@vritti/quantum-ui 0.6.4 → 0.6.6

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 (156) hide show
  1. package/dist/Badge2.js +2 -0
  2. package/dist/Badge2.js.map +1 -1
  3. package/dist/ChartFrame.js +1 -1
  4. package/dist/ChartFrame.js.map +1 -1
  5. package/dist/CurrencyFieldFilter.js +53 -27
  6. package/dist/CurrencyFieldFilter.js.map +1 -1
  7. package/dist/CurrencySelector.js.map +1 -1
  8. package/dist/DateRangePicker.js +1 -1
  9. package/dist/DateTimePicker.js +1 -1
  10. package/dist/DropdownMenu.js +64 -33
  11. package/dist/DropdownMenu.js.map +1 -1
  12. package/dist/ISOCountrySelect.js.map +1 -1
  13. package/dist/LocaleSelector.js.map +1 -1
  14. package/dist/Progress.js +31 -4
  15. package/dist/Progress.js.map +1 -1
  16. package/dist/QuantityField.js +190 -0
  17. package/dist/QuantityField.js.map +1 -0
  18. package/dist/SegmentedProgressKey.js +65 -0
  19. package/dist/SegmentedProgressKey.js.map +1 -0
  20. package/dist/Select.js +47 -13
  21. package/dist/Select.js.map +1 -1
  22. package/dist/SelectFilter.js +19 -3
  23. package/dist/SelectFilter.js.map +1 -1
  24. package/dist/Sidebar.js +1 -1
  25. package/dist/SingleSelect.js +24 -6
  26. package/dist/SingleSelect.js.map +1 -1
  27. package/dist/Spinner.js +1 -7
  28. package/dist/Spinner.js.map +1 -1
  29. package/dist/Spinner2.js +10 -0
  30. package/dist/Spinner2.js.map +1 -0
  31. package/dist/StepProgressIndicator.js +49 -28
  32. package/dist/StepProgressIndicator.js.map +1 -1
  33. package/dist/SwitchFilter.js +80 -0
  34. package/dist/SwitchFilter.js.map +1 -0
  35. package/dist/TimezoneSelector.js.map +1 -1
  36. package/dist/ValueFilter.js +2 -2
  37. package/dist/ValueFilter.js.map +1 -1
  38. package/dist/assets/quantum-ui.css +260 -4
  39. package/dist/calendar2.js +1 -1
  40. package/dist/components/DataTable.js +1 -1
  41. package/dist/components/DateFilter.js +1 -1
  42. package/dist/components/FormattedDate.js +1 -1
  43. package/dist/components/QuantityField.js +2 -0
  44. package/dist/components/QuantityField.js.map +1 -0
  45. package/dist/components/SegmentedProgress.js +2 -0
  46. package/dist/components/SegmentedProgress.js.map +1 -0
  47. package/dist/components/Select.js.map +1 -1
  48. package/dist/components/Switch.js +1 -0
  49. package/dist/components/Switch.js.map +1 -1
  50. package/dist/contextAnchor.js +3 -2
  51. package/dist/contextAnchor.js.map +1 -1
  52. package/dist/dropdown-menu.js +1 -1
  53. package/dist/index.js +5 -2
  54. package/dist/index.js.map +1 -1
  55. package/dist/index14.js +1139 -20
  56. package/dist/index14.js.map +1 -1
  57. package/dist/index15.js +20 -1139
  58. package/dist/index15.js.map +1 -1
  59. package/dist/index34.js +2 -2
  60. package/dist/index6.js +90 -382
  61. package/dist/index6.js.map +1 -1
  62. package/dist/index7.js +382 -90
  63. package/dist/index7.js.map +1 -1
  64. package/dist/lib/components/Chart/ChartFrame.d.ts.map +1 -1
  65. package/dist/lib/components/CurrencyField/CurrencyFieldFilter.d.ts +2 -0
  66. package/dist/lib/components/CurrencyField/CurrencyFieldFilter.d.ts.map +1 -1
  67. package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
  68. package/dist/lib/components/DataTable/DataTableSkeleton.d.ts +11 -0
  69. package/dist/lib/components/DataTable/DataTableSkeleton.d.ts.map +1 -0
  70. package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts.map +1 -1
  71. package/dist/lib/components/DataTable/index.d.ts +3 -0
  72. package/dist/lib/components/DataTable/index.d.ts.map +1 -1
  73. package/dist/lib/components/DataTable/modes.d.ts +9 -0
  74. package/dist/lib/components/DataTable/modes.d.ts.map +1 -0
  75. package/dist/lib/components/DataTable/types.d.ts +3 -1
  76. package/dist/lib/components/DataTable/types.d.ts.map +1 -1
  77. package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  78. package/dist/lib/components/DropdownMenu/types.d.ts +1 -0
  79. package/dist/lib/components/DropdownMenu/types.d.ts.map +1 -1
  80. package/dist/lib/components/Progress/Progress.d.ts +3 -1
  81. package/dist/lib/components/Progress/Progress.d.ts.map +1 -1
  82. package/dist/lib/components/QuantityField/QuantityField.d.ts +22 -0
  83. package/dist/lib/components/QuantityField/QuantityField.d.ts.map +1 -0
  84. package/dist/lib/components/QuantityField/index.d.ts +3 -0
  85. package/dist/lib/components/QuantityField/index.d.ts.map +1 -0
  86. package/dist/lib/components/QuantityField/quantity.d.ts +13 -0
  87. package/dist/lib/components/QuantityField/quantity.d.ts.map +1 -0
  88. package/dist/lib/components/SegmentedProgress/SegmentedProgress.d.ts +16 -0
  89. package/dist/lib/components/SegmentedProgress/SegmentedProgress.d.ts.map +1 -0
  90. package/dist/lib/components/SegmentedProgress/SegmentedProgressKey.d.ts +14 -0
  91. package/dist/lib/components/SegmentedProgress/SegmentedProgressKey.d.ts.map +1 -0
  92. package/dist/lib/components/SegmentedProgress/index.d.ts +5 -0
  93. package/dist/lib/components/SegmentedProgress/index.d.ts.map +1 -0
  94. package/dist/lib/components/SegmentedProgress/steps.d.ts +2 -0
  95. package/dist/lib/components/SegmentedProgress/steps.d.ts.map +1 -0
  96. package/dist/lib/components/Select/Select.d.ts +11 -3
  97. package/dist/lib/components/Select/Select.d.ts.map +1 -1
  98. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  99. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -1
  100. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts +11 -3
  101. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -1
  102. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
  103. package/dist/lib/components/Select/contextAnchor.d.ts +3 -0
  104. package/dist/lib/components/Select/contextAnchor.d.ts.map +1 -1
  105. package/dist/lib/components/Select/hooks/useSelect.d.ts.map +1 -1
  106. package/dist/lib/components/Select/index.d.ts +1 -1
  107. package/dist/lib/components/Select/index.d.ts.map +1 -1
  108. package/dist/lib/components/StepProgressIndicator/StepProgressIndicator.d.ts +4 -1
  109. package/dist/lib/components/StepProgressIndicator/StepProgressIndicator.d.ts.map +1 -1
  110. package/dist/lib/components/Switch/SwitchFilter.d.ts +21 -0
  111. package/dist/lib/components/Switch/SwitchFilter.d.ts.map +1 -0
  112. package/dist/lib/components/Switch/index.d.ts +2 -0
  113. package/dist/lib/components/Switch/index.d.ts.map +1 -1
  114. package/dist/lib/components/ValueFilter/ValueFilter.d.ts +6 -1
  115. package/dist/lib/components/ValueFilter/ValueFilter.d.ts.map +1 -1
  116. package/dist/lib/components/index.d.ts +2 -0
  117. package/dist/lib/components/index.d.ts.map +1 -1
  118. package/dist/lib/hooks/useFormatters.d.ts +5 -1
  119. package/dist/lib/hooks/useFormatters.d.ts.map +1 -1
  120. package/dist/lib/selects/currency/CurrencySelector.d.ts +3 -4
  121. package/dist/lib/selects/currency/CurrencySelector.d.ts.map +1 -1
  122. package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts +1 -1
  123. package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts.map +1 -1
  124. package/dist/lib/selects/locale/LocaleSelector.d.ts +2 -1
  125. package/dist/lib/selects/locale/LocaleSelector.d.ts.map +1 -1
  126. package/dist/lib/selects/timezone/TimezoneSelector.d.ts +2 -1
  127. package/dist/lib/selects/timezone/TimezoneSelector.d.ts.map +1 -1
  128. package/dist/lib/utils/format.d.ts +18 -0
  129. package/dist/lib/utils/format.d.ts.map +1 -1
  130. package/dist/lib/utils/lodash.d.ts +1 -1
  131. package/dist/lib/utils/lodash.d.ts.map +1 -1
  132. package/dist/select2.js +1 -1
  133. package/dist/separator2.js +1 -1
  134. package/dist/shadcn/shadcnBadge/Badge.d.ts +1 -1
  135. package/dist/shadcn/shadcnBadge/Badge.d.ts.map +1 -1
  136. package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts +2 -1
  137. package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts.map +1 -1
  138. package/dist/shadcn/shadcnProgress/Progress.d.ts +4 -1
  139. package/dist/shadcn/shadcnProgress/Progress.d.ts.map +1 -1
  140. package/dist/shadcn/shadcnSingleSelect/single-select.d.ts +2 -1
  141. package/dist/shadcn/shadcnSingleSelect/single-select.d.ts.map +1 -1
  142. package/dist/timezone.js +2 -2
  143. package/dist/useContextState.js +1 -1
  144. package/dist/useDataTable.js +255 -213
  145. package/dist/useDataTable.js.map +1 -1
  146. package/dist/useFormatters.js +3 -1
  147. package/dist/useFormatters.js.map +1 -1
  148. package/dist/useWorkspaceCurrency.js +1 -1
  149. package/dist/utils/axios.js +1 -1
  150. package/dist/utils/currency.js +1 -1
  151. package/dist/utils/format.js +37 -3
  152. package/dist/utils/format.js.map +1 -1
  153. package/dist/utils/lodash.js +3 -1
  154. package/dist/utils/lodash.js.map +1 -1
  155. package/dist/utils/timezone.js +2 -2
  156. package/package.json +9 -1
@@ -47,7 +47,7 @@ import { S as Save, a as Share2 } from './share-2.js';
47
47
  import { P as Pencil, a as Plus, T as Trash2 } from './trash-2.js';
48
48
  import { S as Separator } from './separator2.js';
49
49
  import { C as Checkbox } from './Checkbox.js';
50
- import { g as getConfig } from './index7.js';
50
+ import { g as getConfig } from './index6.js';
51
51
  import { t as toast } from './toast.js';
52
52
 
53
53
  function viewsUrl(path = "") {
@@ -19359,7 +19359,7 @@ function DataTableSelectionBar({
19359
19359
  const exportConfig = importExport ?? {
19360
19360
  columns: table.getAllLeafColumns().filter((column) => "accessorKey" in column.columnDef && column.getIsVisible()).map((column) => ({
19361
19361
  key: column.id,
19362
- label: typeof column.columnDef.header === "string" ? column.columnDef.header : column.id
19362
+ label: typeof column.columnDef.header === "string" ? column.columnDef.header : column.columnDef.meta?.label ?? column.id
19363
19363
  })),
19364
19364
  filename: meta?.slug ?? "export"
19365
19365
  };
@@ -19433,7 +19433,7 @@ function SortableColumnItem({ column }) {
19433
19433
  const isPinned = column.getIsPinned();
19434
19434
  const isVisible = column.getIsVisible();
19435
19435
  const header = column.columnDef.header;
19436
- const label = typeof header === "string" ? header : column.id;
19436
+ const label = typeof header === "string" ? header : column.columnDef.meta?.label ?? column.id;
19437
19437
  return /* @__PURE__ */ jsx(SortableItem, { id: column.id, children: ({ isDragging, dragHandleProps }) => /* @__PURE__ */ jsxs(
19438
19438
  "div",
19439
19439
  {
@@ -23708,17 +23708,20 @@ function DataTableViewTabs({ slug }) {
23708
23708
  }
23709
23709
  DataTableViewTabs.displayName = "DataTableViewTabs";
23710
23710
 
23711
+ const DATA_TABLE_MODE_HEIGHTS = {
23712
+ page: "calc(100vh - 280px)",
23713
+ tab: "calc(100vh - 320px)",
23714
+ stepper: "calc(100vh - 355px)",
23715
+ stepperTab: "calc(100vh - 395px)",
23716
+ compact: "calc(100vh - 570px)"
23717
+ };
23718
+
23711
23719
  const densityClasses = {
23712
23720
  compact: "py-1 px-2 text-xs",
23713
23721
  normal: "py-2 px-3 text-sm",
23714
23722
  comfortable: "py-4 px-3 text-sm"
23715
23723
  };
23716
23724
  const NO_FILTERS = [];
23717
- const MODE_HEIGHTS = {
23718
- page: "calc(100vh - 280px)",
23719
- tab: "calc(100vh - 320px)",
23720
- compact: "calc(100vh - 570px)"
23721
- };
23722
23725
  function grows(column) {
23723
23726
  return column.getLeafColumns().some((leaf) => leaf.columnDef.meta?.grow === true);
23724
23727
  }
@@ -23975,217 +23978,224 @@ function DataTable({
23975
23978
  toolbarActions?.actions
23976
23979
  ] })
23977
23980
  ] }),
23978
- /* @__PURE__ */ jsxs("div", { className: "relative border rounded-lg overflow-hidden flex flex-col", style: { height: MODE_HEIGHTS[mode] }, children: [
23979
- (isFetching || isSyncing) && !isLoading && /* @__PURE__ */ jsx(
23980
- "div",
23981
- {
23982
- role: "progressbar",
23983
- "aria-label": "Loading",
23984
- className: "pointer-events-none absolute inset-x-0 top-0 z-30 h-0.5 overflow-hidden bg-primary/15",
23985
- children: /* @__PURE__ */ jsx(
23986
- motion.div,
23981
+ /* @__PURE__ */ jsxs(
23982
+ "div",
23983
+ {
23984
+ className: "relative border rounded-lg overflow-hidden flex flex-col",
23985
+ style: { height: DATA_TABLE_MODE_HEIGHTS[mode] },
23986
+ children: [
23987
+ (isFetching || isSyncing) && !isLoading && /* @__PURE__ */ jsx(
23988
+ "div",
23987
23989
  {
23988
- className: "h-full w-1/3 bg-primary",
23989
- initial: { x: "-100%" },
23990
- animate: { x: "300%" },
23991
- transition: { duration: 1.1, ease: "easeInOut", repeat: Number.POSITIVE_INFINITY }
23990
+ role: "progressbar",
23991
+ "aria-label": "Loading",
23992
+ className: "pointer-events-none absolute inset-x-0 top-0 z-30 h-0.5 overflow-hidden bg-primary/15",
23993
+ children: /* @__PURE__ */ jsx(
23994
+ motion.div,
23995
+ {
23996
+ className: "h-full w-1/3 bg-primary",
23997
+ initial: { x: "-100%" },
23998
+ animate: { x: "300%" },
23999
+ transition: { duration: 1.1, ease: "easeInOut", repeat: Number.POSITIVE_INFINITY }
24000
+ }
24001
+ )
23992
24002
  }
23993
- )
23994
- }
23995
- ),
23996
- isError && hasRows && !isLoading && /* @__PURE__ */ jsx(DataTableRefreshFailed, { refetch }),
23997
- /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: selectedCount > 0 ? /* @__PURE__ */ jsx(
23998
- motion.div,
23999
- {
24000
- className: "shrink-0 overflow-hidden",
24001
- initial: { height: 0, opacity: 0 },
24002
- animate: { height: "auto", opacity: 1 },
24003
- exit: { height: 0, opacity: 0 },
24004
- transition: { duration: 0.3, ease: [0.4, 0, 0.2, 1] },
24005
- children: /* @__PURE__ */ jsx(
24006
- DataTableSelectionBar,
24003
+ ),
24004
+ isError && hasRows && !isLoading && /* @__PURE__ */ jsx(DataTableRefreshFailed, { refetch }),
24005
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: selectedCount > 0 ? /* @__PURE__ */ jsx(
24006
+ motion.div,
24007
24007
  {
24008
- table,
24009
- importExport,
24010
- exportHidden: !exportGate.granted,
24011
- exportLockTip: exportGate.locked ? lockedTip(exportGate) : void 0,
24012
- children: selectActions?.(table.getFilteredSelectedRowModel().rows)
24013
- }
24014
- )
24015
- },
24016
- "selection"
24017
- ) : filters && filtersOpen ? /* @__PURE__ */ jsx(
24018
- motion.div,
24019
- {
24020
- className: "shrink-0 overflow-hidden",
24021
- initial: { height: 0, opacity: 0 },
24022
- animate: { height: "auto", opacity: 1 },
24023
- exit: { height: 0, opacity: 0 },
24024
- transition: { duration: 0.3, ease: [0.4, 0, 0.2, 1] },
24025
- children: /* @__PURE__ */ jsx(DataTableFilters, { filters, table })
24026
- },
24027
- "filters"
24028
- ) : null }),
24029
- /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col flex-1 min-h-0", children: [
24030
- /* @__PURE__ */ jsx("div", { ref: headerScrollRef, onScroll: syncBodyScroll, className: "shrink-0 overflow-hidden", children: /* @__PURE__ */ jsxs(
24031
- "table",
24032
- {
24033
- className: "w-full caption-bottom text-sm table-fixed",
24034
- style: { minWidth: table.getCenterTotalSize() },
24035
- children: [
24036
- columnWidths,
24037
- /* @__PURE__ */ jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup, rowIndex, headerGroups) => /* @__PURE__ */ jsx(
24038
- TableRow,
24008
+ className: "shrink-0 overflow-hidden",
24009
+ initial: { height: 0, opacity: 0 },
24010
+ animate: { height: "auto", opacity: 1 },
24011
+ exit: { height: 0, opacity: 0 },
24012
+ transition: { duration: 0.3, ease: [0.4, 0, 0.2, 1] },
24013
+ children: /* @__PURE__ */ jsx(
24014
+ DataTableSelectionBar,
24039
24015
  {
24040
- className: cn(rowIndex < headerGroups.length - 1 && "border-b-0!"),
24041
- children: headerGroup.headers.map((header) => {
24042
- const isActions = header.column.id === "actions";
24043
- const headerAlignClass = isActions ? "justify-end" : "justify-center";
24044
- const isGroup = header.subHeaders.length > 0 && !header.isPlaceholder;
24045
- const isGroupRow = rowIndex < headerGroups.length - 1;
24046
- const edges = groupEdges(header.column);
24047
- return /* @__PURE__ */ jsxs(
24048
- TableHead,
24049
- {
24050
- colSpan: header.colSpan,
24051
- style: isActions ? { width: "70px" } : grows(header.column) ? { minWidth: header.getSize() } : { width: header.getSize(), minWidth: header.getSize(), maxWidth: header.getSize() },
24052
- className: cn(
24053
- "relative group/resize",
24054
- // actions header stays pinned on horizontal scroll; z-20 keeps it above the
24055
- // regular header cells that scroll underneath it.
24056
- isActions ? "text-right sticky right-0 z-20" : "text-center",
24057
- // grouped, the two rows together take one ungrouped header row's height
24058
- isGroupRow && "h-5 px-0 align-bottom",
24059
- !isGroupRow && headerGroups.length > 1 && "h-7",
24060
- // a group and the column headers under it share one tint, edged where the group starts and ends
24061
- (isGroup || edges.inGroup) && "bg-primary/5",
24062
- isGroup && "border-x border-border",
24063
- edges.isFirst && "border-l border-border",
24064
- edges.isLast && "border-r border-border"
24065
- ),
24066
- "aria-sort": header.column.getCanSort() ? header.column.getIsSorted() === "asc" ? "ascending" : header.column.getIsSorted() === "desc" ? "descending" : "none" : void 0,
24067
- children: [
24068
- isActions && /* @__PURE__ */ jsx(
24069
- "div",
24070
- {
24071
- "aria-hidden": true,
24072
- className: "pointer-events-none absolute inset-x-0 top-0 bottom-px bg-muted backdrop-blur-sm"
24073
- }
24074
- ),
24075
- /* @__PURE__ */ jsx(
24076
- "div",
24077
- {
24078
- className: cn(
24079
- isActions ? "relative" : void 0,
24080
- // an ungrouped column's title rises by half the group row so it centres across both rows
24081
- !isGroupRow && headerGroups.length > 1 && !edges.inGroup && "-translate-y-2.5"
24016
+ table,
24017
+ importExport,
24018
+ exportHidden: !exportGate.granted,
24019
+ exportLockTip: exportGate.locked ? lockedTip(exportGate) : void 0,
24020
+ children: selectActions?.(table.getFilteredSelectedRowModel().rows)
24021
+ }
24022
+ )
24023
+ },
24024
+ "selection"
24025
+ ) : filters && filtersOpen ? /* @__PURE__ */ jsx(
24026
+ motion.div,
24027
+ {
24028
+ className: "shrink-0 overflow-hidden",
24029
+ initial: { height: 0, opacity: 0 },
24030
+ animate: { height: "auto", opacity: 1 },
24031
+ exit: { height: 0, opacity: 0 },
24032
+ transition: { duration: 0.3, ease: [0.4, 0, 0.2, 1] },
24033
+ children: /* @__PURE__ */ jsx(DataTableFilters, { filters, table })
24034
+ },
24035
+ "filters"
24036
+ ) : null }),
24037
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col flex-1 min-h-0", children: [
24038
+ /* @__PURE__ */ jsx("div", { ref: headerScrollRef, onScroll: syncBodyScroll, className: "shrink-0 overflow-hidden", children: /* @__PURE__ */ jsxs(
24039
+ "table",
24040
+ {
24041
+ className: "w-full caption-bottom text-sm table-fixed",
24042
+ style: { minWidth: table.getCenterTotalSize() },
24043
+ children: [
24044
+ columnWidths,
24045
+ /* @__PURE__ */ jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup, rowIndex, headerGroups) => /* @__PURE__ */ jsx(
24046
+ TableRow,
24047
+ {
24048
+ className: cn(rowIndex < headerGroups.length - 1 && "border-b-0!"),
24049
+ children: headerGroup.headers.map((header) => {
24050
+ const isActions = header.column.id === "actions";
24051
+ const headerAlignClass = isActions ? "justify-end" : "justify-center";
24052
+ const isGroup = header.subHeaders.length > 0 && !header.isPlaceholder;
24053
+ const isGroupRow = rowIndex < headerGroups.length - 1;
24054
+ const edges = groupEdges(header.column);
24055
+ return /* @__PURE__ */ jsxs(
24056
+ TableHead,
24057
+ {
24058
+ colSpan: header.colSpan,
24059
+ style: isActions ? { width: "70px" } : grows(header.column) ? { minWidth: header.getSize() } : { width: header.getSize(), minWidth: header.getSize(), maxWidth: header.getSize() },
24060
+ className: cn(
24061
+ "relative group/resize",
24062
+ // actions header stays pinned on horizontal scroll; z-20 keeps it above the
24063
+ // regular header cells that scroll underneath it.
24064
+ isActions ? "text-right sticky right-0 z-20" : "text-center",
24065
+ // grouped, the two rows together take one ungrouped header row's height
24066
+ isGroupRow && "h-5 px-0 align-bottom",
24067
+ !isGroupRow && headerGroups.length > 1 && "h-7",
24068
+ // a group and the column headers under it share one tint, edged where the group starts and ends
24069
+ (isGroup || edges.inGroup) && "bg-primary/5",
24070
+ isGroup && "border-x border-border",
24071
+ edges.isFirst && "border-l border-border",
24072
+ edges.isLast && "border-r border-border"
24073
+ ),
24074
+ "aria-sort": header.column.getCanSort() ? header.column.getIsSorted() === "asc" ? "ascending" : header.column.getIsSorted() === "desc" ? "descending" : "none" : void 0,
24075
+ children: [
24076
+ isActions && /* @__PURE__ */ jsx(
24077
+ "div",
24078
+ {
24079
+ "aria-hidden": true,
24080
+ className: "pointer-events-none absolute inset-x-0 top-0 bottom-px bg-muted backdrop-blur-sm"
24081
+ }
24082
24082
  ),
24083
- children: header.isPlaceholder ? null : isGroup ? /* @__PURE__ */ jsx(GroupBracket, { children: typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : flexRender(header.column.columnDef.header, header.getContext()) }) : typeof header.column.columnDef.header === "string" ? /* @__PURE__ */ jsx("div", { className: cn("flex min-w-0", headerAlignClass), children: /* @__PURE__ */ jsx(DataTableColumnHeader, { column: header.column, title: header.column.columnDef.header }) }) : flexRender(header.column.columnDef.header, header.getContext())
24084
- }
24085
- ),
24086
- !meta?.lockedColumnSizing && header.column.getCanResize() && /* @__PURE__ */ jsx(
24087
- "div",
24088
- {
24089
- onPointerDown: header.getResizeHandler(),
24090
- onTouchStart: header.getResizeHandler(),
24091
- className: cn(
24092
- "absolute top-0 right-0 w-1 h-full cursor-col-resize select-none touch-none z-10",
24093
- "opacity-0 group-hover/resize:opacity-100 hover:bg-primary/50",
24094
- header.column.getIsResizing() && "opacity-100 bg-primary"
24095
- )
24096
- }
24097
- )
24098
- ]
24099
- },
24100
- header.id
24101
- );
24102
- })
24103
- },
24104
- headerGroup.id
24105
- )) })
24106
- ]
24107
- }
24108
- ) }),
24109
- /* @__PURE__ */ jsxs(
24110
- "div",
24111
- {
24112
- ref: bodyScrollRef,
24113
- onScroll: syncHeaderScroll,
24114
- className: "relative flex flex-col flex-1 min-h-0 overflow-auto overscroll-auto",
24115
- children: [
24116
- !locked && (isLoading || hasRows) && /* @__PURE__ */ jsxs(
24117
- "table",
24118
- {
24119
- className: "w-full caption-bottom text-sm table-fixed",
24120
- style: { minWidth: table.getCenterTotalSize() },
24121
- children: [
24122
- columnWidths,
24123
- /* @__PURE__ */ jsx(TableBody, { className: cn("transition-opacity", isSyncing && !isLoading && "opacity-60"), children: isLoading ? Array.from(
24124
- { length: table.getState().pagination?.pageSize ?? 20 },
24125
- (_, i) => `skeleton-row-${i}`
24126
- ).map((rowKey) => /* @__PURE__ */ jsx(TableRow, { children: Array.from({ length: columnCount }, (_, i) => `${rowKey}-cell-${i}`).map((cellKey) => /* @__PURE__ */ jsx(TableCell, { className: densityClasses[density], children: /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-full" }) }, cellKey)) }, rowKey)) : table.getRowModel().rows.map((row, index) => {
24127
- const externallySelected = selectedRowId != null && row.id === selectedRowId;
24128
- const isSelected = row.getIsSelected() || externallySelected;
24129
- return /* @__PURE__ */ jsx(
24130
- TableRow,
24131
- {
24132
- "data-state": isSelected ? "selected" : void 0,
24133
- className: "group animate-in fade-in duration-300",
24134
- style: { animationDelay: `${Math.min(index, 12) * 25}ms`, animationFillMode: "both" },
24135
- children: row.getVisibleCells().map((cell) => {
24136
- const isActionsCell = cell.column.id === "actions";
24137
- const edges = groupEdges(cell.column);
24138
- return /* @__PURE__ */ jsxs(
24139
- TableCell,
24140
- {
24141
- className: cn(
24142
- densityClasses[density],
24143
- edges.isFirst && "border-l border-border/60",
24144
- edges.isLast && "border-r border-border/60",
24145
- isActionsCell ? "px-2 sticky right-0 z-10" : void 0,
24146
- onRowClick && !isActionsCell ? "cursor-pointer" : void 0
24147
- ),
24148
- onClick: onRowClick && !isActionsCell ? () => onRowClick(row.original) : void 0,
24149
- style: isActionsCell ? { width: "70px" } : grows(cell.column) ? { minWidth: cell.column.getSize() } : {
24150
- width: cell.column.getSize(),
24151
- minWidth: cell.column.getSize(),
24152
- maxWidth: cell.column.getSize()
24153
- },
24154
- children: [
24155
- isActionsCell && /* @__PURE__ */ jsx(
24156
- "div",
24157
- {
24158
- "aria-hidden": true,
24159
- className: "pointer-events-none absolute inset-x-0 top-0 bottom-px bg-background/40 backdrop-blur-sm group-hover:bg-muted/30 group-data-[state=selected]:bg-muted/40"
24160
- }
24083
+ /* @__PURE__ */ jsx(
24084
+ "div",
24085
+ {
24086
+ className: cn(
24087
+ isActions ? "relative" : void 0,
24088
+ // an ungrouped column's title rises by half the group row so it centres across both rows
24089
+ !isGroupRow && headerGroups.length > 1 && !edges.inGroup && "-translate-y-2.5"
24161
24090
  ),
24162
- /* @__PURE__ */ jsx(
24163
- "div",
24164
- {
24165
- className: cn(
24166
- isActionsCell ? "relative flex items-center justify-end" : "overflow-hidden text-center"
24167
- ),
24168
- children: flexRender(cell.column.columnDef.cell, cell.getContext())
24169
- }
24091
+ children: header.isPlaceholder ? null : isGroup ? /* @__PURE__ */ jsx(GroupBracket, { children: typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : flexRender(header.column.columnDef.header, header.getContext()) }) : typeof header.column.columnDef.header === "string" ? /* @__PURE__ */ jsx("div", { className: cn("flex min-w-0", headerAlignClass), children: /* @__PURE__ */ jsx(DataTableColumnHeader, { column: header.column, title: header.column.columnDef.header }) }) : flexRender(header.column.columnDef.header, header.getContext())
24092
+ }
24093
+ ),
24094
+ !meta?.lockedColumnSizing && header.column.getCanResize() && /* @__PURE__ */ jsx(
24095
+ "div",
24096
+ {
24097
+ onPointerDown: header.getResizeHandler(),
24098
+ onTouchStart: header.getResizeHandler(),
24099
+ className: cn(
24100
+ "absolute top-0 right-0 w-1 h-full cursor-col-resize select-none touch-none z-10",
24101
+ "opacity-0 group-hover/resize:opacity-100 hover:bg-primary/50",
24102
+ header.column.getIsResizing() && "opacity-100 bg-primary"
24170
24103
  )
24171
- ]
24172
- },
24173
- cell.id
24174
- );
24175
- })
24176
- },
24177
- row.id
24178
- );
24179
- }) })
24180
- ]
24181
- }
24182
- ),
24183
- (locked || !isLoading && !hasRows) && /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center justify-center", children: renderNoRows() })
24184
- ]
24185
- }
24186
- )
24187
- ] })
24188
- ] }),
24104
+ }
24105
+ )
24106
+ ]
24107
+ },
24108
+ header.id
24109
+ );
24110
+ })
24111
+ },
24112
+ headerGroup.id
24113
+ )) })
24114
+ ]
24115
+ }
24116
+ ) }),
24117
+ /* @__PURE__ */ jsxs(
24118
+ "div",
24119
+ {
24120
+ ref: bodyScrollRef,
24121
+ onScroll: syncHeaderScroll,
24122
+ className: "relative flex flex-col flex-1 min-h-0 overflow-auto overscroll-auto",
24123
+ children: [
24124
+ !locked && (isLoading || hasRows) && /* @__PURE__ */ jsxs(
24125
+ "table",
24126
+ {
24127
+ className: "w-full caption-bottom text-sm table-fixed",
24128
+ style: { minWidth: table.getCenterTotalSize() },
24129
+ children: [
24130
+ columnWidths,
24131
+ /* @__PURE__ */ jsx(TableBody, { className: cn("transition-opacity", isSyncing && !isLoading && "opacity-60"), children: isLoading ? Array.from(
24132
+ { length: table.getState().pagination?.pageSize ?? 20 },
24133
+ (_, i) => `skeleton-row-${i}`
24134
+ ).map((rowKey) => /* @__PURE__ */ jsx(TableRow, { children: Array.from({ length: columnCount }, (_, i) => `${rowKey}-cell-${i}`).map((cellKey) => /* @__PURE__ */ jsx(TableCell, { className: densityClasses[density], children: /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-full" }) }, cellKey)) }, rowKey)) : table.getRowModel().rows.map((row, index) => {
24135
+ const externallySelected = selectedRowId != null && row.id === selectedRowId;
24136
+ const isSelected = row.getIsSelected() || externallySelected;
24137
+ return /* @__PURE__ */ jsx(
24138
+ TableRow,
24139
+ {
24140
+ "data-state": isSelected ? "selected" : void 0,
24141
+ className: "group animate-in fade-in duration-300",
24142
+ style: { animationDelay: `${Math.min(index, 12) * 25}ms`, animationFillMode: "both" },
24143
+ children: row.getVisibleCells().map((cell) => {
24144
+ const isActionsCell = cell.column.id === "actions";
24145
+ const edges = groupEdges(cell.column);
24146
+ return /* @__PURE__ */ jsxs(
24147
+ TableCell,
24148
+ {
24149
+ className: cn(
24150
+ densityClasses[density],
24151
+ edges.isFirst && "border-l border-border/60",
24152
+ edges.isLast && "border-r border-border/60",
24153
+ isActionsCell ? "px-2 sticky right-0 z-10" : void 0,
24154
+ onRowClick && !isActionsCell ? "cursor-pointer" : void 0
24155
+ ),
24156
+ onClick: onRowClick && !isActionsCell ? () => onRowClick(row.original) : void 0,
24157
+ style: isActionsCell ? { width: "70px" } : grows(cell.column) ? { minWidth: cell.column.getSize() } : {
24158
+ width: cell.column.getSize(),
24159
+ minWidth: cell.column.getSize(),
24160
+ maxWidth: cell.column.getSize()
24161
+ },
24162
+ children: [
24163
+ isActionsCell && /* @__PURE__ */ jsx(
24164
+ "div",
24165
+ {
24166
+ "aria-hidden": true,
24167
+ className: "pointer-events-none absolute inset-x-0 top-0 bottom-px bg-background/40 backdrop-blur-sm group-hover:bg-muted/30 group-data-[state=selected]:bg-muted/40"
24168
+ }
24169
+ ),
24170
+ /* @__PURE__ */ jsx(
24171
+ "div",
24172
+ {
24173
+ className: cn(
24174
+ isActionsCell ? "relative flex items-center justify-end" : "overflow-hidden text-center"
24175
+ ),
24176
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
24177
+ }
24178
+ )
24179
+ ]
24180
+ },
24181
+ cell.id
24182
+ );
24183
+ })
24184
+ },
24185
+ row.id
24186
+ );
24187
+ }) })
24188
+ ]
24189
+ }
24190
+ ),
24191
+ (locked || !isLoading && !hasRows) && /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center justify-center", children: renderNoRows() })
24192
+ ]
24193
+ }
24194
+ )
24195
+ ] })
24196
+ ]
24197
+ }
24198
+ ),
24189
24199
  (mode !== "compact" || table.getRowCount() > (table.getState().pagination?.pageSize ?? 20)) && /* @__PURE__ */ jsx(DataTablePagination, { table }),
24190
24200
  importExport?.importEndpoint && showImport && /* @__PURE__ */ jsx(
24191
24201
  DataTableImportDialog,
@@ -24202,6 +24212,38 @@ function DataTable({
24202
24212
  }
24203
24213
  DataTable.displayName = "DataTable";
24204
24214
 
24215
+ const DataTableSkeleton = ({
24216
+ mode = "page",
24217
+ columns = 4,
24218
+ rows = 6,
24219
+ toolbarAction = true,
24220
+ className
24221
+ }) => /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
24222
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2", children: [
24223
+ /* @__PURE__ */ jsx(Skeleton, { className: "size-8" }),
24224
+ /* @__PURE__ */ jsx(Skeleton, { className: "size-8" }),
24225
+ /* @__PURE__ */ jsx(Skeleton, { className: "size-8" }),
24226
+ toolbarAction && /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-28" })
24227
+ ] }),
24228
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col overflow-hidden rounded-lg border", style: { height: DATA_TABLE_MODE_HEIGHTS[mode] }, children: [
24229
+ /* @__PURE__ */ jsx("div", { className: "flex gap-6 border-b bg-muted/40 px-4 py-3.5", children: Array.from({ length: columns }).map((_, columnIndex) => (
24230
+ // biome-ignore lint/suspicious/noArrayIndexKey: <static skeleton list>
24231
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 flex-1" }, `dt-skel-th-${columnIndex}`)
24232
+ )) }),
24233
+ Array.from({ length: rows }).map((_, rowIndex) => (
24234
+ // biome-ignore lint/suspicious/noArrayIndexKey: <static skeleton list>
24235
+ /* @__PURE__ */ jsx("div", { className: "flex gap-6 border-b px-4 py-4", children: Array.from({ length: columns }).map((_2, columnIndex) => (
24236
+ // biome-ignore lint/suspicious/noArrayIndexKey: <static skeleton list>
24237
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 flex-1" }, `dt-skel-td-${rowIndex}-${columnIndex}`)
24238
+ )) }, `dt-skel-tr-${rowIndex}`)
24239
+ ))
24240
+ ] }),
24241
+ mode !== "compact" && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-1", children: [
24242
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-40" }),
24243
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-64" })
24244
+ ] })
24245
+ ] });
24246
+
24205
24247
  function useTableSlice(slug) {
24206
24248
  const activeState = useDataTableStore((s) => s.tables[slug]?.activeState ?? EMPTY_TABLE_STATE);
24207
24249
  const activeViewId = useDataTableStore((s) => s.tables[slug]?.activeViewId ?? null);
@@ -24551,5 +24593,5 @@ function useDataTable({
24551
24593
  };
24552
24594
  }
24553
24595
 
24554
- export { CompactTableSkeleton as C, DataTable as D, NumberCell as N, RowActions as R, StringCell as S, CurrencyCell as a, DataTableColumnHeader as b, DataTableEmpty as c, DataTableFilters as d, DataTablePagination as e, DataTableRowDensity as f, DataTableSearch as g, DataTableSelectionBar as h, DataTableViewOptions as i, DateCell as j, DateTimeCell as k, getSelectionColumn as l, setTableContext as s, useDataTable as u };
24596
+ export { CompactTableSkeleton as C, DataTable as D, NumberCell as N, RowActions as R, StringCell as S, CurrencyCell as a, DataTableColumnHeader as b, DataTableEmpty as c, DataTableFilters as d, DataTablePagination as e, DataTableRowDensity as f, DataTableSearch as g, DataTableSelectionBar as h, DataTableSkeleton as i, DataTableViewOptions as j, DateCell as k, DateTimeCell as l, getSelectionColumn as m, setTableContext as s, useDataTable as u };
24555
24597
  //# sourceMappingURL=useDataTable.js.map