@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
|
@@ -39,17 +39,11 @@ function TooltipMatrixCell({ column, row }: ComponentMatrixCellProps) {
|
|
|
39
39
|
return (
|
|
40
40
|
<Tooltip>
|
|
41
41
|
{row.key === 'icon' ? (
|
|
42
|
-
<Tooltip.Trigger
|
|
43
|
-
render={
|
|
44
|
-
<Button aria-label="Copy link" size="icon" variant="outline" />
|
|
45
|
-
}
|
|
46
|
-
>
|
|
42
|
+
<Tooltip.Trigger render={<Button aria-label="Copy link" size="icon" variant="outline" />}>
|
|
47
43
|
<IconCopy />
|
|
48
44
|
</Tooltip.Trigger>
|
|
49
45
|
) : (
|
|
50
|
-
<Tooltip.Trigger render={<Button variant="outline" />}>
|
|
51
|
-
Hover me
|
|
52
|
-
</Tooltip.Trigger>
|
|
46
|
+
<Tooltip.Trigger render={<Button variant="outline" />}>Hover me</Tooltip.Trigger>
|
|
53
47
|
)}
|
|
54
48
|
<Tooltip.Content side={side}>
|
|
55
49
|
{row.key === 'icon' ? 'Copy link' : `Shown on the ${column.label}`}
|
|
@@ -62,11 +56,7 @@ export const All: StoryDefinition = {
|
|
|
62
56
|
render: () => (
|
|
63
57
|
<Story.Layout className="max-w-6xl" title="Tooltip">
|
|
64
58
|
<Story.Section title="Sides and triggers">
|
|
65
|
-
<Story.Matrix
|
|
66
|
-
Cell={TooltipMatrixCell}
|
|
67
|
-
columns={SIDE_COLUMNS}
|
|
68
|
-
rows={TRIGGER_ROWS}
|
|
69
|
-
/>
|
|
59
|
+
<Story.Matrix Cell={TooltipMatrixCell} columns={SIDE_COLUMNS} rows={TRIGGER_ROWS} />
|
|
70
60
|
</Story.Section>
|
|
71
61
|
<Story.Section title="Shared delay with Provider">
|
|
72
62
|
<Text className="mb-4" tone="muted">
|
|
@@ -75,24 +65,14 @@ export const All: StoryDefinition = {
|
|
|
75
65
|
<Tooltip.Provider delay={300}>
|
|
76
66
|
<div className="flex gap-2">
|
|
77
67
|
<Tooltip>
|
|
78
|
-
<Tooltip.Trigger
|
|
79
|
-
render={
|
|
80
|
-
<Button aria-label="Edit" size="icon" variant="outline" />
|
|
81
|
-
}
|
|
82
|
-
>
|
|
68
|
+
<Tooltip.Trigger render={<Button aria-label="Edit" size="icon" variant="outline" />}>
|
|
83
69
|
<IconEdit />
|
|
84
70
|
</Tooltip.Trigger>
|
|
85
71
|
<Tooltip.Content>Edit</Tooltip.Content>
|
|
86
72
|
</Tooltip>
|
|
87
73
|
<Tooltip>
|
|
88
74
|
<Tooltip.Trigger
|
|
89
|
-
render={
|
|
90
|
-
<Button
|
|
91
|
-
aria-label="Duplicate"
|
|
92
|
-
size="icon"
|
|
93
|
-
variant="outline"
|
|
94
|
-
/>
|
|
95
|
-
}
|
|
75
|
+
render={<Button aria-label="Duplicate" size="icon" variant="outline" />}
|
|
96
76
|
>
|
|
97
77
|
<IconCopy />
|
|
98
78
|
</Tooltip.Trigger>
|
|
@@ -100,9 +80,7 @@ export const All: StoryDefinition = {
|
|
|
100
80
|
</Tooltip>
|
|
101
81
|
<Tooltip>
|
|
102
82
|
<Tooltip.Trigger
|
|
103
|
-
render={
|
|
104
|
-
<Button aria-label="Delete" size="icon" variant="outline" />
|
|
105
|
-
}
|
|
83
|
+
render={<Button aria-label="Delete" size="icon" variant="outline" />}
|
|
106
84
|
>
|
|
107
85
|
<IconTrash />
|
|
108
86
|
</Tooltip.Trigger>
|
|
@@ -18,10 +18,7 @@ describe('Tooltip', () => {
|
|
|
18
18
|
'data-slot',
|
|
19
19
|
'tooltip-trigger',
|
|
20
20
|
);
|
|
21
|
-
expect(screen.getByText('Save changes')).toHaveAttribute(
|
|
22
|
-
'data-slot',
|
|
23
|
-
'tooltip-content',
|
|
24
|
-
);
|
|
21
|
+
expect(screen.getByText('Save changes')).toHaveAttribute('data-slot', 'tooltip-content');
|
|
25
22
|
});
|
|
26
23
|
|
|
27
24
|
it('does not render the content while closed', () => {
|
|
@@ -43,9 +40,6 @@ describe('Tooltip', () => {
|
|
|
43
40
|
</Tooltip>,
|
|
44
41
|
);
|
|
45
42
|
|
|
46
|
-
expect(screen.getByText('Save changes')).toHaveAttribute(
|
|
47
|
-
'data-side',
|
|
48
|
-
'bottom',
|
|
49
|
-
);
|
|
43
|
+
expect(screen.getByText('Save changes')).toHaveAttribute('data-side', 'bottom');
|
|
50
44
|
});
|
|
51
45
|
});
|
|
@@ -9,12 +9,8 @@ type TooltipContentProps = Pick<
|
|
|
9
9
|
> &
|
|
10
10
|
React.ComponentProps<typeof TooltipPrimitive.Popup>;
|
|
11
11
|
type TooltipProps = React.ComponentProps<typeof TooltipPrimitive.Root>;
|
|
12
|
-
type TooltipProviderProps = React.ComponentProps<
|
|
13
|
-
|
|
14
|
-
>;
|
|
15
|
-
type TooltipTriggerProps = React.ComponentProps<
|
|
16
|
-
typeof TooltipPrimitive.Trigger
|
|
17
|
-
>;
|
|
12
|
+
type TooltipProviderProps = React.ComponentProps<typeof TooltipPrimitive.Provider>;
|
|
13
|
+
type TooltipTriggerProps = React.ComponentProps<typeof TooltipPrimitive.Trigger>;
|
|
18
14
|
|
|
19
15
|
function TooltipContent({
|
|
20
16
|
align = 'center',
|
|
@@ -72,9 +68,4 @@ const Tooltip = Object.assign(TooltipRoot, {
|
|
|
72
68
|
});
|
|
73
69
|
|
|
74
70
|
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
75
|
-
export type {
|
|
76
|
-
TooltipContentProps,
|
|
77
|
-
TooltipProps,
|
|
78
|
-
TooltipProviderProps,
|
|
79
|
-
TooltipTriggerProps,
|
|
80
|
-
};
|
|
71
|
+
export type { TooltipContentProps, TooltipProps, TooltipProviderProps, TooltipTriggerProps };
|
|
@@ -16,9 +16,7 @@ export default meta;
|
|
|
16
16
|
type StoryDefinition = StoryObj<typeof meta>;
|
|
17
17
|
|
|
18
18
|
function Item({ children }: { children: string }) {
|
|
19
|
-
return
|
|
20
|
-
<Text className="bg-muted rounded-md border px-4 py-3">{children}</Text>
|
|
21
|
-
);
|
|
19
|
+
return <Text className="bg-muted rounded-md border px-4 py-3">{children}</Text>;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
export const All: StoryDefinition = {
|
|
@@ -45,11 +43,9 @@ export const All: StoryDefinition = {
|
|
|
45
43
|
|
|
46
44
|
<Story.Section title="Wrapping">
|
|
47
45
|
<XStack gap={2} wrap="wrap">
|
|
48
|
-
{['Design', 'Engineering', 'Product', 'Research', 'Support'].map(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
),
|
|
52
|
-
)}
|
|
46
|
+
{['Design', 'Engineering', 'Product', 'Research', 'Support'].map((label) => (
|
|
47
|
+
<Item key={label}>{label}</Item>
|
|
48
|
+
))}
|
|
53
49
|
</XStack>
|
|
54
50
|
</Story.Section>
|
|
55
51
|
|
|
@@ -22,9 +22,7 @@ describe('XStack', () => {
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
it('supports polymorphism, native props, and responsive overrides', () => {
|
|
25
|
-
render(
|
|
26
|
-
<XStack aria-label="actions" as="nav" className="max-md:flex-col" />,
|
|
27
|
-
);
|
|
25
|
+
render(<XStack aria-label="actions" as="nav" className="max-md:flex-col" />);
|
|
28
26
|
|
|
29
27
|
const element = screen.getByLabelText('actions');
|
|
30
28
|
expect(element.tagName.toLowerCase()).toBe('nav');
|
|
@@ -57,9 +55,7 @@ describe('XStack', () => {
|
|
|
57
55
|
|
|
58
56
|
const stack = container.firstElementChild!;
|
|
59
57
|
expect(
|
|
60
|
-
[...stack.children].map(
|
|
61
|
-
(child) => child.getAttribute('data-slot') ?? child.textContent,
|
|
62
|
-
),
|
|
58
|
+
[...stack.children].map((child) => child.getAttribute('data-slot') ?? child.textContent),
|
|
63
59
|
).toEqual(['A', 'separator', 'B', 'separator', 'C']);
|
|
64
60
|
});
|
|
65
61
|
|
|
@@ -97,9 +93,10 @@ describe('XStack', () => {
|
|
|
97
93
|
);
|
|
98
94
|
|
|
99
95
|
expect(screen.queryAllByRole('separator')).toHaveLength(0);
|
|
100
|
-
expect(
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
expect(screen.getAllByRole('separator', { hidden: true })[0]).toHaveAttribute(
|
|
97
|
+
'aria-hidden',
|
|
98
|
+
'true',
|
|
99
|
+
);
|
|
103
100
|
expect(screen.getByRole('list').children).toHaveLength(3);
|
|
104
101
|
});
|
|
105
102
|
|
|
@@ -111,10 +108,7 @@ describe('XStack', () => {
|
|
|
111
108
|
</XStack>,
|
|
112
109
|
);
|
|
113
110
|
|
|
114
|
-
expect(separators(container)[0]).toHaveAttribute(
|
|
115
|
-
'data-orientation',
|
|
116
|
-
'vertical',
|
|
117
|
-
);
|
|
111
|
+
expect(separators(container)[0]).toHaveAttribute('data-orientation', 'vertical');
|
|
118
112
|
});
|
|
119
113
|
|
|
120
114
|
it('renders the node a separator function returns', () => {
|
|
@@ -132,14 +126,9 @@ describe('XStack', () => {
|
|
|
132
126
|
|
|
133
127
|
const stack = container.firstElementChild!;
|
|
134
128
|
expect(
|
|
135
|
-
[...stack.children].map(
|
|
136
|
-
(child) => child.getAttribute('data-testid') ?? child.textContent,
|
|
137
|
-
),
|
|
129
|
+
[...stack.children].map((child) => child.getAttribute('data-testid') ?? child.textContent),
|
|
138
130
|
).toEqual(['A', 'rule-0', 'B', 'rule-1', 'C']);
|
|
139
|
-
expect(screen.getByTestId('rule-0')).toHaveAttribute(
|
|
140
|
-
'data-orientation',
|
|
141
|
-
'vertical',
|
|
142
|
-
);
|
|
131
|
+
expect(screen.getByTestId('rule-0')).toHaveAttribute('data-orientation', 'vertical');
|
|
143
132
|
expect(separators(container)).toHaveLength(0);
|
|
144
133
|
});
|
|
145
134
|
});
|
|
@@ -11,20 +11,9 @@ type XStackProps = Omit<FlexProps, 'direction'> & {
|
|
|
11
11
|
separator?: boolean | RenderSeparator;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
function XStack({
|
|
15
|
-
children,
|
|
16
|
-
className,
|
|
17
|
-
ref,
|
|
18
|
-
separator,
|
|
19
|
-
...props
|
|
20
|
-
}: XStackProps) {
|
|
14
|
+
function XStack({ children, className, ref, separator, ...props }: XStackProps) {
|
|
21
15
|
return (
|
|
22
|
-
<Flex
|
|
23
|
-
className={cn('flex-row', className)}
|
|
24
|
-
data-slot="x-stack"
|
|
25
|
-
ref={ref}
|
|
26
|
-
{...props}
|
|
27
|
-
>
|
|
16
|
+
<Flex className={cn('flex-row', className)} data-slot="x-stack" ref={ref} {...props}>
|
|
28
17
|
{separate(children, 'vertical', separator)}
|
|
29
18
|
</Flex>
|
|
30
19
|
);
|
|
@@ -17,9 +17,7 @@ export default meta;
|
|
|
17
17
|
type StoryDefinition = StoryObj<typeof meta>;
|
|
18
18
|
|
|
19
19
|
function Item({ children }: { children: string }) {
|
|
20
|
-
return
|
|
21
|
-
<Text className="bg-muted rounded-md border px-4 py-3">{children}</Text>
|
|
22
|
-
);
|
|
20
|
+
return <Text className="bg-muted rounded-md border px-4 py-3">{children}</Text>;
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
export const All: StoryDefinition = {
|
|
@@ -67,11 +65,7 @@ export const All: StoryDefinition = {
|
|
|
67
65
|
<YStack
|
|
68
66
|
gap={3}
|
|
69
67
|
separator={({ orientation }) => (
|
|
70
|
-
<Separator
|
|
71
|
-
aria-hidden
|
|
72
|
-
className="bg-primary"
|
|
73
|
-
orientation={orientation}
|
|
74
|
-
/>
|
|
68
|
+
<Separator aria-hidden className="bg-primary" orientation={orientation} />
|
|
75
69
|
)}
|
|
76
70
|
>
|
|
77
71
|
<Item>Groceries</Item>
|
|
@@ -11,20 +11,9 @@ type YStackProps = Omit<FlexProps, 'direction'> & {
|
|
|
11
11
|
separator?: boolean | RenderSeparator;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
function YStack({
|
|
15
|
-
children,
|
|
16
|
-
className,
|
|
17
|
-
ref,
|
|
18
|
-
separator,
|
|
19
|
-
...props
|
|
20
|
-
}: YStackProps) {
|
|
14
|
+
function YStack({ children, className, ref, separator, ...props }: YStackProps) {
|
|
21
15
|
return (
|
|
22
|
-
<Flex
|
|
23
|
-
className={cn('flex-col', className)}
|
|
24
|
-
data-slot="y-stack"
|
|
25
|
-
ref={ref}
|
|
26
|
-
{...props}
|
|
27
|
-
>
|
|
16
|
+
<Flex className={cn('flex-col', className)} data-slot="y-stack" ref={ref} {...props}>
|
|
28
17
|
{separate(children, 'horizontal', separator)}
|
|
29
18
|
</Flex>
|
|
30
19
|
);
|
|
@@ -66,12 +66,7 @@ function Matrix({
|
|
|
66
66
|
: `minmax(${cellWidth}, 1fr)`;
|
|
67
67
|
|
|
68
68
|
return (
|
|
69
|
-
<div
|
|
70
|
-
className={cn(
|
|
71
|
-
'border-border bg-card/20 overflow-x-auto rounded-md border',
|
|
72
|
-
className,
|
|
73
|
-
)}
|
|
74
|
-
>
|
|
69
|
+
<div className={cn('border-border bg-card/20 overflow-x-auto rounded-md border', className)}>
|
|
75
70
|
<div
|
|
76
71
|
className="grid min-w-max"
|
|
77
72
|
style={{
|
|
@@ -87,13 +82,9 @@ function Matrix({
|
|
|
87
82
|
)}
|
|
88
83
|
key={column.key}
|
|
89
84
|
>
|
|
90
|
-
<div className="text-foreground text-sm font-medium">
|
|
91
|
-
{column.label}
|
|
92
|
-
</div>
|
|
85
|
+
<div className="text-foreground text-sm font-medium">{column.label}</div>
|
|
93
86
|
{column.description ? (
|
|
94
|
-
<div className="text-muted-foreground mt-1 text-xs">
|
|
95
|
-
{column.description}
|
|
96
|
-
</div>
|
|
87
|
+
<div className="text-muted-foreground mt-1 text-xs">{column.description}</div>
|
|
97
88
|
) : null}
|
|
98
89
|
</div>
|
|
99
90
|
))}
|
|
@@ -106,13 +97,9 @@ function Matrix({
|
|
|
106
97
|
rowIndex < rows.length - 1 && 'border-b',
|
|
107
98
|
)}
|
|
108
99
|
>
|
|
109
|
-
<div className="text-foreground text-sm font-medium">
|
|
110
|
-
{row.label}
|
|
111
|
-
</div>
|
|
100
|
+
<div className="text-foreground text-sm font-medium">{row.label}</div>
|
|
112
101
|
{row.description ? (
|
|
113
|
-
<div className="text-muted-foreground mt-1 max-w-40 text-xs">
|
|
114
|
-
{row.description}
|
|
115
|
-
</div>
|
|
102
|
+
<div className="text-muted-foreground mt-1 max-w-40 text-xs">{row.description}</div>
|
|
116
103
|
) : null}
|
|
117
104
|
</div>
|
|
118
105
|
{columns.map((column, columnIndex) => (
|
|
@@ -153,8 +140,4 @@ const Story = Object.assign(Layout, {
|
|
|
153
140
|
});
|
|
154
141
|
|
|
155
142
|
export { Story };
|
|
156
|
-
export type {
|
|
157
|
-
ComponentMatrixCellProps,
|
|
158
|
-
ComponentMatrixColumn,
|
|
159
|
-
ComponentMatrixRow,
|
|
160
|
-
};
|
|
143
|
+
export type { ComponentMatrixCellProps, ComponentMatrixColumn, ComponentMatrixRow };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
|
|
5
|
-
/* eslint-disable react
|
|
5
|
+
/* eslint-disable react/refs -- prevValueRef is read during render on purpose: it holds the previous value and never affects the output. */
|
|
6
6
|
|
|
7
7
|
type InputValue = string | string[];
|
|
8
8
|
|
|
@@ -34,8 +34,7 @@ function useElementSize(element: HTMLElement | null) {
|
|
|
34
34
|
},
|
|
35
35
|
[element],
|
|
36
36
|
);
|
|
37
|
-
const getSnapshot = () =>
|
|
38
|
-
element ? `${element.offsetWidth}x${element.offsetHeight}` : '';
|
|
37
|
+
const getSnapshot = () => (element ? `${element.offsetWidth}x${element.offsetHeight}` : '');
|
|
39
38
|
const snapshot = React.useSyncExternalStore(subscribe, getSnapshot, () => '');
|
|
40
39
|
|
|
41
40
|
return React.useMemo(() => {
|
|
@@ -46,9 +45,7 @@ function useElementSize(element: HTMLElement | null) {
|
|
|
46
45
|
}, [snapshot]);
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
function VisuallyHiddenInput<T = InputValue>(
|
|
50
|
-
props: VisuallyHiddenInputProps<T>,
|
|
51
|
-
) {
|
|
48
|
+
function VisuallyHiddenInput<T = InputValue>(props: VisuallyHiddenInputProps<T>) {
|
|
52
49
|
const {
|
|
53
50
|
bubbles = true,
|
|
54
51
|
checked,
|
|
@@ -114,9 +111,7 @@ function VisuallyHiddenInput<T = InputValue>(
|
|
|
114
111
|
const composedStyle = React.useMemo<React.CSSProperties>(() => {
|
|
115
112
|
return {
|
|
116
113
|
...style,
|
|
117
|
-
...(controlSize.width !== undefined && controlSize.height !== undefined
|
|
118
|
-
? controlSize
|
|
119
|
-
: {}),
|
|
114
|
+
...(controlSize.width !== undefined && controlSize.height !== undefined ? controlSize : {}),
|
|
120
115
|
border: 0,
|
|
121
116
|
clip: 'rect(0 0 0 0)',
|
|
122
117
|
clipPath: 'inset(50%)',
|
|
@@ -29,8 +29,7 @@ const dialogPopupVariants = cva(
|
|
|
29
29
|
|
|
30
30
|
const dialogHeaderClassName = 'flex flex-col gap-1.5 text-center sm:text-start';
|
|
31
31
|
|
|
32
|
-
const dialogFooterClassName =
|
|
33
|
-
'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end';
|
|
32
|
+
const dialogFooterClassName = 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end';
|
|
34
33
|
|
|
35
34
|
const dialogTitleClassName = cn(
|
|
36
35
|
textVariants({ variant: 'h4' }),
|
|
@@ -83,13 +83,7 @@ type LayoutStyleProps = {
|
|
|
83
83
|
justify?: LayoutJustify;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
function getLayoutClasses({
|
|
87
|
-
align,
|
|
88
|
-
gap,
|
|
89
|
-
gapX,
|
|
90
|
-
gapY,
|
|
91
|
-
justify,
|
|
92
|
-
}: LayoutStyleProps) {
|
|
86
|
+
function getLayoutClasses({ align, gap, gapX, gapY, justify }: LayoutStyleProps) {
|
|
93
87
|
return cn(
|
|
94
88
|
align === undefined ? undefined : alignClasses[align],
|
|
95
89
|
gap === undefined ? undefined : gapClasses[gap],
|
|
@@ -26,13 +26,10 @@ export function separate(
|
|
|
26
26
|
const render = separator === true ? renderSeparator : separator;
|
|
27
27
|
|
|
28
28
|
// `toArray` drops empty children; `map` then keys each fragment by its child.
|
|
29
|
-
return React.Children.map(
|
|
30
|
-
React.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
</React.Fragment>
|
|
36
|
-
),
|
|
37
|
-
);
|
|
29
|
+
return React.Children.map(React.Children.toArray(children), (child, index) => (
|
|
30
|
+
<React.Fragment>
|
|
31
|
+
{index > 0 && render({ index: index - 1, orientation })}
|
|
32
|
+
{child}
|
|
33
|
+
</React.Fragment>
|
|
34
|
+
));
|
|
38
35
|
}
|
|
@@ -14,9 +14,7 @@ describe('Checkbox', () => {
|
|
|
14
14
|
|
|
15
15
|
it('renders the control as a native button for sibling labels', () => {
|
|
16
16
|
render(<Checkbox aria-label="Accept" />);
|
|
17
|
-
expect(screen.getByRole('checkbox', { name: 'Accept' }).tagName).toBe(
|
|
18
|
-
'BUTTON',
|
|
19
|
-
);
|
|
17
|
+
expect(screen.getByRole('checkbox', { name: 'Accept' }).tagName).toBe('BUTTON');
|
|
20
18
|
});
|
|
21
19
|
|
|
22
20
|
it('toggles on click', () => {
|
|
@@ -65,9 +63,7 @@ describe('Checkbox', () => {
|
|
|
65
63
|
|
|
66
64
|
it('merges custom className', () => {
|
|
67
65
|
render(<Checkbox aria-label="Accept" className="my-class" />);
|
|
68
|
-
const root = screen
|
|
69
|
-
.getByRole('checkbox', { name: 'Accept' })
|
|
70
|
-
.closest('[data-slot="checkbox"]');
|
|
66
|
+
const root = screen.getByRole('checkbox', { name: 'Accept' }).closest('[data-slot="checkbox"]');
|
|
71
67
|
expect(root).toHaveClass('my-class');
|
|
72
68
|
});
|
|
73
69
|
|
|
@@ -78,10 +74,7 @@ describe('Checkbox', () => {
|
|
|
78
74
|
<Checkbox.Label htmlFor="cb-compose">Composed label</Checkbox.Label>
|
|
79
75
|
</>,
|
|
80
76
|
);
|
|
81
|
-
expect(screen.getByText('Composed label')).toHaveAttribute(
|
|
82
|
-
'data-slot',
|
|
83
|
-
'checkbox-label',
|
|
84
|
-
);
|
|
77
|
+
expect(screen.getByText('Composed label')).toHaveAttribute('data-slot', 'checkbox-label');
|
|
85
78
|
});
|
|
86
79
|
|
|
87
80
|
it('applies classNames to the field, indicator, and label slots', () => {
|
|
@@ -96,12 +89,8 @@ describe('Checkbox', () => {
|
|
|
96
89
|
label="Accept"
|
|
97
90
|
/>,
|
|
98
91
|
);
|
|
99
|
-
expect(container.querySelector('[data-slot="checkbox-field"]')).toHaveClass(
|
|
100
|
-
|
|
101
|
-
);
|
|
102
|
-
expect(
|
|
103
|
-
container.querySelector('[data-slot="checkbox-indicator"]'),
|
|
104
|
-
).toHaveClass('indicator-x');
|
|
92
|
+
expect(container.querySelector('[data-slot="checkbox-field"]')).toHaveClass('field-x');
|
|
93
|
+
expect(container.querySelector('[data-slot="checkbox-indicator"]')).toHaveClass('indicator-x');
|
|
105
94
|
expect(screen.getByText('Accept')).toHaveClass('label-x');
|
|
106
95
|
});
|
|
107
96
|
});
|
|
@@ -75,10 +75,7 @@ function CheckboxRoot({ classNames, id, label, ...props }: CheckboxProps) {
|
|
|
75
75
|
const checkboxId = id ?? generatedId;
|
|
76
76
|
|
|
77
77
|
return (
|
|
78
|
-
<div
|
|
79
|
-
className={cn('flex items-center gap-2', classNames?.field)}
|
|
80
|
-
data-slot="checkbox-field"
|
|
81
|
-
>
|
|
78
|
+
<div className={cn('flex items-center gap-2', classNames?.field)} data-slot="checkbox-field">
|
|
82
79
|
<CheckboxControl classNames={classNames} id={checkboxId} {...props} />
|
|
83
80
|
<CheckboxLabel className={classNames?.label} htmlFor={checkboxId}>
|
|
84
81
|
{label}
|
|
@@ -55,9 +55,7 @@ function formatColor(hex: string, format: ColorFormat) {
|
|
|
55
55
|
const diff = max - min;
|
|
56
56
|
const lightness = (max + min) / 2;
|
|
57
57
|
const saturation =
|
|
58
|
-
diff === 0
|
|
59
|
-
? 0
|
|
60
|
-
: diff / (format === 'hsl' ? 1 - Math.abs(2 * lightness - 1) : max);
|
|
58
|
+
diff === 0 ? 0 : diff / (format === 'hsl' ? 1 - Math.abs(2 * lightness - 1) : max);
|
|
61
59
|
const hue =
|
|
62
60
|
diff === 0
|
|
63
61
|
? 0
|
|
@@ -101,9 +99,7 @@ function PickerControls() {
|
|
|
101
99
|
function PickerPreview({ format, mode }: { format: string; mode: string }) {
|
|
102
100
|
const initialColor = mode === 'disabled' ? '#94a3b8' : '#3b82f6';
|
|
103
101
|
const colorFormat = format as ColorFormat;
|
|
104
|
-
const [color, setColor] = useState(() =>
|
|
105
|
-
formatColor(initialColor, colorFormat),
|
|
106
|
-
);
|
|
102
|
+
const [color, setColor] = useState(() => formatColor(initialColor, colorFormat));
|
|
107
103
|
|
|
108
104
|
if (mode === 'inline') {
|
|
109
105
|
return (
|
|
@@ -129,10 +125,7 @@ function PickerPreview({ format, mode }: { format: string; mode: string }) {
|
|
|
129
125
|
disabled={mode === 'disabled'}
|
|
130
126
|
onValueChange={setColor}
|
|
131
127
|
>
|
|
132
|
-
<ColorPicker.Trigger
|
|
133
|
-
className="w-52 justify-start gap-2"
|
|
134
|
-
variant="outline"
|
|
135
|
-
>
|
|
128
|
+
<ColorPicker.Trigger className="w-52 justify-start gap-2" variant="outline">
|
|
136
129
|
<ColorPicker.Swatch className="size-5" />
|
|
137
130
|
<span className="font-mono">{color}</span>
|
|
138
131
|
</ColorPicker.Trigger>
|
|
@@ -19,9 +19,7 @@ describe('ColorPicker', () => {
|
|
|
19
19
|
|
|
20
20
|
const trigger = screen.getByRole('button', { name: /Pick a color/ });
|
|
21
21
|
expect(trigger).toHaveAttribute('data-slot', 'color-picker-trigger');
|
|
22
|
-
expect(
|
|
23
|
-
screen.getByRole('img', { name: /Current color/ }),
|
|
24
|
-
).toBeInTheDocument();
|
|
22
|
+
expect(screen.getByRole('img', { name: /Current color/ })).toBeInTheDocument();
|
|
25
23
|
|
|
26
24
|
fireEvent.click(trigger);
|
|
27
25
|
|
|
@@ -14,15 +14,11 @@ import {
|
|
|
14
14
|
ColorPickerTrigger,
|
|
15
15
|
} from './ColorPickerPrimitive';
|
|
16
16
|
|
|
17
|
-
type ColorPickerAlphaSliderProps = ComponentProps<
|
|
18
|
-
typeof ColorPickerAlphaSlider
|
|
19
|
-
>;
|
|
17
|
+
type ColorPickerAlphaSliderProps = ComponentProps<typeof ColorPickerAlphaSlider>;
|
|
20
18
|
type ColorPickerAreaProps = ComponentProps<typeof ColorPickerArea>;
|
|
21
19
|
type ColorPickerContentProps = ComponentProps<typeof ColorPickerContent>;
|
|
22
20
|
type ColorPickerEyeDropperProps = ComponentProps<typeof ColorPickerEyeDropper>;
|
|
23
|
-
type ColorPickerFormatSelectProps = ComponentProps<
|
|
24
|
-
typeof ColorPickerFormatSelect
|
|
25
|
-
>;
|
|
21
|
+
type ColorPickerFormatSelectProps = ComponentProps<typeof ColorPickerFormatSelect>;
|
|
26
22
|
type ColorPickerHueSliderProps = ComponentProps<typeof ColorPickerHueSlider>;
|
|
27
23
|
type ColorPickerInputProps = ComponentProps<typeof ColorPickerInput>;
|
|
28
24
|
type ColorPickerSwatchProps = ComponentProps<typeof ColorPickerSwatch>;
|