@proyecto-viviana/solidaria 0.4.1 → 0.4.3

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 (54) hide show
  1. package/dist/_chunk/DragManager.js.map +1 -1
  2. package/dist/_chunk/DragManager.jsx.map +1 -1
  3. package/dist/_chunk/actiongroup.js.map +1 -1
  4. package/dist/_chunk/actiongroup.jsx.map +1 -1
  5. package/dist/_chunk/datepicker.js +544 -544
  6. package/dist/_chunk/datepicker.js.map +1 -1
  7. package/dist/_chunk/datepicker.jsx +544 -544
  8. package/dist/_chunk/datepicker.jsx.map +1 -1
  9. package/dist/_chunk/dnd.js.map +1 -1
  10. package/dist/_chunk/dnd.jsx.map +1 -1
  11. package/dist/_chunk/select.js +6 -2
  12. package/dist/_chunk/select.js.map +1 -1
  13. package/dist/_chunk/select.jsx +6 -2
  14. package/dist/_chunk/select.jsx.map +1 -1
  15. package/dist/_chunk/spinbutton.js +34 -34
  16. package/dist/_chunk/spinbutton.js.map +1 -1
  17. package/dist/_chunk/spinbutton.jsx +34 -34
  18. package/dist/_chunk/spinbutton.jsx.map +1 -1
  19. package/dist/_chunk/table.js.map +1 -1
  20. package/dist/_chunk/table.jsx.map +1 -1
  21. package/dist/_chunk/tree.js.map +1 -1
  22. package/dist/_chunk/tree.jsx.map +1 -1
  23. package/dist/actiongroup/createActionGroup.d.ts.map +1 -1
  24. package/dist/datepicker/createDateField.d.ts.map +1 -1
  25. package/dist/datepicker/createDatePickerGroup.d.ts.map +1 -1
  26. package/dist/datepicker/createDateSegment.d.ts.map +1 -1
  27. package/dist/datepicker/createTimeField.d.ts.map +1 -1
  28. package/dist/datepicker/intl.d.ts.map +1 -1
  29. package/dist/dnd/DragManager.d.ts.map +1 -1
  30. package/dist/dnd/createDraggableItem.d.ts.map +1 -1
  31. package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
  32. package/dist/select/createSelect.d.ts.map +1 -1
  33. package/dist/spinbutton/index.d.ts +2 -2
  34. package/dist/spinbutton/index.d.ts.map +1 -1
  35. package/dist/table/createTable.d.ts.map +1 -1
  36. package/dist/table/utils.d.ts.map +1 -1
  37. package/dist/tree/createTree.d.ts.map +1 -1
  38. package/package.json +4 -2
  39. package/src/actiongroup/createActionGroup.ts +1 -4
  40. package/src/datepicker/createDateField.ts +3 -1
  41. package/src/datepicker/createDatePickerGroup.ts +8 -4
  42. package/src/datepicker/createDateSegment.ts +47 -39
  43. package/src/datepicker/createTimeField.ts +1 -5
  44. package/src/datepicker/intl.ts +587 -544
  45. package/src/dnd/DragManager.ts +5 -5
  46. package/src/dnd/DropTargetKeyboardNavigation.ts +6 -4
  47. package/src/dnd/createDraggableItem.ts +3 -1
  48. package/src/dnd/createDroppableCollection.ts +7 -8
  49. package/src/select/createSelect.ts +19 -16
  50. package/src/spinbutton/index.ts +2 -10
  51. package/src/spinbutton/intl.ts +34 -34
  52. package/src/table/createTable.ts +2 -3
  53. package/src/table/utils.ts +1 -6
  54. package/src/tree/createTree.ts +1 -4
@@ -1 +1 @@
1
- {"version":3,"file":"table.jsx","names":["mergeProps"],"sources":["../../src/table/createTable.ts","../../src/table/createTableHeaderRow.ts","../../src/table/createTableColumnHeader.ts","../../src/table/utils.ts","../../src/table/createTableRow.ts","../../src/table/createTableCell.ts","../../src/table/createTableRowGroup.ts","../../src/table/createTableSelectionCheckbox.ts","../../src/table/createTableSelectAllCheckbox.ts","../../src/table/createTableColumnResize.ts"],"sourcesContent":["/**\n * createTable - Provides accessibility for a table component.\n * Based on @react-aria/table/useTable.\n */\n\nimport { createMemo, createEffect, on, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TableState, TableCollection, Key, GridNode } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableProps, TableAria } from \"./types\";\nimport { useLocale } from \"../i18n\";\nimport { announce } from \"../live-announcer\";\nimport { createDescription } from \"../utils/createDescription\";\nimport { scrollIntoViewport } from \"../utils\";\nimport { getInteractionModality } from \"../interactions/createInteractionModality\";\n\n// Global map to store table metadata for child components\nconst tableMap = new WeakMap<\n object,\n {\n tableId: string;\n actions: { onRowAction?: (key: Key) => void; onCellAction?: (key: Key) => void };\n shouldSelectOnPressUp?: boolean;\n focusMode?: \"row\" | \"cell\";\n }\n>();\n\n/**\n * Get the table metadata for child components.\n */\nexport function getTableData<T>(state: TableState<T, TableCollection<T>>) {\n return tableMap.get(state);\n}\n\n/**\n * Helper to get cells from a row by iterating children\n */\nfunction getChildCells<T>(collection: TableCollection<T>, rowKey: Key): GridNode<T>[] {\n const children = collection.getChildren(rowKey);\n return [...children].filter((node) => node.type === \"cell\" || node.type === \"rowheader\");\n}\n\n/**\n * Helper to get cell at specific index in a row\n */\nfunction getCellAtIndex<T>(\n collection: TableCollection<T>,\n rowKey: Key,\n index: number,\n): GridNode<T> | null {\n const cells = getChildCells(collection, rowKey);\n return cells[index] ?? null;\n}\n\n/**\n * Helper to check if a node is a cell\n */\nfunction isCell<T>(node: GridNode<T> | null): boolean {\n return node?.type === \"cell\" || node?.type === \"rowheader\";\n}\n\n/**\n * Helper to check if a node is a row\n */\nfunction isRow<T>(node: GridNode<T> | null): boolean {\n return node?.type === \"item\";\n}\n\n/**\n * Creates accessibility props for a table component.\n */\nexport function createTable<T extends object>(\n props: Accessor<AriaTableProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n ref: Accessor<HTMLTableElement | null>,\n): TableAria {\n const id = createId(props().id);\n const locale = useLocale();\n\n // Track previous sort descriptor for announcements\n let prevSortDescriptor: { column: Key; direction: \"ascending\" | \"descending\" } | null = null;\n let isFirstRender = true;\n let typeaheadBuffer = \"\";\n let typeaheadTimeout: ReturnType<typeof setTimeout> | undefined;\n\n // Store metadata for child components\n const storeTableData = () => {\n const s = state();\n const p = props();\n tableMap.set(s, {\n tableId: id,\n actions: {\n onRowAction: p.onRowAction,\n onCellAction: p.onCellAction,\n },\n shouldSelectOnPressUp: p.shouldSelectOnPressUp,\n focusMode: p.focusMode,\n });\n };\n\n // Update table data whenever props/state changes\n createMemo(() => {\n storeTableData();\n });\n\n // Announce sort changes (only after initial render)\n createEffect(\n on(\n () => state().sortDescriptor,\n (sortDescriptor) => {\n if (isFirstRender) {\n isFirstRender = false;\n prevSortDescriptor = sortDescriptor;\n return;\n }\n\n if (\n sortDescriptor &&\n (sortDescriptor.column !== prevSortDescriptor?.column ||\n sortDescriptor.direction !== prevSortDescriptor?.direction)\n ) {\n const collection = state().collection;\n const column = collection.columns.find((c) => c.key === sortDescriptor.column);\n const columnName = column?.textValue ?? String(sortDescriptor.column);\n const directionText =\n sortDescriptor.direction === \"ascending\" ? \"ascending\" : \"descending\";\n\n announce(`Sorted by ${columnName}, ${directionText}`, \"assertive\", 500);\n }\n\n prevSortDescriptor = sortDescriptor;\n },\n ),\n );\n\n // Keyboard navigation handler with full 2D navigation\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const collection = s.collection;\n const p = props();\n const focusMode = p.focusMode ?? \"row\";\n const isRTL = locale().direction === \"rtl\";\n const setFocusedKey = (key: Key) => {\n s.setFocusedKey(key);\n };\n const runTypeahead = (focusedKey: Key, focusedItem: GridNode<T>) => {\n if (e.key.length !== 1 || e.ctrlKey || e.metaKey || e.altKey) {\n return false;\n }\n\n // A leading Spacebar is a selection/action key, not the start of a type-ahead\n // search. Mirror upstream useTypeSelect (`search.length === 0 && character === ' '`)\n // and let it fall through so the focused row's own Space handler toggles selection.\n // Once a search is active, Space continues the query as normal.\n if (e.key === \" \" && typeaheadBuffer.length === 0) {\n return false;\n }\n\n typeaheadBuffer += e.key.toLocaleLowerCase();\n if (typeaheadTimeout) {\n clearTimeout(typeaheadTimeout);\n }\n typeaheadTimeout = setTimeout(() => {\n typeaheadBuffer = \"\";\n typeaheadTimeout = undefined;\n }, 500);\n\n const rows = Array.from(collection).filter((node) => !s.isDisabled(node.key));\n if (rows.length === 0) {\n return true;\n }\n\n const currentRowKey =\n isCell(focusedItem) && focusedItem.parentKey != null ? focusedItem.parentKey : focusedKey;\n const currentIndex = rows.findIndex((node) => node.key === currentRowKey);\n const orderedRows =\n currentIndex >= 0\n ? [...rows.slice(currentIndex + 1), ...rows.slice(0, currentIndex + 1)]\n : rows;\n const match = orderedRows.find((node) =>\n collection.getTextValue(node.key).toLocaleLowerCase().startsWith(typeaheadBuffer),\n );\n\n if (match) {\n e.preventDefault();\n setFocusedKey(match.key);\n }\n\n return true;\n };\n\n if (s.isKeyboardNavigationDisabled) {\n return;\n }\n\n const focusedKey = s.focusedKey;\n if (focusedKey == null) {\n // If nothing is focused, focus the first item\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Home\" || e.key === \"End\") {\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n e.preventDefault();\n setFocusedKey(firstKey);\n }\n }\n return;\n }\n\n const focusedItem = collection.getItem(focusedKey);\n if (!focusedItem) return;\n\n let nextKey: Key | null = null;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n // If focused on a cell, move to the same column in the next row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n const nextRowKey = collection.getKeyAfter(focusedItem.parentKey);\n if (nextRowKey != null) {\n const cellIndex = focusedItem.index;\n const nextCell = getCellAtIndex(collection, nextRowKey, cellIndex);\n nextKey = nextCell?.key ?? nextRowKey;\n }\n } else {\n // Move to next row\n nextKey = collection.getKeyAfter(focusedKey);\n }\n break;\n }\n\n case \"ArrowUp\": {\n e.preventDefault();\n // If focused on a cell, move to the same column in the previous row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n const prevRowKey = collection.getKeyBefore(focusedItem.parentKey);\n if (prevRowKey != null) {\n const cellIndex = focusedItem.index;\n const prevCell = getCellAtIndex(collection, prevRowKey, cellIndex);\n nextKey = prevCell?.key ?? prevRowKey;\n }\n } else {\n // Move to previous row\n nextKey = collection.getKeyBefore(focusedKey);\n }\n break;\n }\n\n case \"ArrowRight\": {\n e.preventDefault();\n const goNext = !isRTL;\n\n if (isRow(focusedItem)) {\n // If on a row, go to the first/last cell\n const cells = getChildCells(collection, focusedKey);\n if (cells.length > 0) {\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // If on a cell, go to the next/prev cell\n const cells = getChildCells(collection, focusedItem.parentKey);\n const currentIndex = focusedItem.index;\n const targetIndex = goNext ? currentIndex + 1 : currentIndex - 1;\n\n if (targetIndex >= 0 && targetIndex < cells.length) {\n nextKey = cells[targetIndex].key;\n } else if (focusMode === \"row\") {\n // Wrap to row\n nextKey = focusedItem.parentKey;\n } else {\n // Wrap to first/last cell\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n }\n break;\n }\n\n case \"ArrowLeft\": {\n e.preventDefault();\n const goNext = isRTL;\n\n if (isRow(focusedItem)) {\n // If on a row, go to the last/first cell\n const cells = getChildCells(collection, focusedKey);\n if (cells.length > 0) {\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // If on a cell, go to the prev/next cell\n const cells = getChildCells(collection, focusedItem.parentKey);\n const currentIndex = focusedItem.index;\n const targetIndex = goNext ? currentIndex + 1 : currentIndex - 1;\n\n if (targetIndex >= 0 && targetIndex < cells.length) {\n nextKey = cells[targetIndex].key;\n } else if (focusMode === \"row\") {\n // Wrap to row\n nextKey = focusedItem.parentKey;\n } else {\n // Wrap to first/last cell\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n }\n break;\n }\n\n case \"Home\": {\n e.preventDefault();\n if (e.ctrlKey) {\n // Ctrl+Home: Go to first row/cell\n const firstRowKey = collection.getFirstKey();\n if (firstRowKey != null) {\n if (isCell(focusedItem) || focusMode === \"cell\") {\n const cells = getChildCells(collection, firstRowKey);\n nextKey = cells[0]?.key ?? firstRowKey;\n } else {\n nextKey = firstRowKey;\n }\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // Home: Go to first cell in current row\n const cells = getChildCells(collection, focusedItem.parentKey);\n nextKey = cells[0]?.key ?? null;\n } else {\n // On row: go to first row\n nextKey = collection.getFirstKey();\n }\n break;\n }\n\n case \"End\": {\n e.preventDefault();\n if (e.ctrlKey) {\n // Ctrl+End: Go to last row/cell\n const lastRowKey = collection.getLastKey();\n if (lastRowKey != null) {\n if (isCell(focusedItem) || focusMode === \"cell\") {\n const cells = getChildCells(collection, lastRowKey);\n nextKey = cells[cells.length - 1]?.key ?? lastRowKey;\n } else {\n nextKey = lastRowKey;\n }\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // End: Go to last cell in current row\n const cells = getChildCells(collection, focusedItem.parentKey);\n nextKey = cells[cells.length - 1]?.key ?? null;\n } else {\n // On row: go to last row\n nextKey = collection.getLastKey();\n }\n break;\n }\n\n case \"PageDown\": {\n e.preventDefault();\n // Move down by roughly a page (using DOM measurements if available)\n const el = ref();\n if (el && el.clientHeight > 0) {\n const visibleHeight = el.clientHeight;\n let currentKey: Key | null = focusedKey;\n let traveled = 0;\n\n // If on a cell, start from the parent row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n currentKey = focusedItem.parentKey;\n }\n\n // Move down until we've traveled approximately one page\n while (currentKey != null && traveled < visibleHeight) {\n const next = collection.getKeyAfter(currentKey);\n if (next == null) break;\n\n // Estimate row height (default to 40px if we can't measure)\n const rowElement = el.querySelector(`[data-key=\"${currentKey}\"]`);\n traveled += rowElement?.clientHeight ?? 40;\n currentKey = next;\n }\n\n if (currentKey != null) {\n // If we started on a cell, focus the same column in the new row\n if (isCell(focusedItem)) {\n const cellIndex = focusedItem.index;\n const targetCell = getCellAtIndex(collection, currentKey, cellIndex);\n nextKey = targetCell?.key ?? currentKey;\n } else {\n nextKey = currentKey;\n }\n }\n } else {\n // Fallback: move 10 rows\n let count = 10;\n let current: Key | null =\n isCell(focusedItem) && focusedItem.parentKey != null\n ? focusedItem.parentKey\n : focusedKey;\n while (count > 0 && current != null) {\n const next = collection.getKeyAfter(current);\n if (next == null) break;\n current = next;\n count--;\n }\n if (current != null && isCell(focusedItem)) {\n const targetCell = getCellAtIndex(collection, current, focusedItem.index);\n nextKey = targetCell?.key ?? current;\n } else {\n nextKey = current;\n }\n }\n break;\n }\n\n case \"PageUp\": {\n e.preventDefault();\n // Move up by roughly a page\n const el = ref();\n if (el && el.clientHeight > 0) {\n const visibleHeight = el.clientHeight;\n let currentKey: Key | null = focusedKey;\n let traveled = 0;\n\n // If on a cell, start from the parent row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n currentKey = focusedItem.parentKey;\n }\n\n // Move up until we've traveled approximately one page\n while (currentKey != null && traveled < visibleHeight) {\n const prev = collection.getKeyBefore(currentKey);\n if (prev == null) break;\n\n const rowElement = el.querySelector(`[data-key=\"${currentKey}\"]`);\n traveled += rowElement?.clientHeight ?? 40;\n currentKey = prev;\n }\n\n if (currentKey != null) {\n if (isCell(focusedItem)) {\n const cellIndex = focusedItem.index;\n const targetCell = getCellAtIndex(collection, currentKey, cellIndex);\n nextKey = targetCell?.key ?? currentKey;\n } else {\n nextKey = currentKey;\n }\n }\n } else {\n // Fallback: move 10 rows\n let count = 10;\n let current: Key | null =\n isCell(focusedItem) && focusedItem.parentKey != null\n ? focusedItem.parentKey\n : focusedKey;\n while (count > 0 && current != null) {\n const prev = collection.getKeyBefore(current);\n if (prev == null) break;\n current = prev;\n count--;\n }\n if (current != null && isCell(focusedItem)) {\n const targetCell = getCellAtIndex(collection, current, focusedItem.index);\n nextKey = targetCell?.key ?? current;\n } else {\n nextKey = current;\n }\n }\n break;\n }\n\n case \"Escape\":\n if (p.escapeKeyBehavior !== \"none\") {\n s.clearSelection();\n }\n return;\n\n case \"a\":\n if (e.ctrlKey || e.metaKey) {\n e.preventDefault();\n if (s.selectionMode === \"multiple\") {\n s.selectAll();\n }\n }\n return;\n\n // NOTE: Space/Enter selection is intentionally NOT handled here. Upstream\n // useSelectableCollection has no ' '/Enter case — keyboard selection is owned\n // by the row (useSelectableItem, ported in createTableRow). Handling it here too\n // double-toggled the selection (row toggles on, grid toggles back off → no-op),\n // since the row handler does not stop propagation. Space/Enter fall through to\n // the type-ahead path below, which ignores a leading Space and bails on Enter.\n\n default:\n if (runTypeahead(focusedKey, focusedItem)) {\n return;\n }\n return;\n }\n\n if (nextKey != null) {\n setFocusedKey(nextKey);\n\n // Handle shift+arrow for range selection\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n // For cells, select the parent row\n const focusedNode = collection.getItem(nextKey);\n const keyToSelect =\n focusedNode && isCell(focusedNode) && focusedNode.parentKey != null\n ? focusedNode.parentKey\n : nextKey;\n s.extendSelection(keyToSelect);\n }\n }\n };\n\n // Focus handling\n const onFocus = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n if (!el?.contains(e.target as Element)) {\n return;\n }\n\n if (!s.isFocused) {\n s.setFocused(true);\n\n // If no key is focused, focus the first one\n if (s.focusedKey == null) {\n const firstKey = s.collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n // Only blur if focus is leaving the table entirely\n if (el && !el.contains(e.relatedTarget as Element)) {\n s.setFocused(false);\n }\n };\n\n // Mirror React Aria's useSelectableCollection: once the roving tabindex for\n // the focused key has been committed to the DOM, move browser focus onto that\n // element from a post-commit effect — looking it up by its stable data-key\n // rather than by transient tabindex. Doing this imperatively during the key\n // handler (in a microtask) raced Solid's reconciliation and dropped focus to\n // <body>, so Space/Enter never reached the grid's selection handler.\n createEffect(() => {\n const s = state();\n const key = s.focusedKey;\n const el = ref();\n if (!el || key == null) {\n return;\n }\n\n // Only manage focus while it already lives inside the table — i.e. the user\n // is navigating with the keyboard. We gate on the *physical* position of\n // browser focus rather than the grid's logical `isFocused` signal: focus can\n // land directly on a row (a pointer click, or programmatic row focus) without\n // ever firing the grid's own non-bubbling focus handler, so `isFocused` stays\n // false even though the table genuinely holds focus. The contains() check is\n // also what keeps us from pulling focus back from elsewhere on the page when\n // the focused key changes from a background interaction.\n const active = document.activeElement;\n if (!active || (active !== el && !el.contains(active))) {\n return;\n }\n\n const target = el.querySelector<HTMLElement>(`[data-key=\"${key}\"]`);\n if (target && target !== active) {\n target.focus();\n\n // Reveal the newly focused row/cell when navigating with the keyboard,\n // mirroring useSelectableCollection. Pointer-driven focus changes should\n // not shift the scroll position under the user's finger.\n if (getInteractionModality() !== \"pointer\") {\n scrollIntoViewport(target, { containingElement: el });\n }\n }\n });\n\n // Warn if no label is provided\n createMemo(() => {\n const p = props();\n if (!p[\"aria-label\"] && !p[\"aria-labelledby\"]) {\n console.warn(\"Table: An aria-label or aria-labelledby prop is required for accessibility.\");\n }\n });\n\n // A sorted table exposes a persistent sort description on the grid (\"sorted by\n // column {name} in {direction} order\"), mirroring `useTable`'s\n // `useDescription(sortDescription)` — separate from the transient live-region\n // announcement above. `columnName` follows upstream exactly\n // (`columns.find(c => c.key === column)?.textValue ?? ''`) so a header with no\n // plain-text value yields an empty name, matching the S2 oracle.\n const sortDescription = () => {\n const s = state();\n const descriptor = s.sortDescriptor;\n const column = descriptor?.column;\n const direction = descriptor?.direction;\n if (!direction || column == null) {\n return undefined;\n }\n const columnName = s.collection.columns.find((c) => c.key === column)?.textValue ?? \"\";\n return `sorted by column ${columnName} in ${direction} order`;\n };\n const sortDescriptionProps = createDescription(sortDescription);\n\n const gridProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const describedBy =\n [sortDescriptionProps[\"aria-describedby\"], p[\"aria-describedby\"]]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n const baseProps: Record<string, unknown> = {\n role: \"grid\",\n id,\n \"aria-label\": p[\"aria-label\"],\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-describedby\": describedBy,\n \"aria-multiselectable\": s.selectionMode === \"multiple\" ? \"true\" : undefined,\n // Keep the grid itself tabbable so keyboard users can enter\n // row/cell navigation without requiring a prior pointer interaction.\n tabIndex: 0,\n onKeyDown,\n onFocus,\n onBlur,\n };\n\n if (p.isVirtualized) {\n baseProps[\"aria-rowcount\"] = s.collection.rowCount;\n baseProps[\"aria-colcount\"] = s.collection.columnCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableElement>;\n });\n\n return {\n get gridProps() {\n return gridProps();\n },\n };\n}\n","/**\n * createTableHeaderRow - Provides accessibility for a table header row.\n * Based on @react-aria/table/useTableHeaderRow.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableHeaderRowProps, TableHeaderRowAria } from \"./types\";\n\n/**\n * Creates accessibility props for a table header row.\n */\nexport function createTableHeaderRow<T extends object>(\n props: Accessor<AriaTableHeaderRowProps>,\n _state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableRowElement | null>,\n): TableHeaderRowAria {\n const rowProps = createMemo(() => {\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n };\n\n // Add aria-rowindex for virtualized tables\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps[\"aria-rowindex\"] = node.rowIndex + 1; // 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableRowElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n };\n}\n","/**\n * createTableColumnHeader - Provides accessibility for a table column header.\n * Based on @react-aria/table/useTableColumnHeader.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableColumnHeaderProps, TableColumnHeaderAria } from \"./types\";\nimport { getTableData } from \"./createTable\";\nimport { createDescription } from \"../utils/createDescription\";\n\n/**\n * Creates accessibility props for a table column header.\n */\nexport function createTableColumnHeader<T extends object>(\n props: Accessor<AriaTableColumnHeaderProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableCellElement | null>,\n): TableColumnHeaderAria {\n const [isPressed, setIsPressed] = createSignal(false);\n let ignoreNextClick = false;\n let ignoreNextClickTimeout: ReturnType<typeof setTimeout> | undefined;\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n // A sortable column header is described as \"sortable column\" — mirrors\n // `useTableColumnHeader`'s `useDescription(stringFormatter.format('sortable'))`.\n // Backed by a shared hidden element (ref-counted) and referenced via\n // aria-describedby.\n const sortDescriptionProps = createDescription(() =>\n props().allowsSorting ? \"sortable column\" : undefined,\n );\n\n const sortColumn = () => {\n const s = state();\n const p = props();\n\n if (p.allowsSorting) {\n s.sort(p.node.key);\n }\n };\n\n const clearPendingClickIgnore = () => {\n if (ignoreNextClickTimeout != null) {\n clearTimeout(ignoreNextClickTimeout);\n ignoreNextClickTimeout = undefined;\n }\n };\n\n const ignorePointerGeneratedClick = () => {\n clearPendingClickIgnore();\n ignoreNextClick = true;\n ignoreNextClickTimeout = setTimeout(() => {\n ignoreNextClick = false;\n ignoreNextClickTimeout = undefined;\n }, 0);\n };\n\n // Handle click for sorting. Pointer activation is handled on pointerup because\n // focusing the table header can re-render its child content before a native\n // click is dispatched.\n const onClick = () => {\n if (ignoreNextClick) {\n ignoreNextClick = false;\n clearPendingClickIgnore();\n return;\n }\n\n sortColumn();\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const p = props();\n\n if (\n p.allowsSorting &&\n (e.key === \"Enter\" || e.key === \" \" || e.key === \"Space\" || e.key === \"Spacebar\")\n ) {\n e.preventDefault();\n sortColumn();\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = (e: PointerEvent) => {\n if (e.button !== 0) {\n return;\n }\n\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n if (isPressed()) {\n ignorePointerGeneratedClick();\n sortColumn();\n }\n\n setIsPressed(false);\n };\n\n const onPointerCancel = () => {\n setIsPressed(false);\n };\n\n const columnHeaderProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const tableData = getTableData(s);\n\n // Determine sort state\n let ariaSort: \"none\" | \"ascending\" | \"descending\" | undefined = undefined;\n if (p.allowsSorting) {\n const sortDescriptor = s.sortDescriptor;\n if (sortDescriptor?.column === node.key) {\n ariaSort = sortDescriptor.direction;\n } else {\n ariaSort = \"none\";\n }\n }\n\n const baseProps: Record<string, unknown> = {\n role: \"columnheader\",\n id: tableData ? `${tableData.tableId}-${node.key}` : undefined,\n \"aria-sort\": ariaSort,\n \"aria-describedby\": sortDescriptionProps[\"aria-describedby\"],\n tabIndex: isFocused() ? 0 : -1,\n onFocus,\n };\n\n // Add click handler if sortable\n if (p.allowsSorting) {\n baseProps.onClick = onClick;\n baseProps.onKeyDown = onKeyDown;\n baseProps.onPointerDown = onPointerDown;\n baseProps.onPointerUp = onPointerUp;\n baseProps.onPointerCancel = onPointerCancel;\n baseProps.onPointerLeave = onPointerCancel;\n baseProps.style = { cursor: \"pointer\" };\n }\n\n // Add aria-colindex for virtualized tables\n if (p.isVirtualized && node.column != null) {\n baseProps[\"aria-colindex\"] = node.column + 1; // 1-based\n }\n\n // Add colspan if present\n if (node.colspan != null && node.colspan > 1) {\n baseProps[\"aria-colspan\"] = node.colspan;\n baseProps.colSpan = node.colspan;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableCellElement>;\n });\n\n return {\n get columnHeaderProps() {\n return columnHeaderProps();\n },\n };\n}\n","/**\n * Table accessibility id helpers.\n * Port of @react-aria/table/utils (`getRowLabelledBy` / cell id derivation).\n */\n\nimport type {\n Key,\n GridNode,\n TableState,\n TableCollection,\n} from \"@proyecto-viviana/solid-stately\";\nimport { getTableData } from \"./createTable\";\n\n/**\n * A row is labelled by its row-header cells. Mirrors `@react-aria/table`'s\n * `getRowLabelledBy`, which joins `getCellId(state, rowKey, columnKey)` across\n * `collection.rowHeaderColumnKeys`. We resolve the actual rowheader cell node\n * and rebuild the exact id string `createTableCell` puts on the element\n * (`${tableId}-${parentKey}-${cellKey}`) so the reference always matches a real\n * element, regardless of the cell-key scheme.\n */\nexport function getRowLabelledBy<T extends object>(\n state: TableState<T, TableCollection<T>>,\n rowKey: Key,\n): string {\n const tableData = getTableData(state);\n const tableId = tableData?.tableId ?? \"table\";\n const collection = state.collection as TableCollection<T> & {\n getCell?: (rowKey: Key, columnKey: Key) => GridNode<T> | null;\n };\n\n return [...collection.rowHeaderColumnKeys]\n .map((columnKey) => {\n const cell = collection.getCell?.(rowKey, columnKey);\n return cell?.parentKey != null\n ? `${tableId}-${String(cell.parentKey)}-${String(cell.key)}`\n : null;\n })\n .filter((id): id is string => id != null)\n .join(\" \");\n}\n","/**\n * createTableRow - Provides accessibility for a table row.\n * Based on @react-aria/table/useTableRow.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type {\n Collection,\n Key,\n Selection,\n TableState,\n TableCollection,\n} from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableRowProps, TableRowAria, ExpandButtonProps } from \"./types\";\nimport { getTableData } from \"./createTable\";\nimport { getRowLabelledBy } from \"./utils\";\nimport { useLocale } from \"../i18n\";\nimport { createSelectableItem, type SelectableItemState } from \"../selection/createSelectableItem\";\nimport { mergeProps } from \"../utils/mergeProps\";\n\n/**\n * Arrow keys that expand/collapse a tree-grid row, mirroring `@react-aria/table`.\n * Direction is flipped under RTL.\n */\nconst EXPANSION_KEYS = {\n expand: { ltr: \"ArrowRight\", rtl: \"ArrowLeft\" },\n collapse: { ltr: \"ArrowLeft\", rtl: \"ArrowRight\" },\n} as const;\n\n/**\n * Creates accessibility props for a table row.\n */\nexport function createTableRow<T extends object>(\n props: Accessor<AriaTableRowProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n ref: Accessor<HTMLTableRowElement | null>,\n): TableRowAria {\n const locale = useLocale();\n\n // Tree-grid (expandable rows): only active when the collection has a tree column.\n const isTreeRow = createMemo(() => state().treeColumn != null);\n\n const hasChildRows = createMemo(() => props().node.isExpandable ?? false);\n\n const isExpanded = createMemo(() => {\n const s = state();\n if (s.treeColumn == null) return false;\n return s.expandedKeys === \"all\" || s.expandedKeys.has(props().node.key);\n });\n\n // aria-posinset / aria-setsize among same-level sibling rows.\n const siblingInfo = createMemo(() => {\n const s = state();\n const node = props().node;\n if (node.parentKey != null) {\n const parent = s.collection.getItem(node.parentKey);\n if (parent) {\n const siblings = parent.childNodes.filter((n) => n.type === \"item\");\n return { posinset: node.index + 1, setsize: siblings.length };\n }\n }\n const rootRows = s.collection.body.childNodes.filter((n) => n.type === \"item\");\n const rootIndex = rootRows.findIndex((n) => n.key === node.key);\n return {\n posinset: rootIndex >= 0 ? rootIndex + 1 : node.index + 1,\n setsize: rootRows.length,\n };\n });\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.node.key);\n });\n\n const selectableState: SelectableItemState<T> = {\n collection: () => state().collection as unknown as Collection<T>,\n isFocused: () => state().isFocused,\n setFocused: (focused: boolean) => state().setFocused(focused),\n focusedKey: () => state().focusedKey,\n childFocusStrategy: () => state().childFocusStrategy,\n setFocusedKey: (key: Key | null, strategy) => state().setFocusedKey(key, strategy),\n selectionMode: () => state().selectionMode,\n selectionBehavior: () => state().selectionBehavior,\n disallowEmptySelection: () => state().disallowEmptySelection,\n selectedKeys: () => state().selectedKeys as Selection,\n disabledKeys: () => state().disabledKeys,\n disabledBehavior: () => state().disabledBehavior,\n isEmpty: () => {\n const keys = state().selectedKeys;\n return keys !== \"all\" && keys.size === 0;\n },\n isSelectAll: () => state().selectedKeys === \"all\",\n isSelected: (key: Key) => state().isSelected(key),\n isDisabled: (key: Key) => {\n const s = state();\n const item = s.collection.getItem(key);\n return (\n s.disabledBehavior === \"all\" &&\n s.isDisabled(key) &&\n item?.props?.disabledBehavior !== \"selection\"\n );\n },\n canSelectItem: (key: Key) => {\n const s = state();\n return s.selectionMode !== \"none\" && !s.isDisabled(key);\n },\n setSelectionBehavior: (behavior) => state().setSelectionBehavior(behavior),\n toggleSelection: (key: Key) => state().toggleSelection(key),\n replaceSelection: (key: Key) => state().replaceSelection(key),\n setSelectedKeys: (keys: Iterable<Key>) => state().setSelectedKeys(keys),\n selectAll: () => state().selectAll(),\n clearSelection: () => state().clearSelection(),\n toggleSelectAll: () => state().toggleSelectAll(),\n extendSelection: (toKey: Key, _collection: Collection<T>) => state().extendSelection(toKey),\n };\n\n const selectableItem = createSelectableItem<T>(\n () => {\n const s = state();\n const p = props();\n const tableData = getTableData(s);\n const onRowAction = tableData?.actions.onRowAction;\n const hasAction = !!p.onAction || !!onRowAction || !!p.href;\n\n return {\n key: p.node.key,\n id: `${tableData?.tableId ?? \"table\"}-row-${String(p.node.key)}`,\n isVirtualized: p.isVirtualized,\n shouldSelectOnPressUp: tableData?.shouldSelectOnPressUp ?? false,\n isDisabled: !!p.isDisabled || s.collection.size === 0,\n onAction: hasAction\n ? (event) => {\n p.onAction?.();\n onRowAction?.(p.node.key);\n if (p.href) {\n p.onLinkAction?.(event);\n }\n }\n : undefined,\n };\n },\n selectableState,\n ref,\n );\n\n const isDisabled = () => selectableItem.isDisabled();\n\n const onTreeGridKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Tree-grid expand/collapse with Left/Right arrows (flipped under RTL). Handled before\n // selection/navigation; stopping propagation prevents the grid's arrow navigation when\n // expansion consumes the key.\n if (s.treeColumn != null) {\n const direction = locale().direction === \"rtl\" ? \"rtl\" : \"ltr\";\n const key = p.node.key;\n const expanded = s.expandedKeys;\n if (\n e.key === EXPANSION_KEYS.expand[direction] &&\n s.focusedKey === key &&\n hasChildRows() &&\n expanded !== \"all\" &&\n !expanded.has(key)\n ) {\n s.toggleKey(key);\n e.stopPropagation();\n return;\n } else if (e.key === EXPANSION_KEYS.collapse[direction] && s.focusedKey === key) {\n if (expanded !== \"all\") {\n if (hasChildRows() && expanded.has(key)) {\n s.toggleKey(key);\n e.stopPropagation();\n return;\n } else if (!expanded.has(key) && p.node.parentKey != null && p.node.level > 0) {\n // Leaf or already-collapsed row: move focus to the parent row.\n s.setFocusedKey(p.node.parentKey);\n e.stopPropagation();\n return;\n }\n } else {\n s.toggleKey(key);\n e.stopPropagation();\n return;\n }\n }\n }\n };\n\n const rowProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n \"aria-selected\": s.selectionMode !== \"none\" ? isSelected() : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n };\n\n // A row is labelled by its row-header cell(s) — mirrors `useTableRow`'s\n // `'aria-labelledby': getRowLabelledBy(state, node.key)`. Without it the\n // browser falls back to concatenating every cell (incl. the selection\n // checkbox), so the row's accessible name reads \"Select Foo.pdf PDF …\".\n const labelledBy = getRowLabelledBy(s, node.key);\n if (labelledBy) {\n baseProps[\"aria-labelledby\"] = labelledBy;\n }\n\n // Tree-grid rows expose their nesting depth, position and expansion state.\n if (s.treeColumn != null) {\n const { posinset, setsize } = siblingInfo();\n baseProps[\"aria-expanded\"] = hasChildRows() ? isExpanded() : undefined;\n baseProps[\"aria-level\"] = node.level + 1; // 1-based\n baseProps[\"aria-posinset\"] = posinset;\n baseProps[\"aria-setsize\"] = setsize;\n baseProps.onKeyDown = onTreeGridKeyDown;\n }\n\n // Add aria-rowindex for virtualized tables. Tree grids omit it (matches upstream).\n if (p.isVirtualized && s.treeColumn == null && node.rowIndex != null) {\n baseProps[\"aria-rowindex\"] = node.rowIndex + 1; // 1-based\n }\n\n return mergeProps<JSX.HTMLAttributes<HTMLTableRowElement>>(\n selectableItem.itemProps as unknown as JSX.HTMLAttributes<HTMLTableRowElement>,\n baseProps,\n );\n });\n\n // Chevron button for expanding/collapsing a tree-grid row. Press-based so it flows through\n // our Button's `createPress`, and excluded from the tab order — reached via the row's\n // Left/Right arrow keys instead. Mirrors `@react-aria/table`'s `expandButtonProps`; whether a\n // chevron renders for a leaf row is the consumer's call (gate on `hasChildItems`), matching S2.\n const onExpandPress = () => {\n const s = state();\n const p = props();\n if (isDisabled()) return;\n s.toggleKey(p.node.key);\n s.setFocused(true);\n s.setFocusedKey(p.node.key);\n };\n\n const expandButtonProps = createMemo<ExpandButtonProps>(() => ({\n isDisabled: isDisabled(),\n onPress: onExpandPress,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n \"data-react-aria-prevent-focus\": true,\n \"aria-label\": isExpanded() ? \"Collapse\" : \"Expand\",\n }));\n\n return {\n get rowProps() {\n return rowProps();\n },\n get expandButtonProps() {\n return expandButtonProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return selectableItem.isPressed();\n },\n get isExpanded() {\n return isExpanded();\n },\n get hasChildRows() {\n return hasChildRows();\n },\n };\n}\n","/**\n * createTableCell - Provides accessibility for a table cell.\n * Based on @react-aria/table/useTableCell.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableCellProps, TableCellAria } from \"./types\";\nimport { getTableData } from \"./createTable\";\n\n/**\n * Creates accessibility props for a table cell.\n */\nexport function createTableCell<T extends object>(\n props: Accessor<AriaTableCellProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableCellElement | null>,\n): TableCellAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n // Check if parent row is disabled\n const node = p.node;\n if (node.parentKey != null) {\n return s.isDisabled(node.parentKey);\n }\n return false;\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n // Handle click for cell actions\n const onClick = () => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get table metadata for actions\n const tableData = getTableData(s);\n const onCellAction = tableData?.actions.onCellAction;\n\n // Call cell action handler\n if (onCellAction) {\n onCellAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Enter triggers cell action\n if (e.key === \"Enter\") {\n const tableData = getTableData(s);\n const onCellAction = tableData?.actions.onCellAction;\n\n if (onCellAction || p.onAction) {\n e.preventDefault();\n\n if (onCellAction) {\n onCellAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const gridCellProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const tableData = getTableData(s);\n\n // Determine the role based on node type\n let role: string = \"gridcell\";\n if (node.type === \"rowheader\") {\n role = \"rowheader\";\n }\n\n const baseProps: Record<string, unknown> = {\n role,\n id:\n tableData && node.parentKey != null\n ? `${tableData.tableId}-${node.parentKey}-${node.key}`\n : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add aria-colindex for virtualized tables\n if (p.isVirtualized && node.column != null) {\n baseProps[\"aria-colindex\"] = node.column + 1; // 1-based\n }\n\n // Add colspan if present\n if (node.colspan != null && node.colspan > 1) {\n baseProps[\"aria-colspan\"] = node.colspan;\n baseProps.colSpan = node.colspan;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableCellElement>;\n });\n\n return {\n get gridCellProps() {\n return gridCellProps();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n","/**\n * createTableRowGroup - Provides accessibility for a table row group.\n * Based on @react-aria/grid/useTableRowGroup.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { AriaTableRowGroupProps, TableRowGroupAria } from \"./types\";\n\n/**\n * Creates accessibility props for a table row group (thead, tbody, tfoot).\n */\nexport function createTableRowGroup(props: Accessor<AriaTableRowGroupProps>): TableRowGroupAria {\n const rowGroupProps = createMemo(() => {\n // Access props for reactivity tracking, even though not currently used\n void props();\n\n const baseProps: Record<string, unknown> = {\n role: \"rowgroup\",\n };\n\n return baseProps as JSX.HTMLAttributes<HTMLTableSectionElement>;\n });\n\n return {\n get rowGroupProps() {\n return rowGroupProps();\n },\n };\n}\n","/**\n * createTableSelectionCheckbox - Provides accessibility for a table row selection checkbox.\n * Based on @react-aria/table/useTableSelectionCheckbox.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableSelectionCheckboxProps, TableSelectionCheckboxAria } from \"./types\";\nimport { getRowLabelledBy } from \"./utils\";\n\n/**\n * Creates accessibility props for a table row selection checkbox.\n */\nexport function createTableSelectionCheckbox<T extends object>(\n props: Accessor<AriaTableSelectionCheckboxProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n): TableSelectionCheckboxAria {\n const checkboxId = createId();\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n // Mirrors `useGridSelectionCheckbox`'s `!selectionManager.canSelectItem(key)`:\n // a row's checkbox is disabled when selection is off, the key is in\n // `disabledKeys`, or the row/item itself is disabled. This is broader than the\n // row's own focusability gate (which only disables under `disabledBehavior:\n // \"all\"`) — a row disabled via its `isDisabled` prop still cannot be selected,\n // so its checkbox is disabled regardless of `disabledBehavior`.\n //\n // `isRowDisabled` carries the render-time per-row `isDisabled` that this\n // data-driven port keeps on the row hook rather than the collection node\n // (surfaced via `TableRowContext`); the collection-node check below still\n // applies for any path that does populate `node.isDisabled`.\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n if (s.selectionMode === \"none\" || s.disabledKeys.has(p.key) || p.isRowDisabled) {\n return true;\n }\n const item = s.collection.getItem(p.key);\n return !item || !!item.isDisabled || !!item.props?.isDisabled;\n });\n\n const onChange = () => {\n const s = state();\n const p = props();\n if (!isDisabled()) {\n s.toggleSelection(p.key);\n }\n };\n\n const checkboxProps = createMemo(() => {\n const s = state();\n const p = props();\n\n const baseProps: Record<string, unknown> = {\n id: checkboxId,\n type: \"checkbox\",\n checked: isSelected(),\n disabled: isDisabled(),\n onChange,\n \"aria-label\": \"Select\",\n // Mirrors `useTableSelectionCheckbox`: the checkbox is labelled by its own\n // \"Select\" text plus the row's row-header cell(s), so screen readers read\n // \"Select Foo.pdf\" rather than a bare \"Select\".\n \"aria-labelledby\": `${checkboxId} ${getRowLabelledBy(s, p.key)}`,\n };\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n","/**\n * createTableSelectAllCheckbox - Provides accessibility for a table select-all checkbox.\n * Based on @react-aria/table/useTableSelectAllCheckbox.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { TableSelectAllCheckboxAria } from \"./types\";\n\n/**\n * Creates accessibility props for a table select-all checkbox.\n */\nexport function createTableSelectAllCheckbox<T extends object>(\n state: Accessor<TableState<T, TableCollection<T>>>,\n): TableSelectAllCheckboxAria {\n const isSelectAll = createMemo(() => {\n const s = state();\n return s.selectedKeys === \"all\";\n });\n\n const isEmpty = createMemo(() => {\n const s = state();\n return s.collection.size === 0;\n });\n\n const isIndeterminate = createMemo(() => {\n const s = state();\n const selectedKeys = s.selectedKeys;\n if (selectedKeys === \"all\") return false;\n if (selectedKeys.size === 0) return false;\n return selectedKeys.size < s.collection.size;\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n return s.selectionMode !== \"multiple\" || isEmpty();\n });\n\n const onChange = () => {\n const s = state();\n if (!isDisabled()) {\n s.toggleSelectAll();\n }\n };\n\n const checkboxProps = createMemo(() => {\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n type: \"checkbox\",\n checked: isSelectAll(),\n disabled: isDisabled(),\n onChange,\n \"aria-label\": s.selectionMode === \"single\" ? \"Select\" : \"Select All\",\n };\n\n if (isIndeterminate()) {\n baseProps[\"data-indeterminate\"] = \"true\";\n }\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n get isIndeterminate() {\n return isIndeterminate();\n },\n };\n}\n","/**\n * ARIA hook for table column resize interactions.\n * Based on @react-aria/table/useTableColumnResize.\n *\n * Provides pointer-drag and keyboard-based column resizing with\n * correct ARIA attributes for screen readers.\n */\n\nimport { createSignal, createMemo, type Accessor, type JSX } from \"solid-js\";\nimport type { Key, TableColumnResizeState } from \"@proyecto-viviana/solid-stately\";\nimport { useLocale } from \"../i18n\";\n\nexport interface CreateTableColumnResizeProps {\n /** The column being resized. */\n column: { key: Key };\n /** Accessible label for the resizer. */\n \"aria-label\": string;\n /** Whether resizing is disabled. */\n isDisabled?: boolean;\n /** Called when a resize operation starts. */\n onResizeStart?: (widths: Map<Key, number>) => void;\n /** Called during resize with updated widths. */\n onResize?: (widths: Map<Key, number>) => void;\n /** Called when resize operation ends. */\n onResizeEnd?: (widths: Map<Key, number>) => void;\n}\n\nexport interface TableColumnResizeResult {\n /** Props for the visible resizer handle element (div). */\n resizerProps: JSX.HTMLAttributes<HTMLDivElement>;\n /** Props for the hidden range input (screen reader accessible). */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether this column is currently being resized. */\n isResizing: Accessor<boolean>;\n}\n\nconst KEYBOARD_STEP = 10; // px per arrow key press\n\n/**\n * Creates ARIA-compliant column resize behavior.\n *\n * Returns props for a visible drag handle (div) and a visually-hidden\n * range input that allows keyboard and screen-reader users to resize columns.\n */\nexport function createTableColumnResize(\n props: Accessor<CreateTableColumnResizeProps>,\n state: Accessor<TableColumnResizeState>,\n): TableColumnResizeResult {\n const getProps = () => props();\n const getState = () => state();\n const locale = useLocale();\n\n const [isPointerDragging, setIsPointerDragging] = createSignal(false);\n const [isKeyboardResizing, setIsKeyboardResizing] = createSignal(false);\n\n const isResizing = createMemo(() => getState().resizingColumn() === getProps().column.key);\n\n const isRtl = createMemo(() => {\n const l = locale();\n return l?.direction === \"rtl\";\n });\n\n // ---- Pointer (mouse/touch) drag ----\n\n let startX = 0;\n let startWidth = 0;\n\n const onPointerDown = (e: PointerEvent) => {\n if (getProps().isDisabled) return;\n e.preventDefault();\n e.stopPropagation();\n\n const key = getProps().column.key;\n startX = e.clientX;\n startWidth = getState().getColumnWidth(key);\n\n getState().startResize(key);\n getProps().onResizeStart?.(getState().columnWidths());\n setIsPointerDragging(true);\n\n const target = e.currentTarget as HTMLElement;\n target.setPointerCapture(e.pointerId);\n };\n\n const onPointerMove = (e: PointerEvent) => {\n if (!isPointerDragging()) return;\n e.preventDefault();\n\n const deltaX = e.clientX - startX;\n const direction = isRtl() ? -1 : 1;\n const newWidth = startWidth + deltaX * direction;\n\n const key = getProps().column.key;\n const widths = getState().updateResizedColumns(key, newWidth);\n getProps().onResize?.(widths);\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (!isPointerDragging()) return;\n e.preventDefault();\n setIsPointerDragging(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n };\n\n // ---- Keyboard resize (on the hidden input) ----\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (getProps().isDisabled) return;\n\n const key = getProps().column.key;\n const rtlMul = isRtl() ? -1 : 1;\n\n switch (e.key) {\n case \"Enter\": {\n if (isKeyboardResizing()) {\n // End resize\n setIsKeyboardResizing(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n } else {\n // Start resize\n setIsKeyboardResizing(true);\n getState().startResize(key);\n getProps().onResizeStart?.(getState().columnWidths());\n }\n e.preventDefault();\n break;\n }\n case \"Escape\": {\n if (isKeyboardResizing()) {\n setIsKeyboardResizing(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n e.preventDefault();\n }\n break;\n }\n case \"Tab\": {\n if (isKeyboardResizing()) {\n setIsKeyboardResizing(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n }\n // Let Tab propagate for focus management\n break;\n }\n case \"ArrowRight\": {\n if (isKeyboardResizing()) {\n const currentWidth = getState().getColumnWidth(key);\n const widths = getState().updateResizedColumns(\n key,\n currentWidth + KEYBOARD_STEP * rtlMul,\n );\n getProps().onResize?.(widths);\n e.preventDefault();\n }\n break;\n }\n case \"ArrowLeft\": {\n if (isKeyboardResizing()) {\n const currentWidth = getState().getColumnWidth(key);\n const widths = getState().updateResizedColumns(\n key,\n currentWidth - KEYBOARD_STEP * rtlMul,\n );\n getProps().onResize?.(widths);\n e.preventDefault();\n }\n break;\n }\n }\n };\n\n // Handle input change (from screen reader range slider)\n const onInputChange = (e: Event) => {\n const input = e.target as HTMLInputElement;\n const newWidth = parseFloat(input.value);\n if (isNaN(newWidth)) return;\n\n const key = getProps().column.key;\n if (!isResizing()) {\n getState().startResize(key);\n getProps().onResizeStart?.(getState().columnWidths());\n }\n\n const widths = getState().updateResizedColumns(key, newWidth);\n getProps().onResize?.(widths);\n\n // End immediately for discrete input changes\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n };\n\n // Visible resize handle props. The accessible resize control is the hidden\n // range input below, matching React Aria's ColumnResizer structure.\n const resizerProps: JSX.HTMLAttributes<HTMLDivElement> = {\n role: \"presentation\",\n tabIndex: -1,\n style: {\n \"touch-action\": \"none\",\n cursor: \"col-resize\",\n },\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n // Visually hidden range input props\n const inputProps: JSX.InputHTMLAttributes<HTMLInputElement> = {\n get type() {\n return \"range\";\n },\n get tabIndex() {\n return getProps().isDisabled ? -1 : 0;\n },\n get disabled() {\n return getProps().isDisabled;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-orientation\"() {\n return \"horizontal\" as const;\n },\n get min() {\n return getState().getColumnMinWidth(getProps().column.key);\n },\n get max() {\n const maxW = getState().getColumnMaxWidth(getProps().column.key);\n return maxW === Infinity ? 9999 : maxW;\n },\n get value() {\n return getState().getColumnWidth(getProps().column.key);\n },\n style: {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n \"white-space\": \"nowrap\",\n \"border-width\": \"0\",\n },\n onKeyDown,\n onChange: onInputChange,\n };\n\n return {\n resizerProps,\n inputProps,\n isResizing,\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,2BAAW,IAAI,QAQnB;;;;AAKF,SAAgB,aAAgB,OAA0C;CACxE,OAAO,SAAS,IAAI,KAAK;AAC3B;;;;AAKA,SAAS,cAAiB,YAAgC,QAA4B;CAEpF,OAAO,CAAC,GADS,WAAW,YAAY,MACtB,CAAC,CAAC,CAAC,QAAQ,SAAS,KAAK,SAAS,UAAU,KAAK,SAAS,WAAW;AACzF;;;;AAKA,SAAS,eACP,YACA,QACA,OACoB;CAEpB,OADc,cAAc,YAAY,MAC7B,CAAC,CAAC,UAAU;AACzB;;;;AAKA,SAAS,OAAU,MAAmC;CACpD,OAAO,MAAM,SAAS,UAAU,MAAM,SAAS;AACjD;;;;AAKA,SAAS,MAAS,MAAmC;CACnD,OAAO,MAAM,SAAS;AACxB;;;;AAKA,SAAgB,YACd,OACA,OACA,KACW;CACX,MAAM,KAAK,SAAS,MAAM,CAAC,CAAC,EAAE;CAC9B,MAAM,SAAS,UAAU;CAGzB,IAAI,qBAAoF;CACxF,IAAI,gBAAgB;CACpB,IAAI,kBAAkB;CACtB,IAA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
1
+ {"version":3,"file":"table.jsx","names":["mergeProps"],"sources":["../../src/table/createTable.ts","../../src/table/createTableHeaderRow.ts","../../src/table/createTableColumnHeader.ts","../../src/table/utils.ts","../../src/table/createTableRow.ts","../../src/table/createTableCell.ts","../../src/table/createTableRowGroup.ts","../../src/table/createTableSelectionCheckbox.ts","../../src/table/createTableSelectAllCheckbox.ts","../../src/table/createTableColumnResize.ts"],"sourcesContent":["/**\n * createTable - Provides accessibility for a table component.\n * Based on @react-aria/table/useTable.\n */\n\nimport { createMemo, createEffect, on, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TableState, TableCollection, Key, GridNode } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableProps, TableAria } from \"./types\";\nimport { useLocale } from \"../i18n\";\nimport { announce } from \"../live-announcer\";\nimport { createDescription } from \"../utils/createDescription\";\nimport { scrollIntoViewport } from \"../utils\";\nimport { getInteractionModality } from \"../interactions/createInteractionModality\";\n\n// Global map to store table metadata for child components\nconst tableMap = new WeakMap<\n object,\n {\n tableId: string;\n actions: { onRowAction?: (key: Key) => void; onCellAction?: (key: Key) => void };\n shouldSelectOnPressUp?: boolean;\n focusMode?: \"row\" | \"cell\";\n }\n>();\n\n/**\n * Get the table metadata for child components.\n */\nexport function getTableData<T>(state: TableState<T, TableCollection<T>>) {\n return tableMap.get(state);\n}\n\n/**\n * Helper to get cells from a row by iterating children\n */\nfunction getChildCells<T>(collection: TableCollection<T>, rowKey: Key): GridNode<T>[] {\n const children = collection.getChildren(rowKey);\n return [...children].filter((node) => node.type === \"cell\" || node.type === \"rowheader\");\n}\n\n/**\n * Helper to get cell at specific index in a row\n */\nfunction getCellAtIndex<T>(\n collection: TableCollection<T>,\n rowKey: Key,\n index: number,\n): GridNode<T> | null {\n const cells = getChildCells(collection, rowKey);\n return cells[index] ?? null;\n}\n\n/**\n * Helper to check if a node is a cell\n */\nfunction isCell<T>(node: GridNode<T> | null): boolean {\n return node?.type === \"cell\" || node?.type === \"rowheader\";\n}\n\n/**\n * Helper to check if a node is a row\n */\nfunction isRow<T>(node: GridNode<T> | null): boolean {\n return node?.type === \"item\";\n}\n\n/**\n * Creates accessibility props for a table component.\n */\nexport function createTable<T extends object>(\n props: Accessor<AriaTableProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n ref: Accessor<HTMLTableElement | null>,\n): TableAria {\n const id = createId(props().id);\n const locale = useLocale();\n\n // Track previous sort descriptor for announcements\n let prevSortDescriptor: { column: Key; direction: \"ascending\" | \"descending\" } | null = null;\n let isFirstRender = true;\n let typeaheadBuffer = \"\";\n let typeaheadTimeout: ReturnType<typeof setTimeout> | undefined;\n\n // Store metadata for child components\n const storeTableData = () => {\n const s = state();\n const p = props();\n tableMap.set(s, {\n tableId: id,\n actions: {\n onRowAction: p.onRowAction,\n onCellAction: p.onCellAction,\n },\n shouldSelectOnPressUp: p.shouldSelectOnPressUp,\n focusMode: p.focusMode,\n });\n };\n\n // Update table data whenever props/state changes\n createMemo(() => {\n storeTableData();\n });\n\n // Announce sort changes (only after initial render)\n createEffect(\n on(\n () => state().sortDescriptor,\n (sortDescriptor) => {\n if (isFirstRender) {\n isFirstRender = false;\n prevSortDescriptor = sortDescriptor;\n return;\n }\n\n if (\n sortDescriptor &&\n (sortDescriptor.column !== prevSortDescriptor?.column ||\n sortDescriptor.direction !== prevSortDescriptor?.direction)\n ) {\n const collection = state().collection;\n const column = collection.columns.find((c) => c.key === sortDescriptor.column);\n const columnName = column?.textValue ?? String(sortDescriptor.column);\n const directionText =\n sortDescriptor.direction === \"ascending\" ? \"ascending\" : \"descending\";\n\n announce(`Sorted by ${columnName}, ${directionText}`, \"assertive\", 500);\n }\n\n prevSortDescriptor = sortDescriptor;\n },\n ),\n );\n\n // Keyboard navigation handler with full 2D navigation\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const collection = s.collection;\n const p = props();\n const focusMode = p.focusMode ?? \"row\";\n const isRTL = locale().direction === \"rtl\";\n const setFocusedKey = (key: Key) => {\n s.setFocusedKey(key);\n };\n const runTypeahead = (focusedKey: Key, focusedItem: GridNode<T>) => {\n if (e.key.length !== 1 || e.ctrlKey || e.metaKey || e.altKey) {\n return false;\n }\n\n // A leading Spacebar is a selection/action key, not the start of a type-ahead\n // search. Mirror upstream useTypeSelect (`search.length === 0 && character === ' '`)\n // and let it fall through so the focused row's own Space handler toggles selection.\n // Once a search is active, Space continues the query as normal.\n if (e.key === \" \" && typeaheadBuffer.length === 0) {\n return false;\n }\n\n typeaheadBuffer += e.key.toLocaleLowerCase();\n if (typeaheadTimeout) {\n clearTimeout(typeaheadTimeout);\n }\n typeaheadTimeout = setTimeout(() => {\n typeaheadBuffer = \"\";\n typeaheadTimeout = undefined;\n }, 500);\n\n const rows = Array.from(collection).filter((node) => !s.isDisabled(node.key));\n if (rows.length === 0) {\n return true;\n }\n\n const currentRowKey =\n isCell(focusedItem) && focusedItem.parentKey != null ? focusedItem.parentKey : focusedKey;\n const currentIndex = rows.findIndex((node) => node.key === currentRowKey);\n const orderedRows =\n currentIndex >= 0\n ? [...rows.slice(currentIndex + 1), ...rows.slice(0, currentIndex + 1)]\n : rows;\n const match = orderedRows.find((node) =>\n collection.getTextValue(node.key).toLocaleLowerCase().startsWith(typeaheadBuffer),\n );\n\n if (match) {\n e.preventDefault();\n setFocusedKey(match.key);\n }\n\n return true;\n };\n\n if (s.isKeyboardNavigationDisabled) {\n return;\n }\n\n const focusedKey = s.focusedKey;\n if (focusedKey == null) {\n // If nothing is focused, focus the first item\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Home\" || e.key === \"End\") {\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n e.preventDefault();\n setFocusedKey(firstKey);\n }\n }\n return;\n }\n\n const focusedItem = collection.getItem(focusedKey);\n if (!focusedItem) return;\n\n let nextKey: Key | null = null;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n // If focused on a cell, move to the same column in the next row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n const nextRowKey = collection.getKeyAfter(focusedItem.parentKey);\n if (nextRowKey != null) {\n const cellIndex = focusedItem.index;\n const nextCell = getCellAtIndex(collection, nextRowKey, cellIndex);\n nextKey = nextCell?.key ?? nextRowKey;\n }\n } else {\n // Move to next row\n nextKey = collection.getKeyAfter(focusedKey);\n }\n break;\n }\n\n case \"ArrowUp\": {\n e.preventDefault();\n // If focused on a cell, move to the same column in the previous row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n const prevRowKey = collection.getKeyBefore(focusedItem.parentKey);\n if (prevRowKey != null) {\n const cellIndex = focusedItem.index;\n const prevCell = getCellAtIndex(collection, prevRowKey, cellIndex);\n nextKey = prevCell?.key ?? prevRowKey;\n }\n } else {\n // Move to previous row\n nextKey = collection.getKeyBefore(focusedKey);\n }\n break;\n }\n\n case \"ArrowRight\": {\n e.preventDefault();\n const goNext = !isRTL;\n\n if (isRow(focusedItem)) {\n // If on a row, go to the first/last cell\n const cells = getChildCells(collection, focusedKey);\n if (cells.length > 0) {\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // If on a cell, go to the next/prev cell\n const cells = getChildCells(collection, focusedItem.parentKey);\n const currentIndex = focusedItem.index;\n const targetIndex = goNext ? currentIndex + 1 : currentIndex - 1;\n\n if (targetIndex >= 0 && targetIndex < cells.length) {\n nextKey = cells[targetIndex].key;\n } else if (focusMode === \"row\") {\n // Wrap to row\n nextKey = focusedItem.parentKey;\n } else {\n // Wrap to first/last cell\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n }\n break;\n }\n\n case \"ArrowLeft\": {\n e.preventDefault();\n const goNext = isRTL;\n\n if (isRow(focusedItem)) {\n // If on a row, go to the last/first cell\n const cells = getChildCells(collection, focusedKey);\n if (cells.length > 0) {\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // If on a cell, go to the prev/next cell\n const cells = getChildCells(collection, focusedItem.parentKey);\n const currentIndex = focusedItem.index;\n const targetIndex = goNext ? currentIndex + 1 : currentIndex - 1;\n\n if (targetIndex >= 0 && targetIndex < cells.length) {\n nextKey = cells[targetIndex].key;\n } else if (focusMode === \"row\") {\n // Wrap to row\n nextKey = focusedItem.parentKey;\n } else {\n // Wrap to first/last cell\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n }\n break;\n }\n\n case \"Home\": {\n e.preventDefault();\n if (e.ctrlKey) {\n // Ctrl+Home: Go to first row/cell\n const firstRowKey = collection.getFirstKey();\n if (firstRowKey != null) {\n if (isCell(focusedItem) || focusMode === \"cell\") {\n const cells = getChildCells(collection, firstRowKey);\n nextKey = cells[0]?.key ?? firstRowKey;\n } else {\n nextKey = firstRowKey;\n }\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // Home: Go to first cell in current row\n const cells = getChildCells(collection, focusedItem.parentKey);\n nextKey = cells[0]?.key ?? null;\n } else {\n // On row: go to first row\n nextKey = collection.getFirstKey();\n }\n break;\n }\n\n case \"End\": {\n e.preventDefault();\n if (e.ctrlKey) {\n // Ctrl+End: Go to last row/cell\n const lastRowKey = collection.getLastKey();\n if (lastRowKey != null) {\n if (isCell(focusedItem) || focusMode === \"cell\") {\n const cells = getChildCells(collection, lastRowKey);\n nextKey = cells[cells.length - 1]?.key ?? lastRowKey;\n } else {\n nextKey = lastRowKey;\n }\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // End: Go to last cell in current row\n const cells = getChildCells(collection, focusedItem.parentKey);\n nextKey = cells[cells.length - 1]?.key ?? null;\n } else {\n // On row: go to last row\n nextKey = collection.getLastKey();\n }\n break;\n }\n\n case \"PageDown\": {\n e.preventDefault();\n // Move down by roughly a page (using DOM measurements if available)\n const el = ref();\n if (el && el.clientHeight > 0) {\n const visibleHeight = el.clientHeight;\n let currentKey: Key | null = focusedKey;\n let traveled = 0;\n\n // If on a cell, start from the parent row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n currentKey = focusedItem.parentKey;\n }\n\n // Move down until we've traveled approximately one page\n while (currentKey != null && traveled < visibleHeight) {\n const next = collection.getKeyAfter(currentKey);\n if (next == null) break;\n\n // Estimate row height (default to 40px if we can't measure)\n const rowElement = el.querySelector(`[data-key=\"${currentKey}\"]`);\n traveled += rowElement?.clientHeight ?? 40;\n currentKey = next;\n }\n\n if (currentKey != null) {\n // If we started on a cell, focus the same column in the new row\n if (isCell(focusedItem)) {\n const cellIndex = focusedItem.index;\n const targetCell = getCellAtIndex(collection, currentKey, cellIndex);\n nextKey = targetCell?.key ?? currentKey;\n } else {\n nextKey = currentKey;\n }\n }\n } else {\n // Fallback: move 10 rows\n let count = 10;\n let current: Key | null =\n isCell(focusedItem) && focusedItem.parentKey != null\n ? focusedItem.parentKey\n : focusedKey;\n while (count > 0 && current != null) {\n const next = collection.getKeyAfter(current);\n if (next == null) break;\n current = next;\n count--;\n }\n if (current != null && isCell(focusedItem)) {\n const targetCell = getCellAtIndex(collection, current, focusedItem.index);\n nextKey = targetCell?.key ?? current;\n } else {\n nextKey = current;\n }\n }\n break;\n }\n\n case \"PageUp\": {\n e.preventDefault();\n // Move up by roughly a page\n const el = ref();\n if (el && el.clientHeight > 0) {\n const visibleHeight = el.clientHeight;\n let currentKey: Key | null = focusedKey;\n let traveled = 0;\n\n // If on a cell, start from the parent row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n currentKey = focusedItem.parentKey;\n }\n\n // Move up until we've traveled approximately one page\n while (currentKey != null && traveled < visibleHeight) {\n const prev = collection.getKeyBefore(currentKey);\n if (prev == null) break;\n\n const rowElement = el.querySelector(`[data-key=\"${currentKey}\"]`);\n traveled += rowElement?.clientHeight ?? 40;\n currentKey = prev;\n }\n\n if (currentKey != null) {\n if (isCell(focusedItem)) {\n const cellIndex = focusedItem.index;\n const targetCell = getCellAtIndex(collection, currentKey, cellIndex);\n nextKey = targetCell?.key ?? currentKey;\n } else {\n nextKey = currentKey;\n }\n }\n } else {\n // Fallback: move 10 rows\n let count = 10;\n let current: Key | null =\n isCell(focusedItem) && focusedItem.parentKey != null\n ? focusedItem.parentKey\n : focusedKey;\n while (count > 0 && current != null) {\n const prev = collection.getKeyBefore(current);\n if (prev == null) break;\n current = prev;\n count--;\n }\n if (current != null && isCell(focusedItem)) {\n const targetCell = getCellAtIndex(collection, current, focusedItem.index);\n nextKey = targetCell?.key ?? current;\n } else {\n nextKey = current;\n }\n }\n break;\n }\n\n case \"Escape\":\n if (p.escapeKeyBehavior !== \"none\") {\n s.clearSelection();\n }\n return;\n\n case \"a\":\n if (e.ctrlKey || e.metaKey) {\n e.preventDefault();\n if (s.selectionMode === \"multiple\") {\n s.selectAll();\n }\n }\n return;\n\n // NOTE: Space/Enter selection is intentionally NOT handled here. Upstream\n // useSelectableCollection has no ' '/Enter case — keyboard selection is owned\n // by the row (useSelectableItem, ported in createTableRow). Handling it here too\n // double-toggled the selection (row toggles on, grid toggles back off → no-op),\n // since the row handler does not stop propagation. Space/Enter fall through to\n // the type-ahead path below, which ignores a leading Space and bails on Enter.\n\n default:\n if (runTypeahead(focusedKey, focusedItem)) {\n return;\n }\n return;\n }\n\n if (nextKey != null) {\n setFocusedKey(nextKey);\n\n // Handle shift+arrow for range selection\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n // For cells, select the parent row\n const focusedNode = collection.getItem(nextKey);\n const keyToSelect =\n focusedNode && isCell(focusedNode) && focusedNode.parentKey != null\n ? focusedNode.parentKey\n : nextKey;\n s.extendSelection(keyToSelect);\n }\n }\n };\n\n // Focus handling\n const onFocus = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n if (!el?.contains(e.target as Element)) {\n return;\n }\n\n if (!s.isFocused) {\n s.setFocused(true);\n\n // If no key is focused, focus the first one\n if (s.focusedKey == null) {\n const firstKey = s.collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n // Only blur if focus is leaving the table entirely\n if (el && !el.contains(e.relatedTarget as Element)) {\n s.setFocused(false);\n }\n };\n\n // Mirror React Aria's useSelectableCollection: once the roving tabindex for\n // the focused key has been committed to the DOM, move browser focus onto that\n // element from a post-commit effect — looking it up by its stable data-key\n // rather than by transient tabindex. Doing this imperatively during the key\n // handler (in a microtask) raced Solid's reconciliation and dropped focus to\n // <body>, so Space/Enter never reached the grid's selection handler.\n createEffect(() => {\n const s = state();\n const key = s.focusedKey;\n const el = ref();\n if (!el || key == null) {\n return;\n }\n\n // Only manage focus while it already lives inside the table — i.e. the user\n // is navigating with the keyboard. We gate on the *physical* position of\n // browser focus rather than the grid's logical `isFocused` signal: focus can\n // land directly on a row (a pointer click, or programmatic row focus) without\n // ever firing the grid's own non-bubbling focus handler, so `isFocused` stays\n // false even though the table genuinely holds focus. The contains() check is\n // also what keeps us from pulling focus back from elsewhere on the page when\n // the focused key changes from a background interaction.\n const active = document.activeElement;\n if (!active || (active !== el && !el.contains(active))) {\n return;\n }\n\n const target = el.querySelector<HTMLElement>(`[data-key=\"${key}\"]`);\n if (target && target !== active) {\n target.focus();\n\n // Reveal the newly focused row/cell when navigating with the keyboard,\n // mirroring useSelectableCollection. Pointer-driven focus changes should\n // not shift the scroll position under the user's finger.\n if (getInteractionModality() !== \"pointer\") {\n scrollIntoViewport(target, { containingElement: el });\n }\n }\n });\n\n // Warn if no label is provided\n createMemo(() => {\n const p = props();\n if (!p[\"aria-label\"] && !p[\"aria-labelledby\"]) {\n console.warn(\"Table: An aria-label or aria-labelledby prop is required for accessibility.\");\n }\n });\n\n // A sorted table exposes a persistent sort description on the grid (\"sorted by\n // column {name} in {direction} order\"), mirroring `useTable`'s\n // `useDescription(sortDescription)` — separate from the transient live-region\n // announcement above. `columnName` follows upstream exactly\n // (`columns.find(c => c.key === column)?.textValue ?? ''`) so a header with no\n // plain-text value yields an empty name, matching the S2 oracle.\n const sortDescription = () => {\n const s = state();\n const descriptor = s.sortDescriptor;\n const column = descriptor?.column;\n const direction = descriptor?.direction;\n if (!direction || column == null) {\n return undefined;\n }\n const columnName = s.collection.columns.find((c) => c.key === column)?.textValue ?? \"\";\n return `sorted by column ${columnName} in ${direction} order`;\n };\n const sortDescriptionProps = createDescription(sortDescription);\n\n const gridProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const describedBy =\n [sortDescriptionProps[\"aria-describedby\"], p[\"aria-describedby\"]].filter(Boolean).join(\" \") ||\n undefined;\n\n const baseProps: Record<string, unknown> = {\n role: \"grid\",\n id,\n \"aria-label\": p[\"aria-label\"],\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-describedby\": describedBy,\n \"aria-multiselectable\": s.selectionMode === \"multiple\" ? \"true\" : undefined,\n // Keep the grid itself tabbable so keyboard users can enter\n // row/cell navigation without requiring a prior pointer interaction.\n tabIndex: 0,\n onKeyDown,\n onFocus,\n onBlur,\n };\n\n if (p.isVirtualized) {\n baseProps[\"aria-rowcount\"] = s.collection.rowCount;\n baseProps[\"aria-colcount\"] = s.collection.columnCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableElement>;\n });\n\n return {\n get gridProps() {\n return gridProps();\n },\n };\n}\n","/**\n * createTableHeaderRow - Provides accessibility for a table header row.\n * Based on @react-aria/table/useTableHeaderRow.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableHeaderRowProps, TableHeaderRowAria } from \"./types\";\n\n/**\n * Creates accessibility props for a table header row.\n */\nexport function createTableHeaderRow<T extends object>(\n props: Accessor<AriaTableHeaderRowProps>,\n _state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableRowElement | null>,\n): TableHeaderRowAria {\n const rowProps = createMemo(() => {\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n };\n\n // Add aria-rowindex for virtualized tables\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps[\"aria-rowindex\"] = node.rowIndex + 1; // 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableRowElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n };\n}\n","/**\n * createTableColumnHeader - Provides accessibility for a table column header.\n * Based on @react-aria/table/useTableColumnHeader.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableColumnHeaderProps, TableColumnHeaderAria } from \"./types\";\nimport { getTableData } from \"./createTable\";\nimport { createDescription } from \"../utils/createDescription\";\n\n/**\n * Creates accessibility props for a table column header.\n */\nexport function createTableColumnHeader<T extends object>(\n props: Accessor<AriaTableColumnHeaderProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableCellElement | null>,\n): TableColumnHeaderAria {\n const [isPressed, setIsPressed] = createSignal(false);\n let ignoreNextClick = false;\n let ignoreNextClickTimeout: ReturnType<typeof setTimeout> | undefined;\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n // A sortable column header is described as \"sortable column\" — mirrors\n // `useTableColumnHeader`'s `useDescription(stringFormatter.format('sortable'))`.\n // Backed by a shared hidden element (ref-counted) and referenced via\n // aria-describedby.\n const sortDescriptionProps = createDescription(() =>\n props().allowsSorting ? \"sortable column\" : undefined,\n );\n\n const sortColumn = () => {\n const s = state();\n const p = props();\n\n if (p.allowsSorting) {\n s.sort(p.node.key);\n }\n };\n\n const clearPendingClickIgnore = () => {\n if (ignoreNextClickTimeout != null) {\n clearTimeout(ignoreNextClickTimeout);\n ignoreNextClickTimeout = undefined;\n }\n };\n\n const ignorePointerGeneratedClick = () => {\n clearPendingClickIgnore();\n ignoreNextClick = true;\n ignoreNextClickTimeout = setTimeout(() => {\n ignoreNextClick = false;\n ignoreNextClickTimeout = undefined;\n }, 0);\n };\n\n // Handle click for sorting. Pointer activation is handled on pointerup because\n // focusing the table header can re-render its child content before a native\n // click is dispatched.\n const onClick = () => {\n if (ignoreNextClick) {\n ignoreNextClick = false;\n clearPendingClickIgnore();\n return;\n }\n\n sortColumn();\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const p = props();\n\n if (\n p.allowsSorting &&\n (e.key === \"Enter\" || e.key === \" \" || e.key === \"Space\" || e.key === \"Spacebar\")\n ) {\n e.preventDefault();\n sortColumn();\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = (e: PointerEvent) => {\n if (e.button !== 0) {\n return;\n }\n\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n if (isPressed()) {\n ignorePointerGeneratedClick();\n sortColumn();\n }\n\n setIsPressed(false);\n };\n\n const onPointerCancel = () => {\n setIsPressed(false);\n };\n\n const columnHeaderProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const tableData = getTableData(s);\n\n // Determine sort state\n let ariaSort: \"none\" | \"ascending\" | \"descending\" | undefined = undefined;\n if (p.allowsSorting) {\n const sortDescriptor = s.sortDescriptor;\n if (sortDescriptor?.column === node.key) {\n ariaSort = sortDescriptor.direction;\n } else {\n ariaSort = \"none\";\n }\n }\n\n const baseProps: Record<string, unknown> = {\n role: \"columnheader\",\n id: tableData ? `${tableData.tableId}-${node.key}` : undefined,\n \"aria-sort\": ariaSort,\n \"aria-describedby\": sortDescriptionProps[\"aria-describedby\"],\n tabIndex: isFocused() ? 0 : -1,\n onFocus,\n };\n\n // Add click handler if sortable\n if (p.allowsSorting) {\n baseProps.onClick = onClick;\n baseProps.onKeyDown = onKeyDown;\n baseProps.onPointerDown = onPointerDown;\n baseProps.onPointerUp = onPointerUp;\n baseProps.onPointerCancel = onPointerCancel;\n baseProps.onPointerLeave = onPointerCancel;\n baseProps.style = { cursor: \"pointer\" };\n }\n\n // Add aria-colindex for virtualized tables\n if (p.isVirtualized && node.column != null) {\n baseProps[\"aria-colindex\"] = node.column + 1; // 1-based\n }\n\n // Add colspan if present\n if (node.colspan != null && node.colspan > 1) {\n baseProps[\"aria-colspan\"] = node.colspan;\n baseProps.colSpan = node.colspan;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableCellElement>;\n });\n\n return {\n get columnHeaderProps() {\n return columnHeaderProps();\n },\n };\n}\n","/**\n * Table accessibility id helpers.\n * Port of @react-aria/table/utils (`getRowLabelledBy` / cell id derivation).\n */\n\nimport type { Key, GridNode, TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport { getTableData } from \"./createTable\";\n\n/**\n * A row is labelled by its row-header cells. Mirrors `@react-aria/table`'s\n * `getRowLabelledBy`, which joins `getCellId(state, rowKey, columnKey)` across\n * `collection.rowHeaderColumnKeys`. We resolve the actual rowheader cell node\n * and rebuild the exact id string `createTableCell` puts on the element\n * (`${tableId}-${parentKey}-${cellKey}`) so the reference always matches a real\n * element, regardless of the cell-key scheme.\n */\nexport function getRowLabelledBy<T extends object>(\n state: TableState<T, TableCollection<T>>,\n rowKey: Key,\n): string {\n const tableData = getTableData(state);\n const tableId = tableData?.tableId ?? \"table\";\n const collection = state.collection as TableCollection<T> & {\n getCell?: (rowKey: Key, columnKey: Key) => GridNode<T> | null;\n };\n\n return [...collection.rowHeaderColumnKeys]\n .map((columnKey) => {\n const cell = collection.getCell?.(rowKey, columnKey);\n return cell?.parentKey != null\n ? `${tableId}-${String(cell.parentKey)}-${String(cell.key)}`\n : null;\n })\n .filter((id): id is string => id != null)\n .join(\" \");\n}\n","/**\n * createTableRow - Provides accessibility for a table row.\n * Based on @react-aria/table/useTableRow.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type {\n Collection,\n Key,\n Selection,\n TableState,\n TableCollection,\n} from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableRowProps, TableRowAria, ExpandButtonProps } from \"./types\";\nimport { getTableData } from \"./createTable\";\nimport { getRowLabelledBy } from \"./utils\";\nimport { useLocale } from \"../i18n\";\nimport { createSelectableItem, type SelectableItemState } from \"../selection/createSelectableItem\";\nimport { mergeProps } from \"../utils/mergeProps\";\n\n/**\n * Arrow keys that expand/collapse a tree-grid row, mirroring `@react-aria/table`.\n * Direction is flipped under RTL.\n */\nconst EXPANSION_KEYS = {\n expand: { ltr: \"ArrowRight\", rtl: \"ArrowLeft\" },\n collapse: { ltr: \"ArrowLeft\", rtl: \"ArrowRight\" },\n} as const;\n\n/**\n * Creates accessibility props for a table row.\n */\nexport function createTableRow<T extends object>(\n props: Accessor<AriaTableRowProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n ref: Accessor<HTMLTableRowElement | null>,\n): TableRowAria {\n const locale = useLocale();\n\n // Tree-grid (expandable rows): only active when the collection has a tree column.\n const isTreeRow = createMemo(() => state().treeColumn != null);\n\n const hasChildRows = createMemo(() => props().node.isExpandable ?? false);\n\n const isExpanded = createMemo(() => {\n const s = state();\n if (s.treeColumn == null) return false;\n return s.expandedKeys === \"all\" || s.expandedKeys.has(props().node.key);\n });\n\n // aria-posinset / aria-setsize among same-level sibling rows.\n const siblingInfo = createMemo(() => {\n const s = state();\n const node = props().node;\n if (node.parentKey != null) {\n const parent = s.collection.getItem(node.parentKey);\n if (parent) {\n const siblings = parent.childNodes.filter((n) => n.type === \"item\");\n return { posinset: node.index + 1, setsize: siblings.length };\n }\n }\n const rootRows = s.collection.body.childNodes.filter((n) => n.type === \"item\");\n const rootIndex = rootRows.findIndex((n) => n.key === node.key);\n return {\n posinset: rootIndex >= 0 ? rootIndex + 1 : node.index + 1,\n setsize: rootRows.length,\n };\n });\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.node.key);\n });\n\n const selectableState: SelectableItemState<T> = {\n collection: () => state().collection as unknown as Collection<T>,\n isFocused: () => state().isFocused,\n setFocused: (focused: boolean) => state().setFocused(focused),\n focusedKey: () => state().focusedKey,\n childFocusStrategy: () => state().childFocusStrategy,\n setFocusedKey: (key: Key | null, strategy) => state().setFocusedKey(key, strategy),\n selectionMode: () => state().selectionMode,\n selectionBehavior: () => state().selectionBehavior,\n disallowEmptySelection: () => state().disallowEmptySelection,\n selectedKeys: () => state().selectedKeys as Selection,\n disabledKeys: () => state().disabledKeys,\n disabledBehavior: () => state().disabledBehavior,\n isEmpty: () => {\n const keys = state().selectedKeys;\n return keys !== \"all\" && keys.size === 0;\n },\n isSelectAll: () => state().selectedKeys === \"all\",\n isSelected: (key: Key) => state().isSelected(key),\n isDisabled: (key: Key) => {\n const s = state();\n const item = s.collection.getItem(key);\n return (\n s.disabledBehavior === \"all\" &&\n s.isDisabled(key) &&\n item?.props?.disabledBehavior !== \"selection\"\n );\n },\n canSelectItem: (key: Key) => {\n const s = state();\n return s.selectionMode !== \"none\" && !s.isDisabled(key);\n },\n setSelectionBehavior: (behavior) => state().setSelectionBehavior(behavior),\n toggleSelection: (key: Key) => state().toggleSelection(key),\n replaceSelection: (key: Key) => state().replaceSelection(key),\n setSelectedKeys: (keys: Iterable<Key>) => state().setSelectedKeys(keys),\n selectAll: () => state().selectAll(),\n clearSelection: () => state().clearSelection(),\n toggleSelectAll: () => state().toggleSelectAll(),\n extendSelection: (toKey: Key, _collection: Collection<T>) => state().extendSelection(toKey),\n };\n\n const selectableItem = createSelectableItem<T>(\n () => {\n const s = state();\n const p = props();\n const tableData = getTableData(s);\n const onRowAction = tableData?.actions.onRowAction;\n const hasAction = !!p.onAction || !!onRowAction || !!p.href;\n\n return {\n key: p.node.key,\n id: `${tableData?.tableId ?? \"table\"}-row-${String(p.node.key)}`,\n isVirtualized: p.isVirtualized,\n shouldSelectOnPressUp: tableData?.shouldSelectOnPressUp ?? false,\n isDisabled: !!p.isDisabled || s.collection.size === 0,\n onAction: hasAction\n ? (event) => {\n p.onAction?.();\n onRowAction?.(p.node.key);\n if (p.href) {\n p.onLinkAction?.(event);\n }\n }\n : undefined,\n };\n },\n selectableState,\n ref,\n );\n\n const isDisabled = () => selectableItem.isDisabled();\n\n const onTreeGridKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Tree-grid expand/collapse with Left/Right arrows (flipped under RTL). Handled before\n // selection/navigation; stopping propagation prevents the grid's arrow navigation when\n // expansion consumes the key.\n if (s.treeColumn != null) {\n const direction = locale().direction === \"rtl\" ? \"rtl\" : \"ltr\";\n const key = p.node.key;\n const expanded = s.expandedKeys;\n if (\n e.key === EXPANSION_KEYS.expand[direction] &&\n s.focusedKey === key &&\n hasChildRows() &&\n expanded !== \"all\" &&\n !expanded.has(key)\n ) {\n s.toggleKey(key);\n e.stopPropagation();\n return;\n } else if (e.key === EXPANSION_KEYS.collapse[direction] && s.focusedKey === key) {\n if (expanded !== \"all\") {\n if (hasChildRows() && expanded.has(key)) {\n s.toggleKey(key);\n e.stopPropagation();\n return;\n } else if (!expanded.has(key) && p.node.parentKey != null && p.node.level > 0) {\n // Leaf or already-collapsed row: move focus to the parent row.\n s.setFocusedKey(p.node.parentKey);\n e.stopPropagation();\n return;\n }\n } else {\n s.toggleKey(key);\n e.stopPropagation();\n return;\n }\n }\n }\n };\n\n const rowProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n \"aria-selected\": s.selectionMode !== \"none\" ? isSelected() : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n };\n\n // A row is labelled by its row-header cell(s) — mirrors `useTableRow`'s\n // `'aria-labelledby': getRowLabelledBy(state, node.key)`. Without it the\n // browser falls back to concatenating every cell (incl. the selection\n // checkbox), so the row's accessible name reads \"Select Foo.pdf PDF …\".\n const labelledBy = getRowLabelledBy(s, node.key);\n if (labelledBy) {\n baseProps[\"aria-labelledby\"] = labelledBy;\n }\n\n // Tree-grid rows expose their nesting depth, position and expansion state.\n if (s.treeColumn != null) {\n const { posinset, setsize } = siblingInfo();\n baseProps[\"aria-expanded\"] = hasChildRows() ? isExpanded() : undefined;\n baseProps[\"aria-level\"] = node.level + 1; // 1-based\n baseProps[\"aria-posinset\"] = posinset;\n baseProps[\"aria-setsize\"] = setsize;\n baseProps.onKeyDown = onTreeGridKeyDown;\n }\n\n // Add aria-rowindex for virtualized tables. Tree grids omit it (matches upstream).\n if (p.isVirtualized && s.treeColumn == null && node.rowIndex != null) {\n baseProps[\"aria-rowindex\"] = node.rowIndex + 1; // 1-based\n }\n\n return mergeProps<JSX.HTMLAttributes<HTMLTableRowElement>>(\n selectableItem.itemProps as unknown as JSX.HTMLAttributes<HTMLTableRowElement>,\n baseProps,\n );\n });\n\n // Chevron button for expanding/collapsing a tree-grid row. Press-based so it flows through\n // our Button's `createPress`, and excluded from the tab order — reached via the row's\n // Left/Right arrow keys instead. Mirrors `@react-aria/table`'s `expandButtonProps`; whether a\n // chevron renders for a leaf row is the consumer's call (gate on `hasChildItems`), matching S2.\n const onExpandPress = () => {\n const s = state();\n const p = props();\n if (isDisabled()) return;\n s.toggleKey(p.node.key);\n s.setFocused(true);\n s.setFocusedKey(p.node.key);\n };\n\n const expandButtonProps = createMemo<ExpandButtonProps>(() => ({\n isDisabled: isDisabled(),\n onPress: onExpandPress,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n \"data-react-aria-prevent-focus\": true,\n \"aria-label\": isExpanded() ? \"Collapse\" : \"Expand\",\n }));\n\n return {\n get rowProps() {\n return rowProps();\n },\n get expandButtonProps() {\n return expandButtonProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return selectableItem.isPressed();\n },\n get isExpanded() {\n return isExpanded();\n },\n get hasChildRows() {\n return hasChildRows();\n },\n };\n}\n","/**\n * createTableCell - Provides accessibility for a table cell.\n * Based on @react-aria/table/useTableCell.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableCellProps, TableCellAria } from \"./types\";\nimport { getTableData } from \"./createTable\";\n\n/**\n * Creates accessibility props for a table cell.\n */\nexport function createTableCell<T extends object>(\n props: Accessor<AriaTableCellProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableCellElement | null>,\n): TableCellAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n // Check if parent row is disabled\n const node = p.node;\n if (node.parentKey != null) {\n return s.isDisabled(node.parentKey);\n }\n return false;\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n // Handle click for cell actions\n const onClick = () => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get table metadata for actions\n const tableData = getTableData(s);\n const onCellAction = tableData?.actions.onCellAction;\n\n // Call cell action handler\n if (onCellAction) {\n onCellAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Enter triggers cell action\n if (e.key === \"Enter\") {\n const tableData = getTableData(s);\n const onCellAction = tableData?.actions.onCellAction;\n\n if (onCellAction || p.onAction) {\n e.preventDefault();\n\n if (onCellAction) {\n onCellAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const gridCellProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const tableData = getTableData(s);\n\n // Determine the role based on node type\n let role: string = \"gridcell\";\n if (node.type === \"rowheader\") {\n role = \"rowheader\";\n }\n\n const baseProps: Record<string, unknown> = {\n role,\n id:\n tableData && node.parentKey != null\n ? `${tableData.tableId}-${node.parentKey}-${node.key}`\n : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add aria-colindex for virtualized tables\n if (p.isVirtualized && node.column != null) {\n baseProps[\"aria-colindex\"] = node.column + 1; // 1-based\n }\n\n // Add colspan if present\n if (node.colspan != null && node.colspan > 1) {\n baseProps[\"aria-colspan\"] = node.colspan;\n baseProps.colSpan = node.colspan;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableCellElement>;\n });\n\n return {\n get gridCellProps() {\n return gridCellProps();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n","/**\n * createTableRowGroup - Provides accessibility for a table row group.\n * Based on @react-aria/grid/useTableRowGroup.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { AriaTableRowGroupProps, TableRowGroupAria } from \"./types\";\n\n/**\n * Creates accessibility props for a table row group (thead, tbody, tfoot).\n */\nexport function createTableRowGroup(props: Accessor<AriaTableRowGroupProps>): TableRowGroupAria {\n const rowGroupProps = createMemo(() => {\n // Access props for reactivity tracking, even though not currently used\n void props();\n\n const baseProps: Record<string, unknown> = {\n role: \"rowgroup\",\n };\n\n return baseProps as JSX.HTMLAttributes<HTMLTableSectionElement>;\n });\n\n return {\n get rowGroupProps() {\n return rowGroupProps();\n },\n };\n}\n","/**\n * createTableSelectionCheckbox - Provides accessibility for a table row selection checkbox.\n * Based on @react-aria/table/useTableSelectionCheckbox.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableSelectionCheckboxProps, TableSelectionCheckboxAria } from \"./types\";\nimport { getRowLabelledBy } from \"./utils\";\n\n/**\n * Creates accessibility props for a table row selection checkbox.\n */\nexport function createTableSelectionCheckbox<T extends object>(\n props: Accessor<AriaTableSelectionCheckboxProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n): TableSelectionCheckboxAria {\n const checkboxId = createId();\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n // Mirrors `useGridSelectionCheckbox`'s `!selectionManager.canSelectItem(key)`:\n // a row's checkbox is disabled when selection is off, the key is in\n // `disabledKeys`, or the row/item itself is disabled. This is broader than the\n // row's own focusability gate (which only disables under `disabledBehavior:\n // \"all\"`) — a row disabled via its `isDisabled` prop still cannot be selected,\n // so its checkbox is disabled regardless of `disabledBehavior`.\n //\n // `isRowDisabled` carries the render-time per-row `isDisabled` that this\n // data-driven port keeps on the row hook rather than the collection node\n // (surfaced via `TableRowContext`); the collection-node check below still\n // applies for any path that does populate `node.isDisabled`.\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n if (s.selectionMode === \"none\" || s.disabledKeys.has(p.key) || p.isRowDisabled) {\n return true;\n }\n const item = s.collection.getItem(p.key);\n return !item || !!item.isDisabled || !!item.props?.isDisabled;\n });\n\n const onChange = () => {\n const s = state();\n const p = props();\n if (!isDisabled()) {\n s.toggleSelection(p.key);\n }\n };\n\n const checkboxProps = createMemo(() => {\n const s = state();\n const p = props();\n\n const baseProps: Record<string, unknown> = {\n id: checkboxId,\n type: \"checkbox\",\n checked: isSelected(),\n disabled: isDisabled(),\n onChange,\n \"aria-label\": \"Select\",\n // Mirrors `useTableSelectionCheckbox`: the checkbox is labelled by its own\n // \"Select\" text plus the row's row-header cell(s), so screen readers read\n // \"Select Foo.pdf\" rather than a bare \"Select\".\n \"aria-labelledby\": `${checkboxId} ${getRowLabelledBy(s, p.key)}`,\n };\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n","/**\n * createTableSelectAllCheckbox - Provides accessibility for a table select-all checkbox.\n * Based on @react-aria/table/useTableSelectAllCheckbox.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { TableSelectAllCheckboxAria } from \"./types\";\n\n/**\n * Creates accessibility props for a table select-all checkbox.\n */\nexport function createTableSelectAllCheckbox<T extends object>(\n state: Accessor<TableState<T, TableCollection<T>>>,\n): TableSelectAllCheckboxAria {\n const isSelectAll = createMemo(() => {\n const s = state();\n return s.selectedKeys === \"all\";\n });\n\n const isEmpty = createMemo(() => {\n const s = state();\n return s.collection.size === 0;\n });\n\n const isIndeterminate = createMemo(() => {\n const s = state();\n const selectedKeys = s.selectedKeys;\n if (selectedKeys === \"all\") return false;\n if (selectedKeys.size === 0) return false;\n return selectedKeys.size < s.collection.size;\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n return s.selectionMode !== \"multiple\" || isEmpty();\n });\n\n const onChange = () => {\n const s = state();\n if (!isDisabled()) {\n s.toggleSelectAll();\n }\n };\n\n const checkboxProps = createMemo(() => {\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n type: \"checkbox\",\n checked: isSelectAll(),\n disabled: isDisabled(),\n onChange,\n \"aria-label\": s.selectionMode === \"single\" ? \"Select\" : \"Select All\",\n };\n\n if (isIndeterminate()) {\n baseProps[\"data-indeterminate\"] = \"true\";\n }\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n get isIndeterminate() {\n return isIndeterminate();\n },\n };\n}\n","/**\n * ARIA hook for table column resize interactions.\n * Based on @react-aria/table/useTableColumnResize.\n *\n * Provides pointer-drag and keyboard-based column resizing with\n * correct ARIA attributes for screen readers.\n */\n\nimport { createSignal, createMemo, type Accessor, type JSX } from \"solid-js\";\nimport type { Key, TableColumnResizeState } from \"@proyecto-viviana/solid-stately\";\nimport { useLocale } from \"../i18n\";\n\nexport interface CreateTableColumnResizeProps {\n /** The column being resized. */\n column: { key: Key };\n /** Accessible label for the resizer. */\n \"aria-label\": string;\n /** Whether resizing is disabled. */\n isDisabled?: boolean;\n /** Called when a resize operation starts. */\n onResizeStart?: (widths: Map<Key, number>) => void;\n /** Called during resize with updated widths. */\n onResize?: (widths: Map<Key, number>) => void;\n /** Called when resize operation ends. */\n onResizeEnd?: (widths: Map<Key, number>) => void;\n}\n\nexport interface TableColumnResizeResult {\n /** Props for the visible resizer handle element (div). */\n resizerProps: JSX.HTMLAttributes<HTMLDivElement>;\n /** Props for the hidden range input (screen reader accessible). */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether this column is currently being resized. */\n isResizing: Accessor<boolean>;\n}\n\nconst KEYBOARD_STEP = 10; // px per arrow key press\n\n/**\n * Creates ARIA-compliant column resize behavior.\n *\n * Returns props for a visible drag handle (div) and a visually-hidden\n * range input that allows keyboard and screen-reader users to resize columns.\n */\nexport function createTableColumnResize(\n props: Accessor<CreateTableColumnResizeProps>,\n state: Accessor<TableColumnResizeState>,\n): TableColumnResizeResult {\n const getProps = () => props();\n const getState = () => state();\n const locale = useLocale();\n\n const [isPointerDragging, setIsPointerDragging] = createSignal(false);\n const [isKeyboardResizing, setIsKeyboardResizing] = createSignal(false);\n\n const isResizing = createMemo(() => getState().resizingColumn() === getProps().column.key);\n\n const isRtl = createMemo(() => {\n const l = locale();\n return l?.direction === \"rtl\";\n });\n\n // ---- Pointer (mouse/touch) drag ----\n\n let startX = 0;\n let startWidth = 0;\n\n const onPointerDown = (e: PointerEvent) => {\n if (getProps().isDisabled) return;\n e.preventDefault();\n e.stopPropagation();\n\n const key = getProps().column.key;\n startX = e.clientX;\n startWidth = getState().getColumnWidth(key);\n\n getState().startResize(key);\n getProps().onResizeStart?.(getState().columnWidths());\n setIsPointerDragging(true);\n\n const target = e.currentTarget as HTMLElement;\n target.setPointerCapture(e.pointerId);\n };\n\n const onPointerMove = (e: PointerEvent) => {\n if (!isPointerDragging()) return;\n e.preventDefault();\n\n const deltaX = e.clientX - startX;\n const direction = isRtl() ? -1 : 1;\n const newWidth = startWidth + deltaX * direction;\n\n const key = getProps().column.key;\n const widths = getState().updateResizedColumns(key, newWidth);\n getProps().onResize?.(widths);\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (!isPointerDragging()) return;\n e.preventDefault();\n setIsPointerDragging(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n };\n\n // ---- Keyboard resize (on the hidden input) ----\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (getProps().isDisabled) return;\n\n const key = getProps().column.key;\n const rtlMul = isRtl() ? -1 : 1;\n\n switch (e.key) {\n case \"Enter\": {\n if (isKeyboardResizing()) {\n // End resize\n setIsKeyboardResizing(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n } else {\n // Start resize\n setIsKeyboardResizing(true);\n getState().startResize(key);\n getProps().onResizeStart?.(getState().columnWidths());\n }\n e.preventDefault();\n break;\n }\n case \"Escape\": {\n if (isKeyboardResizing()) {\n setIsKeyboardResizing(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n e.preventDefault();\n }\n break;\n }\n case \"Tab\": {\n if (isKeyboardResizing()) {\n setIsKeyboardResizing(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n }\n // Let Tab propagate for focus management\n break;\n }\n case \"ArrowRight\": {\n if (isKeyboardResizing()) {\n const currentWidth = getState().getColumnWidth(key);\n const widths = getState().updateResizedColumns(\n key,\n currentWidth + KEYBOARD_STEP * rtlMul,\n );\n getProps().onResize?.(widths);\n e.preventDefault();\n }\n break;\n }\n case \"ArrowLeft\": {\n if (isKeyboardResizing()) {\n const currentWidth = getState().getColumnWidth(key);\n const widths = getState().updateResizedColumns(\n key,\n currentWidth - KEYBOARD_STEP * rtlMul,\n );\n getProps().onResize?.(widths);\n e.preventDefault();\n }\n break;\n }\n }\n };\n\n // Handle input change (from screen reader range slider)\n const onInputChange = (e: Event) => {\n const input = e.target as HTMLInputElement;\n const newWidth = parseFloat(input.value);\n if (isNaN(newWidth)) return;\n\n const key = getProps().column.key;\n if (!isResizing()) {\n getState().startResize(key);\n getProps().onResizeStart?.(getState().columnWidths());\n }\n\n const widths = getState().updateResizedColumns(key, newWidth);\n getProps().onResize?.(widths);\n\n // End immediately for discrete input changes\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n };\n\n // Visible resize handle props. The accessible resize control is the hidden\n // range input below, matching React Aria's ColumnResizer structure.\n const resizerProps: JSX.HTMLAttributes<HTMLDivElement> = {\n role: \"presentation\",\n tabIndex: -1,\n style: {\n \"touch-action\": \"none\",\n cursor: \"col-resize\",\n },\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n // Visually hidden range input props\n const inputProps: JSX.InputHTMLAttributes<HTMLInputElement> = {\n get type() {\n return \"range\";\n },\n get tabIndex() {\n return getProps().isDisabled ? -1 : 0;\n },\n get disabled() {\n return getProps().isDisabled;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-orientation\"() {\n return \"horizontal\" as const;\n },\n get min() {\n return getState().getColumnMinWidth(getProps().column.key);\n },\n get max() {\n const maxW = getState().getColumnMaxWidth(getProps().column.key);\n return maxW === Infinity ? 9999 : maxW;\n },\n get value() {\n return getState().getColumnWidth(getProps().column.key);\n },\n style: {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n \"white-space\": \"nowrap\",\n \"border-width\": \"0\",\n },\n onKeyDown,\n onChange: onInputChange,\n };\n\n return {\n resizerProps,\n inputProps,\n isResizing,\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,2BAAW,IAAI,QAQnB;;;;AAKF,SAAgB,aAAgB,OAA0C;CACxE,OAAO,SAAS,IAAI,KAAK;AAC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CAAC;GACpB;GACA,IAAI,eAAe;IACjB,OAAO,SAAS,CAAC,CAAC;GACpB;GACA,IAAI,qBAAqB;IACvB,OAAO;GACT;GACA,IAAI,MAAM;IACR,OAAO,SAAS,CAAC,CAAC,kBAAkB,SAAS,CAAC,CAAC,OAAO,GAAG;GAC3D;GACA,IAAI,MAAM;IACR,MAAM,OAAO,SAAS,CAAC,CAAC,kBAAkB,SAAS,CAAC,CAAC,OAAO,GAAG;IAC/D,OAAO,SAAS,WAAW,OAAO;GACpC;GACA,IAAI,QAAQ;IACV,OAAO,SAAS,CAAC,CAAC,eAAe,SAAS,CAAC,CAAC,OAAO,GAAG;GACxD;GACA,OAAO;IACL,UAAU;IACV,OAAO;IACP,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,UAAU;IACV,MAAM;IACN,eAAe;IACf,gBAAgB;GAClB;GACA;GACA,UAAU;EAKD;EACT;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"tree.js","names":["mergeProps"],"sources":["../../src/tree/createTree.ts","../../src/tree/createTreeItem.ts","../../src/tree/createTreeSelectionCheckbox.ts"],"sourcesContent":["/**\n * createTree - Provides accessibility for a tree component.\n * Based on @react-aria/tree/useTree.\n */\n\nimport { createEffect, createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TreeState, TreeCollection, Key } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTreeProps, TreeAria } from \"./types\";\nimport { scrollIntoViewport } from \"../utils\";\nimport { getInteractionModality } from \"../interactions/createInteractionModality\";\n\n/**\n * Metadata stored for a tree instance.\n */\ninterface TreeData {\n /** The generated ID for the tree. */\n treeId: string;\n /** How keyboard navigation behaves within row children. */\n keyboardNavigationBehavior: \"arrow\" | \"tab\";\n /** Text direction for row-child arrow navigation and tree expansion keys. */\n direction: \"ltr\" | \"rtl\";\n /** Actions registered for the tree. */\n actions: {\n onAction?: (key: Key) => void;\n };\n}\n\n/**\n * WeakMap to store tree data for child components to access.\n */\nconst treeDataMap = new WeakMap<object, TreeData>();\n\n/**\n * Gets the tree data for a given state.\n */\nexport function getTreeData<T extends object, C extends TreeCollection<T>>(\n state: TreeState<T, C>,\n): TreeData | undefined {\n return treeDataMap.get(state);\n}\n\n/**\n * Whether a key should be skipped during keyboard navigation. Disabled keys only\n * block navigation under `disabledBehavior: \"all\"` (the default); under\n * `\"selection\"` they remain focusable (selection is still blocked elsewhere).\n * Mirrors `ListKeyboardDelegate.isDisabled` in React Aria.\n */\nfunction isNavigationDisabled<T extends object, C extends TreeCollection<T>>(\n state: TreeState<T, C>,\n key: Key,\n): boolean {\n return state.isDisabled(key) && state.disabledBehavior === \"all\";\n}\n\n/**\n * Walks from `startKey` via `step` until reaching a key that is navigable (not\n * disabled for navigation), mirroring React Aria's\n * `ListKeyboardDelegate.findNextNonDisabled`. `getFirstKey`/`getLastKey` and the\n * next/previous lookups all funnel through this so arrow keys, Home and End land\n * on enabled rows only.\n */\nfunction findNextNavigableKey<T extends object, C extends TreeCollection<T>>(\n state: TreeState<T, C>,\n startKey: Key | null,\n step: (key: Key) => Key | null,\n): Key | null {\n let key = startKey;\n while (key != null && isNavigationDisabled(state, key)) {\n key = step(key);\n }\n return key;\n}\n\n/**\n * Creates accessibility props for a tree.\n */\nexport function createTree<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(\n props: Accessor<AriaTreeProps>,\n state: Accessor<TreeState<T, C>>,\n ref: Accessor<HTMLDivElement | null>,\n): TreeAria {\n // Generate a unique ID for the tree\n const treeId = props().id ?? createId();\n\n // Store tree data for child components\n const treeData: TreeData = {\n treeId,\n get keyboardNavigationBehavior() {\n return props().keyboardNavigationBehavior ?? \"arrow\";\n },\n get direction() {\n return props().direction ?? \"ltr\";\n },\n actions: {\n get onAction() {\n return props().onAction;\n },\n },\n };\n\n // Store in WeakMap using the state as key\n treeDataMap.set(state(), treeData);\n\n // Handle keyboard navigation\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n const collection = s.collection;\n const focusedKey = s.focusedKey;\n const direction = p.direction ?? \"ltr\";\n // In RTL, ArrowLeft expands and ArrowRight collapses (opposite of LTR)\n const expandKey = direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n const collapseKey = direction === \"rtl\" ? \"ArrowRight\" : \"ArrowLeft\";\n\n if (p.isDisabled) return;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n const nextKey =\n focusedKey != null\n ? findNextNavigableKey(s, collection.getKeyAfter(focusedKey), (k) =>\n collection.getKeyAfter(k),\n )\n : findNextNavigableKey(s, collection.getFirstKey(), (k) => collection.getKeyAfter(k));\n if (nextKey != null) {\n s.setFocusedKey(nextKey);\n }\n break;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n const prevKey =\n focusedKey != null\n ? findNextNavigableKey(s, collection.getKeyBefore(focusedKey), (k) =>\n collection.getKeyBefore(k),\n )\n : findNextNavigableKey(s, collection.getLastKey(), (k) => collection.getKeyBefore(k));\n if (prevKey != null) {\n s.setFocusedKey(prevKey);\n }\n break;\n }\n case \"ArrowRight\":\n case \"ArrowLeft\": {\n e.preventDefault();\n if (focusedKey != null) {\n const node = collection.getItem(focusedKey);\n if (e.key === expandKey) {\n // Expand or move to first child\n if (node?.isExpandable) {\n if (!s.isExpanded(focusedKey)) {\n s.expandKey(focusedKey);\n } else {\n const children = [...collection.getChildren(focusedKey)];\n if (children.length > 0) {\n s.setFocusedKey(children[0].key);\n }\n }\n }\n } else if (e.key === collapseKey) {\n // Collapse or move to parent\n if (node?.isExpandable && s.isExpanded(focusedKey)) {\n s.collapseKey(focusedKey);\n } else if (node?.parentKey != null) {\n s.setFocusedKey(node.parentKey);\n }\n }\n }\n break;\n }\n case \"Home\": {\n e.preventDefault();\n const firstKey = findNextNavigableKey(s, collection.getFirstKey(), (k) =>\n collection.getKeyAfter(k),\n );\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n break;\n }\n case \"End\": {\n e.preventDefault();\n const lastKey = findNextNavigableKey(s, collection.getLastKey(), (k) =>\n collection.getKeyBefore(k),\n );\n if (lastKey != null) {\n s.setFocusedKey(lastKey);\n }\n break;\n }\n case \"a\":\n case \"A\": {\n if ((e.ctrlKey || e.metaKey) && s.selectionMode === \"multiple\") {\n e.preventDefault();\n s.selectAll();\n }\n break;\n }\n // Space (selection) and Enter (action) are intentionally absent here.\n // Upstream's useSelectableCollection leaves activation to useSelectableItem.\n // The focus effect below moves DOM focus onto the focused row, so the row's\n // own createSelectableItem handlers receive those keys without duplicating\n // work in the bubbling tree handler.\n case \"Escape\": {\n if (s.selectionMode !== \"none\") {\n e.preventDefault();\n s.clearSelection();\n }\n break;\n }\n case \"*\": {\n // Expand all siblings at current level\n e.preventDefault();\n if (focusedKey != null) {\n const node = collection.getItem(focusedKey);\n if (node) {\n // Find all siblings at the same level\n const parentKey = node.parentKey;\n let siblings: Key[];\n if (parentKey != null) {\n siblings = [...collection.getChildren(parentKey)].map((n) => n.key);\n } else {\n // Root level siblings\n siblings = collection.rows.filter((n) => n.level === 0).map((n) => n.key);\n }\n // Expand all expandable siblings\n for (const siblingKey of siblings) {\n const sibling = collection.getItem(siblingKey);\n if (sibling?.isExpandable && !s.isExpanded(siblingKey)) {\n s.expandKey(siblingKey);\n }\n }\n }\n }\n break;\n }\n }\n };\n\n // The first / last SELECTED key in flattened (visible) order — mirrors React\n // Aria's `SelectionManager.firstSelectedKey`/`lastSelectedKey`, which entry\n // focus prefers over the first/last row.\n const firstSelectedKey = (s: TreeState<T, C>): Key | null => {\n let key = s.collection.getFirstKey();\n while (key != null) {\n if (s.isSelected(key)) return key;\n key = s.collection.getKeyAfter(key);\n }\n return null;\n };\n const lastSelectedKey = (s: TreeState<T, C>): Key | null => {\n let key = s.collection.getLastKey();\n while (key != null) {\n if (s.isSelected(key)) return key;\n key = s.collection.getKeyBefore(key);\n }\n return null;\n };\n\n // Entry focus is handled on `focusin` (BUBBLING) rather than `focus`\n // (non-bubbling): React Aria's `useSelectableCollection.onFocus` bubbles, so a\n // Shift+Tab that the browser parks on a tabbable descendant (e.g. a selection\n // checkbox, which is `tabIndex=0` like upstream) still reaches the collection\n // and is redirected to the focused/selected row. A Solid non-bubbling `focus`\n // handler on the treegrid only fires for forward Tab (the container is the first\n // tab stop) and would strand backward entry on the last checkbox — the same\n // trampoline gotcha the TagGroup port hit. See `createListBox.onListBoxFocus`.\n const onFocusIn = (e: FocusEvent) => {\n const s = state();\n s.setFocused(true);\n\n const currentTarget = e.currentTarget as Element | null;\n const relatedTarget = e.relatedTarget as Element | null;\n // Internal roving moves (focus already inside the tree) are driven by\n // `onKeyDown`; only seed focus when it enters from OUTSIDE the treegrid.\n if (!currentTarget || (relatedTarget && currentTarget.contains(relatedTarget))) {\n return;\n }\n\n let key = s.focusedKey;\n if (key == null) {\n // Shift+Tab backward into the tree (focus arrived from a FOLLOWING element)\n // enters at the last selected row, else the last navigable row; forward Tab\n // enters at the first selected row, else the first navigable row.\n const backward =\n !!relatedTarget &&\n !!(\n currentTarget.compareDocumentPosition(relatedTarget) &\n Node.DOCUMENT_POSITION_FOLLOWING\n );\n key = backward\n ? (lastSelectedKey(s) ??\n findNextNavigableKey(s, s.collection.getLastKey(), (k) => s.collection.getKeyBefore(k)))\n : (firstSelectedKey(s) ??\n findNextNavigableKey(s, s.collection.getFirstKey(), (k) => s.collection.getKeyAfter(k)));\n }\n if (key != null) {\n s.setFocusedKey(key);\n }\n };\n\n const onFocusOut = (e: FocusEvent) => {\n const s = state();\n const currentTarget = e.currentTarget as Element | null;\n const relatedTarget = e.relatedTarget as Element | null;\n // Only clear the focused flag once focus has left the treegrid entirely.\n if (!currentTarget || !relatedTarget || !currentTarget.contains(relatedTarget)) {\n s.setFocused(false);\n }\n };\n\n createEffect(() => {\n const s = state();\n const key = s.focusedKey;\n const el = ref();\n if (!el || key == null) {\n return;\n }\n\n const active = document.activeElement;\n if (!active || (active !== el && !el.contains(active))) {\n return;\n }\n\n const target = el.querySelector<HTMLElement>(`[data-key=\"${key}\"]`);\n if (target && target !== active) {\n target.focus();\n\n if (getInteractionModality() !== \"pointer\") {\n scrollIntoViewport(target, { containingElement: el });\n }\n }\n });\n\n const treeProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n role: \"treegrid\",\n id: treeId,\n \"aria-label\": p[\"aria-label\"],\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-multiselectable\": s.selectionMode === \"multiple\" ? true : undefined,\n \"aria-disabled\": p.isDisabled || undefined,\n // Roving container tab stop: `0` while no row is focused (Tab enters the\n // tree), `-1` once a row takes focus (the row holds the tab stop). Mirrors\n // `useSelectableCollection` `tabIndex = focusedKey == null ? 0 : -1`.\n tabIndex: p.isDisabled ? undefined : s.focusedKey == null ? 0 : -1,\n onKeyDown,\n onFocusIn,\n onFocusOut,\n };\n\n // Add row count for virtualized trees\n if (p.isVirtualized) {\n baseProps[\"aria-rowcount\"] = s.collection.rowCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n return {\n get treeProps() {\n return treeProps();\n },\n };\n}\n","/**\n * createTreeItem - Provides accessibility for a tree item.\n * Based on @react-aria/tree/useTreeItem.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type {\n Collection,\n Key,\n Selection,\n TreeState,\n TreeCollection,\n} from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTreeItemProps, TreeItemAria } from \"./types\";\nimport { getTreeData } from \"./createTree\";\nimport { createSelectableItem, type SelectableItemState } from \"../selection/createSelectableItem\";\nimport { mergeCollectionRowInteractionProps } from \"../selection/createCollectionRowInteraction\";\nimport { mergeProps } from \"../utils/mergeProps\";\n\n/**\n * Creates accessibility props for a tree item.\n */\nexport function createTreeItem<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(\n props: Accessor<AriaTreeItemProps<T>>,\n state: Accessor<TreeState<T, C>>,\n ref: Accessor<HTMLElement | null>,\n): TreeItemAria {\n const fallbackRowId = createId();\n const expandButtonId = createId();\n\n const rowId = createMemo(() => {\n const treeData = getTreeData(state());\n return treeData ? `${treeData.treeId}-row-${String(props().node.key)}` : fallbackRowId;\n });\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.node.key);\n });\n\n const isExpanded = createMemo(() => {\n const s = state();\n const p = props();\n return s.isExpanded(p.node.key);\n });\n\n const isExpandable = createMemo(() => {\n const p = props();\n return p.node.isExpandable ?? false;\n });\n\n const level = createMemo(() => {\n const p = props();\n return p.node.level;\n });\n\n const selectableState: SelectableItemState<T> = {\n collection: () => state().collection as unknown as Collection<T>,\n isFocused: () => state().isFocused,\n setFocused: (focused: boolean) => state().setFocused(focused),\n focusedKey: () => state().focusedKey,\n childFocusStrategy: () => state().childFocusStrategy,\n setFocusedKey: (key: Key | null, strategy) => state().setFocusedKey(key, strategy),\n selectionMode: () => state().selectionMode,\n selectionBehavior: () => props().selectionBehavior ?? state().selectionBehavior,\n disallowEmptySelection: () => state().disallowEmptySelection,\n selectedKeys: () => state().selectedKeys as Selection,\n disabledKeys: () => state().disabledKeys,\n disabledBehavior: () => state().disabledBehavior,\n isEmpty: () => {\n const keys = state().selectedKeys;\n return keys !== \"all\" && keys.size === 0;\n },\n isSelectAll: () => state().selectedKeys === \"all\",\n isSelected: (key: Key) => state().isSelected(key),\n isDisabled: (key: Key) => {\n const s = state();\n const item = s.collection.getItem(key);\n return (\n s.disabledBehavior === \"all\" &&\n s.isDisabled(key) &&\n item?.props?.disabledBehavior !== \"selection\"\n );\n },\n canSelectItem: (key: Key) => {\n const s = state();\n return s.selectionMode !== \"none\" && !s.isDisabled(key);\n },\n setSelectionBehavior: (behavior) => state().setSelectionBehavior(behavior),\n toggleSelection: (key: Key) => state().toggleSelection(key),\n replaceSelection: (key: Key) => state().replaceSelection(key),\n setSelectedKeys: (keys: Iterable<Key>) => state().setSelectedKeys(keys),\n selectAll: () => state().selectAll(),\n clearSelection: () => state().clearSelection(),\n toggleSelectAll: () => state().toggleSelectAll(),\n extendSelection: (toKey: Key, _collection: Collection<T>) => state().extendSelection(toKey),\n };\n\n const selectableItem = createSelectableItem<T>(\n () => {\n const s = state();\n const p = props();\n const treeData = getTreeData(s);\n const treeAction = treeData?.actions.onAction;\n const shouldToggleOnAction =\n !treeAction && !p.onAction && s.selectionMode === \"none\" && isExpandable();\n\n return {\n key: p.node.key,\n id: rowId(),\n isVirtualized: p.isVirtualized,\n isDisabled: p.isDisabled,\n onAction:\n treeAction || p.onAction || shouldToggleOnAction\n ? () => {\n p.onAction?.();\n treeAction?.(p.node.key);\n if (shouldToggleOnAction) {\n s.toggleKey(p.node.key);\n }\n }\n : undefined,\n };\n },\n selectableState,\n ref,\n );\n\n // Compute sibling position (aria-posinset/aria-setsize)\n const siblingInfo = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const parentKey = node.parentKey;\n\n if (parentKey != null) {\n const parentNode = s.collection.getItem(parentKey);\n if (parentNode) {\n return {\n posinset: node.index + 1, // 1-based\n setsize: parentNode.childNodes.length,\n };\n }\n }\n\n // Root-level: count root nodes\n const rootNodes = s.collection.rows.filter((n) => n.level === 0);\n const rootIndex = rootNodes.findIndex((n) => n.key === node.key);\n return {\n posinset: rootIndex >= 0 ? rootIndex + 1 : node.index + 1,\n setsize: rootNodes.length,\n };\n });\n\n const rowProps = createMemo(() => {\n const p = props();\n const node = p.node;\n const { posinset, setsize } = siblingInfo();\n\n // Use textValue for aria-label (if available), or explicit textValue prop\n const textValue = p.textValue ?? node.textValue;\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n \"aria-label\": textValue || undefined,\n \"aria-selected\": selectableState.canSelectItem?.(node.key) ? isSelected() : undefined,\n \"aria-disabled\": selectableItem.isDisabled() || undefined,\n \"aria-expanded\": isExpandable() ? isExpanded() : undefined,\n \"aria-level\": node.level + 1, // 1-based for ARIA\n \"aria-posinset\": posinset,\n \"aria-setsize\": setsize,\n };\n\n // Add aria-rowindex for virtualized trees\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps[\"aria-rowindex\"] = node.rowIndex + 1; // 1-based\n }\n\n const treeData = getTreeData(state());\n const mergedProps = mergeProps<JSX.HTMLAttributes<HTMLDivElement>>(\n selectableItem.itemProps,\n baseProps,\n );\n\n return mergeCollectionRowInteractionProps(mergedProps, {\n ref,\n keyboardNavigationBehavior: () => treeData?.keyboardNavigationBehavior ?? \"arrow\",\n direction: () => treeData?.direction ?? \"ltr\",\n });\n });\n\n const gridCellProps = createMemo(() => {\n return {\n role: \"gridcell\",\n \"aria-colindex\": 1,\n } as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n // Expand button handler\n const onExpandClick = (e: MouseEvent) => {\n e.stopPropagation(); // Don't trigger row click\n const s = state();\n const p = props();\n\n if (selectableItem.isDisabled()) return;\n\n s.toggleKey(p.node.key);\n };\n\n const stopPointerPropagation = (e: Event) => {\n // Prevent row pointer handlers from flipping pressed state and re-rendering\n // before the button click handler can run.\n e.stopPropagation();\n };\n\n const expandButtonProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n type: \"button\",\n id: expandButtonId,\n \"aria-label\": isExpanded() ? \"Collapse\" : \"Expand\",\n \"aria-labelledby\": isExpandable() ? `${expandButtonId} ${rowId()}` : undefined,\n \"data-react-aria-prevent-focus\": true,\n onClick: onExpandClick,\n onPointerDown: stopPointerPropagation,\n onPointerUp: stopPointerPropagation,\n onMouseDown: stopPointerPropagation,\n onMouseUp: stopPointerPropagation,\n tabIndex: -1, // Not in tab order, use arrow keys\n \"aria-hidden\": !isExpandable() ? true : undefined,\n };\n\n return baseProps as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n get gridCellProps() {\n return gridCellProps();\n },\n get expandButtonProps() {\n return expandButtonProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return selectableItem.isDisabled();\n },\n get isPressed() {\n return selectableItem.isPressed();\n },\n get isExpanded() {\n return isExpanded();\n },\n get isExpandable() {\n return isExpandable();\n },\n get level() {\n return level();\n },\n };\n}\n","/**\n * createTreeSelectionCheckbox - Provides accessibility for a tree item's selection checkbox.\n * Based on @react-aria/gridlist/useGridListSelectionCheckbox.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TreeState, TreeCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTreeSelectionCheckboxProps, TreeSelectionCheckboxAria } from \"./types\";\nimport { getTreeData } from \"./createTree\";\n\n/**\n * Creates accessibility props for a tree selection checkbox.\n */\nexport function createTreeSelectionCheckbox<\n T extends object,\n C extends TreeCollection<T> = TreeCollection<T>,\n>(\n props: Accessor<AriaTreeSelectionCheckboxProps>,\n state: Accessor<TreeState<T, C>>,\n): TreeSelectionCheckboxAria {\n const fallbackRowId = createId();\n const checkboxId = createId();\n\n // Mirror @react-aria/tree getRowId: the checkbox's aria-labelledby folds its own\n // \"Select\" label with the row's id so the SR announces \"Select <row text>\".\n const rowId = createMemo(() => {\n const treeData = getTreeData(state());\n return treeData ? `${treeData.treeId}-row-${String(props().key)}` : fallbackRowId;\n });\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.key);\n });\n\n const onChange = (e: Event) => {\n const s = state();\n const p = props();\n const target = e.target as HTMLInputElement;\n\n if (isDisabled()) return;\n\n if (target.checked) {\n s.toggleSelection(p.key);\n } else {\n s.toggleSelection(p.key);\n }\n };\n\n const onClick = (e: MouseEvent) => {\n // Stop propagation to prevent row click from also firing\n e.stopPropagation();\n };\n\n const checkboxProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n type: \"checkbox\",\n id: checkboxId,\n \"aria-label\": \"Select\",\n \"aria-labelledby\": `${checkboxId} ${rowId()}`,\n checked: isSelected(),\n disabled: isDisabled(),\n onChange,\n onClick,\n };\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAM,8BAAc,IAAI,QAA0B;;;;AAKlD,SAAgB,YACd,OACsB;CACtB,OAAO,YAAY,IAAI,KAAK;AAC9B;;;;;;;AAQA,SAAS,qBACP,OACA,KACS;CACT,OAAO,MAAM,WAAW,GAAG,KAAK,MAAM,qBAAqB;AAC7D;;;;;;;;AASA,SAAS,qBACP,OACA,UACA,MACY;CACZ,IAAI,MAAM;CACV,OAAO,OAAO,QAAQ,qBAAqB,OAAO,GAAG,GACnD,MAAM,KAAK,GAAG;CAEhB,OAAO;AACT;;;;AAKA,SAAgB,WACd,OACA,OACA,KACU;CAEV,MAAM,SAAS,MAAM,CAAC,CAAC,MAAM,SAAS;CAGtC,MAAM,WAAqB;EACzB;EACA,IAAI,6BAA6B;GAC/B,OAAO,MAAM,CAAC,CAAC,8BAA8B;EAC/C;EACA,IAAI,YAAY;GACd,OAAO,MAAM,CAAC,CAAC,aAAa;EAC9B;EACA,SAAS,EACP,IAAI,WAAW;GACb,OAAO,MAAM,CAAC,CAAC;EACjB,EACF;CACF;CAGA,YAAY,IAAI,MAAM,GAAG,QAAQ;CAGjC,MAAM,aAAa,MAAqB;EACtC,MAAM,IAAI,MAAM;EAChB,MAAM,IAAI,MAAM;EAChB,MAAM,aAAa,EAAE;EACrB,MAAM,aAAa,EAAE;EACrB,MAAM,YAAY,EAAE,aAAa;EAEjC,MAAM,YAAY,cAAc,QAAQ,cAAc;EACtD,MAAM,cAAc,cAAc,QAAQ,eAAe;EAEzD,IAAI,EAAE,YAAY;EAElB,QAAQ,EAAE,KAAV;GACE,KAAK,aAAa;IAChB,EAAE,eAAe;IACjB,MA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;;;;;;;;;AC3PA,SAAgB,4BAId,OACA,OAC2B;CAC3B,MAAM,gBAAgB,SAAS;CAC/B,MAAM,aAAa,SAAS;CAI5B,MAAM,QAAQ,iBAAiB;EAC7B,MAAM,WAAW,YAAY,MAAM,CAAC;EACpC,OAAO,WAAW,GAAG,SAAS,OAAO,OAAO,OAAO,MAAM,CAAC,CAAC,GAAG,MAAM;CACtE,CAAC;CAED,MAAM,aAAa,iBAAiB;EAClC,MAAM,IAAI,MAAM;EAChB,MAAM,IAAI,MAAM;EAChB,OAAO,EAAE,WAAW,EAAE,GAAG;CAC3B,CAAC;CAED,MAAM,aAAa,iBAAiB;EAClC,MAAM,IAAI,MAAM;EAChB,MAAM,IAAI,MAAM;EAChB,OAAO,EAAE,WAAW,EAAE,GAAG;CAC3B,CAAC;CAED,MAAM,YAAY,MAAa;EAC7B,MAAM,IAAI,MAAM;EAChB,MAAM,IAAI,MAAM;EAChB,MAAM,SAAS,EAAE;EAEjB,IAAI,WAAW,GAAG;EAElB,IAAI,OAAO,SACT,EAAE,gBAAgB,EAAE,GAAG;OAEvB,EAAE,gBAAgB,EAAE,GAAG;CAE3B;CAEA,MAAM,WAAW,MAAkB;EAEjC,EAAE,gBAAgB;CACpB;CAEA,MAAM,gBAAgB,iBAAiB;EAYrC,OAAO;GAVL,MAAM;GACN,IAAI;GACJ,cAAc;GACd,mBAAmB,GAAG,WAAW,GAAG,MAAM;GAC1C,SAAS,WAAW;GACpB,UAAU,WAAW;GACrB;GACA;EAGa;CACjB,CAAC;CAED,OAAO,EACL,IAAI,gBAAgB;EAClB,OAAO,cAAc;CACvB,EACF;AACF"}
1
+ {"version":3,"file":"tree.js","names":["mergeProps"],"sources":["../../src/tree/createTree.ts","../../src/tree/createTreeItem.ts","../../src/tree/createTreeSelectionCheckbox.ts"],"sourcesContent":["/**\n * createTree - Provides accessibility for a tree component.\n * Based on @react-aria/tree/useTree.\n */\n\nimport { createEffect, createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TreeState, TreeCollection, Key } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTreeProps, TreeAria } from \"./types\";\nimport { scrollIntoViewport } from \"../utils\";\nimport { getInteractionModality } from \"../interactions/createInteractionModality\";\n\n/**\n * Metadata stored for a tree instance.\n */\ninterface TreeData {\n /** The generated ID for the tree. */\n treeId: string;\n /** How keyboard navigation behaves within row children. */\n keyboardNavigationBehavior: \"arrow\" | \"tab\";\n /** Text direction for row-child arrow navigation and tree expansion keys. */\n direction: \"ltr\" | \"rtl\";\n /** Actions registered for the tree. */\n actions: {\n onAction?: (key: Key) => void;\n };\n}\n\n/**\n * WeakMap to store tree data for child components to access.\n */\nconst treeDataMap = new WeakMap<object, TreeData>();\n\n/**\n * Gets the tree data for a given state.\n */\nexport function getTreeData<T extends object, C extends TreeCollection<T>>(\n state: TreeState<T, C>,\n): TreeData | undefined {\n return treeDataMap.get(state);\n}\n\n/**\n * Whether a key should be skipped during keyboard navigation. Disabled keys only\n * block navigation under `disabledBehavior: \"all\"` (the default); under\n * `\"selection\"` they remain focusable (selection is still blocked elsewhere).\n * Mirrors `ListKeyboardDelegate.isDisabled` in React Aria.\n */\nfunction isNavigationDisabled<T extends object, C extends TreeCollection<T>>(\n state: TreeState<T, C>,\n key: Key,\n): boolean {\n return state.isDisabled(key) && state.disabledBehavior === \"all\";\n}\n\n/**\n * Walks from `startKey` via `step` until reaching a key that is navigable (not\n * disabled for navigation), mirroring React Aria's\n * `ListKeyboardDelegate.findNextNonDisabled`. `getFirstKey`/`getLastKey` and the\n * next/previous lookups all funnel through this so arrow keys, Home and End land\n * on enabled rows only.\n */\nfunction findNextNavigableKey<T extends object, C extends TreeCollection<T>>(\n state: TreeState<T, C>,\n startKey: Key | null,\n step: (key: Key) => Key | null,\n): Key | null {\n let key = startKey;\n while (key != null && isNavigationDisabled(state, key)) {\n key = step(key);\n }\n return key;\n}\n\n/**\n * Creates accessibility props for a tree.\n */\nexport function createTree<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(\n props: Accessor<AriaTreeProps>,\n state: Accessor<TreeState<T, C>>,\n ref: Accessor<HTMLDivElement | null>,\n): TreeAria {\n // Generate a unique ID for the tree\n const treeId = props().id ?? createId();\n\n // Store tree data for child components\n const treeData: TreeData = {\n treeId,\n get keyboardNavigationBehavior() {\n return props().keyboardNavigationBehavior ?? \"arrow\";\n },\n get direction() {\n return props().direction ?? \"ltr\";\n },\n actions: {\n get onAction() {\n return props().onAction;\n },\n },\n };\n\n // Store in WeakMap using the state as key\n treeDataMap.set(state(), treeData);\n\n // Handle keyboard navigation\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n const collection = s.collection;\n const focusedKey = s.focusedKey;\n const direction = p.direction ?? \"ltr\";\n // In RTL, ArrowLeft expands and ArrowRight collapses (opposite of LTR)\n const expandKey = direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n const collapseKey = direction === \"rtl\" ? \"ArrowRight\" : \"ArrowLeft\";\n\n if (p.isDisabled) return;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n const nextKey =\n focusedKey != null\n ? findNextNavigableKey(s, collection.getKeyAfter(focusedKey), (k) =>\n collection.getKeyAfter(k),\n )\n : findNextNavigableKey(s, collection.getFirstKey(), (k) => collection.getKeyAfter(k));\n if (nextKey != null) {\n s.setFocusedKey(nextKey);\n }\n break;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n const prevKey =\n focusedKey != null\n ? findNextNavigableKey(s, collection.getKeyBefore(focusedKey), (k) =>\n collection.getKeyBefore(k),\n )\n : findNextNavigableKey(s, collection.getLastKey(), (k) => collection.getKeyBefore(k));\n if (prevKey != null) {\n s.setFocusedKey(prevKey);\n }\n break;\n }\n case \"ArrowRight\":\n case \"ArrowLeft\": {\n e.preventDefault();\n if (focusedKey != null) {\n const node = collection.getItem(focusedKey);\n if (e.key === expandKey) {\n // Expand or move to first child\n if (node?.isExpandable) {\n if (!s.isExpanded(focusedKey)) {\n s.expandKey(focusedKey);\n } else {\n const children = [...collection.getChildren(focusedKey)];\n if (children.length > 0) {\n s.setFocusedKey(children[0].key);\n }\n }\n }\n } else if (e.key === collapseKey) {\n // Collapse or move to parent\n if (node?.isExpandable && s.isExpanded(focusedKey)) {\n s.collapseKey(focusedKey);\n } else if (node?.parentKey != null) {\n s.setFocusedKey(node.parentKey);\n }\n }\n }\n break;\n }\n case \"Home\": {\n e.preventDefault();\n const firstKey = findNextNavigableKey(s, collection.getFirstKey(), (k) =>\n collection.getKeyAfter(k),\n );\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n break;\n }\n case \"End\": {\n e.preventDefault();\n const lastKey = findNextNavigableKey(s, collection.getLastKey(), (k) =>\n collection.getKeyBefore(k),\n );\n if (lastKey != null) {\n s.setFocusedKey(lastKey);\n }\n break;\n }\n case \"a\":\n case \"A\": {\n if ((e.ctrlKey || e.metaKey) && s.selectionMode === \"multiple\") {\n e.preventDefault();\n s.selectAll();\n }\n break;\n }\n // Space (selection) and Enter (action) are intentionally absent here.\n // Upstream's useSelectableCollection leaves activation to useSelectableItem.\n // The focus effect below moves DOM focus onto the focused row, so the row's\n // own createSelectableItem handlers receive those keys without duplicating\n // work in the bubbling tree handler.\n case \"Escape\": {\n if (s.selectionMode !== \"none\") {\n e.preventDefault();\n s.clearSelection();\n }\n break;\n }\n case \"*\": {\n // Expand all siblings at current level\n e.preventDefault();\n if (focusedKey != null) {\n const node = collection.getItem(focusedKey);\n if (node) {\n // Find all siblings at the same level\n const parentKey = node.parentKey;\n let siblings: Key[];\n if (parentKey != null) {\n siblings = [...collection.getChildren(parentKey)].map((n) => n.key);\n } else {\n // Root level siblings\n siblings = collection.rows.filter((n) => n.level === 0).map((n) => n.key);\n }\n // Expand all expandable siblings\n for (const siblingKey of siblings) {\n const sibling = collection.getItem(siblingKey);\n if (sibling?.isExpandable && !s.isExpanded(siblingKey)) {\n s.expandKey(siblingKey);\n }\n }\n }\n }\n break;\n }\n }\n };\n\n // The first / last SELECTED key in flattened (visible) order — mirrors React\n // Aria's `SelectionManager.firstSelectedKey`/`lastSelectedKey`, which entry\n // focus prefers over the first/last row.\n const firstSelectedKey = (s: TreeState<T, C>): Key | null => {\n let key = s.collection.getFirstKey();\n while (key != null) {\n if (s.isSelected(key)) return key;\n key = s.collection.getKeyAfter(key);\n }\n return null;\n };\n const lastSelectedKey = (s: TreeState<T, C>): Key | null => {\n let key = s.collection.getLastKey();\n while (key != null) {\n if (s.isSelected(key)) return key;\n key = s.collection.getKeyBefore(key);\n }\n return null;\n };\n\n // Entry focus is handled on `focusin` (BUBBLING) rather than `focus`\n // (non-bubbling): React Aria's `useSelectableCollection.onFocus` bubbles, so a\n // Shift+Tab that the browser parks on a tabbable descendant (e.g. a selection\n // checkbox, which is `tabIndex=0` like upstream) still reaches the collection\n // and is redirected to the focused/selected row. A Solid non-bubbling `focus`\n // handler on the treegrid only fires for forward Tab (the container is the first\n // tab stop) and would strand backward entry on the last checkbox — the same\n // trampoline gotcha the TagGroup port hit. See `createListBox.onListBoxFocus`.\n const onFocusIn = (e: FocusEvent) => {\n const s = state();\n s.setFocused(true);\n\n const currentTarget = e.currentTarget as Element | null;\n const relatedTarget = e.relatedTarget as Element | null;\n // Internal roving moves (focus already inside the tree) are driven by\n // `onKeyDown`; only seed focus when it enters from OUTSIDE the treegrid.\n if (!currentTarget || (relatedTarget && currentTarget.contains(relatedTarget))) {\n return;\n }\n\n let key = s.focusedKey;\n if (key == null) {\n // Shift+Tab backward into the tree (focus arrived from a FOLLOWING element)\n // enters at the last selected row, else the last navigable row; forward Tab\n // enters at the first selected row, else the first navigable row.\n const backward =\n !!relatedTarget &&\n !!(currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING);\n key = backward\n ? (lastSelectedKey(s) ??\n findNextNavigableKey(s, s.collection.getLastKey(), (k) => s.collection.getKeyBefore(k)))\n : (firstSelectedKey(s) ??\n findNextNavigableKey(s, s.collection.getFirstKey(), (k) => s.collection.getKeyAfter(k)));\n }\n if (key != null) {\n s.setFocusedKey(key);\n }\n };\n\n const onFocusOut = (e: FocusEvent) => {\n const s = state();\n const currentTarget = e.currentTarget as Element | null;\n const relatedTarget = e.relatedTarget as Element | null;\n // Only clear the focused flag once focus has left the treegrid entirely.\n if (!currentTarget || !relatedTarget || !currentTarget.contains(relatedTarget)) {\n s.setFocused(false);\n }\n };\n\n createEffect(() => {\n const s = state();\n const key = s.focusedKey;\n const el = ref();\n if (!el || key == null) {\n return;\n }\n\n const active = document.activeElement;\n if (!active || (active !== el && !el.contains(active))) {\n return;\n }\n\n const target = el.querySelector<HTMLElement>(`[data-key=\"${key}\"]`);\n if (target && target !== active) {\n target.focus();\n\n if (getInteractionModality() !== \"pointer\") {\n scrollIntoViewport(target, { containingElement: el });\n }\n }\n });\n\n const treeProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n role: \"treegrid\",\n id: treeId,\n \"aria-label\": p[\"aria-label\"],\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-multiselectable\": s.selectionMode === \"multiple\" ? true : undefined,\n \"aria-disabled\": p.isDisabled || undefined,\n // Roving container tab stop: `0` while no row is focused (Tab enters the\n // tree), `-1` once a row takes focus (the row holds the tab stop). Mirrors\n // `useSelectableCollection` `tabIndex = focusedKey == null ? 0 : -1`.\n tabIndex: p.isDisabled ? undefined : s.focusedKey == null ? 0 : -1,\n onKeyDown,\n onFocusIn,\n onFocusOut,\n };\n\n // Add row count for virtualized trees\n if (p.isVirtualized) {\n baseProps[\"aria-rowcount\"] = s.collection.rowCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n return {\n get treeProps() {\n return treeProps();\n },\n };\n}\n","/**\n * createTreeItem - Provides accessibility for a tree item.\n * Based on @react-aria/tree/useTreeItem.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type {\n Collection,\n Key,\n Selection,\n TreeState,\n TreeCollection,\n} from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTreeItemProps, TreeItemAria } from \"./types\";\nimport { getTreeData } from \"./createTree\";\nimport { createSelectableItem, type SelectableItemState } from \"../selection/createSelectableItem\";\nimport { mergeCollectionRowInteractionProps } from \"../selection/createCollectionRowInteraction\";\nimport { mergeProps } from \"../utils/mergeProps\";\n\n/**\n * Creates accessibility props for a tree item.\n */\nexport function createTreeItem<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(\n props: Accessor<AriaTreeItemProps<T>>,\n state: Accessor<TreeState<T, C>>,\n ref: Accessor<HTMLElement | null>,\n): TreeItemAria {\n const fallbackRowId = createId();\n const expandButtonId = createId();\n\n const rowId = createMemo(() => {\n const treeData = getTreeData(state());\n return treeData ? `${treeData.treeId}-row-${String(props().node.key)}` : fallbackRowId;\n });\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.node.key);\n });\n\n const isExpanded = createMemo(() => {\n const s = state();\n const p = props();\n return s.isExpanded(p.node.key);\n });\n\n const isExpandable = createMemo(() => {\n const p = props();\n return p.node.isExpandable ?? false;\n });\n\n const level = createMemo(() => {\n const p = props();\n return p.node.level;\n });\n\n const selectableState: SelectableItemState<T> = {\n collection: () => state().collection as unknown as Collection<T>,\n isFocused: () => state().isFocused,\n setFocused: (focused: boolean) => state().setFocused(focused),\n focusedKey: () => state().focusedKey,\n childFocusStrategy: () => state().childFocusStrategy,\n setFocusedKey: (key: Key | null, strategy) => state().setFocusedKey(key, strategy),\n selectionMode: () => state().selectionMode,\n selectionBehavior: () => props().selectionBehavior ?? state().selectionBehavior,\n disallowEmptySelection: () => state().disallowEmptySelection,\n selectedKeys: () => state().selectedKeys as Selection,\n disabledKeys: () => state().disabledKeys,\n disabledBehavior: () => state().disabledBehavior,\n isEmpty: () => {\n const keys = state().selectedKeys;\n return keys !== \"all\" && keys.size === 0;\n },\n isSelectAll: () => state().selectedKeys === \"all\",\n isSelected: (key: Key) => state().isSelected(key),\n isDisabled: (key: Key) => {\n const s = state();\n const item = s.collection.getItem(key);\n return (\n s.disabledBehavior === \"all\" &&\n s.isDisabled(key) &&\n item?.props?.disabledBehavior !== \"selection\"\n );\n },\n canSelectItem: (key: Key) => {\n const s = state();\n return s.selectionMode !== \"none\" && !s.isDisabled(key);\n },\n setSelectionBehavior: (behavior) => state().setSelectionBehavior(behavior),\n toggleSelection: (key: Key) => state().toggleSelection(key),\n replaceSelection: (key: Key) => state().replaceSelection(key),\n setSelectedKeys: (keys: Iterable<Key>) => state().setSelectedKeys(keys),\n selectAll: () => state().selectAll(),\n clearSelection: () => state().clearSelection(),\n toggleSelectAll: () => state().toggleSelectAll(),\n extendSelection: (toKey: Key, _collection: Collection<T>) => state().extendSelection(toKey),\n };\n\n const selectableItem = createSelectableItem<T>(\n () => {\n const s = state();\n const p = props();\n const treeData = getTreeData(s);\n const treeAction = treeData?.actions.onAction;\n const shouldToggleOnAction =\n !treeAction && !p.onAction && s.selectionMode === \"none\" && isExpandable();\n\n return {\n key: p.node.key,\n id: rowId(),\n isVirtualized: p.isVirtualized,\n isDisabled: p.isDisabled,\n onAction:\n treeAction || p.onAction || shouldToggleOnAction\n ? () => {\n p.onAction?.();\n treeAction?.(p.node.key);\n if (shouldToggleOnAction) {\n s.toggleKey(p.node.key);\n }\n }\n : undefined,\n };\n },\n selectableState,\n ref,\n );\n\n // Compute sibling position (aria-posinset/aria-setsize)\n const siblingInfo = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const parentKey = node.parentKey;\n\n if (parentKey != null) {\n const parentNode = s.collection.getItem(parentKey);\n if (parentNode) {\n return {\n posinset: node.index + 1, // 1-based\n setsize: parentNode.childNodes.length,\n };\n }\n }\n\n // Root-level: count root nodes\n const rootNodes = s.collection.rows.filter((n) => n.level === 0);\n const rootIndex = rootNodes.findIndex((n) => n.key === node.key);\n return {\n posinset: rootIndex >= 0 ? rootIndex + 1 : node.index + 1,\n setsize: rootNodes.length,\n };\n });\n\n const rowProps = createMemo(() => {\n const p = props();\n const node = p.node;\n const { posinset, setsize } = siblingInfo();\n\n // Use textValue for aria-label (if available), or explicit textValue prop\n const textValue = p.textValue ?? node.textValue;\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n \"aria-label\": textValue || undefined,\n \"aria-selected\": selectableState.canSelectItem?.(node.key) ? isSelected() : undefined,\n \"aria-disabled\": selectableItem.isDisabled() || undefined,\n \"aria-expanded\": isExpandable() ? isExpanded() : undefined,\n \"aria-level\": node.level + 1, // 1-based for ARIA\n \"aria-posinset\": posinset,\n \"aria-setsize\": setsize,\n };\n\n // Add aria-rowindex for virtualized trees\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps[\"aria-rowindex\"] = node.rowIndex + 1; // 1-based\n }\n\n const treeData = getTreeData(state());\n const mergedProps = mergeProps<JSX.HTMLAttributes<HTMLDivElement>>(\n selectableItem.itemProps,\n baseProps,\n );\n\n return mergeCollectionRowInteractionProps(mergedProps, {\n ref,\n keyboardNavigationBehavior: () => treeData?.keyboardNavigationBehavior ?? \"arrow\",\n direction: () => treeData?.direction ?? \"ltr\",\n });\n });\n\n const gridCellProps = createMemo(() => {\n return {\n role: \"gridcell\",\n \"aria-colindex\": 1,\n } as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n // Expand button handler\n const onExpandClick = (e: MouseEvent) => {\n e.stopPropagation(); // Don't trigger row click\n const s = state();\n const p = props();\n\n if (selectableItem.isDisabled()) return;\n\n s.toggleKey(p.node.key);\n };\n\n const stopPointerPropagation = (e: Event) => {\n // Prevent row pointer handlers from flipping pressed state and re-rendering\n // before the button click handler can run.\n e.stopPropagation();\n };\n\n const expandButtonProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n type: \"button\",\n id: expandButtonId,\n \"aria-label\": isExpanded() ? \"Collapse\" : \"Expand\",\n \"aria-labelledby\": isExpandable() ? `${expandButtonId} ${rowId()}` : undefined,\n \"data-react-aria-prevent-focus\": true,\n onClick: onExpandClick,\n onPointerDown: stopPointerPropagation,\n onPointerUp: stopPointerPropagation,\n onMouseDown: stopPointerPropagation,\n onMouseUp: stopPointerPropagation,\n tabIndex: -1, // Not in tab order, use arrow keys\n \"aria-hidden\": !isExpandable() ? true : undefined,\n };\n\n return baseProps as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n get gridCellProps() {\n return gridCellProps();\n },\n get expandButtonProps() {\n return expandButtonProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return selectableItem.isDisabled();\n },\n get isPressed() {\n return selectableItem.isPressed();\n },\n get isExpanded() {\n return isExpanded();\n },\n get isExpandable() {\n return isExpandable();\n },\n get level() {\n return level();\n },\n };\n}\n","/**\n * createTreeSelectionCheckbox - Provides accessibility for a tree item's selection checkbox.\n * Based on @react-aria/gridlist/useGridListSelectionCheckbox.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TreeState, TreeCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTreeSelectionCheckboxProps, TreeSelectionCheckboxAria } from \"./types\";\nimport { getTreeData } from \"./createTree\";\n\n/**\n * Creates accessibility props for a tree selection checkbox.\n */\nexport function createTreeSelectionCheckbox<\n T extends object,\n C extends TreeCollection<T> = TreeCollection<T>,\n>(\n props: Accessor<AriaTreeSelectionCheckboxProps>,\n state: Accessor<TreeState<T, C>>,\n): TreeSelectionCheckboxAria {\n const fallbackRowId = createId();\n const checkboxId = createId();\n\n // Mirror @react-aria/tree getRowId: the checkbox's aria-labelledby folds its own\n // \"Select\" label with the row's id so the SR announces \"Select <row text>\".\n const rowId = createMemo(() => {\n const treeData = getTreeData(state());\n return treeData ? `${treeData.treeId}-row-${String(props().key)}` : fallbackRowId;\n });\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.key);\n });\n\n const onChange = (e: Event) => {\n const s = state();\n const p = props();\n const target = e.target as HTMLInputElement;\n\n if (isDisabled()) return;\n\n if (target.checked) {\n s.toggleSelection(p.key);\n } else {\n s.toggleSelection(p.key);\n }\n };\n\n const onClick = (e: MouseEvent) => {\n // Stop propagation to prevent row click from also firing\n e.stopPropagation();\n };\n\n const checkboxProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n type: \"checkbox\",\n id: checkboxId,\n \"aria-label\": \"Select\",\n \"aria-labelledby\": `${checkboxId} ${rowId()}`,\n checked: isSelected(),\n disabled: isDisabled(),\n onChange,\n onClick,\n };\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAM,8BAAc,IAAI,QAA0B;;;;AAKlD,SAAgB,YACd,OACsB;CACtB,OAAO,YAAY,IAAI,KAAK;AAC9B;;;;;;;AAQA,SAAS,qBACP,OACA,KACS;CACT,OAAO,MAAM,WAAW,GAAG,KAAK,MAAM,qBAAqB;AAC7D;;;;;;;;AASA,SAAS,qBACP,OACA,UACA,MACY;CACZ,IAAI,MAAM;CACV,OAAO,OAAO,QAAQ,qBAAqB,OAAO,GAAG,GACnD,MAAM,KAAK,GAAG;CAEhB,OAAO;AACT;;;;AAKA,SAAgB,WACd,OACA,OACA,KACU;CAEV,MAAM,SAAS,MAAM,CAAC,CAAC,MAAM,SAAS;CAGtC,MAAM,WAAqB;EACzB;EACA,IAAI,6BAA6B;GAC/B,OAAO,MAAM,CAAC,CAAC,8BAA8B;EAC/C;EACA,IAAI,YAAY;GACd,OAAO,MAAM,CAAC,CAAC,aAAa;EAC9B;EACA,SAAS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