@fluidattacks/design 9.1.0 → 9.1.1

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.
@@ -12,6 +12,7 @@ import "react-dom";
12
12
  import "../../typography/heading/index.js";
13
13
  import "../../typography/span/index.js";
14
14
  import "../../typography/text/index.js";
15
+ import "../../inputs/styles.js";
15
16
  import "../../container/index.js";
16
17
  import "../../icon-button/index.js";
17
18
  import "../../../_virtual/dayjs.min.js";
@@ -20,7 +21,7 @@ import "../../layout/categories/buttons/index.js";
20
21
  import { InputNumber as S } from "../../inputs/fields/number/index.js";
21
22
  import "../../inputs/utils/action-button/index.js";
22
23
  import "../../../node_modules/react-international-phone/dist/index.js";
23
- const it = ({
24
+ const pt = ({
24
25
  control: u,
25
26
  description: B,
26
27
  disabled: t,
@@ -141,5 +142,5 @@ const it = ({
141
142
  );
142
143
  };
143
144
  export {
144
- it as CardWithInput
145
+ pt as CardWithInput
145
146
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as a, jsx as o } from "react/jsx-runtime";
2
2
  import I from "../../../_virtual/snakeCase.js";
3
- import { forwardRef as O, useContext as $, useMemo as B, useCallback as h, Fragment as L } from "react";
3
+ import { forwardRef as O, useContext as $, useMemo as B, useCallback as p, Fragment as L } from "react";
4
4
  import { useTheme as R } from "styled-components";
5
5
  import { FiltersContext as A } from "../context/index.js";
6
6
  import { NoMatches as P } from "../search/no-matches/index.js";
@@ -15,6 +15,7 @@ import "react-dom";
15
15
  import "../../typography/heading/index.js";
16
16
  import "../../typography/span/index.js";
17
17
  import { Text as M } from "../../typography/text/index.js";
18
+ import "../../inputs/styles.js";
18
19
  import { Tag as K } from "../../tag/index.js";
19
20
  import "../../../_virtual/dayjs.min.js";
20
21
  import "../../icon-button/index.js";
@@ -26,8 +27,8 @@ import { parseTextFilterValue as U, parseCheckboxesFilterValue as X, parseInclud
26
27
  const Z = (c, d) => {
27
28
  if (d?.some((t) => t.type === "text") ?? !1)
28
29
  return U(c ?? "").text ? "1" : "0";
29
- const l = new Set(d?.map((t) => t.type) ?? []);
30
- if (l.size === 1 && l.has("checkboxes"))
30
+ const i = new Set(d?.map((t) => t.type) ?? []);
31
+ if (i.size === 1 && i.has("checkboxes"))
31
32
  return X(
32
33
  c ?? ""
33
34
  ).values.length.toString();
@@ -38,11 +39,11 @@ const Z = (c, d) => {
38
39
  return (t.length + f.length).toString();
39
40
  }
40
41
  return (c ?? "").split(",").filter((t) => t && t !== "-").length.toString();
41
- }, ke = O(function({
42
+ }, Te = O(function({
42
43
  includeSearch: d = !1,
43
44
  groupedFilters: g,
44
- handleChangeId: l,
45
- pinnedFilters: p
45
+ handleChangeId: i,
46
+ pinnedFilters: h
46
47
  }, b) {
47
48
  const t = R(), {
48
49
  id: f,
@@ -51,16 +52,16 @@ const Z = (c, d) => {
51
52
  values: s,
52
53
  updateSearch: v,
53
54
  setValues: u
54
- } = $(A), C = q(g, y), w = B(() => Object.values(s).filter(Boolean).length > 0, [s]), S = p.length > 0, V = h(
55
+ } = $(A), C = q(g, y), w = B(() => Object.values(s).filter(Boolean).length > 0, [s]), S = h.length > 0, V = p(
55
56
  (e) => () => {
56
- l(e), v({ previousValue: s[e] ?? "" }), m({ searchFilter: "", searchGlobal: "" });
57
+ i(e), v({ previousValue: s[e] ?? "" }), m({ searchFilter: "", searchGlobal: "" });
57
58
  },
58
- [l, v, m, s]
59
- ), j = h(() => {
59
+ [i, v, m, s]
60
+ ), j = p(() => {
60
61
  u(
61
62
  (e) => Object.keys(e).reduce((n, r) => ({ ...n, [r]: "" }), {})
62
- ), l("");
63
- }, [u, l]), z = h(
63
+ ), i("");
64
+ }, [u, i]), z = p(
64
65
  (e) => {
65
66
  m((n) => ({
66
67
  ...n,
@@ -68,7 +69,7 @@ const Z = (c, d) => {
68
69
  }));
69
70
  },
70
71
  [m]
71
- ), E = h(
72
+ ), E = p(
72
73
  (e) => (n) => {
73
74
  u((r) => ({ ...r, [e]: n }));
74
75
  },
@@ -107,7 +108,7 @@ const Z = (c, d) => {
107
108
  scroll: "y",
108
109
  width: "100%",
109
110
  children: [
110
- S ? /* @__PURE__ */ o(k, { "data-testid": "menu-pinned", children: p.map((e) => {
111
+ S ? /* @__PURE__ */ o(k, { "data-testid": "menu-pinned", children: h.map((e) => {
111
112
  const n = e.options?.[0]?.items?.map((r) => ({
112
113
  name: r.label ?? r.value,
113
114
  value: r.value
@@ -140,17 +141,17 @@ const Z = (c, d) => {
140
141
  children: e
141
142
  }
142
143
  ) : void 0,
143
- n.map((i) => {
144
- const G = s[i.id], F = Z(
144
+ n.map((l) => {
145
+ const G = s[l.id], F = Z(
145
146
  G,
146
- i.options
147
+ l.options
147
148
  );
148
149
  return /* @__PURE__ */ o(L, { children: /* @__PURE__ */ a(
149
150
  N,
150
151
  {
151
152
  as: "button",
152
- "data-testid": i.id,
153
- onClick: V(i.id),
153
+ "data-testid": l.id,
154
+ onClick: V(l.id),
154
155
  children: [
155
156
  /* @__PURE__ */ o(
156
157
  T,
@@ -161,7 +162,7 @@ const Z = (c, d) => {
161
162
  iconType: "fa-light"
162
163
  }
163
164
  ),
164
- i.label,
165
+ l.label,
165
166
  /* @__PURE__ */ a(
166
167
  x,
167
168
  {
@@ -170,7 +171,7 @@ const Z = (c, d) => {
170
171
  gap: 0.5,
171
172
  style: { marginLeft: "auto" },
172
173
  children: [
173
- f === i.id ? /* @__PURE__ */ o(
174
+ f === l.id ? /* @__PURE__ */ o(
174
175
  T,
175
176
  {
176
177
  icon: "chevron-right",
@@ -185,7 +186,7 @@ const Z = (c, d) => {
185
186
  )
186
187
  ]
187
188
  }
188
- ) }, i.id);
189
+ ) }, l.id);
189
190
  })
190
191
  ]
191
192
  },
@@ -197,5 +198,5 @@ const Z = (c, d) => {
197
198
  ] });
198
199
  });
199
200
  export {
200
- ke as FiltersMenu
201
+ Te as FiltersMenu
201
202
  };
@@ -16,9 +16,9 @@ import "react-dom";
16
16
  import "../../../typography/heading/index.js";
17
17
  import { Span as G } from "../../../typography/span/index.js";
18
18
  import "../../../typography/text/index.js";
19
+ import "../../../inputs/styles.js";
19
20
  import "../../../container/index.js";
20
21
  import { Tag as H } from "../../../tag/index.js";
21
- import "../../../../_virtual/isEqual.js";
22
22
  import "../../../icon-button/index.js";
23
23
  import "../../../button/index.js";
24
24
  import { InputDateRange as J } from "../../../inputs/fields/date-range/index.js";
@@ -1,6 +1,6 @@
1
- import { jsx as o, jsxs as z } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as R } from "react/jsx-runtime";
2
2
  import { useVirtualizer as He } from "../../../../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
3
- import { useState as v, useMemo as I, useRef as y, useCallback as g } from "react";
3
+ import { useState as v, useMemo as F, useRef as y, useCallback as g } from "react";
4
4
  import { useButton as Ue } from "../../../../../node_modules/react-aria/dist/private/button/useButton.js";
5
5
  import { useComboBox as We } from "../../../../../node_modules/react-aria/dist/private/combobox/useComboBox.js";
6
6
  import { useFilter as Ye } from "../../../../../node_modules/react-aria/dist/private/i18n/useFilter.js";
@@ -13,26 +13,27 @@ import { StyledTextInputContainer as Ze } from "../../../styles.js";
13
13
  import { Popover as de } from "../../../utils/popover/index.js";
14
14
  import { Option as _e } from "../option/index.js";
15
15
  import { StyledStatusMessage as eo, ChevronIconButton as oo, StyledDropdown as he, StyledGroupHeader as to, StyledEmptyMessage as ro } from "../styles.js";
16
+ import { describeSelection as no, toSelection as so } from "../utils.js";
16
17
  import { Icon as q } from "../../../../icon/index.js";
17
- import { IconButton as no } from "../../../../icon-button/index.js";
18
+ import { IconButton as lo } from "../../../../icon-button/index.js";
18
19
  import "../../../../typography/heading/index.js";
19
20
  import "../../../../typography/span/index.js";
20
21
  import { Text as J } from "../../../../typography/text/index.js";
21
- import { useClickOutside as so } from "../../../../../hooks/use-click-outside.js";
22
- const zo = ({
22
+ import { useClickOutside as io } from "../../../../../hooks/use-click-outside.js";
23
+ const Fo = ({
23
24
  field: u,
24
25
  disabled: h = !1,
25
- disabledKeys: R,
26
+ disabledKeys: x,
26
27
  error: me,
27
28
  helpLink: ye,
28
29
  helpLinkText: ge,
29
30
  helpText: ve,
30
31
  label: P,
31
32
  loadingItems: xe,
32
- name: a,
33
+ name: i,
33
34
  multiSelection: r = !1,
34
- items: n,
35
- onBlur: L,
35
+ items: o,
36
+ onBlur: K,
36
37
  onChange: f,
37
38
  onClear: Q,
38
39
  placeholder: $e,
@@ -40,90 +41,93 @@ const zo = ({
40
41
  emptyMessage: X,
41
42
  statusMessage: Z,
42
43
  required: we,
43
- setValue: x,
44
+ setValue: $,
44
45
  tooltip: Se,
45
46
  value: Be,
46
- watch: F,
47
+ watch: b,
47
48
  weight: Ce
48
49
  }) => {
49
- const m = Qe(), D = h ? void 0 : me, d = u?.value ?? Be, [G, $] = v(
50
- n.find((e) => e.value === d)?.name ?? ""
51
- ), [_, k] = v(d), j = (xe === !1 || !d) && !r, N = I(
52
- () => j ? n.find((e) => e.value === d)?.name ?? "" : "",
53
- [j, d, n]
50
+ const m = Qe(), D = h ? void 0 : me, d = u?.value ?? Be, [G, w] = v(() => r ? no(
51
+ so(b?.(`${i}Options`)),
52
+ o.map((e) => e.value),
53
+ x ?? [],
54
+ o.find((e) => e.value === "All")?.name
55
+ ).text : o.find((e) => e.value === d)?.name ?? ""), [_, k] = v(d), j = (xe === !1 || !d) && !r, N = F(
56
+ () => j ? o.find((e) => e.value === d)?.name ?? "" : "",
57
+ [j, d, o]
54
58
  ), [Ae, Oe] = v(d), [ze, Ie] = v(N);
55
- j && (d !== Ae || N !== ze) && (Oe(d), Ie(N), $(N), k(d ?? ""));
56
- const [Re, H] = v(n), [ee, b] = v(!1), { contains: M } = Ye({ sensitivity: "base" }), U = y(null), W = y(null), w = y(null), S = y(null), oe = y(null), B = y(null), Y = y(/* @__PURE__ */ new Set()), Fe = I(() => {
57
- const e = Y.current, s = Array.from(R ?? []), l = n.some((t) => t.group !== void 0);
58
- return n.toSorted((t, p) => {
59
- if (t.value === "All") return -1;
59
+ j && (d !== Ae || N !== ze) && (Oe(d), Ie(N), w(N), k(d ?? ""));
60
+ const [Re, H] = v(o), [ee, S] = v(!1), { contains: M } = Ye({ sensitivity: "base" }), U = y(null), W = y(null), B = y(null), C = y(null), oe = y(null), A = y(null), Y = y(/* @__PURE__ */ new Set()), Fe = F(() => {
61
+ const e = Y.current, s = Array.from(x ?? []), l = o.some((n) => n.group !== void 0);
62
+ return o.toSorted((n, p) => {
63
+ if (n.value === "All") return -1;
60
64
  if (p.value === "All") return 1;
61
- const E = s.includes(t.value), K = s.includes(p.value);
65
+ const E = s.includes(n.value), L = s.includes(p.value);
62
66
  if (l) {
63
- const A = t.group ?? "", O = p.group ?? "";
64
- if (!t.group && p.group) return -1;
65
- if (t.group && !p.group) return 1;
66
- if (A !== O)
67
- return A.localeCompare(O);
68
- if (E && !K) return 1;
69
- if (!E && K) return -1;
67
+ const z = n.group ?? "", I = p.group ?? "";
68
+ if (!n.group && p.group) return -1;
69
+ if (n.group && !p.group) return 1;
70
+ if (z !== I)
71
+ return z.localeCompare(I);
72
+ if (E && !L) return 1;
73
+ if (!E && L) return -1;
70
74
  if (r) {
71
- const ue = e.has(t.value), fe = e.has(p.value);
75
+ const ue = e.has(n.value), fe = e.has(p.value);
72
76
  if (ue && !fe) return -1;
73
77
  if (!ue && fe) return 1;
74
78
  }
75
- return t.name.localeCompare(p.name);
79
+ return n.name.localeCompare(p.name);
76
80
  }
77
- if (E && !K) return 1;
78
- if (!E && K) return -1;
81
+ if (E && !L) return 1;
82
+ if (!E && L) return -1;
79
83
  if (r) {
80
- const A = e.has(t.value), O = e.has(p.value);
81
- return A && !O ? -1 : !A && O ? 1 : t.name.localeCompare(p.name);
84
+ const z = e.has(n.value), I = e.has(p.value);
85
+ return z && !I ? -1 : !z && I ? 1 : n.name.localeCompare(p.name);
82
86
  }
83
87
  return 0;
84
88
  }).map(
85
- (t) => M(t.name, G) || ee ? /* @__PURE__ */ o(
89
+ (n) => M(n.name, G) || ee ? /* @__PURE__ */ t(
86
90
  Pe,
87
91
  {
88
- "aria-label": t.value,
89
- hrefLang: t.href,
90
- textValue: t.tag,
91
- children: t.name
92
+ "aria-label": n.value,
93
+ hrefLang: n.href,
94
+ textValue: n.tag,
95
+ children: n.name
92
96
  },
93
- t.value
97
+ n.value
94
98
  ) : null
95
99
  );
96
- }, [M, R, G, n, r, ee]), De = g(
100
+ }, [M, x, G, o, r, ee]), De = g(
97
101
  (e) => {
98
102
  const s = e.split(/,|\s/u).slice(-1)[0].trim();
99
- $(r ? s : e), e === "" || e.endsWith(",") ? b(!0) : (b(!1), k((l) => {
103
+ w(r ? s : e), e === "" || e.endsWith(",") ? S(!0) : (S(!1), k((l) => {
100
104
  const c = e === "" ? "" : l;
101
105
  return u && u.onChange(c), f && f(e), c;
102
106
  }), H(
103
- n.filter(
107
+ o.filter(
104
108
  (l) => M(l.name, r ? s : e)
105
109
  )
106
110
  ));
107
111
  },
108
- [M, n, u, r, f]
112
+ [M, o, u, r, f]
109
113
  ), Ge = g(
110
114
  (e) => {
111
- $(n.find((s) => s.value === e)?.name ?? ""), k(e ? String(e) : ""), u && u.onChange(e), f && f(e ? String(e) : ""), H(n);
115
+ w(o.find((s) => s.value === e)?.name ?? ""), k(e ? String(e) : ""), u && u.onChange(e), f && f(e ? String(e) : ""), H(o);
112
116
  },
113
- [n, u, f]
117
+ [o, u, f]
114
118
  ), te = g(
115
119
  (e) => {
116
- e.key === "Enter" && e.preventDefault(), b(!1);
120
+ e.key === "Enter" && e.preventDefault(), S(!1);
117
121
  },
118
122
  []
119
123
  ), ke = g(() => {
120
- L && L(), u && u.onBlur();
121
- }, [u, L]), Ne = g(() => {
122
- b(!0);
123
- }, []), i = Je({
124
+ K && K(), u && u.onBlur();
125
+ }, [u, K]), Ne = g(() => {
126
+ S(!0);
127
+ }, []), a = Je({
124
128
  allowsCustomValue: r,
125
129
  allowsEmptyCollection: !0,
126
- disabledKeys: R,
130
+ disabledKeys: x,
127
131
  inputValue: G,
128
132
  items: Re,
129
133
  menuTrigger: "focus",
@@ -134,11 +138,11 @@ const zo = ({
134
138
  onKeyDown: te,
135
139
  onKeyUp: Ne,
136
140
  onOpenChange(e, s) {
137
- if (e && r && F) {
138
- const l = F(`${a}Options`) ?? [], c = Array.isArray(l) ? l : l ? [l] : [];
141
+ if (e && r && b) {
142
+ const l = b(`${i}Options`) ?? [], c = Array.isArray(l) ? l : l ? [l] : [];
139
143
  Y.current = new Set(c.filter(Boolean));
140
144
  }
141
- b(
145
+ S(
142
146
  e && (s === "manual" || s === "focus")
143
147
  ), e && s !== "focus" && requestAnimationFrame(() => {
144
148
  U.current?.focus();
@@ -147,8 +151,8 @@ const zo = ({
147
151
  onSelectionChange: r ? void 0 : Ge,
148
152
  children: Fe
149
153
  }), Me = g(() => {
150
- $(""), k(null), H(n), i.setSelectedKey(null), i.setInputValue(""), f && f(""), r && x && (x(`${a}Options`, []), x(`${a}CheckAll`, "")), Q?.();
151
- }, [n, r, a, Q, f, x, i]), {
154
+ w(""), k(null), H(o), a.setSelectedKey(null), a.setInputValue(""), f && f(""), r && $ && ($(`${i}Options`, []), $(`${i}CheckAll`, "")), Q?.();
155
+ }, [o, r, i, Q, f, $, a]), {
152
156
  buttonProps: Ve,
153
157
  inputProps: Te,
154
158
  listBoxProps: Ee
@@ -156,45 +160,45 @@ const zo = ({
156
160
  {
157
161
  inputValue: G,
158
162
  buttonRef: W,
159
- id: a,
163
+ id: i,
160
164
  inputRef: U,
161
- label: P ?? a,
162
- listBoxRef: w,
163
- name: a,
165
+ label: P ?? i,
166
+ listBoxRef: B,
167
+ name: i,
164
168
  placeholder: $e,
165
- popoverRef: B
169
+ popoverRef: A
166
170
  },
167
- i
168
- ), { listBoxProps: re } = qe(Ee, i, w), { buttonProps: Ke } = Ue(Ve, W), { width: ne } = S.current?.getBoundingClientRect() ?? {
171
+ a
172
+ ), { listBoxProps: re } = qe(Ee, a, B), { buttonProps: Le } = Ue(Ve, W), { width: ne } = C.current?.getBoundingClientRect() ?? {
169
173
  width: 240
170
174
  };
171
- so(S, () => {
172
- i.isOpen && !r && i.close();
173
- }, [B]);
174
- const C = Array.from(i.collection), se = r ? C.findLastIndex(
175
+ io(C, () => {
176
+ a.isOpen && !r && a.close();
177
+ }, [A]);
178
+ const O = Array.from(a.collection), se = r ? O.findLastIndex(
175
179
  (e) => e.key === "All" || Y.current.has(String(e.key))
176
- ) : -1, Le = I(() => n.map((e) => e.value), [n]), le = I(
177
- () => new Map(n.map((e) => [e.value, e.group])),
178
- [n]
179
- ), V = I(() => C.reduce(
180
+ ) : -1, Ke = F(() => o.map((e) => e.value), [o]), le = F(
181
+ () => new Map(o.map((e) => [e.value, e.group])),
182
+ [o]
183
+ ), V = F(() => O.reduce(
180
184
  (e, s, l) => {
181
185
  const c = le.get(String(s.key));
182
186
  return c !== void 0 && c !== e.currentGroup ? (e.result.push({ type: "header", group: c }), e.currentGroup = c) : c === void 0 && e.currentGroup !== void 0 && (e.currentGroup = void 0), e.result.push({ type: "item", index: l }), e;
183
187
  },
184
188
  { result: [], currentGroup: void 0 }
185
- ).result, [C, le]), ie = He({
189
+ ).result, [O, le]), ie = He({
186
190
  count: V.length,
187
191
  estimateSize: (e) => V[e].type === "header" ? 44 : 28,
188
- getScrollElement: () => w.current,
192
+ getScrollElement: () => B.current,
189
193
  useFlushSync: !1
190
- }), ae = i.isOpen && !h, T = ae && !!Z, ce = ae && n.length === 0 && !!X, je = g(
194
+ }), ae = a.isOpen && !h, T = ae && !!Z, ce = ae && o.length === 0 && !!X, je = g(
191
195
  (e) => {
192
196
  e.preventDefault();
193
197
  },
194
198
  []
195
199
  ), pe = T ? (
196
200
  // A listbox only owns options, so the row itself must stay presentational
197
- /* @__PURE__ */ o(eo, { onMouseDown: je, role: "presentation", children: /* @__PURE__ */ o("div", { "aria-live": "polite", role: "status", children: /* @__PURE__ */ o(
201
+ /* @__PURE__ */ t(eo, { onMouseDown: je, role: "presentation", children: /* @__PURE__ */ t("div", { "aria-live": "polite", role: "status", children: /* @__PURE__ */ t(
198
202
  J,
199
203
  {
200
204
  color: m.palette.gray[400],
@@ -205,7 +209,7 @@ const zo = ({
205
209
  }
206
210
  ) }) })
207
211
  ) : null;
208
- return /* @__PURE__ */ z(
212
+ return /* @__PURE__ */ R(
209
213
  Xe,
210
214
  {
211
215
  containerRef: oe,
@@ -213,31 +217,31 @@ const zo = ({
213
217
  helpLink: ye,
214
218
  helpLinkText: ge,
215
219
  helpText: ve,
216
- htmlFor: a,
217
- id: `combobox-${a}`,
220
+ htmlFor: i,
221
+ id: `combobox-${i}`,
218
222
  label: P,
219
223
  required: we,
220
224
  tooltip: Se,
221
225
  weight: Ce,
222
226
  children: [
223
- /* @__PURE__ */ z(
227
+ /* @__PURE__ */ R(
224
228
  Ze,
225
229
  {
226
230
  className: `${h ? "disabled" : ""} ${D ? "error" : ""}`,
227
- ref: S,
231
+ ref: C,
228
232
  children: [
229
- /* @__PURE__ */ o(
233
+ /* @__PURE__ */ t(
230
234
  "input",
231
235
  {
232
236
  ...Te,
233
237
  "aria-invalid": D ? "true" : "false",
234
- "aria-label": a,
238
+ "aria-label": i,
235
239
  disabled: h,
236
240
  onKeyDown: te,
237
241
  ref: U
238
242
  }
239
243
  ),
240
- D ? /* @__PURE__ */ o(
244
+ D ? /* @__PURE__ */ t(
241
245
  q,
242
246
  {
243
247
  icon: "exclamation-circle",
@@ -246,8 +250,8 @@ const zo = ({
246
250
  iconSize: "lg"
247
251
  }
248
252
  ) : void 0,
249
- be && !h && (r ? (F?.(`${a}Options`)?.length ?? 0) > 0 : _) ? /* @__PURE__ */ o(
250
- no,
253
+ be && !h && (r ? (b?.(`${i}Options`)?.length ?? 0) > 0 : _) ? /* @__PURE__ */ t(
254
+ lo,
251
255
  {
252
256
  icon: "xmark",
253
257
  iconColor: m.palette.gray[400],
@@ -260,19 +264,19 @@ const zo = ({
260
264
  variant: "ghost"
261
265
  }
262
266
  ) : void 0,
263
- /* @__PURE__ */ z(
267
+ /* @__PURE__ */ R(
264
268
  oo,
265
269
  {
266
- ...Ke,
270
+ ...Le,
267
271
  $variant: "ghost",
268
- className: `action ${i.isOpen && !h ? "open" : "closed"}`,
272
+ className: `action ${a.isOpen && !h ? "open" : "closed"}`,
269
273
  disabled: h,
270
274
  px: 0.125,
271
275
  py: 0.125,
272
276
  ref: W,
273
277
  type: "button",
274
278
  children: [
275
- /* @__PURE__ */ o("div", { className: "chevron-down", children: /* @__PURE__ */ o(
279
+ /* @__PURE__ */ t("div", { className: "chevron-down", children: /* @__PURE__ */ t(
276
280
  q,
277
281
  {
278
282
  clickable: !1,
@@ -282,7 +286,7 @@ const zo = ({
282
286
  iconType: "fa-light"
283
287
  }
284
288
  ) }),
285
- /* @__PURE__ */ o("div", { className: "chevron-up", children: /* @__PURE__ */ o(
289
+ /* @__PURE__ */ t("div", { className: "chevron-up", children: /* @__PURE__ */ t(
286
290
  q,
287
291
  {
288
292
  clickable: !1,
@@ -298,26 +302,26 @@ const zo = ({
298
302
  ]
299
303
  }
300
304
  ),
301
- i.isOpen && i.collection.size > 0 && !h ? /* @__PURE__ */ o(
305
+ a.isOpen && a.collection.size > 0 && !h ? /* @__PURE__ */ t(
302
306
  de,
303
307
  {
304
308
  className: "dropdown",
305
- id: `popover-${a}`,
309
+ id: `popover-${i}`,
306
310
  offset: 4,
307
311
  placement: "bottom start",
308
- popoverRef: B,
309
- state: i,
310
- triggerRef: S,
311
- children: /* @__PURE__ */ z(
312
+ popoverRef: A,
313
+ state: a,
314
+ triggerRef: C,
315
+ children: /* @__PURE__ */ R(
312
316
  he,
313
317
  {
314
318
  ...re,
315
319
  $hasStatus: T,
316
- $multiSelection: r && !Array.from(R ?? []).includes("All"),
320
+ $multiSelection: r && !Array.from(x ?? []).includes("All"),
317
321
  $width: ne,
318
- ref: w,
322
+ ref: B,
319
323
  children: [
320
- /* @__PURE__ */ o(
324
+ /* @__PURE__ */ t(
321
325
  "div",
322
326
  {
323
327
  style: {
@@ -327,7 +331,7 @@ const zo = ({
327
331
  children: ie.getVirtualItems().map((e) => {
328
332
  const s = V[e.index];
329
333
  if (s.type === "header")
330
- return /* @__PURE__ */ o(
334
+ return /* @__PURE__ */ t(
331
335
  "div",
332
336
  {
333
337
  style: {
@@ -338,7 +342,7 @@ const zo = ({
338
342
  height: `${e.size}px`,
339
343
  transform: `translateY(${e.start}px)`
340
344
  },
341
- children: /* @__PURE__ */ o(to, { children: /* @__PURE__ */ o(
345
+ children: /* @__PURE__ */ t(to, { children: /* @__PURE__ */ t(
342
346
  J,
343
347
  {
344
348
  color: m.palette.gray[400],
@@ -350,8 +354,8 @@ const zo = ({
350
354
  },
351
355
  `header-${e.index}`
352
356
  );
353
- const l = C[s.index], c = V[e.index + 1], t = l.key === "All" && c?.type === "header", p = r && s.index === se && se >= 0 && s.index < C.length - 1 && !t;
354
- return /* @__PURE__ */ o(
357
+ const l = O[s.index], c = V[e.index + 1], n = l.key === "All" && c?.type === "header", p = r && s.index === se && se >= 0 && s.index < O.length - 1 && !n;
358
+ return /* @__PURE__ */ t(
355
359
  "div",
356
360
  {
357
361
  style: {
@@ -363,19 +367,19 @@ const zo = ({
363
367
  transform: `translateY(${e.start}px)`,
364
368
  borderBottom: p ? `1px solid ${m.palette.gray[200]}` : void 0
365
369
  },
366
- children: /* @__PURE__ */ o(
370
+ children: /* @__PURE__ */ t(
367
371
  _e,
368
372
  {
369
- allItemKeys: Le,
373
+ allItemKeys: Ke,
370
374
  containerRef: oe,
371
375
  item: l,
372
376
  multiSelection: r,
373
- name: a,
374
- popoverRef: B,
375
- setInputValue: $,
376
- setValue: x,
377
- state: i,
378
- watch: F
377
+ name: i,
378
+ popoverRef: A,
379
+ setInputValue: w,
380
+ setValue: $,
381
+ state: a,
382
+ watch: b
379
383
  }
380
384
  )
381
385
  },
@@ -389,26 +393,26 @@ const zo = ({
389
393
  }
390
394
  )
391
395
  }
392
- ) : !ce && !T ? null : /* @__PURE__ */ o(
396
+ ) : !ce && !T ? null : /* @__PURE__ */ t(
393
397
  de,
394
398
  {
395
399
  className: "dropdown",
396
- id: `popover-${a}-empty`,
400
+ id: `popover-${i}-empty`,
397
401
  offset: 4,
398
402
  placement: "bottom start",
399
- popoverRef: B,
400
- state: i,
401
- triggerRef: S,
402
- children: /* @__PURE__ */ z(
403
+ popoverRef: A,
404
+ state: a,
405
+ triggerRef: C,
406
+ children: /* @__PURE__ */ R(
403
407
  he,
404
408
  {
405
409
  ...re,
406
410
  $hasStatus: T,
407
411
  $multiSelection: !1,
408
412
  $width: ne,
409
- ref: w,
413
+ ref: B,
410
414
  children: [
411
- ce ? /* @__PURE__ */ o(ro, { children: /* @__PURE__ */ o(
415
+ ce ? /* @__PURE__ */ t(ro, { children: /* @__PURE__ */ t(
412
416
  J,
413
417
  {
414
418
  color: m.palette.gray[400],
@@ -429,5 +433,5 @@ const zo = ({
429
433
  );
430
434
  };
431
435
  export {
432
- zo as ComboBoxField
436
+ Fo as ComboBoxField
433
437
  };
@@ -7,5 +7,6 @@ declare const withEmptyMessage: import('storybook/internal/csf').AnnotatedStoryF
7
7
  declare const withStatusMessage: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
8
8
  declare const withClearButton: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
9
9
  declare const groupedMultiSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
10
- export { Default, multiSelectWithAll, withEmptyMessage, withStatusMessage, withClearButton, groupedMultiSelect, };
10
+ declare const preselectedMultiSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
11
+ export { Default, multiSelectWithAll, withEmptyMessage, withStatusMessage, withClearButton, groupedMultiSelect, preselectedMultiSelect, };
11
12
  export default config;
@@ -1,10 +1,10 @@
1
- import { jsx as d, jsxs as U } from "react/jsx-runtime";
2
- import G from "../../../../../_virtual/isEqual.js";
3
- import { useRef as H, useMemo as g, useCallback as y } from "react";
4
- import { useOption as J } from "../../../../../node_modules/react-aria/dist/private/listbox/useOption.js";
5
- import { useTheme as Q } from "styled-components";
6
- import { StyledOption as W } from "../styles.js";
7
- import { Checkbox as j } from "../../../../checkbox/index.js";
1
+ import { jsx as d, jsxs as E } from "react/jsx-runtime";
2
+ import { useRef as G, useMemo as h, useCallback as k } from "react";
3
+ import { useOption as H } from "../../../../../node_modules/react-aria/dist/private/listbox/useOption.js";
4
+ import { useTheme as J } from "styled-components";
5
+ import { StyledOption as Q } from "../styles.js";
6
+ import { describeSelection as W } from "../utils.js";
7
+ import { Checkbox as T } from "../../../../checkbox/index.js";
8
8
  import { Icon as X } from "../../../../icon/index.js";
9
9
  import { Link as Y } from "../../../../link/index.js";
10
10
  import { Tag as Z } from "../../../../tag/index.js";
@@ -14,105 +14,103 @@ import { Text as _ } from "../../../../typography/text/index.js";
14
14
  import { useClickOutside as I } from "../../../../../hooks/use-click-outside.js";
15
15
  import { openUrl as V } from "../../../../../utils/open-url.js";
16
16
  const yo = ({
17
- allItemKeys: L,
18
- containerRef: T,
17
+ allItemKeys: g,
18
+ containerRef: j,
19
19
  item: o,
20
20
  multiSelection: p,
21
- name: e,
21
+ name: r,
22
22
  popoverRef: D,
23
23
  setInputValue: t,
24
24
  setValue: n,
25
25
  state: c,
26
26
  watch: f
27
27
  }) => {
28
- const K = Q(), C = H(null), h = o.props.hrefLang, A = c.disabledKeys, i = L.filter(
29
- (r) => !Array.from(A).includes(r) && r !== "All"
30
- ), { optionProps: q, isSelected: O, isFocused: w, isDisabled: $ } = J(
28
+ const w = J(), O = G(null), a = o.props.hrefLang, y = c.disabledKeys, C = g.filter(
29
+ (e) => !Array.from(y).includes(e) && e !== "All"
30
+ ), { optionProps: z, isSelected: $, isFocused: F, isDisabled: A } = H(
31
31
  { key: o.key },
32
32
  c,
33
- C
34
- ), k = g(() => c.collection.getItem("All")?.rendered?.toString(), [c.collection]), z = [
35
- O ? "selected" : "",
36
- w ? "focused" : "",
37
- $ ? "disabled" : ""
38
- ].join(" "), m = y(
39
- (r) => {
40
- if (i.length > 0 && r.length === i.length && G([...i].sort(), [...r].sort()) && !Array.from(A).includes("All") && k)
41
- n?.(`${e}CheckAll`, k), t(k);
42
- else {
43
- n?.(`${e}CheckAll`, "");
44
- const l = [...r].sort();
45
- t(
46
- l.length <= 2 ? l.join(", ") : `${l.slice(0, 2).join(", ")}, +${l.length - 2} more`
47
- );
48
- }
33
+ O
34
+ ), b = h(() => c.collection.getItem("All")?.rendered?.toString(), [c.collection]), q = [
35
+ $ ? "selected" : "",
36
+ F ? "focused" : "",
37
+ A ? "disabled" : ""
38
+ ].join(" "), S = k(
39
+ (e) => {
40
+ const { allSelected: s, text: i } = W(
41
+ e,
42
+ g,
43
+ y,
44
+ b
45
+ );
46
+ n?.(`${r}CheckAll`, s ? i : ""), t(i);
49
47
  },
50
- [k, A, i, e, t, n]
51
- ), F = y(
52
- (r) => {
53
- if (r.target.checked) {
54
- const a = [...i].sort();
55
- n?.(`${e}Options`, a), n?.(`${e}CheckAll`, r.target.value), t(r.target.value);
48
+ [g, b, y, r, t, n]
49
+ ), B = k(
50
+ (e) => {
51
+ if (e.target.checked) {
52
+ const s = [...C].sort();
53
+ n?.(`${r}Options`, s), n?.(`${r}CheckAll`, e.target.value), t(e.target.value);
56
54
  } else
57
- n?.(`${e}Options`, []), n?.(`${e}CheckAll`, ""), t("");
55
+ n?.(`${r}Options`, []), n?.(`${r}CheckAll`, ""), t("");
58
56
  },
59
- [i, e, t, n]
60
- ), B = y(
61
- (r) => {
62
- const a = r.target.value, l = f?.(`${e}Options`) ?? [], u = Array.isArray(l) ? l : l ? [l] : [], v = r.target.checked ? [...u, a] : u.filter((R) => R !== a);
63
- n?.(`${e}Options`, v), m(v);
57
+ [C, r, t, n]
58
+ ), K = k(
59
+ (e) => {
60
+ const s = e.target.value, i = f?.(`${r}Options`) ?? [], v = Array.isArray(i) ? i : i ? [i] : [], L = e.target.checked ? [...v, s] : v.filter((U) => U !== s);
61
+ n?.(`${r}Options`, L), S(L);
64
62
  },
65
- [e, n, f, m]
66
- ), s = f?.(`${e}Options`), b = g(() => Array.isArray(s) ? s : typeof s == "string" && s ? [s] : [], [s]), E = g(
67
- () => b.includes(o.key.toString()),
68
- [b, o.key]
69
- ), S = f?.(`${e}CheckAll`), M = g(() => !!S, [S]), N = o.key === "All" ? /* @__PURE__ */ d(
70
- j,
63
+ [r, n, f, S]
64
+ ), l = f?.(`${r}Options`), m = h(() => Array.isArray(l) ? l : typeof l == "string" && l ? [l] : [], [l]), M = h(
65
+ () => m.includes(o.key.toString()),
66
+ [m, o.key]
67
+ ), x = f?.(`${r}CheckAll`), N = h(() => !!x, [x]), P = o.key === "All" ? /* @__PURE__ */ d(
68
+ T,
71
69
  {
72
- checked: M,
70
+ checked: N,
73
71
  label: o.rendered?.toString(),
74
- name: `${e}CheckAll`,
75
- onChange: F,
72
+ name: `${r}CheckAll`,
73
+ onChange: B,
76
74
  value: o.rendered?.toString()
77
75
  }
78
76
  ) : /* @__PURE__ */ d(
79
- j,
77
+ T,
80
78
  {
81
- checked: E,
79
+ checked: M,
82
80
  label: o.rendered?.toString(),
83
- name: `${e}Options`,
84
- onChange: B,
81
+ name: `${r}Options`,
82
+ onChange: K,
85
83
  value: o.key.toString()
86
84
  }
87
- ), x = p && !$ ? N : /* @__PURE__ */ d(
85
+ ), u = p && !A ? P : /* @__PURE__ */ d(
88
86
  _,
89
87
  {
90
- color: K.palette.gray[800],
88
+ color: w.palette.gray[800],
91
89
  size: "md",
92
90
  textOverflow: "ellipsis",
93
91
  whiteSpace: "nowrap",
94
92
  children: o.rendered
95
93
  }
96
- ), P = y(
97
- (r) => {
98
- r.preventDefault(), t(o.rendered?.toString() ?? ""), c.setSelectedKey(o.key), requestAnimationFrame(() => {
94
+ ), R = k(
95
+ (e) => {
96
+ e.preventDefault(), t(o.rendered?.toString() ?? ""), c.setSelectedKey(o.key), requestAnimationFrame(() => {
99
97
  c.setOpen(!1);
100
- }), V(h);
98
+ }), V(a);
101
99
  },
102
- [h, o.key, o.rendered, c, t]
100
+ [a, o.key, o.rendered, c, t]
103
101
  );
104
102
  return I(D, () => {
105
103
  p && c.close();
106
- }, [T]), /* @__PURE__ */ U(
107
- W,
104
+ }, [j]), /* @__PURE__ */ E(
105
+ Q,
108
106
  {
109
- ...!p && !h ? q : {},
107
+ ...!p && !a ? z : {},
110
108
  $multiSelection: p,
111
- className: z,
112
- ref: C,
109
+ className: q,
110
+ ref: O,
113
111
  children: [
114
- h ? /* @__PURE__ */ d(Y, { href: h, onClick: P, children: x }) : x,
115
- O && !$ && !p ? /* @__PURE__ */ d(X, { icon: "check", iconSize: "sm", iconType: "fa-light" }) : void 0,
112
+ a ? /* @__PURE__ */ d(Y, { href: a, onClick: R, children: u }) : u,
113
+ $ && !A && !p ? /* @__PURE__ */ d(X, { icon: "check", iconSize: "sm", iconType: "fa-light" }) : void 0,
116
114
  o.rendered === o.textValue ? void 0 : /* @__PURE__ */ d(Z, { tagLabel: o.textValue, variant: "inactive" })
117
115
  ]
118
116
  }
@@ -0,0 +1,7 @@
1
+ import { Key } from 'react-aria';
2
+ declare const toSelection: (options: unknown) => string[];
3
+ declare const describeSelection: (selected: readonly string[], keys: readonly string[], disabledKeys: Iterable<Key>, allName: string | undefined) => {
4
+ allSelected: boolean;
5
+ text: string;
6
+ };
7
+ export { describeSelection, toSelection };
@@ -0,0 +1,16 @@
1
+ import h from "../../../../_virtual/isEqual.js";
2
+ const g = (t) => Array.isArray(t) ? t : typeof t == "string" && t ? [t] : [], u = (t, i, a, c) => {
3
+ const o = new Set(a), r = i.filter(
4
+ (s) => s !== "All" && !o.has(s)
5
+ ), l = o.has("All") ? void 0 : c, n = !!l && r.length > 0 && t.length === r.length && h([...r].sort(), [...t].sort());
6
+ if (n && l) return { allSelected: n, text: l };
7
+ const e = [...t].sort();
8
+ return {
9
+ allSelected: n,
10
+ text: e.length <= 2 ? e.join(", ") : `${e.slice(0, 2).join(", ")}, +${e.length - 2} more`
11
+ };
12
+ };
13
+ export {
14
+ u as describeSelection,
15
+ g as toSelection
16
+ };
@@ -6,7 +6,6 @@ import { Icon as E } from "../icon/index.js";
6
6
  import { IconButton as P } from "../icon-button/index.js";
7
7
  import { OutlineContainer as S } from "../inputs/outline-container/index.js";
8
8
  import { StyledTextInputContainer as x } from "../inputs/styles.js";
9
- import "../../_virtual/isEqual.js";
10
9
  import "../checkbox/index.js";
11
10
  import "../typography/heading/index.js";
12
11
  import "../typography/span/index.js";
@@ -38,7 +37,7 @@ const C = 300, s = () => {
38
37
  timeStamp: t.timeStamp,
39
38
  type: t.type
40
39
  };
41
- }, J = ({
40
+ }, q = ({
42
41
  name: o,
43
42
  onClear: t,
44
43
  onChange: i,
@@ -112,5 +111,5 @@ const C = 300, s = () => {
112
111
  ] }) });
113
112
  };
114
113
  export {
115
- J as Search
114
+ q as Search
116
115
  };
@@ -9,7 +9,7 @@ import { Thumb as k } from "./thumb/index.js";
9
9
  import { normalizeValue as v } from "./utils.js";
10
10
  import { Container as w } from "../container/index.js";
11
11
  import { OutlineContainer as y } from "../inputs/outline-container/index.js";
12
- import "../../_virtual/isEqual.js";
12
+ import "../inputs/styles.js";
13
13
  import "../checkbox/index.js";
14
14
  import "../icon/index.js";
15
15
  import "../../_virtual/lodash.js";
package/package.json CHANGED
@@ -135,5 +135,5 @@
135
135
  "./dist/index.js"
136
136
  ],
137
137
  "typings": "./dist/index.d.ts",
138
- "version": "9.1.0"
138
+ "version": "9.1.1"
139
139
  }