Conversation
docs/src/examples/components/Tree/Types/TreeTitleCustomizationExample.shorthand.tsx
Outdated
Show resolved
Hide resolved
docs/src/examples/components/Tree/Types/TreeExclusiveExample.shorthand.tsx
Outdated
Show resolved
Hide resolved
packages/react/src/lib/accessibility/Behaviors/Tree/treeBehavior.ts
Outdated
Show resolved
Hide resolved
packages/react/src/themes/teams-dark/components/Tree/treeTitleVariables.ts
Outdated
Show resolved
Hide resolved
ae93151 to
1b11bd4
Compare
|
|
||
| static getDerivedStateFromProps(props: TreeItemProps) { | ||
| return { | ||
| hasSubtree: Tree.hasSubtree(props), |
There was a problem hiding this comment.
ERROR in packages/react/dist/es/components/Tree/Tree.js -> packages/react/dist/es/components/Tree/TreeItem.js -> packages/react/dist/es/components/Tree/Tree.js
This create a circular reference, I suggest to create a simple function as there are no context requirements and move it to Tree/lib/hasSubtree.ts:
| hasSubtree: Tree.hasSubtree(props), | |
| hasSubtree: hasSubtree(props), |
|
|
||
| export default (siteVars: any): TreeTitleVariables => { | ||
| return { | ||
| defaultColor: siteVars.colors.grey[750], |
There was a problem hiding this comment.
https://stardust-ui.github.io/react/color-schemes
This color perfectly maps foreground from default, can we use it? And we will be to remove variable overrides in Dark and HC themes.
I also suggest to rename it to color to match our variable naming convention:
| defaultColor: siteVars.colors.grey[750], | |
| color: siteVars.colorScheme.default.foreground, |
| @@ -0,0 +1,7 @@ | |||
| import { TreeTitleVariables } from '../../../teams/components/Tree/treeTitleVariables' | |||
There was a problem hiding this comment.
| return { | ||
| defaultColor: siteVars.colors.white, | ||
| } | ||
| } |
There was a problem hiding this comment.
|
|
||
| const treeTitleStyles = { | ||
| root: ({ variables, theme: { siteVariables } }): ICSSInJSStyle => ({ | ||
| padding: `${pxToRem(1)} 0`, |
There was a problem hiding this comment.
Can we move this to variables?
| padding: `${pxToRem(1)} 0`, | |
| padding: v.padding, |
| root: ({ variables, theme: { siteVariables } }): ICSSInJSStyle => ({ | ||
| padding: `${pxToRem(1)} 0`, | ||
| cursor: 'pointer', | ||
| color: variables.defaultColor, |
There was a problem hiding this comment.
| color: variables.defaultColor, | |
| color: v.color, |
https://github.com/stardust-ui/react/pull/1779/files#r319038491
| import getBorderFocusStyles from '../../getBorderFocusStyles' | ||
|
|
||
| const treeTitleStyles = { | ||
| root: ({ variables, theme: { siteVariables } }): ICSSInJSStyle => ({ |
There was a problem hiding this comment.
| root: ({ variables, theme: { siteVariables } }): ICSSInJSStyle => ({ | |
| root: ({ variables: v, theme: { siteVariables } }): ICSSInJSStyle => ({ |
Let's use v.* naming
| @@ -0,0 +1,9 @@ | |||
| export interface TreeTitleVariables { | |||
| defaultColor: string | |||
There was a problem hiding this comment.
| defaultColor: string | |
| color: string |
https://github.com/stardust-ui/react/pull/1779/files#r319038491
| testMethod: (parameters: TestMethod) => { | ||
| const [action, key, elementToPerformAction] = [...parameters.props] | ||
| const propertyOpenedSubtree = { open: true, items: [{ a: 1 }] } | ||
| const propertyOpenedSubtree = { open: true, items: [{ a: 1 }], siblings: [], hasSubtree: true } |
There was a problem hiding this comment.
| const propertyOpenedSubtree = { open: true, items: [{ a: 1 }], siblings: [], hasSubtree: true } | |
| const propertyOpenedSubtree = { open: true, hasSubtree: true } |
I think that is not required anymore
There was a problem hiding this comment.
still required as it will be used for the Hierarchical tree tests.
| import TreeTitle from '../../../../components/Tree/TreeTitle' | ||
|
|
||
| const treeItemStyles: ComponentSlotStylesInput<TreeItemProps> = { | ||
| root: ({ theme: { siteVariables }, props: { level } }): ICSSInJSStyle => ({ |
There was a problem hiding this comment.
| root: ({ theme: { siteVariables }, props: { level } }): ICSSInJSStyle => ({ | |
| root: ({ theme: { siteVariables }, props: p } }): ICSSInJSStyle => ({ |
Please use p.* naming
…t-ui/react into feat/flat-tree-component
|
Merging this. We can create issues to follow up, if any. |
Since now this tree may be virtualized, subtree open/closed state should be kept only on the main
Tree, as other Items/Titles/Trees can be removed during the virtualisation process. Also removed sub-trees altogether and kept only the first Tree.The Tree renders TreeItems which in turn render TreeTitles. open/close logic is kept on the main
Treestate in a Map. Each item has an id (map key) and we keep its ref and open/close state as map object value.At Tree constructor time, all items will receive props that should not be changed by the user, as they are used in aria attribute generation, keyboard navigation and collapsing/expansion. These are: level, siblings, index, parent. Each item will receive these props.
Each item will pass level, treeSize, index to the TreeTitle (for aria attribute generation in the behavior).
idis now required from the user for reach tree item.