@nxgt/material 3.62.0 → 3.64.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 (103) hide show
  1. package/CHANGELOG.md +33 -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-2kTVPsMg.js} +15801 -15541
  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/actions/load-more-footer/load-more-footer.d.ts +11 -2
  29. package/dist/lib/components/ui/actions/load-more-footer/use-footer-focus.d.ts +15 -0
  30. package/dist/lib/components/ui/actions/load-more-footer/use-last-page.d.ts +9 -0
  31. package/dist/lib/components/ui/collections/filter/bar/partials/filter-inline-chips.d.ts +11 -0
  32. package/dist/lib/components/ui/collections/filter/bar/partials/filter-inline-list.d.ts +6 -0
  33. package/dist/lib/components/ui/collections/server-table/partials/server-table-grid-paging.d.ts +9 -0
  34. package/dist/lib/components/ui/collections/server-table/partials/server-table-load-more.d.ts +17 -0
  35. package/dist/lib/components/ui/collections/server-table/types-paging.d.ts +10 -0
  36. package/dist/lib/components/ui/feedback/index.d.ts +1 -0
  37. package/dist/lib/components/ui/feedback/unsaved-dialog/index.d.ts +1 -0
  38. package/dist/lib/components/ui/feedback/unsaved-dialog/unsaved-dialog.d.ts +20 -0
  39. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  40. package/dist/lib/components/ui/fields/textarea-field/textarea-footer.d.ts +2 -1
  41. package/dist/lib/components/ui/widgets/education/questions/index.d.ts +3 -1
  42. package/dist/lib/components/ui/widgets/education/questions/partials/question-content.d.ts +1 -1
  43. package/dist/lib/components/ui/widgets/education/questions/partials/question-top.d.ts +6 -0
  44. package/dist/lib/components/ui/widgets/education/questions/question-long-text.d.ts +5 -0
  45. package/dist/lib/components/ui/widgets/education/questions/question-media-content.d.ts +24 -0
  46. package/dist/lib/components/ui/widgets/education/questions/question-media-helpers.d.ts +11 -0
  47. package/dist/lib/components/ui/widgets/education/questions/question-media-view.d.ts +18 -0
  48. package/dist/lib/components/ui/widgets/education/questions/question-media-view.types.d.ts +32 -0
  49. package/dist/lib/components/ui/widgets/education/questions/question-options.d.ts +2 -2
  50. package/dist/lib/components/ui/widgets/education/questions/question-text.d.ts +1 -1
  51. package/dist/lib/components/ui/widgets/education/questions/question.d.ts +1 -1
  52. package/dist/lib/components/ui/widgets/education/questions/types.d.ts +52 -1
  53. package/dist/lib/components/ui/widgets/education/questions/use-reload-focus.d.ts +13 -0
  54. package/dist/lib/hooks/index.d.ts +3 -0
  55. package/dist/lib/hooks/unsaved-guard-rules.d.ts +30 -0
  56. package/dist/lib/hooks/use-react-router-block.d.ts +11 -0
  57. package/dist/lib/hooks/use-unsaved-guard/guard-core.d.ts +30 -0
  58. package/dist/lib/hooks/use-unsaved-guard/index.d.ts +3 -0
  59. package/dist/lib/hooks/use-unsaved-guard/types.d.ts +63 -0
  60. package/dist/lib/hooks/use-unsaved-guard/use-discard-guard.d.ts +15 -0
  61. package/dist/lib/hooks/use-unsaved-guard/use-unsaved-guard.d.ts +19 -0
  62. package/dist/lib/i18n/resources/en/en.d.ts +20 -0
  63. package/dist/lib/i18n/resources/en/material.json.d.ts +21 -1
  64. package/dist/lib/i18n/resources/fr/fr.d.ts +20 -0
  65. package/dist/lib/i18n/resources/fr/material.json.d.ts +21 -1
  66. package/dist/lib/i18n/resources/resources.d.ts +40 -0
  67. package/dist/lib/i18n/translator.d.ts +1 -1
  68. package/dist/lib.js +1 -1
  69. package/dist/main.js +42 -43
  70. package/dist/map.js +63 -63
  71. package/dist/material.css +1 -1
  72. package/dist/pdf-reader.js +1 -1
  73. package/dist/print.js +1 -2
  74. package/dist/{public-BYsrhyPW.js → public-D8JGp3PH.js} +823 -822
  75. package/dist/{rich-code-block-WJxDWPPY.js → rich-code-block-0R3bidsM.js} +5 -5
  76. package/dist/{sortable-provider-oPjlhlZo.js → sortable-provider-B75v53sB.js} +2 -2
  77. package/dist/{spinner-C5lObWXT.js → spinner-CAnpF3RK.js} +1 -1
  78. package/dist/theme-picker.js +2 -2
  79. package/dist/{theme-toggle-CPEq5JG-.js → theme-toggle-pQ5F602V.js} +1 -1
  80. package/dist/{toolbar-items-ByvXcMHm.js → toolbar-items-_ezD5B0r.js} +4 -4
  81. package/dist/translate-material-CvZK8_S6.js +96 -0
  82. package/dist/{stored-language-B-tiWZU2.js → translator-Caf-d96e.js} +2497 -8
  83. package/dist/{escape-owner-r57kuPjn.js → typography-CEK19bj8.js} +17 -34
  84. package/dist/{use-chat-composer-CzOVaIed.js → use-chat-composer-Dpvi_-CR.js} +5164 -5338
  85. package/dist/{use-heading-spy-BOtygPFu.js → use-heading-spy-mmcyEGmm.js} +186 -71
  86. package/dist/{use-material-translation-B5j3jZs7.js → use-material-translation-C_1cWRzW.js} +1 -2
  87. package/dist/use-return-focus-1ZIchrBM.js +269 -0
  88. package/docs/components/buttons-and-actions.md +2 -2
  89. package/docs/components/data-table-filter-and-lists.md +96 -0
  90. package/docs/components/feedback-and-status.md +23 -0
  91. package/docs/components/navigation-and-layout.md +4 -3
  92. package/docs/components/rich-widgets.md +75 -1
  93. package/docs/guides/helpers.md +63 -0
  94. package/docs/guides/theming.md +13 -3
  95. package/docs/previews/feedback-status-unsaveddialog.webp +0 -0
  96. package/docs/roadmap.md +4 -0
  97. package/lib/components/ui/layout/sidebar/sidebar-tokens.css +13 -1
  98. package/package.json +2 -2
  99. package/dist/dialog-yfPkLqUQ.js +0 -482
  100. package/dist/hooks-CGnqFngB.js +0 -187
  101. package/dist/i18n-provider-BehR6cU7.js +0 -79
  102. package/dist/translate-material-tUaLZUmT.js +0 -20
  103. package/dist/translator-B9XjUDRu.js +0 -2451
@@ -620,15 +620,16 @@ descendant of it: an element that reads `--nxgt-tone-container` needs its own
620
620
  ## The active entry of the sidebar and the rail
621
621
 
622
622
  The selected `SidebarMenuItem` (and so the `AppSidebar` and `ActivityLayout`
623
- rail and menu sheet) is drawn with three tokens, in light and in dark:
623
+ rail and menu sheet) is drawn with four tokens, in light and in dark:
624
624
 
625
625
  | Token | Tailwind | Default, light | Default, dark |
626
626
  | --- | --- | --- | --- |
627
627
  | `--sidebar-active` | `bg-sidebar-active` | primary at 15 % | primary at 30 % |
628
628
  | `--sidebar-active-hover` | `bg-sidebar-active-hover` | primary at 20 % | primary at 35 % |
629
629
  | `--sidebar-active-foreground` | `text-sidebar-active-foreground` | `oklch(from var(--primary) calc(l * 0.85) c h)`, 4.5:1 or more on the pill for every theme preset | `oklch(from var(--primary) 0.72 0.15 h)`, 6.3:1 or more on the pill |
630
+ | `--sidebar-active-edge` | `bg-sidebar-active-edge` | the value of `--sidebar-active-foreground` | the value of `--sidebar-active-foreground` |
630
631
 
631
- The pill is the icon's (collapsed rail) or the whole row (expanded), a pill in the collapsed rail and, in the expanded row, an `--nxgt-item-radius` (6px) shape that carries the 3px start bar every chosen row has, drawn in `--sidebar-active-foreground` (a `Highlight` bar in forced colours); the
632
+ The pill is the icon's (collapsed rail) or the whole row (expanded), a pill in the collapsed rail and, in the expanded row, an `--nxgt-item-radius` (6px) shape that carries the 3px start bar every chosen row has, drawn in `--sidebar-active-edge` (a `Highlight` bar in forced colours); the
632
633
  foreground is the label and the icon, whose duotone layers both follow it (in
633
634
  dark too: the icon of `AppSidebar` is the lifted lavender like its label). The
634
635
  label is read on the pill (expanded) or on the sidebar (collapsed rail); the
@@ -639,9 +640,18 @@ itself in light and dark, as both the light darkening and the dark lift need
639
640
 
640
641
  The defaults are derived where the entry is drawn, from the `--primary` it
641
642
  sits under, so a `--primary` set on a wrapper recolours the rail inside it.
642
- The three tokens are not declared on `:root`: setting one replaces its
643
+ The four tokens are not declared on `:root`: setting one replaces its
643
644
  default wherever it is set.
644
645
 
646
+ `--sidebar-active-edge` recolours the start bar alone; unset, the bar follows
647
+ the foreground:
648
+
649
+ ```css
650
+ :root {
651
+ --sidebar-active-edge: oklch(0.8 0.15 90);
652
+ }
653
+ ```
654
+
645
655
  Set them after importing the stylesheet, under the same selectors as the
646
656
  theme, for example a rail in the `maths` colour:
647
657
 
package/docs/roadmap.md CHANGED
@@ -241,6 +241,10 @@ version they shipped in, and planned entries may name the major they target.
241
241
  slot; the bar's `views` slot is planned with it. They are meant to replace
242
242
  the legacy `FilterPresets`. Tracked in [#1876](https://github.com/softistx/nxgt-material/issues/1876).
243
243
 
244
+ - **Link navigation** — `TabsNav` and `SegmentedNav` render route tabs and segmented navigation as a `nav` of links with `aria-current="page"`, looking like Tabs and the segmented ToggleGroup, plus `useTabParam` to keep the current tab in the URL.
245
+ - **RecordActionsMenu** — one menu for a record's lifecycle: archive with an Undo toast (or confirm first with `archivePolicy="confirm"`), restore, and delete that always confirms and shows the backend's refusal, with `ConfirmDialog` gaining `details` and `refusal` slots.
246
+ - **Cursor trail cap** — `ServerTable` and `PageFooter` keep cursor URLs short: the trail is encoded once and capped by `maxTrail` (20 by default) with an exact page count, and `totalCount` becomes optional for APIs that do not count.
247
+
244
248
  ## Later
245
249
 
246
250
  - **A strict theme `motif` (4.0)** — a theme background's `motif` with an
@@ -8,7 +8,9 @@
8
8
  * follow a `--primary` set below :root. To theme the rail set
9
9
  * `--sidebar-active`, `--sidebar-active-hover` and
10
10
  * `--sidebar-active-foreground` (all three, or the first two and the
11
- * foreground); the derived colours are not declared here, on purpose. */
11
+ * foreground); the derived colours are not declared here, on purpose.
12
+ * `--sidebar-active-edge` recolours the start bar alone; unset, the bar is
13
+ * the foreground (`--sidebar-active-edge: gold` changes nothing else). */
12
14
  --nxgt-sidebar-active-share: 15%;
13
15
  /* Light: primary itself reads 4.5:1 on the page but not on its own 15 % pill
14
16
  * for every preset (corail 3.7:1), so the label is primary darkened to 85 %
@@ -71,4 +73,14 @@
71
73
  var(--nxgt-sidebar-active-c, c) h
72
74
  )
73
75
  );
76
+ --color-sidebar-active-edge: var(
77
+ --sidebar-active-edge,
78
+ var(
79
+ --sidebar-active-foreground,
80
+ oklch(
81
+ from var(--primary) var(--nxgt-sidebar-active-l, l)
82
+ var(--nxgt-sidebar-active-c, c) h
83
+ )
84
+ )
85
+ );
74
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/material",
3
- "version": "3.62.0",
3
+ "version": "3.64.0",
4
4
  "license": "MIT",
5
5
  "bugs": {
6
6
  "email": "stevegires@gmail.com"
@@ -372,7 +372,7 @@
372
372
  "docs:previews": "rm -rf node_modules/.cache/nxgt-preview-free/missing && NXGT_PREVIEW_FREE=1 vitest run --project previews && bun .storybook/preview-free-report.ts"
373
373
  },
374
374
  "dependencies": {
375
- "@nxgt/material-core": "^0.44.0",
375
+ "@nxgt/material-core": "^0.45.0",
376
376
  "@base-ui/react": "^1.6.0",
377
377
  "@dnd-kit/core": "^6.3.1",
378
378
  "@dnd-kit/sortable": "^10.0.0",
@@ -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 };