@pickle-ui/react 1.0.0-beta.14 → 1.0.0-beta.15
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 +22 -12
- package/dist/components/Alert.d.ts +1 -1
- package/dist/components/Alert.d.ts.map +1 -1
- package/dist/components/Alert.js.map +1 -1
- package/dist/components/AlertDialog.d.ts.map +1 -1
- package/dist/components/AlertDialog.js +3 -3
- package/dist/components/AlertDialog.js.map +1 -1
- package/dist/components/Avatar.d.ts +1 -1
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Badge.d.ts +2 -2
- package/dist/components/Badge.d.ts.map +1 -1
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.d.ts +1 -1
- package/dist/components/Card.d.ts.map +1 -1
- package/dist/components/Card.js +1 -1
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog.js.map +1 -1
- package/dist/components/Drawer.d.ts +2 -2
- package/dist/components/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer.js.map +1 -1
- package/dist/components/Flex.d.ts +7 -7
- package/dist/components/Flex.d.ts.map +1 -1
- package/dist/components/Grid.d.ts +42 -42
- package/dist/components/Grid.d.ts.map +1 -1
- package/dist/components/Grid.js +4 -3
- package/dist/components/Grid.js.map +1 -1
- package/dist/components/Group.d.ts.map +1 -1
- package/dist/components/Group.js.map +1 -1
- package/dist/components/Menu.d.ts +1 -1
- package/dist/components/Menu.d.ts.map +1 -1
- package/dist/components/Menu.js +1 -1
- package/dist/components/Menu.js.map +1 -1
- package/dist/components/Popover.d.ts.map +1 -1
- package/dist/components/Popover.js.map +1 -1
- package/dist/components/Progress.d.ts +1 -1
- package/dist/components/Progress.d.ts.map +1 -1
- package/dist/components/Progress.js +1 -1
- package/dist/components/Progress.js.map +1 -1
- package/dist/components/ScrollArea.d.ts.map +1 -1
- package/dist/components/ScrollArea.js +1 -1
- package/dist/components/ScrollArea.js.map +1 -1
- package/dist/components/Separator.d.ts.map +1 -1
- package/dist/components/Separator.js.map +1 -1
- package/dist/components/Sidebar.d.ts.map +1 -1
- package/dist/components/Sidebar.js +1 -1
- package/dist/components/Sidebar.js.map +1 -1
- package/dist/components/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner.js.map +1 -1
- package/dist/components/Table.d.ts +1 -1
- package/dist/components/Table.d.ts.map +1 -1
- package/dist/components/Table.js +2 -2
- package/dist/components/Table.js.map +1 -1
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js.map +1 -1
- package/dist/components/Toast.d.ts.map +1 -1
- package/dist/components/Toast.js +1 -1
- package/dist/components/Toast.js.map +1 -1
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/XStack.d.ts.map +1 -1
- package/dist/components/XStack.js.map +1 -1
- package/dist/components/YStack.d.ts.map +1 -1
- package/dist/components/YStack.js.map +1 -1
- package/dist/components/_internal/VisuallyHiddenInput.d.ts.map +1 -1
- package/dist/components/_internal/VisuallyHiddenInput.js +2 -4
- package/dist/components/_internal/VisuallyHiddenInput.js.map +1 -1
- package/dist/components/_internal/dialog-styles.d.ts +1 -1
- package/dist/components/_internal/dialog-styles.d.ts.map +1 -1
- package/dist/components/_internal/dialog-styles.js.map +1 -1
- package/dist/components/_internal/layout.d.ts +27 -27
- package/dist/components/_internal/layout.d.ts.map +1 -1
- package/dist/components/_internal/layout.js +1 -1
- package/dist/components/_internal/layout.js.map +1 -1
- package/dist/components/_internal/separate.d.ts +1 -1
- package/dist/components/_internal/separate.d.ts.map +1 -1
- package/dist/components/_internal/separate.js.map +1 -1
- package/dist/components/form/Checkbox.d.ts.map +1 -1
- package/dist/components/form/Checkbox.js.map +1 -1
- package/dist/components/form/ColorPicker.d.ts.map +1 -1
- package/dist/components/form/ColorPicker.js.map +1 -1
- package/dist/components/form/ColorPickerPrimitive.d.ts.map +1 -1
- package/dist/components/form/ColorPickerPrimitive.js +9 -14
- package/dist/components/form/ColorPickerPrimitive.js.map +1 -1
- package/dist/components/form/Combobox.d.ts.map +1 -1
- package/dist/components/form/Combobox.js +11 -12
- package/dist/components/form/Combobox.js.map +1 -1
- package/dist/components/form/Form.context.d.ts.map +1 -1
- package/dist/components/form/Form.context.js +2 -4
- package/dist/components/form/Form.context.js.map +1 -1
- package/dist/components/form/Form.d.ts +1 -1
- package/dist/components/form/Form.d.ts.map +1 -1
- package/dist/components/form/FormCheckbox.d.ts.map +1 -1
- package/dist/components/form/FormCheckbox.js.map +1 -1
- package/dist/components/form/FormCombobox.d.ts +1 -1
- package/dist/components/form/FormCombobox.d.ts.map +1 -1
- package/dist/components/form/FormCombobox.js +1 -1
- package/dist/components/form/FormCombobox.js.map +1 -1
- package/dist/components/form/FormField.d.ts.map +1 -1
- package/dist/components/form/FormField.js +1 -1
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/form/FormInput.d.ts.map +1 -1
- package/dist/components/form/FormInput.js +1 -1
- package/dist/components/form/FormInput.js.map +1 -1
- package/dist/components/form/FormInputGroup.d.ts.map +1 -1
- package/dist/components/form/FormInputGroup.js +2 -6
- package/dist/components/form/FormInputGroup.js.map +1 -1
- package/dist/components/form/FormRadioGroup.d.ts +1 -1
- package/dist/components/form/FormRadioGroup.d.ts.map +1 -1
- package/dist/components/form/FormSwitch.d.ts.map +1 -1
- package/dist/components/form/FormSwitch.js.map +1 -1
- package/dist/components/form/FormTextarea.d.ts.map +1 -1
- package/dist/components/form/FormTextarea.js +1 -1
- package/dist/components/form/FormTextarea.js.map +1 -1
- package/dist/components/form/Input.d.ts.map +1 -1
- package/dist/components/form/Input.js.map +1 -1
- package/dist/components/form/InputGroup.d.ts +1 -1
- package/dist/components/form/InputGroup.d.ts.map +1 -1
- package/dist/components/form/InputGroup.js.map +1 -1
- package/dist/components/form/RadioGroup.d.ts.map +1 -1
- package/dist/components/form/RadioGroup.js.map +1 -1
- package/dist/components/form/Select.d.ts.map +1 -1
- package/dist/components/form/Select.js +1 -1
- package/dist/components/form/Select.js.map +1 -1
- package/dist/components/form/Slider.d.ts +1 -1
- package/dist/components/form/Slider.d.ts.map +1 -1
- package/dist/components/form/Slider.js.map +1 -1
- package/dist/components/form/Switch.d.ts.map +1 -1
- package/dist/components/form/Switch.js.map +1 -1
- package/dist/components/form/Textarea.d.ts.map +1 -1
- package/dist/components/form/Textarea.js.map +1 -1
- package/dist/entries/checkbox.d.ts +1 -1
- package/dist/entries/checkbox.d.ts.map +1 -1
- package/dist/entries/group.d.ts +1 -1
- package/dist/entries/group.d.ts.map +1 -1
- package/dist/entries/radio-group.d.ts +1 -1
- package/dist/entries/radio-group.d.ts.map +1 -1
- package/dist/lib/color.d.ts +1 -1
- package/dist/lib/color.d.ts.map +1 -1
- package/dist/lib/color.js +1 -3
- package/dist/lib/color.js.map +1 -1
- package/dist/lib/compose-refs.js +1 -1
- package/dist/lib/compose-refs.js.map +1 -1
- package/package.json +35 -34
- package/skills/pickle-ui-react/SKILL.md +38 -0
- package/src/agent-skill.test.ts +30 -0
- package/src/components/Alert.test.tsx +3 -12
- package/src/components/Alert.tsx +2 -4
- package/src/components/AlertDialog.stories.tsx +10 -35
- package/src/components/AlertDialog.test.tsx +6 -23
- package/src/components/AlertDialog.tsx +12 -40
- package/src/components/Avatar.stories.tsx +3 -8
- package/src/components/Avatar.tsx +4 -18
- package/src/components/Badge.stories.tsx +1 -5
- package/src/components/Badge.test.tsx +1 -4
- package/src/components/Badge.tsx +5 -14
- package/src/components/Button.stories.tsx +4 -16
- package/src/components/Button.test.tsx +8 -9
- package/src/components/Button.tsx +2 -7
- package/src/components/Card.stories.tsx +1 -3
- package/src/components/Card.test.tsx +1 -3
- package/src/components/Card.tsx +1 -9
- package/src/components/Dialog.stories.tsx +9 -23
- package/src/components/Dialog.test.tsx +6 -23
- package/src/components/Dialog.tsx +4 -17
- package/src/components/Drawer.stories.tsx +9 -34
- package/src/components/Drawer.test.tsx +8 -29
- package/src/components/Drawer.tsx +4 -15
- package/src/components/Grid.stories.tsx +1 -4
- package/src/components/Grid.test.tsx +1 -3
- package/src/components/Grid.tsx +4 -4
- package/src/components/Group.stories.tsx +4 -20
- package/src/components/Group.test.tsx +2 -9
- package/src/components/Group.tsx +3 -12
- package/src/components/Menu.stories.tsx +5 -18
- package/src/components/Menu.test.tsx +11 -17
- package/src/components/Menu.tsx +7 -27
- package/src/components/Popover.stories.tsx +4 -10
- package/src/components/Popover.tsx +3 -13
- package/src/components/Progress.tsx +5 -24
- package/src/components/ScrollArea.test.tsx +4 -6
- package/src/components/ScrollArea.tsx +10 -28
- package/src/components/Separator.test.tsx +2 -8
- package/src/components/Separator.tsx +1 -5
- package/src/components/Sidebar.stories.tsx +1 -5
- package/src/components/Sidebar.tsx +4 -22
- package/src/components/Spinner.tsx +1 -5
- package/src/components/Table.stories.tsx +1 -3
- package/src/components/Table.tsx +5 -30
- package/src/components/Text.stories.tsx +8 -13
- package/src/components/Text.tsx +1 -4
- package/src/components/Toast.test.tsx +6 -17
- package/src/components/Toast.tsx +4 -17
- package/src/components/Tooltip.stories.tsx +6 -28
- package/src/components/Tooltip.test.tsx +2 -8
- package/src/components/Tooltip.tsx +3 -12
- package/src/components/XStack.stories.tsx +4 -8
- package/src/components/XStack.test.tsx +9 -20
- package/src/components/XStack.tsx +2 -13
- package/src/components/YStack.stories.tsx +2 -8
- package/src/components/YStack.tsx +2 -13
- package/src/components/_internal/Story.tsx +6 -23
- package/src/components/_internal/VisuallyHiddenInput.tsx +4 -9
- package/src/components/_internal/dialog-styles.ts +1 -2
- package/src/components/_internal/layout.ts +1 -7
- package/src/components/_internal/separate.tsx +6 -9
- package/src/components/form/Checkbox.test.tsx +5 -16
- package/src/components/form/Checkbox.tsx +1 -4
- package/src/components/form/ColorPicker.stories.tsx +3 -10
- package/src/components/form/ColorPicker.test.tsx +1 -3
- package/src/components/form/ColorPicker.tsx +2 -6
- package/src/components/form/ColorPickerPrimitive.tsx +40 -151
- package/src/components/form/Combobox.stories.tsx +7 -31
- package/src/components/form/Combobox.test.tsx +10 -27
- package/src/components/form/Combobox.tsx +31 -89
- package/src/components/form/Form.context.ts +5 -19
- package/src/components/form/Form.stories.tsx +6 -28
- package/src/components/form/Form.test.tsx +21 -38
- package/src/components/form/FormCheckbox.tsx +1 -5
- package/src/components/form/FormCombobox.tsx +4 -10
- package/src/components/form/FormField.tsx +4 -15
- package/src/components/form/FormInput.tsx +2 -12
- package/src/components/form/FormInputGroup.tsx +3 -11
- package/src/components/form/FormSwitch.tsx +1 -5
- package/src/components/form/FormTextarea.tsx +3 -11
- package/src/components/form/Input.stories.tsx +1 -5
- package/src/components/form/Input.test.tsx +20 -31
- package/src/components/form/Input.tsx +1 -4
- package/src/components/form/InputGroup.stories.tsx +4 -23
- package/src/components/form/InputGroup.tsx +5 -10
- package/src/components/form/RadioGroup.test.tsx +14 -28
- package/src/components/form/RadioGroup.tsx +1 -5
- package/src/components/form/Select.stories.tsx +2 -10
- package/src/components/form/Select.test.tsx +4 -14
- package/src/components/form/Select.tsx +9 -38
- package/src/components/form/Slider.stories.tsx +7 -17
- package/src/components/form/Slider.test.tsx +4 -12
- package/src/components/form/Slider.tsx +4 -20
- package/src/components/form/Switch.test.tsx +3 -9
- package/src/components/form/Switch.tsx +2 -9
- package/src/components/form/Textarea.test.tsx +2 -6
- package/src/components/form/Textarea.tsx +1 -6
- package/src/entries/checkbox.ts +1 -4
- package/src/entries/group.ts +1 -5
- package/src/entries/radio-group.ts +1 -4
- package/src/lib/color.test.ts +2 -6
- package/src/lib/color.ts +3 -11
- package/src/lib/compose-refs.ts +1 -1
- package/src/public-api.test.ts +7 -8
package/src/components/Menu.tsx
CHANGED
|
@@ -1,41 +1,29 @@
|
|
|
1
1
|
import { Menu as MenuPrimitive } from '@base-ui/react/menu';
|
|
2
|
-
import {
|
|
3
|
-
IconCheck,
|
|
4
|
-
IconChevronRight,
|
|
5
|
-
IconCircleFilled,
|
|
6
|
-
} from '@tabler/icons-react';
|
|
2
|
+
import { IconCheck, IconChevronRight, IconCircleFilled } from '@tabler/icons-react';
|
|
7
3
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
8
4
|
import * as React from 'react';
|
|
9
5
|
|
|
10
6
|
import { cn } from '../lib/utils';
|
|
11
7
|
import { Text, type TextProps } from './Text';
|
|
12
8
|
|
|
13
|
-
type MenuCheckboxItemProps = React.ComponentProps<
|
|
14
|
-
typeof MenuPrimitive.CheckboxItem
|
|
15
|
-
>;
|
|
9
|
+
type MenuCheckboxItemProps = React.ComponentProps<typeof MenuPrimitive.CheckboxItem>;
|
|
16
10
|
type MenuContentProps = Pick<
|
|
17
11
|
React.ComponentProps<typeof MenuPrimitive.Positioner>,
|
|
18
12
|
'align' | 'alignOffset' | 'side' | 'sideOffset'
|
|
19
13
|
> &
|
|
20
14
|
React.ComponentProps<typeof MenuPrimitive.Popup>;
|
|
21
|
-
type MenuGroupLabelProps = React.ComponentProps<
|
|
22
|
-
typeof MenuPrimitive.GroupLabel
|
|
23
|
-
>;
|
|
15
|
+
type MenuGroupLabelProps = React.ComponentProps<typeof MenuPrimitive.GroupLabel>;
|
|
24
16
|
type MenuGroupProps = React.ComponentProps<typeof MenuPrimitive.Group>;
|
|
25
17
|
type MenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> &
|
|
26
18
|
VariantProps<typeof menuItemVariants>;
|
|
27
19
|
type MenuProps = React.ComponentProps<typeof MenuPrimitive.Root>;
|
|
28
|
-
type MenuRadioGroupProps = React.ComponentProps<
|
|
29
|
-
typeof MenuPrimitive.RadioGroup
|
|
30
|
-
>;
|
|
20
|
+
type MenuRadioGroupProps = React.ComponentProps<typeof MenuPrimitive.RadioGroup>;
|
|
31
21
|
type MenuRadioItemProps = React.ComponentProps<typeof MenuPrimitive.RadioItem>;
|
|
32
22
|
type MenuSeparatorProps = React.ComponentProps<typeof MenuPrimitive.Separator>;
|
|
33
23
|
type MenuShortcutProps = Omit<TextProps, 'as'>;
|
|
34
24
|
type MenuSubContentProps = MenuContentProps;
|
|
35
25
|
type MenuSubProps = React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>;
|
|
36
|
-
type MenuSubTriggerProps = React.ComponentProps<
|
|
37
|
-
typeof MenuPrimitive.SubmenuTrigger
|
|
38
|
-
>;
|
|
26
|
+
type MenuSubTriggerProps = React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger>;
|
|
39
27
|
type MenuTriggerProps = React.ComponentProps<typeof MenuPrimitive.Trigger>;
|
|
40
28
|
|
|
41
29
|
const menuPopupClassName =
|
|
@@ -57,11 +45,7 @@ const menuItemVariants = cva(menuItemBaseClassName, {
|
|
|
57
45
|
},
|
|
58
46
|
});
|
|
59
47
|
|
|
60
|
-
function MenuCheckboxItem({
|
|
61
|
-
children,
|
|
62
|
-
className,
|
|
63
|
-
...props
|
|
64
|
-
}: MenuCheckboxItemProps) {
|
|
48
|
+
function MenuCheckboxItem({ children, className, ...props }: MenuCheckboxItemProps) {
|
|
65
49
|
return (
|
|
66
50
|
<MenuPrimitive.CheckboxItem
|
|
67
51
|
className={cn(menuItemBaseClassName, 'pr-8', className)}
|
|
@@ -214,11 +198,7 @@ function MenuSubContent({
|
|
|
214
198
|
);
|
|
215
199
|
}
|
|
216
200
|
|
|
217
|
-
function MenuSubTrigger({
|
|
218
|
-
children,
|
|
219
|
-
className,
|
|
220
|
-
...props
|
|
221
|
-
}: MenuSubTriggerProps) {
|
|
201
|
+
function MenuSubTrigger({ children, className, ...props }: MenuSubTriggerProps) {
|
|
222
202
|
return (
|
|
223
203
|
<MenuPrimitive.SubmenuTrigger
|
|
224
204
|
className={cn(
|
|
@@ -34,9 +34,7 @@ function PopoverMatrixCell({ column, row }: ComponentMatrixCellProps) {
|
|
|
34
34
|
return (
|
|
35
35
|
<Popover>
|
|
36
36
|
<Popover.Trigger
|
|
37
|
-
render={
|
|
38
|
-
<Button variant={column.key as NonNullable<ButtonProps['variant']>} />
|
|
39
|
-
}
|
|
37
|
+
render={<Button variant={column.key as NonNullable<ButtonProps['variant']>} />}
|
|
40
38
|
>
|
|
41
39
|
Open
|
|
42
40
|
</Popover.Trigger>
|
|
@@ -44,8 +42,8 @@ function PopoverMatrixCell({ column, row }: ComponentMatrixCellProps) {
|
|
|
44
42
|
<Popover.Header>
|
|
45
43
|
<Popover.Title>{row.label}</Popover.Title>
|
|
46
44
|
<Popover.Description>
|
|
47
|
-
Contextual content keeps the same spacing, radius, and border
|
|
48
|
-
|
|
45
|
+
Contextual content keeps the same spacing, radius, and border treatment across trigger
|
|
46
|
+
styles.
|
|
49
47
|
</Popover.Description>
|
|
50
48
|
</Popover.Header>
|
|
51
49
|
<div className="flex justify-end gap-2">
|
|
@@ -61,11 +59,7 @@ export const All: StoryDefinition = {
|
|
|
61
59
|
render: () => (
|
|
62
60
|
<Story.Layout className="max-w-6xl" title="Popover">
|
|
63
61
|
<Story.Section title="Alignment and trigger styles">
|
|
64
|
-
<Story.Matrix
|
|
65
|
-
Cell={PopoverMatrixCell}
|
|
66
|
-
columns={TRIGGER_COLUMNS}
|
|
67
|
-
rows={ALIGN_ROWS}
|
|
68
|
-
/>
|
|
62
|
+
<Story.Matrix Cell={PopoverMatrixCell} columns={TRIGGER_COLUMNS} rows={ALIGN_ROWS} />
|
|
69
63
|
</Story.Section>
|
|
70
64
|
</Story.Layout>
|
|
71
65
|
),
|
|
@@ -13,9 +13,7 @@ type PopoverDescriptionProps = React.ComponentProps<'p'>;
|
|
|
13
13
|
type PopoverHeaderProps = React.ComponentProps<'div'>;
|
|
14
14
|
type PopoverProps = React.ComponentProps<typeof PopoverPrimitive.Root>;
|
|
15
15
|
type PopoverTitleProps = React.ComponentProps<'h2'>;
|
|
16
|
-
type PopoverTriggerProps = React.ComponentProps<
|
|
17
|
-
typeof PopoverPrimitive.Trigger
|
|
18
|
-
>;
|
|
16
|
+
type PopoverTriggerProps = React.ComponentProps<typeof PopoverPrimitive.Trigger>;
|
|
19
17
|
|
|
20
18
|
function PopoverAnchor({ ...props }: PopoverAnchorProps) {
|
|
21
19
|
return <div data-slot="popover-anchor" {...props} />;
|
|
@@ -30,11 +28,7 @@ function PopoverContent({
|
|
|
30
28
|
}: PopoverContentProps) {
|
|
31
29
|
return (
|
|
32
30
|
<PopoverPrimitive.Portal>
|
|
33
|
-
<PopoverPrimitive.Positioner
|
|
34
|
-
align={align}
|
|
35
|
-
side={side}
|
|
36
|
-
sideOffset={sideOffset}
|
|
37
|
-
>
|
|
31
|
+
<PopoverPrimitive.Positioner align={align} side={side} sideOffset={sideOffset}>
|
|
38
32
|
<PopoverPrimitive.Popup
|
|
39
33
|
className={cn(
|
|
40
34
|
'border-border bg-popover text-popover-foreground data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md border p-4 text-sm shadow-lg duration-100 outline-none',
|
|
@@ -74,11 +68,7 @@ function PopoverRoot({ ...props }: PopoverProps) {
|
|
|
74
68
|
|
|
75
69
|
function PopoverTitle({ children, className, ...props }: PopoverTitleProps) {
|
|
76
70
|
return (
|
|
77
|
-
<h2
|
|
78
|
-
className={cn('text-base font-medium', className)}
|
|
79
|
-
data-slot="popover-title"
|
|
80
|
-
{...props}
|
|
81
|
-
>
|
|
71
|
+
<h2 className={cn('text-base font-medium', className)} data-slot="popover-title" {...props}>
|
|
82
72
|
{children}
|
|
83
73
|
</h2>
|
|
84
74
|
);
|
|
@@ -3,9 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { cn } from '../lib/utils';
|
|
5
5
|
|
|
6
|
-
type ProgressIndicatorProps = React.ComponentProps<
|
|
7
|
-
typeof ProgressPrimitive.Indicator
|
|
8
|
-
> & {
|
|
6
|
+
type ProgressIndicatorProps = React.ComponentProps<typeof ProgressPrimitive.Indicator> & {
|
|
9
7
|
indicatorClassName?: string;
|
|
10
8
|
};
|
|
11
9
|
|
|
@@ -15,11 +13,7 @@ type ProgressTrackProps = React.ComponentProps<typeof ProgressPrimitive.Track>;
|
|
|
15
13
|
|
|
16
14
|
type ProgressValueProps = React.ComponentProps<typeof ProgressPrimitive.Value>;
|
|
17
15
|
|
|
18
|
-
function ProgressIndicator({
|
|
19
|
-
className,
|
|
20
|
-
indicatorClassName,
|
|
21
|
-
...props
|
|
22
|
-
}: ProgressIndicatorProps) {
|
|
16
|
+
function ProgressIndicator({ className, indicatorClassName, ...props }: ProgressIndicatorProps) {
|
|
23
17
|
return (
|
|
24
18
|
<ProgressPrimitive.Indicator
|
|
25
19
|
className={cn(
|
|
@@ -62,10 +56,7 @@ function ProgressRoot({ children, className, ...props }: ProgressProps) {
|
|
|
62
56
|
function ProgressTrack({ children, className, ...props }: ProgressTrackProps) {
|
|
63
57
|
return (
|
|
64
58
|
<ProgressPrimitive.Track
|
|
65
|
-
className={cn(
|
|
66
|
-
'bg-muted h-2 w-full overflow-hidden rounded-full',
|
|
67
|
-
className,
|
|
68
|
-
)}
|
|
59
|
+
className={cn('bg-muted h-2 w-full overflow-hidden rounded-full', className)}
|
|
69
60
|
data-slot="progress-track"
|
|
70
61
|
{...props}
|
|
71
62
|
>
|
|
@@ -77,10 +68,7 @@ function ProgressTrack({ children, className, ...props }: ProgressTrackProps) {
|
|
|
77
68
|
function ProgressValue({ className, ...props }: ProgressValueProps) {
|
|
78
69
|
return (
|
|
79
70
|
<ProgressPrimitive.Value
|
|
80
|
-
className={cn(
|
|
81
|
-
'text-muted-foreground text-right text-sm tabular-nums',
|
|
82
|
-
className,
|
|
83
|
-
)}
|
|
71
|
+
className={cn('text-muted-foreground text-right text-sm tabular-nums', className)}
|
|
84
72
|
data-slot="progress-value"
|
|
85
73
|
{...props}
|
|
86
74
|
/>
|
|
@@ -94,14 +82,7 @@ const Progress = Object.assign(ProgressRoot, {
|
|
|
94
82
|
Value: ProgressValue,
|
|
95
83
|
});
|
|
96
84
|
|
|
97
|
-
export {
|
|
98
|
-
Progress,
|
|
99
|
-
ProgressIndicator,
|
|
100
|
-
ProgressLabel,
|
|
101
|
-
ProgressRoot,
|
|
102
|
-
ProgressTrack,
|
|
103
|
-
ProgressValue,
|
|
104
|
-
};
|
|
85
|
+
export { Progress, ProgressIndicator, ProgressLabel, ProgressRoot, ProgressTrack, ProgressValue };
|
|
105
86
|
export type {
|
|
106
87
|
ProgressIndicatorProps,
|
|
107
88
|
ProgressLabelProps,
|
|
@@ -8,9 +8,9 @@ describe('ScrollArea', () => {
|
|
|
8
8
|
const { container } = render(<ScrollArea>Scrollable content</ScrollArea>);
|
|
9
9
|
|
|
10
10
|
await waitFor(() =>
|
|
11
|
-
expect(
|
|
12
|
-
|
|
13
|
-
)
|
|
11
|
+
expect(container.querySelector('[data-slot="scroll-area-viewport"]')).toContainElement(
|
|
12
|
+
screen.getByText('Scrollable content'),
|
|
13
|
+
),
|
|
14
14
|
);
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -24,9 +24,7 @@ describe('ScrollArea', () => {
|
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
await waitFor(() =>
|
|
27
|
-
expect(screen.getByTestId('custom-viewport')).toHaveTextContent(
|
|
28
|
-
'Custom content',
|
|
29
|
-
),
|
|
27
|
+
expect(screen.getByTestId('custom-viewport')).toHaveTextContent('Custom content'),
|
|
30
28
|
);
|
|
31
29
|
});
|
|
32
30
|
});
|
|
@@ -3,30 +3,18 @@ import * as React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { cn } from '../lib/utils';
|
|
5
5
|
|
|
6
|
-
type ScrollAreaContentProps = React.ComponentProps<
|
|
7
|
-
|
|
8
|
-
>;
|
|
9
|
-
type ScrollAreaCornerProps = React.ComponentProps<
|
|
10
|
-
typeof ScrollAreaPrimitive.Corner
|
|
11
|
-
>;
|
|
6
|
+
type ScrollAreaContentProps = React.ComponentProps<typeof ScrollAreaPrimitive.Content>;
|
|
7
|
+
type ScrollAreaCornerProps = React.ComponentProps<typeof ScrollAreaPrimitive.Corner>;
|
|
12
8
|
type ScrollAreaProps = Omit<ScrollAreaRootProps, 'children'> & {
|
|
13
9
|
children?: React.ReactNode;
|
|
14
10
|
contentClassName?: string;
|
|
15
11
|
orientation?: 'both' | 'horizontal' | 'vertical';
|
|
16
12
|
viewportClassName?: string;
|
|
17
13
|
};
|
|
18
|
-
type ScrollAreaRootProps = React.ComponentProps<
|
|
19
|
-
|
|
20
|
-
>;
|
|
21
|
-
type
|
|
22
|
-
typeof ScrollAreaPrimitive.Scrollbar
|
|
23
|
-
>;
|
|
24
|
-
type ScrollAreaThumbProps = React.ComponentProps<
|
|
25
|
-
typeof ScrollAreaPrimitive.Thumb
|
|
26
|
-
>;
|
|
27
|
-
type ScrollAreaViewportProps = React.ComponentProps<
|
|
28
|
-
typeof ScrollAreaPrimitive.Viewport
|
|
29
|
-
>;
|
|
14
|
+
type ScrollAreaRootProps = React.ComponentProps<typeof ScrollAreaPrimitive.Root>;
|
|
15
|
+
type ScrollAreaScrollbarProps = React.ComponentProps<typeof ScrollAreaPrimitive.Scrollbar>;
|
|
16
|
+
type ScrollAreaThumbProps = React.ComponentProps<typeof ScrollAreaPrimitive.Thumb>;
|
|
17
|
+
type ScrollAreaViewportProps = React.ComponentProps<typeof ScrollAreaPrimitive.Viewport>;
|
|
30
18
|
|
|
31
19
|
function ScrollAreaContent({ className, ...props }: ScrollAreaContentProps) {
|
|
32
20
|
return (
|
|
@@ -55,22 +43,16 @@ function ScrollAreaFacade({
|
|
|
55
43
|
viewportClassName,
|
|
56
44
|
...props
|
|
57
45
|
}: ScrollAreaProps) {
|
|
58
|
-
const hasHorizontalScrollbar =
|
|
59
|
-
|
|
60
|
-
const hasVerticalScrollbar =
|
|
61
|
-
orientation === 'vertical' || orientation === 'both';
|
|
46
|
+
const hasHorizontalScrollbar = orientation === 'horizontal' || orientation === 'both';
|
|
47
|
+
const hasVerticalScrollbar = orientation === 'vertical' || orientation === 'both';
|
|
62
48
|
|
|
63
49
|
return (
|
|
64
50
|
<ScrollAreaRoot {...props}>
|
|
65
51
|
<ScrollAreaViewport className={viewportClassName}>
|
|
66
|
-
<ScrollAreaContent className={contentClassName}>
|
|
67
|
-
{children}
|
|
68
|
-
</ScrollAreaContent>
|
|
52
|
+
<ScrollAreaContent className={contentClassName}>{children}</ScrollAreaContent>
|
|
69
53
|
</ScrollAreaViewport>
|
|
70
54
|
{hasVerticalScrollbar ? <ScrollAreaScrollbar /> : null}
|
|
71
|
-
{hasHorizontalScrollbar ?
|
|
72
|
-
<ScrollAreaScrollbar orientation="horizontal" />
|
|
73
|
-
) : null}
|
|
55
|
+
{hasHorizontalScrollbar ? <ScrollAreaScrollbar orientation="horizontal" /> : null}
|
|
74
56
|
{orientation === 'both' ? <ScrollAreaCorner /> : null}
|
|
75
57
|
</ScrollAreaRoot>
|
|
76
58
|
);
|
|
@@ -7,18 +7,12 @@ describe('Separator', () => {
|
|
|
7
7
|
it('renders a horizontal separator by default', () => {
|
|
8
8
|
render(<Separator />);
|
|
9
9
|
|
|
10
|
-
expect(screen.getByRole('separator')).toHaveAttribute(
|
|
11
|
-
'data-orientation',
|
|
12
|
-
'horizontal',
|
|
13
|
-
);
|
|
10
|
+
expect(screen.getByRole('separator')).toHaveAttribute('data-orientation', 'horizontal');
|
|
14
11
|
});
|
|
15
12
|
|
|
16
13
|
it('renders a vertical separator', () => {
|
|
17
14
|
render(<Separator orientation="vertical" />);
|
|
18
15
|
|
|
19
|
-
expect(screen.getByRole('separator')).toHaveAttribute(
|
|
20
|
-
'aria-orientation',
|
|
21
|
-
'vertical',
|
|
22
|
-
);
|
|
16
|
+
expect(screen.getByRole('separator')).toHaveAttribute('aria-orientation', 'vertical');
|
|
23
17
|
});
|
|
24
18
|
});
|
|
@@ -5,11 +5,7 @@ import { cn } from '../lib/utils';
|
|
|
5
5
|
|
|
6
6
|
type SeparatorProps = React.ComponentProps<typeof SeparatorPrimitive>;
|
|
7
7
|
|
|
8
|
-
function Separator({
|
|
9
|
-
className,
|
|
10
|
-
orientation = 'horizontal',
|
|
11
|
-
...props
|
|
12
|
-
}: SeparatorProps) {
|
|
8
|
+
function Separator({ className, orientation = 'horizontal', ...props }: SeparatorProps) {
|
|
13
9
|
return (
|
|
14
10
|
<SeparatorPrimitive
|
|
15
11
|
className={cn(
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
IconLayoutDashboard,
|
|
5
|
-
IconSearch,
|
|
6
|
-
IconSettings,
|
|
7
|
-
} from '@tabler/icons-react';
|
|
3
|
+
import { IconLayoutDashboard, IconSearch, IconSettings } from '@tabler/icons-react';
|
|
8
4
|
|
|
9
5
|
import { Story } from './_internal/Story';
|
|
10
6
|
import { Sidebar } from './Sidebar';
|
|
@@ -35,11 +35,7 @@ function SidebarFooter({ className, ...props }: SidebarFooterProps) {
|
|
|
35
35
|
|
|
36
36
|
function SidebarGroup({ className, ...props }: SidebarGroupProps) {
|
|
37
37
|
return (
|
|
38
|
-
<div
|
|
39
|
-
className={cn('flex flex-col gap-1', className)}
|
|
40
|
-
data-slot="sidebar-group"
|
|
41
|
-
{...props}
|
|
42
|
-
/>
|
|
38
|
+
<div className={cn('flex flex-col gap-1', className)} data-slot="sidebar-group" {...props} />
|
|
43
39
|
);
|
|
44
40
|
}
|
|
45
41
|
|
|
@@ -68,29 +64,15 @@ function SidebarHeader({ className, ...props }: SidebarHeaderProps) {
|
|
|
68
64
|
|
|
69
65
|
function SidebarMenu({ className, ...props }: SidebarMenuProps) {
|
|
70
66
|
return (
|
|
71
|
-
<nav
|
|
72
|
-
className={cn('flex flex-col gap-1', className)}
|
|
73
|
-
data-slot="sidebar-menu"
|
|
74
|
-
{...props}
|
|
75
|
-
/>
|
|
67
|
+
<nav className={cn('flex flex-col gap-1', className)} data-slot="sidebar-menu" {...props} />
|
|
76
68
|
);
|
|
77
69
|
}
|
|
78
70
|
|
|
79
71
|
function SidebarMenuItem({ className, ...props }: SidebarMenuItemProps) {
|
|
80
|
-
return (
|
|
81
|
-
<li
|
|
82
|
-
className={cn('w-full', className)}
|
|
83
|
-
data-slot="sidebar-menu-item"
|
|
84
|
-
{...props}
|
|
85
|
-
/>
|
|
86
|
-
);
|
|
72
|
+
return <li className={cn('w-full', className)} data-slot="sidebar-menu-item" {...props} />;
|
|
87
73
|
}
|
|
88
74
|
|
|
89
|
-
function SidebarMenuLink({
|
|
90
|
-
children,
|
|
91
|
-
className,
|
|
92
|
-
...props
|
|
93
|
-
}: SidebarMenuLinkProps) {
|
|
75
|
+
function SidebarMenuLink({ children, className, ...props }: SidebarMenuLinkProps) {
|
|
94
76
|
return (
|
|
95
77
|
<a
|
|
96
78
|
className={cn(
|
|
@@ -9,11 +9,7 @@ type SpinnerProps = React.ComponentProps<typeof IconLoader2>;
|
|
|
9
9
|
* Announced as a loading status by default. Pass `aria-hidden` when visible
|
|
10
10
|
* text already says what is loading, and it becomes purely decorative.
|
|
11
11
|
*/
|
|
12
|
-
function Spinner({
|
|
13
|
-
'aria-hidden': ariaHidden,
|
|
14
|
-
className,
|
|
15
|
-
...props
|
|
16
|
-
}: SpinnerProps) {
|
|
12
|
+
function Spinner({ 'aria-hidden': ariaHidden, className, ...props }: SpinnerProps) {
|
|
17
13
|
const decorative = ariaHidden === true || ariaHidden === 'true';
|
|
18
14
|
|
|
19
15
|
return (
|
|
@@ -62,9 +62,7 @@ export const All: StoryDefinition = {
|
|
|
62
62
|
<Text variant="code">{deployment.branch}</Text>
|
|
63
63
|
</Table.Cell>
|
|
64
64
|
<Table.Cell>
|
|
65
|
-
<Badge variant={deployment.statusVariant}>
|
|
66
|
-
{deployment.status}
|
|
67
|
-
</Badge>
|
|
65
|
+
<Badge variant={deployment.statusVariant}>{deployment.status}</Badge>
|
|
68
66
|
</Table.Cell>
|
|
69
67
|
</Table.Row>
|
|
70
68
|
))}
|
package/src/components/Table.tsx
CHANGED
|
@@ -36,21 +36,14 @@ function TableCaption({ className, ...props }: TableCaptionProps) {
|
|
|
36
36
|
|
|
37
37
|
function TableCell({ className, ...props }: TableCellProps) {
|
|
38
38
|
return (
|
|
39
|
-
<td
|
|
40
|
-
className={cn('p-4 align-middle text-sm', className)}
|
|
41
|
-
data-slot="table-cell"
|
|
42
|
-
{...props}
|
|
43
|
-
/>
|
|
39
|
+
<td className={cn('p-4 align-middle text-sm', className)} data-slot="table-cell" {...props} />
|
|
44
40
|
);
|
|
45
41
|
}
|
|
46
42
|
|
|
47
43
|
function TableFooter({ className, ...props }: TableFooterProps) {
|
|
48
44
|
return (
|
|
49
45
|
<tfoot
|
|
50
|
-
className={cn(
|
|
51
|
-
'bg-muted/50 border-t font-medium [&>tr]:last:border-b-0',
|
|
52
|
-
className,
|
|
53
|
-
)}
|
|
46
|
+
className={cn('bg-muted/50 border-t font-medium [&>tr]:last:border-b-0', className)}
|
|
54
47
|
data-slot="table-footer"
|
|
55
48
|
{...props}
|
|
56
49
|
/>
|
|
@@ -71,13 +64,7 @@ function TableHead({ className, ...props }: TableHeadProps) {
|
|
|
71
64
|
}
|
|
72
65
|
|
|
73
66
|
function TableHeader({ className, ...props }: TableHeaderProps) {
|
|
74
|
-
return (
|
|
75
|
-
<thead
|
|
76
|
-
className={cn('[&_tr]:border-b', className)}
|
|
77
|
-
data-slot="table-header"
|
|
78
|
-
{...props}
|
|
79
|
-
/>
|
|
80
|
-
);
|
|
67
|
+
return <thead className={cn('[&_tr]:border-b', className)} data-slot="table-header" {...props} />;
|
|
81
68
|
}
|
|
82
69
|
|
|
83
70
|
function TableRoot({
|
|
@@ -109,10 +96,7 @@ function TableRoot({
|
|
|
109
96
|
function TableRow({ className, ...props }: TableRowProps) {
|
|
110
97
|
return (
|
|
111
98
|
<tr
|
|
112
|
-
className={cn(
|
|
113
|
-
'border-border hover:bg-muted/30 border-b transition-none',
|
|
114
|
-
className,
|
|
115
|
-
)}
|
|
99
|
+
className={cn('border-border hover:bg-muted/30 border-b transition-none', className)}
|
|
116
100
|
data-slot="table-row"
|
|
117
101
|
{...props}
|
|
118
102
|
/>
|
|
@@ -129,16 +113,7 @@ const Table = Object.assign(TableRoot, {
|
|
|
129
113
|
Row: TableRow,
|
|
130
114
|
});
|
|
131
115
|
|
|
132
|
-
export {
|
|
133
|
-
Table,
|
|
134
|
-
TableBody,
|
|
135
|
-
TableCaption,
|
|
136
|
-
TableCell,
|
|
137
|
-
TableFooter,
|
|
138
|
-
TableHead,
|
|
139
|
-
TableHeader,
|
|
140
|
-
TableRow,
|
|
141
|
-
};
|
|
116
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
142
117
|
export type {
|
|
143
118
|
TableBodyProps,
|
|
144
119
|
TableCaptionProps,
|
|
@@ -35,11 +35,10 @@ const TONE_COLUMNS: { key: TextTone; label: string }[] = [
|
|
|
35
35
|
{ key: 'destructive', label: 'Destructive' },
|
|
36
36
|
];
|
|
37
37
|
|
|
38
|
-
const WEIGHT_ROWS: { key: NonNullable<TextProps['weight']>; label: string }[] =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
];
|
|
38
|
+
const WEIGHT_ROWS: { key: NonNullable<TextProps['weight']>; label: string }[] = [
|
|
39
|
+
{ key: 'normal', label: 'Normal' },
|
|
40
|
+
{ key: 'bold', label: 'Bold' },
|
|
41
|
+
];
|
|
43
42
|
|
|
44
43
|
function ToneCell({ column, row }: ComponentMatrixCellProps) {
|
|
45
44
|
return (
|
|
@@ -64,9 +63,7 @@ export const All: StoryDefinition = {
|
|
|
64
63
|
<div className="flex flex-col gap-4">
|
|
65
64
|
{VARIANT_ROWS.map(({ key, label }) => (
|
|
66
65
|
<div className="flex items-baseline gap-4" key={key}>
|
|
67
|
-
<span className="text-muted-foreground w-12 shrink-0 text-xs">
|
|
68
|
-
{label}
|
|
69
|
-
</span>
|
|
66
|
+
<span className="text-muted-foreground w-12 shrink-0 text-xs">{label}</span>
|
|
70
67
|
<Text variant={key}>
|
|
71
68
|
{key === 'code'
|
|
72
69
|
? 'npm install pickle-ui'
|
|
@@ -108,9 +105,7 @@ export const All: StoryDefinition = {
|
|
|
108
105
|
>
|
|
109
106
|
{VARIANT_ROWS.map(({ key, label }) => (
|
|
110
107
|
<div className="flex items-baseline gap-4" key={key}>
|
|
111
|
-
<span className="text-muted-foreground w-12 shrink-0 text-xs">
|
|
112
|
-
{label}
|
|
113
|
-
</span>
|
|
108
|
+
<span className="text-muted-foreground w-12 shrink-0 text-xs">{label}</span>
|
|
114
109
|
<Text variant={key}>
|
|
115
110
|
{key === 'code'
|
|
116
111
|
? 'npm install pickle-ui'
|
|
@@ -124,8 +119,8 @@ export const All: StoryDefinition = {
|
|
|
124
119
|
<Story.Section title="Truncation">
|
|
125
120
|
<div className="max-w-xs">
|
|
126
121
|
<Text className="border border-dashed" truncate variant="body">
|
|
127
|
-
This is a very long line of text that will be truncated because
|
|
128
|
-
|
|
122
|
+
This is a very long line of text that will be truncated because there is not enough
|
|
123
|
+
horizontal space to display it all.
|
|
129
124
|
</Text>
|
|
130
125
|
</div>
|
|
131
126
|
</Story.Section>
|
package/src/components/Text.tsx
CHANGED
|
@@ -67,10 +67,7 @@ function Text({
|
|
|
67
67
|
const Component = as ?? variantElement[resolvedVariant];
|
|
68
68
|
return (
|
|
69
69
|
<Component
|
|
70
|
-
className={cn(
|
|
71
|
-
textVariants({ tone, truncate, variant, weight }),
|
|
72
|
-
className,
|
|
73
|
-
)}
|
|
70
|
+
className={cn(textVariants({ tone, truncate, variant, weight }), className)}
|
|
74
71
|
data-slot="text"
|
|
75
72
|
data-tone={tone}
|
|
76
73
|
data-truncate={truncate ? '' : undefined}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
act,
|
|
3
|
-
fireEvent,
|
|
4
|
-
render,
|
|
5
|
-
screen,
|
|
6
|
-
waitFor,
|
|
7
|
-
} from '@testing-library/react';
|
|
1
|
+
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
8
2
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
9
3
|
|
|
10
4
|
import { Toast } from './Toast';
|
|
@@ -51,10 +45,7 @@ describe('Toast', () => {
|
|
|
51
45
|
expect(title).toHaveClass('text-sm');
|
|
52
46
|
expect(title).not.toHaveClass('text-body');
|
|
53
47
|
expect(screen.getByText('Your changes are live.')).toHaveClass('text-sm');
|
|
54
|
-
expect(title.closest('[data-slot="toast"]')).toHaveAttribute(
|
|
55
|
-
'data-type',
|
|
56
|
-
'success',
|
|
57
|
-
);
|
|
48
|
+
expect(title.closest('[data-slot="toast"]')).toHaveAttribute('data-type', 'success');
|
|
58
49
|
|
|
59
50
|
// Base UI hides the close button from assistive tech until the stack is
|
|
60
51
|
// expanded or focused, so look it up by its label.
|
|
@@ -75,13 +66,11 @@ describe('Toast', () => {
|
|
|
75
66
|
fireEvent.click(screen.getByRole('button', { name: 'Notify' }));
|
|
76
67
|
|
|
77
68
|
expect(await screen.findByText('Hook toast')).toBeInTheDocument();
|
|
78
|
-
expect(screen.getByText('Undo')).toHaveAttribute(
|
|
79
|
-
|
|
80
|
-
'
|
|
69
|
+
expect(screen.getByText('Undo')).toHaveAttribute('data-slot', 'toast-action');
|
|
70
|
+
expect(document.querySelector('[data-slot="toast-viewport"]')).toHaveAttribute(
|
|
71
|
+
'data-position',
|
|
72
|
+
'top-center',
|
|
81
73
|
);
|
|
82
|
-
expect(
|
|
83
|
-
document.querySelector('[data-slot="toast-viewport"]'),
|
|
84
|
-
).toHaveAttribute('data-position', 'top-center');
|
|
85
74
|
});
|
|
86
75
|
|
|
87
76
|
it('names the close button with closeLabel', async () => {
|
package/src/components/Toast.tsx
CHANGED
|
@@ -20,9 +20,7 @@ type SwipeDirection = 'down' | 'left' | 'right' | 'up';
|
|
|
20
20
|
|
|
21
21
|
type ToastActionProps = React.ComponentProps<typeof ToastPrimitive.Action>;
|
|
22
22
|
type ToastCloseProps = React.ComponentProps<typeof ToastPrimitive.Close>;
|
|
23
|
-
type ToastDescriptionProps = React.ComponentProps<
|
|
24
|
-
typeof ToastPrimitive.Description
|
|
25
|
-
>;
|
|
23
|
+
type ToastDescriptionProps = React.ComponentProps<typeof ToastPrimitive.Description>;
|
|
26
24
|
type ToastObject = ToastPrimitive.Root.ToastObject;
|
|
27
25
|
type ToastPosition =
|
|
28
26
|
| 'bottom-center'
|
|
@@ -31,9 +29,7 @@ type ToastPosition =
|
|
|
31
29
|
| 'top-center'
|
|
32
30
|
| 'top-left'
|
|
33
31
|
| 'top-right';
|
|
34
|
-
type ToastProviderProps = React.ComponentProps<
|
|
35
|
-
typeof ToastPrimitive.Provider
|
|
36
|
-
> & {
|
|
32
|
+
type ToastProviderProps = React.ComponentProps<typeof ToastPrimitive.Provider> & {
|
|
37
33
|
/**
|
|
38
34
|
* Accessible name of each toast's close button.
|
|
39
35
|
* @default 'Close'
|
|
@@ -92,10 +88,7 @@ const toastIcons: Record<string, React.ReactNode> = {
|
|
|
92
88
|
function ToastAction({ className, ...props }: ToastActionProps) {
|
|
93
89
|
return (
|
|
94
90
|
<ToastPrimitive.Action
|
|
95
|
-
className={cn(
|
|
96
|
-
buttonVariants({ size: 'xs', variant: 'outline' }),
|
|
97
|
-
className,
|
|
98
|
-
)}
|
|
91
|
+
className={cn(buttonVariants({ size: 'xs', variant: 'outline' }), className)}
|
|
99
92
|
data-slot="toast-action"
|
|
100
93
|
{...props}
|
|
101
94
|
/>
|
|
@@ -135,13 +128,7 @@ function ToastDescription({ className, ...props }: ToastDescriptionProps) {
|
|
|
135
128
|
);
|
|
136
129
|
}
|
|
137
130
|
|
|
138
|
-
function ToastList({
|
|
139
|
-
closeLabel,
|
|
140
|
-
position,
|
|
141
|
-
}: {
|
|
142
|
-
closeLabel: string;
|
|
143
|
-
position: ToastPosition;
|
|
144
|
-
}) {
|
|
131
|
+
function ToastList({ closeLabel, position }: { closeLabel: string; position: ToastPosition }) {
|
|
145
132
|
const { toasts } = ToastPrimitive.useToastManager();
|
|
146
133
|
|
|
147
134
|
return toasts.map((toast) => (
|