@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormCheckbox.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormCheckbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAO1D,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,SAAS,CAAC,GAAG;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EAAE,QAAQ,EACd,eAAe,EACf,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAuBnB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useController } from 'react-hook-form';
|
|
3
|
+
import { Checkbox } from './Checkbox';
|
|
4
|
+
import { useFormControlProps, useFormMethods, useRequiredFieldName, } from './Form.context';
|
|
5
|
+
/** A `Checkbox` bound to the field's boolean value. */
|
|
6
|
+
export function FormCheckbox({ name: nameProp, onCheckedChange, ...props }) {
|
|
7
|
+
const name = useRequiredFieldName(nameProp, 'Form.Checkbox');
|
|
8
|
+
const { control } = useFormMethods();
|
|
9
|
+
const { field } = useController({
|
|
10
|
+
control,
|
|
11
|
+
defaultValue: props.defaultChecked ?? false,
|
|
12
|
+
name,
|
|
13
|
+
});
|
|
14
|
+
const { accessibilityLabel, invalid } = useFormControlProps();
|
|
15
|
+
return (_jsx(Checkbox
|
|
16
|
+
// A `label` already names the checkbox.
|
|
17
|
+
, {
|
|
18
|
+
// A `label` already names the checkbox.
|
|
19
|
+
accessibilityLabel: props.label ? undefined : accessibilityLabel, ...props, checked: Boolean(field.value), invalid: invalid, onCheckedChange: (checked) => {
|
|
20
|
+
field.onChange(checked);
|
|
21
|
+
onCheckedChange?.(checked);
|
|
22
|
+
} }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=FormCheckbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormCheckbox.js","sourceRoot":"","sources":["../../../src/components/form/FormCheckbox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC;AAC1D,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAMxB,uDAAuD;AACvD,MAAM,UAAU,YAAY,CAAC,EAC3B,IAAI,EAAE,QAAQ,EACd,eAAe,EACf,GAAG,KAAK,EACU;IAClB,MAAM,IAAI,GAAG,oBAAoB,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC7D,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC;QAC9B,OAAO;QACP,YAAY,EAAE,KAAK,CAAC,cAAc,IAAI,KAAK;QAC3C,IAAI;KACL,CAAC,CAAC;IACH,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAE9D,OAAO,CACL,KAAC,QAAQ;IACP,wCAAwC;;QAAxC,wCAAwC;QACxC,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,KAC5D,KAAK,EACT,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAC7B,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE;YAC3B,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACxB,eAAe,EAAE,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC,GACD,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Text } from 'react-native';
|
|
2
|
+
export type FormDescriptionProps = React.ComponentProps<typeof Text>;
|
|
3
|
+
export declare function FormDescription({ className, ...props }: FormDescriptionProps): import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=FormDescription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDescription.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormDescription.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIpC,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAErE,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,+BAO5E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
export function FormDescription({ className, ...props }) {
|
|
5
|
+
return (_jsx(Text, { className: cn('text-muted-foreground font-sans text-sm', className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=FormDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDescription.js","sourceRoot":"","sources":["../../../src/components/form/FormDescription.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAIlC,MAAM,UAAU,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAwB;IAC3E,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CAAC,yCAAyC,EAAE,SAAS,CAAC,KAC/D,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Text } from 'react-native';
|
|
2
|
+
export type FormErrorProps = React.ComponentProps<typeof Text>;
|
|
3
|
+
/** Announced by screen readers when it appears, like the web's live error. */
|
|
4
|
+
export declare function FormError({ className, ...props }: FormErrorProps): import("react").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=FormError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormError.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormError.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIpC,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAE/D,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,+BAYhE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
/** Announced by screen readers when it appears, like the web's live error. */
|
|
5
|
+
export function FormError({ className, ...props }) {
|
|
6
|
+
return (_jsx(Text, { accessibilityLiveRegion: "polite", className: cn('text-destructive font-sans text-sm font-medium', className), role: "alert", ...props }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=FormError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormError.js","sourceRoot":"","sources":["../../../src/components/form/FormError.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAIlC,8EAA8E;AAC9E,MAAM,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAkB;IAC/D,OAAO,CACL,KAAC,IAAI,IACH,uBAAuB,EAAC,QAAQ,EAChC,SAAS,EAAE,EAAE,CACX,gDAAgD,EAChD,SAAS,CACV,EACD,IAAI,EAAC,OAAO,KACR,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
export type FormFieldProps = Omit<React.ComponentProps<typeof View>, 'children'> & {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
/** Replaces the error message React Hook Form holds for the field. */
|
|
7
|
+
error?: ReactNode;
|
|
8
|
+
/** Names the control and focuses it when pressed, like the web's `<label>`. */
|
|
9
|
+
label?: ReactNode;
|
|
10
|
+
name?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A labelled field bound to `name`, like `Form.Field` in @pickle-ui/react:
|
|
14
|
+
* the label, the control, then the field's error or its description.
|
|
15
|
+
*/
|
|
16
|
+
export declare function FormField({ children, className, description, error, label, name, ...props }: FormFieldProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=FormField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA0B,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAYpC,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,EACjC,UAAU,CACX,GAAG;IACF,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,sEAAsE;IACtE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,KAAK,EACL,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,+BA0ChB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useMemo, useRef } from 'react';
|
|
3
|
+
import { useFormState } from 'react-hook-form';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { cn } from '../../lib/cn';
|
|
6
|
+
import { FormFieldContext, getErrorMessage, useFormMethods, } from './Form.context';
|
|
7
|
+
import { FormDescription } from './FormDescription';
|
|
8
|
+
import { FormError } from './FormError';
|
|
9
|
+
import { FormLabel } from './FormLabel';
|
|
10
|
+
/**
|
|
11
|
+
* A labelled field bound to `name`, like `Form.Field` in @pickle-ui/react:
|
|
12
|
+
* the label, the control, then the field's error or its description.
|
|
13
|
+
*/
|
|
14
|
+
export function FormField({ children, className, description, error, label, name, ...props }) {
|
|
15
|
+
const { control, getFieldState } = useFormMethods();
|
|
16
|
+
const formState = useFormState({
|
|
17
|
+
control,
|
|
18
|
+
disabled: !name,
|
|
19
|
+
exact: true,
|
|
20
|
+
name,
|
|
21
|
+
});
|
|
22
|
+
const fieldError = name ? getFieldState(name, formState).error : undefined;
|
|
23
|
+
const errorMessage = error ?? getErrorMessage(fieldError);
|
|
24
|
+
const labelId = useId();
|
|
25
|
+
const controlRef = useRef(null);
|
|
26
|
+
const context = useMemo(() => ({
|
|
27
|
+
label,
|
|
28
|
+
labelId: label ? labelId : undefined,
|
|
29
|
+
name,
|
|
30
|
+
setControl: (target) => {
|
|
31
|
+
controlRef.current = target;
|
|
32
|
+
},
|
|
33
|
+
}), [label, labelId, name]);
|
|
34
|
+
return (_jsxs(View, { className: cn('gap-2.5', className), ...props, children: [label ? (_jsx(FormLabel, { nativeID: labelId, onPress: () => controlRef.current?.focus(), children: label })) : null, _jsx(FormFieldContext, { value: context, children: children }), errorMessage ? (_jsx(FormError, { children: errorMessage })) : description ? (_jsx(FormDescription, { children: description })) : null] }));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=FormField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form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OAAO,CAAC,CAAC,CAAC,SAAS;QACpC,IAAI;QACJ,UAAU,EAAE,CAAC,MAAoC,EAAE,EAAE;YACnD,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC;QAC9B,CAAC;KACF,CAAC,EACF,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CACvB,CAAC;IAEF,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,KAAM,KAAK,aACjD,KAAK,CAAC,CAAC,CAAC,CACP,KAAC,SAAS,IACR,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,YAEzC,KAAK,GACI,CACb,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,gBAAgB,IAAC,KAAK,EAAE,OAAO,YAAG,QAAQ,GAAoB,EAC9D,YAAY,CAAC,CAAC,CAAC,CACd,KAAC,SAAS,cAAE,YAAY,GAAa,CACtC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAChB,KAAC,eAAe,cAAE,WAAW,GAAmB,CACjD,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type InputProps } from './Input';
|
|
2
|
+
export type FormInputProps = Omit<InputProps, 'defaultValue' | 'invalid' | 'value'> & {
|
|
3
|
+
name?: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* An `Input` bound to the field's value. The return key submits the form,
|
|
7
|
+
* like Enter on the web, unless `onSubmitEditing` is set.
|
|
8
|
+
*/
|
|
9
|
+
export declare function FormInput({ name: nameProp, onBlur, onChangeText, onSubmitEditing, ref, ...props }: FormInputProps): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=FormInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormInput.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormInput.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAGjD,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,UAAU,EACV,cAAc,GAAG,SAAS,GAAG,OAAO,CACrC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAItB;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,YAAY,EACZ,eAAe,EACf,GAAG,EACH,GAAG,KAAK,EACT,EAAE,cAAc,+BAoChB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { use, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
import { useController } from 'react-hook-form';
|
|
4
|
+
import { FormFieldContext, FormInputGroupContext, FormSubmitContext, useFormControlProps, useFormMethods, useRequiredFieldName, } from './Form.context';
|
|
5
|
+
import { Input } from './Input';
|
|
6
|
+
import { InputGroup } from './InputGroup';
|
|
7
|
+
/**
|
|
8
|
+
* An `Input` bound to the field's value. The return key submits the form,
|
|
9
|
+
* like Enter on the web, unless `onSubmitEditing` is set.
|
|
10
|
+
*/
|
|
11
|
+
export function FormInput({ name: nameProp, onBlur, onChangeText, onSubmitEditing, ref, ...props }) {
|
|
12
|
+
const name = useRequiredFieldName(nameProp, 'Form.Input');
|
|
13
|
+
const { control } = useFormMethods();
|
|
14
|
+
const { field } = useController({ control, name });
|
|
15
|
+
const controlProps = useFormControlProps();
|
|
16
|
+
const fieldContext = use(FormFieldContext);
|
|
17
|
+
const isInsideInputGroup = use(FormInputGroupContext);
|
|
18
|
+
const submit = use(FormSubmitContext);
|
|
19
|
+
const inputRef = useRef(null);
|
|
20
|
+
useImperativeHandle(ref, () => inputRef.current);
|
|
21
|
+
const InputComponent = isInsideInputGroup ? InputGroup.Input : Input;
|
|
22
|
+
return (_jsx(InputComponent, { ...controlProps, ...props, onBlur: (event) => {
|
|
23
|
+
field.onBlur();
|
|
24
|
+
onBlur?.(event);
|
|
25
|
+
}, onChangeText: (text) => {
|
|
26
|
+
field.onChange(text);
|
|
27
|
+
onChangeText?.(text);
|
|
28
|
+
}, onSubmitEditing: onSubmitEditing ?? submit, ref: (node) => {
|
|
29
|
+
inputRef.current = node;
|
|
30
|
+
// React Hook Form focuses the first invalid field after a submit,
|
|
31
|
+
// and the field's label focuses its input when pressed.
|
|
32
|
+
field.ref(node);
|
|
33
|
+
fieldContext?.setControl(node);
|
|
34
|
+
}, value: field.value ?? '' }));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=FormInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormInput.js","sourceRoot":"","sources":["../../../src/components/form/FormInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAmB,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,YAAY,EACZ,eAAe,EACf,GAAG,EACH,GAAG,KAAK,EACO;IACf,MAAM,IAAI,GAAG,oBAAoB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC1D,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CA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InputGroup>;
|
|
3
|
+
/**
|
|
4
|
+
* An `InputGroup` whose `Form.Input` renders `InputGroup.Input`, framed as
|
|
5
|
+
* invalid while the field has an error.
|
|
6
|
+
*/
|
|
7
|
+
export declare function FormInputGroup({ children, ...props }: FormInputGroupProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=FormInputGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormInputGroup.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormInputGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAE1E;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,+BAgBzE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children, isValidElement } from 'react';
|
|
3
|
+
import { FormInputGroupContext, useFormControlProps } from './Form.context';
|
|
4
|
+
import { FormInput } from './FormInput';
|
|
5
|
+
import { InputGroup } from './InputGroup';
|
|
6
|
+
import { InputGroupStateContext } from './InputGroup.context';
|
|
7
|
+
/**
|
|
8
|
+
* An `InputGroup` whose `Form.Input` renders `InputGroup.Input`, framed as
|
|
9
|
+
* invalid while the field has an error.
|
|
10
|
+
*/
|
|
11
|
+
export function FormInputGroup({ children, ...props }) {
|
|
12
|
+
const { invalid } = useFormControlProps();
|
|
13
|
+
const disabled = Children.toArray(children).some((child) => isValidElement(child) &&
|
|
14
|
+
child.type === FormInput &&
|
|
15
|
+
Boolean(child.props.disabled));
|
|
16
|
+
return (_jsx(FormInputGroupContext, { value: true, children: _jsx(InputGroupStateContext, { value: { disabled, invalid }, children: _jsx(InputGroup, { ...props, children: children }) }) }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=FormInputGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormInputGroup.js","sourceRoot":"","sources":["../../../src/components/form/FormInputGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAI9D;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAuB;IACxE,MAAM,EAAE,OAAO,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAC1C,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAC9C,CAAC,KAAK,EAAE,EAAE,CACR,cAAc,CAAiB,KAAK,CAAC;QACrC,KAAK,CAAC,IAAI,KAAK,SAAS;QACxB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAChC,CAAC;IAEF,OAAO,CACL,KAAC,qBAAqB,IAAC,KAAK,kBAC1B,KAAC,sBAAsB,IAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,YAClD,KAAC,UAAU,OAAK,KAAK,YAAG,QAAQ,GAAc,GACvB,GACH,CACzB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormLabel.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIpC,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAE/D,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,+BAUhE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
export function FormLabel({ className, ...props }) {
|
|
5
|
+
return (_jsx(Text, { className: cn('text-foreground font-sans text-sm leading-none font-medium', className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=FormLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormLabel.js","sourceRoot":"","sources":["../../../src/components/form/FormLabel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAIlC,MAAM,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAkB;IAC/D,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,4DAA4D,EAC5D,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type RadioGroupProps } from './RadioGroup';
|
|
2
|
+
export type FormRadioGroupProps = Omit<RadioGroupProps, 'value'> & {
|
|
3
|
+
name?: string;
|
|
4
|
+
};
|
|
5
|
+
/** A `RadioGroup` bound to the field's value. */
|
|
6
|
+
declare function FormRadioGroupRoot({ name: nameProp, onValueChange, ...props }: FormRadioGroupProps): import("react").JSX.Element;
|
|
7
|
+
declare const FormRadioGroup: typeof FormRadioGroupRoot & {
|
|
8
|
+
Item: typeof import("./RadioGroup").RadioGroupItem;
|
|
9
|
+
};
|
|
10
|
+
export { FormRadioGroup };
|
|
11
|
+
//# sourceMappingURL=FormRadioGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRadioGroup.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormRadioGroup.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAEhE,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,GAAG;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,iDAAiD;AACjD,iBAAS,kBAAkB,CAAC,EAC1B,IAAI,EAAE,QAAQ,EACd,aAAa,EACb,GAAG,KAAK,EACT,EAAE,mBAAmB,+BAuBrB;AAED,QAAA,MAAM,cAAc;;CAElB,CAAC;AAEH,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useController } from 'react-hook-form';
|
|
3
|
+
import { useFormControlProps, useFormMethods, useRequiredFieldName, } from './Form.context';
|
|
4
|
+
import { RadioGroup } from './RadioGroup';
|
|
5
|
+
/** A `RadioGroup` bound to the field's value. */
|
|
6
|
+
function FormRadioGroupRoot({ name: nameProp, onValueChange, ...props }) {
|
|
7
|
+
const name = useRequiredFieldName(nameProp, 'Form.RadioGroup');
|
|
8
|
+
const { control } = useFormMethods();
|
|
9
|
+
const { field } = useController({
|
|
10
|
+
control,
|
|
11
|
+
defaultValue: props.defaultValue,
|
|
12
|
+
name,
|
|
13
|
+
});
|
|
14
|
+
const { accessibilityLabel, 'aria-labelledby': labelledBy } = useFormControlProps();
|
|
15
|
+
return (_jsx(RadioGroup, { accessibilityLabel: accessibilityLabel, "aria-labelledby": labelledBy, ...props, onValueChange: (value) => {
|
|
16
|
+
field.onChange(value);
|
|
17
|
+
onValueChange?.(value);
|
|
18
|
+
}, value: field.value }));
|
|
19
|
+
}
|
|
20
|
+
const FormRadioGroup = Object.assign(FormRadioGroupRoot, {
|
|
21
|
+
Item: RadioGroup.Item,
|
|
22
|
+
});
|
|
23
|
+
export { FormRadioGroup };
|
|
24
|
+
//# sourceMappingURL=FormRadioGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRadioGroup.js","sourceRoot":"","sources":["../../../src/components/form/FormRadioGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAC;AAMhE,iDAAiD;AACjD,SAAS,kBAAkB,CAAC,EAC1B,IAAI,EAAE,QAAQ,EACd,aAAa,EACb,GAAG,KAAK,EACY;IACpB,MAAM,IAAI,GAAG,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC;QAC9B,OAAO;QACP,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,IAAI;KACL,CAAC,CAAC;IACH,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,GACzD,mBAAmB,EAAE,CAAC;IAExB,OAAO,CACL,KAAC,UAAU,IACT,kBAAkB,EAAE,kBAAkB,qBACrB,UAAU,KACvB,KAAK,EACT,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;YACvB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACtB,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,GAClB,CACH,CAAC;AACJ,CAAC;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;IACvD,IAAI,EAAE,UAAU,CAAC,IAAI;CACtB,CAAC,CAAC;AAEH,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type FieldValues, type SubmitHandler, type UseFormReturn } from 'react-hook-form';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
export type FormProps<FormValues extends FieldValues = FieldValues> = React.ComponentProps<typeof View> & {
|
|
4
|
+
form: UseFormReturn<FormValues>;
|
|
5
|
+
onSubmit?: SubmitHandler<FormValues>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* React Native has no `<form>`, so the root shares a submit action:
|
|
9
|
+
* `Form.Button` and the return key in `Form.Input` call it, like a submit
|
|
10
|
+
* button and Enter on the web.
|
|
11
|
+
*/
|
|
12
|
+
export declare function FormRoot<FormValues extends FieldValues = FieldValues>({ className, form, onSubmit, ...props }: FormProps<FormValues>): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=FormRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRoot.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormRoot.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAKpC,MAAM,MAAM,SAAS,CAAC,UAAU,SAAS,WAAW,GAAG,WAAW,IAChE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,GAAG;IAClC,IAAI,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CACtC,CAAC;AAEJ;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,UAAU,SAAS,WAAW,GAAG,WAAW,EAAE,EACrE,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,CAAC,UAAU,CAAC,+BAYvB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { FormProvider, } from 'react-hook-form';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { cn } from '../../lib/cn';
|
|
6
|
+
import { FormSubmitContext } from './Form.context';
|
|
7
|
+
/**
|
|
8
|
+
* React Native has no `<form>`, so the root shares a submit action:
|
|
9
|
+
* `Form.Button` and the return key in `Form.Input` call it, like a submit
|
|
10
|
+
* button and Enter on the web.
|
|
11
|
+
*/
|
|
12
|
+
export function FormRoot({ className, form, onSubmit, ...props }) {
|
|
13
|
+
const submit = useCallback(() => {
|
|
14
|
+
if (onSubmit)
|
|
15
|
+
void form.handleSubmit(onSubmit)();
|
|
16
|
+
}, [form, onSubmit]);
|
|
17
|
+
return (_jsx(FormProvider, { ...form, children: _jsx(FormSubmitContext, { value: submit, children: _jsx(View, { className: cn('gap-6', className), ...props }) }) }));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=FormRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRoot.js","sourceRoot":"","sources":["../../../src/components/form/FormRoot.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAEL,YAAY,GAGb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAQnD;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAA+C,EACrE,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACc;IACtB,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,IAAI,QAAQ;YAAE,KAAK,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnD,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,KAAC,YAAY,OAAK,IAAI,YACpB,KAAC,iBAAiB,IAAC,KAAK,EAAE,MAAM,YAC9B,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,GACpC,GACP,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TextareaProps } from './Textarea';
|
|
2
|
+
export type FormTextareaProps = Omit<TextareaProps, 'defaultValue' | 'invalid' | 'value'> & {
|
|
3
|
+
name?: string;
|
|
4
|
+
};
|
|
5
|
+
/** A `Textarea` bound to the field's value. */
|
|
6
|
+
export declare function FormTextarea({ name: nameProp, onBlur, onChangeText, ref, ...props }: FormTextareaProps): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=FormTextarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTextarea.d.ts","sourceRoot":"","sources":["../../../src/components/form/FormTextarea.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,aAAa,EACb,cAAc,GAAG,SAAS,GAAG,OAAO,CACrC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAItB,+CAA+C;AAC/C,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,YAAY,EACZ,GAAG,EACH,GAAG,KAAK,EACT,EAAE,iBAAiB,+BA6BnB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { use, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
import { useController } from 'react-hook-form';
|
|
4
|
+
import { FormFieldContext, useFormControlProps, useFormMethods, useRequiredFieldName, } from './Form.context';
|
|
5
|
+
import { Textarea } from './Textarea';
|
|
6
|
+
/** A `Textarea` bound to the field's value. */
|
|
7
|
+
export function FormTextarea({ name: nameProp, onBlur, onChangeText, ref, ...props }) {
|
|
8
|
+
const name = useRequiredFieldName(nameProp, 'Form.Textarea');
|
|
9
|
+
const { control } = useFormMethods();
|
|
10
|
+
const { field } = useController({ control, name });
|
|
11
|
+
const controlProps = useFormControlProps();
|
|
12
|
+
const fieldContext = use(FormFieldContext);
|
|
13
|
+
const inputRef = useRef(null);
|
|
14
|
+
useImperativeHandle(ref, () => inputRef.current);
|
|
15
|
+
return (_jsx(Textarea, { ...controlProps, ...props, onBlur: (event) => {
|
|
16
|
+
field.onBlur();
|
|
17
|
+
onBlur?.(event);
|
|
18
|
+
}, onChangeText: (text) => {
|
|
19
|
+
field.onChange(text);
|
|
20
|
+
onChangeText?.(text);
|
|
21
|
+
}, ref: (node) => {
|
|
22
|
+
inputRef.current = node;
|
|
23
|
+
field.ref(node);
|
|
24
|
+
fieldContext?.setControl(node);
|
|
25
|
+
}, value: field.value ?? '' }));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=FormTextarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTextarea.js","sourceRoot":"","sources":["../../../src/components/form/FormTextarea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC;AAS1D,+CAA+C;AAC/C,M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export type InputProps = React.ComponentProps<typeof TextInput> & {
|
|
3
|
+
/** Class overrides for the inner `TextInput`; `className` styles the control around it. */
|
|
4
|
+
classNames?: {
|
|
5
|
+
input?: string;
|
|
6
|
+
};
|
|
7
|
+
/** Dims the field and stops editing, like the web's `disabled`. */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** Marks the value as invalid, like the web's `aria-invalid`. */
|
|
10
|
+
invalid?: boolean;
|
|
11
|
+
size?: 'lg' | 'md' | 'sm';
|
|
12
|
+
/** Renders the bare `TextInput`, without the border and background. */
|
|
13
|
+
unstyled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** A single-line text field, like `Input` in @pickle-ui/react. */
|
|
16
|
+
export declare function Input({ className, classNames, disabled, editable, invalid, onBlur, onFocus, size, unstyled, ...props }: InputProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/form/Input.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAczC,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IAChE,2FAA2F;IAC3F,UAAU,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,kEAAkE;AAClE,wBAAgB,KAAK,CAAC,EACpB,SAAS,EACT,UAAU,EACV,QAAgB,EAChB,QAAe,EACf,OAAe,EACf,MAAM,EACN,OAAO,EACP,IAAW,EACX,QAAgB,EAChB,GAAG,KAAK,EACT,EAAE,UAAU,+BAyCZ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { TextInput } from 'react-native';
|
|
4
|
+
import { cn } from '../../lib/cn';
|
|
5
|
+
import { InputFrame } from '../_internal/InputFrame';
|
|
6
|
+
// Same heights as `Button` for the same size, so they line up side by side,
|
|
7
|
+
// and the web's paddings minus the 1pt border.
|
|
8
|
+
const heightClasses = { lg: 'h-9', md: 'h-8', sm: 'h-7' };
|
|
9
|
+
const paddingClasses = {
|
|
10
|
+
lg: 'px-[13px]',
|
|
11
|
+
md: 'px-[11px]',
|
|
12
|
+
sm: 'px-[9px]',
|
|
13
|
+
};
|
|
14
|
+
/** A single-line text field, like `Input` in @pickle-ui/react. */
|
|
15
|
+
export function Input({ className, classNames, disabled = false, editable = true, invalid = false, onBlur, onFocus, size = 'md', unstyled = false, ...props }) {
|
|
16
|
+
const [focused, setFocused] = useState(false);
|
|
17
|
+
// The web's 14px from `sm` up: the 16px it uses on phones only stops iOS
|
|
18
|
+
// Safari zooming into a focused field, which native apps don't do.
|
|
19
|
+
// `text-[14px]` sets the size without `text-sm`'s line height, which
|
|
20
|
+
// pushes a single-line field's text off center on iOS.
|
|
21
|
+
const input = (_jsx(TextInput, { accessibilityState: { disabled }, className: cn('text-foreground flex-1 font-sans text-[14px] outline-none', paddingClasses[size], unstyled ? cn(heightClasses[size], disabled && 'opacity-64') : 'h-full', unstyled ? className : classNames?.input), editable: editable && !disabled, onBlur: (event) => {
|
|
22
|
+
setFocused(false);
|
|
23
|
+
onBlur?.(event);
|
|
24
|
+
}, onFocus: (event) => {
|
|
25
|
+
setFocused(true);
|
|
26
|
+
onFocus?.(event);
|
|
27
|
+
}, placeholderTextColorClassName: "accent-muted-foreground/72", ...props }));
|
|
28
|
+
if (unstyled)
|
|
29
|
+
return input;
|
|
30
|
+
return (_jsx(InputFrame, { className: cn(heightClasses[size], className), disabled: disabled, focused: focused, invalid: invalid, children: input }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../src/components/form/Input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,4EAA4E;AAC5E,+CAA+C;AAC/C,MAAM,aAAa,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAW,CAAC;AACnE,MAAM,cAAc,GAAG;IACrB,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,UAAU;CACN,CAAC;AAcX,kEAAkE;AAClE,MAAM,UAAU,KAAK,CAAC,EACpB,SAAS,EACT,UAAU,EACV,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,IAAI,EACf,OAAO,GAAG,KAAK,EACf,MAAM,EACN,OAAO,EACP,IAAI,GAAG,IAAI,EACX,QAAQ,GAAG,KAAK,EAChB,GAAG,KAAK,EACG;IACX,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,yEAAyE;IACzE,mEAAmE;IACnE,qEAAqE;IACrE,uDAAuD;IACvD,MAAM,KAAK,GAAG,CACZ,KAAC,SAAS,IACR,kBAAkB,EAAE,EAAE,QAAQ,EAAE,EAChC,SAAS,EAAE,EAAE,CACX,2DAA2D,EAC3D,cAAc,CAAC,IAAI,CAAC,EACpB,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,QAAQ,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,EACvE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CACzC,EACD,QAAQ,EAAE,QAAQ,IAAI,CAAC,QAAQ,EAC/B,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,UAAU,CAAC,KAAK,CAAC,CAAC;YAClB,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,EACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjB,UAAU,CAAC,IAAI,CAAC,CAAC;YACjB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC,EACD,6BAA6B,EAAC,4BAA4B,KACtD,KAAK,GACT,CACH,CAAC;IAEF,IAAI,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE3B,OAAO,CACL,KAAC,UAAU,IACT,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,EAC7C,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,YAEf,KAAK,GACK,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lets a wrapper mark the frame `disabled` or `invalid` when its input isn't
|
|
3
|
+
* a direct `InputGroup.Input` child, like `Form.InputGroup` does with
|
|
4
|
+
* `Form.Input`, whose invalid state comes from the form.
|
|
5
|
+
*/
|
|
6
|
+
export declare const InputGroupStateContext: import("react").Context<{
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
} | null>;
|
|
10
|
+
//# sourceMappingURL=InputGroup.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputGroup.context.d.ts","sourceRoot":"","sources":["../../../src/components/form/InputGroup.context.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;eACtB,OAAO;cACR,OAAO;SACX,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Lets a wrapper mark the frame `disabled` or `invalid` when its input isn't
|
|
4
|
+
* a direct `InputGroup.Input` child, like `Form.InputGroup` does with
|
|
5
|
+
* `Form.Input`, whose invalid state comes from the form.
|
|
6
|
+
*/
|
|
7
|
+
export const InputGroupStateContext = createContext(null);
|
|
8
|
+
//# sourceMappingURL=InputGroup.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputGroup.context.js","sourceRoot":"","sources":["../../../src/components/form/InputGroup.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAGhD,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Pressable, Text, View } from 'react-native';
|
|
3
|
+
import { type ButtonProps } from '../Button';
|
|
4
|
+
import { type InputProps } from './Input';
|
|
5
|
+
type InputGroupAlign = 'block-end' | 'block-start' | 'inline-end' | 'inline-start';
|
|
6
|
+
export type InputGroupAddonProps = React.ComponentProps<typeof Pressable> & {
|
|
7
|
+
align?: InputGroupAlign;
|
|
8
|
+
/** Text is wrapped in a label; other children, such as icons, render as they are. */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export type InputGroupButtonProps = ButtonProps & {
|
|
12
|
+
align?: InputGroupAlign;
|
|
13
|
+
};
|
|
14
|
+
export type InputGroupInputProps = Omit<InputProps, 'unstyled'>;
|
|
15
|
+
export type InputGroupProps = React.ComponentProps<typeof View>;
|
|
16
|
+
export type InputGroupTextProps = React.ComponentProps<typeof Text>;
|
|
17
|
+
/** Pressing an addon focuses the field, like clicking it on the web. */
|
|
18
|
+
declare function InputGroupAddon({ align, children, className, ...props }: InputGroupAddonProps): import("react").JSX.Element;
|
|
19
|
+
declare function InputGroupButton({ align, className, size, variant, ...props }: InputGroupButtonProps): import("react").JSX.Element;
|
|
20
|
+
declare function InputGroupInput({ className, onBlur, onFocus, ref, ...props }: InputGroupInputProps): import("react").JSX.Element;
|
|
21
|
+
/** Places addons around the input and frames the group like an `Input`. */
|
|
22
|
+
declare function InputGroupRoot({ children, className, ...props }: InputGroupProps): import("react").JSX.Element;
|
|
23
|
+
declare function InputGroupText({ className, ...props }: InputGroupTextProps): import("react").JSX.Element;
|
|
24
|
+
declare const InputGroup: typeof InputGroupRoot & {
|
|
25
|
+
Addon: typeof InputGroupAddon;
|
|
26
|
+
Button: typeof InputGroupButton;
|
|
27
|
+
Input: typeof InputGroupInput;
|
|
28
|
+
Text: typeof InputGroupText;
|
|
29
|
+
};
|
|
30
|
+
export { InputGroup };
|
|
31
|
+
//# sourceMappingURL=InputGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputGroup.d.ts","sourceRoot":"","sources":["../../../src/components/form/InputGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,IAAI,EAAkB,IAAI,EAAE,MAAM,cAAc,CAAC;AAIrE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAGjD,KAAK,eAAe,GAChB,WAAW,GACX,aAAa,GACb,YAAY,GACZ,cAAc,CAAC;AA6BnB,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IAC1E,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,qFAAqF;IACrF,QAAQ,CA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