@fluidattacks/design 10.1.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/form/styles.js +12 -7
- package/dist/components/inputs/fields/combobox/field/index.d.ts +1 -1
- package/dist/components/inputs/fields/combobox/field/index.js +115 -112
- package/dist/components/inputs/fields/combobox/index.d.ts +1 -1
- package/dist/components/inputs/fields/combobox/index.js +34 -31
- package/dist/components/inputs/fields/combobox/index.stories.d.ts +4 -1
- package/dist/components/inputs/fields/combobox/option/index.d.ts +1 -1
- package/dist/components/inputs/fields/combobox/option/index.js +79 -68
- package/dist/components/inputs/fields/combobox/styles.js +10 -3
- package/dist/components/inputs/fields/combobox/types.d.ts +5 -0
- package/dist/components/inputs/fields/combobox/utils.d.ts +1 -1
- package/dist/components/inputs/fields/combobox/utils.js +10 -10
- package/dist/components/loading/index.js +11 -11
- package/dist/components/loading/index.stories.d.ts +2 -1
- package/dist/components/modal/index.stories.d.ts +4 -1
- package/dist/components/modal/modal-confirm/index.d.ts +1 -1
- package/dist/components/modal/modal-confirm/index.js +34 -20
- package/dist/components/modal/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { styled as
|
|
1
|
+
import { styled as o } from "styled-components";
|
|
2
2
|
import { Container as e } from "../container/index.js";
|
|
3
|
-
const
|
|
3
|
+
const l = o(e)`
|
|
4
4
|
> * {
|
|
5
5
|
flex-shrink: 0;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
|
|
8
|
+
&:has(> #sticky-footer) {
|
|
9
|
+
height: auto;
|
|
10
|
+
overflow: visible;
|
|
11
|
+
}
|
|
12
|
+
`, n = o.form`
|
|
13
|
+
${({ theme: t }) => `
|
|
9
14
|
align-items: flex-start;
|
|
10
15
|
align-self: stretch;
|
|
11
16
|
display: flex;
|
|
12
17
|
flex-direction: column;
|
|
13
|
-
gap: ${
|
|
18
|
+
gap: ${t.spacing[0.5]};
|
|
14
19
|
overflow: hidden auto;
|
|
15
20
|
width: 100%;
|
|
16
21
|
`}
|
|
17
22
|
`;
|
|
18
23
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
l as FormContent,
|
|
25
|
+
n as StyledForm
|
|
21
26
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ControllerRenderProps } from 'react-hook-form';
|
|
2
2
|
import { IComboBoxProps } from '../types';
|
|
3
|
-
declare const ComboBoxField: ({ field, disabled, disabledKeys, error, helpLink, helpLinkText, helpText, label, loadingItems, name, multiSelection, items, onBlur: onBlurProp, onChange: onChangeProp, onClear, placeholder, clearable, emptyMessage, statusMessage, required, setValue, tooltip, value, watch, weight, }: Readonly<IComboBoxProps & {
|
|
3
|
+
declare const ComboBoxField: ({ field, disabled, disabledKeys, error, helpLink, helpLinkText, helpText, label, loadingItems, name, multiSelection, items, onBlur: onBlurProp, onChange: onChangeProp, onClear, placeholder, clearable, countLabel, emptyMessage, statusMessage, required, setValue, tooltip, value, watch, weight, }: Readonly<IComboBoxProps & {
|
|
4
4
|
field?: ControllerRenderProps<any>;
|
|
5
5
|
}>) => JSX.Element;
|
|
6
6
|
export { ComboBoxField };
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { jsx as r, jsxs as G } from "react/jsx-runtime";
|
|
2
|
-
import { useVirtualizer as
|
|
2
|
+
import { useVirtualizer as Je } from "../../../../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
|
|
3
3
|
import { useState as g, useMemo as $, useRef as y, useCallback as v } from "react";
|
|
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
|
|
13
|
-
import { Popover as
|
|
14
|
-
import { Option as
|
|
15
|
-
import { StyledStatusMessage as
|
|
16
|
-
import { describeSelection as
|
|
4
|
+
import { useButton as Pe } 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 Xe } from "../../../../../node_modules/react-aria/dist/private/i18n/useFilter.js";
|
|
7
|
+
import { useListBox as Ze } from "../../../../../node_modules/react-aria/dist/private/listbox/useListBox.js";
|
|
8
|
+
import { useComboBoxState as _e } from "../../../../../node_modules/react-stately/dist/private/combobox/useComboBoxState.js";
|
|
9
|
+
import { Item as eo } from "../../../../../node_modules/react-stately/dist/private/collections/Item.js";
|
|
10
|
+
import { useTheme as oo } from "styled-components";
|
|
11
|
+
import { OutlineContainer as to } from "../../../outline-container/index.js";
|
|
12
|
+
import { StyledTextInputContainer as ro } from "../../../styles.js";
|
|
13
|
+
import { Popover as ye } from "../../../utils/popover/index.js";
|
|
14
|
+
import { Option as no } from "../option/index.js";
|
|
15
|
+
import { StyledStatusMessage as so, ChevronIconButton as lo, StyledDropdown as ve, StyledGroupHeader as ao, StyledEmptyMessage as co } from "../styles.js";
|
|
16
|
+
import { describeSelection as io, toSelection as xe } from "../utils.js";
|
|
17
17
|
import { Icon as J } from "../../../../icon/index.js";
|
|
18
|
-
import { IconButton as
|
|
18
|
+
import { IconButton as po } from "../../../../icon-button/index.js";
|
|
19
19
|
import "../../../../typography/heading/index.js";
|
|
20
20
|
import "../../../../typography/span/index.js";
|
|
21
21
|
import { Text as P } from "../../../../typography/text/index.js";
|
|
22
|
-
import { useClickOutside as
|
|
23
|
-
const
|
|
22
|
+
import { useClickOutside as uo } from "../../../../../hooks/use-click-outside.js";
|
|
23
|
+
const Mo = ({
|
|
24
24
|
field: i,
|
|
25
25
|
disabled: h = !1,
|
|
26
26
|
disabledKeys: b,
|
|
27
|
-
error:
|
|
28
|
-
helpLink:
|
|
29
|
-
helpLinkText:
|
|
30
|
-
helpText:
|
|
27
|
+
error: $e,
|
|
28
|
+
helpLink: be,
|
|
29
|
+
helpLinkText: we,
|
|
30
|
+
helpText: Se,
|
|
31
31
|
label: Q,
|
|
32
32
|
loadingItems: X,
|
|
33
33
|
name: l,
|
|
@@ -36,30 +36,32 @@ const ko = ({
|
|
|
36
36
|
onBlur: j,
|
|
37
37
|
onChange: d,
|
|
38
38
|
onClear: Z,
|
|
39
|
-
placeholder:
|
|
40
|
-
clearable:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
placeholder: Be,
|
|
40
|
+
clearable: Ce = !1,
|
|
41
|
+
countLabel: _,
|
|
42
|
+
emptyMessage: ee,
|
|
43
|
+
statusMessage: oe,
|
|
44
|
+
required: Ae,
|
|
44
45
|
setValue: w,
|
|
45
|
-
tooltip:
|
|
46
|
-
value:
|
|
46
|
+
tooltip: Oe,
|
|
47
|
+
value: ze,
|
|
47
48
|
watch: S,
|
|
48
|
-
weight:
|
|
49
|
+
weight: Re
|
|
49
50
|
}) => {
|
|
50
|
-
const m =
|
|
51
|
-
|
|
51
|
+
const m = oo(), k = h ? void 0 : $e, a = i?.value ?? ze, [M, x] = g(() => t ? io(
|
|
52
|
+
xe(S?.(`${l}Options`)),
|
|
52
53
|
o.map((e) => e.value),
|
|
53
54
|
b ?? [],
|
|
54
|
-
o.find((e) => e.value === "All")?.name
|
|
55
|
-
|
|
55
|
+
o.find((e) => e.value === "All")?.name,
|
|
56
|
+
_
|
|
57
|
+
).text : o.find((e) => e.value === a)?.name ?? ""), [te, B] = g(a), H = (X === !1 || !a) && !t, C = $(
|
|
56
58
|
() => H ? o.find((e) => e.value === a)?.name ?? "" : "",
|
|
57
59
|
[H, a, o]
|
|
58
|
-
), [
|
|
59
|
-
a !==
|
|
60
|
+
), [Ie, Fe] = g(a), [De, re] = g(C), [Ge, N] = g(a);
|
|
61
|
+
a !== Ie ? (Fe(a), re(C), !t && (X !== !0 || !a) && a !== Ge && (N(a), x(
|
|
60
62
|
o.find((e) => e.value === a)?.name ?? ""
|
|
61
|
-
), B(a ?? ""))) : H && C !==
|
|
62
|
-
const [
|
|
63
|
+
), B(a ?? ""))) : H && C !== De && (re(C), x(C), B(a ?? ""));
|
|
64
|
+
const [ke, U] = g(o), [ne, A] = g(!1), { contains: V } = Xe({ sensitivity: "base" }), W = y(null), Y = y(null), O = y(null), z = y(null), se = y(null), R = y(null), q = y(/* @__PURE__ */ new Set()), Me = $(() => {
|
|
63
65
|
const e = q.current, s = Array.from(b ?? []), p = o.some((n) => n.group !== void 0);
|
|
64
66
|
return o.toSorted((n, f) => {
|
|
65
67
|
if (n.value === "All") return -1;
|
|
@@ -74,9 +76,9 @@ const ko = ({
|
|
|
74
76
|
if (K && !L) return 1;
|
|
75
77
|
if (!K && L) return -1;
|
|
76
78
|
if (t) {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
if (!
|
|
79
|
+
const me = e.has(n.value), ge = e.has(f.value);
|
|
80
|
+
if (me && !ge) return -1;
|
|
81
|
+
if (!me && ge) return 1;
|
|
80
82
|
}
|
|
81
83
|
return n.name.localeCompare(f.name);
|
|
82
84
|
}
|
|
@@ -88,8 +90,8 @@ const ko = ({
|
|
|
88
90
|
}
|
|
89
91
|
return 0;
|
|
90
92
|
}).map(
|
|
91
|
-
(n) => V(n.name, M) ||
|
|
92
|
-
|
|
93
|
+
(n) => V(n.name, M) || ne ? /* @__PURE__ */ r(
|
|
94
|
+
eo,
|
|
93
95
|
{
|
|
94
96
|
"aria-label": n.value,
|
|
95
97
|
hrefLang: n.href,
|
|
@@ -99,7 +101,7 @@ const ko = ({
|
|
|
99
101
|
n.value
|
|
100
102
|
) : null
|
|
101
103
|
);
|
|
102
|
-
}, [V, b, M, o, t,
|
|
104
|
+
}, [V, b, M, o, t, ne]), Ne = v(
|
|
103
105
|
(e) => {
|
|
104
106
|
const s = e.split(/,|\s/u).slice(-1)[0].trim();
|
|
105
107
|
x(t ? s : e), e === "" || e.endsWith(",") ? A(!0) : (A(!1), i || N(e), B((p) => {
|
|
@@ -112,45 +114,45 @@ const ko = ({
|
|
|
112
114
|
));
|
|
113
115
|
},
|
|
114
116
|
[V, o, i, t, d]
|
|
115
|
-
),
|
|
117
|
+
), Ve = v(
|
|
116
118
|
(e) => {
|
|
117
119
|
x(o.find((s) => s.value === e)?.name ?? ""), B(e ? String(e) : ""), N(i ? e : String(e ?? "")), i && i.onChange(e), d && d(e ? String(e) : ""), U(o);
|
|
118
120
|
},
|
|
119
121
|
[o, i, d]
|
|
120
|
-
),
|
|
122
|
+
), le = v(
|
|
121
123
|
(e) => {
|
|
122
124
|
e.key === "Enter" && e.preventDefault(), A(!1);
|
|
123
125
|
},
|
|
124
126
|
[]
|
|
125
|
-
),
|
|
127
|
+
), Te = v(() => {
|
|
126
128
|
j && j(), i && i.onBlur();
|
|
127
|
-
}, [i, j]),
|
|
129
|
+
}, [i, j]), Ee = v(() => {
|
|
128
130
|
A(!0);
|
|
129
|
-
}, []), c =
|
|
131
|
+
}, []), c = _e({
|
|
130
132
|
allowsCustomValue: t,
|
|
131
133
|
allowsEmptyCollection: !0,
|
|
132
134
|
disabledKeys: b,
|
|
133
135
|
inputValue: M,
|
|
134
|
-
items:
|
|
136
|
+
items: ke,
|
|
135
137
|
menuTrigger: "focus",
|
|
136
138
|
shouldCloseOnBlur: !t,
|
|
137
|
-
selectedKey:
|
|
138
|
-
onBlur:
|
|
139
|
-
onInputChange:
|
|
140
|
-
onKeyDown:
|
|
141
|
-
onKeyUp:
|
|
139
|
+
selectedKey: te,
|
|
140
|
+
onBlur: Te,
|
|
141
|
+
onInputChange: Ne,
|
|
142
|
+
onKeyDown: le,
|
|
143
|
+
onKeyUp: Ee,
|
|
142
144
|
onOpenChange(e, s) {
|
|
143
145
|
e && t && S && (q.current = new Set(
|
|
144
|
-
|
|
146
|
+
xe(S(`${l}Options`)).filter(Boolean)
|
|
145
147
|
)), A(
|
|
146
148
|
e && (s === "manual" || s === "focus")
|
|
147
149
|
), e && s !== "focus" && requestAnimationFrame(() => {
|
|
148
150
|
W.current?.focus();
|
|
149
151
|
});
|
|
150
152
|
},
|
|
151
|
-
onSelectionChange: t ? void 0 :
|
|
152
|
-
children:
|
|
153
|
-
}),
|
|
153
|
+
onSelectionChange: t ? void 0 : Ve,
|
|
154
|
+
children: Me
|
|
155
|
+
}), Ke = v(() => {
|
|
154
156
|
x(""), B(null), U(o), c.setSelectedKey(null), c.setInputValue(""), i || N(""), d && d(""), t && w && (w(`${l}Options`, []), w(`${l}CheckAll`, "")), Z?.();
|
|
155
157
|
}, [
|
|
156
158
|
i,
|
|
@@ -162,10 +164,10 @@ const ko = ({
|
|
|
162
164
|
w,
|
|
163
165
|
c
|
|
164
166
|
]), {
|
|
165
|
-
buttonProps:
|
|
166
|
-
inputProps:
|
|
167
|
-
listBoxProps:
|
|
168
|
-
} =
|
|
167
|
+
buttonProps: Le,
|
|
168
|
+
inputProps: je,
|
|
169
|
+
listBoxProps: He
|
|
170
|
+
} = Qe(
|
|
169
171
|
{
|
|
170
172
|
inputValue: M,
|
|
171
173
|
buttonRef: Y,
|
|
@@ -174,70 +176,70 @@ const ko = ({
|
|
|
174
176
|
label: Q ?? l,
|
|
175
177
|
listBoxRef: O,
|
|
176
178
|
name: l,
|
|
177
|
-
placeholder:
|
|
179
|
+
placeholder: Be,
|
|
178
180
|
popoverRef: R
|
|
179
181
|
},
|
|
180
182
|
c
|
|
181
|
-
), { listBoxProps:
|
|
183
|
+
), { listBoxProps: ae } = Ze(He, c, O), { buttonProps: Ue } = Pe(Le, Y), { width: ce } = z.current?.getBoundingClientRect() ?? {
|
|
182
184
|
width: 240
|
|
183
185
|
};
|
|
184
|
-
|
|
186
|
+
uo(z, () => {
|
|
185
187
|
c.isOpen && !t && c.close();
|
|
186
188
|
}, [R]);
|
|
187
|
-
const I = Array.from(c.collection),
|
|
189
|
+
const I = Array.from(c.collection), ie = t ? I.findLastIndex(
|
|
188
190
|
(e) => e.key === "All" || q.current.has(String(e.key))
|
|
189
|
-
) : -1,
|
|
191
|
+
) : -1, We = $(() => o.map((e) => e.value), [o]), pe = $(
|
|
190
192
|
() => new Map(o.map((e) => [e.value, e.group])),
|
|
191
193
|
[o]
|
|
192
|
-
),
|
|
194
|
+
), Ye = $(
|
|
193
195
|
() => new Map(o.map((e) => [e.value, e.tag])),
|
|
194
196
|
[o]
|
|
195
197
|
), T = $(() => I.reduce(
|
|
196
198
|
(e, s, p) => {
|
|
197
|
-
const u =
|
|
199
|
+
const u = pe.get(String(s.key));
|
|
198
200
|
return u !== void 0 && u !== e.currentGroup ? (e.result.push({ type: "header", group: u }), e.currentGroup = u) : u === void 0 && e.currentGroup !== void 0 && (e.currentGroup = void 0), e.result.push({ type: "item", index: p }), e;
|
|
199
201
|
},
|
|
200
202
|
{ result: [], currentGroup: void 0 }
|
|
201
|
-
).result, [I,
|
|
203
|
+
).result, [I, pe]), ue = Je({
|
|
202
204
|
count: T.length,
|
|
203
205
|
estimateSize: (e) => T[e].type === "header" ? 44 : 28,
|
|
204
206
|
getScrollElement: () => O.current,
|
|
205
207
|
useFlushSync: !1
|
|
206
|
-
}),
|
|
208
|
+
}), fe = c.isOpen && !h, E = fe && !!oe, de = fe && o.length === 0 && !!ee, qe = v(
|
|
207
209
|
(e) => {
|
|
208
210
|
e.preventDefault();
|
|
209
211
|
},
|
|
210
212
|
[]
|
|
211
|
-
),
|
|
213
|
+
), he = E ? (
|
|
212
214
|
// A listbox only owns options, so the row itself must stay presentational
|
|
213
|
-
/* @__PURE__ */ r(
|
|
215
|
+
/* @__PURE__ */ r(so, { onMouseDown: qe, role: "presentation", children: /* @__PURE__ */ r("div", { "aria-live": "polite", role: "status", children: /* @__PURE__ */ r(
|
|
214
216
|
P,
|
|
215
217
|
{
|
|
216
218
|
color: m.palette.gray[400],
|
|
217
219
|
size: "sm",
|
|
218
220
|
textOverflow: "auto",
|
|
219
221
|
whiteSpace: "wrap",
|
|
220
|
-
children:
|
|
222
|
+
children: oe
|
|
221
223
|
}
|
|
222
224
|
) }) })
|
|
223
225
|
) : null;
|
|
224
226
|
return /* @__PURE__ */ G(
|
|
225
|
-
|
|
227
|
+
to,
|
|
226
228
|
{
|
|
227
|
-
containerRef:
|
|
229
|
+
containerRef: se,
|
|
228
230
|
error: k,
|
|
229
|
-
helpLink:
|
|
230
|
-
helpLinkText:
|
|
231
|
-
helpText:
|
|
231
|
+
helpLink: be,
|
|
232
|
+
helpLinkText: we,
|
|
233
|
+
helpText: Se,
|
|
232
234
|
htmlFor: l,
|
|
233
235
|
id: `combobox-${l}`,
|
|
234
236
|
label: Q,
|
|
235
|
-
required:
|
|
236
|
-
tooltip:
|
|
237
|
-
weight:
|
|
237
|
+
required: Ae,
|
|
238
|
+
tooltip: Oe,
|
|
239
|
+
weight: Re,
|
|
238
240
|
children: [
|
|
239
241
|
/* @__PURE__ */ G(
|
|
240
|
-
|
|
242
|
+
ro,
|
|
241
243
|
{
|
|
242
244
|
className: `${h ? "disabled" : ""} ${k ? "error" : ""}`,
|
|
243
245
|
ref: z,
|
|
@@ -245,11 +247,11 @@ const ko = ({
|
|
|
245
247
|
/* @__PURE__ */ r(
|
|
246
248
|
"input",
|
|
247
249
|
{
|
|
248
|
-
...
|
|
250
|
+
...je,
|
|
249
251
|
"aria-invalid": k ? "true" : "false",
|
|
250
252
|
"aria-label": l,
|
|
251
253
|
disabled: h,
|
|
252
|
-
onKeyDown:
|
|
254
|
+
onKeyDown: le,
|
|
253
255
|
ref: W
|
|
254
256
|
}
|
|
255
257
|
),
|
|
@@ -262,14 +264,14 @@ const ko = ({
|
|
|
262
264
|
iconSize: "lg"
|
|
263
265
|
}
|
|
264
266
|
) : void 0,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
+
Ce && !h && (t ? (S?.(`${l}Options`)?.length ?? 0) > 0 : te) ? /* @__PURE__ */ r(
|
|
268
|
+
po,
|
|
267
269
|
{
|
|
268
270
|
icon: "xmark",
|
|
269
271
|
iconColor: m.palette.gray[400],
|
|
270
272
|
iconSize: "sm",
|
|
271
273
|
iconType: "fa-light",
|
|
272
|
-
onClick:
|
|
274
|
+
onClick: Ke,
|
|
273
275
|
px: 0.125,
|
|
274
276
|
py: 0.125,
|
|
275
277
|
type: "reset",
|
|
@@ -277,9 +279,9 @@ const ko = ({
|
|
|
277
279
|
}
|
|
278
280
|
) : void 0,
|
|
279
281
|
/* @__PURE__ */ G(
|
|
280
|
-
|
|
282
|
+
lo,
|
|
281
283
|
{
|
|
282
|
-
...
|
|
284
|
+
...Ue,
|
|
283
285
|
$variant: "ghost",
|
|
284
286
|
className: `action ${c.isOpen && !h ? "open" : "closed"}`,
|
|
285
287
|
disabled: h,
|
|
@@ -315,7 +317,7 @@ const ko = ({
|
|
|
315
317
|
}
|
|
316
318
|
),
|
|
317
319
|
c.isOpen && c.collection.size > 0 && !h ? /* @__PURE__ */ r(
|
|
318
|
-
|
|
320
|
+
ye,
|
|
319
321
|
{
|
|
320
322
|
className: "dropdown",
|
|
321
323
|
id: `popover-${l}`,
|
|
@@ -325,22 +327,22 @@ const ko = ({
|
|
|
325
327
|
state: c,
|
|
326
328
|
triggerRef: z,
|
|
327
329
|
children: /* @__PURE__ */ G(
|
|
328
|
-
|
|
330
|
+
ve,
|
|
329
331
|
{
|
|
330
|
-
...
|
|
332
|
+
...ae,
|
|
331
333
|
$hasStatus: E,
|
|
332
334
|
$multiSelection: t && !Array.from(b ?? []).includes("All"),
|
|
333
|
-
$width:
|
|
335
|
+
$width: ce,
|
|
334
336
|
ref: O,
|
|
335
337
|
children: [
|
|
336
338
|
/* @__PURE__ */ r(
|
|
337
339
|
"div",
|
|
338
340
|
{
|
|
339
341
|
style: {
|
|
340
|
-
height: `${
|
|
342
|
+
height: `${ue.getTotalSize()}px`,
|
|
341
343
|
position: "relative"
|
|
342
344
|
},
|
|
343
|
-
children:
|
|
345
|
+
children: ue.getVirtualItems().map((e) => {
|
|
344
346
|
const s = T[e.index];
|
|
345
347
|
if (s.type === "header")
|
|
346
348
|
return /* @__PURE__ */ r(
|
|
@@ -354,7 +356,7 @@ const ko = ({
|
|
|
354
356
|
height: `${e.size}px`,
|
|
355
357
|
transform: `translateY(${e.start}px)`
|
|
356
358
|
},
|
|
357
|
-
children: /* @__PURE__ */ r(
|
|
359
|
+
children: /* @__PURE__ */ r(ao, { children: /* @__PURE__ */ r(
|
|
358
360
|
P,
|
|
359
361
|
{
|
|
360
362
|
color: m.palette.gray[400],
|
|
@@ -366,7 +368,7 @@ const ko = ({
|
|
|
366
368
|
},
|
|
367
369
|
`header-${e.index}`
|
|
368
370
|
);
|
|
369
|
-
const p = I[s.index], u = T[e.index + 1], n = p.key === "All" && u?.type === "header", f = t && s.index ===
|
|
371
|
+
const p = I[s.index], u = T[e.index + 1], n = p.key === "All" && u?.type === "header", f = t && s.index === ie && ie >= 0 && s.index < I.length - 1 && !n;
|
|
370
372
|
return /* @__PURE__ */ r(
|
|
371
373
|
"div",
|
|
372
374
|
{
|
|
@@ -380,10 +382,11 @@ const ko = ({
|
|
|
380
382
|
borderBottom: f ? `1px solid ${m.palette.gray[200]}` : void 0
|
|
381
383
|
},
|
|
382
384
|
children: /* @__PURE__ */ r(
|
|
383
|
-
|
|
385
|
+
no,
|
|
384
386
|
{
|
|
385
|
-
allItemKeys:
|
|
386
|
-
containerRef:
|
|
387
|
+
allItemKeys: We,
|
|
388
|
+
containerRef: se,
|
|
389
|
+
countLabel: _,
|
|
387
390
|
item: p,
|
|
388
391
|
multiSelection: t,
|
|
389
392
|
name: l,
|
|
@@ -391,7 +394,7 @@ const ko = ({
|
|
|
391
394
|
setInputValue: x,
|
|
392
395
|
setValue: w,
|
|
393
396
|
state: c,
|
|
394
|
-
tag:
|
|
397
|
+
tag: Ye.get(String(p.key)),
|
|
395
398
|
watch: S
|
|
396
399
|
}
|
|
397
400
|
)
|
|
@@ -401,13 +404,13 @@ const ko = ({
|
|
|
401
404
|
})
|
|
402
405
|
}
|
|
403
406
|
),
|
|
404
|
-
|
|
407
|
+
he
|
|
405
408
|
]
|
|
406
409
|
}
|
|
407
410
|
)
|
|
408
411
|
}
|
|
409
|
-
) : !
|
|
410
|
-
|
|
412
|
+
) : !de && !E ? null : /* @__PURE__ */ r(
|
|
413
|
+
ye,
|
|
411
414
|
{
|
|
412
415
|
className: "dropdown",
|
|
413
416
|
id: `popover-${l}-empty`,
|
|
@@ -417,25 +420,25 @@ const ko = ({
|
|
|
417
420
|
state: c,
|
|
418
421
|
triggerRef: z,
|
|
419
422
|
children: /* @__PURE__ */ G(
|
|
420
|
-
|
|
423
|
+
ve,
|
|
421
424
|
{
|
|
422
|
-
...
|
|
425
|
+
...ae,
|
|
423
426
|
$hasStatus: E,
|
|
424
427
|
$multiSelection: !1,
|
|
425
|
-
$width:
|
|
428
|
+
$width: ce,
|
|
426
429
|
ref: O,
|
|
427
430
|
children: [
|
|
428
|
-
|
|
431
|
+
de ? /* @__PURE__ */ r(co, { children: /* @__PURE__ */ r(
|
|
429
432
|
P,
|
|
430
433
|
{
|
|
431
434
|
color: m.palette.gray[400],
|
|
432
435
|
size: "md",
|
|
433
436
|
textOverflow: "auto",
|
|
434
437
|
whiteSpace: "wrap",
|
|
435
|
-
children:
|
|
438
|
+
children: ee
|
|
436
439
|
}
|
|
437
440
|
) }) : null,
|
|
438
|
-
|
|
441
|
+
he
|
|
439
442
|
]
|
|
440
443
|
}
|
|
441
444
|
)
|
|
@@ -446,5 +449,5 @@ const ko = ({
|
|
|
446
449
|
);
|
|
447
450
|
};
|
|
448
451
|
export {
|
|
449
|
-
|
|
452
|
+
Mo as ComboBoxField
|
|
450
453
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IComboBoxProps, IItem } from './types';
|
|
2
|
-
declare const ComboBox: ({ control, disabled, disabledKeys, error, helpLink, helpLinkText, helpText, label, loadingItems, name, multiSelection, items, onBlur, onChange, onClear, placeholder, clearable, emptyMessage, required, setValue, statusMessage, tooltip, value, watch, weight, }: Readonly<IComboBoxProps>) => JSX.Element;
|
|
2
|
+
declare const ComboBox: ({ control, disabled, disabledKeys, error, helpLink, helpLinkText, helpText, label, loadingItems, name, multiSelection, items, onBlur, onChange, onClear, placeholder, clearable, countLabel, emptyMessage, required, setValue, statusMessage, tooltip, value, watch, weight, }: Readonly<IComboBoxProps>) => JSX.Element;
|
|
3
3
|
export { ComboBox };
|
|
4
4
|
export type { IComboBoxProps, IItem };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { ComboBoxField as
|
|
4
|
-
const
|
|
2
|
+
import { Controller as w } from "../../../../node_modules/react-hook-form/dist/index.esm.js";
|
|
3
|
+
import { ComboBoxField as X } from "./field/index.js";
|
|
4
|
+
const k = ({
|
|
5
5
|
control: m,
|
|
6
6
|
disabled: x = !1,
|
|
7
7
|
disabledKeys: j,
|
|
8
|
-
error:
|
|
8
|
+
error: Y,
|
|
9
9
|
helpLink: B,
|
|
10
10
|
helpLinkText: C,
|
|
11
11
|
helpText: F,
|
|
@@ -19,28 +19,30 @@ const S = ({
|
|
|
19
19
|
onClear: J,
|
|
20
20
|
placeholder: N,
|
|
21
21
|
clearable: O = !1,
|
|
22
|
-
|
|
22
|
+
countLabel: P,
|
|
23
|
+
emptyMessage: Q,
|
|
23
24
|
required: o,
|
|
24
|
-
setValue:
|
|
25
|
-
statusMessage:
|
|
26
|
-
tooltip:
|
|
27
|
-
value:
|
|
28
|
-
watch:
|
|
29
|
-
weight:
|
|
25
|
+
setValue: Z,
|
|
26
|
+
statusMessage: R,
|
|
27
|
+
tooltip: U,
|
|
28
|
+
value: V,
|
|
29
|
+
watch: _,
|
|
30
|
+
weight: W
|
|
30
31
|
}) => m ? /* @__PURE__ */ f(
|
|
31
|
-
|
|
32
|
+
w,
|
|
32
33
|
{
|
|
33
34
|
control: m,
|
|
34
35
|
name: r,
|
|
35
|
-
render: ({ field:
|
|
36
|
-
|
|
36
|
+
render: ({ field: $, fieldState: v }) => /* @__PURE__ */ f(
|
|
37
|
+
X,
|
|
37
38
|
{
|
|
38
39
|
clearable: O,
|
|
40
|
+
countLabel: P,
|
|
39
41
|
disabled: x,
|
|
40
42
|
disabledKeys: j,
|
|
41
|
-
emptyMessage:
|
|
42
|
-
error:
|
|
43
|
-
field:
|
|
43
|
+
emptyMessage: Q,
|
|
44
|
+
error: v.error?.message,
|
|
45
|
+
field: $,
|
|
44
46
|
helpLink: B,
|
|
45
47
|
helpLinkText: C,
|
|
46
48
|
helpText: F,
|
|
@@ -54,24 +56,25 @@ const S = ({
|
|
|
54
56
|
onClear: J,
|
|
55
57
|
placeholder: N,
|
|
56
58
|
required: o,
|
|
57
|
-
setValue:
|
|
58
|
-
statusMessage:
|
|
59
|
-
tooltip:
|
|
60
|
-
value:
|
|
61
|
-
watch:
|
|
62
|
-
weight:
|
|
59
|
+
setValue: Z,
|
|
60
|
+
statusMessage: R,
|
|
61
|
+
tooltip: U,
|
|
62
|
+
value: V,
|
|
63
|
+
watch: _,
|
|
64
|
+
weight: W
|
|
63
65
|
}
|
|
64
66
|
),
|
|
65
67
|
rules: { required: o }
|
|
66
68
|
}
|
|
67
69
|
) : /* @__PURE__ */ f(
|
|
68
|
-
|
|
70
|
+
X,
|
|
69
71
|
{
|
|
70
72
|
clearable: O,
|
|
73
|
+
countLabel: P,
|
|
71
74
|
disabled: x,
|
|
72
75
|
disabledKeys: j,
|
|
73
|
-
emptyMessage:
|
|
74
|
-
error:
|
|
76
|
+
emptyMessage: Q,
|
|
77
|
+
error: Y,
|
|
75
78
|
helpLink: B,
|
|
76
79
|
helpLinkText: C,
|
|
77
80
|
helpText: F,
|
|
@@ -85,12 +88,12 @@ const S = ({
|
|
|
85
88
|
onClear: J,
|
|
86
89
|
placeholder: N,
|
|
87
90
|
required: o,
|
|
88
|
-
statusMessage:
|
|
89
|
-
tooltip:
|
|
90
|
-
value:
|
|
91
|
-
weight:
|
|
91
|
+
statusMessage: R,
|
|
92
|
+
tooltip: U,
|
|
93
|
+
value: V,
|
|
94
|
+
weight: W
|
|
92
95
|
}
|
|
93
96
|
);
|
|
94
97
|
export {
|
|
95
|
-
|
|
98
|
+
k as ComboBox
|
|
96
99
|
};
|
|
@@ -7,6 +7,9 @@ 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
|
+
declare const narrowMultiSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
11
|
+
declare const countLabelMultiSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
12
|
+
declare const whiteOptionsMultiSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
10
13
|
declare const preselectedMultiSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
11
|
-
export { Default, multiSelectWithAll, withEmptyMessage, withStatusMessage, withClearButton, groupedMultiSelect, preselectedMultiSelect, };
|
|
14
|
+
export { countLabelMultiSelect, Default, multiSelectWithAll, withEmptyMessage, withStatusMessage, withClearButton, groupedMultiSelect, narrowMultiSelect, preselectedMultiSelect, whiteOptionsMultiSelect, };
|
|
12
15
|
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, tag, watch, }: Readonly<IOptionProps<T>>) => JSX.Element;
|
|
2
|
+
declare const Option: <T extends object>({ allItemKeys, containerRef, countLabel, item, multiSelection, name, popoverRef, setInputValue, setValue, state, tag, watch, }: Readonly<IOptionProps<T>>) => JSX.Element;
|
|
3
3
|
export { Option };
|
|
@@ -1,126 +1,137 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useOption as
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { StyledOption as
|
|
6
|
-
import { describeSelection as
|
|
7
|
-
import { Checkbox as
|
|
8
|
-
import { Icon as
|
|
9
|
-
import { Link as
|
|
10
|
-
import { Tag as
|
|
1
|
+
import { jsx as l, jsxs as H } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as J, useMemo as k, useCallback as f } from "react";
|
|
3
|
+
import { useOption as Q } from "../../../../../node_modules/react-aria/dist/private/listbox/useOption.js";
|
|
4
|
+
import { useTheme as W } from "styled-components";
|
|
5
|
+
import { StyledOption as X } from "../styles.js";
|
|
6
|
+
import { describeSelection as Y, toSelection as u } from "../utils.js";
|
|
7
|
+
import { Checkbox as D } from "../../../../checkbox/index.js";
|
|
8
|
+
import { Icon as Z } from "../../../../icon/index.js";
|
|
9
|
+
import { Link as _ } from "../../../../link/index.js";
|
|
10
|
+
import { Tag as I } 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
|
|
13
|
+
import { Text as V } from "../../../../typography/text/index.js";
|
|
14
|
+
import { useClickOutside as oo } from "../../../../../hooks/use-click-outside.js";
|
|
15
|
+
import { openUrl as eo } from "../../../../../utils/open-url.js";
|
|
16
|
+
const yo = ({
|
|
17
17
|
allItemKeys: a,
|
|
18
|
-
containerRef:
|
|
18
|
+
containerRef: w,
|
|
19
|
+
countLabel: $,
|
|
19
20
|
item: o,
|
|
20
21
|
multiSelection: s,
|
|
21
22
|
name: e,
|
|
22
|
-
popoverRef:
|
|
23
|
-
setInputValue:
|
|
23
|
+
popoverRef: z,
|
|
24
|
+
setInputValue: t,
|
|
24
25
|
setValue: n,
|
|
25
26
|
state: c,
|
|
26
|
-
tag:
|
|
27
|
+
tag: y,
|
|
27
28
|
watch: h
|
|
28
29
|
}) => {
|
|
29
|
-
const
|
|
30
|
+
const F = W(), C = J(null), d = o.props.hrefLang, g = c.disabledKeys, A = a.filter(
|
|
30
31
|
(r) => !Array.from(g).includes(r) && r !== "All"
|
|
31
|
-
), { optionProps:
|
|
32
|
+
), { optionProps: q, isSelected: S, isFocused: B, isDisabled: O } = Q(
|
|
32
33
|
{ key: o.key },
|
|
33
34
|
c,
|
|
34
|
-
|
|
35
|
-
), b = k(() => c.collection.getItem("All")?.rendered?.toString(), [c.collection]),
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
C
|
|
36
|
+
), b = k(() => c.collection.getItem("All")?.rendered?.toString(), [c.collection]), K = [
|
|
37
|
+
S ? "selected" : "",
|
|
38
|
+
B ? "focused" : "",
|
|
38
39
|
O ? "disabled" : ""
|
|
39
|
-
].join(" "),
|
|
40
|
+
].join(" "), m = f(
|
|
40
41
|
(r) => {
|
|
41
|
-
const { allSelected:
|
|
42
|
+
const { allSelected: i, text: p } = Y(
|
|
42
43
|
r,
|
|
43
44
|
a,
|
|
44
45
|
g,
|
|
45
|
-
b
|
|
46
|
+
b,
|
|
47
|
+
$
|
|
46
48
|
);
|
|
47
|
-
n?.(`${e}CheckAll`,
|
|
49
|
+
n?.(`${e}CheckAll`, i ? p : ""), t(p);
|
|
48
50
|
},
|
|
49
|
-
[
|
|
50
|
-
|
|
51
|
+
[
|
|
52
|
+
a,
|
|
53
|
+
b,
|
|
54
|
+
$,
|
|
55
|
+
g,
|
|
56
|
+
e,
|
|
57
|
+
t,
|
|
58
|
+
n
|
|
59
|
+
]
|
|
60
|
+
), M = f(
|
|
51
61
|
(r) => {
|
|
52
62
|
if (r.target.checked) {
|
|
53
|
-
const
|
|
54
|
-
n?.(`${e}Options`,
|
|
63
|
+
const i = [...A].sort();
|
|
64
|
+
n?.(`${e}Options`, i), n?.(`${e}CheckAll`, r.target.value), t(r.target.value);
|
|
55
65
|
} else
|
|
56
|
-
n?.(`${e}Options`, []), n?.(`${e}CheckAll`, ""),
|
|
66
|
+
n?.(`${e}Options`, []), n?.(`${e}CheckAll`, ""), t("");
|
|
57
67
|
},
|
|
58
|
-
[
|
|
59
|
-
),
|
|
68
|
+
[A, e, t, n]
|
|
69
|
+
), N = f(
|
|
60
70
|
(r) => {
|
|
61
|
-
const
|
|
62
|
-
n?.(`${e}Options`,
|
|
71
|
+
const i = r.target.value, p = u(h?.(`${e}Options`)), j = r.target.checked ? [...p, i] : p.filter((G) => G !== i);
|
|
72
|
+
n?.(`${e}Options`, j), m(j);
|
|
63
73
|
},
|
|
64
|
-
[e, n, h,
|
|
65
|
-
),
|
|
66
|
-
() =>
|
|
67
|
-
[
|
|
68
|
-
),
|
|
69
|
-
() =>
|
|
70
|
-
[
|
|
71
|
-
),
|
|
72
|
-
|
|
74
|
+
[e, n, h, m]
|
|
75
|
+
), v = h?.(`${e}Options`), x = k(
|
|
76
|
+
() => u(v),
|
|
77
|
+
[v]
|
|
78
|
+
), P = k(
|
|
79
|
+
() => x.includes(o.key.toString()),
|
|
80
|
+
[x, o.key]
|
|
81
|
+
), L = h?.(`${e}CheckAll`), R = k(() => !!L, [L]), U = o.key === "All" ? /* @__PURE__ */ l(
|
|
82
|
+
D,
|
|
73
83
|
{
|
|
74
|
-
checked:
|
|
84
|
+
checked: R,
|
|
75
85
|
label: o.rendered?.toString(),
|
|
76
86
|
name: `${e}CheckAll`,
|
|
77
|
-
onChange:
|
|
87
|
+
onChange: M,
|
|
78
88
|
value: o.rendered?.toString()
|
|
79
89
|
}
|
|
80
90
|
) : /* @__PURE__ */ l(
|
|
81
|
-
|
|
91
|
+
D,
|
|
82
92
|
{
|
|
83
|
-
checked:
|
|
93
|
+
checked: P,
|
|
84
94
|
label: o.rendered?.toString(),
|
|
85
95
|
name: `${e}Options`,
|
|
86
|
-
onChange:
|
|
96
|
+
onChange: N,
|
|
87
97
|
value: o.key.toString()
|
|
88
98
|
}
|
|
89
|
-
),
|
|
90
|
-
|
|
99
|
+
), T = s && !O ? U : /* @__PURE__ */ l(
|
|
100
|
+
V,
|
|
91
101
|
{
|
|
92
|
-
color:
|
|
102
|
+
color: F.palette.gray[800],
|
|
93
103
|
size: "md",
|
|
94
104
|
textOverflow: "ellipsis",
|
|
95
105
|
whiteSpace: "nowrap",
|
|
96
106
|
children: o.rendered
|
|
97
107
|
}
|
|
98
|
-
),
|
|
108
|
+
), E = f(
|
|
99
109
|
(r) => {
|
|
100
|
-
r.preventDefault(),
|
|
110
|
+
r.preventDefault(), t(o.rendered?.toString() ?? ""), c.setSelectedKey(o.key), requestAnimationFrame(() => {
|
|
101
111
|
c.setOpen(!1);
|
|
102
|
-
}),
|
|
112
|
+
}), eo(d);
|
|
103
113
|
},
|
|
104
|
-
[d, o.key, o.rendered, c,
|
|
114
|
+
[d, o.key, o.rendered, c, t]
|
|
105
115
|
);
|
|
106
|
-
return
|
|
116
|
+
return oo(z, () => {
|
|
107
117
|
s && c.close();
|
|
108
|
-
}, [
|
|
109
|
-
|
|
118
|
+
}, [w]), /* @__PURE__ */ H(
|
|
119
|
+
X,
|
|
110
120
|
{
|
|
111
|
-
...!s && !d ?
|
|
121
|
+
...!s && !d ? q : {},
|
|
112
122
|
$multiSelection: s,
|
|
113
|
-
className:
|
|
123
|
+
className: K,
|
|
114
124
|
"data-testid": `${e}-option-${o.key}`,
|
|
115
|
-
ref:
|
|
125
|
+
ref: C,
|
|
126
|
+
title: o.textValue,
|
|
116
127
|
children: [
|
|
117
|
-
d ? /* @__PURE__ */ l(
|
|
118
|
-
|
|
119
|
-
|
|
128
|
+
d ? /* @__PURE__ */ l(_, { href: d, onClick: E, children: T }) : T,
|
|
129
|
+
S && !O && !s ? /* @__PURE__ */ l(Z, { icon: "check", iconSize: "sm", iconType: "fa-light" }) : void 0,
|
|
130
|
+
y === void 0 ? void 0 : /* @__PURE__ */ l(I, { tagLabel: y, variant: "inactive" })
|
|
120
131
|
]
|
|
121
132
|
}
|
|
122
133
|
);
|
|
123
134
|
};
|
|
124
135
|
export {
|
|
125
|
-
|
|
136
|
+
yo as Option
|
|
126
137
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styled as o } from "styled-components";
|
|
2
|
-
import { StyledIconButton as
|
|
2
|
+
import { StyledIconButton as l } from "../../../icon-button/styles.js";
|
|
3
3
|
const t = o.ul`
|
|
4
4
|
${({ theme: a, $hasStatus: n, $multiSelection: p, $width: i }) => `
|
|
5
5
|
align-self: center;
|
|
@@ -23,6 +23,7 @@ const t = o.ul`
|
|
|
23
23
|
`, d = o.li`
|
|
24
24
|
${({ theme: a, $multiSelection: n }) => `
|
|
25
25
|
align-items: center;
|
|
26
|
+
background: ${a.palette.white};
|
|
26
27
|
color: ${a.palette.gray[800]};
|
|
27
28
|
cursor: pointer;
|
|
28
29
|
display: flex;
|
|
@@ -42,6 +43,12 @@ const t = o.ul`
|
|
|
42
43
|
width: 100%;
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
label {
|
|
47
|
+
display: block;
|
|
48
|
+
text-overflow: ellipsis;
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
}
|
|
51
|
+
|
|
45
52
|
span {
|
|
46
53
|
color: ${a.palette.gray[700]};
|
|
47
54
|
}
|
|
@@ -51,7 +58,7 @@ const t = o.ul`
|
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
&.selected {
|
|
54
|
-
background: ${n ?
|
|
61
|
+
background: ${n ? a.palette.white : a.palette.gray[200]};
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
&.disabled {
|
|
@@ -74,7 +81,7 @@ const t = o.ul`
|
|
|
74
81
|
padding: ${a.spacing[0.25]} ${a.spacing[1]};
|
|
75
82
|
size: 28;
|
|
76
83
|
`}
|
|
77
|
-
`, g = o(
|
|
84
|
+
`, g = o(l)`
|
|
78
85
|
${({ disabled: a, theme: n }) => `
|
|
79
86
|
position: relative;
|
|
80
87
|
|
|
@@ -23,6 +23,7 @@ interface IItem {
|
|
|
23
23
|
* Props for the option component.
|
|
24
24
|
* @interface IOptionProps
|
|
25
25
|
* @property { MutableRefObject } containerRef - The ref of the ComboBox container.
|
|
26
|
+
* @property { string } [countLabel] - Plural noun of the selection summary.
|
|
26
27
|
* @property { IItem } item - The item to be rendered as an option.
|
|
27
28
|
* @property { boolean } multiSelection - Enable to select more than one option.
|
|
28
29
|
* @property { string } name - The name of the Select.
|
|
@@ -33,6 +34,7 @@ interface IItem {
|
|
|
33
34
|
interface IOptionProps<T> {
|
|
34
35
|
allItemKeys: string[];
|
|
35
36
|
containerRef: MutableRefObject<HTMLDivElement | null>;
|
|
37
|
+
countLabel?: string;
|
|
36
38
|
item: Node<IItem>;
|
|
37
39
|
multiSelection: boolean;
|
|
38
40
|
name: string;
|
|
@@ -59,6 +61,8 @@ interface IOptionProps<T> {
|
|
|
59
61
|
* next to the items it describes.
|
|
60
62
|
* @property { boolean } [clearable] - Whether the clear button is shown.
|
|
61
63
|
* @property {Function} [onClear] - Called when the clear button is clicked.
|
|
64
|
+
* @property { string } [countLabel] - Plural noun that summarizes two or
|
|
65
|
+
* more selected options as "N countLabel".
|
|
62
66
|
*/
|
|
63
67
|
interface IComboBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "onBlur">, Partial<Omit<IOutlineContainerProps, "maxLength" | "value">> {
|
|
64
68
|
control?: Control<any>;
|
|
@@ -76,6 +80,7 @@ interface IComboBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "on
|
|
|
76
80
|
emptyMessage?: string;
|
|
77
81
|
statusMessage?: string;
|
|
78
82
|
clearable?: boolean;
|
|
83
|
+
countLabel?: string;
|
|
79
84
|
setValue?: UseFormSetValue<any>;
|
|
80
85
|
watch?: UseFormWatch<any>;
|
|
81
86
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Key } from 'react-aria';
|
|
2
2
|
declare const toSelection: (options: unknown) => string[];
|
|
3
|
-
declare const describeSelection: (selected: readonly string[], keys: readonly string[], disabledKeys: Iterable<Key>, allName: string | undefined) => {
|
|
3
|
+
declare const describeSelection: (selected: readonly string[], keys: readonly string[], disabledKeys: Iterable<Key>, allName: string | undefined, countLabel?: string) => {
|
|
4
4
|
allSelected: boolean;
|
|
5
5
|
text: string;
|
|
6
6
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
(s) => s !== "All" && !
|
|
5
|
-
),
|
|
6
|
-
if (
|
|
1
|
+
import g from "../../../../_virtual/isEqual.js";
|
|
2
|
+
const u = (t) => Array.isArray(t) ? t : typeof t == "string" && t ? [t] : [], d = (t, a, c, h, o) => {
|
|
3
|
+
const i = new Set(c), l = a.filter(
|
|
4
|
+
(s) => s !== "All" && !i.has(s)
|
|
5
|
+
), n = i.has("All") ? void 0 : h, r = !!n && l.length > 0 && t.length === l.length && g([...l].sort(), [...t].sort());
|
|
6
|
+
if (r && n) return { allSelected: r, text: n };
|
|
7
7
|
const e = [...t].sort();
|
|
8
|
-
return {
|
|
9
|
-
allSelected:
|
|
8
|
+
return o !== void 0 && e.length > 1 ? { allSelected: r, text: `${e.length} ${o}` } : {
|
|
9
|
+
allSelected: r,
|
|
10
10
|
text: e.length <= 2 ? e.join(", ") : `${e.slice(0, 2).join(", ")}, +${e.length - 2} more`
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
d as describeSelection,
|
|
15
|
+
u as toSelection
|
|
16
16
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import { LoadingContainer as c, CircleBg as
|
|
4
|
-
import { Container as
|
|
2
|
+
import { useTheme as p } from "styled-components";
|
|
3
|
+
import { LoadingContainer as c, CircleBg as s, Circle as a } from "./styles.js";
|
|
4
|
+
import { Container as l } from "../container/index.js";
|
|
5
5
|
import "../typography/heading/index.js";
|
|
6
6
|
import "../typography/span/index.js";
|
|
7
|
-
import { Text as
|
|
8
|
-
const
|
|
7
|
+
import { Text as d } from "../typography/text/index.js";
|
|
8
|
+
const y = ({
|
|
9
9
|
color: e = "red",
|
|
10
10
|
label: t,
|
|
11
11
|
size: n
|
|
12
12
|
}) => {
|
|
13
|
-
const i =
|
|
14
|
-
return /* @__PURE__ */ o(
|
|
13
|
+
const i = p(), m = e === "red" || e === "blue" ? i.palette.gray[700] : e === "white" ? i.palette.white : e;
|
|
14
|
+
return /* @__PURE__ */ o(l, { alignItems: "center", display: "flex", children: [
|
|
15
15
|
/* @__PURE__ */ o(c, { $size: n, viewBox: "0 0 100 100", children: [
|
|
16
|
-
/* @__PURE__ */ r(
|
|
17
|
-
/* @__PURE__ */ r(
|
|
16
|
+
/* @__PURE__ */ r(s, { $color: e, cx: "50", cy: "50", r: "45" }),
|
|
17
|
+
/* @__PURE__ */ r(a, { $color: e, cx: "50", cy: "50", r: "45" })
|
|
18
18
|
] }),
|
|
19
|
-
t && /* @__PURE__ */ r(
|
|
19
|
+
t && /* @__PURE__ */ r(d, { color: m, ml: 0.5, size: "md", whiteSpace: "nowrap", children: t })
|
|
20
20
|
] });
|
|
21
21
|
};
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
y as Loading
|
|
24
24
|
};
|
|
@@ -3,5 +3,6 @@ import { ILoadingProps } from '.';
|
|
|
3
3
|
declare const config: Meta;
|
|
4
4
|
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, ILoadingProps>;
|
|
5
5
|
declare const DarkBackground: StoryFn;
|
|
6
|
-
|
|
6
|
+
declare const InConfirmButton: StoryFn;
|
|
7
|
+
export { Default, DarkBackground, InConfirmButton };
|
|
7
8
|
export default config;
|
|
@@ -9,6 +9,9 @@ declare const WithForm: import('storybook/internal/csf').AnnotatedStoryFn<import
|
|
|
9
9
|
id: string;
|
|
10
10
|
}>>;
|
|
11
11
|
declare const WithTabsAndLongForm: StoryFn;
|
|
12
|
+
declare const WithStickyConfirm: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
13
|
+
id: string;
|
|
14
|
+
}>>;
|
|
12
15
|
declare const ScrollableContent: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
13
16
|
id: string;
|
|
14
17
|
}>>;
|
|
@@ -25,4 +28,4 @@ declare const WithTabs: import('storybook/internal/csf').AnnotatedStoryFn<import
|
|
|
25
28
|
id: string;
|
|
26
29
|
}>>;
|
|
27
30
|
export default config;
|
|
28
|
-
export { Default, ImageModal, WithTabs, ScrollableContent, SingleAction, WithoutFooter, WithForm, WithTabsAndLongForm, };
|
|
31
|
+
export { Default, ImageModal, WithTabs, ScrollableContent, SingleAction, WithoutFooter, WithForm, WithStickyConfirm, WithTabsAndLongForm, };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IModalConfirmProps } from '../types';
|
|
2
|
-
declare const ModalConfirm: ({ disabled, id, onCancel, onConfirm, txtCancel, txtConfirm, }: Readonly<IModalConfirmProps>) => JSX.Element;
|
|
2
|
+
declare const ModalConfirm: ({ disabled, id, onCancel, onConfirm, sticky, txtCancel, txtConfirm, }: Readonly<IModalConfirmProps>) => JSX.Element;
|
|
3
3
|
export { ModalConfirm };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as i, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme as u } from "styled-components";
|
|
2
3
|
import { Button as n } from "../../button/index.js";
|
|
3
|
-
import { Container as
|
|
4
|
-
const
|
|
5
|
-
disabled:
|
|
6
|
-
id:
|
|
4
|
+
import { Container as p } from "../../container/index.js";
|
|
5
|
+
const j = ({
|
|
6
|
+
disabled: a,
|
|
7
|
+
id: o = "modal-confirm",
|
|
7
8
|
onCancel: t,
|
|
8
9
|
onConfirm: r = "submit",
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
sticky: c = !1,
|
|
11
|
+
txtCancel: d,
|
|
12
|
+
txtConfirm: l
|
|
11
13
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
c,
|
|
14
|
+
const e = u(), m = r === "submit", s = /* @__PURE__ */ f(
|
|
15
|
+
p,
|
|
15
16
|
{
|
|
16
17
|
display: "flex",
|
|
17
18
|
gap: 0.75,
|
|
@@ -19,34 +20,47 @@ const u = ({
|
|
|
19
20
|
maxWidth: t ? "392px" : "190px",
|
|
20
21
|
mt: 1.5,
|
|
21
22
|
children: [
|
|
22
|
-
t ? /* @__PURE__ */
|
|
23
|
+
t ? /* @__PURE__ */ i(
|
|
23
24
|
n,
|
|
24
25
|
{
|
|
25
|
-
id: `${
|
|
26
|
+
id: `${o}-cancel`,
|
|
26
27
|
justify: "center",
|
|
27
28
|
onClick: t,
|
|
28
29
|
variant: "tertiary",
|
|
29
30
|
width: "100%",
|
|
30
|
-
children:
|
|
31
|
+
children: d ?? "Cancel"
|
|
31
32
|
}
|
|
32
33
|
) : void 0,
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ i(
|
|
34
35
|
n,
|
|
35
36
|
{
|
|
36
|
-
disabled:
|
|
37
|
-
id:
|
|
37
|
+
disabled: a,
|
|
38
|
+
id: o,
|
|
38
39
|
justify: "center",
|
|
39
|
-
onClick:
|
|
40
|
-
type:
|
|
40
|
+
onClick: m ? void 0 : r,
|
|
41
|
+
type: m ? "submit" : "button",
|
|
41
42
|
variant: "primary",
|
|
42
43
|
width: "100%",
|
|
43
|
-
children:
|
|
44
|
+
children: l ?? "Confirm"
|
|
44
45
|
}
|
|
45
46
|
)
|
|
46
47
|
]
|
|
47
48
|
}
|
|
48
49
|
);
|
|
50
|
+
return c ? /* @__PURE__ */ i(
|
|
51
|
+
p,
|
|
52
|
+
{
|
|
53
|
+
bgColor: e.palette.white,
|
|
54
|
+
borderTop: `1px solid ${e.palette.gray[200]}`,
|
|
55
|
+
bottom: "0",
|
|
56
|
+
id: "sticky-footer",
|
|
57
|
+
pb: 1.25,
|
|
58
|
+
position: "sticky",
|
|
59
|
+
px: 1.25,
|
|
60
|
+
children: s
|
|
61
|
+
}
|
|
62
|
+
) : s;
|
|
49
63
|
};
|
|
50
64
|
export {
|
|
51
|
-
|
|
65
|
+
j as ModalConfirm
|
|
52
66
|
};
|
|
@@ -111,6 +111,7 @@ interface IModalProps extends Omit<IModalHeaderProps, "modalRef">, IModalFooterP
|
|
|
111
111
|
* @property { string } [id] - The id of the confirm button.
|
|
112
112
|
* @property { Function } [onCancel] - The function to call when the cancel button is clicked.
|
|
113
113
|
* @property { "submit" | Function } [onConfirm] - The function to call when the confirm button is clicked.
|
|
114
|
+
* @property { boolean } [sticky] - Whether the buttons stay at the bottom while the content scrolls.
|
|
114
115
|
* @property { string } [txtCancel] - The text of the cancel button.
|
|
115
116
|
* @property { React.ReactNode | string } [txtConfirm] - The text of the confirm button.
|
|
116
117
|
*/
|
|
@@ -119,6 +120,7 @@ interface IModalConfirmProps {
|
|
|
119
120
|
id?: string;
|
|
120
121
|
onCancel?: () => void;
|
|
121
122
|
onConfirm?: "submit" | (() => void);
|
|
123
|
+
sticky?: boolean;
|
|
122
124
|
txtCancel?: string;
|
|
123
125
|
txtConfirm?: React.ReactNode | string;
|
|
124
126
|
}
|
package/package.json
CHANGED