@strapi/design-system 1.3.1-alpha.0 → 1.3.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/AccordionContent.cjs +1 -1
- package/dist/Accordion/AccordionContent.js +37 -17
- package/dist/Accordion/AccordionToggle.cjs +6 -6
- package/dist/Accordion/AccordionToggle.js +96 -75
- package/dist/Alert/Alert.cjs +12 -12
- package/dist/Alert/Alert.js +102 -83
- package/dist/Badge/Badge.cjs +1 -1
- package/dist/Badge/Badge.js +47 -25
- package/dist/BaseButton/BaseButton.cjs +3 -3
- package/dist/BaseButton/BaseButton.js +42 -20
- package/dist/BaseCheckbox/BaseCheckbox.cjs +6 -6
- package/dist/BaseCheckbox/BaseCheckbox.js +55 -35
- package/dist/BaseLink/BaseLink.cjs +2 -2
- package/dist/BaseLink/BaseLink.js +43 -21
- package/dist/BaseRadio/BaseRadio.cjs +8 -8
- package/dist/BaseRadio/BaseRadio.js +51 -31
- package/dist/BaseRadio/RadioGroup.cjs +1 -1
- package/dist/BaseRadio/RadioGroup.js +44 -24
- package/dist/Box/BoxProps.cjs +1 -1
- package/dist/Box/BoxProps.js +19 -10
- package/dist/Breadcrumbs/Breadcrumbs.cjs +4 -4
- package/dist/Breadcrumbs/Breadcrumbs.js +50 -29
- package/dist/Button/Button.cjs +14 -14
- package/dist/Button/Button.js +73 -53
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.js +37 -17
- package/dist/Card/CardAsset.cjs +4 -4
- package/dist/Card/CardAsset.js +42 -19
- package/dist/Card/CardBadge.cjs +3 -3
- package/dist/Card/CardBadge.js +18 -9
- package/dist/Card/CardBody.cjs +1 -1
- package/dist/Card/CardBody.js +19 -8
- package/dist/Card/CardCheckbox.cjs +1 -1
- package/dist/Card/CardCheckbox.js +22 -12
- package/dist/Card/CardContent.cjs +2 -2
- package/dist/Card/CardContent.js +32 -11
- package/dist/Card/CardHeader.cjs +2 -2
- package/dist/Card/CardHeader.js +19 -9
- package/dist/Card/CardTimer.cjs +2 -2
- package/dist/Card/CardTimer.js +42 -20
- package/dist/Card/CardTitle.cjs +1 -1
- package/dist/Card/CardTitle.js +27 -16
- package/dist/CarouselInput/Carousel.cjs +6 -6
- package/dist/CarouselInput/Carousel.js +107 -77
- package/dist/CarouselInput/CarouselActions.cjs +1 -1
- package/dist/CarouselInput/CarouselActions.js +17 -7
- package/dist/CarouselInput/CarouselImage.cjs +3 -3
- package/dist/CarouselInput/CarouselImage.js +38 -26
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +83 -49
- package/dist/CarouselInput/CarouselSlide.cjs +2 -2
- package/dist/CarouselInput/CarouselSlide.js +42 -20
- package/dist/Checkbox/Checkbox.cjs +2 -2
- package/dist/Checkbox/Checkbox.js +63 -44
- package/dist/Combobox/Combobox.cjs +1 -1
- package/dist/Combobox/Combobox.js +240 -190
- package/dist/Combobox/ComboboxOption.cjs +1 -1
- package/dist/Combobox/ComboboxOption.js +47 -25
- 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 +111 -80
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -1
- package/dist/DatePicker/DatePickerCalendar.js +1 -1
- package/dist/DatePicker/DatePickerTd.cjs +4 -4
- package/dist/DatePicker/DatePickerTd.js +42 -23
- package/dist/DatePicker/DatePickerTh.cjs +3 -3
- package/dist/DatePicker/DatePickerTh.js +44 -23
- package/dist/DatePicker/utils/getYears.cjs +1 -1
- package/dist/DatePicker/utils/getYears.js +7 -6
- package/dist/Dialog/Dialog.cjs +5 -5
- package/dist/Dialog/Dialog.js +58 -39
- package/dist/DismissibleLayer/DismissibleLayer.cjs +1 -1
- package/dist/DismissibleLayer/DismissibleLayer.js +29 -26
- package/dist/Divider/Divider.cjs +2 -2
- package/dist/Divider/Divider.js +38 -15
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +38 -19
- package/dist/Field/FieldAction.cjs +2 -2
- package/dist/Field/FieldAction.js +35 -13
- package/dist/Field/FieldInput.cjs +6 -6
- package/dist/Field/FieldInput.js +66 -46
- package/dist/Field/FieldLabel.cjs +3 -3
- package/dist/Field/FieldLabel.js +45 -25
- package/dist/Flex/FlexProps.cjs +1 -1
- package/dist/Flex/FlexProps.js +19 -10
- package/dist/FocusTrap/FocusTrap.cjs +1 -1
- package/dist/FocusTrap/FocusTrap.js +52 -32
- package/dist/Grid/Grid.cjs +3 -3
- package/dist/Grid/Grid.js +42 -20
- package/dist/Grid/GridItem.cjs +2 -2
- package/dist/Grid/GridItem.js +41 -22
- package/dist/Icon/Icon.cjs +2 -2
- package/dist/Icon/Icon.js +27 -17
- package/dist/IconButton/IconButton.cjs +4 -4
- package/dist/IconButton/IconButton.js +67 -47
- package/dist/KeyboardNavigable/KeyboardNavigable.cjs +1 -1
- package/dist/KeyboardNavigable/KeyboardNavigable.js +58 -38
- package/dist/Layout/HeaderLayout.cjs +2 -2
- package/dist/Layout/HeaderLayout.js +96 -78
- package/dist/Link/Link.cjs +6 -6
- package/dist/Link/Link.js +54 -34
- package/dist/LinkButton/LinkButton.cjs +10 -10
- package/dist/LinkButton/LinkButton.js +69 -47
- package/dist/Loader/Loader.cjs +4 -4
- package/dist/Loader/Loader.js +47 -25
- package/dist/Main/Main.cjs +2 -2
- package/dist/Main/Main.js +35 -15
- package/dist/MainNav/MainNav.cjs +2 -2
- package/dist/MainNav/MainNav.js +39 -17
- package/dist/MainNav/NavCondense.cjs +3 -3
- package/dist/MainNav/NavCondense.js +40 -20
- package/dist/MainNav/NavLink.cjs +9 -9
- package/dist/MainNav/NavLink.js +72 -53
- package/dist/MainNav/NavSection.cjs +1 -1
- package/dist/MainNav/NavSection.js +67 -46
- package/dist/MainNav/NavSections.cjs +1 -1
- package/dist/MainNav/NavSections.js +40 -18
- package/dist/MainNav/NavUser.cjs +2 -2
- package/dist/MainNav/NavUser.js +51 -31
- package/dist/ModalLayout/ModalBody.cjs +2 -2
- package/dist/ModalLayout/ModalBody.js +19 -9
- package/dist/ModalLayout/ModalLayout.cjs +3 -3
- package/dist/ModalLayout/ModalLayout.js +52 -30
- package/dist/NumberInput/NumberInput.cjs +6 -6
- package/dist/NumberInput/NumberInput.js +154 -120
- package/dist/Pagination/components.cjs +7 -7
- package/dist/Pagination/components.js +88 -65
- package/dist/Popover/Popover.cjs +3 -3
- package/dist/Popover/Popover.js +91 -65
- package/dist/Portal/Portal.cjs +1 -1
- package/dist/Portal/Portal.js +12 -11
- package/dist/ProgressBar/ProgressBar.cjs +2 -2
- package/dist/ProgressBar/ProgressBar.js +49 -27
- package/dist/Radio/Radio.cjs +2 -2
- package/dist/Radio/Radio.js +40 -19
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +79 -59
- package/dist/RawTable/RawTable.cjs +1 -1
- package/dist/RawTable/RawTable.js +66 -46
- package/dist/RawTable/RawTbody.cjs +1 -1
- package/dist/RawTable/RawTbody.js +30 -11
- package/dist/RawTable/RawThead.cjs +1 -1
- package/dist/RawTable/RawThead.js +29 -10
- package/dist/RawTable/RawTr.cjs +1 -1
- package/dist/RawTable/RawTr.js +34 -14
- package/dist/Searchbar/SearchForm.cjs +1 -1
- package/dist/Searchbar/SearchForm.js +16 -5
- package/dist/Searchbar/Searchbar.cjs +7 -7
- package/dist/Searchbar/Searchbar.js +65 -45
- package/dist/Select/MultiSelectNested.cjs +1 -1
- package/dist/Select/MultiSelectNested.js +45 -23
- package/dist/Select/OptGroup.cjs +1 -1
- package/dist/Select/OptGroup.js +35 -15
- package/dist/Select/Option.cjs +7 -7
- package/dist/Select/Option.js +57 -37
- package/dist/Select/Select.cjs +2 -2
- package/dist/Select/Select.js +183 -144
- package/dist/Select/SelectButton.cjs +2 -2
- package/dist/Select/SelectButton.js +53 -33
- package/dist/SimpleMenu/SimpleMenu.cjs +7 -7
- package/dist/SimpleMenu/SimpleMenu.js +145 -119
- package/dist/Stack/Stack.cjs +3 -3
- package/dist/Stack/Stack.js +50 -29
- package/dist/Status/Status.cjs +4 -4
- package/dist/Status/Status.js +50 -30
- package/dist/SubNav/SubNav.cjs +3 -3
- package/dist/SubNav/SubNav.js +37 -15
- package/dist/SubNav/SubNavHeader.cjs +2 -2
- package/dist/SubNav/SubNavHeader.js +40 -39
- package/dist/SubNav/SubNavLink.cjs +6 -6
- package/dist/SubNav/SubNavLink.js +62 -40
- package/dist/SubNav/SubNavSections.cjs +1 -1
- package/dist/SubNav/SubNavSections.js +39 -17
- package/dist/Switch/Switch.cjs +5 -5
- package/dist/Switch/Switch.js +57 -35
- package/dist/Table/Cell.cjs +3 -3
- package/dist/Table/Cell.js +40 -20
- package/dist/Table/TFooter.cjs +3 -3
- package/dist/Table/TFooter.js +50 -28
- package/dist/Table/Table.cjs +5 -5
- package/dist/Table/Table.js +56 -36
- package/dist/Table/Tbody.cjs +2 -2
- package/dist/Table/Tbody.js +17 -8
- package/dist/Table/Thead.cjs +2 -2
- package/dist/Table/Thead.js +17 -8
- package/dist/Table/Tr.cjs +2 -2
- package/dist/Table/Tr.js +17 -8
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +45 -26
- package/dist/Tabs/TabPanels.cjs +1 -1
- package/dist/Tabs/TabPanels.js +43 -24
- package/dist/Tabs/Tabs.cjs +2 -2
- package/dist/Tabs/Tabs.js +112 -94
- package/dist/Tag/Tag.cjs +4 -4
- package/dist/Tag/Tag.js +50 -27
- package/dist/TextButton/TextButton.cjs +6 -6
- package/dist/TextButton/TextButton.js +59 -39
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +69 -49
- package/dist/Textarea/Textarea.cjs +3 -3
- package/dist/Textarea/Textarea.js +63 -43
- package/dist/Textarea/TextareaInput.cjs +4 -4
- package/dist/Textarea/TextareaInput.js +49 -29
- package/dist/TimePicker/TimePicker.cjs +3 -3
- package/dist/TimePicker/TimePicker.js +89 -58
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +8 -8
- package/dist/ToggleCheckbox/ToggleCheckbox.js +75 -53
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +98 -66
- package/dist/Tooltip/Tooltip.cjs +2 -2
- package/dist/Tooltip/Tooltip.js +57 -38
- package/dist/Typography/TypographyProps.cjs +1 -1
- package/dist/Typography/TypographyProps.js +22 -13
- package/dist/helpers/getDefaultLocale.cjs +1 -1
- package/dist/helpers/getDefaultLocale.js +1 -1
- package/dist/helpers/handleResponsiveValues.cjs +5 -5
- package/dist/helpers/handleResponsiveValues.js +14 -14
- package/dist/themes/darkTheme/index.cjs +1 -1
- package/dist/themes/darkTheme/index.js +18 -8
- package/dist/themes/extendTheme.cjs +4 -4
- package/dist/themes/extendTheme.js +29 -18
- package/dist/themes/lightTheme/index.cjs +1 -1
- package/dist/themes/lightTheme/index.js +18 -8
- package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +2 -2
- package/dist/v2/Breadcrumbs/Breadcrumbs.js +43 -23
- package/dist/v2/Breadcrumbs/Crumb.cjs +1 -1
- package/dist/v2/Breadcrumbs/Crumb.js +44 -22
- package/dist/v2/Breadcrumbs/CrumbLink.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbLink.js +35 -14
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +41 -19
- package/dist/v2/Link/Link.cjs +5 -5
- package/dist/v2/Link/Link.js +64 -42
- package/dist/v2/LinkButton/LinkButton.cjs +10 -10
- package/dist/v2/LinkButton/LinkButton.js +75 -51
- package/dist/v2/MainNav/MainNav.cjs +2 -2
- package/dist/v2/MainNav/MainNav.js +39 -17
- package/dist/v2/MainNav/NavBrand.cjs +3 -3
- package/dist/v2/MainNav/NavBrand.js +78 -57
- package/dist/v2/MainNav/NavCondense.cjs +3 -3
- package/dist/v2/MainNav/NavCondense.js +40 -20
- package/dist/v2/MainNav/NavLink.cjs +9 -9
- package/dist/v2/MainNav/NavLink.js +77 -56
- package/dist/v2/MainNav/NavSection.cjs +1 -1
- package/dist/v2/MainNav/NavSection.js +67 -46
- package/dist/v2/MainNav/NavSections.cjs +1 -1
- package/dist/v2/MainNav/NavSections.js +40 -18
- package/dist/v2/MainNav/NavUser.cjs +2 -2
- package/dist/v2/MainNav/NavUser.js +51 -31
- package/dist/v2/Pagination/components.cjs +7 -7
- package/dist/v2/Pagination/components.js +89 -65
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +7 -7
- package/dist/v2/SimpleMenu/SimpleMenu.js +145 -119
- package/dist/v2/SubNav/SubNav.cjs +3 -3
- package/dist/v2/SubNav/SubNav.js +37 -15
- package/dist/v2/SubNav/SubNavHeader.cjs +2 -2
- package/dist/v2/SubNav/SubNavHeader.js +40 -39
- package/dist/v2/SubNav/SubNavLink.cjs +6 -6
- package/dist/v2/SubNav/SubNavLink.js +65 -43
- package/dist/v2/SubNav/SubNavSections.cjs +1 -1
- package/dist/v2/SubNav/SubNavSections.js +39 -17
- package/package.json +5 -4
|
@@ -1,242 +1,293 @@
|
|
|
1
|
-
|
|
1
|
+
var we = Object.defineProperty, $e = Object.defineProperties;
|
|
2
|
+
var ke = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var w = Object.getOwnPropertySymbols;
|
|
4
|
+
var G = Object.prototype.hasOwnProperty, J = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var W = (o, i, a) => i in o ? we(o, i, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[i] = a, D = (o, i) => {
|
|
6
|
+
for (var a in i || (i = {}))
|
|
7
|
+
G.call(i, a) && W(o, a, i[a]);
|
|
8
|
+
if (w)
|
|
9
|
+
for (var a of w(i))
|
|
10
|
+
J.call(i, a) && W(o, a, i[a]);
|
|
11
|
+
return o;
|
|
12
|
+
}, F = (o, i) => $e(o, ke(i));
|
|
13
|
+
var Q = (o, i) => {
|
|
14
|
+
var a = {};
|
|
15
|
+
for (var p in o)
|
|
16
|
+
G.call(o, p) && i.indexOf(p) < 0 && (a[p] = o[p]);
|
|
17
|
+
if (o != null && w)
|
|
18
|
+
for (var p of w(o))
|
|
19
|
+
i.indexOf(p) < 0 && J.call(o, p) && (a[p] = o[p]);
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
import r, { useState as O, useRef as y, useEffect as X, useLayoutEffect as Be, Children as Y, cloneElement as Re } from "react";
|
|
2
23
|
import e from "prop-types";
|
|
3
|
-
import { useId as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { filterOptions as
|
|
7
|
-
import { Flex as
|
|
8
|
-
import { IconBox as
|
|
9
|
-
import { Popover as
|
|
10
|
-
import { Box as
|
|
11
|
-
import { Typography as
|
|
12
|
-
import { Loader as
|
|
13
|
-
import { MainRow as
|
|
14
|
-
import { ComboboxOption as
|
|
15
|
-
import { ComboboxList as
|
|
16
|
-
import { Field as
|
|
17
|
-
import { FieldLabel as
|
|
24
|
+
import { useId as Se } from "../helpers/useId.js";
|
|
25
|
+
import De from "@strapi/icons/CarretDown";
|
|
26
|
+
import Fe from "@strapi/icons/Cross";
|
|
27
|
+
import { filterOptions as Z, maintainScrollVisibility as Te, getActionFromKey as Ae, MenuActions as C, getUpdatedIndex as T } from "./utils.js";
|
|
28
|
+
import { Flex as ee } from "../Flex/Flex.js";
|
|
29
|
+
import { IconBox as Ve, CaretBox as Ke } from "../Select/components.js";
|
|
30
|
+
import { Popover as Ne } from "../Popover/Popover.js";
|
|
31
|
+
import { Box as Pe } from "../Box/Box.js";
|
|
32
|
+
import { Typography as te } from "../Typography/Typography.js";
|
|
33
|
+
import { Loader as qe } from "../Loader/Loader.js";
|
|
34
|
+
import { MainRow as He, InputContainer as Ue, ValueContainer as _e, Input as je } from "./components.js";
|
|
35
|
+
import { ComboboxOption as ze } from "./ComboboxOption.js";
|
|
36
|
+
import { ComboboxList as We } from "./ComboboxList.js";
|
|
37
|
+
import { Field as Ge } from "../Field/Field.js";
|
|
38
|
+
import { FieldLabel as Je } from "../Field/FieldLabel.js";
|
|
18
39
|
import "../Field/FieldInput.js";
|
|
19
|
-
import { FieldHint as
|
|
20
|
-
import { FieldError as
|
|
40
|
+
import { FieldHint as Qe } from "../Field/FieldHint.js";
|
|
41
|
+
import { FieldError as Xe } from "../Field/FieldError.js";
|
|
21
42
|
import "../Field/FieldContext.js";
|
|
22
43
|
import "../Field/FieldAction.js";
|
|
23
|
-
import { Stack as
|
|
24
|
-
import { KeyboardKeys as
|
|
25
|
-
import { VisuallyHidden as
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
import { Stack as Ye } from "../Stack/Stack.js";
|
|
45
|
+
import { KeyboardKeys as Ze } from "../helpers/keyboardKeys.js";
|
|
46
|
+
import { VisuallyHidden as et } from "../VisuallyHidden/VisuallyHidden.js";
|
|
47
|
+
const $ = (tt) => {
|
|
48
|
+
var P = tt, {
|
|
49
|
+
children: o,
|
|
50
|
+
clearLabel: i,
|
|
51
|
+
creatable: a,
|
|
52
|
+
createMessage: p,
|
|
53
|
+
disabled: f,
|
|
54
|
+
error: k,
|
|
55
|
+
hasMoreItems: re,
|
|
56
|
+
hint: A,
|
|
57
|
+
label: h,
|
|
58
|
+
labelAction: ne,
|
|
59
|
+
loading: B,
|
|
60
|
+
loadingMessage: ae,
|
|
61
|
+
noOptionsMessage: ie,
|
|
62
|
+
onChange: V,
|
|
63
|
+
onClear: K,
|
|
64
|
+
onCreateOption: le,
|
|
65
|
+
onInputChange: N,
|
|
66
|
+
onLoadMore: se,
|
|
67
|
+
placeholder: ce,
|
|
68
|
+
required: pe,
|
|
69
|
+
value: m
|
|
70
|
+
} = P, ue = Q(P, [
|
|
71
|
+
"children",
|
|
72
|
+
"clearLabel",
|
|
73
|
+
"creatable",
|
|
74
|
+
"createMessage",
|
|
75
|
+
"disabled",
|
|
76
|
+
"error",
|
|
77
|
+
"hasMoreItems",
|
|
78
|
+
"hint",
|
|
79
|
+
"label",
|
|
80
|
+
"labelAction",
|
|
81
|
+
"loading",
|
|
82
|
+
"loadingMessage",
|
|
83
|
+
"noOptionsMessage",
|
|
84
|
+
"onChange",
|
|
85
|
+
"onClear",
|
|
86
|
+
"onCreateOption",
|
|
87
|
+
"onInputChange",
|
|
88
|
+
"onLoadMore",
|
|
89
|
+
"placeholder",
|
|
90
|
+
"required",
|
|
91
|
+
"value"
|
|
92
|
+
]);
|
|
93
|
+
const de = () => {
|
|
94
|
+
var t;
|
|
95
|
+
return (t = o.find((n) => {
|
|
96
|
+
var l;
|
|
97
|
+
return ((l = n.props) == null ? void 0 : l.value.toLowerCase()) === m.toLowerCase();
|
|
98
|
+
}).props) == null ? void 0 : t.children;
|
|
99
|
+
}, [c, q] = O(0), [fe, me] = O(null), [d, H] = O(o), [E, ge] = O(!1), [s, M] = O(""), x = y(), L = y(!1), I = y(), U = y(), be = y(), _ = y(!0), u = Se("combobox"), R = `${u}-label`;
|
|
100
|
+
if (!h && !ue["aria-label"])
|
|
52
101
|
throw new Error('The Combobox component needs a "label" or an "aria-label" props');
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, [
|
|
56
|
-
|
|
57
|
-
}, [
|
|
58
|
-
if (
|
|
59
|
-
|
|
102
|
+
X(() => {
|
|
103
|
+
H(Z(o, s));
|
|
104
|
+
}, [s, o]), X(() => {
|
|
105
|
+
E && x.current && Te(x.current);
|
|
106
|
+
}, [c]), Be(() => {
|
|
107
|
+
if (_.current) {
|
|
108
|
+
_.current = !1;
|
|
60
109
|
return;
|
|
61
110
|
}
|
|
62
|
-
}, [
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
const { key:
|
|
71
|
-
switch (
|
|
72
|
-
case
|
|
73
|
-
return
|
|
74
|
-
case
|
|
75
|
-
return
|
|
76
|
-
case
|
|
77
|
-
case
|
|
78
|
-
return
|
|
79
|
-
case
|
|
80
|
-
t.preventDefault(),
|
|
111
|
+
}, [m]);
|
|
112
|
+
const Ce = E ? `${u}-${c}` : "", j = () => {
|
|
113
|
+
V(null), M("");
|
|
114
|
+
}, he = (t) => {
|
|
115
|
+
N && N(t);
|
|
116
|
+
const n = I.current.value;
|
|
117
|
+
H(Z(o, n)), q(0), me(null), s !== n && M(n), E || g(!0, !1);
|
|
118
|
+
}, Ee = (t) => {
|
|
119
|
+
const { key: n } = t, l = a && s ? d.length : d.length - 1, v = Ae(n, E);
|
|
120
|
+
switch (m && !s && n === Ze.BACKSPACE && j(), v) {
|
|
121
|
+
case C.Next:
|
|
122
|
+
return b(c === l ? 0 : T(c, l, v));
|
|
123
|
+
case C.Previous:
|
|
124
|
+
return b(c === 0 ? l : T(c, l, v));
|
|
125
|
+
case C.Last:
|
|
126
|
+
case C.First:
|
|
127
|
+
return b(c === l ? 0 : T(c, l, v));
|
|
128
|
+
case C.CloseSelect:
|
|
129
|
+
t.preventDefault(), S(c);
|
|
81
130
|
return;
|
|
82
|
-
case
|
|
83
|
-
return t.preventDefault(),
|
|
84
|
-
case
|
|
85
|
-
return
|
|
131
|
+
case C.Close:
|
|
132
|
+
return t.preventDefault(), g(!1);
|
|
133
|
+
case C.Open:
|
|
134
|
+
return g(!0);
|
|
86
135
|
default:
|
|
87
136
|
return;
|
|
88
137
|
}
|
|
89
|
-
},
|
|
90
|
-
if (t.preventDefault(),
|
|
91
|
-
|
|
138
|
+
}, xe = (t) => {
|
|
139
|
+
if (t.preventDefault(), m && !L.current && M(""), L.current) {
|
|
140
|
+
L.current = !1;
|
|
92
141
|
return;
|
|
93
142
|
}
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
},
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
const
|
|
110
|
-
return
|
|
111
|
-
id: `${
|
|
112
|
-
"aria-selected":
|
|
113
|
-
"aria-posinset":
|
|
114
|
-
"aria-setsize":
|
|
115
|
-
ref: (
|
|
116
|
-
|
|
143
|
+
g(!1, !1);
|
|
144
|
+
}, b = (t) => {
|
|
145
|
+
q(t);
|
|
146
|
+
}, ve = (t) => {
|
|
147
|
+
b(t), S(t);
|
|
148
|
+
}, z = () => {
|
|
149
|
+
L.current = !0;
|
|
150
|
+
}, S = (t) => {
|
|
151
|
+
const n = d[t];
|
|
152
|
+
if (M(""), n)
|
|
153
|
+
return V(n.props.value), g(!1);
|
|
154
|
+
a && (le(s), g(!1));
|
|
155
|
+
}, g = (t, n = !0) => {
|
|
156
|
+
ge(t), n && I.current.focus();
|
|
157
|
+
}, ye = Y.toArray(d).map((t, n) => {
|
|
158
|
+
const l = c === n;
|
|
159
|
+
return Re(t, {
|
|
160
|
+
id: `${u}-${n}`,
|
|
161
|
+
"aria-selected": fe === n,
|
|
162
|
+
"aria-posinset": n + 1,
|
|
163
|
+
"aria-setsize": Y.toArray(d).length,
|
|
164
|
+
ref: (v) => {
|
|
165
|
+
l && (x.current = v);
|
|
117
166
|
},
|
|
118
|
-
onClick: () =>
|
|
119
|
-
onMouseDown:
|
|
120
|
-
isSelected:
|
|
167
|
+
onClick: () => ve(n),
|
|
168
|
+
onMouseDown: z,
|
|
169
|
+
isSelected: l
|
|
121
170
|
});
|
|
122
|
-
}),
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
},
|
|
127
|
-
const t =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
171
|
+
}), Ie = () => {
|
|
172
|
+
I.current.focus(), K && K(), j();
|
|
173
|
+
}, Oe = () => {
|
|
174
|
+
I.current.focus(), g(!0);
|
|
175
|
+
}, Me = () => {
|
|
176
|
+
const t = d.findIndex((n) => {
|
|
177
|
+
var l;
|
|
178
|
+
return ((l = n.props) == null ? void 0 : l.children) === s;
|
|
179
|
+
});
|
|
180
|
+
return s && t === -1;
|
|
181
|
+
}, Le = (t) => {
|
|
182
|
+
t.preventDefault(), g(t, !0);
|
|
131
183
|
};
|
|
132
|
-
return /* @__PURE__ */
|
|
133
|
-
hint:
|
|
134
|
-
error:
|
|
135
|
-
id:
|
|
136
|
-
}, /* @__PURE__ */
|
|
184
|
+
return /* @__PURE__ */ r.createElement(Ge, {
|
|
185
|
+
hint: A,
|
|
186
|
+
error: k,
|
|
187
|
+
id: u
|
|
188
|
+
}, /* @__PURE__ */ r.createElement(et, {
|
|
137
189
|
"aria-live": "polite",
|
|
138
190
|
"aria-atomic": "false",
|
|
139
191
|
"aria-relevant": "additions text"
|
|
140
|
-
},
|
|
141
|
-
spacing:
|
|
142
|
-
},
|
|
143
|
-
action:
|
|
144
|
-
required:
|
|
145
|
-
id:
|
|
146
|
-
},
|
|
147
|
-
ref:
|
|
148
|
-
$disabled:
|
|
149
|
-
hasError:
|
|
150
|
-
}, /* @__PURE__ */
|
|
192
|
+
}, m), /* @__PURE__ */ r.createElement(Ye, {
|
|
193
|
+
spacing: h || A || k ? 1 : 0
|
|
194
|
+
}, h && /* @__PURE__ */ r.createElement(Je, {
|
|
195
|
+
action: ne,
|
|
196
|
+
required: pe,
|
|
197
|
+
id: R
|
|
198
|
+
}, h), /* @__PURE__ */ r.createElement(He, {
|
|
199
|
+
ref: U,
|
|
200
|
+
$disabled: f,
|
|
201
|
+
hasError: k
|
|
202
|
+
}, /* @__PURE__ */ r.createElement(Ue, {
|
|
151
203
|
wrap: "wrap"
|
|
152
|
-
}, !
|
|
153
|
-
id: `${
|
|
154
|
-
}, /* @__PURE__ */
|
|
155
|
-
"aria-activedescendant":
|
|
204
|
+
}, !s && m && /* @__PURE__ */ r.createElement(_e, {
|
|
205
|
+
id: `${u}-selected-value`
|
|
206
|
+
}, /* @__PURE__ */ r.createElement(te, null, de())), /* @__PURE__ */ r.createElement(je, {
|
|
207
|
+
"aria-activedescendant": Ce,
|
|
156
208
|
"aria-autocomplete": "list",
|
|
157
|
-
"aria-controls": `${
|
|
158
|
-
"aria-disabled":
|
|
159
|
-
"aria-expanded":
|
|
209
|
+
"aria-controls": `${u}-listbox`,
|
|
210
|
+
"aria-disabled": f,
|
|
211
|
+
"aria-expanded": E,
|
|
160
212
|
"aria-haspopup": "listbox",
|
|
161
|
-
"aria-labelledby":
|
|
162
|
-
id:
|
|
163
|
-
onBlur:
|
|
164
|
-
onClick:
|
|
165
|
-
onInput:
|
|
166
|
-
onKeyDown:
|
|
167
|
-
placeholder:
|
|
168
|
-
readOnly:
|
|
169
|
-
ref:
|
|
213
|
+
"aria-labelledby": h ? R : void 0,
|
|
214
|
+
id: u,
|
|
215
|
+
onBlur: f ? void 0 : xe,
|
|
216
|
+
onClick: f ? void 0 : Le,
|
|
217
|
+
onInput: f ? void 0 : he,
|
|
218
|
+
onKeyDown: f ? void 0 : Ee,
|
|
219
|
+
placeholder: m ? "" : ce,
|
|
220
|
+
readOnly: f,
|
|
221
|
+
ref: I,
|
|
170
222
|
role: "combobox",
|
|
171
223
|
autoComplete: "off",
|
|
172
224
|
autoCorrect: "off",
|
|
173
225
|
spellCheck: "off",
|
|
174
226
|
type: "text",
|
|
175
|
-
value:
|
|
176
|
-
})), /* @__PURE__ */
|
|
177
|
-
id: `${
|
|
178
|
-
"aria-label":
|
|
179
|
-
disabled:
|
|
227
|
+
value: s
|
|
228
|
+
})), /* @__PURE__ */ r.createElement(ee, null, (m || s) && /* @__PURE__ */ r.createElement(Ve, {
|
|
229
|
+
id: `${u}-clear`,
|
|
230
|
+
"aria-label": i,
|
|
231
|
+
disabled: f,
|
|
180
232
|
paddingLeft: 3,
|
|
181
233
|
as: "button",
|
|
182
|
-
onClick:
|
|
234
|
+
onClick: Ie,
|
|
183
235
|
type: "button"
|
|
184
|
-
}, /* @__PURE__ */
|
|
185
|
-
disabled:
|
|
236
|
+
}, /* @__PURE__ */ r.createElement(Fe, null)), /* @__PURE__ */ r.createElement(Ke, {
|
|
237
|
+
disabled: f,
|
|
186
238
|
paddingLeft: 3,
|
|
187
239
|
"aria-hidden": !0,
|
|
188
240
|
as: "button",
|
|
189
|
-
onClick:
|
|
241
|
+
onClick: Oe,
|
|
190
242
|
tabIndex: -1,
|
|
191
243
|
type: "button"
|
|
192
|
-
}, /* @__PURE__ */
|
|
193
|
-
id: `${
|
|
194
|
-
source:
|
|
244
|
+
}, /* @__PURE__ */ r.createElement(De, null)))), /* @__PURE__ */ r.createElement(Qe, null), /* @__PURE__ */ r.createElement(Xe, null)), E && /* @__PURE__ */ r.createElement(Ne, {
|
|
245
|
+
id: `${u}-popover`,
|
|
246
|
+
source: U,
|
|
195
247
|
spacing: 4,
|
|
196
248
|
fullWidth: !0,
|
|
197
|
-
intersectionId: `${
|
|
198
|
-
onReachEnd:
|
|
199
|
-
}, /* @__PURE__ */
|
|
249
|
+
intersectionId: `${u}-listbox-popover-intersection`,
|
|
250
|
+
onReachEnd: re && !B ? se : void 0
|
|
251
|
+
}, /* @__PURE__ */ r.createElement("div", {
|
|
200
252
|
role: "listbox",
|
|
201
|
-
ref:
|
|
202
|
-
id: `${
|
|
203
|
-
"aria-labelledby":
|
|
204
|
-
}, (Boolean(
|
|
205
|
-
activeOptionRef:
|
|
206
|
-
options:
|
|
207
|
-
}),
|
|
208
|
-
isSelected:
|
|
253
|
+
ref: be,
|
|
254
|
+
id: `${u}-listbox`,
|
|
255
|
+
"aria-labelledby": h ? R : void 0
|
|
256
|
+
}, (Boolean(d.length) || a) && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(We, {
|
|
257
|
+
activeOptionRef: x,
|
|
258
|
+
options: ye
|
|
259
|
+
}), Me() && a && /* @__PURE__ */ r.createElement(ze, {
|
|
260
|
+
isSelected: c === d.length,
|
|
209
261
|
ref: (t) => {
|
|
210
|
-
|
|
262
|
+
c === d.length && (x.current = t);
|
|
211
263
|
},
|
|
212
|
-
onMouseDown:
|
|
213
|
-
onClick: () =>
|
|
264
|
+
onMouseDown: z,
|
|
265
|
+
onClick: () => S(),
|
|
214
266
|
taindex: 0
|
|
215
|
-
},
|
|
267
|
+
}, p(s))), !Boolean(d.length) && !a && !B && /* @__PURE__ */ r.createElement(Pe, {
|
|
216
268
|
paddingLeft: 4,
|
|
217
269
|
paddingRight: 4,
|
|
218
270
|
paddingTop: 2,
|
|
219
271
|
paddingBottom: 2,
|
|
220
|
-
ref:
|
|
221
|
-
}, /* @__PURE__ */
|
|
272
|
+
ref: x
|
|
273
|
+
}, /* @__PURE__ */ r.createElement(te, {
|
|
222
274
|
textColor: "neutral800"
|
|
223
|
-
},
|
|
275
|
+
}, ie(s))), B && /* @__PURE__ */ r.createElement(ee, {
|
|
224
276
|
justifyContent: "center",
|
|
225
277
|
alignItems: "center",
|
|
226
278
|
paddingTop: 2,
|
|
227
279
|
paddingBottom: 2
|
|
228
|
-
}, /* @__PURE__ */
|
|
280
|
+
}, /* @__PURE__ */ r.createElement(qe, {
|
|
229
281
|
small: !0
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
...s,
|
|
282
|
+
}, ae)))));
|
|
283
|
+
}, oe = (o) => /* @__PURE__ */ r.createElement($, F(D({}, o), {
|
|
233
284
|
creatable: !0
|
|
234
|
-
});
|
|
235
|
-
|
|
285
|
+
}));
|
|
286
|
+
$.defaultProps = oe.defaultProps = {
|
|
236
287
|
"aria-label": void 0,
|
|
237
288
|
clearLabel: "clear",
|
|
238
289
|
creatable: !1,
|
|
239
|
-
createMessage: (
|
|
290
|
+
createMessage: (o) => `Create "${o}"`,
|
|
240
291
|
disabled: !1,
|
|
241
292
|
error: void 0,
|
|
242
293
|
hasMoreItems: !1,
|
|
@@ -252,7 +303,7 @@ M.defaultProps = z.defaultProps = {
|
|
|
252
303
|
placeholder: "Select or enter a value",
|
|
253
304
|
value: void 0
|
|
254
305
|
};
|
|
255
|
-
|
|
306
|
+
$.propTypes = {
|
|
256
307
|
"aria-label": e.string,
|
|
257
308
|
children: e.oneOfType([e.arrayOf(e.node), e.node]),
|
|
258
309
|
clearLabel: e.string,
|
|
@@ -275,11 +326,10 @@ M.propTypes = {
|
|
|
275
326
|
placeholder: e.string,
|
|
276
327
|
value: e.string
|
|
277
328
|
};
|
|
278
|
-
|
|
279
|
-
...M.propTypes,
|
|
329
|
+
oe.propTypes = F(D({}, $.propTypes), {
|
|
280
330
|
onCreateOption: e.func.isRequired
|
|
281
|
-
};
|
|
331
|
+
});
|
|
282
332
|
export {
|
|
283
|
-
|
|
284
|
-
|
|
333
|
+
$ as Combobox,
|
|
334
|
+
oe as CreatableCombobox
|
|
285
335
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";var b=Object.defineProperty;var a=Object.getOwnPropertySymbols;var d=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;var l=(e,t,o)=>t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,s=(e,t)=>{for(var o in t||(t={}))d.call(t,o)&&l(e,o,t[o]);if(a)for(var o of a(t))i.call(t,o)&&l(e,o,t[o]);return e};var c=(e,t)=>{var o={};for(var r in e)d.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&a)for(var r of a(e))t.indexOf(r)<0&&i.call(e,r)&&(o[r]=e[r]);return o};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("react"),m=require("prop-types"),T=require("../Typography/Typography.cjs"),h=require("./components.cjs"),g=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},f=g(y),n=g(m),p=y.forwardRef((_,r)=>{var u=_,{isSelected:e,children:t}=u,o=c(u,["isSelected","children"]);return f.default.createElement(h.OptionBox,s({hasRadius:!0,paddingLeft:4,paddingRight:4,paddingTop:2,paddingBottom:2,role:"option",background:"neutral0",isSelected:e,ref:r},o),f.default.createElement(T.Typography,{textColor:e?"primary600":"neutral800",fontWeight:e?"bold":null},t))});p.defaultProps={isSelected:!1};p.propTypes={children:n.default.oneOfType([n.default.string,n.default.number]).isRequired,isSelected:n.default.bool};p.displayName="ComboboxOption";exports.ComboboxOption=p;
|
|
@@ -1,30 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var p = Object.getOwnPropertySymbols;
|
|
3
|
+
var m = Object.prototype.hasOwnProperty, l = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var d = (o, r, e) => r in o ? g(o, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[r] = e, f = (o, r) => {
|
|
5
|
+
for (var e in r || (r = {}))
|
|
6
|
+
m.call(r, e) && d(o, e, r[e]);
|
|
7
|
+
if (p)
|
|
8
|
+
for (var e of p(r))
|
|
9
|
+
l.call(r, e) && d(o, e, r[e]);
|
|
10
|
+
return o;
|
|
11
|
+
};
|
|
12
|
+
var u = (o, r) => {
|
|
13
|
+
var e = {};
|
|
14
|
+
for (var t in o)
|
|
15
|
+
m.call(o, t) && r.indexOf(t) < 0 && (e[t] = o[t]);
|
|
16
|
+
if (o != null && p)
|
|
17
|
+
for (var t of p(o))
|
|
18
|
+
r.indexOf(t) < 0 && l.call(o, t) && (e[t] = o[t]);
|
|
19
|
+
return e;
|
|
20
|
+
};
|
|
21
|
+
import s, { forwardRef as b } from "react";
|
|
22
|
+
import i from "prop-types";
|
|
23
|
+
import { Typography as y } from "../Typography/Typography.js";
|
|
24
|
+
import { OptionBox as c } from "./components.js";
|
|
25
|
+
const n = b((h, t) => {
|
|
26
|
+
var a = h, { isSelected: o, children: r } = a, e = u(a, ["isSelected", "children"]);
|
|
27
|
+
return /* @__PURE__ */ s.createElement(c, f({
|
|
28
|
+
hasRadius: !0,
|
|
29
|
+
paddingLeft: 4,
|
|
30
|
+
paddingRight: 4,
|
|
31
|
+
paddingTop: 2,
|
|
32
|
+
paddingBottom: 2,
|
|
33
|
+
role: "option",
|
|
34
|
+
background: "neutral0",
|
|
35
|
+
isSelected: o,
|
|
36
|
+
ref: t
|
|
37
|
+
}, e), /* @__PURE__ */ s.createElement(y, {
|
|
38
|
+
textColor: o ? "primary600" : "neutral800",
|
|
39
|
+
fontWeight: o ? "bold" : null
|
|
40
|
+
}, r));
|
|
41
|
+
});
|
|
42
|
+
n.defaultProps = {
|
|
21
43
|
isSelected: !1
|
|
22
44
|
};
|
|
23
|
-
|
|
24
|
-
children:
|
|
25
|
-
isSelected:
|
|
45
|
+
n.propTypes = {
|
|
46
|
+
children: i.oneOfType([i.string, i.number]).isRequired,
|
|
47
|
+
isSelected: i.bool
|
|
26
48
|
};
|
|
27
|
-
|
|
49
|
+
n.displayName = "ComboboxOption";
|
|
28
50
|
export {
|
|
29
|
-
|
|
51
|
+
n as ComboboxOption
|
|
30
52
|
};
|
package/dist/Combobox/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("compute-scroll-into-view"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("compute-scroll-into-view"),o=require("../helpers/keyboardKeys.cjs"),a=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},c=a(l),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=[],s,r=[]){const n=String(s!=null?s:"").toLowerCase();return n?e.filter(i=>i.props.children.toString().toLowerCase().includes(n)&&r.indexOf(i)<0):e}function p(e,s){if(!s&&e===o.KeyboardKeys.DOWN)return t.Open;if(e===o.KeyboardKeys.DOWN)return t.Next;if(e===o.KeyboardKeys.UP)return t.Previous;if(e===o.KeyboardKeys.HOME)return t.First;if(e===o.KeyboardKeys.END)return t.Last;if(e===o.KeyboardKeys.ESCAPE)return t.Close;if(e===o.KeyboardKeys.ENTER)return t.CloseSelect;if(e===o.KeyboardKeys.BACKSPACE||e===o.KeyboardKeys.CLEAR||e.length===1)return t.Type}function f(e,s,r){switch(r){case t.First:return 0;case t.Last:return s;case t.Previous:return Math.max(0,e-1);case t.Next:return Math.min(s,e+1);default:return e}}function y(e){c.default(e,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}).forEach(({el:r,top:n,left:i})=>{r.scrollTop=n,r.scrollLeft=i})}exports.MenuActions=t;exports.TreeActions=u;exports.filterOptions=d;exports.getActionFromKey=p;exports.getUpdatedIndex=f;exports.maintainScrollVisibility=y;
|