grommet 2.18.0 → 2.19.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/all/stories/{DefaultTheme.js → CustomThemed/DefaultTheme.js} +1 -1
- package/all/stories/{typescript → CustomThemed}/ExtendTheme.tsx +4 -4
- package/components/Accordion/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/components/Anchor/index.d.ts +1 -1
- package/components/Anchor/propTypes.js +1 -1
- package/components/Anchor/stories/Weight.js +24 -0
- package/components/Box/Box.js +3 -1
- package/components/Box/StyledBox.js +15 -6
- package/components/Button/Button.js +2 -0
- package/components/Button/index.d.ts +22 -8
- package/components/Button/stories/Active.js +1 -28
- package/components/Button/stories/Basic.js +1 -3
- package/components/Button/stories/CustomThemed/Active.js +46 -0
- package/{es6/components/Button/stories/typescript → components/Button/stories/CustomThemed}/Badge.tsx +36 -38
- package/components/Button/stories/{Plain.js → CustomThemed/Plain.js} +2 -6
- package/components/Button/stories/{Custom.js → CustomThemed/ThemedButtons.js} +7 -8
- package/{es6/components/Button/stories/typescript/Custom.tsx → components/Button/stories/CustomThemed/Typescript.tsx} +13 -15
- package/components/Button/stories/Fill.js +2 -4
- package/components/Button/stories/Icon.js +4 -8
- package/components/Button/stories/IconLabel.js +2 -6
- package/components/Button/stories/Kind.js +1 -3
- package/components/Button/stories/Multiple.js +2 -6
- package/components/Button/stories/RoutedButton.js +2 -6
- package/components/Button/stories/Sizes.js +1 -5
- package/components/Button/stories/TipOnButton.js +2 -4
- package/components/Button/stories/typescript/Children.tsx +8 -12
- package/components/Calendar/Calendar.js +60 -38
- package/components/Card/Card.js +5 -0
- package/components/Card/stories/Clickable.js +13 -4
- package/components/Card/stories/{RichFooter.js → CustomThemed/RichFooter.js} +1 -1
- package/components/Carousel/Carousel.js +8 -36
- package/components/Carousel/CarouselChild.js +87 -0
- package/components/Carousel/index.d.ts +1 -1
- package/components/Carousel/propTypes.js +16 -2
- package/components/Chart/stories/Animate.js +23 -21
- package/components/Chart/stories/Dash.js +35 -33
- package/components/Chart/stories/Gradient.js +38 -36
- package/components/Chart/stories/Labelled.js +22 -20
- package/components/Chart/stories/Layout.js +43 -41
- package/components/Chart/stories/Pattern.js +25 -23
- package/components/Chart/stories/Point.js +23 -21
- package/components/Chart/stories/Range.js +23 -21
- package/components/Chart/stories/Rich.js +63 -61
- package/components/Chart/stories/Round.js +23 -21
- package/components/Chart/stories/Scan.js +114 -112
- package/components/Chart/stories/Types.js +22 -20
- package/components/Chart/stories/ValueStyle.js +18 -16
- package/components/Chart/stories/Window.js +107 -105
- package/components/Chart/stories/Zoom.js +81 -79
- package/components/CheckBox/CheckBox.js +4 -2
- package/components/CheckBox/StyledCheckBox.js +1 -1
- package/components/CheckBox/stories/Children.js +2 -6
- package/components/CheckBox/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/components/CheckBox/stories/{CustomToggle.js → CustomThemed/CustomToggle.js} +1 -1
- package/components/CheckBox/stories/Disabled.js +2 -6
- package/components/CheckBox/stories/Indeterminate.js +2 -6
- package/components/CheckBox/stories/InsideButton.js +7 -6
- package/components/CheckBox/stories/InsideFormField.js +2 -6
- package/components/CheckBox/stories/NoLabel.js +2 -6
- package/components/CheckBox/stories/Reverse.js +2 -6
- package/components/CheckBox/stories/Simple.js +2 -6
- package/components/CheckBox/stories/Toggle.js +2 -6
- package/components/CheckBox/stories/WithStickyDiv.js +2 -6
- package/components/CheckBoxGroup/index.d.ts +7 -4
- package/components/CheckBoxGroup/stories/Children.js +2 -6
- package/components/CheckBoxGroup/stories/Disabled.js +2 -6
- package/components/CheckBoxGroup/stories/FormControlled.js +2 -6
- package/components/CheckBoxGroup/stories/FormUncontrolled.js +1 -5
- package/components/CheckBoxGroup/stories/InitialValues.js +2 -6
- package/components/CheckBoxGroup/stories/ObjectOptions.js +2 -6
- package/components/CheckBoxGroup/stories/Simple.js +2 -6
- package/components/Clock/index.d.ts +1 -1
- package/components/Clock/stories/Analog.js +21 -19
- package/components/Clock/stories/Countdown.js +15 -13
- package/components/Clock/stories/{typescript → CustomThemed}/CustomAnalog.tsx +1 -1
- package/components/Clock/stories/{Digital.js → CustomThemed/Digital.js} +1 -1
- package/components/DataChart/stories/Axis.js +26 -24
- package/components/DataChart/stories/Detail.js +29 -27
- package/components/DataChart/stories/Everything.js +72 -70
- package/components/DataChart/stories/FourDimension.js +39 -37
- package/components/DataChart/stories/Guide.js +39 -36
- package/components/DataChart/stories/GuideDefault.js +15 -13
- package/components/DataChart/stories/Legend.js +35 -33
- package/components/DataChart/stories/MultipleTypes.js +57 -55
- package/components/DataChart/stories/Pattern.js +22 -20
- package/components/DataChart/stories/Prediction.js +108 -106
- package/components/DataChart/stories/Simple.js +16 -14
- package/components/DataChart/stories/StackedBars.js +39 -37
- package/components/DataChart/stories/typescript/Size.tsx +26 -26
- package/components/DataTable/Body.js +0 -1
- package/components/DataTable/DataTable.js +119 -40
- package/components/DataTable/GroupedBody.js +35 -29
- package/components/DataTable/Header.js +32 -9
- package/components/DataTable/buildState.js +30 -14
- package/components/DataTable/index.d.ts +10 -1
- package/components/DataTable/propTypes.js +5 -1
- package/components/DataTable/stories/{Custom.js → CustomThemed/Custom.js} +2 -2
- package/components/DataTable/stories/OnUpdate.js +335 -0
- package/components/DataTable/stories/SpaceX.js +296 -0
- package/components/DataTable/stories/SpaceXUngrouped.js +166 -0
- package/components/DataTable/stories/data.js +2 -1
- package/components/DateInput/DateInput.js +6 -4
- package/components/DateInput/index.d.ts +14 -1
- package/components/DateInput/stories/Form.js +2 -6
- package/components/DateInput/stories/Format.js +2 -6
- package/components/DateInput/stories/FormatInline.js +2 -6
- package/components/DateInput/stories/Inline.js +2 -6
- package/components/DateInput/stories/Range.js +2 -6
- package/components/DateInput/stories/RangeFormat.js +2 -6
- package/components/DateInput/stories/ResetDate.js +4 -8
- package/components/DateInput/stories/Simple.js +2 -6
- package/components/DateInput/stories/typescript/European.tsx +6 -9
- package/components/DateInput/utils.js +3 -2
- package/components/FileInput/FileInput.js +64 -19
- package/components/FileInput/index.d.ts +7 -0
- package/components/FileInput/propTypes.js +1 -0
- package/components/FileInput/stories/ConfirmRemove.js +80 -0
- package/components/FileInput/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/components/FileInput/stories/MaxFileCount.js +2 -7
- package/components/FileInput/stories/MaxSize.js +2 -7
- package/components/FileInput/stories/Multiple.js +2 -7
- package/components/FileInput/stories/Simple.js +2 -7
- package/components/FormField/FormField.js +8 -2
- package/components/FormField/index.d.ts +1 -1
- package/components/FormField/propTypes.js +3 -1
- package/components/Grid/index.d.ts +8 -7
- package/components/Grid/propTypes.js +1 -1
- package/components/Header/stories/Responsive.js +51 -49
- package/components/Header/stories/typescript/Ref.tsx +10 -10
- package/components/Header/stories/typescript/Simple.tsx +11 -11
- package/components/Heading/stories/All.js +20 -18
- package/components/Heading/stories/Color.js +9 -7
- package/components/Heading/stories/{CustomHeading.js → CustomThemed/CustomHeading.js} +1 -1
- package/components/Heading/stories/{Extend.js → CustomThemed/Extend.js} +1 -1
- package/components/Image/Image.js +14 -7
- package/components/InfiniteScroll/InfiniteScroll.js +1 -1
- package/components/InfiniteScroll/index.d.ts +0 -1
- package/components/InfiniteScroll/propTypes.js +0 -1
- package/components/List/List.js +0 -1
- package/components/List/stories/Action.js +2 -6
- package/components/List/stories/Basic.js +2 -6
- package/components/List/stories/Children.js +2 -4
- package/components/List/stories/{typescript/Theme.tsx → CustomThemed/ThemedList.tsx} +4 -2
- package/components/List/stories/Order.js +2 -7
- package/components/List/stories/Paginated.js +2 -7
- package/components/List/stories/RenderedList.js +2 -6
- package/components/List/stories/Selection.js +2 -6
- package/components/List/stories/Show.js +11 -8
- package/components/List/stories/onClickItem.js +2 -6
- package/components/List/stories/secondaryKey.js +2 -6
- package/components/MaskedInput/index.d.ts +2 -1
- package/components/Meter/stories/Bar.js +13 -11
- package/components/Meter/stories/Circle.js +17 -15
- package/components/Meter/stories/Labelled.js +31 -29
- package/components/Meter/stories/Pie.js +21 -19
- package/components/Meter/stories/SemiCircle.js +15 -13
- package/components/Meter/stories/VerticalBar.js +14 -12
- package/components/Meter/stories/VerticalBarMultiple.js +47 -45
- package/components/Meter/stories/typescript/MultipleValues.tsx +41 -41
- package/components/NameValueList/NameValueList.js +75 -0
- package/components/NameValueList/NameValueListContext.js +12 -0
- package/components/NameValueList/README.md +2 -0
- package/components/NameValueList/index.d.ts +24 -0
- package/components/NameValueList/index.js +8 -0
- package/components/NameValueList/propTypes.js +33 -0
- package/components/NameValueList/stories/Align.js +56 -0
- package/components/NameValueList/stories/CustomName.js +42 -0
- package/components/NameValueList/stories/CustomThemed/Themed.tsx +50 -0
- package/components/NameValueList/stories/CustomValue.js +85 -0
- package/components/NameValueList/stories/Layout.js +62 -0
- package/components/NameValueList/stories/PairProps.js +43 -0
- package/components/NameValueList/stories/Simple.js +35 -0
- package/components/NameValueList/stories/Width.js +57 -0
- package/components/NameValueList/stories/data.js +39 -0
- package/components/NameValuePair/NameValuePair.js +82 -0
- package/components/NameValuePair/README.md +2 -0
- package/components/NameValuePair/index.d.ts +11 -0
- package/components/NameValuePair/index.js +8 -0
- package/components/NameValuePair/propTypes.js +20 -0
- package/components/Notification/stories/{typescript/Themed.tsx → CustomThemed/ThemedNotification.tsx} +3 -3
- package/components/Notification/stories/Status.js +2 -6
- package/components/Notification/stories/Title.js +6 -5
- package/components/Notification/stories/TitleAndMessage.js +6 -5
- package/{es6/components/Pagination/stories/typescript → components/Pagination/stories/CustomThemed}/Custom.tsx +1 -1
- package/components/Paragraph/stories/All.js +1 -5
- package/components/Paragraph/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/components/RadioButton/stories/Children.js +2 -6
- package/components/RadioButton/stories/{Theme.js → CustomThemed/Theme.js} +1 -1
- package/components/RadioButton/stories/Disabled.js +2 -6
- package/components/RadioButton/stories/Simple.js +2 -6
- package/components/RadioButtonGroup/stories/Children.js +2 -6
- package/components/RadioButtonGroup/stories/{CustomTheme.js → CustomThemed/CustomTheme.js} +1 -1
- package/components/RadioButtonGroup/stories/Disabled.js +2 -6
- package/components/RadioButtonGroup/stories/Simple.js +2 -6
- package/components/RangeInput/RangeInput.js +85 -3
- package/components/RangeInput/StyledRangeInput.js +23 -7
- package/components/RangeInput/stories/Disabled.js +51 -0
- package/components/RangeInput/stories/TrackColor.js +1 -0
- package/components/RangeSelector/stories/Step.js +5 -0
- package/components/Select/stories/ChildrenRender.js +5 -0
- package/components/SkipLinks/stories/Simple.js +5 -0
- package/components/SkipLinks/stories/Themed.js +5 -0
- package/components/Spinner/Spinner.js +18 -11
- package/components/Spinner/stories/Animation.js +2 -5
- package/components/Spinner/stories/Announced.js +2 -7
- package/components/Spinner/stories/Border.js +2 -5
- package/components/Spinner/stories/ChildrenSpinner.js +2 -3
- package/components/Spinner/stories/Color.js +2 -5
- package/components/Spinner/stories/{typescript → CustomThemed}/ThemedIcon.tsx +1 -1
- package/{es6/components/Spinner/stories/typescript/Themed.tsx → components/Spinner/stories/CustomThemed/ThemedSpinner.tsx} +4 -2
- package/components/Spinner/stories/Modal.js +4 -3
- package/components/Spinner/stories/Round.js +2 -5
- package/components/Spinner/stories/Simple.js +2 -5
- package/components/Spinner/stories/Size.js +1 -4
- package/components/Tab/index.d.ts +2 -1
- package/components/Table/stories/{Custom.js → CustomThemed/Custom.js} +2 -2
- package/components/Table/stories/InfiniteScrollInTable.js +0 -1
- package/components/Text/Text.js +12 -12
- package/components/Text/index.d.ts +2 -1
- package/components/Text/stories/All.js +2 -6
- package/components/Text/stories/Color.js +2 -6
- package/components/Text/stories/Tip.js +2 -4
- package/components/Text/stories/WordBreak.js +1 -5
- package/components/TextArea/stories/Fill.js +5 -0
- package/components/TextInput/index.d.ts +2 -1
- package/components/Tip/Tip.js +22 -2
- package/components/Video/index.d.ts +1 -1
- package/components/Video/stories/typescript/ControlsBelow.tsx +19 -22
- package/components/Video/stories/typescript/Simple.tsx +18 -21
- package/components/WorldMap/WorldMap.js +129 -95
- package/components/WorldMap/index.d.ts +3 -0
- package/components/WorldMap/propTypes.js +2 -0
- package/components/WorldMap/stories/Color.js +2 -6
- package/components/WorldMap/stories/Continents.js +2 -6
- package/components/WorldMap/stories/Places.js +59 -20
- package/components/WorldMap/stories/SelectPlace.js +3 -6
- package/components/WorldMap/stories/Simple.js +2 -6
- package/components/index.d.ts +2 -0
- package/components/index.js +16 -0
- package/es6/all/stories/{DefaultTheme.js → CustomThemed/DefaultTheme.js} +1 -1
- package/es6/all/stories/{typescript → CustomThemed}/ExtendTheme.tsx +4 -4
- package/es6/components/Accordion/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/es6/components/Anchor/index.d.ts +1 -1
- package/es6/components/Anchor/propTypes.js +1 -1
- package/es6/components/Anchor/stories/Weight.js +24 -0
- package/es6/components/Box/Box.js +3 -1
- package/es6/components/Box/StyledBox.js +15 -6
- package/es6/components/Button/Button.js +2 -0
- package/es6/components/Button/index.d.ts +22 -8
- package/es6/components/Button/stories/Active.js +2 -28
- package/es6/components/Button/stories/Basic.js +2 -4
- package/es6/components/Button/stories/CustomThemed/Active.js +33 -0
- package/{components/Button/stories/typescript → es6/components/Button/stories/CustomThemed}/Badge.tsx +36 -38
- package/es6/components/Button/stories/{Plain.js → CustomThemed/Plain.js} +2 -5
- package/es6/components/Button/stories/{Custom.js → CustomThemed/ThemedButtons.js} +6 -7
- package/{components/Button/stories/typescript/Custom.tsx → es6/components/Button/stories/CustomThemed/Typescript.tsx} +13 -15
- package/es6/components/Button/stories/Fill.js +3 -5
- package/es6/components/Button/stories/Icon.js +5 -8
- package/es6/components/Button/stories/IconLabel.js +3 -6
- package/es6/components/Button/stories/Kind.js +2 -4
- package/es6/components/Button/stories/Multiple.js +3 -6
- package/es6/components/Button/stories/RoutedButton.js +3 -6
- package/es6/components/Button/stories/Sizes.js +2 -5
- package/es6/components/Button/stories/TipOnButton.js +3 -5
- package/es6/components/Button/stories/typescript/Children.tsx +8 -12
- package/es6/components/Calendar/Calendar.js +60 -38
- package/es6/components/Card/Card.js +5 -0
- package/es6/components/Card/stories/Clickable.js +13 -4
- package/es6/components/Card/stories/{RichFooter.js → CustomThemed/RichFooter.js} +1 -1
- package/es6/components/Carousel/Carousel.js +7 -36
- package/es6/components/Carousel/CarouselChild.js +73 -0
- package/es6/components/Carousel/index.d.ts +1 -1
- package/es6/components/Carousel/propTypes.js +14 -1
- package/es6/components/Chart/stories/Animate.js +24 -21
- package/es6/components/Chart/stories/Dash.js +36 -33
- package/es6/components/Chart/stories/Gradient.js +39 -36
- package/es6/components/Chart/stories/Labelled.js +23 -20
- package/es6/components/Chart/stories/Layout.js +44 -41
- package/es6/components/Chart/stories/Pattern.js +26 -23
- package/es6/components/Chart/stories/Point.js +24 -21
- package/es6/components/Chart/stories/Range.js +24 -21
- package/es6/components/Chart/stories/Rich.js +64 -61
- package/es6/components/Chart/stories/Round.js +24 -21
- package/es6/components/Chart/stories/Scan.js +115 -112
- package/es6/components/Chart/stories/Types.js +23 -20
- package/es6/components/Chart/stories/ValueStyle.js +19 -16
- package/es6/components/Chart/stories/Window.js +108 -105
- package/es6/components/Chart/stories/Zoom.js +82 -79
- package/es6/components/CheckBox/CheckBox.js +4 -2
- package/es6/components/CheckBox/StyledCheckBox.js +1 -1
- package/es6/components/CheckBox/stories/Children.js +3 -6
- package/es6/components/CheckBox/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/es6/components/CheckBox/stories/{CustomToggle.js → CustomThemed/CustomToggle.js} +1 -1
- package/es6/components/CheckBox/stories/Disabled.js +3 -6
- package/es6/components/CheckBox/stories/Indeterminate.js +3 -6
- package/es6/components/CheckBox/stories/InsideButton.js +8 -6
- package/es6/components/CheckBox/stories/InsideFormField.js +3 -6
- package/es6/components/CheckBox/stories/NoLabel.js +3 -6
- package/es6/components/CheckBox/stories/Reverse.js +3 -6
- package/es6/components/CheckBox/stories/Simple.js +3 -6
- package/es6/components/CheckBox/stories/Toggle.js +3 -6
- package/es6/components/CheckBox/stories/WithStickyDiv.js +3 -6
- package/es6/components/CheckBoxGroup/index.d.ts +7 -4
- package/es6/components/CheckBoxGroup/stories/Children.js +3 -6
- package/es6/components/CheckBoxGroup/stories/Disabled.js +3 -6
- package/es6/components/CheckBoxGroup/stories/FormControlled.js +3 -6
- package/es6/components/CheckBoxGroup/stories/FormUncontrolled.js +2 -5
- package/es6/components/CheckBoxGroup/stories/InitialValues.js +3 -6
- package/es6/components/CheckBoxGroup/stories/ObjectOptions.js +3 -6
- package/es6/components/CheckBoxGroup/stories/Simple.js +3 -6
- package/es6/components/Clock/index.d.ts +1 -1
- package/es6/components/Clock/stories/Analog.js +22 -19
- package/es6/components/Clock/stories/Countdown.js +16 -13
- package/es6/components/Clock/stories/{typescript → CustomThemed}/CustomAnalog.tsx +1 -1
- package/es6/components/Clock/stories/{Digital.js → CustomThemed/Digital.js} +1 -1
- package/es6/components/DataChart/stories/Axis.js +27 -24
- package/es6/components/DataChart/stories/Detail.js +30 -27
- package/es6/components/DataChart/stories/Everything.js +73 -70
- package/es6/components/DataChart/stories/FourDimension.js +40 -37
- package/es6/components/DataChart/stories/Guide.js +40 -36
- package/es6/components/DataChart/stories/GuideDefault.js +16 -13
- package/es6/components/DataChart/stories/Legend.js +36 -33
- package/es6/components/DataChart/stories/MultipleTypes.js +58 -55
- package/es6/components/DataChart/stories/Pattern.js +23 -20
- package/es6/components/DataChart/stories/Prediction.js +109 -106
- package/es6/components/DataChart/stories/Simple.js +17 -14
- package/es6/components/DataChart/stories/StackedBars.js +40 -37
- package/es6/components/DataChart/stories/typescript/Size.tsx +26 -26
- package/es6/components/DataTable/Body.js +0 -1
- package/es6/components/DataTable/DataTable.js +119 -40
- package/es6/components/DataTable/GroupedBody.js +35 -29
- package/es6/components/DataTable/Header.js +32 -9
- package/es6/components/DataTable/buildState.js +30 -14
- package/es6/components/DataTable/index.d.ts +10 -1
- package/es6/components/DataTable/propTypes.js +5 -1
- package/es6/components/DataTable/stories/{Custom.js → CustomThemed/Custom.js} +2 -2
- package/es6/components/DataTable/stories/OnUpdate.js +320 -0
- package/es6/components/DataTable/stories/SpaceX.js +279 -0
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +148 -0
- package/es6/components/DataTable/stories/data.js +1 -1
- package/es6/components/DateInput/DateInput.js +6 -4
- package/es6/components/DateInput/index.d.ts +14 -1
- package/es6/components/DateInput/stories/Form.js +3 -6
- package/es6/components/DateInput/stories/Format.js +3 -6
- package/es6/components/DateInput/stories/FormatInline.js +3 -6
- package/es6/components/DateInput/stories/Inline.js +3 -6
- package/es6/components/DateInput/stories/Range.js +3 -6
- package/es6/components/DateInput/stories/RangeFormat.js +3 -6
- package/es6/components/DateInput/stories/ResetDate.js +5 -9
- package/es6/components/DateInput/stories/Simple.js +3 -6
- package/es6/components/DateInput/stories/typescript/European.tsx +6 -9
- package/es6/components/DateInput/utils.js +3 -2
- package/es6/components/FileInput/FileInput.js +65 -20
- package/es6/components/FileInput/index.d.ts +7 -0
- package/es6/components/FileInput/propTypes.js +1 -0
- package/es6/components/FileInput/stories/ConfirmRemove.js +68 -0
- package/es6/components/FileInput/stories/{Custom.js → CustomThemed/Custom.js} +1 -1
- package/es6/components/FileInput/stories/MaxFileCount.js +3 -7
- package/es6/components/FileInput/stories/MaxSize.js +3 -7
- package/es6/components/FileInput/stories/Multiple.js +3 -7
- package/es6/components/FileInput/stories/Simple.js +3 -7
- package/es6/components/FormField/FormField.js +8 -2
- package/es6/components/FormField/index.d.ts +1 -1
- package/es6/components/FormField/propTypes.js +3 -1
- package/es6/components/Grid/index.d.ts +8 -7
- package/es6/components/Grid/propTypes.js +2 -2
- package/es6/components/Header/stories/Responsive.js +52 -49
- package/es6/components/Header/stories/typescript/Ref.tsx +10 -10
- package/es6/components/Header/stories/typescript/Simple.tsx +11 -11
- package/es6/components/Heading/stories/All.js +21 -18
- package/es6/components/Heading/stories/Color.js +10 -7
- package/es6/components/Heading/stories/{CustomHeading.js → CustomThemed/CustomHeading.js} +1 -1
- package/es6/components/Heading/stories/{Extend.js → CustomThemed/Extend.js} +1 -1
- package/es6/components/Image/Image.js +14 -7
- package/es6/components/InfiniteScroll/InfiniteScroll.js +1 -1
- package/es6/components/InfiniteScroll/index.d.ts +0 -1
- package/es6/components/InfiniteScroll/propTypes.js +0 -1
- package/es6/components/List/List.js +0 -1
- package/es6/components/List/stories/Action.js +3 -6
- package/es6/components/List/stories/Basic.js +3 -6
- package/es6/components/List/stories/Children.js +3 -5
- package/es6/components/List/stories/{typescript/Theme.tsx → CustomThemed/ThemedList.tsx} +4 -2
- package/es6/components/List/stories/Order.js +3 -7
- package/es6/components/List/stories/Paginated.js +3 -7
- package/es6/components/List/stories/RenderedList.js +3 -6
- package/es6/components/List/stories/Selection.js +3 -6
- package/es6/components/List/stories/Show.js +9 -6
- package/es6/components/List/stories/onClickItem.js +3 -6
- package/es6/components/List/stories/secondaryKey.js +3 -6
- package/es6/components/MaskedInput/index.d.ts +2 -1
- package/es6/components/Meter/stories/Bar.js +14 -11
- package/es6/components/Meter/stories/Circle.js +18 -15
- package/es6/components/Meter/stories/Labelled.js +32 -29
- package/es6/components/Meter/stories/Pie.js +22 -19
- package/es6/components/Meter/stories/SemiCircle.js +16 -13
- package/es6/components/Meter/stories/VerticalBar.js +15 -12
- package/es6/components/Meter/stories/VerticalBarMultiple.js +48 -45
- package/es6/components/Meter/stories/typescript/MultipleValues.tsx +41 -41
- package/es6/components/NameValueList/NameValueList.js +61 -0
- package/es6/components/NameValueList/NameValueListContext.js +2 -0
- package/es6/components/NameValueList/README.md +2 -0
- package/es6/components/NameValueList/index.d.ts +24 -0
- package/es6/components/NameValueList/index.js +1 -0
- package/es6/components/NameValueList/propTypes.js +23 -0
- package/es6/components/NameValueList/stories/Align.js +42 -0
- package/es6/components/NameValueList/stories/CustomName.js +28 -0
- package/es6/components/NameValueList/stories/CustomThemed/Themed.tsx +50 -0
- package/es6/components/NameValueList/stories/CustomValue.js +73 -0
- package/es6/components/NameValueList/stories/Layout.js +48 -0
- package/es6/components/NameValueList/stories/PairProps.js +29 -0
- package/es6/components/NameValueList/stories/Simple.js +21 -0
- package/es6/components/NameValueList/stories/Width.js +43 -0
- package/es6/components/NameValueList/stories/data.js +26 -0
- package/es6/components/NameValuePair/NameValuePair.js +68 -0
- package/es6/components/NameValuePair/README.md +2 -0
- package/es6/components/NameValuePair/index.d.ts +11 -0
- package/es6/components/NameValuePair/index.js +1 -0
- package/es6/components/NameValuePair/propTypes.js +11 -0
- package/es6/components/Notification/stories/{typescript/Themed.tsx → CustomThemed/ThemedNotification.tsx} +3 -3
- package/es6/components/Notification/stories/Status.js +3 -6
- package/es6/components/Notification/stories/Title.js +7 -5
- package/es6/components/Notification/stories/TitleAndMessage.js +7 -5
- package/{components/Pagination/stories/typescript → es6/components/Pagination/stories/CustomThemed}/Custom.tsx +1 -1
- package/es6/components/Paragraph/stories/All.js +2 -5
- package/es6/components/Paragraph/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/es6/components/RadioButton/stories/Children.js +3 -6
- package/es6/components/RadioButton/stories/{Theme.js → CustomThemed/Theme.js} +1 -1
- package/es6/components/RadioButton/stories/Disabled.js +3 -6
- package/es6/components/RadioButton/stories/Simple.js +3 -6
- package/es6/components/RadioButtonGroup/stories/Children.js +3 -6
- package/es6/components/RadioButtonGroup/stories/{CustomTheme.js → CustomThemed/CustomTheme.js} +1 -1
- package/es6/components/RadioButtonGroup/stories/Disabled.js +3 -6
- package/es6/components/RadioButtonGroup/stories/Simple.js +3 -6
- package/es6/components/RangeInput/RangeInput.js +85 -4
- package/es6/components/RangeInput/StyledRangeInput.js +24 -8
- package/es6/components/RangeInput/stories/Disabled.js +37 -0
- package/es6/components/RangeInput/stories/TrackColor.js +1 -0
- package/es6/components/RangeSelector/stories/Step.js +5 -0
- package/es6/components/Select/stories/ChildrenRender.js +5 -0
- package/es6/components/SkipLinks/stories/Simple.js +5 -0
- package/es6/components/SkipLinks/stories/Themed.js +5 -0
- package/es6/components/Spinner/Spinner.js +18 -11
- package/es6/components/Spinner/stories/Animation.js +3 -6
- package/es6/components/Spinner/stories/Announced.js +3 -7
- package/es6/components/Spinner/stories/Border.js +3 -6
- package/es6/components/Spinner/stories/ChildrenSpinner.js +3 -4
- package/es6/components/Spinner/stories/Color.js +3 -6
- package/es6/components/Spinner/stories/{typescript → CustomThemed}/ThemedIcon.tsx +1 -1
- package/{components/Spinner/stories/typescript/Themed.tsx → es6/components/Spinner/stories/CustomThemed/ThemedSpinner.tsx} +4 -2
- package/es6/components/Spinner/stories/Modal.js +5 -4
- package/es6/components/Spinner/stories/Round.js +3 -6
- package/es6/components/Spinner/stories/Simple.js +3 -6
- package/es6/components/Spinner/stories/Size.js +2 -5
- package/es6/components/Tab/index.d.ts +2 -1
- package/es6/components/Table/stories/{Custom.js → CustomThemed/Custom.js} +2 -2
- package/es6/components/Table/stories/InfiniteScrollInTable.js +0 -1
- package/es6/components/Text/Text.js +12 -12
- package/es6/components/Text/index.d.ts +2 -1
- package/es6/components/Text/stories/All.js +3 -6
- package/es6/components/Text/stories/Color.js +3 -6
- package/es6/components/Text/stories/Tip.js +3 -5
- package/es6/components/Text/stories/WordBreak.js +2 -5
- package/es6/components/TextArea/stories/Fill.js +5 -0
- package/es6/components/TextInput/index.d.ts +2 -1
- package/es6/components/Tip/Tip.js +23 -3
- package/es6/components/Video/index.d.ts +1 -1
- package/es6/components/Video/stories/typescript/ControlsBelow.tsx +19 -22
- package/es6/components/Video/stories/typescript/Simple.tsx +18 -21
- package/es6/components/WorldMap/WorldMap.js +127 -95
- package/es6/components/WorldMap/index.d.ts +3 -0
- package/es6/components/WorldMap/propTypes.js +2 -0
- package/es6/components/WorldMap/stories/Color.js +3 -6
- package/es6/components/WorldMap/stories/Continents.js +3 -6
- package/es6/components/WorldMap/stories/Places.js +61 -20
- package/es6/components/WorldMap/stories/SelectPlace.js +4 -6
- package/es6/components/WorldMap/stories/Simple.js +3 -6
- package/es6/components/index.d.ts +2 -0
- 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 +64 -3
- package/es6/themes/base.js +50 -1
- package/es6/utils/general-prop-types.js +1 -0
- package/es6/utils/index.d.ts +9 -0
- package/es6/utils/pagination.js +5 -2
- package/es6/utils/portal.d.ts +7 -0
- 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 +26 -25
- package/themes/base.d.ts +64 -3
- package/themes/base.js +50 -1
- package/utils/general-prop-types.js +5 -1
- package/utils/index.d.ts +9 -0
- package/utils/pagination.js +5 -2
- package/utils/portal.d.ts +7 -0
|
@@ -7,6 +7,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _styledComponents = require("styled-components");
|
|
9
9
|
|
|
10
|
+
var _Drop = require("../Drop");
|
|
11
|
+
|
|
10
12
|
var _defaultProps = require("../../default-props");
|
|
11
13
|
|
|
12
14
|
var _utils = require("../../utils");
|
|
@@ -18,7 +20,7 @@ var _propTypes = require("./propTypes");
|
|
|
18
20
|
var _excluded = ["fill", "color", "continents", "hoverColor", "onSelectPlace", "places"],
|
|
19
21
|
_excluded2 = ["location"],
|
|
20
22
|
_excluded3 = ["color", "onClick", "onHover"],
|
|
21
|
-
_excluded4 = ["color", "coords", "key", "name", "onClick", "onHover"];
|
|
23
|
+
_excluded4 = ["color", "coords", "content", "dropProps", "key", "name", "onClick", "onHover"];
|
|
22
24
|
|
|
23
25
|
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); }
|
|
24
26
|
|
|
@@ -29,10 +31,29 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
29
31
|
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; }
|
|
30
32
|
|
|
31
33
|
// The graphic is drawn as a rectangular grid using coordinates spaced
|
|
32
|
-
// by FACTOR pixels.
|
|
34
|
+
// by FACTOR pixels.
|
|
35
|
+
var FACTOR = 10; // Mapping constants between coordinates and latitude+longitude.
|
|
36
|
+
// The map coordinate space isn't precisely a mercator projection. So,
|
|
37
|
+
// we have a few adjustments that we've empirically determined. The following
|
|
38
|
+
// cities were used to make the empirical determinations:
|
|
39
|
+
// London (0 lon), Quito (0 lat), Nome (far west), Sydney (far east),
|
|
40
|
+
// Svalbard (far north), Ushuaia (far south).
|
|
41
|
+
// These map to reality, they aren't adjusted.
|
|
42
|
+
|
|
43
|
+
var EQUATOR_Y = 32;
|
|
44
|
+
var WIDTH = 93; // Scale the latitude and longitude to align better with actual locations.
|
|
45
|
+
|
|
46
|
+
var LAT_SCALE = 0.98; // adjust more extreme latitudes to fit with the map dots better
|
|
47
|
+
|
|
48
|
+
var LAT_EXTREME_SCALE = 0.91;
|
|
49
|
+
var LON_SCALE = 0.99; // We shift the map coordinates to align better with actual locations.
|
|
50
|
+
|
|
51
|
+
var X_OFFSET = -2;
|
|
52
|
+
var Y_OFFSET = -2; // The continents have both an area boundary for interaction
|
|
33
53
|
// and dots described as rows where each row is described by three values:
|
|
34
54
|
// a starting coordinate and a length. This approach is more efficient than
|
|
35
55
|
// describing it via SVG elements, keeping the code/library size smaller.
|
|
56
|
+
|
|
36
57
|
var CONTINENTS = [{
|
|
37
58
|
name: 'Australia',
|
|
38
59
|
origin: [74, 32],
|
|
@@ -44,7 +65,6 @@ var CONTINENTS = [{
|
|
|
44
65
|
area: [[16, 0], [38, 5], [40, 7], [28, 17], [24, 25], [29, 29], [19, 29], [11, 24], [3, 23], [0, 20], [0, 19], [6, 13], [7, 6]],
|
|
45
66
|
dots: [[16, 0, 1], [17, 1, 2], [18, 2, 2], [15, 3, 6], [28, 3, 1], [30, 3, 1], [10, 4, 2], [13, 4, 10], [24, 4, 1], [9, 5, 22], [32, 5, 1], [38, 5, 1], [7, 6, 2], [10, 6, 1], [12, 6, 27], [7, 7, 34], [7, 8, 31], [7, 9, 26], [34, 9, 3], [7, 10, 22], [31, 10, 1], [33, 10, 1], [7, 11, 21], [32, 11, 2], [7, 12, 21], [32, 12, 1], [6, 13, 22], [32, 13, 1], [6, 14, 22], [5, 15, 22], [3, 16, 2], [6, 16, 20], [2, 17, 3], [6, 17, 16], [24, 17, 1], [28, 17, 1], [1, 18, 22], [26, 18, 2], [0, 19, 24], [0, 20, 5], [6, 20, 17], [2, 21, 5], [10, 21, 14], [2, 22, 5], [11, 22, 4], [16, 22, 4], [3, 23, 3], [11, 23, 2], [17, 23, 3], [23, 23, 1], [11, 24, 2], [18, 24, 2], [23, 24, 1], [24, 25, 1], [18, 26, 1], [22, 26, 1], [18, 27, 1], [20, 27, 4], [18, 28, 1], [21, 28, 1], [23, 28, 1], [26, 28, 3], [19, 29, 1], [28, 29, 2]]
|
|
46
67
|
}, {
|
|
47
|
-
// 21X, 40Y
|
|
48
68
|
name: 'Africa',
|
|
49
69
|
origin: [40, 19],
|
|
50
70
|
area: [[3, 0], [6, 0], [11, 2], [16, 7], [16, 15], [11, 18], [9, 18], [0, 6], [0, 3]],
|
|
@@ -64,64 +84,49 @@ var CONTINENTS = [{
|
|
|
64
84
|
origin: [0, 0],
|
|
65
85
|
area: [[21, 0], [39, 0], [39, 6], [22, 26], [16, 23], [2, 12], [0, 7]],
|
|
66
86
|
dots: [[22, 0, 6], [29, 0, 1], [31, 0, 1], [33, 0, 5], [20, 1, 1], [22, 1, 1], [24, 1, 2], [27, 1, 13], [17, 2, 1], [20, 2, 5], [26, 2, 13], [13, 3, 1], [19, 3, 1], [21, 3, 3], [26, 3, 14], [14, 4, 1], [16, 4, 4], [21, 4, 3], [29, 4, 11], [12, 5, 3], [16, 5, 1], [18, 5, 1], [20, 5, 3], [24, 5, 1], [30, 5, 8], [14, 6, 3], [19, 6, 1], [22, 6, 4], [31, 6, 8], [0, 7, 15], [16, 7, 1], [18, 7, 4], [24, 7, 2], [30, 7, 7], [2, 8, 20], [24, 8, 3], [29, 8, 5], [2, 9, 20], [24, 9, 2], [30, 9, 3], [1, 10, 18], [23, 10, 2], [31, 10, 1], [2, 11, 2], [8, 11, 11], [23, 11, 2], [26, 11, 1], [2, 12, 1], [8, 12, 13], [24, 12, 3], [10, 13, 12], [23, 13, 5], [11, 14, 17], [11, 15, 9], [21, 15, 6], [28, 15, 2], [11, 16, 11], [23, 16, 4], [11, 17, 14], [12, 18, 11], [12, 19, 12], [13, 20, 9], [15, 21, 3], [22, 21, 1], [16, 22, 2], [16, 23, 2], [20, 23, 1], [23, 23, 1], [18, 24, 3], [21, 25, 1], [22, 26, 1]]
|
|
67
|
-
}];
|
|
87
|
+
}];
|
|
68
88
|
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return [Math.max(a[0], b[0]), Math.max(a[1], b[1])];
|
|
73
|
-
}; // const minCoordinate = (a, b) =>
|
|
74
|
-
// [Math.min(a[0], b[0]), Math.min(a[1], b[1])];
|
|
75
|
-
// Based on https://stackoverflow.com/a/43861247
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var MAP_LAT_BOTTOM = -50.0; // empirically determined
|
|
79
|
-
|
|
80
|
-
var MAP_LAT_BOTTOM_RAD = MAP_LAT_BOTTOM * Math.PI / 180;
|
|
81
|
-
var MAP_LON_LEFT = -171.0; // empirically determined
|
|
82
|
-
|
|
83
|
-
var MAP_LON_RIGHT = 184.0; // empirically determined
|
|
89
|
+
var mergeBounds = function mergeBounds(bounds1, bounds2) {
|
|
90
|
+
return [bounds1 ? Math.min(bounds1[0], bounds2[0]) : bounds2[0], bounds1 ? Math.min(bounds1[1], bounds2[1]) : bounds2[1], bounds1 ? Math.max(bounds1[2], bounds2[2]) : bounds2[2], bounds1 ? Math.max(bounds1[3], bounds2[3]) : bounds2[3]];
|
|
91
|
+
};
|
|
84
92
|
|
|
85
|
-
var
|
|
93
|
+
var midPoint = function midPoint(bounds) {
|
|
94
|
+
return [bounds[0] + (bounds[2] - bounds[0]) / 2, bounds[1] + (bounds[3] - bounds[1]) / 2];
|
|
95
|
+
}; // from https://stackoverflow.com/a/14457180/8513067
|
|
86
96
|
|
|
87
|
-
var mapValues = function mapValues(extent) {
|
|
88
|
-
var mapRadius = extent[0] / MAP_LON_DELTA * 360 / (2 * Math.PI);
|
|
89
|
-
var mapOffsetY = Math.round(mapRadius / 2 * Math.log((1 + Math.sin(MAP_LAT_BOTTOM_RAD)) / (1 - Math.sin(MAP_LAT_BOTTOM_RAD))));
|
|
90
|
-
return {
|
|
91
|
-
mapRadius: mapRadius,
|
|
92
|
-
mapOffsetY: mapOffsetY
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
97
|
|
|
96
|
-
var latLonToCoord = function latLonToCoord(
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
var latLonToCoord = function latLonToCoord(_ref) {
|
|
99
|
+
var lat = _ref[0],
|
|
100
|
+
lon = _ref[1];
|
|
101
|
+
var scaledLon = lon * LON_SCALE;
|
|
102
|
+
var x = Math.round((scaledLon + 180) * (WIDTH / 360)); // adjust more extreme latitudes to fit with the map dots better
|
|
100
103
|
|
|
101
|
-
var
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
|
|
104
|
+
var scaledLat = lat * (lat > 60 || lat < -50 ? LAT_EXTREME_SCALE : LAT_SCALE);
|
|
105
|
+
var latRad = scaledLat * Math.PI / 180;
|
|
106
|
+
var mercN = Math.log(Math.tan(Math.PI / 4 + latRad / 2));
|
|
107
|
+
var y = Math.round(EQUATOR_Y - WIDTH * mercN / (2 * Math.PI));
|
|
108
|
+
return [x + X_OFFSET, y + Y_OFFSET];
|
|
105
109
|
};
|
|
106
110
|
|
|
107
|
-
var coordToLatLon = function coordToLatLon(
|
|
108
|
-
var
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
var coordToLatLon = function coordToLatLon(_ref2) {
|
|
112
|
+
var x = _ref2[0],
|
|
113
|
+
y = _ref2[1];
|
|
114
|
+
var mercN = (EQUATOR_Y - (y - Y_OFFSET)) * (2 * Math.PI) / WIDTH;
|
|
115
|
+
var latRad = (Math.atan(Math.exp(mercN)) - Math.PI / 4) * 2;
|
|
116
|
+
var scaledLat = latRad * 180 / Math.PI / LAT_SCALE; // adjust more extreme latitudes to fit with the map dots better
|
|
111
117
|
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
var lon = coord[0] * MAP_LON_DELTA / extent[0] + MAP_LON_LEFT;
|
|
118
|
+
var lat = scaledLat / (scaledLat > 60 || scaledLat < -50 ? LAT_EXTREME_SCALE : LAT_SCALE);
|
|
119
|
+
var lon = (x - X_OFFSET) * 360 / WIDTH - 180;
|
|
115
120
|
return [lat, lon];
|
|
116
121
|
};
|
|
117
122
|
|
|
118
|
-
var buildContinent = function buildContinent(
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
name =
|
|
122
|
-
origin =
|
|
123
|
-
var
|
|
124
|
-
var
|
|
123
|
+
var buildContinent = function buildContinent(_ref3) {
|
|
124
|
+
var areaProp = _ref3.area,
|
|
125
|
+
dotsProp = _ref3.dots,
|
|
126
|
+
name = _ref3.name,
|
|
127
|
+
origin = _ref3.origin;
|
|
128
|
+
var bounds = [origin[0], origin[1], origin[0], origin[1]];
|
|
129
|
+
var dots = dotsProp.map(function (segment) {
|
|
125
130
|
var count = segment[2];
|
|
126
131
|
var spots = [];
|
|
127
132
|
|
|
@@ -132,21 +137,21 @@ var buildContinent = function buildContinent(_ref) {
|
|
|
132
137
|
var dotCommands = spots.join(' m10,0 ');
|
|
133
138
|
var x = FACTOR * (origin[0] + segment[0] + 1);
|
|
134
139
|
var y = FACTOR * (origin[1] + segment[1] + 1);
|
|
135
|
-
|
|
140
|
+
bounds = mergeBounds(bounds, [origin[0], origin[1], origin[0] + segment[0] + segment[2], origin[1] + segment[1]]);
|
|
136
141
|
return "M" + x + "," + y + " " + dotCommands;
|
|
137
142
|
}).join(' ');
|
|
138
|
-
var
|
|
143
|
+
var area = areaProp.map(function (point, index) {
|
|
139
144
|
var x = FACTOR * (point[0] + origin[0] + 1);
|
|
140
145
|
var y = FACTOR * (point[1] + origin[1] + 1);
|
|
141
146
|
return "" + (index === 0 ? 'M' : 'L') + x + "," + y;
|
|
142
147
|
}).join(' ') + " Z";
|
|
143
|
-
var mid =
|
|
148
|
+
var mid = midPoint(bounds);
|
|
144
149
|
return {
|
|
145
|
-
area:
|
|
146
|
-
dots:
|
|
150
|
+
area: area,
|
|
151
|
+
dots: dots,
|
|
147
152
|
name: name,
|
|
148
153
|
origin: origin,
|
|
149
|
-
|
|
154
|
+
bounds: bounds,
|
|
150
155
|
mid: mid
|
|
151
156
|
};
|
|
152
157
|
};
|
|
@@ -154,26 +159,24 @@ var buildContinent = function buildContinent(_ref) {
|
|
|
154
159
|
var buildWorld = function buildWorld() {
|
|
155
160
|
// Build the SVG paths describing the individual dots
|
|
156
161
|
var continents = CONTINENTS.map(buildContinent);
|
|
157
|
-
var
|
|
158
|
-
var extent = [0, 0];
|
|
162
|
+
var bounds;
|
|
159
163
|
continents.forEach(function (continent) {
|
|
160
|
-
|
|
164
|
+
bounds = mergeBounds(bounds, continent.bounds);
|
|
161
165
|
});
|
|
162
166
|
return {
|
|
163
167
|
continents: continents,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
height: (extent[1] - origin[1] + 2) * FACTOR
|
|
168
|
+
bounds: bounds,
|
|
169
|
+
x: bounds[0] * FACTOR,
|
|
170
|
+
y: bounds[1] * FACTOR,
|
|
171
|
+
width: (bounds[2] - bounds[0] + 1) * FACTOR,
|
|
172
|
+
height: (bounds[3] - bounds[1] + 2) * FACTOR
|
|
170
173
|
};
|
|
171
174
|
};
|
|
172
175
|
|
|
173
|
-
var buildInteractiveProps = function buildInteractiveProps(
|
|
174
|
-
var name =
|
|
175
|
-
onClick =
|
|
176
|
-
onHover =
|
|
176
|
+
var buildInteractiveProps = function buildInteractiveProps(_ref4, activeFunc, active) {
|
|
177
|
+
var name = _ref4.name,
|
|
178
|
+
onClick = _ref4.onClick,
|
|
179
|
+
onHover = _ref4.onHover;
|
|
177
180
|
return {
|
|
178
181
|
role: 'button',
|
|
179
182
|
'aria-label': name,
|
|
@@ -215,14 +218,14 @@ var buildInteractiveProps = function buildInteractiveProps(_ref2, activeFunc, ac
|
|
|
215
218
|
};
|
|
216
219
|
};
|
|
217
220
|
|
|
218
|
-
var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
219
|
-
var fill =
|
|
220
|
-
color =
|
|
221
|
-
continentsProp =
|
|
222
|
-
hoverColor =
|
|
223
|
-
onSelectPlace =
|
|
224
|
-
placesProp =
|
|
225
|
-
rest = _objectWithoutPropertiesLoose(
|
|
221
|
+
var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref5, ref) {
|
|
222
|
+
var fill = _ref5.fill,
|
|
223
|
+
color = _ref5.color,
|
|
224
|
+
continentsProp = _ref5.continents,
|
|
225
|
+
hoverColor = _ref5.hoverColor,
|
|
226
|
+
onSelectPlace = _ref5.onSelectPlace,
|
|
227
|
+
placesProp = _ref5.places,
|
|
228
|
+
rest = _objectWithoutPropertiesLoose(_ref5, _excluded);
|
|
226
229
|
|
|
227
230
|
var theme = _react["default"].useContext(_styledComponents.ThemeContext);
|
|
228
231
|
|
|
@@ -248,11 +251,11 @@ var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
248
251
|
|
|
249
252
|
_react["default"].useEffect(function () {
|
|
250
253
|
if (placesProp) {
|
|
251
|
-
setPlaces(placesProp.map(function (
|
|
252
|
-
var location =
|
|
253
|
-
place = _objectWithoutPropertiesLoose(
|
|
254
|
+
setPlaces(placesProp.map(function (_ref6) {
|
|
255
|
+
var location = _ref6.location,
|
|
256
|
+
place = _objectWithoutPropertiesLoose(_ref6, _excluded2);
|
|
254
257
|
|
|
255
|
-
var coords = latLonToCoord(location
|
|
258
|
+
var coords = latLonToCoord(location);
|
|
256
259
|
return _extends({
|
|
257
260
|
coords: coords,
|
|
258
261
|
key: location.join(',')
|
|
@@ -277,7 +280,24 @@ var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
277
280
|
activePlace = _React$useState6[0],
|
|
278
281
|
setActivePlace = _React$useState6[1];
|
|
279
282
|
|
|
280
|
-
var containerRef = _react["default"].useRef();
|
|
283
|
+
var containerRef = _react["default"].useRef(); // targets are used for the Drops associated with places content
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
var _React$useState7 = _react["default"].useState([]),
|
|
287
|
+
targets = _React$useState7[0],
|
|
288
|
+
setTargets = _React$useState7[1];
|
|
289
|
+
|
|
290
|
+
var placeRef = _react["default"].useCallback(function (node, index) {
|
|
291
|
+
setTargets(function (prevTargets) {
|
|
292
|
+
if (!prevTargets[index]) {
|
|
293
|
+
var nextTargets = [].concat(prevTargets);
|
|
294
|
+
nextTargets[index] = node;
|
|
295
|
+
return nextTargets;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return prevTargets;
|
|
299
|
+
});
|
|
300
|
+
}, []);
|
|
281
301
|
|
|
282
302
|
var onMouseMove = _react["default"].useCallback(function (event) {
|
|
283
303
|
// determine the map coordinates for where the mouse is
|
|
@@ -289,16 +309,16 @@ var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
289
309
|
setActiveCoords(coords);
|
|
290
310
|
}, [world.width]);
|
|
291
311
|
|
|
292
|
-
var continentElements = world.continents.map(function (
|
|
293
|
-
var area =
|
|
294
|
-
dots =
|
|
295
|
-
name =
|
|
312
|
+
var continentElements = world.continents.map(function (_ref7) {
|
|
313
|
+
var area = _ref7.area,
|
|
314
|
+
dots = _ref7.dots,
|
|
315
|
+
name = _ref7.name;
|
|
296
316
|
|
|
297
|
-
var
|
|
298
|
-
continentColor =
|
|
299
|
-
onClick =
|
|
300
|
-
onHover =
|
|
301
|
-
restContinents = _objectWithoutPropertiesLoose(
|
|
317
|
+
var _ref8 = continents[name] || {},
|
|
318
|
+
continentColor = _ref8.color,
|
|
319
|
+
onClick = _ref8.onClick,
|
|
320
|
+
onHover = _ref8.onHover,
|
|
321
|
+
restContinents = _objectWithoutPropertiesLoose(_ref8, _excluded3);
|
|
302
322
|
|
|
303
323
|
var active = activeContinent && activeContinent === name;
|
|
304
324
|
var interactiveProps = {};
|
|
@@ -323,9 +343,12 @@ var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
323
343
|
stroke: (0, _utils.normalizeColor)(continentColor || color || theme.worldMap.color, theme)
|
|
324
344
|
}));
|
|
325
345
|
});
|
|
326
|
-
var
|
|
346
|
+
var placesContent = [];
|
|
347
|
+
var placeElements = places.map(function (place, index) {
|
|
327
348
|
var placeColor = place.color,
|
|
328
349
|
coords = place.coords,
|
|
350
|
+
content = place.content,
|
|
351
|
+
dropProps = place.dropProps,
|
|
329
352
|
key = place.key,
|
|
330
353
|
name = place.name,
|
|
331
354
|
onClick = place.onClick,
|
|
@@ -342,8 +365,19 @@ var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
342
365
|
}, active);
|
|
343
366
|
}
|
|
344
367
|
|
|
368
|
+
if (content && targets[index]) {
|
|
369
|
+
placesContent.push( /*#__PURE__*/_react["default"].createElement(_Drop.Drop, _extends({
|
|
370
|
+
key: key || name
|
|
371
|
+
}, dropProps, {
|
|
372
|
+
target: targets[index]
|
|
373
|
+
}), content));
|
|
374
|
+
}
|
|
375
|
+
|
|
345
376
|
return /*#__PURE__*/_react["default"].createElement("path", _extends({
|
|
346
377
|
key: key,
|
|
378
|
+
ref: function ref(node) {
|
|
379
|
+
return placeRef(node, index);
|
|
380
|
+
},
|
|
347
381
|
strokeLinecap: "round",
|
|
348
382
|
strokeWidth: (0, _utils.parseMetricToNum)(theme.worldMap.place[active ? 'active' : 'base']),
|
|
349
383
|
stroke: (0, _utils.normalizeColor)(placeColor || color || theme.worldMap.color, theme)
|
|
@@ -376,7 +410,7 @@ var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
376
410
|
fill: "none",
|
|
377
411
|
fillRule: "evenodd",
|
|
378
412
|
onClick: function onClick() {
|
|
379
|
-
return onSelectPlace(coordToLatLon(activeCoords, world.
|
|
413
|
+
return onSelectPlace(coordToLatLon(activeCoords, world.bounds));
|
|
380
414
|
}
|
|
381
415
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
382
416
|
strokeLinecap: "round",
|
|
@@ -386,7 +420,7 @@ var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
386
420
|
}));
|
|
387
421
|
}
|
|
388
422
|
|
|
389
|
-
return /*#__PURE__*/_react["default"].createElement(_StyledWorldMap.StyledWorldMap, _extends({
|
|
423
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_StyledWorldMap.StyledWorldMap, _extends({
|
|
390
424
|
ref: ref,
|
|
391
425
|
viewBox: world.x + " " + world.y + " " + world.width + " " + world.height,
|
|
392
426
|
preserveAspectRatio: "xMinYMin meet",
|
|
@@ -398,7 +432,7 @@ var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
398
432
|
stroke: "none",
|
|
399
433
|
fill: "none",
|
|
400
434
|
fillRule: "evenodd"
|
|
401
|
-
}, continentElements), placeElements, active);
|
|
435
|
+
}, continentElements), placeElements, active), placesContent);
|
|
402
436
|
});
|
|
403
437
|
exports.WorldMap = WorldMap;
|
|
404
438
|
WorldMap.displayName = 'WorldMap';
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
GridAreaType,
|
|
8
8
|
MarginType,
|
|
9
9
|
} from '../../utils';
|
|
10
|
+
import { DropProps } from '../Drop';
|
|
10
11
|
|
|
11
12
|
export interface WorldMapProps {
|
|
12
13
|
a11yTitle?: A11yTitleType;
|
|
@@ -31,6 +32,8 @@ export interface WorldMapProps {
|
|
|
31
32
|
onSelectPlace?: (place: [number, number]) => void;
|
|
32
33
|
places?: {
|
|
33
34
|
color?: string | { dark?: string; light?: string };
|
|
35
|
+
content?: React.ReactNode;
|
|
36
|
+
dropProps?: DropProps;
|
|
34
37
|
name?: string;
|
|
35
38
|
location: number[];
|
|
36
39
|
onClick?: (name: string) => void;
|
|
@@ -26,6 +26,8 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
26
26
|
onSelectPlace: _propTypes["default"].func,
|
|
27
27
|
places: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
28
28
|
color: _generalPropTypes.colorPropType,
|
|
29
|
+
content: _propTypes["default"].node,
|
|
30
|
+
dropProps: _propTypes["default"].shape({}),
|
|
29
31
|
name: _propTypes["default"].string,
|
|
30
32
|
// for a11y aria-label
|
|
31
33
|
location: _propTypes["default"].arrayOf(_propTypes["default"].number).isRequired,
|
|
@@ -7,19 +7,15 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
11
|
|
|
14
12
|
var Color = function Color() {
|
|
15
|
-
return /*#__PURE__*/_react["default"].createElement(_grommet.
|
|
16
|
-
theme: _themes.grommet
|
|
17
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
13
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
18
14
|
align: "center",
|
|
19
15
|
pad: "large"
|
|
20
16
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.WorldMap, {
|
|
21
17
|
color: "graph-1"
|
|
22
|
-
}))
|
|
18
|
+
}));
|
|
23
19
|
};
|
|
24
20
|
|
|
25
21
|
exports.Color = Color;
|
|
@@ -7,8 +7,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
11
|
|
|
14
12
|
var Continents = function Continents() {
|
|
@@ -16,9 +14,7 @@ var Continents = function Continents() {
|
|
|
16
14
|
active = _React$useState[0],
|
|
17
15
|
setActive = _React$useState[1];
|
|
18
16
|
|
|
19
|
-
return /*#__PURE__*/_react["default"].createElement(_grommet.
|
|
20
|
-
theme: _themes.grommet
|
|
21
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
17
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
22
18
|
align: "center",
|
|
23
19
|
pad: "large"
|
|
24
20
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.WorldMap, {
|
|
@@ -31,7 +27,7 @@ var Continents = function Continents() {
|
|
|
31
27
|
}]
|
|
32
28
|
}), active && /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
33
29
|
margin: "large"
|
|
34
|
-
}, "Africa"))
|
|
30
|
+
}, "Africa"));
|
|
35
31
|
};
|
|
36
32
|
|
|
37
33
|
exports.Continents = Continents;
|
|
@@ -7,32 +7,71 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
11
|
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
var placeProps = function placeProps(name, color, showDrop) {
|
|
15
|
+
return _extends({
|
|
16
|
+
name: name,
|
|
17
|
+
color: color
|
|
18
|
+
}, showDrop ? {
|
|
19
|
+
content: /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
20
|
+
pad: {
|
|
21
|
+
horizontal: 'small',
|
|
22
|
+
vertical: 'xsmall'
|
|
23
|
+
}
|
|
24
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, name)),
|
|
25
|
+
dropProps: {
|
|
26
|
+
align: {
|
|
27
|
+
left: 'right'
|
|
28
|
+
},
|
|
29
|
+
background: {
|
|
30
|
+
color: color,
|
|
31
|
+
opacity: 'strong'
|
|
32
|
+
},
|
|
33
|
+
elevation: 'medium',
|
|
34
|
+
margin: {
|
|
35
|
+
left: 'small'
|
|
36
|
+
},
|
|
37
|
+
round: 'xsmall'
|
|
38
|
+
}
|
|
39
|
+
} : {});
|
|
40
|
+
};
|
|
41
|
+
|
|
14
42
|
var Places = function Places() {
|
|
15
|
-
var _React$useState = _react["default"].useState(),
|
|
16
|
-
|
|
17
|
-
|
|
43
|
+
var _React$useState = _react["default"].useState(true),
|
|
44
|
+
showDrops = _React$useState[0],
|
|
45
|
+
setShowDrops = _React$useState[1];
|
|
18
46
|
|
|
19
|
-
return /*#__PURE__*/_react["default"].createElement(_grommet.
|
|
20
|
-
theme: _themes.grommet
|
|
21
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
47
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
22
48
|
align: "center",
|
|
23
49
|
pad: "large"
|
|
24
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.CheckBox, {
|
|
51
|
+
label: "show",
|
|
52
|
+
checked: showDrops,
|
|
53
|
+
onChange: function onChange() {
|
|
54
|
+
return setShowDrops(!showDrops);
|
|
55
|
+
}
|
|
56
|
+
}), /*#__PURE__*/_react["default"].createElement(_grommet.WorldMap, {
|
|
57
|
+
places: [_extends({
|
|
58
|
+
location: [-33.8830555556, 151.216666667]
|
|
59
|
+
}, placeProps('Sydney', 'graph-1', showDrops)), _extends({
|
|
60
|
+
location: [42.358056, -71.063611]
|
|
61
|
+
}, placeProps('Boston', 'graph-2', showDrops)), _extends({
|
|
62
|
+
location: [51.507222, -0.1275]
|
|
63
|
+
}, placeProps('London', 'graph-3', showDrops)), _extends({
|
|
64
|
+
location: [-0.002222, -78.455833]
|
|
65
|
+
}, placeProps('Quito', 'graph-1', showDrops)), _extends({
|
|
66
|
+
location: [34.05, -118.25]
|
|
67
|
+
}, placeProps('Los Angeles', 'graph-2', showDrops)), _extends({
|
|
68
|
+
location: [35.689722, 139.692222]
|
|
69
|
+
}, placeProps('Tokyo', 'graph-3', showDrops)), _extends({
|
|
70
|
+
location: [78.22, 15.65]
|
|
71
|
+
}, placeProps('Svalbard', 'graph-1', showDrops)), _extends({
|
|
72
|
+
location: [-54.801944, -68.303056]
|
|
73
|
+
}, placeProps('Ushuaia', 'graph-2', showDrops))]
|
|
74
|
+
}));
|
|
36
75
|
};
|
|
37
76
|
|
|
38
77
|
exports.Places = Places;
|
|
@@ -7,8 +7,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
11
|
|
|
14
12
|
var SelectPlace = function SelectPlace() {
|
|
@@ -17,21 +15,20 @@ var SelectPlace = function SelectPlace() {
|
|
|
17
15
|
setPlaces = _React$useState[1];
|
|
18
16
|
|
|
19
17
|
var onSelectPlace = function onSelectPlace(place) {
|
|
18
|
+
console.log('Selected', place);
|
|
20
19
|
setPlaces([{
|
|
21
20
|
color: 'graph-1',
|
|
22
21
|
location: place
|
|
23
22
|
}]);
|
|
24
23
|
};
|
|
25
24
|
|
|
26
|
-
return /*#__PURE__*/_react["default"].createElement(_grommet.
|
|
27
|
-
theme: _themes.grommet
|
|
28
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
25
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
29
26
|
align: "center",
|
|
30
27
|
pad: "large"
|
|
31
28
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.WorldMap, {
|
|
32
29
|
onSelectPlace: onSelectPlace,
|
|
33
30
|
places: places
|
|
34
|
-
}))
|
|
31
|
+
}));
|
|
35
32
|
};
|
|
36
33
|
|
|
37
34
|
exports.SelectPlace = SelectPlace;
|
|
@@ -7,17 +7,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
11
|
|
|
14
12
|
var Simple = function Simple() {
|
|
15
|
-
return /*#__PURE__*/_react["default"].createElement(_grommet.
|
|
16
|
-
theme: _themes.grommet
|
|
17
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
13
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
18
14
|
align: "center",
|
|
19
15
|
pad: "large"
|
|
20
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.WorldMap, null))
|
|
16
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.WorldMap, null));
|
|
21
17
|
};
|
|
22
18
|
|
|
23
19
|
exports.Simple = Simple;
|
package/components/index.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export * from './Meter';
|
|
|
43
43
|
export * from './Pagination';
|
|
44
44
|
export * from './Paragraph';
|
|
45
45
|
export * from './Nav';
|
|
46
|
+
export * from './NameValueList';
|
|
47
|
+
export * from './NameValuePair';
|
|
46
48
|
export * from './Notification';
|
|
47
49
|
export * from './RadioButton';
|
|
48
50
|
export * from './RadioButtonGroup';
|
package/components/index.js
CHANGED
|
@@ -354,6 +354,22 @@ Object.keys(_Paragraph).forEach(function (key) {
|
|
|
354
354
|
exports[key] = _Paragraph[key];
|
|
355
355
|
});
|
|
356
356
|
|
|
357
|
+
var _NameValuePair = require("./NameValuePair");
|
|
358
|
+
|
|
359
|
+
Object.keys(_NameValuePair).forEach(function (key) {
|
|
360
|
+
if (key === "default" || key === "__esModule") return;
|
|
361
|
+
if (key in exports && exports[key] === _NameValuePair[key]) return;
|
|
362
|
+
exports[key] = _NameValuePair[key];
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
var _NameValueList = require("./NameValueList");
|
|
366
|
+
|
|
367
|
+
Object.keys(_NameValueList).forEach(function (key) {
|
|
368
|
+
if (key === "default" || key === "__esModule") return;
|
|
369
|
+
if (key in exports && exports[key] === _NameValueList[key]) return;
|
|
370
|
+
exports[key] = _NameValueList[key];
|
|
371
|
+
});
|
|
372
|
+
|
|
357
373
|
var _Nav = require("./Nav");
|
|
358
374
|
|
|
359
375
|
Object.keys(_Nav).forEach(function (key) {
|