@wealth-os/design-system 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +11 -3
- package/dist/button-yvMc7CT-.js +47 -0
- package/dist/command-menu.js +34 -22
- package/dist/components/advanced-controls.d.ts +13 -6
- package/dist/components/button.d.ts +3 -0
- package/dist/components/date-input.d.ts +3 -1
- package/dist/components/date-range-picker.d.ts +3 -1
- package/dist/components/navigation.d.ts +7 -1
- package/dist/components/number-input.d.ts +2 -0
- package/dist/components/select-menu.d.ts +3 -1
- package/dist/components/select.d.ts +3 -1
- package/dist/components/surface.d.ts +1 -0
- package/dist/components/text-input.d.ts +2 -0
- package/dist/components/textarea.d.ts +2 -0
- package/dist/data-table.js +9 -9
- package/dist/financial.js +2 -2
- package/dist/{form-D3G5306m.js → form-Csxly6Es.js} +1 -1
- package/dist/forms.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +683 -654
- package/dist/lib/control-density.d.ts +3 -0
- package/dist/navigation.d.ts +1 -1
- package/dist/navigation.js +126 -124
- package/dist/{notice-D5u9rkFU.js → notice-jbY9FQu_.js} +2 -2
- package/dist/{overlays-9ArfwHJo.js → overlays-BleXRtz6.js} +7 -7
- package/dist/overlays.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tokens.css +54 -15
- package/docs/accessibility.md +27 -1
- package/docs/components.md +58 -4
- package/docs/migration.md +91 -0
- package/docs/tokens.md +94 -18
- package/package.json +4 -2
- package/dist/button-MVZPcSXf.js +0 -41
package/dist/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { i
|
|
5
|
-
import { n as
|
|
6
|
-
import { C as
|
|
7
|
-
import * as
|
|
8
|
-
import { cva as
|
|
9
|
-
import { Fragment as
|
|
2
|
+
import { n as e, r as t, t as n } from "./button-yvMc7CT-.js";
|
|
3
|
+
import { t as r } from "./utils-CX-Pz5p6.js";
|
|
4
|
+
import { i, n as a, r as o, t as s } from "./form-Csxly6Es.js";
|
|
5
|
+
import { n as c, t as l } from "./notice-jbY9FQu_.js";
|
|
6
|
+
import { C as u, S as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, l as x, m as S, n as C, o as w, p as T, r as E, s as D, t as O, u as k, v as A, x as j, y as M } from "./data-display-BA7t1E4G.js";
|
|
7
|
+
import * as N from "react";
|
|
8
|
+
import { cva as P } from "class-variance-authority";
|
|
9
|
+
import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/icon-button.tsx
|
|
11
|
-
var
|
|
11
|
+
var R = N.forwardRef(({ label: e, icon: t, size: r = "md", ...i }, a) => /* @__PURE__ */ I(n, {
|
|
12
12
|
...i,
|
|
13
13
|
ref: a,
|
|
14
14
|
size: r === "sm" ? "icon-sm" : r === "lg" ? "icon-lg" : "icon",
|
|
15
15
|
"aria-label": e,
|
|
16
|
-
children: /* @__PURE__ */
|
|
16
|
+
children: /* @__PURE__ */ I("span", {
|
|
17
17
|
"aria-hidden": "true",
|
|
18
18
|
className: "inline-flex items-center justify-center",
|
|
19
19
|
children: t
|
|
20
20
|
})
|
|
21
21
|
}));
|
|
22
|
-
|
|
22
|
+
R.displayName = "IconButton";
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/components/button-group.tsx
|
|
25
|
-
var
|
|
25
|
+
var z = N.forwardRef(({ orientation: e = "horizontal", className: t, children: n, ...i }, a) => /* @__PURE__ */ I("div", {
|
|
26
26
|
...i,
|
|
27
27
|
ref: a,
|
|
28
28
|
role: "group",
|
|
29
|
-
"data-orientation":
|
|
30
|
-
className:
|
|
31
|
-
children:
|
|
29
|
+
"data-orientation": e,
|
|
30
|
+
className: r("inline-flex gap-2", e === "horizontal" ? "flex-row flex-wrap items-center" : "flex-col items-stretch", t),
|
|
31
|
+
children: n
|
|
32
32
|
}));
|
|
33
|
-
|
|
33
|
+
z.displayName = "ButtonGroup";
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/components/icons.tsx
|
|
36
|
-
function
|
|
36
|
+
function B({ name: e, size: t = 16, strokeWidth: n = 1.75, className: r }) {
|
|
37
37
|
let i = {
|
|
38
38
|
fill: "none",
|
|
39
39
|
stroke: "currentColor",
|
|
@@ -41,43 +41,43 @@ function z({ name: e, size: t = 16, strokeWidth: n = 1.75, className: r }) {
|
|
|
41
41
|
strokeLinecap: "round",
|
|
42
42
|
strokeLinejoin: "round"
|
|
43
43
|
}, a = {
|
|
44
|
-
check: /* @__PURE__ */
|
|
44
|
+
check: /* @__PURE__ */ I("path", {
|
|
45
45
|
...i,
|
|
46
46
|
d: "M12.5 4 6.5 10 3.5 7"
|
|
47
47
|
}),
|
|
48
|
-
"chevron-down": /* @__PURE__ */
|
|
48
|
+
"chevron-down": /* @__PURE__ */ I("path", {
|
|
49
49
|
...i,
|
|
50
50
|
d: "m4 6 4 4 4-4"
|
|
51
51
|
}),
|
|
52
|
-
"chevron-left": /* @__PURE__ */
|
|
52
|
+
"chevron-left": /* @__PURE__ */ I("path", {
|
|
53
53
|
...i,
|
|
54
54
|
d: "m9 4-4 4 4 4"
|
|
55
55
|
}),
|
|
56
|
-
"chevron-right": /* @__PURE__ */
|
|
56
|
+
"chevron-right": /* @__PURE__ */ I("path", {
|
|
57
57
|
...i,
|
|
58
58
|
d: "m7 4 4 4-4 4"
|
|
59
59
|
}),
|
|
60
|
-
"chevrons-left": /* @__PURE__ */
|
|
60
|
+
"chevrons-left": /* @__PURE__ */ I("path", {
|
|
61
61
|
...i,
|
|
62
62
|
d: "m10 4-4 4 4 4M6 4 2 8l4 4"
|
|
63
63
|
}),
|
|
64
|
-
"chevrons-right": /* @__PURE__ */
|
|
64
|
+
"chevrons-right": /* @__PURE__ */ I("path", {
|
|
65
65
|
...i,
|
|
66
66
|
d: "m6 4 4 4-4 4m4-8 4 4-4 4"
|
|
67
67
|
}),
|
|
68
|
-
calendar: /* @__PURE__ */
|
|
68
|
+
calendar: /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I("rect", {
|
|
69
69
|
...i,
|
|
70
70
|
x: "2",
|
|
71
71
|
y: "3",
|
|
72
72
|
width: "12",
|
|
73
73
|
height: "11",
|
|
74
74
|
rx: "2"
|
|
75
|
-
}), /* @__PURE__ */
|
|
75
|
+
}), /* @__PURE__ */ I("path", {
|
|
76
76
|
...i,
|
|
77
77
|
d: "M5 1.5v3M11 1.5v3M2 6.5h12"
|
|
78
78
|
})] })
|
|
79
79
|
};
|
|
80
|
-
return /* @__PURE__ */
|
|
80
|
+
return /* @__PURE__ */ I("svg", {
|
|
81
81
|
"aria-hidden": "true",
|
|
82
82
|
className: r,
|
|
83
83
|
width: t,
|
|
@@ -88,69 +88,71 @@ function z({ name: e, size: t = 16, strokeWidth: n = 1.75, className: r }) {
|
|
|
88
88
|
}
|
|
89
89
|
//#endregion
|
|
90
90
|
//#region src/components/text-input.tsx
|
|
91
|
-
var
|
|
91
|
+
var V = N.forwardRef(({ className: e, type: n = "text", invalid: i, density: a, "aria-invalid": o, ...s }, c) => /* @__PURE__ */ I("input", {
|
|
92
92
|
type: n,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
"data-density": a,
|
|
94
|
+
className: r("wos-field block", t(a), e),
|
|
95
|
+
"aria-invalid": i || o || void 0,
|
|
96
|
+
ref: c,
|
|
97
|
+
...s
|
|
97
98
|
}));
|
|
98
|
-
|
|
99
|
+
V.displayName = "TextInput";
|
|
99
100
|
//#endregion
|
|
100
101
|
//#region src/components/number-input.tsx
|
|
101
|
-
var
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
].filter(Boolean).join(" ") || void 0,
|
|
107
|
-
re(
|
|
102
|
+
var H = N.forwardRef(({ label: e, value: n, onChange: i, density: a, help: s, error: c, invalid: l, disabled: u, placeholder: d, inputMode: f = "decimal", prefix: p, suffix: m, format: h, className: g, inputClassName: _, id: v, name: y, inputRef: b, onBlur: x, "aria-describedby": S, ...C }, w) => {
|
|
103
|
+
let T = N.useId(), E = v ?? T, D = [
|
|
104
|
+
S,
|
|
105
|
+
s ? `${E}-help` : void 0,
|
|
106
|
+
c ? `${E}-error` : void 0
|
|
107
|
+
].filter(Boolean).join(" ") || void 0, O = (e) => {
|
|
108
|
+
re(w, e), re(b, e);
|
|
108
109
|
};
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
-
label:
|
|
111
|
-
help:
|
|
112
|
-
error:
|
|
113
|
-
htmlFor:
|
|
114
|
-
className:
|
|
115
|
-
children: /* @__PURE__ */
|
|
116
|
-
className: "relative",
|
|
110
|
+
return /* @__PURE__ */ I(o, {
|
|
111
|
+
label: e,
|
|
112
|
+
help: s,
|
|
113
|
+
error: c,
|
|
114
|
+
htmlFor: E,
|
|
115
|
+
className: g,
|
|
116
|
+
children: /* @__PURE__ */ L("div", {
|
|
117
|
+
className: r("relative", t(a)),
|
|
117
118
|
"data-field-container": "true",
|
|
118
119
|
children: [
|
|
119
|
-
|
|
120
|
+
p != null && p !== "" && /* @__PURE__ */ I("span", {
|
|
120
121
|
"aria-hidden": "true",
|
|
121
|
-
className: "pointer-events-none absolute inset-y-0 left-2.5 flex items-center text-[length:var(--type-size-control)] text-muted-foreground",
|
|
122
|
-
children:
|
|
122
|
+
className: "pointer-events-none absolute inset-y-0 left-2.5 flex items-center text-[length:var(--wos-control-font-size,var(--type-size-control))] text-muted-foreground",
|
|
123
|
+
children: p
|
|
123
124
|
}),
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
...
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
/* @__PURE__ */ I(V, {
|
|
126
|
+
...C,
|
|
127
|
+
density: a,
|
|
128
|
+
ref: O,
|
|
129
|
+
id: E,
|
|
130
|
+
name: y,
|
|
129
131
|
type: "text",
|
|
130
|
-
inputMode:
|
|
132
|
+
inputMode: f,
|
|
131
133
|
value: n,
|
|
132
|
-
placeholder:
|
|
133
|
-
disabled:
|
|
134
|
-
invalid:
|
|
135
|
-
"aria-describedby":
|
|
136
|
-
"aria-errormessage":
|
|
137
|
-
className:
|
|
138
|
-
onChange: (e) =>
|
|
134
|
+
placeholder: d,
|
|
135
|
+
disabled: u,
|
|
136
|
+
invalid: l || !!c,
|
|
137
|
+
"aria-describedby": D,
|
|
138
|
+
"aria-errormessage": c ? `${E}-error` : void 0,
|
|
139
|
+
className: r(p ? "pl-6" : void 0, m ? "pr-14" : void 0, "tabular", _),
|
|
140
|
+
onChange: (e) => i(e.currentTarget.value),
|
|
139
141
|
onBlur: (e) => {
|
|
140
|
-
|
|
142
|
+
h && i(ne(e.currentTarget.value, h)), x?.(e);
|
|
141
143
|
}
|
|
142
144
|
}),
|
|
143
|
-
|
|
145
|
+
m != null && m !== "" && /* @__PURE__ */ I("span", {
|
|
144
146
|
"aria-hidden": "true",
|
|
145
147
|
className: "pointer-events-none absolute inset-y-0 right-2.5 flex items-center text-[13px] text-muted-foreground",
|
|
146
|
-
children:
|
|
148
|
+
children: m
|
|
147
149
|
})
|
|
148
150
|
]
|
|
149
151
|
})
|
|
150
152
|
});
|
|
151
153
|
});
|
|
152
|
-
|
|
153
|
-
var ee =
|
|
154
|
+
H.displayName = "NumberInput";
|
|
155
|
+
var ee = N.forwardRef(({ prefix: e = "$", ...t }, n) => /* @__PURE__ */ I(H, {
|
|
154
156
|
...t,
|
|
155
157
|
ref: n,
|
|
156
158
|
prefix: e,
|
|
@@ -158,7 +160,7 @@ var ee = M.forwardRef(({ prefix: e = "$", ...t }, n) => /* @__PURE__ */ F(V, {
|
|
|
158
160
|
format: "money"
|
|
159
161
|
}));
|
|
160
162
|
ee.displayName = "MoneyInput";
|
|
161
|
-
var te =
|
|
163
|
+
var te = N.forwardRef(({ prefix: e, ...t }, n) => /* @__PURE__ */ I(H, {
|
|
162
164
|
...t,
|
|
163
165
|
ref: n,
|
|
164
166
|
prefix: e,
|
|
@@ -180,138 +182,141 @@ function re(e, t) {
|
|
|
180
182
|
}
|
|
181
183
|
//#endregion
|
|
182
184
|
//#region src/components/select-menu.tsx
|
|
183
|
-
function
|
|
184
|
-
let
|
|
185
|
+
function U({ id: e, value: n, onChange: i, options: a, placeholder: o, ariaLabel: s, className: c = "", compact: l = !1, density: u, tone: d, disabled: f, "aria-describedby": p, "aria-invalid": m }) {
|
|
186
|
+
let h = N.useId(), g = e ?? h, _ = `${g}-list`, [v, y] = N.useState(!1), [b, x] = N.useState(-1), [S, C] = N.useState(!1), w = N.useRef(null), T = N.useRef(null), E = N.useRef({
|
|
185
187
|
text: "",
|
|
186
188
|
at: 0
|
|
187
|
-
}),
|
|
188
|
-
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
for (let n = e + t; n >= 0 && n <
|
|
189
|
+
}), D = a.findIndex((e) => e.value === n), O = D >= 0 ? a[D] : null, k = (e) => e >= 0 && e < a.length && !a[e].disabled, A = (e = D) => {
|
|
190
|
+
x(k(e) ? e : a.findIndex((e) => !e.disabled)), y(!0);
|
|
191
|
+
}, j = (e = !0) => {
|
|
192
|
+
y(!1), e && w.current?.querySelector("button")?.focus();
|
|
193
|
+
}, M = (e) => {
|
|
194
|
+
k(e) && (a[e].value !== n && i(a[e].value), j());
|
|
195
|
+
}, P = (e, t) => {
|
|
196
|
+
for (let n = e + t; n >= 0 && n < a.length; n += t) if (!a[n].disabled) return n;
|
|
195
197
|
return e;
|
|
196
198
|
};
|
|
197
|
-
return
|
|
198
|
-
if (!
|
|
199
|
+
return N.useEffect(() => {
|
|
200
|
+
if (!v) return;
|
|
199
201
|
let e = (e) => {
|
|
200
|
-
|
|
202
|
+
w.current?.contains(e.target) || y(!1);
|
|
201
203
|
};
|
|
202
204
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
203
|
-
}, [
|
|
204
|
-
if (!
|
|
205
|
-
let e =
|
|
206
|
-
|
|
207
|
-
}, [
|
|
208
|
-
|
|
209
|
-
}, [
|
|
210
|
-
ref:
|
|
211
|
-
className:
|
|
212
|
-
children: [/* @__PURE__ */
|
|
213
|
-
id:
|
|
205
|
+
}, [v]), N.useLayoutEffect(() => {
|
|
206
|
+
if (!v || !w.current) return;
|
|
207
|
+
let e = w.current.getBoundingClientRect();
|
|
208
|
+
C(window.innerHeight - e.bottom < 260 && e.top > window.innerHeight - e.bottom);
|
|
209
|
+
}, [v]), N.useEffect(() => {
|
|
210
|
+
v && b >= 0 && (T.current?.children[b])?.scrollIntoView?.({ block: "nearest" });
|
|
211
|
+
}, [v, b]), /* @__PURE__ */ L("div", {
|
|
212
|
+
ref: w,
|
|
213
|
+
className: r("relative", t(u), c.includes("w-") ? void 0 : "w-full", c),
|
|
214
|
+
children: [/* @__PURE__ */ L("button", {
|
|
215
|
+
id: g,
|
|
216
|
+
"data-density": u,
|
|
214
217
|
type: "button",
|
|
215
218
|
role: "combobox",
|
|
216
219
|
"aria-haspopup": "listbox",
|
|
217
|
-
"aria-expanded":
|
|
218
|
-
"aria-controls":
|
|
219
|
-
"aria-label":
|
|
220
|
-
"aria-activedescendant":
|
|
221
|
-
"aria-describedby":
|
|
222
|
-
"aria-invalid":
|
|
223
|
-
disabled:
|
|
224
|
-
className:
|
|
225
|
-
onClick: () =>
|
|
220
|
+
"aria-expanded": v,
|
|
221
|
+
"aria-controls": _,
|
|
222
|
+
"aria-label": s,
|
|
223
|
+
"aria-activedescendant": v && b >= 0 ? `${_}-${b}` : void 0,
|
|
224
|
+
"aria-describedby": p,
|
|
225
|
+
"aria-invalid": m,
|
|
226
|
+
disabled: f,
|
|
227
|
+
className: r("wos-field flex items-center justify-between gap-2 text-left", u ? "h-[var(--wos-control-height)]" : l ? "h-8" : "h-9", d),
|
|
228
|
+
onClick: () => v ? j(!1) : A(),
|
|
226
229
|
onKeyDown: (e) => {
|
|
227
230
|
let t = e.key;
|
|
228
|
-
if (!
|
|
231
|
+
if (!v) [
|
|
229
232
|
"ArrowDown",
|
|
230
233
|
"ArrowUp",
|
|
231
234
|
"Enter",
|
|
232
235
|
" "
|
|
233
|
-
].includes(t) && (e.preventDefault(),
|
|
234
|
-
else if (t === "Escape") e.preventDefault(),
|
|
235
|
-
else if (t === "Tab")
|
|
236
|
-
else if (t === "ArrowDown") e.preventDefault(),
|
|
237
|
-
else if (t === "ArrowUp") e.preventDefault(),
|
|
238
|
-
else if (t === "Home") e.preventDefault(),
|
|
239
|
-
else if (t === "End") e.preventDefault(),
|
|
240
|
-
else if (t === "Enter" || t === " ") e.preventDefault(),
|
|
236
|
+
].includes(t) && (e.preventDefault(), A());
|
|
237
|
+
else if (t === "Escape") e.preventDefault(), j();
|
|
238
|
+
else if (t === "Tab") y(!1);
|
|
239
|
+
else if (t === "ArrowDown") e.preventDefault(), x((e) => P(e, 1));
|
|
240
|
+
else if (t === "ArrowUp") e.preventDefault(), x((e) => P(e, -1));
|
|
241
|
+
else if (t === "Home") e.preventDefault(), x(P(-1, 1));
|
|
242
|
+
else if (t === "End") e.preventDefault(), x(P(a.length, -1));
|
|
243
|
+
else if (t === "Enter" || t === " ") e.preventDefault(), M(b);
|
|
241
244
|
else if (t.length === 1 && /\S/.test(t)) {
|
|
242
|
-
let e = Date.now(), n = e -
|
|
243
|
-
|
|
245
|
+
let e = Date.now(), n = e - E.current.at < 500 ? E.current.text + t.toLowerCase() : t.toLowerCase();
|
|
246
|
+
E.current = {
|
|
244
247
|
text: n,
|
|
245
248
|
at: e
|
|
246
249
|
};
|
|
247
|
-
let r = n.length === 1 ?
|
|
248
|
-
|
|
250
|
+
let r = n.length === 1 ? b + 1 : b, i = [...a.keys()].map((e) => (r + e) % a.length).find((e) => k(e) && a[e].label.toLowerCase().startsWith(n));
|
|
251
|
+
i !== void 0 && x(i);
|
|
249
252
|
}
|
|
250
253
|
},
|
|
251
|
-
children: [/* @__PURE__ */
|
|
252
|
-
className:
|
|
253
|
-
children:
|
|
254
|
-
}), /* @__PURE__ */
|
|
254
|
+
children: [/* @__PURE__ */ I("span", {
|
|
255
|
+
className: r("truncate", O ? void 0 : "text-muted-foreground"),
|
|
256
|
+
children: O?.label ?? o ?? "Choose"
|
|
257
|
+
}), /* @__PURE__ */ I(B, {
|
|
255
258
|
name: "chevron-down",
|
|
256
|
-
className:
|
|
259
|
+
className: r("shrink-0 text-muted-foreground transition-transform", v && "rotate-180")
|
|
257
260
|
})]
|
|
258
|
-
}),
|
|
259
|
-
ref:
|
|
260
|
-
id:
|
|
261
|
+
}), v && /* @__PURE__ */ I("ul", {
|
|
262
|
+
ref: T,
|
|
263
|
+
id: _,
|
|
261
264
|
role: "listbox",
|
|
262
|
-
"aria-labelledby":
|
|
263
|
-
"aria-label":
|
|
264
|
-
className:
|
|
265
|
-
children:
|
|
266
|
-
id: `${
|
|
265
|
+
"aria-labelledby": s ? void 0 : g,
|
|
266
|
+
"aria-label": s,
|
|
267
|
+
className: r("absolute left-0 z-50 max-h-[280px] min-w-full overflow-y-auto rounded-[var(--control-radius)] border border-border bg-surface py-1 shadow-working", S ? "bottom-full mb-1" : "top-full mt-1"),
|
|
268
|
+
children: a.map((e, t) => /* @__PURE__ */ L("li", {
|
|
269
|
+
id: `${_}-${t}`,
|
|
267
270
|
role: "option",
|
|
268
|
-
"
|
|
269
|
-
"aria-
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
"data-active": t === b || void 0,
|
|
272
|
+
"aria-selected": t === D,
|
|
273
|
+
"aria-disabled": e.disabled || void 0,
|
|
274
|
+
className: r("wos-option flex cursor-pointer items-center gap-2 whitespace-nowrap px-3 text-[length:var(--wos-control-font-size,var(--type-size-control))]", u ? "h-[var(--wos-control-height)]" : "h-9", e.disabled ? "cursor-default text-muted-foreground" : t === b ? "bg-surface-subtle text-foreground" : "text-secondary-foreground"),
|
|
275
|
+
onPointerEnter: () => !e.disabled && x(t),
|
|
272
276
|
onPointerDown: (e) => e.preventDefault(),
|
|
273
|
-
onClick: () =>
|
|
274
|
-
children: [/* @__PURE__ */
|
|
277
|
+
onClick: () => M(t),
|
|
278
|
+
children: [/* @__PURE__ */ I("span", {
|
|
275
279
|
className: "w-4 shrink-0",
|
|
276
|
-
children:
|
|
280
|
+
children: t === D && /* @__PURE__ */ I(B, {
|
|
277
281
|
name: "check",
|
|
278
282
|
size: 14,
|
|
279
|
-
className: "text-
|
|
283
|
+
className: "text-selected"
|
|
280
284
|
})
|
|
281
|
-
}), /* @__PURE__ */
|
|
282
|
-
className:
|
|
283
|
-
children:
|
|
285
|
+
}), /* @__PURE__ */ I("span", {
|
|
286
|
+
className: t === D ? "font-medium text-foreground" : void 0,
|
|
287
|
+
children: e.label
|
|
284
288
|
})]
|
|
285
|
-
},
|
|
289
|
+
}, e.value || `empty-${t}`))
|
|
286
290
|
})]
|
|
287
291
|
});
|
|
288
292
|
}
|
|
289
|
-
|
|
293
|
+
U.displayName = "SelectMenu", U.fieldControl = !0;
|
|
290
294
|
//#endregion
|
|
291
295
|
//#region src/components/select.tsx
|
|
292
|
-
function ie({ label: e, value: t, onChange: n, options: r, help: i, error:
|
|
293
|
-
return /* @__PURE__ */
|
|
296
|
+
function ie({ label: e, value: t, onChange: n, options: r, help: i, error: a, placeholder: s, compact: c, density: l, disabled: u, className: d, menuClassName: f, id: p }) {
|
|
297
|
+
return /* @__PURE__ */ I(o, {
|
|
294
298
|
label: e,
|
|
295
299
|
help: i,
|
|
296
|
-
error:
|
|
297
|
-
htmlFor:
|
|
298
|
-
className:
|
|
299
|
-
children: /* @__PURE__ */
|
|
300
|
-
id:
|
|
300
|
+
error: a,
|
|
301
|
+
htmlFor: p,
|
|
302
|
+
className: d,
|
|
303
|
+
children: /* @__PURE__ */ I(U, {
|
|
304
|
+
id: p,
|
|
301
305
|
value: t,
|
|
302
306
|
onChange: n,
|
|
303
307
|
options: r,
|
|
304
308
|
placeholder: s,
|
|
305
309
|
compact: c,
|
|
306
|
-
|
|
307
|
-
|
|
310
|
+
density: l,
|
|
311
|
+
disabled: u,
|
|
312
|
+
className: f
|
|
308
313
|
})
|
|
309
314
|
});
|
|
310
315
|
}
|
|
311
316
|
ie.displayName = "Select";
|
|
312
317
|
//#endregion
|
|
313
318
|
//#region src/components/date-input.tsx
|
|
314
|
-
var
|
|
319
|
+
var W = [
|
|
315
320
|
"January",
|
|
316
321
|
"February",
|
|
317
322
|
"March",
|
|
@@ -353,26 +358,26 @@ var U = [
|
|
|
353
358
|
"Thursday",
|
|
354
359
|
"Friday",
|
|
355
360
|
"Saturday"
|
|
356
|
-
],
|
|
361
|
+
], G = /^\d{4}-\d{2}-\d{2}$/, K = (e) => String(e).padStart(2, "0"), q = (e, t, n) => {
|
|
357
362
|
let r = new Date(Date.UTC(e, t, n));
|
|
358
|
-
return `${r.getUTCFullYear()}-${
|
|
359
|
-
},
|
|
363
|
+
return `${r.getUTCFullYear()}-${K(r.getUTCMonth() + 1)}-${K(r.getUTCDate())}`;
|
|
364
|
+
}, J = (e) => ({
|
|
360
365
|
year: Number(e.slice(0, 4)),
|
|
361
366
|
month: Number(e.slice(5, 7)) - 1,
|
|
362
367
|
day: Number(e.slice(8, 10))
|
|
363
|
-
}),
|
|
364
|
-
let { year: n, month: r, day: i } =
|
|
365
|
-
return
|
|
366
|
-
},
|
|
367
|
-
let { year: n, month: r, day: i } =
|
|
368
|
-
return
|
|
369
|
-
},
|
|
370
|
-
let { year: t, month: n, day: r } =
|
|
368
|
+
}), Y = (e, t) => {
|
|
369
|
+
let { year: n, month: r, day: i } = J(e);
|
|
370
|
+
return q(n, r, i + t);
|
|
371
|
+
}, X = (e, t) => {
|
|
372
|
+
let { year: n, month: r, day: i } = J(e), a = new Date(Date.UTC(n, r + t + 1, 0)).getUTCDate();
|
|
373
|
+
return q(n, r + t, Math.min(i, a));
|
|
374
|
+
}, Z = (e) => {
|
|
375
|
+
let { year: t, month: n, day: r } = J(e);
|
|
371
376
|
return new Date(Date.UTC(t, n, r)).getUTCDay();
|
|
372
377
|
}, ce = () => {
|
|
373
378
|
let e = /* @__PURE__ */ new Date();
|
|
374
|
-
return `${e.getFullYear()}-${
|
|
375
|
-
},
|
|
379
|
+
return `${e.getFullYear()}-${K(e.getMonth() + 1)}-${K(e.getDate())}`;
|
|
380
|
+
}, le = (e) => G.test(e) ? `${e.slice(5, 7)}/${e.slice(8, 10)}/${e.slice(0, 4)}` : "", Q = (e) => {
|
|
376
381
|
let t = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e.trim());
|
|
377
382
|
if (!t) return null;
|
|
378
383
|
let [n, r, i] = [
|
|
@@ -380,167 +385,168 @@ var U = [
|
|
|
380
385
|
Number(t[2]),
|
|
381
386
|
Number(t[3])
|
|
382
387
|
], a = new Date(Date.UTC(i, n - 1, r));
|
|
383
|
-
return a.getUTCFullYear() !== i || a.getUTCMonth() !== n - 1 || a.getUTCDate() !== r ? null : `${i}-${
|
|
388
|
+
return a.getUTCFullYear() !== i || a.getUTCMonth() !== n - 1 || a.getUTCDate() !== r ? null : `${i}-${K(n)}-${K(r)}`;
|
|
384
389
|
};
|
|
385
|
-
function
|
|
390
|
+
function ue(e) {
|
|
386
391
|
let t = e.replace(/[^\d]/g, "").slice(0, 8);
|
|
387
392
|
return e.includes("/") ? e.replace(/[^\d/]/g, "").slice(0, 10) : t.length > 4 ? `${t.slice(0, 2)}/${t.slice(2, 4)}/${t.slice(4)}` : t.length > 2 ? `${t.slice(0, 2)}/${t.slice(2)}` : t;
|
|
388
393
|
}
|
|
389
|
-
function $({ id:
|
|
390
|
-
let
|
|
391
|
-
|
|
392
|
-
Q(
|
|
393
|
-
}, [n]),
|
|
394
|
-
if (!
|
|
394
|
+
function $({ id: e, value: n, onChange: i, ariaLabel: a, min: o, max: s, disabled: c, required: l, invalid: u, compact: d, density: f, longDisplay: p, className: m = "", "aria-describedby": h, "aria-errormessage": g, "aria-invalid": _ }) {
|
|
395
|
+
let v = N.useId(), y = e ?? v, [b, x] = N.useState(le(n)), [S, C] = N.useState(!1), [w, T] = N.useState(!1), E = !!p && !w && G.test(n) && Q(b) === n, D = N.useRef(null), O = N.useRef(null);
|
|
396
|
+
N.useEffect(() => {
|
|
397
|
+
Q(b) !== n && (n !== "" || b === "" || Q(b) !== null) && x(le(n));
|
|
398
|
+
}, [n]), N.useEffect(() => {
|
|
399
|
+
if (!S) return;
|
|
395
400
|
let e = (e) => {
|
|
396
|
-
|
|
401
|
+
D.current?.contains(e.target) || C(!1);
|
|
397
402
|
};
|
|
398
403
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
399
|
-
}, [
|
|
400
|
-
let
|
|
401
|
-
let t =
|
|
402
|
-
|
|
404
|
+
}, [S]);
|
|
405
|
+
let k = (e) => {
|
|
406
|
+
let t = ue(e);
|
|
407
|
+
x(t), i(Q(t) ?? "");
|
|
403
408
|
};
|
|
404
|
-
return /* @__PURE__ */
|
|
405
|
-
ref:
|
|
406
|
-
className:
|
|
409
|
+
return /* @__PURE__ */ L("div", {
|
|
410
|
+
ref: D,
|
|
411
|
+
className: r("relative", t(f), m),
|
|
407
412
|
children: [
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
id:
|
|
410
|
-
|
|
413
|
+
/* @__PURE__ */ I("input", {
|
|
414
|
+
id: y,
|
|
415
|
+
"data-density": f,
|
|
416
|
+
className: r("wos-field pr-9 tabular disabled:cursor-not-allowed", !f && d && "h-8", E && "text-transparent"),
|
|
411
417
|
inputMode: "numeric",
|
|
412
418
|
placeholder: "MM/DD/YYYY",
|
|
413
419
|
autoComplete: "off",
|
|
414
|
-
required:
|
|
415
|
-
value:
|
|
416
|
-
onFocus: () =>
|
|
417
|
-
onBlur: () =>
|
|
418
|
-
disabled:
|
|
419
|
-
"aria-label":
|
|
420
|
-
"aria-invalid":
|
|
421
|
-
"aria-describedby":
|
|
422
|
-
"aria-errormessage":
|
|
423
|
-
onChange: (e) =>
|
|
420
|
+
required: l,
|
|
421
|
+
value: b,
|
|
422
|
+
onFocus: () => T(!0),
|
|
423
|
+
onBlur: () => T(!1),
|
|
424
|
+
disabled: c,
|
|
425
|
+
"aria-label": a,
|
|
426
|
+
"aria-invalid": u || _ || void 0,
|
|
427
|
+
"aria-describedby": h,
|
|
428
|
+
"aria-errormessage": g,
|
|
429
|
+
onChange: (e) => k(e.currentTarget.value)
|
|
424
430
|
}),
|
|
425
|
-
|
|
431
|
+
E && /* @__PURE__ */ I("span", {
|
|
426
432
|
"aria-hidden": "true",
|
|
427
|
-
className: "pointer-events-none absolute inset-y-0 left-3 flex items-center text-[
|
|
433
|
+
className: "pointer-events-none absolute inset-y-0 left-3 flex items-center text-[length:var(--wos-control-font-size,var(--type-size-control))] tabular",
|
|
428
434
|
"data-testid": "date-long",
|
|
429
|
-
children:
|
|
435
|
+
children: fe(n)
|
|
430
436
|
}),
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
-
ref:
|
|
437
|
+
/* @__PURE__ */ I("button", {
|
|
438
|
+
ref: O,
|
|
433
439
|
type: "button",
|
|
434
|
-
disabled:
|
|
435
|
-
className:
|
|
436
|
-
"aria-label": `Choose ${
|
|
440
|
+
disabled: c,
|
|
441
|
+
className: r("absolute inset-y-0 right-0.5 my-auto grid place-items-center rounded-[var(--control-radius-inner)] text-muted-foreground hover:bg-interaction-hover hover:text-foreground disabled:pointer-events-none", f ? "h-[calc(var(--wos-control-height)-4px)] w-[calc(var(--wos-control-height)-4px)]" : d ? "h-7 w-7" : "h-8 w-8"),
|
|
442
|
+
"aria-label": `Choose ${a ? a.toLowerCase() : "date"} from a calendar`,
|
|
437
443
|
"aria-haspopup": "dialog",
|
|
438
|
-
"aria-expanded":
|
|
439
|
-
onClick: () =>
|
|
440
|
-
children: /* @__PURE__ */
|
|
444
|
+
"aria-expanded": S,
|
|
445
|
+
onClick: () => C(!S),
|
|
446
|
+
children: /* @__PURE__ */ I(B, { name: "calendar" })
|
|
441
447
|
}),
|
|
442
|
-
|
|
443
|
-
value:
|
|
444
|
-
min:
|
|
445
|
-
max:
|
|
448
|
+
S && /* @__PURE__ */ I(pe, {
|
|
449
|
+
value: G.test(n) ? n : null,
|
|
450
|
+
min: o,
|
|
451
|
+
max: s,
|
|
446
452
|
onPick: (e) => {
|
|
447
|
-
|
|
453
|
+
x(le(e)), i(e), C(!1), O.current?.focus();
|
|
448
454
|
},
|
|
449
455
|
onClose: () => {
|
|
450
|
-
|
|
456
|
+
C(!1), O.current?.focus();
|
|
451
457
|
},
|
|
452
|
-
anchor:
|
|
458
|
+
anchor: D
|
|
453
459
|
})
|
|
454
460
|
]
|
|
455
461
|
});
|
|
456
462
|
}
|
|
457
463
|
$.displayName = "DateInput", $.fieldControl = !0;
|
|
458
|
-
function
|
|
459
|
-
return /* @__PURE__ */
|
|
464
|
+
function de({ label: e, help: t, error: n, confirm: r, ...i }) {
|
|
465
|
+
return /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I(o, {
|
|
460
466
|
label: e,
|
|
461
467
|
help: t,
|
|
462
468
|
error: n,
|
|
463
469
|
htmlFor: i.id,
|
|
464
|
-
children: /* @__PURE__ */
|
|
470
|
+
children: /* @__PURE__ */ I($, {
|
|
465
471
|
...i,
|
|
466
472
|
ariaLabel: typeof e == "string" ? e : void 0,
|
|
467
473
|
invalid: i.invalid || !!n
|
|
468
474
|
})
|
|
469
|
-
}), !n && r && /* @__PURE__ */
|
|
475
|
+
}), !n && r && /* @__PURE__ */ I("p", {
|
|
470
476
|
className: "mt-1 text-[length:var(--type-size-metadata)] text-secondary-foreground",
|
|
471
477
|
children: r
|
|
472
478
|
})] });
|
|
473
479
|
}
|
|
474
|
-
|
|
475
|
-
function
|
|
476
|
-
let { year: t, month: n, day: r } =
|
|
480
|
+
de.displayName = "UsDateInput";
|
|
481
|
+
function fe(e) {
|
|
482
|
+
let { year: t, month: n, day: r } = J(e);
|
|
477
483
|
return `${ae[n]} ${r}, ${t}`;
|
|
478
484
|
}
|
|
479
|
-
function
|
|
480
|
-
let s = ce(), c = (e) =>
|
|
481
|
-
|
|
485
|
+
function pe({ value: e, min: t, max: n, onPick: i, onClose: a, anchor: o }) {
|
|
486
|
+
let s = ce(), c = (e) => t && e < t ? t : n && e > n ? n : e, [l, u] = N.useState(() => c(e ?? s)), [d, f] = N.useState(!1), p = N.useRef(null), { year: m, month: h } = J(l), g = (e) => (!t || e >= t) && (!n || e <= n);
|
|
487
|
+
N.useLayoutEffect(() => {
|
|
482
488
|
let e = o.current?.getBoundingClientRect();
|
|
483
489
|
e && f(window.innerHeight - e.bottom < 360 && e.top > window.innerHeight - e.bottom);
|
|
484
|
-
}, [o]),
|
|
490
|
+
}, [o]), N.useEffect(() => {
|
|
485
491
|
p.current?.querySelector(`[data-day="${l}"]`)?.focus();
|
|
486
492
|
}, [l]);
|
|
487
|
-
let _ =
|
|
493
|
+
let _ = q(m, h, 1), v = Y(_, -Z(_)), y = Array.from({ length: 42 }, (e, t) => Y(v, t)), b = (e) => u(c(e)), x = (e) => {
|
|
488
494
|
let t = {
|
|
489
|
-
ArrowLeft: () =>
|
|
490
|
-
ArrowRight: () =>
|
|
491
|
-
ArrowUp: () =>
|
|
492
|
-
ArrowDown: () =>
|
|
493
|
-
Home: () =>
|
|
494
|
-
End: () =>
|
|
495
|
-
PageUp: () =>
|
|
496
|
-
PageDown: () =>
|
|
495
|
+
ArrowLeft: () => Y(l, -1),
|
|
496
|
+
ArrowRight: () => Y(l, 1),
|
|
497
|
+
ArrowUp: () => Y(l, -7),
|
|
498
|
+
ArrowDown: () => Y(l, 7),
|
|
499
|
+
Home: () => Y(l, -Z(l)),
|
|
500
|
+
End: () => Y(l, 6 - Z(l)),
|
|
501
|
+
PageUp: () => X(l, e.shiftKey ? -12 : -1),
|
|
502
|
+
PageDown: () => X(l, e.shiftKey ? 12 : 1)
|
|
497
503
|
};
|
|
498
504
|
t[e.key] ? (e.preventDefault(), b(t[e.key]())) : e.key === "Escape" && (e.preventDefault(), a());
|
|
499
|
-
}, S = (e, t, n) => /* @__PURE__ */
|
|
505
|
+
}, S = (e, t, n) => /* @__PURE__ */ I("button", {
|
|
500
506
|
type: "button",
|
|
501
|
-
className: "grid h-8 w-8 place-items-center rounded-[
|
|
507
|
+
className: "grid h-8 w-8 place-items-center rounded-[var(--control-radius-inner)] text-secondary-foreground hover:bg-interaction-hover",
|
|
502
508
|
"aria-label": e,
|
|
503
509
|
onClick: () => b(n),
|
|
504
510
|
children: t
|
|
505
511
|
});
|
|
506
|
-
return /* @__PURE__ */
|
|
512
|
+
return /* @__PURE__ */ L("div", {
|
|
507
513
|
role: "dialog",
|
|
508
514
|
"aria-modal": "false",
|
|
509
515
|
"aria-label": "Choose a date",
|
|
510
|
-
className:
|
|
516
|
+
className: r("absolute right-0 z-50 w-[300px] rounded-[var(--surface-radius)] border border-border bg-surface p-3 shadow-working", d ? "bottom-full mb-1" : "top-full mt-1"),
|
|
511
517
|
onKeyDown: x,
|
|
512
518
|
children: [
|
|
513
|
-
/* @__PURE__ */
|
|
519
|
+
/* @__PURE__ */ L("div", {
|
|
514
520
|
className: "flex items-center justify-between",
|
|
515
521
|
children: [
|
|
516
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ L("div", {
|
|
517
523
|
className: "flex",
|
|
518
|
-
children: [S("Previous year", /* @__PURE__ */
|
|
524
|
+
children: [S("Previous year", /* @__PURE__ */ I(B, { name: "chevrons-left" }), X(l, -12)), S("Previous month", /* @__PURE__ */ I(B, { name: "chevron-left" }), X(l, -1))]
|
|
519
525
|
}),
|
|
520
|
-
/* @__PURE__ */
|
|
521
|
-
className: "text-[
|
|
526
|
+
/* @__PURE__ */ L("p", {
|
|
527
|
+
className: "text-[length:var(--type-size-control)] font-semibold text-foreground",
|
|
522
528
|
"aria-live": "polite",
|
|
523
529
|
children: [
|
|
524
|
-
|
|
530
|
+
W[h],
|
|
525
531
|
" ",
|
|
526
532
|
m
|
|
527
533
|
]
|
|
528
534
|
}),
|
|
529
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ L("div", {
|
|
530
536
|
className: "flex",
|
|
531
|
-
children: [S("Next month", /* @__PURE__ */
|
|
537
|
+
children: [S("Next month", /* @__PURE__ */ I(B, { name: "chevron-right" }), X(l, 1)), S("Next year", /* @__PURE__ */ I(B, { name: "chevrons-right" }), X(l, 12))]
|
|
532
538
|
})
|
|
533
539
|
]
|
|
534
540
|
}),
|
|
535
|
-
/* @__PURE__ */
|
|
541
|
+
/* @__PURE__ */ L("div", {
|
|
536
542
|
ref: p,
|
|
537
543
|
role: "grid",
|
|
538
|
-
"aria-label": `${
|
|
544
|
+
"aria-label": `${W[h]} ${m}`,
|
|
539
545
|
className: "mt-2",
|
|
540
|
-
children: [/* @__PURE__ */
|
|
546
|
+
children: [/* @__PURE__ */ I("div", {
|
|
541
547
|
role: "row",
|
|
542
548
|
className: "grid grid-cols-7",
|
|
543
|
-
children: oe.map((e) => /* @__PURE__ */
|
|
549
|
+
children: oe.map((e) => /* @__PURE__ */ I("span", {
|
|
544
550
|
role: "columnheader",
|
|
545
551
|
className: "grid h-8 place-items-center text-[12px] font-medium text-muted-foreground",
|
|
546
552
|
children: e
|
|
@@ -552,40 +558,40 @@ function fe({ value: t, min: n, max: r, onPick: i, onClose: a, anchor: o }) {
|
|
|
552
558
|
3,
|
|
553
559
|
4,
|
|
554
560
|
5
|
|
555
|
-
].map((
|
|
561
|
+
].map((t) => /* @__PURE__ */ I("div", {
|
|
556
562
|
role: "row",
|
|
557
563
|
className: "grid grid-cols-7",
|
|
558
|
-
children: y.slice(
|
|
559
|
-
let
|
|
560
|
-
return /* @__PURE__ */
|
|
564
|
+
children: y.slice(t * 7, t * 7 + 7).map((t) => {
|
|
565
|
+
let n = J(t).month === h, a = t === e, o = g(t);
|
|
566
|
+
return /* @__PURE__ */ I("span", {
|
|
561
567
|
role: "gridcell",
|
|
562
|
-
children: /* @__PURE__ */
|
|
568
|
+
children: /* @__PURE__ */ I("button", {
|
|
563
569
|
type: "button",
|
|
564
|
-
"data-day":
|
|
565
|
-
tabIndex:
|
|
570
|
+
"data-day": t,
|
|
571
|
+
tabIndex: t === l ? 0 : -1,
|
|
566
572
|
disabled: !o,
|
|
567
573
|
"aria-selected": a,
|
|
568
|
-
"aria-current":
|
|
569
|
-
"aria-label":
|
|
570
|
-
className:
|
|
571
|
-
onClick: () => i(
|
|
572
|
-
children:
|
|
574
|
+
"aria-current": t === s ? "date" : void 0,
|
|
575
|
+
"aria-label": me(t),
|
|
576
|
+
className: r("tabular grid h-9 w-full place-items-center rounded-[var(--control-radius-inner)] text-[length:var(--type-size-control)] outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-color)] disabled:cursor-not-allowed disabled:opacity-[var(--state-disabled-opacity)]", a ? "bg-selection-indicator font-semibold text-selection-indicator-foreground" : t === s ? "font-semibold text-link hover:bg-interaction-hover" : n ? "text-foreground hover:bg-interaction-hover" : "text-muted-foreground hover:bg-interaction-hover"),
|
|
577
|
+
onClick: () => i(t),
|
|
578
|
+
children: J(t).day
|
|
573
579
|
})
|
|
574
|
-
},
|
|
580
|
+
}, t);
|
|
575
581
|
})
|
|
576
|
-
},
|
|
582
|
+
}, t))]
|
|
577
583
|
}),
|
|
578
|
-
/* @__PURE__ */
|
|
584
|
+
/* @__PURE__ */ L("div", {
|
|
579
585
|
className: "mt-2 flex items-center justify-between border-t border-border-subtle pt-2",
|
|
580
|
-
children: [/* @__PURE__ */
|
|
586
|
+
children: [/* @__PURE__ */ I("button", {
|
|
581
587
|
type: "button",
|
|
582
|
-
className: "rounded-[
|
|
588
|
+
className: "rounded-[var(--control-radius-inner)] px-2 py-1 text-[13px] font-medium text-link hover:bg-interaction-hover disabled:text-muted-foreground",
|
|
583
589
|
disabled: !g(s),
|
|
584
590
|
onClick: () => i(s),
|
|
585
591
|
children: "Today"
|
|
586
|
-
}), /* @__PURE__ */
|
|
592
|
+
}), /* @__PURE__ */ I("button", {
|
|
587
593
|
type: "button",
|
|
588
|
-
className: "rounded-[
|
|
594
|
+
className: "rounded-[var(--control-radius-inner)] px-2 py-1 text-[13px] text-secondary-foreground hover:bg-interaction-hover",
|
|
589
595
|
onClick: a,
|
|
590
596
|
children: "Close"
|
|
591
597
|
})]
|
|
@@ -593,212 +599,216 @@ function fe({ value: t, min: n, max: r, onPick: i, onClose: a, anchor: o }) {
|
|
|
593
599
|
]
|
|
594
600
|
});
|
|
595
601
|
}
|
|
596
|
-
function
|
|
597
|
-
let { year: t, month: n, day: r } =
|
|
598
|
-
return `${se[
|
|
602
|
+
function me(e) {
|
|
603
|
+
let { year: t, month: n, day: r } = J(e);
|
|
604
|
+
return `${se[Z(e)]}, ${W[n]} ${r}, ${t}`;
|
|
599
605
|
}
|
|
600
606
|
//#endregion
|
|
601
607
|
//#region src/components/date-range-picker.tsx
|
|
602
|
-
function
|
|
603
|
-
let
|
|
604
|
-
return /* @__PURE__ */
|
|
605
|
-
className:
|
|
608
|
+
function he({ label: e, value: t, onChange: n, help: r, error: i, min: a, max: o, disabled: s, required: c, density: l, className: u, id: d }) {
|
|
609
|
+
let f = N.useId(), p = typeof e == "string" || typeof e == "number" ? String(e) : "Date range", m = !ge(t, a, o), h = t.start && t.end && t.start > t.end ? "End date must be on or after the start date." : a && t.start && t.start < a ? `Start date must be on or after ${a}.` : o && t.end && t.end > o ? `End date must be on or before ${o}.` : void 0, g = i ?? (m ? h : void 0), _ = [r ? `${d ?? f}-help` : void 0, g ? `${d ?? f}-error` : void 0].filter(Boolean).join(" ") || void 0, v = t.end && (!o || t.end < o) ? t.end : o, y = t.start && (!a || t.start > a) ? t.start : a;
|
|
610
|
+
return /* @__PURE__ */ L("fieldset", {
|
|
611
|
+
className: u,
|
|
606
612
|
children: [
|
|
607
|
-
/* @__PURE__ */
|
|
608
|
-
className: "mb-2 type-label
|
|
609
|
-
children: [e, c && /* @__PURE__ */
|
|
613
|
+
/* @__PURE__ */ L("legend", {
|
|
614
|
+
className: "mb-2 type-label text-secondary-foreground",
|
|
615
|
+
children: [e, c && /* @__PURE__ */ I("span", {
|
|
610
616
|
className: "ml-1 font-normal text-muted-foreground",
|
|
611
617
|
children: "Required"
|
|
612
618
|
})]
|
|
613
619
|
}),
|
|
614
|
-
/* @__PURE__ */
|
|
620
|
+
/* @__PURE__ */ L("div", {
|
|
615
621
|
className: "grid min-w-0 gap-3 sm:grid-cols-2",
|
|
616
|
-
children: [/* @__PURE__ */
|
|
622
|
+
children: [/* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("span", {
|
|
617
623
|
className: "mb-1 block type-caption text-muted-foreground",
|
|
618
624
|
children: "Start date"
|
|
619
|
-
}), /* @__PURE__ */
|
|
620
|
-
|
|
625
|
+
}), /* @__PURE__ */ I($, {
|
|
626
|
+
density: l,
|
|
627
|
+
id: `${d ?? f}-start`,
|
|
621
628
|
value: t.start,
|
|
622
629
|
onChange: (e) => n({
|
|
623
630
|
start: e,
|
|
624
631
|
end: t.end
|
|
625
632
|
}),
|
|
626
|
-
ariaLabel: `${
|
|
633
|
+
ariaLabel: `${p} start date`,
|
|
627
634
|
min: a,
|
|
628
|
-
max:
|
|
635
|
+
max: v,
|
|
629
636
|
disabled: s,
|
|
630
637
|
required: c,
|
|
631
|
-
invalid: !!
|
|
632
|
-
"aria-describedby":
|
|
633
|
-
})] }), /* @__PURE__ */
|
|
638
|
+
invalid: !!g,
|
|
639
|
+
"aria-describedby": _
|
|
640
|
+
})] }), /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("span", {
|
|
634
641
|
className: "mb-1 block type-caption text-muted-foreground",
|
|
635
642
|
children: "End date"
|
|
636
|
-
}), /* @__PURE__ */
|
|
637
|
-
|
|
643
|
+
}), /* @__PURE__ */ I($, {
|
|
644
|
+
density: l,
|
|
645
|
+
id: `${d ?? f}-end`,
|
|
638
646
|
value: t.end,
|
|
639
647
|
onChange: (e) => n({
|
|
640
648
|
start: t.start,
|
|
641
649
|
end: e
|
|
642
650
|
}),
|
|
643
|
-
ariaLabel: `${
|
|
644
|
-
min:
|
|
651
|
+
ariaLabel: `${p} end date`,
|
|
652
|
+
min: y,
|
|
645
653
|
max: o,
|
|
646
654
|
disabled: s,
|
|
647
655
|
required: c,
|
|
648
|
-
invalid: !!
|
|
649
|
-
"aria-describedby":
|
|
656
|
+
invalid: !!g,
|
|
657
|
+
"aria-describedby": _
|
|
650
658
|
})] })]
|
|
651
659
|
}),
|
|
652
|
-
r && /* @__PURE__ */
|
|
653
|
-
id: `${
|
|
660
|
+
r && /* @__PURE__ */ I("p", {
|
|
661
|
+
id: `${d ?? f}-help`,
|
|
654
662
|
className: "mt-1 type-caption text-muted-foreground",
|
|
655
663
|
children: r
|
|
656
664
|
}),
|
|
657
|
-
|
|
658
|
-
id: `${
|
|
665
|
+
g && /* @__PURE__ */ I("p", {
|
|
666
|
+
id: `${d ?? f}-error`,
|
|
659
667
|
className: "mt-1 type-caption text-destructive",
|
|
660
|
-
children:
|
|
668
|
+
children: g
|
|
661
669
|
})
|
|
662
670
|
]
|
|
663
671
|
});
|
|
664
672
|
}
|
|
665
|
-
function
|
|
673
|
+
function ge(e, t, n) {
|
|
666
674
|
return (!e.start || !e.end || e.start <= e.end) && (!t || !e.start || e.start >= t) && (!n || !e.end || e.end <= n);
|
|
667
675
|
}
|
|
668
676
|
//#endregion
|
|
669
677
|
//#region src/components/advanced-controls.tsx
|
|
670
|
-
var
|
|
671
|
-
function
|
|
672
|
-
let
|
|
673
|
-
for (let t = e; t <
|
|
678
|
+
var _e = (e, t) => typeof e == "string" || typeof e == "number" ? String(e) : t;
|
|
679
|
+
function ve({ label: e, value: n, onChange: i, options: a, help: s, error: c, placeholder: l = "Search options", emptyMessage: u = "No results found.", disabled: d, required: f, clearable: p = !0, loading: m, className: h, id: g, allowCustomValue: _, onValueSubmit: v, name: y, density: b }) {
|
|
680
|
+
let x = N.useId(), S = g ?? x, C = `${S}-options`, [w, T] = N.useState(!1), [E, D] = N.useState(""), [O, k] = N.useState(0), A = N.useRef(null), j = N.useRef(null), M = N.useRef(null), P = a.find((e) => e.value === n), F = a.filter((e) => e.label.toLocaleLowerCase().includes(E.toLocaleLowerCase())), R = (e = 0) => {
|
|
681
|
+
for (let t = e; t < F.length; t++) if (!F[t].disabled) return t;
|
|
674
682
|
return -1;
|
|
675
|
-
},
|
|
676
|
-
for (let e =
|
|
683
|
+
}, z = () => {
|
|
684
|
+
for (let e = F.length - 1; e >= 0; e--) if (!F[e].disabled) return e;
|
|
677
685
|
return -1;
|
|
678
686
|
};
|
|
679
|
-
|
|
680
|
-
if (!
|
|
687
|
+
N.useEffect(() => {
|
|
688
|
+
if (!w) return;
|
|
681
689
|
let e = (e) => {
|
|
682
|
-
|
|
690
|
+
A.current?.contains(e.target) || T(!1);
|
|
683
691
|
};
|
|
684
692
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
685
|
-
}, [
|
|
686
|
-
|
|
687
|
-
}, [
|
|
688
|
-
let
|
|
689
|
-
e.disabled || (
|
|
693
|
+
}, [w]), N.useEffect(() => {
|
|
694
|
+
w && (M.current?.querySelector(`[data-index="${O}"]`))?.scrollIntoView?.({ block: "nearest" });
|
|
695
|
+
}, [w, O]);
|
|
696
|
+
let H = (e) => {
|
|
697
|
+
e.disabled || (i(e.value), D(""), T(!1), j.current?.focus());
|
|
690
698
|
};
|
|
691
|
-
return /* @__PURE__ */
|
|
692
|
-
label:
|
|
693
|
-
help:
|
|
694
|
-
error:
|
|
695
|
-
htmlFor:
|
|
696
|
-
required:
|
|
697
|
-
className:
|
|
698
|
-
children: /* @__PURE__ */
|
|
699
|
-
ref:
|
|
700
|
-
className: "relative",
|
|
699
|
+
return /* @__PURE__ */ I(o, {
|
|
700
|
+
label: e,
|
|
701
|
+
help: s,
|
|
702
|
+
error: c,
|
|
703
|
+
htmlFor: S,
|
|
704
|
+
required: f,
|
|
705
|
+
className: h,
|
|
706
|
+
children: /* @__PURE__ */ L("div", {
|
|
707
|
+
ref: A,
|
|
708
|
+
className: r("relative", t(b)),
|
|
701
709
|
"data-field-container": "true",
|
|
702
710
|
children: [
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
711
|
+
/* @__PURE__ */ I(V, {
|
|
712
|
+
density: b,
|
|
713
|
+
ref: j,
|
|
714
|
+
id: S,
|
|
715
|
+
name: _ ? y : void 0,
|
|
707
716
|
role: "combobox",
|
|
708
717
|
"aria-autocomplete": "list",
|
|
709
|
-
"aria-expanded":
|
|
710
|
-
"aria-controls":
|
|
711
|
-
"aria-activedescendant":
|
|
712
|
-
"aria-describedby": [
|
|
713
|
-
required:
|
|
714
|
-
placeholder:
|
|
715
|
-
value:
|
|
716
|
-
disabled:
|
|
717
|
-
invalid: !!
|
|
718
|
+
"aria-expanded": w,
|
|
719
|
+
"aria-controls": C,
|
|
720
|
+
"aria-activedescendant": w && O >= 0 ? `${C}-${O}` : void 0,
|
|
721
|
+
"aria-describedby": [s && `${S}-help`, c && `${S}-error`].filter(Boolean).join(" ") || void 0,
|
|
722
|
+
required: f,
|
|
723
|
+
placeholder: P && !w ? P.label : l,
|
|
724
|
+
value: w ? E : P?.label ?? (_ ? n : ""),
|
|
725
|
+
disabled: d,
|
|
726
|
+
invalid: !!c,
|
|
718
727
|
onFocus: () => {
|
|
719
|
-
|
|
728
|
+
T(!0), D(_ ? n : ""), k(-1);
|
|
720
729
|
},
|
|
721
730
|
onChange: (e) => {
|
|
722
|
-
|
|
731
|
+
D(e.currentTarget.value), _ && i(e.currentTarget.value), k(R()), T(!0);
|
|
723
732
|
},
|
|
724
733
|
onKeyDown: (e) => {
|
|
725
|
-
if (e.key === "ArrowDown") e.preventDefault(),
|
|
726
|
-
for (let t = Math.max(e + 1, 0); t <
|
|
727
|
-
return
|
|
734
|
+
if (e.key === "ArrowDown") e.preventDefault(), w || T(!0), k((e) => {
|
|
735
|
+
for (let t = Math.max(e + 1, 0); t < F.length; t++) if (!F[t].disabled) return t;
|
|
736
|
+
return R();
|
|
728
737
|
});
|
|
729
|
-
else if (e.key === "ArrowUp" &&
|
|
730
|
-
if (e < 0) return
|
|
731
|
-
for (let t = e - 1; t >= 0; t--) if (!
|
|
738
|
+
else if (e.key === "ArrowUp" && w) e.preventDefault(), k((e) => {
|
|
739
|
+
if (e < 0) return z();
|
|
740
|
+
for (let t = e - 1; t >= 0; t--) if (!F[t].disabled) return t;
|
|
732
741
|
return e;
|
|
733
742
|
});
|
|
734
|
-
else if (e.key === "Home" &&
|
|
735
|
-
else if (e.key === "End" &&
|
|
736
|
-
else if (e.key === "Enter" &&
|
|
743
|
+
else if (e.key === "Home" && w) e.preventDefault(), k(R());
|
|
744
|
+
else if (e.key === "End" && w) e.preventDefault(), k(z());
|
|
745
|
+
else if (e.key === "Enter" && w) {
|
|
737
746
|
e.preventDefault();
|
|
738
|
-
let t =
|
|
739
|
-
t && !t.disabled ?
|
|
740
|
-
} else e.key === "Escape" &&
|
|
747
|
+
let t = F[O];
|
|
748
|
+
t && !t.disabled ? H(t) : _ && v?.();
|
|
749
|
+
} else e.key === "Escape" && w ? (e.preventDefault(), T(!1), D("")) : e.key === "Tab" && T(!1);
|
|
741
750
|
},
|
|
742
751
|
autoComplete: "off"
|
|
743
752
|
}),
|
|
744
|
-
|
|
753
|
+
y && !_ && /* @__PURE__ */ I("input", {
|
|
745
754
|
type: "hidden",
|
|
746
|
-
name:
|
|
755
|
+
name: y,
|
|
747
756
|
value: n,
|
|
748
|
-
disabled:
|
|
757
|
+
disabled: d
|
|
749
758
|
}),
|
|
750
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ L("div", {
|
|
751
760
|
className: "absolute inset-y-0 right-1 flex items-center gap-0.5",
|
|
752
|
-
children: [
|
|
761
|
+
children: [p && n !== "" && /* @__PURE__ */ I("button", {
|
|
753
762
|
type: "button",
|
|
754
763
|
"aria-label": "Clear selection",
|
|
755
|
-
disabled:
|
|
756
|
-
className: "grid h-7 w-7 place-items-center rounded text-muted-foreground hover:bg-
|
|
764
|
+
disabled: d,
|
|
765
|
+
className: "grid h-7 w-7 place-items-center rounded-[var(--control-radius-inner)] text-muted-foreground hover:bg-interaction-hover disabled:cursor-not-allowed disabled:opacity-[var(--state-disabled-opacity)]",
|
|
757
766
|
onClick: () => {
|
|
758
|
-
|
|
767
|
+
i(""), D(""), k(-1), T(!0), j.current?.focus();
|
|
759
768
|
},
|
|
760
769
|
children: "×"
|
|
761
|
-
}), /* @__PURE__ */
|
|
770
|
+
}), /* @__PURE__ */ I(B, {
|
|
762
771
|
name: "chevron-down",
|
|
763
|
-
className:
|
|
772
|
+
className: r("text-muted-foreground transition-transform", w && "rotate-180")
|
|
764
773
|
})]
|
|
765
774
|
}),
|
|
766
|
-
|
|
767
|
-
id:
|
|
775
|
+
w && (m || F.length === 0 ? /* @__PURE__ */ I("div", {
|
|
776
|
+
id: C,
|
|
768
777
|
role: "status",
|
|
769
778
|
className: "absolute left-0 right-0 top-full z-50 mt-1 rounded-[var(--control-radius)] border border-border bg-surface px-3 py-2 type-caption text-muted-foreground shadow-working",
|
|
770
|
-
children:
|
|
771
|
-
}) : /* @__PURE__ */
|
|
772
|
-
id:
|
|
773
|
-
ref:
|
|
779
|
+
children: m ? "Loading…" : u
|
|
780
|
+
}) : /* @__PURE__ */ I("ul", {
|
|
781
|
+
id: C,
|
|
782
|
+
ref: M,
|
|
774
783
|
role: "listbox",
|
|
775
|
-
"aria-label": `${
|
|
784
|
+
"aria-label": `${_e(e, "Search")} options`,
|
|
776
785
|
className: "absolute left-0 right-0 top-full z-50 mt-1 max-h-64 overflow-auto rounded-[var(--control-radius)] border border-border bg-surface py-1 shadow-working",
|
|
777
|
-
children:
|
|
778
|
-
id: `${
|
|
779
|
-
"data-index":
|
|
786
|
+
children: F.map((e, t) => /* @__PURE__ */ L("li", {
|
|
787
|
+
id: `${C}-${t}`,
|
|
788
|
+
"data-index": t,
|
|
780
789
|
role: "option",
|
|
781
|
-
"
|
|
782
|
-
"aria-
|
|
783
|
-
|
|
784
|
-
|
|
790
|
+
"data-active": t === O || void 0,
|
|
791
|
+
"aria-selected": e.value === n,
|
|
792
|
+
"aria-disabled": e.disabled || void 0,
|
|
793
|
+
className: r("wos-option cursor-pointer px-3 py-2 text-[length:var(--wos-control-font-size,var(--type-size-control))]", b && "min-h-[var(--wos-control-height)]", e.disabled ? "cursor-not-allowed text-muted-foreground opacity-[var(--state-disabled-opacity)]" : t === O ? "bg-surface-subtle" : "text-secondary-foreground"),
|
|
794
|
+
onPointerEnter: () => !e.disabled && k(t),
|
|
785
795
|
onPointerDown: (e) => e.preventDefault(),
|
|
786
|
-
onClick: () =>
|
|
787
|
-
children: [/* @__PURE__ */
|
|
796
|
+
onClick: () => H(e),
|
|
797
|
+
children: [/* @__PURE__ */ I("span", { children: e.label }), e.description && /* @__PURE__ */ I("span", {
|
|
788
798
|
className: "block type-caption text-muted-foreground",
|
|
789
|
-
children:
|
|
799
|
+
children: e.description
|
|
790
800
|
})]
|
|
791
|
-
},
|
|
801
|
+
}, e.value))
|
|
792
802
|
}))
|
|
793
803
|
]
|
|
794
804
|
})
|
|
795
805
|
});
|
|
796
806
|
}
|
|
797
|
-
function
|
|
798
|
-
return /* @__PURE__ */
|
|
807
|
+
function ye(e) {
|
|
808
|
+
return /* @__PURE__ */ I(ve, { ...e });
|
|
799
809
|
}
|
|
800
|
-
function
|
|
801
|
-
return /* @__PURE__ */
|
|
810
|
+
function be({ label: e, value: t, onChange: n, onSubmit: r, options: i = [], ...a }) {
|
|
811
|
+
return /* @__PURE__ */ I(ve, {
|
|
802
812
|
...a,
|
|
803
813
|
label: e,
|
|
804
814
|
value: t,
|
|
@@ -809,280 +819,289 @@ function ye({ label: e, value: t, onChange: n, onSubmit: r, options: i = [], ...
|
|
|
809
819
|
clearable: !0
|
|
810
820
|
});
|
|
811
821
|
}
|
|
812
|
-
function
|
|
813
|
-
let
|
|
814
|
-
for (let n = e; n >= 0 && n <
|
|
822
|
+
function xe({ label: e, value: n, onChange: i, options: a, help: s, error: c, placeholder: l = "Search options", emptyMessage: u = "No results found.", disabled: d, required: f, name: p, className: m, id: h, density: g }) {
|
|
823
|
+
let _ = N.useId(), v = h ?? _, [y, b] = N.useState(""), [x, S] = N.useState(!1), [C, w] = N.useState(0), T = N.useRef(null), E = N.useRef(null), D = `${v}-list`, O = a.filter((e) => e.label.toLowerCase().includes(y.toLowerCase())), k = N.useRef(null), A = (e, t) => {
|
|
824
|
+
for (let n = e; n >= 0 && n < O.length; n += t) if (!O[n].disabled) return n;
|
|
815
825
|
return -1;
|
|
816
826
|
};
|
|
817
|
-
|
|
818
|
-
if (!
|
|
827
|
+
N.useEffect(() => {
|
|
828
|
+
if (!x) return;
|
|
819
829
|
let e = (e) => {
|
|
820
|
-
|
|
830
|
+
T.current?.contains(e.target) || S(!1);
|
|
821
831
|
};
|
|
822
832
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
823
|
-
}, [
|
|
824
|
-
|
|
833
|
+
}, [x]), N.useEffect(() => {
|
|
834
|
+
x && C >= 0 && document.getElementById(`${D}-${C}`)?.scrollIntoView?.({ block: "nearest" });
|
|
825
835
|
}, [
|
|
826
|
-
y,
|
|
827
836
|
x,
|
|
828
|
-
|
|
837
|
+
C,
|
|
838
|
+
D
|
|
829
839
|
]);
|
|
830
|
-
let
|
|
831
|
-
e.disabled || (
|
|
840
|
+
let j = (e) => {
|
|
841
|
+
e.disabled || (i(n.includes(e.value) ? n.filter((t) => t !== e.value) : [...n, e.value]), b(""), w(-1), S(!0), E.current?.focus());
|
|
832
842
|
};
|
|
833
|
-
return /* @__PURE__ */
|
|
834
|
-
label:
|
|
835
|
-
help:
|
|
836
|
-
error:
|
|
837
|
-
htmlFor:
|
|
838
|
-
required:
|
|
839
|
-
className:
|
|
840
|
-
children: /* @__PURE__ */
|
|
843
|
+
return /* @__PURE__ */ I(o, {
|
|
844
|
+
label: e,
|
|
845
|
+
help: s,
|
|
846
|
+
error: c,
|
|
847
|
+
htmlFor: v,
|
|
848
|
+
required: f,
|
|
849
|
+
className: m,
|
|
850
|
+
children: /* @__PURE__ */ L("div", {
|
|
841
851
|
"data-field-container": "true",
|
|
842
|
-
ref:
|
|
843
|
-
|
|
852
|
+
ref: T,
|
|
853
|
+
"data-invalid": !!c || void 0,
|
|
854
|
+
"data-disabled": d || void 0,
|
|
855
|
+
className: r("wos-multiselect relative rounded-[var(--control-radius)] border border-input bg-surface px-2 py-1.5 focus-within:ring-2 focus-within:ring-ring", t(g)),
|
|
844
856
|
children: [
|
|
845
|
-
|
|
857
|
+
p && n.map((e) => /* @__PURE__ */ I("input", {
|
|
846
858
|
type: "hidden",
|
|
847
|
-
name:
|
|
859
|
+
name: p,
|
|
848
860
|
value: e,
|
|
849
|
-
disabled:
|
|
861
|
+
disabled: d
|
|
850
862
|
}, e)),
|
|
851
|
-
/* @__PURE__ */
|
|
863
|
+
/* @__PURE__ */ L("div", {
|
|
852
864
|
className: "flex min-h-7 flex-wrap items-center gap-1.5",
|
|
853
865
|
children: [n.map((e) => {
|
|
854
|
-
let t =
|
|
855
|
-
return /* @__PURE__ */
|
|
856
|
-
className: "inline-flex items-center gap-1 rounded bg-
|
|
857
|
-
children: [t?.label ?? e, /* @__PURE__ */
|
|
866
|
+
let t = a.find((t) => t.value === e);
|
|
867
|
+
return /* @__PURE__ */ L("span", {
|
|
868
|
+
className: "inline-flex items-center gap-1 rounded-[var(--control-radius-inner)] bg-selected-subtle px-2 py-1 type-caption text-selected",
|
|
869
|
+
children: [t?.label ?? e, /* @__PURE__ */ I("button", {
|
|
858
870
|
type: "button",
|
|
859
|
-
disabled:
|
|
871
|
+
disabled: d,
|
|
860
872
|
"aria-label": `Remove ${t?.label ?? e}`,
|
|
861
873
|
onClick: () => {
|
|
862
|
-
|
|
874
|
+
i(n.filter((t) => t !== e)), E.current?.focus();
|
|
863
875
|
},
|
|
864
|
-
className: "min-h-8 min-w-8 rounded hover:text-foreground disabled:cursor-not-allowed",
|
|
876
|
+
className: "min-h-8 min-w-8 rounded-[var(--control-radius-inner)] hover:text-foreground disabled:cursor-not-allowed",
|
|
865
877
|
children: "×"
|
|
866
878
|
})]
|
|
867
879
|
}, e);
|
|
868
|
-
}), /* @__PURE__ */
|
|
869
|
-
|
|
870
|
-
|
|
880
|
+
}), /* @__PURE__ */ I("input", {
|
|
881
|
+
"data-density": g,
|
|
882
|
+
ref: E,
|
|
883
|
+
id: v,
|
|
871
884
|
role: "combobox",
|
|
872
|
-
"aria-expanded":
|
|
873
|
-
"aria-controls":
|
|
874
|
-
"aria-activedescendant":
|
|
885
|
+
"aria-expanded": x,
|
|
886
|
+
"aria-controls": D,
|
|
887
|
+
"aria-activedescendant": x && C >= 0 ? `${D}-${C}` : void 0,
|
|
875
888
|
"aria-autocomplete": "list",
|
|
876
|
-
"aria-invalid": !!
|
|
877
|
-
"aria-describedby": [
|
|
878
|
-
disabled:
|
|
879
|
-
required:
|
|
880
|
-
className: "min-w-28 flex-1 border-0 bg-transparent px-1 py-1 text-[length:var(--type-size-control)] outline-none placeholder:text-muted-foreground",
|
|
881
|
-
placeholder: n.length ? "Add another" :
|
|
882
|
-
value:
|
|
889
|
+
"aria-invalid": !!c || void 0,
|
|
890
|
+
"aria-describedby": [s && `${v}-help`, c && `${v}-error`].filter(Boolean).join(" ") || void 0,
|
|
891
|
+
disabled: d,
|
|
892
|
+
required: f && n.length === 0,
|
|
893
|
+
className: "min-w-28 flex-1 border-0 bg-transparent px-1 py-1 text-[length:var(--wos-control-font-size,var(--type-size-control))] outline-none placeholder:text-muted-foreground",
|
|
894
|
+
placeholder: n.length ? "Add another" : l,
|
|
895
|
+
value: y,
|
|
883
896
|
onFocus: () => {
|
|
884
|
-
|
|
897
|
+
S(!0), w(-1);
|
|
885
898
|
},
|
|
886
899
|
onChange: (e) => {
|
|
887
|
-
|
|
900
|
+
b(e.currentTarget.value), w(A(0, 1)), S(!0);
|
|
888
901
|
},
|
|
889
902
|
onKeyDown: (e) => {
|
|
890
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
891
|
-
let t =
|
|
892
|
-
return t < 0 ?
|
|
893
|
-
})) : e.key === "ArrowUp" ? (e.preventDefault(),
|
|
894
|
-
let t =
|
|
895
|
-
return t < 0 ? O
|
|
896
|
-
})) : e.key === "Home" &&
|
|
903
|
+
e.key === "ArrowDown" ? (e.preventDefault(), S(!0), w((e) => {
|
|
904
|
+
let t = A(e < 0 ? 0 : e + 1, 1);
|
|
905
|
+
return t < 0 ? A(0, 1) : t;
|
|
906
|
+
})) : e.key === "ArrowUp" ? (e.preventDefault(), w((e) => {
|
|
907
|
+
let t = A(e < 0 ? O.length - 1 : e - 1, -1);
|
|
908
|
+
return t < 0 ? A(O.length - 1, -1) : t;
|
|
909
|
+
})) : e.key === "Home" && x ? (e.preventDefault(), w(A(0, 1))) : e.key === "End" && x ? (e.preventDefault(), w(A(O.length - 1, -1))) : e.key === "Enter" && x && O[C] && !O[C].disabled ? (e.preventDefault(), j(O[C])) : e.key === "Escape" ? S(!1) : e.key === "Backspace" && !y && n.length ? i(n.slice(0, -1)) : e.key === "Tab" && S(!1);
|
|
897
910
|
}
|
|
898
911
|
})]
|
|
899
912
|
}),
|
|
900
|
-
|
|
901
|
-
id:
|
|
902
|
-
ref:
|
|
913
|
+
x && (O.length ? /* @__PURE__ */ I("ul", {
|
|
914
|
+
id: D,
|
|
915
|
+
ref: k,
|
|
903
916
|
role: "listbox",
|
|
904
917
|
"aria-multiselectable": "true",
|
|
905
|
-
"aria-label": `${
|
|
918
|
+
"aria-label": `${_e(e, "Selection")} options`,
|
|
906
919
|
className: "absolute left-0 right-0 top-full z-50 mt-1 max-h-64 overflow-auto rounded-[var(--control-radius)] border border-border bg-surface py-1 shadow-working",
|
|
907
|
-
children:
|
|
908
|
-
id: `${
|
|
909
|
-
"data-index":
|
|
920
|
+
children: O.map((e, t) => /* @__PURE__ */ L("li", {
|
|
921
|
+
id: `${D}-${t}`,
|
|
922
|
+
"data-index": t,
|
|
910
923
|
role: "option",
|
|
911
|
-
"
|
|
912
|
-
"aria-
|
|
913
|
-
|
|
924
|
+
"data-active": t === C || void 0,
|
|
925
|
+
"aria-selected": n.includes(e.value),
|
|
926
|
+
"aria-disabled": e.disabled || void 0,
|
|
927
|
+
className: r("wos-option cursor-pointer px-3 py-2 text-[length:var(--wos-control-font-size,var(--type-size-control))]", g && "min-h-[var(--wos-control-height)]", e.disabled && "opacity-[var(--state-disabled-opacity)]", t === C && "bg-surface-subtle"),
|
|
914
928
|
onPointerDown: (e) => e.preventDefault(),
|
|
915
|
-
onPointerEnter: () => !
|
|
916
|
-
onClick: () =>
|
|
917
|
-
children: [
|
|
929
|
+
onPointerEnter: () => !e.disabled && w(t),
|
|
930
|
+
onClick: () => j(e),
|
|
931
|
+
children: [e.label, n.includes(e.value) && /* @__PURE__ */ I("span", {
|
|
918
932
|
className: "float-right",
|
|
919
933
|
children: "✓"
|
|
920
934
|
})]
|
|
921
|
-
},
|
|
922
|
-
}) : /* @__PURE__ */
|
|
923
|
-
id:
|
|
935
|
+
}, e.value))
|
|
936
|
+
}) : /* @__PURE__ */ I("div", {
|
|
937
|
+
id: D,
|
|
924
938
|
role: "status",
|
|
925
939
|
className: "absolute left-0 right-0 top-full z-50 mt-1 rounded-[var(--control-radius)] border border-border bg-surface px-3 py-2 type-caption text-muted-foreground shadow-working",
|
|
926
|
-
children:
|
|
940
|
+
children: u
|
|
927
941
|
}))
|
|
928
942
|
]
|
|
929
943
|
})
|
|
930
944
|
});
|
|
931
945
|
}
|
|
932
|
-
function
|
|
933
|
-
let
|
|
934
|
-
return /* @__PURE__ */
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
946
|
+
function Se({ label: e, help: n, error: i, className: a, onChange: o, density: s, ...c }) {
|
|
947
|
+
let l = N.useId(), u = c.id ?? l, d = n ? `${u}-help` : void 0, f = i ? `${u}-error` : void 0;
|
|
948
|
+
return /* @__PURE__ */ L("label", {
|
|
949
|
+
"data-disabled": c.disabled || void 0,
|
|
950
|
+
"data-density": s,
|
|
951
|
+
className: r("wos-choice-label flex min-h-11 cursor-pointer items-start gap-2.5 py-1.5 rounded-[var(--control-radius)] hover:bg-interaction-hover", t(s), s && "min-h-[var(--wos-control-height)]", c.disabled && "cursor-not-allowed opacity-[var(--state-disabled-opacity)]", a),
|
|
952
|
+
children: [/* @__PURE__ */ I("input", {
|
|
953
|
+
...c,
|
|
954
|
+
id: u,
|
|
939
955
|
type: "checkbox",
|
|
940
|
-
"aria-invalid": !!
|
|
956
|
+
"aria-invalid": !!i || c["aria-invalid"] || void 0,
|
|
941
957
|
"aria-describedby": [
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
958
|
+
c["aria-describedby"],
|
|
959
|
+
d,
|
|
960
|
+
f
|
|
945
961
|
].filter(Boolean).join(" ") || void 0,
|
|
946
|
-
className: "mt-0.5 h-4 w-4 accent-
|
|
947
|
-
onChange: (e) =>
|
|
948
|
-
}), /* @__PURE__ */
|
|
962
|
+
className: "wos-choice-input mt-0.5 h-4 w-4 accent-selection-indicator focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
963
|
+
onChange: (e) => o?.(e.currentTarget.checked, e)
|
|
964
|
+
}), /* @__PURE__ */ L("span", {
|
|
949
965
|
className: "min-w-0",
|
|
950
966
|
children: [
|
|
951
|
-
/* @__PURE__ */
|
|
967
|
+
/* @__PURE__ */ L("span", {
|
|
952
968
|
className: "block type-label text-secondary-foreground",
|
|
953
|
-
children: [
|
|
969
|
+
children: [e, c.required && /* @__PURE__ */ I("span", {
|
|
954
970
|
className: "ml-1 text-muted-foreground",
|
|
955
971
|
children: "Required"
|
|
956
972
|
})]
|
|
957
973
|
}),
|
|
958
|
-
n && /* @__PURE__ */
|
|
959
|
-
id:
|
|
974
|
+
n && /* @__PURE__ */ I("span", {
|
|
975
|
+
id: d,
|
|
960
976
|
className: "block type-caption text-muted-foreground",
|
|
961
977
|
children: n
|
|
962
978
|
}),
|
|
963
|
-
|
|
964
|
-
id:
|
|
979
|
+
i && /* @__PURE__ */ I("span", {
|
|
980
|
+
id: f,
|
|
965
981
|
className: "block type-caption text-destructive",
|
|
966
|
-
children:
|
|
982
|
+
children: i
|
|
967
983
|
})
|
|
968
984
|
]
|
|
969
985
|
})]
|
|
970
986
|
});
|
|
971
987
|
}
|
|
972
|
-
function
|
|
973
|
-
let
|
|
974
|
-
return /* @__PURE__ */
|
|
975
|
-
className:
|
|
976
|
-
disabled:
|
|
977
|
-
"aria-describedby": [
|
|
988
|
+
function Ce({ label: e, value: n, onChange: i, options: a, help: o, error: s, disabled: c, required: l, orientation: u = "vertical", name: d, className: f, density: p }) {
|
|
989
|
+
let m = N.useId(), h = d ?? m;
|
|
990
|
+
return /* @__PURE__ */ L("fieldset", {
|
|
991
|
+
className: r("min-w-0", t(p), f),
|
|
992
|
+
disabled: c,
|
|
993
|
+
"aria-describedby": [o && `${m}-help`, s && `${m}-error`].filter(Boolean).join(" ") || void 0,
|
|
978
994
|
children: [
|
|
979
|
-
/* @__PURE__ */
|
|
980
|
-
className: "mb-2 type-label
|
|
981
|
-
children: [
|
|
995
|
+
/* @__PURE__ */ L("legend", {
|
|
996
|
+
className: "mb-2 type-label text-secondary-foreground",
|
|
997
|
+
children: [e, l && /* @__PURE__ */ I("span", {
|
|
982
998
|
className: "ml-1 font-normal text-muted-foreground",
|
|
983
999
|
children: "Required"
|
|
984
1000
|
})]
|
|
985
1001
|
}),
|
|
986
|
-
/* @__PURE__ */
|
|
987
|
-
className:
|
|
1002
|
+
/* @__PURE__ */ I("div", {
|
|
1003
|
+
className: r("flex gap-x-5 gap-y-2", u === "vertical" ? "flex-col" : "flex-wrap"),
|
|
988
1004
|
role: "radiogroup",
|
|
989
|
-
"aria-required":
|
|
990
|
-
"aria-invalid": !!
|
|
991
|
-
children:
|
|
992
|
-
|
|
993
|
-
|
|
1005
|
+
"aria-required": l || void 0,
|
|
1006
|
+
"aria-invalid": !!s || void 0,
|
|
1007
|
+
children: a.map((e) => /* @__PURE__ */ L("label", {
|
|
1008
|
+
"data-disabled": c || e.disabled || void 0,
|
|
1009
|
+
"data-density": p,
|
|
1010
|
+
className: r("wos-choice-label flex min-h-11 cursor-pointer items-center gap-2 rounded-[var(--control-radius)] hover:bg-interaction-hover", p && "min-h-[var(--wos-control-height)]", (c || e.disabled) && "cursor-not-allowed opacity-[var(--state-disabled-opacity)]"),
|
|
1011
|
+
children: [/* @__PURE__ */ I("input", {
|
|
1012
|
+
"aria-invalid": !!s || void 0,
|
|
994
1013
|
type: "radio",
|
|
995
|
-
name:
|
|
996
|
-
value:
|
|
997
|
-
checked: n ===
|
|
998
|
-
disabled:
|
|
999
|
-
required:
|
|
1000
|
-
onChange: () =>
|
|
1001
|
-
className: "h-4 w-4 accent-
|
|
1002
|
-
}), /* @__PURE__ */
|
|
1014
|
+
name: h,
|
|
1015
|
+
value: e.value,
|
|
1016
|
+
checked: n === e.value,
|
|
1017
|
+
disabled: c || e.disabled,
|
|
1018
|
+
required: l,
|
|
1019
|
+
onChange: () => i(e.value),
|
|
1020
|
+
className: "wos-choice-input h-4 w-4 accent-selection-indicator focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
|
|
1021
|
+
}), /* @__PURE__ */ I("span", {
|
|
1003
1022
|
className: "type-supporting text-secondary-foreground",
|
|
1004
|
-
children:
|
|
1023
|
+
children: e.label
|
|
1005
1024
|
})]
|
|
1006
|
-
},
|
|
1025
|
+
}, e.value))
|
|
1007
1026
|
}),
|
|
1008
|
-
|
|
1009
|
-
id: `${
|
|
1027
|
+
o && /* @__PURE__ */ I("p", {
|
|
1028
|
+
id: `${m}-help`,
|
|
1010
1029
|
className: "mt-1 type-caption text-muted-foreground",
|
|
1011
|
-
children:
|
|
1030
|
+
children: o
|
|
1012
1031
|
}),
|
|
1013
|
-
|
|
1014
|
-
id: `${
|
|
1032
|
+
s && /* @__PURE__ */ I("p", {
|
|
1033
|
+
id: `${m}-error`,
|
|
1015
1034
|
className: "mt-1 type-caption text-destructive",
|
|
1016
|
-
children:
|
|
1035
|
+
children: s
|
|
1017
1036
|
})
|
|
1018
1037
|
]
|
|
1019
1038
|
});
|
|
1020
1039
|
}
|
|
1021
|
-
function
|
|
1022
|
-
let s =
|
|
1023
|
-
return /* @__PURE__ */
|
|
1024
|
-
className:
|
|
1025
|
-
children: [/* @__PURE__ */
|
|
1026
|
-
className:
|
|
1040
|
+
function we({ label: e, description: t, error: n, className: i, onChange: a, ...o }) {
|
|
1041
|
+
let s = N.useId(), c = n ? `${o.id ?? s}-error` : void 0;
|
|
1042
|
+
return /* @__PURE__ */ L("div", {
|
|
1043
|
+
className: r("space-y-1", i),
|
|
1044
|
+
children: [/* @__PURE__ */ L("label", {
|
|
1045
|
+
className: r("flex min-h-11 cursor-pointer items-center justify-between gap-4", o.disabled && "cursor-not-allowed opacity-[var(--state-disabled-opacity)]"),
|
|
1027
1046
|
children: [
|
|
1028
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ L("span", { children: [/* @__PURE__ */ L("span", {
|
|
1029
1048
|
className: "block type-label text-secondary-foreground",
|
|
1030
|
-
children: [
|
|
1049
|
+
children: [e, o.required && /* @__PURE__ */ I("span", {
|
|
1031
1050
|
className: "ml-1 text-muted-foreground",
|
|
1032
1051
|
children: "Required"
|
|
1033
1052
|
})]
|
|
1034
|
-
}),
|
|
1053
|
+
}), t && /* @__PURE__ */ I("span", {
|
|
1035
1054
|
id: s,
|
|
1036
1055
|
className: "block type-caption text-muted-foreground",
|
|
1037
|
-
children:
|
|
1056
|
+
children: t
|
|
1038
1057
|
})] }),
|
|
1039
|
-
/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ I("input", {
|
|
1040
1059
|
...o,
|
|
1041
1060
|
type: "checkbox",
|
|
1042
1061
|
role: "switch",
|
|
1043
|
-
"aria-invalid": !!
|
|
1062
|
+
"aria-invalid": !!n || o["aria-invalid"] || void 0,
|
|
1044
1063
|
"aria-describedby": [
|
|
1045
|
-
|
|
1064
|
+
t && s,
|
|
1046
1065
|
c,
|
|
1047
1066
|
o["aria-describedby"]
|
|
1048
1067
|
].filter(Boolean).join(" ") || void 0,
|
|
1049
1068
|
className: "peer sr-only",
|
|
1050
1069
|
onChange: (e) => a?.(e.currentTarget.checked)
|
|
1051
1070
|
}),
|
|
1052
|
-
/* @__PURE__ */
|
|
1071
|
+
/* @__PURE__ */ I("span", {
|
|
1053
1072
|
"aria-hidden": "true",
|
|
1054
|
-
className: "relative h-6 w-11 shrink-0 rounded-full bg-border transition-colors duration-[var(--motion-duration-fast)] after:absolute after:left-0.5 after:top-0.5 after:h-5 after:w-5 after:rounded-full after:bg-
|
|
1073
|
+
className: "relative h-6 w-11 shrink-0 rounded-full bg-border transition-colors duration-[var(--motion-duration-fast)] after:absolute after:left-0.5 after:top-0.5 after:h-5 after:w-5 after:rounded-full after:bg-surface after:shadow-sm after:transition-transform after:duration-[var(--motion-duration-fast)] peer-checked:bg-selection-indicator peer-checked:after:translate-x-5 peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-ring peer-disabled:opacity-[var(--state-disabled-opacity)] peer-aria-[invalid=true]:ring-1 peer-aria-[invalid=true]:ring-destructive"
|
|
1055
1074
|
})
|
|
1056
1075
|
]
|
|
1057
|
-
}),
|
|
1076
|
+
}), n && /* @__PURE__ */ I("p", {
|
|
1058
1077
|
id: c,
|
|
1059
1078
|
className: "type-caption text-destructive",
|
|
1060
|
-
children:
|
|
1079
|
+
children: n
|
|
1061
1080
|
})]
|
|
1062
1081
|
});
|
|
1063
1082
|
}
|
|
1064
|
-
function
|
|
1065
|
-
let c = s.id ??
|
|
1066
|
-
return /* @__PURE__ */
|
|
1083
|
+
function Te({ label: e, value: t, onChange: n, help: r, error: i, className: a, ...s }) {
|
|
1084
|
+
let c = s.id ?? N.useId();
|
|
1085
|
+
return /* @__PURE__ */ I(o, {
|
|
1067
1086
|
label: e,
|
|
1068
1087
|
help: r,
|
|
1069
1088
|
error: i,
|
|
1070
1089
|
htmlFor: c,
|
|
1071
1090
|
required: s.required,
|
|
1072
|
-
className:
|
|
1073
|
-
children: /* @__PURE__ */
|
|
1091
|
+
className: a,
|
|
1092
|
+
children: /* @__PURE__ */ L("div", {
|
|
1074
1093
|
"data-field-container": "true",
|
|
1075
1094
|
className: "flex items-center gap-3",
|
|
1076
|
-
children: [/* @__PURE__ */
|
|
1095
|
+
children: [/* @__PURE__ */ I("input", {
|
|
1077
1096
|
...s,
|
|
1078
1097
|
id: c,
|
|
1079
1098
|
type: "range",
|
|
1080
1099
|
value: t,
|
|
1081
1100
|
"aria-describedby": [r && `${c}-help`, i && `${c}-error`].filter(Boolean).join(" ") || void 0,
|
|
1082
1101
|
"aria-invalid": !!i || void 0,
|
|
1083
|
-
className: "w-full accent-
|
|
1102
|
+
className: "w-full accent-selection-indicator focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
1084
1103
|
onChange: (e) => n(Number(e.currentTarget.value))
|
|
1085
|
-
}), /* @__PURE__ */
|
|
1104
|
+
}), /* @__PURE__ */ I("output", {
|
|
1086
1105
|
htmlFor: c,
|
|
1087
1106
|
className: "min-w-10 text-right type-caption tabular",
|
|
1088
1107
|
children: t
|
|
@@ -1090,88 +1109,90 @@ function we({ label: e, value: t, onChange: n, help: r, error: i, className: o,
|
|
|
1090
1109
|
})
|
|
1091
1110
|
});
|
|
1092
1111
|
}
|
|
1093
|
-
function
|
|
1094
|
-
return /* @__PURE__ */
|
|
1095
|
-
...
|
|
1112
|
+
function Ee({ pressed: e, onPressedChange: n, className: i, children: a, density: o, ...s }) {
|
|
1113
|
+
return /* @__PURE__ */ I("button", {
|
|
1114
|
+
...s,
|
|
1115
|
+
"data-density": o,
|
|
1096
1116
|
type: "button",
|
|
1097
|
-
"aria-pressed":
|
|
1098
|
-
className:
|
|
1099
|
-
onClick: () => !
|
|
1100
|
-
children:
|
|
1117
|
+
"aria-pressed": e,
|
|
1118
|
+
className: r("wos-state-control inline-flex min-h-9 items-center justify-center rounded-[var(--control-radius)] border px-3 type-control transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:cursor-not-allowed disabled:opacity-[var(--state-disabled-opacity)]", t(o), o && "min-h-[var(--wos-control-height)] text-[length:var(--wos-control-font-size)]", e ? "border-selection-indicator bg-selected-subtle text-selected" : "border-border bg-surface text-secondary-foreground hover:bg-interaction-hover", i),
|
|
1119
|
+
onClick: () => !s.disabled && n(!e),
|
|
1120
|
+
children: a
|
|
1101
1121
|
});
|
|
1102
1122
|
}
|
|
1103
|
-
function
|
|
1104
|
-
let
|
|
1105
|
-
|
|
1106
|
-
},
|
|
1123
|
+
function De({ label: e, value: n, onChange: i, options: a, type: o = "single", disabled: s, className: c, density: l }) {
|
|
1124
|
+
let u = Array.isArray(n) ? n : n ? [n] : [], d = (e) => {
|
|
1125
|
+
o === "multiple" ? i(u.includes(e) ? u.filter((t) => t !== e) : [...u, e]) : u[0] !== e && i(e);
|
|
1126
|
+
}, f = a.map((e, t) => !e.disabled && !s ? t : -1).filter((e) => e >= 0), p = a.findIndex((e) => u.includes(e.value) && !e.disabled), m = f.includes(p) ? p : f[0] ?? -1, h = (e, t) => {
|
|
1107
1127
|
let n = ["ArrowRight", "ArrowDown"].includes(e.key) ? 1 : ["ArrowLeft", "ArrowUp"].includes(e.key) ? -1 : 0;
|
|
1108
|
-
if (!n ||
|
|
1128
|
+
if (!n || o !== "single" || !f.length) return;
|
|
1109
1129
|
e.preventDefault();
|
|
1110
|
-
let r =
|
|
1111
|
-
(e.currentTarget.parentElement?.children[
|
|
1130
|
+
let r = f.indexOf(t), i = f[(r + n + f.length) % f.length];
|
|
1131
|
+
(e.currentTarget.parentElement?.children[i])?.focus(), d(a[i].value);
|
|
1112
1132
|
};
|
|
1113
|
-
return /* @__PURE__ */
|
|
1114
|
-
|
|
1115
|
-
"
|
|
1116
|
-
|
|
1117
|
-
|
|
1133
|
+
return /* @__PURE__ */ I("div", {
|
|
1134
|
+
"data-density": l,
|
|
1135
|
+
role: o === "single" ? "radiogroup" : "group",
|
|
1136
|
+
"aria-label": e,
|
|
1137
|
+
className: r("inline-flex max-w-full flex-wrap rounded-[var(--control-radius)] border border-border bg-surface p-0.5", t(l), c),
|
|
1138
|
+
children: a.map((e, t) => /* @__PURE__ */ I("button", {
|
|
1118
1139
|
type: "button",
|
|
1119
|
-
role:
|
|
1120
|
-
"aria-checked":
|
|
1121
|
-
tabIndex:
|
|
1122
|
-
disabled:
|
|
1123
|
-
className:
|
|
1124
|
-
onKeyDown: (e) =>
|
|
1125
|
-
onClick: () =>
|
|
1126
|
-
children:
|
|
1127
|
-
},
|
|
1140
|
+
role: o === "single" ? "radio" : "button",
|
|
1141
|
+
"aria-checked": u.includes(e.value),
|
|
1142
|
+
tabIndex: o === "single" ? t === m ? 0 : -1 : void 0,
|
|
1143
|
+
disabled: s || e.disabled,
|
|
1144
|
+
className: r("min-h-8 rounded-[var(--control-radius)] px-3 type-control hover:bg-interaction-hover text-secondary-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-[var(--state-disabled-opacity)]", l && "min-h-[var(--wos-control-height)] text-[length:var(--wos-control-font-size)]", u.includes(e.value) && "bg-selected-subtle font-medium text-selected"),
|
|
1145
|
+
onKeyDown: (e) => h(e, t),
|
|
1146
|
+
onClick: () => d(e.value),
|
|
1147
|
+
children: e.label
|
|
1148
|
+
}, e.value))
|
|
1128
1149
|
});
|
|
1129
1150
|
}
|
|
1130
|
-
var
|
|
1131
|
-
function
|
|
1132
|
-
let d =
|
|
1133
|
-
let
|
|
1134
|
-
if (!
|
|
1151
|
+
var Oe = De;
|
|
1152
|
+
function ke({ label: e, value: t, onChange: n, length: i = 6, error: a, help: o, disabled: s, required: c, name: l, className: u }) {
|
|
1153
|
+
let d = N.useId(), f = N.useRef([]), p = Array.from({ length: i }, (e, n) => t[n] ?? ""), m = (e, t) => {
|
|
1154
|
+
let r = t.replace(/\D/g, "");
|
|
1155
|
+
if (!r) {
|
|
1135
1156
|
let t = [...p];
|
|
1136
|
-
t[e] = "",
|
|
1157
|
+
t[e] = "", n(t.join(""));
|
|
1137
1158
|
return;
|
|
1138
1159
|
}
|
|
1139
|
-
let a =
|
|
1160
|
+
let a = r.slice(0, i - e), o = [...p];
|
|
1140
1161
|
a.split("").forEach((t, n) => {
|
|
1141
1162
|
o[e + n] = t;
|
|
1142
|
-
}),
|
|
1163
|
+
}), n(o.join("")), f.current[Math.min(e + a.length, i - 1)]?.focus();
|
|
1143
1164
|
};
|
|
1144
|
-
return /* @__PURE__ */
|
|
1145
|
-
className:
|
|
1165
|
+
return /* @__PURE__ */ L("fieldset", {
|
|
1166
|
+
className: r("min-w-0", u),
|
|
1146
1167
|
children: [
|
|
1147
|
-
/* @__PURE__ */
|
|
1148
|
-
className: "mb-2 type-label
|
|
1149
|
-
children: [
|
|
1168
|
+
/* @__PURE__ */ L("legend", {
|
|
1169
|
+
className: "mb-2 type-label text-secondary-foreground",
|
|
1170
|
+
children: [e, c && /* @__PURE__ */ I("span", {
|
|
1150
1171
|
className: "ml-1 font-normal text-muted-foreground",
|
|
1151
1172
|
children: "Required"
|
|
1152
1173
|
})]
|
|
1153
1174
|
}),
|
|
1154
|
-
/* @__PURE__ */
|
|
1175
|
+
/* @__PURE__ */ I("div", {
|
|
1155
1176
|
className: "flex flex-wrap gap-2",
|
|
1156
1177
|
role: "group",
|
|
1157
|
-
"aria-label": String(
|
|
1158
|
-
children: p.map((
|
|
1178
|
+
"aria-label": String(e),
|
|
1179
|
+
children: p.map((t, n) => /* @__PURE__ */ I("input", {
|
|
1159
1180
|
ref: (e) => {
|
|
1160
1181
|
f.current[n] = e;
|
|
1161
1182
|
},
|
|
1162
1183
|
id: `${d}-${n}`,
|
|
1163
1184
|
name: n === 0 ? l : void 0,
|
|
1164
|
-
"aria-label": `${String(
|
|
1185
|
+
"aria-label": `${String(e)} digit ${n + 1} of ${i}`,
|
|
1165
1186
|
"aria-invalid": !!a || void 0,
|
|
1166
1187
|
"aria-describedby": a ? `${d}-error` : o ? `${d}-help` : void 0,
|
|
1167
1188
|
type: "text",
|
|
1168
1189
|
inputMode: "numeric",
|
|
1169
1190
|
autoComplete: n === 0 ? "one-time-code" : "off",
|
|
1170
1191
|
maxLength: i,
|
|
1171
|
-
value:
|
|
1192
|
+
value: t,
|
|
1172
1193
|
required: c,
|
|
1173
1194
|
disabled: s,
|
|
1174
|
-
className: "w-10 h-11 rounded-[var(--control-radius)] border border-input bg-surface text-center text-lg tabular focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-
|
|
1195
|
+
className: "wos-choice-input w-10 h-11 rounded-[var(--control-radius)] border border-input bg-surface text-center text-lg tabular focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-[var(--state-disabled-opacity)]",
|
|
1175
1196
|
onChange: (e) => m(n, e.currentTarget.value),
|
|
1176
1197
|
onKeyDown: (e) => {
|
|
1177
1198
|
e.key === "Backspace" && !p[n] && n > 0 && f.current[n - 1]?.focus(), e.key === "ArrowLeft" && n > 0 && (e.preventDefault(), f.current[n - 1]?.focus()), e.key === "ArrowRight" && n < i - 1 && (e.preventDefault(), f.current[n + 1]?.focus());
|
|
@@ -1182,12 +1203,12 @@ function Oe({ label: t, value: n, onChange: r, length: i = 6, error: a, help: o,
|
|
|
1182
1203
|
}
|
|
1183
1204
|
}, n))
|
|
1184
1205
|
}),
|
|
1185
|
-
o && /* @__PURE__ */
|
|
1206
|
+
o && /* @__PURE__ */ I("p", {
|
|
1186
1207
|
id: `${d}-help`,
|
|
1187
1208
|
className: "mt-1 type-caption text-muted-foreground",
|
|
1188
1209
|
children: o
|
|
1189
1210
|
}),
|
|
1190
|
-
a && /* @__PURE__ */
|
|
1211
|
+
a && /* @__PURE__ */ I("p", {
|
|
1191
1212
|
id: `${d}-error`,
|
|
1192
1213
|
className: "mt-1 type-caption text-destructive",
|
|
1193
1214
|
children: a
|
|
@@ -1195,29 +1216,29 @@ function Oe({ label: t, value: n, onChange: r, length: i = 6, error: a, help: o,
|
|
|
1195
1216
|
]
|
|
1196
1217
|
});
|
|
1197
1218
|
}
|
|
1198
|
-
function
|
|
1199
|
-
let d =
|
|
1200
|
-
let
|
|
1219
|
+
function Ae({ label: e, files: t, onFilesChange: n, accept: i, multiple: a, maxSizeBytes: o, help: s, disabled: c, required: l, className: u }) {
|
|
1220
|
+
let d = N.useId(), [f, p] = N.useState(!1), [m, h] = N.useState(""), g = s ? `${d}-help` : void 0, _ = m ? `${d}-error` : void 0, v = (e) => {
|
|
1221
|
+
let r = Array.from(e), s = o ? r.find((e) => e.size > o) : void 0;
|
|
1201
1222
|
if (s) {
|
|
1202
1223
|
let e = o >= 1048576 ? `${(o / 1024 / 1024).toFixed(1)} MB` : `${Math.round(o / 1024)} KB`;
|
|
1203
1224
|
h(`${s.name} exceeds the ${e} limit.`);
|
|
1204
1225
|
return;
|
|
1205
1226
|
}
|
|
1206
|
-
let c = i?.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), l = c?.length ?
|
|
1207
|
-
l ? h(`${l.name} is not an accepted file type (${i}).`) : (h(""),
|
|
1227
|
+
let c = i?.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), l = c?.length ? r.find((e) => !c.some((t) => t.startsWith(".") ? e.name.toLowerCase().endsWith(t) : t.endsWith("/*") ? e.type.startsWith(t.slice(0, -1)) : e.type === t)) : void 0;
|
|
1228
|
+
l ? h(`${l.name} is not an accepted file type (${i}).`) : (h(""), n(a ? [...t, ...r] : r.slice(0, 1)));
|
|
1208
1229
|
};
|
|
1209
|
-
return /* @__PURE__ */
|
|
1210
|
-
className:
|
|
1230
|
+
return /* @__PURE__ */ L("div", {
|
|
1231
|
+
className: r("space-y-1.5", u),
|
|
1211
1232
|
children: [
|
|
1212
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ L("label", {
|
|
1213
1234
|
htmlFor: d,
|
|
1214
|
-
className: "block type-label
|
|
1215
|
-
children: [
|
|
1235
|
+
className: "block type-label text-secondary-foreground",
|
|
1236
|
+
children: [e, l && /* @__PURE__ */ I("span", {
|
|
1216
1237
|
className: "ml-1 font-normal text-muted-foreground",
|
|
1217
1238
|
children: "Required"
|
|
1218
1239
|
})]
|
|
1219
1240
|
}),
|
|
1220
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ L("div", {
|
|
1221
1242
|
onDragOver: (e) => {
|
|
1222
1243
|
e.preventDefault(), c || p(!0);
|
|
1223
1244
|
},
|
|
@@ -1225,9 +1246,9 @@ function ke({ label: t, files: n, onFilesChange: r, accept: i, multiple: a, maxS
|
|
|
1225
1246
|
onDrop: (e) => {
|
|
1226
1247
|
e.preventDefault(), p(!1), c || v(e.dataTransfer.files);
|
|
1227
1248
|
},
|
|
1228
|
-
className:
|
|
1249
|
+
className: r("rounded-[var(--surface-radius)] border border-dashed p-4 text-center", f ? "border-selection-indicator bg-selected-subtle" : "border-border", c && "opacity-[var(--state-disabled-opacity)]"),
|
|
1229
1250
|
children: [
|
|
1230
|
-
/* @__PURE__ */
|
|
1251
|
+
/* @__PURE__ */ I("input", {
|
|
1231
1252
|
id: d,
|
|
1232
1253
|
type: "file",
|
|
1233
1254
|
accept: i,
|
|
@@ -1241,12 +1262,12 @@ function ke({ label: t, files: n, onFilesChange: r, accept: i, multiple: a, maxS
|
|
|
1241
1262
|
e.currentTarget.files && v(e.currentTarget.files), e.currentTarget.value = "";
|
|
1242
1263
|
}
|
|
1243
1264
|
}),
|
|
1244
|
-
/* @__PURE__ */
|
|
1265
|
+
/* @__PURE__ */ L("label", {
|
|
1245
1266
|
htmlFor: d,
|
|
1246
|
-
className:
|
|
1267
|
+
className: r("inline-flex min-h-11 cursor-pointer items-center rounded-[var(--control-radius)] border border-border bg-surface px-3 type-control hover:bg-interaction-hover peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-ring", c && "cursor-not-allowed"),
|
|
1247
1268
|
children: ["Choose file", a ? "s" : ""]
|
|
1248
1269
|
}),
|
|
1249
|
-
/* @__PURE__ */
|
|
1270
|
+
/* @__PURE__ */ L("p", {
|
|
1250
1271
|
className: "mt-2 type-caption text-muted-foreground",
|
|
1251
1272
|
children: [
|
|
1252
1273
|
"or drop ",
|
|
@@ -1255,57 +1276,63 @@ function ke({ label: t, files: n, onFilesChange: r, accept: i, multiple: a, maxS
|
|
|
1255
1276
|
i ? ` · ${i}` : ""
|
|
1256
1277
|
]
|
|
1257
1278
|
}),
|
|
1258
|
-
s && /* @__PURE__ */
|
|
1279
|
+
s && /* @__PURE__ */ I("p", {
|
|
1259
1280
|
id: g,
|
|
1260
1281
|
className: "mt-1 type-caption text-muted-foreground",
|
|
1261
1282
|
children: s
|
|
1262
1283
|
})
|
|
1263
1284
|
]
|
|
1264
1285
|
}),
|
|
1265
|
-
m && /* @__PURE__ */
|
|
1286
|
+
m && /* @__PURE__ */ I("p", {
|
|
1266
1287
|
id: _,
|
|
1267
1288
|
role: "alert",
|
|
1268
1289
|
className: "type-caption text-destructive",
|
|
1269
1290
|
children: m
|
|
1270
1291
|
}),
|
|
1271
|
-
|
|
1292
|
+
t.length > 0 && /* @__PURE__ */ I("ul", {
|
|
1272
1293
|
"aria-label": "Selected files",
|
|
1273
1294
|
className: "space-y-1",
|
|
1274
|
-
children:
|
|
1295
|
+
children: t.map((e, r) => /* @__PURE__ */ L("li", {
|
|
1275
1296
|
className: "flex items-center justify-between gap-2 type-caption",
|
|
1276
|
-
children: [/* @__PURE__ */
|
|
1297
|
+
children: [/* @__PURE__ */ I("span", {
|
|
1277
1298
|
className: "truncate",
|
|
1278
1299
|
children: e.name
|
|
1279
|
-
}), /* @__PURE__ */
|
|
1300
|
+
}), /* @__PURE__ */ I("button", {
|
|
1280
1301
|
type: "button",
|
|
1281
1302
|
"aria-label": `Remove ${e.name}`,
|
|
1282
1303
|
disabled: c,
|
|
1283
1304
|
className: "min-h-11 px-2 text-muted-foreground hover:text-foreground",
|
|
1284
|
-
onClick: () =>
|
|
1305
|
+
onClick: () => n(t.filter((e, t) => t !== r)),
|
|
1285
1306
|
children: "Remove"
|
|
1286
1307
|
})]
|
|
1287
|
-
}, `${e.name}-${
|
|
1308
|
+
}, `${e.name}-${r}`))
|
|
1288
1309
|
})
|
|
1289
1310
|
]
|
|
1290
1311
|
});
|
|
1291
1312
|
}
|
|
1292
1313
|
//#endregion
|
|
1293
1314
|
//#region src/components/textarea.tsx
|
|
1294
|
-
var
|
|
1295
|
-
|
|
1296
|
-
"aria-invalid"
|
|
1297
|
-
|
|
1298
|
-
|
|
1315
|
+
var je = N.forwardRef(({ className: e, invalid: n, density: i, "aria-invalid": a, ...o }, s) => /* @__PURE__ */ I("textarea", {
|
|
1316
|
+
"data-density": i,
|
|
1317
|
+
className: r("wos-textarea placeholder:text-muted-foreground aria-[invalid=true]:border-destructive", t(i), e),
|
|
1318
|
+
"aria-invalid": n || a || void 0,
|
|
1319
|
+
ref: s,
|
|
1320
|
+
...o
|
|
1299
1321
|
}));
|
|
1300
|
-
|
|
1322
|
+
je.displayName = "Textarea";
|
|
1301
1323
|
//#endregion
|
|
1302
1324
|
//#region src/components/surface.tsx
|
|
1303
|
-
var
|
|
1325
|
+
var Me = P("", {
|
|
1304
1326
|
variants: {
|
|
1305
1327
|
variant: {
|
|
1306
1328
|
working: "wos-surface",
|
|
1307
|
-
quiet: "border border-border
|
|
1308
|
-
raised: "border border-border bg-surface-raised shadow-working"
|
|
1329
|
+
quiet: "border border-surface-border bg-surface",
|
|
1330
|
+
raised: "border border-surface-border bg-surface-raised shadow-working"
|
|
1331
|
+
},
|
|
1332
|
+
radius: {
|
|
1333
|
+
default: "rounded-[var(--surface-radius)]",
|
|
1334
|
+
lg: "rounded-[var(--surface-radius-large)]",
|
|
1335
|
+
xl: "rounded-[var(--surface-radius-presentation)]"
|
|
1309
1336
|
},
|
|
1310
1337
|
padding: {
|
|
1311
1338
|
none: "p-0",
|
|
@@ -1316,67 +1343,69 @@ var je = N("rounded-[var(--surface-radius)]", {
|
|
|
1316
1343
|
},
|
|
1317
1344
|
defaultVariants: {
|
|
1318
1345
|
variant: "working",
|
|
1319
|
-
padding: "md"
|
|
1346
|
+
padding: "md",
|
|
1347
|
+
radius: "default"
|
|
1320
1348
|
}
|
|
1321
|
-
}),
|
|
1322
|
-
ref:
|
|
1323
|
-
className:
|
|
1324
|
-
variant:
|
|
1325
|
-
padding:
|
|
1326
|
-
|
|
1327
|
-
|
|
1349
|
+
}), Ne = N.forwardRef(({ className: e, variant: t, padding: n, radius: i, ...a }, o) => /* @__PURE__ */ I("div", {
|
|
1350
|
+
ref: o,
|
|
1351
|
+
className: r(Me({
|
|
1352
|
+
variant: t,
|
|
1353
|
+
padding: n,
|
|
1354
|
+
radius: i
|
|
1355
|
+
}), e),
|
|
1356
|
+
...a
|
|
1328
1357
|
}));
|
|
1329
|
-
|
|
1330
|
-
var
|
|
1358
|
+
Ne.displayName = "Surface";
|
|
1359
|
+
var Pe = N.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ I(Ne, {
|
|
1331
1360
|
ref: n,
|
|
1332
1361
|
className: e,
|
|
1333
1362
|
...t
|
|
1334
1363
|
}));
|
|
1335
|
-
|
|
1336
|
-
var
|
|
1337
|
-
ref:
|
|
1338
|
-
className:
|
|
1339
|
-
...
|
|
1364
|
+
Pe.displayName = "Card";
|
|
1365
|
+
var Fe = N.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ I("div", {
|
|
1366
|
+
ref: n,
|
|
1367
|
+
className: r("flex flex-col gap-1.5", e),
|
|
1368
|
+
...t
|
|
1340
1369
|
}));
|
|
1341
|
-
|
|
1342
|
-
var
|
|
1343
|
-
ref:
|
|
1344
|
-
className:
|
|
1345
|
-
...
|
|
1370
|
+
Fe.displayName = "CardHeader";
|
|
1371
|
+
var Ie = N.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ I("h3", {
|
|
1372
|
+
ref: n,
|
|
1373
|
+
className: r("type-subsection text-foreground", e),
|
|
1374
|
+
...t
|
|
1346
1375
|
}));
|
|
1347
|
-
|
|
1348
|
-
var
|
|
1349
|
-
ref:
|
|
1350
|
-
className:
|
|
1351
|
-
...
|
|
1376
|
+
Ie.displayName = "CardTitle";
|
|
1377
|
+
var Le = N.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ I("p", {
|
|
1378
|
+
ref: n,
|
|
1379
|
+
className: r("type-supporting text-muted-foreground", e),
|
|
1380
|
+
...t
|
|
1352
1381
|
}));
|
|
1353
|
-
|
|
1354
|
-
var
|
|
1355
|
-
ref:
|
|
1356
|
-
className: e
|
|
1357
|
-
...
|
|
1382
|
+
Le.displayName = "CardDescription";
|
|
1383
|
+
var Re = N.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ I("div", {
|
|
1384
|
+
ref: n,
|
|
1385
|
+
className: r(e),
|
|
1386
|
+
...t
|
|
1358
1387
|
}));
|
|
1359
|
-
|
|
1360
|
-
var
|
|
1361
|
-
ref:
|
|
1362
|
-
className:
|
|
1363
|
-
...
|
|
1388
|
+
Re.displayName = "CardContent";
|
|
1389
|
+
var ze = N.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ I("div", {
|
|
1390
|
+
ref: n,
|
|
1391
|
+
className: r("flex items-center", e),
|
|
1392
|
+
...t
|
|
1364
1393
|
}));
|
|
1365
|
-
|
|
1394
|
+
ze.displayName = "CardFooter";
|
|
1366
1395
|
//#endregion
|
|
1367
1396
|
//#region src/components/badge.tsx
|
|
1368
|
-
var
|
|
1397
|
+
var Be = P("wos-badge inline-flex items-center font-normal", {
|
|
1369
1398
|
variants: { variant: {
|
|
1370
1399
|
default: "",
|
|
1371
1400
|
secondary: "border-transparent bg-surface-subtle text-secondary-foreground",
|
|
1372
1401
|
outline: "bg-transparent"
|
|
1373
1402
|
} },
|
|
1374
1403
|
defaultVariants: { variant: "default" }
|
|
1375
|
-
}),
|
|
1404
|
+
}), Ve = N.forwardRef(({ className: e, variant: t, ...n }, i) => /* @__PURE__ */ I("span", {
|
|
1376
1405
|
ref: i,
|
|
1377
|
-
className:
|
|
1378
|
-
...
|
|
1406
|
+
className: r(Be({ variant: t }), e),
|
|
1407
|
+
...n
|
|
1379
1408
|
}));
|
|
1380
|
-
|
|
1409
|
+
Ve.displayName = "Badge";
|
|
1381
1410
|
//#endregion
|
|
1382
|
-
export {
|
|
1411
|
+
export { O as AspectRatio, ye as Autocomplete, C as Avatar, E as AvatarGroup, Ve as Badge, n as Button, z as ButtonGroup, Pe as Card, Re as CardContent, Le as CardDescription, ze as CardFooter, Fe as CardHeader, Ie as CardTitle, Se as Checkbox, b as CircularProgress, ve as Combobox, p as DataList, $ as DateInput, he as DateRangePicker, w as DescriptionList, D as EmptyState, o as Field, Ae as FileUpload, s as Form, a as FormField, R as IconButton, ke as InputOTP, h as KeyValue, x as MetricCard, ee as MoneyInput, xe as MultiSelect, l as Notice, H as NumberInput, k as Progress, te as QuantityInput, Ce as RadioGroup, g as ScrollArea, be as SearchInput, Oe as SegmentedControl, ie as Select, U as SelectMenu, _ as Separator, T as Skeleton, Te as Slider, S as Stat, c as StatusBadge, Ne as Surface, we as Switch, y as Table, v as TableBody, f as TableCaption, A as TableCell, M as TableFooter, m as TableHead, j as TableHeader, d as TableRow, V as TextInput, je as Textarea, u as Timeline, Ee as Toggle, De as ToggleGroup, de as UsDateInput, i as ValidationMessage, B as WealthIcon, Be as badgeVariants, e as buttonVariants, r as cn, ge as isDateRangeValid, Me as surfaceVariants };
|