@chassis-ui/react 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alert.js +1 -1
- package/dist/avatar.js +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/card.js +1 -1
- package/dist/chunks/Link-DyZyAQFj.js +2 -0
- package/dist/chunks/Link-DyZyAQFj.js.map +1 -0
- package/dist/chunks/{MenuToggle-BdQtF7FV.js → MenuToggle-7RQ0dmtZ.js} +2 -2
- package/dist/chunks/{MenuToggle-BdQtF7FV.js.map → MenuToggle-7RQ0dmtZ.js.map} +1 -1
- package/dist/chunks/alert-3kTBfWFw.js +2 -0
- package/dist/chunks/{alert-BXI-_qlt.js.map → alert-3kTBfWFw.js.map} +1 -1
- package/dist/chunks/{avatar-S3dGy6Qc.js → avatar-MklqAKcz.js} +2 -2
- package/dist/chunks/{avatar-S3dGy6Qc.js.map → avatar-MklqAKcz.js.map} +1 -1
- package/dist/chunks/{breadcrumb-s6J9itez.js → breadcrumb-CHxTiZLt.js} +2 -2
- package/dist/chunks/{breadcrumb-s6J9itez.js.map → breadcrumb-CHxTiZLt.js.map} +1 -1
- package/dist/chunks/{card-CobeDpf1.js → card-CTP9K8xG.js} +2 -2
- package/dist/chunks/{card-CobeDpf1.js.map → card-CTP9K8xG.js.map} +1 -1
- package/dist/chunks/colorClassNames-CEh5Yzfp.js +2 -0
- package/dist/chunks/colorClassNames-CEh5Yzfp.js.map +1 -0
- package/dist/chunks/datagrid-DOYxx0sF.js +3 -0
- package/dist/chunks/datagrid-DOYxx0sF.js.map +1 -0
- package/dist/chunks/{index-B5bF1JxF.d.ts → index-Dzga1f4w.d.ts} +2 -2
- package/dist/chunks/{list-BQCkwWjF.js → list-07e2a1Ym.js} +2 -2
- package/dist/chunks/{list-BQCkwWjF.js.map → list-07e2a1Ym.js.map} +1 -1
- package/dist/chunks/{menu-98EAD9nj.js → menu-Upf6P-2P.js} +2 -2
- package/dist/chunks/{menu-98EAD9nj.js.map → menu-Upf6P-2P.js.map} +1 -1
- package/dist/chunks/{nav-TiZuTHC6.js → nav-DI6oEULI.js} +2 -2
- package/dist/chunks/{nav-TiZuTHC6.js.map → nav-DI6oEULI.js.map} +1 -1
- package/dist/chunks/{nav-overflow-Ay5mM5Gc.js → nav-overflow-DlLer6EK.js} +2 -2
- package/dist/chunks/{nav-overflow-Ay5mM5Gc.js.map → nav-overflow-DlLer6EK.js.map} +1 -1
- package/dist/chunks/pagination-BREQp-ZC.js +2 -0
- package/dist/chunks/{pagination-BkOquk-x.js.map → pagination-BREQp-ZC.js.map} +1 -1
- package/dist/chunks/placeholder-DhNpUJqv.js +2 -0
- package/dist/chunks/placeholder-DhNpUJqv.js.map +1 -0
- package/dist/chunks/progress-BqgWezdG.js +2 -0
- package/dist/chunks/progress-BqgWezdG.js.map +1 -0
- package/dist/chunks/skeleton-Bjv9gGd3.js +2 -0
- package/dist/chunks/skeleton-Bjv9gGd3.js.map +1 -0
- package/dist/chunks/spinner-DBuvQvMR.js +2 -0
- package/dist/chunks/spinner-DBuvQvMR.js.map +1 -0
- package/dist/chunks/static-table-uu297Liz.js +2 -0
- package/dist/chunks/{static-table-D0M4oc_t.js.map → static-table-uu297Liz.js.map} +1 -1
- package/dist/chunks/{table-Cy6uEuEP.js → table-DPLOygg0.js} +2 -2
- package/dist/chunks/{table-Cy6uEuEP.js.map → table-DPLOygg0.js.map} +1 -1
- package/dist/chunks/tableClassName-DleBjOj2.js +2 -0
- package/dist/chunks/tableClassName-DleBjOj2.js.map +1 -0
- package/dist/datagrid.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/link.js +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/nav-overflow.js +1 -1
- package/dist/nav.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/placeholder.js +1 -1
- package/dist/progress.js +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/spinner.d.ts +1 -1
- package/dist/spinner.js +1 -1
- package/dist/static-table.js +1 -1
- package/dist/table.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/Link-CZsWCnQb.js +0 -2
- package/dist/chunks/Link-CZsWCnQb.js.map +0 -1
- package/dist/chunks/alert-BXI-_qlt.js +0 -2
- package/dist/chunks/datagrid-CH3Cy-q7.js +0 -3
- package/dist/chunks/datagrid-CH3Cy-q7.js.map +0 -1
- package/dist/chunks/pagination-BkOquk-x.js +0 -2
- package/dist/chunks/placeholder-BCr83sUn.js +0 -2
- package/dist/chunks/placeholder-BCr83sUn.js.map +0 -1
- package/dist/chunks/progress-zWkTltor.js +0 -2
- package/dist/chunks/progress-zWkTltor.js.map +0 -1
- package/dist/chunks/skeleton-CmZBLJwp.js +0 -2
- package/dist/chunks/skeleton-CmZBLJwp.js.map +0 -1
- package/dist/chunks/spinner-DblhvrHL.js +0 -2
- package/dist/chunks/spinner-DblhvrHL.js.map +0 -1
- package/dist/chunks/static-table-D0M4oc_t.js +0 -2
- package/dist/chunks/tableClassName-CZA2Bse8.js +0 -2
- package/dist/chunks/tableClassName-CZA2Bse8.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-Cy6uEuEP.js","names":["TableRow","TableCell","TableBody","StatelyTableBody","TableHeader","StatelyTableHeader"],"sources":["../../src/components/table/Table.tsx","../../src/components/table/TableBody.tsx","../../src/components/table/TableCell.tsx","../../src/components/table/TableColumn.tsx","../../src/components/table/TableHeader.tsx","../../src/components/table/TableRow.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode, Ref, forwardRef, useRef } from 'react'\nimport classNames from 'classnames'\nimport {\n AriaCheckboxProps,\n Key,\n useCheckbox,\n useTable,\n useTableCell,\n useTableColumnHeader,\n useTableHeaderRow,\n useTableRow,\n useTableRowGroup,\n useTableSelectAllCheckbox,\n useTableSelectionCheckbox\n} from 'react-aria'\nimport {\n Selection,\n SortDescriptor,\n TableBodyProps,\n TableHeaderProps,\n TableState,\n useTableState,\n useToggleState\n} from 'react-stately'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { ContextColor } from '../../types'\nimport { tableClassName, tableWrapperClassName } from '../../utils/tableClassName'\nimport './Table.css'\n\n// `GridNode<T>` (from `@react-types/shared`) isn't re-exported by either package's public\n// surface — derived from the hooks' own parameter types instead of adding an undeclared\n// dependency on react-aria/react-stately's shared internals package.\ntype ColumnNode<T> = Parameters<typeof useTableColumnHeader<T>>[0]['node']\ntype RowNode<T> = Parameters<typeof useTableRow<T>>[0]['node']\ntype CellNode<T> = Parameters<typeof useTableCell<T>>[0]['node']\n\nexport interface TableProps<T extends object> {\n /**\n * An accessible label for the table, used when there's no visible heading.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible heading element for the table.\n */\n 'aria-labelledby'?: string\n /**\n * Set the vertical alignment of cell content.\n */\n align?: 'bottom' | 'middle' | 'top'\n /**\n * Add borders on all sides of the table and cells.\n */\n bordered?: boolean\n /**\n * Remove borders on all sides of the table and cells.\n */\n borderless?: boolean\n /**\n * Content shown above the table, functioning as a heading for it.\n */\n caption?: ReactNode\n /**\n * A `TableHeader` and a `TableBody`, each built from `TableColumn`/`TableRow`/\n * `TableCell` — read as data to build the table's collection. Not rendered directly.\n */\n children: [\n ReactElement<TableHeaderProps<T> & { className?: string }>,\n ReactElement<TableBodyProps<T> & { className?: string }>\n ]\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component.\n */\n color?: ContextColor\n /**\n * A list of row keys to disable. Disabled rows cannot be selected, focused, or interacted with.\n */\n disabledKeys?: Iterable<Key>\n /**\n * Content shown below the table in a `<tfoot>`, e.g. a totals row. Rendered as plain markup —\n * not part of the keyboard-navigable grid.\n */\n footer?: ReactNode\n /**\n * Enable a hover state on table rows.\n */\n hover?: boolean\n /**\n * `id` forwarded to the table element.\n */\n id?: string\n /**\n * Handler that is called when the selection changes.\n */\n onSelectionChange?: (keys: Selection) => void\n /**\n * Handler that is called when a column is sorted.\n */\n onSortChange?: (descriptor: SortDescriptor) => void\n /**\n * Make any table responsive across all viewports or pick a maximum breakpoint.\n */\n responsive?: boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n /**\n * The currently selected row keys (controlled).\n */\n selectedKeys?: Selection\n /**\n * The type of selection that is allowed.\n */\n selectionMode?: 'none' | 'single' | 'multiple'\n /**\n * Make table more compact by cutting all cell padding.\n */\n sm?: boolean\n /**\n * The current sort column and direction.\n */\n sortDescriptor?: SortDescriptor\n /**\n * Convert rows into stacked label/value blocks below a container width, for tables with too\n * many columns to read comfortably even with horizontal scrolling. `true` always stacks; a\n * breakpoint name stacks only below it. Implies `responsive` when `responsive` isn't set\n * separately, since stacking needs the same `.table-responsive` container-query ancestor.\n * Labels come from each `TableColumn`'s text (or its `textValue`, for non-text headers).\n */\n stacked?: boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n /**\n * Add zebra-striping to table rows.\n */\n striped?: boolean\n}\n\nconst TableInner = <T extends object>(\n {\n align,\n bordered,\n borderless,\n caption,\n children,\n className,\n color,\n disabledKeys,\n footer,\n hover,\n id,\n onSelectionChange,\n onSortChange,\n responsive,\n selectedKeys,\n selectionMode = 'none',\n sm,\n sortDescriptor,\n stacked,\n striped,\n ...rest\n }: TableProps<T>,\n forwardedRef: Ref<HTMLTableElement>\n) => {\n const state = useTableState<T>({\n children,\n disabledKeys,\n onSelectionChange,\n onSortChange,\n selectedKeys,\n selectionMode,\n showSelectionCheckboxes: selectionMode === 'multiple',\n sortDescriptor\n })\n\n const internalRef = useRef<HTMLTableElement>(null)\n const ref = useForkedRef(internalRef, forwardedRef)\n const { gridProps } = useTable(\n { 'aria-label': rest['aria-label'], 'aria-labelledby': rest['aria-labelledby'], id },\n state,\n internalRef\n )\n\n const _className = tableClassName({\n align,\n bordered,\n borderless,\n className,\n color,\n hover,\n sm,\n stacked,\n striped\n })\n\n const tableEl = (\n // react-aria joins the table's descriptions without dropping an empty result, so a table\n // with none had `aria-describedby=\"\"`.\n <table\n {...gridProps}\n aria-describedby={gridProps['aria-describedby'] || undefined}\n className={_className}\n ref={ref}\n >\n {caption && <caption>{caption}</caption>}\n <TableRowGroup className={children[0].props.className} type=\"thead\">\n {state.collection.headerRows.map((headerRow) => (\n <TableHeaderRow key={headerRow.key} item={headerRow} state={state}>\n {[...(state.collection.getChildren?.(headerRow.key) ?? [])].map((column) =>\n column.props?.isSelectionCell ? (\n <TableSelectAllCell key={column.key} column={column} state={state} />\n ) : (\n <TableColumnHeader key={column.key} column={column} state={state} />\n )\n )}\n </TableHeaderRow>\n ))}\n </TableRowGroup>\n <TableRowGroup className={children[1].props.className} type=\"tbody\">\n {[...state.collection.body.childNodes].map((row) => (\n <TableRow key={row.key} item={row} state={state}>\n {[...(state.collection.getChildren?.(row.key) ?? [])].map((cell) =>\n cell.props?.isSelectionCell ? (\n <TableSelectionCell key={cell.key} cell={cell} state={state} />\n ) : (\n <TableCell key={cell.key} cell={cell} stacked={!!stacked} state={state} />\n )\n )}\n </TableRow>\n ))}\n </TableRowGroup>\n {footer && <tfoot>{footer}</tfoot>}\n </table>\n )\n\n const wrapperClassName = tableWrapperClassName({ responsive, stacked })\n if (!wrapperClassName) return tableEl\n\n return <div className={wrapperClassName}>{tableEl}</div>\n}\n\n// `forwardRef` erases type parameters, so the generic component is cast back to a generic\n// signature for callers — same reasoning as `TableHeader`/`TableBody`'s casts above.\nexport const Table = forwardRef(TableInner) as <T extends object>(\n props: TableProps<T> & { ref?: Ref<HTMLTableElement> }\n) => ReactElement\n\n;(Table as { displayName?: string }).displayName = 'Table'\n\nconst TableRowGroup = ({\n className,\n type: Element,\n children\n}: {\n children: ReactNode\n className?: string\n type: 'thead' | 'tbody'\n}) => {\n const { rowGroupProps } = useTableRowGroup()\n return (\n <Element {...rowGroupProps} className={className || undefined}>\n {children}\n </Element>\n )\n}\n\ninterface TableHeaderRowProps<T> {\n children: ReactNode\n item: RowNode<T>\n state: TableState<T>\n}\n\nconst TableHeaderRow = <T extends object>({ children, item, state }: TableHeaderRowProps<T>) => {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps } = useTableHeaderRow({ node: item }, state, ref)\n return (\n <tr {...rowProps} ref={ref}>\n {children}\n </tr>\n )\n}\n\ninterface TableColumnHeaderProps<T> {\n column: ColumnNode<T>\n state: TableState<T>\n}\n\nconst TableColumnHeader = <T extends object>({ column, state }: TableColumnHeaderProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref)\n const sortActive = state.sortDescriptor?.column === column.key\n const sortIcon = state.sortDescriptor?.direction === 'ascending' ? '▲' : '▼'\n\n return (\n <th\n {...columnHeaderProps}\n className={column.props?.className || undefined}\n colSpan={column.colSpan ?? undefined}\n // react-aria's `useTableColumnHeader` supplies `role=\"columnheader\"` for the ARIA grid\n // pattern but no `scope`, so the native table semantics were left ambiguous — a `<th>` with\n // no `scope` fails WCAG H63, and assistive technology reading the table natively (rather\n // than through the grid roles) has to guess whether the header applies to its column or its\n // row. These are always column headers; the row-header case doesn't exist in this API.\n scope=\"col\"\n ref={ref}\n >\n {column.rendered}\n {column.props?.allowsSorting && (\n <span aria-hidden=\"true\" className=\"table-sort-icon\">\n {sortActive ? sortIcon : '⇅'}\n </span>\n )}\n </th>\n )\n}\n\ninterface TableSelectAllCellProps<T> {\n column: ColumnNode<T>\n state: TableState<T>\n}\n\nconst TableSelectAllCell = <T extends object>({ column, state }: TableSelectAllCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref)\n const { checkboxProps } = useTableSelectAllCheckbox(state)\n\n return (\n <th\n {...columnHeaderProps}\n className=\"table-selection-cell\"\n scope=\"col\"\n // react-stately's internal \"select all\" column key is a module-scoped\n // `'row-header-column-' + Math.random()` constant (@react-stately/table's TableCollection),\n // computed once per JS environment rather than per render. Under SSR this makes `id`/\n // `data-key` here differ between the server module instance and the browser's, on every\n // request — a real react-stately bug, not something this component can influence (the key\n // never reaches a public prop) — see README.md's Table/DataGrid known-issue section for the\n // upstream write-up. The mismatch is confined to this internal bookkeeping attribute (no\n // visible content, nothing else references this id), so suppressing the warning is safe\n // rather than papering over a real functional break.\n suppressHydrationWarning\n ref={ref}\n >\n <TableCheckbox checkboxProps={checkboxProps} />\n </th>\n )\n}\n\ninterface TableRowProps<T> {\n children: ReactNode\n item: RowNode<T>\n state: TableState<T>\n}\n\nconst TableRow = <T extends object>({ children, item, state }: TableRowProps<T>) => {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps } = useTableRow({ node: item }, state, ref)\n const isSelected = state.selectionManager.isSelected(item.key)\n\n return (\n <tr\n {...rowProps}\n className={classNames({ active: isSelected }, item.props?.className)}\n ref={ref}\n >\n {children}\n </tr>\n )\n}\n\ninterface TableCellProps<T> {\n cell: CellNode<T>\n stacked?: boolean\n state: TableState<T>\n}\n\nconst TableCell = <T extends object>({ cell, stacked, state }: TableCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { gridCellProps } = useTableCell({ node: cell }, state, ref)\n\n return (\n <td\n {...gridCellProps}\n className={cell.props?.className || undefined}\n data-cell={stacked ? cell.column?.textValue || undefined : undefined}\n ref={ref}\n >\n {cell.rendered}\n </td>\n )\n}\n\nconst TableSelectionCell = <T extends object>({ cell, state }: TableCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { gridCellProps } = useTableCell({ node: cell }, state, ref)\n const { checkboxProps } = useTableSelectionCheckbox({ key: cell.parentKey! }, state)\n\n return (\n // See `TableSelectAllCell`'s comment: this cell's `id`/`data-key` derive from the same\n // module-scoped random column key and mismatch between server and client under SSR.\n <td {...gridCellProps} className=\"table-selection-cell\" suppressHydrationWarning ref={ref}>\n <TableCheckbox checkboxProps={checkboxProps} />\n </td>\n )\n}\n\nconst TableCheckbox = ({ checkboxProps }: { checkboxProps: AriaCheckboxProps }) => {\n const toggleState = useToggleState(checkboxProps)\n const ref = useRef<HTMLInputElement>(null)\n const { inputProps } = useCheckbox(checkboxProps, toggleState, ref)\n\n // `aria-describedby` after the spread: react-aria's own adds ids it never renders (FORMS.md,\n // gotcha 6).\n return <input {...inputProps} aria-describedby={undefined} className=\"check-input\" ref={ref} />\n}\n","import { ReactElement } from 'react'\nimport { TableBody as StatelyTableBody } from 'react-stately'\n\nexport interface TableBodyProps<T> {\n /**\n * `TableRow` elements, or a render function paired with `items` for dynamic row generation.\n */\n children: ReactElement | ReactElement[] | ((item: T) => ReactElement)\n /**\n * A string of all className you want applied to the `<tbody>` element.\n */\n className?: string\n /**\n * A list of row data objects, rendered via the function form of `children`.\n */\n items?: Iterable<T>\n}\n\n/**\n * Collection node, data-only — read by `Table` to build the table's row collection. Never\n * rendered directly.\n */\nexport const TableBody = StatelyTableBody as unknown as <T>(\n props: TableBodyProps<T>\n) => ReactElement\n","import { ReactElement, ReactNode } from 'react'\nimport { Cell } from 'react-stately'\n\nexport interface TableCellProps {\n /**\n * The contents of the cell.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the cell.\n */\n className?: string\n /**\n * Indicates how many columns the cell spans.\n */\n colSpan?: number\n /**\n * A string representation of the cell's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a cell in the\n * table's collection; never rendered directly.\n */\nexport const TableCell = Cell as unknown as (props: TableCellProps) => ReactElement\n","import { ReactElement, ReactNode } from 'react'\nimport { Column } from 'react-stately'\n\nexport interface TableColumnProps {\n /**\n * Whether the column allows sorting. Adds a sort indicator and makes the header\n * clickable/keyboard-activatable.\n */\n allowsSorting?: boolean\n /**\n * Rendered contents of the column header.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the column header.\n */\n className?: string\n /**\n * A string representation of the column header, used for accessibility announcements and,\n * when `Table`'s `stacked` prop is set, as the label shown before each row's value for this\n * column. Defaults to `children` when it's a plain string — set this explicitly when the\n * header contains anything else (an icon, a `Tooltip`, etc.).\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a column in the\n * table's collection; never rendered directly.\n */\nexport const TableColumn = Column as unknown as (props: TableColumnProps) => ReactElement\n","import { ReactElement } from 'react'\nimport { TableHeader as StatelyTableHeader } from 'react-stately'\n\nexport interface TableHeaderProps<T> {\n /**\n * `TableColumn` elements, or a render function paired with `columns` for dynamic column\n * generation.\n */\n children: ReactElement | ReactElement[] | ((column: T) => ReactElement)\n /**\n * A string of all className you want applied to the `<thead>` element.\n */\n className?: string\n /**\n * A list of column data objects, rendered via the function form of `children`.\n */\n columns?: readonly T[]\n}\n\n/**\n * Collection node, data-only — read by `Table` to build the table's column collection. Never\n * rendered directly.\n */\nexport const TableHeader = StatelyTableHeader as unknown as <T>(\n props: TableHeaderProps<T>\n) => ReactElement\n","import { Key, ReactElement } from 'react'\nimport { Row } from 'react-stately'\n\nexport interface TableRowProps {\n /**\n * `TableCell` elements, or a render function called once per column with that column's key —\n * required when the row's parent `TableBody` uses the `items`/render-function form.\n */\n children: ReactElement | ReactElement[] | ((columnKey: Key) => ReactElement)\n /**\n * A string of all className you want applied to the row.\n */\n className?: string\n /**\n * A string representation of the row's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a row in the\n * table's collection; never rendered directly.\n */\nexport const TableRow = Row as unknown as (props: TableRowProps) => ReactElement\n"],"mappings":"ojBAkPA,MAAa,EAAQ,GAxGnB,CACE,QACA,WACA,aACA,UACA,WACA,YACA,QACA,eACA,SACA,QACA,KACA,oBACA,eACA,aACA,eACA,gBAAgB,OAChB,KACA,iBACA,UACA,UACA,GAAG,GAEL,IACG,CACH,IAAM,EAAQ,EAAiB,CAC7B,WACA,eACA,oBACA,eACA,eACA,gBACA,wBAAyB,IAAkB,WAC3C,gBACF,CAAC,EAEK,EAAc,EAAyB,IAAI,EAC3C,EAAM,EAAa,EAAa,CAAY,EAC5C,CAAE,aAAc,E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,GAAW,UAAU,cAAmB,KAAM,CAAA,CAChG,ECvYaC,EAAYC,ECIZ,EAAY,ECIZ,EAAc,ECPdC,EAAcC,ECAd,EAAW"}
|
|
1
|
+
{"version":3,"file":"table-DPLOygg0.js","names":["TableRow","TableCell","TableBody","StatelyTableBody","TableHeader","StatelyTableHeader"],"sources":["../../src/components/table/Table.tsx","../../src/components/table/TableBody.tsx","../../src/components/table/TableCell.tsx","../../src/components/table/TableColumn.tsx","../../src/components/table/TableHeader.tsx","../../src/components/table/TableRow.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode, Ref, forwardRef, useRef } from 'react'\nimport classNames from 'classnames'\nimport {\n AriaCheckboxProps,\n Key,\n useCheckbox,\n useTable,\n useTableCell,\n useTableColumnHeader,\n useTableHeaderRow,\n useTableRow,\n useTableRowGroup,\n useTableSelectAllCheckbox,\n useTableSelectionCheckbox\n} from 'react-aria'\nimport {\n Selection,\n SortDescriptor,\n TableBodyProps,\n TableHeaderProps,\n TableState,\n useTableState,\n useToggleState\n} from 'react-stately'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { ContextColor } from '../../types'\nimport { tableClassName, tableWrapperClassName } from '../../utils/tableClassName'\nimport './Table.css'\n\n// `GridNode<T>` (from `@react-types/shared`) isn't re-exported by either package's public\n// surface — derived from the hooks' own parameter types instead of adding an undeclared\n// dependency on react-aria/react-stately's shared internals package.\ntype ColumnNode<T> = Parameters<typeof useTableColumnHeader<T>>[0]['node']\ntype RowNode<T> = Parameters<typeof useTableRow<T>>[0]['node']\ntype CellNode<T> = Parameters<typeof useTableCell<T>>[0]['node']\n\nexport interface TableProps<T extends object> {\n /**\n * An accessible label for the table, used when there's no visible heading.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible heading element for the table.\n */\n 'aria-labelledby'?: string\n /**\n * Set the vertical alignment of cell content.\n */\n align?: 'bottom' | 'middle' | 'top'\n /**\n * Add borders on all sides of the table and cells.\n */\n bordered?: boolean\n /**\n * Remove borders on all sides of the table and cells.\n */\n borderless?: boolean\n /**\n * Content shown above the table, functioning as a heading for it.\n */\n caption?: ReactNode\n /**\n * A `TableHeader` and a `TableBody`, each built from `TableColumn`/`TableRow`/\n * `TableCell` — read as data to build the table's collection. Not rendered directly.\n */\n children: [\n ReactElement<TableHeaderProps<T> & { className?: string }>,\n ReactElement<TableBodyProps<T> & { className?: string }>\n ]\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component.\n */\n color?: ContextColor\n /**\n * A list of row keys to disable. Disabled rows cannot be selected, focused, or interacted with.\n */\n disabledKeys?: Iterable<Key>\n /**\n * Content shown below the table in a `<tfoot>`, e.g. a totals row. Rendered as plain markup —\n * not part of the keyboard-navigable grid.\n */\n footer?: ReactNode\n /**\n * Enable a hover state on table rows.\n */\n hover?: boolean\n /**\n * `id` forwarded to the table element.\n */\n id?: string\n /**\n * Handler that is called when the selection changes.\n */\n onSelectionChange?: (keys: Selection) => void\n /**\n * Handler that is called when a column is sorted.\n */\n onSortChange?: (descriptor: SortDescriptor) => void\n /**\n * Make any table responsive across all viewports or pick a maximum breakpoint.\n */\n responsive?: boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n /**\n * The currently selected row keys (controlled).\n */\n selectedKeys?: Selection\n /**\n * The type of selection that is allowed.\n */\n selectionMode?: 'none' | 'single' | 'multiple'\n /**\n * Make table more compact by cutting all cell padding.\n */\n sm?: boolean\n /**\n * The current sort column and direction.\n */\n sortDescriptor?: SortDescriptor\n /**\n * Convert rows into stacked label/value blocks below a container width, for tables with too\n * many columns to read comfortably even with horizontal scrolling. `true` always stacks; a\n * breakpoint name stacks only below it. Implies `responsive` when `responsive` isn't set\n * separately, since stacking needs the same `.table-responsive` container-query ancestor.\n * Labels come from each `TableColumn`'s text (or its `textValue`, for non-text headers).\n */\n stacked?: boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n /**\n * Add zebra-striping to table rows.\n */\n striped?: boolean\n}\n\nconst TableInner = <T extends object>(\n {\n align,\n bordered,\n borderless,\n caption,\n children,\n className,\n color,\n disabledKeys,\n footer,\n hover,\n id,\n onSelectionChange,\n onSortChange,\n responsive,\n selectedKeys,\n selectionMode = 'none',\n sm,\n sortDescriptor,\n stacked,\n striped,\n ...rest\n }: TableProps<T>,\n forwardedRef: Ref<HTMLTableElement>\n) => {\n const state = useTableState<T>({\n children,\n disabledKeys,\n onSelectionChange,\n onSortChange,\n selectedKeys,\n selectionMode,\n showSelectionCheckboxes: selectionMode === 'multiple',\n sortDescriptor\n })\n\n const internalRef = useRef<HTMLTableElement>(null)\n const ref = useForkedRef(internalRef, forwardedRef)\n const { gridProps } = useTable(\n { 'aria-label': rest['aria-label'], 'aria-labelledby': rest['aria-labelledby'], id },\n state,\n internalRef\n )\n\n const _className = tableClassName({\n align,\n bordered,\n borderless,\n className,\n color,\n hover,\n sm,\n stacked,\n striped\n })\n\n const tableEl = (\n // react-aria joins the table's descriptions without dropping an empty result, so a table\n // with none had `aria-describedby=\"\"`.\n <table\n {...gridProps}\n aria-describedby={gridProps['aria-describedby'] || undefined}\n className={_className}\n ref={ref}\n >\n {caption && <caption>{caption}</caption>}\n <TableRowGroup className={children[0].props.className} type=\"thead\">\n {state.collection.headerRows.map((headerRow) => (\n <TableHeaderRow key={headerRow.key} item={headerRow} state={state}>\n {[...(state.collection.getChildren?.(headerRow.key) ?? [])].map((column) =>\n column.props?.isSelectionCell ? (\n <TableSelectAllCell key={column.key} column={column} state={state} />\n ) : (\n <TableColumnHeader key={column.key} column={column} state={state} />\n )\n )}\n </TableHeaderRow>\n ))}\n </TableRowGroup>\n <TableRowGroup className={children[1].props.className} type=\"tbody\">\n {[...state.collection.body.childNodes].map((row) => (\n <TableRow key={row.key} item={row} state={state}>\n {[...(state.collection.getChildren?.(row.key) ?? [])].map((cell) =>\n cell.props?.isSelectionCell ? (\n <TableSelectionCell key={cell.key} cell={cell} state={state} />\n ) : (\n <TableCell key={cell.key} cell={cell} stacked={!!stacked} state={state} />\n )\n )}\n </TableRow>\n ))}\n </TableRowGroup>\n {footer && <tfoot>{footer}</tfoot>}\n </table>\n )\n\n const wrapperClassName = tableWrapperClassName({ responsive, stacked })\n if (!wrapperClassName) return tableEl\n\n return <div className={wrapperClassName}>{tableEl}</div>\n}\n\n// `forwardRef` erases type parameters, so the generic component is cast back to a generic\n// signature for callers — same reasoning as `TableHeader`/`TableBody`'s casts above.\nexport const Table = forwardRef(TableInner) as <T extends object>(\n props: TableProps<T> & { ref?: Ref<HTMLTableElement> }\n) => ReactElement\n\n;(Table as { displayName?: string }).displayName = 'Table'\n\nconst TableRowGroup = ({\n className,\n type: Element,\n children\n}: {\n children: ReactNode\n className?: string\n type: 'thead' | 'tbody'\n}) => {\n const { rowGroupProps } = useTableRowGroup()\n return (\n <Element {...rowGroupProps} className={className || undefined}>\n {children}\n </Element>\n )\n}\n\ninterface TableHeaderRowProps<T> {\n children: ReactNode\n item: RowNode<T>\n state: TableState<T>\n}\n\nconst TableHeaderRow = <T extends object>({ children, item, state }: TableHeaderRowProps<T>) => {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps } = useTableHeaderRow({ node: item }, state, ref)\n return (\n <tr {...rowProps} ref={ref}>\n {children}\n </tr>\n )\n}\n\ninterface TableColumnHeaderProps<T> {\n column: ColumnNode<T>\n state: TableState<T>\n}\n\nconst TableColumnHeader = <T extends object>({ column, state }: TableColumnHeaderProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref)\n const sortActive = state.sortDescriptor?.column === column.key\n const sortIcon = state.sortDescriptor?.direction === 'ascending' ? '▲' : '▼'\n\n return (\n <th\n {...columnHeaderProps}\n className={column.props?.className || undefined}\n colSpan={column.colSpan ?? undefined}\n // react-aria's `useTableColumnHeader` supplies `role=\"columnheader\"` for the ARIA grid\n // pattern but no `scope`, so the native table semantics were left ambiguous — a `<th>` with\n // no `scope` fails WCAG H63, and assistive technology reading the table natively (rather\n // than through the grid roles) has to guess whether the header applies to its column or its\n // row. These are always column headers; the row-header case doesn't exist in this API.\n scope=\"col\"\n ref={ref}\n >\n {column.rendered}\n {column.props?.allowsSorting && (\n <span aria-hidden=\"true\" className=\"table-sort-icon\">\n {sortActive ? sortIcon : '⇅'}\n </span>\n )}\n </th>\n )\n}\n\ninterface TableSelectAllCellProps<T> {\n column: ColumnNode<T>\n state: TableState<T>\n}\n\nconst TableSelectAllCell = <T extends object>({ column, state }: TableSelectAllCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref)\n const { checkboxProps } = useTableSelectAllCheckbox(state)\n\n return (\n <th\n {...columnHeaderProps}\n className=\"table-selection-cell\"\n scope=\"col\"\n // react-stately's internal \"select all\" column key is a module-scoped\n // `'row-header-column-' + Math.random()` constant (@react-stately/table's TableCollection),\n // computed once per JS environment rather than per render. Under SSR this makes `id`/\n // `data-key` here differ between the server module instance and the browser's, on every\n // request — a real react-stately bug, not something this component can influence (the key\n // never reaches a public prop) — see README.md's Table/DataGrid known-issue section for the\n // upstream write-up. The mismatch is confined to this internal bookkeeping attribute (no\n // visible content, nothing else references this id), so suppressing the warning is safe\n // rather than papering over a real functional break.\n suppressHydrationWarning\n ref={ref}\n >\n <TableCheckbox checkboxProps={checkboxProps} />\n </th>\n )\n}\n\ninterface TableRowProps<T> {\n children: ReactNode\n item: RowNode<T>\n state: TableState<T>\n}\n\nconst TableRow = <T extends object>({ children, item, state }: TableRowProps<T>) => {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps } = useTableRow({ node: item }, state, ref)\n const isSelected = state.selectionManager.isSelected(item.key)\n\n return (\n <tr\n {...rowProps}\n className={classNames({ active: isSelected }, item.props?.className)}\n ref={ref}\n >\n {children}\n </tr>\n )\n}\n\ninterface TableCellProps<T> {\n cell: CellNode<T>\n stacked?: boolean\n state: TableState<T>\n}\n\nconst TableCell = <T extends object>({ cell, stacked, state }: TableCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { gridCellProps } = useTableCell({ node: cell }, state, ref)\n\n return (\n <td\n {...gridCellProps}\n className={cell.props?.className || undefined}\n data-cell={stacked ? cell.column?.textValue || undefined : undefined}\n ref={ref}\n >\n {cell.rendered}\n </td>\n )\n}\n\nconst TableSelectionCell = <T extends object>({ cell, state }: TableCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { gridCellProps } = useTableCell({ node: cell }, state, ref)\n const { checkboxProps } = useTableSelectionCheckbox({ key: cell.parentKey! }, state)\n\n return (\n // See `TableSelectAllCell`'s comment: this cell's `id`/`data-key` derive from the same\n // module-scoped random column key and mismatch between server and client under SSR.\n <td {...gridCellProps} className=\"table-selection-cell\" suppressHydrationWarning ref={ref}>\n <TableCheckbox checkboxProps={checkboxProps} />\n </td>\n )\n}\n\nconst TableCheckbox = ({ checkboxProps }: { checkboxProps: AriaCheckboxProps }) => {\n const toggleState = useToggleState(checkboxProps)\n const ref = useRef<HTMLInputElement>(null)\n const { inputProps } = useCheckbox(checkboxProps, toggleState, ref)\n\n // `aria-describedby` after the spread: react-aria's own adds ids it never renders (FORMS.md,\n // gotcha 6).\n return <input {...inputProps} aria-describedby={undefined} className=\"check-input\" ref={ref} />\n}\n","import { ReactElement } from 'react'\nimport { TableBody as StatelyTableBody } from 'react-stately'\n\nexport interface TableBodyProps<T> {\n /**\n * `TableRow` elements, or a render function paired with `items` for dynamic row generation.\n */\n children: ReactElement | ReactElement[] | ((item: T) => ReactElement)\n /**\n * A string of all className you want applied to the `<tbody>` element.\n */\n className?: string\n /**\n * A list of row data objects, rendered via the function form of `children`.\n */\n items?: Iterable<T>\n}\n\n/**\n * Collection node, data-only — read by `Table` to build the table's row collection. Never\n * rendered directly.\n */\nexport const TableBody = StatelyTableBody as unknown as <T>(\n props: TableBodyProps<T>\n) => ReactElement\n","import { ReactElement, ReactNode } from 'react'\nimport { Cell } from 'react-stately'\n\nexport interface TableCellProps {\n /**\n * The contents of the cell.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the cell.\n */\n className?: string\n /**\n * Indicates how many columns the cell spans.\n */\n colSpan?: number\n /**\n * A string representation of the cell's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a cell in the\n * table's collection; never rendered directly.\n */\nexport const TableCell = Cell as unknown as (props: TableCellProps) => ReactElement\n","import { ReactElement, ReactNode } from 'react'\nimport { Column } from 'react-stately'\n\nexport interface TableColumnProps {\n /**\n * Whether the column allows sorting. Adds a sort indicator and makes the header\n * clickable/keyboard-activatable.\n */\n allowsSorting?: boolean\n /**\n * Rendered contents of the column header.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the column header.\n */\n className?: string\n /**\n * A string representation of the column header, used for accessibility announcements and,\n * when `Table`'s `stacked` prop is set, as the label shown before each row's value for this\n * column. Defaults to `children` when it's a plain string — set this explicitly when the\n * header contains anything else (an icon, a `Tooltip`, etc.).\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a column in the\n * table's collection; never rendered directly.\n */\nexport const TableColumn = Column as unknown as (props: TableColumnProps) => ReactElement\n","import { ReactElement } from 'react'\nimport { TableHeader as StatelyTableHeader } from 'react-stately'\n\nexport interface TableHeaderProps<T> {\n /**\n * `TableColumn` elements, or a render function paired with `columns` for dynamic column\n * generation.\n */\n children: ReactElement | ReactElement[] | ((column: T) => ReactElement)\n /**\n * A string of all className you want applied to the `<thead>` element.\n */\n className?: string\n /**\n * A list of column data objects, rendered via the function form of `children`.\n */\n columns?: readonly T[]\n}\n\n/**\n * Collection node, data-only — read by `Table` to build the table's column collection. Never\n * rendered directly.\n */\nexport const TableHeader = StatelyTableHeader as unknown as <T>(\n props: TableHeaderProps<T>\n) => ReactElement\n","import { Key, ReactElement } from 'react'\nimport { Row } from 'react-stately'\n\nexport interface TableRowProps {\n /**\n * `TableCell` elements, or a render function called once per column with that column's key —\n * required when the row's parent `TableBody` uses the `items`/render-function form.\n */\n children: ReactElement | ReactElement[] | ((columnKey: Key) => ReactElement)\n /**\n * A string of all className you want applied to the row.\n */\n className?: string\n /**\n * A string representation of the row's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a row in the\n * table's collection; never rendered directly.\n */\nexport const TableRow = Row as unknown as (props: TableRowProps) => ReactElement\n"],"mappings":"ojBAkPA,MAAa,EAAQ,GAxGnB,CACE,QACA,WACA,aACA,UACA,WACA,YACA,QACA,eACA,SACA,QACA,KACA,oBACA,eACA,aACA,eACA,gBAAgB,OAChB,KACA,iBACA,UACA,UACA,GAAG,GAEL,IACG,CACH,IAAM,EAAQ,EAAiB,CAC7B,WACA,eACA,oBACA,eACA,eACA,gBACA,wBAAyB,IAAkB,WAC3C,gBACF,CAAC,EAEK,EAAc,EAAyB,IAAI,EAC3C,EAAM,EAAa,EAAa,CAAY,EAC5C,CAAE,aAAc,EACpB,CAAE,aAAc,EAAK,cAAe,kBAAmB,EAAK,mBAAoB,IAAG,EACnF,EACA,CACF,EAEM,EAAa,EAAe,CAChC,QACA,WACA,aACA,YACA,QACA,QACA,KACA,UACA,SACF,CAAC,EAEK,EAGJ,EAAA,cAAC,QAAD,CACE,GAAI,EACJ,mBAAkB,EAAU,qBAAuB,IAAA,GACnD,UAAW,EACN,KA8BA,EA5BJ,GAAW,EAAA,cAAC,UAAA,KAAS,CAAiB,EACvC,EAAA,cAAC,EAAD,CAAe,UAAW,EAAS,EAAE,CAAC,MAAM,UAAW,KAAK,OAY7C,EAXZ,EAAM,WAAW,WAAW,IAAK,GAChC,EAAA,cAAC,EAAD,CAAgB,IAAK,EAAU,IAAK,KAAM,EAAkB,OAQ5C,EAPb,CAAC,GAAI,EAAM,WAAW,cAAc,EAAU,GAAG,GAAK,CAAC,CAAE,CAAC,CAAC,IAAK,GAC/D,EAAO,OAAO,gBACZ,EAAA,cAAC,EAAD,CAAoB,IAAK,EAAO,I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Aa,IAAA,GACpC,YAAW,GAAU,EAAK,QAAQ,WAAyB,IAAA,GACtD,KAGH,EADD,EAAK,QACJ,CAER,EAEM,GAAwC,CAAE,OAAM,WAA+B,CACnF,IAAM,EAAM,EAA6B,IAAI,EACvC,CAAE,iBAAkB,EAAa,CAAE,KAAM,CAAK,EAAG,EAAO,CAAG,EAC3D,CAAE,iBAAkB,EAA0B,CAAE,IAAK,EAAK,SAAW,EAAG,CAAK,EAEnF,OAGE,EAAA,cAAC,KAAD,CAAI,GAAI,EAAe,UAAU,uBAAuB,yBAAA,GAA8B,KAElF,EADF,EAAA,cAAC,EAAD,CAA8B,eAAgB,CAAA,CAC5C,CAER,EAEM,GAAiB,CAAE,mBAA0D,CACjF,IAAM,EAAc,EAAe,CAAa,EAC1C,EAAM,EAAyB,IAAI,EACnC,CAAE,cAAe,EAAY,EAAe,EAAa,CAAG,EAIlE,OAAO,EAAA,cAAC,QAAD,CAAO,GAAI,EAAY,mBAAkB,IAAA,GAAW,UAAU,cAAmB,KAAM,CAAA,CAChG,ECvYaC,EAAYC,ECIZ,EAAY,ECIZ,EAAc,ECPdC,EAAcC,ECAd,EAAW"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"classnames";const t={bottom:`align-bottom`,middle:`align-middle`,top:`align-top`};function n({align:n,bordered:r,borderless:i,className:a,color:o,hover:s,sm:c,stacked:l,striped:u}){return e(`table`,o,n&&t[n],{bordered:r,borderless:i,hoverable:s,sm:c,stacked:l===!0,striped:u},typeof l==`string`?`max-${l}:stacked`:void 0,a)||void 0}function r({responsive:e,stacked:t}){if(e||t)return!e||e===!0?`table-responsive`:`max-${e}:table-responsive`}export{n,r,t};
|
|
2
|
+
//# sourceMappingURL=tableClassName-DleBjOj2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableClassName-DleBjOj2.js","names":[],"sources":["../../src/utils/tableClassName.ts"],"sourcesContent":["import classNames from 'classnames'\n\nimport { Breakpoint, ContextColor } from '../types'\n\n// The styling props `Table` and `StaticTable` share. Kept in one place so the two can't drift into\n// applying different chassis-css classes for the same prop — `StaticTable` exists to be the\n// zero-JS twin of `Table`'s look, so a prop meaning something different on each would defeat it.\nexport interface TableStyleProps {\n /**\n * Set the vertical alignment of cell content.\n */\n align?: 'bottom' | 'middle' | 'top'\n /**\n * Add borders on all sides of the table and cells.\n */\n bordered?: boolean\n /**\n * Remove borders on all sides of the table and cells.\n */\n borderless?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component.\n */\n color?: ContextColor\n /**\n * Enable a hover state on table rows.\n */\n hover?: boolean\n /**\n * Make any table responsive across all viewports or pick a maximum breakpoint.\n */\n responsive?: boolean | Breakpoint\n /**\n * Make table more compact by cutting all cell padding.\n */\n sm?: boolean\n /**\n * Convert rows into stacked label/value blocks below a container width, for tables with too\n * many columns to read comfortably even with horizontal scrolling. `true` always stacks; a\n * breakpoint name stacks only below it. Implies `responsive` when `responsive` isn't set\n * separately, since stacking needs the same `.table-responsive` container-query ancestor.\n */\n stacked?: boolean | Breakpoint\n /**\n * Add zebra-striping to table rows.\n */\n striped?: boolean\n}\n\n// Whole class names, not `align-${align}`: see `utils/colorClassNames.ts`.\nexport const TABLE_ALIGN_CLASS_NAMES: Record<NonNullable<TableStyleProps['align']>, string> = {\n bottom: 'align-bottom',\n middle: 'align-middle',\n top: 'align-top'\n}\n\nexport function tableClassName({\n align,\n bordered,\n borderless,\n className,\n color,\n hover,\n sm,\n stacked,\n striped\n}: TableStyleProps): string | undefined {\n return (\n classNames(\n 'table',\n color,\n align && TABLE_ALIGN_CLASS_NAMES[align],\n {\n bordered,\n borderless,\n hoverable: hover,\n sm,\n stacked: stacked === true,\n striped\n },\n typeof stacked === 'string' ? `max-${stacked}:stacked` : undefined,\n className\n ) || undefined\n )\n}\n\n// `undefined` when the table needs no wrapper at all. Stacking needs the same `.table-responsive`\n// container-query ancestor as horizontal scrolling, so `stacked` alone still gets one.\nexport function tableWrapperClassName({\n responsive,\n stacked\n}: Pick<TableStyleProps, 'responsive' | 'stacked'>): string | undefined {\n if (!responsive && !stacked) return undefined\n if (!responsive || responsive === true) return 'table-responsive'\n return `max-${responsive}:table-responsive`\n}\n"],"mappings":"0BAsDA,MAAa,EAAiF,CAC5F,OAAQ,eACR,OAAQ,eACR,IAAK,WACP,EAEA,SAAgB,EAAe,CAC7B,QACA,WACA,aACA,YACA,QACA,QACA,KACA,UACA,WACsC,CACtC,OACE,EACE,QACA,EACA,GAAS,EAAwB,GACjC,CACE,WACA,aACA,UAAW,EACX,KACA,QAAS,IAAY,GACrB,SACF,EACA,OAAO,GAAY,SAAW,OAAO,EAAQ,UAAY,IAAA,GACzD,CACF,GAAK,IAAA,EAET,CAIA,SAAgB,EAAsB,CACpC,aACA,WACsE,CAClE,GAAC,GAAe,EAEpB,MADI,CAAC,GAAc,IAAe,GAAa,mBACxC,OAAO,EAAW,kBAC3B"}
|
package/dist/datagrid.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./chunks/datagrid-
|
|
1
|
+
"use client";import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./chunks/datagrid-DOYxx0sF.js";export{t as DataGrid,o as DataGridBody,i as DataGridCell,e as DataGridColumn,n as DataGridHeader,a as DataGridRow,s as DataGridSelectAllCell,r as DataGridSelectionCell};
|
package/dist/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ import { i as useScrollspy, n as ScrollspyProps, r as UseScrollspyOptions, t as
|
|
|
64
64
|
import { n as SearchFieldProps, t as SearchField } from "./chunks/index-Bz8MDq0H.js";
|
|
65
65
|
import { n as SelectOptionDef, r as SelectProps, t as Select } from "./chunks/index-BVGGIaPX.js";
|
|
66
66
|
import { i as SkeletonProps, n as SkeletonLoaderProps, r as Skeleton, t as SkeletonLoader } from "./chunks/index-CHQR8x8_.js";
|
|
67
|
-
import { n as SpinnerProps, t as Spinner } from "./chunks/index-
|
|
67
|
+
import { n as SpinnerProps, t as Spinner } from "./chunks/index-Dzga1f4w.js";
|
|
68
68
|
import { n as StackProps, t as Stack } from "./chunks/index-YJ9QdBuq.js";
|
|
69
69
|
import { n as StaticTableProps, t as StaticTable } from "./chunks/index-U27Ar174.js";
|
|
70
70
|
import { a as StepperProps, i as StepperItemDef, n as StepperItemProps, r as Stepper, t as StepperItem } from "./chunks/index-BLS1jhSJ.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import"./chunks/focus-ring-SR_LwaN7.js";import{i as e,n as t,r as n,t as r}from"./chunks/accordion-B8UWyvQB.js";import{n as i,t as a}from"./chunks/Portal-CgeR1WXV.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./chunks/drawer-C7Tz4XU_.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./chunks/modal-bgDR29Jh.js";import{a as v,c as y,i as b,l as x,n as S,o as C,r as w,s as T,t as E}from"./chunks/notification-Dbci5Ka3.js";import{n as D,t as O}from"./chunks/datepicker-bOiM_zhJ.js";import{n as k,r as A,t as j}from"./chunks/pagination-
|
|
1
|
+
"use client";import"./chunks/focus-ring-SR_LwaN7.js";import{i as e,n as t,r as n,t as r}from"./chunks/accordion-B8UWyvQB.js";import{n as i,t as a}from"./chunks/Portal-CgeR1WXV.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./chunks/drawer-C7Tz4XU_.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./chunks/modal-bgDR29Jh.js";import{a as v,c as y,i as b,l as x,n as S,o as C,r as w,s as T,t as E}from"./chunks/notification-Dbci5Ka3.js";import{n as D,t as O}from"./chunks/datepicker-bOiM_zhJ.js";import{n as k,r as A,t as j}from"./chunks/pagination-BREQp-ZC.js";import{a as M,c as N,i as P,l as F,n as I,o as L,r as R,s as z,t as B,u as V}from"./chunks/toast-CGHl3-oU.js";import{o as H}from"./chunks/ComboboxListBox-Cm3L1ULl.js";import{t as U}from"./chunks/Icon-DLB1f88W.js";import{n as W,t as G}from"./chunks/FormHelp-AE6_iSLJ.js";import{t as K}from"./chunks/FormLabel-CYcQiFUI.js";import{n as q,r as J,t as Y}from"./chunks/autocomplete-Baf9VSHN.js";import{t as X}from"./chunks/Link-DyZyAQFj.js";import{t as Z}from"./chunks/badge-D2oztCvs.js";import{n as Q,r as $,t as ee}from"./chunks/avatar-MklqAKcz.js";import{t as te}from"./chunks/VisuallyHidden-C2dM7HhC.js";import{t as ne}from"./chunks/CloseButton-DPgQztE0.js";import{t as re}from"./chunks/stack-DK5F53VT.js";import{n as ie,t as ae}from"./chunks/breadcrumb-CHxTiZLt.js";import{t as oe}from"./chunks/Button-BoymWE-L.js";import"./button.js";import{n as se,t as ce}from"./chunks/button-group-BGppPrIv.js";import{n as le,t as ue}from"./chunks/RangeCalendar-BJl-j4W2.js";import"./calendar.js";import{a as de,c as fe,i as pe,n as me,o as he,r as ge,s as _e,t as ve}from"./chunks/datagrid-DOYxx0sF.js";import{a as ye,c as be,d as xe,i as Se,l as Ce,n as we,o as Te,r as Ee,s as De,t as Oe,u as ke}from"./chunks/card-CTP9K8xG.js";import{a as Ae,c as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./chunks/carousel-fTVPqnSV.js";import{t as Re}from"./chunks/collapse--Go2Y73B.js";import{t as ze}from"./chunks/Chip-DCaWaBqo.js";import{t as Be}from"./chunks/chip-input-BpVDRERg.js";import"./close-button.js";import{t as Ve}from"./chunks/color-input-Bwl5ef5B.js";import{t as He}from"./chunks/file-input-CDM6qrmV.js";import{n as Ue,t as We}from"./chunks/combobox-Bp1tIaiW.js";import{t as Ge}from"./chunks/otp-input-ws393uPB.js";import{t as Ke}from"./chunks/password-strength-DDK8pHRq.js";import{t as qe}from"./chunks/Menu-CSBg2Zmc.js";import{d as Je,l as Ye,n as Xe,t as Ze,u as Qe}from"./chunks/MenuToggle-7RQ0dmtZ.js";import{n as $e,r as et,t as tt}from"./chunks/menu-Upf6P-2P.js";import{n as nt,r as rt,t as it}from"./chunks/grid-C7tO-ppc.js";import{n as at,t as ot}from"./chunks/checkbox-ZyQn5Ku5.js";import{t as st}from"./chunks/flex-B52oLCCC.js";import{t as ct}from"./chunks/form-GpdAyWWi.js";import{t as lt}from"./chunks/floating-input-DmSZZc27.js";import{t as ut}from"./chunks/form-field-CNPGTMiW.js";import{n as dt,t as ft}from"./chunks/input-group-Cuiuf4Dl.js";import{t as pt}from"./chunks/input-adorn-DwdX-jxA.js";import{n as mt,t as ht}from"./chunks/radio-B6gJdtoN.js";import{t as gt}from"./chunks/range-input-CT_8TKL7.js";import{t as _t}from"./chunks/select-BwJIfv9f.js";import{t as vt}from"./chunks/switch-C6s3LxEv.js";import{t as yt}from"./chunks/text-input-B4pTv6SU.js";import{t as bt}from"./chunks/textarea-1A1nABQE.js";import{t as xt}from"./chunks/icon-BQsT6YtE.js";import{t as St}from"./chunks/placeholder-DhNpUJqv.js";import"./link.js";import{n as Ct,t as wt}from"./chunks/list-07e2a1Ym.js";import{i as Tt,n as Et,r as Dt,t as Ot}from"./chunks/nav-DI6oEULI.js";import{a as kt,i as At,n as jt,r as Mt,t as Nt}from"./chunks/navbar-DxIwt0sc.js";import{t as Pt}from"./chunks/popover-Bdg8D4sm.js";import{n as Ft,t as It}from"./chunks/progress-BqgWezdG.js";import{n as Lt,t as Rt}from"./chunks/skeleton-Bjv9gGd3.js";import{t as zt}from"./chunks/spinner-DBuvQvMR.js";import{t as Bt}from"./chunks/static-table-uu297Liz.js";import{n as Vt,t as Ht}from"./chunks/stepper-CVXMJ2yg.js";import{a as Ut,i as Wt,n as Gt,o as Kt,r as qt,t as Jt}from"./chunks/table-DPLOygg0.js";import{i as Yt,n as Xt,r as Zt,t as Qt}from"./chunks/tabs-91T7-8qq.js";import{t as $t}from"./chunks/tooltip-Bc-u6nIW.js";import"./chip.js";import"./portal.js";import"./visually-hidden.js";import{a as en,c as tn,i as nn,n as rn,o as an,r as on,s as sn,t as cn}from"./chunks/alert-3kTBfWFw.js";import{t as ln}from"./chunks/nav-overflow-DlLer6EK.js";import{n as un,t as dn}from"./chunks/scrollspy-C2HmrnZ4.js";import{t as fn}from"./chunks/divider-CjbF4OfA.js";import{t as pn}from"./chunks/number-field-IBIX2IWH.js";import{t as mn}from"./chunks/time-field-B3MA7ED_.js";import{t as hn}from"./chunks/search-field--nDoCI_E.js";import{t as gn}from"./chunks/context-menu-B4a0tS-h.js";import{n as _n,t as vn}from"./chunks/tree-Cql1veeZ.js";import{I18nProvider as yn}from"react-aria";export{r as Accordion,e as AccordionBody,n as AccordionHeader,t as AccordionItem,tn as Alert,sn as AlertBody,an as AlertCancel,en as AlertCode,nn as AlertFooter,on as AlertIcon,rn as AlertText,cn as AlertTitle,Y as Autocomplete,J as AutocompleteGroup,q as AutocompleteItem,Q as Avatar,$ as AvatarImage,ee as AvatarStack,Z as Badge,ae as Breadcrumb,ie as BreadcrumbItem,oe as Button,se as ButtonGroup,ce as ButtonToolbar,le as Calendar,ye as Card,xe as CardBody,ke as CardFooter,Se as CardGroup,Ee as CardHeader,Ce as CardImage,we as CardImageOverlay,Oe as CardLink,be as CardSubtitle,De as CardText,Te as CardTitle,Pe as Carousel,Ae as CarouselControlNext,Me as CarouselControlPrev,Fe as CarouselIndicators,Ie as CarouselInner,je as CarouselItem,Ne as CarouselOverlay,Le as CarouselPlayPause,at as Checkbox,ot as CheckboxGroup,ze as Chip,Be as ChipInput,ne as CloseButton,Re as Collapse,Ve as ColorInput,We as Combobox,Ue as ComboboxGroup,H as ComboboxItem,rt as Container,gn as ContextMenu,fe as DataGrid,_e as DataGridBody,he as DataGridCell,de as DataGridColumn,pe as DataGridHeader,ge as DataGridRow,ve as DataGridSelectAllCell,me as DataGridSelectionCell,D as DatePicker,O as DateRangePicker,fn as Divider,l as Drawer,s as DrawerBody,u as DrawerFooter,c as DrawerHeader,d as DrawerTitle,He as FileInput,st as Flex,lt as FloatingInput,ct as Form,W as FormFeedback,ut as FormField,G as FormHelp,K as FormLabel,nt as Grid,it as GridItem,yn as I18nProvider,U as Icon,xt as IconProvider,pt as InputAdorn,dt as InputGroup,ft as InputGroupAddon,X as Link,wt as List,Ct as ListItem,qe as Menu,Je as MenuDivider,Qe as MenuHeader,Ye as MenuItem,Xe as MenuList,$e as MenuSubmenu,tt as MenuSubmenuBack,et as MenuText,Ze as MenuToggle,h as Modal,p as ModalBody,g as ModalFooter,m as ModalHeader,_ as ModalTitle,Et as Nav,Dt as NavItem,Tt as NavLink,ln as NavOverflow,Ot as NavTitle,kt as Navbar,At as NavbarBrand,Mt as NavbarNav,jt as NavbarText,Nt as NavbarToggler,C as Notification,v as NotificationIcon,E as NotificationStack,y as NotificationText,T as NotificationTitle,pn as NumberField,Ge as OtpInput,j as Pagination,k as PaginationItem,Ke as PasswordStrength,St as Placeholder,Pt as Popover,a as Portal,It as Progress,Ft as ProgressBar,mt as Radio,ht as RadioGroup,ue as RangeCalendar,gt as RangeInput,dn as Scrollspy,hn as SearchField,_t as Select,Lt as Skeleton,Rt as SkeletonLoader,zt as Spinner,re as Stack,Bt as StaticTable,Ht as Stepper,Vt as StepperItem,vt as Switch,Qt as Tab,Yt as TabList,Zt as TabPanel,Kt as Table,Ut as TableBody,Wt as TableCell,qt as TableColumn,Gt as TableHeader,Jt as TableRow,Xt as Tabs,yt as TextInput,bt as Textarea,mn as TimeField,L as Toast,F as ToastBody,N as ToastFooter,z as ToastHeader,M as ToastIcon,B as Toaster,$t as Tooltip,_n as Tree,vn as TreeItem,te as VisuallyHidden,S as addNotification,I as addToast,w as closeNotification,R as closeToast,b as notificationQueue,P as toastQueue,o as useDrawer,i as useHydrated,f as useModal,x as useNotification,A as usePagination,un as useScrollspy,V as useToast};
|
package/dist/link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import"./chunks/focus-ring-SR_LwaN7.js";import{t as e}from"./chunks/Link-
|
|
1
|
+
"use client";import"./chunks/focus-ring-SR_LwaN7.js";import{t as e}from"./chunks/Link-DyZyAQFj.js";export{e as Link};
|
package/dist/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{n as e,t}from"./chunks/list-
|
|
1
|
+
"use client";import{n as e,t}from"./chunks/list-07e2a1Ym.js";export{t as List,e as ListItem};
|
package/dist/menu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{t as e}from"./chunks/Menu-CSBg2Zmc.js";import{d as t,l as n,n as r,t as i,u as a}from"./chunks/MenuToggle-
|
|
1
|
+
"use client";import{t as e}from"./chunks/Menu-CSBg2Zmc.js";import{d as t,l as n,n as r,t as i,u as a}from"./chunks/MenuToggle-7RQ0dmtZ.js";import{n as o,r as s,t as c}from"./chunks/menu-Upf6P-2P.js";export{e as Menu,t as MenuDivider,a as MenuHeader,n as MenuItem,r as MenuList,o as MenuSubmenu,c as MenuSubmenuBack,s as MenuText,i as MenuToggle};
|
package/dist/nav-overflow.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{t as e}from"./chunks/nav-overflow-
|
|
1
|
+
"use client";import{t as e}from"./chunks/nav-overflow-DlLer6EK.js";export{e as NavOverflow};
|
package/dist/nav.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{i as e,n as t,r as n,t as r}from"./chunks/nav-
|
|
1
|
+
"use client";import{i as e,n as t,r as n,t as r}from"./chunks/nav-DI6oEULI.js";export{t as Nav,n as NavItem,e as NavLink,r as NavTitle};
|
package/dist/pagination.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{n as e,r as t,t as n}from"./chunks/pagination-
|
|
1
|
+
"use client";import{n as e,r as t,t as n}from"./chunks/pagination-BREQp-ZC.js";export{n as Pagination,e as PaginationItem,t as usePagination};
|
package/dist/placeholder.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{t as e}from"./chunks/placeholder-
|
|
1
|
+
"use client";import{t as e}from"./chunks/placeholder-DhNpUJqv.js";export{e as Placeholder};
|
package/dist/progress.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{n as e,t}from"./chunks/progress-
|
|
1
|
+
"use client";import{n as e,t}from"./chunks/progress-BqgWezdG.js";export{t as Progress,e as ProgressBar};
|
package/dist/skeleton.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{n as e,t}from"./chunks/skeleton-
|
|
1
|
+
"use client";import{n as e,t}from"./chunks/skeleton-Bjv9gGd3.js";export{e as Skeleton,t as SkeletonLoader};
|
package/dist/spinner.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SpinnerProps, t as Spinner } from "./chunks/index-
|
|
1
|
+
import { n as SpinnerProps, t as Spinner } from "./chunks/index-Dzga1f4w.js";
|
|
2
2
|
export { Spinner, type SpinnerProps };
|
package/dist/spinner.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{t as e}from"./chunks/spinner-
|
|
1
|
+
"use client";import{t as e}from"./chunks/spinner-DBuvQvMR.js";export{e as Spinner};
|
package/dist/static-table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./chunks/static-table-
|
|
1
|
+
import{t as e}from"./chunks/static-table-uu297Liz.js";export{e as StaticTable};
|
package/dist/table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as e,i as t,n,o as r,r as i,t as a}from"./chunks/table-
|
|
1
|
+
"use client";import{a as e,i as t,n,o as r,r as i,t as a}from"./chunks/table-DPLOygg0.js";export{r as Table,e as TableBody,t as TableCell,i as TableColumn,n as TableHeader,a as TableRow};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chassis-ui/react",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Chassis UI Components Library for React.js",
|
|
6
6
|
"keywords": [
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"devDependencies": {
|
|
147
147
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
148
148
|
"@arethetypeswrong/core": "^0.18.5",
|
|
149
|
-
"@chassis-ui/css": "^0.7.
|
|
149
|
+
"@chassis-ui/css": "^0.7.2",
|
|
150
150
|
"@chassis-ui/tokens": "^0.7.0",
|
|
151
151
|
"@playwright/test": "1.63.0",
|
|
152
152
|
"@storybook/addon-a11y": "^10.6.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as e,f as t,g as n,p as r}from"./slot-CNhFZdHF.js";import{t as i}from"./useForkedRef-DVEfT-KI.js";import{t as a}from"./polymorphic-BhGNZQja.js";import{t as o}from"./useButtonSemantics-CILM_lhi.js";import{t as s}from"./useDisabledAnchorGuard-Cz58UCXy.js";import{n as c}from"./scrollspy-D_lPjb92.js";import l from"react";import u from"classnames";import{mergeProps as d}from"react-aria";function f({children:a,active:f,className:p,color:m,component:h,disabled:g,href:_,iconLink:v,onClick:y,reset:b,stretched:x,type:S=`button`,...C},w){let T=r(h,_,`a`),E=n(T,_,C),D=t(E),O=E===`component`,k=c(g),A=k.onClick,j=s(E===`anchor`,g,A?e=>{y?.(e),A(e)}:y),M=!D&&!O&&!!y,{buttonProps:N,forkedRef:P}=o(w,{disabled:g,onClick:y}),F=M?P:w,I=i(F,k.ref),L=f||!!k.mark,R=f?`page`:k.mark===`current`?`true`:void 0,z=u(m&&`link-${m}`,{"icon-link":v,"fg-reset":b,"stretched-link":x},{active:L,disabled:g},p);return l.createElement(T,{...d(C,M?N:{}),className:z,...e(E,_,`Link`),...R&&{"aria-current":R},...E===`anchor`&&g&&{"aria-disabled":!0,tabIndex:-1},...!M&&{onClick:j},...E===`button`&&{disabled:g,type:S},ref:k.ref?I:F},a)}const p=a(f,`Link`);export{p as t};
|
|
2
|
-
//# sourceMappingURL=Link-CZsWCnQb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Link-CZsWCnQb.js","names":[],"sources":["../../src/components/link/Link.tsx"],"sourcesContent":["import React, {\n ElementType,\n ForwardRefRenderFunction,\n MouseEventHandler,\n ReactElement,\n Ref\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps } from 'react-aria'\n\nimport { ContextColor } from '../../types'\nimport { useButtonSemantics, useDisabledAnchorGuard, useForkedRef } from '../../hooks'\nimport { hrefProps, isInteractiveKind, linkElement, resolveLinkKind } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { useScrollspyLink } from '../../utils/scrollspy'\n\ntype LinkOwnProps<C extends ElementType> = {\n /**\n * Toggle the active state for the component.\n */\n active?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the link color to one of Chassis context colors, including its interactive\n * (`:hover`/`:focus`/`:active`/`:visited`) states.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * The href attribute specifies the URL of the page the link goes to. Reaches an `<a>` or a\n * component reference (a router link); dropped, with a warning in development, when\n * `component` is another element. Declared explicitly here — rather than left to flow through\n * generically from whatever `C` is — so consumers that wrap `Link` (`MenuItem`, `ListItem`,\n * `NavLink`) can read it with a concrete type regardless of `component`.\n */\n href?: string\n /**\n * Fires on click.\n */\n onClick?: MouseEventHandler<HTMLElement>\n /**\n * Aligns a leading or trailing icon with the link text using flexbox, with a gap between\n * them and an offset underline. Icons need to be passed as `children` alongside the text.\n * Named `iconLink` rather than `icon` to avoid colliding with components (e.g. `MenuItem`)\n * that already have their own, differently-typed `icon` prop for the icon content itself.\n */\n iconLink?: boolean\n /**\n * Removes the foreground color override, so the link inherits its color from the nearest\n * ancestor instead of the default link color.\n */\n reset?: boolean\n /**\n * Expands the link's click target to fill its positioned ancestor (the nearest ancestor with\n * a `position` other than `static`).\n */\n stretched?: boolean\n /**\n * Specifies the type of button. Only applies when `component=\"button\"`. Different browsers may\n * use different default types for the `<button>` element, so always specify it explicitly.\n */\n type?: 'button' | 'submit' | 'reset'\n}\n\nexport type LinkProps<C extends ElementType = 'a'> = PolymorphicComponentProps<C, LinkOwnProps<C>>\n\ntype LinkComponent = (<C extends ElementType = 'a'>(\n props: LinkProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction LinkRender<C extends ElementType = 'a'>(\n {\n children,\n active,\n className,\n color,\n component,\n disabled,\n href,\n iconLink,\n onClick,\n reset,\n stretched,\n type = 'button',\n ...rest\n }: LinkProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = linkElement(component, href, 'a')\n // The kind rather than the tag, counting a router link with `href` or `to` as an anchor: under `asChild`, `Component` is a `Slot` standing in for the\n // caller's element, and a slotted `<a>` needs what `component=\"a\"` gets.\n const kind = resolveLinkKind(Component, href, rest)\n\n const isInteractive = isInteractiveKind(kind)\n // A component reference without a link target (a router link with `href` or `to` is an anchor,\n // see `resolveLinkKind`) has its own visual identity and is trusted to\n // handle its own keyboard/role semantics, same as `CloseButton`'s `isComponentReference` escape\n // hatch — synthesizing `role=\"button\"` and Enter/Space handling on top of it would stamp the\n // wrong ARIA role onto whatever it actually renders (e.g. an `<a>`) and can double-fire a click\n // (native anchor Enter→click, plus the synthesized keydown→click).\n const isComponentReference = kind === 'component'\n // Inside a `Scrollspy`, the link registers its element, is marked when its section is the one\n // being read, and scrolls to it smoothly when the `Scrollspy` is set to (`src/utils/scrollspy.ts`).\n const spy = useScrollspyLink(disabled)\n const spyClick = spy.onClick\n const clickHandler: MouseEventHandler<HTMLElement> | undefined = spyClick\n ? (event) => {\n onClick?.(event)\n spyClick(event)\n }\n : onClick\n // `<a>` has no real `disabled` attribute, so a disabled anchor link still fires click (and\n // still navigates) unless it's blocked here, same guard `Button`/`CloseButton` apply. A real\n // `<button>` already stops clicks on its own once the `disabled` attribute below is set.\n const handleClick = useDisabledAnchorGuard<HTMLElement>(kind === 'anchor', disabled, clickHandler)\n\n // A `component` that isn't a native interactive element gets a raw onClick with no\n // keyboard semantics otherwise — mouse-only, unlike `Button`/`CloseButton`, which\n // synthesize this via `useButtonSemantics` for exactly this \"arbitrary component\" case. A\n // component reference is excluded (see `isComponentReference` above).\n const needsButtonSemantics = !isInteractive && !isComponentReference && !!onClick\n const { buttonProps, forkedRef } = useButtonSemantics<HTMLElement>(ref as Ref<HTMLElement>, {\n disabled,\n onClick\n })\n const ownRef = needsButtonSemantics ? forkedRef : ref\n const spyRef = useForkedRef(ownRef as Ref<HTMLElement>, spy.ref)\n // A link to the section being read is `active` and `aria-current=\"true\"`: the current place in\n // the page, not the current page. A link it belongs under, such as its menu's toggle, only\n // looks active. An `active` given as a prop wins.\n const isActive = active || !!spy.mark\n const ariaCurrent = active ? 'page' : spy.mark === 'current' ? 'true' : undefined\n\n const _className = classNames(\n color && `link-${color}`,\n { 'icon-link': iconLink, 'fg-reset': reset, 'stretched-link': stretched },\n { active: isActive, disabled },\n className\n )\n\n return (\n <Component\n {...(mergeProps(rest, needsButtonSemantics ? buttonProps : {}) as Record<string, unknown>)}\n className={_className}\n {...hrefProps(kind, href, 'Link')}\n {...(ariaCurrent && { 'aria-current': ariaCurrent })}\n {...(kind === 'anchor' && disabled && { 'aria-disabled': true, tabIndex: -1 })}\n {...(!needsButtonSemantics && { onClick: handleClick })}\n {...(kind === 'button' && { disabled, type })}\n ref={spy.ref ? spyRef : ownRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const Link = createPolymorphicComponent<LinkComponent>(\n LinkRender as ForwardRefRenderFunction<Element, LinkProps<ElementType>>,\n 'Link'\n)\n"],"mappings":"0YAoFA,SAAS,EACP,CACE,WACA,SACA,YACA,QACA,YACA,WACA,OACA,WACA,UACA,QACA,YACA,OAAO,SACP,GAAG,GAEL,EACA,CACA,IAAM,EAAY,EAAY,EAAW,EAAM,GAAG,EAG5C,EAAO,EAAgB,EAAW,EAAM,CAAI,EAE5C,EAAgB,EAAkB,CAAI,EAOtC,EAAuB,IAAS,YAGhC,EAAM,EAAiB,CAAQ,EAC/B,EAAW,EAAI,QAUf,EAAc,EAAoC,IAAS,SAAU,EATV,EAC5D,GAAU,CACT,IAAU,CAAK,EACf,EAAS,CAAK,CAChB,EACA,CAI6F,EAM3F,EAAuB,CAAC,GAAiB,CAAC,GAAwB,CAAC,CAAC,EACpE,CAAE,cAAa,aAAc,EAAgC,EAAyB,CAC1F,WACA,SACF,CAAC,EACK,EAAS,EAAuB,EAAY,EAC5C,EAAS,EAAa,EAA4B,EAAI,GAAG,EAIzD,EAAW,GAAU,CAAC,CAAC,EAAI,KAC3B,EAAc,EAAS,OAAS,EAAI,OAAS,UAAY,OAAS,IAAA,GAElE,EAAa,EACjB,GAAS,QAAQ,IACjB,CAAE,YAAa,EAAU,WAAY,EAAO,iBAAkB,CAAU,EACxE,CAAE,OAAQ,EAAU,UAAS,EAC7B,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CACE,GAAK,EAAW,EAAM,EAAuB,EAAc,CAAC,CAAC,EAC7D,UAAW,EACX,GAAI,EAAU,EAAM,EAAM,MAAM,EAChC,GAAK,GAAe,CAAE,eAAgB,CAAY,EAClD,GAAK,IAAS,UAAY,GAAY,CAAE,gBAAiB,GAAM,SAAU,EAAG,EAC5E,GAAK,CAAC,GAAwB,CAAE,QAAS,CAAY,EACrD,GAAK,IAAS,UAAY,CAAE,WAAU,MAAK,EAC3C,IAAK,EAAI,IAAM,EAAS,CAGf,EADR,CACQ,CAEf,CAEA,MAAa,EAAO,EAClB,EACA,MACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{c as e}from"./slot-CNhFZdHF.js";import{t}from"./useForkedRef-DVEfT-KI.js";import{t as n}from"./polymorphic-BhGNZQja.js";import{t as r}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as i}from"./useDialogElement-CgOnJAzu.js";import{t as a}from"./Icon-DLB1f88W.js";import{t as o}from"./CloseButton-DPgQztE0.js";import{t as s}from"./Button-BoymWE-L.js";import c,{createContext as l,forwardRef as u,useCallback as d,useContext as f,useId as p,useRef as m,useState as h}from"react";import g from"classnames";const _=l({close:()=>{},registerPart:()=>()=>{}}),v=()=>f(_),y=u(({"aria-describedby":t,"aria-labelledby":n,backdrop:r=`static`,children:a,className:s,closeButton:l,closeLabel:u,defaultVisible:f,instant:p,keyboard:m=!1,onClick:v,onClose:y,onClosePrevented:b,onHidden:x,onShow:S,onShown:C,onVisibleChange:w,open:T,visible:E,...D},O)=>{let{close:k,forkedRef:A,handleBackdropClick:j,handleCancel:M,hiding:N,staticBounce:P}=i({backdrop:r,defaultVisible:f,instant:p,isModal:!0,keyboard:m,onClick:v,onClose:y,onClosePrevented:b,onHidden:x,onShow:S,onShown:C,onVisibleChange:w,open:T,ref:O,visible:E}),[F,I]=h([]),L=d((e,t,n)=>{let r={id:n,kind:e,node:t};return I(e=>[...e,r]),()=>I(e=>e.filter(e=>e!==r))},[]),R=e=>F.filter(t=>t.kind===e).sort((e,t)=>e.node.compareDocumentPosition(t.node)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1).map(({id:e})=>e),z=n||e(...R(`title`)),B=t||e(...R(`description`)),V={close:k,registerPart:L};return c.createElement(_.Provider,{value:V},c.createElement(`dialog`,{"aria-describedby":B,"aria-labelledby":z,role:`alertdialog`,...D,open:T,className:g(`alert`,`dialog`,{instant:p,hiding:N,"dialog-static":P},s),onCancel:M,onClick:j,ref:A},a,l&&c.createElement(o,{label:u,onClick:k})))});y.displayName=`Alert`;function b({children:e,className:t,component:n,...r},i){let a=n??`div`;return c.createElement(a,{className:g(`alert-body`,t),...r,ref:i},e)}const x=n(b,`AlertBody`),S=u(({color:e=`default`,onClick:t,...n},r)=>{let{close:i}=v();return c.createElement(s,{color:e,"data-autofocus":``,...n,onClick:e=>{t?.(e),e.defaultPrevented||i()},ref:r})});S.displayName=`AlertCancel`;function C(e){let t=m(null),{registerPart:n}=v(),i=m({});return r(()=>{let r=t.current,a=r?.id||void 0;a!==i.current.id&&(i.current.unregister?.(),i.current=r&&a?{id:a,unregister:n(e,r,a)}:{})}),r(()=>()=>{i.current.unregister?.(),i.current={}},[n]),t}function w({children:e,className:n,component:r,id:i,...a},o){let s=r??`code`,l=p(),u=C(`description`),d=t(o,u);return c.createElement(s,{className:g(`alert-code`,n),id:i??l,...a,ref:d},e)}const T=n(w,`AlertCode`);function E({children:e,className:t,component:n,stacked:r,...i},a){let o=n??`div`;return c.createElement(o,{className:g(`alert-footer`,{stacked:r},t),...i,ref:a},e)}const D=n(E,`AlertFooter`),O=u(({className:e,color:t,...n},r)=>c.createElement(a,{className:g(`alert-icon`,t&&`icon-${t}`,e),...n,ref:r}));O.displayName=`AlertIcon`;function k({children:e,className:n,component:r,id:i,...a},o){let s=r??`p`,l=p(),u=C(`description`),d=t(o,u);return c.createElement(s,{className:n,id:i??l,...a,ref:d},e)}const A=n(k,`AlertText`);function j({children:e,className:n,component:r,id:i,...a},o){let s=r??`h2`,l=p(),u=C(`title`),d=t(o,u);return c.createElement(s,{className:g(`alert-title`,n),id:i??l,...a,ref:d},e)}const M=n(j,`AlertTitle`);export{T as a,y as c,D as i,A as n,S as o,O as r,x as s,M as t};
|
|
2
|
-
//# sourceMappingURL=alert-BXI-_qlt.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useForkedRef-DVEfT-KI.js";import{n as t}from"./lazyElement-tfMG21pZ.js";import n,{forwardRef as r,useEffect as i,useId as a,useMemo as o,useRef as s,useState as c}from"react";import l from"classnames";import{useCheckbox as u}from"react-aria";import{useToggleState as d}from"react-stately";import{Cell as f,CheckboxContext as p,Column as m,Row as h,Table as g,TableBody as _,TableHeader as v,TableLayout as y,TableLoadMoreItem as b,Virtualizer as x,useSlottedContext as S}from"react-aria-components";const C=/^\d+(\.\d+)?%?$/,w=e=>e!=null&&(typeof e==`number`||C.test(e)),T=(e,t)=>typeof e==`number`?e:e.endsWith(`%`)?parseFloat(e)/100*t:parseFloat(e);function E(e,t){let n=new Map,r=0,i=!0;for(let a of e){if(!i||!w(a.defaultWidth)){i=!1,n.set(a.id,null);continue}let e=T(a.defaultWidth,t);w(a.minWidth)&&(e=Math.max(e,T(a.minWidth,t))),w(a.maxWidth)&&(e=Math.min(e,T(a.maxWidth,t))),n.set(a.id,{id:a.id,offset:r,width:e}),r+=e}return n}const D=e=>{let t=new Map;return e.querySelectorAll(`[role="columnheader"]`).forEach(e=>{let n=Number(e.getAttribute(`aria-colindex`));!Number.isInteger(n)||n<1||t.set(n-1,{offset:e.offsetLeft,width:e.offsetWidth})}),t};function O(e,t){let[n,r]=c(0),[a,s]=c(()=>new Map);i(()=>{let e=t.current;if(!e||typeof ResizeObserver>`u`)return;let n=()=>{r(e.clientWidth),s(D(e))};n();let i=new ResizeObserver(n);return i.observe(e),()=>i.disconnect()},[t]);let l=o(()=>E(e,n),[e,n]);return o(()=>{let t=new Map;return e.forEach((e,n)=>{let r=l.get(e.id),i=a.get(n);r?t.set(e.id,r):i&&t.set(e.id,{id:e.id,...i})}),t},[e,l,a])}const k=e=>`[aria-colindex="${e+1}"]`,A=({header:e,instanceClassName:r,containerRef:a})=>{let s=t(e).props.children,c=o(()=>typeof s==`function`?[]:n.Children.toArray(s),[s]),l=c.map(e=>{if(!n.isValidElement(e))return``;let{defaultWidth:t,maxWidth:r,minWidth:i,pin:a}=e.props;return`${t??``}/${i??``}/${r??``}/${a??``}`}).join(`|`),{all:u,endIndices:d,startIndices:f}=o(()=>{let e={all:[],endIndices:[],startIndices:[]};return c.forEach((t,r)=>{if(!n.isValidElement(t))return;let{defaultWidth:i,maxWidth:a,minWidth:o,pin:s}=t.props;e.all.push({id:r,defaultWidth:i,maxWidth:a,minWidth:o}),s===`start`?e.startIndices.push(r):s===`end`&&e.endIndices.push(r)}),e},[l]),p=O(u,a),m=o(()=>{let e=new Map,t=0;for(let n=d.length-1;n>=0;n--){let r=d[n];if(r==null)continue;let i=p.get(r)?.width??0;e.set(r,{index:r,rightOffset:t}),t+=i}return e},[d,p]);if(i(()=>{let e=a.current;if(!e||m.size===0)return;let t=null,n=new Set,r=()=>{t=null;let r=e.clientWidth,i=e.scrollLeft;e.querySelectorAll(`[role="row"]`).forEach(e=>{m.forEach(({index:t,rightOffset:a})=>{let o=e.querySelector(k(t))?.parentElement;if(!o)return;let s=p.get(t);if(!s)return;let c=s.offset+s.width,l=r-a-c+i;o.style.transform=`translateX(${l}px)`,o.style.zIndex=`2`,n.add(o)})})},i=()=>{t??=requestAnimationFrame(r)};i(),e.addEventListener(`scroll`,i,{passive:!0});let o=typeof ResizeObserver>`u`?null:new ResizeObserver(i);o?.observe(e);let s=typeof MutationObserver>`u`?null:new MutationObserver(i);return s?.observe(e,{childList:!0,subtree:!0}),()=>{t!=null&&cancelAnimationFrame(t),e.removeEventListener(`scroll`,i),o?.disconnect(),s?.disconnect(),n.forEach(e=>{e.style.transform=``,e.style.zIndex=``})}},[a,m,p]),f.length===0&&d.length===0)return null;let h=[];if(f.length>0){let e=Math.max(...f);h.push(`.${r}.datagrid-scrolled-start ${k(e)} { box-shadow: var(--datagrid-pin-cue-shadow-start); }`)}if(d.length>0){let e=Math.min(...d);h.push(`.${r}.datagrid-scrolled-end ${k(e)} { box-shadow: var(--datagrid-pin-cue-shadow-end); }`)}return n.createElement(`style`,null,h.join(`
|
|
2
|
-
`))};var j=class extends y{isStickyColumn(e){let t=e.type===`column`?e.index:e.colIndex??e.index;return t!=null&&this.collection.columns[t]?.props?.pin===`start`}buildRowGroup(...e){let t=super.buildRowGroup(...e);return t.layoutInfo.rect.height=Math.max(0,t.layoutInfo.rect.height),t}};const M=r(({align:t,bordered:r,borderless:u,children:d,className:f,color:p,disabledKeys:m,estimatedRowHeight:h,footer:_,hover:v,onSelectionChange:y,onSortChange:b,rowHeight:S,selectedKeys:C,selectionMode:w=`none`,sm:T,sortDescriptor:E,...D},O)=>{let k=S===`auto`,M=o(()=>new j(k?{estimatedRowHeight:h,headingHeight:h}:{rowHeight:S}),[k,S,h]),N=s(null),P=e(O,N),F=`datagrid-${a().replace(/[^a-zA-Z0-9]/g,``)}`,[I,L]=c(!1),[R,z]=c(!1);i(()=>{let e=N.current;if(!e)return;let t=()=>{L(e.scrollLeft>0),z(Math.ceil(e.scrollLeft+e.clientWidth)<e.scrollWidth)};t(),e.addEventListener(`scroll`,t,{passive:!0});let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),()=>{e.removeEventListener(`scroll`,t),n?.disconnect()}},[]);let B=l(`datagrid`,F,p,{[`align-${t}`]:t,bordered:r,borderless:u,hoverable:v,sm:T,"datagrid-scrolled-start":I,"datagrid-scrolled-end":R},f);return n.createElement(x,{layout:M,shouldObserveItemSize:k},n.createElement(g,{"aria-label":D[`aria-label`],"aria-labelledby":D[`aria-labelledby`],className:B||void 0,disabledKeys:m,onSelectionChange:y,onSortChange:b,ref:P,selectedKeys:C,selectionMode:w,sortDescriptor:E,render:e=>n.createElement(`div`,{...e,"aria-describedby":e[`aria-describedby`]||void 0})},d),_&&n.createElement(`div`,{className:l(`datagrid-footer`,{borderless:u})},_),n.createElement(A,{containerRef:N,header:d[0],instanceClassName:F}))});M.displayName=`DataGrid`;const N={id:`__datagrid-body-loader__`},P=({children:e,className:t,dependencies:r,isLoading:i,items:a,loadingContent:s,onLoadMore:c,renderEmptyState:u})=>{let d=c!=null&&a!=null,f=o(()=>d?[...a,N]:a,[d,a]),p=o(()=>d?[...r??[],i,c,s]:r,[r,d,i,c,s]),m=d?t=>t===N?n.createElement(b,{className:`datagrid-loader`,isLoading:i,onLoadMore:i?void 0:c},s):e(t):e;return n.createElement(_,{className:l(`datagrid-body`,t),dependencies:p,items:f,renderEmptyState:u},m)},F=({children:e,className:t,colSpan:r,id:i,textValue:a})=>n.createElement(f,{className:l(`datagrid-cell`,t),colSpan:r,id:i,textValue:a},e),I=({allowsSorting:e,children:t,className:r,defaultWidth:i,id:a,isRowHeader:o,maxWidth:s,minWidth:c,pin:u,textValue:d})=>n.createElement(m,{allowsSorting:e,className:l(`datagrid-col`,u&&`datagrid-col-pinned-${u}`,r),defaultWidth:i,id:a,isRowHeader:o,maxWidth:s,minWidth:c,textValue:d,pin:u},e?({sortDirection:e})=>n.createElement(n.Fragment,null,t,n.createElement(`span`,{"aria-hidden":`true`,className:`datagrid-sort-icon`},e===`ascending`?`▲`:e===`descending`?`▼`:`⇅`)):t),L=({children:e,className:t,columns:r,dependencies:i})=>n.createElement(v,{className:l(`datagrid-header`,t),columns:r,dependencies:i},e),R=({children:e,className:t,columns:r,id:i,textValue:a})=>n.createElement(h,{className:l(`datagrid-row`,t),columns:r,id:i,textValue:a},e),z=e=>{let t=S(p,`selection`);if(!t)throw Error(`${e} must be rendered inside a DataGrid with selection enabled.`);return t},B=({className:e})=>{let t=z(`DataGridSelectionCell`);return n.createElement(H,{checkboxProps:t,className:e})},V=({className:e})=>{let t=z(`DataGridSelectAllCell`);return n.createElement(H,{checkboxProps:t,className:e})},H=({checkboxProps:e,className:t})=>{let r=d(e),i=s(null),{inputProps:a}=u(e,r,i);return n.createElement(`input`,{...a,"aria-describedby":void 0,className:t??`check-input`,ref:i})};export{I as a,M as c,L as i,B as n,F as o,R as r,P as s,V as t};
|
|
3
|
-
//# sourceMappingURL=datagrid-CH3Cy-q7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datagrid-CH3Cy-q7.js","names":["AriaTable","AriaTableBody","AriaCell","AriaColumn","AriaTableHeader","AriaRow"],"sources":["../../src/components/datagrid/useColumnGeometry.ts","../../src/components/datagrid/DataGridPinBehavior.tsx","../../src/components/datagrid/DataGridTableLayout.ts","../../src/components/datagrid/DataGrid.tsx","../../src/components/datagrid/DataGridBody.tsx","../../src/components/datagrid/DataGridCell.tsx","../../src/components/datagrid/DataGridColumn.tsx","../../src/components/datagrid/DataGridHeader.tsx","../../src/components/datagrid/DataGridRow.tsx","../../src/components/datagrid/DataGridSelectionCell.tsx"],"sourcesContent":["import { RefObject, useEffect, useMemo, useState } from 'react'\nimport { Key } from 'react-aria-components'\nimport { ColumnSize, ColumnStaticSize } from 'react-stately'\n\nexport interface ColumnGeometryColumn {\n /**\n * The column's unique id — matches `DataGridColumn`'s `id`/collection key.\n */\n id: Key\n /**\n * Mirrors `DataGridColumn`'s prop of the same name.\n */\n defaultWidth?: ColumnSize | null\n /**\n * Mirrors `DataGridColumn`'s prop of the same name.\n */\n minWidth?: ColumnStaticSize | null\n /**\n * Mirrors `DataGridColumn`'s prop of the same name.\n */\n maxWidth?: ColumnStaticSize | null\n}\n\nexport interface ColumnOffset {\n id: Key\n /**\n * Cumulative distance in pixels from the start edge of the row to this column's start edge.\n */\n offset: number\n width: number\n}\n\nconst STATIC_SIZE_PATTERN = /^\\d+(\\.\\d+)?%?$/\n\n/**\n * Whether a `ColumnSize` resolves to a definite pixel value without waiting for layout: a plain\n * number, a numeric string (`'150'`), or a percentage string (`'50%'`) — resolvable as soon as\n * the container's own width is known. An `'<n>fr'` string is proportional — it only resolves to\n * pixels once the layout engine has distributed the container's remaining space among every\n * fractional column, so it's excluded here.\n */\nexport const isStaticColumnSize = (size: ColumnSize | null | undefined): size is ColumnStaticSize =>\n size != null && (typeof size === 'number' || STATIC_SIZE_PATTERN.test(size))\n\nconst resolveStaticWidth = (size: ColumnStaticSize, containerWidth: number): number => {\n if (typeof size === 'number') return size\n return size.endsWith('%') ? (parseFloat(size) / 100) * containerWidth : parseFloat(size)\n}\n\n/**\n * Computes cumulative left-edge offsets for a list of columns from their declared\n * `defaultWidth`/`minWidth`/`maxWidth` props, without reading the DOM. Only correct for a column\n * whose own width — and every preceding column's width — is statically resolvable (see\n * `isStaticColumnSize`): a column at or after the first `fr`-sized column has no offset that can\n * be known before layout runs, so it resolves to `null`. Callers should fall back to\n * `useColumnGeometry`'s DOM measurement for those.\n */\nexport function calculateStaticColumnOffsets(\n columns: readonly ColumnGeometryColumn[],\n containerWidth: number\n): Map<Key, ColumnOffset | null> {\n const offsets = new Map<Key, ColumnOffset | null>()\n let offset = 0\n let resolvable = true\n\n for (const column of columns) {\n if (!resolvable || !isStaticColumnSize(column.defaultWidth)) {\n resolvable = false\n offsets.set(column.id, null)\n continue\n }\n\n let width = resolveStaticWidth(column.defaultWidth, containerWidth)\n if (isStaticColumnSize(column.minWidth)) {\n width = Math.max(width, resolveStaticWidth(column.minWidth, containerWidth))\n }\n if (isStaticColumnSize(column.maxWidth)) {\n width = Math.min(width, resolveStaticWidth(column.maxWidth, containerWidth))\n }\n\n offsets.set(column.id, { id: column.id, offset, width })\n offset += width\n }\n\n return offsets\n}\n\ninterface MeasuredRect {\n offset: number\n width: number\n}\n\n/**\n * Measures the mounted column-header cells, keyed by their 0-based column position.\n *\n * Keyed off each cell's own `aria-colindex` (1-based, assigned from the column's position in the\n * resolved collection) rather than its position among the cells that happen to be in the DOM: the\n * layout engine windows columns horizontally as well as rows, so `querySelectorAll` returns only\n * the headers intersecting the horizontal viewport. Matching those positionally to the full column\n * list — as this used to — mapped every column past the first unmounted one onto the wrong rect.\n * A header without the attribute is skipped rather than guessed at.\n */\nconst measureColumnHeaders = (container: HTMLElement): Map<number, MeasuredRect> => {\n const measured = new Map<number, MeasuredRect>()\n container.querySelectorAll<HTMLElement>('[role=\"columnheader\"]').forEach((cell) => {\n const colIndex = Number(cell.getAttribute('aria-colindex'))\n if (!Number.isInteger(colIndex) || colIndex < 1) return\n measured.set(colIndex - 1, { offset: cell.offsetLeft, width: cell.offsetWidth })\n })\n return measured\n}\n\n/**\n * Resolves each column's rendered left-offset and width, independent of the virtualizer's\n * private layout internals. Statically-sized columns (see `isStaticColumnSize`) resolve\n * immediately from their declared props; `fr`-sized (proportional) columns fall back to\n * `ResizeObserver`-measured DOM rects of the mounted `[role=\"columnheader\"]` cells inside\n * `containerRef`, matched to `columns` by `aria-colindex` (see `measureColumnHeaders`), since\n * those only resolve to real pixels after the layout engine has actually distributed space.\n */\nexport function useColumnGeometry(\n columns: readonly ColumnGeometryColumn[],\n containerRef: RefObject<HTMLElement | null>\n): Map<Key, ColumnOffset> {\n const [containerWidth, setContainerWidth] = useState(0)\n const [measured, setMeasured] = useState<Map<number, MeasuredRect>>(() => new Map())\n\n useEffect(() => {\n const container = containerRef.current\n if (!container || typeof ResizeObserver === 'undefined') return\n\n const measure = () => {\n setContainerWidth(container.clientWidth)\n setMeasured(measureColumnHeaders(container))\n }\n\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(container)\n return () => observer.disconnect()\n }, [containerRef])\n\n const staticOffsets = useMemo(\n () => calculateStaticColumnOffsets(columns, containerWidth),\n [columns, containerWidth]\n )\n\n return useMemo(() => {\n const result = new Map<Key, ColumnOffset>()\n columns.forEach((column, index) => {\n const staticOffset = staticOffsets.get(column.id)\n const measuredRect = measured.get(index)\n if (staticOffset) {\n result.set(column.id, staticOffset)\n } else if (measuredRect) {\n result.set(column.id, { id: column.id, ...measuredRect })\n }\n })\n return result\n }, [columns, staticOffsets, measured])\n}\n","import React, { ReactElement, RefObject, useEffect, useMemo } from 'react'\n\nimport { resolveLazy } from '../../utils/lazyElement'\nimport { DataGridColumnProps } from './DataGridColumn'\nimport { DataGridHeaderProps } from './DataGridHeader'\nimport { ColumnGeometryColumn, useColumnGeometry } from './useColumnGeometry'\n\nexport interface DataGridPinBehaviorProps<T> {\n /**\n * The same header element passed as `DataGrid`'s first child. Read directly (rather than via\n * `TableStateContext`) because react-aria-components' virtualized `<Table>` only ever renders\n * DOM output for its own collection-derived tree — an arbitrary extra child (like this\n * component, if it were nested inside `<Table>`) never mounts, regardless of context\n * availability. Only the static-children form of `DataGridHeader` can be introspected this\n * way; the `columns`/render-function form gets no pinned-column behavior from here (`pin=\n * \"start\"`'s positioning still works either way — see `DataGridTableLayout`, which reads pin\n * state off the resolved collection instead, not off this introspection).\n */\n header: ReactElement<DataGridHeaderProps<T>>\n /**\n * A CSS class unique to this `DataGrid` instance, scoping the generated rules below so\n * multiple grids on the same page (with different pinned columns) don't collide.\n */\n instanceClassName: string\n /**\n * Ref to `DataGrid`'s own scrolling root — used both to measure `fr`-sized pinned columns via\n * `useColumnGeometry` and, for `pin=\"end\"`, to find and reposition its cells on scroll (see\n * below).\n */\n containerRef: RefObject<HTMLElement | null>\n}\n\ninterface PinnedColumnInfo {\n index: number\n /** Cumulative width of the end-pinned columns after this one — its distance from the edge. */\n rightOffset: number\n}\n\ninterface DeclaredColumns {\n all: ColumnGeometryColumn[]\n endIndices: number[]\n startIndices: number[]\n}\n\n/**\n * A cell's (1-based) `aria-colindex` for the (0-based) column position it was declared at.\n *\n * Every cell and column header react-aria-components renders carries `aria-colindex`, set from the\n * column's position in the resolved collection — which is the declaration order this component\n * reads off the header's JSX. That makes it the one stable handle from a declared column back to\n * its rendered DOM, and the reason nothing here counts DOM children: the layout engine windows\n * columns horizontally as well as rows (only the cells intersecting the horizontal viewport are\n * mounted, see `datagrid.mdx`'s Scope section), so a row's child count is the size of the mounted\n * window, not the column count. The `nth-child`/`nth-last-child` arithmetic this used to do was\n * therefore only correct while every column happened to be mounted, and silently moved and\n * shadowed the wrong cells in exactly the wide grids pinning exists for.\n */\nconst colIndexSelector = (index: number) => `[aria-colindex=\"${index + 1}\"]`\n\n/**\n * Handles the two things `DataGrid`'s own layout subclass (`DataGridTableLayout`) can't:\n *\n * - `pin=\"end\"`'s positioning. `DataGridTableLayout` reuses the layout engine's own sticky\n * mechanism for `pin=\"start\"`, but that mechanism is hardcoded to the leading edge — there's no\n * upstream hook for a trailing-edge pin. A pure-CSS `position: sticky; right: 0` equivalent\n * doesn't work either: for the *last* child of a horizontally-scrolling container, the browser's\n * own max-scroll bound is defined such that its gap to the viewport's trailing edge never goes\n * negative until the very last pixel of scroll — sticky has nothing to correct until then, so it\n * renders exactly like `position: absolute` for the entire scroll range up to that point (this is\n * a well-known, verified-here CSS limitation, not specific to this layout). So `pin=\"end\"` is\n * positioned imperatively instead: on every scroll (and on mount/resize), each `pin=\"end\"`\n * column's auto-generated wrapper div gets a `transform: translateX(...)` that keeps it flush\n * against the scroll viewport's trailing edge, computed from `useColumnGeometry`'s cumulative\n * offsets, plus the `z-index` that keeps it above the cells it now overlaps. This bypasses React\n * for those two styles, similar to how other virtualized grids (e.g. AG-Grid) handle right-pinned\n * columns — react-aria-components' own layout doesn't re-render an already-mounted cell's style on\n * a plain scroll (its `layoutInfo` doesn't depend on scroll position), so there's no fight between\n * this and React's own reconciliation; newly-mounted rows (from vertical scroll bringing fresh\n * cells into the virtualized window) are covered by the same scroll-driven sync running again.\n * - The scroll-cue box-shadow on the boundary column of each pinned group (the last `pin=\"start\"`\n * column, the first `pin=\"end\"` column) — shown only once the grid has actually scrolled far\n * enough to hide content under it, via the `datagrid-scrolled-start`/`datagrid-scrolled-end`\n * classes `DataGrid` toggles on scroll. This part stays pure CSS since box-shadow, unlike\n * sticky's position offsets, has no \"last child\" gotcha.\n *\n * Rendered as a plain sibling of `DataGrid`'s `<Table>`, not inside it.\n */\nexport const DataGridPinBehavior = <T extends object>({\n header,\n instanceClassName,\n containerRef\n}: DataGridPinBehaviorProps<T>) => {\n // A header written in a Server Component can arrive as a lazy node (see `utils/lazyElement`).\n const headerChildren = resolveLazy(header).props.children\n\n // Re-derived only when a column's own sizing/pin props actually change, not on every parent\n // render: `useColumnGeometry` keys its memoized result off this array's identity, and the\n // scroll-sync effect below keys off that result in turn — rebuilding it unconditionally tore\n // down and re-registered the effect's scroll listener and its two observers on every single\n // `DataGrid` render.\n const columnElements = useMemo(\n () => (typeof headerChildren === 'function' ? [] : React.Children.toArray(headerChildren)),\n [headerChildren]\n )\n const declaredKey = columnElements\n .map((element) => {\n if (!React.isValidElement<DataGridColumnProps>(element)) return ''\n const { defaultWidth, maxWidth, minWidth, pin } = element.props\n return `${defaultWidth ?? ''}/${minWidth ?? ''}/${maxWidth ?? ''}/${pin ?? ''}`\n })\n .join('|')\n\n const {\n all: allColumns,\n endIndices,\n startIndices\n } = useMemo<DeclaredColumns>(() => {\n const declared: DeclaredColumns = { all: [], endIndices: [], startIndices: [] }\n columnElements.forEach((element, index) => {\n if (!React.isValidElement<DataGridColumnProps>(element)) return\n const { defaultWidth, maxWidth, minWidth, pin } = element.props\n declared.all.push({ id: index, defaultWidth, maxWidth, minWidth })\n if (pin === 'start') declared.startIndices.push(index)\n else if (pin === 'end') declared.endIndices.push(index)\n })\n return declared\n // `declaredKey` is the value-based identity of `columnElements` — a fresh JSX array every\n // render, so its own reference can't be the dependency.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [declaredKey])\n\n const offsets = useColumnGeometry(allColumns, containerRef)\n\n // Cumulative width of the end-pinned columns after this one, keyed by column index — how far\n // from the viewport's trailing edge each one needs to sit so they stack correctly.\n const endPinnedInfo = useMemo(() => {\n const info = new Map<number, PinnedColumnInfo>()\n let right = 0\n for (let i = endIndices.length - 1; i >= 0; i--) {\n const index = endIndices[i]\n if (index == null) continue\n const width = offsets.get(index)?.width ?? 0\n info.set(index, { index, rightOffset: right })\n right += width\n }\n return info\n }, [endIndices, offsets])\n\n useEffect(() => {\n const container = containerRef.current\n if (!container || endPinnedInfo.size === 0) return\n\n let frame: number | null = null\n // The wrappers this effect has written inline styles onto, so they can be handed back\n // unstyled when it tears down — un-pinning a column at runtime (or unmounting this behavior\n // while the grid stays) otherwise left its cells stuck at their last scroll offset.\n const styled = new Set<HTMLElement>()\n\n const sync = () => {\n frame = null\n const clientWidth = container.clientWidth\n const scrollLeft = container.scrollLeft\n const rows = container.querySelectorAll<HTMLElement>('[role=\"row\"]')\n rows.forEach((row) => {\n endPinnedInfo.forEach(({ index, rightOffset }) => {\n const cell = row.querySelector<HTMLElement>(colIndexSelector(index))\n const wrapper = cell?.parentElement\n if (!wrapper) return\n const offset = offsets.get(index)\n if (!offset) return\n const rightEdge = offset.offset + offset.width\n const delta = clientWidth - rightOffset - rightEdge + scrollLeft\n wrapper.style.transform = `translateX(${delta}px)`\n // Above the unpinned cells it now overlaps. Set here rather than in the generated\n // stylesheet below because the virtualizer writes the wrapper's own `z-index` inline,\n // which no plain rule can outrank without `!important`.\n wrapper.style.zIndex = '2'\n styled.add(wrapper)\n })\n })\n }\n\n const scheduleSync = () => {\n if (frame == null) frame = requestAnimationFrame(sync)\n }\n\n scheduleSync()\n container.addEventListener('scroll', scheduleSync, { passive: true })\n const resizeObserver =\n typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(scheduleSync)\n resizeObserver?.observe(container)\n const mutationObserver =\n typeof MutationObserver === 'undefined' ? null : new MutationObserver(scheduleSync)\n mutationObserver?.observe(container, { childList: true, subtree: true })\n\n return () => {\n if (frame != null) cancelAnimationFrame(frame)\n container.removeEventListener('scroll', scheduleSync)\n resizeObserver?.disconnect()\n mutationObserver?.disconnect()\n styled.forEach((wrapper) => {\n wrapper.style.transform = ''\n wrapper.style.zIndex = ''\n })\n }\n }, [containerRef, endPinnedInfo, offsets])\n\n if (startIndices.length === 0 && endIndices.length === 0) return null\n\n const rules: string[] = []\n\n if (startIndices.length > 0) {\n const lastStartIndex = Math.max(...startIndices)\n rules.push(\n `.${instanceClassName}.datagrid-scrolled-start ${colIndexSelector(lastStartIndex)} { box-shadow: var(--datagrid-pin-cue-shadow-start); }`\n )\n }\n\n if (endIndices.length > 0) {\n const firstEndIndex = Math.min(...endIndices)\n rules.push(\n `.${instanceClassName}.datagrid-scrolled-end ${colIndexSelector(firstEndIndex)} { box-shadow: var(--datagrid-pin-cue-shadow-end); }`\n )\n }\n\n return <style>{rules.join('\\n')}</style>\n}\n","import { TableLayout } from 'react-aria-components'\n\ninterface StickyColumnNode {\n type: string\n index: number\n colIndex?: number | null\n}\n\n/**\n * `DataGrid`'s own subclass of react-aria-components' `TableLayout`, overriding the (protected,\n * hardcoded-`false` upstream) `isStickyColumn` hook so a `pin=\"start\"` `DataGridColumn` uses the\n * layout engine's own sticky-positioning machinery — the same mechanism that already makes the\n * header row pin to the top (`buildTableHeader` sets `layoutInfo.isSticky = true` unconditionally\n * there). The subclass exists instead of a pure-CSS `position: sticky` override because\n * react-aria-components' own `TableLayout` never overrides `isStickyColumn`, so no column becomes\n * visually sticky by default — and because the engine, not CSS, owns each cell wrapper's `left`.\n *\n * `pin=\"end\"` isn't handled here — the engine's sticky positioning is hardcoded to the leading\n * edge (`position: sticky; left: ...`, mirrored to `right` only for RTL *direction*, never per\n * column), so there's no upstream mechanism to reuse for a trailing pin in an LTR grid. See\n * `DataGrid.scss`'s `nth-last-child`-based rules for that half instead.\n */\nexport class DataGridTableLayout<T> extends TableLayout<T> {\n protected isStickyColumn(node: StickyColumnNode): boolean {\n const colIndex = node.type === 'column' ? node.index : (node.colIndex ?? node.index)\n if (colIndex == null) return false\n const column = this.collection.columns[colIndex]\n return (column?.props as { pin?: 'start' | 'end' } | undefined)?.pin === 'start'\n }\n\n // An empty body fills the viewport below the header. On the server the viewport has no size,\n // so the body came out as tall as minus the header (`height: -40px`), which CSS doesn't allow.\n protected buildRowGroup(...args: Parameters<TableLayout<T>['buildRowGroup']>) {\n const group = super.buildRowGroup(...args)\n group.layoutInfo.rect.height = Math.max(0, group.layoutInfo.rect.height)\n return group\n }\n}\n","import React, {\n ReactElement,\n ReactNode,\n Ref,\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState\n} from 'react'\nimport classNames from 'classnames'\nimport {\n Key,\n Selection,\n SortDescriptor,\n Table as AriaTable,\n Virtualizer\n} from 'react-aria-components'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { ContextColor } from '../../types'\nimport { DataGridBodyProps } from './DataGridBody'\nimport { DataGridHeaderProps } from './DataGridHeader'\nimport { DataGridPinBehavior } from './DataGridPinBehavior'\nimport { DataGridTableLayout } from './DataGridTableLayout'\nimport './DataGrid.scss'\n\n// No `striped`/`stacked` props: zebra-striping via CSS `:nth-of-type` (Table's approach) isn't\n// virtualization-safe — a windowed row's DOM siblings are only the currently-mounted rows, not\n// every logical row, so the stripe parity would flip as the mounted window's starting index\n// changes during scroll. A correct implementation needs the row's real index at render time, not\n// a pure-CSS trick; deferred rather than shipped broken.\ninterface DataGridOwnProps<T extends object> {\n /**\n * An accessible label for the grid, used when there's no visible heading.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible heading element for the grid.\n */\n 'aria-labelledby'?: string\n /**\n * Set the vertical alignment of cell content. Mirrors `Table`'s prop of the same name for API\n * parity — same as `Table`, this awaits chassis-css adding the matching `.align-*` styles.\n */\n align?: 'bottom' | 'middle' | 'top'\n /**\n * Add borders on all sides of the grid and cells.\n */\n bordered?: boolean\n /**\n * Remove borders on all sides of the grid and cells.\n */\n borderless?: boolean\n /**\n * A `DataGridHeader` and a `DataGridBody`, each built from `DataGridColumn`/`DataGridRow`/\n * `DataGridCell`.\n */\n children: [ReactElement<DataGridHeaderProps<T>>, ReactElement<DataGridBodyProps<T>>]\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component.\n */\n color?: ContextColor\n /**\n * A list of row keys to disable. Disabled rows cannot be selected, focused, or interacted with.\n */\n disabledKeys?: Iterable<Key>\n /**\n * Content shown below the grid, e.g. a totals row or a \"load more\" control. Rendered as plain\n * markup outside the grid's own scrollable/virtualized region — not part of the\n * keyboard-navigable grid, and never scrolls out of view along with the body rows. Mirrors\n * `Table`'s `footer` prop for API parity.\n */\n footer?: ReactNode\n /**\n * Enable a hover state on grid rows.\n */\n hover?: boolean\n /**\n * Handler that is called when the selection changes.\n */\n onSelectionChange?: (keys: Selection) => void\n /**\n * Handler that is called when a column is sorted.\n */\n onSortChange?: (descriptor: SortDescriptor) => void\n /**\n * The currently selected row keys (controlled).\n */\n selectedKeys?: Selection\n /**\n * The type of selection that is allowed.\n */\n selectionMode?: 'none' | 'single' | 'multiple'\n /**\n * Make the grid more compact by cutting all cell padding.\n */\n sm?: boolean\n /**\n * The current sort column and direction.\n */\n sortDescriptor?: SortDescriptor\n}\n\ntype DataGridRowHeightProps =\n | {\n /**\n * Row height in pixels, or `\"auto\"` to measure each row from its own rendered content\n * instead of a single fixed height shared by every row (pair it with a required\n * `estimatedRowHeight`, and see the docs site's \"Variable row height\" section for the\n * tradeoffs). A fixed number renders every row, including the header, at that exact\n * height; content taller than it visually overflows rather than growing the row.\n */\n rowHeight: number\n estimatedRowHeight?: never\n }\n | {\n rowHeight: 'auto'\n /**\n * Seeds the virtualizer's scroll-position math for rows that haven't been measured yet.\n * Required when `rowHeight=\"auto\"` — pick a value close to the typical row's real height\n * to minimize scroll-jump on first measurement. A row's real height can still turn out far\n * from this estimate once it renders, which can cause a visible scroll-jump for rows the\n * viewport hasn't reached yet.\n */\n estimatedRowHeight: number\n }\n\nexport type DataGridProps<T extends object> = DataGridOwnProps<T> & DataGridRowHeightProps\n\nconst DataGridInner = <T extends object>(\n {\n align,\n bordered,\n borderless,\n children,\n className,\n color,\n disabledKeys,\n estimatedRowHeight,\n footer,\n hover,\n onSelectionChange,\n onSortChange,\n rowHeight,\n selectedKeys,\n selectionMode = 'none',\n sm,\n sortDescriptor,\n ...rest\n }: DataGridProps<T>,\n forwardedRef: Ref<HTMLDivElement>\n) => {\n const isVariableRowHeight = rowHeight === 'auto'\n const layout = useMemo(\n () =>\n new DataGridTableLayout<T>(\n // `headingHeight` is pinned to `estimatedRowHeight` (fixed, not itself an estimate) in\n // variable-height mode — leaving it unset falls back to `estimatedRowHeight` as an\n // *estimate* for the header too, which sounds harmless but isn't: the header's own\n // sticky-positioned outer wrapper (built once in `buildTableHeader`, see\n // `DataGridTableLayout`'s doc comment for why the header is sticky at all) is never\n // recomputed when a column-header cell's later real measurement corrects its height, so\n // the outer wrapper's stale height desyncs from the cell's real one, spilling header\n // content into the body's first row instead of the header growing to fit it. Fixing the\n // header's height sidesteps that gap instead of shipping it.\n isVariableRowHeight\n ? { estimatedRowHeight, headingHeight: estimatedRowHeight }\n : { rowHeight }\n ),\n [isVariableRowHeight, rowHeight, estimatedRowHeight]\n )\n const gridRef = useRef<HTMLDivElement>(null)\n const ref = useForkedRef(forwardedRef, gridRef)\n\n // A stable per-instance class, scoping DataGridPinBehavior's generated CSS so multiple grids on\n // the same page (each with their own pinned columns) don't collide.\n const rawId = useId()\n const instanceClassName = `datagrid-${rawId.replace(/[^a-zA-Z0-9]/g, '')}`\n\n // Drives the pin=start/pin=end scroll-cue box-shadow — see DataGridPinBehavior — which should\n // only appear once there's actually hidden content under the pinned column to cue.\n const [scrolledStart, setScrolledStart] = useState(false)\n const [scrolledEnd, setScrolledEnd] = useState(false)\n\n useEffect(() => {\n const grid = gridRef.current\n if (!grid) return\n\n const updateScrollState = () => {\n setScrolledStart(grid.scrollLeft > 0)\n setScrolledEnd(Math.ceil(grid.scrollLeft + grid.clientWidth) < grid.scrollWidth)\n }\n\n updateScrollState()\n grid.addEventListener('scroll', updateScrollState, { passive: true })\n const observer =\n typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(updateScrollState)\n observer?.observe(grid)\n return () => {\n grid.removeEventListener('scroll', updateScrollState)\n observer?.disconnect()\n }\n }, [])\n\n const _className = classNames(\n 'datagrid',\n instanceClassName,\n color,\n {\n [`align-${align}`]: align,\n bordered,\n borderless,\n hoverable: hover,\n sm,\n 'datagrid-scrolled-start': scrolledStart,\n 'datagrid-scrolled-end': scrolledEnd\n },\n className\n )\n\n return (\n <Virtualizer layout={layout} shouldObserveItemSize={isVariableRowHeight}>\n <AriaTable\n aria-label={rest['aria-label']}\n aria-labelledby={rest['aria-labelledby']}\n className={_className || undefined}\n disabledKeys={disabledKeys}\n onSelectionChange={onSelectionChange}\n onSortChange={onSortChange}\n ref={ref}\n selectedKeys={selectedKeys}\n selectionMode={selectionMode}\n sortDescriptor={sortDescriptor}\n // react-aria joins the grid's descriptions without dropping an empty result, so a grid\n // with none had `aria-describedby=\"\"`.\n render={(props) => (\n <div\n {...(props as React.ComponentProps<'div'>)}\n aria-describedby={props['aria-describedby'] || undefined}\n />\n )}\n >\n {children}\n </AriaTable>\n {footer && <div className={classNames('datagrid-footer', { borderless })}>{footer}</div>}\n <DataGridPinBehavior\n containerRef={gridRef}\n header={children[0]}\n instanceClassName={instanceClassName}\n />\n </Virtualizer>\n )\n}\n\n// `forwardRef` erases type parameters, so the generic component is cast back to a generic\n// signature for callers — same pattern `Table` uses.\nexport const DataGrid = forwardRef(DataGridInner) as <T extends object>(\n props: DataGridProps<T> & { ref?: Ref<HTMLDivElement> }\n) => ReactElement\n\n;(DataGrid as { displayName?: string }).displayName = 'DataGrid'\n","import React, { ReactElement, ReactNode, useMemo } from 'react'\nimport classNames from 'classnames'\nimport {\n TableBody as AriaTableBody,\n TableBodyRenderProps,\n TableLoadMoreItem\n} from 'react-aria-components'\n\n// A unique value appended to `items` internally to represent the trailing \"load more\" row in\n// react-aria-components' collection. `TableLoadMoreItem` has to be returned from the per-item\n// render function like any other row — react-aria-components' `useCachedChildren` only supports\n// EITHER `items` + a render function OR static `children`, never a mix of both in the same\n// `children` prop, so a `<TableLoadMoreItem>` placed as a plain JSX sibling inside `<TableBody>`\n// is silently dropped (or crashes, if `children` becomes an array mixing the render function in).\n// Checked by reference (`item === LOADER_ITEM`), so it can never collide with a real `T` the way a\n// `{ __loader: true }` marker object might if compared structurally. Its `id` matters too, not\n// just its identity: react-aria-components derives each rendered item's React key from\n// `rendered.props.id ?? item?.key ?? item?.id ?? <positional index>` (`useCachedChildren`) —\n// `TableLoadMoreItem` doesn't accept an `id` prop itself, so without this object's own `id` the\n// loader's key falls back to its position in the array, which collides with a real row whenever a\n// row's own `id` happens to equal that count (e.g. a 2-item list with a row literally id `\"2\"`).\nconst LOADER_ITEM = { id: '__datagrid-body-loader__' }\n\ninterface DataGridBodyOwnProps {\n /**\n * A string of all className you want applied to the body row group.\n */\n className?: string\n /**\n * Values that should invalidate the row cache when using the `items`/render-function form of\n * `children` — e.g. a value from outside `items` that the render function reads. Without this,\n * changing that outside value won't re-render already-cached rows, since dynamic rows are only\n * rebuilt when `items` or `dependencies` change by reference, not on every parent re-render.\n */\n dependencies?: ReadonlyArray<unknown>\n /**\n * Content shown in place of rows when `items` is empty.\n */\n renderEmptyState?: (props: TableBodyRenderProps) => React.ReactNode\n}\n\n/**\n * The `items` + render-function form. `isLoading`/`loadingContent`/`onLoadMore` live here rather\n * than alongside the static form because the loader row is generated by appending to `items` and\n * rendering through that same function — there's no growing dataset to load more of, and nothing\n * to render the loader with, in a hand-written list of `DataGridRow` elements.\n */\ninterface DataGridBodyDynamicProps<T> {\n /**\n * A render function called once per item in `items`, returning that row's `DataGridRow`.\n */\n children: (item: T) => ReactElement\n /**\n * Whether more items are currently being fetched. Shows `loadingContent` in the loader row while\n * true, and — until this goes back to `false` — suppresses further `onLoadMore` calls, so one\n * scroll-into-view doesn't fire the callback again before the in-flight fetch resolves.\n */\n isLoading?: boolean\n /**\n * A list of row data objects, rendered via the function form of `children`.\n */\n items: Iterable<T>\n /**\n * Content rendered inside the loader row while `isLoading` is true, e.g. a spinner. Only takes\n * effect alongside `onLoadMore`.\n */\n loadingContent?: ReactNode\n /**\n * Called when the grid scrolls near its last row, so more data can be fetched and appended to\n * `items`. Pair with `isLoading` so a fetch already in flight isn't triggered again before it\n * resolves.\n */\n onLoadMore?: () => void\n}\n\n/** The static form: `DataGridRow` elements written out directly. */\ninterface DataGridBodyStaticProps {\n /**\n * `DataGridRow` elements.\n */\n children: ReactElement | ReactElement[]\n isLoading?: never\n items?: never\n loadingContent?: never\n onLoadMore?: never\n}\n\n/**\n * Split into a static and a dynamic form so the two can't be mixed: the loader row is appended to\n * `items` and rendered through `children`, so `onLoadMore` alongside a static list of elements used\n * to type-check and then throw at render (\"children is not a function\") the moment the loader row\n * came up.\n */\nexport type DataGridBodyProps<T> = DataGridBodyOwnProps &\n (DataGridBodyDynamicProps<T> | DataGridBodyStaticProps)\n\n/**\n * Body row group for `DataGrid`, containing `DataGridRow`s. Unlike `Table`'s sub-parts, this\n * renders directly — it's a thin wrapper over react-aria-components' own `TableBody`.\n *\n * Always carries the `datagrid-body` class — see `DataGridHeader`'s equivalent note.\n */\nexport const DataGridBody = <T extends object>({\n children,\n className,\n dependencies,\n isLoading,\n items,\n loadingContent,\n onLoadMore,\n renderEmptyState\n}: DataGridBodyProps<T>) => {\n const hasLoader = onLoadMore != null && items != null\n\n const itemsWithLoader = useMemo(() => {\n if (!hasLoader) return items\n return [...(items as Iterable<T>), LOADER_ITEM] as Iterable<T>\n }, [hasLoader, items])\n\n // react-aria-components caches each rendered row by item identity (see `dependencies`'s own doc\n // comment above) — the loader branch below reads `isLoading`/`onLoadMore`/`loadingContent`, none\n // of which are part of `items`, so without surfacing them here the cached loader row would keep\n // whatever `isLoading` value (and stale `onLoadMore` closure) was in scope the first time it\n // rendered, never picking up a later change.\n const dependenciesWithLoader = useMemo(\n () =>\n hasLoader ? [...(dependencies ?? []), isLoading, onLoadMore, loadingContent] : dependencies,\n [dependencies, hasLoader, isLoading, onLoadMore, loadingContent]\n )\n\n const bodyChildren = hasLoader\n ? (item: T) =>\n (item as unknown) === LOADER_ITEM ? (\n <TableLoadMoreItem\n className=\"datagrid-loader\"\n isLoading={isLoading}\n // Suppresses re-triggering onLoadMore while a fetch is already in flight — the\n // underlying sentinel has no built-in debounce of its own and calls onLoadMore again\n // whenever it (re-)observes the sentinel still intersecting, e.g. after the collection\n // changes but the loader row hasn't yet scrolled out of view.\n onLoadMore={isLoading ? undefined : onLoadMore}\n >\n {loadingContent}\n </TableLoadMoreItem>\n ) : (\n // `hasLoader` implies the dynamic form of the props union, whose `children` is the\n // render function — `onLoadMore` isn't assignable alongside static children.\n (children as (item: T) => ReactElement)(item)\n )\n : children\n\n return (\n <AriaTableBody\n className={classNames('datagrid-body', className)}\n dependencies={dependenciesWithLoader}\n items={itemsWithLoader}\n renderEmptyState={renderEmptyState}\n >\n {bodyChildren}\n </AriaTableBody>\n )\n}\n","import React, { ReactNode } from 'react'\nimport { Key, Cell as AriaCell } from 'react-aria-components'\nimport classNames from 'classnames'\n\nexport interface DataGridCellProps {\n /**\n * The contents of the cell.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the cell.\n */\n className?: string\n /**\n * Indicates how many columns the cell spans.\n */\n colSpan?: number\n /**\n * The unique id of the cell.\n */\n id?: Key\n /**\n * A string representation of the cell's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * A cell within a `DataGrid` row. Unlike `Table`'s sub-parts, this renders directly — it's a\n * thin wrapper over react-aria-components' own `Cell`.\n */\nexport const DataGridCell = ({\n children,\n className,\n colSpan,\n id,\n textValue\n}: DataGridCellProps) => (\n <AriaCell\n className={classNames('datagrid-cell', className)}\n colSpan={colSpan}\n id={id}\n textValue={textValue}\n >\n {children}\n </AriaCell>\n)\n","import React, { ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { Key, Column as AriaColumn } from 'react-aria-components'\nimport { ColumnSize, ColumnStaticSize } from 'react-stately'\n\nexport interface DataGridColumnProps {\n /**\n * Whether the column allows sorting. Adds a sort indicator and makes the header\n * clickable/keyboard-activatable.\n */\n allowsSorting?: boolean\n /**\n * Rendered contents of the column header.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the column header.\n */\n className?: string\n /**\n * The initial width of the column, e.g. for a narrow selection/icon column — a plain number or\n * `'<n>%'` for a fixed size, or `'<n>fr'` to share remaining space with other fractional\n * columns in proportion (columns default to `'1fr'`, so they split space evenly unless given\n * one of these). Unlike `Table`, which sizes a narrow column via `width: 1%` relying on native\n * `<table>` auto-layout, `DataGrid`'s virtualized layout computes every column's width itself —\n * a CSS `width` rule on the cell has no effect, so this prop is the only way to size a column.\n */\n defaultWidth?: ColumnSize | null\n /**\n * The unique id of the column, referenced by `sortDescriptor.column`.\n */\n id?: Key\n /**\n * Whether this column is a row header, announced by assistive technology during row\n * navigation.\n */\n isRowHeader?: boolean\n /**\n * The maximum width of the column, as a fixed pixel number or `'<n>%'`.\n */\n maxWidth?: ColumnStaticSize | null\n /**\n * The minimum width of the column, as a fixed pixel number or `'<n>%'`.\n */\n minWidth?: ColumnStaticSize | null\n /**\n * Pin the column so it stays visible while the grid scrolls horizontally: `'start'` pins it to\n * the leading edge, `'end'` to the trailing edge. Stacks correctly with other pinned columns on\n * the same side, in declaration order.\n */\n pin?: 'start' | 'end'\n /**\n * A string representation of the column header, used for accessibility announcements. Defaults\n * to `children` when it's a plain string — set this explicitly when the header contains\n * anything else (an icon, a `Tooltip`, etc.).\n */\n textValue?: string\n}\n\n/**\n * A column within `DataGrid`. Unlike `Table`'s sub-parts, this renders directly — it's a thin\n * wrapper over react-aria-components' own `Column`.\n *\n * When `allowsSorting` is set, renders a sort indicator after `children` — mirrors `Table`'s own\n * `TableColumnHeader`, but reads the active direction from react-aria-components' own\n * `ColumnRenderProps` (via the `children` render-prop form) instead of reaching into table state\n * directly, since this wrapper has no state of its own to read.\n */\nexport const DataGridColumn = ({\n allowsSorting,\n children,\n className,\n defaultWidth,\n id,\n isRowHeader,\n maxWidth,\n minWidth,\n pin,\n textValue\n}: DataGridColumnProps) => (\n <AriaColumn\n allowsSorting={allowsSorting}\n className={classNames('datagrid-col', pin && `datagrid-col-pinned-${pin}`, className)}\n defaultWidth={defaultWidth}\n id={id}\n isRowHeader={isRowHeader}\n maxWidth={maxWidth}\n minWidth={minWidth}\n textValue={textValue}\n // `pin` isn't a react-aria-components `Column` prop, but its collection builder preserves\n // the full props object it's given verbatim (see react-stately's `Column.getCollectionNode`)\n // — passing it through here is what makes it reach `column.props.pin` in\n // `DataGridTableLayout`'s `isStickyColumn` override, which is what positions `pin=\"start\"`.\n // `pin=\"end\"` is handled separately by `DataGridPinBehavior`, which reads the same prop off\n // the header's JSX rather than the resolved collection.\n {...({ pin } as Record<string, unknown>)}\n >\n {allowsSorting\n ? ({ sortDirection }) => (\n <>\n {children}\n <span aria-hidden=\"true\" className=\"datagrid-sort-icon\">\n {sortDirection === 'ascending' ? '▲' : sortDirection === 'descending' ? '▼' : '⇅'}\n </span>\n </>\n )\n : children}\n </AriaColumn>\n)\n","import React, { ReactElement, ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { TableHeader as AriaTableHeader } from 'react-aria-components'\n\nexport interface DataGridHeaderProps<T> {\n /**\n * `DataGridColumn` elements, or a render function paired with `columns` for dynamic column\n * generation.\n */\n children: ReactNode | ((column: T) => ReactElement)\n /**\n * A string of all className you want applied to the header row group.\n */\n className?: string\n /**\n * A list of column data objects, rendered via the function form of `children`.\n */\n columns?: Iterable<T>\n /**\n * Values that should invalidate the column cache when using the `columns`/render-function form\n * of `children` — see `DataGridBody`'s `dependencies` for why this matters.\n */\n dependencies?: ReadonlyArray<unknown>\n}\n\n/**\n * Header row group for `DataGrid`, containing `DataGridColumn`s. Unlike `Table`'s sub-parts,\n * this renders directly — it's a thin wrapper over react-aria-components' own `TableHeader`.\n *\n * Always carries the `datagrid-header` class (not just the caller's `className`) — `DataGrid.scss`\n * uses it to tell header cells from body cells, since react-aria-components renders both as plain\n * `[role=\"rowgroup\"]` divs with no structural difference to select on otherwise.\n */\nexport const DataGridHeader = <T extends object>({\n children,\n className,\n columns,\n dependencies\n}: DataGridHeaderProps<T>) => (\n <AriaTableHeader\n className={classNames('datagrid-header', className)}\n columns={columns}\n dependencies={dependencies}\n >\n {children}\n </AriaTableHeader>\n)\n","import React, { ReactElement, ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { Key, Row as AriaRow } from 'react-aria-components'\n\nexport interface DataGridRowProps<T> {\n /**\n * `DataGridCell` elements, or a render function called once per column with that column's\n * data — required when the row's parent `DataGridBody` uses the `items`/render-function form.\n */\n children: ReactNode | ((column: T) => ReactElement)\n /**\n * A string of all className you want applied to the row.\n */\n className?: string\n /**\n * A list of column data objects, rendered via the function form of `children`.\n */\n columns?: Iterable<T>\n /**\n * The unique id of the row, referenced by `selectedKeys`/`disabledKeys`.\n */\n id?: Key\n /**\n * A string representation of the row's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * A row within `DataGrid`. Unlike `Table`'s sub-parts, this renders directly — it's a thin\n * wrapper over react-aria-components' own `Row`.\n */\nexport const DataGridRow = <T extends object>({\n children,\n className,\n columns,\n id,\n textValue\n}: DataGridRowProps<T>) => (\n <AriaRow\n className={classNames('datagrid-row', className)}\n columns={columns}\n id={id}\n textValue={textValue}\n >\n {children}\n </AriaRow>\n)\n","import React, { useRef } from 'react'\nimport { AriaCheckboxProps, useCheckbox } from 'react-aria'\nimport { useToggleState } from 'react-stately'\nimport { CheckboxContext, CheckboxProps, useSlottedContext } from 'react-aria-components'\n\nexport interface DataGridSelectionCellProps {\n /**\n * A string of all className you want applied to the checkbox, replacing the default\n * `check-input`.\n */\n className?: string\n}\n\n/**\n * Reads the selection checkbox props react-aria-components' own `Row`/`TableHeader` publish on\n * `CheckboxContext`'s `selection` slot — the same ones its `<Checkbox slot=\"selection\">` would\n * consume, already carrying the localized label, the row-header `aria-labelledby`, and the\n * selected/disabled/indeterminate state.\n *\n * Reading them off that context (rather than calling react-aria's `useTableSelectionCheckbox`/\n * `useTableSelectAllCheckbox` against `TableStateContext` ourselves, as this file used to) is what\n * keeps this working when more than one copy of `react-aria` is installed. Those hooks resolve the\n * grid's id through a module-scoped `WeakMap` that only `useTable` populates, in whichever copy\n * ran it — always the copy bundled inside `react-aria-components` here, since its `Table` is what\n * calls `useTable`. `react-aria-components` pins `react-aria` to an exact version, so a consumer\n * whose own `react-aria` resolves anywhere else in our `^` range gets a second copy and the lookup\n * throws `Error: Unknown grid` on every selection cell. Letting react-aria-components compute the\n * props in its own copy sidesteps that entirely, and drops the duplicated `rowKey` this component\n * used to need — the context is already scoped to the row it's rendered in, so a `rowKey` that\n * disagreed with the surrounding `DataGridRow` can no longer silently toggle a different row.\n */\nconst useSelectionCheckboxProps = (component: string): AriaCheckboxProps => {\n const props = useSlottedContext(CheckboxContext, 'selection') as CheckboxProps | null | undefined\n if (!props) {\n throw new Error(`${component} must be rendered inside a DataGrid with selection enabled.`)\n }\n return props as AriaCheckboxProps\n}\n\n/**\n * Selection checkbox for one `DataGrid` row — place inside a `DataGridCell`.\n *\n * react-aria-components' own `Checkbox` always visually hides its native `<input>` behind a custom\n * indicator the caller must supply. This renders a plain native `<input className=\"check-input\">`\n * instead, wired to the same state, so it picks up chassis-css's existing checkbox styling for\n * free with no new CSS of its own.\n */\nexport const DataGridSelectionCell = ({ className }: DataGridSelectionCellProps) => {\n const checkboxProps = useSelectionCheckboxProps('DataGridSelectionCell')\n return <DataGridCheckboxInput checkboxProps={checkboxProps} className={className} />\n}\n\n/**\n * \"Select all\" checkbox for `DataGrid`'s header row — place inside a `DataGridColumn`. See\n * `DataGridSelectionCell` for why this bypasses react-aria-components' own `Checkbox`.\n */\nexport const DataGridSelectAllCell = ({ className }: DataGridSelectionCellProps) => {\n const checkboxProps = useSelectionCheckboxProps('DataGridSelectAllCell')\n return <DataGridCheckboxInput checkboxProps={checkboxProps} className={className} />\n}\n\nconst DataGridCheckboxInput = ({\n checkboxProps,\n className\n}: {\n checkboxProps: AriaCheckboxProps\n className?: string\n}) => {\n const toggleState = useToggleState(checkboxProps)\n const ref = useRef<HTMLInputElement>(null)\n const { inputProps } = useCheckbox(checkboxProps, toggleState, ref)\n\n // `aria-describedby` after the spread: react-aria's own adds ids it never renders (FORMS.md,\n // gotcha 6).\n return (\n <input\n {...inputProps}\n aria-describedby={undefined}\n className={className ?? 'check-input'}\n ref={ref}\n />\n )\n}\n"],"mappings":"yiBAgCA,MAAM,EAAsB,kBASf,EAAsB,GACjC,GAAQ,OAAS,OAAO,GAAS,UAAY,EAAoB,KAAK,CAAI,GAEtE,GAAsB,EAAwB,IAC9C,OAAO,GAAS,SAAiB,EAC9B,EAAK,SAAS,GAAG,EAAK,WAAW,CAAI,EAAI,IAAO,EAAiB,WAAW,CAAI,EAWzF,SAAgB,EACd,EACA,EAC+B,CAC/B,IAAM,EAAU,IAAI,IAChB,EAAS,EACT,EAAa,GAEjB,IAAK,IAAM,KAAU,EAAS,CAC5B,GAAI,CAAC,GAAc,CAAC,EAAmB,EAAO,YAAY,EAAG,CAC3D,EAAa,GACb,EAAQ,IAAI,EAAO,GAAI,IAAI,EAC3B,QACF,CAEA,IAAI,E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AkB,aAAe,IAAM,GAC1E,CACN,EAEJ,CACM,EC1ED,GAAoC,CAC/C,WACA,YACA,UACA,kBAEA,EAAA,cAACC,EAAD,CACE,UAAW,EAAW,kBAAmB,CAAS,EACzC,UACK,cAGC,EADd,CACc,ECbN,GAAiC,CAC5C,WACA,YACA,UACA,KACA,eAEA,EAAA,cAACC,EAAD,CACE,UAAW,EAAW,eAAgB,CAAS,EACtC,UACL,KACO,WAGJ,EADN,CACM,ECfL,EAA6B,GAAyC,CAC1E,IAAM,EAAQ,EAAkB,EAAiB,WAAW,EAC5D,GAAI,CAAC,EACH,MAAU,MAAM,GAAG,EAAU,4DAA4D,EAE3F,OAAO,CACT,EAUa,GAAyB,CAAE,eAA4C,CAClF,IAAM,EAAgB,EAA0B,uBAAuB,EACvE,OAAO,EAAA,cAAC,EAAD,CAAsC,gBAA0B,WAAY,CAAA,CACrF,EAMa,GAAyB,CAAE,eAA4C,CAClF,IAAM,EAAgB,EAA0B,uBAAuB,EACvE,OAAO,EAAA,cAAC,EAAD,CAAsC,gBAA0B,WAAY,CAAA,CACrF,EAEM,GAAyB,CAC7B,gBACA,eAII,CACJ,IAAM,EAAc,EAAe,CAAa,EAC1C,EAAM,EAAyB,IAAI,EACnC,CAAE,cAAe,EAAY,EAAe,EAAa,CAAG,EAIlE,OACE,EAAA,cAAC,QAAD,CACE,GAAI,EACJ,mBAAkB,IAAA,GAClB,UAAW,GAAa,cACnB,KACN,CAAA,CAEL"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{d as e,g as t,p as n}from"./slot-CNhFZdHF.js";import{t as r}from"./polymorphic-BhGNZQja.js";import{t as i}from"./useButtonSemantics-CILM_lhi.js";import{t as a}from"./focusRedirect-BrvK3U_o.js";import{t as o}from"./iconSlot-BNu2MrFI.js";import s,{forwardRef as c,useEffect as l,useRef as u}from"react";import d from"classnames";import{mergeProps as f}from"react-aria";function p({prevDisabled:e,nextDisabled:t,onPrev:n,onNext:r}){let i=u(null),o=u(null),s=u(null);return l(()=>{let n=s.current;s.current=null,n&&(n.from===`prev`&&e?a(o.current,n.viaPointer):n.from===`next`&&t&&a(i.current,n.viaPointer))}),{prevRef:i,nextRef:o,handlePrevClick:e=>{s.current={from:`prev`,viaPointer:e.detail!==0},n()},handleNextClick:e=>{s.current={from:`next`,viaPointer:e.detail!==0},r()}}}function m({active:r,children:a,className:o,component:c,disabled:l,href:u,onClick:p,...m},h){let g=d(`pagination-item`,{active:r,disabled:l},o),_=n(c,u,`button`),v=t(_,u,m),y=e(v,u,`PaginationItem`),b=_,x=_,S=e=>{if(v===`anchor`&&l){e.preventDefault();return}p?.(e)},C=v!==`button`&&v!==`anchor`&&!!p,{buttonProps:w,forkedRef:T}=i(h,{disabled:l,onClick:p}),E=r?{"aria-current":`page`}:{};return s.createElement(`li`,{className:g},v===`button`?s.createElement(b,{...m,className:`pagination-link`,type:`button`,disabled:l,onClick:S,...E,ref:h},a):v===`anchor`?s.createElement(x,{...m,className:`pagination-link`,...y,onClick:S,...l&&{"aria-disabled":!0,tabIndex:-1},...E,ref:h},a):s.createElement(_,{className:`pagination-link`,...f(m,C?w:{}),...!C&&{onClick:S},...y,...E,ref:C?T:h},a))}const h=r(m,`PaginationItem`);function g(e,t,n){let r=Math.max(1,n);if(t<=r)return Array.from({length:t},(e,t)=>t+1);let i=Math.floor(r/2),a=Math.max(1,e-i),o=Math.min(t,a+r-1);o-a<r-1&&(a=Math.max(1,o-r+1));let s=[];a>1&&(s.push(1),a>2&&s.push(`...`));for(let e=a;e<=o;e++)s.push(e);return o<t&&(o<t-1&&s.push(`...`),s.push(t)),s}const _=c(({activePage:e=1,align:t,"aria-label":n=`Pagination`,children:r,className:i,maxVisiblePages:a=5,nextIcon:c,nextLabel:l=`Next`,onActivePageChange:u,pages:f,previousIcon:m,previousLabel:_=`Previous`,showPageNumbers:v=!0,showPrevNext:y=!0,size:b,...x},S)=>{let C=d(`pagination`,b,{[`justify-content-${t}`]:t},i),w=f?Math.min(Math.max(e,1),f):e,T=f?w<=1:!1,E=f?w>=f:!1,{prevRef:D,nextRef:O,handlePrevClick:k,handleNextClick:A}=p({prevDisabled:T,nextDisabled:E,onPrev:()=>u&&u(w-1),onNext:()=>u&&u(w+1)}),j=f?s.createElement(s.Fragment,null,y&&s.createElement(h,{ref:D,disabled:T,onClick:k,"aria-label":_},s.createElement(o,{icon:`previous`,override:m,className:`directional-icon`})),v&&g(w,f,a).map((e,t)=>e===`...`?s.createElement(h,{key:`ellipsis-${t}`,disabled:!0,component:`span`,"aria-hidden":`true`},`…`):s.createElement(h,{key:e,active:e===w,onClick:()=>u&&u(e)},e)),y&&s.createElement(h,{ref:O,disabled:E,onClick:A,"aria-label":l},s.createElement(o,{icon:`next`,override:c,className:`directional-icon`}))):null;return s.createElement(`nav`,{"aria-label":n,ref:S,...x},s.createElement(`ul`,{className:C},j??r))});_.displayName=`Pagination`;export{h as n,p as r,_ as t};
|
|
2
|
-
//# sourceMappingURL=pagination-BkOquk-x.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{a as e}from"./slot-CNhFZdHF.js";import{t}from"./polymorphic-BhGNZQja.js";import n from"react";import r from"classnames";const i=e=>[e===`start`||e===`end`?`float-${e}`:null,e===`center`?`d-block mx-auto`:null];function a({align:t,alt:a,className:o,color:s,component:c,fluid:l,height:u,rounded:d,src:f,text:p,thumbnail:m,title:h=`Placeholder`,variant:g,width:_,...v},y){let b=h!==!1,x=p===!1?void 0:p??(_!==void 0&&u!==void 0?`${_}x${u}`:void 0),S=x!==void 0,C=[b&&h,S&&x].filter(Boolean).join(`: `)||void 0;if(f||e(c)){let e=c??`img`,s=r({image:l||m,fluid:l,rounded:d,thumbnail:m},i(t),o);return n.createElement(e,{src:f,width:_,height:u,alt:a??C??``,className:s,...v,ref:y})}let w=r(`image`,{context:!!(s||g)},s,g||`bg-evident`,`fg-subtle`,o);return n.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:_,height:u,"aria-label":C,"aria-hidden":!C||void 0,className:w,preserveAspectRatio:`xMidYMid slice`,role:C?`img`:void 0,...v,ref:y},b&&n.createElement(`title`,null,h),S&&n.createElement(`text`,{dy:`.3em`,fill:`currentColor`,textAnchor:`middle`,x:`50%`,y:`50%`},x))}const o=t(a,`Placeholder`);export{o as t};
|
|
2
|
-
//# sourceMappingURL=placeholder-BCr83sUn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"placeholder-BCr83sUn.js","names":[],"sources":["../../src/components/placeholder/Placeholder.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor, ContextStyle } from '../../types'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { isSlot } from '../../utils/slot'\n\ntype PlaceholderAlign = 'start' | 'center' | 'end'\n\ntype PlaceholderOwnProps<C extends ElementType> = {\n /**\n * Set the horizontal alignment. Only applies when `src` is set.\n */\n align?: PlaceholderAlign\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the generated placeholder graphic to one of Chassis context colors. Has no\n * effect when `src` is set.\n */\n color?: ContextColor\n /**\n * Sets the variant of the generated placeholder graphic to one of Chassis context styles. Has no\n * effect when `src` is set.\n */\n variant?: Exclude<ContextStyle, 'basic' | 'outline'>\n /**\n * Component used for the root node when `src` is set. Either a string to use an HTML element\n * or a component — e.g. a framework's own `Image` component. Its own props (`src`, `fill`,\n * `priority`, etc.) are type-checked at the call site once passed here. With `asChild`, the\n * child element is the image and carries its own `src`.\n */\n component?: C\n /**\n * Make the image responsive, so it never grows larger than its parent. Only applies when `src`\n * is set.\n */\n fluid?: boolean\n /**\n * Placeholder height.\n */\n height?: number | string\n /**\n * Give the image a rounded border-radius. Only applies when `src` is set.\n */\n rounded?: boolean\n /**\n * Renders a real image instead of the generated placeholder graphic, e.g. a default asset or a\n * `placehold.co` URL.\n */\n src?: string\n /**\n * Text shown in the generated placeholder graphic. Defaults to `{width}x{height}`. Pass `false`\n * to hide it. Has no effect when `src` is set.\n */\n text?: string | false\n /**\n * Give the image a thumbnail appearance (padding, background, border, box-shadow). Only\n * applies when `src` is set.\n */\n thumbnail?: boolean\n /**\n * Accessible title for the generated placeholder graphic, rendered as an SVG `<title>`. Pass\n * `false` to hide it. Has no effect when `src` is set.\n *\n * @default 'Placeholder'\n */\n title?: string | false\n /**\n * Placeholder width.\n */\n width?: number | string\n}\n\nexport type PlaceholderProps<C extends ElementType = 'img'> = PolymorphicComponentProps<\n C,\n PlaceholderOwnProps<C>\n>\n\ntype PlaceholderComponent = (<C extends ElementType = 'img'>(\n props: PlaceholderProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nconst alignClassNames = (align: PlaceholderAlign | undefined) => [\n align === 'start' || align === 'end' ? `float-${align}` : null,\n align === 'center' ? 'd-block mx-auto' : null\n]\n\nfunction PlaceholderRender<C extends ElementType = 'img'>(\n {\n align,\n alt,\n className,\n color,\n component,\n fluid,\n height,\n rounded,\n src,\n text,\n thumbnail,\n title = 'Placeholder',\n variant,\n width,\n ...rest\n }: PlaceholderProps<C>,\n ref: PolymorphicRef<C>\n) {\n const showTitle = title !== false\n const displayText =\n text === false\n ? undefined\n : (text ?? (width !== undefined && height !== undefined ? `${width}x${height}` : undefined))\n const showText = displayText !== undefined\n const label =\n [showTitle && title, showText && displayText].filter(Boolean).join(': ') || undefined\n\n // Under `asChild` the caller's element is the image and holds the `src`, so there is none here\n // to choose the branch by.\n if (src || isSlot(component)) {\n const Component = component ?? 'img'\n const _className = classNames(\n { image: fluid || thumbnail, fluid, rounded, thumbnail },\n alignClassNames(align),\n className\n )\n\n return (\n <Component\n src={src}\n width={width}\n height={height}\n alt={alt ?? label ?? ''}\n className={_className}\n {...rest}\n ref={ref}\n />\n )\n }\n\n const _className = classNames(\n 'image',\n { context: Boolean(color || variant) },\n color,\n variant ? variant : 'bg-evident',\n 'fg-subtle',\n className\n )\n\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={width}\n height={height}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className={_className}\n preserveAspectRatio=\"xMidYMid slice\"\n role={label ? 'img' : undefined}\n {...rest}\n ref={ref as PolymorphicRef<'svg'>}\n >\n {showTitle && <title>{title}</title>}\n {showText && (\n <text dy=\".3em\" fill=\"currentColor\" textAnchor=\"middle\" x=\"50%\" y=\"50%\">\n {displayText}\n </text>\n )}\n </svg>\n )\n}\n\nexport const Placeholder = createPolymorphicComponent<PlaceholderComponent>(\n PlaceholderRender as ForwardRefRenderFunction<Element, PlaceholderProps<ElementType>>,\n 'Placeholder'\n)\n"],"mappings":"gKAyFA,MAAM,EAAmB,GAAwC,CAC/D,IAAU,SAAW,IAAU,MAAQ,SAAS,IAAU,KAC1D,IAAU,SAAW,kBAAoB,IAC3C,EAEA,SAAS,EACP,CACE,QACA,MACA,YACA,QACA,YACA,QACA,SACA,UACA,MACA,OACA,YACA,QAAQ,cACR,UACA,QACA,GAAG,GAEL,EACA,CACA,IAAM,EAAY,IAAU,GACtB,EACJ,IAAS,GACL,IAAA,GACC,IAAS,IAAU,IAAA,IAAa,IAAW,IAAA,GAAY,GAAG,EAAM,GAAG,IAAW,IAAA,IAC/E,EAAW,IAAgB,IAAA,GAC3B,EACJ,CAAC,GAAa,EAAO,GAAY,CAAW,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI,GAAK,IAAA,GAI9E,GAAI,GAAO,EAAO,CAAS,EAAG,CAC5B,IAAM,EAAY,GAAa,MACzB,EAAa,EACjB,CAAE,MAAO,GAAS,EAAW,QAAO,UAAS,WAAU,EACvD,EAAgB,CAAK,EACrB,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CACO,MACE,QACC,SACR,IAAK,GAAO,GAAS,GACrB,UAAW,EACX,GAAI,EACC,KACN,CAAA,CAEL,CAEA,IAAM,EAAa,EACjB,QACA,CAAE,QAAS,GAAQ,GAAS,EAAS,EACrC,EACA,GAAoB,aACpB,YACA,CACF,EAEA,OACE,EAAA,cAAC,MAAD,CACE,MAAM,6BACC,QACC,SACR,aAAY,EACZ,cAAa,IAAQ,IAAA,GACrB,UAAW,EACX,oBAAoB,iBACpB,KAAM,EAAQ,MAAQ,IAAA,GACtB,GAAI,EACC,KAQF,EANF,GAAa,EAAA,cAAC,QAAA,KAAO,CAAa,EAClC,GACC,EAAA,cAAC,OAAD,CAAM,GAAG,OAAO,KAAK,eAAe,WAAW,SAAS,EAAE,MAAM,EAAE,KAE5D,EADH,CACG,CAEL,CAET,CAEA,MAAa,EAAc,EACzB,EACA,aACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./polymorphic-BhGNZQja.js";import t,{useId as n}from"react";import r from"classnames";function i({children:e,animated:n,className:i,color:a,component:o,striped:s,style:c,value:l=0,...u},d){let f=o??`div`,p=Math.min(100,Math.max(0,l)),m=r(`progress-bar`,a&&`bg-${a} fg-contrast`,{striped:s,animated:n},i);return t.createElement(f,{...u,className:m,style:{width:`${p}%`,...c},ref:d},t.createElement(`span`,{className:`mx-2xs`},e))}const a=e(i,`ProgressBar`);function o({"aria-label":e,animated:i,children:o,className:s,color:c,component:l,height:u,inlineValue:d,label:f,showValue:p,striped:m,style:h,value:g=0,..._},v){let y=l??`div`,b=r(`progress`,s),x=Math.min(100,Math.max(0,g)),S=o===void 0?d?`${x}%`:void 0:o,C=!!(f||p),w=n(),T=f!=null&&typeof f!=`string`,E={...h};u!==void 0&&(E[`--cx-height`]=`${u}px`);let D=t.createElement(y,{..._,className:b,role:`progressbar`,"aria-valuenow":x,"aria-valuemin":0,"aria-valuemax":100,"aria-label":e??(typeof f==`string`?f:void 0),"aria-labelledby":!e&&T?w:void 0,style:E,ref:v},t.createElement(a,{animated:i,color:c,striped:m,value:x},S));return C?t.createElement(`div`,{className:`d-flex flex-column gap-xs`},t.createElement(`div`,{className:r(`d-flex`,f?`justify-content-between`:`justify-content-end`)},f?t.createElement(`span`,{className:`font-strong`,id:T?w:void 0},f):null,p?t.createElement(`span`,{className:`font-strong`},x,`%`):null),D):D}const s=e(o,`Progress`);export{a as n,s as t};
|
|
2
|
-
//# sourceMappingURL=progress-zWkTltor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"progress-zWkTltor.js","names":[],"sources":["../../src/components/progress/ProgressBar.tsx","../../src/components/progress/Progress.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor } from '../../types'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype ProgressBarOwnProps<C extends ElementType> = {\n /**\n * Use to animate the stripes right to left via CSS3 animations.\n */\n animated?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Adds a diagonal stripe pattern over the bar's background.\n */\n striped?: boolean\n /**\n * The percent to progress the ProgressBar.\n */\n value?: number\n}\n\nexport type ProgressBarProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ProgressBarOwnProps<C>\n>\n\ntype ProgressBarComponent = (<C extends ElementType = 'div'>(\n props: ProgressBarProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ProgressBarRender<C extends ElementType = 'div'>(\n {\n children,\n animated,\n className,\n color,\n component,\n striped,\n style,\n value = 0,\n ...rest\n }: ProgressBarProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const clampedValue = Math.min(100, Math.max(0, value))\n const _className = classNames(\n 'progress-bar',\n color && `bg-${color} fg-contrast`,\n {\n striped,\n animated\n },\n className\n )\n\n return (\n <Component\n {...rest}\n className={_className}\n style={{ width: `${clampedValue}%`, ...style }}\n ref={ref}\n >\n <span className=\"mx-2xs\">{children}</span>\n </Component>\n )\n}\n\nexport const ProgressBar = createPolymorphicComponent<ProgressBarComponent>(\n ProgressBarRender as ForwardRefRenderFunction<Element, ProgressBarProps<ElementType>>,\n 'ProgressBar'\n)\n","import React, {\n CSSProperties,\n ElementType,\n ForwardRefRenderFunction,\n ReactElement,\n ReactNode,\n useId\n} from 'react'\nimport classNames from 'classnames'\n\nimport { ContextColor } from '../../types'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { ProgressBar } from './ProgressBar'\n\ntype ProgressStyle = CSSProperties & {\n '--cx-height'?: string\n}\n\ntype ProgressOwnProps<C extends ElementType> = {\n /**\n * Use to animate the stripes right to left via CSS3 animations.\n */\n animated?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Sets the height of the component, via the `--cx-height` custom property. If you set that\n * value the inner bar (and the striped pattern's tile size) automatically resizes accordingly.\n */\n height?: number\n /**\n * Shows the current value as text inside the bar, independently of `showValue` — combine both\n * to get a `label` + `showValue` caption above the bar alongside an `inlineValue` reading\n * inside it.\n */\n inlineValue?: boolean\n /**\n * A text label describing the progress. Rendered in a caption row above the bar. Also used as\n * the default accessible name when no `aria-label`/`aria-labelledby` is supplied.\n */\n label?: ReactNode\n /**\n * Shows the current value as text in the caption row above the bar, alongside `label` when\n * both are set, or alone otherwise. Use `inlineValue` to show it inside the bar instead.\n */\n showValue?: boolean\n /**\n * Adds a diagonal stripe pattern over the bar's background.\n */\n striped?: boolean\n /**\n * The percent to progress the ProgressBar (out of 100).\n */\n value?: number\n}\n\nexport type ProgressProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ProgressOwnProps<C>\n>\n\ntype ProgressComponent = (<C extends ElementType = 'div'>(\n props: ProgressProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ProgressRender<C extends ElementType = 'div'>(\n {\n 'aria-label': ariaLabel,\n animated,\n children,\n className,\n color,\n component,\n height,\n inlineValue,\n label,\n showValue,\n striped,\n style,\n value = 0,\n ...rest\n }: ProgressProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('progress', className)\n const clampedValue = Math.min(100, Math.max(0, value))\n\n const barChildren =\n children !== undefined ? children : inlineValue ? `${clampedValue}%` : undefined\n const hasCaption = Boolean(label || showValue)\n\n const labelId = useId()\n const isNodeLabel = label != null && typeof label !== 'string'\n\n const _style: ProgressStyle = { ...style }\n if (height !== undefined) _style['--cx-height'] = `${height}px`\n\n const progressElement = (\n <Component\n {...rest}\n className={_className}\n role=\"progressbar\"\n aria-valuenow={clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={ariaLabel ?? (typeof label === 'string' ? label : undefined)}\n aria-labelledby={!ariaLabel && isNodeLabel ? labelId : undefined}\n style={_style}\n ref={ref}\n >\n <ProgressBar animated={animated} color={color} striped={striped} value={clampedValue}>\n {barChildren}\n </ProgressBar>\n </Component>\n )\n\n if (!hasCaption) return progressElement\n\n return (\n <div className=\"d-flex flex-column gap-xs\">\n <div\n className={classNames('d-flex', label ? 'justify-content-between' : 'justify-content-end')}\n >\n {label ? (\n <span className=\"font-strong\" id={isNodeLabel ? labelId : undefined}>\n {label}\n </span>\n ) : null}\n {showValue ? <span className=\"font-strong\">{clampedValue}%</span> : null}\n </div>\n {progressElement}\n </div>\n )\n}\n\nexport const Progress = createPolymorphicComponent<ProgressComponent>(\n ProgressRender as ForwardRefRenderFunction<Element, ProgressProps<ElementType>>,\n 'Progress'\n)\n"],"mappings":"0IA8CA,SAAS,EACP,CACE,WACA,WACA,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,UAAU,2BAYV,EAXH,EAAA,cAAC,MAAD,CACE,UAAW,EAAW,SAAU,EAAQ,0BAA4B,qBAAqB,CAQtF,EANF,EACC,EAAA,cAAC,OAAD,CAAM,UAAU,cAAc,GAAI,EAAc,EAAU,IAAA,EAEpD,EADH,CACG,EACJ,KACH,EAAY,EAAA,cAAC,OAAD,CAAM,UAAU,aAAmC,EAApB,EAAa,GAAO,EAAI,IACjE,EACJ,CACE,EAfiB,CAiB1B,CAEA,MAAa,EAAW,EACtB,EACA,UACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./polymorphic-BhGNZQja.js";import{a as t,i as n}from"./breakpoints-CGk8szzR.js";import r,{Fragment as i,forwardRef as a}from"react";import o from"classnames";const s=(e,t)=>e===!0?`${t}flex-fill`:e===`auto`?`${t}w-auto`:typeof e==`number`||typeof e==`string`?Number(e)===12?`${t}w-100`:`${t}w-${e}/12`:null;function c({children:e,animation:i,className:a,color:c,component:l,span:u,...d},f){let p=l??`span`,m=o(`skeleton`,i&&`skeleton-${i}`,{[`bg-${c}`]:c},n([t(u,s)]),a);return r.createElement(p,{className:m,...d,ref:f},e)}const l=e(c,`Skeleton`);function u({children:e,color:t,component:n,loading:a,spans:o,...s},c){if(!a)return r.createElement(r.Fragment,null,e);let u=o===void 0?[void 0]:Array.isArray(o)?o:[o];return r.createElement(r.Fragment,null,u.map((e,a)=>r.createElement(i,{key:a},a>0&&` `,r.createElement(l,{component:n,span:e,color:t,...s,ref:a===0?c:void 0}))))}const d=a(u);d.displayName=`SkeletonLoader`;export{l as n,d as t};
|
|
2
|
-
//# sourceMappingURL=skeleton-CmZBLJwp.js.map
|