@mt-gloss/ui 0.1.138 → 0.2.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 (108) hide show
  1. package/{BaseAsyncButton-CJlY7Uik.js → BaseAsyncButton-Cq_l7clO.js} +29 -30
  2. package/COMMITS-Dm8qIHaq.js +444 -0
  3. package/Expandable-BcmIxWR8.js +13807 -0
  4. package/UIContext-DP6JGCto.js +1731 -0
  5. package/catalog.js +120 -122
  6. package/composites-panels.js +578 -1442
  7. package/index.d.ts +4 -2
  8. package/index.js +2368 -2029
  9. package/internals.js +80 -81
  10. package/lib/base/BaseAccordion/BaseAccordion.d.ts +4 -24
  11. package/lib/base/BaseCard/BaseCard.d.ts +8 -48
  12. package/lib/base/BaseCheckbox/BaseCheckbox.d.ts +1 -6
  13. package/lib/base/BaseInput/BaseInput.d.ts +1 -6
  14. package/lib/base/BaseMaskedInput/BaseMaskedInput.d.ts +1 -6
  15. package/lib/base/BaseMenu/BaseMenu.d.ts +2 -12
  16. package/lib/base/BaseRadio/BaseRadio.d.ts +1 -6
  17. package/lib/base/BaseRating/BaseRating.d.ts +1 -6
  18. package/lib/base/BaseSegmentedControl/BaseSegmentedControl.d.ts +1 -6
  19. package/lib/base/BaseSelect/BaseSelect.d.ts +2 -12
  20. package/lib/base/BaseTextarea/BaseTextarea.d.ts +1 -6
  21. package/lib/base/BaseToggle/BaseToggle.d.ts +1 -6
  22. package/lib/base/BaseTooltip/BaseTooltip.d.ts +1 -6
  23. package/lib/composites/dashboard/BellPopover/BellPopover.d.ts +0 -12
  24. package/lib/composites/forms/PasswordInput.d.ts +1 -6
  25. package/lib/composites/forms/PhoneInput.d.ts +1 -6
  26. package/lib/composites/forms/SearchInput.d.ts +1 -6
  27. package/lib/composites/forms/TagInput.d.ts +1 -6
  28. package/lib/composites/inputs/FilterChip.d.ts +1 -6
  29. package/lib/composites/overlay/SplitButton/SplitButton.d.ts +1 -6
  30. package/lib/composites/panels/PanelChrome.d.ts +1 -23
  31. package/lib/composites/panels/PanelSlot.d.ts +3 -14
  32. package/lib/composites/panels/coordinator/types.d.ts +1 -12
  33. package/lib/composites/panels/index.d.ts +4 -5
  34. package/lib/composites/panels/shells/CatalogAddShell.d.ts +8 -21
  35. package/lib/composites/panels/shells/CatalogReplaceShell.d.ts +4 -9
  36. package/lib/composites/panels/shells/PageMgmtShell.d.ts +3 -28
  37. package/lib/composites/panels/shells/SettingsShell.d.ts +3 -55
  38. package/lib/composites/panels/shells/index.d.ts +2 -2
  39. package/lib/composites/panels/shells/internals/CatalogLensPicker.d.ts +1 -14
  40. package/lib/composites/panels/shells/internals/CatalogTileGrid.d.ts +1 -18
  41. package/lib/composites/panels/shells/internals/PageMgmtFooter.d.ts +0 -11
  42. package/lib/composites/panels/shells/internals/PageMgmtRow.d.ts +1 -6
  43. package/lib/composites/panels/shells/internals/catalog-mocks.d.ts +8 -145
  44. package/lib/composites/panels/stage3d/CloneStage.d.ts +1 -11
  45. package/lib/containers/ContainerDialog/ContainerDialog.d.ts +3 -18
  46. package/lib/containers/ContainerFormSection/ContainerFormSection.d.ts +1 -6
  47. package/lib/containers/ContainerPanel/ContainerPanel.d.ts +1 -6
  48. package/lib/containers/ContainerTable/ContainerTable.d.ts +1 -6
  49. package/lib/containers/ContainerToolbar/ContainerToolbar.d.ts +1 -6
  50. package/lib/facade/index.d.ts +2 -0
  51. package/lib/presets/PresetAccordion/PresetAccordion.d.ts +4 -24
  52. package/lib/presets/PresetBadge/PresetBadge.d.ts +1 -6
  53. package/lib/presets/PresetCard/PresetCard.d.ts +8 -48
  54. package/lib/presets/PresetCheckbox/PresetCheckbox.d.ts +1 -6
  55. package/lib/presets/PresetChip/PresetChip.d.ts +1 -6
  56. package/lib/presets/PresetColorPicker/PresetColorPicker.d.ts +1 -6
  57. package/lib/presets/PresetDatePicker/PresetDatePicker.d.ts +1 -6
  58. package/lib/presets/PresetDateRangePicker/PresetDateRangePicker.d.ts +1 -6
  59. package/lib/presets/PresetFileUpload/PresetFileUpload.d.ts +1 -6
  60. package/lib/presets/PresetInput/PresetInput.d.ts +1 -6
  61. package/lib/presets/PresetLink/PresetLink.d.ts +1 -6
  62. package/lib/presets/PresetMaskedInput/PresetMaskedInput.d.ts +1 -6
  63. package/lib/presets/PresetMenu/PresetMenu.d.ts +2 -13
  64. package/lib/presets/PresetNumberInput/PresetNumberInput.d.ts +1 -6
  65. package/lib/presets/PresetRadio/PresetRadio.d.ts +1 -6
  66. package/lib/presets/PresetRangeSlider/PresetRangeSlider.d.ts +1 -6
  67. package/lib/presets/PresetRating/PresetRating.d.ts +1 -6
  68. package/lib/presets/PresetTextarea/PresetTextarea.d.ts +1 -6
  69. package/lib/presets/PresetTimePicker/PresetTimePicker.d.ts +1 -6
  70. package/lib/presets/PresetToggle/PresetToggle.d.ts +1 -6
  71. package/lib/primitives/dashboard/ResizePill/ResizePill.d.ts +1 -7
  72. package/lib/primitives/dashboard/index.d.ts +0 -1
  73. package/lib/wrappers/Actionable/Actionable.d.ts +1 -6
  74. package/lib/wrappers/AsyncLoader/AsyncLoader.d.ts +1 -6
  75. package/lib/wrappers/ButtonGroup/ButtonGroup.d.ts +1 -6
  76. package/lib/wrappers/CheckboxGroup/CheckboxGroup.d.ts +1 -6
  77. package/lib/wrappers/Dismissible/Dismissible.d.ts +1 -6
  78. package/lib/wrappers/Expandable/Expandable.d.ts +1 -6
  79. package/lib/wrappers/InputGroup/InputGroup.d.ts +2 -12
  80. package/lib/wrappers/RadioGroup/RadioGroup.d.ts +1 -6
  81. package/lib/wrappers/Selectable/Selectable.d.ts +1 -6
  82. package/lib/wrappers/Sortable/Sortable.d.ts +1 -6
  83. package/package.json +1 -1
  84. package/ui.css +1 -1
  85. package/BaseText-Dxbk1JJa.js +0 -66
  86. package/COMMITS-aGwevMtR.js +0 -975
  87. package/Expandable-G7SCUlMb.js +0 -13245
  88. package/MetricCard-DOPtBpek.js +0 -698
  89. package/UIContext-CGQI_KJk.js +0 -1808
  90. package/lib/composites/panels/chrome-v2/PanelBody.d.ts +0 -5
  91. package/lib/composites/panels/chrome-v2/PanelChromeV2.d.ts +0 -18
  92. package/lib/composites/panels/chrome-v2/PanelFooter.d.ts +0 -6
  93. package/lib/composites/panels/chrome-v2/PanelFooterMessage.d.ts +0 -6
  94. package/lib/composites/panels/chrome-v2/PanelHeader.d.ts +0 -10
  95. package/lib/composites/panels/chrome-v2/PanelNavigation.d.ts +0 -5
  96. package/lib/composites/panels/chrome-v2/PanelStage.d.ts +0 -5
  97. package/lib/composites/panels/chrome-v2/index.d.ts +0 -23
  98. package/lib/composites/panels/coordinator/settingsBufferSchemas.d.ts +0 -18
  99. package/lib/composites/panels/hooks/useEditingCardId.d.ts +0 -16
  100. package/lib/composites/panels/shells/NotificationCenterShell.d.ts +0 -2
  101. package/lib/composites/panels/shells/settings/ColorControls.d.ts +0 -13
  102. package/lib/composites/panels/shells/settings/SlotsControls.d.ts +0 -6
  103. package/lib/composites/panels/shells/settings/ThresholdControls.d.ts +0 -10
  104. package/lib/composites/panels/shells/settings/TimeframeControls.d.ts +0 -6
  105. package/lib/composites/panels/shells/settings/index.d.ts +0 -12
  106. package/lib/primitives/dashboard/SettingsTabStrip/SettingsTabStrip.d.ts +0 -17
  107. package/lib/primitives/dashboard/SettingsTabStrip/index.d.ts +0 -6
  108. package/lib/primitives/dashboard/SettingsTabStrip/types.d.ts +0 -12
@@ -1,975 +0,0 @@
1
- import { jsx as i, jsxs as N } from "react/jsx-runtime";
2
- import { motion as ie } from "framer-motion";
3
- import Z, { useSyncExternalStore as le, useState as A, useRef as O, useMemo as z, useEffect as w, useCallback as T, createContext as ae, useContext as W, useReducer as ce, useId as X, useLayoutEffect as G } from "react";
4
- import { z as L } from "zod";
5
- const Je = {
6
- forwardStaggerMs: 50,
7
- reverseStaggerMs: 30,
8
- springStiffness: 380,
9
- springDamping: 32,
10
- reverseVelocityMultiplier: 1.4
11
- }, en = {
12
- enterDurationMs: 220,
13
- exitDurationMs: 140,
14
- enterEasing: "cubic-bezier(0.34, 1.56, 0.64, 1)",
15
- exitEasing: "cubic-bezier(0.4, 0, 1, 1)",
16
- translateOffsetPx: 8
17
- }, nn = {
18
- shiverCycles: 3,
19
- shiverAmplitudePx: 2,
20
- shiverDurationMs: 180,
21
- validCellOpacity: 0.6
22
- }, tn = {
23
- materializeMs: 180,
24
- dematerializeMs: 140,
25
- easing: "cubic-bezier(0.22, 1, 0.36, 1)",
26
- dotStrokePx: 2,
27
- dividerDashGapPx: 4
28
- }, rn = {
29
- cascadeStaggerMs: 0,
30
- cascadeSpringCapMs: 120,
31
- swingEnterMs: 100,
32
- swingEnterStyle: "opacity",
33
- provisionalMs: 80,
34
- provisionalStyle: "opacity",
35
- shiverMs: 200,
36
- shiverStyle: "color-flash"
37
- }, on = !0, sn = {
38
- rejectionFill: "var(--gloss-rejection-fill)",
39
- rejectionStroke: "var(--gloss-rejection-stroke)",
40
- validFill: "var(--gloss-valid-fill)",
41
- validStroke: "var(--gloss-valid-stroke)",
42
- validCellStroke: "var(--gloss-valid-cell-stroke)",
43
- provisionalWash: "var(--gloss-provisional-wash)"
44
- };
45
- function ln() {
46
- if (typeof window > "u") return "full";
47
- try {
48
- return window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "reduced" : "full";
49
- } catch {
50
- return "full";
51
- }
52
- }
53
- const de = "(prefers-reduced-motion: reduce)";
54
- function J() {
55
- return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia(de);
56
- }
57
- function ue(e) {
58
- const n = J();
59
- return n ? (n.addEventListener("change", e), () => {
60
- n.removeEventListener("change", e);
61
- }) : () => {
62
- };
63
- }
64
- function fe() {
65
- const e = J();
66
- return e ? e.matches : !1;
67
- }
68
- function pe() {
69
- return !1;
70
- }
71
- function ee() {
72
- return le(ue, fe, pe);
73
- }
74
- const me = {
75
- threshold: "Threshold",
76
- timeframe: "Timeframe",
77
- slots: "Slots",
78
- color: "Color"
79
- };
80
- function ge({
81
- dimensions: e,
82
- activeTab: n,
83
- onSelect: t,
84
- reduced: r,
85
- labels: s,
86
- ariaLabel: a = "Settings dimensions"
87
- }) {
88
- const c = ee(), o = r ?? c;
89
- if (e.length < 2) return null;
90
- const p = (d) => s?.[d] ?? me[d], u = (d, m) => {
91
- d.key === "ArrowRight" ? (d.preventDefault(), t(e[(m + 1) % e.length])) : d.key === "ArrowLeft" ? (d.preventDefault(), t(e[(m - 1 + e.length) % e.length])) : d.key === "Home" ? (d.preventDefault(), t(e[0])) : d.key === "End" && (d.preventDefault(), t(e[e.length - 1]));
92
- };
93
- return /* @__PURE__ */ i(
94
- "div",
95
- {
96
- role: "tablist",
97
- "aria-label": a,
98
- className: "settings-tab-strip",
99
- children: e.map((d, m) => {
100
- const _ = n === d;
101
- return /* @__PURE__ */ N(
102
- "button",
103
- {
104
- role: "tab",
105
- type: "button",
106
- id: `settings-tab-${d}`,
107
- "aria-selected": _,
108
- "aria-controls": `settings-tabpanel-${d}`,
109
- tabIndex: _ ? 0 : -1,
110
- className: `settings-tab-strip__tab${_ ? " settings-tab-strip__tab--active" : ""}`,
111
- onClick: () => t(d),
112
- onKeyDown: (k) => u(k, m),
113
- children: [
114
- /* @__PURE__ */ i("span", { className: "settings-tab-strip__label", children: p(d) }),
115
- _ && !o && /* @__PURE__ */ i(
116
- ie.span,
117
- {
118
- layoutId: "settings-active-tab-indicator",
119
- "data-layout-id": "settings-active-tab-indicator",
120
- className: "settings-tab-strip__indicator",
121
- "aria-hidden": "true",
122
- transition: { type: "spring", stiffness: 380, damping: 30 }
123
- }
124
- )
125
- ]
126
- },
127
- d
128
- );
129
- })
130
- }
131
- );
132
- }
133
- ge.displayName = "SettingsTabStrip";
134
- function U(e, n) {
135
- for (const t of e)
136
- if (t.items.some((r) => r.id === n))
137
- return t.zoneKey;
138
- return null;
139
- }
140
- function Q(e, n) {
141
- const t = e.find((r) => r.zoneKey === n);
142
- return t ? t.zoneKey : U(e, n);
143
- }
144
- function he(e, n, t) {
145
- const r = [...e], [s] = r.splice(n, 1);
146
- return r.splice(t, 0, s), r;
147
- }
148
- function ve(e) {
149
- return e.map((n) => `${n.zoneKey}:${n.items.map((t) => t.id).join(",")}`).join("|");
150
- }
151
- function ye(e) {
152
- const [n, t] = A(
153
- () => e.zones.map((l) => l.maxItems !== void 0 && l.items.length > l.maxItems ? (process.env.NODE_ENV !== "production" && console.warn(
154
- `useSortableZones: zone "${l.zoneKey}" exceeds maxItems (${l.items.length} > ${l.maxItems}); trimming to cap.`
155
- ), { ...l, items: l.items.slice(0, l.maxItems) }) : l)
156
- ), [r, s] = A(null), [a, c] = A(null), o = O(null), p = O(e.onZoneChange);
157
- p.current = e.onZoneChange;
158
- const u = z(
159
- () => ve(e.zones),
160
- [e.zones]
161
- ), d = O(u);
162
- w(() => {
163
- d.current !== u && (d.current = u, !r && t(
164
- e.zones.map((l) => l.maxItems !== void 0 && l.items.length > l.maxItems ? (process.env.NODE_ENV !== "production" && console.warn(
165
- `useSortableZones: zone "${l.zoneKey}" exceeds maxItems (${l.items.length} > ${l.maxItems}); trimming to cap.`
166
- ), { ...l, items: l.items.slice(0, l.maxItems) }) : l)
167
- ));
168
- }, [u, e.zones, r]);
169
- const m = T(
170
- (l) => {
171
- const g = l.active.id;
172
- let C = null, y = null;
173
- for (const b of n) {
174
- const P = b.items.find((f) => f.id === g);
175
- if (P) {
176
- C = P, y = b.zoneKey;
177
- break;
178
- }
179
- }
180
- o.current = y, s(C), c(y);
181
- },
182
- [n]
183
- ), _ = T(
184
- (l) => {
185
- if (!l.over) {
186
- c(o.current);
187
- return;
188
- }
189
- const g = Q(n, l.over.id);
190
- c(g);
191
- },
192
- [n]
193
- ), k = T(
194
- (l) => {
195
- const { active: g, over: C } = l, y = () => {
196
- o.current = null, s(null), c(null);
197
- };
198
- if (!C) {
199
- y();
200
- return;
201
- }
202
- const b = U(n, g.id), P = Q(n, C.id);
203
- if (!b || !P) {
204
- y();
205
- return;
206
- }
207
- let f = n.map((E) => ({ ...E, items: [...E.items] }));
208
- if (b === P) {
209
- const E = f.findIndex((D) => D.zoneKey === b), I = f[E], h = I.items.findIndex((D) => D.id === g.id), S = I.items.findIndex((D) => D.id === C.id), R = S >= 0 ? S : Math.max(0, I.items.length - 1);
210
- f[E] = {
211
- ...I,
212
- items: he(I.items, h, R)
213
- };
214
- } else {
215
- const E = f.findIndex((v) => v.zoneKey === b), I = f.findIndex((v) => v.zoneKey === P), h = f[E], S = f[I], R = h.items.find((v) => v.id === g.id);
216
- if (!R) {
217
- y();
218
- return;
219
- }
220
- const D = h.items.filter((v) => v.id !== g.id), $ = S.items.findIndex((v) => v.id === C.id), oe = $ >= 0 ? $ : S.items.length;
221
- let j = D, x = [...S.items];
222
- if (S.maxItems !== void 0 && x.length >= S.maxItems) {
223
- const v = x[x.length - 1];
224
- x = x.slice(0, S.maxItems - 1), j = [...D, v];
225
- }
226
- const q = Math.min(oe, x.length), se = [
227
- ...x.slice(0, q),
228
- R,
229
- ...x.slice(q)
230
- ];
231
- f[E] = { ...h, items: j }, f[I] = { ...S, items: se };
232
- }
233
- t(f), p.current?.(f), y();
234
- },
235
- [n]
236
- ), H = T(
237
- (l) => ({
238
- id: l,
239
- "data-zone-key": l
240
- }),
241
- []
242
- ), B = T(
243
- (l) => {
244
- const g = U(n, l.id) ?? "";
245
- return {
246
- id: l.id,
247
- "data-item-id": l.id,
248
- "data-zone-key": g
249
- };
250
- },
251
- [n]
252
- );
253
- return {
254
- zones: n,
255
- activeZone: a,
256
- activeItem: r,
257
- getZoneProps: H,
258
- getItemProps: B,
259
- handleDragStart: m,
260
- handleDragOver: _,
261
- handleDragEnd: k
262
- };
263
- }
264
- let M = null, F = null, K = !1;
265
- const Ee = [
266
- "DndContext",
267
- "DragOverlay",
268
- "useSensors",
269
- "useSensor",
270
- "useDroppable",
271
- "PointerSensor",
272
- "KeyboardSensor",
273
- "closestCenter"
274
- ], Ie = [
275
- "SortableContext",
276
- "useSortable",
277
- "verticalListSortingStrategy"
278
- ];
279
- function Se(e, n) {
280
- const t = [], r = e ?? {};
281
- for (const a of Ee)
282
- r[a] === void 0 && t.push(`@dnd-kit/core:${a}`);
283
- const s = n ?? {};
284
- for (const a of Ie)
285
- s[a] === void 0 && t.push(`@dnd-kit/sortable:${a}`);
286
- return t.length === 0 ? { ok: !0 } : { ok: !1, missing: t };
287
- }
288
- function Ce() {
289
- return M ? Promise.resolve(M) : K ? Promise.resolve(null) : F || (F = (async () => {
290
- try {
291
- const [e, n, t] = await Promise.all([
292
- import("@dnd-kit/core"),
293
- import("@dnd-kit/sortable"),
294
- import("@dnd-kit/utilities").catch(() => (process.env.NODE_ENV !== "production" && console.warn(
295
- "SortableZones: @dnd-kit/utilities failed to load; drag-overlay positioning will fall back (items may teleport instead of slide)."
296
- ), {}))
297
- ]), r = Se(e, n);
298
- return r.ok ? (M = {
299
- core: e,
300
- sortable: n,
301
- utilities: t
302
- }, M) : (K = !0, process.env.NODE_ENV !== "production" && console.error(
303
- `SortableZones: @dnd-kit shape mismatch — missing exports: ${r.missing.join(", ")}. Check installed versions against optionalDependencies in @mt-gloss/ui.`
304
- ), null);
305
- } catch {
306
- return K = !0, null;
307
- }
308
- })(), F);
309
- }
310
- function be(e) {
311
- const { zones: n, onZoneChange: t, renderZone: r, renderItem: s, renderDragOverlay: a } = e, c = ye({ zones: n, onZoneChange: t }), [o, p] = Z.useState(M);
312
- return Z.useEffect(() => {
313
- if (o) return;
314
- let u = !0;
315
- return Ce().then((d) => {
316
- u && p(d);
317
- }), () => {
318
- u = !1;
319
- };
320
- }, [o]), o ? /* @__PURE__ */ i(
321
- ne,
322
- {
323
- state: c,
324
- modules: o,
325
- renderZone: r,
326
- renderItem: s,
327
- renderDragOverlay: a
328
- }
329
- ) : /* @__PURE__ */ i("div", { "data-sortable-zones-passive": "true", children: c.zones.map((u) => {
330
- const d = u.items.map((m) => /* @__PURE__ */ i(Z.Fragment, { children: s(m) }, m.id));
331
- return /* @__PURE__ */ i("div", { ...c.getZoneProps(u.zoneKey), children: r(u.zoneKey, u.items, d) }, u.zoneKey);
332
- }) });
333
- }
334
- be.displayName = "SortableZones";
335
- function ne({
336
- state: e,
337
- modules: n,
338
- renderZone: t,
339
- renderItem: r,
340
- renderDragOverlay: s
341
- }) {
342
- const { core: a, sortable: c, utilities: o } = n, { DndContext: p, DragOverlay: u, useSensors: d, useSensor: m, useDroppable: _, PointerSensor: k, KeyboardSensor: H, closestCenter: B } = a, { SortableContext: l, verticalListSortingStrategy: g } = c, C = d(
343
- m(k, { activationConstraint: { distance: 5 } }),
344
- m(H)
345
- ), y = p, b = u, P = l;
346
- return /* @__PURE__ */ N(
347
- y,
348
- {
349
- sensors: C,
350
- collisionDetection: B,
351
- onDragStart: e.handleDragStart,
352
- onDragOver: e.handleDragOver,
353
- onDragEnd: e.handleDragEnd,
354
- children: [
355
- e.zones.map((f) => {
356
- const E = f.items.map((h) => h.id), I = f.items.map((h) => /* @__PURE__ */ i(
357
- te,
358
- {
359
- id: h.id,
360
- useSortable: c.useSortable,
361
- cssHelper: o.CSS,
362
- children: r(h)
363
- },
364
- h.id
365
- ));
366
- return /* @__PURE__ */ i(
367
- re,
368
- {
369
- zoneKey: f.zoneKey,
370
- zoneProps: e.getZoneProps(f.zoneKey),
371
- useDroppable: _,
372
- children: /* @__PURE__ */ i(P, { items: E, strategy: g, children: t(f.zoneKey, f.items, I) })
373
- },
374
- f.zoneKey
375
- );
376
- }),
377
- /* @__PURE__ */ i(b, { children: e.activeItem ? s?.(e.activeItem) ?? r(e.activeItem) : null })
378
- ]
379
- }
380
- );
381
- }
382
- ne.displayName = "SortableZonesInner";
383
- function te({ id: e, useSortable: n, cssHelper: t, children: r }) {
384
- const { attributes: s, listeners: a, setNodeRef: c, transform: o, transition: p, isDragging: u } = n({ id: e }), d = {
385
- transform: t?.Transform?.toString(o) ?? void 0,
386
- transition: p,
387
- opacity: u ? 0.5 : 1
388
- };
389
- return /* @__PURE__ */ i("div", { ref: c, style: d, "data-sortable-item-id": e, ...s, ...a, children: r });
390
- }
391
- te.displayName = "SortableItem";
392
- function re({
393
- zoneKey: e,
394
- zoneProps: n,
395
- useDroppable: t,
396
- children: r
397
- }) {
398
- const { setNodeRef: s, isOver: a } = t({ id: e });
399
- return /* @__PURE__ */ i("div", { ref: s, "data-zone-is-over": a || void 0, ...n, children: r });
400
- }
401
- re.displayName = "ZoneDroppable";
402
- const V = ae(null);
403
- function _e() {
404
- const e = W(V);
405
- if (!e)
406
- throw new Error(
407
- "[panels] usePanelContext must be used inside <PanelProvider>. See @mt-gloss/ui/composites/panels."
408
- );
409
- return e;
410
- }
411
- function Pe() {
412
- return W(V);
413
- }
414
- const De = L.number().min(0).max(100), xe = L.number().min(7).max(90), Ne = L.enum(["#1d6fd8", "#10b981", "#f59e0b", "#ef4444", "#8b5cf6"]), Oe = L.array(L.string().min(1)).max(3), we = L.boolean();
415
- function Te(e, n) {
416
- if (e === "threshold") {
417
- const t = De.safeParse(n);
418
- return t.success ? t.data : 80;
419
- }
420
- if (e === "timeframe") {
421
- const t = xe.safeParse(n);
422
- return t.success ? t.data : 30;
423
- }
424
- if (e === "accent") {
425
- const t = Ne.safeParse(n);
426
- return t.success ? t.data : null;
427
- }
428
- if (e === "slots") {
429
- const t = Oe.safeParse(n);
430
- return t.success ? t.data : [];
431
- }
432
- if (e === "thresholdEnabled" || e === "accentEnabled") {
433
- const t = we.safeParse(n);
434
- return t.success ? t.data : !1;
435
- }
436
- return n;
437
- }
438
- const Le = {
439
- activePanelId: null,
440
- activeTrigger: null,
441
- bellCutoutOpen: !1,
442
- isDirty: !1,
443
- dirtySessionCount: 0,
444
- lockHint: null,
445
- bufferByCard: {},
446
- lastClose: null,
447
- pendingSideEffects: []
448
- }, Y = /* @__PURE__ */ new Set(["settings"]);
449
- function ke(e, n) {
450
- if (e == null || e.kind !== n.kind) return !1;
451
- switch (e.kind) {
452
- case "bell":
453
- return !0;
454
- case "card-overflow":
455
- return e.cardId === n.cardId && e.sectionIndex === n.sectionIndex && e.action === n.action;
456
- case "empty-cell":
457
- return e.sectionIndex === n.sectionIndex && e.cellPosition.row === n.cellPosition.row && e.cellPosition.col === n.cellPosition.col;
458
- case "manage-pages-action":
459
- return e.global === n.global && e.align === n.align;
460
- case "layout-action-blocked":
461
- return e.action === n.action && e.blockedCardId === n.blockedCardId && e.activeCardId === n.activeCardId;
462
- }
463
- }
464
- function Me(e, n) {
465
- switch (n.type) {
466
- case "OPEN_PANEL": {
467
- if (e.activePanelId && e.isDirty)
468
- return {
469
- ...e,
470
- pendingSideEffects: [
471
- ...e.pendingSideEffects,
472
- {
473
- type: "SET_LOCK_HINT",
474
- hint: {
475
- blockedTrigger: n.trigger,
476
- activeCardId: e.activeTrigger?.cardId ?? null,
477
- expiresAt: Date.now() + 4e3
478
- }
479
- }
480
- ]
481
- };
482
- if (e.activePanelId === n.panelId && ke(e.activeTrigger, n.trigger))
483
- return e;
484
- const t = e.activePanelId != null ? [
485
- {
486
- type: "HANDOFF_CLOSE",
487
- reason: "mutex-handoff",
488
- previousPanelId: e.activePanelId
489
- }
490
- ] : [], r = n.panelId === "notification-center" && e.bellCutoutOpen;
491
- return {
492
- ...e,
493
- activePanelId: n.panelId,
494
- activeTrigger: n.trigger,
495
- isDirty: !1,
496
- dirtySessionCount: 0,
497
- // Phase 16 P2 CC-17 — fresh open starts a clean session
498
- bellCutoutOpen: r ? !1 : e.bellCutoutOpen,
499
- lastClose: null,
500
- // reset on fresh open
501
- pendingSideEffects: [...e.pendingSideEffects, ...t]
502
- };
503
- }
504
- case "CLOSE_PANEL": {
505
- if (e.activePanelId == null)
506
- return e;
507
- const t = e.activePanelId, r = e.activeTrigger?.cardId ?? null, s = r != null ? e.bufferByCard[r] : void 0, a = e.isDirty ? n.reason === "apply-button" ? r != null && s != null ? [
508
- {
509
- type: "COMMIT_BUFFER",
510
- payload: { cardId: r, delta: s }
511
- }
512
- ] : [{ type: "COMMIT_BUFFER" }] : [{ type: "DISCARD_BUFFER" }] : [], c = r != null && s != null ? (() => {
513
- const o = { ...e.bufferByCard };
514
- return delete o[r], o;
515
- })() : e.bufferByCard;
516
- return {
517
- ...e,
518
- activePanelId: null,
519
- activeTrigger: null,
520
- isDirty: !1,
521
- dirtySessionCount: 0,
522
- // Phase 16 P2 CC-17 — session ends on panel close (apply or discard)
523
- lockHint: null,
524
- // closing clears any active lockHint (dirty-buffer condition gone)
525
- bufferByCard: c,
526
- lastClose: { panelId: t, reason: n.reason },
527
- pendingSideEffects: [...e.pendingSideEffects, ...a]
528
- };
529
- }
530
- case "OPEN_BELL_CUTOUT":
531
- return e.bellCutoutOpen ? e : e.activePanelId === "notification-center" ? {
532
- ...e,
533
- activePanelId: null,
534
- activeTrigger: null,
535
- bellCutoutOpen: !0,
536
- pendingSideEffects: [
537
- ...e.pendingSideEffects,
538
- { type: "AUTO_CLOSE_NOTIF_CENTER" }
539
- ]
540
- } : { ...e, bellCutoutOpen: !0 };
541
- case "CLOSE_BELL_CUTOUT":
542
- return e.bellCutoutOpen ? { ...e, bellCutoutOpen: !1 } : e;
543
- case "SET_BUFFER_VALUE": {
544
- if (e.activePanelId == null || !Y.has(e.activePanelId))
545
- return {
546
- ...e,
547
- pendingSideEffects: [
548
- ...e.pendingSideEffects,
549
- { type: "INVALID_DISPATCH", reason: "no-buffer-panel" }
550
- ]
551
- };
552
- const t = e.bufferByCard[n.cardId], r = t == null, s = Te(n.key, n.value);
553
- if (!r && t.changes[n.key] === s)
554
- return e;
555
- const c = { kind: "settings", changes: {
556
- ...t?.kind === "settings" ? t.changes : {},
557
- [n.key]: s
558
- } }, o = { ...e.bufferByCard, [n.cardId]: c }, p = r ? [
559
- {
560
- type: "SCHEDULE_TIMER",
561
- ms: 0,
562
- action: { type: "BUFFER_BECOMES_DIRTY" }
563
- }
564
- ] : [];
565
- return {
566
- ...e,
567
- bufferByCard: o,
568
- pendingSideEffects: [...e.pendingSideEffects, ...p]
569
- };
570
- }
571
- case "CLEAR_BUFFER": {
572
- if (e.bufferByCard[n.cardId] == null)
573
- return e;
574
- const r = Object.keys(e.bufferByCard).length === 1, s = { ...e.bufferByCard };
575
- delete s[n.cardId];
576
- const a = r && e.isDirty ? [
577
- {
578
- type: "SCHEDULE_TIMER",
579
- ms: 0,
580
- action: { type: "BUFFER_BECOMES_CLEAN" }
581
- }
582
- ] : [];
583
- return {
584
- ...e,
585
- bufferByCard: s,
586
- pendingSideEffects: [...e.pendingSideEffects, ...a]
587
- };
588
- }
589
- case "BUFFER_BECOMES_DIRTY":
590
- return e.activePanelId == null || !Y.has(e.activePanelId) ? {
591
- ...e,
592
- pendingSideEffects: [
593
- ...e.pendingSideEffects,
594
- { type: "INVALID_DISPATCH", reason: "no-buffer-panel" }
595
- ]
596
- } : e.isDirty ? e : { ...e, isDirty: !0, dirtySessionCount: e.dirtySessionCount + 1 };
597
- case "BUFFER_BECOMES_CLEAN":
598
- return e.isDirty ? { ...e, isDirty: !1, dirtySessionCount: 0 } : e;
599
- case "SET_LOCK_HINT":
600
- return {
601
- ...e,
602
- lockHint: n.hint,
603
- pendingSideEffects: [
604
- ...e.pendingSideEffects,
605
- {
606
- type: "SCHEDULE_TIMER",
607
- ms: Math.max(0, n.hint.expiresAt - Date.now()),
608
- action: { type: "CLEAR_LOCK_HINT" }
609
- }
610
- ]
611
- };
612
- case "CLEAR_LOCK_HINT":
613
- return e.lockHint == null ? e : { ...e, lockHint: null };
614
- case "DRAIN_SIDE_EFFECTS":
615
- return e.pendingSideEffects.length === 0 ? e : typeof n.count == "number" && n.count > 0 ? n.count >= e.pendingSideEffects.length ? { ...e, pendingSideEffects: [] } : {
616
- ...e,
617
- pendingSideEffects: e.pendingSideEffects.slice(n.count)
618
- } : {
619
- ...e,
620
- pendingSideEffects: []
621
- };
622
- default:
623
- return e;
624
- }
625
- }
626
- function Re(e) {
627
- return e.activePanelId === "notification-center" ? "notif-center" : e.activePanelId != null && e.bellCutoutOpen ? e.isDirty ? "panel-dirty+cutout" : "panel-clean+cutout" : e.activePanelId != null ? e.isDirty ? "panel-dirty" : "panel-clean" : e.bellCutoutOpen ? "bell-cutout-only" : "idle";
628
- }
629
- function Fe() {
630
- const [e, n] = ce(Me, Le), t = O([]), r = O(null);
631
- w(() => () => {
632
- r.current != null && (window.clearTimeout(r.current), r.current = null);
633
- }, []), w(() => {
634
- const c = e.pendingSideEffects.length;
635
- if (c !== 0) {
636
- for (const o of e.pendingSideEffects)
637
- o.type === "SCHEDULE_TIMER" ? (r.current != null && window.clearTimeout(r.current), r.current = window.setTimeout(() => {
638
- r.current = null, n(o.action);
639
- }, Math.max(0, o.ms))) : o.type === "SET_LOCK_HINT" ? n({ type: "SET_LOCK_HINT", hint: o.hint }) : o.type === "HANDOFF_CLOSE" ? t.current = [
640
- ...t.current.slice(-99),
641
- {
642
- panelId: o.previousPanelId,
643
- reason: "mutex-handoff",
644
- at: Date.now(),
645
- note: "F22: mutex-handoff synthetic close-log entry"
646
- }
647
- ] : o.type === "INVALID_DISPATCH" && process.env.NODE_ENV !== "production" && console.warn("[panels] INVALID_DISPATCH:", o.reason);
648
- n({ type: "DRAIN_SIDE_EFFECTS", count: c });
649
- }
650
- }, [e.pendingSideEffects, n]), w(() => {
651
- if (!e.lastClose) return;
652
- const c = {
653
- panelId: e.lastClose.panelId,
654
- reason: e.lastClose.reason,
655
- at: Date.now(),
656
- note: e.lastClose.reason === "nav-escape-hatch" ? "F21: backdrop-click OR page-nav escape" : void 0
657
- };
658
- t.current = [
659
- ...t.current.slice(-99),
660
- c
661
- ];
662
- }, [e.lastClose]);
663
- const s = z(
664
- () => Re(e),
665
- [e.activePanelId, e.bellCutoutOpen, e.isDirty]
666
- ), a = T(() => t.current.slice(), []);
667
- return { state: e, surfaceState: s, dispatch: n, getCloseLog: a };
668
- }
669
- function an({ children: e }) {
670
- const n = Fe(), t = z(
671
- () => n,
672
- // Re-publish only when one of the four coordinator fields changes identity.
673
- // dispatch + getCloseLog are stable. state + surfaceState change on dispatch.
674
- [n.state, n.surfaceState, n.dispatch, n.getCloseLog]
675
- );
676
- return /* @__PURE__ */ i(V.Provider, { value: t, children: e });
677
- }
678
- function Ae({ title: e, onClose: n, titleId: t }) {
679
- return /* @__PURE__ */ N("div", { className: "gloss-panel-chrome-v2__header", children: [
680
- e != null && /* @__PURE__ */ i("span", { id: t, className: "gloss-panel-chrome-v2__title", children: e }),
681
- /* @__PURE__ */ i(
682
- "button",
683
- {
684
- id: "panel-close",
685
- type: "button",
686
- "aria-label": "Close panel",
687
- className: "gloss-panel-chrome-v2__close",
688
- onClick: n,
689
- children: "×"
690
- }
691
- )
692
- ] });
693
- }
694
- function He({ children: e }) {
695
- return /* @__PURE__ */ i(
696
- "div",
697
- {
698
- "data-panel-stage": !0,
699
- "aria-hidden": "true",
700
- className: "gloss-panel-chrome-v2__stage",
701
- children: e
702
- }
703
- );
704
- }
705
- function Be({ children: e }) {
706
- return /* @__PURE__ */ i("div", { className: "gloss-panel-chrome-v2__navigation", children: e });
707
- }
708
- function Ze({ children: e }) {
709
- return /* @__PURE__ */ i("div", { className: "gloss-panel-chrome-v2__body", children: e });
710
- }
711
- function Ke({ left: e, right: n }) {
712
- return /* @__PURE__ */ N("div", { className: "gloss-panel-chrome-v2__footer", children: [
713
- /* @__PURE__ */ i("div", { className: "gloss-panel-chrome-v2__footer-left", children: e }),
714
- /* @__PURE__ */ i("div", { className: "gloss-panel-chrome-v2__footer-right", children: n })
715
- ] });
716
- }
717
- function Ue({
718
- children: e,
719
- onClose: n,
720
- title: t,
721
- variant: r = "no-stage",
722
- stage: s,
723
- navigation: a,
724
- footer: c
725
- }) {
726
- const o = t == null && r === "with-stage", p = X(), u = t != null;
727
- return /* @__PURE__ */ N(
728
- "div",
729
- {
730
- "data-chrome": "panel-v2",
731
- "data-chrome-variant": r,
732
- "data-headerless": o || void 0,
733
- role: "dialog",
734
- "aria-modal": "true",
735
- "aria-labelledby": u ? p : void 0,
736
- "aria-label": u ? void 0 : "Panel",
737
- className: `gloss-panel-chrome-v2 gloss-panel-chrome-v2--${r}${o ? " gloss-panel-chrome-v2--headerless" : ""}`,
738
- children: [
739
- !o && /* @__PURE__ */ i(Ae, { title: t, onClose: n, titleId: p }),
740
- r === "with-stage" && /* @__PURE__ */ i(He, { children: s }),
741
- a != null && /* @__PURE__ */ i(Be, { children: a }),
742
- /* @__PURE__ */ i(Ze, { children: e }),
743
- c != null && /* @__PURE__ */ i(Ke, { left: c.left, right: c.right }),
744
- o && /* @__PURE__ */ i(
745
- "button",
746
- {
747
- id: "panel-close",
748
- type: "button",
749
- "aria-label": "Close panel",
750
- className: "gloss-panel-chrome-v2__close gloss-panel-chrome-v2__close--floating",
751
- onClick: n,
752
- children: "×"
753
- }
754
- )
755
- ]
756
- }
757
- );
758
- }
759
- function cn({ isOpen: e }) {
760
- const n = Pe();
761
- return /* @__PURE__ */ i(
762
- Ue,
763
- {
764
- variant: "no-stage",
765
- title: "Notifications",
766
- onClose: () => n?.dispatch({ type: "CLOSE_PANEL", reason: "header-x" }),
767
- children: /* @__PURE__ */ i(
768
- "div",
769
- {
770
- "data-shell": "notification-center",
771
- "data-panel": "notification-center",
772
- "aria-hidden": !e,
773
- children: /* @__PURE__ */ i("p", { children: "No notifications" })
774
- }
775
- )
776
- }
777
- );
778
- }
779
- const ze = {
780
- position: "relative",
781
- pointerEvents: "auto"
782
- };
783
- function Ve({ children: e, onClose: n, footer: t, title: r, variant: s = "default" }) {
784
- const a = `panel-close-${X().replace(/:/g, "-")}`;
785
- return /* @__PURE__ */ N(
786
- "div",
787
- {
788
- "data-chrome": "panel",
789
- "data-chrome-variant": s,
790
- role: "dialog",
791
- "aria-modal": "true",
792
- className: s === "merged-stage" ? "gloss-panel-chrome gloss-panel-chrome--merged-stage" : "gloss-panel-chrome",
793
- style: ze,
794
- children: [
795
- /* @__PURE__ */ N("div", { className: "gloss-panel-chrome__header", children: [
796
- r != null && /* @__PURE__ */ i("span", { className: "gloss-panel-chrome__title", children: r }),
797
- /* @__PURE__ */ i(
798
- "button",
799
- {
800
- id: a,
801
- type: "button",
802
- "aria-label": "Close panel",
803
- className: "gloss-panel-chrome__close",
804
- onClick: n,
805
- children: "×"
806
- }
807
- )
808
- ] }),
809
- /* @__PURE__ */ i("div", { className: "gloss-panel-chrome__body", children: e }),
810
- t != null && /* @__PURE__ */ i("div", { className: "gloss-panel-chrome__footer", children: t })
811
- ]
812
- }
813
- );
814
- }
815
- function $e(e) {
816
- if (process.env.NODE_ENV === "production" || !e || !e.parentElement) return;
817
- const n = e.parentElement, t = window.getComputedStyle(n);
818
- t.perspective === "none" && console.warn(
819
- "[PanelMount] §2.7 violation: parent of .gloss-panel-mount has perspective:none. Rotated mount will render flat. Parent:",
820
- n
821
- ), (t.overflow === "hidden" || t.overflowY === "hidden") && console.warn(
822
- "[PanelMount] §2.9 violation: parent of .gloss-panel-mount has overflow:hidden. Rising panel will be clipped. Parent:",
823
- n
824
- );
825
- }
826
- function je({ isOpen: e, children: n }) {
827
- const t = ee(), r = O(null);
828
- G(() => {
829
- $e(r.current);
830
- }, []);
831
- const [s, a] = A(!1);
832
- w(() => {
833
- if (!e) {
834
- a(!1);
835
- return;
836
- }
837
- const o = requestAnimationFrame(() => a(!0));
838
- return () => cancelAnimationFrame(o);
839
- }, [e]);
840
- const c = [
841
- "gloss-panel-mount",
842
- s ? "has-panel" : "",
843
- t ? "reduced-motion" : ""
844
- ].filter(Boolean).join(" ");
845
- return /* @__PURE__ */ i(
846
- "div",
847
- {
848
- ref: r,
849
- className: c,
850
- "data-mount": "panel",
851
- "data-open": e ? "true" : "false",
852
- children: n
853
- }
854
- );
855
- }
856
- const qe = {
857
- position: "fixed",
858
- top: 0,
859
- left: 0,
860
- right: 0,
861
- height: "var(--tb-h, 60px)",
862
- perspective: "var(--panel-perspective, 1500px)",
863
- perspectiveOrigin: "center bottom",
864
- overflow: "visible",
865
- pointerEvents: "none",
866
- zIndex: 55
867
- }, Qe = {
868
- position: "fixed",
869
- top: "var(--tb-h, 60px)",
870
- left: 0,
871
- right: 0,
872
- bottom: 0,
873
- zIndex: 1,
874
- // CR-03 fix: pass-through tint — scrim is visual-only and must not intercept
875
- // grid card clicks. Dismiss is via ESC keydown (see useEffect above) only;
876
- // no scrim-click-to-close by design (prevents accidental dismissal while
877
- // interacting with cards behind the scrim).
878
- pointerEvents: "none",
879
- background: "rgba(0, 0, 0, 0.04)"
880
- };
881
- function dn({ panelComponents: e }) {
882
- const { state: n, dispatch: t, getCloseLog: r } = _e(), s = n.activePanelId ? e[n.activePanelId] : null;
883
- n.activePanelId && !s && process.env.NODE_ENV !== "production" && console.error(
884
- "[panels] No panel component registered for activePanelId:",
885
- n.activePanelId
886
- ), w(() => {
887
- if (n.activePanelId == null) return;
888
- function o(p) {
889
- p.key === "Escape" && t({ type: "CLOSE_PANEL", reason: "escape-key" });
890
- }
891
- return document.addEventListener("keydown", o), () => {
892
- document.removeEventListener("keydown", o);
893
- };
894
- }, [n.activePanelId, t]);
895
- const a = O(n);
896
- G(() => {
897
- a.current = n;
898
- }), w(() => {
899
- if (process.env.NODE_ENV === "production") return;
900
- const o = window;
901
- return o.__panelsHostHandle && console.warn("[panels] multiple PanelHost/PanelHostShell instances mounted; dev handle is unreliable"), o.__panelsHostHandle = {
902
- dispatch: t,
903
- getState: () => a.current,
904
- getCloseLog: r
905
- }, () => {
906
- o.__panelsHostHandle?.dispatch === t && delete o.__panelsHostHandle;
907
- };
908
- }, [t, r]);
909
- const c = n.activePanelId != null && s != null;
910
- return /* @__PURE__ */ N("div", { "data-panel-host": "true", style: qe, children: [
911
- c && /* @__PURE__ */ i(
912
- "div",
913
- {
914
- "data-panel-scrim": "true",
915
- style: Qe
916
- }
917
- ),
918
- /* @__PURE__ */ i(je, { isOpen: c, children: c && /* @__PURE__ */ i(
919
- Ve,
920
- {
921
- isOpen: !0,
922
- onClose: () => t({ type: "CLOSE_PANEL", reason: "header-x" }),
923
- children: /* @__PURE__ */ i(s, { isOpen: !0 })
924
- }
925
- ) })
926
- ] });
927
- }
928
- const un = {
929
- "apply-button": !0,
930
- // the ONLY commit reason
931
- "cancel-button": !1,
932
- "header-x": !1,
933
- "escape-key": !1,
934
- "page-nav": !1,
935
- "mutex-handoff": !1,
936
- "ghost-anchor": !1,
937
- "viewport-collapse": !1,
938
- unmount: !1,
939
- "nav-escape-hatch": !1,
940
- "drag-start": !1,
941
- // Phase 11.6 D-19 — R9 drag-start auto-close discards buffer
942
- "section-hidden": !1
943
- // 260524 panel-x-axis-transitions — viewport shrank past targetSection
944
- };
945
- export {
946
- un as C,
947
- on as H,
948
- cn as N,
949
- an as P,
950
- be as S,
951
- rn as a,
952
- sn as b,
953
- Je as c,
954
- ye as d,
955
- _e as e,
956
- dn as f,
957
- ln as g,
958
- Fe as h,
959
- Me as i,
960
- Le as j,
961
- Re as k,
962
- ge as l,
963
- ee as m,
964
- Ue as n,
965
- je as o,
966
- tn as p,
967
- Ae as q,
968
- nn as r,
969
- en as s,
970
- He as t,
971
- Pe as u,
972
- Be as v,
973
- Ze as w,
974
- Ke as x
975
- };