@sproutsocial/racine 12.20.0 → 12.21.1
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/CHANGELOG.md +26 -0
- package/README.md +46 -44
- package/__flow__/Avatar/index.js +26 -26
- package/__flow__/Avatar/index.stories.js +8 -8
- package/__flow__/Avatar/index.test.js +13 -13
- package/__flow__/Badge/constants.js +14 -14
- package/__flow__/Badge/index.js +18 -18
- package/__flow__/Badge/index.stories.js +8 -8
- package/__flow__/Badge/index.test.js +43 -43
- package/__flow__/Badge/styles.js +13 -9
- package/__flow__/Banner/index.js +21 -21
- package/__flow__/Banner/index.stories.js +56 -68
- package/__flow__/Banner/index.test.js +32 -34
- package/__flow__/Banner/styles.js +4 -4
- package/__flow__/Box/index.js +4 -4
- package/__flow__/Box/index.stories.js +58 -51
- package/__flow__/Box/index.test.js +7 -7
- package/__flow__/Box/styles.js +6 -6
- package/__flow__/Breadcrumb/index.js +9 -13
- package/__flow__/Breadcrumb/index.stories.js +14 -14
- package/__flow__/Breadcrumb/index.test.js +20 -20
- package/__flow__/Breadcrumb/styles.js +5 -5
- package/__flow__/Button/index.js +23 -23
- package/__flow__/Button/index.stories.js +34 -34
- package/__flow__/Button/styles.js +11 -11
- package/__flow__/Card/index.js +7 -7
- package/__flow__/Card/index.stories.js +14 -14
- package/__flow__/Card/styles.js +7 -7
- package/__flow__/CharacterCounter/index.js +7 -7
- package/__flow__/CharacterCounter/index.stories.js +25 -26
- package/__flow__/CharacterCounter/index.test.js +11 -11
- package/__flow__/CharacterCounter/styles.js +3 -3
- package/__flow__/ChartLegend/index.js +7 -7
- package/__flow__/ChartLegend/index.stories.js +22 -22
- package/__flow__/ChartLegend/index.test.js +27 -27
- package/__flow__/ChartLegend/styles.js +7 -7
- package/__flow__/Checkbox/index.js +10 -10
- package/__flow__/Checkbox/index.stories.js +24 -24
- package/__flow__/Checkbox/index.test.js +25 -25
- package/__flow__/Checkbox/styles.js +27 -28
- package/__flow__/Collapsible/index.js +15 -15
- package/__flow__/Collapsible/index.stories.js +13 -13
- package/__flow__/Collapsible/index.test.js +27 -27
- package/__flow__/Collapsible/styles.js +5 -5
- package/__flow__/DatePicker/DateRangePicker.js +5 -8
- package/__flow__/DatePicker/DateRangePicker.stories.js +19 -19
- package/__flow__/DatePicker/DateRangePicker.test.js +21 -21
- package/__flow__/DatePicker/SingleDatePicker.js +6 -9
- package/__flow__/DatePicker/SingleDatePicker.stories.js +10 -10
- package/__flow__/DatePicker/SingleDatePicker.test.js +21 -23
- package/__flow__/DatePicker/StatefulDateRangePicker.js +6 -6
- package/__flow__/DatePicker/StatefulSingleDatePicker.js +3 -3
- package/__flow__/DatePicker/common.js +13 -13
- package/__flow__/DatePicker/index.js +3 -3
- package/__flow__/DatePicker/styles.js +42 -42
- package/__flow__/Drawer/SlideTransition.js +10 -10
- package/__flow__/Drawer/index.js +29 -29
- package/__flow__/Drawer/index.stories.js +58 -141
- package/__flow__/Drawer/index.test.js +28 -28
- package/__flow__/Drawer/styles.js +4 -4
- package/__flow__/EmptyState/index.js +5 -5
- package/__flow__/EmptyState/index.stories.js +10 -10
- package/__flow__/EmptyState/index.test.js +27 -27
- package/__flow__/EnumIllustrationNames.js +1 -1
- package/__flow__/Fieldset/index.js +14 -14
- package/__flow__/Fieldset/index.stories.js +19 -20
- package/__flow__/Fieldset/index.test.js +14 -14
- package/__flow__/Fieldset/styles.js +5 -5
- package/__flow__/FormField/index.js +14 -14
- package/__flow__/FormField/index.stories.js +31 -21
- package/__flow__/FormField/index.test.js +19 -19
- package/__flow__/Icon/deprecatedIcons.js +36 -36
- package/__flow__/Icon/index.js +17 -17
- package/__flow__/Icon/index.stories.js +30 -30
- package/__flow__/Icon/index.test.js +15 -15
- package/__flow__/Icon/styles.js +12 -12
- package/__flow__/IllustrationViewBoxes.js +1 -1
- package/__flow__/Image/index.js +6 -7
- package/__flow__/Image/index.stories.js +5 -5
- package/__flow__/Image/index.test.js +24 -24
- package/__flow__/Image/styles.js +6 -5
- package/__flow__/Indicator/index.js +7 -7
- package/__flow__/Indicator/index.stories.js +8 -14
- package/__flow__/Indicator/index.test.js +6 -6
- package/__flow__/Indicator/styles.js +6 -6
- package/__flow__/Input/index.js +37 -37
- package/__flow__/Input/index.stories.js +96 -189
- package/__flow__/Input/index.test.js +117 -117
- package/__flow__/Input/styles.js +13 -13
- package/__flow__/KeyboardKey/index.js +5 -5
- package/__flow__/KeyboardKey/index.stories.js +9 -12
- package/__flow__/KeyboardKey/index.test.js +7 -7
- package/__flow__/KeyboardKey/styles.js +4 -4
- package/__flow__/Label/index.js +6 -6
- package/__flow__/Label/index.stories.js +5 -7
- package/__flow__/Label/index.test.js +8 -8
- package/__flow__/Link/constants.js +4 -4
- package/__flow__/Link/index.js +11 -11
- package/__flow__/Link/index.stories.js +61 -102
- package/__flow__/Link/index.test.js +40 -40
- package/__flow__/Link/styles.js +6 -6
- package/__flow__/Listbox/index.js +16 -16
- package/__flow__/Listbox/index.stories.js +35 -35
- package/__flow__/Listbox/index.test.js +63 -65
- package/__flow__/Loader/index.js +12 -12
- package/__flow__/Loader/index.stories.js +10 -10
- package/__flow__/Loader/index.test.js +17 -17
- package/__flow__/Loader/styles.js +9 -13
- package/__flow__/LoaderButton/index.js +25 -25
- package/__flow__/LoaderButton/index.stories.js +7 -7
- package/__flow__/LoaderButton/index.test.js +15 -15
- package/__flow__/Menu/constants.js +8 -8
- package/__flow__/Menu/descendants.js +89 -80
- package/__flow__/Menu/hooks.js +22 -22
- package/__flow__/Menu/index.flow.js +13 -13
- package/__flow__/Menu/index.js +56 -60
- package/__flow__/Menu/index.stories.js +19 -19
- package/__flow__/Menu/index.test.js +22 -22
- package/__flow__/Menu/names.js +4945 -4945
- package/__flow__/Menu/styles.js +5 -5
- package/__flow__/Message/index.js +33 -33
- package/__flow__/Message/index.stories.js +18 -13
- package/__flow__/Message/index.test.js +6 -6
- package/__flow__/Message/styles.js +15 -15
- package/__flow__/Modal/index.js +19 -19
- package/__flow__/Modal/index.stories.js +43 -43
- package/__flow__/Modal/index.test.js +29 -29
- package/__flow__/Modal/styles.js +27 -32
- package/__flow__/Numeral/index.js +22 -22
- package/__flow__/Numeral/index.stories.js +74 -74
- package/__flow__/Numeral/styles.js +3 -3
- package/__flow__/Numeral/tests/A11y.test.js +7 -7
- package/__flow__/Numeral/tests/abbreviate.test.js +40 -40
- package/__flow__/Numeral/tests/currency.test.js +24 -24
- package/__flow__/Numeral/tests/defaults.test.js +20 -20
- package/__flow__/Numeral/tests/invalid.test.js +9 -9
- package/__flow__/Numeral/tests/locale.test.js +38 -38
- package/__flow__/Numeral/tests/precision.test.js +76 -76
- package/__flow__/Numeral/tests/testNumeral.js +11 -11
- package/__flow__/Numeral/tests/zero.test.js +8 -8
- package/__flow__/OverflowList/index.flow.js +2 -2
- package/__flow__/OverflowList/index.js +12 -12
- package/__flow__/OverflowList/index.stories.js +10 -10
- package/__flow__/OverflowList/index.test.js +25 -25
- package/__flow__/OverflowList/styles.js +5 -5
- package/__flow__/PartnerLogo/TypePartnerNames.js +37 -37
- package/__flow__/PartnerLogo/index.js +20 -20
- package/__flow__/PartnerLogo/index.stories.js +52 -52
- package/__flow__/PartnerLogo/styles.js +12 -12
- package/__flow__/Popout/index.js +66 -67
- package/__flow__/Popout/index.stories.js +101 -82
- package/__flow__/Popout/index.test.js +43 -43
- package/__flow__/Popout/styles.js +4 -5
- package/__flow__/Portal/index.js +9 -9
- package/__flow__/Portal/index.stories.js +12 -12
- package/__flow__/Radio/index.js +4 -4
- package/__flow__/Radio/index.stories.js +11 -11
- package/__flow__/Radio/index.test.js +12 -12
- package/__flow__/Radio/styles.js +15 -16
- package/__flow__/SegmentedControl/index.js +7 -7
- package/__flow__/SegmentedControl/index.stories.js +7 -7
- package/__flow__/SegmentedControl/index.test.js +29 -29
- package/__flow__/SegmentedControl/styles.js +10 -9
- package/__flow__/Select/index.js +10 -10
- package/__flow__/Select/index.stories.js +33 -69
- package/__flow__/Select/index.test.js +14 -14
- package/__flow__/Select/styles.js +16 -16
- package/__flow__/Skeleton/index.js +4 -4
- package/__flow__/Skeleton/index.stories.js +5 -5
- package/__flow__/SpotIllustration/illustrationNames.js +118 -117
- package/__flow__/SpotIllustration/index.js +15 -11
- package/__flow__/SpotIllustration/index.stories.js +18 -18
- package/__flow__/SpotIllustration/spotIllustrations/molecule.svg +14 -0
- package/__flow__/Stack/index.js +43 -33
- package/__flow__/Stack/index.stories.js +41 -91
- package/__flow__/Stack/index.test.js +16 -7
- package/__flow__/Switch/index.js +8 -8
- package/__flow__/Switch/index.stories.js +5 -5
- package/__flow__/Switch/index.test.js +25 -29
- package/__flow__/Switch/styles.js +13 -9
- package/__flow__/Table/index.js +17 -17
- package/__flow__/Table/index.stories.js +99 -99
- package/__flow__/Table/index.test.js +32 -32
- package/__flow__/Table/styles.js +4 -4
- package/__flow__/TableCell/index.js +8 -7
- package/__flow__/TableCell/index.stories.js +20 -23
- package/__flow__/TableCell/index.test.js +11 -11
- package/__flow__/TableCell/styles.js +4 -5
- package/__flow__/TableHeaderCell/index.js +14 -14
- package/__flow__/TableHeaderCell/index.stories.js +35 -30
- package/__flow__/TableHeaderCell/index.test.js +11 -11
- package/__flow__/TableHeaderCell/styles.js +4 -4
- package/__flow__/TableRowAccordion/index.js +8 -8
- package/__flow__/TableRowAccordion/index.stories.js +36 -36
- package/__flow__/TableRowAccordion/index.test.js +28 -30
- package/__flow__/TableRowAccordion/styles.js +11 -7
- package/__flow__/Tabs/index.js +11 -11
- package/__flow__/Tabs/index.stories.js +28 -54
- package/__flow__/Tabs/index.test.js +54 -54
- package/__flow__/Tabs/styles.js +6 -7
- package/__flow__/Text/index.js +14 -14
- package/__flow__/Text/index.stories.js +84 -86
- package/__flow__/Text/index.test.js +29 -33
- package/__flow__/Text/styles.js +4 -4
- package/__flow__/Textarea/index.js +5 -5
- package/__flow__/Textarea/index.stories.js +54 -93
- package/__flow__/Textarea/index.test.js +30 -30
- package/__flow__/Textarea/styles.js +6 -6
- package/__flow__/ThemeProvider/index.js +4 -4
- package/__flow__/Toast/index.js +23 -23
- package/__flow__/Toast/index.stories.js +21 -21
- package/__flow__/Toast/styles.js +6 -6
- package/__flow__/ToggleHint/index.js +8 -8
- package/__flow__/ToggleHint/index.test.js +8 -8
- package/__flow__/ToggleHint/styles.js +8 -8
- package/__flow__/Token/index.js +10 -10
- package/__flow__/Token/index.stories.js +49 -54
- package/__flow__/Token/index.test.js +28 -28
- package/__flow__/Token/styles.js +11 -11
- package/__flow__/TokenInput/index.flow.js +1 -1
- package/__flow__/TokenInput/index.js +39 -39
- package/__flow__/TokenInput/index.stories.js +121 -128
- package/__flow__/TokenInput/styles.js +5 -5
- package/__flow__/TokenInput/tests/default/clicking.test.js +13 -13
- package/__flow__/TokenInput/tests/default/deleting.test.js +39 -39
- package/__flow__/TokenInput/tests/default/focusing.test.js +18 -18
- package/__flow__/TokenInput/tests/default/inputting.test.js +23 -23
- package/__flow__/TokenInput/tests/default/pasting.test.js +52 -52
- package/__flow__/TokenInput/tests/default/rendering.test.js +54 -54
- package/__flow__/TokenInput/util.js +4 -4
- package/__flow__/Tooltip/index.js +21 -21
- package/__flow__/Tooltip/index.stories.js +18 -18
- package/__flow__/Tooltip/index.test.js +54 -54
- package/__flow__/Tooltip/styles.js +4 -5
- package/__flow__/VisuallyHidden/index.js +3 -3
- package/__flow__/building-stories.stories.mdx +121 -0
- package/__flow__/dataviz/dataviz.stories.js +4 -4
- package/__flow__/dataviz/index.js +3 -3
- package/__flow__/index.js +72 -72
- package/__flow__/overview.stories.js +60 -0
- package/__flow__/setupTests.js +5 -5
- package/__flow__/systemProps/background.js +3 -3
- package/__flow__/systemProps/border.js +3 -3
- package/__flow__/systemProps/color.js +3 -3
- package/__flow__/systemProps/custom.js +3 -3
- package/__flow__/systemProps/flexbox.js +3 -3
- package/__flow__/systemProps/grid.js +3 -3
- package/__flow__/systemProps/index.js +14 -14
- package/__flow__/systemProps/layout.js +3 -3
- package/__flow__/systemProps/position.js +3 -3
- package/__flow__/systemProps/shadow.js +3 -3
- package/__flow__/systemProps/space.js +3 -7
- package/__flow__/systemProps/systemProps.js +14 -14
- package/__flow__/systemProps/tests/background.test.js +17 -17
- package/__flow__/systemProps/tests/border.test.js +61 -61
- package/__flow__/systemProps/tests/color.test.js +15 -15
- package/__flow__/systemProps/tests/custom.test.js +12 -12
- package/__flow__/systemProps/tests/flexbox.test.js +33 -33
- package/__flow__/systemProps/tests/grid.test.js +31 -31
- package/__flow__/systemProps/tests/layout.test.js +29 -29
- package/__flow__/systemProps/tests/position.test.js +19 -19
- package/__flow__/systemProps/tests/shadow.test.js +11 -11
- package/__flow__/systemProps/tests/space.test.js +11 -11
- package/__flow__/systemProps/tests/types.flow.js +18 -18
- package/__flow__/systemProps/tests/typography.test.js +21 -21
- package/__flow__/systemProps/tests/variant.test.js +9 -9
- package/__flow__/systemProps/types.flow.js +2 -2
- package/__flow__/systemProps/typography.js +4 -4
- package/__flow__/systemProps/variant.js +5 -5
- package/__flow__/themes/dark/dataviz-palette.js +21 -21
- package/__flow__/themes/dark/decorative-palettes.js +1 -1
- package/__flow__/themes/dark/theme.js +16 -16
- package/__flow__/themes/extendedThemes/README.md +1 -1
- package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +4 -4
- package/__flow__/themes/extendedThemes/sproutTheme/index.js +2 -2
- package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +4 -4
- package/__flow__/themes/light/dataviz-palette.js +21 -21
- package/__flow__/themes/light/decorative-palettes.js +1 -1
- package/__flow__/themes/light/literal-colors.js +133 -133
- package/__flow__/themes/light/theme.js +51 -51
- package/__flow__/types/system-props.flow.js +5 -5
- package/__flow__/types/theme.colors.flow.js +2 -2
- package/__flow__/types/theme.flow.js +5 -5
- package/__flow__/utils/a11yTest.js +1 -1
- package/__flow__/utils/chartColors.js +1 -1
- package/__flow__/utils/constants.js +1 -1
- package/__flow__/utils/dataQaLabelQueries.js +2 -2
- package/__flow__/utils/hooks.js +17 -17
- package/__flow__/utils/index.js +4 -4
- package/__flow__/utils/innerText.js +9 -9
- package/__flow__/utils/mixins.js +6 -6
- package/__flow__/utils/react-testing-library.js +6 -6
- package/__flow__/utils/responsiveProps/index.js +3 -3
- package/__flow__/utils/responsiveProps/index.test.js +8 -8
- package/__flow__/utils/system-props.js +3 -3
- package/__flow__/utils/useInteractiveColor.js +5 -5
- package/__flow__/writing-good-stories.stories.mdx +3 -0
- package/bin/racine-codemod.js +12 -12
- package/codemods/__tests__/migrate-2.x-to-3.x.test.js +2 -2
- package/codemods/migrate-2.x-to-3.x.js +29 -30
- package/commonjs/Avatar/index.js +33 -53
- package/commonjs/Badge/constants.js +18 -15
- package/commonjs/Badge/index.js +14 -28
- package/commonjs/Badge/styles.js +3 -9
- package/commonjs/Banner/index.js +16 -37
- package/commonjs/Banner/styles.js +0 -5
- package/commonjs/Box/index.js +2 -9
- package/commonjs/Box/styles.js +0 -4
- package/commonjs/Breadcrumb/index.js +13 -29
- package/commonjs/Breadcrumb/styles.js +1 -4
- package/commonjs/Button/index.js +29 -43
- package/commonjs/Button/styles.js +6 -15
- package/commonjs/Card/index.js +16 -26
- package/commonjs/Card/styles.js +1 -5
- package/commonjs/CharacterCounter/index.js +6 -23
- package/commonjs/CharacterCounter/styles.js +0 -5
- package/commonjs/ChartLegend/index.js +5 -20
- package/commonjs/ChartLegend/styles.js +2 -11
- package/commonjs/Checkbox/index.js +30 -53
- package/commonjs/Checkbox/styles.js +14 -35
- package/commonjs/Collapsible/index.js +31 -54
- package/commonjs/Collapsible/styles.js +3 -6
- package/commonjs/DatePicker/DateRangePicker.js +4 -17
- package/commonjs/DatePicker/SingleDatePicker.js +3 -17
- package/commonjs/DatePicker/StatefulDateRangePicker.js +16 -31
- package/commonjs/DatePicker/StatefulSingleDatePicker.js +7 -20
- package/commonjs/DatePicker/common.js +8 -22
- package/commonjs/DatePicker/index.js +0 -5
- package/commonjs/DatePicker/styles.js +8 -25
- package/commonjs/Drawer/SlideTransition.js +8 -18
- package/commonjs/Drawer/index.js +51 -90
- package/commonjs/Drawer/styles.js +0 -8
- package/commonjs/EmptyState/index.js +8 -20
- package/commonjs/Fieldset/index.js +15 -32
- package/commonjs/Fieldset/styles.js +2 -7
- package/commonjs/FormField/index.js +19 -36
- package/commonjs/Icon/deprecatedIcons.js +36 -36
- package/commonjs/Icon/index.js +19 -37
- package/commonjs/Icon/styles.js +7 -16
- package/commonjs/IllustrationViewBoxes.js +1 -0
- package/commonjs/Image/index.js +13 -41
- package/commonjs/Image/styles.js +1 -7
- package/commonjs/Indicator/index.js +8 -26
- package/commonjs/Indicator/styles.js +1 -7
- package/commonjs/Input/index.js +80 -119
- package/commonjs/Input/styles.js +9 -19
- package/commonjs/KeyboardKey/index.js +3 -20
- package/commonjs/KeyboardKey/styles.js +0 -4
- package/commonjs/Label/index.js +7 -27
- package/commonjs/Link/constants.js +3 -4
- package/commonjs/Link/index.js +16 -28
- package/commonjs/Link/styles.js +1 -8
- package/commonjs/Listbox/index.js +15 -36
- package/commonjs/Loader/index.js +15 -31
- package/commonjs/Loader/styles.js +2 -13
- package/commonjs/LoaderButton/index.js +26 -55
- package/commonjs/Menu/constants.js +9 -8
- package/commonjs/Menu/descendants.js +70 -105
- package/commonjs/Menu/hooks.js +23 -41
- package/commonjs/Menu/index.flow.js +0 -7
- package/commonjs/Menu/index.js +94 -164
- package/commonjs/Menu/names.js +1 -1
- package/commonjs/Menu/styles.js +0 -6
- package/commonjs/Message/index.js +37 -70
- package/commonjs/Message/styles.js +9 -24
- package/commonjs/Modal/index.js +31 -54
- package/commonjs/Modal/styles.js +17 -36
- package/commonjs/Numeral/index.js +39 -67
- package/commonjs/Numeral/styles.js +0 -3
- package/commonjs/Numeral/tests/testNumeral.js +13 -31
- package/commonjs/OverflowList/index.flow.js +0 -2
- package/commonjs/OverflowList/index.js +27 -41
- package/commonjs/OverflowList/styles.js +0 -7
- package/commonjs/PartnerLogo/index.js +19 -33
- package/commonjs/PartnerLogo/styles.js +7 -15
- package/commonjs/Popout/index.js +95 -127
- package/commonjs/Popout/styles.js +0 -5
- package/commonjs/Portal/index.js +8 -31
- package/commonjs/Radio/index.js +18 -42
- package/commonjs/Radio/styles.js +9 -21
- package/commonjs/SegmentedControl/index.js +17 -37
- package/commonjs/SegmentedControl/styles.js +2 -12
- package/commonjs/Select/index.js +24 -47
- package/commonjs/Select/styles.js +12 -24
- package/commonjs/Skeleton/index.js +0 -5
- package/commonjs/SpotIllustration/illustrationNames.js +1 -1
- package/commonjs/SpotIllustration/index.js +5 -11
- package/commonjs/Stack/index.js +27 -42
- package/commonjs/Switch/index.js +17 -42
- package/commonjs/Switch/styles.js +3 -11
- package/commonjs/Table/index.js +26 -50
- package/commonjs/Table/styles.js +0 -4
- package/commonjs/TableCell/index.js +12 -30
- package/commonjs/TableCell/styles.js +0 -5
- package/commonjs/TableHeaderCell/index.js +27 -56
- package/commonjs/TableHeaderCell/styles.js +0 -6
- package/commonjs/TableRowAccordion/index.js +12 -37
- package/commonjs/TableRowAccordion/styles.js +2 -9
- package/commonjs/Tabs/index.js +16 -66
- package/commonjs/Tabs/styles.js +2 -11
- package/commonjs/Text/index.js +12 -25
- package/commonjs/Text/styles.js +1 -6
- package/commonjs/Textarea/index.js +31 -55
- package/commonjs/Textarea/styles.js +2 -9
- package/commonjs/ThemeProvider/index.js +1 -10
- package/commonjs/Toast/index.js +19 -42
- package/commonjs/Toast/styles.js +1 -7
- package/commonjs/ToggleHint/index.js +15 -39
- package/commonjs/ToggleHint/styles.js +2 -9
- package/commonjs/Token/index.js +15 -29
- package/commonjs/Token/styles.js +5 -12
- package/commonjs/TokenInput/index.js +70 -122
- package/commonjs/TokenInput/styles.js +1 -7
- package/commonjs/TokenInput/util.js +2 -7
- package/commonjs/Tooltip/index.js +40 -63
- package/commonjs/Tooltip/styles.js +1 -5
- package/commonjs/VisuallyHidden/index.js +0 -4
- package/commonjs/dataviz/index.js +0 -4
- package/commonjs/index.js +0 -129
- package/commonjs/systemProps/background.js +0 -1
- package/commonjs/systemProps/border.js +0 -1
- package/commonjs/systemProps/color.js +0 -1
- package/commonjs/systemProps/custom.js +0 -1
- package/commonjs/systemProps/flexbox.js +0 -1
- package/commonjs/systemProps/grid.js +0 -1
- package/commonjs/systemProps/index.js +0 -28
- package/commonjs/systemProps/layout.js +0 -1
- package/commonjs/systemProps/position.js +0 -1
- package/commonjs/systemProps/shadow.js +0 -1
- package/commonjs/systemProps/space.js +1 -2
- package/commonjs/systemProps/systemProps.js +0 -13
- package/commonjs/systemProps/tests/types.flow.js +25 -22
- package/commonjs/systemProps/typography.js +0 -1
- package/commonjs/systemProps/variant.js +2 -3
- package/commonjs/themes/dark/dataviz-palette.js +20 -22
- package/commonjs/themes/dark/decorative-palettes.js +0 -2
- package/commonjs/themes/dark/theme.js +13 -27
- package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +2 -9
- package/commonjs/themes/extendedThemes/sproutTheme/index.js +0 -5
- package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +2 -9
- package/commonjs/themes/light/dataviz-palette.js +20 -22
- package/commonjs/themes/light/decorative-palettes.js +0 -2
- package/commonjs/themes/light/literal-colors.js +132 -134
- package/commonjs/themes/light/theme.js +43 -59
- package/commonjs/types/system-props.flow.js +1 -1
- package/commonjs/types/theme.colors.flow.js +0 -2
- package/commonjs/types/theme.flow.js +0 -1
- package/commonjs/utils/a11yTest.js +3 -10
- package/commonjs/utils/chartColors.js +0 -1
- package/commonjs/utils/constants.js +1 -1
- package/commonjs/utils/dataQaLabelQueries.js +12 -21
- package/commonjs/utils/hooks.js +39 -70
- package/commonjs/utils/index.js +2 -9
- package/commonjs/utils/innerText.js +10 -14
- package/commonjs/utils/mixins.js +2 -7
- package/commonjs/utils/react-testing-library.js +4 -26
- package/commonjs/utils/responsiveProps/index.js +1 -11
- package/commonjs/utils/system-props.js +2 -5
- package/commonjs/utils/useInteractiveColor.js +6 -8
- package/dist/illustration.svg +1 -1
- package/dist/illustrationList.js +1 -1
- package/lib/Avatar/index.js +40 -47
- package/lib/Badge/constants.js +19 -15
- package/lib/Badge/index.js +18 -25
- package/lib/Badge/styles.js +8 -6
- package/lib/Banner/index.js +20 -32
- package/lib/Banner/styles.js +3 -2
- package/lib/Box/index.js +4 -5
- package/lib/Box/styles.js +3 -2
- package/lib/Breadcrumb/index.js +19 -27
- package/lib/Breadcrumb/styles.js +3 -2
- package/lib/Button/index.js +31 -38
- package/lib/Button/styles.js +14 -11
- package/lib/Card/index.js +18 -24
- package/lib/Card/styles.js +5 -4
- package/lib/CharacterCounter/index.js +8 -20
- package/lib/CharacterCounter/styles.js +3 -2
- package/lib/ChartLegend/index.js +9 -17
- package/lib/ChartLegend/styles.js +5 -4
- package/lib/Checkbox/index.js +32 -51
- package/lib/Checkbox/styles.js +21 -26
- package/lib/Collapsible/index.js +36 -51
- package/lib/Collapsible/styles.js +6 -5
- package/lib/DatePicker/DateRangePicker.js +8 -14
- package/lib/DatePicker/SingleDatePicker.js +7 -13
- package/lib/DatePicker/StatefulDateRangePicker.js +19 -26
- package/lib/DatePicker/StatefulSingleDatePicker.js +9 -15
- package/lib/DatePicker/common.js +14 -13
- package/lib/DatePicker/index.js +2 -2
- package/lib/DatePicker/styles.js +12 -22
- package/lib/Drawer/SlideTransition.js +11 -14
- package/lib/Drawer/index.js +64 -88
- package/lib/Drawer/styles.js +4 -3
- package/lib/EmptyState/index.js +11 -17
- package/lib/Fieldset/index.js +19 -29
- package/lib/Fieldset/styles.js +5 -4
- package/lib/FormField/index.js +27 -33
- package/lib/Icon/deprecatedIcons.js +36 -36
- package/lib/Icon/index.js +25 -34
- package/lib/Icon/styles.js +11 -13
- package/lib/IllustrationViewBoxes.js +1 -0
- package/lib/Image/index.js +15 -38
- package/lib/Image/styles.js +4 -4
- package/lib/Indicator/index.js +11 -23
- package/lib/Indicator/styles.js +5 -5
- package/lib/Input/index.js +87 -115
- package/lib/Input/styles.js +13 -15
- package/lib/KeyboardKey/index.js +6 -17
- package/lib/KeyboardKey/styles.js +3 -2
- package/lib/Label/index.js +10 -24
- package/lib/Link/constants.js +5 -4
- package/lib/Link/index.js +18 -25
- package/lib/Link/styles.js +6 -5
- package/lib/Listbox/index.js +21 -29
- package/lib/Loader/index.js +17 -29
- package/lib/Loader/styles.js +6 -8
- package/lib/LoaderButton/index.js +34 -51
- package/lib/Menu/constants.js +10 -8
- package/lib/Menu/descendants.js +73 -94
- package/lib/Menu/hooks.js +28 -39
- package/lib/Menu/index.flow.js +6 -5
- package/lib/Menu/index.js +113 -150
- package/lib/Menu/names.js +1 -1
- package/lib/Menu/styles.js +4 -3
- package/lib/Message/index.js +42 -66
- package/lib/Message/styles.js +15 -23
- package/lib/Modal/index.js +38 -51
- package/lib/Modal/styles.js +23 -32
- package/lib/Numeral/index.js +45 -64
- package/lib/Numeral/styles.js +3 -2
- package/lib/Numeral/tests/testNumeral.js +17 -27
- package/lib/OverflowList/index.flow.js +2 -1
- package/lib/OverflowList/index.js +31 -38
- package/lib/OverflowList/styles.js +5 -4
- package/lib/PartnerLogo/index.js +23 -31
- package/lib/PartnerLogo/styles.js +11 -12
- package/lib/Popout/index.js +105 -121
- package/lib/Popout/styles.js +3 -3
- package/lib/Portal/index.js +11 -29
- package/lib/Radio/index.js +20 -40
- package/lib/Radio/styles.js +14 -14
- package/lib/SegmentedControl/index.js +21 -34
- package/lib/SegmentedControl/styles.js +7 -9
- package/lib/Select/index.js +27 -44
- package/lib/Select/styles.js +16 -20
- package/lib/Skeleton/index.js +7 -4
- package/lib/SpotIllustration/illustrationNames.js +2 -1
- package/lib/SpotIllustration/index.js +9 -10
- package/lib/Stack/index.js +31 -39
- package/lib/Switch/index.js +21 -39
- package/lib/Switch/styles.js +8 -7
- package/lib/Table/index.js +30 -40
- package/lib/Table/styles.js +3 -2
- package/lib/TableCell/index.js +14 -27
- package/lib/TableCell/styles.js +3 -3
- package/lib/TableHeaderCell/index.js +30 -52
- package/lib/TableHeaderCell/styles.js +3 -2
- package/lib/TableRowAccordion/index.js +16 -34
- package/lib/TableRowAccordion/styles.js +5 -3
- package/lib/Tabs/index.js +18 -63
- package/lib/Tabs/styles.js +6 -6
- package/lib/Text/index.js +15 -21
- package/lib/Text/styles.js +4 -3
- package/lib/Textarea/index.js +33 -53
- package/lib/Textarea/styles.js +6 -5
- package/lib/ThemeProvider/index.js +4 -7
- package/lib/Toast/index.js +26 -37
- package/lib/Toast/styles.js +5 -4
- package/lib/ToggleHint/index.js +18 -36
- package/lib/ToggleHint/styles.js +6 -5
- package/lib/Token/index.js +20 -26
- package/lib/Token/styles.js +10 -9
- package/lib/TokenInput/index.js +78 -118
- package/lib/TokenInput/styles.js +5 -4
- package/lib/TokenInput/util.js +5 -3
- package/lib/Tooltip/index.js +45 -60
- package/lib/Tooltip/styles.js +4 -4
- package/lib/VisuallyHidden/index.js +3 -2
- package/lib/dataviz/index.js +4 -3
- package/lib/index.js +66 -64
- package/lib/systemProps/background.js +3 -1
- package/lib/systemProps/border.js +3 -1
- package/lib/systemProps/color.js +3 -1
- package/lib/systemProps/custom.js +3 -1
- package/lib/systemProps/flexbox.js +3 -1
- package/lib/systemProps/grid.js +3 -1
- package/lib/systemProps/index.js +16 -14
- package/lib/systemProps/layout.js +3 -1
- package/lib/systemProps/position.js +3 -1
- package/lib/systemProps/shadow.js +3 -1
- package/lib/systemProps/space.js +2 -1
- package/lib/systemProps/systemProps.js +14 -13
- package/lib/systemProps/tests/types.flow.js +27 -22
- package/lib/systemProps/typography.js +3 -1
- package/lib/systemProps/variant.js +4 -3
- package/lib/themes/dark/dataviz-palette.js +23 -21
- package/lib/themes/dark/decorative-palettes.js +3 -1
- package/lib/themes/dark/theme.js +20 -23
- package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +4 -7
- package/lib/themes/extendedThemes/sproutTheme/index.js +3 -2
- package/lib/themes/extendedThemes/sproutTheme/light/theme.js +4 -7
- package/lib/themes/light/dataviz-palette.js +23 -21
- package/lib/themes/light/decorative-palettes.js +3 -1
- package/lib/themes/light/literal-colors.js +135 -133
- package/lib/themes/light/theme.js +54 -55
- package/lib/types/system-props.flow.js +1 -1
- package/lib/types/theme.colors.flow.js +4 -2
- package/lib/types/theme.flow.js +3 -2
- package/lib/utils/a11yTest.js +5 -8
- package/lib/utils/chartColors.js +3 -1
- package/lib/utils/constants.js +3 -1
- package/lib/utils/dataQaLabelQueries.js +13 -21
- package/lib/utils/hooks.js +41 -64
- package/lib/utils/index.js +2 -5
- package/lib/utils/innerText.js +12 -14
- package/lib/utils/mixins.js +6 -5
- package/lib/utils/react-testing-library.js +10 -20
- package/lib/utils/responsiveProps/index.js +3 -8
- package/lib/utils/system-props.js +4 -3
- package/lib/utils/useInteractiveColor.js +10 -9
- package/package.json +6 -13
package/lib/ToggleHint/index.js
CHANGED
|
@@ -1,72 +1,54 @@
|
|
|
1
1
|
var _excluded = ["icon", "isOpen", "openString", "closeString", "qa", "className"];
|
|
2
|
-
|
|
3
|
-
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); }
|
|
4
|
-
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
import Icon from "../Icon";
|
|
13
|
-
import Container, { IconText } from "./styles";
|
|
14
|
-
|
|
5
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import Icon from '../Icon';
|
|
8
|
+
import Container, { IconText } from './styles';
|
|
15
9
|
/**
|
|
16
10
|
* Icon (either chevron or plus/minus) indicating whether an element is open or closed.
|
|
17
|
-
*/
|
|
18
|
-
var ToggleHint = /*#__PURE__*/function (_React$Component) {
|
|
11
|
+
*/var ToggleHint = /*#__PURE__*/function (_React$Component) {
|
|
19
12
|
_inheritsLoose(ToggleHint, _React$Component);
|
|
20
|
-
|
|
21
13
|
function ToggleHint() {
|
|
22
14
|
var _this;
|
|
23
|
-
|
|
24
15
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
16
|
args[_key] = arguments[_key];
|
|
26
17
|
}
|
|
27
|
-
|
|
28
18
|
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
29
|
-
|
|
30
19
|
_this.getIcon = function () {
|
|
31
|
-
if (_this.props.icon ===
|
|
20
|
+
if (_this.props.icon === 'chevron') {
|
|
32
21
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
33
22
|
name: "chevron-down"
|
|
34
23
|
});
|
|
35
24
|
}
|
|
36
|
-
|
|
37
25
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
38
|
-
name: _this.props.isOpen ?
|
|
26
|
+
name: _this.props.isOpen ? 'minus' : 'plus'
|
|
39
27
|
});
|
|
40
28
|
};
|
|
41
|
-
|
|
42
29
|
return _this;
|
|
43
30
|
}
|
|
44
|
-
|
|
45
31
|
var _proto = ToggleHint.prototype;
|
|
46
|
-
|
|
47
32
|
_proto.render = function render() {
|
|
48
33
|
var _this$props = this.props,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
34
|
+
icon = _this$props.icon,
|
|
35
|
+
isOpen = _this$props.isOpen,
|
|
36
|
+
openString = _this$props.openString,
|
|
37
|
+
closeString = _this$props.closeString,
|
|
38
|
+
qa = _this$props.qa,
|
|
39
|
+
className = _this$props.className,
|
|
40
|
+
rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
57
41
|
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
58
42
|
icon: icon,
|
|
59
43
|
isOpen: isOpen,
|
|
60
|
-
"data-qa-togglehint-isopen": isOpen
|
|
61
|
-
|
|
44
|
+
"data-qa-togglehint-isopen": isOpen
|
|
45
|
+
// $FlowIssue - upgrade v0.112.0
|
|
62
46
|
}, qa, rest), this.getIcon(), /*#__PURE__*/React.createElement(IconText, null, isOpen ? closeString : openString));
|
|
63
47
|
};
|
|
64
|
-
|
|
65
48
|
return ToggleHint;
|
|
66
49
|
}(React.Component);
|
|
67
|
-
|
|
68
50
|
ToggleHint.defaultProps = {
|
|
69
51
|
isOpen: false,
|
|
70
|
-
icon:
|
|
52
|
+
icon: 'chevron'
|
|
71
53
|
};
|
|
72
54
|
export { ToggleHint as default };
|
package/lib/ToggleHint/styles.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { COMMON } from '../utils/system-props';
|
|
4
|
+
import { visuallyHidden } from '../utils/mixins';
|
|
4
5
|
var Container = styled.div.attrs({
|
|
5
|
-
className:
|
|
6
|
+
className: 'ToggleHint'
|
|
6
7
|
}).withConfig({
|
|
7
8
|
displayName: "styles__Container",
|
|
8
9
|
componentId: "sc-9dc46e-0"
|
|
9
10
|
})(["position:relative;display:inline-block;padding:", ";color:currentColor;", " ", ""], function (props) {
|
|
10
11
|
return props.theme.space[100];
|
|
11
12
|
}, function (props) {
|
|
12
|
-
return props.icon ===
|
|
13
|
+
return props.icon === 'chevron' && css(["transition:transform ", ";", ""], function (props) {
|
|
13
14
|
return props.theme.duration.medium + " " + props.theme.easing.ease_inout;
|
|
14
15
|
}, props.isOpen && css(["transform:rotateX(180deg);"]));
|
|
15
16
|
}, COMMON);
|
package/lib/Token/index.js
CHANGED
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
var _excluded = ["children", "closeable", "onClick", "qa", "valid", "disabled", "palette"];
|
|
2
|
-
|
|
3
|
-
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); }
|
|
4
|
-
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import Box from "../Box";
|
|
12
|
-
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useTextContent } from '../utils/hooks';
|
|
6
|
+
import Container from './styles';
|
|
7
|
+
import Icon from '../Icon';
|
|
8
|
+
import Box from '../Box';
|
|
13
9
|
var Token = function Token(_ref) {
|
|
14
10
|
var children = _ref.children,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var textContainer = useTextContent("");
|
|
11
|
+
_ref$closeable = _ref.closeable,
|
|
12
|
+
closeable = _ref$closeable === void 0 ? true : _ref$closeable,
|
|
13
|
+
onClick = _ref.onClick,
|
|
14
|
+
qa = _ref.qa,
|
|
15
|
+
_ref$valid = _ref.valid,
|
|
16
|
+
valid = _ref$valid === void 0 ? true : _ref$valid,
|
|
17
|
+
_ref$disabled = _ref.disabled,
|
|
18
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
19
|
+
_ref$palette = _ref.palette,
|
|
20
|
+
palette = _ref$palette === void 0 ? 'neutral' : _ref$palette,
|
|
21
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
22
|
+
var textContainer = useTextContent('');
|
|
28
23
|
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
29
24
|
ref: textContainer,
|
|
30
25
|
valid: valid,
|
|
31
26
|
palette: palette,
|
|
32
|
-
type: closeable || onClick ?
|
|
33
|
-
as: closeable || onClick ?
|
|
27
|
+
type: closeable || onClick ? 'button' : undefined,
|
|
28
|
+
as: closeable || onClick ? 'button' : 'div',
|
|
34
29
|
closeable: closeable || onClick,
|
|
35
30
|
disabled: disabled,
|
|
36
31
|
onClick: onClick,
|
|
@@ -48,5 +43,4 @@ var Token = function Token(_ref) {
|
|
|
48
43
|
size: "mini"
|
|
49
44
|
})) : children);
|
|
50
45
|
};
|
|
51
|
-
|
|
52
46
|
export default Token;
|
package/lib/Token/styles.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { COMMON } from '../utils/system-props';
|
|
4
|
+
import { focusRing } from '../utils/mixins';
|
|
5
|
+
import { useInteractiveColor } from '../utils/useInteractiveColor';
|
|
5
6
|
var Container = styled.button.withConfig({
|
|
6
7
|
displayName: "styles__Container",
|
|
7
8
|
componentId: "sc-nyn5zy-0"
|
|
@@ -10,19 +11,19 @@ var Container = styled.button.withConfig({
|
|
|
10
11
|
return css(["", " font-family:", ";font-weight:", ";border:1px solid ", ";border-radius:", ";color:", ";background:", ";padding:", " ", ";transition:all ", " ", ";"], theme.typography[200], theme.fontFamily, theme.fontWeights.normal, theme.colors.container.border.base, theme.radii[500], theme.colors.text.body, theme.colors.container.background.base, theme.space[200], theme.space[300], theme.duration.fast, theme.easing.ease_inout);
|
|
11
12
|
}, focusRing, function (_ref2) {
|
|
12
13
|
var closeable = _ref2.closeable,
|
|
13
|
-
|
|
14
|
+
theme = _ref2.theme;
|
|
14
15
|
return closeable && css(["cursor:pointer;&:hover,&:active{box-shadow:", ";border:1px solid ", ";}"], theme.shadows.low, useInteractiveColor(theme.colors.container.border.base));
|
|
15
16
|
}, function (_ref3) {
|
|
16
17
|
var theme = _ref3.theme,
|
|
17
|
-
|
|
18
|
-
return palette ===
|
|
18
|
+
palette = _ref3.palette;
|
|
19
|
+
return palette === 'blue' && css(["color:", ";background:", ";border:1px solid ", ";&:hover,&:active{cursor:pointer;box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.body, theme.colors.container.background.decorative.blue, theme.colors.container.border.decorative.blue, theme.shadows.low, useInteractiveColor(theme.colors.container.border.decorative.blue));
|
|
19
20
|
}, function (_ref4) {
|
|
20
21
|
var disabled = _ref4.disabled,
|
|
21
|
-
|
|
22
|
+
theme = _ref4.theme;
|
|
22
23
|
return disabled && css(["opacity:0.4;cursor:not-allowed;&:hover,&:active{box-shadow:none;border:1px solid ", ";}"], theme.colors.container.border.base);
|
|
23
24
|
}, function (_ref5) {
|
|
24
25
|
var valid = _ref5.valid,
|
|
25
|
-
|
|
26
|
+
theme = _ref5.theme;
|
|
26
27
|
return !valid && css(["color:", ";background:", ";border:1px solid ", ";&:hover{box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.error, theme.colors.container.background.error, theme.colors.container.border.error, theme.shadows.low, useInteractiveColor(theme.colors.container.border.error));
|
|
27
28
|
}, COMMON);
|
|
28
29
|
export default Container;
|
package/lib/TokenInput/index.js
CHANGED
|
@@ -1,134 +1,110 @@
|
|
|
1
1
|
var _excluded = ["autoFocus", "autocomplete", "disabled", "isInvalid", "hasWarning", "id", "name", "placeholder", "required", "value", "elemBefore", "elemAfter", "maxLength", "ariaDescribedby", "ariaLabel", "innerRef", "onAddToken", "onRemoveToken", "onChangeTokens", "onClickToken", "onBlur", "onChange", "onFocus", "onKeyDown", "onKeyUp", "onPaste", "inputProps", "qa", "tokens"];
|
|
2
|
-
|
|
3
|
-
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); }
|
|
4
|
-
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
var ControlledPropNames = ["value", "hasFocus", "activeToken"];
|
|
20
|
-
|
|
5
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
6
|
+
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import Container from './styles';
|
|
9
|
+
import { asTokenSpec, delimitersAsRegExp } from './util';
|
|
10
|
+
import { Accessory } from '../Input/styles';
|
|
11
|
+
import Box from '../Box';
|
|
12
|
+
import Icon from '../Icon';
|
|
13
|
+
import Token from '../Token';
|
|
14
|
+
var DefaultDelimiters = [',', 'Enter'];
|
|
15
|
+
var ControlledPropNames = ['value', 'hasFocus', 'activeToken'];
|
|
21
16
|
var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
22
17
|
_inheritsLoose(TokenInput, _React$Component);
|
|
23
|
-
|
|
24
18
|
function TokenInput(props) {
|
|
25
19
|
var _this;
|
|
26
|
-
|
|
27
20
|
_this = _React$Component.call(this, props) || this;
|
|
28
21
|
_this.delimiterMatcher = void 0;
|
|
29
|
-
|
|
30
22
|
_this.handleChangeText = function (e) {
|
|
31
23
|
var value = e.currentTarget.value;
|
|
32
24
|
var onChange = _this.props.onChange;
|
|
33
|
-
|
|
34
25
|
_this.setState({
|
|
35
26
|
value: value
|
|
36
27
|
});
|
|
37
|
-
|
|
38
28
|
onChange == null ? void 0 : onChange(e, value);
|
|
39
29
|
};
|
|
40
|
-
|
|
41
30
|
_this.handleFocus = function (e) {
|
|
42
31
|
var onFocus = _this.props.onFocus;
|
|
43
|
-
|
|
44
32
|
_this.setState({
|
|
45
33
|
hasFocus: true
|
|
46
34
|
});
|
|
47
|
-
|
|
48
35
|
onFocus == null ? void 0 : onFocus(e);
|
|
49
36
|
};
|
|
50
|
-
|
|
51
37
|
_this.handleBlur = function (e) {
|
|
52
38
|
var onBlur = _this.props.onBlur;
|
|
53
39
|
if (onBlur) onBlur(e);
|
|
54
|
-
|
|
55
40
|
_this.setState({
|
|
56
41
|
hasFocus: false
|
|
57
42
|
});
|
|
58
43
|
};
|
|
59
|
-
|
|
60
44
|
_this.handleKeyUp = function (e) {
|
|
61
45
|
_this.props.onKeyUp == null ? void 0 : _this.props.onKeyUp(e, e.currentTarget.value);
|
|
62
46
|
};
|
|
63
|
-
|
|
64
47
|
_this.handleKeyDown = function (e) {
|
|
65
48
|
var onKeyDown = _this.props.onKeyDown;
|
|
66
49
|
var key = e.key,
|
|
67
|
-
|
|
50
|
+
currentTarget = e.currentTarget;
|
|
68
51
|
var text = currentTarget.value;
|
|
69
|
-
if (onKeyDown) onKeyDown(e, text);
|
|
52
|
+
if (onKeyDown) onKeyDown(e, text);
|
|
53
|
+
|
|
54
|
+
// keyPress event runs before change
|
|
70
55
|
// Prevent event from bubbling up and calling change, which can lead to comma in value
|
|
71
56
|
|
|
72
57
|
if (_this.isDelimiter(key)) {
|
|
73
58
|
if (text) {
|
|
74
59
|
_this.spawnNewTokens([text]);
|
|
75
|
-
|
|
76
60
|
e.preventDefault();
|
|
77
61
|
}
|
|
78
|
-
} else if (key ===
|
|
79
|
-
if (text ===
|
|
62
|
+
} else if (key === 'Backspace') {
|
|
63
|
+
if (text === '') {
|
|
80
64
|
_this.deleteToken();
|
|
81
65
|
}
|
|
82
66
|
}
|
|
83
67
|
};
|
|
84
|
-
|
|
85
68
|
_this.handlePaste = function (e) {
|
|
86
|
-
var text = e.clipboardData.getData(
|
|
69
|
+
var text = e.clipboardData.getData('text');
|
|
87
70
|
var onPaste = _this.props.onPaste;
|
|
88
71
|
if (onPaste) onPaste(e, text);
|
|
89
72
|
var subtexts = text.split(_this.delimiterMatcher);
|
|
90
73
|
var texts = subtexts.filter(function (subtext) {
|
|
91
74
|
return subtext.length;
|
|
92
75
|
});
|
|
93
|
-
|
|
94
76
|
if (texts.length > 1) {
|
|
95
77
|
_this.spawnNewTokens(texts);
|
|
96
|
-
|
|
97
78
|
e.preventDefault();
|
|
98
79
|
}
|
|
99
80
|
};
|
|
100
|
-
|
|
101
81
|
_this.handleClickToken = function (e, token) {
|
|
102
82
|
var _this$props = _this.props,
|
|
103
|
-
|
|
104
|
-
|
|
83
|
+
onClickToken = _this$props.onClickToken,
|
|
84
|
+
disabled = _this$props.disabled;
|
|
105
85
|
if (onClickToken) onClickToken(e, token.id);
|
|
106
|
-
|
|
107
86
|
if (!disabled) {
|
|
108
87
|
_this.deleteToken(token.id);
|
|
109
88
|
}
|
|
110
89
|
};
|
|
111
|
-
|
|
112
90
|
var hasFocus = props.hasFocus,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
91
|
+
activeToken = props.activeToken,
|
|
92
|
+
_value = props.value,
|
|
93
|
+
delimiters = props.delimiters;
|
|
116
94
|
_this.delimiterMatcher = delimitersAsRegExp(delimiters || DefaultDelimiters);
|
|
117
95
|
_this.state = {
|
|
118
96
|
prevProps: props,
|
|
119
97
|
hasFocus: hasFocus || false,
|
|
120
98
|
activeToken: activeToken,
|
|
121
|
-
value: _value ||
|
|
99
|
+
value: _value || ''
|
|
122
100
|
};
|
|
123
101
|
return _this;
|
|
124
102
|
}
|
|
125
|
-
|
|
126
103
|
TokenInput.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
|
|
127
104
|
var prevProps = state.prevProps;
|
|
128
105
|
var modifiedState = {};
|
|
129
106
|
ControlledPropNames.forEach(function (propName) {
|
|
130
107
|
var currentProp = props[propName];
|
|
131
|
-
|
|
132
108
|
if (currentProp !== prevProps[propName]) {
|
|
133
109
|
modifiedState[propName] = currentProp;
|
|
134
110
|
}
|
|
@@ -136,48 +112,41 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
|
136
112
|
modifiedState.prevProps = props;
|
|
137
113
|
return modifiedState;
|
|
138
114
|
};
|
|
139
|
-
|
|
140
115
|
var _proto = TokenInput.prototype;
|
|
141
|
-
|
|
142
116
|
_proto.isDelimiter = function isDelimiter(keyName) {
|
|
143
117
|
var _this$props$delimiter = this.props.delimiters,
|
|
144
|
-
|
|
118
|
+
delimiters = _this$props$delimiter === void 0 ? DefaultDelimiters : _this$props$delimiter;
|
|
145
119
|
return delimiters.includes(keyName);
|
|
146
120
|
};
|
|
147
|
-
|
|
148
121
|
_proto.spawnNewTokens = function spawnNewTokens(texts) {
|
|
149
122
|
var _this$props2 = this.props,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
123
|
+
onAddToken = _this$props2.onAddToken,
|
|
124
|
+
onChangeTokens = _this$props2.onChangeTokens,
|
|
125
|
+
_this$props2$tokenMax = _this$props2.tokenMaxLength,
|
|
126
|
+
max = _this$props2$tokenMax === void 0 ? Infinity : _this$props2$tokenMax,
|
|
127
|
+
_this$props2$tokens = _this$props2.tokens,
|
|
128
|
+
tokens = _this$props2$tokens === void 0 ? [] : _this$props2$tokens;
|
|
156
129
|
var tokenSpecs = texts.map(function (text) {
|
|
157
130
|
return asTokenSpec(text.slice(0, max));
|
|
158
131
|
});
|
|
159
|
-
|
|
160
132
|
if (onAddToken) {
|
|
161
133
|
tokenSpecs.forEach(onAddToken);
|
|
162
134
|
} else if (onChangeTokens) {
|
|
163
135
|
onChangeTokens(tokens.concat(tokenSpecs));
|
|
164
136
|
}
|
|
165
|
-
|
|
166
137
|
this.setState({
|
|
167
|
-
value:
|
|
138
|
+
value: ''
|
|
168
139
|
});
|
|
169
140
|
};
|
|
170
|
-
|
|
171
141
|
_proto.deleteToken = function deleteToken(tokenId) {
|
|
172
142
|
var _this$props3 = this.props,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
143
|
+
onRemoveToken = _this$props3.onRemoveToken,
|
|
144
|
+
onChangeTokens = _this$props3.onChangeTokens,
|
|
145
|
+
_this$props3$tokens = _this$props3.tokens,
|
|
146
|
+
tokens = _this$props3$tokens === void 0 ? [] : _this$props3$tokens;
|
|
177
147
|
var count = tokens.length;
|
|
178
148
|
if (count === 0) return;
|
|
179
149
|
var id = tokenId != null ? tokenId : tokens[count - 1].id;
|
|
180
|
-
|
|
181
150
|
if (onRemoveToken) {
|
|
182
151
|
onRemoveToken(id);
|
|
183
152
|
} else if (onChangeTokens) {
|
|
@@ -185,23 +154,20 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
|
185
154
|
return tokenSpec.id !== id;
|
|
186
155
|
}));
|
|
187
156
|
}
|
|
188
|
-
|
|
189
157
|
this.setState({
|
|
190
|
-
value:
|
|
158
|
+
value: ''
|
|
191
159
|
});
|
|
192
160
|
};
|
|
193
|
-
|
|
194
161
|
_proto.renderToken = function renderToken(token) {
|
|
195
162
|
var _this2 = this;
|
|
196
|
-
|
|
197
163
|
var _this$props4 = this.props,
|
|
198
|
-
|
|
199
|
-
|
|
164
|
+
defaultIconName = _this$props4.iconName,
|
|
165
|
+
disabled = _this$props4.disabled;
|
|
200
166
|
var activeId = this.state.activeToken;
|
|
201
167
|
var id = token.id,
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
168
|
+
tokenIconName = token.iconName,
|
|
169
|
+
value = token.value,
|
|
170
|
+
valid = token.valid;
|
|
205
171
|
var iconName = tokenIconName || defaultIconName;
|
|
206
172
|
var isActive = activeId === id;
|
|
207
173
|
return /*#__PURE__*/React.createElement(Token, {
|
|
@@ -221,10 +187,8 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
|
221
187
|
pr: 300
|
|
222
188
|
}), value));
|
|
223
189
|
};
|
|
224
|
-
|
|
225
190
|
_proto.renderTokens = function renderTokens(tokens) {
|
|
226
191
|
var _this3 = this;
|
|
227
|
-
|
|
228
192
|
return tokens.map(function (token) {
|
|
229
193
|
return /*#__PURE__*/React.createElement("div", {
|
|
230
194
|
key: token.id,
|
|
@@ -232,42 +196,40 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
|
232
196
|
}, _this3.renderToken(token));
|
|
233
197
|
});
|
|
234
198
|
};
|
|
235
|
-
|
|
236
199
|
_proto.render = function render() {
|
|
237
200
|
var _this$props5 = this.props,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
201
|
+
autoFocus = _this$props5.autoFocus,
|
|
202
|
+
autocomplete = _this$props5.autocomplete,
|
|
203
|
+
disabled = _this$props5.disabled,
|
|
204
|
+
isInvalid = _this$props5.isInvalid,
|
|
205
|
+
hasWarning = _this$props5.hasWarning,
|
|
206
|
+
id = _this$props5.id,
|
|
207
|
+
name = _this$props5.name,
|
|
208
|
+
placeholder = _this$props5.placeholder,
|
|
209
|
+
required = _this$props5.required,
|
|
210
|
+
value = _this$props5.value,
|
|
211
|
+
elemBefore = _this$props5.elemBefore,
|
|
212
|
+
elemAfter = _this$props5.elemAfter,
|
|
213
|
+
maxLength = _this$props5.maxLength,
|
|
214
|
+
ariaDescribedby = _this$props5.ariaDescribedby,
|
|
215
|
+
ariaLabel = _this$props5.ariaLabel,
|
|
216
|
+
innerRef = _this$props5.innerRef,
|
|
217
|
+
onAddToken = _this$props5.onAddToken,
|
|
218
|
+
onRemoveToken = _this$props5.onRemoveToken,
|
|
219
|
+
onChangeTokens = _this$props5.onChangeTokens,
|
|
220
|
+
onClickToken = _this$props5.onClickToken,
|
|
221
|
+
onBlur = _this$props5.onBlur,
|
|
222
|
+
onChange = _this$props5.onChange,
|
|
223
|
+
onFocus = _this$props5.onFocus,
|
|
224
|
+
onKeyDown = _this$props5.onKeyDown,
|
|
225
|
+
onKeyUp = _this$props5.onKeyUp,
|
|
226
|
+
onPaste = _this$props5.onPaste,
|
|
227
|
+
_this$props5$inputPro = _this$props5.inputProps,
|
|
228
|
+
inputProps = _this$props5$inputPro === void 0 ? {} : _this$props5$inputPro,
|
|
229
|
+
_this$props5$qa = _this$props5.qa,
|
|
230
|
+
qa = _this$props5$qa === void 0 ? {} : _this$props5$qa,
|
|
231
|
+
tokens = _this$props5.tokens,
|
|
232
|
+
rest = _objectWithoutPropertiesLoose(_this$props5, _excluded);
|
|
271
233
|
var state = this.state;
|
|
272
234
|
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
273
235
|
hasBeforeElement: !!elemBefore,
|
|
@@ -275,8 +237,8 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
|
275
237
|
disabled: disabled,
|
|
276
238
|
invalid: !!isInvalid,
|
|
277
239
|
warning: hasWarning,
|
|
278
|
-
focused: state.hasFocus
|
|
279
|
-
|
|
240
|
+
focused: state.hasFocus
|
|
241
|
+
// $FlowIssue - upgrade v0.112.0
|
|
280
242
|
}, rest), elemBefore && /*#__PURE__*/React.createElement(Accessory, {
|
|
281
243
|
before: true
|
|
282
244
|
}, elemBefore), tokens && this.renderTokens(tokens), /*#__PURE__*/React.createElement("input", _extends({
|
|
@@ -300,15 +262,13 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
|
300
262
|
onKeyUp: this.handleKeyUp,
|
|
301
263
|
onPaste: this.handlePaste,
|
|
302
264
|
ref: innerRef,
|
|
303
|
-
"data-qa-input": name ||
|
|
265
|
+
"data-qa-input": name || '',
|
|
304
266
|
"data-qa-input-isdisabled": !!disabled,
|
|
305
267
|
"data-qa-input-isrequired": !!required
|
|
306
268
|
}, qa, inputProps)), elemAfter && /*#__PURE__*/React.createElement(Accessory, {
|
|
307
269
|
after: true
|
|
308
270
|
}, elemAfter));
|
|
309
271
|
};
|
|
310
|
-
|
|
311
272
|
return TokenInput;
|
|
312
273
|
}(React.Component);
|
|
313
|
-
|
|
314
274
|
export { TokenInput as default };
|
package/lib/TokenInput/styles.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { COMMON } from '../utils/system-props';
|
|
4
|
+
import { focusRing } from '../utils/mixins';
|
|
4
5
|
var Container = styled.div.withConfig({
|
|
5
6
|
displayName: "styles__Container",
|
|
6
7
|
componentId: "sc-19um4n4-0"
|
|
@@ -69,5 +70,5 @@ var Container = styled.div.withConfig({
|
|
|
69
70
|
return props.theme.colors.form.border.warning;
|
|
70
71
|
});
|
|
71
72
|
}, COMMON);
|
|
72
|
-
Container.displayName =
|
|
73
|
+
Container.displayName = 'TokenInputContainer';
|
|
73
74
|
export default Container;
|
package/lib/TokenInput/util.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import uniqueId from 'lodash.uniqueid';
|
|
2
4
|
export var asTokenSpec = function asTokenSpec(text) {
|
|
3
5
|
return {
|
|
4
6
|
id: uniqueId(text + "-"),
|
|
@@ -6,12 +8,12 @@ export var asTokenSpec = function asTokenSpec(text) {
|
|
|
6
8
|
};
|
|
7
9
|
};
|
|
8
10
|
var KeyNameToRegExpChar = {
|
|
9
|
-
Enter:
|
|
11
|
+
Enter: '\\n'
|
|
10
12
|
};
|
|
11
13
|
export var delimitersAsRegExp = function delimitersAsRegExp(delimiters) {
|
|
12
14
|
if (!delimiters) return /[,\n]/;
|
|
13
15
|
var chars = delimiters.map(function (key) {
|
|
14
16
|
return KeyNameToRegExpChar[key] || key;
|
|
15
|
-
}).join(
|
|
17
|
+
}).join('');
|
|
16
18
|
return RegExp("[" + chars + "]");
|
|
17
19
|
};
|