@basic-ui/material 0.1.13 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +634 -371
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Alert/Alert.d.ts +1 -1
- package/build/esm/Alert/Alert.js +1 -1
- package/build/esm/Alert/Alert.js.map +1 -1
- package/build/esm/Alert/index.d.ts +0 -0
- package/build/esm/Alert/index.js.map +0 -0
- package/build/esm/AppBar/AppBar.d.ts +1 -1
- package/build/esm/AppBar/AppBar.js +1 -2
- package/build/esm/AppBar/AppBar.js.map +1 -1
- package/build/esm/AppBar/AppBarButton.d.ts +1 -1
- package/build/esm/AppBar/AppBarButton.js.map +0 -0
- package/build/esm/AppBar/context.d.ts +0 -0
- package/build/esm/AppBar/context.js.map +0 -0
- package/build/esm/AppBar/index.d.ts +0 -0
- package/build/esm/AppBar/index.js.map +0 -0
- package/build/esm/Badge/Badge.d.ts +1 -1
- package/build/esm/Badge/Badge.js.map +0 -0
- package/build/esm/Badge/index.d.ts +0 -0
- package/build/esm/Badge/index.js.map +0 -0
- package/build/esm/BaseLine/BaseLine.d.ts +0 -1
- package/build/esm/BaseLine/BaseLine.js.map +0 -0
- package/build/esm/BaseLine/index.d.ts +0 -0
- package/build/esm/BaseLine/index.js.map +0 -0
- package/build/esm/BottomSheet/BottomSheet.d.ts +1 -1
- package/build/esm/BottomSheet/BottomSheet.js.map +0 -0
- package/build/esm/BottomSheet/BottomSheetSurface.d.ts +1 -1
- package/build/esm/BottomSheet/BottomSheetSurface.js +1 -1
- package/build/esm/BottomSheet/BottomSheetSurface.js.map +1 -1
- package/build/esm/BottomSheet/index.d.ts +0 -0
- package/build/esm/BottomSheet/index.js.map +0 -0
- package/build/esm/Box/Box.d.ts +0 -0
- package/build/esm/Box/Box.js.map +0 -0
- package/build/esm/Box/index.d.ts +0 -0
- package/build/esm/Box/index.js.map +0 -0
- package/build/esm/Button/BaseButton.d.ts +2 -1
- package/build/esm/Button/BaseButton.js.map +1 -1
- package/build/esm/Button/Button.d.ts +3 -3
- package/build/esm/Button/Button.js +22 -6
- package/build/esm/Button/Button.js.map +1 -1
- package/build/esm/Button/ButtonGroup.d.ts +5 -0
- package/build/esm/Button/ButtonGroup.js +28 -0
- package/build/esm/Button/ButtonGroup.js.map +1 -0
- package/build/esm/Button/FilledButton.d.ts +2 -1
- package/build/esm/Button/FilledButton.js +36 -3
- package/build/esm/Button/FilledButton.js.map +1 -1
- package/build/esm/Button/IconButton.d.ts +1 -0
- package/build/esm/Button/IconButton.js +2 -1
- package/build/esm/Button/IconButton.js.map +1 -1
- package/build/esm/Button/OutlinedButton.d.ts +1 -1
- package/build/esm/Button/OutlinedButton.js +32 -2
- package/build/esm/Button/OutlinedButton.js.map +1 -1
- package/build/esm/Button/TransparentButton.d.ts +2 -1
- package/build/esm/Button/TransparentButton.js +32 -2
- package/build/esm/Button/TransparentButton.js.map +1 -1
- package/build/esm/Button/context.d.ts +8 -0
- package/build/esm/Button/context.js +5 -0
- package/build/esm/Button/context.js.map +1 -0
- package/build/esm/Button/index.d.ts +1 -0
- package/build/esm/Button/index.js +1 -0
- package/build/esm/Button/index.js.map +1 -1
- package/build/esm/CheckBox/CheckBox.d.ts +1 -1
- package/build/esm/CheckBox/CheckBox.js +1 -1
- package/build/esm/CheckBox/CheckBox.js.map +1 -1
- package/build/esm/CheckBox/CheckBoxIcon.d.ts +1 -1
- package/build/esm/CheckBox/CheckBoxIcon.js.map +0 -0
- package/build/esm/CheckBox/CheckPath.d.ts +0 -0
- package/build/esm/CheckBox/CheckPath.js.map +0 -0
- package/build/esm/CheckBox/IndeterminatePath.d.ts +0 -0
- package/build/esm/CheckBox/IndeterminatePath.js.map +0 -0
- package/build/esm/CheckBox/index.d.ts +0 -0
- package/build/esm/CheckBox/index.js.map +0 -0
- package/build/esm/Chip/ButtonChip.d.ts +3 -3
- package/build/esm/Chip/ButtonChip.js +41 -53
- package/build/esm/Chip/ButtonChip.js.map +1 -1
- package/build/esm/Chip/Chip.d.ts +0 -0
- package/build/esm/Chip/Chip.js.map +0 -0
- package/build/esm/Chip/ChipBase.d.ts +1 -1
- package/build/esm/Chip/ChipBase.js +23 -15
- package/build/esm/Chip/ChipBase.js.map +1 -1
- package/build/esm/Chip/ChoiceChip.d.ts +3 -2
- package/build/esm/Chip/ChoiceChip.js +18 -24
- package/build/esm/Chip/ChoiceChip.js.map +1 -1
- package/build/esm/Chip/index.d.ts +0 -0
- package/build/esm/Chip/index.js.map +0 -0
- package/build/esm/ColorMode/ColorModeProvider.d.ts +0 -0
- package/build/esm/ColorMode/ColorModeProvider.js.map +0 -0
- package/build/esm/ColorMode/color-mode.d.ts +0 -0
- package/build/esm/ColorMode/color-mode.js.map +0 -0
- package/build/esm/ColorMode/color-vars.d.ts +0 -0
- package/build/esm/ColorMode/color-vars.js.map +0 -0
- package/build/esm/ColorMode/constants.d.ts +0 -0
- package/build/esm/ColorMode/constants.js.map +0 -0
- package/build/esm/ColorMode/index.d.ts +0 -0
- package/build/esm/ColorMode/index.js.map +0 -0
- package/build/esm/Combobox/Combobox.d.ts +7 -7
- package/build/esm/Combobox/Combobox.js +2 -1
- package/build/esm/Combobox/Combobox.js.map +1 -1
- package/build/esm/Combobox/index.d.ts +0 -0
- package/build/esm/Combobox/index.js.map +0 -0
- package/build/esm/Dialog/Dialog.d.ts +1 -1
- package/build/esm/Dialog/Dialog.js.map +0 -0
- package/build/esm/Dialog/DialogBackdrop.d.ts +1 -1
- package/build/esm/Dialog/DialogBackdrop.js.map +0 -0
- package/build/esm/Dialog/DialogContainer.d.ts +1 -1
- package/build/esm/Dialog/DialogContainer.js.map +0 -0
- package/build/esm/Dialog/DialogSurface.d.ts +4 -2
- package/build/esm/Dialog/DialogSurface.js +19 -7
- package/build/esm/Dialog/DialogSurface.js.map +1 -1
- package/build/esm/Dialog/Scrim.d.ts +1 -1
- package/build/esm/Dialog/Scrim.js.map +0 -0
- package/build/esm/Dialog/index.d.ts +0 -0
- package/build/esm/Dialog/index.js.map +0 -0
- package/build/esm/Dialog/useDialogAnimation.d.ts +0 -0
- package/build/esm/Dialog/useDialogAnimation.js.map +0 -0
- package/build/esm/Divider/Divider.d.ts +1 -1
- package/build/esm/Divider/Divider.js.map +0 -0
- package/build/esm/Divider/index.d.ts +0 -0
- package/build/esm/Divider/index.js.map +0 -0
- package/build/esm/FloatingLabel/FloatingLabel.d.ts +0 -1
- package/build/esm/FloatingLabel/FloatingLabel.js +1 -3
- package/build/esm/FloatingLabel/FloatingLabel.js.map +1 -1
- package/build/esm/FloatingLabel/index.d.ts +0 -0
- package/build/esm/FloatingLabel/index.js.map +0 -0
- package/build/esm/LineRipple/LineRipple.d.ts +1 -1
- package/build/esm/LineRipple/LineRipple.js.map +0 -0
- package/build/esm/LineRipple/index.d.ts +0 -0
- package/build/esm/LineRipple/index.js.map +0 -0
- package/build/esm/Link/Link.d.ts +1 -1
- package/build/esm/Link/Link.js.map +0 -0
- package/build/esm/Link/index.d.ts +0 -0
- package/build/esm/Link/index.js.map +0 -0
- package/build/esm/List/List.d.ts +1 -1
- package/build/esm/List/List.js.map +0 -0
- package/build/esm/List/index.d.ts +0 -0
- package/build/esm/List/index.js.map +0 -0
- package/build/esm/ListItem/ListItem.d.ts +1 -1
- package/build/esm/ListItem/ListItem.js +52 -33
- package/build/esm/ListItem/ListItem.js.map +1 -1
- package/build/esm/ListItem/ListItemText.d.ts +0 -0
- package/build/esm/ListItem/ListItemText.js +2 -7
- package/build/esm/ListItem/ListItemText.js.map +1 -1
- package/build/esm/ListItem/context.d.ts +0 -0
- package/build/esm/ListItem/context.js.map +0 -0
- package/build/esm/ListItem/index.d.ts +0 -0
- package/build/esm/ListItem/index.js.map +0 -0
- package/build/esm/Menu/Menu.d.ts +4 -4
- package/build/esm/Menu/Menu.js +2 -2
- package/build/esm/Menu/Menu.js.map +1 -1
- package/build/esm/Menu/animation.d.ts +0 -0
- package/build/esm/Menu/animation.js.map +0 -0
- package/build/esm/Menu/index.d.ts +0 -0
- package/build/esm/Menu/index.js.map +0 -0
- package/build/esm/NotchedOutline/NotchedOutline.d.ts +0 -0
- package/build/esm/NotchedOutline/NotchedOutline.js.map +0 -0
- package/build/esm/NotchedOutline/context.d.ts +0 -0
- package/build/esm/NotchedOutline/context.js.map +0 -0
- package/build/esm/NotchedOutline/index.d.ts +0 -0
- package/build/esm/NotchedOutline/index.js.map +0 -0
- package/build/esm/NotchedOutline/styledComponents.d.ts +96 -50
- package/build/esm/NotchedOutline/styledComponents.js +7 -7
- package/build/esm/NotchedOutline/styledComponents.js.map +1 -1
- package/build/esm/Paper/Paper.d.ts +1 -1
- package/build/esm/Paper/Paper.js +2 -2
- package/build/esm/Paper/Paper.js.map +1 -1
- package/build/esm/Paper/index.d.ts +0 -0
- package/build/esm/Paper/index.js.map +0 -0
- package/build/esm/ProgressSpinner/ProgressSpinner.d.ts +1 -1
- package/build/esm/ProgressSpinner/ProgressSpinner.js.map +0 -0
- package/build/esm/ProgressSpinner/index.d.ts +0 -0
- package/build/esm/ProgressSpinner/index.js.map +0 -0
- package/build/esm/RadioButton/RadioButton.d.ts +0 -0
- package/build/esm/RadioButton/RadioButton.js +1 -1
- package/build/esm/RadioButton/RadioButton.js.map +1 -1
- package/build/esm/RadioButton/RadioButtonIcon.d.ts +0 -0
- package/build/esm/RadioButton/RadioButtonIcon.js +2 -2
- package/build/esm/RadioButton/RadioButtonIcon.js.map +1 -1
- package/build/esm/RadioButton/RadioGroup.d.ts +1 -1
- package/build/esm/RadioButton/RadioGroup.js.map +0 -0
- package/build/esm/RadioButton/index.d.ts +0 -0
- package/build/esm/RadioButton/index.js.map +0 -0
- package/build/esm/Ripple/Ripple.d.ts +0 -0
- package/build/esm/Ripple/Ripple.js +2 -2
- package/build/esm/Ripple/Ripple.js.map +1 -1
- package/build/esm/Ripple/RippleBox.d.ts +0 -0
- package/build/esm/Ripple/RippleBox.js +1 -1
- package/build/esm/Ripple/RippleBox.js.map +1 -1
- package/build/esm/Ripple/constants.d.ts +0 -0
- package/build/esm/Ripple/constants.js.map +0 -0
- package/build/esm/Ripple/index.d.ts +0 -0
- package/build/esm/Ripple/index.js.map +0 -0
- package/build/esm/Ripple/keyframes.d.ts +0 -0
- package/build/esm/Ripple/keyframes.js.map +0 -0
- package/build/esm/Ripple/useRipple.d.ts +0 -0
- package/build/esm/Ripple/useRipple.js.map +0 -0
- package/build/esm/Ripple/useRippleHandlers.d.ts +0 -0
- package/build/esm/Ripple/useRippleHandlers.js.map +0 -0
- package/build/esm/Ripple/useRippleSurface.d.ts +5 -4
- package/build/esm/Ripple/useRippleSurface.js +30 -8
- package/build/esm/Ripple/useRippleSurface.js.map +1 -1
- package/build/esm/Select/Select.d.ts +3 -3
- package/build/esm/Select/Select.js +5 -14
- package/build/esm/Select/Select.js.map +1 -1
- package/build/esm/Select/SelectIcon.d.ts +1 -1
- package/build/esm/Select/SelectIcon.js +3 -1
- package/build/esm/Select/SelectIcon.js.map +1 -1
- package/build/esm/Select/context.d.ts +0 -0
- package/build/esm/Select/context.js.map +0 -0
- package/build/esm/Select/defaultRender.d.ts +0 -0
- package/build/esm/Select/defaultRender.js.map +0 -0
- package/build/esm/Select/index.d.ts +0 -0
- package/build/esm/Select/index.js.map +0 -0
- package/build/esm/Select/styledComponents.d.ts +0 -0
- package/build/esm/Select/styledComponents.js +9 -5
- package/build/esm/Select/styledComponents.js.map +1 -1
- package/build/esm/SelectItem/SelectItem.d.ts +1 -1
- package/build/esm/SelectItem/SelectItem.js.map +0 -0
- package/build/esm/SelectItem/index.d.ts +0 -0
- package/build/esm/SelectItem/index.js.map +0 -0
- package/build/esm/SelectionControl/SelectionControlLabel.d.ts +1 -1
- package/build/esm/SelectionControl/SelectionControlLabel.js.map +0 -0
- package/build/esm/SelectionControl/SelectionControlText.d.ts +1 -1
- package/build/esm/SelectionControl/SelectionControlText.js.map +0 -0
- package/build/esm/SelectionControl/index.d.ts +0 -0
- package/build/esm/SelectionControl/index.js.map +0 -0
- package/build/esm/Skeleton/DelayAppearance.d.ts +1 -1
- package/build/esm/Skeleton/DelayAppearance.js.map +0 -0
- package/build/esm/Skeleton/Skeleton.d.ts +1 -1
- package/build/esm/Skeleton/Skeleton.js.map +0 -0
- package/build/esm/Skeleton/animation.d.ts +0 -0
- package/build/esm/Skeleton/animation.js.map +0 -0
- package/build/esm/Skeleton/index.d.ts +0 -0
- package/build/esm/Skeleton/index.js.map +0 -0
- package/build/esm/Snackbar/Snackbar.d.ts +1 -1
- package/build/esm/Snackbar/Snackbar.js +4 -4
- package/build/esm/Snackbar/Snackbar.js.map +1 -1
- package/build/esm/Snackbar/Stack.d.ts +0 -0
- package/build/esm/Snackbar/Stack.js.map +0 -0
- package/build/esm/Snackbar/index.d.ts +0 -0
- package/build/esm/Snackbar/index.js.map +0 -0
- package/build/esm/Snackbar/useSnackbarAnimation.d.ts +0 -0
- package/build/esm/Snackbar/useSnackbarAnimation.js.map +0 -0
- package/build/esm/Switch/Switch.d.ts +1 -1
- package/build/esm/Switch/Switch.js +8 -6
- package/build/esm/Switch/Switch.js.map +1 -1
- package/build/esm/Switch/index.d.ts +0 -0
- package/build/esm/Switch/index.js.map +0 -0
- package/build/esm/Switch/styledComponents.d.ts +2 -2
- package/build/esm/Switch/styledComponents.js +54 -26
- package/build/esm/Switch/styledComponents.js.map +1 -1
- package/build/esm/Tab/Tab.d.ts +1 -1
- package/build/esm/Tab/Tab.js.map +0 -0
- package/build/esm/Tab/TabList.d.ts +1 -1
- package/build/esm/Tab/TabList.js.map +0 -0
- package/build/esm/Tab/TabPanel.d.ts +1 -1
- package/build/esm/Tab/TabPanel.js.map +0 -0
- package/build/esm/Tab/TabPanels.d.ts +0 -0
- package/build/esm/Tab/TabPanels.js.map +0 -0
- package/build/esm/Tab/Tabs.d.ts +0 -0
- package/build/esm/Tab/Tabs.js.map +0 -0
- package/build/esm/Tab/context.d.ts +0 -0
- package/build/esm/Tab/context.js.map +0 -0
- package/build/esm/Tab/index.d.ts +0 -0
- package/build/esm/Tab/index.js.map +0 -0
- package/build/esm/TabIndicator/TabIndicator.d.ts +1 -1
- package/build/esm/TabIndicator/TabIndicator.js.map +0 -0
- package/build/esm/TabIndicator/context.d.ts +0 -0
- package/build/esm/TabIndicator/context.js.map +0 -0
- package/build/esm/TabIndicator/index.d.ts +0 -0
- package/build/esm/TabIndicator/index.js.map +0 -0
- package/build/esm/Table/Table.d.ts +1 -1
- package/build/esm/Table/Table.js +1 -1
- package/build/esm/Table/Table.js.map +1 -1
- package/build/esm/Table/TableBody.d.ts +1 -1
- package/build/esm/Table/TableBody.js.map +0 -0
- package/build/esm/Table/TableCell.d.ts +1 -1
- package/build/esm/Table/TableCell.js.map +0 -0
- package/build/esm/Table/TableHead.d.ts +1 -1
- package/build/esm/Table/TableHead.js.map +0 -0
- package/build/esm/Table/TableRow.d.ts +1 -1
- package/build/esm/Table/TableRow.js.map +0 -0
- package/build/esm/Table/context.d.ts +0 -0
- package/build/esm/Table/context.js.map +0 -0
- package/build/esm/Table/index.d.ts +0 -0
- package/build/esm/Table/index.js.map +0 -0
- package/build/esm/Text/LoremIpsum.d.ts +4 -4
- package/build/esm/Text/LoremIpsum.js.map +1 -1
- package/build/esm/Text/Text.d.ts +1 -1
- package/build/esm/Text/Text.js.map +0 -0
- package/build/esm/Text/index.d.ts +0 -0
- package/build/esm/Text/index.js.map +0 -0
- package/build/esm/TextField/FilledContainer.d.ts +1 -1
- package/build/esm/TextField/FilledContainer.js +17 -10
- package/build/esm/TextField/FilledContainer.js.map +1 -1
- package/build/esm/TextField/HelperText.d.ts +1 -1
- package/build/esm/TextField/HelperText.js.map +0 -0
- package/build/esm/TextField/IconContainer.d.ts +2 -2
- package/build/esm/TextField/IconContainer.js +4 -2
- package/build/esm/TextField/IconContainer.js.map +1 -1
- package/build/esm/TextField/Input.d.ts +1 -1
- package/build/esm/TextField/Input.js +18 -10
- package/build/esm/TextField/Input.js.map +1 -1
- package/build/esm/TextField/OutlinedContainer.d.ts +1 -1
- package/build/esm/TextField/OutlinedContainer.js +7 -4
- package/build/esm/TextField/OutlinedContainer.js.map +1 -1
- package/build/esm/TextField/TextField.d.ts +1 -1
- package/build/esm/TextField/TextField.js +2 -2
- package/build/esm/TextField/TextField.js.map +1 -1
- package/build/esm/TextField/consts.d.ts +5 -0
- package/build/esm/TextField/consts.js +6 -0
- package/build/esm/TextField/consts.js.map +1 -0
- package/build/esm/TextField/index.d.ts +0 -0
- package/build/esm/TextField/index.js.map +0 -0
- package/build/esm/ThemeExplorer/ColorPicker.js +2 -2
- package/build/esm/ThemeExplorer/ColorPicker.js.map +1 -1
- package/build/esm/ThemeExplorer/TextFieldColorPicker.js +5 -5
- package/build/esm/ThemeExplorer/TextFieldColorPicker.js.map +1 -1
- package/build/esm/Tooltip/Tooltip.d.ts +1 -1
- package/build/esm/Tooltip/Tooltip.js.map +0 -0
- package/build/esm/Tooltip/index.d.ts +0 -0
- package/build/esm/Tooltip/index.js.map +0 -0
- package/build/esm/color.d.ts +2 -1
- package/build/esm/color.js +10 -6
- package/build/esm/color.js.map +1 -1
- package/build/esm/css.d.ts +0 -0
- package/build/esm/css.js.map +0 -0
- package/build/esm/hooks/useAnimation.d.ts +0 -0
- package/build/esm/hooks/useAnimation.js.map +0 -0
- package/build/esm/index.d.ts +0 -0
- package/build/esm/index.js.map +0 -0
- package/build/esm/theme/index.d.ts +0 -0
- package/build/esm/theme/index.js.map +0 -0
- package/build/esm/theme/theme.d.ts +96 -50
- package/build/esm/theme/theme.js +133 -93
- package/build/esm/theme/theme.js.map +1 -1
- package/build/esm/theme/typography-raleway.d.ts +0 -0
- package/build/esm/theme/typography-raleway.js.map +0 -0
- package/build/esm/theme/typography-roboto.d.ts +0 -0
- package/build/esm/theme/typography-roboto.js.map +0 -0
- package/build/esm/theme/useTheme.d.ts +471 -1
- package/build/esm/theme/useTheme.js.map +0 -0
- package/build/tsconfig.tsbuildinfo +1 -4757
- package/package.json +15 -14
- package/src/Alert/Alert.story.tsx +5 -6
- package/src/Alert/Alert.tsx +1 -1
- package/src/AppBar/AppBar.story.tsx +11 -20
- package/src/AppBar/AppBar.tsx +5 -6
- package/src/BottomSheet/BottomSheet.story.tsx +5 -6
- package/src/BottomSheet/BottomSheetSurface.tsx +1 -1
- package/src/Button/BaseButton.tsx +1 -0
- package/src/Button/Button.story.tsx +34 -47
- package/src/Button/Button.tsx +20 -6
- package/src/Button/ButtonGroup.story.tsx +106 -0
- package/src/Button/ButtonGroup.tsx +33 -0
- package/src/Button/FilledButton.tsx +38 -4
- package/src/Button/FloatingActionButton.tsx +9 -0
- package/src/Button/IconButton.tsx +1 -0
- package/src/Button/OutlinedButton.tsx +30 -2
- package/src/Button/SpinnerButton.story.tsx +7 -7
- package/src/Button/TransparentButton.tsx +32 -1
- package/src/Button/context.tsx +16 -0
- package/src/Button/index.ts +1 -0
- package/src/CheckBox/CheckBox.story.tsx +7 -6
- package/src/CheckBox/CheckBox.tsx +1 -1
- package/src/Chip/ButtonChip.tsx +42 -46
- package/src/Chip/Chip.story.tsx +98 -26
- package/src/Chip/ChipBase.tsx +40 -12
- package/src/Chip/ChoiceChip.tsx +18 -17
- package/src/Combobox/Combobox.story.tsx +12 -13
- package/src/Combobox/Combobox.tsx +2 -1
- package/src/Dialog/Dialog.story.tsx +7 -8
- package/src/Dialog/DialogSurface.tsx +20 -5
- package/src/Divider/Divider.story.tsx +6 -5
- package/src/FloatingLabel/FloatingLabel.story.tsx +10 -9
- package/src/FloatingLabel/FloatingLabel.tsx +0 -3
- package/src/LineRipple/LineRipple.story.tsx +5 -4
- package/src/Link/Link.story.tsx +3 -4
- package/src/ListItem/ListItem.story.tsx +6 -5
- package/src/ListItem/ListItem.tsx +55 -32
- package/src/ListItem/ListItemText.tsx +2 -4
- package/src/Menu/Menu.story.tsx +8 -7
- package/src/Menu/Menu.tsx +2 -2
- package/src/NotchedOutline/NotchedOutline.story.tsx +6 -5
- package/src/NotchedOutline/styledComponents.ts +6 -6
- package/src/Paper/Paper.story.tsx +21 -7
- package/src/Paper/Paper.tsx +6 -2
- package/src/ProgressSpinner/ProgressSpinner.story.tsx +5 -4
- package/src/RadioButton/RadioButton.story.tsx +12 -10
- package/src/RadioButton/RadioButton.tsx +1 -1
- package/src/RadioButton/RadioButtonIcon.tsx +2 -2
- package/src/Ripple/Ripple.story.tsx +6 -5
- package/src/Ripple/Ripple.tsx +1 -1
- package/src/Ripple/RippleBox.tsx +1 -0
- package/src/Ripple/useRippleSurface.ts +31 -7
- package/src/Select/PaymentMethodSelect.story.tsx +321 -0
- package/src/Select/Select.story.tsx +34 -8
- package/src/Select/Select.tsx +12 -34
- package/src/Select/SelectIcon.tsx +2 -1
- package/src/Select/styledComponents.tsx +8 -4
- package/src/Skeleton/Skeleton.story.tsx +9 -8
- package/src/Snackbar/Snackbar.story.tsx +7 -6
- package/src/Snackbar/Snackbar.tsx +4 -4
- package/src/Switch/Switch.story.tsx +5 -4
- package/src/Switch/Switch.tsx +7 -6
- package/src/Switch/styledComponents.tsx +69 -22
- package/src/Tab/Tab.story.tsx +7 -5
- package/src/Table/Table.story.tsx +5 -4
- package/src/Table/Table.tsx +1 -1
- package/src/Text/LoremIpsum.tsx +3 -1
- package/src/Text/Text.story.tsx +5 -4
- package/src/TextField/FilledContainer.tsx +30 -10
- package/src/TextField/IconContainer.tsx +5 -4
- package/src/TextField/Input.tsx +33 -10
- package/src/TextField/OutlinedContainer.tsx +18 -4
- package/src/TextField/TextField.story.tsx +21 -7
- package/src/TextField/TextField.tsx +2 -2
- package/src/TextField/consts.ts +7 -0
- package/src/ThemeExplorer/ColorPicker.tsx +101 -0
- package/src/ThemeExplorer/TextFieldColorPicker.tsx +112 -0
- package/src/ThemeExplorer/ThemeBuilder.story.tsx +169 -0
- package/src/ThemeExplorer/ThemeColors.tsx +88 -0
- package/src/ThemeExplorer/ThemeExplorer.story.tsx +42 -0
- package/src/ThemeExplorer/components.tsx +208 -0
- package/src/ThemeExplorer/makeColorScheme.tsx +73 -0
- package/src/ThemeExplorer/useDeferredColor.tsx +24 -0
- package/src/ThemeExplorer/useLocalStorageCachedState.ts +18 -0
- package/src/Tooltip/Tooltip.story.tsx +5 -4
- package/src/color.ts +18 -13
- package/src/theme/theme.ts +131 -92
- package/src/ListItem/context.ts +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basic-ui/material",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
4
|
"description": "Accessible React Components used as building blocks for UI patterns",
|
|
5
5
|
"author": "Lucas Terra <lucasterra7@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
],
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "concurrently \"yarn:build:*\"",
|
|
18
|
-
"build:dts": "tsc -p ./tsconfig.json --isolatedModules false --declaration --emitDeclarationOnly",
|
|
19
|
-
"build:cjs": "rollup -c ../../rollup.config.js",
|
|
20
|
-
"build:esm": "cross-env NODE_ENV=production BABEL_ENV=esm babel --config-file ../../babel.config.js ./src --extensions \".ts,.tsx,.js,.jsx\" --source-maps --out-dir ./build/esm --ignore \"**/*.story.tsx,**/*.story.ts,**/*.test.tsx,**/*.test.ts\"",
|
|
21
|
-
"build-storybook": "build-storybook -c
|
|
22
|
-
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
|
|
23
|
-
"format": "prettier --write '**/*.js'",
|
|
24
|
-
"start": "
|
|
25
|
-
"serve": "http-server .out",
|
|
26
|
-
"typecheck": "tsc --noEmit",
|
|
17
|
+
"build": "run -T concurrently \"yarn:build:*\"",
|
|
18
|
+
"build:dts": "run -T tsc -p ./tsconfig.json --isolatedModules false --declaration --emitDeclarationOnly",
|
|
19
|
+
"build:cjs": "run -T rollup -c ../../rollup.config.js",
|
|
20
|
+
"build:esm": "run -T cross-env NODE_ENV=production BABEL_ENV=esm run -T babel --config-file ../../babel.config.js ./src --extensions \".ts,.tsx,.js,.jsx\" --source-maps --out-dir ./build/esm --ignore \"**/*.story.tsx,**/*.story.ts,**/*.test.tsx,**/*.test.ts\"",
|
|
21
|
+
"build-storybook": "run -T build-storybook -c ./scripts/storybook -o .out",
|
|
22
|
+
"lint": "run -T eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
|
|
23
|
+
"format": "run -T prettier --write '**/*.js'",
|
|
24
|
+
"start": "run -T start-storybook -p 9001 -c ./scripts/storybook",
|
|
25
|
+
"serve": "run -T http-server .out",
|
|
26
|
+
"typecheck": "run -T tsc --noEmit -p ./tsconfig.json",
|
|
27
27
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@basic-ui/core": "^0.0.
|
|
30
|
+
"@basic-ui/core": "^0.0.38",
|
|
31
31
|
"@styled-system/should-forward-prop": "5.1.5",
|
|
32
32
|
"@types/styled-system": "^5.1.10",
|
|
33
33
|
"@types/styled-system__css": "^5.0.14",
|
|
@@ -35,8 +35,10 @@
|
|
|
35
35
|
"styled-system": "^5.1.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
+
"@basic-ui/color-picker": "*",
|
|
38
39
|
"@emotion/react": "11.9.0",
|
|
39
40
|
"@emotion/styled": "11.8.1",
|
|
41
|
+
"@material/material-color-utilities": "^0.1.1",
|
|
40
42
|
"polished": "^4.1.1"
|
|
41
43
|
},
|
|
42
44
|
"peerDependencies": {
|
|
@@ -49,6 +51,5 @@
|
|
|
49
51
|
"react": "^16.14.0 || ^17.0.0 || ^18.0.0",
|
|
50
52
|
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0",
|
|
51
53
|
"react-spring": "^9.0.0"
|
|
52
|
-
}
|
|
53
|
-
"gitHead": "6fe8c9cf2cff7546aeb8c6d0b700f78f9ba6e1a5"
|
|
54
|
+
}
|
|
54
55
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Alert } from './';
|
|
2
2
|
import { Link } from '../Link';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
// import './styles.css';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Alert',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const Controlled = () => {
|
|
7
10
|
const color = ['primary', 'secondary', 'error'];
|
|
8
11
|
return (
|
|
9
12
|
<>
|
|
@@ -23,7 +26,3 @@ const Example = () => {
|
|
|
23
26
|
</>
|
|
24
27
|
);
|
|
25
28
|
};
|
|
26
|
-
|
|
27
|
-
const stories = storiesOf('Components/Alert', module);
|
|
28
|
-
|
|
29
|
-
stories.add('controlled', () => <Example />);
|
package/src/Alert/Alert.tsx
CHANGED
|
@@ -19,7 +19,7 @@ export const Alert = forwardRef<HTMLDivElement, AlertProps>(function Alert(
|
|
|
19
19
|
__css={{
|
|
20
20
|
p: 3,
|
|
21
21
|
bg: alpha(color, 0.1),
|
|
22
|
-
borderRadius:
|
|
22
|
+
borderRadius: 'extra-small',
|
|
23
23
|
borderColor: alpha(color, 0.2),
|
|
24
24
|
borderStyle: 'solid',
|
|
25
25
|
borderWidth: rem(1),
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { AppBar, AppBarButton, AppBarProps } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Box } from '../Box';
|
|
5
4
|
import { LoremIpsum } from '../Text/LoremIpsum';
|
|
6
5
|
import { Button } from '../Button';
|
|
7
6
|
import { BaseLine } from '../BaseLine';
|
|
8
7
|
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/AppBar',
|
|
10
|
+
};
|
|
11
|
+
|
|
9
12
|
const MenuIcon = (props) => (
|
|
10
13
|
<svg width={24} height={24} {...props}>
|
|
11
14
|
<path d="M0 0h24v24H0z" fill="none" />
|
|
@@ -54,24 +57,12 @@ const Example = ({ variant, size }) => {
|
|
|
54
57
|
);
|
|
55
58
|
};
|
|
56
59
|
|
|
57
|
-
const
|
|
60
|
+
export const Default = () => <Example variant="default" size="default" />;
|
|
61
|
+
export const Primary = () => <Example variant="primary" size="default" />;
|
|
62
|
+
export const Secondary = () => <Example variant="secondary" size="default" />;
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
62
|
-
stories.add('primary appbar', () => (
|
|
63
|
-
<Example variant="primary" size="default" />
|
|
64
|
-
));
|
|
65
|
-
stories.add('secondary appbar', () => (
|
|
66
|
-
<Example variant="secondary" size="default" />
|
|
67
|
-
));
|
|
68
|
-
|
|
69
|
-
stories.add('default appbar, dense', () => (
|
|
70
|
-
<Example variant="default" size="dense" />
|
|
71
|
-
));
|
|
72
|
-
stories.add('primary appbar, dense', () => (
|
|
73
|
-
<Example variant="primary" size="dense" />
|
|
74
|
-
));
|
|
75
|
-
stories.add('secondary appbar, dense', () => (
|
|
64
|
+
export const DefaultDense = () => <Example variant="default" size="dense" />;
|
|
65
|
+
export const PrimaryDense = () => <Example variant="primary" size="dense" />;
|
|
66
|
+
export const SecondaryDense = () => (
|
|
76
67
|
<Example variant="secondary" size="dense" />
|
|
77
|
-
)
|
|
68
|
+
);
|
package/src/AppBar/AppBar.tsx
CHANGED
|
@@ -54,17 +54,16 @@ export const AppBar = forwardRef<HTMLDivElement, AppBarProps>(function AppBar(
|
|
|
54
54
|
ref={forwardedRef}
|
|
55
55
|
theme={theme}
|
|
56
56
|
variant="square"
|
|
57
|
-
backgroundOverlay={
|
|
57
|
+
backgroundOverlay={
|
|
58
|
+
elevation === 'elevated' && variantProp === 'default'
|
|
59
|
+
? get(theme, `appbar.elevations.${elevation}.boxShadow`, 2)
|
|
60
|
+
: 0
|
|
61
|
+
}
|
|
58
62
|
color={
|
|
59
63
|
variantProp === 'default' || variantProp === 'transparent'
|
|
60
64
|
? 'on.surface'
|
|
61
65
|
: `on.${variantProp}`
|
|
62
66
|
}
|
|
63
|
-
elevation={
|
|
64
|
-
elevation === 'elevated'
|
|
65
|
-
? get(theme, `appbar.elevations.${elevation}.boxShadow`, 4)
|
|
66
|
-
: 0
|
|
67
|
-
}
|
|
68
67
|
__css={{
|
|
69
68
|
boxSizing: 'border-box',
|
|
70
69
|
display: 'inline-flex',
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { BottomSheet } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Button } from '../Button';
|
|
5
4
|
import { LoremIpsum } from '../Text/LoremIpsum';
|
|
6
5
|
import { Box } from '../Box';
|
|
7
6
|
import { Switch } from '../Switch';
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
export default {
|
|
9
|
+
title: 'components/BottomSheet',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Default = () => {
|
|
10
13
|
const [open, setOpen] = useState(false);
|
|
11
14
|
const [long, setLong] = useState(false);
|
|
12
15
|
|
|
@@ -29,7 +32,3 @@ const Example = () => {
|
|
|
29
32
|
</Box>
|
|
30
33
|
);
|
|
31
34
|
};
|
|
32
|
-
|
|
33
|
-
const stories = storiesOf('Components/BottomSheet', module);
|
|
34
|
-
|
|
35
|
-
stories.add('bottomsheet', () => <Example />);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Button } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Box } from '../Box';
|
|
5
4
|
|
|
5
|
+
export default {
|
|
6
|
+
title: 'components/Button',
|
|
7
|
+
};
|
|
8
|
+
|
|
6
9
|
const AppsIcon = (props) => (
|
|
7
10
|
<svg width={24} height={24} {...props}>
|
|
8
11
|
<path
|
|
@@ -16,11 +19,12 @@ const AppsIcon = (props) => (
|
|
|
16
19
|
const Example = (props) => {
|
|
17
20
|
return (
|
|
18
21
|
<Box bg="surface">
|
|
19
|
-
<Box p={3}>
|
|
22
|
+
<Box p={3} display="flex" sx={{ gap: 2 }}>
|
|
23
|
+
<Button variant="filled" {...props}>
|
|
24
|
+
Filled
|
|
25
|
+
</Button>
|
|
20
26
|
<Button
|
|
21
27
|
variant="text"
|
|
22
|
-
mr={2}
|
|
23
|
-
mb={2}
|
|
24
28
|
{...props}
|
|
25
29
|
color={props.colorTransparent || props.color}
|
|
26
30
|
>
|
|
@@ -28,58 +32,44 @@ const Example = (props) => {
|
|
|
28
32
|
</Button>
|
|
29
33
|
<Button
|
|
30
34
|
variant="outlined"
|
|
31
|
-
mr={2}
|
|
32
|
-
mb={2}
|
|
33
35
|
{...props}
|
|
34
36
|
color={props.colorTransparent || props.color}
|
|
35
37
|
>
|
|
36
38
|
Outlined
|
|
37
39
|
</Button>
|
|
38
|
-
<Button variant="filled"
|
|
39
|
-
|
|
40
|
-
</Button>
|
|
41
|
-
<Button variant="filled" elevation="contained" mr={2} mb={2} {...props}>
|
|
42
|
-
Contained
|
|
40
|
+
<Button variant="filled" elevation="elevated" {...props}>
|
|
41
|
+
Elevated
|
|
43
42
|
</Button>
|
|
44
43
|
</Box>
|
|
45
|
-
<Box p={3}>
|
|
46
|
-
<Button variant="fab" elevation="floating"
|
|
44
|
+
<Box p={3} display="flex" sx={{ gap: 2 }}>
|
|
45
|
+
<Button variant="fab-mini" elevation="floating" {...props}>
|
|
47
46
|
S
|
|
48
47
|
</Button>
|
|
49
|
-
<Button
|
|
50
|
-
variant="fab-mini"
|
|
51
|
-
elevation="floating"
|
|
52
|
-
mr={2}
|
|
53
|
-
mb={2}
|
|
54
|
-
{...props}
|
|
55
|
-
>
|
|
48
|
+
<Button variant="fab" elevation="floating" {...props}>
|
|
56
49
|
S
|
|
57
50
|
</Button>
|
|
58
|
-
<Button
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
mb={2}
|
|
63
|
-
{...props}
|
|
64
|
-
>
|
|
51
|
+
<Button variant="fab-large" elevation="floating" {...props}>
|
|
52
|
+
S
|
|
53
|
+
</Button>
|
|
54
|
+
<Button variant="fab-extended" elevation="floating" {...props}>
|
|
65
55
|
Fab extended
|
|
66
56
|
</Button>
|
|
67
57
|
</Box>
|
|
68
|
-
<Box p={3}>
|
|
69
|
-
<Box bg={props.color} display="inline-block"
|
|
70
|
-
<Button variant="icon"
|
|
58
|
+
<Box p={3} display="flex" sx={{ gap: 2 }}>
|
|
59
|
+
<Box bg={props.color} display="inline-block">
|
|
60
|
+
<Button variant="icon" {...props} color={`on.${props.color}`}>
|
|
71
61
|
<AppsIcon title="apps icon" />
|
|
72
62
|
</Button>
|
|
73
63
|
</Box>
|
|
74
|
-
<Box bg={'#333'} display="inline-block"
|
|
75
|
-
<Button variant="icon"
|
|
64
|
+
<Box bg={'#333'} display="inline-block">
|
|
65
|
+
<Button variant="icon" {...props} color="#fff">
|
|
76
66
|
<AppsIcon title="apps icon" />
|
|
77
67
|
</Button>
|
|
78
68
|
</Box>
|
|
79
|
-
<Button variant="icon"
|
|
69
|
+
<Button variant="icon" {...props} color="on.surface">
|
|
80
70
|
<AppsIcon title="apps icon" />
|
|
81
71
|
</Button>
|
|
82
|
-
<Button variant="icon"
|
|
72
|
+
<Button variant="icon" {...props} color="#f00">
|
|
83
73
|
<AppsIcon title="apps icon" />
|
|
84
74
|
</Button>
|
|
85
75
|
</Box>
|
|
@@ -87,12 +77,11 @@ const Example = (props) => {
|
|
|
87
77
|
);
|
|
88
78
|
};
|
|
89
79
|
|
|
90
|
-
const stories = storiesOf('Components/Button', module);
|
|
91
80
|
const onClick = (e) => {
|
|
92
81
|
console.log('I got clicked', e.target.innerText);
|
|
93
82
|
};
|
|
94
83
|
|
|
95
|
-
const
|
|
84
|
+
export const DebugButtonClick = () => {
|
|
96
85
|
const [count, setCount] = useState(0);
|
|
97
86
|
|
|
98
87
|
return (
|
|
@@ -104,22 +93,20 @@ const ButtonDebug = () => {
|
|
|
104
93
|
);
|
|
105
94
|
};
|
|
106
95
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
stories.add('default', () => (
|
|
96
|
+
export const Default = () => (
|
|
110
97
|
<Example color="surface" colorTransparent="on.surface" onClick={onClick} />
|
|
111
|
-
)
|
|
98
|
+
);
|
|
112
99
|
|
|
113
|
-
|
|
100
|
+
export const Primary = () => <Example color="primary" onClick={onClick} />;
|
|
114
101
|
|
|
115
|
-
|
|
102
|
+
export const Secondary = () => <Example color="secondary" onClick={onClick} />;
|
|
116
103
|
|
|
117
|
-
|
|
104
|
+
export const Error = () => <Example color="error" onClick={onClick} />;
|
|
118
105
|
|
|
119
|
-
|
|
106
|
+
export const Disabled = () => (
|
|
120
107
|
<Example color="primary" disabled={true} onClick={onClick} />
|
|
121
|
-
)
|
|
108
|
+
);
|
|
122
109
|
|
|
123
|
-
|
|
110
|
+
export const DisabledSecondary = () => (
|
|
124
111
|
<Example color="secondary" disabled={true} onClick={onClick} />
|
|
125
|
-
)
|
|
112
|
+
);
|
package/src/Button/Button.tsx
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import type * as React from 'react';
|
|
3
3
|
import * as TransparentButton from './TransparentButton';
|
|
4
|
+
import * as FloatingActionButton from './FloatingActionButton';
|
|
4
5
|
import * as FilledButton from './FilledButton';
|
|
5
6
|
import * as OutlinedButton from './OutlinedButton';
|
|
6
7
|
import * as IconButton from './IconButton';
|
|
7
8
|
import { useTheme } from '../theme';
|
|
8
9
|
import { useRippleSurface } from '../Ripple';
|
|
9
10
|
import { BaseButtonProps } from './BaseButton';
|
|
11
|
+
import { useButtonGroupContext } from './context';
|
|
10
12
|
|
|
11
13
|
export type ButtonVariants =
|
|
12
14
|
| 'text'
|
|
@@ -14,6 +16,7 @@ export type ButtonVariants =
|
|
|
14
16
|
| 'filled'
|
|
15
17
|
| 'fab'
|
|
16
18
|
| 'fab-mini'
|
|
19
|
+
| 'fab-large'
|
|
17
20
|
| 'fab-extended'
|
|
18
21
|
| 'icon';
|
|
19
22
|
|
|
@@ -22,8 +25,9 @@ const componentMapping = {
|
|
|
22
25
|
outlined: OutlinedButton.OutlinedButton,
|
|
23
26
|
filled: FilledButton.FilledButton,
|
|
24
27
|
fab: FilledButton.FilledButton,
|
|
25
|
-
'fab-extended': FilledButton.FilledButton,
|
|
26
28
|
'fab-mini': FilledButton.FilledButton,
|
|
29
|
+
'fab-large': FilledButton.FilledButton,
|
|
30
|
+
'fab-extended': FilledButton.FilledButton,
|
|
27
31
|
icon: TransparentButton.TransparentButton,
|
|
28
32
|
};
|
|
29
33
|
|
|
@@ -31,9 +35,10 @@ const rippleMapping = {
|
|
|
31
35
|
text: TransparentButton.getRippleProperties,
|
|
32
36
|
outlined: TransparentButton.getRippleProperties,
|
|
33
37
|
filled: FilledButton.getRippleProperties,
|
|
34
|
-
fab:
|
|
38
|
+
fab: FloatingActionButton.getRippleProperties,
|
|
39
|
+
'fab-mini': FloatingActionButton.getRippleProperties,
|
|
40
|
+
'fab-large': FloatingActionButton.getRippleProperties,
|
|
35
41
|
'fab-extended': FilledButton.getRippleProperties,
|
|
36
|
-
'fab-mini': FilledButton.getRippleProperties,
|
|
37
42
|
icon: IconButton.getRippleProperties,
|
|
38
43
|
};
|
|
39
44
|
|
|
@@ -45,19 +50,27 @@ export interface ButtonProps extends BaseButtonProps {
|
|
|
45
50
|
variant?: ButtonVariants;
|
|
46
51
|
color?: ButtonColors;
|
|
47
52
|
disabled?: boolean;
|
|
48
|
-
elevation?: 'none' | 'contained' | 'floating';
|
|
53
|
+
elevation?: 'none' | 'default' | 'contained' | 'floating' | 'elevated';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getFallbackElevation(variant: ButtonVariants = 'text') {
|
|
57
|
+
if (variant === 'text' || variant === 'outlined' || variant === 'icon') {
|
|
58
|
+
return 'none';
|
|
59
|
+
}
|
|
60
|
+
return 'default';
|
|
49
61
|
}
|
|
50
62
|
|
|
51
63
|
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
52
64
|
function Button(props, forwardedRef) {
|
|
65
|
+
const buttonGroup = useButtonGroupContext();
|
|
53
66
|
const {
|
|
54
67
|
children,
|
|
55
|
-
variant = 'text',
|
|
68
|
+
variant = buttonGroup?.variant || 'text',
|
|
56
69
|
onPointerDown: onPointerDownProp,
|
|
57
70
|
onKeyDown: onKeyDownProp,
|
|
58
71
|
color = 'primary',
|
|
59
72
|
disabled = false,
|
|
60
|
-
elevation =
|
|
73
|
+
elevation = getFallbackElevation(props.variant),
|
|
61
74
|
style: styleProp,
|
|
62
75
|
...otherProps
|
|
63
76
|
} = props;
|
|
@@ -85,6 +98,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
85
98
|
aria-disabled={disabled ? 'true' : undefined}
|
|
86
99
|
color={color}
|
|
87
100
|
elevation={elevation}
|
|
101
|
+
isGroupedButton={Boolean(buttonGroup)}
|
|
88
102
|
{...rippleProps}
|
|
89
103
|
{...otherProps}
|
|
90
104
|
>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Box } from '../Box';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
import { ButtonGroup as BaseButtonGroup } from './ButtonGroup';
|
|
4
|
+
|
|
5
|
+
export default { title: 'components/ButtonGroup' };
|
|
6
|
+
|
|
7
|
+
const Example = () => {
|
|
8
|
+
return (
|
|
9
|
+
<Box sx={{ gap: 24, flexDirection: 'column', display: 'flex' }}>
|
|
10
|
+
<BaseButtonGroup variant="text">
|
|
11
|
+
<Button>Hello</Button>
|
|
12
|
+
<Button>Hello</Button>
|
|
13
|
+
</BaseButtonGroup>
|
|
14
|
+
<BaseButtonGroup variant="text">
|
|
15
|
+
<Button>Hello</Button>
|
|
16
|
+
<Button>Hello</Button>
|
|
17
|
+
<Button>Hello</Button>
|
|
18
|
+
</BaseButtonGroup>
|
|
19
|
+
<BaseButtonGroup variant="text">
|
|
20
|
+
<Button>Hello</Button>
|
|
21
|
+
<Button disabled>Hello</Button>
|
|
22
|
+
<Button>Hello</Button>
|
|
23
|
+
</BaseButtonGroup>
|
|
24
|
+
<BaseButtonGroup variant="filled">
|
|
25
|
+
<Button>Hello</Button>
|
|
26
|
+
<Button>Hello</Button>
|
|
27
|
+
</BaseButtonGroup>
|
|
28
|
+
<BaseButtonGroup variant="filled">
|
|
29
|
+
<Button>Hello</Button>
|
|
30
|
+
<Button>Hello</Button>
|
|
31
|
+
<Button>Hello</Button>
|
|
32
|
+
</BaseButtonGroup>
|
|
33
|
+
<BaseButtonGroup variant="filled">
|
|
34
|
+
<Button>Hello</Button>
|
|
35
|
+
<Button disabled>Hello</Button>
|
|
36
|
+
<Button>Hello</Button>
|
|
37
|
+
</BaseButtonGroup>
|
|
38
|
+
<BaseButtonGroup variant="outlined">
|
|
39
|
+
<Button>Hello</Button>
|
|
40
|
+
<Button>Hello</Button>
|
|
41
|
+
</BaseButtonGroup>
|
|
42
|
+
<BaseButtonGroup variant="outlined">
|
|
43
|
+
<Button>Hello</Button>
|
|
44
|
+
<Button>Hello</Button>
|
|
45
|
+
<Button>Hello</Button>
|
|
46
|
+
</BaseButtonGroup>
|
|
47
|
+
<BaseButtonGroup variant="outlined">
|
|
48
|
+
<Button>Hello</Button>
|
|
49
|
+
<Button disabled>Hello</Button>
|
|
50
|
+
<Button>Hello</Button>
|
|
51
|
+
</BaseButtonGroup>
|
|
52
|
+
</Box>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const Pressable = () => {
|
|
57
|
+
return (
|
|
58
|
+
<Box sx={{ gap: 24, flexDirection: 'column', display: 'flex' }}>
|
|
59
|
+
<BaseButtonGroup variant="text">
|
|
60
|
+
<Button aria-pressed="true">Hello</Button>
|
|
61
|
+
<Button>Hello</Button>
|
|
62
|
+
</BaseButtonGroup>
|
|
63
|
+
<BaseButtonGroup variant="text">
|
|
64
|
+
<Button aria-pressed="true">Hello</Button>
|
|
65
|
+
<Button>Hello</Button>
|
|
66
|
+
<Button>Hello</Button>
|
|
67
|
+
</BaseButtonGroup>
|
|
68
|
+
<BaseButtonGroup variant="text">
|
|
69
|
+
<Button aria-pressed="true">Hello</Button>
|
|
70
|
+
<Button disabled>Hello</Button>
|
|
71
|
+
<Button>Hello</Button>
|
|
72
|
+
</BaseButtonGroup>
|
|
73
|
+
<BaseButtonGroup variant="filled">
|
|
74
|
+
<Button aria-pressed="true">Hello</Button>
|
|
75
|
+
<Button>Hello</Button>
|
|
76
|
+
</BaseButtonGroup>
|
|
77
|
+
<BaseButtonGroup variant="filled">
|
|
78
|
+
<Button aria-pressed="true">Hello</Button>
|
|
79
|
+
<Button>Hello</Button>
|
|
80
|
+
<Button>Hello</Button>
|
|
81
|
+
</BaseButtonGroup>
|
|
82
|
+
<BaseButtonGroup variant="filled">
|
|
83
|
+
<Button aria-pressed="true">Hello</Button>
|
|
84
|
+
<Button disabled>Hello</Button>
|
|
85
|
+
<Button>Hello</Button>
|
|
86
|
+
</BaseButtonGroup>
|
|
87
|
+
<BaseButtonGroup variant="outlined">
|
|
88
|
+
<Button aria-pressed="true">Hello</Button>
|
|
89
|
+
<Button>Hello</Button>
|
|
90
|
+
</BaseButtonGroup>
|
|
91
|
+
<BaseButtonGroup variant="outlined">
|
|
92
|
+
<Button aria-pressed="true">Hello</Button>
|
|
93
|
+
<Button>Hello</Button>
|
|
94
|
+
<Button>Hello</Button>
|
|
95
|
+
</BaseButtonGroup>
|
|
96
|
+
<BaseButtonGroup variant="outlined">
|
|
97
|
+
<Button aria-pressed="true">Hello</Button>
|
|
98
|
+
<Button disabled>Hello</Button>
|
|
99
|
+
<Button>Hello</Button>
|
|
100
|
+
</BaseButtonGroup>
|
|
101
|
+
</Box>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const ButtonGroup = () => <Example />;
|
|
106
|
+
export const ButtonGroupPressable = () => <Pressable />;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
2
|
+
import { ButtonProps } from './Button';
|
|
3
|
+
import { ButtonGroupContext, ButtonGroupContextProps } from './context';
|
|
4
|
+
|
|
5
|
+
export type ButtonGroupProps = ButtonProps & ButtonGroupContextProps;
|
|
6
|
+
|
|
7
|
+
export const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(
|
|
8
|
+
function ButtonGroup(props, forwardedRef) {
|
|
9
|
+
const {
|
|
10
|
+
as: Comp = 'div',
|
|
11
|
+
variant = 'text',
|
|
12
|
+
direction = 'row',
|
|
13
|
+
...otherProps
|
|
14
|
+
} = props;
|
|
15
|
+
|
|
16
|
+
const value: ButtonGroupContextProps = useMemo(
|
|
17
|
+
() => ({ direction, variant }),
|
|
18
|
+
[direction, variant]
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<ButtonGroupContext.Provider value={value}>
|
|
23
|
+
<Comp
|
|
24
|
+
ref={forwardedRef}
|
|
25
|
+
role="group"
|
|
26
|
+
data-button-group=""
|
|
27
|
+
data-button-group-direction={direction}
|
|
28
|
+
{...otherProps}
|
|
29
|
+
/>
|
|
30
|
+
</ButtonGroupContext.Provider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import { readableColor } from 'polished';
|
|
2
|
+
import { readableColor, rem } from 'polished';
|
|
3
3
|
import { BaseButton } from './BaseButton';
|
|
4
4
|
import { Theme } from '../theme';
|
|
5
|
-
import { alpha,
|
|
5
|
+
import { alpha, getBackgroundOverlay } from '../color';
|
|
6
6
|
import { get, css } from '@styled-system/css';
|
|
7
7
|
|
|
8
8
|
export const FilledButton = styled(BaseButton)(
|
|
@@ -21,13 +21,46 @@ export const FilledButton = styled(BaseButton)(
|
|
|
21
21
|
backgroundBlendMode: 'overlay',
|
|
22
22
|
cursor: 'default',
|
|
23
23
|
},
|
|
24
|
+
'&:focus-visible': {
|
|
25
|
+
outlineColor: get(theme, `colors.${String(color)}`) || color,
|
|
26
|
+
outlineWidth: 2,
|
|
27
|
+
outlineStyle: 'auto',
|
|
28
|
+
outlineOffset: '2px',
|
|
29
|
+
},
|
|
24
30
|
}),
|
|
25
31
|
({ color = 'primary', elevation = 'none', theme }) =>
|
|
26
32
|
color === 'surface' && {
|
|
27
|
-
...
|
|
33
|
+
...getBackgroundOverlay(
|
|
28
34
|
theme,
|
|
29
|
-
get(theme, `buttons.elevations.${elevation}.boxShadow`, 0)
|
|
35
|
+
get(theme, `buttons.elevations.${elevation}.boxShadow`, 0),
|
|
36
|
+
'primary'
|
|
30
37
|
),
|
|
38
|
+
},
|
|
39
|
+
({ color = 'primary', theme, isGroupedButton = false }) =>
|
|
40
|
+
isGroupedButton && {
|
|
41
|
+
'[data-button-group=""] &': {
|
|
42
|
+
borderColor:
|
|
43
|
+
get(theme, `colors.on.${String(color)}`) ||
|
|
44
|
+
(typeof color === 'string' ? readableColor(color) : undefined),
|
|
45
|
+
':first-of-type': {
|
|
46
|
+
borderTopRightRadius: 0,
|
|
47
|
+
borderBottomRightRadius: 0,
|
|
48
|
+
borderRightStyle: 'solid',
|
|
49
|
+
borderRightWidth: rem(1),
|
|
50
|
+
},
|
|
51
|
+
':not(:first-of-type):not(:last-of-type)': {
|
|
52
|
+
borderRadius: 0,
|
|
53
|
+
},
|
|
54
|
+
':last-of-type': {
|
|
55
|
+
borderTopLeftRadius: 0,
|
|
56
|
+
borderBottomLeftRadius: 0,
|
|
57
|
+
borderLeftStyle: 'solid',
|
|
58
|
+
borderLeftWidth: rem(1),
|
|
59
|
+
},
|
|
60
|
+
':last-of-type:nth-of-type(2)': {
|
|
61
|
+
borderLeftWidth: 0,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
31
64
|
}
|
|
32
65
|
);
|
|
33
66
|
|
|
@@ -36,5 +69,6 @@ export function getRippleProperties(theme: Theme) {
|
|
|
36
69
|
hoverOpacity: get(theme, `buttons.overlays.filled.hover.opacity`),
|
|
37
70
|
focusOpacity: get(theme, `buttons.overlays.filled.focus.opacity`),
|
|
38
71
|
pressedOpacity: get(theme, `buttons.overlays.filled.pressed.opacity`),
|
|
72
|
+
rippleEnabled: false,
|
|
39
73
|
};
|
|
40
74
|
}
|