@pickle-ui/react 1.0.0-beta.13 → 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 +36 -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 +6 -2
- package/dist/components/form/Form.d.ts.map +1 -1
- package/dist/components/form/Form.js +2 -0
- package/dist/components/form/Form.js.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 +5 -2
- package/dist/components/form/FormField.d.ts.map +1 -1
- package/dist/components/form/FormField.js +20 -9
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/form/FormGroupField.d.ts +13 -0
- package/dist/components/form/FormGroupField.d.ts.map +1 -0
- package/dist/components/form/FormGroupField.js +17 -0
- package/dist/components/form/FormGroupField.js.map +1 -0
- 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/form.d.ts +1 -1
- package/dist/entries/form.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 +34 -23
- package/src/components/form/Form.test.tsx +105 -23
- package/src/components/form/Form.tsx +8 -0
- package/src/components/form/FormCheckbox.tsx +1 -5
- package/src/components/form/FormCombobox.tsx +4 -10
- package/src/components/form/FormField.tsx +50 -31
- package/src/components/form/FormGroupField.tsx +25 -0
- 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/form.ts +2 -0
- package/src/entries/group.ts +1 -5
- package/src/entries/radio-group.ts +1 -4
- package/src/lib/color.test.ts +2 -6
- package/src/lib/color.ts +3 -11
- package/src/lib/compose-refs.ts +1 -1
- package/src/public-api.test.ts +7 -8
package/dist/lib/compose-refs.js
CHANGED
|
@@ -37,7 +37,7 @@ function setRef(ref, value) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
function useComposedRefs(...refs) {
|
|
40
|
-
// eslint-disable-next-line react
|
|
40
|
+
// eslint-disable-next-line react/exhaustive-deps, react/use-memo -- memoized by every ref: the spread `refs` is the dependency list
|
|
41
41
|
return React.useCallback(composeRefs(...refs), refs); // react-doctor-disable-line react-doctor/exhaustive-deps -- memoized by every ref: the spread `refs` is the dependency list
|
|
42
42
|
}
|
|
43
43
|
export { composeRefs, useComposedRefs };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose-refs.js","sourceRoot":"","sources":["../../src/lib/compose-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,+EAA+E;AAC/E,4CAA4C;AAE5C,SAAS,WAAW,CAAI,GAAG,IAAsB;IAC/C,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,IAAI,UAAU,GAAG,KAAK,CAAC;QACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAChC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAClC,IAAI,CAAC,UAAU,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;gBACjD,UAAU,GAAG,IAAI,CAAC;YACpB,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,wEAAwE;QACxE,2CAA2C;QAC3C,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,GAAG,EAAE;gBACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBACzC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;oBAC5B,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;wBAClC,OAAO,EAAE,CAAC;oBACZ,CAAC;yBAAM,CAAC;wBACN,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;oBACxB,CAAC;gBACH,CAAC;YACH,CAAC,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAI,GAAmB,EAAE,KAAQ;IAC9C,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAI,GAAG,IAAsB;IACnD,
|
|
1
|
+
{"version":3,"file":"compose-refs.js","sourceRoot":"","sources":["../../src/lib/compose-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,+EAA+E;AAC/E,4CAA4C;AAE5C,SAAS,WAAW,CAAI,GAAG,IAAsB;IAC/C,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,IAAI,UAAU,GAAG,KAAK,CAAC;QACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAChC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAClC,IAAI,CAAC,UAAU,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;gBACjD,UAAU,GAAG,IAAI,CAAC;YACpB,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,wEAAwE;QACxE,2CAA2C;QAC3C,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,GAAG,EAAE;gBACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBACzC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;oBAC5B,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;wBAClC,OAAO,EAAE,CAAC;oBACZ,CAAC;yBAAM,CAAC;wBACN,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;oBACxB,CAAC;gBACH,CAAC;YACH,CAAC,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAI,GAAmB,EAAE,KAAQ;IAC9C,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAI,GAAG,IAAsB;IACnD,oIAAoI;IACpI,OAAO,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,4HAA4H;AACpL,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pickle-ui/react",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React component library built with Base UI, shadcn/ui, Tailwind CSS, and reui.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"dist",
|
|
39
|
+
"skills",
|
|
39
40
|
"src"
|
|
40
41
|
],
|
|
41
42
|
"keywords": [
|
|
@@ -49,46 +50,46 @@
|
|
|
49
50
|
"author": "Ugo Onali",
|
|
50
51
|
"license": "MIT",
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@base-ui/react": "^1.
|
|
53
|
-
"@tabler/icons-react": "^3.
|
|
53
|
+
"@base-ui/react": "^1.9.0",
|
|
54
|
+
"@tabler/icons-react": "^3.54.0",
|
|
54
55
|
"class-variance-authority": "^0.7.1",
|
|
55
56
|
"clsx": "^2.1.1",
|
|
56
57
|
"culori": "^4.0.2",
|
|
57
|
-
"tailwind-merge": "^3.
|
|
58
|
+
"tailwind-merge": "^3.7.1",
|
|
58
59
|
"tw-animate-css": "^1.4.0",
|
|
59
|
-
"@pickle-ui/tokens": "1.0.0-beta.
|
|
60
|
+
"@pickle-ui/tokens": "1.0.0-beta.8"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
|
-
"@fontsource-variable/geist": "5.
|
|
63
|
-
"@fontsource/jetbrains-mono": "5.
|
|
64
|
-
"@hookform/resolvers": "^
|
|
65
|
-
"@storybook/addon-docs": "^10.6.
|
|
66
|
-
"@storybook/addon-links": "^10.6.
|
|
67
|
-
"@storybook/react": "^10.6.
|
|
68
|
-
"@storybook/react-vite": "^10.6.
|
|
69
|
-
"@tailwindcss/postcss": "^4.3.
|
|
70
|
-
"@testing-library/dom": "^10.4.
|
|
71
|
-
"@testing-library/jest-dom": "^
|
|
72
|
-
"@testing-library/react": "^16.3.
|
|
63
|
+
"@fontsource-variable/geist": "5.3.0",
|
|
64
|
+
"@fontsource/jetbrains-mono": "5.3.0",
|
|
65
|
+
"@hookform/resolvers": "^7.0.10",
|
|
66
|
+
"@storybook/addon-docs": "^10.6.9",
|
|
67
|
+
"@storybook/addon-links": "^10.6.9",
|
|
68
|
+
"@storybook/react": "^10.6.9",
|
|
69
|
+
"@storybook/react-vite": "^10.6.9",
|
|
70
|
+
"@tailwindcss/postcss": "^4.3.5",
|
|
71
|
+
"@testing-library/dom": "^10.4.2",
|
|
72
|
+
"@testing-library/jest-dom": "^8.0.0",
|
|
73
|
+
"@testing-library/react": "^16.3.3",
|
|
73
74
|
"@types/culori": "^4.0.1",
|
|
74
|
-
"@types/node": "^
|
|
75
|
-
"@types/react": "^19.
|
|
76
|
-
"@types/react-dom": "^19.
|
|
77
|
-
"@vitejs/plugin-react": "^6.0
|
|
78
|
-
"jsdom": "^
|
|
79
|
-
"postcss": "^8.5.
|
|
80
|
-
"react": "^19.
|
|
81
|
-
"react-doctor": "^0.9.
|
|
82
|
-
"react-dom": "^19.
|
|
83
|
-
"react-hook-form": "^7.
|
|
84
|
-
"storybook": "^10.6.
|
|
85
|
-
"storybook-addon-pseudo-states": "^10.6.
|
|
86
|
-
"tailwindcss": "^4.3.
|
|
87
|
-
"tsc-alias": "^1.
|
|
88
|
-
"typescript": "^
|
|
89
|
-
"vite": "^8.0
|
|
90
|
-
"vitest": "^
|
|
91
|
-
"zod": "4.
|
|
75
|
+
"@types/node": "^26.6.11",
|
|
76
|
+
"@types/react": "^19.3.3",
|
|
77
|
+
"@types/react-dom": "^19.3.0",
|
|
78
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
79
|
+
"jsdom": "^31.0.1",
|
|
80
|
+
"postcss": "^8.5.34",
|
|
81
|
+
"react": "^19.3.1",
|
|
82
|
+
"react-doctor": "^0.9.23",
|
|
83
|
+
"react-dom": "^19.3.1",
|
|
84
|
+
"react-hook-form": "^7.92.0",
|
|
85
|
+
"storybook": "^10.6.9",
|
|
86
|
+
"storybook-addon-pseudo-states": "^10.6.9",
|
|
87
|
+
"tailwindcss": "^4.3.5",
|
|
88
|
+
"tsc-alias": "^1.9.12",
|
|
89
|
+
"typescript": "^7.0.2",
|
|
90
|
+
"vite": "^8.4.0",
|
|
91
|
+
"vitest": "^5.1.2",
|
|
92
|
+
"zod": "4.6.7"
|
|
92
93
|
},
|
|
93
94
|
"peerDependencies": {
|
|
94
95
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pickle-ui-react
|
|
3
|
+
description: Builds web interfaces with @pickle-ui/react, Pickle UI's React components on Base UI and Tailwind CSS v4. Covers setup, choosing and composing components, forms with React Hook Form, theming with tokens and createTheme, and styling through className, data-slot and variant attributes. Use whenever a project has @pickle-ui/react installed or the user mentions Pickle UI on the web.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build with @pickle-ui/react
|
|
7
|
+
|
|
8
|
+
## Read first
|
|
9
|
+
|
|
10
|
+
The docs for the installed version ship in the package:
|
|
11
|
+
|
|
12
|
+
- `node_modules/@pickle-ui/react/README.md` is the index: setup, every subpath with its parts, theming, and the `data-slot` and variant attributes. Read it first.
|
|
13
|
+
- `node_modules/@pickle-ui/react/src/components/<Name>.tsx` (`src/components/form/<Name>.tsx` for form controls) holds a component's parts, props and variant values.
|
|
14
|
+
- `<Name>.stories.tsx` next to it shows the component composed as intended. Copy its shape.
|
|
15
|
+
- Don't read the compiled JavaScript in `dist/*.js`. The sources above and the `.d.ts` types are the API.
|
|
16
|
+
|
|
17
|
+
If the package isn't installed yet, follow the README's "Use Pickle UI" section.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
|
|
21
|
+
- **Import from the subpath**: `import { Dialog } from '@pickle-ui/react/dialog'`. Exports are named, never default.
|
|
22
|
+
- **Reach parts through the component**: `<Dialog.Title>`, never `DialogTitle`. The root is `<Dialog>` itself; only `ScrollArea` has a `.Root`.
|
|
23
|
+
- **Swap the element with `render`**: `<Button render={<a href="/docs" />}>Docs</Button>`. There is no `asChild`. `Text`, `Flex`, `Grid`, `XStack` and `YStack` take `as` instead.
|
|
24
|
+
- **Overlays are one part**: each overlay's `Content` (`Dialog.Content`, `Popover.Content`, …) already renders the portal and the backdrop or positioner. Position `Popover`, `Menu`, `Tooltip`, `Select` and `Combobox` popups with `side`, `align`, `sideOffset` or `alignOffset` on `Content`.
|
|
25
|
+
- **State props follow Base UI**: `open` / `defaultOpen` / `onOpenChange`, `value` / `defaultValue` / `onValueChange`, `disabled`.
|
|
26
|
+
- **Text goes in `Text`** with a `variant` (`h1` … `h4`, `lead`, `body`, `small`, `code`), not raw `h1`–`h6`, `p` or `span`.
|
|
27
|
+
- **Forms**: pass `useForm()`'s return to `<Form form={form}>`, wrap each control in `Form.Field` with a `label` and `name`, and use the bound controls (`Form.Input`, `Form.Select`, …). Rows of controls go in `Form.GroupField`.
|
|
28
|
+
- **Name every control**: an icon-only button needs an `aria-label`.
|
|
29
|
+
- **Style with tokens**: `bg-primary`, `text-muted-foreground`, `border-input`, never raw palette colors such as `bg-blue-500` on themed surfaces. `className` merges last and wins. Components listed in the README take `classNames` for inner slots. Global rules target `data-slot` and `data-variant` / `data-size` inside `@layer utilities`.
|
|
30
|
+
- **Dark mode** is the `dark` class on an ancestor. Pickle never reads `prefers-color-scheme` on its own.
|
|
31
|
+
- **Brand colors** come from `createTheme` in `@pickle-ui/react/theme`, not hand-written `--primary` values for both schemes.
|
|
32
|
+
|
|
33
|
+
## When you're done
|
|
34
|
+
|
|
35
|
+
1. Typecheck and run the project's tests.
|
|
36
|
+
2. Report each command you ran with its result, and anything the README or types got wrong or left out.
|
|
37
|
+
|
|
38
|
+
When a component does something its README entry or types say it won't, work around it, then offer once to report it on https://github.com/ugogo/pickle-ui/issues. Show the issue to the user and file it only after a yes.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { readdirSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
|
|
6
|
+
// The skill sends agents to the README for the list of subpaths, so the
|
|
7
|
+
// README must name every entry and the skill must ship.
|
|
8
|
+
|
|
9
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
10
|
+
const read = (path: string) => readFileSync(join(root, path), 'utf8');
|
|
11
|
+
|
|
12
|
+
const entryNames = readdirSync(join(root, 'src/entries'))
|
|
13
|
+
.filter((file) => file.endsWith('.ts') && !file.endsWith('.test.ts'))
|
|
14
|
+
.map((file) => file.replace(/\.ts$/, ''));
|
|
15
|
+
|
|
16
|
+
describe('agent skill', () => {
|
|
17
|
+
it('is named after its folder and shipped', () => {
|
|
18
|
+
const skill = read('skills/pickle-ui-react/SKILL.md');
|
|
19
|
+
const { files } = JSON.parse(read('package.json')) as { files: string[] };
|
|
20
|
+
|
|
21
|
+
expect(skill).toMatch(/^---\nname: pickle-ui-react\n/);
|
|
22
|
+
expect(files).toContain('skills');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('can rely on the README to list every subpath', () => {
|
|
26
|
+
const readme = read('README.md');
|
|
27
|
+
|
|
28
|
+
expect(entryNames.filter((name) => !readme.includes(`@pickle-ui/react/${name}\``))).toEqual([]);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -22,19 +22,13 @@ describe('Alert', () => {
|
|
|
22
22
|
|
|
23
23
|
expect(alert).toHaveAttribute('data-slot', 'alert');
|
|
24
24
|
expect(alert).toHaveAttribute('data-variant', 'warning');
|
|
25
|
-
expect(screen.getByText('Trial ending soon')).toHaveAttribute(
|
|
26
|
-
'data-slot',
|
|
27
|
-
'alert-title',
|
|
28
|
-
);
|
|
25
|
+
expect(screen.getByText('Trial ending soon')).toHaveAttribute('data-slot', 'alert-title');
|
|
29
26
|
expect(screen.getByText('Add a payment method.')).toHaveAttribute(
|
|
30
27
|
'data-slot',
|
|
31
28
|
'alert-description',
|
|
32
29
|
);
|
|
33
30
|
expect(screen.getByRole('button', { name: 'Upgrade' })).toBeInTheDocument();
|
|
34
|
-
expect(alert.querySelector('[data-slot="alert-icon"]')).toHaveAttribute(
|
|
35
|
-
'aria-hidden',
|
|
36
|
-
'true',
|
|
37
|
-
);
|
|
31
|
+
expect(alert.querySelector('[data-slot="alert-icon"]')).toHaveAttribute('aria-hidden', 'true');
|
|
38
32
|
});
|
|
39
33
|
|
|
40
34
|
it('keeps the title and description at text-sm whatever the body size', () => {
|
|
@@ -60,10 +54,7 @@ describe('Alert', () => {
|
|
|
60
54
|
);
|
|
61
55
|
|
|
62
56
|
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
|
|
63
|
-
expect(screen.getByText('Notice').parentElement).toHaveAttribute(
|
|
64
|
-
'data-variant',
|
|
65
|
-
'default',
|
|
66
|
-
);
|
|
57
|
+
expect(screen.getByText('Notice').parentElement).toHaveAttribute('data-variant', 'default');
|
|
67
58
|
|
|
68
59
|
rerender(
|
|
69
60
|
<Alert role="alert" variant="destructive">
|
package/src/components/Alert.tsx
CHANGED
|
@@ -12,8 +12,7 @@ const alertVariants = cva(
|
|
|
12
12
|
},
|
|
13
13
|
variants: {
|
|
14
14
|
variant: {
|
|
15
|
-
default:
|
|
16
|
-
'bg-card text-card-foreground *:data-[slot=alert-icon]:text-muted-foreground',
|
|
15
|
+
default: 'bg-card text-card-foreground *:data-[slot=alert-icon]:text-muted-foreground',
|
|
17
16
|
destructive:
|
|
18
17
|
'border-destructive/32 bg-destructive-subtle text-foreground *:data-[slot=alert-icon]:text-destructive',
|
|
19
18
|
info: 'border-info/32 bg-info-subtle text-foreground *:data-[slot=alert-icon]:text-info',
|
|
@@ -29,8 +28,7 @@ const alertVariants = cva(
|
|
|
29
28
|
type AlertActionProps = React.ComponentProps<'div'>;
|
|
30
29
|
type AlertDescriptionProps = Omit<TextProps, 'as' | 'tone' | 'variant'>;
|
|
31
30
|
type AlertIconProps = React.ComponentProps<'div'>;
|
|
32
|
-
type AlertProps = React.ComponentProps<'div'> &
|
|
33
|
-
VariantProps<typeof alertVariants>;
|
|
31
|
+
type AlertProps = React.ComponentProps<'div'> & VariantProps<typeof alertVariants>;
|
|
34
32
|
type AlertTitleProps = Omit<TextProps, 'as' | 'tone' | 'variant'>;
|
|
35
33
|
|
|
36
34
|
function AlertAction({ className, ...props }: AlertActionProps) {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
3
|
import { type ComponentMatrixCellProps, Story } from './_internal/Story';
|
|
4
|
-
import {
|
|
5
|
-
AlertDialog,
|
|
6
|
-
type AlertDialogContentProps,
|
|
7
|
-
type AlertDialogProps,
|
|
8
|
-
} from './AlertDialog';
|
|
4
|
+
import { AlertDialog, type AlertDialogContentProps, type AlertDialogProps } from './AlertDialog';
|
|
9
5
|
import { Button } from './Button';
|
|
10
6
|
|
|
11
7
|
const meta = {
|
|
@@ -55,8 +51,7 @@ const CONTENT: Record<
|
|
|
55
51
|
},
|
|
56
52
|
long: {
|
|
57
53
|
action: 'Archive',
|
|
58
|
-
description:
|
|
59
|
-
'Members keep their exported data. You can restore the workspace within 30 days.',
|
|
54
|
+
description: 'Members keep their exported data. You can restore the workspace within 30 days.',
|
|
60
55
|
title: 'Archive this workspace and remove access for every member?',
|
|
61
56
|
trigger: 'Archive',
|
|
62
57
|
},
|
|
@@ -99,9 +94,7 @@ function AlertDialogDismissalCell({ column }: ComponentMatrixCellProps) {
|
|
|
99
94
|
|
|
100
95
|
return (
|
|
101
96
|
<AlertDialog disablePointerDismissal={disablePointerDismissal}>
|
|
102
|
-
<AlertDialog.Trigger render={<Button variant="outline" />}>
|
|
103
|
-
Leave page
|
|
104
|
-
</AlertDialog.Trigger>
|
|
97
|
+
<AlertDialog.Trigger render={<Button variant="outline" />}>Leave page</AlertDialog.Trigger>
|
|
105
98
|
<AlertDialog.Content>
|
|
106
99
|
<AlertDialog.Header>
|
|
107
100
|
<AlertDialog.Title>Leave this page?</AlertDialog.Title>
|
|
@@ -112,9 +105,7 @@ function AlertDialogDismissalCell({ column }: ComponentMatrixCellProps) {
|
|
|
112
105
|
</AlertDialog.Description>
|
|
113
106
|
</AlertDialog.Header>
|
|
114
107
|
<AlertDialog.Footer>
|
|
115
|
-
<AlertDialog.Close render={<Button variant="outline" />}>
|
|
116
|
-
Stay
|
|
117
|
-
</AlertDialog.Close>
|
|
108
|
+
<AlertDialog.Close render={<Button variant="outline" />}>Stay</AlertDialog.Close>
|
|
118
109
|
<AlertDialog.Close render={<Button />}>Leave</AlertDialog.Close>
|
|
119
110
|
</AlertDialog.Footer>
|
|
120
111
|
</AlertDialog.Content>
|
|
@@ -129,30 +120,18 @@ function AlertDialogMatrixCell({ column, row }: ComponentMatrixCellProps) {
|
|
|
129
120
|
return (
|
|
130
121
|
<AlertDialog>
|
|
131
122
|
<AlertDialog.Trigger
|
|
132
|
-
render={
|
|
133
|
-
<Button variant={destructive ? 'outline-destructive' : 'outline'} />
|
|
134
|
-
}
|
|
123
|
+
render={<Button variant={destructive ? 'outline-destructive' : 'outline'} />}
|
|
135
124
|
>
|
|
136
125
|
{content.trigger}
|
|
137
126
|
</AlertDialog.Trigger>
|
|
138
|
-
<AlertDialog.Content
|
|
139
|
-
size={column.key as NonNullable<AlertDialogContentProps['size']>}
|
|
140
|
-
>
|
|
127
|
+
<AlertDialog.Content size={column.key as NonNullable<AlertDialogContentProps['size']>}>
|
|
141
128
|
<AlertDialog.Header>
|
|
142
129
|
<AlertDialog.Title>{content.title}</AlertDialog.Title>
|
|
143
|
-
<AlertDialog.Description>
|
|
144
|
-
{content.description}
|
|
145
|
-
</AlertDialog.Description>
|
|
130
|
+
<AlertDialog.Description>{content.description}</AlertDialog.Description>
|
|
146
131
|
</AlertDialog.Header>
|
|
147
132
|
<AlertDialog.Footer>
|
|
148
|
-
<AlertDialog.Close render={<Button variant="outline" />}>
|
|
149
|
-
|
|
150
|
-
</AlertDialog.Close>
|
|
151
|
-
<AlertDialog.Close
|
|
152
|
-
render={
|
|
153
|
-
<Button variant={destructive ? 'destructive' : 'default'} />
|
|
154
|
-
}
|
|
155
|
-
>
|
|
133
|
+
<AlertDialog.Close render={<Button variant="outline" />}>Cancel</AlertDialog.Close>
|
|
134
|
+
<AlertDialog.Close render={<Button variant={destructive ? 'destructive' : 'default'} />}>
|
|
156
135
|
{content.action}
|
|
157
136
|
</AlertDialog.Close>
|
|
158
137
|
</AlertDialog.Footer>
|
|
@@ -165,11 +144,7 @@ export const All: StoryDefinition = {
|
|
|
165
144
|
render: () => (
|
|
166
145
|
<Story.Layout className="max-w-5xl" title="AlertDialog">
|
|
167
146
|
<Story.Section title="Sizes and content">
|
|
168
|
-
<Story.Matrix
|
|
169
|
-
Cell={AlertDialogMatrixCell}
|
|
170
|
-
columns={SIZE_COLUMNS}
|
|
171
|
-
rows={CONTENT_ROWS}
|
|
172
|
-
/>
|
|
147
|
+
<Story.Matrix Cell={AlertDialogMatrixCell} columns={SIZE_COLUMNS} rows={CONTENT_ROWS} />
|
|
173
148
|
</Story.Section>
|
|
174
149
|
|
|
175
150
|
<Story.Section title="Backdrop dismissal">
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
act,
|
|
3
|
-
fireEvent,
|
|
4
|
-
render,
|
|
5
|
-
screen,
|
|
6
|
-
waitFor,
|
|
7
|
-
within,
|
|
8
|
-
} from '@testing-library/react';
|
|
1
|
+
import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
|
9
2
|
import { describe, expect, it, vi } from 'vitest';
|
|
10
3
|
|
|
11
4
|
import { AlertDialog, type AlertDialogProps } from './AlertDialog';
|
|
@@ -42,9 +35,7 @@ function renderAlertDialog(props: AlertDialogProps = {}) {
|
|
|
42
35
|
<AlertDialog.Content>
|
|
43
36
|
<AlertDialog.Header>
|
|
44
37
|
<AlertDialog.Title>Delete project?</AlertDialog.Title>
|
|
45
|
-
<AlertDialog.Description>
|
|
46
|
-
This action cannot be undone.
|
|
47
|
-
</AlertDialog.Description>
|
|
38
|
+
<AlertDialog.Description>This action cannot be undone.</AlertDialog.Description>
|
|
48
39
|
</AlertDialog.Header>
|
|
49
40
|
<AlertDialog.Footer>
|
|
50
41
|
<AlertDialog.Close>Cancel</AlertDialog.Close>
|
|
@@ -67,9 +58,7 @@ describe('AlertDialog', () => {
|
|
|
67
58
|
|
|
68
59
|
expect(dialog).toHaveAccessibleDescription('This action cannot be undone.');
|
|
69
60
|
expect(dialog).toHaveAttribute('data-slot', 'alert-dialog-content');
|
|
70
|
-
expect(
|
|
71
|
-
document.querySelector('[data-slot=alert-dialog-backdrop]'),
|
|
72
|
-
).toBeTruthy();
|
|
61
|
+
expect(document.querySelector('[data-slot=alert-dialog-backdrop]')).toBeTruthy();
|
|
73
62
|
});
|
|
74
63
|
|
|
75
64
|
it('has no built-in close icon', async () => {
|
|
@@ -78,9 +67,7 @@ describe('AlertDialog', () => {
|
|
|
78
67
|
|
|
79
68
|
const dialog = await screen.findByRole('alertdialog');
|
|
80
69
|
|
|
81
|
-
expect(
|
|
82
|
-
within(dialog).queryByRole('button', { name: 'Close' }),
|
|
83
|
-
).not.toBeInTheDocument();
|
|
70
|
+
expect(within(dialog).queryByRole('button', { name: 'Close' })).not.toBeInTheDocument();
|
|
84
71
|
});
|
|
85
72
|
|
|
86
73
|
it('closes from AlertDialog.Close', async () => {
|
|
@@ -90,9 +77,7 @@ describe('AlertDialog', () => {
|
|
|
90
77
|
const dialog = await screen.findByRole('alertdialog');
|
|
91
78
|
fireEvent.click(within(dialog).getByRole('button', { name: 'Cancel' }));
|
|
92
79
|
|
|
93
|
-
await waitFor(() =>
|
|
94
|
-
expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument(),
|
|
95
|
-
);
|
|
80
|
+
await waitFor(() => expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument());
|
|
96
81
|
});
|
|
97
82
|
|
|
98
83
|
it('closes on backdrop click by default', async () => {
|
|
@@ -106,9 +91,7 @@ describe('AlertDialog', () => {
|
|
|
106
91
|
false,
|
|
107
92
|
expect.objectContaining({ reason: 'outside-press' }),
|
|
108
93
|
);
|
|
109
|
-
await waitFor(() =>
|
|
110
|
-
expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument(),
|
|
111
|
-
);
|
|
94
|
+
await waitFor(() => expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument());
|
|
112
95
|
});
|
|
113
96
|
|
|
114
97
|
it('stays open on backdrop click with disablePointerDismissal', async () => {
|
|
@@ -14,23 +14,15 @@ import {
|
|
|
14
14
|
dialogViewportClassName,
|
|
15
15
|
} from './_internal/dialog-styles';
|
|
16
16
|
|
|
17
|
-
type AlertDialogCloseProps = React.ComponentProps<
|
|
18
|
-
|
|
19
|
-
>;
|
|
20
|
-
type AlertDialogContentProps = React.ComponentProps<
|
|
21
|
-
typeof AlertDialogPrimitive.Popup
|
|
22
|
-
> & {
|
|
17
|
+
type AlertDialogCloseProps = React.ComponentProps<typeof AlertDialogPrimitive.Close>;
|
|
18
|
+
type AlertDialogContentProps = React.ComponentProps<typeof AlertDialogPrimitive.Popup> & {
|
|
23
19
|
/** Maximum width of the dialog. Defaults to `md`. */
|
|
24
20
|
size?: DialogSize;
|
|
25
21
|
};
|
|
26
|
-
type AlertDialogDescriptionProps = React.ComponentProps<
|
|
27
|
-
typeof AlertDialogPrimitive.Description
|
|
28
|
-
>;
|
|
22
|
+
type AlertDialogDescriptionProps = React.ComponentProps<typeof AlertDialogPrimitive.Description>;
|
|
29
23
|
type AlertDialogFooterProps = React.ComponentProps<'div'>;
|
|
30
24
|
type AlertDialogHeaderProps = React.ComponentProps<'div'>;
|
|
31
|
-
type AlertDialogProps = React.ComponentProps<
|
|
32
|
-
typeof AlertDialogPrimitive.Root
|
|
33
|
-
> & {
|
|
25
|
+
type AlertDialogProps = React.ComponentProps<typeof AlertDialogPrimitive.Root> & {
|
|
34
26
|
/**
|
|
35
27
|
* Keeps the dialog open when the backdrop is clicked, so it only closes
|
|
36
28
|
* through `AlertDialog.Close` or Escape. Defaults to `false`: a backdrop
|
|
@@ -38,24 +30,14 @@ type AlertDialogProps = React.ComponentProps<
|
|
|
38
30
|
*/
|
|
39
31
|
disablePointerDismissal?: boolean;
|
|
40
32
|
};
|
|
41
|
-
type AlertDialogTitleProps = React.ComponentProps<
|
|
42
|
-
|
|
43
|
-
>;
|
|
44
|
-
type AlertDialogTriggerProps = React.ComponentProps<
|
|
45
|
-
typeof AlertDialogPrimitive.Trigger
|
|
46
|
-
>;
|
|
33
|
+
type AlertDialogTitleProps = React.ComponentProps<typeof AlertDialogPrimitive.Title>;
|
|
34
|
+
type AlertDialogTriggerProps = React.ComponentProps<typeof AlertDialogPrimitive.Trigger>;
|
|
47
35
|
|
|
48
36
|
function AlertDialogClose({ ...props }: AlertDialogCloseProps) {
|
|
49
|
-
return
|
|
50
|
-
<AlertDialogPrimitive.Close data-slot="alert-dialog-close" {...props} />
|
|
51
|
-
);
|
|
37
|
+
return <AlertDialogPrimitive.Close data-slot="alert-dialog-close" {...props} />;
|
|
52
38
|
}
|
|
53
39
|
|
|
54
|
-
function AlertDialogContent({
|
|
55
|
-
className,
|
|
56
|
-
size = 'md',
|
|
57
|
-
...props
|
|
58
|
-
}: AlertDialogContentProps) {
|
|
40
|
+
function AlertDialogContent({ className, size = 'md', ...props }: AlertDialogContentProps) {
|
|
59
41
|
return (
|
|
60
42
|
<AlertDialogPrimitive.Portal>
|
|
61
43
|
<AlertDialogPrimitive.Backdrop
|
|
@@ -76,10 +58,7 @@ function AlertDialogContent({
|
|
|
76
58
|
);
|
|
77
59
|
}
|
|
78
60
|
|
|
79
|
-
function AlertDialogDescription({
|
|
80
|
-
className,
|
|
81
|
-
...props
|
|
82
|
-
}: AlertDialogDescriptionProps) {
|
|
61
|
+
function AlertDialogDescription({ className, ...props }: AlertDialogDescriptionProps) {
|
|
83
62
|
return (
|
|
84
63
|
<AlertDialogPrimitive.Description
|
|
85
64
|
className={cn(dialogDescriptionClassName, className)}
|
|
@@ -109,19 +88,14 @@ function AlertDialogHeader({ className, ...props }: AlertDialogHeaderProps) {
|
|
|
109
88
|
);
|
|
110
89
|
}
|
|
111
90
|
|
|
112
|
-
function AlertDialogRoot({
|
|
113
|
-
disablePointerDismissal = false,
|
|
114
|
-
...props
|
|
115
|
-
}: AlertDialogProps) {
|
|
91
|
+
function AlertDialogRoot({ disablePointerDismissal = false, ...props }: AlertDialogProps) {
|
|
116
92
|
if (disablePointerDismissal) {
|
|
117
93
|
return <AlertDialogPrimitive.Root {...props} />;
|
|
118
94
|
}
|
|
119
95
|
|
|
120
96
|
// Base UI's alert dialog always ignores outside presses. A modal Dialog root
|
|
121
97
|
// shares every part and closes on them with the `outside-press` reason.
|
|
122
|
-
return
|
|
123
|
-
<DialogPrimitive.Root {...props} disablePointerDismissal={false} modal />
|
|
124
|
-
);
|
|
98
|
+
return <DialogPrimitive.Root {...props} disablePointerDismissal={false} modal />;
|
|
125
99
|
}
|
|
126
100
|
|
|
127
101
|
function AlertDialogTitle({ className, ...props }: AlertDialogTitleProps) {
|
|
@@ -135,9 +109,7 @@ function AlertDialogTitle({ className, ...props }: AlertDialogTitleProps) {
|
|
|
135
109
|
}
|
|
136
110
|
|
|
137
111
|
function AlertDialogTrigger({ ...props }: AlertDialogTriggerProps) {
|
|
138
|
-
return
|
|
139
|
-
<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
|
|
140
|
-
);
|
|
112
|
+
return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />;
|
|
141
113
|
}
|
|
142
114
|
|
|
143
115
|
const AlertDialog = Object.assign(AlertDialogRoot, {
|
|
@@ -49,15 +49,12 @@ const AVATAR_COLUMNS = people.map((person) => ({
|
|
|
49
49
|
}));
|
|
50
50
|
|
|
51
51
|
function AvatarMatrixCell({ column, row }: ComponentMatrixCellProps) {
|
|
52
|
-
const person =
|
|
53
|
-
people.find((candidate) => candidate.name === column.key) ?? people[0];
|
|
52
|
+
const person = people.find((candidate) => candidate.name === column.key) ?? people[0];
|
|
54
53
|
const src = row.key === 'broken' ? '/missing-avatar.png' : person.src;
|
|
55
54
|
|
|
56
55
|
return (
|
|
57
56
|
<Avatar>
|
|
58
|
-
{row.key === 'fallback' || !src ? null :
|
|
59
|
-
<Avatar.Image alt={person.name} src={src} />
|
|
60
|
-
)}
|
|
57
|
+
{row.key === 'fallback' || !src ? null : <Avatar.Image alt={person.name} src={src} />}
|
|
61
58
|
<Avatar.Fallback>{person.fallback}</Avatar.Fallback>
|
|
62
59
|
</Avatar>
|
|
63
60
|
);
|
|
@@ -79,9 +76,7 @@ export const All: StoryDefinition = {
|
|
|
79
76
|
<Avatar.Group>
|
|
80
77
|
{people.map((person) => (
|
|
81
78
|
<Avatar key={person.name}>
|
|
82
|
-
{person.src ?
|
|
83
|
-
<Avatar.Image alt={person.name} src={person.src} />
|
|
84
|
-
) : null}
|
|
79
|
+
{person.src ? <Avatar.Image alt={person.name} src={person.src} /> : null}
|
|
85
80
|
<Avatar.Fallback>{person.fallback}</Avatar.Fallback>
|
|
86
81
|
</Avatar>
|
|
87
82
|
))}
|
|
@@ -3,9 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { cn } from '../lib/utils';
|
|
5
5
|
|
|
6
|
-
type AvatarFallbackProps = React.ComponentProps<
|
|
7
|
-
typeof AvatarPrimitive.Fallback
|
|
8
|
-
>;
|
|
6
|
+
type AvatarFallbackProps = React.ComponentProps<typeof AvatarPrimitive.Fallback>;
|
|
9
7
|
|
|
10
8
|
type AvatarGroupChildProps = {
|
|
11
9
|
className?: string;
|
|
@@ -33,21 +31,14 @@ function AvatarFallback({ className, ...props }: AvatarFallbackProps) {
|
|
|
33
31
|
|
|
34
32
|
function AvatarGroup({ children, className, ...props }: AvatarGroupProps) {
|
|
35
33
|
return (
|
|
36
|
-
<div
|
|
37
|
-
className={cn('flex -space-x-3', className)}
|
|
38
|
-
data-slot="avatar-group"
|
|
39
|
-
{...props}
|
|
40
|
-
>
|
|
34
|
+
<div className={cn('flex -space-x-3', className)} data-slot="avatar-group" {...props}>
|
|
41
35
|
{React.Children.map(children, (child, index) => {
|
|
42
36
|
if (!React.isValidElement<AvatarGroupChildProps>(child)) {
|
|
43
37
|
return child;
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
return React.cloneElement(child, {
|
|
47
|
-
className: cn(
|
|
48
|
-
'ring-background relative ring-2',
|
|
49
|
-
child.props.className,
|
|
50
|
-
),
|
|
41
|
+
className: cn('ring-background relative ring-2', child.props.className),
|
|
51
42
|
style: {
|
|
52
43
|
...child.props.style,
|
|
53
44
|
zIndex: index + 1,
|
|
@@ -88,9 +79,4 @@ const Avatar = Object.assign(AvatarRoot, {
|
|
|
88
79
|
});
|
|
89
80
|
|
|
90
81
|
export { Avatar, AvatarFallback, AvatarGroup, AvatarImage, AvatarRoot };
|
|
91
|
-
export type {
|
|
92
|
-
AvatarFallbackProps,
|
|
93
|
-
AvatarGroupProps,
|
|
94
|
-
AvatarImageProps,
|
|
95
|
-
AvatarProps,
|
|
96
|
-
};
|
|
82
|
+
export type { AvatarFallbackProps, AvatarGroupProps, AvatarImageProps, AvatarProps };
|
|
@@ -29,11 +29,7 @@ const SEMANTIC_ROWS = [
|
|
|
29
29
|
];
|
|
30
30
|
|
|
31
31
|
function SemanticBadgeCell({ row }: ComponentMatrixCellProps) {
|
|
32
|
-
return
|
|
33
|
-
<Badge variant={row.key as NonNullable<BadgeProps['variant']>}>
|
|
34
|
-
{row.label}
|
|
35
|
-
</Badge>
|
|
36
|
-
);
|
|
32
|
+
return <Badge variant={row.key as NonNullable<BadgeProps['variant']>}>{row.label}</Badge>;
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
export const All: StoryDefinition = {
|
|
@@ -26,10 +26,7 @@ describe('Badge', () => {
|
|
|
26
26
|
|
|
27
27
|
expect(screen.getByText('New')).toHaveAttribute('data-variant', 'default');
|
|
28
28
|
expect(screen.getByText('New')).toHaveAttribute('data-size', 'md');
|
|
29
|
-
expect(screen.getByText('Pending')).toHaveAttribute(
|
|
30
|
-
'data-variant',
|
|
31
|
-
'warning',
|
|
32
|
-
);
|
|
29
|
+
expect(screen.getByText('Pending')).toHaveAttribute('data-variant', 'warning');
|
|
33
30
|
expect(screen.getByText('Pending')).toHaveAttribute('data-size', 'sm');
|
|
34
31
|
});
|
|
35
32
|
});
|
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)}
|