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
|
@@ -37,7 +37,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
37
37
|
|
|
38
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
39
|
|
|
40
|
-
function _extends() { _extends = Object.assign
|
|
40
|
+
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); }
|
|
41
41
|
|
|
42
42
|
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; }
|
|
43
43
|
|
|
@@ -64,7 +64,7 @@ var formatBytes = function formatBytes(size) {
|
|
|
64
64
|
var ContentsBox = (0, _styledComponents["default"])(_Box.Box).withConfig({
|
|
65
65
|
displayName: "FileInput__ContentsBox",
|
|
66
66
|
componentId: "sc-1jzq7im-0"
|
|
67
|
-
})(["position:relative;", " ", ";", ";", ";"], function (props) {
|
|
67
|
+
})(["cursor:pointer;position:relative;", " ", ";", ";", ";"], function (props) {
|
|
68
68
|
return props.disabled && (0, _utils.disabledStyle)();
|
|
69
69
|
}, function (props) {
|
|
70
70
|
return props.theme.fileInput && props.theme.fileInput.extend;
|
|
@@ -251,8 +251,7 @@ var FileInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
251
251
|
});
|
|
252
252
|
} else message = files.length + " items";
|
|
253
253
|
|
|
254
|
-
var removeFile = function removeFile(
|
|
255
|
-
event.stopPropagation();
|
|
254
|
+
var removeFile = function removeFile(index) {
|
|
256
255
|
var nextFiles;
|
|
257
256
|
|
|
258
257
|
if (index === 'all') {
|
|
@@ -262,11 +261,30 @@ var FileInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
262
261
|
nextFiles.splice(index, 1);
|
|
263
262
|
}
|
|
264
263
|
|
|
265
|
-
setFiles(nextFiles);
|
|
264
|
+
setFiles(nextFiles); // Need to have a way to track the files other than an array
|
|
265
|
+
// since inputRef.current.files is a read-only FileList
|
|
266
|
+
// https://stackoverflow.com/a/64019766
|
|
267
|
+
|
|
268
|
+
/* eslint-disable no-undef */
|
|
269
|
+
|
|
270
|
+
var dt = new DataTransfer();
|
|
271
|
+
var curFiles = inputRef.current.files;
|
|
272
|
+
if (index === 'all' || nextFiles.length === 0) inputRef.current.value = '';
|
|
273
|
+
|
|
274
|
+
for (var i = 0; i < curFiles.length; i += 1) {
|
|
275
|
+
var curfile = curFiles[i];
|
|
276
|
+
if (index !== i) dt.items.add(curfile);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'files').set;
|
|
280
|
+
nativeInputValueSetter.call(inputRef.current, dt.files);
|
|
281
|
+
var event = new Event('input', {
|
|
282
|
+
bubbles: true
|
|
283
|
+
});
|
|
284
|
+
inputRef.current.dispatchEvent(event);
|
|
266
285
|
if (_onChange) _onChange(event, {
|
|
267
286
|
files: nextFiles
|
|
268
287
|
});
|
|
269
|
-
if (nextFiles.length === 0) inputRef.current.value = '';
|
|
270
288
|
inputRef.current.focus();
|
|
271
289
|
};
|
|
272
290
|
|
|
@@ -296,6 +314,7 @@ var FileInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
296
314
|
justify: "between"
|
|
297
315
|
}, files.length <= aggregateThreshold && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(Message, theme.fileInput.message, message), /*#__PURE__*/_react["default"].createElement(_Keyboard.Keyboard, {
|
|
298
316
|
onSpace: function onSpace(event) {
|
|
317
|
+
event.preventDefault();
|
|
299
318
|
if (controlRef.current === event.target) inputRef.current.click();
|
|
300
319
|
},
|
|
301
320
|
onEnter: function onEnter(event) {
|
|
@@ -353,7 +372,7 @@ var FileInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
353
372
|
index: 'all'
|
|
354
373
|
});
|
|
355
374
|
setShowRemoveConfirmation(true);
|
|
356
|
-
} else removeFile(
|
|
375
|
+
} else removeFile('all');
|
|
357
376
|
}
|
|
358
377
|
}), /*#__PURE__*/_react["default"].createElement(_Keyboard.Keyboard, {
|
|
359
378
|
onSpace: function onSpace(event) {
|
|
@@ -420,7 +439,7 @@ var FileInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
420
439
|
index: index
|
|
421
440
|
});
|
|
422
441
|
setShowRemoveConfirmation(true);
|
|
423
|
-
} else removeFile(
|
|
442
|
+
} else removeFile(index);
|
|
424
443
|
}
|
|
425
444
|
}), files.length === 1 && /*#__PURE__*/_react["default"].createElement(_Keyboard.Keyboard, {
|
|
426
445
|
onSpace: function onSpace(event) {
|
|
@@ -498,7 +517,7 @@ var FileInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
498
517
|
}
|
|
499
518
|
}))), showRemoveConfirmation && /*#__PURE__*/_react["default"].createElement(ConfirmRemove, {
|
|
500
519
|
onConfirm: function onConfirm() {
|
|
501
|
-
removeFile(pendingRemoval.
|
|
520
|
+
removeFile(pendingRemoval.index);
|
|
502
521
|
setPendingRemoval(defaultPendingRemoval);
|
|
503
522
|
setShowRemoveConfirmation(false);
|
|
504
523
|
},
|
|
@@ -14,7 +14,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
14
14
|
var StyledFileInput = _styledComponents["default"].input.withConfig({
|
|
15
15
|
displayName: "StyledFileInput",
|
|
16
16
|
componentId: "sc-rl7ywv-0"
|
|
17
|
-
})(["position:absolute;height:100%;width:100%;", " opacity:0;border:none;", " ", " &::-moz-focus-inner{border:none;outline:none;}"], _utils.inputStyle, function (props) {
|
|
17
|
+
})(["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;}"], _utils.inputStyle, function (props) {
|
|
18
18
|
return !props.disabled && 'cursor: pointer;';
|
|
19
19
|
}, function (props) {
|
|
20
20
|
return props.rightOffset && "\n width: calc(100% - " + props.rightOffset + "px);\n right: " + props.rightOffset + "px;\n ";
|
|
@@ -15,7 +15,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
function _extends() { _extends = Object.assign
|
|
18
|
+
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); }
|
|
19
19
|
|
|
20
20
|
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; }
|
|
21
21
|
|
|
@@ -9,7 +9,7 @@ var _Box = require("../Box");
|
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
11
|
|
|
12
|
-
function _extends() { _extends = Object.assign
|
|
12
|
+
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); }
|
|
13
13
|
|
|
14
14
|
var Footer = function Footer(_ref) {
|
|
15
15
|
var rest = _extends({}, _ref);
|
|
@@ -15,7 +15,7 @@ var _data = require("./data");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
17
|
|
|
18
|
-
function _extends() { _extends = Object.assign
|
|
18
|
+
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); }
|
|
19
19
|
|
|
20
20
|
var StyledAnchor = (0, _styledComponents["default"])(_grommet.Anchor).withConfig({
|
|
21
21
|
displayName: "DoubleFooter__StyledAnchor",
|
|
@@ -13,7 +13,7 @@ var _data = require("./data");
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
15
|
|
|
16
|
-
function _extends() { _extends = Object.assign
|
|
16
|
+
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); }
|
|
17
17
|
|
|
18
18
|
var FooterAnchor = function FooterAnchor(_ref) {
|
|
19
19
|
var rest = _extends({}, _ref);
|
package/components/Form/Form.js
CHANGED
|
@@ -5,8 +5,12 @@ exports.Form = void 0;
|
|
|
5
5
|
|
|
6
6
|
var _react = _interopRequireWildcard(require("react"));
|
|
7
7
|
|
|
8
|
+
var _contexts = require("../../contexts");
|
|
9
|
+
|
|
8
10
|
var _MessageContext = require("../../contexts/MessageContext");
|
|
9
11
|
|
|
12
|
+
var _utils = require("../../utils");
|
|
13
|
+
|
|
10
14
|
var _FormContext = require("./FormContext");
|
|
11
15
|
|
|
12
16
|
var _propTypes = require("./propTypes");
|
|
@@ -19,7 +23,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
23
|
|
|
20
24
|
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; }
|
|
21
25
|
|
|
22
|
-
function _extends() { _extends = Object.assign
|
|
26
|
+
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); }
|
|
23
27
|
|
|
24
28
|
var defaultValue = {};
|
|
25
29
|
var defaultTouched = {};
|
|
@@ -195,6 +199,8 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
195
199
|
valueProp = _ref2.value,
|
|
196
200
|
rest = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
197
201
|
|
|
202
|
+
var formRef = (0, _utils.useForwardedRef)(ref);
|
|
203
|
+
|
|
198
204
|
var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
199
205
|
format = _useContext.format;
|
|
200
206
|
|
|
@@ -238,6 +244,11 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
238
244
|
|
|
239
245
|
var validationRulesRef = (0, _react.useRef)({});
|
|
240
246
|
var requiredFields = (0, _react.useRef)([]);
|
|
247
|
+
var analyticsRef = (0, _react.useRef)({
|
|
248
|
+
start: new Date(),
|
|
249
|
+
errors: {}
|
|
250
|
+
});
|
|
251
|
+
var sendAnalytics = (0, _contexts.useAnalytics)();
|
|
241
252
|
var buildValid = (0, _react.useCallback)(function (nextErrors) {
|
|
242
253
|
var valid = false;
|
|
243
254
|
valid = requiredFields.current.filter(function (n) {
|
|
@@ -260,6 +271,19 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
260
271
|
});
|
|
261
272
|
};
|
|
262
273
|
|
|
274
|
+
var updateAnalytics = function updateAnalytics() {
|
|
275
|
+
var _validationResultsRef;
|
|
276
|
+
|
|
277
|
+
var errorFields = Object.keys((_validationResultsRef = validationResultsRef.current) == null ? void 0 : _validationResultsRef.errors);
|
|
278
|
+
var errorCounts = analyticsRef.current.errors;
|
|
279
|
+
|
|
280
|
+
if (errorFields.length > 0) {
|
|
281
|
+
errorFields.forEach(function (key) {
|
|
282
|
+
errorCounts[key] = (errorCounts[key] || 0) + 1;
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
263
287
|
var applyValidationRules = (0, _react.useCallback)(function (validationRules) {
|
|
264
288
|
var _validateForm = validateForm(validationRules, value, format, messages),
|
|
265
289
|
validatedErrors = _validateForm[0],
|
|
@@ -284,6 +308,7 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
284
308
|
valid: buildValid(nextErrors)
|
|
285
309
|
}));
|
|
286
310
|
validationResultsRef.current = nextValidationResults;
|
|
311
|
+
updateAnalytics();
|
|
287
312
|
return nextValidationResults;
|
|
288
313
|
});
|
|
289
314
|
}, [buildValid, format, messages, onValidate, value]); // Validate all fields holding values onMount if set to
|
|
@@ -331,17 +356,38 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
331
356
|
// as the user fixes them (basically act like validate=change for that)
|
|
332
357
|
|
|
333
358
|
(0, _react.useEffect)(function () {
|
|
334
|
-
var
|
|
359
|
+
var _validationResultsRef2;
|
|
335
360
|
|
|
336
361
|
var validationRules = Object.entries(validationRulesRef.current);
|
|
337
362
|
|
|
338
|
-
if ((
|
|
363
|
+
if ((_validationResultsRef2 = validationResultsRef.current) != null && _validationResultsRef2.errors && Object.keys(validationResultsRef.current.errors).length > 0) {
|
|
339
364
|
applyValidationRules(validationRules.filter(function (_ref6) {
|
|
340
365
|
var n = _ref6[0];
|
|
341
366
|
return touched[n] && validationResultsRef.current.errors[n];
|
|
342
367
|
}));
|
|
343
368
|
}
|
|
344
|
-
}, [applyValidationRules, touched]);
|
|
369
|
+
}, [applyValidationRules, touched]);
|
|
370
|
+
(0, _react.useEffect)(function () {
|
|
371
|
+
var element = formRef.current;
|
|
372
|
+
analyticsRef.current = {
|
|
373
|
+
start: new Date(),
|
|
374
|
+
errors: {}
|
|
375
|
+
};
|
|
376
|
+
sendAnalytics({
|
|
377
|
+
type: 'formOpen',
|
|
378
|
+
element: element
|
|
379
|
+
});
|
|
380
|
+
return function () {
|
|
381
|
+
if (!analyticsRef.current.submitted) {
|
|
382
|
+
sendAnalytics({
|
|
383
|
+
type: 'formClose',
|
|
384
|
+
element: element,
|
|
385
|
+
errors: analyticsRef.current.errors,
|
|
386
|
+
elapsed: new Date().getTime() - analyticsRef.current.start.getTime()
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
}, [sendAnalytics, formRef]); // There are three basic patterns of handling form input value state:
|
|
345
391
|
//
|
|
346
392
|
// 1 - form controlled
|
|
347
393
|
//
|
|
@@ -499,7 +545,12 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
499
545
|
|
|
500
546
|
validationRulesRef.current[name].field = validateName(validateArg, required);
|
|
501
547
|
return function () {
|
|
502
|
-
|
|
548
|
+
delete validationRulesRef.current[name].field;
|
|
549
|
+
var requiredFieldIndex = requiredFields.current.indexOf(name);
|
|
550
|
+
|
|
551
|
+
if (requiredFieldIndex !== -1) {
|
|
552
|
+
requiredFields.current.splice(requiredFieldIndex, 1);
|
|
553
|
+
}
|
|
503
554
|
};
|
|
504
555
|
}
|
|
505
556
|
|
|
@@ -524,9 +575,16 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
524
575
|
};
|
|
525
576
|
}, [onChange, pendingValidation, touched, validateOn, validationResults.errors, validationResults.infos, value, valueProp]);
|
|
526
577
|
return /*#__PURE__*/_react["default"].createElement("form", _extends({
|
|
527
|
-
ref:
|
|
578
|
+
ref: formRef
|
|
528
579
|
}, rest, {
|
|
529
580
|
onReset: function onReset(event) {
|
|
581
|
+
sendAnalytics({
|
|
582
|
+
type: 'formReset',
|
|
583
|
+
element: formRef.current,
|
|
584
|
+
data: event,
|
|
585
|
+
errors: analyticsRef.current.errors,
|
|
586
|
+
elapsed: new Date().getTime() - analyticsRef.current.start.getTime()
|
|
587
|
+
});
|
|
530
588
|
setPendingValidation(undefined);
|
|
531
589
|
|
|
532
590
|
if (!valueProp) {
|
|
@@ -538,6 +596,10 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
538
596
|
|
|
539
597
|
setTouched(defaultTouched);
|
|
540
598
|
setValidationResults(defaultValidationResults);
|
|
599
|
+
analyticsRef.current = {
|
|
600
|
+
start: new Date(),
|
|
601
|
+
errors: {}
|
|
602
|
+
};
|
|
541
603
|
|
|
542
604
|
if (_onReset) {
|
|
543
605
|
event.persist(); // extract from React's synthetic event pool
|
|
@@ -568,6 +630,7 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
568
630
|
};
|
|
569
631
|
if (onValidate) onValidate(nextValidationResults);
|
|
570
632
|
validationResultsRef.current = nextValidationResults;
|
|
633
|
+
updateAnalytics();
|
|
571
634
|
return nextValidationResults;
|
|
572
635
|
});
|
|
573
636
|
|
|
@@ -579,6 +642,16 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
579
642
|
adjustedEvent.touched = touched;
|
|
580
643
|
|
|
581
644
|
_onSubmit(adjustedEvent);
|
|
645
|
+
|
|
646
|
+
sendAnalytics({
|
|
647
|
+
type: 'formSubmit',
|
|
648
|
+
element: formRef.current,
|
|
649
|
+
data: adjustedEvent,
|
|
650
|
+
errors: analyticsRef.current.errors,
|
|
651
|
+
elapsed: new Date().getTime() - analyticsRef.current.start.getTime()
|
|
652
|
+
});
|
|
653
|
+
analyticsRef.current.errors = {};
|
|
654
|
+
analyticsRef.current.submitted = true;
|
|
582
655
|
}
|
|
583
656
|
}
|
|
584
657
|
}), /*#__PURE__*/_react["default"].createElement(_FormContext.FormContext.Provider, {
|
|
@@ -13,7 +13,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
15
|
|
|
16
|
-
function _extends() { _extends = Object.assign
|
|
16
|
+
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); }
|
|
17
17
|
|
|
18
18
|
var ArrayOfFormFields = function ArrayOfFormFields() {
|
|
19
19
|
var _useState = (0, _react.useState)({
|
|
@@ -13,7 +13,7 @@ var _utils = require("grommet/utils");
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
15
|
|
|
16
|
-
function _extends() { _extends = Object.assign
|
|
16
|
+
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); }
|
|
17
17
|
|
|
18
18
|
var customTheme = (0, _utils.deepMerge)(_themes.grommet, {
|
|
19
19
|
formField: {
|
|
@@ -41,7 +41,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
41
41
|
|
|
42
42
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
43
|
|
|
44
|
-
function _extends() { _extends = Object.assign
|
|
44
|
+
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); }
|
|
45
45
|
|
|
46
46
|
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; }
|
|
47
47
|
|
|
@@ -153,21 +153,23 @@ var Input = function Input(_ref2) {
|
|
|
153
153
|
}, rest, extraProps));
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
-
var
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
args[_key] = arguments[_key];
|
|
161
|
-
}
|
|
156
|
+
var useDebounce = function useDebounce() {
|
|
157
|
+
var _useState = (0, _react.useState)(),
|
|
158
|
+
func = _useState[0],
|
|
159
|
+
setFunc = _useState[1];
|
|
162
160
|
|
|
163
|
-
|
|
164
|
-
timeout = null;
|
|
165
|
-
func.apply(void 0, args);
|
|
166
|
-
};
|
|
161
|
+
var theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _defaultProps.defaultProps.theme;
|
|
167
162
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
163
|
+
(0, _react.useEffect)(function () {
|
|
164
|
+
var timer;
|
|
165
|
+
if (func) timer = setTimeout(function () {
|
|
166
|
+
return func();
|
|
167
|
+
}, theme.global.debounceDelay);
|
|
168
|
+
return function () {
|
|
169
|
+
return clearTimeout(timer);
|
|
170
|
+
};
|
|
171
|
+
}, [func, theme.global.debounceDelay]);
|
|
172
|
+
return setFunc;
|
|
171
173
|
};
|
|
172
174
|
|
|
173
175
|
var FormField = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
@@ -210,13 +212,14 @@ var FormField = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
210
212
|
contextOnBlur = _formContext$useFormF.onBlur,
|
|
211
213
|
contextOnChange = _formContext$useFormF.onChange;
|
|
212
214
|
|
|
213
|
-
var
|
|
214
|
-
focus =
|
|
215
|
-
setFocus =
|
|
215
|
+
var _useState2 = (0, _react.useState)(),
|
|
216
|
+
focus = _useState2[0],
|
|
217
|
+
setFocus = _useState2[1];
|
|
216
218
|
|
|
217
219
|
var formFieldRef = (0, _refs.useForwardedRef)(ref);
|
|
218
220
|
var formFieldTheme = theme.formField;
|
|
219
|
-
var themeBorder = formFieldTheme.border;
|
|
221
|
+
var themeBorder = formFieldTheme.border;
|
|
222
|
+
var debounce = useDebounce(); // This is here for backwards compatibility. In case the child is a grommet
|
|
220
223
|
// input component, set plain and focusIndicator props, if they aren't
|
|
221
224
|
// already set.
|
|
222
225
|
|
|
@@ -227,9 +230,12 @@ var FormField = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
227
230
|
}
|
|
228
231
|
|
|
229
232
|
if (child && child.type && grommetInputNames.indexOf(child.type.displayName) !== -1 && child.props.plain === undefined && child.props.focusIndicator === undefined) {
|
|
233
|
+
var _formFieldTheme$check;
|
|
234
|
+
|
|
230
235
|
return /*#__PURE__*/(0, _react.cloneElement)(child, {
|
|
231
236
|
plain: true,
|
|
232
|
-
focusIndicator: false
|
|
237
|
+
focusIndicator: false,
|
|
238
|
+
pad: 'CheckBox'.indexOf(child.type.displayName) !== -1 ? formFieldTheme == null ? void 0 : (_formFieldTheme$check = formFieldTheme.checkBox) == null ? void 0 : _formFieldTheme$check.pad : undefined
|
|
233
239
|
});
|
|
234
240
|
}
|
|
235
241
|
|
|
@@ -393,17 +399,11 @@ var FormField = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
393
399
|
onChange: contextOnChange || onChange ? function (event) {
|
|
394
400
|
event.persist();
|
|
395
401
|
if (onChange) onChange(event);
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
// field, but capture their attention before they move on
|
|
402
|
-
// past it. 2 second (2000ms) might be too long depending
|
|
403
|
-
// on how fast people type, and 200ms would be an eye blink
|
|
404
|
-
}, 500);
|
|
405
|
-
debouncedFn();
|
|
406
|
-
}
|
|
402
|
+
if (contextOnChange) debounce(function () {
|
|
403
|
+
return function () {
|
|
404
|
+
return contextOnChange(event);
|
|
405
|
+
};
|
|
406
|
+
});
|
|
407
407
|
} : undefined
|
|
408
408
|
}, containerRest), label && component !== _CheckBox.CheckBox || help ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, label && component !== _CheckBox.CheckBox && /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({
|
|
409
409
|
as: "label",
|
package/components/Grid/Grid.js
CHANGED
|
@@ -15,7 +15,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
function _extends() { _extends = Object.assign
|
|
18
|
+
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); }
|
|
19
19
|
|
|
20
20
|
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; }
|
|
21
21
|
|
|
@@ -47,5 +47,7 @@ var Grid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
47
47
|
});
|
|
48
48
|
exports.Grid = Grid;
|
|
49
49
|
Grid.displayName = 'Grid';
|
|
50
|
-
Grid.propTypes = _propTypes.GridPropTypes;
|
|
51
|
-
|
|
50
|
+
Grid.propTypes = _propTypes.GridPropTypes; // Defualting to true to support existing code that relies on
|
|
51
|
+
// grid.available to create a fallback option
|
|
52
|
+
|
|
53
|
+
Grid.available = true;
|
|
@@ -5,5 +5,3 @@ A grid system for laying out content. To use, define the
|
|
|
5
5
|
rows and columns, create area names for adjacent cells, and then
|
|
6
6
|
place Box components inside those areas using the gridArea property.
|
|
7
7
|
See https://css-tricks.com/snippets/css/complete-guide-grid/.
|
|
8
|
-
The availability of Grid can be tested via `Grid.available`. Use this
|
|
9
|
-
to create fallback rendering for older browsers, like ie11.
|
|
@@ -44,7 +44,9 @@ export type GridColumnsType =
|
|
|
44
44
|
|
|
45
45
|
export type GridGapType = GapType | { row?: GapType; column?: GapType };
|
|
46
46
|
|
|
47
|
-
export type AreasType =
|
|
47
|
+
export type AreasType =
|
|
48
|
+
| { name?: string; start?: number[]; end?: number[] }[]
|
|
49
|
+
| string[][];
|
|
48
50
|
export interface GridProps {
|
|
49
51
|
a11yTitle?: A11yTitleType;
|
|
50
52
|
alignSelf?: AlignSelfType;
|
|
@@ -72,6 +74,6 @@ type divProps = JSX.IntrinsicElements['div'];
|
|
|
72
74
|
|
|
73
75
|
export interface GridExtendedProps extends GridProps, divProps {}
|
|
74
76
|
|
|
75
|
-
declare const Grid: React.FC<GridExtendedProps
|
|
77
|
+
declare const Grid: React.FC<GridExtendedProps>;
|
|
76
78
|
|
|
77
79
|
export { Grid };
|
|
@@ -9,7 +9,7 @@ var _generalPropTypes = require("../../utils/general-prop-types");
|
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
11
|
|
|
12
|
-
function _extends() { _extends = Object.assign
|
|
12
|
+
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); }
|
|
13
13
|
|
|
14
14
|
var fixedSizes = ['xsmall', 'small', 'medium', 'large', 'xlarge'];
|
|
15
15
|
var sizes = ['xsmall', 'small', 'medium', 'large', 'xlarge', 'full', '1/2', '1/3', '2/3', '1/4', '2/4', '3/4', 'flex', 'auto'];
|
|
@@ -15,7 +15,7 @@ var _excluded = ["children", "overrideColumns", "overrideRows", "areas"];
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
17
|
|
|
18
|
-
function _extends() { _extends = Object.assign
|
|
18
|
+
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); }
|
|
19
19
|
|
|
20
20
|
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; }
|
|
21
21
|
|
|
@@ -8,58 +8,52 @@ export const AppGrid = () => {
|
|
|
8
8
|
return (
|
|
9
9
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
10
10
|
// <Grommet theme={...}>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
<Grid
|
|
12
|
+
fill
|
|
13
|
+
rows={['auto', 'flex']}
|
|
14
|
+
columns={['auto', 'flex']}
|
|
15
|
+
areas={[
|
|
16
|
+
{ name: 'header', start: [0, 0], end: [1, 0] },
|
|
17
|
+
{ name: 'sidebar', start: [0, 1], end: [0, 1] },
|
|
18
|
+
{ name: 'main', start: [1, 1], end: [1, 1] },
|
|
19
|
+
]}
|
|
20
|
+
>
|
|
21
|
+
<Box
|
|
22
|
+
gridArea="header"
|
|
23
|
+
direction="row"
|
|
24
|
+
align="center"
|
|
25
|
+
justify="between"
|
|
26
|
+
pad={{ horizontal: 'medium', vertical: 'small' }}
|
|
27
|
+
background="dark-2"
|
|
28
|
+
>
|
|
29
|
+
<Button onClick={() => setSidebar(!sidebar)}>
|
|
30
|
+
<Text size="large">Title</Text>
|
|
31
|
+
</Button>
|
|
32
|
+
<Text>my@email</Text>
|
|
33
|
+
</Box>
|
|
34
|
+
{sidebar && (
|
|
35
|
+
<Box
|
|
36
|
+
gridArea="sidebar"
|
|
37
|
+
background="dark-3"
|
|
38
|
+
width="small"
|
|
39
|
+
animation={[
|
|
40
|
+
{ type: 'fadeIn', duration: 300 },
|
|
41
|
+
{ type: 'slideRight', size: 'xlarge', duration: 150 },
|
|
21
42
|
]}
|
|
22
43
|
>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
pad={{ horizontal: 'medium', vertical: 'small' }}
|
|
29
|
-
background="dark-2"
|
|
30
|
-
>
|
|
31
|
-
<Button onClick={() => setSidebar(!sidebar)}>
|
|
32
|
-
<Text size="large">Title</Text>
|
|
44
|
+
{['First', 'Second', 'Third'].map((name) => (
|
|
45
|
+
<Button key={name} href="#" hoverIndicator>
|
|
46
|
+
<Box pad={{ horizontal: 'medium', vertical: 'small' }}>
|
|
47
|
+
<Text>{name}</Text>
|
|
48
|
+
</Box>
|
|
33
49
|
</Button>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{sidebar && (
|
|
37
|
-
<Box
|
|
38
|
-
gridArea="sidebar"
|
|
39
|
-
background="dark-3"
|
|
40
|
-
width="small"
|
|
41
|
-
animation={[
|
|
42
|
-
{ type: 'fadeIn', duration: 300 },
|
|
43
|
-
{ type: 'slideRight', size: 'xlarge', duration: 150 },
|
|
44
|
-
]}
|
|
45
|
-
>
|
|
46
|
-
{['First', 'Second', 'Third'].map((name) => (
|
|
47
|
-
<Button key={name} href="#" hoverIndicator>
|
|
48
|
-
<Box pad={{ horizontal: 'medium', vertical: 'small' }}>
|
|
49
|
-
<Text>{name}</Text>
|
|
50
|
-
</Box>
|
|
51
|
-
</Button>
|
|
52
|
-
))}
|
|
53
|
-
</Box>
|
|
54
|
-
)}
|
|
55
|
-
<Box gridArea="main" justify="center" align="center">
|
|
56
|
-
<Text>main</Text>
|
|
57
|
-
</Box>
|
|
58
|
-
</Grid>
|
|
59
|
-
) : (
|
|
60
|
-
<Text>Grid is not supported by your browser</Text>
|
|
50
|
+
))}
|
|
51
|
+
</Box>
|
|
61
52
|
)}
|
|
62
|
-
|
|
53
|
+
<Box gridArea="main" justify="center" align="center">
|
|
54
|
+
<Text>main</Text>
|
|
55
|
+
</Box>
|
|
56
|
+
</Grid>
|
|
63
57
|
// </Grommet>
|
|
64
58
|
);
|
|
65
59
|
};
|