@pickle-ui/react 1.0.0-beta.14 → 1.0.0-beta.16
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 +23 -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/Tabs.d.ts +26 -0
- package/dist/components/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs.js +78 -0
- package/dist/components/Tabs.js.map +1 -0
- 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/entries/tabs.d.ts +3 -0
- package/dist/entries/tabs.d.ts.map +1 -0
- package/dist/entries/tabs.js +2 -0
- package/dist/entries/tabs.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.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 +33 -32
- 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/Tabs.stories.tsx +101 -0
- package/src/components/Tabs.test.tsx +129 -0
- package/src/components/Tabs.tsx +142 -0
- 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/entries/tabs.ts +8 -0
- package/src/index.ts +1 -0
- 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/Badge.tsx
CHANGED
|
@@ -17,13 +17,11 @@ const badgeVariants = cva(
|
|
|
17
17
|
sm: 'h-4 min-w-4 rounded-[.25rem] px-[calc(--spacing(1)-1px)] text-[.625rem]',
|
|
18
18
|
},
|
|
19
19
|
variant: {
|
|
20
|
-
default:
|
|
21
|
-
'bg-primary text-primary-foreground [button&,a&]:hover:bg-primary/90',
|
|
20
|
+
default: 'bg-primary text-primary-foreground [button&,a&]:hover:bg-primary/90',
|
|
22
21
|
destructive:
|
|
23
22
|
'bg-destructive text-destructive-foreground [button&,a&]:hover:bg-destructive/90',
|
|
24
23
|
error: 'bg-destructive-subtle text-destructive-subtle-foreground',
|
|
25
|
-
expired:
|
|
26
|
-
'bg-secondary text-secondary-foreground [button&,a&]:hover:bg-secondary/90',
|
|
24
|
+
expired: 'bg-secondary text-secondary-foreground [button&,a&]:hover:bg-secondary/90',
|
|
27
25
|
failed: 'bg-destructive-subtle text-destructive-subtle-foreground',
|
|
28
26
|
info: 'bg-info-subtle text-info-subtle-foreground',
|
|
29
27
|
inProgress: 'bg-info-subtle text-info-subtle-foreground',
|
|
@@ -31,8 +29,7 @@ const badgeVariants = cva(
|
|
|
31
29
|
outline:
|
|
32
30
|
'border-input bg-background text-foreground dark:bg-input/32 [button&,a&]:hover:bg-accent/50 dark:[button&,a&]:hover:bg-input/48',
|
|
33
31
|
pending: 'bg-warning-subtle text-warning-subtle-foreground',
|
|
34
|
-
secondary:
|
|
35
|
-
'bg-secondary text-secondary-foreground [button&,a&]:hover:bg-secondary/90',
|
|
32
|
+
secondary: 'bg-secondary text-secondary-foreground [button&,a&]:hover:bg-secondary/90',
|
|
36
33
|
submitted: 'bg-info-subtle text-info-subtle-foreground',
|
|
37
34
|
success: 'bg-success-subtle text-success-subtle-foreground',
|
|
38
35
|
warning: 'bg-warning-subtle text-warning-subtle-foreground',
|
|
@@ -41,15 +38,9 @@ const badgeVariants = cva(
|
|
|
41
38
|
},
|
|
42
39
|
);
|
|
43
40
|
|
|
44
|
-
interface BadgeProps
|
|
45
|
-
extends React.ComponentProps<'span'>, VariantProps<typeof badgeVariants> {}
|
|
41
|
+
interface BadgeProps extends React.ComponentProps<'span'>, VariantProps<typeof badgeVariants> {}
|
|
46
42
|
|
|
47
|
-
function Badge({
|
|
48
|
-
className,
|
|
49
|
-
size = 'md',
|
|
50
|
-
variant = 'default',
|
|
51
|
-
...props
|
|
52
|
-
}: BadgeProps) {
|
|
43
|
+
function Badge({ className, size = 'md', variant = 'default', ...props }: BadgeProps) {
|
|
53
44
|
return (
|
|
54
45
|
<span
|
|
55
46
|
className={cn(badgeVariants({ size, variant }), className)}
|
|
@@ -86,9 +86,7 @@ function ButtonContentCell({ column, row }: ComponentMatrixCellProps) {
|
|
|
86
86
|
|
|
87
87
|
return (
|
|
88
88
|
<Button variant={variant}>
|
|
89
|
-
{row.key === 'with-icon' ?
|
|
90
|
-
<IconPlus aria-hidden="true" stroke={2} />
|
|
91
|
-
) : null}
|
|
89
|
+
{row.key === 'with-icon' ? <IconPlus aria-hidden="true" stroke={2} /> : null}
|
|
92
90
|
Add
|
|
93
91
|
</Button>
|
|
94
92
|
);
|
|
@@ -107,9 +105,7 @@ function ButtonSizeCell({ column, row }: ComponentMatrixCellProps) {
|
|
|
107
105
|
|
|
108
106
|
return (
|
|
109
107
|
<Button size={size}>
|
|
110
|
-
{row.key === 'with-icon' ?
|
|
111
|
-
<IconPlus aria-hidden="true" stroke={2} />
|
|
112
|
-
) : null}
|
|
108
|
+
{row.key === 'with-icon' ? <IconPlus aria-hidden="true" stroke={2} /> : null}
|
|
113
109
|
Add
|
|
114
110
|
</Button>
|
|
115
111
|
);
|
|
@@ -127,11 +123,7 @@ export const All: StoryDefinition = {
|
|
|
127
123
|
render: () => (
|
|
128
124
|
<Story.Layout className="max-w-6xl" title="Button">
|
|
129
125
|
<Story.Section title="Variants and states">
|
|
130
|
-
<Story.Matrix
|
|
131
|
-
Cell={ButtonStateCell}
|
|
132
|
-
columns={STATE_COLUMNS}
|
|
133
|
-
rows={VARIANT_ROWS}
|
|
134
|
-
/>
|
|
126
|
+
<Story.Matrix Cell={ButtonStateCell} columns={STATE_COLUMNS} rows={VARIANT_ROWS} />
|
|
135
127
|
</Story.Section>
|
|
136
128
|
|
|
137
129
|
<Story.Section title="Content patterns">
|
|
@@ -147,11 +139,7 @@ export const All: StoryDefinition = {
|
|
|
147
139
|
</Story.Section>
|
|
148
140
|
|
|
149
141
|
<Story.Section title="Sizes">
|
|
150
|
-
<Story.Matrix
|
|
151
|
-
Cell={ButtonSizeCell}
|
|
152
|
-
columns={SIZE_COLUMNS}
|
|
153
|
-
rows={CONTENT_ROWS}
|
|
154
|
-
/>
|
|
142
|
+
<Story.Matrix Cell={ButtonSizeCell} columns={SIZE_COLUMNS} rows={CONTENT_ROWS} />
|
|
155
143
|
</Story.Section>
|
|
156
144
|
|
|
157
145
|
<Story.Section title="Render as a link">
|
|
@@ -22,9 +22,7 @@ describe('Button', () => {
|
|
|
22
22
|
const classes = [...screen.getByRole('button').classList];
|
|
23
23
|
|
|
24
24
|
expect(classes).toContain(height);
|
|
25
|
-
expect(
|
|
26
|
-
classes.filter((name) => /^sm:(h|size|min-[hw])-/.test(name)),
|
|
27
|
-
).toEqual([]);
|
|
25
|
+
expect(classes.filter((name) => /^sm:(h|size|min-[hw])-/.test(name))).toEqual([]);
|
|
28
26
|
});
|
|
29
27
|
|
|
30
28
|
it('exposes its variant and size as data attributes, defaults included', () => {
|
|
@@ -63,9 +61,10 @@ describe('Button', () => {
|
|
|
63
61
|
const { container } = render(<Button loading>Save</Button>);
|
|
64
62
|
|
|
65
63
|
expect(screen.getByRole('button', { name: 'Save' })).toBeDisabled();
|
|
66
|
-
expect(
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
expect(container.querySelector('[data-slot="button-loading-indicator"]')).toHaveAttribute(
|
|
65
|
+
'aria-hidden',
|
|
66
|
+
'true',
|
|
67
|
+
);
|
|
69
68
|
expect(screen.queryByRole('status')).not.toBeInTheDocument();
|
|
70
69
|
expect(screen.queryByLabelText('Loading')).not.toBeInTheDocument();
|
|
71
70
|
});
|
|
@@ -109,8 +108,8 @@ describe('Button', () => {
|
|
|
109
108
|
Save
|
|
110
109
|
</Button>,
|
|
111
110
|
);
|
|
112
|
-
expect(
|
|
113
|
-
|
|
114
|
-
)
|
|
111
|
+
expect(container.querySelector('[data-slot="button-loading-indicator"]')).toHaveClass(
|
|
112
|
+
'spinner-x',
|
|
113
|
+
);
|
|
115
114
|
});
|
|
116
115
|
});
|
|
@@ -52,9 +52,7 @@ const buttonVariants = cva(
|
|
|
52
52
|
);
|
|
53
53
|
|
|
54
54
|
export interface ButtonProps
|
|
55
|
-
extends
|
|
56
|
-
useRender.ComponentProps<'button'>,
|
|
57
|
-
VariantProps<typeof buttonVariants> {
|
|
55
|
+
extends useRender.ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
|
58
56
|
classNames?: SlotClassNames<'loadingIndicator'>;
|
|
59
57
|
loading?: boolean;
|
|
60
58
|
}
|
|
@@ -89,10 +87,7 @@ function Button({
|
|
|
89
87
|
{loading ? (
|
|
90
88
|
<Spinner
|
|
91
89
|
aria-hidden
|
|
92
|
-
className={cn(
|
|
93
|
-
'pointer-events-none absolute',
|
|
94
|
-
classNames?.loadingIndicator,
|
|
95
|
-
)}
|
|
90
|
+
className={cn('pointer-events-none absolute', classNames?.loadingIndicator)}
|
|
96
91
|
data-slot="button-loading-indicator"
|
|
97
92
|
/>
|
|
98
93
|
) : null}
|
|
@@ -24,9 +24,7 @@ export const All: StoryDefinition = {
|
|
|
24
24
|
<Card>
|
|
25
25
|
<Card.Header>
|
|
26
26
|
<Card.Title>Project activity</Card.Title>
|
|
27
|
-
<Card.Description>
|
|
28
|
-
Changes made in the last week.
|
|
29
|
-
</Card.Description>
|
|
27
|
+
<Card.Description>Changes made in the last week.</Card.Description>
|
|
30
28
|
<Card.Action>
|
|
31
29
|
<Button aria-label="More options" variant="ghost">
|
|
32
30
|
<IconDots />
|
|
@@ -15,9 +15,7 @@ describe('Card', () => {
|
|
|
15
15
|
</Card>,
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
expect(
|
|
19
|
-
screen.getByRole('heading', { name: 'Account' }),
|
|
20
|
-
).toBeInTheDocument();
|
|
18
|
+
expect(screen.getByRole('heading', { name: 'Account' })).toBeInTheDocument();
|
|
21
19
|
expect(screen.getByText('Manage your profile.')).toBeInTheDocument();
|
|
22
20
|
});
|
|
23
21
|
});
|
package/src/components/Card.tsx
CHANGED
|
@@ -108,15 +108,7 @@ const Card = Object.assign(CardRoot, {
|
|
|
108
108
|
Title: CardTitle,
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
export {
|
|
112
|
-
Card,
|
|
113
|
-
CardAction,
|
|
114
|
-
CardContent,
|
|
115
|
-
CardDescription,
|
|
116
|
-
CardFooter,
|
|
117
|
-
CardHeader,
|
|
118
|
-
CardTitle,
|
|
119
|
-
};
|
|
111
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
120
112
|
export type {
|
|
121
113
|
CardActionProps,
|
|
122
114
|
CardContentProps,
|
|
@@ -32,19 +32,15 @@ export const All: StoryDefinition = {
|
|
|
32
32
|
<Story.Section title="Basic">
|
|
33
33
|
<div className="flex flex-wrap gap-3">
|
|
34
34
|
<Dialog>
|
|
35
|
-
<Dialog.Trigger render={<Button variant="outline" />}>
|
|
36
|
-
Show details
|
|
37
|
-
</Dialog.Trigger>
|
|
35
|
+
<Dialog.Trigger render={<Button variant="outline" />}>Show details</Dialog.Trigger>
|
|
38
36
|
<Dialog.Content>
|
|
39
37
|
<Dialog.Header>
|
|
40
38
|
<Dialog.Title>Release notes</Dialog.Title>
|
|
41
|
-
<Dialog.Description>
|
|
42
|
-
What changed in version 1.0.
|
|
43
|
-
</Dialog.Description>
|
|
39
|
+
<Dialog.Description>What changed in version 1.0.</Dialog.Description>
|
|
44
40
|
</Dialog.Header>
|
|
45
41
|
<Text>
|
|
46
|
-
Dialogs now share their look with alert dialogs, animate in and
|
|
47
|
-
|
|
42
|
+
Dialogs now share their look with alert dialogs, animate in and out, and keep focus
|
|
43
|
+
inside until they close.
|
|
48
44
|
</Text>
|
|
49
45
|
<Dialog.Footer>
|
|
50
46
|
<Dialog.Close render={<Button />}>Got it</Dialog.Close>
|
|
@@ -59,14 +55,10 @@ export const All: StoryDefinition = {
|
|
|
59
55
|
<Dialog.Content showCloseButton={false}>
|
|
60
56
|
<Dialog.Header>
|
|
61
57
|
<Dialog.Title>Session expiring</Dialog.Title>
|
|
62
|
-
<Dialog.Description>
|
|
63
|
-
You will be signed out in two minutes.
|
|
64
|
-
</Dialog.Description>
|
|
58
|
+
<Dialog.Description>You will be signed out in two minutes.</Dialog.Description>
|
|
65
59
|
</Dialog.Header>
|
|
66
60
|
<Dialog.Footer>
|
|
67
|
-
<Dialog.Close render={<Button variant="outline" />}>
|
|
68
|
-
Sign out
|
|
69
|
-
</Dialog.Close>
|
|
61
|
+
<Dialog.Close render={<Button variant="outline" />}>Sign out</Dialog.Close>
|
|
70
62
|
<Dialog.Close render={<Button />}>Stay signed in</Dialog.Close>
|
|
71
63
|
</Dialog.Footer>
|
|
72
64
|
</Dialog.Content>
|
|
@@ -76,9 +68,7 @@ export const All: StoryDefinition = {
|
|
|
76
68
|
|
|
77
69
|
<Story.Section title="Form">
|
|
78
70
|
<Dialog>
|
|
79
|
-
<Dialog.Trigger render={<Button variant="outline" />}>
|
|
80
|
-
Edit profile
|
|
81
|
-
</Dialog.Trigger>
|
|
71
|
+
<Dialog.Trigger render={<Button variant="outline" />}>Edit profile</Dialog.Trigger>
|
|
82
72
|
<Dialog.Content>
|
|
83
73
|
<Dialog.Header>
|
|
84
74
|
<Dialog.Title>Edit profile</Dialog.Title>
|
|
@@ -97,9 +87,7 @@ export const All: StoryDefinition = {
|
|
|
97
87
|
</label>
|
|
98
88
|
</div>
|
|
99
89
|
<Dialog.Footer>
|
|
100
|
-
<Dialog.Close render={<Button variant="outline" />}>
|
|
101
|
-
Cancel
|
|
102
|
-
</Dialog.Close>
|
|
90
|
+
<Dialog.Close render={<Button variant="outline" />}>Cancel</Dialog.Close>
|
|
103
91
|
<Button type="submit">Save changes</Button>
|
|
104
92
|
</Dialog.Footer>
|
|
105
93
|
</Dialog.Content>
|
|
@@ -110,9 +98,7 @@ export const All: StoryDefinition = {
|
|
|
110
98
|
<div className="flex flex-wrap gap-3">
|
|
111
99
|
{SIZES.map(({ label, size }) => (
|
|
112
100
|
<Dialog key={size}>
|
|
113
|
-
<Dialog.Trigger render={<Button variant="outline" />}>
|
|
114
|
-
{label}
|
|
115
|
-
</Dialog.Trigger>
|
|
101
|
+
<Dialog.Trigger render={<Button variant="outline" />}>{label}</Dialog.Trigger>
|
|
116
102
|
<Dialog.Content size={size}>
|
|
117
103
|
<Dialog.Header>
|
|
118
104
|
<Dialog.Title>{label} dialog</Dialog.Title>
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fireEvent,
|
|
3
|
-
render,
|
|
4
|
-
screen,
|
|
5
|
-
waitFor,
|
|
6
|
-
within,
|
|
7
|
-
} from '@testing-library/react';
|
|
1
|
+
import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
|
8
2
|
import { describe, expect, it } from 'vitest';
|
|
9
3
|
|
|
10
4
|
import { Dialog } from './Dialog';
|
|
11
5
|
|
|
12
|
-
function renderDialog(contentProps?: {
|
|
13
|
-
closeLabel?: string;
|
|
14
|
-
showCloseButton?: boolean;
|
|
15
|
-
}) {
|
|
6
|
+
function renderDialog(contentProps?: { closeLabel?: string; showCloseButton?: boolean }) {
|
|
16
7
|
return render(
|
|
17
8
|
<Dialog>
|
|
18
9
|
<Dialog.Trigger>Edit profile</Dialog.Trigger>
|
|
@@ -54,9 +45,7 @@ describe('Dialog', () => {
|
|
|
54
45
|
const dialog = await screen.findByRole('dialog', { name: 'Profile' });
|
|
55
46
|
fireEvent.click(within(dialog).getByRole('button', { name: 'Close' }));
|
|
56
47
|
|
|
57
|
-
await waitFor(() =>
|
|
58
|
-
expect(screen.queryByRole('dialog')).not.toBeInTheDocument(),
|
|
59
|
-
);
|
|
48
|
+
await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
|
|
60
49
|
});
|
|
61
50
|
|
|
62
51
|
it('closes from Dialog.Close', async () => {
|
|
@@ -66,9 +55,7 @@ describe('Dialog', () => {
|
|
|
66
55
|
const dialog = await screen.findByRole('dialog', { name: 'Profile' });
|
|
67
56
|
fireEvent.click(within(dialog).getByRole('button', { name: 'Cancel' }));
|
|
68
57
|
|
|
69
|
-
await waitFor(() =>
|
|
70
|
-
expect(screen.queryByRole('dialog')).not.toBeInTheDocument(),
|
|
71
|
-
);
|
|
58
|
+
await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
|
|
72
59
|
});
|
|
73
60
|
|
|
74
61
|
it('names the close button with closeLabel', async () => {
|
|
@@ -77,9 +64,7 @@ describe('Dialog', () => {
|
|
|
77
64
|
|
|
78
65
|
const dialog = await screen.findByRole('dialog', { name: 'Profile' });
|
|
79
66
|
|
|
80
|
-
expect(
|
|
81
|
-
within(dialog).getByRole('button', { name: 'Fermer' }),
|
|
82
|
-
).toBeInTheDocument();
|
|
67
|
+
expect(within(dialog).getByRole('button', { name: 'Fermer' })).toBeInTheDocument();
|
|
83
68
|
});
|
|
84
69
|
|
|
85
70
|
it('omits the close button when showCloseButton is false', async () => {
|
|
@@ -88,8 +73,6 @@ describe('Dialog', () => {
|
|
|
88
73
|
|
|
89
74
|
const dialog = await screen.findByRole('dialog', { name: 'Profile' });
|
|
90
75
|
|
|
91
|
-
expect(
|
|
92
|
-
within(dialog).queryByRole('button', { name: 'Close' }),
|
|
93
|
-
).not.toBeInTheDocument();
|
|
76
|
+
expect(within(dialog).queryByRole('button', { name: 'Close' })).not.toBeInTheDocument();
|
|
94
77
|
});
|
|
95
78
|
});
|
|
@@ -24,9 +24,7 @@ type DialogContentProps = React.ComponentProps<typeof DialogPrimitive.Popup> & {
|
|
|
24
24
|
/** Maximum width of the dialog. Defaults to `md`. */
|
|
25
25
|
size?: DialogSize;
|
|
26
26
|
};
|
|
27
|
-
type DialogDescriptionProps = React.ComponentProps<
|
|
28
|
-
typeof DialogPrimitive.Description
|
|
29
|
-
>;
|
|
27
|
+
type DialogDescriptionProps = React.ComponentProps<typeof DialogPrimitive.Description>;
|
|
30
28
|
type DialogFooterProps = React.ComponentProps<'div'>;
|
|
31
29
|
type DialogHeaderProps = React.ComponentProps<'div'>;
|
|
32
30
|
type DialogProps = React.ComponentProps<typeof DialogPrimitive.Root>;
|
|
@@ -47,10 +45,7 @@ function DialogContent({
|
|
|
47
45
|
}: DialogContentProps) {
|
|
48
46
|
return (
|
|
49
47
|
<DialogPrimitive.Portal>
|
|
50
|
-
<DialogPrimitive.Backdrop
|
|
51
|
-
className={dialogBackdropClassName}
|
|
52
|
-
data-slot="dialog-backdrop"
|
|
53
|
-
/>
|
|
48
|
+
<DialogPrimitive.Backdrop className={dialogBackdropClassName} data-slot="dialog-backdrop" />
|
|
54
49
|
<DialogPrimitive.Viewport className={dialogViewportClassName}>
|
|
55
50
|
<DialogPrimitive.Popup
|
|
56
51
|
className={cn(dialogPopupVariants({ size }), className)}
|
|
@@ -87,21 +82,13 @@ function DialogDescription({ className, ...props }: DialogDescriptionProps) {
|
|
|
87
82
|
|
|
88
83
|
function DialogFooter({ className, ...props }: DialogFooterProps) {
|
|
89
84
|
return (
|
|
90
|
-
<div
|
|
91
|
-
className={cn(dialogFooterClassName, className)}
|
|
92
|
-
data-slot="dialog-footer"
|
|
93
|
-
{...props}
|
|
94
|
-
/>
|
|
85
|
+
<div className={cn(dialogFooterClassName, className)} data-slot="dialog-footer" {...props} />
|
|
95
86
|
);
|
|
96
87
|
}
|
|
97
88
|
|
|
98
89
|
function DialogHeader({ className, ...props }: DialogHeaderProps) {
|
|
99
90
|
return (
|
|
100
|
-
<div
|
|
101
|
-
className={cn(dialogHeaderClassName, className)}
|
|
102
|
-
data-slot="dialog-header"
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
91
|
+
<div className={cn(dialogHeaderClassName, className)} data-slot="dialog-header" {...props} />
|
|
105
92
|
);
|
|
106
93
|
}
|
|
107
94
|
|
|
@@ -100,17 +100,9 @@ function DrawerExample({
|
|
|
100
100
|
|
|
101
101
|
return (
|
|
102
102
|
<Drawer onOpenChange={setOpen} open={open}>
|
|
103
|
-
<Drawer.Trigger render={<Button variant="outline" />}>
|
|
104
|
-
|
|
105
|
-
|
|
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}
|
|
103
|
+
<Drawer.Trigger render={<Button variant="outline" />}>{trigger}</Drawer.Trigger>
|
|
104
|
+
<Drawer.Content showCloseButton={content === 'close-button'} size={size} variant={variant}>
|
|
105
|
+
{content === 'form' ? <ProfileForm onSaved={() => setOpen(false)} /> : null}
|
|
114
106
|
{content === 'list' ? (
|
|
115
107
|
<>
|
|
116
108
|
<Drawer.Header>
|
|
@@ -125,9 +117,7 @@ function DrawerExample({
|
|
|
125
117
|
))}
|
|
126
118
|
</Drawer.Panel>
|
|
127
119
|
<Drawer.Footer>
|
|
128
|
-
<Drawer.Close render={<Button variant="outline" />}>
|
|
129
|
-
Close
|
|
130
|
-
</Drawer.Close>
|
|
120
|
+
<Drawer.Close render={<Button variant="outline" />}>Close</Drawer.Close>
|
|
131
121
|
</Drawer.Footer>
|
|
132
122
|
</>
|
|
133
123
|
) : null}
|
|
@@ -136,8 +126,7 @@ function DrawerExample({
|
|
|
136
126
|
<Drawer.Header>
|
|
137
127
|
<Drawer.Title>Share link</Drawer.Title>
|
|
138
128
|
<Drawer.Description>
|
|
139
|
-
Anyone with the link can view this project. Press Escape or
|
|
140
|
-
click outside to close.
|
|
129
|
+
Anyone with the link can view this project. Press Escape or click outside to close.
|
|
141
130
|
</Drawer.Description>
|
|
142
131
|
</Drawer.Header>
|
|
143
132
|
<Drawer.Panel>
|
|
@@ -173,18 +162,12 @@ function ProfileForm({ onSaved }: { onSaved: () => void }) {
|
|
|
173
162
|
<Form.Field label="Name" name="name">
|
|
174
163
|
<Form.Input autoComplete="name" />
|
|
175
164
|
</Form.Field>
|
|
176
|
-
<Form.Field
|
|
177
|
-
description="Shown on your public profile."
|
|
178
|
-
label="Username"
|
|
179
|
-
name="username"
|
|
180
|
-
>
|
|
165
|
+
<Form.Field description="Shown on your public profile." label="Username" name="username">
|
|
181
166
|
<Form.Input autoComplete="username" />
|
|
182
167
|
</Form.Field>
|
|
183
168
|
</Drawer.Panel>
|
|
184
169
|
<Drawer.Footer>
|
|
185
|
-
<Drawer.Close render={<Button variant="outline" />}>
|
|
186
|
-
Cancel
|
|
187
|
-
</Drawer.Close>
|
|
170
|
+
<Drawer.Close render={<Button variant="outline" />}>Cancel</Drawer.Close>
|
|
188
171
|
<Form.Button type="submit">Save changes</Form.Button>
|
|
189
172
|
</Drawer.Footer>
|
|
190
173
|
</Form>
|
|
@@ -193,11 +176,7 @@ function ProfileForm({ onSaved }: { onSaved: () => void }) {
|
|
|
193
176
|
|
|
194
177
|
function SizeCell({ column }: ComponentMatrixCellProps) {
|
|
195
178
|
return (
|
|
196
|
-
<DrawerExample
|
|
197
|
-
content="form"
|
|
198
|
-
size={column.key as DrawerContentProps['size']}
|
|
199
|
-
trigger="Open"
|
|
200
|
-
/>
|
|
179
|
+
<DrawerExample content="form" size={column.key as DrawerContentProps['size']} trigger="Open" />
|
|
201
180
|
);
|
|
202
181
|
}
|
|
203
182
|
|
|
@@ -215,11 +194,7 @@ export const All: StoryDefinition = {
|
|
|
215
194
|
render: () => (
|
|
216
195
|
<Story.Layout className="max-w-5xl" title="Drawer">
|
|
217
196
|
<Story.Section title="Variants">
|
|
218
|
-
<Story.Matrix
|
|
219
|
-
Cell={VariantCell}
|
|
220
|
-
columns={CONTENT_COLUMNS}
|
|
221
|
-
rows={VARIANT_ROWS}
|
|
222
|
-
/>
|
|
197
|
+
<Story.Matrix Cell={VariantCell} columns={CONTENT_COLUMNS} rows={VARIANT_ROWS} />
|
|
223
198
|
</Story.Section>
|
|
224
199
|
|
|
225
200
|
<Story.Section title="Sizes">
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fireEvent,
|
|
3
|
-
render,
|
|
4
|
-
screen,
|
|
5
|
-
waitFor,
|
|
6
|
-
within,
|
|
7
|
-
} from '@testing-library/react';
|
|
1
|
+
import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
|
8
2
|
import { describe, expect, it } from 'vitest';
|
|
9
3
|
|
|
10
4
|
import { Drawer, type DrawerContentProps } from './Drawer';
|
|
@@ -68,13 +62,8 @@ describe('Drawer', () => {
|
|
|
68
62
|
|
|
69
63
|
const drawer = await openDrawer();
|
|
70
64
|
|
|
71
|
-
expect(within(drawer).getByText('Two items')).toHaveAttribute(
|
|
72
|
-
|
|
73
|
-
'drawer-panel',
|
|
74
|
-
);
|
|
75
|
-
expect(
|
|
76
|
-
drawer.querySelector('[data-slot=drawer-footer]'),
|
|
77
|
-
).toBeInTheDocument();
|
|
65
|
+
expect(within(drawer).getByText('Two items')).toHaveAttribute('data-slot', 'drawer-panel');
|
|
66
|
+
expect(drawer.querySelector('[data-slot=drawer-footer]')).toBeInTheDocument();
|
|
78
67
|
});
|
|
79
68
|
|
|
80
69
|
it('closes from the close button when showCloseButton is set', async () => {
|
|
@@ -83,22 +72,16 @@ describe('Drawer', () => {
|
|
|
83
72
|
const drawer = await openDrawer();
|
|
84
73
|
fireEvent.click(within(drawer).getByRole('button', { name: 'Close' }));
|
|
85
74
|
|
|
86
|
-
await waitFor(() =>
|
|
87
|
-
expect(screen.queryByRole('dialog')).not.toBeInTheDocument(),
|
|
88
|
-
);
|
|
75
|
+
await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
|
|
89
76
|
});
|
|
90
77
|
|
|
91
78
|
it('closes from Drawer.Close', async () => {
|
|
92
79
|
renderDrawer();
|
|
93
80
|
|
|
94
81
|
const drawer = await openDrawer();
|
|
95
|
-
fireEvent.click(
|
|
96
|
-
within(drawer).getByRole('button', { name: 'Keep shopping' }),
|
|
97
|
-
);
|
|
82
|
+
fireEvent.click(within(drawer).getByRole('button', { name: 'Keep shopping' }));
|
|
98
83
|
|
|
99
|
-
await waitFor(() =>
|
|
100
|
-
expect(screen.queryByRole('dialog')).not.toBeInTheDocument(),
|
|
101
|
-
);
|
|
84
|
+
await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
|
|
102
85
|
});
|
|
103
86
|
|
|
104
87
|
it('names the close button with closeLabel', async () => {
|
|
@@ -106,9 +89,7 @@ describe('Drawer', () => {
|
|
|
106
89
|
|
|
107
90
|
const drawer = await openDrawer();
|
|
108
91
|
|
|
109
|
-
expect(
|
|
110
|
-
within(drawer).getByRole('button', { name: 'Fermer' }),
|
|
111
|
-
).toBeInTheDocument();
|
|
92
|
+
expect(within(drawer).getByRole('button', { name: 'Fermer' })).toBeInTheDocument();
|
|
112
93
|
});
|
|
113
94
|
|
|
114
95
|
it('has no close button by default', async () => {
|
|
@@ -116,8 +97,6 @@ describe('Drawer', () => {
|
|
|
116
97
|
|
|
117
98
|
const drawer = await openDrawer();
|
|
118
99
|
|
|
119
|
-
expect(
|
|
120
|
-
within(drawer).queryByRole('button', { name: 'Close' }),
|
|
121
|
-
).not.toBeInTheDocument();
|
|
100
|
+
expect(within(drawer).queryByRole('button', { name: 'Close' })).not.toBeInTheDocument();
|
|
122
101
|
});
|
|
123
102
|
});
|
|
@@ -79,9 +79,7 @@ type DrawerContentProps = React.ComponentProps<typeof DrawerPrimitive.Popup> & {
|
|
|
79
79
|
*/
|
|
80
80
|
variant?: DrawerVariant;
|
|
81
81
|
};
|
|
82
|
-
type DrawerDescriptionProps = React.ComponentProps<
|
|
83
|
-
typeof DrawerPrimitive.Description
|
|
84
|
-
>;
|
|
82
|
+
type DrawerDescriptionProps = React.ComponentProps<typeof DrawerPrimitive.Description>;
|
|
85
83
|
type DrawerFooterProps = React.ComponentProps<'div'>;
|
|
86
84
|
type DrawerHeaderProps = React.ComponentProps<'div'>;
|
|
87
85
|
type DrawerPanelProps = React.ComponentProps<typeof DrawerPrimitive.Content>;
|
|
@@ -99,9 +97,7 @@ type DrawerProps = Omit<
|
|
|
99
97
|
type DrawerSize = NonNullable<VariantProps<typeof drawerPopupVariants>['size']>;
|
|
100
98
|
type DrawerTitleProps = React.ComponentProps<typeof DrawerPrimitive.Title>;
|
|
101
99
|
type DrawerTriggerProps = React.ComponentProps<typeof DrawerPrimitive.Trigger>;
|
|
102
|
-
type DrawerVariant = NonNullable<
|
|
103
|
-
VariantProps<typeof drawerPopupVariants>['variant']
|
|
104
|
-
>;
|
|
100
|
+
type DrawerVariant = NonNullable<VariantProps<typeof drawerPopupVariants>['variant']>;
|
|
105
101
|
|
|
106
102
|
function DrawerClose({ ...props }: DrawerCloseProps) {
|
|
107
103
|
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
|
|
@@ -118,10 +114,7 @@ function DrawerContent({
|
|
|
118
114
|
}: DrawerContentProps) {
|
|
119
115
|
return (
|
|
120
116
|
<DrawerPrimitive.Portal>
|
|
121
|
-
<DrawerPrimitive.Backdrop
|
|
122
|
-
className={drawerBackdropClassName}
|
|
123
|
-
data-slot="drawer-backdrop"
|
|
124
|
-
/>
|
|
117
|
+
<DrawerPrimitive.Backdrop className={drawerBackdropClassName} data-slot="drawer-backdrop" />
|
|
125
118
|
<DrawerPrimitive.Viewport className={drawerViewportClassName}>
|
|
126
119
|
<DrawerPrimitive.Popup
|
|
127
120
|
className={cn(
|
|
@@ -165,11 +158,7 @@ function DrawerDescription({ className, ...props }: DrawerDescriptionProps) {
|
|
|
165
158
|
function DrawerFooter({ className, ...props }: DrawerFooterProps) {
|
|
166
159
|
return (
|
|
167
160
|
<div
|
|
168
|
-
className={cn(
|
|
169
|
-
dialogFooterClassName,
|
|
170
|
-
'bg-muted/72 mt-auto border-t px-6 py-4',
|
|
171
|
-
className,
|
|
172
|
-
)}
|
|
161
|
+
className={cn(dialogFooterClassName, 'bg-muted/72 mt-auto border-t px-6 py-4', className)}
|
|
173
162
|
data-slot="drawer-footer"
|
|
174
163
|
{...props}
|
|
175
164
|
/>
|
|
@@ -17,10 +17,7 @@ type StoryDefinition = StoryObj<typeof meta>;
|
|
|
17
17
|
|
|
18
18
|
function Item({ children }: { children: string }) {
|
|
19
19
|
return (
|
|
20
|
-
<Grid
|
|
21
|
-
className="bg-muted min-h-20 rounded-md border p-4"
|
|
22
|
-
placeItems="center"
|
|
23
|
-
>
|
|
20
|
+
<Grid className="bg-muted min-h-20 rounded-md border p-4" placeItems="center">
|
|
24
21
|
<Text>{children}</Text>
|
|
25
22
|
</Grid>
|
|
26
23
|
);
|
|
@@ -34,9 +34,7 @@ describe('Grid', () => {
|
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
it('supports polymorphism and forwards native props', () => {
|
|
37
|
-
render(
|
|
38
|
-
<Grid aria-label="results" as="section" className="md:grid-cols-4" />,
|
|
39
|
-
);
|
|
37
|
+
render(<Grid aria-label="results" as="section" className="md:grid-cols-4" />);
|
|
40
38
|
|
|
41
39
|
const element = screen.getByLabelText('results');
|
|
42
40
|
expect(element.tagName.toLowerCase()).toBe('section');
|
package/src/components/Grid.tsx
CHANGED
|
@@ -92,14 +92,14 @@ function Grid({
|
|
|
92
92
|
<Component
|
|
93
93
|
className={cn(
|
|
94
94
|
'grid',
|
|
95
|
-
getLayoutClasses({ align, gap, gapX, gapY, justify }),
|
|
96
95
|
columns === undefined ? undefined : columnClasses[columns],
|
|
97
96
|
flow === undefined ? undefined : flowClasses[flow],
|
|
98
|
-
placeContent === undefined
|
|
99
|
-
? undefined
|
|
100
|
-
: placeContentClasses[placeContent],
|
|
97
|
+
placeContent === undefined ? undefined : placeContentClasses[placeContent],
|
|
101
98
|
placeItems === undefined ? undefined : placeItemsClasses[placeItems],
|
|
102
99
|
rows === undefined ? undefined : rowClasses[rows],
|
|
100
|
+
// After the place-* shorthands, which tailwind-merge lets override
|
|
101
|
+
// them, so align and justify keep winning as they do in CSS.
|
|
102
|
+
getLayoutClasses({ align, gap, gapX, gapY, justify }),
|
|
103
103
|
className,
|
|
104
104
|
)}
|
|
105
105
|
data-slot="grid"
|