@basic-ui/material 1.0.0-alpha.5 → 1.0.0-alpha.50
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/README.md +3 -3
- package/build/cjs/index.js +2262 -1469
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Alert/Alert.d.ts +6 -6
- package/build/esm/Alert/Alert.js +3 -2
- package/build/esm/Alert/Alert.js.map +1 -1
- package/build/esm/Alert/index.d.ts +1 -1
- package/build/esm/Alert/index.js.map +1 -1
- package/build/esm/AppBar/AppBar.d.ts +9 -9
- package/build/esm/AppBar/AppBar.js +6 -5
- package/build/esm/AppBar/AppBar.js.map +1 -1
- package/build/esm/AppBar/AppBarButton.d.ts +4 -4
- package/build/esm/AppBar/AppBarButton.js +2 -1
- package/build/esm/AppBar/AppBarButton.js.map +1 -1
- package/build/esm/AppBar/context.d.ts +5 -5
- package/build/esm/AppBar/context.js.map +1 -1
- package/build/esm/AppBar/index.d.ts +3 -3
- package/build/esm/AppBar/index.js.map +1 -1
- package/build/esm/Badge/Badge.d.ts +6 -6
- package/build/esm/Badge/Badge.js +28 -2
- package/build/esm/Badge/Badge.js.map +1 -1
- package/build/esm/Badge/index.d.ts +1 -1
- package/build/esm/Badge/index.js.map +1 -1
- package/build/esm/BaseLine/BaseLine.d.ts +1 -1
- package/build/esm/BaseLine/BaseLine.js +1 -1
- package/build/esm/BaseLine/BaseLine.js.map +1 -1
- package/build/esm/BaseLine/index.d.ts +1 -1
- package/build/esm/BaseLine/index.js.map +1 -1
- package/build/esm/BottomSheet/BottomSheet.d.ts +7 -7
- package/build/esm/BottomSheet/BottomSheet.js +2 -1
- package/build/esm/BottomSheet/BottomSheet.js.map +1 -1
- package/build/esm/BottomSheet/BottomSheetSurface.d.ts +5 -5
- package/build/esm/BottomSheet/BottomSheetSurface.js +2 -2
- package/build/esm/BottomSheet/BottomSheetSurface.js.map +1 -1
- package/build/esm/BottomSheet/index.d.ts +1 -1
- package/build/esm/BottomSheet/index.js.map +1 -1
- package/build/esm/Box/Box.d.ts +23 -23
- package/build/esm/Box/Box.js +1 -2
- package/build/esm/Box/Box.js.map +1 -1
- package/build/esm/Box/index.d.ts +1 -1
- package/build/esm/Box/index.js.map +1 -1
- package/build/esm/Button/BaseButton.d.ts +7 -7
- package/build/esm/Button/BaseButton.js +6 -5
- package/build/esm/Button/BaseButton.js.map +1 -1
- package/build/esm/Button/Button.d.ts +13 -13
- package/build/esm/Button/Button.js +6 -6
- package/build/esm/Button/Button.js.map +1 -1
- package/build/esm/Button/ButtonGroup.d.ts +5 -5
- package/build/esm/Button/ButtonGroup.js +3 -2
- package/build/esm/Button/ButtonGroup.js.map +1 -1
- package/build/esm/Button/FilledButton.d.ts +11 -11
- package/build/esm/Button/FilledButton.js +22 -9
- package/build/esm/Button/FilledButton.js.map +1 -1
- package/build/esm/Button/FloatingActionButton.d.ts +7 -7
- package/build/esm/Button/FloatingActionButton.js +1 -1
- package/build/esm/Button/FloatingActionButton.js.map +1 -1
- package/build/esm/Button/IconButton.d.ts +8 -8
- package/build/esm/Button/IconButton.js +1 -1
- package/build/esm/Button/IconButton.js.map +1 -1
- package/build/esm/Button/OutlinedButton.d.ts +4 -4
- package/build/esm/Button/OutlinedButton.js +18 -3
- package/build/esm/Button/OutlinedButton.js.map +1 -1
- package/build/esm/Button/TransparentButton.d.ts +11 -11
- package/build/esm/Button/TransparentButton.js +17 -2
- package/build/esm/Button/TransparentButton.js.map +1 -1
- package/build/esm/Button/context.d.ts +8 -8
- package/build/esm/Button/context.js.map +1 -1
- package/build/esm/Button/index.d.ts +2 -2
- package/build/esm/Button/index.js.map +1 -1
- package/build/esm/CheckBox/CheckBox.d.ts +13 -13
- package/build/esm/CheckBox/CheckBox.js +6 -5
- package/build/esm/CheckBox/CheckBox.js.map +1 -1
- package/build/esm/CheckBox/CheckBoxIcon.d.ts +10 -10
- package/build/esm/CheckBox/CheckBoxIcon.js +6 -5
- package/build/esm/CheckBox/CheckBoxIcon.js.map +1 -1
- package/build/esm/CheckBox/CheckPath.d.ts +3 -4
- package/build/esm/CheckBox/CheckPath.js +1 -1
- package/build/esm/CheckBox/CheckPath.js.map +1 -1
- package/build/esm/CheckBox/IndeterminatePath.d.ts +3 -4
- package/build/esm/CheckBox/IndeterminatePath.js +1 -1
- package/build/esm/CheckBox/IndeterminatePath.js.map +1 -1
- package/build/esm/CheckBox/index.d.ts +1 -1
- package/build/esm/CheckBox/index.js.map +1 -1
- package/build/esm/Chip/ButtonChip.d.ts +9 -9
- package/build/esm/Chip/ButtonChip.js +4 -4
- package/build/esm/Chip/ButtonChip.js.map +1 -1
- package/build/esm/Chip/Chip.d.ts +4 -4
- package/build/esm/Chip/Chip.js.map +1 -1
- package/build/esm/Chip/ChipBase.d.ts +10 -10
- package/build/esm/Chip/ChipBase.js +10 -10
- package/build/esm/Chip/ChipBase.js.map +1 -1
- package/build/esm/Chip/ChoiceChip.d.ts +10 -10
- package/build/esm/Chip/ChoiceChip.js +6 -5
- package/build/esm/Chip/ChoiceChip.js.map +1 -1
- package/build/esm/Chip/index.d.ts +2 -2
- package/build/esm/Chip/index.js.map +1 -1
- package/build/esm/Combobox/Combobox.d.ts +23 -23
- package/build/esm/Combobox/Combobox.js +25 -16
- package/build/esm/Combobox/Combobox.js.map +1 -1
- package/build/esm/Combobox/index.d.ts +1 -1
- package/build/esm/Combobox/index.js.map +1 -1
- package/build/esm/Dialog/Dialog.d.ts +20 -20
- package/build/esm/Dialog/Dialog.js +6 -5
- package/build/esm/Dialog/Dialog.js.map +1 -1
- package/build/esm/Dialog/DialogBackdrop.d.ts +7 -7
- package/build/esm/Dialog/DialogBackdrop.js +2 -2
- package/build/esm/Dialog/DialogBackdrop.js.map +1 -1
- package/build/esm/Dialog/DialogContainer.d.ts +4 -4
- package/build/esm/Dialog/DialogContainer.js +2 -1
- package/build/esm/Dialog/DialogContainer.js.map +1 -1
- package/build/esm/Dialog/DialogSurface.d.ts +7 -7
- package/build/esm/Dialog/DialogSurface.js +4 -4
- package/build/esm/Dialog/DialogSurface.js.map +1 -1
- package/build/esm/Dialog/Scrim.d.ts +4 -4
- package/build/esm/Dialog/Scrim.js +2 -1
- package/build/esm/Dialog/Scrim.js.map +1 -1
- package/build/esm/Dialog/index.d.ts +2 -2
- package/build/esm/Dialog/index.js +1 -0
- package/build/esm/Dialog/index.js.map +1 -1
- package/build/esm/Dialog/useDialogAnimation.d.ts +824 -824
- package/build/esm/Dialog/useDialogAnimation.js +6 -4
- package/build/esm/Dialog/useDialogAnimation.js.map +1 -1
- package/build/esm/Divider/Divider.d.ts +7 -7
- package/build/esm/Divider/Divider.js +9 -10
- package/build/esm/Divider/Divider.js.map +1 -1
- package/build/esm/Divider/index.d.ts +1 -1
- package/build/esm/Divider/index.js.map +1 -1
- package/build/esm/FloatingLabel/FloatingLabel.d.ts +13 -13
- package/build/esm/FloatingLabel/FloatingLabel.js +7 -6
- package/build/esm/FloatingLabel/FloatingLabel.js.map +1 -1
- package/build/esm/FloatingLabel/index.d.ts +1 -1
- package/build/esm/FloatingLabel/index.js.map +1 -1
- package/build/esm/LineRipple/LineRipple.d.ts +9 -9
- package/build/esm/LineRipple/LineRipple.js +5 -4
- package/build/esm/LineRipple/LineRipple.js.map +1 -1
- package/build/esm/LineRipple/index.d.ts +1 -1
- package/build/esm/LineRipple/index.js.map +1 -1
- package/build/esm/Link/Link.d.ts +9 -9
- package/build/esm/Link/Link.js +14 -2
- package/build/esm/Link/Link.js.map +1 -1
- package/build/esm/Link/index.d.ts +1 -1
- package/build/esm/Link/index.js.map +1 -1
- package/build/esm/List/List.d.ts +8 -8
- package/build/esm/List/List.js +2 -2
- package/build/esm/List/List.js.map +1 -1
- package/build/esm/List/index.d.ts +1 -1
- package/build/esm/List/index.js.map +1 -1
- package/build/esm/ListItem/ListItem.d.ts +14 -12
- package/build/esm/ListItem/ListItem.js +50 -47
- package/build/esm/ListItem/ListItem.js.map +1 -1
- package/build/esm/ListItem/ListItemText.d.ts +7 -7
- package/build/esm/ListItem/ListItemText.js +5 -5
- package/build/esm/ListItem/ListItemText.js.map +1 -1
- package/build/esm/ListItem/index.d.ts +2 -2
- package/build/esm/ListItem/index.js.map +1 -1
- package/build/esm/Menu/Menu.d.ts +18 -16
- package/build/esm/Menu/Menu.js +31 -11
- package/build/esm/Menu/Menu.js.map +1 -1
- package/build/esm/Menu/animation.d.ts +2 -2
- package/build/esm/Menu/animation.js.map +1 -1
- package/build/esm/Menu/index.d.ts +2 -1
- package/build/esm/Menu/index.js +1 -0
- package/build/esm/Menu/index.js.map +1 -1
- package/build/esm/NavRail/NavRailItem.d.ts +15 -0
- package/build/esm/NavRail/NavRailItem.js +149 -0
- package/build/esm/NavRail/NavRailItem.js.map +1 -0
- package/build/esm/NavRail/icons/test-icons.d.ts +4 -0
- package/build/esm/NavRail/icons/test-icons.js +42 -0
- package/build/esm/NavRail/icons/test-icons.js.map +1 -0
- package/build/esm/NavRail/index.d.ts +1 -0
- package/build/esm/NavRail/index.js +2 -0
- package/build/esm/NavRail/index.js.map +1 -0
- package/build/esm/NotchedOutline/NotchedOutline.d.ts +14 -14
- package/build/esm/NotchedOutline/NotchedOutline.js +4 -4
- package/build/esm/NotchedOutline/NotchedOutline.js.map +1 -1
- package/build/esm/NotchedOutline/context.d.ts +6 -6
- package/build/esm/NotchedOutline/context.js.map +1 -1
- package/build/esm/NotchedOutline/index.d.ts +1 -1
- package/build/esm/NotchedOutline/index.js.map +1 -1
- package/build/esm/NotchedOutline/styledComponents.d.ts +575 -485
- package/build/esm/NotchedOutline/styledComponents.js +3 -2
- package/build/esm/NotchedOutline/styledComponents.js.map +1 -1
- package/build/esm/Paper/Paper.d.ts +11 -11
- package/build/esm/Paper/Paper.js +8 -8
- package/build/esm/Paper/Paper.js.map +1 -1
- package/build/esm/Paper/index.d.ts +1 -1
- package/build/esm/Paper/index.js.map +1 -1
- package/build/esm/Popover/Popover.d.ts +14 -0
- package/build/esm/Popover/Popover.js +74 -0
- package/build/esm/Popover/Popover.js.map +1 -0
- package/build/esm/Popover/PopoverContainer.d.ts +4 -0
- package/build/esm/Popover/PopoverContainer.js +20 -0
- package/build/esm/Popover/PopoverContainer.js.map +1 -0
- package/build/esm/Popover/PopoverSurface.d.ts +5 -0
- package/build/esm/Popover/PopoverSurface.js +41 -0
- package/build/esm/Popover/PopoverSurface.js.map +1 -0
- package/build/esm/Popover/index.d.ts +1 -0
- package/build/esm/Popover/index.js +2 -0
- package/build/esm/Popover/index.js.map +1 -0
- package/build/esm/ProgressSpinner/ProgressSpinner.d.ts +8 -8
- package/build/esm/ProgressSpinner/ProgressSpinner.js +14 -14
- package/build/esm/ProgressSpinner/ProgressSpinner.js.map +1 -1
- package/build/esm/ProgressSpinner/index.d.ts +1 -1
- package/build/esm/ProgressSpinner/index.js.map +1 -1
- package/build/esm/RadioButton/RadioButton.d.ts +4 -4
- package/build/esm/RadioButton/RadioButton.js +4 -2
- package/build/esm/RadioButton/RadioButton.js.map +1 -1
- package/build/esm/RadioButton/RadioButtonIcon.d.ts +6 -6
- package/build/esm/RadioButton/RadioButtonIcon.js +6 -5
- package/build/esm/RadioButton/RadioButtonIcon.js.map +1 -1
- package/build/esm/RadioButton/RadioGroup.d.ts +5 -5
- package/build/esm/RadioButton/RadioGroup.js +2 -1
- package/build/esm/RadioButton/RadioGroup.js.map +1 -1
- package/build/esm/RadioButton/index.d.ts +2 -2
- package/build/esm/RadioButton/index.js.map +1 -1
- package/build/esm/Ripple/Ripple.d.ts +11 -11
- package/build/esm/Ripple/Ripple.js +1 -1
- package/build/esm/Ripple/Ripple.js.map +1 -1
- package/build/esm/Ripple/RippleBox.d.ts +5 -6
- package/build/esm/Ripple/RippleBox.js +7 -6
- package/build/esm/Ripple/RippleBox.js.map +1 -1
- package/build/esm/Ripple/constants.d.ts +7 -7
- package/build/esm/Ripple/constants.js.map +1 -1
- package/build/esm/Ripple/index.d.ts +5 -5
- package/build/esm/Ripple/index.js.map +1 -1
- package/build/esm/Ripple/keyframes.d.ts +4 -4
- package/build/esm/Ripple/keyframes.js.map +1 -1
- package/build/esm/Ripple/useRipple.d.ts +14 -14
- package/build/esm/Ripple/useRipple.js +2 -2
- package/build/esm/Ripple/useRipple.js.map +1 -1
- package/build/esm/Ripple/useRippleHandlers.d.ts +8 -8
- package/build/esm/Ripple/useRippleHandlers.js +2 -1
- package/build/esm/Ripple/useRippleHandlers.js.map +1 -1
- package/build/esm/Ripple/useRippleSurface.d.ts +787 -786
- package/build/esm/Ripple/useRippleSurface.js +65 -60
- package/build/esm/Ripple/useRippleSurface.js.map +1 -1
- package/build/esm/SearchBar/SearchBar.d.ts +15 -0
- package/build/esm/SearchBar/SearchBar.js +90 -0
- package/build/esm/SearchBar/SearchBar.js.map +1 -0
- package/build/esm/SearchBar/index.d.ts +1 -0
- package/build/esm/SearchBar/index.js +2 -0
- package/build/esm/SearchBar/index.js.map +1 -0
- package/build/esm/Select/CustomContainerExample.d.ts +3 -0
- package/build/esm/Select/CustomContainerExample.js +59 -0
- package/build/esm/Select/CustomContainerExample.js.map +1 -0
- package/build/esm/Select/Select.d.ts +32 -18
- package/build/esm/Select/Select.js +67 -15
- package/build/esm/Select/Select.js.map +1 -1
- package/build/esm/Select/SelectIcon.d.ts +6 -6
- package/build/esm/Select/SelectIcon.js +6 -5
- package/build/esm/Select/SelectIcon.js.map +1 -1
- package/build/esm/Select/context.d.ts +9 -8
- package/build/esm/Select/context.js +2 -1
- package/build/esm/Select/context.js.map +1 -1
- package/build/esm/Select/defaultRender.d.ts +3 -1
- package/build/esm/Select/defaultRender.js +33 -4
- package/build/esm/Select/defaultRender.js.map +1 -1
- package/build/esm/Select/index.d.ts +1 -1
- package/build/esm/Select/index.js.map +1 -1
- package/build/esm/Select/styledComponents.d.ts +15 -15
- package/build/esm/Select/styledComponents.js +13 -22
- package/build/esm/Select/styledComponents.js.map +1 -1
- package/build/esm/SelectItem/SelectItem.d.ts +11 -4
- package/build/esm/SelectItem/SelectItem.js +34 -9
- package/build/esm/SelectItem/SelectItem.js.map +1 -1
- package/build/esm/SelectItem/index.d.ts +1 -1
- package/build/esm/SelectItem/index.js.map +1 -1
- package/build/esm/SelectionControl/SelectionControlLabel.d.ts +7 -7
- package/build/esm/SelectionControl/SelectionControlLabel.js +4 -3
- package/build/esm/SelectionControl/SelectionControlLabel.js.map +1 -1
- package/build/esm/SelectionControl/SelectionControlText.d.ts +8 -8
- package/build/esm/SelectionControl/SelectionControlText.js +4 -4
- package/build/esm/SelectionControl/SelectionControlText.js.map +1 -1
- package/build/esm/SelectionControl/index.d.ts +2 -2
- package/build/esm/SelectionControl/index.js.map +1 -1
- package/build/esm/Skeleton/DelayAppearance.d.ts +13 -13
- package/build/esm/Skeleton/DelayAppearance.js +5 -5
- package/build/esm/Skeleton/DelayAppearance.js.map +1 -1
- package/build/esm/Skeleton/Skeleton.d.ts +9 -9
- package/build/esm/Skeleton/Skeleton.js +4 -4
- package/build/esm/Skeleton/Skeleton.js.map +1 -1
- package/build/esm/Skeleton/animation.d.ts +8 -8
- package/build/esm/Skeleton/animation.js.map +1 -1
- package/build/esm/Skeleton/index.d.ts +2 -2
- package/build/esm/Skeleton/index.js.map +1 -1
- package/build/esm/Slider/Slider.d.ts +17 -0
- package/build/esm/Slider/Slider.js +224 -0
- package/build/esm/Slider/Slider.js.map +1 -0
- package/build/esm/Slider/index.d.ts +1 -0
- package/build/esm/Slider/index.js +2 -0
- package/build/esm/Slider/index.js.map +1 -0
- package/build/esm/Snackbar/Snackbar.d.ts +8 -8
- package/build/esm/Snackbar/Snackbar.js +12 -12
- package/build/esm/Snackbar/Snackbar.js.map +1 -1
- package/build/esm/Snackbar/Stack.d.ts +31 -32
- package/build/esm/Snackbar/Stack.js +11 -10
- package/build/esm/Snackbar/Stack.js.map +1 -1
- package/build/esm/Snackbar/index.d.ts +3 -2
- package/build/esm/Snackbar/index.js +1 -0
- package/build/esm/Snackbar/index.js.map +1 -1
- package/build/esm/Snackbar/useSnackbarAnimation.d.ts +6 -70
- package/build/esm/Snackbar/useSnackbarAnimation.js +9 -8
- package/build/esm/Snackbar/useSnackbarAnimation.js.map +1 -1
- package/build/esm/Switch/Switch.d.ts +13 -8
- package/build/esm/Switch/Switch.js +70 -48
- package/build/esm/Switch/Switch.js.map +1 -1
- package/build/esm/Switch/index.d.ts +1 -1
- package/build/esm/Switch/index.js.map +1 -1
- package/build/esm/Switch/styledComponents.d.ts +13 -13
- package/build/esm/Switch/styledComponents.js +34 -25
- package/build/esm/Switch/styledComponents.js.map +1 -1
- package/build/esm/Tab/Tab.d.ts +5 -5
- package/build/esm/Tab/Tab.js +51 -14
- package/build/esm/Tab/Tab.js.map +1 -1
- package/build/esm/Tab/TabList.d.ts +10 -9
- package/build/esm/Tab/TabList.js +8 -3
- package/build/esm/Tab/TabList.js.map +1 -1
- package/build/esm/Tab/TabPanel.d.ts +5 -5
- package/build/esm/Tab/TabPanel.js +4 -2
- package/build/esm/Tab/TabPanel.js.map +1 -1
- package/build/esm/Tab/TabPanels.d.ts +4 -4
- package/build/esm/Tab/TabPanels.js.map +1 -1
- package/build/esm/Tab/Tabs.d.ts +4 -4
- package/build/esm/Tab/Tabs.js.map +1 -1
- package/build/esm/Tab/context.d.ts +9 -8
- package/build/esm/Tab/context.js +2 -1
- package/build/esm/Tab/context.js.map +1 -1
- package/build/esm/Tab/index.d.ts +5 -5
- package/build/esm/Tab/index.js.map +1 -1
- package/build/esm/TabIndicator/TabIndicator.d.ts +9 -7
- package/build/esm/TabIndicator/TabIndicator.js +78 -10
- package/build/esm/TabIndicator/TabIndicator.js.map +1 -1
- package/build/esm/TabIndicator/context.d.ts +6 -6
- package/build/esm/TabIndicator/context.js.map +1 -1
- package/build/esm/TabIndicator/index.d.ts +2 -2
- package/build/esm/TabIndicator/index.js.map +1 -1
- package/build/esm/Table/Table.d.ts +4 -4
- package/build/esm/Table/Table.js +13 -11
- package/build/esm/Table/Table.js.map +1 -1
- package/build/esm/Table/TableBody.d.ts +4 -4
- package/build/esm/Table/TableBody.js +4 -3
- package/build/esm/Table/TableBody.js.map +1 -1
- package/build/esm/Table/TableCell.d.ts +4 -4
- package/build/esm/Table/TableCell.js +9 -6
- package/build/esm/Table/TableCell.js.map +1 -1
- package/build/esm/Table/TableHead.d.ts +4 -4
- package/build/esm/Table/TableHead.js +5 -5
- package/build/esm/Table/TableHead.js.map +1 -1
- package/build/esm/Table/TableRow.d.ts +4 -4
- package/build/esm/Table/TableRow.js +9 -9
- package/build/esm/Table/TableRow.js.map +1 -1
- package/build/esm/Table/context.d.ts +3 -3
- package/build/esm/Table/context.js.map +1 -1
- package/build/esm/Table/index.d.ts +5 -5
- package/build/esm/Table/index.js.map +1 -1
- package/build/esm/Text/LoremIpsum.d.ts +4 -4
- package/build/esm/Text/LoremIpsum.js +1 -1
- package/build/esm/Text/LoremIpsum.js.map +1 -1
- package/build/esm/Text/Text.d.ts +11 -7
- package/build/esm/Text/Text.js +7 -3
- package/build/esm/Text/Text.js.map +1 -1
- package/build/esm/Text/index.d.ts +1 -1
- package/build/esm/Text/index.js.map +1 -1
- package/build/esm/TextField/FilledContainer.d.ts +18 -15
- package/build/esm/TextField/FilledContainer.js +11 -11
- package/build/esm/TextField/FilledContainer.js.map +1 -1
- package/build/esm/TextField/HelperText.d.ts +10 -10
- package/build/esm/TextField/HelperText.js +5 -5
- package/build/esm/TextField/HelperText.js.map +1 -1
- package/build/esm/TextField/IconContainer.d.ts +5 -6
- package/build/esm/TextField/IconContainer.js +0 -1
- package/build/esm/TextField/IconContainer.js.map +1 -1
- package/build/esm/TextField/Input.d.ts +11 -11
- package/build/esm/TextField/Input.js +12 -10
- package/build/esm/TextField/Input.js.map +1 -1
- package/build/esm/TextField/OutlinedContainer.d.ts +17 -17
- package/build/esm/TextField/OutlinedContainer.js +17 -9
- package/build/esm/TextField/OutlinedContainer.js.map +1 -1
- package/build/esm/TextField/TextField.d.ts +19 -19
- package/build/esm/TextField/TextField.js +4 -4
- package/build/esm/TextField/TextField.js.map +1 -1
- package/build/esm/TextField/consts.d.ts +5 -5
- package/build/esm/TextField/consts.js.map +1 -1
- package/build/esm/TextField/index.d.ts +4 -4
- package/build/esm/TextField/index.js.map +1 -1
- package/build/esm/ThemeExplorer/BorderSlider.d.ts +7 -0
- package/build/esm/ThemeExplorer/BorderSlider.js +78 -0
- package/build/esm/ThemeExplorer/BorderSlider.js.map +1 -0
- package/build/esm/ThemeExplorer/ColorPicker.d.ts +8 -8
- package/build/esm/ThemeExplorer/ColorPicker.js +4 -3
- package/build/esm/ThemeExplorer/ColorPicker.js.map +1 -1
- package/build/esm/ThemeExplorer/ColorSchemePicker.d.ts +10 -0
- package/build/esm/ThemeExplorer/ColorSchemePicker.js +54 -0
- package/build/esm/ThemeExplorer/ColorSchemePicker.js.map +1 -0
- package/build/esm/ThemeExplorer/FontAutoComplete.d.ts +9 -0
- package/build/esm/ThemeExplorer/FontAutoComplete.js +128 -0
- package/build/esm/ThemeExplorer/FontAutoComplete.js.map +1 -0
- package/build/esm/ThemeExplorer/TextFieldColorPicker.d.ts +9 -9
- package/build/esm/ThemeExplorer/TextFieldColorPicker.js +4 -3
- package/build/esm/ThemeExplorer/TextFieldColorPicker.js.map +1 -1
- package/build/esm/ThemeExplorer/ThemeBuilder.d.ts +11 -0
- package/build/esm/ThemeExplorer/ThemeBuilder.js +400 -0
- package/build/esm/ThemeExplorer/ThemeBuilder.js.map +1 -0
- package/build/esm/ThemeExplorer/ThemeColors.d.ts +5 -5
- package/build/esm/ThemeExplorer/ThemeColors.js +38 -16
- package/build/esm/ThemeExplorer/ThemeColors.js.map +1 -1
- package/build/esm/ThemeExplorer/components.d.ts +31 -32
- package/build/esm/ThemeExplorer/components.js +29 -28
- package/build/esm/ThemeExplorer/components.js.map +1 -1
- package/build/esm/ThemeExplorer/googleFonts.d.ts +1 -0
- package/build/esm/ThemeExplorer/googleFonts.js +7 -0
- package/build/esm/ThemeExplorer/googleFonts.js.map +1 -0
- package/build/esm/ThemeExplorer/index.d.ts +1 -0
- package/build/esm/ThemeExplorer/index.js +2 -0
- package/build/esm/ThemeExplorer/index.js.map +1 -0
- package/build/esm/ThemeExplorer/makeColorScheme.d.ts +98 -66
- package/build/esm/ThemeExplorer/makeColorScheme.js +46 -10
- package/build/esm/ThemeExplorer/makeColorScheme.js.map +1 -1
- package/build/esm/ThemeExplorer/makeTailwindTheme.d.ts +2 -0
- package/build/esm/ThemeExplorer/makeTailwindTheme.js +30 -0
- package/build/esm/ThemeExplorer/makeTailwindTheme.js.map +1 -0
- package/build/esm/ThemeExplorer/updateGoogleFonts.js +70 -0
- package/build/esm/ThemeExplorer/updateGoogleFonts.js.map +1 -0
- package/build/esm/ThemeExplorer/useDeferredColor.d.ts +3 -3
- package/build/esm/ThemeExplorer/useDeferredColor.js +6 -9
- package/build/esm/ThemeExplorer/useDeferredColor.js.map +1 -1
- package/build/esm/ThemeExplorer/useLocalStorageCachedState.d.ts +1 -1
- package/build/esm/ThemeExplorer/useLocalStorageCachedState.js +1 -1
- package/build/esm/ThemeExplorer/useLocalStorageCachedState.js.map +1 -1
- package/build/esm/Tooltip/Tooltip.d.ts +8 -8
- package/build/esm/Tooltip/Tooltip.js +30 -16
- package/build/esm/Tooltip/Tooltip.js.map +1 -1
- package/build/esm/Tooltip/index.d.ts +1 -1
- package/build/esm/Tooltip/index.js.map +1 -1
- package/build/esm/color.d.ts +8 -6
- package/build/esm/color.js +14 -5
- package/build/esm/color.js.map +1 -1
- package/build/esm/css.d.ts +1 -1
- package/build/esm/css.js.map +1 -1
- package/build/esm/hooks/useAnimation.d.ts +20 -20
- package/build/esm/hooks/useAnimation.js +3 -3
- package/build/esm/hooks/useAnimation.js.map +1 -1
- package/build/esm/index.d.ts +42 -37
- package/build/esm/index.js +6 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/motion.d.ts +7 -0
- package/build/esm/motion.js +8 -0
- package/build/esm/motion.js.map +1 -0
- package/build/esm/tailwind/extendColors.d.ts +5 -0
- package/build/esm/tailwind/extendColors.js +59 -0
- package/build/esm/tailwind/extendColors.js.map +1 -0
- package/build/esm/tailwind/index.d.ts +8 -0
- package/build/esm/tailwind/index.js +45 -0
- package/build/esm/tailwind/index.js.map +1 -0
- package/build/esm/theme/index.d.ts +2 -2
- package/build/esm/theme/index.js.map +1 -1
- package/build/esm/theme/theme.d.ts +562 -472
- package/build/esm/theme/theme.js +54 -42
- package/build/esm/theme/theme.js.map +1 -1
- package/build/esm/theme/typography-raleway.d.ts +112 -112
- package/build/esm/theme/typography-raleway.js.map +1 -1
- package/build/esm/theme/typography-roboto.d.ts +111 -111
- package/build/esm/theme/typography-roboto.js.map +1 -1
- package/build/esm/theme/useTheme.d.ts +566 -6
- package/build/esm/theme/useTheme.js.map +1 -1
- package/build/tsconfig-build.tsbuildinfo +1 -0
- package/package.json +22 -13
- package/src/Alert/Alert.tsx +1 -1
- package/src/Alert/index.ts +1 -1
- package/src/AppBar/AppBar.story.tsx +69 -69
- package/src/AppBar/AppBar.tsx +85 -84
- package/src/AppBar/AppBarButton.tsx +25 -25
- package/src/AppBar/context.ts +13 -13
- package/src/AppBar/index.ts +3 -3
- package/src/Badge/Badge.story.tsx +68 -0
- package/src/Badge/Badge.tsx +47 -17
- package/src/Badge/index.ts +1 -1
- package/src/BaseLine/BaseLine.tsx +100 -100
- package/src/BaseLine/index.ts +1 -1
- package/src/BottomSheet/BottomSheet.story.tsx +35 -35
- package/src/BottomSheet/BottomSheet.tsx +39 -39
- package/src/BottomSheet/BottomSheetSurface.tsx +49 -49
- package/src/BottomSheet/index.ts +1 -1
- package/src/Box/Box.tsx +127 -129
- package/src/Box/index.ts +1 -1
- package/src/Button/BaseButton.tsx +4 -11
- package/src/Button/Button.story.tsx +10 -1
- package/src/Button/Button.tsx +4 -4
- package/src/Button/ButtonGroup.story.tsx +68 -43
- package/src/Button/ButtonGroup.tsx +1 -1
- package/src/Button/FilledButton.tsx +20 -10
- package/src/Button/FloatingActionButton.tsx +9 -9
- package/src/Button/OutlinedButton.tsx +17 -2
- package/src/Button/SpinnerButton.story.tsx +91 -91
- package/src/Button/TransparentButton.tsx +16 -1
- package/src/Button/context.tsx +17 -17
- package/src/Button/index.ts +2 -2
- package/src/CheckBox/CheckBox.story.tsx +155 -154
- package/src/CheckBox/CheckBox.tsx +170 -174
- package/src/CheckBox/CheckBoxIcon.tsx +64 -64
- package/src/CheckBox/CheckPath.tsx +18 -18
- package/src/CheckBox/IndeterminatePath.tsx +16 -16
- package/src/CheckBox/index.ts +1 -1
- package/src/Chip/ButtonChip.tsx +86 -86
- package/src/Chip/Chip.story.tsx +242 -242
- package/src/Chip/Chip.tsx +5 -5
- package/src/Chip/ChipBase.tsx +141 -141
- package/src/Chip/ChoiceChip.tsx +127 -127
- package/src/Chip/index.ts +2 -2
- package/src/Combobox/Combobox.story.tsx +3 -3
- package/src/Combobox/Combobox.tsx +274 -272
- package/src/Combobox/index.ts +1 -1
- package/src/Dialog/Dialog.story.tsx +53 -53
- package/src/Dialog/Dialog.tsx +73 -73
- package/src/Dialog/DialogBackdrop.tsx +42 -42
- package/src/Dialog/DialogContainer.tsx +31 -31
- package/src/Dialog/DialogSurface.tsx +55 -57
- package/src/Dialog/Scrim.tsx +35 -35
- package/src/Dialog/index.ts +2 -2
- package/src/Dialog/useDialogAnimation.tsx +49 -50
- package/src/Divider/Divider.story.tsx +39 -39
- package/src/Divider/Divider.tsx +48 -49
- package/src/Divider/index.ts +1 -1
- package/src/FloatingLabel/FloatingLabel.story.tsx +55 -55
- package/src/FloatingLabel/FloatingLabel.tsx +77 -76
- package/src/FloatingLabel/index.ts +1 -1
- package/src/LineRipple/LineRipple.story.tsx +43 -43
- package/src/LineRipple/LineRipple.tsx +81 -81
- package/src/LineRipple/index.ts +1 -1
- package/src/Link/Link.story.tsx +14 -14
- package/src/Link/Link.tsx +65 -56
- package/src/Link/index.ts +1 -1
- package/src/List/List.tsx +46 -46
- package/src/List/index.ts +1 -1
- package/src/ListItem/ListItem.story.tsx +43 -43
- package/src/ListItem/ListItem.tsx +104 -99
- package/src/ListItem/ListItemText.tsx +35 -36
- package/src/ListItem/index.ts +2 -2
- package/src/Menu/ContextMenu.story.tsx +34 -0
- package/src/Menu/Menu.story.tsx +54 -54
- package/src/Menu/Menu.tsx +124 -110
- package/src/Menu/animation.ts +16 -16
- package/src/Menu/index.ts +2 -1
- package/src/NavRail/NavRail.story.tsx +146 -0
- package/src/NavRail/NavRailItem.tsx +175 -0
- package/src/NavRail/icons/test-icons.tsx +46 -0
- package/src/NavRail/index.ts +1 -0
- package/src/NotchedOutline/NotchedOutline.story.tsx +99 -99
- package/src/NotchedOutline/NotchedOutline.tsx +80 -81
- package/src/NotchedOutline/context.ts +12 -12
- package/src/NotchedOutline/index.ts +1 -1
- package/src/NotchedOutline/styledComponents.ts +122 -121
- package/src/Paper/Paper.story.tsx +50 -50
- package/src/Paper/Paper.tsx +67 -71
- package/src/Paper/index.ts +1 -1
- package/src/Popover/Popover.story.tsx +34 -0
- package/src/Popover/Popover.tsx +97 -0
- package/src/Popover/PopoverContainer.tsx +25 -0
- package/src/Popover/PopoverSurface.tsx +51 -0
- package/src/Popover/index.ts +1 -0
- package/src/ProgressSpinner/ProgressSpinner.story.tsx +35 -35
- package/src/ProgressSpinner/ProgressSpinner.tsx +119 -119
- package/src/ProgressSpinner/index.ts +1 -1
- package/src/RadioButton/RadioButton.story.tsx +109 -109
- package/src/RadioButton/RadioButton.tsx +112 -112
- package/src/RadioButton/RadioButtonIcon.tsx +44 -45
- package/src/RadioButton/RadioGroup.tsx +27 -27
- package/src/RadioButton/index.ts +2 -2
- package/src/Ripple/Ripple.story.tsx +78 -78
- package/src/Ripple/Ripple.tsx +33 -33
- package/src/Ripple/RippleBox.tsx +52 -53
- package/src/Ripple/constants.ts +15 -15
- package/src/Ripple/index.ts +5 -5
- package/src/Ripple/keyframes.ts +36 -36
- package/src/Ripple/useRipple.ts +209 -209
- package/src/Ripple/useRippleHandlers.ts +54 -54
- package/src/Ripple/useRippleSurface.ts +155 -133
- package/src/SearchBar/SearchBar.story.tsx +98 -0
- package/src/SearchBar/SearchBar.tsx +105 -0
- package/src/SearchBar/index.ts +1 -0
- package/src/Select/CustomContainerExample.tsx +59 -0
- package/src/Select/PaymentMethodSelect.story.tsx +316 -323
- package/src/Select/Select.story.tsx +225 -226
- package/src/Select/Select.tsx +283 -197
- package/src/Select/SelectIcon.tsx +43 -44
- package/src/Select/SelectMultiple.story.tsx +215 -0
- package/src/Select/context.ts +22 -19
- package/src/Select/defaultRender.tsx +49 -0
- package/src/Select/index.ts +1 -1
- package/src/Select/styledComponents.tsx +38 -48
- package/src/SelectItem/SelectItem.tsx +92 -60
- package/src/SelectItem/index.ts +1 -1
- package/src/SelectionControl/SelectionControlLabel.tsx +34 -37
- package/src/SelectionControl/SelectionControlText.tsx +37 -37
- package/src/SelectionControl/index.ts +2 -2
- package/src/Skeleton/DelayAppearance.tsx +41 -41
- package/src/Skeleton/Skeleton.story.tsx +57 -57
- package/src/Skeleton/Skeleton.tsx +40 -40
- package/src/Skeleton/animation.ts +54 -54
- package/src/Skeleton/index.ts +2 -2
- package/src/Slider/Slider.story.tsx +36 -0
- package/src/Slider/Slider.tsx +275 -0
- package/src/Slider/index.ts +1 -0
- package/src/Snackbar/Snackbar.story.tsx +99 -99
- package/src/Snackbar/Snackbar.tsx +10 -10
- package/src/Snackbar/Stack.tsx +13 -12
- package/src/Snackbar/index.ts +1 -0
- package/src/Snackbar/useSnackbarAnimation.ts +5 -4
- package/src/Switch/Switch.story.tsx +98 -27
- package/src/Switch/Switch.tsx +170 -127
- package/src/Switch/index.ts +1 -1
- package/src/Switch/styledComponents.tsx +117 -110
- package/src/Tab/Tab.story.tsx +209 -53
- package/src/Tab/Tab.tsx +120 -82
- package/src/Tab/TabList.tsx +61 -57
- package/src/Tab/TabPanel.tsx +31 -31
- package/src/Tab/TabPanels.tsx +5 -5
- package/src/Tab/Tabs.tsx +5 -5
- package/src/Tab/context.ts +17 -15
- package/src/Tab/index.ts +5 -5
- package/src/TabIndicator/TabIndicator.tsx +146 -69
- package/src/TabIndicator/context.ts +13 -12
- package/src/TabIndicator/index.ts +2 -2
- package/src/Table/Table.tsx +12 -9
- package/src/Table/TableCell.tsx +5 -2
- package/src/Table/TableHead.tsx +1 -2
- package/src/Table/TableRow.tsx +5 -6
- package/src/Table/context.ts +6 -6
- package/src/Text/LoremIpsum.tsx +18 -18
- package/src/Text/Text.story.tsx +75 -40
- package/src/Text/Text.tsx +84 -64
- package/src/Text/index.ts +1 -1
- package/src/TextField/FilledContainer.tsx +173 -172
- package/src/TextField/HelperText.tsx +63 -63
- package/src/TextField/IconContainer.tsx +2 -3
- package/src/TextField/Input.tsx +6 -5
- package/src/TextField/OutlinedContainer.tsx +116 -111
- package/src/TextField/TextField.story.tsx +2 -3
- package/src/TextField/TextField.tsx +4 -4
- package/src/TextField/consts.ts +7 -7
- package/src/TextField/index.ts +4 -4
- package/src/ThemeExplorer/BorderSlider.tsx +73 -0
- package/src/ThemeExplorer/ColorPicker.tsx +104 -104
- package/src/ThemeExplorer/ColorSchemePicker.tsx +55 -0
- package/src/ThemeExplorer/FontAutoComplete.tsx +139 -0
- package/src/ThemeExplorer/TextFieldColorPicker.tsx +115 -115
- package/src/ThemeExplorer/ThemeBuilder.story.tsx +8 -165
- package/src/ThemeExplorer/ThemeBuilder.tsx +353 -0
- package/src/ThemeExplorer/ThemeColors.tsx +118 -89
- package/src/ThemeExplorer/components.tsx +195 -195
- package/src/ThemeExplorer/googleFonts.ts +1436 -0
- package/src/ThemeExplorer/index.ts +1 -0
- package/src/ThemeExplorer/makeColorScheme.tsx +111 -74
- package/src/ThemeExplorer/makeTailwindTheme.ts +44 -0
- package/src/ThemeExplorer/updateGoogleFonts.js +33 -0
- package/src/ThemeExplorer/useDeferredColor.tsx +21 -25
- package/src/ThemeExplorer/useLocalStorageCachedState.ts +18 -18
- package/src/Tooltip/Tooltip.story.tsx +35 -35
- package/src/Tooltip/Tooltip.tsx +67 -50
- package/src/Tooltip/index.ts +1 -1
- package/src/color.ts +30 -6
- package/src/css.ts +2 -2
- package/src/hooks/useAnimation.ts +111 -111
- package/src/index.ts +6 -1
- package/src/motion.ts +7 -0
- package/src/tailwind/extendColors.ts +51 -0
- package/src/tailwind/index.ts +56 -0
- package/src/tailwind/tests/extendColors.test.ts +123 -0
- package/src/theme/index.ts +2 -2
- package/src/theme/theme.ts +57 -39
- package/src/theme/typography-raleway.ts +114 -114
- package/src/theme/typography-roboto.ts +113 -113
- package/src/theme/useTheme.ts +18 -18
- package/tailwind/package.json +5 -0
- package/theme-explorer/package.json +5 -0
- package/build/esm/ColorMode/ColorModeProvider.d.ts +0 -7
- package/build/esm/ColorMode/ColorModeProvider.js +0 -92
- package/build/esm/ColorMode/ColorModeProvider.js.map +0 -1
- package/build/esm/ColorMode/color-mode.d.ts +0 -8
- package/build/esm/ColorMode/color-mode.js +0 -11
- package/build/esm/ColorMode/color-mode.js.map +0 -1
- package/build/esm/ColorMode/color-vars.d.ts +0 -4
- package/build/esm/ColorMode/color-vars.js +0 -58
- package/build/esm/ColorMode/color-vars.js.map +0 -1
- package/build/esm/ColorMode/constants.d.ts +0 -3
- package/build/esm/ColorMode/constants.js +0 -5
- package/build/esm/ColorMode/constants.js.map +0 -1
- package/build/esm/ColorMode/index.d.ts +0 -4
- package/build/esm/ColorMode/index.js +0 -5
- package/build/esm/ColorMode/index.js.map +0 -1
- package/build/esm/ListItem/context.d.ts +0 -7
- package/build/esm/ListItem/context.js +0 -10
- package/build/esm/ListItem/context.js.map +0 -1
- package/build/tsconfig.tsbuildinfo +0 -1
- package/src/ColorMode/ColorModeProvider.tsx +0 -97
- package/src/ColorMode/color-mode.ts +0 -20
- package/src/ColorMode/color-vars.ts +0 -56
- package/src/ColorMode/constants.ts +0 -5
- package/src/ColorMode/index.ts +0 -4
- package/src/ColorMode/tests/color-vars.test.ts +0 -9
- package/src/Select/defaultRender.ts +0 -18
- package/src/ThemeExplorer/ThemeExplorer.story.tsx +0 -43
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { startTransition, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Box } from '../Box';
|
|
4
|
+
import { Link as BaseLink } from '../Link';
|
|
5
|
+
import { Slider, SliderMarker } from '../Slider';
|
|
6
|
+
import { Text } from '../Text';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
var Link = BaseLink;
|
|
10
|
+
export function BorderSlider(props) {
|
|
11
|
+
var _useState = useState(props.defaultValue),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
value = _useState2[0],
|
|
14
|
+
setValue = _useState2[1];
|
|
15
|
+
|
|
16
|
+
var resetting = useRef(false);
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
if (resetting.current) {
|
|
19
|
+
setValue(props.defaultValue);
|
|
20
|
+
resetting.current = false;
|
|
21
|
+
}
|
|
22
|
+
}, [props.defaultValue]);
|
|
23
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
24
|
+
width: "100%",
|
|
25
|
+
display: "flex",
|
|
26
|
+
flexDirection: "column",
|
|
27
|
+
children: [/*#__PURE__*/_jsxs(Text, {
|
|
28
|
+
display: "flex",
|
|
29
|
+
justifyContent: "space-between",
|
|
30
|
+
width: "100%",
|
|
31
|
+
pb: 2,
|
|
32
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
33
|
+
children: [props.label, ' ', /*#__PURE__*/_jsx(Link, {
|
|
34
|
+
as: "button",
|
|
35
|
+
disabled: props.resetDisabled ? true : undefined,
|
|
36
|
+
onClick: function onClick() {
|
|
37
|
+
resetting.current = true;
|
|
38
|
+
props.onReset();
|
|
39
|
+
},
|
|
40
|
+
children: "Reset"
|
|
41
|
+
})]
|
|
42
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
43
|
+
children: [value, "px"]
|
|
44
|
+
})]
|
|
45
|
+
}), /*#__PURE__*/_jsxs(Slider, {
|
|
46
|
+
value: value,
|
|
47
|
+
onChange: function onChange(e, v) {
|
|
48
|
+
setValue(v);
|
|
49
|
+
startTransition(function () {
|
|
50
|
+
props.onChange(v);
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
min: 0,
|
|
54
|
+
max: 64,
|
|
55
|
+
step: 2,
|
|
56
|
+
children: [/*#__PURE__*/_jsx(SliderMarker, {
|
|
57
|
+
value: 2
|
|
58
|
+
}), /*#__PURE__*/_jsx(SliderMarker, {
|
|
59
|
+
value: 4
|
|
60
|
+
}), /*#__PURE__*/_jsx(SliderMarker, {
|
|
61
|
+
value: 8
|
|
62
|
+
}), /*#__PURE__*/_jsx(SliderMarker, {
|
|
63
|
+
value: 12
|
|
64
|
+
}), /*#__PURE__*/_jsx(SliderMarker, {
|
|
65
|
+
value: 16
|
|
66
|
+
}), /*#__PURE__*/_jsx(SliderMarker, {
|
|
67
|
+
value: 24
|
|
68
|
+
}), /*#__PURE__*/_jsx(SliderMarker, {
|
|
69
|
+
value: 32
|
|
70
|
+
}), /*#__PURE__*/_jsx(SliderMarker, {
|
|
71
|
+
value: 40
|
|
72
|
+
}), /*#__PURE__*/_jsx(SliderMarker, {
|
|
73
|
+
value: 48
|
|
74
|
+
})]
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=BorderSlider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BorderSlider.js","names":["startTransition","useEffect","useRef","useState","Box","Link","BaseLink","Slider","SliderMarker","Text","BorderSlider","props","defaultValue","value","setValue","resetting","current","label","resetDisabled","undefined","onReset","e","v","onChange"],"sources":["../../../src/ThemeExplorer/BorderSlider.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes, FC } from 'react';\r\nimport { startTransition, useEffect, useRef, useState } from 'react';\r\n\r\nimport type { BoxProps } from '../Box';\r\nimport { Box } from '../Box';\r\nimport { Link as BaseLink } from '../Link';\r\nimport { Slider, SliderMarker } from '../Slider';\r\nimport { Text } from '../Text';\r\n\r\nconst Link: FC<\r\n BoxProps<HTMLButtonElement, ButtonHTMLAttributes<HTMLButtonElement>>\r\n> = BaseLink as any;\r\n\r\nexport function BorderSlider(props: {\r\n label: string;\r\n defaultValue: number;\r\n onChange: (value: number) => void;\r\n onReset: () => void;\r\n resetDisabled: boolean;\r\n}) {\r\n const [value, setValue] = useState(props.defaultValue);\r\n\r\n const resetting = useRef(false);\r\n useEffect(() => {\r\n if (resetting.current) {\r\n setValue(props.defaultValue);\r\n resetting.current = false;\r\n }\r\n }, [props.defaultValue]);\r\n\r\n return (\r\n <Box width=\"100%\" display=\"flex\" flexDirection=\"column\">\r\n <Text display=\"flex\" justifyContent=\"space-between\" width=\"100%\" pb={2}>\r\n <span>\r\n {props.label}{' '}\r\n <Link\r\n as=\"button\"\r\n disabled={props.resetDisabled ? true : undefined}\r\n onClick={() => {\r\n resetting.current = true;\r\n props.onReset();\r\n }}\r\n >\r\n Reset\r\n </Link>\r\n </span>\r\n <span>{value}px</span>\r\n </Text>\r\n <Slider\r\n value={value}\r\n onChange={(e, v) => {\r\n setValue(v);\r\n startTransition(() => {\r\n props.onChange(v);\r\n });\r\n }}\r\n min={0}\r\n max={64}\r\n step={2}\r\n >\r\n <SliderMarker value={2} />\r\n <SliderMarker value={4} />\r\n <SliderMarker value={8} />\r\n <SliderMarker value={12} />\r\n <SliderMarker value={16} />\r\n <SliderMarker value={24} />\r\n <SliderMarker value={32} />\r\n <SliderMarker value={40} />\r\n <SliderMarker value={48} />\r\n </Slider>\r\n </Box>\r\n );\r\n}\r\n"],"mappings":";AACA,SAASA,eAAT,EAA0BC,SAA1B,EAAqCC,MAArC,EAA6CC,QAA7C,QAA6D,OAA7D;AAGA,SAASC,GAAT,QAAoB,QAApB;AACA,SAASC,IAAI,IAAIC,QAAjB,QAAiC,SAAjC;AACA,SAASC,MAAT,EAAiBC,YAAjB,QAAqC,WAArC;AACA,SAASC,IAAT,QAAqB,S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AAG,EAAE,CARP;MASE,GAAG,EAAE,EATP;MAUE,IAAI,EAAE,CAVR;MAAA,wBAYE,KAAC,YAAD;QAAc,KAAK,EAAE;MAArB,EAZF,eAaE,KAAC,YAAD;QAAc,KAAK,EAAE;MAArB,EAbF,eAcE,KAAC,YAAD;QAAc,KAAK,EAAE;MAArB,EAdF,eAeE,KAAC,YAAD;QAAc,KAAK,EAAE;MAArB,EAfF,eAgBE,KAAC,YAAD;QAAc,KAAK,EAAE;MAArB,EAhBF,eAiBE,KAAC,YAAD;QAAc,KAAK,EAAE;MAArB,EAjBF,eAkBE,KAAC,YAAD;QAAc,KAAK,EAAE;MAArB,EAlBF,eAmBE,KAAC,YAAD;QAAc,KAAK,EAAE;MAArB,EAnBF,eAoBE,KAAC,YAAD;QAAc,KAAK,EAAE;MAArB,EApBF;IAAA,EAjBF;EAAA,EADF;AA0CD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Color, ColorPickerProps as BaseColorPickerProps } from '@basic-ui/color-picker';
|
|
2
|
-
import type { FC } from 'react';
|
|
3
|
-
import type { BoxProps } from '../Box';
|
|
4
|
-
export declare type ColorPickerProps = (Omit<BoxProps, 'color' | 'onChange'> & BaseColorPickerProps) & {
|
|
5
|
-
color: Color;
|
|
6
|
-
onChange: (color: Color) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const ColorPicker: FC<ColorPickerProps>;
|
|
1
|
+
import type { Color, ColorPickerProps as BaseColorPickerProps } from '@basic-ui/color-picker';
|
|
2
|
+
import type { FC } from 'react';
|
|
3
|
+
import type { BoxProps } from '../Box';
|
|
4
|
+
export declare type ColorPickerProps = (Omit<BoxProps, 'color' | 'onChange'> & BaseColorPickerProps) & {
|
|
5
|
+
color: Color;
|
|
6
|
+
onChange: (color: Color) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const ColorPicker: FC<ColorPickerProps>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["color", "onChange", "width", "height"];
|
|
3
4
|
import { ColorPicker as _BaseColorPicker, Hue as _Hue, HueCursor as _HueCursor, Saturation as _Saturation, SaturationCursor as _SaturationCursor } from '@basic-ui/color-picker';
|
|
4
5
|
import { Box } from '../Box';
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -16,15 +17,15 @@ export var ColorPicker = function ColorPicker(_ref) {
|
|
|
16
17
|
width = _ref$width === void 0 ? 450 : _ref$width,
|
|
17
18
|
_ref$height = _ref.height,
|
|
18
19
|
height = _ref$height === void 0 ? 225 : _ref$height,
|
|
19
|
-
otherProps = _objectWithoutProperties(_ref,
|
|
20
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
20
21
|
|
|
21
|
-
return /*#__PURE__*/_jsxs(BaseColorPicker, _extends({
|
|
22
|
+
return /*#__PURE__*/_jsxs(BaseColorPicker, _extends(_extends({
|
|
22
23
|
as: Box,
|
|
23
24
|
width: width,
|
|
24
25
|
height: height,
|
|
25
26
|
onChange: onChange,
|
|
26
27
|
color: color
|
|
27
|
-
}, otherProps, {
|
|
28
|
+
}, otherProps), {}, {
|
|
28
29
|
children: [/*#__PURE__*/_jsx(Saturation, {
|
|
29
30
|
as: Box,
|
|
30
31
|
sx: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"ColorPicker.js","names":["ColorPicker","_BaseColorPicker","Hue","_Hue","HueCursor","_HueCursor","Saturation","_Saturation","SaturationCursor","_SaturationCursor","Box","BaseColorPicker","color","onChange","width","height","otherProps","position","touchAction","userSelect","backgroundImage","border","borderRadius","boxShadow","boxSizing","transform"],"sources":["../../../src/ThemeExplorer/ColorPicker.tsx"],"sourcesContent":["import type {\r\n Color,\r\n ColorPickerProps as BaseColorPickerProps,\r\n HueProps,\r\n HueCursorProps,\r\n SaturationProps,\r\n SaturationCursorProps,\r\n} from '@basic-ui/color-picker';\r\nimport {\r\n ColorPicker as _BaseColorPicker,\r\n Hue as _Hue,\r\n HueCursor as _HueCursor,\r\n Saturation as _Saturation,\r\n SaturationCursor as _SaturationCursor,\r\n} from '@basic-ui/color-picker';\r\nimport type { FC } from 'react';\r\n\r\nimport type { BoxProps } from '../Box';\r\nimport { Box } from '../Box';\r\n\r\nexport type ColorPickerProps = (Omit<BoxProps, 'color' | 'onChange'> &\r\n BaseColorPickerProps) & {\r\n color: Color;\r\n onChange: (color: Color) => void;\r\n};\r\n\r\nconst BaseColorPicker: FC<\r\n Omit<BoxProps, 'color' | 'onChange'> & BaseColorPickerProps\r\n> = _BaseColorPicker as any;\r\nconst Hue: FC<BoxProps & HueProps> = _Hue as any;\r\nconst HueCursor: FC<BoxProps & HueCursorProps> = _HueCursor as any;\r\nconst Saturation: FC<BoxProps & SaturationProps> = _Saturation as any;\r\nconst SaturationCursor: FC<BoxProps & SaturationCursorProps> =\r\n _SaturationCursor as any;\r\n\r\nexport const ColorPicker: FC<ColorPickerProps> = ({\r\n color,\r\n onChange,\r\n width = 450,\r\n height = 225,\r\n ...otherProps\r\n}) => {\r\n return (\r\n <BaseColorPicker\r\n as={Box}\r\n width={width}\r\n height={height}\r\n onChange={onChange}\r\n color={color}\r\n {...otherProps}\r\n >\r\n <Saturation\r\n as={Box}\r\n sx={{\r\n position: 'relative',\r\n touchAction: 'none',\r\n userSelect: 'none',\r\n width: '100%',\r\n backgroundImage:\r\n 'linear-gradient(transparent, black), linear-gradient(to right, white, transparent)',\r\n }}\r\n >\r\n <SaturationCursor\r\n as={Box}\r\n sx={{\r\n position: 'absolute',\r\n width: '20px',\r\n height: '20px',\r\n border: '2px solid #ffffff',\r\n borderRadius: 'full',\r\n boxShadow: '0 0 15px 0 rgba(0, 0, 0, 0.15)',\r\n boxSizing: 'border-box',\r\n transform: 'translate(-10px, -10px)',\r\n }}\r\n />\r\n </Saturation>\r\n <Hue\r\n as={Box}\r\n sx={{\r\n position: 'relative',\r\n touchAction: 'none',\r\n userSelect: 'none',\r\n width: '100%',\r\n height: '12px',\r\n backgroundImage: `linear-gradient(to right, rgb(255, 0, 0), rgb(255, 255, 0), rgb(0, 255, 0), rgb(0, 255, 255), rgb(0, 0, 255), rgb(255, 0, 255), rgb(255, 0, 0))`,\r\n }}\r\n >\r\n <HueCursor\r\n as={Box}\r\n sx={{\r\n position: 'absolute',\r\n width: '20px',\r\n height: '20px',\r\n border: '2px solid #ffffff',\r\n borderRadius: 'full',\r\n boxShadow: 'rgba(0, 0, 0, 0.2) 0px 0px 0px 0.5px',\r\n boxSizing: 'border-box',\r\n transform: 'translate(-10px, -4px)',\r\n }}\r\n />\r\n </Hue>\r\n </BaseColorPicker>\r\n );\r\n};\r\n"],"mappings":";;;AAQA,SACEA,WAAW,IAAIC,gBADjB,EAEEC,GAAG,IAAIC,IAFT,EAGEC,SAAS,IAAIC,UAHf,EAIEC,UAAU,IAAIC,WAJhB,EAKEC,gBAAgB,IAAIC,iBALtB,QAMO,wBANP;AAUA,SAASC,GAAT,QAAoB,QAApB;;;AAQA,IAAMC,eAEL,GAAGV,gBAFJ;AAGA,IAAMC,GAA4B,GAAGC,IAArC;AACA,IAAMC,SAAwC,GAAGC,UAAjD;AACA,IAAMC,UAA0C,GAAGC,WAAnD;AACA,IAAMC,gBAAsD,GAC1DC,iBADF;AAGA,OAAO,IAAMT,WAAiC,GAAG,SAApCA,WAAoC,OAM3C;EAAA,IALJY,KAKI,QALJA,KAKI;EAAA,IAJJC,QAII,QAJJA,QAII;EAAA,sBAHJC,KAGI;EAAA,IAHJA,KAGI,2BAHI,GAGJ;EAAA,uBAFJC,MAEI;EAAA,IAFJA,MAEI,4BAFK,GAEL;EAAA,IADDC,UACC;;EACJ,oBACE,MAAC,eAAD;IACE,EAAE,EAAEN,GADN;IAEE,KAAK,EAAEI,KAFT;IAGE,MAAM,EAAEC,MAHV;IAIE,QAAQ,EAAEF,QAJZ;IAKE,KAAK,EAAED;EALT,GAMMI,UANN;IAAA,wBAQE,KAAC,UAAD;MACE,EAAE,EAAEN,GADN;MAEE,EAAE,EAAE;QACFO,QAAQ,EAAE,UADR;QAEFC,WAAW,EAAE,MAFX;QAGFC,UAAU,EAAE,MAHV;QAIFL,KAAK,EAAE,MAJL;QAKFM,eAAe,EACb;MANA,CAFN;MAAA,uBAWE,KAAC,gBAAD;QACE,EAAE,EAAEV,GADN;QAEE,EAAE,EAAE;UACFO,QAAQ,EAAE,UADR;UAEFH,KAAK,EAAE,MAFL;UAGFC,MAAM,EAAE,MAHN;UAIFM,MAAM,EAAE,mBAJN;UAKFC,YAAY,EAAE,MALZ;UAMFC,SAAS,EAAE,gCANT;UAOFC,SAAS,EAAE,YAPT;UAQFC,SAAS,EAAE;QART;MAFN;IAXF,EARF,eAiCE,KAAC,GAAD;MACE,EAAE,EAAEf,GADN;MAEE,EAAE,EAAE;QACFO,QAAQ,EAAE,UADR;QAEFC,WAAW,EAAE,MAFX;QAGFC,UAAU,EAAE,MAHV;QAIFL,KAAK,EAAE,MAJL;QAKFC,MAAM,EAAE,MALN;QAMFK,eAAe;MANb,CAFN;MAAA,uBAWE,KAAC,SAAD;QACE,EAAE,EAAEV,GADN;QAEE,EAAE,EAAE;UACFO,QAAQ,EAAE,UADR;UAEFH,KAAK,EAAE,MAFL;UAGFC,MAAM,EAAE,MAHN;UAIFM,MAAM,EAAE,mBAJN;UAKFC,YAAY,EAAE,MALZ;UAMFC,SAAS,EAAE,sCANT;UAOFC,SAAS,EAAE,YAPT;UAQFC,SAAS,EAAE;QART;MAFN;IAXF,EAjCF;EAAA,GADF;AA6DD,CApEM"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Color } from '@basic-ui/color-picker';
|
|
2
|
+
interface ColorSchemePickerProps {
|
|
3
|
+
label: string;
|
|
4
|
+
initialValue: Color;
|
|
5
|
+
onChange: (c: Color) => void;
|
|
6
|
+
onReset: () => void;
|
|
7
|
+
resetDisabled: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function ColorSchemePicker(props: ColorSchemePickerProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { startTransition, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Box } from '../Box';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { TextFieldColorPicker } from './TextFieldColorPicker';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export function ColorSchemePicker(props) {
|
|
9
|
+
var label = props.label,
|
|
10
|
+
initialValue = props.initialValue,
|
|
11
|
+
_onChange = props.onChange,
|
|
12
|
+
onReset = props.onReset,
|
|
13
|
+
resetDisabled = props.resetDisabled;
|
|
14
|
+
|
|
15
|
+
var _useState = useState(initialValue),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
value = _useState2[0],
|
|
18
|
+
setValue = _useState2[1];
|
|
19
|
+
|
|
20
|
+
var remountKey = useRef(0);
|
|
21
|
+
var resetting = useRef(false);
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
if (resetting.current) {
|
|
24
|
+
remountKey.current++;
|
|
25
|
+
resetting.current = false;
|
|
26
|
+
setValue(props.initialValue);
|
|
27
|
+
}
|
|
28
|
+
}, [props.initialValue]);
|
|
29
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
30
|
+
display: "flex",
|
|
31
|
+
minWidth: "300px",
|
|
32
|
+
flex: "1",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
children: [/*#__PURE__*/_jsx(TextFieldColorPicker, {
|
|
35
|
+
label: label,
|
|
36
|
+
value: value,
|
|
37
|
+
onChange: function onChange(c) {
|
|
38
|
+
setValue(c);
|
|
39
|
+
startTransition(function () {
|
|
40
|
+
_onChange(c);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, remountKey.current), /*#__PURE__*/_jsx(Button, {
|
|
44
|
+
variant: "text",
|
|
45
|
+
disabled: resetDisabled,
|
|
46
|
+
onClick: function onClick() {
|
|
47
|
+
resetting.current = true;
|
|
48
|
+
onReset();
|
|
49
|
+
},
|
|
50
|
+
children: "Reset"
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=ColorSchemePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorSchemePicker.js","names":["startTransition","useEffect","useRef","useState","Box","Button","TextFieldColorPicker","ColorSchemePicker","props","label","initialValue","onChange","onReset","resetDisabled","value","setValue","remountKey","resetting","current","c"],"sources":["../../../src/ThemeExplorer/ColorSchemePicker.tsx"],"sourcesContent":["import type { Color } from '@basic-ui/color-picker';\r\nimport { startTransition, useEffect, useRef, useState } from 'react';\r\n\r\nimport { Box } from '../Box';\r\nimport { Button } from '../Button';\r\nimport { TextFieldColorPicker } from './TextFieldColorPicker';\r\n\r\ninterface ColorSchemePickerProps {\r\n label: string;\r\n initialValue: Color;\r\n onChange: (c: Color) => void;\r\n onReset: () => void;\r\n resetDisabled: boolean;\r\n}\r\n\r\nexport function ColorSchemePicker(props: ColorSchemePickerProps) {\r\n const { label, initialValue, onChange, onReset, resetDisabled } = props;\r\n const [value, setValue] = useState(initialValue);\r\n\r\n const remountKey = useRef(0);\r\n const resetting = useRef(false);\r\n useEffect(() => {\r\n if (resetting.current) {\r\n remountKey.current++;\r\n resetting.current = false;\r\n setValue(props.initialValue);\r\n }\r\n }, [props.initialValue]);\r\n\r\n return (\r\n <Box display=\"flex\" minWidth=\"300px\" flex=\"1\" alignItems=\"center\">\r\n <TextFieldColorPicker\r\n key={remountKey.current}\r\n label={label}\r\n value={value}\r\n onChange={(c) => {\r\n setValue(c);\r\n startTransition(() => {\r\n onChange(c);\r\n });\r\n }}\r\n />\r\n <Button\r\n variant=\"text\"\r\n disabled={resetDisabled}\r\n onClick={() => {\r\n resetting.current = true;\r\n onReset();\r\n }}\r\n >\r\n Reset\r\n </Button>\r\n </Box>\r\n );\r\n}\r\n"],"mappings":";AACA,SAASA,eAAT,EAA0BC,SAA1B,EAAqCC,MAArC,EAA6CC,QAA7C,QAA6D,OAA7D;AAEA,SAASC,GAAT,QAAoB,QAApB;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,SAASC,oBAAT,QAAqC,wBAArC;;;AAUA,OAAO,SAASC,iBAAT,CAA2BC,KAA3B,EAA0D;EAC/D,IAAQC,KAAR,GAAkED,KAAlE,CAAQC,KAAR;EAAA,IAAeC,YAAf,GAAkEF,KAAlE,CAAeE,YAAf;EAAA,IAA6BC,SAA7B,GAAkEH,KAAlE,CAA6BG,QAA7B;EAAA,IAAuCC,OAAvC,GAAkEJ,KAAlE,CAAuCI,OAAvC;EAAA,IAAgDC,aAAhD,GAAkEL,KAAlE,CAAgDK,aAAhD;;EACA,gBAA0BV,QAAQ,CAACO,YAAD,CAAlC;EAAA;EAAA,IAAOI,KAAP;EAAA,IAAcC,QAAd;;EAEA,IAAMC,UAAU,GAAGd,MAAM,CAAC,CAAD,CAAzB;EACA,IAAMe,SAAS,GAAGf,MAAM,CAAC,KAAD,CAAxB;EACAD,SAAS,CAAC,YAAM;IACd,IAAIgB,SAAS,CAACC,OAAd,EAAuB;MACrBF,UAAU,CAACE,OAAX;MACAD,SAAS,CAACC,OAAV,GAAoB,KAApB;MACAH,QAAQ,CAACP,KAAK,CAACE,YAAP,CAAR;IACD;EACF,CANQ,EAMN,CAACF,KAAK,CAACE,YAAP,CANM,CAAT;EAQA,oBACE,MAAC,GAAD;IAAK,OAAO,EAAC,MAAb;IAAoB,QAAQ,EAAC,OAA7B;IAAqC,IAAI,EAAC,GAA1C;IAA8C,UAAU,EAAC,QAAzD;IAAA,wBACE,KAAC,oBAAD;MAEE,KAAK,EAAED,KAFT;MAGE,KAAK,EAAEK,KAHT;MAIE,QAAQ,EAAE,kBAACK,CAAD,EAAO;QACfJ,QAAQ,CAACI,CAAD,CAAR;QACAnB,eAAe,CAAC,YAAM;UACpBW,SAAQ,CAACQ,CAAD,CAAR;QACD,CAFc,CAAf;MAGD;IATH,GACOH,UAAU,CAACE,OADlB,CADF,eAYE,KAAC,MAAD;MACE,OAAO,EAAC,MADV;MAEE,QAAQ,EAAEL,aAFZ;MAGE,OAAO,EAAE,mBAAM;QACbI,SAAS,CAACC,OAAV,GAAoB,IAApB;QACAN,OAAO;MACR,CANH;MAAA;IAAA,EAZF;EAAA,EADF;AAyBD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface FontAutoCompleteProps {
|
|
2
|
+
label?: string;
|
|
3
|
+
initialValue?: string;
|
|
4
|
+
onSelect?: (font: string) => void;
|
|
5
|
+
onReset: () => void;
|
|
6
|
+
resetDisabled: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseMainFont(fontStr: string): string | undefined;
|
|
9
|
+
export declare function FontAutoComplete({ initialValue, onSelect, label, onReset, resetDisabled, }: FontAutoCompleteProps): JSX.Element;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useState, useMemo, useEffect, useRef, useDeferredValue, memo } from 'react';
|
|
3
|
+
import { Box } from '../Box';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { Combobox, ComboboxOption, ComboboxList, ComboboxPopover, ComboboxInput, ComboboxButton } from '../Combobox';
|
|
6
|
+
import { Text } from '../Text';
|
|
7
|
+
import { googleFonts } from './googleFonts';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
|
|
11
|
+
function useFontMatch(searchTerm) {
|
|
12
|
+
return useMemo(function () {
|
|
13
|
+
var term = searchTerm.trim().toLowerCase();
|
|
14
|
+
return term === '' ? googleFonts : googleFonts.filter(function (font) {
|
|
15
|
+
return font.toLowerCase().indexOf(term) !== -1;
|
|
16
|
+
});
|
|
17
|
+
}, [searchTerm]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function parseMainFont(fontStr) {
|
|
21
|
+
var fonts = fontStr.split(/, */).map(function (f) {
|
|
22
|
+
return f.replace(/"([^"]+)"/, '$1');
|
|
23
|
+
});
|
|
24
|
+
return fonts.length > 0 ? fonts[0] : undefined;
|
|
25
|
+
}
|
|
26
|
+
export function FontAutoComplete(_ref) {
|
|
27
|
+
var _ref$initialValue = _ref.initialValue,
|
|
28
|
+
initialValue = _ref$initialValue === void 0 ? '' : _ref$initialValue,
|
|
29
|
+
_onSelect = _ref.onSelect,
|
|
30
|
+
label = _ref.label,
|
|
31
|
+
onReset = _ref.onReset,
|
|
32
|
+
resetDisabled = _ref.resetDisabled;
|
|
33
|
+
|
|
34
|
+
var _useState = useState(undefined),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
term = _useState2[0],
|
|
37
|
+
setTerm = _useState2[1];
|
|
38
|
+
|
|
39
|
+
var filterTerm = useDeferredValue(term);
|
|
40
|
+
|
|
41
|
+
var _useState3 = useState(initialValue),
|
|
42
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
+
selected = _useState4[0],
|
|
44
|
+
setSelected = _useState4[1];
|
|
45
|
+
|
|
46
|
+
var resetting = useRef(false);
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
if (resetting.current) {
|
|
49
|
+
setSelected(initialValue);
|
|
50
|
+
setTerm(undefined);
|
|
51
|
+
resetting.current = false;
|
|
52
|
+
}
|
|
53
|
+
}, [initialValue]);
|
|
54
|
+
var results = useFontMatch(filterTerm || '');
|
|
55
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
56
|
+
display: "flex",
|
|
57
|
+
minWidth: "300px",
|
|
58
|
+
flex: "1",
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
children: [/*#__PURE__*/_jsxs(Combobox, {
|
|
61
|
+
onSelect: function onSelect(text) {
|
|
62
|
+
setSelected(text);
|
|
63
|
+
setTerm(text);
|
|
64
|
+
_onSelect === null || _onSelect === void 0 ? void 0 : _onSelect(text);
|
|
65
|
+
},
|
|
66
|
+
selectOnBlur: true,
|
|
67
|
+
width: "100%",
|
|
68
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
69
|
+
position: "relative",
|
|
70
|
+
width: "100%",
|
|
71
|
+
children: [/*#__PURE__*/_jsx(ComboboxInput, {
|
|
72
|
+
onChange: function onChange(e) {
|
|
73
|
+
setTerm(e.target.value);
|
|
74
|
+
},
|
|
75
|
+
value: term === undefined ? selected : term,
|
|
76
|
+
label: label
|
|
77
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
78
|
+
height: 56,
|
|
79
|
+
width: 56,
|
|
80
|
+
position: "absolute",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
display: "flex",
|
|
84
|
+
top: 0,
|
|
85
|
+
right: 0,
|
|
86
|
+
bottom: 0,
|
|
87
|
+
children: /*#__PURE__*/_jsx(ComboboxButton, {})
|
|
88
|
+
})]
|
|
89
|
+
}), /*#__PURE__*/_jsx(SearchResults, {
|
|
90
|
+
results: results
|
|
91
|
+
})]
|
|
92
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
93
|
+
variant: "text",
|
|
94
|
+
onClick: function onClick() {
|
|
95
|
+
resetting.current = true;
|
|
96
|
+
onReset();
|
|
97
|
+
},
|
|
98
|
+
disabled: resetDisabled,
|
|
99
|
+
children: "Reset"
|
|
100
|
+
})]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
var SearchResults = /*#__PURE__*/memo(function SearchResults(props) {
|
|
104
|
+
if (!props.results) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return /*#__PURE__*/_jsx(ComboboxPopover, {
|
|
109
|
+
zIndex: 100,
|
|
110
|
+
children: /*#__PURE__*/_jsxs(ComboboxList, {
|
|
111
|
+
persistSelection: true,
|
|
112
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
113
|
+
variant: "label-medium",
|
|
114
|
+
opacity: 0.6,
|
|
115
|
+
px: 3,
|
|
116
|
+
py: 2,
|
|
117
|
+
children: "Sorted by popularity"
|
|
118
|
+
}), props.results.map(function (result) {
|
|
119
|
+
return /*#__PURE__*/_jsx(ComboboxOption, {
|
|
120
|
+
id: result,
|
|
121
|
+
text: result,
|
|
122
|
+
value: result
|
|
123
|
+
}, result);
|
|
124
|
+
})]
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=FontAutoComplete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontAutoComplete.js","names":["useState","useMemo","useEffect","useRef","useDeferredValue","memo","Box","Button","Combobox","ComboboxOption","ComboboxList","ComboboxPopover","ComboboxInput","ComboboxButton","Text","googleFonts","useFontMatch","searchTerm","term","trim","toLowerCase","filter","font","indexOf","parseMainFont","fontStr","fonts","split","map","f","replace","length","undefined","FontAutoComplete","initialValue","onSelect","label","onReset","resetDisabled","setTerm","filterTerm","selected","setSelected","resetting","current","results","text","e","target","value","SearchResults","props","result"],"sources":["../../../src/ThemeExplorer/FontAutoComplete.tsx"],"sourcesContent":["import {\r\n useState,\r\n useMemo,\r\n useEffect,\r\n useRef,\r\n useDeferredValue,\r\n memo,\r\n} from 'react';\r\n\r\nimport { Box } from '../Box';\r\nimport { Button } from '../Button';\r\nimport {\r\n Combobox,\r\n ComboboxOption,\r\n ComboboxList,\r\n ComboboxPopover,\r\n ComboboxInput,\r\n ComboboxButton,\r\n} from '../Combobox';\r\nimport { Text } from '../Text';\r\nimport { googleFonts } from './googleFonts';\r\n\r\nexport interface FontAutoCompleteProps {\r\n label?: string;\r\n initialValue?: string;\r\n onSelect?: (font: string) => void;\r\n onReset: () => void;\r\n resetDisabled: boolean;\r\n}\r\n\r\nfunction useFontMatch(searchTerm: string) {\r\n return useMemo(() => {\r\n const term = searchTerm.trim().toLowerCase();\r\n return term === ''\r\n ? googleFonts\r\n : googleFonts.filter((font) => font.toLowerCase().indexOf(term) !== -1);\r\n }, [searchTerm]);\r\n}\r\n\r\nexport function parseMainFont(fontStr: string): string | undefined {\r\n const fonts = fontStr.split(/, */).map((f) => f.replace(/\"([^\"]+)\"/, '$1'));\r\n return fonts.length > 0 ? fonts[0] : undefined;\r\n}\r\n\r\nexport function FontAutoComplete({\r\n initialValue = '',\r\n onSelect,\r\n label,\r\n onReset,\r\n resetDisabled,\r\n}: FontAutoCompleteProps) {\r\n const [term, setTerm] = useState<undefined | string>(undefined);\r\n const filterTerm = useDeferredValue(term);\r\n const [selected, setSelected] = useState(initialValue);\r\n\r\n const resetting = useRef(false);\r\n useEffect(() => {\r\n if (resetting.current) {\r\n setSelected(initialValue);\r\n setTerm(undefined);\r\n resetting.current = false;\r\n }\r\n }, [initialValue]);\r\n\r\n const results = useFontMatch(filterTerm || '');\r\n return (\r\n <Box display=\"flex\" minWidth=\"300px\" flex=\"1\" alignItems=\"center\">\r\n <Combobox\r\n onSelect={(text) => {\r\n setSelected(text);\r\n setTerm(text);\r\n onSelect?.(text);\r\n }}\r\n selectOnBlur\r\n width=\"100%\"\r\n >\r\n <Box position=\"relative\" width=\"100%\">\r\n <ComboboxInput\r\n onChange={(e) => {\r\n setTerm(e.target.value);\r\n }}\r\n value={term === undefined ? selected : term}\r\n label={label}\r\n />\r\n <Box\r\n height={56}\r\n width={56}\r\n position=\"absolute\"\r\n justifyContent=\"center\"\r\n alignItems=\"center\"\r\n display=\"flex\"\r\n top={0}\r\n right={0}\r\n bottom={0}\r\n >\r\n <ComboboxButton />\r\n </Box>\r\n </Box>\r\n <SearchResults results={results} />\r\n </Combobox>\r\n <Button\r\n variant=\"text\"\r\n onClick={() => {\r\n resetting.current = true;\r\n onReset();\r\n }}\r\n disabled={resetDisabled}\r\n >\r\n Reset\r\n </Button>\r\n </Box>\r\n );\r\n}\r\n\r\nconst SearchResults = memo(function SearchResults(props: {\r\n results: string[];\r\n}) {\r\n if (!props.results) {\r\n return null;\r\n }\r\n\r\n return (\r\n <ComboboxPopover zIndex={100}>\r\n <ComboboxList persistSelection={true}>\r\n <Text variant=\"label-medium\" opacity={0.6} px={3} py={2}>\r\n Sorted by popularity\r\n </Text>\r\n {props.results.map((result) => (\r\n <ComboboxOption\r\n key={result}\r\n id={result}\r\n text={result}\r\n value={result}\r\n />\r\n ))}\r\n </ComboboxList>\r\n </ComboboxPopover>\r\n );\r\n});\r\n"],"mappings":";AAAA,SACEA,QADF,EAEEC,OAFF,EAGEC,SAHF,EAIEC,MAJF,EAKEC,gBALF,EAMEC,IANF,QAOO,OAPP;AASA,SAASC,GAAT,QAAoB,QAApB;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,SACEC,QADF,EAEEC,cAFF,EAGEC,YAHF,EAIEC,eAJF,EAKEC,aALF,EAMEC,cANF,QAOO,aAPP;AAQA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,WAAT,QAA4B,eAA5B;;;;AAUA,SAASC,YAAT,CAAsBC,UAAtB,EAA0C;EACxC,OAAOhB,OAAO,CAAC,YAAM;IACnB,IAAMiB,IAAI,GAAGD,UAAU,CAACE,IAAX,GAAkBC,WAAlB,EAAb;IACA,OAAOF,IAAI,KAAK,EAAT,GACHH,WADG,GAEHA,WAAW,CAACM,MAAZ,CAAmB,UAACC,IAAD;MAAA,OAAUA,IAAI,CAACF,WAAL,GAAmBG,OAAnB,CAA2BL,IAA3B,MAAqC,CAAC,CAAhD;IAAA,CAAnB,CAFJ;EAGD,CALa,EAKX,CAACD,UAAD,CALW,CAAd;AAMD;;AAED,OAAO,SAASO,aAAT,CAAuBC,OAAvB,EAA4D;EACjE,IAAMC,KAAK,GAAGD,OAAO,CAACE,KAAR,CAAc,KAAd,EAAqBC,GAArB,CAAyB,UAACC,CAAD;IAAA,OAAOA,CAAC,C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E,GAAtC;QAA2C,EAAE,EAAE,CAA/C;QAAkD,EAAE,EAAE,CAAtD;QAAA;MAAA,EADF,EAIGM,KAAK,CAACN,OAAN,CAAcjB,GAAd,CAAkB,UAACwB,MAAD;QAAA,oBACjB,KAAC,cAAD;UAEE,EAAE,EAAEA,MAFN;UAGE,IAAI,EAAEA,MAHR;UAIE,KAAK,EAAEA;QAJT,GACOA,MADP,CADiB;MAAA,CAAlB,CAJH;IAAA;EADF,EADF;AAiBD,CAxByB,CAA1B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { Color } from '@basic-ui/color-picker';
|
|
3
|
-
import type { TextFieldProps } from '../';
|
|
4
|
-
export interface TextFieldColorPickerProps extends Omit<TextFieldProps, 'value' | 'defaultValue' | 'onChange'> {
|
|
5
|
-
value?: Color;
|
|
6
|
-
defaultValue?: Color;
|
|
7
|
-
onChange?: (color: Color) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare const TextFieldColorPicker: import("react").NamedExoticComponent<TextFieldColorPickerProps>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Color } from '@basic-ui/color-picker';
|
|
3
|
+
import type { TextFieldProps } from '../';
|
|
4
|
+
export interface TextFieldColorPickerProps extends Omit<TextFieldProps, 'value' | 'defaultValue' | 'onChange'> {
|
|
5
|
+
value?: Color;
|
|
6
|
+
defaultValue?: Color;
|
|
7
|
+
onChange?: (color: Color) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const TextFieldColorPicker: import("react").NamedExoticComponent<TextFieldColorPickerProps>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["value", "defaultValue", "onChange", "disabled"];
|
|
4
5
|
import { toColor } from '@basic-ui/color-picker';
|
|
5
6
|
import { Popper, useControlledState, useOnClickOutside } from '@basic-ui/core';
|
|
6
7
|
import { useRef, useState, memo, useCallback } from 'react';
|
|
@@ -15,14 +16,14 @@ export var TextFieldColorPicker = /*#__PURE__*/memo(function (props) {
|
|
|
15
16
|
defaultValue = _props$defaultValue === void 0 ? toColor('hex', '#33ff33') : _props$defaultValue,
|
|
16
17
|
onChangeProp = props.onChange,
|
|
17
18
|
disabled = props.disabled,
|
|
18
|
-
otherProps = _objectWithoutProperties(props,
|
|
19
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
19
20
|
|
|
20
21
|
var _useState = useState(false),
|
|
21
22
|
_useState2 = _slicedToArray(_useState, 2),
|
|
22
23
|
popoverOpen = _useState2[0],
|
|
23
24
|
setPopoverOpen = _useState2[1];
|
|
24
25
|
|
|
25
|
-
var _useState3 = useState((valueProp
|
|
26
|
+
var _useState3 = useState((valueProp === null || valueProp === void 0 ? void 0 : valueProp.hex) || defaultValue.hex),
|
|
26
27
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
27
28
|
text = _useState4[0],
|
|
28
29
|
setText = _useState4[1];
|
|
@@ -47,7 +48,7 @@ export var TextFieldColorPicker = /*#__PURE__*/memo(function (props) {
|
|
|
47
48
|
var popoverRef = useRef(null);
|
|
48
49
|
var buttonRef = useRef(null);
|
|
49
50
|
useOnClickOutside(popoverRef, function (e) {
|
|
50
|
-
if (e.target === (buttonRef
|
|
51
|
+
if (e.target === (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current)) {
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"TextFieldColorPicker.js","names":["toColor","Popper","useControlledState","useOnClickOutside","useRef","useState","memo","useCallback","alpha","Box","TextField","Button","ColorPicker","TextFieldColorPicker","props","valueProp","value","defaultValue","onChangeProp","onChange","disabled","otherProps","popoverOpen","setPopoverOpen","hex","text","setText","setState","v","_onChange","color","replace","popoverRef","buttonRef","e","target","current","backgroundColor","open","pointerEvents","cursor","width","height","borderRadius","borderWidth","borderColor","borderStyle","outlineColor","match","zIndex"],"sources":["../../../src/ThemeExplorer/TextFieldColorPicker.tsx"],"sourcesContent":["import type { Color } from '@basic-ui/color-picker';\r\nimport { toColor } from '@basic-ui/color-picker';\r\nimport { Popper, useControlledState, useOnClickOutside } from '@basic-ui/core';\r\nimport { useRef, useState, memo, useCallback } from 'react';\r\n\r\nimport type { TextFieldProps } from '../';\r\nimport { alpha, Box, TextField, Button } from '../';\r\nimport { ColorPicker } from './ColorPicker';\r\n\r\nexport interface TextFieldColorPickerProps\r\n extends Omit<TextFieldProps, 'value' | 'defaultValue' | 'onChange'> {\r\n value?: Color;\r\n defaultValue?: Color;\r\n onChange?: (color: Color) => void;\r\n}\r\n\r\nexport const TextFieldColorPicker = memo<TextFieldColorPickerProps>((props) => {\r\n const {\r\n value: valueProp,\r\n defaultValue = toColor('hex', '#33ff33'),\r\n onChange: onChangeProp,\r\n disabled,\r\n ...otherProps\r\n } = props;\r\n\r\n const [popoverOpen, setPopoverOpen] = useState(false);\r\n const [text, setText] = useState(valueProp?.hex || defaultValue.hex);\r\n const [value, _onChange] = useControlledState<Color, any, []>(\r\n valueProp,\r\n onChangeProp as any,\r\n defaultValue,\r\n (setState) => (v: any) => {\r\n setState(v);\r\n setText(v.hex);\r\n }\r\n );\r\n\r\n const onChange = useCallback(\r\n (color: Color) => {\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n _onChange!(color);\r\n setText(color.hex.replace('#', ''));\r\n },\r\n [_onChange]\r\n );\r\n\r\n const popoverRef = useRef<HTMLDivElement>(null);\r\n const buttonRef = useRef<HTMLButtonElement>(null);\r\n useOnClickOutside(popoverRef, (e) => {\r\n if (e.target === buttonRef?.current) {\r\n return;\r\n }\r\n setPopoverOpen(false);\r\n });\r\n\r\n return (\r\n <>\r\n <TextField\r\n disabled={disabled}\r\n value={text.replace('#', '')}\r\n leadingIcon={'#'}\r\n trailingIcon={\r\n <Button\r\n style={{ backgroundColor: value.hex }}\r\n color=\"on.surface\"\r\n ref={buttonRef}\r\n onClick={() => setPopoverOpen((open) => !open)}\r\n disabled={disabled}\r\n sx={{\r\n pointerEvents: 'all',\r\n cursor: 'pointer',\r\n width: 32,\r\n height: 32,\r\n borderRadius: 'extra-small',\r\n borderWidth: '1px',\r\n borderColor: alpha('on.surface', 0.38),\r\n borderStyle: 'solid',\r\n outlineColor: 'transparent',\r\n }}\r\n />\r\n }\r\n maxLength={6}\r\n hideCharacterCounter\r\n onChange={(e) => {\r\n if (e.target.value.match(/^[a-fA-F0-9]{6}$/)) {\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n onChange!(toColor('hex', '#' + e.target.value));\r\n return;\r\n }\r\n setText(e.target.value);\r\n }}\r\n {...otherProps}\r\n />\r\n {popoverOpen && (\r\n <Popper\r\n anchorEl={buttonRef}\r\n placement=\"bottom-end\"\r\n style={{ zIndex: 2 }}\r\n >\r\n <Box ref={popoverRef} py={2}>\r\n <Box boxShadow={4}>\r\n <ColorPicker\r\n color={value}\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n onChange={onChange!}\r\n width={220}\r\n height={220}\r\n />\r\n </Box>\r\n </Box>\r\n </Popper>\r\n )}\r\n </>\r\n );\r\n});\r\n"],"mappings":";;;;AACA,SAASA,OAAT,QAAwB,wBAAxB;AACA,SAASC,MAAT,EAAiBC,kBAAjB,EAAqCC,iBAArC,QAA8D,gBAA9D;AACA,SAASC,MAAT,EAAiBC,QAAjB,EAA2BC,IAA3B,EAAiCC,WAAjC,QAAoD,OAApD;AAGA,SAASC,KAAT,EAAgBC,GAAhB,EAAqBC,SAArB,EAAgCC,MAAhC,QAA8C,KAA9C;AACA,SAASC,WAAT,QAA4B,eAA5B;;;;AASA,OAAO,IAAMC,oBAAoB,gBAAGP,IAAI,CAA4B,UAACQ,KAAD,EAAW;E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EADF,EAqCGC,WAAW,iBACV,KAAC,MAAD;MACE,QAAQ,EAAEW,SADZ;MAEE,SAAS,EAAC,YAFZ;MAGE,KAAK,EAAE;QAAEgB,MAAM,EAAE;MAAV,CAHT;MAAA,uBAKE,KAAC,GAAD;QAAK,GAAG,EAAEjB,UAAV;QAAsB,EAAE,EAAE,CAA1B;QAAA,uBACE,KAAC,GAAD;UAAK,SAAS,EAAE,CAAhB;UAAA,uBACE,KAAC,WAAD;YACE,KAAK,EAAEhB,KADT,CAEE;YAFF;YAGE,QAAQ,EAAEG,UAHZ;YAIE,KAAK,EAAE,GAJT;YAKE,MAAM,EAAE;UALV;QADF;MADF;IALF,EAtCJ;EAAA,EADF;AA2DD,CAlGuC,CAAjC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { Theme } from '../theme/theme';
|
|
3
|
+
export interface ThemeBuilderProps {
|
|
4
|
+
CodeHighlightingComponent?: ComponentType<{
|
|
5
|
+
children: string;
|
|
6
|
+
className: string;
|
|
7
|
+
showButtons?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
baseTheme: Theme;
|
|
10
|
+
}
|
|
11
|
+
export declare const ThemeBuilder: (props: ThemeBuilderProps) => JSX.Element | null;
|