@mt-gloss/ui 0.1.139 → 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 (107) 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 +581 -1404
  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 -7
  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 -57
  38. package/lib/composites/panels/shells/index.d.ts +2 -4
  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/presets/PresetAccordion/PresetAccordion.d.ts +4 -24
  51. package/lib/presets/PresetBadge/PresetBadge.d.ts +1 -6
  52. package/lib/presets/PresetCard/PresetCard.d.ts +8 -48
  53. package/lib/presets/PresetCheckbox/PresetCheckbox.d.ts +1 -6
  54. package/lib/presets/PresetChip/PresetChip.d.ts +1 -6
  55. package/lib/presets/PresetColorPicker/PresetColorPicker.d.ts +1 -6
  56. package/lib/presets/PresetDatePicker/PresetDatePicker.d.ts +1 -6
  57. package/lib/presets/PresetDateRangePicker/PresetDateRangePicker.d.ts +1 -6
  58. package/lib/presets/PresetFileUpload/PresetFileUpload.d.ts +1 -6
  59. package/lib/presets/PresetInput/PresetInput.d.ts +1 -6
  60. package/lib/presets/PresetLink/PresetLink.d.ts +1 -6
  61. package/lib/presets/PresetMaskedInput/PresetMaskedInput.d.ts +1 -6
  62. package/lib/presets/PresetMenu/PresetMenu.d.ts +2 -12
  63. package/lib/presets/PresetNumberInput/PresetNumberInput.d.ts +1 -6
  64. package/lib/presets/PresetRadio/PresetRadio.d.ts +1 -6
  65. package/lib/presets/PresetRangeSlider/PresetRangeSlider.d.ts +1 -6
  66. package/lib/presets/PresetRating/PresetRating.d.ts +1 -6
  67. package/lib/presets/PresetTextarea/PresetTextarea.d.ts +1 -6
  68. package/lib/presets/PresetTimePicker/PresetTimePicker.d.ts +1 -6
  69. package/lib/presets/PresetToggle/PresetToggle.d.ts +1 -6
  70. package/lib/primitives/dashboard/ResizePill/ResizePill.d.ts +1 -7
  71. package/lib/primitives/dashboard/index.d.ts +0 -1
  72. package/lib/wrappers/Actionable/Actionable.d.ts +1 -6
  73. package/lib/wrappers/AsyncLoader/AsyncLoader.d.ts +1 -6
  74. package/lib/wrappers/ButtonGroup/ButtonGroup.d.ts +1 -6
  75. package/lib/wrappers/CheckboxGroup/CheckboxGroup.d.ts +1 -6
  76. package/lib/wrappers/Dismissible/Dismissible.d.ts +1 -6
  77. package/lib/wrappers/Expandable/Expandable.d.ts +1 -6
  78. package/lib/wrappers/InputGroup/InputGroup.d.ts +2 -12
  79. package/lib/wrappers/RadioGroup/RadioGroup.d.ts +1 -6
  80. package/lib/wrappers/Selectable/Selectable.d.ts +1 -6
  81. package/lib/wrappers/Sortable/Sortable.d.ts +1 -6
  82. package/package.json +1 -1
  83. package/ui.css +1 -1
  84. package/BaseText-Dxbk1JJa.js +0 -66
  85. package/COMMITS-DEdHYT0E.js +0 -963
  86. package/Expandable-DA4NFzCR.js +0 -13243
  87. package/MetricCard-DOPtBpek.js +0 -698
  88. package/UIContext-CGQI_KJk.js +0 -1808
  89. package/lib/composites/panels/chrome-v2/PanelBody.d.ts +0 -5
  90. package/lib/composites/panels/chrome-v2/PanelChromeV2.d.ts +0 -18
  91. package/lib/composites/panels/chrome-v2/PanelFooter.d.ts +0 -6
  92. package/lib/composites/panels/chrome-v2/PanelFooterMessage.d.ts +0 -6
  93. package/lib/composites/panels/chrome-v2/PanelHeader.d.ts +0 -10
  94. package/lib/composites/panels/chrome-v2/PanelNavigation.d.ts +0 -5
  95. package/lib/composites/panels/chrome-v2/PanelStage.d.ts +0 -5
  96. package/lib/composites/panels/chrome-v2/index.d.ts +0 -23
  97. package/lib/composites/panels/coordinator/settingsBufferSchemas.d.ts +0 -13
  98. package/lib/composites/panels/hooks/useEditingCardId.d.ts +0 -16
  99. package/lib/composites/panels/shells/MetricInfoShell.d.ts +0 -29
  100. package/lib/composites/panels/shells/NotificationCenterShell.d.ts +0 -2
  101. package/lib/composites/panels/shells/settings/GhostSlotPill.d.ts +0 -7
  102. package/lib/composites/panels/shells/settings/SlotsControls.d.ts +0 -11
  103. package/lib/composites/panels/shells/settings/TimeframeControls.d.ts +0 -6
  104. package/lib/composites/panels/shells/settings/index.d.ts +0 -14
  105. package/lib/primitives/dashboard/SettingsTabStrip/SettingsTabStrip.d.ts +0 -17
  106. package/lib/primitives/dashboard/SettingsTabStrip/index.d.ts +0 -6
  107. package/lib/primitives/dashboard/SettingsTabStrip/types.d.ts +0 -12
@@ -1,963 +0,0 @@
1
- import { jsx as i, jsxs as N } from "react/jsx-runtime";
2
- import { motion as ie } from "framer-motion";
3
- import B, { useSyncExternalStore as le, useState as F, 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 K } from "zod";
5
- const We = {
6
- forwardStaggerMs: 50,
7
- reverseStaggerMs: 30,
8
- springStiffness: 380,
9
- springDamping: 32,
10
- reverseVelocityMultiplier: 1.4
11
- }, Xe = {
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
- }, Ge = {
18
- shiverCycles: 3,
19
- shiverAmplitudePx: 2,
20
- shiverDurationMs: 180,
21
- validCellOpacity: 0.6
22
- }, Je = {
23
- materializeMs: 180,
24
- dematerializeMs: 140,
25
- easing: "cubic-bezier(0.22, 1, 0.36, 1)",
26
- dotStrokePx: 2,
27
- dividerDashGapPx: 4
28
- }, en = {
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
- }, nn = !0, tn = {
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 rn() {
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 ve(e, n, t) {
145
- const r = [...e], [s] = r.splice(n, 1);
146
- return r.splice(t, 0, s), r;
147
- }
148
- function he(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] = F(
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] = F(null), [a, c] = F(null), o = O(null), p = O(e.onZoneChange);
157
- p.current = e.onZoneChange;
158
- const u = z(
159
- () => he(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((I) => ({ ...I, items: [...I.items] }));
208
- if (b === P) {
209
- const I = f.findIndex((D) => D.zoneKey === b), E = f[I], v = E.items.findIndex((D) => D.id === g.id), S = E.items.findIndex((D) => D.id === C.id), M = S >= 0 ? S : Math.max(0, E.items.length - 1);
210
- f[I] = {
211
- ...E,
212
- items: ve(E.items, v, M)
213
- };
214
- } else {
215
- const I = f.findIndex((h) => h.zoneKey === b), E = f.findIndex((h) => h.zoneKey === P), v = f[I], S = f[E], M = v.items.find((h) => h.id === g.id);
216
- if (!M) {
217
- y();
218
- return;
219
- }
220
- const D = v.items.filter((h) => h.id !== g.id), $ = S.items.findIndex((h) => h.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 h = x[x.length - 1];
224
- x = x.slice(0, S.maxItems - 1), j = [...D, h];
225
- }
226
- const q = Math.min(oe, x.length), se = [
227
- ...x.slice(0, q),
228
- M,
229
- ...x.slice(q)
230
- ];
231
- f[I] = { ...v, items: j }, f[E] = { ...S, items: se };
232
- }
233
- t(f), p.current?.(f), y();
234
- },
235
- [n]
236
- ), A = T(
237
- (l) => ({
238
- id: l,
239
- "data-zone-key": l
240
- }),
241
- []
242
- ), H = 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: A,
258
- getItemProps: H,
259
- handleDragStart: m,
260
- handleDragOver: _,
261
- handleDragEnd: k
262
- };
263
- }
264
- let L = null, R = null, Z = !1;
265
- const Ie = [
266
- "DndContext",
267
- "DragOverlay",
268
- "useSensors",
269
- "useSensor",
270
- "useDroppable",
271
- "PointerSensor",
272
- "KeyboardSensor",
273
- "closestCenter"
274
- ], Ee = [
275
- "SortableContext",
276
- "useSortable",
277
- "verticalListSortingStrategy"
278
- ];
279
- function Se(e, n) {
280
- const t = [], r = e ?? {};
281
- for (const a of Ie)
282
- r[a] === void 0 && t.push(`@dnd-kit/core:${a}`);
283
- const s = n ?? {};
284
- for (const a of Ee)
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 L ? Promise.resolve(L) : Z ? Promise.resolve(null) : R || (R = (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 ? (L = {
299
- core: e,
300
- sortable: n,
301
- utilities: t
302
- }, L) : (Z = !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 Z = !0, null;
307
- }
308
- })(), R);
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] = B.useState(L);
312
- return B.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(B.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: A, closestCenter: H } = a, { SortableContext: l, verticalListSortingStrategy: g } = c, C = d(
343
- m(k, { activationConstraint: { distance: 5 } }),
344
- m(A)
345
- ), y = p, b = u, P = l;
346
- return /* @__PURE__ */ N(
347
- y,
348
- {
349
- sensors: C,
350
- collisionDetection: H,
351
- onDragStart: e.handleDragStart,
352
- onDragOver: e.handleDragOver,
353
- onDragEnd: e.handleDragEnd,
354
- children: [
355
- e.zones.map((f) => {
356
- const I = f.items.map((v) => v.id), E = f.items.map((v) => /* @__PURE__ */ i(
357
- te,
358
- {
359
- id: v.id,
360
- useSortable: c.useSortable,
361
- cssHelper: o.CSS,
362
- children: r(v)
363
- },
364
- v.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: I, strategy: g, children: t(f.zoneKey, f.items, E) })
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 = K.number().min(7).max(90), xe = K.array(K.string().min(1)).max(6);
415
- function Ne(e, n) {
416
- if (e === "timeframe") {
417
- const t = De.safeParse(n);
418
- return t.success ? t.data : 30;
419
- }
420
- if (e === "slots") {
421
- const t = xe.safeParse(n);
422
- return t.success ? t.data : [];
423
- }
424
- return n;
425
- }
426
- const Oe = {
427
- activePanelId: null,
428
- activeTrigger: null,
429
- bellCutoutOpen: !1,
430
- isDirty: !1,
431
- dirtySessionCount: 0,
432
- lockHint: null,
433
- bufferByCard: {},
434
- lastClose: null,
435
- pendingSideEffects: []
436
- }, Y = /* @__PURE__ */ new Set(["settings"]);
437
- function we(e, n) {
438
- if (e == null || e.kind !== n.kind) return !1;
439
- switch (e.kind) {
440
- case "bell":
441
- return !0;
442
- case "card-overflow":
443
- return e.cardId === n.cardId && e.sectionIndex === n.sectionIndex && e.action === n.action;
444
- case "empty-cell":
445
- return e.sectionIndex === n.sectionIndex && e.cellPosition.row === n.cellPosition.row && e.cellPosition.col === n.cellPosition.col;
446
- case "manage-pages-action":
447
- return e.global === n.global && e.align === n.align;
448
- case "layout-action-blocked":
449
- return e.action === n.action && e.blockedCardId === n.blockedCardId && e.activeCardId === n.activeCardId;
450
- }
451
- }
452
- function Te(e, n) {
453
- switch (n.type) {
454
- case "OPEN_PANEL": {
455
- if (e.activePanelId && e.isDirty)
456
- return {
457
- ...e,
458
- pendingSideEffects: [
459
- ...e.pendingSideEffects,
460
- {
461
- type: "SET_LOCK_HINT",
462
- hint: {
463
- blockedTrigger: n.trigger,
464
- activeCardId: e.activeTrigger?.cardId ?? null,
465
- expiresAt: Date.now() + 4e3
466
- }
467
- }
468
- ]
469
- };
470
- if (e.activePanelId === n.panelId && we(e.activeTrigger, n.trigger))
471
- return e;
472
- const t = e.activePanelId != null ? [
473
- {
474
- type: "HANDOFF_CLOSE",
475
- reason: "mutex-handoff",
476
- previousPanelId: e.activePanelId
477
- }
478
- ] : [], r = n.panelId === "notification-center" && e.bellCutoutOpen;
479
- return {
480
- ...e,
481
- activePanelId: n.panelId,
482
- activeTrigger: n.trigger,
483
- isDirty: !1,
484
- dirtySessionCount: 0,
485
- // Phase 16 P2 CC-17 — fresh open starts a clean session
486
- bellCutoutOpen: r ? !1 : e.bellCutoutOpen,
487
- lastClose: null,
488
- // reset on fresh open
489
- pendingSideEffects: [...e.pendingSideEffects, ...t]
490
- };
491
- }
492
- case "CLOSE_PANEL": {
493
- if (e.activePanelId == null)
494
- return e;
495
- 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 ? [
496
- {
497
- type: "COMMIT_BUFFER",
498
- payload: { cardId: r, delta: s }
499
- }
500
- ] : [{ type: "COMMIT_BUFFER" }] : [{ type: "DISCARD_BUFFER" }] : [], c = r != null && s != null ? (() => {
501
- const o = { ...e.bufferByCard };
502
- return delete o[r], o;
503
- })() : e.bufferByCard;
504
- return {
505
- ...e,
506
- activePanelId: null,
507
- activeTrigger: null,
508
- isDirty: !1,
509
- dirtySessionCount: 0,
510
- // Phase 16 P2 CC-17 — session ends on panel close (apply or discard)
511
- lockHint: null,
512
- // closing clears any active lockHint (dirty-buffer condition gone)
513
- bufferByCard: c,
514
- lastClose: { panelId: t, reason: n.reason },
515
- pendingSideEffects: [...e.pendingSideEffects, ...a]
516
- };
517
- }
518
- case "OPEN_BELL_CUTOUT":
519
- return e.bellCutoutOpen ? e : e.activePanelId === "notification-center" ? {
520
- ...e,
521
- activePanelId: null,
522
- activeTrigger: null,
523
- bellCutoutOpen: !0,
524
- pendingSideEffects: [
525
- ...e.pendingSideEffects,
526
- { type: "AUTO_CLOSE_NOTIF_CENTER" }
527
- ]
528
- } : { ...e, bellCutoutOpen: !0 };
529
- case "CLOSE_BELL_CUTOUT":
530
- return e.bellCutoutOpen ? { ...e, bellCutoutOpen: !1 } : e;
531
- case "SET_BUFFER_VALUE": {
532
- if (e.activePanelId == null || !Y.has(e.activePanelId))
533
- return {
534
- ...e,
535
- pendingSideEffects: [
536
- ...e.pendingSideEffects,
537
- { type: "INVALID_DISPATCH", reason: "no-buffer-panel" }
538
- ]
539
- };
540
- const t = e.bufferByCard[n.cardId], r = t == null, s = Ne(n.key, n.value);
541
- if (!r && t.changes[n.key] === s)
542
- return e;
543
- const c = { kind: "settings", changes: {
544
- ...t?.kind === "settings" ? t.changes : {},
545
- [n.key]: s
546
- } }, o = { ...e.bufferByCard, [n.cardId]: c }, p = r ? [
547
- {
548
- type: "SCHEDULE_TIMER",
549
- ms: 0,
550
- action: { type: "BUFFER_BECOMES_DIRTY" }
551
- }
552
- ] : [];
553
- return {
554
- ...e,
555
- bufferByCard: o,
556
- pendingSideEffects: [...e.pendingSideEffects, ...p]
557
- };
558
- }
559
- case "CLEAR_BUFFER": {
560
- if (e.bufferByCard[n.cardId] == null)
561
- return e;
562
- const r = Object.keys(e.bufferByCard).length === 1, s = { ...e.bufferByCard };
563
- delete s[n.cardId];
564
- const a = r && e.isDirty ? [
565
- {
566
- type: "SCHEDULE_TIMER",
567
- ms: 0,
568
- action: { type: "BUFFER_BECOMES_CLEAN" }
569
- }
570
- ] : [];
571
- return {
572
- ...e,
573
- bufferByCard: s,
574
- pendingSideEffects: [...e.pendingSideEffects, ...a]
575
- };
576
- }
577
- case "BUFFER_BECOMES_DIRTY":
578
- return e.activePanelId == null || !Y.has(e.activePanelId) ? {
579
- ...e,
580
- pendingSideEffects: [
581
- ...e.pendingSideEffects,
582
- { type: "INVALID_DISPATCH", reason: "no-buffer-panel" }
583
- ]
584
- } : e.isDirty ? e : { ...e, isDirty: !0, dirtySessionCount: e.dirtySessionCount + 1 };
585
- case "BUFFER_BECOMES_CLEAN":
586
- return e.isDirty ? { ...e, isDirty: !1, dirtySessionCount: 0 } : e;
587
- case "SET_LOCK_HINT":
588
- return {
589
- ...e,
590
- lockHint: n.hint,
591
- pendingSideEffects: [
592
- ...e.pendingSideEffects,
593
- {
594
- type: "SCHEDULE_TIMER",
595
- ms: Math.max(0, n.hint.expiresAt - Date.now()),
596
- action: { type: "CLEAR_LOCK_HINT" }
597
- }
598
- ]
599
- };
600
- case "CLEAR_LOCK_HINT":
601
- return e.lockHint == null ? e : { ...e, lockHint: null };
602
- case "DRAIN_SIDE_EFFECTS":
603
- return e.pendingSideEffects.length === 0 ? e : typeof n.count == "number" && n.count > 0 ? n.count >= e.pendingSideEffects.length ? { ...e, pendingSideEffects: [] } : {
604
- ...e,
605
- pendingSideEffects: e.pendingSideEffects.slice(n.count)
606
- } : {
607
- ...e,
608
- pendingSideEffects: []
609
- };
610
- default:
611
- return e;
612
- }
613
- }
614
- function ke(e) {
615
- 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";
616
- }
617
- function Le() {
618
- const [e, n] = ce(Te, Oe), t = O([]), r = O(null);
619
- w(() => () => {
620
- r.current != null && (window.clearTimeout(r.current), r.current = null);
621
- }, []), w(() => {
622
- const c = e.pendingSideEffects.length;
623
- if (c !== 0) {
624
- for (const o of e.pendingSideEffects)
625
- o.type === "SCHEDULE_TIMER" ? (r.current != null && window.clearTimeout(r.current), r.current = window.setTimeout(() => {
626
- r.current = null, n(o.action);
627
- }, Math.max(0, o.ms))) : o.type === "SET_LOCK_HINT" ? n({ type: "SET_LOCK_HINT", hint: o.hint }) : o.type === "HANDOFF_CLOSE" ? t.current = [
628
- ...t.current.slice(-99),
629
- {
630
- panelId: o.previousPanelId,
631
- reason: "mutex-handoff",
632
- at: Date.now(),
633
- note: "F22: mutex-handoff synthetic close-log entry"
634
- }
635
- ] : o.type === "INVALID_DISPATCH" && process.env.NODE_ENV !== "production" && console.warn("[panels] INVALID_DISPATCH:", o.reason);
636
- n({ type: "DRAIN_SIDE_EFFECTS", count: c });
637
- }
638
- }, [e.pendingSideEffects, n]), w(() => {
639
- if (!e.lastClose) return;
640
- const c = {
641
- panelId: e.lastClose.panelId,
642
- reason: e.lastClose.reason,
643
- at: Date.now(),
644
- note: e.lastClose.reason === "nav-escape-hatch" ? "F21: backdrop-click OR page-nav escape" : void 0
645
- };
646
- t.current = [
647
- ...t.current.slice(-99),
648
- c
649
- ];
650
- }, [e.lastClose]);
651
- const s = z(
652
- () => ke(e),
653
- [e.activePanelId, e.bellCutoutOpen, e.isDirty]
654
- ), a = T(() => t.current.slice(), []);
655
- return { state: e, surfaceState: s, dispatch: n, getCloseLog: a };
656
- }
657
- function on({ children: e }) {
658
- const n = Le(), t = z(
659
- () => n,
660
- // Re-publish only when one of the four coordinator fields changes identity.
661
- // dispatch + getCloseLog are stable. state + surfaceState change on dispatch.
662
- [n.state, n.surfaceState, n.dispatch, n.getCloseLog]
663
- );
664
- return /* @__PURE__ */ i(V.Provider, { value: t, children: e });
665
- }
666
- function Me({ title: e, onClose: n, titleId: t }) {
667
- return /* @__PURE__ */ N("div", { className: "gloss-panel-chrome-v2__header", children: [
668
- e != null && /* @__PURE__ */ i("span", { id: t, className: "gloss-panel-chrome-v2__title", children: e }),
669
- /* @__PURE__ */ i(
670
- "button",
671
- {
672
- id: "panel-close",
673
- type: "button",
674
- "aria-label": "Close panel",
675
- className: "gloss-panel-chrome-v2__close",
676
- onClick: n,
677
- children: "×"
678
- }
679
- )
680
- ] });
681
- }
682
- function Re({ children: e }) {
683
- return /* @__PURE__ */ i(
684
- "div",
685
- {
686
- "data-panel-stage": !0,
687
- "aria-hidden": "true",
688
- className: "gloss-panel-chrome-v2__stage",
689
- children: e
690
- }
691
- );
692
- }
693
- function Fe({ children: e }) {
694
- return /* @__PURE__ */ i("div", { className: "gloss-panel-chrome-v2__navigation", children: e });
695
- }
696
- function Ae({ children: e }) {
697
- return /* @__PURE__ */ i("div", { className: "gloss-panel-chrome-v2__body", children: e });
698
- }
699
- function He({ left: e, right: n }) {
700
- return /* @__PURE__ */ N("div", { className: "gloss-panel-chrome-v2__footer", children: [
701
- /* @__PURE__ */ i("div", { className: "gloss-panel-chrome-v2__footer-left", children: e }),
702
- /* @__PURE__ */ i("div", { className: "gloss-panel-chrome-v2__footer-right", children: n })
703
- ] });
704
- }
705
- function Be({
706
- children: e,
707
- onClose: n,
708
- title: t,
709
- variant: r = "no-stage",
710
- stage: s,
711
- navigation: a,
712
- footer: c
713
- }) {
714
- const o = t == null && r === "with-stage", p = X(), u = t != null;
715
- return /* @__PURE__ */ N(
716
- "div",
717
- {
718
- "data-chrome": "panel-v2",
719
- "data-chrome-variant": r,
720
- "data-headerless": o || void 0,
721
- role: "dialog",
722
- "aria-modal": "true",
723
- "aria-labelledby": u ? p : void 0,
724
- "aria-label": u ? void 0 : "Panel",
725
- className: `gloss-panel-chrome-v2 gloss-panel-chrome-v2--${r}${o ? " gloss-panel-chrome-v2--headerless" : ""}`,
726
- children: [
727
- !o && /* @__PURE__ */ i(Me, { title: t, onClose: n, titleId: p }),
728
- r === "with-stage" && /* @__PURE__ */ i(Re, { children: s }),
729
- a != null && /* @__PURE__ */ i(Fe, { children: a }),
730
- /* @__PURE__ */ i(Ae, { children: e }),
731
- c != null && /* @__PURE__ */ i(He, { left: c.left, right: c.right }),
732
- o && /* @__PURE__ */ i(
733
- "button",
734
- {
735
- id: "panel-close",
736
- type: "button",
737
- "aria-label": "Close panel",
738
- className: "gloss-panel-chrome-v2__close gloss-panel-chrome-v2__close--floating",
739
- onClick: n,
740
- children: "×"
741
- }
742
- )
743
- ]
744
- }
745
- );
746
- }
747
- function sn({ isOpen: e }) {
748
- const n = Pe();
749
- return /* @__PURE__ */ i(
750
- Be,
751
- {
752
- variant: "no-stage",
753
- title: "Notifications",
754
- onClose: () => n?.dispatch({ type: "CLOSE_PANEL", reason: "header-x" }),
755
- children: /* @__PURE__ */ i(
756
- "div",
757
- {
758
- "data-shell": "notification-center",
759
- "data-panel": "notification-center",
760
- "aria-hidden": !e,
761
- children: /* @__PURE__ */ i("p", { children: "No notifications" })
762
- }
763
- )
764
- }
765
- );
766
- }
767
- const Ze = {
768
- position: "relative",
769
- pointerEvents: "auto"
770
- };
771
- function Ke({ children: e, onClose: n, footer: t, title: r, variant: s = "default" }) {
772
- const a = `panel-close-${X().replace(/:/g, "-")}`;
773
- return /* @__PURE__ */ N(
774
- "div",
775
- {
776
- "data-chrome": "panel",
777
- "data-chrome-variant": s,
778
- role: "dialog",
779
- "aria-modal": "true",
780
- className: s === "merged-stage" ? "gloss-panel-chrome gloss-panel-chrome--merged-stage" : "gloss-panel-chrome",
781
- style: Ze,
782
- children: [
783
- /* @__PURE__ */ N("div", { className: "gloss-panel-chrome__header", children: [
784
- r != null && /* @__PURE__ */ i("span", { className: "gloss-panel-chrome__title", children: r }),
785
- /* @__PURE__ */ i(
786
- "button",
787
- {
788
- id: a,
789
- type: "button",
790
- "aria-label": "Close panel",
791
- className: "gloss-panel-chrome__close",
792
- onClick: n,
793
- children: "×"
794
- }
795
- )
796
- ] }),
797
- /* @__PURE__ */ i("div", { className: "gloss-panel-chrome__body", children: e }),
798
- t != null && /* @__PURE__ */ i("div", { className: "gloss-panel-chrome__footer", children: t })
799
- ]
800
- }
801
- );
802
- }
803
- function Ue(e) {
804
- if (process.env.NODE_ENV === "production" || !e || !e.parentElement) return;
805
- const n = e.parentElement, t = window.getComputedStyle(n);
806
- t.perspective === "none" && console.warn(
807
- "[PanelMount] §2.7 violation: parent of .gloss-panel-mount has perspective:none. Rotated mount will render flat. Parent:",
808
- n
809
- ), (t.overflow === "hidden" || t.overflowY === "hidden") && console.warn(
810
- "[PanelMount] §2.9 violation: parent of .gloss-panel-mount has overflow:hidden. Rising panel will be clipped. Parent:",
811
- n
812
- );
813
- }
814
- function ze({ isOpen: e, children: n }) {
815
- const t = ee(), r = O(null);
816
- G(() => {
817
- Ue(r.current);
818
- }, []);
819
- const [s, a] = F(!1);
820
- w(() => {
821
- if (!e) {
822
- a(!1);
823
- return;
824
- }
825
- const o = requestAnimationFrame(() => a(!0));
826
- return () => cancelAnimationFrame(o);
827
- }, [e]);
828
- const c = [
829
- "gloss-panel-mount",
830
- s ? "has-panel" : "",
831
- t ? "reduced-motion" : ""
832
- ].filter(Boolean).join(" ");
833
- return /* @__PURE__ */ i(
834
- "div",
835
- {
836
- ref: r,
837
- className: c,
838
- "data-mount": "panel",
839
- "data-open": e ? "true" : "false",
840
- children: n
841
- }
842
- );
843
- }
844
- const Ve = {
845
- position: "fixed",
846
- top: 0,
847
- left: 0,
848
- right: 0,
849
- height: "var(--tb-h, 60px)",
850
- perspective: "var(--panel-perspective, 1500px)",
851
- perspectiveOrigin: "center bottom",
852
- overflow: "visible",
853
- pointerEvents: "none",
854
- zIndex: 55
855
- }, $e = {
856
- position: "fixed",
857
- top: "var(--tb-h, 60px)",
858
- left: 0,
859
- right: 0,
860
- bottom: 0,
861
- zIndex: 1,
862
- // CR-03 fix: pass-through tint — scrim is visual-only and must not intercept
863
- // grid card clicks. Dismiss is via ESC keydown (see useEffect above) only;
864
- // no scrim-click-to-close by design (prevents accidental dismissal while
865
- // interacting with cards behind the scrim).
866
- pointerEvents: "none",
867
- background: "rgba(0, 0, 0, 0.04)"
868
- };
869
- function ln({ panelComponents: e }) {
870
- const { state: n, dispatch: t, getCloseLog: r } = _e(), s = n.activePanelId ? e[n.activePanelId] : null;
871
- n.activePanelId && !s && process.env.NODE_ENV !== "production" && console.error(
872
- "[panels] No panel component registered for activePanelId:",
873
- n.activePanelId
874
- ), w(() => {
875
- if (n.activePanelId == null) return;
876
- function o(p) {
877
- p.key === "Escape" && t({ type: "CLOSE_PANEL", reason: "escape-key" });
878
- }
879
- return document.addEventListener("keydown", o), () => {
880
- document.removeEventListener("keydown", o);
881
- };
882
- }, [n.activePanelId, t]);
883
- const a = O(n);
884
- G(() => {
885
- a.current = n;
886
- }), w(() => {
887
- if (process.env.NODE_ENV === "production") return;
888
- const o = window;
889
- return o.__panelsHostHandle && console.warn("[panels] multiple PanelHost/PanelHostShell instances mounted; dev handle is unreliable"), o.__panelsHostHandle = {
890
- dispatch: t,
891
- getState: () => a.current,
892
- getCloseLog: r
893
- }, () => {
894
- o.__panelsHostHandle?.dispatch === t && delete o.__panelsHostHandle;
895
- };
896
- }, [t, r]);
897
- const c = n.activePanelId != null && s != null;
898
- return /* @__PURE__ */ N("div", { "data-panel-host": "true", style: Ve, children: [
899
- c && /* @__PURE__ */ i(
900
- "div",
901
- {
902
- "data-panel-scrim": "true",
903
- style: $e
904
- }
905
- ),
906
- /* @__PURE__ */ i(ze, { isOpen: c, children: c && /* @__PURE__ */ i(
907
- Ke,
908
- {
909
- isOpen: !0,
910
- onClose: () => t({ type: "CLOSE_PANEL", reason: "header-x" }),
911
- children: /* @__PURE__ */ i(s, { isOpen: !0 })
912
- }
913
- ) })
914
- ] });
915
- }
916
- const an = {
917
- "apply-button": !0,
918
- // the ONLY commit reason
919
- "cancel-button": !1,
920
- "header-x": !1,
921
- "escape-key": !1,
922
- "page-nav": !1,
923
- "mutex-handoff": !1,
924
- "ghost-anchor": !1,
925
- "viewport-collapse": !1,
926
- unmount: !1,
927
- "nav-escape-hatch": !1,
928
- "drag-start": !1,
929
- // Phase 11.6 D-19 — R9 drag-start auto-close discards buffer
930
- "section-hidden": !1
931
- // 260524 panel-x-axis-transitions — viewport shrank past targetSection
932
- };
933
- export {
934
- an as C,
935
- nn as H,
936
- sn as N,
937
- on as P,
938
- be as S,
939
- en as a,
940
- tn as b,
941
- We as c,
942
- ye as d,
943
- _e as e,
944
- ln as f,
945
- rn as g,
946
- Le as h,
947
- Te as i,
948
- Oe as j,
949
- ke as k,
950
- ge as l,
951
- ee as m,
952
- Be as n,
953
- ze as o,
954
- Je as p,
955
- Me as q,
956
- Ge as r,
957
- Xe as s,
958
- Re as t,
959
- Pe as u,
960
- Fe as v,
961
- Ae as w,
962
- He as x
963
- };