@dmsi/wedgekit-react 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/dist/classNames.js +150 -0
  2. package/dist/components/AccessCard.js +63 -0
  3. package/dist/components/AccessCardGroup.js +73 -0
  4. package/dist/components/AccessChangerTabItem.js +51 -0
  5. package/dist/components/Accordion.js +99 -0
  6. package/dist/components/Alert.js +78 -0
  7. package/dist/components/Breadcrumbs.js +111 -0
  8. package/dist/components/Button.js +137 -0
  9. package/dist/components/CalendarRange.js +405 -0
  10. package/dist/components/Caption.js +99 -0
  11. package/dist/components/Card.js +50 -0
  12. package/dist/components/Checkbox.js +108 -0
  13. package/dist/components/CompactImagesPreview.js +120 -0
  14. package/dist/components/ContentTab.js +68 -0
  15. package/dist/components/ContentTabs.js +96 -0
  16. package/dist/components/DMSiLogo.js +54 -0
  17. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +27 -0
  18. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +79 -0
  19. package/dist/components/DataGrid/PinnedColumns.js +165 -0
  20. package/dist/components/DataGrid/SummaryRow/SummaryCell.js +51 -0
  21. package/dist/components/DataGrid/SummaryRow/aggregations.js +55 -0
  22. package/dist/components/DataGrid/SummaryRow/index.js +86 -0
  23. package/dist/components/DataGrid/TableBody/GroupRow.js +243 -0
  24. package/dist/components/DataGrid/TableBody/LoadingCell.js +33 -0
  25. package/dist/components/DataGrid/TableBody/TableBodyRow.js +136 -0
  26. package/dist/components/DataGrid/TableBody/index.js +161 -0
  27. package/dist/components/DataGrid/index.js +696 -0
  28. package/dist/components/DataGrid/utils.js +20 -0
  29. package/dist/components/DataGridCell.js +412 -0
  30. package/dist/components/DataTable.js +700 -0
  31. package/dist/components/DateInput.js +193 -0
  32. package/dist/components/DateRangeInput.js +368 -0
  33. package/dist/components/DebugJson.js +28 -0
  34. package/dist/components/Display.js +46 -0
  35. package/dist/components/EditingContext.js +34 -0
  36. package/dist/components/EmblaCarousel/ArrowButtons.js +83 -0
  37. package/dist/components/EmblaCarousel/SelectedSnapDisplay.js +12 -0
  38. package/dist/components/EmblaCarousel/index.js +153 -0
  39. package/dist/components/EmblaCarousel/usePrevNextButtons.js +21 -0
  40. package/dist/components/EmblaCarousel/useSelectedSnapDisplay.js +15 -0
  41. package/dist/components/EmptyCartIcon.js +25 -0
  42. package/dist/components/FilterGroup.js +198 -0
  43. package/dist/components/FullViewportBox.js +19 -0
  44. package/dist/components/Grid.js +54 -0
  45. package/dist/components/Heading.js +50 -0
  46. package/dist/components/HorizontalDivider.js +20 -0
  47. package/dist/components/Icon.js +73 -0
  48. package/dist/components/ImagePlaceholder.js +22 -0
  49. package/dist/components/Input.js +469 -0
  50. package/dist/components/InputGroup.js +45 -0
  51. package/dist/components/Label.js +37 -0
  52. package/dist/components/Link.js +69 -0
  53. package/dist/components/List.js +12 -0
  54. package/dist/components/ListGroup.js +54 -0
  55. package/dist/components/LiveChatComponent.js +25 -0
  56. package/dist/components/LoadingScrim.js +22 -0
  57. package/dist/components/LogoAgilityTopBar.js +90 -0
  58. package/dist/components/LogoDMSiTopBar.js +54 -0
  59. package/dist/components/LogoMillworkTopBar.js +196 -0
  60. package/dist/components/MainBar.js +58 -0
  61. package/dist/components/MaxViewportBox.js +19 -0
  62. package/dist/components/Menu.js +202 -0
  63. package/dist/components/MenuOption.js +161 -0
  64. package/dist/components/MobileDataGrid/ColumnList.js +85 -0
  65. package/dist/components/MobileDataGrid/ColumnSelector/index.js +100 -0
  66. package/dist/components/MobileDataGrid/GridContextProvider/GridContext.d.ts.map +1 -1
  67. package/dist/components/MobileDataGrid/GridContextProvider/GridContext.js +6 -0
  68. package/dist/components/MobileDataGrid/GridContextProvider/index.js +80 -0
  69. package/dist/components/MobileDataGrid/GridContextProvider/useGridContext.js +11 -0
  70. package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +18 -0
  71. package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +130 -0
  72. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +67 -0
  73. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +42 -0
  74. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +58 -0
  75. package/dist/components/MobileDataGrid/dataGridReducer.js +28 -0
  76. package/dist/components/MobileDataGrid/index.js +78 -0
  77. package/dist/components/MobileNavMenu.js +173 -0
  78. package/dist/components/Modal.js +201 -0
  79. package/dist/components/ModalButtons.js +57 -0
  80. package/dist/components/ModalContent.js +24 -0
  81. package/dist/components/ModalHeader.js +74 -0
  82. package/dist/components/ModalScrim.js +32 -0
  83. package/dist/components/NavigationTab.js +72 -0
  84. package/dist/components/NavigationTabs.js +45 -0
  85. package/dist/components/NestedMenu.js +119 -0
  86. package/dist/components/Notification.js +91 -0
  87. package/dist/components/OptionPill.js +103 -0
  88. package/dist/components/OrderCheckIcon.js +28 -0
  89. package/dist/components/PDFViewer/DownloadIcon.js +25 -0
  90. package/dist/components/PDFViewer/PDFElement.js +77 -0
  91. package/dist/components/PDFViewer/PDFNavigation.js +64 -0
  92. package/dist/components/PDFViewer/PDFPage.js +28 -0
  93. package/dist/components/PDFViewer/index.js +124 -0
  94. package/dist/components/Pagination.js +117 -0
  95. package/dist/components/Paragraph.js +43 -0
  96. package/dist/components/Password.js +47 -0
  97. package/dist/components/ProductImagePreview/CarouselPagination.js +48 -0
  98. package/dist/components/ProductImagePreview/MobileImageCarousel.js +146 -0
  99. package/dist/components/ProductImagePreview/ProductPrimaryImage.js +138 -0
  100. package/dist/components/ProductImagePreview/Thumbnail.js +46 -0
  101. package/dist/components/ProductImagePreview/ZoomWindow.js +74 -0
  102. package/dist/components/ProductImagePreview/index.js +189 -0
  103. package/dist/components/ProductImagePreview/useProductImagePreview.js +85 -0
  104. package/dist/components/ProjectBar.js +54 -0
  105. package/dist/components/Radio.js +113 -0
  106. package/dist/components/Search.js +89 -0
  107. package/dist/components/SearchResultImage/index.js +26 -0
  108. package/dist/components/Select.js +122 -0
  109. package/dist/components/SideMenu.js +24 -0
  110. package/dist/components/SideMenuGroup.js +80 -0
  111. package/dist/components/SideMenuItem.js +79 -0
  112. package/dist/components/SimpleTable.js +60 -0
  113. package/dist/components/SkeletonParagraph.js +24 -0
  114. package/dist/components/Spinner.js +30 -0
  115. package/dist/components/Stack.js +174 -0
  116. package/dist/components/StatusPill.js +44 -0
  117. package/dist/components/Stepper.js +138 -0
  118. package/dist/components/Subheader.js +41 -0
  119. package/dist/components/Surface.js +30 -0
  120. package/dist/components/Swatch.js +1498 -0
  121. package/dist/components/Textarea.js +106 -0
  122. package/dist/components/Theme.js +25 -0
  123. package/dist/components/Time.js +225 -0
  124. package/dist/components/Toast.js +170 -0
  125. package/dist/components/Tooltip.js +102 -0
  126. package/dist/components/TopBar.js +119 -0
  127. package/dist/components/Upload.js +107 -0
  128. package/dist/components/WorldpayIframe.js +19 -0
  129. package/dist/hooks/useEditCell.js +23 -0
  130. package/dist/hooks/useInfiniteScroll.js +25 -0
  131. package/dist/hooks/useKeydown.js +20 -0
  132. package/dist/hooks/useMatchesMedia.js +15 -0
  133. package/dist/hooks/useMenuSystem.js +186 -0
  134. package/dist/hooks/useMounted.js +9 -0
  135. package/dist/hooks/useTableLayout/computeColumns.js +59 -0
  136. package/dist/hooks/useTableLayout/storage.js +64 -0
  137. package/dist/hooks/useTableLayout/useTableLayout.js +163 -0
  138. package/dist/index.js +249 -53839
  139. package/dist/lib/loadFonts.js +11 -0
  140. package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +56 -0
  141. package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +2299 -0
  142. package/dist/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js +13 -0
  143. package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +367 -0
  144. package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +235 -0
  145. package/dist/node_modules/@headlessui/react/dist/components/description/description.js +45 -0
  146. package/dist/node_modules/@headlessui/react/dist/components/keyboard.js +4 -0
  147. package/dist/node_modules/@headlessui/react/dist/components/label/label.js +62 -0
  148. package/dist/node_modules/@headlessui/react/dist/components/switch/switch.js +56 -0
  149. package/dist/node_modules/@headlessui/react/dist/hooks/use-active-press.js +33 -0
  150. package/dist/node_modules/@headlessui/react/dist/hooks/use-controllable.js +10 -0
  151. package/dist/node_modules/@headlessui/react/dist/hooks/use-default-value.js +8 -0
  152. package/dist/node_modules/@headlessui/react/dist/hooks/use-disposables.js +9 -0
  153. package/dist/node_modules/@headlessui/react/dist/hooks/use-event.js +9 -0
  154. package/dist/node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js +8 -0
  155. package/dist/node_modules/@headlessui/react/dist/hooks/use-latest-value.js +11 -0
  156. package/dist/node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js +12 -0
  157. package/dist/node_modules/@headlessui/react/dist/hooks/use-slot.js +7 -0
  158. package/dist/node_modules/@headlessui/react/dist/hooks/use-sync-refs.js +16 -0
  159. package/dist/node_modules/@headlessui/react/dist/internal/disabled.js +8 -0
  160. package/dist/node_modules/@headlessui/react/dist/internal/form-fields.js +35 -0
  161. package/dist/node_modules/@headlessui/react/dist/internal/hidden.js +13 -0
  162. package/dist/node_modules/@headlessui/react/dist/internal/id.js +8 -0
  163. package/dist/node_modules/@headlessui/react/dist/utils/bugs.js +19 -0
  164. package/dist/node_modules/@headlessui/react/dist/utils/class-names.js +6 -0
  165. package/dist/node_modules/@headlessui/react/dist/utils/disposables.js +40 -0
  166. package/dist/node_modules/@headlessui/react/dist/utils/dom.js +34 -0
  167. package/dist/node_modules/@headlessui/react/dist/utils/env.js +34 -0
  168. package/dist/node_modules/@headlessui/react/dist/utils/form.js +32 -0
  169. package/dist/node_modules/@headlessui/react/dist/utils/match.js +11 -0
  170. package/dist/node_modules/@headlessui/react/dist/utils/micro-task.js +8 -0
  171. package/dist/node_modules/@headlessui/react/dist/utils/owner.js +8 -0
  172. package/dist/node_modules/@headlessui/react/dist/utils/render.js +126 -0
  173. package/dist/node_modules/@js-temporal/polyfill/dist/index.esm.js +3913 -0
  174. package/dist/node_modules/@mikecousins/react-pdf/dist/index.js +83 -0
  175. package/dist/node_modules/@react-aria/focus/dist/useFocusRing.js +38 -0
  176. package/dist/node_modules/@react-aria/interactions/dist/useFocus.js +31 -0
  177. package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.js +99 -0
  178. package/dist/node_modules/@react-aria/interactions/dist/useFocusWithin.js +59 -0
  179. package/dist/node_modules/@react-aria/interactions/dist/useHover.js +86 -0
  180. package/dist/node_modules/@react-aria/interactions/dist/utils.js +68 -0
  181. package/dist/node_modules/@react-aria/utils/dist/DOMFunctions.js +32 -0
  182. package/dist/node_modules/@react-aria/utils/dist/domHelpers.js +15 -0
  183. package/dist/node_modules/@react-aria/utils/dist/focusWithoutScrolling.js +45 -0
  184. package/dist/node_modules/@react-aria/utils/dist/isVirtualEvent.js +7 -0
  185. package/dist/node_modules/@react-aria/utils/dist/openLink.js +28 -0
  186. package/dist/node_modules/@react-aria/utils/dist/platform.js +47 -0
  187. package/dist/node_modules/@react-aria/utils/dist/useGlobalListeners.js +34 -0
  188. package/dist/node_modules/@react-aria/utils/dist/useLayoutEffect.js +6 -0
  189. package/dist/node_modules/@react-stately/flags/dist/import.js +7 -0
  190. package/dist/node_modules/@tanstack/react-table/build/lib/index.js +94 -0
  191. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +38 -0
  192. package/dist/node_modules/@tanstack/table-core/build/lib/index.js +1954 -0
  193. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +575 -0
  194. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +52 -0
  195. package/dist/node_modules/clsx/dist/clsx.js +17 -0
  196. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +1204 -0
  197. package/dist/node_modules/embla-carousel-autoplay/esm/embla-carousel-autoplay.esm.js +126 -0
  198. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +24 -0
  199. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +35 -0
  200. package/dist/node_modules/jsbi/dist/jsbi.js +1040 -0
  201. package/dist/node_modules/react-use/esm/usePrevious.js +10 -0
  202. package/dist/static/no-results-image.png.js +4 -0
  203. package/dist/utils/date-patch-dashes.js +28 -0
  204. package/dist/utils/date.js +95 -0
  205. package/dist/utils/formatting.js +22 -0
  206. package/dist/utils/index.js +4 -0
  207. package/dist/utils/mergeObjectArrays.js +18 -0
  208. package/dist/utils.js +20 -0
  209. package/package.json +1 -1
  210. /package/dist/{pdf-l6QfMa5e.js → node_modules/pdfjs-dist/build/pdf.js} +0 -0
@@ -0,0 +1,165 @@
1
+ import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
+ import { flexRender as D } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
3
+ import { Checkbox as N } from "../Checkbox.js";
4
+ import { DataCellHeader as T, DataGridCell as j } from "../DataGridCell.js";
5
+ import { Subheader as p } from "../Subheader.js";
6
+ import { Tooltip as P } from "../Tooltip.js";
7
+ import { clsx as h } from "../../node_modules/clsx/dist/clsx.js";
8
+ import { getSortIcon as w } from "./utils.js";
9
+ import V from "react";
10
+ import { TableBody as A } from "./TableBody/index.js";
11
+ import { ColumnSelectorHeaderCell as O } from "./ColumnSelectorHeaderCell/index.js";
12
+ import { SummaryRow as G } from "./SummaryRow/index.js";
13
+ function Y({
14
+ id: m,
15
+ pinDirection: r = "left",
16
+ table: e,
17
+ centerHeader: x,
18
+ allSelectedAcrossPages: v,
19
+ someSelectedAcrossPages: y,
20
+ toggleSelectAllAcrossPages: S,
21
+ testid: i,
22
+ enableColumnSelector: c,
23
+ toggleColumnVisibility: C,
24
+ resetColumnVisibility: R,
25
+ summaryRow: a,
26
+ filteredRows: k,
27
+ allRows: H,
28
+ totalRowCount: I,
29
+ allowUserGrouping: z,
30
+ ...s
31
+ }) {
32
+ const g = r === "left" ? e.getLeftHeaderGroups() : e.getRightHeaderGroups(), n = i ? `${r}-pinned-${i}` : void 0;
33
+ if (!(!(g[0]?.headers.length > 0) && !c))
34
+ return /* @__PURE__ */ d(
35
+ "table",
36
+ {
37
+ className: h(
38
+ "flex flex-col min-h-min sticky z-20",
39
+ r === "left" ? "left-0" : "right-0"
40
+ ),
41
+ "data-testid": n,
42
+ children: [
43
+ /* @__PURE__ */ t("thead", { className: "sticky top-0 z-20 grid", children: g.map((u) => /* @__PURE__ */ d(
44
+ "tr",
45
+ {
46
+ "data-testid": n ? `${n}-header-row-${u.id}` : void 0,
47
+ className: "flex w-full",
48
+ children: [
49
+ u.headers.map((o) => {
50
+ if (!o)
51
+ return;
52
+ const $ = e.getRowModel().rows[0]?.getValue(o.column.id), f = o.column.columnDef.meta?.align ?? (typeof $ == "number" ? "right" : "left");
53
+ if (typeof o.column.columnDef.header == "string") {
54
+ const b = o.column.columnDef.meta?.headerWidth;
55
+ return /* @__PURE__ */ d(
56
+ T,
57
+ {
58
+ locked: !0,
59
+ testid: n ? `${n}-header-${o.id}` : void 0,
60
+ header: o,
61
+ center: x,
62
+ allowUserGrouping: z,
63
+ width: b ?? `${o.column.getSize()}px`,
64
+ className: h(
65
+ o.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
66
+ "group",
67
+ {
68
+ "justify-start": f === "left",
69
+ "justify-end": f === "right"
70
+ }
71
+ ),
72
+ children: [
73
+ /* @__PURE__ */ t(
74
+ P,
75
+ {
76
+ showOnTruncation: !0,
77
+ message: o.column.columnDef.header,
78
+ position: "bottom",
79
+ children: /* @__PURE__ */ t(p, { as: "p", addOverflow: !0, tall: !0, children: o.column.columnDef.header })
80
+ }
81
+ ),
82
+ w(o.column.getIsSorted()),
83
+ !o.column.getIsSorted() && o.column.getCanSort() && !e.getState().columnSizingInfo.isResizingColumn && w(o.column.getNextSortingOrder(), !0),
84
+ o.column.getSortIndex() !== -1 && e.getState().sorting.length > 1 && /* @__PURE__ */ t(p, { tall: !0, children: o.column.getSortIndex() + 1 }),
85
+ !o.column.columnDef.meta?.locked && /* @__PURE__ */ t(
86
+ "div",
87
+ {
88
+ onDoubleClick: (l) => {
89
+ l.stopPropagation(), o.column.resetSize();
90
+ },
91
+ onMouseDown: (l) => {
92
+ l.stopPropagation(), o.getResizeHandler()(l);
93
+ },
94
+ onTouchStart: (l) => {
95
+ l.stopPropagation(), o.getResizeHandler()(l);
96
+ },
97
+ className: "absolute right-0 inset-y-0 w-4 cursor-col-resize",
98
+ children: /* @__PURE__ */ t("div", { className: "absolute right-0 inset-y-0 w-px bg-black pointer-events-none" })
99
+ }
100
+ )
101
+ ]
102
+ },
103
+ o.id
104
+ );
105
+ }
106
+ return /* @__PURE__ */ t(V.Fragment, { children: o.column.columnDef.meta?.checkbox ? /* @__PURE__ */ t(j, { type: "header", component: "checkbox", locked: !0, children: /* @__PURE__ */ t(
107
+ N,
108
+ {
109
+ checked: v,
110
+ indeterminate: y,
111
+ onChange: S
112
+ }
113
+ ) }) : D(
114
+ o.column.columnDef.header,
115
+ o.getContext()
116
+ ) }, o.id);
117
+ }),
118
+ c && /* @__PURE__ */ t(
119
+ O,
120
+ {
121
+ id: m ? `${m}-column-selector` : void 0,
122
+ testid: i ? `${i}-column-selector` : void 0,
123
+ table: e,
124
+ toggleColumnVisibility: C ?? (() => {
125
+ }),
126
+ resetColumnVisibility: R ?? (() => {
127
+ })
128
+ }
129
+ )
130
+ ]
131
+ },
132
+ u.id
133
+ )) }),
134
+ /* @__PURE__ */ t(
135
+ A,
136
+ {
137
+ testid: n,
138
+ ...s,
139
+ table: e,
140
+ locked: !c || r === "right",
141
+ pinDirection: r,
142
+ hoveredRowId: s.hoveredRowId,
143
+ setHoveredRowId: s.setHoveredRowId
144
+ }
145
+ ),
146
+ a && /* @__PURE__ */ t(
147
+ G,
148
+ {
149
+ id: m,
150
+ testid: n,
151
+ table: e,
152
+ summaryConfig: a,
153
+ filteredRows: k ?? [],
154
+ allRows: H ?? [],
155
+ totalRowCount: I ?? 0,
156
+ locked: r
157
+ }
158
+ )
159
+ ]
160
+ }
161
+ );
162
+ }
163
+ export {
164
+ Y as PinnedColumns
165
+ };
@@ -0,0 +1,51 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { clsx as g } from "../../../node_modules/clsx/dist/clsx.js";
3
+ import { typography as h } from "../../../classNames.js";
4
+ import { DataGridCell as y } from "../../DataGridCell.js";
5
+ import { Label as f } from "../../Label.js";
6
+ import { Tooltip as v } from "../../Tooltip.js";
7
+ import { parseTemplate as b } from "./aggregations.js";
8
+ function G({
9
+ id: s,
10
+ testid: p,
11
+ cellDef: r,
12
+ columnId: n,
13
+ filteredRows: a,
14
+ allRows: d,
15
+ totalRowCount: l,
16
+ colSpan: e,
17
+ width: u,
18
+ getColumn: c
19
+ }) {
20
+ const o = r?.align ?? "left", m = r?.render ? r.render({ filteredRows: a, allRows: d, columnId: n }) : void 0, i = !r?.render && r?.template ? b(r.template, {
21
+ filteredRows: a,
22
+ totalRowCount: l,
23
+ columnId: n,
24
+ getColumn: c
25
+ }) : void 0;
26
+ return /* @__PURE__ */ t(
27
+ y,
28
+ {
29
+ id: s,
30
+ testid: p,
31
+ type: "summary",
32
+ width: u,
33
+ colSpan: e && e > 1 ? e : void 0,
34
+ className: g("bg-background-grouped-primary-normal", {
35
+ "justify-start": o === "left",
36
+ "justify-end": o === "right",
37
+ "justify-center": o === "center"
38
+ }),
39
+ children: i !== void 0 ? /* @__PURE__ */ t(v, { showOnTruncation: !0, message: i, position: "bottom", children: /* @__PURE__ */ t(f, { className: "!leading-6 whitespace-nowrap overflow-hidden text-ellipsis", children: i }) }) : m !== void 0 ? (
40
+ // A custom render result is an arbitrary ReactNode the consumer fully
41
+ // controls, so no truncation/tooltip wrapper is applied — but it still
42
+ // gets the same base typography as every other summary cell so a
43
+ // consumer's un-styled text matches the rest of the row by default.
44
+ /* @__PURE__ */ t("span", { className: h.label, children: m })
45
+ ) : null
46
+ }
47
+ );
48
+ }
49
+ export {
50
+ G as SummaryCell
51
+ };
@@ -0,0 +1,55 @@
1
+ import { formatCurrencyDisplay as s } from "../../../utils/formatting.js";
2
+ function m(r) {
3
+ if (typeof r == "number")
4
+ return Number.isFinite(r) ? r : void 0;
5
+ if (typeof r == "string") {
6
+ const t = r.trim().replace(/,/g, "");
7
+ if (t === "") return 0;
8
+ const n = Number(t);
9
+ return Number.isFinite(n) ? n : void 0;
10
+ }
11
+ if (r == null) return 0;
12
+ }
13
+ function f(r, t) {
14
+ let n = 0;
15
+ for (const o of r) {
16
+ const e = m(t(o));
17
+ if (e === void 0) return;
18
+ n += e;
19
+ }
20
+ return Math.round(n * 100) / 100;
21
+ }
22
+ function a(r) {
23
+ return r.length;
24
+ }
25
+ const d = /\{(count|total|sum)(?:,([^}]+))?\}/g;
26
+ function p(r, t) {
27
+ return r.replace(
28
+ d,
29
+ (n, o, e) => {
30
+ switch (o) {
31
+ case "count":
32
+ return String(a(t.filteredRows));
33
+ case "total":
34
+ return String(t.totalRowCount);
35
+ case "sum": {
36
+ const c = e ?? t.columnId, u = t.getColumn(c);
37
+ if (!u) return "";
38
+ const i = f(t.filteredRows, u.accessor);
39
+ return i === void 0 ? "" : u.format === "currency" ? s(String(i)) : String(i);
40
+ }
41
+ default:
42
+ return "";
43
+ }
44
+ }
45
+ );
46
+ }
47
+ function g(r, t) {
48
+ return r === t ? `${r} Records` : `${r} of ${t} Records`;
49
+ }
50
+ export {
51
+ g as buildDefaultSummaryTemplate,
52
+ a as computeCount,
53
+ f as computeSum,
54
+ p as parseTemplate
55
+ };
@@ -0,0 +1,86 @@
1
+ import { jsx as C } from "react/jsx-runtime";
2
+ import { clsx as v } from "../../../node_modules/clsx/dist/clsx.js";
3
+ import { SummaryCell as x } from "./SummaryCell.js";
4
+ import { buildDefaultSummaryTemplate as D } from "./aggregations.js";
5
+ function b(m, o, n) {
6
+ return `${m.slice(o, o + n).reduce((u, a) => u + a.getSize(), 0)}px`;
7
+ }
8
+ function N({
9
+ id: m,
10
+ testid: o,
11
+ table: n,
12
+ summaryConfig: s,
13
+ filteredRows: c,
14
+ allRows: u,
15
+ totalRowCount: a,
16
+ locked: l
17
+ }) {
18
+ const i = l === "left" ? n.getLeftLeafColumns() : l === "right" ? n.getRightLeafColumns() : n.getCenterLeafColumns();
19
+ if (i.length === 0) return null;
20
+ const $ = [
21
+ ...n.getLeftLeafColumns(),
22
+ ...n.getCenterLeafColumns(),
23
+ ...n.getRightLeafColumns()
24
+ ].find(
25
+ (e) => !e.columnDef.meta?.checkbox
26
+ )?.id, S = (e) => {
27
+ const r = n.getColumn(e);
28
+ if (r?.accessorFn)
29
+ return {
30
+ // AccessorFn's second (index) argument is essentially never used by
31
+ // consumer-defined accessors in practice; summary aggregation has no
32
+ // meaningful row index, so 0 is passed.
33
+ accessor: (d) => r.accessorFn(d, 0),
34
+ format: r.columnDef.meta?.format
35
+ };
36
+ };
37
+ let f = 0;
38
+ return /* @__PURE__ */ C(
39
+ "tfoot",
40
+ {
41
+ className: v("sticky bottom-0 grid", l ? "z-20" : "z-10"),
42
+ "data-testid": o ? `${o}-summary-footer` : void 0,
43
+ children: /* @__PURE__ */ C(
44
+ "tr",
45
+ {
46
+ id: m,
47
+ className: "flex w-full border-t border-border-primary-normal bg-background-grouped-primary-normal",
48
+ "data-testid": o ? `${o}-summary-row` : void 0,
49
+ children: i.map((e, r) => {
50
+ if (f > 0)
51
+ return f -= 1, null;
52
+ const d = e.columnDef.meta?.checkbox, y = e.id === $, h = d ? void 0 : s === !0 ? y ? {
53
+ template: D(
54
+ c.length,
55
+ a
56
+ )
57
+ } : void 0 : s.cells[e.id], p = i.length - r, g = h?.colSpan ?? 1, t = Math.min(g, p);
58
+ g > p && console.warn(
59
+ `DataGrid summaryRow: colSpan of ${g} on column "${e.id}" exceeds the ${p} column(s) remaining in the ${l || "center"} section. Clamping to ${t}.`
60
+ ), t > 1 && (f = t - 1);
61
+ const L = t > 1 ? b(i, r, t) : `${e.getSize()}px`;
62
+ return /* @__PURE__ */ C(
63
+ x,
64
+ {
65
+ id: m ? `${m}-summary-cell-${e.id}` : void 0,
66
+ testid: o ? `${o}-summary-cell-${e.id}` : void 0,
67
+ cellDef: h,
68
+ columnId: e.id,
69
+ filteredRows: c,
70
+ allRows: u,
71
+ totalRowCount: a,
72
+ colSpan: t > 1 ? t : void 0,
73
+ width: L,
74
+ getColumn: S
75
+ },
76
+ e.id
77
+ );
78
+ })
79
+ }
80
+ )
81
+ }
82
+ );
83
+ }
84
+ export {
85
+ N as SummaryRow
86
+ };
@@ -0,0 +1,243 @@
1
+ import { jsx as o, jsxs as k, Fragment as L } from "react/jsx-runtime";
2
+ import { clsx as f } from "../../../node_modules/clsx/dist/clsx.js";
3
+ import { typography as M } from "../../../classNames.js";
4
+ import { formatCurrencyDisplay as Q } from "../../../utils/formatting.js";
5
+ import { Checkbox as U } from "../../Checkbox.js";
6
+ import { DataGridCell as m, DragAlongCell as X } from "../../DataGridCell.js";
7
+ import { Icon as Z } from "../../Icon.js";
8
+ import { computeCount as ee, computeSum as ne } from "../SummaryRow/aggregations.js";
9
+ import { handleRowArrowKeyDown as te } from "../utils.js";
10
+ const le = 40;
11
+ function oe(t) {
12
+ return t === 0 ? "bg-brand-500" : t === 1 ? "bg-brand-300" : "bg-brand-200";
13
+ }
14
+ function G(t) {
15
+ return t >= 2 ? "text-neutral-500" : "text-neutral-000";
16
+ }
17
+ function ie(t) {
18
+ return f(
19
+ M.label,
20
+ "!leading-6 whitespace-nowrap overflow-hidden text-ellipsis",
21
+ G(t)
22
+ );
23
+ }
24
+ function fe({
25
+ id: t,
26
+ testid: r,
27
+ row: e,
28
+ virtualRow: V,
29
+ showFilterRow: j,
30
+ locked: a,
31
+ groupRowMode: A = "spanning",
32
+ groupSelectionMode: R = "row",
33
+ columnVirtualizer: H,
34
+ virtualPaddingLeft: D,
35
+ virtualPaddingRight: I
36
+ }) {
37
+ const x = e.getIsExpanded(), u = e.depth, E = R === "group" || R === "both", d = oe(u), C = ie(u), F = () => {
38
+ e.toggleExpanded();
39
+ }, P = (n) => {
40
+ if (n.key === "Enter" || n.key === " ") {
41
+ n.preventDefault(), e.toggleExpanded();
42
+ return;
43
+ }
44
+ te(n);
45
+ }, T = (n) => {
46
+ const l = n.columnDef.meta;
47
+ if (l?.groupCell)
48
+ return l.groupCell({
49
+ rows: e.getLeafRows().map((i) => i.original),
50
+ groupValue: e.groupingValue,
51
+ depth: u,
52
+ isExpanded: x
53
+ });
54
+ if (!l?.aggregationFn) return;
55
+ if (l.aggregationFn === "count")
56
+ return String(ee(e.getLeafRows()));
57
+ if (!n.accessorFn) return;
58
+ const c = ne(
59
+ e.getLeafRows(),
60
+ (i) => n.accessorFn(i.original, 0)
61
+ );
62
+ if (c !== void 0)
63
+ return l.format === "currency" ? Q(String(c)) : String(c);
64
+ }, _ = () => {
65
+ const n = e.getIsAllSubRowsSelected(), l = e.getIsSomeSelected();
66
+ return /* @__PURE__ */ o("div", { className: "contents", onClick: (c) => c.stopPropagation(), children: /* @__PURE__ */ o(
67
+ U,
68
+ {
69
+ id: t ? `${t}-group-checkbox-${e.id}` : void 0,
70
+ testid: r ? `${r}-group-checkbox-${e.id}` : void 0,
71
+ checked: n,
72
+ indeterminate: l,
73
+ onChange: () => {
74
+ const c = !n;
75
+ e.getLeafRows().forEach((i) => i.toggleSelected(c));
76
+ }
77
+ }
78
+ ) });
79
+ }, B = (n) => /* @__PURE__ */ o(
80
+ m,
81
+ {
82
+ id: t ? `${t}-group-checkbox-cell-${e.id}` : void 0,
83
+ testid: r ? `${r}-group-checkbox-cell-${e.id}` : void 0,
84
+ component: "checkbox",
85
+ width: `${n.column.getSize()}px`,
86
+ className: d,
87
+ children: _()
88
+ },
89
+ n.id
90
+ ), $ = (n) => {
91
+ if (!E) return { checkboxCell: null, remainingCells: n };
92
+ const l = n.findIndex((c) => c.column.columnDef.meta?.checkbox);
93
+ return l === -1 ? { checkboxCell: null, remainingCells: n } : {
94
+ checkboxCell: B(n[l]),
95
+ remainingCells: n.filter((c, i) => i !== l)
96
+ };
97
+ }, K = (n) => {
98
+ const l = T(n.column);
99
+ return l === void 0 ? null : /* @__PURE__ */ o("span", { className: C, children: l });
100
+ }, W = (n) => {
101
+ const l = n.column.columnDef.meta?.align ?? "left";
102
+ return f(d, {
103
+ "justify-start": l === "left",
104
+ "justify-end": l === "right",
105
+ "justify-center": l === "center"
106
+ });
107
+ }, b = /* @__PURE__ */ o(
108
+ m,
109
+ {
110
+ id: t ? `${t}-group-chevron-${e.id}` : void 0,
111
+ testid: r ? `${r}-group-chevron-${e.id}` : void 0,
112
+ noPadding: !0,
113
+ width: `${le + u * 16}px`,
114
+ style: { paddingLeft: u * 16 },
115
+ className: f(d, "justify-center"),
116
+ children: /* @__PURE__ */ o("span", { className: f(G(u), "contents"), children: /* @__PURE__ */ o(Z, { name: x ? "expand_more" : "chevron_right", size: 24 }) })
117
+ }
118
+ ), O = (() => {
119
+ if (A === "columns") {
120
+ const i = a === "left" ? e.getLeftVisibleCells() : a === "right" ? e.getRightVisibleCells() : e.getCenterVisibleCells(), g = H?.getVirtualItems() ?? [], p = a ? m : X, { checkboxCell: h, remainingCells: v } = $(i), y = E ? i.find((s) => s.column.columnDef.meta?.checkbox)?.column.id : void 0, Y = e.getLeftVisibleCells().length > 0, q = a === "left" || a === !1 && !Y, S = e.getAllCells().find((s) => s.column.id === e.groupingColumnId), w = !!S?.column.columnDef.meta?.groupCell, J = a === !1 && !w ? /* @__PURE__ */ o(
121
+ m,
122
+ {
123
+ id: t ? `${t}-group-value-${e.id}` : void 0,
124
+ testid: r ? `${r}-group-value-${e.id}` : void 0,
125
+ width: S ? `${S.column.getSize()}px` : void 0,
126
+ className: d,
127
+ children: /* @__PURE__ */ o("span", { className: C, style: { paddingLeft: u * 16 }, children: String(e.groupingValue) })
128
+ }
129
+ ) : null, z = (s) => /* @__PURE__ */ o(
130
+ p,
131
+ {
132
+ cell: s,
133
+ id: t ? `${t}-group-cell-${e.id}-${s.column.id}` : void 0,
134
+ testid: r ? `${r}-group-cell-${e.id}-${s.column.id}` : void 0,
135
+ width: `${s.column.getSize()}px`,
136
+ className: W(s),
137
+ children: K(s)
138
+ },
139
+ s.id
140
+ );
141
+ return /* @__PURE__ */ k(L, { children: [
142
+ h,
143
+ q ? b : null,
144
+ J,
145
+ !a && D ? /* @__PURE__ */ o("td", { style: { display: "flex", width: D } }) : null,
146
+ a ? v.map(z) : g.map((s) => {
147
+ const N = i[s.index];
148
+ return !N || N.column.id === y ? null : z(N);
149
+ }),
150
+ !a && I ? /* @__PURE__ */ o("td", { style: { display: "flex", width: I } }) : null
151
+ ] });
152
+ }
153
+ if (a === "left") {
154
+ const i = e.getLeftVisibleCells(), { checkboxCell: g, remainingCells: p } = $(i);
155
+ return /* @__PURE__ */ k(L, { children: [
156
+ g,
157
+ b,
158
+ p.slice(1).map((h) => /* @__PURE__ */ o(
159
+ m,
160
+ {
161
+ noPadding: !0,
162
+ width: `${h.column.getSize()}px`,
163
+ className: d
164
+ },
165
+ h.id
166
+ ))
167
+ ] });
168
+ }
169
+ if (a === "right")
170
+ return e.getRightVisibleCells().map((g) => /* @__PURE__ */ o(
171
+ m,
172
+ {
173
+ noPadding: !0,
174
+ width: `${g.column.getSize()}px`,
175
+ className: d
176
+ },
177
+ g.id
178
+ ));
179
+ const n = e.getCenterVisibleCells();
180
+ if (!(e.getLeftVisibleCells().length > 0) && n.length > 0) {
181
+ const { checkboxCell: i, remainingCells: g } = $(n), [, ...p] = g, h = p.reduce(
182
+ (v, y) => v + y.column.getSize(),
183
+ 0
184
+ );
185
+ return /* @__PURE__ */ k(L, { children: [
186
+ i,
187
+ b,
188
+ /* @__PURE__ */ o(
189
+ m,
190
+ {
191
+ id: t ? `${t}-group-value-${e.id}` : void 0,
192
+ testid: r ? `${r}-group-value-${e.id}` : void 0,
193
+ colSpan: p.length,
194
+ width: `${h}px`,
195
+ className: d,
196
+ children: /* @__PURE__ */ o("span", { className: C, style: { paddingLeft: u * 16 }, children: String(e.groupingValue) })
197
+ }
198
+ )
199
+ ] });
200
+ }
201
+ const c = n.reduce(
202
+ (i, g) => i + g.column.getSize(),
203
+ 0
204
+ );
205
+ return /* @__PURE__ */ o(
206
+ m,
207
+ {
208
+ id: t ? `${t}-group-value-${e.id}` : void 0,
209
+ testid: r ? `${r}-group-value-${e.id}` : void 0,
210
+ colSpan: n.length,
211
+ width: `${c}px`,
212
+ className: d,
213
+ children: /* @__PURE__ */ o("span", { className: C, style: { paddingLeft: u * 16 }, children: String(e.groupingValue) })
214
+ }
215
+ );
216
+ })();
217
+ return /* @__PURE__ */ o(
218
+ "tr",
219
+ {
220
+ id: t ? `${t}-group-row-${e.id}` : void 0,
221
+ "data-testid": r ? `${r}-group-row-${e.id}` : void 0,
222
+ "data-group-row": "true",
223
+ "data-depth": u,
224
+ role: "row",
225
+ "aria-expanded": x,
226
+ "aria-level": u + 1,
227
+ tabIndex: 0,
228
+ onClick: F,
229
+ onKeyDown: P,
230
+ className: f("flex cursor-pointer min-h-10", d),
231
+ style: {
232
+ display: "flex",
233
+ position: "absolute",
234
+ transform: `translateY(${j ? V.start + 40 : V.start}px)`,
235
+ width: "100%"
236
+ },
237
+ children: O
238
+ }
239
+ );
240
+ }
241
+ export {
242
+ fe as GroupRow
243
+ };
@@ -0,0 +1,33 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { Checkbox as $ } from "../../Checkbox.js";
3
+ import { DataGridCell as l } from "../../DataGridCell.js";
4
+ import { Input as d } from "../../Input.js";
5
+ function p({
6
+ id: r,
7
+ testid: e,
8
+ column: n
9
+ }) {
10
+ const o = `loading-${n.id}`;
11
+ return n.cell === "checkbox" ? /* @__PURE__ */ i(l, { id: r ? `${r}-${o}` : void 0, testid: e ? `${e}-${o}` : void 0, children: /* @__PURE__ */ i($, { id: r ? `${r}-${o}-checkbox` : void 0, testid: e ? `${e}-${o}-checkbox` : void 0, disabled: !0 }) }, o) : n.cell === "input" ? /* @__PURE__ */ i(
12
+ l,
13
+ {
14
+ id: r ? `${r}-${o}` : void 0,
15
+ testid: e ? `${e}-${o}` : void 0,
16
+ component: "input",
17
+ children: /* @__PURE__ */ i(
18
+ d,
19
+ {
20
+ id: r ? `${r}-${o}-input` : void 0,
21
+ testid: e ? `${e}-${o}-input` : void 0,
22
+ align: "left",
23
+ disabled: !0,
24
+ wrapperClassName: "!rounded-none !border-0"
25
+ }
26
+ )
27
+ },
28
+ o
29
+ ) : /* @__PURE__ */ i(l, { id: r ? `${r}-${o}` : void 0, testid: e ? `${e}-${o}` : void 0, children: /* @__PURE__ */ i("div", { className: "bg-linear-270 to-neutral-300/[24%] from-neutral-300/[12%] rounded-xs w-full max-w-25 h-6" }) }, o);
30
+ }
31
+ export {
32
+ p as LoadingCell
33
+ };