motile-ui 1.0.1 → 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 -2494
  44. package/dist/motile-ui.umd.js +0 -2
@@ -0,0 +1,197 @@
1
+ import { jsxs as $, jsx as g } from "react/jsx-runtime";
2
+ import h, { useCallback as R, useId as k, useRef as I, useMemo as N, createContext as j, useContext as E } from "react";
3
+ import './Popover.css';/* empty css */
4
+ import { Slot as T } from "../../utils/Slot.js";
5
+ import { useClickOutside as A } from "../../hooks/useClickOutside.js";
6
+ import { useEscapeKey as B } from "../../hooks/useEscapeKey.js";
7
+ import { FloatingArrow as F } from "../../utils/FloatingArrow.js";
8
+ const S = j(null);
9
+ function C() {
10
+ const t = E(S);
11
+ if (!t)
12
+ throw new Error("Popover components must be used within Popover.Root");
13
+ return t;
14
+ }
15
+ function K({
16
+ value: t,
17
+ defaultValue: s = !1,
18
+ onChange: o
19
+ }) {
20
+ const e = t !== void 0, [r, i] = h.useState(s), l = e ? t : r, a = R(
21
+ (c) => {
22
+ const m = typeof c == "function" ? c(l) : c;
23
+ e || i(m), o == null || o(m);
24
+ },
25
+ [e, o, l]
26
+ );
27
+ return [l, a];
28
+ }
29
+ function M({
30
+ children: t,
31
+ position: s = "top",
32
+ align: o = "center",
33
+ variant: e = "filled",
34
+ showArrow: r = !1,
35
+ zIndex: i = 10,
36
+ color: l,
37
+ bounceCount: a = 0,
38
+ open: c,
39
+ defaultOpen: m = !1,
40
+ onOpenChange: f,
41
+ onClickOutside: u,
42
+ onDismiss: v,
43
+ autoClose: d = !0
44
+ }) {
45
+ const n = k().replace(/:/g, ""), x = I(null), w = I(null), b = I(null), [P, p] = K({
46
+ value: c,
47
+ defaultValue: m,
48
+ onChange: f
49
+ }), y = N(
50
+ () => ({
51
+ open: P,
52
+ setOpen: p,
53
+ position: s,
54
+ align: o,
55
+ variant: e,
56
+ showArrow: r,
57
+ zIndex: i,
58
+ color: l,
59
+ autoClose: d,
60
+ bounceCount: a,
61
+ onOpenChange: f,
62
+ onClickOutside: u,
63
+ onDismiss: v,
64
+ triggerId: `${n}-trigger`,
65
+ contentId: `${n}-content`,
66
+ triggerRef: x,
67
+ contentRef: w,
68
+ wrapperRef: b
69
+ }),
70
+ [
71
+ P,
72
+ p,
73
+ s,
74
+ o,
75
+ e,
76
+ r,
77
+ i,
78
+ l,
79
+ d,
80
+ a,
81
+ f,
82
+ u,
83
+ v,
84
+ n
85
+ ]
86
+ );
87
+ return /* @__PURE__ */ g(S.Provider, { value: y, children: /* @__PURE__ */ g("div", { ref: b, className: "motile-popover-wrapper", children: t }) });
88
+ }
89
+ function V({ children: t, asChild: s = !1 }) {
90
+ const { open: o, setOpen: e, triggerId: r, contentId: i, triggerRef: l } = C(), a = R(() => {
91
+ e((c) => !c);
92
+ }, [e]);
93
+ return s ? /* @__PURE__ */ g(
94
+ T,
95
+ {
96
+ ref: (c) => {
97
+ l.current = c;
98
+ },
99
+ id: r,
100
+ "aria-expanded": o,
101
+ "aria-controls": i,
102
+ onClick: a,
103
+ children: t
104
+ }
105
+ ) : /* @__PURE__ */ g(
106
+ "button",
107
+ {
108
+ ref: l,
109
+ id: r,
110
+ type: "button",
111
+ "aria-expanded": o,
112
+ "aria-controls": i,
113
+ onClick: a,
114
+ children: t
115
+ }
116
+ );
117
+ }
118
+ function q({
119
+ children: t,
120
+ className: s = "",
121
+ style: o
122
+ }) {
123
+ const {
124
+ open: e,
125
+ setOpen: r,
126
+ position: i,
127
+ align: l,
128
+ variant: a,
129
+ showArrow: c,
130
+ zIndex: m,
131
+ color: f,
132
+ autoClose: u,
133
+ bounceCount: v,
134
+ onClickOutside: d,
135
+ onDismiss: n,
136
+ contentId: x,
137
+ contentRef: w,
138
+ wrapperRef: b
139
+ } = C();
140
+ if (B({
141
+ handler: R(
142
+ (p) => {
143
+ u && (n == null || n(p), p.defaultPrevented || r(!1));
144
+ },
145
+ [u, n, r]
146
+ ),
147
+ enabled: e
148
+ }), A({
149
+ refs: [b],
150
+ handler: R(
151
+ (p) => {
152
+ u && (d == null || d(p), n == null || n(p), p.defaultPrevented || r(!1));
153
+ },
154
+ [u, d, n, r]
155
+ ),
156
+ enabled: e
157
+ }), !e) return null;
158
+ const P = v !== 0;
159
+ return /* @__PURE__ */ $(
160
+ "div",
161
+ {
162
+ ref: w,
163
+ id: x,
164
+ role: "dialog",
165
+ "aria-modal": "false",
166
+ className: `motile-popover-content motile-popover-content--${a} ${s}`,
167
+ "data-placement": i,
168
+ "data-align": l,
169
+ "data-bounce": P ? "true" : "false",
170
+ style: {
171
+ zIndex: m,
172
+ ...f && { "--motile-popover-color": f },
173
+ "--bounce-count": v,
174
+ ...o
175
+ },
176
+ children: [
177
+ c && /* @__PURE__ */ g(
178
+ F,
179
+ {
180
+ className: "motile-popover-arrow",
181
+ variant: a,
182
+ color: f || (a === "filled" ? "var(--motile-ui-popover, var(--motile-theme, #3b82f6))" : "var(--motile-ui-popover, var(--motile-theme, #e5e7eb))")
183
+ }
184
+ ),
185
+ t
186
+ ]
187
+ }
188
+ );
189
+ }
190
+ const U = {
191
+ Root: M,
192
+ Trigger: V,
193
+ Content: q
194
+ };
195
+ export {
196
+ U as Popover
197
+ };
@@ -0,0 +1 @@
1
+ .motile-sheet__overlay{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#0000;transition:background-color .3s ease;overscroll-behavior:contain;display:flex}.motile-sheet__overlay--left{justify-content:flex-start}.motile-sheet__overlay--right{justify-content:flex-end}.motile-sheet__overlay--visible{background-color:#0006}.motile-sheet__content{position:fixed;top:0;bottom:0;margin:0;width:100%;max-width:var(--sheet-max-width, 600px);height:100vh;height:100dvh;background-color:#fff;box-shadow:0 0 30px #00000026;display:flex;flex-direction:column;transition:transform .3s ease;will-change:transform;overscroll-behavior:contain;box-sizing:border-box}.motile-sheet__content--left{left:0;border-right:1px solid #e5e7eb;transform:translate(-100%)}.motile-sheet__content--left.motile-sheet__content--visible{transform:translate(0)}.motile-sheet__content--right{right:0;border-left:1px solid #e5e7eb;transform:translate(100%)}.motile-sheet__content--right.motile-sheet__content--visible{transform:translate(0)}@media (max-width: 768px){.motile-sheet__content{max-width:none;width:100%}}.motile-sheet__header{height:56px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 20px;flex-shrink:0;border-bottom:1px solid #e5e7eb;background-color:#fff;user-select:none;-webkit-user-select:none}.motile-sheet__header button{color:inherit}@media (min-width: 769px){.motile-sheet__header{height:64px;padding:0 24px}}.motile-sheet__back-button{display:flex;align-items:center;gap:12px;background:none;border:none;padding:8px 12px 8px 4px;margin-left:-4px;cursor:pointer;border-radius:8px;color:#111827;transition:all .2s ease;font-size:16px;font-weight:600}.motile-sheet__back-button:hover{background-color:#f3f4f6}.motile-sheet__back-button:active{transform:scale(.98)}.motile-sheet__chevron{width:24px;height:24px;flex-shrink:0}.motile-sheet__title{flex:1;min-width:0;margin:0;font-size:18px;font-weight:600;color:#111827;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media (max-width: 768px){.motile-sheet__title{font-size:16px}}.motile-sheet__close{display:flex;align-items:center;justify-content:center;min-width:32px;min-height:32px;padding:0;margin:0;background:none;border:none;border-radius:6px;cursor:pointer;color:#6b7280;transition:all .15s ease;flex-shrink:0;-webkit-tap-highlight-color:transparent}.motile-sheet__close:hover{background-color:#f3f4f6;color:#111827}.motile-sheet__close:active{transform:scale(.95);background-color:#e5e7eb}.motile-sheet__close:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.motile-sheet__body{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;padding:20px;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;width:100%;box-sizing:border-box;background-color:#fff}@media (min-width: 769px){.motile-sheet__body{padding:20px 24px}}.motile-sheet__body::-webkit-scrollbar{width:6px}.motile-sheet__body::-webkit-scrollbar-track{background:transparent}.motile-sheet__body::-webkit-scrollbar-thumb{background-color:#0003;border-radius:3px}.motile-sheet__body::-webkit-scrollbar-thumb:hover{background-color:#0000004d}@media (prefers-color-scheme: dark){.motile-sheet__content{background-color:#1f2937;box-shadow:0 0 30px #00000080}.motile-sheet__content--left{border-right-color:#374151}.motile-sheet__content--right{border-left-color:#374151}.motile-sheet__header{background-color:#1f2937;border-bottom-color:#374151}.motile-sheet__back-button{color:#f9fafb}.motile-sheet__back-button:hover{background-color:#374151}.motile-sheet__title{color:#f9fafb}.motile-sheet__body{background-color:#1f2937}.motile-sheet__body::-webkit-scrollbar-thumb{background-color:#fff3}.motile-sheet__body::-webkit-scrollbar-thumb:hover{background-color:#ffffff4d}.motile-sheet__close{color:#9ca3af}.motile-sheet__close:hover{background-color:#374151;color:#f9fafb}.motile-sheet__close:active{background-color:#4b5563}}@media (prefers-reduced-motion: reduce){.motile-sheet__content,.motile-sheet__overlay{transition:none}}@media (hover: none) and (pointer: coarse){.motile-sheet__header{height:60px}.motile-sheet__chevron{width:26px;height:26px}}
@@ -0,0 +1,283 @@
1
+ import { jsx as u, jsxs as $ } from "react/jsx-runtime";
2
+ import { useCallback as v, useState as S, useEffect as b, useId as F, useRef as x, useMemo as A, createContext as T, useContext as w } from "react";
3
+ import { createPortal as K } from "react-dom";
4
+ import { Slot as g } from "../../utils/Slot.js";
5
+ import { useScrollLock as N } from "../../hooks/useScrollLock.js";
6
+ import { useClickOutside as H } from "../../hooks/useClickOutside.js";
7
+ import { useEscapeKey as V } from "../../hooks/useEscapeKey.js";
8
+ import { useHistoryClose as q } from "../../hooks/useHistoryClose.js";
9
+ import './Sheet.css';/* empty css */
10
+ const I = T(null);
11
+ function k() {
12
+ const e = w(I);
13
+ if (!e)
14
+ throw new Error("Sheet components must be used within Sheet.Root");
15
+ return e;
16
+ }
17
+ function z({
18
+ value: e,
19
+ defaultValue: n = !1,
20
+ onChange: o
21
+ }) {
22
+ const t = e !== void 0, [a, l] = S(n), s = t ? e : a, i = v(
23
+ (r) => {
24
+ const f = typeof r == "function" ? r(s) : r;
25
+ t || l(f), o == null || o(f);
26
+ },
27
+ [t, o, s]
28
+ );
29
+ return [s, i];
30
+ }
31
+ function B({
32
+ children: e,
33
+ position: n = "right",
34
+ closeOnBackdrop: o = !0,
35
+ maxWidth: t = "600px",
36
+ zIndex: a = 1e3,
37
+ open: l,
38
+ defaultOpen: s = !1,
39
+ onOpenChange: i
40
+ }) {
41
+ const r = F().replace(/:/g, ""), f = x(null), p = x(null), [d, c] = z({
42
+ value: l,
43
+ defaultValue: s,
44
+ onChange: i
45
+ }), { isClosingFromHistory: h, navigateAndClose: y } = q({
46
+ isOpen: d,
47
+ onClose: () => c(!1)
48
+ }), m = A(
49
+ () => ({
50
+ open: d,
51
+ setOpen: c,
52
+ position: n,
53
+ closeOnBackdrop: o,
54
+ maxWidth: t,
55
+ zIndex: a,
56
+ onOpenChange: i,
57
+ triggerId: `${r}-trigger`,
58
+ contentId: `${r}-content`,
59
+ overlayRef: f,
60
+ sheetRef: p,
61
+ isClosingFromHistory: h,
62
+ navigateAndClose: y
63
+ }),
64
+ [
65
+ d,
66
+ c,
67
+ n,
68
+ o,
69
+ t,
70
+ a,
71
+ i,
72
+ r,
73
+ f,
74
+ p,
75
+ h,
76
+ y
77
+ ]
78
+ );
79
+ return /* @__PURE__ */ u(I.Provider, { value: m, children: e });
80
+ }
81
+ function P({ children: e, asChild: n = !1 }) {
82
+ const { open: o, setOpen: t, triggerId: a, contentId: l } = k(), s = v(() => {
83
+ t((i) => !i);
84
+ }, [t]);
85
+ return n ? /* @__PURE__ */ u(
86
+ g,
87
+ {
88
+ id: a,
89
+ "aria-expanded": o,
90
+ "aria-controls": l,
91
+ onClick: s,
92
+ children: e
93
+ }
94
+ ) : /* @__PURE__ */ u(
95
+ "button",
96
+ {
97
+ id: a,
98
+ type: "button",
99
+ "aria-expanded": o,
100
+ "aria-controls": l,
101
+ onClick: s,
102
+ children: e
103
+ }
104
+ );
105
+ }
106
+ function j({ children: e, container: n }) {
107
+ const { open: o } = k();
108
+ return !o || typeof document > "u" ? null : K(e, n || document.body);
109
+ }
110
+ function E({ className: e = "", style: n }) {
111
+ const { open: o, setOpen: t, position: a, closeOnBackdrop: l, zIndex: s, overlayRef: i } = k(), [r, f] = S(!1), [p, d] = S(!1), c = typeof l == "boolean" ? { clickOutside: l } : {
112
+ escapeKey: l.escapeKey ?? !1,
113
+ clickOutside: l.clickOutside ?? !1
114
+ };
115
+ b(() => {
116
+ if (o)
117
+ f(!0);
118
+ else if (r) {
119
+ d(!1);
120
+ const m = setTimeout(() => {
121
+ f(!1);
122
+ }, 300);
123
+ return () => clearTimeout(m);
124
+ }
125
+ }, [o, r]), b(() => {
126
+ if (!r || !o) return;
127
+ const m = requestAnimationFrame(() => {
128
+ const _ = requestAnimationFrame(() => {
129
+ d(!0);
130
+ });
131
+ return () => cancelAnimationFrame(_);
132
+ });
133
+ return () => cancelAnimationFrame(m);
134
+ }, [r, o]);
135
+ const h = v(
136
+ (m) => {
137
+ c.clickOutside && m.target === i.current && t(!1);
138
+ },
139
+ [c.clickOutside, t, i]
140
+ );
141
+ if (!r)
142
+ return null;
143
+ const y = {
144
+ zIndex: s,
145
+ ...n
146
+ };
147
+ return /* @__PURE__ */ u(
148
+ "div",
149
+ {
150
+ ref: i,
151
+ className: `motile-sheet__overlay ${p ? "motile-sheet__overlay--visible" : ""} motile-sheet__overlay--${a} ${e}`,
152
+ style: y,
153
+ onClick: h,
154
+ role: "presentation"
155
+ }
156
+ );
157
+ }
158
+ function L({ children: e, className: n = "", style: o }) {
159
+ const {
160
+ open: t,
161
+ setOpen: a,
162
+ position: l,
163
+ closeOnBackdrop: s,
164
+ maxWidth: i,
165
+ zIndex: r,
166
+ contentId: f,
167
+ sheetRef: p,
168
+ isClosingFromHistory: d
169
+ } = k(), [c, h] = S(!1), [y, m] = S(!1), _ = typeof s == "boolean" ? { escapeKey: s, clickOutside: s } : {
170
+ escapeKey: s.escapeKey ?? !1,
171
+ clickOutside: s.clickOutside ?? !1
172
+ };
173
+ if (N({
174
+ enabled: t,
175
+ allowedSelectors: [".motile-sheet__body"]
176
+ }), H({
177
+ refs: [p],
178
+ handler: () => a(!1),
179
+ enabled: t && _.clickOutside
180
+ }), V({
181
+ handler: () => a(!1),
182
+ enabled: t && _.escapeKey
183
+ }), b(() => {
184
+ if (t)
185
+ h(!0);
186
+ else if (c) {
187
+ m(!1);
188
+ const C = setTimeout(() => {
189
+ h(!1);
190
+ }, d ? 0 : 300);
191
+ return () => clearTimeout(C);
192
+ }
193
+ }, [t, c, d]), b(() => {
194
+ if (!c || !t || d) return;
195
+ const O = requestAnimationFrame(() => {
196
+ const C = requestAnimationFrame(() => {
197
+ m(!0);
198
+ });
199
+ return () => cancelAnimationFrame(C);
200
+ });
201
+ return () => cancelAnimationFrame(O);
202
+ }, [c, t, d]), !c)
203
+ return null;
204
+ const R = {
205
+ ...i !== "600px" && { "--sheet-max-width": i },
206
+ zIndex: r + 1,
207
+ ...o
208
+ };
209
+ return /* @__PURE__ */ u(
210
+ "div",
211
+ {
212
+ ref: p,
213
+ id: f,
214
+ className: `motile-sheet__content motile-sheet__content--${l} ${y ? "motile-sheet__content--visible" : ""} ${n}`,
215
+ style: R,
216
+ role: "dialog",
217
+ "aria-modal": "true",
218
+ children: e
219
+ }
220
+ );
221
+ }
222
+ function D({ children: e, className: n = "" }) {
223
+ return /* @__PURE__ */ u("div", { className: `motile-sheet__header ${n}`, children: e });
224
+ }
225
+ function M({ children: e, className: n = "" }) {
226
+ return /* @__PURE__ */ u("h2", { id: "sheet-title", className: `motile-sheet__title ${n}`, children: e });
227
+ }
228
+ function W({ children: e, className: n = "" }) {
229
+ return /* @__PURE__ */ u("div", { className: `motile-sheet__body ${n}`, children: e });
230
+ }
231
+ function G({ children: e, asChild: n = !1 }) {
232
+ const { setOpen: o } = k(), t = v(() => {
233
+ o(!1);
234
+ }, [o]);
235
+ return n ? /* @__PURE__ */ u(
236
+ g,
237
+ {
238
+ className: "motile-sheet__close",
239
+ onClick: t,
240
+ "aria-label": "닫기",
241
+ children: e
242
+ }
243
+ ) : /* @__PURE__ */ u(
244
+ "button",
245
+ {
246
+ className: "motile-sheet__close",
247
+ onClick: t,
248
+ "aria-label": "닫기",
249
+ type: "button",
250
+ children: e || /* @__PURE__ */ $(
251
+ "svg",
252
+ {
253
+ width: "20",
254
+ height: "20",
255
+ viewBox: "0 0 24 24",
256
+ fill: "none",
257
+ stroke: "currentColor",
258
+ strokeWidth: "2",
259
+ strokeLinecap: "round",
260
+ strokeLinejoin: "round",
261
+ children: [
262
+ /* @__PURE__ */ u("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
263
+ /* @__PURE__ */ u("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
264
+ ]
265
+ }
266
+ )
267
+ }
268
+ );
269
+ }
270
+ const ne = {
271
+ Root: B,
272
+ Trigger: P,
273
+ Portal: j,
274
+ Overlay: E,
275
+ Content: L,
276
+ Header: D,
277
+ Title: M,
278
+ Body: W,
279
+ Close: G
280
+ };
281
+ export {
282
+ ne as Sheet
283
+ };
@@ -0,0 +1 @@
1
+ .motile-skeleton{display:inline-block;position:relative;overflow:hidden;background-color:#e5e7eb}.motile-skeleton:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,#fff0,#fff6,#fff0);transform:translate(-100%);animation:motile-skeleton-shimmer 1.5s ease-in-out infinite}@keyframes motile-skeleton-shimmer{0%{transform:translate(-100%)}to{transform:translate(100%)}}@media (prefers-reduced-motion: reduce){.motile-skeleton:after{animation:none;display:none}}@media (prefers-color-scheme: dark){.motile-skeleton{background-color:#374151}.motile-skeleton:after{background:linear-gradient(90deg,#fff0,#ffffff1a,#fff0)}}
@@ -0,0 +1,30 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import './Skeleton.css';/* empty css */
3
+ const f = ({
4
+ width: o = "100%",
5
+ height: r = "1rem",
6
+ borderRadius: s = "4px",
7
+ className: a,
8
+ style: i,
9
+ ...l
10
+ }) => {
11
+ const n = ["motile-skeleton", a].filter(Boolean).join(" "), t = (e, c) => e === void 0 ? c : typeof e == "number" ? `${e}px` : e, m = {
12
+ ...i,
13
+ width: t(o, "100%"),
14
+ height: t(r, "1rem"),
15
+ borderRadius: t(s, "4px")
16
+ };
17
+ return /* @__PURE__ */ p(
18
+ "div",
19
+ {
20
+ className: n,
21
+ style: m,
22
+ "aria-busy": "true",
23
+ "aria-live": "polite",
24
+ ...l
25
+ }
26
+ );
27
+ };
28
+ export {
29
+ f as Skeleton
30
+ };
@@ -0,0 +1 @@
1
+ .motile-speed-dial{position:relative;display:inline-flex;align-items:center;justify-content:center}.motile-speed-dial__trigger{position:relative;z-index:2;display:flex;align-items:center;justify-content:center;width:56px;height:56px;padding:0;border:none;border-radius:50%;background-color:var(--motile-speeddial-color, var(--motile-theme, #3b82f6));color:#fff;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1);font-size:16px;font-weight:500}.motile-speed-dial__trigger:hover{filter:brightness(.9);box-shadow:0 6px 16px #0003,0 3px 6px #00000026;transform:scale(1.05)}.motile-speed-dial__trigger:active{filter:brightness(.85);transform:scale(.95);box-shadow:0 2px 8px #00000026,0 1px 3px #0000001a}.motile-speed-dial__trigger[aria-expanded=true]{filter:brightness(.75);transform:rotate(45deg)}.motile-speed-dial__actions{position:absolute;display:flex;gap:12px;z-index:1}.motile-speed-dial__actions[data-direction=up]{flex-direction:column-reverse;bottom:100%;left:50%;transform:translate(-50%);margin-bottom:12px}.motile-speed-dial__actions[data-direction=down]{flex-direction:column;top:100%;left:50%;transform:translate(-50%);margin-top:12px}.motile-speed-dial__actions[data-direction=left]{flex-direction:row-reverse;right:100%;top:50%;transform:translateY(-50%);margin-right:12px}.motile-speed-dial__actions[data-direction=right]{flex-direction:row;left:100%;top:50%;transform:translateY(-50%);margin-left:12px}.motile-speed-dial__action{display:flex;align-items:center;justify-content:center;width:48px;height:48px;padding:0;border:none;border-radius:50%;background-color:#fff;color:#374151;box-shadow:0 2px 8px #0000001a,0 1px 3px #00000014;cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1);font-size:14px}.motile-speed-dial__action:hover{background-color:#f3f4f6;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;transform:scale(1.08)}.motile-speed-dial__action:active{transform:scale(.95);box-shadow:0 1px 4px #0000001a,0 0 2px #00000014}.motile-speed-dial__actions[data-direction=up] .motile-speed-dial__action{animation:motile-speed-dial-slide-up .3s cubic-bezier(.34,1.56,.64,1) backwards;animation-delay:calc(var(--action-index) * .05s)}.motile-speed-dial__actions[data-direction=down] .motile-speed-dial__action{animation:motile-speed-dial-slide-down .3s cubic-bezier(.34,1.56,.64,1) backwards;animation-delay:calc(var(--action-index) * .05s)}.motile-speed-dial__actions[data-direction=left] .motile-speed-dial__action{animation:motile-speed-dial-slide-left .3s cubic-bezier(.34,1.56,.64,1) backwards;animation-delay:calc(var(--action-index) * .05s)}.motile-speed-dial__actions[data-direction=right] .motile-speed-dial__action{animation:motile-speed-dial-slide-right .3s cubic-bezier(.34,1.56,.64,1) backwards;animation-delay:calc(var(--action-index) * .05s)}@keyframes motile-speed-dial-slide-up{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes motile-speed-dial-slide-down{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes motile-speed-dial-slide-left{0%{opacity:0;transform:translate(10px)}to{opacity:1;transform:translate(0)}}@keyframes motile-speed-dial-slide-right{0%{opacity:0;transform:translate(-10px)}to{opacity:1;transform:translate(0)}}@media (prefers-reduced-motion: reduce){.motile-speed-dial__actions[data-direction=up] .motile-speed-dial__action,.motile-speed-dial__actions[data-direction=down] .motile-speed-dial__action,.motile-speed-dial__actions[data-direction=left] .motile-speed-dial__action,.motile-speed-dial__actions[data-direction=right] .motile-speed-dial__action{animation:none}}.motile-speed-dial__trigger:focus-visible,.motile-speed-dial__action:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}@media (prefers-color-scheme: dark){.motile-speed-dial__trigger{box-shadow:0 4px 12px #0000004d,0 2px 4px #0003}.motile-speed-dial__trigger:hover{box-shadow:0 6px 16px #0006,0 3px 6px #0000004d}.motile-speed-dial__action{background-color:#374151;color:#f9fafb;box-shadow:0 2px 8px #0000004d,0 1px 3px #0003}.motile-speed-dial__action:hover{background-color:#4b5563;box-shadow:0 4px 12px #0006,0 2px 4px #0000004d}}
@@ -0,0 +1,149 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import m, { forwardRef as c, useRef as y, useId as b, createContext as R, useContext as h } from "react";
3
+ import { Slot as f } from "../../utils/Slot.js";
4
+ import { useClickOutside as v } from "../../hooks/useClickOutside.js";
5
+ import { useEscapeKey as A } from "../../hooks/useEscapeKey.js";
6
+ import './SpeedDial.css';/* empty css */
7
+ const _ = R(null), g = () => {
8
+ const e = h(_);
9
+ if (!e)
10
+ throw new Error(
11
+ "SpeedDial compound components must be used within SpeedDial.Root"
12
+ );
13
+ return e;
14
+ }, I = ({
15
+ open: e,
16
+ onOpenChange: t,
17
+ direction: i = "up",
18
+ color: d,
19
+ closeOnClickOutside: n = !0,
20
+ closeOnEscapeKey: a = !0,
21
+ children: o
22
+ }) => {
23
+ const l = y(null), r = b();
24
+ v({
25
+ refs: [l],
26
+ handler: () => {
27
+ n && t(!1);
28
+ },
29
+ enabled: e
30
+ }), A({
31
+ handler: () => {
32
+ a && t(!1);
33
+ },
34
+ enabled: e
35
+ });
36
+ const p = m.useMemo(
37
+ () => ({
38
+ open: e,
39
+ onOpenChange: t,
40
+ direction: i,
41
+ triggerId: r
42
+ }),
43
+ [e, t, i, r]
44
+ ), u = d ? { "--motile-speeddial-color": d } : void 0;
45
+ return /* @__PURE__ */ s(_.Provider, { value: p, children: /* @__PURE__ */ s(
46
+ "div",
47
+ {
48
+ ref: l,
49
+ className: "motile-speed-dial",
50
+ style: u,
51
+ children: o
52
+ }
53
+ ) });
54
+ }, S = c(({ className: e, onClick: t, children: i, asChild: d = !1, ...n }, a) => {
55
+ const { open: o, onOpenChange: l, triggerId: r } = g(), p = (u) => {
56
+ t == null || t(u), u.defaultPrevented || l(!o);
57
+ };
58
+ return d ? /* @__PURE__ */ s(
59
+ f,
60
+ {
61
+ ref: a,
62
+ id: r,
63
+ className: e ? `motile-speed-dial__trigger ${e}` : "motile-speed-dial__trigger",
64
+ "aria-expanded": o,
65
+ "aria-haspopup": "menu",
66
+ onClick: p,
67
+ ...n,
68
+ children: i
69
+ }
70
+ ) : /* @__PURE__ */ s(
71
+ "button",
72
+ {
73
+ ref: a,
74
+ type: "button",
75
+ id: r,
76
+ className: e ? `motile-speed-dial__trigger ${e}` : "motile-speed-dial__trigger",
77
+ "aria-expanded": o,
78
+ "aria-haspopup": "menu",
79
+ onClick: p,
80
+ ...n,
81
+ children: i
82
+ }
83
+ );
84
+ });
85
+ S.displayName = "SpeedDial.Trigger";
86
+ const x = c(({ className: e, children: t, ...i }, d) => {
87
+ const { open: n, direction: a, triggerId: o } = g();
88
+ if (!n) return null;
89
+ const l = m.Children.map(t, (r, p) => m.isValidElement(r) ? m.cloneElement(r, {
90
+ style: {
91
+ "--action-index": p,
92
+ ...r.props.style || {}
93
+ }
94
+ }) : r);
95
+ return /* @__PURE__ */ s(
96
+ "div",
97
+ {
98
+ ref: d,
99
+ role: "menu",
100
+ "aria-labelledby": o,
101
+ className: e ? `motile-speed-dial__actions ${e}` : "motile-speed-dial__actions",
102
+ "data-direction": a,
103
+ ...i,
104
+ children: l
105
+ }
106
+ );
107
+ });
108
+ x.displayName = "SpeedDial.Actions";
109
+ const D = c(({ className: e, onClick: t, children: i, asChild: d = !1, ...n }, a) => {
110
+ const o = (l) => {
111
+ t == null || t(l);
112
+ };
113
+ return d ? /* @__PURE__ */ s(
114
+ f,
115
+ {
116
+ ref: a,
117
+ role: "menuitem",
118
+ className: e ? `motile-speed-dial__action ${e}` : "motile-speed-dial__action",
119
+ onClick: o,
120
+ ...n,
121
+ children: i
122
+ }
123
+ ) : /* @__PURE__ */ s(
124
+ "button",
125
+ {
126
+ ref: a,
127
+ type: "button",
128
+ role: "menuitem",
129
+ className: e ? `motile-speed-dial__action ${e}` : "motile-speed-dial__action",
130
+ onClick: o,
131
+ ...n,
132
+ children: i
133
+ }
134
+ );
135
+ });
136
+ D.displayName = "SpeedDial.Action";
137
+ const P = {
138
+ Root: I,
139
+ Trigger: S,
140
+ Actions: x,
141
+ Action: D
142
+ };
143
+ export {
144
+ P as SpeedDial,
145
+ D as SpeedDialAction,
146
+ x as SpeedDialActions,
147
+ I as SpeedDialRoot,
148
+ S as SpeedDialTrigger
149
+ };
@@ -0,0 +1 @@
1
+ .motile-switch-container{display:inline-flex;flex-direction:column;gap:4px}.motile-switch-wrapper{display:flex;align-items:center;gap:8px;cursor:pointer;position:relative;-webkit-user-select:none;user-select:none}.motile-switch-container--disabled .motile-switch-wrapper{cursor:not-allowed;opacity:.6}.motile-switch{position:absolute;opacity:0;width:0;height:0;margin:0;pointer-events:none}.motile-switch:focus{outline:none}.motile-switch__track{position:relative;width:44px;height:24px;background-color:#e5e7eb;border-radius:24px;transition:background-color .2s cubic-bezier(.4,0,.2,1);display:flex;align-items:center;flex-shrink:0;box-sizing:border-box}.motile-switch__thumb{position:absolute;width:18px;height:18px;background-color:#fff;border-radius:50%;left:3px;transition:transform .2s cubic-bezier(.4,0,.2,1);box-shadow:0 2px 4px #0000001a}.motile-switch:checked+.motile-switch__track{background-color:var( --motile-switch-color, var(--motile-ui-switch, var(--motile-theme, #3b82f6)) )}.motile-switch:checked+.motile-switch__track .motile-switch__thumb{transform:translate(20px)}.motile-switch:not(:checked)+.motile-switch__track:hover{background-color:#d1d5db}.motile-switch:checked+.motile-switch__track:hover{background-color:color-mix(in srgb,var( --motile-switch-color, var(--motile-ui-switch, var(--motile-theme, #3b82f6)) ) 90%,black)}.motile-switch:disabled+.motile-switch__track{background-color:#f3f4f6;cursor:not-allowed}.motile-switch:disabled:checked+.motile-switch__track{background-color:#d1d5db}.motile-switch:disabled+.motile-switch__track .motile-switch__thumb{box-shadow:none}.motile-switch--elastic+.motile-switch__track .motile-switch__thumb{transition:none;will-change:transform}.motile-switch--elastic:checked+.motile-switch__track .motile-switch__thumb{animation:switch-slide-on .35s cubic-bezier(.25,.1,.25,1);transform:translate(20px);transform-origin:left center}.motile-switch--elastic:not(:checked)+.motile-switch__track .motile-switch__thumb{animation:switch-slide-off .35s cubic-bezier(.25,.1,.25,1);transform:translate(0);transform-origin:right center}@keyframes switch-slide-on{0%{transform:translate(0) scaleX(1)}10%{transform:translate(.5px) scaleX(1.05)}25%{transform:translate(3px) scaleX(1.25)}45%{transform:translate(8px) scaleX(1.4)}65%{transform:translate(14px) scaleX(1.3)}85%{transform:translate(18.5px) scaleX(1.08)}95%{transform:translate(19.8px) scaleX(1.02)}to{transform:translate(20px) scaleX(1)}}@keyframes switch-slide-off{0%{transform:translate(20px) scaleX(1)}10%{transform:translate(19.5px) scaleX(1.05)}25%{transform:translate(17px) scaleX(1.25)}45%{transform:translate(12px) scaleX(1.4)}65%{transform:translate(6px) scaleX(1.3)}85%{transform:translate(1.5px) scaleX(1.08)}95%{transform:translate(.2px) scaleX(1.02)}to{transform:translate(0) scaleX(1)}}.motile-switch--bounce+.motile-switch__track .motile-switch__thumb{transition:none;will-change:transform}.motile-switch--bounce:checked+.motile-switch__track .motile-switch__thumb{animation:switch-bounce-on .65s cubic-bezier(.68,-.55,.27,1.55);transform:translate(20px)}.motile-switch--bounce:not(:checked)+.motile-switch__track .motile-switch__thumb{animation:switch-bounce-off .65s cubic-bezier(.68,-.55,.27,1.55);transform:translate(0)}@keyframes switch-bounce-on{0%{transform:translate(0)}60%{transform:translate(23px)}80%{transform:translate(18px)}95%{transform:translate(20.5px)}to{transform:translate(20px)}}@keyframes switch-bounce-off{0%{transform:translate(20px)}60%{transform:translate(-3px)}80%{transform:translate(2px)}95%{transform:translate(-.5px)}to{transform:translate(0)}}