@nxgt/material 3.62.0 → 3.63.0

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 (92) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -1
  3. package/dist/alert-dialog-RHm6WtQj.js +189 -0
  4. package/dist/{async-slice-HJY_VJjD.js → async-slice-DmX59NyA.js} +3 -4
  5. package/dist/{button-7BuUCGRm.js → button-DfS_amfQ.js} +1 -1
  6. package/dist/charts.js +3 -3
  7. package/dist/{chip-kQOrHlDX.js → chip-Cbndukko.js} +2 -2
  8. package/dist/{code-editor-Ckc9TTCM.js → code-editor-B0tN8Ha_.js} +11 -11
  9. package/dist/code-editor.js +5 -5
  10. package/dist/{code-language-items-rCPB0Xee.js → code-language-items-andgHKrM.js} +2 -2
  11. package/dist/components/ui/layout/sidebar/sidebar-tokens.css +13 -1
  12. package/dist/{components-TDDUQ1Y0.js → components-Cm2doOJS.js} +14345 -14224
  13. package/dist/components.js +28 -26
  14. package/dist/dialog-Bd7Hid2L.js +219 -0
  15. package/dist/dnd.js +1 -1
  16. package/dist/{dropdown-menu-CiobN1wi.js → dropdown-menu-_SyVmSuy.js} +1 -1
  17. package/dist/editor.js +707 -706
  18. package/dist/{empty-state-DA517HAb.js → empty-state-D-2ZMXXJ.js} +2 -2
  19. package/dist/escape-owner-DpaP0lm1.js +19 -0
  20. package/dist/{field-blur-DdvY0NQQ.js → field-blur-DyOByjzw.js} +1 -1
  21. package/dist/{field-blur-context-DbJQZkEB.js → field-blur-context-DPe5_Nv5.js} +1 -1
  22. package/dist/hooks-a7_exKWS.js +329 -0
  23. package/dist/hooks.js +3 -3
  24. package/dist/{hover-card-DPs9huSs.js → hover-card-D_0smKBQ.js} +2 -2
  25. package/dist/i18n.js +8 -10
  26. package/dist/{icon-badge-C646JTOI.js → icon-badge-CBCU3ySF.js} +14 -14
  27. package/dist/{icon-button-DvP0Gy3j.js → icon-button-hKHsWTAt.js} +1 -1
  28. package/dist/lib/components/ui/feedback/index.d.ts +1 -0
  29. package/dist/lib/components/ui/feedback/unsaved-dialog/index.d.ts +1 -0
  30. package/dist/lib/components/ui/feedback/unsaved-dialog/unsaved-dialog.d.ts +20 -0
  31. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  32. package/dist/lib/components/ui/fields/textarea-field/textarea-footer.d.ts +2 -1
  33. package/dist/lib/components/ui/widgets/education/questions/index.d.ts +3 -1
  34. package/dist/lib/components/ui/widgets/education/questions/partials/question-content.d.ts +1 -1
  35. package/dist/lib/components/ui/widgets/education/questions/partials/question-top.d.ts +6 -0
  36. package/dist/lib/components/ui/widgets/education/questions/question-long-text.d.ts +5 -0
  37. package/dist/lib/components/ui/widgets/education/questions/question-media-content.d.ts +24 -0
  38. package/dist/lib/components/ui/widgets/education/questions/question-media-helpers.d.ts +11 -0
  39. package/dist/lib/components/ui/widgets/education/questions/question-media-view.d.ts +18 -0
  40. package/dist/lib/components/ui/widgets/education/questions/question-media-view.types.d.ts +32 -0
  41. package/dist/lib/components/ui/widgets/education/questions/question-options.d.ts +2 -2
  42. package/dist/lib/components/ui/widgets/education/questions/question-text.d.ts +1 -1
  43. package/dist/lib/components/ui/widgets/education/questions/question.d.ts +1 -1
  44. package/dist/lib/components/ui/widgets/education/questions/types.d.ts +38 -1
  45. package/dist/lib/components/ui/widgets/education/questions/use-reload-focus.d.ts +13 -0
  46. package/dist/lib/hooks/index.d.ts +3 -0
  47. package/dist/lib/hooks/unsaved-guard-rules.d.ts +30 -0
  48. package/dist/lib/hooks/use-react-router-block.d.ts +11 -0
  49. package/dist/lib/hooks/use-unsaved-guard/guard-core.d.ts +30 -0
  50. package/dist/lib/hooks/use-unsaved-guard/index.d.ts +3 -0
  51. package/dist/lib/hooks/use-unsaved-guard/types.d.ts +63 -0
  52. package/dist/lib/hooks/use-unsaved-guard/use-discard-guard.d.ts +15 -0
  53. package/dist/lib/hooks/use-unsaved-guard/use-unsaved-guard.d.ts +19 -0
  54. package/dist/lib/i18n/resources/en/en.d.ts +20 -0
  55. package/dist/lib/i18n/resources/en/material.json.d.ts +21 -1
  56. package/dist/lib/i18n/resources/fr/fr.d.ts +20 -0
  57. package/dist/lib/i18n/resources/fr/material.json.d.ts +21 -1
  58. package/dist/lib/i18n/resources/resources.d.ts +40 -0
  59. package/dist/lib/i18n/translator.d.ts +1 -1
  60. package/dist/lib.js +1 -1
  61. package/dist/main.js +42 -43
  62. package/dist/map.js +63 -63
  63. package/dist/material.css +1 -1
  64. package/dist/pdf-reader.js +1 -1
  65. package/dist/print.js +1 -2
  66. package/dist/{public-BYsrhyPW.js → public-D8JGp3PH.js} +823 -822
  67. package/dist/{rich-code-block-WJxDWPPY.js → rich-code-block-0R3bidsM.js} +5 -5
  68. package/dist/{sortable-provider-oPjlhlZo.js → sortable-provider-B75v53sB.js} +2 -2
  69. package/dist/{spinner-C5lObWXT.js → spinner-CAnpF3RK.js} +1 -1
  70. package/dist/theme-picker.js +2 -2
  71. package/dist/{theme-toggle-CPEq5JG-.js → theme-toggle-pQ5F602V.js} +1 -1
  72. package/dist/{toolbar-items-ByvXcMHm.js → toolbar-items-_ezD5B0r.js} +4 -4
  73. package/dist/translate-material-CvZK8_S6.js +96 -0
  74. package/dist/{stored-language-B-tiWZU2.js → translator-Caf-d96e.js} +2497 -8
  75. package/dist/{escape-owner-r57kuPjn.js → typography-CEK19bj8.js} +17 -34
  76. package/dist/{use-chat-composer-CzOVaIed.js → use-chat-composer-Dpvi_-CR.js} +5164 -5338
  77. package/dist/{use-heading-spy-BOtygPFu.js → use-heading-spy-mmcyEGmm.js} +186 -71
  78. package/dist/{use-material-translation-B5j3jZs7.js → use-material-translation-C_1cWRzW.js} +1 -2
  79. package/dist/use-return-focus-1ZIchrBM.js +269 -0
  80. package/docs/components/feedback-and-status.md +23 -0
  81. package/docs/components/navigation-and-layout.md +4 -3
  82. package/docs/components/rich-widgets.md +73 -1
  83. package/docs/guides/helpers.md +63 -0
  84. package/docs/guides/theming.md +13 -3
  85. package/docs/previews/feedback-status-unsaveddialog.webp +0 -0
  86. package/lib/components/ui/layout/sidebar/sidebar-tokens.css +13 -1
  87. package/package.json +1 -1
  88. package/dist/dialog-yfPkLqUQ.js +0 -482
  89. package/dist/hooks-CGnqFngB.js +0 -187
  90. package/dist/i18n-provider-BehR6cU7.js +0 -79
  91. package/dist/translate-material-tUaLZUmT.js +0 -20
  92. package/dist/translator-B9XjUDRu.js +0 -2451
@@ -1,482 +0,0 @@
1
- import { t as e } from "./utils-BLfntITJ.js";
2
- import { o as t, r as n } from "./dist-DVRQkaTK.js";
3
- import { a as r, c as i, i as a, l as o, o as s, r as c, s as l } from "./dist-lmHmz_bu.js";
4
- import { C as u, S as d, n as f, w as p } from "./spinner-C5lObWXT.js";
5
- import { c as m, i as h, l as g, o as ee, r as _, s as te, t as ne } from "./in-dialog-Vwkyp-M5.js";
6
- import { t as re } from "./use-material-translation-B5j3jZs7.js";
7
- import { n as ie } from "./icon-button-DvP0Gy3j.js";
8
- import { i as ae, r as oe } from "./escape-owner-r57kuPjn.js";
9
- import * as v from "react";
10
- import { useCallback as se, useContext as ce, useRef as y } from "react";
11
- import { Fragment as le, jsx as b, jsxs as ue } from "react/jsx-runtime";
12
- import { forwardEscape as de, keepListEscape as fe } from "@nxgt/material-core/escape-forward";
13
- import { X as pe } from "lucide-react";
14
- //#region ../../node_modules/@radix-ui/react-dialog/dist/index.mjs
15
- var me = Object.defineProperty, x = (e, t) => me(e, "name", {
16
- value: t,
17
- configurable: !0
18
- }), S = "Dialog", [C, he] = i(S), [ge, w] = C(S), T = /* @__PURE__ */ x((e) => {
19
- let { __scopeDialog: t, children: n, open: i, defaultOpen: a, onOpenChange: o, modal: s = !0 } = e, l = v.useRef(null), u = v.useRef(null), [d, f] = r({
20
- prop: i,
21
- defaultProp: a ?? !1,
22
- onChange: o,
23
- caller: S
24
- }), [p, m] = v.useState(0), [h, g] = v.useState(0);
25
- return /* @__PURE__ */ b(ge, {
26
- scope: t,
27
- triggerRef: l,
28
- contentRef: u,
29
- contentId: c(),
30
- titleId: c(),
31
- descriptionId: c(),
32
- titlePresent: p > 0,
33
- descriptionPresent: h > 0,
34
- setTitleCount: m,
35
- setDescriptionCount: g,
36
- open: d,
37
- onOpenChange: f,
38
- onOpenToggle: v.useCallback(() => f((e) => !e), [f]),
39
- modal: s,
40
- children: n
41
- });
42
- }, "Dialog"), _e = "DialogTrigger", E = /* @__PURE__ */ v.forwardRef(/* @__PURE__ */ x(function(e, n) {
43
- let { __scopeDialog: r, ...i } = e, a = w(_e, r), s = t(n, a.triggerRef);
44
- return /* @__PURE__ */ b(o.button, {
45
- type: "button",
46
- "aria-haspopup": "dialog",
47
- "aria-expanded": a.open,
48
- "aria-controls": a.open ? a.contentId : void 0,
49
- "data-state": R(a.open),
50
- ...i,
51
- ref: s,
52
- onClick: l(e.onClick, a.onOpenToggle)
53
- });
54
- }, "DialogTrigger")), D = "DialogPortal", [ve, O] = C(D, { forceMount: void 0 }), k = /* @__PURE__ */ x((e) => {
55
- let { __scopeDialog: t, forceMount: n, children: r, container: i } = e, o = w(D, t);
56
- return /* @__PURE__ */ b(ve, {
57
- scope: t,
58
- forceMount: n,
59
- children: v.Children.map(r, (e) => /* @__PURE__ */ b(a, {
60
- present: n || o.open,
61
- children: /* @__PURE__ */ b(d, {
62
- asChild: !0,
63
- container: i,
64
- children: e
65
- })
66
- }))
67
- });
68
- }, "DialogPortal"), A = "DialogOverlay", j = /* @__PURE__ */ v.forwardRef(/* @__PURE__ */ x(function(e, t) {
69
- let n = O(A, e.__scopeDialog), { forceMount: r = n.forceMount, ...i } = e, o = w(A, e.__scopeDialog);
70
- return o.modal ? /* @__PURE__ */ b(a, {
71
- present: r || o.open,
72
- children: /* @__PURE__ */ b(be, {
73
- ...i,
74
- ref: t
75
- })
76
- }) : null;
77
- }, "DialogOverlay")), ye = n("DialogOverlay.RemoveScroll"), be = /* @__PURE__ */ v.forwardRef(/* @__PURE__ */ x(function(e, n) {
78
- let { __scopeDialog: r, ...i } = e, a = w(A, r), s = t(n, p());
79
- return /* @__PURE__ */ b(te, {
80
- as: ye,
81
- allowPinchZoom: !0,
82
- shards: [a.contentRef],
83
- children: /* @__PURE__ */ b(o.div, {
84
- "data-state": R(a.open),
85
- ...i,
86
- ref: s,
87
- style: {
88
- pointerEvents: "auto",
89
- ...i.style
90
- }
91
- })
92
- });
93
- }, "DialogOverlayImpl")), M = "DialogContent", N = /* @__PURE__ */ v.forwardRef(/* @__PURE__ */ x(function(e, t) {
94
- let n = O(M, e.__scopeDialog), { forceMount: r = n.forceMount, ...i } = e, o = w(M, e.__scopeDialog);
95
- return /* @__PURE__ */ b(a, {
96
- present: r || o.open,
97
- children: o.modal ? /* @__PURE__ */ b(xe, {
98
- ...i,
99
- ref: t
100
- }) : /* @__PURE__ */ b(Se, {
101
- ...i,
102
- ref: t
103
- })
104
- });
105
- }, "DialogContent")), xe = /* @__PURE__ */ v.forwardRef(/* @__PURE__ */ x(function(e, n) {
106
- let r = w(M, e.__scopeDialog), i = v.useRef(null), a = t(n, r.contentRef, i);
107
- return v.useEffect(() => {
108
- let e = i.current;
109
- if (e) return ee(e);
110
- }, []), /* @__PURE__ */ b(P, {
111
- ...e,
112
- ref: a,
113
- trapFocus: r.open,
114
- disableOutsidePointerEvents: r.open,
115
- onCloseAutoFocus: l(e.onCloseAutoFocus, (e) => {
116
- e.preventDefault(), r.triggerRef.current?.focus();
117
- }),
118
- onPointerDownOutside: l(e.onPointerDownOutside, (e) => {
119
- let t = e.detail.originalEvent, n = t.button === 0 && t.ctrlKey === !0;
120
- (t.button === 2 || n) && e.preventDefault();
121
- }),
122
- onFocusOutside: l(e.onFocusOutside, (e) => e.preventDefault())
123
- });
124
- }, "DialogContentModal")), Se = /* @__PURE__ */ v.forwardRef(/* @__PURE__ */ x(function(e, t) {
125
- let n = w(M, e.__scopeDialog), r = v.useRef(!1), i = v.useRef(!1);
126
- return /* @__PURE__ */ b(P, {
127
- ...e,
128
- ref: t,
129
- trapFocus: !1,
130
- disableOutsidePointerEvents: !1,
131
- onCloseAutoFocus: (t) => {
132
- e.onCloseAutoFocus?.(t), t.defaultPrevented || (r.current || n.triggerRef.current?.focus(), t.preventDefault()), r.current = !1, i.current = !1;
133
- },
134
- onInteractOutside: (t) => {
135
- e.onInteractOutside?.(t), t.defaultPrevented || (r.current = !0, t.detail.originalEvent.type === "pointerdown" && (i.current = !0));
136
- let a = t.target;
137
- n.triggerRef.current?.contains(a) && t.preventDefault(), t.detail.originalEvent.type === "focusin" && i.current && t.preventDefault();
138
- }
139
- });
140
- }, "DialogContentNonModal")), P = /* @__PURE__ */ v.forwardRef(/* @__PURE__ */ x(function(e, t) {
141
- let { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: i, onCloseAutoFocus: a, ...o } = e, s = w(M, n);
142
- return m(), /* @__PURE__ */ b(le, { children: /* @__PURE__ */ b(g, {
143
- asChild: !0,
144
- loop: !0,
145
- trapped: r,
146
- onMountAutoFocus: i,
147
- onUnmountAutoFocus: a,
148
- children: /* @__PURE__ */ b(u, {
149
- role: "dialog",
150
- id: s.contentId,
151
- "aria-describedby": s.descriptionPresent ? s.descriptionId : void 0,
152
- "aria-labelledby": s.titlePresent ? s.titleId : void 0,
153
- "data-state": R(s.open),
154
- ...o,
155
- ref: t,
156
- deferPointerDownOutside: !0,
157
- onDismiss: () => s.onOpenChange(!1)
158
- })
159
- }) });
160
- }, "DialogContentImpl")), Ce = "DialogTitle", F = /* @__PURE__ */ v.forwardRef(/* @__PURE__ */ x(function(e, t) {
161
- let { __scopeDialog: n, ...r } = e, i = w(Ce, n), { setTitleCount: a } = i;
162
- return s(() => (a((e) => e + 1), () => a((e) => e - 1)), [a]), /* @__PURE__ */ b(o.h2, {
163
- id: i.titleId,
164
- ...r,
165
- ref: t
166
- });
167
- }, "DialogTitle")), we = "DialogDescription", I = /* @__PURE__ */ v.forwardRef(/* @__PURE__ */ x(function(e, t) {
168
- let { __scopeDialog: n, ...r } = e, i = w(we, n), { setDescriptionCount: a } = i;
169
- return s(() => (a((e) => e + 1), () => a((e) => e - 1)), [a]), /* @__PURE__ */ b(o.p, {
170
- id: i.descriptionId,
171
- ...r,
172
- ref: t
173
- });
174
- }, "DialogDescription")), Te = "DialogClose", L = /* @__PURE__ */ v.forwardRef(/* @__PURE__ */ x(function(e, t) {
175
- let { __scopeDialog: n, ...r } = e, i = w(Te, n);
176
- return /* @__PURE__ */ b(o.button, {
177
- type: "button",
178
- ...r,
179
- ref: t,
180
- onClick: l(e.onClick, () => i.onOpenChange(!1))
181
- });
182
- }, "DialogClose"));
183
- function R(e) {
184
- return e ? "open" : "closed";
185
- }
186
- x(R, "getState");
187
- //#endregion
188
- //#region lib/components/ui/primitives/field-box/field-box.ts
189
- var z = "nxgt-field-box", Ee = "nxgt-field-list", B = (e) => e ? "" : void 0;
190
- function De(e) {
191
- return {
192
- "data-size": e.size,
193
- "data-filled": B(e.filled),
194
- "data-open": B(e.list?.open),
195
- "data-list-side": e.list?.open ? e.list.side : void 0,
196
- "data-focused": B(e.focused),
197
- "data-invalid": B(e.invalid),
198
- "data-disabled": B(e.disabled),
199
- "data-readonly": B(e.readOnly)
200
- };
201
- }
202
- var Oe = /* @__PURE__ */ new Set([
203
- "checkbox",
204
- "radio",
205
- "file",
206
- "range",
207
- "color",
208
- "hidden",
209
- "button",
210
- "submit",
211
- "reset",
212
- "image"
213
- ]);
214
- function V(e, t = "text") {
215
- return e || (Oe.has(t) ? void 0 : " ");
216
- }
217
- //#endregion
218
- //#region lib/components/ui/overlays/dialog/use-escape-forward.ts
219
- function ke(e, n) {
220
- let r = y(null);
221
- return {
222
- ref: t(r, n),
223
- onEscapeKeyDown(t) {
224
- fe(t), oe(t, r.current), e?.(t), de(r.current, t);
225
- }
226
- };
227
- }
228
- //#endregion
229
- //#region lib/components/ui/overlays/dialog/use-overlay-order.ts
230
- function Ae(e) {
231
- let n = y(null);
232
- return {
233
- overlayRef: se((e) => {
234
- let t = n.current;
235
- !e || !t?.isConnected || t.parentNode === e.parentNode && t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING && t.before(e);
236
- }, []),
237
- contentRef: t(n, e)
238
- };
239
- }
240
- //#endregion
241
- //#region lib/components/ui/overlays/dialog/use-modal-content.ts
242
- function H({ ref: e, onEscapeKeyDown: t, ...n }, r) {
243
- let i = ce(_) ?? !0, a = ke(t, h(r ?? i, e)), o = Ae(a.ref);
244
- return {
245
- ref: o.contentRef,
246
- overlayRef: o.overlayRef,
247
- onEscapeKeyDown: a.onEscapeKeyDown,
248
- outside: {
249
- onPointerDownOutside: U(n.onPointerDownOutside),
250
- onFocusOutside: U(n.onFocusOutside),
251
- onInteractOutside: U(n.onInteractOutside)
252
- }
253
- };
254
- }
255
- function U(e) {
256
- return (t) => {
257
- e?.(t);
258
- let n = t.target;
259
- n instanceof Element && n.closest("[data-sonner-toaster]") && t.preventDefault();
260
- };
261
- }
262
- //#endregion
263
- //#region lib/components/ui/overlays/dialog/menu-trigger.ts
264
- var W = "[role=\"menu\"]", je = 8;
265
- function Me(e) {
266
- let t = null, n = e?.closest(W) ?? null;
267
- for (let e = 0; n && e < je; e++) {
268
- let e = n.getAttribute("data-return-focus"), r = e ? n.ownerDocument.getElementById(e) : null;
269
- if (r) return r;
270
- let [i] = (n.getAttribute("aria-labelledby") ?? "").split(/\s+/), a = i ? n.ownerDocument.getElementById(i) : null;
271
- if (!a) break;
272
- t = a, n = a.closest(W);
273
- }
274
- return t;
275
- }
276
- //#endregion
277
- //#region lib/components/ui/overlays/dialog/use-return-focus.ts
278
- var Ne = "button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]";
279
- function Pe(e) {
280
- ([...e.querySelectorAll(Ne)].find((e) => e.tabIndex >= 0 && e.getClientRects().length > 0) ?? e).focus({ preventScroll: !0 });
281
- }
282
- function G(e, { focusFallback: t = !1 } = {}) {
283
- let n = y(null), r = y(null);
284
- return {
285
- onOpenAutoFocus(i) {
286
- let a = document.activeElement;
287
- n.current = a instanceof HTMLElement && a !== document.body ? a : null, r.current = Me(n.current), e.onOpenAutoFocus?.(i);
288
- let o = i.target;
289
- !t || i.defaultPrevented || !(o instanceof HTMLElement) || queueMicrotask(() => {
290
- o.isConnected && !o.contains(document.activeElement) && Pe(o);
291
- });
292
- },
293
- onCloseAutoFocus(t) {
294
- e.onCloseAutoFocus?.(t);
295
- let i = n.current?.isConnected ? n.current : r.current;
296
- if (n.current = null, r.current = null, t.defaultPrevented || !i?.isConnected) return;
297
- let a = document.activeElement;
298
- a && a !== document.body || (t.preventDefault(), i.focus());
299
- }
300
- };
301
- }
302
- //#endregion
303
- //#region lib/components/ui/primitives/input/input-box.ts
304
- var Fe = "selection:bg-primary selection:text-primary-foreground", K = [
305
- "inline-flex gap-2 items-center h-11 max-h-full w-full min-w-0",
306
- "px-2 py-1 text-base md:text-sm outline-none",
307
- "placeholder:text-muted-foreground",
308
- "file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-muted-foreground",
309
- "disabled:pointer-events-none"
310
- ], q = [
311
- ...K,
312
- Fe,
313
- z
314
- ], Ie = [...K, z], J = q;
315
- function Le({ className: t, type: n = "text", ...r }) {
316
- return /* @__PURE__ */ b("input", {
317
- type: n,
318
- "data-slot": "input",
319
- className: e(J, t),
320
- "data-pw": r.name ?? "input",
321
- ...r,
322
- placeholder: V(r.placeholder, n)
323
- });
324
- }
325
- //#endregion
326
- //#region lib/components/ui/overlays/dialog/dialog-outside.ts
327
- function Re(e) {
328
- let t = e.target;
329
- t instanceof Element && t.closest("[data-slot=\"combobox-content\"]") && e.preventDefault();
330
- }
331
- function Y(e) {
332
- return (t) => {
333
- Re(t), e?.(t);
334
- };
335
- }
336
- function X(e) {
337
- return {
338
- ...e,
339
- onPointerDownOutside: Y(e.onPointerDownOutside),
340
- onFocusOutside: Y(e.onFocusOutside),
341
- onInteractOutside: Y(e.onInteractOutside)
342
- };
343
- }
344
- //#endregion
345
- //#region lib/components/ui/overlays/dialog/dialog-variants.ts
346
- var ze = f("nxgt-dialog fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 p-6 max-h-[calc(100dvh-2rem)] supports-[not(height:100dvh)]:max-h-[calc(100vh-2rem)] overflow-y-auto", {
347
- variants: {
348
- size: {
349
- sm: "sm:max-w-sm",
350
- md: "sm:max-w-lg",
351
- lg: "sm:max-w-2xl",
352
- xl: "sm:max-w-4xl",
353
- full: "sm:max-w-[calc(100%-4rem)]"
354
- },
355
- mobilePresentation: {
356
- dialog: "",
357
- "bottom-sheet": "max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:max-h-[calc(100dvh-1.5rem)] max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))]",
358
- top: "max-sm:top-3 max-sm:translate-y-0 max-sm:max-h-[calc(100dvh-1.5rem)]",
359
- fullscreen: "max-sm:inset-0 max-sm:h-dvh max-sm:max-h-none max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:content-start max-sm:pt-[max(1.5rem,env(safe-area-inset-top))]"
360
- }
361
- },
362
- defaultVariants: {
363
- size: "md",
364
- mobilePresentation: "dialog"
365
- }
366
- });
367
- //#endregion
368
- //#region lib/components/ui/overlays/dialog/dialog-parts.tsx
369
- function Z({ className: t, ...n }) {
370
- return /* @__PURE__ */ b("div", {
371
- "data-slot": "dialog-header",
372
- className: e("flex flex-col gap-2 text-center sm:text-left", t),
373
- ...n
374
- });
375
- }
376
- function Be({ className: t, stackOnPhone: n = !0, ...r }) {
377
- return /* @__PURE__ */ b("div", {
378
- "data-slot": "dialog-footer",
379
- className: e("flex gap-2 pt-2", n ? "flex-col-reverse max-sm:*:w-full sm:flex-row sm:justify-end" : "flex-row justify-end max-sm:justify-between", t),
380
- ...r
381
- });
382
- }
383
- function Ve({ className: t, ...n }) {
384
- return /* @__PURE__ */ b(F, {
385
- "data-slot": "dialog-title",
386
- className: e("text-2xl/8 font-medium tracking-tight text-foreground", t),
387
- ...n
388
- });
389
- }
390
- function He({ className: t, ...n }) {
391
- return /* @__PURE__ */ b(I, {
392
- "data-slot": "dialog-description",
393
- className: e("text-muted-foreground text-sm/6", t),
394
- ...n
395
- });
396
- }
397
- //#endregion
398
- //#region lib/components/ui/overlays/dialog/dialog.tsx
399
- function Ue({ ...e }) {
400
- return /* @__PURE__ */ b(_, {
401
- value: e.modal ?? !0,
402
- children: /* @__PURE__ */ b(T, {
403
- "data-slot": "dialog",
404
- ...e
405
- })
406
- });
407
- }
408
- function We({ asChild: e = !0, ...t }) {
409
- return /* @__PURE__ */ b(E, {
410
- "data-slot": "dialog-trigger",
411
- ...t,
412
- asChild: e
413
- });
414
- }
415
- function Q({ ...e }) {
416
- return /* @__PURE__ */ b(k, {
417
- "data-slot": "dialog-portal",
418
- ...e
419
- });
420
- }
421
- function Ge({ className: t, color: n, children: r, type: i = "button", variant: a = "ghost", ...o }) {
422
- let { t: s } = re();
423
- return /* @__PURE__ */ b(L, {
424
- "aria-label": r ? void 0 : s("material.buttons.close", "Close"),
425
- ...o,
426
- type: i,
427
- className: e("absolute top-4 right-4", ie({
428
- variant: a,
429
- color: n,
430
- className: t
431
- })),
432
- "data-slot": "dialog-close",
433
- children: r || /* @__PURE__ */ b(pe, { className: "size-4" })
434
- });
435
- }
436
- function $({ className: t, scrim: n = "dim", ...r }) {
437
- return /* @__PURE__ */ b(j, {
438
- "data-slot": "dialog-overlay",
439
- "data-scrim": n,
440
- className: e("nxgt-scrim fixed inset-0 z-50", t),
441
- ...r
442
- });
443
- }
444
- function Ke({ className: t, children: n, onInteractOutside: r, onPointerDownOutside: i, onFocusOutside: a, onOpenAutoFocus: o, onCloseAutoFocus: s, onEscapeKeyDown: c, size: l, mobilePresentation: u, scrim: d, container: f, ref: p, ...m }) {
445
- let h = G({
446
- onOpenAutoFocus: o,
447
- onCloseAutoFocus: s
448
- }), g = H(X({
449
- ref: p,
450
- onEscapeKeyDown: c,
451
- onInteractOutside: r,
452
- onPointerDownOutside: i,
453
- onFocusOutside: a
454
- }));
455
- return /* @__PURE__ */ b(ae, { children: /* @__PURE__ */ b(ne, {
456
- value: !0,
457
- children: /* @__PURE__ */ ue(Q, {
458
- "data-slot": "dialog-portal",
459
- container: f,
460
- children: [/* @__PURE__ */ b($, {
461
- ref: g.overlayRef,
462
- scrim: d
463
- }), /* @__PURE__ */ b(N, {
464
- ref: g.ref,
465
- "data-slot": "dialog-content",
466
- "data-presentation": u ?? void 0,
467
- className: e(ze({
468
- size: l,
469
- mobilePresentation: u
470
- }), t),
471
- onOpenAutoFocus: h.onOpenAutoFocus,
472
- onCloseAutoFocus: h.onCloseAutoFocus,
473
- onEscapeKeyDown: g.onEscapeKeyDown,
474
- ...m,
475
- ...g.outside,
476
- children: n
477
- })]
478
- })
479
- }) });
480
- }
481
- //#endregion
482
- export { he as A, L as C, k as D, j as E, F as O, T as S, I as T, H as _, Q as a, Ee as b, Be as c, X as d, Le as f, G as g, Ie as h, $ as i, E as k, Z as l, q as m, Ge as n, We as o, J as p, Ke as r, He as s, Ue as t, Ve as u, V as v, N as w, De as x, z as y };
@@ -1,187 +0,0 @@
1
- import { r as e } from "./i18n-provider-BehR6cU7.js";
2
- import { t } from "./number.utils-BG_eEt5g.js";
3
- import { useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
4
- import { useNavigate as s, useSearchParams as c } from "react-router";
5
- import { createFormatters as l } from "@nxgt/material-core/print-format";
6
- //#region lib/hooks/use-allowed-transitions.ts
7
- function u(e, t, n) {
8
- return (t[e] || []).map((e) => {
9
- let t = n[e];
10
- return t ? {
11
- targetStatus: e,
12
- ...t
13
- } : null;
14
- }).filter((e) => e !== null);
15
- }
16
- //#endregion
17
- //#region lib/hooks/drafts-store.ts
18
- function d(e, t, n) {
19
- let r = {};
20
- try {
21
- let i = e?.getItem(t);
22
- if (!i) return r;
23
- let a = JSON.parse(i);
24
- if (!a || typeof a != "object" || Array.isArray(a)) return r;
25
- for (let [e, t] of Object.entries(a)) if (typeof t == "string") try {
26
- let i = n(t);
27
- i !== void 0 && (r[e] = i);
28
- } catch {}
29
- } catch {}
30
- return r;
31
- }
32
- function f(e, t, n, r) {
33
- try {
34
- let i = Object.keys(n);
35
- if (i.length === 0) {
36
- e?.removeItem(t);
37
- return;
38
- }
39
- let a = {};
40
- for (let e of i) a[e] = r(n[e]);
41
- e?.setItem(t, JSON.stringify(a));
42
- } catch {}
43
- }
44
- //#endregion
45
- //#region lib/hooks/use-drafts.ts
46
- function p() {
47
- try {
48
- return window.sessionStorage;
49
- } catch {
50
- return;
51
- }
52
- }
53
- var m = (e) => JSON.parse(e);
54
- function h(e) {
55
- try {
56
- return e === void 0 ? p() : typeof e == "function" ? e() : e;
57
- } catch {
58
- return;
59
- }
60
- }
61
- function g(e, t) {
62
- try {
63
- h(t)?.removeItem(e);
64
- } catch {}
65
- }
66
- function _(e, t = {}) {
67
- let { serialize: s = JSON.stringify, parse: c = m, storage: l } = t, [u, p] = o({
68
- key: e,
69
- drafts: {},
70
- loaded: !1
71
- }), g = a(u), _ = u.key === e, y = _ ? u.drafts : v, b = _ && u.loaded;
72
- r(() => {
73
- let t = d(h(l), e, c), n = g.current, r = {
74
- key: e,
75
- drafts: n.key === e ? {
76
- ...t,
77
- ...n.drafts
78
- } : t,
79
- loaded: !0
80
- };
81
- g.current = r, p(r);
82
- }, [e]);
83
- let x = n((t) => {
84
- let n = h(l), r = g.current, i = r.key === e && r.loaded, a = {
85
- key: e,
86
- drafts: t(i ? r.drafts : d(n, e, c)),
87
- loaded: i
88
- };
89
- f(n, e, a.drafts, s), g.current = a, p(a);
90
- }, [e]), S = n((e, t) => x((n) => ({
91
- ...n,
92
- [e]: t
93
- })), [x]), C = n((e) => x((t) => {
94
- let { [e]: n, ...r } = t;
95
- return r;
96
- }), [x]), w = n(() => x(() => ({})), [x]);
97
- return {
98
- get: n((e) => y[e], [y]),
99
- set: S,
100
- drop: C,
101
- clear: w,
102
- keys: i(() => Object.keys(y), [y]),
103
- loaded: b
104
- };
105
- }
106
- var v = {};
107
- //#endregion
108
- //#region lib/hooks/use-formatters.ts
109
- function y(t = {}) {
110
- let n = e(), r = t.locale ?? n?.language ?? "en", { timeZone: a } = t;
111
- return i(() => l({
112
- locale: r,
113
- timeZone: a
114
- }), [r, a]);
115
- }
116
- //#endregion
117
- //#region lib/hooks/use-navigation.ts
118
- function b(e, t) {
119
- let r = s();
120
- return n(() => {
121
- r(e, t);
122
- }, [
123
- r,
124
- e,
125
- t
126
- ]);
127
- }
128
- function x(e) {
129
- let t = s();
130
- return i(() => e.map(({ to: e, options: n }) => () => {
131
- t(e, n);
132
- }), [t, e]);
133
- }
134
- //#endregion
135
- //#region lib/hooks/use-number-formatter.ts
136
- function S() {
137
- let r = e(), i = n((e, n) => t(e, {
138
- ...n,
139
- language: r?.language
140
- }), [r?.language]);
141
- return {
142
- formatCurrency: n((e, t) => i(e, {
143
- ...t,
144
- currency: t?.currency,
145
- style: t?.currency ? "currency" : void 0
146
- }), [i]),
147
- formatNumber: i
148
- };
149
- }
150
- //#endregion
151
- //#region lib/hooks/use-options.ts
152
- function C(e, { filter: t, value: n, label: r, expanded: i }) {
153
- return e.filter((e) => e && (t?.(e) ?? !0)).map((e) => {
154
- let t = typeof n == "function" ? n(e) : e[n]?.toString() ?? "", a = "";
155
- return a = typeof r == "function" ? r(e) : Array.isArray(r) ? r.map((t) => e[t]).filter(Boolean).join(" ") : e[r]?.toString() ?? "", {
156
- value: t,
157
- label: a,
158
- ...i ? e : {}
159
- };
160
- });
161
- }
162
- function w(e, t) {
163
- let { filter: n, value: r, label: a, expanded: o } = t;
164
- return i(() => C(e, {
165
- filter: n,
166
- value: r,
167
- label: a,
168
- expanded: o
169
- }), [
170
- e,
171
- n,
172
- r,
173
- a,
174
- o
175
- ]);
176
- }
177
- function T(e) {
178
- return e?.edges?.map((e) => e.node) ?? [];
179
- }
180
- //#endregion
181
- //#region lib/hooks/use-search-param.ts
182
- function E(e) {
183
- let [t, n] = c();
184
- return i(() => t.get(e), [t, e]);
185
- }
186
- //#endregion
187
- export { S as a, y as c, u as d, w as i, g as l, C as n, b as o, T as r, x as s, E as t, _ as u };