@solibo/solibo-ui 2.2.16 → 2.2.18
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/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/components/app-layout/index.cjs +1 -0
- package/dist/components/app-layout/index.js +17 -0
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.js +1 -1
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +195 -184
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +78 -70
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.js +34 -34
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
- package/dist/components/app-shell/index.cjs +0 -1
- package/dist/components/app-shell/index.js +0 -17
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { jsxs as b, Fragment as
|
|
1
|
+
import { jsxs as b, Fragment as it, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import k from "classix";
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
5
|
-
import { FieldError as
|
|
6
|
-
import { i as
|
|
7
|
-
import { f as
|
|
8
|
-
import { Label as
|
|
9
|
-
import { List as
|
|
10
|
-
import { Loading as
|
|
11
|
-
import { S as
|
|
12
|
-
import '../../assets/index41.css';function
|
|
13
|
-
return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(
|
|
3
|
+
import rt, { Children as lt, isValidElement as F, useRef as _, useId as st, useState as D, useCallback as oe, useEffect as g } from "react";
|
|
4
|
+
import { Button as j } from "../button/index.js";
|
|
5
|
+
import { FieldError as at } from "../form/index.js";
|
|
6
|
+
import { i as ot } from "../../icons-DVeBguFb.js";
|
|
7
|
+
import { f as ct, I as dt } from "../../index-6TyCExT0.js";
|
|
8
|
+
import { Label as ut } from "../label/index.js";
|
|
9
|
+
import { List as ft } from "../list/index.js";
|
|
10
|
+
import { Loading as Re } from "../loading/index.js";
|
|
11
|
+
import { S as pt, s as mt, r as ce } from "../../index-GPsHvb4d.js";
|
|
12
|
+
import '../../assets/index41.css';function K(t) {
|
|
13
|
+
return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(K).join(" ") : F(t) ? K(t.props.children) : "";
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
function bt(t) {
|
|
16
|
+
return F(t) && t.type === "option";
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function yt(t) {
|
|
19
|
+
return F(t) && t.type === "optgroup";
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
21
|
+
function _t(t) {
|
|
22
|
+
return F(t) && t.type === rt.Fragment;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function vt(t) {
|
|
25
|
+
return F(t) && t.type === pt;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
return
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
else if (
|
|
33
|
-
const
|
|
34
|
-
|
|
27
|
+
function de(t, s, r = !1) {
|
|
28
|
+
const a = [];
|
|
29
|
+
return lt.forEach(t, (n) => {
|
|
30
|
+
if (_t(n))
|
|
31
|
+
a.push(...de(n.props.children, s, r));
|
|
32
|
+
else if (bt(n)) {
|
|
33
|
+
const w = K(n.props.children).trim(), W = n.props.value != null ? String(n.props.value) : w;
|
|
34
|
+
a.push({
|
|
35
35
|
disabled: r || !!n.props.disabled,
|
|
36
36
|
groupLabel: s,
|
|
37
37
|
hidden: !!n.props.hidden,
|
|
38
|
-
isPlaceholder: !!(n.props.hidden &&
|
|
38
|
+
isPlaceholder: !!(n.props.hidden && W === ""),
|
|
39
39
|
label: n.props.children,
|
|
40
40
|
selected: !!n.props.selected,
|
|
41
|
-
text:
|
|
42
|
-
value:
|
|
41
|
+
text: w,
|
|
42
|
+
value: W
|
|
43
43
|
});
|
|
44
|
-
} else
|
|
45
|
-
}),
|
|
44
|
+
} else yt(n) && a.push(...de(n.props.children, n.props.label, r || !!n.props.disabled));
|
|
45
|
+
}), a;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function ht(t) {
|
|
48
48
|
const s = t.trim();
|
|
49
49
|
if (!s) return null;
|
|
50
|
-
const
|
|
51
|
-
return new RegExp(`^${
|
|
50
|
+
const a = [.../[*?]/.test(s) ? s : `*${s}*`].map((n) => n === "*" ? ".*" : n === "?" ? "." : n.replace(/[|\\{}()[\]^$+.,]/g, "\\$&")).join("");
|
|
51
|
+
return new RegExp(`^${a}$`, "i");
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const r =
|
|
55
|
-
return r ?
|
|
53
|
+
function gt(t, s) {
|
|
54
|
+
const r = ht(s), a = t.filter((n) => !n.hidden && !n.isPlaceholder);
|
|
55
|
+
return r ? a.filter((n) => r.test([n.groupLabel, n.text, n.value].filter(Boolean).join(" "))) : a;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function wt(t, s) {
|
|
58
58
|
return t.find((r) => r.value === s) ?? t.find((r) => r.isPlaceholder) ?? t[0];
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
var
|
|
62
|
-
return s != null ? String(s) : r != null ? String(r) : ((
|
|
60
|
+
function qt(t, s, r) {
|
|
61
|
+
var a, n;
|
|
62
|
+
return s != null ? String(s) : r != null ? String(r) : ((a = t.find((w) => w.selected)) == null ? void 0 : a.value) ?? ((n = t[0]) == null ? void 0 : n.value) ?? "";
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
if (
|
|
64
|
+
function St(t) {
|
|
65
|
+
if (vt(t)) {
|
|
66
66
|
const {
|
|
67
67
|
children: s,
|
|
68
68
|
placeholder: r,
|
|
69
|
-
...
|
|
69
|
+
...a
|
|
70
70
|
} = t.props;
|
|
71
71
|
return {
|
|
72
|
-
children: /* @__PURE__ */ b(
|
|
72
|
+
children: /* @__PURE__ */ b(it, { children: [
|
|
73
73
|
r && /* @__PURE__ */ l("option", { hidden: !0, value: "", children: r }),
|
|
74
74
|
s
|
|
75
75
|
] }),
|
|
76
|
-
props:
|
|
76
|
+
props: a
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
return {
|
|
@@ -81,183 +81,194 @@ function bt(t) {
|
|
|
81
81
|
props: t.props
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
const
|
|
85
|
-
combobox:
|
|
86
|
-
"combobox-input": "_combobox-
|
|
87
|
-
dropdown:
|
|
88
|
-
empty:
|
|
89
|
-
group:
|
|
90
|
-
placeholder:
|
|
91
|
-
filter:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
84
|
+
const It = "_combobox_7iy0q_3", Nt = "_dropdown_7iy0q_21", xt = "_empty_7iy0q_29", Et = "_group_7iy0q_30", Ct = "_placeholder_7iy0q_31", Rt = "_filter_7iy0q_39", Vt = "_native_7iy0q_71", $t = "_option_7iy0q_81", Bt = "_options_7iy0q_107", kt = "_panel_7iy0q_117", Dt = "_selected_7iy0q_142", jt = "_text_7iy0q_146", Ft = "_trigger_7iy0q_154", Wt = "_minimal_7iy0q_199", zt = "_inline_7iy0q_259", Qt = "_field_7iy0q_293", Gt = "_label_7iy0q_297", i = {
|
|
85
|
+
combobox: It,
|
|
86
|
+
"combobox-input": "_combobox-input_7iy0q_12",
|
|
87
|
+
dropdown: Nt,
|
|
88
|
+
empty: xt,
|
|
89
|
+
group: Et,
|
|
90
|
+
placeholder: Ct,
|
|
91
|
+
filter: Rt,
|
|
92
|
+
"filter-controls": "_filter-controls_7iy0q_46",
|
|
93
|
+
"loading-status": "_loading-status_7iy0q_57",
|
|
94
|
+
native: Vt,
|
|
95
|
+
option: $t,
|
|
96
|
+
options: Bt,
|
|
97
|
+
panel: kt,
|
|
98
|
+
selected: Dt,
|
|
99
|
+
text: jt,
|
|
100
|
+
trigger: Ft,
|
|
101
|
+
minimal: Wt,
|
|
102
|
+
inline: zt,
|
|
103
|
+
field: Qt,
|
|
104
|
+
label: Gt,
|
|
105
|
+
"inline-field": "_inline-field_7iy0q_302"
|
|
104
106
|
};
|
|
105
|
-
function
|
|
107
|
+
function Ve(t, s) {
|
|
106
108
|
return {
|
|
107
|
-
"--icon-svg":
|
|
109
|
+
"--icon-svg": ot(t, s)
|
|
108
110
|
};
|
|
109
111
|
}
|
|
110
|
-
const
|
|
112
|
+
const Yt = ({
|
|
111
113
|
children: t,
|
|
112
114
|
className: s,
|
|
113
115
|
combobox: r = !1,
|
|
114
|
-
description:
|
|
116
|
+
description: a,
|
|
115
117
|
errorMessage: n,
|
|
116
|
-
invalid:
|
|
117
|
-
searchable:
|
|
118
|
-
createOption:
|
|
119
|
-
emptyLabel:
|
|
120
|
-
errorLabel:
|
|
121
|
-
onRetry:
|
|
122
|
-
retryLabel:
|
|
123
|
-
label:
|
|
124
|
-
filterOptions:
|
|
125
|
-
hasNextPage:
|
|
126
|
-
loading:
|
|
127
|
-
|
|
118
|
+
invalid: w = !1,
|
|
119
|
+
searchable: W,
|
|
120
|
+
createOption: q,
|
|
121
|
+
emptyLabel: $e = "No matches found",
|
|
122
|
+
errorLabel: p,
|
|
123
|
+
onRetry: ue,
|
|
124
|
+
retryLabel: Be = "Retry",
|
|
125
|
+
label: v,
|
|
126
|
+
filterOptions: ke = !0,
|
|
127
|
+
hasNextPage: y = !1,
|
|
128
|
+
loading: d = !1,
|
|
129
|
+
loadingLabel: fe = "Loading",
|
|
130
|
+
loadMoreLabel: De = "Load more",
|
|
128
131
|
onLoadMore: R,
|
|
129
|
-
onOpenChange:
|
|
132
|
+
onOpenChange: z,
|
|
130
133
|
onSearchChange: Q,
|
|
131
|
-
searchValue:
|
|
132
|
-
renderOption:
|
|
133
|
-
searchPlaceholder:
|
|
134
|
-
selectedItems:
|
|
135
|
-
variant:
|
|
136
|
-
...
|
|
134
|
+
searchValue: L,
|
|
135
|
+
renderOption: O,
|
|
136
|
+
searchPlaceholder: T = "Filter",
|
|
137
|
+
selectedItems: je,
|
|
138
|
+
variant: S = "default",
|
|
139
|
+
...Fe
|
|
137
140
|
}) => {
|
|
138
|
-
const
|
|
139
|
-
defaultValue:
|
|
140
|
-
onChange:
|
|
141
|
-
value:
|
|
142
|
-
...
|
|
143
|
-
} =
|
|
144
|
-
className:
|
|
145
|
-
...
|
|
146
|
-
} =
|
|
147
|
-
|
|
148
|
-
}, [Q,
|
|
149
|
-
|
|
150
|
-
}, [
|
|
151
|
-
default:
|
|
152
|
-
white:
|
|
153
|
-
},
|
|
141
|
+
const H = St(t), {
|
|
142
|
+
defaultValue: We,
|
|
143
|
+
onChange: J,
|
|
144
|
+
value: P,
|
|
145
|
+
...ze
|
|
146
|
+
} = H.props, o = mt(ze), {
|
|
147
|
+
className: Qe,
|
|
148
|
+
...Ge
|
|
149
|
+
} = o, pe = _(null), me = _(null), I = st(), U = w && n ? `${I}-error` : void 0, be = a ? `${I}-description` : void 0, ye = [o["aria-describedby"], be, U].filter(Boolean).join(" ") || void 0, _e = w ? !0 : o["aria-invalid"], ve = _(null), N = _(null), X = _(null), he = _(null), Y = _(!1), Z = _(!1), ee = _(R), ge = !!R, x = de(H.children), V = P != null, te = qt(x, P, We), [ne, ie] = D(() => te), [c, Ae] = D(!1), [Me, we] = D(!1), [Ke, Le] = D(null), [Oe, Te] = D(""), h = L ?? Oe, re = x.filter((e) => !e.hidden).length, He = Ke ?? (d || !!p || y || re > 8), E = W ?? (He || Me || h.length > 0), $ = oe((e) => {
|
|
150
|
+
L === void 0 && Te(e), Q == null || Q(e);
|
|
151
|
+
}, [Q, L]), m = oe((e) => {
|
|
152
|
+
Y.current === e || e && o.disabled || (Y.current = e, Ae(e), z == null || z(e), e || $(""));
|
|
153
|
+
}, [z, o.disabled, $]), G = V ? String(P) : ne, qe = {
|
|
154
|
+
default: ce("--colors-semantic-content-secondary"),
|
|
155
|
+
white: ce("--color-white", "white")
|
|
156
|
+
}, Se = o.disabled ? ce("--colors-semantic-content-disabled") : S === "minimal" ? qe.white : qe.default, A = wt(x, G), Je = Ve("CaretDown", Se), Pe = Ve("MagnifyingGlass", Se), le = gt(x, ke ? h : ""), C = h.trim(), M = !!(r && q && C && q.isValid(C)), Ue = v && S === "inline" ? ct(v) : v, Ie = (e) => e ? (O == null ? void 0 : O({
|
|
154
157
|
groupLabel: e.groupLabel,
|
|
155
|
-
isSelected: e.value ===
|
|
158
|
+
isSelected: e.value === G,
|
|
156
159
|
label: e.label,
|
|
157
160
|
text: e.text,
|
|
158
161
|
value: e.value
|
|
159
162
|
})) ?? e.label : "Select an option";
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}, [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
g(() => {
|
|
164
|
+
c && !h && !d && !p && Le(y || re > 8);
|
|
165
|
+
}, [c, h, d, p, y, re]), g(() => {
|
|
166
|
+
!V && !x.some((e) => e.value === ne) && ie(te);
|
|
167
|
+
}, [te, ne, V, x]), g(() => {
|
|
168
|
+
c ? E && we(!0) : we(!1);
|
|
169
|
+
}, [c, E]), g(() => {
|
|
170
|
+
var e, u, f;
|
|
171
|
+
c && (r || E ? (e = N.current) == null || e.focus() : (f = (u = X.current) == null ? void 0 : u.querySelector("button:not(:disabled)")) == null || f.focus());
|
|
172
|
+
}, [c, r, E]), g(() => {
|
|
173
|
+
if (!c)
|
|
167
174
|
return;
|
|
168
|
-
const e = (
|
|
169
|
-
var
|
|
170
|
-
(
|
|
175
|
+
const e = (u) => {
|
|
176
|
+
var f;
|
|
177
|
+
(f = me.current) != null && f.contains(u.target) || m(!1);
|
|
171
178
|
};
|
|
172
179
|
return document.addEventListener("mousedown", e), () => {
|
|
173
180
|
document.removeEventListener("mousedown", e);
|
|
174
181
|
};
|
|
175
|
-
}, [
|
|
176
|
-
|
|
177
|
-
}, [R]),
|
|
178
|
-
|
|
179
|
-
}, [
|
|
180
|
-
const
|
|
181
|
-
!
|
|
182
|
-
}, [
|
|
183
|
-
|
|
184
|
-
if (
|
|
185
|
-
const e =
|
|
186
|
-
if (!e || !
|
|
187
|
-
let
|
|
188
|
-
const
|
|
189
|
-
|
|
182
|
+
}, [m, c]), g(() => {
|
|
183
|
+
ee.current = R;
|
|
184
|
+
}, [R]), g(() => {
|
|
185
|
+
o.disabled && m(!1);
|
|
186
|
+
}, [m, o.disabled]);
|
|
187
|
+
const se = oe(() => {
|
|
188
|
+
!Y.current || o.disabled || d || p || !y || !ee.current || Z.current || (Z.current = !0, ee.current());
|
|
189
|
+
}, [p, y, d, o.disabled]);
|
|
190
|
+
g(() => {
|
|
191
|
+
if (Z.current = !1, !c || o.disabled || d || p || !y || !ge) return;
|
|
192
|
+
const e = he.current, u = X.current;
|
|
193
|
+
if (!e || !u || typeof IntersectionObserver > "u") return;
|
|
194
|
+
let f = !0;
|
|
195
|
+
const B = new IntersectionObserver((tt) => {
|
|
196
|
+
f && tt.some((nt) => nt.isIntersecting) && se();
|
|
190
197
|
}, {
|
|
191
|
-
root:
|
|
198
|
+
root: u
|
|
192
199
|
});
|
|
193
|
-
return
|
|
194
|
-
|
|
200
|
+
return B.observe(e), () => {
|
|
201
|
+
f = !1, B.disconnect();
|
|
195
202
|
};
|
|
196
|
-
}, [
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
var e;
|
|
201
|
-
f(!1), r || (e = ue.current) == null || e.focus();
|
|
202
|
-
}, xe = () => {
|
|
203
|
+
}, [c, d, p, y, ge, se, le.length, h, o.disabled]);
|
|
204
|
+
const Xe = (e) => {
|
|
205
|
+
V || ie(e.target.value), J == null || J(e);
|
|
206
|
+
}, ae = () => {
|
|
203
207
|
var e;
|
|
204
|
-
|
|
208
|
+
m(!1), r || (e = pe.current) == null || e.focus();
|
|
205
209
|
}, Ne = () => {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
var e;
|
|
211
|
+
$(""), m(!0), (e = N.current) == null || e.focus();
|
|
212
|
+
}, xe = () => {
|
|
213
|
+
!q || !M || (q.onCreate(C), Ne());
|
|
214
|
+
}, Ye = (e) => {
|
|
215
|
+
var B;
|
|
216
|
+
V || ie(e);
|
|
217
|
+
const u = ve.current;
|
|
218
|
+
if (!u) {
|
|
219
|
+
ae();
|
|
213
220
|
return;
|
|
214
221
|
}
|
|
215
|
-
const
|
|
216
|
-
|
|
222
|
+
const f = (B = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value")) == null ? void 0 : B.set;
|
|
223
|
+
f == null || f.call(u, e), u.dispatchEvent(new Event("change", {
|
|
217
224
|
bubbles: !0
|
|
218
|
-
})), r ?
|
|
219
|
-
},
|
|
220
|
-
e.key === "Escape" &&
|
|
221
|
-
},
|
|
222
|
-
/* @__PURE__ */ l("select", { ...
|
|
225
|
+
})), r ? Ne() : ae();
|
|
226
|
+
}, Ze = (e) => {
|
|
227
|
+
e.key === "Escape" && ae(), e.key === "Enter" && e.target === N.current && M && (e.preventDefault(), xe());
|
|
228
|
+
}, Ee = /* @__PURE__ */ l("div", { "aria-hidden": !d, "aria-label": fe, className: i["loading-status"], role: "status", children: d && /* @__PURE__ */ l(Re, { size: "small" }) }), Ce = /* @__PURE__ */ b("div", { className: k(i.dropdown, S === "inline" && i.inline, S === "minimal" && i.minimal, s), onKeyDown: Ze, ref: me, ...Fe, children: [
|
|
229
|
+
/* @__PURE__ */ l("select", { ...Ge, "aria-hidden": "true", className: k(i.native, Qe), onChange: Xe, ref: ve, tabIndex: -1, value: G, children: H.children }),
|
|
223
230
|
r ? /* @__PURE__ */ b("div", { className: i.combobox, onClick: () => {
|
|
224
231
|
var e;
|
|
225
232
|
return (e = N.current) == null ? void 0 : e.focus();
|
|
226
233
|
}, children: [
|
|
227
|
-
|
|
228
|
-
/* @__PURE__ */ l("input", { "aria-describedby":
|
|
229
|
-
|
|
230
|
-
}, onClick: () =>
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
/* @__PURE__ */ b(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
je,
|
|
235
|
+
/* @__PURE__ */ l("input", { "aria-describedby": ye, "aria-invalid": _e, "aria-autocomplete": "list", "aria-expanded": c, "aria-label": o["aria-label"] ?? v ?? T, className: i["combobox-input"], disabled: o.disabled, onChange: (e) => {
|
|
236
|
+
$(e.target.value), m(!0);
|
|
237
|
+
}, onClick: () => m(!0), onFocus: () => m(!0), placeholder: T || void 0, ref: N, role: "combobox", type: "text", value: h }),
|
|
238
|
+
Ee
|
|
239
|
+
] }) : /* @__PURE__ */ l(j, { "aria-describedby": ye, "aria-invalid": _e, "aria-label": v ? void 0 : o["aria-label"], "aria-expanded": c, "aria-haspopup": "dialog", "aria-labelledby": v ? `${I} ${I}-value` : void 0, className: k(i.trigger, (A == null ? void 0 : A.isPlaceholder) && i.placeholder), "data-open": c ? "true" : void 0, disabled: o.disabled, onClick: () => m(!c), ref: pe, style: Je, variant: "simple", children: /* @__PURE__ */ l("span", { className: i.text, id: `${I}-value`, children: Ie(A) }) }),
|
|
240
|
+
c && /* @__PURE__ */ b("div", { className: i.panel, children: [
|
|
241
|
+
!r && E && /* @__PURE__ */ b("div", { className: i["filter-controls"], children: [
|
|
242
|
+
/* @__PURE__ */ l(dt, { "aria-label": "Filter", className: i.filter, icon: "MagnifyingGlass", onChange: (e) => $(e.target.value), placeholder: T, ref: N, style: Pe, type: "search", value: h }),
|
|
243
|
+
Ee
|
|
244
|
+
] }),
|
|
245
|
+
/* @__PURE__ */ b(ft, { "aria-label": "Dropdown", "aria-busy": d || void 0, className: i.options, ref: X, children: [
|
|
246
|
+
le.map((e) => {
|
|
247
|
+
const u = e.value === G;
|
|
248
|
+
return /* @__PURE__ */ l("li", { "data-component": "dropdown", children: /* @__PURE__ */ b(j, { "aria-label": u ? `${e.text}, selected` : e.text, className: k(i.option, u && i.selected), disabled: e.disabled, onClick: () => Ye(e.value), variant: "tertiary", children: [
|
|
249
|
+
/* @__PURE__ */ l("span", { className: i.text, children: Ie(e) }),
|
|
239
250
|
e.groupLabel && /* @__PURE__ */ l("small", { className: i.group, children: e.groupLabel })
|
|
240
251
|
] }) }, `${e.groupLabel ?? "root"}-${e.value}`);
|
|
241
252
|
}),
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
/* @__PURE__ */ l("span", { role: "alert", children:
|
|
246
|
-
|
|
253
|
+
M && q && /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(j, { "aria-label": K(q.render(C)) || C, className: i.option, onClick: xe, variant: "tertiary", children: /* @__PURE__ */ l("span", { className: i.text, children: q.render(C) }) }) }),
|
|
254
|
+
le.length === 0 && !M && !d && !p && !y && /* @__PURE__ */ l("li", { className: i.empty, children: $e }),
|
|
255
|
+
p && /* @__PURE__ */ b("li", { className: i.empty, children: [
|
|
256
|
+
/* @__PURE__ */ l("span", { role: "alert", children: p }),
|
|
257
|
+
ue && /* @__PURE__ */ l(j, { disabled: d, onClick: ue, variant: "tertiary", children: Be })
|
|
247
258
|
] }),
|
|
248
|
-
|
|
249
|
-
|
|
259
|
+
d && !r && !E && /* @__PURE__ */ l("li", { "aria-label": fe, className: i.empty, role: "status", children: /* @__PURE__ */ l(Re, { size: "small" }) }),
|
|
260
|
+
y && R && !p && /* @__PURE__ */ l("li", { ref: he, children: /* @__PURE__ */ l(j, { className: i.option, disabled: d, onClick: se, variant: "tertiary", children: De }) })
|
|
250
261
|
] })
|
|
251
262
|
] })
|
|
252
|
-
] }),
|
|
253
|
-
/* @__PURE__ */ l(
|
|
254
|
-
|
|
255
|
-
] }) :
|
|
263
|
+
] }), et = v || a ? /* @__PURE__ */ b("div", { className: k(i.label, S === "inline" && i["inline-field"]), children: [
|
|
264
|
+
/* @__PURE__ */ l(ut, { label: Ue, labelId: v ? I : void 0, description: a, descriptionId: be, inline: S === "inline" }),
|
|
265
|
+
Ce
|
|
266
|
+
] }) : Ce;
|
|
256
267
|
return /* @__PURE__ */ b("div", { className: i.field, "data-component": "dropdown", children: [
|
|
257
|
-
|
|
258
|
-
|
|
268
|
+
et,
|
|
269
|
+
U && /* @__PURE__ */ l(at, { errorId: U, errorMessage: n })
|
|
259
270
|
] });
|
|
260
271
|
};
|
|
261
272
|
export {
|
|
262
|
-
|
|
273
|
+
Yt as Dropdown
|
|
263
274
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index9.css');const a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index9.css');const a=require("react/jsx-runtime"),b=require("react"),h=require("../button/index.cjs"),z=require("../checkbox/index.cjs"),H=require("../chip/index.cjs"),P=require("../collapsible/index.cjs"),A=require("../../index-BwfsmdF6.cjs"),E=require("../dialog/index.cjs"),J=require("../header/index.cjs"),K=require("../../index-DEQcFR32.cjs"),Q=require("../loading/index.cjs"),S="_search_1r1ik_3",U="_controls_1r1ik_15",V="_actions_1r1ik_36",W="_chips_1r1ik_56",X="_radio_1r1ik_122",n={search:S,controls:U,actions:V,"loading-status":"_loading-status_1r1ik_46",chips:W,"filter-dialog":"_filter-dialog_1r1ik_63","filter-groups":"_filter-groups_1r1ik_68","filter-group":"_filter-group_1r1ik_68","filter-option":"_filter-option_1r1ik_104","option-copy":"_option-copy_1r1ik_110",radio:X,"collapsible-options":"_collapsible-options_1r1ik_145"},Y=({filterButtonLabel:j="Filters",filterDialogColumns:f=1,filterDialogTitle:M="Filters",filterGroups:t=[],isLoading:d,loadingLabel:$="Loading results",onChange:w,onSelectedFiltersChange:l,removeFilterLabel:O=o=>`Remove ${o.label} filter`,resetLabel:v="Reset",searchLabel:B="Search",searchPlaceholder:D="Search",selectedFilters:r=[],showResultsLabel:R="Show results",value:I=""})=>{const o=b.useId(),[u,_]=b.useState(!1),T=b.useMemo(()=>new Map(t.flatMap(s=>{var i;return[...s.options,...((i=s.collapsible)==null?void 0:i.options)??[]]}).map(s=>[s.value,s])),[t]),p=r.flatMap(s=>{const i=T.get(s);return i?[i]:[]}),m=(s,i,e)=>{var q;if(!l)return;const x=new Set([...(e==null?void 0:e.options.map(c=>c.value))??[],...((q=e==null?void 0:e.collapsible)==null?void 0:q.options.map(c=>c.value))??[]]),N=r.filter(c=>!x.has(c));if(i&&(e==null?void 0:e.defaultValue)===s){l(N);return}l(i?(e==null?void 0:e.control)==="radio"||(e==null?void 0:e.selectionMode)==="single"?[...N,s]:[...new Set([...r,s])]:r.filter(c=>c!==s))},k=(s,i)=>{var e;return r.includes(s)||i.defaultValue===s&&![...i.options,...((e=i.collapsible)==null?void 0:e.options)??[]].some(x=>r.includes(x.value))},y=(s,i)=>a.jsx("div",{className:n["filter-option"],"data-component":"renderfilter",children:i.control==="radio"?a.jsxs("label",{className:n.radio,children:[a.jsx("input",{checked:k(s.value,i),name:`${o}-filter-${i.label??"group"}`,onChange:e=>m(s.value,e.target.checked,i),type:"radio"}),a.jsxs("span",{className:n["option-copy"],children:[s.label,s.description&&a.jsx("sub",{children:s.description})]})]}):a.jsx(z.Checkbox,{checked:k(s.value,i),label:a.jsxs("span",{className:n["option-copy"],children:[s.label,s.description&&a.jsx("sub",{children:s.description})]}),onChange:e=>m(s.value,e.target.checked,i)})},s.value);return a.jsxs("div",{className:n.search,"data-component":"search",children:[a.jsxs("div",{className:n.controls,"data-with-filters":t.length>0||void 0,children:[a.jsx(K.Input,{"aria-label":B,icon:"MagnifyingGlass",onChange:s=>w(s.target.value),placeholder:D,type:"search",value:I}),(t.length>0||d!==void 0)&&a.jsxs("div",{className:n.actions,children:[t.length>0&&a.jsx(h.Button,{"aria-expanded":u,"aria-haspopup":"dialog",badge:p.length,icon:"Funnel",onClick:()=>_(!0),variant:"tertiary",children:j}),d!==void 0&&a.jsx("div",{"aria-hidden":!d,"aria-label":$,className:n["loading-status"],role:"status",children:d&&a.jsx(Q.Loading,{size:"small"})})]})]}),p.length>0&&a.jsxs("div",{"aria-label":j,className:n.chips,children:[p.map(s=>a.jsx(H.Chip,{accessibleLabel:O(s),label:s.label,onDelete:()=>m(s.value,!1)},s.value)),a.jsx(h.Button,{onClick:()=>l==null?void 0:l([]),variant:"tertiary",children:v})]}),u&&a.jsx(E.Dialog,{"aria-labelledby":o,className:n["filter-dialog"],controls:a.jsxs(A.Controls,{children:[a.jsx(h.Button,{onClick:()=>{l==null||l([]),_(!1)},children:v}),a.jsx(h.Button,{onClick:()=>_(!1),variant:"primary",children:R})]}),header:a.jsx(J.Header,{children:a.jsx("h2",{id:o,children:M})}),open:!0,setOpen:_,children:a.jsx("div",{className:n["filter-groups"],"data-columns":f,children:t.map((s,i)=>a.jsxs("section",{"aria-labelledby":s.label?`${o}-${i}`:void 0,className:n["filter-group"],"data-column-span":s.columnSpan??1,role:s.control==="radio"?"radiogroup":"group",children:[s.label&&a.jsx("h3",{id:`${o}-${i}`,children:s.label}),s.options.map(e=>y(e,s)),s.collapsible&&a.jsx(P.Collapsible,{summary:s.collapsible.label,children:a.jsx("div",{className:n["collapsible-options"],children:s.collapsible.options.map(e=>y(e,s))})})]},s.label??i))})})]})};exports.Search=Y;
|