@cdx-ui/primitives 0.0.1-alpha.29 → 0.0.1-alpha.30

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 (101) hide show
  1. package/lib/commonjs/form-control/createFormError.js +41 -0
  2. package/lib/commonjs/form-control/createFormError.js.map +1 -0
  3. package/lib/commonjs/form-control/createFormErrorIcon.js +18 -0
  4. package/lib/commonjs/form-control/createFormErrorIcon.js.map +1 -0
  5. package/lib/commonjs/form-control/createFormErrorText.js +18 -0
  6. package/lib/commonjs/form-control/createFormErrorText.js.map +1 -0
  7. package/lib/commonjs/form-control/createFormField.js +35 -0
  8. package/lib/commonjs/form-control/createFormField.js.map +1 -0
  9. package/lib/commonjs/form-control/createFormHelper.js +41 -0
  10. package/lib/commonjs/form-control/createFormHelper.js.map +1 -0
  11. package/lib/commonjs/form-control/createFormHelperText.js +18 -0
  12. package/lib/commonjs/form-control/createFormHelperText.js.map +1 -0
  13. package/lib/commonjs/form-control/createFormLabel.js +38 -0
  14. package/lib/commonjs/form-control/createFormLabel.js.map +1 -0
  15. package/lib/commonjs/form-control/createFormRoot.js +21 -0
  16. package/lib/commonjs/form-control/createFormRoot.js.map +1 -0
  17. package/lib/commonjs/form-control/index.js +53 -0
  18. package/lib/commonjs/form-control/index.js.map +1 -0
  19. package/lib/commonjs/form-control/types.js +6 -0
  20. package/lib/commonjs/form-control/types.js.map +1 -0
  21. package/lib/commonjs/index.js +12 -0
  22. package/lib/commonjs/index.js.map +1 -1
  23. package/lib/commonjs/input/createInputField.js +3 -1
  24. package/lib/commonjs/input/createInputField.js.map +1 -1
  25. package/lib/commonjs/select/createSelectRoot.js +8 -5
  26. package/lib/commonjs/select/createSelectRoot.js.map +1 -1
  27. package/lib/commonjs/select/createSelectTrigger.js +50 -3
  28. package/lib/commonjs/select/createSelectTrigger.js.map +1 -1
  29. package/lib/module/form-control/createFormError.js +35 -0
  30. package/lib/module/form-control/createFormError.js.map +1 -0
  31. package/lib/module/form-control/createFormErrorIcon.js +13 -0
  32. package/lib/module/form-control/createFormErrorIcon.js.map +1 -0
  33. package/lib/module/form-control/createFormErrorText.js +13 -0
  34. package/lib/module/form-control/createFormErrorText.js.map +1 -0
  35. package/lib/module/form-control/createFormField.js +29 -0
  36. package/lib/module/form-control/createFormField.js.map +1 -0
  37. package/lib/module/form-control/createFormHelper.js +35 -0
  38. package/lib/module/form-control/createFormHelper.js.map +1 -0
  39. package/lib/module/form-control/createFormHelperText.js +13 -0
  40. package/lib/module/form-control/createFormHelperText.js.map +1 -0
  41. package/lib/module/form-control/createFormLabel.js +33 -0
  42. package/lib/module/form-control/createFormLabel.js.map +1 -0
  43. package/lib/module/form-control/createFormRoot.js +15 -0
  44. package/lib/module/form-control/createFormRoot.js.map +1 -0
  45. package/lib/module/form-control/index.js +49 -0
  46. package/lib/module/form-control/index.js.map +1 -0
  47. package/lib/module/form-control/types.js +4 -0
  48. package/lib/module/form-control/types.js.map +1 -0
  49. package/lib/module/index.js +1 -0
  50. package/lib/module/index.js.map +1 -1
  51. package/lib/module/input/createInputField.js +4 -2
  52. package/lib/module/input/createInputField.js.map +1 -1
  53. package/lib/module/select/createSelectRoot.js +8 -5
  54. package/lib/module/select/createSelectRoot.js.map +1 -1
  55. package/lib/module/select/createSelectTrigger.js +52 -5
  56. package/lib/module/select/createSelectTrigger.js.map +1 -1
  57. package/lib/typescript/checkbox/useCheckboxRoot.d.ts +5 -0
  58. package/lib/typescript/checkbox/useCheckboxRoot.d.ts.map +1 -1
  59. package/lib/typescript/form-control/createFormError.d.ts +5 -0
  60. package/lib/typescript/form-control/createFormError.d.ts.map +1 -0
  61. package/lib/typescript/form-control/createFormErrorIcon.d.ts +5 -0
  62. package/lib/typescript/form-control/createFormErrorIcon.d.ts.map +1 -0
  63. package/lib/typescript/form-control/createFormErrorText.d.ts +5 -0
  64. package/lib/typescript/form-control/createFormErrorText.d.ts.map +1 -0
  65. package/lib/typescript/form-control/createFormField.d.ts +6 -0
  66. package/lib/typescript/form-control/createFormField.d.ts.map +1 -0
  67. package/lib/typescript/form-control/createFormHelper.d.ts +5 -0
  68. package/lib/typescript/form-control/createFormHelper.d.ts.map +1 -0
  69. package/lib/typescript/form-control/createFormHelperText.d.ts +5 -0
  70. package/lib/typescript/form-control/createFormHelperText.d.ts.map +1 -0
  71. package/lib/typescript/form-control/createFormLabel.d.ts +8 -0
  72. package/lib/typescript/form-control/createFormLabel.d.ts.map +1 -0
  73. package/lib/typescript/form-control/createFormRoot.d.ts +6 -0
  74. package/lib/typescript/form-control/createFormRoot.d.ts.map +1 -0
  75. package/lib/typescript/form-control/index.d.ts +14 -0
  76. package/lib/typescript/form-control/index.d.ts.map +1 -0
  77. package/lib/typescript/form-control/types.d.ts +73 -0
  78. package/lib/typescript/form-control/types.d.ts.map +1 -0
  79. package/lib/typescript/index.d.ts +1 -0
  80. package/lib/typescript/index.d.ts.map +1 -1
  81. package/lib/typescript/input/createInputField.d.ts.map +1 -1
  82. package/lib/typescript/select/createSelectRoot.d.ts.map +1 -1
  83. package/lib/typescript/select/createSelectTrigger.d.ts.map +1 -1
  84. package/lib/typescript/select/types.d.ts +4 -0
  85. package/lib/typescript/select/types.d.ts.map +1 -1
  86. package/package.json +2 -2
  87. package/src/form-control/createFormError.tsx +32 -0
  88. package/src/form-control/createFormErrorIcon.tsx +9 -0
  89. package/src/form-control/createFormErrorText.tsx +9 -0
  90. package/src/form-control/createFormField.tsx +27 -0
  91. package/src/form-control/createFormHelper.tsx +28 -0
  92. package/src/form-control/createFormHelperText.tsx +9 -0
  93. package/src/form-control/createFormLabel.tsx +30 -0
  94. package/src/form-control/createFormRoot.tsx +13 -0
  95. package/src/form-control/index.tsx +71 -0
  96. package/src/form-control/types.tsx +92 -0
  97. package/src/index.ts +1 -0
  98. package/src/input/createInputField.tsx +8 -2
  99. package/src/select/createSelectRoot.tsx +7 -3
  100. package/src/select/createSelectTrigger.tsx +55 -4
  101. package/src/select/types.ts +4 -0
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const createFormError: <T>(BaseFormError: React.ComponentType<T>) => React.ForwardRefExoticComponent<{
3
+ children?: React.ReactNode;
4
+ } & React.RefAttributes<unknown>>;
5
+ //# sourceMappingURL=createFormError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFormError.d.ts","sourceRoot":"","sources":["../../../src/form-control/createFormError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,eAAe,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;eACtC,KAAK,CAAC,SAAS;iCA2B9C,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type React from 'react';
2
+ export declare const createFormErrorIcon: <T>(BaseFormErrorIcon: React.ComponentType<T>) => React.ForwardRefExoticComponent<{
3
+ children?: React.ReactNode;
4
+ } & React.RefAttributes<unknown>>;
5
+ //# sourceMappingURL=createFormErrorIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFormErrorIcon.d.ts","sourceRoot":"","sources":["../../../src/form-control/createFormErrorIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAG,mBAAmB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;eAC9C,KAAK,CAAC,SAAS;iCAI9C,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type React from 'react';
2
+ export declare const createFormErrorText: <T>(BaseFormErrorText: React.ComponentType<T>) => React.ForwardRefExoticComponent<{
3
+ children?: React.ReactNode;
4
+ } & React.RefAttributes<unknown>>;
5
+ //# sourceMappingURL=createFormErrorText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFormErrorText.d.ts","sourceRoot":"","sources":["../../../src/form-control/createFormErrorText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAG,mBAAmB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;eAC9C,KAAK,CAAC,SAAS;iCAI9C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { IFormFieldProps } from './types';
3
+ export declare const createFormField: <T>(BaseFormField: React.ComponentType<T>) => React.ForwardRefExoticComponent<IFormFieldProps & {
4
+ children?: React.ReactNode;
5
+ } & React.RefAttributes<unknown>>;
6
+ //# sourceMappingURL=createFormField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFormField.d.ts","sourceRoot":"","sources":["../../../src/form-control/createFormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,eAAe,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;eAEb,KAAK,CAAC,SAAS;iCAmBxE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const createFormHelper: <T>(BaseFormHelper: React.ComponentType<T>) => React.ForwardRefExoticComponent<{
3
+ children?: React.ReactNode;
4
+ } & React.RefAttributes<unknown>>;
5
+ //# sourceMappingURL=createFormHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFormHelper.d.ts","sourceRoot":"","sources":["../../../src/form-control/createFormHelper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,gBAAgB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;eACxC,KAAK,CAAC,SAAS;iCAuB9C,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type React from 'react';
2
+ export declare const createFormHelperText: <T>(BaseFormHelperText: React.ComponentType<T>) => React.ForwardRefExoticComponent<{
3
+ children?: React.ReactNode;
4
+ } & React.RefAttributes<unknown>>;
5
+ //# sourceMappingURL=createFormHelperText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFormHelperText.d.ts","sourceRoot":"","sources":["../../../src/form-control/createFormHelperText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAG,oBAAoB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;eAChD,KAAK,CAAC,SAAS;iCAI9C,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type React from 'react';
2
+ import type { IFormLabelProps } from './types';
3
+ export declare const createFormLabel: <T>({ Label: BaseFormLabel }: {
4
+ Label: React.ComponentType<T>;
5
+ }) => React.ForwardRefExoticComponent<IFormLabelProps & {
6
+ children?: React.ReactNode;
7
+ } & React.RefAttributes<unknown>>;
8
+ //# sourceMappingURL=createFormLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFormLabel.d.ts","sourceRoot":"","sources":["../../../src/form-control/createFormLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,0BAA0B;IAAE,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;CAAE;eAC1C,KAAK,CAAC,SAAS;iCAsBjE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { IFormProps } from './types';
3
+ export declare const createFormRoot: <T>(BaseFormRoot: React.ComponentType<T>) => React.ForwardRefExoticComponent<IFormProps & {
4
+ children?: React.ReactNode;
5
+ } & React.RefAttributes<unknown>>;
6
+ //# sourceMappingURL=createFormRoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFormRoot.d.ts","sourceRoot":"","sources":["../../../src/form-control/createFormRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,cAAc,GAAI,CAAC,EAAG,cAAc,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;eAEhB,KAAK,CAAC,SAAS;iCAKnE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type React from 'react';
2
+ import type { IFormComponentType } from './types';
3
+ export type { IFormProps, IFormFieldProps, IFormLabelProps, IFormHelperProps, IFormHelperTextProps, IFormErrorProps, IFormErrorTextProps, IFormErrorIconProps, IFormComponentType, } from './types';
4
+ export declare function createForm<Root, Field, Error, ErrorText, ErrorIcon, Label, Helper, HelperText>({ Root, Field, Error, ErrorText, ErrorIcon, Label, Helper, HelperText, }: {
5
+ Root: React.ComponentType<Root>;
6
+ Field: React.ComponentType<Field>;
7
+ Error: React.ComponentType<Error>;
8
+ ErrorText: React.ComponentType<ErrorText>;
9
+ ErrorIcon: React.ComponentType<ErrorIcon>;
10
+ Label: React.ComponentType<Label>;
11
+ Helper: React.ComponentType<Helper>;
12
+ HelperText: React.ComponentType<HelperText>;
13
+ }): IFormComponentType<Root, Field, Error, ErrorText, ErrorIcon, Label, Helper, HelperText>;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/form-control/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,YAAY,EACV,UAAU,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAC9F,IAAI,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,KAAK,EACL,MAAM,EACN,UAAU,GACX,EAAE;IACD,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC1C,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC1C,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;CAC7C,GA4BO,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAC9F"}
@@ -0,0 +1,73 @@
1
+ import type React from 'react';
2
+ import type { TextProps, ViewProps } from 'react-native';
3
+ /**
4
+ * Props for the Form container (`<form>` on web, `<View>` on RN).
5
+ * Does NOT provide field-level context — use `Form.Field` for that.
6
+ *
7
+ * Web-only submit props (`onSubmit`, `action`, `method`) belong in the
8
+ * platform-specific base component (`FormRoot.web.tsx`), not here.
9
+ */
10
+ export interface IFormProps {
11
+ }
12
+ /**
13
+ * Props for a single form field (`Form.Field`).
14
+ * Provides field-level context (name, validation state, ids) to children.
15
+ *
16
+ * **Initial focus:** use `autoFocus` on `Input.Field` (or your control). `TextInput` / DOM
17
+ * inputs support it natively. Do not rely on `Form.Field` for autofocus — it does not forward
18
+ * to a single child.
19
+ *
20
+ * **Submit UX:** "focus first invalid on error" needs form-level validation state; not built in yet.
21
+ */
22
+ export interface IFormFieldProps extends ViewProps {
23
+ /** Unique id for this field. Auto-generated if not provided. */
24
+ readonly id?: string;
25
+ /**
26
+ * Field name for form submission. Passed through context so child inputs
27
+ * automatically receive it as their `name` attribute for `FormData` support.
28
+ */
29
+ readonly name?: string;
30
+ /** If true, the field is marked as invalid. Controls error visibility. */
31
+ readonly isInvalid?: boolean;
32
+ /** If true, the field is marked as required. Shows asterisk on label. */
33
+ readonly isRequired?: boolean;
34
+ /** If true, the field is disabled. */
35
+ readonly isDisabled?: boolean;
36
+ /** If true, the field is read-only. */
37
+ readonly isReadOnly?: boolean;
38
+ }
39
+ export interface IFormLabelProps extends TextProps {
40
+ /**
41
+ * Associates the label with a control `id` on web (`<label htmlFor>`).
42
+ * If omitted, defaults to the same id `Input.Field` gets from form context: `fieldId + "-input"`.
43
+ */
44
+ readonly htmlFor?: string;
45
+ /**
46
+ * Element to render after the label text when the field is required.
47
+ * Rendered by the primitive (which owns the form-control context) so the
48
+ * styled layer never needs to read `FormControlContext` across packages.
49
+ */
50
+ readonly requiredIndicator?: React.ReactNode;
51
+ }
52
+ export interface IFormHelperProps extends ViewProps {
53
+ }
54
+ export interface IFormHelperTextProps extends TextProps {
55
+ }
56
+ export interface IFormErrorProps extends ViewProps {
57
+ }
58
+ export interface IFormErrorTextProps extends TextProps {
59
+ }
60
+ export interface IFormErrorIconProps extends ViewProps {
61
+ }
62
+ export type IFormComponentType<Root, Field, Error, ErrorText, ErrorIcon, Label, Helper, HelperText> = React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<Root> & IFormProps> & {
63
+ Field: React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<Field> & IFormFieldProps>;
64
+ Label: React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<Label> & IFormLabelProps>;
65
+ Helper: React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<Helper> & IFormHelperProps>;
66
+ HelperText: React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<HelperText> & IFormHelperTextProps>;
67
+ Error: React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<Error> & IFormErrorProps>;
68
+ ErrorText: React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<ErrorText> & IFormErrorTextProps>;
69
+ ErrorIcon: React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<ErrorIcon> & IFormErrorIconProps>;
70
+ };
71
+ type InnerForwardRefExoticComponent<T> = React.PropsWithoutRef<T> & React.RefAttributes<unknown>;
72
+ export {};
73
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/form-control/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;CAAG;AAE9B;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,gEAAgE;IAChE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,sCAAsC;IACtC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,uCAAuC;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,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e,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC"}
@@ -2,6 +2,7 @@ export * from './avatar';
2
2
  export * from './button';
3
3
  export * from './checkbox';
4
4
  export * from './dialog';
5
+ export * from './form-control';
5
6
  export * from './input';
6
7
  export * from './link';
7
8
  export { type EdgeInsets, OverlayInsetsProvider } from './overlay';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,KAAK,UAAU,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACnE,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,KAAK,UAAU,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACnE,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createInputField.d.ts","sourceRoot":"","sources":["../../../src/input/createInputField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,gBAAgB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,gFA8FxE,CAAC"}
1
+ {"version":3,"file":"createInputField.d.ts","sourceRoot":"","sources":["../../../src/input/createInputField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,gBAAgB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,gFAoGxE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createSelectRoot.d.ts","sourceRoot":"","sources":["../../../src/select/createSelectRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,UAAU,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,iFA0HlE,CAAC"}
1
+ {"version":3,"file":"createSelectRoot.d.ts","sourceRoot":"","sources":["../../../src/select/createSelectRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,UAAU,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,iFA8HlE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createSelectTrigger.d.ts","sourceRoot":"","sources":["../../../src/select/createSelectTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAG,aAAa,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;eAYxD,CAAC,CAAC,KAAK,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS;iCA+IhF,CAAC"}
1
+ {"version":3,"file":"createSelectTrigger.d.ts","sourceRoot":"","sources":["../../../src/select/createSelectTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAG,aAAa,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;eAaxD,CAAC,CAAC,KAAK,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS;iCAiMhF,CAAC"}
@@ -28,6 +28,8 @@ export interface ISelectTriggerProps extends PressableProps {
28
28
  isFocused?: boolean;
29
29
  isFocusVisible?: boolean;
30
30
  isDisabled?: boolean;
31
+ /** @platform web — merged with form field helper/error ids */
32
+ 'aria-describedby'?: string;
31
33
  }
32
34
  export interface ISelectValueProps {
33
35
  placeholder?: string;
@@ -78,6 +80,8 @@ export interface SelectContextValue {
78
80
  activeValue: string | undefined;
79
81
  setActiveValue: (value: string | undefined) => void;
80
82
  accessibilityLabel: string | undefined;
83
+ /** From `Form.Field` via `useFormControl` on the select root (helper/error `aria-describedby`). */
84
+ ariaDescribedBy?: string;
81
85
  }
82
86
  export type ISelectComponentType<RootProps, TriggerProps, ValueProps, IconProps, ContentProps, ItemProps, ItemLabelProps, TriggerRef = unknown, ValueRef = unknown> = React.ForwardRefExoticComponent<PropsWithoutRef<RootProps & ISelectProps> & RefAttributes<unknown>> & {
83
87
  Trigger: React.ForwardRefExoticComponent<PropsWithoutRef<TriggerProps & ISelectTriggerProps> & RefAttributes<TriggerRef>>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,WAAW,0BAA2B,SAAQ,gBAAgB;IAClE,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;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CAAC,OAAO,CAAC,CACnE,GAAG;IACF,OAAO,EAAE,KAAK,CAAC,yBAAyB,CACtC,eAAe,CAAC,YAAY,GAAG,mBAAmB,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,CAChF,CAAC;IACF,KAAK,EAAE,KAAK,CAAC,yBAAyB,CACpC,eAAe,CAAC,UAAU,GAAG,iBAAiB,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,CAC1E,CAAC;IACF,IAAI,EAAE,KAAK,CAAC,yBAAyB,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3F,OAAO,EAAE,KAAK,CAAC,yBAAyB,CACtC,eAAe,CAAC,YAAY,GAAG,mBAAmB,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CAC7E,CAAC;IACF,IAAI,EAAE,KAAK,CAAC,yBAAyB,CACnC,eAAe,CAAC,SAAS,GAAG,gBAAgB,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CACvE,CAAC;IACF,SAAS,EAAE,KAAK,CAAC,yBAAyB,CACxC,eAAe,CAAC,cAAc,GAAG,qBAAqB,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CACjF,CAAC;CACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdx-ui/primitives",
3
- "version": "0.0.1-alpha.29",
3
+ "version": "0.0.1-alpha.30",
4
4
  "main": "lib/commonjs/index.js",
5
5
  "module": "lib/module/index.js",
6
6
  "react-native": "src/index.ts",
@@ -52,7 +52,7 @@
52
52
  "@react-native-aria/interactions": "^0.2.16",
53
53
  "@react-stately/checkbox": "3.7.4",
54
54
  "@react-stately/toggle": "3.9.4",
55
- "@cdx-ui/utils": "0.0.1-alpha.29"
55
+ "@cdx-ui/utils": "0.0.1-alpha.30"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/react": "*",
@@ -0,0 +1,32 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { useFormControlContext } from '@cdx-ui/utils';
3
+
4
+ export const createFormError = <T,>(BaseFormError: React.ComponentType<T>) =>
5
+ forwardRef<unknown, { children?: React.ReactNode }>(({ children, ...props }, ref) => {
6
+ const { isInvalid, feedbackId, setHasFeedbackText } = useFormControlContext();
7
+
8
+ const visible = Boolean(isInvalid && children);
9
+
10
+ React.useEffect(() => {
11
+ if (!visible) {
12
+ setHasFeedbackText?.(false);
13
+ return undefined;
14
+ }
15
+ setHasFeedbackText?.(true);
16
+ return () => {
17
+ setHasFeedbackText?.(false);
18
+ };
19
+ }, [setHasFeedbackText, visible]);
20
+
21
+ return visible ? (
22
+ <BaseFormError
23
+ ref={ref}
24
+ {...(props as T)}
25
+ id={feedbackId}
26
+ accessibilityRole="alert"
27
+ accessibilityLiveRegion="assertive"
28
+ >
29
+ {children}
30
+ </BaseFormError>
31
+ ) : null;
32
+ });
@@ -0,0 +1,9 @@
1
+ import type React from 'react';
2
+ import { forwardRef } from 'react';
3
+
4
+ export const createFormErrorIcon = <T,>(BaseFormErrorIcon: React.ComponentType<T>) =>
5
+ forwardRef<unknown, { children?: React.ReactNode }>(({ children, ...props }, ref) => (
6
+ <BaseFormErrorIcon ref={ref} {...(props as T)}>
7
+ {children}
8
+ </BaseFormErrorIcon>
9
+ ));
@@ -0,0 +1,9 @@
1
+ import type React from 'react';
2
+ import { forwardRef } from 'react';
3
+
4
+ export const createFormErrorText = <T,>(BaseFormErrorText: React.ComponentType<T>) =>
5
+ forwardRef<unknown, { children?: React.ReactNode }>(({ children, ...props }, ref) => (
6
+ <BaseFormErrorText ref={ref} {...(props as T)}>
7
+ {children}
8
+ </BaseFormErrorText>
9
+ ));
@@ -0,0 +1,27 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { useFormControlRoot, FormControlContext } from '@cdx-ui/utils';
3
+ import { dataAttributes } from '../utils/dataAttributes';
4
+ import type { IFormFieldProps } from './types';
5
+
6
+ export const createFormField = <T,>(BaseFormField: React.ComponentType<T>) =>
7
+ forwardRef(
8
+ ({ children, ...props }: IFormFieldProps & { children?: React.ReactNode }, ref?: unknown) => {
9
+ const { htmlProps, ...context } = useFormControlRoot(props);
10
+
11
+ return (
12
+ <FormControlContext.Provider value={context}>
13
+ <BaseFormField
14
+ ref={ref}
15
+ {...(htmlProps as T)}
16
+ {...dataAttributes({
17
+ disabled: context.isDisabled,
18
+ invalid: context.isInvalid,
19
+ required: context.isRequired,
20
+ })}
21
+ >
22
+ {children}
23
+ </BaseFormField>
24
+ </FormControlContext.Provider>
25
+ );
26
+ },
27
+ );
@@ -0,0 +1,28 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { useFormControlContext } from '@cdx-ui/utils';
3
+
4
+ export const createFormHelper = <T,>(BaseFormHelper: React.ComponentType<T>) =>
5
+ forwardRef<unknown, { children?: React.ReactNode }>(({ children, ...props }, ref) => {
6
+ const { helpTextId, setHasHelpText, isInvalid } = useFormControlContext();
7
+
8
+ React.useEffect(() => {
9
+ if (isInvalid) {
10
+ setHasHelpText?.(false);
11
+ return undefined;
12
+ }
13
+ setHasHelpText?.(true);
14
+ return () => {
15
+ setHasHelpText?.(false);
16
+ };
17
+ }, [setHasHelpText, isInvalid]);
18
+
19
+ if (isInvalid) {
20
+ return null;
21
+ }
22
+
23
+ return (
24
+ <BaseFormHelper ref={ref} {...(props as T)} id={helpTextId}>
25
+ {children}
26
+ </BaseFormHelper>
27
+ );
28
+ });
@@ -0,0 +1,9 @@
1
+ import type React from 'react';
2
+ import { forwardRef } from 'react';
3
+
4
+ export const createFormHelperText = <T,>(BaseFormHelperText: React.ComponentType<T>) =>
5
+ forwardRef<unknown, { children?: React.ReactNode }>(({ children, ...props }, ref) => (
6
+ <BaseFormHelperText ref={ref} {...(props as T)}>
7
+ {children}
8
+ </BaseFormHelperText>
9
+ ));
@@ -0,0 +1,30 @@
1
+ import type React from 'react';
2
+ import { forwardRef } from 'react';
3
+ import { useFormControlContext } from '@cdx-ui/utils';
4
+ import { dataAttributes } from '../utils/dataAttributes';
5
+ import type { IFormLabelProps } from './types';
6
+
7
+ export const createFormLabel = <T,>({ Label: BaseFormLabel }: { Label: React.ComponentType<T> }) =>
8
+ forwardRef<unknown, IFormLabelProps & { children?: React.ReactNode }>(
9
+ ({ children, htmlFor: htmlForProp, requiredIndicator, ...props }, ref) => {
10
+ const field = useFormControlContext();
11
+ const fieldId = field.id;
12
+ const labelId = field.labelId;
13
+
14
+ /** Must match `useFormControl` default: `props.id ?? \`${field.id}-input\``. */
15
+ const htmlFor = htmlForProp ?? (fieldId ? `${fieldId}-input` : undefined);
16
+
17
+ return (
18
+ <BaseFormLabel
19
+ ref={ref}
20
+ {...(props as T)}
21
+ id={labelId}
22
+ htmlFor={htmlFor}
23
+ {...dataAttributes({ invalid: field.isInvalid, required: field.isRequired })}
24
+ >
25
+ {children}
26
+ {field.isRequired ? requiredIndicator : null}
27
+ </BaseFormLabel>
28
+ );
29
+ },
30
+ );
@@ -0,0 +1,13 @@
1
+ import React, { forwardRef } from 'react';
2
+ import type { IFormProps } from './types';
3
+
4
+ // TODO: Handle web submission (button type submit)
5
+
6
+ export const createFormRoot = <T,>(BaseFormRoot: React.ComponentType<T>) =>
7
+ forwardRef(
8
+ ({ children, ...props }: IFormProps & { children?: React.ReactNode }, ref?: unknown) => (
9
+ <BaseFormRoot ref={ref} {...(props as T)}>
10
+ {children}
11
+ </BaseFormRoot>
12
+ ),
13
+ );
@@ -0,0 +1,71 @@
1
+ import type React from 'react';
2
+ import { createFormError } from './createFormError';
3
+ import { createFormErrorText } from './createFormErrorText';
4
+ import { createFormErrorIcon } from './createFormErrorIcon';
5
+ import { createFormField } from './createFormField';
6
+ import { createFormHelper } from './createFormHelper';
7
+ import { createFormHelperText } from './createFormHelperText';
8
+ import { createFormLabel } from './createFormLabel';
9
+ import { createFormRoot } from './createFormRoot';
10
+ import type { IFormComponentType } from './types';
11
+
12
+ export type {
13
+ IFormProps,
14
+ IFormFieldProps,
15
+ IFormLabelProps,
16
+ IFormHelperProps,
17
+ IFormHelperTextProps,
18
+ IFormErrorProps,
19
+ IFormErrorTextProps,
20
+ IFormErrorIconProps,
21
+ IFormComponentType,
22
+ } from './types';
23
+
24
+ export function createForm<Root, Field, Error, ErrorText, ErrorIcon, Label, Helper, HelperText>({
25
+ Root,
26
+ Field,
27
+ Error,
28
+ ErrorText,
29
+ ErrorIcon,
30
+ Label,
31
+ Helper,
32
+ HelperText,
33
+ }: {
34
+ Root: React.ComponentType<Root>;
35
+ Field: React.ComponentType<Field>;
36
+ Error: React.ComponentType<Error>;
37
+ ErrorText: React.ComponentType<ErrorText>;
38
+ ErrorIcon: React.ComponentType<ErrorIcon>;
39
+ Label: React.ComponentType<Label>;
40
+ Helper: React.ComponentType<Helper>;
41
+ HelperText: React.ComponentType<HelperText>;
42
+ }) {
43
+ const FormRoot = createFormRoot(Root);
44
+ FormRoot.displayName = 'FormPrimitive';
45
+
46
+ const FormField = createFormField(Field);
47
+ FormField.displayName = 'FormPrimitive.Field';
48
+ const FormLabel = createFormLabel({ Label });
49
+ const FormHelper = createFormHelper(Helper);
50
+ const FormHelperText = createFormHelperText(HelperText);
51
+ const FormError = createFormError(Error);
52
+ const FormErrorText = createFormErrorText(ErrorText);
53
+ const FormErrorIcon = createFormErrorIcon(ErrorIcon);
54
+
55
+ FormLabel.displayName = 'FormPrimitive.Label';
56
+ FormHelper.displayName = 'FormPrimitive.Helper';
57
+ FormHelperText.displayName = 'FormPrimitive.HelperText';
58
+ FormError.displayName = 'FormPrimitive.Error';
59
+ FormErrorText.displayName = 'FormPrimitive.ErrorText';
60
+ FormErrorIcon.displayName = 'FormPrimitive.ErrorIcon';
61
+
62
+ return Object.assign(FormRoot, {
63
+ Field: FormField,
64
+ Label: FormLabel,
65
+ Helper: FormHelper,
66
+ HelperText: FormHelperText,
67
+ Error: FormError,
68
+ ErrorText: FormErrorText,
69
+ ErrorIcon: FormErrorIcon,
70
+ }) as IFormComponentType<Root, Field, Error, ErrorText, ErrorIcon, Label, Helper, HelperText>;
71
+ }
@@ -0,0 +1,92 @@
1
+ import type React from 'react';
2
+ import type { TextProps, ViewProps } from 'react-native';
3
+
4
+ /**
5
+ * Props for the Form container (`<form>` on web, `<View>` on RN).
6
+ * Does NOT provide field-level context — use `Form.Field` for that.
7
+ *
8
+ * Web-only submit props (`onSubmit`, `action`, `method`) belong in the
9
+ * platform-specific base component (`FormRoot.web.tsx`), not here.
10
+ */
11
+ export interface IFormProps {}
12
+
13
+ /**
14
+ * Props for a single form field (`Form.Field`).
15
+ * Provides field-level context (name, validation state, ids) to children.
16
+ *
17
+ * **Initial focus:** use `autoFocus` on `Input.Field` (or your control). `TextInput` / DOM
18
+ * inputs support it natively. Do not rely on `Form.Field` for autofocus — it does not forward
19
+ * to a single child.
20
+ *
21
+ * **Submit UX:** "focus first invalid on error" needs form-level validation state; not built in yet.
22
+ */
23
+ export interface IFormFieldProps extends ViewProps {
24
+ /** Unique id for this field. Auto-generated if not provided. */
25
+ readonly id?: string;
26
+ /**
27
+ * Field name for form submission. Passed through context so child inputs
28
+ * automatically receive it as their `name` attribute for `FormData` support.
29
+ */
30
+ readonly name?: string;
31
+ /** If true, the field is marked as invalid. Controls error visibility. */
32
+ readonly isInvalid?: boolean;
33
+ /** If true, the field is marked as required. Shows asterisk on label. */
34
+ readonly isRequired?: boolean;
35
+ /** If true, the field is disabled. */
36
+ readonly isDisabled?: boolean;
37
+ /** If true, the field is read-only. */
38
+ readonly isReadOnly?: boolean;
39
+ }
40
+
41
+ export interface IFormLabelProps extends TextProps {
42
+ /**
43
+ * Associates the label with a control `id` on web (`<label htmlFor>`).
44
+ * If omitted, defaults to the same id `Input.Field` gets from form context: `fieldId + "-input"`.
45
+ */
46
+ readonly htmlFor?: string;
47
+ /**
48
+ * Element to render after the label text when the field is required.
49
+ * Rendered by the primitive (which owns the form-control context) so the
50
+ * styled layer never needs to read `FormControlContext` across packages.
51
+ */
52
+ readonly requiredIndicator?: React.ReactNode;
53
+ }
54
+
55
+ export interface IFormHelperProps extends ViewProps {}
56
+
57
+ export interface IFormHelperTextProps extends TextProps {}
58
+
59
+ export interface IFormErrorProps extends ViewProps {}
60
+
61
+ export interface IFormErrorTextProps extends TextProps {}
62
+
63
+ export interface IFormErrorIconProps extends ViewProps {}
64
+
65
+ export type IFormComponentType<
66
+ Root,
67
+ Field,
68
+ Error,
69
+ ErrorText,
70
+ ErrorIcon,
71
+ Label,
72
+ Helper,
73
+ HelperText,
74
+ > = React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<Root> & IFormProps> & {
75
+ Field: React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<Field> & IFormFieldProps>;
76
+ Label: React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<Label> & IFormLabelProps>;
77
+ Helper: React.ForwardRefExoticComponent<
78
+ InnerForwardRefExoticComponent<Helper> & IFormHelperProps
79
+ >;
80
+ HelperText: React.ForwardRefExoticComponent<
81
+ InnerForwardRefExoticComponent<HelperText> & IFormHelperTextProps
82
+ >;
83
+ Error: React.ForwardRefExoticComponent<InnerForwardRefExoticComponent<Error> & IFormErrorProps>;
84
+ ErrorText: React.ForwardRefExoticComponent<
85
+ InnerForwardRefExoticComponent<ErrorText> & IFormErrorTextProps
86
+ >;
87
+ ErrorIcon: React.ForwardRefExoticComponent<
88
+ InnerForwardRefExoticComponent<ErrorIcon> & IFormErrorIconProps
89
+ >;
90
+ };
91
+
92
+ type InnerForwardRefExoticComponent<T> = React.PropsWithoutRef<T> & React.RefAttributes<unknown>;
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from './avatar';
2
2
  export * from './button';
3
3
  export * from './checkbox';
4
4
  export * from './dialog';
5
+ export * from './form-control';
5
6
  export * from './input';
6
7
  export * from './link';
7
8
  export { type EdgeInsets, OverlayInsetsProvider } from './overlay';