grommet 2.24.0 → 2.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all/stories/AllComponents.js +2 -7
- package/components/Accordion/Accordion.js +1 -1
- package/components/Accordion/propTypes.js +1 -1
- package/components/Accordion/stories/CustomThemed/Custom.js +3 -2
- package/components/AccordionPanel/AccordionPanel.js +2 -1
- package/components/Anchor/Anchor.js +15 -2
- package/components/Anchor/propTypes.js +1 -1
- package/components/Avatar/Avatar.js +1 -1
- package/components/Box/Box.js +1 -1
- package/components/Box/StyledBox.js +1 -1
- package/components/Box/propTypes.js +1 -1
- package/components/Button/Button.js +83 -10
- package/components/Button/StyledButtonKind.js +9 -3
- package/components/Button/index.d.ts +1 -1
- package/components/Button/propTypes.js +3 -3
- package/components/Button/stories/Basic.js +1 -1
- package/components/Button/stories/Fill.js +1 -1
- package/components/Button/stories/Kind.js +1 -1
- package/components/Calendar/Calendar.js +233 -293
- package/components/Calendar/index.d.ts +2 -2
- package/components/Calendar/propTypes.js +1 -1
- package/components/Calendar/stories/ShowAdjacentDays.js +1 -1
- package/components/Calendar/utils.js +16 -129
- package/components/Card/Card.js +1 -1
- package/components/Card/stories/CustomThemed/Clickable.js +1 -1
- package/components/Card/stories/CustomThemed/RichFooter.js +1 -1
- package/components/Card/stories/CustomThemed/Themed.js +1 -1
- package/components/CardBody/CardBody.js +1 -1
- package/components/CardFooter/CardFooter.js +1 -1
- package/components/CardHeader/CardHeader.js +1 -1
- package/components/Carousel/Carousel.js +1 -1
- package/components/Carousel/propTypes.js +1 -1
- package/components/Carousel/stories/CustomThemed/Custom.js +1 -1
- package/components/Chart/Chart.js +1 -1
- package/components/Chart/calcs.js +44 -27
- package/components/Chart/index.d.ts +28 -2
- package/components/Chart/propTypes.js +1 -1
- package/components/Chart/stories/Rich.js +1 -1
- package/components/Chart/stories/Scan.js +11 -9
- package/components/Chart/stories/Window.js +1 -1
- package/components/Chart/stories/data.js +16 -17
- package/components/CheckBox/CheckBox.js +4 -3
- package/components/CheckBox/stories/CustomThemed/Custom.js +1 -1
- package/components/CheckBox/stories/CustomThemed/CustomToggle.js +1 -1
- package/components/CheckBox/stories/NoLabel.js +1 -1
- package/components/CheckBox/stories/Simple.js +1 -1
- package/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/components/Clock/Analog.js +1 -1
- package/components/Clock/Clock.js +1 -1
- package/components/Clock/Digital.js +1 -1
- package/components/Clock/propTypes.js +1 -1
- package/components/Collapsible/stories/Nested.js +1 -1
- package/components/Collapsible/stories/Simple.js +1 -1
- package/components/DataChart/DataChart.js +22 -55
- package/components/DataChart/Detail.js +18 -11
- package/components/DataChart/Legend.js +1 -1
- package/components/DataChart/Swatch.js +64 -23
- package/components/DataChart/XAxis.js +30 -19
- package/components/DataChart/YGuide.js +1 -1
- package/components/DataChart/propTypes.js +1 -1
- package/components/DataChart/stories/Legend.js +6 -2
- package/components/DataChart/stories/Pad.js +54 -0
- package/components/DataChart/utils.js +11 -1
- package/components/DataTable/Body.js +11 -5
- package/components/DataTable/Cell.js +1 -1
- package/components/DataTable/DataTable.js +14 -10
- package/components/DataTable/ExpanderCell.js +1 -1
- package/components/DataTable/Footer.js +1 -1
- package/components/DataTable/GroupedBody.js +1 -1
- package/components/DataTable/Header.js +1 -1
- package/components/DataTable/Resizer.js +1 -1
- package/components/DataTable/Sorter.js +1 -1
- package/components/DataTable/buildState.js +2 -2
- package/components/DataTable/index.d.ts +4 -1
- package/components/DataTable/propTypes.js +1 -1
- package/components/DataTable/stories/Controlled.js +1 -1
- package/components/DataTable/stories/ControlledGrouped.js +1 -1
- package/components/DataTable/stories/CustomThemed/Fill.js +1 -1
- package/components/DataTable/stories/GroupedOnSelect.js +1 -1
- package/components/DataTable/stories/OnUpdate.js +1 -1
- package/components/DataTable/stories/Served.js +1 -1
- package/components/DataTable/stories/Sort.js +1 -1
- package/components/DataTable/stories/SpaceX.js +3 -1
- package/components/DataTable/stories/SpaceXUngrouped.js +6 -2
- package/components/DataTable/stories/Tunable.js +1 -1
- package/components/DataTable/stories/data.js +1 -1
- package/components/DataTable/stories/rowDetails.js +1 -1
- package/components/DateInput/DateInput.js +89 -92
- package/components/DateInput/index.d.ts +1 -0
- package/components/DateInput/propTypes.js +1 -0
- package/components/DateInput/stories/Format.js +14 -1
- package/components/DateInput/utils.js +31 -6
- package/components/Diagram/Diagram.js +1 -1
- package/components/Diagram/stories/Animated.js +1 -1
- package/components/Diagram/stories/Progressing.js +1 -1
- package/components/Distribution/Distribution.js +1 -1
- package/components/Distribution/propTypes.js +1 -1
- package/components/Drop/Drop.js +1 -1
- package/components/Drop/DropContainer.js +1 -1
- package/components/DropButton/DropButton.js +1 -1
- package/components/DropButton/propTypes.js +1 -1
- package/components/FileInput/FileInput.js +28 -9
- package/components/FileInput/StyledFileInput.js +1 -1
- package/components/FileInput/stories/Multiple.js +1 -0
- package/components/FocusedContainer.js +1 -1
- package/components/Footer/Footer.js +1 -1
- package/components/Footer/stories/DoubleFooter.js +1 -1
- package/components/Footer/stories/Sitemap.js +1 -1
- package/components/Form/Form.js +79 -6
- package/components/Form/stories/ArrayOfFormFields.js +1 -1
- package/components/Form/stories/CustomThemed/FieldSpacingOptions.js +1 -1
- package/components/FormField/FormField.js +30 -30
- package/components/Grid/Grid.js +5 -3
- package/components/Grid/README.md +0 -2
- package/components/Grid/index.d.ts +4 -2
- package/components/Grid/propTypes.js +1 -1
- package/components/Grid/stories/CustomThemed/Responsive.js +1 -1
- package/components/Grid/stories/typescript/App.tsx +42 -48
- package/components/Grommet/Grommet.js +8 -3
- package/components/Grommet/index.d.ts +1 -0
- package/components/Grommet/propTypes.js +2 -1
- package/components/Header/Header.js +1 -1
- package/components/Heading/Heading.js +5 -3
- package/components/Heading/StyledHeading.js +1 -1
- package/components/Heading/index.d.ts +1 -0
- package/components/Heading/propTypes.js +3 -2
- package/components/Image/Image.js +5 -3
- package/components/Image/propTypes.js +1 -1
- package/components/InfiniteScroll/stories/Basics.js +1 -1
- package/components/InfiniteScroll/stories/ClassChildren.js +1 -1
- package/components/InfiniteScroll/stories/Marker.js +1 -1
- package/components/InfiniteScroll/stories/Show.js +1 -1
- package/components/InfiniteScroll/stories/ShowAfter.js +1 -1
- package/components/InfiniteScroll/stories/ShowBefore.js +1 -1
- package/components/Layer/Layer.js +1 -1
- package/components/Layer/LayerContainer.js +19 -1
- package/components/List/List.js +1 -1
- package/components/List/propTypes.js +1 -1
- package/components/Main/Main.js +1 -1
- package/components/Markdown/Markdown.js +1 -1
- package/components/MaskedInput/MaskedInput.js +37 -28
- package/components/Menu/Menu.js +109 -62
- package/components/Menu/index.d.ts +2 -2
- package/components/Menu/propTypes.js +2 -2
- package/components/Menu/stories/CustomThemed/Themed.tsx +6 -0
- package/components/Menu/stories/Grouped.js +52 -0
- package/components/Meter/Bar.js +1 -1
- package/components/Meter/Circle.js +9 -3
- package/components/Meter/Meter.js +1 -1
- package/components/Meter/propTypes.js +1 -1
- package/components/NameValueList/NameValueList.js +1 -1
- package/components/NameValuePair/NameValuePair.js +1 -1
- package/components/Nav/Nav.js +1 -1
- package/components/Nav/stories/CustomThemed/JustifySidebar.js +1 -1
- package/components/Nav/stories/Sidebar.js +1 -1
- package/components/Notification/Notification.js +1 -1
- package/components/Notification/index.d.ts +1 -1
- package/components/Notification/propTypes.js +1 -1
- package/components/Page/Page.js +1 -1
- package/components/PageContent/PageContent.js +1 -1
- package/components/PageHeader/PageHeader.js +23 -14
- package/components/PageHeader/index.d.ts +10 -1
- package/components/PageHeader/propTypes.js +2 -1
- package/components/PageHeader/stories/Size.js +55 -0
- package/components/Pagination/PageControl.js +1 -1
- package/components/Pagination/Pagination.js +1 -1
- package/components/Pagination/propTypes.js +1 -1
- package/components/Paragraph/Paragraph.js +1 -1
- package/components/Paragraph/StyledParagraph.js +7 -1
- package/components/Paragraph/index.d.ts +1 -0
- package/components/Paragraph/propTypes.js +2 -1
- package/components/Paragraph/stories/MaxLines.js +37 -0
- package/components/RadioButton/RadioButton.js +1 -1
- package/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.js +1 -1
- package/components/RadioButtonGroup/stories/Disabled.js +1 -1
- package/components/RangeInput/RangeInput.js +1 -1
- package/components/RangeSelector/EdgeControl.js +1 -1
- package/components/RangeSelector/RangeSelector.js +1 -1
- package/components/RangeSelector/stories/CustomThemed/Custom.js +1 -1
- package/components/RangeSelector/stories/CustomThemed/CustomEdgeControl.js +1 -1
- package/components/RangeSelector/stories/Step.js +1 -1
- package/components/RangeSelector/stories/Vertical.js +1 -1
- package/components/RoutedAnchor/RoutedAnchor.js +2 -2
- package/components/RoutedButton/RoutedButton.js +2 -2
- package/components/Select/Select.js +11 -30
- package/components/Select/SelectContainer.js +97 -76
- package/components/Select/propTypes.js +1 -1
- package/components/Select/stories/Clear.js +7 -1
- package/components/Select/stories/components/SearchBorderBox.js +1 -1
- package/components/Select/stories/components/SearchInput.js +1 -1
- package/components/Select/utils.js +1 -0
- package/components/Sidebar/Sidebar.js +1 -1
- package/components/Sidebar/stories/Labels.js +1 -1
- package/components/SkipLink/SkipLink.js +1 -1
- package/components/SkipLinkTarget/SkipLinkTarget.js +1 -1
- package/components/Spinner/Spinner.js +2 -1
- package/components/Stack/Stack.js +1 -1
- package/components/Stack/propTypes.js +1 -1
- package/components/Tab/StyledTab.js +2 -2
- package/components/Tab/Tab.js +35 -17
- package/components/Table/propTypes.js +1 -1
- package/components/TableBody/TableBody.js +1 -1
- package/components/TableCell/TableCell.js +1 -1
- package/components/TableFooter/TableFooter.js +1 -1
- package/components/TableHeader/TableHeader.js +1 -1
- package/components/TableRow/TableRow.js +1 -1
- package/components/Tabs/Tabs.js +241 -11
- package/components/Tabs/propTypes.js +1 -1
- package/components/Tabs/stories/Responsive.js +18 -0
- package/components/Tag/Tag.js +1 -1
- package/components/Tag/propTypes.js +1 -1
- package/components/Text/Text.js +1 -1
- package/components/Text/propTypes.js +1 -1
- package/components/TextArea/TextArea.js +1 -1
- package/components/TextArea/stories/NonResizable.js +1 -1
- package/components/TextArea/stories/Simple.js +1 -1
- package/components/TextInput/TextInput.js +1 -1
- package/components/TextInput/stories/InsideFormField.js +1 -1
- package/components/TextInput/stories/WithTags.js +1 -1
- package/components/Tip/Tip.js +4 -23
- package/components/Video/StyledVideo.js +2 -2
- package/components/Video/Video.js +1 -1
- package/components/Video/propTypes.js +1 -1
- package/components/WorldMap/WorldMap.js +1 -1
- package/components/WorldMap/propTypes.js +1 -1
- package/components/WorldMap/stories/Places.js +1 -1
- package/contexts/AnalyticsContext/AnalyticsContext.js +65 -0
- package/contexts/AnalyticsContext/index.d.ts +7 -0
- package/contexts/AnalyticsContext/index.js +11 -0
- package/contexts/AnnounceContext/stories/Assertive.js +1 -1
- package/contexts/ResponsiveContext/stories/ResponsiveGrid.js +1 -1
- package/contexts/index.js +8 -0
- package/es6/all/stories/AllComponents.js +2 -7
- package/es6/components/Accordion/Accordion.js +1 -1
- package/es6/components/Accordion/propTypes.js +1 -1
- package/es6/components/Accordion/stories/CustomThemed/Custom.js +3 -2
- package/es6/components/AccordionPanel/AccordionPanel.js +2 -1
- package/es6/components/Anchor/Anchor.js +15 -3
- package/es6/components/Anchor/propTypes.js +1 -1
- package/es6/components/Avatar/Avatar.js +1 -1
- package/es6/components/Box/Box.js +1 -1
- package/es6/components/Box/StyledBox.js +1 -1
- package/es6/components/Box/propTypes.js +1 -1
- package/es6/components/Button/Button.js +84 -12
- package/es6/components/Button/StyledButtonKind.js +9 -3
- package/es6/components/Button/index.d.ts +1 -1
- package/es6/components/Button/propTypes.js +3 -3
- package/es6/components/Button/stories/Basic.js +1 -1
- package/es6/components/Button/stories/Fill.js +1 -1
- package/es6/components/Button/stories/Kind.js +1 -1
- package/es6/components/Calendar/Calendar.js +231 -293
- package/es6/components/Calendar/index.d.ts +2 -2
- package/es6/components/Calendar/propTypes.js +1 -1
- package/es6/components/Calendar/stories/ShowAdjacentDays.js +1 -1
- package/es6/components/Calendar/utils.js +13 -114
- package/es6/components/Card/Card.js +1 -1
- package/es6/components/Card/stories/CustomThemed/Clickable.js +1 -1
- package/es6/components/Card/stories/CustomThemed/RichFooter.js +1 -1
- package/es6/components/Card/stories/CustomThemed/Themed.js +1 -1
- package/es6/components/CardBody/CardBody.js +1 -1
- package/es6/components/CardFooter/CardFooter.js +1 -1
- package/es6/components/CardHeader/CardHeader.js +1 -1
- package/es6/components/Carousel/Carousel.js +1 -1
- package/es6/components/Carousel/propTypes.js +1 -1
- package/es6/components/Carousel/stories/CustomThemed/Custom.js +1 -1
- package/es6/components/Chart/Chart.js +1 -1
- package/es6/components/Chart/calcs.js +44 -27
- package/es6/components/Chart/index.d.ts +28 -2
- package/es6/components/Chart/propTypes.js +1 -1
- package/es6/components/Chart/stories/Rich.js +1 -1
- package/es6/components/Chart/stories/Scan.js +10 -9
- package/es6/components/Chart/stories/Window.js +1 -1
- package/es6/components/Chart/stories/data.js +16 -17
- package/es6/components/CheckBox/CheckBox.js +4 -3
- package/es6/components/CheckBox/stories/CustomThemed/Custom.js +1 -1
- package/es6/components/CheckBox/stories/CustomThemed/CustomToggle.js +1 -1
- package/es6/components/CheckBox/stories/NoLabel.js +1 -1
- package/es6/components/CheckBox/stories/Simple.js +1 -1
- package/es6/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/es6/components/Clock/Analog.js +1 -1
- package/es6/components/Clock/Clock.js +1 -1
- package/es6/components/Clock/Digital.js +1 -1
- package/es6/components/Clock/propTypes.js +1 -1
- package/es6/components/Collapsible/stories/Nested.js +1 -1
- package/es6/components/Collapsible/stories/Simple.js +1 -1
- package/es6/components/DataChart/DataChart.js +24 -57
- package/es6/components/DataChart/Detail.js +20 -10
- package/es6/components/DataChart/Legend.js +1 -1
- package/es6/components/DataChart/Swatch.js +64 -23
- package/es6/components/DataChart/XAxis.js +30 -20
- package/es6/components/DataChart/YGuide.js +1 -1
- package/es6/components/DataChart/propTypes.js +1 -1
- package/es6/components/DataChart/stories/Legend.js +6 -2
- package/es6/components/DataChart/stories/Pad.js +42 -0
- package/es6/components/DataChart/utils.js +7 -0
- package/es6/components/DataTable/Body.js +10 -5
- package/es6/components/DataTable/Cell.js +1 -1
- package/es6/components/DataTable/DataTable.js +14 -10
- package/es6/components/DataTable/ExpanderCell.js +1 -1
- package/es6/components/DataTable/Footer.js +1 -1
- package/es6/components/DataTable/GroupedBody.js +1 -1
- package/es6/components/DataTable/Header.js +1 -1
- package/es6/components/DataTable/Resizer.js +1 -1
- package/es6/components/DataTable/Sorter.js +1 -1
- package/es6/components/DataTable/buildState.js +2 -2
- package/es6/components/DataTable/index.d.ts +4 -1
- package/es6/components/DataTable/propTypes.js +1 -1
- package/es6/components/DataTable/stories/Controlled.js +1 -1
- package/es6/components/DataTable/stories/ControlledGrouped.js +1 -1
- package/es6/components/DataTable/stories/CustomThemed/Fill.js +1 -1
- package/es6/components/DataTable/stories/GroupedOnSelect.js +1 -1
- package/es6/components/DataTable/stories/OnUpdate.js +1 -1
- package/es6/components/DataTable/stories/Served.js +1 -1
- package/es6/components/DataTable/stories/Sort.js +1 -1
- package/es6/components/DataTable/stories/SpaceX.js +3 -1
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +6 -2
- package/es6/components/DataTable/stories/Tunable.js +1 -1
- package/es6/components/DataTable/stories/data.js +1 -1
- package/es6/components/DataTable/stories/rowDetails.js +1 -1
- package/es6/components/DateInput/DateInput.js +85 -88
- package/es6/components/DateInput/index.d.ts +1 -0
- package/es6/components/DateInput/propTypes.js +1 -0
- package/es6/components/DateInput/stories/Format.js +14 -1
- package/es6/components/DateInput/utils.js +30 -8
- package/es6/components/Diagram/Diagram.js +1 -1
- package/es6/components/Diagram/stories/Animated.js +1 -1
- package/es6/components/Diagram/stories/Progressing.js +1 -1
- package/es6/components/Distribution/Distribution.js +1 -1
- package/es6/components/Distribution/propTypes.js +1 -1
- package/es6/components/Drop/Drop.js +1 -1
- package/es6/components/Drop/DropContainer.js +1 -1
- package/es6/components/DropButton/DropButton.js +1 -1
- package/es6/components/DropButton/propTypes.js +1 -1
- package/es6/components/FileInput/FileInput.js +28 -9
- package/es6/components/FileInput/StyledFileInput.js +1 -1
- package/es6/components/FileInput/stories/Multiple.js +1 -0
- package/es6/components/FocusedContainer.js +1 -1
- package/es6/components/Footer/Footer.js +1 -1
- package/es6/components/Footer/stories/DoubleFooter.js +1 -1
- package/es6/components/Footer/stories/Sitemap.js +1 -1
- package/es6/components/Form/Form.js +77 -6
- package/es6/components/Form/stories/ArrayOfFormFields.js +1 -1
- package/es6/components/Form/stories/CustomThemed/FieldSpacingOptions.js +1 -1
- package/es6/components/FormField/FormField.js +30 -31
- package/es6/components/Grid/Grid.js +5 -3
- package/es6/components/Grid/README.md +0 -2
- package/es6/components/Grid/index.d.ts +4 -2
- package/es6/components/Grid/propTypes.js +1 -1
- package/es6/components/Grid/stories/CustomThemed/Responsive.js +1 -1
- package/es6/components/Grid/stories/typescript/App.tsx +42 -48
- package/es6/components/Grommet/Grommet.js +7 -3
- package/es6/components/Grommet/index.d.ts +1 -0
- package/es6/components/Grommet/propTypes.js +2 -1
- package/es6/components/Header/Header.js +1 -1
- package/es6/components/Heading/Heading.js +5 -3
- package/es6/components/Heading/StyledHeading.js +1 -1
- package/es6/components/Heading/index.d.ts +1 -0
- package/es6/components/Heading/propTypes.js +3 -2
- package/es6/components/Image/Image.js +5 -3
- package/es6/components/Image/propTypes.js +1 -1
- package/es6/components/InfiniteScroll/stories/Basics.js +1 -1
- package/es6/components/InfiniteScroll/stories/ClassChildren.js +1 -1
- package/es6/components/InfiniteScroll/stories/Marker.js +1 -1
- package/es6/components/InfiniteScroll/stories/Show.js +1 -1
- package/es6/components/InfiniteScroll/stories/ShowAfter.js +1 -1
- package/es6/components/InfiniteScroll/stories/ShowBefore.js +1 -1
- package/es6/components/Layer/Layer.js +1 -1
- package/es6/components/Layer/LayerContainer.js +18 -1
- package/es6/components/List/List.js +1 -1
- package/es6/components/List/propTypes.js +1 -1
- package/es6/components/Main/Main.js +1 -1
- package/es6/components/Markdown/Markdown.js +1 -1
- package/es6/components/MaskedInput/MaskedInput.js +38 -29
- package/es6/components/Menu/Menu.js +110 -62
- package/es6/components/Menu/index.d.ts +2 -2
- package/es6/components/Menu/propTypes.js +2 -2
- package/es6/components/Menu/stories/CustomThemed/Themed.tsx +6 -0
- package/es6/components/Menu/stories/Grouped.js +40 -0
- package/es6/components/Meter/Bar.js +1 -1
- package/es6/components/Meter/Circle.js +9 -3
- package/es6/components/Meter/Meter.js +1 -1
- package/es6/components/Meter/propTypes.js +1 -1
- package/es6/components/NameValueList/NameValueList.js +1 -1
- package/es6/components/NameValuePair/NameValuePair.js +1 -1
- package/es6/components/Nav/Nav.js +1 -1
- package/es6/components/Nav/stories/CustomThemed/JustifySidebar.js +1 -1
- package/es6/components/Nav/stories/Sidebar.js +1 -1
- package/es6/components/Notification/Notification.js +1 -1
- package/es6/components/Notification/index.d.ts +1 -1
- package/es6/components/Notification/propTypes.js +1 -1
- package/es6/components/Page/Page.js +1 -1
- package/es6/components/PageContent/PageContent.js +1 -1
- package/es6/components/PageHeader/PageHeader.js +24 -14
- package/es6/components/PageHeader/index.d.ts +10 -1
- package/es6/components/PageHeader/propTypes.js +2 -1
- package/es6/components/PageHeader/stories/Size.js +43 -0
- package/es6/components/Pagination/PageControl.js +1 -1
- package/es6/components/Pagination/Pagination.js +1 -1
- package/es6/components/Pagination/propTypes.js +1 -1
- package/es6/components/Paragraph/Paragraph.js +1 -1
- package/es6/components/Paragraph/StyledParagraph.js +8 -1
- package/es6/components/Paragraph/index.d.ts +1 -0
- package/es6/components/Paragraph/propTypes.js +2 -1
- package/es6/components/Paragraph/stories/MaxLines.js +24 -0
- package/es6/components/RadioButton/RadioButton.js +1 -1
- package/es6/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es6/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.js +1 -1
- package/es6/components/RadioButtonGroup/stories/Disabled.js +1 -1
- package/es6/components/RangeInput/RangeInput.js +1 -1
- package/es6/components/RangeSelector/EdgeControl.js +1 -1
- package/es6/components/RangeSelector/RangeSelector.js +1 -1
- package/es6/components/RangeSelector/stories/CustomThemed/Custom.js +1 -1
- package/es6/components/RangeSelector/stories/CustomThemed/CustomEdgeControl.js +1 -1
- package/es6/components/RangeSelector/stories/Step.js +1 -1
- package/es6/components/RangeSelector/stories/Vertical.js +1 -1
- package/es6/components/RoutedAnchor/RoutedAnchor.js +2 -2
- package/es6/components/RoutedButton/RoutedButton.js +2 -2
- package/es6/components/Select/Select.js +12 -31
- package/es6/components/Select/SelectContainer.js +97 -78
- package/es6/components/Select/propTypes.js +1 -1
- package/es6/components/Select/stories/Clear.js +7 -1
- package/es6/components/Select/stories/components/SearchBorderBox.js +1 -1
- package/es6/components/Select/stories/components/SearchInput.js +1 -1
- package/es6/components/Select/utils.js +1 -0
- package/es6/components/Sidebar/Sidebar.js +1 -1
- package/es6/components/Sidebar/stories/Labels.js +1 -1
- package/es6/components/SkipLink/SkipLink.js +1 -1
- package/es6/components/SkipLinkTarget/SkipLinkTarget.js +1 -1
- package/es6/components/Spinner/Spinner.js +2 -1
- package/es6/components/Stack/Stack.js +1 -1
- package/es6/components/Stack/propTypes.js +1 -1
- package/es6/components/Tab/StyledTab.js +2 -2
- package/es6/components/Tab/Tab.js +35 -18
- package/es6/components/Table/propTypes.js +1 -1
- package/es6/components/TableBody/TableBody.js +1 -1
- package/es6/components/TableCell/TableCell.js +1 -1
- package/es6/components/TableFooter/TableFooter.js +1 -1
- package/es6/components/TableHeader/TableHeader.js +1 -1
- package/es6/components/TableRow/TableRow.js +1 -1
- package/es6/components/Tabs/Tabs.js +236 -12
- package/es6/components/Tabs/propTypes.js +1 -1
- package/es6/components/Tabs/stories/Responsive.js +18 -0
- package/es6/components/Tag/Tag.js +1 -1
- package/es6/components/Tag/propTypes.js +1 -1
- package/es6/components/Text/Text.js +1 -1
- package/es6/components/Text/propTypes.js +1 -1
- package/es6/components/TextArea/TextArea.js +1 -1
- package/es6/components/TextArea/stories/NonResizable.js +1 -1
- package/es6/components/TextArea/stories/Simple.js +1 -1
- package/es6/components/TextInput/TextInput.js +1 -1
- package/es6/components/TextInput/stories/InsideFormField.js +1 -1
- package/es6/components/TextInput/stories/WithTags.js +1 -1
- package/es6/components/Tip/Tip.js +4 -23
- package/es6/components/Video/StyledVideo.js +2 -2
- package/es6/components/Video/Video.js +1 -1
- package/es6/components/Video/propTypes.js +1 -1
- package/es6/components/WorldMap/WorldMap.js +1 -1
- package/es6/components/WorldMap/propTypes.js +1 -1
- package/es6/components/WorldMap/stories/Places.js +1 -1
- package/es6/contexts/AnalyticsContext/AnalyticsContext.js +47 -0
- package/es6/contexts/AnalyticsContext/index.d.ts +7 -0
- package/es6/contexts/AnalyticsContext/index.js +1 -0
- package/es6/contexts/AnnounceContext/stories/Assertive.js +1 -1
- package/es6/contexts/ResponsiveContext/stories/ResponsiveGrid.js +1 -1
- package/es6/contexts/index.js +1 -0
- package/es6/index.d.ts +1 -0
- package/es6/themes/base.d.ts +65 -33
- package/es6/themes/base.js +70 -2
- package/es6/utils/index.js +2 -1
- package/es6/utils/mixins.js +3 -0
- package/es6/utils/object.js +1 -1
- package/es6/utils/pagination.js +1 -1
- package/es6/utils/use-keyboard.js +25 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +63 -55
- package/themes/base.d.ts +65 -33
- package/themes/base.js +70 -2
- package/tools/pack.js +20 -13
- package/tools/release-stable.js +2 -4
- package/utils/index.js +8 -0
- package/utils/mixins.js +7 -1
- package/utils/object.js +1 -1
- package/utils/pagination.js +1 -1
- package/utils/use-keyboard.js +34 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["children", "value", "disabled", "focusIndicator", "gap", "labelKey", "valueKey", "onChange", "options", "name"],
|
|
2
2
|
_excluded2 = ["value"];
|
|
3
3
|
|
|
4
|
-
function _extends() { _extends = Object.assign
|
|
4
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
5
|
|
|
6
6
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["elements", "precision"];
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["hourLimit", "onChange", "precision", "run", "size", "time", "type"];
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["elements", "precision", "run", "size"];
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { genericProps } from '../../utils/general-prop-types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["label", "open", "submenu"];
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Box, Button, Collapsible, Text } from 'grommet';
|
|
@@ -2,13 +2,12 @@ var _excluded = ["a11yTitle", "axis", "bounds", "chart", "data", "detail", "gap"
|
|
|
2
2
|
_excluded2 = ["property", "type", "x", "y"],
|
|
3
3
|
_excluded3 = ["property"];
|
|
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, { forwardRef, useContext, useMemo,
|
|
9
|
+
import React, { forwardRef, useContext, useMemo, useState } from 'react';
|
|
10
10
|
import { ThemeContext } from 'styled-components';
|
|
11
|
-
import { useLayoutEffect } from '../../utils/use-isomorphic-layout-effect';
|
|
12
11
|
import { Box } from '../Box';
|
|
13
12
|
import { Chart, calcs, calcBounds } from '../Chart';
|
|
14
13
|
import { Grid } from '../Grid';
|
|
@@ -21,7 +20,7 @@ import { XAxis } from './XAxis';
|
|
|
21
20
|
import { YAxis } from './YAxis';
|
|
22
21
|
import { XGuide } from './XGuide';
|
|
23
22
|
import { YGuide } from './YGuide';
|
|
24
|
-
import { createDateFormat, halfPad, heightYGranularity, points } from './utils';
|
|
23
|
+
import { createDateFormat, halfPad, heightYGranularity, largestSize, points } from './utils';
|
|
25
24
|
import { DataChartPropTypes } from './propTypes';
|
|
26
25
|
var stackedChartType = {
|
|
27
26
|
areas: 'area',
|
|
@@ -60,12 +59,9 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
60
59
|
|
|
61
60
|
var _useState = useState(),
|
|
62
61
|
activeProperty = _useState[0],
|
|
63
|
-
setActiveProperty = _useState[1]; //
|
|
62
|
+
setActiveProperty = _useState[1]; // normalize seriesProp to an array of objects, one per property
|
|
64
63
|
|
|
65
64
|
|
|
66
|
-
var xRef = useRef();
|
|
67
|
-
var spacerRef = useRef(); // normalize seriesProp to an array of objects, one per property
|
|
68
|
-
|
|
69
65
|
var series = useMemo(function () {
|
|
70
66
|
if (Array.isArray(seriesProp)) return seriesProp.filter(function (s) {
|
|
71
67
|
return s.property || typeof s === 'string';
|
|
@@ -366,8 +362,10 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
366
362
|
|
|
367
363
|
charts.forEach(function (_ref6, index) {
|
|
368
364
|
var color = _ref6.color,
|
|
365
|
+
dash = _ref6.dash,
|
|
369
366
|
point = _ref6.point,
|
|
370
367
|
property = _ref6.property,
|
|
368
|
+
round = _ref6.round,
|
|
371
369
|
thickness = _ref6.thickness,
|
|
372
370
|
type = _ref6.type;
|
|
373
371
|
var calcThickness = chartProps[index].thickness;
|
|
@@ -389,6 +387,9 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
389
387
|
if (pColor && !result[p].color) result[p].color = pColor;
|
|
390
388
|
if (point && !result[p].point) result[p].point = point;else if (type === 'point') result[p].point = false;
|
|
391
389
|
if ((thickness || calcThickness) && !result[p].thickness) result[p].thickness = thickness || calcThickness;
|
|
390
|
+
if (round !== undefined && result[p].round === undefined) result[p].round = round;
|
|
391
|
+
if (dash !== undefined && result[p].dash === undefined) result[p].dash = dash;
|
|
392
|
+
if (result[p].type === undefined) result[p].type = type;
|
|
392
393
|
});
|
|
393
394
|
}
|
|
394
395
|
}); // set color for any non-aspect properties we don't have one for yet
|
|
@@ -454,8 +455,8 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
454
455
|
charts.forEach(function (_ref7, index) {
|
|
455
456
|
var type = _ref7.type;
|
|
456
457
|
var thickness = chartProps[index].thickness;
|
|
457
|
-
result.horizontal = halfPad[thickness];
|
|
458
|
-
if (type && type !== 'bar') result.vertical = halfPad[thickness];
|
|
458
|
+
result.horizontal = largestSize(result.horizontal, halfPad[thickness]);
|
|
459
|
+
if (type && type !== 'bar') result.vertical = largestSize(result.vertical, halfPad[thickness]);
|
|
459
460
|
});
|
|
460
461
|
return result;
|
|
461
462
|
}, [chartProps, charts, padProp]); // calculate the thickness in pixels of each chart
|
|
@@ -488,22 +489,18 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
488
489
|
|
|
489
490
|
var offsetPad = useMemo(function () {
|
|
490
491
|
return offsets ? offsets[offsets.length - 1] + thicknesses[thicknesses.length - 1] + "px" : undefined;
|
|
491
|
-
}, [offsets, thicknesses]); // The thickness of the
|
|
492
|
+
}, [offsets, thicknesses]); // The thickness of the segments. We need to convert to numbers
|
|
492
493
|
// to be able to compare across charts where some might be using T-shirt
|
|
493
494
|
// labels and others might be pixel values.
|
|
494
495
|
|
|
495
|
-
var
|
|
496
|
+
var segmentThickness = useMemo(function () {
|
|
496
497
|
var result = 0;
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
result = Math.max(result, parseMetricToNum(theme.global.edgeSize[thickness] || thickness));
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
|
|
498
|
+
charts.forEach(function (_, index) {
|
|
499
|
+
var thickness = chartProps[index].thickness;
|
|
500
|
+
result = Math.max(result, parseMetricToNum(theme.global.edgeSize[thickness] || thickness));
|
|
501
|
+
});
|
|
505
502
|
return result + "px";
|
|
506
|
-
}, [charts, chartProps,
|
|
503
|
+
}, [charts, chartProps, theme]);
|
|
507
504
|
var dateFormats = useMemo(function () {
|
|
508
505
|
var result = {};
|
|
509
506
|
var full = axis && axis.x && axis.x.granularity === 'coarse';
|
|
@@ -516,14 +513,7 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
516
513
|
}
|
|
517
514
|
});
|
|
518
515
|
return result;
|
|
519
|
-
}, [axis, data, series]);
|
|
520
|
-
|
|
521
|
-
useLayoutEffect(function () {
|
|
522
|
-
if (xRef.current && spacerRef.current) {
|
|
523
|
-
var rect = xRef.current.getBoundingClientRect();
|
|
524
|
-
spacerRef.current.style.height = rect.height + "px";
|
|
525
|
-
}
|
|
526
|
-
}, []);
|
|
516
|
+
}, [axis, data, series]);
|
|
527
517
|
|
|
528
518
|
var renderValue = function renderValue(serie, dataIndex, valueArg) {
|
|
529
519
|
var value;
|
|
@@ -549,17 +539,18 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
549
539
|
|
|
550
540
|
|
|
551
541
|
var xAxisElement = axis && axis.x && chartProps.length ? /*#__PURE__*/React.createElement(XAxis, {
|
|
552
|
-
ref: xRef,
|
|
553
542
|
axis: axis,
|
|
554
543
|
values: (Array.isArray(chartProps[0]) ? chartProps[0][0] : chartProps[0]).axis[0],
|
|
555
544
|
pad: offsetPad ? _extends({}, pad, {
|
|
556
545
|
end: offsetPad
|
|
557
546
|
}) : pad,
|
|
558
547
|
renderValue: renderValue,
|
|
548
|
+
thickness: segmentThickness,
|
|
559
549
|
serie: axis.x.property && getPropertySeries(axis.x.property),
|
|
560
550
|
style: offsetPad ? {
|
|
561
551
|
transform: "translate(" + offsets[Math.floor(offsets.length / 2)] + "px, 0px)"
|
|
562
|
-
} : {}
|
|
552
|
+
} : {},
|
|
553
|
+
theme: theme
|
|
563
554
|
}) : null;
|
|
564
555
|
var yAxisElement = axis && axis.y && (chartProps.length || boundsProp != null && boundsProp.y) ? /*#__PURE__*/React.createElement(YAxis, {
|
|
565
556
|
axis: axis,
|
|
@@ -663,38 +654,14 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
663
654
|
series: series,
|
|
664
655
|
seriesStyles: seriesStyles,
|
|
665
656
|
renderValue: renderValue,
|
|
666
|
-
thickness:
|
|
657
|
+
thickness: segmentThickness
|
|
667
658
|
}));
|
|
668
659
|
var legendElement = legend ? /*#__PURE__*/React.createElement(Legend, {
|
|
669
660
|
series: series,
|
|
670
661
|
seriesStyles: seriesStyles,
|
|
671
662
|
activeProperty: activeProperty,
|
|
672
663
|
setActiveProperty: setActiveProperty
|
|
673
|
-
}) : null;
|
|
674
|
-
|
|
675
|
-
if (!Grid.available) {
|
|
676
|
-
var _content = stackElement;
|
|
677
|
-
|
|
678
|
-
if (xAxisElement) {
|
|
679
|
-
_content = /*#__PURE__*/React.createElement(Box, null, _content, xAxisElement);
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
if (yAxisElement) {
|
|
683
|
-
_content = /*#__PURE__*/React.createElement(Box, {
|
|
684
|
-
direction: "row"
|
|
685
|
-
}, /*#__PURE__*/React.createElement(Box, null, yAxisElement, /*#__PURE__*/React.createElement(Box, {
|
|
686
|
-
ref: spacerRef,
|
|
687
|
-
flex: false
|
|
688
|
-
})), _content);
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
if (legendElement) {
|
|
692
|
-
_content = /*#__PURE__*/React.createElement(Box, null, _content, legendElement);
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
return _content;
|
|
696
|
-
}
|
|
697
|
-
|
|
664
|
+
}) : null;
|
|
698
665
|
var content = /*#__PURE__*/React.createElement(Grid, _extends({
|
|
699
666
|
ref: ref,
|
|
700
667
|
"aria-label": a11yTitle,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import React, { Fragment, useCallback, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
1
|
+
import React, { Fragment, useCallback, useContext, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import styled, { ThemeContext } from 'styled-components';
|
|
3
3
|
import { Box } from '../Box';
|
|
4
4
|
import { Drop } from '../Drop';
|
|
5
5
|
import { Grid } from '../Grid';
|
|
6
6
|
import { Keyboard } from '../Keyboard';
|
|
7
7
|
import { Text } from '../Text';
|
|
8
|
-
import { focusStyle, unfocusStyle } from '../../utils';
|
|
9
|
-
import { halfPad } from './utils';
|
|
8
|
+
import { focusStyle, parseMetricToNum, unfocusStyle } from '../../utils';
|
|
10
9
|
import { Swatch } from './Swatch';
|
|
11
10
|
var DetailControl = styled(Box).withConfig({
|
|
12
11
|
displayName: "Detail__DetailControl",
|
|
@@ -17,11 +16,12 @@ var Detail = function Detail(_ref) {
|
|
|
17
16
|
var activeProperty = _ref.activeProperty,
|
|
18
17
|
axis = _ref.axis,
|
|
19
18
|
data = _ref.data,
|
|
20
|
-
|
|
19
|
+
padProp = _ref.pad,
|
|
21
20
|
series = _ref.series,
|
|
22
21
|
seriesStyles = _ref.seriesStyles,
|
|
23
22
|
renderValue = _ref.renderValue,
|
|
24
23
|
thickness = _ref.thickness;
|
|
24
|
+
var theme = useContext(ThemeContext) || defaultProps.theme;
|
|
25
25
|
|
|
26
26
|
var _useState = useState(),
|
|
27
27
|
detailIndex = _useState[0],
|
|
@@ -31,6 +31,20 @@ var Detail = function Detail(_ref) {
|
|
|
31
31
|
var detailRefs = useMemo(function () {
|
|
32
32
|
return [];
|
|
33
33
|
}, []);
|
|
34
|
+
var pad = useMemo(function () {
|
|
35
|
+
// ensure the hit targets and center lines align with
|
|
36
|
+
// the data/guide lines
|
|
37
|
+
var horizontal = (padProp == null ? void 0 : padProp.horizontal) || typeof padProp === 'string' && padProp || 0;
|
|
38
|
+
horizontal = theme.global.edgeSize[horizontal] || horizontal;
|
|
39
|
+
horizontal = parseMetricToNum(horizontal);
|
|
40
|
+
var vertical = (padProp == null ? void 0 : padProp.vertical) || typeof padProp === 'string' && padProp || 0;
|
|
41
|
+
vertical = theme.global.edgeSize[vertical] || vertical;
|
|
42
|
+
vertical = parseMetricToNum(vertical);
|
|
43
|
+
return {
|
|
44
|
+
horizontal: horizontal - parseMetricToNum(thickness) / 2 + "px",
|
|
45
|
+
vertical: vertical + "px"
|
|
46
|
+
};
|
|
47
|
+
}, [padProp, theme.global.edgeSize, thickness]);
|
|
34
48
|
var onMouseLeave = useCallback(function (event) {
|
|
35
49
|
// Only remove detail if the mouse isn't over the active index.
|
|
36
50
|
// This helps distinguish leaving the drop on the edge where it is
|
|
@@ -54,11 +68,7 @@ var Detail = function Detail(_ref) {
|
|
|
54
68
|
tabIndex: 0,
|
|
55
69
|
direction: "row",
|
|
56
70
|
fill: true,
|
|
57
|
-
pad:
|
|
58
|
-
// the data/guide lines
|
|
59
|
-
(pad == null ? void 0 : pad.horizontal) && halfPad[pad.horizontal] && {
|
|
60
|
-
horizontal: halfPad[pad.horizontal]
|
|
61
|
-
} || pad,
|
|
71
|
+
pad: pad,
|
|
62
72
|
justify: "between",
|
|
63
73
|
responsive: false,
|
|
64
74
|
onFocus: function onFocus() {},
|
|
@@ -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, { useMemo } from 'react';
|
|
4
4
|
import { Box } from '../Box';
|
|
@@ -1,3 +1,5 @@
|
|
|
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
|
+
|
|
1
3
|
import React, { useContext } from 'react';
|
|
2
4
|
import { ThemeContext } from 'styled-components';
|
|
3
5
|
import { normalizeColor, parseMetricToNum } from '../../utils';
|
|
@@ -5,12 +7,19 @@ import { normalizeColor, parseMetricToNum } from '../../utils';
|
|
|
5
7
|
var Swatch = function Swatch(_ref) {
|
|
6
8
|
var aspect = _ref.aspect,
|
|
7
9
|
color = _ref.color,
|
|
10
|
+
dash = _ref.dash,
|
|
8
11
|
point = _ref.point,
|
|
9
|
-
|
|
12
|
+
round = _ref.round,
|
|
13
|
+
thickness = _ref.thickness,
|
|
14
|
+
type = _ref.type;
|
|
10
15
|
var theme = useContext(ThemeContext);
|
|
11
16
|
var dim = parseInt(theme.global.spacing, 10) / 2;
|
|
12
17
|
var half = dim / 2;
|
|
18
|
+
var height = dim;
|
|
13
19
|
var width = dim;
|
|
20
|
+
var normalizedColor = color ? normalizeColor(color.color || color, theme) : undefined;
|
|
21
|
+
var fill = normalizedColor;
|
|
22
|
+
var stroke = 'none';
|
|
14
23
|
var content;
|
|
15
24
|
if (aspect === 'x') content = /*#__PURE__*/React.createElement("path", {
|
|
16
25
|
d: "M 0 " + half + " L " + dim + " " + half,
|
|
@@ -43,34 +52,66 @@ var Swatch = function Swatch(_ref) {
|
|
|
43
52
|
height: dim,
|
|
44
53
|
fill: "#000",
|
|
45
54
|
opacity: 0.8
|
|
46
|
-
}));else if (point
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
}));else if (point) {
|
|
56
|
+
if (point === 'circle') content = /*#__PURE__*/React.createElement("circle", {
|
|
57
|
+
cx: half,
|
|
58
|
+
cy: half,
|
|
59
|
+
r: half
|
|
60
|
+
});else {
|
|
61
|
+
var d;
|
|
62
|
+
if (point === 'diamond') d = "M " + half + " 0 L " + dim + " " + half + " L " + half + " " + dim + " L 0 " + half + " Z";else if (point === 'star') {
|
|
63
|
+
var off1 = half / 3;
|
|
64
|
+
var off2 = off1 * 2;
|
|
65
|
+
d = "M " + half + " 0 L " + (half - off2) + " " + dim + " L " + dim + " " + (half - off1) + " L 0 " + (half - off1) + " L " + (half + off2) + " " + dim + " Z";
|
|
66
|
+
} else if (point === 'triangle') d = "M " + half + " 0 L " + dim + " " + dim + " L 0 " + dim + " Z";else if (point === 'triangleDown') d = "M 0 0 L " + dim + " 0 L " + half + " " + dim + " Z";else if (point === 'square') d = "M 0 0 L " + dim + " 0 L " + dim + " " + dim + " L 0 " + dim + " Z";
|
|
67
|
+
if (d) content = /*#__PURE__*/React.createElement("path", {
|
|
68
|
+
d: d
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
} else if (type === 'area') {
|
|
72
|
+
if (round) content = /*#__PURE__*/React.createElement("circle", {
|
|
73
|
+
cx: half,
|
|
74
|
+
cy: half,
|
|
75
|
+
r: half
|
|
76
|
+
});else content = /*#__PURE__*/React.createElement("rect", {
|
|
77
|
+
x: 0,
|
|
78
|
+
y: 0,
|
|
79
|
+
width: width,
|
|
80
|
+
height: height
|
|
64
81
|
});
|
|
82
|
+
} else {
|
|
83
|
+
// draw a line oriented based on the type and then match style
|
|
84
|
+
var strokeWidth = parseMetricToNum(theme.global.edgeSize[thickness]) || dim;
|
|
85
|
+
|
|
86
|
+
var _d;
|
|
87
|
+
|
|
88
|
+
if (type === 'line' || type === 'area') {
|
|
89
|
+
width = Math.max(width, strokeWidth * 4);
|
|
90
|
+
height = strokeWidth;
|
|
91
|
+
_d = "M 0 " + height / 2 + " L " + width + " " + height / 2;
|
|
92
|
+
} else {
|
|
93
|
+
width = strokeWidth;
|
|
94
|
+
_d = "M " + width / 2 + " 0 L " + width / 2 + " " + dim;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
fill = 'none';
|
|
98
|
+
stroke = normalizedColor;
|
|
99
|
+
var strokeProps = {};
|
|
100
|
+
if (round) strokeProps.strokeLinecap = 'round';
|
|
101
|
+
if (dash) strokeProps.strokeDasharray = round ? strokeWidth + " " + strokeWidth * 1.5 : strokeWidth * 2 + " " + strokeWidth / 2;
|
|
102
|
+
content = /*#__PURE__*/React.createElement("path", _extends({
|
|
103
|
+
d: _d,
|
|
104
|
+
strokeWidth: strokeWidth
|
|
105
|
+
}, strokeProps));
|
|
65
106
|
}
|
|
66
107
|
var opacity = color && color.opacity ? theme.global.opacity[color.opacity] : undefined;
|
|
67
108
|
return /*#__PURE__*/React.createElement("svg", {
|
|
68
109
|
width: width,
|
|
69
|
-
height:
|
|
70
|
-
viewBox: "0 0 " + width + " " +
|
|
71
|
-
fill:
|
|
110
|
+
height: height,
|
|
111
|
+
viewBox: "0 0 " + width + " " + height,
|
|
112
|
+
fill: fill,
|
|
72
113
|
opacity: opacity,
|
|
73
|
-
stroke:
|
|
114
|
+
stroke: stroke
|
|
74
115
|
}, content);
|
|
75
116
|
};
|
|
76
117
|
|
|
@@ -1,47 +1,57 @@
|
|
|
1
|
-
var _excluded = ["values", "pad", "renderValue", "serie"];
|
|
1
|
+
var _excluded = ["values", "pad", "renderValue", "serie", "theme", "thickness"];
|
|
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
|
|
|
7
|
-
import React, { forwardRef } from 'react';
|
|
7
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
8
|
+
import { edgeToNum } from '../../utils';
|
|
8
9
|
import { Box } from '../Box';
|
|
9
10
|
var XAxis = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
11
|
var values = _ref.values,
|
|
11
|
-
|
|
12
|
+
padProp = _ref.pad,
|
|
12
13
|
renderValue = _ref.renderValue,
|
|
13
14
|
serie = _ref.serie,
|
|
15
|
+
theme = _ref.theme,
|
|
16
|
+
thickness = _ref.thickness,
|
|
14
17
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
15
18
|
|
|
16
|
-
//
|
|
17
|
-
//
|
|
19
|
+
// pad to the edge of the thickness, for when padding is more than half
|
|
20
|
+
// the thickness
|
|
21
|
+
var pad = useMemo(function () {
|
|
22
|
+
return {
|
|
23
|
+
start: edgeToNum(padProp.start || padProp.horizontal, theme) - edgeToNum(thickness, theme) / 2 + "px",
|
|
24
|
+
end: edgeToNum(padProp.end || padProp.horizontal, theme) - edgeToNum(thickness, theme) / 2 + "px"
|
|
25
|
+
};
|
|
26
|
+
}, [padProp, theme, thickness]); // When there are only labels at the end of the axis and there isn't
|
|
27
|
+
// much space for them, let them take as much space as they like
|
|
28
|
+
// flowing in from the edges.
|
|
29
|
+
// Otherwise, align their container to the
|
|
18
30
|
// data/guide lines and then let their content overflow that.
|
|
19
|
-
var itemProps = values.length === 2 ? {} : {
|
|
20
|
-
width: '1px',
|
|
21
|
-
overflow: 'visible',
|
|
22
|
-
align: 'center'
|
|
23
|
-
};
|
|
24
|
-
var horizontal = pad.horizontal,
|
|
25
|
-
start = pad.start,
|
|
26
|
-
end = pad.end; // ignore vertical parts
|
|
27
31
|
|
|
32
|
+
var labelContainerProps = useMemo(function () {
|
|
33
|
+
// 24px was chosen empirically as 48px is enough to show some simple text
|
|
34
|
+
var centered = values.length !== 2 || edgeToNum(padProp.start || padProp.horizontal, theme) >= 24;
|
|
35
|
+
if (centered) return {
|
|
36
|
+
width: thickness,
|
|
37
|
+
overflow: 'visible',
|
|
38
|
+
align: 'center'
|
|
39
|
+
};
|
|
40
|
+
return {};
|
|
41
|
+
}, [padProp, theme, thickness, values]);
|
|
28
42
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
29
43
|
ref: ref,
|
|
30
44
|
gridArea: "xAxis",
|
|
31
45
|
direction: "row",
|
|
32
46
|
justify: "between",
|
|
33
|
-
pad:
|
|
34
|
-
horizontal: horizontal,
|
|
35
|
-
start: start,
|
|
36
|
-
end: end
|
|
37
|
-
}
|
|
47
|
+
pad: pad
|
|
38
48
|
}, rest), values.map(function (dataIndex, i) {
|
|
39
49
|
return (
|
|
40
50
|
/*#__PURE__*/
|
|
41
51
|
// eslint-disable-next-line react/no-array-index-key
|
|
42
52
|
React.createElement(Box, _extends({
|
|
43
53
|
key: i
|
|
44
|
-
},
|
|
54
|
+
}, labelContainerProps), serie ? renderValue(serie, dataIndex) : dataIndex)
|
|
45
55
|
);
|
|
46
56
|
}));
|
|
47
57
|
});
|
|
@@ -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, { forwardRef } from 'react';
|
|
4
4
|
import { Box } from '../Box';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { genericProps, padPropType, pointPropType } from '../../utils/general-prop-types';
|
|
@@ -7,7 +7,7 @@ for (var i = 1; i < 8; i += 1) {
|
|
|
7
7
|
data.push({
|
|
8
8
|
date: "2020-07-" + (i % 30 + 1).toString().padStart(2, 0),
|
|
9
9
|
percent: Math.abs(v * 100),
|
|
10
|
-
amount:
|
|
10
|
+
amount: Math.round(Math.abs(v * 50))
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -36,10 +36,14 @@ export var Legend = function Legend() {
|
|
|
36
36
|
label: 'Amount'
|
|
37
37
|
}],
|
|
38
38
|
chart: ['percent', {
|
|
39
|
+
type: 'line',
|
|
39
40
|
property: 'amount',
|
|
40
|
-
thickness: '
|
|
41
|
+
thickness: 'xsmall',
|
|
42
|
+
dash: true,
|
|
43
|
+
round: true
|
|
41
44
|
}],
|
|
42
45
|
legend: true,
|
|
46
|
+
detail: true,
|
|
43
47
|
axis: {
|
|
44
48
|
x: {
|
|
45
49
|
property: 'date',
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, DataChart } from 'grommet';
|
|
3
|
+
var data = [];
|
|
4
|
+
|
|
5
|
+
for (var i = 1; i < 3; i += 1) {
|
|
6
|
+
var v = Math.sin(i / 2.0);
|
|
7
|
+
data.push({
|
|
8
|
+
percent: Math.abs(v * 100)
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export var Pad = function Pad() {
|
|
13
|
+
return (
|
|
14
|
+
/*#__PURE__*/
|
|
15
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
16
|
+
// <Grommet theme={grommet}>
|
|
17
|
+
React.createElement(Box, {
|
|
18
|
+
align: "center",
|
|
19
|
+
justify: "start",
|
|
20
|
+
pad: "large"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(DataChart, {
|
|
22
|
+
bounds: {
|
|
23
|
+
y: [0, 100]
|
|
24
|
+
},
|
|
25
|
+
guide: true,
|
|
26
|
+
detail: true,
|
|
27
|
+
pad: {
|
|
28
|
+
horizontal: 'xlarge'
|
|
29
|
+
},
|
|
30
|
+
data: data,
|
|
31
|
+
series: ['percent', {}],
|
|
32
|
+
chart: [{
|
|
33
|
+
property: 'percent',
|
|
34
|
+
thickness: 'medium'
|
|
35
|
+
}]
|
|
36
|
+
})) // </Grommet>
|
|
37
|
+
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
export default {
|
|
41
|
+
title: 'Visualizations/DataChart/Pad'
|
|
42
|
+
};
|
|
@@ -39,6 +39,13 @@ export var doublePad = {
|
|
|
39
39
|
xsmall: 'small',
|
|
40
40
|
xxsmall: 'xsmall'
|
|
41
41
|
};
|
|
42
|
+
var orderedSizes = ['xlarge', 'large', 'medium', 'small', 'xsmall', 'xxsmall', 'hair'];
|
|
43
|
+
export var largestSize = function largestSize(size1, size2) {
|
|
44
|
+
if (size1 && !size2) return size1;
|
|
45
|
+
if (size2 && !size1) return size2;
|
|
46
|
+
if (orderedSizes.indexOf(size1) < orderedSizes.indexOf(size2)) return size1;
|
|
47
|
+
return size2;
|
|
48
|
+
};
|
|
42
49
|
export var createDateFormat = function createDateFormat(firstValue, lastValue, full) {
|
|
43
50
|
var dateFormat;
|
|
44
51
|
var startDate = new Date(firstValue);
|