seam-react 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/Dialog.d.ts +62 -5
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +531 -402
- package/dist/index.js.map +1 -1
- package/dist/motion.d.ts +7 -0
- package/dist/styles.cjs +106 -201
- package/dist/styles.cjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.js +106 -201
- package/dist/styles.js.map +1 -1
- package/package.json +7 -4
- package/dist/Toast.d.ts +0 -43
package/dist/index.js
CHANGED
|
@@ -1,501 +1,630 @@
|
|
|
1
|
-
import { jsxs as N, jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsxs as N, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as y, useId as L, useRef as M, useEffect as R, useMemo as F, createContext as j, useContext as B, isValidElement as se, cloneElement as K, useSyncExternalStore as ce, useState as $, useLayoutEffect as le } from "react";
|
|
3
|
+
import { useReducedMotion as S, useMotionValue as ue, animate as V, motion as A, MotionConfig as de, AnimatePresence as fe, useIsPresent as pe } from "motion/react";
|
|
4
|
+
import { createPortal as ge } from "react-dom";
|
|
5
|
+
import { useControllableState as H, useEventCallback as be, useLockBodyScroll as he, useFocusTrap as me } from "seam-hooks";
|
|
6
|
+
function h(...o) {
|
|
7
|
+
return o.filter(Boolean).join(" ");
|
|
7
8
|
}
|
|
8
|
-
const
|
|
9
|
-
variant:
|
|
10
|
-
size:
|
|
9
|
+
const Y = y(function({
|
|
10
|
+
variant: e = "primary",
|
|
11
|
+
size: n = "md",
|
|
11
12
|
loading: r = !1,
|
|
12
|
-
iconOnly:
|
|
13
|
-
type:
|
|
14
|
-
className:
|
|
15
|
-
children:
|
|
16
|
-
...
|
|
13
|
+
iconOnly: a = !1,
|
|
14
|
+
type: s = "button",
|
|
15
|
+
className: i,
|
|
16
|
+
children: d,
|
|
17
|
+
...u
|
|
17
18
|
}, c) {
|
|
18
19
|
return /* @__PURE__ */ N(
|
|
19
20
|
"button",
|
|
20
21
|
{
|
|
21
|
-
...
|
|
22
|
+
...u,
|
|
22
23
|
ref: c,
|
|
23
|
-
type:
|
|
24
|
-
className:
|
|
25
|
-
"data-variant":
|
|
26
|
-
"data-size":
|
|
24
|
+
type: s,
|
|
25
|
+
className: h("uk-button", i),
|
|
26
|
+
"data-variant": e,
|
|
27
|
+
"data-size": n,
|
|
27
28
|
"data-loading": r ? "true" : void 0,
|
|
28
|
-
"data-icon-only":
|
|
29
|
-
disabled:
|
|
29
|
+
"data-icon-only": a ? "true" : void 0,
|
|
30
|
+
disabled: u.disabled || r,
|
|
30
31
|
"aria-busy": r || void 0,
|
|
31
32
|
children: [
|
|
32
|
-
r ? /* @__PURE__ */
|
|
33
|
-
|
|
33
|
+
r ? /* @__PURE__ */ l("span", { className: "uk-button__spinner", "aria-hidden": "true" }) : null,
|
|
34
|
+
d
|
|
34
35
|
]
|
|
35
36
|
}
|
|
36
37
|
);
|
|
37
|
-
}),
|
|
38
|
-
inputSize:
|
|
39
|
-
invalid:
|
|
38
|
+
}), Ae = y(function({
|
|
39
|
+
inputSize: e = "md",
|
|
40
|
+
invalid: n = !1,
|
|
40
41
|
className: r,
|
|
41
|
-
"aria-invalid":
|
|
42
|
-
...
|
|
43
|
-
},
|
|
44
|
-
return /* @__PURE__ */
|
|
42
|
+
"aria-invalid": a,
|
|
43
|
+
...s
|
|
44
|
+
}, i) {
|
|
45
|
+
return /* @__PURE__ */ l(
|
|
45
46
|
"input",
|
|
46
47
|
{
|
|
47
|
-
...
|
|
48
|
-
ref:
|
|
49
|
-
className:
|
|
50
|
-
"data-size":
|
|
51
|
-
"aria-invalid":
|
|
48
|
+
...s,
|
|
49
|
+
ref: i,
|
|
50
|
+
className: h("uk-input", r),
|
|
51
|
+
"data-size": e,
|
|
52
|
+
"aria-invalid": n ? !0 : a
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
|
-
}),
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
}), Ie = [0.23, 1, 0.32, 1], U = {
|
|
56
|
+
type: "spring",
|
|
57
|
+
bounce: 0,
|
|
58
|
+
duration: 0.3
|
|
59
|
+
}, X = {
|
|
60
|
+
type: "spring",
|
|
61
|
+
bounce: 0.04,
|
|
62
|
+
duration: 0.38
|
|
63
|
+
}, ye = {
|
|
64
|
+
type: "spring",
|
|
65
|
+
bounce: 0.08,
|
|
66
|
+
duration: 0.34
|
|
67
|
+
}, z = {
|
|
68
|
+
duration: 0.12,
|
|
69
|
+
ease: Ie
|
|
70
|
+
}, He = y(function({
|
|
71
|
+
checked: e,
|
|
72
|
+
defaultChecked: n,
|
|
57
73
|
onCheckedChange: r,
|
|
58
|
-
disabled:
|
|
59
|
-
className:
|
|
60
|
-
children:
|
|
61
|
-
id:
|
|
62
|
-
...
|
|
74
|
+
disabled: a,
|
|
75
|
+
className: s,
|
|
76
|
+
children: i,
|
|
77
|
+
id: d,
|
|
78
|
+
...u
|
|
63
79
|
}, c) {
|
|
64
|
-
const
|
|
65
|
-
value:
|
|
66
|
-
defaultValue:
|
|
80
|
+
const p = L(), g = d ?? p, k = S() ?? !1, b = M(!1), m = M(null), [C, _] = H({
|
|
81
|
+
value: e,
|
|
82
|
+
defaultValue: n ?? !1,
|
|
67
83
|
onChange: r
|
|
68
|
-
});
|
|
84
|
+
}), D = ue(C ? 16 : 0);
|
|
85
|
+
R(() => {
|
|
86
|
+
if (m.current)
|
|
87
|
+
return;
|
|
88
|
+
const t = V(
|
|
89
|
+
D,
|
|
90
|
+
C ? 16 : 0,
|
|
91
|
+
k ? { duration: 0 } : U
|
|
92
|
+
);
|
|
93
|
+
return () => t.stop();
|
|
94
|
+
}, [C, k, D]);
|
|
95
|
+
const v = (t) => {
|
|
96
|
+
const f = m.current;
|
|
97
|
+
if (!(!f || f.pointerId !== t.pointerId)) {
|
|
98
|
+
if (f.moved) {
|
|
99
|
+
const T = f.samples[0], x = f.samples[f.samples.length - 1], E = T && x ? Math.max(x.time - T.time, 1) : 1, w = T && x ? (x.x - T.x) / E * 1e3 : 0, I = Math.abs(w) > 220 ? w > 0 : D.get() >= 8;
|
|
100
|
+
b.current = !0, m.current = null, _(I), V(
|
|
101
|
+
D,
|
|
102
|
+
I ? 16 : 0,
|
|
103
|
+
k ? { duration: 0 } : { ...U, velocity: w }
|
|
104
|
+
), window.setTimeout(() => {
|
|
105
|
+
b.current = !1;
|
|
106
|
+
}, 0);
|
|
107
|
+
} else
|
|
108
|
+
m.current = null;
|
|
109
|
+
t.currentTarget.hasPointerCapture(t.pointerId) && typeof t.currentTarget.releasePointerCapture == "function" && t.currentTarget.releasePointerCapture(t.pointerId);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
69
112
|
return /* @__PURE__ */ N(
|
|
70
113
|
"label",
|
|
71
114
|
{
|
|
72
|
-
className:
|
|
73
|
-
"data-disabled":
|
|
115
|
+
className: h("uk-switch", s),
|
|
116
|
+
"data-disabled": a ? "true" : void 0,
|
|
74
117
|
htmlFor: g,
|
|
118
|
+
onClickCapture: (t) => {
|
|
119
|
+
b.current && (t.preventDefault(), t.stopPropagation());
|
|
120
|
+
},
|
|
75
121
|
children: [
|
|
76
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ l(
|
|
77
123
|
"input",
|
|
78
124
|
{
|
|
79
|
-
...
|
|
125
|
+
...u,
|
|
80
126
|
ref: c,
|
|
81
127
|
id: g,
|
|
82
128
|
type: "checkbox",
|
|
83
129
|
role: "switch",
|
|
84
130
|
className: "uk-switch__input",
|
|
85
|
-
checked:
|
|
86
|
-
disabled:
|
|
87
|
-
"aria-checked":
|
|
88
|
-
onChange: (
|
|
131
|
+
checked: C,
|
|
132
|
+
disabled: a,
|
|
133
|
+
"aria-checked": C,
|
|
134
|
+
onChange: (t) => _(t.target.checked)
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ l(
|
|
138
|
+
"span",
|
|
139
|
+
{
|
|
140
|
+
className: "uk-switch__track",
|
|
141
|
+
"aria-hidden": "true",
|
|
142
|
+
onPointerDown: (t) => {
|
|
143
|
+
a || (m.current = {
|
|
144
|
+
pointerId: t.pointerId,
|
|
145
|
+
startX: t.clientX,
|
|
146
|
+
startValue: D.get(),
|
|
147
|
+
moved: !1,
|
|
148
|
+
samples: [{ x: t.clientX, time: performance.now() }]
|
|
149
|
+
}, typeof t.currentTarget.setPointerCapture == "function" && t.currentTarget.setPointerCapture(t.pointerId));
|
|
150
|
+
},
|
|
151
|
+
onPointerMove: (t) => {
|
|
152
|
+
const f = m.current;
|
|
153
|
+
if (!f || f.pointerId !== t.pointerId)
|
|
154
|
+
return;
|
|
155
|
+
const T = t.clientX - f.startX;
|
|
156
|
+
Math.abs(T) > 4 && (f.moved = !0), f.moved && (t.preventDefault(), D.set(Math.max(0, Math.min(16, f.startValue + T))), f.samples.push({ x: t.clientX, time: performance.now() }), f.samples = f.samples.filter(
|
|
157
|
+
(x) => performance.now() - x.time < 120
|
|
158
|
+
));
|
|
159
|
+
},
|
|
160
|
+
onPointerUp: v,
|
|
161
|
+
onPointerCancel: v,
|
|
162
|
+
children: /* @__PURE__ */ l(A.span, { className: "uk-switch__thumb", style: { x: D } })
|
|
89
163
|
}
|
|
90
164
|
),
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
s ? /* @__PURE__ */ a("span", { className: "uk-switch__label", children: s }) : null
|
|
165
|
+
i ? /* @__PURE__ */ l("span", { className: "uk-switch__label", children: i }) : null
|
|
93
166
|
]
|
|
94
167
|
}
|
|
95
168
|
);
|
|
96
|
-
}),
|
|
97
|
-
function
|
|
98
|
-
const
|
|
99
|
-
if (!
|
|
100
|
-
throw new Error(`<${
|
|
101
|
-
return
|
|
169
|
+
}), G = j(null);
|
|
170
|
+
function O(o) {
|
|
171
|
+
const e = B(G);
|
|
172
|
+
if (!e)
|
|
173
|
+
throw new Error(`<${o}> must be rendered inside <Tabs>`);
|
|
174
|
+
return e;
|
|
102
175
|
}
|
|
103
|
-
function W(
|
|
104
|
-
return `${
|
|
176
|
+
function W(o, e) {
|
|
177
|
+
return `${o}-tab-${encodeURIComponent(e)}`;
|
|
105
178
|
}
|
|
106
|
-
function
|
|
107
|
-
return `${
|
|
179
|
+
function J(o, e) {
|
|
180
|
+
return `${o}-panel-${encodeURIComponent(e)}`;
|
|
108
181
|
}
|
|
109
|
-
function
|
|
110
|
-
value:
|
|
111
|
-
defaultValue:
|
|
112
|
-
onValueChange:
|
|
182
|
+
function ke({
|
|
183
|
+
value: o,
|
|
184
|
+
defaultValue: e,
|
|
185
|
+
onValueChange: n,
|
|
113
186
|
orientation: r = "horizontal",
|
|
114
|
-
className:
|
|
115
|
-
children:
|
|
187
|
+
className: a,
|
|
188
|
+
children: s
|
|
116
189
|
}) {
|
|
117
|
-
const
|
|
118
|
-
value:
|
|
119
|
-
defaultValue:
|
|
120
|
-
onChange:
|
|
121
|
-
}), c =
|
|
122
|
-
() => ({
|
|
123
|
-
|
|
190
|
+
const i = L(), [d, u] = H({
|
|
191
|
+
value: o,
|
|
192
|
+
defaultValue: e ?? "",
|
|
193
|
+
onChange: n
|
|
194
|
+
}), c = F(
|
|
195
|
+
() => ({
|
|
196
|
+
baseId: i,
|
|
197
|
+
value: d,
|
|
198
|
+
setValue: u,
|
|
199
|
+
orientation: r,
|
|
200
|
+
indicatorId: `${i}-indicator`
|
|
201
|
+
}),
|
|
202
|
+
[i, d, r, u]
|
|
124
203
|
);
|
|
125
|
-
return /* @__PURE__ */
|
|
204
|
+
return /* @__PURE__ */ l(G.Provider, { value: c, children: /* @__PURE__ */ l("div", { className: h("uk-tabs", a), "data-orientation": r, children: s }) });
|
|
126
205
|
}
|
|
127
|
-
const
|
|
128
|
-
const { orientation:
|
|
129
|
-
return /* @__PURE__ */
|
|
206
|
+
const Ce = y(function({ className: e, onKeyDown: n, ...r }, a) {
|
|
207
|
+
const { orientation: s } = O("Tabs.List");
|
|
208
|
+
return /* @__PURE__ */ l(
|
|
130
209
|
"div",
|
|
131
210
|
{
|
|
132
211
|
...r,
|
|
133
|
-
ref:
|
|
212
|
+
ref: a,
|
|
134
213
|
role: "tablist",
|
|
135
|
-
"aria-orientation":
|
|
214
|
+
"aria-orientation": s,
|
|
136
215
|
tabIndex: -1,
|
|
137
|
-
className:
|
|
138
|
-
onKeyDown: (
|
|
139
|
-
if (
|
|
216
|
+
className: h("uk-tabs__list", e),
|
|
217
|
+
onKeyDown: (i) => {
|
|
218
|
+
if (n?.(i), i.defaultPrevented)
|
|
140
219
|
return;
|
|
141
|
-
const
|
|
142
|
-
if (!
|
|
220
|
+
const u = i.target?.closest('[role="tab"]');
|
|
221
|
+
if (!u || u.hasAttribute("disabled"))
|
|
143
222
|
return;
|
|
144
223
|
const c = Array.from(
|
|
145
|
-
|
|
224
|
+
i.currentTarget.querySelectorAll(
|
|
146
225
|
'[role="tab"]:not([disabled])'
|
|
147
226
|
)
|
|
148
|
-
),
|
|
149
|
-
if (
|
|
227
|
+
), p = c.indexOf(u);
|
|
228
|
+
if (p === -1)
|
|
150
229
|
return;
|
|
151
|
-
const g =
|
|
152
|
-
let
|
|
153
|
-
switch (
|
|
230
|
+
const g = s === "horizontal" ? "ArrowRight" : "ArrowDown", k = s === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
231
|
+
let b = -1;
|
|
232
|
+
switch (i.key) {
|
|
154
233
|
case g:
|
|
155
|
-
|
|
234
|
+
b = (p + 1) % c.length;
|
|
156
235
|
break;
|
|
157
|
-
case
|
|
158
|
-
|
|
236
|
+
case k:
|
|
237
|
+
b = (p - 1 + c.length) % c.length;
|
|
159
238
|
break;
|
|
160
239
|
case "Home":
|
|
161
|
-
|
|
240
|
+
b = 0;
|
|
162
241
|
break;
|
|
163
242
|
case "End":
|
|
164
|
-
|
|
243
|
+
b = c.length - 1;
|
|
165
244
|
break;
|
|
166
245
|
default:
|
|
167
246
|
return;
|
|
168
247
|
}
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
248
|
+
i.preventDefault();
|
|
249
|
+
const m = c[b];
|
|
250
|
+
m && (m.focus(), m.click());
|
|
172
251
|
}
|
|
173
252
|
}
|
|
174
253
|
);
|
|
175
|
-
}),
|
|
176
|
-
const
|
|
177
|
-
return /* @__PURE__ */
|
|
254
|
+
}), De = y(function({ value: e, type: n = "button", className: r, onClick: a, children: s, ...i }, d) {
|
|
255
|
+
const u = O("Tabs.Trigger"), c = u.value === e, p = S() ?? !1;
|
|
256
|
+
return /* @__PURE__ */ N(
|
|
178
257
|
"button",
|
|
179
258
|
{
|
|
180
|
-
...
|
|
181
|
-
ref:
|
|
182
|
-
type:
|
|
259
|
+
...i,
|
|
260
|
+
ref: d,
|
|
261
|
+
type: n,
|
|
183
262
|
role: "tab",
|
|
184
|
-
id: W(
|
|
185
|
-
"aria-selected":
|
|
186
|
-
"aria-controls":
|
|
187
|
-
tabIndex:
|
|
188
|
-
"data-state":
|
|
189
|
-
className:
|
|
190
|
-
onClick: (
|
|
191
|
-
|
|
192
|
-
}
|
|
263
|
+
id: W(u.baseId, e),
|
|
264
|
+
"aria-selected": c,
|
|
265
|
+
"aria-controls": J(u.baseId, e),
|
|
266
|
+
tabIndex: c ? 0 : -1,
|
|
267
|
+
"data-state": c ? "active" : "inactive",
|
|
268
|
+
className: h("uk-tabs__trigger", r),
|
|
269
|
+
onClick: (g) => {
|
|
270
|
+
a?.(g), g.defaultPrevented || u.setValue(e);
|
|
271
|
+
},
|
|
272
|
+
children: [
|
|
273
|
+
s,
|
|
274
|
+
c ? /* @__PURE__ */ l(
|
|
275
|
+
A.span,
|
|
276
|
+
{
|
|
277
|
+
className: "uk-tabs__indicator",
|
|
278
|
+
layoutId: u.indicatorId,
|
|
279
|
+
"aria-hidden": "true",
|
|
280
|
+
transition: p ? { duration: 0 } : ye
|
|
281
|
+
}
|
|
282
|
+
) : null
|
|
283
|
+
]
|
|
193
284
|
}
|
|
194
285
|
);
|
|
195
|
-
}),
|
|
196
|
-
const
|
|
197
|
-
return /* @__PURE__ */
|
|
286
|
+
}), Te = y(function({ value: e, className: n, ...r }, a) {
|
|
287
|
+
const s = O("Tabs.Content"), i = s.value === e;
|
|
288
|
+
return /* @__PURE__ */ l(
|
|
198
289
|
"div",
|
|
199
290
|
{
|
|
200
291
|
...r,
|
|
201
|
-
ref:
|
|
292
|
+
ref: a,
|
|
202
293
|
role: "tabpanel",
|
|
203
|
-
id:
|
|
204
|
-
"aria-labelledby": W(
|
|
205
|
-
hidden: !
|
|
294
|
+
id: J(s.baseId, e),
|
|
295
|
+
"aria-labelledby": W(s.baseId, e),
|
|
296
|
+
hidden: !i,
|
|
206
297
|
tabIndex: 0,
|
|
207
|
-
"data-state":
|
|
208
|
-
className:
|
|
298
|
+
"data-state": i ? "active" : "inactive",
|
|
299
|
+
className: h("uk-tabs__panel", n)
|
|
209
300
|
}
|
|
210
301
|
);
|
|
211
|
-
}),
|
|
212
|
-
List:
|
|
213
|
-
Trigger:
|
|
214
|
-
Content:
|
|
215
|
-
}),
|
|
216
|
-
},
|
|
217
|
-
function
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
302
|
+
}), Oe = Object.assign(ke, {
|
|
303
|
+
List: Ce,
|
|
304
|
+
Trigger: De,
|
|
305
|
+
Content: Te
|
|
306
|
+
}), Q = j(null), xe = () => () => {
|
|
307
|
+
}, _e = () => !0, ve = () => !1;
|
|
308
|
+
function P(o) {
|
|
309
|
+
const e = B(Q);
|
|
310
|
+
if (!e)
|
|
311
|
+
throw new Error(`<${o}> must be rendered inside <Dialog.Root>`);
|
|
312
|
+
return e;
|
|
313
|
+
}
|
|
314
|
+
function Z(o, e) {
|
|
315
|
+
return (n) => {
|
|
316
|
+
o?.(n), n.defaultPrevented || e(n);
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function q({
|
|
320
|
+
children: o,
|
|
321
|
+
open: e,
|
|
322
|
+
defaultOpen: n,
|
|
323
|
+
onOpenChange: r
|
|
232
324
|
}) {
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
),
|
|
238
|
-
|
|
325
|
+
const a = L(), [s, i] = $(!1), [d, u] = $(!1), [c, p] = H({
|
|
326
|
+
value: e,
|
|
327
|
+
defaultValue: n ?? !1,
|
|
328
|
+
onChange: r
|
|
329
|
+
}), g = F(
|
|
330
|
+
() => ({
|
|
331
|
+
open: c,
|
|
332
|
+
setOpen: p,
|
|
333
|
+
triggerId: `${a}-trigger`,
|
|
334
|
+
contentId: `${a}-content`,
|
|
335
|
+
titleId: `${a}-title`,
|
|
336
|
+
descriptionId: `${a}-description`,
|
|
337
|
+
hasTitle: s,
|
|
338
|
+
setHasTitle: i,
|
|
339
|
+
hasDescription: d,
|
|
340
|
+
setHasDescription: u
|
|
341
|
+
}),
|
|
342
|
+
[a, c, d, s, p]
|
|
343
|
+
);
|
|
344
|
+
return /* @__PURE__ */ l(Q.Provider, { value: g, children: o });
|
|
345
|
+
}
|
|
346
|
+
function we({ children: o }) {
|
|
347
|
+
const e = P("Dialog.Trigger"), n = o, r = n.props.onClick;
|
|
348
|
+
return K(n, {
|
|
349
|
+
id: e.triggerId,
|
|
350
|
+
"aria-haspopup": "dialog",
|
|
351
|
+
"aria-expanded": e.open,
|
|
352
|
+
"aria-controls": e.open ? e.contentId : void 0,
|
|
353
|
+
onClick: Z(r, () => {
|
|
354
|
+
e.setOpen(!e.open);
|
|
355
|
+
})
|
|
239
356
|
});
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
357
|
+
}
|
|
358
|
+
function ee({
|
|
359
|
+
children: o,
|
|
360
|
+
label: e = "Close"
|
|
361
|
+
}) {
|
|
362
|
+
const n = P("Dialog.Close");
|
|
363
|
+
if (se(o)) {
|
|
364
|
+
const r = o, a = r.props.onClick;
|
|
365
|
+
return K(r, {
|
|
366
|
+
onClick: Z(a, () => {
|
|
367
|
+
n.setOpen(!1);
|
|
368
|
+
})
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
return /* @__PURE__ */ l(Y, { variant: "ghost", onClick: () => n.setOpen(!1), children: e });
|
|
372
|
+
}
|
|
373
|
+
const te = y(function({ className: e, ...n }, r) {
|
|
374
|
+
return /* @__PURE__ */ l(
|
|
375
|
+
"header",
|
|
376
|
+
{
|
|
377
|
+
...n,
|
|
378
|
+
ref: r,
|
|
379
|
+
className: h("uk-dialog__header", e)
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
}), ne = y(function({ className: e, children: n, ...r }, a) {
|
|
383
|
+
const s = P("Dialog.Title"), i = s.setHasTitle;
|
|
384
|
+
return R(() => (i(!0), () => i(!1)), [i]), /* @__PURE__ */ l(
|
|
385
|
+
"h2",
|
|
386
|
+
{
|
|
387
|
+
...r,
|
|
388
|
+
ref: a,
|
|
389
|
+
id: s.titleId,
|
|
390
|
+
className: h("uk-dialog__title", e),
|
|
391
|
+
children: n
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
}), re = y(
|
|
395
|
+
function({ className: e, ...n }, r) {
|
|
396
|
+
const a = P("Dialog.Description"), s = a.setHasDescription;
|
|
397
|
+
return R(() => (s(!0), () => s(!1)), [s]), /* @__PURE__ */ l(
|
|
398
|
+
"p",
|
|
399
|
+
{
|
|
400
|
+
...n,
|
|
401
|
+
ref: r,
|
|
402
|
+
id: a.descriptionId,
|
|
403
|
+
className: h("uk-dialog__description", e)
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
), oe = y(function({ className: e, ...n }, r) {
|
|
408
|
+
return /* @__PURE__ */ l("div", { ...n, ref: r, className: h("uk-dialog__body", e) });
|
|
409
|
+
}), ae = y(function({ className: e, ...n }, r) {
|
|
410
|
+
return /* @__PURE__ */ l(
|
|
411
|
+
"footer",
|
|
412
|
+
{
|
|
413
|
+
...n,
|
|
414
|
+
ref: r,
|
|
415
|
+
className: h("uk-dialog__footer", e)
|
|
416
|
+
}
|
|
417
|
+
);
|
|
418
|
+
});
|
|
419
|
+
function Ne({
|
|
420
|
+
requestClose: o,
|
|
421
|
+
contentId: e,
|
|
422
|
+
titleId: n,
|
|
423
|
+
descriptionId: r,
|
|
424
|
+
hasTitle: a,
|
|
425
|
+
hasDescription: s,
|
|
426
|
+
children: i,
|
|
427
|
+
closeOnBackdropClick: d = !0,
|
|
428
|
+
closeOnEscape: u = !0,
|
|
429
|
+
initialFocusRef: c,
|
|
430
|
+
returnFocusRef: p,
|
|
431
|
+
className: g,
|
|
432
|
+
"aria-label": k,
|
|
433
|
+
"aria-labelledby": b,
|
|
434
|
+
"aria-describedby": m
|
|
435
|
+
}) {
|
|
436
|
+
const C = M(null), _ = M(null), D = pe(), v = S() ?? !1;
|
|
437
|
+
return he(!0), le(() => {
|
|
438
|
+
const t = C.current;
|
|
439
|
+
t && (_.current ?? (_.current = document.activeElement instanceof HTMLElement ? document.activeElement : null), !t.open && (typeof t.showModal == "function" ? t.showModal() : t.setAttribute("open", "")));
|
|
440
|
+
}, []), me({
|
|
441
|
+
active: !0,
|
|
442
|
+
containerRef: C,
|
|
443
|
+
initialFocusRef: c,
|
|
444
|
+
returnFocusRef: p ?? _
|
|
445
|
+
}), R(() => {
|
|
446
|
+
const t = C.current;
|
|
447
|
+
if (!t)
|
|
253
448
|
return;
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
},
|
|
257
|
-
|
|
449
|
+
const f = () => {
|
|
450
|
+
t.open || (typeof t.showModal == "function" ? t.showModal() : t.setAttribute("open", ""));
|
|
451
|
+
}, T = () => {
|
|
452
|
+
if (!u) {
|
|
453
|
+
f();
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
o();
|
|
457
|
+
}, x = (I) => {
|
|
458
|
+
I.preventDefault(), u && o();
|
|
459
|
+
}, E = (I) => {
|
|
460
|
+
u || I.key !== "Escape" || I.defaultPrevented || (I.preventDefault(), I.stopPropagation());
|
|
461
|
+
}, w = (I) => {
|
|
462
|
+
d && I.target === t && o();
|
|
258
463
|
};
|
|
259
|
-
return
|
|
260
|
-
|
|
464
|
+
return t.addEventListener("close", T), t.addEventListener("cancel", x), t.addEventListener("keydown", E, !0), t.addEventListener("click", w), () => {
|
|
465
|
+
t.removeEventListener("close", T), t.removeEventListener("cancel", x), t.removeEventListener("keydown", E, !0), t.removeEventListener("click", w);
|
|
261
466
|
};
|
|
262
|
-
}, [
|
|
263
|
-
|
|
264
|
-
|
|
467
|
+
}, [d, u, o]), /* @__PURE__ */ l(
|
|
468
|
+
"dialog",
|
|
469
|
+
{
|
|
470
|
+
ref: C,
|
|
471
|
+
id: e,
|
|
472
|
+
className: h("uk-dialog", g),
|
|
473
|
+
closedby: u || d ? "any" : "none",
|
|
474
|
+
"data-state": D ? "open" : "closed",
|
|
475
|
+
inert: !D,
|
|
476
|
+
"aria-label": k,
|
|
477
|
+
"aria-labelledby": b ?? (k ? void 0 : a ? n : void 0),
|
|
478
|
+
"aria-describedby": m ?? (s ? r : void 0),
|
|
479
|
+
children: /* @__PURE__ */ l(
|
|
480
|
+
A.div,
|
|
481
|
+
{
|
|
482
|
+
className: "uk-dialog__panel",
|
|
483
|
+
initial: v ? { opacity: 0 } : {
|
|
484
|
+
opacity: 0,
|
|
485
|
+
transform: "translateY(12px) scale(0.96)"
|
|
486
|
+
},
|
|
487
|
+
animate: {
|
|
488
|
+
opacity: 1,
|
|
489
|
+
transform: "translateY(0px) scale(1)",
|
|
490
|
+
transition: v ? z : { ...X, delay: 0.06 }
|
|
491
|
+
},
|
|
492
|
+
exit: v ? { opacity: 0, transition: z } : {
|
|
493
|
+
opacity: 0,
|
|
494
|
+
transform: "translateY(8px) scale(0.97)",
|
|
495
|
+
transition: X
|
|
496
|
+
},
|
|
497
|
+
children: i
|
|
498
|
+
}
|
|
499
|
+
)
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
function ie({
|
|
504
|
+
children: o,
|
|
505
|
+
closeOnBackdropClick: e = !0,
|
|
506
|
+
closeOnEscape: n = !0,
|
|
507
|
+
initialFocusRef: r,
|
|
508
|
+
returnFocusRef: a,
|
|
509
|
+
className: s,
|
|
510
|
+
"aria-label": i,
|
|
511
|
+
"aria-labelledby": d,
|
|
512
|
+
"aria-describedby": u
|
|
513
|
+
}) {
|
|
514
|
+
const c = P("Dialog.Content"), p = be(() => {
|
|
515
|
+
c.setOpen(!1);
|
|
516
|
+
});
|
|
517
|
+
return ce(
|
|
518
|
+
xe,
|
|
519
|
+
_e,
|
|
520
|
+
ve
|
|
521
|
+
) ? ge(
|
|
522
|
+
/* @__PURE__ */ l(de, { reducedMotion: "user", children: /* @__PURE__ */ l(fe, { children: c.open ? /* @__PURE__ */ l(
|
|
523
|
+
Ne,
|
|
265
524
|
{
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
className: "uk-dialog__close",
|
|
285
|
-
onClick: I,
|
|
286
|
-
children: /* @__PURE__ */ a(
|
|
287
|
-
"svg",
|
|
288
|
-
{
|
|
289
|
-
viewBox: "0 0 20 20",
|
|
290
|
-
width: "16",
|
|
291
|
-
height: "16",
|
|
292
|
-
"aria-hidden": "true",
|
|
293
|
-
children: /* @__PURE__ */ a(
|
|
294
|
-
"path",
|
|
295
|
-
{
|
|
296
|
-
d: "M5 5l10 10M15 5L5 15",
|
|
297
|
-
stroke: "currentColor",
|
|
298
|
-
strokeWidth: "1.8",
|
|
299
|
-
strokeLinecap: "round"
|
|
300
|
-
}
|
|
301
|
-
)
|
|
302
|
-
}
|
|
303
|
-
)
|
|
304
|
-
}
|
|
305
|
-
) : null
|
|
306
|
-
] }) : null,
|
|
307
|
-
/* @__PURE__ */ a("div", { className: "uk-dialog__body", children: u }),
|
|
308
|
-
l ? /* @__PURE__ */ a("footer", { className: "uk-dialog__footer", children: l }) : null
|
|
309
|
-
] })
|
|
310
|
-
}
|
|
311
|
-
),
|
|
525
|
+
requestClose: p,
|
|
526
|
+
contentId: c.contentId,
|
|
527
|
+
titleId: c.titleId,
|
|
528
|
+
descriptionId: c.descriptionId,
|
|
529
|
+
hasTitle: c.hasTitle,
|
|
530
|
+
hasDescription: c.hasDescription,
|
|
531
|
+
closeOnBackdropClick: e,
|
|
532
|
+
closeOnEscape: n,
|
|
533
|
+
initialFocusRef: r,
|
|
534
|
+
returnFocusRef: a,
|
|
535
|
+
className: s,
|
|
536
|
+
"aria-label": i,
|
|
537
|
+
"aria-labelledby": d,
|
|
538
|
+
"aria-describedby": u,
|
|
539
|
+
children: o
|
|
540
|
+
},
|
|
541
|
+
"uk-dialog"
|
|
542
|
+
) : null }) }),
|
|
312
543
|
document.body
|
|
313
544
|
) : null;
|
|
314
545
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
546
|
+
function Pe({
|
|
547
|
+
open: o,
|
|
548
|
+
onOpenChange: e,
|
|
549
|
+
title: n,
|
|
550
|
+
description: r,
|
|
551
|
+
footer: a,
|
|
552
|
+
children: s,
|
|
553
|
+
closeLabel: i = "Close",
|
|
554
|
+
showCloseButton: d = !0,
|
|
555
|
+
closeOnBackdropClick: u = !0,
|
|
556
|
+
closeOnEscape: c = !0,
|
|
557
|
+
initialFocusRef: p,
|
|
558
|
+
returnFocusRef: g,
|
|
559
|
+
className: k,
|
|
560
|
+
"aria-label": b
|
|
323
561
|
}) {
|
|
324
|
-
return /* @__PURE__ */ N(
|
|
325
|
-
|
|
562
|
+
return /* @__PURE__ */ l(q, { open: o, onOpenChange: e, children: /* @__PURE__ */ N(
|
|
563
|
+
ie,
|
|
326
564
|
{
|
|
327
|
-
className:
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
onBlurCapture: () => l(t.id),
|
|
565
|
+
className: k,
|
|
566
|
+
closeOnBackdropClick: u,
|
|
567
|
+
closeOnEscape: c,
|
|
568
|
+
initialFocusRef: p,
|
|
569
|
+
returnFocusRef: g,
|
|
570
|
+
"aria-label": b,
|
|
334
571
|
children: [
|
|
335
|
-
/* @__PURE__ */ N(
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
"
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
572
|
+
n || r || d ? /* @__PURE__ */ N(te, { children: [
|
|
573
|
+
/* @__PURE__ */ N("div", { className: "uk-dialog__heading", children: [
|
|
574
|
+
n ? /* @__PURE__ */ l(ne, { children: n }) : null,
|
|
575
|
+
r ? /* @__PURE__ */ l(re, { children: r }) : null
|
|
576
|
+
] }),
|
|
577
|
+
d ? /* @__PURE__ */ l(ee, { children: /* @__PURE__ */ l(
|
|
578
|
+
Y,
|
|
579
|
+
{
|
|
580
|
+
variant: "ghost",
|
|
581
|
+
size: "sm",
|
|
582
|
+
iconOnly: !0,
|
|
583
|
+
"aria-label": i,
|
|
584
|
+
className: "uk-dialog__close",
|
|
585
|
+
children: /* @__PURE__ */ l(
|
|
586
|
+
"svg",
|
|
587
|
+
{
|
|
588
|
+
viewBox: "0 0 20 20",
|
|
589
|
+
width: "16",
|
|
590
|
+
height: "16",
|
|
591
|
+
"aria-hidden": "true",
|
|
592
|
+
children: /* @__PURE__ */ l(
|
|
593
|
+
"path",
|
|
594
|
+
{
|
|
595
|
+
d: "M5 5l10 10M15 5L5 15",
|
|
596
|
+
stroke: "currentColor",
|
|
597
|
+
strokeWidth: "1.8",
|
|
598
|
+
strokeLinecap: "round"
|
|
599
|
+
}
|
|
600
|
+
)
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
}
|
|
604
|
+
) }) : null
|
|
605
|
+
] }) : null,
|
|
606
|
+
/* @__PURE__ */ l(oe, { children: s }),
|
|
607
|
+
a ? /* @__PURE__ */ l(ae, { children: a }) : null
|
|
357
608
|
]
|
|
358
609
|
}
|
|
359
|
-
);
|
|
360
|
-
}
|
|
361
|
-
function we({
|
|
362
|
-
children: t,
|
|
363
|
-
placement: n = "top-right",
|
|
364
|
-
duration: i = 4e3,
|
|
365
|
-
maxToasts: r = 4,
|
|
366
|
-
label: l = "Notifications",
|
|
367
|
-
closeLabel: u = "Close"
|
|
368
|
-
}) {
|
|
369
|
-
const [s, h] = Q([]), o = x([]), c = x(/* @__PURE__ */ new Map()), m = x(
|
|
370
|
-
/* @__PURE__ */ new Map()
|
|
371
|
-
), g = x(
|
|
372
|
-
/* @__PURE__ */ new Map()
|
|
373
|
-
), _ = x(0), v = S(), p = K(
|
|
374
|
-
ue,
|
|
375
|
-
de,
|
|
376
|
-
fe
|
|
377
|
-
), w = C((e) => {
|
|
378
|
-
o.current = e, h(e);
|
|
379
|
-
}, []), k = C((e) => {
|
|
380
|
-
const f = m.current.get(e);
|
|
381
|
-
f !== void 0 && (clearTimeout(f), m.current.delete(e));
|
|
382
|
-
}, []), R = C((e) => {
|
|
383
|
-
const f = g.current.get(e);
|
|
384
|
-
f !== void 0 && (clearTimeout(f), g.current.delete(e));
|
|
385
|
-
}, []), T = C(
|
|
386
|
-
(e) => {
|
|
387
|
-
k(e), !(g.current.has(e) || !o.current.some((b) => b.id === e)) && (w(
|
|
388
|
-
o.current.map(
|
|
389
|
-
(b) => b.id === e ? { ...b, leaving: !0 } : b
|
|
390
|
-
)
|
|
391
|
-
), g.current.set(
|
|
392
|
-
e,
|
|
393
|
-
setTimeout(() => {
|
|
394
|
-
g.current.delete(e), c.current.delete(e), w(o.current.filter((b) => b.id !== e));
|
|
395
|
-
}, le)
|
|
396
|
-
));
|
|
397
|
-
},
|
|
398
|
-
[k, w]
|
|
399
|
-
), E = C(
|
|
400
|
-
(e, f) => {
|
|
401
|
-
k(e), !(f <= 0) && m.current.set(
|
|
402
|
-
e,
|
|
403
|
-
setTimeout(() => {
|
|
404
|
-
m.current.delete(e), T(e);
|
|
405
|
-
}, f)
|
|
406
|
-
);
|
|
407
|
-
},
|
|
408
|
-
[k, T]
|
|
409
|
-
), I = C(
|
|
410
|
-
(e) => {
|
|
411
|
-
const f = `${v}-${_.current}`;
|
|
412
|
-
_.current += 1;
|
|
413
|
-
const b = {
|
|
414
|
-
id: f,
|
|
415
|
-
title: e.title,
|
|
416
|
-
description: e.description,
|
|
417
|
-
variant: e.variant ?? "info",
|
|
418
|
-
duration: e.duration ?? i,
|
|
419
|
-
leaving: !1
|
|
420
|
-
}, D = [...o.current, b], P = Math.max(0, D.length - r);
|
|
421
|
-
(P > 0 ? D.slice(0, P) : []).forEach((B) => {
|
|
422
|
-
k(B.id), R(B.id), c.current.delete(B.id);
|
|
423
|
-
});
|
|
424
|
-
const J = P > 0 ? D.slice(P) : D;
|
|
425
|
-
return c.current.set(f, b.duration), w(J), E(f, b.duration), f;
|
|
426
|
-
},
|
|
427
|
-
[
|
|
428
|
-
v,
|
|
429
|
-
k,
|
|
430
|
-
R,
|
|
431
|
-
w,
|
|
432
|
-
i,
|
|
433
|
-
r,
|
|
434
|
-
E
|
|
435
|
-
]
|
|
436
|
-
), d = C(
|
|
437
|
-
(e) => {
|
|
438
|
-
k(e);
|
|
439
|
-
},
|
|
440
|
-
[k]
|
|
441
|
-
), A = C(
|
|
442
|
-
(e) => {
|
|
443
|
-
const f = c.current.get(e);
|
|
444
|
-
f !== void 0 && E(e, f);
|
|
445
|
-
},
|
|
446
|
-
[E]
|
|
447
|
-
), M = C(() => {
|
|
448
|
-
o.current.forEach((e) => T(e.id));
|
|
449
|
-
}, [T]), $ = j(
|
|
450
|
-
() => ({ toast: I, dismiss: T, dismissAll: M }),
|
|
451
|
-
[T, M, I]
|
|
452
|
-
);
|
|
453
|
-
return z(() => {
|
|
454
|
-
const e = m.current, f = g.current;
|
|
455
|
-
return () => {
|
|
456
|
-
e.forEach((b) => clearTimeout(b)), f.forEach((b) => clearTimeout(b)), e.clear(), f.clear();
|
|
457
|
-
};
|
|
458
|
-
}, []), /* @__PURE__ */ N(G.Provider, { value: $, children: [
|
|
459
|
-
t,
|
|
460
|
-
p ? q(
|
|
461
|
-
/* @__PURE__ */ a(
|
|
462
|
-
"section",
|
|
463
|
-
{
|
|
464
|
-
className: "uk-toast-viewport",
|
|
465
|
-
"data-placement": n,
|
|
466
|
-
"aria-label": l,
|
|
467
|
-
"aria-live": "polite",
|
|
468
|
-
"aria-atomic": "false",
|
|
469
|
-
children: s.map((e) => /* @__PURE__ */ a(
|
|
470
|
-
he,
|
|
471
|
-
{
|
|
472
|
-
record: e,
|
|
473
|
-
closeLabel: u,
|
|
474
|
-
onDismiss: T,
|
|
475
|
-
onPause: d,
|
|
476
|
-
onResume: A
|
|
477
|
-
},
|
|
478
|
-
e.id
|
|
479
|
-
))
|
|
480
|
-
}
|
|
481
|
-
),
|
|
482
|
-
document.body
|
|
483
|
-
) : null
|
|
484
|
-
] });
|
|
485
|
-
}
|
|
486
|
-
function xe() {
|
|
487
|
-
const t = U(G);
|
|
488
|
-
if (!t)
|
|
489
|
-
throw new Error("useToast must be used within <ToastProvider>");
|
|
490
|
-
return t;
|
|
610
|
+
) });
|
|
491
611
|
}
|
|
612
|
+
const $e = Object.assign(Pe, {
|
|
613
|
+
Root: q,
|
|
614
|
+
Trigger: we,
|
|
615
|
+
Content: ie,
|
|
616
|
+
Header: te,
|
|
617
|
+
Title: ne,
|
|
618
|
+
Description: re,
|
|
619
|
+
Body: oe,
|
|
620
|
+
Footer: ae,
|
|
621
|
+
Close: ee
|
|
622
|
+
});
|
|
492
623
|
export {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
we as ToastProvider,
|
|
499
|
-
xe as useToast
|
|
624
|
+
Y as Button,
|
|
625
|
+
$e as Dialog,
|
|
626
|
+
Ae as Input,
|
|
627
|
+
He as Switch,
|
|
628
|
+
Oe as Tabs
|
|
500
629
|
};
|
|
501
630
|
//# sourceMappingURL=index.js.map
|