@slotted/react 0.1.0-beta.14 → 0.1.0-beta.16

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 (132) hide show
  1. package/dist/{action-sheet-BAoaxbmI.js → action-sheet-dNnB26br.js} +20 -20
  2. package/dist/action-sheet.js +1 -1
  3. package/dist/{attachment-DKKiNUKe.js → attachment-C1wBuup6.js} +2 -0
  4. package/dist/attachment.js +1 -1
  5. package/dist/calendar-wqDIW4Z8.js +469 -0
  6. package/dist/calendar.js +1 -1
  7. package/dist/{column-manager-DMaWNyXs.js → column-manager-C8fN_mDy.js} +6 -6
  8. package/dist/column-manager.js +1 -1
  9. package/dist/dashboard-grid-ByThIV_n.js +1066 -0
  10. package/dist/dashboard-grid.js +1 -1
  11. package/dist/{data-grid-B5feiNsE.js → data-grid-aHlR2FHu.js} +4 -4
  12. package/dist/data-grid.js +1 -1
  13. package/dist/{data-list-CUvUS2AX.js → data-list-Cu6LtnDX.js} +1 -1
  14. package/dist/data-list.js +1 -1
  15. package/dist/{date-picker-Dys-z9mZ.js → date-picker-B5V8NZCT.js} +1 -1
  16. package/dist/date-picker.js +1 -1
  17. package/dist/{date-range-picker-Cu95hHyO.js → date-range-picker-B89Q973N.js} +1 -1
  18. package/dist/date-range-picker.js +1 -1
  19. package/dist/{datetime-picker-B7eWKoN3.js → datetime-picker-Cx6Z52Ka.js} +1 -1
  20. package/dist/datetime-picker.js +1 -1
  21. package/dist/{datetime-range-picker-Cm42pY3M.js → datetime-range-picker-DYshAlgq.js} +1 -1
  22. package/dist/datetime-range-picker.js +1 -1
  23. package/dist/docs/calendar.json +19 -1
  24. package/dist/docs/calendar.md +3 -1
  25. package/dist/docs/dashboard-grid.json +26 -4
  26. package/dist/docs/dashboard-grid.md +5 -2
  27. package/dist/docs/drawer.examples.md +1 -1
  28. package/dist/docs/drawer.json +18 -7
  29. package/dist/docs/drawer.md +7 -6
  30. package/dist/docs/link.json +16 -0
  31. package/dist/docs/link.md +3 -1
  32. package/dist/docs/list-item.json +10 -2
  33. package/dist/docs/list-item.md +20 -13
  34. package/dist/docs/markdown.json +7 -0
  35. package/dist/docs/markdown.md +1 -0
  36. package/dist/docs/message-scroller.json +1 -1
  37. package/dist/docs/prompt-composer.json +9 -2
  38. package/dist/docs/prompt-composer.md +3 -1
  39. package/dist/drawer-Du1aC1px.js +830 -0
  40. package/dist/drawer.js +2 -2
  41. package/dist/{event-calendar-kX0aS8Pm.js → event-calendar-CEIyV-fW.js} +520 -520
  42. package/dist/event-calendar.js +1 -1
  43. package/dist/{filter-bar-B-Jk5sPq.js → filter-bar-BHzy0o7n.js} +8 -8
  44. package/dist/filter-bar.js +1 -1
  45. package/dist/{import-export-center-BIB7sRCl.js → import-export-center-BX1Bhj8c.js} +1 -1
  46. package/dist/import-export-center.js +1 -1
  47. package/dist/index.js +124 -124
  48. package/dist/{link-rGL3Lr2t.js → link-YvD_Wov8.js} +23 -22
  49. package/dist/link.js +1 -1
  50. package/dist/list-item-2z75VYyp.js +160 -0
  51. package/dist/list-item.js +1 -1
  52. package/dist/markdown-gfrgwq6-.js +311 -0
  53. package/dist/markdown.js +1 -1
  54. package/dist/{prompt-composer-BDOi4rVK.js → prompt-composer-C57BzYrn.js} +109 -77
  55. package/dist/prompt-composer.js +2 -2
  56. package/dist/styles/action-sheet.css +1 -1
  57. package/dist/styles/calendar.css +3 -1
  58. package/dist/styles/chart.css +1 -1
  59. package/dist/styles/column-manager.css +1 -1
  60. package/dist/styles/command-palette.css +1 -1
  61. package/dist/styles/dashboard-grid.css +3 -1
  62. package/dist/styles/data-grid.css +1 -1
  63. package/dist/styles/date-picker.css +3 -1
  64. package/dist/styles/date-range-picker.css +3 -1
  65. package/dist/styles/datetime-picker.css +3 -1
  66. package/dist/styles/datetime-range-picker.css +3 -1
  67. package/dist/styles/detail-panel.css +1 -1
  68. package/dist/styles/dialog.css +1 -1
  69. package/dist/styles/drawer.css +1 -1
  70. package/dist/styles/event-calendar.css +1 -1
  71. package/dist/styles/filter-bar.css +4 -2
  72. package/dist/styles/import-export-center.css +2 -2
  73. package/dist/styles/index.css +11 -11
  74. package/dist/styles/link.css +1 -1
  75. package/dist/styles/markdown.css +1 -1
  76. package/dist/styles/message.css +1 -1
  77. package/dist/styles/prompt-composer.css +1 -1
  78. package/dist/styles/section.css +1 -1
  79. package/dist/styles/stat-card.css +1 -1
  80. package/dist/styles/table.css +2 -2
  81. package/dist/styles/upload.css +1 -1
  82. package/dist/styles.css +1 -1
  83. package/dist/{table-_xX87qua.js → table-BHuKvsgJ.js} +4 -4
  84. package/dist/table.js +1 -1
  85. package/dist/types/calendar/calendar.d.ts +2 -1
  86. package/dist/types/calendar/calendar.d.ts.map +1 -1
  87. package/dist/types/calendar/calendar.types.d.ts +11 -0
  88. package/dist/types/calendar/calendar.types.d.ts.map +1 -1
  89. package/dist/types/calendar/index.d.ts +1 -1
  90. package/dist/types/calendar/index.d.ts.map +1 -1
  91. package/dist/types/dashboard-grid/dashboard-grid.d.ts +1 -1
  92. package/dist/types/dashboard-grid/dashboard-grid.d.ts.map +1 -1
  93. package/dist/types/dashboard-grid/dashboard-grid.types.d.ts +23 -3
  94. package/dist/types/dashboard-grid/dashboard-grid.types.d.ts.map +1 -1
  95. package/dist/types/dashboard-grid/dashboard-widget.d.ts +1 -1
  96. package/dist/types/dashboard-grid/dashboard-widget.d.ts.map +1 -1
  97. package/dist/types/dashboard-grid/index.d.ts +1 -1
  98. package/dist/types/dashboard-grid/index.d.ts.map +1 -1
  99. package/dist/types/drawer/drawer-parts.d.ts +3 -1
  100. package/dist/types/drawer/drawer-parts.d.ts.map +1 -1
  101. package/dist/types/drawer/drawer.types.d.ts +2 -0
  102. package/dist/types/drawer/drawer.types.d.ts.map +1 -1
  103. package/dist/types/drawer/index.d.ts +2 -2
  104. package/dist/types/drawer/index.d.ts.map +1 -1
  105. package/dist/types/link/index.d.ts +1 -1
  106. package/dist/types/link/index.d.ts.map +1 -1
  107. package/dist/types/link/link.d.ts +1 -1
  108. package/dist/types/link/link.d.ts.map +1 -1
  109. package/dist/types/link/link.types.d.ts +7 -0
  110. package/dist/types/link/link.types.d.ts.map +1 -1
  111. package/dist/types/list-item/list-item-content.d.ts +3 -3
  112. package/dist/types/list-item/list-item-content.d.ts.map +1 -1
  113. package/dist/types/list-item/list-item-nesting.d.ts +15 -0
  114. package/dist/types/list-item/list-item-nesting.d.ts.map +1 -0
  115. package/dist/types/list-item/list-item-parts.d.ts +3 -3
  116. package/dist/types/list-item/list-item-parts.d.ts.map +1 -1
  117. package/dist/types/markdown/markdown.d.ts +1 -1
  118. package/dist/types/markdown/markdown.d.ts.map +1 -1
  119. package/dist/types/markdown/markdown.types.d.ts +6 -1
  120. package/dist/types/markdown/markdown.types.d.ts.map +1 -1
  121. package/dist/types/prompt-composer/index.d.ts +2 -2
  122. package/dist/types/prompt-composer/index.d.ts.map +1 -1
  123. package/dist/types/prompt-composer/prompt-composer.d.ts +8 -1
  124. package/dist/types/prompt-composer/prompt-composer.d.ts.map +1 -1
  125. package/dist/types/prompt-composer/prompt-composer.types.d.ts +7 -1
  126. package/dist/types/prompt-composer/prompt-composer.types.d.ts.map +1 -1
  127. package/package.json +6 -6
  128. package/dist/calendar-DZx00W81.js +0 -457
  129. package/dist/dashboard-grid-B9-_lwn6.js +0 -1048
  130. package/dist/drawer-Pk4tqPUV.js +0 -819
  131. package/dist/list-item-CHaJYl5r.js +0 -125
  132. package/dist/markdown-B_lMpWz0.js +0 -306
@@ -1,819 +0,0 @@
1
- import { r as e } from "./i18n-D7xXDd8-.js";
2
- import { n as t, t as n } from "./icon-D04-_QFA.js";
3
- import { keyedProps as r } from "@slotted/core/selector-key";
4
- import { createFocusScope as i } from "@slotted/core/focus";
5
- import { createControllable as a } from "@slotted/core/state";
6
- import { createContext as o, useCallback as s, useContext as c, useEffect as l, useId as u, useImperativeHandle as d, useLayoutEffect as f, useMemo as p, useRef as m, useState as h, useSyncExternalStore as g } from "react";
7
- import { Fragment as ee, jsx as _, jsxs as v } from "react/jsx-runtime";
8
- import { createPresence as y } from "@slotted/core/presence";
9
- import { drawerMessages as b } from "@slotted/core/i18n";
10
- import { createPortalRoot as x } from "@slotted/core/portal";
11
- import { createDismissableLayer as S } from "@slotted/core/dismissable-layer";
12
- import { createPortal as C, flushSync as te } from "react-dom";
13
- import { EXTENT_LARGE_STEP_PX as w, EXTENT_STEP_PX as T, SHEET_FLING_PX_PER_S as ne, addExtentSample as E, anchorsAtStart as D, attachSheetDrag as re, createSheetMotion as O, dampenExtent as k, extentAtPoint as ie, extentBounds as ae, extentVelocity as oe, holdResizeGesture as se, isInlineSide as ce, measureSheetStops as A, sameStop as j, settleExtent as le, sheetMotionHolds as M, stepAmountFromPixels as ue, stepExtent as N, stopAsExtent as P } from "@slotted/core/extent";
14
- import { clamp as F, observeKeyboardInset as I } from "@slotted/core/measure";
15
- //#region src/drawer/drawer-defaults.tsx
16
- var L = o({
17
- back: "close",
18
- escape: "close",
19
- modal: !0,
20
- mode: "overlay",
21
- mount: "active",
22
- outsidePress: "close",
23
- side: "end",
24
- size: void 0,
25
- drag: "panel"
26
- });
27
- function R() {
28
- return c(L);
29
- }
30
- function z({ children: e, ...t }) {
31
- let n = R();
32
- return /* @__PURE__ */ _(L.Provider, {
33
- value: {
34
- back: t.back ?? n.back,
35
- escape: t.escape ?? n.escape,
36
- modal: t.modal ?? n.modal,
37
- mode: t.mode ?? n.mode,
38
- mount: t.mount ?? n.mount,
39
- outsidePress: t.outsidePress ?? n.outsidePress,
40
- side: t.side ?? n.side,
41
- size: t.size ?? n.size,
42
- drag: t.drag ?? n.drag
43
- },
44
- children: e
45
- });
46
- }
47
- //#endregion
48
- //#region src/drawer/drawer.tsx
49
- var de = o(void 0);
50
- function B() {
51
- let e = c(de);
52
- if (e === void 0) throw Error("Every drawer part must be rendered inside Drawer.");
53
- return e;
54
- }
55
- var V = [];
56
- function H({ children: t, back: n, container: r, defaultExtent: i, defaultOpen: o, drag: c, escape: f, extent: g, finalFocus: ee, initialFocus: v, loading: x, maxExtent: S, messages: C, minExtent: te, modal: w, mode: T, mount: ne, onExtentChange: E, onOpenChange: D, onOpenChangeComplete: re, open: O, outsidePress: k, ref: ie, scrimFrom: oe, side: se, size: ce, snapPoints: A }) {
57
- let j = R(), le = e(b, C), M = u(), [ue, N] = h(o ?? !1), P = O ?? ue, [I, L] = h(i), z = g ?? I, [B, H] = h(!1), [U, W] = h(null), [fe, pe] = h(void 0), G = T ?? j.mode, me = G === "inline" ? !1 : w ?? j.modal, K = ne ?? j.mount, q = se ?? j.side, J = ce ?? j.size ?? (q === "top" || q === "bottom" ? "content" : "md"), he = G === "inline" ? "none" : f ?? j.escape, ge = G === "inline" ? "none" : n ?? j.back, _e = G === "inline" ? "none" : k ?? j.outsidePress, Y = A ?? V, X = p(() => {
58
- let e = ae(Y, te ?? .2, S ?? 1);
59
- return J === "content" ? {
60
- ...e,
61
- max: Math.max(e.max, S ?? 1)
62
- } : e;
63
- }, [
64
- S,
65
- te,
66
- J,
67
- Y
68
- ]), [Z, ve] = h(P ? "entering" : "unmounted"), Q = m(null), ye = m(re);
69
- ye.current = re, Q.current === null && (Q.current = y({
70
- onEnterComplete: () => ye.current?.(!0),
71
- onExitComplete: () => ye.current?.(!1),
72
- onStatusChange: ve,
73
- present: P,
74
- skipInitialAnimation: !1
75
- })), l(() => {
76
- Q.current?.sync(P);
77
- }, [P]), l(() => {
78
- P && W(null);
79
- }, [P]), l(() => {
80
- let e = Q.current;
81
- return () => e?.stop();
82
- }, []);
83
- let be = m(P);
84
- P && (be.current = !0);
85
- let xe = G === "inline" || K === "eager" ? !0 : K === "lazy" ? be.current : Z !== "unmounted", Se = m({
86
- layer: null,
87
- panel: null,
88
- trigger: null
89
- }), [Ce, we] = h(!1), [Te, Ee] = h(!1), De = s((e) => (e === "title" ? we(!0) : Ee(!0), () => {
90
- e === "title" ? we(!1) : Ee(!1);
91
- }), []), Oe = s((e) => {
92
- Se.current.layer = e, Q.current?.setNode(e);
93
- }, []), $ = s((e, t, n, r) => {
94
- if (e === P) return;
95
- let i = !1, o = a({
96
- controlled: O,
97
- initial: P,
98
- onRequest: (e) => {
99
- i = e.cancelled, D?.(e.value, {
100
- get cancelled() {
101
- return e.cancelled;
102
- },
103
- cancel: () => e.cancel(),
104
- previous: e.previous,
105
- reason: t,
106
- result: n,
107
- source: e.source,
108
- value: e.value
109
- });
110
- }
111
- }).request(e, t, r);
112
- i || o && N(e);
113
- }, [
114
- P,
115
- D,
116
- O
117
- ]), ke = s((e, t, n) => {
118
- let r = e === void 0 ? void 0 : F(e, 0, X.max);
119
- if (r === z) return;
120
- let i = !1, o = a({
121
- controlled: g,
122
- initial: z,
123
- onRequest: (e) => {
124
- i = e.cancelled, E?.(e.value, {
125
- get cancelled() {
126
- return e.cancelled;
127
- },
128
- cancel: () => e.cancel(),
129
- previous: e.previous,
130
- reason: t,
131
- source: e.source,
132
- value: e.value
133
- });
134
- }
135
- }).request(r, t, n);
136
- i || o && L(r);
137
- }, [
138
- X.max,
139
- z,
140
- g,
141
- E
142
- ]);
143
- d(ie, () => ({
144
- open: () => $(!0, "programmatic", void 0, void 0),
145
- close: (e) => $(!1, "programmatic", e, void 0),
146
- focus: () => Se.current.panel?.focus(),
147
- get panel() {
148
- return Se.current.panel;
149
- }
150
- }), [$]);
151
- let Ae = p(() => ({
152
- announce: De,
153
- close: (e, t, n) => $(!1, e, t, n),
154
- container: r,
155
- descriptionId: Te ? `${M}description` : "",
156
- dragging: B,
157
- drag: c ?? j.drag,
158
- scrimFrom: oe ?? 0,
159
- live: U,
160
- setLive: W,
161
- rest: fe,
162
- setRest: pe,
163
- back: ge,
164
- escape: he,
165
- extent: z,
166
- finalFocus: ee,
167
- initialFocus: v ?? "first",
168
- loading: x === !0,
169
- defaultExtent: i,
170
- maxExtent: X.max,
171
- minExtent: X.min,
172
- modal: me,
173
- mode: G,
174
- mounted: xe,
175
- mount: K,
176
- nodes: Se.current,
177
- open: P,
178
- openWith: (e, t) => $(!0, e, void 0, t),
179
- outsidePress: _e,
180
- panelId: `${M}panel`,
181
- registerLayer: Oe,
182
- requestExtent: ke,
183
- setDragging: H,
184
- side: q,
185
- size: J,
186
- snapPoints: Y,
187
- t: le,
188
- titleId: Ce ? `${M}title` : "",
189
- triggerId: `${M}trigger`,
190
- visible: G === "inline" ? P : Z === "open",
191
- interactive: G === "inline" ? P : Z === "entering" || Z === "open"
192
- }), [
193
- De,
194
- M,
195
- X.max,
196
- X.min,
197
- r,
198
- z,
199
- i,
200
- P,
201
- Te,
202
- j.drag,
203
- c,
204
- B,
205
- U,
206
- fe,
207
- oe,
208
- ee,
209
- v,
210
- x,
211
- xe,
212
- Oe,
213
- ke,
214
- $,
215
- ge,
216
- he,
217
- me,
218
- G,
219
- K,
220
- _e,
221
- q,
222
- J,
223
- Y,
224
- Z,
225
- le,
226
- Ce
227
- ]);
228
- return /* @__PURE__ */ _(de.Provider, {
229
- value: Ae,
230
- children: t
231
- });
232
- }
233
- //#endregion
234
- //#region src/drawer/drawer-parts.tsx
235
- function U(e) {
236
- return e.detail === 0 ? "keyboard" : "pointer";
237
- }
238
- var W = typeof document > "u" ? l : f;
239
- function fe(e) {
240
- return e !== null && getComputedStyle(e).direction === "rtl";
241
- }
242
- function pe(e, t) {
243
- if (e === null) return null;
244
- if (t !== "inline") return e;
245
- let n = e.parentElement;
246
- for (; n !== null && G.has(n);) n = n.parentElement;
247
- return n;
248
- }
249
- var G = /* @__PURE__ */ new WeakSet(), me = () => () => {};
250
- function K() {
251
- return g(me, () => !0, () => !1);
252
- }
253
- function q({ children: e, className: t, onClick: n, ref: i, render: a, style: o, ...s }) {
254
- let c = B(), l = r({
255
- ...s,
256
- "aria-controls": c.mounted ? c.panelId : void 0,
257
- "aria-expanded": c.open,
258
- ...c.mode === "overlay" ? { "aria-haspopup": "dialog" } : {},
259
- children: e,
260
- className: t,
261
- "data-part": "trigger",
262
- ...c.open ? { "data-open": "" } : {},
263
- id: c.triggerId,
264
- onClick: (e) => {
265
- n?.(e), !e.defaultPrevented && (c.open ? c.close(U(e), void 0, e) : c.openWith(U(e), e));
266
- },
267
- ref: (e) => {
268
- c.nodes.trigger = e, typeof i == "function" ? i(e) : i && (i.current = e);
269
- },
270
- style: o,
271
- type: "button"
272
- });
273
- return a === void 0 ? /* @__PURE__ */ _("button", { ...l }) : a(l);
274
- }
275
- function J(e) {
276
- let [t, n] = h(null);
277
- return W(() => {
278
- if (e.mode === "inline" || !e.mounted) return;
279
- let t = x({
280
- origin: e.nodes.trigger,
281
- ...e.container === void 0 ? {} : { container: e.container }
282
- });
283
- return n(t.container), () => {
284
- n(null), t.release();
285
- };
286
- }, [
287
- e.container,
288
- e.mode,
289
- e.mounted,
290
- e.nodes
291
- ]), t;
292
- }
293
- function he(e, t) {
294
- let [n, r] = h(void 0), { mode: i, side: a } = e, o = e.live ?? e.extent;
295
- return W(() => {
296
- let e = pe(t, i);
297
- if (e === null || o === void 0) {
298
- r(void 0);
299
- return;
300
- }
301
- let n = () => {
302
- let t = e.getBoundingClientRect(), n = ce(a) ? t.width : t.height;
303
- n > 0 && r(`${Math.round(o * n)}px`);
304
- };
305
- if (n(), typeof ResizeObserver > "u") return;
306
- let s = new ResizeObserver(n);
307
- return s.observe(e), () => s.disconnect();
308
- }, [
309
- o,
310
- t,
311
- i,
312
- a
313
- ]), n;
314
- }
315
- function ge(e) {
316
- let t = getComputedStyle(e).transitionDuration.split(",").map((e) => e.trim().endsWith("ms") ? Number.parseFloat(e) : Number.parseFloat(e) * 1e3).filter(Number.isFinite), n = Math.max(0, ...t);
317
- return n > 0 ? n : void 0;
318
- }
319
- var _e = "var(--slotted-space-12, 4rem)";
320
- function Y(e, t, n) {
321
- return A({
322
- atRest: e.extent === void 0 && e.live === null,
323
- content: e.size === "content",
324
- panel: t,
325
- reserve: _e,
326
- rest: e.rest,
327
- snapPoints: e.snapPoints,
328
- span: n
329
- });
330
- }
331
- function X(e, t, n) {
332
- return P(t, n, e.size === "content");
333
- }
334
- function Z({ children: e, className: t, ref: n, render: a, style: o, ...c }) {
335
- let u = B(), d = J(u), [f, p] = h(null), [g, y] = h(null), b = he(u, f), x = u.mode === "overlay", w = K(), [T] = h(() => {
336
- if (typeof document > "u") return null;
337
- let e = document.createElement("div");
338
- return e.style.display = "contents", G.add(e), e;
339
- }), ne = s((e) => {
340
- e !== null && T !== null && (G.add(e), x ? d !== null && d.append(T) : e.append(T));
341
- }, [
342
- T,
343
- x,
344
- d
345
- ]), E = m(!1), D = w && T !== null && u.mounted && (!x || d !== null || E.current);
346
- W(() => {
347
- E.current = D;
348
- });
349
- let ie = !x || d !== null, ae = u.titleId !== "" && c["aria-label"] === void 0 && (x || c.role !== void 0), { registerLayer: oe } = u, se = s((e) => {
350
- p(e), oe(e);
351
- }, [oe]), A = m(u);
352
- A.current = u, l(() => {
353
- if (g === null || f === null || !u.open || !ie) return;
354
- let e = u.nodes.trigger === null ? [] : [u.nodes.trigger], t = x ? S(f, {
355
- back: u.modal && u.back === "close",
356
- branches: e,
357
- content: g,
358
- escape: u.escape === "close",
359
- modal: u.modal,
360
- onDismiss: (e) => {
361
- if (e.reason === "outsidePress" && A.current.outsidePress === "none") return e.cancel();
362
- A.current.close(e.reason, void 0, e.source);
363
- },
364
- outsidePress: u.outsidePress === "close",
365
- outsidePressEvent: "click"
366
- }) : null, n = u.initialFocus, r = u.finalFocus, a = g.ownerDocument.activeElement, o = a?.parentElement ?? null, s = i(g, {
367
- contain: x && u.modal,
368
- initial: x ? typeof n == "object" && n ? () => n.current : n : !1,
369
- restore: r === void 0 ? () => {
370
- if (a === null || a === a.ownerDocument.body) return A.current.nodes.trigger;
371
- if (a.isConnected) return a;
372
- let e = o;
373
- for (; e !== null && !e.isConnected;) e = e.parentElement;
374
- return e;
375
- } : r === !1 ? !1 : () => r.current
376
- });
377
- return s.enter(), () => {
378
- t?.destroy(), s.destroy();
379
- };
380
- }, [
381
- u.back,
382
- u.escape,
383
- u.finalFocus,
384
- u.initialFocus,
385
- u.modal,
386
- u.open,
387
- u.outsidePress,
388
- f,
389
- x,
390
- g,
391
- ie
392
- ]);
393
- let { setRest: ue, open: N, extent: P, live: F, dragging: L } = u;
394
- W(() => {
395
- let e = pe(f, u.mode);
396
- if (g === null || e === null || !N || P !== void 0 || F !== null || L) return;
397
- let t = ce(u.side), n = () => {
398
- if (M(g)) return;
399
- let n = e.getBoundingClientRect(), r = t ? n.width : n.height;
400
- if (r <= 0) return;
401
- let i = t ? g.offsetWidth : g.offsetHeight;
402
- ue(Math.round(i / r * 1e3) / 1e3);
403
- };
404
- if (typeof ResizeObserver > "u") {
405
- n();
406
- return;
407
- }
408
- let r = new ResizeObserver(n);
409
- return r.observe(g), r.observe(e), () => r.disconnect();
410
- }, [
411
- f,
412
- u.mode,
413
- u.side,
414
- L,
415
- P,
416
- N,
417
- F,
418
- g,
419
- ue
420
- ]), l(() => {
421
- if (!x || f === null || !N) return;
422
- let e = I(f.ownerDocument.defaultView, (e) => {
423
- e === 0 ? f.style.removeProperty("--slotted-keyboard-inset") : f.style.setProperty("--slotted-keyboard-inset", `${e}px`);
424
- });
425
- return () => {
426
- e(), f.style.removeProperty("--slotted-keyboard-inset");
427
- };
428
- }, [
429
- N,
430
- f,
431
- x
432
- ]);
433
- let R = x && u.side === "bottom" && u.drag === "panel", z = m(null);
434
- if (l(() => {
435
- if (!R || g === null || f === null || !N) return;
436
- let e = 0, t = 0, n = 0, r = {
437
- rest: void 0,
438
- stops: []
439
- }, i = !1, a = O(g);
440
- z.current = a;
441
- let o = () => (e = f.getBoundingClientRect().height, e > 0 ? (a.visible() ?? g.offsetHeight) / e : 0), s = () => {
442
- a.end(), f.toggleAttribute("data-undimmed", i);
443
- }, c = () => a.holds() && r.stops.length > 0 ? r : Y(A.current, g, e);
444
- return re(g, {
445
- enabled: () => A.current.open,
446
- canGrow: () => {
447
- let e = o(), t = c().stops.at(-1);
448
- return t !== void 0 && e < t && !j(e, t);
449
- },
450
- onStart: () => {
451
- let s = a.holds(), l = o();
452
- r = c(), s || (i = f.hasAttribute("data-undimmed")), t = a.begin(l * e, (r.stops.at(-1) ?? 0) * e) / e, n = t, f.toggleAttribute("data-dragging", !0);
453
- },
454
- onMove: (i) => {
455
- if (e <= 0) return;
456
- n = Math.max(0, t + i / e);
457
- let o = r.stops.at(-1) ?? t, s = k(n, o);
458
- a.follow(s * e), f.toggleAttribute("data-undimmed", s < A.current.scrimFrom);
459
- },
460
- onEnd: (i) => {
461
- let o = A.current;
462
- f.toggleAttribute("data-dragging", !1);
463
- let c = le({
464
- fraction: Math.min(n, r.stops.at(-1) ?? n),
465
- span: e,
466
- stops: r.stops,
467
- velocity: e > 0 ? i / e : 0
468
- });
469
- if (c === "close") {
470
- a.settle(0, i, ge(f)), o.close("pointer", void 0, null), requestAnimationFrame(() => {
471
- A.current.open && a.settle(t * e, 0).then(s);
472
- });
473
- return;
474
- }
475
- a.settle(c * e, i).then(() => {
476
- te(() => {
477
- o.requestExtent(X(o, c, r.rest), "pointer", null);
478
- }), s();
479
- });
480
- }
481
- });
482
- }, [
483
- N,
484
- f,
485
- g,
486
- R
487
- ]), l(() => () => {
488
- z.current?.end(), z.current = null;
489
- }, [g]), !u.mounted) return null;
490
- if (!w || T === null) {
491
- if (x) return null;
492
- } else if (!D) return null;
493
- let de = x && u.side === "bottom" && (u.size === "full" || u.extent !== void 0 && j(u.extent, 1)), V = r({
494
- ...c,
495
- ...u.descriptionId === "" ? {} : { "aria-describedby": u.descriptionId },
496
- ...ae ? { "aria-labelledby": u.titleId } : {},
497
- ...u.modal ? { "aria-modal": !0 } : {},
498
- children: e,
499
- className: t,
500
- "data-part": "panel",
501
- id: u.panelId,
502
- ref: (e) => {
503
- y(e), u.nodes.panel = e, typeof n == "function" ? n(e) : n && (n.current = e);
504
- },
505
- ...x ? { role: "dialog" } : {},
506
- style: o
507
- }), H = /* @__PURE__ */ v("div", {
508
- "data-mode": u.mode,
509
- "data-mount": u.mount,
510
- "data-part": "root",
511
- "data-part-root": "",
512
- "data-side": u.side,
513
- "data-size": u.size,
514
- "data-ui": "drawer",
515
- "data-ui-drawer": "",
516
- ...u.dragging ? { "data-dragging": "" } : {},
517
- ...x && u.side === "bottom" ? { "data-drag": u.drag } : {},
518
- ...de ? { "data-expanded": "" } : {},
519
- ...x && (u.live ?? u.extent ?? u.rest ?? 1) < u.scrimFrom ? { "data-undimmed": "" } : {},
520
- ...u.loading ? { "data-loading": "" } : {},
521
- ...u.modal ? { "data-modal": "" } : {},
522
- ...u.interactive ? {} : { inert: !0 },
523
- ...u.visible ? { "data-open": "" } : {},
524
- ref: se,
525
- style: b === void 0 ? void 0 : { "--slotted-drawer-extent": b },
526
- children: [x ? /* @__PURE__ */ _("div", {
527
- "data-part": "backdrop",
528
- "data-part-backdrop": ""
529
- }) : null, a === void 0 ? /* @__PURE__ */ _("div", { ...V }) : a(V)]
530
- });
531
- return !w || T === null ? /* @__PURE__ */ _("div", {
532
- style: ve,
533
- children: H
534
- }) : /* @__PURE__ */ v(ee, { children: [/* @__PURE__ */ _("div", {
535
- ref: ne,
536
- style: ve
537
- }), C(H, T)] });
538
- }
539
- var ve = { display: "contents" }, Q = 3;
540
- function ye({ className: e, largeStep: t = w, onDoubleClick: n, onKeyDown: i, onPointerDown: a, ref: o, render: s, step: c = T, style: u, ...d }) {
541
- let f = B(), p = m(null), h = m(null), g = m([]), y = m(null), b = m(null), x = m(null), S = m(null), C = m(null), re = m(null), k = m(null);
542
- l(() => () => S.current?.end(), []);
543
- let ae = m(f);
544
- ae.current = f;
545
- let A = ce(f.side), M = f.live ?? f.extent ?? f.rest ?? f.minExtent, P = (e) => Math.round(F(e, 0, 1) * 100), I = () => {
546
- let e = pe(f.nodes.layer, f.mode);
547
- return e === null ? null : e.getBoundingClientRect();
548
- }, L = () => {
549
- let e = f.nodes.panel, t = I();
550
- return e === null || t === null || f.snapPoints.length === 0 ? {
551
- rest: f.rest,
552
- stops: []
553
- } : Y(f, e, A ? t.width : t.height);
554
- }, R = (e, t) => {
555
- h.current = e, f.requestExtent(e, "pointer", t);
556
- }, z = (e, t) => ie({
557
- point: {
558
- x: e.clientX,
559
- y: e.clientY
560
- },
561
- rect: t,
562
- rtl: fe(p.current),
563
- side: f.side
564
- }), de = (e) => {
565
- if (a?.(e), e.defaultPrevented || e.button !== 0) return;
566
- let t = I();
567
- t !== null && (e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), e.currentTarget.focus(), y.current = {
568
- before: f.extent,
569
- moved: !1,
570
- offset: M - z(e, t),
571
- x: e.clientX,
572
- y: e.clientY
573
- }, g.current = []);
574
- }, V = (e) => {
575
- let t = y.current;
576
- if (t === null) return;
577
- let n = k.current;
578
- if (S.current !== null && n !== null) {
579
- let r = F((n.bottom - e.clientY) / n.height + t.offset, 0, 1);
580
- g.current = E(g.current, {
581
- at: e.timeStamp,
582
- fraction: r
583
- }), h.current = r, S.current.follow(r * n.height);
584
- return;
585
- }
586
- let r = I();
587
- if (r === null) return;
588
- if (!t.moved) {
589
- if (Math.hypot(e.clientX - t.x, e.clientY - t.y) < Q) return;
590
- t.moved = !0, x.current?.(), x.current = se(p.current?.ownerDocument, A ? "col-resize" : "row-resize");
591
- let n = f.nodes.panel, i = f.nodes.layer;
592
- if (f.side === "bottom" && f.mode === "overlay" && n !== null && i !== null) {
593
- let a = O(n), o = a.holds(), s = a.visible() ?? (n.offsetHeight || M * r.height);
594
- C.current = o && re.current || L(), re.current = C.current;
595
- let c = C.current.stops.at(-1) ?? f.maxExtent, l = a.begin(s, c * r.height);
596
- S.current = a, k.current = r, i.toggleAttribute("data-dragging", !0), t.offset = l / r.height - (r.bottom - t.y) / r.height, V(e);
597
- return;
598
- }
599
- f.setDragging(!0);
600
- }
601
- let i = F(z(e, r) + t.offset, 0, 1);
602
- g.current = E(g.current, {
603
- at: e.timeStamp,
604
- fraction: i
605
- }), R(i, e);
606
- }, H = (e) => {
607
- let { rest: t, stops: n } = L();
608
- if (n.length < 2) return;
609
- let r = f.live ?? f.extent ?? t ?? M, i = n.find((e) => e > r && !j(e, r)) ?? n[0];
610
- f.requestExtent(X(f, i, t), "pointer", e);
611
- }, U = (e) => {
612
- let t = y.current;
613
- if (t === null) return;
614
- if (y.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), !t.moved) {
615
- e.type === "pointerup" && H(e);
616
- return;
617
- }
618
- x.current?.(), x.current = null;
619
- let n = S.current;
620
- S.current = null;
621
- let r = k.current ?? I();
622
- k.current = null, n === null ? f.setDragging(!1) : f.nodes.layer?.toggleAttribute("data-dragging", !1);
623
- let i = r === null ? 0 : A ? r.width : r.height, a = h.current ?? M, o = e.type === "pointercancel" ? 0 : oe(g.current, e.timeStamp);
624
- h.current = null, g.current = [];
625
- let { rest: s, stops: c } = n && C.current || L();
626
- C.current = null;
627
- let l = c.length > 0 ? le({
628
- fraction: a,
629
- span: i,
630
- stops: c,
631
- velocity: o
632
- }) : a < f.minExtent || o * i <= -ne ? "close" : F(a, f.minExtent, f.maxExtent), u = (t) => f.requestExtent(c.length > 0 ? X(f, t, s) : t, "pointer", e);
633
- if (l === "close") {
634
- let r = f.nodes.layer, a = c.length > 0 ? c[0] : f.minExtent;
635
- n?.settle(0, o * i, r ? ge(r) : void 0), f.close("pointer", void 0, e), n === null && f.requestExtent(t.before, "pointer", e), requestAnimationFrame(() => {
636
- ae.current.open && (ae.current.requestExtent(a, "pointer", e), n !== null && n.settle(a * i, 0).then(n.end));
637
- });
638
- return;
639
- }
640
- if (n === null) {
641
- u(l);
642
- return;
643
- }
644
- n.settle(l * i, o * i).then(() => {
645
- te(() => u(l)), n.end();
646
- });
647
- }, W = (e) => {
648
- if (i?.(e), e.defaultPrevented) return;
649
- let n = D(f.side, fe(p.current)), r = A ? "ArrowLeft" : "ArrowUp", a = A ? "ArrowRight" : "ArrowDown", o = (n) => {
650
- e.preventDefault();
651
- let r = I(), i = r === null ? 0 : ue({
652
- pixels: e.shiftKey ? t : c,
653
- rect: r,
654
- side: f.side
655
- }), { rest: a, stops: o } = L(), s = N({
656
- amount: i,
657
- direction: n,
658
- fraction: M,
659
- max: o.at(-1) ?? f.maxExtent,
660
- min: o[0] ?? f.minExtent,
661
- snapPoints: o
662
- });
663
- f.requestExtent(X(f, s, a), "keyboard", e);
664
- }, s = (t) => {
665
- e.preventDefault();
666
- let { rest: n, stops: r } = L(), i = t === "first" ? r[0] ?? f.minExtent : r.at(-1) ?? f.maxExtent;
667
- f.requestExtent(X(f, i, n), "keyboard", e);
668
- };
669
- switch (e.key) {
670
- case r: return o(n ? -1 : 1);
671
- case a: return o(n ? 1 : -1);
672
- case "Home": return s("first");
673
- case "End": return s("last");
674
- case "Enter": return e.preventDefault(), M > f.minExtent ? (b.current = M, f.requestExtent(f.minExtent, "keyboard", e)) : f.requestExtent(b.current ?? f.maxExtent, "keyboard", e);
675
- default: return;
676
- }
677
- }, G = (e) => {
678
- n?.(e), !e.defaultPrevented && (e.preventDefault(), f.requestExtent(f.defaultExtent, "pointer", e));
679
- }, me = f.size === "content" && f.rest !== void 0 ? Math.min(f.minExtent, f.rest) : f.minExtent, K = r({
680
- "aria-controls": f.panelId,
681
- ...f.titleId === "" ? {} : { "aria-labelledby": f.titleId },
682
- "aria-orientation": A ? "vertical" : "horizontal",
683
- "aria-valuemax": P(f.maxExtent),
684
- "aria-valuemin": P(me),
685
- "aria-valuenow": P(F(M, me, f.maxExtent)),
686
- ...d,
687
- className: e,
688
- "data-part": "resizer",
689
- onDoubleClick: G,
690
- onKeyDown: W,
691
- onLostPointerCapture: U,
692
- onPointerDown: de,
693
- onPointerMove: V,
694
- onPointerUp: U,
695
- role: "separator",
696
- style: u,
697
- tabIndex: 0
698
- }), q = (e) => {
699
- p.current = e, typeof o == "function" ? o(e) : o && (o.current = e);
700
- }, J = /* @__PURE__ */ v(ee, { children: [
701
- /* @__PURE__ */ _("span", {
702
- "aria-hidden": "true",
703
- "data-part": "line",
704
- "data-part-line": ""
705
- }),
706
- /* @__PURE__ */ _("span", {
707
- "aria-hidden": "true",
708
- "data-part": "grip",
709
- "data-part-grip": ""
710
- }),
711
- /* @__PURE__ */ _("span", {
712
- "aria-hidden": "true",
713
- "data-part": "line",
714
- "data-part-line": ""
715
- })
716
- ] });
717
- return s === void 0 ? /* @__PURE__ */ _("div", {
718
- ...K,
719
- ref: q,
720
- children: J
721
- }) : s({
722
- ...K,
723
- children: J,
724
- ref: q
725
- });
726
- }
727
- function be({ children: e, className: t, ref: n, render: i, style: a, ...o }) {
728
- let s = r({
729
- ...o,
730
- children: e,
731
- className: t,
732
- "data-part": "header",
733
- style: a
734
- });
735
- return i === void 0 ? /* @__PURE__ */ _("header", {
736
- ...s,
737
- ref: n
738
- }) : i(s);
739
- }
740
- function xe({ children: e, className: t, ref: n, render: i, style: a, ...o }) {
741
- let s = B();
742
- l(() => s.announce("title"), [s]);
743
- let c = r({
744
- ...o,
745
- children: e,
746
- className: t,
747
- "data-part": "title",
748
- id: s.titleId === "" ? void 0 : s.titleId,
749
- style: a
750
- });
751
- return i === void 0 ? /* @__PURE__ */ _("h2", {
752
- ...c,
753
- ref: n
754
- }) : i(c);
755
- }
756
- function Se({ children: e, className: t, ref: n, render: i, style: a, ...o }) {
757
- let s = B();
758
- l(() => s.announce("description"), [s]);
759
- let c = r({
760
- ...o,
761
- children: e,
762
- className: t,
763
- "data-part": "description",
764
- id: s.descriptionId === "" ? void 0 : s.descriptionId,
765
- style: a
766
- });
767
- return i === void 0 ? /* @__PURE__ */ _("p", {
768
- ...c,
769
- ref: n
770
- }) : i(c);
771
- }
772
- function Ce({ children: e, className: t, inset: n, ref: i, render: a, style: o, ...s }) {
773
- let c = B(), l = r({
774
- ...s,
775
- ...c.loading ? { "aria-busy": !0 } : {},
776
- children: e,
777
- className: t,
778
- ...n === void 0 ? {} : { "data-inset": n },
779
- "data-part": "body",
780
- style: o
781
- });
782
- return a === void 0 ? /* @__PURE__ */ _("div", {
783
- ...l,
784
- ref: i
785
- }) : a(l);
786
- }
787
- function we({ children: e, className: t, ref: n, render: i, style: a, ...o }) {
788
- let s = r({
789
- ...o,
790
- children: e,
791
- className: t,
792
- "data-part": "footer",
793
- style: a
794
- });
795
- return i === void 0 ? /* @__PURE__ */ _("footer", {
796
- ...s,
797
- ref: n
798
- }) : i(s);
799
- }
800
- function Te({ children: e, className: i, onClick: a, ref: o, render: s, style: c, value: l, ...u }) {
801
- let d = B(), f = r({
802
- "aria-label": d.t("close"),
803
- ...u,
804
- children: e ?? /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(t, { name: "x" }) }),
805
- className: i,
806
- "data-part": "close",
807
- onClick: (e) => {
808
- a?.(e), !e.defaultPrevented && d.close("dismiss", l, e);
809
- },
810
- style: c,
811
- type: "button"
812
- });
813
- return s === void 0 ? /* @__PURE__ */ _("button", {
814
- ...f,
815
- ref: o
816
- }) : s(f);
817
- }
818
- //#endregion
819
- export { be as a, xe as c, B as d, z as f, we as i, q as l, Te as n, Z as o, R as p, Se as r, ye as s, Ce as t, H as u };