seam-react 0.2.0 → 0.4.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 +2 -1
- package/dist/Sidebar.d.ts +41 -0
- package/dist/Tooltip.d.ts +112 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1099 -346
- package/dist/index.js.map +1 -1
- package/dist/motion.d.ts +7 -0
- package/dist/styles.cjs +242 -2
- package/dist/styles.cjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.js +243 -3
- package/dist/styles.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,498 +1,620 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { useReducedMotion as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { useControllableState as
|
|
6
|
-
function
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
const
|
|
1
|
+
import { jsxs as _, jsx as p, Fragment as qe } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as E, useId as A, useRef as D, useEffect as O, useState as L, useMemo as j, isValidElement as W, cloneElement as q, createContext as U, useContext as X, useSyncExternalStore as oe, useLayoutEffect as re, useCallback as F } from "react";
|
|
3
|
+
import { useReducedMotion as V, useMotionValue as Ue, animate as pe, motion as $, LayoutGroup as Xe, AnimatePresence as z, MotionConfig as ie, useIsPresent as ae } from "motion/react";
|
|
4
|
+
import { createPortal as se } from "react-dom";
|
|
5
|
+
import { useControllableState as Z, useEventCallback as R, useLockBodyScroll as Ye, useFocusTrap as Je } from "seam-hooks";
|
|
6
|
+
function I(...t) {
|
|
7
|
+
return t.filter(Boolean).join(" ");
|
|
8
|
+
}
|
|
9
|
+
const be = E(function({
|
|
10
10
|
variant: e = "primary",
|
|
11
11
|
size: n = "md",
|
|
12
|
-
loading:
|
|
13
|
-
iconOnly:
|
|
12
|
+
loading: o = !1,
|
|
13
|
+
iconOnly: r = !1,
|
|
14
14
|
type: s = "button",
|
|
15
15
|
className: i,
|
|
16
|
-
children:
|
|
17
|
-
...
|
|
18
|
-
},
|
|
19
|
-
return /* @__PURE__ */
|
|
16
|
+
children: c,
|
|
17
|
+
...l
|
|
18
|
+
}, a) {
|
|
19
|
+
return /* @__PURE__ */ _(
|
|
20
20
|
"button",
|
|
21
21
|
{
|
|
22
|
-
...
|
|
23
|
-
ref:
|
|
22
|
+
...l,
|
|
23
|
+
ref: a,
|
|
24
24
|
type: s,
|
|
25
|
-
className:
|
|
25
|
+
className: I("uk-button", i),
|
|
26
26
|
"data-variant": e,
|
|
27
27
|
"data-size": n,
|
|
28
|
-
"data-loading":
|
|
29
|
-
"data-icon-only":
|
|
30
|
-
disabled:
|
|
31
|
-
"aria-busy":
|
|
28
|
+
"data-loading": o ? "true" : void 0,
|
|
29
|
+
"data-icon-only": r ? "true" : void 0,
|
|
30
|
+
disabled: l.disabled || o,
|
|
31
|
+
"aria-busy": o || void 0,
|
|
32
32
|
children: [
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
o ? /* @__PURE__ */ p("span", { className: "uk-button__spinner", "aria-hidden": "true" }) : null,
|
|
34
|
+
c
|
|
35
35
|
]
|
|
36
36
|
}
|
|
37
37
|
);
|
|
38
|
-
}),
|
|
38
|
+
}), Et = E(function({
|
|
39
39
|
inputSize: e = "md",
|
|
40
40
|
invalid: n = !1,
|
|
41
|
-
className:
|
|
42
|
-
"aria-invalid":
|
|
41
|
+
className: o,
|
|
42
|
+
"aria-invalid": r,
|
|
43
43
|
...s
|
|
44
44
|
}, i) {
|
|
45
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ p(
|
|
46
46
|
"input",
|
|
47
47
|
{
|
|
48
48
|
...s,
|
|
49
49
|
ref: i,
|
|
50
|
-
className:
|
|
50
|
+
className: I("uk-input", o),
|
|
51
51
|
"data-size": e,
|
|
52
|
-
"aria-invalid": n ? !0 :
|
|
52
|
+
"aria-invalid": n ? !0 : r
|
|
53
53
|
}
|
|
54
54
|
);
|
|
55
|
-
}),
|
|
55
|
+
}), Q = [0.23, 1, 0.32, 1], fe = {
|
|
56
56
|
type: "spring",
|
|
57
57
|
bounce: 0,
|
|
58
58
|
duration: 0.3
|
|
59
|
-
},
|
|
59
|
+
}, he = {
|
|
60
60
|
type: "spring",
|
|
61
61
|
bounce: 0.04,
|
|
62
62
|
duration: 0.38
|
|
63
|
-
},
|
|
63
|
+
}, ge = {
|
|
64
64
|
type: "spring",
|
|
65
65
|
bounce: 0.08,
|
|
66
66
|
duration: 0.34
|
|
67
|
-
},
|
|
67
|
+
}, ye = {
|
|
68
68
|
duration: 0.12,
|
|
69
|
-
ease:
|
|
70
|
-
},
|
|
69
|
+
ease: Q
|
|
70
|
+
}, Qe = {
|
|
71
|
+
layout: { type: "spring", bounce: 0, duration: 0.22 },
|
|
72
|
+
opacity: { duration: 0.12, ease: Q },
|
|
73
|
+
scale: { duration: 0.12, ease: Q }
|
|
74
|
+
}, K = {
|
|
75
|
+
duration: 0.12,
|
|
76
|
+
ease: Q
|
|
77
|
+
}, Pt = E(function({
|
|
71
78
|
checked: e,
|
|
72
79
|
defaultChecked: n,
|
|
73
|
-
onCheckedChange:
|
|
74
|
-
disabled:
|
|
80
|
+
onCheckedChange: o,
|
|
81
|
+
disabled: r,
|
|
75
82
|
className: s,
|
|
76
83
|
children: i,
|
|
77
|
-
id:
|
|
78
|
-
...
|
|
79
|
-
},
|
|
80
|
-
const
|
|
84
|
+
id: c,
|
|
85
|
+
...l
|
|
86
|
+
}, a) {
|
|
87
|
+
const m = A(), b = c ?? m, u = V() ?? !1, h = D(!1), f = D(null), [g, y] = Z({
|
|
81
88
|
value: e,
|
|
82
89
|
defaultValue: n ?? !1,
|
|
83
|
-
onChange:
|
|
84
|
-
}),
|
|
85
|
-
|
|
86
|
-
if (
|
|
90
|
+
onChange: o
|
|
91
|
+
}), T = Ue(g ? 16 : 0);
|
|
92
|
+
O(() => {
|
|
93
|
+
if (f.current)
|
|
87
94
|
return;
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
const d = pe(
|
|
96
|
+
T,
|
|
97
|
+
g ? 16 : 0,
|
|
98
|
+
u ? { duration: 0 } : fe
|
|
92
99
|
);
|
|
93
|
-
return () =>
|
|
94
|
-
}, [
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
if (!(!
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
return () => d.stop();
|
|
101
|
+
}, [g, u, T]);
|
|
102
|
+
const w = (d) => {
|
|
103
|
+
const v = f.current;
|
|
104
|
+
if (!(!v || v.pointerId !== d.pointerId)) {
|
|
105
|
+
if (v.moved) {
|
|
106
|
+
const x = v.samples[0], C = v.samples[v.samples.length - 1], S = x && C ? Math.max(C.time - x.time, 1) : 1, N = x && C ? (C.x - x.x) / S * 1e3 : 0, k = Math.abs(N) > 220 ? N > 0 : T.get() >= 8;
|
|
107
|
+
h.current = !0, f.current = null, y(k), pe(
|
|
108
|
+
T,
|
|
109
|
+
k ? 16 : 0,
|
|
110
|
+
u ? { duration: 0 } : { ...fe, velocity: N }
|
|
104
111
|
), window.setTimeout(() => {
|
|
105
|
-
|
|
112
|
+
h.current = !1;
|
|
106
113
|
}, 0);
|
|
107
114
|
} else
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
f.current = null;
|
|
116
|
+
d.currentTarget.hasPointerCapture(d.pointerId) && typeof d.currentTarget.releasePointerCapture == "function" && d.currentTarget.releasePointerCapture(d.pointerId);
|
|
110
117
|
}
|
|
111
118
|
};
|
|
112
|
-
return /* @__PURE__ */
|
|
119
|
+
return /* @__PURE__ */ _(
|
|
113
120
|
"label",
|
|
114
121
|
{
|
|
115
|
-
className:
|
|
116
|
-
"data-disabled":
|
|
117
|
-
htmlFor:
|
|
118
|
-
onClickCapture: (
|
|
119
|
-
|
|
122
|
+
className: I("uk-switch", s),
|
|
123
|
+
"data-disabled": r ? "true" : void 0,
|
|
124
|
+
htmlFor: b,
|
|
125
|
+
onClickCapture: (d) => {
|
|
126
|
+
h.current && (d.preventDefault(), d.stopPropagation());
|
|
120
127
|
},
|
|
121
128
|
children: [
|
|
122
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ p(
|
|
123
130
|
"input",
|
|
124
131
|
{
|
|
125
|
-
...
|
|
126
|
-
ref:
|
|
127
|
-
id:
|
|
132
|
+
...l,
|
|
133
|
+
ref: a,
|
|
134
|
+
id: b,
|
|
128
135
|
type: "checkbox",
|
|
129
136
|
role: "switch",
|
|
130
137
|
className: "uk-switch__input",
|
|
131
|
-
checked:
|
|
132
|
-
disabled:
|
|
133
|
-
"aria-checked":
|
|
134
|
-
onChange: (
|
|
138
|
+
checked: g,
|
|
139
|
+
disabled: r,
|
|
140
|
+
"aria-checked": g,
|
|
141
|
+
onChange: (d) => y(d.target.checked)
|
|
135
142
|
}
|
|
136
143
|
),
|
|
137
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ p(
|
|
138
145
|
"span",
|
|
139
146
|
{
|
|
140
147
|
className: "uk-switch__track",
|
|
141
148
|
"aria-hidden": "true",
|
|
142
|
-
onPointerDown: (
|
|
143
|
-
|
|
144
|
-
pointerId:
|
|
145
|
-
startX:
|
|
146
|
-
startValue:
|
|
149
|
+
onPointerDown: (d) => {
|
|
150
|
+
r || (f.current = {
|
|
151
|
+
pointerId: d.pointerId,
|
|
152
|
+
startX: d.clientX,
|
|
153
|
+
startValue: T.get(),
|
|
147
154
|
moved: !1,
|
|
148
|
-
samples: [{ x:
|
|
149
|
-
}, typeof
|
|
155
|
+
samples: [{ x: d.clientX, time: performance.now() }]
|
|
156
|
+
}, typeof d.currentTarget.setPointerCapture == "function" && d.currentTarget.setPointerCapture(d.pointerId));
|
|
150
157
|
},
|
|
151
|
-
onPointerMove: (
|
|
152
|
-
const
|
|
153
|
-
if (!
|
|
158
|
+
onPointerMove: (d) => {
|
|
159
|
+
const v = f.current;
|
|
160
|
+
if (!v || v.pointerId !== d.pointerId)
|
|
154
161
|
return;
|
|
155
|
-
const
|
|
156
|
-
Math.abs(
|
|
157
|
-
(
|
|
162
|
+
const x = d.clientX - v.startX;
|
|
163
|
+
Math.abs(x) > 4 && (v.moved = !0), v.moved && (d.preventDefault(), T.set(Math.max(0, Math.min(16, v.startValue + x))), v.samples.push({ x: d.clientX, time: performance.now() }), v.samples = v.samples.filter(
|
|
164
|
+
(C) => performance.now() - C.time < 120
|
|
158
165
|
));
|
|
159
166
|
},
|
|
160
|
-
onPointerUp:
|
|
161
|
-
onPointerCancel:
|
|
162
|
-
children: /* @__PURE__ */
|
|
167
|
+
onPointerUp: w,
|
|
168
|
+
onPointerCancel: w,
|
|
169
|
+
children: /* @__PURE__ */ p($.span, { className: "uk-switch__thumb", style: { x: T } })
|
|
163
170
|
}
|
|
164
171
|
),
|
|
165
|
-
i ? /* @__PURE__ */
|
|
172
|
+
i ? /* @__PURE__ */ p("span", { className: "uk-switch__label", children: i }) : null
|
|
166
173
|
]
|
|
167
174
|
}
|
|
168
175
|
);
|
|
169
|
-
}),
|
|
170
|
-
function
|
|
171
|
-
const e =
|
|
176
|
+
}), Te = U(null);
|
|
177
|
+
function We(t) {
|
|
178
|
+
const e = X(Te);
|
|
172
179
|
if (!e)
|
|
173
|
-
throw new Error(`<${
|
|
180
|
+
throw new Error(`<${t}> must be rendered inside <Sidebar>`);
|
|
174
181
|
return e;
|
|
175
182
|
}
|
|
176
|
-
function
|
|
177
|
-
return
|
|
183
|
+
function te(t, e) {
|
|
184
|
+
return (n) => {
|
|
185
|
+
t?.(n), n.defaultPrevented || e(n);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function Ze({
|
|
189
|
+
children: t,
|
|
190
|
+
className: e,
|
|
191
|
+
hoverPreview: n = !0,
|
|
192
|
+
...o
|
|
193
|
+
}) {
|
|
194
|
+
const [r, s] = L(null), i = A().replace(/:/g, ""), c = j(
|
|
195
|
+
() => ({ hoveredId: r, setHoveredId: s, indicatorBaseId: i, hoverPreview: n }),
|
|
196
|
+
[r, i, n]
|
|
197
|
+
);
|
|
198
|
+
return /* @__PURE__ */ p(Te.Provider, { value: c, children: /* @__PURE__ */ p(Xe, { id: `sidebar-${i}`, children: /* @__PURE__ */ p("nav", { ...o, className: I("uk-sidebar", e), children: t }) }) });
|
|
178
199
|
}
|
|
179
|
-
function
|
|
180
|
-
|
|
200
|
+
function et({
|
|
201
|
+
title: t,
|
|
202
|
+
icon: e,
|
|
203
|
+
children: n,
|
|
204
|
+
className: o,
|
|
205
|
+
...r
|
|
206
|
+
}) {
|
|
207
|
+
const s = A(), i = e != null;
|
|
208
|
+
return /* @__PURE__ */ _(
|
|
209
|
+
"section",
|
|
210
|
+
{
|
|
211
|
+
...r,
|
|
212
|
+
className: I("uk-sidebar__group", o),
|
|
213
|
+
"aria-labelledby": r["aria-labelledby"] ?? s,
|
|
214
|
+
"data-has-icon": i ? "true" : "false",
|
|
215
|
+
children: [
|
|
216
|
+
/* @__PURE__ */ _("p", { className: "uk-sidebar__group-title", id: s, children: [
|
|
217
|
+
i ? /* @__PURE__ */ p("span", { className: "uk-sidebar__group-icon", "aria-hidden": "true", children: e }) : null,
|
|
218
|
+
/* @__PURE__ */ p("span", { children: t })
|
|
219
|
+
] }),
|
|
220
|
+
/* @__PURE__ */ p("ul", { className: "uk-sidebar__list", children: n })
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
);
|
|
181
224
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
225
|
+
function tt({
|
|
226
|
+
active: t = !1,
|
|
227
|
+
children: e,
|
|
228
|
+
className: n
|
|
229
|
+
}) {
|
|
230
|
+
const o = We("Sidebar.Item"), r = A(), i = V() ?? !1 ? { duration: 0 } : ge;
|
|
231
|
+
if (!W(e))
|
|
232
|
+
throw new Error("<Sidebar.Item> expects a single valid React element");
|
|
233
|
+
const c = e, l = c.props, a = l.className, m = typeof a == "function" ? (y) => I("uk-sidebar__link", a(y), n) : I("uk-sidebar__link", a, n), b = l.onPointerEnter, u = l.onPointerLeave, h = l.onPointerCancel, f = o.hoveredId === r, g = /* @__PURE__ */ _(qe, { children: [
|
|
234
|
+
/* @__PURE__ */ p("span", { className: "uk-sidebar__rail", "aria-hidden": "true" }),
|
|
235
|
+
/* @__PURE__ */ p(z, { initial: !1, children: o.hoverPreview && f ? /* @__PURE__ */ p(
|
|
236
|
+
$.span,
|
|
237
|
+
{
|
|
238
|
+
className: "uk-sidebar__indicator",
|
|
239
|
+
"data-kind": "hover",
|
|
240
|
+
"data-slot": "sidebar-hover-indicator",
|
|
241
|
+
layoutId: `${o.indicatorBaseId}-hover`,
|
|
242
|
+
"aria-hidden": "true",
|
|
243
|
+
initial: { opacity: 0 },
|
|
244
|
+
animate: { opacity: 1 },
|
|
245
|
+
exit: { opacity: 0 },
|
|
246
|
+
transition: i
|
|
247
|
+
}
|
|
248
|
+
) : null }),
|
|
249
|
+
/* @__PURE__ */ p(z, { initial: !1, children: t ? /* @__PURE__ */ p(
|
|
250
|
+
$.span,
|
|
251
|
+
{
|
|
252
|
+
className: "uk-sidebar__indicator",
|
|
253
|
+
"data-kind": "active",
|
|
254
|
+
"data-slot": "sidebar-active-indicator",
|
|
255
|
+
layoutId: `${o.indicatorBaseId}-active`,
|
|
256
|
+
"aria-hidden": "true",
|
|
257
|
+
initial: { opacity: 0 },
|
|
258
|
+
animate: { opacity: 1 },
|
|
259
|
+
exit: { opacity: 0 },
|
|
260
|
+
transition: i
|
|
261
|
+
}
|
|
262
|
+
) : null }),
|
|
263
|
+
/* @__PURE__ */ p("span", { className: "uk-sidebar__label", children: l.children })
|
|
264
|
+
] });
|
|
265
|
+
return /* @__PURE__ */ p("li", { className: "uk-sidebar__item", children: q(
|
|
266
|
+
c,
|
|
267
|
+
{
|
|
268
|
+
className: m,
|
|
269
|
+
"data-active": t ? "true" : "false",
|
|
270
|
+
"data-preview": t || f ? "true" : "false",
|
|
271
|
+
"aria-current": l["aria-current"] ?? (t ? "page" : void 0),
|
|
272
|
+
onPointerEnter: te(
|
|
273
|
+
b,
|
|
274
|
+
(y) => {
|
|
275
|
+
o.hoverPreview && y.pointerType === "mouse" && o.setHoveredId(r);
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
onPointerLeave: te(u, () => {
|
|
279
|
+
o.hoveredId === r && o.setHoveredId(null);
|
|
280
|
+
}),
|
|
281
|
+
onPointerCancel: te(h, () => {
|
|
282
|
+
o.hoveredId === r && o.setHoveredId(null);
|
|
283
|
+
})
|
|
284
|
+
},
|
|
285
|
+
g
|
|
286
|
+
) });
|
|
287
|
+
}
|
|
288
|
+
const Dt = Object.assign(Ze, {
|
|
289
|
+
Group: et,
|
|
290
|
+
Item: tt
|
|
291
|
+
}), ve = U(null);
|
|
292
|
+
function ce(t) {
|
|
293
|
+
const e = X(ve);
|
|
294
|
+
if (!e)
|
|
295
|
+
throw new Error(`<${t}> must be rendered inside <Tabs>`);
|
|
296
|
+
return e;
|
|
297
|
+
}
|
|
298
|
+
function we(t, e) {
|
|
299
|
+
return `${t}-tab-${encodeURIComponent(e)}`;
|
|
300
|
+
}
|
|
301
|
+
function Ie(t, e) {
|
|
302
|
+
return `${t}-panel-${encodeURIComponent(e)}`;
|
|
303
|
+
}
|
|
304
|
+
function nt({
|
|
305
|
+
value: t,
|
|
184
306
|
defaultValue: e,
|
|
185
307
|
onValueChange: n,
|
|
186
|
-
orientation:
|
|
187
|
-
className:
|
|
308
|
+
orientation: o = "horizontal",
|
|
309
|
+
className: r,
|
|
188
310
|
children: s
|
|
189
311
|
}) {
|
|
190
|
-
const i =
|
|
191
|
-
value:
|
|
312
|
+
const i = A(), [c, l] = Z({
|
|
313
|
+
value: t,
|
|
192
314
|
defaultValue: e ?? "",
|
|
193
315
|
onChange: n
|
|
194
|
-
}),
|
|
316
|
+
}), a = j(
|
|
195
317
|
() => ({
|
|
196
318
|
baseId: i,
|
|
197
|
-
value:
|
|
198
|
-
setValue:
|
|
199
|
-
orientation:
|
|
319
|
+
value: c,
|
|
320
|
+
setValue: l,
|
|
321
|
+
orientation: o,
|
|
200
322
|
indicatorId: `${i}-indicator`
|
|
201
323
|
}),
|
|
202
|
-
[i,
|
|
324
|
+
[i, c, o, l]
|
|
203
325
|
);
|
|
204
|
-
return /* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ p(ve.Provider, { value: a, children: /* @__PURE__ */ p("div", { className: I("uk-tabs", r), "data-orientation": o, children: s }) });
|
|
205
327
|
}
|
|
206
|
-
const
|
|
207
|
-
const { orientation: s } =
|
|
208
|
-
return /* @__PURE__ */
|
|
328
|
+
const ot = E(function({ className: e, onKeyDown: n, ...o }, r) {
|
|
329
|
+
const { orientation: s } = ce("Tabs.List");
|
|
330
|
+
return /* @__PURE__ */ p(
|
|
209
331
|
"div",
|
|
210
332
|
{
|
|
211
|
-
...
|
|
212
|
-
ref:
|
|
333
|
+
...o,
|
|
334
|
+
ref: r,
|
|
213
335
|
role: "tablist",
|
|
214
336
|
"aria-orientation": s,
|
|
215
337
|
tabIndex: -1,
|
|
216
|
-
className:
|
|
338
|
+
className: I("uk-tabs__list", e),
|
|
217
339
|
onKeyDown: (i) => {
|
|
218
340
|
if (n?.(i), i.defaultPrevented)
|
|
219
341
|
return;
|
|
220
|
-
const
|
|
221
|
-
if (!
|
|
342
|
+
const l = i.target?.closest('[role="tab"]');
|
|
343
|
+
if (!l || l.hasAttribute("disabled"))
|
|
222
344
|
return;
|
|
223
|
-
const
|
|
345
|
+
const a = Array.from(
|
|
224
346
|
i.currentTarget.querySelectorAll(
|
|
225
347
|
'[role="tab"]:not([disabled])'
|
|
226
348
|
)
|
|
227
|
-
),
|
|
228
|
-
if (
|
|
349
|
+
), m = a.indexOf(l);
|
|
350
|
+
if (m === -1)
|
|
229
351
|
return;
|
|
230
|
-
const
|
|
231
|
-
let
|
|
352
|
+
const b = s === "horizontal" ? "ArrowRight" : "ArrowDown", u = s === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
353
|
+
let h = -1;
|
|
232
354
|
switch (i.key) {
|
|
233
|
-
case
|
|
234
|
-
|
|
355
|
+
case b:
|
|
356
|
+
h = (m + 1) % a.length;
|
|
235
357
|
break;
|
|
236
|
-
case
|
|
237
|
-
|
|
358
|
+
case u:
|
|
359
|
+
h = (m - 1 + a.length) % a.length;
|
|
238
360
|
break;
|
|
239
361
|
case "Home":
|
|
240
|
-
|
|
362
|
+
h = 0;
|
|
241
363
|
break;
|
|
242
364
|
case "End":
|
|
243
|
-
|
|
365
|
+
h = a.length - 1;
|
|
244
366
|
break;
|
|
245
367
|
default:
|
|
246
368
|
return;
|
|
247
369
|
}
|
|
248
370
|
i.preventDefault();
|
|
249
|
-
const
|
|
250
|
-
|
|
371
|
+
const f = a[h];
|
|
372
|
+
f && (f.focus(), f.click());
|
|
251
373
|
}
|
|
252
374
|
}
|
|
253
375
|
);
|
|
254
|
-
}),
|
|
255
|
-
const
|
|
256
|
-
return /* @__PURE__ */
|
|
376
|
+
}), rt = E(function({ value: e, type: n = "button", className: o, onClick: r, children: s, ...i }, c) {
|
|
377
|
+
const l = ce("Tabs.Trigger"), a = l.value === e, m = V() ?? !1;
|
|
378
|
+
return /* @__PURE__ */ _(
|
|
257
379
|
"button",
|
|
258
380
|
{
|
|
259
381
|
...i,
|
|
260
|
-
ref:
|
|
382
|
+
ref: c,
|
|
261
383
|
type: n,
|
|
262
384
|
role: "tab",
|
|
263
|
-
id:
|
|
264
|
-
"aria-selected":
|
|
265
|
-
"aria-controls":
|
|
266
|
-
tabIndex:
|
|
267
|
-
"data-state":
|
|
268
|
-
className:
|
|
269
|
-
onClick: (
|
|
270
|
-
|
|
385
|
+
id: we(l.baseId, e),
|
|
386
|
+
"aria-selected": a,
|
|
387
|
+
"aria-controls": Ie(l.baseId, e),
|
|
388
|
+
tabIndex: a ? 0 : -1,
|
|
389
|
+
"data-state": a ? "active" : "inactive",
|
|
390
|
+
className: I("uk-tabs__trigger", o),
|
|
391
|
+
onClick: (b) => {
|
|
392
|
+
r?.(b), b.defaultPrevented || l.setValue(e);
|
|
271
393
|
},
|
|
272
394
|
children: [
|
|
273
395
|
s,
|
|
274
|
-
|
|
275
|
-
|
|
396
|
+
a ? /* @__PURE__ */ p(
|
|
397
|
+
$.span,
|
|
276
398
|
{
|
|
277
399
|
className: "uk-tabs__indicator",
|
|
278
|
-
layoutId:
|
|
400
|
+
layoutId: l.indicatorId,
|
|
279
401
|
"aria-hidden": "true",
|
|
280
|
-
transition:
|
|
402
|
+
transition: m ? { duration: 0 } : ge
|
|
281
403
|
}
|
|
282
404
|
) : null
|
|
283
405
|
]
|
|
284
406
|
}
|
|
285
407
|
);
|
|
286
|
-
}),
|
|
287
|
-
const s =
|
|
288
|
-
return /* @__PURE__ */
|
|
408
|
+
}), it = E(function({ value: e, className: n, ...o }, r) {
|
|
409
|
+
const s = ce("Tabs.Content"), i = s.value === e;
|
|
410
|
+
return /* @__PURE__ */ p(
|
|
289
411
|
"div",
|
|
290
412
|
{
|
|
291
|
-
...
|
|
292
|
-
ref:
|
|
413
|
+
...o,
|
|
414
|
+
ref: r,
|
|
293
415
|
role: "tabpanel",
|
|
294
|
-
id:
|
|
295
|
-
"aria-labelledby":
|
|
416
|
+
id: Ie(s.baseId, e),
|
|
417
|
+
"aria-labelledby": we(s.baseId, e),
|
|
296
418
|
hidden: !i,
|
|
297
419
|
tabIndex: 0,
|
|
298
420
|
"data-state": i ? "active" : "inactive",
|
|
299
|
-
className:
|
|
421
|
+
className: I("uk-tabs__panel", n)
|
|
300
422
|
}
|
|
301
423
|
);
|
|
302
|
-
}),
|
|
303
|
-
List:
|
|
304
|
-
Trigger:
|
|
305
|
-
Content:
|
|
306
|
-
}),
|
|
307
|
-
},
|
|
308
|
-
function
|
|
309
|
-
const e =
|
|
424
|
+
}), Nt = Object.assign(nt, {
|
|
425
|
+
List: ot,
|
|
426
|
+
Trigger: rt,
|
|
427
|
+
Content: it
|
|
428
|
+
}), ke = U(null), at = () => () => {
|
|
429
|
+
}, st = () => !0, ct = () => !1;
|
|
430
|
+
function Y(t) {
|
|
431
|
+
const e = X(ke);
|
|
310
432
|
if (!e)
|
|
311
|
-
throw new Error(`<${
|
|
433
|
+
throw new Error(`<${t}> must be rendered inside <Dialog.Root>`);
|
|
312
434
|
return e;
|
|
313
435
|
}
|
|
314
|
-
function
|
|
436
|
+
function xe(t, e) {
|
|
315
437
|
return (n) => {
|
|
316
|
-
|
|
438
|
+
t?.(n), n.defaultPrevented || e(n);
|
|
317
439
|
};
|
|
318
440
|
}
|
|
319
|
-
function
|
|
320
|
-
children:
|
|
441
|
+
function Ce({
|
|
442
|
+
children: t,
|
|
321
443
|
open: e,
|
|
322
444
|
defaultOpen: n,
|
|
323
|
-
onOpenChange:
|
|
445
|
+
onOpenChange: o
|
|
324
446
|
}) {
|
|
325
|
-
const
|
|
447
|
+
const r = A(), [s, i] = L(!1), [c, l] = L(!1), [a, m] = Z({
|
|
326
448
|
value: e,
|
|
327
449
|
defaultValue: n ?? !1,
|
|
328
|
-
onChange:
|
|
329
|
-
}),
|
|
450
|
+
onChange: o
|
|
451
|
+
}), b = j(
|
|
330
452
|
() => ({
|
|
331
|
-
open:
|
|
332
|
-
setOpen:
|
|
333
|
-
triggerId: `${
|
|
334
|
-
contentId: `${
|
|
335
|
-
titleId: `${
|
|
336
|
-
descriptionId: `${
|
|
453
|
+
open: a,
|
|
454
|
+
setOpen: m,
|
|
455
|
+
triggerId: `${r}-trigger`,
|
|
456
|
+
contentId: `${r}-content`,
|
|
457
|
+
titleId: `${r}-title`,
|
|
458
|
+
descriptionId: `${r}-description`,
|
|
337
459
|
hasTitle: s,
|
|
338
460
|
setHasTitle: i,
|
|
339
|
-
hasDescription:
|
|
340
|
-
setHasDescription:
|
|
461
|
+
hasDescription: c,
|
|
462
|
+
setHasDescription: l
|
|
341
463
|
}),
|
|
342
|
-
[a, c,
|
|
464
|
+
[r, a, c, s, m]
|
|
343
465
|
);
|
|
344
|
-
return /* @__PURE__ */
|
|
466
|
+
return /* @__PURE__ */ p(ke.Provider, { value: b, children: t });
|
|
345
467
|
}
|
|
346
|
-
function
|
|
347
|
-
const e =
|
|
348
|
-
return
|
|
468
|
+
function lt({ children: t }) {
|
|
469
|
+
const e = Y("Dialog.Trigger"), n = t, o = n.props.onClick;
|
|
470
|
+
return q(n, {
|
|
349
471
|
id: e.triggerId,
|
|
350
472
|
"aria-haspopup": "dialog",
|
|
351
473
|
"aria-expanded": e.open,
|
|
352
474
|
"aria-controls": e.open ? e.contentId : void 0,
|
|
353
|
-
onClick:
|
|
475
|
+
onClick: xe(o, () => {
|
|
354
476
|
e.setOpen(!e.open);
|
|
355
477
|
})
|
|
356
478
|
});
|
|
357
479
|
}
|
|
358
|
-
function
|
|
359
|
-
children:
|
|
480
|
+
function _e({
|
|
481
|
+
children: t,
|
|
360
482
|
label: e = "Close"
|
|
361
483
|
}) {
|
|
362
|
-
const n =
|
|
363
|
-
if (
|
|
364
|
-
const
|
|
365
|
-
return
|
|
366
|
-
onClick:
|
|
484
|
+
const n = Y("Dialog.Close");
|
|
485
|
+
if (W(t)) {
|
|
486
|
+
const o = t, r = o.props.onClick;
|
|
487
|
+
return q(o, {
|
|
488
|
+
onClick: xe(r, () => {
|
|
367
489
|
n.setOpen(!1);
|
|
368
490
|
})
|
|
369
491
|
});
|
|
370
492
|
}
|
|
371
|
-
return /* @__PURE__ */
|
|
493
|
+
return /* @__PURE__ */ p(be, { variant: "ghost", onClick: () => n.setOpen(!1), children: e });
|
|
372
494
|
}
|
|
373
|
-
const
|
|
374
|
-
return /* @__PURE__ */
|
|
495
|
+
const Ee = E(function({ className: e, ...n }, o) {
|
|
496
|
+
return /* @__PURE__ */ p(
|
|
375
497
|
"header",
|
|
376
498
|
{
|
|
377
499
|
...n,
|
|
378
|
-
ref:
|
|
379
|
-
className:
|
|
500
|
+
ref: o,
|
|
501
|
+
className: I("uk-dialog__header", e)
|
|
380
502
|
}
|
|
381
503
|
);
|
|
382
|
-
}),
|
|
383
|
-
const s =
|
|
384
|
-
return
|
|
504
|
+
}), Pe = E(function({ className: e, children: n, ...o }, r) {
|
|
505
|
+
const s = Y("Dialog.Title"), i = s.setHasTitle;
|
|
506
|
+
return O(() => (i(!0), () => i(!1)), [i]), /* @__PURE__ */ p(
|
|
385
507
|
"h2",
|
|
386
508
|
{
|
|
387
|
-
...
|
|
388
|
-
ref:
|
|
509
|
+
...o,
|
|
510
|
+
ref: r,
|
|
389
511
|
id: s.titleId,
|
|
390
|
-
className:
|
|
512
|
+
className: I("uk-dialog__title", e),
|
|
391
513
|
children: n
|
|
392
514
|
}
|
|
393
515
|
);
|
|
394
|
-
}),
|
|
395
|
-
function({ className: e, ...n },
|
|
396
|
-
const
|
|
397
|
-
return
|
|
516
|
+
}), De = E(
|
|
517
|
+
function({ className: e, ...n }, o) {
|
|
518
|
+
const r = Y("Dialog.Description"), s = r.setHasDescription;
|
|
519
|
+
return O(() => (s(!0), () => s(!1)), [s]), /* @__PURE__ */ p(
|
|
398
520
|
"p",
|
|
399
521
|
{
|
|
400
522
|
...n,
|
|
401
|
-
ref:
|
|
402
|
-
id:
|
|
403
|
-
className:
|
|
523
|
+
ref: o,
|
|
524
|
+
id: r.descriptionId,
|
|
525
|
+
className: I("uk-dialog__description", e)
|
|
404
526
|
}
|
|
405
527
|
);
|
|
406
528
|
}
|
|
407
|
-
),
|
|
408
|
-
return /* @__PURE__ */
|
|
409
|
-
}),
|
|
410
|
-
return /* @__PURE__ */
|
|
529
|
+
), Ne = E(function({ className: e, ...n }, o) {
|
|
530
|
+
return /* @__PURE__ */ p("div", { ...n, ref: o, className: I("uk-dialog__body", e) });
|
|
531
|
+
}), Re = E(function({ className: e, ...n }, o) {
|
|
532
|
+
return /* @__PURE__ */ p(
|
|
411
533
|
"footer",
|
|
412
534
|
{
|
|
413
535
|
...n,
|
|
414
|
-
ref:
|
|
415
|
-
className:
|
|
536
|
+
ref: o,
|
|
537
|
+
className: I("uk-dialog__footer", e)
|
|
416
538
|
}
|
|
417
539
|
);
|
|
418
540
|
});
|
|
419
|
-
function
|
|
420
|
-
requestClose:
|
|
541
|
+
function ut({
|
|
542
|
+
requestClose: t,
|
|
421
543
|
contentId: e,
|
|
422
544
|
titleId: n,
|
|
423
|
-
descriptionId:
|
|
424
|
-
hasTitle:
|
|
545
|
+
descriptionId: o,
|
|
546
|
+
hasTitle: r,
|
|
425
547
|
hasDescription: s,
|
|
426
548
|
children: i,
|
|
427
|
-
closeOnBackdropClick:
|
|
428
|
-
closeOnEscape:
|
|
429
|
-
initialFocusRef:
|
|
430
|
-
returnFocusRef:
|
|
431
|
-
className:
|
|
432
|
-
"aria-label":
|
|
433
|
-
"aria-labelledby":
|
|
434
|
-
"aria-describedby":
|
|
549
|
+
closeOnBackdropClick: c = !0,
|
|
550
|
+
closeOnEscape: l = !0,
|
|
551
|
+
initialFocusRef: a,
|
|
552
|
+
returnFocusRef: m,
|
|
553
|
+
className: b,
|
|
554
|
+
"aria-label": u,
|
|
555
|
+
"aria-labelledby": h,
|
|
556
|
+
"aria-describedby": f
|
|
435
557
|
}) {
|
|
436
|
-
const
|
|
437
|
-
return
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
}, []),
|
|
558
|
+
const g = D(null), y = D(null), T = ae(), w = V() ?? !1;
|
|
559
|
+
return Ye(!0), re(() => {
|
|
560
|
+
const d = g.current;
|
|
561
|
+
d && (y.current ?? (y.current = document.activeElement instanceof HTMLElement ? document.activeElement : null), !d.open && (typeof d.showModal == "function" ? d.showModal() : d.setAttribute("open", "")));
|
|
562
|
+
}, []), Je({
|
|
441
563
|
active: !0,
|
|
442
|
-
containerRef:
|
|
443
|
-
initialFocusRef:
|
|
444
|
-
returnFocusRef:
|
|
445
|
-
}),
|
|
446
|
-
const
|
|
447
|
-
if (!
|
|
564
|
+
containerRef: g,
|
|
565
|
+
initialFocusRef: a,
|
|
566
|
+
returnFocusRef: m ?? y
|
|
567
|
+
}), O(() => {
|
|
568
|
+
const d = g.current;
|
|
569
|
+
if (!d)
|
|
448
570
|
return;
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
},
|
|
452
|
-
if (!
|
|
453
|
-
|
|
571
|
+
const v = () => {
|
|
572
|
+
d.open || (typeof d.showModal == "function" ? d.showModal() : d.setAttribute("open", ""));
|
|
573
|
+
}, x = () => {
|
|
574
|
+
if (!l) {
|
|
575
|
+
v();
|
|
454
576
|
return;
|
|
455
577
|
}
|
|
456
|
-
|
|
457
|
-
},
|
|
458
|
-
|
|
459
|
-
},
|
|
460
|
-
|
|
461
|
-
},
|
|
462
|
-
|
|
578
|
+
t();
|
|
579
|
+
}, C = (k) => {
|
|
580
|
+
k.preventDefault(), l && t();
|
|
581
|
+
}, S = (k) => {
|
|
582
|
+
l || k.key !== "Escape" || k.defaultPrevented || (k.preventDefault(), k.stopPropagation());
|
|
583
|
+
}, N = (k) => {
|
|
584
|
+
c && k.target === d && t();
|
|
463
585
|
};
|
|
464
|
-
return
|
|
465
|
-
|
|
586
|
+
return d.addEventListener("close", x), d.addEventListener("cancel", C), d.addEventListener("keydown", S, !0), d.addEventListener("click", N), () => {
|
|
587
|
+
d.removeEventListener("close", x), d.removeEventListener("cancel", C), d.removeEventListener("keydown", S, !0), d.removeEventListener("click", N);
|
|
466
588
|
};
|
|
467
|
-
}, [
|
|
589
|
+
}, [c, l, t]), /* @__PURE__ */ p(
|
|
468
590
|
"dialog",
|
|
469
591
|
{
|
|
470
|
-
ref:
|
|
592
|
+
ref: g,
|
|
471
593
|
id: e,
|
|
472
|
-
className:
|
|
473
|
-
closedby:
|
|
474
|
-
"data-state":
|
|
475
|
-
inert: !
|
|
476
|
-
"aria-label":
|
|
477
|
-
"aria-labelledby":
|
|
478
|
-
"aria-describedby":
|
|
479
|
-
children: /* @__PURE__ */
|
|
480
|
-
|
|
594
|
+
className: I("uk-dialog", b),
|
|
595
|
+
closedby: l || c ? "any" : "none",
|
|
596
|
+
"data-state": T ? "open" : "closed",
|
|
597
|
+
inert: !T,
|
|
598
|
+
"aria-label": u,
|
|
599
|
+
"aria-labelledby": h ?? (u ? void 0 : r ? n : void 0),
|
|
600
|
+
"aria-describedby": f ?? (s ? o : void 0),
|
|
601
|
+
children: /* @__PURE__ */ p(
|
|
602
|
+
$.div,
|
|
481
603
|
{
|
|
482
604
|
className: "uk-dialog__panel",
|
|
483
|
-
initial:
|
|
605
|
+
initial: w ? { opacity: 0 } : {
|
|
484
606
|
opacity: 0,
|
|
485
607
|
transform: "translateY(12px) scale(0.96)"
|
|
486
608
|
},
|
|
487
609
|
animate: {
|
|
488
610
|
opacity: 1,
|
|
489
611
|
transform: "translateY(0px) scale(1)",
|
|
490
|
-
transition:
|
|
612
|
+
transition: w ? K : { ...he, delay: 0.06 }
|
|
491
613
|
},
|
|
492
|
-
exit:
|
|
614
|
+
exit: w ? { opacity: 0, transition: K } : {
|
|
493
615
|
opacity: 0,
|
|
494
616
|
transform: "translateY(8px) scale(0.97)",
|
|
495
|
-
transition:
|
|
617
|
+
transition: he
|
|
496
618
|
},
|
|
497
619
|
children: i
|
|
498
620
|
}
|
|
@@ -500,96 +622,96 @@ function Ne({
|
|
|
500
622
|
}
|
|
501
623
|
);
|
|
502
624
|
}
|
|
503
|
-
function
|
|
504
|
-
children:
|
|
625
|
+
function Le({
|
|
626
|
+
children: t,
|
|
505
627
|
closeOnBackdropClick: e = !0,
|
|
506
628
|
closeOnEscape: n = !0,
|
|
507
|
-
initialFocusRef:
|
|
508
|
-
returnFocusRef:
|
|
629
|
+
initialFocusRef: o,
|
|
630
|
+
returnFocusRef: r,
|
|
509
631
|
className: s,
|
|
510
632
|
"aria-label": i,
|
|
511
|
-
"aria-labelledby":
|
|
512
|
-
"aria-describedby":
|
|
633
|
+
"aria-labelledby": c,
|
|
634
|
+
"aria-describedby": l
|
|
513
635
|
}) {
|
|
514
|
-
const
|
|
515
|
-
|
|
636
|
+
const a = Y("Dialog.Content"), m = R(() => {
|
|
637
|
+
a.setOpen(!1);
|
|
516
638
|
});
|
|
517
|
-
return
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
) ?
|
|
522
|
-
/* @__PURE__ */
|
|
523
|
-
|
|
639
|
+
return oe(
|
|
640
|
+
at,
|
|
641
|
+
st,
|
|
642
|
+
ct
|
|
643
|
+
) ? se(
|
|
644
|
+
/* @__PURE__ */ p(ie, { reducedMotion: "user", children: /* @__PURE__ */ p(z, { children: a.open ? /* @__PURE__ */ p(
|
|
645
|
+
ut,
|
|
524
646
|
{
|
|
525
|
-
requestClose:
|
|
526
|
-
contentId:
|
|
527
|
-
titleId:
|
|
528
|
-
descriptionId:
|
|
529
|
-
hasTitle:
|
|
530
|
-
hasDescription:
|
|
647
|
+
requestClose: m,
|
|
648
|
+
contentId: a.contentId,
|
|
649
|
+
titleId: a.titleId,
|
|
650
|
+
descriptionId: a.descriptionId,
|
|
651
|
+
hasTitle: a.hasTitle,
|
|
652
|
+
hasDescription: a.hasDescription,
|
|
531
653
|
closeOnBackdropClick: e,
|
|
532
654
|
closeOnEscape: n,
|
|
533
|
-
initialFocusRef:
|
|
534
|
-
returnFocusRef:
|
|
655
|
+
initialFocusRef: o,
|
|
656
|
+
returnFocusRef: r,
|
|
535
657
|
className: s,
|
|
536
658
|
"aria-label": i,
|
|
537
|
-
"aria-labelledby":
|
|
538
|
-
"aria-describedby":
|
|
539
|
-
children:
|
|
659
|
+
"aria-labelledby": c,
|
|
660
|
+
"aria-describedby": l,
|
|
661
|
+
children: t
|
|
540
662
|
},
|
|
541
663
|
"uk-dialog"
|
|
542
664
|
) : null }) }),
|
|
543
665
|
document.body
|
|
544
666
|
) : null;
|
|
545
667
|
}
|
|
546
|
-
function
|
|
547
|
-
open:
|
|
668
|
+
function dt({
|
|
669
|
+
open: t,
|
|
548
670
|
onOpenChange: e,
|
|
549
671
|
title: n,
|
|
550
|
-
description:
|
|
551
|
-
footer:
|
|
672
|
+
description: o,
|
|
673
|
+
footer: r,
|
|
552
674
|
children: s,
|
|
553
675
|
closeLabel: i = "Close",
|
|
554
|
-
showCloseButton:
|
|
555
|
-
closeOnBackdropClick:
|
|
556
|
-
closeOnEscape:
|
|
557
|
-
initialFocusRef:
|
|
558
|
-
returnFocusRef:
|
|
559
|
-
className:
|
|
560
|
-
"aria-label":
|
|
676
|
+
showCloseButton: c = !0,
|
|
677
|
+
closeOnBackdropClick: l = !0,
|
|
678
|
+
closeOnEscape: a = !0,
|
|
679
|
+
initialFocusRef: m,
|
|
680
|
+
returnFocusRef: b,
|
|
681
|
+
className: u,
|
|
682
|
+
"aria-label": h
|
|
561
683
|
}) {
|
|
562
|
-
return /* @__PURE__ */
|
|
563
|
-
|
|
684
|
+
return /* @__PURE__ */ p(Ce, { open: t, onOpenChange: e, children: /* @__PURE__ */ _(
|
|
685
|
+
Le,
|
|
564
686
|
{
|
|
565
|
-
className:
|
|
566
|
-
closeOnBackdropClick:
|
|
567
|
-
closeOnEscape:
|
|
568
|
-
initialFocusRef:
|
|
569
|
-
returnFocusRef:
|
|
570
|
-
"aria-label":
|
|
687
|
+
className: u,
|
|
688
|
+
closeOnBackdropClick: l,
|
|
689
|
+
closeOnEscape: a,
|
|
690
|
+
initialFocusRef: m,
|
|
691
|
+
returnFocusRef: b,
|
|
692
|
+
"aria-label": h,
|
|
571
693
|
children: [
|
|
572
|
-
n ||
|
|
573
|
-
/* @__PURE__ */
|
|
574
|
-
n ? /* @__PURE__ */
|
|
575
|
-
|
|
694
|
+
n || o || c ? /* @__PURE__ */ _(Ee, { children: [
|
|
695
|
+
/* @__PURE__ */ _("div", { className: "uk-dialog__heading", children: [
|
|
696
|
+
n ? /* @__PURE__ */ p(Pe, { children: n }) : null,
|
|
697
|
+
o ? /* @__PURE__ */ p(De, { children: o }) : null
|
|
576
698
|
] }),
|
|
577
|
-
|
|
578
|
-
|
|
699
|
+
c ? /* @__PURE__ */ p(_e, { children: /* @__PURE__ */ p(
|
|
700
|
+
be,
|
|
579
701
|
{
|
|
580
702
|
variant: "ghost",
|
|
581
703
|
size: "sm",
|
|
582
704
|
iconOnly: !0,
|
|
583
705
|
"aria-label": i,
|
|
584
706
|
className: "uk-dialog__close",
|
|
585
|
-
children: /* @__PURE__ */
|
|
707
|
+
children: /* @__PURE__ */ p(
|
|
586
708
|
"svg",
|
|
587
709
|
{
|
|
588
710
|
viewBox: "0 0 20 20",
|
|
589
711
|
width: "16",
|
|
590
712
|
height: "16",
|
|
591
713
|
"aria-hidden": "true",
|
|
592
|
-
children: /* @__PURE__ */
|
|
714
|
+
children: /* @__PURE__ */ p(
|
|
593
715
|
"path",
|
|
594
716
|
{
|
|
595
717
|
d: "M5 5l10 10M15 5L5 15",
|
|
@@ -603,28 +725,659 @@ function Pe({
|
|
|
603
725
|
}
|
|
604
726
|
) }) : null
|
|
605
727
|
] }) : null,
|
|
606
|
-
/* @__PURE__ */
|
|
607
|
-
|
|
728
|
+
/* @__PURE__ */ p(Ne, { children: s }),
|
|
729
|
+
r ? /* @__PURE__ */ p(Re, { children: r }) : null
|
|
608
730
|
]
|
|
609
731
|
}
|
|
610
732
|
) });
|
|
611
733
|
}
|
|
612
|
-
const
|
|
613
|
-
Root:
|
|
614
|
-
Trigger:
|
|
615
|
-
Content:
|
|
616
|
-
Header:
|
|
617
|
-
Title:
|
|
618
|
-
Description:
|
|
619
|
-
Body:
|
|
620
|
-
Footer:
|
|
621
|
-
Close:
|
|
622
|
-
})
|
|
734
|
+
const Rt = Object.assign(dt, {
|
|
735
|
+
Root: Ce,
|
|
736
|
+
Trigger: lt,
|
|
737
|
+
Content: Le,
|
|
738
|
+
Header: Ee,
|
|
739
|
+
Title: Pe,
|
|
740
|
+
Description: De,
|
|
741
|
+
Body: Ne,
|
|
742
|
+
Footer: Re,
|
|
743
|
+
Close: _e
|
|
744
|
+
}), Se = U(null), Me = () => () => {
|
|
745
|
+
}, Oe = () => !0, $e = () => !1;
|
|
746
|
+
function Ae(t) {
|
|
747
|
+
const e = X(Se);
|
|
748
|
+
if (!e)
|
|
749
|
+
throw new Error(`<${t}> must be rendered inside <Tooltip.Root>`);
|
|
750
|
+
return e;
|
|
751
|
+
}
|
|
752
|
+
function Be(t, e) {
|
|
753
|
+
typeof t == "function" ? t(e) : t && (t.current = e);
|
|
754
|
+
}
|
|
755
|
+
function He(t, e) {
|
|
756
|
+
const n = typeof t == "string" ? t.split(/\s+/).filter(Boolean) : [];
|
|
757
|
+
return Array.from(/* @__PURE__ */ new Set([...n, e])).join(" ");
|
|
758
|
+
}
|
|
759
|
+
function P(t, e) {
|
|
760
|
+
return (n) => {
|
|
761
|
+
t?.(n), n.defaultPrevented || e(n);
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
function pt({
|
|
765
|
+
children: t,
|
|
766
|
+
open: e,
|
|
767
|
+
defaultOpen: n,
|
|
768
|
+
onOpenChange: o,
|
|
769
|
+
delayDuration: r = 300,
|
|
770
|
+
closeDelay: s = 80
|
|
771
|
+
}) {
|
|
772
|
+
const i = A(), [c, l] = L(
|
|
773
|
+
null
|
|
774
|
+
), a = D(null), m = D(null), [b, u] = Z({
|
|
775
|
+
value: e,
|
|
776
|
+
defaultValue: n ?? !1,
|
|
777
|
+
onChange: o
|
|
778
|
+
}), h = F(() => {
|
|
779
|
+
a.current !== null && (clearTimeout(a.current), a.current = null);
|
|
780
|
+
}, []), f = F(() => {
|
|
781
|
+
m.current !== null && (clearTimeout(m.current), m.current = null);
|
|
782
|
+
}, []), g = R((d = !1) => {
|
|
783
|
+
if (h(), f(), !b) {
|
|
784
|
+
if (d || r <= 0) {
|
|
785
|
+
u(!0);
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
a.current = setTimeout(() => {
|
|
789
|
+
a.current = null, u(!0);
|
|
790
|
+
}, r);
|
|
791
|
+
}
|
|
792
|
+
}), y = R(() => {
|
|
793
|
+
if (h(), f(), !!b) {
|
|
794
|
+
if (s <= 0) {
|
|
795
|
+
u(!1);
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
m.current = setTimeout(() => {
|
|
799
|
+
m.current = null, u(!1);
|
|
800
|
+
}, s);
|
|
801
|
+
}
|
|
802
|
+
}), T = R(() => {
|
|
803
|
+
h(), f(), u(!1);
|
|
804
|
+
});
|
|
805
|
+
O(() => {
|
|
806
|
+
b ? f() : h();
|
|
807
|
+
}, [f, h, b]), O(
|
|
808
|
+
() => () => {
|
|
809
|
+
h(), f();
|
|
810
|
+
},
|
|
811
|
+
[f, h]
|
|
812
|
+
);
|
|
813
|
+
const w = j(
|
|
814
|
+
() => ({
|
|
815
|
+
open: b,
|
|
816
|
+
triggerElement: c,
|
|
817
|
+
setTriggerElement: l,
|
|
818
|
+
contentId: i,
|
|
819
|
+
requestOpen: g,
|
|
820
|
+
requestClose: y,
|
|
821
|
+
dismiss: T
|
|
822
|
+
}),
|
|
823
|
+
[i, b, T, y, g, c]
|
|
824
|
+
);
|
|
825
|
+
return /* @__PURE__ */ p(Se.Provider, { value: w, children: t });
|
|
826
|
+
}
|
|
827
|
+
function ft({ children: t }) {
|
|
828
|
+
const e = Ae("Tooltip.Trigger"), { setTriggerElement: n } = e;
|
|
829
|
+
if (!W(t))
|
|
830
|
+
throw new Error("<Tooltip.Trigger> expects a single valid React element");
|
|
831
|
+
const o = t, r = o.props, s = r.ref ?? o.ref, i = r.onPointerEnter, c = r.onPointerLeave, l = r.onFocus, a = r.onBlur, m = r.onKeyDown, b = F(
|
|
832
|
+
(u) => {
|
|
833
|
+
Be(s, u), n(u);
|
|
834
|
+
},
|
|
835
|
+
[s, n]
|
|
836
|
+
);
|
|
837
|
+
return q(o, {
|
|
838
|
+
ref: b,
|
|
839
|
+
"aria-describedby": e.open ? He(r["aria-describedby"], e.contentId) : r["aria-describedby"],
|
|
840
|
+
onPointerEnter: P(i, (u) => {
|
|
841
|
+
e.requestOpen(u.pointerType === "touch");
|
|
842
|
+
}),
|
|
843
|
+
onPointerLeave: P(c, (u) => {
|
|
844
|
+
u.pointerType !== "touch" && e.requestClose();
|
|
845
|
+
}),
|
|
846
|
+
onFocus: P(l, () => {
|
|
847
|
+
e.requestOpen();
|
|
848
|
+
}),
|
|
849
|
+
onBlur: P(a, () => {
|
|
850
|
+
e.requestClose();
|
|
851
|
+
}),
|
|
852
|
+
onKeyDown: P(m, (u) => {
|
|
853
|
+
u.key === "Escape" && e.open && (u.preventDefault(), u.stopPropagation(), e.dismiss());
|
|
854
|
+
})
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
function J(t, e, n) {
|
|
858
|
+
return n < e ? e : Math.min(Math.max(t, e), n);
|
|
859
|
+
}
|
|
860
|
+
function ht(t) {
|
|
861
|
+
switch (t) {
|
|
862
|
+
case "top":
|
|
863
|
+
return "bottom";
|
|
864
|
+
case "right":
|
|
865
|
+
return "left";
|
|
866
|
+
case "bottom":
|
|
867
|
+
return "top";
|
|
868
|
+
case "left":
|
|
869
|
+
return "right";
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
function ne(t, e, n, o, r) {
|
|
873
|
+
switch (e) {
|
|
874
|
+
case "top":
|
|
875
|
+
return t.top - r;
|
|
876
|
+
case "right":
|
|
877
|
+
return n - t.right - r;
|
|
878
|
+
case "bottom":
|
|
879
|
+
return o - t.bottom - r;
|
|
880
|
+
case "left":
|
|
881
|
+
return t.left - r;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function me(t, e, n, o, r, s, i) {
|
|
885
|
+
return ne(
|
|
886
|
+
t,
|
|
887
|
+
n,
|
|
888
|
+
r,
|
|
889
|
+
s,
|
|
890
|
+
i
|
|
891
|
+
) >= (n === "top" || n === "bottom" ? e.height : e.width) + o;
|
|
892
|
+
}
|
|
893
|
+
function mt({
|
|
894
|
+
trigger: t,
|
|
895
|
+
tooltip: e,
|
|
896
|
+
side: n,
|
|
897
|
+
align: o,
|
|
898
|
+
sideOffset: r,
|
|
899
|
+
collisionPadding: s,
|
|
900
|
+
avoidCollisions: i,
|
|
901
|
+
viewportWidth: c,
|
|
902
|
+
viewportHeight: l
|
|
903
|
+
}) {
|
|
904
|
+
let a = n;
|
|
905
|
+
if (i && !me(
|
|
906
|
+
t,
|
|
907
|
+
e,
|
|
908
|
+
n,
|
|
909
|
+
r,
|
|
910
|
+
c,
|
|
911
|
+
l,
|
|
912
|
+
s
|
|
913
|
+
)) {
|
|
914
|
+
const y = ht(n), T = me(
|
|
915
|
+
t,
|
|
916
|
+
e,
|
|
917
|
+
y,
|
|
918
|
+
r,
|
|
919
|
+
c,
|
|
920
|
+
l,
|
|
921
|
+
s
|
|
922
|
+
), w = ne(
|
|
923
|
+
t,
|
|
924
|
+
n,
|
|
925
|
+
c,
|
|
926
|
+
l,
|
|
927
|
+
s
|
|
928
|
+
), d = ne(
|
|
929
|
+
t,
|
|
930
|
+
y,
|
|
931
|
+
c,
|
|
932
|
+
l,
|
|
933
|
+
s
|
|
934
|
+
);
|
|
935
|
+
(T || d > w) && (a = y);
|
|
936
|
+
}
|
|
937
|
+
const m = t.left + t.width / 2, b = t.top + t.height / 2;
|
|
938
|
+
let u = 0, h = 0;
|
|
939
|
+
switch (a) {
|
|
940
|
+
case "top":
|
|
941
|
+
case "bottom":
|
|
942
|
+
u = o === "start" ? t.left : o === "end" ? t.right - e.width : m - e.width / 2, h = a === "top" ? t.top - e.height - r : t.bottom + r;
|
|
943
|
+
break;
|
|
944
|
+
case "left":
|
|
945
|
+
case "right":
|
|
946
|
+
u = a === "left" ? t.left - e.width - r : t.right + r, h = o === "start" ? t.top : o === "end" ? t.bottom - e.height : b - e.height / 2;
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
949
|
+
i && (u = J(
|
|
950
|
+
u,
|
|
951
|
+
s,
|
|
952
|
+
c - e.width - s
|
|
953
|
+
), h = J(
|
|
954
|
+
h,
|
|
955
|
+
s,
|
|
956
|
+
l - e.height - s
|
|
957
|
+
));
|
|
958
|
+
const f = 10, g = a === "top" || a === "bottom" ? J(
|
|
959
|
+
m - u,
|
|
960
|
+
f,
|
|
961
|
+
Math.max(f, e.width - f)
|
|
962
|
+
) : J(
|
|
963
|
+
b - h,
|
|
964
|
+
f,
|
|
965
|
+
Math.max(f, e.height - f)
|
|
966
|
+
);
|
|
967
|
+
return { x: u, y: h, side: a, arrowOffset: g };
|
|
968
|
+
}
|
|
969
|
+
function Fe(t, e, {
|
|
970
|
+
side: n,
|
|
971
|
+
align: o,
|
|
972
|
+
sideOffset: r,
|
|
973
|
+
collisionPadding: s,
|
|
974
|
+
avoidCollisions: i
|
|
975
|
+
}) {
|
|
976
|
+
const [c, l] = L(null);
|
|
977
|
+
return re(() => {
|
|
978
|
+
const a = e.current;
|
|
979
|
+
if (!a || !t)
|
|
980
|
+
return;
|
|
981
|
+
const m = () => {
|
|
982
|
+
const u = t.getBoundingClientRect(), h = a.getBoundingClientRect();
|
|
983
|
+
l(
|
|
984
|
+
mt({
|
|
985
|
+
trigger: u,
|
|
986
|
+
tooltip: h,
|
|
987
|
+
side: n,
|
|
988
|
+
align: o,
|
|
989
|
+
sideOffset: r,
|
|
990
|
+
collisionPadding: s,
|
|
991
|
+
avoidCollisions: i,
|
|
992
|
+
viewportWidth: window.innerWidth || document.documentElement.clientWidth,
|
|
993
|
+
viewportHeight: window.innerHeight || document.documentElement.clientHeight
|
|
994
|
+
})
|
|
995
|
+
);
|
|
996
|
+
};
|
|
997
|
+
m(), window.addEventListener("resize", m), window.addEventListener("scroll", m, !0);
|
|
998
|
+
const b = typeof ResizeObserver > "u" ? null : new ResizeObserver(m);
|
|
999
|
+
return b?.observe(t), b?.observe(a), () => {
|
|
1000
|
+
window.removeEventListener("resize", m), window.removeEventListener("scroll", m, !0), b?.disconnect();
|
|
1001
|
+
};
|
|
1002
|
+
}, [
|
|
1003
|
+
o,
|
|
1004
|
+
i,
|
|
1005
|
+
s,
|
|
1006
|
+
e,
|
|
1007
|
+
n,
|
|
1008
|
+
r,
|
|
1009
|
+
t
|
|
1010
|
+
]), c;
|
|
1011
|
+
}
|
|
1012
|
+
function Ve(t, e, n) {
|
|
1013
|
+
O(() => {
|
|
1014
|
+
const o = (i) => {
|
|
1015
|
+
const c = i.target;
|
|
1016
|
+
c instanceof Node && (t.contains(c) || e.current?.contains(c) || n());
|
|
1017
|
+
}, r = () => {
|
|
1018
|
+
document.visibilityState === "hidden" && n();
|
|
1019
|
+
}, s = (i) => {
|
|
1020
|
+
const c = i.target;
|
|
1021
|
+
i.key !== "Escape" || c instanceof Node && t.contains(c) || n();
|
|
1022
|
+
};
|
|
1023
|
+
return document.addEventListener("pointerdown", o, !0), document.addEventListener("visibilitychange", r), document.addEventListener("keydown", s, !0), window.addEventListener("blur", n), () => {
|
|
1024
|
+
document.removeEventListener("pointerdown", o, !0), document.removeEventListener("visibilitychange", r), document.removeEventListener("keydown", s, !0), window.removeEventListener("blur", n);
|
|
1025
|
+
};
|
|
1026
|
+
}, [n, e, t]);
|
|
1027
|
+
}
|
|
1028
|
+
function Ge(t) {
|
|
1029
|
+
switch (t) {
|
|
1030
|
+
case "top":
|
|
1031
|
+
return "center bottom";
|
|
1032
|
+
case "bottom":
|
|
1033
|
+
return "center top";
|
|
1034
|
+
case "left":
|
|
1035
|
+
return "right center";
|
|
1036
|
+
case "right":
|
|
1037
|
+
return "left center";
|
|
1038
|
+
default:
|
|
1039
|
+
return "center";
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
function bt({
|
|
1043
|
+
contentId: t,
|
|
1044
|
+
triggerElement: e,
|
|
1045
|
+
dismiss: n,
|
|
1046
|
+
children: o,
|
|
1047
|
+
className: r,
|
|
1048
|
+
style: s,
|
|
1049
|
+
side: i = "top",
|
|
1050
|
+
align: c = "center",
|
|
1051
|
+
sideOffset: l = 8,
|
|
1052
|
+
collisionPadding: a = 8,
|
|
1053
|
+
avoidCollisions: m = !0,
|
|
1054
|
+
...b
|
|
1055
|
+
}) {
|
|
1056
|
+
const u = D(null), h = V() ?? !1, f = ae(), g = Fe(e, u, {
|
|
1057
|
+
side: i,
|
|
1058
|
+
align: c,
|
|
1059
|
+
sideOffset: l,
|
|
1060
|
+
collisionPadding: a,
|
|
1061
|
+
avoidCollisions: m
|
|
1062
|
+
});
|
|
1063
|
+
Ve(e, u, n);
|
|
1064
|
+
const y = Ge(g?.side ?? i), T = {
|
|
1065
|
+
...s,
|
|
1066
|
+
left: g ? `${g.x}px` : 0,
|
|
1067
|
+
top: g ? `${g.y}px` : 0,
|
|
1068
|
+
visibility: g ? "visible" : "hidden"
|
|
1069
|
+
};
|
|
1070
|
+
return /* @__PURE__ */ p(
|
|
1071
|
+
"div",
|
|
1072
|
+
{
|
|
1073
|
+
...b,
|
|
1074
|
+
ref: u,
|
|
1075
|
+
id: t,
|
|
1076
|
+
role: "tooltip",
|
|
1077
|
+
"data-side": g?.side ?? i,
|
|
1078
|
+
"data-align": c,
|
|
1079
|
+
"data-state": f ? "open" : "closed",
|
|
1080
|
+
"aria-hidden": f ? void 0 : !0,
|
|
1081
|
+
className: I("uk-tooltip", r),
|
|
1082
|
+
style: T,
|
|
1083
|
+
children: /* @__PURE__ */ _(
|
|
1084
|
+
$.div,
|
|
1085
|
+
{
|
|
1086
|
+
className: "uk-tooltip__surface",
|
|
1087
|
+
style: { transformOrigin: y },
|
|
1088
|
+
initial: h ? { opacity: 0 } : { opacity: 0, scale: 0.96 },
|
|
1089
|
+
animate: { opacity: 1, scale: 1 },
|
|
1090
|
+
exit: h ? { opacity: 0 } : { opacity: 0, scale: 0.96 },
|
|
1091
|
+
transition: h ? K : ye,
|
|
1092
|
+
children: [
|
|
1093
|
+
/* @__PURE__ */ p(
|
|
1094
|
+
"span",
|
|
1095
|
+
{
|
|
1096
|
+
className: "uk-tooltip__arrow",
|
|
1097
|
+
"aria-hidden": "true",
|
|
1098
|
+
style: {
|
|
1099
|
+
"--uk-tooltip-arrow-offset": `${g?.arrowOffset ?? 0}px`
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
),
|
|
1103
|
+
o
|
|
1104
|
+
]
|
|
1105
|
+
}
|
|
1106
|
+
)
|
|
1107
|
+
}
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
function gt(t) {
|
|
1111
|
+
const e = Ae("Tooltip.Content"), o = oe(
|
|
1112
|
+
Me,
|
|
1113
|
+
Oe,
|
|
1114
|
+
$e
|
|
1115
|
+
) && e.triggerElement ? e.triggerElement.closest("dialog") ?? document.body : null;
|
|
1116
|
+
return !o || !e.triggerElement ? null : se(
|
|
1117
|
+
/* @__PURE__ */ p(ie, { reducedMotion: "user", children: /* @__PURE__ */ p(z, { children: e.open ? /* @__PURE__ */ p(
|
|
1118
|
+
bt,
|
|
1119
|
+
{
|
|
1120
|
+
contentId: e.contentId,
|
|
1121
|
+
triggerElement: e.triggerElement,
|
|
1122
|
+
dismiss: e.dismiss,
|
|
1123
|
+
...t
|
|
1124
|
+
},
|
|
1125
|
+
"uk-tooltip"
|
|
1126
|
+
) : null }) }),
|
|
1127
|
+
o
|
|
1128
|
+
);
|
|
1129
|
+
}
|
|
1130
|
+
const ze = U(
|
|
1131
|
+
null
|
|
1132
|
+
);
|
|
1133
|
+
function yt(t) {
|
|
1134
|
+
const e = X(ze);
|
|
1135
|
+
if (!e)
|
|
1136
|
+
throw new Error(`<${t}> must be rendered inside <Tooltip.Group>`);
|
|
1137
|
+
return e;
|
|
1138
|
+
}
|
|
1139
|
+
function Tt({
|
|
1140
|
+
activeValue: t,
|
|
1141
|
+
content: e,
|
|
1142
|
+
contentClassName: n,
|
|
1143
|
+
contentId: o,
|
|
1144
|
+
dismiss: r,
|
|
1145
|
+
triggerElement: s,
|
|
1146
|
+
side: i,
|
|
1147
|
+
align: c,
|
|
1148
|
+
sideOffset: l,
|
|
1149
|
+
collisionPadding: a,
|
|
1150
|
+
avoidCollisions: m
|
|
1151
|
+
}) {
|
|
1152
|
+
const b = D(null), u = V() ?? !1, h = ae(), f = Fe(s, b, {
|
|
1153
|
+
side: i,
|
|
1154
|
+
align: c,
|
|
1155
|
+
sideOffset: l,
|
|
1156
|
+
collisionPadding: a,
|
|
1157
|
+
avoidCollisions: m
|
|
1158
|
+
});
|
|
1159
|
+
Ve(s, b, r);
|
|
1160
|
+
const g = {
|
|
1161
|
+
left: f ? `${f.x}px` : 0,
|
|
1162
|
+
top: f ? `${f.y}px` : 0,
|
|
1163
|
+
transformOrigin: Ge(f?.side ?? i),
|
|
1164
|
+
visibility: f ? "visible" : "hidden"
|
|
1165
|
+
};
|
|
1166
|
+
return /* @__PURE__ */ _(
|
|
1167
|
+
$.div,
|
|
1168
|
+
{
|
|
1169
|
+
ref: b,
|
|
1170
|
+
id: o,
|
|
1171
|
+
role: "tooltip",
|
|
1172
|
+
layout: !u,
|
|
1173
|
+
layoutDependency: t,
|
|
1174
|
+
"data-side": f?.side ?? i,
|
|
1175
|
+
"data-align": c,
|
|
1176
|
+
"data-state": h ? "open" : "closed",
|
|
1177
|
+
"aria-hidden": h ? void 0 : !0,
|
|
1178
|
+
className: I(
|
|
1179
|
+
"uk-tooltip",
|
|
1180
|
+
"uk-tooltip__surface",
|
|
1181
|
+
"uk-tooltip--group",
|
|
1182
|
+
n
|
|
1183
|
+
),
|
|
1184
|
+
style: g,
|
|
1185
|
+
initial: u ? { opacity: 0 } : { opacity: 0, scale: 0.96 },
|
|
1186
|
+
animate: { opacity: 1, scale: 1 },
|
|
1187
|
+
exit: u ? { opacity: 0 } : { opacity: 0, scale: 0.96 },
|
|
1188
|
+
transition: u ? { ...K, layout: { duration: 0 } } : Qe,
|
|
1189
|
+
children: [
|
|
1190
|
+
/* @__PURE__ */ p(
|
|
1191
|
+
"span",
|
|
1192
|
+
{
|
|
1193
|
+
className: "uk-tooltip__arrow",
|
|
1194
|
+
"aria-hidden": "true",
|
|
1195
|
+
style: {
|
|
1196
|
+
"--uk-tooltip-arrow-offset": `${f?.arrowOffset ?? 0}px`
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
),
|
|
1200
|
+
/* @__PURE__ */ p(
|
|
1201
|
+
$.div,
|
|
1202
|
+
{
|
|
1203
|
+
className: "uk-tooltip__content",
|
|
1204
|
+
initial: { opacity: 0 },
|
|
1205
|
+
animate: { opacity: 1 },
|
|
1206
|
+
transition: u ? K : ye,
|
|
1207
|
+
children: e
|
|
1208
|
+
},
|
|
1209
|
+
t
|
|
1210
|
+
)
|
|
1211
|
+
]
|
|
1212
|
+
}
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
function vt({
|
|
1216
|
+
children: t,
|
|
1217
|
+
side: e = "top",
|
|
1218
|
+
align: n = "center",
|
|
1219
|
+
sideOffset: o = 8,
|
|
1220
|
+
collisionPadding: r = 8,
|
|
1221
|
+
avoidCollisions: s = !0,
|
|
1222
|
+
delayDuration: i = 180,
|
|
1223
|
+
closeDelay: c = 80,
|
|
1224
|
+
contentClassName: l
|
|
1225
|
+
}) {
|
|
1226
|
+
const a = A(), [m, b] = L(
|
|
1227
|
+
() => /* @__PURE__ */ new Map()
|
|
1228
|
+
), [u, h] = L(!1), [f, g] = L(null), y = D(null), T = D(null), w = oe(
|
|
1229
|
+
Me,
|
|
1230
|
+
Oe,
|
|
1231
|
+
$e
|
|
1232
|
+
), d = F(() => {
|
|
1233
|
+
y.current !== null && (clearTimeout(y.current), y.current = null);
|
|
1234
|
+
}, []), v = F(() => {
|
|
1235
|
+
T.current !== null && (clearTimeout(T.current), T.current = null);
|
|
1236
|
+
}, []), x = R((B, M = !1) => {
|
|
1237
|
+
if (d(), v(), g(B), !u) {
|
|
1238
|
+
if (M || i <= 0) {
|
|
1239
|
+
h(!0);
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
y.current = setTimeout(() => {
|
|
1243
|
+
y.current = null, h(!0);
|
|
1244
|
+
}, i);
|
|
1245
|
+
}
|
|
1246
|
+
}), C = R(() => {
|
|
1247
|
+
if (d(), v(), !!u) {
|
|
1248
|
+
if (c <= 0) {
|
|
1249
|
+
h(!1);
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
T.current = setTimeout(() => {
|
|
1253
|
+
T.current = null, h(!1);
|
|
1254
|
+
}, c);
|
|
1255
|
+
}
|
|
1256
|
+
}), S = R(() => {
|
|
1257
|
+
d(), v(), h(!1);
|
|
1258
|
+
}), N = R(
|
|
1259
|
+
(B, M, G) => {
|
|
1260
|
+
b((ee) => {
|
|
1261
|
+
const ue = ee.get(B);
|
|
1262
|
+
if (ue?.triggerElement === M && Object.is(ue.content, G))
|
|
1263
|
+
return ee;
|
|
1264
|
+
const de = new Map(ee);
|
|
1265
|
+
return de.set(B, { triggerElement: M, content: G }), de;
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
), k = R((B) => {
|
|
1269
|
+
b((M) => {
|
|
1270
|
+
if (!M.has(B))
|
|
1271
|
+
return M;
|
|
1272
|
+
const G = new Map(M);
|
|
1273
|
+
return G.delete(B), G;
|
|
1274
|
+
});
|
|
1275
|
+
});
|
|
1276
|
+
O(
|
|
1277
|
+
() => () => {
|
|
1278
|
+
d(), v();
|
|
1279
|
+
},
|
|
1280
|
+
[v, d]
|
|
1281
|
+
);
|
|
1282
|
+
const Ke = j(
|
|
1283
|
+
() => ({
|
|
1284
|
+
open: u,
|
|
1285
|
+
activeValue: f,
|
|
1286
|
+
contentId: a,
|
|
1287
|
+
activate: x,
|
|
1288
|
+
requestClose: C,
|
|
1289
|
+
dismiss: S,
|
|
1290
|
+
register: N,
|
|
1291
|
+
unregister: k
|
|
1292
|
+
}),
|
|
1293
|
+
[
|
|
1294
|
+
x,
|
|
1295
|
+
f,
|
|
1296
|
+
a,
|
|
1297
|
+
S,
|
|
1298
|
+
u,
|
|
1299
|
+
N,
|
|
1300
|
+
C,
|
|
1301
|
+
k
|
|
1302
|
+
]
|
|
1303
|
+
), H = f ? m.get(f) : void 0, je = u && !!H, le = w && H ? H.triggerElement.closest("dialog") ?? document.body : null;
|
|
1304
|
+
return /* @__PURE__ */ _(ze.Provider, { value: Ke, children: [
|
|
1305
|
+
t,
|
|
1306
|
+
le && H ? se(
|
|
1307
|
+
/* @__PURE__ */ p(ie, { reducedMotion: "user", children: /* @__PURE__ */ p(z, { children: je ? /* @__PURE__ */ p(
|
|
1308
|
+
Tt,
|
|
1309
|
+
{
|
|
1310
|
+
activeValue: f ?? "",
|
|
1311
|
+
content: H.content,
|
|
1312
|
+
contentClassName: l,
|
|
1313
|
+
contentId: a,
|
|
1314
|
+
dismiss: S,
|
|
1315
|
+
triggerElement: H.triggerElement,
|
|
1316
|
+
side: e,
|
|
1317
|
+
align: n,
|
|
1318
|
+
sideOffset: o,
|
|
1319
|
+
collisionPadding: r,
|
|
1320
|
+
avoidCollisions: s
|
|
1321
|
+
},
|
|
1322
|
+
"uk-tooltip-group"
|
|
1323
|
+
) : null }) }),
|
|
1324
|
+
le
|
|
1325
|
+
) : null
|
|
1326
|
+
] });
|
|
1327
|
+
}
|
|
1328
|
+
function wt({
|
|
1329
|
+
value: t,
|
|
1330
|
+
content: e,
|
|
1331
|
+
children: n
|
|
1332
|
+
}) {
|
|
1333
|
+
const o = yt("Tooltip.Item"), { register: r, unregister: s } = o, [i, c] = L(
|
|
1334
|
+
null
|
|
1335
|
+
);
|
|
1336
|
+
if (!W(n))
|
|
1337
|
+
throw new Error("<Tooltip.Item> expects a single valid React element");
|
|
1338
|
+
const l = n, a = l.props, m = a.ref ?? l.ref, b = a.onPointerEnter, u = a.onPointerLeave, h = a.onFocus, f = a.onBlur, g = a.onKeyDown, y = o.open && o.activeValue === t, T = F(
|
|
1339
|
+
(w) => {
|
|
1340
|
+
Be(m, w), c(w);
|
|
1341
|
+
},
|
|
1342
|
+
[m, c]
|
|
1343
|
+
);
|
|
1344
|
+
return re(() => {
|
|
1345
|
+
if (i)
|
|
1346
|
+
return r(t, i, e), () => s(t);
|
|
1347
|
+
}, [e, r, i, s, t]), q(l, {
|
|
1348
|
+
ref: T,
|
|
1349
|
+
"aria-describedby": y ? He(a["aria-describedby"], o.contentId) : a["aria-describedby"],
|
|
1350
|
+
onPointerEnter: P(b, (w) => {
|
|
1351
|
+
o.activate(t, w.pointerType === "touch");
|
|
1352
|
+
}),
|
|
1353
|
+
onPointerLeave: P(u, (w) => {
|
|
1354
|
+
w.pointerType !== "touch" && o.requestClose();
|
|
1355
|
+
}),
|
|
1356
|
+
onFocus: P(h, () => {
|
|
1357
|
+
o.activate(t);
|
|
1358
|
+
}),
|
|
1359
|
+
onBlur: P(f, () => {
|
|
1360
|
+
o.requestClose();
|
|
1361
|
+
}),
|
|
1362
|
+
onKeyDown: P(g, (w) => {
|
|
1363
|
+
w.key === "Escape" && y && (w.preventDefault(), w.stopPropagation(), o.dismiss());
|
|
1364
|
+
})
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
const Lt = {
|
|
1368
|
+
Root: pt,
|
|
1369
|
+
Trigger: ft,
|
|
1370
|
+
Content: gt,
|
|
1371
|
+
Group: vt,
|
|
1372
|
+
Item: wt
|
|
1373
|
+
};
|
|
623
1374
|
export {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
1375
|
+
be as Button,
|
|
1376
|
+
Rt as Dialog,
|
|
1377
|
+
Et as Input,
|
|
1378
|
+
Dt as Sidebar,
|
|
1379
|
+
Pt as Switch,
|
|
1380
|
+
Nt as Tabs,
|
|
1381
|
+
Lt as Tooltip
|
|
629
1382
|
};
|
|
630
1383
|
//# sourceMappingURL=index.js.map
|