motile-ui 1.0.2 → 1.0.3

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 (44) hide show
  1. package/dist/components/Accordion/Accordion.css +1 -0
  2. package/dist/components/Accordion/Accordion.js +121 -0
  3. package/dist/components/Badge/Badge.css +1 -0
  4. package/dist/components/Badge/Badge.js +24 -0
  5. package/dist/components/Button/Button.css +1 -0
  6. package/dist/components/Button/Button.js +73 -0
  7. package/dist/components/Checkbox/Checkbox.css +1 -0
  8. package/dist/components/Checkbox/Checkbox.js +69 -0
  9. package/dist/components/Dock/Dock.css +1 -0
  10. package/dist/components/Dock/Dock.js +151 -0
  11. package/dist/components/Drawer/Drawer.css +1 -0
  12. package/dist/components/Drawer/Drawer.js +275 -0
  13. package/dist/components/Input/Input.css +1 -0
  14. package/dist/components/Input/Input.js +122 -0
  15. package/dist/components/Modal/Modal.css +1 -0
  16. package/dist/components/Modal/Modal.js +231 -0
  17. package/dist/components/Popover/Popover.css +1 -0
  18. package/dist/components/Popover/Popover.js +197 -0
  19. package/dist/components/Sheet/Sheet.css +1 -0
  20. package/dist/components/Sheet/Sheet.js +283 -0
  21. package/dist/components/Skeleton/Skeleton.css +1 -0
  22. package/dist/components/Skeleton/Skeleton.js +30 -0
  23. package/dist/components/SpeedDial/SpeedDial.css +1 -0
  24. package/dist/components/SpeedDial/SpeedDial.js +149 -0
  25. package/dist/components/Switch/Switch.css +1 -0
  26. package/dist/components/Switch/Switch.js +31 -0
  27. package/dist/components/Textarea/Textarea.css +1 -0
  28. package/dist/components/Textarea/Textarea.js +111 -0
  29. package/dist/components/Toast/Toast.css +1 -0
  30. package/dist/components/Toast/Toast.js +178 -0
  31. package/dist/components/Toast/useToast.js +30 -0
  32. package/dist/components/Tooltip/Tooltip.css +1 -0
  33. package/dist/components/Tooltip/Tooltip.js +321 -0
  34. package/dist/hooks/useClickOutside.js +24 -0
  35. package/dist/hooks/useEscapeKey.js +18 -0
  36. package/dist/hooks/useHistoryClose.js +42 -0
  37. package/dist/hooks/useScrollLock.js +73 -0
  38. package/dist/index.js +42 -0
  39. package/dist/utils/FloatingArrow.js +55 -0
  40. package/dist/utils/Slot.js +44 -0
  41. package/package.json +88 -6
  42. package/dist/index.css +0 -1
  43. package/dist/motile-ui.es.js +0 -2492
  44. package/dist/motile-ui.umd.js +0 -2
@@ -1,2492 +0,0 @@
1
- import T, { forwardRef as B, useId as Q, useRef as C, useEffect as I, useState as A, useMemo as ie, useLayoutEffect as ve, useCallback as k, createContext as X, useContext as G } from "react";
2
- import { jsx as c, jsxs as S, Fragment as nt } from "react/jsx-runtime";
3
- import { createPortal as ae } from "react-dom";
4
- import './index.css';const W = T.forwardRef(
5
- ({ children: e, ...n }, o) => {
6
- if (!T.isValidElement(e))
7
- return null;
8
- const t = rt(e);
9
- return T.cloneElement(e, {
10
- ...st(n, e.props),
11
- ref: o ? it(o, t) : t
12
- });
13
- }
14
- );
15
- W.displayName = "Slot";
16
- function rt(e) {
17
- var t;
18
- let n = (t = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : t.get;
19
- return n && "isReactWarning" in n && n.isReactWarning ? e.ref : e.props.ref || e.ref;
20
- }
21
- function st(e, n) {
22
- const o = { ...n };
23
- e.className && n.className ? o.className = `${n.className} ${e.className}` : e.className && (o.className = e.className), (e.style || n.style) && (o.style = {
24
- ...n.style,
25
- ...e.style
26
- });
27
- for (const t in n) {
28
- const r = e[t], s = n[t];
29
- /^on[A-Z]/.test(t) ? typeof r == "function" && typeof s == "function" ? o[t] = (...i) => {
30
- s(...i), r(...i);
31
- } : typeof r == "function" && (o[t] = r) : t !== "className" && t !== "style" && (o[t] = r ?? s);
32
- }
33
- for (const t in e)
34
- t in o || (o[t] = e[t]);
35
- return o;
36
- }
37
- function it(...e) {
38
- return (n) => {
39
- e.forEach((o) => {
40
- typeof o == "function" ? o(n) : o != null && typeof o == "object" && (o.current = n);
41
- });
42
- };
43
- }
44
- const at = T.forwardRef(
45
- ({
46
- variant: e = "primary",
47
- size: n = "large",
48
- fullWidth: o,
49
- color: t,
50
- hoverOnTouch: r = !1,
51
- isLoading: s = !1,
52
- asChild: a = !1,
53
- children: i,
54
- className: l,
55
- disabled: f,
56
- style: d,
57
- ...u
58
- }, p) => {
59
- const m = "motile-btn", h = o ?? n === "large", y = [
60
- m,
61
- `${m}--${e}`,
62
- `${m}--${n}`,
63
- h && `${m}--full-width`,
64
- (f || s) && `${m}--disabled`,
65
- s && `${m}--loading`,
66
- r && `${m}--hover-on-touch`,
67
- l
68
- ].filter(Boolean).join(" "), $ = {
69
- ...d,
70
- ...t && { "--motile-btn-color": t }
71
- };
72
- return a ? /* @__PURE__ */ c(W, { ref: p, className: y, style: $, ...u, children: i }) : /* @__PURE__ */ c(
73
- "button",
74
- {
75
- ref: p,
76
- type: "button",
77
- className: y,
78
- disabled: f || s,
79
- "aria-busy": s || void 0,
80
- style: $,
81
- ...u,
82
- children: /* @__PURE__ */ S("span", { className: `${m}__wrapper`, children: [
83
- /* @__PURE__ */ c(
84
- "span",
85
- {
86
- className: `${m}__content`,
87
- style: { opacity: s ? 0 : 1 },
88
- children: i
89
- }
90
- ),
91
- s && /* @__PURE__ */ c(
92
- "span",
93
- {
94
- className: `${m}__loading`,
95
- role: "status",
96
- "aria-label": "Loading",
97
- children: /* @__PURE__ */ S("span", { className: `${m}__dots`, children: [
98
- /* @__PURE__ */ c("span", { className: `${m}__dot` }),
99
- /* @__PURE__ */ c("span", { className: `${m}__dot` }),
100
- /* @__PURE__ */ c("span", { className: `${m}__dot` })
101
- ] })
102
- }
103
- )
104
- ] })
105
- }
106
- );
107
- }
108
- );
109
- at.displayName = "Button";
110
- const lt = B(
111
- ({
112
- id: e,
113
- autoFocus: n = !1,
114
- autoSelect: o = !1,
115
- variant: t = "outlined",
116
- isError: r,
117
- errorMessage: s,
118
- onClear: a,
119
- leftIcon: i,
120
- rightIcon: l,
121
- className: f,
122
- value: d,
123
- color: u,
124
- style: p,
125
- maxLength: m,
126
- label: h,
127
- placeholder: y,
128
- ...$
129
- }, v) => {
130
- const N = Q().replace(/:/g, ""), g = e ?? `motile-input-${N}`, R = C(null), x = v || R, w = r ?? !!s;
131
- I(() => {
132
- if (n && x.current) {
133
- const te = setTimeout(() => {
134
- x.current && (x.current.focus(), o && x.current.select());
135
- }, 50);
136
- return () => clearTimeout(te);
137
- }
138
- }, [n, o]);
139
- const b = "motile-input", F = a && d, _ = !!i, q = F || l, U = [
140
- b,
141
- `${b}--${t}`,
142
- w && `${b}--error`,
143
- _ && `${b}--with-left-icon`,
144
- q && `${b}--with-right-content`,
145
- h && `${b}--with-label`,
146
- f
147
- ].filter(Boolean).join(" "), Y = [
148
- `${b}-wrapper`,
149
- h && `${b}-wrapper--with-label`,
150
- w && `${b}-wrapper--shake`
151
- ].filter(Boolean).join(" "), L = [
152
- `${b}__label`,
153
- w && `${b}__label--error`
154
- ].filter(Boolean).join(" "), E = u ? { "--motile-input-color": u } : void 0, M = {
155
- ...p
156
- }, K = d ? String(d).length : 0, H = m !== void 0, ee = [
157
- $["aria-describedby"],
158
- s ? `${g}-error` : void 0,
159
- H ? `${g}-counter` : void 0
160
- ].filter(Boolean).join(" ") || void 0;
161
- return /* @__PURE__ */ S("div", { className: `${b}-root`, children: [
162
- /* @__PURE__ */ S("div", { className: Y, style: E, children: [
163
- h && /* @__PURE__ */ c("label", { className: L, htmlFor: g, children: h }),
164
- i && /* @__PURE__ */ c("div", { className: `${b}__left-icon`, children: i }),
165
- /* @__PURE__ */ c(
166
- "input",
167
- {
168
- id: g,
169
- ...$,
170
- "aria-describedby": ee,
171
- "aria-invalid": w || void 0,
172
- ref: x,
173
- className: U,
174
- value: d,
175
- maxLength: m,
176
- style: M,
177
- placeholder: h ? y || " " : y
178
- }
179
- ),
180
- l && !F && /* @__PURE__ */ c("div", { className: `${b}__right-icon`, children: l }),
181
- F && /* @__PURE__ */ c(
182
- "button",
183
- {
184
- type: "button",
185
- onClick: a,
186
- className: `${b}__clear-button`,
187
- "aria-label": "지우기",
188
- children: /* @__PURE__ */ c(
189
- "svg",
190
- {
191
- className: `${b}__clear-icon`,
192
- viewBox: "0 0 20 20",
193
- fill: "currentColor",
194
- children: /* @__PURE__ */ c("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" })
195
- }
196
- )
197
- }
198
- )
199
- ] }),
200
- (s || H) && /* @__PURE__ */ S(
201
- "div",
202
- {
203
- className: `${b}__helper-text ${s && H ? `${b}__helper-text--both` : s ? `${b}__helper-text--error-only` : `${b}__helper-text--counter-only`}`,
204
- children: [
205
- s && /* @__PURE__ */ c(
206
- "span",
207
- {
208
- id: `${g}-error`,
209
- className: `${b}__error-message`,
210
- role: "alert",
211
- children: s
212
- }
213
- ),
214
- H && /* @__PURE__ */ S("span", { id: `${g}-counter`, className: `${b}__counter`, children: [
215
- K,
216
- "/",
217
- m
218
- ] })
219
- ]
220
- }
221
- )
222
- ] });
223
- }
224
- );
225
- lt.displayName = "Input";
226
- const ct = B(
227
- ({
228
- autoFocus: e = !1,
229
- autoSelect: n = !1,
230
- isError: o,
231
- errorMessage: t,
232
- className: r,
233
- value: s,
234
- color: a,
235
- style: i,
236
- maxLength: l,
237
- label: f,
238
- placeholder: d,
239
- rows: u = 4,
240
- resize: p = "none",
241
- autoSize: m = !1,
242
- ...h
243
- }, y) => {
244
- const $ = C(null), v = y || $, [N, g] = A({ height: void 0, isMaxHeight: !1 }), R = o ?? !!t, x = ie(() => typeof m == "boolean" ? m ? { minRows: u, maxRows: void 0 } : void 0 : m ? {
245
- minRows: m.minRows ?? u,
246
- maxRows: m.maxRows
247
- } : void 0, [m, u]);
248
- I(() => {
249
- if (e && v.current) {
250
- const M = setTimeout(() => {
251
- v.current && (v.current.focus(), n && v.current.select());
252
- }, 50);
253
- return () => clearTimeout(M);
254
- }
255
- }, [e, n]), ve(() => {
256
- if (!x || !v.current) return;
257
- const M = v.current;
258
- M.style.height = "auto";
259
- const K = M.scrollHeight, H = window.getComputedStyle(M), ee = parseInt(H.lineHeight, 10), te = parseInt(H.paddingTop, 10), z = parseInt(H.paddingBottom, 10), pe = parseInt(H.borderTopWidth, 10), P = parseInt(H.borderBottomWidth, 10), j = te + z + pe + P, O = x.minRows ? ee * x.minRows + j : void 0, J = x.maxRows ? ee * x.maxRows + j : void 0;
260
- let V = K, Z = !1;
261
- O !== void 0 && V < O && (V = O), J !== void 0 && V > J && (V = J, Z = !0), M.style.height = `${V}px`, g((re) => V !== re.height || Z !== re.isMaxHeight ? { height: V, isMaxHeight: Z } : re);
262
- }, [s, x]);
263
- const w = "motile-textarea", b = [
264
- w,
265
- R && `${w}--error`,
266
- R && `${w}--shake`,
267
- f && `${w}--with-label`,
268
- r
269
- ].filter(Boolean).join(" "), F = [
270
- `${w}-wrapper`,
271
- f && `${w}-wrapper--with-label`
272
- ].filter(Boolean).join(" "), _ = [
273
- `${w}__label`,
274
- R && `${w}__label--error`
275
- ].filter(Boolean).join(" "), q = a ? { "--motile-textarea-color": a } : void 0, U = {
276
- ...i,
277
- resize: x ? "none" : p,
278
- ...x ? {
279
- height: N.height !== void 0 ? N.height : "auto",
280
- minHeight: "auto",
281
- overflowY: N.isMaxHeight ? "auto" : "hidden"
282
- } : {}
283
- }, Y = s ? String(s).length : 0, L = l !== void 0, E = [
284
- h["aria-describedby"],
285
- t ? `${w}-error` : void 0
286
- ].filter(Boolean).join(" ") || void 0;
287
- return /* @__PURE__ */ S("div", { className: `${w}-root`, children: [
288
- /* @__PURE__ */ S("div", { className: F, style: q, children: [
289
- f && /* @__PURE__ */ c("label", { className: _, children: f }),
290
- /* @__PURE__ */ c(
291
- "textarea",
292
- {
293
- ...h,
294
- "aria-describedby": E,
295
- ref: v,
296
- className: b,
297
- value: s,
298
- maxLength: l,
299
- rows: u,
300
- style: U,
301
- placeholder: f ? d || " " : d
302
- }
303
- )
304
- ] }),
305
- (t || L) && /* @__PURE__ */ S(
306
- "div",
307
- {
308
- className: `${w}__helper-text ${t && L ? `${w}__helper-text--both` : t ? `${w}__helper-text--error-only` : `${w}__helper-text--counter-only`}`,
309
- children: [
310
- t && /* @__PURE__ */ c(
311
- "span",
312
- {
313
- id: `${w}-error`,
314
- className: `${w}__error-message`,
315
- role: "alert",
316
- children: t
317
- }
318
- ),
319
- L && /* @__PURE__ */ S("span", { className: `${w}__counter`, children: [
320
- Y,
321
- "/",
322
- l
323
- ] })
324
- ]
325
- }
326
- )
327
- ] });
328
- }
329
- );
330
- ct.displayName = "Textarea";
331
- const dt = B(
332
- ({
333
- variant: e = "standard",
334
- size: n = "medium",
335
- label: o,
336
- color: t,
337
- filled: r = !1,
338
- className: s,
339
- disabled: a,
340
- style: i,
341
- ...l
342
- }, f) => {
343
- const d = "motile-checkbox", u = [
344
- `${d}-container`,
345
- `${d}-container--${e}`,
346
- `${d}-container--${n}`,
347
- a && `${d}-container--disabled`,
348
- r && `${d}-container--filled`
349
- ].filter(Boolean).join(" "), p = [
350
- d,
351
- `${d}--${e}`,
352
- `${d}--${n}`,
353
- r && `${d}--filled`,
354
- s
355
- ].filter(Boolean).join(" "), m = [
356
- `${d}__label`,
357
- a && `${d}__label--disabled`
358
- ].filter(Boolean).join(" ");
359
- return /* @__PURE__ */ c("div", { className: u, style: t ? { "--motile-checkbox-color": t } : void 0, children: /* @__PURE__ */ S("label", { className: `${d}-wrapper`, children: [
360
- /* @__PURE__ */ c(
361
- "input",
362
- {
363
- ...l,
364
- ref: f,
365
- type: "checkbox",
366
- className: p,
367
- disabled: a,
368
- style: i
369
- }
370
- ),
371
- /* @__PURE__ */ c("span", { className: `${d}__mark`, children: /* @__PURE__ */ c(
372
- "svg",
373
- {
374
- className: `${d}__check-icon`,
375
- viewBox: "0 0 16 16",
376
- fill: "none",
377
- children: /* @__PURE__ */ c(
378
- "path",
379
- {
380
- d: "M13.5 4L6 11.5L2.5 8",
381
- stroke: "currentColor",
382
- strokeWidth: "2",
383
- strokeLinecap: "round",
384
- strokeLinejoin: "round"
385
- }
386
- )
387
- }
388
- ) }),
389
- o && /* @__PURE__ */ c("span", { className: m, children: o })
390
- ] }) });
391
- }
392
- );
393
- dt.displayName = "Checkbox";
394
- const ut = B(
395
- ({ variant: e = "smooth", color: n, className: o, disabled: t, style: r, ...s }, a) => {
396
- const i = "motile-switch", l = [
397
- `${i}-container`,
398
- `${i}-container--${e}`,
399
- t && `${i}-container--disabled`
400
- ].filter(Boolean).join(" "), f = [i, `${i}--${e}`, o].filter(Boolean).join(" ");
401
- return /* @__PURE__ */ c("div", { className: l, style: n ? { "--motile-switch-color": n } : void 0, children: /* @__PURE__ */ S("label", { className: `${i}-wrapper`, children: [
402
- /* @__PURE__ */ c(
403
- "input",
404
- {
405
- ...s,
406
- ref: a,
407
- type: "checkbox",
408
- className: f,
409
- disabled: t,
410
- style: r,
411
- role: "switch"
412
- }
413
- ),
414
- /* @__PURE__ */ c("span", { className: `${i}__track`, children: /* @__PURE__ */ c("span", { className: `${i}__thumb` }) })
415
- ] }) });
416
- }
417
- );
418
- ut.displayName = "Switch";
419
- const oe = "motile-accordion", we = X(null), be = () => {
420
- const e = G(we);
421
- if (!e)
422
- throw new Error("AccordionHeader/Content must be used within <Accordion>");
423
- return e;
424
- }, ge = B(
425
- ({
426
- variant: e = "filled",
427
- defaultExpanded: n = !1,
428
- expanded: o,
429
- onChange: t,
430
- disabled: r = !1,
431
- className: s,
432
- children: a,
433
- asChild: i = !1,
434
- ...l
435
- }, f) => {
436
- const [d, u] = A(n), p = o !== void 0, m = p ? o : d, y = `accordion-panel-${Q()}`, $ = C(null), v = k(() => {
437
- if (r) return;
438
- const R = !m;
439
- p || u(R), t == null || t(R);
440
- }, [r, m, p, t]), N = {
441
- ...l,
442
- "data-state": m ? "open" : "closed",
443
- "data-disabled": r ? "" : void 0,
444
- "data-variant": e
445
- }, g = [
446
- oe,
447
- `${oe}--${e}`,
448
- m && `${oe}--expanded`,
449
- r && `${oe}--disabled`,
450
- s
451
- ].filter(Boolean).join(" ");
452
- return /* @__PURE__ */ c(
453
- we.Provider,
454
- {
455
- value: { isOpen: m, toggle: v, disabled: r, variant: e, panelId: y, panelRef: $ },
456
- children: i ? /* @__PURE__ */ c(W, { ref: f, ...N, className: s, children: a }) : /* @__PURE__ */ c("div", { ...N, ref: f, className: g, children: a })
457
- }
458
- );
459
- }
460
- );
461
- ge.displayName = "Accordion";
462
- const $e = B(
463
- ({ className: e, children: n, asChild: o = !1, ...t }, r) => {
464
- const { isOpen: s, toggle: a, disabled: i, panelId: l } = be(), f = {
465
- ...t,
466
- onClick: (u) => {
467
- var p;
468
- (p = t.onClick) == null || p.call(t, u), a();
469
- },
470
- "aria-expanded": s,
471
- "aria-controls": l,
472
- "aria-disabled": i,
473
- type: "button",
474
- disabled: i,
475
- "data-state": s ? "open" : "closed",
476
- "data-disabled": i ? "" : void 0
477
- };
478
- if (o)
479
- return /* @__PURE__ */ c(W, { ref: r, ...f, className: e, children: n });
480
- const d = [`${oe}__header`, e].filter(Boolean).join(" ");
481
- return /* @__PURE__ */ c("button", { ...f, ref: r, className: d, children: n });
482
- }
483
- );
484
- $e.displayName = "Accordion.Header";
485
- const _e = B(
486
- ({ className: e, children: n, asChild: o = !1, ...t }, r) => {
487
- const { isOpen: s, panelId: a, panelRef: i } = be(), l = k(() => {
488
- const u = i.current;
489
- if (!u) return;
490
- if (typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
491
- u.style.height = s ? "auto" : "0px";
492
- return;
493
- }
494
- if (s) {
495
- (u.style.height === "" || u.style.height === "auto") && (u.style.height = "0px"), u.getBoundingClientRect(), u.style.height = `${u.scrollHeight}px`;
496
- const m = () => {
497
- s && (u.style.height = "auto"), u.removeEventListener("transitionend", m);
498
- };
499
- u.addEventListener("transitionend", m);
500
- } else
501
- (u.style.height === "" || u.style.height === "auto") && (u.style.height = `${u.scrollHeight}px`), u.getBoundingClientRect(), u.style.height = "0px";
502
- }, [s, i]);
503
- I(() => {
504
- const u = i.current;
505
- if (u)
506
- return u.style.willChange = "height", l(), () => {
507
- u.style.willChange = "";
508
- };
509
- }, [l, i]);
510
- const f = {
511
- ...t,
512
- "aria-hidden": !s,
513
- "data-state": s ? "open" : "closed"
514
- }, d = [`${oe}__content`, e].filter(Boolean).join(" ");
515
- return /* @__PURE__ */ c(
516
- "div",
517
- {
518
- id: a,
519
- ref: i,
520
- className: `${oe}__panel`,
521
- "aria-hidden": !s,
522
- "data-state": s ? "open" : "closed",
523
- children: o ? /* @__PURE__ */ c(W, { ref: r, ...f, className: e, children: n }) : /* @__PURE__ */ c("div", { ...f, ref: r, className: d, children: n })
524
- }
525
- );
526
- }
527
- );
528
- _e.displayName = "Accordion.Content";
529
- const jt = Object.assign(ge, {
530
- Header: $e,
531
- Content: _e
532
- }), Vt = ({
533
- width: e = "100%",
534
- height: n = "1rem",
535
- borderRadius: o = "4px",
536
- className: t,
537
- style: r,
538
- ...s
539
- }) => {
540
- const i = ["motile-skeleton", t].filter(Boolean).join(" "), l = (d, u) => d === void 0 ? u : typeof d == "number" ? `${d}px` : d, f = {
541
- ...r,
542
- width: l(e, "100%"),
543
- height: l(n, "1rem"),
544
- borderRadius: l(o, "4px")
545
- };
546
- return /* @__PURE__ */ c(
547
- "div",
548
- {
549
- className: i,
550
- style: f,
551
- "aria-busy": "true",
552
- "aria-live": "polite",
553
- ...s
554
- }
555
- );
556
- }, mt = T.forwardRef(
557
- ({ variant: e, size: n = "medium", color: o, className: t, children: r, style: s, ...a }, i) => {
558
- const l = "motile-badge", f = [
559
- l,
560
- `${l}--${n}`,
561
- e && `${l}--${e}`,
562
- t
563
- ].filter(Boolean).join(" "), d = {
564
- ...s,
565
- ...o && { "--motile-badge-color": o }
566
- };
567
- return e === "dot" ? /* @__PURE__ */ S("span", { ref: i, className: f, style: d, ...a, children: [
568
- /* @__PURE__ */ c("span", { className: `${l}__dot` }),
569
- /* @__PURE__ */ c("span", { className: `${l}__text`, children: r })
570
- ] }) : /* @__PURE__ */ c("span", { ref: i, className: f, style: d, ...a, children: r });
571
- }
572
- );
573
- mt.displayName = "Badge";
574
- const me = T.forwardRef(
575
- ({
576
- variant: e = "filled",
577
- color: n,
578
- className: o = "",
579
- style: t,
580
- width: r = 12,
581
- height: s = 8
582
- }, a) => /* @__PURE__ */ c(
583
- "svg",
584
- {
585
- ref: a,
586
- className: o,
587
- width: r,
588
- height: s,
589
- viewBox: `0 0 ${r} ${s}`,
590
- style: {
591
- "--arrow-color": n,
592
- ...t
593
- },
594
- children: e === "filled" ? /* @__PURE__ */ c(
595
- "path",
596
- {
597
- d: `M${r / 2} 1 L${r - 1} ${s - 1} L${r} ${s} L0 ${s} L1 ${s - 1} Z`,
598
- fill: "var(--arrow-color)"
599
- }
600
- ) : /* @__PURE__ */ S(nt, { children: [
601
- /* @__PURE__ */ c(
602
- "path",
603
- {
604
- d: `M-1 ${s - 1} L-0.5 ${s + 0.5} L${r + 0.5} ${s + 0.5} L${r + 1} ${s - 1} L${r - 1} ${s - 1} L${r / 2} 1 L1 ${s - 1} Z`,
605
- fill: "white"
606
- }
607
- ),
608
- /* @__PURE__ */ c(
609
- "path",
610
- {
611
- d: `M1 ${s - 1} L${r / 2} 1 L${r - 1} ${s - 1}`,
612
- fill: "none",
613
- stroke: "var(--arrow-color)",
614
- strokeWidth: "1.2",
615
- strokeLinejoin: "round",
616
- strokeLinecap: "round"
617
- }
618
- )
619
- ] })
620
- }
621
- )
622
- );
623
- me.displayName = "FloatingArrow";
624
- const xe = X(null);
625
- function Ne() {
626
- const e = G(xe);
627
- if (!e)
628
- throw new Error("Tooltip components must be used within Tooltip.Root");
629
- return e;
630
- }
631
- const D = 8;
632
- function ye(e, n, o, t, r, s, a) {
633
- switch (e) {
634
- case "top":
635
- return n.top - r.top - t >= D;
636
- case "bottom":
637
- return n.bottom + r.bottom + t <= a - D;
638
- case "left":
639
- return n.left - r.left - o >= D;
640
- case "right":
641
- return n.right + r.right + o <= s - D;
642
- }
643
- }
644
- function ft(e) {
645
- return [{
646
- top: "bottom",
647
- bottom: "top",
648
- left: "right",
649
- right: "left"
650
- }[e]];
651
- }
652
- function pt(e, n, o, t) {
653
- if (!(o < 768))
654
- return ft(e);
655
- const a = n.top + n.height / 2 < t / 2;
656
- return e === "left" || e === "right" ? [a ? "bottom" : "top", a ? "top" : "bottom", e === "left" ? "right" : "left"] : e === "top" || e === "bottom" ? [e === "top" ? "bottom" : "top"] : [];
657
- }
658
- function ht(e, n, o, t) {
659
- const r = {
660
- top: e.top - n.top - D,
661
- bottom: t - e.bottom - n.bottom - D,
662
- left: e.left - n.left - D,
663
- right: o - e.right - n.right - D
664
- };
665
- let s = "bottom", a = r.bottom;
666
- for (const [i, l] of Object.entries(r))
667
- l > a && (a = l, s = i);
668
- return s;
669
- }
670
- function yt({
671
- children: e,
672
- position: n = "top",
673
- align: o = "center",
674
- variant: t = "filled",
675
- color: r,
676
- showArrow: s = !1,
677
- keepOpen: a = !1,
678
- offset: i
679
- }) {
680
- const l = i === void 0 ? { top: 7, bottom: 6, left: 6, right: 6 } : typeof i == "number" ? { top: i, bottom: i, left: i, right: i } : {
681
- top: i.top ?? 7,
682
- bottom: i.bottom ?? 6,
683
- left: i.left ?? 6,
684
- right: i.right ?? 6
685
- }, f = Q().replace(/:/g, ""), d = C(null), u = C(null), p = C(), [m, h] = A(!1), [y, $] = A(n), [v, N] = A({}), g = C(null), R = k((w, b = 0) => {
686
- p.current && (clearTimeout(p.current), p.current = void 0), !w && b > 0 ? p.current = window.setTimeout(
687
- () => h(!1),
688
- b
689
- ) : h(w);
690
- }, []);
691
- ve(() => {
692
- if (!m || !d.current || !u.current) return;
693
- const w = () => {
694
- if (!d.current || !u.current) return;
695
- const _ = d.current.getBoundingClientRect(), q = u.current;
696
- q.classList.add("measuring"), q.offsetHeight;
697
- const U = window.getComputedStyle(q), Y = parseFloat(U.width), L = parseFloat(U.height);
698
- let E = Y, M = L;
699
- q.classList.remove("measuring");
700
- const K = window.innerWidth, H = window.innerHeight;
701
- (isNaN(E) || E <= 0) && (E = 100), (isNaN(M) || M <= 0) && (M = 50);
702
- const ee = K - D * 2, te = H - D * 2;
703
- E > ee && (E = ee), M > te && (M = te);
704
- let z = n;
705
- if (_.width === 0 && _.height === 0 || ye(n, _, E, M, l, K, H))
706
- z = n;
707
- else {
708
- const Z = pt(n, _, K, H);
709
- let re = !1;
710
- for (const he of Z)
711
- if (ye(he, _, E, M, l, K, H)) {
712
- z = he, re = !0;
713
- break;
714
- }
715
- re || (z = ht(_, l, K, H));
716
- }
717
- let P = 0, j = 0;
718
- if (z === "top" || z === "bottom") {
719
- switch (o) {
720
- case "start":
721
- P = _.left;
722
- break;
723
- case "center":
724
- P = _.left + _.width / 2 - E / 2;
725
- break;
726
- case "end":
727
- P = _.right - E;
728
- break;
729
- }
730
- P = Math.max(D, Math.min(P, K - D - E)), j = z === "top" ? _.top - l.top - M : _.bottom + l.bottom, j = Math.max(D, Math.min(j, H - D - M));
731
- } else {
732
- switch (o) {
733
- case "start":
734
- j = _.top;
735
- break;
736
- case "center":
737
- j = _.top + _.height / 2 - M / 2;
738
- break;
739
- case "end":
740
- j = _.bottom - M;
741
- break;
742
- }
743
- j = Math.max(D, Math.min(j, H - D - M)), z === "left" ? (P = _.left - l.left - E, P < D && (E = _.left - l.left - D, P = D)) : (P = _.right + l.right, P + E > K - D && (E = K - D - P));
744
- }
745
- let O = 0;
746
- const J = 12, V = 16;
747
- if (z === "left" || z === "right") {
748
- switch (o) {
749
- case "start":
750
- O = _.top - j + J;
751
- break;
752
- case "center":
753
- O = _.top + _.height / 2 - j;
754
- break;
755
- case "end":
756
- O = _.bottom - j - J;
757
- break;
758
- }
759
- const Z = Math.max(V, M - V);
760
- O = Math.max(
761
- V,
762
- Math.min(O, Z)
763
- );
764
- } else {
765
- switch (o) {
766
- case "start":
767
- O = _.left - P + J;
768
- break;
769
- case "center":
770
- O = _.left + _.width / 2 - P;
771
- break;
772
- case "end":
773
- O = _.right - P - J;
774
- break;
775
- }
776
- const Z = Math.max(V, E - V);
777
- O = Math.max(
778
- V,
779
- Math.min(O, Z)
780
- );
781
- }
782
- isNaN(O) && (O = V), $(z), N({
783
- left: Math.round(P),
784
- top: Math.round(j),
785
- ...E !== Y && { maxWidth: E },
786
- ...M !== L && { maxHeight: te },
787
- "--arrow-offset": `${Math.round(O)}px`,
788
- ...r && { "--motile-tooltip-color": r }
789
- });
790
- }, b = () => {
791
- g.current === null && (g.current = requestAnimationFrame(() => {
792
- w(), g.current = null;
793
- }));
794
- };
795
- w(), window.addEventListener("scroll", b, {
796
- passive: !0,
797
- capture: !0
798
- }), window.addEventListener("resize", b, { passive: !0 });
799
- const F = new ResizeObserver(b);
800
- return d.current && F.observe(d.current), () => {
801
- g.current !== null && (cancelAnimationFrame(g.current), g.current = null), window.removeEventListener("scroll", b, { capture: !0 }), window.removeEventListener("resize", b), F.disconnect();
802
- };
803
- }, [m, n, o, r, i]), I(() => {
804
- if (!m) return;
805
- const w = () => {
806
- R(!1, 0);
807
- };
808
- return window.addEventListener("scroll", w, { capture: !0 }), () => {
809
- window.removeEventListener("scroll", w, { capture: !0 });
810
- };
811
- }, [m, R]), I(() => () => {
812
- p.current && clearTimeout(p.current);
813
- }, []);
814
- const x = {
815
- open: m,
816
- setOpen: R,
817
- position: n,
818
- align: o,
819
- variant: t,
820
- showArrow: s,
821
- color: r,
822
- keepOpen: a,
823
- tooltipId: `${f}-tooltip`,
824
- triggerRef: d,
825
- contentRef: u,
826
- style: v,
827
- placement: y
828
- };
829
- return /* @__PURE__ */ c(xe.Provider, { value: x, children: e });
830
- }
831
- function vt({ children: e, asChild: n = !1 }) {
832
- const { open: o, setOpen: t, tooltipId: r, triggerRef: s, keepOpen: a } = Ne(), i = k(() => {
833
- t(!0, 0);
834
- }, [t]), l = k(() => {
835
- a ? t(!1, 100) : t(!1, 0);
836
- }, [t, a]), f = k(() => {
837
- t(!0, 0);
838
- }, [t]), d = k(() => {
839
- t(!1, 0);
840
- }, [t]), u = k(() => {
841
- t(!o, 0);
842
- }, [t, o]);
843
- return n ? /* @__PURE__ */ c(
844
- W,
845
- {
846
- ref: (p) => {
847
- s.current = p;
848
- },
849
- className: "motile-tooltip-trigger",
850
- "aria-describedby": o ? r : void 0,
851
- tabIndex: 0,
852
- onMouseEnter: i,
853
- onMouseLeave: l,
854
- onFocus: f,
855
- onBlur: d,
856
- onClick: u,
857
- children: e
858
- }
859
- ) : T.cloneElement(e, {
860
- ref: (p) => {
861
- s.current = p;
862
- const m = e.props.ref || e.ref;
863
- m && (typeof m == "function" ? m(p) : typeof m == "object" && m !== null && (m.current = p));
864
- },
865
- className: `motile-tooltip-trigger ${e.props.className || ""}`.trim(),
866
- "aria-describedby": o ? r : void 0,
867
- tabIndex: e.props.tabIndex ?? 0,
868
- onMouseEnter: i,
869
- onMouseLeave: l,
870
- onFocus: f,
871
- onBlur: d,
872
- onClick: u
873
- });
874
- }
875
- function wt({ children: e }) {
876
- const {
877
- open: n,
878
- setOpen: o,
879
- tooltipId: t,
880
- contentRef: r,
881
- variant: s,
882
- showArrow: a,
883
- keepOpen: i,
884
- align: l,
885
- style: f,
886
- placement: d
887
- } = Ne(), [u, p] = A(!1);
888
- I(() => {
889
- n ? requestAnimationFrame(() => {
890
- p(!0);
891
- }) : p(!1);
892
- }, [n]);
893
- const m = k(() => {
894
- i && o(!0, 0);
895
- }, [i, o]), h = k(() => {
896
- i && o(!1, 0);
897
- }, [i, o]), y = f["--motile-tooltip-color"] || (s === "filled" ? "var(--motile-ui-tooltip, rgba(0, 0, 0, 0.9))" : "var(--motile-ui-tooltip, #3b82f6)");
898
- return !n || typeof document > "u" ? null : ae(
899
- /* @__PURE__ */ S(
900
- "div",
901
- {
902
- ref: r,
903
- id: t,
904
- role: "tooltip",
905
- className: `motile-tooltip-bubble motile-tooltip-bubble--${s}`,
906
- "data-open": u || void 0,
907
- "data-placement": d,
908
- "data-align": l,
909
- "data-show-arrow": a || void 0,
910
- "data-keep-open": i || void 0,
911
- style: f,
912
- "aria-hidden": !n,
913
- onMouseEnter: m,
914
- onMouseLeave: h,
915
- children: [
916
- e,
917
- a && /* @__PURE__ */ c(
918
- me,
919
- {
920
- className: "motile-tooltip-arrow",
921
- variant: s,
922
- color: y
923
- }
924
- )
925
- ]
926
- }
927
- ),
928
- document.body
929
- );
930
- }
931
- const se = {
932
- Root: yt,
933
- Trigger: vt,
934
- Content: wt
935
- };
936
- function le({
937
- refs: e,
938
- handler: n,
939
- enabled: o = !0
940
- }) {
941
- I(() => {
942
- if (!o) return;
943
- const t = (r) => {
944
- const s = r.target;
945
- if (!e.every((l) => l.current)) return;
946
- e.every((l) => {
947
- var f;
948
- return !((f = l.current) != null && f.contains(s));
949
- }) && n(r);
950
- };
951
- return document.addEventListener("mousedown", t), document.addEventListener("touchstart", t), () => {
952
- document.removeEventListener("mousedown", t), document.removeEventListener("touchstart", t);
953
- };
954
- }, [e, n, o]);
955
- }
956
- function ce({
957
- handler: e,
958
- enabled: n = !0
959
- }) {
960
- I(() => {
961
- if (!n) return;
962
- const o = (t) => {
963
- t.key === "Escape" && e(t);
964
- };
965
- return document.addEventListener("keydown", o), () => {
966
- document.removeEventListener("keydown", o);
967
- };
968
- }, [e, n]);
969
- }
970
- const Re = X(null);
971
- function Ce() {
972
- const e = G(Re);
973
- if (!e)
974
- throw new Error("Popover components must be used within Popover.Root");
975
- return e;
976
- }
977
- function bt({
978
- value: e,
979
- defaultValue: n = !1,
980
- onChange: o
981
- }) {
982
- const t = e !== void 0, [r, s] = T.useState(n), a = t ? e : r, i = k(
983
- (l) => {
984
- const f = typeof l == "function" ? l(a) : l;
985
- t || s(f), o == null || o(f);
986
- },
987
- [t, o, a]
988
- );
989
- return [a, i];
990
- }
991
- function gt({
992
- children: e,
993
- position: n = "top",
994
- align: o = "center",
995
- variant: t = "filled",
996
- showArrow: r = !1,
997
- zIndex: s = 10,
998
- color: a,
999
- bounceCount: i = 0,
1000
- open: l,
1001
- defaultOpen: f = !1,
1002
- onOpenChange: d,
1003
- onClickOutside: u,
1004
- onDismiss: p,
1005
- autoClose: m = !0
1006
- }) {
1007
- const h = Q().replace(/:/g, ""), y = C(null), $ = C(null), v = C(null), [N, g] = bt({
1008
- value: l,
1009
- defaultValue: f,
1010
- onChange: d
1011
- }), R = ie(
1012
- () => ({
1013
- open: N,
1014
- setOpen: g,
1015
- position: n,
1016
- align: o,
1017
- variant: t,
1018
- showArrow: r,
1019
- zIndex: s,
1020
- color: a,
1021
- autoClose: m,
1022
- bounceCount: i,
1023
- onOpenChange: d,
1024
- onClickOutside: u,
1025
- onDismiss: p,
1026
- triggerId: `${h}-trigger`,
1027
- contentId: `${h}-content`,
1028
- triggerRef: y,
1029
- contentRef: $,
1030
- wrapperRef: v
1031
- }),
1032
- [
1033
- N,
1034
- g,
1035
- n,
1036
- o,
1037
- t,
1038
- r,
1039
- s,
1040
- a,
1041
- m,
1042
- i,
1043
- d,
1044
- u,
1045
- p,
1046
- h
1047
- ]
1048
- );
1049
- return /* @__PURE__ */ c(Re.Provider, { value: R, children: /* @__PURE__ */ c("div", { ref: v, className: "motile-popover-wrapper", children: e }) });
1050
- }
1051
- function $t({ children: e, asChild: n = !1 }) {
1052
- const { open: o, setOpen: t, triggerId: r, contentId: s, triggerRef: a } = Ce(), i = k(() => {
1053
- t((l) => !l);
1054
- }, [t]);
1055
- return n ? /* @__PURE__ */ c(
1056
- W,
1057
- {
1058
- ref: (l) => {
1059
- a.current = l;
1060
- },
1061
- id: r,
1062
- "aria-expanded": o,
1063
- "aria-controls": s,
1064
- onClick: i,
1065
- children: e
1066
- }
1067
- ) : /* @__PURE__ */ c(
1068
- "button",
1069
- {
1070
- ref: a,
1071
- id: r,
1072
- type: "button",
1073
- "aria-expanded": o,
1074
- "aria-controls": s,
1075
- onClick: i,
1076
- children: e
1077
- }
1078
- );
1079
- }
1080
- function _t({
1081
- children: e,
1082
- className: n = "",
1083
- style: o
1084
- }) {
1085
- const {
1086
- open: t,
1087
- setOpen: r,
1088
- position: s,
1089
- align: a,
1090
- variant: i,
1091
- showArrow: l,
1092
- zIndex: f,
1093
- color: d,
1094
- autoClose: u,
1095
- bounceCount: p,
1096
- onClickOutside: m,
1097
- onDismiss: h,
1098
- contentId: y,
1099
- contentRef: $,
1100
- wrapperRef: v
1101
- } = Ce();
1102
- if (ce({
1103
- handler: k(
1104
- (g) => {
1105
- u && (h == null || h(g), g.defaultPrevented || r(!1));
1106
- },
1107
- [u, h, r]
1108
- ),
1109
- enabled: t
1110
- }), le({
1111
- refs: [v],
1112
- handler: k(
1113
- (g) => {
1114
- u && (m == null || m(g), h == null || h(g), g.defaultPrevented || r(!1));
1115
- },
1116
- [u, m, h, r]
1117
- ),
1118
- enabled: t
1119
- }), !t) return null;
1120
- const N = p !== 0;
1121
- return /* @__PURE__ */ S(
1122
- "div",
1123
- {
1124
- ref: $,
1125
- id: y,
1126
- role: "dialog",
1127
- "aria-modal": "false",
1128
- className: `motile-popover-content motile-popover-content--${i} ${n}`,
1129
- "data-placement": s,
1130
- "data-align": a,
1131
- "data-bounce": N ? "true" : "false",
1132
- style: {
1133
- zIndex: f,
1134
- ...d && { "--motile-popover-color": d },
1135
- "--bounce-count": p,
1136
- ...o
1137
- },
1138
- children: [
1139
- l && /* @__PURE__ */ c(
1140
- me,
1141
- {
1142
- className: "motile-popover-arrow",
1143
- variant: i,
1144
- color: d || (i === "filled" ? "var(--motile-ui-popover, var(--motile-theme, #3b82f6))" : "var(--motile-ui-popover, var(--motile-theme, #e5e7eb))")
1145
- }
1146
- ),
1147
- e
1148
- ]
1149
- }
1150
- );
1151
- }
1152
- const Wt = {
1153
- Root: gt,
1154
- Trigger: $t,
1155
- Content: _t
1156
- };
1157
- function fe({
1158
- enabled: e = !0,
1159
- allowedSelectors: n = ["[data-scroll-allowed]", ".sheet-content", ".modal-body"]
1160
- } = {}) {
1161
- return I(() => {
1162
- if (!e) return;
1163
- const o = document.body.style.overflow, t = document.documentElement.style.overflow, r = document.body.style.height, s = document.body.style.paddingRight, a = document.body.style.touchAction, i = document.documentElement.style.touchAction, l = document.body.style.overscrollBehavior, f = document.documentElement.style.overscrollBehavior, d = window.innerWidth - document.documentElement.clientWidth;
1164
- document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden", document.body.style.height = "100%", document.body.style.touchAction = "none", document.documentElement.style.touchAction = "none", document.body.style.overscrollBehavior = "none", document.documentElement.style.overscrollBehavior = "none", d > 0 && (document.body.style.paddingRight = `${d}px`);
1165
- const u = (h) => {
1166
- const y = h.target;
1167
- if (!y || !(y instanceof HTMLElement) || !n.some((v) => {
1168
- try {
1169
- return y.closest(v);
1170
- } catch {
1171
- return !1;
1172
- }
1173
- }))
1174
- return h.preventDefault(), h.stopPropagation(), !1;
1175
- }, p = { passive: !1 };
1176
- document.addEventListener("wheel", u, p), document.addEventListener("touchmove", u, p), document.addEventListener("scroll", u, p);
1177
- const m = (h) => {
1178
- const y = h.target;
1179
- if (!y || !(y instanceof HTMLElement))
1180
- return [
1181
- "Space",
1182
- "PageUp",
1183
- "PageDown",
1184
- "End",
1185
- "Home",
1186
- "ArrowLeft",
1187
- "ArrowUp",
1188
- "ArrowRight",
1189
- "ArrowDown"
1190
- ].includes(h.code) ? (h.preventDefault(), h.stopPropagation(), !1) : void 0;
1191
- if (!n.some((v) => {
1192
- try {
1193
- return y.closest(v);
1194
- } catch {
1195
- return !1;
1196
- }
1197
- }) && [
1198
- "Space",
1199
- // 스페이스바
1200
- "PageUp",
1201
- // Page Up
1202
- "PageDown",
1203
- // Page Down
1204
- "End",
1205
- // End
1206
- "Home",
1207
- // Home
1208
- "ArrowLeft",
1209
- // ← 화살표
1210
- "ArrowUp",
1211
- // ↑ 화살표
1212
- "ArrowRight",
1213
- // → 화살표
1214
- "ArrowDown"
1215
- // ↓ 화살표
1216
- ].includes(h.code))
1217
- return h.preventDefault(), h.stopPropagation(), !1;
1218
- };
1219
- return document.addEventListener("keydown", m, p), () => {
1220
- document.body.style.overflow = o, document.documentElement.style.overflow = t, document.body.style.height = r, document.body.style.paddingRight = s, document.body.style.touchAction = a, document.documentElement.style.touchAction = i, document.body.style.overscrollBehavior = l, document.documentElement.style.overscrollBehavior = f, document.removeEventListener("wheel", u), document.removeEventListener("touchmove", u), document.removeEventListener("scroll", u), document.removeEventListener("keydown", m);
1221
- };
1222
- }, [e, n]), {
1223
- isLocked: e
1224
- };
1225
- }
1226
- const ke = X(null), ne = () => {
1227
- const e = G(ke);
1228
- if (!e)
1229
- throw new Error("Drawer components must be used within Drawer.Root");
1230
- return e;
1231
- }, Se = ({
1232
- children: e,
1233
- open: n,
1234
- defaultOpen: o = !1,
1235
- onOpenChange: t,
1236
- closeOnBackdrop: r = !0,
1237
- closeOnDrag: s = !0,
1238
- maxHeight: a = "70dvh",
1239
- width: i = "480px",
1240
- maxWidth: l,
1241
- zIndex: f = 9999
1242
- }) => {
1243
- const d = C(null), u = C(null), p = C(null), m = C(0), h = C(!1), [y, $] = A(!1), [v, N] = A(o), [g, R] = A(o), x = n !== void 0 ? n : g, w = (L) => {
1244
- n === void 0 && R(L), t == null || t(L);
1245
- }, b = typeof r == "boolean" ? { escapeKey: r, clickOutside: r } : {
1246
- escapeKey: (r == null ? void 0 : r.escapeKey) ?? !1,
1247
- clickOutside: (r == null ? void 0 : r.clickOutside) ?? !1
1248
- };
1249
- fe({
1250
- enabled: x,
1251
- allowedSelectors: ["[data-scroll-allowed]", ".motile-drawer__body"]
1252
- });
1253
- const F = () => {
1254
- if (!d.current) {
1255
- $(!1), setTimeout(() => {
1256
- N(!1), w(!1);
1257
- }, 300);
1258
- return;
1259
- }
1260
- d.current.style.transition = "transform 0.3s ease", d.current.style.transform = "translateY(100%)", $(!1), setTimeout(() => {
1261
- N(!1), w(!1);
1262
- }, 300);
1263
- };
1264
- I(() => {
1265
- x ? N(!0) : v && F();
1266
- }, [x]), I(() => {
1267
- if (!v || !d.current) return;
1268
- const L = d.current;
1269
- L.style.transition = "none", L.style.transform = "translateY(100%)", requestAnimationFrame(() => {
1270
- requestAnimationFrame(() => {
1271
- L.style.transition = "transform 0.3s ease", L.style.transform = "translateY(0)", $(!0);
1272
- });
1273
- });
1274
- }, [v]), le({
1275
- refs: [d],
1276
- handler: F,
1277
- enabled: x && b.clickOutside
1278
- }), ce({
1279
- handler: F,
1280
- enabled: x && b.escapeKey
1281
- });
1282
- const Y = {
1283
- open: v,
1284
- setOpen: w,
1285
- closeOnBackdrop: r,
1286
- closeOnDrag: s,
1287
- maxHeight: a,
1288
- width: i,
1289
- maxWidth: l,
1290
- zIndex: f,
1291
- drawerRef: d,
1292
- bodyRef: u,
1293
- isVisible: y,
1294
- handleClose: F,
1295
- handleDragStart: (L) => {
1296
- s && (p.current = L, h.current = !1);
1297
- },
1298
- handleDragMove: (L) => {
1299
- if (!s || !d.current || p.current === null || !u.current)
1300
- return;
1301
- const E = L - p.current;
1302
- u.current.scrollTop <= 0 && E > 0 && (h.current = !0, m.current = E, d.current.style.transition = "none", d.current.style.transform = `translateY(${E}px)`);
1303
- },
1304
- handleDragEnd: () => {
1305
- if (!s || !d.current) return;
1306
- const L = window.innerHeight * 0.2;
1307
- d.current.style.transition = "transform 0.3s ease", h.current && m.current > L ? F() : (d.current.style.transform = "translateY(0)", m.current = 0), h.current = !1, p.current = null;
1308
- }
1309
- };
1310
- return /* @__PURE__ */ c(ke.Provider, { value: Y, children: e });
1311
- };
1312
- Se.displayName = "Drawer.Root";
1313
- const Ee = B(
1314
- ({ children: e, asChild: n, onClick: o, ...t }, r) => {
1315
- const { setOpen: s } = ne(), a = (i) => {
1316
- o == null || o(i), s(!0);
1317
- };
1318
- return n ? /* @__PURE__ */ c(
1319
- W,
1320
- {
1321
- ...t,
1322
- onClick: a,
1323
- ref: r,
1324
- children: e
1325
- }
1326
- ) : /* @__PURE__ */ c("button", { type: "button", onClick: a, ref: r, ...t, children: e });
1327
- }
1328
- );
1329
- Ee.displayName = "Drawer.Trigger";
1330
- const Te = ({
1331
- children: e,
1332
- container: n
1333
- }) => {
1334
- const { open: o } = ne();
1335
- return !o || typeof document > "u" ? null : ae(e, n || document.body);
1336
- };
1337
- Te.displayName = "Drawer.Portal";
1338
- const Me = B(
1339
- ({ className: e, ...n }, o) => {
1340
- const { isVisible: t, zIndex: r } = ne();
1341
- return /* @__PURE__ */ c(
1342
- "div",
1343
- {
1344
- ref: o,
1345
- className: `motile-drawer__overlay ${t ? "motile-drawer__overlay--visible" : ""} ${e || ""}`,
1346
- style: { zIndex: r },
1347
- role: "presentation",
1348
- ...n
1349
- }
1350
- );
1351
- }
1352
- );
1353
- Me.displayName = "Drawer.Overlay";
1354
- const Le = B(
1355
- ({ className: e, style: n, children: o, ...t }, r) => {
1356
- const { drawerRef: s, isVisible: a, maxHeight: i, width: l, maxWidth: f, zIndex: d } = ne(), u = {
1357
- ...i !== "70dvh" && { "--drawer-max-height": i },
1358
- ...l !== "480px" && { "--drawer-width": l },
1359
- ...f && { "--drawer-max-width": f },
1360
- zIndex: d + 1,
1361
- ...n
1362
- };
1363
- return /* @__PURE__ */ c(
1364
- "div",
1365
- {
1366
- ref: (p) => {
1367
- typeof r == "function" ? r(p) : r && (r.current = p), s.current = p;
1368
- },
1369
- className: `motile-drawer__content ${a ? "motile-drawer__content--visible" : ""} ${e || ""}`,
1370
- style: u,
1371
- onClick: (p) => p.stopPropagation(),
1372
- role: "dialog",
1373
- "aria-modal": "true",
1374
- ...t,
1375
- children: o
1376
- }
1377
- );
1378
- }
1379
- );
1380
- Le.displayName = "Drawer.Content";
1381
- const De = B(
1382
- ({ className: e, ...n }, o) => {
1383
- const { handleDragStart: t, handleDragMove: r, handleDragEnd: s } = ne(), a = (d) => {
1384
- t(d.touches[0].clientY);
1385
- }, i = (d) => {
1386
- r(d.touches[0].clientY);
1387
- }, l = () => {
1388
- s();
1389
- }, f = (d) => {
1390
- t(d.clientY);
1391
- const u = (m) => {
1392
- r(m.clientY);
1393
- }, p = () => {
1394
- s(), window.removeEventListener("mousemove", u), window.removeEventListener("mouseup", p);
1395
- };
1396
- window.addEventListener("mousemove", u), window.addEventListener("mouseup", p);
1397
- };
1398
- return /* @__PURE__ */ c(
1399
- "div",
1400
- {
1401
- ref: o,
1402
- className: `motile-drawer__header ${e || ""}`,
1403
- onTouchStart: a,
1404
- onTouchMove: i,
1405
- onTouchEnd: l,
1406
- onMouseDown: f,
1407
- ...n,
1408
- children: /* @__PURE__ */ c("div", { className: "motile-drawer__handle", "aria-hidden": "true" })
1409
- }
1410
- );
1411
- }
1412
- );
1413
- De.displayName = "Drawer.Handle";
1414
- const Ae = B(
1415
- ({ children: e, asChild: n, className: o, ...t }, r) => n && T.isValidElement(e) ? /* @__PURE__ */ c(
1416
- W,
1417
- {
1418
- ...t,
1419
- className: `motile-drawer__title ${o || ""}`,
1420
- ref: r,
1421
- children: e
1422
- }
1423
- ) : /* @__PURE__ */ c("div", { className: "motile-drawer__title-wrapper", children: /* @__PURE__ */ c(
1424
- "h2",
1425
- {
1426
- ref: r,
1427
- id: "motile-drawer-title",
1428
- className: `motile-drawer__title ${o || ""}`,
1429
- ...t,
1430
- children: e
1431
- }
1432
- ) })
1433
- );
1434
- Ae.displayName = "Drawer.Title";
1435
- const Ie = B(
1436
- ({ className: e, children: n, ...o }, t) => {
1437
- const { bodyRef: r } = ne();
1438
- return /* @__PURE__ */ c(
1439
- "div",
1440
- {
1441
- ref: (s) => {
1442
- typeof t == "function" ? t(s) : t && (t.current = s), r.current = s;
1443
- },
1444
- className: `motile-drawer__body ${e || ""}`,
1445
- "data-scroll-allowed": !0,
1446
- ...o,
1447
- children: n
1448
- }
1449
- );
1450
- }
1451
- );
1452
- Ie.displayName = "Drawer.Body";
1453
- const Be = B(
1454
- ({ children: e, asChild: n, onClick: o, ...t }, r) => {
1455
- const { handleClose: s } = ne(), a = (i) => {
1456
- o == null || o(i), s();
1457
- };
1458
- return n ? /* @__PURE__ */ c(
1459
- W,
1460
- {
1461
- ...t,
1462
- onClick: a,
1463
- ref: r,
1464
- children: e
1465
- }
1466
- ) : /* @__PURE__ */ c("button", { type: "button", onClick: a, ref: r, ...t, children: e });
1467
- }
1468
- );
1469
- Be.displayName = "Drawer.Close";
1470
- const Yt = {
1471
- Root: Se,
1472
- Trigger: Ee,
1473
- Portal: Te,
1474
- Overlay: Me,
1475
- Content: Le,
1476
- Handle: De,
1477
- Title: Ae,
1478
- Body: Ie,
1479
- Close: Be
1480
- };
1481
- function xt({
1482
- onClose: e,
1483
- isOpen: n
1484
- }) {
1485
- const o = C(e), t = C(!1), [r, s] = A(!1), a = C(0), i = C(null);
1486
- return I(() => {
1487
- o.current = e;
1488
- }, [e]), I(() => {
1489
- if (n && !t.current) {
1490
- const f = (d) => {
1491
- s(!0), o.current();
1492
- };
1493
- return a.current = window.history.length, window.history.pushState({ modal: !0 }, ""), t.current = !0, window.addEventListener("popstate", f), () => {
1494
- window.removeEventListener("popstate", f);
1495
- };
1496
- }
1497
- if (!n && t.current) {
1498
- if (!r) {
1499
- const f = a.current + 1;
1500
- if (window.history.length !== f)
1501
- i.current = null;
1502
- else if (i.current) {
1503
- const u = () => {
1504
- window.removeEventListener("popstate", u), i.current && (i.current(), i.current = null);
1505
- };
1506
- window.addEventListener("popstate", u), window.history.back();
1507
- } else
1508
- window.history.back();
1509
- }
1510
- t.current = !1, s(!1);
1511
- }
1512
- }, [n, r]), {
1513
- isClosingFromHistory: r,
1514
- navigateAndClose: (f) => {
1515
- i.current = f, o.current();
1516
- }
1517
- };
1518
- }
1519
- const He = X(null);
1520
- function de() {
1521
- const e = G(He);
1522
- if (!e)
1523
- throw new Error("Sheet components must be used within Sheet.Root");
1524
- return e;
1525
- }
1526
- function Nt({
1527
- value: e,
1528
- defaultValue: n = !1,
1529
- onChange: o
1530
- }) {
1531
- const t = e !== void 0, [r, s] = A(n), a = t ? e : r, i = k(
1532
- (l) => {
1533
- const f = typeof l == "function" ? l(a) : l;
1534
- t || s(f), o == null || o(f);
1535
- },
1536
- [t, o, a]
1537
- );
1538
- return [a, i];
1539
- }
1540
- function Rt({
1541
- children: e,
1542
- position: n = "right",
1543
- closeOnBackdrop: o = !0,
1544
- maxWidth: t = "600px",
1545
- zIndex: r = 1e3,
1546
- open: s,
1547
- defaultOpen: a = !1,
1548
- onOpenChange: i
1549
- }) {
1550
- const l = Q().replace(/:/g, ""), f = C(null), d = C(null), [u, p] = Nt({
1551
- value: s,
1552
- defaultValue: a,
1553
- onChange: i
1554
- }), { isClosingFromHistory: m, navigateAndClose: h } = xt({
1555
- isOpen: u,
1556
- onClose: () => p(!1)
1557
- }), y = ie(
1558
- () => ({
1559
- open: u,
1560
- setOpen: p,
1561
- position: n,
1562
- closeOnBackdrop: o,
1563
- maxWidth: t,
1564
- zIndex: r,
1565
- onOpenChange: i,
1566
- triggerId: `${l}-trigger`,
1567
- contentId: `${l}-content`,
1568
- overlayRef: f,
1569
- sheetRef: d,
1570
- isClosingFromHistory: m,
1571
- navigateAndClose: h
1572
- }),
1573
- [
1574
- u,
1575
- p,
1576
- n,
1577
- o,
1578
- t,
1579
- r,
1580
- i,
1581
- l,
1582
- f,
1583
- d,
1584
- m,
1585
- h
1586
- ]
1587
- );
1588
- return /* @__PURE__ */ c(He.Provider, { value: y, children: e });
1589
- }
1590
- function Ct({ children: e, asChild: n = !1 }) {
1591
- const { open: o, setOpen: t, triggerId: r, contentId: s } = de(), a = k(() => {
1592
- t((i) => !i);
1593
- }, [t]);
1594
- return n ? /* @__PURE__ */ c(
1595
- W,
1596
- {
1597
- id: r,
1598
- "aria-expanded": o,
1599
- "aria-controls": s,
1600
- onClick: a,
1601
- children: e
1602
- }
1603
- ) : /* @__PURE__ */ c(
1604
- "button",
1605
- {
1606
- id: r,
1607
- type: "button",
1608
- "aria-expanded": o,
1609
- "aria-controls": s,
1610
- onClick: a,
1611
- children: e
1612
- }
1613
- );
1614
- }
1615
- function kt({ children: e, container: n }) {
1616
- const { open: o } = de();
1617
- return !o || typeof document > "u" ? null : ae(e, n || document.body);
1618
- }
1619
- function St({ className: e = "", style: n }) {
1620
- const { open: o, setOpen: t, position: r, closeOnBackdrop: s, zIndex: a, overlayRef: i } = de(), [l, f] = A(!1), [d, u] = A(!1), p = typeof s == "boolean" ? { clickOutside: s } : {
1621
- escapeKey: s.escapeKey ?? !1,
1622
- clickOutside: s.clickOutside ?? !1
1623
- };
1624
- I(() => {
1625
- if (o)
1626
- f(!0);
1627
- else if (l) {
1628
- u(!1);
1629
- const y = setTimeout(() => {
1630
- f(!1);
1631
- }, 300);
1632
- return () => clearTimeout(y);
1633
- }
1634
- }, [o, l]), I(() => {
1635
- if (!l || !o) return;
1636
- const y = requestAnimationFrame(() => {
1637
- const $ = requestAnimationFrame(() => {
1638
- u(!0);
1639
- });
1640
- return () => cancelAnimationFrame($);
1641
- });
1642
- return () => cancelAnimationFrame(y);
1643
- }, [l, o]);
1644
- const m = k(
1645
- (y) => {
1646
- p.clickOutside && y.target === i.current && t(!1);
1647
- },
1648
- [p.clickOutside, t, i]
1649
- );
1650
- if (!l)
1651
- return null;
1652
- const h = {
1653
- zIndex: a,
1654
- ...n
1655
- };
1656
- return /* @__PURE__ */ c(
1657
- "div",
1658
- {
1659
- ref: i,
1660
- className: `motile-sheet__overlay ${d ? "motile-sheet__overlay--visible" : ""} motile-sheet__overlay--${r} ${e}`,
1661
- style: h,
1662
- onClick: m,
1663
- role: "presentation"
1664
- }
1665
- );
1666
- }
1667
- function Et({ children: e, className: n = "", style: o }) {
1668
- const {
1669
- open: t,
1670
- setOpen: r,
1671
- position: s,
1672
- closeOnBackdrop: a,
1673
- maxWidth: i,
1674
- zIndex: l,
1675
- contentId: f,
1676
- sheetRef: d,
1677
- isClosingFromHistory: u
1678
- } = de(), [p, m] = A(!1), [h, y] = A(!1), $ = typeof a == "boolean" ? { escapeKey: a, clickOutside: a } : {
1679
- escapeKey: a.escapeKey ?? !1,
1680
- clickOutside: a.clickOutside ?? !1
1681
- };
1682
- if (fe({
1683
- enabled: t,
1684
- allowedSelectors: [".motile-sheet__body"]
1685
- }), le({
1686
- refs: [d],
1687
- handler: () => r(!1),
1688
- enabled: t && $.clickOutside
1689
- }), ce({
1690
- handler: () => r(!1),
1691
- enabled: t && $.escapeKey
1692
- }), I(() => {
1693
- if (t)
1694
- m(!0);
1695
- else if (p) {
1696
- y(!1);
1697
- const g = setTimeout(() => {
1698
- m(!1);
1699
- }, u ? 0 : 300);
1700
- return () => clearTimeout(g);
1701
- }
1702
- }, [t, p, u]), I(() => {
1703
- if (!p || !t || u) return;
1704
- const N = requestAnimationFrame(() => {
1705
- const g = requestAnimationFrame(() => {
1706
- y(!0);
1707
- });
1708
- return () => cancelAnimationFrame(g);
1709
- });
1710
- return () => cancelAnimationFrame(N);
1711
- }, [p, t, u]), !p)
1712
- return null;
1713
- const v = {
1714
- ...i !== "600px" && { "--sheet-max-width": i },
1715
- zIndex: l + 1,
1716
- ...o
1717
- };
1718
- return /* @__PURE__ */ c(
1719
- "div",
1720
- {
1721
- ref: d,
1722
- id: f,
1723
- className: `motile-sheet__content motile-sheet__content--${s} ${h ? "motile-sheet__content--visible" : ""} ${n}`,
1724
- style: v,
1725
- role: "dialog",
1726
- "aria-modal": "true",
1727
- children: e
1728
- }
1729
- );
1730
- }
1731
- function Tt({ children: e, className: n = "" }) {
1732
- return /* @__PURE__ */ c("div", { className: `motile-sheet__header ${n}`, children: e });
1733
- }
1734
- function Mt({ children: e, className: n = "" }) {
1735
- return /* @__PURE__ */ c("h2", { id: "sheet-title", className: `motile-sheet__title ${n}`, children: e });
1736
- }
1737
- function Lt({ children: e, className: n = "" }) {
1738
- return /* @__PURE__ */ c("div", { className: `motile-sheet__body ${n}`, children: e });
1739
- }
1740
- function Dt({ children: e, asChild: n = !1 }) {
1741
- const { setOpen: o } = de(), t = k(() => {
1742
- o(!1);
1743
- }, [o]);
1744
- return n ? /* @__PURE__ */ c(
1745
- W,
1746
- {
1747
- className: "motile-sheet__close",
1748
- onClick: t,
1749
- "aria-label": "닫기",
1750
- children: e
1751
- }
1752
- ) : /* @__PURE__ */ c(
1753
- "button",
1754
- {
1755
- className: "motile-sheet__close",
1756
- onClick: t,
1757
- "aria-label": "닫기",
1758
- type: "button",
1759
- children: e || /* @__PURE__ */ S(
1760
- "svg",
1761
- {
1762
- width: "20",
1763
- height: "20",
1764
- viewBox: "0 0 24 24",
1765
- fill: "none",
1766
- stroke: "currentColor",
1767
- strokeWidth: "2",
1768
- strokeLinecap: "round",
1769
- strokeLinejoin: "round",
1770
- children: [
1771
- /* @__PURE__ */ c("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1772
- /* @__PURE__ */ c("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1773
- ]
1774
- }
1775
- )
1776
- }
1777
- );
1778
- }
1779
- const Kt = {
1780
- Root: Rt,
1781
- Trigger: Ct,
1782
- Portal: kt,
1783
- Overlay: St,
1784
- Content: Et,
1785
- Header: Tt,
1786
- Title: Mt,
1787
- Body: Lt,
1788
- Close: Dt
1789
- }, Pe = X(null), ue = () => {
1790
- const e = G(Pe);
1791
- if (!e)
1792
- throw new Error("Modal compound components must be used within Modal.Root");
1793
- return e;
1794
- }, At = ({
1795
- open: e,
1796
- onOpenChange: n,
1797
- children: o
1798
- }) => {
1799
- const t = Q(), r = Q(), s = T.useMemo(
1800
- () => ({
1801
- open: e,
1802
- onOpenChange: n,
1803
- titleId: t,
1804
- descriptionId: r
1805
- }),
1806
- [e, n, t, r]
1807
- );
1808
- return /* @__PURE__ */ c(Pe.Provider, { value: s, children: o });
1809
- }, Oe = T.forwardRef(
1810
- ({
1811
- container: e,
1812
- variant: n = "scale",
1813
- closeOnBackdrop: o = !0,
1814
- disableScrollLock: t = !1,
1815
- width: r,
1816
- maxWidth: s,
1817
- zIndex: a = 1e3,
1818
- className: i,
1819
- onClick: l,
1820
- style: f,
1821
- ...d
1822
- }, u) => {
1823
- const { open: p, onOpenChange: m } = ue(), h = C(null), y = typeof o == "boolean" ? o : o.clickOutside ?? !1, $ = typeof o == "boolean" ? o : o.escapeKey ?? !1;
1824
- fe({
1825
- enabled: p && !t,
1826
- allowedSelectors: [".motile-modal__content"]
1827
- }), le({
1828
- refs: [h],
1829
- handler: () => {
1830
- y && m(!1);
1831
- },
1832
- enabled: p
1833
- }), ce({
1834
- handler: () => {
1835
- $ && m(!1);
1836
- },
1837
- enabled: p
1838
- });
1839
- const v = (x) => {
1840
- l == null || l(x), x.target === x.currentTarget && y && m(!1);
1841
- };
1842
- if (!p || typeof document > "u") return null;
1843
- const N = {
1844
- zIndex: a,
1845
- ...f
1846
- }, g = {
1847
- ...r && { "--modal-width": r },
1848
- ...s && { "--modal-max-width": s },
1849
- zIndex: a + 1
1850
- }, R = /* @__PURE__ */ c(
1851
- "div",
1852
- {
1853
- ref: u,
1854
- className: `motile-modal__backdrop ${i || ""}`,
1855
- "data-state": p ? "open" : "closed",
1856
- "data-variant": n,
1857
- onClick: v,
1858
- style: N,
1859
- ...d,
1860
- children: /* @__PURE__ */ c(
1861
- "div",
1862
- {
1863
- ref: h,
1864
- className: "motile-modal",
1865
- "data-variant": n,
1866
- style: g,
1867
- children: d.children
1868
- }
1869
- )
1870
- }
1871
- );
1872
- return ae(R, e || document.body);
1873
- }
1874
- );
1875
- Oe.displayName = "Modal.Overlay";
1876
- const Fe = T.forwardRef(
1877
- ({ className: e, forceMount: n, ...o }, t) => {
1878
- const { open: r, titleId: s, descriptionId: a } = ue();
1879
- return !r && !n ? null : /* @__PURE__ */ c(
1880
- "div",
1881
- {
1882
- ref: t,
1883
- className: `motile-modal__content ${e || ""}`,
1884
- role: "dialog",
1885
- "aria-modal": "true",
1886
- "aria-labelledby": s,
1887
- "aria-describedby": a,
1888
- "data-state": r ? "open" : "closed",
1889
- ...o
1890
- }
1891
- );
1892
- }
1893
- );
1894
- Fe.displayName = "Modal.Content";
1895
- const je = T.forwardRef(
1896
- ({ className: e, ...n }, o) => {
1897
- const { titleId: t } = ue();
1898
- return /* @__PURE__ */ c(
1899
- "h2",
1900
- {
1901
- ref: o,
1902
- id: t,
1903
- className: `motile-modal__title ${e || ""}`,
1904
- ...n
1905
- }
1906
- );
1907
- }
1908
- );
1909
- je.displayName = "Modal.Title";
1910
- const Ve = T.forwardRef(
1911
- ({ className: e, ...n }, o) => {
1912
- const { descriptionId: t } = ue();
1913
- return /* @__PURE__ */ c(
1914
- "div",
1915
- {
1916
- ref: o,
1917
- id: t,
1918
- className: `motile-modal__body ${e || ""}`,
1919
- ...n
1920
- }
1921
- );
1922
- }
1923
- );
1924
- Ve.displayName = "Modal.Body";
1925
- const We = T.forwardRef(
1926
- ({ asChild: e, className: n, onClick: o, children: t, ...r }, s) => {
1927
- const { onOpenChange: a } = ue(), i = (l) => {
1928
- o == null || o(l), a(!1);
1929
- };
1930
- return e ? /* @__PURE__ */ c(
1931
- W,
1932
- {
1933
- ...r,
1934
- onClick: i,
1935
- ref: s,
1936
- children: t
1937
- }
1938
- ) : /* @__PURE__ */ c(
1939
- "button",
1940
- {
1941
- ref: s,
1942
- type: "button",
1943
- className: `motile-modal__close ${n || ""}`,
1944
- onClick: i,
1945
- "aria-label": "닫기",
1946
- ...r,
1947
- children: t || /* @__PURE__ */ S(
1948
- "svg",
1949
- {
1950
- width: "18",
1951
- height: "18",
1952
- viewBox: "0 0 24 24",
1953
- fill: "none",
1954
- stroke: "currentColor",
1955
- strokeWidth: "2",
1956
- strokeLinecap: "round",
1957
- strokeLinejoin: "round",
1958
- children: [
1959
- /* @__PURE__ */ c("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1960
- /* @__PURE__ */ c("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1961
- ]
1962
- }
1963
- )
1964
- }
1965
- );
1966
- }
1967
- );
1968
- We.displayName = "Modal.Close";
1969
- const Ye = T.forwardRef(
1970
- ({ className: e, ...n }, o) => /* @__PURE__ */ c(
1971
- "div",
1972
- {
1973
- ref: o,
1974
- className: `motile-modal__footer ${e || ""}`,
1975
- ...n
1976
- }
1977
- )
1978
- );
1979
- Ye.displayName = "Modal.Footer";
1980
- const Ke = T.forwardRef(
1981
- ({ className: e, ...n }, o) => /* @__PURE__ */ c(
1982
- "div",
1983
- {
1984
- ref: o,
1985
- className: `motile-modal__header ${e || ""}`,
1986
- ...n
1987
- }
1988
- )
1989
- );
1990
- Ke.displayName = "Modal.Header";
1991
- const zt = {
1992
- Root: At,
1993
- Overlay: Oe,
1994
- Content: Fe,
1995
- Title: je,
1996
- Body: Ve,
1997
- Close: We,
1998
- Footer: Ye,
1999
- Header: Ke
2000
- }, ze = X(null);
2001
- function It() {
2002
- const e = G(ze);
2003
- if (!e)
2004
- throw new Error("useToastContext must be used within ToastProvider");
2005
- return e;
2006
- }
2007
- function Bt({ toast: e, onRemove: n }) {
2008
- const [o, t] = A(!1), r = k(() => {
2009
- t(!0), setTimeout(() => {
2010
- n(e.id);
2011
- }, 250);
2012
- }, [e.id, n]);
2013
- I(() => {
2014
- const l = setTimeout(r, e.duration);
2015
- return () => {
2016
- clearTimeout(l);
2017
- };
2018
- }, [r, e.duration]);
2019
- const s = ie(() => e.variant === "success" ? /* @__PURE__ */ S(
2020
- "svg",
2021
- {
2022
- width: "20",
2023
- height: "20",
2024
- viewBox: "0 0 20 20",
2025
- fill: "none",
2026
- xmlns: "http://www.w3.org/2000/svg",
2027
- children: [
2028
- /* @__PURE__ */ c("circle", { cx: "10", cy: "10", r: "9", fill: "currentColor", opacity: "0.2" }),
2029
- /* @__PURE__ */ c(
2030
- "path",
2031
- {
2032
- d: "M6 10L8.5 12.5L14 7",
2033
- stroke: "currentColor",
2034
- strokeWidth: "2",
2035
- strokeLinecap: "round",
2036
- strokeLinejoin: "round"
2037
- }
2038
- )
2039
- ]
2040
- }
2041
- ) : e.variant === "error" ? /* @__PURE__ */ S(
2042
- "svg",
2043
- {
2044
- width: "20",
2045
- height: "20",
2046
- viewBox: "0 0 20 20",
2047
- fill: "none",
2048
- xmlns: "http://www.w3.org/2000/svg",
2049
- children: [
2050
- /* @__PURE__ */ c("circle", { cx: "10", cy: "10", r: "9", fill: "currentColor", opacity: "0.2" }),
2051
- /* @__PURE__ */ c(
2052
- "path",
2053
- {
2054
- d: "M7 7L13 13M13 7L7 13",
2055
- stroke: "currentColor",
2056
- strokeWidth: "2",
2057
- strokeLinecap: "round"
2058
- }
2059
- )
2060
- ]
2061
- }
2062
- ) : e.variant === "warning" ? /* @__PURE__ */ S(
2063
- "svg",
2064
- {
2065
- width: "20",
2066
- height: "20",
2067
- viewBox: "0 0 20 20",
2068
- fill: "none",
2069
- xmlns: "http://www.w3.org/2000/svg",
2070
- children: [
2071
- /* @__PURE__ */ c("path", { d: "M10 2L2 17H18L10 2Z", fill: "currentColor", opacity: "0.2" }),
2072
- /* @__PURE__ */ c(
2073
- "path",
2074
- {
2075
- d: "M10 7V11M10 14V14.5",
2076
- stroke: "currentColor",
2077
- strokeWidth: "2",
2078
- strokeLinecap: "round"
2079
- }
2080
- )
2081
- ]
2082
- }
2083
- ) : e.variant === "info" ? /* @__PURE__ */ S(
2084
- "svg",
2085
- {
2086
- width: "20",
2087
- height: "20",
2088
- viewBox: "0 0 20 20",
2089
- fill: "none",
2090
- xmlns: "http://www.w3.org/2000/svg",
2091
- children: [
2092
- /* @__PURE__ */ c("circle", { cx: "10", cy: "10", r: "9", fill: "currentColor", opacity: "0.2" }),
2093
- /* @__PURE__ */ c(
2094
- "path",
2095
- {
2096
- d: "M10 7V7.5M10 10V14",
2097
- stroke: "currentColor",
2098
- strokeWidth: "2",
2099
- strokeLinecap: "round"
2100
- }
2101
- )
2102
- ]
2103
- }
2104
- ) : null, [e.variant]), a = "motile-toast", i = [
2105
- a,
2106
- `${a}--${e.variant}`,
2107
- o && `${a}--exiting`
2108
- ].filter(Boolean).join(" ");
2109
- return /* @__PURE__ */ S(
2110
- "div",
2111
- {
2112
- className: i,
2113
- role: "status",
2114
- "aria-live": "polite",
2115
- "aria-atomic": "true",
2116
- "data-toast-id": e.id,
2117
- children: [
2118
- s && /* @__PURE__ */ c("div", { className: `${a}__icon`, children: s }),
2119
- /* @__PURE__ */ c("div", { className: `${a}__message`, children: e.message })
2120
- ]
2121
- }
2122
- );
2123
- }
2124
- function qt({ children: e, zIndex: n = 9999 }) {
2125
- const [o, t] = A([]), [r, s] = A(!1);
2126
- I(() => {
2127
- s(!0);
2128
- }, []);
2129
- const a = k(
2130
- (u, p = "default", m) => {
2131
- const h = `toast-${Date.now()}-${Math.random()}`, y = {
2132
- id: h,
2133
- message: u,
2134
- variant: p,
2135
- duration: (m == null ? void 0 : m.duration) ?? 4e3,
2136
- zIndex: m == null ? void 0 : m.zIndex,
2137
- createdAt: Date.now()
2138
- };
2139
- return t(($) => [y, ...$]), h;
2140
- },
2141
- []
2142
- ), i = k((u) => {
2143
- t((p) => p.filter((m) => m.id !== u));
2144
- }, []), l = ie(
2145
- () => ({
2146
- toasts: o,
2147
- addToast: a
2148
- }),
2149
- [o, a]
2150
- ), f = o.filter(
2151
- (u) => u.zIndex !== void 0
2152
- ), d = f.length > 0 ? Math.max(...f.map((u) => u.zIndex)) : n;
2153
- return /* @__PURE__ */ S(ze.Provider, { value: l, children: [
2154
- e,
2155
- r && ae(
2156
- /* @__PURE__ */ c(
2157
- "div",
2158
- {
2159
- className: "motile-toast-container",
2160
- "aria-live": "polite",
2161
- "aria-label": "Notifications",
2162
- style: { zIndex: d },
2163
- children: o.map((u) => /* @__PURE__ */ c(Bt, { toast: u, onRemove: i }, u.id))
2164
- }
2165
- ),
2166
- document.body
2167
- )
2168
- ] });
2169
- }
2170
- function Ut() {
2171
- const { addToast: e } = It(), n = k(
2172
- (a, i) => e(a, "default", i),
2173
- [e]
2174
- ), o = k(
2175
- (a, i) => e(a, "success", i),
2176
- [e]
2177
- ), t = k(
2178
- (a, i) => e(a, "error", i),
2179
- [e]
2180
- ), r = k(
2181
- (a, i) => e(a, "warning", i),
2182
- [e]
2183
- ), s = k(
2184
- (a, i) => e(a, "info", i),
2185
- [e]
2186
- );
2187
- return {
2188
- show: n,
2189
- success: o,
2190
- error: t,
2191
- warning: r,
2192
- info: s
2193
- };
2194
- }
2195
- const qe = X(null), Ue = () => {
2196
- const e = G(qe);
2197
- if (!e)
2198
- throw new Error("Dock compound components must be used within Dock.Root");
2199
- return e;
2200
- }, Ze = B(
2201
- ({
2202
- position: e = "bottom",
2203
- zIndex: n = 1e3,
2204
- color: o,
2205
- className: t,
2206
- children: r,
2207
- style: s,
2208
- ...a
2209
- }, i) => {
2210
- const [l, f] = A(null), [d, u] = A(null), p = C(null), m = 1.7, h = (v) => {
2211
- f(v.clientX), u(v.clientY);
2212
- }, y = () => {
2213
- f(null), u(null);
2214
- }, $ = T.useMemo(
2215
- () => ({
2216
- magnification: m,
2217
- mouseX: l,
2218
- mouseY: d,
2219
- position: e,
2220
- color: o
2221
- }),
2222
- [m, l, d, e, o]
2223
- );
2224
- return /* @__PURE__ */ c(qe.Provider, { value: $, children: /* @__PURE__ */ c(
2225
- "div",
2226
- {
2227
- ref: (v) => {
2228
- typeof i == "function" ? i(v) : i && (i.current = v), p.current = v;
2229
- },
2230
- className: `motile-dock ${t || ""}`,
2231
- "data-position": e,
2232
- style: { ...s, zIndex: n },
2233
- onMouseMove: h,
2234
- onMouseLeave: y,
2235
- ...a,
2236
- children: r
2237
- }
2238
- ) });
2239
- }
2240
- );
2241
- Ze.displayName = "Dock.Root";
2242
- const Xe = B(
2243
- ({ icon: e, label: n, asChild: o, color: t, className: r, children: s, style: a, ...i }, l) => {
2244
- const {
2245
- magnification: f,
2246
- mouseX: d,
2247
- mouseY: u,
2248
- position: p,
2249
- color: m
2250
- } = Ue(), h = C(null), y = C(), $ = t || m;
2251
- I(() => {
2252
- if (!h.current || window.matchMedia(
2253
- "(hover: none) and (pointer: coarse)"
2254
- ).matches) return;
2255
- const x = () => {
2256
- if (h.current)
2257
- if (d !== null && u !== null) {
2258
- const w = h.current.getBoundingClientRect();
2259
- let b;
2260
- if (p === "top" || p === "bottom") {
2261
- const Y = w.left + w.width / 2;
2262
- b = Math.abs(d - Y);
2263
- } else {
2264
- const Y = w.top + w.height / 2;
2265
- b = Math.abs(u - Y);
2266
- }
2267
- const _ = Math.max(0, 1 - b / 100), q = _ * _, U = 1 + (f - 1) * q;
2268
- h.current.style.transform = `scale(${U})`;
2269
- } else
2270
- h.current.style.transform = "scale(1)";
2271
- };
2272
- return y.current = requestAnimationFrame(x), () => {
2273
- y.current && cancelAnimationFrame(y.current);
2274
- };
2275
- }, [d, u, f, p]);
2276
- const v = p === "top" ? "bottom" : p === "bottom" ? "top" : p === "left" ? "right" : "left", N = {
2277
- ...a,
2278
- ...$ && { "--motile-dock-color": $ }
2279
- };
2280
- if (o && T.isValidElement(s)) {
2281
- const R = T.cloneElement(s, {
2282
- ref: (x) => {
2283
- typeof l == "function" ? l(x) : l && (l.current = x), h.current = x;
2284
- },
2285
- className: `motile-dock__item ${r || ""}`,
2286
- style: N,
2287
- "aria-label": n
2288
- });
2289
- return n ? /* @__PURE__ */ S(se.Root, { position: v, showArrow: !0, children: [
2290
- /* @__PURE__ */ c(se.Trigger, { children: R }),
2291
- /* @__PURE__ */ c(se.Content, { children: n })
2292
- ] }) : R;
2293
- }
2294
- const g = /* @__PURE__ */ c(
2295
- "button",
2296
- {
2297
- ref: (R) => {
2298
- typeof l == "function" ? l(R) : l && (l.current = R), h.current = R;
2299
- },
2300
- type: "button",
2301
- className: `motile-dock__item ${r || ""}`,
2302
- style: N,
2303
- "aria-label": n,
2304
- ...i,
2305
- children: e || s
2306
- }
2307
- );
2308
- return n ? /* @__PURE__ */ S(se.Root, { position: v, showArrow: !0, children: [
2309
- /* @__PURE__ */ c(se.Trigger, { children: g }),
2310
- /* @__PURE__ */ c(se.Content, { children: n })
2311
- ] }) : g;
2312
- }
2313
- );
2314
- Xe.displayName = "Dock.Item";
2315
- const Ge = B(
2316
- ({ className: e, ...n }, o) => {
2317
- const { position: t } = Ue();
2318
- return /* @__PURE__ */ c(
2319
- "div",
2320
- {
2321
- ref: o,
2322
- className: `motile-dock__separator ${e || ""}`,
2323
- "data-position": t,
2324
- "aria-hidden": "true",
2325
- ...n
2326
- }
2327
- );
2328
- }
2329
- );
2330
- Ge.displayName = "Dock.Separator";
2331
- const Zt = {
2332
- Root: Ze,
2333
- Item: Xe,
2334
- Separator: Ge
2335
- }, Je = X(null), Qe = () => {
2336
- const e = G(Je);
2337
- if (!e)
2338
- throw new Error(
2339
- "SpeedDial compound components must be used within SpeedDial.Root"
2340
- );
2341
- return e;
2342
- }, Ht = ({
2343
- open: e,
2344
- onOpenChange: n,
2345
- direction: o = "up",
2346
- color: t,
2347
- closeOnClickOutside: r = !0,
2348
- closeOnEscapeKey: s = !0,
2349
- children: a
2350
- }) => {
2351
- const i = C(null), l = Q();
2352
- le({
2353
- refs: [i],
2354
- handler: () => {
2355
- r && n(!1);
2356
- },
2357
- enabled: e
2358
- }), ce({
2359
- handler: () => {
2360
- s && n(!1);
2361
- },
2362
- enabled: e
2363
- });
2364
- const f = T.useMemo(
2365
- () => ({
2366
- open: e,
2367
- onOpenChange: n,
2368
- direction: o,
2369
- triggerId: l
2370
- }),
2371
- [e, n, o, l]
2372
- ), d = t ? { "--motile-speeddial-color": t } : void 0;
2373
- return /* @__PURE__ */ c(Je.Provider, { value: f, children: /* @__PURE__ */ c(
2374
- "div",
2375
- {
2376
- ref: i,
2377
- className: "motile-speed-dial",
2378
- style: d,
2379
- children: a
2380
- }
2381
- ) });
2382
- }, et = B(({ className: e, onClick: n, children: o, asChild: t = !1, ...r }, s) => {
2383
- const { open: a, onOpenChange: i, triggerId: l } = Qe(), f = (d) => {
2384
- n == null || n(d), d.defaultPrevented || i(!a);
2385
- };
2386
- return t ? /* @__PURE__ */ c(
2387
- W,
2388
- {
2389
- ref: s,
2390
- id: l,
2391
- className: e ? `motile-speed-dial__trigger ${e}` : "motile-speed-dial__trigger",
2392
- "aria-expanded": a,
2393
- "aria-haspopup": "menu",
2394
- onClick: f,
2395
- ...r,
2396
- children: o
2397
- }
2398
- ) : /* @__PURE__ */ c(
2399
- "button",
2400
- {
2401
- ref: s,
2402
- type: "button",
2403
- id: l,
2404
- className: e ? `motile-speed-dial__trigger ${e}` : "motile-speed-dial__trigger",
2405
- "aria-expanded": a,
2406
- "aria-haspopup": "menu",
2407
- onClick: f,
2408
- ...r,
2409
- children: o
2410
- }
2411
- );
2412
- });
2413
- et.displayName = "SpeedDial.Trigger";
2414
- const tt = B(({ className: e, children: n, ...o }, t) => {
2415
- const { open: r, direction: s, triggerId: a } = Qe();
2416
- if (!r) return null;
2417
- const i = T.Children.map(n, (l, f) => T.isValidElement(l) ? T.cloneElement(l, {
2418
- style: {
2419
- "--action-index": f,
2420
- ...l.props.style || {}
2421
- }
2422
- }) : l);
2423
- return /* @__PURE__ */ c(
2424
- "div",
2425
- {
2426
- ref: t,
2427
- role: "menu",
2428
- "aria-labelledby": a,
2429
- className: e ? `motile-speed-dial__actions ${e}` : "motile-speed-dial__actions",
2430
- "data-direction": s,
2431
- ...o,
2432
- children: i
2433
- }
2434
- );
2435
- });
2436
- tt.displayName = "SpeedDial.Actions";
2437
- const ot = B(({ className: e, onClick: n, children: o, asChild: t = !1, ...r }, s) => {
2438
- const a = (i) => {
2439
- n == null || n(i);
2440
- };
2441
- return t ? /* @__PURE__ */ c(
2442
- W,
2443
- {
2444
- ref: s,
2445
- role: "menuitem",
2446
- className: e ? `motile-speed-dial__action ${e}` : "motile-speed-dial__action",
2447
- onClick: a,
2448
- ...r,
2449
- children: o
2450
- }
2451
- ) : /* @__PURE__ */ c(
2452
- "button",
2453
- {
2454
- ref: s,
2455
- type: "button",
2456
- role: "menuitem",
2457
- className: e ? `motile-speed-dial__action ${e}` : "motile-speed-dial__action",
2458
- onClick: a,
2459
- ...r,
2460
- children: o
2461
- }
2462
- );
2463
- });
2464
- ot.displayName = "SpeedDial.Action";
2465
- const Xt = {
2466
- Root: Ht,
2467
- Trigger: et,
2468
- Actions: tt,
2469
- Action: ot
2470
- };
2471
- export {
2472
- jt as Accordion,
2473
- mt as Badge,
2474
- at as Button,
2475
- dt as Checkbox,
2476
- Zt as Dock,
2477
- Yt as Drawer,
2478
- lt as Input,
2479
- zt as Modal,
2480
- Wt as Popover,
2481
- Kt as Sheet,
2482
- Vt as Skeleton,
2483
- Xt as SpeedDial,
2484
- ut as Switch,
2485
- ct as Textarea,
2486
- qt as ToastProvider,
2487
- se as Tooltip,
2488
- le as useClickOutside,
2489
- ce as useEscapeKey,
2490
- fe as useScrollLock,
2491
- Ut as useToast
2492
- };