@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.
@@ -1,79 +1,79 @@
1
- import { jsxs as b, Fragment as Oe, jsx as l } from "react/jsx-runtime";
1
+ import { jsxs as b, Fragment as it, jsx as l } from "react/jsx-runtime";
2
2
  import k from "classix";
3
- import Je, { Children as Ue, isValidElement as j, useRef as m, useId as Xe, useState as se, useCallback as oe, useEffect as E } from "react";
4
- import { Button as D } from "../button/index.js";
5
- import { FieldError as Ye } from "../form/index.js";
6
- import { i as Ze } from "../../icons-DVeBguFb.js";
7
- import { f as et, I as tt } from "../../index-6TyCExT0.js";
8
- import { Label as nt } from "../label/index.js";
9
- import { List as rt } from "../list/index.js";
10
- import { Loading as it } from "../loading/index.js";
11
- import { S as lt, s as st, r as ae } from "../../index-GPsHvb4d.js";
12
- import '../../assets/index41.css';function q(t) {
13
- return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(q).join(" ") : j(t) ? q(t.props.children) : "";
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 ot(t) {
16
- return j(t) && t.type === "option";
15
+ function bt(t) {
16
+ return F(t) && t.type === "option";
17
17
  }
18
- function at(t) {
19
- return j(t) && t.type === "optgroup";
18
+ function yt(t) {
19
+ return F(t) && t.type === "optgroup";
20
20
  }
21
- function ct(t) {
22
- return j(t) && t.type === Je.Fragment;
21
+ function _t(t) {
22
+ return F(t) && t.type === rt.Fragment;
23
23
  }
24
- function dt(t) {
25
- return j(t) && t.type === lt;
24
+ function vt(t) {
25
+ return F(t) && t.type === pt;
26
26
  }
27
- function ce(t, s, r = !1) {
28
- const o = [];
29
- return Ue.forEach(t, (n) => {
30
- if (ct(n))
31
- o.push(...ce(n.props.children, s, r));
32
- else if (ot(n)) {
33
- const y = q(n.props.children).trim(), F = n.props.value != null ? String(n.props.value) : y;
34
- o.push({
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 && F === ""),
38
+ isPlaceholder: !!(n.props.hidden && W === ""),
39
39
  label: n.props.children,
40
40
  selected: !!n.props.selected,
41
- text: y,
42
- value: F
41
+ text: w,
42
+ value: W
43
43
  });
44
- } else at(n) && o.push(...ce(n.props.children, n.props.label, r || !!n.props.disabled));
45
- }), o;
44
+ } else yt(n) && a.push(...de(n.props.children, n.props.label, r || !!n.props.disabled));
45
+ }), a;
46
46
  }
47
- function ut(t) {
47
+ function ht(t) {
48
48
  const s = t.trim();
49
49
  if (!s) return null;
50
- const o = [.../[*?]/.test(s) ? s : `*${s}*`].map((n) => n === "*" ? ".*" : n === "?" ? "." : n.replace(/[|\\{}()[\]^$+.,]/g, "\\$&")).join("");
51
- return new RegExp(`^${o}$`, "i");
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 ft(t, s) {
54
- const r = ut(s), o = t.filter((n) => !n.hidden && !n.isPlaceholder);
55
- return r ? o.filter((n) => r.test([n.groupLabel, n.text, n.value].filter(Boolean).join(" "))) : o;
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 pt(t, s) {
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 mt(t, s, r) {
61
- var o, n;
62
- return s != null ? String(s) : r != null ? String(r) : ((o = t.find((y) => y.selected)) == null ? void 0 : o.value) ?? ((n = t[0]) == null ? void 0 : n.value) ?? "";
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 bt(t) {
65
- if (dt(t)) {
64
+ function St(t) {
65
+ if (vt(t)) {
66
66
  const {
67
67
  children: s,
68
68
  placeholder: r,
69
- ...o
69
+ ...a
70
70
  } = t.props;
71
71
  return {
72
- children: /* @__PURE__ */ b(Oe, { children: [
72
+ children: /* @__PURE__ */ b(it, { children: [
73
73
  r && /* @__PURE__ */ l("option", { hidden: !0, value: "", children: r }),
74
74
  s
75
75
  ] }),
76
- props: o
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 vt = "_combobox_10eim_3", _t = "_dropdown_10eim_21", yt = "_empty_10eim_29", ht = "_group_10eim_30", gt = "_placeholder_10eim_31", wt = "_filter_10eim_39", xt = "_native_10eim_49", Nt = "_option_10eim_59", It = "_options_10eim_85", St = "_panel_10eim_95", Et = "_selected_10eim_120", Rt = "_text_10eim_124", $t = "_trigger_10eim_132", Ct = "_minimal_10eim_177", Bt = "_inline_10eim_237", Vt = "_field_10eim_271", kt = "_label_10eim_275", i = {
85
- combobox: vt,
86
- "combobox-input": "_combobox-input_10eim_12",
87
- dropdown: _t,
88
- empty: yt,
89
- group: ht,
90
- placeholder: gt,
91
- filter: wt,
92
- native: xt,
93
- option: Nt,
94
- options: It,
95
- panel: St,
96
- selected: Et,
97
- text: Rt,
98
- trigger: $t,
99
- minimal: Ct,
100
- inline: Bt,
101
- field: Vt,
102
- label: kt,
103
- "inline-field": "_inline-field_10eim_280"
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 Se(t, s) {
107
+ function Ve(t, s) {
106
108
  return {
107
- "--icon-svg": Ze(t, s)
109
+ "--icon-svg": ot(t, s)
108
110
  };
109
111
  }
110
- const At = ({
112
+ const Yt = ({
111
113
  children: t,
112
114
  className: s,
113
115
  combobox: r = !1,
114
- description: o,
116
+ description: a,
115
117
  errorMessage: n,
116
- invalid: y = !1,
117
- searchable: F,
118
- createOption: h,
119
- emptyLabel: Ee = "No matches found",
120
- errorLabel: v,
121
- onRetry: de,
122
- retryLabel: Re = "Retry",
123
- label: _,
124
- filterOptions: $e = !0,
125
- hasNextPage: g = !1,
126
- loading: p = !1,
127
- loadMoreLabel: Ce = "Load more",
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: L,
132
+ onOpenChange: z,
130
133
  onSearchChange: Q,
131
- searchValue: M,
132
- renderOption: P,
133
- searchPlaceholder: A = "Filter",
134
- selectedItems: Be,
135
- variant: w = "default",
136
- ...Ve
134
+ searchValue: L,
135
+ renderOption: O,
136
+ searchPlaceholder: T = "Filter",
137
+ selectedItems: je,
138
+ variant: S = "default",
139
+ ...Fe
137
140
  }) => {
138
- const K = bt(t), {
139
- defaultValue: ke,
140
- onChange: T,
141
- value: H,
142
- ...De
143
- } = K.props, a = st(De), {
144
- className: je,
145
- ...Fe
146
- } = a, ue = m(null), fe = m(null), x = Xe(), O = y && n ? `${x}-error` : void 0, pe = o ? `${x}-description` : void 0, me = [a["aria-describedby"], pe, O].filter(Boolean).join(" ") || void 0, be = y ? !0 : a["aria-invalid"], ve = m(null), N = m(null), J = m(null), _e = m(null), U = m(!1), X = m(!1), Y = m(R), ye = !!R, I = ce(K.children), Z = F ?? I.filter((e) => !e.hidden).length > 8, $ = H != null, ee = mt(I, H, ke), [te, ne] = se(() => ee), [u, Le] = se(!1), [Qe, We] = se(""), C = M ?? Qe, B = oe((e) => {
147
- M === void 0 && We(e), Q == null || Q(e);
148
- }, [Q, M]), f = oe((e) => {
149
- U.current === e || e && a.disabled || (U.current = e, Le(e), L == null || L(e), e || B(""));
150
- }, [L, a.disabled, B]), W = $ ? String(H) : te, he = {
151
- default: ae("--colors-semantic-content-secondary"),
152
- white: ae("--color-white", "white")
153
- }, ge = a.disabled ? ae("--colors-semantic-content-disabled") : w === "minimal" ? he.white : he.default, z = pt(I, W), ze = Se("CaretDown", ge), Ge = Se("MagnifyingGlass", ge), re = ft(I, $e ? C : ""), S = C.trim(), G = !!(r && h && S && h.isValid(S)), qe = _ && w === "inline" ? et(_) : _, we = (e) => e ? (P == null ? void 0 : P({
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 === W,
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
- E(() => {
161
- !$ && !I.some((e) => e.value === te) && ne(ee);
162
- }, [ee, te, $, I]), E(() => {
163
- var e, c, d;
164
- u && (r || Z ? (e = N.current) == null || e.focus() : (d = (c = J.current) == null ? void 0 : c.querySelector("button:not(:disabled)")) == null || d.focus());
165
- }, [u, r, Z]), E(() => {
166
- if (!u)
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 = (c) => {
169
- var d;
170
- (d = fe.current) != null && d.contains(c.target) || f(!1);
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
- }, [f, u]), E(() => {
176
- Y.current = R;
177
- }, [R]), E(() => {
178
- a.disabled && f(!1);
179
- }, [f, a.disabled]);
180
- const ie = oe(() => {
181
- !U.current || a.disabled || p || v || !g || !Y.current || X.current || (X.current = !0, Y.current());
182
- }, [v, g, p, a.disabled]);
183
- E(() => {
184
- if (X.current = !1, !u || a.disabled || p || v || !g || !ye) return;
185
- const e = _e.current, c = J.current;
186
- if (!e || !c || typeof IntersectionObserver > "u") return;
187
- let d = !0;
188
- const V = new IntersectionObserver((Te) => {
189
- d && Te.some((He) => He.isIntersecting) && ie();
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: c
198
+ root: u
192
199
  });
193
- return V.observe(e), () => {
194
- d = !1, V.disconnect();
200
+ return B.observe(e), () => {
201
+ f = !1, B.disconnect();
195
202
  };
196
- }, [u, p, v, g, ye, ie, re.length, C, a.disabled]);
197
- const Me = (e) => {
198
- $ || ne(e.target.value), T == null || T(e);
199
- }, le = () => {
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
- B(""), f(!0), (e = N.current) == null || e.focus();
208
+ m(!1), r || (e = pe.current) == null || e.focus();
205
209
  }, Ne = () => {
206
- !h || !G || (h.onCreate(S), xe());
207
- }, Pe = (e) => {
208
- var V;
209
- $ || ne(e);
210
- const c = ve.current;
211
- if (!c) {
212
- le();
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 d = (V = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value")) == null ? void 0 : V.set;
216
- d == null || d.call(c, e), c.dispatchEvent(new Event("change", {
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 ? xe() : le();
219
- }, Ae = (e) => {
220
- e.key === "Escape" && le(), e.key === "Enter" && e.target === N.current && G && (e.preventDefault(), Ne());
221
- }, Ie = /* @__PURE__ */ b("div", { className: k(i.dropdown, w === "inline" && i.inline, w === "minimal" && i.minimal, s), onKeyDown: Ae, ref: fe, ...Ve, children: [
222
- /* @__PURE__ */ l("select", { ...Fe, "aria-hidden": "true", className: k(i.native, je), onChange: Me, ref: ve, tabIndex: -1, value: W, children: K.children }),
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
- Be,
228
- /* @__PURE__ */ l("input", { "aria-describedby": me, "aria-invalid": be, "aria-autocomplete": "list", "aria-expanded": u, "aria-label": a["aria-label"] ?? _ ?? A, className: i["combobox-input"], disabled: a.disabled, onChange: (e) => {
229
- B(e.target.value), f(!0);
230
- }, onClick: () => f(!0), onFocus: () => f(!0), placeholder: A || void 0, ref: N, role: "combobox", type: "text", value: C })
231
- ] }) : /* @__PURE__ */ l(D, { "aria-describedby": me, "aria-invalid": be, "aria-label": _ ? void 0 : a["aria-label"], "aria-expanded": u, "aria-haspopup": "dialog", "aria-labelledby": _ ? `${x} ${x}-value` : void 0, className: k(i.trigger, (z == null ? void 0 : z.isPlaceholder) && i.placeholder), "data-open": u ? "true" : void 0, disabled: a.disabled, onClick: () => f(!u), ref: ue, style: ze, variant: "simple", children: /* @__PURE__ */ l("span", { className: i.text, id: `${x}-value`, children: we(z) }) }),
232
- u && /* @__PURE__ */ b("div", { className: i.panel, children: [
233
- !r && Z && /* @__PURE__ */ l(tt, { "aria-label": "Filter", className: i.filter, icon: "MagnifyingGlass", onChange: (e) => B(e.target.value), placeholder: A, ref: N, style: Ge, type: "search", value: C }),
234
- /* @__PURE__ */ b(rt, { "aria-label": "Dropdown", "aria-busy": p || void 0, className: i.options, ref: J, children: [
235
- re.map((e) => {
236
- const c = e.value === W;
237
- return /* @__PURE__ */ l("li", { "data-component": "dropdown", children: /* @__PURE__ */ b(D, { "aria-label": c ? `${e.text}, selected` : e.text, className: k(i.option, c && i.selected), disabled: e.disabled, onClick: () => Pe(e.value), variant: "tertiary", children: [
238
- /* @__PURE__ */ l("span", { className: i.text, children: we(e) }),
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
- G && h && /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(D, { "aria-label": q(h.render(S)) || S, className: i.option, onClick: Ne, variant: "tertiary", children: /* @__PURE__ */ l("span", { className: i.text, children: h.render(S) }) }) }),
243
- re.length === 0 && !G && !p && !v && !g && /* @__PURE__ */ l("li", { className: i.empty, children: Ee }),
244
- v && /* @__PURE__ */ b("li", { className: i.empty, children: [
245
- /* @__PURE__ */ l("span", { role: "alert", children: v }),
246
- de && /* @__PURE__ */ l(D, { disabled: p, onClick: de, variant: "tertiary", children: Re })
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
- p && /* @__PURE__ */ l("li", { "aria-label": "Loading", className: i.empty, role: "status", children: /* @__PURE__ */ l(it, { size: "small" }) }),
249
- g && R && !v && /* @__PURE__ */ l("li", { ref: _e, children: /* @__PURE__ */ l(D, { className: i.option, disabled: p, onClick: ie, variant: "tertiary", children: Ce }) })
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
- ] }), Ke = _ || o ? /* @__PURE__ */ b("div", { className: k(i.label, w === "inline" && i["inline-field"]), children: [
253
- /* @__PURE__ */ l(nt, { label: qe, labelId: _ ? x : void 0, description: o, descriptionId: pe, inline: w === "inline" }),
254
- Ie
255
- ] }) : Ie;
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
- Ke,
258
- O && /* @__PURE__ */ l(Ye, { errorId: O, errorMessage: n })
268
+ et,
269
+ U && /* @__PURE__ */ l(at, { errorId: U, errorMessage: n })
259
270
  ] });
260
271
  };
261
272
  export {
262
- At as Dropdown
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"),m=require("react"),b=require("../button/index.cjs"),I=require("../checkbox/index.cjs"),T=require("../chip/index.cjs"),H=require("../collapsible/index.cjs"),P=require("../../index-BwfsmdF6.cjs"),z=require("../dialog/index.cjs"),A=require("../header/index.cjs"),E=require("../../index-DEQcFR32.cjs"),J="_search_wsuwb_3",K="_controls_wsuwb_15",Q="_chips_wsuwb_35",S="_radio_wsuwb_101",l={search:J,controls:K,chips:Q,"filter-dialog":"_filter-dialog_wsuwb_42","filter-groups":"_filter-groups_wsuwb_47","filter-group":"_filter-group_wsuwb_47","filter-option":"_filter-option_wsuwb_83","option-copy":"_option-copy_wsuwb_89",radio:S,"collapsible-options":"_collapsible-options_wsuwb_124"},U=({filterButtonLabel:x="Filters",filterDialogColumns:f=1,filterDialogTitle:k="Filters",filterGroups:d=[],onChange:q,onSelectedFiltersChange:i,removeFilterLabel:M=c=>`Remove ${c.label} filter`,resetLabel:u="Reset",searchLabel:$="Search",searchPlaceholder:O="Search",selectedFilters:t=[],showResultsLabel:B="Show results",value:D=""})=>{const c=m.useId(),[j,r]=m.useState(!1),R=m.useMemo(()=>new Map(d.flatMap(s=>{var n;return[...s.options,...((n=s.collapsible)==null?void 0:n.options)??[]]}).map(s=>[s.value,s])),[d]),h=t.flatMap(s=>{const n=R.get(s);return n?[n]:[]}),p=(s,n,e)=>{var N;if(!i)return;const _=new Set([...(e==null?void 0:e.options.map(o=>o.value))??[],...((N=e==null?void 0:e.collapsible)==null?void 0:N.options.map(o=>o.value))??[]]),y=t.filter(o=>!_.has(o));if(n&&(e==null?void 0:e.defaultValue)===s){i(y);return}i(n?(e==null?void 0:e.control)==="radio"||(e==null?void 0:e.selectionMode)==="single"?[...y,s]:[...new Set([...t,s])]:t.filter(o=>o!==s))},v=(s,n)=>{var e;return t.includes(s)||n.defaultValue===s&&![...n.options,...((e=n.collapsible)==null?void 0:e.options)??[]].some(_=>t.includes(_.value))},w=(s,n)=>a.jsx("div",{className:l["filter-option"],"data-component":"renderfilter",children:n.control==="radio"?a.jsxs("label",{className:l.radio,children:[a.jsx("input",{checked:v(s.value,n),name:`${c}-filter-${n.label??"group"}`,onChange:e=>p(s.value,e.target.checked,n),type:"radio"}),a.jsxs("span",{className:l["option-copy"],children:[s.label,s.description&&a.jsx("sub",{children:s.description})]})]}):a.jsx(I.Checkbox,{checked:v(s.value,n),label:a.jsxs("span",{className:l["option-copy"],children:[s.label,s.description&&a.jsx("sub",{children:s.description})]}),onChange:e=>p(s.value,e.target.checked,n)})},s.value);return a.jsxs("div",{className:l.search,"data-component":"search",children:[a.jsxs("div",{className:l.controls,children:[a.jsx(E.Input,{"aria-label":$,icon:"MagnifyingGlass",onChange:s=>q(s.target.value),placeholder:O,type:"search",value:D}),d.length>0&&a.jsx(b.Button,{"aria-expanded":j,"aria-haspopup":"dialog",badge:h.length,icon:"Funnel",onClick:()=>r(!0),variant:"tertiary",children:x})]}),h.length>0&&a.jsxs("div",{"aria-label":x,className:l.chips,children:[h.map(s=>a.jsx(T.Chip,{accessibleLabel:M(s),label:s.label,onDelete:()=>p(s.value,!1)},s.value)),a.jsx(b.Button,{onClick:()=>i==null?void 0:i([]),variant:"tertiary",children:u})]}),j&&a.jsx(z.Dialog,{"aria-labelledby":c,className:l["filter-dialog"],controls:a.jsxs(P.Controls,{children:[a.jsx(b.Button,{onClick:()=>{i==null||i([]),r(!1)},children:u}),a.jsx(b.Button,{onClick:()=>r(!1),variant:"primary",children:B})]}),header:a.jsx(A.Header,{children:a.jsx("h2",{id:c,children:k})}),open:!0,setOpen:r,children:a.jsx("div",{className:l["filter-groups"],"data-columns":f,children:d.map((s,n)=>a.jsxs("section",{"aria-labelledby":s.label?`${c}-${n}`:void 0,className:l["filter-group"],"data-column-span":s.columnSpan??1,role:s.control==="radio"?"radiogroup":"group",children:[s.label&&a.jsx("h3",{id:`${c}-${n}`,children:s.label}),s.options.map(e=>w(e,s)),s.collapsible&&a.jsx(H.Collapsible,{summary:s.collapsible.label,children:a.jsx("div",{className:l["collapsible-options"],children:s.collapsible.options.map(e=>w(e,s))})})]},s.label??n))})})]})};exports.Search=U;
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;