diff --git a/package-lock.json b/package-lock.json index ef9d5dd62..b4bff3c76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2399,6 +2399,7 @@ }, "node_modules/@clack/prompts/node_modules/is-unicode-supported": { "version": "1.3.0", + "extraneous": true, "inBundle": true, "license": "MIT", "engines": { diff --git a/packages/components/drawer/src/Drawer.doc.mdx b/packages/components/drawer/src/Drawer.doc.mdx index 8bee70bf9..2efb72665 100644 --- a/packages/components/drawer/src/Drawer.doc.mdx +++ b/packages/components/drawer/src/Drawer.doc.mdx @@ -91,9 +91,15 @@ import { Drawer } from '@spark-ui/drawer' -### Sizes +### Side + +Pick a side among `right`, `left`, `top` and `bottom`. + + -Pick a size among `sm`, `md`, `lg`. +### Size + +Pick a size among `sm`, `md`, `lg`, `fluid` and `fullscreen`. @@ -103,15 +109,13 @@ When set to `true`, this option will remove the internal padding of the `Drawer. -### Side +### Sandbox -Pick a side among `right`, `left`, `top` and `bottom`. - - + ## Accessibility -Adheres to the [Drawer WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/drawermodal). +Adheres to the [Dialog WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/). ### Guidelines diff --git a/packages/components/drawer/src/Drawer.stories.tsx b/packages/components/drawer/src/Drawer.stories.tsx index b7eb6887a..3e30d0db3 100644 --- a/packages/components/drawer/src/Drawer.stories.tsx +++ b/packages/components/drawer/src/Drawer.stories.tsx @@ -79,6 +79,7 @@ export const Sizes = () => { Small Medium Large + Fluid Fullscreen @@ -98,16 +99,22 @@ export const Sizes = () => { Please select a drawer size - {Array.from({ length: 10 }, (_, index) => ( -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla - pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui - officia deserunt mollit anim id est laborum. -

- ))} +

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ + {size !== 'fluid' && ( + <> + {Array.from({ length: 5 }, (_, index) => ( +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor + incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis + nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore + eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt + in culpa qui officia deserunt mollit anim id est laborum. +

+ ))} + + )}
@@ -177,6 +184,7 @@ export const Side = () => { Top Bottom + @@ -219,3 +227,84 @@ export const Side = () => { ) } + +export const Sandbox = () => { + const [size, setSize] = useState['size']>('md') + const [side, setSide] = useState['side']>('right') + const [open, setOpen] = useState(false) + + return ( +
+ setSide(value as ExcludeNull['side'])} + > + Right + Left + Top + Bottom + + + setSize(value as ExcludeNull['size'])} + > + Small + Medium + Large + Fluid + Fullscreen + + + + + + + + + + + + + Edit size + + + + Please select a drawer size + +

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ + {size !== 'fluid' && ( + <> + {Array.from({ length: 5 }, (_, index) => ( +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor + incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis + nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore + eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt + in culpa qui officia deserunt mollit anim id est laborum. +

+ ))} + + )} +
+ + + + + + + +
+
+
+
+ ) +} diff --git a/packages/components/drawer/src/DrawerContent.styles.tsx b/packages/components/drawer/src/DrawerContent.styles.tsx index 5844f9438..b26cf0812 100644 --- a/packages/components/drawer/src/DrawerContent.styles.tsx +++ b/packages/components/drawer/src/DrawerContent.styles.tsx @@ -11,6 +11,7 @@ export const drawerContentStyles = cva( sm: '', md: '', lg: '', + fluid: '', fullscreen: 'h-screen w-screen', }, side: { @@ -54,6 +55,11 @@ export const drawerContentStyles = cva( size: 'lg', class: ['w-sz-864', 'max-w-full'], }, + { + side: ['left', 'right'], + size: 'fluid', + class: ['w-auto', 'max-w-full'], + }, { side: ['top', 'bottom'], size: 'sm', @@ -69,6 +75,11 @@ export const drawerContentStyles = cva( size: 'lg', class: ['h-sz-864', 'max-h-full'], }, + { + side: ['top', 'bottom'], + size: 'fluid', + class: ['h-auto', 'max-h-full'], + }, ], defaultVariants: { side: 'right',