@strapi/design-system 1.6.3 → 1.6.5
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 +5 -5
- package/dist/Accordion/Accordion.js +45 -44
- package/dist/Accordion/AccordionContent.cjs +1 -1
- package/dist/Accordion/AccordionContent.js +4 -4
- package/dist/Accordion/AccordionGroup.cjs +4 -4
- package/dist/Accordion/AccordionGroup.js +18 -18
- package/dist/Accordion/AccordionToggle.cjs +6 -6
- package/dist/Accordion/AccordionToggle.js +50 -53
- package/dist/Alert/Alert.cjs +1 -1
- package/dist/Alert/Alert.js +8 -8
- package/dist/Avatar/Avatar.cjs +5 -5
- package/dist/Avatar/Avatar.js +11 -11
- package/dist/Avatar/AvatarGroup.cjs +2 -2
- package/dist/Avatar/AvatarGroup.js +4 -4
- package/dist/BaseButton/BaseButton.cjs +5 -11
- package/dist/BaseButton/BaseButton.js +31 -38
- package/dist/BaseCheckbox/BaseCheckbox.cjs +3 -3
- package/dist/BaseCheckbox/BaseCheckbox.js +22 -22
- package/dist/BaseRadio/BaseRadio.cjs +2 -2
- package/dist/BaseRadio/BaseRadio.js +4 -4
- package/dist/BaseRadio/RadioGroup.cjs +1 -1
- package/dist/BaseRadio/RadioGroup.js +28 -26
- package/dist/Box/Box.cjs +3 -3
- package/dist/Box/Box.js +27 -27
- package/dist/Breadcrumbs/Breadcrumbs.cjs +4 -4
- package/dist/Breadcrumbs/Breadcrumbs.js +12 -12
- package/dist/Button/Button.cjs +10 -27
- package/dist/Button/Button.js +65 -85
- package/dist/Button/utils.cjs +22 -22
- package/dist/Button/utils.js +2 -2
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.js +15 -14
- package/dist/Card/CardAsset.js +4 -4
- package/dist/Card/CardBody.cjs +1 -1
- package/dist/Card/CardBody.js +4 -4
- package/dist/Card/CardCheckbox.cjs +1 -1
- package/dist/Card/CardCheckbox.js +6 -6
- package/dist/Card/CardTitle.cjs +1 -1
- package/dist/Card/CardTitle.js +1 -1
- package/dist/CarouselInput/Carousel.cjs +2 -2
- package/dist/CarouselInput/Carousel.js +19 -64
- package/dist/CarouselInput/CarouselActions.cjs +1 -1
- package/dist/CarouselInput/CarouselActions.js +16 -12
- package/dist/CarouselInput/CarouselImage.js +1 -10
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +23 -28
- package/dist/CarouselInput/CarouselSlide.js +13 -9
- package/dist/Checkbox/Checkbox.cjs +2 -2
- package/dist/Checkbox/Checkbox.js +15 -34
- package/dist/Combobox/Combobox.cjs +1 -1
- package/dist/Combobox/Combobox.js +144 -159
- package/dist/Combobox/ComboboxOption.cjs +1 -1
- package/dist/Combobox/ComboboxOption.js +18 -17
- package/dist/DatePicker/DatePicker.cjs +1 -1
- package/dist/DatePicker/DatePicker.js +47 -46
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -1
- package/dist/DatePicker/DatePickerCalendar.js +30 -62
- package/dist/DatePicker/DatePickerTd.cjs +3 -3
- package/dist/DatePicker/DatePickerTd.js +8 -20
- package/dist/DatePicker/DatePickerTh.cjs +3 -3
- package/dist/DatePicker/DatePickerTh.js +10 -20
- package/dist/DatePicker/components.cjs +3 -3
- package/dist/DatePicker/components.js +6 -6
- package/dist/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +70 -67
- package/dist/DateTimePicker/DateTimePickerProps.js +1 -3
- package/dist/Dialog/Dialog.cjs +5 -5
- package/dist/Dialog/Dialog.js +26 -37
- package/dist/Dialog/DialogBody.cjs +1 -1
- package/dist/Dialog/DialogBody.js +2 -11
- package/dist/Dialog/DialogFooter.cjs +3 -3
- package/dist/Dialog/DialogFooter.js +3 -8
- package/dist/DismissibleLayer/DismissibleLayer.js +1 -4
- package/dist/Divider/Divider.js +1 -5
- package/dist/EmptyStateLayout/EmptyStateLayout.cjs +1 -1
- package/dist/EmptyStateLayout/EmptyStateLayout.js +2 -16
- package/dist/EmptyStateLayout/story-assets/Illo.js +60 -45
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +31 -28
- package/dist/Field/FieldAction.cjs +2 -8
- package/dist/Field/FieldAction.js +26 -19
- package/dist/Field/FieldContext.cjs +1 -1
- package/dist/Field/FieldContext.js +2 -2
- package/dist/Field/FieldError.cjs +1 -1
- package/dist/Field/FieldError.js +11 -7
- package/dist/Field/FieldHint.cjs +1 -1
- package/dist/Field/FieldHint.js +15 -10
- package/dist/Field/FieldInput.cjs +14 -16
- package/dist/Field/FieldInput.js +105 -81
- package/dist/Field/FieldLabel.cjs +3 -3
- package/dist/Field/FieldLabel.js +43 -38
- package/dist/FocusTrap/FocusTrap.cjs +1 -1
- package/dist/FocusTrap/FocusTrap.js +33 -41
- package/dist/Grid/Grid.cjs +3 -3
- package/dist/Grid/Grid.js +12 -15
- package/dist/Grid/GridItem.cjs +2 -2
- package/dist/Grid/GridItem.js +5 -13
- package/dist/IconButton/IconButton.cjs +7 -12
- package/dist/IconButton/IconButton.js +88 -84
- package/dist/JSONInput/JSONInput.cjs +1 -1
- package/dist/JSONInput/JSONInput.js +88 -79
- package/dist/JSONInput/JSONInputContainer.cjs +10 -10
- package/dist/JSONInput/JSONInputContainer.js +22 -15
- package/dist/Layout/ActionLayout.js +1 -13
- package/dist/Layout/ContentLayout.js +1 -4
- package/dist/Layout/HeaderLayout.cjs +2 -2
- package/dist/Layout/HeaderLayout.js +37 -66
- package/dist/Layout/Layout.js +1 -5
- package/dist/Layout/TwoColsLayout.js +1 -17
- package/dist/Link/Link.cjs +5 -5
- package/dist/Link/Link.js +55 -57
- package/dist/LinkButton/LinkButton.cjs +7 -24
- package/dist/LinkButton/LinkButton.js +60 -87
- package/dist/LiveRegions/LiveRegions.cjs +1 -1
- package/dist/LiveRegions/LiveRegions.js +1 -1
- package/dist/Loader/Loader.cjs +4 -4
- package/dist/Loader/Loader.js +26 -24
- package/dist/Main/Main.js +1 -6
- package/dist/Main/SkipToContent.cjs +2 -2
- package/dist/Main/SkipToContent.js +17 -13
- package/dist/MainNav/MainNav.cjs +2 -2
- package/dist/MainNav/MainNav.js +21 -20
- package/dist/MainNav/NavBrand.cjs +2 -2
- package/dist/MainNav/NavBrand.js +4 -38
- package/dist/MainNav/NavCondense.cjs +2 -2
- package/dist/MainNav/NavCondense.js +10 -18
- package/dist/MainNav/NavFooter.js +1 -3
- package/dist/MainNav/NavLink.cjs +4 -4
- package/dist/MainNav/NavLink.js +8 -34
- package/dist/MainNav/NavSection.cjs +1 -1
- package/dist/MainNav/NavSection.js +31 -44
- package/dist/MainNav/NavSections.cjs +2 -2
- package/dist/MainNav/NavSections.js +20 -21
- package/dist/MainNav/NavUser.cjs +2 -2
- package/dist/MainNav/NavUser.js +6 -27
- package/dist/ModalLayout/ModalBody.js +1 -4
- package/dist/ModalLayout/ModalFooter.cjs +1 -1
- package/dist/ModalLayout/ModalFooter.js +2 -10
- package/dist/ModalLayout/ModalHeader.cjs +2 -2
- package/dist/ModalLayout/ModalHeader.js +8 -20
- package/dist/ModalLayout/ModalLayout.cjs +3 -3
- package/dist/ModalLayout/ModalLayout.js +23 -31
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +75 -80
- package/dist/Pagination/Pagination.cjs +2 -2
- package/dist/Pagination/Pagination.js +11 -16
- package/dist/Pagination/components.cjs +3 -3
- package/dist/Pagination/components.js +31 -38
- package/dist/Popover/Popover.cjs +1 -1
- package/dist/Popover/Popover.js +5 -5
- package/dist/Portal/Portal.cjs +1 -1
- package/dist/Portal/Portal.js +10 -12
- package/dist/ProgressBar/ProgressBar.js +17 -14
- package/dist/Radio/Radio.cjs +2 -2
- package/dist/Radio/Radio.js +4 -11
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +57 -72
- package/dist/RawTable/RawTable.cjs +1 -1
- package/dist/RawTable/RawTable.js +45 -42
- package/dist/RawTable/RawTbody.cjs +1 -1
- package/dist/RawTable/RawTbody.js +14 -13
- package/dist/RawTable/RawThead.cjs +1 -1
- package/dist/RawTable/RawThead.js +13 -10
- package/dist/RawTable/RawTr.cjs +1 -1
- package/dist/RawTable/RawTr.js +19 -15
- package/dist/Searchbar/SearchForm.js +1 -4
- package/dist/Searchbar/Searchbar.cjs +3 -3
- package/dist/Searchbar/Searchbar.js +25 -28
- package/dist/Select/MultiSelectNested.js +2 -14
- package/dist/Select/OptGroup.cjs +1 -1
- package/dist/Select/OptGroup.js +14 -10
- package/dist/Select/Option.cjs +3 -3
- package/dist/Select/Option.js +31 -33
- package/dist/Select/Select.cjs +2 -2
- package/dist/Select/Select.js +98 -119
- package/dist/Select/SelectButton.cjs +1 -1
- package/dist/Select/SelectButton.js +14 -11
- package/dist/Select/SelectList.cjs +1 -1
- package/dist/Select/SelectList.js +24 -18
- package/dist/Select/SelectTags.cjs +3 -3
- package/dist/Select/SelectTags.js +17 -15
- package/dist/SimpleMenu/SimpleMenu.cjs +3 -3
- package/dist/SimpleMenu/SimpleMenu.js +43 -67
- package/dist/Status/Status.js +15 -13
- package/dist/SubNav/SubNav.cjs +2 -2
- package/dist/SubNav/SubNav.js +5 -9
- package/dist/SubNav/SubNavHeader.cjs +2 -2
- package/dist/SubNav/SubNavHeader.js +31 -53
- package/dist/SubNav/SubNavLink.cjs +3 -3
- package/dist/SubNav/SubNavLink.js +18 -22
- package/dist/SubNav/SubNavLinkSection.cjs +3 -3
- package/dist/SubNav/SubNavLinkSection.js +5 -30
- package/dist/SubNav/SubNavSection.cjs +2 -2
- package/dist/SubNav/SubNavSection.js +27 -34
- package/dist/SubNav/SubNavSectionLabel.cjs +2 -2
- package/dist/SubNav/SubNavSectionLabel.js +15 -24
- package/dist/SubNav/SubNavSections.cjs +1 -1
- package/dist/SubNav/SubNavSections.js +17 -16
- package/dist/Switch/Switch.cjs +2 -2
- package/dist/Switch/Switch.js +16 -17
- package/dist/Table/Cell.cjs +1 -1
- package/dist/Table/Cell.js +3 -8
- package/dist/Table/TFooter.cjs +2 -2
- package/dist/Table/TFooter.js +3 -17
- package/dist/Table/Table.cjs +1 -1
- package/dist/Table/Table.js +2 -18
- package/dist/Table/Tbody.js +1 -3
- package/dist/Table/Thead.js +1 -3
- package/dist/Table/Tr.js +1 -3
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +30 -27
- package/dist/Tabs/TabPanels.js +2 -10
- package/dist/Tabs/Tabs.cjs +1 -1
- package/dist/Tabs/Tabs.js +43 -51
- package/dist/Tag/Tag.cjs +8 -8
- package/dist/Tag/Tag.js +52 -52
- package/dist/TextButton/TextButton.cjs +6 -6
- package/dist/TextButton/TextButton.js +15 -15
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +13 -31
- package/dist/Textarea/Textarea.cjs +2 -2
- package/dist/Textarea/Textarea.js +12 -28
- package/dist/Textarea/TextareaInput.cjs +4 -4
- package/dist/Textarea/TextareaInput.js +22 -21
- package/dist/TimePicker/TimePicker.cjs +2 -2
- package/dist/TimePicker/TimePicker.js +26 -25
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +5 -5
- package/dist/ToggleCheckbox/ToggleCheckbox.js +86 -60
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +28 -47
- package/dist/Tooltip/Tooltip.cjs +2 -2
- package/dist/Tooltip/Tooltip.js +62 -53
- package/dist/Tooltip/hooks/useTooltipHandlers.cjs +1 -1
- package/dist/Tooltip/hooks/useTooltipHandlers.js +7 -7
- package/dist/Tooltip/hooks/useTooltipLayout.cjs +1 -1
- package/dist/Tooltip/hooks/useTooltipLayout.js +8 -5
- package/dist/Typography/Typography.cjs +3 -2
- package/dist/Typography/Typography.js +17 -14
- package/dist/helpers/deprecations.cjs +1 -1
- package/dist/helpers/deprecations.js +7 -7
- package/dist/helpers/objects.cjs +1 -1
- package/dist/helpers/objects.js +1 -1
- package/dist/helpers/useElementOnScreen.cjs +1 -1
- package/dist/helpers/useElementOnScreen.js +4 -13
- package/dist/helpers/useId.cjs +1 -1
- package/dist/helpers/useId.js +4 -11
- package/dist/helpers/useIntersection.cjs +1 -1
- package/dist/helpers/useIntersection.js +4 -21
- package/dist/helpers/useLockScroll.cjs +1 -1
- package/dist/helpers/useLockScroll.js +4 -7
- package/dist/helpers/usePrevious.cjs +1 -1
- package/dist/helpers/usePrevious.js +4 -8
- package/dist/helpers/useResizeObserver.cjs +1 -1
- package/dist/helpers/useResizeObserver.js +4 -14
- package/dist/hooks/useElementOnScreen.cjs +1 -0
- package/dist/hooks/useElementOnScreen.js +15 -0
- package/dist/hooks/useId.cjs +1 -0
- package/dist/hooks/useId.js +13 -0
- package/dist/hooks/useIntersection.cjs +1 -1
- package/dist/hooks/useIntersection.js +3 -3
- package/dist/hooks/useLockScroll.cjs +1 -0
- package/dist/hooks/useLockScroll.js +9 -0
- package/dist/hooks/usePrevious.cjs +1 -0
- package/dist/hooks/usePrevious.js +10 -0
- package/dist/hooks/useResizeObserver.cjs +1 -0
- package/dist/hooks/useResizeObserver.js +16 -0
- package/dist/themes/extendTheme.cjs +1 -1
- package/dist/themes/extendTheme.js +4 -4
- package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +2 -2
- package/dist/v2/Breadcrumbs/Breadcrumbs.js +4 -13
- package/dist/v2/Breadcrumbs/Crumb.js +11 -12
- package/dist/v2/Breadcrumbs/CrumbLink.js +1 -3
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +5 -11
- package/dist/v2/Breadcrumbs/Divider.js +1 -8
- package/dist/v2/Link/Link.cjs +2 -2
- package/dist/v2/Link/Link.js +5 -24
- package/dist/v2/LinkButton/LinkButton.cjs +11 -24
- package/dist/v2/LinkButton/LinkButton.js +62 -84
- package/dist/v2/MainNav/MainNav.cjs +2 -2
- package/dist/v2/MainNav/MainNav.js +21 -20
- package/dist/v2/MainNav/NavBrand.cjs +2 -2
- package/dist/v2/MainNav/NavBrand.js +4 -38
- package/dist/v2/MainNav/NavCondense.cjs +2 -2
- package/dist/v2/MainNav/NavCondense.js +10 -18
- package/dist/v2/MainNav/NavFooter.js +1 -3
- package/dist/v2/MainNav/NavLink.cjs +4 -4
- package/dist/v2/MainNav/NavLink.js +10 -39
- package/dist/v2/MainNav/NavSection.cjs +1 -1
- package/dist/v2/MainNav/NavSection.js +31 -44
- package/dist/v2/MainNav/NavSections.cjs +2 -2
- package/dist/v2/MainNav/NavSections.js +20 -21
- package/dist/v2/MainNav/NavUser.cjs +2 -2
- package/dist/v2/MainNav/NavUser.js +6 -27
- package/dist/v2/Pagination/Pagination.cjs +2 -2
- package/dist/v2/Pagination/Pagination.js +11 -16
- package/dist/v2/Pagination/components.cjs +2 -2
- package/dist/v2/Pagination/components.js +11 -39
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +4 -4
- package/dist/v2/SimpleMenu/SimpleMenu.js +42 -65
- package/dist/v2/SubNav/SubNav.cjs +2 -2
- package/dist/v2/SubNav/SubNav.js +5 -9
- package/dist/v2/SubNav/SubNavHeader.cjs +2 -2
- package/dist/v2/SubNav/SubNavHeader.js +31 -53
- package/dist/v2/SubNav/SubNavLink.cjs +2 -2
- package/dist/v2/SubNav/SubNavLink.js +18 -22
- package/dist/v2/SubNav/SubNavLinkSection.cjs +3 -3
- package/dist/v2/SubNav/SubNavLinkSection.js +5 -30
- package/dist/v2/SubNav/SubNavSection.cjs +2 -2
- package/dist/v2/SubNav/SubNavSection.js +29 -36
- package/dist/v2/SubNav/SubNavSectionLabel.cjs +2 -2
- package/dist/v2/SubNav/SubNavSectionLabel.js +15 -24
- package/dist/v2/SubNav/SubNavSections.cjs +1 -1
- package/dist/v2/SubNav/SubNavSections.js +17 -16
- package/package.json +8 -4
- package/dist/Select/SingleSelect.cjs +0 -82
- package/dist/Select/SingleSelect.js +0 -285
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import o, { useState as y, useRef as C, useEffect as
|
|
1
|
+
import o, { useState as y, useRef as C, useEffect as _, useLayoutEffect as xe, Children as j, cloneElement as ye } from "react";
|
|
2
|
+
import { Cross as Ie, CarretDown as Oe } from "@strapi/icons";
|
|
2
3
|
import e from "prop-types";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { filterOptions as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { Box as Re } from "../Box/Box.js";
|
|
10
|
-
import { Typography as z } from "../Typography/Typography.js";
|
|
11
|
-
import { Loader as Se } from "../Loader/Loader.js";
|
|
12
|
-
import { MainRow as Be, InputContainer as Fe, ValueContainer as Te, Input as Ae } from "./components.js";
|
|
13
|
-
import { ComboboxOption as Pe } from "./ComboboxOption.js";
|
|
14
|
-
import { Field as Ve } from "../Field/Field.js";
|
|
15
|
-
import { FieldLabel as Ke } from "../Field/FieldLabel.js";
|
|
4
|
+
import { ComboboxOption as ke } from "./ComboboxOption.js";
|
|
5
|
+
import { MainRow as Me, InputContainer as $e, ValueContainer as we, Input as Le } from "./components.js";
|
|
6
|
+
import { filterOptions as q, maintainScrollVisibility as De, getActionFromKey as Re, MenuActions as b, getUpdatedIndex as R } from "./utils.js";
|
|
7
|
+
import { Box as Be } from "../Box/Box.js";
|
|
8
|
+
import { Field as Fe } from "../Field/Field.js";
|
|
9
|
+
import { FieldLabel as Se } from "../Field/FieldLabel.js";
|
|
16
10
|
import "../Field/FieldInput.js";
|
|
17
|
-
import { FieldHint as
|
|
18
|
-
import { FieldError as
|
|
11
|
+
import { FieldHint as Te } from "../Field/FieldHint.js";
|
|
12
|
+
import { FieldError as Ae } from "../Field/FieldError.js";
|
|
19
13
|
import "../Field/FieldContext.js";
|
|
20
14
|
import "../Field/FieldAction.js";
|
|
21
|
-
import {
|
|
22
|
-
import { KeyboardKeys as
|
|
23
|
-
import {
|
|
15
|
+
import { Flex as B } from "../Flex/Flex.js";
|
|
16
|
+
import { KeyboardKeys as Pe } from "../helpers/keyboardKeys.js";
|
|
17
|
+
import { useId as Ve } from "../hooks/useId.js";
|
|
18
|
+
import { Loader as Ke } from "../Loader/Loader.js";
|
|
19
|
+
import { Popover as Ne } from "../Popover/Popover.js";
|
|
20
|
+
import { IconBox as He, CaretBox as Ue } from "../Select/components.js";
|
|
21
|
+
import { Typography as z } from "../Typography/Typography.js";
|
|
22
|
+
import { VisuallyHidden as _e } from "../VisuallyHidden/VisuallyHidden.js";
|
|
24
23
|
const I = ({
|
|
25
24
|
children: s,
|
|
26
25
|
clearLabel: G,
|
|
27
26
|
creatable: h,
|
|
28
27
|
createMessage: J,
|
|
29
28
|
disabled: c,
|
|
30
|
-
error:
|
|
29
|
+
error: O,
|
|
31
30
|
hasMoreItems: Q,
|
|
32
31
|
hint: $,
|
|
33
32
|
id: X,
|
|
@@ -36,35 +35,35 @@ const I = ({
|
|
|
36
35
|
loading: w,
|
|
37
36
|
loadingMessage: Z,
|
|
38
37
|
noOptionsMessage: ee,
|
|
39
|
-
onChange:
|
|
40
|
-
onClear:
|
|
38
|
+
onChange: F,
|
|
39
|
+
onClear: S,
|
|
41
40
|
onCreateOption: te,
|
|
42
|
-
onInputChange:
|
|
41
|
+
onInputChange: T,
|
|
43
42
|
onLoadMore: oe,
|
|
44
|
-
placeholder:
|
|
45
|
-
required:
|
|
43
|
+
placeholder: ne,
|
|
44
|
+
required: A,
|
|
46
45
|
value: d,
|
|
47
|
-
...
|
|
46
|
+
...re
|
|
48
47
|
}) => {
|
|
49
|
-
const ae = () => s.find((t) => t.props?.value.toLowerCase() === d.toLowerCase()).props?.children, [i,
|
|
50
|
-
if (!E && !
|
|
48
|
+
const ae = () => s.find((t) => t.props?.value.toLowerCase() === d.toLowerCase()).props?.children, [i, P] = y(0), [ie, le] = y(null), [l, V] = y(s), [u, se] = y(!1), [r, k] = y(""), v = C(), M = C(!1), x = C(), K = C(), ce = C(), N = C(!0), a = Ve(X), pe = `${a}-label`;
|
|
49
|
+
if (!E && !re["aria-label"])
|
|
51
50
|
throw new Error('The Combobox component needs a "label" or an "aria-label" props');
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, [
|
|
55
|
-
u && v.current &&
|
|
51
|
+
_(() => {
|
|
52
|
+
V(q(s, r));
|
|
53
|
+
}, [r, s]), _(() => {
|
|
54
|
+
u && v.current && De(v.current);
|
|
56
55
|
}, [i, u]), xe(() => {
|
|
57
|
-
|
|
56
|
+
N.current && (N.current = !1);
|
|
58
57
|
}, [d]);
|
|
59
|
-
const de = u ? `${a}-${i}` : "",
|
|
60
|
-
|
|
58
|
+
const de = u ? `${a}-${i}` : "", H = () => {
|
|
59
|
+
F(null), k("");
|
|
61
60
|
}, fe = (t) => {
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
61
|
+
T && T(t);
|
|
62
|
+
const n = x.current.value;
|
|
63
|
+
V(q(s, n)), P(0), le(null), r !== n && k(n), u || f(!0, !1);
|
|
65
64
|
}, ue = (t) => {
|
|
66
|
-
const { key:
|
|
67
|
-
switch (d && !
|
|
65
|
+
const { key: n } = t, p = h && r ? l.length : l.length - 1, g = Re(n, u);
|
|
66
|
+
switch (d && !r && n === Pe.BACKSPACE && H(), g) {
|
|
68
67
|
case b.Next: {
|
|
69
68
|
if (i === p) {
|
|
70
69
|
m(0);
|
|
@@ -101,151 +100,137 @@ const I = ({
|
|
|
101
100
|
break;
|
|
102
101
|
}
|
|
103
102
|
}, me = (t) => {
|
|
104
|
-
if (t.preventDefault(), d && !M.current &&
|
|
103
|
+
if (t.preventDefault(), d && !M.current && k(""), M.current) {
|
|
105
104
|
M.current = !1;
|
|
106
105
|
return;
|
|
107
106
|
}
|
|
108
107
|
f(!1, !1);
|
|
109
108
|
}, m = (t) => {
|
|
110
|
-
|
|
109
|
+
P(t);
|
|
111
110
|
}, be = (t) => {
|
|
112
111
|
m(t), L(t);
|
|
113
|
-
},
|
|
112
|
+
}, U = () => {
|
|
114
113
|
M.current = !0;
|
|
115
114
|
}, L = (t) => {
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
|
|
115
|
+
const n = l[t];
|
|
116
|
+
if (k(""), n) {
|
|
117
|
+
F(n.props.value), f(!1);
|
|
119
118
|
return;
|
|
120
119
|
}
|
|
121
|
-
h && (te(
|
|
122
|
-
}, f = (t,
|
|
123
|
-
se(t),
|
|
124
|
-
}, ge =
|
|
125
|
-
const p = i ===
|
|
120
|
+
h && (te(r), f(!1));
|
|
121
|
+
}, f = (t, n = !0) => {
|
|
122
|
+
se(t), n && x.current.focus();
|
|
123
|
+
}, ge = j.toArray(l).map((t, n) => {
|
|
124
|
+
const p = i === n;
|
|
126
125
|
return ye(t, {
|
|
127
|
-
id: `${a}-${
|
|
128
|
-
"aria-selected": ie ===
|
|
129
|
-
"aria-posinset":
|
|
130
|
-
"aria-setsize":
|
|
126
|
+
id: `${a}-${n}`,
|
|
127
|
+
"aria-selected": ie === n,
|
|
128
|
+
"aria-posinset": n + 1,
|
|
129
|
+
"aria-setsize": j.toArray(l).length,
|
|
131
130
|
ref(g) {
|
|
132
131
|
p && (v.current = g);
|
|
133
132
|
},
|
|
134
|
-
onClick: () => be(
|
|
135
|
-
onMouseDown:
|
|
133
|
+
onClick: () => be(n),
|
|
134
|
+
onMouseDown: U,
|
|
136
135
|
isSelected: p
|
|
137
136
|
});
|
|
138
137
|
}), Ce = () => {
|
|
139
|
-
x.current.focus(),
|
|
138
|
+
x.current.focus(), S && S(), H();
|
|
140
139
|
}, he = () => {
|
|
141
140
|
x.current.focus(), f(!0);
|
|
142
141
|
}, Ee = () => {
|
|
143
|
-
const t = l.findIndex((
|
|
144
|
-
return
|
|
142
|
+
const t = l.findIndex((n) => n.props?.children === r);
|
|
143
|
+
return r && t === -1;
|
|
145
144
|
}, ve = (t) => {
|
|
146
145
|
t.preventDefault(), f(t, !0);
|
|
147
146
|
};
|
|
148
147
|
let D;
|
|
149
|
-
return
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
placeholder: d ? "" : re,
|
|
186
|
-
readOnly: c,
|
|
187
|
-
ref: x,
|
|
188
|
-
required: T,
|
|
189
|
-
role: "combobox",
|
|
190
|
-
spellCheck: "off",
|
|
191
|
-
type: "text",
|
|
192
|
-
value: n
|
|
193
|
-
})), /* @__PURE__ */ o.createElement(q, null, (d || n) && /* @__PURE__ */ o.createElement(we, {
|
|
194
|
-
id: `${a}-clear`,
|
|
195
|
-
"aria-label": G,
|
|
196
|
-
disabled: c,
|
|
197
|
-
paddingLeft: 3,
|
|
198
|
-
as: "button",
|
|
199
|
-
onClick: Ce,
|
|
200
|
-
type: "button"
|
|
201
|
-
}, /* @__PURE__ */ o.createElement(Ie, null)), /* @__PURE__ */ o.createElement(Le, {
|
|
202
|
-
disabled: c,
|
|
203
|
-
paddingLeft: 3,
|
|
204
|
-
"aria-hidden": !0,
|
|
205
|
-
as: "button",
|
|
206
|
-
onClick: he,
|
|
207
|
-
tabIndex: -1,
|
|
208
|
-
type: "button"
|
|
209
|
-
}, /* @__PURE__ */ o.createElement(ke, null)))), /* @__PURE__ */ o.createElement(Ne, null), /* @__PURE__ */ o.createElement(He, null)), u && /* @__PURE__ */ o.createElement(De, {
|
|
210
|
-
id: `${a}-popover`,
|
|
211
|
-
source: V,
|
|
212
|
-
spacing: 4,
|
|
213
|
-
fullWidth: !0,
|
|
214
|
-
intersectionId: `${a}-listbox-popover-intersection`,
|
|
215
|
-
onReachEnd: Q && !w ? oe : void 0
|
|
216
|
-
}, /* @__PURE__ */ o.createElement("div", {
|
|
217
|
-
role: "listbox",
|
|
218
|
-
ref: ce,
|
|
219
|
-
id: `${a}-listbox`,
|
|
220
|
-
"aria-labelledby": E ? pe : void 0
|
|
221
|
-
}, (Boolean(l.length) || h) && /* @__PURE__ */ o.createElement(o.Fragment, null, ge, Ee() && h && /* @__PURE__ */ o.createElement(Pe, {
|
|
222
|
-
isSelected: i === l.length,
|
|
223
|
-
ref: (t) => {
|
|
224
|
-
i === l.length && (v.current = t);
|
|
148
|
+
return O ? D = `${a}-error` : $ && (D = `${a}-hint`), /* @__PURE__ */ o.createElement(Fe, { hint: $, error: O, id: a, required: A }, /* @__PURE__ */ o.createElement(_e, { "aria-live": "polite", "aria-atomic": "false", "aria-relevant": "additions text" }, d), /* @__PURE__ */ o.createElement(B, { direction: "column", alignItems: "stretch", gap: E || $ || O ? 1 : 0 }, E && /* @__PURE__ */ o.createElement(Se, { action: Y }, E), /* @__PURE__ */ o.createElement(Me, { ref: K, $disabled: c, hasError: O }, /* @__PURE__ */ o.createElement($e, { wrap: "wrap" }, !r && d && /* @__PURE__ */ o.createElement(we, { id: `${a}-selected-value` }, /* @__PURE__ */ o.createElement(z, null, ae())), /* @__PURE__ */ o.createElement(
|
|
149
|
+
Le,
|
|
150
|
+
{
|
|
151
|
+
"aria-activedescendant": de,
|
|
152
|
+
"aria-autocomplete": "list",
|
|
153
|
+
"aria-controls": `${a}-listbox`,
|
|
154
|
+
"aria-disabled": c,
|
|
155
|
+
"aria-expanded": u,
|
|
156
|
+
"aria-haspopup": "listbox",
|
|
157
|
+
"aria-describedby": D,
|
|
158
|
+
autoComplete: "off",
|
|
159
|
+
autoCorrect: "off",
|
|
160
|
+
id: a,
|
|
161
|
+
onBlur: c ? void 0 : me,
|
|
162
|
+
onClick: c ? void 0 : ve,
|
|
163
|
+
onInput: c ? void 0 : fe,
|
|
164
|
+
onKeyDown: c ? void 0 : ue,
|
|
165
|
+
placeholder: d ? "" : ne,
|
|
166
|
+
readOnly: c,
|
|
167
|
+
ref: x,
|
|
168
|
+
required: A,
|
|
169
|
+
role: "combobox",
|
|
170
|
+
spellCheck: "off",
|
|
171
|
+
type: "text",
|
|
172
|
+
value: r
|
|
173
|
+
}
|
|
174
|
+
)), /* @__PURE__ */ o.createElement(B, null, (d || r) && /* @__PURE__ */ o.createElement(
|
|
175
|
+
He,
|
|
176
|
+
{
|
|
177
|
+
id: `${a}-clear`,
|
|
178
|
+
"aria-label": G,
|
|
179
|
+
disabled: c,
|
|
180
|
+
paddingLeft: 3,
|
|
181
|
+
as: "button",
|
|
182
|
+
onClick: Ce,
|
|
183
|
+
type: "button"
|
|
225
184
|
},
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
185
|
+
/* @__PURE__ */ o.createElement(Ie, null)
|
|
186
|
+
), /* @__PURE__ */ o.createElement(
|
|
187
|
+
Ue,
|
|
188
|
+
{
|
|
189
|
+
disabled: c,
|
|
190
|
+
paddingLeft: 3,
|
|
191
|
+
"aria-hidden": !0,
|
|
192
|
+
as: "button",
|
|
193
|
+
onClick: he,
|
|
194
|
+
tabIndex: -1,
|
|
195
|
+
type: "button"
|
|
196
|
+
},
|
|
197
|
+
/* @__PURE__ */ o.createElement(Oe, null)
|
|
198
|
+
))), /* @__PURE__ */ o.createElement(Te, null), /* @__PURE__ */ o.createElement(Ae, null)), u && /* @__PURE__ */ o.createElement(
|
|
199
|
+
Ne,
|
|
200
|
+
{
|
|
201
|
+
id: `${a}-popover`,
|
|
202
|
+
source: K,
|
|
203
|
+
spacing: 4,
|
|
204
|
+
fullWidth: !0,
|
|
205
|
+
intersectionId: `${a}-listbox-popover-intersection`,
|
|
206
|
+
onReachEnd: Q && !w ? oe : void 0
|
|
207
|
+
},
|
|
208
|
+
/* @__PURE__ */ o.createElement(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
role: "listbox",
|
|
212
|
+
ref: ce,
|
|
213
|
+
id: `${a}-listbox`,
|
|
214
|
+
"aria-labelledby": E ? pe : void 0
|
|
215
|
+
},
|
|
216
|
+
(Boolean(l.length) || h) && /* @__PURE__ */ o.createElement(o.Fragment, null, ge, Ee() && h && /* @__PURE__ */ o.createElement(
|
|
217
|
+
ke,
|
|
218
|
+
{
|
|
219
|
+
isSelected: i === l.length,
|
|
220
|
+
ref: (t) => {
|
|
221
|
+
i === l.length && (v.current = t);
|
|
222
|
+
},
|
|
223
|
+
onMouseDown: U,
|
|
224
|
+
onClick: () => L(),
|
|
225
|
+
taindex: 0
|
|
226
|
+
},
|
|
227
|
+
J(r)
|
|
228
|
+
)),
|
|
229
|
+
!l.length && !h && !w && /* @__PURE__ */ o.createElement(Be, { paddingLeft: 4, paddingRight: 4, paddingTop: 2, paddingBottom: 2, ref: v }, /* @__PURE__ */ o.createElement(z, { textColor: "neutral800" }, ee(r))),
|
|
230
|
+
w && /* @__PURE__ */ o.createElement(B, { justifyContent: "center", alignItems: "center", paddingTop: 2, paddingBottom: 2 }, /* @__PURE__ */ o.createElement(Ke, { small: !0 }, Z))
|
|
231
|
+
)
|
|
232
|
+
));
|
|
233
|
+
}, W = (s) => /* @__PURE__ */ o.createElement(I, { ...s, creatable: !0 });
|
|
249
234
|
I.defaultProps = {
|
|
250
235
|
"aria-label": void 0,
|
|
251
236
|
clearLabel: "clear",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react"),d=require("prop-types"),i=require("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react"),d=require("prop-types"),i=require("./components.cjs"),s=require("../Typography/Typography.cjs"),n=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},r=n(a),o=n(d),t=a.forwardRef(({isSelected:e,children:p,...u},l)=>r.default.createElement(i.OptionBox,{hasRadius:!0,paddingLeft:4,paddingRight:4,paddingTop:2,paddingBottom:2,role:"option",background:"neutral0",isSelected:e,ref:l,...u},r.default.createElement(s.Typography,{textColor:e?"primary600":"neutral800",fontWeight:e?"bold":null},p)));t.defaultProps={isSelected:!1};t.propTypes={children:o.default.oneOfType([o.default.string,o.default.number]).isRequired,isSelected:o.default.bool};t.displayName="ComboboxOption";exports.ComboboxOption=t;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import t, { forwardRef as a } from "react";
|
|
2
2
|
import o from "prop-types";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
const r = a(({ isSelected: e, children: p, ...i }, n) => /* @__PURE__ */ t.createElement(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, p)
|
|
3
|
+
import { OptionBox as d } from "./components.js";
|
|
4
|
+
import { Typography as m } from "../Typography/Typography.js";
|
|
5
|
+
const r = a(({ isSelected: e, children: p, ...i }, n) => /* @__PURE__ */ t.createElement(
|
|
6
|
+
d,
|
|
7
|
+
{
|
|
8
|
+
hasRadius: !0,
|
|
9
|
+
paddingLeft: 4,
|
|
10
|
+
paddingRight: 4,
|
|
11
|
+
paddingTop: 2,
|
|
12
|
+
paddingBottom: 2,
|
|
13
|
+
role: "option",
|
|
14
|
+
background: "neutral0",
|
|
15
|
+
isSelected: e,
|
|
16
|
+
ref: n,
|
|
17
|
+
...i
|
|
18
|
+
},
|
|
19
|
+
/* @__PURE__ */ t.createElement(m, { textColor: e ? "primary600" : "neutral800", fontWeight: e ? "bold" : null }, p)
|
|
20
|
+
));
|
|
20
21
|
r.defaultProps = {
|
|
21
22
|
isSelected: !1
|
|
22
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),v=require("@strapi/icons"),z=require("prop-types"),u=require("./components.cjs"),I=require("./DatePickerCalendar.cjs"),C=require("./utils/formatDate.cjs"),S=require("../helpers/getDefaultLocale.cjs"),B=require("../TextInput/TextInput.cjs"),M=require("../themes/sizes.cjs"),h=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},a=h(o),e=h(z),f=({ariaLabel:t,initialDate:k,selectedDate:n,onChange:P,label:i,locale:q,selectedDateLabel:y,onClear:d,clearLabel:R,disabled:l,id:j,minDate:E,maxDate:T,...x})=>{const[p,c]=o.useState(!1),r=o.useRef(null),D=o.useRef(null),m=q||S.getDefaultLocale(),b=n?C.formatDate(n,m):"",g=()=>{l||c(s=>!s)},L=()=>{l||(d(),D.current.focus())},O=s=>{P(s),c(!1)},_=()=>{c(!1)};return a.default.createElement(u.DatePickerWrapper,{bold:p},a.default.createElement(B.TextInput,{ref:r,onClick:g,onChange:()=>{},value:b,startAction:a.default.createElement(u.DatePickerButton,{ref:D,onClick:g,"aria-label":n?y(C.formatDate(n,m)):i||t,type:"button","aria-disabled":l},a.default.createElement(v.Calendar,{"aria-hidden":!0})),endAction:d&&b?a.default.createElement(u.IconBox,{as:"button",onClick:L,"aria-label":R,"aria-disabled":l},a.default.createElement(v.Cross,null)):void 0,"aria-autocomplete":"none",label:i,"aria-label":t,disabled:l,id:j,...x}),r.current&&r.current.inputWrapperRef&&p&&a.default.createElement(I.DatePickerCalendar,{selectedDate:n,initialDate:k,onChange:O,onEscape:_,popoverSource:r.current.inputWrapperRef,label:i||t,minDate:E,maxDate:T}))};f.defaultProps={ariaLabel:void 0,clearLabel:void 0,disabled:!1,id:void 0,label:void 0,locale:void 0,initialDate:new Date,minDate:void 0,maxDate:void 0,onClear:void 0,placeholder:void 0,selectedDate:void 0,size:"M"};f.propTypes={ariaLabel:e.default.string,clearLabel:e.default.string,disabled:e.default.bool,id:e.default.string,initialDate:e.default.instanceOf(Date),label:e.default.string,locale:e.default.string,maxDate:e.default.instanceOf(Date),minDate:e.default.instanceOf(Date),onChange:e.default.func.isRequired,onClear:e.default.func,placeholder:e.default.string,selectedDate:e.default.instanceOf(Date),selectedDateLabel:e.default.func.isRequired,size:e.default.oneOf(Object.keys(M.sizes.input))};exports.DatePicker=f;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import t, { useState as B, useRef as D } from "react";
|
|
2
|
-
import e from "prop-types";
|
|
3
2
|
import { Calendar as T, Cross as W } from "@strapi/icons";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { DatePickerCalendar as _ } from "./DatePickerCalendar.js";
|
|
3
|
+
import e from "prop-types";
|
|
4
|
+
import { DatePickerWrapper as q, DatePickerButton as A, IconBox as I } from "./components.js";
|
|
5
|
+
import { DatePickerCalendar as S } from "./DatePickerCalendar.js";
|
|
8
6
|
import { formatDate as b } from "./utils/formatDate.js";
|
|
9
|
-
import { getDefaultLocale as
|
|
7
|
+
import { getDefaultLocale as V } from "../helpers/getDefaultLocale.js";
|
|
8
|
+
import { TextInput as _ } from "../TextInput/TextInput.js";
|
|
9
|
+
import { sizes as j } from "../themes/sizes.js";
|
|
10
10
|
const v = ({
|
|
11
11
|
ariaLabel: o,
|
|
12
12
|
initialDate: g,
|
|
@@ -23,7 +23,7 @@ const v = ({
|
|
|
23
23
|
maxDate: O,
|
|
24
24
|
...x
|
|
25
25
|
}) => {
|
|
26
|
-
const [f, l] = B(!1), n = D(null), p = D(null), u = h ||
|
|
26
|
+
const [f, l] = B(!1), n = D(null), p = D(null), u = h || V(), m = a ? b(a, u) : "", d = () => {
|
|
27
27
|
r || l((c) => !c);
|
|
28
28
|
}, y = () => {
|
|
29
29
|
r || (s(), p.current.focus());
|
|
@@ -32,45 +32,46 @@ const v = ({
|
|
|
32
32
|
}, z = () => {
|
|
33
33
|
l(!1);
|
|
34
34
|
};
|
|
35
|
-
return /* @__PURE__ */ t.createElement(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
onClick: d,
|
|
40
|
-
onChange: () => {
|
|
41
|
-
},
|
|
42
|
-
value: m,
|
|
43
|
-
startAction: /* @__PURE__ */ t.createElement(S, {
|
|
44
|
-
ref: p,
|
|
35
|
+
return /* @__PURE__ */ t.createElement(q, { bold: f }, /* @__PURE__ */ t.createElement(
|
|
36
|
+
_,
|
|
37
|
+
{
|
|
38
|
+
ref: n,
|
|
45
39
|
onClick: d,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
40
|
+
onChange: () => {
|
|
41
|
+
},
|
|
42
|
+
value: m,
|
|
43
|
+
startAction: /* @__PURE__ */ t.createElement(
|
|
44
|
+
A,
|
|
45
|
+
{
|
|
46
|
+
ref: p,
|
|
47
|
+
onClick: d,
|
|
48
|
+
"aria-label": a ? k(b(a, u)) : i || o,
|
|
49
|
+
type: "button",
|
|
50
|
+
"aria-disabled": r
|
|
51
|
+
},
|
|
52
|
+
/* @__PURE__ */ t.createElement(T, { "aria-hidden": !0 })
|
|
53
|
+
),
|
|
54
|
+
endAction: s && m ? /* @__PURE__ */ t.createElement(I, { as: "button", onClick: y, "aria-label": E, "aria-disabled": r }, /* @__PURE__ */ t.createElement(W, null)) : void 0,
|
|
55
|
+
"aria-autocomplete": "none",
|
|
56
|
+
label: i,
|
|
57
|
+
"aria-label": o,
|
|
58
|
+
disabled: r,
|
|
59
|
+
id: R,
|
|
60
|
+
...x
|
|
61
|
+
}
|
|
62
|
+
), n.current && n.current.inputWrapperRef && f && /* @__PURE__ */ t.createElement(
|
|
63
|
+
S,
|
|
64
|
+
{
|
|
65
|
+
selectedDate: a,
|
|
66
|
+
initialDate: g,
|
|
67
|
+
onChange: L,
|
|
68
|
+
onEscape: z,
|
|
69
|
+
popoverSource: n.current.inputWrapperRef,
|
|
70
|
+
label: i || o,
|
|
71
|
+
minDate: P,
|
|
72
|
+
maxDate: O
|
|
73
|
+
}
|
|
74
|
+
));
|
|
74
75
|
};
|
|
75
76
|
v.defaultProps = {
|
|
76
77
|
ariaLabel: void 0,
|
|
@@ -102,7 +103,7 @@ v.propTypes = {
|
|
|
102
103
|
placeholder: e.string,
|
|
103
104
|
selectedDate: e.instanceOf(Date),
|
|
104
105
|
selectedDateLabel: e.func.isRequired,
|
|
105
|
-
size: e.oneOf(Object.keys(
|
|
106
|
+
size: e.oneOf(Object.keys(j.input))
|
|
106
107
|
};
|
|
107
108
|
export {
|
|
108
109
|
v as DatePicker
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("react"),W=require("prop-types"),H=require("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("react"),W=require("prop-types"),H=require("./components.cjs"),V=require("./DatePickerTd.cjs"),r=require("./DatePickerTh.cjs"),L=require("./utils/getDayOfWeek.cjs"),$=require("./utils/getMonths.cjs"),I=require("./utils/generateWeeks.cjs"),z=require("./utils/getYears.cjs"),A=require("./utils/formatDate.cjs"),d=require("../Box/Box.cjs"),G=require("../Flex/Flex.cjs"),J=require("../FocusTrap/FocusTrap.cjs"),K=require("../RawTable/RawTable.cjs");require("react/jsx-runtime");require("../RawTable/RawTableContext.cjs");const N=require("../RawTable/RawThead.cjs"),Q=require("../RawTable/RawTbody.cjs"),D=require("../RawTable/RawTr.cjs"),i=require("../SimpleMenu/SimpleMenu.cjs"),U=require("../VisuallyHidden/VisuallyHidden.cjs"),T=a=>a&&typeof a=="object"&&"default"in a?a:{default:a},e=T(f),l=T(W),m=({selectedDate:a,initialDate:g,popoverSource:E,onChange:R,label:h,minDate:k,maxDate:w,onEscape:q})=>{const[c,s]=f.useState(g),[p,y,j]=I.generateWeeks(c,a),{sun:P,mon:b,tue:x,wed:M,thu:C,fri:F,sat:O}=L.getDayOfWeek(),o=$.getMonths(),S=z.getYears(k,w);f.useEffect(()=>{a&&s(a)},[a]);const v=t=>{const n=new Date(c);n.setMonth(o.indexOf(t)),s(n)},B=t=>{const n=new Date(c);n.setFullYear(t),s(n)};return e.default.createElement(H.DatePickerPopover,{source:E,role:"dialog","aria-modal":"true","aria-label":h,spacing:4},e.default.createElement(J.FocusTrap,{onEscape:q},e.default.createElement(d.Box,{padding:4},e.default.createElement(d.Box,{paddingBottom:4,paddingLeft:2,paddingRight:2},e.default.createElement(G.Flex,null,e.default.createElement(i.SimpleMenu,{label:o[c.getMonth()]},o.map(t=>e.default.createElement(i.MenuItem,{key:t,onClick:()=>v(t)},t))),e.default.createElement(d.Box,{paddingLeft:2},e.default.createElement(i.SimpleMenu,{label:c.getFullYear()},S.map(t=>e.default.createElement(i.MenuItem,{key:t,onClick:()=>B(t)},t)))))),e.default.createElement(K.RawTable,{colCount:7,rowCount:p.length+1,initialCol:j,initialRow:y,role:"grid"},e.default.createElement(N.RawThead,null,e.default.createElement(D.RawTr,{"aria-rowindex":1},e.default.createElement(r.DatePickerTh,null,P),e.default.createElement(r.DatePickerTh,null,b),e.default.createElement(r.DatePickerTh,null,x),e.default.createElement(r.DatePickerTh,null,M),e.default.createElement(r.DatePickerTh,null,C),e.default.createElement(r.DatePickerTh,null,F),e.default.createElement(r.DatePickerTh,null,O))),e.default.createElement(Q.RawTbody,null,p.map((t,n)=>e.default.createElement(D.RawTr,{key:n},t.map(({date:u,outsideMonth:Y,isSelected:_})=>e.default.createElement(V.DatePickerTd,{key:`${u.getFullYear()}-${u.getMonth()+1}-${u.getDate()}`,outsideMonth:Y,onSelectDay:()=>R(u),isSelected:_},e.default.createElement("span",{"aria-hidden":!0},u.getDate()),e.default.createElement(U.VisuallyHidden,null,e.default.createElement("span",null,A.formatDate(u))))))))))))};m.defaultProps={selectedDate:void 0,initialDate:new Date,minDate:void 0,maxDate:void 0};m.propTypes={initialDate:l.default.instanceOf(Date),label:l.default.string.isRequired,maxDate:l.default.instanceOf(Date),minDate:l.default.instanceOf(Date),onChange:l.default.func.isRequired,onEscape:l.default.func.isRequired,popoverSource:l.default.shape({current:(typeof Element>"u"?l.default.any:l.default.instanceOf(Element)).isRequired}).isRequired,selectedDate:l.default.instanceOf(Date)};exports.DatePickerCalendar=m;
|