@pickle-ui/react 0.0.0-stage → 1.0.0-beta.4
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 +490 -2
- package/dist/components/Alert.d.ts +38 -0
- package/dist/components/Alert.d.ts.map +1 -0
- package/dist/components/Alert.js +54 -0
- package/dist/components/Alert.js.map +1 -0
- package/dist/components/AlertDialog.d.ts +41 -0
- package/dist/components/AlertDialog.d.ts.map +1 -0
- package/dist/components/AlertDialog.js +47 -0
- package/dist/components/AlertDialog.js.map +1 -0
- package/dist/components/Avatar.d.ts +18 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar.js +34 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Badge.d.ts +12 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/Badge.js +37 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Button.d.ts +19 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +66 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Card.d.ts +27 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +34 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/Dialog.d.ts +38 -0
- package/dist/components/Dialog.d.ts.map +1 -0
- package/dist/components/Dialog.js +41 -0
- package/dist/components/Dialog.js.map +1 -0
- package/dist/components/Flex.d.ts +22 -0
- package/dist/components/Flex.d.ts.map +1 -0
- package/dist/components/Flex.js +20 -0
- package/dist/components/Flex.js.map +1 -0
- package/dist/components/Grid.d.ts +66 -0
- package/dist/components/Grid.d.ts.map +1 -0
- package/dist/components/Grid.js +63 -0
- package/dist/components/Grid.js.map +1 -0
- package/dist/components/Group.d.ts +20 -0
- package/dist/components/Group.d.ts.map +1 -0
- package/dist/components/Group.js +43 -0
- package/dist/components/Group.js.map +1 -0
- package/dist/components/Menu.d.ts +53 -0
- package/dist/components/Menu.d.ts.map +1 -0
- package/dist/components/Menu.js +78 -0
- package/dist/components/Menu.js.map +1 -0
- package/dist/components/Popover.d.ts +27 -0
- package/dist/components/Popover.d.ts.map +1 -0
- package/dist/components/Popover.js +34 -0
- package/dist/components/Popover.js.map +1 -0
- package/dist/components/Progress.d.ts +23 -0
- package/dist/components/Progress.d.ts.map +1 -0
- package/dist/components/Progress.js +26 -0
- package/dist/components/Progress.js.map +1 -0
- package/dist/components/ScrollArea.d.ts +32 -0
- package/dist/components/ScrollArea.d.ts.map +1 -0
- package/dist/components/ScrollArea.js +36 -0
- package/dist/components/ScrollArea.js.map +1 -0
- package/dist/components/Separator.d.ts +7 -0
- package/dist/components/Separator.d.ts.map +1 -0
- package/dist/components/Separator.js +8 -0
- package/dist/components/Separator.js.map +1 -0
- package/dist/components/Sidebar.d.ts +35 -0
- package/dist/components/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar.js +45 -0
- package/dist/components/Sidebar.js.map +1 -0
- package/dist/components/Spinner.d.ts +11 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +13 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Table.d.ts +32 -0
- package/dist/components/Table.d.ts.map +1 -0
- package/dist/components/Table.js +37 -0
- package/dist/components/Table.js.map +1 -0
- package/dist/components/Text.d.ts +14 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/Text.js +50 -0
- package/dist/components/Text.js.map +1 -0
- package/dist/components/Toast.d.ts +39 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Toast.js +97 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/components/Tooltip.d.ts +18 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip.js +22 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/XStack.d.ts +6 -0
- package/dist/components/XStack.d.ts.map +1 -0
- package/dist/components/XStack.js +8 -0
- package/dist/components/XStack.js.map +1 -0
- package/dist/components/YStack.d.ts +6 -0
- package/dist/components/YStack.d.ts.map +1 -0
- package/dist/components/YStack.js +8 -0
- package/dist/components/YStack.js.map +1 -0
- package/dist/components/_internal/VisuallyHiddenInput.d.ts +11 -0
- package/dist/components/_internal/VisuallyHiddenInput.d.ts.map +1 -0
- package/dist/components/_internal/VisuallyHiddenInput.js +105 -0
- package/dist/components/_internal/VisuallyHiddenInput.js.map +1 -0
- package/dist/components/_internal/dialog-styles.d.ts +15 -0
- package/dist/components/_internal/dialog-styles.d.ts.map +1 -0
- package/dist/components/_internal/dialog-styles.js +27 -0
- package/dist/components/_internal/dialog-styles.js.map +1 -0
- package/dist/components/_internal/layout.d.ts +46 -0
- package/dist/components/_internal/layout.d.ts.map +1 -0
- package/dist/components/_internal/layout.js +72 -0
- package/dist/components/_internal/layout.js.map +1 -0
- package/dist/components/form/Checkbox.d.ts +19 -0
- package/dist/components/form/Checkbox.d.ts.map +1 -0
- package/dist/components/form/Checkbox.js +27 -0
- package/dist/components/form/Checkbox.js.map +1 -0
- package/dist/components/form/ColorPicker.d.ts +25 -0
- package/dist/components/form/ColorPicker.d.ts.map +1 -0
- package/dist/components/form/ColorPicker.js +14 -0
- package/dist/components/form/ColorPicker.js.map +1 -0
- package/dist/components/form/ColorPickerPrimitive.d.ts +65 -0
- package/dist/components/form/ColorPickerPrimitive.d.ts.map +1 -0
- package/dist/components/form/ColorPickerPrimitive.js +486 -0
- package/dist/components/form/ColorPickerPrimitive.js.map +1 -0
- package/dist/components/form/Combobox.d.ts +86 -0
- package/dist/components/form/Combobox.d.ts.map +1 -0
- package/dist/components/form/Combobox.js +198 -0
- package/dist/components/form/Combobox.js.map +1 -0
- package/dist/components/form/Form.context.d.ts +28 -0
- package/dist/components/form/Form.context.d.ts.map +1 -0
- package/dist/components/form/Form.context.js +56 -0
- package/dist/components/form/Form.context.js.map +1 -0
- package/dist/components/form/Form.d.ts +68 -0
- package/dist/components/form/Form.d.ts.map +1 -0
- package/dist/components/form/Form.js +32 -0
- package/dist/components/form/Form.js.map +1 -0
- package/dist/components/form/FormCheckbox.d.ts +10 -0
- package/dist/components/form/FormCheckbox.d.ts.map +1 -0
- package/dist/components/form/FormCheckbox.js +24 -0
- package/dist/components/form/FormCheckbox.js.map +1 -0
- package/dist/components/form/FormCombobox.d.ts +28 -0
- package/dist/components/form/FormCombobox.d.ts.map +1 -0
- package/dist/components/form/FormCombobox.js +50 -0
- package/dist/components/form/FormCombobox.js.map +1 -0
- package/dist/components/form/FormDescription.d.ts +7 -0
- package/dist/components/form/FormDescription.d.ts.map +1 -0
- package/dist/components/form/FormDescription.js +9 -0
- package/dist/components/form/FormDescription.js.map +1 -0
- package/dist/components/form/FormError.d.ts +7 -0
- package/dist/components/form/FormError.d.ts.map +1 -0
- package/dist/components/form/FormError.js +9 -0
- package/dist/components/form/FormError.js.map +1 -0
- package/dist/components/form/FormField.d.ts +13 -0
- package/dist/components/form/FormField.d.ts.map +1 -0
- package/dist/components/form/FormField.js +45 -0
- package/dist/components/form/FormField.js.map +1 -0
- package/dist/components/form/FormInput.d.ts +8 -0
- package/dist/components/form/FormInput.d.ts.map +1 -0
- package/dist/components/form/FormInput.js +17 -0
- package/dist/components/form/FormInput.js.map +1 -0
- package/dist/components/form/FormInputGroup.d.ts +7 -0
- package/dist/components/form/FormInputGroup.d.ts.map +1 -0
- package/dist/components/form/FormInputGroup.js +30 -0
- package/dist/components/form/FormInputGroup.js.map +1 -0
- package/dist/components/form/FormLabel.d.ts +7 -0
- package/dist/components/form/FormLabel.d.ts.map +1 -0
- package/dist/components/form/FormLabel.js +9 -0
- package/dist/components/form/FormLabel.js.map +1 -0
- package/dist/components/form/FormRadioGroup.d.ts +14 -0
- package/dist/components/form/FormRadioGroup.d.ts.map +1 -0
- package/dist/components/form/FormRadioGroup.js +25 -0
- package/dist/components/form/FormRadioGroup.js.map +1 -0
- package/dist/components/form/FormRoot.d.ts +10 -0
- package/dist/components/form/FormRoot.d.ts.map +1 -0
- package/dist/components/form/FormRoot.js +10 -0
- package/dist/components/form/FormRoot.js.map +1 -0
- package/dist/components/form/FormSelect.d.ts +19 -0
- package/dist/components/form/FormSelect.d.ts.map +1 -0
- package/dist/components/form/FormSelect.js +34 -0
- package/dist/components/form/FormSelect.js.map +1 -0
- package/dist/components/form/FormSwitch.d.ts +10 -0
- package/dist/components/form/FormSwitch.d.ts.map +1 -0
- package/dist/components/form/FormSwitch.js +24 -0
- package/dist/components/form/FormSwitch.js.map +1 -0
- package/dist/components/form/FormTextarea.d.ts +8 -0
- package/dist/components/form/FormTextarea.d.ts.map +1 -0
- package/dist/components/form/FormTextarea.js +13 -0
- package/dist/components/form/FormTextarea.js.map +1 -0
- package/dist/components/form/Input.d.ts +14 -0
- package/dist/components/form/Input.d.ts.map +1 -0
- package/dist/components/form/Input.js +22 -0
- package/dist/components/form/Input.js.map +1 -0
- package/dist/components/form/InputGroup.d.ts +26 -0
- package/dist/components/form/InputGroup.d.ts.map +1 -0
- package/dist/components/form/InputGroup.js +58 -0
- package/dist/components/form/InputGroup.js.map +1 -0
- package/dist/components/form/RadioGroup.d.ts +23 -0
- package/dist/components/form/RadioGroup.d.ts.map +1 -0
- package/dist/components/form/RadioGroup.js +30 -0
- package/dist/components/form/RadioGroup.js.map +1 -0
- package/dist/components/form/Select.d.ts +42 -0
- package/dist/components/form/Select.d.ts.map +1 -0
- package/dist/components/form/Select.js +68 -0
- package/dist/components/form/Select.js.map +1 -0
- package/dist/components/form/Slider.d.ts +37 -0
- package/dist/components/form/Slider.d.ts.map +1 -0
- package/dist/components/form/Slider.js +35 -0
- package/dist/components/form/Slider.js.map +1 -0
- package/dist/components/form/Switch.d.ts +23 -0
- package/dist/components/form/Switch.d.ts.map +1 -0
- package/dist/components/form/Switch.js +21 -0
- package/dist/components/form/Switch.js.map +1 -0
- package/dist/components/form/Textarea.d.ts +16 -0
- package/dist/components/form/Textarea.d.ts.map +1 -0
- package/dist/components/form/Textarea.js +12 -0
- package/dist/components/form/Textarea.js.map +1 -0
- package/dist/entries/alert-dialog.d.ts +3 -0
- package/dist/entries/alert-dialog.d.ts.map +1 -0
- package/dist/entries/alert-dialog.js +2 -0
- package/dist/entries/alert-dialog.js.map +1 -0
- package/dist/entries/alert.d.ts +3 -0
- package/dist/entries/alert.d.ts.map +1 -0
- package/dist/entries/alert.js +2 -0
- package/dist/entries/alert.js.map +1 -0
- package/dist/entries/avatar.d.ts +3 -0
- package/dist/entries/avatar.d.ts.map +1 -0
- package/dist/entries/avatar.js +2 -0
- package/dist/entries/avatar.js.map +1 -0
- package/dist/entries/badge.d.ts +3 -0
- package/dist/entries/badge.d.ts.map +1 -0
- package/dist/entries/badge.js +2 -0
- package/dist/entries/badge.js.map +1 -0
- package/dist/entries/button.d.ts +3 -0
- package/dist/entries/button.d.ts.map +1 -0
- package/dist/entries/button.js +2 -0
- package/dist/entries/button.js.map +1 -0
- package/dist/entries/card.d.ts +3 -0
- package/dist/entries/card.d.ts.map +1 -0
- package/dist/entries/card.js +2 -0
- package/dist/entries/card.js.map +1 -0
- package/dist/entries/checkbox.d.ts +3 -0
- package/dist/entries/checkbox.d.ts.map +1 -0
- package/dist/entries/checkbox.js +2 -0
- package/dist/entries/checkbox.js.map +1 -0
- package/dist/entries/cn.d.ts +3 -0
- package/dist/entries/cn.d.ts.map +1 -0
- package/dist/entries/cn.js +2 -0
- package/dist/entries/cn.js.map +1 -0
- package/dist/entries/color-picker.d.ts +3 -0
- package/dist/entries/color-picker.d.ts.map +1 -0
- package/dist/entries/color-picker.js +2 -0
- package/dist/entries/color-picker.js.map +1 -0
- package/dist/entries/combobox.d.ts +3 -0
- package/dist/entries/combobox.d.ts.map +1 -0
- package/dist/entries/combobox.js +2 -0
- package/dist/entries/combobox.js.map +1 -0
- package/dist/entries/dialog.d.ts +3 -0
- package/dist/entries/dialog.d.ts.map +1 -0
- package/dist/entries/dialog.js +2 -0
- package/dist/entries/dialog.js.map +1 -0
- package/dist/entries/flex.d.ts +3 -0
- package/dist/entries/flex.d.ts.map +1 -0
- package/dist/entries/flex.js +2 -0
- package/dist/entries/flex.js.map +1 -0
- package/dist/entries/form.d.ts +3 -0
- package/dist/entries/form.d.ts.map +1 -0
- package/dist/entries/form.js +2 -0
- package/dist/entries/form.js.map +1 -0
- package/dist/entries/grid.d.ts +3 -0
- package/dist/entries/grid.d.ts.map +1 -0
- package/dist/entries/grid.js +2 -0
- package/dist/entries/grid.js.map +1 -0
- package/dist/entries/group.d.ts +3 -0
- package/dist/entries/group.d.ts.map +1 -0
- package/dist/entries/group.js +2 -0
- package/dist/entries/group.js.map +1 -0
- package/dist/entries/input-group.d.ts +3 -0
- package/dist/entries/input-group.d.ts.map +1 -0
- package/dist/entries/input-group.js +2 -0
- package/dist/entries/input-group.js.map +1 -0
- package/dist/entries/input.d.ts +3 -0
- package/dist/entries/input.d.ts.map +1 -0
- package/dist/entries/input.js +2 -0
- package/dist/entries/input.js.map +1 -0
- package/dist/entries/menu.d.ts +3 -0
- package/dist/entries/menu.d.ts.map +1 -0
- package/dist/entries/menu.js +2 -0
- package/dist/entries/menu.js.map +1 -0
- package/dist/entries/popover.d.ts +3 -0
- package/dist/entries/popover.d.ts.map +1 -0
- package/dist/entries/popover.js +2 -0
- package/dist/entries/popover.js.map +1 -0
- package/dist/entries/progress.d.ts +3 -0
- package/dist/entries/progress.d.ts.map +1 -0
- package/dist/entries/progress.js +2 -0
- package/dist/entries/progress.js.map +1 -0
- package/dist/entries/radio-group.d.ts +3 -0
- package/dist/entries/radio-group.d.ts.map +1 -0
- package/dist/entries/radio-group.js +2 -0
- package/dist/entries/radio-group.js.map +1 -0
- package/dist/entries/scroll-area.d.ts +3 -0
- package/dist/entries/scroll-area.d.ts.map +1 -0
- package/dist/entries/scroll-area.js +2 -0
- package/dist/entries/scroll-area.js.map +1 -0
- package/dist/entries/select.d.ts +3 -0
- package/dist/entries/select.d.ts.map +1 -0
- package/dist/entries/select.js +2 -0
- package/dist/entries/select.js.map +1 -0
- package/dist/entries/separator.d.ts +3 -0
- package/dist/entries/separator.d.ts.map +1 -0
- package/dist/entries/separator.js +2 -0
- package/dist/entries/separator.js.map +1 -0
- package/dist/entries/sidebar.d.ts +3 -0
- package/dist/entries/sidebar.d.ts.map +1 -0
- package/dist/entries/sidebar.js +2 -0
- package/dist/entries/sidebar.js.map +1 -0
- package/dist/entries/slider.d.ts +3 -0
- package/dist/entries/slider.d.ts.map +1 -0
- package/dist/entries/slider.js +2 -0
- package/dist/entries/slider.js.map +1 -0
- package/dist/entries/spinner.d.ts +3 -0
- package/dist/entries/spinner.d.ts.map +1 -0
- package/dist/entries/spinner.js +2 -0
- package/dist/entries/spinner.js.map +1 -0
- package/dist/entries/switch.d.ts +3 -0
- package/dist/entries/switch.d.ts.map +1 -0
- package/dist/entries/switch.js +2 -0
- package/dist/entries/switch.js.map +1 -0
- package/dist/entries/table.d.ts +3 -0
- package/dist/entries/table.d.ts.map +1 -0
- package/dist/entries/table.js +2 -0
- package/dist/entries/table.js.map +1 -0
- package/dist/entries/text.d.ts +3 -0
- package/dist/entries/text.d.ts.map +1 -0
- package/dist/entries/text.js +2 -0
- package/dist/entries/text.js.map +1 -0
- package/dist/entries/textarea.d.ts +3 -0
- package/dist/entries/textarea.d.ts.map +1 -0
- package/dist/entries/textarea.js +2 -0
- package/dist/entries/textarea.js.map +1 -0
- package/dist/entries/theme.d.ts +3 -0
- package/dist/entries/theme.d.ts.map +1 -0
- package/dist/entries/theme.js +2 -0
- package/dist/entries/theme.js.map +1 -0
- package/dist/entries/toast.d.ts +3 -0
- package/dist/entries/toast.d.ts.map +1 -0
- package/dist/entries/toast.js +2 -0
- package/dist/entries/toast.js.map +1 -0
- package/dist/entries/tooltip.d.ts +3 -0
- package/dist/entries/tooltip.d.ts.map +1 -0
- package/dist/entries/tooltip.js +2 -0
- package/dist/entries/tooltip.js.map +1 -0
- package/dist/entries/x-stack.d.ts +3 -0
- package/dist/entries/x-stack.d.ts.map +1 -0
- package/dist/entries/x-stack.js +2 -0
- package/dist/entries/x-stack.js.map +1 -0
- package/dist/entries/y-stack.d.ts +3 -0
- package/dist/entries/y-stack.d.ts.map +1 -0
- package/dist/entries/y-stack.js +2 -0
- package/dist/entries/y-stack.js.map +1 -0
- package/dist/hooks/use-as-ref.d.ts +4 -0
- package/dist/hooks/use-as-ref.d.ts.map +1 -0
- package/dist/hooks/use-as-ref.js +11 -0
- package/dist/hooks/use-as-ref.js.map +1 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +4 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts.map +1 -0
- package/dist/hooks/use-isomorphic-layout-effect.js +4 -0
- package/dist/hooks/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/hooks/use-lazy-ref.d.ts +4 -0
- package/dist/hooks/use-lazy-ref.d.ts.map +1 -0
- package/dist/hooks/use-lazy-ref.js +10 -0
- package/dist/hooks/use-lazy-ref.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/color.d.ts +42 -0
- package/dist/lib/color.d.ts.map +1 -0
- package/dist/lib/color.js +140 -0
- package/dist/lib/color.js.map +1 -0
- package/dist/lib/compose-refs.d.ts +14 -0
- package/dist/lib/compose-refs.d.ts.map +1 -0
- package/dist/lib/compose-refs.js +57 -0
- package/dist/lib/compose-refs.js.map +1 -0
- package/dist/lib/theme.d.ts +40 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/theme.js +82 -0
- package/dist/lib/theme.js.map +1 -0
- package/dist/lib/utils.d.ts +8 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +18 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +2 -0
- package/dist/test-setup.js.map +1 -0
- package/package.json +107 -4
- package/src/base.css +99 -0
- package/src/components/Alert.stories.tsx +124 -0
- package/src/components/Alert.test.tsx +76 -0
- package/src/components/Alert.tsx +133 -0
- package/src/components/AlertDialog.stories.tsx +184 -0
- package/src/components/AlertDialog.test.tsx +142 -0
- package/src/components/AlertDialog.tsx +164 -0
- package/src/components/Avatar.stories.tsx +92 -0
- package/src/components/Avatar.test.tsx +26 -0
- package/src/components/Avatar.tsx +96 -0
- package/src/components/Badge.stories.tsx +52 -0
- package/src/components/Badge.test.tsx +35 -0
- package/src/components/Badge.tsx +65 -0
- package/src/components/Button.stories.tsx +171 -0
- package/src/components/Button.test.tsx +112 -0
- package/src/components/Button.tsx +114 -0
- package/src/components/Card.stories.tsx +62 -0
- package/src/components/Card.test.tsx +23 -0
- package/src/components/Card.tsx +129 -0
- package/src/components/Dialog.stories.tsx +133 -0
- package/src/components/Dialog.test.tsx +95 -0
- package/src/components/Dialog.tsx +147 -0
- package/src/components/Flex.stories.tsx +70 -0
- package/src/components/Flex.test.tsx +53 -0
- package/src/components/Flex.tsx +59 -0
- package/src/components/Grid.stories.tsx +70 -0
- package/src/components/Grid.test.tsx +46 -0
- package/src/components/Grid.tsx +114 -0
- package/src/components/Group.stories.tsx +130 -0
- package/src/components/Group.test.tsx +57 -0
- package/src/components/Group.tsx +92 -0
- package/src/components/Menu.stories.tsx +139 -0
- package/src/components/Menu.test.tsx +103 -0
- package/src/components/Menu.tsx +290 -0
- package/src/components/Popover.stories.tsx +72 -0
- package/src/components/Popover.tsx +117 -0
- package/src/components/Progress.stories.tsx +105 -0
- package/src/components/Progress.test.tsx +28 -0
- package/src/components/Progress.tsx +111 -0
- package/src/components/ScrollArea.stories.tsx +66 -0
- package/src/components/ScrollArea.test.tsx +32 -0
- package/src/components/ScrollArea.tsx +160 -0
- package/src/components/Separator.stories.tsx +39 -0
- package/src/components/Separator.test.tsx +24 -0
- package/src/components/Separator.tsx +27 -0
- package/src/components/Sidebar.stories.tsx +87 -0
- package/src/components/Sidebar.tsx +166 -0
- package/src/components/Spinner.stories.tsx +36 -0
- package/src/components/Spinner.test.tsx +25 -0
- package/src/components/Spinner.tsx +31 -0
- package/src/components/Table.stories.tsx +76 -0
- package/src/components/Table.tsx +151 -0
- package/src/components/Text.stories.tsx +148 -0
- package/src/components/Text.test.tsx +106 -0
- package/src/components/Text.tsx +85 -0
- package/src/components/Toast.stories.tsx +166 -0
- package/src/components/Toast.test.tsx +97 -0
- package/src/components/Toast.tsx +270 -0
- package/src/components/Tooltip.stories.tsx +116 -0
- package/src/components/Tooltip.test.tsx +51 -0
- package/src/components/Tooltip.tsx +80 -0
- package/src/components/XStack.stories.tsx +64 -0
- package/src/components/XStack.test.tsx +33 -0
- package/src/components/XStack.tsx +19 -0
- package/src/components/YStack.stories.tsx +65 -0
- package/src/components/YStack.test.tsx +31 -0
- package/src/components/YStack.tsx +19 -0
- package/src/components/_internal/Story.tsx +161 -0
- package/src/components/_internal/VisuallyHiddenInput.tsx +164 -0
- package/src/components/_internal/dialog-styles.ts +57 -0
- package/src/components/_internal/layout.ts +103 -0
- package/src/components/form/Checkbox.stories.tsx +78 -0
- package/src/components/form/Checkbox.test.tsx +107 -0
- package/src/components/form/Checkbox.tsx +95 -0
- package/src/components/form/ColorPicker.stories.tsx +160 -0
- package/src/components/form/ColorPicker.test.tsx +45 -0
- package/src/components/form/ColorPicker.tsx +55 -0
- package/src/components/form/ColorPickerPrimitive.test.tsx +14 -0
- package/src/components/form/ColorPickerPrimitive.tsx +1283 -0
- package/src/components/form/Combobox.stories.tsx +378 -0
- package/src/components/form/Combobox.test.tsx +334 -0
- package/src/components/form/Combobox.tsx +667 -0
- package/src/components/form/Form.context.ts +114 -0
- package/src/components/form/Form.stories.tsx +226 -0
- package/src/components/form/Form.test.tsx +293 -0
- package/src/components/form/Form.tsx +50 -0
- package/src/components/form/FormCheckbox.tsx +50 -0
- package/src/components/form/FormCombobox.tsx +92 -0
- package/src/components/form/FormDescription.tsx +21 -0
- package/src/components/form/FormError.tsx +21 -0
- package/src/components/form/FormField.tsx +109 -0
- package/src/components/form/FormInput.tsx +41 -0
- package/src/components/form/FormInputGroup.tsx +47 -0
- package/src/components/form/FormLabel.tsx +24 -0
- package/src/components/form/FormRadioGroup.tsx +46 -0
- package/src/components/form/FormRoot.tsx +41 -0
- package/src/components/form/FormSelect.tsx +60 -0
- package/src/components/form/FormSwitch.tsx +50 -0
- package/src/components/form/FormTextarea.tsx +34 -0
- package/src/components/form/Input.stories.tsx +114 -0
- package/src/components/form/Input.test.tsx +62 -0
- package/src/components/form/Input.tsx +93 -0
- package/src/components/form/InputGroup.stories.tsx +162 -0
- package/src/components/form/InputGroup.tsx +149 -0
- package/src/components/form/RadioGroup.stories.tsx +68 -0
- package/src/components/form/RadioGroup.test.tsx +171 -0
- package/src/components/form/RadioGroup.tsx +127 -0
- package/src/components/form/Select.stories.tsx +115 -0
- package/src/components/form/Select.test.tsx +115 -0
- package/src/components/form/Select.tsx +293 -0
- package/src/components/form/Slider.stories.tsx +121 -0
- package/src/components/form/Slider.test.tsx +33 -0
- package/src/components/form/Slider.tsx +200 -0
- package/src/components/form/Switch.stories.tsx +62 -0
- package/src/components/form/Switch.test.tsx +29 -0
- package/src/components/form/Switch.tsx +81 -0
- package/src/components/form/Textarea.stories.tsx +71 -0
- package/src/components/form/Textarea.test.tsx +31 -0
- package/src/components/form/Textarea.tsx +46 -0
- package/src/entries/alert-dialog.ts +11 -0
- package/src/entries/alert.ts +8 -0
- package/src/entries/avatar.ts +7 -0
- package/src/entries/badge.ts +2 -0
- package/src/entries/button.ts +2 -0
- package/src/entries/card.ts +10 -0
- package/src/entries/checkbox.ts +5 -0
- package/src/entries/cn.ts +2 -0
- package/src/entries/color-picker.ts +13 -0
- package/src/entries/combobox.ts +20 -0
- package/src/entries/dialog.ts +11 -0
- package/src/entries/entries.test.ts +65 -0
- package/src/entries/flex.ts +2 -0
- package/src/entries/form.ts +16 -0
- package/src/entries/grid.ts +2 -0
- package/src/entries/group.ts +6 -0
- package/src/entries/input-group.ts +8 -0
- package/src/entries/input.ts +2 -0
- package/src/entries/menu.ts +17 -0
- package/src/entries/popover.ts +10 -0
- package/src/entries/progress.ts +8 -0
- package/src/entries/radio-group.ts +5 -0
- package/src/entries/scroll-area.ts +10 -0
- package/src/entries/select.ts +12 -0
- package/src/entries/separator.ts +2 -0
- package/src/entries/sidebar.ts +13 -0
- package/src/entries/slider.ts +7 -0
- package/src/entries/spinner.ts +2 -0
- package/src/entries/switch.ts +2 -0
- package/src/entries/table.ts +11 -0
- package/src/entries/text.ts +2 -0
- package/src/entries/textarea.ts +2 -0
- package/src/entries/theme.ts +8 -0
- package/src/entries/toast.ts +2 -0
- package/src/entries/tooltip.ts +7 -0
- package/src/entries/x-stack.ts +2 -0
- package/src/entries/y-stack.ts +2 -0
- package/src/hooks/use-as-ref.ts +15 -0
- package/src/hooks/use-isomorphic-layout-effect.ts +6 -0
- package/src/hooks/use-lazy-ref.ts +13 -0
- package/src/index.ts +38 -0
- package/src/lib/color.test.ts +148 -0
- package/src/lib/color.ts +193 -0
- package/src/lib/compose-refs.ts +63 -0
- package/src/lib/theme.test.ts +64 -0
- package/src/lib/theme.ts +143 -0
- package/src/lib/utils.ts +25 -0
- package/src/public-api.test.ts +74 -0
- package/src/styles.css +2 -0
- package/src/test-setup.ts +1 -0
- package/src/theme.css +195 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@/lib/utils';
|
|
4
|
+
|
|
5
|
+
type SidebarContentProps = React.ComponentProps<'div'>;
|
|
6
|
+
type SidebarFooterProps = React.ComponentProps<'div'>;
|
|
7
|
+
type SidebarGroupLabelProps = React.ComponentProps<'div'>;
|
|
8
|
+
type SidebarGroupProps = React.ComponentProps<'div'>;
|
|
9
|
+
type SidebarHeaderProps = React.ComponentProps<'div'>;
|
|
10
|
+
type SidebarMenuItemProps = React.ComponentProps<'li'>;
|
|
11
|
+
type SidebarMenuLinkProps = React.ComponentProps<'a'>;
|
|
12
|
+
type SidebarMenuListProps = React.ComponentProps<'ul'>;
|
|
13
|
+
type SidebarMenuProps = React.ComponentProps<'nav'>;
|
|
14
|
+
type SidebarProps = React.ComponentProps<'aside'>;
|
|
15
|
+
|
|
16
|
+
function SidebarContent({ className, ...props }: SidebarContentProps) {
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
className={cn('min-h-0 flex-1 overflow-auto px-3 py-4', className)}
|
|
20
|
+
data-slot="sidebar-content"
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function SidebarFooter({ className, ...props }: SidebarFooterProps) {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className={cn('border-sidebar-border border-t p-4', className)}
|
|
30
|
+
data-slot="sidebar-footer"
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function SidebarGroup({ className, ...props }: SidebarGroupProps) {
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
className={cn('flex flex-col gap-1', className)}
|
|
40
|
+
data-slot="sidebar-group"
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function SidebarGroupLabel({ className, ...props }: SidebarGroupLabelProps) {
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
className={cn(
|
|
50
|
+
'text-sidebar-foreground/70 px-2 py-1 text-xs font-medium tracking-wide uppercase',
|
|
51
|
+
className,
|
|
52
|
+
)}
|
|
53
|
+
data-slot="sidebar-group-label"
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function SidebarHeader({ className, ...props }: SidebarHeaderProps) {
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
className={cn('border-sidebar-border border-b px-5 py-4', className)}
|
|
63
|
+
data-slot="sidebar-header"
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function SidebarMenu({ className, ...props }: SidebarMenuProps) {
|
|
70
|
+
return (
|
|
71
|
+
<nav
|
|
72
|
+
className={cn('flex flex-col gap-1', className)}
|
|
73
|
+
data-slot="sidebar-menu"
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function SidebarMenuItem({ className, ...props }: SidebarMenuItemProps) {
|
|
80
|
+
return (
|
|
81
|
+
<li
|
|
82
|
+
className={cn('w-full', className)}
|
|
83
|
+
data-slot="sidebar-menu-item"
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function SidebarMenuLink({
|
|
90
|
+
children,
|
|
91
|
+
className,
|
|
92
|
+
...props
|
|
93
|
+
}: SidebarMenuLinkProps) {
|
|
94
|
+
return (
|
|
95
|
+
<a
|
|
96
|
+
className={cn(
|
|
97
|
+
'focus-ring text-sidebar-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:bg-sidebar-primary aria-[current=page]:text-sidebar-primary-foreground flex h-9 w-full items-center gap-2 rounded-md px-2.5 text-sm font-medium transition-colors [&_svg]:size-4 [&_svg]:shrink-0',
|
|
98
|
+
className,
|
|
99
|
+
)}
|
|
100
|
+
data-slot="sidebar-menu-link"
|
|
101
|
+
{...props}
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</a>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function SidebarMenuList({ className, ...props }: SidebarMenuListProps) {
|
|
109
|
+
return (
|
|
110
|
+
<ul
|
|
111
|
+
className={cn('flex list-none flex-col gap-1 p-0', className)}
|
|
112
|
+
data-slot="sidebar-menu-list"
|
|
113
|
+
{...props}
|
|
114
|
+
/>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function SidebarRoot({ className, ...props }: SidebarProps) {
|
|
119
|
+
return (
|
|
120
|
+
<aside
|
|
121
|
+
className={cn(
|
|
122
|
+
'border-sidebar-border bg-sidebar text-sidebar-foreground flex w-64 shrink-0 flex-col border-r',
|
|
123
|
+
className,
|
|
124
|
+
)}
|
|
125
|
+
data-slot="sidebar"
|
|
126
|
+
{...props}
|
|
127
|
+
/>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const Sidebar = Object.assign(SidebarRoot, {
|
|
132
|
+
Content: SidebarContent,
|
|
133
|
+
Footer: SidebarFooter,
|
|
134
|
+
Group: SidebarGroup,
|
|
135
|
+
GroupLabel: SidebarGroupLabel,
|
|
136
|
+
Header: SidebarHeader,
|
|
137
|
+
Menu: SidebarMenu,
|
|
138
|
+
MenuItem: SidebarMenuItem,
|
|
139
|
+
MenuLink: SidebarMenuLink,
|
|
140
|
+
MenuList: SidebarMenuList,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
export {
|
|
144
|
+
Sidebar,
|
|
145
|
+
SidebarContent,
|
|
146
|
+
SidebarFooter,
|
|
147
|
+
SidebarGroup,
|
|
148
|
+
SidebarGroupLabel,
|
|
149
|
+
SidebarHeader,
|
|
150
|
+
SidebarMenu,
|
|
151
|
+
SidebarMenuItem,
|
|
152
|
+
SidebarMenuLink,
|
|
153
|
+
SidebarMenuList,
|
|
154
|
+
};
|
|
155
|
+
export type {
|
|
156
|
+
SidebarContentProps,
|
|
157
|
+
SidebarFooterProps,
|
|
158
|
+
SidebarGroupLabelProps,
|
|
159
|
+
SidebarGroupProps,
|
|
160
|
+
SidebarHeaderProps,
|
|
161
|
+
SidebarMenuItemProps,
|
|
162
|
+
SidebarMenuLinkProps,
|
|
163
|
+
SidebarMenuListProps,
|
|
164
|
+
SidebarMenuProps,
|
|
165
|
+
SidebarProps,
|
|
166
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { Story } from './_internal/Story';
|
|
4
|
+
import { Spinner } from './Spinner';
|
|
5
|
+
import { Text } from './Text';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
component: Spinner,
|
|
9
|
+
parameters: { layout: 'fullscreen' },
|
|
10
|
+
title: 'components/Spinner',
|
|
11
|
+
} satisfies Meta<typeof Spinner>;
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type StoryDefinition = StoryObj<typeof meta>;
|
|
15
|
+
|
|
16
|
+
export const All: StoryDefinition = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<Story.Layout className="max-w-3xl" title="Spinner">
|
|
19
|
+
<Story.Section title="Sizes">
|
|
20
|
+
<div className="flex items-center gap-6">
|
|
21
|
+
<Spinner className="size-4" />
|
|
22
|
+
<Spinner className="size-6" />
|
|
23
|
+
<Spinner className="size-8" />
|
|
24
|
+
</div>
|
|
25
|
+
</Story.Section>
|
|
26
|
+
<Story.Section title="With a label">
|
|
27
|
+
<div className="text-muted-foreground flex items-center gap-2">
|
|
28
|
+
<Spinner aria-hidden className="size-4" />
|
|
29
|
+
<Text tone="muted" variant="body">
|
|
30
|
+
Loading your workspace…
|
|
31
|
+
</Text>
|
|
32
|
+
</div>
|
|
33
|
+
</Story.Section>
|
|
34
|
+
</Story.Layout>
|
|
35
|
+
),
|
|
36
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { Spinner } from './Spinner';
|
|
5
|
+
|
|
6
|
+
describe('Spinner', () => {
|
|
7
|
+
it('announces a loading status', () => {
|
|
8
|
+
render(<Spinner />);
|
|
9
|
+
|
|
10
|
+
expect(screen.getByRole('status', { name: 'Loading' })).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('accepts a custom accessible name', () => {
|
|
14
|
+
render(<Spinner aria-label="Saving" />);
|
|
15
|
+
|
|
16
|
+
expect(screen.getByRole('status', { name: 'Saving' })).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('is decorative when aria-hidden', () => {
|
|
20
|
+
const { container } = render(<Spinner aria-hidden />);
|
|
21
|
+
|
|
22
|
+
expect(screen.queryByRole('status')).not.toBeInTheDocument();
|
|
23
|
+
expect(container.querySelector('svg')).not.toHaveAttribute('aria-label');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IconLoader2 } from '@tabler/icons-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
5
|
+
|
|
6
|
+
type SpinnerProps = React.ComponentProps<typeof IconLoader2>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Announced as a loading status by default. Pass `aria-hidden` when visible
|
|
10
|
+
* text already says what is loading, and it becomes purely decorative.
|
|
11
|
+
*/
|
|
12
|
+
function Spinner({
|
|
13
|
+
'aria-hidden': ariaHidden,
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: SpinnerProps) {
|
|
17
|
+
const decorative = ariaHidden === true || ariaHidden === 'true';
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<IconLoader2
|
|
21
|
+
aria-hidden={ariaHidden}
|
|
22
|
+
aria-label={decorative ? undefined : 'Loading'}
|
|
23
|
+
className={cn('animate-spin', className)}
|
|
24
|
+
role={decorative ? undefined : 'status'}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Spinner };
|
|
31
|
+
export type { SpinnerProps };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { Story } from './_internal/Story';
|
|
4
|
+
import { Badge } from './Badge';
|
|
5
|
+
import { Table } from './Table';
|
|
6
|
+
import { Text } from './Text';
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
component: Table,
|
|
10
|
+
parameters: { layout: 'fullscreen' },
|
|
11
|
+
title: 'components/Table',
|
|
12
|
+
} satisfies Meta<typeof Table>;
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type StoryDefinition = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
const deployments = [
|
|
18
|
+
{
|
|
19
|
+
branch: 'main',
|
|
20
|
+
environment: 'Production',
|
|
21
|
+
id: 'dep-1042',
|
|
22
|
+
status: 'Success',
|
|
23
|
+
statusVariant: 'success' as const,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
branch: 'release/2.4',
|
|
27
|
+
environment: 'Staging',
|
|
28
|
+
id: 'dep-1041',
|
|
29
|
+
status: 'Running',
|
|
30
|
+
statusVariant: 'inProgress' as const,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
branch: 'feat/billing',
|
|
34
|
+
environment: 'Preview',
|
|
35
|
+
id: 'dep-1040',
|
|
36
|
+
status: 'Failed',
|
|
37
|
+
statusVariant: 'failed' as const,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
export const All: StoryDefinition = {
|
|
42
|
+
render: () => (
|
|
43
|
+
<Story.Layout className="max-w-4xl" title="Table">
|
|
44
|
+
<Story.Section title="Deployments">
|
|
45
|
+
<Table aria-label="Deployments">
|
|
46
|
+
<Table.Header>
|
|
47
|
+
<Table.Row>
|
|
48
|
+
<Table.Head>Deployment</Table.Head>
|
|
49
|
+
<Table.Head>Environment</Table.Head>
|
|
50
|
+
<Table.Head>Branch</Table.Head>
|
|
51
|
+
<Table.Head>Status</Table.Head>
|
|
52
|
+
</Table.Row>
|
|
53
|
+
</Table.Header>
|
|
54
|
+
<Table.Body>
|
|
55
|
+
{deployments.map((deployment) => (
|
|
56
|
+
<Table.Row key={deployment.id}>
|
|
57
|
+
<Table.Cell>
|
|
58
|
+
<Text variant="code">{deployment.id}</Text>
|
|
59
|
+
</Table.Cell>
|
|
60
|
+
<Table.Cell>{deployment.environment}</Table.Cell>
|
|
61
|
+
<Table.Cell>
|
|
62
|
+
<Text variant="code">{deployment.branch}</Text>
|
|
63
|
+
</Table.Cell>
|
|
64
|
+
<Table.Cell>
|
|
65
|
+
<Badge variant={deployment.statusVariant}>
|
|
66
|
+
{deployment.status}
|
|
67
|
+
</Badge>
|
|
68
|
+
</Table.Cell>
|
|
69
|
+
</Table.Row>
|
|
70
|
+
))}
|
|
71
|
+
</Table.Body>
|
|
72
|
+
</Table>
|
|
73
|
+
</Story.Section>
|
|
74
|
+
</Story.Layout>
|
|
75
|
+
),
|
|
76
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@/lib/utils';
|
|
4
|
+
|
|
5
|
+
type TableBodyProps = React.ComponentProps<'tbody'>;
|
|
6
|
+
type TableCaptionProps = React.ComponentProps<'caption'>;
|
|
7
|
+
type TableCellProps = React.ComponentProps<'td'>;
|
|
8
|
+
type TableFooterProps = React.ComponentProps<'tfoot'>;
|
|
9
|
+
type TableHeaderProps = React.ComponentProps<'thead'>;
|
|
10
|
+
type TableHeadProps = React.ComponentProps<'th'>;
|
|
11
|
+
type TableProps = React.ComponentProps<'table'> & {
|
|
12
|
+
containerClassName?: string;
|
|
13
|
+
containerProps?: Omit<React.ComponentProps<'div'>, 'children' | 'className'>;
|
|
14
|
+
};
|
|
15
|
+
type TableRowProps = React.ComponentProps<'tr'>;
|
|
16
|
+
|
|
17
|
+
function TableBody({ className, ...props }: TableBodyProps) {
|
|
18
|
+
return (
|
|
19
|
+
<tbody
|
|
20
|
+
className={cn('[&_tr:last-child]:border-0', className)}
|
|
21
|
+
data-slot="table-body"
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function TableCaption({ className, ...props }: TableCaptionProps) {
|
|
28
|
+
return (
|
|
29
|
+
<caption
|
|
30
|
+
className={cn('text-muted-foreground mt-4 text-sm', className)}
|
|
31
|
+
data-slot="table-caption"
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function TableCell({ className, ...props }: TableCellProps) {
|
|
38
|
+
return (
|
|
39
|
+
<td
|
|
40
|
+
className={cn('p-4 align-middle text-sm', className)}
|
|
41
|
+
data-slot="table-cell"
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function TableFooter({ className, ...props }: TableFooterProps) {
|
|
48
|
+
return (
|
|
49
|
+
<tfoot
|
|
50
|
+
className={cn(
|
|
51
|
+
'bg-muted/50 border-t font-medium [&>tr]:last:border-b-0',
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
data-slot="table-footer"
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function TableHead({ className, ...props }: TableHeadProps) {
|
|
61
|
+
return (
|
|
62
|
+
<th
|
|
63
|
+
className={cn(
|
|
64
|
+
'text-muted-foreground h-10 px-4 text-left align-middle text-xs font-medium tracking-wide uppercase',
|
|
65
|
+
className,
|
|
66
|
+
)}
|
|
67
|
+
data-slot="table-head"
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function TableHeader({ className, ...props }: TableHeaderProps) {
|
|
74
|
+
return (
|
|
75
|
+
<thead
|
|
76
|
+
className={cn('[&_tr]:border-b', className)}
|
|
77
|
+
data-slot="table-header"
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function TableRoot({
|
|
84
|
+
children,
|
|
85
|
+
className,
|
|
86
|
+
containerClassName,
|
|
87
|
+
containerProps,
|
|
88
|
+
ref,
|
|
89
|
+
...props
|
|
90
|
+
}: TableProps) {
|
|
91
|
+
return (
|
|
92
|
+
<div
|
|
93
|
+
className={cn('relative w-full overflow-auto', containerClassName)}
|
|
94
|
+
data-slot="table-container"
|
|
95
|
+
{...containerProps}
|
|
96
|
+
>
|
|
97
|
+
<table
|
|
98
|
+
className={cn('w-full caption-bottom text-sm', className)}
|
|
99
|
+
data-slot="table"
|
|
100
|
+
ref={ref}
|
|
101
|
+
{...props}
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</table>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function TableRow({ className, ...props }: TableRowProps) {
|
|
110
|
+
return (
|
|
111
|
+
<tr
|
|
112
|
+
className={cn(
|
|
113
|
+
'border-border hover:bg-muted/30 border-b transition-none',
|
|
114
|
+
className,
|
|
115
|
+
)}
|
|
116
|
+
data-slot="table-row"
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const Table = Object.assign(TableRoot, {
|
|
123
|
+
Body: TableBody,
|
|
124
|
+
Caption: TableCaption,
|
|
125
|
+
Cell: TableCell,
|
|
126
|
+
Footer: TableFooter,
|
|
127
|
+
Head: TableHead,
|
|
128
|
+
Header: TableHeader,
|
|
129
|
+
Row: TableRow,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
Table,
|
|
134
|
+
TableBody,
|
|
135
|
+
TableCaption,
|
|
136
|
+
TableCell,
|
|
137
|
+
TableFooter,
|
|
138
|
+
TableHead,
|
|
139
|
+
TableHeader,
|
|
140
|
+
TableRow,
|
|
141
|
+
};
|
|
142
|
+
export type {
|
|
143
|
+
TableBodyProps,
|
|
144
|
+
TableCaptionProps,
|
|
145
|
+
TableCellProps,
|
|
146
|
+
TableFooterProps,
|
|
147
|
+
TableHeaderProps,
|
|
148
|
+
TableHeadProps,
|
|
149
|
+
TableProps,
|
|
150
|
+
TableRowProps,
|
|
151
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { type ComponentMatrixCellProps, Story } from './_internal/Story';
|
|
5
|
+
import { Text, type TextProps } from './Text';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
component: Text,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'fullscreen',
|
|
11
|
+
},
|
|
12
|
+
title: 'components/Text',
|
|
13
|
+
} satisfies Meta<typeof Text>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type StoryDefinition = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
type TextTone = NonNullable<TextProps['tone']>;
|
|
19
|
+
type TextVariant = NonNullable<TextProps['variant']>;
|
|
20
|
+
|
|
21
|
+
const VARIANT_ROWS: { key: TextVariant; label: string }[] = [
|
|
22
|
+
{ key: 'h1', label: 'H1' },
|
|
23
|
+
{ key: 'h2', label: 'H2' },
|
|
24
|
+
{ key: 'h3', label: 'H3' },
|
|
25
|
+
{ key: 'h4', label: 'H4' },
|
|
26
|
+
{ key: 'lead', label: 'Lead' },
|
|
27
|
+
{ key: 'body', label: 'Body' },
|
|
28
|
+
{ key: 'small', label: 'Small' },
|
|
29
|
+
{ key: 'code', label: 'Code' },
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const TONE_COLUMNS: { key: TextTone; label: string }[] = [
|
|
33
|
+
{ key: 'primary', label: 'Primary' },
|
|
34
|
+
{ key: 'muted', label: 'Muted' },
|
|
35
|
+
{ key: 'destructive', label: 'Destructive' },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const WEIGHT_ROWS: { key: NonNullable<TextProps['weight']>; label: string }[] =
|
|
39
|
+
[
|
|
40
|
+
{ key: 'normal', label: 'Normal' },
|
|
41
|
+
{ key: 'bold', label: 'Bold' },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
function ToneCell({ column, row }: ComponentMatrixCellProps) {
|
|
45
|
+
return (
|
|
46
|
+
<Text tone={column.key as TextTone} variant={row.key as TextVariant}>
|
|
47
|
+
Sample text
|
|
48
|
+
</Text>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function WeightCell({ column, row }: ComponentMatrixCellProps) {
|
|
53
|
+
return (
|
|
54
|
+
<Text variant="body" weight={row.key as NonNullable<TextProps['weight']>}>
|
|
55
|
+
{column.label} weight
|
|
56
|
+
</Text>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const All: StoryDefinition = {
|
|
61
|
+
render: () => (
|
|
62
|
+
<Story.Layout className="max-w-5xl" title="Text">
|
|
63
|
+
<Story.Section title="Variant scale">
|
|
64
|
+
<div className="flex flex-col gap-4">
|
|
65
|
+
{VARIANT_ROWS.map(({ key, label }) => (
|
|
66
|
+
<div className="flex items-baseline gap-4" key={key}>
|
|
67
|
+
<span className="text-muted-foreground w-12 shrink-0 text-xs">
|
|
68
|
+
{label}
|
|
69
|
+
</span>
|
|
70
|
+
<Text variant={key}>
|
|
71
|
+
{key === 'code'
|
|
72
|
+
? 'npm install pickle-ui'
|
|
73
|
+
: 'The quick brown fox jumps over the lazy dog.'}
|
|
74
|
+
</Text>
|
|
75
|
+
</div>
|
|
76
|
+
))}
|
|
77
|
+
</div>
|
|
78
|
+
</Story.Section>
|
|
79
|
+
|
|
80
|
+
<Story.Section title="Tone (color axis)">
|
|
81
|
+
<Story.Matrix
|
|
82
|
+
Cell={ToneCell}
|
|
83
|
+
cellWidth="14rem"
|
|
84
|
+
columns={TONE_COLUMNS}
|
|
85
|
+
rows={VARIANT_ROWS.slice(0, 4)}
|
|
86
|
+
/>
|
|
87
|
+
</Story.Section>
|
|
88
|
+
|
|
89
|
+
<Story.Section title="Weight">
|
|
90
|
+
<Story.Matrix
|
|
91
|
+
Cell={WeightCell}
|
|
92
|
+
cellWidth="14rem"
|
|
93
|
+
columns={[{ key: 'body', label: 'Body' }]}
|
|
94
|
+
rows={WEIGHT_ROWS}
|
|
95
|
+
/>
|
|
96
|
+
</Story.Section>
|
|
97
|
+
|
|
98
|
+
<Story.Section title="Size tokens">
|
|
99
|
+
<div
|
|
100
|
+
className="flex flex-col gap-4"
|
|
101
|
+
style={
|
|
102
|
+
{
|
|
103
|
+
'--text-body': '1rem',
|
|
104
|
+
'--text-h1': '2.25rem',
|
|
105
|
+
'--text-small': '0.875rem',
|
|
106
|
+
} as React.CSSProperties
|
|
107
|
+
}
|
|
108
|
+
>
|
|
109
|
+
{VARIANT_ROWS.map(({ key, label }) => (
|
|
110
|
+
<div className="flex items-baseline gap-4" key={key}>
|
|
111
|
+
<span className="text-muted-foreground w-12 shrink-0 text-xs">
|
|
112
|
+
{label}
|
|
113
|
+
</span>
|
|
114
|
+
<Text variant={key}>
|
|
115
|
+
{key === 'code'
|
|
116
|
+
? 'npm install pickle-ui'
|
|
117
|
+
: 'The quick brown fox jumps over the lazy dog.'}
|
|
118
|
+
</Text>
|
|
119
|
+
</div>
|
|
120
|
+
))}
|
|
121
|
+
</div>
|
|
122
|
+
</Story.Section>
|
|
123
|
+
|
|
124
|
+
<Story.Section title="Truncation">
|
|
125
|
+
<div className="max-w-xs">
|
|
126
|
+
<Text className="border border-dashed" truncate variant="body">
|
|
127
|
+
This is a very long line of text that will be truncated because
|
|
128
|
+
there is not enough horizontal space to display it all.
|
|
129
|
+
</Text>
|
|
130
|
+
</div>
|
|
131
|
+
</Story.Section>
|
|
132
|
+
|
|
133
|
+
<Story.Section title="Polymorphism (as prop)">
|
|
134
|
+
<div className="flex flex-col gap-3">
|
|
135
|
+
<Text as="h1" variant="h2">
|
|
136
|
+
h2 styles on an <h1> element
|
|
137
|
+
</Text>
|
|
138
|
+
<Text as="div" variant="body">
|
|
139
|
+
Body copy rendered as a <div>
|
|
140
|
+
</Text>
|
|
141
|
+
<Text as="label" tone="muted" variant="small">
|
|
142
|
+
Small muted text rendered as a <label>
|
|
143
|
+
</Text>
|
|
144
|
+
</div>
|
|
145
|
+
</Story.Section>
|
|
146
|
+
</Story.Layout>
|
|
147
|
+
),
|
|
148
|
+
};
|