@cascivo/react 0.16.1 → 0.17.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/accordion/accordion.js +5 -4
- package/dist/app-shell/app-shell.css +1 -1
- package/dist/app-shell/app-shell.js +28 -26
- package/dist/app-shell/app-shell.module.js +8 -8
- package/dist/button/button.css +1 -1
- package/dist/button/button.js +4 -1
- package/dist/button/button.module.js +4 -1
- package/dist/calendar/calendar.js +67 -63
- package/dist/card/card.css +1 -1
- package/dist/card/card.module.js +8 -8
- package/dist/checkbox/checkbox.css +1 -1
- package/dist/checkbox/checkbox.module.js +4 -4
- package/dist/combobox/combobox.js +55 -54
- package/dist/data-table/data-table.css +1 -1
- package/dist/data-table/data-table.js +155 -160
- package/dist/data-table/data-table.module.js +29 -29
- package/dist/date-picker/date-picker.js +90 -89
- package/dist/field/field.css +1 -1
- package/dist/field/field.module.js +3 -3
- package/dist/index.d.ts +72 -4
- package/dist/layouts/src/grid/grid.css +1 -1
- package/dist/layouts/src/grid/grid.module.js +3 -3
- package/dist/node/accordion/accordion.js +5 -4
- package/dist/node/app-shell/app-shell.js +28 -26
- package/dist/node/app-shell/app-shell.module.js +8 -8
- package/dist/node/button/button.js +4 -1
- package/dist/node/button/button.module.js +4 -1
- package/dist/node/calendar/calendar.js +67 -63
- package/dist/node/card/card.module.js +8 -8
- package/dist/node/checkbox/checkbox.module.js +4 -4
- package/dist/node/combobox/combobox.js +55 -54
- package/dist/node/data-table/data-table.js +155 -160
- package/dist/node/data-table/data-table.module.js +29 -29
- package/dist/node/date-picker/date-picker.js +90 -89
- package/dist/node/field/field.module.js +3 -3
- package/dist/node/layouts/src/grid/grid.module.js +3 -3
- package/dist/node/search/search.js +5 -4
- package/dist/node/side-nav/side-nav.js +90 -89
- package/dist/node/swap/swap.js +2 -3
- package/dist/node/switcher/switcher.js +1 -1
- package/dist/node/tabs/tabs.js +5 -4
- package/dist/node/toc/toc.js +5 -4
- package/dist/search/search.js +5 -4
- package/dist/side-nav/side-nav.js +90 -89
- package/dist/styles.css +7 -7
- package/dist/swap/swap.js +2 -3
- package/dist/switcher/switcher.js +1 -1
- package/dist/tabs/tabs.js +5 -4
- package/dist/toc/toc.js +5 -4
- package/package.json +3 -3
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import e from "./calendar.module.js";
|
|
4
|
-
import { batch as t, cn as n,
|
|
5
|
-
import { builtin as
|
|
6
|
-
import { jsx as
|
|
4
|
+
import { batch as t, cn as n, useControllableSignal as r, useSignal as i, useSignals as a } from "@cascivo/core";
|
|
5
|
+
import { builtin as o, currentLocale as s, t as c } from "@cascivo/i18n";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/calendar/calendar.tsx
|
|
8
|
-
function
|
|
8
|
+
function d(e) {
|
|
9
9
|
try {
|
|
10
10
|
let t = new Intl.Locale(e).weekInfo;
|
|
11
11
|
if (t) return t.firstDay % 7;
|
|
12
12
|
} catch {}
|
|
13
13
|
return 1;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function f(e, t, n) {
|
|
16
16
|
let r = new Date(Date.UTC(e, t, 1)), i = new Date(Date.UTC(e, t + 1, 0)), a = (r.getUTCDay() - n + 7) % 7, o = [];
|
|
17
17
|
for (let e = 0; e < a; e++) o.push(null);
|
|
18
18
|
for (let n = 1; n <= i.getUTCDate(); n++) o.push(new Date(Date.UTC(e, t, n)));
|
|
@@ -21,22 +21,22 @@ function d(e, t, n) {
|
|
|
21
21
|
for (let e = 0; e < o.length; e += 7) s.push(o.slice(e, e + 7));
|
|
22
22
|
return s;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function p(e) {
|
|
25
25
|
return `${e.getUTCFullYear()}-${e.getUTCMonth()}-${e.getUTCDate()}`;
|
|
26
26
|
}
|
|
27
|
-
function p(e, t) {
|
|
28
|
-
return !e || !t ? !1 : f(e) === f(t);
|
|
29
|
-
}
|
|
30
27
|
function m(e, t) {
|
|
31
|
-
return
|
|
28
|
+
return !e || !t ? !1 : p(e) === p(t);
|
|
32
29
|
}
|
|
33
30
|
function h(e, t) {
|
|
34
|
-
return new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth()
|
|
31
|
+
return new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate() + t));
|
|
35
32
|
}
|
|
36
33
|
function g(e, t) {
|
|
37
|
-
return
|
|
34
|
+
return new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth() + t, e.getUTCDate()));
|
|
35
|
+
}
|
|
36
|
+
function _(e, t) {
|
|
37
|
+
return h(e, -((e.getUTCDay() - t + 7) % 7));
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function v(e, t, n) {
|
|
40
40
|
if (t) {
|
|
41
41
|
let n = new Date(Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()));
|
|
42
42
|
if (e.getTime() < n.getTime()) return !0;
|
|
@@ -47,96 +47,100 @@ function _(e, t, n) {
|
|
|
47
47
|
}
|
|
48
48
|
return !1;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
function y({ value: p, defaultValue: y, onValueChange: b, min: x, max: S, disabled: C, locale: w, size: T = "md", labels: E, className: D, isInRange: O, isRangeStart: k, isRangeEnd: A, onDayHover: j, month: M, year: N, onViewChange: P, hideNav: F = !1 }) {
|
|
51
|
+
a();
|
|
52
|
+
let I = w ?? s(), L = E?.previousMonth ?? c(o.calendar.previousMonth), R = E?.nextMonth ?? c(o.calendar.nextMonth), z = p === void 0 ? y ?? null : p, B = /* @__PURE__ */ new Date(), V = z ?? y ?? B, [H] = r({
|
|
53
|
+
value: N,
|
|
54
|
+
defaultValue: V.getUTCFullYear()
|
|
55
|
+
}), [U] = r({
|
|
56
|
+
value: M,
|
|
57
|
+
defaultValue: V.getUTCMonth()
|
|
58
|
+
}), W = i(V), G = d(I), K = f(H.value, U.value, G), q = new Intl.DateTimeFormat(I, { weekday: "short" }), J = Array.from({ length: 7 }, (e, t) => {
|
|
59
|
+
let n = new Date(Date.UTC(2024, 0, 7 + G + t));
|
|
60
|
+
return q.format(n);
|
|
61
|
+
}), ee = new Intl.DateTimeFormat(I, {
|
|
58
62
|
weekday: "long",
|
|
59
63
|
year: "numeric",
|
|
60
64
|
month: "long",
|
|
61
65
|
day: "numeric"
|
|
62
|
-
}), Y = new Intl.DateTimeFormat(
|
|
66
|
+
}), Y = new Intl.DateTimeFormat(I, {
|
|
63
67
|
month: "long",
|
|
64
68
|
year: "numeric"
|
|
65
|
-
}).format(new Date(Date.UTC(
|
|
66
|
-
Z ?
|
|
67
|
-
|
|
68
|
-
}),
|
|
69
|
+
}).format(new Date(Date.UTC(H.value, U.value, 1))), X = (e) => v(e, x, S) || (C ? C(e) : !1), Z = M !== void 0 || N !== void 0, te = (e) => {
|
|
70
|
+
Z ? W.value = e : t(() => {
|
|
71
|
+
H.value = e.getUTCFullYear(), U.value = e.getUTCMonth(), W.value = e;
|
|
72
|
+
}), P?.({
|
|
69
73
|
month: e.getUTCMonth(),
|
|
70
74
|
year: e.getUTCFullYear()
|
|
71
75
|
});
|
|
72
76
|
}, Q = (e) => {
|
|
73
|
-
X(e) ||
|
|
77
|
+
X(e) || b?.(e);
|
|
74
78
|
}, $ = (e) => {
|
|
75
|
-
let n =
|
|
79
|
+
let n = g(new Date(Date.UTC(H.value, U.value, 1)), e), r = n.getUTCMonth(), i = n.getUTCFullYear();
|
|
76
80
|
Z || t(() => {
|
|
77
|
-
|
|
78
|
-
}),
|
|
81
|
+
U.value = r, H.value = i;
|
|
82
|
+
}), P?.({
|
|
79
83
|
month: r,
|
|
80
84
|
year: i
|
|
81
85
|
});
|
|
82
86
|
};
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
className: n(e.calendar,
|
|
85
|
-
"data-size":
|
|
86
|
-
onMouseLeave: () =>
|
|
87
|
-
children: [/* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ u("div", {
|
|
88
|
+
className: n(e.calendar, D),
|
|
89
|
+
"data-size": T,
|
|
90
|
+
onMouseLeave: () => j?.(null),
|
|
91
|
+
children: [/* @__PURE__ */ u("div", {
|
|
88
92
|
className: e.header,
|
|
89
93
|
children: [
|
|
90
|
-
|
|
94
|
+
F ? /* @__PURE__ */ l("span", { className: e.navSpacer }) : /* @__PURE__ */ l("button", {
|
|
91
95
|
type: "button",
|
|
92
96
|
className: e.navButton,
|
|
93
|
-
"aria-label":
|
|
97
|
+
"aria-label": L,
|
|
94
98
|
onClick: () => $(-1),
|
|
95
99
|
children: "‹"
|
|
96
100
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ l("span", {
|
|
98
102
|
className: e.monthLabel,
|
|
99
103
|
"aria-live": "polite",
|
|
100
104
|
children: Y
|
|
101
105
|
}),
|
|
102
|
-
|
|
106
|
+
F ? /* @__PURE__ */ l("span", { className: e.navSpacer }) : /* @__PURE__ */ l("button", {
|
|
103
107
|
type: "button",
|
|
104
108
|
className: e.navButton,
|
|
105
|
-
"aria-label":
|
|
109
|
+
"aria-label": R,
|
|
106
110
|
onClick: () => $(1),
|
|
107
111
|
children: "›"
|
|
108
112
|
})
|
|
109
113
|
]
|
|
110
|
-
}), /* @__PURE__ */
|
|
114
|
+
}), /* @__PURE__ */ u("table", {
|
|
111
115
|
role: "grid",
|
|
112
116
|
"aria-label": Y,
|
|
113
117
|
className: e.grid,
|
|
114
118
|
onKeyDown: (e) => {
|
|
115
|
-
let t =
|
|
119
|
+
let t = W.value, n;
|
|
116
120
|
switch (e.key) {
|
|
117
121
|
case "ArrowRight":
|
|
118
|
-
n =
|
|
122
|
+
n = h(t, 1);
|
|
119
123
|
break;
|
|
120
124
|
case "ArrowLeft":
|
|
121
|
-
n =
|
|
125
|
+
n = h(t, -1);
|
|
122
126
|
break;
|
|
123
127
|
case "ArrowDown":
|
|
124
|
-
n =
|
|
128
|
+
n = h(t, 7);
|
|
125
129
|
break;
|
|
126
130
|
case "ArrowUp":
|
|
127
|
-
n =
|
|
131
|
+
n = h(t, -7);
|
|
128
132
|
break;
|
|
129
133
|
case "Home":
|
|
130
|
-
n =
|
|
134
|
+
n = _(t, G);
|
|
131
135
|
break;
|
|
132
136
|
case "End":
|
|
133
|
-
n =
|
|
137
|
+
n = h(_(t, G), 6);
|
|
134
138
|
break;
|
|
135
139
|
case "PageUp":
|
|
136
|
-
n =
|
|
140
|
+
n = g(t, e.shiftKey ? -12 : -1);
|
|
137
141
|
break;
|
|
138
142
|
case "PageDown":
|
|
139
|
-
n =
|
|
143
|
+
n = g(t, e.shiftKey ? 12 : 1);
|
|
140
144
|
break;
|
|
141
145
|
case "Enter":
|
|
142
146
|
case " ":
|
|
@@ -144,45 +148,45 @@ function v({ value: f, defaultValue: v, onValueChange: y, min: b, max: x, disabl
|
|
|
144
148
|
return;
|
|
145
149
|
default: return;
|
|
146
150
|
}
|
|
147
|
-
e.preventDefault(),
|
|
151
|
+
e.preventDefault(), te(n), j?.(n);
|
|
148
152
|
},
|
|
149
|
-
children: [/* @__PURE__ */
|
|
153
|
+
children: [/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ l("tr", {
|
|
150
154
|
role: "row",
|
|
151
|
-
children:
|
|
155
|
+
children: J.map((t) => /* @__PURE__ */ l("th", {
|
|
152
156
|
className: e.weekday,
|
|
153
157
|
abbr: t,
|
|
154
158
|
scope: "col",
|
|
155
159
|
children: t
|
|
156
160
|
}, t))
|
|
157
|
-
}) }), /* @__PURE__ */
|
|
161
|
+
}) }), /* @__PURE__ */ l("tbody", { children: K.map((t, n) => /* @__PURE__ */ l("tr", {
|
|
158
162
|
role: "row",
|
|
159
163
|
children: t.map((t, n) => {
|
|
160
|
-
if (!t) return /* @__PURE__ */
|
|
164
|
+
if (!t) return /* @__PURE__ */ l("td", {
|
|
161
165
|
role: "gridcell",
|
|
162
166
|
className: e.empty
|
|
163
167
|
}, n);
|
|
164
|
-
let r =
|
|
165
|
-
return /* @__PURE__ */
|
|
168
|
+
let r = m(t, z), i = m(t, B), a = m(t, W.value), o = X(t), s = O ? O(t) : !1, c = k ? k(t) : !1, u = A ? A(t) : !1;
|
|
169
|
+
return /* @__PURE__ */ l("td", {
|
|
166
170
|
role: "gridcell",
|
|
167
171
|
className: e.cell,
|
|
168
172
|
"aria-selected": r,
|
|
169
|
-
children: /* @__PURE__ */
|
|
173
|
+
children: /* @__PURE__ */ l("button", {
|
|
170
174
|
type: "button",
|
|
171
175
|
className: e.day,
|
|
172
176
|
tabIndex: a ? 0 : -1,
|
|
173
|
-
"aria-label":
|
|
177
|
+
"aria-label": ee.format(t),
|
|
174
178
|
"aria-current": i ? "date" : void 0,
|
|
175
179
|
"aria-disabled": o || void 0,
|
|
176
180
|
"data-selected": r || void 0,
|
|
177
181
|
"data-today": i || void 0,
|
|
178
182
|
"data-in-range": s || void 0,
|
|
179
|
-
"data-range-start":
|
|
183
|
+
"data-range-start": c || void 0,
|
|
180
184
|
"data-range-end": u || void 0,
|
|
181
185
|
onClick: () => Q(t),
|
|
182
186
|
onFocus: () => {
|
|
183
|
-
|
|
187
|
+
W.value = t;
|
|
184
188
|
},
|
|
185
|
-
onMouseEnter: () =>
|
|
189
|
+
onMouseEnter: () => j?.(t),
|
|
186
190
|
children: t.getUTCDate()
|
|
187
191
|
})
|
|
188
192
|
}, n);
|
|
@@ -192,4 +196,4 @@ function v({ value: f, defaultValue: v, onValueChange: y, min: b, max: x, disabl
|
|
|
192
196
|
});
|
|
193
197
|
}
|
|
194
198
|
//#endregion
|
|
195
|
-
export {
|
|
199
|
+
export { y as Calendar };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
card: "
|
|
3
|
-
header: "
|
|
4
|
-
content: "
|
|
5
|
-
footer: "
|
|
6
|
-
headerRow: "
|
|
7
|
-
headerMain: "
|
|
8
|
-
headerActions: "
|
|
9
|
-
title: "
|
|
2
|
+
card: "_card_ipz9f_2",
|
|
3
|
+
header: "_header_ipz9f_19",
|
|
4
|
+
content: "_content_ipz9f_19",
|
|
5
|
+
footer: "_footer_ipz9f_19",
|
|
6
|
+
headerRow: "_headerRow_ipz9f_74",
|
|
7
|
+
headerMain: "_headerMain_ipz9f_82",
|
|
8
|
+
headerActions: "_headerActions_ipz9f_89",
|
|
9
|
+
title: "_title_ipz9f_97"
|
|
10
10
|
};
|
|
11
11
|
//#endregion
|
|
12
12
|
export { e as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
wrapper: "
|
|
3
|
-
input: "
|
|
4
|
-
control: "
|
|
5
|
-
label: "
|
|
2
|
+
wrapper: "_wrapper_4zlmw_2",
|
|
3
|
+
input: "_input_4zlmw_15",
|
|
4
|
+
control: "_control_4zlmw_28",
|
|
5
|
+
label: "_label_4zlmw_78"
|
|
6
6
|
};
|
|
7
7
|
//#endregion
|
|
8
8
|
export { e as default };
|
|
@@ -2,45 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./combobox.module.js";
|
|
4
4
|
import { useId as t, useRef as n } from "react";
|
|
5
|
-
import { cn as r, createMachine as i, focusElement as a,
|
|
6
|
-
import { builtin as
|
|
7
|
-
import { jsx as
|
|
5
|
+
import { cn as r, createMachine as i, focusElement as a, useControllableSignal as o, useMachine as s, useSignal as c, useSignalEffect as l, useSignals as u } from "@cascivo/core";
|
|
6
|
+
import { builtin as d, t as f } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/combobox/combobox.tsx
|
|
9
|
-
var
|
|
9
|
+
var h = i({
|
|
10
10
|
initial: "closed",
|
|
11
11
|
states: {
|
|
12
12
|
closed: { on: { OPEN: "open" } },
|
|
13
13
|
open: { on: { CLOSE: "closed" } }
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
let [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
c(() =>
|
|
16
|
+
function g({ options: i, value: g, defaultValue: _, onValueChange: v, onChange: y, clearable: b = !1, searchable: x = !0, label: S, hint: C, error: w, size: T = "md", disabled: E = !1, labels: D, className: O, id: k }) {
|
|
17
|
+
u();
|
|
18
|
+
let [A, j] = s(h), M = t(), N = k ?? `cascade-combobox-${M}`, P = `${M}-listbox`, F = n(null), ee = D?.placeholder ?? f(d.combobox.placeholder), I = D?.empty ?? f(d.combobox.empty), L = D?.clear ?? f(d.combobox.clear), R = D?.search ?? f(d.combobox.search), [z] = o({
|
|
19
|
+
value: g,
|
|
20
|
+
defaultValue: _
|
|
21
|
+
}), B = c(""), V = c(0), H = A.value === "open", U = i.filter((e) => !x || !B.value ? !0 : e.label.toLowerCase().includes(B.value.toLowerCase())), W = i.find((e) => e.value === z.value);
|
|
22
|
+
l(() => {
|
|
22
23
|
if (!H) return;
|
|
23
24
|
let e = (e) => {
|
|
24
|
-
let t = document.getElementById(`${
|
|
25
|
-
t && !t.contains(e.target) &&
|
|
25
|
+
let t = document.getElementById(`${M}-root`);
|
|
26
|
+
t && !t.contains(e.target) && j("CLOSE");
|
|
26
27
|
};
|
|
27
28
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
28
29
|
});
|
|
29
30
|
let G = () => {
|
|
30
|
-
|
|
31
|
+
E || (B.value = "", V.value = 0, j("OPEN"), setTimeout(() => a(F.current), 0));
|
|
31
32
|
}, K = () => {
|
|
32
|
-
|
|
33
|
-
}, q =
|
|
34
|
-
|
|
33
|
+
j("CLOSE"), B.value = "";
|
|
34
|
+
}, q = v ?? y, J = (e) => {
|
|
35
|
+
g === void 0 && (z.value = e), q?.(e), K();
|
|
35
36
|
}, Y = () => {
|
|
36
|
-
|
|
37
|
+
g === void 0 && (z.value = void 0), q?.(void 0);
|
|
37
38
|
}, X = U.flatMap((e, t) => e.disabled ? [] : [t]), Z = (e) => {
|
|
38
39
|
if (X.length === 0) return;
|
|
39
40
|
let t = X[(X.indexOf(V.value) + e + X.length) % X.length];
|
|
40
41
|
t !== void 0 && (V.value = t);
|
|
41
42
|
}, Q = (e) => {
|
|
42
43
|
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), G());
|
|
43
|
-
},
|
|
44
|
+
}, te = (e) => {
|
|
44
45
|
switch (e.key) {
|
|
45
46
|
case "ArrowDown":
|
|
46
47
|
e.preventDefault(), Z(1);
|
|
@@ -61,42 +62,42 @@ function h({ options: i, value: h, defaultValue: g, onValueChange: _, onChange:
|
|
|
61
62
|
K();
|
|
62
63
|
break;
|
|
63
64
|
}
|
|
64
|
-
}, $ = (e) => `${
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
id: `${
|
|
67
|
-
className: r(e.wrapper,
|
|
68
|
-
"data-state":
|
|
69
|
-
"data-size":
|
|
65
|
+
}, $ = (e) => `${M}-option-${e}`;
|
|
66
|
+
return /* @__PURE__ */ m("div", {
|
|
67
|
+
id: `${M}-root`,
|
|
68
|
+
className: r(e.wrapper, O),
|
|
69
|
+
"data-state": w ? "error" : A.value,
|
|
70
|
+
"data-size": T,
|
|
70
71
|
children: [
|
|
71
|
-
|
|
72
|
+
S && /* @__PURE__ */ p("label", {
|
|
72
73
|
className: e.label,
|
|
73
|
-
htmlFor:
|
|
74
|
-
children:
|
|
74
|
+
htmlFor: N,
|
|
75
|
+
children: S
|
|
75
76
|
}),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ m("div", {
|
|
77
78
|
className: e.field,
|
|
78
|
-
children: [/* @__PURE__ */
|
|
79
|
-
id:
|
|
79
|
+
children: [/* @__PURE__ */ m("button", {
|
|
80
|
+
id: N,
|
|
80
81
|
type: "button",
|
|
81
82
|
role: "combobox",
|
|
82
83
|
"aria-expanded": H,
|
|
83
|
-
"aria-controls":
|
|
84
|
+
"aria-controls": P,
|
|
84
85
|
"aria-haspopup": "listbox",
|
|
85
86
|
"aria-activedescendant": H && V.value >= 0 ? $(V.value) : void 0,
|
|
86
|
-
"aria-invalid":
|
|
87
|
-
"aria-describedby":
|
|
87
|
+
"aria-invalid": w ? !0 : void 0,
|
|
88
|
+
"aria-describedby": w ? `${M}-error` : C ? `${M}-hint` : void 0,
|
|
88
89
|
className: e.trigger,
|
|
89
|
-
disabled:
|
|
90
|
+
disabled: E,
|
|
90
91
|
onKeyDown: Q,
|
|
91
92
|
onClick: H ? K : G,
|
|
92
|
-
children: [/* @__PURE__ */
|
|
93
|
+
children: [/* @__PURE__ */ p("span", {
|
|
93
94
|
className: r(e.value, W ? void 0 : e.placeholder),
|
|
94
|
-
children: W?.label ??
|
|
95
|
-
}), /* @__PURE__ */
|
|
95
|
+
children: W?.label ?? ee
|
|
96
|
+
}), /* @__PURE__ */ p("span", {
|
|
96
97
|
className: e.chevron,
|
|
97
98
|
"aria-hidden": "true"
|
|
98
99
|
})]
|
|
99
|
-
}),
|
|
100
|
+
}), b && z.value !== void 0 && /* @__PURE__ */ p("button", {
|
|
100
101
|
type: "button",
|
|
101
102
|
className: e.clear,
|
|
102
103
|
"aria-label": L,
|
|
@@ -106,30 +107,30 @@ function h({ options: i, value: h, defaultValue: g, onValueChange: _, onChange:
|
|
|
106
107
|
children: "✕"
|
|
107
108
|
})]
|
|
108
109
|
}),
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ m("div", {
|
|
110
111
|
role: "listbox",
|
|
111
|
-
id:
|
|
112
|
+
id: P,
|
|
112
113
|
className: e.listbox,
|
|
113
114
|
"data-state": H ? "open" : "closed",
|
|
114
|
-
"aria-label":
|
|
115
|
-
children: [
|
|
115
|
+
"aria-label": S,
|
|
116
|
+
children: [x && H && /* @__PURE__ */ p("div", {
|
|
116
117
|
className: e.searchWrapper,
|
|
117
|
-
children: /* @__PURE__ */
|
|
118
|
-
ref:
|
|
118
|
+
children: /* @__PURE__ */ p("input", {
|
|
119
|
+
ref: F,
|
|
119
120
|
type: "text",
|
|
120
121
|
className: e.search,
|
|
121
122
|
value: B.value,
|
|
122
123
|
onChange: (e) => {
|
|
123
124
|
B.value = e.target.value, V.value = 0;
|
|
124
125
|
},
|
|
125
|
-
onKeyDown:
|
|
126
|
+
onKeyDown: te,
|
|
126
127
|
"aria-label": R,
|
|
127
128
|
autoComplete: "off"
|
|
128
129
|
})
|
|
129
|
-
}), U.length === 0 ? /* @__PURE__ */
|
|
130
|
+
}), U.length === 0 ? /* @__PURE__ */ p("div", {
|
|
130
131
|
className: e.empty,
|
|
131
132
|
children: I
|
|
132
|
-
}) : U.map((t, n) => /* @__PURE__ */
|
|
133
|
+
}) : U.map((t, n) => /* @__PURE__ */ p("div", {
|
|
133
134
|
id: $(n),
|
|
134
135
|
role: "option",
|
|
135
136
|
"aria-selected": t.value === z.value,
|
|
@@ -146,19 +147,19 @@ function h({ options: i, value: h, defaultValue: g, onValueChange: _, onChange:
|
|
|
146
147
|
children: t.label
|
|
147
148
|
}, t.value))]
|
|
148
149
|
}),
|
|
149
|
-
|
|
150
|
-
id: `${
|
|
150
|
+
w && /* @__PURE__ */ p("span", {
|
|
151
|
+
id: `${M}-error`,
|
|
151
152
|
className: e.error,
|
|
152
153
|
role: "alert",
|
|
153
|
-
children:
|
|
154
|
+
children: w
|
|
154
155
|
}),
|
|
155
|
-
!
|
|
156
|
-
id: `${
|
|
156
|
+
!w && C && /* @__PURE__ */ p("span", {
|
|
157
|
+
id: `${M}-hint`,
|
|
157
158
|
className: e.hint,
|
|
158
|
-
children:
|
|
159
|
+
children: C
|
|
159
160
|
})
|
|
160
161
|
]
|
|
161
162
|
});
|
|
162
163
|
}
|
|
163
164
|
//#endregion
|
|
164
|
-
export {
|
|
165
|
+
export { g as Combobox };
|