@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,202 @@
1
+ "use client";
2
+ import { jsxs as U } from "react/jsx-runtime";
3
+ import { clsx as $ } from "../node_modules/clsx/dist/clsx.js";
4
+ import { useRef as A, useState as j, useEffect as y } from "react";
5
+ import { createPortal as V } from "react-dom";
6
+ import { useMenuPosition as G } from "../hooks/useMenuSystem.js";
7
+ import { findDocumentRoot as J } from "../utils.js";
8
+ import { useMatchesMobile as X } from "../hooks/useMatchesMedia.js";
9
+ function ce({
10
+ id: L,
11
+ testid: M,
12
+ children: P,
13
+ className: C,
14
+ ref: f,
15
+ positionTo: o,
16
+ mobilePositionTo: g,
17
+ show: u,
18
+ setShow: m,
19
+ position: H = "bottom",
20
+ maxHeight: x,
21
+ topOffset: K,
22
+ mobileBackMenuOption: q,
23
+ mobileHide: S,
24
+ useDefaultMinWidth: W,
25
+ autoFocusOff: E,
26
+ menuName: B,
27
+ calculateMinMaxHeight: d,
28
+ typeAheadQuery: k,
29
+ ...w
30
+ }) {
31
+ const c = A(null), i = A(""), l = A(null), p = f || c, [F, b] = j("180px"), D = X(), { menuPosition: I, updatePosition: R } = G(
32
+ D && g ? g : o,
33
+ H,
34
+ {
35
+ isOpen: u,
36
+ setIsOpen: m,
37
+ menuRef: c,
38
+ topOffset: K,
39
+ isMobile: !!(D && g)
40
+ }
41
+ );
42
+ return y(() => {
43
+ if (d)
44
+ return;
45
+ const e = requestAnimationFrame(() => {
46
+ if (!p.current || x)
47
+ return;
48
+ const t = Array.from(p.current.children).filter(
49
+ (s) => s.getAttribute("role") === "menuitem"
50
+ );
51
+ if (t.length === 0)
52
+ return;
53
+ if (t.length <= 4) {
54
+ b("none");
55
+ return;
56
+ }
57
+ let n = 0;
58
+ t.forEach((s, a) => {
59
+ a >= 5 || (n += s.clientHeight);
60
+ }), n = n / 5 * 4.5, b(`${n}px`);
61
+ });
62
+ return () => {
63
+ cancelAnimationFrame(e);
64
+ };
65
+ }, [u, x, d]), y(() => {
66
+ if (d && o?.current && p.current) {
67
+ const e = o.current.getBoundingClientRect(), n = window.innerHeight - e.bottom - 16;
68
+ b(`${n}px`);
69
+ }
70
+ }, [p.current, o?.current, d]), y(() => {
71
+ if (!u) {
72
+ i.current = "", l.current && clearTimeout(l.current);
73
+ return;
74
+ }
75
+ i.current = k ?? "", T(), R();
76
+ }, [u, R]), y(() => {
77
+ if (!u || !m)
78
+ return;
79
+ const e = (t) => {
80
+ t.key === "Escape" && (m(!1), o?.current?.focus());
81
+ };
82
+ return document.addEventListener("keydown", e), () => {
83
+ document.removeEventListener("keydown", e);
84
+ };
85
+ }, [u, m, o]), u && V(
86
+ /* @__PURE__ */ U(
87
+ "div",
88
+ {
89
+ id: L,
90
+ "data-testid": M,
91
+ ref: z,
92
+ className: $(
93
+ "shadow-4 rounded-base bg-background-grouped-primary-normal overflow-x-hidden overflow-y-auto flex flex-col outline-0",
94
+ "fixed",
95
+ "z-50",
96
+ "max-w-screen",
97
+ S && "opacity-0 pointer-events-none",
98
+ C
99
+ ),
100
+ ...w,
101
+ style: {
102
+ ...w.style,
103
+ maxHeight: x || F,
104
+ ...I,
105
+ minWidth: W ? "212px" : I.minWidth
106
+ },
107
+ onKeyDown: O,
108
+ onMouseDown: h,
109
+ onMouseUp: h,
110
+ onTouchStart: h,
111
+ onTouchEnd: h,
112
+ tabIndex: -1,
113
+ "data-menu": B ?? "",
114
+ children: [
115
+ q?.(),
116
+ P
117
+ ]
118
+ }
119
+ ),
120
+ J(c.current)
121
+ );
122
+ function O(e) {
123
+ if (!c.current || (e.key !== "Escape" && e.stopPropagation(), e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLSelectElement))
124
+ return;
125
+ const t = Array.from(
126
+ c.current.querySelectorAll('[role="menuitem"]')
127
+ );
128
+ if (t.length === 0)
129
+ return;
130
+ let n = -1;
131
+ const s = document.activeElement;
132
+ for (let r = 0; r < t.length; r++)
133
+ if (t[r] === s) {
134
+ n = r;
135
+ break;
136
+ }
137
+ const a = e.key.length === 1 && e.key !== " " && !e.ctrlKey && !e.metaKey && !e.altKey, v = e.key === " " && i.current.length > 0;
138
+ if (a || v) {
139
+ e.preventDefault(), l.current && clearTimeout(l.current);
140
+ const r = i.current + e.key.toLowerCase();
141
+ i.current = r, l.current = setTimeout(() => {
142
+ i.current = "";
143
+ }, 1e3), t.find(
144
+ (N) => N.textContent?.trim().toLowerCase().startsWith(r)
145
+ )?.focus();
146
+ return;
147
+ }
148
+ switch (e.key) {
149
+ case "ArrowDown": {
150
+ e.preventDefault();
151
+ const r = n < t.length - 1 ? n + 1 : 0;
152
+ t[r].focus();
153
+ break;
154
+ }
155
+ case "ArrowUp": {
156
+ e.preventDefault();
157
+ const r = n > 0 ? n - 1 : t.length - 1;
158
+ t[r].focus();
159
+ break;
160
+ }
161
+ case "Home":
162
+ e.preventDefault(), t[0].focus();
163
+ break;
164
+ case "End":
165
+ e.preventDefault(), t[t.length - 1].focus();
166
+ break;
167
+ case "Enter":
168
+ case " ":
169
+ case "ArrowRight":
170
+ e.preventDefault(), n >= 0 && t[n].click();
171
+ break;
172
+ case "ArrowLeft":
173
+ e.preventDefault(), o?.current?.click(), o?.current?.focus();
174
+ break;
175
+ }
176
+ }
177
+ function T() {
178
+ E || c.current?.focus();
179
+ const e = Array.from(
180
+ c.current?.querySelectorAll('[role="menuitem"]') ?? []
181
+ ), t = c.current?.querySelector(
182
+ "[data-selected]"
183
+ ), n = e[0] ?? null, a = (k ? e.find(
184
+ (v) => v.textContent?.trim().toLowerCase().startsWith(k.toLowerCase())
185
+ ) ?? null : null) || t || n;
186
+ a && (a.scrollIntoView({
187
+ block: "nearest",
188
+ behavior: "instant"
189
+ }), !E && requestAnimationFrame(() => {
190
+ a.focus();
191
+ }));
192
+ }
193
+ function z(e) {
194
+ c.current = e, f && (typeof f == "function" ? f(e) : f.current = e);
195
+ }
196
+ function h(e) {
197
+ e.stopPropagation();
198
+ }
199
+ }
200
+ export {
201
+ ce as Menu
202
+ };
@@ -0,0 +1,161 @@
1
+ "use client";
2
+ import { jsxs as N, Fragment as te, jsx as r } from "react/jsx-runtime";
3
+ import { clsx as n } from "../node_modules/clsx/dist/clsx.js";
4
+ import { useId as oe, useRef as $, useState as ne } from "react";
5
+ import { layoutGroupGap as re, componentGap as ae, componentPadding as ce, baseTransition as ie } from "../classNames.js";
6
+ import { Label as se } from "./Label.js";
7
+ import { Paragraph as de } from "./Paragraph.js";
8
+ import { Icon as w } from "./Icon.js";
9
+ import { useMatchesMobile as le } from "../hooks/useMatchesMedia.js";
10
+ import { Caption as ue } from "./Caption.js";
11
+ function me({
12
+ id: i,
13
+ testid: c,
14
+ children: e,
15
+ disabled: t = !1,
16
+ variant: o = "normal",
17
+ value: l,
18
+ before: g,
19
+ after: m,
20
+ subMenu: a,
21
+ onClick: C,
22
+ selected: E,
23
+ ref: R,
24
+ onSubMenuHover: v,
25
+ onSubMenuLeave: b,
26
+ onSubMenuEnter: x,
27
+ toggleMenu: j,
28
+ subMenuLevel: d = 1,
29
+ currentSubMenuLevel: G,
30
+ closeSubMenuLevel: M,
31
+ activeMenu: O,
32
+ mobilePositionTo: P,
33
+ highlightMatchingText: A = !1,
34
+ menuValue: B,
35
+ onMouseMove: y,
36
+ onMouseEnter: D,
37
+ onMouseLeave: F,
38
+ small: u = !1
39
+ }) {
40
+ const H = oe(), T = $(null), k = R || T, s = $(`menu-${H}`), S = le(), [_, f] = ne(!1), q = () => {
41
+ a && v && !t && v(s.current, d), D?.();
42
+ }, I = () => {
43
+ a && b && !t && b(d), f(!1), F?.();
44
+ }, z = () => {
45
+ a && y && !t && y();
46
+ }, J = () => {
47
+ x && x(), f(!0);
48
+ }, K = {
49
+ "data-selected": E || null,
50
+ "data-submenu-hovered": _ || null
51
+ }, L = n(
52
+ "[&>svg]:shrink-0 [&>svg]:fill-icon-action-primary-normal"
53
+ ), p = n("w-full whitespace-nowrap !leading-6"), Q = o === "normal" && !t && n(
54
+ "bg-transparent text-text-primary-normal",
55
+ "hover:bg-background-action-secondary-hover",
56
+ "focus-visible:bg-background-action-secondary-hover",
57
+ "data-selected:bg-background-action-secondary-hover",
58
+ "data-submenu-hovered:bg-background-action-secondary-hover",
59
+ "active:bg-background-action-secondary-active"
60
+ ), U = o === "normal" && t && n("text-text-primary-disabled"), W = o === "action" && !t && n(
61
+ "text-action-400 bg-transparent",
62
+ "hover:bg-background-action-secondary-hover hover:text-text-action-hover",
63
+ "focus-visible:bg-background-action-secondary-hover focus-visible:text-text-action-hover",
64
+ "data-selected:bg-background-action-secondary-hover data-selected:text-text-action-hover",
65
+ "data-submenu-hovered:bg-background-action-secondary-hover data-submenu-hovered:text-text-action-hover",
66
+ "active:bg-background-action-secondary-active active:text-text-action-active"
67
+ ), X = o === "action" && t && n("text-text-action-disabled"), Y = t && n("bg-transparent cursor-default pointer-events-none"), h = typeof e == "string" && A ? fe(e, B) : e, Z = typeof e == "object" ? e : o === "action" ? /* @__PURE__ */ r(se, { padded: !0, className: p, children: h }) : u ? /* @__PURE__ */ r(ue, { padded: !0, className: p, children: h }) : /* @__PURE__ */ r(de, { padded: !0, className: p, children: h });
68
+ return /* @__PURE__ */ N(te, { children: [
69
+ /* @__PURE__ */ N(
70
+ "div",
71
+ {
72
+ id: i,
73
+ "data-testid": c,
74
+ ref: k,
75
+ className: n(
76
+ "flex cursor-pointer w-full text-left relative outline-none",
77
+ L,
78
+ u ? re : ae,
79
+ ce,
80
+ ie,
81
+ Q,
82
+ U,
83
+ W,
84
+ X,
85
+ Y,
86
+ { "items-center": !u }
87
+ ),
88
+ "data-value": l || e,
89
+ onClick: () => {
90
+ C?.(s.current, l || e), a && j(s.current, d);
91
+ },
92
+ onMouseEnter: q,
93
+ onMouseLeave: I,
94
+ onMouseMove: z,
95
+ ...K,
96
+ tabIndex: -1,
97
+ role: "menuitem",
98
+ "aria-haspopup": a ? "menu" : void 0,
99
+ children: [
100
+ g && /* @__PURE__ */ r("div", { className: n("shrink-0", { "items-center flex": !u }), children: g }),
101
+ Z,
102
+ V()
103
+ ]
104
+ }
105
+ ),
106
+ a && /* @__PURE__ */ r(
107
+ "div",
108
+ {
109
+ onMouseEnter: J,
110
+ onMouseLeave: () => {
111
+ I(), f(!1);
112
+ },
113
+ "data-submenu-parent": s.current,
114
+ "data-menu-level": d + 1,
115
+ children: a({
116
+ menuId: s.current,
117
+ positionTo: k,
118
+ mobilePositionTo: P,
119
+ position: "right",
120
+ subMenuLevel: d,
121
+ mobileBackMenuOption: ee,
122
+ mobileHide: S && O !== s.current,
123
+ autoFocusOff: !0
124
+ })
125
+ }
126
+ )
127
+ ] });
128
+ function V() {
129
+ return m || (a && m !== null ? /* @__PURE__ */ r(w, { name: "chevron_right" }) : null);
130
+ }
131
+ function ee() {
132
+ if (S)
133
+ return /* @__PURE__ */ r(
134
+ me,
135
+ {
136
+ id: i ? `${i}-back` : void 0,
137
+ testid: c ? `${c}-back` : void 0,
138
+ onClick: () => {
139
+ M?.(G ?? 0);
140
+ },
141
+ variant: "action",
142
+ before: /* @__PURE__ */ r(w, { name: "chevron_left" }),
143
+ children: "Back"
144
+ }
145
+ );
146
+ }
147
+ }
148
+ function fe(i, c) {
149
+ if (!c || !c.trim())
150
+ return i;
151
+ const e = new RegExp(
152
+ `(${c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`,
153
+ "gi"
154
+ );
155
+ return i.split(e).map(
156
+ (o, l) => e.test(o) ? /* @__PURE__ */ r("span", { className: "font-bold", children: o }, l) : o
157
+ );
158
+ }
159
+ export {
160
+ me as MenuOption
161
+ };
@@ -0,0 +1,85 @@
1
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
+ import { clsx as l } from "../../node_modules/clsx/dist/clsx.js";
3
+ import { useGridContext as y } from "./GridContextProvider/useGridContext.js";
4
+ import { MobileDataGridCard as N } from "./MobileDataGridCard/index.js";
5
+ import { Subheader as R } from "../Subheader.js";
6
+ import { Paragraph as C } from "../Paragraph.js";
7
+ import c from "../../static/no-results-image.png.js";
8
+ import { componentGap as j, componentPadding as G } from "../../classNames.js";
9
+ function F(m) {
10
+ const {
11
+ withBorder: f,
12
+ renderLink: u,
13
+ renderChevron: h,
14
+ footer: r,
15
+ enableRowSelection: p,
16
+ rowActions: x
17
+ } = m, d = y(), { id: b, testid: o, data: i, getId: w, selectedRowIds: v } = d, n = i.length === 0;
18
+ return /* @__PURE__ */ e(
19
+ "div",
20
+ {
21
+ className: l(
22
+ "flex flex-col flex-1 relative overflow-y-auto overflow-x-hidden",
23
+ !!r && "mb-20"
24
+ ),
25
+ children: /* @__PURE__ */ a(
26
+ "ul",
27
+ {
28
+ id: b,
29
+ "data-testid": o,
30
+ className: l(
31
+ "border-t-0 rounded-b w-full",
32
+ n && "!rounded-t-none",
33
+ f && "border border-border-primary-normal"
34
+ ),
35
+ children: [
36
+ n ? /* @__PURE__ */ a(
37
+ "div",
38
+ {
39
+ className: l(
40
+ "flex flex-col items-center justify-center",
41
+ j,
42
+ G
43
+ ),
44
+ "data-testid": o ? `${o}-no-results` : void 0,
45
+ children: [
46
+ /* @__PURE__ */ e(
47
+ "img",
48
+ {
49
+ src: c?.src ?? c,
50
+ alt: "No Results",
51
+ className: "h-30 opacity-20",
52
+ width: 120,
53
+ height: 120
54
+ }
55
+ ),
56
+ /* @__PURE__ */ e(R, { color: "text-secondary-normal", children: "No Results" }),
57
+ /* @__PURE__ */ e(C, { color: "text-secondary-normal", children: "To view results, enter or update your search criteria." })
58
+ ]
59
+ }
60
+ ) : i.map((s, g) => {
61
+ const t = w(s);
62
+ return /* @__PURE__ */ e(
63
+ N,
64
+ {
65
+ data: s,
66
+ index: g,
67
+ renderLink: u,
68
+ enableRowSelection: p,
69
+ selected: !!t && v.includes(t),
70
+ renderChevron: h,
71
+ rowActions: x
72
+ },
73
+ t
74
+ );
75
+ }),
76
+ !!r && /* @__PURE__ */ e("div", { className: "fixed left-0 right-0 bottom-0 flex flex-col w-full min-h-20", children: /* @__PURE__ */ e(r, { ...d }) })
77
+ ]
78
+ }
79
+ )
80
+ }
81
+ );
82
+ }
83
+ export {
84
+ F as ColumnList
85
+ };
@@ -0,0 +1,100 @@
1
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
+ import { useRef as g, useState as x, useCallback as y } from "react";
3
+ import { Button as u } from "../../Button.js";
4
+ import { Icon as C } from "../../Icon.js";
5
+ import { Menu as k } from "../../Menu.js";
6
+ import { Checkbox as S } from "../../Checkbox.js";
7
+ import { MenuOption as M } from "../../MenuOption.js";
8
+ import { useGridContext as w } from "../GridContextProvider/useGridContext.js";
9
+ function B() {
10
+ const b = w(), r = g(null), [p, n] = x(!1), {
11
+ columns: s,
12
+ id: i,
13
+ testid: e,
14
+ visibleColumns: f,
15
+ numberOfColumnsToShow: a,
16
+ primaryKey: l,
17
+ resetColumnVisibility: h,
18
+ dispatch: m
19
+ } = b, v = y(
20
+ (t, d) => {
21
+ m({ type: "UPDATE", index: t, payload: { meta: { visible: d } } });
22
+ },
23
+ [m]
24
+ );
25
+ return /* @__PURE__ */ c(
26
+ "div",
27
+ {
28
+ id: i ? `${i}-column-selector` : void 0,
29
+ "data-testid": e,
30
+ className: "text-text-secondary-normal border-l border-brand-200 p-mobile-container-padding",
31
+ ref: r,
32
+ children: [
33
+ /* @__PURE__ */ o(
34
+ u,
35
+ {
36
+ id: i ? `${i}-button` : void 0,
37
+ testid: e ? `${e}-button` : void 0,
38
+ onClick: () => n((t) => !t),
39
+ variant: "navigation",
40
+ iconOnly: !0,
41
+ leftIcon: /* @__PURE__ */ o(C, { name: "tune", size: 24 })
42
+ }
43
+ ),
44
+ /* @__PURE__ */ c(
45
+ k,
46
+ {
47
+ id: i ? `${i}-menu` : void 0,
48
+ testid: e ? `${e}-menu` : void 0,
49
+ positionTo: r,
50
+ position: "bottom-right",
51
+ show: p,
52
+ setShow: n,
53
+ calculateMinMaxHeight: !0,
54
+ children: [
55
+ /* @__PURE__ */ o(
56
+ u,
57
+ {
58
+ id: i ? `${i}-reset-button` : void 0,
59
+ testid: e ? `${e}-reset-button` : void 0,
60
+ variant: "tertiary",
61
+ onClick: () => {
62
+ h(), n(!1);
63
+ },
64
+ children: "Reset to default"
65
+ }
66
+ ),
67
+ s.filter((t) => t.meta?.inVisibilityMenu).map((t) => /* @__PURE__ */ o(
68
+ M,
69
+ {
70
+ testid: e ? `${e}-option-${t.id}` : void 0,
71
+ children: /* @__PURE__ */ o(
72
+ S,
73
+ {
74
+ id: i ? `${i}-checkbox-${t.id}` : void 0,
75
+ testid: e ? `${e}-checkbox-${t.id}` : void 0,
76
+ label: t.header?.toString(),
77
+ checked: !!t.meta?.visible || t.id === String(l),
78
+ disabled: typeof a < "u" && // account for header+link occupying one slot
79
+ f.length >= a - 1 && t.meta?.visible !== !0 || t.id === String(l),
80
+ onChange: (d) => {
81
+ v(
82
+ s.findIndex(({ id: $ }) => $ === t.id),
83
+ d.target.checked
84
+ );
85
+ }
86
+ }
87
+ )
88
+ },
89
+ i ? `${i}-option-${t.id}` : void 0
90
+ ))
91
+ ]
92
+ }
93
+ )
94
+ ]
95
+ }
96
+ );
97
+ }
98
+ export {
99
+ B as ColumnSelector
100
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"GridContext.d.ts","sourceRoot":"","sources":["../../../../src/components/MobileDataGrid/GridContextProvider/GridContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAiB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,OAAO,IAAI;IACzC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,cAAc,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACpC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAChD,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACnC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,CAAC,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,WAAW,0DAA8C,CAAC"}
1
+ {"version":3,"file":"GridContext.d.ts","sourceRoot":"","sources":["../../../../src/components/MobileDataGrid/GridContextProvider/GridContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAiB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,OAAO,IAAI;IACzC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,cAAc,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACpC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAChD,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACnC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,CAAC,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,WAAW,0DAA8C,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { createContext as t } from "react";
3
+ const e = t(null);
4
+ export {
5
+ e as GridContext
6
+ };
@@ -0,0 +1,80 @@
1
+ import { jsx as M } from "react/jsx-runtime";
2
+ import { useReducer as O, useState as v, useCallback as d, useMemo as P } from "react";
3
+ import { dataGridReducer as T } from "../dataGridReducer.js";
4
+ import { GridContext as j } from "./GridContext.js";
5
+ function V(S) {
6
+ const {
7
+ initialColumns: m,
8
+ id: b,
9
+ testid: h,
10
+ children: x,
11
+ data: c,
12
+ numberOfColumnsToShow: u,
13
+ primaryKey: n,
14
+ getId: r,
15
+ onRowSelect: f
16
+ } = S, [o, p] = O(T, m), [l, C] = v([]), [w, R] = v(null), y = d(() => {
17
+ const t = o.map((e) => {
18
+ const i = m.find((a) => a.id === e.id);
19
+ return {
20
+ ...e,
21
+ meta: {
22
+ ...e.meta,
23
+ visible: i?.meta?.visible
24
+ }
25
+ };
26
+ });
27
+ p({ type: "SET", payload: t });
28
+ }, [o, m]), g = d(
29
+ (t) => {
30
+ const e = r(t) ?? "";
31
+ if (!e) return;
32
+ const i = l.includes(e) ? l.filter((a) => a !== e) : [...l, e];
33
+ C(i), f && f(t, i);
34
+ },
35
+ [r, f, l]
36
+ ), I = d(() => {
37
+ C((t) => t.length === c.length ? [] : c.map(r).filter((e) => e !== void 0));
38
+ }, [c, r]), D = d((t) => {
39
+ R(t);
40
+ }, []), G = d(() => {
41
+ R(null);
42
+ }, []), k = P(() => {
43
+ const t = typeof u == "number" ? Math.max(u - 1, 0) : void 0;
44
+ if (n) {
45
+ const e = o.find((s) => s.id === String(n)), i = o.filter(
46
+ (s) => s.id !== String(n)
47
+ );
48
+ return (e ? [e, ...i] : [...i]).filter((s) => s.meta?.visible !== !1).slice(0, t);
49
+ }
50
+ return o.filter((e) => e.meta?.visible !== !1).slice(0, t);
51
+ }, [o, u, n]);
52
+ return /* @__PURE__ */ M(
53
+ j.Provider,
54
+ {
55
+ value: {
56
+ columns: o,
57
+ testid: h,
58
+ id: b,
59
+ data: c,
60
+ selectedRowIds: l,
61
+ visibleColumns: k,
62
+ numberOfColumnsToShow: u,
63
+ primaryKey: n,
64
+ dispatch: p,
65
+ getId: r,
66
+ resetColumnVisibility: y,
67
+ handleRowSelect: g,
68
+ handleRowSelectAll: I,
69
+ isRowDetailOpen: !!w,
70
+ currentRow: w,
71
+ openRowDetail: D,
72
+ closeRowDetail: G
73
+ },
74
+ children: x
75
+ }
76
+ );
77
+ }
78
+ export {
79
+ V as GridContextProvider
80
+ };
@@ -0,0 +1,11 @@
1
+ import { useContext as r } from "react";
2
+ import { GridContext as o } from "./GridContext.js";
3
+ function n() {
4
+ const t = r(o);
5
+ if (!t)
6
+ throw new Error("useGridContext must be used within GridContextProvider");
7
+ return t;
8
+ }
9
+ export {
10
+ n as useGridContext
11
+ };
@@ -0,0 +1,18 @@
1
+ import { jsxs as a } from "react/jsx-runtime";
2
+ import { Paragraph as i } from "../../Paragraph.js";
3
+ import { formatDate as l } from "../../../utils/date.js";
4
+ function f(o) {
5
+ const { column: t, data: e } = o;
6
+ let r;
7
+ return t.id && (r = e[t.id], t.meta?.format === "date" && typeof r == "string" && (r = l(r))), /* @__PURE__ */ a("div", { className: "grid grid-cols-2 gap-2 flex-1", children: [
8
+ /* @__PURE__ */ a(i, { color: "text-secondary-normal", className: "text-left", children: [
9
+ t.header?.toString(),
10
+ ":"
11
+ ] }),
12
+ " ",
13
+ r || null
14
+ ] });
15
+ }
16
+ export {
17
+ f as MobileDataGridColumn
18
+ };