@fountain-ui/core 2.0.0-beta.91 → 2.0.0-beta.93
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/build/commonjs/Button/Button.js +51 -63
- package/build/commonjs/Button/Button.js.map +1 -1
- package/build/commonjs/Button/ButtonProps.js +11 -0
- package/build/commonjs/Button/ButtonProps.js.map +1 -1
- package/build/commonjs/Button/LegacyButton.js +144 -0
- package/build/commonjs/Button/LegacyButton.js.map +1 -0
- package/build/commonjs/Button/LegacyButtonProps.js +2 -0
- package/build/commonjs/Button/LegacyButtonProps.js.map +1 -0
- package/build/commonjs/Button/index.js +2 -2
- package/build/commonjs/Button/index.js.map +1 -1
- package/build/commonjs/Button/useVariantStyleMap.js +95 -0
- package/build/commonjs/Button/useVariantStyleMap.js.map +1 -0
- package/build/commonjs/ButtonSet/ButtonSet.js +54 -0
- package/build/commonjs/ButtonSet/ButtonSet.js.map +1 -0
- package/build/commonjs/ButtonSet/ButtonSetProps.js +11 -0
- package/build/commonjs/ButtonSet/ButtonSetProps.js.map +1 -0
- package/build/commonjs/ButtonSet/index.js +30 -0
- package/build/commonjs/ButtonSet/index.js.map +1 -0
- package/build/commonjs/ButtonSet/useVariantStyleMap.js +85 -0
- package/build/commonjs/ButtonSet/useVariantStyleMap.js.map +1 -0
- package/build/commonjs/Checkbox/Checkbox.js +33 -23
- package/build/commonjs/Checkbox/Checkbox.js.map +1 -1
- package/build/commonjs/Checkbox/CheckboxProps.js +7 -0
- package/build/commonjs/Checkbox/CheckboxProps.js.map +1 -1
- package/build/commonjs/Checkbox/LegacyCheckbox.js +65 -0
- package/build/commonjs/Checkbox/LegacyCheckbox.js.map +1 -0
- package/build/commonjs/Checkbox/LegacyCheckboxProps.js +2 -0
- package/build/commonjs/Checkbox/LegacyCheckboxProps.js.map +1 -0
- package/build/commonjs/Checkbox/index.js +2 -2
- package/build/commonjs/Checkbox/index.js.map +1 -1
- package/build/commonjs/Checkbox/useVariantStyleMap.js +70 -0
- package/build/commonjs/Checkbox/useVariantStyleMap.js.map +1 -0
- package/build/commonjs/CheckboxGroup/CheckboxGroup.js +50 -0
- package/build/commonjs/CheckboxGroup/CheckboxGroup.js.map +1 -0
- package/build/commonjs/CheckboxGroup/CheckboxGroupProps.js +2 -0
- package/build/commonjs/CheckboxGroup/CheckboxGroupProps.js.map +1 -0
- package/build/commonjs/CheckboxGroup/index.js +16 -0
- package/build/commonjs/CheckboxGroup/index.js.map +1 -0
- package/build/commonjs/Divider/Divider.js +16 -4
- package/build/commonjs/Divider/Divider.js.map +1 -1
- package/build/commonjs/Divider/DividerProps.js +9 -0
- package/build/commonjs/Divider/DividerProps.js.map +1 -1
- package/build/commonjs/Divider/LegacyDivider.js +114 -0
- package/build/commonjs/Divider/LegacyDivider.js.map +1 -0
- package/build/commonjs/Divider/LegacyDividerProps.js +2 -0
- package/build/commonjs/Divider/LegacyDividerProps.js.map +1 -0
- package/build/commonjs/Divider/index.js +2 -2
- package/build/commonjs/Divider/index.js.map +1 -1
- package/build/commonjs/IconButton/IconButton.js +39 -42
- package/build/commonjs/IconButton/IconButton.js.map +1 -1
- package/build/commonjs/IconButton/IconButtonProps.js +7 -0
- package/build/commonjs/IconButton/IconButtonProps.js.map +1 -1
- package/build/commonjs/IconButton/LegacyIconButton.js +88 -0
- package/build/commonjs/IconButton/LegacyIconButton.js.map +1 -0
- package/build/commonjs/IconButton/LegacyIconButtonProps.js +2 -0
- package/build/commonjs/IconButton/LegacyIconButtonProps.js.map +1 -0
- package/build/commonjs/IconButton/index.js +2 -2
- package/build/commonjs/IconButton/index.js.map +1 -1
- package/build/commonjs/Modal/index.js +0 -10
- package/build/commonjs/Modal/index.js.map +1 -1
- package/build/commonjs/Radio/LegacyRadio.js +82 -0
- package/build/commonjs/Radio/LegacyRadio.js.map +1 -0
- package/build/commonjs/Radio/LegacyRadioProps.js +2 -0
- package/build/commonjs/Radio/LegacyRadioProps.js.map +1 -0
- package/build/commonjs/Radio/Radio.js +40 -19
- package/build/commonjs/Radio/Radio.js.map +1 -1
- package/build/commonjs/Radio/RadioProps.js.map +1 -1
- package/build/commonjs/Radio/index.js +2 -2
- package/build/commonjs/Radio/index.js.map +1 -1
- package/build/commonjs/RadioGroup/LegacyRadioGroup.js +31 -0
- package/build/commonjs/RadioGroup/LegacyRadioGroup.js.map +1 -0
- package/build/commonjs/RadioGroup/RadioGroup.js +28 -2
- package/build/commonjs/RadioGroup/RadioGroup.js.map +1 -1
- package/build/commonjs/RadioGroup/index.js +2 -2
- package/build/commonjs/RadioGroup/index.js.map +1 -1
- package/build/commonjs/ShadowView/ShadowView.js +35 -0
- package/build/commonjs/ShadowView/ShadowView.js.map +1 -0
- package/build/commonjs/ShadowView/ShadowView.native.js +35 -0
- package/build/commonjs/ShadowView/ShadowView.native.js.map +1 -0
- package/build/commonjs/ShadowView/ShadowViewProps.js +2 -0
- package/build/commonjs/ShadowView/ShadowViewProps.js.map +1 -0
- package/build/commonjs/ShadowView/index.js +16 -0
- package/build/commonjs/ShadowView/index.js.map +1 -0
- package/build/commonjs/SvgIcon/LegacySvgIcon.js +43 -0
- package/build/commonjs/SvgIcon/LegacySvgIcon.js.map +1 -0
- package/build/commonjs/SvgIcon/LegacySvgIconProps.js +2 -0
- package/build/commonjs/SvgIcon/LegacySvgIconProps.js.map +1 -0
- package/build/commonjs/SvgIcon/SvgIcon.js +16 -4
- package/build/commonjs/SvgIcon/SvgIcon.js.map +1 -1
- package/build/commonjs/SvgIcon/SvgIconProps.js +15 -0
- package/build/commonjs/SvgIcon/SvgIconProps.js.map +1 -1
- package/build/commonjs/SvgIcon/index.js +2 -2
- package/build/commonjs/SvgIcon/index.js.map +1 -1
- package/build/commonjs/Toggle/Toggle.js +110 -0
- package/build/commonjs/Toggle/Toggle.js.map +1 -0
- package/build/commonjs/Toggle/ToggleProps.js +2 -0
- package/build/commonjs/Toggle/ToggleProps.js.map +1 -0
- package/build/commonjs/Toggle/index.js +16 -0
- package/build/commonjs/Toggle/index.js.map +1 -0
- package/build/commonjs/Typography/LegacyTypography.js +142 -0
- package/build/commonjs/Typography/LegacyTypography.js.map +1 -0
- package/build/commonjs/Typography/LegacyTypographyProps.js +2 -0
- package/build/commonjs/Typography/LegacyTypographyProps.js.map +1 -0
- package/build/commonjs/Typography/Typography.js +15 -54
- package/build/commonjs/Typography/Typography.js.map +1 -1
- package/build/commonjs/Typography/TypographyProps.js +7 -0
- package/build/commonjs/Typography/TypographyProps.js.map +1 -1
- package/build/commonjs/Typography/index.js +2 -2
- package/build/commonjs/Typography/index.js.map +1 -1
- package/build/commonjs/hooks/useCollapsibleAppBar.js +11 -2
- package/build/commonjs/hooks/useCollapsibleAppBar.js.map +1 -1
- package/build/commonjs/index.js +80 -3
- package/build/commonjs/index.js.map +1 -1
- package/build/commonjs/internal/icons/Check.js +23 -0
- package/build/commonjs/internal/icons/Check.js.map +1 -0
- package/build/commonjs/internal/icons/CheckboxOn.js +23 -0
- package/build/commonjs/internal/icons/CheckboxOn.js.map +1 -0
- package/build/commonjs/internal/icons/index.js +16 -0
- package/build/commonjs/internal/icons/index.js.map +1 -1
- package/build/commonjs/styles/createFontStyle.js.map +1 -1
- package/build/commonjs/utils/cloneElementSafely.js.map +1 -1
- package/build/commonjs/utils/createSvgIcon.js +15 -3
- package/build/commonjs/utils/createSvgIcon.js.map +1 -1
- package/build/commonjs/utils/index.js.map +1 -1
- package/build/module/Button/Button.js +53 -63
- package/build/module/Button/Button.js.map +1 -1
- package/build/module/Button/ButtonProps.js +3 -1
- package/build/module/Button/ButtonProps.js.map +1 -1
- package/build/module/Button/LegacyButton.js +127 -0
- package/build/module/Button/LegacyButton.js.map +1 -0
- package/build/module/Button/LegacyButtonProps.js +2 -0
- package/build/module/Button/LegacyButtonProps.js.map +1 -0
- package/build/module/Button/index.js +1 -1
- package/build/module/Button/index.js.map +1 -1
- package/build/module/Button/useVariantStyleMap.js +85 -0
- package/build/module/Button/useVariantStyleMap.js.map +1 -0
- package/build/module/ButtonSet/ButtonSet.js +34 -0
- package/build/module/ButtonSet/ButtonSet.js.map +1 -0
- package/build/module/ButtonSet/ButtonSetProps.js +3 -0
- package/build/module/ButtonSet/ButtonSetProps.js.map +1 -0
- package/build/module/ButtonSet/index.js +3 -0
- package/build/module/ButtonSet/index.js.map +1 -0
- package/build/module/ButtonSet/useVariantStyleMap.js +76 -0
- package/build/module/ButtonSet/useVariantStyleMap.js.map +1 -0
- package/build/module/Checkbox/Checkbox.js +32 -26
- package/build/module/Checkbox/Checkbox.js.map +1 -1
- package/build/module/Checkbox/CheckboxProps.js +1 -1
- package/build/module/Checkbox/CheckboxProps.js.map +1 -1
- package/build/module/Checkbox/LegacyCheckbox.js +52 -0
- package/build/module/Checkbox/LegacyCheckbox.js.map +1 -0
- package/build/module/Checkbox/LegacyCheckboxProps.js +2 -0
- package/build/module/Checkbox/LegacyCheckboxProps.js.map +1 -0
- package/build/module/Checkbox/index.js +1 -1
- package/build/module/Checkbox/index.js.map +1 -1
- package/build/module/Checkbox/useVariantStyleMap.js +59 -0
- package/build/module/Checkbox/useVariantStyleMap.js.map +1 -0
- package/build/module/CheckboxGroup/CheckboxGroup.js +34 -0
- package/build/module/CheckboxGroup/CheckboxGroup.js.map +1 -0
- package/build/module/CheckboxGroup/CheckboxGroupProps.js +2 -0
- package/build/module/CheckboxGroup/CheckboxGroupProps.js.map +1 -0
- package/build/module/CheckboxGroup/index.js +2 -0
- package/build/module/CheckboxGroup/index.js.map +1 -0
- package/build/module/Divider/Divider.js +17 -4
- package/build/module/Divider/Divider.js.map +1 -1
- package/build/module/Divider/DividerProps.js +2 -1
- package/build/module/Divider/DividerProps.js.map +1 -1
- package/build/module/Divider/LegacyDivider.js +100 -0
- package/build/module/Divider/LegacyDivider.js.map +1 -0
- package/build/module/Divider/LegacyDividerProps.js +2 -0
- package/build/module/Divider/LegacyDividerProps.js.map +1 -0
- package/build/module/Divider/index.js +1 -1
- package/build/module/Divider/index.js.map +1 -1
- package/build/module/IconButton/IconButton.js +36 -40
- package/build/module/IconButton/IconButton.js.map +1 -1
- package/build/module/IconButton/IconButtonProps.js +1 -1
- package/build/module/IconButton/IconButtonProps.js.map +1 -1
- package/build/module/IconButton/LegacyIconButton.js +73 -0
- package/build/module/IconButton/LegacyIconButton.js.map +1 -0
- package/build/module/IconButton/LegacyIconButtonProps.js +2 -0
- package/build/module/IconButton/LegacyIconButtonProps.js.map +1 -0
- package/build/module/IconButton/index.js +1 -1
- package/build/module/IconButton/index.js.map +1 -1
- package/build/module/Modal/index.js +0 -1
- package/build/module/Modal/index.js.map +1 -1
- package/build/module/Radio/LegacyRadio.js +63 -0
- package/build/module/Radio/LegacyRadio.js.map +1 -0
- package/build/module/Radio/LegacyRadioProps.js +2 -0
- package/build/module/Radio/LegacyRadioProps.js.map +1 -0
- package/build/module/Radio/Radio.js +35 -18
- package/build/module/Radio/Radio.js.map +1 -1
- package/build/module/Radio/RadioProps.js.map +1 -1
- package/build/module/Radio/index.js +1 -1
- package/build/module/Radio/index.js.map +1 -1
- package/build/module/RadioGroup/LegacyRadioGroup.js +18 -0
- package/build/module/RadioGroup/LegacyRadioGroup.js.map +1 -0
- package/build/module/RadioGroup/RadioGroup.js +21 -2
- package/build/module/RadioGroup/RadioGroup.js.map +1 -1
- package/build/module/RadioGroup/index.js +1 -1
- package/build/module/RadioGroup/index.js.map +1 -1
- package/build/module/ShadowView/ShadowView.js +23 -0
- package/build/module/ShadowView/ShadowView.js.map +1 -0
- package/build/module/ShadowView/ShadowView.native.js +23 -0
- package/build/module/ShadowView/ShadowView.native.js.map +1 -0
- package/build/module/ShadowView/ShadowViewProps.js +2 -0
- package/build/module/ShadowView/ShadowViewProps.js.map +1 -0
- package/build/module/ShadowView/index.js +2 -0
- package/build/module/ShadowView/index.js.map +1 -0
- package/build/module/SvgIcon/LegacySvgIcon.js +30 -0
- package/build/module/SvgIcon/LegacySvgIcon.js.map +1 -0
- package/build/module/SvgIcon/LegacySvgIconProps.js +2 -0
- package/build/module/SvgIcon/LegacySvgIconProps.js.map +1 -0
- package/build/module/SvgIcon/SvgIcon.js +15 -4
- package/build/module/SvgIcon/SvgIcon.js.map +1 -1
- package/build/module/SvgIcon/SvgIconProps.js +7 -1
- package/build/module/SvgIcon/SvgIconProps.js.map +1 -1
- package/build/module/SvgIcon/index.js +1 -1
- package/build/module/SvgIcon/index.js.map +1 -1
- package/build/module/Toggle/Toggle.js +90 -0
- package/build/module/Toggle/Toggle.js.map +1 -0
- package/build/module/Toggle/ToggleProps.js +2 -0
- package/build/module/Toggle/ToggleProps.js.map +1 -0
- package/build/module/Toggle/index.js +2 -0
- package/build/module/Toggle/index.js.map +1 -0
- package/build/module/Typography/LegacyTypography.js +126 -0
- package/build/module/Typography/LegacyTypography.js.map +1 -0
- package/build/module/Typography/LegacyTypographyProps.js +2 -0
- package/build/module/Typography/LegacyTypographyProps.js.map +1 -0
- package/build/module/Typography/Typography.js +15 -54
- package/build/module/Typography/Typography.js.map +1 -1
- package/build/module/Typography/TypographyProps.js +1 -1
- package/build/module/Typography/TypographyProps.js.map +1 -1
- package/build/module/Typography/index.js +1 -1
- package/build/module/Typography/index.js.map +1 -1
- package/build/module/hooks/useCollapsibleAppBar.js +12 -3
- package/build/module/hooks/useCollapsibleAppBar.js.map +1 -1
- package/build/module/index.js +9 -1
- package/build/module/index.js.map +1 -1
- package/build/module/internal/icons/Check.js +9 -0
- package/build/module/internal/icons/Check.js.map +1 -0
- package/build/module/internal/icons/CheckboxOn.js +9 -0
- package/build/module/internal/icons/CheckboxOn.js.map +1 -0
- package/build/module/internal/icons/index.js +2 -0
- package/build/module/internal/icons/index.js.map +1 -1
- package/build/module/styles/createFontStyle.js.map +1 -1
- package/build/module/utils/cloneElementSafely.js.map +1 -1
- package/build/module/utils/createSvgIcon.js +14 -3
- package/build/module/utils/createSvgIcon.js.map +1 -1
- package/build/module/utils/index.js.map +1 -1
- package/build/typescript/Button/ButtonProps.d.ts +13 -11
- package/build/typescript/Button/LegacyButton.d.ts +3 -0
- package/build/typescript/Button/LegacyButtonProps.d.ts +51 -0
- package/build/typescript/Button/index.d.ts +2 -2
- package/build/typescript/Button/useVariantStyleMap.d.ts +9 -0
- package/build/typescript/ButtonSet/ButtonSet.d.ts +3 -0
- package/build/typescript/ButtonSet/ButtonSetProps.d.ts +20 -0
- package/build/typescript/ButtonSet/index.d.ts +3 -0
- package/build/typescript/ButtonSet/useVariantStyleMap.d.ts +10 -0
- package/build/typescript/Checkbox/CheckboxProps.d.ts +10 -14
- package/build/typescript/Checkbox/LegacyCheckbox.d.ts +3 -0
- package/build/typescript/Checkbox/LegacyCheckboxProps.d.ts +36 -0
- package/build/typescript/Checkbox/index.d.ts +2 -2
- package/build/typescript/Checkbox/useVariantStyleMap.d.ts +9 -0
- package/build/typescript/CheckboxGroup/CheckboxGroup.d.ts +3 -0
- package/build/typescript/CheckboxGroup/CheckboxGroupProps.d.ts +11 -0
- package/build/typescript/CheckboxGroup/index.d.ts +2 -0
- package/build/typescript/Divider/DividerProps.d.ts +12 -9
- package/build/typescript/Divider/LegacyDivider.d.ts +3 -0
- package/build/typescript/Divider/LegacyDividerProps.d.ts +41 -0
- package/build/typescript/Divider/index.d.ts +2 -2
- package/build/typescript/IconButton/IconButtonProps.d.ts +7 -10
- package/build/typescript/IconButton/LegacyIconButton.d.ts +3 -0
- package/build/typescript/IconButton/LegacyIconButtonProps.d.ts +26 -0
- package/build/typescript/IconButton/index.d.ts +2 -2
- package/build/typescript/Modal/index.d.ts +0 -2
- package/build/typescript/Radio/LegacyRadio.d.ts +3 -0
- package/build/typescript/Radio/LegacyRadioProps.d.ts +43 -0
- package/build/typescript/Radio/RadioProps.d.ts +9 -14
- package/build/typescript/Radio/index.d.ts +2 -2
- package/build/typescript/RadioGroup/LegacyRadioGroup.d.ts +3 -0
- package/build/typescript/RadioGroup/index.d.ts +1 -1
- package/build/typescript/ShadowView/ShadowView.d.ts +3 -0
- package/build/typescript/ShadowView/ShadowView.native.d.ts +3 -0
- package/build/typescript/ShadowView/ShadowViewProps.d.ts +11 -0
- package/build/typescript/ShadowView/index.d.ts +2 -0
- package/build/typescript/SvgIcon/LegacySvgIcon.d.ts +3 -0
- package/build/typescript/SvgIcon/LegacySvgIconProps.d.ts +35 -0
- package/build/typescript/SvgIcon/SvgIconProps.d.ts +17 -6
- package/build/typescript/SvgIcon/index.d.ts +2 -2
- package/build/typescript/Toggle/Toggle.d.ts +3 -0
- package/build/typescript/Toggle/ToggleProps.d.ts +19 -0
- package/build/typescript/Toggle/index.d.ts +2 -0
- package/build/typescript/Typography/LegacyTypography.d.ts +5 -0
- package/build/typescript/Typography/LegacyTypographyProps.d.ts +81 -0
- package/build/typescript/Typography/Typography.d.ts +1 -1
- package/build/typescript/Typography/TypographyProps.d.ts +12 -9
- package/build/typescript/Typography/index.d.ts +2 -2
- package/build/typescript/hooks/useCollapsibleAppBar.d.ts +1 -0
- package/build/typescript/index.d.ts +10 -2
- package/build/typescript/internal/icons/Check.d.ts +8 -0
- package/build/typescript/internal/icons/Checkbox.d.ts +2 -124
- package/build/typescript/internal/icons/CheckboxChecked.d.ts +2 -124
- package/build/typescript/internal/icons/CheckboxOn.d.ts +8 -0
- package/build/typescript/internal/icons/ChevronDown.d.ts +2 -124
- package/build/typescript/internal/icons/ChevronLeft.d.ts +2 -124
- package/build/typescript/internal/icons/ChevronRight.d.ts +2 -124
- package/build/typescript/internal/icons/Close.d.ts +2 -124
- package/build/typescript/internal/icons/Radio.d.ts +2 -124
- package/build/typescript/internal/icons/RadioChecked.d.ts +2 -124
- package/build/typescript/internal/icons/index.d.ts +2 -0
- package/build/typescript/styles/createFontStyle.d.ts +1 -1
- package/build/typescript/utils/cloneElementSafely.d.ts +1 -2
- package/build/typescript/utils/createSvgIcon.d.ts +8 -3
- package/build/typescript/utils/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/Button/Button.tsx +53 -71
- package/src/Button/ButtonProps.ts +29 -12
- package/src/Button/LegacyButton.tsx +157 -0
- package/src/Button/LegacyButtonProps.ts +62 -0
- package/src/Button/index.ts +2 -2
- package/src/Button/useVariantStyleMap.ts +99 -0
- package/src/ButtonSet/ButtonSet.tsx +43 -0
- package/src/ButtonSet/ButtonSetProps.ts +27 -0
- package/src/ButtonSet/index.ts +3 -0
- package/src/ButtonSet/useVariantStyleMap.ts +84 -0
- package/src/Checkbox/Checkbox.tsx +48 -33
- package/src/Checkbox/CheckboxProps.ts +10 -15
- package/src/Checkbox/LegacyCheckbox.tsx +62 -0
- package/src/Checkbox/LegacyCheckboxProps.ts +42 -0
- package/src/Checkbox/index.ts +2 -2
- package/src/Checkbox/useVariantStyleMap.ts +71 -0
- package/src/CheckboxGroup/CheckboxGroup.tsx +47 -0
- package/src/CheckboxGroup/CheckboxGroupProps.ts +11 -0
- package/src/CheckboxGroup/index.ts +2 -0
- package/src/Divider/Divider.tsx +17 -8
- package/src/Divider/DividerProps.ts +14 -10
- package/src/Divider/LegacyDivider.tsx +114 -0
- package/src/Divider/LegacyDividerProps.ts +48 -0
- package/src/Divider/index.ts +2 -2
- package/src/IconButton/IconButton.tsx +36 -54
- package/src/IconButton/IconButtonProps.ts +12 -12
- package/src/IconButton/LegacyIconButton.tsx +96 -0
- package/src/IconButton/LegacyIconButtonProps.ts +31 -0
- package/src/IconButton/index.ts +2 -2
- package/src/Modal/index.ts +0 -2
- package/src/Radio/LegacyRadio.tsx +72 -0
- package/src/Radio/LegacyRadioProps.ts +50 -0
- package/src/Radio/Radio.tsx +47 -16
- package/src/Radio/RadioProps.ts +10 -16
- package/src/Radio/index.ts +2 -2
- package/src/RadioGroup/LegacyRadioGroup.tsx +20 -0
- package/src/RadioGroup/RadioGroup.tsx +31 -4
- package/src/RadioGroup/index.ts +2 -2
- package/src/ShadowView/ShadowView.native.tsx +37 -0
- package/src/ShadowView/ShadowView.tsx +33 -0
- package/src/ShadowView/ShadowViewProps.ts +11 -0
- package/src/ShadowView/index.ts +2 -0
- package/src/SvgIcon/LegacySvgIcon.tsx +36 -0
- package/src/SvgIcon/LegacySvgIconProps.ts +41 -0
- package/src/SvgIcon/SvgIcon.tsx +19 -5
- package/src/SvgIcon/SvgIconProps.ts +33 -6
- package/src/SvgIcon/index.ts +2 -2
- package/src/Toggle/Toggle.tsx +113 -0
- package/src/Toggle/ToggleProps.ts +21 -0
- package/src/Toggle/index.ts +2 -0
- package/src/Typography/LegacyTypography.tsx +107 -0
- package/src/Typography/LegacyTypographyProps.ts +122 -0
- package/src/Typography/Typography.tsx +24 -30
- package/src/Typography/TypographyProps.ts +29 -34
- package/src/Typography/index.ts +2 -2
- package/src/hooks/useCollapsibleAppBar.ts +12 -2
- package/src/index.ts +14 -2
- package/src/internal/icons/Check.tsx +13 -0
- package/src/internal/icons/CheckboxOn.tsx +13 -0
- package/src/internal/icons/index.ts +2 -0
- package/src/styles/createFontStyle.ts +1 -1
- package/src/utils/cloneElementSafely.ts +1 -1
- package/src/utils/createSvgIcon.tsx +29 -6
- package/src/utils/index.ts +1 -0
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ButtonBaseProps } from '../ButtonBase';
|
|
3
|
-
import type { OverridableComponentProps
|
|
3
|
+
import type { OverridableComponentProps } from '../types';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export const ButtonColors = [
|
|
6
|
+
'accent',
|
|
7
|
+
'primary',
|
|
8
|
+
'danger',
|
|
9
|
+
'disabled',
|
|
10
|
+
'secondary',
|
|
11
|
+
'accentAlt',
|
|
12
|
+
] as const;
|
|
13
|
+
export type ButtonColor = typeof ButtonColors[number];
|
|
6
14
|
|
|
7
|
-
export
|
|
15
|
+
export const ButtonSizes = [
|
|
16
|
+
'small',
|
|
17
|
+
'medium',
|
|
18
|
+
'large',
|
|
19
|
+
] as const;
|
|
20
|
+
export type ButtonSize = typeof ButtonSizes[number];
|
|
8
21
|
|
|
9
|
-
export
|
|
22
|
+
export const ButtonVariants = [
|
|
23
|
+
'solid',
|
|
24
|
+
'outlined',
|
|
25
|
+
'text',
|
|
26
|
+
] as const;
|
|
27
|
+
export type ButtonVariant = typeof ButtonVariants[number];
|
|
10
28
|
|
|
11
29
|
export default interface ButtonProps extends OverridableComponentProps<ButtonBaseProps, {
|
|
12
30
|
/**
|
|
@@ -14,19 +32,18 @@ export default interface ButtonProps extends OverridableComponentProps<ButtonBas
|
|
|
14
32
|
*/
|
|
15
33
|
children: string;
|
|
16
34
|
|
|
17
|
-
/**
|
|
18
|
-
* If `true`, remove horizontal padding and minimum width.
|
|
19
|
-
* This prop only applied on `text` variant.
|
|
20
|
-
* @default false
|
|
21
|
-
*/
|
|
22
|
-
clipHorizontalSpacing?: boolean;
|
|
23
|
-
|
|
24
35
|
/**
|
|
25
36
|
* The color of the component. It supports those theme colors that make sense for this component.
|
|
26
37
|
* @default 'primary'
|
|
27
38
|
*/
|
|
28
39
|
color?: ButtonColor;
|
|
29
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Determines whether minWidth should be applied.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
disableMinWidth?: boolean;
|
|
46
|
+
|
|
30
47
|
/**
|
|
31
48
|
* Element placed after the children.
|
|
32
49
|
*/
|
|
@@ -56,7 +73,7 @@ export default interface ButtonProps extends OverridableComponentProps<ButtonBas
|
|
|
56
73
|
|
|
57
74
|
/**
|
|
58
75
|
* The variant to use.
|
|
59
|
-
* @default '
|
|
76
|
+
* @default 'solid'
|
|
60
77
|
*/
|
|
61
78
|
variant?: ButtonVariant;
|
|
62
79
|
}> {}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Linking, Text } from 'react-native';
|
|
3
|
+
import ButtonBase from '../ButtonBase';
|
|
4
|
+
import { createFontStyle, css, StyleSheet, useTheme } from '../styles';
|
|
5
|
+
import { cloneElementSafely } from '../utils';
|
|
6
|
+
import type ButtonProps from './LegacyButtonProps';
|
|
7
|
+
import type { ButtonSize } from './LegacyButtonProps';
|
|
8
|
+
|
|
9
|
+
type IconSizes = { [n in ButtonSize]: number };
|
|
10
|
+
|
|
11
|
+
const iconSizes: IconSizes = {
|
|
12
|
+
small: 20,
|
|
13
|
+
medium: 24,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const styles = StyleSheet.create({
|
|
17
|
+
root: {
|
|
18
|
+
flexDirection: 'row',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
},
|
|
22
|
+
fullWidth: {
|
|
23
|
+
width: '100%',
|
|
24
|
+
},
|
|
25
|
+
medium: {
|
|
26
|
+
minWidth: 104,
|
|
27
|
+
height: 48,
|
|
28
|
+
},
|
|
29
|
+
small: {
|
|
30
|
+
minWidth: 56,
|
|
31
|
+
height: 32,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export default function Button(props: ButtonProps) {
|
|
36
|
+
const {
|
|
37
|
+
children,
|
|
38
|
+
clipHorizontalSpacing = false,
|
|
39
|
+
color = 'primary',
|
|
40
|
+
disabled = false,
|
|
41
|
+
endIcon: endIconProp,
|
|
42
|
+
fullWidth = false,
|
|
43
|
+
href,
|
|
44
|
+
onPress,
|
|
45
|
+
pressEffect,
|
|
46
|
+
size = 'medium',
|
|
47
|
+
startIcon: startIconProp,
|
|
48
|
+
style: styleProp,
|
|
49
|
+
variant = 'contained',
|
|
50
|
+
...otherProps
|
|
51
|
+
} = props;
|
|
52
|
+
|
|
53
|
+
const theme = useTheme();
|
|
54
|
+
|
|
55
|
+
const mainColor = theme.palette[color].main;
|
|
56
|
+
|
|
57
|
+
const fontColor = variant === 'contained'
|
|
58
|
+
? theme.palette[color].contrastTextColor
|
|
59
|
+
: theme.palette[color].main;
|
|
60
|
+
|
|
61
|
+
const variantStyleMap = {
|
|
62
|
+
contained: {
|
|
63
|
+
backgroundColor: mainColor,
|
|
64
|
+
},
|
|
65
|
+
outlined: {
|
|
66
|
+
backgroundColor: 'transparent',
|
|
67
|
+
borderColor: mainColor,
|
|
68
|
+
borderStyle: 'solid',
|
|
69
|
+
borderWidth: 1,
|
|
70
|
+
},
|
|
71
|
+
text: {
|
|
72
|
+
backgroundColor: 'transparent',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const iconProps = {
|
|
77
|
+
width: iconSizes[size],
|
|
78
|
+
height: iconSizes[size],
|
|
79
|
+
fill: fontColor,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const startIcon = cloneElementSafely(startIconProp, iconProps);
|
|
83
|
+
const endIcon = cloneElementSafely(endIconProp, iconProps);
|
|
84
|
+
|
|
85
|
+
const paddingSize = size === 'small' ? theme.spacing(3) : theme.spacing(4);
|
|
86
|
+
const paddingLeft = startIcon ? paddingSize - theme.spacing(1) : paddingSize;
|
|
87
|
+
const paddingRight = endIcon ? paddingSize - theme.spacing(1) : paddingSize;
|
|
88
|
+
|
|
89
|
+
const borderRadius = theme.shape.roundnessLarge;
|
|
90
|
+
const buttonBaseStyle = css([
|
|
91
|
+
styles.root,
|
|
92
|
+
variantStyleMap[variant],
|
|
93
|
+
size === 'medium' ? styles.medium : styles.small,
|
|
94
|
+
fullWidth ? styles.fullWidth : undefined,
|
|
95
|
+
{ borderRadius, color: fontColor },
|
|
96
|
+
(variant === 'text' && clipHorizontalSpacing)
|
|
97
|
+
? { minWidth: 0 }
|
|
98
|
+
: { paddingLeft, paddingRight },
|
|
99
|
+
styleProp,
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
const fontStyle = createFontStyle(theme, {
|
|
103
|
+
selector: (typo) => size === 'small' ? typo.button2 : typo.button1,
|
|
104
|
+
color: fontColor,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const textMarginSize = size === 'small' ? theme.spacing(1) : theme.spacing(2);
|
|
108
|
+
const textMarginStyle = startIcon
|
|
109
|
+
? { marginLeft: textMarginSize }
|
|
110
|
+
: endIcon
|
|
111
|
+
? { marginRight: textMarginSize }
|
|
112
|
+
: undefined;
|
|
113
|
+
|
|
114
|
+
const textStyle = css([
|
|
115
|
+
fontStyle,
|
|
116
|
+
textMarginStyle,
|
|
117
|
+
{ textAlign: 'center' },
|
|
118
|
+
]);
|
|
119
|
+
|
|
120
|
+
const modifiedPressEffect = variant !== 'text' && !pressEffect
|
|
121
|
+
? 'scale'
|
|
122
|
+
: pressEffect;
|
|
123
|
+
|
|
124
|
+
const handlePress = async () => {
|
|
125
|
+
if (disabled) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (onPress) {
|
|
129
|
+
onPress();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (href) {
|
|
133
|
+
if (await Linking.canOpenURL(href)) {
|
|
134
|
+
await Linking.openURL(href);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<ButtonBase
|
|
141
|
+
disabled={disabled}
|
|
142
|
+
onPress={handlePress}
|
|
143
|
+
style={buttonBaseStyle}
|
|
144
|
+
pressEffect={modifiedPressEffect}
|
|
145
|
+
{...otherProps}
|
|
146
|
+
>
|
|
147
|
+
{startIcon}
|
|
148
|
+
|
|
149
|
+
<Text
|
|
150
|
+
children={children}
|
|
151
|
+
style={textStyle}
|
|
152
|
+
/>
|
|
153
|
+
|
|
154
|
+
{endIcon}
|
|
155
|
+
</ButtonBase>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ButtonBaseProps } from '../ButtonBase';
|
|
3
|
+
import type { OverridableComponentProps, CommonComponentColor } from '../types';
|
|
4
|
+
|
|
5
|
+
export type ButtonColor = CommonComponentColor;
|
|
6
|
+
|
|
7
|
+
export type ButtonSize = 'small' | 'medium';
|
|
8
|
+
|
|
9
|
+
export type ButtonVariant = 'contained' | 'outlined' | 'text';
|
|
10
|
+
|
|
11
|
+
export default interface ButtonProps extends OverridableComponentProps<ButtonBaseProps, {
|
|
12
|
+
/**
|
|
13
|
+
* The content of the button.
|
|
14
|
+
*/
|
|
15
|
+
children: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* If `true`, remove horizontal padding and minimum width.
|
|
19
|
+
* This prop only applied on `text` variant.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
clipHorizontalSpacing?: boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The color of the component. It supports those theme colors that make sense for this component.
|
|
26
|
+
* @default 'primary'
|
|
27
|
+
*/
|
|
28
|
+
color?: ButtonColor;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Element placed after the children.
|
|
32
|
+
*/
|
|
33
|
+
endIcon?: React.ReactElement;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* If `true`, the button will take up the full width of its container.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
fullWidth?: boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The URL to link to when the button is clicked.
|
|
43
|
+
*/
|
|
44
|
+
href?: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The size of the button.
|
|
48
|
+
* @default 'medium'
|
|
49
|
+
*/
|
|
50
|
+
size?: ButtonSize;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Element placed before the children.
|
|
54
|
+
*/
|
|
55
|
+
startIcon?: React.ReactElement;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The variant to use.
|
|
59
|
+
* @default 'contained'
|
|
60
|
+
*/
|
|
61
|
+
variant?: ButtonVariant;
|
|
62
|
+
}> {}
|
package/src/Button/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './
|
|
2
|
-
export type { default as ButtonProps } from './
|
|
1
|
+
export { default } from './LegacyButton';
|
|
2
|
+
export type { default as ButtonProps } from './LegacyButtonProps';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { commonColors } from '@fountain-ui/styles';
|
|
3
|
+
import { useTheme } from '../styles';
|
|
4
|
+
import { ButtonColor, ButtonVariant } from './ButtonProps';
|
|
5
|
+
|
|
6
|
+
type UseVariantStyleMapReturns = {
|
|
7
|
+
borderColor?: string;
|
|
8
|
+
fillColor?: string;
|
|
9
|
+
iconColor?: string;
|
|
10
|
+
labelColor?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type VariantStyleMap = {
|
|
14
|
+
[variant in ButtonVariant]: {
|
|
15
|
+
[color in ButtonColor]?: UseVariantStyleMapReturns;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default function useVariantStyleMap(variant: ButtonVariant, color: ButtonColor): UseVariantStyleMapReturns {
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
|
|
22
|
+
return useMemo(() => {
|
|
23
|
+
const { palette } = theme;
|
|
24
|
+
|
|
25
|
+
const variantStyleMap: VariantStyleMap = {
|
|
26
|
+
solid: {
|
|
27
|
+
accent: {
|
|
28
|
+
fillColor: palette.fill.accent,
|
|
29
|
+
labelColor: commonColors.static.strongInverse,
|
|
30
|
+
iconColor: commonColors.static.strongInverse,
|
|
31
|
+
},
|
|
32
|
+
primary: {
|
|
33
|
+
fillColor: palette.fill.base,
|
|
34
|
+
labelColor: palette.text.strongInverse,
|
|
35
|
+
iconColor: palette.icon.strongInverse,
|
|
36
|
+
},
|
|
37
|
+
danger: {
|
|
38
|
+
fillColor: palette.status.danger,
|
|
39
|
+
labelColor: commonColors.static.strongInverse,
|
|
40
|
+
iconColor: commonColors.static.strongInverse,
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
fillColor: palette.status.disabled,
|
|
44
|
+
labelColor: palette.status.onDisabled,
|
|
45
|
+
iconColor: palette.status.onDisabled,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
outlined: {
|
|
49
|
+
accent: {
|
|
50
|
+
borderColor: palette.border.accent,
|
|
51
|
+
labelColor: palette.text.accent,
|
|
52
|
+
iconColor: palette.icon.accent,
|
|
53
|
+
},
|
|
54
|
+
primary: {
|
|
55
|
+
borderColor: palette.border.base,
|
|
56
|
+
labelColor: palette.text.base,
|
|
57
|
+
iconColor: palette.icon.base,
|
|
58
|
+
},
|
|
59
|
+
disabled: {
|
|
60
|
+
borderColor: palette.status.disabled,
|
|
61
|
+
labelColor: palette.status.disabledLabel,
|
|
62
|
+
iconColor: palette.status.disabledLabel,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
text: {
|
|
66
|
+
primary: {
|
|
67
|
+
labelColor: palette.text.strong,
|
|
68
|
+
iconColor: palette.icon.strong,
|
|
69
|
+
},
|
|
70
|
+
secondary: {
|
|
71
|
+
labelColor: palette.text.base,
|
|
72
|
+
iconColor: palette.icon.base,
|
|
73
|
+
},
|
|
74
|
+
accent: {
|
|
75
|
+
labelColor: palette.text.accent,
|
|
76
|
+
iconColor: palette.icon.accent,
|
|
77
|
+
},
|
|
78
|
+
accentAlt: {
|
|
79
|
+
labelColor: palette.text.accentAlt,
|
|
80
|
+
iconColor: palette.icon.accentAlt,
|
|
81
|
+
},
|
|
82
|
+
disabled: {
|
|
83
|
+
labelColor: palette.status.disabledLabel,
|
|
84
|
+
iconColor: palette.status.disabledLabel,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
if (variantStyleMap[variant][color]) {
|
|
90
|
+
return variantStyleMap[variant][color] as UseVariantStyleMapReturns;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
94
|
+
console.warn('The selected color is not supported for the chosen variant.');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return {};
|
|
98
|
+
}, [theme, variant, color]);
|
|
99
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { Children } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { FalsyReactElement } from '../utils';
|
|
4
|
+
import { cloneElementSafely } from '../utils';
|
|
5
|
+
import type ButtonSetProps from './ButtonSetProps';
|
|
6
|
+
import type { ButtonSetColor, ButtonSetVariant } from './ButtonSetProps';
|
|
7
|
+
import useVariantStyleMap from './useVariantStyleMap';
|
|
8
|
+
import { css } from '../styles';
|
|
9
|
+
|
|
10
|
+
export default function ButtonSet(props: ButtonSetProps) {
|
|
11
|
+
const {
|
|
12
|
+
children,
|
|
13
|
+
color = 'accent' as ButtonSetColor,
|
|
14
|
+
variant = 'horizontal' as ButtonSetVariant,
|
|
15
|
+
style: styleProp,
|
|
16
|
+
...otherProps
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
containerStyle,
|
|
21
|
+
buttonStyleMap,
|
|
22
|
+
} = useVariantStyleMap(variant, color);
|
|
23
|
+
|
|
24
|
+
const buttons = Children.map(children, (child, index) => {
|
|
25
|
+
const props = {
|
|
26
|
+
...buttonStyleMap[index],
|
|
27
|
+
...(variant === 'horizontal' ? { style: { flex: 1 } } : {}),
|
|
28
|
+
};
|
|
29
|
+
return cloneElementSafely(child as FalsyReactElement, props);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<View
|
|
34
|
+
{...otherProps}
|
|
35
|
+
style={css([
|
|
36
|
+
containerStyle,
|
|
37
|
+
styleProp,
|
|
38
|
+
])}
|
|
39
|
+
>
|
|
40
|
+
{buttons}
|
|
41
|
+
</View>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import type { OverridableComponentProps } from '../types';
|
|
4
|
+
|
|
5
|
+
export const buttonSetColors = [
|
|
6
|
+
'accent',
|
|
7
|
+
'danger',
|
|
8
|
+
'warning',
|
|
9
|
+
] as const;
|
|
10
|
+
export type ButtonSetColor = typeof buttonSetColors[number];
|
|
11
|
+
|
|
12
|
+
export const buttonSetVariants = ['horizontal', 'vertical'] as const;
|
|
13
|
+
export type ButtonSetVariant = typeof buttonSetVariants[number];
|
|
14
|
+
|
|
15
|
+
export default interface ButtonSetProps extends OverridableComponentProps<PropsWithChildren<ViewProps>, {
|
|
16
|
+
/**
|
|
17
|
+
* Determines the base color of the button set that goes inside.
|
|
18
|
+
* @default 'accent'
|
|
19
|
+
*/
|
|
20
|
+
color?: ButtonSetColor;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Determines design variations of the component.
|
|
24
|
+
* @default 'horizontal'
|
|
25
|
+
*/
|
|
26
|
+
variant?: ButtonSetVariant;
|
|
27
|
+
}> {}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import type { FountainUiStyle } from '@fountain-ui/styles';
|
|
3
|
+
import { useTheme } from '@fountain-ui/styles';
|
|
4
|
+
import type ButtonProps from '../Button/ButtonProps';
|
|
5
|
+
import type { ButtonSetColor, ButtonSetVariant } from './ButtonSetProps';
|
|
6
|
+
|
|
7
|
+
type ButtonStyle = Partial<ButtonProps>;
|
|
8
|
+
|
|
9
|
+
type ButtonStyleMap = {
|
|
10
|
+
[color in ButtonSetColor]?: ButtonStyle[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type VariantButtonStyleMap = {
|
|
14
|
+
[variant in ButtonSetVariant]: {
|
|
15
|
+
containerStyle: FountainUiStyle;
|
|
16
|
+
buttonStyleMap: ButtonStyleMap;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type UseVariantButtonStyleMapReturns = {
|
|
21
|
+
containerStyle: FountainUiStyle;
|
|
22
|
+
buttonStyleMap: ButtonStyle[];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default function useVariantStyleMap(variant: ButtonSetVariant, color: ButtonSetColor): UseVariantButtonStyleMapReturns {
|
|
26
|
+
const theme = useTheme();
|
|
27
|
+
|
|
28
|
+
return useMemo(() => {
|
|
29
|
+
const variantStyleMap: VariantButtonStyleMap = {
|
|
30
|
+
horizontal: {
|
|
31
|
+
containerStyle: {
|
|
32
|
+
flexDirection: 'row',
|
|
33
|
+
gap: theme.spacing(2),
|
|
34
|
+
paddingVertical: theme.spacing(2),
|
|
35
|
+
},
|
|
36
|
+
buttonStyleMap: {
|
|
37
|
+
accent: [
|
|
38
|
+
{ color: 'primary', variant: 'outlined' },
|
|
39
|
+
{ color: 'accent', variant: 'solid' },
|
|
40
|
+
],
|
|
41
|
+
danger: [
|
|
42
|
+
{ color: 'primary', variant: 'outlined' },
|
|
43
|
+
{ color: 'danger', variant: 'solid' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
vertical: {
|
|
48
|
+
containerStyle: {
|
|
49
|
+
flexDirection: 'column',
|
|
50
|
+
gap: theme.spacing(2.5),
|
|
51
|
+
paddingTop: theme.spacing(2),
|
|
52
|
+
},
|
|
53
|
+
buttonStyleMap: {
|
|
54
|
+
accent: [
|
|
55
|
+
{ color: 'accent', variant: 'solid' },
|
|
56
|
+
{ color: 'secondary', variant: 'text' },
|
|
57
|
+
],
|
|
58
|
+
danger: [
|
|
59
|
+
{ color: 'danger', variant: 'solid' },
|
|
60
|
+
{ color: 'secondary', variant: 'text' },
|
|
61
|
+
],
|
|
62
|
+
warning: [
|
|
63
|
+
{ color: 'primary', variant: 'solid' },
|
|
64
|
+
{ color: 'danger', variant: 'text' },
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const {
|
|
71
|
+
containerStyle,
|
|
72
|
+
buttonStyleMap,
|
|
73
|
+
} = variantStyleMap[variant];
|
|
74
|
+
|
|
75
|
+
if (process.env.NODE_ENV !== 'production' && buttonStyleMap[color] === undefined) {
|
|
76
|
+
console.warn('The selected color is not supported for the chosen variant.');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
containerStyle,
|
|
81
|
+
buttonStyleMap: buttonStyleMap[color] ?? [],
|
|
82
|
+
};
|
|
83
|
+
}, [theme, variant, color]);
|
|
84
|
+
}
|
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import type CheckboxProps from './CheckboxProps';
|
|
2
|
+
import { Text, View } from 'react-native';
|
|
4
3
|
import ButtonBase from '../ButtonBase';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
root: {
|
|
13
|
-
width: 24,
|
|
14
|
-
height: 24,
|
|
15
|
-
justifyContent: 'center',
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
};
|
|
4
|
+
import { CheckboxOn as CheckboxOnIcon } from '../internal/icons';
|
|
5
|
+
import Row from '../Row';
|
|
6
|
+
import { createFontStyle, css, useTheme } from '../styles';
|
|
7
|
+
import type CheckboxProps from './CheckboxProps';
|
|
8
|
+
import type { CheckboxVariant } from './CheckboxProps';
|
|
9
|
+
import useVariantStyleMap from './useVariantStyleMap';
|
|
20
10
|
|
|
21
11
|
export default function Checkbox(props: CheckboxProps) {
|
|
22
12
|
const {
|
|
23
13
|
checked = false,
|
|
24
|
-
|
|
25
|
-
color = 'primary',
|
|
14
|
+
children,
|
|
26
15
|
disabled = false,
|
|
27
|
-
icon: iconProp,
|
|
28
16
|
onChange,
|
|
29
|
-
style,
|
|
17
|
+
style: styleProp,
|
|
18
|
+
variant = 'square' as CheckboxVariant,
|
|
30
19
|
...otherProps
|
|
31
20
|
} = props;
|
|
32
21
|
|
|
33
|
-
const
|
|
22
|
+
const theme = useTheme();
|
|
34
23
|
|
|
35
|
-
const
|
|
36
|
-
|
|
24
|
+
const {
|
|
25
|
+
checkboxStyle,
|
|
26
|
+
containerStyle,
|
|
27
|
+
iconColor,
|
|
28
|
+
} = useVariantStyleMap(variant, checked);
|
|
29
|
+
|
|
30
|
+
const rootStyle = css([
|
|
31
|
+
children ? containerStyle : undefined,
|
|
32
|
+
styleProp,
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
const fontStyle = createFontStyle(theme, {
|
|
36
|
+
// TODO: apply typo select.
|
|
37
|
+
color: theme.palette.text.strong,
|
|
38
|
+
});
|
|
37
39
|
|
|
38
40
|
const handlePress = () => {
|
|
39
41
|
if (onChange) {
|
|
@@ -41,11 +43,6 @@ export default function Checkbox(props: CheckboxProps) {
|
|
|
41
43
|
}
|
|
42
44
|
};
|
|
43
45
|
|
|
44
|
-
const rootStyle = css([
|
|
45
|
-
styles.root,
|
|
46
|
-
style,
|
|
47
|
-
]);
|
|
48
|
-
|
|
49
46
|
return (
|
|
50
47
|
<ButtonBase
|
|
51
48
|
disabled={disabled}
|
|
@@ -53,10 +50,28 @@ export default function Checkbox(props: CheckboxProps) {
|
|
|
53
50
|
style={rootStyle}
|
|
54
51
|
{...otherProps}
|
|
55
52
|
>
|
|
56
|
-
{
|
|
57
|
-
?
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
<View style={checkboxStyle}>
|
|
54
|
+
{checked ? (
|
|
55
|
+
<CheckboxOnIcon
|
|
56
|
+
fill={iconColor}
|
|
57
|
+
enableV2={true}
|
|
58
|
+
height={7.5}
|
|
59
|
+
width={11}
|
|
60
|
+
/>
|
|
61
|
+
) : null}
|
|
62
|
+
</View>
|
|
63
|
+
|
|
64
|
+
{children ? (
|
|
65
|
+
<Row
|
|
66
|
+
flexGrow={1}
|
|
67
|
+
flexShrink={1}
|
|
68
|
+
>
|
|
69
|
+
<Text
|
|
70
|
+
children={children}
|
|
71
|
+
style={fontStyle}
|
|
72
|
+
/>
|
|
73
|
+
</Row>
|
|
74
|
+
) : null}
|
|
60
75
|
</ButtonBase>
|
|
61
76
|
);
|
|
62
77
|
};
|