motile-ui 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/components/Accordion/index.d.ts +1 -1
- package/dist/components/Badge/Badge.css +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Checkbox/index.d.ts +1 -1
- package/dist/components/Dock/index.d.ts +2 -2
- package/dist/components/Drawer/Drawer.js +6 -6
- package/dist/components/Drawer/index.d.ts +1 -1
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/Modal/Modal.js +8 -8
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/NumberFlow/NumberFlow.css +1 -0
- package/dist/components/NumberFlow/NumberFlow.d.ts +31 -0
- package/dist/components/NumberFlow/NumberFlow.js +128 -0
- package/dist/components/NumberFlow/NumberFlow.test.d.ts +1 -0
- package/dist/components/NumberFlow/index.d.ts +2 -0
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Popover/Popover.js +8 -8
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Sheet/Sheet.d.ts +8 -2
- package/dist/components/Sheet/Sheet.js +119 -122
- package/dist/components/Sheet/index.d.ts +1 -1
- package/dist/components/Skeleton/index.d.ts +1 -1
- package/dist/components/SpeedDial/SpeedDial.js +1 -1
- package/dist/components/SpeedDial/index.d.ts +2 -2
- package/dist/components/Switch/index.d.ts +1 -1
- package/dist/components/Textarea/index.d.ts +1 -1
- package/dist/components/TimePicker/TimePicker.css +1 -0
- package/dist/components/TimePicker/TimePicker.d.ts +33 -0
- package/dist/components/TimePicker/TimePicker.js +281 -0
- package/dist/components/TimePicker/TimePicker.test.d.ts +1 -0
- package/dist/components/TimePicker/index.d.ts +2 -0
- package/dist/components/Toast/index.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +4 -4
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.js +6 -6
- package/dist/hooks/useHistoryClose.d.ts +7 -1
- package/dist/hooks/useHistoryClose.js +30 -29
- package/dist/index.d.ts +31 -27
- package/dist/index.js +34 -30
- package/dist/test/utils.d.ts +1 -1
- package/dist/utils/Slot.js +7 -7
- package/package.json +21 -1
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { jsx as S, jsxs as X } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as U, useRef as f, useMemo as O, useCallback as T, useEffect as N, useState as Z, createContext as ee, useContext as te } from "react";
|
|
3
|
+
import './TimePicker.css';/* empty css */
|
|
4
|
+
const W = ee(null), q = () => {
|
|
5
|
+
const t = te(W);
|
|
6
|
+
if (!t)
|
|
7
|
+
throw new Error(
|
|
8
|
+
"TimePicker components must be used within TimePicker.Root"
|
|
9
|
+
);
|
|
10
|
+
return t;
|
|
11
|
+
}, z = U(
|
|
12
|
+
({
|
|
13
|
+
value: t,
|
|
14
|
+
defaultValue: w,
|
|
15
|
+
onChange: v,
|
|
16
|
+
format: l = "12",
|
|
17
|
+
minuteStep: a = 5,
|
|
18
|
+
disabled: p = !1,
|
|
19
|
+
itemHeight: n = 40,
|
|
20
|
+
fullWidth: g = !1,
|
|
21
|
+
children: $,
|
|
22
|
+
className: D,
|
|
23
|
+
style: I,
|
|
24
|
+
...m
|
|
25
|
+
}, M) => {
|
|
26
|
+
const [P, E] = Z(() => t || w || {
|
|
27
|
+
hour: l === "12" ? 12 : 0,
|
|
28
|
+
minute: 0,
|
|
29
|
+
period: l === "12" ? "AM" : void 0
|
|
30
|
+
}), k = t !== void 0, b = k ? t : P, L = O(() => l === "12" ? Array.from({ length: 12 }, (x, u) => u + 1) : Array.from({ length: 24 }, (x, u) => u), [l]), _ = O(() => {
|
|
31
|
+
const x = 60 / a;
|
|
32
|
+
return Array.from({ length: x }, (u, s) => s * a);
|
|
33
|
+
}, [a]), V = O(() => ["AM", "PM"], []), A = T(
|
|
34
|
+
(x, u) => {
|
|
35
|
+
const s = { ...b };
|
|
36
|
+
x === "hour" ? s.hour = u : x === "minute" ? s.minute = u : s.period = u, k || E(s), v == null || v(s);
|
|
37
|
+
},
|
|
38
|
+
[b, k, v]
|
|
39
|
+
), o = {
|
|
40
|
+
value: b,
|
|
41
|
+
format: l,
|
|
42
|
+
minuteStep: a,
|
|
43
|
+
disabled: p,
|
|
44
|
+
itemHeight: n,
|
|
45
|
+
updateValue: A,
|
|
46
|
+
hourOptions: L,
|
|
47
|
+
minuteOptions: _,
|
|
48
|
+
periodOptions: V
|
|
49
|
+
}, c = {
|
|
50
|
+
"--timepicker-item-height": `${n}px`,
|
|
51
|
+
...I
|
|
52
|
+
};
|
|
53
|
+
return /* @__PURE__ */ S(W.Provider, { value: o, children: /* @__PURE__ */ S(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
ref: M,
|
|
57
|
+
className: `motile-timepicker ${p ? "motile-timepicker--disabled" : ""} ${g ? "motile-timepicker--full-width" : ""} ${D || ""}`,
|
|
58
|
+
style: c,
|
|
59
|
+
"aria-disabled": p,
|
|
60
|
+
role: "group",
|
|
61
|
+
"aria-label": "시간 선택",
|
|
62
|
+
...m,
|
|
63
|
+
children: $
|
|
64
|
+
}
|
|
65
|
+
) });
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
z.displayName = "TimePicker.Root";
|
|
69
|
+
const B = U(({ type: t, className: w, ...v }, l) => {
|
|
70
|
+
const {
|
|
71
|
+
value: a,
|
|
72
|
+
disabled: p,
|
|
73
|
+
itemHeight: n,
|
|
74
|
+
updateValue: g,
|
|
75
|
+
hourOptions: $,
|
|
76
|
+
minuteOptions: D,
|
|
77
|
+
periodOptions: I
|
|
78
|
+
} = q(), m = f(null), M = f(null), P = f(!1), E = f(!1), k = f(0), b = f(null), L = f(!0), _ = f(!1), V = f(0), A = f(0), o = O(() => {
|
|
79
|
+
switch (t) {
|
|
80
|
+
case "hour":
|
|
81
|
+
return $;
|
|
82
|
+
case "minute":
|
|
83
|
+
return D;
|
|
84
|
+
case "period":
|
|
85
|
+
return I;
|
|
86
|
+
default:
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
}, [t, $, D, I]), c = O(() => {
|
|
90
|
+
switch (t) {
|
|
91
|
+
case "hour":
|
|
92
|
+
return a.hour;
|
|
93
|
+
case "minute":
|
|
94
|
+
return a.minute;
|
|
95
|
+
case "period":
|
|
96
|
+
return a.period;
|
|
97
|
+
default:
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}, [t, a]), x = T(
|
|
101
|
+
(e) => t === "period" ? e : e.toString().padStart(2, "0"),
|
|
102
|
+
[t]
|
|
103
|
+
), u = T(
|
|
104
|
+
(e, r = !0) => {
|
|
105
|
+
const i = m.current;
|
|
106
|
+
if (!i || e === void 0) return;
|
|
107
|
+
const d = o.indexOf(e);
|
|
108
|
+
if (d === -1) return;
|
|
109
|
+
const R = d * n;
|
|
110
|
+
i.scrollTo({
|
|
111
|
+
top: R,
|
|
112
|
+
behavior: r ? "smooth" : "auto"
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
[o, n]
|
|
116
|
+
), s = T(() => typeof window < "u" && window.matchMedia("(hover: none) and (pointer: coarse)").matches, []), Y = T(
|
|
117
|
+
(e) => {
|
|
118
|
+
if (s()) return;
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
const r = m.current;
|
|
121
|
+
r && (k.current += e.deltaY, b.current && clearTimeout(b.current), E.current = !0, b.current = setTimeout(() => {
|
|
122
|
+
const i = k.current, d = 20, R = 80;
|
|
123
|
+
let h = 0;
|
|
124
|
+
if (Math.abs(i) >= d && (h = Math.sign(i) * Math.max(1, Math.round(Math.abs(i) / R))), h !== 0) {
|
|
125
|
+
const H = o.indexOf(c), j = Math.max(
|
|
126
|
+
0,
|
|
127
|
+
Math.min(H + h, o.length - 1)
|
|
128
|
+
);
|
|
129
|
+
if (j !== H) {
|
|
130
|
+
const K = o[j], Q = j * n;
|
|
131
|
+
r.scrollTo({ top: Q, behavior: "smooth" }), g(t, K);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
k.current = 0, setTimeout(() => {
|
|
135
|
+
E.current = !1;
|
|
136
|
+
}, 150);
|
|
137
|
+
}, 50));
|
|
138
|
+
},
|
|
139
|
+
[o, n, c, g, t, s]
|
|
140
|
+
), G = T(
|
|
141
|
+
(e) => {
|
|
142
|
+
if (s() || p) return;
|
|
143
|
+
const r = m.current;
|
|
144
|
+
r && (_.current = !0, V.current = e.clientY, A.current = r.scrollTop, r.style.cursor = "grabbing", e.preventDefault());
|
|
145
|
+
},
|
|
146
|
+
[s, p]
|
|
147
|
+
), y = T((e) => {
|
|
148
|
+
if (!_.current) return;
|
|
149
|
+
const r = m.current;
|
|
150
|
+
if (!r) return;
|
|
151
|
+
const i = V.current - e.clientY;
|
|
152
|
+
r.scrollTop = A.current + i;
|
|
153
|
+
}, []), C = T(() => {
|
|
154
|
+
if (!_.current) return;
|
|
155
|
+
_.current = !1;
|
|
156
|
+
const e = m.current;
|
|
157
|
+
if (!e) return;
|
|
158
|
+
e.style.cursor = "grab";
|
|
159
|
+
const r = e.scrollTop, i = Math.round(r / n), d = Math.max(0, Math.min(i, o.length - 1)), R = d * n;
|
|
160
|
+
e.scrollTo({ top: R, behavior: "smooth" });
|
|
161
|
+
const h = o[d];
|
|
162
|
+
h !== void 0 && h !== c && g(t, h);
|
|
163
|
+
}, [o, n, c, g, t]), J = T(() => {
|
|
164
|
+
if (E.current || _.current) return;
|
|
165
|
+
M.current && clearTimeout(M.current);
|
|
166
|
+
const e = s() ? 50 : 100;
|
|
167
|
+
M.current = setTimeout(() => {
|
|
168
|
+
const r = m.current;
|
|
169
|
+
if (!r) return;
|
|
170
|
+
if (P.current) {
|
|
171
|
+
P.current = !1;
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const i = r.scrollTop, d = Math.round(i / n), R = Math.max(0, Math.min(d, o.length - 1)), h = o[R];
|
|
175
|
+
h !== void 0 && h !== c && g(t, h);
|
|
176
|
+
}, e);
|
|
177
|
+
}, [o, n, c, g, t, s]);
|
|
178
|
+
return N(() => {
|
|
179
|
+
if (!L.current) return;
|
|
180
|
+
L.current = !1;
|
|
181
|
+
const e = setTimeout(() => {
|
|
182
|
+
u(c, !1);
|
|
183
|
+
}, 0);
|
|
184
|
+
return () => clearTimeout(e);
|
|
185
|
+
}, [u, c]), N(() => {
|
|
186
|
+
const e = m.current;
|
|
187
|
+
if (!e || c === void 0) return;
|
|
188
|
+
const r = o.indexOf(c);
|
|
189
|
+
if (r === -1) return;
|
|
190
|
+
const i = r * n, d = e.scrollTop;
|
|
191
|
+
Math.abs(d - i) > 1 && (P.current = !0, u(c, !0), setTimeout(() => {
|
|
192
|
+
P.current = !1;
|
|
193
|
+
}, 200));
|
|
194
|
+
}, [c, u, o, n]), N(() => {
|
|
195
|
+
const e = m.current;
|
|
196
|
+
if (e)
|
|
197
|
+
return e.addEventListener("wheel", Y, { passive: !1 }), () => {
|
|
198
|
+
e.removeEventListener("wheel", Y);
|
|
199
|
+
};
|
|
200
|
+
}, [Y]), N(() => (document.addEventListener("mousemove", y), document.addEventListener("mouseup", C), () => {
|
|
201
|
+
document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", C);
|
|
202
|
+
}), [y, C]), N(() => () => {
|
|
203
|
+
M.current !== null && clearTimeout(M.current);
|
|
204
|
+
}, []), /* @__PURE__ */ X(
|
|
205
|
+
"div",
|
|
206
|
+
{
|
|
207
|
+
ref: (e) => {
|
|
208
|
+
typeof l == "function" ? l(e) : l && (l.current = e), m.current = e;
|
|
209
|
+
},
|
|
210
|
+
className: `motile-timepicker__column ${w || ""}`,
|
|
211
|
+
onScroll: J,
|
|
212
|
+
onMouseDown: G,
|
|
213
|
+
role: "listbox",
|
|
214
|
+
"aria-label": `${t} selector`,
|
|
215
|
+
"aria-orientation": "vertical",
|
|
216
|
+
...v,
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ S(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
className: "motile-timepicker__spacer",
|
|
222
|
+
style: { height: n },
|
|
223
|
+
"aria-hidden": "true"
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
o.map((e, r) => {
|
|
227
|
+
const i = e === c;
|
|
228
|
+
return /* @__PURE__ */ S(
|
|
229
|
+
"div",
|
|
230
|
+
{
|
|
231
|
+
className: `motile-timepicker__item ${i ? "motile-timepicker__item--selected" : ""} ${p ? "motile-timepicker__item--disabled" : ""}`,
|
|
232
|
+
style: { height: n },
|
|
233
|
+
role: "option",
|
|
234
|
+
"aria-selected": i,
|
|
235
|
+
"data-value": e,
|
|
236
|
+
children: x(e)
|
|
237
|
+
},
|
|
238
|
+
r
|
|
239
|
+
);
|
|
240
|
+
}),
|
|
241
|
+
/* @__PURE__ */ S(
|
|
242
|
+
"div",
|
|
243
|
+
{
|
|
244
|
+
className: "motile-timepicker__spacer",
|
|
245
|
+
style: { height: n },
|
|
246
|
+
"aria-hidden": "true"
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
});
|
|
253
|
+
B.displayName = "TimePicker.Column";
|
|
254
|
+
const F = U(({ className: t, style: w, ...v }, l) => {
|
|
255
|
+
const { itemHeight: a } = q(), p = {
|
|
256
|
+
height: a,
|
|
257
|
+
...w
|
|
258
|
+
};
|
|
259
|
+
return /* @__PURE__ */ S(
|
|
260
|
+
"div",
|
|
261
|
+
{
|
|
262
|
+
ref: l,
|
|
263
|
+
className: `motile-timepicker__highlight ${t || ""}`,
|
|
264
|
+
style: p,
|
|
265
|
+
"aria-hidden": "true",
|
|
266
|
+
...v
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
});
|
|
270
|
+
F.displayName = "TimePicker.Highlight";
|
|
271
|
+
const ie = {
|
|
272
|
+
Root: z,
|
|
273
|
+
Column: B,
|
|
274
|
+
Highlight: F
|
|
275
|
+
};
|
|
276
|
+
export {
|
|
277
|
+
ie as TimePicker,
|
|
278
|
+
B as TimePickerColumn,
|
|
279
|
+
F as TimePickerHighlight,
|
|
280
|
+
z as TimePickerRoot
|
|
281
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
export type { Toast, ToastOptions, ToastProviderProps, ToastVariant, } from './Toast';
|
|
1
2
|
export { ToastProvider, useToastContext } from './Toast';
|
|
2
|
-
export type { ToastVariant, Toast, ToastOptions, ToastProviderProps, } from './Toast';
|
|
3
|
-
export { useToast } from './useToast';
|
|
4
3
|
export type { UseToastReturn } from './useToast';
|
|
4
|
+
export { useToast } from './useToast';
|
|
@@ -88,4 +88,4 @@ export declare const Tooltip: {
|
|
|
88
88
|
Trigger: typeof TooltipTrigger;
|
|
89
89
|
Content: typeof TooltipContent;
|
|
90
90
|
};
|
|
91
|
-
export type {
|
|
91
|
+
export type { TooltipAlign, TooltipContentProps, TooltipPosition, TooltipRootProps, TooltipTriggerProps, TooltipVariant, };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as tt, jsx as V } from "react/jsx-runtime";
|
|
2
2
|
import et, { useState as A, useEffect as B, useCallback as C, useId as ot, useRef as y, useLayoutEffect as nt, createContext as rt, useContext as st } from "react";
|
|
3
3
|
import { createPortal as it } from "react-dom";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { FloatingArrow as at } from "../../utils/FloatingArrow.js";
|
|
5
|
+
import { Slot as lt } from "../../utils/Slot.js";
|
|
6
6
|
import './Tooltip.css';/* empty css */
|
|
7
7
|
const Z = rt(null);
|
|
8
8
|
function J() {
|
|
@@ -225,7 +225,7 @@ function mt({ children: t, asChild: e = !1 }) {
|
|
|
225
225
|
}, [s, r]);
|
|
226
226
|
if (e)
|
|
227
227
|
return /* @__PURE__ */ V(
|
|
228
|
-
|
|
228
|
+
lt,
|
|
229
229
|
{
|
|
230
230
|
ref: (c) => {
|
|
231
231
|
m.current = c;
|
|
@@ -311,7 +311,7 @@ function bt({ children: t }) {
|
|
|
311
311
|
children: [
|
|
312
312
|
t,
|
|
313
313
|
p && /* @__PURE__ */ V(
|
|
314
|
-
|
|
314
|
+
at,
|
|
315
315
|
{
|
|
316
316
|
className: "motile-tooltip-arrow",
|
|
317
317
|
variant: m,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
+
export type { TooltipAlign, TooltipContentProps, TooltipPosition, TooltipRootProps, TooltipTriggerProps, TooltipVariant, } from './Tooltip';
|
|
1
2
|
export { Tooltip } from './Tooltip';
|
|
2
|
-
export type { TooltipRootProps, TooltipTriggerProps, TooltipContentProps, TooltipVariant, TooltipPosition, TooltipAlign, } from './Tooltip';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { useScrollLock } from './useScrollLock';
|
|
2
|
-
export { useClickOutside } from './useClickOutside';
|
|
3
1
|
export type { UseClickOutsideOptions } from './useClickOutside';
|
|
4
|
-
export {
|
|
2
|
+
export { useClickOutside } from './useClickOutside';
|
|
5
3
|
export type { UseEscapeKeyOptions } from './useEscapeKey';
|
|
4
|
+
export { useEscapeKey } from './useEscapeKey';
|
|
5
|
+
export { useScrollLock } from './useScrollLock';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useClickOutside as r } from "./useClickOutside.js";
|
|
2
|
+
import { useEscapeKey as c } from "./useEscapeKey.js";
|
|
3
|
+
import { useScrollLock as t } from "./useScrollLock.js";
|
|
4
4
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
r as useClickOutside,
|
|
6
|
+
c as useEscapeKey,
|
|
7
|
+
t as useScrollLock
|
|
8
8
|
};
|
|
@@ -28,6 +28,12 @@ export interface UseHistoryCloseProps {
|
|
|
28
28
|
* 모달/Sheet 닫기 핸들러
|
|
29
29
|
*/
|
|
30
30
|
onClose: () => void;
|
|
31
|
+
/**
|
|
32
|
+
* 히스토리 기반 닫기 기능 활성화 여부
|
|
33
|
+
* URL로 Sheet를 제어하는 경우 false로 설정
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
enabled?: boolean;
|
|
31
37
|
}
|
|
32
38
|
export interface UseHistoryCloseReturn {
|
|
33
39
|
/**
|
|
@@ -51,4 +57,4 @@ export interface UseHistoryCloseReturn {
|
|
|
51
57
|
*/
|
|
52
58
|
navigateAndClose: (navigationFn: () => void) => void;
|
|
53
59
|
}
|
|
54
|
-
export declare function useHistoryClose({ onClose, isOpen, }: UseHistoryCloseProps): UseHistoryCloseReturn;
|
|
60
|
+
export declare function useHistoryClose({ onClose, isOpen, enabled, }: UseHistoryCloseProps): UseHistoryCloseReturn;
|
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
function
|
|
1
|
+
import { useRef as i, useState as h, useEffect as c } from "react";
|
|
2
|
+
function m({
|
|
3
3
|
onClose: s,
|
|
4
|
-
isOpen: n
|
|
4
|
+
isOpen: n,
|
|
5
|
+
enabled: r = !0
|
|
5
6
|
}) {
|
|
6
|
-
const
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
}, [s]),
|
|
10
|
-
if (!n) return;
|
|
11
|
-
const
|
|
12
|
-
|
|
7
|
+
const u = i(s), o = i(!1), [a, l] = h(!1), f = i(0), e = i(null);
|
|
8
|
+
return c(() => {
|
|
9
|
+
u.current = s;
|
|
10
|
+
}, [s]), c(() => {
|
|
11
|
+
if (!r || !n) return;
|
|
12
|
+
const t = (d) => {
|
|
13
|
+
l(!0), u.current();
|
|
13
14
|
};
|
|
14
|
-
return
|
|
15
|
-
window.removeEventListener("popstate",
|
|
15
|
+
return o.current || (f.current = window.history.length, window.history.pushState({ modal: !0 }, ""), o.current = !0), window.addEventListener("popstate", t), () => {
|
|
16
|
+
window.removeEventListener("popstate", t);
|
|
16
17
|
};
|
|
17
|
-
}, [n]),
|
|
18
|
-
if (n || !
|
|
19
|
-
let
|
|
18
|
+
}, [n, r]), c(() => {
|
|
19
|
+
if (!r || n || !o.current) return;
|
|
20
|
+
let t = null;
|
|
20
21
|
if (!a) {
|
|
21
|
-
const d =
|
|
22
|
+
const d = f.current + 1;
|
|
22
23
|
if (window.history.length !== d)
|
|
23
|
-
|
|
24
|
-
else if (
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
window.removeEventListener("popstate",
|
|
28
|
-
|
|
24
|
+
e.current = null;
|
|
25
|
+
else if (e.current) {
|
|
26
|
+
const w = e.current;
|
|
27
|
+
e.current = null, t = () => {
|
|
28
|
+
window.removeEventListener("popstate", t), t = null, setTimeout(() => {
|
|
29
|
+
w();
|
|
29
30
|
}, 0);
|
|
30
|
-
}, window.addEventListener("popstate",
|
|
31
|
+
}, window.addEventListener("popstate", t), window.history.back();
|
|
31
32
|
} else
|
|
32
33
|
window.history.back();
|
|
33
34
|
}
|
|
34
|
-
return
|
|
35
|
-
|
|
35
|
+
return o.current = !1, l(!1), () => {
|
|
36
|
+
t && window.removeEventListener("popstate", t);
|
|
36
37
|
};
|
|
37
|
-
}, [n, a]), {
|
|
38
|
+
}, [n, a, r]), {
|
|
38
39
|
isClosingFromHistory: a,
|
|
39
|
-
navigateAndClose: (
|
|
40
|
-
|
|
40
|
+
navigateAndClose: (t) => {
|
|
41
|
+
e.current = t, u.current();
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
export {
|
|
45
|
-
|
|
46
|
+
m as useHistoryClose
|
|
46
47
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type { ButtonProps } from './components/Button';
|
|
3
|
-
export { Input } from './components/Input';
|
|
4
|
-
export type { InputProps } from './components/Input';
|
|
5
|
-
export { Textarea } from './components/Textarea';
|
|
6
|
-
export type { TextareaProps, AutoSizeConfig } from './components/Textarea';
|
|
7
|
-
export { Checkbox } from './components/Checkbox';
|
|
8
|
-
export type { CheckboxProps } from './components/Checkbox';
|
|
9
|
-
export { Switch } from './components/Switch';
|
|
10
|
-
export type { SwitchProps } from './components/Switch';
|
|
1
|
+
export type { AccordionContentProps, AccordionHeaderProps, AccordionProps, } from './components/Accordion';
|
|
11
2
|
export { Accordion } from './components/Accordion';
|
|
12
|
-
export type { AccordionProps, AccordionHeaderProps, AccordionContentProps, } from './components/Accordion';
|
|
13
|
-
export { Skeleton } from './components/Skeleton';
|
|
14
|
-
export type { SkeletonProps } from './components/Skeleton';
|
|
15
|
-
export { Badge } from './components/Badge';
|
|
16
3
|
export type { BadgeProps } from './components/Badge';
|
|
17
|
-
export {
|
|
18
|
-
export type {
|
|
19
|
-
export {
|
|
20
|
-
export type {
|
|
4
|
+
export { Badge } from './components/Badge';
|
|
5
|
+
export type { ButtonProps } from './components/Button';
|
|
6
|
+
export { Button } from './components/Button';
|
|
7
|
+
export type { CheckboxProps } from './components/Checkbox';
|
|
8
|
+
export { Checkbox } from './components/Checkbox';
|
|
9
|
+
export type { DockItemProps, DockPosition, DockRootProps, DockSeparatorProps, } from './components/Dock';
|
|
10
|
+
export { Dock } from './components/Dock';
|
|
11
|
+
export type { CloseOnBackdropOptions, DrawerBodyProps, DrawerCloseProps, DrawerContentProps, DrawerHandleProps, DrawerOverlayProps, DrawerPortalProps, DrawerRootProps, DrawerTitleProps, DrawerTriggerProps, } from './components/Drawer';
|
|
21
12
|
export { Drawer } from './components/Drawer';
|
|
22
|
-
export type {
|
|
23
|
-
export {
|
|
24
|
-
export type {
|
|
13
|
+
export type { InputProps } from './components/Input';
|
|
14
|
+
export { Input } from './components/Input';
|
|
15
|
+
export type { ModalBodyProps, ModalCloseProps, ModalContentProps, ModalFooterProps, ModalHeaderProps, ModalOverlayProps, ModalRootProps, ModalTitleProps, ModalVariant, } from './components/Modal';
|
|
25
16
|
export { Modal } from './components/Modal';
|
|
26
|
-
export type {
|
|
27
|
-
export {
|
|
28
|
-
export type {
|
|
29
|
-
export {
|
|
30
|
-
export type {
|
|
17
|
+
export type { NumberFlowProps } from './components/NumberFlow';
|
|
18
|
+
export { NumberFlow } from './components/NumberFlow';
|
|
19
|
+
export type { PopoverContentProps, PopoverRootProps, PopoverTriggerProps, } from './components/Popover';
|
|
20
|
+
export { Popover } from './components/Popover';
|
|
21
|
+
export type { SheetBodyProps, SheetCloseProps, SheetContentProps, SheetHeaderProps, SheetOverlayProps, SheetPortalProps, SheetPosition, SheetRootProps, SheetTitleProps, SheetTriggerProps, } from './components/Sheet';
|
|
22
|
+
export { Sheet } from './components/Sheet';
|
|
23
|
+
export type { SkeletonProps } from './components/Skeleton';
|
|
24
|
+
export { Skeleton } from './components/Skeleton';
|
|
25
|
+
export type { SpeedDialActionProps, SpeedDialActionsProps, SpeedDialDirection, SpeedDialRootProps, SpeedDialTriggerProps, } from './components/SpeedDial';
|
|
31
26
|
export { SpeedDial } from './components/SpeedDial';
|
|
32
|
-
export type {
|
|
27
|
+
export type { SwitchProps } from './components/Switch';
|
|
28
|
+
export { Switch } from './components/Switch';
|
|
29
|
+
export type { AutoSizeConfig, TextareaProps } from './components/Textarea';
|
|
30
|
+
export { Textarea } from './components/Textarea';
|
|
31
|
+
export type { MinuteStep, TimeFormat, TimePeriod, TimePickerColumnProps, TimePickerHighlightProps, TimePickerRootProps, TimeValue, } from './components/TimePicker';
|
|
32
|
+
export { TimePicker } from './components/TimePicker';
|
|
33
|
+
export type { Toast, ToastOptions, ToastProviderProps, ToastVariant, UseToastReturn, } from './components/Toast';
|
|
34
|
+
export { ToastProvider, useToast } from './components/Toast';
|
|
35
|
+
export type { TooltipAlign, TooltipContentProps, TooltipPosition, TooltipRootProps, TooltipTriggerProps, TooltipVariant, } from './components/Tooltip';
|
|
36
|
+
export { Tooltip } from './components/Tooltip';
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Accordion as e } from "./components/Accordion/Accordion.js";
|
|
2
|
+
import { Badge as p } from "./components/Badge/Badge.js";
|
|
3
|
+
import { Button as x } from "./components/Button/Button.js";
|
|
4
4
|
import { Checkbox as a } from "./components/Checkbox/Checkbox.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Popover as
|
|
11
|
-
import { Drawer as w } from "./components/Drawer/Drawer.js";
|
|
5
|
+
import { Dock as c } from "./components/Dock/Dock.js";
|
|
6
|
+
import { Drawer as l } from "./components/Drawer/Drawer.js";
|
|
7
|
+
import { Input as k } from "./components/Input/Input.js";
|
|
8
|
+
import { Modal as u } from "./components/Modal/Modal.js";
|
|
9
|
+
import { NumberFlow as h } from "./components/NumberFlow/NumberFlow.js";
|
|
10
|
+
import { Popover as w } from "./components/Popover/Popover.js";
|
|
12
11
|
import { Sheet as P } from "./components/Sheet/Sheet.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
12
|
+
import { Skeleton as v } from "./components/Skeleton/Skeleton.js";
|
|
13
|
+
import { SpeedDial as g } from "./components/SpeedDial/SpeedDial.js";
|
|
14
|
+
import { Switch as C } from "./components/Switch/Switch.js";
|
|
15
|
+
import { Textarea as I } from "./components/Textarea/Textarea.js";
|
|
16
|
+
import { TimePicker as N } from "./components/TimePicker/TimePicker.js";
|
|
17
|
+
import { ToastProvider as q } from "./components/Toast/Toast.js";
|
|
18
|
+
import { useToast as z } from "./components/Toast/useToast.js";
|
|
19
|
+
import { Tooltip as G } from "./components/Tooltip/Tooltip.js";
|
|
18
20
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
e as Accordion,
|
|
22
|
+
p as Badge,
|
|
23
|
+
x as Button,
|
|
22
24
|
a as Checkbox,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
c as Dock,
|
|
26
|
+
l as Drawer,
|
|
27
|
+
k as Input,
|
|
28
|
+
u as Modal,
|
|
29
|
+
h as NumberFlow,
|
|
30
|
+
w as Popover,
|
|
28
31
|
P as Sheet,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
v as Skeleton,
|
|
33
|
+
g as SpeedDial,
|
|
34
|
+
C as Switch,
|
|
35
|
+
I as Textarea,
|
|
36
|
+
N as TimePicker,
|
|
37
|
+
q as ToastProvider,
|
|
38
|
+
G as Tooltip,
|
|
39
|
+
z as useToast
|
|
36
40
|
};
|
package/dist/test/utils.d.ts
CHANGED
package/dist/utils/Slot.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
const r =
|
|
1
|
+
import c from "react";
|
|
2
|
+
const r = c.forwardRef(
|
|
3
3
|
({ children: e, ...a }, t) => {
|
|
4
|
-
if (!
|
|
4
|
+
if (!c.isValidElement(e))
|
|
5
5
|
return null;
|
|
6
6
|
const n = o(e);
|
|
7
|
-
return
|
|
7
|
+
return c.cloneElement(e, {
|
|
8
8
|
...l(a, e.props),
|
|
9
9
|
ref: t ? m(t, n) : n
|
|
10
10
|
});
|
|
@@ -13,7 +13,7 @@ const r = i.forwardRef(
|
|
|
13
13
|
r.displayName = "Slot";
|
|
14
14
|
function o(e) {
|
|
15
15
|
var n;
|
|
16
|
-
|
|
16
|
+
const a = (n = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : n.get;
|
|
17
17
|
return a && "isReactWarning" in a && a.isReactWarning ? e.ref : e.props.ref || e.ref;
|
|
18
18
|
}
|
|
19
19
|
function l(e, a) {
|
|
@@ -24,8 +24,8 @@ function l(e, a) {
|
|
|
24
24
|
});
|
|
25
25
|
for (const n in a) {
|
|
26
26
|
const f = e[n], s = a[n];
|
|
27
|
-
/^on[A-Z]/.test(n) ? typeof f == "function" && typeof s == "function" ? t[n] = (...
|
|
28
|
-
s(...
|
|
27
|
+
/^on[A-Z]/.test(n) ? typeof f == "function" && typeof s == "function" ? t[n] = (...i) => {
|
|
28
|
+
s(...i), f(...i);
|
|
29
29
|
} : typeof f == "function" && (t[n] = f) : n !== "className" && n !== "style" && (t[n] = f ?? s);
|
|
30
30
|
}
|
|
31
31
|
for (const n in e)
|