@pickle-ui/react-native 1.0.0-beta.0 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/README.md +70 -11
  2. package/dist/components/Badge.d.ts +6 -3
  3. package/dist/components/Badge.d.ts.map +1 -1
  4. package/dist/components/Badge.js +36 -7
  5. package/dist/components/Badge.js.map +1 -1
  6. package/dist/components/Button.d.ts +11 -4
  7. package/dist/components/Button.d.ts.map +1 -1
  8. package/dist/components/Button.js +100 -15
  9. package/dist/components/Button.js.map +1 -1
  10. package/dist/components/Card.d.ts +15 -5
  11. package/dist/components/Card.d.ts.map +1 -1
  12. package/dist/components/Card.js +28 -10
  13. package/dist/components/Card.js.map +1 -1
  14. package/dist/components/Flex.d.ts +25 -0
  15. package/dist/components/Flex.d.ts.map +1 -0
  16. package/dist/components/Flex.js +24 -0
  17. package/dist/components/Flex.js.map +1 -0
  18. package/dist/components/Grid.d.ts +36 -0
  19. package/dist/components/Grid.d.ts.map +1 -0
  20. package/dist/components/Grid.js +68 -0
  21. package/dist/components/Grid.js.map +1 -0
  22. package/dist/components/Separator.d.ts +11 -0
  23. package/dist/components/Separator.d.ts.map +1 -0
  24. package/dist/components/Separator.js +12 -0
  25. package/dist/components/Separator.js.map +1 -0
  26. package/dist/components/Spinner.d.ts +14 -0
  27. package/dist/components/Spinner.d.ts.map +1 -0
  28. package/dist/components/Spinner.js +41 -0
  29. package/dist/components/Spinner.js.map +1 -0
  30. package/dist/components/Text.d.ts +7 -3
  31. package/dist/components/Text.d.ts.map +1 -1
  32. package/dist/components/Text.js +23 -11
  33. package/dist/components/Text.js.map +1 -1
  34. package/dist/components/XStack.d.ts +4 -0
  35. package/dist/components/XStack.d.ts.map +1 -0
  36. package/dist/components/XStack.js +6 -0
  37. package/dist/components/XStack.js.map +1 -0
  38. package/dist/components/YStack.d.ts +4 -0
  39. package/dist/components/YStack.d.ts.map +1 -0
  40. package/dist/components/YStack.js +6 -0
  41. package/dist/components/YStack.js.map +1 -0
  42. package/dist/components/_internal/InputFrame.d.ts +13 -0
  43. package/dist/components/_internal/InputFrame.d.ts.map +1 -0
  44. package/dist/components/_internal/InputFrame.js +14 -0
  45. package/dist/components/_internal/InputFrame.js.map +1 -0
  46. package/dist/components/_internal/StoryItem.d.ts +6 -0
  47. package/dist/components/_internal/StoryItem.d.ts.map +1 -0
  48. package/dist/components/_internal/StoryItem.js +9 -0
  49. package/dist/components/_internal/StoryItem.js.map +1 -0
  50. package/dist/components/_internal/layout.d.ts +79 -0
  51. package/dist/components/_internal/layout.d.ts.map +1 -0
  52. package/dist/components/_internal/layout.js +73 -0
  53. package/dist/components/_internal/layout.js.map +1 -0
  54. package/dist/components/_internal/useControllableState.d.ts +7 -0
  55. package/dist/components/_internal/useControllableState.d.ts.map +1 -0
  56. package/dist/components/_internal/useControllableState.js +17 -0
  57. package/dist/components/_internal/useControllableState.js.map +1 -0
  58. package/dist/components/form/Checkbox.d.ts +26 -0
  59. package/dist/components/form/Checkbox.d.ts.map +1 -0
  60. package/dist/components/form/Checkbox.js +41 -0
  61. package/dist/components/form/Checkbox.js.map +1 -0
  62. package/dist/components/form/Form.context.d.ts +34 -0
  63. package/dist/components/form/Form.context.d.ts.map +1 -0
  64. package/dist/components/form/Form.context.js +53 -0
  65. package/dist/components/form/Form.context.js.map +1 -0
  66. package/dist/components/form/Form.d.ts +33 -0
  67. package/dist/components/form/Form.d.ts.map +1 -0
  68. package/dist/components/form/Form.js +36 -0
  69. package/dist/components/form/Form.js.map +1 -0
  70. package/dist/components/form/FormCheckbox.d.ts +7 -0
  71. package/dist/components/form/FormCheckbox.d.ts.map +1 -0
  72. package/dist/components/form/FormCheckbox.js +24 -0
  73. package/dist/components/form/FormCheckbox.js.map +1 -0
  74. package/dist/components/form/FormDescription.d.ts +4 -0
  75. package/dist/components/form/FormDescription.d.ts.map +1 -0
  76. package/dist/components/form/FormDescription.js +7 -0
  77. package/dist/components/form/FormDescription.js.map +1 -0
  78. package/dist/components/form/FormError.d.ts +5 -0
  79. package/dist/components/form/FormError.d.ts.map +1 -0
  80. package/dist/components/form/FormError.js +8 -0
  81. package/dist/components/form/FormError.js.map +1 -0
  82. package/dist/components/form/FormField.d.ts +17 -0
  83. package/dist/components/form/FormField.d.ts.map +1 -0
  84. package/dist/components/form/FormField.js +36 -0
  85. package/dist/components/form/FormField.js.map +1 -0
  86. package/dist/components/form/FormInput.d.ts +10 -0
  87. package/dist/components/form/FormInput.d.ts.map +1 -0
  88. package/dist/components/form/FormInput.js +36 -0
  89. package/dist/components/form/FormInput.js.map +1 -0
  90. package/dist/components/form/FormInputGroup.d.ts +8 -0
  91. package/dist/components/form/FormInputGroup.d.ts.map +1 -0
  92. package/dist/components/form/FormInputGroup.js +18 -0
  93. package/dist/components/form/FormInputGroup.js.map +1 -0
  94. package/dist/components/form/FormLabel.d.ts +4 -0
  95. package/dist/components/form/FormLabel.d.ts.map +1 -0
  96. package/dist/components/form/FormLabel.js +7 -0
  97. package/dist/components/form/FormLabel.js.map +1 -0
  98. package/dist/components/form/FormRadioGroup.d.ts +11 -0
  99. package/dist/components/form/FormRadioGroup.d.ts.map +1 -0
  100. package/dist/components/form/FormRadioGroup.js +24 -0
  101. package/dist/components/form/FormRadioGroup.js.map +1 -0
  102. package/dist/components/form/FormRoot.d.ts +13 -0
  103. package/dist/components/form/FormRoot.d.ts.map +1 -0
  104. package/dist/components/form/FormRoot.js +19 -0
  105. package/dist/components/form/FormRoot.js.map +1 -0
  106. package/dist/components/form/FormTextarea.d.ts +7 -0
  107. package/dist/components/form/FormTextarea.d.ts.map +1 -0
  108. package/dist/components/form/FormTextarea.js +27 -0
  109. package/dist/components/form/FormTextarea.js.map +1 -0
  110. package/dist/components/form/Input.d.ts +17 -0
  111. package/dist/components/form/Input.d.ts.map +1 -0
  112. package/dist/components/form/Input.js +32 -0
  113. package/dist/components/form/Input.js.map +1 -0
  114. package/dist/components/form/InputGroup.context.d.ts +10 -0
  115. package/dist/components/form/InputGroup.context.d.ts.map +1 -0
  116. package/dist/components/form/InputGroup.context.js +8 -0
  117. package/dist/components/form/InputGroup.context.js.map +1 -0
  118. package/dist/components/form/InputGroup.d.ts +31 -0
  119. package/dist/components/form/InputGroup.d.ts.map +1 -0
  120. package/dist/components/form/InputGroup.js +123 -0
  121. package/dist/components/form/InputGroup.js.map +1 -0
  122. package/dist/components/form/RadioGroup.d.ts +29 -0
  123. package/dist/components/form/RadioGroup.d.ts.map +1 -0
  124. package/dist/components/form/RadioGroup.js +42 -0
  125. package/dist/components/form/RadioGroup.js.map +1 -0
  126. package/dist/components/form/Textarea.d.ts +19 -0
  127. package/dist/components/form/Textarea.d.ts.map +1 -0
  128. package/dist/components/form/Textarea.js +26 -0
  129. package/dist/components/form/Textarea.js.map +1 -0
  130. package/dist/entries/card.d.ts +1 -1
  131. package/dist/entries/card.d.ts.map +1 -1
  132. package/dist/entries/checkbox.d.ts +3 -0
  133. package/dist/entries/checkbox.d.ts.map +1 -0
  134. package/dist/entries/checkbox.js +2 -0
  135. package/dist/entries/checkbox.js.map +1 -0
  136. package/dist/entries/flex.d.ts +3 -0
  137. package/dist/entries/flex.d.ts.map +1 -0
  138. package/dist/entries/flex.js +2 -0
  139. package/dist/entries/flex.js.map +1 -0
  140. package/dist/entries/form.d.ts +3 -0
  141. package/dist/entries/form.d.ts.map +1 -0
  142. package/dist/entries/form.js +2 -0
  143. package/dist/entries/form.js.map +1 -0
  144. package/dist/entries/grid.d.ts +3 -0
  145. package/dist/entries/grid.d.ts.map +1 -0
  146. package/dist/entries/grid.js +2 -0
  147. package/dist/entries/grid.js.map +1 -0
  148. package/dist/entries/input-group.d.ts +3 -0
  149. package/dist/entries/input-group.d.ts.map +1 -0
  150. package/dist/entries/input-group.js +2 -0
  151. package/dist/entries/input-group.js.map +1 -0
  152. package/dist/entries/input.d.ts +3 -0
  153. package/dist/entries/input.d.ts.map +1 -0
  154. package/dist/entries/input.js +2 -0
  155. package/dist/entries/input.js.map +1 -0
  156. package/dist/entries/radio-group.d.ts +3 -0
  157. package/dist/entries/radio-group.d.ts.map +1 -0
  158. package/dist/entries/radio-group.js +2 -0
  159. package/dist/entries/radio-group.js.map +1 -0
  160. package/dist/entries/separator.d.ts +3 -0
  161. package/dist/entries/separator.d.ts.map +1 -0
  162. package/dist/entries/separator.js +2 -0
  163. package/dist/entries/separator.js.map +1 -0
  164. package/dist/entries/spinner.d.ts +3 -0
  165. package/dist/entries/spinner.d.ts.map +1 -0
  166. package/dist/entries/spinner.js +2 -0
  167. package/dist/entries/spinner.js.map +1 -0
  168. package/dist/entries/textarea.d.ts +3 -0
  169. package/dist/entries/textarea.d.ts.map +1 -0
  170. package/dist/entries/textarea.js +2 -0
  171. package/dist/entries/textarea.js.map +1 -0
  172. package/dist/entries/theme.d.ts +3 -0
  173. package/dist/entries/theme.d.ts.map +1 -0
  174. package/dist/entries/theme.js +2 -0
  175. package/dist/entries/theme.js.map +1 -0
  176. package/dist/entries/x-stack.d.ts +3 -0
  177. package/dist/entries/x-stack.d.ts.map +1 -0
  178. package/dist/entries/x-stack.js +2 -0
  179. package/dist/entries/x-stack.js.map +1 -0
  180. package/dist/entries/y-stack.d.ts +3 -0
  181. package/dist/entries/y-stack.d.ts.map +1 -0
  182. package/dist/entries/y-stack.js +2 -0
  183. package/dist/entries/y-stack.js.map +1 -0
  184. package/dist/index.d.ts +13 -0
  185. package/dist/index.d.ts.map +1 -1
  186. package/dist/index.js +13 -0
  187. package/dist/index.js.map +1 -1
  188. package/dist/lib/cn.d.ts.map +1 -1
  189. package/dist/lib/cn.js +13 -1
  190. package/dist/lib/cn.js.map +1 -1
  191. package/package.json +10 -3
  192. package/src/base.css +7 -2
  193. package/src/components/Badge.stories.tsx +51 -6
  194. package/src/components/Badge.test.tsx +15 -0
  195. package/src/components/Badge.tsx +73 -17
  196. package/src/components/Button.stories.tsx +96 -8
  197. package/src/components/Button.test.tsx +69 -0
  198. package/src/components/Button.tsx +159 -18
  199. package/src/components/Card.stories.tsx +17 -4
  200. package/src/components/Card.test.tsx +24 -1
  201. package/src/components/Card.tsx +71 -13
  202. package/src/components/Flex.stories.tsx +58 -0
  203. package/src/components/Flex.test.tsx +57 -0
  204. package/src/components/Flex.tsx +52 -0
  205. package/src/components/Grid.stories.tsx +55 -0
  206. package/src/components/Grid.test.tsx +140 -0
  207. package/src/components/Grid.tsx +166 -0
  208. package/src/components/Separator.stories.tsx +39 -0
  209. package/src/components/Separator.test.tsx +25 -0
  210. package/src/components/Separator.tsx +30 -0
  211. package/src/components/Spinner.stories.tsx +35 -0
  212. package/src/components/Spinner.test.tsx +30 -0
  213. package/src/components/Spinner.tsx +75 -0
  214. package/src/components/Text.stories.tsx +52 -2
  215. package/src/components/Text.test.tsx +35 -3
  216. package/src/components/Text.tsx +42 -12
  217. package/src/components/XStack.stories.tsx +46 -0
  218. package/src/components/XStack.test.tsx +13 -0
  219. package/src/components/XStack.tsx +7 -0
  220. package/src/components/YStack.stories.tsx +46 -0
  221. package/src/components/YStack.test.tsx +13 -0
  222. package/src/components/YStack.tsx +7 -0
  223. package/src/components/_internal/InputFrame.tsx +50 -0
  224. package/src/components/_internal/Story.tsx +34 -0
  225. package/src/components/_internal/StoryItem.tsx +24 -0
  226. package/src/components/_internal/layout.ts +103 -0
  227. package/src/components/_internal/useControllableState.ts +25 -0
  228. package/src/components/form/Checkbox.stories.tsx +67 -0
  229. package/src/components/form/Checkbox.test.tsx +88 -0
  230. package/src/components/form/Checkbox.tsx +141 -0
  231. package/src/components/form/Form.context.ts +91 -0
  232. package/src/components/form/Form.stories.tsx +152 -0
  233. package/src/components/form/Form.test.tsx +195 -0
  234. package/src/components/form/Form.tsx +51 -0
  235. package/src/components/form/FormCheckbox.tsx +42 -0
  236. package/src/components/form/FormDescription.tsx +14 -0
  237. package/src/components/form/FormError.tsx +17 -0
  238. package/src/components/form/FormField.tsx +82 -0
  239. package/src/components/form/FormInput.tsx +70 -0
  240. package/src/components/form/FormInputGroup.tsx +30 -0
  241. package/src/components/form/FormLabel.tsx +17 -0
  242. package/src/components/form/FormRadioGroup.tsx +48 -0
  243. package/src/components/form/FormRoot.tsx +41 -0
  244. package/src/components/form/FormTextarea.tsx +56 -0
  245. package/src/components/form/Input.stories.tsx +105 -0
  246. package/src/components/form/Input.test.tsx +76 -0
  247. package/src/components/form/Input.tsx +81 -0
  248. package/src/components/form/InputGroup.context.ts +11 -0
  249. package/src/components/form/InputGroup.stories.tsx +129 -0
  250. package/src/components/form/InputGroup.test.tsx +95 -0
  251. package/src/components/form/InputGroup.tsx +266 -0
  252. package/src/components/form/RadioGroup.stories.tsx +62 -0
  253. package/src/components/form/RadioGroup.test.tsx +98 -0
  254. package/src/components/form/RadioGroup.tsx +151 -0
  255. package/src/components/form/Textarea.stories.tsx +61 -0
  256. package/src/components/form/Textarea.test.tsx +35 -0
  257. package/src/components/form/Textarea.tsx +74 -0
  258. package/src/entries/card.ts +2 -0
  259. package/src/entries/checkbox.ts +2 -0
  260. package/src/entries/flex.ts +2 -0
  261. package/src/entries/form.ts +13 -0
  262. package/src/entries/grid.ts +2 -0
  263. package/src/entries/input-group.ts +8 -0
  264. package/src/entries/input.ts +2 -0
  265. package/src/entries/radio-group.ts +5 -0
  266. package/src/entries/separator.ts +2 -0
  267. package/src/entries/spinner.ts +2 -0
  268. package/src/entries/textarea.ts +2 -0
  269. package/src/entries/theme.ts +7 -0
  270. package/src/entries/x-stack.ts +2 -0
  271. package/src/entries/y-stack.ts +2 -0
  272. package/src/index.ts +13 -0
  273. package/src/lib/cn.test.ts +6 -0
  274. package/src/lib/cn.ts +14 -1
@@ -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,MAAM,UAAU,YAAY,CAAC,EAC3B,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,YAAY,EACZ,GAAG,EACH,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,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,mBAAmB,EAAE,CAAC;IAC3C,MAAM,YAAY,GAAG,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACxD,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAA4B,CAAC,CAAC;IAEtE,OAAO,CACL,KAAC,QAAQ,OACH,YAAY,KACZ,KAAK,EACT,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,KAAK,CAAC,MAAM,EAAE,CAAC;YACf,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,EACD,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;YACrB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrB,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC,EACD,GAAG,EAAE,CAAC,IAA8B,EAAE,EAAE;YACtC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YACxB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAChB,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE,GACxB,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { TextInput } from 'react-native';
2
+ 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 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,iDAAiD,EACjD,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,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG;IAAE,KAAK,CAAC,EAAE,eAAe,CAAA;CAAE,CAAC;AAE9E,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAEhE,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAEpE,wEAAwE;AACxE,iBAAS,eAAe,CAAC,EACvB,KAAsB,EACtB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,oBAAoB,+BAuBtB;AAED,iBAAS,gBAAgB,CAAC,EACxB,KAAoB,EACpB,SAAS,EACT,IAAgB,EAChB,OAAiB,EACjB,GAAG,KAAK,EACT,EAAE,qBAAqB,+BAMvB;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,MAAM,EACN,OAAO,EACP,GAAG,EACH,GAAG,KAAK,EACT,EAAE,oBAAoB,+BA6BtB;AAED,2EAA2E;AAC3E,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,+BAoDzE;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,+BAQnE;AA+CD,QAAA,MAAM,UAAU;;;;;CAKd,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,123 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Children, createContext, isValidElement, use, useImperativeHandle, useMemo, useRef, useState, } from 'react';
3
+ import { Pressable, Text, View } from 'react-native';
4
+ import { cn } from '../../lib/cn';
5
+ import { InputFrame } from '../_internal/InputFrame';
6
+ import { Button } from '../Button';
7
+ import { Input } from './Input';
8
+ import { InputGroupStateContext } from './InputGroup.context';
9
+ // The web's addon paddings minus the 1pt border. Addons holding a button sit
10
+ // closer to the edge, like the web's `has-[>button]` margins.
11
+ const addonClasses = {
12
+ 'block-end': 'w-full justify-start px-[11px] pb-[11px]',
13
+ 'block-start': 'w-full justify-start px-[11px] pt-[11px]',
14
+ 'inline-end': 'pe-[11px]',
15
+ 'inline-start': 'ps-[11px]',
16
+ };
17
+ const buttonAddonClasses = {
18
+ 'block-end': '',
19
+ 'block-start': '',
20
+ 'inline-end': 'pe-[3px]',
21
+ 'inline-start': 'ps-[3px]',
22
+ };
23
+ const InputGroupContext = createContext(null);
24
+ /** Pressing an addon focuses the field, like clicking it on the web. */
25
+ function InputGroupAddon({ align = 'inline-start', children, className, ...props }) {
26
+ const group = useInputGroup('Addon');
27
+ return (_jsx(Pressable, { accessible: false, className: cn('flex-row items-center justify-center gap-2', addonClasses[align], className), onPress: group.focusInput, ...props, children: Children.map(children, (child) => typeof child === 'string' || typeof child === 'number' ? (_jsx(Text, { className: "text-foreground text-[14px]", children: child })) : (child)) }));
28
+ }
29
+ function InputGroupButton({ align = 'inline-end', className, size = 'icon-xs', variant = 'ghost', ...props }) {
30
+ return (_jsx(InputGroupAddon, { align: align, className: buttonAddonClasses[align], children: _jsx(Button, { className: className, size: size, variant: variant, ...props }) }));
31
+ }
32
+ function InputGroupInput({ className, onBlur, onFocus, ref, ...props }) {
33
+ const group = useInputGroup('Input');
34
+ const inputRef = useRef(null);
35
+ useImperativeHandle(ref, () => inputRef.current);
36
+ return (_jsx(Input, { className: cn(group.hasInlineStart && 'ps-2', group.hasInlineEnd && 'pe-2', className), onBlur: (event) => {
37
+ group.setFocused(false);
38
+ onBlur?.(event);
39
+ }, onFocus: (event) => {
40
+ group.setFocused(true);
41
+ onFocus?.(event);
42
+ }, ref: (node) => {
43
+ inputRef.current = node;
44
+ // The group focuses the input when an addon is pressed.
45
+ group.setInput(node);
46
+ }, unstyled: true, ...props }));
47
+ }
48
+ /** Places addons around the input and frames the group like an `Input`. */
49
+ function InputGroupRoot({ children, className, ...props }) {
50
+ const [focused, setFocused] = useState(false);
51
+ const inputRef = useRef(null);
52
+ const state = use(InputGroupStateContext);
53
+ const sorted = sortChildren(children);
54
+ const { parts } = sorted;
55
+ const disabled = sorted.disabled || Boolean(state?.disabled);
56
+ const invalid = sorted.invalid || Boolean(state?.invalid);
57
+ const hasInlineEnd = parts['inline-end'].length > 0;
58
+ const hasInlineStart = parts['inline-start'].length > 0;
59
+ const context = useMemo(() => ({
60
+ focusInput: () => inputRef.current?.focus(),
61
+ hasInlineEnd,
62
+ hasInlineStart,
63
+ setFocused,
64
+ setInput: (input) => {
65
+ inputRef.current = input;
66
+ },
67
+ }), [hasInlineEnd, hasInlineStart]);
68
+ const hasBlock = parts['block-start'].length > 0 || parts['block-end'].length > 0;
69
+ const row = [
70
+ ...parts['inline-start'],
71
+ ...parts.field,
72
+ ...parts['inline-end'],
73
+ ];
74
+ return (_jsx(InputGroupContext, { value: context, children: _jsx(InputFrame, { className: cn(hasBlock ? 'flex-col' : 'h-8 items-center', className), disabled: disabled, focused: focused, invalid: invalid, role: "group", ...props, children: hasBlock ? (_jsxs(_Fragment, { children: [parts['block-start'], _jsx(View, { className: "flex-row items-center", children: row }), parts['block-end']] })) : (row) }) }));
75
+ }
76
+ function InputGroupText({ className, ...props }) {
77
+ return (_jsx(Text, { className: cn('text-muted-foreground text-[14px]', className), numberOfLines: 1, ...props }));
78
+ }
79
+ /**
80
+ * Splits the group's direct children by `align`, since React Native has no
81
+ * CSS `order`, and reads `disabled` and `invalid` from its inputs.
82
+ */
83
+ function sortChildren(children) {
84
+ const parts = {
85
+ 'block-end': [],
86
+ 'block-start': [],
87
+ field: [],
88
+ 'inline-end': [],
89
+ 'inline-start': [],
90
+ };
91
+ let disabled = false;
92
+ let invalid = false;
93
+ for (const child of Children.toArray(children)) {
94
+ if (isValidElement(child) &&
95
+ (child.type === InputGroupAddon || child.type === InputGroupButton)) {
96
+ const fallback = child.type === InputGroupButton ? 'inline-end' : 'inline-start';
97
+ parts[child.props.align ?? fallback].push(child);
98
+ }
99
+ else {
100
+ if (isValidElement(child) &&
101
+ child.type === InputGroupInput) {
102
+ disabled || (disabled = Boolean(child.props.disabled));
103
+ invalid || (invalid = Boolean(child.props.invalid));
104
+ }
105
+ parts.field.push(child);
106
+ }
107
+ }
108
+ return { disabled, invalid, parts };
109
+ }
110
+ function useInputGroup(part) {
111
+ const group = use(InputGroupContext);
112
+ if (!group)
113
+ throw new Error(`InputGroup.${part} must be inside an InputGroup.`);
114
+ return group;
115
+ }
116
+ const InputGroup = Object.assign(InputGroupRoot, {
117
+ Addon: InputGroupAddon,
118
+ Button: InputGroupButton,
119
+ Input: InputGroupInput,
120
+ Text: InputGroupText,
121
+ });
122
+ export { InputGroup };
123
+ //# sourceMappingURL=InputGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputGroup.js","sourceRoot":"","sources":["../../../src/components/form/InputGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,aAAa,EACb,cAAc,EAEd,GAAG,EACH,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,IAAI,EAAkB,IAAI,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAoB,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,KAAK,EAAmB,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAU9D,6EAA6E;AAC7E,8DAA8D;AAC9D,MAAM,YAAY,GAAG;IACnB,WAAW,EAAE,0CAA0C;IACvD,aAAa,EAAE,0CAA0C;IACzD,YAAY,EAAE,WAAW;IACzB,cAAc,EAAE,WAAW;CACnB,CAAC;AACX,MAAM,kBAAkB,GAAG;IACzB,WAAW,EAAE,EAAE;IACf,aAAa,EAAE,EAAE;IACjB,YAAY,EAAE,UAAU;IACxB,cAAc,EAAE,UAAU;CAClB,CAAC;AAUX,MAAM,iBAAiB,GAAG,aAAa,CAAgC,IAAI,CAAC,CAAC;AAgB7E,wEAAwE;AACxE,SAAS,eAAe,CAAC,EACvB,KAAK,GAAG,cAAc,EACtB,QAAQ,EACR,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KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,KAAK,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACrC,IAAI,CAAC,KAAK;QACR,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,gCAAgC,CAAC,CAAC;IACtE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE;IAC/C,KAAK,EAAE,eAAe;IACtB,MAAM,EAAE,gBAAgB;IACxB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;CACrB,CAAC,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { Pressable, View } from 'react-native';
2
+ export type RadioGroupItemProps = Omit<React.ComponentProps<typeof Pressable>, 'children' | 'disabled'> & {
3
+ /** Class overrides for the row around the circle and label, the dot and the label. */
4
+ classNames?: {
5
+ field?: string;
6
+ indicator?: string;
7
+ label?: string;
8
+ };
9
+ disabled?: boolean;
10
+ /** Marks the choice as invalid, like the web's `aria-invalid`. */
11
+ invalid?: boolean;
12
+ /** Text next to the circle; pressing it selects the item and names it. */
13
+ label?: React.ReactNode;
14
+ size?: 'md' | 'sm';
15
+ value: string;
16
+ };
17
+ export type RadioGroupProps = React.ComponentProps<typeof View> & {
18
+ defaultValue?: string;
19
+ disabled?: boolean;
20
+ onValueChange?: (value: string) => void;
21
+ value?: string;
22
+ };
23
+ declare function RadioGroupItem({ accessibilityState, className, classNames, disabled: disabledProp, invalid, label, size, value, ...props }: RadioGroupItemProps): import("react").JSX.Element;
24
+ declare function RadioGroupRoot({ className, defaultValue, disabled, onValueChange, value: valueProp, ...props }: RadioGroupProps): import("react").JSX.Element;
25
+ declare const RadioGroup: typeof RadioGroupRoot & {
26
+ Item: typeof RadioGroupItem;
27
+ };
28
+ export { RadioGroup, RadioGroupItem };
29
+ //# sourceMappingURL=RadioGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/components/form/RadioGroup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAQ,IAAI,EAAE,MAAM,cAAc,CAAC;AAuBrD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,EACtC,UAAU,GAAG,UAAU,CACxB,GAAG;IACF,sFAAsF;IACtF,UAAU,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,GAAG;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,iBAAS,cAAc,CAAC,EACtB,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,QAAQ,EAAE,YAAoB,EAC9B,OAAe,EACf,KAAK,EACL,IAAW,EACX,KAAK,EACL,GAAG,KAAK,EACT,EAAE,mBAAmB,+BAwDrB;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,YAAY,EACZ,QAAgB,EAChB,aAAa,EACb,KAAK,EAAE,SAAS,EAChB,GAAG,KAAK,EACT,EAAE,eAAe,+BAuBjB;AAED,QAAA,MAAM,UAAU;;CAEd,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, use, useMemo } from 'react';
3
+ import { Pressable, Text, View } from 'react-native';
4
+ import { cn } from '../../lib/cn';
5
+ import { useControllableState } from '../_internal/useControllableState';
6
+ // Same sizes as `RadioGroup` in @pickle-ui/react. `hitSlop` stretches the
7
+ // circle to a 44pt touch target, vertically only when a label widens it.
8
+ const controlClasses = { md: 'size-4', sm: 'size-3.5' };
9
+ const indicatorClasses = { md: 'size-2', sm: 'size-1.5' };
10
+ const controlHitSlop = { md: 14, sm: 15 };
11
+ const fieldHitSlop = {
12
+ md: { bottom: 14, top: 14 },
13
+ sm: { bottom: 15, top: 15 },
14
+ };
15
+ const RadioGroupContext = createContext(null);
16
+ function RadioGroupItem({ accessibilityState, className, classNames, disabled: disabledProp = false, invalid = false, label, size = 'md', value, ...props }) {
17
+ const group = use(RadioGroupContext);
18
+ if (!group)
19
+ throw new Error('RadioGroup.Item must be inside a RadioGroup.');
20
+ const checked = group.value === value;
21
+ const disabled = group.disabled || disabledProp;
22
+ return (_jsxs(Pressable, { accessibilityState: { ...accessibilityState, checked, disabled }, "aria-checked": checked, "aria-disabled": disabled, className: label
23
+ ? cn('flex-row items-center gap-2', classNames?.field)
24
+ : 'self-start', disabled: disabled, hitSlop: label ? fieldHitSlop[size] : controlHitSlop[size], onPress: () => group.onSelect(value), role: "radio", ...props, children: [_jsx(View, { className: cn('border-input bg-background items-center justify-center rounded-full border', controlClasses[size], checked && 'border-primary', invalid && 'border-destructive', disabled && 'opacity-50', className), children: checked ? (_jsx(View, { className: cn('bg-primary rounded-full', indicatorClasses[size], classNames?.indicator) })) : null }), label ? (_jsx(Text, { className: cn('text-sm leading-none font-medium', disabled ? 'text-muted-foreground' : 'text-foreground', classNames?.label), children: label })) : null] }));
25
+ }
26
+ function RadioGroupRoot({ className, defaultValue, disabled = false, onValueChange, value: valueProp, ...props }) {
27
+ const [value, setValue] = useControllableState(valueProp, defaultValue, onValueChange);
28
+ const context = useMemo(() => ({
29
+ disabled,
30
+ onSelect: (next) => {
31
+ if (next !== value)
32
+ setValue(next);
33
+ },
34
+ value,
35
+ }), [disabled, setValue, value]);
36
+ return (_jsx(RadioGroupContext, { value: context, children: _jsx(View, { className: cn('gap-2', className), role: "radiogroup", ...props }) }));
37
+ }
38
+ const RadioGroup = Object.assign(RadioGroupRoot, {
39
+ Item: RadioGroupItem,
40
+ });
41
+ export { RadioGroup, RadioGroupItem };
42
+ //# sourceMappingURL=RadioGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../../src/components/form/RadioGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACpD,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,0EAA0E;AAC1E,yEAAyE;AACzE,MAAM,cAAc,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAW,CAAC;AACjE,MAAM,gBAAgB,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAW,CAAC;AACnE,MAAM,cAAc,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAW,CAAC;AACnD,MAAM,YAA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D,CACrB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE;IAC/C,IAAI,EAAE,cAAc;CACrB,CAAC,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { TextInput } from 'react-native';
2
+ export type TextareaProps = Omit<React.ComponentProps<typeof TextInput>, 'multiline'> & {
3
+ /** Class overrides for the inner `TextInput`; `className` styles the control around it. */
4
+ classNames?: {
5
+ textarea?: 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
+ };
13
+ /**
14
+ * A multi-line text field that grows with its content from three lines, like
15
+ * `Textarea` in @pickle-ui/react. Set a `min-h-*` class on
16
+ * `classNames.textarea` to change the minimum.
17
+ */
18
+ export declare function Textarea({ className, classNames, disabled, editable, invalid, onBlur, onFocus, size, ...props }: TextareaProps): import("react").JSX.Element;
19
+ //# sourceMappingURL=Textarea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/form/Textarea.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAWzC,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,EACtC,WAAW,CACZ,GAAG;IACF,2FAA2F;IAC3F,UAAU,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,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;CAC3B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EACvB,SAAS,EACT,UAAU,EACV,QAAgB,EAChB,QAAe,EACf,OAAe,EACf,MAAM,EACN,OAAO,EACP,IAAW,EACX,GAAG,KAAK,EACT,EAAE,aAAa,+BAiCf"}
@@ -0,0 +1,26 @@
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
+ const sizeClasses = {
7
+ lg: 'min-h-18 px-[11px]',
8
+ md: 'min-h-17.5 px-[11px]',
9
+ sm: 'min-h-16 px-[9px]',
10
+ };
11
+ /**
12
+ * A multi-line text field that grows with its content from three lines, like
13
+ * `Textarea` in @pickle-ui/react. Set a `min-h-*` class on
14
+ * `classNames.textarea` to change the minimum.
15
+ */
16
+ export function Textarea({ className, classNames, disabled = false, editable = true, invalid = false, onBlur, onFocus, size = 'md', ...props }) {
17
+ const [focused, setFocused] = useState(false);
18
+ return (_jsx(InputFrame, { className: className, disabled: disabled, focused: focused, invalid: invalid, children: _jsx(TextInput, { accessibilityState: { disabled }, className: cn('text-foreground web:field-sizing-content web:resize-none flex-1 py-2 text-sm outline-none', sizeClasses[size], classNames?.textarea), editable: editable && !disabled, multiline: true, onBlur: (event) => {
19
+ setFocused(false);
20
+ onBlur?.(event);
21
+ }, onFocus: (event) => {
22
+ setFocused(true);
23
+ onFocus?.(event);
24
+ }, placeholderTextColorClassName: "accent-muted-foreground/72", textAlignVertical: "top", ...props }) }));
25
+ }
26
+ //# sourceMappingURL=Textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../../src/components/form/Textarea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,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card';
2
- export type { CardContentProps, CardDescriptionProps, CardHeaderProps, CardProps, CardTitleProps, } from '../components/Card';
2
+ export type { CardActionProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardProps, CardTitleProps, } from '../components/Card';
3
3
  //# sourceMappingURL=card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/entries/card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,SAAS,EACT,cAAc,GACf,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/entries/card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,SAAS,EACT,cAAc,GACf,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Checkbox } from '../components/form/Checkbox';
2
+ export type { CheckboxProps } from '../components/form/Checkbox';
3
+ //# sourceMappingURL=checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/entries/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Checkbox } from '../components/form/Checkbox';
2
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../src/entries/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Flex } from '../components/Flex';
2
+ export type { FlexProps } from '../components/Flex';
3
+ //# sourceMappingURL=flex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flex.d.ts","sourceRoot":"","sources":["../../src/entries/flex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Flex } from '../components/Flex';
2
+ //# sourceMappingURL=flex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flex.js","sourceRoot":"","sources":["../../src/entries/flex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Form } from '../components/form/Form';
2
+ export type { FormCheckboxProps, FormDescriptionProps, FormErrorProps, FormFieldProps, FormInputGroupProps, FormInputProps, FormLabelProps, FormProps, FormRadioGroupProps, FormTextareaProps, } from '../components/form/Form';
3
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/entries/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,SAAS,EACT,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Form } from '../components/form/Form';
2
+ //# sourceMappingURL=form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/entries/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Grid } from '../components/Grid';
2
+ export type { GridProps } from '../components/Grid';
3
+ //# sourceMappingURL=grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/entries/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Grid } from '../components/Grid';
2
+ //# sourceMappingURL=grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/entries/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { InputGroup } from '../components/form/InputGroup';
2
+ export type { InputGroupAddonProps, InputGroupButtonProps, InputGroupInputProps, InputGroupProps, InputGroupTextProps, } from '../components/form/InputGroup';
3
+ //# sourceMappingURL=input-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../src/entries/input-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,GACpB,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { InputGroup } from '../components/form/InputGroup';
2
+ //# sourceMappingURL=input-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-group.js","sourceRoot":"","sources":["../../src/entries/input-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Input } from '../components/form/Input';
2
+ export type { InputProps } from '../components/form/Input';
3
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/entries/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Input } from '../components/form/Input';
2
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/entries/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { RadioGroup } from '../components/form/RadioGroup';
2
+ export type { RadioGroupItemProps, RadioGroupProps, } from '../components/form/RadioGroup';
3
+ //# sourceMappingURL=radio-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../src/entries/radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,YAAY,EACV,mBAAmB,EACnB,eAAe,GAChB,MAAM,+BAA+B,CAAC"}