Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: S2 treeview #7343

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

feat: S2 treeview #7343

wants to merge 26 commits into from

Conversation

snowystinger
Copy link
Member

@snowystinger snowystinger commented Nov 8, 2024

Closes

This only implements two of the combinations of isDetached/isEmphasized/Checkbox Selection.

  • isDetached + checkbox selection or no selection -> seemed mostly clear cut
  • isEmphasized + checkbox selection or no selection -> matches table
    The others aren't well defined enough yet to implement.

Virtualization coming soon.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@snowystinger snowystinger marked this pull request as ready for review December 3, 2024 05:09
@snowystinger snowystinger changed the title [WIP] - S2 treeview S2 treeview Dec 3, 2024
@rspbot
Copy link

rspbot commented Dec 3, 2024

@snowystinger snowystinger changed the title S2 treeview feature: S2 treeview Dec 3, 2024
@snowystinger snowystinger changed the title feature: S2 treeview feat: S2 treeview Dec 3, 2024
@rspbot
Copy link

rspbot commented Dec 3, 2024

@rspbot
Copy link

rspbot commented Dec 3, 2024

## API Changes

react-aria-components

/react-aria-components:TreeItemContentRenderProps

 TreeItemContentRenderProps {
   allowsDragging?: boolean
   hasChildRows: boolean
+  id: Key
   isDisabled: boolean
   isDragging?: boolean
   isDropTarget?: boolean
   isExpanded: boolean
   isFocusVisible: boolean
   isFocusVisibleWithin: boolean
   isFocused: boolean
   isHovered: boolean
   isPressed: boolean
   isSelected: boolean
   level: number
   selectionBehavior: SelectionBehavior
   selectionMode: SelectionMode
+  state: TreeState<unknown>
 }

@react-spectrum/s2

/@react-spectrum/s2:TreeView

+TreeView {
+  UNSAFE_className?: string
+  UNSAFE_style?: CSSProperties
+  aria-describedby?: string
+  aria-details?: string
+  aria-label?: string
+  aria-labelledby?: string
+  children?: ReactNode | (T) => ReactNode
+  defaultExpandedKeys?: Iterable<Key>
+  defaultSelectedKeys?: 'all' | Iterable<Key>
+  dependencies?: Array<any>
+  disabledBehavior?: DisabledBehavior = 'selection'
+  disabledKeys?: Iterable<Key>
+  disallowEmptySelection?: boolean
+  expandedKeys?: Iterable<Key>
+  id?: string
+  isDetached?: boolean
+  isEmphasized?: boolean
+  items?: Iterable<T>
+  onAction?: (Key) => void
+  onExpandedChange?: (Set<Key>) => any
+  onSelectionChange?: (Selection) => void
+  renderEmptyState?: (TreeEmptyStateRenderProps) => ReactNode
+  selectedKeys?: 'all' | Iterable<Key>
+  selectionMode?: SelectionMode
+  slot?: string | null
+  styles?: StylesPropWithHeight
+}

/@react-spectrum/s2:TreeViewItem

+TreeViewItem <T extends {}> {
+  aria-label?: string
+  childItems?: Iterable<{}>
+  children: ReactNode
+  download?: boolean | string
+  hasChildItems?: boolean
+  href?: Href
+  hrefLang?: string
+  id?: Key
+  onHoverChange?: (boolean) => void
+  onHoverEnd?: (HoverEvent) => void
+  onHoverStart?: (HoverEvent) => void
+  ping?: string
+  referrerPolicy?: HTMLAttributeReferrerPolicy
+  rel?: string
+  routerOptions?: RouterOptions
+  target?: HTMLAttributeAnchorTarget
+  textValue: string
+  value?: T
+}

/@react-spectrum/s2:TreeViewProps

+TreeViewProps {
+  UNSAFE_className?: string
+  UNSAFE_style?: CSSProperties
+  aria-describedby?: string
+  aria-details?: string
+  aria-label?: string
+  aria-labelledby?: string
+  children?: ReactNode | (T) => ReactNode
+  defaultExpandedKeys?: Iterable<Key>
+  defaultSelectedKeys?: 'all' | Iterable<Key>
+  dependencies?: Array<any>
+  disabledBehavior?: DisabledBehavior = 'selection'
+  disabledKeys?: Iterable<Key>
+  disallowEmptySelection?: boolean
+  expandedKeys?: Iterable<Key>
+  id?: string
+  isDetached?: boolean
+  isEmphasized?: boolean
+  items?: Iterable<T>
+  onAction?: (Key) => void
+  onExpandedChange?: (Set<Key>) => any
+  onSelectionChange?: (Selection) => void
+  renderEmptyState?: (TreeEmptyStateRenderProps) => ReactNode
+  selectedKeys?: 'all' | Iterable<Key>
+  selectionMode?: SelectionMode
+  slot?: string | null
+  styles?: StylesPropWithHeight
+}

/@react-spectrum/s2:TreeViewItemProps

+TreeViewItemProps <T extends {} = {}> {
+  aria-label?: string
+  childItems?: Iterable<{}>
+  children: ReactNode
+  download?: boolean | string
+  hasChildItems?: boolean
+  href?: Href
+  hrefLang?: string
+  id?: Key
+  onHoverChange?: (boolean) => void
+  onHoverEnd?: (HoverEvent) => void
+  onHoverStart?: (HoverEvent) => void
+  ping?: string
+  referrerPolicy?: HTMLAttributeReferrerPolicy
+  rel?: string
+  routerOptions?: RouterOptions
+  target?: HTMLAttributeAnchorTarget
+  textValue: string
+  value?: T
+}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants