@jordan-mace/chaser-design-system 1.2.2 → 1.2.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/dist/components/Accordion/Accordion.d.ts +2 -2
- package/dist/components/Accordion/Accordion.js +26 -91
- package/dist/components/Accordion/index.js +1 -2
- package/dist/components/Accordion/styles.css.js +65 -14
- package/dist/components/Alert/Alert.d.ts +1 -1
- package/dist/components/Alert/Alert.js +8 -28
- package/dist/components/Alert/index.js +1 -2
- package/dist/components/Alert/styles.css.js +54 -13
- package/dist/components/AspectRatio/AspectRatio.js +9 -24
- package/dist/components/AspectRatio/index.js +1 -2
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Avatar/Avatar.js +10 -24
- package/dist/components/Avatar/index.js +1 -2
- package/dist/components/Avatar/styles.css.js +151 -19
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Badge/Badge.js +8 -13
- package/dist/components/Badge/index.js +1 -2
- package/dist/components/Badge/styles.css.js +77 -23
- package/dist/components/Box/Box.js +18 -17
- package/dist/components/Box/index.js +1 -2
- package/dist/components/Box/reset.css.js +15 -3
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -2
- package/dist/components/Breadcrumb/Breadcrumb.js +8 -66
- package/dist/components/Breadcrumb/index.js +1 -2
- package/dist/components/Breadcrumb/styles.css.js +50 -10
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +8 -15
- package/dist/components/Button/index.js +1 -2
- package/dist/components/Button/styles.css.js +30 -9
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.js +8 -15
- package/dist/components/Card/index.js +1 -2
- package/dist/components/Card/styles.css.js +25 -10
- package/dist/components/Checkbox/Checkbox.js +20 -45
- package/dist/components/Checkbox/index.js +1 -2
- package/dist/components/Checkbox/styles.css.js +31 -7
- package/dist/components/Collapse/Collapse.d.ts +1 -1
- package/dist/components/Collapse/Collapse.js +40 -42
- package/dist/components/Collapse/index.js +1 -2
- package/dist/components/Collapse/styles.css.js +36 -8
- package/dist/components/Combobox/Combobox.d.ts +1 -1
- package/dist/components/Combobox/Combobox.js +62 -129
- package/dist/components/Combobox/index.js +1 -2
- package/dist/components/Combobox/styles.css.js +142 -20
- package/dist/components/Container/Container.js +9 -19
- package/dist/components/Container/index.js +1 -2
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/Divider/Divider.js +8 -14
- package/dist/components/Divider/index.js +1 -2
- package/dist/components/Divider/styles.css.js +41 -19
- package/dist/components/Drawer/Drawer.d.ts +1 -1
- package/dist/components/Drawer/Drawer.js +37 -85
- package/dist/components/Drawer/index.js +1 -2
- package/dist/components/Drawer/styles.css.js +125 -17
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +33 -88
- package/dist/components/DropdownMenu/index.js +1 -2
- package/dist/components/DropdownMenu/styles.css.d.ts +1 -1
- package/dist/components/DropdownMenu/styles.css.js +93 -22
- package/dist/components/EmptyState/EmptyState.d.ts +1 -1
- package/dist/components/EmptyState/EmptyState.js +8 -32
- package/dist/components/EmptyState/index.js +1 -2
- package/dist/components/EmptyState/styles.css.js +30 -9
- package/dist/components/FileUpload/FileUpload.d.ts +1 -1
- package/dist/components/FileUpload/FileUpload.js +63 -175
- package/dist/components/FileUpload/index.js +1 -2
- package/dist/components/FileUpload/styles.css.js +145 -32
- package/dist/components/Form/Form.d.ts +1 -1
- package/dist/components/Form/Form.js +8 -15
- package/dist/components/Form/FormInput.d.ts +1 -1
- package/dist/components/Form/FormInput.js +9 -15
- package/dist/components/Form/index.js +2 -3
- package/dist/components/Form/styles.css.js +11 -4
- package/dist/components/Grid/Grid.js +14 -19
- package/dist/components/Grid/index.js +1 -2
- package/dist/components/Icon/Icon.d.ts +1 -1
- package/dist/components/Icon/Icon.js +12 -20
- package/dist/components/Icon/index.js +1 -2
- package/dist/components/Icon/styles.css.js +9 -3
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +9 -38
- package/dist/components/Input/index.js +1 -2
- package/dist/components/Input/styles.css.js +8 -4
- package/dist/components/Kbd/Kbd.d.ts +1 -1
- package/dist/components/Kbd/Kbd.js +6 -10
- package/dist/components/Kbd/index.js +1 -2
- package/dist/components/Kbd/styles.css.js +16 -5
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/List/List.js +7 -11
- package/dist/components/List/ListItem.d.ts +1 -1
- package/dist/components/List/ListItem.js +7 -11
- package/dist/components/List/index.js +2 -3
- package/dist/components/List/styles.css.js +11 -6
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/Modal/Modal.js +21 -57
- package/dist/components/Modal/index.js +1 -2
- package/dist/components/Modal/styles.css.js +92 -16
- package/dist/components/Navbar/Navbar.d.ts +1 -1
- package/dist/components/Navbar/Navbar.js +8 -16
- package/dist/components/Navbar/NavbarItem.d.ts +1 -1
- package/dist/components/Navbar/NavbarItem.js +8 -12
- package/dist/components/Navbar/index.js +2 -3
- package/dist/components/Navbar/styles.css.js +3 -4
- package/dist/components/NumberInput/NumberInput.d.ts +1 -1
- package/dist/components/NumberInput/NumberInput.js +25 -94
- package/dist/components/NumberInput/index.js +1 -2
- package/dist/components/NumberInput/styles.css.js +117 -17
- package/dist/components/Pagination/Pagination.d.ts +1 -2
- package/dist/components/Pagination/Pagination.js +34 -57
- package/dist/components/Pagination/index.js +1 -2
- package/dist/components/Pagination/styles.css.js +44 -11
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Popover/Popover.js +43 -93
- package/dist/components/Popover/index.js +1 -2
- package/dist/components/Popover/styles.css.d.ts +2 -2
- package/dist/components/Popover/styles.css.js +185 -33
- package/dist/components/Progress/Progress.d.ts +1 -2
- package/dist/components/Progress/Progress.js +8 -54
- package/dist/components/Progress/index.js +1 -2
- package/dist/components/Progress/styles.css.js +71 -18
- package/dist/components/Radio/Radio.d.ts +2 -2
- package/dist/components/Radio/Radio.js +17 -52
- package/dist/components/Radio/index.js +1 -2
- package/dist/components/Radio/styles.css.js +42 -9
- package/dist/components/ScrollArea/ScrollArea.d.ts +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +8 -18
- package/dist/components/ScrollArea/index.js +1 -2
- package/dist/components/ScrollArea/styles.css.js +25 -11
- package/dist/components/Select/Select.js +9 -35
- package/dist/components/Select/index.js +1 -2
- package/dist/components/Select/styles.css.js +82 -11
- package/dist/components/Separator/Separator.d.ts +1 -2
- package/dist/components/Separator/Separator.js +8 -13
- package/dist/components/Separator/index.js +1 -2
- package/dist/components/Separator/styles.css.js +28 -15
- package/dist/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.js +9 -24
- package/dist/components/Skeleton/index.js +1 -2
- package/dist/components/Skeleton/styles.css.js +56 -20
- package/dist/components/Spinner/Spinner.d.ts +1 -1
- package/dist/components/Spinner/Spinner.js +8 -14
- package/dist/components/Spinner/index.js +1 -2
- package/dist/components/Spinner/styles.css.d.ts +1 -1
- package/dist/components/Spinner/styles.css.js +55 -19
- package/dist/components/Stack/Stack.js +10 -25
- package/dist/components/Stack/index.js +1 -2
- package/dist/components/Stepper/Stepper.d.ts +1 -1
- package/dist/components/Stepper/Stepper.js +19 -64
- package/dist/components/Stepper/index.js +1 -2
- package/dist/components/Stepper/styles.css.js +104 -22
- package/dist/components/Table/Table.d.ts +7 -7
- package/dist/components/Table/Table.js +30 -56
- package/dist/components/Table/index.js +1 -2
- package/dist/components/Table/styles.css.js +49 -15
- package/dist/components/Tabs/Tabs.d.ts +4 -4
- package/dist/components/Tabs/Tabs.js +33 -52
- package/dist/components/Tabs/index.js +1 -2
- package/dist/components/Tabs/styles.css.js +100 -14
- package/dist/components/Tag/Tag.d.ts +2 -2
- package/dist/components/Tag/Tag.js +16 -38
- package/dist/components/Tag/index.js +1 -2
- package/dist/components/Tag/styles.css.d.ts +1 -1
- package/dist/components/Tag/styles.css.js +93 -14
- package/dist/components/Text/Header.d.ts +1 -1
- package/dist/components/Text/Header.js +8 -12
- package/dist/components/Text/P.d.ts +1 -1
- package/dist/components/Text/P.js +8 -12
- package/dist/components/Text/index.js +2 -3
- package/dist/components/Text/styles.css.js +13 -6
- package/dist/components/TextArea/TextArea.d.ts +1 -1
- package/dist/components/TextArea/TextArea.js +9 -38
- package/dist/components/TextArea/index.js +1 -2
- package/dist/components/TextArea/styles.css.js +10 -4
- package/dist/components/Toast/Toast.d.ts +3 -3
- package/dist/components/Toast/Toast.js +85 -144
- package/dist/components/Toast/index.js +1 -2
- package/dist/components/Toast/styles.css.d.ts +1 -1
- package/dist/components/Toast/styles.css.js +192 -32
- package/dist/components/Toggle/Toggle.d.ts +1 -1
- package/dist/components/Toggle/Toggle.js +12 -57
- package/dist/components/Toggle/index.js +1 -2
- package/dist/components/Toggle/styles.css.js +118 -24
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +12 -37
- package/dist/components/Tooltip/index.js +1 -2
- package/dist/components/Tooltip/styles.css.js +86 -17
- package/dist/components/VisuallyHidden/VisuallyHidden.js +7 -6
- package/dist/components/VisuallyHidden/index.js +1 -2
- package/dist/components/VisuallyHidden/styles.css.js +12 -3
- package/dist/components/index.js +47 -48
- package/dist/index.js +1 -1
- package/dist/styles/layers.css.js +3 -4
- package/dist/styles/sprinkles.css.d.ts +115 -115
- package/dist/styles/sprinkles.css.js +72 -2219
- package/dist/styles/theme.css.js +48 -38
- package/dist/styles/utils.js +7 -8
- package/package.json +12 -16
- package/src/components/Accordion/Accordion.stories.tsx +73 -0
- package/src/components/Accordion/Accordion.test.tsx +54 -0
- package/src/components/Accordion/Accordion.tsx +146 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/Accordion/styles.css.ts +72 -0
- package/src/components/Alert/Alert.stories.tsx +82 -0
- package/src/components/Alert/Alert.test.tsx +58 -0
- package/src/components/Alert/Alert.tsx +48 -0
- package/src/components/Alert/__screenshots__/Alert.test.tsx/Alert-renders-dismissible-alert-correctly-1-chromium-linux.png +0 -0
- package/src/components/Alert/__screenshots__/Alert.test.tsx/Alert-renders-error-alert-correctly-1-chromium-linux.png +0 -0
- package/src/components/Alert/__screenshots__/Alert.test.tsx/Alert-renders-info-alert-correctly-1-chromium-linux.png +0 -0
- package/src/components/Alert/__screenshots__/Alert.test.tsx/Alert-renders-success-alert-correctly-1-chromium-linux.png +0 -0
- package/src/components/Alert/__screenshots__/Alert.test.tsx/Alert-renders-warning-alert-correctly-1-chromium-linux.png +0 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/Alert/styles.css.ts +58 -0
- package/src/components/AspectRatio/AspectRatio.stories.tsx +85 -0
- package/src/components/AspectRatio/AspectRatio.test.tsx +50 -0
- package/src/components/AspectRatio/AspectRatio.tsx +42 -0
- package/src/components/AspectRatio/index.ts +2 -0
- package/src/components/Avatar/Avatar.stories.tsx +82 -0
- package/src/components/Avatar/Avatar.test.tsx +45 -0
- package/src/components/Avatar/Avatar.tsx +51 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Avatar/styles.css.ts +155 -0
- package/src/components/Badge/Badge.stories.tsx +141 -0
- package/src/components/Badge/Badge.test.tsx +74 -0
- package/src/components/Badge/Badge.tsx +46 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-does-not-render-children-when-dot-is-true-1.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-default-badge-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-dot-badge-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-dot-with-size-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-dot-with-variant-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-error-badge-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-info-badge-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-large-badge-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-medium-badge-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-small-badge-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-span-element-with-proper-attributes-1.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-success-badge-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/__screenshots__/Badge.test.tsx/Badge-renders-warning-badge-correctly-1-chromium-linux.png +0 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/Badge/styles.css.ts +82 -0
- package/src/components/Box/Box.stories.tsx +183 -0
- package/src/components/Box/Box.test.tsx +63 -0
- package/src/components/Box/Box.tsx +72 -0
- package/src/components/Box/index.ts +2 -0
- package/src/components/Box/reset.css.ts +16 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +55 -0
- package/src/components/Breadcrumb/Breadcrumb.test.tsx +44 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +102 -0
- package/src/components/Breadcrumb/index.ts +1 -0
- package/src/components/Breadcrumb/styles.css.ts +56 -0
- package/src/components/Button/Button.stories.tsx +60 -0
- package/src/components/Button/Button.test.tsx +26 -0
- package/src/components/Button/Button.tsx +31 -0
- package/src/components/Button/__screenshots__/Button.test.tsx/Button-renders-correctly-1-chromium-win32.png +0 -0
- package/src/components/Button/__screenshots__/Button.test.tsx/Button-renders-primary-button-correctly-1-chromium-linux.png +0 -0
- package/src/components/Button/__screenshots__/Button.test.tsx/Button-renders-primary-button-correctly-1-chromium-win32.png +0 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Button/styles.css.ts +32 -0
- package/src/components/Card/Card.stories.tsx +85 -0
- package/src/components/Card/Card.test.tsx +43 -0
- package/src/components/Card/Card.tsx +34 -0
- package/src/components/Card/__screenshots__/Card.test.tsx/Card-renders-elevated-card-correctly-1-chromium-linux.png +0 -0
- package/src/components/Card/__screenshots__/Card.test.tsx/Card-renders-filled-card-correctly-1-chromium-linux.png +0 -0
- package/src/components/Card/__screenshots__/Card.test.tsx/Card-renders-outlined-card-correctly-1-chromium-linux.png +0 -0
- package/src/components/Card/__screenshots__/Card.test.tsx/Card-renders-with-no-padding-1-chromium-linux.png +0 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Card/styles.css.ts +27 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +61 -0
- package/src/components/Checkbox/Checkbox.test.tsx +40 -0
- package/src/components/Checkbox/Checkbox.tsx +58 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Checkbox/styles.css.ts +34 -0
- package/src/components/Collapse/Collapse.stories.tsx +63 -0
- package/src/components/Collapse/Collapse.test.tsx +24 -0
- package/src/components/Collapse/Collapse.tsx +97 -0
- package/src/components/Collapse/index.ts +2 -0
- package/src/components/Collapse/styles.css.ts +42 -0
- package/src/components/Combobox/Combobox.stories.tsx +100 -0
- package/src/components/Combobox/Combobox.test.tsx +49 -0
- package/src/components/Combobox/Combobox.tsx +266 -0
- package/src/components/Combobox/index.ts +2 -0
- package/src/components/Combobox/styles.css.ts +155 -0
- package/src/components/Container/Container.stories.tsx +69 -0
- package/src/components/Container/Container.test.tsx +42 -0
- package/src/components/Container/Container.tsx +47 -0
- package/src/components/Container/index.ts +2 -0
- package/src/components/Divider/Divider.stories.tsx +121 -0
- package/src/components/Divider/Divider.test.tsx +56 -0
- package/src/components/Divider/Divider.tsx +40 -0
- package/src/components/Divider/__screenshots__/Divider.test.tsx/Divider-applies-orientation-correctly-1.png +0 -0
- package/src/components/Divider/__screenshots__/Divider.test.tsx/Divider-renders-horizontal-divider-correctly-1-chromium-linux.png +0 -0
- package/src/components/Divider/__screenshots__/Divider.test.tsx/Divider-renders-hr-element-with-proper-attributes-1.png +0 -0
- package/src/components/Divider/__screenshots__/Divider.test.tsx/Divider-renders-large-divider-correctly-1-chromium-linux.png +0 -0
- package/src/components/Divider/__screenshots__/Divider.test.tsx/Divider-renders-medium-divider-correctly-1-chromium-linux.png +0 -0
- package/src/components/Divider/__screenshots__/Divider.test.tsx/Divider-renders-small-divider-correctly-1-chromium-linux.png +0 -0
- package/src/components/Divider/__screenshots__/Divider.test.tsx/Divider-renders-vertical-divider-correctly-1-chromium-linux.png +0 -0
- package/src/components/Divider/index.ts +2 -0
- package/src/components/Divider/styles.css.ts +45 -0
- package/src/components/Drawer/Drawer.stories.tsx +99 -0
- package/src/components/Drawer/Drawer.test.tsx +51 -0
- package/src/components/Drawer/Drawer.tsx +148 -0
- package/src/components/Drawer/index.ts +2 -0
- package/src/components/Drawer/styles.css.ts +138 -0
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +72 -0
- package/src/components/DropdownMenu/DropdownMenu.test.tsx +43 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +156 -0
- package/src/components/DropdownMenu/index.ts +2 -0
- package/src/components/DropdownMenu/styles.css.ts +102 -0
- package/src/components/EmptyState/EmptyState.stories.tsx +47 -0
- package/src/components/EmptyState/EmptyState.test.tsx +25 -0
- package/src/components/EmptyState/EmptyState.tsx +53 -0
- package/src/components/EmptyState/index.ts +2 -0
- package/src/components/EmptyState/styles.css.ts +36 -0
- package/src/components/FileUpload/FileUpload.stories.tsx +138 -0
- package/src/components/FileUpload/FileUpload.test.tsx +56 -0
- package/src/components/FileUpload/FileUpload.tsx +269 -0
- package/src/components/FileUpload/index.ts +2 -0
- package/src/components/FileUpload/styles.css.ts +164 -0
- package/src/components/Form/Form.stories.tsx +51 -0
- package/src/components/Form/Form.test.tsx +41 -0
- package/src/components/Form/Form.tsx +28 -0
- package/src/components/Form/FormInput.tsx +16 -0
- package/src/components/Form/__screenshots__/Form.test.tsx/Form-can-submit-1.png +0 -0
- package/src/components/Form/__screenshots__/Form.test.tsx/Form-renders-correctly-1-chromium-win32.png +0 -0
- package/src/components/Form/__screenshots__/Form.test.tsx/Form-renders-form-correctly-1-chromium-linux.png +0 -0
- package/src/components/Form/__screenshots__/Form.test.tsx/Form-renders-form-correctly-1-chromium-win32.png +0 -0
- package/src/components/Form/index.ts +2 -0
- package/src/components/Form/styles.css.ts +13 -0
- package/src/components/Grid/Grid.stories.tsx +134 -0
- package/src/components/Grid/Grid.test.tsx +41 -0
- package/src/components/Grid/Grid.tsx +48 -0
- package/src/components/Grid/index.ts +2 -0
- package/src/components/Icon/Icon.tsx +43 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/Icon/styles.css.ts +11 -0
- package/src/components/Input/Input.stories.tsx +38 -0
- package/src/components/Input/Input.test.tsx +16 -0
- package/src/components/Input/Input.tsx +43 -0
- package/src/components/Input/__screenshots__/Input.test.tsx/Input-renders-correctly-with-label-1-chromium-linux.png +0 -0
- package/src/components/Input/__screenshots__/Input.test.tsx/Input-renders-correctly-with-label-1-chromium-win32.png +0 -0
- package/src/components/Input/__screenshots__/Input.test.tsx/Input-renders-correctly-without-label-1-chromium-linux.png +0 -0
- package/src/components/Input/__screenshots__/Input.test.tsx/Input-renders-correctly-without-label-1-chromium-win32.png +0 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/Input/styles.css.ts +10 -0
- package/src/components/Kbd/Kbd.stories.tsx +53 -0
- package/src/components/Kbd/Kbd.test.tsx +22 -0
- package/src/components/Kbd/Kbd.tsx +17 -0
- package/src/components/Kbd/index.ts +2 -0
- package/src/components/Kbd/styles.css.ts +18 -0
- package/src/components/List/List.test.tsx +18 -0
- package/src/components/List/List.tsx +13 -0
- package/src/components/List/ListItem.tsx +13 -0
- package/src/components/List/__screenshots__/List.test.tsx/List-renders-correctly-1-chromium-win32.png +0 -0
- package/src/components/List/__screenshots__/List.test.tsx/List-renders-list-correctly-1-chromium-linux.png +0 -0
- package/src/components/List/__screenshots__/List.test.tsx/List-renders-list-correctly-1-chromium-win32.png +0 -0
- package/src/components/List/index.ts +2 -0
- package/src/components/List/styles.css.ts +13 -0
- package/src/components/Modal/Modal.stories.tsx +202 -0
- package/src/components/Modal/Modal.test.tsx +168 -0
- package/src/components/Modal/Modal.tsx +109 -0
- package/src/components/Modal/__screenshots__/Modal.test.tsx/Modal-displays-title-correctly-1.png +0 -0
- package/src/components/Modal/__screenshots__/Modal.test.tsx/Modal-handles-backdrop-click-to-close-1.png +0 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Modal/styles.css.ts +99 -0
- package/src/components/Navbar/Navbar.stories.tsx +49 -0
- package/src/components/Navbar/Navbar.test.tsx +18 -0
- package/src/components/Navbar/Navbar.tsx +27 -0
- package/src/components/Navbar/NavbarItem.tsx +14 -0
- package/src/components/Navbar/__screenshots__/Navbar.test.tsx/Navbar-renders-correctly-1-chromium-win32.png +0 -0
- package/src/components/Navbar/__screenshots__/Navbar.test.tsx/Navbar-renders-navbar-correctly-1-chromium-linux.png +0 -0
- package/src/components/Navbar/__screenshots__/Navbar.test.tsx/Navbar-renders-navbar-correctly-1-chromium-win32.png +0 -0
- package/src/components/Navbar/index.ts +2 -0
- package/src/components/Navbar/styles.css.ts +5 -0
- package/src/components/NumberInput/NumberInput.stories.tsx +101 -0
- package/src/components/NumberInput/NumberInput.test.tsx +39 -0
- package/src/components/NumberInput/NumberInput.tsx +161 -0
- package/src/components/NumberInput/index.ts +2 -0
- package/src/components/NumberInput/styles.css.ts +127 -0
- package/src/components/Pagination/Pagination.stories.tsx +63 -0
- package/src/components/Pagination/Pagination.test.tsx +27 -0
- package/src/components/Pagination/Pagination.tsx +138 -0
- package/src/components/Pagination/index.ts +2 -0
- package/src/components/Pagination/styles.css.ts +48 -0
- package/src/components/Popover/Popover.stories.tsx +80 -0
- package/src/components/Popover/Popover.test.tsx +47 -0
- package/src/components/Popover/Popover.tsx +171 -0
- package/src/components/Popover/index.ts +2 -0
- package/src/components/Popover/styles.css.ts +197 -0
- package/src/components/Progress/Progress.stories.tsx +73 -0
- package/src/components/Progress/Progress.test.tsx +53 -0
- package/src/components/Progress/Progress.tsx +66 -0
- package/src/components/Progress/index.ts +1 -0
- package/src/components/Progress/styles.css.ts +75 -0
- package/src/components/Radio/Radio.stories.tsx +75 -0
- package/src/components/Radio/Radio.test.tsx +54 -0
- package/src/components/Radio/Radio.tsx +104 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/Radio/styles.css.ts +47 -0
- package/src/components/ScrollArea/ScrollArea.stories.tsx +63 -0
- package/src/components/ScrollArea/ScrollArea.test.tsx +24 -0
- package/src/components/ScrollArea/ScrollArea.tsx +50 -0
- package/src/components/ScrollArea/index.ts +2 -0
- package/src/components/ScrollArea/styles.css.ts +28 -0
- package/src/components/Select/Select.stories.tsx +94 -0
- package/src/components/Select/Select.test.tsx +57 -0
- package/src/components/Select/Select.tsx +60 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Select/styles.css.ts +86 -0
- package/src/components/Separator/Separator.stories.tsx +49 -0
- package/src/components/Separator/Separator.test.tsx +22 -0
- package/src/components/Separator/Separator.tsx +37 -0
- package/src/components/Separator/index.ts +2 -0
- package/src/components/Separator/styles.css.ts +32 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +78 -0
- package/src/components/Skeleton/Skeleton.test.tsx +36 -0
- package/src/components/Skeleton/Skeleton.tsx +67 -0
- package/src/components/Skeleton/index.ts +2 -0
- package/src/components/Skeleton/styles.css.ts +62 -0
- package/src/components/Spinner/Spinner.stories.tsx +123 -0
- package/src/components/Spinner/Spinner.test.tsx +73 -0
- package/src/components/Spinner/Spinner.tsx +41 -0
- package/src/components/Spinner/__screenshots__/Spinner.test.tsx/Spinner-renders-div-element-with-proper-attributes-1.png +0 -0
- package/src/components/Spinner/__screenshots__/Spinner.test.tsx/Spinner-renders-error-color-correctly-1-chromium-linux.png +0 -0
- package/src/components/Spinner/__screenshots__/Spinner.test.tsx/Spinner-renders-info-color-correctly-1-chromium-linux.png +0 -0
- package/src/components/Spinner/__screenshots__/Spinner.test.tsx/Spinner-renders-large-spinner-correctly-1-chromium-linux.png +0 -0
- package/src/components/Spinner/__screenshots__/Spinner.test.tsx/Spinner-renders-medium-spinner-correctly-1-chromium-linux.png +0 -0
- package/src/components/Spinner/__screenshots__/Spinner.test.tsx/Spinner-renders-primary-spinner-correctly-1-chromium-linux.png +0 -0
- package/src/components/Spinner/__screenshots__/Spinner.test.tsx/Spinner-renders-secondary-color-correctly-1-chromium-linux.png +0 -0
- package/src/components/Spinner/__screenshots__/Spinner.test.tsx/Spinner-renders-small-spinner-correctly-1-chromium-linux.png +0 -0
- package/src/components/Spinner/__screenshots__/Spinner.test.tsx/Spinner-renders-success-color-correctly-1-chromium-linux.png +0 -0
- package/src/components/Spinner/__screenshots__/Spinner.test.tsx/Spinner-renders-warning-color-correctly-1-chromium-linux.png +0 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Spinner/styles.css.ts +59 -0
- package/src/components/Stack/Stack.stories.tsx +123 -0
- package/src/components/Stack/Stack.test.tsx +48 -0
- package/src/components/Stack/Stack.tsx +60 -0
- package/src/components/Stack/index.ts +2 -0
- package/src/components/Stepper/Stepper.stories.tsx +85 -0
- package/src/components/Stepper/Stepper.test.tsx +47 -0
- package/src/components/Stepper/Stepper.tsx +133 -0
- package/src/components/Stepper/index.ts +2 -0
- package/src/components/Stepper/styles.css.ts +118 -0
- package/src/components/Table/Table.stories.tsx +147 -0
- package/src/components/Table/Table.test.tsx +104 -0
- package/src/components/Table/Table.tsx +131 -0
- package/src/components/Table/index.ts +1 -0
- package/src/components/Table/styles.css.ts +57 -0
- package/src/components/Tabs/Tabs.stories.tsx +104 -0
- package/src/components/Tabs/Tabs.test.tsx +52 -0
- package/src/components/Tabs/Tabs.tsx +147 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tabs/styles.css.ts +106 -0
- package/src/components/Tag/Tag.stories.tsx +72 -0
- package/src/components/Tag/Tag.test.tsx +49 -0
- package/src/components/Tag/Tag.tsx +72 -0
- package/src/components/Tag/index.ts +1 -0
- package/src/components/Tag/styles.css.ts +96 -0
- package/src/components/Text/Header.stories.tsx +45 -0
- package/src/components/Text/Header.tsx +20 -0
- package/src/components/Text/P.stories.tsx +24 -0
- package/src/components/Text/P.tsx +19 -0
- package/src/components/Text/Text.test.tsx +32 -0
- package/src/components/Text/__screenshots__/Text.test.tsx/Header-renders-h1-correctly-1-chromium-linux.png +0 -0
- package/src/components/Text/__screenshots__/Text.test.tsx/Header-renders-h1-correctly-1-chromium-win32.png +0 -0
- package/src/components/Text/__screenshots__/Text.test.tsx/Header-renders-h2-correctly-1-chromium-linux.png +0 -0
- package/src/components/Text/__screenshots__/Text.test.tsx/Header-renders-h2-correctly-1-chromium-win32.png +0 -0
- package/src/components/Text/__screenshots__/Text.test.tsx/Header-renders-h3-correctly-1-chromium-linux.png +0 -0
- package/src/components/Text/__screenshots__/Text.test.tsx/Header-renders-h3-correctly-1-chromium-win32.png +0 -0
- package/src/components/Text/__screenshots__/Text.test.tsx/P-renders-correctly-1-chromium-win32.png +0 -0
- package/src/components/Text/__screenshots__/Text.test.tsx/P-renders-p-correctly-1-chromium-linux.png +0 -0
- package/src/components/Text/__screenshots__/Text.test.tsx/P-renders-p-correctly-1-chromium-win32.png +0 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Text/styles.css.ts +15 -0
- package/src/components/TextArea/TextArea.stories.tsx +40 -0
- package/src/components/TextArea/TextArea.test.tsx +16 -0
- package/src/components/TextArea/TextArea.tsx +43 -0
- package/src/components/TextArea/index.ts +2 -0
- package/src/components/TextArea/styles.css.ts +12 -0
- package/src/components/Toast/Toast.tsx +342 -0
- package/src/components/Toast/index.ts +9 -0
- package/src/components/Toast/styles.css.ts +213 -0
- package/src/components/Toggle/Toggle.stories.tsx +190 -0
- package/src/components/Toggle/Toggle.test.tsx +85 -0
- package/src/components/Toggle/Toggle.tsx +94 -0
- package/src/components/Toggle/index.ts +2 -0
- package/src/components/Toggle/styles.css.ts +130 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +111 -0
- package/src/components/Tooltip/Tooltip.test.tsx +93 -0
- package/src/components/Tooltip/Tooltip.tsx +72 -0
- package/src/components/Tooltip/__screenshots__/Tooltip.test.tsx/Tooltip-has-proper-role-attribute-1.png +0 -0
- package/src/components/Tooltip/__screenshots__/Tooltip.test.tsx/Tooltip-renders-bottom-tooltip-correctly-1-chromium-linux.png +0 -0
- package/src/components/Tooltip/__screenshots__/Tooltip.test.tsx/Tooltip-renders-left-tooltip-correctly-1-chromium-linux.png +0 -0
- package/src/components/Tooltip/__screenshots__/Tooltip.test.tsx/Tooltip-renders-right-tooltip-correctly-1-chromium-linux.png +0 -0
- package/src/components/Tooltip/__screenshots__/Tooltip.test.tsx/Tooltip-renders-tooltip-without-arrow-1-chromium-linux.png +0 -0
- package/src/components/Tooltip/__screenshots__/Tooltip.test.tsx/Tooltip-renders-top-tooltip-correctly-1-chromium-linux.png +0 -0
- package/src/components/Tooltip/__screenshots__/Tooltip.test.tsx/Tooltip-renders-with-tooltip-content-1.png +0 -0
- package/src/components/Tooltip/__screenshots__/Tooltip.test.tsx/Tooltip-shows-tooltip-on-hover-1.png +0 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/Tooltip/styles.css.ts +94 -0
- package/src/components/VisuallyHidden/VisuallyHidden.stories.tsx +42 -0
- package/src/components/VisuallyHidden/VisuallyHidden.test.tsx +20 -0
- package/src/components/VisuallyHidden/VisuallyHidden.tsx +26 -0
- package/src/components/VisuallyHidden/index.ts +2 -0
- package/src/components/VisuallyHidden/styles.css.ts +14 -0
- package/src/components/index.ts +68 -0
- package/src/index.ts +1 -0
- package/src/styles/layers.css.ts +3 -0
- package/src/styles/reset.css.ts +79 -0
- package/src/styles/sprinkles.css.ts +177 -0
- package/src/styles/theme.css.ts +55 -0
- package/src/styles/utils.ts +9 -0
- package/dist/layers.css.js +0 -4
- package/dist/reset.css.js +0 -1
- package/dist/styles/reset.css.js +0 -1
- package/dist/theme.css.js +0 -41
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { button, buttonVariants } from './styles.css';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Box from '../Box';
|
|
5
|
+
|
|
6
|
+
type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
7
|
+
variant: 'primary' | 'secondary';
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
label?: string;
|
|
10
|
+
fullWidth?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Button = ({ label, ...props }: ButtonProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<Box
|
|
16
|
+
as="button"
|
|
17
|
+
borderRadius="large"
|
|
18
|
+
width={props.fullWidth ? '100%' : undefined}
|
|
19
|
+
className={clsx(
|
|
20
|
+
buttonVariants[props.variant],
|
|
21
|
+
button,
|
|
22
|
+
props.className,
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
{props.children || label}
|
|
27
|
+
</Box>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default Button;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from './Button';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { styleVariants } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
+
|
|
5
|
+
export const buttonVariants = styleVariants({
|
|
6
|
+
primary: {
|
|
7
|
+
backgroundColor: vars.colors.buttonBackgroundPrimary,
|
|
8
|
+
color: vars.colors.buttonTextPrimary,
|
|
9
|
+
':focus-visible': {
|
|
10
|
+
backgroundColor: vars.colors.buttonBackgroundFocusedPrimary,
|
|
11
|
+
},
|
|
12
|
+
':hover': {
|
|
13
|
+
backgroundColor: vars.colors.buttonBackgroundFocusedPrimary,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
secondary: {
|
|
17
|
+
backgroundColor: vars.colors.buttonBackgroundSecondary,
|
|
18
|
+
color: vars.colors.buttonTextSecondary,
|
|
19
|
+
':focus-visible': {
|
|
20
|
+
backgroundColor: vars.colors.buttonBackgroundFocusedSecondary,
|
|
21
|
+
},
|
|
22
|
+
':hover': {
|
|
23
|
+
backgroundColor: vars.colors.buttonBackgroundFocusedSecondary,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const button = styleWithLayer({
|
|
29
|
+
padding: '1rem',
|
|
30
|
+
borderRadius: '1rem',
|
|
31
|
+
border: 0,
|
|
32
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
|
|
3
|
+
import { Card } from '.';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { P } from '../Text';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Components/Card',
|
|
10
|
+
component: Card,
|
|
11
|
+
parameters: {
|
|
12
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
13
|
+
layout: 'centered',
|
|
14
|
+
},
|
|
15
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
decorators: [
|
|
18
|
+
(Story) => (
|
|
19
|
+
<div
|
|
20
|
+
style={{
|
|
21
|
+
display: 'flex',
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
width: '100vw',
|
|
25
|
+
maxWidth: '400px',
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<Story />
|
|
29
|
+
</div>
|
|
30
|
+
),
|
|
31
|
+
],
|
|
32
|
+
} satisfies Meta<typeof Card>;
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
36
|
+
|
|
37
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
38
|
+
export const Elevated: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
variant: 'elevated',
|
|
41
|
+
children: (
|
|
42
|
+
<>
|
|
43
|
+
<P>This is an elevated card with a shadow effect.</P>
|
|
44
|
+
<P>It stands out from the background nicely.</P>
|
|
45
|
+
</>
|
|
46
|
+
),
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const Outlined: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
variant: 'outlined',
|
|
53
|
+
children: (
|
|
54
|
+
<>
|
|
55
|
+
<P>This is an outlined card with a border.</P>
|
|
56
|
+
<P>It has a clean, minimal appearance.</P>
|
|
57
|
+
</>
|
|
58
|
+
),
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Filled: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
variant: 'filled',
|
|
65
|
+
children: (
|
|
66
|
+
<>
|
|
67
|
+
<P>This is a filled card with background color.</P>
|
|
68
|
+
<P>It provides subtle visual separation.</P>
|
|
69
|
+
</>
|
|
70
|
+
),
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const NoPadding: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
variant: 'elevated',
|
|
77
|
+
padding: 'none',
|
|
78
|
+
children: (
|
|
79
|
+
<div style={{ padding: '1rem' }}>
|
|
80
|
+
<P>This card has no built-in padding.</P>
|
|
81
|
+
<P>Useful when you need full control over spacing.</P>
|
|
82
|
+
</div>
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from 'vitest-browser-react';
|
|
3
|
+
import Card from './Card';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { P } from '../Text';
|
|
6
|
+
|
|
7
|
+
describe('Card', () => {
|
|
8
|
+
it('renders elevated card correctly', async () => {
|
|
9
|
+
const { container } = await render(
|
|
10
|
+
<Card variant="elevated">
|
|
11
|
+
<P>Card content</P>
|
|
12
|
+
</Card>,
|
|
13
|
+
);
|
|
14
|
+
expect(container).toMatchScreenshot();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders outlined card correctly', async () => {
|
|
18
|
+
const { container } = await render(
|
|
19
|
+
<Card variant="outlined">
|
|
20
|
+
<P>Card content</P>
|
|
21
|
+
</Card>,
|
|
22
|
+
);
|
|
23
|
+
expect(container).toMatchScreenshot();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('renders filled card correctly', async () => {
|
|
27
|
+
const { container } = await render(
|
|
28
|
+
<Card variant="filled">
|
|
29
|
+
<P>Card content</P>
|
|
30
|
+
</Card>,
|
|
31
|
+
);
|
|
32
|
+
expect(container).toMatchScreenshot();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('renders with no padding', async () => {
|
|
36
|
+
const { container } = await render(
|
|
37
|
+
<Card variant="elevated" padding="none">
|
|
38
|
+
<P>Card content</P>
|
|
39
|
+
</Card>,
|
|
40
|
+
);
|
|
41
|
+
expect(container).toMatchScreenshot();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { card, cardVariants } from './styles.css';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Box from '../Box';
|
|
5
|
+
|
|
6
|
+
type CardProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
variant?: 'elevated' | 'outlined' | 'filled';
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
padding?: 'none' | 'small' | 'medium' | 'large';
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Card = ({
|
|
13
|
+
variant = 'elevated',
|
|
14
|
+
padding = 'medium',
|
|
15
|
+
...props
|
|
16
|
+
}: CardProps) => {
|
|
17
|
+
return (
|
|
18
|
+
<Box
|
|
19
|
+
as="div"
|
|
20
|
+
borderRadius="large"
|
|
21
|
+
padding={padding !== 'none' ? padding : undefined}
|
|
22
|
+
className={clsx(
|
|
23
|
+
cardVariants[variant],
|
|
24
|
+
card,
|
|
25
|
+
props.className,
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
{props.children}
|
|
30
|
+
</Box>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default Card;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Card } from './Card';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { styleVariants } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
+
|
|
5
|
+
export const cardVariants = styleVariants({
|
|
6
|
+
elevated: {
|
|
7
|
+
backgroundColor: vars.colors.backgroundDefault,
|
|
8
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
|
|
9
|
+
border: 'none',
|
|
10
|
+
},
|
|
11
|
+
outlined: {
|
|
12
|
+
backgroundColor: vars.colors.backgroundDefault,
|
|
13
|
+
border: `1px solid ${vars.colors.borderDefault}`,
|
|
14
|
+
boxShadow: 'none',
|
|
15
|
+
},
|
|
16
|
+
filled: {
|
|
17
|
+
backgroundColor: vars.colors.backgroundMuted,
|
|
18
|
+
border: 'none',
|
|
19
|
+
boxShadow: 'none',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const card = styleWithLayer({
|
|
24
|
+
display: 'block',
|
|
25
|
+
position: 'relative',
|
|
26
|
+
transition: 'all 0.2s ease-in-out',
|
|
27
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
|
+
|
|
4
|
+
import { Checkbox } from '.';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/Checkbox',
|
|
9
|
+
component: Checkbox,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
args: { onChange: fn() },
|
|
15
|
+
} satisfies Meta<typeof Checkbox>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
args: {},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const WithLabel: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
label: 'Accept terms and conditions',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Checked: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
label: 'Selected option',
|
|
33
|
+
checked: true,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const Disabled: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
label: 'Disabled checkbox',
|
|
40
|
+
disabled: true,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const DisabledChecked: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
label: 'Disabled checked',
|
|
47
|
+
disabled: true,
|
|
48
|
+
checked: true,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Multiple: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
55
|
+
<Checkbox label="Option 1" />
|
|
56
|
+
<Checkbox label="Option 2" defaultChecked />
|
|
57
|
+
<Checkbox label="Option 3" />
|
|
58
|
+
<Checkbox label="Option 4 (disabled)" disabled />
|
|
59
|
+
</div>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from 'vitest-browser-react';
|
|
3
|
+
import Checkbox from './Checkbox';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
describe('Checkbox', () => {
|
|
7
|
+
it('renders unchecked checkbox correctly', async () => {
|
|
8
|
+
const { container } = await render(<Checkbox />);
|
|
9
|
+
expect(container).toMatchScreenshot();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('renders checked checkbox correctly', async () => {
|
|
13
|
+
const { container } = await render(<Checkbox checked readOnly />);
|
|
14
|
+
expect(container).toMatchScreenshot();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders checkbox with label correctly', async () => {
|
|
18
|
+
const { container } = await render(<Checkbox label="Accept terms" />);
|
|
19
|
+
expect(container).toMatchScreenshot();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('renders disabled checkbox correctly', async () => {
|
|
23
|
+
const { container } = await render(<Checkbox disabled label="Disabled option" />);
|
|
24
|
+
expect(container).toMatchScreenshot();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('renders as checked after click', async () => {
|
|
28
|
+
const { container } = await render(<Checkbox />);
|
|
29
|
+
const checkbox = container.querySelector('input[type="checkbox"]');
|
|
30
|
+
await checkbox?.click();
|
|
31
|
+
// After clicking, checkbox should be checked
|
|
32
|
+
expect(checkbox?.checked).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('is accessible with proper role', async () => {
|
|
36
|
+
const { getByRole } = await render(<Checkbox label="Test checkbox" />);
|
|
37
|
+
const checkbox = getByRole('checkbox');
|
|
38
|
+
expect(checkbox).toBeDefined();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import React, { forwardRef, useEffect, useRef } from 'react';
|
|
3
|
+
import { checkboxContainer, checkboxInput, checkboxLabel } from './styles.css';
|
|
4
|
+
import Box from '../Box';
|
|
5
|
+
|
|
6
|
+
type CheckboxProps = Omit<
|
|
7
|
+
React.InputHTMLAttributes<HTMLInputElement>,
|
|
8
|
+
'type'
|
|
9
|
+
> & {
|
|
10
|
+
label?: string;
|
|
11
|
+
indeterminate?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
15
|
+
({ label, className, indeterminate, ...props }, ref) => {
|
|
16
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
17
|
+
const combinedRef = (node: HTMLInputElement) => {
|
|
18
|
+
if (typeof ref === 'function') {
|
|
19
|
+
ref(node);
|
|
20
|
+
} else if (ref) {
|
|
21
|
+
ref.current = node;
|
|
22
|
+
}
|
|
23
|
+
inputRef.current = node;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (inputRef.current) {
|
|
28
|
+
inputRef.current.indeterminate = !!indeterminate;
|
|
29
|
+
}
|
|
30
|
+
}, [indeterminate]);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Box
|
|
34
|
+
as="label"
|
|
35
|
+
className={clsx(checkboxContainer, className)}
|
|
36
|
+
display="flex"
|
|
37
|
+
alignItems="center"
|
|
38
|
+
gap="small"
|
|
39
|
+
cursor="pointer"
|
|
40
|
+
style={{ userSelect: 'none' }}
|
|
41
|
+
>
|
|
42
|
+
<Box
|
|
43
|
+
as="input"
|
|
44
|
+
type="checkbox"
|
|
45
|
+
ref={combinedRef}
|
|
46
|
+
className={checkboxInput}
|
|
47
|
+
style={{ width: '18px', height: '18px' }}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
{label && <Box as="span" className={checkboxLabel}>{label}</Box>}
|
|
51
|
+
</Box>
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
Checkbox.displayName = 'Checkbox';
|
|
57
|
+
|
|
58
|
+
export default Checkbox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from './Checkbox';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
+
|
|
5
|
+
export const checkboxContainer = styleWithLayer({
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
gap: '8px',
|
|
9
|
+
cursor: 'pointer',
|
|
10
|
+
userSelect: 'none',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const checkboxInput = style({
|
|
14
|
+
width: '18px',
|
|
15
|
+
height: '18px',
|
|
16
|
+
border: `2px solid ${vars.colors.borderDefault}`,
|
|
17
|
+
borderRadius: '4px',
|
|
18
|
+
cursor: 'pointer',
|
|
19
|
+
accentColor: vars.colors.buttonBackgroundPrimary,
|
|
20
|
+
':focus-visible': {
|
|
21
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
22
|
+
outlineOffset: '2px',
|
|
23
|
+
},
|
|
24
|
+
':disabled': {
|
|
25
|
+
cursor: 'not-allowed',
|
|
26
|
+
opacity: 0.5,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const checkboxLabel = styleWithLayer({
|
|
31
|
+
fontFamily: vars.fontFamily.body,
|
|
32
|
+
fontSize: '14px',
|
|
33
|
+
color: vars.colors.textPrimary,
|
|
34
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Collapse } from '.';
|
|
5
|
+
import { Box } from '../Box';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/Collapse',
|
|
9
|
+
component: Collapse,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
} satisfies Meta<typeof Collapse>;
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
|
|
19
|
+
export const Open: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
isOpen: true,
|
|
22
|
+
children: (
|
|
23
|
+
<Box padding="medium" background="c1-100">
|
|
24
|
+
This content is visible and can be collapsed.
|
|
25
|
+
</Box>
|
|
26
|
+
),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Closed: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
isOpen: false,
|
|
33
|
+
children: (
|
|
34
|
+
<Box padding="medium" background="c1-100">
|
|
35
|
+
This content is hidden when collapsed.
|
|
36
|
+
</Box>
|
|
37
|
+
),
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const HeightOnly: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
isOpen: true,
|
|
44
|
+
animation: 'height',
|
|
45
|
+
children: (
|
|
46
|
+
<Box padding="medium" background="c2-100">
|
|
47
|
+
Height-only animation
|
|
48
|
+
</Box>
|
|
49
|
+
),
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const OpacityOnly: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
isOpen: true,
|
|
56
|
+
animation: 'opacity',
|
|
57
|
+
children: (
|
|
58
|
+
<Box padding="medium" background="c3-100">
|
|
59
|
+
Opacity-only animation
|
|
60
|
+
</Box>
|
|
61
|
+
),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from 'vitest-browser-react';
|
|
3
|
+
import Collapse from './Collapse';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
describe('Collapse', () => {
|
|
7
|
+
it('renders when open', async () => {
|
|
8
|
+
const { container } = await render(
|
|
9
|
+
<Collapse isOpen={true}>
|
|
10
|
+
<div>Collapsed content</div>
|
|
11
|
+
</Collapse>
|
|
12
|
+
);
|
|
13
|
+
expect(container).toMatchScreenshot();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('renders when closed', async () => {
|
|
17
|
+
const { container } = await render(
|
|
18
|
+
<Collapse isOpen={false}>
|
|
19
|
+
<div>Hidden content</div>
|
|
20
|
+
</Collapse>
|
|
21
|
+
);
|
|
22
|
+
expect(container).toMatchScreenshot();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
collapseContainer,
|
|
5
|
+
collapseContent,
|
|
6
|
+
collapseAnimation,
|
|
7
|
+
} from './styles.css';
|
|
8
|
+
import Box from '../Box';
|
|
9
|
+
|
|
10
|
+
export type CollapseAnimation = 'height' | 'opacity' | 'both';
|
|
11
|
+
|
|
12
|
+
export interface CollapseProps {
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
animation?: CollapseAnimation;
|
|
16
|
+
duration?: number;
|
|
17
|
+
className?: string;
|
|
18
|
+
onAnimationEnd?: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const Collapse = ({
|
|
22
|
+
isOpen,
|
|
23
|
+
children,
|
|
24
|
+
animation = 'both',
|
|
25
|
+
duration = 300,
|
|
26
|
+
className,
|
|
27
|
+
onAnimationEnd,
|
|
28
|
+
}: CollapseProps) => {
|
|
29
|
+
const [height, setHeight] = useState<number | undefined>(isOpen ? undefined : 0);
|
|
30
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
31
|
+
const contentRef = useRef<HTMLDivElement>(null);
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (isOpen) {
|
|
35
|
+
setIsAnimating(true);
|
|
36
|
+
if (contentRef.current) {
|
|
37
|
+
setHeight(contentRef.current.scrollHeight);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
setIsAnimating(true);
|
|
41
|
+
setHeight(0);
|
|
42
|
+
}
|
|
43
|
+
}, [isOpen]);
|
|
44
|
+
|
|
45
|
+
const handleTransitionEnd = () => {
|
|
46
|
+
setIsAnimating(false);
|
|
47
|
+
if (isOpen) {
|
|
48
|
+
setHeight(undefined);
|
|
49
|
+
}
|
|
50
|
+
onAnimationEnd?.();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const getAnimationStyles = (): React.CSSProperties => {
|
|
54
|
+
const baseStyles: React.CSSProperties = {
|
|
55
|
+
transition: `height ${duration}ms ease-out, opacity ${duration}ms ease-out`,
|
|
56
|
+
height: height !== undefined ? `${height}px` : undefined,
|
|
57
|
+
opacity: isOpen || isAnimating ? 1 : 0,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if (animation === 'height') {
|
|
61
|
+
return {
|
|
62
|
+
...baseStyles,
|
|
63
|
+
transition: `height ${duration}ms ease-out`,
|
|
64
|
+
opacity: 1,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (animation === 'opacity') {
|
|
69
|
+
return {
|
|
70
|
+
...baseStyles,
|
|
71
|
+
transition: `opacity ${duration}ms ease-out`,
|
|
72
|
+
height: undefined,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return baseStyles;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
if (!isOpen && !isAnimating && animation !== 'opacity') {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Box
|
|
85
|
+
className={clsx(collapseContainer, className)}
|
|
86
|
+
style={getAnimationStyles()}
|
|
87
|
+
onTransitionEnd={handleTransitionEnd}
|
|
88
|
+
aria-hidden={!isOpen}
|
|
89
|
+
>
|
|
90
|
+
<Box ref={contentRef} className={collapseContent}>
|
|
91
|
+
{children}
|
|
92
|
+
</Box>
|
|
93
|
+
</Box>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default Collapse;
|