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,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 { Grommet as GrommetIcon } from "grommet-icons/es6/icons/Grommet";
|
|
@@ -2,10 +2,12 @@ var _excluded = ["children", "errors", "infos", "messages", "onChange", "onReset
|
|
|
2
2
|
|
|
3
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
4
|
|
|
5
|
-
function _extends() { _extends = Object.assign
|
|
5
|
+
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); }
|
|
6
6
|
|
|
7
7
|
import React, { forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
|
+
import { useAnalytics } from '../../contexts';
|
|
8
9
|
import { MessageContext } from '../../contexts/MessageContext';
|
|
10
|
+
import { useForwardedRef } from '../../utils';
|
|
9
11
|
import { FormContext } from './FormContext';
|
|
10
12
|
import { FormPropTypes } from './propTypes';
|
|
11
13
|
var defaultValue = {};
|
|
@@ -182,6 +184,8 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
182
184
|
valueProp = _ref2.value,
|
|
183
185
|
rest = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
184
186
|
|
|
187
|
+
var formRef = useForwardedRef(ref);
|
|
188
|
+
|
|
185
189
|
var _useContext = useContext(MessageContext),
|
|
186
190
|
format = _useContext.format;
|
|
187
191
|
|
|
@@ -225,6 +229,11 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
225
229
|
|
|
226
230
|
var validationRulesRef = useRef({});
|
|
227
231
|
var requiredFields = useRef([]);
|
|
232
|
+
var analyticsRef = useRef({
|
|
233
|
+
start: new Date(),
|
|
234
|
+
errors: {}
|
|
235
|
+
});
|
|
236
|
+
var sendAnalytics = useAnalytics();
|
|
228
237
|
var buildValid = useCallback(function (nextErrors) {
|
|
229
238
|
var valid = false;
|
|
230
239
|
valid = requiredFields.current.filter(function (n) {
|
|
@@ -247,6 +256,19 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
247
256
|
});
|
|
248
257
|
};
|
|
249
258
|
|
|
259
|
+
var updateAnalytics = function updateAnalytics() {
|
|
260
|
+
var _validationResultsRef;
|
|
261
|
+
|
|
262
|
+
var errorFields = Object.keys((_validationResultsRef = validationResultsRef.current) == null ? void 0 : _validationResultsRef.errors);
|
|
263
|
+
var errorCounts = analyticsRef.current.errors;
|
|
264
|
+
|
|
265
|
+
if (errorFields.length > 0) {
|
|
266
|
+
errorFields.forEach(function (key) {
|
|
267
|
+
errorCounts[key] = (errorCounts[key] || 0) + 1;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
250
272
|
var applyValidationRules = useCallback(function (validationRules) {
|
|
251
273
|
var _validateForm = validateForm(validationRules, value, format, messages),
|
|
252
274
|
validatedErrors = _validateForm[0],
|
|
@@ -271,6 +293,7 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
271
293
|
valid: buildValid(nextErrors)
|
|
272
294
|
}));
|
|
273
295
|
validationResultsRef.current = nextValidationResults;
|
|
296
|
+
updateAnalytics();
|
|
274
297
|
return nextValidationResults;
|
|
275
298
|
});
|
|
276
299
|
}, [buildValid, format, messages, onValidate, value]); // Validate all fields holding values onMount if set to
|
|
@@ -318,17 +341,38 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
318
341
|
// as the user fixes them (basically act like validate=change for that)
|
|
319
342
|
|
|
320
343
|
useEffect(function () {
|
|
321
|
-
var
|
|
344
|
+
var _validationResultsRef2;
|
|
322
345
|
|
|
323
346
|
var validationRules = Object.entries(validationRulesRef.current);
|
|
324
347
|
|
|
325
|
-
if ((
|
|
348
|
+
if ((_validationResultsRef2 = validationResultsRef.current) != null && _validationResultsRef2.errors && Object.keys(validationResultsRef.current.errors).length > 0) {
|
|
326
349
|
applyValidationRules(validationRules.filter(function (_ref6) {
|
|
327
350
|
var n = _ref6[0];
|
|
328
351
|
return touched[n] && validationResultsRef.current.errors[n];
|
|
329
352
|
}));
|
|
330
353
|
}
|
|
331
|
-
}, [applyValidationRules, touched]);
|
|
354
|
+
}, [applyValidationRules, touched]);
|
|
355
|
+
useEffect(function () {
|
|
356
|
+
var element = formRef.current;
|
|
357
|
+
analyticsRef.current = {
|
|
358
|
+
start: new Date(),
|
|
359
|
+
errors: {}
|
|
360
|
+
};
|
|
361
|
+
sendAnalytics({
|
|
362
|
+
type: 'formOpen',
|
|
363
|
+
element: element
|
|
364
|
+
});
|
|
365
|
+
return function () {
|
|
366
|
+
if (!analyticsRef.current.submitted) {
|
|
367
|
+
sendAnalytics({
|
|
368
|
+
type: 'formClose',
|
|
369
|
+
element: element,
|
|
370
|
+
errors: analyticsRef.current.errors,
|
|
371
|
+
elapsed: new Date().getTime() - analyticsRef.current.start.getTime()
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}, [sendAnalytics, formRef]); // There are three basic patterns of handling form input value state:
|
|
332
376
|
//
|
|
333
377
|
// 1 - form controlled
|
|
334
378
|
//
|
|
@@ -486,7 +530,12 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
486
530
|
|
|
487
531
|
validationRulesRef.current[name].field = validateName(validateArg, required);
|
|
488
532
|
return function () {
|
|
489
|
-
|
|
533
|
+
delete validationRulesRef.current[name].field;
|
|
534
|
+
var requiredFieldIndex = requiredFields.current.indexOf(name);
|
|
535
|
+
|
|
536
|
+
if (requiredFieldIndex !== -1) {
|
|
537
|
+
requiredFields.current.splice(requiredFieldIndex, 1);
|
|
538
|
+
}
|
|
490
539
|
};
|
|
491
540
|
}
|
|
492
541
|
|
|
@@ -511,9 +560,16 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
511
560
|
};
|
|
512
561
|
}, [onChange, pendingValidation, touched, validateOn, validationResults.errors, validationResults.infos, value, valueProp]);
|
|
513
562
|
return /*#__PURE__*/React.createElement("form", _extends({
|
|
514
|
-
ref:
|
|
563
|
+
ref: formRef
|
|
515
564
|
}, rest, {
|
|
516
565
|
onReset: function onReset(event) {
|
|
566
|
+
sendAnalytics({
|
|
567
|
+
type: 'formReset',
|
|
568
|
+
element: formRef.current,
|
|
569
|
+
data: event,
|
|
570
|
+
errors: analyticsRef.current.errors,
|
|
571
|
+
elapsed: new Date().getTime() - analyticsRef.current.start.getTime()
|
|
572
|
+
});
|
|
517
573
|
setPendingValidation(undefined);
|
|
518
574
|
|
|
519
575
|
if (!valueProp) {
|
|
@@ -525,6 +581,10 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
525
581
|
|
|
526
582
|
setTouched(defaultTouched);
|
|
527
583
|
setValidationResults(defaultValidationResults);
|
|
584
|
+
analyticsRef.current = {
|
|
585
|
+
start: new Date(),
|
|
586
|
+
errors: {}
|
|
587
|
+
};
|
|
528
588
|
|
|
529
589
|
if (_onReset) {
|
|
530
590
|
event.persist(); // extract from React's synthetic event pool
|
|
@@ -555,6 +615,7 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
555
615
|
};
|
|
556
616
|
if (onValidate) onValidate(nextValidationResults);
|
|
557
617
|
validationResultsRef.current = nextValidationResults;
|
|
618
|
+
updateAnalytics();
|
|
558
619
|
return nextValidationResults;
|
|
559
620
|
});
|
|
560
621
|
|
|
@@ -566,6 +627,16 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
566
627
|
adjustedEvent.touched = touched;
|
|
567
628
|
|
|
568
629
|
_onSubmit(adjustedEvent);
|
|
630
|
+
|
|
631
|
+
sendAnalytics({
|
|
632
|
+
type: 'formSubmit',
|
|
633
|
+
element: formRef.current,
|
|
634
|
+
data: adjustedEvent,
|
|
635
|
+
errors: analyticsRef.current.errors,
|
|
636
|
+
elapsed: new Date().getTime() - analyticsRef.current.start.getTime()
|
|
637
|
+
});
|
|
638
|
+
analyticsRef.current.errors = {};
|
|
639
|
+
analyticsRef.current.submitted = true;
|
|
569
640
|
}
|
|
570
641
|
}
|
|
571
642
|
}), /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
@@ -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, { useState } from 'react';
|
|
4
4
|
import { Box, Form, Button, FormField } from 'grommet';
|
|
@@ -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, Form, FormField, Grid, Grommet, Heading, RadioButtonGroup, TextInput, ThemeContext } from 'grommet';
|
|
@@ -2,11 +2,11 @@ var _excluded = ["error", "info", "message", "type"],
|
|
|
2
2
|
_excluded2 = ["component", "disabled", "invalid", "name", "onChange"],
|
|
3
3
|
_excluded3 = ["children", "className", "component", "contentProps", "disabled", "error", "help", "htmlFor", "info", "label", "margin", "name", "onBlur", "onChange", "onFocus", "pad", "required", "style", "validate"];
|
|
4
4
|
|
|
5
|
-
function _extends() { _extends = Object.assign
|
|
5
|
+
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); }
|
|
6
6
|
|
|
7
7
|
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; }
|
|
8
8
|
|
|
9
|
-
import React, { Children, cloneElement, forwardRef, useContext, useState } from 'react';
|
|
9
|
+
import React, { Children, cloneElement, forwardRef, useContext, useState, useEffect } from 'react';
|
|
10
10
|
import styled, { ThemeContext } from 'styled-components';
|
|
11
11
|
import { defaultProps } from '../../default-props';
|
|
12
12
|
import { containsFocus, shouldKeepFocus } from '../../utils/DOM';
|
|
@@ -129,21 +129,22 @@ var Input = function Input(_ref2) {
|
|
|
129
129
|
}, rest, extraProps));
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
var
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
args[_key] = arguments[_key];
|
|
137
|
-
}
|
|
132
|
+
var useDebounce = function useDebounce() {
|
|
133
|
+
var _useState = useState(),
|
|
134
|
+
func = _useState[0],
|
|
135
|
+
setFunc = _useState[1];
|
|
138
136
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
var theme = useContext(ThemeContext) || defaultProps.theme;
|
|
138
|
+
useEffect(function () {
|
|
139
|
+
var timer;
|
|
140
|
+
if (func) timer = setTimeout(function () {
|
|
141
|
+
return func();
|
|
142
|
+
}, theme.global.debounceDelay);
|
|
143
|
+
return function () {
|
|
144
|
+
return clearTimeout(timer);
|
|
142
145
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
timeout = setTimeout(later, wait);
|
|
146
|
-
};
|
|
146
|
+
}, [func, theme.global.debounceDelay]);
|
|
147
|
+
return setFunc;
|
|
147
148
|
};
|
|
148
149
|
|
|
149
150
|
var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
@@ -185,13 +186,14 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
185
186
|
contextOnBlur = _formContext$useFormF.onBlur,
|
|
186
187
|
contextOnChange = _formContext$useFormF.onChange;
|
|
187
188
|
|
|
188
|
-
var
|
|
189
|
-
focus =
|
|
190
|
-
setFocus =
|
|
189
|
+
var _useState2 = useState(),
|
|
190
|
+
focus = _useState2[0],
|
|
191
|
+
setFocus = _useState2[1];
|
|
191
192
|
|
|
192
193
|
var formFieldRef = useForwardedRef(ref);
|
|
193
194
|
var formFieldTheme = theme.formField;
|
|
194
|
-
var themeBorder = formFieldTheme.border;
|
|
195
|
+
var themeBorder = formFieldTheme.border;
|
|
196
|
+
var debounce = useDebounce(); // This is here for backwards compatibility. In case the child is a grommet
|
|
195
197
|
// input component, set plain and focusIndicator props, if they aren't
|
|
196
198
|
// already set.
|
|
197
199
|
|
|
@@ -202,9 +204,12 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
202
204
|
}
|
|
203
205
|
|
|
204
206
|
if (child && child.type && grommetInputNames.indexOf(child.type.displayName) !== -1 && child.props.plain === undefined && child.props.focusIndicator === undefined) {
|
|
207
|
+
var _formFieldTheme$check;
|
|
208
|
+
|
|
205
209
|
return /*#__PURE__*/cloneElement(child, {
|
|
206
210
|
plain: true,
|
|
207
|
-
focusIndicator: false
|
|
211
|
+
focusIndicator: false,
|
|
212
|
+
pad: 'CheckBox'.indexOf(child.type.displayName) !== -1 ? formFieldTheme == null ? void 0 : (_formFieldTheme$check = formFieldTheme.checkBox) == null ? void 0 : _formFieldTheme$check.pad : undefined
|
|
208
213
|
});
|
|
209
214
|
}
|
|
210
215
|
|
|
@@ -368,17 +373,11 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
368
373
|
onChange: contextOnChange || onChange ? function (event) {
|
|
369
374
|
event.persist();
|
|
370
375
|
if (onChange) onChange(event);
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
// field, but capture their attention before they move on
|
|
377
|
-
// past it. 2 second (2000ms) might be too long depending
|
|
378
|
-
// on how fast people type, and 200ms would be an eye blink
|
|
379
|
-
}, 500);
|
|
380
|
-
debouncedFn();
|
|
381
|
-
}
|
|
376
|
+
if (contextOnChange) debounce(function () {
|
|
377
|
+
return function () {
|
|
378
|
+
return contextOnChange(event);
|
|
379
|
+
};
|
|
380
|
+
});
|
|
382
381
|
} : undefined
|
|
383
382
|
}, containerRest), label && component !== CheckBox || help ? /*#__PURE__*/React.createElement(React.Fragment, null, label && component !== CheckBox && /*#__PURE__*/React.createElement(Text, _extends({
|
|
384
383
|
as: "label",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["a11yTitle", "aria-label", "border", "fill", "height", "responsive", "rows", "tag", "as", "width"];
|
|
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
|
|
|
@@ -34,6 +34,8 @@ var Grid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
34
34
|
}, rest));
|
|
35
35
|
});
|
|
36
36
|
Grid.displayName = 'Grid';
|
|
37
|
-
Grid.propTypes = GridPropTypes;
|
|
38
|
-
|
|
37
|
+
Grid.propTypes = GridPropTypes; // Defualting to true to support existing code that relies on
|
|
38
|
+
// grid.available to create a fallback option
|
|
39
|
+
|
|
40
|
+
Grid.available = true;
|
|
39
41
|
export { Grid };
|
|
@@ -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 };
|
|
@@ -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 { alignPropType, genericProps, heightPropType, padPropType, widthPropType } from '../../utils/general-prop-types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["children", "overrideColumns", "overrideRows", "areas"];
|
|
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
|
|
|
@@ -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
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var _excluded = ["children", "full", "containerTarget", "theme", "options", "messages"];
|
|
1
|
+
var _excluded = ["children", "full", "containerTarget", "theme", "options", "messages", "onAnalytics"];
|
|
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
|
|
|
@@ -15,6 +15,7 @@ import { OptionsContext } from '../../contexts/OptionsContext';
|
|
|
15
15
|
import { format as _format, MessageContext } from '../../contexts/MessageContext';
|
|
16
16
|
import defaultMessages from '../../languages/default.json';
|
|
17
17
|
import { GrommetPropTypes } from './propTypes';
|
|
18
|
+
import { AnalyticsProvider } from '../../contexts/AnalyticsContext';
|
|
18
19
|
var FullGlobalStyle = createGlobalStyle(["body{margin:0;}"]);
|
|
19
20
|
|
|
20
21
|
var deviceResponsive = function deviceResponsive(userAgent, theme) {
|
|
@@ -52,6 +53,7 @@ var Grommet = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
52
53
|
_props$options = props.options,
|
|
53
54
|
options = _props$options === void 0 ? defaultOptions : _props$options,
|
|
54
55
|
messagesProp = props.messages,
|
|
56
|
+
onAnalytics = props.onAnalytics,
|
|
55
57
|
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
56
58
|
|
|
57
59
|
var background = props.background,
|
|
@@ -132,11 +134,13 @@ var Grommet = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
132
134
|
value: options
|
|
133
135
|
}, /*#__PURE__*/React.createElement(MessageContext.Provider, {
|
|
134
136
|
value: messages
|
|
137
|
+
}, /*#__PURE__*/React.createElement(AnalyticsProvider, {
|
|
138
|
+
onAnalytics: onAnalytics
|
|
135
139
|
}, /*#__PURE__*/React.createElement(StyledGrommet, _extends({
|
|
136
140
|
full: full
|
|
137
141
|
}, rest, {
|
|
138
142
|
ref: grommetRef
|
|
139
|
-
}), children), full && /*#__PURE__*/React.createElement(FullGlobalStyle, null)))))));
|
|
143
|
+
}), children), full && /*#__PURE__*/React.createElement(FullGlobalStyle, null))))))));
|
|
140
144
|
});
|
|
141
145
|
Grommet.displayName = 'Grommet';
|
|
142
146
|
Grommet.propTypes = GrommetPropTypes;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["sticky"];
|
|
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
|
-
var _excluded = ["color", "fill", "level"];
|
|
1
|
+
var _excluded = ["color", "fill", "level", "weight"];
|
|
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
|
|
|
@@ -12,6 +12,7 @@ var Heading = /*#__PURE__*/forwardRef(function (_ref, ref // munged to avoid sty
|
|
|
12
12
|
var color = _ref.color,
|
|
13
13
|
fill = _ref.fill,
|
|
14
14
|
level = _ref.level,
|
|
15
|
+
weight = _ref.weight,
|
|
15
16
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
16
17
|
|
|
17
18
|
return (
|
|
@@ -21,7 +22,8 @@ var Heading = /*#__PURE__*/forwardRef(function (_ref, ref // munged to avoid sty
|
|
|
21
22
|
as: "h" + level,
|
|
22
23
|
colorProp: color,
|
|
23
24
|
fillProp: fill,
|
|
24
|
-
level: +level
|
|
25
|
+
level: +level,
|
|
26
|
+
weight: weight
|
|
25
27
|
}, rest, {
|
|
26
28
|
ref: ref
|
|
27
29
|
}))
|
|
@@ -10,7 +10,7 @@ var sizeStyle = function sizeStyle(props) {
|
|
|
10
10
|
|
|
11
11
|
if (levelStyle) {
|
|
12
12
|
var data = levelStyle[size];
|
|
13
|
-
var styles = [css(["font-size:", ";line-height:", ";max-width:", ";font-weight:", ";"], data ? data.size : size, data ? data.height : 'normal', props.fillProp && 'none' || data && data.maxWidth || levelStyle.medium.maxWidth, levelStyle.font.weight || headingTheme.weight)];
|
|
13
|
+
var styles = [css(["font-size:", ";line-height:", ";max-width:", ";font-weight:", ";"], data ? data.size : size, data ? data.height : 'normal', props.fillProp && 'none' || data && data.maxWidth || levelStyle.medium.maxWidth, props.weight || levelStyle.font.weight || headingTheme.weight)];
|
|
14
14
|
|
|
15
15
|
if (props.responsive && headingTheme.responsiveBreakpoint) {
|
|
16
16
|
var breakpoint = props.theme.global.breakpoints[headingTheme.responsiveBreakpoint];
|
|
@@ -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 { colorPropType, genericProps } from '../../utils/general-prop-types';
|
|
@@ -12,7 +12,8 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
12
12
|
responsive: PropTypes.bool,
|
|
13
13
|
size: PropTypes.oneOfType([PropTypes.oneOf(['small', 'medium', 'large', 'xlarge']), PropTypes.string]),
|
|
14
14
|
textAlign: PropTypes.oneOf(['start', 'center', 'end', 'justify']),
|
|
15
|
-
truncate: PropTypes.bool
|
|
15
|
+
truncate: PropTypes.bool,
|
|
16
|
+
weight: PropTypes.oneOfType([PropTypes.oneOf(['normal', 'bold', 'lighter', 'bolder']), PropTypes.number, PropTypes.string])
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var _excluded = ["a11yTitle", "fallback", "onError", "opacity", "fill", "src"];
|
|
1
|
+
var _excluded = ["a11yTitle", "fallback", "onError", "onLoad", "opacity", "fill", "src"];
|
|
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
|
|
|
@@ -11,6 +11,7 @@ var Image = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
11
11
|
var a11yTitle = _ref.a11yTitle,
|
|
12
12
|
fallback = _ref.fallback,
|
|
13
13
|
onError = _ref.onError,
|
|
14
|
+
onLoad = _ref.onLoad,
|
|
14
15
|
opacity = _ref.opacity,
|
|
15
16
|
fill = _ref.fill,
|
|
16
17
|
src = _ref.src,
|
|
@@ -30,7 +31,8 @@ var Image = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
var handleOnLoad = function handleOnLoad() {
|
|
34
|
+
var handleOnLoad = function handleOnLoad(event) {
|
|
35
|
+
if (onLoad) onLoad(event);
|
|
34
36
|
setFallbackInUse(false);
|
|
35
37
|
};
|
|
36
38
|
|
|
@@ -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';
|