@pickle-ui/react-native 1.0.0-beta.0 → 1.0.0-beta.2
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 +70 -11
- package/dist/components/Badge.d.ts +6 -3
- package/dist/components/Badge.d.ts.map +1 -1
- package/dist/components/Badge.js +36 -7
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Button.d.ts +11 -4
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +100 -15
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.d.ts +15 -5
- package/dist/components/Card.d.ts.map +1 -1
- package/dist/components/Card.js +28 -10
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Flex.d.ts +25 -0
- package/dist/components/Flex.d.ts.map +1 -0
- package/dist/components/Flex.js +24 -0
- package/dist/components/Flex.js.map +1 -0
- package/dist/components/Grid.d.ts +36 -0
- package/dist/components/Grid.d.ts.map +1 -0
- package/dist/components/Grid.js +68 -0
- package/dist/components/Grid.js.map +1 -0
- package/dist/components/Separator.d.ts +11 -0
- package/dist/components/Separator.d.ts.map +1 -0
- package/dist/components/Separator.js +12 -0
- package/dist/components/Separator.js.map +1 -0
- package/dist/components/Spinner.d.ts +14 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +41 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Text.d.ts +7 -3
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +23 -11
- package/dist/components/Text.js.map +1 -1
- package/dist/components/XStack.d.ts +4 -0
- package/dist/components/XStack.d.ts.map +1 -0
- package/dist/components/XStack.js +6 -0
- package/dist/components/XStack.js.map +1 -0
- package/dist/components/YStack.d.ts +4 -0
- package/dist/components/YStack.d.ts.map +1 -0
- package/dist/components/YStack.js +6 -0
- package/dist/components/YStack.js.map +1 -0
- package/dist/components/_internal/InputFrame.d.ts +13 -0
- package/dist/components/_internal/InputFrame.d.ts.map +1 -0
- package/dist/components/_internal/InputFrame.js +14 -0
- package/dist/components/_internal/InputFrame.js.map +1 -0
- package/dist/components/_internal/StoryItem.d.ts +6 -0
- package/dist/components/_internal/StoryItem.d.ts.map +1 -0
- package/dist/components/_internal/StoryItem.js +9 -0
- package/dist/components/_internal/StoryItem.js.map +1 -0
- package/dist/components/_internal/layout.d.ts +79 -0
- package/dist/components/_internal/layout.d.ts.map +1 -0
- package/dist/components/_internal/layout.js +73 -0
- package/dist/components/_internal/layout.js.map +1 -0
- package/dist/components/_internal/useControllableState.d.ts +7 -0
- package/dist/components/_internal/useControllableState.d.ts.map +1 -0
- package/dist/components/_internal/useControllableState.js +17 -0
- package/dist/components/_internal/useControllableState.js.map +1 -0
- package/dist/components/form/Checkbox.d.ts +26 -0
- package/dist/components/form/Checkbox.d.ts.map +1 -0
- package/dist/components/form/Checkbox.js +41 -0
- package/dist/components/form/Checkbox.js.map +1 -0
- package/dist/components/form/Form.context.d.ts +34 -0
- package/dist/components/form/Form.context.d.ts.map +1 -0
- package/dist/components/form/Form.context.js +53 -0
- package/dist/components/form/Form.context.js.map +1 -0
- package/dist/components/form/Form.d.ts +33 -0
- package/dist/components/form/Form.d.ts.map +1 -0
- package/dist/components/form/Form.js +36 -0
- package/dist/components/form/Form.js.map +1 -0
- package/dist/components/form/FormCheckbox.d.ts +7 -0
- package/dist/components/form/FormCheckbox.d.ts.map +1 -0
- package/dist/components/form/FormCheckbox.js +24 -0
- package/dist/components/form/FormCheckbox.js.map +1 -0
- package/dist/components/form/FormDescription.d.ts +4 -0
- package/dist/components/form/FormDescription.d.ts.map +1 -0
- package/dist/components/form/FormDescription.js +7 -0
- package/dist/components/form/FormDescription.js.map +1 -0
- package/dist/components/form/FormError.d.ts +5 -0
- package/dist/components/form/FormError.d.ts.map +1 -0
- package/dist/components/form/FormError.js +8 -0
- package/dist/components/form/FormError.js.map +1 -0
- package/dist/components/form/FormField.d.ts +17 -0
- package/dist/components/form/FormField.d.ts.map +1 -0
- package/dist/components/form/FormField.js +36 -0
- package/dist/components/form/FormField.js.map +1 -0
- package/dist/components/form/FormInput.d.ts +10 -0
- package/dist/components/form/FormInput.d.ts.map +1 -0
- package/dist/components/form/FormInput.js +36 -0
- package/dist/components/form/FormInput.js.map +1 -0
- package/dist/components/form/FormInputGroup.d.ts +8 -0
- package/dist/components/form/FormInputGroup.d.ts.map +1 -0
- package/dist/components/form/FormInputGroup.js +18 -0
- package/dist/components/form/FormInputGroup.js.map +1 -0
- package/dist/components/form/FormLabel.d.ts +4 -0
- package/dist/components/form/FormLabel.d.ts.map +1 -0
- package/dist/components/form/FormLabel.js +7 -0
- package/dist/components/form/FormLabel.js.map +1 -0
- package/dist/components/form/FormRadioGroup.d.ts +11 -0
- package/dist/components/form/FormRadioGroup.d.ts.map +1 -0
- package/dist/components/form/FormRadioGroup.js +24 -0
- package/dist/components/form/FormRadioGroup.js.map +1 -0
- package/dist/components/form/FormRoot.d.ts +13 -0
- package/dist/components/form/FormRoot.d.ts.map +1 -0
- package/dist/components/form/FormRoot.js +19 -0
- package/dist/components/form/FormRoot.js.map +1 -0
- package/dist/components/form/FormTextarea.d.ts +7 -0
- package/dist/components/form/FormTextarea.d.ts.map +1 -0
- package/dist/components/form/FormTextarea.js +27 -0
- package/dist/components/form/FormTextarea.js.map +1 -0
- package/dist/components/form/Input.d.ts +17 -0
- package/dist/components/form/Input.d.ts.map +1 -0
- package/dist/components/form/Input.js +32 -0
- package/dist/components/form/Input.js.map +1 -0
- package/dist/components/form/InputGroup.context.d.ts +10 -0
- package/dist/components/form/InputGroup.context.d.ts.map +1 -0
- package/dist/components/form/InputGroup.context.js +8 -0
- package/dist/components/form/InputGroup.context.js.map +1 -0
- package/dist/components/form/InputGroup.d.ts +31 -0
- package/dist/components/form/InputGroup.d.ts.map +1 -0
- package/dist/components/form/InputGroup.js +123 -0
- package/dist/components/form/InputGroup.js.map +1 -0
- package/dist/components/form/RadioGroup.d.ts +29 -0
- package/dist/components/form/RadioGroup.d.ts.map +1 -0
- package/dist/components/form/RadioGroup.js +42 -0
- package/dist/components/form/RadioGroup.js.map +1 -0
- package/dist/components/form/Textarea.d.ts +19 -0
- package/dist/components/form/Textarea.d.ts.map +1 -0
- package/dist/components/form/Textarea.js +26 -0
- package/dist/components/form/Textarea.js.map +1 -0
- package/dist/entries/card.d.ts +1 -1
- package/dist/entries/card.d.ts.map +1 -1
- package/dist/entries/checkbox.d.ts +3 -0
- package/dist/entries/checkbox.d.ts.map +1 -0
- package/dist/entries/checkbox.js +2 -0
- package/dist/entries/checkbox.js.map +1 -0
- package/dist/entries/flex.d.ts +3 -0
- package/dist/entries/flex.d.ts.map +1 -0
- package/dist/entries/flex.js +2 -0
- package/dist/entries/flex.js.map +1 -0
- package/dist/entries/form.d.ts +3 -0
- package/dist/entries/form.d.ts.map +1 -0
- package/dist/entries/form.js +2 -0
- package/dist/entries/form.js.map +1 -0
- package/dist/entries/grid.d.ts +3 -0
- package/dist/entries/grid.d.ts.map +1 -0
- package/dist/entries/grid.js +2 -0
- package/dist/entries/grid.js.map +1 -0
- package/dist/entries/input-group.d.ts +3 -0
- package/dist/entries/input-group.d.ts.map +1 -0
- package/dist/entries/input-group.js +2 -0
- package/dist/entries/input-group.js.map +1 -0
- package/dist/entries/input.d.ts +3 -0
- package/dist/entries/input.d.ts.map +1 -0
- package/dist/entries/input.js +2 -0
- package/dist/entries/input.js.map +1 -0
- package/dist/entries/radio-group.d.ts +3 -0
- package/dist/entries/radio-group.d.ts.map +1 -0
- package/dist/entries/radio-group.js +2 -0
- package/dist/entries/radio-group.js.map +1 -0
- package/dist/entries/separator.d.ts +3 -0
- package/dist/entries/separator.d.ts.map +1 -0
- package/dist/entries/separator.js +2 -0
- package/dist/entries/separator.js.map +1 -0
- package/dist/entries/spinner.d.ts +3 -0
- package/dist/entries/spinner.d.ts.map +1 -0
- package/dist/entries/spinner.js +2 -0
- package/dist/entries/spinner.js.map +1 -0
- package/dist/entries/textarea.d.ts +3 -0
- package/dist/entries/textarea.d.ts.map +1 -0
- package/dist/entries/textarea.js +2 -0
- package/dist/entries/textarea.js.map +1 -0
- package/dist/entries/theme.d.ts +3 -0
- package/dist/entries/theme.d.ts.map +1 -0
- package/dist/entries/theme.js +2 -0
- package/dist/entries/theme.js.map +1 -0
- package/dist/entries/x-stack.d.ts +3 -0
- package/dist/entries/x-stack.d.ts.map +1 -0
- package/dist/entries/x-stack.js +2 -0
- package/dist/entries/x-stack.js.map +1 -0
- package/dist/entries/y-stack.d.ts +3 -0
- package/dist/entries/y-stack.d.ts.map +1 -0
- package/dist/entries/y-stack.js +2 -0
- package/dist/entries/y-stack.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/cn.d.ts.map +1 -1
- package/dist/lib/cn.js +13 -1
- package/dist/lib/cn.js.map +1 -1
- package/package.json +10 -3
- package/src/base.css +7 -2
- package/src/components/Badge.stories.tsx +51 -6
- package/src/components/Badge.test.tsx +15 -0
- package/src/components/Badge.tsx +73 -17
- package/src/components/Button.stories.tsx +96 -8
- package/src/components/Button.test.tsx +69 -0
- package/src/components/Button.tsx +159 -18
- package/src/components/Card.stories.tsx +17 -4
- package/src/components/Card.test.tsx +24 -1
- package/src/components/Card.tsx +71 -13
- package/src/components/Flex.stories.tsx +58 -0
- package/src/components/Flex.test.tsx +57 -0
- package/src/components/Flex.tsx +52 -0
- package/src/components/Grid.stories.tsx +55 -0
- package/src/components/Grid.test.tsx +140 -0
- package/src/components/Grid.tsx +166 -0
- package/src/components/Separator.stories.tsx +39 -0
- package/src/components/Separator.test.tsx +25 -0
- package/src/components/Separator.tsx +30 -0
- package/src/components/Spinner.stories.tsx +35 -0
- package/src/components/Spinner.test.tsx +30 -0
- package/src/components/Spinner.tsx +75 -0
- package/src/components/Text.stories.tsx +52 -2
- package/src/components/Text.test.tsx +35 -3
- package/src/components/Text.tsx +42 -12
- package/src/components/XStack.stories.tsx +46 -0
- package/src/components/XStack.test.tsx +13 -0
- package/src/components/XStack.tsx +7 -0
- package/src/components/YStack.stories.tsx +46 -0
- package/src/components/YStack.test.tsx +13 -0
- package/src/components/YStack.tsx +7 -0
- package/src/components/_internal/InputFrame.tsx +50 -0
- package/src/components/_internal/Story.tsx +34 -0
- package/src/components/_internal/StoryItem.tsx +24 -0
- package/src/components/_internal/layout.ts +103 -0
- package/src/components/_internal/useControllableState.ts +25 -0
- package/src/components/form/Checkbox.stories.tsx +67 -0
- package/src/components/form/Checkbox.test.tsx +88 -0
- package/src/components/form/Checkbox.tsx +141 -0
- package/src/components/form/Form.context.ts +91 -0
- package/src/components/form/Form.stories.tsx +152 -0
- package/src/components/form/Form.test.tsx +195 -0
- package/src/components/form/Form.tsx +51 -0
- package/src/components/form/FormCheckbox.tsx +42 -0
- package/src/components/form/FormDescription.tsx +14 -0
- package/src/components/form/FormError.tsx +17 -0
- package/src/components/form/FormField.tsx +82 -0
- package/src/components/form/FormInput.tsx +70 -0
- package/src/components/form/FormInputGroup.tsx +30 -0
- package/src/components/form/FormLabel.tsx +17 -0
- package/src/components/form/FormRadioGroup.tsx +48 -0
- package/src/components/form/FormRoot.tsx +41 -0
- package/src/components/form/FormTextarea.tsx +56 -0
- package/src/components/form/Input.stories.tsx +105 -0
- package/src/components/form/Input.test.tsx +76 -0
- package/src/components/form/Input.tsx +81 -0
- package/src/components/form/InputGroup.context.ts +11 -0
- package/src/components/form/InputGroup.stories.tsx +129 -0
- package/src/components/form/InputGroup.test.tsx +95 -0
- package/src/components/form/InputGroup.tsx +266 -0
- package/src/components/form/RadioGroup.stories.tsx +62 -0
- package/src/components/form/RadioGroup.test.tsx +98 -0
- package/src/components/form/RadioGroup.tsx +151 -0
- package/src/components/form/Textarea.stories.tsx +61 -0
- package/src/components/form/Textarea.test.tsx +35 -0
- package/src/components/form/Textarea.tsx +74 -0
- package/src/entries/card.ts +2 -0
- package/src/entries/checkbox.ts +2 -0
- package/src/entries/flex.ts +2 -0
- package/src/entries/form.ts +13 -0
- package/src/entries/grid.ts +2 -0
- package/src/entries/input-group.ts +8 -0
- package/src/entries/input.ts +2 -0
- package/src/entries/radio-group.ts +5 -0
- package/src/entries/separator.ts +2 -0
- package/src/entries/spinner.ts +2 -0
- package/src/entries/textarea.ts +2 -0
- package/src/entries/theme.ts +7 -0
- package/src/entries/x-stack.ts +2 -0
- package/src/entries/y-stack.ts +2 -0
- package/src/index.ts +13 -0
- package/src/lib/cn.test.ts +6 -0
- package/src/lib/cn.ts +14 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../src/entries/radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../src/entries/separator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separator.js","sourceRoot":"","sources":["../../src/entries/separator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/entries/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../src/entries/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/entries/textarea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../src/entries/textarea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/entries/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,YAAY,EACV,KAAK,EACL,UAAU,EACV,YAAY,EACZ,cAAc,GACf,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/entries/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x-stack.d.ts","sourceRoot":"","sources":["../../src/entries/x-stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x-stack.js","sourceRoot":"","sources":["../../src/entries/x-stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"y-stack.d.ts","sourceRoot":"","sources":["../../src/entries/y-stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"y-stack.js","sourceRoot":"","sources":["../../src/entries/y-stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
export * from './entries/badge';
|
|
2
2
|
export * from './entries/button';
|
|
3
3
|
export * from './entries/card';
|
|
4
|
+
export * from './entries/checkbox';
|
|
4
5
|
export * from './entries/cn';
|
|
6
|
+
export * from './entries/flex';
|
|
7
|
+
export * from './entries/form';
|
|
8
|
+
export * from './entries/grid';
|
|
9
|
+
export * from './entries/input';
|
|
10
|
+
export * from './entries/input-group';
|
|
11
|
+
export * from './entries/radio-group';
|
|
12
|
+
export * from './entries/separator';
|
|
13
|
+
export * from './entries/spinner';
|
|
5
14
|
export * from './entries/text';
|
|
15
|
+
export * from './entries/textarea';
|
|
16
|
+
export * from './entries/theme';
|
|
6
17
|
export * from './entries/use-color-token';
|
|
18
|
+
export * from './entries/x-stack';
|
|
19
|
+
export * from './entries/y-stack';
|
|
7
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,20 @@
|
|
|
3
3
|
export * from './entries/badge';
|
|
4
4
|
export * from './entries/button';
|
|
5
5
|
export * from './entries/card';
|
|
6
|
+
export * from './entries/checkbox';
|
|
6
7
|
export * from './entries/cn';
|
|
8
|
+
export * from './entries/flex';
|
|
9
|
+
export * from './entries/form';
|
|
10
|
+
export * from './entries/grid';
|
|
11
|
+
export * from './entries/input';
|
|
12
|
+
export * from './entries/input-group';
|
|
13
|
+
export * from './entries/radio-group';
|
|
14
|
+
export * from './entries/separator';
|
|
15
|
+
export * from './entries/spinner';
|
|
7
16
|
export * from './entries/text';
|
|
17
|
+
export * from './entries/textarea';
|
|
18
|
+
export * from './entries/theme';
|
|
8
19
|
export * from './entries/use-color-token';
|
|
20
|
+
export * from './entries/x-stack';
|
|
21
|
+
export * from './entries/y-stack';
|
|
9
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
|
package/dist/lib/cn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings":"AAeA,wEAAwE;AACxE,wBAAgB,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC,UAEtE"}
|
package/dist/lib/cn.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
2
|
+
/**
|
|
3
|
+
* Teaches tailwind-merge Pickle's type scale: `text-body`, `text-h1`, … are
|
|
4
|
+
* font sizes, so they must not be mistaken for text colors and dropped next
|
|
5
|
+
* to one.
|
|
6
|
+
*/
|
|
7
|
+
const twMerge = extendTailwindMerge({
|
|
8
|
+
extend: {
|
|
9
|
+
theme: {
|
|
10
|
+
text: ['body', 'code', 'h1', 'h2', 'h3', 'h4', 'lead', 'small'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
2
14
|
/** Joins class names; later classes win, like `@pickle-ui/react/cn`. */
|
|
3
15
|
export function cn(...classes) {
|
|
4
16
|
return twMerge(classes.filter(Boolean).join(' '));
|
package/dist/lib/cn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;GAIG;AACH,MAAM,OAAO,GAAG,mBAAmB,CAAC;IAClC,MAAM,EAAE;QACN,KAAK,EAAE;YACL,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC;SAChE;KACF;CACF,CAAC,CAAC;AAEH,wEAAwE;AACxE,MAAM,UAAU,EAAE,CAAC,GAAG,OAAiD;IACrE,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pickle-ui/react-native",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native components for Expo, styled with Pickle UI's tokens through Uniwind.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -49,12 +49,15 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"class-variance-authority": "^0.7.1",
|
|
51
51
|
"tailwind-merge": "^3.6.0",
|
|
52
|
-
"@pickle-ui/tokens": "1.0.0-beta.
|
|
52
|
+
"@pickle-ui/tokens": "1.0.0-beta.7"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
+
"@hookform/resolvers": "^5.4.0",
|
|
56
|
+
"@react-native/assets-registry": "0.88.0",
|
|
55
57
|
"@react-native/jest-preset": "^0.88.1",
|
|
56
58
|
"@storybook/addon-docs": "^10.6.3",
|
|
57
59
|
"@storybook/react-native-web-vite": "^10.6.5",
|
|
60
|
+
"@tabler/icons-react-native": "^3.50.0",
|
|
58
61
|
"@tailwindcss/vite": "^4.3.3",
|
|
59
62
|
"@testing-library/react-native": "^14.1.0",
|
|
60
63
|
"@types/jest": "^30.0.0",
|
|
@@ -66,17 +69,21 @@
|
|
|
66
69
|
"react": "19.3.0",
|
|
67
70
|
"react-doctor": "^0.5.6",
|
|
68
71
|
"react-dom": "19.3.0",
|
|
72
|
+
"react-hook-form": "^7.79.0",
|
|
69
73
|
"react-native": "0.88.0",
|
|
74
|
+
"react-native-svg": "^15.16.0",
|
|
70
75
|
"react-native-web": "^0.21.4",
|
|
71
76
|
"storybook": "^10.6.3",
|
|
72
77
|
"tailwindcss": "^4.3.3",
|
|
73
78
|
"test-renderer": "^1.3.1",
|
|
74
79
|
"typescript": "^6.0.3",
|
|
75
80
|
"uniwind": "^1.13.0",
|
|
76
|
-
"vite": "^8.3.5"
|
|
81
|
+
"vite": "^8.3.5",
|
|
82
|
+
"zod": "4.0.17"
|
|
77
83
|
},
|
|
78
84
|
"peerDependencies": {
|
|
79
85
|
"react": "^19.0.0",
|
|
86
|
+
"react-hook-form": "^7.0.0",
|
|
80
87
|
"react-native": "*",
|
|
81
88
|
"tailwindcss": "^4.0.0",
|
|
82
89
|
"uniwind": "^1.13.0"
|
package/src/base.css
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pickle's components as a content source, so Uniwind generates the classes
|
|
3
|
-
* they use
|
|
4
|
-
*
|
|
3
|
+
* they use, and the type scale behind `Text`'s variants, shared with
|
|
4
|
+
* `@pickle-ui/react`. `styles.css` imports this file; import it alone, after
|
|
5
|
+
* `uniwind`, to bring your own token set instead of
|
|
6
|
+
* `@pickle-ui/tokens/native.css`. The type scale only declares theme
|
|
7
|
+
* variables, so it compiles in any order.
|
|
5
8
|
*/
|
|
9
|
+
@import '@pickle-ui/tokens/typography.css';
|
|
10
|
+
|
|
6
11
|
@source './components/**/*.{ts,tsx}';
|
|
@@ -10,21 +10,48 @@ const meta = {
|
|
|
10
10
|
} satisfies Meta<typeof Badge>;
|
|
11
11
|
|
|
12
12
|
export default meta;
|
|
13
|
+
type BadgeSize = NonNullable<BadgeProps['size']>;
|
|
14
|
+
type BadgeVariant = NonNullable<BadgeProps['variant']>;
|
|
13
15
|
type StoryDefinition = StoryObj<typeof meta>;
|
|
14
16
|
|
|
15
|
-
const DISPLAY_COLUMNS = [
|
|
17
|
+
const DISPLAY_COLUMNS = [
|
|
18
|
+
{ key: 'label', label: 'Label only' },
|
|
19
|
+
{ key: 'icon', label: 'With icon' },
|
|
20
|
+
];
|
|
16
21
|
|
|
17
|
-
const SEMANTIC_ROWS = [
|
|
22
|
+
const SEMANTIC_ROWS: { key: BadgeVariant; label: string }[] = [
|
|
18
23
|
{ key: 'default', label: 'Default' },
|
|
19
24
|
{ key: 'secondary', label: 'Secondary' },
|
|
25
|
+
{ key: 'outline', label: 'Outline' },
|
|
26
|
+
{ key: 'info', label: 'Info' },
|
|
27
|
+
{ key: 'success', label: 'Success' },
|
|
28
|
+
{ key: 'warning', label: 'Warning' },
|
|
29
|
+
{ key: 'error', label: 'Error' },
|
|
30
|
+
{ key: 'destructive', label: 'Destructive' },
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const STATUS_ROWS: { key: BadgeVariant; label: string }[] = [
|
|
34
|
+
{ key: 'pending', label: 'Pending' },
|
|
35
|
+
{ key: 'submitted', label: 'Submitted' },
|
|
20
36
|
{ key: 'inProgress', label: 'In progress' },
|
|
21
37
|
{ key: 'inReview', label: 'In review' },
|
|
22
|
-
{ key: '
|
|
38
|
+
{ key: 'failed', label: 'Failed' },
|
|
39
|
+
{ key: 'expired', label: 'Expired' },
|
|
23
40
|
];
|
|
24
41
|
|
|
25
|
-
|
|
42
|
+
const SIZE_COLUMNS: { description: string; key: BadgeSize; label: string }[] = [
|
|
43
|
+
{ description: 'h-4', key: 'sm', label: 'Small' },
|
|
44
|
+
{ description: 'h-4.5', key: 'md', label: 'Medium' },
|
|
45
|
+
{ description: 'h-5.5', key: 'lg', label: 'Large' },
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
function BadgeCell({ row }: ComponentMatrixCellProps) {
|
|
49
|
+
return <Badge variant={row.key as BadgeVariant}>{row.label}</Badge>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function BadgeSizeCell({ column, row }: ComponentMatrixCellProps) {
|
|
26
53
|
return (
|
|
27
|
-
<Badge variant={row.key as
|
|
54
|
+
<Badge size={column.key as BadgeSize} variant={row.key as BadgeVariant}>
|
|
28
55
|
{row.label}
|
|
29
56
|
</Badge>
|
|
30
57
|
);
|
|
@@ -36,12 +63,30 @@ export const All: StoryDefinition = {
|
|
|
36
63
|
<Story.Layout className="max-w-4xl" title="Badge">
|
|
37
64
|
<Story.Section title="Semantic badges">
|
|
38
65
|
<Story.Matrix
|
|
39
|
-
Cell={
|
|
66
|
+
Cell={BadgeCell}
|
|
40
67
|
cellClassName="min-h-16"
|
|
41
68
|
columns={DISPLAY_COLUMNS}
|
|
42
69
|
rows={SEMANTIC_ROWS}
|
|
43
70
|
/>
|
|
44
71
|
</Story.Section>
|
|
72
|
+
|
|
73
|
+
<Story.Section title="Statuses">
|
|
74
|
+
<Story.Matrix
|
|
75
|
+
Cell={BadgeCell}
|
|
76
|
+
cellClassName="min-h-16"
|
|
77
|
+
columns={DISPLAY_COLUMNS}
|
|
78
|
+
rows={STATUS_ROWS}
|
|
79
|
+
/>
|
|
80
|
+
</Story.Section>
|
|
81
|
+
|
|
82
|
+
<Story.Section title="Sizes">
|
|
83
|
+
<Story.Matrix
|
|
84
|
+
Cell={BadgeSizeCell}
|
|
85
|
+
cellClassName="min-h-16"
|
|
86
|
+
columns={SIZE_COLUMNS}
|
|
87
|
+
rows={SEMANTIC_ROWS.slice(0, 3)}
|
|
88
|
+
/>
|
|
89
|
+
</Story.Section>
|
|
45
90
|
</Story.Layout>
|
|
46
91
|
),
|
|
47
92
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react-native';
|
|
2
|
+
import { View } from 'react-native';
|
|
2
3
|
|
|
3
4
|
import { Badge } from './Badge';
|
|
4
5
|
|
|
@@ -8,4 +9,18 @@ describe('Badge', () => {
|
|
|
8
9
|
|
|
9
10
|
expect(screen.getByText('Shipped')).toBeOnTheScreen();
|
|
10
11
|
});
|
|
12
|
+
|
|
13
|
+
it('renders icons next to the label', async () => {
|
|
14
|
+
await render(
|
|
15
|
+
<Badge size="lg" testID="badge" variant="warning">
|
|
16
|
+
<View testID="icon" />
|
|
17
|
+
Pending
|
|
18
|
+
</Badge>,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
expect(screen.getByTestId('badge')).toContainElement(
|
|
22
|
+
screen.getByTestId('icon'),
|
|
23
|
+
);
|
|
24
|
+
expect(screen.getByText('Pending')).toBeOnTheScreen();
|
|
25
|
+
});
|
|
11
26
|
});
|
package/src/components/Badge.tsx
CHANGED
|
@@ -1,42 +1,98 @@
|
|
|
1
1
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { Children, isValidElement } from 'react';
|
|
2
3
|
import { Text, View } from 'react-native';
|
|
3
4
|
|
|
4
5
|
import { cn } from '../lib/cn';
|
|
5
6
|
|
|
6
|
-
//
|
|
7
|
-
const badgeVariants = cva(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
variant:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
// Same variants and sizes as `Badge` in @pickle-ui/react.
|
|
8
|
+
const badgeVariants = cva(
|
|
9
|
+
'flex-row items-center justify-center gap-1 self-start rounded-sm border border-transparent',
|
|
10
|
+
{
|
|
11
|
+
defaultVariants: { size: 'md', variant: 'default' },
|
|
12
|
+
variants: {
|
|
13
|
+
size: {
|
|
14
|
+
lg: 'h-5.5 min-w-5.5 px-1.5',
|
|
15
|
+
md: 'h-4.5 min-w-4.5 px-1',
|
|
16
|
+
sm: 'h-4 min-w-4 rounded px-1',
|
|
17
|
+
},
|
|
18
|
+
variant: {
|
|
19
|
+
default: 'bg-primary',
|
|
20
|
+
destructive: 'bg-destructive',
|
|
21
|
+
error: 'bg-destructive-subtle',
|
|
22
|
+
expired: 'bg-secondary',
|
|
23
|
+
failed: 'bg-destructive-subtle',
|
|
24
|
+
info: 'bg-info-subtle',
|
|
25
|
+
inProgress: 'bg-info-subtle',
|
|
26
|
+
inReview: 'bg-warning-subtle',
|
|
27
|
+
outline: 'border-input bg-background dark:bg-input/32',
|
|
28
|
+
pending: 'bg-warning-subtle',
|
|
29
|
+
secondary: 'bg-secondary',
|
|
30
|
+
submitted: 'bg-info-subtle',
|
|
31
|
+
success: 'bg-success-subtle',
|
|
32
|
+
warning: 'bg-warning-subtle',
|
|
33
|
+
},
|
|
16
34
|
},
|
|
17
35
|
},
|
|
18
|
-
|
|
36
|
+
);
|
|
19
37
|
|
|
20
|
-
const labelVariants = cva('
|
|
21
|
-
defaultVariants: { variant: 'default' },
|
|
38
|
+
const labelVariants = cva('font-medium', {
|
|
39
|
+
defaultVariants: { size: 'md', variant: 'default' },
|
|
22
40
|
variants: {
|
|
41
|
+
size: {
|
|
42
|
+
lg: 'text-sm',
|
|
43
|
+
md: 'text-xs',
|
|
44
|
+
sm: 'text-[10px]',
|
|
45
|
+
},
|
|
23
46
|
variant: {
|
|
24
47
|
default: 'text-primary-foreground',
|
|
48
|
+
destructive: 'text-destructive-foreground',
|
|
49
|
+
error: 'text-destructive-subtle-foreground',
|
|
50
|
+
expired: 'text-secondary-foreground',
|
|
51
|
+
failed: 'text-destructive-subtle-foreground',
|
|
52
|
+
info: 'text-info-subtle-foreground',
|
|
25
53
|
inProgress: 'text-info-subtle-foreground',
|
|
26
54
|
inReview: 'text-warning-subtle-foreground',
|
|
55
|
+
outline: 'text-foreground',
|
|
56
|
+
pending: 'text-warning-subtle-foreground',
|
|
27
57
|
secondary: 'text-secondary-foreground',
|
|
58
|
+
submitted: 'text-info-subtle-foreground',
|
|
28
59
|
success: 'text-success-subtle-foreground',
|
|
60
|
+
warning: 'text-warning-subtle-foreground',
|
|
29
61
|
},
|
|
30
62
|
},
|
|
31
63
|
});
|
|
32
64
|
|
|
33
65
|
export type BadgeProps = React.ComponentProps<typeof View> &
|
|
34
|
-
VariantProps<typeof badgeVariants> & {
|
|
66
|
+
VariantProps<typeof badgeVariants> & {
|
|
67
|
+
/** Text is wrapped in the label; other children, such as icons, render as they are. */
|
|
68
|
+
children: React.ReactNode;
|
|
69
|
+
labelClassName?: string;
|
|
70
|
+
};
|
|
35
71
|
|
|
36
|
-
export function Badge({
|
|
72
|
+
export function Badge({
|
|
73
|
+
children,
|
|
74
|
+
className,
|
|
75
|
+
labelClassName,
|
|
76
|
+
size = 'md',
|
|
77
|
+
variant = 'default',
|
|
78
|
+
...props
|
|
79
|
+
}: BadgeProps) {
|
|
37
80
|
return (
|
|
38
|
-
<View
|
|
39
|
-
|
|
81
|
+
<View
|
|
82
|
+
className={cn(badgeVariants({ size, variant }), className)}
|
|
83
|
+
{...props}
|
|
84
|
+
>
|
|
85
|
+
{Children.map(children, (child) =>
|
|
86
|
+
typeof child === 'string' || typeof child === 'number' ? (
|
|
87
|
+
<Text
|
|
88
|
+
className={cn(labelVariants({ size, variant }), labelClassName)}
|
|
89
|
+
>
|
|
90
|
+
{child}
|
|
91
|
+
</Text>
|
|
92
|
+
) : isValidElement(child) ? (
|
|
93
|
+
child
|
|
94
|
+
) : null,
|
|
95
|
+
)}
|
|
40
96
|
</View>
|
|
41
97
|
);
|
|
42
98
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
2
|
|
|
3
|
+
import { IconPlus } from '@tabler/icons-react-native';
|
|
4
|
+
|
|
3
5
|
import { type ComponentMatrixCellProps, Story } from './_internal/Story';
|
|
4
6
|
import { Button, type ButtonProps } from './Button';
|
|
5
7
|
|
|
@@ -23,6 +25,7 @@ const STATE_COLUMNS: {
|
|
|
23
25
|
}[] = [
|
|
24
26
|
{ key: 'default', label: 'Default', props: {} },
|
|
25
27
|
{ key: 'disabled', label: 'Disabled', props: { disabled: true } },
|
|
28
|
+
{ key: 'loading', label: 'Loading', props: { loading: true } },
|
|
26
29
|
];
|
|
27
30
|
|
|
28
31
|
const STATE_PROPS = Object.fromEntries(
|
|
@@ -36,20 +39,93 @@ const VARIANT_ROWS: {
|
|
|
36
39
|
{ key: 'default', label: 'Default' },
|
|
37
40
|
{ key: 'secondary', label: 'Secondary' },
|
|
38
41
|
{ key: 'destructive', label: 'Destructive' },
|
|
42
|
+
{ key: 'destructive-outline', label: 'Destructive outline' },
|
|
39
43
|
{ key: 'outline', label: 'Outline' },
|
|
40
44
|
{ key: 'ghost', label: 'Ghost' },
|
|
45
|
+
{ key: 'link', label: 'Link' },
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const SIZE_COLUMNS: {
|
|
49
|
+
description: string;
|
|
50
|
+
icon: ButtonSize;
|
|
51
|
+
key: ButtonSize;
|
|
52
|
+
label: string;
|
|
53
|
+
}[] = [
|
|
54
|
+
{ description: 'h-6', icon: 'icon-xs', key: 'xs', label: 'Extra small' },
|
|
55
|
+
{ description: 'h-7', icon: 'icon-sm', key: 'sm', label: 'Small' },
|
|
56
|
+
{ description: 'h-8', icon: 'icon', key: 'md', label: 'Medium' },
|
|
57
|
+
{ description: 'h-9', icon: 'icon-lg', key: 'lg', label: 'Large' },
|
|
58
|
+
{ description: 'h-10', icon: 'icon-xl', key: 'xl', label: 'Extra large' },
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
const ICON_SIZES = Object.fromEntries(
|
|
62
|
+
SIZE_COLUMNS.map((column) => [column.key, column.icon]),
|
|
63
|
+
) as Record<string, ButtonSize>;
|
|
64
|
+
|
|
65
|
+
// The web's `[&_svg]:size-*` per button size, in points.
|
|
66
|
+
const ICON_PIXELS: Record<string, number> = { xl: 18, xs: 14 };
|
|
67
|
+
|
|
68
|
+
const CONTENT_ROWS = [
|
|
69
|
+
{ key: 'text', label: 'Text' },
|
|
70
|
+
{ key: 'with-icon', label: 'Icon and text' },
|
|
71
|
+
{
|
|
72
|
+
description: 'Use an icon size with accessibilityLabel',
|
|
73
|
+
key: 'icon',
|
|
74
|
+
label: 'Icon only',
|
|
75
|
+
},
|
|
41
76
|
];
|
|
42
77
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
78
|
+
// Icons don't inherit the label's color on native; pass it to the icon.
|
|
79
|
+
const ICON_COLORS: Record<ButtonVariant, string> = {
|
|
80
|
+
default: 'text-primary-foreground',
|
|
81
|
+
destructive: 'text-destructive-foreground',
|
|
82
|
+
'destructive-outline': 'text-destructive-subtle-foreground',
|
|
83
|
+
ghost: 'text-foreground',
|
|
84
|
+
link: 'text-foreground',
|
|
85
|
+
outline: 'text-foreground',
|
|
86
|
+
secondary: 'text-secondary-foreground',
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
function ButtonContentCell({ column, row }: ComponentMatrixCellProps) {
|
|
90
|
+
const variant = column.key as ButtonVariant;
|
|
91
|
+
const icon = <Story.Icon className={ICON_COLORS[variant]} icon={IconPlus} />;
|
|
92
|
+
|
|
93
|
+
if (row.key === 'icon') {
|
|
94
|
+
return (
|
|
95
|
+
<Button accessibilityLabel="Add" size="icon" variant={variant}>
|
|
96
|
+
{icon}
|
|
97
|
+
</Button>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Button variant={variant}>
|
|
103
|
+
{row.key === 'with-icon' ? icon : null}
|
|
104
|
+
Add
|
|
105
|
+
</Button>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
49
108
|
|
|
50
109
|
function ButtonSizeCell({ column, row }: ComponentMatrixCellProps) {
|
|
110
|
+
const icon = (
|
|
111
|
+
<Story.Icon
|
|
112
|
+
className={ICON_COLORS.default}
|
|
113
|
+
icon={IconPlus}
|
|
114
|
+
size={ICON_PIXELS[column.key]}
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
if (row.key === 'icon') {
|
|
119
|
+
return (
|
|
120
|
+
<Button accessibilityLabel="Add" size={ICON_SIZES[column.key]}>
|
|
121
|
+
{icon}
|
|
122
|
+
</Button>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
51
126
|
return (
|
|
52
|
-
<Button size={column.key as ButtonSize}
|
|
127
|
+
<Button size={column.key as ButtonSize}>
|
|
128
|
+
{row.key === 'with-icon' ? icon : null}
|
|
53
129
|
Add
|
|
54
130
|
</Button>
|
|
55
131
|
);
|
|
@@ -75,11 +151,23 @@ export const All: StoryDefinition = {
|
|
|
75
151
|
/>
|
|
76
152
|
</Story.Section>
|
|
77
153
|
|
|
154
|
+
<Story.Section title="Content patterns">
|
|
155
|
+
<Story.Matrix
|
|
156
|
+
Cell={ButtonContentCell}
|
|
157
|
+
columns={[
|
|
158
|
+
{ key: 'default', label: 'Default' },
|
|
159
|
+
{ key: 'outline', label: 'Outline' },
|
|
160
|
+
{ key: 'ghost', label: 'Ghost' },
|
|
161
|
+
]}
|
|
162
|
+
rows={CONTENT_ROWS}
|
|
163
|
+
/>
|
|
164
|
+
</Story.Section>
|
|
165
|
+
|
|
78
166
|
<Story.Section title="Sizes">
|
|
79
167
|
<Story.Matrix
|
|
80
168
|
Cell={ButtonSizeCell}
|
|
81
169
|
columns={SIZE_COLUMNS}
|
|
82
|
-
rows={
|
|
170
|
+
rows={CONTENT_ROWS}
|
|
83
171
|
/>
|
|
84
172
|
</Story.Section>
|
|
85
173
|
</Story.Layout>
|