@mucsi96/react-ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +233 -2
- package/dist/components/button/button.d.ts +21 -0
- package/dist/components/dialog/dialog.d.ts +13 -0
- package/dist/components/donut-slider/donut-slider.d.ts +16 -0
- package/dist/components/forms/controls.d.ts +23 -0
- package/dist/components/forms/select.d.ts +22 -0
- package/dist/components/forms/text-field.d.ts +14 -0
- package/dist/components/loader/loader.d.ts +13 -0
- package/dist/components/menu/menu.d.ts +18 -0
- package/dist/components/notifications/notifications.d.ts +26 -0
- package/dist/components/split-button/split-button.d.ts +9 -0
- package/dist/components/surface/surface.d.ts +22 -0
- package/dist/components/table/data-table.d.ts +21 -0
- package/dist/components/tooltip/tooltip.d.ts +9 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +831 -0
- package/dist/internal/classes.d.ts +1 -0
- package/dist/internal/icon.d.ts +16 -0
- package/dist/styles.css +2 -0
- package/dist/types.d.ts +1 -0
- package/package.json +50 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,831 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button as e, Checkbox as t, ComboBox as n, Dialog as r, DialogTrigger as i, FieldError as a, Group as o, Heading as s, Input as c, Label as l, Link as u, ListBox as d, ListBoxItem as f, Menu as p, MenuItem as m, MenuTrigger as h, MenuTrigger as g, Modal as _, ModalOverlay as v, Popover as y, ProgressBar as b, Radio as x, RadioGroup as S, Select as C, SelectValue as w, Separator as T, SubmenuTrigger as E, Switch as D, Text as O, TextArea as ee, TextField as te, Tooltip as ne, TooltipTrigger as re } from "react-aria-components";
|
|
3
|
+
import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
4
|
+
import { createContext as ie, useCallback as M, useContext as ae, useEffect as oe, useId as N, useMemo as se, useRef as P, useState as F } from "react";
|
|
5
|
+
import { createPortal as ce } from "react-dom";
|
|
6
|
+
//#region src/internal/classes.ts
|
|
7
|
+
function I(...e) {
|
|
8
|
+
return e.filter(Boolean).join(" ");
|
|
9
|
+
}
|
|
10
|
+
var L = { button: "_button_1t5ia_1" };
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/components/button/button.tsx
|
|
13
|
+
function R({ variant: t = "filled", tone: n = "primary", background: r, className: i, style: a, children: o, ref: s, ...c }) {
|
|
14
|
+
return /* @__PURE__ */ A(e, {
|
|
15
|
+
...c,
|
|
16
|
+
ref: s,
|
|
17
|
+
className: I(L.button, i),
|
|
18
|
+
"data-variant": t,
|
|
19
|
+
"data-tone": n,
|
|
20
|
+
style: {
|
|
21
|
+
...a,
|
|
22
|
+
"--bt-button-bg": r
|
|
23
|
+
},
|
|
24
|
+
children: o
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function le({ variant: e = "filled", tone: t = "primary", background: n, className: r, style: i, children: a, ref: o, ...s }) {
|
|
28
|
+
return /* @__PURE__ */ A(u, {
|
|
29
|
+
...s,
|
|
30
|
+
ref: o,
|
|
31
|
+
className: I(L.button, r),
|
|
32
|
+
"data-variant": e,
|
|
33
|
+
"data-tone": t,
|
|
34
|
+
style: {
|
|
35
|
+
...i,
|
|
36
|
+
"--bt-button-bg": n
|
|
37
|
+
},
|
|
38
|
+
children: a
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
var z = {
|
|
42
|
+
field: "_field_zdwqy_1",
|
|
43
|
+
label: "_label_zdwqy_9",
|
|
44
|
+
input: "_input_zdwqy_13",
|
|
45
|
+
selectButton: "_selectButton_zdwqy_14",
|
|
46
|
+
description: "_description_zdwqy_44",
|
|
47
|
+
error: "_error_zdwqy_48",
|
|
48
|
+
combo: "_combo_zdwqy_65",
|
|
49
|
+
comboButton: "_comboButton_zdwqy_71",
|
|
50
|
+
popover: "_popover_zdwqy_89",
|
|
51
|
+
list: "_list_zdwqy_99",
|
|
52
|
+
option: "_option_zdwqy_105",
|
|
53
|
+
control: "_control_zdwqy_120",
|
|
54
|
+
check: "_check_zdwqy_134",
|
|
55
|
+
radio: "_radio_zdwqy_135",
|
|
56
|
+
track: "_track_zdwqy_159",
|
|
57
|
+
thumb: "_thumb_zdwqy_169"
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/components/forms/text-field.tsx
|
|
61
|
+
function ue({ label: e, description: t, error: n, placeholder: r, multiline: i = !1, rows: o = 3, appearance: s = "outlined", className: u, ref: d, ...f }) {
|
|
62
|
+
return /* @__PURE__ */ j(te, {
|
|
63
|
+
...f,
|
|
64
|
+
ref: d,
|
|
65
|
+
isInvalid: !!n || f.isInvalid,
|
|
66
|
+
className: I(z.field, u),
|
|
67
|
+
"data-appearance": s,
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ A(l, {
|
|
70
|
+
className: z.label,
|
|
71
|
+
children: e
|
|
72
|
+
}),
|
|
73
|
+
i ? /* @__PURE__ */ A(ee, {
|
|
74
|
+
className: z.input,
|
|
75
|
+
placeholder: r,
|
|
76
|
+
rows: o
|
|
77
|
+
}) : /* @__PURE__ */ A(c, {
|
|
78
|
+
className: z.input,
|
|
79
|
+
placeholder: r
|
|
80
|
+
}),
|
|
81
|
+
t && /* @__PURE__ */ A(O, {
|
|
82
|
+
slot: "description",
|
|
83
|
+
className: z.description,
|
|
84
|
+
children: t
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ A(a, {
|
|
87
|
+
className: z.error,
|
|
88
|
+
children: n
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
var de = { icon: "_icon_1xold_1" }, fe = {
|
|
94
|
+
"chevron-down": "m6 9 6 6 6-6",
|
|
95
|
+
"chevron-right": "m9 6 6 6-6 6",
|
|
96
|
+
"arrow-left": "m12 19-7-7 7-7M5 12h14",
|
|
97
|
+
"arrow-right": "m12 5 7 7-7 7M5 12h14",
|
|
98
|
+
"arrow-up": "m5 12 7-7 7 7M12 5v14",
|
|
99
|
+
"arrow-down": "m5 12 7 7 7-7M12 5v14",
|
|
100
|
+
sort: "m8 3-4 4h8M8 3v18m8 0 4-4h-8m4-14v18",
|
|
101
|
+
close: "m6 6 12 12M6 18 18 6"
|
|
102
|
+
};
|
|
103
|
+
function B({ name: e, className: t, ...n }) {
|
|
104
|
+
return /* @__PURE__ */ A("svg", {
|
|
105
|
+
...n,
|
|
106
|
+
width: "16",
|
|
107
|
+
height: "16",
|
|
108
|
+
viewBox: "0 0 24 24",
|
|
109
|
+
fill: "none",
|
|
110
|
+
stroke: "currentColor",
|
|
111
|
+
strokeWidth: "2",
|
|
112
|
+
strokeLinecap: "round",
|
|
113
|
+
strokeLinejoin: "round",
|
|
114
|
+
className: I(de.icon, t),
|
|
115
|
+
"aria-hidden": "true",
|
|
116
|
+
focusable: "false",
|
|
117
|
+
children: /* @__PURE__ */ A("path", { d: fe[e] })
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/components/forms/select.tsx
|
|
122
|
+
function pe({ label: t, options: n, description: r, error: i, placeholder: o = "Select an option", className: s, ...c }) {
|
|
123
|
+
return /* @__PURE__ */ j(C, {
|
|
124
|
+
...c,
|
|
125
|
+
isInvalid: !!i || c.isInvalid,
|
|
126
|
+
className: I(z.field, s),
|
|
127
|
+
placeholder: o,
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ A(l, {
|
|
130
|
+
className: z.label,
|
|
131
|
+
children: t
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ j(e, {
|
|
134
|
+
className: z.selectButton,
|
|
135
|
+
children: [/* @__PURE__ */ A(w, {}), /* @__PURE__ */ A(B, { name: "chevron-down" })]
|
|
136
|
+
}),
|
|
137
|
+
r && /* @__PURE__ */ A(O, {
|
|
138
|
+
slot: "description",
|
|
139
|
+
className: z.description,
|
|
140
|
+
children: r
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ A(a, {
|
|
143
|
+
className: z.error,
|
|
144
|
+
children: i
|
|
145
|
+
}),
|
|
146
|
+
/* @__PURE__ */ A(y, {
|
|
147
|
+
className: z.popover,
|
|
148
|
+
children: /* @__PURE__ */ A(d, {
|
|
149
|
+
items: n,
|
|
150
|
+
className: z.list,
|
|
151
|
+
children: (e) => /* @__PURE__ */ A(f, {
|
|
152
|
+
id: e.id,
|
|
153
|
+
textValue: e.label,
|
|
154
|
+
isDisabled: e.isDisabled,
|
|
155
|
+
className: z.option,
|
|
156
|
+
children: e.label
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function me({ label: t, options: r, description: i, error: s, placeholder: u = "Search…", className: p, ...m }) {
|
|
164
|
+
return /* @__PURE__ */ j(n, {
|
|
165
|
+
...m,
|
|
166
|
+
defaultItems: r,
|
|
167
|
+
isInvalid: !!s || m.isInvalid,
|
|
168
|
+
className: I(z.field, p),
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ A(l, {
|
|
171
|
+
className: z.label,
|
|
172
|
+
children: t
|
|
173
|
+
}),
|
|
174
|
+
/* @__PURE__ */ j(o, {
|
|
175
|
+
className: z.combo,
|
|
176
|
+
children: [/* @__PURE__ */ A(c, {
|
|
177
|
+
className: z.input,
|
|
178
|
+
placeholder: u
|
|
179
|
+
}), /* @__PURE__ */ A(e, {
|
|
180
|
+
className: z.comboButton,
|
|
181
|
+
"aria-label": `Show ${t.toLowerCase()} options`,
|
|
182
|
+
children: /* @__PURE__ */ A(B, { name: "chevron-down" })
|
|
183
|
+
})]
|
|
184
|
+
}),
|
|
185
|
+
i && /* @__PURE__ */ A(O, {
|
|
186
|
+
slot: "description",
|
|
187
|
+
className: z.description,
|
|
188
|
+
children: i
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ A(a, {
|
|
191
|
+
className: z.error,
|
|
192
|
+
children: s
|
|
193
|
+
}),
|
|
194
|
+
/* @__PURE__ */ A(y, {
|
|
195
|
+
className: z.popover,
|
|
196
|
+
children: /* @__PURE__ */ A(d, {
|
|
197
|
+
className: z.list,
|
|
198
|
+
renderEmptyState: () => "No results",
|
|
199
|
+
children: (e) => /* @__PURE__ */ A(f, {
|
|
200
|
+
id: e.id,
|
|
201
|
+
textValue: e.label,
|
|
202
|
+
isDisabled: e.isDisabled,
|
|
203
|
+
className: z.option,
|
|
204
|
+
children: e.label
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/components/forms/controls.tsx
|
|
213
|
+
function he({ children: e, className: n, ...r }) {
|
|
214
|
+
return /* @__PURE__ */ A(t, {
|
|
215
|
+
...r,
|
|
216
|
+
className: I(z.control, n),
|
|
217
|
+
children: ({ isSelected: t, isIndeterminate: n }) => /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A("span", {
|
|
218
|
+
className: z.check,
|
|
219
|
+
"aria-hidden": "true",
|
|
220
|
+
children: n ? "−" : t ? "✓" : ""
|
|
221
|
+
}), e] })
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function ge({ label: e, children: t, className: n, ...r }) {
|
|
225
|
+
return /* @__PURE__ */ j(S, {
|
|
226
|
+
...r,
|
|
227
|
+
className: I(z.field, n),
|
|
228
|
+
children: [/* @__PURE__ */ A(l, {
|
|
229
|
+
className: z.label,
|
|
230
|
+
children: e
|
|
231
|
+
}), t]
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function _e({ children: e, className: t, ...n }) {
|
|
235
|
+
return /* @__PURE__ */ j(x, {
|
|
236
|
+
...n,
|
|
237
|
+
className: I(z.control, t),
|
|
238
|
+
children: [/* @__PURE__ */ A("span", {
|
|
239
|
+
className: z.radio,
|
|
240
|
+
"aria-hidden": "true"
|
|
241
|
+
}), e]
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function ve({ children: e, className: t, ...n }) {
|
|
245
|
+
return /* @__PURE__ */ j(D, {
|
|
246
|
+
...n,
|
|
247
|
+
className: I(z.control, t),
|
|
248
|
+
children: [/* @__PURE__ */ A("span", {
|
|
249
|
+
className: z.track,
|
|
250
|
+
"aria-hidden": "true",
|
|
251
|
+
children: /* @__PURE__ */ A("span", { className: z.thumb })
|
|
252
|
+
}), e]
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
var V = {
|
|
256
|
+
slider: "_slider_1x954_1",
|
|
257
|
+
svg: "_svg_1x954_11",
|
|
258
|
+
track: "_track_1x954_27",
|
|
259
|
+
progress: "_progress_1x954_28",
|
|
260
|
+
handle: "_handle_1x954_39",
|
|
261
|
+
readout: "_readout_1x954_48",
|
|
262
|
+
label: "_label_1x954_60",
|
|
263
|
+
value: "_value_1x954_66",
|
|
264
|
+
unit: "_unit_1x954_73"
|
|
265
|
+
};
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/components/donut-slider/donut-slider.tsx
|
|
268
|
+
function H(e, t, n, r) {
|
|
269
|
+
let i = Number((Math.round(e / t) * t).toFixed(12));
|
|
270
|
+
return Math.min(r ?? Infinity, Math.max(n ?? -Infinity, i));
|
|
271
|
+
}
|
|
272
|
+
function U(e) {
|
|
273
|
+
let t = e.currentTarget.getBoundingClientRect();
|
|
274
|
+
return (Math.atan2(e.clientX - t.left - t.width / 2, -(e.clientY - t.top - t.height / 2)) * 180 / Math.PI + 360) % 360;
|
|
275
|
+
}
|
|
276
|
+
function ye({ label: e, value: t, defaultValue: n = 0, onChange: r, valuePerTurn: i = 100, step: a = 1, min: o, max: s, unit: c = "", size: l = 220, displayDecimals: u = 0, isDisabled: d = !1, className: f }) {
|
|
277
|
+
let [p, m] = F(n), [h, g] = F(!1), _ = P(null), v = P(null);
|
|
278
|
+
if (!Number.isFinite(i) || i <= 0 || !Number.isFinite(a) || a <= 0) throw RangeError("DonutSlider requires positive, finite step and valuePerTurn values.");
|
|
279
|
+
if (o !== void 0 && s !== void 0 && o > s) throw RangeError("DonutSlider min must not exceed max.");
|
|
280
|
+
let y = H(t ?? p, a, o, s), b = (y / i % 1 + 1) % 1, x = (b * 360 - 90) * Math.PI / 180, S = 2 * Math.PI * 90, C = y.toFixed(Math.min(20, Math.max(0, Math.trunc(u))));
|
|
281
|
+
function w(e) {
|
|
282
|
+
let n = H(e, a, o, s);
|
|
283
|
+
n !== y && (t === void 0 && m(n), r?.(n));
|
|
284
|
+
}
|
|
285
|
+
function T(e) {
|
|
286
|
+
if (d || e.button !== 0 || _.current) return;
|
|
287
|
+
let t = U(e), n = Math.round(y / i - t / 360);
|
|
288
|
+
_.current = {
|
|
289
|
+
pointerId: e.pointerId,
|
|
290
|
+
lastAngle: t,
|
|
291
|
+
turn: n
|
|
292
|
+
}, e.currentTarget.setPointerCapture(e.pointerId), v.current?.focus(), g(!0), w((n + t / 360) * i), e.preventDefault();
|
|
293
|
+
}
|
|
294
|
+
function E(e) {
|
|
295
|
+
let t = _.current;
|
|
296
|
+
if (d || !t || e.pointerId !== t.pointerId) return;
|
|
297
|
+
let n = U(e);
|
|
298
|
+
t.lastAngle > 270 && n < 90 ? t.turn += 1 : t.lastAngle < 90 && n > 270 && --t.turn, t.lastAngle = n, w((t.turn + n / 360) * i), e.preventDefault();
|
|
299
|
+
}
|
|
300
|
+
function D(e) {
|
|
301
|
+
e.pointerId === _.current?.pointerId && (_.current = null, g(!1), e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId));
|
|
302
|
+
}
|
|
303
|
+
function O(e) {
|
|
304
|
+
if (d) return;
|
|
305
|
+
let t;
|
|
306
|
+
switch (e.key) {
|
|
307
|
+
case "ArrowUp":
|
|
308
|
+
case "ArrowRight":
|
|
309
|
+
t = y + a;
|
|
310
|
+
break;
|
|
311
|
+
case "ArrowDown":
|
|
312
|
+
case "ArrowLeft":
|
|
313
|
+
t = y - a;
|
|
314
|
+
break;
|
|
315
|
+
case "PageUp":
|
|
316
|
+
t = y + i / 10;
|
|
317
|
+
break;
|
|
318
|
+
case "PageDown":
|
|
319
|
+
t = y - i / 10;
|
|
320
|
+
break;
|
|
321
|
+
case "Home":
|
|
322
|
+
if (o === void 0) return;
|
|
323
|
+
t = o;
|
|
324
|
+
break;
|
|
325
|
+
case "End":
|
|
326
|
+
if (s === void 0) return;
|
|
327
|
+
t = s;
|
|
328
|
+
break;
|
|
329
|
+
default: return;
|
|
330
|
+
}
|
|
331
|
+
e.preventDefault(), w(t);
|
|
332
|
+
}
|
|
333
|
+
return /* @__PURE__ */ j("div", {
|
|
334
|
+
ref: v,
|
|
335
|
+
role: "slider",
|
|
336
|
+
tabIndex: d ? -1 : 0,
|
|
337
|
+
"aria-label": e,
|
|
338
|
+
"aria-valuenow": y,
|
|
339
|
+
"aria-valuemin": o,
|
|
340
|
+
"aria-valuemax": s,
|
|
341
|
+
"aria-valuetext": `${C}${c ? ` ${c}` : ""}`,
|
|
342
|
+
"aria-disabled": d || void 0,
|
|
343
|
+
className: I(V.slider, f),
|
|
344
|
+
"data-dragging": h || void 0,
|
|
345
|
+
"data-disabled": d || void 0,
|
|
346
|
+
style: { "--dial-size": `${l}px` },
|
|
347
|
+
onKeyDown: O,
|
|
348
|
+
children: [/* @__PURE__ */ j("svg", {
|
|
349
|
+
viewBox: "0 0 220 220",
|
|
350
|
+
className: V.svg,
|
|
351
|
+
"aria-hidden": "true",
|
|
352
|
+
onPointerDown: T,
|
|
353
|
+
onPointerMove: E,
|
|
354
|
+
onPointerUp: D,
|
|
355
|
+
onPointerCancel: D,
|
|
356
|
+
onLostPointerCapture: D,
|
|
357
|
+
children: [
|
|
358
|
+
/* @__PURE__ */ A("circle", {
|
|
359
|
+
cx: "110",
|
|
360
|
+
cy: "110",
|
|
361
|
+
r: 90,
|
|
362
|
+
className: V.track
|
|
363
|
+
}),
|
|
364
|
+
/* @__PURE__ */ A("circle", {
|
|
365
|
+
cx: "110",
|
|
366
|
+
cy: "110",
|
|
367
|
+
r: 90,
|
|
368
|
+
className: V.progress,
|
|
369
|
+
strokeDasharray: `${b * S} ${S}`,
|
|
370
|
+
transform: "rotate(-90 110 110)"
|
|
371
|
+
}),
|
|
372
|
+
/* @__PURE__ */ A("circle", {
|
|
373
|
+
cx: 110 + 90 * Math.cos(x),
|
|
374
|
+
cy: 110 + 90 * Math.sin(x),
|
|
375
|
+
r: "15",
|
|
376
|
+
className: V.handle
|
|
377
|
+
})
|
|
378
|
+
]
|
|
379
|
+
}), /* @__PURE__ */ j("div", {
|
|
380
|
+
className: V.readout,
|
|
381
|
+
"aria-hidden": "true",
|
|
382
|
+
children: [/* @__PURE__ */ A("span", {
|
|
383
|
+
className: V.label,
|
|
384
|
+
children: e
|
|
385
|
+
}), /* @__PURE__ */ j("span", {
|
|
386
|
+
className: V.value,
|
|
387
|
+
children: [C, /* @__PURE__ */ A("span", {
|
|
388
|
+
className: V.unit,
|
|
389
|
+
children: c
|
|
390
|
+
})]
|
|
391
|
+
})]
|
|
392
|
+
})]
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
var W = {
|
|
396
|
+
popover: "_popover_b0jmz_1",
|
|
397
|
+
menu: "_menu_b0jmz_11",
|
|
398
|
+
item: "_item_b0jmz_18",
|
|
399
|
+
submenuIcon: "_submenuIcon_b0jmz_41",
|
|
400
|
+
separator: "_separator_b0jmz_44"
|
|
401
|
+
};
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/components/menu/menu.tsx
|
|
404
|
+
function G({ className: e, ...t }) {
|
|
405
|
+
return /* @__PURE__ */ A(p, {
|
|
406
|
+
...t,
|
|
407
|
+
className: I(W.menu, e)
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
function be({ className: e, tone: t = "default", children: n, ...r }) {
|
|
411
|
+
return /* @__PURE__ */ A(m, {
|
|
412
|
+
...r,
|
|
413
|
+
textValue: r.textValue ?? (typeof n == "string" ? n : void 0),
|
|
414
|
+
className: I(W.item, e),
|
|
415
|
+
"data-tone": t,
|
|
416
|
+
children: ({ hasSubmenu: e }) => /* @__PURE__ */ j(k, { children: [n, e && /* @__PURE__ */ A(B, {
|
|
417
|
+
name: "chevron-right",
|
|
418
|
+
className: W.submenuIcon
|
|
419
|
+
})] })
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
function K({ className: e, ...t }) {
|
|
423
|
+
return /* @__PURE__ */ A(y, {
|
|
424
|
+
...t,
|
|
425
|
+
className: I(W.popover, e)
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
function xe() {
|
|
429
|
+
return /* @__PURE__ */ A(T, { className: W.separator });
|
|
430
|
+
}
|
|
431
|
+
var q = {
|
|
432
|
+
group: "_group_1dm4k_1",
|
|
433
|
+
primary: "_primary_1dm4k_6",
|
|
434
|
+
trigger: "_trigger_1dm4k_10"
|
|
435
|
+
};
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/components/split-button/split-button.tsx
|
|
438
|
+
function Se({ label: e, icon: t, menuLabel: n = "More actions", children: r, className: i, ...a }) {
|
|
439
|
+
return /* @__PURE__ */ j("div", {
|
|
440
|
+
className: I(q.group, i),
|
|
441
|
+
children: [/* @__PURE__ */ j(R, {
|
|
442
|
+
...a,
|
|
443
|
+
className: q.primary,
|
|
444
|
+
children: [t, e]
|
|
445
|
+
}), /* @__PURE__ */ j(g, { children: [/* @__PURE__ */ A(R, {
|
|
446
|
+
tone: a.tone,
|
|
447
|
+
background: a.background,
|
|
448
|
+
isDisabled: a.isDisabled,
|
|
449
|
+
className: q.trigger,
|
|
450
|
+
"aria-label": n,
|
|
451
|
+
children: /* @__PURE__ */ A(B, { name: "chevron-down" })
|
|
452
|
+
}), /* @__PURE__ */ A(K, {
|
|
453
|
+
placement: "bottom end",
|
|
454
|
+
children: /* @__PURE__ */ A(G, {
|
|
455
|
+
"aria-label": n,
|
|
456
|
+
children: r
|
|
457
|
+
})
|
|
458
|
+
})] })]
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
var J = {
|
|
462
|
+
overlay: "_overlay_1gzvt_1",
|
|
463
|
+
modal: "_modal_1gzvt_12",
|
|
464
|
+
dialog: "_dialog_1gzvt_22",
|
|
465
|
+
header: "_header_1gzvt_27",
|
|
466
|
+
title: "_title_1gzvt_34",
|
|
467
|
+
description: "_description_1gzvt_39"
|
|
468
|
+
};
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/components/dialog/dialog.tsx
|
|
471
|
+
function Ce({ title: e, description: t, children: n, role: i = "dialog", className: a, isDismissable: o = !0, ...c }) {
|
|
472
|
+
let l = N();
|
|
473
|
+
return /* @__PURE__ */ A(v, {
|
|
474
|
+
...c,
|
|
475
|
+
isDismissable: o,
|
|
476
|
+
className: J.overlay,
|
|
477
|
+
children: /* @__PURE__ */ A(_, {
|
|
478
|
+
className: J.modal,
|
|
479
|
+
children: /* @__PURE__ */ A(r, {
|
|
480
|
+
role: i,
|
|
481
|
+
"aria-describedby": t ? l : void 0,
|
|
482
|
+
className: I(J.dialog, a),
|
|
483
|
+
children: ({ close: r }) => /* @__PURE__ */ j(k, { children: [
|
|
484
|
+
/* @__PURE__ */ j("header", {
|
|
485
|
+
className: J.header,
|
|
486
|
+
children: [/* @__PURE__ */ A(s, {
|
|
487
|
+
slot: "title",
|
|
488
|
+
className: J.title,
|
|
489
|
+
children: e
|
|
490
|
+
}), /* @__PURE__ */ A(R, {
|
|
491
|
+
variant: "icon",
|
|
492
|
+
"aria-label": "Close dialog",
|
|
493
|
+
onPress: r,
|
|
494
|
+
children: /* @__PURE__ */ A(B, { name: "close" })
|
|
495
|
+
})]
|
|
496
|
+
}),
|
|
497
|
+
t && /* @__PURE__ */ A("p", {
|
|
498
|
+
id: l,
|
|
499
|
+
className: J.description,
|
|
500
|
+
children: t
|
|
501
|
+
}),
|
|
502
|
+
typeof n == "function" ? n({ close: r }) : n
|
|
503
|
+
] })
|
|
504
|
+
})
|
|
505
|
+
})
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
var we = { tooltip: "_tooltip_yd2ye_1" };
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/components/tooltip/tooltip.tsx
|
|
511
|
+
function Te({ children: e, content: t, placement: n = "top", delay: r = 500 }) {
|
|
512
|
+
return /* @__PURE__ */ j(re, {
|
|
513
|
+
delay: r,
|
|
514
|
+
children: [e, /* @__PURE__ */ A(ne, {
|
|
515
|
+
className: we.tooltip,
|
|
516
|
+
placement: n,
|
|
517
|
+
children: t
|
|
518
|
+
})]
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
var Y = {
|
|
522
|
+
container: "_container_154he_1",
|
|
523
|
+
scroll: "_scroll_154he_12",
|
|
524
|
+
table: "_table_154he_15",
|
|
525
|
+
caption: "_caption_154he_20",
|
|
526
|
+
captionText: "_captionText_154he_27",
|
|
527
|
+
sort: "_sort_154he_59",
|
|
528
|
+
pagination: "_pagination_154he_76",
|
|
529
|
+
empty: "_empty_154he_86",
|
|
530
|
+
srOnly: "_srOnly_154he_93"
|
|
531
|
+
};
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/components/table/data-table.tsx
|
|
534
|
+
function Ee({ caption: e, rows: t, columns: n, getRowKey: r, pageSize: i = 10, selectedKey: a = null, onSelectionChange: o, getRowLabel: s, emptyMessage: c = "No results found.", className: l }) {
|
|
535
|
+
let [u, d] = F(null), [f, p] = F(0), m = N(), h = Math.max(1, Math.trunc(i)), g = Math.max(1, Math.ceil(t.length / h)), _ = Math.min(f, g - 1), v = n.find((e) => e.id === u?.column)?.compare, y = (v && u ? [...t].sort((e, t) => v(e, t) * (u.direction === "ascending" ? 1 : -1)) : t).slice(_ * h, (_ + 1) * h);
|
|
536
|
+
function b(e) {
|
|
537
|
+
d((t) => t?.column === e ? t.direction === "ascending" ? {
|
|
538
|
+
column: e,
|
|
539
|
+
direction: "descending"
|
|
540
|
+
} : null : {
|
|
541
|
+
column: e,
|
|
542
|
+
direction: "ascending"
|
|
543
|
+
}), p(0);
|
|
544
|
+
}
|
|
545
|
+
return /* @__PURE__ */ j("div", {
|
|
546
|
+
className: I(Y.container, l),
|
|
547
|
+
children: [
|
|
548
|
+
/* @__PURE__ */ A("div", {
|
|
549
|
+
className: Y.scroll,
|
|
550
|
+
children: /* @__PURE__ */ j("table", {
|
|
551
|
+
className: Y.table,
|
|
552
|
+
"aria-describedby": y.length === 0 ? m : void 0,
|
|
553
|
+
children: [
|
|
554
|
+
/* @__PURE__ */ A("caption", {
|
|
555
|
+
className: Y.caption,
|
|
556
|
+
children: /* @__PURE__ */ A("span", {
|
|
557
|
+
className: Y.captionText,
|
|
558
|
+
children: e
|
|
559
|
+
})
|
|
560
|
+
}),
|
|
561
|
+
/* @__PURE__ */ A("thead", { children: /* @__PURE__ */ j("tr", { children: [o && /* @__PURE__ */ A("th", {
|
|
562
|
+
scope: "col",
|
|
563
|
+
children: /* @__PURE__ */ A("span", {
|
|
564
|
+
className: Y.srOnly,
|
|
565
|
+
children: "Selection"
|
|
566
|
+
})
|
|
567
|
+
}), n.map((e) => /* @__PURE__ */ A("th", {
|
|
568
|
+
scope: "col",
|
|
569
|
+
"data-align": e.align,
|
|
570
|
+
"aria-sort": e.compare ? u?.column === e.id ? u.direction : "none" : void 0,
|
|
571
|
+
children: e.compare ? /* @__PURE__ */ j("button", {
|
|
572
|
+
className: Y.sort,
|
|
573
|
+
onClick: () => b(e.id),
|
|
574
|
+
children: [e.label, /* @__PURE__ */ A(B, { name: u?.column === e.id ? u.direction === "ascending" ? "arrow-up" : "arrow-down" : "sort" })]
|
|
575
|
+
}) : e.label
|
|
576
|
+
}, e.id))] }) }),
|
|
577
|
+
/* @__PURE__ */ A("tbody", { children: y.map((e) => {
|
|
578
|
+
let t = r(e);
|
|
579
|
+
return /* @__PURE__ */ j("tr", {
|
|
580
|
+
"data-selected": t === a || void 0,
|
|
581
|
+
children: [o && /* @__PURE__ */ A("td", { children: /* @__PURE__ */ A(R, {
|
|
582
|
+
variant: "icon",
|
|
583
|
+
"aria-label": `Select ${s?.(e) ?? String(t)}`,
|
|
584
|
+
"aria-pressed": a === t,
|
|
585
|
+
onPress: () => o(a === t ? null : t),
|
|
586
|
+
children: /* @__PURE__ */ A(B, { name: "chevron-right" })
|
|
587
|
+
}) }), n.map((t) => /* @__PURE__ */ A("td", {
|
|
588
|
+
"data-align": t.align,
|
|
589
|
+
children: t.renderCell(e)
|
|
590
|
+
}, t.id))]
|
|
591
|
+
}, t);
|
|
592
|
+
}) })
|
|
593
|
+
]
|
|
594
|
+
})
|
|
595
|
+
}),
|
|
596
|
+
y.length === 0 && /* @__PURE__ */ A("p", {
|
|
597
|
+
id: m,
|
|
598
|
+
className: Y.empty,
|
|
599
|
+
children: c
|
|
600
|
+
}),
|
|
601
|
+
/* @__PURE__ */ j("nav", {
|
|
602
|
+
"aria-label": `${e} pagination`,
|
|
603
|
+
className: Y.pagination,
|
|
604
|
+
children: [
|
|
605
|
+
/* @__PURE__ */ j("span", { children: [
|
|
606
|
+
t.length === 0 ? 0 : _ * h + 1,
|
|
607
|
+
"–",
|
|
608
|
+
Math.min((_ + 1) * h, t.length),
|
|
609
|
+
" of ",
|
|
610
|
+
t.length
|
|
611
|
+
] }),
|
|
612
|
+
/* @__PURE__ */ A(R, {
|
|
613
|
+
variant: "text",
|
|
614
|
+
"aria-label": "Previous page",
|
|
615
|
+
isDisabled: _ === 0,
|
|
616
|
+
onPress: () => p(_ - 1),
|
|
617
|
+
children: /* @__PURE__ */ A(B, { name: "arrow-left" })
|
|
618
|
+
}),
|
|
619
|
+
/* @__PURE__ */ j("span", { children: [
|
|
620
|
+
"Page ",
|
|
621
|
+
_ + 1,
|
|
622
|
+
" of ",
|
|
623
|
+
g
|
|
624
|
+
] }),
|
|
625
|
+
/* @__PURE__ */ A(R, {
|
|
626
|
+
variant: "text",
|
|
627
|
+
"aria-label": "Next page",
|
|
628
|
+
isDisabled: _ === g - 1,
|
|
629
|
+
onPress: () => p(_ + 1),
|
|
630
|
+
children: /* @__PURE__ */ A(B, { name: "arrow-right" })
|
|
631
|
+
})
|
|
632
|
+
]
|
|
633
|
+
})
|
|
634
|
+
]
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
var X = {
|
|
638
|
+
alert: "_alert_swrmo_1",
|
|
639
|
+
title: "_title_swrmo_30",
|
|
640
|
+
region: "_region_swrmo_34",
|
|
641
|
+
dismiss: "_dismiss_swrmo_45"
|
|
642
|
+
};
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region src/components/notifications/notifications.tsx
|
|
645
|
+
function De({ tone: e = "info", title: t, children: n, className: r, role: i, ...a }) {
|
|
646
|
+
return /* @__PURE__ */ A("div", {
|
|
647
|
+
...a,
|
|
648
|
+
role: i ?? (e === "error" ? "alert" : "status"),
|
|
649
|
+
className: I(X.alert, r),
|
|
650
|
+
"data-tone": e,
|
|
651
|
+
children: /* @__PURE__ */ j("div", { children: [t && /* @__PURE__ */ A("strong", {
|
|
652
|
+
className: X.title,
|
|
653
|
+
children: t
|
|
654
|
+
}), n] })
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
var Z = ie(null);
|
|
658
|
+
function Oe({ notification: e, dismiss: t }) {
|
|
659
|
+
let [n, r] = F(!1), [i, a] = F(!1), o = P(e.duration);
|
|
660
|
+
return oe(() => {
|
|
661
|
+
if (n || i || e.duration <= 0) return;
|
|
662
|
+
let r = Date.now(), a = setTimeout(() => t(e.id), Math.max(0, o.current));
|
|
663
|
+
return () => {
|
|
664
|
+
clearTimeout(a), o.current = Math.max(0, o.current - (Date.now() - r));
|
|
665
|
+
};
|
|
666
|
+
}, [
|
|
667
|
+
n,
|
|
668
|
+
i,
|
|
669
|
+
e.duration,
|
|
670
|
+
e.id,
|
|
671
|
+
t
|
|
672
|
+
]), /* @__PURE__ */ j("div", {
|
|
673
|
+
className: X.alert,
|
|
674
|
+
"data-tone": e.tone,
|
|
675
|
+
role: e.tone === "error" ? "alert" : "status",
|
|
676
|
+
onMouseEnter: () => r(!0),
|
|
677
|
+
onMouseLeave: () => r(!1),
|
|
678
|
+
onFocus: () => a(!0),
|
|
679
|
+
onBlur: (e) => {
|
|
680
|
+
e.currentTarget.contains(e.relatedTarget) || a(!1);
|
|
681
|
+
},
|
|
682
|
+
children: [/* @__PURE__ */ j("div", { children: [e.title && /* @__PURE__ */ A("strong", {
|
|
683
|
+
className: X.title,
|
|
684
|
+
children: e.title
|
|
685
|
+
}), e.message] }), /* @__PURE__ */ A("button", {
|
|
686
|
+
className: X.dismiss,
|
|
687
|
+
onClick: () => t(e.id),
|
|
688
|
+
"aria-label": "Dismiss notification",
|
|
689
|
+
children: /* @__PURE__ */ A(B, { name: "close" })
|
|
690
|
+
})]
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
function ke({ children: e, defaultDuration: t = 4e3 }) {
|
|
694
|
+
let [n, r] = F([]), i = P(0), a = M((e) => r((t) => t.filter((t) => t.id !== e)), []), o = M(() => r([]), []), s = M((e, n, a = {}) => {
|
|
695
|
+
let o = ++i.current;
|
|
696
|
+
return r((r) => [...r, {
|
|
697
|
+
...a,
|
|
698
|
+
id: o,
|
|
699
|
+
tone: e,
|
|
700
|
+
message: n,
|
|
701
|
+
duration: a.duration ?? t
|
|
702
|
+
}]), o;
|
|
703
|
+
}, [t]), c = se(() => ({
|
|
704
|
+
info: (e, t) => s("info", e, t),
|
|
705
|
+
success: (e, t) => s("success", e, t),
|
|
706
|
+
warn: (e, t) => s("warn", e, t),
|
|
707
|
+
error: (e, t) => s("error", e, t),
|
|
708
|
+
dismiss: a,
|
|
709
|
+
clear: o
|
|
710
|
+
}), [
|
|
711
|
+
s,
|
|
712
|
+
a,
|
|
713
|
+
o
|
|
714
|
+
]);
|
|
715
|
+
return /* @__PURE__ */ j(Z, {
|
|
716
|
+
value: c,
|
|
717
|
+
children: [e, n.length > 0 && typeof document < "u" && ce(/* @__PURE__ */ A("section", {
|
|
718
|
+
className: X.region,
|
|
719
|
+
"aria-label": "Notifications",
|
|
720
|
+
"data-react-aria-top-layer": !0,
|
|
721
|
+
children: n.map((e) => /* @__PURE__ */ A(Oe, {
|
|
722
|
+
notification: e,
|
|
723
|
+
dismiss: a
|
|
724
|
+
}, e.id))
|
|
725
|
+
}), document.body)]
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
function Ae() {
|
|
729
|
+
let e = ae(Z);
|
|
730
|
+
if (!e) throw Error("useNotifications must be used within NotificationsProvider.");
|
|
731
|
+
return e;
|
|
732
|
+
}
|
|
733
|
+
var Q = {
|
|
734
|
+
bars: "_bars_12foz_1",
|
|
735
|
+
stretch: "_stretch_12foz_1",
|
|
736
|
+
spinner: "_spinner_12foz_25",
|
|
737
|
+
spin: "_spin_12foz_25",
|
|
738
|
+
progress: "_progress_12foz_34",
|
|
739
|
+
track: "_track_12foz_41",
|
|
740
|
+
fill: "_fill_12foz_47",
|
|
741
|
+
travel: "_travel_12foz_1"
|
|
742
|
+
};
|
|
743
|
+
//#endregion
|
|
744
|
+
//#region src/components/loader/loader.tsx
|
|
745
|
+
function je({ label: e = "Loading", color: t, className: n }) {
|
|
746
|
+
return /* @__PURE__ */ A("div", {
|
|
747
|
+
role: "progressbar",
|
|
748
|
+
"aria-label": e,
|
|
749
|
+
"aria-busy": "true",
|
|
750
|
+
className: I(Q.bars, n),
|
|
751
|
+
style: { "--bt-bar-loader-color": t },
|
|
752
|
+
children: [
|
|
753
|
+
0,
|
|
754
|
+
1,
|
|
755
|
+
2,
|
|
756
|
+
3,
|
|
757
|
+
4
|
|
758
|
+
].map((e) => /* @__PURE__ */ A("span", { "aria-hidden": "true" }, e))
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
function Me({ label: e = "Loading", className: t }) {
|
|
762
|
+
return /* @__PURE__ */ A("div", {
|
|
763
|
+
role: "progressbar",
|
|
764
|
+
"aria-label": e,
|
|
765
|
+
"aria-busy": "true",
|
|
766
|
+
className: I(Q.spinner, t)
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
function Ne({ label: e, className: t, ...n }) {
|
|
770
|
+
return /* @__PURE__ */ A(b, {
|
|
771
|
+
...n,
|
|
772
|
+
className: I(Q.progress, t),
|
|
773
|
+
children: ({ percentage: t, isIndeterminate: n }) => /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(l, { children: e }), /* @__PURE__ */ A("div", {
|
|
774
|
+
className: Q.track,
|
|
775
|
+
children: /* @__PURE__ */ A("div", {
|
|
776
|
+
className: Q.fill,
|
|
777
|
+
"data-indeterminate": n || void 0,
|
|
778
|
+
style: { width: n ? "35%" : `${t}%` }
|
|
779
|
+
})
|
|
780
|
+
})] })
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
var $ = {
|
|
784
|
+
card: "_card_1qbnp_1",
|
|
785
|
+
badge: "_badge_1qbnp_14",
|
|
786
|
+
heading: "_heading_1qbnp_41",
|
|
787
|
+
text: "_text_1qbnp_63",
|
|
788
|
+
muted: "_muted_1qbnp_68",
|
|
789
|
+
code: "_code_1qbnp_71",
|
|
790
|
+
divider: "_divider_1qbnp_81"
|
|
791
|
+
};
|
|
792
|
+
//#endregion
|
|
793
|
+
//#region src/components/surface/surface.tsx
|
|
794
|
+
function Pe({ variant: e = "outlined", className: t, ...n }) {
|
|
795
|
+
return /* @__PURE__ */ A("section", {
|
|
796
|
+
...n,
|
|
797
|
+
className: I($.card, t),
|
|
798
|
+
"data-variant": e
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
function Fe({ tone: e = "neutral", className: t, ...n }) {
|
|
802
|
+
return /* @__PURE__ */ A("span", {
|
|
803
|
+
...n,
|
|
804
|
+
className: I($.badge, t),
|
|
805
|
+
"data-tone": e
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
function Ie({ level: e = 2, className: t, ...n }) {
|
|
809
|
+
let r = `h${e}`;
|
|
810
|
+
return /* @__PURE__ */ A(r, {
|
|
811
|
+
...n,
|
|
812
|
+
className: I($.heading, t)
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
function Le({ muted: e = !1, className: t, ...n }) {
|
|
816
|
+
return /* @__PURE__ */ A("p", {
|
|
817
|
+
...n,
|
|
818
|
+
className: I($.text, e && $.muted, t)
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
function Re({ children: e }) {
|
|
822
|
+
return /* @__PURE__ */ A("code", {
|
|
823
|
+
className: $.code,
|
|
824
|
+
children: e
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
function ze() {
|
|
828
|
+
return /* @__PURE__ */ A("hr", { className: $.divider });
|
|
829
|
+
}
|
|
830
|
+
//#endregion
|
|
831
|
+
export { De as Alert, Fe as Badge, je as BarLoader, R as Button, Pe as Card, he as Checkbox, Re as Code, me as ComboBox, Ee as DataTable, Ce as Dialog, i as DialogTrigger, ze as Divider, ye as DonutSlider, Ie as Heading, le as LinkButton, G as Menu, be as MenuItem, K as MenuPopover, xe as MenuSeparator, h as MenuTrigger, ke as NotificationsProvider, Ne as ProgressBar, _e as Radio, ge as RadioGroup, pe as Select, Me as Spinner, Se as SplitButton, E as SubmenuTrigger, ve as Switch, Le as Text, ue as TextField, Te as Tooltip, Ae as useNotifications };
|