react-sxo 0.0.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 +15 -0
- package/dist/components/Accordion.d.ts +15 -0
- package/dist/components/Alert.d.ts +11 -0
- package/dist/components/Avatar.d.ts +9 -0
- package/dist/components/BackTop.d.ts +9 -0
- package/dist/components/Badge.d.ts +5 -0
- package/dist/components/Box.d.ts +23 -0
- package/dist/components/Breadcrumb.d.ts +11 -0
- package/dist/components/Button.d.ts +6 -0
- package/dist/components/Card.d.ts +6 -0
- package/dist/components/Checkbox.d.ts +24 -0
- package/dist/components/CommandPalette.d.ts +8 -0
- package/dist/components/Dialog.d.ts +12 -0
- package/dist/components/Divider.d.ts +6 -0
- package/dist/components/Dropdown.d.ts +19 -0
- package/dist/components/Empty.d.ts +8 -0
- package/dist/components/Form.d.ts +15 -0
- package/dist/components/Icon.d.ts +7 -0
- package/dist/components/Input.d.ts +5 -0
- package/dist/components/Layout.d.ts +28 -0
- package/dist/components/Menu.d.ts +13 -0
- package/dist/components/Pagination.d.ts +12 -0
- package/dist/components/Radio.d.ts +19 -0
- package/dist/components/Result.d.ts +9 -0
- package/dist/components/Search.d.ts +10 -0
- package/dist/components/Select.d.ts +19 -0
- package/dist/components/Slider.d.ts +12 -0
- package/dist/components/Switch.d.ts +10 -0
- package/dist/components/Table.d.ts +5 -0
- package/dist/components/Tabs.d.ts +24 -0
- package/dist/components/Tag.d.ts +7 -0
- package/dist/components/Timeline.d.ts +13 -0
- package/dist/components/Toast.d.ts +5 -0
- package/dist/components/Tooltip.d.ts +9 -0
- package/dist/components/VirtualList.d.ts +9 -0
- package/dist/context.d.ts +8 -0
- package/dist/hooks.d.ts +13 -0
- package/dist/index.cjs +13 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +1000 -0
- package/dist/provider.d.ts +8 -0
- package/package.json +61 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1000 @@
|
|
|
1
|
+
import { resolveToken as W, useAccordion as X, useCheckbox as U, useDialog as F, useDraggable as K, useMenu as q, useRadioGroup as J, useSelect as Q, useToggle as Y, useTabs as Z, useTooltip as _, defaultTokens as ee } from "@sxo/design";
|
|
2
|
+
export * from "@sxo/design";
|
|
3
|
+
import { jsx as a, jsxs as k } from "react/jsx-runtime";
|
|
4
|
+
import { getAccordionClasses as te, getAvatarClasses as se, getBadgeClasses as ne, getButtonClasses as oe, getCardClasses as re, getCheckboxClasses as le, getDialogClasses as ie, getDropdownClasses as S, getInputClasses as ae, getMenuClasses as ce, getPaginationClasses as de, getRadioClasses as ue, getSelectClasses as A, getSliderClasses as me, getSwitchClasses as pe, getTabsClasses as fe, getTagClasses as ge, getTooltipClasses as he } from "@sxo/ui";
|
|
5
|
+
import y, { createContext as j, useContext as E, useMemo as M, useEffect as C, useState as N, useCallback as O, useRef as D } from "react";
|
|
6
|
+
import { Icons as ve } from "@sxo/component-icons";
|
|
7
|
+
import { useTable as $e } from "@sxo/component-table";
|
|
8
|
+
import { StyleEngine as xe } from "@sxo/engine";
|
|
9
|
+
const R = j(void 0);
|
|
10
|
+
function V() {
|
|
11
|
+
const s = E(R);
|
|
12
|
+
if (!s)
|
|
13
|
+
throw new Error("useSxo must be used within a SxoProvider");
|
|
14
|
+
return s;
|
|
15
|
+
}
|
|
16
|
+
function $(s) {
|
|
17
|
+
const { engine: o } = V(), t = M(() => {
|
|
18
|
+
const e = s.split(/\s+/).filter(Boolean);
|
|
19
|
+
return o.generateSheet(e);
|
|
20
|
+
}, [s, o]);
|
|
21
|
+
return C(() => {
|
|
22
|
+
if (t) {
|
|
23
|
+
let e = document.getElementById("sxo-engine");
|
|
24
|
+
e || (e = document.createElement("style"), e.id = "sxo-engine", document.head.appendChild(e)), e.innerHTML.includes(t) || (e.innerHTML += t);
|
|
25
|
+
}
|
|
26
|
+
}, [t]), s;
|
|
27
|
+
}
|
|
28
|
+
function Ce(s) {
|
|
29
|
+
const { tokens: o } = V();
|
|
30
|
+
return M(() => W(o, s), [o, s]);
|
|
31
|
+
}
|
|
32
|
+
function Ee() {
|
|
33
|
+
const { tokens: s } = V(), [o, t] = N("xs"), e = O(() => {
|
|
34
|
+
const n = window.innerWidth, r = Object.entries(s.breakpoints).sort(
|
|
35
|
+
(l, d) => parseInt(d[1]) - parseInt(l[1])
|
|
36
|
+
);
|
|
37
|
+
for (const [l, d] of r)
|
|
38
|
+
if (n >= parseInt(d)) {
|
|
39
|
+
t(l);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
t("xs");
|
|
43
|
+
}, [s.breakpoints]);
|
|
44
|
+
return C(() => (e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e)), [e]), o;
|
|
45
|
+
}
|
|
46
|
+
const z = j(null), Ie = ({
|
|
47
|
+
children: s,
|
|
48
|
+
allowMultiple: o = !1,
|
|
49
|
+
defaultExpanded: t = [],
|
|
50
|
+
variant: e = "bordered",
|
|
51
|
+
className: n = ""
|
|
52
|
+
}) => {
|
|
53
|
+
const [r, l] = N(t), d = (p) => {
|
|
54
|
+
l((m) => m.includes(p) ? m.filter((f) => f !== p) : o ? [...m, p] : [p]);
|
|
55
|
+
}, { getItemProps: u } = X({ allowMultiple: o, defaultExpanded: t }), i = te({ variant: e });
|
|
56
|
+
return $(
|
|
57
|
+
[
|
|
58
|
+
i.root,
|
|
59
|
+
i.trigger,
|
|
60
|
+
i.triggerText,
|
|
61
|
+
i.panel,
|
|
62
|
+
i.item(!0),
|
|
63
|
+
i.item(!1),
|
|
64
|
+
i.icon(!0),
|
|
65
|
+
i.icon(!1),
|
|
66
|
+
n
|
|
67
|
+
].filter(Boolean).join(" ")
|
|
68
|
+
), /* @__PURE__ */ a(z.Provider, { value: { expandedItems: r, toggleItem: d, getItemProps: u, styles: i }, children: /* @__PURE__ */ a("div", { className: `${i.root} ${n}`.trim(), children: s }) });
|
|
69
|
+
}, Be = ({ value: s, title: o, children: t, className: e = "" }) => {
|
|
70
|
+
const n = E(z);
|
|
71
|
+
if (!n) throw new Error("AccordionItem must be used within Accordion");
|
|
72
|
+
const r = n.expandedItems.includes(s), { triggerProps: l, panelProps: d } = n.getItemProps(s, n.toggleItem);
|
|
73
|
+
return /* @__PURE__ */ k("div", { className: `${n.styles.item(r)} ${e}`.trim(), children: [
|
|
74
|
+
/* @__PURE__ */ k("button", { ...l, className: n.styles.trigger, children: [
|
|
75
|
+
/* @__PURE__ */ a("span", { className: n.styles.triggerText, children: o }),
|
|
76
|
+
/* @__PURE__ */ a(
|
|
77
|
+
"svg",
|
|
78
|
+
{
|
|
79
|
+
className: n.styles.icon(r),
|
|
80
|
+
width: "16",
|
|
81
|
+
height: "16",
|
|
82
|
+
viewBox: "0 0 24 24",
|
|
83
|
+
fill: "none",
|
|
84
|
+
stroke: "currentColor",
|
|
85
|
+
strokeWidth: "2",
|
|
86
|
+
strokeLinecap: "round",
|
|
87
|
+
strokeLinejoin: "round",
|
|
88
|
+
children: /* @__PURE__ */ a("path", { d: "m6 9 6 6 6-6" })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ a("div", { ...d, className: n.styles.panel, children: t })
|
|
93
|
+
] });
|
|
94
|
+
}, je = ({
|
|
95
|
+
src: s,
|
|
96
|
+
alt: o,
|
|
97
|
+
fallback: t,
|
|
98
|
+
size: e = "md",
|
|
99
|
+
shape: n = "circle",
|
|
100
|
+
className: r = ""
|
|
101
|
+
}) => {
|
|
102
|
+
const l = se({ size: e, shape: n });
|
|
103
|
+
return $([l.root, l.image, l.fallback, r].filter(Boolean).join(" ")), /* @__PURE__ */ a("div", { className: `${l.root} ${r}`.trim(), children: s ? /* @__PURE__ */ a("img", { src: s, alt: o, className: l.image }) : /* @__PURE__ */ a("span", { className: l.fallback, children: t || (o == null ? void 0 : o.charAt(0)) || "?" }) });
|
|
104
|
+
}, Le = ({
|
|
105
|
+
variant: s = "primary",
|
|
106
|
+
className: o = "",
|
|
107
|
+
children: t,
|
|
108
|
+
...e
|
|
109
|
+
}) => {
|
|
110
|
+
const n = ne({ variant: s }), r = $(`${n} ${o}`.trim());
|
|
111
|
+
return /* @__PURE__ */ a("span", { className: r, ...e, children: t });
|
|
112
|
+
}, Me = ({
|
|
113
|
+
as: s = "div",
|
|
114
|
+
className: o = "",
|
|
115
|
+
children: t,
|
|
116
|
+
...e
|
|
117
|
+
}) => {
|
|
118
|
+
const n = {
|
|
119
|
+
p: "p",
|
|
120
|
+
padding: "p",
|
|
121
|
+
m: "m",
|
|
122
|
+
margin: "m",
|
|
123
|
+
bg: "bg",
|
|
124
|
+
text: "text",
|
|
125
|
+
rounded: "rounded",
|
|
126
|
+
shadow: "shadow",
|
|
127
|
+
w: "w",
|
|
128
|
+
h: "h",
|
|
129
|
+
display: "",
|
|
130
|
+
flex: "flex",
|
|
131
|
+
grid: "grid"
|
|
132
|
+
}, r = [o], l = {};
|
|
133
|
+
for (const [u, i] of Object.entries(e))
|
|
134
|
+
if (u in n) {
|
|
135
|
+
const p = n[u];
|
|
136
|
+
p ? r.push(`${p}-${i}`) : r.push(String(i));
|
|
137
|
+
} else
|
|
138
|
+
l[u] = i;
|
|
139
|
+
const d = $(r.filter(Boolean).join(" "));
|
|
140
|
+
return y.createElement(
|
|
141
|
+
s,
|
|
142
|
+
{
|
|
143
|
+
className: d,
|
|
144
|
+
...l
|
|
145
|
+
},
|
|
146
|
+
t
|
|
147
|
+
);
|
|
148
|
+
}, Ve = ({
|
|
149
|
+
variant: s,
|
|
150
|
+
size: o,
|
|
151
|
+
disabled: t,
|
|
152
|
+
rounded: e,
|
|
153
|
+
className: n,
|
|
154
|
+
children: r,
|
|
155
|
+
...l
|
|
156
|
+
}) => {
|
|
157
|
+
const d = oe({ variant: s, size: o, disabled: t, rounded: e }), u = $(`${d} ${n || ""}`);
|
|
158
|
+
return y.createElement(
|
|
159
|
+
"button",
|
|
160
|
+
{
|
|
161
|
+
className: u,
|
|
162
|
+
disabled: t,
|
|
163
|
+
...l
|
|
164
|
+
},
|
|
165
|
+
r
|
|
166
|
+
);
|
|
167
|
+
}, Se = ({
|
|
168
|
+
variant: s,
|
|
169
|
+
padding: o,
|
|
170
|
+
interactive: t,
|
|
171
|
+
rounded: e,
|
|
172
|
+
className: n,
|
|
173
|
+
children: r,
|
|
174
|
+
...l
|
|
175
|
+
}) => {
|
|
176
|
+
const d = re({ variant: s, padding: o, interactive: t, rounded: e }), u = $(`${d} ${n || ""}`);
|
|
177
|
+
return y.createElement(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
className: u,
|
|
181
|
+
...l
|
|
182
|
+
},
|
|
183
|
+
r
|
|
184
|
+
);
|
|
185
|
+
}, G = j(
|
|
186
|
+
null
|
|
187
|
+
), Ae = ({
|
|
188
|
+
value: s,
|
|
189
|
+
defaultValue: o = [],
|
|
190
|
+
onChange: t,
|
|
191
|
+
direction: e = "col",
|
|
192
|
+
gap: n = 2,
|
|
193
|
+
size: r = "md",
|
|
194
|
+
color: l = "primary",
|
|
195
|
+
children: d,
|
|
196
|
+
className: u = ""
|
|
197
|
+
}) => {
|
|
198
|
+
const [i, p] = N(o), m = s !== void 0, f = m ? s : i, g = (h) => {
|
|
199
|
+
const c = f.includes(h) ? f.filter((v) => v !== h) : [...f, h];
|
|
200
|
+
m || p(c), t == null || t(c);
|
|
201
|
+
};
|
|
202
|
+
return /* @__PURE__ */ a(
|
|
203
|
+
G.Provider,
|
|
204
|
+
{
|
|
205
|
+
value: { value: f, toggleValue: g, size: r, color: l },
|
|
206
|
+
children: /* @__PURE__ */ a("div", { className: `flex flex-${e} gap-${n} ${u}`.trim(), children: d })
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}, Oe = ({
|
|
210
|
+
checked: s,
|
|
211
|
+
defaultChecked: o = !1,
|
|
212
|
+
value: t,
|
|
213
|
+
disabled: e = !1,
|
|
214
|
+
onChange: n,
|
|
215
|
+
size: r,
|
|
216
|
+
color: l,
|
|
217
|
+
children: d,
|
|
218
|
+
className: u = ""
|
|
219
|
+
}) => {
|
|
220
|
+
const i = E(G), [p, m] = N(o), f = s !== void 0, g = i ? i.value.includes(t) : f ? s : p, h = r || (i == null ? void 0 : i.size) || "md", c = l || (i == null ? void 0 : i.color) || "primary", { getInputProps: v, getLabelProps: w } = U({
|
|
221
|
+
defaultChecked: g,
|
|
222
|
+
disabled: e
|
|
223
|
+
}), x = le(g, {
|
|
224
|
+
size: h,
|
|
225
|
+
color: c,
|
|
226
|
+
disabled: e
|
|
227
|
+
});
|
|
228
|
+
$([x.root, x.icon, u].filter(Boolean).join(" "));
|
|
229
|
+
const b = () => {
|
|
230
|
+
if (e) return;
|
|
231
|
+
const P = !g;
|
|
232
|
+
i && t !== void 0 ? i.toggleValue(t) : f || m(P), n == null || n(P);
|
|
233
|
+
};
|
|
234
|
+
return /* @__PURE__ */ k(
|
|
235
|
+
"label",
|
|
236
|
+
{
|
|
237
|
+
...w(),
|
|
238
|
+
className: `inline-flex items-center gap-2 cursor-pointer ${e ? "opacity-50 cursor-not-allowed" : ""} ${u}`.trim(),
|
|
239
|
+
children: [
|
|
240
|
+
/* @__PURE__ */ k("div", { className: x.root, onClick: b, children: [
|
|
241
|
+
/* @__PURE__ */ a("input", { ...v(), className: "sr-only", readOnly: !0 }),
|
|
242
|
+
/* @__PURE__ */ a(
|
|
243
|
+
"svg",
|
|
244
|
+
{
|
|
245
|
+
className: x.icon,
|
|
246
|
+
width: "12",
|
|
247
|
+
height: "12",
|
|
248
|
+
viewBox: "0 0 12 12",
|
|
249
|
+
fill: "none",
|
|
250
|
+
stroke: "currentColor",
|
|
251
|
+
strokeWidth: "2",
|
|
252
|
+
strokeLinecap: "round",
|
|
253
|
+
strokeLinejoin: "round",
|
|
254
|
+
children: /* @__PURE__ */ a("polyline", { points: "2 6 5 9 10 3" })
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] }),
|
|
258
|
+
d && /* @__PURE__ */ a("span", { className: "text-sm select-none", children: d })
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
}, De = ({
|
|
263
|
+
isOpen: s,
|
|
264
|
+
onClose: o,
|
|
265
|
+
title: t,
|
|
266
|
+
description: e,
|
|
267
|
+
children: n,
|
|
268
|
+
footer: r,
|
|
269
|
+
size: l,
|
|
270
|
+
isCentered: d,
|
|
271
|
+
isDraggable: u = !1
|
|
272
|
+
}) => {
|
|
273
|
+
const [i, p] = N({ x: 0, y: 0 }), { getDialogProps: m, getOverlayProps: f, getCloseButtonProps: g } = F({
|
|
274
|
+
isOpen: s,
|
|
275
|
+
onClose: o
|
|
276
|
+
}), { getDragProps: h } = K({
|
|
277
|
+
onDrag: (v) => {
|
|
278
|
+
p({ x: v.x, y: v.y });
|
|
279
|
+
}
|
|
280
|
+
}), c = ie({ size: l, isCentered: d });
|
|
281
|
+
return $(Object.values(c).join(" ")), s ? y.createElement("div", { className: c.container }, [
|
|
282
|
+
// 遮罩层
|
|
283
|
+
y.createElement("div", {
|
|
284
|
+
key: "overlay",
|
|
285
|
+
...f(),
|
|
286
|
+
className: c.overlay
|
|
287
|
+
}),
|
|
288
|
+
// 内容层
|
|
289
|
+
y.createElement(
|
|
290
|
+
"div",
|
|
291
|
+
{
|
|
292
|
+
key: "content",
|
|
293
|
+
...m(),
|
|
294
|
+
className: c.content,
|
|
295
|
+
style: {
|
|
296
|
+
transform: `translate(${i.x}px, ${i.y}px)`
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
[
|
|
300
|
+
// 关闭按钮
|
|
301
|
+
y.createElement(
|
|
302
|
+
"button",
|
|
303
|
+
{
|
|
304
|
+
key: "close",
|
|
305
|
+
...g(),
|
|
306
|
+
className: c.closeButton
|
|
307
|
+
},
|
|
308
|
+
"✕"
|
|
309
|
+
),
|
|
310
|
+
// 头部
|
|
311
|
+
y.createElement(
|
|
312
|
+
"div",
|
|
313
|
+
{
|
|
314
|
+
key: "header",
|
|
315
|
+
className: c.header,
|
|
316
|
+
...u ? h() : {}
|
|
317
|
+
},
|
|
318
|
+
[
|
|
319
|
+
t && y.createElement(
|
|
320
|
+
"h2",
|
|
321
|
+
{ key: "title", className: c.title },
|
|
322
|
+
t
|
|
323
|
+
),
|
|
324
|
+
e && y.createElement(
|
|
325
|
+
"p",
|
|
326
|
+
{ key: "desc", className: c.description },
|
|
327
|
+
e
|
|
328
|
+
)
|
|
329
|
+
]
|
|
330
|
+
),
|
|
331
|
+
// 内容
|
|
332
|
+
y.createElement("div", { key: "body", className: "dialog-body" }, n),
|
|
333
|
+
// 底部
|
|
334
|
+
r && y.createElement("div", { key: "footer", className: c.footer }, r)
|
|
335
|
+
]
|
|
336
|
+
)
|
|
337
|
+
]) : null;
|
|
338
|
+
}, Re = ({
|
|
339
|
+
disabled: s = !1,
|
|
340
|
+
active: o = !1,
|
|
341
|
+
divider: t = !1,
|
|
342
|
+
header: e = "",
|
|
343
|
+
children: n,
|
|
344
|
+
className: r = "",
|
|
345
|
+
onClick: l
|
|
346
|
+
}) => {
|
|
347
|
+
const d = S();
|
|
348
|
+
return t ? /* @__PURE__ */ a("div", { className: d.divider }) : e ? /* @__PURE__ */ a("div", { className: d.header, children: e }) : /* @__PURE__ */ a(
|
|
349
|
+
"div",
|
|
350
|
+
{
|
|
351
|
+
className: [
|
|
352
|
+
d.item,
|
|
353
|
+
o && d.itemActive,
|
|
354
|
+
s && d.itemDisabled,
|
|
355
|
+
r
|
|
356
|
+
].filter(Boolean).join(" "),
|
|
357
|
+
onClick: (u) => {
|
|
358
|
+
s || l == null || l(u);
|
|
359
|
+
},
|
|
360
|
+
children: n
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
}, ze = ({
|
|
364
|
+
trigger: s = "click",
|
|
365
|
+
placement: o = "bottom-left",
|
|
366
|
+
overlay: t,
|
|
367
|
+
children: e,
|
|
368
|
+
className: n = ""
|
|
369
|
+
}) => {
|
|
370
|
+
const [r, l] = N(!1), d = D(null), u = S({ placement: o });
|
|
371
|
+
$(
|
|
372
|
+
[
|
|
373
|
+
u.container,
|
|
374
|
+
u.menu,
|
|
375
|
+
u.item,
|
|
376
|
+
u.itemActive,
|
|
377
|
+
u.itemDisabled,
|
|
378
|
+
u.divider,
|
|
379
|
+
u.header,
|
|
380
|
+
n
|
|
381
|
+
].filter(Boolean).join(" ")
|
|
382
|
+
);
|
|
383
|
+
const i = () => l((g) => !g), p = () => l(!0), m = () => l(!1);
|
|
384
|
+
C(() => {
|
|
385
|
+
if (s === "click") {
|
|
386
|
+
const g = (h) => {
|
|
387
|
+
d.current && !d.current.contains(h.target) && m();
|
|
388
|
+
};
|
|
389
|
+
return window.addEventListener("click", g), () => window.removeEventListener("click", g);
|
|
390
|
+
}
|
|
391
|
+
}, [s]);
|
|
392
|
+
const f = {};
|
|
393
|
+
return s === "hover" ? (f.onMouseEnter = p, f.onMouseLeave = m) : f.onClick = (g) => {
|
|
394
|
+
g.stopPropagation(), i();
|
|
395
|
+
}, /* @__PURE__ */ k(
|
|
396
|
+
"div",
|
|
397
|
+
{
|
|
398
|
+
ref: d,
|
|
399
|
+
className: `${u.container} ${n}`.trim(),
|
|
400
|
+
...f,
|
|
401
|
+
children: [
|
|
402
|
+
e,
|
|
403
|
+
r && /* @__PURE__ */ a("div", { className: u.menu, onClick: (g) => g.stopPropagation(), children: t })
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}, Ge = ({
|
|
408
|
+
name: s,
|
|
409
|
+
size: o = "1em",
|
|
410
|
+
color: t = "currentColor",
|
|
411
|
+
strokeWidth: e = 2,
|
|
412
|
+
className: n = "",
|
|
413
|
+
style: r
|
|
414
|
+
}) => {
|
|
415
|
+
const l = ve[s];
|
|
416
|
+
return $(n), /* @__PURE__ */ a(
|
|
417
|
+
"svg",
|
|
418
|
+
{
|
|
419
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
420
|
+
width: o,
|
|
421
|
+
height: o,
|
|
422
|
+
viewBox: "0 0 24 24",
|
|
423
|
+
fill: "none",
|
|
424
|
+
stroke: t,
|
|
425
|
+
strokeWidth: e,
|
|
426
|
+
strokeLinecap: "round",
|
|
427
|
+
strokeLinejoin: "round",
|
|
428
|
+
className: n,
|
|
429
|
+
style: { display: "inline-block", verticalAlign: "middle", ...r },
|
|
430
|
+
children: /* @__PURE__ */ a("path", { d: l })
|
|
431
|
+
}
|
|
432
|
+
);
|
|
433
|
+
}, He = ({
|
|
434
|
+
variant: s = "outline",
|
|
435
|
+
size: o = "md",
|
|
436
|
+
invalid: t = !1,
|
|
437
|
+
className: e = "",
|
|
438
|
+
...n
|
|
439
|
+
}) => {
|
|
440
|
+
const r = ae({ variant: s, size: o, invalid: t }), l = $(`${r} ${e}`.trim());
|
|
441
|
+
return /* @__PURE__ */ a("input", { className: l, ...n });
|
|
442
|
+
};
|
|
443
|
+
function T(s, o) {
|
|
444
|
+
if (s === void 0) return [];
|
|
445
|
+
if (typeof s != "object" || Array.isArray(s))
|
|
446
|
+
return [`${o}-${s}`];
|
|
447
|
+
const t = [], e = s;
|
|
448
|
+
return e.base !== void 0 && t.push(`${o}-${e.base}`), e.sm !== void 0 && t.push(`sm:${o}-${e.sm}`), e.md !== void 0 && t.push(`md:${o}-${e.md}`), e.lg !== void 0 && t.push(`lg:${o}-${e.lg}`), e.xl !== void 0 && t.push(`xl:${o}-${e.xl}`), e["2xl"] !== void 0 && t.push(`2xl:${o}-${e["2xl"]}`), t;
|
|
449
|
+
}
|
|
450
|
+
const We = ({
|
|
451
|
+
direction: s = "col",
|
|
452
|
+
gap: o = 4,
|
|
453
|
+
align: t = "stretch",
|
|
454
|
+
justify: e = "start",
|
|
455
|
+
wrap: n = !1,
|
|
456
|
+
className: r = "",
|
|
457
|
+
children: l,
|
|
458
|
+
...d
|
|
459
|
+
}) => {
|
|
460
|
+
const u = [
|
|
461
|
+
"flex",
|
|
462
|
+
...T(s, "flex"),
|
|
463
|
+
...T(o, "gap"),
|
|
464
|
+
...T(t, "items"),
|
|
465
|
+
...T(e, "justify"),
|
|
466
|
+
...typeof n == "boolean" ? [n ? "flex-wrap" : "flex-nowrap"] : T(n, "flex").map(
|
|
467
|
+
(i) => i.includes("true") ? i.replace("-true", "-wrap") : i.replace("-false", "-nowrap")
|
|
468
|
+
),
|
|
469
|
+
r
|
|
470
|
+
].filter(Boolean).join(" ");
|
|
471
|
+
return $(u), /* @__PURE__ */ a("div", { className: u, ...d, children: l });
|
|
472
|
+
}, Xe = ({
|
|
473
|
+
cols: s = 1,
|
|
474
|
+
rows: o,
|
|
475
|
+
gap: t = 4,
|
|
476
|
+
className: e = "",
|
|
477
|
+
children: n,
|
|
478
|
+
...r
|
|
479
|
+
}) => {
|
|
480
|
+
const l = [
|
|
481
|
+
"grid",
|
|
482
|
+
...T(s, "grid-cols"),
|
|
483
|
+
...T(o, "grid-rows"),
|
|
484
|
+
...T(t, "gap"),
|
|
485
|
+
e
|
|
486
|
+
].filter(Boolean).join(" ");
|
|
487
|
+
return $(l), /* @__PURE__ */ a("div", { className: l, ...r, children: n });
|
|
488
|
+
}, Ue = ({
|
|
489
|
+
center: s = !0,
|
|
490
|
+
className: o = "",
|
|
491
|
+
children: t,
|
|
492
|
+
...e
|
|
493
|
+
}) => {
|
|
494
|
+
const n = ["container", s ? "mx-auto" : "", o].filter(Boolean).join(" ");
|
|
495
|
+
return $(n), /* @__PURE__ */ a("div", { className: n, ...e, children: t });
|
|
496
|
+
}, Fe = ({
|
|
497
|
+
label: s,
|
|
498
|
+
items: o,
|
|
499
|
+
variant: t = "default",
|
|
500
|
+
className: e = ""
|
|
501
|
+
}) => {
|
|
502
|
+
const [n, r] = N(!1), { getMenuProps: l, getItemProps: d, getButtonProps: u } = q({
|
|
503
|
+
isOpen: n,
|
|
504
|
+
id: "sxo-menu"
|
|
505
|
+
}), i = ce({ variant: t });
|
|
506
|
+
$(`${Object.values(i).join(" ")} ${e}`);
|
|
507
|
+
const p = () => r(!n);
|
|
508
|
+
return /* @__PURE__ */ k("div", { className: `${i.container} ${e}`.trim(), children: [
|
|
509
|
+
/* @__PURE__ */ a("button", { ...u(), className: i.button, onClick: p, children: s }),
|
|
510
|
+
n && /* @__PURE__ */ a("div", { ...l(), className: i.items, children: /* @__PURE__ */ a("div", { className: i.section, children: o.map((m) => /* @__PURE__ */ a(
|
|
511
|
+
"button",
|
|
512
|
+
{
|
|
513
|
+
...d(m.id),
|
|
514
|
+
className: i.item,
|
|
515
|
+
onClick: () => {
|
|
516
|
+
var f;
|
|
517
|
+
(f = m.onClick) == null || f.call(m), r(!1);
|
|
518
|
+
},
|
|
519
|
+
children: m.label
|
|
520
|
+
},
|
|
521
|
+
m.id
|
|
522
|
+
)) }) })
|
|
523
|
+
] });
|
|
524
|
+
}, Ke = ({
|
|
525
|
+
total: s,
|
|
526
|
+
pageSize: o,
|
|
527
|
+
current: t,
|
|
528
|
+
onChange: e,
|
|
529
|
+
className: n = "",
|
|
530
|
+
size: r = "md",
|
|
531
|
+
variant: l = "outline",
|
|
532
|
+
rounded: d = !0,
|
|
533
|
+
showTotal: u = !1,
|
|
534
|
+
showJumper: i = !1
|
|
535
|
+
}) => {
|
|
536
|
+
const p = Math.ceil(s / o), m = de({
|
|
537
|
+
size: r,
|
|
538
|
+
variant: l,
|
|
539
|
+
rounded: d
|
|
540
|
+
});
|
|
541
|
+
$(
|
|
542
|
+
`${m.container} ${m.item} ${m.active} ${m.disabled} ${m.ellipsis} ${n}`
|
|
543
|
+
);
|
|
544
|
+
const f = (c) => {
|
|
545
|
+
c < 1 || c > p || c === t || e == null || e(c);
|
|
546
|
+
}, g = (c) => /* @__PURE__ */ a(
|
|
547
|
+
"li",
|
|
548
|
+
{
|
|
549
|
+
className: `${m.item} ${t === c ? m.active : ""}`.trim(),
|
|
550
|
+
onClick: () => f(c),
|
|
551
|
+
children: c
|
|
552
|
+
},
|
|
553
|
+
c
|
|
554
|
+
), h = () => {
|
|
555
|
+
const c = [];
|
|
556
|
+
if (c.push(
|
|
557
|
+
/* @__PURE__ */ a(
|
|
558
|
+
"li",
|
|
559
|
+
{
|
|
560
|
+
className: `${m.item} ${t === 1 ? m.disabled : ""}`.trim(),
|
|
561
|
+
onClick: () => f(t - 1),
|
|
562
|
+
children: "<"
|
|
563
|
+
},
|
|
564
|
+
"prev"
|
|
565
|
+
)
|
|
566
|
+
), p <= 7)
|
|
567
|
+
for (let v = 1; v <= p; v++)
|
|
568
|
+
c.push(g(v));
|
|
569
|
+
else {
|
|
570
|
+
c.push(g(1)), t > 4 && c.push(
|
|
571
|
+
/* @__PURE__ */ a("li", { className: m.ellipsis, children: "..." }, "ellipsis-prev")
|
|
572
|
+
);
|
|
573
|
+
const v = Math.max(2, t - 2), w = Math.min(p - 1, t + 2);
|
|
574
|
+
for (let x = v; x <= w; x++)
|
|
575
|
+
c.push(g(x));
|
|
576
|
+
t < p - 3 && c.push(
|
|
577
|
+
/* @__PURE__ */ a("li", { className: m.ellipsis, children: "..." }, "ellipsis-next")
|
|
578
|
+
), c.push(g(p));
|
|
579
|
+
}
|
|
580
|
+
return c.push(
|
|
581
|
+
/* @__PURE__ */ a(
|
|
582
|
+
"li",
|
|
583
|
+
{
|
|
584
|
+
className: `${m.item} ${t === p ? m.disabled : ""}`.trim(),
|
|
585
|
+
onClick: () => f(t + 1),
|
|
586
|
+
children: ">"
|
|
587
|
+
},
|
|
588
|
+
"next"
|
|
589
|
+
)
|
|
590
|
+
), c;
|
|
591
|
+
};
|
|
592
|
+
return /* @__PURE__ */ k("nav", { className: `${m.container} ${n}`.trim(), children: [
|
|
593
|
+
u && /* @__PURE__ */ k("span", { className: m.total, children: [
|
|
594
|
+
"Total ",
|
|
595
|
+
s
|
|
596
|
+
] }),
|
|
597
|
+
/* @__PURE__ */ a("ul", { className: "flex items-center gap-1 list-none p-0 m-0", children: h() }),
|
|
598
|
+
i && /* @__PURE__ */ k("div", { className: m.jumper, children: [
|
|
599
|
+
"Go to",
|
|
600
|
+
/* @__PURE__ */ a(
|
|
601
|
+
"input",
|
|
602
|
+
{
|
|
603
|
+
className: "w-12 h-8 px-2 border rounded text-center outline-none focus:border-primary-500",
|
|
604
|
+
type: "number",
|
|
605
|
+
onKeyUp: (c) => {
|
|
606
|
+
if (c.key === "Enter") {
|
|
607
|
+
const v = parseInt(c.target.value);
|
|
608
|
+
isNaN(v) || f(v);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
)
|
|
613
|
+
] })
|
|
614
|
+
] });
|
|
615
|
+
}, H = j(null), qe = ({
|
|
616
|
+
value: s,
|
|
617
|
+
defaultValue: o = "",
|
|
618
|
+
onChange: t,
|
|
619
|
+
name: e,
|
|
620
|
+
size: n = "md",
|
|
621
|
+
color: r = "primary",
|
|
622
|
+
children: l,
|
|
623
|
+
className: d = ""
|
|
624
|
+
}) => {
|
|
625
|
+
const [u, i] = N(o), p = s !== void 0, m = p ? s : u, { value: f, setValue: g } = J({
|
|
626
|
+
defaultValue: m,
|
|
627
|
+
name: e
|
|
628
|
+
}), h = (c) => {
|
|
629
|
+
p || i(c), t == null || t(c);
|
|
630
|
+
};
|
|
631
|
+
return /* @__PURE__ */ a(
|
|
632
|
+
H.Provider,
|
|
633
|
+
{
|
|
634
|
+
value: { value: m, onChange: h, name: e, size: n, color: r },
|
|
635
|
+
children: /* @__PURE__ */ a("div", { className: `flex flex-col gap-2 ${d}`.trim(), children: l })
|
|
636
|
+
}
|
|
637
|
+
);
|
|
638
|
+
}, Je = ({
|
|
639
|
+
value: s,
|
|
640
|
+
children: o,
|
|
641
|
+
className: t = "",
|
|
642
|
+
...e
|
|
643
|
+
}) => {
|
|
644
|
+
const n = E(H);
|
|
645
|
+
if (!n) throw new Error("Radio must be used within RadioGroup");
|
|
646
|
+
const r = n.value === s, l = e.size || n.size || "md", d = e.color || n.color || "primary", u = ue(r, { size: l, color: d });
|
|
647
|
+
return $([u.root, u.inner, t].filter(Boolean).join(" ")), /* @__PURE__ */ k("label", { className: `inline-flex items-center gap-2 cursor-pointer ${t}`.trim(), children: [
|
|
648
|
+
/* @__PURE__ */ k("div", { className: u.root, onClick: () => n.onChange(s), children: [
|
|
649
|
+
/* @__PURE__ */ a(
|
|
650
|
+
"input",
|
|
651
|
+
{
|
|
652
|
+
type: "radio",
|
|
653
|
+
name: n.name,
|
|
654
|
+
value: s,
|
|
655
|
+
checked: r,
|
|
656
|
+
className: "sr-only",
|
|
657
|
+
readOnly: !0
|
|
658
|
+
}
|
|
659
|
+
),
|
|
660
|
+
/* @__PURE__ */ a("div", { className: u.inner })
|
|
661
|
+
] }),
|
|
662
|
+
o && /* @__PURE__ */ a("span", { className: "text-sm select-none", children: o })
|
|
663
|
+
] });
|
|
664
|
+
}, Qe = ({
|
|
665
|
+
value: s,
|
|
666
|
+
defaultValue: o = "",
|
|
667
|
+
onChange: t,
|
|
668
|
+
placeholder: e = "Select an option",
|
|
669
|
+
size: n = "md",
|
|
670
|
+
disabled: r = !1,
|
|
671
|
+
children: l,
|
|
672
|
+
className: d = ""
|
|
673
|
+
}) => {
|
|
674
|
+
const [u, i] = N(o), p = s !== void 0, m = p ? s : u, { isOpen: f, value: g, setValue: h, getTriggerProps: c, getListboxProps: v } = Q({
|
|
675
|
+
defaultValue: m,
|
|
676
|
+
disabled: r
|
|
677
|
+
}), w = A(f, { size: n, disabled: r });
|
|
678
|
+
$(`${w.trigger} ${w.listbox} ${w.option} ${d}`);
|
|
679
|
+
const x = (b) => {
|
|
680
|
+
r || (p || i(b), h(b), t == null || t(b));
|
|
681
|
+
};
|
|
682
|
+
return /* @__PURE__ */ k("div", { className: `relative inline-block w-full ${d}`.trim(), children: [
|
|
683
|
+
/* @__PURE__ */ k(
|
|
684
|
+
"div",
|
|
685
|
+
{
|
|
686
|
+
...c(),
|
|
687
|
+
className: `${w.trigger} ${r ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
688
|
+
children: [
|
|
689
|
+
/* @__PURE__ */ a("span", { className: m ? "text-foreground" : "text-neutral-400", children: m || e }),
|
|
690
|
+
/* @__PURE__ */ a(
|
|
691
|
+
"svg",
|
|
692
|
+
{
|
|
693
|
+
className: `transition-transform duration-200 ${f ? "rotate-180" : ""}`,
|
|
694
|
+
width: "16",
|
|
695
|
+
height: "16",
|
|
696
|
+
viewBox: "0 0 24 24",
|
|
697
|
+
fill: "none",
|
|
698
|
+
stroke: "currentColor",
|
|
699
|
+
strokeWidth: "2",
|
|
700
|
+
children: /* @__PURE__ */ a("polyline", { points: "6 9 12 15 18 9" })
|
|
701
|
+
}
|
|
702
|
+
)
|
|
703
|
+
]
|
|
704
|
+
}
|
|
705
|
+
),
|
|
706
|
+
/* @__PURE__ */ a("div", { ...v(), className: w.listbox, children: y.Children.map(l, (b) => y.isValidElement(b) ? y.cloneElement(b, {
|
|
707
|
+
onSelect: x,
|
|
708
|
+
isSelected: m === b.props.value
|
|
709
|
+
}) : b) })
|
|
710
|
+
] });
|
|
711
|
+
}, Ye = ({
|
|
712
|
+
value: s,
|
|
713
|
+
children: o,
|
|
714
|
+
onSelect: t,
|
|
715
|
+
isSelected: e
|
|
716
|
+
}) => {
|
|
717
|
+
const n = A(!1);
|
|
718
|
+
return /* @__PURE__ */ a(
|
|
719
|
+
"div",
|
|
720
|
+
{
|
|
721
|
+
className: `${n.option} ${e ? "bg-primary/10 text-primary font-medium" : ""}`,
|
|
722
|
+
onClick: () => t == null ? void 0 : t(s),
|
|
723
|
+
children: o
|
|
724
|
+
}
|
|
725
|
+
);
|
|
726
|
+
}, Ze = ({
|
|
727
|
+
value: s,
|
|
728
|
+
defaultValue: o = 0,
|
|
729
|
+
min: t = 0,
|
|
730
|
+
max: e = 100,
|
|
731
|
+
step: n = 1,
|
|
732
|
+
disabled: r = !1,
|
|
733
|
+
onChange: l,
|
|
734
|
+
className: d = ""
|
|
735
|
+
}) => {
|
|
736
|
+
const [u, i] = N(o), p = s !== void 0, m = p ? s : u, f = D(null), [g, h] = N(!1), c = me({ disabled: r });
|
|
737
|
+
$(`${c.container} ${c.track} ${c.range} ${c.handle} ${d}`);
|
|
738
|
+
const v = (m - t) / (e - t) * 100, w = O(
|
|
739
|
+
(b) => {
|
|
740
|
+
if (r || !f.current) return;
|
|
741
|
+
const P = f.current.getBoundingClientRect();
|
|
742
|
+
let B = (b - P.left) / P.width;
|
|
743
|
+
B = Math.max(0, Math.min(1, B));
|
|
744
|
+
let I = t + B * (e - t);
|
|
745
|
+
I = Math.round(I / n) * n, I = Math.max(t, Math.min(e, I)), p || i(I), l == null || l(I);
|
|
746
|
+
},
|
|
747
|
+
[r, t, e, n, p, l]
|
|
748
|
+
), x = (b) => {
|
|
749
|
+
r || (h(!0), w(b.clientX));
|
|
750
|
+
};
|
|
751
|
+
return C(() => {
|
|
752
|
+
if (!g) return;
|
|
753
|
+
const b = (B) => {
|
|
754
|
+
w(B.clientX);
|
|
755
|
+
}, P = () => {
|
|
756
|
+
h(!1);
|
|
757
|
+
};
|
|
758
|
+
return window.addEventListener("mousemove", b), window.addEventListener("mouseup", P), () => {
|
|
759
|
+
window.removeEventListener("mousemove", b), window.removeEventListener("mouseup", P);
|
|
760
|
+
};
|
|
761
|
+
}, [g, w]), /* @__PURE__ */ k(
|
|
762
|
+
"div",
|
|
763
|
+
{
|
|
764
|
+
ref: f,
|
|
765
|
+
className: `${c.container} ${d}`.trim(),
|
|
766
|
+
onMouseDown: x,
|
|
767
|
+
children: [
|
|
768
|
+
/* @__PURE__ */ a("div", { className: c.track, children: /* @__PURE__ */ a("div", { className: c.range, style: { width: `${v}%` } }) }),
|
|
769
|
+
/* @__PURE__ */ a(
|
|
770
|
+
"div",
|
|
771
|
+
{
|
|
772
|
+
className: c.handle,
|
|
773
|
+
style: {
|
|
774
|
+
left: `${v}%`,
|
|
775
|
+
transform: "translateX(-50%)"
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
)
|
|
779
|
+
]
|
|
780
|
+
}
|
|
781
|
+
);
|
|
782
|
+
}, _e = ({
|
|
783
|
+
checked: s,
|
|
784
|
+
defaultChecked: o = !1,
|
|
785
|
+
disabled: t = !1,
|
|
786
|
+
onChange: e,
|
|
787
|
+
size: n = "md",
|
|
788
|
+
color: r = "primary",
|
|
789
|
+
className: l = ""
|
|
790
|
+
}) => {
|
|
791
|
+
const [d, u] = N(o), i = s !== void 0, p = i ? s : d, { getToggleProps: m } = Y(p), f = pe(p, {
|
|
792
|
+
size: n,
|
|
793
|
+
color: r,
|
|
794
|
+
disabled: t
|
|
795
|
+
});
|
|
796
|
+
$(`${f.track} ${f.thumb} ${l}`);
|
|
797
|
+
const g = () => {
|
|
798
|
+
if (t) return;
|
|
799
|
+
const h = !p;
|
|
800
|
+
i || u(h), e == null || e(h);
|
|
801
|
+
};
|
|
802
|
+
return /* @__PURE__ */ a(
|
|
803
|
+
"div",
|
|
804
|
+
{
|
|
805
|
+
...m(),
|
|
806
|
+
className: `${f.track} ${t ? "opacity-50 cursor-not-allowed" : "cursor-pointer"} ${l}`.trim(),
|
|
807
|
+
onClick: g,
|
|
808
|
+
children: /* @__PURE__ */ a("span", { className: f.thumb })
|
|
809
|
+
}
|
|
810
|
+
);
|
|
811
|
+
};
|
|
812
|
+
function et({ data: s, columns: o, onRowClick: t, className: e = "" }) {
|
|
813
|
+
const {
|
|
814
|
+
getTableProps: n,
|
|
815
|
+
getHeaderProps: r,
|
|
816
|
+
getBodyProps: l,
|
|
817
|
+
getRowProps: d,
|
|
818
|
+
getCellProps: u,
|
|
819
|
+
getHeaderCellProps: i
|
|
820
|
+
} = $e({ data: s, columns: o, onRowClick: t }), p = n(), m = r(), f = l(), g = i(), h = u(), c = [
|
|
821
|
+
p.className,
|
|
822
|
+
m.className,
|
|
823
|
+
f.className,
|
|
824
|
+
g.className,
|
|
825
|
+
h.className,
|
|
826
|
+
"sxo-table-row border-b border-neutral-100 hover:bg-neutral-50 transition-colors"
|
|
827
|
+
].join(" ");
|
|
828
|
+
return $(`${c} ${e}`), /* @__PURE__ */ a("div", { className: "overflow-x-auto", children: /* @__PURE__ */ k("table", { ...p, className: `${p.className} ${e}`.trim(), children: [
|
|
829
|
+
/* @__PURE__ */ a("thead", { ...m, children: /* @__PURE__ */ a("tr", { children: o.map((v) => /* @__PURE__ */ a("th", { ...g, children: v.header }, v.key)) }) }),
|
|
830
|
+
/* @__PURE__ */ a("tbody", { ...f, children: s.map((v, w) => /* @__PURE__ */ a("tr", { ...d(v), children: o.map((x) => /* @__PURE__ */ a("td", { ...h, children: x.render ? x.render(v) : v[x.key] }, x.key)) }, w)) })
|
|
831
|
+
] }) });
|
|
832
|
+
}
|
|
833
|
+
const L = j(null), tt = ({
|
|
834
|
+
children: s,
|
|
835
|
+
defaultValue: o,
|
|
836
|
+
value: t,
|
|
837
|
+
onChange: e,
|
|
838
|
+
variant: n = "line",
|
|
839
|
+
size: r = "md",
|
|
840
|
+
className: l = ""
|
|
841
|
+
}) => {
|
|
842
|
+
const [d, u] = N(o || ""), i = t !== void 0, p = i ? t : d, { getTabListProps: m, getTabProps: f, getTabPanelProps: g } = Z({
|
|
843
|
+
value: p,
|
|
844
|
+
onChange: (c) => {
|
|
845
|
+
i || u(c), e == null || e(c);
|
|
846
|
+
}
|
|
847
|
+
}), h = fe({ variant: n, size: r });
|
|
848
|
+
return $(`${h.list} ${l}`), /* @__PURE__ */ a(
|
|
849
|
+
L.Provider,
|
|
850
|
+
{
|
|
851
|
+
value: {
|
|
852
|
+
currentValue: p,
|
|
853
|
+
selectTab: (c) => {
|
|
854
|
+
i || u(c), e == null || e(c);
|
|
855
|
+
},
|
|
856
|
+
getTabProps: f,
|
|
857
|
+
getTabPanelProps: g,
|
|
858
|
+
styles: h
|
|
859
|
+
},
|
|
860
|
+
children: /* @__PURE__ */ a("div", { className: l, children: s })
|
|
861
|
+
}
|
|
862
|
+
);
|
|
863
|
+
}, st = ({ children: s, className: o = "" }) => {
|
|
864
|
+
const t = E(L);
|
|
865
|
+
if (!t) throw new Error("TabList must be used within Tabs");
|
|
866
|
+
return /* @__PURE__ */ a("div", { role: "tablist", className: `${t.styles.list} ${o}`.trim(), children: s });
|
|
867
|
+
}, nt = ({ value: s, children: o, className: t = "" }) => {
|
|
868
|
+
const e = E(L);
|
|
869
|
+
if (!e) throw new Error("Tab must be used within Tabs");
|
|
870
|
+
const n = e.currentValue === s, r = e.getTabProps(s, e.selectTab);
|
|
871
|
+
return /* @__PURE__ */ a("div", { ...r, className: `${e.styles.tab(n)} ${t}`.trim(), children: o });
|
|
872
|
+
}, ot = ({ value: s, children: o, className: t = "" }) => {
|
|
873
|
+
const e = E(L);
|
|
874
|
+
if (!e) throw new Error("TabPanel must be used within Tabs");
|
|
875
|
+
const n = e.getTabPanelProps(s);
|
|
876
|
+
return /* @__PURE__ */ a("div", { ...n, className: `${e.styles.panel} ${t}`.trim(), children: o });
|
|
877
|
+
}, rt = ({
|
|
878
|
+
variant: s = "solid",
|
|
879
|
+
color: o = "primary",
|
|
880
|
+
rounded: t = "sm",
|
|
881
|
+
size: e = "md",
|
|
882
|
+
closable: n = !1,
|
|
883
|
+
className: r = "",
|
|
884
|
+
children: l,
|
|
885
|
+
onClose: d,
|
|
886
|
+
...u
|
|
887
|
+
}) => {
|
|
888
|
+
const i = ge({ variant: s, color: o, rounded: t, size: e, closable: n }), p = $(`${i.base} ${r}`.trim());
|
|
889
|
+
return /* @__PURE__ */ k("span", { className: p, ...u, children: [
|
|
890
|
+
l,
|
|
891
|
+
n && /* @__PURE__ */ a(
|
|
892
|
+
"span",
|
|
893
|
+
{
|
|
894
|
+
className: i.closeIcon,
|
|
895
|
+
onClick: (m) => {
|
|
896
|
+
m.stopPropagation(), d == null || d();
|
|
897
|
+
},
|
|
898
|
+
children: "×"
|
|
899
|
+
}
|
|
900
|
+
)
|
|
901
|
+
] });
|
|
902
|
+
}, lt = ({
|
|
903
|
+
content: s,
|
|
904
|
+
children: o,
|
|
905
|
+
delay: t = 200,
|
|
906
|
+
variant: e = "dark",
|
|
907
|
+
className: n = ""
|
|
908
|
+
}) => {
|
|
909
|
+
const [r, l] = N(!1), { getTriggerProps: d, getTooltipProps: u } = _({
|
|
910
|
+
delay: t,
|
|
911
|
+
defaultOpen: r
|
|
912
|
+
}), i = he({ variant: e });
|
|
913
|
+
$(`${i.content} ${n}`);
|
|
914
|
+
const p = d(
|
|
915
|
+
() => l(!0),
|
|
916
|
+
() => l(!1)
|
|
917
|
+
);
|
|
918
|
+
return /* @__PURE__ */ k("div", { className: "relative inline-block", children: [
|
|
919
|
+
y.cloneElement(o, p),
|
|
920
|
+
r && /* @__PURE__ */ a(
|
|
921
|
+
"div",
|
|
922
|
+
{
|
|
923
|
+
...u(),
|
|
924
|
+
className: `${i.content} ${n} bottom-full left-1/2 -translate-x-1/2 mb-2`.trim(),
|
|
925
|
+
children: s
|
|
926
|
+
}
|
|
927
|
+
)
|
|
928
|
+
] });
|
|
929
|
+
}, it = ({
|
|
930
|
+
tokens: s = ee,
|
|
931
|
+
mode: o = "light",
|
|
932
|
+
children: t
|
|
933
|
+
}) => {
|
|
934
|
+
const e = M(() => new xe(s), [s]);
|
|
935
|
+
return C(() => {
|
|
936
|
+
document.documentElement.setAttribute("data-sxo-mode", o);
|
|
937
|
+
}, [o]), C(() => {
|
|
938
|
+
const n = e.generateTokenCssVars();
|
|
939
|
+
let r = document.getElementById("sxo-tokens");
|
|
940
|
+
if (r || (r = document.createElement("style"), r.id = "sxo-tokens", document.head.appendChild(r)), r.innerHTML = n, !document.getElementById("sxo-engine")) {
|
|
941
|
+
const l = document.createElement("style");
|
|
942
|
+
l.id = "sxo-engine", document.head.appendChild(l);
|
|
943
|
+
}
|
|
944
|
+
}, [e]), C(() => {
|
|
945
|
+
let n = document.getElementById("sxo-reset");
|
|
946
|
+
n || (n = document.createElement("style"), n.id = "sxo-reset", document.head.appendChild(n), n.innerHTML = `
|
|
947
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
948
|
+
body {
|
|
949
|
+
margin: 0;
|
|
950
|
+
font-family: var(--sxo-typography-fontFamily-sans);
|
|
951
|
+
-webkit-font-smoothing: antialiased;
|
|
952
|
+
background-color: var(--sxo-color-background-primary);
|
|
953
|
+
color: var(--sxo-color-neutral-900);
|
|
954
|
+
transition: background-color 0.3s ease, color 0.3s ease;
|
|
955
|
+
}
|
|
956
|
+
button, input, select, textarea { font-family: inherit; }
|
|
957
|
+
a { color: inherit; text-decoration: none; }
|
|
958
|
+
`);
|
|
959
|
+
}, []), y.createElement(R.Provider, { value: { tokens: s, engine: e } }, t);
|
|
960
|
+
};
|
|
961
|
+
export {
|
|
962
|
+
Ie as Accordion,
|
|
963
|
+
Be as AccordionItem,
|
|
964
|
+
je as Avatar,
|
|
965
|
+
Le as Badge,
|
|
966
|
+
Me as Box,
|
|
967
|
+
Ve as Button,
|
|
968
|
+
Se as Card,
|
|
969
|
+
Oe as Checkbox,
|
|
970
|
+
Ae as CheckboxGroup,
|
|
971
|
+
Ue as Container,
|
|
972
|
+
De as Dialog,
|
|
973
|
+
ze as Dropdown,
|
|
974
|
+
Re as DropdownItem,
|
|
975
|
+
Xe as Grid,
|
|
976
|
+
Ge as Icon,
|
|
977
|
+
He as Input,
|
|
978
|
+
Fe as Menu,
|
|
979
|
+
Ke as Pagination,
|
|
980
|
+
Je as Radio,
|
|
981
|
+
qe as RadioGroup,
|
|
982
|
+
Qe as Select,
|
|
983
|
+
Ye as SelectOption,
|
|
984
|
+
Ze as Slider,
|
|
985
|
+
We as Stack,
|
|
986
|
+
_e as Switch,
|
|
987
|
+
R as SxoContext,
|
|
988
|
+
nt as Tab,
|
|
989
|
+
st as TabList,
|
|
990
|
+
ot as TabPanel,
|
|
991
|
+
et as Table,
|
|
992
|
+
tt as Tabs,
|
|
993
|
+
rt as Tag,
|
|
994
|
+
it as ThemeProvider,
|
|
995
|
+
lt as Tooltip,
|
|
996
|
+
Ee as useBreakpoint,
|
|
997
|
+
$ as useStyle,
|
|
998
|
+
V as useSxo,
|
|
999
|
+
Ce as useToken
|
|
1000
|
+
};
|