@impulse-ui-native/form-field 15.0.5 → 17.0.0
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 +47 -47
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
# @impulse-ui-native/form-field
|
|
2
|
-
|
|
3
|
-
Label, description, required-state, and validation composition for custom Impulse UI Native controls.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
pnpm add @impulse-ui-native/form-field
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Render `FormField` inside `ThemeProvider` from `@impulse-ui-native/theme`.
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```tsx
|
|
16
|
-
import { FormField } from "@impulse-ui-native/form-field";
|
|
17
|
-
import { Switch } from "@impulse-ui-native/switch";
|
|
18
|
-
|
|
19
|
-
<FormField
|
|
20
|
-
label="Notifications"
|
|
21
|
-
description="Receive updates about your account."
|
|
22
|
-
required
|
|
23
|
-
error={notificationError}
|
|
24
|
-
>
|
|
25
|
-
{({ controlProps }) => (
|
|
26
|
-
<Switch
|
|
27
|
-
{...controlProps}
|
|
28
|
-
checked={notificationsEnabled}
|
|
29
|
-
onCheckedChange={setNotificationsEnabled}
|
|
30
|
-
/>
|
|
31
|
-
)}
|
|
32
|
-
</FormField>;
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
The render function receives:
|
|
36
|
-
|
|
37
|
-
- `controlProps`: the generated native ID and disabled state to spread onto the control;
|
|
38
|
-
- `invalid`: whether the field currently has an error;
|
|
39
|
-
- `required`: the field's required state for custom visual treatment.
|
|
40
|
-
|
|
41
|
-
`FormField` renders validation feedback once outside the custom control. Use `invalid` only to map the field state into a control's own visual API; do not render the error a second time inside the control.
|
|
42
|
-
|
|
43
|
-
An explicit `nativeID` can be provided when stable IDs are required; otherwise, `FormField` generates one with React `useId`.
|
|
44
|
-
|
|
45
|
-
## Agent and design reference
|
|
46
|
-
|
|
47
|
-
Start with the [capability guide](../../docs/design-system/capabilities/form-field.md) for supported exports, props, defaults, composition rules, setup, and recipes. Use the [component chooser](../../docs/design-system/component-chooser.md) to select a package. These references describe the repository source; verify your installed package version before copying examples.
|
|
1
|
+
# @impulse-ui-native/form-field
|
|
2
|
+
|
|
3
|
+
Label, description, required-state, and validation composition for custom Impulse UI Native controls.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @impulse-ui-native/form-field
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Render `FormField` inside `ThemeProvider` from `@impulse-ui-native/theme`.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { FormField } from "@impulse-ui-native/form-field";
|
|
17
|
+
import { Switch } from "@impulse-ui-native/switch";
|
|
18
|
+
|
|
19
|
+
<FormField
|
|
20
|
+
label="Notifications"
|
|
21
|
+
description="Receive updates about your account."
|
|
22
|
+
required
|
|
23
|
+
error={notificationError}
|
|
24
|
+
>
|
|
25
|
+
{({ controlProps }) => (
|
|
26
|
+
<Switch
|
|
27
|
+
{...controlProps}
|
|
28
|
+
checked={notificationsEnabled}
|
|
29
|
+
onCheckedChange={setNotificationsEnabled}
|
|
30
|
+
/>
|
|
31
|
+
)}
|
|
32
|
+
</FormField>;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The render function receives:
|
|
36
|
+
|
|
37
|
+
- `controlProps`: the generated native ID and disabled state to spread onto the control;
|
|
38
|
+
- `invalid`: whether the field currently has an error;
|
|
39
|
+
- `required`: the field's required state for custom visual treatment.
|
|
40
|
+
|
|
41
|
+
`FormField` renders validation feedback once outside the custom control. Use `invalid` only to map the field state into a control's own visual API; do not render the error a second time inside the control.
|
|
42
|
+
|
|
43
|
+
An explicit `nativeID` can be provided when stable IDs are required; otherwise, `FormField` generates one with React `useId`.
|
|
44
|
+
|
|
45
|
+
## Agent and design reference
|
|
46
|
+
|
|
47
|
+
Start with the [capability guide](../../docs/design-system/capabilities/form-field.md) for supported exports, props, defaults, composition rules, setup, and recipes. Use the [component chooser](../../docs/design-system/component-chooser.md) to select a package. These references describe the repository source; verify your installed package version before copying examples.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impulse-ui-native/form-field",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"description": "Form-field composition for Impulse UI Native controls.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
],
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@impulse-ui-native/primitives": "
|
|
32
|
-
"@impulse-ui-native/theme": "
|
|
31
|
+
"@impulse-ui-native/primitives": "17.0.0",
|
|
32
|
+
"@impulse-ui-native/theme": "17.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@impulse-ui-native/prettier-config": "1.0.0",
|