@startupjs-ui/object-input 0.1.12 → 0.1.16
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/CHANGELOG.md +16 -0
- package/README.mdx +15 -11
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.1.16](https://github.com/startupjs/startupjs-ui/compare/v0.1.15...v0.1.16) (2026-02-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/object-input
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.1.13](https://github.com/startupjs/startupjs-ui/compare/v0.1.12...v0.1.13) (2026-02-03)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @startupjs-ui/object-input
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.1.12](https://github.com/startupjs/startupjs-ui/compare/v0.1.11...v0.1.12) (2026-01-21)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @startupjs-ui/object-input
|
package/README.mdx
CHANGED
|
@@ -5,11 +5,11 @@ import { Sandbox } from '@startupjs-ui/docs'
|
|
|
5
5
|
|
|
6
6
|
# ObjectInput
|
|
7
7
|
|
|
8
|
-
ObjectInput lets you build dynamic forms using
|
|
8
|
+
ObjectInput lets you build dynamic forms using a declarative API. Define your form fields in the `properties` prop as an object where each key maps to an input configuration with a required `input` key specifying the input type.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Available input types: [array](/docs/forms/Array), [checkbox](/docs/forms/Checkbox), [date](/docs/forms/DateTimePicker), [datetime](/docs/forms/DateTimePicker), [multiselect](/docs/forms/Multiselect), [number](/docs/forms/NumberInput), [object](/docs/forms/ObjectInput), [password](/docs/forms/PasswordInput), [radio](/docs/forms/Radio), [select](/docs/forms/Select), [time](/docs/forms/DateTimePicker), [text](/docs/forms/TextInput).
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
The component requires a `$value` prop for two-way data binding. It also accepts `style` for the outer wrapper, `inputStyle` for the inner input container, `disabled` to prevent interaction, and `readonly` for a non-editable display.
|
|
13
13
|
|
|
14
14
|
```jsx
|
|
15
15
|
import { ObjectInput } from 'startupjs-ui'
|
|
@@ -17,7 +17,7 @@ import { ObjectInput } from 'startupjs-ui'
|
|
|
17
17
|
|
|
18
18
|
## Simple example
|
|
19
19
|
|
|
20
|
-
It
|
|
20
|
+
It is important to define the `properties` object as a constant outside of your component or cache it with `useMemo()`. Otherwise, the entire form tree will re-render whenever you edit any field.
|
|
21
21
|
|
|
22
22
|
```jsx example
|
|
23
23
|
const $value = $()
|
|
@@ -70,7 +70,7 @@ return (
|
|
|
70
70
|
|
|
71
71
|
## Inputs order
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
Pass an `order` array to control the order in which inputs are displayed.
|
|
74
74
|
|
|
75
75
|
```jsx example
|
|
76
76
|
const $value = $()
|
|
@@ -96,7 +96,7 @@ return (
|
|
|
96
96
|
|
|
97
97
|
## Displaying errors
|
|
98
98
|
|
|
99
|
-
The `errors`
|
|
99
|
+
The `errors` prop accepts an object mapping property names to error messages. Each key should match a key from the `properties` object.
|
|
100
100
|
|
|
101
101
|
```jsx example
|
|
102
102
|
const $value = $()
|
|
@@ -125,6 +125,8 @@ return (
|
|
|
125
125
|
|
|
126
126
|
## Disabled
|
|
127
127
|
|
|
128
|
+
When the `disabled` prop is set, all inputs in the form become non-interactive.
|
|
129
|
+
|
|
128
130
|
```jsx example
|
|
129
131
|
const $value = $()
|
|
130
132
|
|
|
@@ -149,6 +151,8 @@ return (
|
|
|
149
151
|
|
|
150
152
|
## Readonly
|
|
151
153
|
|
|
154
|
+
When the `readonly` prop is set, all inputs display their values as non-editable text.
|
|
155
|
+
|
|
152
156
|
```jsx example
|
|
153
157
|
const $value = $({ email: 'startupjs@gmail.com', password: '123456' })
|
|
154
158
|
|
|
@@ -173,14 +177,14 @@ return (
|
|
|
173
177
|
|
|
174
178
|
## Advanced usage
|
|
175
179
|
|
|
176
|
-
ObjectInput supports `dependsOn` and `dependsValue`
|
|
180
|
+
ObjectInput supports `dependsOn` and `dependsValue` fields within each input configuration in `properties` to conditionally display inputs.
|
|
177
181
|
|
|
178
|
-
- `dependsOn`
|
|
179
|
-
- `dependsValue`
|
|
182
|
+
- `dependsOn` specifies the property key that the current input depends on.
|
|
183
|
+
- `dependsValue` specifies the value of the `dependsOn` field at which the current input should be shown. If `dependsValue` is omitted, the input is shown whenever the dependency has any non-empty value.
|
|
180
184
|
|
|
181
|
-
In the example below the
|
|
185
|
+
In the example below, the `password` input only appears when the `email` input is not empty.
|
|
182
186
|
|
|
183
|
-
**Caution**: When the `dependsOn` field changes and dependent field is no longer visible its previous value is preserved.
|
|
187
|
+
**Caution**: When the `dependsOn` field changes and the dependent field is no longer visible, its previous value is preserved.
|
|
184
188
|
|
|
185
189
|
```jsx example
|
|
186
190
|
const $value = $()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/object-input",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@startupjs-ui/core": "^0.1.11",
|
|
12
|
-
"@startupjs-ui/div": "^0.1.
|
|
13
|
-
"@startupjs-ui/input": "^0.1.
|
|
12
|
+
"@startupjs-ui/div": "^0.1.16",
|
|
13
|
+
"@startupjs-ui/input": "^0.1.16"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": "*",
|
|
17
17
|
"react-native": "*",
|
|
18
18
|
"startupjs": "*"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "9943aa3566d5d80f5b404473906eb3c0611f9ee5"
|
|
21
21
|
}
|