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