grommet 2.24.0 → 2.25.2
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/all/stories/AllComponents.js +2 -7
- package/components/Accordion/Accordion.js +1 -1
- package/components/Accordion/propTypes.js +1 -1
- package/components/Accordion/stories/CustomThemed/Custom.js +3 -2
- package/components/AccordionPanel/AccordionPanel.js +2 -1
- package/components/Anchor/Anchor.js +15 -2
- package/components/Anchor/propTypes.js +1 -1
- package/components/Avatar/Avatar.js +1 -1
- package/components/Box/Box.js +1 -1
- package/components/Box/StyledBox.js +1 -1
- package/components/Box/propTypes.js +1 -1
- package/components/Button/Button.js +83 -10
- package/components/Button/StyledButtonKind.js +9 -3
- package/components/Button/index.d.ts +1 -1
- package/components/Button/propTypes.js +3 -3
- package/components/Button/stories/Basic.js +1 -1
- package/components/Button/stories/Fill.js +1 -1
- package/components/Button/stories/Kind.js +1 -1
- package/components/Calendar/Calendar.js +233 -293
- package/components/Calendar/index.d.ts +2 -2
- package/components/Calendar/propTypes.js +1 -1
- package/components/Calendar/stories/ShowAdjacentDays.js +1 -1
- package/components/Calendar/utils.js +16 -129
- package/components/Card/Card.js +1 -1
- package/components/Card/stories/CustomThemed/Clickable.js +1 -1
- package/components/Card/stories/CustomThemed/RichFooter.js +1 -1
- package/components/Card/stories/CustomThemed/Themed.js +1 -1
- package/components/CardBody/CardBody.js +1 -1
- package/components/CardFooter/CardFooter.js +1 -1
- package/components/CardHeader/CardHeader.js +1 -1
- package/components/Carousel/Carousel.js +1 -1
- package/components/Carousel/propTypes.js +1 -1
- package/components/Carousel/stories/CustomThemed/Custom.js +1 -1
- package/components/Chart/Chart.js +1 -1
- package/components/Chart/calcs.js +44 -27
- package/components/Chart/index.d.ts +28 -2
- package/components/Chart/propTypes.js +1 -1
- package/components/Chart/stories/Rich.js +1 -1
- package/components/Chart/stories/Scan.js +11 -9
- package/components/Chart/stories/Window.js +1 -1
- package/components/Chart/stories/data.js +16 -17
- package/components/CheckBox/CheckBox.js +4 -3
- package/components/CheckBox/stories/CustomThemed/Custom.js +1 -1
- package/components/CheckBox/stories/CustomThemed/CustomToggle.js +1 -1
- package/components/CheckBox/stories/NoLabel.js +1 -1
- package/components/CheckBox/stories/Simple.js +1 -1
- package/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/components/Clock/Analog.js +1 -1
- package/components/Clock/Clock.js +1 -1
- package/components/Clock/Digital.js +1 -1
- package/components/Clock/propTypes.js +1 -1
- package/components/Collapsible/stories/Nested.js +1 -1
- package/components/Collapsible/stories/Simple.js +1 -1
- package/components/DataChart/DataChart.js +22 -55
- package/components/DataChart/Detail.js +18 -11
- package/components/DataChart/Legend.js +1 -1
- package/components/DataChart/Swatch.js +64 -23
- package/components/DataChart/XAxis.js +30 -19
- package/components/DataChart/YGuide.js +1 -1
- package/components/DataChart/propTypes.js +1 -1
- package/components/DataChart/stories/Legend.js +6 -2
- package/components/DataChart/stories/Pad.js +54 -0
- package/components/DataChart/utils.js +11 -1
- package/components/DataTable/Body.js +11 -5
- package/components/DataTable/Cell.js +1 -1
- package/components/DataTable/DataTable.js +14 -10
- package/components/DataTable/ExpanderCell.js +1 -1
- package/components/DataTable/Footer.js +1 -1
- package/components/DataTable/GroupedBody.js +1 -1
- package/components/DataTable/Header.js +1 -1
- package/components/DataTable/Resizer.js +1 -1
- package/components/DataTable/Sorter.js +1 -1
- package/components/DataTable/buildState.js +2 -2
- package/components/DataTable/index.d.ts +4 -1
- package/components/DataTable/propTypes.js +1 -1
- package/components/DataTable/stories/Controlled.js +1 -1
- package/components/DataTable/stories/ControlledGrouped.js +1 -1
- package/components/DataTable/stories/CustomThemed/Fill.js +1 -1
- package/components/DataTable/stories/GroupedOnSelect.js +1 -1
- package/components/DataTable/stories/OnUpdate.js +1 -1
- package/components/DataTable/stories/Served.js +1 -1
- package/components/DataTable/stories/Sort.js +1 -1
- package/components/DataTable/stories/SpaceX.js +3 -1
- package/components/DataTable/stories/SpaceXUngrouped.js +6 -2
- package/components/DataTable/stories/Tunable.js +1 -1
- package/components/DataTable/stories/data.js +1 -1
- package/components/DataTable/stories/rowDetails.js +1 -1
- package/components/DateInput/DateInput.js +89 -92
- package/components/DateInput/index.d.ts +1 -0
- package/components/DateInput/propTypes.js +1 -0
- package/components/DateInput/stories/Format.js +14 -1
- package/components/DateInput/utils.js +31 -6
- package/components/Diagram/Diagram.js +1 -1
- package/components/Diagram/stories/Animated.js +1 -1
- package/components/Diagram/stories/Progressing.js +1 -1
- package/components/Distribution/Distribution.js +1 -1
- package/components/Distribution/propTypes.js +1 -1
- package/components/Drop/Drop.js +1 -1
- package/components/Drop/DropContainer.js +1 -1
- package/components/DropButton/DropButton.js +1 -1
- package/components/DropButton/propTypes.js +1 -1
- package/components/FileInput/FileInput.js +28 -9
- package/components/FileInput/StyledFileInput.js +1 -1
- package/components/FileInput/stories/Multiple.js +1 -0
- package/components/FocusedContainer.js +1 -1
- package/components/Footer/Footer.js +1 -1
- package/components/Footer/stories/DoubleFooter.js +1 -1
- package/components/Footer/stories/Sitemap.js +1 -1
- package/components/Form/Form.js +79 -6
- package/components/Form/stories/ArrayOfFormFields.js +1 -1
- package/components/Form/stories/CustomThemed/FieldSpacingOptions.js +1 -1
- package/components/FormField/FormField.js +30 -30
- package/components/Grid/Grid.js +5 -3
- package/components/Grid/README.md +0 -2
- package/components/Grid/index.d.ts +4 -2
- package/components/Grid/propTypes.js +1 -1
- package/components/Grid/stories/CustomThemed/Responsive.js +1 -1
- package/components/Grid/stories/typescript/App.tsx +42 -48
- package/components/Grommet/Grommet.js +8 -3
- package/components/Grommet/index.d.ts +1 -0
- package/components/Grommet/propTypes.js +2 -1
- package/components/Header/Header.js +1 -1
- package/components/Heading/Heading.js +5 -3
- package/components/Heading/StyledHeading.js +1 -1
- package/components/Heading/index.d.ts +1 -0
- package/components/Heading/propTypes.js +3 -2
- package/components/Image/Image.js +5 -3
- package/components/Image/propTypes.js +1 -1
- package/components/InfiniteScroll/stories/Basics.js +1 -1
- package/components/InfiniteScroll/stories/ClassChildren.js +1 -1
- package/components/InfiniteScroll/stories/Marker.js +1 -1
- package/components/InfiniteScroll/stories/Show.js +1 -1
- package/components/InfiniteScroll/stories/ShowAfter.js +1 -1
- package/components/InfiniteScroll/stories/ShowBefore.js +1 -1
- package/components/Layer/Layer.js +1 -1
- package/components/Layer/LayerContainer.js +19 -1
- package/components/List/List.js +1 -1
- package/components/List/propTypes.js +1 -1
- package/components/Main/Main.js +1 -1
- package/components/Markdown/Markdown.js +1 -1
- package/components/MaskedInput/MaskedInput.js +37 -28
- package/components/Menu/Menu.js +109 -62
- package/components/Menu/index.d.ts +2 -2
- package/components/Menu/propTypes.js +2 -2
- package/components/Menu/stories/CustomThemed/Themed.tsx +6 -0
- package/components/Menu/stories/Grouped.js +52 -0
- package/components/Meter/Bar.js +1 -1
- package/components/Meter/Circle.js +9 -3
- package/components/Meter/Meter.js +1 -1
- package/components/Meter/propTypes.js +1 -1
- package/components/NameValueList/NameValueList.js +1 -1
- package/components/NameValuePair/NameValuePair.js +1 -1
- package/components/Nav/Nav.js +1 -1
- package/components/Nav/stories/CustomThemed/JustifySidebar.js +1 -1
- package/components/Nav/stories/Sidebar.js +1 -1
- package/components/Notification/Notification.js +1 -1
- package/components/Notification/index.d.ts +1 -1
- package/components/Notification/propTypes.js +1 -1
- package/components/Page/Page.js +1 -1
- package/components/PageContent/PageContent.js +1 -1
- package/components/PageHeader/PageHeader.js +23 -14
- package/components/PageHeader/index.d.ts +10 -1
- package/components/PageHeader/propTypes.js +2 -1
- package/components/PageHeader/stories/Size.js +55 -0
- package/components/Pagination/PageControl.js +1 -1
- package/components/Pagination/Pagination.js +1 -1
- package/components/Pagination/propTypes.js +1 -1
- package/components/Paragraph/Paragraph.js +1 -1
- package/components/Paragraph/StyledParagraph.js +7 -1
- package/components/Paragraph/index.d.ts +1 -0
- package/components/Paragraph/propTypes.js +2 -1
- package/components/Paragraph/stories/MaxLines.js +37 -0
- package/components/RadioButton/RadioButton.js +1 -1
- package/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.js +1 -1
- package/components/RadioButtonGroup/stories/Disabled.js +1 -1
- package/components/RangeInput/RangeInput.js +1 -1
- package/components/RangeSelector/EdgeControl.js +1 -1
- package/components/RangeSelector/RangeSelector.js +1 -1
- package/components/RangeSelector/stories/CustomThemed/Custom.js +1 -1
- package/components/RangeSelector/stories/CustomThemed/CustomEdgeControl.js +1 -1
- package/components/RangeSelector/stories/Step.js +1 -1
- package/components/RangeSelector/stories/Vertical.js +1 -1
- package/components/RoutedAnchor/RoutedAnchor.js +2 -2
- package/components/RoutedButton/RoutedButton.js +2 -2
- package/components/Select/Select.js +11 -30
- package/components/Select/SelectContainer.js +97 -76
- package/components/Select/propTypes.js +1 -1
- package/components/Select/stories/Clear.js +7 -1
- package/components/Select/stories/components/SearchBorderBox.js +1 -1
- package/components/Select/stories/components/SearchInput.js +1 -1
- package/components/Select/utils.js +1 -0
- package/components/Sidebar/Sidebar.js +1 -1
- package/components/Sidebar/stories/Labels.js +1 -1
- package/components/SkipLink/SkipLink.js +1 -1
- package/components/SkipLinkTarget/SkipLinkTarget.js +1 -1
- package/components/Spinner/Spinner.js +2 -1
- package/components/Stack/Stack.js +1 -1
- package/components/Stack/propTypes.js +1 -1
- package/components/Tab/StyledTab.js +2 -2
- package/components/Tab/Tab.js +35 -17
- package/components/Table/propTypes.js +1 -1
- package/components/TableBody/TableBody.js +1 -1
- package/components/TableCell/TableCell.js +1 -1
- package/components/TableFooter/TableFooter.js +1 -1
- package/components/TableHeader/TableHeader.js +1 -1
- package/components/TableRow/TableRow.js +1 -1
- package/components/Tabs/Tabs.js +241 -11
- package/components/Tabs/propTypes.js +1 -1
- package/components/Tabs/stories/Responsive.js +18 -0
- package/components/Tag/Tag.js +1 -1
- package/components/Tag/propTypes.js +1 -1
- package/components/Text/Text.js +1 -1
- package/components/Text/propTypes.js +1 -1
- package/components/TextArea/TextArea.js +1 -1
- package/components/TextArea/stories/NonResizable.js +1 -1
- package/components/TextArea/stories/Simple.js +1 -1
- package/components/TextInput/TextInput.js +1 -1
- package/components/TextInput/stories/InsideFormField.js +1 -1
- package/components/TextInput/stories/WithTags.js +1 -1
- package/components/Tip/Tip.js +4 -23
- package/components/Video/StyledVideo.js +2 -2
- package/components/Video/Video.js +1 -1
- package/components/Video/propTypes.js +1 -1
- package/components/WorldMap/WorldMap.js +1 -1
- package/components/WorldMap/propTypes.js +1 -1
- package/components/WorldMap/stories/Places.js +1 -1
- package/contexts/AnalyticsContext/AnalyticsContext.js +65 -0
- package/contexts/AnalyticsContext/index.d.ts +7 -0
- package/contexts/AnalyticsContext/index.js +11 -0
- package/contexts/AnnounceContext/stories/Assertive.js +1 -1
- package/contexts/ResponsiveContext/stories/ResponsiveGrid.js +1 -1
- package/contexts/index.js +8 -0
- package/es6/all/stories/AllComponents.js +2 -7
- package/es6/components/Accordion/Accordion.js +1 -1
- package/es6/components/Accordion/propTypes.js +1 -1
- package/es6/components/Accordion/stories/CustomThemed/Custom.js +3 -2
- package/es6/components/AccordionPanel/AccordionPanel.js +2 -1
- package/es6/components/Anchor/Anchor.js +15 -3
- package/es6/components/Anchor/propTypes.js +1 -1
- package/es6/components/Avatar/Avatar.js +1 -1
- package/es6/components/Box/Box.js +1 -1
- package/es6/components/Box/StyledBox.js +1 -1
- package/es6/components/Box/propTypes.js +1 -1
- package/es6/components/Button/Button.js +84 -12
- package/es6/components/Button/StyledButtonKind.js +9 -3
- package/es6/components/Button/index.d.ts +1 -1
- package/es6/components/Button/propTypes.js +3 -3
- package/es6/components/Button/stories/Basic.js +1 -1
- package/es6/components/Button/stories/Fill.js +1 -1
- package/es6/components/Button/stories/Kind.js +1 -1
- package/es6/components/Calendar/Calendar.js +231 -293
- package/es6/components/Calendar/index.d.ts +2 -2
- package/es6/components/Calendar/propTypes.js +1 -1
- package/es6/components/Calendar/stories/ShowAdjacentDays.js +1 -1
- package/es6/components/Calendar/utils.js +13 -114
- package/es6/components/Card/Card.js +1 -1
- package/es6/components/Card/stories/CustomThemed/Clickable.js +1 -1
- package/es6/components/Card/stories/CustomThemed/RichFooter.js +1 -1
- package/es6/components/Card/stories/CustomThemed/Themed.js +1 -1
- package/es6/components/CardBody/CardBody.js +1 -1
- package/es6/components/CardFooter/CardFooter.js +1 -1
- package/es6/components/CardHeader/CardHeader.js +1 -1
- package/es6/components/Carousel/Carousel.js +1 -1
- package/es6/components/Carousel/propTypes.js +1 -1
- package/es6/components/Carousel/stories/CustomThemed/Custom.js +1 -1
- package/es6/components/Chart/Chart.js +1 -1
- package/es6/components/Chart/calcs.js +44 -27
- package/es6/components/Chart/index.d.ts +28 -2
- package/es6/components/Chart/propTypes.js +1 -1
- package/es6/components/Chart/stories/Rich.js +1 -1
- package/es6/components/Chart/stories/Scan.js +10 -9
- package/es6/components/Chart/stories/Window.js +1 -1
- package/es6/components/Chart/stories/data.js +16 -17
- package/es6/components/CheckBox/CheckBox.js +4 -3
- package/es6/components/CheckBox/stories/CustomThemed/Custom.js +1 -1
- package/es6/components/CheckBox/stories/CustomThemed/CustomToggle.js +1 -1
- package/es6/components/CheckBox/stories/NoLabel.js +1 -1
- package/es6/components/CheckBox/stories/Simple.js +1 -1
- package/es6/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/es6/components/Clock/Analog.js +1 -1
- package/es6/components/Clock/Clock.js +1 -1
- package/es6/components/Clock/Digital.js +1 -1
- package/es6/components/Clock/propTypes.js +1 -1
- package/es6/components/Collapsible/stories/Nested.js +1 -1
- package/es6/components/Collapsible/stories/Simple.js +1 -1
- package/es6/components/DataChart/DataChart.js +24 -57
- package/es6/components/DataChart/Detail.js +20 -10
- package/es6/components/DataChart/Legend.js +1 -1
- package/es6/components/DataChart/Swatch.js +64 -23
- package/es6/components/DataChart/XAxis.js +30 -20
- package/es6/components/DataChart/YGuide.js +1 -1
- package/es6/components/DataChart/propTypes.js +1 -1
- package/es6/components/DataChart/stories/Legend.js +6 -2
- package/es6/components/DataChart/stories/Pad.js +42 -0
- package/es6/components/DataChart/utils.js +7 -0
- package/es6/components/DataTable/Body.js +10 -5
- package/es6/components/DataTable/Cell.js +1 -1
- package/es6/components/DataTable/DataTable.js +14 -10
- package/es6/components/DataTable/ExpanderCell.js +1 -1
- package/es6/components/DataTable/Footer.js +1 -1
- package/es6/components/DataTable/GroupedBody.js +1 -1
- package/es6/components/DataTable/Header.js +1 -1
- package/es6/components/DataTable/Resizer.js +1 -1
- package/es6/components/DataTable/Sorter.js +1 -1
- package/es6/components/DataTable/buildState.js +2 -2
- package/es6/components/DataTable/index.d.ts +4 -1
- package/es6/components/DataTable/propTypes.js +1 -1
- package/es6/components/DataTable/stories/Controlled.js +1 -1
- package/es6/components/DataTable/stories/ControlledGrouped.js +1 -1
- package/es6/components/DataTable/stories/CustomThemed/Fill.js +1 -1
- package/es6/components/DataTable/stories/GroupedOnSelect.js +1 -1
- package/es6/components/DataTable/stories/OnUpdate.js +1 -1
- package/es6/components/DataTable/stories/Served.js +1 -1
- package/es6/components/DataTable/stories/Sort.js +1 -1
- package/es6/components/DataTable/stories/SpaceX.js +3 -1
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +6 -2
- package/es6/components/DataTable/stories/Tunable.js +1 -1
- package/es6/components/DataTable/stories/data.js +1 -1
- package/es6/components/DataTable/stories/rowDetails.js +1 -1
- package/es6/components/DateInput/DateInput.js +85 -88
- package/es6/components/DateInput/index.d.ts +1 -0
- package/es6/components/DateInput/propTypes.js +1 -0
- package/es6/components/DateInput/stories/Format.js +14 -1
- package/es6/components/DateInput/utils.js +30 -8
- package/es6/components/Diagram/Diagram.js +1 -1
- package/es6/components/Diagram/stories/Animated.js +1 -1
- package/es6/components/Diagram/stories/Progressing.js +1 -1
- package/es6/components/Distribution/Distribution.js +1 -1
- package/es6/components/Distribution/propTypes.js +1 -1
- package/es6/components/Drop/Drop.js +1 -1
- package/es6/components/Drop/DropContainer.js +1 -1
- package/es6/components/DropButton/DropButton.js +1 -1
- package/es6/components/DropButton/propTypes.js +1 -1
- package/es6/components/FileInput/FileInput.js +28 -9
- package/es6/components/FileInput/StyledFileInput.js +1 -1
- package/es6/components/FileInput/stories/Multiple.js +1 -0
- package/es6/components/FocusedContainer.js +1 -1
- package/es6/components/Footer/Footer.js +1 -1
- package/es6/components/Footer/stories/DoubleFooter.js +1 -1
- package/es6/components/Footer/stories/Sitemap.js +1 -1
- package/es6/components/Form/Form.js +77 -6
- package/es6/components/Form/stories/ArrayOfFormFields.js +1 -1
- package/es6/components/Form/stories/CustomThemed/FieldSpacingOptions.js +1 -1
- package/es6/components/FormField/FormField.js +30 -31
- package/es6/components/Grid/Grid.js +5 -3
- package/es6/components/Grid/README.md +0 -2
- package/es6/components/Grid/index.d.ts +4 -2
- package/es6/components/Grid/propTypes.js +1 -1
- package/es6/components/Grid/stories/CustomThemed/Responsive.js +1 -1
- package/es6/components/Grid/stories/typescript/App.tsx +42 -48
- package/es6/components/Grommet/Grommet.js +7 -3
- package/es6/components/Grommet/index.d.ts +1 -0
- package/es6/components/Grommet/propTypes.js +2 -1
- package/es6/components/Header/Header.js +1 -1
- package/es6/components/Heading/Heading.js +5 -3
- package/es6/components/Heading/StyledHeading.js +1 -1
- package/es6/components/Heading/index.d.ts +1 -0
- package/es6/components/Heading/propTypes.js +3 -2
- package/es6/components/Image/Image.js +5 -3
- package/es6/components/Image/propTypes.js +1 -1
- package/es6/components/InfiniteScroll/stories/Basics.js +1 -1
- package/es6/components/InfiniteScroll/stories/ClassChildren.js +1 -1
- package/es6/components/InfiniteScroll/stories/Marker.js +1 -1
- package/es6/components/InfiniteScroll/stories/Show.js +1 -1
- package/es6/components/InfiniteScroll/stories/ShowAfter.js +1 -1
- package/es6/components/InfiniteScroll/stories/ShowBefore.js +1 -1
- package/es6/components/Layer/Layer.js +1 -1
- package/es6/components/Layer/LayerContainer.js +18 -1
- package/es6/components/List/List.js +1 -1
- package/es6/components/List/propTypes.js +1 -1
- package/es6/components/Main/Main.js +1 -1
- package/es6/components/Markdown/Markdown.js +1 -1
- package/es6/components/MaskedInput/MaskedInput.js +38 -29
- package/es6/components/Menu/Menu.js +110 -62
- package/es6/components/Menu/index.d.ts +2 -2
- package/es6/components/Menu/propTypes.js +2 -2
- package/es6/components/Menu/stories/CustomThemed/Themed.tsx +6 -0
- package/es6/components/Menu/stories/Grouped.js +40 -0
- package/es6/components/Meter/Bar.js +1 -1
- package/es6/components/Meter/Circle.js +9 -3
- package/es6/components/Meter/Meter.js +1 -1
- package/es6/components/Meter/propTypes.js +1 -1
- package/es6/components/NameValueList/NameValueList.js +1 -1
- package/es6/components/NameValuePair/NameValuePair.js +1 -1
- package/es6/components/Nav/Nav.js +1 -1
- package/es6/components/Nav/stories/CustomThemed/JustifySidebar.js +1 -1
- package/es6/components/Nav/stories/Sidebar.js +1 -1
- package/es6/components/Notification/Notification.js +1 -1
- package/es6/components/Notification/index.d.ts +1 -1
- package/es6/components/Notification/propTypes.js +1 -1
- package/es6/components/Page/Page.js +1 -1
- package/es6/components/PageContent/PageContent.js +1 -1
- package/es6/components/PageHeader/PageHeader.js +24 -14
- package/es6/components/PageHeader/index.d.ts +10 -1
- package/es6/components/PageHeader/propTypes.js +2 -1
- package/es6/components/PageHeader/stories/Size.js +43 -0
- package/es6/components/Pagination/PageControl.js +1 -1
- package/es6/components/Pagination/Pagination.js +1 -1
- package/es6/components/Pagination/propTypes.js +1 -1
- package/es6/components/Paragraph/Paragraph.js +1 -1
- package/es6/components/Paragraph/StyledParagraph.js +8 -1
- package/es6/components/Paragraph/index.d.ts +1 -0
- package/es6/components/Paragraph/propTypes.js +2 -1
- package/es6/components/Paragraph/stories/MaxLines.js +24 -0
- package/es6/components/RadioButton/RadioButton.js +1 -1
- package/es6/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es6/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.js +1 -1
- package/es6/components/RadioButtonGroup/stories/Disabled.js +1 -1
- package/es6/components/RangeInput/RangeInput.js +1 -1
- package/es6/components/RangeSelector/EdgeControl.js +1 -1
- package/es6/components/RangeSelector/RangeSelector.js +1 -1
- package/es6/components/RangeSelector/stories/CustomThemed/Custom.js +1 -1
- package/es6/components/RangeSelector/stories/CustomThemed/CustomEdgeControl.js +1 -1
- package/es6/components/RangeSelector/stories/Step.js +1 -1
- package/es6/components/RangeSelector/stories/Vertical.js +1 -1
- package/es6/components/RoutedAnchor/RoutedAnchor.js +2 -2
- package/es6/components/RoutedButton/RoutedButton.js +2 -2
- package/es6/components/Select/Select.js +12 -31
- package/es6/components/Select/SelectContainer.js +97 -78
- package/es6/components/Select/propTypes.js +1 -1
- package/es6/components/Select/stories/Clear.js +7 -1
- package/es6/components/Select/stories/components/SearchBorderBox.js +1 -1
- package/es6/components/Select/stories/components/SearchInput.js +1 -1
- package/es6/components/Select/utils.js +1 -0
- package/es6/components/Sidebar/Sidebar.js +1 -1
- package/es6/components/Sidebar/stories/Labels.js +1 -1
- package/es6/components/SkipLink/SkipLink.js +1 -1
- package/es6/components/SkipLinkTarget/SkipLinkTarget.js +1 -1
- package/es6/components/Spinner/Spinner.js +2 -1
- package/es6/components/Stack/Stack.js +1 -1
- package/es6/components/Stack/propTypes.js +1 -1
- package/es6/components/Tab/StyledTab.js +2 -2
- package/es6/components/Tab/Tab.js +35 -18
- package/es6/components/Table/propTypes.js +1 -1
- package/es6/components/TableBody/TableBody.js +1 -1
- package/es6/components/TableCell/TableCell.js +1 -1
- package/es6/components/TableFooter/TableFooter.js +1 -1
- package/es6/components/TableHeader/TableHeader.js +1 -1
- package/es6/components/TableRow/TableRow.js +1 -1
- package/es6/components/Tabs/Tabs.js +236 -12
- package/es6/components/Tabs/propTypes.js +1 -1
- package/es6/components/Tabs/stories/Responsive.js +18 -0
- package/es6/components/Tag/Tag.js +1 -1
- package/es6/components/Tag/propTypes.js +1 -1
- package/es6/components/Text/Text.js +1 -1
- package/es6/components/Text/propTypes.js +1 -1
- package/es6/components/TextArea/TextArea.js +1 -1
- package/es6/components/TextArea/stories/NonResizable.js +1 -1
- package/es6/components/TextArea/stories/Simple.js +1 -1
- package/es6/components/TextInput/TextInput.js +1 -1
- package/es6/components/TextInput/stories/InsideFormField.js +1 -1
- package/es6/components/TextInput/stories/WithTags.js +1 -1
- package/es6/components/Tip/Tip.js +4 -23
- package/es6/components/Video/StyledVideo.js +2 -2
- package/es6/components/Video/Video.js +1 -1
- package/es6/components/Video/propTypes.js +1 -1
- package/es6/components/WorldMap/WorldMap.js +1 -1
- package/es6/components/WorldMap/propTypes.js +1 -1
- package/es6/components/WorldMap/stories/Places.js +1 -1
- package/es6/contexts/AnalyticsContext/AnalyticsContext.js +47 -0
- package/es6/contexts/AnalyticsContext/index.d.ts +7 -0
- package/es6/contexts/AnalyticsContext/index.js +1 -0
- package/es6/contexts/AnnounceContext/stories/Assertive.js +1 -1
- package/es6/contexts/ResponsiveContext/stories/ResponsiveGrid.js +1 -1
- package/es6/contexts/index.js +1 -0
- package/es6/index.d.ts +1 -0
- package/es6/themes/base.d.ts +65 -33
- package/es6/themes/base.js +70 -2
- package/es6/utils/index.js +2 -1
- package/es6/utils/mixins.js +3 -0
- package/es6/utils/object.js +1 -1
- package/es6/utils/pagination.js +1 -1
- package/es6/utils/use-keyboard.js +25 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +63 -55
- package/themes/base.d.ts +65 -33
- package/themes/base.js +70 -2
- package/tools/pack.js +20 -13
- package/tools/release-stable.js +2 -4
- package/utils/index.js +8 -0
- package/utils/mixins.js +7 -1
- package/utils/object.js +1 -1
- package/utils/pagination.js +1 -1
- package/utils/use-keyboard.js +34 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var _excluded = ["buttonProps", "calendarProps", "defaultValue", "disabled", "dropProps", "format", "id", "icon", "inline", "inputProps", "name", "onChange", "onFocus", "plain", "value", "messages"],
|
|
1
|
+
var _excluded = ["buttonProps", "calendarProps", "defaultValue", "disabled", "dropProps", "format", "id", "icon", "inline", "inputProps", "name", "onChange", "onFocus", "plain", "reverse", "value", "messages"],
|
|
2
2
|
_excluded2 = ["icon"];
|
|
3
3
|
|
|
4
|
-
function _extends() { _extends = Object.assign
|
|
4
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
5
|
|
|
6
6
|
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; }
|
|
7
7
|
|
|
@@ -20,9 +20,34 @@ import { FormContext } from '../Form';
|
|
|
20
20
|
import { Keyboard } from '../Keyboard';
|
|
21
21
|
import { MaskedInput } from '../MaskedInput';
|
|
22
22
|
import { useForwardedRef } from '../../utils';
|
|
23
|
-
import { getTimestamp, normalizeForTimezone } from '../Calendar/utils';
|
|
24
23
|
import { formatToSchema, schemaToMask, valuesAreEqual, valueToText, textToValue } from './utils';
|
|
25
24
|
import { DateInputPropTypes } from './propTypes';
|
|
25
|
+
import { getOutputFormat } from '../Calendar/Calendar';
|
|
26
|
+
|
|
27
|
+
var getReference = function getReference(value) {
|
|
28
|
+
var adjustedDate;
|
|
29
|
+
var res;
|
|
30
|
+
if (typeof value === 'string') res = value;else if (Array.isArray(value) && Array.isArray(value[0])) res = value[0].find(function (date) {
|
|
31
|
+
return date;
|
|
32
|
+
});else if (Array.isArray(value) && value.length) {
|
|
33
|
+
res = value[0];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (res) {
|
|
37
|
+
var _res;
|
|
38
|
+
|
|
39
|
+
adjustedDate = new Date(res); // if time is not specified in ISOstring, normalize to midnight
|
|
40
|
+
|
|
41
|
+
if (((_res = res) == null ? void 0 : _res.indexOf('T')) === -1) {
|
|
42
|
+
var offset = adjustedDate.getTimezoneOffset();
|
|
43
|
+
var hour = adjustedDate.getHours();
|
|
44
|
+
adjustedDate.setHours(hour, offset);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return adjustedDate;
|
|
49
|
+
};
|
|
50
|
+
|
|
26
51
|
var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
27
52
|
var buttonProps = _ref.buttonProps,
|
|
28
53
|
calendarProps = _ref.calendarProps,
|
|
@@ -39,6 +64,8 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
39
64
|
_onChange = _ref.onChange,
|
|
40
65
|
_onFocus = _ref.onFocus,
|
|
41
66
|
plain = _ref.plain,
|
|
67
|
+
_ref$reverse = _ref.reverse,
|
|
68
|
+
reverseProp = _ref$reverse === void 0 ? false : _ref$reverse,
|
|
42
69
|
valueArg = _ref.value,
|
|
43
70
|
messages = _ref.messages,
|
|
44
71
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
@@ -65,25 +92,24 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
65
92
|
value = _useFormInput[0],
|
|
66
93
|
setValue = _useFormInput[1];
|
|
67
94
|
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (Array.isArray(value) && value.length) return getTimestamp(value[0]); // check to see if value is not an empty string
|
|
72
|
-
// empty string should behave like undefined
|
|
95
|
+
var _useState = useState(getOutputFormat(value)),
|
|
96
|
+
outputFormat = _useState[0],
|
|
97
|
+
setOutputFormat = _useState[1];
|
|
73
98
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// will just rely on the UTC timestamp and don't need to normalize.
|
|
99
|
+
useEffect(function () {
|
|
100
|
+
setOutputFormat(function (previousFormat) {
|
|
101
|
+
var nextFormat = getOutputFormat(value); // when user types, date could become something like 07//2020
|
|
102
|
+
// and value becomes undefined. don't lose the format from the
|
|
103
|
+
// previous valid date
|
|
80
104
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
105
|
+
return previousFormat !== nextFormat ? previousFormat : nextFormat;
|
|
106
|
+
});
|
|
107
|
+
}, [value]); // keep track of timestamp from original date(s)
|
|
84
108
|
|
|
109
|
+
var _useState2 = useState(getReference(value)),
|
|
110
|
+
reference = _useState2[0],
|
|
111
|
+
setReference = _useState2[1]; // do we expect multiple dates?
|
|
85
112
|
|
|
86
|
-
var normalizedDate = normalizeForTimezone(value, timestamp, normalize); // do we expect multiple dates?
|
|
87
113
|
|
|
88
114
|
var range = Array.isArray(value) || format && format.includes('-'); // parse format and build a formal schema we can use elsewhere
|
|
89
115
|
|
|
@@ -95,9 +121,9 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
95
121
|
return schemaToMask(schema);
|
|
96
122
|
}, [schema]); // textValue is only used when a format is provided
|
|
97
123
|
|
|
98
|
-
var
|
|
99
|
-
textValue =
|
|
100
|
-
setTextValue =
|
|
124
|
+
var _useState3 = useState(schema ? valueToText(value, schema) : undefined),
|
|
125
|
+
textValue = _useState3[0],
|
|
126
|
+
setTextValue = _useState3[1]; // Setting the icon through `inputProps` is deprecated.
|
|
101
127
|
// The `icon` prop should be used instead.
|
|
102
128
|
|
|
103
129
|
|
|
@@ -107,27 +133,32 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
107
133
|
|
|
108
134
|
if (MaskedInputIcon) {
|
|
109
135
|
console.warn("Customizing the DateInput icon through inputProps is deprecated. \nUse the icon prop instead.");
|
|
110
|
-
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
var reverse = reverseProp || restOfInputProps.reverse;
|
|
139
|
+
var calendarDropdownAlign = {
|
|
140
|
+
top: 'bottom',
|
|
141
|
+
left: 'left'
|
|
142
|
+
}; // We need to distinguish between the caller changing a Form value
|
|
111
143
|
// and the user typing a date that he isn't finished with yet.
|
|
112
144
|
// To handle this, we see if we have a value and the text value
|
|
113
145
|
// associated with it doesn't align to it, then we update the text value.
|
|
114
146
|
// We compare using textToValue to avoid "06/01/2021" not
|
|
115
147
|
// matching "06/1/2021".
|
|
116
148
|
|
|
117
|
-
|
|
118
149
|
useEffect(function () {
|
|
119
150
|
if (schema && value !== undefined) {
|
|
120
|
-
var nextTextValue = valueToText(
|
|
151
|
+
var nextTextValue = valueToText(value, schema);
|
|
121
152
|
|
|
122
|
-
if (!valuesAreEqual(textToValue(textValue, schema, range,
|
|
153
|
+
if (!valuesAreEqual(textToValue(textValue, schema, range, reference), textToValue(nextTextValue, schema, range, reference)) || textValue === '' && nextTextValue !== '') {
|
|
123
154
|
setTextValue(nextTextValue);
|
|
124
155
|
}
|
|
125
156
|
}
|
|
126
|
-
}, [range, schema, textValue,
|
|
157
|
+
}, [range, schema, textValue, reference, value]); // when format and not inline, whether to show the Calendar in a Drop
|
|
127
158
|
|
|
128
|
-
var
|
|
129
|
-
open =
|
|
130
|
-
setOpen =
|
|
159
|
+
var _useState4 = useState(),
|
|
160
|
+
open = _useState4[0],
|
|
161
|
+
setOpen = _useState4[1];
|
|
131
162
|
|
|
132
163
|
var openCalendar = useCallback(function () {
|
|
133
164
|
setOpen(true);
|
|
@@ -147,33 +178,23 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
147
178
|
ref: inline ? ref : undefined,
|
|
148
179
|
id: inline && !format ? id : undefined,
|
|
149
180
|
range: range,
|
|
150
|
-
date: range ? undefined :
|
|
181
|
+
date: range ? undefined : value // when caller initializes with empty array, dates should be undefined
|
|
151
182
|
// allowing the user to select both begin and end of the range
|
|
152
183
|
,
|
|
153
|
-
dates: range && value.length ? [
|
|
184
|
+
dates: range && value.length ? [value] : undefined // places focus on days grid when Calendar opens
|
|
154
185
|
,
|
|
155
186
|
initialFocus: open ? 'days' : undefined,
|
|
156
|
-
normalize: normalize,
|
|
157
187
|
onSelect: disabled ? undefined : function (nextValue) {
|
|
158
188
|
var normalizedValue;
|
|
159
189
|
|
|
160
190
|
if (range && Array.isArray(nextValue)) {
|
|
161
191
|
normalizedValue = nextValue[0];
|
|
162
192
|
} // clicking an edge date removes it
|
|
163
|
-
else if (range) normalizedValue = [nextValue, nextValue];else normalizedValue = nextValue;
|
|
164
|
-
// been passed in, indicating that we should stay local if the
|
|
165
|
-
// user first picks a date via the Calendar.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
var nextNormalize = normalize;
|
|
169
|
-
|
|
170
|
-
if (timestamp === undefined) {
|
|
171
|
-
nextNormalize = false;
|
|
172
|
-
setNormalize(nextNormalize);
|
|
173
|
-
}
|
|
193
|
+
else if (range) normalizedValue = [nextValue, nextValue];else normalizedValue = nextValue;
|
|
174
194
|
|
|
175
|
-
if (schema) setTextValue(valueToText(
|
|
195
|
+
if (schema) setTextValue(valueToText(normalizedValue, schema));
|
|
176
196
|
setValue(normalizedValue);
|
|
197
|
+
setReference(getReference(nextValue));
|
|
177
198
|
if (_onChange) _onChange({
|
|
178
199
|
value: normalizedValue
|
|
179
200
|
});
|
|
@@ -185,9 +206,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
185
206
|
}, 1);
|
|
186
207
|
}
|
|
187
208
|
}
|
|
188
|
-
},
|
|
189
|
-
timestamp: timestamp
|
|
190
|
-
})));
|
|
209
|
+
}, calendarProps));
|
|
191
210
|
var formContextValue = useMemo(function () {
|
|
192
211
|
return {
|
|
193
212
|
useFormInput: function useFormInput(_ref3) {
|
|
@@ -204,10 +223,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
204
223
|
ref: ref,
|
|
205
224
|
id: id,
|
|
206
225
|
dropProps: _extends({
|
|
207
|
-
align:
|
|
208
|
-
top: 'bottom',
|
|
209
|
-
left: 'left'
|
|
210
|
-
}
|
|
226
|
+
align: calendarDropdownAlign
|
|
211
227
|
}, dropProps),
|
|
212
228
|
dropContent: calendar,
|
|
213
229
|
icon: icon || MaskedInputIcon || /*#__PURE__*/React.createElement(CalendarIcon, {
|
|
@@ -216,6 +232,18 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
216
232
|
}, buttonProps));
|
|
217
233
|
}
|
|
218
234
|
|
|
235
|
+
var calendarButton = /*#__PURE__*/React.createElement(Button, {
|
|
236
|
+
onClick: open ? closeCalendar : openCalendar,
|
|
237
|
+
plain: true,
|
|
238
|
+
icon: icon || MaskedInputIcon || /*#__PURE__*/React.createElement(CalendarIcon, {
|
|
239
|
+
size: iconSize
|
|
240
|
+
}),
|
|
241
|
+
margin: reverse ? {
|
|
242
|
+
left: 'small'
|
|
243
|
+
} : {
|
|
244
|
+
right: 'small'
|
|
245
|
+
}
|
|
246
|
+
});
|
|
219
247
|
var input = /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
220
248
|
key: "input" // don't let MaskedInput drive the Form
|
|
221
249
|
,
|
|
@@ -234,7 +262,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
234
262
|
round: "xxsmall",
|
|
235
263
|
direction: "row",
|
|
236
264
|
fill: true
|
|
237
|
-
}, /*#__PURE__*/React.createElement(MaskedInput, _extends({
|
|
265
|
+
}, reverse && calendarButton, /*#__PURE__*/React.createElement(MaskedInput, _extends({
|
|
238
266
|
ref: ref,
|
|
239
267
|
id: id,
|
|
240
268
|
name: name,
|
|
@@ -247,27 +275,8 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
247
275
|
onChange: function onChange(event) {
|
|
248
276
|
var nextTextValue = event.target.value;
|
|
249
277
|
setTextValue(nextTextValue);
|
|
250
|
-
var
|
|
251
|
-
//
|
|
252
|
-
|
|
253
|
-
if (timestamp === undefined && Date.parse(nextTextValue)) {
|
|
254
|
-
var _Date$toISOString$spl = new Date(nextTextValue).toISOString().split('T');
|
|
255
|
-
|
|
256
|
-
localTimestamp = _Date$toISOString$spl[1];
|
|
257
|
-
} // timestamp will be undefined if no defaultValue or value have
|
|
258
|
-
// been passed in, indicating that we should stay local
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
var nextNormalize = normalize;
|
|
262
|
-
|
|
263
|
-
if (timestamp === undefined) {
|
|
264
|
-
nextNormalize = false;
|
|
265
|
-
setNormalize(nextNormalize);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
var nextValue = textToValue(nextTextValue, schema, range, timestamp || localTimestamp, nextNormalize); // reset to original state
|
|
269
|
-
|
|
270
|
-
if (nextValue === undefined) setNormalize(true); // update value even when undefined
|
|
278
|
+
var nextValue = textToValue(nextTextValue, schema, range, reference, outputFormat);
|
|
279
|
+
if (nextValue !== undefined) setReference(getReference(nextValue)); // update value even when undefined
|
|
271
280
|
|
|
272
281
|
setValue(nextValue);
|
|
273
282
|
|
|
@@ -287,16 +296,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
287
296
|
}));
|
|
288
297
|
if (_onFocus) _onFocus(event);
|
|
289
298
|
}
|
|
290
|
-
})),
|
|
291
|
-
onClick: open ? closeCalendar : openCalendar,
|
|
292
|
-
plain: true,
|
|
293
|
-
icon: icon || MaskedInputIcon || /*#__PURE__*/React.createElement(CalendarIcon, {
|
|
294
|
-
size: iconSize
|
|
295
|
-
}),
|
|
296
|
-
margin: {
|
|
297
|
-
right: 'small'
|
|
298
|
-
}
|
|
299
|
-
}))));
|
|
299
|
+
})), !reverse && calendarButton)));
|
|
300
300
|
|
|
301
301
|
if (inline) {
|
|
302
302
|
return /*#__PURE__*/React.createElement(Box, null, input, calendar);
|
|
@@ -311,11 +311,8 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
311
311
|
}, /*#__PURE__*/React.createElement(Drop, _extends({
|
|
312
312
|
overflow: "visible",
|
|
313
313
|
id: id ? id + "__drop" : undefined,
|
|
314
|
-
target:
|
|
315
|
-
align: _extends({
|
|
316
|
-
top: 'bottom',
|
|
317
|
-
left: 'left'
|
|
318
|
-
}, dropProps),
|
|
314
|
+
target: containerRef.current,
|
|
315
|
+
align: _extends({}, calendarDropdownAlign, dropProps),
|
|
319
316
|
onEsc: closeCalendar,
|
|
320
317
|
onClickOutside: function onClickOutside(_ref4) {
|
|
321
318
|
var target = _ref4.target;
|
|
@@ -16,11 +16,24 @@ export var Format = function Format() {
|
|
|
16
16
|
align: "center",
|
|
17
17
|
pad: "large"
|
|
18
18
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
19
|
-
width: "medium"
|
|
19
|
+
width: "medium",
|
|
20
|
+
margin: {
|
|
21
|
+
vertical: 'small'
|
|
22
|
+
}
|
|
20
23
|
}, /*#__PURE__*/React.createElement(DateInput, {
|
|
21
24
|
format: "m/d/yy",
|
|
22
25
|
value: value,
|
|
23
26
|
onChange: onChange
|
|
27
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
28
|
+
width: "medium",
|
|
29
|
+
margin: {
|
|
30
|
+
vertical: 'small'
|
|
31
|
+
}
|
|
32
|
+
}, /*#__PURE__*/React.createElement(DateInput, {
|
|
33
|
+
format: "m/d/yy",
|
|
34
|
+
value: value,
|
|
35
|
+
reverse: true,
|
|
36
|
+
onChange: onChange
|
|
24
37
|
})));
|
|
25
38
|
};
|
|
26
39
|
export default {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
4
|
+
|
|
5
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
6
|
+
|
|
7
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
|
+
|
|
9
|
+
import { handleOffset } from '../Calendar/utils'; // Converting between Date and String types is handled via a "schema".
|
|
4
10
|
// The schema is an array of strings, split into strings with identical
|
|
5
11
|
// characters. So, 'mm/dd/yyyy' will be ['mm', '/', 'dd', '/', 'yyyyy'].
|
|
6
|
-
|
|
12
|
+
|
|
7
13
|
export var formatToSchema = function formatToSchema(format) {
|
|
8
14
|
if (!format) return undefined;
|
|
9
15
|
var result = [];
|
|
@@ -70,7 +76,16 @@ export var valueToText = function valueToText(value, schema) {
|
|
|
70
76
|
|
|
71
77
|
if (!value || Array.isArray(value) && !value.length) return text;
|
|
72
78
|
var dates = (Array.isArray(value) ? value : [value]).map(function (v) {
|
|
73
|
-
|
|
79
|
+
// TO DO should we extract this to a reusable function?
|
|
80
|
+
var adjustedDate = new Date(v); // if time is not specified in ISOstring, normalize to midnight
|
|
81
|
+
|
|
82
|
+
if (v.indexOf('T') === -1) {
|
|
83
|
+
var offset = adjustedDate.getTimezoneOffset();
|
|
84
|
+
var hour = adjustedDate.getHours();
|
|
85
|
+
adjustedDate.setHours(hour, offset);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return adjustedDate;
|
|
74
89
|
});
|
|
75
90
|
var dateIndex = 0;
|
|
76
91
|
var parts = {};
|
|
@@ -126,7 +141,7 @@ var pullDigits = function pullDigits(text, index) {
|
|
|
126
141
|
return text.slice(index, end);
|
|
127
142
|
};
|
|
128
143
|
|
|
129
|
-
export var textToValue = function textToValue(text, schema, range,
|
|
144
|
+
export var textToValue = function textToValue(text, schema, range, reference, outputFormat) {
|
|
130
145
|
if (!text) return range ? [] : undefined;
|
|
131
146
|
var result;
|
|
132
147
|
|
|
@@ -134,10 +149,17 @@ export var textToValue = function textToValue(text, schema, range, timestamp, no
|
|
|
134
149
|
var leapYear = parts.y % 4 === 0 && parts.y % 100 !== 0 || parts.y % 400 === 0; // Do a little sanity checking on the parts first.
|
|
135
150
|
// If not valid, leave as is.
|
|
136
151
|
|
|
137
|
-
if (!parts.m || !parts.d || !parts.y || parts.y.length < 4 || parts.m.length > 2 || parts.d.length > 2 || parts.m > 12 || parts.d > 31 || (parts.m === "02" || parts.m === "2") && parts.d > (leapYear ? 29 : 28)) return parts;
|
|
138
|
-
|
|
152
|
+
if (!parts.m || !parts.d || !parts.y || parts.y.length < 4 || parts.m.length > 2 || parts.d.length > 2 || parts.m > 12 || parts.d > 31 || (parts.m === "02" || parts.m === "2") && parts.d > (leapYear ? 29 : 28)) return parts; // use time info from reference date
|
|
153
|
+
|
|
154
|
+
var time = reference ? [reference.getHours(), reference.getMinutes(), reference.getSeconds(), reference.getMilliseconds()] : null;
|
|
155
|
+
|
|
156
|
+
var date = _construct(Date, [parts.y, parts.m - 1, parts.d].concat(time)).toISOString();
|
|
139
157
|
|
|
140
|
-
if (
|
|
158
|
+
if (date && outputFormat === 'no timezone') {
|
|
159
|
+
var _handleOffset$toISOSt = handleOffset(date).toISOString().split('T');
|
|
160
|
+
|
|
161
|
+
date = _handleOffset$toISOSt[0];
|
|
162
|
+
}
|
|
141
163
|
|
|
142
164
|
if (!range) {
|
|
143
165
|
if (!result) result = date;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["connections"],
|
|
2
2
|
_excluded2 = ["anchor", "animation", "color", "offset", "round", "thickness", "type"];
|
|
3
3
|
|
|
4
|
-
function _extends() { _extends = Object.assign
|
|
4
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
5
|
|
|
6
6
|
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; }
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import React, { useReducer, useEffect } from 'react';
|
|
4
4
|
import { Box, Diagram, Stack, Text } from 'grommet';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["id"],
|
|
2
2
|
_excluded2 = ["color"];
|
|
3
3
|
|
|
4
|
-
function _extends() { _extends = Object.assign
|
|
4
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
5
|
|
|
6
6
|
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; }
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["basis", "children", "direction", "fill", "gap", "values"];
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { genericProps } from '../../utils/general-prop-types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["inline", "restrictFocus", "target", "trapFocus"];
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["a11yTitle", "aria-label", "align", "background", "onAlign", "children", "dropTarget", "elevation", "onClickOutside", "onEsc", "onKeyDown", "overflow", "plain", "responsive", "restrictFocus", "stretch", "trapFocus"];
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["a11yTitle", "onAlign", "disabled", "dropAlign", "dropProps", "dropContent", "dropTarget", "id", "open", "onClick", "onClose", "onOpen"];
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { genericProps } from '../../utils/general-prop-types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["a11yTitle", "background", "border", "confirmRemove", "disabled", "id", "plain", "renderFile", "maxSize", "messages", "margin", "multiple", "name", "onChange", "pad", "value"];
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
@@ -42,7 +42,7 @@ var formatBytes = function formatBytes(size) {
|
|
|
42
42
|
var ContentsBox = styled(Box).withConfig({
|
|
43
43
|
displayName: "FileInput__ContentsBox",
|
|
44
44
|
componentId: "sc-1jzq7im-0"
|
|
45
|
-
})(["position:relative;", " ", ";", ";", ";"], function (props) {
|
|
45
|
+
})(["cursor:pointer;position:relative;", " ", ";", ";", ";"], function (props) {
|
|
46
46
|
return props.disabled && disabledStyle();
|
|
47
47
|
}, function (props) {
|
|
48
48
|
return props.theme.fileInput && props.theme.fileInput.extend;
|
|
@@ -229,8 +229,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
229
229
|
});
|
|
230
230
|
} else message = files.length + " items";
|
|
231
231
|
|
|
232
|
-
var removeFile = function removeFile(
|
|
233
|
-
event.stopPropagation();
|
|
232
|
+
var removeFile = function removeFile(index) {
|
|
234
233
|
var nextFiles;
|
|
235
234
|
|
|
236
235
|
if (index === 'all') {
|
|
@@ -240,11 +239,30 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
240
239
|
nextFiles.splice(index, 1);
|
|
241
240
|
}
|
|
242
241
|
|
|
243
|
-
setFiles(nextFiles);
|
|
242
|
+
setFiles(nextFiles); // Need to have a way to track the files other than an array
|
|
243
|
+
// since inputRef.current.files is a read-only FileList
|
|
244
|
+
// https://stackoverflow.com/a/64019766
|
|
245
|
+
|
|
246
|
+
/* eslint-disable no-undef */
|
|
247
|
+
|
|
248
|
+
var dt = new DataTransfer();
|
|
249
|
+
var curFiles = inputRef.current.files;
|
|
250
|
+
if (index === 'all' || nextFiles.length === 0) inputRef.current.value = '';
|
|
251
|
+
|
|
252
|
+
for (var i = 0; i < curFiles.length; i += 1) {
|
|
253
|
+
var curfile = curFiles[i];
|
|
254
|
+
if (index !== i) dt.items.add(curfile);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'files').set;
|
|
258
|
+
nativeInputValueSetter.call(inputRef.current, dt.files);
|
|
259
|
+
var event = new Event('input', {
|
|
260
|
+
bubbles: true
|
|
261
|
+
});
|
|
262
|
+
inputRef.current.dispatchEvent(event);
|
|
244
263
|
if (_onChange) _onChange(event, {
|
|
245
264
|
files: nextFiles
|
|
246
265
|
});
|
|
247
|
-
if (nextFiles.length === 0) inputRef.current.value = '';
|
|
248
266
|
inputRef.current.focus();
|
|
249
267
|
};
|
|
250
268
|
|
|
@@ -274,6 +292,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
274
292
|
justify: "between"
|
|
275
293
|
}, files.length <= aggregateThreshold && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Message, theme.fileInput.message, message), /*#__PURE__*/React.createElement(Keyboard, {
|
|
276
294
|
onSpace: function onSpace(event) {
|
|
295
|
+
event.preventDefault();
|
|
277
296
|
if (controlRef.current === event.target) inputRef.current.click();
|
|
278
297
|
},
|
|
279
298
|
onEnter: function onEnter(event) {
|
|
@@ -331,7 +350,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
331
350
|
index: 'all'
|
|
332
351
|
});
|
|
333
352
|
setShowRemoveConfirmation(true);
|
|
334
|
-
} else removeFile(
|
|
353
|
+
} else removeFile('all');
|
|
335
354
|
}
|
|
336
355
|
}), /*#__PURE__*/React.createElement(Keyboard, {
|
|
337
356
|
onSpace: function onSpace(event) {
|
|
@@ -398,7 +417,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
398
417
|
index: index
|
|
399
418
|
});
|
|
400
419
|
setShowRemoveConfirmation(true);
|
|
401
|
-
} else removeFile(
|
|
420
|
+
} else removeFile(index);
|
|
402
421
|
}
|
|
403
422
|
}), files.length === 1 && /*#__PURE__*/React.createElement(Keyboard, {
|
|
404
423
|
onSpace: function onSpace(event) {
|
|
@@ -476,7 +495,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
476
495
|
}
|
|
477
496
|
}))), showRemoveConfirmation && /*#__PURE__*/React.createElement(ConfirmRemove, {
|
|
478
497
|
onConfirm: function onConfirm() {
|
|
479
|
-
removeFile(pendingRemoval.
|
|
498
|
+
removeFile(pendingRemoval.index);
|
|
480
499
|
setPendingRemoval(defaultPendingRemoval);
|
|
481
500
|
setShowRemoveConfirmation(false);
|
|
482
501
|
},
|
|
@@ -4,7 +4,7 @@ import { defaultProps } from '../../default-props';
|
|
|
4
4
|
var StyledFileInput = styled.input.withConfig({
|
|
5
5
|
displayName: "StyledFileInput",
|
|
6
6
|
componentId: "sc-rl7ywv-0"
|
|
7
|
-
})(["position:absolute;height:100%;width:100%;", " opacity:0;border:none;", " ", " &::-moz-focus-inner{border:none;outline:none;}"], inputStyle, function (props) {
|
|
7
|
+
})(["position:absolute;height:100%;width:100%;", " font-size:0;opacity:0;border:none;", " ", " &::-moz-focus-inner{border:none;outline:none;}&::-webkit-file-upload-button{cursor:pointer;}"], inputStyle, function (props) {
|
|
8
8
|
return !props.disabled && 'cursor: pointer;';
|
|
9
9
|
}, function (props) {
|
|
10
10
|
return props.rightOffset && "\n width: calc(100% - " + props.rightOffset + "px);\n right: " + props.rightOffset + "px;\n ";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["hidden", "restrictScroll", "children", "trapFocus"];
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Box } from '../Box';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import styled from 'styled-components';
|