grommet 2.19.1 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Accordion/Accordion.js +26 -23
- package/components/Accordion/stories/CustomHeader.js +36 -34
- package/components/Accordion/stories/CustomThemed/Custom.js +2 -9
- package/components/Accordion/stories/{typescript → CustomThemed}/Rich.tsx +2 -2
- package/components/Accordion/stories/DarkNoAnimation.js +34 -32
- package/components/Accordion/stories/Multiple.js +32 -30
- package/components/Accordion/stories/Simple.js +33 -31
- package/components/Anchor/propTypes.js +1 -1
- package/components/Anchor/stories/Color.js +1 -5
- package/components/Anchor/stories/Default.js +2 -6
- package/components/Anchor/stories/Disabled.js +2 -6
- package/components/Anchor/stories/Gap.js +2 -6
- package/components/Anchor/stories/Inline.js +2 -6
- package/components/Anchor/stories/Size.js +2 -6
- package/components/Anchor/stories/Weight.js +2 -6
- package/components/Avatar/Avatar.js +12 -11
- package/components/Avatar/stories/Basic.js +23 -21
- package/components/Avatar/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/components/Avatar/stories/Round.js +35 -33
- package/components/Avatar/stories/Sizes.js +80 -78
- package/components/Avatar/stories/typescript/Stacked.tsx +10 -11
- package/components/Button/Button.js +1 -0
- package/components/Button/StyledButton.js +3 -1
- package/components/Button/StyledButtonKind.js +5 -11
- package/components/Calendar/Calendar.js +113 -87
- package/components/Calendar/StyledCalendar.js +1 -1
- package/components/Calendar/index.d.ts +4 -0
- package/components/Calendar/stories/ActiveDate.js +35 -34
- package/components/Calendar/stories/CustomDay.js +69 -67
- package/components/Calendar/stories/CustomHeader.js +39 -37
- package/{es6/components/Calendar/stories/typescript → components/Calendar/stories/CustomThemed}/CustomDate.tsx +1 -1
- package/components/Calendar/stories/{CustomSizeHeading.js → CustomThemed/CustomSizeHeading.js} +1 -1
- package/components/Calendar/stories/DaylightSavings.js +55 -53
- package/components/Calendar/stories/Dual.js +86 -84
- package/components/Calendar/stories/Fill.js +16 -14
- package/components/Calendar/stories/Multiple.js +26 -24
- package/components/Calendar/stories/Range.js +13 -11
- package/components/Calendar/stories/ShowAdjacentDays.js +36 -34
- package/components/Calendar/stories/Simple.js +24 -22
- package/components/Calendar/stories/SundayFirstDay.js +13 -11
- package/components/Calendar/utils.js +60 -10
- package/components/Card/stories/{Clickable.js → CustomThemed/Clickable.js} +2 -2
- package/components/Card/stories/{Stacked.js → CustomThemed/Stacked.js} +2 -2
- package/components/Card/stories/{Themed.js → CustomThemed/Themed.js} +2 -2
- package/components/Card/stories/Simple.js +26 -23
- package/components/Carousel/Carousel.js +145 -93
- package/components/Carousel/CarouselChild.js +17 -27
- package/components/Carousel/StyledCarousel.js +44 -0
- package/components/Carousel/index.d.ts +5 -0
- package/components/Carousel/propTypes.js +13 -9
- package/components/Carousel/stories/Autoplay.js +52 -0
- package/components/Carousel/stories/ControlVariations.js +170 -0
- package/components/Carousel/stories/Controlled.js +43 -37
- package/components/Carousel/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/components/Carousel/stories/CustomThemed/Icons.tsx +50 -0
- package/components/Carousel/stories/InteractiveChild.js +73 -0
- package/components/Carousel/stories/Multiple.js +7 -1
- package/components/Carousel/stories/Simple.js +25 -19
- package/components/Chart/Chart.js +2 -1
- package/components/Chart/calcs.js +1 -1
- package/components/Chart/utils.js +1 -1
- package/components/CheckBox/StyledCheckBox.js +1 -1
- package/components/Clock/Clock.js +1 -1
- package/components/Clock/StyledClock.js +1 -1
- package/components/Collapsible/stories/Horizontal.js +54 -50
- package/components/Collapsible/stories/Nested.js +78 -76
- package/components/Collapsible/stories/Simple.js +24 -22
- package/components/DataChart/utils.js +1 -1
- package/components/DataTable/DataTable.js +1 -1
- package/components/DataTable/StyledDataTable.js +1 -1
- package/components/DataTable/buildState.js +3 -2
- package/components/DataTable/index.d.ts +3 -3
- package/components/DataTable/stories/ColumnSize.js +63 -61
- package/components/DataTable/stories/Controlled.js +34 -32
- package/components/DataTable/stories/ControlledGrouped.js +16 -14
- package/components/DataTable/stories/{Fill.js → CustomThemed/Fill.js} +2 -2
- package/components/DataTable/stories/Grouped.js +15 -13
- package/components/DataTable/stories/GroupedOnSelect.js +16 -14
- package/components/DataTable/stories/InfiniteScrollDataTable.js +22 -20
- package/components/DataTable/stories/MultiplePin.js +48 -44
- package/components/DataTable/stories/NoPrimary.js +15 -13
- package/components/DataTable/stories/OnUpdate.js +24 -22
- package/components/DataTable/stories/Placeholder.js +27 -25
- package/components/DataTable/stories/ResizableColumns.js +17 -15
- package/components/DataTable/stories/Served.js +18 -16
- package/components/DataTable/stories/Show.js +29 -23
- package/components/DataTable/stories/Simple.js +14 -12
- package/components/DataTable/stories/Sized.js +14 -12
- package/components/DataTable/stories/Sort.js +20 -18
- package/components/DataTable/stories/SpaceX.js +36 -34
- package/components/DataTable/stories/SpaceXUngrouped.js +26 -24
- package/components/DataTable/stories/Styled.js +43 -41
- package/components/DataTable/stories/Tunable.js +19 -17
- package/components/DataTable/stories/Units.js +16 -14
- package/components/DataTable/stories/data.js +1 -1
- package/components/DataTable/stories/rowDetails.js +40 -38
- package/components/DataTable/stories/typescript/Clickable.tsx +30 -29
- package/components/DataTable/stories/typescript/OnSelect.tsx +13 -13
- package/components/DataTable/stories/typescript/Paginated.tsx +15 -15
- package/components/DateInput/DateInput.js +68 -25
- package/components/DateInput/stories/FormatInline.js +172 -16
- package/components/DateInput/stories/ResetDate.js +1 -1
- package/components/DateInput/utils.js +11 -15
- package/components/Drop/DropContainer.js +16 -9
- package/components/Drop/stories/AllNotStretched.js +166 -164
- package/components/Drop/stories/{Lazy.js → CustomThemed/Lazy.js} +1 -1
- package/components/Drop/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/components/Drop/stories/Meter.js +35 -30
- package/components/Drop/stories/Multiple.js +56 -52
- package/components/Drop/stories/Overflow.js +54 -50
- package/components/Drop/stories/Plain.js +30 -26
- package/components/Drop/stories/Progressive.js +52 -48
- package/components/Drop/stories/Simple.js +28 -24
- package/components/Drop/stories/Styled.js +45 -41
- package/components/Drop/stories/TrapFocus.js +21 -16
- package/components/DropButton/stories/Menu.js +5 -7
- package/components/DropButton/stories/Simple.js +2 -6
- package/components/DropButton/stories/typescript/Calendar.tsx +17 -20
- package/components/FileInput/stories/CustomThemed/Custom.js +5 -7
- package/components/Footer/stories/data.js +1 -1
- package/components/Form/Form.js +240 -183
- package/components/Form/stories/ArrayOfFormFields.js +161 -0
- package/components/Form/stories/FieldWithChildren.js +4 -4
- package/components/FormField/FormField.js +1 -1
- package/components/Grommet/Grommet.js +8 -1
- package/components/Layer/LayerContainer.js +9 -4
- package/components/Layer/StyledLayer.js +1 -1
- package/components/MaskedInput/StyledMaskedInput.js +1 -1
- package/components/Menu/stories/BottomControlButton.js +2 -6
- package/components/Menu/stories/{typescript → CustomThemed}/Themed.tsx +1 -1
- package/components/Menu/stories/ItemWithIcon.js +2 -6
- package/components/Menu/stories/Justify.js +2 -6
- package/components/Menu/stories/Reverse.js +2 -6
- package/components/Menu/stories/Simple.js +2 -6
- package/components/Menu/stories/typescript/Children.tsx +10 -13
- package/components/Meter/utils.js +1 -1
- package/components/NameValueList/NameValueList.js +8 -5
- package/components/NameValueList/stories/CustomValue.js +1 -1
- package/components/NameValueList/stories/data.js +1 -1
- package/components/NameValuePair/NameValuePair.js +1 -4
- package/components/Nav/stories/Collapsable.js +39 -37
- package/components/Nav/stories/{CustomAnchor.js → CustomThemed/CustomAnchor.js} +2 -2
- package/components/Nav/stories/{JustifySidebar.js → CustomThemed/JustifySidebar.js} +1 -1
- package/components/Nav/stories/OnHeader.js +29 -27
- package/components/Nav/stories/Sidebar.js +24 -18
- package/components/Nav/stories/Simple.js +15 -13
- package/components/Notification/Notification.js +2 -2
- package/components/Pagination/StyledPageControl.js +2 -2
- package/components/RadioButton/StyledRadioButton.js +1 -1
- package/components/RadioButtonGroup/RadioButtonGroup.js +3 -1
- package/components/Select/Select.js +1 -0
- package/components/Stack/stories/Fill.js +15 -11
- package/components/Stack/stories/Simple.js +15 -9
- package/components/Table/StyledTable.js +1 -1
- package/components/Table/stories/data.js +1 -1
- package/components/Tabs/StyledTabs.js +1 -1
- package/components/Tabs/Tabs.js +23 -19
- package/components/Tabs/stories/{AlignControls.js → CustomThemed/AlignControls.js} +1 -1
- package/components/Tabs/stories/{Custom.js → CustomThemed/Custom.js} +3 -3
- package/components/Tabs/stories/{Icon.js → CustomThemed/Icon.js} +1 -1
- package/components/Tabs/stories/{States.js → CustomThemed/States.js} +1 -1
- package/components/Tabs/stories/Plain.js +45 -41
- package/components/Tabs/stories/Responsive.js +191 -189
- package/components/Tabs/stories/Rich.js +30 -28
- package/components/Tabs/stories/Scrollable.js +32 -28
- package/components/Tabs/stories/Uncontrolled.js +45 -41
- package/components/Tabs/stories/typescript/Controlled.tsx +21 -21
- package/components/Tag/README.md +2 -0
- package/components/Tag/StyledTag.js +35 -0
- package/components/Tag/Tag.js +83 -0
- package/components/Tag/index.d.ts +27 -0
- package/components/Tag/index.js +8 -0
- package/components/Tag/propTypes.js +27 -0
- package/components/Tag/stories/OnClick.js +34 -0
- package/components/Tag/stories/OnRemove.js +38 -0
- package/components/Tag/stories/Simple.js +32 -0
- package/components/Text/Text.js +23 -9
- package/components/TextInput/StyledTextInput.js +1 -1
- package/components/TextInput/TextInput.js +14 -2
- package/components/TextInput/index.d.ts +6 -1
- package/components/Video/Video.js +98 -38
- package/components/Video/index.d.ts +15 -2
- package/components/Video/propTypes.js +8 -1
- package/components/Video/stories/typescript/TheaterMode.tsx +46 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +8 -0
- package/contexts/MessageContext/MessageContext.js +3 -2
- package/contexts/MessageContext/index.js +1 -1
- package/es6/components/Accordion/Accordion.js +26 -23
- package/es6/components/Accordion/stories/CustomHeader.js +37 -34
- package/es6/components/Accordion/stories/CustomThemed/Custom.js +2 -9
- package/es6/components/Accordion/stories/{typescript → CustomThemed}/Rich.tsx +2 -2
- package/es6/components/Accordion/stories/DarkNoAnimation.js +35 -32
- package/es6/components/Accordion/stories/Multiple.js +33 -30
- package/es6/components/Accordion/stories/Simple.js +34 -31
- package/es6/components/Anchor/propTypes.js +1 -1
- package/es6/components/Anchor/stories/Color.js +2 -5
- package/es6/components/Anchor/stories/Default.js +3 -6
- package/es6/components/Anchor/stories/Disabled.js +3 -6
- package/es6/components/Anchor/stories/Gap.js +3 -6
- package/es6/components/Anchor/stories/Inline.js +3 -6
- package/es6/components/Anchor/stories/Size.js +3 -6
- package/es6/components/Anchor/stories/Weight.js +3 -6
- package/es6/components/Avatar/Avatar.js +13 -12
- package/es6/components/Avatar/stories/Basic.js +24 -21
- package/es6/components/Avatar/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/es6/components/Avatar/stories/Round.js +36 -33
- package/es6/components/Avatar/stories/Sizes.js +81 -78
- package/es6/components/Avatar/stories/typescript/Stacked.tsx +10 -11
- package/es6/components/Button/Button.js +1 -0
- package/es6/components/Button/StyledButton.js +3 -1
- package/es6/components/Button/StyledButtonKind.js +4 -11
- package/es6/components/Calendar/Calendar.js +114 -88
- package/es6/components/Calendar/index.d.ts +4 -0
- package/es6/components/Calendar/stories/ActiveDate.js +36 -34
- package/es6/components/Calendar/stories/CustomDay.js +70 -67
- package/es6/components/Calendar/stories/CustomHeader.js +40 -37
- package/{components/Calendar/stories/typescript → es6/components/Calendar/stories/CustomThemed}/CustomDate.tsx +1 -1
- package/es6/components/Calendar/stories/{CustomSizeHeading.js → CustomThemed/CustomSizeHeading.js} +1 -1
- package/es6/components/Calendar/stories/DaylightSavings.js +56 -53
- package/es6/components/Calendar/stories/Dual.js +87 -84
- package/es6/components/Calendar/stories/Fill.js +17 -14
- package/es6/components/Calendar/stories/Multiple.js +25 -22
- package/es6/components/Calendar/stories/Range.js +14 -11
- package/es6/components/Calendar/stories/ShowAdjacentDays.js +37 -34
- package/es6/components/Calendar/stories/Simple.js +25 -22
- package/es6/components/Calendar/stories/SundayFirstDay.js +14 -11
- package/es6/components/Calendar/utils.js +48 -4
- package/es6/components/Card/stories/{Clickable.js → CustomThemed/Clickable.js} +2 -2
- package/es6/components/Card/stories/{Stacked.js → CustomThemed/Stacked.js} +2 -2
- package/es6/components/Card/stories/{Themed.js → CustomThemed/Themed.js} +2 -2
- package/es6/components/Card/stories/Simple.js +27 -24
- package/es6/components/Carousel/Carousel.js +145 -94
- package/es6/components/Carousel/CarouselChild.js +17 -25
- package/es6/components/Carousel/StyledCarousel.js +31 -0
- package/es6/components/Carousel/index.d.ts +5 -0
- package/es6/components/Carousel/propTypes.js +13 -9
- package/es6/components/Carousel/stories/Autoplay.js +41 -0
- package/es6/components/Carousel/stories/ControlVariations.js +161 -0
- package/es6/components/Carousel/stories/Controlled.js +44 -38
- package/es6/components/Carousel/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/es6/components/Carousel/stories/CustomThemed/Icons.tsx +50 -0
- package/es6/components/Carousel/stories/InteractiveChild.js +61 -0
- package/es6/components/Carousel/stories/Multiple.js +8 -2
- package/es6/components/Carousel/stories/Simple.js +26 -20
- package/es6/components/Chart/Chart.js +2 -1
- package/es6/components/Clock/Clock.js +1 -1
- package/es6/components/Collapsible/stories/Horizontal.js +55 -50
- package/es6/components/Collapsible/stories/Nested.js +79 -76
- package/es6/components/Collapsible/stories/Simple.js +25 -22
- package/es6/components/DataTable/DataTable.js +1 -1
- package/es6/components/DataTable/buildState.js +2 -1
- package/es6/components/DataTable/index.d.ts +3 -3
- package/es6/components/DataTable/stories/ColumnSize.js +64 -61
- package/es6/components/DataTable/stories/Controlled.js +35 -32
- package/es6/components/DataTable/stories/ControlledGrouped.js +17 -14
- package/es6/components/DataTable/stories/{Fill.js → CustomThemed/Fill.js} +2 -2
- package/es6/components/DataTable/stories/Grouped.js +16 -13
- package/es6/components/DataTable/stories/GroupedOnSelect.js +17 -14
- package/es6/components/DataTable/stories/InfiniteScrollDataTable.js +23 -20
- package/es6/components/DataTable/stories/MultiplePin.js +49 -45
- package/es6/components/DataTable/stories/NoPrimary.js +16 -13
- package/es6/components/DataTable/stories/OnUpdate.js +25 -22
- package/es6/components/DataTable/stories/Placeholder.js +28 -25
- package/es6/components/DataTable/stories/ResizableColumns.js +18 -15
- package/es6/components/DataTable/stories/Served.js +19 -16
- package/es6/components/DataTable/stories/Show.js +27 -21
- package/es6/components/DataTable/stories/Simple.js +15 -12
- package/es6/components/DataTable/stories/Sized.js +15 -12
- package/es6/components/DataTable/stories/Sort.js +21 -18
- package/es6/components/DataTable/stories/SpaceX.js +37 -34
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +27 -24
- package/es6/components/DataTable/stories/Styled.js +44 -41
- package/es6/components/DataTable/stories/Tunable.js +20 -17
- package/es6/components/DataTable/stories/Units.js +17 -14
- package/es6/components/DataTable/stories/rowDetails.js +41 -38
- package/es6/components/DataTable/stories/typescript/Clickable.tsx +30 -29
- package/es6/components/DataTable/stories/typescript/OnSelect.tsx +13 -13
- package/es6/components/DataTable/stories/typescript/Paginated.tsx +15 -15
- package/es6/components/DateInput/DateInput.js +63 -23
- package/es6/components/DateInput/stories/FormatInline.js +169 -16
- package/es6/components/DateInput/utils.js +9 -11
- package/es6/components/Drop/DropContainer.js +15 -9
- package/es6/components/Drop/stories/AllNotStretched.js +167 -164
- package/es6/components/Drop/stories/{Lazy.js → CustomThemed/Lazy.js} +1 -1
- package/es6/components/Drop/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/es6/components/Drop/stories/Meter.js +36 -30
- package/es6/components/Drop/stories/Multiple.js +57 -52
- package/es6/components/Drop/stories/Overflow.js +55 -50
- package/es6/components/Drop/stories/Plain.js +31 -26
- package/es6/components/Drop/stories/Progressive.js +53 -48
- package/es6/components/Drop/stories/Simple.js +29 -24
- package/es6/components/Drop/stories/Styled.js +46 -41
- package/es6/components/Drop/stories/TrapFocus.js +22 -17
- package/es6/components/DropButton/stories/Menu.js +6 -7
- package/es6/components/DropButton/stories/Simple.js +3 -6
- package/es6/components/DropButton/stories/typescript/Calendar.tsx +17 -20
- package/es6/components/FileInput/stories/CustomThemed/Custom.js +5 -7
- package/es6/components/Form/Form.js +240 -183
- package/es6/components/Form/stories/ArrayOfFormFields.js +147 -0
- package/es6/components/Form/stories/FieldWithChildren.js +4 -4
- package/es6/components/FormField/FormField.js +2 -2
- package/es6/components/Grommet/Grommet.js +8 -1
- package/es6/components/Layer/LayerContainer.js +9 -4
- package/es6/components/Menu/stories/BottomControlButton.js +3 -6
- package/es6/components/Menu/stories/{typescript → CustomThemed}/Themed.tsx +1 -1
- package/es6/components/Menu/stories/ItemWithIcon.js +3 -6
- package/es6/components/Menu/stories/Justify.js +3 -6
- package/es6/components/Menu/stories/Reverse.js +3 -6
- package/es6/components/Menu/stories/Simple.js +3 -6
- package/es6/components/Menu/stories/typescript/Children.tsx +10 -13
- package/es6/components/NameValueList/NameValueList.js +9 -6
- package/es6/components/NameValueList/stories/CustomValue.js +1 -1
- package/es6/components/NameValuePair/NameValuePair.js +1 -4
- package/es6/components/Nav/stories/Collapsable.js +40 -37
- package/es6/components/Nav/stories/{CustomAnchor.js → CustomThemed/CustomAnchor.js} +2 -2
- package/es6/components/Nav/stories/{JustifySidebar.js → CustomThemed/JustifySidebar.js} +1 -1
- package/es6/components/Nav/stories/OnHeader.js +30 -27
- package/es6/components/Nav/stories/Sidebar.js +25 -19
- package/es6/components/Nav/stories/Simple.js +16 -13
- package/es6/components/Notification/Notification.js +2 -2
- package/es6/components/Pagination/StyledPageControl.js +1 -1
- package/es6/components/RadioButtonGroup/RadioButtonGroup.js +3 -1
- package/es6/components/Select/Select.js +1 -0
- package/es6/components/Stack/stories/Fill.js +16 -11
- package/es6/components/Stack/stories/Simple.js +16 -10
- package/es6/components/Tabs/Tabs.js +23 -20
- package/es6/components/Tabs/stories/{AlignControls.js → CustomThemed/AlignControls.js} +1 -1
- package/es6/components/Tabs/stories/{Custom.js → CustomThemed/Custom.js} +3 -3
- package/es6/components/Tabs/stories/{Icon.js → CustomThemed/Icon.js} +1 -1
- package/es6/components/Tabs/stories/{States.js → CustomThemed/States.js} +1 -1
- package/es6/components/Tabs/stories/Plain.js +45 -40
- package/es6/components/Tabs/stories/Responsive.js +191 -188
- package/es6/components/Tabs/stories/Rich.js +30 -27
- package/es6/components/Tabs/stories/Scrollable.js +32 -27
- package/es6/components/Tabs/stories/Uncontrolled.js +45 -40
- package/es6/components/Tabs/stories/typescript/Controlled.tsx +21 -21
- package/es6/components/Tag/README.md +2 -0
- package/es6/components/Tag/StyledTag.js +22 -0
- package/es6/components/Tag/Tag.js +66 -0
- package/es6/components/Tag/index.d.ts +27 -0
- package/es6/components/Tag/index.js +1 -0
- package/es6/components/Tag/propTypes.js +17 -0
- package/es6/components/Tag/stories/OnClick.js +22 -0
- package/es6/components/Tag/stories/OnRemove.js +26 -0
- package/es6/components/Tag/stories/Simple.js +20 -0
- package/es6/components/Text/Text.js +23 -10
- package/es6/components/TextInput/TextInput.js +14 -2
- package/es6/components/TextInput/index.d.ts +6 -1
- package/es6/components/Video/Video.js +99 -39
- package/es6/components/Video/index.d.ts +15 -2
- package/es6/components/Video/propTypes.js +8 -1
- package/es6/components/Video/stories/typescript/TheaterMode.tsx +46 -0
- package/es6/components/index.d.ts +1 -0
- package/es6/components/index.js +1 -0
- package/es6/contexts/MessageContext/MessageContext.js +2 -1
- package/es6/index.d.ts +1 -0
- package/es6/languages/default.json +9 -2
- package/es6/themes/base.d.ts +25 -11
- package/es6/themes/base.js +21 -2
- package/es6/utils/DOM.js +13 -3
- package/es6/utils/background.js +2 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/index.d.ts +1 -0
- package/languages/default.json +9 -2
- package/package.json +53 -52
- package/themes/base.d.ts +25 -11
- package/themes/base.js +22 -3
- package/themes/index.js +1 -1
- package/utils/DOM.js +20 -4
- package/utils/animation.js +1 -1
- package/utils/background.js +3 -2
- package/utils/border.js +1 -1
- package/utils/colors.js +1 -1
- package/utils/general-prop-types.js +1 -1
- package/utils/graphics.js +1 -1
- package/utils/mixins.js +1 -1
- package/utils/object.js +1 -1
- package/utils/responsive.js +1 -1
- package/utils/styles.js +1 -1
- package/utils/use-isomorphic-layout-effect.js +1 -1
- package/components/Carousel/stories/InitialChild.js +0 -43
- package/components/Carousel/stories/WithClickableChild.js +0 -51
- package/components/Carousel/stories/WithoutControls.js +0 -44
- package/es6/components/Carousel/stories/InitialChild.js +0 -32
- package/es6/components/Carousel/stories/WithClickableChild.js +0 -40
- package/es6/components/Carousel/stories/WithoutControls.js +0 -33
|
@@ -1,84 +1,87 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Avatar, Box,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Avatar, Box, Paragraph } from 'grommet';
|
|
4
3
|
export var Sizes = function Sizes() {
|
|
5
4
|
var src = '//s.gravatar.com/avatar/b7fb138d53ba0f573212ccce38a7c43b?s=80';
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
5
|
+
return (
|
|
6
|
+
/*#__PURE__*/
|
|
7
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
8
|
+
// <Grommet theme={grommet}>
|
|
9
|
+
React.createElement(Box, null, /*#__PURE__*/React.createElement(Box, {
|
|
10
|
+
direction: "row",
|
|
11
|
+
pad: "large",
|
|
12
|
+
gap: "small"
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
14
|
+
size: "small",
|
|
15
|
+
src: src
|
|
16
|
+
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
17
|
+
size: "medium",
|
|
18
|
+
src: src
|
|
19
|
+
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
20
|
+
size: "large",
|
|
21
|
+
src: src
|
|
22
|
+
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
23
|
+
size: "xlarge",
|
|
24
|
+
src: src
|
|
25
|
+
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
26
|
+
size: "2xl",
|
|
27
|
+
src: src
|
|
28
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
29
|
+
direction: "row",
|
|
30
|
+
pad: "large",
|
|
31
|
+
align: "center",
|
|
32
|
+
gap: "small"
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
34
|
+
background: "dark-2",
|
|
35
|
+
size: "small"
|
|
36
|
+
}, "S"), /*#__PURE__*/React.createElement(Avatar, {
|
|
37
|
+
background: "dark-2",
|
|
38
|
+
size: "medium"
|
|
39
|
+
}, "LS"), /*#__PURE__*/React.createElement(Avatar, {
|
|
40
|
+
background: "dark-2",
|
|
41
|
+
size: "large"
|
|
42
|
+
}, "JF"), /*#__PURE__*/React.createElement(Avatar, {
|
|
43
|
+
background: "dark-2",
|
|
44
|
+
size: "xlarge"
|
|
45
|
+
}, "SY"), /*#__PURE__*/React.createElement(Avatar, {
|
|
46
|
+
background: "dark-2",
|
|
47
|
+
size: "2xl"
|
|
48
|
+
}, "SOS")), /*#__PURE__*/React.createElement(Box, {
|
|
49
|
+
margin: {
|
|
50
|
+
vertical: 'xlarge'
|
|
51
|
+
}
|
|
52
|
+
}, /*#__PURE__*/React.createElement(Paragraph, {
|
|
53
|
+
textAlign: "center",
|
|
54
|
+
align: "center"
|
|
55
|
+
}, "Larger Avatars"), /*#__PURE__*/React.createElement(Box, {
|
|
56
|
+
direction: "row",
|
|
57
|
+
pad: "large",
|
|
58
|
+
align: "center",
|
|
59
|
+
gap: "small"
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
61
|
+
background: "dark-2",
|
|
62
|
+
size: "3xl"
|
|
63
|
+
}, "3xl"), /*#__PURE__*/React.createElement(Avatar, {
|
|
64
|
+
background: "dark-2",
|
|
65
|
+
size: "4xl"
|
|
66
|
+
}, "4xl"), /*#__PURE__*/React.createElement(Avatar, {
|
|
67
|
+
background: "dark-2",
|
|
68
|
+
size: "5xl"
|
|
69
|
+
}, "5xl")), /*#__PURE__*/React.createElement(Box, {
|
|
70
|
+
direction: "row",
|
|
71
|
+
pad: "large",
|
|
72
|
+
gap: "small"
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
74
|
+
size: "3xl",
|
|
75
|
+
src: src
|
|
76
|
+
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
77
|
+
size: "4xl",
|
|
78
|
+
src: src
|
|
79
|
+
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
80
|
+
size: "5xl",
|
|
81
|
+
src: src
|
|
82
|
+
})))) // </Grommet>
|
|
83
|
+
|
|
84
|
+
);
|
|
82
85
|
};
|
|
83
86
|
export default {
|
|
84
87
|
title: 'Visualizations/Avatar/Sizes'
|
|
@@ -2,8 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Favorite, UserFemale, UserNew } from 'grommet-icons';
|
|
4
4
|
|
|
5
|
-
import { Avatar, Box,
|
|
6
|
-
import { grommet } from 'grommet/themes';
|
|
5
|
+
import { Avatar, Box, Stack } from 'grommet';
|
|
7
6
|
|
|
8
7
|
export const Stacked = () => {
|
|
9
8
|
const shimi = '//s.gravatar.com/avatar/b7fb138d53ba0f573212ccce38a7c43b?s=80';
|
|
@@ -37,20 +36,20 @@ export const Stacked = () => {
|
|
|
37
36
|
|
|
38
37
|
const GroupedIcons = () => (
|
|
39
38
|
<Stack anchor="left">
|
|
40
|
-
<Avatar background="
|
|
41
|
-
<UserNew color="
|
|
39
|
+
<Avatar background="dark-1">
|
|
40
|
+
<UserNew color="light-2" />
|
|
42
41
|
</Avatar>
|
|
43
|
-
<Avatar background="
|
|
44
|
-
<UserFemale color="
|
|
42
|
+
<Avatar background="dark-2" margin={{ left: 'medium' }}>
|
|
43
|
+
<UserFemale color="light-1" />
|
|
45
44
|
</Avatar>
|
|
46
|
-
<Avatar background="
|
|
47
|
-
<Favorite color="
|
|
45
|
+
<Avatar background="dark-4" margin={{ left: 'large' }}>
|
|
46
|
+
<Favorite color="light-2" />
|
|
48
47
|
</Avatar>
|
|
49
48
|
</Stack>
|
|
50
49
|
);
|
|
51
50
|
|
|
52
51
|
return (
|
|
53
|
-
<
|
|
52
|
+
<Box>
|
|
54
53
|
<Box align="center" gap="medium" pad="large" background="dark-1">
|
|
55
54
|
{/* Nested Avatars */}
|
|
56
55
|
<Stack anchor="bottom-right">
|
|
@@ -67,7 +66,7 @@ export const Stacked = () => {
|
|
|
67
66
|
{/* Notification */}
|
|
68
67
|
<Stack anchor="top-right">
|
|
69
68
|
<Avatar src={shimi} />
|
|
70
|
-
<Box pad="xsmall" round background="
|
|
69
|
+
<Box pad="xsmall" round background="light-1" responsive={false} />
|
|
71
70
|
</Stack>
|
|
72
71
|
|
|
73
72
|
{/* Groups */}
|
|
@@ -76,7 +75,7 @@ export const Stacked = () => {
|
|
|
76
75
|
<GroupedGravatarCentered />
|
|
77
76
|
<GroupedGravatarRTL />
|
|
78
77
|
</Box>
|
|
79
|
-
</
|
|
78
|
+
</Box>
|
|
80
79
|
);
|
|
81
80
|
};
|
|
82
81
|
|
|
@@ -81,7 +81,9 @@ var activeButtonStyle = function activeButtonStyle(props) {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
var disabledButtonStyle = function disabledButtonStyle(props) {
|
|
84
|
-
return css(["", " ", " ", " ", ""], disabledStyle(props.theme.button.disabled.opacity), !props.plain && props.theme.button.disabled.border && props.theme.button.disabled.border.color && "border: " + props.theme.button.border.width + " solid\n " + normalizeColor(props.theme.button.disabled.border.color, props.theme) + ";", props.theme.button.disabled.color && (
|
|
84
|
+
return css(["", " ", " ", " ", ""], disabledStyle(props.theme.button.disabled.opacity), !props.plain && props.theme.button.disabled.border && props.theme.button.disabled.border.color && "border: " + props.theme.button.border.width + " solid\n " + normalizeColor(props.theme.button.disabled.border.color, props.theme) + ";", props.theme.button.disabled.color && ( // if primary button, apply disabled color to background. otherwise,
|
|
85
|
+
// apply disabled color to the label
|
|
86
|
+
props.primary ? backgroundStyle(normalizeColor(props.theme.button.disabled.color, props.theme), props.theme, props.theme.button.color) : "color: " + normalizeColor(props.theme.button.disabled.color, props.theme) + ";"), props.theme.button.disabled && props.theme.button.disabled.extend);
|
|
85
87
|
}; // Deprecate props.theme.button.disabled.opacity in V3
|
|
86
88
|
|
|
87
89
|
|
|
@@ -49,12 +49,10 @@ var padStyle = function padStyle(_ref) {
|
|
|
49
49
|
var themeObj = typeof kind === 'object' ? kind : theme.button;
|
|
50
50
|
var pad = padFromTheme(size, theme, themeObj);
|
|
51
51
|
return pad ? css(["padding:", " ", ";"], pad.vertical, pad.horizontal) : '';
|
|
52
|
-
};
|
|
53
|
-
// vertical height internally.
|
|
54
|
-
|
|
52
|
+
};
|
|
55
53
|
|
|
56
54
|
var basicStyle = function basicStyle(props) {
|
|
57
|
-
return css(["border:none;", ";", " ", " ", ""], radiusStyle(props), padStyle(props), fontStyle(props), props.
|
|
55
|
+
return css(["border:none;", ";", " ", " ", ""], radiusStyle(props), padStyle(props), fontStyle(props), props.icon && "\n > svg {\n display: flex;\n align-self: center;\n }\n ");
|
|
58
56
|
};
|
|
59
57
|
|
|
60
58
|
var getPath = function getPath(theme, path) {
|
|
@@ -168,14 +166,9 @@ var fillStyle = function fillStyle(fillContainer) {
|
|
|
168
166
|
}
|
|
169
167
|
|
|
170
168
|
return undefined;
|
|
171
|
-
}; // The > svg rule is to ensure Buttons with just an icon don't add additional
|
|
172
|
-
// vertical height internally.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
var plainStyle = function plainStyle() {
|
|
176
|
-
return css(["outline:none;border:none;padding:0;text-align:inherit;color:inherit;> svg{vertical-align:bottom;}"]);
|
|
177
169
|
};
|
|
178
170
|
|
|
171
|
+
var plainStyle = css(["outline:none;border:none;padding:0;text-align:inherit;color:inherit;"]);
|
|
179
172
|
var StyledButtonKind = styled.button.withConfig({
|
|
180
173
|
// don't let kind attribute leak to DOM
|
|
181
174
|
// https://styled-components.com/docs/api#shouldforwardprop
|
|
@@ -186,7 +179,7 @@ var StyledButtonKind = styled.button.withConfig({
|
|
|
186
179
|
displayName: "StyledButtonKind",
|
|
187
180
|
componentId: "sc-1vhfpnt-0"
|
|
188
181
|
})(["display:inline-block;box-sizing:border-box;cursor:pointer;font:inherit;text-decoration:none;margin:0;background:transparent;overflow:visible;text-transform:none;", " ", " ", " ", " ", " ", " ", " ", " &:focus{", "}&:focus:not(:focus-visible){", "}", " ", " ", ""], genericStyles, function (props) {
|
|
189
|
-
return props.plain && plainStyle
|
|
182
|
+
return props.plain && plainStyle;
|
|
190
183
|
}, function (props) {
|
|
191
184
|
return !props.disabled && props.active && activeStyle;
|
|
192
185
|
}, function (props) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["activeDate", "animate", "bounds", "children", "date", "dates", "daysOfWeek", "disabled", "initialFocus", "fill", "firstDayOfWeek", "header", "locale", "messages", "onReference", "onSelect", "range", "reference", "showAdjacentDays", "size"];
|
|
1
|
+
var _excluded = ["activeDate", "animate", "bounds", "children", "date", "dates", "daysOfWeek", "disabled", "initialFocus", "fill", "firstDayOfWeek", "header", "locale", "messages", "onReference", "onSelect", "range", "reference", "showAdjacentDays", "size", "timestamp"];
|
|
2
2
|
|
|
3
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ import { Button } from '../Button';
|
|
|
14
14
|
import { Heading } from '../Heading';
|
|
15
15
|
import { Keyboard } from '../Keyboard';
|
|
16
16
|
import { StyledCalendar, StyledDay, StyledDayContainer, StyledWeek, StyledWeeks, StyledWeeksContainer } from './StyledCalendar';
|
|
17
|
-
import { addDays, addMonths, betweenDates, daysApart, endOfMonth, formatToLocalYYYYMMDD,
|
|
17
|
+
import { addDays, addMonths, betweenDates, daysApart, endOfMonth, formatDateToPropStructure, formatToLocalYYYYMMDD, getTimestamp, normalizeForTimezone, startOfMonth, subtractDays, subtractMonths, withinDates } from './utils';
|
|
18
18
|
import { CalendarPropTypes } from './propTypes';
|
|
19
19
|
var headingPadMap = {
|
|
20
20
|
small: 'xsmall',
|
|
@@ -25,10 +25,10 @@ var activeDates = {
|
|
|
25
25
|
start: 'start',
|
|
26
26
|
end: 'end'
|
|
27
27
|
};
|
|
28
|
-
var timeStamp =
|
|
28
|
+
var timeStamp = /T.*/;
|
|
29
29
|
|
|
30
30
|
var formatSelectedDatesString = function formatSelectedDatesString(date) {
|
|
31
|
-
return "Currently selected
|
|
31
|
+
return "Currently selected\n " + (date == null ? void 0 : date.map(function (item) {
|
|
32
32
|
var dates;
|
|
33
33
|
|
|
34
34
|
if (!Array.isArray(item)) {
|
|
@@ -57,18 +57,50 @@ var getAccessibilityString = function getAccessibilityString(date, dates) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
return 'No date selected';
|
|
60
|
-
};
|
|
60
|
+
}; // function that runs inside the useEffect for date and dates
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
var normalizeDate = function normalizeDate(dateValue, timestamp) {
|
|
64
|
+
if (typeof dateValue === 'string') {
|
|
65
|
+
return normalizeForTimezone(dateValue, timestamp);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (Array.isArray(dateValue)) {
|
|
69
|
+
if (Array.isArray(dateValue[0])) {
|
|
70
|
+
var _dateValue$0$map = dateValue[0].map(function (day) {
|
|
71
|
+
return normalizeForTimezone(day, timestamp) || undefined;
|
|
72
|
+
}),
|
|
73
|
+
from = _dateValue$0$map[0],
|
|
74
|
+
to = _dateValue$0$map[1];
|
|
75
|
+
|
|
76
|
+
return [[from, to]];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var dateArray = [];
|
|
80
|
+
dateValue.forEach(function (d) {
|
|
81
|
+
if (Array.isArray(d)) {
|
|
82
|
+
var _d$map = d.map(function (day) {
|
|
83
|
+
return normalizeForTimezone(day, timestamp);
|
|
84
|
+
}),
|
|
85
|
+
_from = _d$map[0],
|
|
86
|
+
_to = _d$map[1];
|
|
87
|
+
|
|
88
|
+
dateArray.push([_from, _to]);
|
|
89
|
+
} else {
|
|
90
|
+
dateArray.push(normalizeForTimezone(d, timestamp));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return dateArray;
|
|
94
|
+
}
|
|
61
95
|
|
|
62
|
-
|
|
63
|
-
if (!date) return undefined;
|
|
64
|
-
return (!timeStamp.test(refDate || date) ? localTimezoneToUTC(new Date(date)) : new Date(date)).toISOString();
|
|
96
|
+
return undefined;
|
|
65
97
|
};
|
|
66
98
|
|
|
67
|
-
var normalizeReference = function normalizeReference(reference, date, dates) {
|
|
99
|
+
var normalizeReference = function normalizeReference(reference, date, dates, timestamp) {
|
|
68
100
|
var normalizedReference;
|
|
69
101
|
|
|
70
102
|
if (reference) {
|
|
71
|
-
normalizedReference = new Date(reference);
|
|
103
|
+
normalizedReference = new Date(normalizeForTimezone(reference, timestamp));
|
|
72
104
|
} else if (date) {
|
|
73
105
|
if (typeof date === 'string') {
|
|
74
106
|
normalizedReference = new Date(date);
|
|
@@ -106,7 +138,8 @@ var buildDisplayBounds = function buildDisplayBounds(reference, firstDayOfWeek)
|
|
|
106
138
|
// to be the first day of the week, then we need to include Sunday and six
|
|
107
139
|
// days prior.
|
|
108
140
|
|
|
109
|
-
start = start.getDay() === 0 && firstDayOfWeek === 1 ? start = subtractDays(start, 6) :
|
|
141
|
+
start = start.getDay() === 0 && firstDayOfWeek === 1 ? start = subtractDays(start, 6) : // beginning of week
|
|
142
|
+
start = subtractDays(start, start.getDay() - firstDayOfWeek);
|
|
110
143
|
var end = addDays(start, 7 * 5 + 7); // 5 weeks to end of week
|
|
111
144
|
|
|
112
145
|
return [start, end];
|
|
@@ -195,6 +228,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
195
228
|
showAdjacentDays = _ref3$showAdjacentDay === void 0 ? true : _ref3$showAdjacentDay,
|
|
196
229
|
_ref3$size = _ref3.size,
|
|
197
230
|
size = _ref3$size === void 0 ? 'medium' : _ref3$size,
|
|
231
|
+
timestampProp = _ref3.timestamp,
|
|
198
232
|
rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
199
233
|
|
|
200
234
|
var theme = useContext(ThemeContext) || defaultProps.theme;
|
|
@@ -233,91 +267,68 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
233
267
|
|
|
234
268
|
useEffect(function () {
|
|
235
269
|
if (activeDateProp) setActiveDate(activeDateProp);
|
|
236
|
-
}, [activeDateProp]);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
270
|
+
}, [activeDateProp]);
|
|
271
|
+
var timestamp = useMemo(function () {
|
|
272
|
+
return timestampProp;
|
|
273
|
+
}, [timestampProp]);
|
|
274
|
+
|
|
275
|
+
if (timestampProp === undefined) {
|
|
276
|
+
if (Array.isArray(dateProp) && dateProp.length) {
|
|
277
|
+
if (Array.isArray(dateProp[0])) {
|
|
278
|
+
timestamp = getTimestamp(dateProp[0][0]);
|
|
279
|
+
} else timestamp = getTimestamp(dateProp[0]); // check to see if value is not an empty string
|
|
280
|
+
// empty string should behave like undefined
|
|
281
|
+
|
|
282
|
+
} else if (typeof dateProp === 'string' && dateProp.length) {
|
|
283
|
+
timestamp = getTimestamp(dateProp);
|
|
284
|
+
} else if (Array.isArray(datesProp) && datesProp.length) {
|
|
285
|
+
if (Array.isArray(datesProp[0])) {
|
|
286
|
+
timestamp = getTimestamp(datesProp[0][0]);
|
|
287
|
+
} else timestamp = getTimestamp(datesProp[0]);
|
|
288
|
+
} else if (typeof datesProp === 'string') {
|
|
289
|
+
timestamp = getTimestamp(datesProp);
|
|
290
|
+
} else if (typeof referenceProp === 'string') {
|
|
291
|
+
timestamp = getTimestamp(referenceProp);
|
|
242
292
|
}
|
|
293
|
+
}
|
|
243
294
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return day ? new Date(day) : undefined;
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
from = _dateValue$0$map[0];
|
|
254
|
-
to = _dateValue$0$map[1];
|
|
255
|
-
if (from) from = normalizeForTimezone(from, dateValue[0][0]);
|
|
256
|
-
if (to) to = normalizeForTimezone(to, dateValue[0][0]);
|
|
257
|
-
return [[from, to]];
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
var dateArray = [];
|
|
261
|
-
dateValue.forEach(function (d) {
|
|
262
|
-
if (Array.isArray(d)) {
|
|
263
|
-
var _from;
|
|
264
|
-
|
|
265
|
-
var _to;
|
|
266
|
-
|
|
267
|
-
var _d$map = d.map(function (day) {
|
|
268
|
-
return new Date(day);
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
_from = _d$map[0];
|
|
272
|
-
_to = _d$map[1];
|
|
273
|
-
_from = normalizeForTimezone(_from, d[0]);
|
|
274
|
-
_to = normalizeForTimezone(_to, d[0]);
|
|
275
|
-
dateArray.push([_from, _to]);
|
|
276
|
-
} else {
|
|
277
|
-
dateArray.push(normalizeForTimezone(d));
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
return dateArray;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
return undefined;
|
|
284
|
-
}; // set date when caller changes it, allows us to change it internally too
|
|
285
|
-
|
|
295
|
+
var normalizedDate = useMemo(function () {
|
|
296
|
+
return timestampProp === undefined ? normalizeDate(dateProp, timestamp) : dateProp;
|
|
297
|
+
}, [dateProp, timestamp, timestampProp]);
|
|
298
|
+
var normalizedDates = useMemo(function () {
|
|
299
|
+
return timestampProp === undefined ? normalizeDate(datesProp, timestamp) : datesProp;
|
|
300
|
+
}, [datesProp, timestamp, timestampProp]); // set date when caller changes it, allows us to change it internally too
|
|
286
301
|
|
|
287
|
-
var _useState3 = useState(
|
|
302
|
+
var _useState3 = useState(normalizedDate),
|
|
288
303
|
date = _useState3[0],
|
|
289
304
|
setDate = _useState3[1];
|
|
290
305
|
|
|
291
306
|
useEffect(function () {
|
|
292
|
-
setDate(
|
|
293
|
-
}, [
|
|
307
|
+
setDate(normalizedDate);
|
|
308
|
+
}, [normalizedDate]); // set dates when caller changes it, allows us to change it internally too
|
|
294
309
|
|
|
295
|
-
var _useState4 = useState(
|
|
310
|
+
var _useState4 = useState(normalizedDates),
|
|
296
311
|
dates = _useState4[0],
|
|
297
312
|
setDates = _useState4[1];
|
|
298
313
|
|
|
299
314
|
useEffect(function () {
|
|
300
|
-
setDates(
|
|
301
|
-
}, [
|
|
315
|
+
setDates(normalizedDates);
|
|
316
|
+
}, [normalizedDates]); // set reference based on what the caller passed or date/dates.
|
|
302
317
|
|
|
303
|
-
var _useState5 = useState(normalizeReference(referenceProp,
|
|
318
|
+
var _useState5 = useState(normalizeReference(referenceProp, normalizedDate, normalizedDates, timestamp)),
|
|
304
319
|
reference = _useState5[0],
|
|
305
320
|
setReference = _useState5[1];
|
|
306
321
|
|
|
307
322
|
useEffect(function () {
|
|
308
|
-
return setReference(normalizeReference(referenceProp,
|
|
309
|
-
}, [
|
|
323
|
+
return setReference(normalizeReference(referenceProp, normalizedDate, normalizedDates, timestamp));
|
|
324
|
+
}, [referenceProp, normalizedDate, normalizedDates, timestamp]); // normalize bounds
|
|
310
325
|
|
|
311
|
-
var _useState6 = useState(boundsProp
|
|
312
|
-
return normalizeForTimezone(b);
|
|
313
|
-
}) : undefined),
|
|
326
|
+
var _useState6 = useState(boundsProp),
|
|
314
327
|
bounds = _useState6[0],
|
|
315
328
|
setBounds = _useState6[1];
|
|
316
329
|
|
|
317
330
|
useEffect(function () {
|
|
318
|
-
if (boundsProp) setBounds(boundsProp
|
|
319
|
-
return normalizeForTimezone(b);
|
|
320
|
-
}));else setBounds(undefined);
|
|
331
|
+
if (boundsProp) setBounds(boundsProp);else setBounds(undefined);
|
|
321
332
|
}, [boundsProp]); // calculate the bounds we display based on the reference
|
|
322
333
|
|
|
323
334
|
var _useState7 = useState(buildDisplayBounds(reference, firstDayOfWeek)),
|
|
@@ -451,7 +462,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
451
462
|
var adjustedDate;
|
|
452
463
|
|
|
453
464
|
if (!range) {
|
|
454
|
-
nextDate = selectedDate;
|
|
465
|
+
nextDate = formatDateToPropStructure(selectedDate, timestamp);
|
|
455
466
|
|
|
456
467
|
if (datesProp) {
|
|
457
468
|
datesProp.forEach(function (d) {
|
|
@@ -575,7 +586,9 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
575
586
|
setDates(nextDates);
|
|
576
587
|
|
|
577
588
|
if (date && typeof date === 'string') {
|
|
578
|
-
|
|
589
|
+
// for internal calculations, adjust based on timestamp
|
|
590
|
+
// and user's local timezone
|
|
591
|
+
setDate(normalizeForTimezone(nextDate, timestamp));
|
|
579
592
|
} else if (date && Array.isArray(date)) {
|
|
580
593
|
setDate(nextDates);
|
|
581
594
|
}
|
|
@@ -592,13 +605,14 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
592
605
|
});
|
|
593
606
|
|
|
594
607
|
adjustedDates = _nextDates$0$filter[0];
|
|
595
|
-
|
|
596
|
-
|
|
608
|
+
adjustedDates = formatDateToPropStructure(adjustedDates, timestamp);
|
|
609
|
+
} else if (nextDates) {
|
|
610
|
+
adjustedDates = [[formatDateToPropStructure(nextDates[0][0], timestamp), formatDateToPropStructure(nextDates[0][1], timestamp)]];
|
|
597
611
|
}
|
|
598
612
|
|
|
599
613
|
onSelect(adjustedDates || adjustedDate || nextDate);
|
|
600
614
|
}
|
|
601
|
-
}, [activeDate, activeDateProp, date, dateProp, dates, datesProp, onSelect, range]);
|
|
615
|
+
}, [activeDate, activeDateProp, date, dateProp, dates, datesProp, onSelect, range, timestamp]);
|
|
602
616
|
|
|
603
617
|
var renderCalendarHeader = function renderCalendarHeader() {
|
|
604
618
|
var PreviousIcon = size === 'small' ? theme.calendar.icons.small.previous : theme.calendar.icons.previous;
|
|
@@ -624,9 +638,15 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
624
638
|
direction: "row",
|
|
625
639
|
align: "center"
|
|
626
640
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
627
|
-
a11yTitle:
|
|
628
|
-
|
|
629
|
-
|
|
641
|
+
a11yTitle: format({
|
|
642
|
+
id: 'calendar.previous',
|
|
643
|
+
messages: messages,
|
|
644
|
+
values: {
|
|
645
|
+
date: previousMonth.toLocaleDateString(locale, {
|
|
646
|
+
month: 'long',
|
|
647
|
+
year: 'numeric'
|
|
648
|
+
})
|
|
649
|
+
}
|
|
630
650
|
}),
|
|
631
651
|
icon: /*#__PURE__*/React.createElement(PreviousIcon, {
|
|
632
652
|
size: size !== 'small' ? size : undefined
|
|
@@ -635,7 +655,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
635
655
|
onClick: function onClick() {
|
|
636
656
|
changeReference(previousMonth);
|
|
637
657
|
announce(format({
|
|
638
|
-
id: 'calendar.
|
|
658
|
+
id: 'calendar.previousMove',
|
|
639
659
|
messages: messages,
|
|
640
660
|
values: {
|
|
641
661
|
date: previousMonth.toLocaleDateString(locale, {
|
|
@@ -646,9 +666,15 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
646
666
|
}));
|
|
647
667
|
}
|
|
648
668
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
649
|
-
a11yTitle:
|
|
650
|
-
|
|
651
|
-
|
|
669
|
+
a11yTitle: format({
|
|
670
|
+
id: 'calendar.next',
|
|
671
|
+
messages: messages,
|
|
672
|
+
values: {
|
|
673
|
+
date: nextMonth.toLocaleDateString(locale, {
|
|
674
|
+
month: 'long',
|
|
675
|
+
year: 'numeric'
|
|
676
|
+
})
|
|
677
|
+
}
|
|
652
678
|
}),
|
|
653
679
|
icon: /*#__PURE__*/React.createElement(NextIcon, {
|
|
654
680
|
size: size !== 'small' ? size : undefined
|
|
@@ -657,7 +683,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
657
683
|
onClick: function onClick() {
|
|
658
684
|
changeReference(nextMonth);
|
|
659
685
|
announce(format({
|
|
660
|
-
id: 'calendar.
|
|
686
|
+
id: 'calendar.nextMove',
|
|
661
687
|
messages: messages,
|
|
662
688
|
values: {
|
|
663
689
|
date: nextMonth.toLocaleDateString(locale, {
|
|
@@ -805,7 +831,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
805
831
|
disabled: dayDisabled && !!dayDisabled,
|
|
806
832
|
onClick: function onClick() {
|
|
807
833
|
selectDate(dateString);
|
|
808
|
-
announce("Selected
|
|
834
|
+
announce("Selected\n " + formatToLocalYYYYMMDD(dateString), 'assertive'); // Chrome moves the focus indicator to this button. Set
|
|
809
835
|
// the focus to the grid of days instead.
|
|
810
836
|
|
|
811
837
|
daysRef.current.focus();
|
|
@@ -40,6 +40,10 @@ export interface CalendarProps {
|
|
|
40
40
|
firstDayOfWeek?: 0 | 1;
|
|
41
41
|
header?: (args: HeaderProps) => React.ReactNode;
|
|
42
42
|
locale?: string;
|
|
43
|
+
messages?: {
|
|
44
|
+
previous?: string;
|
|
45
|
+
next?: string;
|
|
46
|
+
};
|
|
43
47
|
onReference?: (reference: string) => void;
|
|
44
48
|
onSelect?: (select: string | string[]) => any;
|
|
45
49
|
range?: boolean | 'array';
|