@brycks/core-front 0.5.0 → 0.6.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/dist/components/data/List/List.cjs +1 -1
- package/dist/components/data/List/List.cjs.map +1 -1
- package/dist/components/data/List/List.js +68 -148
- package/dist/components/data/List/List.js.map +1 -1
- package/dist/components/data/Table/Table.cjs +1 -1
- package/dist/components/data/Table/Table.cjs.map +1 -1
- package/dist/components/data/Table/Table.js +142 -224
- package/dist/components/data/Table/Table.js.map +1 -1
- package/dist/components/data/TreeView/TreeView.cjs +1 -1
- package/dist/components/data/TreeView/TreeView.cjs.map +1 -1
- package/dist/components/data/TreeView/TreeView.js +141 -182
- package/dist/components/data/TreeView/TreeView.js.map +1 -1
- package/dist/components/feedback/Drawer/Drawer.cjs +1 -22
- package/dist/components/feedback/Drawer/Drawer.cjs.map +1 -1
- package/dist/components/feedback/Drawer/Drawer.js +84 -184
- package/dist/components/feedback/Drawer/Drawer.js.map +1 -1
- package/dist/components/feedback/Modal/Modal.cjs +1 -1
- package/dist/components/feedback/Modal/Modal.cjs.map +1 -1
- package/dist/components/feedback/Modal/Modal.js +65 -150
- package/dist/components/feedback/Modal/Modal.js.map +1 -1
- package/dist/components/feedback/Toast/Toast.cjs +1 -10
- package/dist/components/feedback/Toast/Toast.cjs.map +1 -1
- package/dist/components/feedback/Toast/Toast.js +94 -187
- package/dist/components/feedback/Toast/Toast.js.map +1 -1
- package/dist/components/form/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/form/Checkbox/Checkbox.js +11 -11
- package/dist/components/form/Combobox/Combobox.cjs +1 -6
- package/dist/components/form/Combobox/Combobox.cjs.map +1 -1
- package/dist/components/form/Combobox/Combobox.js +187 -283
- package/dist/components/form/Combobox/Combobox.js.map +1 -1
- package/dist/components/form/Input/Input.cjs +1 -1
- package/dist/components/form/Input/Input.cjs.map +1 -1
- package/dist/components/form/Input/Input.js +38 -133
- package/dist/components/form/Input/Input.js.map +1 -1
- package/dist/components/form/Select/Select.cjs +1 -1
- package/dist/components/form/Select/Select.cjs.map +1 -1
- package/dist/components/form/Select/Select.js +36 -82
- package/dist/components/form/Select/Select.js.map +1 -1
- package/dist/components/form/TagInput/TagInput.cjs +1 -1
- package/dist/components/form/TagInput/TagInput.js +8 -8
- package/dist/components/form/Textarea/Textarea.cjs +1 -1
- package/dist/components/form/Textarea/Textarea.cjs.map +1 -1
- package/dist/components/form/Textarea/Textarea.js +61 -95
- package/dist/components/form/Textarea/Textarea.js.map +1 -1
- package/dist/components/navigation/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/components/navigation/ContextMenu/ContextMenu.js +9 -9
- package/dist/components/navigation/Menu/Menu.cjs +1 -1
- package/dist/components/navigation/Menu/Menu.cjs.map +1 -1
- package/dist/components/navigation/Menu/Menu.js +70 -135
- package/dist/components/navigation/Menu/Menu.js.map +1 -1
- package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination/Pagination.cjs.map +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +87 -157
- package/dist/components/navigation/Pagination/Pagination.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,358 +1,262 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { cx as
|
|
5
|
-
import { useId as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const Le = {
|
|
11
|
-
sm: { height: B.sm, fontSize: M.base - 1, padding: E.sm, iconSize: j.sm },
|
|
12
|
-
md: { height: B.md, fontSize: M.base, padding: E.md, iconSize: j.md },
|
|
13
|
-
lg: { height: B.lg, fontSize: M.md, padding: E.lg, iconSize: j.lg }
|
|
14
|
-
}, Ee = (C, p) => {
|
|
15
|
-
const c = p.toLowerCase();
|
|
16
|
-
return C.label.toLowerCase().includes(c) || C.value.toLowerCase().includes(c) || (C.description?.toLowerCase().includes(c) ?? !1);
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ne, useState as k, useRef as D, useMemo as j, useEffect as C, useCallback as N } from "react";
|
|
3
|
+
import { createPortal as se } from "react-dom";
|
|
4
|
+
import { cx as g } from "../../../utils/styles.js";
|
|
5
|
+
import { useId as ce } from "../../../hooks/useId.js";
|
|
6
|
+
import { spacing as ie } from "../../../design-system/tokens/spacing.js";
|
|
7
|
+
const ae = (v, b) => {
|
|
8
|
+
const a = b.toLowerCase();
|
|
9
|
+
return v.label.toLowerCase().includes(a) || v.value.toLowerCase().includes(a) || (v.description?.toLowerCase().includes(a) ?? !1);
|
|
17
10
|
};
|
|
18
|
-
function
|
|
11
|
+
function le() {
|
|
19
12
|
return /* @__PURE__ */ t("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t("path", { d: "M4 6l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
20
13
|
}
|
|
21
|
-
function
|
|
14
|
+
function de() {
|
|
22
15
|
return /* @__PURE__ */ t("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t("path", { d: "M4 4l6 6M10 4l-6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) });
|
|
23
16
|
}
|
|
24
|
-
const
|
|
25
|
-
options:
|
|
26
|
-
value:
|
|
27
|
-
defaultValue:
|
|
28
|
-
onChange:
|
|
29
|
-
onInputChange:
|
|
30
|
-
placeholder:
|
|
31
|
-
size:
|
|
32
|
-
disabled:
|
|
33
|
-
isInvalid:
|
|
34
|
-
required:
|
|
35
|
-
clearable:
|
|
36
|
-
"aria-label":
|
|
37
|
-
"aria-labelledby":
|
|
38
|
-
filterFn:
|
|
39
|
-
emptyText:
|
|
40
|
-
isLoading:
|
|
41
|
-
loadingText:
|
|
42
|
-
creatable:
|
|
43
|
-
onCreate:
|
|
44
|
-
createLabel:
|
|
45
|
-
clearLabel:
|
|
46
|
-
listboxLabel:
|
|
47
|
-
className:
|
|
48
|
-
testId:
|
|
49
|
-
},
|
|
50
|
-
const
|
|
51
|
-
() =>
|
|
52
|
-
[
|
|
53
|
-
),
|
|
54
|
-
|
|
55
|
-
!
|
|
56
|
-
}, [
|
|
57
|
-
const
|
|
17
|
+
const be = ne(function({
|
|
18
|
+
options: b,
|
|
19
|
+
value: a,
|
|
20
|
+
defaultValue: S = null,
|
|
21
|
+
onChange: M,
|
|
22
|
+
onInputChange: R,
|
|
23
|
+
placeholder: A = "Select or search...",
|
|
24
|
+
size: z = "md",
|
|
25
|
+
disabled: w = !1,
|
|
26
|
+
isInvalid: $ = !1,
|
|
27
|
+
required: F = !1,
|
|
28
|
+
clearable: K = !0,
|
|
29
|
+
"aria-label": B,
|
|
30
|
+
"aria-labelledby": V,
|
|
31
|
+
filterFn: O = ae,
|
|
32
|
+
emptyText: q = "No options found",
|
|
33
|
+
isLoading: P = !1,
|
|
34
|
+
loadingText: T = "Loading…",
|
|
35
|
+
creatable: L = !1,
|
|
36
|
+
onCreate: I,
|
|
37
|
+
createLabel: U = (p) => `Create "${p}"`,
|
|
38
|
+
clearLabel: X = "Clear selection",
|
|
39
|
+
listboxLabel: Y = "Options",
|
|
40
|
+
className: G,
|
|
41
|
+
testId: H
|
|
42
|
+
}, y) {
|
|
43
|
+
const p = ce("combobox-listbox"), [J, Q] = k(S), [s, f] = k(""), [o, u] = k(!1), [n, c] = k(-1), _ = D(null), x = D(null), W = D(null), l = a !== void 0 ? a : J, i = j(
|
|
44
|
+
() => b.find((e) => e.value === l),
|
|
45
|
+
[b, l]
|
|
46
|
+
), d = j(() => s ? b.filter((e) => O(e, s)) : b, [b, s, O]);
|
|
47
|
+
C(() => {
|
|
48
|
+
!o && i ? f(i.label) : !o && !l && f("");
|
|
49
|
+
}, [o, i, l]);
|
|
50
|
+
const h = N(
|
|
58
51
|
(e) => {
|
|
59
|
-
|
|
52
|
+
a === void 0 && Q(e), M?.(e), u(!1), c(-1), x.current?.focus();
|
|
60
53
|
},
|
|
61
|
-
[
|
|
62
|
-
),
|
|
54
|
+
[a, M]
|
|
55
|
+
), Z = N(
|
|
63
56
|
(e) => {
|
|
64
|
-
const
|
|
65
|
-
|
|
57
|
+
const r = e.target.value;
|
|
58
|
+
f(r), R?.(r), o || u(!0), c(0);
|
|
66
59
|
},
|
|
67
|
-
[
|
|
68
|
-
),
|
|
60
|
+
[o, R]
|
|
61
|
+
), ee = N(
|
|
69
62
|
(e) => {
|
|
70
|
-
e.stopPropagation(),
|
|
63
|
+
e.stopPropagation(), h(null), f(""), x.current?.focus();
|
|
71
64
|
},
|
|
72
|
-
[
|
|
73
|
-
),
|
|
65
|
+
[h]
|
|
66
|
+
), oe = N(
|
|
74
67
|
(e) => {
|
|
75
68
|
switch (e.key) {
|
|
76
69
|
case "ArrowDown":
|
|
77
|
-
e.preventDefault(),
|
|
70
|
+
e.preventDefault(), o ? c((r) => Math.min(r + 1, d.length - 1)) : (u(!0), c(0));
|
|
78
71
|
break;
|
|
79
72
|
case "ArrowUp":
|
|
80
|
-
e.preventDefault(),
|
|
73
|
+
e.preventDefault(), o && c((r) => Math.max(r - 1, 0));
|
|
81
74
|
break;
|
|
82
75
|
case "Enter":
|
|
83
|
-
e.preventDefault(),
|
|
76
|
+
e.preventDefault(), o && n >= 0 && d[n] ? d[n].disabled || h(d[n].value) : L && s && d.length === 0 && I?.(s);
|
|
84
77
|
break;
|
|
85
78
|
case "Escape":
|
|
86
|
-
e.preventDefault(),
|
|
79
|
+
e.preventDefault(), u(!1), c(-1), i && f(i.label);
|
|
87
80
|
break;
|
|
88
81
|
case "Tab":
|
|
89
|
-
|
|
82
|
+
o && (u(!1), c(-1));
|
|
90
83
|
break;
|
|
91
84
|
}
|
|
92
85
|
},
|
|
93
|
-
[
|
|
86
|
+
[o, n, d, h, L, s, I, i]
|
|
94
87
|
);
|
|
95
|
-
|
|
96
|
-
if (!
|
|
97
|
-
const e = (
|
|
98
|
-
|
|
88
|
+
C(() => {
|
|
89
|
+
if (!o) return;
|
|
90
|
+
const e = (r) => {
|
|
91
|
+
_.current?.contains(r.target) || (u(!1), c(-1), i && f(i.label));
|
|
99
92
|
};
|
|
100
93
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
101
|
-
}, [
|
|
102
|
-
if (!
|
|
103
|
-
|
|
104
|
-
}, [
|
|
105
|
-
const [
|
|
106
|
-
|
|
107
|
-
if (!
|
|
94
|
+
}, [o, i]), C(() => {
|
|
95
|
+
if (!o || n < 0) return;
|
|
96
|
+
W.current?.children[n]?.scrollIntoView({ block: "nearest" });
|
|
97
|
+
}, [o, n]);
|
|
98
|
+
const [E, te] = k({ top: 0, left: 0, width: 0 });
|
|
99
|
+
C(() => {
|
|
100
|
+
if (!o || !_.current) return;
|
|
108
101
|
const e = () => {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
top:
|
|
112
|
-
left:
|
|
113
|
-
width:
|
|
102
|
+
const r = _.current.getBoundingClientRect();
|
|
103
|
+
te({
|
|
104
|
+
top: r.bottom + window.scrollY + ie[1],
|
|
105
|
+
left: r.left + window.scrollX,
|
|
106
|
+
width: r.width
|
|
114
107
|
});
|
|
115
108
|
};
|
|
116
109
|
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
117
110
|
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
118
111
|
};
|
|
119
|
-
}, [
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
width:
|
|
124
|
-
}, me = {
|
|
125
|
-
position: "relative",
|
|
126
|
-
display: "flex",
|
|
127
|
-
alignItems: "center",
|
|
128
|
-
width: "100%",
|
|
129
|
-
height: v.height,
|
|
130
|
-
backgroundColor: b ? "var(--brycks-background-muted)" : "var(--brycks-background-default)",
|
|
131
|
-
border: `1px solid ${A ? "var(--brycks-error-default)" : H ? "var(--brycks-primary-default)" : "var(--brycks-border-default)"}`,
|
|
132
|
-
borderRadius: "var(--brycks-radius-md)",
|
|
133
|
-
transition: `all ${w.fast}ms ${x.easeOut}`,
|
|
134
|
-
cursor: b ? "not-allowed" : "text",
|
|
135
|
-
boxShadow: H ? "var(--brycks-focus-ring)" : void 0
|
|
136
|
-
}, he = {
|
|
137
|
-
flex: 1,
|
|
138
|
-
height: "100%",
|
|
139
|
-
padding: `0 ${v.padding}px`,
|
|
140
|
-
paddingRight: a[10],
|
|
141
|
-
fontSize: v.fontSize,
|
|
142
|
-
color: b ? "var(--brycks-foreground-disabled)" : "var(--brycks-foreground-default)",
|
|
143
|
-
backgroundColor: "transparent",
|
|
144
|
-
border: "none",
|
|
145
|
-
outline: "none",
|
|
146
|
-
cursor: b ? "not-allowed" : "text"
|
|
147
|
-
}, ye = {
|
|
148
|
-
position: "absolute",
|
|
149
|
-
right: v.padding,
|
|
150
|
-
display: "flex",
|
|
151
|
-
alignItems: "center",
|
|
152
|
-
gap: a[1],
|
|
153
|
-
pointerEvents: "none"
|
|
154
|
-
}, ve = {
|
|
155
|
-
display: "flex",
|
|
156
|
-
alignItems: "center",
|
|
157
|
-
justifyContent: "center",
|
|
158
|
-
width: a[5],
|
|
159
|
-
height: a[5],
|
|
160
|
-
color: "var(--brycks-foreground-muted)",
|
|
161
|
-
cursor: "pointer",
|
|
162
|
-
borderRadius: "var(--brycks-radius-sm)",
|
|
163
|
-
transition: `all ${w.fast}ms ${x.easeOut}`,
|
|
164
|
-
pointerEvents: "auto"
|
|
165
|
-
}, ge = {
|
|
166
|
-
display: "flex",
|
|
167
|
-
alignItems: "center",
|
|
168
|
-
justifyContent: "center",
|
|
169
|
-
color: "var(--brycks-foreground-muted)",
|
|
170
|
-
transform: r ? "rotate(180deg)" : "rotate(0)",
|
|
171
|
-
transition: `transform ${w.fast}ms ${x.easeOut}`
|
|
172
|
-
}, ke = {
|
|
173
|
-
position: "absolute",
|
|
174
|
-
top: D.top,
|
|
175
|
-
left: D.left,
|
|
176
|
-
width: D.width,
|
|
177
|
-
maxHeight: 300,
|
|
178
|
-
overflowY: "auto",
|
|
179
|
-
backgroundColor: "var(--brycks-background-elevated)",
|
|
180
|
-
border: "1px solid var(--brycks-border-default)",
|
|
181
|
-
borderRadius: "var(--brycks-radius-lg)",
|
|
182
|
-
boxShadow: "var(--brycks-shadow-lg)",
|
|
183
|
-
zIndex: "var(--brycks-z-dropdown)",
|
|
184
|
-
padding: a[1],
|
|
185
|
-
animation: `brycks-dropdown-in ${w.quick}ms ${x.easeOut}`
|
|
186
|
-
}, X = (e, o, we) => ({
|
|
187
|
-
display: "flex",
|
|
188
|
-
alignItems: "center",
|
|
189
|
-
gap: Ie.md,
|
|
190
|
-
padding: `${a[2]}px ${E.sm}px`,
|
|
191
|
-
fontSize: v.fontSize,
|
|
192
|
-
color: o ? "var(--brycks-foreground-disabled)" : "var(--brycks-foreground-default)",
|
|
193
|
-
backgroundColor: e ? "var(--brycks-background-muted)" : we ? "var(--brycks-primary-muted)" : "transparent",
|
|
194
|
-
borderRadius: "var(--brycks-radius-md)",
|
|
195
|
-
cursor: o ? "not-allowed" : "pointer",
|
|
196
|
-
transition: `background-color ${w.fast}ms ${x.easeOut}`
|
|
197
|
-
}), G = {
|
|
198
|
-
padding: `${a[4]}px ${a[3]}px`,
|
|
199
|
-
fontSize: v.fontSize,
|
|
200
|
-
color: "var(--brycks-foreground-muted)",
|
|
201
|
-
textAlign: "center"
|
|
112
|
+
}, [o]);
|
|
113
|
+
const re = {
|
|
114
|
+
top: E.top,
|
|
115
|
+
left: E.left,
|
|
116
|
+
width: E.width
|
|
202
117
|
};
|
|
203
|
-
return /* @__PURE__ */
|
|
118
|
+
return /* @__PURE__ */ m(
|
|
204
119
|
"div",
|
|
205
120
|
{
|
|
206
|
-
ref:
|
|
207
|
-
className:
|
|
208
|
-
|
|
209
|
-
"data-testid": se,
|
|
121
|
+
ref: _,
|
|
122
|
+
className: g("brycks-combobox", `brycks-combobox--${z}`, G),
|
|
123
|
+
"data-testid": H,
|
|
210
124
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ m(
|
|
212
126
|
"div",
|
|
213
127
|
{
|
|
214
|
-
|
|
215
|
-
|
|
128
|
+
className: g(
|
|
129
|
+
"brycks-combobox__wrapper",
|
|
130
|
+
$ && "brycks-combobox__wrapper--invalid",
|
|
131
|
+
w && "brycks-combobox__wrapper--disabled"
|
|
132
|
+
),
|
|
133
|
+
onClick: () => !w && x.current?.focus(),
|
|
216
134
|
children: [
|
|
217
135
|
/* @__PURE__ */ t(
|
|
218
136
|
"input",
|
|
219
137
|
{
|
|
220
138
|
ref: (e) => {
|
|
221
|
-
|
|
139
|
+
x.current = e, typeof y == "function" ? y(e) : y && (y.current = e);
|
|
222
140
|
},
|
|
223
141
|
type: "text",
|
|
224
142
|
role: "combobox",
|
|
225
|
-
"aria-expanded":
|
|
143
|
+
"aria-expanded": o,
|
|
226
144
|
"aria-haspopup": "listbox",
|
|
227
145
|
"aria-autocomplete": "list",
|
|
228
|
-
"aria-controls":
|
|
229
|
-
"aria-activedescendant":
|
|
230
|
-
"aria-invalid":
|
|
231
|
-
"aria-required":
|
|
232
|
-
"aria-label":
|
|
233
|
-
"aria-labelledby":
|
|
234
|
-
value:
|
|
235
|
-
placeholder:
|
|
236
|
-
disabled:
|
|
237
|
-
|
|
238
|
-
onChange:
|
|
239
|
-
onKeyDown:
|
|
146
|
+
"aria-controls": o ? p : void 0,
|
|
147
|
+
"aria-activedescendant": o && n >= 0 ? `${p}-option-${n}` : void 0,
|
|
148
|
+
"aria-invalid": $,
|
|
149
|
+
"aria-required": F,
|
|
150
|
+
"aria-label": B,
|
|
151
|
+
"aria-labelledby": V,
|
|
152
|
+
value: s,
|
|
153
|
+
placeholder: A,
|
|
154
|
+
disabled: w,
|
|
155
|
+
className: "brycks-combobox__input",
|
|
156
|
+
onChange: Z,
|
|
157
|
+
onKeyDown: oe,
|
|
240
158
|
onFocus: () => {
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
onBlur: () => K(!1)
|
|
159
|
+
u(!0);
|
|
160
|
+
}
|
|
244
161
|
}
|
|
245
162
|
),
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
|
|
163
|
+
/* @__PURE__ */ m("div", { className: "brycks-combobox__icons", children: [
|
|
164
|
+
K && l && !w && /* @__PURE__ */ t(
|
|
248
165
|
"button",
|
|
249
166
|
{
|
|
250
167
|
type: "button",
|
|
251
|
-
"aria-label":
|
|
252
|
-
|
|
253
|
-
onClick:
|
|
254
|
-
|
|
255
|
-
e.currentTarget.style.backgroundColor = "var(--brycks-background-muted)", e.currentTarget.style.color = "var(--brycks-foreground-default)";
|
|
256
|
-
},
|
|
257
|
-
onMouseLeave: (e) => {
|
|
258
|
-
e.currentTarget.style.backgroundColor = "transparent", e.currentTarget.style.color = "var(--brycks-foreground-muted)";
|
|
259
|
-
},
|
|
260
|
-
children: /* @__PURE__ */ t(Re, {})
|
|
168
|
+
"aria-label": X,
|
|
169
|
+
className: "brycks-combobox__clear",
|
|
170
|
+
onClick: ee,
|
|
171
|
+
children: /* @__PURE__ */ t(de, {})
|
|
261
172
|
}
|
|
262
173
|
),
|
|
263
|
-
/* @__PURE__ */ t("span", {
|
|
174
|
+
/* @__PURE__ */ t("span", { className: g("brycks-combobox__chevron", o && "brycks-combobox__chevron--open"), children: /* @__PURE__ */ t(le, {}) })
|
|
264
175
|
] })
|
|
265
176
|
]
|
|
266
177
|
}
|
|
267
178
|
),
|
|
268
|
-
|
|
269
|
-
/* @__PURE__ */
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
"
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
"aria-label": N || ie,
|
|
283
|
-
"aria-busy": q || void 0,
|
|
284
|
-
style: ke,
|
|
285
|
-
children: q ? /* @__PURE__ */ t("li", { style: G, role: "status", "aria-live": "polite", children: /* @__PURE__ */ f("span", { style: { display: "inline-flex", alignItems: "center", justifyContent: "center", gap: a[2] }, children: [
|
|
286
|
-
/* @__PURE__ */ f(
|
|
287
|
-
"svg",
|
|
288
|
-
{
|
|
289
|
-
width: "16",
|
|
290
|
-
height: "16",
|
|
291
|
-
viewBox: "0 0 24 24",
|
|
292
|
-
fill: "none",
|
|
293
|
-
className: "brycks-animate-spin",
|
|
294
|
-
"aria-hidden": "true",
|
|
295
|
-
children: [
|
|
296
|
-
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.2" }),
|
|
297
|
-
/* @__PURE__ */ t("path", { d: "M12 2C6.47715 2 2 6.47715 2 12", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" })
|
|
298
|
-
]
|
|
299
|
-
}
|
|
300
|
-
),
|
|
301
|
-
te
|
|
302
|
-
] }) }) : u.length > 0 ? u.map((e, o) => /* @__PURE__ */ f(
|
|
303
|
-
"li",
|
|
179
|
+
o && se(
|
|
180
|
+
/* @__PURE__ */ t(
|
|
181
|
+
"ul",
|
|
182
|
+
{
|
|
183
|
+
ref: W,
|
|
184
|
+
id: p,
|
|
185
|
+
role: "listbox",
|
|
186
|
+
"aria-label": B || Y,
|
|
187
|
+
"aria-busy": P || void 0,
|
|
188
|
+
className: "brycks-combobox__dropdown",
|
|
189
|
+
style: re,
|
|
190
|
+
children: P ? /* @__PURE__ */ t("li", { className: "brycks-combobox__empty", role: "status", "aria-live": "polite", children: /* @__PURE__ */ m("span", { className: "brycks-combobox__loading", children: [
|
|
191
|
+
/* @__PURE__ */ m(
|
|
192
|
+
"svg",
|
|
304
193
|
{
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
"
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
onMouseEnter: () => s(o),
|
|
194
|
+
width: "16",
|
|
195
|
+
height: "16",
|
|
196
|
+
viewBox: "0 0 24 24",
|
|
197
|
+
fill: "none",
|
|
198
|
+
className: "brycks-animate-spin",
|
|
199
|
+
"aria-hidden": "true",
|
|
312
200
|
children: [
|
|
313
|
-
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
-
/* @__PURE__ */ t("div", { style: { fontWeight: e.value === l ? 500 : 400 }, children: e.label }),
|
|
316
|
-
e.description && /* @__PURE__ */ t("div", { style: { fontSize: M.sm, color: "var(--brycks-foreground-muted)" }, children: e.description })
|
|
317
|
-
] }),
|
|
318
|
-
e.value === l && /* @__PURE__ */ t("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ t(
|
|
319
|
-
"path",
|
|
320
|
-
{
|
|
321
|
-
d: "M3 8l3 3 7-7",
|
|
322
|
-
stroke: "var(--brycks-primary-default)",
|
|
323
|
-
strokeWidth: "2",
|
|
324
|
-
strokeLinecap: "round",
|
|
325
|
-
strokeLinejoin: "round"
|
|
326
|
-
}
|
|
327
|
-
) })
|
|
201
|
+
/* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.2" }),
|
|
202
|
+
/* @__PURE__ */ t("path", { d: "M12 2C6.47715 2 2 6.47715 2 12", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" })
|
|
328
203
|
]
|
|
329
|
-
},
|
|
330
|
-
e.value
|
|
331
|
-
)) : /* @__PURE__ */ t("li", { style: G, children: R && i ? /* @__PURE__ */ t(
|
|
332
|
-
"button",
|
|
333
|
-
{
|
|
334
|
-
type: "button",
|
|
335
|
-
style: {
|
|
336
|
-
...X(!0, !1, !1),
|
|
337
|
-
width: "100%",
|
|
338
|
-
border: "none",
|
|
339
|
-
cursor: "pointer"
|
|
340
|
-
},
|
|
341
|
-
onClick: () => O?.(i),
|
|
342
|
-
children: oe(i)
|
|
343
204
|
}
|
|
344
|
-
)
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
205
|
+
),
|
|
206
|
+
T
|
|
207
|
+
] }) }) : d.length > 0 ? d.map((e, r) => /* @__PURE__ */ m(
|
|
208
|
+
"li",
|
|
209
|
+
{
|
|
210
|
+
id: `${p}-option-${r}`,
|
|
211
|
+
role: "option",
|
|
212
|
+
"aria-selected": e.value === l,
|
|
213
|
+
"aria-disabled": e.disabled,
|
|
214
|
+
className: g(
|
|
215
|
+
"brycks-combobox__option",
|
|
216
|
+
e.value === l && "brycks-combobox__option--selected",
|
|
217
|
+
r === n && "brycks-combobox__option--active",
|
|
218
|
+
e.disabled && "brycks-combobox__option--disabled"
|
|
219
|
+
),
|
|
220
|
+
onClick: () => !e.disabled && h(e.value),
|
|
221
|
+
onMouseEnter: () => c(r),
|
|
222
|
+
children: [
|
|
223
|
+
e.icon && /* @__PURE__ */ t("span", { className: "brycks-combobox__option-icon", children: e.icon }),
|
|
224
|
+
/* @__PURE__ */ m("div", { className: "brycks-combobox__option-body", children: [
|
|
225
|
+
/* @__PURE__ */ t("div", { className: "brycks-combobox__option-label", children: e.label }),
|
|
226
|
+
e.description && /* @__PURE__ */ t("div", { className: "brycks-combobox__option-description", children: e.description })
|
|
227
|
+
] }),
|
|
228
|
+
e.value === l && /* @__PURE__ */ t("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "brycks-combobox__option-check", children: /* @__PURE__ */ t(
|
|
229
|
+
"path",
|
|
230
|
+
{
|
|
231
|
+
d: "M3 8l3 3 7-7",
|
|
232
|
+
stroke: "var(--brycks-primary-default)",
|
|
233
|
+
strokeWidth: "2",
|
|
234
|
+
strokeLinecap: "round",
|
|
235
|
+
strokeLinejoin: "round"
|
|
236
|
+
}
|
|
237
|
+
) })
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
e.value
|
|
241
|
+
)) : /* @__PURE__ */ t("li", { className: "brycks-combobox__empty", children: L && s ? /* @__PURE__ */ t(
|
|
242
|
+
"button",
|
|
243
|
+
{
|
|
244
|
+
type: "button",
|
|
245
|
+
className: "brycks-combobox__option brycks-combobox__option--active brycks-combobox__option--create",
|
|
246
|
+
onClick: () => I?.(s),
|
|
247
|
+
children: U(s)
|
|
248
|
+
}
|
|
249
|
+
) : q })
|
|
250
|
+
}
|
|
251
|
+
),
|
|
348
252
|
document.body
|
|
349
253
|
)
|
|
350
254
|
]
|
|
351
255
|
}
|
|
352
256
|
);
|
|
353
257
|
});
|
|
354
|
-
|
|
258
|
+
be.displayName = "Combobox";
|
|
355
259
|
export {
|
|
356
|
-
|
|
260
|
+
be as Combobox
|
|
357
261
|
};
|
|
358
262
|
//# sourceMappingURL=Combobox.js.map
|