@nxgt/material 3.60.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 (114) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +3 -2
  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 +54 -37
  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-BSM-h5IQ.js → components-Cm2doOJS.js} +13090 -12957
  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 +8 -102
  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/illustrations-game.js +2 -0
  29. package/dist/lib/components/ui/display/list-tile/list-tile.d.ts +6 -0
  30. package/dist/lib/components/ui/display/list-tile/partials/list-tile-classes.d.ts +3 -1
  31. package/dist/lib/components/ui/display/list-tile/partials/list-tile-line.d.ts +1 -1
  32. package/dist/lib/components/ui/display/list-tile/partials/list-tile-toggle.d.ts +1 -1
  33. package/dist/lib/components/ui/feedback/index.d.ts +1 -0
  34. package/dist/lib/components/ui/feedback/unsaved-dialog/index.d.ts +1 -0
  35. package/dist/lib/components/ui/feedback/unsaved-dialog/unsaved-dialog.d.ts +20 -0
  36. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  37. package/dist/lib/components/ui/fields/textarea-field/textarea-footer.d.ts +2 -1
  38. package/dist/lib/components/ui/layout/app-shell/activity-layout.types.d.ts +6 -3
  39. package/dist/lib/components/ui/layout/app-shell/index.d.ts +1 -1
  40. package/dist/lib/components/ui/layout/app-shell/route-transition.d.ts +20 -2
  41. package/dist/lib/components/ui/layout/app-shell/shapes-clear-content.d.ts +2 -1
  42. package/dist/lib/components/ui/widgets/code-editor/configure-monaco.d.ts +2 -0
  43. package/dist/lib/components/ui/widgets/education/questions/index.d.ts +3 -1
  44. package/dist/lib/components/ui/widgets/education/questions/partials/question-content.d.ts +1 -1
  45. package/dist/lib/components/ui/widgets/education/questions/partials/question-top.d.ts +6 -0
  46. package/dist/lib/components/ui/widgets/education/questions/question-long-text.d.ts +5 -0
  47. package/dist/lib/components/ui/widgets/education/questions/question-media-content.d.ts +24 -0
  48. package/dist/lib/components/ui/widgets/education/questions/question-media-helpers.d.ts +11 -0
  49. package/dist/lib/components/ui/widgets/education/questions/question-media-view.d.ts +18 -0
  50. package/dist/lib/components/ui/widgets/education/questions/question-media-view.types.d.ts +32 -0
  51. package/dist/lib/components/ui/widgets/education/questions/question-options.d.ts +2 -2
  52. package/dist/lib/components/ui/widgets/education/questions/question-text.d.ts +1 -1
  53. package/dist/lib/components/ui/widgets/education/questions/question.d.ts +1 -1
  54. package/dist/lib/components/ui/widgets/education/questions/types.d.ts +38 -1
  55. package/dist/lib/components/ui/widgets/education/questions/use-reload-focus.d.ts +13 -0
  56. package/dist/lib/hooks/drafts-store.d.ts +4 -0
  57. package/dist/lib/hooks/index.d.ts +4 -0
  58. package/dist/lib/hooks/unsaved-guard-rules.d.ts +30 -0
  59. package/dist/lib/hooks/use-drafts.d.ts +75 -0
  60. package/dist/lib/hooks/use-react-router-block.d.ts +11 -0
  61. package/dist/lib/hooks/use-unsaved-guard/guard-core.d.ts +30 -0
  62. package/dist/lib/hooks/use-unsaved-guard/index.d.ts +3 -0
  63. package/dist/lib/hooks/use-unsaved-guard/types.d.ts +63 -0
  64. package/dist/lib/hooks/use-unsaved-guard/use-discard-guard.d.ts +15 -0
  65. package/dist/lib/hooks/use-unsaved-guard/use-unsaved-guard.d.ts +19 -0
  66. package/dist/lib/i18n/resources/en/en.d.ts +20 -0
  67. package/dist/lib/i18n/resources/en/material.json.d.ts +21 -1
  68. package/dist/lib/i18n/resources/fr/fr.d.ts +20 -0
  69. package/dist/lib/i18n/resources/fr/material.json.d.ts +21 -1
  70. package/dist/lib/i18n/resources/resources.d.ts +40 -0
  71. package/dist/lib/i18n/translator.d.ts +1 -1
  72. package/dist/lib/illustrations-game/index.d.ts +17 -0
  73. package/dist/lib.js +1 -1
  74. package/dist/main.js +42 -43
  75. package/dist/map.js +63 -63
  76. package/dist/material.css +1 -1
  77. package/dist/pdf-reader.js +1 -1
  78. package/dist/print.js +1 -2
  79. package/dist/{public-BYsrhyPW.js → public-D8JGp3PH.js} +823 -822
  80. package/dist/{rich-code-block-WJxDWPPY.js → rich-code-block-0R3bidsM.js} +5 -5
  81. package/dist/{sortable-provider-oPjlhlZo.js → sortable-provider-B75v53sB.js} +2 -2
  82. package/dist/{spinner-C5lObWXT.js → spinner-CAnpF3RK.js} +1 -1
  83. package/dist/theme-picker.js +2 -2
  84. package/dist/{theme-toggle-CPEq5JG-.js → theme-toggle-pQ5F602V.js} +1 -1
  85. package/dist/{toolbar-items-ByvXcMHm.js → toolbar-items-_ezD5B0r.js} +4 -4
  86. package/dist/translate-material-CvZK8_S6.js +96 -0
  87. package/dist/{stored-language-B-tiWZU2.js → translator-Caf-d96e.js} +2497 -8
  88. package/dist/{escape-owner-r57kuPjn.js → typography-CEK19bj8.js} +17 -34
  89. package/dist/{use-chat-composer-CzOVaIed.js → use-chat-composer-Dpvi_-CR.js} +5164 -5338
  90. package/dist/{use-heading-spy-BOtygPFu.js → use-heading-spy-mmcyEGmm.js} +186 -71
  91. package/dist/{use-material-translation-B5j3jZs7.js → use-material-translation-C_1cWRzW.js} +1 -2
  92. package/dist/use-return-focus-1ZIchrBM.js +269 -0
  93. package/docs/components/data-display.md +1 -0
  94. package/docs/components/feedback-and-status.md +23 -0
  95. package/docs/components/navigation-and-layout.md +5 -4
  96. package/docs/components/rich-widgets.md +73 -1
  97. package/docs/guides/app-shell.md +17 -0
  98. package/docs/guides/code-editor.md +8 -0
  99. package/docs/guides/csp.md +4 -0
  100. package/docs/guides/helpers.md +120 -0
  101. package/docs/guides/icon-motifs.md +3 -1
  102. package/docs/guides/illustrations.md +33 -1
  103. package/docs/guides/migrating-to-3.md +4 -2
  104. package/docs/guides/theming.md +13 -3
  105. package/docs/previews/feedback-status-illustration-game.webp +0 -0
  106. package/docs/previews/feedback-status-unsaveddialog.webp +0 -0
  107. package/docs/roadmap.md +1 -1
  108. package/docs/troubleshooting.md +9 -6
  109. package/lib/components/ui/layout/sidebar/sidebar-tokens.css +13 -1
  110. package/package.json +7 -2
  111. package/dist/dialog-yfPkLqUQ.js +0 -482
  112. package/dist/i18n-provider-BehR6cU7.js +0 -79
  113. package/dist/translate-material-tUaLZUmT.js +0 -20
  114. 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,79 +0,0 @@
1
- import { i as e, r as t, t as n } from "./stored-language-B-tiWZU2.js";
2
- import { createContext as r, useCallback as i, useContext as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
3
- import { jsx as u } from "react/jsx-runtime";
4
- //#region lib/i18n/material-resources-registry.ts
5
- var d = [], f = /* @__PURE__ */ new WeakMap();
6
- function p(e, t) {
7
- let n = {
8
- resources: e,
9
- language: t
10
- };
11
- d.push(n);
12
- let r = () => {
13
- let e = d.lastIndexOf(n);
14
- e !== -1 && d.splice(e, 1);
15
- };
16
- return f.set(r, n), r;
17
- }
18
- function m(e, t, n) {
19
- let r = f.get(e);
20
- r && (r.resources = t, r.language = n);
21
- }
22
- function h() {
23
- return d[d.length - 1];
24
- }
25
- //#endregion
26
- //#region lib/i18n/i18n-provider.tsx
27
- var g = r(null);
28
- function _({ children: r, defaultLanguage: a = "en", storageKey: d = t, supportedLanguages: f = e, onLanguageChange: h, initialLanguage: _, resources: v }) {
29
- let [y, b] = l(() => _ && f.includes(_) ? _ : n(d, a, f)), x = i((e) => {
30
- if (!f.includes(e)) {
31
- console.warn(`[@nxgt/material] Unsupported language: "${e}".`);
32
- return;
33
- }
34
- if (typeof localStorage < "u") try {
35
- localStorage.setItem(d, e);
36
- } catch {}
37
- b(e), h?.(e);
38
- }, [
39
- d,
40
- f,
41
- h
42
- ]), S = c(null), C = c({
43
- resources: v,
44
- language: y
45
- });
46
- C.current = {
47
- resources: v,
48
- language: y
49
- }, o(() => (S.current = p(C.current.resources, C.current.language), () => {
50
- S.current?.(), S.current = null;
51
- }), []), o(() => {
52
- S.current && m(S.current, v, y);
53
- }, [v, y]);
54
- let w = s(() => ({
55
- language: y,
56
- changeLanguage: x,
57
- supportedLanguages: f,
58
- resources: v
59
- }), [
60
- y,
61
- x,
62
- f,
63
- v
64
- ]);
65
- return /* @__PURE__ */ u(g.Provider, {
66
- value: w,
67
- children: r
68
- });
69
- }
70
- function v() {
71
- let e = a(g);
72
- if (!e) throw Error("useI18nContext must be used within an I18nProvider");
73
- return e;
74
- }
75
- function y() {
76
- return a(g);
77
- }
78
- //#endregion
79
- export { h as i, v as n, y as r, _ as t };
@@ -1,20 +0,0 @@
1
- import "./stored-language-B-tiWZU2.js";
2
- import { a as e, r as t, t as n } from "./translator-B9XjUDRu.js";
3
- //#region lib/i18n/translate-material.ts
4
- var r = /* @__PURE__ */ new WeakMap();
5
- function i(e) {
6
- let t = r.get(e);
7
- return t || (t = n(e), r.set(e, t)), t;
8
- }
9
- function a(n, r, a, o, s) {
10
- if (n) {
11
- let e = s ? [i(s), t] : [t];
12
- for (let t of /* @__PURE__ */ new Set([n, n.split("-")[0]])) for (let n of e) {
13
- let e = n(r, o, () => t);
14
- if (e !== r) return e;
15
- }
16
- }
17
- return e(a, n || "en", o);
18
- }
19
- //#endregion
20
- export { a as t };