@seed-design/react 0.0.1-alpha-20250210081704
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 +7 -0
- package/lib/components/ActionButton/ActionButton.d.ts +24 -0
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -0
- package/lib/components/ActionButton/ActionButton.namespace.d.ts +2 -0
- package/lib/components/ActionButton/ActionButton.namespace.d.ts.map +1 -0
- package/lib/components/ActionButton/index.d.ts +3 -0
- package/lib/components/ActionButton/index.d.ts.map +1 -0
- package/lib/components/ActionChip/ActionChip.d.ts +23 -0
- package/lib/components/ActionChip/ActionChip.d.ts.map +1 -0
- package/lib/components/ActionChip/ActionChip.namespace.d.ts +2 -0
- package/lib/components/ActionChip/ActionChip.namespace.d.ts.map +1 -0
- package/lib/components/ActionChip/index.d.ts +3 -0
- package/lib/components/ActionChip/index.d.ts.map +1 -0
- package/lib/components/ActionSheet/ActionSheet.d.ts +47 -0
- package/lib/components/ActionSheet/ActionSheet.d.ts.map +1 -0
- package/lib/components/ActionSheet/ActionSheet.namespace.d.ts +2 -0
- package/lib/components/ActionSheet/ActionSheet.namespace.d.ts.map +1 -0
- package/lib/components/ActionSheet/index.d.ts +3 -0
- package/lib/components/ActionSheet/index.d.ts.map +1 -0
- package/lib/components/Avatar/Avatar.d.ts +21 -0
- package/lib/components/Avatar/Avatar.d.ts.map +1 -0
- package/lib/components/Avatar/Avatar.namespace.d.ts +2 -0
- package/lib/components/Avatar/Avatar.namespace.d.ts.map +1 -0
- package/lib/components/Avatar/index.d.ts +3 -0
- package/lib/components/Avatar/index.d.ts.map +1 -0
- package/lib/components/Badge/Badge.d.ts +10 -0
- package/lib/components/Badge/Badge.d.ts.map +1 -0
- package/lib/components/Badge/Badge.namespace.d.ts +2 -0
- package/lib/components/Badge/Badge.namespace.d.ts.map +1 -0
- package/lib/components/Badge/index.d.ts +3 -0
- package/lib/components/Badge/index.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts +42 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts +2 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts.map +1 -0
- package/lib/components/BottomSheet/index.d.ts +3 -0
- package/lib/components/BottomSheet/index.d.ts.map +1 -0
- package/lib/components/Box/Box.d.ts +50 -0
- package/lib/components/Box/Box.d.ts.map +1 -0
- package/lib/components/Box/index.d.ts +2 -0
- package/lib/components/Box/index.d.ts.map +1 -0
- package/lib/components/Callout/Callout.d.ts +33 -0
- package/lib/components/Callout/Callout.d.ts.map +1 -0
- package/lib/components/Callout/Callout.namespace.d.ts +2 -0
- package/lib/components/Callout/Callout.namespace.d.ts.map +1 -0
- package/lib/components/Callout/index.d.ts +3 -0
- package/lib/components/Callout/index.d.ts.map +1 -0
- package/lib/components/Celcius/Celcius.d.ts +6 -0
- package/lib/components/Celcius/Celcius.d.ts.map +1 -0
- package/lib/components/Celcius/index.d.ts +2 -0
- package/lib/components/Celcius/index.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.d.ts +31 -0
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.namespace.d.ts +2 -0
- package/lib/components/Checkbox/Checkbox.namespace.d.ts.map +1 -0
- package/lib/components/Checkbox/index.d.ts +3 -0
- package/lib/components/Checkbox/index.d.ts.map +1 -0
- package/lib/components/ChipTabs/ChipTabs.d.ts +26 -0
- package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.d.ts +2 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.d.ts.map +1 -0
- package/lib/components/ChipTabs/index.d.ts +3 -0
- package/lib/components/ChipTabs/index.d.ts.map +1 -0
- package/lib/components/Columns/Columns.d.ts +10 -0
- package/lib/components/Columns/Columns.d.ts.map +1 -0
- package/lib/components/Columns/index.d.ts +2 -0
- package/lib/components/Columns/index.d.ts.map +1 -0
- package/lib/components/ControlChip/ControlChip.d.ts +25 -0
- package/lib/components/ControlChip/ControlChip.d.ts.map +1 -0
- package/lib/components/ControlChip/ControlChip.namespace.d.ts +2 -0
- package/lib/components/ControlChip/ControlChip.namespace.d.ts.map +1 -0
- package/lib/components/ControlChip/index.d.ts +3 -0
- package/lib/components/ControlChip/index.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.d.ts +34 -0
- package/lib/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts +2 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts.map +1 -0
- package/lib/components/Dialog/index.d.ts +3 -0
- package/lib/components/Dialog/index.d.ts.map +1 -0
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.d.ts +54 -0
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.d.ts.map +1 -0
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.namespace.d.ts +2 -0
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.namespace.d.ts.map +1 -0
- package/lib/components/ExtendedActionSheet/index.d.ts +3 -0
- package/lib/components/ExtendedActionSheet/index.d.ts.map +1 -0
- package/lib/components/ExtendedFab/ExtendedFab.d.ts +13 -0
- package/lib/components/ExtendedFab/ExtendedFab.d.ts.map +1 -0
- package/lib/components/ExtendedFab/ExtendedFab.namespace.d.ts +2 -0
- package/lib/components/ExtendedFab/ExtendedFab.namespace.d.ts.map +1 -0
- package/lib/components/ExtendedFab/index.d.ts +3 -0
- package/lib/components/ExtendedFab/index.d.ts.map +1 -0
- package/lib/components/Fab/Fab.d.ts +11 -0
- package/lib/components/Fab/Fab.d.ts.map +1 -0
- package/lib/components/Fab/Fab.namespace.d.ts +2 -0
- package/lib/components/Fab/Fab.namespace.d.ts.map +1 -0
- package/lib/components/Fab/index.d.ts +3 -0
- package/lib/components/Fab/index.d.ts.map +1 -0
- package/lib/components/Flex/Flex.d.ts +12 -0
- package/lib/components/Flex/Flex.d.ts.map +1 -0
- package/lib/components/Flex/index.d.ts +2 -0
- package/lib/components/Flex/index.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts +47 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts +2 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts.map +1 -0
- package/lib/components/HelpBubble/index.d.ts +3 -0
- package/lib/components/HelpBubble/index.d.ts.map +1 -0
- package/lib/components/Inline/Inline.d.ts +6 -0
- package/lib/components/Inline/Inline.d.ts.map +1 -0
- package/lib/components/Inline/index.d.ts +2 -0
- package/lib/components/Inline/index.d.ts.map +1 -0
- package/lib/components/InlineBanner/InlineBanner.d.ts +36 -0
- package/lib/components/InlineBanner/InlineBanner.d.ts.map +1 -0
- package/lib/components/InlineBanner/InlineBanner.namespace.d.ts +2 -0
- package/lib/components/InlineBanner/InlineBanner.namespace.d.ts.map +1 -0
- package/lib/components/InlineBanner/index.d.ts +3 -0
- package/lib/components/InlineBanner/index.d.ts.map +1 -0
- package/lib/components/MannerTempBadge/MannerTempBadge.d.ts +10 -0
- package/lib/components/MannerTempBadge/MannerTempBadge.d.ts.map +1 -0
- package/lib/components/MannerTempBadge/MannerTempBadge.namespace.d.ts +2 -0
- package/lib/components/MannerTempBadge/MannerTempBadge.namespace.d.ts.map +1 -0
- package/lib/components/MannerTempBadge/index.d.ts +3 -0
- package/lib/components/MannerTempBadge/index.d.ts.map +1 -0
- package/lib/components/ProgressCircle/ProgressCircle.d.ts +12 -0
- package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -0
- package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts +2 -0
- package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts.map +1 -0
- package/lib/components/ProgressCircle/index.d.ts +3 -0
- package/lib/components/ProgressCircle/index.d.ts.map +1 -0
- package/lib/components/PullToRefresh/PullToRefresh.d.ts +12 -0
- package/lib/components/PullToRefresh/PullToRefresh.d.ts.map +1 -0
- package/lib/components/PullToRefresh/PullToRefresh.namespace.d.ts +2 -0
- package/lib/components/PullToRefresh/PullToRefresh.namespace.d.ts.map +1 -0
- package/lib/components/PullToRefresh/index.d.ts +3 -0
- package/lib/components/PullToRefresh/index.d.ts.map +1 -0
- package/lib/components/ReactionButton/ReactionButton.d.ts +22 -0
- package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -0
- package/lib/components/ReactionButton/ReactionButton.namespace.d.ts +2 -0
- package/lib/components/ReactionButton/ReactionButton.namespace.d.ts.map +1 -0
- package/lib/components/ReactionButton/index.d.ts +3 -0
- package/lib/components/ReactionButton/index.d.ts.map +1 -0
- package/lib/components/SegmentedControl/SegmentedControl.d.ts +19 -0
- package/lib/components/SegmentedControl/SegmentedControl.d.ts.map +1 -0
- package/lib/components/SegmentedControl/SegmentedControl.namespace.d.ts +2 -0
- package/lib/components/SegmentedControl/SegmentedControl.namespace.d.ts.map +1 -0
- package/lib/components/SegmentedControl/index.d.ts +3 -0
- package/lib/components/SegmentedControl/index.d.ts.map +1 -0
- package/lib/components/SelectBox/CheckSelectBox.d.ts +32 -0
- package/lib/components/SelectBox/CheckSelectBox.d.ts.map +1 -0
- package/lib/components/SelectBox/CheckSelectBox.namespace.d.ts +2 -0
- package/lib/components/SelectBox/CheckSelectBox.namespace.d.ts.map +1 -0
- package/lib/components/SelectBox/RadioSelectBox.d.ts +28 -0
- package/lib/components/SelectBox/RadioSelectBox.d.ts.map +1 -0
- package/lib/components/SelectBox/RadioSelectBox.namespace.d.ts +2 -0
- package/lib/components/SelectBox/RadioSelectBox.namespace.d.ts.map +1 -0
- package/lib/components/SelectBox/index.d.ts +5 -0
- package/lib/components/SelectBox/index.d.ts.map +1 -0
- package/lib/components/Skeleton/Skeleton.d.ts +7 -0
- package/lib/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/components/Skeleton/index.d.ts +2 -0
- package/lib/components/Skeleton/index.d.ts.map +1 -0
- package/lib/components/Snackbar/Snackbar.d.ts +35 -0
- package/lib/components/Snackbar/Snackbar.d.ts.map +1 -0
- package/lib/components/Snackbar/Snackbar.namespace.d.ts +2 -0
- package/lib/components/Snackbar/Snackbar.namespace.d.ts.map +1 -0
- package/lib/components/Snackbar/index.d.ts +5 -0
- package/lib/components/Snackbar/index.d.ts.map +1 -0
- package/lib/components/Snackbar/useSnackbarAdapter.d.ts +11 -0
- package/lib/components/Snackbar/useSnackbarAdapter.d.ts.map +1 -0
- package/lib/components/Stack/Stack.d.ts +6 -0
- package/lib/components/Stack/Stack.d.ts.map +1 -0
- package/lib/components/Stack/index.d.ts +2 -0
- package/lib/components/Stack/index.d.ts.map +1 -0
- package/lib/components/Switch/Switch.d.ts +19 -0
- package/lib/components/Switch/Switch.d.ts.map +1 -0
- package/lib/components/Switch/Switch.namespace.d.ts +2 -0
- package/lib/components/Switch/Switch.namespace.d.ts.map +1 -0
- package/lib/components/Switch/index.d.ts +3 -0
- package/lib/components/Switch/index.d.ts.map +1 -0
- package/lib/components/Tabs/Tabs.d.ts +32 -0
- package/lib/components/Tabs/Tabs.d.ts.map +1 -0
- package/lib/components/Tabs/Tabs.namespace.d.ts +2 -0
- package/lib/components/Tabs/Tabs.namespace.d.ts.map +1 -0
- package/lib/components/Tabs/index.d.ts +3 -0
- package/lib/components/Tabs/index.d.ts.map +1 -0
- package/lib/components/Text/Text.d.ts +36 -0
- package/lib/components/Text/Text.d.ts.map +1 -0
- package/lib/components/Text/index.d.ts +2 -0
- package/lib/components/Text/index.d.ts.map +1 -0
- package/lib/components/TextButton/TextButton.d.ts +17 -0
- package/lib/components/TextButton/TextButton.d.ts.map +1 -0
- package/lib/components/TextButton/TextButton.namespace.d.ts +2 -0
- package/lib/components/TextButton/TextButton.namespace.d.ts.map +1 -0
- package/lib/components/TextButton/index.d.ts +3 -0
- package/lib/components/TextButton/index.d.ts.map +1 -0
- package/lib/components/TextField/TextField.d.ts +65 -0
- package/lib/components/TextField/TextField.d.ts.map +1 -0
- package/lib/components/TextField/TextField.namespace.d.ts +2 -0
- package/lib/components/TextField/TextField.namespace.d.ts.map +1 -0
- package/lib/components/TextField/index.d.ts +3 -0
- package/lib/components/TextField/index.d.ts.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.d.ts +22 -0
- package/lib/components/ToggleButton/ToggleButton.d.ts.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.namespace.d.ts +2 -0
- package/lib/components/ToggleButton/ToggleButton.namespace.d.ts.map +1 -0
- package/lib/components/ToggleButton/index.d.ts +3 -0
- package/lib/components/ToggleButton/index.d.ts.map +1 -0
- package/lib/components/VisuallyHidden/VisuallyHidden.d.ts +6 -0
- package/lib/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -0
- package/lib/components/VisuallyHidden/index.d.ts +2 -0
- package/lib/components/VisuallyHidden/index.d.ts.map +1 -0
- package/lib/components/index.d.ts +38 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/private/Icon.d.ts +5 -0
- package/lib/components/private/Icon.d.ts.map +1 -0
- package/lib/components/private/useDismissible.d.ts +1665 -0
- package/lib/components/private/useDismissible.d.ts.map +1 -0
- package/lib/components/private/usePendingButton.d.ts +831 -0
- package/lib/components/private/usePendingButton.d.ts.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2309 -0
- package/lib/index.js.map +7 -0
- package/lib/index.mjs +2318 -0
- package/lib/index.mjs.map +7 -0
- package/lib/primitive.d.ts +12 -0
- package/lib/primitive.d.ts.map +1 -0
- package/lib/primitive.js +31 -0
- package/lib/primitive.js.map +7 -0
- package/lib/primitive.mjs +13 -0
- package/lib/primitive.mjs.map +7 -0
- package/lib/utils/createStyleContext.d.ts +24 -0
- package/lib/utils/createStyleContext.d.ts.map +1 -0
- package/lib/utils/createWithStateProps.d.ts +10 -0
- package/lib/utils/createWithStateProps.d.ts.map +1 -0
- package/lib/vars.d.ts +2 -0
- package/lib/vars.d.ts.map +1 -0
- package/lib/vars.js +21 -0
- package/lib/vars.js.map +7 -0
- package/lib/vars.mjs +3 -0
- package/lib/vars.mjs.map +7 -0
- package/package.json +80 -0
- package/src/components/ActionButton/ActionButton.namespace.ts +14 -0
- package/src/components/ActionButton/ActionButton.tsx +98 -0
- package/src/components/ActionButton/index.ts +16 -0
- package/src/components/ActionChip/ActionChip.namespace.ts +14 -0
- package/src/components/ActionChip/ActionChip.tsx +54 -0
- package/src/components/ActionChip/index.ts +16 -0
- package/src/components/ActionSheet/ActionSheet.namespace.ts +28 -0
- package/src/components/ActionSheet/ActionSheet.tsx +150 -0
- package/src/components/ActionSheet/index.ts +30 -0
- package/src/components/Avatar/Avatar.namespace.ts +12 -0
- package/src/components/Avatar/Avatar.tsx +69 -0
- package/src/components/Avatar/index.ts +14 -0
- package/src/components/Badge/Badge.namespace.ts +6 -0
- package/src/components/Badge/Badge.tsx +21 -0
- package/src/components/Badge/index.ts +8 -0
- package/src/components/BottomSheet/BottomSheet.namespace.ts +26 -0
- package/src/components/BottomSheet/BottomSheet.tsx +123 -0
- package/src/components/BottomSheet/index.ts +28 -0
- package/src/components/Box/Box.tsx +303 -0
- package/src/components/Box/index.ts +1 -0
- package/src/components/Callout/Callout.namespace.ts +20 -0
- package/src/components/Callout/Callout.tsx +101 -0
- package/src/components/Callout/index.ts +22 -0
- package/src/components/Celcius/Celcius.tsx +9 -0
- package/src/components/Celcius/index.ts +4 -0
- package/src/components/Checkbox/Checkbox.namespace.ts +12 -0
- package/src/components/Checkbox/Checkbox.tsx +96 -0
- package/src/components/Checkbox/index.ts +14 -0
- package/src/components/ChipTabs/ChipTabs.namespace.ts +16 -0
- package/src/components/ChipTabs/ChipTabs.tsx +80 -0
- package/src/components/ChipTabs/index.ts +18 -0
- package/src/components/Columns/Columns.tsx +38 -0
- package/src/components/Columns/index.ts +1 -0
- package/src/components/ControlChip/ControlChip.namespace.ts +15 -0
- package/src/components/ControlChip/ControlChip.tsx +63 -0
- package/src/components/ControlChip/index.ts +17 -0
- package/src/components/Dialog/Dialog.namespace.ts +22 -0
- package/src/components/Dialog/Dialog.tsx +94 -0
- package/src/components/Dialog/index.ts +24 -0
- package/src/components/ExtendedActionSheet/ExtendedActionSheet.namespace.ts +32 -0
- package/src/components/ExtendedActionSheet/ExtendedActionSheet.tsx +181 -0
- package/src/components/ExtendedActionSheet/index.ts +34 -0
- package/src/components/ExtendedFab/ExtendedFab.namespace.ts +8 -0
- package/src/components/ExtendedFab/ExtendedFab.tsx +44 -0
- package/src/components/ExtendedFab/index.ts +10 -0
- package/src/components/Fab/Fab.namespace.ts +6 -0
- package/src/components/Fab/Fab.tsx +22 -0
- package/src/components/Fab/index.ts +8 -0
- package/src/components/Flex/Flex.tsx +19 -0
- package/src/components/Flex/index.ts +1 -0
- package/src/components/HelpBubble/HelpBubble.namespace.ts +25 -0
- package/src/components/HelpBubble/HelpBubble.tsx +158 -0
- package/src/components/HelpBubble/index.ts +28 -0
- package/src/components/Inline/Inline.tsx +18 -0
- package/src/components/Inline/index.ts +1 -0
- package/src/components/InlineBanner/InlineBanner.namespace.ts +22 -0
- package/src/components/InlineBanner/InlineBanner.tsx +105 -0
- package/src/components/InlineBanner/index.ts +24 -0
- package/src/components/MannerTempBadge/MannerTempBadge.namespace.ts +6 -0
- package/src/components/MannerTempBadge/MannerTempBadge.tsx +32 -0
- package/src/components/MannerTempBadge/index.ts +8 -0
- package/src/components/ProgressCircle/ProgressCircle.namespace.ts +8 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +31 -0
- package/src/components/ProgressCircle/index.ts +10 -0
- package/src/components/PullToRefresh/PullToRefresh.namespace.ts +8 -0
- package/src/components/PullToRefresh/PullToRefresh.tsx +25 -0
- package/src/components/PullToRefresh/index.ts +10 -0
- package/src/components/ReactionButton/ReactionButton.namespace.ts +12 -0
- package/src/components/ReactionButton/ReactionButton.tsx +80 -0
- package/src/components/ReactionButton/index.ts +14 -0
- package/src/components/SegmentedControl/SegmentedControl.namespace.ts +12 -0
- package/src/components/SegmentedControl/SegmentedControl.tsx +53 -0
- package/src/components/SegmentedControl/index.ts +14 -0
- package/src/components/SelectBox/CheckSelectBox.namespace.ts +18 -0
- package/src/components/SelectBox/CheckSelectBox.tsx +79 -0
- package/src/components/SelectBox/RadioSelectBox.namespace.ts +18 -0
- package/src/components/SelectBox/RadioSelectBox.tsx +73 -0
- package/src/components/SelectBox/index.ts +40 -0
- package/src/components/Skeleton/Skeleton.tsx +13 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Snackbar/Snackbar.namespace.ts +20 -0
- package/src/components/Snackbar/Snackbar.tsx +100 -0
- package/src/components/Snackbar/index.ts +32 -0
- package/src/components/Snackbar/useSnackbarAdapter.ts +28 -0
- package/src/components/Stack/Stack.tsx +8 -0
- package/src/components/Stack/index.ts +1 -0
- package/src/components/Switch/Switch.namespace.ts +12 -0
- package/src/components/Switch/Switch.tsx +50 -0
- package/src/components/Switch/index.ts +14 -0
- package/src/components/Tabs/Tabs.namespace.ts +20 -0
- package/src/components/Tabs/Tabs.tsx +94 -0
- package/src/components/Tabs/index.ts +22 -0
- package/src/components/Text/Text.tsx +139 -0
- package/src/components/Text/index.tsx +1 -0
- package/src/components/TextButton/TextButton.namespace.ts +10 -0
- package/src/components/TextButton/TextButton.tsx +41 -0
- package/src/components/TextButton/index.ts +12 -0
- package/src/components/TextField/TextField.namespace.tsx +38 -0
- package/src/components/TextField/TextField.tsx +258 -0
- package/src/components/TextField/index.tsx +40 -0
- package/src/components/ToggleButton/ToggleButton.namespace.ts +12 -0
- package/src/components/ToggleButton/ToggleButton.tsx +75 -0
- package/src/components/ToggleButton/index.ts +14 -0
- package/src/components/VisuallyHidden/VisuallyHidden.tsx +13 -0
- package/src/components/VisuallyHidden/index.tsx +1 -0
- package/src/components/index.ts +37 -0
- package/src/components/private/Icon.tsx +15 -0
- package/src/components/private/useDismissible.tsx +86 -0
- package/src/components/private/usePendingButton.tsx +45 -0
- package/src/index.tsx +1 -0
- package/src/primitive.ts +11 -0
- package/src/utils/createStyleContext.tsx +125 -0
- package/src/utils/createWithStateProps.tsx +28 -0
- package/src/vars.ts +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ToggleButtonLabel as Label,
|
|
3
|
+
ToggleButtonPrefixIcon as PrefixIcon,
|
|
4
|
+
ToggleButtonProgressIndicator as ProgressIndicator,
|
|
5
|
+
ToggleButtonRoot as Root,
|
|
6
|
+
ToggleButtonSuffixIcon as SuffixIcon,
|
|
7
|
+
type ToggleButtonLabelProps as LabelProps,
|
|
8
|
+
type ToggleButtonPrefixIconProps as PrefixIconProps,
|
|
9
|
+
type ToggleButtonProgressIndicatorProps as ProgressIndicatorProps,
|
|
10
|
+
type ToggleButtonRootProps as RootProps,
|
|
11
|
+
type ToggleButtonSuffixIconProps as SuffixIconProps,
|
|
12
|
+
} from "./ToggleButton";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
2
|
+
import { Toggle as TogglePrimitive, useToggleContext } from "@seed-design/react-toggle";
|
|
3
|
+
import { toggleButton, type ToggleButtonVariantProps } from "@seed-design/recipe/toggleButton";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { createStyleContext } from "../../utils/createStyleContext";
|
|
7
|
+
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
8
|
+
import { Icon, type IconProps } from "../private/Icon";
|
|
9
|
+
import {
|
|
10
|
+
PendingButtonProvider,
|
|
11
|
+
usePendingButton,
|
|
12
|
+
usePendingButtonContext,
|
|
13
|
+
type UsePendingButtonProps,
|
|
14
|
+
} from "../private/usePendingButton";
|
|
15
|
+
|
|
16
|
+
const { ClassNamesProvider, withContext } = createStyleContext(toggleButton);
|
|
17
|
+
const withStateProps = createWithStateProps([usePendingButtonContext, useToggleContext]);
|
|
18
|
+
|
|
19
|
+
export interface ToggleButtonRootProps
|
|
20
|
+
extends ToggleButtonVariantProps,
|
|
21
|
+
UsePendingButtonProps,
|
|
22
|
+
TogglePrimitive.RootProps {}
|
|
23
|
+
|
|
24
|
+
export const ToggleButtonRoot = React.forwardRef<HTMLButtonElement, ToggleButtonRootProps>(
|
|
25
|
+
({ variant = "brandSolid", size = "small", loading = false, className, ...otherProps }, ref) => {
|
|
26
|
+
const classNames = toggleButton({ variant, size });
|
|
27
|
+
const api = usePendingButton({ loading, disabled: otherProps.disabled });
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<ClassNamesProvider value={classNames}>
|
|
31
|
+
<PendingButtonProvider value={api}>
|
|
32
|
+
<TogglePrimitive.Root
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={clsx(classNames.root, className)}
|
|
35
|
+
{...api.stateProps}
|
|
36
|
+
{...otherProps}
|
|
37
|
+
/>
|
|
38
|
+
</PendingButtonProvider>
|
|
39
|
+
</ClassNamesProvider>
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
ToggleButtonRoot.displayName = "ToggleButton";
|
|
44
|
+
|
|
45
|
+
export interface ToggleButtonLabelProps
|
|
46
|
+
extends PrimitiveProps,
|
|
47
|
+
React.HTMLAttributes<HTMLSpanElement> {}
|
|
48
|
+
|
|
49
|
+
export const ToggleButtonLabel = withContext<HTMLSpanElement, ToggleButtonLabelProps>(
|
|
50
|
+
withStateProps(Primitive.span),
|
|
51
|
+
"label",
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export interface ToggleButtonPrefixIconProps extends IconProps {}
|
|
55
|
+
|
|
56
|
+
export const ToggleButtonPrefixIcon = withContext<SVGSVGElement, ToggleButtonPrefixIconProps>(
|
|
57
|
+
withStateProps(Icon),
|
|
58
|
+
"prefixIcon",
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export interface ToggleButtonSuffixIconProps extends IconProps {}
|
|
62
|
+
|
|
63
|
+
export const ToggleButtonSuffixIcon = withContext<SVGSVGElement, ToggleButtonSuffixIconProps>(
|
|
64
|
+
withStateProps(Icon),
|
|
65
|
+
"suffixIcon",
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export interface ToggleButtonProgressIndicatorProps
|
|
69
|
+
extends PrimitiveProps,
|
|
70
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
71
|
+
|
|
72
|
+
export const ToggleButtonProgressIndicator = withContext<
|
|
73
|
+
HTMLDivElement,
|
|
74
|
+
ToggleButtonProgressIndicatorProps
|
|
75
|
+
>(withStateProps(Primitive.div), "progressIndicator");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ToggleButtonLabel,
|
|
3
|
+
ToggleButtonPrefixIcon,
|
|
4
|
+
ToggleButtonProgressIndicator,
|
|
5
|
+
ToggleButtonRoot,
|
|
6
|
+
ToggleButtonSuffixIcon,
|
|
7
|
+
type ToggleButtonLabelProps,
|
|
8
|
+
type ToggleButtonPrefixIconProps,
|
|
9
|
+
type ToggleButtonProgressIndicatorProps,
|
|
10
|
+
type ToggleButtonRootProps,
|
|
11
|
+
type ToggleButtonSuffixIconProps,
|
|
12
|
+
} from "./ToggleButton";
|
|
13
|
+
|
|
14
|
+
export * as ToggleButton from "./ToggleButton.namespace";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
2
|
+
import { visuallyHidden } from "@seed-design/recipe/visuallyHidden";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
import { createStyleContext } from "../../utils/createStyleContext";
|
|
5
|
+
|
|
6
|
+
const { withProvider } = createStyleContext(visuallyHidden);
|
|
7
|
+
|
|
8
|
+
export interface VisuallyHiddenProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {}
|
|
9
|
+
|
|
10
|
+
export const VisuallyHidden = withProvider<HTMLDivElement, VisuallyHiddenProps>(
|
|
11
|
+
Primitive.div,
|
|
12
|
+
"root",
|
|
13
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VisuallyHidden, type VisuallyHiddenProps } from "./VisuallyHidden";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export * from "./ActionButton";
|
|
2
|
+
export * from "./ActionChip";
|
|
3
|
+
export * from "./ActionSheet";
|
|
4
|
+
export * from "./Avatar";
|
|
5
|
+
export * from "./Badge";
|
|
6
|
+
export * from "./BottomSheet";
|
|
7
|
+
export * from "./Box";
|
|
8
|
+
export * from "./Callout";
|
|
9
|
+
export * from "./Celcius";
|
|
10
|
+
export * from "./Checkbox";
|
|
11
|
+
export * from "./ChipTabs";
|
|
12
|
+
export * from "./Columns";
|
|
13
|
+
export * from "./ControlChip";
|
|
14
|
+
export * from "./Dialog";
|
|
15
|
+
export * from "./ExtendedActionSheet";
|
|
16
|
+
export * from "./ExtendedFab";
|
|
17
|
+
export * from "./Fab";
|
|
18
|
+
export * from "./Flex";
|
|
19
|
+
export * from "./HelpBubble";
|
|
20
|
+
export * from "./Inline";
|
|
21
|
+
export * from "./InlineBanner";
|
|
22
|
+
export * from "./MannerTempBadge";
|
|
23
|
+
export * from "./ProgressCircle";
|
|
24
|
+
export * from "./PullToRefresh";
|
|
25
|
+
export * from "./ReactionButton";
|
|
26
|
+
export * from "./SegmentedControl";
|
|
27
|
+
export * from "./SelectBox";
|
|
28
|
+
export * from "./Skeleton";
|
|
29
|
+
export * from "./Snackbar";
|
|
30
|
+
export * from "./Stack";
|
|
31
|
+
export * from "./Switch";
|
|
32
|
+
export * from "./Tabs";
|
|
33
|
+
export * from "./Text";
|
|
34
|
+
export * from "./TextButton";
|
|
35
|
+
export * from "./TextField";
|
|
36
|
+
export * from "./ToggleButton";
|
|
37
|
+
export * from "./VisuallyHidden";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Primitive } from "@seed-design/react-primitive";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
|
|
4
|
+
export interface IconProps {
|
|
5
|
+
svg: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const Icon = forwardRef<SVGSVGElement, IconProps>(({ svg, ...otherProps }, ref) => {
|
|
9
|
+
return (
|
|
10
|
+
// biome-ignore lint/a11y/noSvgWithoutTitle: SVG is used as a child of a button element, so it is not required to have a title
|
|
11
|
+
<Primitive.svg ref={ref} aria-hidden asChild {...otherProps}>
|
|
12
|
+
{svg}
|
|
13
|
+
</Primitive.svg>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
2
|
+
import { buttonProps, elementProps, mergeProps } from "@seed-design/dom-utils";
|
|
3
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
export interface UseDismissibleProps {
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
onDismiss?: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type UseDismissibleReturn = ReturnType<typeof useDismissible>;
|
|
13
|
+
|
|
14
|
+
export function useDismissible(props: UseDismissibleProps) {
|
|
15
|
+
const [open = true, setOpen] = useControllableState({
|
|
16
|
+
prop: props.open,
|
|
17
|
+
defaultProp: props.defaultOpen,
|
|
18
|
+
onChange: (open) => {
|
|
19
|
+
if (!open) {
|
|
20
|
+
props.onDismiss?.();
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const dismiss = React.useCallback(() => setOpen(false), [setOpen]);
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
open,
|
|
29
|
+
dismiss,
|
|
30
|
+
|
|
31
|
+
rootProps: elementProps({}),
|
|
32
|
+
|
|
33
|
+
dismissButtonProps: buttonProps({
|
|
34
|
+
onClick: (e) => {
|
|
35
|
+
if (e.defaultPrevented) return;
|
|
36
|
+
|
|
37
|
+
dismiss();
|
|
38
|
+
},
|
|
39
|
+
}),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const DismissibleContext = React.createContext<ReturnType<typeof useDismissible> | null>(null);
|
|
44
|
+
|
|
45
|
+
export const DismissibleProvider = DismissibleContext.Provider;
|
|
46
|
+
|
|
47
|
+
export const useDismissibleContext = () => {
|
|
48
|
+
const context = React.useContext(DismissibleContext);
|
|
49
|
+
if (context === null) {
|
|
50
|
+
throw new Error("useDismissibleContext should be used within DismissibleProvider");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return context;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export interface DismissibleRootProps
|
|
57
|
+
extends PrimitiveProps,
|
|
58
|
+
UseDismissibleProps,
|
|
59
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
60
|
+
|
|
61
|
+
export const DismissibleRoot = React.forwardRef<HTMLDivElement, DismissibleRootProps>(
|
|
62
|
+
({ defaultOpen, open, onDismiss, ...otherProps }, ref) => {
|
|
63
|
+
const api = useDismissible({ defaultOpen, open, onDismiss });
|
|
64
|
+
|
|
65
|
+
if (!api.open) return null;
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<DismissibleProvider value={api}>
|
|
69
|
+
<Primitive.div ref={ref} {...otherProps} />
|
|
70
|
+
</DismissibleProvider>
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
export interface DismissibleDismissButtonProps
|
|
76
|
+
extends PrimitiveProps,
|
|
77
|
+
React.HTMLAttributes<HTMLButtonElement> {}
|
|
78
|
+
|
|
79
|
+
export const DismissibleDismissButton = React.forwardRef<
|
|
80
|
+
HTMLButtonElement,
|
|
81
|
+
DismissibleDismissButtonProps
|
|
82
|
+
>((props, ref) => {
|
|
83
|
+
const { dismissButtonProps } = useDismissibleContext();
|
|
84
|
+
|
|
85
|
+
return <Primitive.button ref={ref} {...mergeProps(dismissButtonProps, props)} />;
|
|
86
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { elementProps } from "@seed-design/dom-utils";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
export interface UsePendingButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* 버튼에 등록된 비동기 작업이 진행 중임을 사용자에게 알립니다.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 버튼의 비활성화 여부를 나타냅니다.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type UsePendingButtonReturn = ReturnType<typeof usePendingButton>;
|
|
19
|
+
|
|
20
|
+
export function usePendingButton(props: UsePendingButtonProps) {
|
|
21
|
+
const { loading, disabled } = props;
|
|
22
|
+
const stateProps = elementProps({
|
|
23
|
+
"data-loading": loading ? "" : undefined,
|
|
24
|
+
"data-disabled": disabled ? "" : undefined,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
loading,
|
|
29
|
+
disabled,
|
|
30
|
+
stateProps,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const PendingButtonContext = React.createContext<ReturnType<typeof usePendingButton> | null>(null);
|
|
35
|
+
|
|
36
|
+
export const PendingButtonProvider = PendingButtonContext.Provider;
|
|
37
|
+
|
|
38
|
+
export const usePendingButtonContext = () => {
|
|
39
|
+
const context = React.useContext(PendingButtonContext);
|
|
40
|
+
if (context === null) {
|
|
41
|
+
throw new Error("usePendingButtonContext should be used within UsePendingButtonProvider");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return context;
|
|
45
|
+
};
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components";
|
package/src/primitive.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "@seed-design/react-avatar";
|
|
2
|
+
export * from "@seed-design/react-checkbox";
|
|
3
|
+
export * from "@seed-design/react-dialog";
|
|
4
|
+
export * from "@seed-design/react-popover";
|
|
5
|
+
export * from "@seed-design/react-progress";
|
|
6
|
+
export * from "@seed-design/react-pull-to-refresh";
|
|
7
|
+
export * from "@seed-design/react-radio-group";
|
|
8
|
+
export * from "@seed-design/react-snackbar";
|
|
9
|
+
export * from "@seed-design/react-switch";
|
|
10
|
+
export * from "@seed-design/react-tabs";
|
|
11
|
+
export * from "@seed-design/react-toggle";
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import { createContext, forwardRef, useContext } from "react";
|
|
3
|
+
|
|
4
|
+
type Recipe<
|
|
5
|
+
Props extends Record<string, string | boolean | undefined>,
|
|
6
|
+
Classnames extends Record<string, string>,
|
|
7
|
+
> = ((props?: Props) => Classnames) & {
|
|
8
|
+
splitVariantProps: <T extends Props>(props: T) => [Props, Omit<T, keyof Props>];
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function createStyleContext<
|
|
12
|
+
Props extends Record<string, string | boolean | undefined>,
|
|
13
|
+
Classnames extends Record<string, string>,
|
|
14
|
+
>(recipe: Recipe<Props, Classnames>) {
|
|
15
|
+
const ClassNamesContext = createContext<Classnames | null>(null);
|
|
16
|
+
const PropsContext = createContext<Props | null>(null);
|
|
17
|
+
|
|
18
|
+
const ClassNamesProvider = ({
|
|
19
|
+
children,
|
|
20
|
+
value,
|
|
21
|
+
}: { children: React.ReactNode; value: Classnames }) => {
|
|
22
|
+
return <ClassNamesContext.Provider value={value}>{children}</ClassNamesContext.Provider>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const PropsProvider = ({ children, value }: { children: React.ReactNode; value: Props }) => {
|
|
26
|
+
return <PropsContext.Provider value={value}>{children}</PropsContext.Provider>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function useClassNames() {
|
|
30
|
+
const context = useContext(ClassNamesContext);
|
|
31
|
+
if (context === null) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
"useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?",
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return context;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function useProps() {
|
|
41
|
+
return useContext(PropsContext);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const withRootProvider = <P,>(
|
|
45
|
+
Component: React.ElementType<any>,
|
|
46
|
+
options?: {
|
|
47
|
+
defaultProps?: Partial<P>;
|
|
48
|
+
},
|
|
49
|
+
): React.ForwardRefExoticComponent<React.PropsWithoutRef<P>> => {
|
|
50
|
+
const { defaultProps } = options ?? {};
|
|
51
|
+
|
|
52
|
+
const StyledComponent = (innerProps: any) => {
|
|
53
|
+
const props = { ...(defaultProps ?? {}), ...useProps(), ...innerProps } as Props &
|
|
54
|
+
React.HTMLAttributes<HTMLElement>;
|
|
55
|
+
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
56
|
+
const classNames = recipe(variantProps); // TODO: should we memoize this?
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<ClassNamesProvider value={classNames}>
|
|
60
|
+
<Component {...otherProps} />
|
|
61
|
+
</ClassNamesProvider>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
67
|
+
|
|
68
|
+
return StyledComponent as any;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const withProvider = <T, P>(
|
|
72
|
+
Component: React.ElementType<any>,
|
|
73
|
+
slot: keyof Classnames,
|
|
74
|
+
options?: {
|
|
75
|
+
defaultProps?: Partial<P>;
|
|
76
|
+
},
|
|
77
|
+
): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>> => {
|
|
78
|
+
const { defaultProps } = options ?? {};
|
|
79
|
+
|
|
80
|
+
const StyledComponent = forwardRef<any, any>((innerProps, ref) => {
|
|
81
|
+
const props = { ...(defaultProps ?? {}), ...useProps(), ...innerProps } as Props &
|
|
82
|
+
React.HTMLAttributes<HTMLElement>;
|
|
83
|
+
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
84
|
+
const classNames = recipe(variantProps); // TODO: should we memoize this?
|
|
85
|
+
const className = classNames[slot as keyof typeof classNames];
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<ClassNamesProvider value={classNames}>
|
|
89
|
+
<Component ref={ref} {...otherProps} className={clsx(className, props.className)} />
|
|
90
|
+
</ClassNamesProvider>
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
96
|
+
|
|
97
|
+
return StyledComponent as any;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const withContext = <T, P>(
|
|
101
|
+
Component: React.ElementType<any>,
|
|
102
|
+
slot?: keyof Classnames,
|
|
103
|
+
): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>> => {
|
|
104
|
+
const StyledComponent = forwardRef<any, React.HTMLAttributes<HTMLElement>>((props, ref) => {
|
|
105
|
+
const classNames = useClassNames();
|
|
106
|
+
const className = classNames?.[slot as keyof typeof classNames];
|
|
107
|
+
|
|
108
|
+
return <Component ref={ref} {...props} className={clsx(className, props.className)} />;
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// @ts-ignore
|
|
112
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
113
|
+
return StyledComponent as any;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
ClassNamesProvider,
|
|
118
|
+
PropsProvider,
|
|
119
|
+
useClassNames,
|
|
120
|
+
useProps,
|
|
121
|
+
withRootProvider,
|
|
122
|
+
withProvider,
|
|
123
|
+
withContext,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
|
|
3
|
+
type AtLeastOne<T> = [T, ...T[]];
|
|
4
|
+
|
|
5
|
+
export function createWithStateProps(
|
|
6
|
+
useContexts: AtLeastOne<
|
|
7
|
+
(prop?: { strict?: boolean }) => { stateProps: React.HTMLAttributes<HTMLElement> } | null
|
|
8
|
+
>,
|
|
9
|
+
options?: { strict?: boolean },
|
|
10
|
+
) {
|
|
11
|
+
const strict = options?.strict ?? true;
|
|
12
|
+
|
|
13
|
+
return function withStateProps<P, R>(Component: React.ComponentType<P & React.RefAttributes<R>>) {
|
|
14
|
+
const Node = forwardRef<R, P>((props, ref) => {
|
|
15
|
+
const stateProps = {};
|
|
16
|
+
for (const useContext of useContexts) {
|
|
17
|
+
Object.assign(stateProps, useContext({ strict })?.stateProps);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
return <Component ref={ref} {...stateProps} {...props} />;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
Node.displayName = Component.displayName || Component.name;
|
|
25
|
+
|
|
26
|
+
return Node;
|
|
27
|
+
};
|
|
28
|
+
}
|
package/src/vars.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@seed-design/vars";
|