@kumix/ui 0.3.15 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +4 -4
  2. package/dist/components/reui/alert.d.ts +1 -1
  3. package/dist/components/reui/autocomplete.d.ts +1 -1
  4. package/dist/components/reui/badge.d.ts +2 -2
  5. package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -1
  6. package/dist/components/reui/cascader/cascader-virtual.js +2 -0
  7. package/dist/components/reui/cascader/cascader-virtual.js.map +1 -1
  8. package/dist/components/reui/data-grid/data-grid-pagination.d.ts +2 -0
  9. package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
  10. package/dist/components/reui/data-grid/data-grid-pagination.js +103 -42
  11. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  12. package/dist/components/reui/data-grid/data-grid-table.js +1 -1
  13. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  14. package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
  15. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  16. package/dist/components/reui/event-calendar/event-calendar-resource-view.d.ts.map +1 -1
  17. package/dist/components/reui/event-calendar/event-calendar-resource-view.js +3 -4
  18. package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
  19. package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts +9 -1
  20. package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts.map +1 -1
  21. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +11 -4
  22. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  23. package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
  24. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  25. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  26. package/dist/components/reui/filters/filters-types.d.ts +8 -0
  27. package/dist/components/reui/filters/filters-types.d.ts.map +1 -1
  28. package/dist/components/reui/frame.d.ts +2 -2
  29. package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
  30. package/dist/components/reui/gantt/gantt.js.map +1 -1
  31. package/dist/components/reui/icon-tile.d.ts +2 -2
  32. package/dist/components/reui/number-field.d.ts +3 -3
  33. package/dist/components/reui/rating.d.ts +1 -1
  34. package/dist/components/ui/attachment.d.ts +2 -2
  35. package/dist/components/ui/badge.d.ts +1 -1
  36. package/dist/components/ui/bubble.d.ts +1 -1
  37. package/dist/components/ui/button-group.d.ts +1 -1
  38. package/dist/components/ui/button.d.ts +2 -2
  39. package/dist/components/ui/field.d.ts +1 -1
  40. package/dist/components/ui/input-group.d.ts +1 -1
  41. package/dist/components/ui/item.d.ts +1 -1
  42. package/dist/components/ui/sidebar.d.ts +1 -1
  43. package/dist/components/ui/toggle.d.ts +1 -1
  44. package/package.json +2 -2
package/README.md CHANGED
@@ -164,15 +164,15 @@ Hand-written Kumix-specific composite components (not from any registry).
164
164
  ## Styling
165
165
 
166
166
  - Tokens live in `@kumix/ui/theme` (`--background`, `--primary`, `--sidebar`, extended `--success` / `--info` / `--warning` / `--invert`, …).
167
- - In the **app** CSS, also `@source` the package so class names inside published JS are scanned:
167
+ - Minimal app CSS setup:
168
168
 
169
169
  ```css
170
+ @import "tailwindcss";
171
+ @import "shadcn/tailwind.css";
170
172
  @import "@kumix/ui/theme";
171
- @import "@kumix/ui/css";
172
- @source "../node_modules/@kumix/ui/dist";
173
173
  ```
174
174
 
175
- (Adjust the path to your monorepo layout.) Shipped `@source "."` only covers files next to the CSS in `dist/`.
175
+ Requires `tailwindcss` and `shadcn` as devDependencies.
176
176
 
177
177
  - Dark mode: `.dark` class (see `theme.css`).
178
178
 
@@ -1,7 +1,7 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
2
  //#region src/components/reui/alert.d.ts
3
3
  declare const alertVariants: (props?: ({
4
- variant?: "default" | "destructive" | "success" | "info" | "warning" | "invert" | null | undefined;
4
+ variant?: "default" | "success" | "destructive" | "info" | "warning" | "invert" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): import("react").JSX.Element;
7
7
  declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
2
2
  import { Autocomplete as Autocomplete$1 } from "@base-ui/react/autocomplete";
3
3
  //#region src/components/reui/autocomplete.d.ts
4
4
  declare const inputVariants: (props?: ({
5
- size?: "sm" | "default" | "lg" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare const Autocomplete: typeof Autocomplete$1.Root;
8
8
  declare function AutocompleteValue({ ...props }: Autocomplete$1.Value.Props): import("react").JSX.Element;
@@ -2,8 +2,8 @@ import { VariantProps } from "class-variance-authority";
2
2
  import { useRender } from "@base-ui/react/use-render";
3
3
  //#region src/components/reui/badge.d.ts
4
4
  declare const badgeVariants: (props?: ({
5
- variant?: "outline" | "default" | "destructive" | "secondary" | "success" | "info" | "warning" | "invert" | "focus" | "primary-light" | "warning-light" | "success-light" | "info-light" | "destructive-light" | "invert-light" | "focus-light" | "primary-outline" | "warning-outline" | "success-outline" | "info-outline" | "destructive-outline" | "invert-outline" | "focus-outline" | null | undefined;
6
- size?: "xs" | "sm" | "default" | "lg" | "xl" | null | undefined;
5
+ variant?: "outline" | "secondary" | "default" | "success" | "destructive" | "info" | "warning" | "focus" | "invert" | "primary-light" | "warning-light" | "success-light" | "info-light" | "destructive-light" | "invert-light" | "focus-light" | "primary-outline" | "warning-outline" | "success-outline" | "info-outline" | "destructive-outline" | "invert-outline" | "focus-outline" | null | undefined;
6
+ size?: "default" | "sm" | "xs" | "lg" | "xl" | null | undefined;
7
7
  radius?: "default" | "full" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  interface BadgeProps extends useRender.ComponentProps<"span"> {
@@ -1 +1 @@
1
- {"version":3,"file":"cascader-virtual.d.ts","names":[],"sources":["../../../../src/components/reui/cascader/cascader-virtual.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;iBAmCiB;EACf;EACA,wBAAwB;EACxB;EACA;;EAEA,aAAa;;EAEb;;YAGU,sBAAsB,YAAY,aAAa;;;;;;;wBAQ3C,yBACd,OACA,kBACA,cACA,UACA,YACA,eACC,gCAAgC;iBAsHlB;;EAEf;;EAEA;;;;;;;;;iBAUO,qBAAqB,OAAO,4BAAyB,QAAA,IAAA;iBA2F7C,mCAAmC;EAClD,QAAQ;;;;;;;;;iBAUD,wBAAwB,QAAQ,cAAc,YAAY,6BAA0B,QAAA,IAAA"}
1
+ {"version":3,"file":"cascader-virtual.d.ts","names":[],"sources":["../../../../src/components/reui/cascader/cascader-virtual.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;iBAmCiB;EACf;EACA,wBAAwB;EACxB;EACA;;EAEA,aAAa;;EAEb;;YAGU,sBAAsB,YAAY,aAAa;;;;;;;wBAQ3C,yBACd,OACA,kBACA,cACA,UACA,YACA,eACC,gCAAgC;iBAuHlB;;EAEf;;EAEA;;;;;;;;;iBAUO,qBAAqB,OAAO,4BAAyB,QAAA,IAAA;iBAgG7C,mCAAmC;EAClD,QAAQ;;;;;;;;;iBAUD,wBAAwB,QAAQ,cAAc,YAAY,6BAA0B,QAAA,IAAA"}
@@ -105,6 +105,7 @@ function CascaderVirtualItems(props) {
105
105
  return /* @__PURE__ */ jsx(CascaderVirtualRows, { ...props });
106
106
  }
107
107
  function CascaderVirtualRows({ estimateSize, overscan }) {
108
+ "use no memo";
108
109
  const { estimateRowSize, overscan: rootOverscan, mode, isBranch, isSelectable, isSelected, isIndeterminate } = useCascaderActions();
109
110
  const { renderedItems, treeRows, deepResults, loadStates } = useCascaderState();
110
111
  const highlight = useCascaderHighlight();
@@ -187,6 +188,7 @@ function CascaderVirtualActiveColumnRows(props) {
187
188
  });
188
189
  }
189
190
  function CascaderVirtualColumnRows({ column, estimateSize, overscan, activeIndex }) {
191
+ "use no memo";
190
192
  const { estimateRowSize, overscan: rootOverscan, baseId, isBranch, isSelectable, isSelected, isIndeterminate } = useCascaderActions();
191
193
  const { loadStates } = useCascaderState();
192
194
  const [contentElement, setContentElement] = React$1.useState(null);
@@ -1 +1 @@
1
- {"version":3,"file":"cascader-virtual.js","names":["React"],"sources":["../../../../src/components/reui/cascader/cascader-virtual.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n defaultRangeExtractor,\n type Range,\n useVirtualizer,\n type Virtualizer,\n} from \"@tanstack/react-virtual\";\n\nimport { CascaderColumnPanel } from \"./cascader-columns\";\nimport type { CascaderColumn } from \"./cascader-context\";\nimport { useCascaderActions, useCascaderHighlight, useCascaderState } from \"./cascader-context\";\nimport { CascaderItem, CascaderItems, getCascaderMoreProps } from \"./cascader-item\";\n\n/**\n * Windowing for the cascader, in its own file so the primitive's own install\n * never pulls `@tanstack/react-virtual` in. Base UI forces three rules:\n *\n * 1. A windowed row MUST carry an explicit `index`; the fallback\n * `findItemIndex` is O(n) per row and returns `-1` on the frame a level swap\n * renders empty, dangling `aria-activedescendant`.\n * 2. That index is DESTRUCTIVE while unvirtualized (`useCompositeListItem`\n * skips registration, `CompositeList` truncates `elementsRef` to zero and\n * the first arrow key highlights nothing), so rows stay plain until the root\n * flips `virtualized`, gated inside `CascaderItem`.\n * 3. No `Combobox.Collection` and no FUNCTION CHILD on `Combobox.List`, which\n * implicitly wraps one in a Collection: a Collection renders every filtered\n * item.\n */\n\n/* -------------------------------------------------------------------------- */\n/* Virtualizer */\n/* -------------------------------------------------------------------------- */\n\nexport interface UseCascaderVirtualizerOptions {\n count: number;\n getScrollElement: () => HTMLElement | null;\n estimateSize?: number;\n overscan?: number;\n /** Key rows by node value, never by index: a tree expand shifts every index. */\n getItemKey: (index: number) => string | number;\n /** Render index of the highlighted row, or `-1`. Pinned into the window. */\n activeIndex?: number;\n}\n\nexport type CascaderVirtualizer = Virtualizer<HTMLElement, HTMLElement>;\n\n/**\n * The cascader's virtualizer: TanStack plus the highlight pinning and\n * scroll-into-view a combobox list needs. `activeIndex` is clamped here, not by\n * the caller: emitted from a layout effect, it can be one commit ahead of a\n * level that just shrank and would otherwise scroll to a row that is gone.\n */\nexport function useCascaderVirtualizer({\n count,\n getScrollElement,\n estimateSize = 32,\n overscan = 8,\n getItemKey,\n activeIndex = -1,\n}: UseCascaderVirtualizerOptions): CascaderVirtualizer {\n const active = activeIndex >= 0 && activeIndex < count ? activeIndex : -1;\n\n // Keeps the highlighted row mounted so `aria-activedescendant` never dangles.\n const rangeExtractor = React.useCallback(\n (range: Range) => {\n const indices = new Set(defaultRangeExtractor(range));\n if (active !== -1) indices.add(active);\n return Array.from(indices).sort((a, b) => a - b);\n },\n [active],\n );\n\n const measureEstimate = React.useCallback(() => estimateSize, [estimateSize]);\n\n // React Compiler bails on `useVirtualizer`; harmless, rows memoise one by one.\n const virtualizer = useVirtualizer<HTMLElement, HTMLElement>({\n count,\n getScrollElement,\n estimateSize: measureEstimate,\n overscan,\n getItemKey,\n rangeExtractor,\n });\n\n // Base UI's scroll-into-view no-ops on a windowed-out row (empty `listRef`).\n React.useEffect(() => {\n if (active === -1) return;\n virtualizer.scrollToIndex(active, { align: \"auto\" });\n }, [active, virtualizer]);\n\n return virtualizer;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Geometry */\n/* -------------------------------------------------------------------------- */\n\ninterface CascaderVirtualGutter {\n block: number;\n inline: number;\n}\n\nconst NO_GUTTER: CascaderVirtualGutter = { block: 0, inline: 0 };\n\n/**\n * The ROWS' BOX's own padding, never the scrollport's (separate element, reads\n * a flat zero). Measured because every style sets its own: a windowed row is\n * positioned against this box's PADDING box while the scroll-height spacer is\n * an in-flow child of its CONTENT box, so without it rows sit flush.\n */\nfunction useCascaderVirtualGutter(contentElement: HTMLElement | null): CascaderVirtualGutter {\n const [gutter, setGutter] = React.useState<CascaderVirtualGutter>(NO_GUTTER);\n\n React.useLayoutEffect(() => {\n if (!contentElement) return;\n const styles = getComputedStyle(contentElement);\n const block = Number.parseFloat(styles.paddingTop) || 0;\n const inline = Number.parseFloat(styles.paddingInlineStart || styles.paddingLeft) || 0;\n setGutter((previous) =>\n previous.block === block && previous.inline === inline ? previous : { block, inline },\n );\n }, [contentElement]);\n\n return gutter;\n}\n\n/** Logical insets, not `left` / `width`, so RTL needs no second code path. */\nfunction cascaderVirtualRowStyle(\n start: number,\n gutter: CascaderVirtualGutter,\n): React.CSSProperties {\n return {\n position: \"absolute\",\n top: 0,\n insetInlineStart: gutter.inline,\n insetInlineEnd: gutter.inline,\n transform: `translateY(${start + gutter.block}px)`,\n };\n}\n\n/**\n * The element that actually SCROLLS: the `ScrollArea` viewport above the rows'\n * box, not the rows' box itself, which never overflows, so a virtualizer aimed\n * at it would read a full `clientHeight` and render every row. `closest` rather\n * than `parentElement`, plus a fallback to the content element, keeps a\n * hand-written `overflow-y-auto` container working.\n */\nfunction cascaderScrollElement(content: HTMLElement | null): HTMLElement | null {\n if (!content) return null;\n return content.closest<HTMLElement>('[data-slot=\"scroll-area-viewport\"]') ?? content;\n}\n\n/**\n * `role=\"presentation\"` keeps the listbox owning nothing but options, and this\n * node's parent IS the rows' box, saving a ref threaded through `CascaderList`.\n */\nfunction CascaderVirtualSpacer({\n height,\n onContentElement,\n}: {\n height: number;\n onContentElement: (element: HTMLElement | null) => void;\n}) {\n return (\n <div\n ref={(node) => onContentElement(node?.parentElement ?? null)}\n role=\"presentation\"\n data-slot=\"cascader-virtual-spacer\"\n style={{ height }}\n />\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Rows */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderVirtualItemsProps {\n /** Row height before measurement. Defaults to the root `estimateRowSize`. */\n estimateSize?: number;\n /** Rows rendered beyond each edge. Defaults to the root `overscan`. */\n overscan?: number;\n}\n\n/**\n * Windowed replacement for `CascaderItems`, dropped inside `CascaderList`. The\n * registration is a LAYOUT effect because the root derives `virtualized` from\n * it and the flip has to land before the browser paints. Until the root has\n * seen it, this renders exactly what `CascaderItems` does, so no frame carries\n * indexed rows while Base UI still owns the composite list.\n */\nfunction CascaderVirtualItems(props: CascaderVirtualItemsProps) {\n const { virtualized, registerVirtualRenderer } = useCascaderActions();\n\n React.useLayoutEffect(() => registerVirtualRenderer(), [registerVirtualRenderer]);\n\n if (!virtualized) return <CascaderItems />;\n\n return <CascaderVirtualRows {...props} />;\n}\n\nfunction CascaderVirtualRows({ estimateSize, overscan }: CascaderVirtualItemsProps) {\n const {\n estimateRowSize,\n overscan: rootOverscan,\n mode,\n isBranch,\n isSelectable,\n isSelected,\n isIndeterminate,\n } = useCascaderActions();\n const { renderedItems, treeRows, deepResults, loadStates } = useCascaderState();\n // Re-renders on every highlight change, and has to: the pinned row and the\n // scroll target are both derived from it.\n const highlight = useCascaderHighlight();\n\n const [contentElement, setContentElement] = React.useState<HTMLElement | null>(null);\n const gutter = useCascaderVirtualGutter(contentElement);\n\n const tree = mode === \"tree\";\n const count = tree ? treeRows.length : renderedItems.length;\n const showPath = !tree && deepResults !== null;\n\n const getItemKey = React.useCallback(\n (index: number) => (tree ? treeRows[index]?.node.value : renderedItems[index]?.value) ?? index,\n [tree, treeRows, renderedItems],\n );\n\n const virtualizer = useCascaderVirtualizer({\n count,\n getScrollElement: () => cascaderScrollElement(contentElement),\n estimateSize: estimateSize ?? estimateRowSize,\n overscan: overscan ?? rootOverscan,\n getItemKey,\n activeIndex: highlight.index,\n });\n\n return (\n <>\n <CascaderVirtualSpacer\n height={virtualizer.getTotalSize()}\n onContentElement={setContentElement}\n />\n {virtualizer.getVirtualItems().map((row) => {\n const flat = tree ? treeRows[row.index] : undefined;\n const node = tree ? flat?.node : renderedItems[row.index];\n // For one commit after a query narrows the level, the window can name\n // a row it no longer has; the count recomputes on the same tick.\n if (!node) return null;\n\n return (\n <CascaderItem\n key={row.key}\n /* Measured, not estimated: rows are two lines with a `description`\n and three in deep search, and row height is per style. An\n estimate alone would make `scrollToIndex` land on the wrong row. */\n ref={virtualizer.measureElement}\n data-index={row.index}\n style={cascaderVirtualRowStyle(row.start, gutter)}\n node={node}\n index={row.index}\n depth={flat?.depth}\n expanded={flat?.expanded}\n branch={flat ? flat.branch : isBranch(node)}\n selectable={isSelectable(node)}\n selected={isSelected(node)}\n indeterminate={isIndeterminate(node)}\n {...getCascaderMoreProps(node, loadStates)}\n showPath={showPath}\n aria-setsize={flat ? flat.setSize : count}\n aria-posinset={flat ? flat.posInSet : row.index + 1}\n />\n );\n })}\n </>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Column */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderVirtualColumnProps extends CascaderVirtualItemsProps {\n column: CascaderColumn;\n}\n\n/**\n * Windowed replacement for one Miller column, passed through the\n * `CascaderColumns` render slot. One virtualizer PER COLUMN, since columns\n * scroll independently, and only the deepest is Base UI's listbox: the trail\n * behind is `as=\"button\"` rows outside Base UI, so it windows on its own row\n * count rather than waiting for the root to flip.\n */\nfunction CascaderVirtualColumn({ column, estimateSize, overscan }: CascaderVirtualColumnProps) {\n const { virtualized, registerVirtualRenderer, virtualize, virtualizeThreshold } =\n useCascaderActions();\n\n React.useLayoutEffect(() => registerVirtualRenderer(), [registerVirtualRenderer]);\n\n const windowed = column.active\n ? virtualized\n : (virtualize ?? column.items.length >= virtualizeThreshold);\n\n if (!windowed) return <CascaderColumnPanel column={column} />;\n\n return (\n <CascaderColumnPanel column={column} virtualized>\n {column.active ? (\n <CascaderVirtualActiveColumnRows\n column={column}\n estimateSize={estimateSize}\n overscan={overscan}\n />\n ) : (\n <CascaderVirtualColumnRows\n column={column}\n estimateSize={estimateSize}\n overscan={overscan}\n activeIndex={-1}\n />\n )}\n </CascaderColumnPanel>\n );\n}\n\n/** Only the active column subscribes to the highlight; a trail column must not. */\nfunction CascaderVirtualActiveColumnRows(props: CascaderVirtualColumnProps) {\n const highlight = useCascaderHighlight();\n return <CascaderVirtualColumnRows {...props} activeIndex={highlight.index} />;\n}\n\nfunction CascaderVirtualColumnRows({\n column,\n estimateSize,\n overscan,\n activeIndex,\n}: CascaderVirtualColumnProps & { activeIndex: number }) {\n const {\n estimateRowSize,\n overscan: rootOverscan,\n baseId,\n isBranch,\n isSelectable,\n isSelected,\n isIndeterminate,\n } = useCascaderActions();\n const { loadStates } = useCascaderState();\n\n const [contentElement, setContentElement] = React.useState<HTMLElement | null>(null);\n const gutter = useCascaderVirtualGutter(contentElement);\n\n const items = column.items;\n const getItemKey = React.useCallback((index: number) => items[index]?.value ?? index, [items]);\n\n const virtualizer = useCascaderVirtualizer({\n count: items.length,\n getScrollElement: () => cascaderScrollElement(contentElement),\n estimateSize: estimateSize ?? estimateRowSize,\n overscan: overscan ?? rootOverscan,\n getItemKey,\n activeIndex,\n });\n\n return (\n <>\n <CascaderVirtualSpacer\n height={virtualizer.getTotalSize()}\n onContentElement={setContentElement}\n />\n {virtualizer.getVirtualItems().map((row) => {\n const node = items[row.index];\n if (!node) return null;\n const open = node.value === column.activeValue;\n\n return (\n <CascaderItem\n key={row.key}\n ref={virtualizer.measureElement}\n data-index={row.index}\n style={cascaderVirtualRowStyle(row.start, gutter)}\n node={node}\n as={column.active ? \"option\" : \"button\"}\n depth={column.depth}\n branch={isBranch(node)}\n selectable={isSelectable(node)}\n selected={isSelected(node)}\n indeterminate={isIndeterminate(node)}\n {...getCascaderMoreProps(node, loadStates)}\n data-open={open || undefined}\n className={open ? \"bg-accent/60 text-accent-foreground\" : undefined}\n /* Only the listbox column may carry an index or listbox metadata.\n A trail row is a `role=\"button\"`, which allows neither. */\n {...(column.active\n ? {\n index: row.index,\n \"aria-setsize\": items.length,\n \"aria-posinset\": row.index + 1,\n }\n : null)}\n {...(!column.active && open\n ? {\n \"aria-expanded\": true,\n \"aria-controls\": `${baseId}-column-${column.depth + 1}`,\n }\n : null)}\n />\n );\n })}\n </>\n );\n}\n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wC,KAAA;GAG1D,GAAK,OAAO,SACR;IACE,OAAO,IAAI;IACX,gBAAgB,MAAM;IACtB,iBAAiB,IAAI,QAAQ;GAC/B,IACA;GACJ,GAAK,CAAC,OAAO,UAAU,OACnB;IACE,iBAAiB;IACjB,iBAAiB,GAAG,OAAO,UAAU,OAAO,QAAQ;GACtD,IACA;EACL,GA7BM,IAAI,GA6BV;CAEL,CAAC,CACD,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"cascader-virtual.js","names":["React"],"sources":["../../../../src/components/reui/cascader/cascader-virtual.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n defaultRangeExtractor,\n type Range,\n useVirtualizer,\n type Virtualizer,\n} from \"@tanstack/react-virtual\";\n\nimport { CascaderColumnPanel } from \"./cascader-columns\";\nimport type { CascaderColumn } from \"./cascader-context\";\nimport { useCascaderActions, useCascaderHighlight, useCascaderState } from \"./cascader-context\";\nimport { CascaderItem, CascaderItems, getCascaderMoreProps } from \"./cascader-item\";\n\n/**\n * Windowing for the cascader, in its own file so the primitive's own install\n * never pulls `@tanstack/react-virtual` in. Base UI forces three rules:\n *\n * 1. A windowed row MUST carry an explicit `index`; the fallback\n * `findItemIndex` is O(n) per row and returns `-1` on the frame a level swap\n * renders empty, dangling `aria-activedescendant`.\n * 2. That index is DESTRUCTIVE while unvirtualized (`useCompositeListItem`\n * skips registration, `CompositeList` truncates `elementsRef` to zero and\n * the first arrow key highlights nothing), so rows stay plain until the root\n * flips `virtualized`, gated inside `CascaderItem`.\n * 3. No `Combobox.Collection` and no FUNCTION CHILD on `Combobox.List`, which\n * implicitly wraps one in a Collection: a Collection renders every filtered\n * item.\n */\n\n/* -------------------------------------------------------------------------- */\n/* Virtualizer */\n/* -------------------------------------------------------------------------- */\n\nexport interface UseCascaderVirtualizerOptions {\n count: number;\n getScrollElement: () => HTMLElement | null;\n estimateSize?: number;\n overscan?: number;\n /** Key rows by node value, never by index: a tree expand shifts every index. */\n getItemKey: (index: number) => string | number;\n /** Render index of the highlighted row, or `-1`. Pinned into the window. */\n activeIndex?: number;\n}\n\nexport type CascaderVirtualizer = Virtualizer<HTMLElement, HTMLElement>;\n\n/**\n * The cascader's virtualizer: TanStack plus the highlight pinning and\n * scroll-into-view a combobox list needs. `activeIndex` is clamped here, not by\n * the caller: emitted from a layout effect, it can be one commit ahead of a\n * level that just shrank and would otherwise scroll to a row that is gone.\n */\nexport function useCascaderVirtualizer({\n count,\n getScrollElement,\n estimateSize = 32,\n overscan = 8,\n getItemKey,\n activeIndex = -1,\n}: UseCascaderVirtualizerOptions): CascaderVirtualizer {\n const active = activeIndex >= 0 && activeIndex < count ? activeIndex : -1;\n\n // Keeps the highlighted row mounted so `aria-activedescendant` never dangles.\n const rangeExtractor = React.useCallback(\n (range: Range) => {\n const indices = new Set(defaultRangeExtractor(range));\n if (active !== -1) indices.add(active);\n return Array.from(indices).sort((a, b) => a - b);\n },\n [active],\n );\n\n const measureEstimate = React.useCallback(() => estimateSize, [estimateSize]);\n\n // React Compiler bails on `useVirtualizer` HERE, and only here - the bail does not\n // propagate to the components that call this hook. They opt out themselves.\n const virtualizer = useVirtualizer<HTMLElement, HTMLElement>({\n count,\n getScrollElement,\n estimateSize: measureEstimate,\n overscan,\n getItemKey,\n rangeExtractor,\n });\n\n // Base UI's scroll-into-view no-ops on a windowed-out row (empty `listRef`).\n React.useEffect(() => {\n if (active === -1) return;\n virtualizer.scrollToIndex(active, { align: \"auto\" });\n }, [active, virtualizer]);\n\n return virtualizer;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Geometry */\n/* -------------------------------------------------------------------------- */\n\ninterface CascaderVirtualGutter {\n block: number;\n inline: number;\n}\n\nconst NO_GUTTER: CascaderVirtualGutter = { block: 0, inline: 0 };\n\n/**\n * The ROWS' BOX's own padding, never the scrollport's (separate element, reads\n * a flat zero). Measured because every style sets its own: a windowed row is\n * positioned against this box's PADDING box while the scroll-height spacer is\n * an in-flow child of its CONTENT box, so without it rows sit flush.\n */\nfunction useCascaderVirtualGutter(contentElement: HTMLElement | null): CascaderVirtualGutter {\n const [gutter, setGutter] = React.useState<CascaderVirtualGutter>(NO_GUTTER);\n\n React.useLayoutEffect(() => {\n if (!contentElement) return;\n const styles = getComputedStyle(contentElement);\n const block = Number.parseFloat(styles.paddingTop) || 0;\n const inline = Number.parseFloat(styles.paddingInlineStart || styles.paddingLeft) || 0;\n setGutter((previous) =>\n previous.block === block && previous.inline === inline ? previous : { block, inline },\n );\n }, [contentElement]);\n\n return gutter;\n}\n\n/** Logical insets, not `left` / `width`, so RTL needs no second code path. */\nfunction cascaderVirtualRowStyle(\n start: number,\n gutter: CascaderVirtualGutter,\n): React.CSSProperties {\n return {\n position: \"absolute\",\n top: 0,\n insetInlineStart: gutter.inline,\n insetInlineEnd: gutter.inline,\n transform: `translateY(${start + gutter.block}px)`,\n };\n}\n\n/**\n * The element that actually SCROLLS: the `ScrollArea` viewport above the rows'\n * box, not the rows' box itself, which never overflows, so a virtualizer aimed\n * at it would read a full `clientHeight` and render every row. `closest` rather\n * than `parentElement`, plus a fallback to the content element, keeps a\n * hand-written `overflow-y-auto` container working.\n */\nfunction cascaderScrollElement(content: HTMLElement | null): HTMLElement | null {\n if (!content) return null;\n return content.closest<HTMLElement>('[data-slot=\"scroll-area-viewport\"]') ?? content;\n}\n\n/**\n * `role=\"presentation\"` keeps the listbox owning nothing but options, and this\n * node's parent IS the rows' box, saving a ref threaded through `CascaderList`.\n */\nfunction CascaderVirtualSpacer({\n height,\n onContentElement,\n}: {\n height: number;\n onContentElement: (element: HTMLElement | null) => void;\n}) {\n return (\n <div\n ref={(node) => onContentElement(node?.parentElement ?? null)}\n role=\"presentation\"\n data-slot=\"cascader-virtual-spacer\"\n style={{ height }}\n />\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Rows */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderVirtualItemsProps {\n /** Row height before measurement. Defaults to the root `estimateRowSize`. */\n estimateSize?: number;\n /** Rows rendered beyond each edge. Defaults to the root `overscan`. */\n overscan?: number;\n}\n\n/**\n * Windowed replacement for `CascaderItems`, dropped inside `CascaderList`. The\n * registration is a LAYOUT effect because the root derives `virtualized` from\n * it and the flip has to land before the browser paints. Until the root has\n * seen it, this renders exactly what `CascaderItems` does, so no frame carries\n * indexed rows while Base UI still owns the composite list.\n */\nfunction CascaderVirtualItems(props: CascaderVirtualItemsProps) {\n const { virtualized, registerVirtualRenderer } = useCascaderActions();\n\n React.useLayoutEffect(() => registerVirtualRenderer(), [registerVirtualRenderer]);\n\n if (!virtualized) return <CascaderItems />;\n\n return <CascaderVirtualRows {...props} />;\n}\n\nfunction CascaderVirtualRows({ estimateSize, overscan }: CascaderVirtualItemsProps) {\n /* The `useCascaderVirtualizer` bail does NOT reach here: the compiler caches\n `getVirtualItems()` on the virtualizer, whose identity never changes, so the\n window freezes on scroll. Inert where no compiler runs. */\n \"use no memo\";\n\n const {\n estimateRowSize,\n overscan: rootOverscan,\n mode,\n isBranch,\n isSelectable,\n isSelected,\n isIndeterminate,\n } = useCascaderActions();\n const { renderedItems, treeRows, deepResults, loadStates } = useCascaderState();\n // Re-renders on every highlight change, and has to: the pinned row and the\n // scroll target are both derived from it.\n const highlight = useCascaderHighlight();\n\n const [contentElement, setContentElement] = React.useState<HTMLElement | null>(null);\n const gutter = useCascaderVirtualGutter(contentElement);\n\n const tree = mode === \"tree\";\n const count = tree ? treeRows.length : renderedItems.length;\n const showPath = !tree && deepResults !== null;\n\n const getItemKey = React.useCallback(\n (index: number) => (tree ? treeRows[index]?.node.value : renderedItems[index]?.value) ?? index,\n [tree, treeRows, renderedItems],\n );\n\n const virtualizer = useCascaderVirtualizer({\n count,\n getScrollElement: () => cascaderScrollElement(contentElement),\n estimateSize: estimateSize ?? estimateRowSize,\n overscan: overscan ?? rootOverscan,\n getItemKey,\n activeIndex: highlight.index,\n });\n\n return (\n <>\n <CascaderVirtualSpacer\n height={virtualizer.getTotalSize()}\n onContentElement={setContentElement}\n />\n {virtualizer.getVirtualItems().map((row) => {\n const flat = tree ? treeRows[row.index] : undefined;\n const node = tree ? flat?.node : renderedItems[row.index];\n // For one commit after a query narrows the level, the window can name\n // a row it no longer has; the count recomputes on the same tick.\n if (!node) return null;\n\n return (\n <CascaderItem\n key={row.key}\n /* Measured, not estimated: rows are two lines with a `description`\n and three in deep search, and row height is per style. An\n estimate alone would make `scrollToIndex` land on the wrong row. */\n ref={virtualizer.measureElement}\n data-index={row.index}\n style={cascaderVirtualRowStyle(row.start, gutter)}\n node={node}\n index={row.index}\n depth={flat?.depth}\n expanded={flat?.expanded}\n branch={flat ? flat.branch : isBranch(node)}\n selectable={isSelectable(node)}\n selected={isSelected(node)}\n indeterminate={isIndeterminate(node)}\n {...getCascaderMoreProps(node, loadStates)}\n showPath={showPath}\n aria-setsize={flat ? flat.setSize : count}\n aria-posinset={flat ? flat.posInSet : row.index + 1}\n />\n );\n })}\n </>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Column */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderVirtualColumnProps extends CascaderVirtualItemsProps {\n column: CascaderColumn;\n}\n\n/**\n * Windowed replacement for one Miller column, passed through the\n * `CascaderColumns` render slot. One virtualizer PER COLUMN, since columns\n * scroll independently, and only the deepest is Base UI's listbox: the trail\n * behind is `as=\"button\"` rows outside Base UI, so it windows on its own row\n * count rather than waiting for the root to flip.\n */\nfunction CascaderVirtualColumn({ column, estimateSize, overscan }: CascaderVirtualColumnProps) {\n const { virtualized, registerVirtualRenderer, virtualize, virtualizeThreshold } =\n useCascaderActions();\n\n React.useLayoutEffect(() => registerVirtualRenderer(), [registerVirtualRenderer]);\n\n const windowed = column.active\n ? virtualized\n : (virtualize ?? column.items.length >= virtualizeThreshold);\n\n if (!windowed) return <CascaderColumnPanel column={column} />;\n\n return (\n <CascaderColumnPanel column={column} virtualized>\n {column.active ? (\n <CascaderVirtualActiveColumnRows\n column={column}\n estimateSize={estimateSize}\n overscan={overscan}\n />\n ) : (\n <CascaderVirtualColumnRows\n column={column}\n estimateSize={estimateSize}\n overscan={overscan}\n activeIndex={-1}\n />\n )}\n </CascaderColumnPanel>\n );\n}\n\n/** Only the active column subscribes to the highlight; a trail column must not. */\nfunction CascaderVirtualActiveColumnRows(props: CascaderVirtualColumnProps) {\n const highlight = useCascaderHighlight();\n return <CascaderVirtualColumnRows {...props} activeIndex={highlight.index} />;\n}\n\nfunction CascaderVirtualColumnRows({\n column,\n estimateSize,\n overscan,\n activeIndex,\n}: CascaderVirtualColumnProps & { activeIndex: number }) {\n /* The `useCascaderVirtualizer` bail does NOT reach here: the compiler caches\n `getVirtualItems()` on the virtualizer, whose identity never changes, so the\n window freezes on scroll. Inert where no compiler runs. */\n \"use no memo\";\n\n const {\n estimateRowSize,\n overscan: rootOverscan,\n baseId,\n isBranch,\n isSelectable,\n isSelected,\n isIndeterminate,\n } = useCascaderActions();\n const { loadStates } = useCascaderState();\n\n const [contentElement, setContentElement] = React.useState<HTMLElement | null>(null);\n const gutter = useCascaderVirtualGutter(contentElement);\n\n const items = column.items;\n const getItemKey = React.useCallback((index: number) => items[index]?.value ?? index, [items]);\n\n const virtualizer = useCascaderVirtualizer({\n count: items.length,\n getScrollElement: () => cascaderScrollElement(contentElement),\n estimateSize: estimateSize ?? estimateRowSize,\n overscan: overscan ?? rootOverscan,\n getItemKey,\n activeIndex,\n });\n\n return (\n <>\n <CascaderVirtualSpacer\n height={virtualizer.getTotalSize()}\n onContentElement={setContentElement}\n />\n {virtualizer.getVirtualItems().map((row) => {\n const node = items[row.index];\n if (!node) return null;\n const open = node.value === column.activeValue;\n\n return (\n <CascaderItem\n key={row.key}\n ref={virtualizer.measureElement}\n data-index={row.index}\n style={cascaderVirtualRowStyle(row.start, gutter)}\n node={node}\n as={column.active ? \"option\" : \"button\"}\n depth={column.depth}\n branch={isBranch(node)}\n selectable={isSelectable(node)}\n selected={isSelected(node)}\n indeterminate={isIndeterminate(node)}\n {...getCascaderMoreProps(node, loadStates)}\n data-open={open || undefined}\n className={open ? \"bg-accent/60 text-accent-foreground\" : undefined}\n /* Only the listbox column may carry an index or listbox metadata.\n A trail row is a `role=\"button\"`, which allows neither. */\n {...(column.active\n ? {\n index: row.index,\n \"aria-setsize\": items.length,\n \"aria-posinset\": row.index + 1,\n }\n : null)}\n {...(!column.active && open\n ? {\n \"aria-expanded\": true,\n \"aria-controls\": `${baseId}-column-${column.depth + 1}`,\n }\n : null)}\n />\n );\n })}\n </>\n );\n}\n\nexport { CascaderVirtualColumn, CascaderVirtualItems };\n"],"mappings":";;;;;;;;;;;;;;AAsDA,SAAgB,uBAAuB,EACrC,OACA,kBACA,eAAe,IACf,WAAW,GACX,YACA,cAAc,MACuC;CACrD,MAAM,SAAS,eAAe,KAAK,cAAc,QAAQ,cAAc;CAGvE,MAAM,iBAAiBA,QAAM,aAC1B,UAAiB;EAChB,MAAM,UAAU,IAAI,IAAI,sBAAsB,KAAK,CAAC;EACpD,IAAI,WAAW,IAAI,QAAQ,IAAI,MAAM;EACrC,OAAO,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;CACjD,GACA,CAAC,MAAM,CACT;CAEA,MAAM,kBAAkBA,QAAM,kBAAkB,cAAc,CAAC,YAAY,CAAC;CAI5E,MAAM,cAAc,eAAyC;EAC3D;EACA;EACA,cAAc;EACd;EACA;EACA;CACF,CAAC;CAGD,QAAM,gBAAgB;EACpB,IAAI,WAAW,IAAI;EACnB,YAAY,cAAc,QAAQ,EAAE,OAAO,OAAO,CAAC;CACrD,GAAG,CAAC,QAAQ,WAAW,CAAC;CAExB,OAAO;AACT;AAWA,MAAM,YAAmC;CAAE,OAAO;CAAG,QAAQ;AAAE;;;;;;;AAQ/D,SAAS,yBAAyB,gBAA2D;CAC3F,MAAM,CAAC,QAAQ,aAAaA,QAAM,SAAgC,SAAS;CAE3E,QAAM,sBAAsB;EAC1B,IAAI,CAAC,gBAAgB;EACrB,MAAM,SAAS,iBAAiB,cAAc;E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D;GAEE,KAAK,YAAY;GACjB,cAAY,IAAI;GAChB,OAAO,wBAAwB,IAAI,OAAO,MAAM;GAC1C;GACN,IAAI,OAAO,SAAS,WAAW;GAC/B,OAAO,OAAO;GACd,QAAQ,SAAS,IAAI;GACrB,YAAY,aAAa,IAAI;GAC7B,UAAU,WAAW,IAAI;GACzB,eAAe,gBAAgB,IAAI;GACnC,GAAI,qBAAqB,MAAM,UAAU;GACzC,aAAW,QAAQ,KAAA;GACnB,WAAW,OAAO,wCAAwC,KAAA;GAG1D,GAAK,OAAO,SACR;IACE,OAAO,IAAI;IACX,gBAAgB,MAAM;IACtB,iBAAiB,IAAI,QAAQ;GAC/B,IACA;GACJ,GAAK,CAAC,OAAO,UAAU,OACnB;IACE,iBAAiB;IACjB,iBAAiB,GAAG,OAAO,UAAU,OAAO,QAAQ;GACtD,IACA;EACL,GA7BM,IAAI,GA6BV;CAEL,CAAC,CACD,EAAA,CAAA;AAEN"}
@@ -7,6 +7,8 @@ interface DataGridPaginationProps {
7
7
  sizesDescription?: string;
8
8
  sizesSkeleton?: ReactNode;
9
9
  more?: boolean;
10
+ /** Page buttons the truncated middle shows; the row adds first, last and
11
+ * an ellipsis for each hidden stretch. Clamped to a minimum of 3. */
10
12
  moreLimit?: number;
11
13
  info?: string;
12
14
  infoSkeleton?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"data-grid-pagination.d.ts","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-pagination.tsx"],"mappings":";;UAWU;EACR;EACA;EACA;EACA;EACA,gBAAgB;EAChB;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;;iBAGO,mBAAmB,OAAO,0BAA0B,IAAI"}
1
+ {"version":3,"file":"data-grid-pagination.d.ts","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-pagination.tsx"],"mappings":";;UAWU;EACR;EACA;EACA;EACA;EACA,gBAAgB;EAChB;;;EAGA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;;iBAiGO,mBAAmB,OAAO,0BAA0B,IAAI"}
@@ -7,6 +7,89 @@ import { cn } from "@kumix/utils";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
9
9
  //#region src/components/reui/data-grid/data-grid-pagination.tsx
10
+ /**
11
+ * The adaptive window: first page, the run around the current one, last page,
12
+ * with an ellipsis standing in for each hidden stretch. It replaced fixed
13
+ * BLOCKS (1-5, then 6-10) because a block never shows the last page, so on a
14
+ * 50-page grid there was no way to reach the end - the primitive wires only
15
+ * `previousPage()` / `nextPage()`, so there is no last-page arrow either.
16
+ *
17
+ * `limit` is `moreLimit`: how many page buttons the truncated middle shows.
18
+ * At the default of 5 this emits exactly the same rows as the block version
19
+ * did at `moreLimit: 5`, so the prop keeps both its meaning and its default.
20
+ * An ellipsis never stands for a single page, because the early return covers
21
+ * every count a full row could hold.
22
+ */
23
+ function getDataGridPaginationItems(pageIndex, pageCount, limit) {
24
+ const sibling = Math.max(0, Math.floor(((Math.floor(limit) || 3) - 3) / 2));
25
+ const pages = sibling * 2 + 3;
26
+ if (pageCount <= pages + 2) return Array.from({ length: pageCount }, (_, index) => ({
27
+ type: "page",
28
+ index
29
+ }));
30
+ if (pageIndex <= sibling + 2) return [
31
+ ...Array.from({ length: pages }, (_, index) => ({
32
+ type: "page",
33
+ index
34
+ })),
35
+ {
36
+ type: "ellipsis",
37
+ direction: "next",
38
+ target: pages
39
+ },
40
+ {
41
+ type: "page",
42
+ index: pageCount - 1
43
+ }
44
+ ];
45
+ if (pageIndex >= pageCount - sibling - 3) return [
46
+ {
47
+ type: "page",
48
+ index: 0
49
+ },
50
+ {
51
+ type: "ellipsis",
52
+ direction: "previous",
53
+ target: pageCount - pages - 1
54
+ },
55
+ ...Array.from({ length: pages }, (_, offset) => ({
56
+ type: "page",
57
+ index: pageCount - pages + offset
58
+ }))
59
+ ];
60
+ return [
61
+ {
62
+ type: "page",
63
+ index: 0
64
+ },
65
+ {
66
+ type: "ellipsis",
67
+ direction: "previous",
68
+ target: pageIndex - sibling - 1
69
+ },
70
+ ...Array.from({ length: sibling * 2 + 1 }, (_, offset) => ({
71
+ type: "page",
72
+ index: pageIndex - sibling + offset
73
+ })),
74
+ {
75
+ type: "ellipsis",
76
+ direction: "next",
77
+ target: pageIndex + sibling + 1
78
+ },
79
+ {
80
+ type: "page",
81
+ index: pageCount - 1
82
+ }
83
+ ];
84
+ }
85
+ /**
86
+ * A page button is square at one digit and grows from there, so the row does
87
+ * not reflow when the count crosses 10 or 100. The floor is each style's own
88
+ * `icon-sm` square, which is also its `sm` HEIGHT, so the numbers stay square
89
+ * and keep the arrows' height. Hardcoding one value would be right in three
90
+ * styles and wrong in five.
91
+ */
92
+ const PAGE_BUTTON_WIDTH_CLASS = "min-w-7";
10
93
  function DataGridPagination(props) {
11
94
  const { i18n, table, recordCount, isLoading } = useDataGrid();
12
95
  const mergedProps = {
@@ -38,44 +121,7 @@ function DataGridPagination(props) {
38
121
  to,
39
122
  count: recordCount
40
123
  });
41
- const paginationMoreLimit = mergedProps.moreLimit || 5;
42
- const currentGroupStart = Math.floor(pageIndex / paginationMoreLimit) * paginationMoreLimit;
43
- const currentGroupEnd = Math.min(currentGroupStart + paginationMoreLimit, pageCount);
44
- const renderPageButtons = () => {
45
- const buttons = [];
46
- for (let i = currentGroupStart; i < currentGroupEnd; i++) buttons.push(/* @__PURE__ */ jsx(Button, {
47
- size: "icon-sm",
48
- variant: "ghost",
49
- "aria-label": i18n.labels.goToPage(i + 1),
50
- "aria-current": pageIndex === i ? "page" : void 0,
51
- className: cn(btnBaseClasses, "text-muted-foreground", { "bg-accent text-accent-foreground": pageIndex === i }),
52
- onClick: () => {
53
- if (pageIndex !== i) table.setPageIndex(i);
54
- },
55
- children: i + 1
56
- }, i));
57
- return buttons;
58
- };
59
- const renderEllipsisPrevButton = () => {
60
- if (currentGroupStart > 0) return /* @__PURE__ */ jsx(Button, {
61
- size: "icon-sm",
62
- className: btnBaseClasses,
63
- variant: "ghost",
64
- onClick: () => table.setPageIndex(currentGroupStart - 1),
65
- children: mergedProps.ellipsisText
66
- });
67
- return null;
68
- };
69
- const renderEllipsisNextButton = () => {
70
- if (currentGroupEnd < pageCount) return /* @__PURE__ */ jsx(Button, {
71
- className: btnBaseClasses,
72
- variant: "ghost",
73
- size: "icon-sm",
74
- onClick: () => table.setPageIndex(currentGroupEnd),
75
- children: mergedProps.ellipsisText
76
- });
77
- return null;
78
- };
124
+ const paginationItems = getDataGridPaginationItems(pageIndex, pageCount, mergedProps.moreLimit ?? 5);
79
125
  return /* @__PURE__ */ jsxs("div", {
80
126
  "data-slot": "data-grid-pagination",
81
127
  className: cn("flex grow flex-col flex-wrap items-center justify-between gap-2.5 py-2.5 sm:flex-row sm:py-0", mergedProps.className),
@@ -111,7 +157,7 @@ function DataGridPagination(props) {
111
157
  className: "order-2 text-nowrap text-muted-foreground text-sm sm:order-1",
112
158
  children: paginationInfo
113
159
  }), pageCount > 1 && /* @__PURE__ */ jsxs("div", {
114
- className: "order-1 flex items-center space-x-1",
160
+ className: "order-1 flex flex-wrap items-center justify-center gap-1 sm:flex-nowrap",
115
161
  children: [
116
162
  /* @__PURE__ */ jsxs(Button, {
117
163
  size: "icon-sm",
@@ -124,9 +170,24 @@ function DataGridPagination(props) {
124
170
  children: mergedProps.previousPageLabel
125
171
  }), /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "size-4" })]
126
172
  }),
127
- renderEllipsisPrevButton(),
128
- renderPageButtons(),
129
- renderEllipsisNextButton(),
173
+ paginationItems.map((item) => item.type === "page" ? /* @__PURE__ */ jsx(Button, {
174
+ size: "sm",
175
+ variant: "ghost",
176
+ "aria-label": i18n.labels.goToPage(item.index + 1),
177
+ "aria-current": pageIndex === item.index ? "page" : void 0,
178
+ className: cn(PAGE_BUTTON_WIDTH_CLASS, "px-1.5 text-sm", "text-muted-foreground", { "bg-accent text-accent-foreground": pageIndex === item.index }),
179
+ onClick: () => {
180
+ if (pageIndex !== item.index) table.setPageIndex(item.index);
181
+ },
182
+ children: item.index + 1
183
+ }, `page-${item.index}`) : /* @__PURE__ */ jsx(Button, {
184
+ size: "icon-sm",
185
+ className: btnBaseClasses,
186
+ variant: "ghost",
187
+ "aria-label": i18n.labels.goToPage(item.target + 1),
188
+ onClick: () => table.setPageIndex(item.target),
189
+ children: mergedProps.ellipsisText
190
+ }, `ellipsis-${item.direction}`)),
130
191
  /* @__PURE__ */ jsxs(Button, {
131
192
  size: "icon-sm",
132
193
  variant: "ghost",
@@ -1 +1 @@
1
- {"version":3,"file":"data-grid-pagination.js","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-pagination.tsx"],"sourcesContent":["\"use client\";\n\nimport type { JSX, ReactNode } from \"react\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"../../ui/select\";\nimport { Skeleton } from \"../../ui/skeleton\";\nimport { useDataGrid } from \"./data-grid\";\n\ninterface DataGridPaginationProps {\n sizes?: number[];\n sizesInfo?: string;\n sizesLabel?: string;\n sizesDescription?: string;\n sizesSkeleton?: ReactNode;\n more?: boolean;\n moreLimit?: number;\n info?: string;\n infoSkeleton?: ReactNode;\n className?: string;\n rowsPerPageLabel?: string;\n previousPageLabel?: string;\n nextPageLabel?: string;\n ellipsisText?: string;\n}\n\nfunction DataGridPagination(props: DataGridPaginationProps): JSX.Element {\n const { i18n, table, recordCount, isLoading } = useDataGrid();\n\n const defaultProps: Partial<DataGridPaginationProps> = {\n sizes: [5, 10, 25, 50, 100],\n sizesSkeleton: <Skeleton className=\"h-8 w-44\" />,\n moreLimit: 5,\n infoSkeleton: <Skeleton className=\"h-8 w-60\" />,\n rowsPerPageLabel: i18n.labels.rowsPerPage,\n previousPageLabel: i18n.labels.previousPage,\n nextPageLabel: i18n.labels.nextPage,\n ellipsisText: i18n.labels.paginationEllipsis,\n };\n\n const mergedProps: DataGridPaginationProps = { ...defaultProps, ...props };\n\n const btnBaseClasses = \"p-0 text-sm\";\n const btnArrowClasses = `${btnBaseClasses} rtl:transform rtl:rotate-180`;\n const pageIndex = table.state.pagination.pageIndex;\n const pageSize = table.state.pagination.pageSize;\n const from = recordCount === 0 ? 0 : pageIndex * pageSize + 1;\n const to = Math.min((pageIndex + 1) * pageSize, recordCount);\n const pageCount = table.getPageCount();\n\n // A supplied `info` keeps its placeholder-template contract; the default\n // routes through the i18n label function, where word order is free.\n const paginationInfo = mergedProps.info\n ? mergedProps.info\n .replaceAll(\"{from}\", from.toString())\n .replaceAll(\"{to}\", to.toString())\n .replaceAll(\"{count}\", recordCount.toString())\n : i18n.labels.paginationInfo({ from, to, count: recordCount });\n\n // Pagination limit logic\n const paginationMoreLimit = mergedProps.moreLimit || 5;\n\n // Determine the start and end of the pagination group\n const currentGroupStart = Math.floor(pageIndex / paginationMoreLimit) * paginationMoreLimit;\n const currentGroupEnd = Math.min(currentGroupStart + paginationMoreLimit, pageCount);\n\n // Render page buttons based on the current group\n const renderPageButtons = () => {\n const buttons = [];\n for (let i = currentGroupStart; i < currentGroupEnd; i++) {\n buttons.push(\n <Button\n key={i}\n size=\"icon-sm\"\n variant=\"ghost\"\n aria-label={i18n.labels.goToPage(i + 1)}\n aria-current={pageIndex === i ? \"page\" : undefined}\n className={cn(btnBaseClasses, \"text-muted-foreground\", {\n \"bg-accent text-accent-foreground\": pageIndex === i,\n })}\n onClick={() => {\n if (pageIndex !== i) {\n table.setPageIndex(i);\n }\n }}\n >\n {i + 1}\n </Button>,\n );\n }\n return buttons;\n };\n\n // Render a \"previous\" ellipsis button if there are previous pages to show\n const renderEllipsisPrevButton = () => {\n if (currentGroupStart > 0) {\n return (\n <Button\n size=\"icon-sm\"\n className={btnBaseClasses}\n variant=\"ghost\"\n onClick={() => table.setPageIndex(currentGroupStart - 1)}\n >\n {mergedProps.ellipsisText}\n </Button>\n );\n }\n return null;\n };\n\n // Render a \"next\" ellipsis button if there are more pages to show after the current group\n const renderEllipsisNextButton = () => {\n if (currentGroupEnd < pageCount) {\n return (\n <Button\n className={btnBaseClasses}\n variant=\"ghost\"\n size=\"icon-sm\"\n onClick={() => table.setPageIndex(currentGroupEnd)}\n >\n {mergedProps.ellipsisText}\n </Button>\n );\n }\n return null;\n };\n\n return (\n <div\n data-slot=\"data-grid-pagination\"\n className={cn(\n \"flex grow flex-col flex-wrap items-center justify-between gap-2.5 py-2.5 sm:flex-row sm:py-0\",\n mergedProps.className,\n )}\n >\n <div className=\"order-2 flex flex-wrap items-center space-x-2.5 pb-2.5 sm:order-1 sm:pb-0\">\n {isLoading ? (\n mergedProps.sizesSkeleton\n ) : (\n <>\n <div className=\"text-muted-foreground text-sm\">{mergedProps.rowsPerPageLabel}</div>\n <Select\n value={`${pageSize}`}\n onValueChange={(value) => {\n const newPageSize = Number(value);\n table.setPageSize(newPageSize);\n }}\n >\n {/* w-fit with a min, never a fixed width: a fixed w-16 clipped\n the value \"100\" by 1px at nova's paddings, while fit-content\n grows the trigger for 3-digit sizes and the min keeps the\n 1-2 digit ones from collapsing narrower than 64px. */}\n <SelectTrigger\n aria-label={mergedProps.rowsPerPageLabel}\n className=\"w-fit min-w-16\"\n size=\"sm\"\n >\n <SelectValue />\n </SelectTrigger>\n <SelectContent\n align=\"start\"\n alignItemWithTrigger={false}\n className=\"min-w-(--anchor-width)\"\n >\n {mergedProps.sizes?.map((size: number) => (\n <SelectItem key={size} value={`${size}`}>\n {size}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </>\n )}\n </div>\n <div className=\"order-1 flex flex-col items-center justify-center gap-2.5 pt-2.5 sm:order-2 sm:flex-row sm:justify-end sm:pt-0\">\n {isLoading ? (\n mergedProps.infoSkeleton\n ) : (\n <>\n <div className=\"order-2 text-nowrap text-muted-foreground text-sm sm:order-1\">\n {paginationInfo}\n </div>\n {pageCount > 1 && (\n <div className=\"order-1 flex items-center space-x-1\">\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n className={btnArrowClasses}\n onClick={() => table.previousPage()}\n disabled={!table.getCanPreviousPage()}\n >\n <span className=\"sr-only\">{mergedProps.previousPageLabel}</span>\n <ChevronLeftIcon className=\"size-4\" />\n </Button>\n\n {renderEllipsisPrevButton()}\n\n {renderPageButtons()}\n\n {renderEllipsisNextButton()}\n\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n className={btnArrowClasses}\n onClick={() => table.nextPage()}\n disabled={!table.getCanNextPage()}\n >\n <span className=\"sr-only\">{mergedProps.nextPageLabel}</span>\n <ChevronRightIcon className=\"size-4\" />\n </Button>\n </div>\n )}\n </>\n )}\n </div>\n </div>\n );\n}\n\nexport { DataGridPagination, type DataGridPaginationProps };\n"],"mappings":";;;;;;;;;AA4BA,SAAS,mBAAmB,OAA6C;CACvE,MAAM,EAAE,MAAM,OAAO,aAAa,cAAc,YAAY;CAa5D,MAAM,cAAuC;EAV3C,OAAO;GAAC;GAAG;GAAI;GAAI;GAAI;EAAG;EAC1B,eAAe,oBAAC,UAAD,EAAU,WAAU,WAAY,CAAA;EAC/C,WAAW;EACX,cAAc,oBAAC,UAAD,EAAU,WAAU,WAAY,CAAA;EAC9C,kBAAkB,KAAK,OAAO;EAC9B,mBAAmB,KAAK,OAAO;EAC/B,eAAe,KAAK,OAAO;EAC3B,cAAc,KAAK,OAAO;EAGoC,GAAG;CAAM;CAEzE,MAAM,iBAAiB;CACvB,MAAM,kBAAkB,GAAG,eAAe;CAC1C,MAAM,YAAY,MAAM,MAAM,WAAW;CACzC,MAAM,WAAW,MAAM,MAAM,WAAW;CACxC,MAAM,OAAO,gBAAgB,IAAI,IAAI,YAAY,WAAW;CAC5D,MAAM,KAAK,KAAK,KAAK,YAAY,KAAK,UAAU,WAAW;CAC3D,MAAM,YAAY,MAAM,aAAa;CAIrC,MAAM,iBAAiB,YAAY,OAC/B,YAAY,KACT,WAAW,UAAU,KAAK,SAAS,CAAC,CAA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EAAA,CAAA;EAED,CAAA,CACF;;AAET"}
1
+ {"version":3,"file":"data-grid-pagination.js","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-pagination.tsx"],"sourcesContent":["\"use client\";\n\nimport type { JSX, ReactNode } from \"react\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"../../ui/select\";\nimport { Skeleton } from \"../../ui/skeleton\";\nimport { useDataGrid } from \"./data-grid\";\n\ninterface DataGridPaginationProps {\n sizes?: number[];\n sizesInfo?: string;\n sizesLabel?: string;\n sizesDescription?: string;\n sizesSkeleton?: ReactNode;\n more?: boolean;\n /** Page buttons the truncated middle shows; the row adds first, last and\n * an ellipsis for each hidden stretch. Clamped to a minimum of 3. */\n moreLimit?: number;\n info?: string;\n infoSkeleton?: ReactNode;\n className?: string;\n rowsPerPageLabel?: string;\n previousPageLabel?: string;\n nextPageLabel?: string;\n ellipsisText?: string;\n}\n\n/**\n * One slot in the page row: a page button, or an ellipsis that jumps over the\n * pages it stands for.\n */\ntype DataGridPaginationItem =\n | { type: \"page\"; index: number }\n | { type: \"ellipsis\"; direction: \"previous\"; target: number }\n | { type: \"ellipsis\"; direction: \"next\"; target: number };\n\n/**\n * The adaptive window: first page, the run around the current one, last page,\n * with an ellipsis standing in for each hidden stretch. It replaced fixed\n * BLOCKS (1-5, then 6-10) because a block never shows the last page, so on a\n * 50-page grid there was no way to reach the end - the primitive wires only\n * `previousPage()` / `nextPage()`, so there is no last-page arrow either.\n *\n * `limit` is `moreLimit`: how many page buttons the truncated middle shows.\n * At the default of 5 this emits exactly the same rows as the block version\n * did at `moreLimit: 5`, so the prop keeps both its meaning and its default.\n * An ellipsis never stands for a single page, because the early return covers\n * every count a full row could hold.\n */\nfunction getDataGridPaginationItems(\n pageIndex: number,\n pageCount: number,\n limit: number,\n): DataGridPaginationItem[] {\n // Pages flanking the current one, per side. The run is rebuilt from it so\n // the count is always odd: an even `limit` would make the head and tail\n // rows one slot wider than the middle, and the footer would twitch as the\n // user pages through.\n const sibling = Math.max(0, Math.floor(((Math.floor(limit) || 3) - 3) / 2));\n const pages = sibling * 2 + 3;\n\n // Two ellipses cost the width of two pages, so below this there is nothing\n // to gain by hiding any.\n if (pageCount <= pages + 2) {\n return Array.from({ length: pageCount }, (_, index) => ({\n type: \"page\" as const,\n index,\n }));\n }\n\n if (pageIndex <= sibling + 2) {\n return [\n ...Array.from({ length: pages }, (_, index) => ({\n type: \"page\" as const,\n index,\n })),\n { type: \"ellipsis\", direction: \"next\", target: pages },\n { type: \"page\", index: pageCount - 1 },\n ];\n }\n\n if (pageIndex >= pageCount - sibling - 3) {\n return [\n { type: \"page\", index: 0 },\n {\n type: \"ellipsis\",\n direction: \"previous\",\n target: pageCount - pages - 1,\n },\n ...Array.from({ length: pages }, (_, offset) => ({\n type: \"page\" as const,\n index: pageCount - pages + offset,\n })),\n ];\n }\n\n return [\n { type: \"page\", index: 0 },\n {\n type: \"ellipsis\",\n direction: \"previous\",\n target: pageIndex - sibling - 1,\n },\n ...Array.from({ length: sibling * 2 + 1 }, (_, offset) => ({\n type: \"page\" as const,\n index: pageIndex - sibling + offset,\n })),\n { type: \"ellipsis\", direction: \"next\", target: pageIndex + sibling + 1 },\n { type: \"page\", index: pageCount - 1 },\n ];\n}\n\n/**\n * A page button is square at one digit and grows from there, so the row does\n * not reflow when the count crosses 10 or 100. The floor is each style's own\n * `icon-sm` square, which is also its `sm` HEIGHT, so the numbers stay square\n * and keep the arrows' height. Hardcoding one value would be right in three\n * styles and wrong in five.\n */\nconst PAGE_BUTTON_WIDTH_CLASS = \"min-w-7\";\n\nfunction DataGridPagination(props: DataGridPaginationProps): JSX.Element {\n const { i18n, table, recordCount, isLoading } = useDataGrid();\n\n const defaultProps: Partial<DataGridPaginationProps> = {\n sizes: [5, 10, 25, 50, 100],\n sizesSkeleton: <Skeleton className=\"h-8 w-44\" />,\n moreLimit: 5,\n infoSkeleton: <Skeleton className=\"h-8 w-60\" />,\n rowsPerPageLabel: i18n.labels.rowsPerPage,\n previousPageLabel: i18n.labels.previousPage,\n nextPageLabel: i18n.labels.nextPage,\n ellipsisText: i18n.labels.paginationEllipsis,\n };\n\n const mergedProps: DataGridPaginationProps = { ...defaultProps, ...props };\n\n const btnBaseClasses = \"p-0 text-sm\";\n const btnArrowClasses = `${btnBaseClasses} rtl:transform rtl:rotate-180`;\n const pageIndex = table.state.pagination.pageIndex;\n const pageSize = table.state.pagination.pageSize;\n const from = recordCount === 0 ? 0 : pageIndex * pageSize + 1;\n const to = Math.min((pageIndex + 1) * pageSize, recordCount);\n const pageCount = table.getPageCount();\n\n // A supplied `info` keeps its placeholder-template contract; the default\n // routes through the i18n label function, where word order is free.\n const paginationInfo = mergedProps.info\n ? mergedProps.info\n .replaceAll(\"{from}\", from.toString())\n .replaceAll(\"{to}\", to.toString())\n .replaceAll(\"{count}\", recordCount.toString())\n : i18n.labels.paginationInfo({ from, to, count: recordCount });\n\n const paginationItems = getDataGridPaginationItems(\n pageIndex,\n pageCount,\n mergedProps.moreLimit ?? 5,\n );\n\n return (\n <div\n data-slot=\"data-grid-pagination\"\n className={cn(\n \"flex grow flex-col flex-wrap items-center justify-between gap-2.5 py-2.5 sm:flex-row sm:py-0\",\n mergedProps.className,\n )}\n >\n <div className=\"order-2 flex flex-wrap items-center space-x-2.5 pb-2.5 sm:order-1 sm:pb-0\">\n {isLoading ? (\n mergedProps.sizesSkeleton\n ) : (\n <>\n <div className=\"text-muted-foreground text-sm\">{mergedProps.rowsPerPageLabel}</div>\n <Select\n value={`${pageSize}`}\n onValueChange={(value) => {\n const newPageSize = Number(value);\n table.setPageSize(newPageSize);\n }}\n >\n {/* w-fit with a min, never a fixed width: a fixed w-16 clipped\n the value \"100\" by 1px at nova's paddings, while fit-content\n grows the trigger for 3-digit sizes and the min keeps the\n 1-2 digit ones from collapsing narrower than 64px. */}\n <SelectTrigger\n aria-label={mergedProps.rowsPerPageLabel}\n className=\"w-fit min-w-16\"\n size=\"sm\"\n >\n <SelectValue />\n </SelectTrigger>\n <SelectContent\n align=\"start\"\n alignItemWithTrigger={false}\n className=\"min-w-(--anchor-width)\"\n >\n {mergedProps.sizes?.map((size: number) => (\n <SelectItem key={size} value={`${size}`}>\n {size}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </>\n )}\n </div>\n <div className=\"order-1 flex flex-col items-center justify-center gap-2.5 pt-2.5 sm:order-2 sm:flex-row sm:justify-end sm:pt-0\">\n {isLoading ? (\n mergedProps.infoSkeleton\n ) : (\n <>\n <div className=\"order-2 text-nowrap text-muted-foreground text-sm sm:order-1\">\n {paginationInfo}\n </div>\n {pageCount > 1 && (\n <div className=\"order-1 flex flex-wrap items-center justify-center gap-1 sm:flex-nowrap\">\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n className={btnArrowClasses}\n onClick={() => table.previousPage()}\n disabled={!table.getCanPreviousPage()}\n >\n <span className=\"sr-only\">{mergedProps.previousPageLabel}</span>\n <ChevronLeftIcon className=\"size-4\" />\n </Button>\n\n {paginationItems.map((item) =>\n item.type === \"page\" ? (\n <Button\n key={`page-${item.index}`}\n size=\"sm\"\n variant=\"ghost\"\n aria-label={i18n.labels.goToPage(item.index + 1)}\n aria-current={pageIndex === item.index ? \"page\" : undefined}\n className={cn(\n PAGE_BUTTON_WIDTH_CLASS,\n \"px-1.5 text-sm\",\n \"text-muted-foreground\",\n {\n \"bg-accent text-accent-foreground\": pageIndex === item.index,\n },\n )}\n onClick={() => {\n if (pageIndex !== item.index) {\n table.setPageIndex(item.index);\n }\n }}\n >\n {item.index + 1}\n </Button>\n ) : (\n /* Clickable, unlike the shadcn PaginationEllipsis, which is\n an aria-hidden span. This one MOVES the user, so it needs\n a name saying where. */\n <Button\n key={`ellipsis-${item.direction}`}\n size=\"icon-sm\"\n className={btnBaseClasses}\n variant=\"ghost\"\n aria-label={i18n.labels.goToPage(item.target + 1)}\n onClick={() => table.setPageIndex(item.target)}\n >\n {mergedProps.ellipsisText}\n </Button>\n ),\n )}\n\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n className={btnArrowClasses}\n onClick={() => table.nextPage()}\n disabled={!table.getCanNextPage()}\n >\n <span className=\"sr-only\">{mergedProps.nextPageLabel}</span>\n <ChevronRightIcon className=\"size-4\" />\n </Button>\n </div>\n )}\n </>\n )}\n </div>\n </div>\n );\n}\n\nexport { DataGridPagination, type DataGridPaginationProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoDA,SAAS,2BACP,WACA,WACA,OAC0B;CAK1B,MAAM,UAAU,KAAK,IAAI,GAAG,KAAK,QAAQ,KAAK,MAAM,KAAK,KAAK,KAAK,KAAK,CAAC,CAAC;CAC1E,MAAM,QAAQ,UAAU,IAAI;CAI5B,IAAI,aAAa,QAAQ,GACvB,OAAO,MAAM,KAAK,EAAE,QAAQ,UAAU,IAAI,GAAG,WAAW;EACtD,MAAM;EACN;CACF,EAAE;CAGJ,IAAI,aAAa,UAAU,GACzB,OAAO;EACL,GAAG,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,WAAW;GAC9C,MAAM;GACN;EACF,EAAE;EACF;GAAE,MAAM;GAAY,WAAW;GAAQ,QAAQ;EAAM;EACrD;GAAE,MAAM;GAAQ,OAAO,YAAY;EAAE;CACvC;CAGF,IAAI,aAAa,YAAY,UAAU,GACrC,OAAO;EACL;GAAE,MAAM;GAAQ,OAAO;EAAE;EACzB;GACE,MAAM;GACN,WAAW;GACX,QAAQ,YAAY,QAAQ;EAC9B;EACA,GAAG,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,YAAY;GAC/C,MAAM;GACN,OAAO,YAAY,QAAQ;EAC7B,EAAE;CACJ;CAGF,OAAO;EACL;GAAE,MAAM;GAAQ,OAAO;EAAE;EACzB;GACE,MAAM;GACN,WAAW;GACX,QAAQ,YAAY,UAAU;EAChC;EACA,G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A;MAClD,WAAW,GACT,yBACA,kBACA,yBACA,EACE,oCAAoC,cAAc,KAAK,MACzD,CACF;MACA,eAAe;OACb,IAAI,cAAc,KAAK,OACrB,MAAM,aAAa,KAAK,KAAK;MAEjC;MAEC,UAAA,KAAK,QAAQ;KACR,GApBD,QAAQ,KAAK,OAoBZ,IAKR,oBAAC,QAAD;MAEE,MAAK;MACL,WAAW;MACX,SAAQ;MACR,cAAY,KAAK,OAAO,SAAS,KAAK,SAAS,CAAC;MAChD,eAAe,MAAM,aAAa,KAAK,MAAM;MAE5C,UAAA,YAAY;KACP,GARD,YAAY,KAAK,WAQhB,CAEZ;KAEA,qBAAC,QAAD;MACE,MAAK;MACL,SAAQ;MACR,WAAW;MACX,eAAe,MAAM,SAAS;MAC9B,UAAU,CAAC,MAAM,eAAe;MALlC,UAAA,CAOE,oBAAC,QAAD;OAAM,WAAU;OAAW,UAAA,YAAY;MAAoB,CAAA,GAC3D,oBAAC,kBAAD,EAAkB,WAAU,SAAU,CAAA,CAChC;;IACL;GAEP,CAAA,CAAA,EAAA,CAAA;EAED,CAAA,CACF;;AAET"}
@@ -559,7 +559,7 @@ function DataGridTableHeadRowCellResize({ header }) {
559
559
  onDoubleClick: () => column.resetSize(),
560
560
  onMouseDown: handleMouseDown,
561
561
  onTouchStart: handleTouchStart,
562
- className: cn("user-select-none absolute top-0 z-10 flex h-full cursor-col-resize touch-none", isPinned === "end" ? cn("start-0 w-5 justify-start", props.tableLayout?.columnsPinnable ? "before:hidden" : "before:absolute before:inset-y-0 before:start-0 before:w-px before:bg-border") : isLastVisibleColumn ? "end-0 w-5 justify-end before:hidden" : isPinned ? cn("end-0 w-5 justify-end", props.tableLayout?.columnsPinnable ? "before:hidden" : "before:absolute before:inset-y-0 before:end-0 before:w-px before:bg-border") : cn("-end-2 w-5 justify-center", props.tableLayout?.cellBorder ? "before:hidden" : "before:absolute before:inset-y-0 before:w-px before:-translate-x-px before:bg-border"), column.getIsResizing() && (isResizeModeOnEnd ? "opacity-100" : isLastVisibleColumn ? "opacity-100 before:absolute before:inset-y-0 before:end-0 before:block before:w-0.5 before:bg-primary" : "opacity-100 before:block before:w-0.5 before:bg-primary"))
562
+ className: cn("absolute top-0 z-10 flex h-full cursor-col-resize touch-none select-none", isPinned === "end" ? cn("start-0 w-5 justify-start", props.tableLayout?.columnsPinnable ? "before:hidden" : "before:absolute before:inset-y-0 before:start-0 before:w-px before:bg-border") : isLastVisibleColumn ? "end-0 w-5 justify-end before:hidden" : isPinned ? cn("end-0 w-5 justify-end", props.tableLayout?.columnsPinnable ? "before:hidden" : "before:absolute before:inset-y-0 before:end-0 before:w-px before:bg-border") : cn("-end-2 w-5 justify-center", props.tableLayout?.cellBorder ? "before:hidden" : "before:absolute before:inset-y-0 before:w-px before:-translate-x-px before:bg-border"), column.getIsResizing() && (isResizeModeOnEnd ? "opacity-100" : isLastVisibleColumn ? "opacity-100 before:absolute before:inset-y-0 before:end-0 before:block before:w-0.5 before:bg-primary" : "opacity-100 before:block before:w-0.5 before:bg-primary"))
563
563
  });
564
564
  }
565
565
  function DataGridTableResizeIndicator({ viewportNodeRef }) {