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

Fix Picker and ComboBox press state, Table types + docs #7086

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

devongovett
Copy link
Member

Noticed that Picker and ComboBox were getting stuck in the down state when open. That's due to RAC setting isPressed when they are open. Not sure what changed since the last release where this didn't happen, but it does now...

Fixed the storybook controls for Table not appearing correctly (it doesn't seem to like forwardRefType, which was unnecessary in this case. only needed when there are generics). Also exported Table components and props from the package and fixed the props for TableHeader to exclude className and style.

@rspbot
Copy link

rspbot commented Sep 25, 2024

@rspbot
Copy link

rspbot commented Sep 25, 2024

## API Changes

@react-spectrum/s2

/@react-spectrum/s2:Table

+Table {
+  UNSAFE_className?: string
+  UNSAFE_style?: CSSProperties
+  aria-describedby?: string
+  aria-details?: string
+  aria-label?: string
+  aria-labelledby?: string
+  children?: ReactNode
+  defaultSelectedKeys?: 'all' | Iterable<Key>
+  density?: 'compact' | 'spacious' | 'regular' = 'regular'
+  disabledKeys?: Iterable<Key>
+  disallowEmptySelection?: boolean
+  isQuiet?: boolean
+  loadingState?: LoadingState
+  onAction?: (Key) => void
+  onLoadMore?: () => any
+  onResize?: (Map<Key, ColumnSize>) => void
+  onResizeEnd?: (Map<Key, ColumnSize>) => void
+  onResizeStart?: (Map<Key, ColumnSize>) => void
+  onSelectionChange?: (Selection) => void
+  onSortChange?: (SortDescriptor) => any
+  overflowMode?: 'wrap' | 'truncate' = 'truncate'
+  selectedKeys?: 'all' | Iterable<Key>
+  selectionMode?: SelectionMode
+  slot?: string | null
+  sortDescriptor?: SortDescriptor
+  styles?: StylesPropWithHeight
+}

/@react-spectrum/s2:TableHeader

+TableHeader <T extends {}> {
+  children?: ReactNode | (T) => ReactElement
+  columns?: Array<T>
+  onHoverChange?: (boolean) => void
+  onHoverEnd?: (HoverEvent) => void
+  onHoverStart?: (HoverEvent) => void
+}

/@react-spectrum/s2:TableBody

+TableBody <T extends {}> {
+  children?: ReactNode | (T) => ReactNode
+  disabledKeys?: Iterable<Key>
+  items?: Iterable<T>
+  renderEmptyState?: (TableBodyRenderProps) => ReactNode
+}

/@react-spectrum/s2:Row

+Row <T extends {}> {
+  children?: ReactNode | (T) => ReactElement
+  columns?: Iterable<T>
+  id?: Key
+  textValue?: string
+}

/@react-spectrum/s2:Cell

+Cell {
+  align?: 'start' | 'center' | 'end' = 'start'
+  children: ReactNode
+  className?: string | ((CellRenderProps & {
+    defaultClassName: string | undefined
+})) => string
+  id?: Key
+  showDivider?: boolean
+  style?: CSSProperties | ((CellRenderProps & {
+    defaultStyle: CSSProperties
+})) => CSSProperties | undefined
+  textValue?: string
+}

/@react-spectrum/s2:Column

+Column {
+  align?: 'start' | 'center' | 'end' = 'start'
+  allowsResizing?: boolean
+  allowsSorting?: boolean
+  children: ReactNode
+  className?: string | ((ColumnRenderProps & {
+    defaultClassName: string | undefined
+})) => string
+  defaultWidth?: ColumnSize | null
+  id?: Key
+  isRowHeader?: boolean
+  maxWidth?: ColumnStaticSize | null
+  minWidth?: ColumnStaticSize | null
+  showDivider?: boolean
+  style?: CSSProperties | ((ColumnRenderProps & {
+    defaultStyle: CSSProperties
+})) => CSSProperties | undefined
+  textValue?: string
+  width?: ColumnSize | null
+}

/@react-spectrum/s2:TableProps

+TableProps {
+  UNSAFE_className?: string
+  UNSAFE_style?: CSSProperties
+  aria-describedby?: string
+  aria-details?: string
+  aria-label?: string
+  aria-labelledby?: string
+  children?: ReactNode
+  defaultSelectedKeys?: 'all' | Iterable<Key>
+  density?: 'compact' | 'spacious' | 'regular' = 'regular'
+  disabledKeys?: Iterable<Key>
+  disallowEmptySelection?: boolean
+  isQuiet?: boolean
+  loadingState?: LoadingState
+  onAction?: (Key) => void
+  onLoadMore?: () => any
+  onResize?: (Map<Key, ColumnSize>) => void
+  onResizeEnd?: (Map<Key, ColumnSize>) => void
+  onResizeStart?: (Map<Key, ColumnSize>) => void
+  onSelectionChange?: (Selection) => void
+  onSortChange?: (SortDescriptor) => any
+  overflowMode?: 'wrap' | 'truncate' = 'truncate'
+  selectedKeys?: 'all' | Iterable<Key>
+  selectionMode?: SelectionMode
+  slot?: string | null
+  sortDescriptor?: SortDescriptor
+  styles?: StylesPropWithHeight
+}

/@react-spectrum/s2:TableHeaderProps

+TableHeaderProps <T> {
+  children?: ReactNode | (T) => ReactElement
+  columns?: Array<T>
+  onHoverChange?: (boolean) => void
+  onHoverEnd?: (HoverEvent) => void
+  onHoverStart?: (HoverEvent) => void
+}

/@react-spectrum/s2:TableBodyProps

+TableBodyProps <T> {
+  children?: ReactNode | (T) => ReactNode
+  disabledKeys?: Iterable<Key>
+  items?: Iterable<T>
+  renderEmptyState?: (TableBodyRenderProps) => ReactNode
+}

/@react-spectrum/s2:RowProps

+RowProps <T> {
+  children?: ReactNode | (T) => ReactElement
+  columns?: Iterable<T>
+  id?: Key
+  textValue?: string
+}

/@react-spectrum/s2:CellProps

+CellProps {
+  align?: 'start' | 'center' | 'end' = 'start'
+  children: ReactNode
+  className?: string | ((CellRenderProps & {
+    defaultClassName: string | undefined
+})) => string
+  id?: Key
+  showDivider?: boolean
+  style?: CSSProperties | ((CellRenderProps & {
+    defaultStyle: CSSProperties
+})) => CSSProperties | undefined
+  textValue?: string
+}

/@react-spectrum/s2:ColumnProps

+ColumnProps {
+  align?: 'start' | 'center' | 'end' = 'start'
+  allowsResizing?: boolean
+  allowsSorting?: boolean
+  children: ReactNode
+  className?: string | ((ColumnRenderProps & {
+    defaultClassName: string | undefined
+})) => string
+  defaultWidth?: ColumnSize | null
+  id?: Key
+  isRowHeader?: boolean
+  maxWidth?: ColumnStaticSize | null
+  minWidth?: ColumnStaticSize | null
+  showDivider?: boolean
+  style?: CSSProperties | ((ColumnRenderProps & {
+    defaultStyle: CSSProperties
+})) => CSSProperties | undefined
+  textValue?: string
+  width?: ColumnSize | null
+}

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bummer about the pressed state :-/

@devongovett devongovett added this pull request to the merge queue Sep 26, 2024
Merged via the queue into main with commit 4357081 Sep 26, 2024
29 checks passed
@devongovett devongovett deleted the release-fixes branch September 26, 2024 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants