@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.
Files changed (272) hide show
  1. package/README.md +23 -12
  2. package/dist/components/Alert.d.ts +1 -1
  3. package/dist/components/Alert.d.ts.map +1 -1
  4. package/dist/components/Alert.js.map +1 -1
  5. package/dist/components/AlertDialog.d.ts.map +1 -1
  6. package/dist/components/AlertDialog.js +3 -3
  7. package/dist/components/AlertDialog.js.map +1 -1
  8. package/dist/components/Avatar.d.ts +1 -1
  9. package/dist/components/Avatar.d.ts.map +1 -1
  10. package/dist/components/Avatar.js.map +1 -1
  11. package/dist/components/Badge.d.ts +2 -2
  12. package/dist/components/Badge.d.ts.map +1 -1
  13. package/dist/components/Badge.js.map +1 -1
  14. package/dist/components/Button.d.ts +2 -2
  15. package/dist/components/Button.d.ts.map +1 -1
  16. package/dist/components/Button.js +1 -1
  17. package/dist/components/Button.js.map +1 -1
  18. package/dist/components/Card.d.ts +1 -1
  19. package/dist/components/Card.d.ts.map +1 -1
  20. package/dist/components/Card.js +1 -1
  21. package/dist/components/Card.js.map +1 -1
  22. package/dist/components/Dialog.d.ts.map +1 -1
  23. package/dist/components/Dialog.js.map +1 -1
  24. package/dist/components/Drawer.d.ts +2 -2
  25. package/dist/components/Drawer.d.ts.map +1 -1
  26. package/dist/components/Drawer.js.map +1 -1
  27. package/dist/components/Flex.d.ts +7 -7
  28. package/dist/components/Flex.d.ts.map +1 -1
  29. package/dist/components/Grid.d.ts +42 -42
  30. package/dist/components/Grid.d.ts.map +1 -1
  31. package/dist/components/Grid.js +4 -3
  32. package/dist/components/Grid.js.map +1 -1
  33. package/dist/components/Group.d.ts.map +1 -1
  34. package/dist/components/Group.js.map +1 -1
  35. package/dist/components/Menu.d.ts +1 -1
  36. package/dist/components/Menu.d.ts.map +1 -1
  37. package/dist/components/Menu.js +1 -1
  38. package/dist/components/Menu.js.map +1 -1
  39. package/dist/components/Popover.d.ts.map +1 -1
  40. package/dist/components/Popover.js.map +1 -1
  41. package/dist/components/Progress.d.ts +1 -1
  42. package/dist/components/Progress.d.ts.map +1 -1
  43. package/dist/components/Progress.js +1 -1
  44. package/dist/components/Progress.js.map +1 -1
  45. package/dist/components/ScrollArea.d.ts.map +1 -1
  46. package/dist/components/ScrollArea.js +1 -1
  47. package/dist/components/ScrollArea.js.map +1 -1
  48. package/dist/components/Separator.d.ts.map +1 -1
  49. package/dist/components/Separator.js.map +1 -1
  50. package/dist/components/Sidebar.d.ts.map +1 -1
  51. package/dist/components/Sidebar.js +1 -1
  52. package/dist/components/Sidebar.js.map +1 -1
  53. package/dist/components/Spinner.d.ts.map +1 -1
  54. package/dist/components/Spinner.js.map +1 -1
  55. package/dist/components/Table.d.ts +1 -1
  56. package/dist/components/Table.d.ts.map +1 -1
  57. package/dist/components/Table.js +2 -2
  58. package/dist/components/Table.js.map +1 -1
  59. package/dist/components/Tabs.d.ts +26 -0
  60. package/dist/components/Tabs.d.ts.map +1 -0
  61. package/dist/components/Tabs.js +78 -0
  62. package/dist/components/Tabs.js.map +1 -0
  63. package/dist/components/Text.d.ts.map +1 -1
  64. package/dist/components/Text.js.map +1 -1
  65. package/dist/components/Toast.d.ts.map +1 -1
  66. package/dist/components/Toast.js +1 -1
  67. package/dist/components/Toast.js.map +1 -1
  68. package/dist/components/Tooltip.d.ts +1 -1
  69. package/dist/components/Tooltip.d.ts.map +1 -1
  70. package/dist/components/Tooltip.js.map +1 -1
  71. package/dist/components/XStack.d.ts.map +1 -1
  72. package/dist/components/XStack.js.map +1 -1
  73. package/dist/components/YStack.d.ts.map +1 -1
  74. package/dist/components/YStack.js.map +1 -1
  75. package/dist/components/_internal/VisuallyHiddenInput.d.ts.map +1 -1
  76. package/dist/components/_internal/VisuallyHiddenInput.js +2 -4
  77. package/dist/components/_internal/VisuallyHiddenInput.js.map +1 -1
  78. package/dist/components/_internal/dialog-styles.d.ts +1 -1
  79. package/dist/components/_internal/dialog-styles.d.ts.map +1 -1
  80. package/dist/components/_internal/dialog-styles.js.map +1 -1
  81. package/dist/components/_internal/layout.d.ts +27 -27
  82. package/dist/components/_internal/layout.d.ts.map +1 -1
  83. package/dist/components/_internal/layout.js +1 -1
  84. package/dist/components/_internal/layout.js.map +1 -1
  85. package/dist/components/_internal/separate.d.ts +1 -1
  86. package/dist/components/_internal/separate.d.ts.map +1 -1
  87. package/dist/components/_internal/separate.js.map +1 -1
  88. package/dist/components/form/Checkbox.d.ts.map +1 -1
  89. package/dist/components/form/Checkbox.js.map +1 -1
  90. package/dist/components/form/ColorPicker.d.ts.map +1 -1
  91. package/dist/components/form/ColorPicker.js.map +1 -1
  92. package/dist/components/form/ColorPickerPrimitive.d.ts.map +1 -1
  93. package/dist/components/form/ColorPickerPrimitive.js +9 -14
  94. package/dist/components/form/ColorPickerPrimitive.js.map +1 -1
  95. package/dist/components/form/Combobox.d.ts.map +1 -1
  96. package/dist/components/form/Combobox.js +11 -12
  97. package/dist/components/form/Combobox.js.map +1 -1
  98. package/dist/components/form/Form.context.d.ts.map +1 -1
  99. package/dist/components/form/Form.context.js +2 -4
  100. package/dist/components/form/Form.context.js.map +1 -1
  101. package/dist/components/form/Form.d.ts +1 -1
  102. package/dist/components/form/Form.d.ts.map +1 -1
  103. package/dist/components/form/FormCheckbox.d.ts.map +1 -1
  104. package/dist/components/form/FormCheckbox.js.map +1 -1
  105. package/dist/components/form/FormCombobox.d.ts +1 -1
  106. package/dist/components/form/FormCombobox.d.ts.map +1 -1
  107. package/dist/components/form/FormCombobox.js +1 -1
  108. package/dist/components/form/FormCombobox.js.map +1 -1
  109. package/dist/components/form/FormField.d.ts.map +1 -1
  110. package/dist/components/form/FormField.js +1 -1
  111. package/dist/components/form/FormField.js.map +1 -1
  112. package/dist/components/form/FormInput.d.ts.map +1 -1
  113. package/dist/components/form/FormInput.js +1 -1
  114. package/dist/components/form/FormInput.js.map +1 -1
  115. package/dist/components/form/FormInputGroup.d.ts.map +1 -1
  116. package/dist/components/form/FormInputGroup.js +2 -6
  117. package/dist/components/form/FormInputGroup.js.map +1 -1
  118. package/dist/components/form/FormRadioGroup.d.ts +1 -1
  119. package/dist/components/form/FormRadioGroup.d.ts.map +1 -1
  120. package/dist/components/form/FormSwitch.d.ts.map +1 -1
  121. package/dist/components/form/FormSwitch.js.map +1 -1
  122. package/dist/components/form/FormTextarea.d.ts.map +1 -1
  123. package/dist/components/form/FormTextarea.js +1 -1
  124. package/dist/components/form/FormTextarea.js.map +1 -1
  125. package/dist/components/form/Input.d.ts.map +1 -1
  126. package/dist/components/form/Input.js.map +1 -1
  127. package/dist/components/form/InputGroup.d.ts +1 -1
  128. package/dist/components/form/InputGroup.d.ts.map +1 -1
  129. package/dist/components/form/InputGroup.js.map +1 -1
  130. package/dist/components/form/RadioGroup.d.ts.map +1 -1
  131. package/dist/components/form/RadioGroup.js.map +1 -1
  132. package/dist/components/form/Select.d.ts.map +1 -1
  133. package/dist/components/form/Select.js +1 -1
  134. package/dist/components/form/Select.js.map +1 -1
  135. package/dist/components/form/Slider.d.ts +1 -1
  136. package/dist/components/form/Slider.d.ts.map +1 -1
  137. package/dist/components/form/Slider.js.map +1 -1
  138. package/dist/components/form/Switch.d.ts.map +1 -1
  139. package/dist/components/form/Switch.js.map +1 -1
  140. package/dist/components/form/Textarea.d.ts.map +1 -1
  141. package/dist/components/form/Textarea.js.map +1 -1
  142. package/dist/entries/checkbox.d.ts +1 -1
  143. package/dist/entries/checkbox.d.ts.map +1 -1
  144. package/dist/entries/group.d.ts +1 -1
  145. package/dist/entries/group.d.ts.map +1 -1
  146. package/dist/entries/radio-group.d.ts +1 -1
  147. package/dist/entries/radio-group.d.ts.map +1 -1
  148. package/dist/entries/tabs.d.ts +3 -0
  149. package/dist/entries/tabs.d.ts.map +1 -0
  150. package/dist/entries/tabs.js +2 -0
  151. package/dist/entries/tabs.js.map +1 -0
  152. package/dist/index.d.ts +1 -0
  153. package/dist/index.d.ts.map +1 -1
  154. package/dist/index.js +1 -0
  155. package/dist/index.js.map +1 -1
  156. package/dist/lib/color.d.ts +1 -1
  157. package/dist/lib/color.d.ts.map +1 -1
  158. package/dist/lib/color.js +1 -3
  159. package/dist/lib/color.js.map +1 -1
  160. package/dist/lib/compose-refs.js +1 -1
  161. package/dist/lib/compose-refs.js.map +1 -1
  162. package/package.json +33 -32
  163. package/skills/pickle-ui-react/SKILL.md +38 -0
  164. package/src/agent-skill.test.ts +30 -0
  165. package/src/components/Alert.test.tsx +3 -12
  166. package/src/components/Alert.tsx +2 -4
  167. package/src/components/AlertDialog.stories.tsx +10 -35
  168. package/src/components/AlertDialog.test.tsx +6 -23
  169. package/src/components/AlertDialog.tsx +12 -40
  170. package/src/components/Avatar.stories.tsx +3 -8
  171. package/src/components/Avatar.tsx +4 -18
  172. package/src/components/Badge.stories.tsx +1 -5
  173. package/src/components/Badge.test.tsx +1 -4
  174. package/src/components/Badge.tsx +5 -14
  175. package/src/components/Button.stories.tsx +4 -16
  176. package/src/components/Button.test.tsx +8 -9
  177. package/src/components/Button.tsx +2 -7
  178. package/src/components/Card.stories.tsx +1 -3
  179. package/src/components/Card.test.tsx +1 -3
  180. package/src/components/Card.tsx +1 -9
  181. package/src/components/Dialog.stories.tsx +9 -23
  182. package/src/components/Dialog.test.tsx +6 -23
  183. package/src/components/Dialog.tsx +4 -17
  184. package/src/components/Drawer.stories.tsx +9 -34
  185. package/src/components/Drawer.test.tsx +8 -29
  186. package/src/components/Drawer.tsx +4 -15
  187. package/src/components/Grid.stories.tsx +1 -4
  188. package/src/components/Grid.test.tsx +1 -3
  189. package/src/components/Grid.tsx +4 -4
  190. package/src/components/Group.stories.tsx +4 -20
  191. package/src/components/Group.test.tsx +2 -9
  192. package/src/components/Group.tsx +3 -12
  193. package/src/components/Menu.stories.tsx +5 -18
  194. package/src/components/Menu.test.tsx +11 -17
  195. package/src/components/Menu.tsx +7 -27
  196. package/src/components/Popover.stories.tsx +4 -10
  197. package/src/components/Popover.tsx +3 -13
  198. package/src/components/Progress.tsx +5 -24
  199. package/src/components/ScrollArea.test.tsx +4 -6
  200. package/src/components/ScrollArea.tsx +10 -28
  201. package/src/components/Separator.test.tsx +2 -8
  202. package/src/components/Separator.tsx +1 -5
  203. package/src/components/Sidebar.stories.tsx +1 -5
  204. package/src/components/Sidebar.tsx +4 -22
  205. package/src/components/Spinner.tsx +1 -5
  206. package/src/components/Table.stories.tsx +1 -3
  207. package/src/components/Table.tsx +5 -30
  208. package/src/components/Tabs.stories.tsx +101 -0
  209. package/src/components/Tabs.test.tsx +129 -0
  210. package/src/components/Tabs.tsx +142 -0
  211. package/src/components/Text.stories.tsx +8 -13
  212. package/src/components/Text.tsx +1 -4
  213. package/src/components/Toast.test.tsx +6 -17
  214. package/src/components/Toast.tsx +4 -17
  215. package/src/components/Tooltip.stories.tsx +6 -28
  216. package/src/components/Tooltip.test.tsx +2 -8
  217. package/src/components/Tooltip.tsx +3 -12
  218. package/src/components/XStack.stories.tsx +4 -8
  219. package/src/components/XStack.test.tsx +9 -20
  220. package/src/components/XStack.tsx +2 -13
  221. package/src/components/YStack.stories.tsx +2 -8
  222. package/src/components/YStack.tsx +2 -13
  223. package/src/components/_internal/Story.tsx +6 -23
  224. package/src/components/_internal/VisuallyHiddenInput.tsx +4 -9
  225. package/src/components/_internal/dialog-styles.ts +1 -2
  226. package/src/components/_internal/layout.ts +1 -7
  227. package/src/components/_internal/separate.tsx +6 -9
  228. package/src/components/form/Checkbox.test.tsx +5 -16
  229. package/src/components/form/Checkbox.tsx +1 -4
  230. package/src/components/form/ColorPicker.stories.tsx +3 -10
  231. package/src/components/form/ColorPicker.test.tsx +1 -3
  232. package/src/components/form/ColorPicker.tsx +2 -6
  233. package/src/components/form/ColorPickerPrimitive.tsx +40 -151
  234. package/src/components/form/Combobox.stories.tsx +7 -31
  235. package/src/components/form/Combobox.test.tsx +10 -27
  236. package/src/components/form/Combobox.tsx +31 -89
  237. package/src/components/form/Form.context.ts +5 -19
  238. package/src/components/form/Form.stories.tsx +6 -28
  239. package/src/components/form/Form.test.tsx +21 -38
  240. package/src/components/form/FormCheckbox.tsx +1 -5
  241. package/src/components/form/FormCombobox.tsx +4 -10
  242. package/src/components/form/FormField.tsx +4 -15
  243. package/src/components/form/FormInput.tsx +2 -12
  244. package/src/components/form/FormInputGroup.tsx +3 -11
  245. package/src/components/form/FormSwitch.tsx +1 -5
  246. package/src/components/form/FormTextarea.tsx +3 -11
  247. package/src/components/form/Input.stories.tsx +1 -5
  248. package/src/components/form/Input.test.tsx +20 -31
  249. package/src/components/form/Input.tsx +1 -4
  250. package/src/components/form/InputGroup.stories.tsx +4 -23
  251. package/src/components/form/InputGroup.tsx +5 -10
  252. package/src/components/form/RadioGroup.test.tsx +14 -28
  253. package/src/components/form/RadioGroup.tsx +1 -5
  254. package/src/components/form/Select.stories.tsx +2 -10
  255. package/src/components/form/Select.test.tsx +4 -14
  256. package/src/components/form/Select.tsx +9 -38
  257. package/src/components/form/Slider.stories.tsx +7 -17
  258. package/src/components/form/Slider.test.tsx +4 -12
  259. package/src/components/form/Slider.tsx +4 -20
  260. package/src/components/form/Switch.test.tsx +3 -9
  261. package/src/components/form/Switch.tsx +2 -9
  262. package/src/components/form/Textarea.test.tsx +2 -6
  263. package/src/components/form/Textarea.tsx +1 -6
  264. package/src/entries/checkbox.ts +1 -4
  265. package/src/entries/group.ts +1 -5
  266. package/src/entries/radio-group.ts +1 -4
  267. package/src/entries/tabs.ts +8 -0
  268. package/src/index.ts +1 -0
  269. package/src/lib/color.test.ts +2 -6
  270. package/src/lib/color.ts +3 -11
  271. package/src/lib/compose-refs.ts +1 -1
  272. package/src/public-api.test.ts +7 -8
@@ -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
- typeof TooltipPrimitive.Provider
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
- (label) => (
50
- <Item key={label}>{label}</Item>
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
- screen.getAllByRole('separator', { hidden: true })[0],
102
- ).toHaveAttribute('aria-hidden', 'true');
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-hooks/refs -- prevValueRef is read during render on purpose: it holds the previous value and never affects the output. */
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.Children.toArray(children),
31
- (child, index) => (
32
- <React.Fragment>
33
- {index > 0 && render({ index: index - 1, orientation })}
34
- {child}
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
- 'field-x',
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>;