@pickle-ui/react-native 1.0.0-beta.1 → 1.0.0-beta.3
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 +62 -24
- package/dist/components/Badge.js +1 -1
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +27 -23
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.d.ts.map +1 -1
- package/dist/components/Card.js +7 -4
- 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.map +1 -1
- package/dist/components/Text.js +5 -4
- 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 +43 -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/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/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 +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
- package/src/base.css +23 -5
- package/src/components/Badge.tsx +1 -1
- package/src/components/Button.tsx +27 -23
- package/src/components/Card.tsx +12 -8
- 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 +49 -0
- package/src/components/Text.tsx +5 -4
- 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/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 +167 -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 +20 -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/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/x-stack.ts +2 -0
- package/src/entries/y-stack.ts +2 -0
- package/src/fonts.test.tsx +244 -0
- package/src/index.ts +12 -0
- package/src/styles.css +12 -0
- package/dist/components/_internal/Spinner.d.ts +0 -9
- package/dist/components/_internal/Spinner.d.ts.map +0 -1
- package/dist/components/_internal/Spinner.js +0 -31
- package/dist/components/_internal/Spinner.js.map +0 -1
- package/src/components/_internal/Spinner.tsx +0 -49
package/dist/components/Text.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Text as NativeText, Platform, StyleSheet } from 'react-native';
|
|
|
4
4
|
import { cn } from '../lib/cn';
|
|
5
5
|
// Same variants, tones and weights as `Text` in @pickle-ui/react, sized by the
|
|
6
6
|
// shared type scale (`@pickle-ui/tokens/typography.css`).
|
|
7
|
-
const textVariants = cva('text-foreground', {
|
|
7
|
+
const textVariants = cva('text-foreground font-sans', {
|
|
8
8
|
defaultVariants: { variant: 'body' },
|
|
9
9
|
variants: {
|
|
10
10
|
tone: {
|
|
@@ -15,8 +15,8 @@ const textVariants = cva('text-foreground', {
|
|
|
15
15
|
variant: {
|
|
16
16
|
body: 'text-body',
|
|
17
17
|
code: 'text-code bg-muted self-start overflow-hidden rounded px-2 py-1',
|
|
18
|
-
h1: 'text-h1 font-semibold tracking-tight',
|
|
19
|
-
h2: 'text-h2 font-semibold tracking-tight',
|
|
18
|
+
h1: 'font-heading text-h1 font-semibold tracking-tight',
|
|
19
|
+
h2: 'font-heading text-h2 font-semibold tracking-tight',
|
|
20
20
|
h3: 'text-h3 font-semibold',
|
|
21
21
|
h4: 'text-h4 font-medium',
|
|
22
22
|
lead: 'text-lead',
|
|
@@ -30,7 +30,8 @@ const textVariants = cva('text-foreground', {
|
|
|
30
30
|
});
|
|
31
31
|
const HEADINGS = new Set(['h1', 'h2', 'h3', 'h4']);
|
|
32
32
|
// Uniwind passes `font-mono`'s web font stack through as is, which native
|
|
33
|
-
// fonts don't resolve, so `code` names each platform's monospace font.
|
|
33
|
+
// fonts don't resolve, so `code` names each platform's monospace font. The
|
|
34
|
+
// `style` prop wins over `font-sans` from `className`.
|
|
34
35
|
const styles = StyleSheet.create({
|
|
35
36
|
code: { fontFamily: Platform.select({ default: 'monospace', ios: 'Menlo' }) },
|
|
36
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EAAE,E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G,EAAE,OAAO,EAAE,CAAC,EAAE;CAC9E,CAAC,CAAC;AAQH,MAAM,UAAU,IAAI,CAAC,EACnB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,GAAG,MAAM,EAChB,MAAM,EACN,GAAG,KAAK,EACE;IACV,OAAO,CACL,KAAC,UAAU,IACT,iBAAiB,EACf,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAEzD,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,CAAC,EACjE,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EACvC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,KACpD,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XStack.d.ts","sourceRoot":"","sources":["../../src/components/XStack.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEvD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAExC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XStack.js","sourceRoot":"","sources":["../../src/components/XStack.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAC;AAI9C,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,KAAC,IAAI,IAAC,SAAS,EAAC,KAAK,KAAK,KAAK,GAAI,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YStack.d.ts","sourceRoot":"","sources":["../../src/components/YStack.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEvD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAExC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YStack.js","sourceRoot":"","sources":["../../src/components/YStack.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAC;AAI9C,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,KAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,KAAK,KAAK,GAAI,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
export type InputFrameProps = React.ComponentProps<typeof View> & {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
focused: boolean;
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The border, background and focus ring the web's `Input`, `Textarea` and
|
|
9
|
+
* `InputGroup` draw around their field. React Native has no `ring`, so a
|
|
10
|
+
* 3pt outline sits outside the border while the field has focus.
|
|
11
|
+
*/
|
|
12
|
+
export declare function InputFrame({ children, className, disabled, focused, invalid, ...props }: InputFrameProps): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=InputFrame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputFrame.d.ts","sourceRoot":"","sources":["../../../src/components/_internal/InputFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIpC,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,GAAG;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EACP,GAAG,KAAK,EACT,EAAE,eAAe,+BA2BjB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
/**
|
|
5
|
+
* The border, background and focus ring the web's `Input`, `Textarea` and
|
|
6
|
+
* `InputGroup` draw around their field. React Native has no `ring`, so a
|
|
7
|
+
* 3pt outline sits outside the border while the field has focus.
|
|
8
|
+
*/
|
|
9
|
+
export function InputFrame({ children, className, disabled, focused, invalid, ...props }) {
|
|
10
|
+
return (_jsxs(View, { className: cn('border-input bg-background dark:bg-input/32 w-full flex-row rounded-lg border shadow-xs shadow-black/5', invalid && 'border-destructive/36', focused && (invalid ? 'border-destructive/64' : 'border-ring'), (disabled || focused || invalid) && 'shadow-none', disabled && 'opacity-64', className), ...props, children: [children, focused ? (_jsx(View, { className: cn('absolute -inset-1 rounded-[calc(var(--radius)+3px)] border-[3px]', invalid
|
|
11
|
+
? 'border-destructive/16 dark:border-destructive/24'
|
|
12
|
+
: 'border-ring/24'), pointerEvents: "none" })) : null] }));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=InputFrame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputFrame.js","sourceRoot":"","sources":["../../../src/components/_internal/InputFrame.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAQlC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EACP,GAAG,KAAK,EACQ;IAChB,OAAO,CACL,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,wGAAwG,EACxG,OAAO,IAAI,uBAAuB,EAClC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,aAAa,CAAC,EAC9D,CAAC,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,aAAa,EACjD,QAAQ,IAAI,YAAY,EACxB,SAAS,CACV,KACG,KAAK,aAER,QAAQ,EACR,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,kEAAkE,EAClE,OAAO;oBACL,CAAC,CAAC,kDAAkD;oBACpD,CAAC,CAAC,gBAAgB,CACrB,EACD,aAAa,EAAC,MAAM,GACpB,CACH,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoryItem.d.ts","sourceRoot":"","sources":["../../../src/components/_internal/StoryItem.tsx"],"names":[],"mappings":"AAKA,6CAA6C;AAC7C,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAWA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
import { Text } from '../Text';
|
|
5
|
+
/** A labelled box for the layout stories. */
|
|
6
|
+
export function StoryItem({ children, className, }) {
|
|
7
|
+
return (_jsx(View, { className: cn('border-border bg-muted items-center justify-center rounded-md border px-4 py-3', className), children: _jsx(Text, { children: children }) }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=StoryItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoryItem.js","sourceRoot":"","sources":["../../../src/components/_internal/StoryItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,6CAA6C;AAC7C,MAAM,UAAU,SAAS,CAAC,EACxB,QAAQ,EACR,SAAS,GAIV;IACC,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,gFAAgF,EAChF,SAAS,CACV,YAED,KAAC,IAAI,cAAE,QAAQ,GAAQ,GAClB,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
declare const alignClasses: {
|
|
2
|
+
readonly baseline: "items-baseline";
|
|
3
|
+
readonly center: "items-center";
|
|
4
|
+
readonly end: "items-end";
|
|
5
|
+
readonly start: "items-start";
|
|
6
|
+
readonly stretch: "items-stretch";
|
|
7
|
+
};
|
|
8
|
+
declare const gapClasses: {
|
|
9
|
+
readonly 0: "gap-0";
|
|
10
|
+
readonly 0.5: "gap-0.5";
|
|
11
|
+
readonly 1: "gap-1";
|
|
12
|
+
readonly 1.5: "gap-1.5";
|
|
13
|
+
readonly 2: "gap-2";
|
|
14
|
+
readonly 2.5: "gap-2.5";
|
|
15
|
+
readonly 3: "gap-3";
|
|
16
|
+
readonly 3.5: "gap-3.5";
|
|
17
|
+
readonly 4: "gap-4";
|
|
18
|
+
readonly 5: "gap-5";
|
|
19
|
+
readonly 6: "gap-6";
|
|
20
|
+
readonly 8: "gap-8";
|
|
21
|
+
readonly 10: "gap-10";
|
|
22
|
+
readonly 12: "gap-12";
|
|
23
|
+
readonly 16: "gap-16";
|
|
24
|
+
};
|
|
25
|
+
export declare const gapXClasses: {
|
|
26
|
+
readonly 0: "gap-x-0";
|
|
27
|
+
readonly 0.5: "gap-x-0.5";
|
|
28
|
+
readonly 1: "gap-x-1";
|
|
29
|
+
readonly 1.5: "gap-x-1.5";
|
|
30
|
+
readonly 2: "gap-x-2";
|
|
31
|
+
readonly 2.5: "gap-x-2.5";
|
|
32
|
+
readonly 3: "gap-x-3";
|
|
33
|
+
readonly 3.5: "gap-x-3.5";
|
|
34
|
+
readonly 4: "gap-x-4";
|
|
35
|
+
readonly 5: "gap-x-5";
|
|
36
|
+
readonly 6: "gap-x-6";
|
|
37
|
+
readonly 8: "gap-x-8";
|
|
38
|
+
readonly 10: "gap-x-10";
|
|
39
|
+
readonly 12: "gap-x-12";
|
|
40
|
+
readonly 16: "gap-x-16";
|
|
41
|
+
};
|
|
42
|
+
export declare const gapYClasses: {
|
|
43
|
+
readonly 0: "gap-y-0";
|
|
44
|
+
readonly 0.5: "gap-y-0.5";
|
|
45
|
+
readonly 1: "gap-y-1";
|
|
46
|
+
readonly 1.5: "gap-y-1.5";
|
|
47
|
+
readonly 2: "gap-y-2";
|
|
48
|
+
readonly 2.5: "gap-y-2.5";
|
|
49
|
+
readonly 3: "gap-y-3";
|
|
50
|
+
readonly 3.5: "gap-y-3.5";
|
|
51
|
+
readonly 4: "gap-y-4";
|
|
52
|
+
readonly 5: "gap-y-5";
|
|
53
|
+
readonly 6: "gap-y-6";
|
|
54
|
+
readonly 8: "gap-y-8";
|
|
55
|
+
readonly 10: "gap-y-10";
|
|
56
|
+
readonly 12: "gap-y-12";
|
|
57
|
+
readonly 16: "gap-y-16";
|
|
58
|
+
};
|
|
59
|
+
declare const justifyClasses: {
|
|
60
|
+
readonly around: "justify-around";
|
|
61
|
+
readonly between: "justify-between";
|
|
62
|
+
readonly center: "justify-center";
|
|
63
|
+
readonly end: "justify-end";
|
|
64
|
+
readonly evenly: "justify-evenly";
|
|
65
|
+
readonly start: "justify-start";
|
|
66
|
+
};
|
|
67
|
+
export type LayoutAlign = keyof typeof alignClasses;
|
|
68
|
+
export type LayoutGap = keyof typeof gapClasses;
|
|
69
|
+
export type LayoutJustify = keyof typeof justifyClasses;
|
|
70
|
+
export type LayoutStyleProps = {
|
|
71
|
+
align?: LayoutAlign;
|
|
72
|
+
gap?: LayoutGap;
|
|
73
|
+
gapX?: LayoutGap;
|
|
74
|
+
gapY?: LayoutGap;
|
|
75
|
+
justify?: LayoutJustify;
|
|
76
|
+
};
|
|
77
|
+
export declare function getLayoutClasses({ align, gap, gapX, gapY, justify, }: LayoutStyleProps): string;
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/components/_internal/layout.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,YAAY;;;;;;CAMR,CAAC;AAEX,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;CAgBN,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAC;AAEX,QAAA,MAAM,cAAc;;;;;;;CAOV,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,YAAY,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,UAAU,CAAC;AAChD,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,cAAc,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,OAAO,GACR,EAAE,gBAAgB,UAQlB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { cn } from '../../lib/cn';
|
|
2
|
+
// Same props and spacing scale as the layout helper of @pickle-ui/react. Each
|
|
3
|
+
// class is written out in full so Uniwind finds it in the source.
|
|
4
|
+
const alignClasses = {
|
|
5
|
+
baseline: 'items-baseline',
|
|
6
|
+
center: 'items-center',
|
|
7
|
+
end: 'items-end',
|
|
8
|
+
start: 'items-start',
|
|
9
|
+
stretch: 'items-stretch',
|
|
10
|
+
};
|
|
11
|
+
const gapClasses = {
|
|
12
|
+
0: 'gap-0',
|
|
13
|
+
0.5: 'gap-0.5',
|
|
14
|
+
1: 'gap-1',
|
|
15
|
+
1.5: 'gap-1.5',
|
|
16
|
+
2: 'gap-2',
|
|
17
|
+
2.5: 'gap-2.5',
|
|
18
|
+
3: 'gap-3',
|
|
19
|
+
3.5: 'gap-3.5',
|
|
20
|
+
4: 'gap-4',
|
|
21
|
+
5: 'gap-5',
|
|
22
|
+
6: 'gap-6',
|
|
23
|
+
8: 'gap-8',
|
|
24
|
+
10: 'gap-10',
|
|
25
|
+
12: 'gap-12',
|
|
26
|
+
16: 'gap-16',
|
|
27
|
+
};
|
|
28
|
+
export const gapXClasses = {
|
|
29
|
+
0: 'gap-x-0',
|
|
30
|
+
0.5: 'gap-x-0.5',
|
|
31
|
+
1: 'gap-x-1',
|
|
32
|
+
1.5: 'gap-x-1.5',
|
|
33
|
+
2: 'gap-x-2',
|
|
34
|
+
2.5: 'gap-x-2.5',
|
|
35
|
+
3: 'gap-x-3',
|
|
36
|
+
3.5: 'gap-x-3.5',
|
|
37
|
+
4: 'gap-x-4',
|
|
38
|
+
5: 'gap-x-5',
|
|
39
|
+
6: 'gap-x-6',
|
|
40
|
+
8: 'gap-x-8',
|
|
41
|
+
10: 'gap-x-10',
|
|
42
|
+
12: 'gap-x-12',
|
|
43
|
+
16: 'gap-x-16',
|
|
44
|
+
};
|
|
45
|
+
export const gapYClasses = {
|
|
46
|
+
0: 'gap-y-0',
|
|
47
|
+
0.5: 'gap-y-0.5',
|
|
48
|
+
1: 'gap-y-1',
|
|
49
|
+
1.5: 'gap-y-1.5',
|
|
50
|
+
2: 'gap-y-2',
|
|
51
|
+
2.5: 'gap-y-2.5',
|
|
52
|
+
3: 'gap-y-3',
|
|
53
|
+
3.5: 'gap-y-3.5',
|
|
54
|
+
4: 'gap-y-4',
|
|
55
|
+
5: 'gap-y-5',
|
|
56
|
+
6: 'gap-y-6',
|
|
57
|
+
8: 'gap-y-8',
|
|
58
|
+
10: 'gap-y-10',
|
|
59
|
+
12: 'gap-y-12',
|
|
60
|
+
16: 'gap-y-16',
|
|
61
|
+
};
|
|
62
|
+
const justifyClasses = {
|
|
63
|
+
around: 'justify-around',
|
|
64
|
+
between: 'justify-between',
|
|
65
|
+
center: 'justify-center',
|
|
66
|
+
end: 'justify-end',
|
|
67
|
+
evenly: 'justify-evenly',
|
|
68
|
+
start: 'justify-start',
|
|
69
|
+
};
|
|
70
|
+
export function getLayoutClasses({ align, gap, gapX, gapY, justify, }) {
|
|
71
|
+
return cn(align === undefined ? undefined : alignClasses[align], gap === undefined ? undefined : gapClasses[gap], gapX === undefined ? undefined : gapXClasses[gapX], gapY === undefined ? undefined : gapYClasses[gapY], justify === undefined ? undefined : justifyClasses[justify]);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/components/_internal/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,8EAA8E;AAC9E,kEAAkE;AAElE,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE,gBAAgB;IAC1B,MAAM,EAAE,cAAc;IACtB,GAAG,EAAE,WAAW;IAChB,KAAK,EAAE,aAAa;IACpB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X,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,gBAAgB;IACxB,OAAO,EAAE,iBAAiB;IAC1B,MAAM,EAAE,gBAAgB;IACxB,GAAG,EAAE,aAAa;IAClB,MAAM,EAAE,gBAAgB;IACxB,KAAK,EAAE,eAAe;CACd,CAAC;AAcX,MAAM,UAAU,gBAAgB,CAAC,EAC/B,KAAK,EACL,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,OAAO,GACU;IACjB,OAAO,EAAE,CACP,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,EACrD,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAC/C,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,EAClD,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,EAClD,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State a component owns unless its parent controls it, like Base UI's
|
|
3
|
+
* `checked` / `defaultChecked` / `onCheckedChange` trios: `value` wins when
|
|
4
|
+
* defined, and every change is reported through `onChange`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useControllableState<T>(value: T | undefined, defaultValue: T, onChange?: (value: T) => void): readonly [T, (next: T) => void];
|
|
7
|
+
//# sourceMappingURL=useControllableState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useControllableState.d.ts","sourceRoot":"","sources":["../../../src/components/_internal/useControllableState.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,KAAK,EAAE,CAAC,GAAG,SAAS,EACpB,YAAY,EAAE,CAAC,EACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,uBAMpB,CAAC,WAQX"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* State a component owns unless its parent controls it, like Base UI's
|
|
4
|
+
* `checked` / `defaultChecked` / `onCheckedChange` trios: `value` wins when
|
|
5
|
+
* defined, and every change is reported through `onChange`.
|
|
6
|
+
*/
|
|
7
|
+
export function useControllableState(value, defaultValue, onChange) {
|
|
8
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
9
|
+
const controlled = value !== undefined;
|
|
10
|
+
const setValue = useCallback((next) => {
|
|
11
|
+
if (!controlled)
|
|
12
|
+
setUncontrolled(next);
|
|
13
|
+
onChange?.(next);
|
|
14
|
+
}, [controlled, onChange]);
|
|
15
|
+
return [controlled ? value : uncontrolled, setValue];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=useControllableState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useControllableState.js","sourceRoot":"","sources":["../../../src/components/_internal/useControllableState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAoB,EACpB,YAAe,EACf,QAA6B;IAE7B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,KAAK,KAAK,SAAS,CAAC;IAEvC,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,IAAO,EAAE,EAAE;QACV,IAAI,CAAC,UAAU;YAAE,eAAe,CAAC,IAAI,CAAC,CAAC;QACvC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,EACD,CAAC,UAAU,EAAE,QAAQ,CAAC,CACvB,CAAC;IAEF,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,EAAE,QAAQ,CAAU,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Pressable } from 'react-native';
|
|
2
|
+
export type CheckboxProps = Omit<React.ComponentProps<typeof Pressable>, 'children' | 'disabled'> & {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
/** Class overrides for the row around the box and label, the check and the label. */
|
|
5
|
+
classNames?: {
|
|
6
|
+
field?: string;
|
|
7
|
+
indicator?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
};
|
|
10
|
+
defaultChecked?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Shows a minus instead of the check, for a partly selected group. */
|
|
13
|
+
indeterminate?: boolean;
|
|
14
|
+
/** Marks the value as invalid, like the web's `aria-invalid`. */
|
|
15
|
+
invalid?: boolean;
|
|
16
|
+
/** Text next to the box; pressing it toggles the checkbox and names it. */
|
|
17
|
+
label?: React.ReactNode;
|
|
18
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
19
|
+
size?: 'md' | 'sm';
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A checkbox, like `Checkbox` in @pickle-ui/react. Give it a `label`, or an
|
|
23
|
+
* `accessibilityLabel` when visible text elsewhere names it.
|
|
24
|
+
*/
|
|
25
|
+
export declare function Checkbox({ accessibilityState, checked: checkedProp, className, classNames, defaultChecked, disabled, indeterminate, invalid, label, onCheckedChange, size, ...props }: CheckboxProps): import("react").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/form/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAsBrD,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,EACtC,UAAU,GAAG,UAAU,CACxB,GAAG;IACF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qFAAqF;IACrF,UAAU,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uEAAuE;IACvE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EACvB,kBAAkB,EAClB,OAAO,EAAE,WAAW,EACpB,SAAS,EACT,UAAU,EACV,cAAsB,EACtB,QAAgB,EAChB,aAAqB,EACrB,OAAe,EACf,KAAK,EACL,eAAe,EACf,IAAW,EACX,GAAG,KAAK,EACT,EAAE,aAAa,+BAkDf"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Pressable, Text, View } from 'react-native';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
import { useControllableState } from '../_internal/useControllableState';
|
|
5
|
+
// Same box sizes as `Checkbox` in @pickle-ui/react. `hitSlop` stretches the
|
|
6
|
+
// box to a 44pt touch target, vertically only when a label already widens it.
|
|
7
|
+
const boxClasses = { md: 'size-4.5', sm: 'size-3.5' };
|
|
8
|
+
const boxHitSlop = { md: 13, sm: 15 };
|
|
9
|
+
const fieldHitSlop = {
|
|
10
|
+
md: { bottom: 13, top: 13 },
|
|
11
|
+
sm: { bottom: 15, top: 15 },
|
|
12
|
+
};
|
|
13
|
+
// The web draws Tabler's check and minus icons. Without SVG, the check is the
|
|
14
|
+
// bottom and right borders of a rotated box, and the minus a bar.
|
|
15
|
+
const checkClasses = {
|
|
16
|
+
md: 'h-[9px] w-[5px] border-b-[1.5px] border-r-[1.5px]',
|
|
17
|
+
sm: 'h-[7px] w-[4px] border-b-[1.25px] border-r-[1.25px]',
|
|
18
|
+
};
|
|
19
|
+
const minusClasses = { md: 'h-[1.5px] w-2', sm: 'h-[1.25px] w-1.5' };
|
|
20
|
+
/**
|
|
21
|
+
* A checkbox, like `Checkbox` in @pickle-ui/react. Give it a `label`, or an
|
|
22
|
+
* `accessibilityLabel` when visible text elsewhere names it.
|
|
23
|
+
*/
|
|
24
|
+
export function Checkbox({ accessibilityState, checked: checkedProp, className, classNames, defaultChecked = false, disabled = false, indeterminate = false, invalid = false, label, onCheckedChange, size = 'md', ...props }) {
|
|
25
|
+
const [checked, setChecked] = useControllableState(checkedProp, defaultChecked, onCheckedChange);
|
|
26
|
+
return (_jsxs(Pressable, { accessibilityState: {
|
|
27
|
+
...accessibilityState,
|
|
28
|
+
checked: indeterminate ? 'mixed' : checked,
|
|
29
|
+
disabled,
|
|
30
|
+
}, "aria-checked": indeterminate ? 'mixed' : checked, "aria-disabled": disabled, className: label
|
|
31
|
+
? cn('flex-row items-center gap-2', classNames?.field)
|
|
32
|
+
: 'self-start', disabled: disabled, hitSlop: label ? fieldHitSlop[size] : boxHitSlop[size], onPress: () => setChecked(!checked), role: "checkbox", ...props, children: [_jsx(CheckboxBox, { checked: checked, className: className, disabled: disabled, indeterminate: indeterminate, indicatorClassName: classNames?.indicator, invalid: invalid, size: size }), label ? (_jsx(Text, { className: cn('text-foreground font-sans text-sm leading-none font-medium', disabled && 'opacity-50', classNames?.label), children: label })) : null] }));
|
|
33
|
+
}
|
|
34
|
+
function CheckboxBox({ checked, className, disabled, indeterminate, indicatorClassName, invalid, size, }) {
|
|
35
|
+
const filled = checked && !indeterminate;
|
|
36
|
+
return (_jsx(View, { className: cn('items-center justify-center rounded-[4px] border shadow-xs shadow-black/5', boxClasses[size],
|
|
37
|
+
// A checked box is filled in both themes, so the dark input
|
|
38
|
+
// background must not apply to it.
|
|
39
|
+
filled
|
|
40
|
+
? 'border-primary bg-primary'
|
|
41
|
+
: cn('border-input bg-background dark:bg-input/32', invalid && 'border-destructive/36'), (checked || indeterminate || invalid || disabled) && 'shadow-none', disabled && 'opacity-64', className), children: indeterminate ? (_jsx(View, { className: cn('bg-foreground rounded-full', minusClasses[size], indicatorClassName) })) : checked ? (_jsx(View, { className: cn('border-primary-foreground -mt-px rotate-45', checkClasses[size], indicatorClassName) })) : null }));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/components/form/Checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,4EAA4E;AAC5E,8EAA8E;AAC9E,MAAM,UAAU,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAW,CAAC;AAC/D,MAAM,UAAU,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAW,CAAC;AAC/C,MAAM,YAAY,GAAG;IACnB,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,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kBAAkB,CACnB,GACD,CACH,CAAC,CAAC,CAAC,IAAI,GACH,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type UseFormReturn } from 'react-hook-form';
|
|
3
|
+
export type FormFieldContextValue = {
|
|
4
|
+
/** The field's label, used as its control's accessibility label when it is text. */
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
/** The `nativeID` of the field's label, for `aria-labelledby`. */
|
|
7
|
+
labelId?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
/** Registers the control the label focuses when pressed. */
|
|
10
|
+
setControl: (control: FocusTarget | null) => void;
|
|
11
|
+
};
|
|
12
|
+
type FocusTarget = {
|
|
13
|
+
focus: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const FormFieldContext: import("react").Context<FormFieldContextValue | null>;
|
|
16
|
+
/** True inside `Form.InputGroup`, where `Form.Input` renders `InputGroup.Input`. */
|
|
17
|
+
export declare const FormInputGroupContext: import("react").Context<boolean>;
|
|
18
|
+
/** Submits the form, like pressing a submit button or Enter on the web. */
|
|
19
|
+
export declare const FormSubmitContext: import("react").Context<() => void>;
|
|
20
|
+
export declare function getErrorMessage(error: unknown): ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* React Hook Form tracks field state but has no DOM to label: this maps the
|
|
23
|
+
* current `Form.Field` onto its control, naming it by the field's label and
|
|
24
|
+
* marking it `invalid` while the field has an error.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useFormControlProps(): {
|
|
27
|
+
accessibilityLabel: string | undefined;
|
|
28
|
+
'aria-labelledby': string | undefined;
|
|
29
|
+
invalid: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare function useFormMethods(): UseFormReturn;
|
|
32
|
+
export declare function useRequiredFieldName(name: string | undefined, componentName: string): string;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=Form.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.context.d.ts","sourceRoot":"","sources":["../../../src/components/form/Form.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,SAAS,EAAO,MAAM,OAAO,CAAC;AAC3E,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,qBAAqB,GAAG;IAClC,oFAAoF;IACpF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEzC,eAAO,MAAM,gBAAgB,uDAE5B,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,kCAAuB,CAAC;AAE1D,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,gCAAuB,IAAI,CAAW,CAAC;AAErE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAUzD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB;;;;EAiBlC;AAED,wBAAgB,cAAc,kBAU7B;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,aAAa,EAAE,MAAM,UAWtB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createContext, isValidElement, use } from 'react';
|
|
2
|
+
import { useFormContext, useFormState, } from 'react-hook-form';
|
|
3
|
+
export const FormFieldContext = createContext(null);
|
|
4
|
+
/** True inside `Form.InputGroup`, where `Form.Input` renders `InputGroup.Input`. */
|
|
5
|
+
export const FormInputGroupContext = createContext(false);
|
|
6
|
+
/** Submits the form, like pressing a submit button or Enter on the web. */
|
|
7
|
+
export const FormSubmitContext = createContext(() => { });
|
|
8
|
+
export function getErrorMessage(error) {
|
|
9
|
+
if (!error || typeof error !== 'object')
|
|
10
|
+
return undefined;
|
|
11
|
+
const message = error.message;
|
|
12
|
+
return isValidElement(message) ||
|
|
13
|
+
typeof message === 'string' ||
|
|
14
|
+
typeof message === 'number'
|
|
15
|
+
? message
|
|
16
|
+
: undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* React Hook Form tracks field state but has no DOM to label: this maps the
|
|
20
|
+
* current `Form.Field` onto its control, naming it by the field's label and
|
|
21
|
+
* marking it `invalid` while the field has an error.
|
|
22
|
+
*/
|
|
23
|
+
export function useFormControlProps() {
|
|
24
|
+
const field = use(FormFieldContext);
|
|
25
|
+
const { control, getFieldState } = useFormMethods();
|
|
26
|
+
const name = field?.name;
|
|
27
|
+
const formState = useFormState({
|
|
28
|
+
control,
|
|
29
|
+
disabled: !name,
|
|
30
|
+
exact: true,
|
|
31
|
+
name,
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
accessibilityLabel: typeof field?.label === 'string' ? field.label : undefined,
|
|
35
|
+
'aria-labelledby': field?.labelId,
|
|
36
|
+
invalid: name ? getFieldState(name, formState).invalid : false,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function useFormMethods() {
|
|
40
|
+
const methods = useFormContext();
|
|
41
|
+
if (!methods) {
|
|
42
|
+
throw new Error('Form components must be rendered inside <Form form={form}>.');
|
|
43
|
+
}
|
|
44
|
+
return methods;
|
|
45
|
+
}
|
|
46
|
+
export function useRequiredFieldName(name, componentName) {
|
|
47
|
+
const fieldName = name ?? use(FormFieldContext)?.name;
|
|
48
|
+
if (!fieldName) {
|
|
49
|
+
throw new Error(`${componentName} requires a name prop or a parent <Form.Field name="...">.`);
|
|
50
|
+
}
|
|
51
|
+
return fieldName;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=Form.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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AAK,CAAC,CAAC,CAAC,SAAS;QAC5D,iBAAiB,EAAE,KAAK,EAAE,OAAO;QACjC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;KAC/D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,OAAO,GAAG,cAAc,EAA0B,CAAC;IAEzD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAwB,EACxB,aAAqB;IAErB,MAAM,SAAS,GAAG,IAAI,IAAI,GAAG,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;IAEtD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,GAAG,aAAa,4DAA4D,CAC7E,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ButtonProps } from '../Button';
|
|
2
|
+
import { FormCheckbox, type FormCheckboxProps } from './FormCheckbox';
|
|
3
|
+
import { FormDescription, type FormDescriptionProps } from './FormDescription';
|
|
4
|
+
import { FormError, type FormErrorProps } from './FormError';
|
|
5
|
+
import { FormField, type FormFieldProps } from './FormField';
|
|
6
|
+
import { FormInput, type FormInputProps } from './FormInput';
|
|
7
|
+
import { FormInputGroup, type FormInputGroupProps } from './FormInputGroup';
|
|
8
|
+
import { FormLabel, type FormLabelProps } from './FormLabel';
|
|
9
|
+
import { type FormRadioGroupProps } from './FormRadioGroup';
|
|
10
|
+
import { type FormProps, FormRoot } from './FormRoot';
|
|
11
|
+
import { FormTextarea, type FormTextareaProps } from './FormTextarea';
|
|
12
|
+
/**
|
|
13
|
+
* A `Button` that submits the form when pressed, like the web's submit
|
|
14
|
+
* button. Pass `onPress` to give it another action.
|
|
15
|
+
*/
|
|
16
|
+
declare function FormButton({ onPress, ...props }: ButtonProps): import("react").JSX.Element;
|
|
17
|
+
declare const Form: typeof FormRoot & {
|
|
18
|
+
Button: typeof FormButton;
|
|
19
|
+
Checkbox: typeof FormCheckbox;
|
|
20
|
+
Description: typeof FormDescription;
|
|
21
|
+
Error: typeof FormError;
|
|
22
|
+
Field: typeof FormField;
|
|
23
|
+
Input: typeof FormInput;
|
|
24
|
+
InputGroup: typeof FormInputGroup;
|
|
25
|
+
Label: typeof FormLabel;
|
|
26
|
+
RadioGroup: (({ name: nameProp, onValueChange, ...props }: FormRadioGroupProps) => import("react").JSX.Element) & {
|
|
27
|
+
Item: typeof import("./RadioGroup").RadioGroupItem;
|
|
28
|
+
};
|
|
29
|
+
Textarea: typeof FormTextarea;
|
|
30
|
+
};
|
|
31
|
+
export { Form };
|
|
32
|
+
export type { FormCheckboxProps, FormDescriptionProps, FormErrorProps, FormFieldProps, FormInputGroupProps, FormInputProps, FormLabelProps, FormProps, FormRadioGroupProps, FormTextareaProps, };
|
|
33
|
+
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/form/Form.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,KAAK,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEtE;;;GAGG;AACH,iBAAS,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,+BAIrD;AAED,QAAA,MAAM,IAAI;;;;;;;;;;;;;CAWR,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,SAAS,EACT,mBAAmB,EACnB,iBAAiB,GAClB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { use } from 'react';
|
|
3
|
+
import { Button } from '../Button';
|
|
4
|
+
import { FormSubmitContext } from './Form.context';
|
|
5
|
+
import { FormCheckbox } from './FormCheckbox';
|
|
6
|
+
import { FormDescription } from './FormDescription';
|
|
7
|
+
import { FormError } from './FormError';
|
|
8
|
+
import { FormField } from './FormField';
|
|
9
|
+
import { FormInput } from './FormInput';
|
|
10
|
+
import { FormInputGroup } from './FormInputGroup';
|
|
11
|
+
import { FormLabel } from './FormLabel';
|
|
12
|
+
import { FormRadioGroup } from './FormRadioGroup';
|
|
13
|
+
import { FormRoot } from './FormRoot';
|
|
14
|
+
import { FormTextarea } from './FormTextarea';
|
|
15
|
+
/**
|
|
16
|
+
* A `Button` that submits the form when pressed, like the web's submit
|
|
17
|
+
* button. Pass `onPress` to give it another action.
|
|
18
|
+
*/
|
|
19
|
+
function FormButton({ onPress, ...props }) {
|
|
20
|
+
const submit = use(FormSubmitContext);
|
|
21
|
+
return _jsx(Button, { onPress: onPress ?? submit, ...props });
|
|
22
|
+
}
|
|
23
|
+
const Form = Object.assign(FormRoot, {
|
|
24
|
+
Button: FormButton,
|
|
25
|
+
Checkbox: FormCheckbox,
|
|
26
|
+
Description: FormDescription,
|
|
27
|
+
Error: FormError,
|
|
28
|
+
Field: FormField,
|
|
29
|
+
Input: FormInput,
|
|
30
|
+
InputGroup: FormInputGroup,
|
|
31
|
+
Label: FormLabel,
|
|
32
|
+
RadioGroup: FormRadioGroup,
|
|
33
|
+
Textarea: FormTextarea,
|
|
34
|
+
});
|
|
35
|
+
export { Form };
|
|
36
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/components/form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAoB,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,YAAY,EAA0B,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,eAAe,EAA6B,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,cAAc,EAA4B,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,cAAc,EAA4B,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAkB,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,YAAY,EAA0B,MAAM,gBAAgB,CAAC;AAEtE;;;GAGG;AACH,SAAS,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAe;IACpD,MAAM,MAAM,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAEtC,OAAO,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,IAAI,MAAM,KAAM,KAAK,GAAI,CAAC;AAC3D,CAAC;AAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;IACnC,MAAM,EAAE,UAAU;IAClB,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,eAAe;IAC5B,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,cAAc;IAC1B,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,cAAc;IAC1B,QAAQ,EAAE,YAAY;CACvB,CAAC,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CheckboxProps } from './Checkbox';
|
|
2
|
+
export type FormCheckboxProps = Omit<CheckboxProps, 'checked' | 'invalid'> & {
|
|
3
|
+
name?: string;
|
|
4
|
+
};
|
|
5
|
+
/** A `Checkbox` bound to the field's boolean value. */
|
|
6
|
+
export declare function FormCheckbox({ name: nameProp, onCheckedChange, ...props }: FormCheckboxProps): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=FormCheckbox.d.ts.map
|