@pickle-ui/react 1.0.0-beta.10 → 1.0.0-beta.12

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 CHANGED
@@ -81,42 +81,43 @@ import { Form } from '@pickle-ui/react/form';
81
81
  Subpaths use the same named exports as the root entry (for example `Button` from
82
82
  `@pickle-ui/react/button`, not a default export).
83
83
 
84
- | Subpath | Exports |
85
- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
86
- | `@pickle-ui/react/alert` | `Alert` with `Icon`, `Title`, `Description`, `Action` |
87
- | `@pickle-ui/react/alert-dialog` | `AlertDialog` with `Trigger`, `Content`, `Header`, `Title`, `Description`, `Footer`, `Close` |
88
- | `@pickle-ui/react/avatar` | `Avatar` with `Image`, `Fallback`, `Group` |
89
- | `@pickle-ui/react/badge` | `Badge`, `badgeVariants` |
90
- | `@pickle-ui/react/button` | `Button`, `buttonVariants` |
91
- | `@pickle-ui/react/card` | `Card` with `Header`, `Title`, `Description`, `Action`, `Content`, `Footer` |
92
- | `@pickle-ui/react/checkbox` | `Checkbox` with `Label` |
93
- | `@pickle-ui/react/color-picker` | `ColorPicker` with `Trigger`, `Content`, `Area`, `HueSlider`, `AlphaSlider`, `Swatch`, `Input`, … |
94
- | `@pickle-ui/react/combobox` | `Combobox` with `Input`, `Content`, `List`, `Item`, `Chips`, … |
95
- | `@pickle-ui/react/dialog` | `Dialog` with `Trigger`, `Content`, `Header`, `Title`, `Description`, `Footer`, `Close` |
96
- | `@pickle-ui/react/flex`, `@pickle-ui/react/grid` | `Flex`, `Grid` layout primitives |
97
- | `@pickle-ui/react/x-stack`, `@pickle-ui/react/y-stack` | `XStack`, `YStack` row and column shorthands |
98
- | `@pickle-ui/react/form` | `Form` with `Field`, `Label`, `Description`, `Error`, `Button` and every React Hook Form-bound control |
99
- | `@pickle-ui/react/group` | `Group` with `Separator`, `Text`, for attached button and input groups |
100
- | `@pickle-ui/react/input` | `Input` |
101
- | `@pickle-ui/react/input-group` | `InputGroup` with `Input`, `Addon`, `Button`, `Text` |
102
- | `@pickle-ui/react/menu` | `Menu` with `Trigger`, `Content`, `Item`, `CheckboxItem`, `RadioGroup`, `Sub`, `Shortcut`, … |
103
- | `@pickle-ui/react/popover` | `Popover` with `Trigger`, `Content`, `Header`, `Title`, `Description`, `Anchor` |
104
- | `@pickle-ui/react/progress` | `Progress` with `Label`, `Value`, `Track`, `Indicator` |
105
- | `@pickle-ui/react/radio-group` | `RadioGroup` with `Item` |
106
- | `@pickle-ui/react/scroll-area` | `ScrollArea` with `Viewport`, `Scrollbar`, `Thumb`, `Corner` |
107
- | `@pickle-ui/react/select` | `Select` with `Trigger`, `Value`, `Content`, `Item`, `Group`, … |
108
- | `@pickle-ui/react/separator` | `Separator` |
109
- | `@pickle-ui/react/sidebar` | `Sidebar` with `Header`, `Content`, `Footer`, `Group`, `Menu`, … |
110
- | `@pickle-ui/react/slider` | `Slider` with `Label`, `Value`, `Marks` |
111
- | `@pickle-ui/react/spinner` | `Spinner` |
112
- | `@pickle-ui/react/switch` | `Switch` with `Label` |
113
- | `@pickle-ui/react/table` | `Table` with `Header`, `Body`, `Footer`, `Row`, `Head`, `Cell`, `Caption` |
114
- | `@pickle-ui/react/text` | `Text`, `textVariants` for headings and body copy |
115
- | `@pickle-ui/react/textarea` | `Textarea`, growing with its content |
116
- | `@pickle-ui/react/toast` | `Toast` with `Provider`, `useToast` and the `manager` for toasts outside React |
117
- | `@pickle-ui/react/tooltip` | `Tooltip` with `Trigger`, `Content`, `Provider` |
118
- | `@pickle-ui/react/cn` | `cn` class helper, `SlotClassNames` type |
119
- | `@pickle-ui/react/theme` | `createTheme`, `themeToCss` |
84
+ | Subpath | Exports |
85
+ | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
86
+ | `@pickle-ui/react/alert` | `Alert` with `Icon`, `Title`, `Description`, `Action` |
87
+ | `@pickle-ui/react/alert-dialog` | `AlertDialog` with `Trigger`, `Content`, `Header`, `Title`, `Description`, `Footer`, `Close` |
88
+ | `@pickle-ui/react/avatar` | `Avatar` with `Image`, `Fallback`, `Group` |
89
+ | `@pickle-ui/react/badge` | `Badge`, `badgeVariants` |
90
+ | `@pickle-ui/react/button` | `Button`, `buttonVariants` |
91
+ | `@pickle-ui/react/card` | `Card` with `Header`, `Title`, `Description`, `Action`, `Content`, `Footer` |
92
+ | `@pickle-ui/react/checkbox` | `Checkbox` with `Label` |
93
+ | `@pickle-ui/react/color-picker` | `ColorPicker` with `Trigger`, `Content`, `Area`, `HueSlider`, `AlphaSlider`, `Swatch`, `Input`, … |
94
+ | `@pickle-ui/react/combobox` | `Combobox` with `Input`, `Content`, `List`, `Item`, `Chips`, … |
95
+ | `@pickle-ui/react/dialog` | `Dialog` with `Trigger`, `Content`, `Header`, `Title`, `Description`, `Footer`, `Close` |
96
+ | `@pickle-ui/react/drawer` | `Drawer`, sliding in from the right, with `Trigger`, `Content`, `Header`, `Title`, `Description`, `Panel`, `Footer`, `Close` |
97
+ | `@pickle-ui/react/flex`, `@pickle-ui/react/grid` | `Flex`, `Grid` layout primitives |
98
+ | `@pickle-ui/react/x-stack`, `@pickle-ui/react/y-stack` | `XStack`, `YStack` row and column shorthands |
99
+ | `@pickle-ui/react/form` | `Form` with `Field`, `Label`, `Description`, `Error`, `Button` and every React Hook Form-bound control |
100
+ | `@pickle-ui/react/group` | `Group` with `Separator`, `Text`, for attached button and input groups |
101
+ | `@pickle-ui/react/input` | `Input` |
102
+ | `@pickle-ui/react/input-group` | `InputGroup` with `Input`, `Addon`, `Button`, `Text` |
103
+ | `@pickle-ui/react/menu` | `Menu` with `Trigger`, `Content`, `Item`, `CheckboxItem`, `RadioGroup`, `Sub`, `Shortcut`, … |
104
+ | `@pickle-ui/react/popover` | `Popover` with `Trigger`, `Content`, `Header`, `Title`, `Description`, `Anchor` |
105
+ | `@pickle-ui/react/progress` | `Progress` with `Label`, `Value`, `Track`, `Indicator` |
106
+ | `@pickle-ui/react/radio-group` | `RadioGroup` with `Item` |
107
+ | `@pickle-ui/react/scroll-area` | `ScrollArea` with `Viewport`, `Scrollbar`, `Thumb`, `Corner` |
108
+ | `@pickle-ui/react/select` | `Select` with `Trigger`, `Value`, `Content`, `Item`, `Group`, … |
109
+ | `@pickle-ui/react/separator` | `Separator` |
110
+ | `@pickle-ui/react/sidebar` | `Sidebar` with `Header`, `Content`, `Footer`, `Group`, `Menu`, … |
111
+ | `@pickle-ui/react/slider` | `Slider` with `Label`, `Value`, `Marks` |
112
+ | `@pickle-ui/react/spinner` | `Spinner` |
113
+ | `@pickle-ui/react/switch` | `Switch` with `Label` |
114
+ | `@pickle-ui/react/table` | `Table` with `Header`, `Body`, `Footer`, `Row`, `Head`, `Cell`, `Caption` |
115
+ | `@pickle-ui/react/text` | `Text`, `textVariants` for headings and body copy |
116
+ | `@pickle-ui/react/textarea` | `Textarea`, growing with its content |
117
+ | `@pickle-ui/react/toast` | `Toast` with `Provider`, `useToast` and the `manager` for toasts outside React |
118
+ | `@pickle-ui/react/tooltip` | `Tooltip` with `Trigger`, `Content`, `Provider` |
119
+ | `@pickle-ui/react/cn` | `cn` class helper, `SlotClassNames` type |
120
+ | `@pickle-ui/react/theme` | `createTheme`, `themeToCss` |
120
121
 
121
122
  Interactive components and their parts take Base UI's `render` prop to swap
122
123
  the element they render, for example
@@ -407,6 +408,7 @@ attribute sits on the slot listed here:
407
408
  | `Alert`, `Menu.Item` | `alert`, `menu-item` | `data-variant` |
408
409
  | `Text` | `text` | `data-variant`, plus `data-tone`, `data-weight` and `data-truncate` when set |
409
410
  | `Dialog.Content`, `AlertDialog.Content` | `dialog-content`, `alert-dialog-content` | `data-size` |
411
+ | `Drawer.Content` | `drawer-content` | `data-size`, `data-variant` |
410
412
  | `Input`, `Textarea` | `input-control`, `textarea-control` (wrappers) | `data-size` |
411
413
  | `Checkbox` | `checkbox` | `data-size` |
412
414
  | `RadioGroup.Item` | `radio` | `data-size` |
@@ -3,7 +3,7 @@ import { type VariantProps } from 'class-variance-authority';
3
3
  import { type SlotClassNames } from '../lib/utils.js';
4
4
  declare const buttonVariants: (props?: ({
5
5
  size?: "md" | "lg" | "sm" | "icon" | "icon-lg" | "icon-sm" | "icon-xl" | "icon-xs" | "xl" | "xs" | null | undefined;
6
- variant?: "destructive" | "link" | "default" | "outline" | "secondary" | "destructive-outline" | "ghost" | null | undefined;
6
+ variant?: "destructive" | "link" | "default" | "outline" | "secondary" | "ghost" | "ghost-destructive" | "outline-destructive" | "secondary-destructive" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  export interface ButtonProps extends useRender.ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
9
9
  classNames?: SlotClassNames<'loadingIndicator'>;
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAM,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAGvD,QAAA,MAAM,cAAc;;;8EAsCnB,CAAC;AAEF,MAAM,WAAW,WACf,SACE,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,EAClC,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,UAAU,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,iBAAS,MAAM,CAAC,EACd,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,EACR,OAAe,EACf,GAAG,EACH,MAAM,EACN,IAAW,EACX,IAAI,EACJ,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,WAAW,8FAqCb;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAM,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAGvD,QAAA,MAAM,cAAc;;;8EA0CnB,CAAC;AAEF,MAAM,WAAW,WACf,SACE,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,EAClC,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,UAAU,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,iBAAS,MAAM,CAAC,EACd,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,EACR,OAAe,EACf,GAAG,EACH,MAAM,EACN,IAAW,EACX,IAAI,EACJ,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,WAAW,8FAqCb;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
@@ -26,11 +26,13 @@ const buttonVariants = cva("relative inline-flex shrink-0 cursor-pointer items-c
26
26
  variant: {
27
27
  default: 'not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 data-pressed:bg-primary/90 *:data-[slot=button-loading-indicator]:text-primary-foreground [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none',
28
28
  destructive: 'not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-destructive-foreground shadow-destructive/24 shadow-xs hover:bg-destructive/90 data-pressed:bg-destructive/90 *:data-[slot=button-loading-indicator]:text-destructive-foreground [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none',
29
- 'destructive-outline': 'border-input bg-popover not-dark:bg-clip-padding text-destructive-subtle-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:border-destructive/32 hover:bg-destructive/4 data-pressed:border-destructive/32 data-pressed:bg-destructive/4 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none',
30
29
  ghost: 'border-transparent text-foreground hover:bg-accent data-pressed:bg-accent *:data-[slot=button-loading-indicator]:text-foreground',
30
+ 'ghost-destructive': 'border-transparent text-destructive-subtle-foreground hover:bg-accent data-pressed:bg-accent *:data-[slot=button-loading-indicator]:text-destructive-subtle-foreground',
31
31
  link: 'border-transparent text-foreground underline-offset-4 hover:underline data-pressed:underline *:data-[slot=button-loading-indicator]:text-foreground',
32
32
  outline: 'border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:bg-accent/50 data-pressed:bg-accent/50 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:data-pressed:bg-input/64 dark:hover:bg-input/64 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none',
33
+ 'outline-destructive': 'border-input bg-popover not-dark:bg-clip-padding text-destructive-subtle-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:border-destructive/32 hover:bg-destructive/4 data-pressed:border-destructive/32 data-pressed:bg-destructive/4 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none',
33
34
  secondary: 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 data-pressed:bg-secondary/90 *:data-[slot=button-loading-indicator]:text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80',
35
+ 'secondary-destructive': 'border-transparent bg-destructive-subtle text-destructive-subtle-foreground hover:bg-destructive-subtle/90 data-pressed:bg-destructive-subtle/90 *:data-[slot=button-loading-indicator]:text-destructive-subtle-foreground [:active,[data-pressed]]:bg-destructive-subtle/80',
34
36
  },
35
37
  },
36
38
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAuB,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,cAAc,GAAG,GAAG,CACxB,oyBAAoyB,EACpyB;IACE,eAAe,EAAE;QACf,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,SAAS;KACnB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,gDAAgD;YAC3D,SAAS,EACP,qIAAqI;YACvI,EAAE,EAAE,mCAAmC;YACvC,EAAE,EAAE,iCAAiC;YACrC,EAAE,EAAE,2CAA2C;YAC/C,EAAE,EAAE,8FAA8F;YAClG,EAAE,EAAE,wJAAwJ;SAC7J;QACD,OAAO,EAAE;YACP,OAAO,EACL,iXAAiX;YACnX,WAAW,EACT,6YAA6Y;Y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cAAc,EAAE,QAAQ;QACxB,KAAK,EAAE,UAAU,CAAW,YAAY,EAAE,KAAK,CAAC;QAChD,GAAG;QACH,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { Drawer as DrawerPrimitive } from '@base-ui/react/drawer';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ import * as React from 'react';
4
+ declare const drawerPopupVariants: (props?: ({
5
+ size?: "md" | "lg" | "sm" | null | undefined;
6
+ variant?: "inset" | "attached" | "straight" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ type DrawerCloseProps = React.ComponentProps<typeof DrawerPrimitive.Close>;
9
+ type DrawerContentProps = React.ComponentProps<typeof DrawerPrimitive.Popup> & {
10
+ /** Accessible name of the close icon button. Defaults to `"Close"`. */
11
+ closeLabel?: string;
12
+ /**
13
+ * Renders a close icon button in the top-right corner. Defaults to `false`.
14
+ */
15
+ showCloseButton?: boolean;
16
+ /** Maximum width of the drawer. Defaults to `md`. */
17
+ size?: DrawerSize;
18
+ /**
19
+ * `inset` floats the drawer away from the viewport's edges, `attached`
20
+ * docks it to the right edge with rounded inner corners, and `straight`
21
+ * docks it without rounding. Defaults to `inset`.
22
+ */
23
+ variant?: DrawerVariant;
24
+ };
25
+ type DrawerDescriptionProps = React.ComponentProps<typeof DrawerPrimitive.Description>;
26
+ type DrawerFooterProps = React.ComponentProps<'div'>;
27
+ type DrawerHeaderProps = React.ComponentProps<'div'>;
28
+ type DrawerPanelProps = React.ComponentProps<typeof DrawerPrimitive.Content>;
29
+ type DrawerProps = Omit<React.ComponentProps<typeof DrawerPrimitive.Root>, 'defaultSnapPoint' | 'onSnapPointChange' | 'snapPoint' | 'snapPoints' | 'snapToSequentialPoints' | 'swipeDirection'>;
30
+ type DrawerSize = NonNullable<VariantProps<typeof drawerPopupVariants>['size']>;
31
+ type DrawerTitleProps = React.ComponentProps<typeof DrawerPrimitive.Title>;
32
+ type DrawerTriggerProps = React.ComponentProps<typeof DrawerPrimitive.Trigger>;
33
+ type DrawerVariant = NonNullable<VariantProps<typeof drawerPopupVariants>['variant']>;
34
+ declare function DrawerClose({ ...props }: DrawerCloseProps): React.JSX.Element;
35
+ declare function DrawerContent({ children, className, closeLabel, showCloseButton, size, variant, ...props }: DrawerContentProps): React.JSX.Element;
36
+ declare function DrawerDescription({ className, ...props }: DrawerDescriptionProps): React.JSX.Element;
37
+ declare function DrawerFooter({ className, ...props }: DrawerFooterProps): React.JSX.Element;
38
+ declare function DrawerHeader({ className, ...props }: DrawerHeaderProps): React.JSX.Element;
39
+ /**
40
+ * The scrolling body between the header and the footer. Mouse drags in it
41
+ * select text instead of moving the drawer.
42
+ */
43
+ declare function DrawerPanel({ className, ...props }: DrawerPanelProps): React.JSX.Element;
44
+ declare function DrawerRoot(props: DrawerProps): React.JSX.Element;
45
+ declare function DrawerTitle({ className, ...props }: DrawerTitleProps): React.JSX.Element;
46
+ declare function DrawerTrigger({ ...props }: DrawerTriggerProps): React.JSX.Element;
47
+ declare const Drawer: typeof DrawerRoot & {
48
+ Close: typeof DrawerClose;
49
+ Content: typeof DrawerContent;
50
+ Description: typeof DrawerDescription;
51
+ Footer: typeof DrawerFooter;
52
+ Header: typeof DrawerHeader;
53
+ Panel: typeof DrawerPanel;
54
+ Title: typeof DrawerTitle;
55
+ Trigger: typeof DrawerTrigger;
56
+ };
57
+ export { Drawer };
58
+ export type { DrawerCloseProps, DrawerContentProps, DrawerDescriptionProps, DrawerFooterProps, DrawerHeaderProps, DrawerPanelProps, DrawerProps, DrawerTitleProps, DrawerTriggerProps, };
59
+ //# sourceMappingURL=Drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../src/components/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEl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
+ import { Drawer as DrawerPrimitive } from '@base-ui/react/drawer';
3
+ import { IconX } from '@tabler/icons-react';
4
+ import { cva } from 'class-variance-authority';
5
+ import { cn } from '../lib/utils.js';
6
+ import { dialogDescriptionClassName, dialogFooterClassName, dialogTitleClassName, } from './_internal/dialog-styles.js';
7
+ import { Button } from './Button.js';
8
+ // iOS sheet curve, as in coss ui's Drawer. Moves use `transform`, which Base
9
+ // UI's inline drag offset replaces, where `translate-*` would add to it.
10
+ const drawerMotion = 'duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none';
11
+ const drawerBackdropClassName = cn('fixed inset-0 z-50 bg-black/32 opacity-[calc(1-var(--drawer-swipe-progress,0))] backdrop-blur-sm transition-opacity data-ending-style:opacity-0 data-starting-style:opacity-0 data-swiping:duration-0', drawerMotion);
12
+ const drawerViewportClassName = 'fixed inset-0 z-50 flex';
13
+ // Fills the gap past the screen edge when a drag pulls a docked drawer inwards.
14
+ const drawerEdgeFillClassName = 'after:bg-popover after:pointer-events-none after:absolute after:inset-y-0 after:left-full after:w-12';
15
+ const drawerPopupVariants = cva(cn('bg-popover text-popover-foreground relative ml-auto flex w-[calc(100%-3rem)] min-w-0 flex-col shadow-lg/5 outline-none not-dark:bg-clip-padding', 'transition-transform data-ending-style:duration-[calc(var(--drawer-swipe-strength,1)*400ms)] data-swiping:select-none', drawerMotion, '[transform:translateX(var(--drawer-swipe-movement-x,0px))] data-ending-style:[transform:translateX(calc(100%+var(--inset,0px)))] data-starting-style:[transform:translateX(calc(100%+var(--inset,0px)))]'), {
16
+ defaultVariants: {
17
+ size: 'md',
18
+ variant: 'inset',
19
+ },
20
+ variants: {
21
+ size: {
22
+ lg: 'max-w-xl',
23
+ md: 'max-w-md',
24
+ sm: 'max-w-sm',
25
+ },
26
+ variant: {
27
+ // Physical sides throughout: the drawer slides in from the right
28
+ // whatever the text direction.
29
+ attached: cn(drawerEdgeFillClassName, 'rounded-l-2xl border-l **:data-[slot=drawer-footer]:rounded-bl-[calc(var(--radius-2xl)-1px)]'),
30
+ // Floats inside the viewport, `--inset` away from its edges.
31
+ inset: 'my-(--inset) mr-(--inset) rounded-2xl border [--inset:--spacing(2)] sm:[--inset:--spacing(4)] **:data-[slot=drawer-footer]:rounded-b-[calc(var(--radius-2xl)-1px)]',
32
+ straight: cn(drawerEdgeFillClassName, 'border-l'),
33
+ },
34
+ },
35
+ });
36
+ function DrawerClose({ ...props }) {
37
+ return _jsx(DrawerPrimitive.Close, { "data-slot": "drawer-close", ...props });
38
+ }
39
+ function DrawerContent({ children, className, closeLabel = 'Close', showCloseButton = false, size = 'md', variant = 'inset', ...props }) {
40
+ return (_jsxs(DrawerPrimitive.Portal, { children: [_jsx(DrawerPrimitive.Backdrop, { className: drawerBackdropClassName, "data-slot": "drawer-backdrop" }), _jsx(DrawerPrimitive.Viewport, { className: drawerViewportClassName, children: _jsxs(DrawerPrimitive.Popup, { className: cn(drawerPopupVariants({ size, variant }),
41
+ // Keeps the title clear of the close button.
42
+ showCloseButton && '**:data-[slot=drawer-header]:pr-12', className), "data-size": size, "data-slot": "drawer-content", "data-variant": variant, ...props, children: [children, showCloseButton ? (_jsx(DrawerPrimitive.Close, { "aria-label": closeLabel, className: "absolute top-3 right-3", "data-slot": "drawer-close", render: _jsx(Button, { size: "icon-sm", variant: "ghost" }), children: _jsx(IconX, {}) })) : null] }) })] }));
43
+ }
44
+ function DrawerDescription({ className, ...props }) {
45
+ return (_jsx(DrawerPrimitive.Description, { className: cn(dialogDescriptionClassName, className), "data-slot": "drawer-description", ...props }));
46
+ }
47
+ function DrawerFooter({ className, ...props }) {
48
+ return (_jsx("div", { className: cn(dialogFooterClassName, 'bg-muted/72 mt-auto border-t px-6 py-4', className), "data-slot": "drawer-footer", ...props }));
49
+ }
50
+ function DrawerHeader({ className, ...props }) {
51
+ return (_jsx("div", { className: cn('flex flex-col gap-1.5 p-6', className), "data-slot": "drawer-header", ...props }));
52
+ }
53
+ /**
54
+ * The scrolling body between the header and the footer. Mouse drags in it
55
+ * select text instead of moving the drawer.
56
+ */
57
+ function DrawerPanel({ className, ...props }) {
58
+ return (_jsx(DrawerPrimitive.Content, { className: cn(
59
+ // Pulled 4px into the header's padding and padded back, so the 3px focus
60
+ // ring of a field at its top isn't clipped by the scroll container.
61
+ '-mt-1 min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 pt-1 pb-6 first:mt-0 first:pt-6', className), "data-slot": "drawer-panel", ...props }));
62
+ }
63
+ function DrawerRoot(props) {
64
+ return _jsx(DrawerPrimitive.Root, { swipeDirection: "right", ...props });
65
+ }
66
+ function DrawerTitle({ className, ...props }) {
67
+ return (_jsx(DrawerPrimitive.Title, { className: cn(dialogTitleClassName, className), "data-slot": "drawer-title", ...props }));
68
+ }
69
+ function DrawerTrigger({ ...props }) {
70
+ return _jsx(DrawerPrimitive.Trigger, { "data-slot": "drawer-trigger", ...props });
71
+ }
72
+ const Drawer = Object.assign(DrawerRoot, {
73
+ Close: DrawerClose,
74
+ Content: DrawerContent,
75
+ Description: DrawerDescription,
76
+ Footer: DrawerFooter,
77
+ Header: DrawerHeader,
78
+ Panel: DrawerPanel,
79
+ Title: DrawerTitle,
80
+ Trigger: DrawerTrigger,
81
+ });
82
+ export { Drawer };
83
+ //# sourceMappingURL=Drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../src/components/Drawer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAA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,eAAe,CAAC,OAAO,IACtB,SAAS,EAAE,EAAE;QACX,yEAAyE;QACzE,oEAAoE;QACpE,8FAA8F,EAC9F,SAAS,CACV,eACS,cAAc,KACpB,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAAkB;IACpC,OAAO,KAAC,eAAe,CAAC,IAAI,IAAC,cAAc,EAAC,OAAO,KAAK,KAAK,GAAI,CAAC;AACpE,CAAC;AAED,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoB;IAC5D,OAAO,CACL,KAAC,eAAe,CAAC,KAAK,IACpB,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,SAAS,CAAC,eACpC,cAAc,KACpB,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,EAAE,GAAG,KAAK,EAAsB;IACrD,OAAO,KAAC,eAAe,CAAC,OAAO,iBAAW,gBAAgB,KAAK,KAAK,GAAI,CAAC;AAC3E,CAAC;AAED,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;IACvC,KAAK,EAAE,WAAW;IAClB,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,iBAAiB;IAC9B,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,WAAW;IAClB,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Field } from '@base-ui/react/field';
4
4
  import { cn } from '../../lib/utils.js';
5
5
  function FormLabel({ className, ...props }) {
6
- return (_jsx(Field.Label, { className: cn('text-sm leading-none font-medium data-disabled:cursor-not-allowed data-disabled:opacity-50', className), "data-slot": "field-label", ...props }));
6
+ return (_jsx(Field.Label, { className: cn('text-sm font-medium data-disabled:cursor-not-allowed data-disabled:opacity-50', className), "data-slot": "field-label", ...props }));
7
7
  }
8
8
  export { FormLabel };
9
9
  //# sourceMappingURL=FormLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormLabel.js","sourceRoot":"","sources":["../../../src/components/form/FormLabel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAIrC,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAkB;IACxD,OAAO,CACL,KAAC,KAAK,CAAC,KAAK,IACV,SAAS,EAAE,EAAE,CACX,4FAA4F,EAC5F,SAAS,CACV,eACS,aAAa,KACnB,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"FormLabel.js","sourceRoot":"","sources":["../../../src/components/form/FormLabel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAIrC,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAkB;IACxD,OAAO,CACL,KAAC,KAAK,CAAC,KAAK,IACV,SAAS,EAAE,EAAE,CACX,+EAA+E,EAC/E,SAAS,CACV,eACS,aAAa,KACnB,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Drawer } from '../components/Drawer.js';
2
+ export type { DrawerCloseProps, DrawerContentProps, DrawerDescriptionProps, DrawerFooterProps, DrawerHeaderProps, DrawerPanelProps, DrawerProps, DrawerTitleProps, DrawerTriggerProps, } from '../components/Drawer.js';
3
+ //# sourceMappingURL=drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/entries/drawer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Drawer } from '../components/Drawer.js';
2
+ //# sourceMappingURL=drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/entries/drawer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './entries/cn.js';
9
9
  export * from './entries/color-picker.js';
10
10
  export * from './entries/combobox.js';
11
11
  export * from './entries/dialog.js';
12
+ export * from './entries/drawer.js';
12
13
  export * from './entries/flex.js';
13
14
  export * from './entries/form.js';
14
15
  export * from './entries/grid.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,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BAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ export * from './entries/cn.js';
11
11
  export * from './entries/color-picker.js';
12
12
  export * from './entries/combobox.js';
13
13
  export * from './entries/dialog.js';
14
+ export * from './entries/drawer.js';
14
15
  export * from './entries/flex.js';
15
16
  export * from './entries/form.js';
16
17
  export * from './entries/grid.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,c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ClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickle-ui/react",
3
- "version": "1.0.0-beta.10",
3
+ "version": "1.0.0-beta.12",
4
4
  "type": "module",
5
5
  "description": "React component library built with Base UI, shadcn/ui, Tailwind CSS, and reui.",
6
6
  "main": "dist/index.js",
@@ -130,7 +130,7 @@ function AlertDialogMatrixCell({ column, row }: ComponentMatrixCellProps) {
130
130
  <AlertDialog>
131
131
  <AlertDialog.Trigger
132
132
  render={
133
- <Button variant={destructive ? 'destructive-outline' : 'outline'} />
133
+ <Button variant={destructive ? 'outline-destructive' : 'outline'} />
134
134
  }
135
135
  >
136
136
  {content.trigger}
@@ -44,10 +44,12 @@ const VARIANT_ROWS: {
44
44
  }[] = [
45
45
  { key: 'default', label: 'Default' },
46
46
  { key: 'secondary', label: 'Secondary' },
47
+ { key: 'secondary-destructive', label: 'Secondary destructive' },
47
48
  { key: 'destructive', label: 'Destructive' },
48
- { key: 'destructive-outline', label: 'Destructive outline' },
49
49
  { key: 'outline', label: 'Outline' },
50
+ { key: 'outline-destructive', label: 'Outline destructive' },
50
51
  { key: 'ghost', label: 'Ghost' },
52
+ { key: 'ghost-destructive', label: 'Ghost destructive' },
51
53
  { key: 'link', label: 'Link' },
52
54
  ];
53
55
 
@@ -33,15 +33,19 @@ const buttonVariants = cva(
33
33
  'not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 data-pressed:bg-primary/90 *:data-[slot=button-loading-indicator]:text-primary-foreground [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none',
34
34
  destructive:
35
35
  'not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-destructive-foreground shadow-destructive/24 shadow-xs hover:bg-destructive/90 data-pressed:bg-destructive/90 *:data-[slot=button-loading-indicator]:text-destructive-foreground [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none',
36
- 'destructive-outline':
37
- 'border-input bg-popover not-dark:bg-clip-padding text-destructive-subtle-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:border-destructive/32 hover:bg-destructive/4 data-pressed:border-destructive/32 data-pressed:bg-destructive/4 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none',
38
36
  ghost:
39
37
  'border-transparent text-foreground hover:bg-accent data-pressed:bg-accent *:data-[slot=button-loading-indicator]:text-foreground',
38
+ 'ghost-destructive':
39
+ 'border-transparent text-destructive-subtle-foreground hover:bg-accent data-pressed:bg-accent *:data-[slot=button-loading-indicator]:text-destructive-subtle-foreground',
40
40
  link: 'border-transparent text-foreground underline-offset-4 hover:underline data-pressed:underline *:data-[slot=button-loading-indicator]:text-foreground',
41
41
  outline:
42
42
  'border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:bg-accent/50 data-pressed:bg-accent/50 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:data-pressed:bg-input/64 dark:hover:bg-input/64 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none',
43
+ 'outline-destructive':
44
+ 'border-input bg-popover not-dark:bg-clip-padding text-destructive-subtle-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:border-destructive/32 hover:bg-destructive/4 data-pressed:border-destructive/32 data-pressed:bg-destructive/4 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none',
43
45
  secondary:
44
46
  'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 data-pressed:bg-secondary/90 *:data-[slot=button-loading-indicator]:text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80',
47
+ 'secondary-destructive':
48
+ 'border-transparent bg-destructive-subtle text-destructive-subtle-foreground hover:bg-destructive-subtle/90 data-pressed:bg-destructive-subtle/90 *:data-[slot=button-loading-indicator]:text-destructive-subtle-foreground [:active,[data-pressed]]:bg-destructive-subtle/80',
45
49
  },
46
50
  },
47
51
  },
@@ -0,0 +1,240 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { zodResolver } from '@hookform/resolvers/zod';
4
+ import * as React from 'react';
5
+ import { useForm } from 'react-hook-form';
6
+ import { z } from 'zod/v4';
7
+
8
+ import { type ComponentMatrixCellProps, Story } from './_internal/Story';
9
+ import { Button } from './Button';
10
+ import { Drawer, type DrawerContentProps } from './Drawer';
11
+ import { Form } from './form/Form';
12
+ import { Input } from './form/Input';
13
+ import { Text } from './Text';
14
+
15
+ const meta = {
16
+ component: Drawer,
17
+ parameters: {
18
+ layout: 'fullscreen',
19
+ },
20
+ title: 'components/Drawer',
21
+ } satisfies Meta<typeof Drawer>;
22
+
23
+ export default meta;
24
+ type ExampleContent = 'close-button' | 'form' | 'list';
25
+
26
+ type StoryDefinition = StoryObj<typeof meta>;
27
+
28
+ const VARIANT_ROWS: {
29
+ description: string;
30
+ key: NonNullable<DrawerContentProps['variant']>;
31
+ label: string;
32
+ }[] = [
33
+ {
34
+ description: 'Floats away from the viewport edges',
35
+ key: 'inset',
36
+ label: 'Inset (default)',
37
+ },
38
+ {
39
+ description: 'Docked to the right edge, rounded inside',
40
+ key: 'attached',
41
+ label: 'Attached',
42
+ },
43
+ {
44
+ description: 'Docked to the right edge, square',
45
+ key: 'straight',
46
+ label: 'Straight',
47
+ },
48
+ ];
49
+
50
+ const CONTENT_COLUMNS: {
51
+ description: string;
52
+ key: ExampleContent;
53
+ label: string;
54
+ }[] = [
55
+ { description: 'Header, panel and footer', key: 'form', label: 'Form' },
56
+ {
57
+ description: 'The panel scrolls between header and footer',
58
+ key: 'list',
59
+ label: 'Long content',
60
+ },
61
+ {
62
+ description: 'showCloseButton, no footer',
63
+ key: 'close-button',
64
+ label: 'With close button',
65
+ },
66
+ ];
67
+
68
+ const SIZE_COLUMNS: {
69
+ description: string;
70
+ key: NonNullable<DrawerContentProps['size']>;
71
+ label: string;
72
+ }[] = [
73
+ { description: 'max-w-sm', key: 'sm', label: 'Small' },
74
+ { description: 'max-w-md', key: 'md', label: 'Medium (default)' },
75
+ { description: 'max-w-xl', key: 'lg', label: 'Large' },
76
+ ];
77
+
78
+ const profileSchema = z.object({
79
+ name: z.string().trim().min(1, 'Enter your name.'),
80
+ username: z.string().trim().min(2, 'Use at least 2 characters.'),
81
+ });
82
+
83
+ const ACTIVITY = Array.from({ length: 24 }, (_, index) => ({
84
+ id: index,
85
+ label: `Deployment #${240 - index}`,
86
+ }));
87
+
88
+ function DrawerExample({
89
+ content,
90
+ size,
91
+ trigger,
92
+ variant,
93
+ }: {
94
+ content: ExampleContent;
95
+ size?: DrawerContentProps['size'];
96
+ trigger: string;
97
+ variant?: DrawerContentProps['variant'];
98
+ }) {
99
+ const [open, setOpen] = React.useState(false);
100
+
101
+ return (
102
+ <Drawer onOpenChange={setOpen} open={open}>
103
+ <Drawer.Trigger render={<Button variant="outline" />}>
104
+ {trigger}
105
+ </Drawer.Trigger>
106
+ <Drawer.Content
107
+ showCloseButton={content === 'close-button'}
108
+ size={size}
109
+ variant={variant}
110
+ >
111
+ {content === 'form' ? (
112
+ <ProfileForm onSaved={() => setOpen(false)} />
113
+ ) : null}
114
+ {content === 'list' ? (
115
+ <>
116
+ <Drawer.Header>
117
+ <Drawer.Title>Activity</Drawer.Title>
118
+ <Drawer.Description>The last 24 deployments.</Drawer.Description>
119
+ </Drawer.Header>
120
+ <Drawer.Panel className="grid content-start gap-2">
121
+ {ACTIVITY.map(({ id, label }) => (
122
+ <div className="rounded-lg border px-3 py-2" key={id}>
123
+ <Text variant="body">{label}</Text>
124
+ </div>
125
+ ))}
126
+ </Drawer.Panel>
127
+ <Drawer.Footer>
128
+ <Drawer.Close render={<Button variant="outline" />}>
129
+ Close
130
+ </Drawer.Close>
131
+ </Drawer.Footer>
132
+ </>
133
+ ) : null}
134
+ {content === 'close-button' ? (
135
+ <>
136
+ <Drawer.Header>
137
+ <Drawer.Title>Share link</Drawer.Title>
138
+ <Drawer.Description>
139
+ Anyone with the link can view this project. Press Escape or
140
+ click outside to close.
141
+ </Drawer.Description>
142
+ </Drawer.Header>
143
+ <Drawer.Panel>
144
+ <Input readOnly value="https://pickle-ui.dev/p/8f2a" />
145
+ </Drawer.Panel>
146
+ </>
147
+ ) : null}
148
+ </Drawer.Content>
149
+ </Drawer>
150
+ );
151
+ }
152
+
153
+ /**
154
+ * A `Form` around the header, panel and footer, so `Form.Button` in the footer
155
+ * submits it. `contents` (and no `space-y`) keeps the three parts laid out
156
+ * by the drawer.
157
+ */
158
+ function ProfileForm({ onSaved }: { onSaved: () => void }) {
159
+ const form = useForm<z.infer<typeof profileSchema>>({
160
+ defaultValues: { name: 'Ada Lovelace', username: 'ada' },
161
+ resolver: zodResolver(profileSchema),
162
+ });
163
+
164
+ return (
165
+ <Form className="contents space-y-0" form={form} onSubmit={onSaved}>
166
+ <Drawer.Header>
167
+ <Drawer.Title>Edit profile</Drawer.Title>
168
+ <Drawer.Description>
169
+ Make changes to your profile, then save when you are done.
170
+ </Drawer.Description>
171
+ </Drawer.Header>
172
+ <Drawer.Panel className="space-y-6">
173
+ <Form.Field label="Name" name="name">
174
+ <Form.Input autoComplete="name" />
175
+ </Form.Field>
176
+ <Form.Field
177
+ description="Shown on your public profile."
178
+ label="Username"
179
+ name="username"
180
+ >
181
+ <Form.Input autoComplete="username" />
182
+ </Form.Field>
183
+ </Drawer.Panel>
184
+ <Drawer.Footer>
185
+ <Drawer.Close render={<Button variant="outline" />}>
186
+ Cancel
187
+ </Drawer.Close>
188
+ <Form.Button type="submit">Save changes</Form.Button>
189
+ </Drawer.Footer>
190
+ </Form>
191
+ );
192
+ }
193
+
194
+ function SizeCell({ column }: ComponentMatrixCellProps) {
195
+ return (
196
+ <DrawerExample
197
+ content="form"
198
+ size={column.key as DrawerContentProps['size']}
199
+ trigger="Open"
200
+ />
201
+ );
202
+ }
203
+
204
+ function VariantCell({ column, row }: ComponentMatrixCellProps) {
205
+ return (
206
+ <DrawerExample
207
+ content={column.key as ExampleContent}
208
+ trigger="Open"
209
+ variant={row.key as DrawerContentProps['variant']}
210
+ />
211
+ );
212
+ }
213
+
214
+ export const All: StoryDefinition = {
215
+ render: () => (
216
+ <Story.Layout className="max-w-5xl" title="Drawer">
217
+ <Story.Section title="Variants">
218
+ <Story.Matrix
219
+ Cell={VariantCell}
220
+ columns={CONTENT_COLUMNS}
221
+ rows={VARIANT_ROWS}
222
+ />
223
+ </Story.Section>
224
+
225
+ <Story.Section title="Sizes">
226
+ <Story.Matrix
227
+ Cell={SizeCell}
228
+ columns={SIZE_COLUMNS}
229
+ rows={[
230
+ {
231
+ description: 'Maximum width of the drawer',
232
+ key: 'size',
233
+ label: 'size',
234
+ },
235
+ ]}
236
+ />
237
+ </Story.Section>
238
+ </Story.Layout>
239
+ ),
240
+ };
@@ -0,0 +1,123 @@
1
+ import {
2
+ fireEvent,
3
+ render,
4
+ screen,
5
+ waitFor,
6
+ within,
7
+ } from '@testing-library/react';
8
+ import { describe, expect, it } from 'vitest';
9
+
10
+ import { Drawer, type DrawerContentProps } from './Drawer';
11
+
12
+ async function openDrawer() {
13
+ fireEvent.click(screen.getByRole('button', { name: 'Open cart' }));
14
+ return screen.findByRole('dialog', { name: 'Cart' });
15
+ }
16
+
17
+ function renderDrawer(contentProps?: DrawerContentProps) {
18
+ return render(
19
+ <Drawer>
20
+ <Drawer.Trigger>Open cart</Drawer.Trigger>
21
+ <Drawer.Content {...contentProps}>
22
+ <Drawer.Header>
23
+ <Drawer.Title>Cart</Drawer.Title>
24
+ <Drawer.Description>Review your items.</Drawer.Description>
25
+ </Drawer.Header>
26
+ <Drawer.Panel>Two items</Drawer.Panel>
27
+ <Drawer.Footer>
28
+ <Drawer.Close>Keep shopping</Drawer.Close>
29
+ </Drawer.Footer>
30
+ </Drawer.Content>
31
+ </Drawer>,
32
+ );
33
+ }
34
+
35
+ describe('Drawer', () => {
36
+ it('opens from the trigger with an accessible name and description', async () => {
37
+ renderDrawer();
38
+
39
+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
40
+
41
+ const drawer = await openDrawer();
42
+
43
+ expect(drawer).toHaveAccessibleDescription('Review your items.');
44
+ expect(drawer).toHaveAttribute('data-slot', 'drawer-content');
45
+ expect(drawer).toHaveAttribute('data-size', 'md');
46
+ expect(drawer).toHaveAttribute('data-variant', 'inset');
47
+ expect(screen.getByRole('heading', { name: 'Cart' })).toHaveAttribute(
48
+ 'data-slot',
49
+ 'drawer-title',
50
+ );
51
+ expect(document.querySelector('[data-slot=drawer-backdrop]')).toBeTruthy();
52
+ });
53
+
54
+ it('slides in from the right', async () => {
55
+ renderDrawer();
56
+
57
+ expect(await openDrawer()).toHaveAttribute('data-swipe-direction', 'right');
58
+ });
59
+
60
+ it('renders the variant it is given', async () => {
61
+ renderDrawer({ variant: 'attached' });
62
+
63
+ expect(await openDrawer()).toHaveAttribute('data-variant', 'attached');
64
+ });
65
+
66
+ it('renders the panel and footer inside the drawer', async () => {
67
+ renderDrawer();
68
+
69
+ const drawer = await openDrawer();
70
+
71
+ expect(within(drawer).getByText('Two items')).toHaveAttribute(
72
+ 'data-slot',
73
+ 'drawer-panel',
74
+ );
75
+ expect(
76
+ drawer.querySelector('[data-slot=drawer-footer]'),
77
+ ).toBeInTheDocument();
78
+ });
79
+
80
+ it('closes from the close button when showCloseButton is set', async () => {
81
+ renderDrawer({ showCloseButton: true });
82
+
83
+ const drawer = await openDrawer();
84
+ fireEvent.click(within(drawer).getByRole('button', { name: 'Close' }));
85
+
86
+ await waitFor(() =>
87
+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument(),
88
+ );
89
+ });
90
+
91
+ it('closes from Drawer.Close', async () => {
92
+ renderDrawer();
93
+
94
+ const drawer = await openDrawer();
95
+ fireEvent.click(
96
+ within(drawer).getByRole('button', { name: 'Keep shopping' }),
97
+ );
98
+
99
+ await waitFor(() =>
100
+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument(),
101
+ );
102
+ });
103
+
104
+ it('names the close button with closeLabel', async () => {
105
+ renderDrawer({ closeLabel: 'Fermer', showCloseButton: true });
106
+
107
+ const drawer = await openDrawer();
108
+
109
+ expect(
110
+ within(drawer).getByRole('button', { name: 'Fermer' }),
111
+ ).toBeInTheDocument();
112
+ });
113
+
114
+ it('has no close button by default', async () => {
115
+ renderDrawer();
116
+
117
+ const drawer = await openDrawer();
118
+
119
+ expect(
120
+ within(drawer).queryByRole('button', { name: 'Close' }),
121
+ ).not.toBeInTheDocument();
122
+ });
123
+ });
@@ -0,0 +1,248 @@
1
+ import { Drawer as DrawerPrimitive } from '@base-ui/react/drawer';
2
+ import { IconX } from '@tabler/icons-react';
3
+ import { cva, type VariantProps } from 'class-variance-authority';
4
+ import * as React from 'react';
5
+
6
+ import { cn } from '../lib/utils';
7
+ import {
8
+ dialogDescriptionClassName,
9
+ dialogFooterClassName,
10
+ dialogTitleClassName,
11
+ } from './_internal/dialog-styles';
12
+ import { Button } from './Button';
13
+
14
+ // iOS sheet curve, as in coss ui's Drawer. Moves use `transform`, which Base
15
+ // UI's inline drag offset replaces, where `translate-*` would add to it.
16
+ const drawerMotion =
17
+ 'duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none';
18
+
19
+ const drawerBackdropClassName = cn(
20
+ 'fixed inset-0 z-50 bg-black/32 opacity-[calc(1-var(--drawer-swipe-progress,0))] backdrop-blur-sm transition-opacity data-ending-style:opacity-0 data-starting-style:opacity-0 data-swiping:duration-0',
21
+ drawerMotion,
22
+ );
23
+
24
+ const drawerViewportClassName = 'fixed inset-0 z-50 flex';
25
+
26
+ // Fills the gap past the screen edge when a drag pulls a docked drawer inwards.
27
+ const drawerEdgeFillClassName =
28
+ 'after:bg-popover after:pointer-events-none after:absolute after:inset-y-0 after:left-full after:w-12';
29
+
30
+ const drawerPopupVariants = cva(
31
+ cn(
32
+ 'bg-popover text-popover-foreground relative ml-auto flex w-[calc(100%-3rem)] min-w-0 flex-col shadow-lg/5 outline-none not-dark:bg-clip-padding',
33
+ 'transition-transform data-ending-style:duration-[calc(var(--drawer-swipe-strength,1)*400ms)] data-swiping:select-none',
34
+ drawerMotion,
35
+ '[transform:translateX(var(--drawer-swipe-movement-x,0px))] data-ending-style:[transform:translateX(calc(100%+var(--inset,0px)))] data-starting-style:[transform:translateX(calc(100%+var(--inset,0px)))]',
36
+ ),
37
+ {
38
+ defaultVariants: {
39
+ size: 'md',
40
+ variant: 'inset',
41
+ },
42
+ variants: {
43
+ size: {
44
+ lg: 'max-w-xl',
45
+ md: 'max-w-md',
46
+ sm: 'max-w-sm',
47
+ },
48
+ variant: {
49
+ // Physical sides throughout: the drawer slides in from the right
50
+ // whatever the text direction.
51
+ attached: cn(
52
+ drawerEdgeFillClassName,
53
+ 'rounded-l-2xl border-l **:data-[slot=drawer-footer]:rounded-bl-[calc(var(--radius-2xl)-1px)]',
54
+ ),
55
+ // Floats inside the viewport, `--inset` away from its edges.
56
+ inset:
57
+ 'my-(--inset) mr-(--inset) rounded-2xl border [--inset:--spacing(2)] sm:[--inset:--spacing(4)] **:data-[slot=drawer-footer]:rounded-b-[calc(var(--radius-2xl)-1px)]',
58
+ straight: cn(drawerEdgeFillClassName, 'border-l'),
59
+ },
60
+ },
61
+ },
62
+ );
63
+
64
+ type DrawerCloseProps = React.ComponentProps<typeof DrawerPrimitive.Close>;
65
+
66
+ type DrawerContentProps = React.ComponentProps<typeof DrawerPrimitive.Popup> & {
67
+ /** Accessible name of the close icon button. Defaults to `"Close"`. */
68
+ closeLabel?: string;
69
+ /**
70
+ * Renders a close icon button in the top-right corner. Defaults to `false`.
71
+ */
72
+ showCloseButton?: boolean;
73
+ /** Maximum width of the drawer. Defaults to `md`. */
74
+ size?: DrawerSize;
75
+ /**
76
+ * `inset` floats the drawer away from the viewport's edges, `attached`
77
+ * docks it to the right edge with rounded inner corners, and `straight`
78
+ * docks it without rounding. Defaults to `inset`.
79
+ */
80
+ variant?: DrawerVariant;
81
+ };
82
+ type DrawerDescriptionProps = React.ComponentProps<
83
+ typeof DrawerPrimitive.Description
84
+ >;
85
+ type DrawerFooterProps = React.ComponentProps<'div'>;
86
+ type DrawerHeaderProps = React.ComponentProps<'div'>;
87
+ type DrawerPanelProps = React.ComponentProps<typeof DrawerPrimitive.Content>;
88
+ // The drawer always slides in from the right, so the swipe direction is fixed
89
+ // and the snap points, which only apply to vertical drawers, are left out.
90
+ type DrawerProps = Omit<
91
+ React.ComponentProps<typeof DrawerPrimitive.Root>,
92
+ | 'defaultSnapPoint'
93
+ | 'onSnapPointChange'
94
+ | 'snapPoint'
95
+ | 'snapPoints'
96
+ | 'snapToSequentialPoints'
97
+ | 'swipeDirection'
98
+ >;
99
+ type DrawerSize = NonNullable<VariantProps<typeof drawerPopupVariants>['size']>;
100
+ type DrawerTitleProps = React.ComponentProps<typeof DrawerPrimitive.Title>;
101
+ type DrawerTriggerProps = React.ComponentProps<typeof DrawerPrimitive.Trigger>;
102
+ type DrawerVariant = NonNullable<
103
+ VariantProps<typeof drawerPopupVariants>['variant']
104
+ >;
105
+
106
+ function DrawerClose({ ...props }: DrawerCloseProps) {
107
+ return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
108
+ }
109
+
110
+ function DrawerContent({
111
+ children,
112
+ className,
113
+ closeLabel = 'Close',
114
+ showCloseButton = false,
115
+ size = 'md',
116
+ variant = 'inset',
117
+ ...props
118
+ }: DrawerContentProps) {
119
+ return (
120
+ <DrawerPrimitive.Portal>
121
+ <DrawerPrimitive.Backdrop
122
+ className={drawerBackdropClassName}
123
+ data-slot="drawer-backdrop"
124
+ />
125
+ <DrawerPrimitive.Viewport className={drawerViewportClassName}>
126
+ <DrawerPrimitive.Popup
127
+ className={cn(
128
+ drawerPopupVariants({ size, variant }),
129
+ // Keeps the title clear of the close button.
130
+ showCloseButton && '**:data-[slot=drawer-header]:pr-12',
131
+ className,
132
+ )}
133
+ data-size={size}
134
+ data-slot="drawer-content"
135
+ data-variant={variant}
136
+ {...props}
137
+ >
138
+ {children}
139
+ {showCloseButton ? (
140
+ <DrawerPrimitive.Close
141
+ aria-label={closeLabel}
142
+ className="absolute top-3 right-3"
143
+ data-slot="drawer-close"
144
+ render={<Button size="icon-sm" variant="ghost" />}
145
+ >
146
+ <IconX />
147
+ </DrawerPrimitive.Close>
148
+ ) : null}
149
+ </DrawerPrimitive.Popup>
150
+ </DrawerPrimitive.Viewport>
151
+ </DrawerPrimitive.Portal>
152
+ );
153
+ }
154
+
155
+ function DrawerDescription({ className, ...props }: DrawerDescriptionProps) {
156
+ return (
157
+ <DrawerPrimitive.Description
158
+ className={cn(dialogDescriptionClassName, className)}
159
+ data-slot="drawer-description"
160
+ {...props}
161
+ />
162
+ );
163
+ }
164
+
165
+ function DrawerFooter({ className, ...props }: DrawerFooterProps) {
166
+ return (
167
+ <div
168
+ className={cn(
169
+ dialogFooterClassName,
170
+ 'bg-muted/72 mt-auto border-t px-6 py-4',
171
+ className,
172
+ )}
173
+ data-slot="drawer-footer"
174
+ {...props}
175
+ />
176
+ );
177
+ }
178
+
179
+ function DrawerHeader({ className, ...props }: DrawerHeaderProps) {
180
+ return (
181
+ <div
182
+ className={cn('flex flex-col gap-1.5 p-6', className)}
183
+ data-slot="drawer-header"
184
+ {...props}
185
+ />
186
+ );
187
+ }
188
+
189
+ /**
190
+ * The scrolling body between the header and the footer. Mouse drags in it
191
+ * select text instead of moving the drawer.
192
+ */
193
+ function DrawerPanel({ className, ...props }: DrawerPanelProps) {
194
+ return (
195
+ <DrawerPrimitive.Content
196
+ className={cn(
197
+ // Pulled 4px into the header's padding and padded back, so the 3px focus
198
+ // ring of a field at its top isn't clipped by the scroll container.
199
+ '-mt-1 min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 pt-1 pb-6 first:mt-0 first:pt-6',
200
+ className,
201
+ )}
202
+ data-slot="drawer-panel"
203
+ {...props}
204
+ />
205
+ );
206
+ }
207
+
208
+ function DrawerRoot(props: DrawerProps) {
209
+ return <DrawerPrimitive.Root swipeDirection="right" {...props} />;
210
+ }
211
+
212
+ function DrawerTitle({ className, ...props }: DrawerTitleProps) {
213
+ return (
214
+ <DrawerPrimitive.Title
215
+ className={cn(dialogTitleClassName, className)}
216
+ data-slot="drawer-title"
217
+ {...props}
218
+ />
219
+ );
220
+ }
221
+
222
+ function DrawerTrigger({ ...props }: DrawerTriggerProps) {
223
+ return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
224
+ }
225
+
226
+ const Drawer = Object.assign(DrawerRoot, {
227
+ Close: DrawerClose,
228
+ Content: DrawerContent,
229
+ Description: DrawerDescription,
230
+ Footer: DrawerFooter,
231
+ Header: DrawerHeader,
232
+ Panel: DrawerPanel,
233
+ Title: DrawerTitle,
234
+ Trigger: DrawerTrigger,
235
+ });
236
+
237
+ export { Drawer };
238
+ export type {
239
+ DrawerCloseProps,
240
+ DrawerContentProps,
241
+ DrawerDescriptionProps,
242
+ DrawerFooterProps,
243
+ DrawerHeaderProps,
244
+ DrawerPanelProps,
245
+ DrawerProps,
246
+ DrawerTitleProps,
247
+ DrawerTriggerProps,
248
+ };
@@ -11,7 +11,7 @@ function FormLabel({ className, ...props }: FormLabelProps) {
11
11
  return (
12
12
  <Field.Label
13
13
  className={cn(
14
- 'text-sm leading-none font-medium data-disabled:cursor-not-allowed data-disabled:opacity-50',
14
+ 'text-sm font-medium data-disabled:cursor-not-allowed data-disabled:opacity-50',
15
15
  className,
16
16
  )}
17
17
  data-slot="field-label"
@@ -0,0 +1,12 @@
1
+ export { Drawer } from '../components/Drawer';
2
+ export type {
3
+ DrawerCloseProps,
4
+ DrawerContentProps,
5
+ DrawerDescriptionProps,
6
+ DrawerFooterProps,
7
+ DrawerHeaderProps,
8
+ DrawerPanelProps,
9
+ DrawerProps,
10
+ DrawerTitleProps,
11
+ DrawerTriggerProps,
12
+ } from '../components/Drawer';
package/src/index.ts CHANGED
@@ -11,6 +11,7 @@ export * from './entries/cn';
11
11
  export * from './entries/color-picker';
12
12
  export * from './entries/combobox';
13
13
  export * from './entries/dialog';
14
+ export * from './entries/drawer';
14
15
  export * from './entries/flex';
15
16
  export * from './entries/form';
16
17
  export * from './entries/grid';