@spark-ui/components 17.5.3 → 17.5.4-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/avatar/index.js +1 -1
  2. package/dist/avatar/index.js.map +1 -1
  3. package/dist/avatar/index.mjs +9 -11
  4. package/dist/avatar/index.mjs.map +1 -1
  5. package/dist/carousel/index.js +1 -1
  6. package/dist/carousel/index.js.map +1 -1
  7. package/dist/carousel/index.mjs +23 -31
  8. package/dist/carousel/index.mjs.map +1 -1
  9. package/dist/file-upload/index.js +1 -1
  10. package/dist/file-upload/index.js.map +1 -1
  11. package/dist/file-upload/index.mjs +33 -38
  12. package/dist/file-upload/index.mjs.map +1 -1
  13. package/dist/form-field/index.js +1 -1
  14. package/dist/form-field/index.mjs +1 -1
  15. package/dist/{form-field-GTAuK_nO.mjs → form-field-BnzHTgp6.mjs} +3 -3
  16. package/dist/{form-field-GTAuK_nO.mjs.map → form-field-BnzHTgp6.mjs.map} +1 -1
  17. package/dist/{form-field-81wzFxM0.js → form-field-Du1Ebx6v.js} +2 -2
  18. package/dist/{form-field-81wzFxM0.js.map → form-field-Du1Ebx6v.js.map} +1 -1
  19. package/dist/input/index.js +1 -1
  20. package/dist/input/index.mjs +1 -1
  21. package/dist/input-DaShg4eE.js +2 -0
  22. package/dist/{input-BUSYZ_VO.js.map → input-DaShg4eE.js.map} +1 -1
  23. package/dist/{input-CiWFuTs_.mjs → input-Dtabf6Mp.mjs} +17 -17
  24. package/dist/{input-CiWFuTs_.mjs.map → input-Dtabf6Mp.mjs.map} +1 -1
  25. package/dist/pagination/index.js +1 -1
  26. package/dist/pagination/index.js.map +1 -1
  27. package/dist/pagination/index.mjs +7 -7
  28. package/dist/pagination/index.mjs.map +1 -1
  29. package/dist/rating/index.js +1 -1
  30. package/dist/rating/index.js.map +1 -1
  31. package/dist/rating/index.mjs +2 -2
  32. package/dist/rating/index.mjs.map +1 -1
  33. package/dist/stepper/index.js +1 -1
  34. package/dist/stepper/index.mjs +1 -1
  35. package/dist/table/index.js.map +1 -1
  36. package/dist/table/index.mjs.map +1 -1
  37. package/dist/textarea/index.js +1 -1
  38. package/dist/textarea/index.mjs +1 -1
  39. package/package.json +5 -5
  40. package/dist/input-BUSYZ_VO.js +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/table/internal/TableContext.tsx","../../src/table/internal/TableRootWrapper.tsx","../../src/table/internal/ResizableTableContainer.tsx","../../src/table/internal/table-keyboard.ts","../../src/table/internal/Table.styles.tsx","../../src/table/internal/table-utils.ts","../../src/table/internal/TableKeyboardModeContext.tsx","../../src/table/internal/TableSelectionCheckbox.tsx","../../src/table/internal/TableBodyCellRenderer.tsx","../../src/table/internal/TableBodyRowRenderer.tsx","../../src/table/internal/TableColumnResizer.tsx","../../src/table/internal/TableHeaderSelectionCheckbox.tsx","../../src/table/internal/TableColumnHeader.tsx","../../src/table/internal/TableHeaderRowRenderer.tsx","../../src/table/internal/TableRoot.tsx","../../src/table/internal/TableGrid.tsx","../../src/table/TableBody.tsx","../../src/table/TableBulkBar.tsx","../../src/table/TableCell.tsx","../../src/table/TableColumn.tsx","../../src/table/TableHeader.tsx","../../src/table/TableRow.tsx","../../src/table/useTableSort.ts","../../src/table/useTablePagination.ts","../../src/table/index.ts"],"sourcesContent":["import type { GridNode } from '@react-types/grid'\nimport type { Selection } from '@react-types/shared'\nimport type { SortDescriptor } from '@react-types/shared'\nimport { createContext, useContext } from 'react'\n\nimport type { ResizableTableContainerProps } from './ResizableTableContainer'\n\nexport interface TableResizableContextValue {\n isResizable: boolean\n tableWidth: number\n}\n\nexport const TableResizableContext = createContext<TableResizableContextValue>({\n isResizable: false,\n tableWidth: 0,\n})\n\nexport function useTableResizableContext() {\n return useContext(TableResizableContext)\n}\n\n/** Values provided by Table (root) and consumed by Table.Grid and Table.BulkBar. */\nexport interface TableContextValue {\n onResizeStart?: ResizableTableContainerProps['onResizeStart']\n onResize?: ResizableTableContainerProps['onResize']\n onResizeEnd?: ResizableTableContainerProps['onResizeEnd']\n // Selection (optional when table has no selection)\n selectionMode?: 'none' | 'single' | 'multiple'\n selectionBehavior?: 'toggle' | 'replace'\n selectedKeys?: Selection\n onSelectionChange?: (keys: Selection) => void\n // BulkBar: optional when not using BulkBar\n totalCount?: number\n hasMultiplePages?: boolean\n onSelectAll?: () => void\n // Derived for BulkBar (from selectedKeys + onSelectionChange)\n selectedCount: number\n onClearSelection: () => void\n // Layout / grid\n allowsResizing?: boolean\n /** `aria-label` for column resizer control. */\n resizeColumnAriaLabel?: string | ((column: GridNode<unknown>) => string)\n maxHeight?: number | string\n stickyHeader?: boolean\n onKeyDownCapture?: React.KeyboardEventHandler<Element>\n sortDescriptor?: SortDescriptor\n onSortChange?: (descriptor: SortDescriptor) => void\n className?: string\n // Pass-through for AriaTable (aria-label, etc.)\n [key: string]: unknown\n}\n\nconst defaultTableContextValue: TableContextValue = {\n selectedCount: 0,\n onClearSelection: () => {},\n}\n\nexport const TableContext = createContext<TableContextValue>(defaultTableContextValue)\n\nexport function useTableContext(): TableContextValue {\n return useContext(TableContext)\n}\n","import type { GridNode } from '@react-types/grid'\nimport type { Key, SelectionBehavior } from '@react-types/shared'\nimport type { ColumnSize } from '@react-types/table'\nimport type { TableProps as AriaTableProps } from '@react-types/table'\nimport { cx } from 'class-variance-authority'\nimport type { ReactNode } from 'react'\n\nimport { TableContext, type TableContextValue } from './TableContext'\n\nexport interface TableProps extends Omit<AriaTableProps<object>, 'children' | 'className'> {\n className?: string\n selectionBehavior?: SelectionBehavior\n onKeyDownCapture?: React.KeyboardEventHandler<Element>\n /** When true (default), columns can be resized. Pass onResizeStart, onResize, onResizeEnd to react to resize events. */\n allowsResizing?: boolean\n /** `aria-label` for the column resize control (for i18n). */\n resizeColumnAriaLabel?: string | ((column: GridNode<unknown>) => string)\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void\n onResize?: (widths: Map<Key, ColumnSize>) => void\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n /** Max height of the scroll container (number in px or CSS value). Applied so vertical and horizontal scrollbars share the same container. */\n maxHeight?: number | string\n /** When true, header cells use `position: sticky` inside the scroll container (pair with `maxHeight`). */\n stickyHeader?: boolean\n /** For BulkBar: total number of items (e.g. for \"Select all X items\"). */\n totalCount?: number\n /** When true, BulkBar shows \"Clear all\" and \"Select all\" buttons. */\n hasMultiplePages?: boolean\n /**\n * Called when user clicks \"Clear all\" in BulkBar.\n * Useful with pagination selection models (e.g. `useTablePagination`) where clearing only the\n * current page would be incorrect.\n */\n onClearSelection?: () => void\n /** Called when user clicks \"Select all\" in BulkBar. */\n onSelectAll?: () => void\n}\n\nexport interface TableRootWrapperProps extends TableProps {\n children: ReactNode\n}\n\n/**\n * A data table component that displays information in rows and columns with support for sorting, selection, and resizing.\n */\nexport function TableRootWrapper({\n children,\n className,\n selectedKeys,\n onSelectionChange,\n totalCount,\n hasMultiplePages,\n onClearSelection: onClearSelectionProp,\n onSelectAll,\n allowsResizing = true,\n resizeColumnAriaLabel,\n maxHeight,\n stickyHeader,\n onResizeStart,\n onResize,\n onResizeEnd,\n onKeyDownCapture,\n sortDescriptor,\n onSortChange,\n ...restProps\n}: TableRootWrapperProps) {\n let selectedCount = 0\n\n if (selectedKeys === 'all') {\n selectedCount = totalCount ?? 0\n } else if (selectedKeys instanceof Set) {\n selectedCount = selectedKeys.size\n } else if (selectedKeys) {\n selectedCount = new Set(selectedKeys).size\n }\n const onClearSelection = onClearSelectionProp ?? (() => onSelectionChange?.(new Set()))\n\n const contextValue = {\n ...restProps,\n selectedKeys,\n onSelectionChange,\n totalCount,\n hasMultiplePages,\n onSelectAll,\n selectedCount,\n onClearSelection,\n allowsResizing,\n resizeColumnAriaLabel,\n maxHeight,\n stickyHeader,\n onResizeStart,\n onResize,\n onResizeEnd,\n onKeyDownCapture,\n sortDescriptor,\n onSortChange,\n className,\n }\n\n return (\n <TableContext.Provider value={contextValue as TableContextValue}>\n <div className={cx('gap-md flex flex-col', className)}>{children}</div>\n </TableContext.Provider>\n )\n}\n\nTableRootWrapper.displayName = 'Table'\n","import { useResizeObserver } from '@react-aria/utils'\nimport type { Key } from '@react-types/shared'\nimport type { ColumnSize } from '@react-types/table'\nimport { cx } from 'class-variance-authority'\nimport type { ComponentPropsWithoutRef } from 'react'\nimport { useLayoutEffect, useRef, useState } from 'react'\n\nimport { TableResizableContext } from './TableContext'\n\nexport interface ResizableTableContainerProps extends ComponentPropsWithoutRef<'div'> {\n className?: string\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void\n onResize?: (widths: Map<Key, ColumnSize>) => void\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n}\n\nexport function ResizableTableContainer({\n className,\n children,\n ...props\n}: ResizableTableContainerProps) {\n const containerRef = useRef<HTMLDivElement>(null)\n const [tableWidth, setTableWidth] = useState(0)\n\n useLayoutEffect(() => {\n const el = containerRef.current\n if (!el) return\n\n const update = () => setTableWidth(el.clientWidth)\n update()\n }, [])\n\n useResizeObserver({\n ref: containerRef,\n onResize: () => {\n const el = containerRef.current\n if (!el) return\n setTableWidth(el.clientWidth)\n },\n })\n\n return (\n <TableResizableContext.Provider value={{ isResizable: true, tableWidth }}>\n <div\n ref={containerRef}\n data-spark-component=\"resizable-table-container\"\n className={cx('relative w-full overflow-auto', className)}\n {...props}\n >\n {children}\n </div>\n </TableResizableContext.Provider>\n )\n}\n\nResizableTableContainer.displayName = 'ResizableTableContainer'\n","// oxlint-disable max-lines-per-function\nimport type { DOMAttributes, FocusableElement } from '@react-types/shared'\nimport type { FocusEventHandler, KeyboardEventHandler, PointerEventHandler, RefObject } from 'react'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { mergeProps } from 'react-aria'\n\ntype KeyboardMode = 'grid' | 'interaction'\n\n// Scope to body cells only so we do not affect header keyboard navigation.\nconst BODY_CELL_SELECTOR = '[data-spark-component=\"table-cell\"]'\n\n/**\n * Collapsible list widgets handle Arrow keys on the focused control (Downshift, native select).\n * - Capture: stopping propagation on the grid would prevent the event from reaching them.\n * - Bubble: useSelectableCollection's grid onKeyDown still runs (target is inside the table), so\n * we must not forward vertical arrows to the collection handler in that case.\n */\nexport function targetIsListboxLikeArrowKeyHandler(target: EventTarget | null): boolean {\n if (!target || !(target instanceof Element)) return false\n return Boolean(\n target.closest(\n '[role=\"combobox\"],select,[data-spark-component=\"dropdown-trigger\"],[data-spark-component=\"combobox-input\"]'\n )\n )\n}\n\n/**\n * Open combobox / dropdown consumes Escape to close the list first (APG pattern).\n * Grid uses onKeyDownCapture on the table element, which runs before the trigger's handlers,\n * so we must not exit interaction mode until aria-expanded is false.\n */\nexport function targetIsOpenComboboxConsumingEscape(target: EventTarget | null): boolean {\n if (!target || !(target instanceof Element)) return false\n const el = target.closest(\n '[role=\"combobox\"],[data-spark-component=\"dropdown-trigger\"],[data-spark-component=\"combobox-input\"]'\n )\n if (!el) return false\n return el.getAttribute('aria-expanded') === 'true'\n}\nconst FOCUSABLE_SELECTOR =\n 'a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]'\n\nfunction getCellFromTarget(target: EventTarget | null): HTMLElement | null {\n if (!target || !(target instanceof Element)) return null\n return (target as Element).closest(BODY_CELL_SELECTOR) as HTMLElement | null\n}\n\n/** Row selection column: checkbox should not switch the grid to interaction (edit) mode. */\nfunction isSelectionBodyCell(cell: HTMLElement): boolean {\n return cell.getAttribute('data-table-cell-kind') === 'selection'\n}\n\nfunction getFocusableDescendants(cell: HTMLElement): HTMLElement[] {\n return Array.from(cell.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter(el => {\n if (el === cell) return false\n if (el.hasAttribute('disabled')) return false\n if (el.getAttribute('aria-disabled') === 'true') return false\n if (el.getAttribute('hidden') !== null) return false\n return true\n })\n}\n\nfunction setDescendantsFocusable(cell: HTMLElement, enabled: boolean) {\n for (const el of getFocusableDescendants(cell)) {\n const key = 'data-prev-tabindex'\n if (!enabled) {\n if (!el.hasAttribute(key)) {\n el.setAttribute(key, el.getAttribute('tabindex') ?? '')\n }\n el.setAttribute('tabindex', '-1')\n } else {\n const prev = el.getAttribute(key)\n if (prev === null) continue\n el.removeAttribute(key)\n if (prev === '') el.removeAttribute('tabindex')\n else el.setAttribute('tabindex', prev)\n }\n }\n}\n\nfunction disableInCellFocusablesForGridMode(table: HTMLTableElement) {\n const cells = Array.from(table.querySelectorAll<HTMLElement>(BODY_CELL_SELECTOR))\n for (const cell of cells) {\n setDescendantsFocusable(cell, false)\n }\n}\n\nexport function useTableKeyboardModes<T extends Element>({\n ref,\n gridProps,\n onKeyDownCapture: userOnKeyDownCapture,\n onFocusCapture: userOnFocusCapture,\n}: {\n ref: RefObject<T | null>\n gridProps: DOMAttributes<FocusableElement> | Record<string, unknown>\n onKeyDownCapture?: KeyboardEventHandler<Element>\n onFocusCapture?: FocusEventHandler<Element>\n}): { gridProps: Record<string, unknown>; keyboardMode: KeyboardMode } {\n const [keyboardMode, setKeyboardMode] = useState<KeyboardMode>('grid')\n const keyboardModeRef = useRef<KeyboardMode>('grid')\n const activeCellRef = useRef<HTMLElement | null>(null)\n /** Pointer on a cell descendant: do not pull focus back to the `td` (grid mode). */\n const skipCellFocusRedirectRef = useRef(false)\n\n const mergedGridProps = useMemo(() => {\n const { onKeyDown: collectionOnKeyDown, ...gridPropsWithoutKeyDown } = gridProps as Record<\n string,\n unknown\n > & {\n onKeyDown?: KeyboardEventHandler<Element>\n }\n\n const enterInteractionModeForCell = (bodyCell: HTMLElement) => {\n activeCellRef.current = bodyCell\n keyboardModeRef.current = 'interaction'\n setKeyboardMode('interaction')\n setDescendantsFocusable(bodyCell, true)\n }\n\n const onBlurCapture: FocusEventHandler<Element> = e => {\n if (keyboardModeRef.current !== 'interaction') return\n const root = ref.current\n if (!root) return\n const next = e.relatedTarget\n if (next instanceof Node && root.contains(next)) return\n\n activeCellRef.current = null\n keyboardModeRef.current = 'grid'\n setKeyboardMode('grid')\n }\n\n const onPointerDownCapture: PointerEventHandler<Element> = e => {\n const cell = getCellFromTarget(e.target)\n if (!cell?.matches(BODY_CELL_SELECTOR)) return\n if (!(e.target instanceof Element)) return\n if (e.target !== cell && cell.contains(e.target)) {\n skipCellFocusRedirectRef.current = true\n }\n }\n\n const onFocusCapture: FocusEventHandler<Element> = e => {\n userOnFocusCapture?.(e)\n\n const skipRedirectFromPointerOnChild = skipCellFocusRedirectRef.current\n skipCellFocusRedirectRef.current = false\n\n const root = ref.current\n const cell = getCellFromTarget(e.target)\n\n if (keyboardModeRef.current === 'interaction' && activeCellRef.current && root) {\n const focusMovedToAnotherBodyCell = Boolean(cell && cell !== activeCellRef.current)\n const focusInsideTableButOutsideActiveCell =\n !cell &&\n e.target instanceof Element &&\n root.contains(e.target) &&\n !activeCellRef.current.contains(e.target)\n\n if (focusMovedToAnotherBodyCell || focusInsideTableButOutsideActiveCell) {\n keyboardModeRef.current = 'grid'\n setKeyboardMode('grid')\n if (focusInsideTableButOutsideActiveCell) {\n activeCellRef.current = null\n }\n }\n }\n\n if (!cell) return\n activeCellRef.current = cell\n\n const focusTarget = e.target instanceof Element ? e.target : null\n const isBodyCell = cell.matches(BODY_CELL_SELECTOR)\n const inGridMode = keyboardModeRef.current === 'grid'\n const focusOnCellDescendant = Boolean(\n focusTarget && focusTarget !== cell && cell.contains(focusTarget)\n )\n const hasInteractiveControls = getFocusableDescendants(cell).length > 0\n\n // Grid roving focus: keep focus on the `td` unless the user pointed at in-cell content.\n if (\n inGridMode &&\n isBodyCell &&\n focusOnCellDescendant &&\n hasInteractiveControls &&\n !skipRedirectFromPointerOnChild\n ) {\n queueMicrotask(() => cell.focus())\n }\n\n // Pointer placed focus on a control: match Enter — interaction mode for this cell.\n if (\n skipRedirectFromPointerOnChild &&\n inGridMode &&\n focusOnCellDescendant &&\n isBodyCell &&\n hasInteractiveControls &&\n !isSelectionBodyCell(cell)\n ) {\n enterInteractionModeForCell(cell)\n }\n }\n\n const onKeyDown: KeyboardEventHandler<Element> = e => {\n // In interaction mode, arrow keys should be handled by the focused control (or ignored),\n // not by the grid's roving focus. We gate on the currently focused element rather than\n // the event target so this still holds for composite controls.\n if (\n keyboardModeRef.current === 'interaction' &&\n (e.key === 'ArrowLeft' ||\n e.key === 'ArrowRight' ||\n e.key === 'ArrowUp' ||\n e.key === 'ArrowDown')\n ) {\n const activeCell = activeCellRef.current\n const focused = document.activeElement\n if (activeCell && focused instanceof Node && activeCell.contains(focused)) {\n return\n }\n }\n if (\n keyboardModeRef.current === 'interaction' &&\n (e.key === 'ArrowUp' || e.key === 'ArrowDown') &&\n targetIsListboxLikeArrowKeyHandler(e.target) &&\n getCellFromTarget(e.target) === activeCellRef.current\n ) {\n return\n }\n collectionOnKeyDown?.(e)\n }\n\n const onKeyDownCapture: KeyboardEventHandler<Element> = e => {\n userOnKeyDownCapture?.(e)\n\n // In interaction mode, allow Tab to move between in-cell controls.\n // React Aria's grid tends to treat Tab as \"leave the grid\", so we stop propagation\n // so the browser can handle normal tabbing inside the active cell.\n if (keyboardModeRef.current === 'interaction' && e.key === 'Tab') {\n const cell = getCellFromTarget(e.target)\n if (cell && cell === activeCellRef.current) {\n e.stopPropagation()\n }\n return\n }\n\n if (\n targetIsListboxLikeArrowKeyHandler(e.target) &&\n keyboardModeRef.current === 'interaction' &&\n (e.key === 'ArrowLeft' ||\n e.key === 'ArrowRight' ||\n e.key === 'ArrowUp' ||\n e.key === 'ArrowDown')\n ) {\n const cell = getCellFromTarget(e.target)\n if (cell && cell === activeCellRef.current) {\n return\n }\n }\n\n if (\n keyboardModeRef.current === 'interaction' &&\n (e.key === 'ArrowLeft' ||\n e.key === 'ArrowRight' ||\n e.key === 'ArrowUp' ||\n e.key === 'ArrowDown')\n ) {\n const cell = getCellFromTarget(e.target)\n if (cell && cell === activeCellRef.current) {\n e.stopPropagation()\n return\n }\n }\n\n // In grid mode, ArrowRight on the last cell focuses the row (Spark behavior).\n if (keyboardModeRef.current === 'grid' && e.key === 'ArrowRight') {\n const cell = getCellFromTarget(e.target)\n if (cell) {\n const row = cell.closest('tr') as HTMLElement | null\n if (row) {\n const cells = Array.from(row.querySelectorAll<HTMLElement>(BODY_CELL_SELECTOR))\n const isLastCell = cells.length > 0 && cells[cells.length - 1] === cell\n if (isLastCell) {\n e.preventDefault()\n e.stopPropagation()\n row.focus()\n return\n }\n }\n }\n }\n\n if (keyboardModeRef.current === 'grid' && e.key === 'Enter') {\n const cell = getCellFromTarget(e.target)\n if (!cell) return\n if (isSelectionBodyCell(cell)) return\n\n const focusables = getFocusableDescendants(cell)\n if (focusables.length === 0) return\n\n e.preventDefault()\n e.stopPropagation()\n\n enterInteractionModeForCell(cell)\n focusables[0]?.focus()\n return\n }\n\n // APG grid pattern: F2 is an alternative to Enter to enter \"interaction\" mode.\n // It is also commonly used as a toggle (press again to restore grid navigation).\n if (keyboardModeRef.current === 'grid' && e.key === 'F2') {\n const cell = getCellFromTarget(e.target)\n if (!cell) return\n if (isSelectionBodyCell(cell)) return\n\n const focusables = getFocusableDescendants(cell)\n if (focusables.length === 0) return\n\n e.preventDefault()\n e.stopPropagation()\n\n enterInteractionModeForCell(cell)\n focusables[0]?.focus()\n return\n }\n\n if (keyboardModeRef.current === 'interaction' && e.key === 'Escape') {\n if (targetIsOpenComboboxConsumingEscape(e.target)) {\n return\n }\n\n const cell = activeCellRef.current\n if (!cell) return\n\n e.preventDefault()\n e.stopPropagation()\n\n keyboardModeRef.current = 'grid'\n setKeyboardMode('grid')\n cell.focus()\n }\n\n if (keyboardModeRef.current === 'interaction' && e.key === 'F2') {\n const cell = activeCellRef.current\n if (!cell) return\n\n e.preventDefault()\n e.stopPropagation()\n\n keyboardModeRef.current = 'grid'\n setKeyboardMode('grid')\n cell.focus()\n }\n }\n\n return mergeProps(gridPropsWithoutKeyDown, {\n onKeyDown,\n onKeyDownCapture,\n onBlurCapture,\n onFocusCapture,\n onPointerDownCapture,\n 'data-table-keyboard-mode': keyboardMode,\n })\n }, [gridProps, keyboardMode, ref, userOnFocusCapture, userOnKeyDownCapture])\n\n useEffect(() => {\n keyboardModeRef.current = keyboardMode\n const table = ref.current\n if (!table) return\n\n if (keyboardMode === 'grid') {\n disableInCellFocusablesForGridMode(table as unknown as HTMLTableElement)\n activeCellRef.current?.focus?.()\n return\n }\n\n disableInCellFocusablesForGridMode(table as unknown as HTMLTableElement)\n if (activeCellRef.current) {\n setDescendantsFocusable(activeCellRef.current, true)\n }\n }, [keyboardMode, ref])\n\n return { gridProps: mergedGridProps, keyboardMode }\n}\n","import { cva, type VariantProps } from 'class-variance-authority'\n\nexport const columnStyles = cva(\n [\n 'h-sz-64 min-w-sz-64',\n 'relative group/column first:rounded-l-xl last:rounded-r-xl bg-neutral-container',\n 'pl-lg pr-lg py-sm text-left outline-none box-border',\n 'cursor-default',\n 'data-focus-visible:u-outline data-focus-visible:-outline-offset-2',\n ],\n {\n variants: {\n /** Selection-mode header checkbox column (first column). */\n checkbox: {\n true: ['w-sz-64 min-w-sz-64 max-w-sz-64', 'px-0 align-middle'],\n },\n /** When a header resizer is present, reserve more space on the right. */\n resizable: {\n true: ['pr-xl'],\n },\n },\n defaultVariants: {\n checkbox: false,\n resizable: false,\n },\n }\n)\n\nexport const columnHeaderContentStyles = cva(\n [\n 'flex flex-1 justify-between items-center gap-md',\n 'font-inherit text-left text-inherit',\n 'whitespace-nowrap text-ellipsis',\n 'border-transparent',\n 'data-focus-visible:u-outline data-focus-visible:outline-offset-2',\n ],\n {\n variants: {},\n defaultVariants: {},\n }\n)\n\nexport const tableBodyStyles = cva(\n ['empty:italic empty:text-center empty:text-body-2 empty:py-lg'],\n {\n variants: {},\n defaultVariants: {},\n }\n)\n\nexport const cellStyles = cva(\n [\n 'p-lg outline-none box-border default:overflow-hidden',\n 'border-b-sm border-outline [tr:last-child>&]:border-b-0',\n '[-webkit-tap-highlight-color:transparent]',\n 'data-focus-visible:u-outline-inset data-focus-visible:outline-dashed',\n ],\n {\n variants: {\n /** When true, matches width + padding of the TableSelectionCheckbox header column (w-sz-64, py-sm, no horizontal padding). Use cellCheckboxInnerStyles on the inner wrapper to fill height and center content. */\n checkbox: {\n true: ['w-sz-64 py-sm px-0 align-middle'],\n },\n },\n defaultVariants: {\n checkbox: false,\n },\n }\n)\n\n/** Spacer row: 16px (md) visual gap between header and first data row. Use as first child of tbody. */\nexport const tableBodySpacerRowStyles = cva(\n [\n 'pointer-events-none',\n '[&_td]:h-sz-16 [&_td]:p-0 [&_td]:border-0 [&_td]:border-b-0 [&_td]:bg-surface [&_td]:align-middle',\n ],\n { variants: {}, defaultVariants: {} }\n)\n\nexport type ColumnStylesProps = VariantProps<typeof columnStyles>\nexport type CellStylesProps = VariantProps<typeof cellStyles>\n","/**\n * Selector for elements that have their own Space/Enter behavior (buttons, switches, inputs, etc.).\n * Used to avoid table row selection capturing these keys when focus is on an interactive cell content.\n */\nconst INTERACTIVE_SELECTOR =\n 'button, [role=\"button\"], [role=\"switch\"], [role=\"checkbox\"], [role=\"option\"], input:not([type=\"hidden\"]), select, textarea, [href], [data-spark-component=\"dropdown-trigger\"], [data-spark-component=\"icon-button\"], [data-spark-component=\"switch\"], [data-spark-component=\"switch-input\"], [data-spark-component=\"combobox-input\"]'\n\n/** Matches table-keyboard `FOCUSABLE_SELECTOR` filtering (body cells with embedded controls). */\nconst TABLE_CELL_FOCUSABLE_DESCENDANT_SELECTOR =\n 'a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]'\n\n/**\n * Elements that are expected to \"activate\" on Space/Enter (and for which we may safely synthesize a click\n * when we intercept key events in capture phase).\n *\n * IMPORTANT: text entry controls (text inputs, textarea, select) are intentionally excluded so Space\n * keeps typing/behaving normally.\n */\nconst KEYBOARD_ACTIVATABLE_SELECTOR =\n 'button, [role=\"button\"], [role=\"switch\"], [role=\"checkbox\"], [href], input[type=\"checkbox\"], input[type=\"radio\"], input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"]'\n\n/** Column resizer uses a hidden focusable input for keyboard resize (Enter to toggle, ArrowLeft/Right). Don't convert Enter to click there. */\nconst COLUMN_RESIZER_SELECTOR = '[data-resizable-direction]'\n\nexport function isInteractiveElement(element: EventTarget | null): element is Element {\n if (!element || !(element instanceof Element)) return false\n const el = element as Element\n\n return el.matches(INTERACTIVE_SELECTOR) || el.closest(INTERACTIVE_SELECTOR) !== null\n}\n\nexport function isKeyboardActivatableElement(element: EventTarget | null): element is Element {\n if (!element || !(element instanceof Element)) return false\n const el = element as Element\n\n return (\n el.matches(KEYBOARD_ACTIVATABLE_SELECTOR) || el.closest(KEYBOARD_ACTIVATABLE_SELECTOR) !== null\n )\n}\n\nexport function isColumnResizerElement(element: EventTarget | null): element is Element {\n if (!element || !(element instanceof Element)) return false\n\n return (element as Element).closest(COLUMN_RESIZER_SELECTOR) !== null\n}\n\nfunction elementFromEventTarget(target: EventTarget | null): Element | null {\n if (!target) return null\n if (target instanceof Element) return target\n if (target instanceof Text) return target.parentElement\n return null\n}\n\nfunction tableBodyCellHasInteractiveDescendants(cell: Element): boolean {\n for (const el of cell.querySelectorAll<HTMLElement>(TABLE_CELL_FOCUSABLE_DESCENDANT_SELECTOR)) {\n if (el === cell) continue\n if (el.hasAttribute('disabled')) continue\n if (el.getAttribute('aria-disabled') === 'true') continue\n if (el.getAttribute('hidden') !== null) continue\n return true\n }\n return false\n}\n\n/**\n * Skip React Aria row press/selection when the pointer target is inside in-cell controls\n * (or any \"interactive\" body cell — same heuristic as grid vs interaction keyboard mode).\n */\nexport function shouldSuppressRowSelectionFromPointerTarget(target: EventTarget | null): boolean {\n const el = elementFromEventTarget(target)\n if (!el) return false\n // Cast so the type guard's false-branch does not narrow `el` to `never` (Element ∧ ¬Element).\n if (isInteractiveElement(el as EventTarget)) return true\n\n const cell = el.closest('[data-spark-component=\"table-cell\"]')\n if (!cell || cell.getAttribute('data-table-cell-kind') === 'selection') return false\n\n return tableBodyCellHasInteractiveDescendants(cell)\n}\n","import { createContext } from 'react'\n\nexport type TableKeyboardMode = 'grid' | 'interaction'\n\nexport const TableKeyboardModeContext = createContext<TableKeyboardMode>('grid')\n","import type { AriaCheckboxProps } from '@react-types/checkbox'\n\nimport { Checkbox } from '../../checkbox'\n\nexport interface TableSelectionCheckboxProps {\n checkboxProps: AriaCheckboxProps\n className?: string\n /**\n * When true, marks inner controls as ignored by React Aria's focusable tree walker so Arrow keys\n * move to adjacent cells instead of trapping focus inside the checkbox (grid navigation mode).\n */\n suppressFocusWalker?: boolean\n}\n\n/**\n * Adapter that renders Spark `Checkbox` from React Aria checkbox props.\n * Used for row selection and \"select all\" in the table header.\n */\nexport function TableSelectionCheckbox({\n checkboxProps,\n className,\n suppressFocusWalker,\n}: TableSelectionCheckboxProps) {\n const { isSelected, isIndeterminate, isDisabled, onChange, ...domProps } = checkboxProps\n\n const checked = isIndeterminate === true ? 'indeterminate' : Boolean(isSelected)\n\n return (\n <span\n {...(suppressFocusWalker ? { 'data-react-aria-prevent-focus': true } : undefined)}\n onClick={e => e.stopPropagation()}\n onPointerDown={e => e.stopPropagation()}\n className={className ?? 'flex h-full min-h-full items-center justify-center'}\n >\n <Checkbox\n checked={checked}\n disabled={isDisabled}\n onCheckedChange={onChange}\n {...(domProps as any)}\n />\n </span>\n )\n}\n\nTableSelectionCheckbox.displayName = 'Table.SelectionCheckbox'\n","import { useTableSelectionCheckbox } from '@react-aria/table'\nimport type { TableState } from '@react-stately/table'\nimport type { GridNode } from '@react-types/grid'\nimport type { Key } from '@react-types/shared'\nimport { useCallback, useContext, useRef, type KeyboardEvent } from 'react'\nimport { mergeProps, useFocusRing, useTableCell } from 'react-aria'\n\nimport { cellStyles } from './Table.styles'\nimport { TableKeyboardModeContext } from './TableKeyboardModeContext'\nimport { TableSelectionCheckbox } from './TableSelectionCheckbox'\n\nexport function TableBodyCellRenderer({\n cell,\n state,\n resizeState,\n}: {\n cell: GridNode<unknown>\n state: TableState<unknown>\n resizeState: any\n}) {\n const ref = useRef<HTMLTableCellElement>(null)\n const { gridCellProps } = useTableCell({ node: cell }, state, ref)\n const { isFocusVisible, focusProps } = useFocusRing()\n const keyboardMode = useContext(TableKeyboardModeContext)\n\n const stopRowKeyboardSelectionInInteractionMode = useCallback(\n (e: KeyboardEvent<HTMLTableCellElement>) => {\n if (keyboardMode !== 'interaction') return\n if (e.key !== ' ' && e.key !== 'Enter') return\n e.stopPropagation()\n },\n [keyboardMode]\n )\n\n const { onKeyDownCapture: gridCellKeyDownCapture, ...gridCellPropsRest } = gridCellProps\n const gridCellCaptureWithListboxPassthrough = useCallback(\n (e: KeyboardEvent<HTMLTableCellElement>) => {\n // Arrow keys should not be handled by the cell-level capture handler:\n // - in grid mode, the table/grid roving focus handles navigation\n // - in interaction mode, the focused control should handle arrows (or ignore them)\n const overridenKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']\n\n if (overridenKeys.includes(e.key)) {\n return\n } else {\n gridCellKeyDownCapture?.(e)\n }\n },\n [gridCellKeyDownCapture]\n )\n\n const rowKey = (cell.parentKey ?? (cell as any).key) as Key\n const selectionCheckbox = useTableSelectionCheckbox({ key: rowKey }, state)\n const columnKey = (state.collection.columns[cell.index ?? 0]?.key ?? null) as Key | null\n const columnWidth = columnKey ? resizeState?.columnWidths?.get?.(columnKey) : undefined\n\n if ((cell.props as any)?.isSelectionCell) {\n return (\n <td\n {...mergeProps(\n gridCellPropsRest,\n { onKeyDownCapture: gridCellCaptureWithListboxPassthrough },\n focusProps,\n { onKeyDown: stopRowKeyboardSelectionInInteractionMode }\n )}\n ref={ref}\n data-spark-component=\"table-cell\"\n data-table-cell-kind=\"selection\"\n className={cellStyles({ checkbox: true })}\n data-focus-visible={isFocusVisible || undefined}\n >\n <TableSelectionCheckbox\n suppressFocusWalker={keyboardMode === 'grid'}\n checkboxProps={selectionCheckbox.checkboxProps}\n />\n </td>\n )\n }\n\n return (\n <td\n {...mergeProps(\n gridCellPropsRest,\n { onKeyDownCapture: gridCellCaptureWithListboxPassthrough },\n focusProps,\n { onKeyDown: stopRowKeyboardSelectionInInteractionMode }\n )}\n ref={ref}\n data-spark-component=\"table-cell\"\n className={cellStyles()}\n data-focus-visible={isFocusVisible || undefined}\n style={columnWidth ? { width: columnWidth } : undefined}\n >\n {cell.rendered}\n </td>\n )\n}\n\nTableBodyCellRenderer.displayName = 'Table.BodyCellRenderer'\n","import { getEventTarget } from '@react-aria/utils'\nimport type { TableState } from '@react-stately/table'\nimport type { GridNode } from '@react-types/grid'\nimport { cx } from 'class-variance-authority'\nimport { useRef, type SyntheticEvent } from 'react'\nimport { mergeProps, useFocusRing, useTableRow } from 'react-aria'\n\nimport { shouldSuppressRowSelectionFromPointerTarget } from './table-utils'\nimport { TableBodyCellRenderer } from './TableBodyCellRenderer'\n\nfunction chainUnlessInteractivePointer<E extends SyntheticEvent<unknown>>(\n handler: ((e: E) => void) | undefined\n): ((e: E) => void) | undefined {\n if (!handler) return undefined\n return (e: E) => {\n // `react-aria` types sometimes differ between `Event`/`MouseEvent` generics and DOM `Event`.\n // We only need a DOM `Event` to extract `target`.\n const eventTarget = getEventTarget(e.nativeEvent as any)\n if (shouldSuppressRowSelectionFromPointerTarget(eventTarget)) {\n return\n }\n handler(e)\n }\n}\n\nexport function TableBodyRowRenderer({\n item,\n state,\n resizeState,\n}: {\n item: GridNode<unknown>\n state: TableState<unknown>\n resizeState: any\n}) {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps, isSelected } = useTableRow({ node: item }, state, ref)\n const { isFocusVisible, focusProps } = useFocusRing()\n\n const { onClick, onPointerDown, onMouseDown, onPointerUp, onPointerCancel, ...restRowProps } =\n rowProps\n const rowClassName = cx(\n 'outline-none box-border data-focus-visible:u-outline-inset data-focus-visible:outline-dashed',\n (restRowProps as any).className,\n isSelected && 'bg-support-container text-on-support-container'\n )\n\n return (\n <tr\n {...mergeProps(restRowProps, focusProps)}\n onPointerDown={chainUnlessInteractivePointer(onPointerDown)}\n onMouseDown={chainUnlessInteractivePointer(onMouseDown)}\n onPointerUp={chainUnlessInteractivePointer(onPointerUp)}\n onPointerCancel={chainUnlessInteractivePointer(onPointerCancel)}\n onClick={chainUnlessInteractivePointer(onClick)}\n ref={ref}\n data-spark-component=\"table-row\"\n data-selected={isSelected || undefined}\n data-focus-visible={isFocusVisible || undefined}\n className={rowClassName}\n tabIndex={-1}\n >\n {[...item.childNodes].map(cell => (\n <TableBodyCellRenderer key={cell.key} cell={cell} state={state} resizeState={resizeState} />\n ))}\n </tr>\n )\n}\n\nTableBodyRowRenderer.displayName = 'Table.BodyRowRenderer'\n","import { useTableColumnResize } from '@react-aria/table'\nimport type { GridNode } from '@react-types/grid'\nimport { cx } from 'class-variance-authority'\nimport { useRef } from 'react'\n\nexport function TableColumnResizer({\n column,\n ariaLabel,\n resizeState,\n resizeCallbacks,\n}: {\n column: GridNode<unknown>\n ariaLabel?: string\n resizeState: any\n resizeCallbacks: {\n onResizeStart?: (widths: any) => void\n onResize?: (widths: any) => void\n onResizeEnd?: (widths: any) => void\n }\n}) {\n const resizeInputRef = useRef<HTMLInputElement>(null)\n const { resizerProps, inputProps, isResizing } = useTableColumnResize(\n {\n column,\n 'aria-label': ariaLabel ?? 'Resize column',\n onResizeStart: resizeCallbacks.onResizeStart,\n onResize: resizeCallbacks.onResize,\n onResizeEnd: resizeCallbacks.onResizeEnd,\n } as any,\n resizeState,\n resizeInputRef\n )\n\n return (\n <div\n role=\"presentation\"\n className={cx(\n // Visible resize handle on the right edge of the header.\n 'cursor-col-resize absolute inset-y-lg right-0 flex w-lg items-center justify-center',\n // Provide a visible affordance.\n 'after:block after:h-full after:w-[2px] after:bg-outline after:transition-all after:duration-75',\n // Focus visible when the hidden input is focused.\n 'has-[input:focus-visible]:after:u-outline has-[input:focus-visible]:after:outline-offset-2',\n isResizing && 'after:bg-outline-high after:scale-120'\n )}\n data-resizable-direction=\"both\"\n {...resizerProps}\n >\n <input\n ref={resizeInputRef}\n // When not actively resizing, disable the input so grid keyboard navigation\n // cannot land on it (it remains programmatically focusable once enabled).\n disabled={!isResizing}\n {...inputProps}\n />\n </div>\n )\n}\n\nTableColumnResizer.displayName = 'Table.ColumnResizer'\n","import { useTableSelectAllCheckbox } from '@react-aria/table'\nimport type { TableState } from '@react-stately/table'\nimport type { Key } from '@react-types/shared'\nimport type { KeyboardEvent } from 'react'\n\nimport { TableSelectionCheckbox } from './TableSelectionCheckbox'\n\n/**\n * Header \"select all\" checkbox that bases its checked/indeterminate state only\n * on the currently visible (rendered) rows. So when the user changes page in a\n * paginated table, the header shows unchecked instead of indeterminate when no\n * visible row is selected.\n *\n * Keyboard: the column header `<th>` uses React Aria `usePress` for collection\n * selection; Space/Enter would bubble from the checkbox and toggle the wrong key.\n * We stop propagation on those keys and explicitly toggle on Enter (Radix checkbox\n * prevents default Enter on the button so it does not activate like Space).\n */\nexport function TableHeaderSelectionCheckbox({ state }: { state: TableState<unknown> }) {\n const { checkboxProps: selectAllAriaProps } = useTableSelectAllCheckbox(state)\n const { collection, selectionManager } = state\n const selectedKeys = selectionManager.selectedKeys\n\n // Visible row keys: only the body row keys (currently rendered rows).\n // TableCollection has a body node whose children are the rows.\n const collectionWithBody = collection as unknown as {\n body?: { key: Key }\n getChildren: (key: Key) => Iterable<{ key: Key }>\n getKeys: () => IterableIterator<Key>\n }\n const bodyNode = collectionWithBody.body\n const visibleRowKeys =\n bodyNode != null\n ? new Set<Key>([...collectionWithBody.getChildren(bodyNode.key)].map(node => node.key))\n : new Set<Key>(collection.getKeys())\n\n const keysSet = (selectedKeys as unknown) === 'all' ? visibleRowKeys : (selectedKeys as Set<Key>)\n const selectedVisibleCount = [...visibleRowKeys].filter(key => keysSet.has(key)).length\n const visibleCount = visibleRowKeys.size\n\n const isAllSelected = visibleCount > 0 && selectedVisibleCount === visibleCount\n const isIndeterminate = selectedVisibleCount > 0 && selectedVisibleCount < visibleCount\n\n const {\n isSelected: _ignoredSelected,\n isIndeterminate: _ignoredIndeterminate,\n onChange: toggleAllOnChange,\n ...selectAllRest\n } = selectAllAriaProps\n\n const onHeaderSelectAllKeyDown = (e: KeyboardEvent) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.stopPropagation()\n }\n if (e.key !== 'Enter') {\n return\n }\n e.preventDefault()\n if (!selectAllAriaProps.isDisabled) {\n toggleAllOnChange?.(!isAllSelected)\n }\n }\n\n return (\n <TableSelectionCheckbox\n checkboxProps={{\n ...selectAllRest,\n isSelected: isAllSelected,\n isIndeterminate,\n onChange: toggleAllOnChange,\n onKeyDown: onHeaderSelectAllKeyDown,\n }}\n />\n )\n}\n\nTableHeaderSelectionCheckbox.displayName = 'Table.HeaderSelectionCheckbox'\n","// oxlint-disable max-lines-per-function\nimport type { TableState } from '@react-stately/table'\nimport type { GridNode } from '@react-types/grid'\nimport { ArrowDown } from '@spark-ui/icons/ArrowDown'\nimport { ArrowUp } from '@spark-ui/icons/ArrowUp'\nimport { Sort } from '@spark-ui/icons/Sort'\nimport { cx } from 'class-variance-authority'\nimport { useRef } from 'react'\nimport { mergeProps, useFocusRing, useTableColumnHeader } from 'react-aria'\n\nimport { Icon } from '../../icon'\nimport { columnHeaderContentStyles, columnStyles } from './Table.styles'\nimport { TableColumnResizer } from './TableColumnResizer'\nimport { useTableContext } from './TableContext'\nimport { TableHeaderSelectionCheckbox } from './TableHeaderSelectionCheckbox'\n\nconst stickyHeaderCellClassName = cx('sticky top-0 z-sticky')\n\nexport function TableColumnHeader({\n column,\n state,\n resizeState,\n stickyHeader,\n resizeCallbacks,\n isLastColumnInRow = false,\n}: {\n column: GridNode<unknown>\n state: TableState<unknown>\n resizeState: any\n stickyHeader?: boolean\n resizeCallbacks: {\n onResizeStart?: (widths: any) => void\n onResize?: (widths: any) => void\n onResizeEnd?: (widths: any) => void\n }\n /** Rightmost header cell in this row. No resizer — nothing to resize against. */\n isLastColumnInRow?: boolean\n}) {\n const ref = useRef<HTMLTableCellElement>(null)\n const { resizeColumnAriaLabel } = useTableContext()\n const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref)\n const { isFocusVisible, focusProps } = useFocusRing()\n const allowsResizing = (column.props as any)?.allowsResizing !== false && !isLastColumnInRow\n const columnWidth = resizeState?.columnWidths?.get?.(column.key)\n const hasResizer = Boolean(resizeState && allowsResizing)\n\n if ((column.props as any)?.isSelectionCell) {\n return (\n <th\n {...columnHeaderProps}\n ref={ref}\n role=\"columnheader\"\n className={cx(columnStyles({ checkbox: true }), stickyHeader && stickyHeaderCellClassName)}\n data-spark-component=\"table-column\"\n data-table-selection-columnheader\n data-focus-visible={isFocusVisible || undefined}\n >\n <TableHeaderSelectionCheckbox state={state} />\n </th>\n )\n }\n\n const allowsSorting = Boolean((column.props as any)?.allowsSorting)\n const isSorted = state.sortDescriptor?.column === column.key\n const direction = state.sortDescriptor?.direction ?? 'ascending'\n const sortIcon = (() => {\n if (!isSorted) return <Sort />\n return direction === 'descending' ? <ArrowDown /> : <ArrowUp />\n })()\n\n const handleSortingKeyDown = (e: React.KeyboardEvent) => {\n // Ensure keyboard sorting works even when column resizing is enabled.\n if (!allowsSorting) return\n if (e.key !== 'Enter' && e.key !== ' ') return\n e.preventDefault()\n e.stopPropagation()\n ;(state as any).sort?.(column.key)\n }\n\n return (\n <th\n {...mergeProps(columnHeaderProps, focusProps)}\n ref={ref}\n role=\"columnheader\"\n className={cx(\n columnStyles({ resizable: hasResizer }),\n stickyHeader && stickyHeaderCellClassName\n )}\n style={columnWidth ? { width: columnWidth } : undefined}\n data-spark-component=\"table-column\"\n data-focus-visible={isFocusVisible || undefined}\n onKeyDown={handleSortingKeyDown}\n >\n <div className={columnHeaderContentStyles()}>\n <button\n type=\"button\"\n className={cx(\n // Make the header title focusable so grid keyboard navigation lands here\n // instead of the resizer when resizing is enabled.\n 'gap-md flex min-w-0 flex-1 items-center text-left',\n 'focus-visible:u-outline outline-none',\n // Avoid default button styling impacting layout.\n 'bg-transparent p-0 border-0'\n )}\n onKeyDown={handleSortingKeyDown}\n >\n <span className=\"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap\">\n {column.rendered}\n </span>\n </button>\n {allowsSorting ? (\n <span\n aria-hidden=\"true\"\n className={cx(\n 'shrink-0 opacity-dim-2 group-hover/column:opacity-100',\n isSorted && 'opacity-100'\n )}\n >\n <Icon size=\"sm\">{sortIcon}</Icon>\n </span>\n ) : null}\n </div>\n {resizeState && allowsResizing ? (\n <TableColumnResizer\n column={column}\n ariaLabel={\n typeof resizeColumnAriaLabel === 'function'\n ? resizeColumnAriaLabel(column)\n : resizeColumnAriaLabel\n }\n resizeState={resizeState}\n resizeCallbacks={resizeCallbacks}\n />\n ) : null}\n </th>\n )\n}\n\nTableColumnHeader.displayName = 'Table.ColumnHeader'\n","import type { TableState } from '@react-stately/table'\nimport type { GridNode } from '@react-types/grid'\nimport { useRef } from 'react'\nimport { useTableHeaderRow } from 'react-aria'\n\nimport { TableColumnHeader } from './TableColumnHeader'\n\nexport function TableHeaderRowRenderer({\n item,\n state,\n resizeState,\n stickyHeader,\n resizeCallbacks,\n}: {\n item: GridNode<unknown>\n state: TableState<unknown>\n resizeState: any\n stickyHeader?: boolean\n resizeCallbacks: {\n onResizeStart?: (widths: any) => void\n onResize?: (widths: any) => void\n onResizeEnd?: (widths: any) => void\n }\n}) {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps } = useTableHeaderRow({ node: item }, state, ref)\n const columns = [...item.childNodes]\n return (\n <tr {...rowProps} ref={ref}>\n {columns.map((column, index) => (\n <TableColumnHeader\n key={column.key}\n column={column}\n state={state}\n resizeState={resizeState}\n stickyHeader={stickyHeader}\n resizeCallbacks={resizeCallbacks}\n isLastColumnInRow={index === columns.length - 1}\n />\n ))}\n </tr>\n )\n}\n\nTableHeaderRowRenderer.displayName = 'Table.HeaderRowRenderer'\n","import { filterDOMProps } from '@react-aria/utils'\nimport { useTableColumnResizeState } from '@react-stately/table'\nimport { useTableState } from '@react-stately/table'\nimport type { TableState } from '@react-stately/table'\nimport type { TableProps as AriaTableProps } from '@react-types/table'\nimport { cx } from 'class-variance-authority'\nimport type { ReactNode } from 'react'\nimport { useRef } from 'react'\nimport { mergeProps, useTable, useTableRowGroup } from 'react-aria'\n\nimport { useTableKeyboardModes } from './table-keyboard'\nimport { tableBodySpacerRowStyles } from './Table.styles'\nimport { TableBodyRowRenderer } from './TableBodyRowRenderer'\nimport { useTableResizableContext } from './TableContext'\nimport { TableHeaderRowRenderer } from './TableHeaderRowRenderer'\nimport { TableKeyboardModeContext } from './TableKeyboardModeContext'\n\nexport function TableRoot({\n className,\n children,\n stickyHeader: stickyHeaderProp,\n ...props\n}: AriaTableProps<object> & {\n className?: string\n stickyHeader?: boolean\n children?: AriaTableProps<object>['children']\n}) {\n const stickyHeader = Boolean(stickyHeaderProp)\n const tableRef = useRef<HTMLTableElement>(null)\n const resizable = useTableResizableContext()\n const shouldUseFixedLayout = (props as any).selectionMode === 'multiple'\n\n const state = useTableState({\n ...(props as AriaTableProps<object>),\n showSelectionCheckboxes: (props as AriaTableProps<object>).selectionMode === 'multiple',\n children,\n })\n\n const columnResizeState = useTableColumnResizeState(\n { tableWidth: resizable.tableWidth },\n state as unknown as TableState<unknown>\n )\n const resizeState =\n resizable.isResizable && (props as any).allowsResizing !== false ? columnResizeState : null\n\n const { gridProps } = useTable({ ...(props as AriaTableProps<unknown>) }, state, tableRef)\n\n const headerRows = state.collection.headerRows\n const bodyRows = [...state.collection.body.childNodes]\n const emptyStateRenderer = (state.collection.body.props as any)?.renderEmptyState as\n | ((props: { isEmpty: boolean; isDropTarget?: boolean }) => ReactNode)\n | undefined\n\n const columnCount = state.collection.columns.length || 1\n const showBodySpacer = bodyRows.length > 0 || Boolean(emptyStateRenderer)\n\n const { rowGroupProps: theadProps } = useTableRowGroup()\n const { rowGroupProps: tbodyProps } = useTableRowGroup()\n\n const { gridProps: keyboardGridProps, keyboardMode } = useTableKeyboardModes({\n ref: tableRef,\n gridProps,\n onKeyDownCapture: (props as any).onKeyDownCapture,\n onFocusCapture: (props as any).onFocusCapture,\n })\n\n return (\n <TableKeyboardModeContext.Provider value={keyboardMode}>\n <table\n {...mergeProps(keyboardGridProps, filterDOMProps(props as any, { global: true }))}\n ref={tableRef}\n data-spark-component=\"table\"\n className={cx(\n 'default:w-full',\n shouldUseFixedLayout ? 'table-fixed' : undefined,\n 'border-separate border-spacing-y-0',\n 'bg-surface',\n 'outline-none',\n 'text-body-1',\n 'forced-color-adjust-none',\n 'data-focus-visible:u-outline-inset',\n 'has-[>[data-empty]]:h-full',\n className\n )}\n >\n <thead {...theadProps} data-spark-component=\"table-header\">\n {headerRows.map(headerRow => (\n <TableHeaderRowRenderer\n key={headerRow.key}\n item={headerRow}\n state={state as TableState<unknown>}\n resizeState={resizeState as any}\n stickyHeader={stickyHeader}\n resizeCallbacks={{\n onResizeStart: (props as any).onResizeStart,\n onResize: (props as any).onResize,\n onResizeEnd: (props as any).onResizeEnd,\n }}\n />\n ))}\n </thead>\n <tbody {...tbodyProps} data-spark-component=\"table-body\">\n {showBodySpacer ? (\n <tr\n aria-hidden=\"true\"\n className={tableBodySpacerRowStyles()}\n role=\"presentation\"\n data-spark-component=\"table-body-spacer\"\n >\n <td colSpan={columnCount} role=\"presentation\" />\n </tr>\n ) : null}\n {bodyRows.length === 0 && emptyStateRenderer ? (\n <tr data-empty>\n <td colSpan={columnCount}>{emptyStateRenderer({ isEmpty: true })}</td>\n </tr>\n ) : null}\n {bodyRows.map(row => (\n <TableBodyRowRenderer\n key={row.key}\n item={row}\n state={state as TableState<unknown>}\n resizeState={resizeState as any}\n />\n ))}\n </tbody>\n </table>\n </TableKeyboardModeContext.Provider>\n )\n}\n\nTableRoot.displayName = 'Table.Grid.Inner'\n","import type { TableProps as AriaTableProps } from '@react-types/table'\n\nimport { ResizableTableContainer } from './ResizableTableContainer'\nimport { useTableContext } from './TableContext'\nimport { TableRoot } from './TableRoot'\n\nfunction toMaxHeightStyle(value: number | string): React.CSSProperties['maxHeight'] {\n return typeof value === 'number' ? `${value}px` : value\n}\n\nexport interface TableGridProps {\n /** Required for accessibility. */\n 'aria-label'?: string\n 'aria-labelledby'?: string\n className?: string\n children?: AriaTableProps<object>['children']\n}\n\nexport function TableGrid({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className: gridClassName,\n children,\n}: TableGridProps) {\n const ctx = useTableContext()\n const {\n allowsResizing = true,\n maxHeight,\n stickyHeader,\n onResizeStart,\n onResize,\n onResizeEnd,\n onKeyDownCapture,\n sortDescriptor,\n onSortChange,\n className: contextClassName,\n ...ariaTableProps\n } = ctx\n\n const scrollContainerStyle =\n maxHeight != null ? { maxHeight: toMaxHeightStyle(maxHeight) } : undefined\n const className = gridClassName ?? contextClassName\n\n const tableRootProps = {\n ...ariaTableProps,\n ...(ariaLabel != null && { 'aria-label': ariaLabel }),\n ...(ariaLabelledBy != null && { 'aria-labelledby': ariaLabelledBy }),\n sortDescriptor,\n onSortChange,\n onKeyDownCapture,\n className,\n stickyHeader,\n }\n\n // React Aria's Table expects a tuple of [Header, Body] children.\n // We keep the public `Table.Grid` API flexible, so we intentionally type-erase at this boundary.\n const TableRootAny = TableRoot as any\n\n if (allowsResizing) {\n return (\n <ResizableTableContainer\n className={className}\n style={scrollContainerStyle}\n onResizeStart={onResizeStart}\n onResize={onResize}\n onResizeEnd={onResizeEnd}\n >\n <TableRootAny {...tableRootProps}>{children}</TableRootAny>\n </ResizableTableContainer>\n )\n }\n\n return (\n <div className=\"relative w-full overflow-auto\" style={scrollContainerStyle}>\n <TableRootAny {...tableRootProps}>{children}</TableRootAny>\n </div>\n )\n}\n\nTableGrid.displayName = 'Table.Grid'\n","import type { TableBodyProps as StatelyTableBodyProps } from '@react-stately/table'\nimport { TableBody as StatelyTableBody } from '@react-stately/table'\nimport type { ReactNode } from 'react'\n\nexport interface TableBodyProps<T extends object = object> extends StatelyTableBodyProps<T> {\n className?: string\n /** Spark-only: used to re-render body when external deps change (Storybook/demo convenience). */\n dependencies?: unknown[]\n /** Spark-only: empty state renderer (handled by Spark Table renderer). */\n renderEmptyState?: () => ReactNode\n}\n\nexport function TableBody<T extends object>(props: TableBodyProps<T>) {\n return <StatelyTableBody {...(props as unknown as StatelyTableBodyProps<T>)} />\n}\n\nTableBody.displayName = 'Table.Body'\n\n// Forward React Stately collection static for useTableState.\n;(TableBody as any).getCollectionNode = (StatelyTableBody as any).getCollectionNode\n","import { cx } from 'class-variance-authority'\nimport type { ComponentPropsWithoutRef, ReactNode } from 'react'\nimport { createContext, useContext } from 'react'\n\nimport { Button, type ButtonProps } from '../button'\nimport { useTableContext } from './internal/TableContext'\n\ninterface TableBulkBarContextValue {\n selectedCount: number\n totalCount?: number\n onClearSelection: () => void\n onSelectAll?: () => void\n /** When true, \"Clear all\" and \"Select all\" are shown (subject to their own conditions). */\n hasMultiplePages?: boolean\n}\n\nconst TableBulkBarContext = createContext<TableBulkBarContextValue | null>(null)\n\nfunction useTableBulkBarContext() {\n const ctx = useContext(TableBulkBarContext)\n\n if (!ctx) {\n throw new Error('Table.BulkBar subcomponents must be used within Table.BulkBar')\n }\n\n return ctx\n}\n\nexport interface TableBulkBarProps {\n children: ReactNode\n className?: string\n /** `aria-label` for the toolbar (for i18n). Overrides `bulkBarAriaLabel` from `Table`. */\n 'aria-label'?: string\n /**\n * Additional props passed to the root element.\n * Note: `role` is fixed to \"toolbar\".\n */\n rootProps?: Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className' | 'role' | 'aria-label'>\n}\n\nfunction TableBulkBarRoot({ children, className, rootProps, ...props }: TableBulkBarProps) {\n const { selectedCount, totalCount, onClearSelection, onSelectAll, hasMultiplePages } = useTableContext()\n\n const contextValue: TableBulkBarContextValue = {\n selectedCount,\n totalCount,\n onClearSelection,\n onSelectAll,\n hasMultiplePages,\n }\n\n return (\n <TableBulkBarContext.Provider value={contextValue}>\n <div\n role=\"toolbar\"\n aria-label={props['aria-label'] ?? 'Table bulk actions'}\n data-spark-component=\"table-bulk-bar\"\n className={cx(\n 'gap-lg min-h-sz-64 flex w-full flex-wrap items-center justify-between',\n 'rounded-lg',\n 'bg-support-container text-on-support-container p-lg',\n className\n )}\n {...rootProps}\n >\n {children}\n </div>\n </TableBulkBarContext.Provider>\n )\n}\n\nfunction TableBulkBarSelectedCount({ children }: { children: ReactNode }) {\n useTableBulkBarContext() // enforce usage within BulkBar\n\n return <span className=\"text-body-1 font-bold\">{children}</span>\n}\n\ntype BulkBarButtonProps = Omit<ButtonProps, 'onClick'>\n\nfunction TableBulkBarClearButton({ className, children, ...props }: BulkBarButtonProps) {\n const { selectedCount, onClearSelection, hasMultiplePages } = useTableBulkBarContext()\n\n if (!hasMultiplePages) {\n return null\n }\n\n const ariaDisabled = selectedCount === 0\n\n return (\n <Button\n size=\"sm\"\n design=\"ghost\"\n intent=\"support\"\n underline\n ariaDisabled={ariaDisabled}\n onClick={onClearSelection}\n className={cx('text-body-2', className)}\n {...props}\n >\n {children}\n </Button>\n )\n}\n\nfunction TableBulkBarSelectAllButton({ className, children, ...props }: BulkBarButtonProps) {\n const { selectedCount, totalCount, onSelectAll, hasMultiplePages } = useTableBulkBarContext()\n\n if (!hasMultiplePages) {\n return null\n }\n\n const ariaDisabled = totalCount == null || onSelectAll == null || selectedCount >= totalCount\n\n return (\n <Button\n size=\"sm\"\n design=\"ghost\"\n intent=\"support\"\n underline\n ariaDisabled={ariaDisabled}\n onClick={onSelectAll}\n className={cx('text-body-2', className)}\n {...props}\n >\n {children}\n </Button>\n )\n}\n\nTableBulkBarRoot.displayName = 'Table.BulkBar'\n\nexport const TableBulkBar = TableBulkBarRoot\nTableBulkBar.displayName = 'Table.BulkBar'\n\nexport { TableBulkBarSelectedCount, TableBulkBarClearButton, TableBulkBarSelectAllButton }\nTableBulkBarSelectedCount.displayName = 'Table.BulkBarSelectedCount'\nTableBulkBarClearButton.displayName = 'Table.BulkBarClearButton'\nTableBulkBarSelectAllButton.displayName = 'Table.BulkBarSelectAllButton'\n","import type { CellProps as StatelyCellProps } from '@react-stately/table'\nimport { Cell as StatelyCell } from '@react-stately/table'\n\nexport interface CellProps extends StatelyCellProps {\n className?: string\n checkbox?: boolean\n}\n\nexport function Cell(props: CellProps) {\n return <StatelyCell {...(props as unknown as StatelyCellProps)} />\n}\n\nCell.displayName = 'Table.Cell'\n\n// Forward React Stately collection static for useTableState.\n;(Cell as any).getCollectionNode = (StatelyCell as any).getCollectionNode\n","import type { PartialNode } from '@react-stately/collections'\nimport type { Key } from '@react-types/shared'\nimport type { ColumnProps as ReactTypesColumnProps } from '@react-types/table'\nimport React, { type ReactElement, type ReactNode } from 'react'\n\nexport interface ColumnProps<T extends object = object> extends Omit<\n ReactTypesColumnProps<T>,\n 'title' | 'children'\n> {\n /** Spark-only props. Stored on the column node and used by the renderer. */\n className?: string\n /** Stable key for the column (Spark API). */\n id?: Key\n /** Header label (Spark API). */\n label: string\n /** Optional header content (Spark API). */\n children?: ReactNode\n allowsResizing?: boolean\n}\n\nexport function Column<T extends object>({\n label,\n allowsResizing = true,\n ...props\n}: ColumnProps<T>) {\n // Collection component: does not render DOM.\n void label\n void allowsResizing\n void props\n return null\n}\n\nColumn.displayName = 'Table.Column'\n\n// React Stately collection static for useTableState, but with Spark's `id` support:\n// React Stately's CollectionBuilder derives keys from React element keys, not `props.id`,\n// so we explicitly set `key` from the `id` prop to preserve Spark's API and tests.\n;(Column as any).getCollectionNode = function* getCollectionNode<T>(\n columnProps: ReactTypesColumnProps<T> & { label?: string; allowsResizing?: boolean },\n context: any\n): Generator<PartialNode<T>, void, any> {\n const rendered =\n (columnProps as any).title ?? (columnProps as any).label ?? columnProps.children ?? null\n const textValue =\n (columnProps as any).textValue ||\n (typeof rendered === 'string' ? rendered : '') ||\n (columnProps as any)['aria-label']\n\n const idKey = (columnProps as any).id\n\n const fullNodes = (yield {\n type: 'column',\n key: idKey ?? null,\n hasChildNodes:\n !!(columnProps as any).childColumns ||\n (!!(columnProps as any).title && React.Children.count(columnProps.children) > 0),\n rendered,\n textValue,\n props: {\n ...(columnProps as any),\n title: (columnProps as any).title ?? (columnProps as any).label,\n allowsResizing: (columnProps as any).allowsResizing,\n },\n *childNodes() {\n if ((columnProps as any).childColumns) {\n for (const child of (columnProps as any).childColumns) {\n yield { type: 'column', value: child }\n }\n } else if ((columnProps as any).title) {\n const childColumns: PartialNode<T>[] = []\n React.Children.forEach(columnProps.children, child => {\n childColumns.push({\n type: 'column',\n element: child as ReactElement<ReactTypesColumnProps<T>>,\n })\n })\n yield* childColumns\n }\n },\n shouldInvalidate(newContext: any) {\n updateContext(newContext)\n return false\n },\n } as PartialNode<T>) as any\n\n const updateContext = (ctx: any) => {\n for (const node of fullNodes) {\n if (!node.hasChildNodes) {\n ctx.columns.push(node)\n }\n }\n }\n\n updateContext(context)\n}\n","import type { TableHeaderProps as StatelyTableHeaderProps } from '@react-stately/table'\nimport { TableHeader as StatelyTableHeader } from '@react-stately/table'\n\nexport interface TableHeaderProps<T extends object = object> extends StatelyTableHeaderProps<T> {\n /**\n * Spark-only props. They are stored on the collection node and used by the renderer.\n * (No DOM is rendered by `@react-stately/table` collection components.)\n */\n className?: string\n}\n\nexport function TableHeader<T extends object>(props: TableHeaderProps<T>) {\n return <StatelyTableHeader {...(props as unknown as StatelyTableHeaderProps<T>)} />\n}\n\nTableHeader.displayName = 'Table.Header'\n\n// Forward React Stately collection static for useTableState.\n;(TableHeader as any).getCollectionNode = (StatelyTableHeader as any).getCollectionNode\n","import type { PartialNode } from '@react-stately/collections'\nimport type { Key } from '@react-types/shared'\nimport type { RowProps as ReactTypesRowProps } from '@react-types/table'\nimport React, { type ReactElement } from 'react'\n\nexport interface RowProps<T extends object = object> extends ReactTypesRowProps<T> {\n className?: string\n /** Stable key for the row (Spark API). */\n id?: Key\n /** Called when the row is activated (e.g. Enter on a link row). */\n onAction?: () => void\n}\n\nexport function Row<T extends object>(props: RowProps<T>) {\n // Collection component: does not render DOM.\n void props\n return null\n}\n\nRow.displayName = 'Table.Row'\n\n// React Stately collection static for useTableState, but with Spark's `id` support:\n// CollectionBuilder derives keys from React element keys, not `props.id`, so we explicitly set `key`.\n;(Row as any).getCollectionNode = function* getCollectionNode<T extends object>(\n props: ReactTypesRowProps<T> & { UNSTABLE_childItems?: any[] },\n context: any\n): Generator<PartialNode<T>, void, any> {\n const { children, textValue, UNSTABLE_childItems } = props as any\n const idKey = (props as any).id\n\n yield {\n type: 'item',\n key: idKey ?? null,\n props,\n textValue,\n 'aria-label': (props as any)['aria-label'],\n hasChildNodes: true,\n *childNodes() {\n if (context.showDragButtons) {\n yield {\n type: 'cell',\n key: 'header-drag',\n props: { isDragButtonCell: true },\n }\n }\n\n if (context.showSelectionCheckboxes && context.selectionMode !== 'none') {\n yield {\n type: 'cell',\n key: 'header',\n props: { isSelectionCell: true },\n }\n }\n\n if (typeof children === 'function') {\n for (const column of context.columns) {\n yield {\n type: 'cell',\n element: children(column.key),\n key: column.key,\n }\n }\n\n if (UNSTABLE_childItems) {\n for (const child of UNSTABLE_childItems) {\n yield { type: 'item', value: child }\n }\n }\n } else {\n const cells: PartialNode<T>[] = []\n const childRows: PartialNode<T>[] = []\n let columnCount = 0\n\n React.Children.forEach(children, node => {\n if (!node) return\n if ((node as any).type === Row) {\n if (cells.length < context.columns.length) {\n throw new Error(\n \"All of a Row's child Cells must be positioned before any child Rows.\"\n )\n }\n\n childRows.push({ type: 'item', element: node as ReactElement<ReactTypesRowProps<T>> })\n } else {\n cells.push({ type: 'cell', element: node as any })\n columnCount += (node as any).props?.colSpan ?? 1\n }\n })\n\n if (columnCount !== context.columns.length) {\n throw new Error(\n `Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`\n )\n }\n\n yield* cells\n yield* childRows\n }\n },\n shouldInvalidate(newContext: any) {\n return (\n newContext.columns.length !== context.columns.length ||\n newContext.columns.some((c: any, i: number) => c.key !== context.columns[i].key) ||\n newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes ||\n newContext.showDragButtons !== context.showDragButtons ||\n newContext.selectionMode !== context.selectionMode\n )\n },\n } satisfies PartialNode<T>\n}\n","import type { SortDescriptor } from '@react-types/shared'\nimport { useMemo, useState } from 'react'\n\nexport interface UseTableSortOptions<T extends object> {\n /** Initial sort column and direction. */\n initialSort?: {\n column: keyof T\n direction: 'ascending' | 'descending'\n }\n /**\n * Custom compare function. If not provided, a default comparator is used:\n * - numbers: numeric comparison\n * - other: localeCompare on string representation\n */\n compare?: (a: T, b: T, column: keyof T, direction: 'ascending' | 'descending') => number\n}\n\nfunction defaultCompare<T extends object>(\n a: T,\n b: T,\n column: keyof T,\n direction: 'ascending' | 'descending'\n): number {\n const aVal = a[column]\n const bVal = b[column]\n\n if (aVal === bVal) return 0\n\n let comparisonResult: number\n if (typeof aVal === 'number' && typeof bVal === 'number') {\n comparisonResult = aVal < bVal ? -1 : 1\n } else {\n comparisonResult = String(aVal).localeCompare(String(bVal))\n }\n\n return direction === 'descending' ? -comparisonResult : comparisonResult\n}\n\n/**\n * Hook to manage table sort state and derive sorted items from a list.\n * Use with Table's sortDescriptor and onSortChange props.\n *\n * @example\n * const { sortDescriptor, onSortChange, setSortDescriptor, sortedItems } = useTableSort(rows, {\n * initialSort: { column: 'name', direction: 'ascending' },\n * })\n * return (\n * <>\n * <Button onClick={() => setSortDescriptor({ column: 'name', direction: 'ascending' })}>Reset sort</Button>\n * <Table sortDescriptor={sortDescriptor} onSortChange={onSortChange}>\n * ...\n * </Table>\n * </>\n * )\n */\nexport function useTableSort<T extends object>(\n items: T[],\n options: UseTableSortOptions<T> = {}\n): {\n sortDescriptor: SortDescriptor\n onSortChange: (descriptor: SortDescriptor) => void\n /** Set sort from outside the table (e.g. a \"Reset sort\" button). */\n setSortDescriptor: (descriptor: SortDescriptor) => void\n sortedItems: T[]\n} {\n const { initialSort, compare } = options\n\n const [sortDescriptor, setSortDescriptor] = useState<SortDescriptor>(() =>\n initialSort\n ? { column: initialSort.column as string, direction: initialSort.direction }\n : { column: 'id', direction: 'ascending' }\n )\n\n const sortedItems = useMemo(() => {\n const column = sortDescriptor.column as keyof T\n if (!column) return [...items]\n\n const compareFn = compare ?? defaultCompare\n const direction = sortDescriptor.direction ?? 'ascending'\n\n return [...items].sort((a, b) => compareFn(a, b, column, direction))\n }, [items, sortDescriptor.column, sortDescriptor.direction, compare])\n\n return {\n sortDescriptor,\n onSortChange: setSortDescriptor,\n setSortDescriptor,\n sortedItems,\n }\n}\n","import type { Key, Selection } from '@react-types/shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nexport interface UseTablePaginationOptions<T> {\n /** Number of items per page. */\n pageSize: number\n /** Initial page index (1-based). Defaults to 1. */\n initialPage?: number\n /**\n * Function to extract a stable key from each item.\n * Defaults to `item.id` if present.\n */\n getId?: (item: T) => Key\n}\n\nexport interface UseTablePaginationResult<T> {\n /** Current page (1-based). */\n page: number\n /** Update the current page manually. */\n setPage: (page: number) => void\n /** Items sliced to the current page. */\n pageItems: T[]\n /** Total number of items. */\n totalItems: number\n /** Total number of pages (at least 1). */\n totalPages: number\n /** All item keys across all pages. */\n allKeys: Set<Key>\n /**\n * Selection state across all pages.\n * Pass to Table (root) as `selectedKeys`.\n */\n selectedKeys: Set<Key>\n /**\n * Selection change handler that keeps selection across pages.\n * Pass to Table (root) as `onSelectionChange`.\n */\n onSelectionChange: (keys: Selection) => void\n /**\n * Convenience handler matching Pagination's `onPageChange` signature:\n * `onPageChange={({ page }) => ...}`.\n */\n onPageChange: (details: { page: number }) => void\n /** Clear selection across all pages. */\n clearSelection: () => void\n}\n\n/**\n * Hook to manage simple client-side pagination and multi-page selection for Table.\n * It slices the full item list to the current page, tracks page state, and merges\n * selection across pages so that rows selected on previous pages remain selected.\n *\n * @example\n * const { page, pageItems, totalItems, allKeys, selectedKeys, onSelectionChange, onPageChange } =\n * useTablePagination(allItems, { pageSize: 10 })\n *\n * return (\n * <Table\n * selectionMode=\"multiple\"\n * selectedKeys={selectedKeys}\n * onSelectionChange={onSelectionChange}\n * totalCount={totalItems}\n * hasMultiplePages={totalItems > 10}\n * onSelectAll={() => onSelectionChange(allKeys)}\n * >\n * <Table.BulkBar>...</Table.BulkBar>\n * <Table.Grid aria-label=\"Items\">\n * <Table.Body>\n * {pageItems.map(item => (\n * <Table.Row key={item.id} id={item.id}>...</Table.Row>\n * ))}\n * </Table.Body>\n * </Table.Grid>\n * <Pagination page={page} pageSize={10} count={totalItems} onPageChange={onPageChange} />\n * </Table>\n * )\n */\nexport function useTablePagination<T>(\n items: T[],\n options: UseTablePaginationOptions<T>\n): UseTablePaginationResult<T> {\n const { pageSize, initialPage = 1, getId } = options\n\n const [page, setPage] = useState(initialPage)\n const [selectedKeys, setSelectedKeys] = useState<Set<Key>>(() => new Set())\n\n const totalItems = items.length\n const totalPages = Math.max(1, Math.ceil(totalItems / pageSize))\n\n // Clamp current page when the total page count changes (e.g. items length shrinks).\n useEffect(() => {\n setPage(current => {\n if (current < 1) return 1\n if (current > totalPages) return totalPages\n\n return current\n })\n }, [totalPages])\n\n let effectivePage = page\n if (effectivePage < 1) {\n effectivePage = 1\n } else if (effectivePage > totalPages) {\n effectivePage = totalPages\n }\n\n const pageItems = useMemo(() => {\n const start = (effectivePage - 1) * pageSize\n const end = start + pageSize\n\n return items.slice(start, end)\n }, [items, effectivePage, pageSize])\n\n const allKeys = useMemo(() => {\n const resolveId =\n getId ??\n ((item: T) => {\n const candidate = (item as unknown as { id?: Key }).id\n\n if (candidate == null) {\n throw new Error(\n 'useTablePagination: item.id is undefined. Provide a `getId` option to extract a stable key.'\n )\n }\n\n return candidate\n })\n\n return new Set<Key>(items.map(item => resolveId(item)))\n }, [getId, items])\n\n const pageIds = useMemo(() => {\n const resolveId =\n getId ??\n ((item: T) => {\n const candidate = (item as unknown as { id?: Key }).id\n\n if (candidate == null) {\n throw new Error(\n 'useTablePagination: item.id is undefined. Provide a `getId` option to extract a stable key.'\n )\n }\n\n return candidate\n })\n\n return new Set<Key>(pageItems.map(item => resolveId(item)))\n }, [getId, pageItems])\n\n const handleSelectionChange = (keys: Selection) => {\n // React Aria uses \"all\" to represent \"select all\" in the current context.\n // For the table header checkbox, interpret \"all\" as \"all items on the current page\".\n const newPageSelection = keys === 'all' ? new Set<Key>(pageIds) : new Set(keys as Set<Key>)\n\n setSelectedKeys(prev => {\n const next = new Set<Key>(newPageSelection)\n\n // Keep selections from other pages.\n for (const key of prev) {\n if (!pageIds.has(key)) {\n next.add(key)\n }\n }\n\n return next\n })\n }\n\n const handlePageChange = (details: { page: number }) => {\n setPage(details.page)\n }\n\n const clearSelection = () => {\n setSelectedKeys(() => new Set())\n }\n\n return {\n page: effectivePage,\n setPage,\n pageItems,\n totalItems,\n totalPages,\n allKeys,\n selectedKeys,\n onSelectionChange: handleSelectionChange,\n onPageChange: handlePageChange,\n clearSelection,\n }\n}\n","import { TableGrid, TableRootWrapper } from './Table'\nimport { TableBody } from './TableBody'\nimport {\n TableBulkBar,\n TableBulkBarClearButton,\n TableBulkBarSelectAllButton,\n TableBulkBarSelectedCount,\n} from './TableBulkBar'\nimport { Cell } from './TableCell'\nimport { Column } from './TableColumn'\nimport { TableHeader } from './TableHeader'\nimport { Row } from './TableRow'\n\n/**\n * A compound component for building data tables with support for headers, rows, cells, sorting,\n * pagination, and bulk selection functionality.\n */\nexport const TableCompound: typeof TableRootWrapper & {\n Grid: typeof TableGrid\n Header: typeof TableHeader\n Column: typeof Column\n Body: typeof TableBody\n Row: typeof Row\n Cell: typeof Cell\n BulkBar: typeof TableBulkBar\n BulkBarSelectedCount: typeof TableBulkBarSelectedCount\n BulkBarClearButton: typeof TableBulkBarClearButton\n BulkBarSelectAllButton: typeof TableBulkBarSelectAllButton\n} = Object.assign(TableRootWrapper, {\n Grid: TableGrid,\n Header: TableHeader,\n Column,\n Body: TableBody,\n Row,\n Cell,\n BulkBar: TableBulkBar,\n BulkBarSelectedCount: TableBulkBarSelectedCount,\n BulkBarClearButton: TableBulkBarClearButton,\n BulkBarSelectAllButton: TableBulkBarSelectAllButton,\n})\n\nTableCompound.displayName = 'Table'\nTableHeader.displayName = 'Table.Header'\nColumn.displayName = 'Table.Column'\nTableBody.displayName = 'Table.Body'\nRow.displayName = 'Table.Row'\nCell.displayName = 'Table.Cell'\n\nexport { TableCompound as Table }\n\nexport { useTableSort } from './useTableSort'\nexport { useTablePagination } from './useTablePagination'\nexport type { SortDescriptor } from '@react-types/shared'\nexport type { UseTableSortOptions } from './useTableSort'\nexport type { UseTablePaginationOptions, UseTablePaginationResult } from './useTablePagination'\nexport { type TableGridProps, type TableProps, type TableRootWrapperProps } from './Table'\nexport { type TableHeaderProps } from './TableHeader'\nexport { type ColumnProps } from './TableColumn'\nexport { type TableBodyProps } from './TableBody'\nexport { type RowProps } from './TableRow'\nexport { type CellProps } from './TableCell'\n"],"mappings":";;;;;;;;;;;;;;AAYA,IAAa,KAAwB,EAA0C;CAC7E,aAAa;CACb,YAAY;CACb,CAAC;AAEF,SAAgB,KAA2B;AACzC,QAAO,EAAW,GAAsB;;AAuC1C,IAAa,KAAe,EALwB;CAClD,eAAe;CACf,wBAAwB;CACzB,CAEqF;AAEtF,SAAgB,IAAqC;AACnD,QAAO,EAAW,GAAa;;;;ACfjC,SAAgB,GAAiB,EAC/B,aACA,cACA,iBACA,sBACA,eACA,qBACA,kBAAkB,GAClB,gBACA,oBAAiB,IACjB,0BACA,cACA,iBACA,kBACA,aACA,gBACA,qBACA,mBACA,iBACA,GAAG,KACqB;CACxB,IAAI,IAAgB;AAEpB,CAAI,MAAiB,QACnB,IAAgB,KAAc,IACrB,aAAwB,MACjC,IAAgB,EAAa,OACpB,MACT,IAAgB,IAAI,IAAI,EAAa,CAAC;CAExC,IAAM,IAAmB,YAA+B,oBAAoB,IAAI,KAAK,CAAC,GAEhF,IAAe;EACnB,GAAG;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;AAED,QACE,kBAAC,GAAa,UAAd;EAAuB,OAAO;YAC5B,kBAAC,OAAD;GAAK,WAAW,EAAG,wBAAwB,EAAU;GAAG;GAAe,CAAA;EACjD,CAAA;;AAI5B,GAAiB,cAAc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AQ,EAAQ,KAAK;;EAiBrB,sBAd2B;AAC3B,2BAAsB,IAAI,KAAK,CAAC;;EAcjC;;;;AC1KH,IAAa,IAWT,OAAO,OAAO,IAAkB;CAClC,MAAM;CACN,QAAQ;CACR;CACA,MAAM;CACN;CACA,MAAA;CACA,SAAS;CACT,sBAAsB;CACtB,oBAAoB;CACpB,wBAAwB;CACzB,CAAC;AAEF,EAAc,cAAc,SAC5B,EAAY,cAAc,gBAC1B,EAAO,cAAc,gBACrB,EAAU,cAAc,cACxB,EAAI,cAAc,aAClB,EAAK,cAAc"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/table/internal/TableContext.tsx","../../src/table/internal/TableRootWrapper.tsx","../../src/table/internal/ResizableTableContainer.tsx","../../src/table/internal/table-keyboard.ts","../../src/table/internal/Table.styles.tsx","../../src/table/internal/table-utils.ts","../../src/table/internal/TableKeyboardModeContext.tsx","../../src/table/internal/TableSelectionCheckbox.tsx","../../src/table/internal/TableBodyCellRenderer.tsx","../../src/table/internal/TableBodyRowRenderer.tsx","../../src/table/internal/TableColumnResizer.tsx","../../src/table/internal/TableHeaderSelectionCheckbox.tsx","../../src/table/internal/TableColumnHeader.tsx","../../src/table/internal/TableHeaderRowRenderer.tsx","../../src/table/internal/TableRoot.tsx","../../src/table/internal/TableGrid.tsx","../../src/table/TableBody.tsx","../../src/table/TableBulkBar.tsx","../../src/table/TableCell.tsx","../../src/table/TableColumn.tsx","../../src/table/TableHeader.tsx","../../src/table/TableRow.tsx","../../src/table/useTableSort.ts","../../src/table/useTablePagination.ts","../../src/table/index.ts"],"sourcesContent":["import type { GridNode } from '@react-types/grid'\nimport type { Selection } from '@react-types/shared'\nimport type { SortDescriptor } from '@react-types/shared'\nimport { createContext, useContext } from 'react'\n\nimport type { ResizableTableContainerProps } from './ResizableTableContainer'\n\nexport interface TableResizableContextValue {\n isResizable: boolean\n tableWidth: number\n}\n\nexport const TableResizableContext = createContext<TableResizableContextValue>({\n isResizable: false,\n tableWidth: 0,\n})\n\nexport function useTableResizableContext() {\n return useContext(TableResizableContext)\n}\n\n/** Values provided by Table (root) and consumed by Table.Grid and Table.BulkBar. */\nexport interface TableContextValue {\n onResizeStart?: ResizableTableContainerProps['onResizeStart']\n onResize?: ResizableTableContainerProps['onResize']\n onResizeEnd?: ResizableTableContainerProps['onResizeEnd']\n // Selection (optional when table has no selection)\n selectionMode?: 'none' | 'single' | 'multiple'\n selectionBehavior?: 'toggle' | 'replace'\n selectedKeys?: Selection\n onSelectionChange?: (keys: Selection) => void\n // BulkBar: optional when not using BulkBar\n totalCount?: number\n hasMultiplePages?: boolean\n onSelectAll?: () => void\n // Derived for BulkBar (from selectedKeys + onSelectionChange)\n selectedCount: number\n onClearSelection: () => void\n // Layout / grid\n allowsResizing?: boolean\n /** `aria-label` for column resizer control. */\n resizeColumnAriaLabel?: string | ((column: GridNode<unknown>) => string)\n maxHeight?: number | string\n stickyHeader?: boolean\n onKeyDownCapture?: React.KeyboardEventHandler<Element>\n sortDescriptor?: SortDescriptor\n onSortChange?: (descriptor: SortDescriptor) => void\n className?: string\n // Pass-through for AriaTable (aria-label, etc.)\n [key: string]: unknown\n}\n\nconst defaultTableContextValue: TableContextValue = {\n selectedCount: 0,\n onClearSelection: () => {},\n}\n\nexport const TableContext = createContext<TableContextValue>(defaultTableContextValue)\n\nexport function useTableContext(): TableContextValue {\n return useContext(TableContext)\n}\n","import type { GridNode } from '@react-types/grid'\nimport type { Key, SelectionBehavior } from '@react-types/shared'\nimport type { ColumnSize } from '@react-types/table'\nimport type { TableProps as AriaTableProps } from '@react-types/table'\nimport { cx } from 'class-variance-authority'\nimport type { ReactNode } from 'react'\n\nimport { TableContext, type TableContextValue } from './TableContext'\n\nexport interface TableProps extends Omit<AriaTableProps<object>, 'children' | 'className'> {\n className?: string\n selectionBehavior?: SelectionBehavior\n onKeyDownCapture?: React.KeyboardEventHandler<Element>\n /** When true (default), columns can be resized. Pass onResizeStart, onResize, onResizeEnd to react to resize events. */\n allowsResizing?: boolean\n /** `aria-label` for the column resize control (for i18n). */\n resizeColumnAriaLabel?: string | ((column: GridNode<unknown>) => string)\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void\n onResize?: (widths: Map<Key, ColumnSize>) => void\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n /** Max height of the scroll container (number in px or CSS value). Applied so vertical and horizontal scrollbars share the same container. */\n maxHeight?: number | string\n /** When true, header cells use `position: sticky` inside the scroll container (pair with `maxHeight`). */\n stickyHeader?: boolean\n /** For BulkBar: total number of items (e.g. for \"Select all X items\"). */\n totalCount?: number\n /** When true, BulkBar shows \"Clear all\" and \"Select all\" buttons. */\n hasMultiplePages?: boolean\n /**\n * Called when user clicks \"Clear all\" in BulkBar.\n * Useful with pagination selection models (e.g. `useTablePagination`) where clearing only the\n * current page would be incorrect.\n */\n onClearSelection?: () => void\n /** Called when user clicks \"Select all\" in BulkBar. */\n onSelectAll?: () => void\n}\n\nexport interface TableRootWrapperProps extends TableProps {\n children: ReactNode\n}\n\n/**\n * A data table component that displays information in rows and columns with support for sorting, selection, and resizing.\n */\nexport function TableRootWrapper({\n children,\n className,\n selectedKeys,\n onSelectionChange,\n totalCount,\n hasMultiplePages,\n onClearSelection: onClearSelectionProp,\n onSelectAll,\n allowsResizing = true,\n resizeColumnAriaLabel,\n maxHeight,\n stickyHeader,\n onResizeStart,\n onResize,\n onResizeEnd,\n onKeyDownCapture,\n sortDescriptor,\n onSortChange,\n ...restProps\n}: TableRootWrapperProps) {\n let selectedCount = 0\n\n if (selectedKeys === 'all') {\n selectedCount = totalCount ?? 0\n } else if (selectedKeys instanceof Set) {\n selectedCount = selectedKeys.size\n } else if (selectedKeys) {\n selectedCount = new Set(selectedKeys).size\n }\n const onClearSelection = onClearSelectionProp ?? (() => onSelectionChange?.(new Set()))\n\n const contextValue = {\n ...restProps,\n selectedKeys,\n onSelectionChange,\n totalCount,\n hasMultiplePages,\n onSelectAll,\n selectedCount,\n onClearSelection,\n allowsResizing,\n resizeColumnAriaLabel,\n maxHeight,\n stickyHeader,\n onResizeStart,\n onResize,\n onResizeEnd,\n onKeyDownCapture,\n sortDescriptor,\n onSortChange,\n className,\n }\n\n return (\n <TableContext.Provider value={contextValue as TableContextValue}>\n <div className={cx('gap-md flex flex-col', className)}>{children}</div>\n </TableContext.Provider>\n )\n}\n\nTableRootWrapper.displayName = 'Table'\n","import { useResizeObserver } from '@react-aria/utils'\nimport type { Key } from '@react-types/shared'\nimport type { ColumnSize } from '@react-types/table'\nimport { cx } from 'class-variance-authority'\nimport type { ComponentPropsWithoutRef } from 'react'\nimport { useLayoutEffect, useRef, useState } from 'react'\n\nimport { TableResizableContext } from './TableContext'\n\nexport interface ResizableTableContainerProps extends ComponentPropsWithoutRef<'div'> {\n className?: string\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void\n onResize?: (widths: Map<Key, ColumnSize>) => void\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n}\n\nexport function ResizableTableContainer({\n className,\n children,\n ...props\n}: ResizableTableContainerProps) {\n const containerRef = useRef<HTMLDivElement>(null)\n const [tableWidth, setTableWidth] = useState(0)\n\n useLayoutEffect(() => {\n const el = containerRef.current\n if (!el) return\n\n const update = () => setTableWidth(el.clientWidth)\n update()\n }, [])\n\n useResizeObserver({\n ref: containerRef,\n onResize: () => {\n const el = containerRef.current\n if (!el) return\n setTableWidth(el.clientWidth)\n },\n })\n\n return (\n <TableResizableContext.Provider value={{ isResizable: true, tableWidth }}>\n <div\n ref={containerRef}\n data-spark-component=\"resizable-table-container\"\n className={cx('relative w-full overflow-auto', className)}\n {...props}\n >\n {children}\n </div>\n </TableResizableContext.Provider>\n )\n}\n\nResizableTableContainer.displayName = 'ResizableTableContainer'\n","// oxlint-disable max-lines-per-function\nimport type { DOMAttributes, FocusableElement } from '@react-types/shared'\nimport type { FocusEventHandler, KeyboardEventHandler, PointerEventHandler, RefObject } from 'react'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { mergeProps } from 'react-aria'\n\ntype KeyboardMode = 'grid' | 'interaction'\n\n// Scope to body cells only so we do not affect header keyboard navigation.\nconst BODY_CELL_SELECTOR = '[data-spark-component=\"table-cell\"]'\n\n/**\n * Collapsible list widgets handle Arrow keys on the focused control (Downshift, native select).\n * - Capture: stopping propagation on the grid would prevent the event from reaching them.\n * - Bubble: useSelectableCollection's grid onKeyDown still runs (target is inside the table), so\n * we must not forward vertical arrows to the collection handler in that case.\n */\nexport function targetIsListboxLikeArrowKeyHandler(target: EventTarget | null): boolean {\n if (!target || !(target instanceof Element)) return false\n return Boolean(\n target.closest(\n '[role=\"combobox\"],select,[data-spark-component=\"dropdown-trigger\"],[data-spark-component=\"combobox-input\"]'\n )\n )\n}\n\n/**\n * Open combobox / dropdown consumes Escape to close the list first (APG pattern).\n * Grid uses onKeyDownCapture on the table element, which runs before the trigger's handlers,\n * so we must not exit interaction mode until aria-expanded is false.\n */\nexport function targetIsOpenComboboxConsumingEscape(target: EventTarget | null): boolean {\n if (!target || !(target instanceof Element)) return false\n const el = target.closest(\n '[role=\"combobox\"],[data-spark-component=\"dropdown-trigger\"],[data-spark-component=\"combobox-input\"]'\n )\n if (!el) return false\n return el.getAttribute('aria-expanded') === 'true'\n}\nconst FOCUSABLE_SELECTOR =\n 'a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]'\n\nfunction getCellFromTarget(target: EventTarget | null): HTMLElement | null {\n if (!target || !(target instanceof Element)) return null\n return (target as Element).closest(BODY_CELL_SELECTOR) as HTMLElement | null\n}\n\n/** Row selection column: checkbox should not switch the grid to interaction (edit) mode. */\nfunction isSelectionBodyCell(cell: HTMLElement): boolean {\n return cell.getAttribute('data-table-cell-kind') === 'selection'\n}\n\nfunction getFocusableDescendants(cell: HTMLElement): HTMLElement[] {\n return Array.from(cell.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter(el => {\n if (el === cell) return false\n if (el.hasAttribute('disabled')) return false\n if (el.getAttribute('aria-disabled') === 'true') return false\n if (el.getAttribute('hidden') !== null) return false\n return true\n })\n}\n\nfunction setDescendantsFocusable(cell: HTMLElement, enabled: boolean) {\n for (const el of getFocusableDescendants(cell)) {\n const key = 'data-prev-tabindex'\n if (!enabled) {\n if (!el.hasAttribute(key)) {\n el.setAttribute(key, el.getAttribute('tabindex') ?? '')\n }\n el.setAttribute('tabindex', '-1')\n } else {\n const prev = el.getAttribute(key)\n if (prev === null) continue\n el.removeAttribute(key)\n if (prev === '') el.removeAttribute('tabindex')\n else el.setAttribute('tabindex', prev)\n }\n }\n}\n\nfunction disableInCellFocusablesForGridMode(table: HTMLTableElement) {\n const cells = Array.from(table.querySelectorAll<HTMLElement>(BODY_CELL_SELECTOR))\n for (const cell of cells) {\n setDescendantsFocusable(cell, false)\n }\n}\n\nexport function useTableKeyboardModes<T extends Element>({\n ref,\n gridProps,\n onKeyDownCapture: userOnKeyDownCapture,\n onFocusCapture: userOnFocusCapture,\n}: {\n ref: RefObject<T | null>\n gridProps: DOMAttributes<FocusableElement> | Record<string, unknown>\n onKeyDownCapture?: KeyboardEventHandler<Element>\n onFocusCapture?: FocusEventHandler<Element>\n}): { gridProps: Record<string, unknown>; keyboardMode: KeyboardMode } {\n const [keyboardMode, setKeyboardMode] = useState<KeyboardMode>('grid')\n const keyboardModeRef = useRef<KeyboardMode>('grid')\n const activeCellRef = useRef<HTMLElement | null>(null)\n /** Pointer on a cell descendant: do not pull focus back to the `td` (grid mode). */\n const skipCellFocusRedirectRef = useRef(false)\n\n const mergedGridProps = useMemo(() => {\n const { onKeyDown: collectionOnKeyDown, ...gridPropsWithoutKeyDown } = gridProps as Record<\n string,\n unknown\n > & {\n onKeyDown?: KeyboardEventHandler<Element>\n }\n\n const enterInteractionModeForCell = (bodyCell: HTMLElement) => {\n activeCellRef.current = bodyCell\n keyboardModeRef.current = 'interaction'\n setKeyboardMode('interaction')\n setDescendantsFocusable(bodyCell, true)\n }\n\n const onBlurCapture: FocusEventHandler<Element> = e => {\n if (keyboardModeRef.current !== 'interaction') return\n const root = ref.current\n if (!root) return\n const next = e.relatedTarget\n if (next instanceof Node && root.contains(next)) return\n\n activeCellRef.current = null\n keyboardModeRef.current = 'grid'\n setKeyboardMode('grid')\n }\n\n const onPointerDownCapture: PointerEventHandler<Element> = e => {\n const cell = getCellFromTarget(e.target)\n if (!cell?.matches(BODY_CELL_SELECTOR)) return\n if (!(e.target instanceof Element)) return\n if (e.target !== cell && cell.contains(e.target)) {\n skipCellFocusRedirectRef.current = true\n }\n }\n\n const onFocusCapture: FocusEventHandler<Element> = e => {\n userOnFocusCapture?.(e)\n\n const skipRedirectFromPointerOnChild = skipCellFocusRedirectRef.current\n skipCellFocusRedirectRef.current = false\n\n const root = ref.current\n const cell = getCellFromTarget(e.target)\n\n if (keyboardModeRef.current === 'interaction' && activeCellRef.current && root) {\n const focusMovedToAnotherBodyCell = Boolean(cell && cell !== activeCellRef.current)\n const focusInsideTableButOutsideActiveCell =\n !cell &&\n e.target instanceof Element &&\n root.contains(e.target) &&\n !activeCellRef.current.contains(e.target)\n\n if (focusMovedToAnotherBodyCell || focusInsideTableButOutsideActiveCell) {\n keyboardModeRef.current = 'grid'\n setKeyboardMode('grid')\n if (focusInsideTableButOutsideActiveCell) {\n activeCellRef.current = null\n }\n }\n }\n\n if (!cell) return\n activeCellRef.current = cell\n\n const focusTarget = e.target instanceof Element ? e.target : null\n const isBodyCell = cell.matches(BODY_CELL_SELECTOR)\n const inGridMode = keyboardModeRef.current === 'grid'\n const focusOnCellDescendant = Boolean(\n focusTarget && focusTarget !== cell && cell.contains(focusTarget)\n )\n const hasInteractiveControls = getFocusableDescendants(cell).length > 0\n\n // Grid roving focus: keep focus on the `td` unless the user pointed at in-cell content.\n if (\n inGridMode &&\n isBodyCell &&\n focusOnCellDescendant &&\n hasInteractiveControls &&\n !skipRedirectFromPointerOnChild\n ) {\n queueMicrotask(() => cell.focus())\n }\n\n // Pointer placed focus on a control: match Enter — interaction mode for this cell.\n if (\n skipRedirectFromPointerOnChild &&\n inGridMode &&\n focusOnCellDescendant &&\n isBodyCell &&\n hasInteractiveControls &&\n !isSelectionBodyCell(cell)\n ) {\n enterInteractionModeForCell(cell)\n }\n }\n\n const onKeyDown: KeyboardEventHandler<Element> = e => {\n // In interaction mode, arrow keys should be handled by the focused control (or ignored),\n // not by the grid's roving focus. We gate on the currently focused element rather than\n // the event target so this still holds for composite controls.\n if (\n keyboardModeRef.current === 'interaction' &&\n (e.key === 'ArrowLeft' ||\n e.key === 'ArrowRight' ||\n e.key === 'ArrowUp' ||\n e.key === 'ArrowDown')\n ) {\n const activeCell = activeCellRef.current\n const focused = document.activeElement\n if (activeCell && focused instanceof Node && activeCell.contains(focused)) {\n return\n }\n }\n if (\n keyboardModeRef.current === 'interaction' &&\n (e.key === 'ArrowUp' || e.key === 'ArrowDown') &&\n targetIsListboxLikeArrowKeyHandler(e.target) &&\n getCellFromTarget(e.target) === activeCellRef.current\n ) {\n return\n }\n collectionOnKeyDown?.(e)\n }\n\n const onKeyDownCapture: KeyboardEventHandler<Element> = e => {\n userOnKeyDownCapture?.(e)\n\n // In interaction mode, allow Tab to move between in-cell controls.\n // React Aria's grid tends to treat Tab as \"leave the grid\", so we stop propagation\n // so the browser can handle normal tabbing inside the active cell.\n if (keyboardModeRef.current === 'interaction' && e.key === 'Tab') {\n const cell = getCellFromTarget(e.target)\n if (cell && cell === activeCellRef.current) {\n e.stopPropagation()\n }\n return\n }\n\n if (\n targetIsListboxLikeArrowKeyHandler(e.target) &&\n keyboardModeRef.current === 'interaction' &&\n (e.key === 'ArrowLeft' ||\n e.key === 'ArrowRight' ||\n e.key === 'ArrowUp' ||\n e.key === 'ArrowDown')\n ) {\n const cell = getCellFromTarget(e.target)\n if (cell && cell === activeCellRef.current) {\n return\n }\n }\n\n if (\n keyboardModeRef.current === 'interaction' &&\n (e.key === 'ArrowLeft' ||\n e.key === 'ArrowRight' ||\n e.key === 'ArrowUp' ||\n e.key === 'ArrowDown')\n ) {\n const cell = getCellFromTarget(e.target)\n if (cell && cell === activeCellRef.current) {\n e.stopPropagation()\n return\n }\n }\n\n // In grid mode, ArrowRight on the last cell focuses the row (Spark behavior).\n if (keyboardModeRef.current === 'grid' && e.key === 'ArrowRight') {\n const cell = getCellFromTarget(e.target)\n if (cell) {\n const row = cell.closest('tr') as HTMLElement | null\n if (row) {\n const cells = Array.from(row.querySelectorAll<HTMLElement>(BODY_CELL_SELECTOR))\n const isLastCell = cells.length > 0 && cells[cells.length - 1] === cell\n if (isLastCell) {\n e.preventDefault()\n e.stopPropagation()\n row.focus()\n return\n }\n }\n }\n }\n\n if (keyboardModeRef.current === 'grid' && e.key === 'Enter') {\n const cell = getCellFromTarget(e.target)\n if (!cell) return\n if (isSelectionBodyCell(cell)) return\n\n const focusables = getFocusableDescendants(cell)\n if (focusables.length === 0) return\n\n e.preventDefault()\n e.stopPropagation()\n\n enterInteractionModeForCell(cell)\n focusables[0]?.focus()\n return\n }\n\n // APG grid pattern: F2 is an alternative to Enter to enter \"interaction\" mode.\n // It is also commonly used as a toggle (press again to restore grid navigation).\n if (keyboardModeRef.current === 'grid' && e.key === 'F2') {\n const cell = getCellFromTarget(e.target)\n if (!cell) return\n if (isSelectionBodyCell(cell)) return\n\n const focusables = getFocusableDescendants(cell)\n if (focusables.length === 0) return\n\n e.preventDefault()\n e.stopPropagation()\n\n enterInteractionModeForCell(cell)\n focusables[0]?.focus()\n return\n }\n\n if (keyboardModeRef.current === 'interaction' && e.key === 'Escape') {\n if (targetIsOpenComboboxConsumingEscape(e.target)) {\n return\n }\n\n const cell = activeCellRef.current\n if (!cell) return\n\n e.preventDefault()\n e.stopPropagation()\n\n keyboardModeRef.current = 'grid'\n setKeyboardMode('grid')\n cell.focus()\n }\n\n if (keyboardModeRef.current === 'interaction' && e.key === 'F2') {\n const cell = activeCellRef.current\n if (!cell) return\n\n e.preventDefault()\n e.stopPropagation()\n\n keyboardModeRef.current = 'grid'\n setKeyboardMode('grid')\n cell.focus()\n }\n }\n\n return mergeProps(gridPropsWithoutKeyDown, {\n onKeyDown,\n onKeyDownCapture,\n onBlurCapture,\n onFocusCapture,\n onPointerDownCapture,\n 'data-table-keyboard-mode': keyboardMode,\n })\n }, [gridProps, keyboardMode, ref, userOnFocusCapture, userOnKeyDownCapture])\n\n useEffect(() => {\n keyboardModeRef.current = keyboardMode\n const table = ref.current\n if (!table) return\n\n if (keyboardMode === 'grid') {\n disableInCellFocusablesForGridMode(table as unknown as HTMLTableElement)\n activeCellRef.current?.focus?.()\n return\n }\n\n disableInCellFocusablesForGridMode(table as unknown as HTMLTableElement)\n if (activeCellRef.current) {\n setDescendantsFocusable(activeCellRef.current, true)\n }\n }, [keyboardMode, ref])\n\n return { gridProps: mergedGridProps, keyboardMode }\n}\n","import { cva, type VariantProps } from 'class-variance-authority'\n\nexport const columnStyles = cva(\n [\n 'h-sz-64 min-w-sz-64',\n 'relative group/column first:rounded-l-xl last:rounded-r-xl bg-neutral-container',\n 'pl-lg pr-lg py-sm text-left outline-none box-border',\n 'cursor-default',\n 'data-focus-visible:u-outline data-focus-visible:-outline-offset-2',\n ],\n {\n variants: {\n /** Selection-mode header checkbox column (first column). */\n checkbox: {\n true: ['w-sz-64 min-w-sz-64 max-w-sz-64', 'px-0 align-middle'],\n },\n /** When a header resizer is present, reserve more space on the right. */\n resizable: {\n true: ['pr-xl'],\n },\n },\n defaultVariants: {\n checkbox: false,\n resizable: false,\n },\n }\n)\n\nexport const columnHeaderContentStyles = cva(\n [\n 'flex flex-1 justify-between items-center gap-md',\n 'font-inherit text-left text-inherit',\n 'whitespace-nowrap text-ellipsis',\n 'border-transparent',\n 'data-focus-visible:u-outline data-focus-visible:outline-offset-2',\n ],\n {\n variants: {},\n defaultVariants: {},\n }\n)\n\nexport const tableBodyStyles = cva(\n ['empty:italic empty:text-center empty:text-body-2 empty:py-lg'],\n {\n variants: {},\n defaultVariants: {},\n }\n)\n\nexport const cellStyles = cva(\n [\n 'p-lg outline-none box-border default:overflow-hidden',\n 'border-b-sm border-outline [tr:last-child>&]:border-b-0',\n '[-webkit-tap-highlight-color:transparent]',\n 'data-focus-visible:u-outline-inset data-focus-visible:outline-dashed',\n ],\n {\n variants: {\n /** When true, matches width + padding of the TableSelectionCheckbox header column (w-sz-64, py-sm, no horizontal padding). Use cellCheckboxInnerStyles on the inner wrapper to fill height and center content. */\n checkbox: {\n true: ['w-sz-64 py-sm px-0 align-middle'],\n },\n },\n defaultVariants: {\n checkbox: false,\n },\n }\n)\n\n/** Spacer row: 16px (md) visual gap between header and first data row. Use as first child of tbody. */\nexport const tableBodySpacerRowStyles = cva(\n [\n 'pointer-events-none',\n '[&_td]:h-sz-16 [&_td]:p-0 [&_td]:border-0 [&_td]:border-b-0 [&_td]:bg-surface [&_td]:align-middle',\n ],\n { variants: {}, defaultVariants: {} }\n)\n\nexport type ColumnStylesProps = VariantProps<typeof columnStyles>\nexport type CellStylesProps = VariantProps<typeof cellStyles>\n","/**\n * Selector for elements that have their own Space/Enter behavior (buttons, switches, inputs, etc.).\n * Used to avoid table row selection capturing these keys when focus is on an interactive cell content.\n */\nconst INTERACTIVE_SELECTOR =\n 'button, [role=\"button\"], [role=\"switch\"], [role=\"checkbox\"], [role=\"option\"], input:not([type=\"hidden\"]), select, textarea, [href], [data-spark-component=\"dropdown-trigger\"], [data-spark-component=\"icon-button\"], [data-spark-component=\"switch\"], [data-spark-component=\"switch-input\"], [data-spark-component=\"combobox-input\"]'\n\n/** Matches table-keyboard `FOCUSABLE_SELECTOR` filtering (body cells with embedded controls). */\nconst TABLE_CELL_FOCUSABLE_DESCENDANT_SELECTOR =\n 'a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]'\n\n/**\n * Elements that are expected to \"activate\" on Space/Enter (and for which we may safely synthesize a click\n * when we intercept key events in capture phase).\n *\n * IMPORTANT: text entry controls (text inputs, textarea, select) are intentionally excluded so Space\n * keeps typing/behaving normally.\n */\nconst KEYBOARD_ACTIVATABLE_SELECTOR =\n 'button, [role=\"button\"], [role=\"switch\"], [role=\"checkbox\"], [href], input[type=\"checkbox\"], input[type=\"radio\"], input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"]'\n\n/** Column resizer uses a hidden focusable input for keyboard resize (Enter to toggle, ArrowLeft/Right). Don't convert Enter to click there. */\nconst COLUMN_RESIZER_SELECTOR = '[data-resizable-direction]'\n\nexport function isInteractiveElement(element: EventTarget | null): element is Element {\n if (!element || !(element instanceof Element)) return false\n const el = element as Element\n\n return el.matches(INTERACTIVE_SELECTOR) || el.closest(INTERACTIVE_SELECTOR) !== null\n}\n\nexport function isKeyboardActivatableElement(element: EventTarget | null): element is Element {\n if (!element || !(element instanceof Element)) return false\n const el = element as Element\n\n return (\n el.matches(KEYBOARD_ACTIVATABLE_SELECTOR) || el.closest(KEYBOARD_ACTIVATABLE_SELECTOR) !== null\n )\n}\n\nexport function isColumnResizerElement(element: EventTarget | null): element is Element {\n if (!element || !(element instanceof Element)) return false\n\n return (element as Element).closest(COLUMN_RESIZER_SELECTOR) !== null\n}\n\nfunction elementFromEventTarget(target: EventTarget | null): Element | null {\n if (!target) return null\n if (target instanceof Element) return target\n if (target instanceof Text) return target.parentElement\n return null\n}\n\nfunction tableBodyCellHasInteractiveDescendants(cell: Element): boolean {\n for (const el of cell.querySelectorAll<HTMLElement>(TABLE_CELL_FOCUSABLE_DESCENDANT_SELECTOR)) {\n if (el === cell) continue\n if (el.hasAttribute('disabled')) continue\n if (el.getAttribute('aria-disabled') === 'true') continue\n if (el.getAttribute('hidden') !== null) continue\n return true\n }\n return false\n}\n\n/**\n * Skip React Aria row press/selection when the pointer target is inside in-cell controls\n * (or any \"interactive\" body cell — same heuristic as grid vs interaction keyboard mode).\n */\nexport function shouldSuppressRowSelectionFromPointerTarget(target: EventTarget | null): boolean {\n const el = elementFromEventTarget(target)\n if (!el) return false\n // Cast so the type guard's false-branch does not narrow `el` to `never` (Element ∧ ¬Element).\n if (isInteractiveElement(el as EventTarget)) return true\n\n const cell = el.closest('[data-spark-component=\"table-cell\"]')\n if (!cell || cell.getAttribute('data-table-cell-kind') === 'selection') return false\n\n return tableBodyCellHasInteractiveDescendants(cell)\n}\n","import { createContext } from 'react'\n\nexport type TableKeyboardMode = 'grid' | 'interaction'\n\nexport const TableKeyboardModeContext = createContext<TableKeyboardMode>('grid')\n","import type { AriaCheckboxProps } from '@react-types/checkbox'\n\nimport { Checkbox } from '../../checkbox'\n\nexport interface TableSelectionCheckboxProps {\n checkboxProps: AriaCheckboxProps\n className?: string\n /**\n * When true, marks inner controls as ignored by React Aria's focusable tree walker so Arrow keys\n * move to adjacent cells instead of trapping focus inside the checkbox (grid navigation mode).\n */\n suppressFocusWalker?: boolean\n}\n\n/**\n * Adapter that renders Spark `Checkbox` from React Aria checkbox props.\n * Used for row selection and \"select all\" in the table header.\n */\nexport function TableSelectionCheckbox({\n checkboxProps,\n className,\n suppressFocusWalker,\n}: TableSelectionCheckboxProps) {\n const { isSelected, isIndeterminate, isDisabled, onChange, ...domProps } = checkboxProps\n\n const checked = isIndeterminate === true ? 'indeterminate' : Boolean(isSelected)\n\n return (\n <span\n {...(suppressFocusWalker ? { 'data-react-aria-prevent-focus': true } : undefined)}\n onClick={e => e.stopPropagation()}\n onPointerDown={e => e.stopPropagation()}\n className={className ?? 'flex h-full min-h-full items-center justify-center'}\n >\n <Checkbox\n checked={checked}\n disabled={isDisabled}\n onCheckedChange={onChange}\n {...(domProps as any)}\n />\n </span>\n )\n}\n\nTableSelectionCheckbox.displayName = 'Table.SelectionCheckbox'\n","import { useTableSelectionCheckbox } from '@react-aria/table'\nimport type { TableState } from '@react-stately/table'\nimport type { GridNode } from '@react-types/grid'\nimport type { Key } from '@react-types/shared'\nimport { useCallback, useContext, useRef, type KeyboardEvent } from 'react'\nimport { mergeProps, useFocusRing, useTableCell } from 'react-aria'\n\nimport { cellStyles } from './Table.styles'\nimport { TableKeyboardModeContext } from './TableKeyboardModeContext'\nimport { TableSelectionCheckbox } from './TableSelectionCheckbox'\n\nexport function TableBodyCellRenderer({\n cell,\n state,\n resizeState,\n}: {\n cell: GridNode<unknown>\n state: TableState<unknown>\n resizeState: any\n}) {\n const ref = useRef<HTMLTableCellElement>(null)\n const { gridCellProps } = useTableCell({ node: cell }, state, ref)\n const { isFocusVisible, focusProps } = useFocusRing()\n const keyboardMode = useContext(TableKeyboardModeContext)\n\n const stopRowKeyboardSelectionInInteractionMode = useCallback(\n (e: KeyboardEvent<HTMLTableCellElement>) => {\n if (keyboardMode !== 'interaction') return\n if (e.key !== ' ' && e.key !== 'Enter') return\n e.stopPropagation()\n },\n [keyboardMode]\n )\n\n const { onKeyDownCapture: gridCellKeyDownCapture, ...gridCellPropsRest } = gridCellProps\n const gridCellCaptureWithListboxPassthrough = useCallback(\n (e: KeyboardEvent<HTMLTableCellElement>) => {\n // Arrow keys should not be handled by the cell-level capture handler:\n // - in grid mode, the table/grid roving focus handles navigation\n // - in interaction mode, the focused control should handle arrows (or ignore them)\n const overridenKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']\n\n if (overridenKeys.includes(e.key)) {\n return\n } else {\n gridCellKeyDownCapture?.(e)\n }\n },\n [gridCellKeyDownCapture]\n )\n\n const rowKey = (cell.parentKey ?? (cell as any).key) as Key\n const selectionCheckbox = useTableSelectionCheckbox({ key: rowKey }, state)\n const columnKey = (state.collection.columns[cell.index ?? 0]?.key ?? null) as Key | null\n const columnWidth = columnKey ? resizeState?.columnWidths?.get?.(columnKey) : undefined\n\n if ((cell.props as any)?.isSelectionCell) {\n return (\n <td\n {...mergeProps(\n gridCellPropsRest,\n { onKeyDownCapture: gridCellCaptureWithListboxPassthrough },\n focusProps,\n { onKeyDown: stopRowKeyboardSelectionInInteractionMode }\n )}\n ref={ref}\n data-spark-component=\"table-cell\"\n data-table-cell-kind=\"selection\"\n className={cellStyles({ checkbox: true })}\n data-focus-visible={isFocusVisible || undefined}\n >\n <TableSelectionCheckbox\n suppressFocusWalker={keyboardMode === 'grid'}\n checkboxProps={selectionCheckbox.checkboxProps}\n />\n </td>\n )\n }\n\n return (\n <td\n {...mergeProps(\n gridCellPropsRest,\n { onKeyDownCapture: gridCellCaptureWithListboxPassthrough },\n focusProps,\n { onKeyDown: stopRowKeyboardSelectionInInteractionMode }\n )}\n ref={ref}\n data-spark-component=\"table-cell\"\n className={cellStyles()}\n data-focus-visible={isFocusVisible || undefined}\n style={columnWidth ? { width: columnWidth } : undefined}\n >\n {cell.rendered}\n </td>\n )\n}\n\nTableBodyCellRenderer.displayName = 'Table.BodyCellRenderer'\n","import { getEventTarget } from '@react-aria/utils'\nimport type { TableState } from '@react-stately/table'\nimport type { GridNode } from '@react-types/grid'\nimport { cx } from 'class-variance-authority'\nimport { useRef, type SyntheticEvent } from 'react'\nimport { mergeProps, useFocusRing, useTableRow } from 'react-aria'\n\nimport { shouldSuppressRowSelectionFromPointerTarget } from './table-utils'\nimport { TableBodyCellRenderer } from './TableBodyCellRenderer'\n\nfunction chainUnlessInteractivePointer<E extends SyntheticEvent<unknown>>(\n handler: ((e: E) => void) | undefined\n): ((e: E) => void) | undefined {\n if (!handler) return undefined\n return (e: E) => {\n // `react-aria` types sometimes differ between `Event`/`MouseEvent` generics and DOM `Event`.\n // We only need a DOM `Event` to extract `target`.\n const eventTarget = getEventTarget(e.nativeEvent as any) as EventTarget | null\n if (shouldSuppressRowSelectionFromPointerTarget(eventTarget)) {\n return\n }\n handler(e)\n }\n}\n\nexport function TableBodyRowRenderer({\n item,\n state,\n resizeState,\n}: {\n item: GridNode<unknown>\n state: TableState<unknown>\n resizeState: any\n}) {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps, isSelected } = useTableRow({ node: item }, state, ref)\n const { isFocusVisible, focusProps } = useFocusRing()\n\n const { onClick, onPointerDown, onMouseDown, onPointerUp, onPointerCancel, ...restRowProps } =\n rowProps\n const rowClassName = cx(\n 'outline-none box-border data-focus-visible:u-outline-inset data-focus-visible:outline-dashed',\n (restRowProps as any).className,\n isSelected && 'bg-support-container text-on-support-container'\n )\n\n return (\n <tr\n {...mergeProps(restRowProps, focusProps)}\n onPointerDown={chainUnlessInteractivePointer(onPointerDown)}\n onMouseDown={chainUnlessInteractivePointer(onMouseDown)}\n onPointerUp={chainUnlessInteractivePointer(onPointerUp)}\n onPointerCancel={chainUnlessInteractivePointer(onPointerCancel)}\n onClick={chainUnlessInteractivePointer(onClick)}\n ref={ref}\n data-spark-component=\"table-row\"\n data-selected={isSelected || undefined}\n data-focus-visible={isFocusVisible || undefined}\n className={rowClassName}\n tabIndex={-1}\n >\n {[...item.childNodes].map(cell => (\n <TableBodyCellRenderer key={cell.key} cell={cell} state={state} resizeState={resizeState} />\n ))}\n </tr>\n )\n}\n\nTableBodyRowRenderer.displayName = 'Table.BodyRowRenderer'\n","import { useTableColumnResize } from '@react-aria/table'\nimport type { GridNode } from '@react-types/grid'\nimport { cx } from 'class-variance-authority'\nimport { useRef } from 'react'\n\nexport function TableColumnResizer({\n column,\n ariaLabel,\n resizeState,\n resizeCallbacks,\n}: {\n column: GridNode<unknown>\n ariaLabel?: string\n resizeState: any\n resizeCallbacks: {\n onResizeStart?: (widths: any) => void\n onResize?: (widths: any) => void\n onResizeEnd?: (widths: any) => void\n }\n}) {\n const resizeInputRef = useRef<HTMLInputElement>(null)\n const { resizerProps, inputProps, isResizing } = useTableColumnResize(\n {\n column,\n 'aria-label': ariaLabel ?? 'Resize column',\n onResizeStart: resizeCallbacks.onResizeStart,\n onResize: resizeCallbacks.onResize,\n onResizeEnd: resizeCallbacks.onResizeEnd,\n } as any,\n resizeState,\n resizeInputRef\n )\n\n return (\n <div\n role=\"presentation\"\n className={cx(\n // Visible resize handle on the right edge of the header.\n 'cursor-col-resize absolute inset-y-lg right-0 flex w-lg items-center justify-center',\n // Provide a visible affordance.\n 'after:block after:h-full after:w-[2px] after:bg-outline after:transition-all after:duration-75',\n // Focus visible when the hidden input is focused.\n 'has-[input:focus-visible]:after:u-outline has-[input:focus-visible]:after:outline-offset-2',\n isResizing && 'after:bg-outline-high after:scale-120'\n )}\n data-resizable-direction=\"both\"\n {...resizerProps}\n >\n <input\n ref={resizeInputRef}\n // When not actively resizing, disable the input so grid keyboard navigation\n // cannot land on it (it remains programmatically focusable once enabled).\n disabled={!isResizing}\n {...inputProps}\n />\n </div>\n )\n}\n\nTableColumnResizer.displayName = 'Table.ColumnResizer'\n","import { useTableSelectAllCheckbox } from '@react-aria/table'\nimport type { TableState } from '@react-stately/table'\nimport type { Key } from '@react-types/shared'\nimport type { KeyboardEvent } from 'react'\n\nimport { TableSelectionCheckbox } from './TableSelectionCheckbox'\n\n/**\n * Header \"select all\" checkbox that bases its checked/indeterminate state only\n * on the currently visible (rendered) rows. So when the user changes page in a\n * paginated table, the header shows unchecked instead of indeterminate when no\n * visible row is selected.\n *\n * Keyboard: the column header `<th>` uses React Aria `usePress` for collection\n * selection; Space/Enter would bubble from the checkbox and toggle the wrong key.\n * We stop propagation on those keys and explicitly toggle on Enter (Radix checkbox\n * prevents default Enter on the button so it does not activate like Space).\n */\nexport function TableHeaderSelectionCheckbox({ state }: { state: TableState<unknown> }) {\n const { checkboxProps: selectAllAriaProps } = useTableSelectAllCheckbox(state)\n const { collection, selectionManager } = state\n const selectedKeys = selectionManager.selectedKeys\n\n // Visible row keys: only the body row keys (currently rendered rows).\n // TableCollection has a body node whose children are the rows.\n const collectionWithBody = collection as unknown as {\n body?: { key: Key }\n getChildren: (key: Key) => Iterable<{ key: Key }>\n getKeys: () => IterableIterator<Key>\n }\n const bodyNode = collectionWithBody.body\n const visibleRowKeys =\n bodyNode != null\n ? new Set<Key>([...collectionWithBody.getChildren(bodyNode.key)].map(node => node.key))\n : new Set<Key>(collection.getKeys())\n\n const keysSet = (selectedKeys as unknown) === 'all' ? visibleRowKeys : (selectedKeys as Set<Key>)\n const selectedVisibleCount = [...visibleRowKeys].filter(key => keysSet.has(key)).length\n const visibleCount = visibleRowKeys.size\n\n const isAllSelected = visibleCount > 0 && selectedVisibleCount === visibleCount\n const isIndeterminate = selectedVisibleCount > 0 && selectedVisibleCount < visibleCount\n\n const {\n isSelected: _ignoredSelected,\n isIndeterminate: _ignoredIndeterminate,\n onChange: toggleAllOnChange,\n ...selectAllRest\n } = selectAllAriaProps\n\n const onHeaderSelectAllKeyDown = (e: KeyboardEvent) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.stopPropagation()\n }\n if (e.key !== 'Enter') {\n return\n }\n e.preventDefault()\n if (!selectAllAriaProps.isDisabled) {\n toggleAllOnChange?.(!isAllSelected)\n }\n }\n\n return (\n <TableSelectionCheckbox\n checkboxProps={{\n ...selectAllRest,\n isSelected: isAllSelected,\n isIndeterminate,\n onChange: toggleAllOnChange,\n onKeyDown: onHeaderSelectAllKeyDown,\n }}\n />\n )\n}\n\nTableHeaderSelectionCheckbox.displayName = 'Table.HeaderSelectionCheckbox'\n","// oxlint-disable max-lines-per-function\nimport type { TableState } from '@react-stately/table'\nimport type { GridNode } from '@react-types/grid'\nimport { ArrowDown } from '@spark-ui/icons/ArrowDown'\nimport { ArrowUp } from '@spark-ui/icons/ArrowUp'\nimport { Sort } from '@spark-ui/icons/Sort'\nimport { cx } from 'class-variance-authority'\nimport { useRef } from 'react'\nimport { mergeProps, useFocusRing, useTableColumnHeader } from 'react-aria'\n\nimport { Icon } from '../../icon'\nimport { columnHeaderContentStyles, columnStyles } from './Table.styles'\nimport { TableColumnResizer } from './TableColumnResizer'\nimport { useTableContext } from './TableContext'\nimport { TableHeaderSelectionCheckbox } from './TableHeaderSelectionCheckbox'\n\nconst stickyHeaderCellClassName = cx('sticky top-0 z-sticky')\n\nexport function TableColumnHeader({\n column,\n state,\n resizeState,\n stickyHeader,\n resizeCallbacks,\n isLastColumnInRow = false,\n}: {\n column: GridNode<unknown>\n state: TableState<unknown>\n resizeState: any\n stickyHeader?: boolean\n resizeCallbacks: {\n onResizeStart?: (widths: any) => void\n onResize?: (widths: any) => void\n onResizeEnd?: (widths: any) => void\n }\n /** Rightmost header cell in this row. No resizer — nothing to resize against. */\n isLastColumnInRow?: boolean\n}) {\n const ref = useRef<HTMLTableCellElement>(null)\n const { resizeColumnAriaLabel } = useTableContext()\n const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref)\n const { isFocusVisible, focusProps } = useFocusRing()\n const allowsResizing = (column.props as any)?.allowsResizing !== false && !isLastColumnInRow\n const columnWidth = resizeState?.columnWidths?.get?.(column.key)\n const hasResizer = Boolean(resizeState && allowsResizing)\n\n if ((column.props as any)?.isSelectionCell) {\n return (\n <th\n {...columnHeaderProps}\n ref={ref}\n role=\"columnheader\"\n className={cx(columnStyles({ checkbox: true }), stickyHeader && stickyHeaderCellClassName)}\n data-spark-component=\"table-column\"\n data-table-selection-columnheader\n data-focus-visible={isFocusVisible || undefined}\n >\n <TableHeaderSelectionCheckbox state={state} />\n </th>\n )\n }\n\n const allowsSorting = Boolean((column.props as any)?.allowsSorting)\n const isSorted = state.sortDescriptor?.column === column.key\n const direction = state.sortDescriptor?.direction ?? 'ascending'\n const sortIcon = (() => {\n if (!isSorted) return <Sort />\n return direction === 'descending' ? <ArrowDown /> : <ArrowUp />\n })()\n\n const handleSortingKeyDown = (e: React.KeyboardEvent) => {\n // Ensure keyboard sorting works even when column resizing is enabled.\n if (!allowsSorting) return\n if (e.key !== 'Enter' && e.key !== ' ') return\n e.preventDefault()\n e.stopPropagation()\n ;(state as any).sort?.(column.key)\n }\n\n return (\n <th\n {...mergeProps(columnHeaderProps, focusProps)}\n ref={ref}\n role=\"columnheader\"\n className={cx(\n columnStyles({ resizable: hasResizer }),\n stickyHeader && stickyHeaderCellClassName\n )}\n style={columnWidth ? { width: columnWidth } : undefined}\n data-spark-component=\"table-column\"\n data-focus-visible={isFocusVisible || undefined}\n onKeyDown={handleSortingKeyDown}\n >\n <div className={columnHeaderContentStyles()}>\n <button\n type=\"button\"\n className={cx(\n // Make the header title focusable so grid keyboard navigation lands here\n // instead of the resizer when resizing is enabled.\n 'gap-md flex min-w-0 flex-1 items-center text-left',\n 'focus-visible:u-outline outline-none',\n // Avoid default button styling impacting layout.\n 'bg-transparent p-0 border-0'\n )}\n onKeyDown={handleSortingKeyDown}\n >\n <span className=\"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap\">\n {column.rendered}\n </span>\n </button>\n {allowsSorting ? (\n <span\n aria-hidden=\"true\"\n className={cx(\n 'shrink-0 opacity-dim-2 group-hover/column:opacity-100',\n isSorted && 'opacity-100'\n )}\n >\n <Icon size=\"sm\">{sortIcon}</Icon>\n </span>\n ) : null}\n </div>\n {resizeState && allowsResizing ? (\n <TableColumnResizer\n column={column}\n ariaLabel={\n typeof resizeColumnAriaLabel === 'function'\n ? resizeColumnAriaLabel(column)\n : resizeColumnAriaLabel\n }\n resizeState={resizeState}\n resizeCallbacks={resizeCallbacks}\n />\n ) : null}\n </th>\n )\n}\n\nTableColumnHeader.displayName = 'Table.ColumnHeader'\n","import type { TableState } from '@react-stately/table'\nimport type { GridNode } from '@react-types/grid'\nimport { useRef } from 'react'\nimport { useTableHeaderRow } from 'react-aria'\n\nimport { TableColumnHeader } from './TableColumnHeader'\n\nexport function TableHeaderRowRenderer({\n item,\n state,\n resizeState,\n stickyHeader,\n resizeCallbacks,\n}: {\n item: GridNode<unknown>\n state: TableState<unknown>\n resizeState: any\n stickyHeader?: boolean\n resizeCallbacks: {\n onResizeStart?: (widths: any) => void\n onResize?: (widths: any) => void\n onResizeEnd?: (widths: any) => void\n }\n}) {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps } = useTableHeaderRow({ node: item }, state, ref)\n const columns = [...item.childNodes]\n return (\n <tr {...rowProps} ref={ref}>\n {columns.map((column, index) => (\n <TableColumnHeader\n key={column.key}\n column={column}\n state={state}\n resizeState={resizeState}\n stickyHeader={stickyHeader}\n resizeCallbacks={resizeCallbacks}\n isLastColumnInRow={index === columns.length - 1}\n />\n ))}\n </tr>\n )\n}\n\nTableHeaderRowRenderer.displayName = 'Table.HeaderRowRenderer'\n","import { filterDOMProps } from '@react-aria/utils'\nimport { useTableColumnResizeState } from '@react-stately/table'\nimport { useTableState } from '@react-stately/table'\nimport type { TableState } from '@react-stately/table'\nimport type { TableProps as AriaTableProps } from '@react-types/table'\nimport { cx } from 'class-variance-authority'\nimport type { ReactNode } from 'react'\nimport { useRef } from 'react'\nimport { mergeProps, useTable, useTableRowGroup } from 'react-aria'\n\nimport { useTableKeyboardModes } from './table-keyboard'\nimport { tableBodySpacerRowStyles } from './Table.styles'\nimport { TableBodyRowRenderer } from './TableBodyRowRenderer'\nimport { useTableResizableContext } from './TableContext'\nimport { TableHeaderRowRenderer } from './TableHeaderRowRenderer'\nimport { TableKeyboardModeContext } from './TableKeyboardModeContext'\n\nexport function TableRoot({\n className,\n children,\n stickyHeader: stickyHeaderProp,\n ...props\n}: AriaTableProps<object> & {\n className?: string\n stickyHeader?: boolean\n children?: AriaTableProps<object>['children']\n}) {\n const stickyHeader = Boolean(stickyHeaderProp)\n const tableRef = useRef<HTMLTableElement>(null)\n const resizable = useTableResizableContext()\n const shouldUseFixedLayout = (props as any).selectionMode === 'multiple'\n\n const state = useTableState({\n ...(props as AriaTableProps<object>),\n showSelectionCheckboxes: (props as AriaTableProps<object>).selectionMode === 'multiple',\n children,\n })\n\n const columnResizeState = useTableColumnResizeState(\n { tableWidth: resizable.tableWidth },\n state as unknown as TableState<unknown>\n )\n const resizeState =\n resizable.isResizable && (props as any).allowsResizing !== false ? columnResizeState : null\n\n const { gridProps } = useTable({ ...(props as AriaTableProps<unknown>) }, state, tableRef)\n\n const headerRows = state.collection.headerRows\n const bodyRows = [...state.collection.body.childNodes]\n const emptyStateRenderer = (state.collection.body.props as any)?.renderEmptyState as\n | ((props: { isEmpty: boolean; isDropTarget?: boolean }) => ReactNode)\n | undefined\n\n const columnCount = state.collection.columns.length || 1\n const showBodySpacer = bodyRows.length > 0 || Boolean(emptyStateRenderer)\n\n const { rowGroupProps: theadProps } = useTableRowGroup()\n const { rowGroupProps: tbodyProps } = useTableRowGroup()\n\n const { gridProps: keyboardGridProps, keyboardMode } = useTableKeyboardModes({\n ref: tableRef,\n gridProps,\n onKeyDownCapture: (props as any).onKeyDownCapture,\n onFocusCapture: (props as any).onFocusCapture,\n })\n\n return (\n <TableKeyboardModeContext.Provider value={keyboardMode}>\n <table\n {...mergeProps(keyboardGridProps, filterDOMProps(props as any, { global: true }))}\n ref={tableRef}\n data-spark-component=\"table\"\n className={cx(\n 'default:w-full',\n shouldUseFixedLayout ? 'table-fixed' : undefined,\n 'border-separate border-spacing-y-0',\n 'bg-surface',\n 'outline-none',\n 'text-body-1',\n 'forced-color-adjust-none',\n 'data-focus-visible:u-outline-inset',\n 'has-[>[data-empty]]:h-full',\n className\n )}\n >\n <thead {...theadProps} data-spark-component=\"table-header\">\n {headerRows.map(headerRow => (\n <TableHeaderRowRenderer\n key={headerRow.key}\n item={headerRow}\n state={state as TableState<unknown>}\n resizeState={resizeState as any}\n stickyHeader={stickyHeader}\n resizeCallbacks={{\n onResizeStart: (props as any).onResizeStart,\n onResize: (props as any).onResize,\n onResizeEnd: (props as any).onResizeEnd,\n }}\n />\n ))}\n </thead>\n <tbody {...tbodyProps} data-spark-component=\"table-body\">\n {showBodySpacer ? (\n <tr\n aria-hidden=\"true\"\n className={tableBodySpacerRowStyles()}\n role=\"presentation\"\n data-spark-component=\"table-body-spacer\"\n >\n <td colSpan={columnCount} role=\"presentation\" />\n </tr>\n ) : null}\n {bodyRows.length === 0 && emptyStateRenderer ? (\n <tr data-empty>\n <td colSpan={columnCount}>{emptyStateRenderer({ isEmpty: true })}</td>\n </tr>\n ) : null}\n {bodyRows.map(row => (\n <TableBodyRowRenderer\n key={row.key}\n item={row}\n state={state as TableState<unknown>}\n resizeState={resizeState as any}\n />\n ))}\n </tbody>\n </table>\n </TableKeyboardModeContext.Provider>\n )\n}\n\nTableRoot.displayName = 'Table.Grid.Inner'\n","import type { TableProps as AriaTableProps } from '@react-types/table'\n\nimport { ResizableTableContainer } from './ResizableTableContainer'\nimport { useTableContext } from './TableContext'\nimport { TableRoot } from './TableRoot'\n\nfunction toMaxHeightStyle(value: number | string): React.CSSProperties['maxHeight'] {\n return typeof value === 'number' ? `${value}px` : value\n}\n\nexport interface TableGridProps {\n /** Required for accessibility. */\n 'aria-label'?: string\n 'aria-labelledby'?: string\n className?: string\n children?: AriaTableProps<object>['children']\n}\n\nexport function TableGrid({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className: gridClassName,\n children,\n}: TableGridProps) {\n const ctx = useTableContext()\n const {\n allowsResizing = true,\n maxHeight,\n stickyHeader,\n onResizeStart,\n onResize,\n onResizeEnd,\n onKeyDownCapture,\n sortDescriptor,\n onSortChange,\n className: contextClassName,\n ...ariaTableProps\n } = ctx\n\n const scrollContainerStyle =\n maxHeight != null ? { maxHeight: toMaxHeightStyle(maxHeight) } : undefined\n const className = gridClassName ?? contextClassName\n\n const tableRootProps = {\n ...ariaTableProps,\n ...(ariaLabel != null && { 'aria-label': ariaLabel }),\n ...(ariaLabelledBy != null && { 'aria-labelledby': ariaLabelledBy }),\n sortDescriptor,\n onSortChange,\n onKeyDownCapture,\n className,\n stickyHeader,\n }\n\n // React Aria's Table expects a tuple of [Header, Body] children.\n // We keep the public `Table.Grid` API flexible, so we intentionally type-erase at this boundary.\n const TableRootAny = TableRoot as any\n\n if (allowsResizing) {\n return (\n <ResizableTableContainer\n className={className}\n style={scrollContainerStyle}\n onResizeStart={onResizeStart}\n onResize={onResize}\n onResizeEnd={onResizeEnd}\n >\n <TableRootAny {...tableRootProps}>{children}</TableRootAny>\n </ResizableTableContainer>\n )\n }\n\n return (\n <div className=\"relative w-full overflow-auto\" style={scrollContainerStyle}>\n <TableRootAny {...tableRootProps}>{children}</TableRootAny>\n </div>\n )\n}\n\nTableGrid.displayName = 'Table.Grid'\n","import type { TableBodyProps as StatelyTableBodyProps } from '@react-stately/table'\nimport { TableBody as StatelyTableBody } from '@react-stately/table'\nimport type { ReactNode } from 'react'\n\nexport interface TableBodyProps<T extends object = object> extends StatelyTableBodyProps<T> {\n className?: string\n /** Spark-only: used to re-render body when external deps change (Storybook/demo convenience). */\n dependencies?: unknown[]\n /** Spark-only: empty state renderer (handled by Spark Table renderer). */\n renderEmptyState?: () => ReactNode\n}\n\nexport function TableBody<T extends object>(props: TableBodyProps<T>) {\n return <StatelyTableBody {...(props as unknown as StatelyTableBodyProps<T>)} />\n}\n\nTableBody.displayName = 'Table.Body'\n\n// Forward React Stately collection static for useTableState.\n;(TableBody as any).getCollectionNode = (StatelyTableBody as any).getCollectionNode\n","import { cx } from 'class-variance-authority'\nimport type { ComponentPropsWithoutRef, ReactNode } from 'react'\nimport { createContext, useContext } from 'react'\n\nimport { Button, type ButtonProps } from '../button'\nimport { useTableContext } from './internal/TableContext'\n\ninterface TableBulkBarContextValue {\n selectedCount: number\n totalCount?: number\n onClearSelection: () => void\n onSelectAll?: () => void\n /** When true, \"Clear all\" and \"Select all\" are shown (subject to their own conditions). */\n hasMultiplePages?: boolean\n}\n\nconst TableBulkBarContext = createContext<TableBulkBarContextValue | null>(null)\n\nfunction useTableBulkBarContext() {\n const ctx = useContext(TableBulkBarContext)\n\n if (!ctx) {\n throw new Error('Table.BulkBar subcomponents must be used within Table.BulkBar')\n }\n\n return ctx\n}\n\nexport interface TableBulkBarProps {\n children: ReactNode\n className?: string\n /** `aria-label` for the toolbar (for i18n). Overrides `bulkBarAriaLabel` from `Table`. */\n 'aria-label'?: string\n /**\n * Additional props passed to the root element.\n * Note: `role` is fixed to \"toolbar\".\n */\n rootProps?: Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className' | 'role' | 'aria-label'>\n}\n\nfunction TableBulkBarRoot({ children, className, rootProps, ...props }: TableBulkBarProps) {\n const { selectedCount, totalCount, onClearSelection, onSelectAll, hasMultiplePages } = useTableContext()\n\n const contextValue: TableBulkBarContextValue = {\n selectedCount,\n totalCount,\n onClearSelection,\n onSelectAll,\n hasMultiplePages,\n }\n\n return (\n <TableBulkBarContext.Provider value={contextValue}>\n <div\n role=\"toolbar\"\n aria-label={props['aria-label'] ?? 'Table bulk actions'}\n data-spark-component=\"table-bulk-bar\"\n className={cx(\n 'gap-lg min-h-sz-64 flex w-full flex-wrap items-center justify-between',\n 'rounded-lg',\n 'bg-support-container text-on-support-container p-lg',\n className\n )}\n {...rootProps}\n >\n {children}\n </div>\n </TableBulkBarContext.Provider>\n )\n}\n\nfunction TableBulkBarSelectedCount({ children }: { children: ReactNode }) {\n useTableBulkBarContext() // enforce usage within BulkBar\n\n return <span className=\"text-body-1 font-bold\">{children}</span>\n}\n\ntype BulkBarButtonProps = Omit<ButtonProps, 'onClick'>\n\nfunction TableBulkBarClearButton({ className, children, ...props }: BulkBarButtonProps) {\n const { selectedCount, onClearSelection, hasMultiplePages } = useTableBulkBarContext()\n\n if (!hasMultiplePages) {\n return null\n }\n\n const ariaDisabled = selectedCount === 0\n\n return (\n <Button\n size=\"sm\"\n design=\"ghost\"\n intent=\"support\"\n underline\n ariaDisabled={ariaDisabled}\n onClick={onClearSelection}\n className={cx('text-body-2', className)}\n {...props}\n >\n {children}\n </Button>\n )\n}\n\nfunction TableBulkBarSelectAllButton({ className, children, ...props }: BulkBarButtonProps) {\n const { selectedCount, totalCount, onSelectAll, hasMultiplePages } = useTableBulkBarContext()\n\n if (!hasMultiplePages) {\n return null\n }\n\n const ariaDisabled = totalCount == null || onSelectAll == null || selectedCount >= totalCount\n\n return (\n <Button\n size=\"sm\"\n design=\"ghost\"\n intent=\"support\"\n underline\n ariaDisabled={ariaDisabled}\n onClick={onSelectAll}\n className={cx('text-body-2', className)}\n {...props}\n >\n {children}\n </Button>\n )\n}\n\nTableBulkBarRoot.displayName = 'Table.BulkBar'\n\nexport const TableBulkBar = TableBulkBarRoot\nTableBulkBar.displayName = 'Table.BulkBar'\n\nexport { TableBulkBarSelectedCount, TableBulkBarClearButton, TableBulkBarSelectAllButton }\nTableBulkBarSelectedCount.displayName = 'Table.BulkBarSelectedCount'\nTableBulkBarClearButton.displayName = 'Table.BulkBarClearButton'\nTableBulkBarSelectAllButton.displayName = 'Table.BulkBarSelectAllButton'\n","import type { CellProps as StatelyCellProps } from '@react-stately/table'\nimport { Cell as StatelyCell } from '@react-stately/table'\n\nexport interface CellProps extends StatelyCellProps {\n className?: string\n checkbox?: boolean\n}\n\nexport function Cell(props: CellProps) {\n return <StatelyCell {...(props as unknown as StatelyCellProps)} />\n}\n\nCell.displayName = 'Table.Cell'\n\n// Forward React Stately collection static for useTableState.\n;(Cell as any).getCollectionNode = (StatelyCell as any).getCollectionNode\n","import type { PartialNode } from '@react-stately/collections'\nimport type { Key } from '@react-types/shared'\nimport type { ColumnProps as ReactTypesColumnProps } from '@react-types/table'\nimport React, { type ReactElement, type ReactNode } from 'react'\n\nexport interface ColumnProps<T extends object = object> extends Omit<\n ReactTypesColumnProps<T>,\n 'title' | 'children'\n> {\n /** Spark-only props. Stored on the column node and used by the renderer. */\n className?: string\n /** Stable key for the column (Spark API). */\n id?: Key\n /** Header label (Spark API). */\n label: string\n /** Optional header content (Spark API). */\n children?: ReactNode\n allowsResizing?: boolean\n}\n\nexport function Column<T extends object>({\n label,\n allowsResizing = true,\n ...props\n}: ColumnProps<T>) {\n // Collection component: does not render DOM.\n void label\n void allowsResizing\n void props\n return null\n}\n\nColumn.displayName = 'Table.Column'\n\n// React Stately collection static for useTableState, but with Spark's `id` support:\n// React Stately's CollectionBuilder derives keys from React element keys, not `props.id`,\n// so we explicitly set `key` from the `id` prop to preserve Spark's API and tests.\n;(Column as any).getCollectionNode = function* getCollectionNode<T>(\n columnProps: ReactTypesColumnProps<T> & { label?: string; allowsResizing?: boolean },\n context: any\n): Generator<PartialNode<T>, void, any> {\n const rendered =\n (columnProps as any).title ?? (columnProps as any).label ?? columnProps.children ?? null\n const textValue =\n (columnProps as any).textValue ||\n (typeof rendered === 'string' ? rendered : '') ||\n (columnProps as any)['aria-label']\n\n const idKey = (columnProps as any).id\n\n const fullNodes = (yield {\n type: 'column',\n key: idKey ?? null,\n hasChildNodes:\n !!(columnProps as any).childColumns ||\n (!!(columnProps as any).title && React.Children.count(columnProps.children) > 0),\n rendered,\n textValue,\n props: {\n ...(columnProps as any),\n title: (columnProps as any).title ?? (columnProps as any).label,\n allowsResizing: (columnProps as any).allowsResizing,\n },\n *childNodes() {\n if ((columnProps as any).childColumns) {\n for (const child of (columnProps as any).childColumns) {\n yield { type: 'column', value: child }\n }\n } else if ((columnProps as any).title) {\n const childColumns: PartialNode<T>[] = []\n React.Children.forEach(columnProps.children, child => {\n childColumns.push({\n type: 'column',\n element: child as ReactElement<ReactTypesColumnProps<T>>,\n })\n })\n yield* childColumns\n }\n },\n shouldInvalidate(newContext: any) {\n updateContext(newContext)\n return false\n },\n } as PartialNode<T>) as any\n\n const updateContext = (ctx: any) => {\n for (const node of fullNodes) {\n if (!node.hasChildNodes) {\n ctx.columns.push(node)\n }\n }\n }\n\n updateContext(context)\n}\n","import type { TableHeaderProps as StatelyTableHeaderProps } from '@react-stately/table'\nimport { TableHeader as StatelyTableHeader } from '@react-stately/table'\n\nexport interface TableHeaderProps<T extends object = object> extends StatelyTableHeaderProps<T> {\n /**\n * Spark-only props. They are stored on the collection node and used by the renderer.\n * (No DOM is rendered by `@react-stately/table` collection components.)\n */\n className?: string\n}\n\nexport function TableHeader<T extends object>(props: TableHeaderProps<T>) {\n return <StatelyTableHeader {...(props as unknown as StatelyTableHeaderProps<T>)} />\n}\n\nTableHeader.displayName = 'Table.Header'\n\n// Forward React Stately collection static for useTableState.\n;(TableHeader as any).getCollectionNode = (StatelyTableHeader as any).getCollectionNode\n","import type { PartialNode } from '@react-stately/collections'\nimport type { Key } from '@react-types/shared'\nimport type { RowProps as ReactTypesRowProps } from '@react-types/table'\nimport React, { type ReactElement } from 'react'\n\nexport interface RowProps<T extends object = object> extends ReactTypesRowProps<T> {\n className?: string\n /** Stable key for the row (Spark API). */\n id?: Key\n /** Called when the row is activated (e.g. Enter on a link row). */\n onAction?: () => void\n}\n\nexport function Row<T extends object>(props: RowProps<T>) {\n // Collection component: does not render DOM.\n void props\n return null\n}\n\nRow.displayName = 'Table.Row'\n\n// React Stately collection static for useTableState, but with Spark's `id` support:\n// CollectionBuilder derives keys from React element keys, not `props.id`, so we explicitly set `key`.\n;(Row as any).getCollectionNode = function* getCollectionNode<T extends object>(\n props: ReactTypesRowProps<T> & { UNSTABLE_childItems?: any[] },\n context: any\n): Generator<PartialNode<T>, void, any> {\n const { children, textValue, UNSTABLE_childItems } = props as any\n const idKey = (props as any).id\n\n yield {\n type: 'item',\n key: idKey ?? null,\n props,\n textValue,\n 'aria-label': (props as any)['aria-label'],\n hasChildNodes: true,\n *childNodes() {\n if (context.showDragButtons) {\n yield {\n type: 'cell',\n key: 'header-drag',\n props: { isDragButtonCell: true },\n }\n }\n\n if (context.showSelectionCheckboxes && context.selectionMode !== 'none') {\n yield {\n type: 'cell',\n key: 'header',\n props: { isSelectionCell: true },\n }\n }\n\n if (typeof children === 'function') {\n for (const column of context.columns) {\n yield {\n type: 'cell',\n element: children(column.key),\n key: column.key,\n }\n }\n\n if (UNSTABLE_childItems) {\n for (const child of UNSTABLE_childItems) {\n yield { type: 'item', value: child }\n }\n }\n } else {\n const cells: PartialNode<T>[] = []\n const childRows: PartialNode<T>[] = []\n let columnCount = 0\n\n React.Children.forEach(children, node => {\n if (!node) return\n if ((node as any).type === Row) {\n if (cells.length < context.columns.length) {\n throw new Error(\n \"All of a Row's child Cells must be positioned before any child Rows.\"\n )\n }\n\n childRows.push({ type: 'item', element: node as ReactElement<ReactTypesRowProps<T>> })\n } else {\n cells.push({ type: 'cell', element: node as any })\n columnCount += (node as any).props?.colSpan ?? 1\n }\n })\n\n if (columnCount !== context.columns.length) {\n throw new Error(\n `Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`\n )\n }\n\n yield* cells\n yield* childRows\n }\n },\n shouldInvalidate(newContext: any) {\n return (\n newContext.columns.length !== context.columns.length ||\n newContext.columns.some((c: any, i: number) => c.key !== context.columns[i].key) ||\n newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes ||\n newContext.showDragButtons !== context.showDragButtons ||\n newContext.selectionMode !== context.selectionMode\n )\n },\n } satisfies PartialNode<T>\n}\n","import type { SortDescriptor } from '@react-types/shared'\nimport { useMemo, useState } from 'react'\n\nexport interface UseTableSortOptions<T extends object> {\n /** Initial sort column and direction. */\n initialSort?: {\n column: keyof T\n direction: 'ascending' | 'descending'\n }\n /**\n * Custom compare function. If not provided, a default comparator is used:\n * - numbers: numeric comparison\n * - other: localeCompare on string representation\n */\n compare?: (a: T, b: T, column: keyof T, direction: 'ascending' | 'descending') => number\n}\n\nfunction defaultCompare<T extends object>(\n a: T,\n b: T,\n column: keyof T,\n direction: 'ascending' | 'descending'\n): number {\n const aVal = a[column]\n const bVal = b[column]\n\n if (aVal === bVal) return 0\n\n let comparisonResult: number\n if (typeof aVal === 'number' && typeof bVal === 'number') {\n comparisonResult = aVal < bVal ? -1 : 1\n } else {\n comparisonResult = String(aVal).localeCompare(String(bVal))\n }\n\n return direction === 'descending' ? -comparisonResult : comparisonResult\n}\n\n/**\n * Hook to manage table sort state and derive sorted items from a list.\n * Use with Table's sortDescriptor and onSortChange props.\n *\n * @example\n * const { sortDescriptor, onSortChange, setSortDescriptor, sortedItems } = useTableSort(rows, {\n * initialSort: { column: 'name', direction: 'ascending' },\n * })\n * return (\n * <>\n * <Button onClick={() => setSortDescriptor({ column: 'name', direction: 'ascending' })}>Reset sort</Button>\n * <Table sortDescriptor={sortDescriptor} onSortChange={onSortChange}>\n * ...\n * </Table>\n * </>\n * )\n */\nexport function useTableSort<T extends object>(\n items: T[],\n options: UseTableSortOptions<T> = {}\n): {\n sortDescriptor: SortDescriptor\n onSortChange: (descriptor: SortDescriptor) => void\n /** Set sort from outside the table (e.g. a \"Reset sort\" button). */\n setSortDescriptor: (descriptor: SortDescriptor) => void\n sortedItems: T[]\n} {\n const { initialSort, compare } = options\n\n const [sortDescriptor, setSortDescriptor] = useState<SortDescriptor>(() =>\n initialSort\n ? { column: initialSort.column as string, direction: initialSort.direction }\n : { column: 'id', direction: 'ascending' }\n )\n\n const sortedItems = useMemo(() => {\n const column = sortDescriptor.column as keyof T\n if (!column) return [...items]\n\n const compareFn = compare ?? defaultCompare\n const direction = sortDescriptor.direction ?? 'ascending'\n\n return [...items].sort((a, b) => compareFn(a, b, column, direction))\n }, [items, sortDescriptor.column, sortDescriptor.direction, compare])\n\n return {\n sortDescriptor,\n onSortChange: setSortDescriptor,\n setSortDescriptor,\n sortedItems,\n }\n}\n","import type { Key, Selection } from '@react-types/shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nexport interface UseTablePaginationOptions<T> {\n /** Number of items per page. */\n pageSize: number\n /** Initial page index (1-based). Defaults to 1. */\n initialPage?: number\n /**\n * Function to extract a stable key from each item.\n * Defaults to `item.id` if present.\n */\n getId?: (item: T) => Key\n}\n\nexport interface UseTablePaginationResult<T> {\n /** Current page (1-based). */\n page: number\n /** Update the current page manually. */\n setPage: (page: number) => void\n /** Items sliced to the current page. */\n pageItems: T[]\n /** Total number of items. */\n totalItems: number\n /** Total number of pages (at least 1). */\n totalPages: number\n /** All item keys across all pages. */\n allKeys: Set<Key>\n /**\n * Selection state across all pages.\n * Pass to Table (root) as `selectedKeys`.\n */\n selectedKeys: Set<Key>\n /**\n * Selection change handler that keeps selection across pages.\n * Pass to Table (root) as `onSelectionChange`.\n */\n onSelectionChange: (keys: Selection) => void\n /**\n * Convenience handler matching Pagination's `onPageChange` signature:\n * `onPageChange={({ page }) => ...}`.\n */\n onPageChange: (details: { page: number }) => void\n /** Clear selection across all pages. */\n clearSelection: () => void\n}\n\n/**\n * Hook to manage simple client-side pagination and multi-page selection for Table.\n * It slices the full item list to the current page, tracks page state, and merges\n * selection across pages so that rows selected on previous pages remain selected.\n *\n * @example\n * const { page, pageItems, totalItems, allKeys, selectedKeys, onSelectionChange, onPageChange } =\n * useTablePagination(allItems, { pageSize: 10 })\n *\n * return (\n * <Table\n * selectionMode=\"multiple\"\n * selectedKeys={selectedKeys}\n * onSelectionChange={onSelectionChange}\n * totalCount={totalItems}\n * hasMultiplePages={totalItems > 10}\n * onSelectAll={() => onSelectionChange(allKeys)}\n * >\n * <Table.BulkBar>...</Table.BulkBar>\n * <Table.Grid aria-label=\"Items\">\n * <Table.Body>\n * {pageItems.map(item => (\n * <Table.Row key={item.id} id={item.id}>...</Table.Row>\n * ))}\n * </Table.Body>\n * </Table.Grid>\n * <Pagination page={page} pageSize={10} count={totalItems} onPageChange={onPageChange} />\n * </Table>\n * )\n */\nexport function useTablePagination<T>(\n items: T[],\n options: UseTablePaginationOptions<T>\n): UseTablePaginationResult<T> {\n const { pageSize, initialPage = 1, getId } = options\n\n const [page, setPage] = useState(initialPage)\n const [selectedKeys, setSelectedKeys] = useState<Set<Key>>(() => new Set())\n\n const totalItems = items.length\n const totalPages = Math.max(1, Math.ceil(totalItems / pageSize))\n\n // Clamp current page when the total page count changes (e.g. items length shrinks).\n useEffect(() => {\n setPage(current => {\n if (current < 1) return 1\n if (current > totalPages) return totalPages\n\n return current\n })\n }, [totalPages])\n\n let effectivePage = page\n if (effectivePage < 1) {\n effectivePage = 1\n } else if (effectivePage > totalPages) {\n effectivePage = totalPages\n }\n\n const pageItems = useMemo(() => {\n const start = (effectivePage - 1) * pageSize\n const end = start + pageSize\n\n return items.slice(start, end)\n }, [items, effectivePage, pageSize])\n\n const allKeys = useMemo(() => {\n const resolveId =\n getId ??\n ((item: T) => {\n const candidate = (item as unknown as { id?: Key }).id\n\n if (candidate == null) {\n throw new Error(\n 'useTablePagination: item.id is undefined. Provide a `getId` option to extract a stable key.'\n )\n }\n\n return candidate\n })\n\n return new Set<Key>(items.map(item => resolveId(item)))\n }, [getId, items])\n\n const pageIds = useMemo(() => {\n const resolveId =\n getId ??\n ((item: T) => {\n const candidate = (item as unknown as { id?: Key }).id\n\n if (candidate == null) {\n throw new Error(\n 'useTablePagination: item.id is undefined. Provide a `getId` option to extract a stable key.'\n )\n }\n\n return candidate\n })\n\n return new Set<Key>(pageItems.map(item => resolveId(item)))\n }, [getId, pageItems])\n\n const handleSelectionChange = (keys: Selection) => {\n // React Aria uses \"all\" to represent \"select all\" in the current context.\n // For the table header checkbox, interpret \"all\" as \"all items on the current page\".\n const newPageSelection = keys === 'all' ? new Set<Key>(pageIds) : new Set(keys as Set<Key>)\n\n setSelectedKeys(prev => {\n const next = new Set<Key>(newPageSelection)\n\n // Keep selections from other pages.\n for (const key of prev) {\n if (!pageIds.has(key)) {\n next.add(key)\n }\n }\n\n return next\n })\n }\n\n const handlePageChange = (details: { page: number }) => {\n setPage(details.page)\n }\n\n const clearSelection = () => {\n setSelectedKeys(() => new Set())\n }\n\n return {\n page: effectivePage,\n setPage,\n pageItems,\n totalItems,\n totalPages,\n allKeys,\n selectedKeys,\n onSelectionChange: handleSelectionChange,\n onPageChange: handlePageChange,\n clearSelection,\n }\n}\n","import { TableGrid, TableRootWrapper } from './Table'\nimport { TableBody } from './TableBody'\nimport {\n TableBulkBar,\n TableBulkBarClearButton,\n TableBulkBarSelectAllButton,\n TableBulkBarSelectedCount,\n} from './TableBulkBar'\nimport { Cell } from './TableCell'\nimport { Column } from './TableColumn'\nimport { TableHeader } from './TableHeader'\nimport { Row } from './TableRow'\n\n/**\n * A compound component for building data tables with support for headers, rows, cells, sorting,\n * pagination, and bulk selection functionality.\n */\nexport const TableCompound: typeof TableRootWrapper & {\n Grid: typeof TableGrid\n Header: typeof TableHeader\n Column: typeof Column\n Body: typeof TableBody\n Row: typeof Row\n Cell: typeof Cell\n BulkBar: typeof TableBulkBar\n BulkBarSelectedCount: typeof TableBulkBarSelectedCount\n BulkBarClearButton: typeof TableBulkBarClearButton\n BulkBarSelectAllButton: typeof TableBulkBarSelectAllButton\n} = Object.assign(TableRootWrapper, {\n Grid: TableGrid,\n Header: TableHeader,\n Column,\n Body: TableBody,\n Row,\n Cell,\n BulkBar: TableBulkBar,\n BulkBarSelectedCount: TableBulkBarSelectedCount,\n BulkBarClearButton: TableBulkBarClearButton,\n BulkBarSelectAllButton: TableBulkBarSelectAllButton,\n})\n\nTableCompound.displayName = 'Table'\nTableHeader.displayName = 'Table.Header'\nColumn.displayName = 'Table.Column'\nTableBody.displayName = 'Table.Body'\nRow.displayName = 'Table.Row'\nCell.displayName = 'Table.Cell'\n\nexport { TableCompound as Table }\n\nexport { useTableSort } from './useTableSort'\nexport { useTablePagination } from './useTablePagination'\nexport type { SortDescriptor } from '@react-types/shared'\nexport type { UseTableSortOptions } from './useTableSort'\nexport type { UseTablePaginationOptions, UseTablePaginationResult } from './useTablePagination'\nexport { type TableGridProps, type TableProps, type TableRootWrapperProps } from './Table'\nexport { type TableHeaderProps } from './TableHeader'\nexport { type ColumnProps } from './TableColumn'\nexport { type TableBodyProps } from './TableBody'\nexport { type RowProps } from './TableRow'\nexport { type CellProps } from './TableCell'\n"],"mappings":";;;;;;;;;;;;;;AAYA,IAAa,KAAwB,EAA0C;CAC7E,aAAa;CACb,YAAY;CACb,CAAC;AAEF,SAAgB,KAA2B;AACzC,QAAO,EAAW,GAAsB;;AAuC1C,IAAa,KAAe,EALwB;CAClD,eAAe;CACf,wBAAwB;CACzB,CAEqF;AAEtF,SAAgB,IAAqC;AACnD,QAAO,EAAW,GAAa;;;;ACfjC,SAAgB,GAAiB,EAC/B,aACA,cACA,iBACA,sBACA,eACA,qBACA,kBAAkB,GAClB,gBACA,oBAAiB,IACjB,0BACA,cACA,iBACA,kBACA,aACA,gBACA,qBACA,mBACA,iBACA,GAAG,KACqB;CACxB,IAAI,IAAgB;AAEpB,CAAI,MAAiB,QACnB,IAAgB,KAAc,IACrB,aAAwB,MACjC,IAAgB,EAAa,OACpB,MACT,IAAgB,IAAI,IAAI,EAAa,CAAC;CAExC,IAAM,IAAmB,YAA+B,oBAAoB,IAAI,KAAK,CAAC,GAEhF,IAAe;EACnB,GAAG;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA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IAAO,IAAI,IAAS,EAAiB;AAG3C,SAAK,IAAM,KAAO,EAChB,CAAK,EAAQ,IAAI,EAAI,IACnB,EAAK,IAAI,EAAI;AAIjB,WAAO;KACP;;EAoBF,eAjBwB,MAA8B;AACtD,KAAQ,EAAQ,KAAK;;EAiBrB,sBAd2B;AAC3B,2BAAsB,IAAI,KAAK,CAAC;;EAcjC;;;;AC1KH,IAAa,IAWT,OAAO,OAAO,IAAkB;CAClC,MAAM;CACN,QAAQ;CACR;CACA,MAAM;CACN;CACA,MAAA;CACA,SAAS;CACT,sBAAsB;CACtB,oBAAoB;CACpB,wBAAwB;CACzB,CAAC;AAEF,EAAc,cAAc,SAC5B,EAAY,cAAc,gBAC1B,EAAO,cAAc,gBACrB,EAAU,cAAc,cACxB,EAAI,cAAc,aAClB,EAAK,cAAc"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);const e=require(`../input-BUSYZ_VO.js`);let t=require(`class-variance-authority`),n=require(`react/jsx-runtime`);var r=t=>(0,n.jsx)(e.t.ClearButton,{inline:!0,"data-spark-component":`textarea-group-trailing-icon`,...t});r.id=e.t.ClearButton.id,r.displayName=`TextareaGroup.ClearButton`;var i=t=>(0,n.jsx)(e.t,{...t});i.displayName=`TextareaGroup`;var a=t=>(0,n.jsx)(e.t.LeadingIcon,{"data-spark-component":`textarea-group-leading-icon`,...t});a.id=e.t.LeadingIcon.id,a.displayName=`TextareaGroup.LeadingIcon`;var o=t=>(0,n.jsx)(e.t.TrailingIcon,{"data-spark-component":`textarea-group-trailing-icon`,...t});o.id=e.t.TrailingIcon.id,o.displayName=`TextareaGroup.TrailingIcon`;var s=({className:r,disabled:i,rows:a=1,isResizable:o=!0,ref:s,onValueChange:c,...l})=>(0,n.jsx)(e.n,{className:(0,t.cx)(r,`py-[var(--spacing-sz-10)]`,o?`resize-y`:`resize-none`),"data-spark-component":`textarea`,disabled:i,asChild:!0,onValueChange:c,children:(0,n.jsx)(`textarea`,{ref:s,rows:a,...l})}),c=Object.assign(s,{id:e.n.id});s.displayName=`Textarea`;var l=Object.assign(i,{LeadingIcon:a,TrailingIcon:o,ClearButton:r});l.displayName=`TextareaGroup`,a.displayName=`TextareaGroup.LeadingIcon`,o.displayName=`TextareaGroup.TrailingIcon`,r.displayName=`TextareaGroup.ClearButton`,exports.Textarea=c,exports.TextareaGroup=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);const e=require(`../input-DaShg4eE.js`);let t=require(`class-variance-authority`),n=require(`react/jsx-runtime`);var r=t=>(0,n.jsx)(e.t.ClearButton,{inline:!0,"data-spark-component":`textarea-group-trailing-icon`,...t});r.id=e.t.ClearButton.id,r.displayName=`TextareaGroup.ClearButton`;var i=t=>(0,n.jsx)(e.t,{...t});i.displayName=`TextareaGroup`;var a=t=>(0,n.jsx)(e.t.LeadingIcon,{"data-spark-component":`textarea-group-leading-icon`,...t});a.id=e.t.LeadingIcon.id,a.displayName=`TextareaGroup.LeadingIcon`;var o=t=>(0,n.jsx)(e.t.TrailingIcon,{"data-spark-component":`textarea-group-trailing-icon`,...t});o.id=e.t.TrailingIcon.id,o.displayName=`TextareaGroup.TrailingIcon`;var s=({className:r,disabled:i,rows:a=1,isResizable:o=!0,ref:s,onValueChange:c,...l})=>(0,n.jsx)(e.n,{className:(0,t.cx)(r,`py-[var(--spacing-sz-10)]`,o?`resize-y`:`resize-none`),"data-spark-component":`textarea`,disabled:i,asChild:!0,onValueChange:c,children:(0,n.jsx)(`textarea`,{ref:s,rows:a,...l})}),c=Object.assign(s,{id:e.n.id});s.displayName=`Textarea`;var l=Object.assign(i,{LeadingIcon:a,TrailingIcon:o,ClearButton:r});l.displayName=`TextareaGroup`,a.displayName=`TextareaGroup.LeadingIcon`,o.displayName=`TextareaGroup.TrailingIcon`,r.displayName=`TextareaGroup.ClearButton`,exports.Textarea=c,exports.TextareaGroup=l;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "../input-CiWFuTs_.mjs";
1
+ import { n as e, t } from "../input-Dtabf6Mp.mjs";
2
2
  import { cx as n } from "class-variance-authority";
3
3
  import { jsx as r } from "react/jsx-runtime";
4
4
  //#region src/textarea/TextareaClearButton.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/components",
3
- "version": "17.5.3",
3
+ "version": "17.5.4-beta.1",
4
4
  "license": "MIT",
5
5
  "description": "Spark (Leboncoin design system) components.",
6
6
  "exports": {
@@ -51,9 +51,9 @@
51
51
  "@react-aria/button": "3.13.3",
52
52
  "@react-aria/numberfield": "3.11.16",
53
53
  "@react-stately/numberfield": "3.9.13",
54
- "@spark-ui/hooks": "17.5.3",
55
- "@spark-ui/icons": "17.5.3",
56
- "@spark-ui/internal-utils": "17.5.3",
54
+ "@spark-ui/hooks": "17.5.4-beta.1",
55
+ "@spark-ui/icons": "17.5.4-beta.1",
56
+ "@spark-ui/internal-utils": "17.5.4-beta.1",
57
57
  "@zag-js/pagination": "1.30.0",
58
58
  "@zag-js/react": "1.30.0",
59
59
  "class-variance-authority": "0.7.1",
@@ -65,7 +65,7 @@
65
65
  "react-snap-carousel": "0.5.1"
66
66
  },
67
67
  "peerDependencies": {
68
- "@spark-ui/theme-utils": "17.5.3",
68
+ "@spark-ui/theme-utils": "17.5.4-beta.1",
69
69
  "react": "19.2.4",
70
70
  "react-dom": "19.2.4",
71
71
  "tailwindcss": "4.1.18"
@@ -1,2 +0,0 @@
1
- require(`./chunk-C91j1N6u.js`);const e=require(`./slot/index.js`),t=require(`./icon-CRPcdgYp.js`);let n=require(`class-variance-authority`),r=require(`react`),i=require(`react/jsx-runtime`),a=require(`@spark-ui/hooks/use-merge-refs`),o=require(`@spark-ui/components/form-field`),s=require(`@spark-ui/hooks/use-combined-state`),c=require(`@spark-ui/icons/DeleteOutline`);var l=(0,r.createContext)(null),u=()=>(0,r.useContext)(l)||{isStandalone:!0},d=({className:e,tabIndex:r=-1,onClick:a,inline:o=!1,ref:s,...l})=>{let{onClear:d,hasTrailingIcon:f}=u(),p=e=>{a&&a(e),d&&d()};return(0,i.jsx)(`button`,{ref:s,"data-spark-component":`input-clear-button`,className:(0,n.cx)(e,`pointer-events-auto absolute`,o?`h-sz-44 top-0 -translate-y-0`:`top-1/2 -translate-y-1/2`,`inline-flex h-full items-center justify-center outline-hidden`,`text-neutral hover:text-neutral-hovered`,f?`right-3xl px-sz-12`:`pl-md pr-lg right-0`),tabIndex:r,onClick:p,type:`button`,...l,children:(0,i.jsx)(t.t,{size:`sm`,children:(0,i.jsx)(c.DeleteOutline,{})})})},f=Object.assign(d,{id:`ClearButton`});d.displayName=`InputGroup.ClearButton`;var p=(0,n.cva)([`relative inline-flex w-full`],{variants:{disabled:{true:[`cursor-not-allowed`,`relative`,`after:absolute`,`after:top-0`,`after:h-full`,`after:w-full`,`after:border-sm after:border-outline`,`after:rounded-lg`],false:`after:hidden`},readOnly:{true:[`relative`,`after:absolute`,`after:top-0`,`after:h-full`,`after:w-full`,`after:border-sm after:border-outline`,`after:rounded-lg`],false:`after:hidden`}}}),m=({className:e,children:t,state:n,disabled:c,readOnly:u,onClear:d,ref:f,...m})=>{let h=e=>e?e.type.id:``,g=(...e)=>_.find(t=>e.includes(h(t)||``)),_=r.Children.toArray(t).filter(r.isValidElement),v=g(`Input`),y=v?.props||{},b=(0,r.useRef)(null),x=(0,r.useRef)(d),S=(0,a.useMergeRefs)(v?.ref,b),[C,w]=(0,s.useCombinedState)(y.value,y.defaultValue,y.onValueChange),T=(0,o.useFormFieldControl)(),E=T.state??n,D=T.disabled||!!c,O=T.readOnly||!!u,k=g(`LeadingAddon`),A=g(`LeadingIcon`),j=g(`ClearButton`),M=g(`TrailingIcon`),N=g(`TrailingAddon`),P=!!k,F=!!N,I=!!A,L=!!M,R=!!C&&!!j&&!D&&!O,z=e=>{y.onChange&&y.onChange(e),w(e.target.value)},B=(0,r.useCallback)(()=>{x.current&&x.current(),w(``),b.current.focus()},[w]),V=(0,r.useMemo)(()=>({state:E,disabled:D,readOnly:O,hasLeadingIcon:I,hasTrailingIcon:L,hasLeadingAddon:P,hasTrailingAddon:F,hasClearButton:R,onClear:B}),[E,D,O,I,L,P,F,R,B]);(0,r.useEffect)(()=>{x.current=d},[d]);let H=b.current?.value;return(0,i.jsx)(l.Provider,{value:V,children:(0,i.jsxs)(`div`,{"data-spark-component":`input-group`,ref:f,className:p({disabled:D,readOnly:O,className:e}),...m,children:[P&&k,(0,i.jsxs)(`div`,{className:`relative inline-flex w-full`,children:[v&&(0,r.cloneElement)(v,{value:C??H??``,ref:S,defaultValue:void 0,onChange:z}),A,R&&j,M]}),F&&N]})})};m.displayName=`InputGroup`;var h=(0,n.cva)([`overflow-hidden`,`border-sm`,`shrink-0`,`h-full`,`focus-visible:relative focus-visible:z-raised`,`mx-0`],{variants:{asChild:{false:[`flex`,`items-center`,`px-lg`]},intent:{neutral:`border-outline`,error:`border-error`,alert:`border-alert`,success:`border-success`},disabled:{true:[`pointer-events-none border-outline!`]},readOnly:{true:[`pointer-events-none`]},design:{text:``,solid:``,inline:``}},compoundVariants:[{disabled:!1,readOnly:!1,design:`text`,class:[`bg-surface`,`text-on-surface`]},{disabled:!0,design:`text`,class:[`text-on-surface/dim-3`]},{disabled:!0,design:[`solid`,`inline`],class:[`opacity-dim-3`]}],defaultVariants:{intent:`neutral`}}),g=({asChild:t,className:n,children:a,ref:o,...s})=>{let{state:c,disabled:l,readOnly:d}=u(),f=typeof a==`string`,p=!!(!f&&t),m=f?a:r.Children.only(a),g=p&&!f?e.Slot:`div`,_=f?`text`:p?`solid`:`inline`;return(0,i.jsx)(g,{ref:o,"data-spark-component":`input-addon`,className:h({className:n,intent:c,disabled:l,readOnly:d,asChild:p,design:_}),...l&&{tabIndex:-1},...s,children:m})};g.displayName=`InputGroup.Addon`;var _=({className:e,ref:t,...r})=>{let{disabled:a,readOnly:o}=u();return(0,i.jsx)(`div`,{className:(0,n.cx)(`rounded-l-lg`,a||o?`bg-on-surface/dim-5`:null),children:(0,i.jsx)(g,{ref:t,className:(0,n.cx)(e,`rounded-r-0! mr-[-1px] rounded-l-lg`),...r})})},v=Object.assign(_,{id:`LeadingAddon`});_.displayName=`InputGroup.LeadingAddon`;var y=({className:e,intent:r,children:a,...o})=>{let{disabled:s,readOnly:c}=u(),l=s||c;return(0,i.jsx)(t.t,{"data-spark-component":`input-icon`,intent:r,className:(0,n.cx)(e,`pointer-events-none absolute top-[calc(var(--spacing-sz-44)/2)] -translate-y-1/2`,r?void 0:`text-neutral peer-focus:text-outline-high`,l?`opacity-dim-3`:void 0),...o,children:a})};y.displayName=`InputGroup.Icon`;var b=({className:e,...t})=>(0,i.jsx)(y,{className:(0,n.cx)(e,`left-lg text-body-1`),...t});b.id=`LeadingIcon`,b.displayName=`InputGroup.LeadingIcon`;var x=({className:e,ref:t,...r})=>{let{disabled:a,readOnly:o}=u();return(0,i.jsx)(`div`,{className:(0,n.cx)(`rounded-r-lg`,a||o?`bg-on-surface/dim-5`:null),children:(0,i.jsx)(g,{ref:t,className:(0,n.cx)(e,`rounded-l-0! ml-[-1px] rounded-r-lg`),...r})})},S=Object.assign(x,{id:`TrailingAddon`});x.displayName=`InputGroup.TrailingAddon`;var C=({className:e,...t})=>(0,i.jsx)(y,{className:(0,n.cx)(e,`right-lg text-body-1`),...t});C.id=`TrailingIcon`,C.displayName=`InputGroup.TrailingIcon`;var w=(0,n.cva)([`relative`,`border-sm`,`peer`,`w-full`,`appearance-none outline-hidden`,`bg-surface`,`text-ellipsis text-body-1 text-on-surface`,`caret-neutral`,`[&:-webkit-autofill]:[-webkit-text-fill-color:var(--color-on-surface)]`,`autofill:shadow-surface autofill:shadow-[inset_0_0_0px_1000px]`,`disabled:cursor-not-allowed disabled:border-outline disabled:bg-on-surface/dim-5 disabled:text-on-surface/dim-3`,`read-only:cursor-default read-only:pointer-events-none read-only:bg-on-surface/dim-5`,`focus:ring-1 focus:ring-inset focus:ring-focus focus:border-focus`],{variants:{asChild:{true:[`min-h-sz-44`],false:[`h-sz-44`]},intent:{neutral:[`border-outline`,`default:hover:border-outline-high`],success:[`default:border-success`],alert:[`default:border-alert`],error:[`default:border-error`]},hasLeadingAddon:{true:[`rounded-l-0`],false:[`rounded-l-lg`]},hasTrailingAddon:{true:[`rounded-r-0`],false:[`rounded-r-lg`]},hasLeadingIcon:{true:[`pl-3xl`],false:[`pl-lg`]},hasTrailingIcon:{true:``},hasClearButton:{true:``}},compoundVariants:[{hasTrailingIcon:!1,hasClearButton:!1,class:`pr-lg`},{hasTrailingIcon:!0,hasClearButton:!1,class:`pr-3xl`},{hasTrailingIcon:!1,hasClearButton:!0,class:`pr-3xl`},{hasTrailingIcon:!0,hasClearButton:!0,class:`pr-[calc(var(--spacing-3xl)*2)]`}],defaultVariants:{intent:`neutral`}}),T=({className:t,asChild:n=!1,onValueChange:r,onChange:a,onKeyDown:s,disabled:c,readOnly:l,ref:d,...f})=>{let p=(0,o.useFormFieldControl)(),m=u(),{id:h,name:g,isInvalid:_,isRequired:v,description:y}=p,{hasLeadingAddon:b,hasTrailingAddon:x,hasLeadingIcon:S,hasTrailingIcon:C,hasClearButton:T,onClear:E}=m,D=n?e.Slot:`input`,O=p.state||m.state,k=p.disabled||m.disabled||c,A=p.readOnly||m.readOnly||l,j=e=>{a&&a(e),r&&r(e.target.value)},M=e=>{s&&s(e),T&&E&&e.key===`Escape`&&E()};return(0,i.jsx)(D,{"data-spark-component":`input`,ref:d,id:h,name:g,className:w({asChild:n,className:t,intent:O,hasLeadingAddon:!!b,hasTrailingAddon:!!x,hasLeadingIcon:!!S,hasTrailingIcon:!!C,hasClearButton:!!T}),disabled:k,readOnly:A,required:v,"aria-describedby":y,"aria-invalid":_,onChange:j,onKeyDown:M,...f})},E=Object.assign(T,{id:`Input`});T.displayName=`Input`;var D=Object.assign(m,{LeadingAddon:v,TrailingAddon:S,LeadingIcon:b,TrailingIcon:C,ClearButton:f});D.displayName=`InputGroup`,v.displayName=`InputGroup.LeadingAddon`,S.displayName=`InputGroup.TrailingAddon`,b.displayName=`InputGroup.LeadingIcon`,C.displayName=`InputGroup.TrailingIcon`,f.displayName=`InputGroup.ClearButton`,Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return D}});
2
- //# sourceMappingURL=input-BUSYZ_VO.js.map