@lunit/design-system 1.0.0-a.1 → 1.0.0-a.3
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/.babelrc.json +16 -0
- package/dist/cjs/components/Alert/index.js +2 -0
- package/dist/cjs/components/Alert/index.js.map +1 -0
- package/dist/cjs/components/Button/index.js +2 -0
- package/dist/cjs/components/Button/index.js.map +1 -0
- package/dist/cjs/components/Checkbox/index.js +2 -0
- package/dist/cjs/components/Checkbox/index.js.map +1 -0
- package/dist/cjs/components/Chip/index.js +2 -0
- package/dist/cjs/components/Chip/index.js.map +1 -0
- package/dist/cjs/components/DataTable/index.js +2 -0
- package/dist/cjs/components/DataTable/index.js.map +1 -0
- package/dist/cjs/components/DatePicker/index.js +2 -0
- package/dist/cjs/components/DatePicker/index.js.map +1 -0
- package/dist/cjs/components/Dropdown/index.js +2 -0
- package/dist/cjs/components/Dropdown/index.js.map +1 -0
- package/dist/cjs/components/FormLabel/index.js +2 -0
- package/dist/cjs/components/FormLabel/index.js.map +1 -0
- package/dist/cjs/components/Modal/index.js +2 -0
- package/dist/cjs/components/Modal/index.js.map +1 -0
- package/dist/cjs/components/Radio/index.js +2 -0
- package/dist/cjs/components/Radio/index.js.map +1 -0
- package/dist/cjs/components/RadioGroup/index.js +2 -0
- package/dist/cjs/components/RadioGroup/index.js.map +1 -0
- package/dist/cjs/components/TextField/index.js +2 -0
- package/dist/cjs/components/TextField/index.js.map +1 -0
- package/dist/cjs/components/Toggle/index.js +2 -0
- package/dist/cjs/components/Toggle/index.js.map +1 -0
- package/dist/cjs/components/ToggleButton/index.js +2 -0
- package/dist/cjs/components/ToggleButton/index.js.map +1 -0
- package/dist/cjs/components/Tooltip/index.js +2 -0
- package/dist/cjs/components/Tooltip/index.js.map +1 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/components/Alert/Alert.js +19 -0
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/Alert/Alert.styled.js +48 -0
- package/dist/components/Alert/Alert.styled.js.map +1 -0
- package/dist/components/Alert/Alert.types.js +2 -0
- package/dist/components/Alert/Alert.types.js.map +1 -0
- package/dist/components/Alert/Alert.utils..js +38 -0
- package/dist/components/Alert/Alert.utils..js.map +1 -0
- package/dist/components/Alert/index.js +1 -1
- package/dist/components/Alert/index.js.map +1 -1
- package/dist/components/Button/Button.js +9 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.styled.js +180 -0
- package/dist/components/Button/Button.styled.js.map +1 -0
- package/dist/components/Button/Button.types.js +2 -0
- package/dist/components/Button/Button.types.js.map +1 -0
- package/dist/components/Button/const.js +3 -0
- package/dist/components/Button/const.js.map +1 -0
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Button/utils/getButtonPaddingBySizeAndKind.js +23 -0
- package/dist/components/Button/utils/getButtonPaddingBySizeAndKind.js.map +1 -0
- package/dist/components/Button/utils/getHoverStyle.js +7 -0
- package/dist/components/Button/utils/getHoverStyle.js.map +1 -0
- package/dist/components/Button/utils/getIconButtonPaddingBySizeAndKind.js +23 -0
- package/dist/components/Button/utils/getIconButtonPaddingBySizeAndKind.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.js +49 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Chip/Chip.js +70 -0
- package/dist/components/Chip/Chip.js.map +1 -0
- package/dist/components/Chip/Chip.styled.js +142 -0
- package/dist/components/Chip/Chip.styled.js.map +1 -0
- package/dist/components/Chip/Chip.types.js +2 -0
- package/dist/components/Chip/Chip.types.js.map +1 -0
- package/dist/components/Chip/consts.js +8 -0
- package/dist/components/Chip/consts.js.map +1 -0
- package/dist/components/Chip/index.js +1 -1
- package/dist/components/Chip/index.js.map +1 -1
- package/dist/components/DataTable/DataTable.js +7 -0
- package/dist/components/DataTable/DataTable.js.map +1 -0
- package/dist/components/DataTable/index.js +1 -1
- package/dist/components/DataTable/index.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +7 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/Dropdown/Dropdown.js +7 -0
- package/dist/components/Dropdown/Dropdown.js.map +1 -0
- package/dist/components/Dropdown/index.js +1 -1
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/FormLabel/FormLabel.js +7 -0
- package/dist/components/FormLabel/FormLabel.js.map +1 -0
- package/dist/components/FormLabel/FormLabel.styled.js +8 -0
- package/dist/components/FormLabel/FormLabel.styled.js.map +1 -0
- package/dist/components/FormLabel/index.js +1 -1
- package/dist/components/FormLabel/index.js.map +1 -1
- package/dist/components/Modal/Modal.js +7 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/index.js +1 -1
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Radio/Radio.js +43 -0
- package/dist/components/Radio/Radio.js.map +1 -0
- package/dist/components/Radio/index.js +1 -1
- package/dist/components/Radio/index.js.map +1 -1
- package/dist/components/RadioGroup/index.js +2 -1
- package/dist/components/RadioGroup/index.js.map +1 -1
- package/dist/components/TextField/TextField.js +19 -0
- package/dist/components/TextField/TextField.js.map +1 -0
- package/dist/components/TextField/TextField.style.js +245 -0
- package/dist/components/TextField/TextField.style.js.map +1 -0
- package/dist/components/TextField/TextField.types.js +2 -0
- package/dist/components/TextField/TextField.types.js.map +1 -0
- package/dist/components/TextField/TextFieldIcon.js +7 -0
- package/dist/components/TextField/TextFieldIcon.js.map +1 -0
- package/dist/components/TextField/index.js +1 -1
- package/dist/components/TextField/index.js.map +1 -1
- package/dist/components/Toast/Toast.js +26 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Toast/Toast.styled.js +49 -0
- package/dist/components/Toast/Toast.styled.js.map +1 -0
- package/dist/components/Toast/Toast.types.js +2 -0
- package/dist/components/Toast/Toast.types.js.map +1 -0
- package/dist/components/Toast/Toast.utils.js +14 -0
- package/dist/components/Toast/Toast.utils.js.map +1 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Toast/index.js.map +1 -0
- package/dist/components/Toggle/Toggle.js +13 -0
- package/dist/components/Toggle/Toggle.js.map +1 -0
- package/dist/components/Toggle/Toggle.styled.js +155 -0
- package/dist/components/Toggle/Toggle.styled.js.map +1 -0
- package/dist/components/Toggle/Toggle.types.js +2 -0
- package/dist/components/Toggle/Toggle.types.js.map +1 -0
- package/dist/components/Toggle/index.js +1 -1
- package/dist/components/Toggle/index.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.js +12 -0
- package/dist/components/ToggleButton/ToggleButton.js.map +1 -0
- package/dist/components/ToggleButton/ToggleButton.styled.js +35 -0
- package/dist/components/ToggleButton/ToggleButton.styled.js.map +1 -0
- package/dist/components/ToggleButton/ToggleButton.types.js +2 -0
- package/dist/components/ToggleButton/ToggleButton.types.js.map +1 -0
- package/dist/components/ToggleButton/index.js +1 -1
- package/dist/components/ToggleButton/index.js.map +1 -1
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.js +7 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.js.map +1 -0
- package/dist/components/ToggleButtonGroup/index.js +2 -0
- package/dist/components/ToggleButtonGroup/index.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +7 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/index.js +1 -1
- package/dist/components/Tooltip/index.js.map +1 -1
- package/dist/components/index.js +7 -0
- package/dist/components/index.js.map +1 -0
- package/dist/foundation/Elevation/index.js +66 -0
- package/dist/foundation/Elevation/index.js.map +1 -0
- package/dist/foundation/Elevation/utils.js +9 -0
- package/dist/foundation/Elevation/utils.js.map +1 -0
- package/dist/foundation/Typography/index.js +62 -0
- package/dist/foundation/Typography/index.js.map +1 -0
- package/dist/foundation/Typography/tokens.js +155 -0
- package/dist/foundation/Typography/tokens.js.map +1 -0
- package/dist/foundation/colors/base/blue.js +26 -0
- package/dist/foundation/colors/base/blue.js.map +1 -0
- package/dist/foundation/colors/base/green.js +26 -0
- package/dist/foundation/colors/base/green.js.map +1 -0
- package/dist/foundation/colors/base/grey.js +52 -0
- package/dist/foundation/colors/base/grey.js.map +1 -0
- package/dist/foundation/colors/base/index.js +12 -0
- package/dist/foundation/colors/base/index.js.map +1 -0
- package/dist/foundation/colors/base/lunitGreen.js +26 -0
- package/dist/foundation/colors/base/lunitGreen.js.map +1 -0
- package/dist/foundation/colors/base/lunitTeal.js +26 -0
- package/dist/foundation/colors/base/lunitTeal.js.map +1 -0
- package/dist/foundation/colors/base/magenta.js +26 -0
- package/dist/foundation/colors/base/magenta.js.map +1 -0
- package/dist/foundation/colors/base/opacity.js +7 -0
- package/dist/foundation/colors/base/opacity.js.map +1 -0
- package/dist/foundation/colors/base/orange.js +26 -0
- package/dist/foundation/colors/base/orange.js.map +1 -0
- package/dist/foundation/colors/base/purple.js +26 -0
- package/dist/foundation/colors/base/purple.js.map +1 -0
- package/dist/foundation/colors/base/red.js +26 -0
- package/dist/foundation/colors/base/red.js.map +1 -0
- package/dist/foundation/colors/base/yellow.js +26 -0
- package/dist/foundation/colors/base/yellow.js.map +1 -0
- package/dist/foundation/colors/index.js +208 -0
- package/dist/foundation/colors/index.js.map +1 -0
- package/dist/foundation/colors/token/component.js +423 -0
- package/dist/foundation/colors/token/component.js.map +1 -0
- package/dist/foundation/colors/token/core.js +206 -0
- package/dist/foundation/colors/token/core.js.map +1 -0
- package/dist/foundation/colors/token/index.js +3 -0
- package/dist/foundation/colors/token/index.js.map +1 -0
- package/dist/foundation/colors/token/types.js +2 -0
- package/dist/foundation/colors/token/types.js.map +1 -0
- package/dist/foundation/colors/types.js +2 -0
- package/dist/foundation/colors/types.js.map +1 -0
- package/dist/foundation/index.js +13 -0
- package/dist/foundation/index.js.map +1 -0
- package/dist/foundation/spacing.js +2 -0
- package/dist/foundation/spacing.js.map +1 -0
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/theme.js +39 -0
- package/dist/theme.js.map +1 -0
- package/dist/types/components/Alert/Alert.d.ts +4 -0
- package/dist/types/components/Alert/Alert.styled.d.ts +6 -0
- package/dist/types/components/Alert/Alert.types.d.ts +9 -0
- package/dist/types/components/Alert/Alert.utils..d.ts +4 -0
- package/dist/types/components/Button/Button.d.ts +3 -0
- package/dist/{components → types/components}/Button/Button.styled.d.ts +26 -2
- package/dist/{components → types/components}/Button/Button.types.d.ts +4 -4
- package/dist/types/components/Button/utils/getHoverStyle.d.ts +6 -0
- package/dist/types/components/Chip/Chip.styled.d.ts +79 -0
- package/dist/{components → types/components}/Chip/Chip.types.d.ts +1 -1
- package/dist/types/components/TextField/TextField.d.ts +3 -0
- package/dist/types/components/TextField/TextField.style.d.ts +9 -0
- package/dist/types/components/TextField/TextField.types.d.ts +29 -0
- package/dist/types/components/TextField/TextFieldIcon.d.ts +8 -0
- package/dist/types/components/TextField/index.d.ts +2 -0
- package/dist/types/components/Toast/Toast.d.ts +4 -0
- package/dist/types/components/Toast/Toast.styled.d.ts +1 -0
- package/dist/types/components/Toast/Toast.types.d.ts +4 -0
- package/dist/types/components/Toast/Toast.utils.d.ts +2 -0
- package/dist/types/components/Toast/index.d.ts +1 -0
- package/dist/{components → types/components}/ToggleButton/ToggleButton.styled.d.ts +1 -1
- package/dist/{components → types/components}/ToggleButton/ToggleButton.types.d.ts +4 -4
- package/dist/{foundation → types/foundation}/colors/base/grey.d.ts +16 -0
- package/dist/{foundation → types/foundation}/colors/base/lunitGreen.d.ts +2 -2
- package/dist/{foundation → types/foundation}/colors/base/lunitTeal.d.ts +2 -2
- package/dist/{foundation → types/foundation}/colors/index.d.ts +42 -9
- package/dist/{foundation → types/foundation}/colors/types.d.ts +1 -3
- package/dist/{foundation → types/foundation}/index.d.ts +37 -5
- package/dist/{index.d.ts → types/index.d.ts} +1 -0
- package/package.json +37 -23
- package/src/components/Alert/Alert.styled.ts +60 -0
- package/src/components/Alert/Alert.tsx +53 -0
- package/src/components/Alert/Alert.types.ts +10 -0
- package/src/components/Alert/Alert.utils..ts +41 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/Button/Button.styled.ts +232 -0
- package/src/components/Button/Button.tsx +50 -0
- package/src/components/Button/Button.types.ts +25 -0
- package/src/components/Button/const.ts +2 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Button/utils/getButtonPaddingBySizeAndKind.ts +35 -0
- package/src/components/Button/utils/getHoverStyle.ts +7 -0
- package/src/components/Button/utils/getIconButtonPaddingBySizeAndKind.ts +38 -0
- package/src/components/Checkbox/Checkbox.tsx +67 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Chip/Chip.styled.ts +164 -0
- package/src/components/Chip/Chip.tsx +132 -0
- package/src/components/Chip/Chip.types.ts +56 -0
- package/src/components/Chip/consts.ts +7 -0
- package/src/components/Chip/index.ts +1 -0
- package/src/components/DataTable/DataTable.tsx +8 -0
- package/src/components/DataTable/index.ts +1 -0
- package/src/components/DatePicker/DatePicker.tsx +8 -0
- package/src/components/DatePicker/index.ts +1 -0
- package/src/components/Dropdown/Dropdown.tsx +11 -0
- package/src/components/Dropdown/index.ts +1 -0
- package/src/components/FormLabel/FormLabel.styled.ts +8 -0
- package/src/components/FormLabel/FormLabel.tsx +9 -0
- package/src/components/FormLabel/index.ts +1 -0
- package/src/components/Modal/Modal.tsx +8 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/Radio/Radio.tsx +58 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/RadioGroup/index.ts +2 -0
- package/src/components/TextField/TextField.style.ts +316 -0
- package/src/components/TextField/TextField.tsx +80 -0
- package/src/components/TextField/TextField.types.ts +38 -0
- package/src/components/TextField/TextFieldIcon.tsx +24 -0
- package/src/components/TextField/index.ts +7 -0
- package/src/components/Toast/Toast.styled.ts +49 -0
- package/src/components/Toast/Toast.tsx +66 -0
- package/src/components/Toast/Toast.types.ts +14 -0
- package/src/components/Toast/Toast.utils.ts +15 -0
- package/src/components/Toast/index.tsx +1 -0
- package/src/components/Toggle/Toggle.styled.ts +162 -0
- package/src/components/Toggle/Toggle.tsx +18 -0
- package/src/components/Toggle/Toggle.types.ts +14 -0
- package/src/components/Toggle/index.ts +1 -0
- package/src/components/ToggleButton/ToggleButton.styled.ts +58 -0
- package/src/components/ToggleButton/ToggleButton.tsx +89 -0
- package/src/components/ToggleButton/ToggleButton.types.ts +25 -0
- package/src/components/ToggleButton/index.ts +1 -0
- package/src/components/ToggleButtonGroup/ToggleButtonGroup.tsx +13 -0
- package/src/components/ToggleButtonGroup/index.tsx +1 -0
- package/src/components/Tooltip/Tooltip.tsx +9 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/index.ts +9 -0
- package/src/foundation/Elevation/index.ts +72 -0
- package/src/foundation/Elevation/utils.ts +11 -0
- package/src/foundation/Typography/index.ts +96 -0
- package/src/foundation/Typography/tokens.ts +162 -0
- package/src/foundation/colors/base/blue.ts +27 -0
- package/src/foundation/colors/base/green.ts +27 -0
- package/src/foundation/colors/base/grey.ts +53 -0
- package/src/foundation/colors/base/index.ts +11 -0
- package/src/foundation/colors/base/lunitGreen.ts +27 -0
- package/src/foundation/colors/base/lunitTeal.ts +27 -0
- package/src/foundation/colors/base/magenta.ts +27 -0
- package/src/foundation/colors/base/opacity.ts +6 -0
- package/src/foundation/colors/base/orange.ts +27 -0
- package/src/foundation/colors/base/purple.ts +27 -0
- package/src/foundation/colors/base/red.ts +27 -0
- package/src/foundation/colors/base/yellow.ts +27 -0
- package/src/foundation/colors/index.ts +256 -0
- package/src/foundation/colors/token/component.ts +430 -0
- package/src/foundation/colors/token/core.ts +211 -0
- package/src/foundation/colors/token/index.ts +2 -0
- package/src/foundation/colors/token/types.ts +8 -0
- package/src/foundation/colors/types.ts +83 -0
- package/src/foundation/index.ts +25 -0
- package/src/foundation/spacing.ts +3 -0
- package/src/index.ts +18 -0
- package/src/stories/components/Alert/Alert.stories.tsx +157 -0
- package/src/stories/components/Button/BasicButton.stories.tsx +168 -0
- package/src/stories/components/Button/IconButton.stories.tsx +139 -0
- package/src/stories/components/Button/Kind.stories.tsx +540 -0
- package/src/stories/components/Chip/Chip.stories.tsx +208 -0
- package/src/stories/components/DataTable/DataTable.stories.tsx +15 -0
- package/src/stories/components/DatePicker/DatePicker.stories.tsx +15 -0
- package/src/stories/components/Dropdown/Dropdown.stories.tsx +21 -0
- package/src/stories/components/Modal/Modal.stories.tsx +15 -0
- package/src/stories/components/SelectControl/Checkbox.stories.tsx +256 -0
- package/src/stories/components/SelectControl/RadioGroup.stories.tsx +68 -0
- package/src/stories/components/SelectControl/RadioStatus.stories.tsx +93 -0
- package/src/stories/components/SelectControl/Toggle.stories.tsx +443 -0
- package/src/stories/components/TextField/TextFieldMulti.stories.tsx +137 -0
- package/src/stories/components/TextField/TextFieldSingle.stories.tsx +283 -0
- package/src/stories/components/TextField/TextFieldSize.stories.tsx +134 -0
- package/src/stories/components/Toast/Toast.stories.tsx +152 -0
- package/src/stories/components/ToggleButton/Basic.stories.tsx +346 -0
- package/src/stories/components/ToggleButton/Group.stories.tsx +221 -0
- package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +708 -0
- package/src/stories/components/ToggleButton/WithIcon.stories.tsx +292 -0
- package/src/stories/components/Tooltip/Tooltip.stories.tsx +15 -0
- package/src/stories/foundation/Elevation/Elevation.stories.tsx +268 -0
- package/src/stories/foundation/Elevation/styled.ts +12 -0
- package/src/stories/foundation/Typography/Typography.mdx +76 -0
- package/src/stories/foundation/Typography/Typography.stories.tsx +101 -0
- package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +44 -0
- package/src/stories/foundation/Typography/TypographyGroup.tsx +71 -0
- package/src/stories/foundation/Typography/const.ts +25 -0
- package/src/stories/foundation/colors/Colors.stories.tsx +66 -0
- package/src/stories/foundation/colors/Mui.stories.tsx +18 -0
- package/src/stories/foundation/colors/Token.inComponent.stories.tsx +167 -0
- package/src/stories/foundation/colors/TokenPaletteTable.stories.tsx +28 -0
- package/src/stories/foundation/colors/TokenPaletteTable.tsx +127 -0
- package/src/stories/foundation/colors/styled.ts +39 -0
- package/src/theme.ts +46 -0
- package/src/types.d.ts +4 -0
- package/tsconfig.build.json +2 -0
- package/dist/components/Alert/Alert.d.ts +0 -2
- package/dist/components/Button/Button.d.ts +0 -3
- package/dist/components/Chip/Chip.styled.d.ts +0 -41
- package/dist/components/HelloWorld/HelloWorld.d.ts +0 -28
- package/dist/components/TextField/TextField.d.ts +0 -2
- package/dist/components/TextField/index.d.ts +0 -1
- package/webpack.config.js +0 -51
- /package/dist/{components → types/components}/Alert/index.d.ts +0 -0
- /package/dist/{components → types/components}/Button/const.d.ts +0 -0
- /package/dist/{components → types/components}/Button/index.d.ts +0 -0
- /package/dist/{components → types/components}/Button/utils/getButtonPaddingBySizeAndKind.d.ts +0 -0
- /package/dist/{components → types/components}/Button/utils/getIconButtonPaddingBySizeAndKind.d.ts +0 -0
- /package/dist/{components → types/components}/Checkbox/Checkbox.d.ts +0 -0
- /package/dist/{components → types/components}/Checkbox/index.d.ts +0 -0
- /package/dist/{components → types/components}/Chip/Chip.d.ts +0 -0
- /package/dist/{components → types/components}/Chip/consts.d.ts +0 -0
- /package/dist/{components → types/components}/Chip/index.d.ts +0 -0
- /package/dist/{components → types/components}/DataTable/DataTable.d.ts +0 -0
- /package/dist/{components → types/components}/DataTable/index.d.ts +0 -0
- /package/dist/{components → types/components}/DatePicker/DatePicker.d.ts +0 -0
- /package/dist/{components → types/components}/DatePicker/index.d.ts +0 -0
- /package/dist/{components → types/components}/Dropdown/Dropdown.d.ts +0 -0
- /package/dist/{components → types/components}/Dropdown/index.d.ts +0 -0
- /package/dist/{components → types/components}/FormLabel/FormLabel.d.ts +0 -0
- /package/dist/{components → types/components}/FormLabel/FormLabel.styled.d.ts +0 -0
- /package/dist/{components → types/components}/FormLabel/index.d.ts +0 -0
- /package/dist/{components → types/components}/Modal/Modal.d.ts +0 -0
- /package/dist/{components → types/components}/Modal/index.d.ts +0 -0
- /package/dist/{components → types/components}/Radio/Radio.d.ts +0 -0
- /package/dist/{components → types/components}/Radio/index.d.ts +0 -0
- /package/dist/{components → types/components}/RadioGroup/index.d.ts +0 -0
- /package/dist/{components → types/components}/Toggle/Toggle.d.ts +0 -0
- /package/dist/{components → types/components}/Toggle/Toggle.styled.d.ts +0 -0
- /package/dist/{components → types/components}/Toggle/Toggle.types.d.ts +0 -0
- /package/dist/{components → types/components}/Toggle/index.d.ts +0 -0
- /package/dist/{components → types/components}/ToggleButton/ToggleButton.d.ts +0 -0
- /package/dist/{components → types/components}/ToggleButton/index.d.ts +0 -0
- /package/dist/{components → types/components}/ToggleButtonGroup/ToggleButtonGroup.d.ts +0 -0
- /package/dist/{components → types/components}/ToggleButtonGroup/index.d.ts +0 -0
- /package/dist/{components → types/components}/Tooltip/Tooltip.d.ts +0 -0
- /package/dist/{components → types/components}/Tooltip/index.d.ts +0 -0
- /package/dist/{components → types/components}/index.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/Elevation/index.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/Elevation/utils.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/Typography/index.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/Typography/tokens.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/base/blue.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/base/green.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/base/index.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/base/magenta.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/base/opacity.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/base/orange.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/base/purple.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/base/red.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/base/yellow.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/token/component.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/token/core.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/token/index.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/colors/token/types.d.ts +0 -0
- /package/dist/{foundation → types/foundation}/spacing.d.ts +0 -0
- /package/dist/{theme.d.ts → types/theme.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunit/design-system",
|
|
3
|
-
"version": "1.0.0-a.
|
|
3
|
+
"version": "1.0.0-a.3",
|
|
4
4
|
"description": "Lunit Design System",
|
|
5
|
-
"main": "dist/index.js",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"sideEffects": false,
|
|
6
8
|
"exports": {
|
|
7
9
|
".": {
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/cjs/index.js",
|
|
13
|
+
"default": "./dist/cjs/index.js"
|
|
10
14
|
},
|
|
11
15
|
"./*": {
|
|
12
|
-
"types": "./dist/components/*/index.d.ts",
|
|
13
|
-
"
|
|
16
|
+
"types": "./dist/types/components/*/index.d.ts",
|
|
17
|
+
"import": "./dist/components/*/index.js",
|
|
18
|
+
"require": "./dist/cjs/components/*/index.js",
|
|
19
|
+
"default": "./dist/cjs/components/*/index.js"
|
|
14
20
|
}
|
|
15
21
|
},
|
|
16
|
-
"types": "dist/index.d.ts",
|
|
22
|
+
"types": "dist/types/index.d.ts",
|
|
17
23
|
"typesVersions": {
|
|
18
24
|
"*": {
|
|
19
25
|
"*": [
|
|
20
|
-
"dist/components/*/index.d.ts",
|
|
21
|
-
"dist/index.d.ts"
|
|
26
|
+
"dist/types/components/*/index.d.ts",
|
|
27
|
+
"dist/types/index.d.ts"
|
|
22
28
|
]
|
|
23
29
|
}
|
|
24
30
|
},
|
|
@@ -29,9 +35,11 @@
|
|
|
29
35
|
"directory": "packages/design-system"
|
|
30
36
|
},
|
|
31
37
|
"scripts": {
|
|
32
|
-
"build": "
|
|
33
|
-
"
|
|
34
|
-
"build
|
|
38
|
+
"build:transpile": "tsc -p tsconfig.build.json",
|
|
39
|
+
"build:cjs": "webpack -c webpack/cjs.config.js",
|
|
40
|
+
"build": "yarn build:transpile && yarn build:cjs",
|
|
41
|
+
"storybook": "storybook dev -p 6006",
|
|
42
|
+
"build-storybook": "storybook build",
|
|
35
43
|
"chromatic": "chromatic"
|
|
36
44
|
},
|
|
37
45
|
"nx": {
|
|
@@ -45,20 +53,25 @@
|
|
|
45
53
|
},
|
|
46
54
|
"devDependencies": {
|
|
47
55
|
"@babel/core": "^7.17.10",
|
|
56
|
+
"@babel/preset-env": "^7.21.4",
|
|
57
|
+
"@babel/preset-react": "^7.18.6",
|
|
58
|
+
"@babel/preset-typescript": "^7.21.4",
|
|
48
59
|
"@emotion/react": "^11.9.0",
|
|
49
60
|
"@emotion/styled": "^11.8.1",
|
|
61
|
+
"@mui/icons-material": "^5.11.3",
|
|
50
62
|
"@mui/material": "^5.11.3",
|
|
63
|
+
"@mui/utils": "^5.11.3",
|
|
51
64
|
"@mui/x-date-pickers": "^5.0.16",
|
|
52
|
-
"@storybook/addon-actions": "^
|
|
53
|
-
"@storybook/addon-essentials": "^
|
|
54
|
-
"@storybook/addon-interactions": "^
|
|
55
|
-
"@storybook/addon-links": "^
|
|
56
|
-
"@storybook/addon-storysource": "^
|
|
57
|
-
"@storybook/
|
|
58
|
-
"@storybook/
|
|
59
|
-
"@storybook/react": "^
|
|
60
|
-
"@storybook/testing-library": "^0.0
|
|
61
|
-
"@storybook/theming": "^
|
|
65
|
+
"@storybook/addon-actions": "^7.0.6",
|
|
66
|
+
"@storybook/addon-essentials": "^7.0.6",
|
|
67
|
+
"@storybook/addon-interactions": "^7.0.6",
|
|
68
|
+
"@storybook/addon-links": "^7.0.6",
|
|
69
|
+
"@storybook/addon-storysource": "^7.0.6",
|
|
70
|
+
"@storybook/blocks": "^7.0.6",
|
|
71
|
+
"@storybook/react": "^7.0.6",
|
|
72
|
+
"@storybook/react-webpack5": "^7.0.6",
|
|
73
|
+
"@storybook/testing-library": "^0.1.0",
|
|
74
|
+
"@storybook/theming": "^7.0.6",
|
|
62
75
|
"@types/lodash": "^4.14.182",
|
|
63
76
|
"babel-loader": "^8.2.5",
|
|
64
77
|
"chromatic": "^6.7.0",
|
|
@@ -67,7 +80,8 @@
|
|
|
67
80
|
"mustache": "^4.2.0",
|
|
68
81
|
"react": "^17.0.2",
|
|
69
82
|
"react-dom": "^17.0.2",
|
|
70
|
-
"storybook
|
|
83
|
+
"storybook": "^7.0.6",
|
|
84
|
+
"storybook-addon-pseudo-states": "^2.0.0",
|
|
71
85
|
"ts-loader": "^9.3.0",
|
|
72
86
|
"typescript": "^4.6.4",
|
|
73
87
|
"webpack": "^5.72.0",
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Alert as MuiAlert,
|
|
3
|
+
AlertTitle as MuiAlertTitle,
|
|
4
|
+
styled,
|
|
5
|
+
} from "@mui/material";
|
|
6
|
+
import type { AlertProps } from "./Alert.types";
|
|
7
|
+
import {
|
|
8
|
+
getBorderColor,
|
|
9
|
+
getBackgroundColor,
|
|
10
|
+
getIconColor,
|
|
11
|
+
} from "./Alert.utils.";
|
|
12
|
+
|
|
13
|
+
export const StyledAlert = styled(MuiAlert)<AlertProps>(({ severity }) => ({
|
|
14
|
+
"&.MuiAlert-root": {
|
|
15
|
+
display: "flex",
|
|
16
|
+
padding: "15px",
|
|
17
|
+
borderRadius: "8px",
|
|
18
|
+
border: `1px solid ${getBorderColor(severity)}`,
|
|
19
|
+
backgroundColor: getBackgroundColor(severity),
|
|
20
|
+
boxShadow: "none",
|
|
21
|
+
},
|
|
22
|
+
"& .MuiAlert-icon": {
|
|
23
|
+
padding: "4px",
|
|
24
|
+
fontSize: "20px",
|
|
25
|
+
marginRight: "16px",
|
|
26
|
+
color: `${getIconColor(severity)} !important`,
|
|
27
|
+
},
|
|
28
|
+
"& .MuiAlert-message": {
|
|
29
|
+
padding: "4px 0",
|
|
30
|
+
width: "100%",
|
|
31
|
+
minHeight: "28px",
|
|
32
|
+
},
|
|
33
|
+
"& .MuiAlert-action": {
|
|
34
|
+
margin: 0,
|
|
35
|
+
padding: 0,
|
|
36
|
+
},
|
|
37
|
+
"& .MuiSvgIcon-root": {
|
|
38
|
+
height: "20px",
|
|
39
|
+
width: "20px",
|
|
40
|
+
},
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
export const StyledAlertTitle = styled(MuiAlertTitle)(({ theme }) => ({
|
|
44
|
+
"&.MuiAlertTitle-root": {
|
|
45
|
+
marginTop: 0,
|
|
46
|
+
marginBottom: 8,
|
|
47
|
+
fontWeight: 700,
|
|
48
|
+
fontSize: "14px",
|
|
49
|
+
lineHeight: "20px",
|
|
50
|
+
color: theme.palette.token.core.text_normal,
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
export const StyledAlertChildren = styled("div")(({ theme }) => ({
|
|
55
|
+
color: theme.palette.token.core.text_normal,
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
export const StyledBottomAction = styled("div")({
|
|
59
|
+
marginTop: "12px",
|
|
60
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
StyledAlert,
|
|
4
|
+
StyledAlertTitle,
|
|
5
|
+
StyledAlertChildren,
|
|
6
|
+
StyledBottomAction,
|
|
7
|
+
} from "./Alert.styled";
|
|
8
|
+
import { AlertProps } from "./Alert.types";
|
|
9
|
+
import {
|
|
10
|
+
Close,
|
|
11
|
+
Success,
|
|
12
|
+
Error,
|
|
13
|
+
Warning,
|
|
14
|
+
Information,
|
|
15
|
+
} from "@lunit/design-system-icons";
|
|
16
|
+
import Button from "../Button";
|
|
17
|
+
|
|
18
|
+
const MAPPED_ICON = {
|
|
19
|
+
success: <Success variant="filled" />,
|
|
20
|
+
info: <Information variant="filled" />,
|
|
21
|
+
warning: <Warning variant="filled" />,
|
|
22
|
+
error: <Error variant="filled" />,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const Alert = forwardRef<HTMLDivElement, AlertProps>((props, ref) => {
|
|
26
|
+
const { title, severity, children, bottomAction, onClose, ...rest } = props;
|
|
27
|
+
return (
|
|
28
|
+
<StyledAlert
|
|
29
|
+
ref={ref}
|
|
30
|
+
severity={severity}
|
|
31
|
+
iconMapping={MAPPED_ICON}
|
|
32
|
+
slots={{
|
|
33
|
+
closeButton: () => (
|
|
34
|
+
<Button
|
|
35
|
+
kind="ghost"
|
|
36
|
+
size="small"
|
|
37
|
+
color="secondary"
|
|
38
|
+
icon={<Close />}
|
|
39
|
+
onClick={onClose}
|
|
40
|
+
/>
|
|
41
|
+
),
|
|
42
|
+
}}
|
|
43
|
+
onClose={onClose}
|
|
44
|
+
{...rest}
|
|
45
|
+
>
|
|
46
|
+
{title && <StyledAlertTitle>{title}</StyledAlertTitle>}
|
|
47
|
+
<StyledAlertChildren>{children}</StyledAlertChildren>
|
|
48
|
+
{bottomAction && <StyledBottomAction>{bottomAction}</StyledBottomAction>}
|
|
49
|
+
</StyledAlert>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export default Alert;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AlertProps as MuiAlertProps } from "@mui/material";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export interface AlertProps extends MuiAlertProps {
|
|
5
|
+
title?: string;
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
bottomAction?: ReactNode;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import theme from "@/theme";
|
|
2
|
+
import { AlertColor } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
export const getBackgroundColor = (severity: AlertColor | undefined) => {
|
|
5
|
+
switch (severity) {
|
|
6
|
+
case "info":
|
|
7
|
+
return theme.palette.token.component.alert_info_bg;
|
|
8
|
+
case "warning":
|
|
9
|
+
return theme.palette.token.component.alert_warning_bg;
|
|
10
|
+
case "error":
|
|
11
|
+
return theme.palette.token.component.alert_error_bg;
|
|
12
|
+
default:
|
|
13
|
+
return theme.palette.token.component.alert_success_bg;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const getBorderColor = (severity: AlertColor | undefined) => {
|
|
18
|
+
switch (severity) {
|
|
19
|
+
case "info":
|
|
20
|
+
return theme.palette.token.component.alert_info_border;
|
|
21
|
+
case "warning":
|
|
22
|
+
return theme.palette.token.component.alert_warning_border;
|
|
23
|
+
case "error":
|
|
24
|
+
return theme.palette.token.component.alert_error_border;
|
|
25
|
+
default:
|
|
26
|
+
return theme.palette.token.component.alert_success_border;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const getIconColor = (severity: AlertColor | undefined) => {
|
|
31
|
+
switch (severity) {
|
|
32
|
+
case "info":
|
|
33
|
+
return theme.palette.token.core.icon_info_02;
|
|
34
|
+
case "warning":
|
|
35
|
+
return theme.palette.token.core.icon_warning_02;
|
|
36
|
+
case "error":
|
|
37
|
+
return theme.palette.token.core.icon_error_02;
|
|
38
|
+
default:
|
|
39
|
+
return theme.palette.token.core.icon_success_02;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Alert";
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { Button as MuiButton } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
import { ColorToken } from "@/foundation/colors/types";
|
|
5
|
+
import { PADDING_OF_FOCUS, OUTLINED_BORDER_WIDTH } from "./const";
|
|
6
|
+
import { getButtonPaddingBySizeAndKind } from "./utils/getButtonPaddingBySizeAndKind";
|
|
7
|
+
import { getIconButtonPaddingBySizeAndKind } from "./utils/getIconButtonPaddingBySizeAndKind";
|
|
8
|
+
import getHoverStyle from "./utils/getHoverStyle";
|
|
9
|
+
|
|
10
|
+
import type { ButtonProps } from "./Button.types";
|
|
11
|
+
import type { ToggleButtonProps } from "../ToggleButton/ToggleButton.types";
|
|
12
|
+
import type { Typography } from "@mui/material/styles/createTypography";
|
|
13
|
+
|
|
14
|
+
type KindStyleParams = Pick<ButtonProps, "kind" | "color"> & {
|
|
15
|
+
token: ColorToken;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type CustomButtonProps = ButtonProps & { hasIconOnly: boolean };
|
|
19
|
+
|
|
20
|
+
type sizeStyleParams = Pick<
|
|
21
|
+
CustomButtonProps,
|
|
22
|
+
"size" | "hasIconOnly" | "kind"
|
|
23
|
+
> &
|
|
24
|
+
Pick<ToggleButtonProps, "selected"> & { typography: Typography };
|
|
25
|
+
|
|
26
|
+
const borderRadius = "8px";
|
|
27
|
+
|
|
28
|
+
export const sizeStyle = ({
|
|
29
|
+
size,
|
|
30
|
+
kind,
|
|
31
|
+
hasIconOnly,
|
|
32
|
+
typography,
|
|
33
|
+
selected = false,
|
|
34
|
+
}: sizeStyleParams) => ({
|
|
35
|
+
...(size === "small" && {
|
|
36
|
+
...typography.button2,
|
|
37
|
+
padding: `${
|
|
38
|
+
hasIconOnly
|
|
39
|
+
? getIconButtonPaddingBySizeAndKind({ kind, size, selected })
|
|
40
|
+
: getButtonPaddingBySizeAndKind({ kind, size, selected })
|
|
41
|
+
}`,
|
|
42
|
+
minWidth: "28px",
|
|
43
|
+
minHeight: "28px",
|
|
44
|
+
}),
|
|
45
|
+
...(size === "medium" && {
|
|
46
|
+
...typography.button2,
|
|
47
|
+
padding: `${
|
|
48
|
+
hasIconOnly
|
|
49
|
+
? getIconButtonPaddingBySizeAndKind({ kind, size, selected })
|
|
50
|
+
: getButtonPaddingBySizeAndKind({ kind, size, selected })
|
|
51
|
+
}`,
|
|
52
|
+
minWidth: "36px",
|
|
53
|
+
minHeight: "36px",
|
|
54
|
+
}),
|
|
55
|
+
...(size === "large" && {
|
|
56
|
+
...typography.button1,
|
|
57
|
+
padding: `${
|
|
58
|
+
hasIconOnly
|
|
59
|
+
? getIconButtonPaddingBySizeAndKind({ kind, size, selected })
|
|
60
|
+
: getButtonPaddingBySizeAndKind({ kind, size, selected })
|
|
61
|
+
}`,
|
|
62
|
+
minWidth: "44px",
|
|
63
|
+
minHeight: "44px",
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const kindStyle = ({ kind, color, token }: KindStyleParams) => ({
|
|
68
|
+
// kind: container
|
|
69
|
+
...(kind === "contained" &&
|
|
70
|
+
color === "primary" && {
|
|
71
|
+
color: token.component.btn_contained_primary_text,
|
|
72
|
+
backgroundColor: token.component.btn_contained_primary_bg,
|
|
73
|
+
"&:hover": getHoverStyle(token.component.btn_contained_primary_bg),
|
|
74
|
+
"&.Mui-disabled": {
|
|
75
|
+
opacity: 0.38,
|
|
76
|
+
border: "none",
|
|
77
|
+
color: token.component.btn_contained_primary_text,
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
...(kind === "contained" &&
|
|
81
|
+
color === "secondary" && {
|
|
82
|
+
color: token.component.btn_contained_secondary_text,
|
|
83
|
+
|
|
84
|
+
backgroundColor: token.component.btn_contained_secondary_bg,
|
|
85
|
+
"&:hover": getHoverStyle(token.component.btn_contained_secondary_bg),
|
|
86
|
+
"&.Mui-disabled": {
|
|
87
|
+
opacity: 0.38,
|
|
88
|
+
border: "none",
|
|
89
|
+
color: token.component.btn_contained_secondary_text,
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
92
|
+
...(kind === "contained" &&
|
|
93
|
+
color === "error" && {
|
|
94
|
+
color: token.component.btn_contained_error_text,
|
|
95
|
+
backgroundColor: token.component.btn_contained_error_bg,
|
|
96
|
+
"&:hover": getHoverStyle(token.component.btn_contained_error_bg),
|
|
97
|
+
"&.Mui-disabled": {
|
|
98
|
+
opacity: 0.38,
|
|
99
|
+
border: "none",
|
|
100
|
+
color: token.component.btn_contained_error_text,
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
// kind: ghost
|
|
104
|
+
...(kind === "ghost" &&
|
|
105
|
+
color === "primary" && {
|
|
106
|
+
color: token.component.btn_ghost_primary_text,
|
|
107
|
+
border: "none",
|
|
108
|
+
"&:hover": getHoverStyle("none"),
|
|
109
|
+
"&.Mui-disabled": {
|
|
110
|
+
opacity: 0.38,
|
|
111
|
+
border: "none",
|
|
112
|
+
color: token.component.btn_ghost_primary_text,
|
|
113
|
+
},
|
|
114
|
+
}),
|
|
115
|
+
...(kind === "ghost" &&
|
|
116
|
+
color === "secondary" && {
|
|
117
|
+
color: token.component.btn_ghost_secondary_text,
|
|
118
|
+
border: "none",
|
|
119
|
+
"&:hover": getHoverStyle("none"),
|
|
120
|
+
"&.Mui-disabled": {
|
|
121
|
+
opacity: 0.38,
|
|
122
|
+
border: "none",
|
|
123
|
+
color: token.component.btn_ghost_secondary_text,
|
|
124
|
+
},
|
|
125
|
+
}),
|
|
126
|
+
...(kind === "ghost" &&
|
|
127
|
+
color === "error" && {
|
|
128
|
+
color: token.component.btn_ghost_error_text,
|
|
129
|
+
"&:hover": getHoverStyle("none"),
|
|
130
|
+
"&.Mui-disabled": {
|
|
131
|
+
opacity: 0.38,
|
|
132
|
+
border: "none",
|
|
133
|
+
color: token.component.btn_ghost_error_text,
|
|
134
|
+
},
|
|
135
|
+
}),
|
|
136
|
+
// kind: outlined
|
|
137
|
+
...(kind === "outlined" &&
|
|
138
|
+
color === "primary" && {
|
|
139
|
+
color: token.component.btn_outlined_primary_text,
|
|
140
|
+
border: `${OUTLINED_BORDER_WIDTH}px solid ${token.component.btn_outlined_primary_border}`,
|
|
141
|
+
"&:hover": getHoverStyle("none"),
|
|
142
|
+
"&:hover:before": {
|
|
143
|
+
content: "''",
|
|
144
|
+
position: "absolute",
|
|
145
|
+
left: "-1px",
|
|
146
|
+
top: "-1px",
|
|
147
|
+
width: "calc(100% + 2px)",
|
|
148
|
+
height: "calc(100% + 2px)",
|
|
149
|
+
zIndex: -1,
|
|
150
|
+
backgroundColor: token.core.hover,
|
|
151
|
+
borderRadius,
|
|
152
|
+
},
|
|
153
|
+
"&.Mui-disabled": {
|
|
154
|
+
opacity: 0.38,
|
|
155
|
+
color: token.component.btn_outlined_primary_text,
|
|
156
|
+
},
|
|
157
|
+
}),
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
export const commonStyle = ({ token }: { token: ColorToken }) =>
|
|
161
|
+
({
|
|
162
|
+
fontWeight: "500",
|
|
163
|
+
borderRadius,
|
|
164
|
+
textTransform: "initial",
|
|
165
|
+
"&.Mui-focusVisible": {
|
|
166
|
+
"&::after": {
|
|
167
|
+
position: "absolute",
|
|
168
|
+
width: `calc(100% + ${PADDING_OF_FOCUS}px)`,
|
|
169
|
+
height: `calc(100% + ${PADDING_OF_FOCUS}px)`,
|
|
170
|
+
content: '""',
|
|
171
|
+
borderRadius: "11px",
|
|
172
|
+
border: `1px solid ${token.core.focused}`,
|
|
173
|
+
boxSizing: "border-box",
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
"&:hover:before": {
|
|
177
|
+
content: "''",
|
|
178
|
+
position: "absolute",
|
|
179
|
+
left: 0,
|
|
180
|
+
top: 0,
|
|
181
|
+
width: "100%",
|
|
182
|
+
height: "100%",
|
|
183
|
+
zIndex: -1,
|
|
184
|
+
backgroundColor: token.core.hover,
|
|
185
|
+
borderRadius,
|
|
186
|
+
},
|
|
187
|
+
} as const);
|
|
188
|
+
|
|
189
|
+
export const iconStyle = ({
|
|
190
|
+
size,
|
|
191
|
+
hasIconOnly,
|
|
192
|
+
}: Pick<CustomButtonProps, "size" | "hasIconOnly">) => ({
|
|
193
|
+
"& .MuiButton-startIcon": {
|
|
194
|
+
width: "20px",
|
|
195
|
+
height: "20px",
|
|
196
|
+
margin: 0,
|
|
197
|
+
marginRight: hasIconOnly ? "0px" : size === "large" ? "8px" : "4px",
|
|
198
|
+
|
|
199
|
+
// This style was added for Mui Button Svg Icon handling
|
|
200
|
+
"*:nth-of-type(1)": {
|
|
201
|
+
fontSize: "20px",
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
svg: {
|
|
205
|
+
width: "20px",
|
|
206
|
+
height: "20px",
|
|
207
|
+
margin: 0,
|
|
208
|
+
marginRight: hasIconOnly ? "0px" : size === "large" ? "8px" : "4px",
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
export const CustomButton = styled(MuiButton, {
|
|
213
|
+
shouldForwardProp: (prop: string) => {
|
|
214
|
+
return !["kind", "hasIconOnly"].includes(prop);
|
|
215
|
+
},
|
|
216
|
+
})<CustomButtonProps>(
|
|
217
|
+
({
|
|
218
|
+
theme: {
|
|
219
|
+
typography,
|
|
220
|
+
palette: { token },
|
|
221
|
+
},
|
|
222
|
+
kind,
|
|
223
|
+
size,
|
|
224
|
+
color,
|
|
225
|
+
hasIconOnly,
|
|
226
|
+
}) => ({
|
|
227
|
+
...commonStyle({ token }),
|
|
228
|
+
...iconStyle({ size, hasIconOnly }),
|
|
229
|
+
...sizeStyle({ size, kind, hasIconOnly, typography }),
|
|
230
|
+
...kindStyle({ kind, color, token }),
|
|
231
|
+
})
|
|
232
|
+
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { CustomButton } from "./Button.styled";
|
|
4
|
+
|
|
5
|
+
import type { ButtonProps } from "./Button.types";
|
|
6
|
+
|
|
7
|
+
const Button = (props: ButtonProps) => {
|
|
8
|
+
const {
|
|
9
|
+
kind = "contained",
|
|
10
|
+
size = "small",
|
|
11
|
+
color = "primary",
|
|
12
|
+
icon,
|
|
13
|
+
className,
|
|
14
|
+
children,
|
|
15
|
+
...buttonProps
|
|
16
|
+
} = props;
|
|
17
|
+
const hasIconOnly = Boolean(icon && !children);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
{kind === "contained" || kind === "ghost" ? (
|
|
22
|
+
<CustomButton
|
|
23
|
+
className={`${kind} ${className ? className : ""}`}
|
|
24
|
+
kind={kind}
|
|
25
|
+
color={color}
|
|
26
|
+
size={size}
|
|
27
|
+
startIcon={icon}
|
|
28
|
+
hasIconOnly={hasIconOnly}
|
|
29
|
+
{...buttonProps}
|
|
30
|
+
>
|
|
31
|
+
{!hasIconOnly && <>{children}</>}
|
|
32
|
+
</CustomButton>
|
|
33
|
+
) : (
|
|
34
|
+
<CustomButton
|
|
35
|
+
className={`outlined ${className ? className : ""}`}
|
|
36
|
+
kind="outlined"
|
|
37
|
+
color="primary"
|
|
38
|
+
size={size}
|
|
39
|
+
startIcon={icon}
|
|
40
|
+
hasIconOnly={hasIconOnly}
|
|
41
|
+
{...buttonProps}
|
|
42
|
+
>
|
|
43
|
+
{!hasIconOnly && <>{children}</>}
|
|
44
|
+
</CustomButton>
|
|
45
|
+
)}
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default Button;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ButtonProps as MuiButtonProps } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
interface BaseButtonProps extends Omit<MuiButtonProps, "variant"> {
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface ContainedButtonProps extends BaseButtonProps {
|
|
8
|
+
kind?: "contained";
|
|
9
|
+
color?: "primary" | "secondary" | "error";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface GhostButtonProps extends BaseButtonProps {
|
|
13
|
+
kind?: "ghost";
|
|
14
|
+
color?: "primary" | "secondary" | "error";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface OutlinedButtonProps extends BaseButtonProps {
|
|
18
|
+
kind?: "outlined";
|
|
19
|
+
color?: "primary";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type ButtonProps =
|
|
23
|
+
| ContainedButtonProps
|
|
24
|
+
| GhostButtonProps
|
|
25
|
+
| OutlinedButtonProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Button";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { OUTLINED_BORDER_WIDTH } from "../const";
|
|
2
|
+
|
|
3
|
+
import type { ButtonProps } from "../Button.types";
|
|
4
|
+
import { ToggleButtonProps } from "@/components/ToggleButton/ToggleButton.types";
|
|
5
|
+
|
|
6
|
+
type GetButtonPaddingBySizeAndKindParams = Pick<ButtonProps, "kind" | "size"> &
|
|
7
|
+
Pick<ToggleButtonProps, "selected">;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* When kind is outlined,
|
|
11
|
+
* the padding value must include the border width of outlined.
|
|
12
|
+
* This function takes care of this.
|
|
13
|
+
*/
|
|
14
|
+
export const getButtonPaddingBySizeAndKind = ({
|
|
15
|
+
kind,
|
|
16
|
+
size,
|
|
17
|
+
selected = false,
|
|
18
|
+
}: GetButtonPaddingBySizeAndKindParams) => {
|
|
19
|
+
if (size === "small") {
|
|
20
|
+
return kind === "outlined" && !selected
|
|
21
|
+
? `${4 - OUTLINED_BORDER_WIDTH}px ${8 - OUTLINED_BORDER_WIDTH}px`
|
|
22
|
+
: "4px 8px";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (size === "medium") {
|
|
26
|
+
return kind === "outlined" && !selected
|
|
27
|
+
? `${8 - OUTLINED_BORDER_WIDTH}px ${12 - OUTLINED_BORDER_WIDTH}px`
|
|
28
|
+
: "8px 12px";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// size === "large"
|
|
32
|
+
return kind === "outlined" && !selected
|
|
33
|
+
? `${10 - OUTLINED_BORDER_WIDTH}px ${12 - OUTLINED_BORDER_WIDTH}px`
|
|
34
|
+
: "10px 12px";
|
|
35
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { OUTLINED_BORDER_WIDTH } from "../const";
|
|
2
|
+
|
|
3
|
+
import type { ButtonProps } from "../Button.types";
|
|
4
|
+
import { ToggleButtonProps } from "@/components/ToggleButton/ToggleButton.types";
|
|
5
|
+
|
|
6
|
+
type GetIconButtonPaddingBySizeAndKindProps = Pick<
|
|
7
|
+
ButtonProps,
|
|
8
|
+
"kind" | "size"
|
|
9
|
+
> &
|
|
10
|
+
Pick<ToggleButtonProps, "selected">;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* When kind is outlined,
|
|
14
|
+
* the padding value must include the border width of outlined.
|
|
15
|
+
* This function takes care of this.
|
|
16
|
+
*/
|
|
17
|
+
export const getIconButtonPaddingBySizeAndKind = ({
|
|
18
|
+
kind,
|
|
19
|
+
size,
|
|
20
|
+
selected = false,
|
|
21
|
+
}: GetIconButtonPaddingBySizeAndKindProps) => {
|
|
22
|
+
if (size === "small") {
|
|
23
|
+
return kind === "outlined" && !selected
|
|
24
|
+
? `${4 - OUTLINED_BORDER_WIDTH}px`
|
|
25
|
+
: "4px";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (size === "medium") {
|
|
29
|
+
return kind === "outlined" && !selected
|
|
30
|
+
? `${8 - OUTLINED_BORDER_WIDTH}px`
|
|
31
|
+
: "8px";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// size === "large"
|
|
35
|
+
return kind === "outlined" && !selected
|
|
36
|
+
? `${12 - OUTLINED_BORDER_WIDTH}px`
|
|
37
|
+
: "12px";
|
|
38
|
+
};
|