Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6503ccf
add Tree component
silviuaavram Aug 6, 2019
399600b
some progress on the handlers
silviuaavram Aug 6, 2019
d46d3b4
fixed left-right navigation
silviuaavram Aug 8, 2019
bc3d663
fixed more expand/collapse logic
silviuaavram Aug 8, 2019
8a15e9a
add styles
silviuaavram Aug 9, 2019
7338e35
call onActiveItemsChange after state change
silviuaavram Aug 9, 2019
6f009f4
remove react-virtualized
silviuaavram Aug 9, 2019
752647e
fixed posinset in title behavior
silviuaavram Aug 9, 2019
3b81e15
fix prop name in onActiveItemsChange call
silviuaavram Aug 9, 2019
d7311c0
behavior renames
silviuaavram Aug 9, 2019
1b11bd4
refactor tree state
silviuaavram Aug 12, 2019
8206641
removed autocontrolled for now
silviuaavram Aug 12, 2019
c948c33
some minor code improvements
silviuaavram Aug 12, 2019
12e2c0a
Merge branch 'master' into feat/flat-tree-component
silviuaavram Aug 12, 2019
ed0abc9
fix behavior tests
silviuaavram Aug 12, 2019
63e98e9
renamed to fix tests
silviuaavram Aug 12, 2019
2285c13
Merge branch 'master' into feat/flat-tree-component
silviuaavram Aug 13, 2019
4055112
only keep in memory refs that are needed
silviuaavram Aug 13, 2019
ed465cd
Merge branch 'feat/flat-tree-component' of https://github.com/stardus…
silviuaavram Aug 13, 2019
0122b71
Merge branch 'master' into feat/flat-tree-component
silviuaavram Aug 15, 2019
b130216
Merge branch 'master' into feat/flat-tree-component
silviuaavram Aug 22, 2019
dc04257
remove mutations from items
silviuaavram Aug 23, 2019
ed860d2
fix props and comments
silviuaavram Aug 23, 2019
9406533
Merge branch 'master' into feat/flat-tree-component
silviuaavram Aug 23, 2019
e2a5626
fixed title render
silviuaavram Aug 26, 2019
7ea01ae
enhance hasSubtree condition
silviuaavram Aug 26, 2019
816b036
fixed some variables
silviuaavram Aug 26, 2019
aba11ae
some checks and comments
silviuaavram Aug 26, 2019
06195ae
Merge branch 'master' into feat/flat-tree-component
silviuaavram Aug 26, 2019
62771be
fixed exclusive
silviuaavram Aug 26, 2019
131b425
small change in example
silviuaavram Aug 26, 2019
50a3f47
some changes in props
silviuaavram Aug 26, 2019
a06a00f
add initialOpen prop
silviuaavram Aug 26, 2019
7886d1a
add some comments
silviuaavram Aug 26, 2019
a0946fe
add autocontrolled back to Tree
silviuaavram Aug 26, 2019
81b8216
add tests and fix asterisk expand bug
silviuaavram Aug 27, 2019
891877e
Merge branch 'master' into feat/flat-tree-component
silviuaavram Aug 27, 2019
7d127fb
refactored the state logic
silviuaavram Aug 28, 2019
1883352
fixed examples
silviuaavram Aug 29, 2019
01e0535
fixed some a11y issues
silviuaavram Aug 29, 2019
dc19756
extracted logic into a method
silviuaavram Aug 29, 2019
424a866
fixed initial open state
silviuaavram Aug 29, 2019
49d35fd
fixed duplicated key
silviuaavram Aug 29, 2019
92f5fb4
fixed some comments
silviuaavram Aug 29, 2019
a761e1a
Merge branch 'master' into feat/flat-tree-component
silviuaavram Aug 29, 2019
0339f9f
prevent mutation
silviuaavram Aug 29, 2019
ef331cb
Merge branch 'feat/flat-tree-component' of https://github.com/stardus…
silviuaavram Aug 29, 2019
6e88bc4
updates on tree item state
silviuaavram Aug 29, 2019
a14f76a
fix behavior tests
silviuaavram Aug 29, 2019
8633f0e
fixed a bad interface name
silviuaavram Aug 29, 2019
eb92577
small improvements
silviuaavram Aug 29, 2019
d15756a
using lib methods
silviuaavram Aug 29, 2019
d5304f2
more code review
silviuaavram Aug 29, 2019
2d2a1cd
move some examples to usage
silviuaavram Aug 29, 2019
0af9a41
Merge branch 'master' into feat/flat-tree-component
silviuaavram Aug 29, 2019
78a9d4f
Merge branch 'feat/flat-tree-component' of https://github.com/stardus…
silviuaavram Aug 29, 2019
84a2068
last round of review
silviuaavram Aug 29, 2019
2de17c2
Update docs/src/examples/components/Tree/Usage/index.tsx
layershifter Aug 29, 2019
8001b8c
add changelog
silviuaavram Aug 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### Features
- Add `yellow`, `green`, `orange`, `pink`, `amethyst`, `silver` and `onyx` color schemes in Teams theme @mnajdova ([#1826](https://github.com/stardust-ui/react/pull/1826))
- Add `Tree` component that is flat DOM structured @silviuavram ([#1779](https://github.com/stardust-ui/react/pull/1779))

### Fixes
- Fix `muted` prop in `Video` component @layershifter ([#1847](https://github.com/stardust-ui/react/pull/1847))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import * as React from 'react'
import { Tree } from '@stardust-ui/react'

const items = [
{
id: '1',
title: 'House Lannister',
items: [
{
id: '11',
title: 'Tywin',
items: [
{
id: '111',
title: 'Jaime',
},
{
id: '112',
title: 'Cersei',
},
{
id: '113',
title: 'Tyrion',
},
],
},
{
id: '12',
title: 'Kevan',
items: [
{
id: '121',
title: 'Lancel',
},
{
id: '122',
title: 'Willem',
},
{
id: '123',
title: 'Martyn',
},
],
},
],
},
{
id: '2',
title: 'House Targaryen',
items: [
{
id: '21',
title: 'Aerys',
items: [
{
id: '211',
title: 'Rhaegar',
},
{
id: '212',
title: 'Viserys',
},
{
id: '213',
title: 'Daenerys',
},
],
},
],
},
]

const TreeExampleShorthand = () => <Tree items={items} />

export default TreeExampleShorthand
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import * as React from 'react'
import { Icon, Tree } from '@stardust-ui/react'

const items = [
{
id: '1',
title: 'one',
items: [
{
id: '2',
title: 'one one',
items: [
{
id: '3',
title: 'one one one',
},
],
},
{
id: '6',
title: 'one two',
items: [
{
id: '7',
title: 'one two one',
},
],
},
],
},
{
id: '4',
title: 'two',
items: [
{
id: '5',
title: 'two one',
},
],
},
]

const titleRenderer = (Component, { content, open, hasSubtree, ...restProps }) => (
<Component open={open} hasSubtree={hasSubtree} {...restProps}>
{hasSubtree && <Icon name={open ? 'triangle-down' : 'triangle-right'} />}
<span>{content}</span>
</Component>
)

const TreeExclusiveExample = () => <Tree items={items} renderItemTitle={titleRenderer} exclusive />

export default TreeExclusiveExample
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import * as React from 'react'
import { Tree } from '@stardust-ui/react'

const items = [
{
id: '1',
title: 'House Lannister',
items: [
{
id: '11',
title: 'Tywin',
items: [
{
id: '111',
title: 'Jaime',
},
{
id: '112',
title: 'Cersei',
},
{
id: '113',
title: 'Tyrion',
},
],
},
{
id: '12',
title: 'Kevan',
items: [
{
id: '121',
title: 'Lancel',
},
{
id: '122',
title: 'Willem',
},
{
id: '123',
title: 'Martyn',
},
],
},
],
},
{
id: '2',
title: 'House Targaryen',
items: [
{
id: '21',
title: 'Aerys',
items: [
{
id: '211',
title: 'Rhaegar',
},
{
id: '212',
title: 'Viserys',
},
{
id: '213',
title: 'Daenerys',
},
],
},
],
},
]

const TreeInitiallyOpenExampleShorthand = () => (
<Tree items={items} defaultActiveItemIds={['1', '12', '2']} />
)

export default TreeInitiallyOpenExampleShorthand
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import * as React from 'react'
import { Icon, Tree } from '@stardust-ui/react'

const items = [
{
id: '1',
title: 'one',
items: [
{
id: '2',
title: 'one one',
items: [
{
id: '3',
title: 'one one one',
},
],
},
],
},
{
id: '4',
title: 'two',
items: [
{
id: '5',
title: 'two one',
},
],
},
]

const titleRenderer = (Component, { content, open, hasSubtree, ...restProps }) => (
<Component open={open} hasSubtree={hasSubtree} {...restProps}>
{hasSubtree && <Icon name={open ? 'triangle-down' : 'triangle-right'} />}
<span>{content}</span>
</Component>
)

const TreeTitleCustomizationExample = () => <Tree items={items} renderItemTitle={titleRenderer} />

export default TreeTitleCustomizationExample
20 changes: 20 additions & 0 deletions docs/src/examples/components/Tree/Types/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as React from 'react'
import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'

const Types = () => (
<ExampleSection title="Types">
<ComponentExample
title="Default"
description="A default Tree."
examplePath="components/Tree/Types/TreeExample"
/>
<ComponentExample
title="Exclusive"
description="A Tree with only one subtree open at a time."
examplePath="components/Tree/Types/TreeExclusiveExample"
/>
</ExampleSection>
)

export default Types
21 changes: 21 additions & 0 deletions docs/src/examples/components/Tree/Usage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as React from 'react'

import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'

const Usage = () => (
<ExampleSection title="Usage">
<ComponentExample
title="Custom Title"
description="A Tree with customized title rendering."
examplePath="components/Tree/Types/TreeTitleCustomizationExample"
/>
<ComponentExample
title="Initially Open"
description="A Tree with some items initially open."
examplePath="components/Tree/Types/TreeInitiallyOpenExample"
/>
</ExampleSection>
)

export default Usage
10 changes: 10 additions & 0 deletions docs/src/examples/components/Tree/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from 'react'
import Types from './Types'

const TreeExamples = () => (
<>
<Types />
</>
)

export default TreeExamples
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class HierarchicalTree extends AutoControlledComponent<
exclusive: PropTypes.bool,
items: customPropTypes.collectionShorthand,
renderItemTitle: PropTypes.func,
rtlAttributes: PropTypes.func,
onActiveIndexChange: PropTypes.func,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class HierarchicalTreeItem extends UIComponent<WithAsProp<HierarchicalTreeItemPr
onTitleClick: PropTypes.func,
open: PropTypes.bool,
renderItemTitle: PropTypes.func,
treeItemRtlAttributes: PropTypes.func,
title: customPropTypes.itemShorthand,
}

Expand Down
Loading