@dmsi/wedgekit-react 2.0.0 → 2.0.2

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 (235) 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.d.ts.map +1 -1
  10. package/dist/components/CalendarRange.js +406 -0
  11. package/dist/components/Caption.js +99 -0
  12. package/dist/components/Card.js +50 -0
  13. package/dist/components/Checkbox.js +108 -0
  14. package/dist/components/CompactImagesPreview.d.ts.map +1 -1
  15. package/dist/components/CompactImagesPreview.js +121 -0
  16. package/dist/components/ContentTab.js +68 -0
  17. package/dist/components/ContentTabs.js +96 -0
  18. package/dist/components/DMSiLogo.js +54 -0
  19. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.d.ts.map +1 -1
  20. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +28 -0
  21. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.d.ts.map +1 -1
  22. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +80 -0
  23. package/dist/components/DataGrid/PinnedColumns.js +165 -0
  24. package/dist/components/DataGrid/SummaryRow/SummaryCell.js +51 -0
  25. package/dist/components/DataGrid/SummaryRow/aggregations.js +55 -0
  26. package/dist/components/DataGrid/SummaryRow/index.js +86 -0
  27. package/dist/components/DataGrid/TableBody/GroupRow.js +243 -0
  28. package/dist/components/DataGrid/TableBody/LoadingCell.js +33 -0
  29. package/dist/components/DataGrid/TableBody/TableBodyRow.js +136 -0
  30. package/dist/components/DataGrid/TableBody/index.js +161 -0
  31. package/dist/components/DataGrid/index.js +696 -0
  32. package/dist/components/DataGrid/utils.js +20 -0
  33. package/dist/components/DataGridCell.js +412 -0
  34. package/dist/components/DataTable.js +700 -0
  35. package/dist/components/DateInput.d.ts.map +1 -1
  36. package/dist/components/DateInput.js +194 -0
  37. package/dist/components/DateRangeInput.d.ts.map +1 -1
  38. package/dist/components/DateRangeInput.js +369 -0
  39. package/dist/components/DebugJson.js +28 -0
  40. package/dist/components/Display.js +46 -0
  41. package/dist/components/EditingContext.js +34 -0
  42. package/dist/components/EmblaCarousel/ArrowButtons.js +83 -0
  43. package/dist/components/EmblaCarousel/SelectedSnapDisplay.js +12 -0
  44. package/dist/components/EmblaCarousel/index.d.ts.map +1 -1
  45. package/dist/components/EmblaCarousel/index.js +154 -0
  46. package/dist/components/EmblaCarousel/usePrevNextButtons.d.ts.map +1 -1
  47. package/dist/components/EmblaCarousel/usePrevNextButtons.js +22 -0
  48. package/dist/components/EmblaCarousel/useSelectedSnapDisplay.d.ts.map +1 -1
  49. package/dist/components/EmblaCarousel/useSelectedSnapDisplay.js +16 -0
  50. package/dist/components/EmptyCartIcon.js +25 -0
  51. package/dist/components/FilterGroup.js +198 -0
  52. package/dist/components/FullViewportBox.js +19 -0
  53. package/dist/components/Grid.js +54 -0
  54. package/dist/components/Heading.js +50 -0
  55. package/dist/components/HorizontalDivider.js +20 -0
  56. package/dist/components/Icon.js +73 -0
  57. package/dist/components/ImagePlaceholder.d.ts.map +1 -1
  58. package/dist/components/ImagePlaceholder.js +23 -0
  59. package/dist/components/Input.js +469 -0
  60. package/dist/components/InputGroup.js +45 -0
  61. package/dist/components/Label.js +37 -0
  62. package/dist/components/Link.js +69 -0
  63. package/dist/components/List.js +12 -0
  64. package/dist/components/ListGroup.d.ts.map +1 -1
  65. package/dist/components/ListGroup.js +55 -0
  66. package/dist/components/LiveChatComponent.js +25 -0
  67. package/dist/components/LoadingScrim.js +22 -0
  68. package/dist/components/LogoAgilityTopBar.js +90 -0
  69. package/dist/components/LogoDMSiTopBar.js +54 -0
  70. package/dist/components/LogoMillworkTopBar.js +196 -0
  71. package/dist/components/MainBar.js +58 -0
  72. package/dist/components/MaxViewportBox.js +19 -0
  73. package/dist/components/Menu.js +202 -0
  74. package/dist/components/MenuOption.js +161 -0
  75. package/dist/components/MobileDataGrid/ColumnList.js +85 -0
  76. package/dist/components/MobileDataGrid/ColumnSelector/index.d.ts.map +1 -1
  77. package/dist/components/MobileDataGrid/ColumnSelector/index.js +101 -0
  78. package/dist/components/MobileDataGrid/GridContextProvider/GridContext.d.ts.map +1 -1
  79. package/dist/components/MobileDataGrid/GridContextProvider/GridContext.js +6 -0
  80. package/dist/components/MobileDataGrid/GridContextProvider/index.d.ts.map +1 -1
  81. package/dist/components/MobileDataGrid/GridContextProvider/index.js +81 -0
  82. package/dist/components/MobileDataGrid/GridContextProvider/useGridContext.d.ts.map +1 -1
  83. package/dist/components/MobileDataGrid/GridContextProvider/useGridContext.js +12 -0
  84. package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +18 -0
  85. package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +130 -0
  86. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +67 -0
  87. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +42 -0
  88. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +58 -0
  89. package/dist/components/MobileDataGrid/dataGridReducer.js +28 -0
  90. package/dist/components/MobileDataGrid/index.js +78 -0
  91. package/dist/components/MobileNavMenu.js +173 -0
  92. package/dist/components/Modal.js +201 -0
  93. package/dist/components/ModalButtons.js +57 -0
  94. package/dist/components/ModalContent.js +24 -0
  95. package/dist/components/ModalHeader.js +74 -0
  96. package/dist/components/ModalScrim.js +32 -0
  97. package/dist/components/NavigationTab.js +72 -0
  98. package/dist/components/NavigationTabs.js +45 -0
  99. package/dist/components/NestedMenu.js +119 -0
  100. package/dist/components/Notification.js +91 -0
  101. package/dist/components/OptionPill.js +103 -0
  102. package/dist/components/OrderCheckIcon.js +28 -0
  103. package/dist/components/PDFViewer/DownloadIcon.js +25 -0
  104. package/dist/components/PDFViewer/PDFElement.js +77 -0
  105. package/dist/components/PDFViewer/PDFNavigation.js +64 -0
  106. package/dist/components/PDFViewer/PDFPage.js +28 -0
  107. package/dist/components/PDFViewer/index.js +124 -0
  108. package/dist/components/Pagination.js +117 -0
  109. package/dist/components/Paragraph.js +43 -0
  110. package/dist/components/Password.js +47 -0
  111. package/dist/components/ProductImagePreview/CarouselPagination.js +48 -0
  112. package/dist/components/ProductImagePreview/MobileImageCarousel.d.ts.map +1 -1
  113. package/dist/components/ProductImagePreview/MobileImageCarousel.js +147 -0
  114. package/dist/components/ProductImagePreview/ProductPrimaryImage.d.ts.map +1 -1
  115. package/dist/components/ProductImagePreview/ProductPrimaryImage.js +139 -0
  116. package/dist/components/ProductImagePreview/Thumbnail.d.ts.map +1 -1
  117. package/dist/components/ProductImagePreview/Thumbnail.js +47 -0
  118. package/dist/components/ProductImagePreview/ZoomWindow.js +74 -0
  119. package/dist/components/ProductImagePreview/index.d.ts.map +1 -1
  120. package/dist/components/ProductImagePreview/index.js +190 -0
  121. package/dist/components/ProductImagePreview/useProductImagePreview.d.ts.map +1 -1
  122. package/dist/components/ProductImagePreview/useProductImagePreview.js +86 -0
  123. package/dist/components/ProjectBar.js +54 -0
  124. package/dist/components/Radio.js +113 -0
  125. package/dist/components/Search.js +89 -0
  126. package/dist/components/SearchResultImage/index.d.ts.map +1 -1
  127. package/dist/components/SearchResultImage/index.js +27 -0
  128. package/dist/components/Select.js +122 -0
  129. package/dist/components/SideMenu.js +24 -0
  130. package/dist/components/SideMenuGroup.js +80 -0
  131. package/dist/components/SideMenuItem.js +79 -0
  132. package/dist/components/SimpleTable.js +60 -0
  133. package/dist/components/SkeletonParagraph.js +24 -0
  134. package/dist/components/Spinner.js +30 -0
  135. package/dist/components/Stack.js +174 -0
  136. package/dist/components/StatusPill.js +44 -0
  137. package/dist/components/Stepper.js +138 -0
  138. package/dist/components/Subheader.js +41 -0
  139. package/dist/components/Surface.js +30 -0
  140. package/dist/components/Swatch.js +1498 -0
  141. package/dist/components/Textarea.js +106 -0
  142. package/dist/components/Theme.js +25 -0
  143. package/dist/components/Time.d.ts.map +1 -1
  144. package/dist/components/Time.js +226 -0
  145. package/dist/components/Toast.js +170 -0
  146. package/dist/components/Tooltip.js +102 -0
  147. package/dist/components/TopBar.js +119 -0
  148. package/dist/components/Upload.js +107 -0
  149. package/dist/components/WorldpayIframe.js +19 -0
  150. package/dist/hooks/useEditCell.d.ts.map +1 -1
  151. package/dist/hooks/useEditCell.js +24 -0
  152. package/dist/hooks/useInfiniteScroll.js +25 -0
  153. package/dist/hooks/useKeydown.d.ts.map +1 -1
  154. package/dist/hooks/useKeydown.js +21 -0
  155. package/dist/hooks/useMatchesMedia.d.ts.map +1 -1
  156. package/dist/hooks/useMatchesMedia.js +16 -0
  157. package/dist/hooks/useMenuSystem.js +186 -0
  158. package/dist/hooks/useMounted.js +9 -0
  159. package/dist/hooks/useTableLayout/computeColumns.js +59 -0
  160. package/dist/hooks/useTableLayout/storage.js +64 -0
  161. package/dist/hooks/useTableLayout/useTableLayout.js +163 -0
  162. package/dist/index.js +249 -53839
  163. package/dist/lib/loadFonts.js +11 -0
  164. package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +56 -0
  165. package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +2299 -0
  166. package/dist/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js +13 -0
  167. package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +367 -0
  168. package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +235 -0
  169. package/dist/node_modules/@headlessui/react/dist/components/description/description.js +45 -0
  170. package/dist/node_modules/@headlessui/react/dist/components/keyboard.js +4 -0
  171. package/dist/node_modules/@headlessui/react/dist/components/label/label.js +62 -0
  172. package/dist/node_modules/@headlessui/react/dist/components/switch/switch.js +56 -0
  173. package/dist/node_modules/@headlessui/react/dist/hooks/use-active-press.js +33 -0
  174. package/dist/node_modules/@headlessui/react/dist/hooks/use-controllable.js +10 -0
  175. package/dist/node_modules/@headlessui/react/dist/hooks/use-default-value.js +8 -0
  176. package/dist/node_modules/@headlessui/react/dist/hooks/use-disposables.js +9 -0
  177. package/dist/node_modules/@headlessui/react/dist/hooks/use-event.js +9 -0
  178. package/dist/node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js +8 -0
  179. package/dist/node_modules/@headlessui/react/dist/hooks/use-latest-value.js +11 -0
  180. package/dist/node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js +12 -0
  181. package/dist/node_modules/@headlessui/react/dist/hooks/use-slot.js +7 -0
  182. package/dist/node_modules/@headlessui/react/dist/hooks/use-sync-refs.js +16 -0
  183. package/dist/node_modules/@headlessui/react/dist/internal/disabled.js +8 -0
  184. package/dist/node_modules/@headlessui/react/dist/internal/form-fields.js +35 -0
  185. package/dist/node_modules/@headlessui/react/dist/internal/hidden.js +13 -0
  186. package/dist/node_modules/@headlessui/react/dist/internal/id.js +8 -0
  187. package/dist/node_modules/@headlessui/react/dist/utils/bugs.js +19 -0
  188. package/dist/node_modules/@headlessui/react/dist/utils/class-names.js +6 -0
  189. package/dist/node_modules/@headlessui/react/dist/utils/disposables.js +40 -0
  190. package/dist/node_modules/@headlessui/react/dist/utils/dom.js +34 -0
  191. package/dist/node_modules/@headlessui/react/dist/utils/env.js +34 -0
  192. package/dist/node_modules/@headlessui/react/dist/utils/form.js +32 -0
  193. package/dist/node_modules/@headlessui/react/dist/utils/match.js +11 -0
  194. package/dist/node_modules/@headlessui/react/dist/utils/micro-task.js +8 -0
  195. package/dist/node_modules/@headlessui/react/dist/utils/owner.js +8 -0
  196. package/dist/node_modules/@headlessui/react/dist/utils/render.js +126 -0
  197. package/dist/node_modules/@js-temporal/polyfill/dist/index.esm.js +3913 -0
  198. package/dist/node_modules/@mikecousins/react-pdf/dist/index.js +83 -0
  199. package/dist/node_modules/@react-aria/focus/dist/useFocusRing.js +38 -0
  200. package/dist/node_modules/@react-aria/interactions/dist/useFocus.js +31 -0
  201. package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.js +99 -0
  202. package/dist/node_modules/@react-aria/interactions/dist/useFocusWithin.js +59 -0
  203. package/dist/node_modules/@react-aria/interactions/dist/useHover.js +86 -0
  204. package/dist/node_modules/@react-aria/interactions/dist/utils.js +68 -0
  205. package/dist/node_modules/@react-aria/utils/dist/DOMFunctions.js +32 -0
  206. package/dist/node_modules/@react-aria/utils/dist/domHelpers.js +15 -0
  207. package/dist/node_modules/@react-aria/utils/dist/focusWithoutScrolling.js +45 -0
  208. package/dist/node_modules/@react-aria/utils/dist/isVirtualEvent.js +7 -0
  209. package/dist/node_modules/@react-aria/utils/dist/openLink.js +28 -0
  210. package/dist/node_modules/@react-aria/utils/dist/platform.js +47 -0
  211. package/dist/node_modules/@react-aria/utils/dist/useGlobalListeners.js +34 -0
  212. package/dist/node_modules/@react-aria/utils/dist/useLayoutEffect.js +6 -0
  213. package/dist/node_modules/@react-stately/flags/dist/import.js +7 -0
  214. package/dist/node_modules/@tanstack/react-table/build/lib/index.js +94 -0
  215. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +38 -0
  216. package/dist/node_modules/@tanstack/table-core/build/lib/index.js +1954 -0
  217. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +575 -0
  218. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +52 -0
  219. package/dist/node_modules/clsx/dist/clsx.js +17 -0
  220. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +1204 -0
  221. package/dist/node_modules/embla-carousel-autoplay/esm/embla-carousel-autoplay.esm.js +126 -0
  222. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +24 -0
  223. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +35 -0
  224. package/dist/node_modules/jsbi/dist/jsbi.js +1040 -0
  225. package/dist/node_modules/react-use/esm/usePrevious.js +10 -0
  226. package/dist/static/no-results-image.png.js +4 -0
  227. package/dist/utils/date-patch-dashes.js +28 -0
  228. package/dist/utils/date.js +95 -0
  229. package/dist/utils/formatting.js +22 -0
  230. package/dist/utils/index.d.ts +1 -1
  231. package/dist/utils/index.js +4 -0
  232. package/dist/utils/mergeObjectArrays.js +18 -0
  233. package/dist/utils.js +20 -0
  234. package/package.json +1 -1
  235. /package/dist/{pdf-l6QfMa5e.js → node_modules/pdfjs-dist/build/pdf.js} +0 -0
@@ -0,0 +1,194 @@
1
+ "use client";
2
+ import { jsxs as F, jsx as f, Fragment as j } from "react/jsx-runtime";
3
+ import { useState as h, useRef as P, useEffect as R, useLayoutEffect as q } from "react";
4
+ import { createPortal as X } from "react-dom";
5
+ import { InputBase as G } from "./Input.js";
6
+ import { CalendarRange as U } from "./CalendarRange.js";
7
+ import { Icon as _ } from "./Icon.js";
8
+ import { findDocumentRoot as H } from "../utils.js";
9
+ import { isValidDate as g, calculateCursorPosition as J } from "../utils/date.js";
10
+ import { formatDateWithDashes as Q, formatInputValueWithDashes as B, parseInputDateWithDashes as b } from "../utils/date-patch-dashes.js";
11
+ import { marginTopUsingComponentGap as Z } from "../classNames.js";
12
+ function me({
13
+ id: o,
14
+ testid: w,
15
+ value: S,
16
+ onChange: D,
17
+ placeholder: T = "MM/DD/YYYY",
18
+ disabled: Y,
19
+ readOnly: d = !1,
20
+ label: M,
21
+ isDateAvailable: $,
22
+ disableManualInput: z,
23
+ theme: K,
24
+ ...W
25
+ }) {
26
+ const [v, s] = h(!1), [y, p] = h(""), [k, i] = h(!1), C = P(null), n = P(null), I = P(null), [E, A] = h({
27
+ top: 0,
28
+ left: 0,
29
+ width: 0
30
+ }), l = S;
31
+ R(() => {
32
+ k || p(L(l));
33
+ }, [l, k]), q(() => {
34
+ v && c();
35
+ }, [v]);
36
+ const c = () => {
37
+ if (I.current) {
38
+ const e = I.current.getBoundingClientRect();
39
+ A({
40
+ top: e.bottom + window.scrollY,
41
+ left: e.left + window.scrollX,
42
+ width: e.width
43
+ });
44
+ }
45
+ };
46
+ R(() => {
47
+ c();
48
+ const e = new ResizeObserver(c);
49
+ return n.current && e.observe(n.current), window.addEventListener("scroll", c), () => {
50
+ e.disconnect(), window.removeEventListener("scroll", c);
51
+ };
52
+ }, []), R(() => {
53
+ const e = (t) => {
54
+ t.key === "Escape" && C.current && (s(!1), n.current?.blur());
55
+ };
56
+ return document.addEventListener("keydown", e), () => {
57
+ document.removeEventListener("keydown", e);
58
+ };
59
+ });
60
+ function N(e) {
61
+ D(e), s(!1), i(!1);
62
+ }
63
+ const V = () => {
64
+ d || s(!0);
65
+ };
66
+ return /* @__PURE__ */ F("div", { className: "relative", children: [
67
+ /* @__PURE__ */ f(
68
+ G,
69
+ {
70
+ id: o,
71
+ testid: w,
72
+ ref: (e) => {
73
+ n.current = e;
74
+ },
75
+ ...W,
76
+ wrapperRef: I,
77
+ value: y,
78
+ placeholder: T,
79
+ disabled: Y,
80
+ readOnly: d,
81
+ after: /* @__PURE__ */ f(_, { name: "calendar_month" }),
82
+ onFocus: z ? (e) => {
83
+ e.preventDefault(), e.stopPropagation(), e.currentTarget.blur();
84
+ } : V,
85
+ onClick: () => {
86
+ V();
87
+ },
88
+ onChange: (e) => {
89
+ if (d) return;
90
+ const t = e.target.value, r = e.target.selectionStart || 0;
91
+ i(!0);
92
+ const a = B(t);
93
+ p(a), requestAnimationFrame(() => {
94
+ if (n.current) {
95
+ const m = J(
96
+ t,
97
+ a,
98
+ r
99
+ );
100
+ n.current.setSelectionRange(m, m);
101
+ }
102
+ });
103
+ const u = b(a);
104
+ u && g(u) && D(u);
105
+ },
106
+ onBlur: () => {
107
+ i(!1);
108
+ const e = b(y);
109
+ (!e || !g(e)) && p(L(l));
110
+ },
111
+ onKeyDown: (e) => {
112
+ if (e.key === "Backspace") {
113
+ const t = e.target, r = t.selectionStart || 0, a = t.value;
114
+ if (r > 0 && a[r - 1] === "/") {
115
+ e.preventDefault();
116
+ const u = a.slice(0, r - 2) + a.slice(r), m = B(u);
117
+ p(m), requestAnimationFrame(() => {
118
+ if (n.current) {
119
+ const x = Math.max(0, r - 2);
120
+ n.current.setSelectionRange(x, x);
121
+ }
122
+ }), i(!0);
123
+ return;
124
+ }
125
+ }
126
+ if (e.key === "Enter") {
127
+ const t = b(y);
128
+ t && g(t) && (D(t), s(!1), i(!1));
129
+ }
130
+ },
131
+ label: M,
132
+ secondaryIconColor: !0
133
+ }
134
+ ),
135
+ v && !d && X(
136
+ /* @__PURE__ */ F(j, { children: [
137
+ /* @__PURE__ */ f(
138
+ "div",
139
+ {
140
+ className: "fixed inset-0 z-30",
141
+ onClick: () => s(!1),
142
+ onMouseDown: (e) => {
143
+ e.preventDefault();
144
+ },
145
+ onWheel: (e) => {
146
+ const t = document.scrollingElement ?? document.documentElement;
147
+ t.scrollTop += e.deltaY, t.scrollLeft += e.deltaX;
148
+ },
149
+ onTouchMove: (e) => {
150
+ e.stopPropagation();
151
+ },
152
+ style: { touchAction: "pan-y pan-x" },
153
+ "aria-hidden": "true"
154
+ }
155
+ ),
156
+ /* @__PURE__ */ f(
157
+ "div",
158
+ {
159
+ ref: (e) => {
160
+ C.current = e;
161
+ },
162
+ className: `absolute z-50 ${Z}`,
163
+ "data-theme": K,
164
+ style: {
165
+ top: `${E.top}px`,
166
+ left: `${E.left}px`
167
+ },
168
+ children: /* @__PURE__ */ f(
169
+ U,
170
+ {
171
+ id: o ? `${o}-calendar` : void 0,
172
+ testid: w ? `${w}-calendar` : void 0,
173
+ from: l,
174
+ to: l,
175
+ onChange: N,
176
+ cardStyle: !0,
177
+ mode: "single",
178
+ disableRange: !0,
179
+ isDateAvailable: $
180
+ }
181
+ )
182
+ }
183
+ )
184
+ ] }),
185
+ H(C.current)
186
+ )
187
+ ] });
188
+ }
189
+ function L(o) {
190
+ return !o || !g(o) ? "" : Q(o);
191
+ }
192
+ export {
193
+ me as DateInput
194
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangeInput.d.ts","sourceRoot":"","sources":["../../src/components/DateRangeInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAa,MAAM,SAAS,CAAC;AACpD,OAAO,EAAiB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAcpE,KAAK,mBAAmB,GAAG,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,IAAI,CAAC,kBAAkB,EAAE,iBAAiB,GAAG,qBAAqB,CAAC,CAAC;AAExE,wBAAgB,cAAc,CAAC,EAC7B,EAAE,EACF,MAAM,EACN,KAAK,EACL,QAAQ,EACR,WAAuC,EACvC,QAAQ,EACR,QAAgB,EAChB,MAAc,EACd,YAAoB,EACpB,KAAK,EACL,eAAe,EACf,mBAAmB,EACnB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,mBAAmB,2CA4kBrB"}
1
+ {"version":3,"file":"DateRangeInput.d.ts","sourceRoot":"","sources":["../../src/components/DateRangeInput.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAa,MAAM,SAAS,CAAC;AACpD,OAAO,EAAiB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAcpE,KAAK,mBAAmB,GAAG,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,IAAI,CAAC,kBAAkB,EAAE,iBAAiB,GAAG,qBAAqB,CAAC,CAAC;AAExE,wBAAgB,cAAc,CAAC,EAC7B,EAAE,EACF,MAAM,EACN,KAAK,EACL,QAAQ,EACR,WAAuC,EACvC,QAAQ,EACR,QAAgB,EAChB,MAAc,EACd,YAAoB,EACpB,KAAK,EACL,eAAe,EACf,mBAAmB,EACnB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,mBAAmB,2CA4kBrB"}
@@ -0,0 +1,369 @@
1
+ "use client";
2
+ import { jsxs as ht, Fragment as Dt, jsx as B } from "react/jsx-runtime";
3
+ import { useState as O, useRef as W, useEffect as K, useLayoutEffect as $t } from "react";
4
+ import { createPortal as wt } from "react-dom";
5
+ import { InputBase as gt } from "./Input.js";
6
+ import { CalendarRange as yt } from "./CalendarRange.js";
7
+ import { Icon as Pt } from "./Icon.js";
8
+ import { findDocumentRoot as St } from "../utils.js";
9
+ import { parseInputDate as d, isValidDate as g, formatDate as z, isValidDateRangeOrder as Vt, formatInputValue as H, calculateCursorPosition as Mt } from "../utils/date.js";
10
+ import { marginTopUsingComponentGap as Ft } from "../classNames.js";
11
+ import { useMatchesMobile as Yt } from "../hooks/useMatchesMedia.js";
12
+ function jt({
13
+ id: o,
14
+ testid: i,
15
+ value: V,
16
+ onChange: r,
17
+ placeholder: p = "MM/DD/YYYY - MM/DD/YYYY",
18
+ disabled: Y,
19
+ readOnly: y = !1,
20
+ single: k = !1,
21
+ disableRange: a = !1,
22
+ label: E,
23
+ isDateAvailable: $,
24
+ onPendingFromChange: Q,
25
+ theme: Z,
26
+ ...tt
27
+ }) {
28
+ const et = Yt(), [j, M] = O(!1), [v, u] = O(""), [X, h] = O(!1), A = W(null), N = W(null), l = W(null), [b, nt] = O({
29
+ top: 0,
30
+ left: 0,
31
+ width: 0
32
+ }), [q, L] = V.split("|");
33
+ K(() => {
34
+ if (!X) {
35
+ const t = J(q, L);
36
+ t && u(t);
37
+ }
38
+ }, [q, L, X, a]), $t(() => {
39
+ j && R();
40
+ }, [j]);
41
+ const R = () => {
42
+ if (N.current) {
43
+ const t = N.current.getBoundingClientRect();
44
+ nt({
45
+ top: t.bottom + window.scrollY,
46
+ left: t.left + window.scrollX,
47
+ width: t.width
48
+ });
49
+ }
50
+ };
51
+ K(() => {
52
+ R();
53
+ const t = new ResizeObserver(R);
54
+ return l.current && t.observe(l.current), window.addEventListener("scroll", R), () => {
55
+ t.disconnect(), window.removeEventListener("scroll", R);
56
+ };
57
+ }, []), K(() => {
58
+ const t = (e) => {
59
+ e.key === "Escape" && A.current && (M(!1), l.current?.blur());
60
+ };
61
+ return document.addEventListener("keydown", t), () => {
62
+ document.removeEventListener("keydown", t);
63
+ };
64
+ }, []), K(() => {
65
+ const t = (e) => {
66
+ A.current && !A.current.contains(e.target) && l.current && !l.current.contains(e.target) && M(!1);
67
+ };
68
+ return document.addEventListener("mousedown", t), () => {
69
+ document.removeEventListener("mousedown", t);
70
+ };
71
+ }, []);
72
+ function rt(t, e) {
73
+ r(a ? `${t}|${t}` : `${t}|${e}`), M(!1), h(!1);
74
+ }
75
+ const _ = () => {
76
+ y || M(!0);
77
+ }, st = () => {
78
+ _();
79
+ }, ot = (t) => {
80
+ if (y) return;
81
+ const e = t.target.value, s = t.target.selectionStart || 0;
82
+ if (ct(e)) {
83
+ it(e, s);
84
+ return;
85
+ }
86
+ h(!0);
87
+ const n = F(e), c = at(n, e) ? `${n} - ` : n;
88
+ u(c);
89
+ const f = lt(
90
+ e,
91
+ n,
92
+ c,
93
+ s
94
+ );
95
+ requestAnimationFrame(() => {
96
+ C(f);
97
+ }), ut(c);
98
+ }, ct = (t) => !a && t.includes("-") && !t.includes(" - "), it = (t, e) => {
99
+ const s = t.replace(/-/g, ""), n = F(s);
100
+ u(n), requestAnimationFrame(() => {
101
+ const c = Math.min(
102
+ e - 1,
103
+ n.length
104
+ );
105
+ C(c);
106
+ });
107
+ }, at = (t, e) => {
108
+ if (a || t.includes(" - ") || !t.match(/^(\d{2})\/(\d{2})\/(\d{4})$/) || e.length !== t.length)
109
+ return !1;
110
+ const n = e.length - 1;
111
+ return !F(e.slice(0, n)).match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
112
+ }, lt = (t, e, s, n) => s !== e ? s.length : It(
113
+ t,
114
+ s,
115
+ n,
116
+ a
117
+ ), C = (t) => {
118
+ l.current && l.current.setSelectionRange(t, t);
119
+ }, ut = (t) => {
120
+ a ? ft(t) : dt(t);
121
+ }, ft = (t) => {
122
+ const e = d(t);
123
+ e && g(e) && r(`${e}|${e}`);
124
+ }, dt = (t) => {
125
+ if (t === "") {
126
+ r("");
127
+ return;
128
+ }
129
+ const e = t.match(/^(.+?)\s*-\s*(.+)$/);
130
+ e ? mt(e) : pt(t);
131
+ }, mt = (t) => {
132
+ const [, e, s] = t, n = d(e.trim()), c = d(s.trim());
133
+ n && c && T(n, c) && r(`${n}|${c}`);
134
+ }, pt = (t) => {
135
+ const e = d(t);
136
+ e && g(e) && r(`${e}|`);
137
+ };
138
+ return /* @__PURE__ */ ht(Dt, { children: [
139
+ /* @__PURE__ */ B(
140
+ gt,
141
+ {
142
+ id: o,
143
+ testid: i,
144
+ ref: (t) => {
145
+ l.current = t;
146
+ },
147
+ ...tt,
148
+ wrapperRef: N,
149
+ value: v,
150
+ placeholder: a ? "MM/DD/YYYY" : p,
151
+ disabled: Y,
152
+ readOnly: y,
153
+ after: /* @__PURE__ */ B(Pt, { name: "calendar_month" }),
154
+ onFocus: _,
155
+ onClick: st,
156
+ onChange: ot,
157
+ onBlur: () => {
158
+ if (h(!1), a) {
159
+ const t = d(v);
160
+ if (!t || !g(t)) {
161
+ const e = J(q, L);
162
+ u(e || "");
163
+ }
164
+ } else {
165
+ const t = v.match(/^(.+?)\s*-\s*(.+)$/);
166
+ if (t) {
167
+ const [, e, s] = t, n = d(e.trim()), c = d(s.trim());
168
+ (!n || !c || !T(n, c)) && (u(""), r(""));
169
+ } else if (v.includes(" - "))
170
+ u(""), r("");
171
+ else {
172
+ const e = d(v);
173
+ !e || g(e), u(""), r("");
174
+ }
175
+ }
176
+ },
177
+ onKeyDown: (t) => {
178
+ if (!a && t.key === "-") {
179
+ t.preventDefault();
180
+ return;
181
+ }
182
+ if (t.key === "Backspace") {
183
+ const e = t.target, s = e.selectionStart || 0, n = e.value;
184
+ if (s > 0 && n[s - 1] === "/") {
185
+ t.preventDefault();
186
+ const c = n.slice(0, s - 2) + n.slice(s), f = F(c);
187
+ u(f), requestAnimationFrame(() => {
188
+ if (l.current) {
189
+ const I = Math.max(0, s - 2);
190
+ l.current.setSelectionRange(I, I);
191
+ }
192
+ }), h(!0);
193
+ return;
194
+ }
195
+ if (!a && n.includes(" - ")) {
196
+ const c = n.indexOf(" - "), f = c, I = c + 3;
197
+ if (s >= f && s <= I) {
198
+ t.preventDefault();
199
+ const w = n.slice(0, f).trim(), P = w.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
200
+ if (P) {
201
+ const [, m, D, S] = P, G = S.slice(0, -1), U = `${m}/${D}/${G}`, x = F(U);
202
+ u(x), r(""), requestAnimationFrame(() => {
203
+ l.current && l.current.setSelectionRange(
204
+ x.length,
205
+ x.length
206
+ );
207
+ });
208
+ } else {
209
+ const m = F(w);
210
+ u(m);
211
+ const D = d(w);
212
+ D && g(D) ? r(`${D}|`) : r(""), requestAnimationFrame(() => {
213
+ if (l.current) {
214
+ const S = m.length;
215
+ l.current.setSelectionRange(S, S);
216
+ }
217
+ });
218
+ }
219
+ h(!0);
220
+ return;
221
+ }
222
+ if (s === I) {
223
+ t.preventDefault();
224
+ const w = n.slice(0, f).trim(), P = `${w} - `;
225
+ u(P);
226
+ const m = d(w);
227
+ m && g(m) && r(`${m}|`), requestAnimationFrame(() => {
228
+ l.current && l.current.setSelectionRange(
229
+ P.length,
230
+ P.length
231
+ );
232
+ }), h(!0);
233
+ return;
234
+ }
235
+ }
236
+ }
237
+ if (t.key === "Delete") {
238
+ const e = t.target, s = e.selectionStart || 0, n = e.value;
239
+ if (!a && n.includes(" - ")) {
240
+ const c = n.indexOf(" - "), f = c, I = c + 3;
241
+ if (s >= f && s <= I) {
242
+ t.preventDefault();
243
+ const w = n.slice(0, f).trim(), P = w.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
244
+ if (P) {
245
+ const [, m, D, S] = P, G = S.slice(0, -1), U = `${m}/${D}/${G}`, x = F(U);
246
+ u(x), r(""), requestAnimationFrame(() => {
247
+ l.current && l.current.setSelectionRange(
248
+ x.length,
249
+ x.length
250
+ );
251
+ });
252
+ } else {
253
+ const m = F(w);
254
+ u(m);
255
+ const D = d(w);
256
+ D && g(D) ? r(`${D}|`) : r(""), requestAnimationFrame(() => {
257
+ if (l.current) {
258
+ const S = m.length;
259
+ l.current.setSelectionRange(S, S);
260
+ }
261
+ });
262
+ }
263
+ h(!0);
264
+ return;
265
+ }
266
+ }
267
+ }
268
+ if (t.key === "Enter")
269
+ if (a) {
270
+ const e = d(v);
271
+ e && g(e) && (r(`${e}|${e}`), M(!1), h(!1));
272
+ } else {
273
+ const e = v.match(/^(.+?)\s*-\s*(.+)$/);
274
+ if (e) {
275
+ const [, s, n] = e, c = d(s.trim()), f = d(n.trim());
276
+ c && f && T(c, f) ? (r(`${c}|${f}`), M(!1), h(!1)) : (u(""), r(""), M(!1), h(!1));
277
+ } else
278
+ u(""), r(""), M(!1), h(!1);
279
+ }
280
+ },
281
+ label: E,
282
+ secondaryIconColor: !0
283
+ }
284
+ ),
285
+ j && !y && wt(
286
+ /* @__PURE__ */ B(
287
+ "div",
288
+ {
289
+ ref: (t) => {
290
+ A.current = t;
291
+ },
292
+ className: `absolute z-40 ${Ft}`,
293
+ "data-theme": Z,
294
+ style: {
295
+ top: `${b.top}px`,
296
+ left: `${b.left}px`,
297
+ minWidth: `${b.width}px`
298
+ },
299
+ children: /* @__PURE__ */ B(
300
+ yt,
301
+ {
302
+ id: o ? `${o}-calendar` : void 0,
303
+ testid: i ? `${i}-calendar` : void 0,
304
+ from: q,
305
+ to: L,
306
+ onChange: rt,
307
+ cardStyle: !0,
308
+ mode: k || et ? "single" : "double",
309
+ disableRange: a,
310
+ isDateAvailable: $,
311
+ onPendingFromChange: Q
312
+ }
313
+ )
314
+ }
315
+ ),
316
+ St(A.current)
317
+ )
318
+ ] });
319
+ function F(t) {
320
+ return vt(t, a);
321
+ }
322
+ function J(t, e) {
323
+ return xt(t, e, a);
324
+ }
325
+ }
326
+ function T(o, i) {
327
+ return Vt(o, i);
328
+ }
329
+ function vt(o, i) {
330
+ if (i)
331
+ return H(o);
332
+ if (o.includes(" - ")) {
333
+ const [r, p] = o.split(" - "), Y = H(r), y = H(p || "");
334
+ return `${Y} - ${y}`;
335
+ }
336
+ const V = o.replace(/-/g, "");
337
+ return H(V);
338
+ }
339
+ function It(o, i, V, r) {
340
+ if (!r && i.includes(" - ")) {
341
+ const p = i.indexOf(" - "), Y = o.indexOf("-");
342
+ if (Y !== -1 && V > Y) {
343
+ const y = o.slice(Y + 1).replace(/\D/g, "").length, k = i.slice(p + 3);
344
+ let a = p + 3, E = 0;
345
+ for (let $ = 0; $ < k.length; $++) {
346
+ if (/\d/.test(k[$]) && (E++, E >= y)) {
347
+ $ + 1 < k.length && k[$ + 1] === "/" ? a = p + 3 + $ + 2 : a = p + 3 + $ + 1;
348
+ break;
349
+ }
350
+ E < y && (a = p + 3 + $ + 1);
351
+ }
352
+ return Math.min(a, i.length);
353
+ }
354
+ }
355
+ return Mt(
356
+ o,
357
+ i,
358
+ V
359
+ );
360
+ }
361
+ function xt(o, i, V) {
362
+ if (!o && !i)
363
+ return "";
364
+ const r = o ? g(o) : !1, p = i ? g(i) : !1;
365
+ return V ? r && o ? z(o) : "" : r && p && o && i && T(o, i) ? `${z(o)} - ${z(i)}` : r && !i && o ? `${z(o)} - ` : "";
366
+ }
367
+ export {
368
+ jt as DateRangeInput
369
+ };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsxs as l, jsx as n } from "react/jsx-runtime";
3
+ import { useState as d } from "react";
4
+ function p({ data: o, id: e }) {
5
+ const [r, t] = d(!1);
6
+ return process.env.NODE_ENV !== "development" ? null : /* @__PURE__ */ l(
7
+ "div",
8
+ {
9
+ id: e,
10
+ className: "p-2 rounded bg-neutral-100 border border-red-500 my-4",
11
+ children: [
12
+ /* @__PURE__ */ n(
13
+ "button",
14
+ {
15
+ id: e ? `${e}-toggle-button` : void 0,
16
+ onClick: () => t((s) => !s),
17
+ className: "px-4 py-2 border rounded bg-white",
18
+ children: r ? "Hide JSON" : "Show JSON"
19
+ }
20
+ ),
21
+ r && /* @__PURE__ */ n("pre", { className: "mt-4", children: JSON.stringify(o, null, 4) })
22
+ ]
23
+ }
24
+ );
25
+ }
26
+ export {
27
+ p as DebugJson
28
+ };
@@ -0,0 +1,46 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { clsx as y } from "../node_modules/clsx/dist/clsx.js";
3
+ import { typography as c } from "../classNames.js";
4
+ function a({
5
+ className: t,
6
+ children: o,
7
+ as: s,
8
+ color: l,
9
+ align: e,
10
+ variant: i = "display1",
11
+ id: m,
12
+ testid: p,
13
+ ...n
14
+ }) {
15
+ return /* @__PURE__ */ r(
16
+ s ?? (i === "display1" ? "h1" : "h2"),
17
+ {
18
+ id: m,
19
+ "data-testid": p,
20
+ className: y(
21
+ c[i],
22
+ t,
23
+ e === "left" && "text-left",
24
+ e === "center" && "text-center",
25
+ e === "right" && "text-right"
26
+ ),
27
+ style: {
28
+ ...n.style,
29
+ color: l ? `var(--color-${l})` : void 0
30
+ },
31
+ ...n,
32
+ children: o
33
+ }
34
+ );
35
+ }
36
+ function E(t) {
37
+ return /* @__PURE__ */ r(a, { ...t, variant: "display1" });
38
+ }
39
+ function v(t) {
40
+ return /* @__PURE__ */ r(a, { ...t, variant: "display2" });
41
+ }
42
+ export {
43
+ a as Display,
44
+ E as Display1,
45
+ v as Display2
46
+ };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as l } from "react/jsx-runtime";
3
+ import { createContext as m, useState as g, useContext as b } from "react";
4
+ const s = m(null), p = ({
5
+ data: e,
6
+ children: a
7
+ }) => {
8
+ const [u, r] = g(e), c = {
9
+ data: u,
10
+ setData: (t, i, o) => {
11
+ r((d) => {
12
+ const n = [...d], x = typeof n[t]?.[i] == "number" && !isNaN(Number(o)) ? Number(o) : o;
13
+ return n[t] = {
14
+ ...n[t],
15
+ [i]: x
16
+ }, n;
17
+ });
18
+ },
19
+ setBulkData: (t) => {
20
+ r(t);
21
+ }
22
+ };
23
+ return /* @__PURE__ */ l(s.Provider, { value: c, children: a });
24
+ }, D = () => {
25
+ const e = b(s);
26
+ if (!e)
27
+ throw new Error("useTableEditingContext must be used within EditingProvider");
28
+ return e;
29
+ };
30
+ export {
31
+ s as EditingContext,
32
+ p as EditingProvider,
33
+ D as useTableEditingContext
34
+ };