@sio-group/form-react 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +14 -46
- package/dist/index.cjs +187 -322
- package/dist/index.d.cts +2 -98
- package/dist/index.d.ts +2 -98
- package/dist/index.js +170 -293
- package/dist/styles/index.css +0 -287
- package/dist/styles/index.css.map +1 -1
- package/package.json +3 -2
- package/src/assets/scss/index.scss +0 -3
- package/src/components/Fields/Input/DateInput/index.tsx +1 -1
- package/src/components/Fields/Input/FileInput/index.tsx +1 -1
- package/src/components/Fields/Input/NumberInput/index.tsx +1 -1
- package/src/components/Fields/InputWrapper/index.tsx +1 -1
- package/src/components/Form.tsx +3 -3
- package/src/index.ts +0 -4
- package/src/types/form-config.d.ts +1 -1
- package/src/types/index.ts +0 -1
- package/dist/styles/components/button.css +0 -244
- package/dist/styles/components/button.css.map +0 -1
- package/dist/styles/components/link.css +0 -113
- package/dist/styles/components/link.css.map +0 -1
- package/src/assets/scss/components/button.scss +0 -164
- package/src/assets/scss/components/link.scss +0 -66
- package/src/components/Button/index.tsx +0 -106
- package/src/components/Link/index.tsx +0 -106
- package/src/types/ui-props.d.ts +0 -33
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,11 +4,6 @@
|
|
|
4
4
|

|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
<!--
|
|
8
|
-
[](https://www.npmjs.com/package/@sio-group/form-validation)
|
|
9
|
-
[](https://www.npmjs.com/package/@sio-group/form-validation)
|
|
10
|
-
-->
|
|
11
|
-
|
|
12
7
|
A powerful, type-safe React form framework. This package provides ready-to-use form components with built-in validation, layout management, and extensive customization options. This package is designed to work seamlessly with `@sio-group/form-builder` and `@sio-group/form-validation`, but can be used independently.
|
|
13
8
|
|
|
14
9
|
Part of the SIO Form ecosystem, it consumes form definitions from `@sio-group/form-builder` and renders them with full type safety and accessibility in mind.
|
|
@@ -187,7 +182,7 @@ const layout = [
|
|
|
187
182
|
|
|
188
183
|
### Button Configuration
|
|
189
184
|
|
|
190
|
-
Buttons can be configured as an array
|
|
185
|
+
Buttons can be configured as an array using the props from `@sio-group/ui-core`.
|
|
191
186
|
|
|
192
187
|
```tsx
|
|
193
188
|
const buttons = [
|
|
@@ -207,7 +202,6 @@ const buttons = [
|
|
|
207
202
|
},
|
|
208
203
|
{
|
|
209
204
|
type: 'link',
|
|
210
|
-
variant: 'link',
|
|
211
205
|
color: 'info',
|
|
212
206
|
label: 'Help',
|
|
213
207
|
href: '/help'
|
|
@@ -215,15 +209,14 @@ const buttons = [
|
|
|
215
209
|
];
|
|
216
210
|
```
|
|
217
211
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
- `
|
|
221
|
-
- `
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
-
|
|
226
|
-
- `disabled?: boolean`
|
|
212
|
+
Button and link properties are inherited from the UI components:
|
|
213
|
+
|
|
214
|
+
- `Button` from `@sio-group/ui-core`
|
|
215
|
+
- `Link` from `@sio-group/ui-core`
|
|
216
|
+
|
|
217
|
+
Refer to their documentation for all available props.
|
|
218
|
+
|
|
219
|
+
[@sio-group/ui-core](https://github.com/SiO-group/UI-React/tree/main/packages/ui-core)
|
|
227
220
|
|
|
228
221
|
---
|
|
229
222
|
|
|
@@ -489,7 +482,8 @@ All standard HTML input types are supported:
|
|
|
489
482
|
You can use the `useForm` hook to control how you use the form, centrally managing state, validation, and submission. This also demonstrates conditional rendering and error automation.
|
|
490
483
|
|
|
491
484
|
```javascript
|
|
492
|
-
import { useForm, Input
|
|
485
|
+
import { useForm, Input } from '@sio-group/form-react';
|
|
486
|
+
import { Button } from '@sio-group/ui-core';
|
|
493
487
|
|
|
494
488
|
function FormWithHook() {
|
|
495
489
|
const { register, getValue, isValid, isBusy, submit } = useForm();
|
|
@@ -536,7 +530,8 @@ All field components and buttons can also be used independently. You can keep an
|
|
|
536
530
|
|
|
537
531
|
```javascript
|
|
538
532
|
import { useState } from 'react';
|
|
539
|
-
import { Input
|
|
533
|
+
import { Input } from '@sio-group/form-react';
|
|
534
|
+
import { Button } from '@sio-group/ui-core';
|
|
540
535
|
|
|
541
536
|
function SimpleForm() {
|
|
542
537
|
const [value, setValue] = useState('');
|
|
@@ -591,34 +586,6 @@ function SimpleForm() {
|
|
|
591
586
|
}
|
|
592
587
|
```
|
|
593
588
|
|
|
594
|
-
### Button Props
|
|
595
|
-
| Prop | Type | Default | Description |
|
|
596
|
-
|------------|------------------------------------------------------------|-------------|-------------------------|
|
|
597
|
-
| `type` | `'button' \| 'submit' \| 'reset'` | `'button'` | Button type |
|
|
598
|
-
| `label` | `string` | - | Label of the Link |
|
|
599
|
-
| `onClick` | `(e: React.MouseEvent) => void` | - | Custom onClick function |
|
|
600
|
-
| `variant` | `'primary' \| 'secondary' \| 'link'` | `'primary'` | Visual variant |
|
|
601
|
-
| `color` | `'default' \| 'error' \| 'success' \| 'warning' \| 'info'` | `'default'` | Color theme |
|
|
602
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
|
|
603
|
-
| `block` | `boolean` | `false` | Full width |
|
|
604
|
-
| `loading` | `boolean` | `false` | Loading state |
|
|
605
|
-
| `disabled` | `boolean` | `false` | Disabled state |
|
|
606
|
-
|
|
607
|
-
### Link Props
|
|
608
|
-
| Prop | Type | Default | Description |
|
|
609
|
-
|------------|------------------------------------------------------------|-------------|--------------------------|
|
|
610
|
-
| `label` | `string` | - | Label of the Link |
|
|
611
|
-
| `to` | `string` | `'#'` | URL or pad |
|
|
612
|
-
| `onClick` | `(e: React.MouseEvent) => void` | - | Custom onClick function |
|
|
613
|
-
| `color` | `'default' \| 'error' \| 'success' \| 'warning' \| 'info'` | `'default'` | Color theme |
|
|
614
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
|
|
615
|
-
| `block` | `boolean` | `false` | Full width |
|
|
616
|
-
| `loading` | `boolean` | `false` | Loading state |
|
|
617
|
-
| `disabled` | `boolean` | `false` | Disabled state |
|
|
618
|
-
| `navigate` | `() => void` | - | Custom navigate function |
|
|
619
|
-
| `external` | `boolean` | `false` | Force external link |
|
|
620
|
-
|
|
621
|
-
|
|
622
589
|
---
|
|
623
590
|
|
|
624
591
|
## Styling
|
|
@@ -683,6 +650,7 @@ Example with Tailwind CSS:
|
|
|
683
650
|
import { Form } from '@sio-group/form-react';
|
|
684
651
|
import { formBuilder } from '@sio-group/form-builder';
|
|
685
652
|
import '@sio-group/form-react/sio-form-style.css';
|
|
653
|
+
import '@sio-group/ui-core/sio-core-style.css';
|
|
686
654
|
|
|
687
655
|
function RegistrationForm() {
|
|
688
656
|
const fields = formBuilder()
|