grommet 2.20.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Anchor/index.d.ts +2 -0
- package/components/Anchor/stories/Default.js +17 -8
- package/components/Box/StyledBox.js +1 -3
- package/components/Box/stories/Animation.js +23 -21
- package/components/Box/stories/Background.js +94 -92
- package/components/Box/stories/Border.js +88 -86
- package/components/Box/stories/Custom.js +15 -13
- package/components/Box/stories/Elevation.js +27 -25
- package/components/Box/stories/Fixed.js +43 -41
- package/components/Box/stories/MinMax.js +206 -204
- package/components/Box/stories/OnClick.js +27 -25
- package/components/Box/stories/RTL.js +35 -31
- package/components/Box/stories/Round.js +55 -53
- package/components/Box/stories/Simple.js +46 -44
- package/components/Button/Button.js +2 -3
- package/components/Button/StyledButtonKind.js +5 -3
- package/components/Button/stories/CustomThemed/Active.js +1 -0
- package/components/Button/stories/CustomThemed/Typescript.tsx +1 -1
- package/components/Button/stories/Multiple.js +1 -1
- package/components/Button/stories/typescript/Badge.tsx +58 -0
- package/components/Calendar/Calendar.js +83 -115
- package/components/Calendar/stories/Multiple.js +2 -1
- package/components/Calendar/stories/Simple.js +0 -8
- package/components/Calendar/utils.js +78 -18
- package/components/Carousel/stories/Autoplay.js +6 -3
- package/components/Carousel/stories/ControlVariations.js +9 -9
- package/components/Carousel/stories/Controlled.js +3 -3
- package/components/Carousel/stories/Simple.js +3 -3
- package/components/Chart/Chart.js +14 -6
- package/components/Chart/stories/Labelled.js +2 -2
- package/components/Chart/utils.js +4 -4
- package/components/CheckBox/stories/Simple.js +9 -3
- package/components/CheckBox/stories/WithStickyDiv.js +1 -1
- package/components/CheckBoxGroup/stories/Disabled.js +7 -1
- package/components/DataChart/DataChart.js +110 -25
- package/components/DataChart/Detail.js +8 -0
- package/components/DataChart/XAxis.js +20 -14
- package/components/DataChart/YAxis.js +4 -7
- package/components/DataChart/YGuide.js +12 -1
- package/components/DataChart/index.d.ts +16 -3
- package/components/DataChart/propTypes.js +6 -2
- package/components/DataChart/stories/Offset.js +82 -0
- package/components/DataChart/stories/Placeholder.js +48 -0
- package/components/DataChart/stories/StackedAreas.js +77 -0
- package/components/DataChart/stories/StackedLines.js +73 -0
- package/components/DataTable/DataTable.js +57 -45
- package/components/{TextArea/stories/Fill.js → DataTable/PlaceholderBody.js} +14 -40
- package/components/DataTable/stories/MultiplePin.js +1 -1
- package/components/DateInput/DateInput.js +80 -30
- package/components/DateInput/index.d.ts +1 -0
- package/components/DateInput/propTypes.js +1 -0
- package/components/DateInput/stories/Form.js +2 -1
- package/components/DateInput/stories/Format.js +2 -1
- package/components/DateInput/stories/FormatInline.js +16 -8
- package/components/DateInput/stories/Inline.js +2 -1
- package/components/DateInput/stories/Range.js +2 -1
- package/components/DateInput/stories/RangeFormat.js +2 -1
- package/components/DateInput/stories/Simple.js +2 -1
- package/components/DateInput/stories/typescript/European.tsx +2 -1
- package/components/DateInput/utils.js +11 -4
- package/components/Diagram/stories/Animated.js +43 -41
- package/components/Diagram/stories/Progressing.js +31 -29
- package/components/Diagram/stories/typescript/Connections.tsx +14 -13
- package/components/Distribution/stories/typescript/Simple.tsx +24 -20
- package/components/Drop/Drop.js +12 -6
- package/components/Drop/index.d.ts +1 -0
- package/components/Drop/propTypes.js +1 -0
- package/components/Drop/stories/CustomThemed/Lazy.js +20 -16
- package/components/Drop/stories/CustomThemed/Themed.js +5 -4
- package/components/Drop/stories/Inline.js +69 -0
- package/components/Drop/stories/Meter.js +7 -5
- package/components/Drop/stories/Multiple.js +20 -6
- package/components/Drop/stories/Overflow.js +7 -4
- package/components/Drop/stories/Plain.js +7 -5
- package/components/Drop/stories/Progressive.js +6 -4
- package/components/Drop/stories/Simple.js +6 -4
- package/components/Drop/stories/Styled.js +11 -8
- package/components/Drop/stories/TrapFocus.js +5 -3
- package/components/DropButton/stories/Menu.js +8 -4
- package/components/DropButton/stories/Simple.js +4 -3
- package/components/Footer/stories/DoubleFooter.js +36 -32
- package/components/Footer/stories/Simple.js +24 -20
- package/components/Footer/stories/Sitemap.js +34 -30
- package/components/Footer/stories/Social.js +34 -30
- package/components/Form/Form.js +111 -112
- package/components/Form/stories/AggregateValidation.js +64 -54
- package/components/Form/stories/ArrayOfFormFields.js +58 -54
- package/components/Form/stories/Controlled.js +99 -95
- package/components/Form/stories/ControlledInput.js +129 -125
- package/components/Form/stories/ControlledInputLazy.js +129 -125
- package/components/Form/stories/ControlledLazy.js +97 -93
- package/components/Form/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/components/Form/stories/{FieldBorderPosition.js → CustomThemed/FieldBorderPosition.js} +23 -18
- package/components/Form/stories/{FieldCustomStates.js → CustomThemed/FieldCustomStates.js} +1 -1
- package/components/Form/stories/{FieldSpacingOptions.js → CustomThemed/FieldSpacingOptions.js} +5 -5
- package/components/Form/stories/{RequiredLabel.js → CustomThemed/RequiredLabel.js} +1 -1
- package/components/Form/stories/{Themed.js → CustomThemed/Themed.js} +2 -2
- package/components/Form/stories/DynamicFields.js +62 -58
- package/components/Form/stories/FieldStates.js +62 -60
- package/components/Form/stories/FieldWithChildren.js +109 -105
- package/components/Form/stories/FieldWithComponentProp.js +109 -105
- package/components/Form/stories/HelpAndError.js +39 -18
- package/components/Form/stories/Uncontrolled.js +99 -95
- package/components/Form/stories/ValidateOnBlur.js +65 -61
- package/components/Form/stories/ValidateOnChange.js +82 -78
- package/components/Form/stories/ValidateOnMount.js +67 -63
- package/components/Form/stories/typescript/TypedForm.tsx +69 -66
- package/components/FormField/FormField.js +6 -2
- package/components/FormField/stories/{typescript → CustomThemed}/Custom.tsx +1 -1
- package/components/FormField/stories/Simple.js +22 -20
- package/components/Grid/StyledGrid.js +1 -3
- package/components/Grid/stories/AreasPropAlternative.js +27 -23
- package/components/Grid/stories/Border.js +75 -73
- package/components/Grid/stories/{Responsive.js → CustomThemed/Responsive.js} +1 -1
- package/components/Grid/stories/NColumn.js +28 -24
- package/components/Grid/stories/Percentages.js +30 -26
- package/components/Grid/stories/ResponsiveCards.js +21 -17
- package/components/Grid/stories/typescript/App.tsx +10 -4
- package/components/Image/stories/Fallback.js +10 -8
- package/components/Image/stories/Fill.js +20 -18
- package/components/Image/stories/Fit.js +24 -22
- package/components/Image/stories/Opacity.js +39 -37
- package/components/Image/stories/Simple.js +9 -7
- package/components/InfiniteScroll/stories/Basics.js +18 -16
- package/components/InfiniteScroll/stories/ClassChildren.js +14 -12
- package/components/InfiniteScroll/stories/Grid.js +21 -19
- package/components/InfiniteScroll/stories/GridWithShow.js +22 -20
- package/components/InfiniteScroll/stories/HeightReplace.js +20 -18
- package/components/InfiniteScroll/stories/Marker.js +18 -16
- package/components/InfiniteScroll/stories/Replace.js +19 -17
- package/components/InfiniteScroll/stories/Show.js +18 -16
- package/components/InfiniteScroll/stories/ShowAfter.js +18 -16
- package/components/InfiniteScroll/stories/ShowBefore.js +18 -16
- package/components/InfiniteScroll/stories/Variable.js +19 -17
- package/components/InfiniteScroll/stories/typescript/OnMore.tsx +18 -24
- package/components/InfiniteScroll/stories/typescript/OnMoreStep.tsx +18 -24
- package/components/Keyboard/stories/OnDocument.js +1 -5
- package/components/Layer/stories/Center.js +83 -79
- package/components/Layer/stories/Corner.js +29 -25
- package/components/Layer/stories/{Round.js → CustomThemed/Round.js} +1 -1
- package/components/Layer/stories/Form.js +72 -68
- package/components/Layer/stories/Full.js +37 -33
- package/components/Layer/stories/Notification.js +51 -47
- package/components/Layer/stories/Plain.js +24 -20
- package/components/Layer/stories/RTL.js +32 -28
- package/components/Layer/stories/ScrollBody.js +43 -41
- package/components/Layer/stories/Target.js +74 -70
- package/components/List/List.js +11 -2
- package/components/List/index.d.ts +1 -0
- package/components/List/propTypes.js +1 -0
- package/components/Main/stories/typescript/Simple.tsx +6 -4
- package/components/Markdown/Markdown.js +4 -2
- package/components/Markdown/stories/Override.js +14 -12
- package/components/Markdown/stories/Simple.js +12 -10
- package/components/MaskedInput/MaskedInput.js +1 -1
- package/components/MaskedInput/index.d.ts +1 -0
- package/components/MaskedInput/propTypes.js +1 -0
- package/components/MaskedInput/stories/CustomBox.js +48 -44
- package/components/MaskedInput/stories/Date.js +54 -50
- package/components/MaskedInput/stories/DateRange.js +87 -83
- package/components/MaskedInput/stories/DateTimeDrop.js +30 -28
- package/components/MaskedInput/stories/Filtered.js +32 -28
- package/components/MaskedInput/stories/Form.js +34 -32
- package/components/MaskedInput/stories/IPV4Range.js +69 -65
- package/components/MaskedInput/stories/IPv4Address.js +45 -41
- package/components/MaskedInput/stories/Phone.js +43 -39
- package/components/MaskedInput/stories/SizeUnits.js +35 -31
- package/components/MaskedInput/stories/Time.js +46 -42
- package/components/MaskedInput/stories/URL.js +28 -24
- package/components/MaskedInput/stories/typescript/Email.tsx +24 -20
- package/components/Menu/Menu.js +47 -14
- package/components/Menu/stories/Justify.js +4 -4
- package/components/Menu/stories/typescript/Children.tsx +4 -3
- package/components/NameValueList/stories/Align.js +37 -35
- package/components/NameValueList/stories/CustomName.js +23 -21
- package/components/NameValueList/stories/CustomValue.js +64 -62
- package/components/NameValueList/stories/Layout.js +43 -41
- package/components/NameValueList/stories/PairProps.js +24 -22
- package/components/NameValueList/stories/Simple.js +16 -14
- package/components/NameValueList/stories/Width.js +38 -36
- package/components/Nav/stories/Sidebar.js +5 -3
- package/components/Notification/Notification.js +136 -21
- package/components/Notification/index.d.ts +10 -3
- package/components/Notification/propTypes.js +8 -2
- package/components/Notification/stories/Global.js +87 -0
- package/components/{CheckBox/stories/Disabled.js → Page/Page.js} +34 -33
- package/components/Page/PageContext.js +9 -0
- package/components/Page/README.md +2 -0
- package/components/Page/index.d.ts +12 -0
- package/components/Page/index.js +12 -0
- package/components/Page/propTypes.js +19 -0
- package/components/Page/stories/Background.js +42 -0
- package/components/Page/stories/ContentBackground.js +44 -0
- package/components/Page/stories/CustomThemed/LeftColumn.js +78 -0
- package/components/Page/stories/GlobalHeader.js +47 -0
- package/components/Page/stories/MultipleBackgrounds.js +75 -0
- package/components/Page/stories/MultipleContent.js +49 -0
- package/components/Page/stories/PageNotificaton.js +91 -0
- package/components/Page/stories/Simple.js +39 -0
- package/components/{CheckBox/stories/Toggle.js → PageContent/PageContent.js} +28 -32
- package/components/PageContent/README.md +2 -0
- package/components/PageContent/index.d.ts +19 -0
- package/components/PageContent/index.js +8 -0
- package/components/PageContent/propTypes.js +31 -0
- package/components/Pagination/stories/Grid.js +34 -30
- package/components/Pagination/stories/NumberEdgePages.js +18 -16
- package/components/Pagination/stories/NumberMiddlePages.js +18 -16
- package/components/Pagination/stories/Simple.js +19 -17
- package/components/Pagination/stories/Size.js +20 -18
- package/components/RadioButton/stories/CustomThemed/Theme.js +5 -5
- package/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.js +7 -10
- package/components/RadioButtonGroup/stories/typescript/Simple.tsx +11 -11
- package/components/RangeInput/RangeInput.js +9 -5
- package/components/RangeInput/StyledRangeInput.js +12 -6
- package/components/RangeInput/stories/{Bounds.js → CustomThemed/Bounds.js} +1 -1
- package/components/RangeInput/stories/{typescript → CustomThemed}/CustomRange.tsx +2 -2
- package/components/RangeInput/stories/{Disabled.js → CustomThemed/Disabled.js} +1 -1
- package/components/RangeInput/stories/{TrackColor.js → CustomThemed/TrackColor.js} +1 -1
- package/components/RangeInput/stories/SimpleRange.js +2 -6
- package/components/RangeSelector/stories/Basics.js +32 -30
- package/components/RangeSelector/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/components/RangeSelector/stories/{CustomEdgeControl.js → CustomThemed/CustomEdgeControl.js} +1 -1
- package/components/RangeSelector/stories/Step.js +32 -30
- package/components/RangeSelector/stories/Thin.js +11 -9
- package/components/RangeSelector/stories/Vertical.js +32 -30
- package/components/Select/Select.js +59 -16
- package/components/Select/SelectContainer.js +58 -36
- package/components/Select/index.d.ts +3 -3
- package/components/Select/propTypes.js +1 -1
- package/components/Select/stories/ChildrenRender.js +37 -33
- package/components/Select/stories/Clear.js +7 -3
- package/components/Select/stories/Controlled.js +32 -28
- package/components/Select/stories/{CustomSearch.js → CustomThemed/CustomSearch.js} +2 -2
- package/components/Select/stories/Disabled.js +29 -25
- package/components/Select/stories/InsideFormField.js +29 -27
- package/components/Select/stories/LazyLoadingOptions.js +27 -25
- package/components/Select/stories/ManyOptions.js +47 -43
- package/components/Select/stories/Multiple.js +25 -21
- package/components/Select/stories/ObjectOptions.js +27 -25
- package/components/Select/stories/Search.js +62 -58
- package/components/Select/stories/Simple.js +26 -22
- package/components/Select/stories/Uncontrolled.js +24 -20
- package/components/Select/stories/ValueLabel.js +40 -36
- package/components/Select/stories/typescript/CreateOption.tsx +34 -30
- package/components/Sidebar/stories/Labels.js +27 -23
- package/components/SkipLinks/SkipLinks.js +1 -0
- package/components/SkipLinks/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/components/SkipLinks/stories/Simple.js +82 -78
- package/components/Stack/stories/Simple.js +17 -8
- package/components/Tab/Tab.js +6 -1
- package/components/Table/stories/Default.js +30 -28
- package/components/Table/stories/InfiniteScrollInTable.js +39 -35
- package/components/Table/stories/MeterInTable.js +26 -24
- package/components/TableCell/TableCell.js +1 -1
- package/components/TableCell/propTypes.js +11 -0
- package/components/Tabs/stories/Responsive.js +17 -102
- package/components/Tabs/stories/Rich.js +29 -51
- package/components/Tabs/stories/Scrollable.js +5 -3
- package/components/Tabs/stories/typescript/Controlled.tsx +18 -17
- package/components/Tag/Tag.js +17 -6
- package/components/Tag/index.d.ts +8 -0
- package/components/Tag/propTypes.js +2 -1
- package/components/Tag/stories/Size.js +45 -0
- package/components/Text/stories/All.js +5 -1
- package/components/TextArea/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/components/TextArea/stories/InsideFormField.js +43 -41
- package/components/TextArea/stories/NonResizable.js +13 -11
- package/components/TextArea/stories/Simple.js +13 -11
- package/components/TextInput/TextInput.js +6 -9
- package/components/TextInput/stories/{typescript → CustomThemed}/CustomSuggestions.tsx +1 -1
- package/components/TextInput/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/components/TextInput/stories/DefaultSuggestion.js +20 -19
- package/components/TextInput/stories/Icon.js +22 -21
- package/components/TextInput/stories/InsideFormField.js +32 -30
- package/components/TextInput/stories/OnSelect.js +20 -19
- package/components/TextInput/stories/Password.js +30 -29
- package/components/TextInput/stories/Simple.js +17 -16
- package/components/TextInput/stories/StyledPlaceholder.js +10 -9
- package/components/TextInput/stories/Suggestions.js +19 -18
- package/components/TextInput/stories/Uncontrolled.js +18 -17
- package/components/TextInput/stories/WithTags.js +19 -18
- package/components/Tip/Tip.js +6 -14
- package/components/Tip/stories/Caret.js +38 -34
- package/components/Tip/stories/{ResponsiveTip.js → CustomThemed/ResponsiveTip.js} +1 -1
- package/components/Tip/stories/{SidebarTip.js → CustomThemed/SidebarTip.js} +1 -1
- package/components/Tip/stories/{typescript → CustomThemed}/Themed.tsx +4 -7
- package/components/Tip/stories/HeaderActions.js +66 -60
- package/components/Tip/stories/InfoTip.js +59 -56
- package/components/Tip/stories/typescript/Animated.tsx +26 -21
- package/components/Tip/stories/typescript/Children.tsx +35 -16
- package/components/Tip/stories/typescript/Simple.tsx +12 -7
- package/components/index.js +16 -0
- package/es6/components/Anchor/index.d.ts +2 -0
- package/es6/components/Anchor/stories/Default.js +16 -7
- package/es6/components/Box/StyledBox.js +1 -3
- package/es6/components/Box/stories/Animation.js +24 -21
- package/es6/components/Box/stories/Background.js +95 -92
- package/es6/components/Box/stories/Border.js +89 -86
- package/es6/components/Box/stories/Custom.js +16 -13
- package/es6/components/Box/stories/Elevation.js +28 -25
- package/es6/components/Box/stories/Fixed.js +44 -41
- package/es6/components/Box/stories/MinMax.js +207 -204
- package/es6/components/Box/stories/OnClick.js +28 -25
- package/es6/components/Box/stories/RTL.js +36 -31
- package/es6/components/Box/stories/Round.js +56 -53
- package/es6/components/Box/stories/Simple.js +47 -44
- package/es6/components/Button/Button.js +2 -3
- package/es6/components/Button/StyledButtonKind.js +6 -3
- package/es6/components/Button/stories/CustomThemed/Active.js +1 -0
- package/es6/components/Button/stories/CustomThemed/Typescript.tsx +1 -1
- package/es6/components/Button/stories/Multiple.js +1 -1
- package/es6/components/Button/stories/typescript/Badge.tsx +58 -0
- package/es6/components/Calendar/Calendar.js +84 -116
- package/es6/components/Calendar/stories/Multiple.js +2 -1
- package/es6/components/Calendar/stories/Simple.js +0 -8
- package/es6/components/Calendar/utils.js +72 -15
- package/es6/components/Carousel/stories/Autoplay.js +6 -3
- package/es6/components/Carousel/stories/ControlVariations.js +9 -9
- package/es6/components/Carousel/stories/Controlled.js +3 -3
- package/es6/components/Carousel/stories/Simple.js +3 -3
- package/es6/components/Chart/Chart.js +14 -6
- package/es6/components/Chart/stories/Labelled.js +2 -2
- package/es6/components/Chart/utils.js +4 -4
- package/es6/components/CheckBox/stories/Simple.js +9 -3
- package/es6/components/CheckBox/stories/WithStickyDiv.js +1 -1
- package/es6/components/CheckBoxGroup/stories/Disabled.js +7 -1
- package/es6/components/DataChart/DataChart.js +109 -25
- package/es6/components/DataChart/Detail.js +7 -0
- package/es6/components/DataChart/XAxis.js +20 -14
- package/es6/components/DataChart/YAxis.js +4 -7
- package/es6/components/DataChart/YGuide.js +12 -1
- package/es6/components/DataChart/index.d.ts +16 -3
- package/es6/components/DataChart/propTypes.js +6 -2
- package/es6/components/DataChart/stories/Offset.js +70 -0
- package/es6/components/DataChart/stories/Placeholder.js +36 -0
- package/es6/components/DataChart/stories/StackedAreas.js +65 -0
- package/es6/components/DataChart/stories/StackedLines.js +61 -0
- package/es6/components/DataTable/DataTable.js +56 -45
- package/es6/components/DataTable/PlaceholderBody.js +13 -0
- package/es6/components/DataTable/stories/MultiplePin.js +1 -1
- package/es6/components/DateInput/DateInput.js +80 -30
- package/es6/components/DateInput/index.d.ts +1 -0
- package/es6/components/DateInput/propTypes.js +1 -0
- package/es6/components/DateInput/stories/Form.js +2 -1
- package/es6/components/DateInput/stories/Format.js +2 -1
- package/es6/components/DateInput/stories/FormatInline.js +16 -8
- package/es6/components/DateInput/stories/Inline.js +2 -1
- package/es6/components/DateInput/stories/Range.js +2 -1
- package/es6/components/DateInput/stories/RangeFormat.js +2 -1
- package/es6/components/DateInput/stories/Simple.js +2 -1
- package/es6/components/DateInput/stories/typescript/European.tsx +2 -1
- package/es6/components/DateInput/utils.js +11 -4
- package/es6/components/Diagram/stories/Animated.js +44 -41
- package/es6/components/Diagram/stories/Progressing.js +32 -29
- package/es6/components/Diagram/stories/typescript/Connections.tsx +14 -13
- package/es6/components/Distribution/stories/typescript/Simple.tsx +24 -20
- package/es6/components/Drop/Drop.js +10 -6
- package/es6/components/Drop/index.d.ts +1 -0
- package/es6/components/Drop/propTypes.js +1 -0
- package/es6/components/Drop/stories/CustomThemed/Lazy.js +20 -16
- package/es6/components/Drop/stories/CustomThemed/Themed.js +5 -4
- package/es6/components/Drop/stories/Inline.js +55 -0
- package/es6/components/Drop/stories/Meter.js +6 -5
- package/es6/components/Drop/stories/Multiple.js +19 -6
- package/es6/components/Drop/stories/Overflow.js +6 -4
- package/es6/components/Drop/stories/Plain.js +6 -5
- package/es6/components/Drop/stories/Progressive.js +5 -4
- package/es6/components/Drop/stories/Simple.js +5 -4
- package/es6/components/Drop/stories/Styled.js +10 -8
- package/es6/components/Drop/stories/TrapFocus.js +4 -3
- package/es6/components/DropButton/stories/Menu.js +8 -4
- package/es6/components/DropButton/stories/Simple.js +4 -3
- package/es6/components/Footer/stories/DoubleFooter.js +37 -33
- package/es6/components/Footer/stories/Simple.js +25 -21
- package/es6/components/Footer/stories/Sitemap.js +35 -31
- package/es6/components/Footer/stories/Social.js +35 -31
- package/es6/components/Form/Form.js +111 -112
- package/es6/components/Form/stories/AggregateValidation.js +65 -54
- package/es6/components/Form/stories/ArrayOfFormFields.js +59 -55
- package/es6/components/Form/stories/Controlled.js +100 -95
- package/es6/components/Form/stories/ControlledInput.js +130 -125
- package/es6/components/Form/stories/ControlledInputLazy.js +130 -125
- package/es6/components/Form/stories/ControlledLazy.js +98 -93
- package/es6/components/Form/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/es6/components/Form/stories/{FieldBorderPosition.js → CustomThemed/FieldBorderPosition.js} +24 -19
- package/es6/components/Form/stories/{FieldCustomStates.js → CustomThemed/FieldCustomStates.js} +1 -1
- package/es6/components/Form/stories/{FieldSpacingOptions.js → CustomThemed/FieldSpacingOptions.js} +5 -5
- package/es6/components/Form/stories/{RequiredLabel.js → CustomThemed/RequiredLabel.js} +1 -1
- package/es6/components/Form/stories/{Themed.js → CustomThemed/Themed.js} +2 -2
- package/es6/components/Form/stories/DynamicFields.js +63 -58
- package/es6/components/Form/stories/FieldStates.js +63 -60
- package/es6/components/Form/stories/FieldWithChildren.js +110 -105
- package/es6/components/Form/stories/FieldWithComponentProp.js +110 -105
- package/es6/components/Form/stories/HelpAndError.js +40 -18
- package/es6/components/Form/stories/Uncontrolled.js +100 -95
- package/es6/components/Form/stories/ValidateOnBlur.js +66 -61
- package/es6/components/Form/stories/ValidateOnChange.js +83 -78
- package/es6/components/Form/stories/ValidateOnMount.js +68 -63
- package/es6/components/Form/stories/typescript/TypedForm.tsx +69 -66
- package/es6/components/FormField/FormField.js +7 -3
- package/es6/components/FormField/stories/{typescript → CustomThemed}/Custom.tsx +1 -1
- package/es6/components/FormField/stories/Simple.js +23 -20
- package/es6/components/Grid/StyledGrid.js +1 -3
- package/es6/components/Grid/stories/AreasPropAlternative.js +28 -23
- package/es6/components/Grid/stories/Border.js +76 -73
- package/es6/components/Grid/stories/{Responsive.js → CustomThemed/Responsive.js} +1 -1
- package/es6/components/Grid/stories/NColumn.js +29 -24
- package/es6/components/Grid/stories/Percentages.js +31 -26
- package/es6/components/Grid/stories/ResponsiveCards.js +22 -18
- package/es6/components/Grid/stories/typescript/App.tsx +10 -4
- package/es6/components/Image/stories/Fallback.js +11 -8
- package/es6/components/Image/stories/Fill.js +21 -18
- package/es6/components/Image/stories/Fit.js +25 -22
- package/es6/components/Image/stories/Opacity.js +40 -37
- package/es6/components/Image/stories/Simple.js +10 -7
- package/es6/components/InfiniteScroll/stories/Basics.js +19 -16
- package/es6/components/InfiniteScroll/stories/ClassChildren.js +15 -12
- package/es6/components/InfiniteScroll/stories/Grid.js +22 -19
- package/es6/components/InfiniteScroll/stories/GridWithShow.js +23 -20
- package/es6/components/InfiniteScroll/stories/HeightReplace.js +21 -18
- package/es6/components/InfiniteScroll/stories/Marker.js +19 -16
- package/es6/components/InfiniteScroll/stories/Replace.js +20 -17
- package/es6/components/InfiniteScroll/stories/Show.js +19 -16
- package/es6/components/InfiniteScroll/stories/ShowAfter.js +19 -16
- package/es6/components/InfiniteScroll/stories/ShowBefore.js +19 -16
- package/es6/components/InfiniteScroll/stories/Variable.js +20 -17
- package/es6/components/InfiniteScroll/stories/typescript/OnMore.tsx +18 -24
- package/es6/components/InfiniteScroll/stories/typescript/OnMoreStep.tsx +18 -24
- package/es6/components/Keyboard/stories/OnDocument.js +2 -5
- package/es6/components/Layer/stories/Center.js +84 -79
- package/es6/components/Layer/stories/Corner.js +30 -25
- package/es6/components/Layer/stories/{Round.js → CustomThemed/Round.js} +1 -1
- package/es6/components/Layer/stories/Form.js +73 -68
- package/es6/components/Layer/stories/Full.js +38 -33
- package/es6/components/Layer/stories/Notification.js +52 -47
- package/es6/components/Layer/stories/Plain.js +25 -20
- package/es6/components/Layer/stories/RTL.js +33 -28
- package/es6/components/Layer/stories/ScrollBody.js +44 -41
- package/es6/components/Layer/stories/Target.js +75 -70
- package/es6/components/List/List.js +11 -2
- package/es6/components/List/index.d.ts +1 -0
- package/es6/components/List/propTypes.js +1 -0
- package/es6/components/Main/stories/typescript/Simple.tsx +6 -4
- package/es6/components/Markdown/Markdown.js +4 -2
- package/es6/components/Markdown/stories/Override.js +15 -12
- package/es6/components/Markdown/stories/Simple.js +13 -10
- package/es6/components/MaskedInput/MaskedInput.js +1 -1
- package/es6/components/MaskedInput/index.d.ts +1 -0
- package/es6/components/MaskedInput/propTypes.js +1 -0
- package/es6/components/MaskedInput/stories/CustomBox.js +49 -44
- package/es6/components/MaskedInput/stories/Date.js +55 -50
- package/es6/components/MaskedInput/stories/DateRange.js +88 -83
- package/es6/components/MaskedInput/stories/DateTimeDrop.js +31 -28
- package/es6/components/MaskedInput/stories/Filtered.js +33 -28
- package/es6/components/MaskedInput/stories/Form.js +35 -32
- package/es6/components/MaskedInput/stories/IPV4Range.js +70 -65
- package/es6/components/MaskedInput/stories/IPv4Address.js +46 -41
- package/es6/components/MaskedInput/stories/Phone.js +44 -39
- package/es6/components/MaskedInput/stories/SizeUnits.js +36 -31
- package/es6/components/MaskedInput/stories/Time.js +47 -42
- package/es6/components/MaskedInput/stories/URL.js +29 -24
- package/es6/components/MaskedInput/stories/typescript/Email.tsx +24 -20
- package/es6/components/Menu/Menu.js +48 -15
- package/es6/components/Menu/stories/Justify.js +5 -4
- package/es6/components/Menu/stories/typescript/Children.tsx +4 -3
- package/es6/components/NameValueList/stories/Align.js +38 -35
- package/es6/components/NameValueList/stories/CustomName.js +24 -21
- package/es6/components/NameValueList/stories/CustomValue.js +65 -62
- package/es6/components/NameValueList/stories/Layout.js +44 -41
- package/es6/components/NameValueList/stories/PairProps.js +25 -22
- package/es6/components/NameValueList/stories/Simple.js +17 -14
- package/es6/components/NameValueList/stories/Width.js +39 -36
- package/es6/components/Nav/stories/Sidebar.js +5 -3
- package/es6/components/Notification/Notification.js +135 -21
- package/es6/components/Notification/index.d.ts +10 -3
- package/es6/components/Notification/propTypes.js +7 -2
- package/es6/components/Notification/stories/Global.js +70 -0
- package/es6/components/Page/Page.js +40 -0
- package/es6/components/Page/PageContext.js +2 -0
- package/es6/components/Page/README.md +2 -0
- package/es6/components/Page/index.d.ts +12 -0
- package/es6/components/Page/index.js +2 -0
- package/es6/components/Page/propTypes.js +10 -0
- package/es6/components/Page/stories/Background.js +30 -0
- package/es6/components/Page/stories/ContentBackground.js +32 -0
- package/es6/components/Page/stories/CustomThemed/LeftColumn.js +65 -0
- package/es6/components/Page/stories/GlobalHeader.js +35 -0
- package/es6/components/Page/stories/MultipleBackgrounds.js +63 -0
- package/es6/components/Page/stories/MultipleContent.js +37 -0
- package/es6/components/Page/stories/PageNotificaton.js +77 -0
- package/es6/components/Page/stories/Simple.js +27 -0
- package/es6/components/PageContent/PageContent.js +36 -0
- package/es6/components/PageContent/README.md +2 -0
- package/es6/components/PageContent/index.d.ts +19 -0
- package/es6/components/PageContent/index.js +1 -0
- package/es6/components/PageContent/propTypes.js +21 -0
- package/es6/components/Pagination/stories/Grid.js +35 -30
- package/es6/components/Pagination/stories/NumberEdgePages.js +19 -16
- package/es6/components/Pagination/stories/NumberMiddlePages.js +19 -16
- package/es6/components/Pagination/stories/Simple.js +20 -17
- package/es6/components/Pagination/stories/Size.js +21 -18
- package/es6/components/RadioButton/stories/CustomThemed/Theme.js +5 -5
- package/es6/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.js +7 -10
- package/es6/components/RadioButtonGroup/stories/typescript/Simple.tsx +11 -11
- package/es6/components/RangeInput/RangeInput.js +9 -5
- package/es6/components/RangeInput/StyledRangeInput.js +12 -6
- package/es6/components/RangeInput/stories/{Bounds.js → CustomThemed/Bounds.js} +1 -1
- package/es6/components/RangeInput/stories/{typescript → CustomThemed}/CustomRange.tsx +2 -2
- package/es6/components/RangeInput/stories/{Disabled.js → CustomThemed/Disabled.js} +1 -1
- package/es6/components/RangeInput/stories/{TrackColor.js → CustomThemed/TrackColor.js} +1 -1
- package/es6/components/RangeInput/stories/SimpleRange.js +3 -6
- package/es6/components/RangeSelector/stories/Basics.js +33 -30
- package/es6/components/RangeSelector/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/es6/components/RangeSelector/stories/{CustomEdgeControl.js → CustomThemed/CustomEdgeControl.js} +1 -1
- package/es6/components/RangeSelector/stories/Step.js +33 -30
- package/es6/components/RangeSelector/stories/Thin.js +12 -9
- package/es6/components/RangeSelector/stories/Vertical.js +33 -30
- package/es6/components/Select/Select.js +59 -16
- package/es6/components/Select/SelectContainer.js +58 -36
- package/es6/components/Select/index.d.ts +3 -3
- package/es6/components/Select/propTypes.js +1 -1
- package/es6/components/Select/stories/ChildrenRender.js +38 -33
- package/es6/components/Select/stories/Clear.js +8 -4
- package/es6/components/Select/stories/Controlled.js +33 -28
- package/es6/components/Select/stories/{CustomSearch.js → CustomThemed/CustomSearch.js} +2 -2
- package/es6/components/Select/stories/Disabled.js +30 -25
- package/es6/components/Select/stories/InsideFormField.js +30 -27
- package/es6/components/Select/stories/LazyLoadingOptions.js +28 -25
- package/es6/components/Select/stories/ManyOptions.js +48 -43
- package/es6/components/Select/stories/Multiple.js +26 -21
- package/es6/components/Select/stories/ObjectOptions.js +28 -25
- package/es6/components/Select/stories/Search.js +63 -58
- package/es6/components/Select/stories/Simple.js +27 -22
- package/es6/components/Select/stories/Uncontrolled.js +25 -20
- package/es6/components/Select/stories/ValueLabel.js +41 -36
- package/es6/components/Select/stories/typescript/CreateOption.tsx +34 -30
- package/es6/components/Sidebar/stories/Labels.js +28 -24
- package/es6/components/SkipLinks/SkipLinks.js +1 -0
- package/es6/components/SkipLinks/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/es6/components/SkipLinks/stories/Simple.js +83 -79
- package/es6/components/Stack/stories/Simple.js +17 -9
- package/es6/components/Tab/Tab.js +6 -1
- package/es6/components/Table/stories/Default.js +31 -28
- package/es6/components/Table/stories/InfiniteScrollInTable.js +40 -36
- package/es6/components/Table/stories/MeterInTable.js +27 -24
- package/es6/components/TableCell/TableCell.js +1 -1
- package/es6/components/TableCell/propTypes.js +10 -0
- package/es6/components/Tabs/stories/Responsive.js +17 -102
- package/es6/components/Tabs/stories/Rich.js +31 -50
- package/es6/components/Tabs/stories/Scrollable.js +6 -4
- package/es6/components/Tabs/stories/typescript/Controlled.tsx +18 -17
- package/es6/components/Tag/Tag.js +17 -6
- package/es6/components/Tag/index.d.ts +8 -0
- package/es6/components/Tag/propTypes.js +2 -1
- package/es6/components/Tag/stories/Size.js +33 -0
- package/es6/components/Text/stories/All.js +5 -1
- package/es6/components/TextArea/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/es6/components/TextArea/stories/InsideFormField.js +44 -41
- package/es6/components/TextArea/stories/NonResizable.js +14 -11
- package/es6/components/TextArea/stories/Simple.js +14 -11
- package/es6/components/TextInput/TextInput.js +6 -9
- package/es6/components/TextInput/stories/{typescript → CustomThemed}/CustomSuggestions.tsx +1 -1
- package/es6/components/TextInput/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/es6/components/TextInput/stories/DefaultSuggestion.js +21 -19
- package/es6/components/TextInput/stories/Icon.js +23 -21
- package/es6/components/TextInput/stories/InsideFormField.js +33 -30
- package/es6/components/TextInput/stories/OnSelect.js +21 -19
- package/es6/components/TextInput/stories/Password.js +31 -29
- package/es6/components/TextInput/stories/Simple.js +18 -16
- package/es6/components/TextInput/stories/StyledPlaceholder.js +11 -9
- package/es6/components/TextInput/stories/Suggestions.js +20 -18
- package/es6/components/TextInput/stories/Uncontrolled.js +19 -17
- package/es6/components/TextInput/stories/WithTags.js +20 -18
- package/es6/components/Tip/Tip.js +6 -15
- package/es6/components/Tip/stories/Caret.js +39 -35
- package/es6/components/Tip/stories/{ResponsiveTip.js → CustomThemed/ResponsiveTip.js} +1 -1
- package/es6/components/Tip/stories/{SidebarTip.js → CustomThemed/SidebarTip.js} +1 -1
- package/es6/components/Tip/stories/{typescript → CustomThemed}/Themed.tsx +4 -7
- package/es6/components/Tip/stories/HeaderActions.js +67 -61
- package/es6/components/Tip/stories/InfoTip.js +60 -57
- package/es6/components/Tip/stories/typescript/Animated.tsx +26 -21
- package/es6/components/Tip/stories/typescript/Children.tsx +35 -16
- package/es6/components/Tip/stories/typescript/Simple.tsx +12 -7
- package/es6/components/index.js +2 -0
- package/es6/index.d.ts +2 -0
- package/es6/languages/default.json +2 -1
- package/es6/themes/base.d.ts +103 -1
- package/es6/themes/base.js +173 -6
- package/es6/utils/border.js +40 -36
- package/es6/utils/index.d.ts +11 -12
- package/es6/utils/styles.js +3 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/index.d.ts +2 -0
- package/languages/default.json +2 -1
- package/package.json +51 -51
- package/themes/base.d.ts +103 -1
- package/themes/base.js +174 -6
- package/utils/border.js +46 -42
- package/utils/index.d.ts +11 -12
- package/utils/styles.js +3 -1
- package/components/Accordion/stories/DarkNoAnimation.js +0 -59
- package/components/Anchor/stories/Disabled.js +0 -32
- package/components/Anchor/stories/Inline.js +0 -30
- package/components/Button/stories/CustomThemed/Badge.tsx +0 -129
- package/components/Chart/stories/Types.js +0 -49
- package/components/CheckBox/stories/InsideFormField.js +0 -93
- package/components/CheckBox/stories/Reverse.js +0 -52
- package/components/CheckBoxGroup/stories/FormControlled.js +0 -55
- package/components/CheckBoxGroup/stories/FormUncontrolled.js +0 -69
- package/components/CheckBoxGroup/stories/ObjectOptions.js +0 -71
- package/components/Heading/stories/Color.js +0 -28
- package/components/Layer/stories/Margin.js +0 -61
- package/components/Layer/stories/MarginCenter.js +0 -62
- package/components/Layer/stories/MarginTop.js +0 -71
- package/components/RadioButtonGroup/stories/Simple.js +0 -54
- package/components/Sidebar/stories/typescript/Simple.tsx +0 -63
- package/components/Tabs/stories/CustomThemed/AlignControls.js +0 -83
- package/components/Tabs/stories/CustomThemed/Icon.js +0 -99
- package/components/Tabs/stories/Plain.js +0 -80
- package/components/Tabs/stories/Uncontrolled.js +0 -78
- package/components/Text/stories/Color.js +0 -22
- package/es6/components/Accordion/stories/DarkNoAnimation.js +0 -47
- package/es6/components/Anchor/stories/Disabled.js +0 -21
- package/es6/components/Anchor/stories/Inline.js +0 -19
- package/es6/components/Button/stories/CustomThemed/Badge.tsx +0 -129
- package/es6/components/Chart/stories/Types.js +0 -36
- package/es6/components/CheckBox/stories/Disabled.js +0 -40
- package/es6/components/CheckBox/stories/InsideFormField.js +0 -81
- package/es6/components/CheckBox/stories/Reverse.js +0 -39
- package/es6/components/CheckBox/stories/Toggle.js +0 -39
- package/es6/components/CheckBoxGroup/stories/FormControlled.js +0 -41
- package/es6/components/CheckBoxGroup/stories/FormUncontrolled.js +0 -57
- package/es6/components/CheckBoxGroup/stories/ObjectOptions.js +0 -57
- package/es6/components/Heading/stories/Color.js +0 -16
- package/es6/components/Layer/stories/Margin.js +0 -49
- package/es6/components/Layer/stories/MarginCenter.js +0 -50
- package/es6/components/Layer/stories/MarginTop.js +0 -59
- package/es6/components/RadioButtonGroup/stories/Simple.js +0 -40
- package/es6/components/Sidebar/stories/typescript/Simple.tsx +0 -63
- package/es6/components/Tabs/stories/CustomThemed/AlignControls.js +0 -71
- package/es6/components/Tabs/stories/CustomThemed/Icon.js +0 -85
- package/es6/components/Tabs/stories/Plain.js +0 -68
- package/es6/components/Tabs/stories/Uncontrolled.js +0 -66
- package/es6/components/Text/stories/Color.js +0 -10
- package/es6/components/TextArea/stories/Fill.js +0 -35
|
@@ -21,17 +21,17 @@ var Simple = function Simple() {
|
|
|
21
21
|
pad: "large"
|
|
22
22
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.Carousel, null, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
23
23
|
pad: "xlarge",
|
|
24
|
-
background: "
|
|
24
|
+
background: "light-1"
|
|
25
25
|
}, /*#__PURE__*/_react["default"].createElement(_grommetIcons.Attraction, {
|
|
26
26
|
size: "xlarge"
|
|
27
27
|
})), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
28
28
|
pad: "xlarge",
|
|
29
|
-
background: "
|
|
29
|
+
background: "light-2"
|
|
30
30
|
}, /*#__PURE__*/_react["default"].createElement(_grommetIcons.TreeOption, {
|
|
31
31
|
size: "xlarge"
|
|
32
32
|
})), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
33
33
|
pad: "xlarge",
|
|
34
|
-
background: "
|
|
34
|
+
background: "light-3"
|
|
35
35
|
}, /*#__PURE__*/_react["default"].createElement(_grommetIcons.Car, {
|
|
36
36
|
size: "xlarge"
|
|
37
37
|
})))) // </Grommet>
|
|
@@ -84,16 +84,24 @@ var Chart = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
84
84
|
|
|
85
85
|
if (pad) {
|
|
86
86
|
if (pad.horizontal) {
|
|
87
|
-
var padSize = (0, _utils.parseMetricToNum)(theme.global.edgeSize[pad.horizontal]);
|
|
88
|
-
result[0]
|
|
89
|
-
result[2]
|
|
87
|
+
var padSize = (0, _utils.parseMetricToNum)(theme.global.edgeSize[pad.horizontal] || pad.horizontal);
|
|
88
|
+
result[0] = padSize;
|
|
89
|
+
result[2] = padSize;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
if (pad.vertical) {
|
|
93
|
-
var _padSize = (0, _utils.parseMetricToNum)(theme.global.edgeSize[pad.vertical]);
|
|
93
|
+
var _padSize = (0, _utils.parseMetricToNum)(theme.global.edgeSize[pad.vertical] || pad.vertical);
|
|
94
94
|
|
|
95
|
-
result[1]
|
|
96
|
-
result[3]
|
|
95
|
+
result[1] = _padSize;
|
|
96
|
+
result[3] = _padSize;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (pad.start) {
|
|
100
|
+
result[0] = (0, _utils.parseMetricToNum)(theme.global.edgeSize[pad.start] || pad.start);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (pad.end) {
|
|
104
|
+
result[2] = (0, _utils.parseMetricToNum)(theme.global.edgeSize[pad.end] || pad.end);
|
|
97
105
|
}
|
|
98
106
|
|
|
99
107
|
if (typeof pad === 'string') {
|
|
@@ -52,11 +52,11 @@ var LabelledCharts = function LabelledCharts() {
|
|
|
52
52
|
}), /*#__PURE__*/_react["default"].createElement(LabelledChart, {
|
|
53
53
|
label: "Usable",
|
|
54
54
|
value: 200,
|
|
55
|
-
color: "
|
|
55
|
+
color: "graph-1"
|
|
56
56
|
}), /*#__PURE__*/_react["default"].createElement(LabelledChart, {
|
|
57
57
|
label: "Used",
|
|
58
58
|
value: 98.2,
|
|
59
|
-
color: "
|
|
59
|
+
color: "graph-2"
|
|
60
60
|
})) // </Grommet>
|
|
61
61
|
|
|
62
62
|
);
|
|
@@ -8,13 +8,13 @@ var normalizeValues = function normalizeValues(values) {
|
|
|
8
8
|
if (value === undefined) return {
|
|
9
9
|
value: [index, undefined]
|
|
10
10
|
};
|
|
11
|
-
if (typeof value === 'number') return {
|
|
12
|
-
value: [index, value]
|
|
13
|
-
};
|
|
14
11
|
if (Array.isArray(value)) return {
|
|
15
12
|
value: value
|
|
16
13
|
};
|
|
17
|
-
return value;
|
|
14
|
+
if (typeof value === 'object') return value;
|
|
15
|
+
return {
|
|
16
|
+
value: [index, value]
|
|
17
|
+
};
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -30,6 +30,7 @@ var SimpleCheckBox = function SimpleCheckBox(_ref) {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
33
|
+
gap: "small",
|
|
33
34
|
align: "center",
|
|
34
35
|
pad: "large"
|
|
35
36
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.CheckBox, _extends({}, rest, {
|
|
@@ -39,9 +40,14 @@ var SimpleCheckBox = function SimpleCheckBox(_ref) {
|
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
var Simple = function Simple() {
|
|
42
|
-
return /*#__PURE__*/_react["default"].createElement(SimpleCheckBox, {
|
|
43
|
-
label: "
|
|
44
|
-
|
|
43
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(SimpleCheckBox, {
|
|
44
|
+
label: "Reversed Checkbox",
|
|
45
|
+
reverse: true
|
|
46
|
+
}), /*#__PURE__*/_react["default"].createElement(SimpleCheckBox, {
|
|
47
|
+
label: "Disabled Checkbox",
|
|
48
|
+
checked: true,
|
|
49
|
+
disabled: true
|
|
50
|
+
}));
|
|
45
51
|
};
|
|
46
52
|
|
|
47
53
|
exports.Simple = Simple;
|
|
@@ -25,13 +25,19 @@ var Disabled = function Disabled() {
|
|
|
25
25
|
vertical: 'small'
|
|
26
26
|
}
|
|
27
27
|
}, " Disabled Individuals"), /*#__PURE__*/_react["default"].createElement(_grommet.CheckBoxGroup, {
|
|
28
|
+
name: "destinations",
|
|
29
|
+
valueKey: "id",
|
|
30
|
+
"aria-labelledby": "drink-formfield-id",
|
|
28
31
|
options: [{
|
|
29
32
|
label: 'Maui',
|
|
33
|
+
id: '1',
|
|
30
34
|
disabled: true
|
|
31
35
|
}, {
|
|
32
|
-
label: 'Jerusalem'
|
|
36
|
+
label: 'Jerusalem',
|
|
37
|
+
id: '2'
|
|
33
38
|
}, {
|
|
34
39
|
label: 'Wuhan',
|
|
40
|
+
id: '3',
|
|
35
41
|
disabled: true
|
|
36
42
|
}]
|
|
37
43
|
})));
|
|
@@ -17,6 +17,8 @@ var _Grid = require("../Grid");
|
|
|
17
17
|
|
|
18
18
|
var _Stack = require("../Stack");
|
|
19
19
|
|
|
20
|
+
var _Text = require("../Text");
|
|
21
|
+
|
|
20
22
|
var _utils = require("../../utils");
|
|
21
23
|
|
|
22
24
|
var _Detail = require("./Detail");
|
|
@@ -35,8 +37,9 @@ var _utils2 = require("./utils");
|
|
|
35
37
|
|
|
36
38
|
var _propTypes = require("./propTypes");
|
|
37
39
|
|
|
38
|
-
var _excluded = ["a11yTitle", "axis", "bounds", "chart", "data", "detail", "gap", "guide", "legend", "pad", "series", "size"],
|
|
39
|
-
_excluded2 = ["property", "type", "x", "y"]
|
|
40
|
+
var _excluded = ["a11yTitle", "axis", "bounds", "chart", "data", "detail", "gap", "guide", "legend", "offset", "placeholder", "pad", "series", "size"],
|
|
41
|
+
_excluded2 = ["property", "type", "x", "y"],
|
|
42
|
+
_excluded3 = ["property"];
|
|
40
43
|
|
|
41
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
42
45
|
|
|
@@ -46,12 +49,19 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
46
49
|
|
|
47
50
|
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; }
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
var stackedChartType = {
|
|
53
|
+
areas: 'area',
|
|
54
|
+
bars: 'bar',
|
|
55
|
+
lines: 'line'
|
|
56
|
+
}; // DataChart takes a generic data array of objects plus as few properties
|
|
50
57
|
// as possible, and creates a Stack of Charts with x and y axes, a legend,
|
|
51
58
|
// and interactive detail.
|
|
52
59
|
// Much of the code here-in involves the "few properties" aspect where we
|
|
53
60
|
// normalize and automatically handle whatever the caller didn't specify.
|
|
61
|
+
|
|
54
62
|
var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
63
|
+
var _boundsProp$y;
|
|
64
|
+
|
|
55
65
|
var a11yTitle = _ref.a11yTitle,
|
|
56
66
|
_ref$axis = _ref.axis,
|
|
57
67
|
axisProp = _ref$axis === void 0 ? true : _ref$axis,
|
|
@@ -65,6 +75,8 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
65
75
|
gap = _ref$gap === void 0 ? 'small' : _ref$gap,
|
|
66
76
|
guideProp = _ref.guide,
|
|
67
77
|
legend = _ref.legend,
|
|
78
|
+
offset = _ref.offset,
|
|
79
|
+
placeholder = _ref.placeholder,
|
|
68
80
|
padProp = _ref.pad,
|
|
69
81
|
seriesProp = _ref.series,
|
|
70
82
|
size = _ref.size,
|
|
@@ -102,7 +114,7 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
102
114
|
});
|
|
103
115
|
}; // Normalize chart to an array of objects.
|
|
104
116
|
// Each chart has one or more properties associated with it.
|
|
105
|
-
// A stacked bar chart has an array of properties.
|
|
117
|
+
// A stacked bar or area chart has an array of properties.
|
|
106
118
|
// A point chart can have x, y, thickness, and color each driven
|
|
107
119
|
// by a separate property.
|
|
108
120
|
|
|
@@ -160,10 +172,11 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
160
172
|
|
|
161
173
|
if (property) {
|
|
162
174
|
if (Array.isArray(property)) {
|
|
163
|
-
// A range chart or a stacked bar chart
|
|
175
|
+
// A range chart or a stacked bar or area chart has multiple
|
|
176
|
+
// properties.
|
|
164
177
|
// In this case, this returns an array of values,
|
|
165
178
|
// one per property.
|
|
166
|
-
if (type
|
|
179
|
+
if (stackedChartType[type]) {
|
|
167
180
|
// Further down, where we render, each property is rendered
|
|
168
181
|
// using a separate Chart component and the values are stacked
|
|
169
182
|
// such that they line up appropriately.
|
|
@@ -177,6 +190,7 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
177
190
|
return values.map(function (v, i) {
|
|
178
191
|
var base = totals[i] || 0;
|
|
179
192
|
totals[i] = base + v;
|
|
193
|
+
if (type === 'lines') return [i, base + v];
|
|
180
194
|
return [i, base, base + v];
|
|
181
195
|
});
|
|
182
196
|
});
|
|
@@ -312,15 +326,20 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
312
326
|
} else steps[1] = 1;
|
|
313
327
|
|
|
314
328
|
var chartBounds = chartValues.map(function (_, index) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
329
|
+
var type = charts[index].type;
|
|
330
|
+
|
|
331
|
+
if (stackedChartType[type]) {
|
|
332
|
+
var _chartValues$index, _chartValues$index$;
|
|
333
|
+
|
|
334
|
+
// merge values for bars, areas, and lines cases
|
|
335
|
+
var mergedValues = ((_chartValues$index = chartValues[index]) == null ? void 0 : (_chartValues$index$ = _chartValues$index[0]) == null ? void 0 : _chartValues$index$.slice(0)) || [];
|
|
336
|
+
chartValues[index].slice(1) // skip first index as that is the x value
|
|
337
|
+
.filter(function (values) {
|
|
319
338
|
return values;
|
|
320
339
|
}) // property name isn't valid
|
|
321
340
|
.forEach(function (values) {
|
|
322
341
|
mergedValues = mergedValues.map(function (__, i) {
|
|
323
|
-
return [i, Math.min(mergedValues[i][1], values[i][1]), Math.max(mergedValues[i][2], values[i][2])];
|
|
342
|
+
return type === 'lines' ? [i, Math.min(mergedValues[i][1], values[i][1]), Math.max(mergedValues[i][1], values[i][1])] : [i, Math.min(mergedValues[i][1], values[i][1]), Math.max(mergedValues[i][2], values[i][2])];
|
|
324
343
|
});
|
|
325
344
|
});
|
|
326
345
|
return (0, _Chart.calcBounds)(mergedValues, {
|
|
@@ -349,11 +368,21 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
349
368
|
});
|
|
350
369
|
}
|
|
351
370
|
|
|
371
|
+
if (typeof boundsProp === 'object') {
|
|
372
|
+
if (boundsProp.y) chartBounds = chartBounds.map(function (b) {
|
|
373
|
+
return [b[0], [].concat(boundsProp.y)];
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
|
|
352
377
|
return chartValues.map(function (values, index) {
|
|
353
|
-
var
|
|
378
|
+
var _charts$index = charts[index],
|
|
379
|
+
thickness = _charts$index.thickness,
|
|
380
|
+
type = _charts$index.type;
|
|
381
|
+
var calcValues = stackedChartType[type] ? values[0] : values;
|
|
354
382
|
return (0, _Chart.calcs)(calcValues, {
|
|
355
383
|
bounds: chartBounds[index],
|
|
356
|
-
steps: steps
|
|
384
|
+
steps: steps,
|
|
385
|
+
thickness: thickness
|
|
357
386
|
});
|
|
358
387
|
});
|
|
359
388
|
}, [axis, boundsProp, charts, chartValues, data, granularities]); // normalize how we style data properties for use by Legend and Detail
|
|
@@ -443,6 +472,7 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
443
472
|
|
|
444
473
|
return result;
|
|
445
474
|
}, [axis, granularities, guideProp]); // set the pad to half the thickness, based on the chart types
|
|
475
|
+
// except when using offset, then add even more horizontal pad
|
|
446
476
|
|
|
447
477
|
var pad = (0, _react.useMemo)(function () {
|
|
448
478
|
if (padProp !== undefined) return padProp;
|
|
@@ -454,7 +484,31 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
454
484
|
if (type && type !== 'bar') result.vertical = _utils2.halfPad[thickness];
|
|
455
485
|
});
|
|
456
486
|
return result;
|
|
457
|
-
}, [chartProps, charts, padProp]); //
|
|
487
|
+
}, [chartProps, charts, padProp]); // calculate the thickness in pixels of each chart
|
|
488
|
+
|
|
489
|
+
var thicknesses = (0, _react.useMemo)(function () {
|
|
490
|
+
return offset ? charts.map(function (_, index) {
|
|
491
|
+
var thickness = chartProps[index].thickness;
|
|
492
|
+
return (0, _utils.parseMetricToNum)(theme.global.edgeSize[thickness] || thickness);
|
|
493
|
+
}) : undefined;
|
|
494
|
+
}, [charts, chartProps, offset, theme]); // calculate the offset for each chart, which is a sum of the thicknesses
|
|
495
|
+
// that preceded it
|
|
496
|
+
|
|
497
|
+
var offsets = (0, _react.useMemo)(function () {
|
|
498
|
+
return offset ? thicknesses.map(function (t, i) {
|
|
499
|
+
return thicknesses.slice(0, i).reduce(function (a, b) {
|
|
500
|
+
return a + b;
|
|
501
|
+
}, 0);
|
|
502
|
+
}) : undefined;
|
|
503
|
+
}, [offset, thicknesses]); // Calculate the total pad we should add to the end of each chart.
|
|
504
|
+
// We do this to shrink the width of each chart so we can shift them
|
|
505
|
+
// via `translate` and have them take up the right amount of width.
|
|
506
|
+
|
|
507
|
+
var offsetPad = (0, _react.useMemo)(function () {
|
|
508
|
+
return offset ? thicknesses.reduce(function (a, b) {
|
|
509
|
+
return a + b;
|
|
510
|
+
}, 0) + "px" : undefined;
|
|
511
|
+
}, [offset, thicknesses]); // The thickness of the Detail segments. We need to convert to numbers
|
|
458
512
|
// to be able to compare across charts where some might be using T-shirt
|
|
459
513
|
// labels and others might be pixel values.
|
|
460
514
|
|
|
@@ -517,14 +571,14 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
517
571
|
var xAxisElement = axis && axis.x && chartProps.length ? /*#__PURE__*/_react["default"].createElement(_XAxis.XAxis, {
|
|
518
572
|
ref: xRef,
|
|
519
573
|
axis: axis,
|
|
520
|
-
chartProps: chartProps,
|
|
521
|
-
|
|
574
|
+
values: (Array.isArray(chartProps[0]) ? chartProps[0][0] : chartProps[0]).axis[0],
|
|
575
|
+
pad: pad,
|
|
522
576
|
renderValue: renderValue,
|
|
523
577
|
serie: axis.x.property && getPropertySeries(axis.x.property)
|
|
524
578
|
}) : null;
|
|
525
|
-
var yAxisElement = axis && axis.y && chartProps.length ? /*#__PURE__*/_react["default"].createElement(_YAxis.YAxis, {
|
|
579
|
+
var yAxisElement = axis && axis.y && (chartProps.length || boundsProp != null && boundsProp.y) ? /*#__PURE__*/_react["default"].createElement(_YAxis.YAxis, {
|
|
526
580
|
axis: axis,
|
|
527
|
-
chartProps: chartProps,
|
|
581
|
+
values: (boundsProp == null ? void 0 : (_boundsProp$y = boundsProp.y) == null ? void 0 : _boundsProp$y.slice(0).reverse()) || (Array.isArray(chartProps[0]) ? chartProps[0][0] : chartProps[0]).axis[1],
|
|
528
582
|
pad: pad,
|
|
529
583
|
renderValue: renderValue,
|
|
530
584
|
serie: axis.y.property && getPropertySeries(axis.y.property)
|
|
@@ -559,20 +613,39 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
559
613
|
y = _ref9.y,
|
|
560
614
|
chartRest = _objectWithoutPropertiesLoose(_ref9, _excluded2);
|
|
561
615
|
|
|
562
|
-
|
|
616
|
+
// When we offset, we increase the padding on the end for all charts
|
|
617
|
+
// by the same amount and we shift each successive chart to the
|
|
618
|
+
// right by an offset for that chart. The last chart's right side
|
|
619
|
+
// will end up aligning with where the charts would have been
|
|
620
|
+
// had we not padded their ends.
|
|
621
|
+
var chartPad = offsetPad ? _extends({}, pad, {
|
|
622
|
+
end: offsetPad
|
|
623
|
+
}) : pad;
|
|
624
|
+
var offsetProps = offsetPad ? {
|
|
625
|
+
style: {
|
|
626
|
+
transform: "translate(" + offsets[i] + "px, 0px)"
|
|
627
|
+
}
|
|
628
|
+
} : {};
|
|
629
|
+
|
|
630
|
+
if (stackedChartType[type]) {
|
|
563
631
|
// reverse to ensure area Charts are stacked in the right order
|
|
564
632
|
return prop.map(function (cProp, j) {
|
|
565
633
|
var pProp = cProp.property || cProp;
|
|
634
|
+
|
|
635
|
+
var _ref10 = typeof cProp === 'object' ? cProp : {},
|
|
636
|
+
property = _ref10.property,
|
|
637
|
+
propRest = _objectWithoutPropertiesLoose(_ref10, _excluded3);
|
|
638
|
+
|
|
566
639
|
return /*#__PURE__*/_react["default"].createElement(_Chart.Chart // eslint-disable-next-line react/no-array-index-key
|
|
567
640
|
, _extends({
|
|
568
641
|
key: j // when property name isn't valid, send empty array
|
|
569
642
|
,
|
|
570
643
|
values: chartValues[i][j] || [],
|
|
571
644
|
overflow: true
|
|
572
|
-
}, seriesStyles[pProp], chartProps[i], chartRest, {
|
|
573
|
-
type:
|
|
645
|
+
}, seriesStyles[pProp], chartProps[i], chartRest, propRest, offsetProps, {
|
|
646
|
+
type: stackedChartType[type] || type,
|
|
574
647
|
size: size,
|
|
575
|
-
pad:
|
|
648
|
+
pad: chartPad
|
|
576
649
|
}));
|
|
577
650
|
}).reverse();
|
|
578
651
|
}
|
|
@@ -582,15 +655,27 @@ var DataChart = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
582
655
|
key: i,
|
|
583
656
|
values: chartValues[i],
|
|
584
657
|
overflow: true
|
|
585
|
-
}, seriesStyles[prop], chartProps[i], chartRest, {
|
|
658
|
+
}, seriesStyles[prop], chartProps[i], chartRest, offsetProps, {
|
|
586
659
|
type: type,
|
|
587
660
|
size: size,
|
|
588
|
-
pad:
|
|
661
|
+
pad: chartPad
|
|
589
662
|
}));
|
|
590
|
-
}),
|
|
663
|
+
}), placeholder && (typeof placeholder === 'string' && /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
664
|
+
fill: "vertical",
|
|
665
|
+
align: "center",
|
|
666
|
+
justify: "center",
|
|
667
|
+
background: {
|
|
668
|
+
color: 'background-front',
|
|
669
|
+
opacity: 'strong'
|
|
670
|
+
},
|
|
671
|
+
margin: pad
|
|
672
|
+
}, /*#__PURE__*/_react["default"].createElement(_Text.Text, {
|
|
673
|
+
color: "text-weak"
|
|
674
|
+
}, placeholder)) || placeholder), detail && /*#__PURE__*/_react["default"].createElement(_Detail.Detail, {
|
|
591
675
|
activeProperty: activeProperty,
|
|
592
676
|
axis: axis,
|
|
593
677
|
data: data,
|
|
678
|
+
pad: pad,
|
|
594
679
|
series: series,
|
|
595
680
|
seriesStyles: seriesStyles,
|
|
596
681
|
renderValue: renderValue,
|
|
@@ -19,6 +19,8 @@ var _Text = require("../Text");
|
|
|
19
19
|
|
|
20
20
|
var _utils = require("../../utils");
|
|
21
21
|
|
|
22
|
+
var _utils2 = require("./utils");
|
|
23
|
+
|
|
22
24
|
var _Swatch = require("./Swatch");
|
|
23
25
|
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -36,6 +38,7 @@ var Detail = function Detail(_ref) {
|
|
|
36
38
|
var activeProperty = _ref.activeProperty,
|
|
37
39
|
axis = _ref.axis,
|
|
38
40
|
data = _ref.data,
|
|
41
|
+
pad = _ref.pad,
|
|
39
42
|
series = _ref.series,
|
|
40
43
|
seriesStyles = _ref.seriesStyles,
|
|
41
44
|
renderValue = _ref.renderValue,
|
|
@@ -72,6 +75,11 @@ var Detail = function Detail(_ref) {
|
|
|
72
75
|
tabIndex: 0,
|
|
73
76
|
direction: "row",
|
|
74
77
|
fill: true,
|
|
78
|
+
pad: // ensure the hit targets and center lines align with
|
|
79
|
+
// the data/guide lines
|
|
80
|
+
(pad == null ? void 0 : pad.horizontal) && _utils2.halfPad[pad.horizontal] && {
|
|
81
|
+
horizontal: _utils2.halfPad[pad.horizontal]
|
|
82
|
+
} || pad,
|
|
75
83
|
justify: "between",
|
|
76
84
|
responsive: false,
|
|
77
85
|
onFocus: function onFocus() {},
|
|
@@ -11,30 +11,36 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
13
|
|
|
14
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
15
|
+
|
|
14
16
|
var XAxis = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
+
var values = _ref.values,
|
|
18
|
+
pad = _ref.pad,
|
|
17
19
|
renderValue = _ref.renderValue,
|
|
18
20
|
serie = _ref.serie;
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
// When there are only labels at the end of the axis, let them take as much
|
|
22
|
+
// space as they like. If there are more, align their container to the
|
|
23
|
+
// data/guide lines and then let their content overflow that.
|
|
24
|
+
var itemProps = values.length === 2 ? {} : {
|
|
25
|
+
width: '1px',
|
|
26
|
+
overflow: 'visible',
|
|
27
|
+
align: 'center'
|
|
28
|
+
};
|
|
22
29
|
return /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
23
30
|
ref: ref,
|
|
24
31
|
gridArea: "xAxis",
|
|
25
32
|
direction: "row",
|
|
26
|
-
justify: "between"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
justify: "between",
|
|
34
|
+
pad: pad != null && pad.horizontal ? {
|
|
35
|
+
horizontal: pad.horizontal
|
|
36
|
+
} : undefined
|
|
37
|
+
}, values.map(function (dataIndex, i) {
|
|
30
38
|
return (
|
|
31
39
|
/*#__PURE__*/
|
|
32
40
|
// eslint-disable-next-line react/no-array-index-key
|
|
33
|
-
_react["default"].createElement(_Box.Box, {
|
|
34
|
-
key: i
|
|
35
|
-
|
|
36
|
-
align: align
|
|
37
|
-
}, serie ? renderValue(serie, dataIndex) : dataIndex)
|
|
41
|
+
_react["default"].createElement(_Box.Box, _extends({
|
|
42
|
+
key: i
|
|
43
|
+
}, itemProps), serie ? renderValue(serie, dataIndex) : dataIndex)
|
|
38
44
|
);
|
|
39
45
|
}));
|
|
40
46
|
});
|
|
@@ -18,23 +18,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
19
|
|
|
20
20
|
var YAxis = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
21
|
-
var
|
|
21
|
+
var values = _ref.values,
|
|
22
22
|
pad = _ref.pad,
|
|
23
23
|
renderValue = _ref.renderValue,
|
|
24
24
|
_ref$serie = _ref.serie,
|
|
25
25
|
serie = _ref$serie === void 0 ? {} : _ref$serie;
|
|
26
26
|
var theme = (0, _react.useContext)(_styledComponents.ThemeContext);
|
|
27
27
|
var render = serie.render,
|
|
28
|
-
suffix = serie.suffix;
|
|
29
|
-
|
|
30
|
-
var _axis = (Array.isArray(chartProps[0]) ? chartProps[0][0] : chartProps[0]).axis,
|
|
31
|
-
axisValues = _axis[1];
|
|
28
|
+
suffix = serie.suffix;
|
|
32
29
|
var divideBy;
|
|
33
30
|
var unit;
|
|
34
31
|
|
|
35
32
|
if (!render && !suffix) {
|
|
36
33
|
// figure out how many digits to show
|
|
37
|
-
var maxValue = Math.max.apply(Math,
|
|
34
|
+
var maxValue = Math.max.apply(Math, values.map(function (v) {
|
|
38
35
|
return Math.abs(v);
|
|
39
36
|
}));
|
|
40
37
|
|
|
@@ -56,7 +53,7 @@ var YAxis = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
56
53
|
gridArea: "yAxis",
|
|
57
54
|
justify: "between",
|
|
58
55
|
flex: true
|
|
59
|
-
},
|
|
56
|
+
}, values.map(function (axisValue, i) {
|
|
60
57
|
var content = renderValue(serie, undefined, axisValue);
|
|
61
58
|
|
|
62
59
|
if (content === axisValue) {
|
|
@@ -11,9 +11,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
13
|
|
|
14
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
15
|
+
|
|
14
16
|
var YGuide = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
15
17
|
var guide = _ref.guide,
|
|
16
|
-
|
|
18
|
+
padArg = _ref.pad;
|
|
19
|
+
// omit any horizontal pad so the guides cover the thickness that
|
|
20
|
+
// is within the pad
|
|
21
|
+
var pad;
|
|
22
|
+
if (typeof padArg === 'object') pad = _extends({}, padArg, {
|
|
23
|
+
start: 'none',
|
|
24
|
+
end: 'none'
|
|
25
|
+
});else if (typeof padArg === 'string') pad = {
|
|
26
|
+
vertical: padArg
|
|
27
|
+
};
|
|
17
28
|
return /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
18
29
|
ref: ref,
|
|
19
30
|
fill: true,
|
|
@@ -14,7 +14,12 @@ type ChartType =
|
|
|
14
14
|
property:
|
|
15
15
|
| string
|
|
16
16
|
| string[]
|
|
17
|
-
| {
|
|
17
|
+
| {
|
|
18
|
+
property: string;
|
|
19
|
+
color?: string;
|
|
20
|
+
opacity?: string;
|
|
21
|
+
thickness?: string;
|
|
22
|
+
}[]
|
|
18
23
|
| {
|
|
19
24
|
color?:
|
|
20
25
|
| string
|
|
@@ -33,7 +38,7 @@ type ChartType =
|
|
|
33
38
|
};
|
|
34
39
|
round?: ChartProps['round']; // defaults to undefined
|
|
35
40
|
thickness?: ChartProps['thickness']; // defaults to auto assigned based on available space and amount of data
|
|
36
|
-
type?: ChartProps['type'] | 'bars'; // defaults to 'bar',
|
|
41
|
+
type?: ChartProps['type'] | 'bars' | 'areas' | 'lines'; // defaults to 'bar',
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
type SeriesType =
|
|
@@ -66,7 +71,11 @@ export interface DataChartProps {
|
|
|
66
71
|
| string
|
|
67
72
|
| { property?: string; granularity?: GranularityType };
|
|
68
73
|
};
|
|
69
|
-
bounds?:
|
|
74
|
+
bounds?:
|
|
75
|
+
| 'align'
|
|
76
|
+
| {
|
|
77
|
+
y?: number[];
|
|
78
|
+
};
|
|
70
79
|
// chart - if undefined, { type: 'bar', property: <first series property> }
|
|
71
80
|
chart?: ChartType | ChartType[];
|
|
72
81
|
// data - an array of objects containing data values
|
|
@@ -87,9 +96,13 @@ export interface DataChartProps {
|
|
|
87
96
|
};
|
|
88
97
|
// legend - when true, { side: 'bottom' }
|
|
89
98
|
legend?: boolean | { side: 'left' | 'right' | 'bottom' };
|
|
99
|
+
// offset - whether to shift the charts to reveal them all, mostly useful
|
|
100
|
+
// for bar charts
|
|
101
|
+
offset?: boolean;
|
|
90
102
|
// pad - padding around the guides/visuals
|
|
91
103
|
// defaults to what's needed based on axis and chart types
|
|
92
104
|
pad?: GridProps['pad'];
|
|
105
|
+
placeholder?: string | React.ReactNode;
|
|
93
106
|
// series - the data item properties and any
|
|
94
107
|
series: SeriesType | SeriesType[];
|
|
95
108
|
margin?: MarginType; // generic
|
|
@@ -40,7 +40,7 @@ var chartType = _propTypes["default"].oneOfType([_propTypes["default"].string, _
|
|
|
40
40
|
point: _generalPropTypes.pointPropType,
|
|
41
41
|
round: _propTypes["default"].bool,
|
|
42
42
|
thickness: thicknessType,
|
|
43
|
-
type: _propTypes["default"].oneOf(['bar', 'bars', 'line', 'area', 'point'])
|
|
43
|
+
type: _propTypes["default"].oneOf(['bar', 'bars', 'line', 'area', 'areas', 'lines', 'point'])
|
|
44
44
|
})]);
|
|
45
45
|
|
|
46
46
|
var seriesType = _propTypes["default"].oneOfType([_propTypes["default"].string, // property
|
|
@@ -68,7 +68,9 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
68
68
|
granularity: granularityType
|
|
69
69
|
})])
|
|
70
70
|
})]),
|
|
71
|
-
bounds: _propTypes["default"].oneOf(['align']),
|
|
71
|
+
bounds: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['align']), _propTypes["default"].shape({
|
|
72
|
+
y: _propTypes["default"].arrayOf(_propTypes["default"].number)
|
|
73
|
+
})]),
|
|
72
74
|
chart: _propTypes["default"].oneOfType([chartType, _propTypes["default"].arrayOf(chartType)]),
|
|
73
75
|
data: _propTypes["default"].arrayOf(_propTypes["default"].shape({})),
|
|
74
76
|
detail: _propTypes["default"].bool,
|
|
@@ -82,7 +84,9 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
82
84
|
})])
|
|
83
85
|
})]),
|
|
84
86
|
legend: _propTypes["default"].bool,
|
|
87
|
+
offset: _propTypes["default"].bool,
|
|
85
88
|
pad: _generalPropTypes.padPropType,
|
|
89
|
+
placeholder: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]),
|
|
86
90
|
series: _propTypes["default"].oneOfType([seriesType, _propTypes["default"].arrayOf(seriesType)]),
|
|
87
91
|
size: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['fill']), _propTypes["default"].shape({
|
|
88
92
|
height: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'fill']), _propTypes["default"].string]),
|