@strapi/design-system 1.3.1 → 1.4.0-beta.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.
- package/dist/Accordion/Accordion.cjs +8 -8
- package/dist/Accordion/Accordion.js +6 -7
- package/dist/Alert/Alert.cjs +3 -3
- package/dist/Alert/Alert.js +10 -10
- package/dist/Badge/Badge.cjs +4 -1
- package/dist/Badge/Badge.js +46 -38
- package/dist/BaseCheckbox/BaseCheckbox.cjs +1 -1
- package/dist/BaseCheckbox/BaseCheckbox.js +1 -1
- package/dist/BaseRadio/RadioGroup.cjs +1 -1
- package/dist/BaseRadio/RadioGroup.js +5 -5
- package/dist/Card/CardContent.cjs +1 -1
- package/dist/Card/CardContent.js +3 -3
- package/dist/CarouselInput/CarouselImage.cjs +1 -1
- package/dist/CarouselInput/CarouselImage.js +3 -3
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +27 -26
- package/dist/CarouselInput/CarouselSlide.cjs +1 -1
- package/dist/CarouselInput/CarouselSlide.js +3 -3
- package/dist/Combobox/Combobox.cjs +1 -1
- package/dist/Combobox/Combobox.js +137 -119
- package/dist/Combobox/ComboboxList.cjs +1 -1
- package/dist/Combobox/ComboboxList.js +5 -5
- package/dist/Combobox/components.cjs +2 -2
- package/dist/Combobox/components.js +1 -1
- package/dist/Combobox/utils.cjs +1 -1
- package/dist/Combobox/utils.js +18 -18
- package/dist/DatePicker/DatePicker.cjs +1 -1
- package/dist/DatePicker/DatePicker.js +53 -54
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -1
- package/dist/DatePicker/DatePickerCalendar.js +17 -12
- package/dist/DatePicker/DatePickerTd.cjs +3 -3
- package/dist/DatePicker/DatePickerTd.js +24 -24
- package/dist/DateTimePicker/DateTimePicker.cjs +1 -0
- package/dist/DateTimePicker/DateTimePicker.js +143 -0
- package/dist/DateTimePicker/DateTimePickerProps.cjs +1 -0
- package/dist/DateTimePicker/DateTimePickerProps.js +51 -0
- package/dist/DateTimePicker/__tests__/parseDate.test.cjs +1 -0
- package/dist/DateTimePicker/__tests__/parseDate.test.js +8 -0
- package/dist/DateTimePicker/index.cjs +1 -0
- package/dist/DateTimePicker/index.js +4 -0
- package/dist/DateTimePicker/parseDate.cjs +1 -0
- package/dist/DateTimePicker/parseDate.js +7 -0
- package/dist/Dialog/DialogBody.cjs +2 -2
- package/dist/Dialog/DialogBody.js +14 -11
- package/dist/DismissibleLayer/DismissibleLayer.cjs +1 -1
- package/dist/DismissibleLayer/DismissibleLayer.js +26 -34
- package/dist/Divider/Divider.cjs +1 -1
- package/dist/Divider/Divider.js +3 -3
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +26 -26
- package/dist/Field/FieldError.cjs +1 -1
- package/dist/Field/FieldError.js +4 -4
- package/dist/Field/FieldInput.cjs +1 -1
- package/dist/Field/FieldInput.js +1 -1
- package/dist/Flex/FlexProps.cjs +1 -1
- package/dist/Flex/FlexProps.js +9 -8
- package/dist/FocusTrap/ExampleComponent.cjs +1 -1
- package/dist/FocusTrap/ExampleComponent.js +3 -2
- package/dist/FocusTrap/FocusTrap.cjs +1 -1
- package/dist/FocusTrap/FocusTrap.js +27 -26
- package/dist/Icon/Icon.cjs +1 -1
- package/dist/Icon/Icon.js +3 -3
- package/dist/IconButton/IconButton.cjs +2 -2
- package/dist/IconButton/IconButton.js +13 -14
- package/dist/Link/Link.cjs +3 -3
- package/dist/Link/Link.js +19 -17
- package/dist/LinkButton/LinkButton.cjs +2 -2
- package/dist/LinkButton/LinkButton.js +2 -2
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +134 -136
- package/dist/Popover/Popover.cjs +2 -2
- package/dist/Popover/Popover.js +10 -9
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +91 -76
- package/dist/RawTable/RawTable.cjs +1 -1
- package/dist/RawTable/RawTable.js +24 -23
- package/dist/RawTable/RawTableContext.cjs +1 -1
- package/dist/RawTable/RawTableContext.js +1 -1
- package/dist/RawTable/RawTr.cjs +1 -1
- package/dist/RawTable/RawTr.js +1 -1
- package/dist/Select/Select.cjs +2 -2
- package/dist/Select/Select.js +147 -142
- package/dist/SimpleMenu/SimpleMenu.cjs +7 -7
- package/dist/SimpleMenu/SimpleMenu.js +128 -113
- package/dist/Status/Status.cjs +4 -4
- package/dist/Status/Status.js +1 -1
- package/dist/SubNav/SubNavHeader.cjs +2 -2
- package/dist/SubNav/SubNavHeader.js +21 -21
- package/dist/SubNav/SubNavLink.cjs +4 -4
- package/dist/SubNav/SubNavLink.js +22 -23
- package/dist/SubNav/SubNavLinkSection.cjs +4 -4
- package/dist/SubNav/SubNavLinkSection.js +8 -7
- package/dist/SubNav/SubNavSection.cjs +2 -2
- package/dist/SubNav/SubNavSection.js +11 -10
- package/dist/SubNav/SubNavSectionLabel.cjs +1 -1
- package/dist/SubNav/SubNavSectionLabel.js +1 -1
- package/dist/Table/TFooter.cjs +2 -2
- package/dist/Table/TFooter.js +1 -1
- package/dist/Table/Table.cjs +3 -3
- package/dist/Table/Table.js +20 -17
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +1 -1
- package/dist/Tabs/useTabsFocus.cjs +1 -1
- package/dist/Tabs/useTabsFocus.js +12 -11
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +36 -36
- package/dist/Textarea/Textarea.cjs +2 -2
- package/dist/Textarea/Textarea.js +14 -14
- package/dist/TimePicker/TimePicker.cjs +3 -3
- package/dist/TimePicker/TimePicker.js +47 -42
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +2 -2
- package/dist/Tooltip/hooks/useTooltipLayout.cjs +1 -1
- package/dist/Tooltip/hooks/useTooltipLayout.js +9 -9
- package/dist/helpers/useIntersection.cjs +1 -1
- package/dist/helpers/useIntersection.js +13 -11
- package/dist/helpers/useResizeObserver.cjs +1 -1
- package/dist/helpers/useResizeObserver.js +10 -8
- package/dist/hooks/useControllableState.cjs +1 -0
- package/dist/hooks/useControllableState.js +25 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +289 -286
- package/dist/themes/ColorButton.cjs +2 -2
- package/dist/themes/ColorButton.js +4 -4
- package/dist/themes/extendTheme.cjs +3 -3
- package/dist/themes/extendTheme.js +6 -6
- package/dist/themes/sizes.cjs +1 -1
- package/dist/themes/sizes.js +4 -0
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +6 -6
- package/dist/v2/LinkButton/LinkButton.cjs +1 -1
- package/dist/v2/LinkButton/LinkButton.js +19 -19
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +7 -7
- package/dist/v2/SimpleMenu/SimpleMenu.js +101 -92
- package/dist/v2/SubNav/SubNavHeader.cjs +2 -2
- package/dist/v2/SubNav/SubNavHeader.js +21 -21
- package/dist/v2/SubNav/SubNavLink.cjs +2 -2
- package/dist/v2/SubNav/SubNavLink.js +16 -17
- package/dist/v2/SubNav/SubNavLinkSection.cjs +4 -4
- package/dist/v2/SubNav/SubNavLinkSection.js +8 -8
- package/dist/v2/SubNav/SubNavSection.cjs +2 -2
- package/dist/v2/SubNav/SubNavSection.js +1 -1
- package/dist/v2/SubNav/SubNavSectionLabel.cjs +1 -1
- package/dist/v2/SubNav/SubNavSectionLabel.js +1 -1
- package/package.json +6 -13
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Le = Object.defineProperty, we = Object.defineProperties;
|
|
2
|
+
var $e = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var w = Object.getOwnPropertySymbols;
|
|
4
4
|
var G = Object.prototype.hasOwnProperty, J = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var W = (o, i, a) => i in o ?
|
|
5
|
+
var W = (o, i, a) => i in o ? Le(o, i, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[i] = a, D = (o, i) => {
|
|
6
6
|
for (var a in i || (i = {}))
|
|
7
7
|
G.call(i, a) && W(o, a, i[a]);
|
|
8
8
|
if (w)
|
|
9
9
|
for (var a of w(i))
|
|
10
10
|
J.call(i, a) && W(o, a, i[a]);
|
|
11
11
|
return o;
|
|
12
|
-
}, F = (o, i) =>
|
|
12
|
+
}, F = (o, i) => we(o, $e(i));
|
|
13
13
|
var Q = (o, i) => {
|
|
14
14
|
var a = {};
|
|
15
15
|
for (var p in o)
|
|
@@ -19,16 +19,16 @@ var Q = (o, i) => {
|
|
|
19
19
|
i.indexOf(p) < 0 && J.call(o, p) && (a[p] = o[p]);
|
|
20
20
|
return a;
|
|
21
21
|
};
|
|
22
|
-
import r, { useState as
|
|
22
|
+
import r, { useState as k, useRef as y, useEffect as X, useLayoutEffect as Re, Children as Y, cloneElement as Se } from "react";
|
|
23
23
|
import e from "prop-types";
|
|
24
|
-
import
|
|
25
|
-
import De from "@strapi/icons/
|
|
26
|
-
import Fe from "
|
|
27
|
-
import { filterOptions as Z, maintainScrollVisibility as Te, getActionFromKey as Ae, MenuActions as
|
|
24
|
+
import Be from "@strapi/icons/CarretDown";
|
|
25
|
+
import De from "@strapi/icons/Cross";
|
|
26
|
+
import { useId as Fe } from "../helpers/useId.js";
|
|
27
|
+
import { filterOptions as Z, maintainScrollVisibility as Te, getActionFromKey as Ae, MenuActions as h, getUpdatedIndex as T } from "./utils.js";
|
|
28
28
|
import { Flex as ee } from "../Flex/Flex.js";
|
|
29
|
-
import { IconBox as
|
|
30
|
-
import { Popover as
|
|
31
|
-
import { Box as
|
|
29
|
+
import { IconBox as Pe, CaretBox as Ve } from "../Select/components.js";
|
|
30
|
+
import { Popover as Ke } from "../Popover/Popover.js";
|
|
31
|
+
import { Box as Ne } from "../Box/Box.js";
|
|
32
32
|
import { Typography as te } from "../Typography/Typography.js";
|
|
33
33
|
import { Loader as qe } from "../Loader/Loader.js";
|
|
34
34
|
import { MainRow as He, InputContainer as Ue, ValueContainer as _e, Input as je } from "./components.js";
|
|
@@ -44,30 +44,30 @@ import "../Field/FieldAction.js";
|
|
|
44
44
|
import { Stack as Ye } from "../Stack/Stack.js";
|
|
45
45
|
import { KeyboardKeys as Ze } from "../helpers/keyboardKeys.js";
|
|
46
46
|
import { VisuallyHidden as et } from "../VisuallyHidden/VisuallyHidden.js";
|
|
47
|
-
const
|
|
48
|
-
var
|
|
47
|
+
const O = (tt) => {
|
|
48
|
+
var N = tt, {
|
|
49
49
|
children: o,
|
|
50
50
|
clearLabel: i,
|
|
51
51
|
creatable: a,
|
|
52
52
|
createMessage: p,
|
|
53
|
-
disabled:
|
|
54
|
-
error:
|
|
53
|
+
disabled: u,
|
|
54
|
+
error: $,
|
|
55
55
|
hasMoreItems: re,
|
|
56
56
|
hint: A,
|
|
57
|
-
label:
|
|
57
|
+
label: E,
|
|
58
58
|
labelAction: ne,
|
|
59
|
-
loading:
|
|
59
|
+
loading: R,
|
|
60
60
|
loadingMessage: ae,
|
|
61
61
|
noOptionsMessage: ie,
|
|
62
|
-
onChange:
|
|
63
|
-
onClear:
|
|
62
|
+
onChange: P,
|
|
63
|
+
onClear: V,
|
|
64
64
|
onCreateOption: le,
|
|
65
|
-
onInputChange:
|
|
65
|
+
onInputChange: K,
|
|
66
66
|
onLoadMore: se,
|
|
67
67
|
placeholder: ce,
|
|
68
68
|
required: pe,
|
|
69
69
|
value: m
|
|
70
|
-
} =
|
|
70
|
+
} = N, de = Q(N, [
|
|
71
71
|
"children",
|
|
72
72
|
"clearLabel",
|
|
73
73
|
"creatable",
|
|
@@ -90,78 +90,95 @@ const $ = (tt) => {
|
|
|
90
90
|
"required",
|
|
91
91
|
"value"
|
|
92
92
|
]);
|
|
93
|
-
const
|
|
93
|
+
const fe = () => {
|
|
94
94
|
var t;
|
|
95
95
|
return (t = o.find((n) => {
|
|
96
96
|
var l;
|
|
97
97
|
return ((l = n.props) == null ? void 0 : l.value.toLowerCase()) === m.toLowerCase();
|
|
98
98
|
}).props) == null ? void 0 : t.children;
|
|
99
|
-
}, [c, q] =
|
|
100
|
-
if (!
|
|
99
|
+
}, [c, q] = k(0), [ue, me] = k(null), [f, H] = k(o), [g, be] = k(!1), [s, M] = k(""), x = y(), L = y(!1), I = y(), U = y(), ge = y(), _ = y(!0), d = Fe("combobox"), S = `${d}-label`;
|
|
100
|
+
if (!E && !de["aria-label"])
|
|
101
101
|
throw new Error('The Combobox component needs a "label" or an "aria-label" props');
|
|
102
102
|
X(() => {
|
|
103
103
|
H(Z(o, s));
|
|
104
104
|
}, [s, o]), X(() => {
|
|
105
|
-
|
|
106
|
-
}, [c]),
|
|
107
|
-
|
|
108
|
-
_.current = !1;
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
105
|
+
g && x.current && Te(x.current);
|
|
106
|
+
}, [c, g]), Re(() => {
|
|
107
|
+
_.current && (_.current = !1);
|
|
111
108
|
}, [m]);
|
|
112
|
-
const Ce =
|
|
113
|
-
|
|
109
|
+
const Ce = g ? `${d}-${c}` : "", j = () => {
|
|
110
|
+
P(null), M("");
|
|
114
111
|
}, he = (t) => {
|
|
115
|
-
|
|
112
|
+
K && K(t);
|
|
116
113
|
const n = I.current.value;
|
|
117
|
-
H(Z(o, n)), q(0), me(null), s !== n && M(n),
|
|
114
|
+
H(Z(o, n)), q(0), me(null), s !== n && M(n), g || b(!0, !1);
|
|
118
115
|
}, Ee = (t) => {
|
|
119
|
-
const { key: n } = t, l = a && s ?
|
|
116
|
+
const { key: n } = t, l = a && s ? f.length : f.length - 1, v = Ae(n, g);
|
|
120
117
|
switch (m && !s && n === Ze.BACKSPACE && j(), v) {
|
|
121
|
-
case
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
118
|
+
case h.Next: {
|
|
119
|
+
if (c === l) {
|
|
120
|
+
C(0);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
C(T(c, l, v));
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case h.Previous: {
|
|
127
|
+
if (c === 0) {
|
|
128
|
+
C(l);
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
C(T(c, l, v));
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case h.Last:
|
|
135
|
+
case h.First: {
|
|
136
|
+
if (c === l) {
|
|
137
|
+
C(0);
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
C(T(c, l, v));
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case h.CloseSelect:
|
|
144
|
+
t.preventDefault(), B(c);
|
|
145
|
+
break;
|
|
146
|
+
case h.Close:
|
|
147
|
+
t.preventDefault(), b(!1);
|
|
148
|
+
break;
|
|
149
|
+
case h.Open:
|
|
150
|
+
b(!0);
|
|
151
|
+
break;
|
|
137
152
|
}
|
|
138
153
|
}, xe = (t) => {
|
|
139
154
|
if (t.preventDefault(), m && !L.current && M(""), L.current) {
|
|
140
155
|
L.current = !1;
|
|
141
156
|
return;
|
|
142
157
|
}
|
|
143
|
-
|
|
144
|
-
},
|
|
158
|
+
b(!1, !1);
|
|
159
|
+
}, C = (t) => {
|
|
145
160
|
q(t);
|
|
146
161
|
}, ve = (t) => {
|
|
147
|
-
|
|
162
|
+
C(t), B(t);
|
|
148
163
|
}, z = () => {
|
|
149
164
|
L.current = !0;
|
|
150
|
-
},
|
|
151
|
-
const n =
|
|
152
|
-
if (M(""), n)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
},
|
|
165
|
+
}, B = (t) => {
|
|
166
|
+
const n = f[t];
|
|
167
|
+
if (M(""), n) {
|
|
168
|
+
P(n.props.value), b(!1);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
a && (le(s), b(!1));
|
|
172
|
+
}, b = (t, n = !0) => {
|
|
173
|
+
be(t), n && I.current.focus();
|
|
174
|
+
}, ye = Y.toArray(f).map((t, n) => {
|
|
158
175
|
const l = c === n;
|
|
159
|
-
return
|
|
160
|
-
id: `${
|
|
161
|
-
"aria-selected":
|
|
176
|
+
return Se(t, {
|
|
177
|
+
id: `${d}-${n}`,
|
|
178
|
+
"aria-selected": ue === n,
|
|
162
179
|
"aria-posinset": n + 1,
|
|
163
|
-
"aria-setsize": Y.toArray(
|
|
164
|
-
ref
|
|
180
|
+
"aria-setsize": Y.toArray(f).length,
|
|
181
|
+
ref(v) {
|
|
165
182
|
l && (x.current = v);
|
|
166
183
|
},
|
|
167
184
|
onClick: () => ve(n),
|
|
@@ -169,55 +186,55 @@ const $ = (tt) => {
|
|
|
169
186
|
isSelected: l
|
|
170
187
|
});
|
|
171
188
|
}), Ie = () => {
|
|
172
|
-
I.current.focus(),
|
|
189
|
+
I.current.focus(), V && V(), j();
|
|
190
|
+
}, ke = () => {
|
|
191
|
+
I.current.focus(), b(!0);
|
|
173
192
|
}, Oe = () => {
|
|
174
|
-
|
|
175
|
-
}, Me = () => {
|
|
176
|
-
const t = d.findIndex((n) => {
|
|
193
|
+
const t = f.findIndex((n) => {
|
|
177
194
|
var l;
|
|
178
195
|
return ((l = n.props) == null ? void 0 : l.children) === s;
|
|
179
196
|
});
|
|
180
197
|
return s && t === -1;
|
|
181
|
-
},
|
|
182
|
-
t.preventDefault(),
|
|
198
|
+
}, Me = (t) => {
|
|
199
|
+
t.preventDefault(), b(t, !0);
|
|
183
200
|
};
|
|
184
201
|
return /* @__PURE__ */ r.createElement(Ge, {
|
|
185
202
|
hint: A,
|
|
186
|
-
error:
|
|
187
|
-
id:
|
|
203
|
+
error: $,
|
|
204
|
+
id: d
|
|
188
205
|
}, /* @__PURE__ */ r.createElement(et, {
|
|
189
206
|
"aria-live": "polite",
|
|
190
207
|
"aria-atomic": "false",
|
|
191
208
|
"aria-relevant": "additions text"
|
|
192
209
|
}, m), /* @__PURE__ */ r.createElement(Ye, {
|
|
193
|
-
spacing:
|
|
194
|
-
},
|
|
210
|
+
spacing: E || A || $ ? 1 : 0
|
|
211
|
+
}, E && /* @__PURE__ */ r.createElement(Je, {
|
|
195
212
|
action: ne,
|
|
196
213
|
required: pe,
|
|
197
|
-
id:
|
|
198
|
-
},
|
|
214
|
+
id: S
|
|
215
|
+
}, E), /* @__PURE__ */ r.createElement(He, {
|
|
199
216
|
ref: U,
|
|
200
|
-
$disabled:
|
|
201
|
-
hasError:
|
|
217
|
+
$disabled: u,
|
|
218
|
+
hasError: $
|
|
202
219
|
}, /* @__PURE__ */ r.createElement(Ue, {
|
|
203
220
|
wrap: "wrap"
|
|
204
221
|
}, !s && m && /* @__PURE__ */ r.createElement(_e, {
|
|
205
|
-
id: `${
|
|
206
|
-
}, /* @__PURE__ */ r.createElement(te, null,
|
|
222
|
+
id: `${d}-selected-value`
|
|
223
|
+
}, /* @__PURE__ */ r.createElement(te, null, fe())), /* @__PURE__ */ r.createElement(je, {
|
|
207
224
|
"aria-activedescendant": Ce,
|
|
208
225
|
"aria-autocomplete": "list",
|
|
209
|
-
"aria-controls": `${
|
|
210
|
-
"aria-disabled":
|
|
211
|
-
"aria-expanded":
|
|
226
|
+
"aria-controls": `${d}-listbox`,
|
|
227
|
+
"aria-disabled": u,
|
|
228
|
+
"aria-expanded": g,
|
|
212
229
|
"aria-haspopup": "listbox",
|
|
213
|
-
"aria-labelledby":
|
|
214
|
-
id:
|
|
215
|
-
onBlur:
|
|
216
|
-
onClick:
|
|
217
|
-
onInput:
|
|
218
|
-
onKeyDown:
|
|
230
|
+
"aria-labelledby": E ? S : void 0,
|
|
231
|
+
id: d,
|
|
232
|
+
onBlur: u ? void 0 : xe,
|
|
233
|
+
onClick: u ? void 0 : Me,
|
|
234
|
+
onInput: u ? void 0 : he,
|
|
235
|
+
onKeyDown: u ? void 0 : Ee,
|
|
219
236
|
placeholder: m ? "" : ce,
|
|
220
|
-
readOnly:
|
|
237
|
+
readOnly: u,
|
|
221
238
|
ref: I,
|
|
222
239
|
role: "combobox",
|
|
223
240
|
autoComplete: "off",
|
|
@@ -225,46 +242,46 @@ const $ = (tt) => {
|
|
|
225
242
|
spellCheck: "off",
|
|
226
243
|
type: "text",
|
|
227
244
|
value: s
|
|
228
|
-
})), /* @__PURE__ */ r.createElement(ee, null, (m || s) && /* @__PURE__ */ r.createElement(
|
|
229
|
-
id: `${
|
|
245
|
+
})), /* @__PURE__ */ r.createElement(ee, null, (m || s) && /* @__PURE__ */ r.createElement(Pe, {
|
|
246
|
+
id: `${d}-clear`,
|
|
230
247
|
"aria-label": i,
|
|
231
|
-
disabled:
|
|
248
|
+
disabled: u,
|
|
232
249
|
paddingLeft: 3,
|
|
233
250
|
as: "button",
|
|
234
251
|
onClick: Ie,
|
|
235
252
|
type: "button"
|
|
236
|
-
}, /* @__PURE__ */ r.createElement(
|
|
237
|
-
disabled:
|
|
253
|
+
}, /* @__PURE__ */ r.createElement(De, null)), /* @__PURE__ */ r.createElement(Ve, {
|
|
254
|
+
disabled: u,
|
|
238
255
|
paddingLeft: 3,
|
|
239
256
|
"aria-hidden": !0,
|
|
240
257
|
as: "button",
|
|
241
|
-
onClick:
|
|
258
|
+
onClick: ke,
|
|
242
259
|
tabIndex: -1,
|
|
243
260
|
type: "button"
|
|
244
|
-
}, /* @__PURE__ */ r.createElement(
|
|
245
|
-
id: `${
|
|
261
|
+
}, /* @__PURE__ */ r.createElement(Be, null)))), /* @__PURE__ */ r.createElement(Qe, null), /* @__PURE__ */ r.createElement(Xe, null)), g && /* @__PURE__ */ r.createElement(Ke, {
|
|
262
|
+
id: `${d}-popover`,
|
|
246
263
|
source: U,
|
|
247
264
|
spacing: 4,
|
|
248
265
|
fullWidth: !0,
|
|
249
|
-
intersectionId: `${
|
|
250
|
-
onReachEnd: re && !
|
|
266
|
+
intersectionId: `${d}-listbox-popover-intersection`,
|
|
267
|
+
onReachEnd: re && !R ? se : void 0
|
|
251
268
|
}, /* @__PURE__ */ r.createElement("div", {
|
|
252
269
|
role: "listbox",
|
|
253
|
-
ref:
|
|
254
|
-
id: `${
|
|
255
|
-
"aria-labelledby":
|
|
256
|
-
}, (Boolean(
|
|
270
|
+
ref: ge,
|
|
271
|
+
id: `${d}-listbox`,
|
|
272
|
+
"aria-labelledby": E ? S : void 0
|
|
273
|
+
}, (Boolean(f.length) || a) && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(We, {
|
|
257
274
|
activeOptionRef: x,
|
|
258
275
|
options: ye
|
|
259
|
-
}),
|
|
260
|
-
isSelected: c ===
|
|
276
|
+
}), Oe() && a && /* @__PURE__ */ r.createElement(ze, {
|
|
277
|
+
isSelected: c === f.length,
|
|
261
278
|
ref: (t) => {
|
|
262
|
-
c ===
|
|
279
|
+
c === f.length && (x.current = t);
|
|
263
280
|
},
|
|
264
281
|
onMouseDown: z,
|
|
265
|
-
onClick: () =>
|
|
282
|
+
onClick: () => B(),
|
|
266
283
|
taindex: 0
|
|
267
|
-
}, p(s))), !
|
|
284
|
+
}, p(s))), !f.length && !a && !R && /* @__PURE__ */ r.createElement(Ne, {
|
|
268
285
|
paddingLeft: 4,
|
|
269
286
|
paddingRight: 4,
|
|
270
287
|
paddingTop: 2,
|
|
@@ -272,7 +289,7 @@ const $ = (tt) => {
|
|
|
272
289
|
ref: x
|
|
273
290
|
}, /* @__PURE__ */ r.createElement(te, {
|
|
274
291
|
textColor: "neutral800"
|
|
275
|
-
}, ie(s))),
|
|
292
|
+
}, ie(s))), R && /* @__PURE__ */ r.createElement(ee, {
|
|
276
293
|
justifyContent: "center",
|
|
277
294
|
alignItems: "center",
|
|
278
295
|
paddingTop: 2,
|
|
@@ -280,10 +297,10 @@ const $ = (tt) => {
|
|
|
280
297
|
}, /* @__PURE__ */ r.createElement(qe, {
|
|
281
298
|
small: !0
|
|
282
299
|
}, ae)))));
|
|
283
|
-
}, oe = (o) => /* @__PURE__ */ r.createElement(
|
|
300
|
+
}, oe = (o) => /* @__PURE__ */ r.createElement(O, F(D({}, o), {
|
|
284
301
|
creatable: !0
|
|
285
302
|
}));
|
|
286
|
-
|
|
303
|
+
O.defaultProps = {
|
|
287
304
|
"aria-label": void 0,
|
|
288
305
|
clearLabel: "clear",
|
|
289
306
|
creatable: !1,
|
|
@@ -303,7 +320,8 @@ $.defaultProps = oe.defaultProps = {
|
|
|
303
320
|
placeholder: "Select or enter a value",
|
|
304
321
|
value: void 0
|
|
305
322
|
};
|
|
306
|
-
|
|
323
|
+
oe.defaultProps = O.defaultProps;
|
|
324
|
+
O.propTypes = {
|
|
307
325
|
"aria-label": e.string,
|
|
308
326
|
children: e.oneOfType([e.arrayOf(e.node), e.node]),
|
|
309
327
|
clearLabel: e.string,
|
|
@@ -326,10 +344,10 @@ $.propTypes = {
|
|
|
326
344
|
placeholder: e.string,
|
|
327
345
|
value: e.string
|
|
328
346
|
};
|
|
329
|
-
oe.propTypes = F(D({},
|
|
347
|
+
oe.propTypes = F(D({}, O.propTypes), {
|
|
330
348
|
onCreateOption: e.func.isRequired
|
|
331
349
|
});
|
|
332
350
|
export {
|
|
333
|
-
|
|
351
|
+
O as Combobox,
|
|
334
352
|
oe as CreatableCombobox
|
|
335
353
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),s=require("prop-types"),i=require("./utils.cjs"),u=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},c=u(s),o=({options:e,activeOptionRef:t})=>(r.useEffect(()=>{t.current&&i.maintainScrollVisibility(t.current)},[t]),e);o.defaultProps={activeOptionRef:void 0};o.propTypes={options:c.default.array.isRequired};exports.ComboboxList=o;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useEffect as t } from "react";
|
|
2
|
-
import
|
|
3
|
-
import { maintainScrollVisibility as
|
|
2
|
+
import p from "prop-types";
|
|
3
|
+
import { maintainScrollVisibility as e } from "./utils.js";
|
|
4
4
|
const o = ({ options: i, activeOptionRef: r }) => (t(() => {
|
|
5
|
-
r.current &&
|
|
6
|
-
}, []), i);
|
|
5
|
+
r.current && e(r.current);
|
|
6
|
+
}, [r]), i);
|
|
7
7
|
o.defaultProps = {
|
|
8
8
|
activeOptionRef: void 0
|
|
9
9
|
};
|
|
10
10
|
o.propTypes = {
|
|
11
|
-
options:
|
|
11
|
+
options: p.array.isRequired
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
14
14
|
o as ComboboxList
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../Box/Box.cjs"),n=require("../Flex/Flex.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("styled-components"),i=require("../Box/Box.cjs"),n=require("../Flex/Flex.cjs"),l=require("../themes/utils.cjs"),a=o=>o&&typeof o=="object"&&"default"in o?o:{default:o},t=a(r),s=t.default(n.Flex)`
|
|
2
2
|
position: relative;
|
|
3
3
|
border: 1px solid ${({theme:o,hasError:e})=>e?o.colors.danger600:o.colors.neutral200};
|
|
4
4
|
padding-right: ${({theme:o})=>o.spaces[3]};
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
color: inherit;
|
|
41
41
|
cursor: not-allowed;
|
|
42
42
|
}
|
|
43
|
-
`,p=t.default(
|
|
43
|
+
`,p=t.default(i.Box)`
|
|
44
44
|
width: 100%;
|
|
45
45
|
border: none;
|
|
46
46
|
text-align: left;
|
package/dist/Combobox/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("compute-scroll-into-view"),r=require("../helpers/keyboardKeys.cjs"),l=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},c=l(a),t={Close:"Close",CloseSelect:"CloseSelect",First:"First",Last:"Last",Next:"Next",Open:"Open",PageDown:"PageDown",PageUp:"PageUp",Previous:"Previous",Select:"Select",Space:"Space",Type:"Type"},u={Close:"Close",First:"First",Last:"Last",Next:"Next",Open:"Open",Previous:"Previous",Select:"Select",UpLevel:"UpLevel"};function d(e=[],o=null,s=[]){const n=String(o!=null?o:"").toLowerCase();return n?e.filter(i=>i.props.children.toString().toLowerCase().includes(n)&&s.indexOf(i)<0):e}function p(e,o){if(!o&&e===r.KeyboardKeys.DOWN)return t.Open;if(e===r.KeyboardKeys.DOWN)return t.Next;if(e===r.KeyboardKeys.UP)return t.Previous;if(e===r.KeyboardKeys.HOME)return t.First;if(e===r.KeyboardKeys.END)return t.Last;if(e===r.KeyboardKeys.ESCAPE)return t.Close;if(e===r.KeyboardKeys.ENTER)return t.CloseSelect;if(e===r.KeyboardKeys.BACKSPACE||e===r.KeyboardKeys.CLEAR||e.length===1)return t.Type}function f(e,o,s){switch(s){case t.First:return 0;case t.Last:return o;case t.Previous:return Math.max(0,e-1);case t.Next:return Math.min(o,e+1);default:return e}}function y(e){c.default(e,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}).forEach(({el:s,top:n,left:i})=>{s.scrollTop=n,s.scrollLeft=i})}exports.MenuActions=t;exports.TreeActions=u;exports.filterOptions=d;exports.getActionFromKey=p;exports.getUpdatedIndex=f;exports.maintainScrollVisibility=y;
|
package/dist/Combobox/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { KeyboardKeys as
|
|
1
|
+
import c from "compute-scroll-into-view";
|
|
2
|
+
import { KeyboardKeys as n } from "../helpers/keyboardKeys.js";
|
|
3
3
|
const t = {
|
|
4
4
|
Close: "Close",
|
|
5
5
|
CloseSelect: "CloseSelect",
|
|
@@ -23,30 +23,30 @@ const t = {
|
|
|
23
23
|
Select: "Select",
|
|
24
24
|
UpLevel: "UpLevel"
|
|
25
25
|
};
|
|
26
|
-
function d(e = [], r,
|
|
27
|
-
const
|
|
28
|
-
return
|
|
26
|
+
function d(e = [], r = null, o = []) {
|
|
27
|
+
const s = String(r != null ? r : "").toLowerCase();
|
|
28
|
+
return s ? e.filter((i) => i.props.children.toString().toLowerCase().includes(s) && o.indexOf(i) < 0) : e;
|
|
29
29
|
}
|
|
30
30
|
function C(e, r) {
|
|
31
|
-
if (!r && e ===
|
|
31
|
+
if (!r && e === n.DOWN)
|
|
32
32
|
return t.Open;
|
|
33
|
-
if (e ===
|
|
33
|
+
if (e === n.DOWN)
|
|
34
34
|
return t.Next;
|
|
35
|
-
if (e ===
|
|
35
|
+
if (e === n.UP)
|
|
36
36
|
return t.Previous;
|
|
37
|
-
if (e ===
|
|
37
|
+
if (e === n.HOME)
|
|
38
38
|
return t.First;
|
|
39
|
-
if (e ===
|
|
39
|
+
if (e === n.END)
|
|
40
40
|
return t.Last;
|
|
41
|
-
if (e ===
|
|
41
|
+
if (e === n.ESCAPE)
|
|
42
42
|
return t.Close;
|
|
43
|
-
if (e ===
|
|
43
|
+
if (e === n.ENTER)
|
|
44
44
|
return t.CloseSelect;
|
|
45
|
-
if (e ===
|
|
45
|
+
if (e === n.BACKSPACE || e === n.CLEAR || e.length === 1)
|
|
46
46
|
return t.Type;
|
|
47
47
|
}
|
|
48
|
-
function S(e, r,
|
|
49
|
-
switch (
|
|
48
|
+
function S(e, r, o) {
|
|
49
|
+
switch (o) {
|
|
50
50
|
case t.First:
|
|
51
51
|
return 0;
|
|
52
52
|
case t.Last:
|
|
@@ -60,12 +60,12 @@ function S(e, r, n) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
function P(e) {
|
|
63
|
-
|
|
63
|
+
c(e, {
|
|
64
64
|
scrollMode: "if-needed",
|
|
65
65
|
block: "nearest",
|
|
66
66
|
inline: "nearest"
|
|
67
|
-
}).forEach(({ el:
|
|
68
|
-
|
|
67
|
+
}).forEach(({ el: o, top: s, left: i }) => {
|
|
68
|
+
o.scrollTop = s, o.scrollLeft = i;
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var W=Object.defineProperty;var
|
|
1
|
+
"use strict";var W=Object.defineProperty;var c=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var P=(e,a,t)=>a in e?W(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,j=(e,a)=>{for(var t in a||(a={}))I.call(a,t)&&P(e,t,a[t]);if(c)for(var t of c(a))_.call(a,t)&&P(e,t,a[t]);return e};var y=(e,a)=>{var t={};for(var n in e)I.call(e,n)&&a.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&c)for(var n of c(e))a.indexOf(n)<0&&_.call(e,n)&&(t[n]=e[n]);return t};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react"),A=require("prop-types"),V=require("@strapi/icons/Calendar"),w=require("@strapi/icons/Cross"),F=require("../themes/sizes.cjs"),G=require("../TextInput/TextInput.cjs"),D=require("./components.cjs"),H=require("./DatePickerCalendar.cjs"),R=require("./utils/formatDate.cjs"),J=require("../helpers/useId.cjs"),K=require("../helpers/getDefaultLocale.cjs"),u=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},l=u(i),r=u(A),N=u(V),Q=u(w),g=U=>{var C=U,{ariaLabel:e,initialDate:a,selectedDate:t,onChange:n,label:d,locale:E,selectedDateLabel:T,onClear:b,clearLabel:L,disabled:o,id:x}=C,z=y(C,["ariaLabel","initialDate","selectedDate","onChange","label","locale","selectedDateLabel","onClear","clearLabel","disabled","id"]);const O=J.useId("datepicker",x),[m,f]=i.useState(!1),s=i.useRef(null),v=i.useRef(null),h=E||K.getDefaultLocale(),k=t?R.formatDate(t,h):"",q=()=>{o||f(p=>!p)},S=()=>{o||(b(),v.current.focus())},B=p=>{n(p),f(!1)},M=()=>{f(!1)};return l.default.createElement(D.DatePickerWrapper,{bold:m},l.default.createElement(G.TextInput,j({ref:s,onClick:q,onChange:()=>{},value:k,startAction:l.default.createElement(D.DatePickerButton,{ref:v,onClick:q,"aria-label":t?T(R.formatDate(t,h)):d||e,type:"button","aria-disabled":o},l.default.createElement(N.default,{"aria-hidden":!0})),endAction:b&&k?l.default.createElement(D.IconBox,{as:"button",onClick:S,"aria-label":L,"aria-disabled":o},l.default.createElement(Q.default,null)):void 0,"aria-autocomplete":"none",label:d,"aria-label":e,disabled:o,id:O},z)),s.current&&s.current.inputWrapperRef&&m&&l.default.createElement(H.DatePickerCalendar,{selectedDate:t,initialDate:a,onChange:B,onEscape:M,popoverSource:s.current.inputWrapperRef,label:d||e}))};g.defaultProps={ariaLabel:void 0,clearLabel:void 0,disabled:!1,id:void 0,label:void 0,locale:void 0,initialDate:new Date,onClear:void 0,placeholder:void 0,selectedDate:void 0,size:"M"};g.propTypes={ariaLabel:r.default.string,clearLabel:r.default.string,disabled:r.default.bool,id:r.default.string,initialDate:r.default.instanceOf(Date),label:r.default.string,locale:r.default.string,onChange:r.default.func.isRequired,onClear:r.default.func,placeholder:r.default.string,selectedDate:r.default.instanceOf(Date),selectedDateLabel:r.default.func.isRequired,size:r.default.oneOf(Object.keys(F.sizes.input))};exports.DatePicker=g;
|