@algodomain/smart-forms 0.1.2 → 0.1.4
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/LICENSE +3 -0
- package/README.md +243 -0
- package/dist/{SmartFormProvider-DyJoDBjQ.d.cts → SmartFormProvider-BdyRQakk.d.cts} +1 -0
- package/dist/{SmartFormProvider-DyJoDBjQ.d.ts → SmartFormProvider-BdyRQakk.d.ts} +1 -0
- package/dist/{SmartTags-HmvmCJPT.d.cts → SmartTags-DEpmTDF5.d.cts} +42 -18
- package/dist/{SmartTags-HmvmCJPT.d.ts → SmartTags-DEpmTDF5.d.ts} +42 -18
- package/dist/{chunk-KDPN4CHW.js → chunk-BNQNL7GF.js} +658 -145
- package/dist/chunk-BNQNL7GF.js.map +1 -0
- package/dist/{chunk-5LRBJEZW.js → chunk-RHECLW3K.js} +80 -7
- package/dist/chunk-RHECLW3K.js.map +1 -0
- package/dist/{chunk-CJ55WKPC.cjs → chunk-VGP3HY5Y.cjs} +758 -235
- package/dist/chunk-VGP3HY5Y.cjs.map +1 -0
- package/dist/{chunk-4H5U5IHH.cjs → chunk-WIBCOQPP.cjs} +80 -7
- package/dist/chunk-WIBCOQPP.cjs.map +1 -0
- package/dist/fields.cjs +212 -481
- package/dist/fields.cjs.map +1 -1
- package/dist/fields.d.cts +14 -22
- package/dist/fields.d.ts +14 -22
- package/dist/fields.js +66 -338
- package/dist/fields.js.map +1 -1
- package/dist/index.cjs +42 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/dist/opinionated.cjs +18 -18
- package/dist/opinionated.d.cts +1 -1
- package/dist/opinionated.d.ts +1 -1
- package/dist/opinionated.js +2 -2
- package/package.json +4 -2
- package/dist/chunk-4H5U5IHH.cjs.map +0 -1
- package/dist/chunk-5LRBJEZW.js.map +0 -1
- package/dist/chunk-CJ55WKPC.cjs.map +0 -1
- package/dist/chunk-KDPN4CHW.js.map +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ Built with TypeScript, Tailwind CSS, Zod validation, and shadcn/ui components.
|
|
|
35
35
|
- 🔄 **API Integration** - Automatic form submission with authentication support
|
|
36
36
|
- 🔗 **Query Params** - Include URL query parameters in form submissions
|
|
37
37
|
- 💾 **Auto-Save** - LocalStorage support for draft saving
|
|
38
|
+
- 🎛️ **Conditional Disabling** - Disable fields and submit buttons based on form data
|
|
38
39
|
- 🎨 **Customizable** - Full theme control via CSS variables
|
|
39
40
|
- 🌙 **Dark Mode** - Built-in support for light and dark themes
|
|
40
41
|
- ♿ **Accessible** - Built on Radix UI primitives
|
|
@@ -479,6 +480,7 @@ All form components (`SmartForm`, `MultiTabSmartForm`, `BaseSmartForm`) support
|
|
|
479
480
|
| `authentication` | `AuthenticationConfig` | - | Authentication configuration |
|
|
480
481
|
| `includeQueryParams` | `boolean` | `false` | Include URL query parameters |
|
|
481
482
|
| `queryParamsToInclude` | `string[]` | - | Filter specific query params |
|
|
483
|
+
| `submitDisabled` | `boolean \| ((formData: any) => boolean)` | `false` | Disable submit button statically or conditionally based on form data |
|
|
482
484
|
| `children` | `ReactNode` | - | Form content |
|
|
483
485
|
|
|
484
486
|
### Authentication Configuration
|
|
@@ -522,6 +524,8 @@ All field components support these props:
|
|
|
522
524
|
| `className` | `string` | - | Custom CSS class |
|
|
523
525
|
| `info` | `string` | - | Info tooltip text |
|
|
524
526
|
| `subLabel` | `string` | - | Additional helper text |
|
|
527
|
+
| `disabled` | `boolean \| ((formData: any) => boolean)` | `false` | Disable field statically or conditionally based on form data |
|
|
528
|
+
| `hidden` | `boolean \| ((formData: any) => boolean)` | `false` | Hide field conditionally based on form data |
|
|
525
529
|
|
|
526
530
|
### Field-Specific Props
|
|
527
531
|
|
|
@@ -594,6 +598,237 @@ All field components support these props:
|
|
|
594
598
|
|
|
595
599
|
## 🚀 Advanced Features
|
|
596
600
|
|
|
601
|
+
### Conditional Field Disabling
|
|
602
|
+
|
|
603
|
+
Disable fields or submit buttons based on form data values. Supports both static boolean values and dynamic functions.
|
|
604
|
+
|
|
605
|
+
#### Disable Fields Conditionally
|
|
606
|
+
|
|
607
|
+
**Static Disable:**
|
|
608
|
+
```tsx
|
|
609
|
+
<SmartInput
|
|
610
|
+
field="username"
|
|
611
|
+
label="Username"
|
|
612
|
+
disabled={true}
|
|
613
|
+
/>
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
**Conditional Disable Based on Form Data:**
|
|
617
|
+
```tsx
|
|
618
|
+
<SmartForm api="/api/submit">
|
|
619
|
+
<SmartCombobox
|
|
620
|
+
field="country"
|
|
621
|
+
label="Country"
|
|
622
|
+
options={[
|
|
623
|
+
{ value: 'us', label: 'United States' },
|
|
624
|
+
{ value: 'ca', label: 'Canada' }
|
|
625
|
+
]}
|
|
626
|
+
placeholder="Please select the country"
|
|
627
|
+
/>
|
|
628
|
+
|
|
629
|
+
<SmartCombobox
|
|
630
|
+
field="state"
|
|
631
|
+
label="State"
|
|
632
|
+
options={stateOptions}
|
|
633
|
+
disabled={(formData) => !formData.country || formData.country === ""}
|
|
634
|
+
/>
|
|
635
|
+
|
|
636
|
+
<SmartInput
|
|
637
|
+
field="zipCode"
|
|
638
|
+
label="Zip Code"
|
|
639
|
+
disabled={(formData) => !formData.state}
|
|
640
|
+
/>
|
|
641
|
+
</SmartForm>
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
**How it works:**
|
|
645
|
+
- The `disabled` function receives the current `formData` object
|
|
646
|
+
- It re-evaluates automatically when form data changes
|
|
647
|
+
- Returns `true` to disable, `false` to enable
|
|
648
|
+
- Empty strings, `null`, and `undefined` are all falsy in JavaScript
|
|
649
|
+
|
|
650
|
+
**Example: Disable until checkbox is checked:**
|
|
651
|
+
```tsx
|
|
652
|
+
<SmartForm api="/api/submit">
|
|
653
|
+
<SmartCheckbox
|
|
654
|
+
field="agreeToTerms"
|
|
655
|
+
label="I agree to the terms and conditions"
|
|
656
|
+
/>
|
|
657
|
+
|
|
658
|
+
<SmartInput
|
|
659
|
+
field="comments"
|
|
660
|
+
label="Additional Comments"
|
|
661
|
+
disabled={(formData) => !formData.agreeToTerms}
|
|
662
|
+
/>
|
|
663
|
+
</SmartForm>
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
**Example: Complex conditional logic:**
|
|
667
|
+
```tsx
|
|
668
|
+
<SmartInput
|
|
669
|
+
field="phone"
|
|
670
|
+
label="Phone Number"
|
|
671
|
+
disabled={(formData) => {
|
|
672
|
+
// Disable if email is not provided OR if user is under 18
|
|
673
|
+
return !formData.email || (formData.age && formData.age < 18)
|
|
674
|
+
}}
|
|
675
|
+
/>
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
#### Disable Submit Button Conditionally
|
|
679
|
+
|
|
680
|
+
**Static Disable:**
|
|
681
|
+
```tsx
|
|
682
|
+
<SmartForm
|
|
683
|
+
api="/api/submit"
|
|
684
|
+
submitDisabled={true}
|
|
685
|
+
>
|
|
686
|
+
{/* Fields */}
|
|
687
|
+
</SmartForm>
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
**Conditional Disable:**
|
|
691
|
+
```tsx
|
|
692
|
+
<SmartForm
|
|
693
|
+
api="/api/submit"
|
|
694
|
+
submitDisabled={(formData) => !formData.agreeToTerms}
|
|
695
|
+
>
|
|
696
|
+
<SmartInput field="name" label="Name" required />
|
|
697
|
+
<SmartCheckbox
|
|
698
|
+
field="agreeToTerms"
|
|
699
|
+
label="I agree to the terms"
|
|
700
|
+
/>
|
|
701
|
+
</SmartForm>
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
**Example: Disable submit until all required fields are filled:**
|
|
705
|
+
```tsx
|
|
706
|
+
<SmartForm
|
|
707
|
+
api="/api/submit"
|
|
708
|
+
submitDisabled={(formData) => {
|
|
709
|
+
return !formData.name || !formData.email || !formData.agreeToTerms
|
|
710
|
+
}}
|
|
711
|
+
>
|
|
712
|
+
<SmartInput field="name" label="Name" required />
|
|
713
|
+
<SmartInput field="email" label="Email" required />
|
|
714
|
+
<SmartCheckbox field="agreeToTerms" label="I agree" required />
|
|
715
|
+
</SmartForm>
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
**Note:** The submit button is automatically disabled when `isLoading` is `true`. The `submitDisabled` prop is combined with the loading state: `disabled={isLoading || isSubmitDisabled}`.
|
|
719
|
+
|
|
720
|
+
#### Combining Disabled and Hidden
|
|
721
|
+
|
|
722
|
+
You can use both `disabled` and `hidden` together for different scenarios:
|
|
723
|
+
|
|
724
|
+
```tsx
|
|
725
|
+
<SmartForm api="/api/submit">
|
|
726
|
+
<SmartSelect
|
|
727
|
+
field="userType"
|
|
728
|
+
label="User Type"
|
|
729
|
+
options={[
|
|
730
|
+
{ value: 'admin', label: 'Admin' },
|
|
731
|
+
{ value: 'user', label: 'User' }
|
|
732
|
+
]}
|
|
733
|
+
/>
|
|
734
|
+
|
|
735
|
+
{/* Hidden for non-admin users */}
|
|
736
|
+
<SmartInput
|
|
737
|
+
field="adminCode"
|
|
738
|
+
label="Admin Code"
|
|
739
|
+
hidden={(formData) => formData.userType !== 'admin'}
|
|
740
|
+
/>
|
|
741
|
+
|
|
742
|
+
{/* Disabled (but visible) for admin users */}
|
|
743
|
+
<SmartInput
|
|
744
|
+
field="userNotes"
|
|
745
|
+
label="User Notes"
|
|
746
|
+
disabled={(formData) => formData.userType === 'admin'}
|
|
747
|
+
/>
|
|
748
|
+
</SmartForm>
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
#### Hide Fields Conditionally
|
|
752
|
+
|
|
753
|
+
Hide fields completely from the form based on form data. When a field is hidden, it's not rendered at all (unlike `disabled` which shows the field but makes it non-interactive).
|
|
754
|
+
|
|
755
|
+
**Static Hide:**
|
|
756
|
+
```tsx
|
|
757
|
+
<SmartInput
|
|
758
|
+
field="optionalField"
|
|
759
|
+
label="Optional Field"
|
|
760
|
+
hidden={true}
|
|
761
|
+
/>
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
**Conditional Hide:**
|
|
765
|
+
```tsx
|
|
766
|
+
<SmartForm api="/api/submit">
|
|
767
|
+
<SmartSelect
|
|
768
|
+
field="accountType"
|
|
769
|
+
label="Account Type"
|
|
770
|
+
options={[
|
|
771
|
+
{ value: 'personal', label: 'Personal' },
|
|
772
|
+
{ value: 'business', label: 'Business' }
|
|
773
|
+
]}
|
|
774
|
+
/>
|
|
775
|
+
|
|
776
|
+
{/* Only show business fields when account type is business */}
|
|
777
|
+
<SmartInput
|
|
778
|
+
field="businessName"
|
|
779
|
+
label="Business Name"
|
|
780
|
+
hidden={(formData) => formData.accountType !== 'business'}
|
|
781
|
+
/>
|
|
782
|
+
|
|
783
|
+
<SmartInput
|
|
784
|
+
field="taxId"
|
|
785
|
+
label="Tax ID"
|
|
786
|
+
hidden={(formData) => formData.accountType !== 'business'}
|
|
787
|
+
/>
|
|
788
|
+
</SmartForm>
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
**Example: Show/hide based on checkbox:**
|
|
792
|
+
```tsx
|
|
793
|
+
<SmartForm api="/api/submit">
|
|
794
|
+
<SmartCheckbox
|
|
795
|
+
field="hasSpecialRequirements"
|
|
796
|
+
label="I have special requirements"
|
|
797
|
+
/>
|
|
798
|
+
|
|
799
|
+
<SmartInput
|
|
800
|
+
field="specialRequirements"
|
|
801
|
+
label="Please describe your requirements"
|
|
802
|
+
type="textarea"
|
|
803
|
+
hidden={(formData) => !formData.hasSpecialRequirements}
|
|
804
|
+
/>
|
|
805
|
+
</SmartForm>
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
**Difference between `disabled` and `hidden`:**
|
|
809
|
+
- `disabled`: Field is visible but grayed out and non-interactive
|
|
810
|
+
- `hidden`: Field is completely removed from the DOM (not rendered)
|
|
811
|
+
|
|
812
|
+
**When to use each:**
|
|
813
|
+
- Use `disabled` when you want to show the field exists but is temporarily unavailable
|
|
814
|
+
- Use `hidden` when you want to completely hide fields that aren't relevant to the current form state
|
|
815
|
+
|
|
816
|
+
#### All Supported Components
|
|
817
|
+
|
|
818
|
+
Both `disabled` and `hidden` props are available on all smart field components:
|
|
819
|
+
- `SmartInput`
|
|
820
|
+
- `SmartSelect`
|
|
821
|
+
- `SmartCombobox`
|
|
822
|
+
- `SmartCheckbox`
|
|
823
|
+
- `SmartRadioGroup`
|
|
824
|
+
- `SmartDatePicker`
|
|
825
|
+
- `SmartSlider`
|
|
826
|
+
- `SmartDualRangeSlider`
|
|
827
|
+
- `SmartTags`
|
|
828
|
+
- `SmartFileUpload`
|
|
829
|
+
- `SmartAutoSuggestTags`
|
|
830
|
+
- `SmartBasicRichTextbox`
|
|
831
|
+
|
|
597
832
|
### Query Parameters
|
|
598
833
|
|
|
599
834
|
Automatically include URL query parameters in form submissions.
|
|
@@ -843,6 +1078,7 @@ export function RegistrationForm() {
|
|
|
843
1078
|
api="https://api.example.com/register"
|
|
844
1079
|
method="POST"
|
|
845
1080
|
submitButtonText="Register"
|
|
1081
|
+
submitDisabled={(formData) => !formData.agreeToTerms}
|
|
846
1082
|
onSuccess={(data) => {
|
|
847
1083
|
toast.success('Account created successfully!')
|
|
848
1084
|
}}
|
|
@@ -871,6 +1107,13 @@ export function RegistrationForm() {
|
|
|
871
1107
|
required
|
|
872
1108
|
/>
|
|
873
1109
|
|
|
1110
|
+
<SmartSelect
|
|
1111
|
+
field="state"
|
|
1112
|
+
label="State"
|
|
1113
|
+
options={stateOptions}
|
|
1114
|
+
disabled={(formData) => !formData.country}
|
|
1115
|
+
/>
|
|
1116
|
+
|
|
874
1117
|
<SmartDatePicker
|
|
875
1118
|
field="birthDate"
|
|
876
1119
|
label="Date of Birth"
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
interface SmartInputProps {
|
|
4
5
|
field: string;
|
|
5
6
|
label?: string;
|
|
6
|
-
type?: 'text' | 'email' | 'password' | 'tel' | 'number' | 'textarea';
|
|
7
|
+
type?: 'text' | 'email' | 'password' | 'tel' | 'number' | 'textarea' | 'date';
|
|
7
8
|
placeholder?: string;
|
|
8
9
|
validation?: any;
|
|
9
10
|
className?: string;
|
|
10
11
|
required?: boolean;
|
|
11
12
|
defaultValue?: any;
|
|
13
|
+
syncValue?: any;
|
|
12
14
|
info?: string;
|
|
13
15
|
subLabel?: string;
|
|
16
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
17
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
18
|
+
icon?: React__default.ReactNode;
|
|
19
|
+
iconPosition?: 'left' | 'right';
|
|
14
20
|
}
|
|
15
21
|
declare const SmartInput: React__default.FC<SmartInputProps>;
|
|
16
22
|
|
|
@@ -23,6 +29,8 @@ interface SmartCheckboxProps {
|
|
|
23
29
|
defaultValue?: boolean;
|
|
24
30
|
info?: string;
|
|
25
31
|
subLabel?: string;
|
|
32
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
33
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
26
34
|
}
|
|
27
35
|
declare const SmartCheckbox: React__default.FC<SmartCheckboxProps>;
|
|
28
36
|
|
|
@@ -42,6 +50,8 @@ interface SmartRadioGroupProps {
|
|
|
42
50
|
defaultValue?: string;
|
|
43
51
|
info?: string;
|
|
44
52
|
subLabel?: string;
|
|
53
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
54
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
45
55
|
}
|
|
46
56
|
declare const SmartRadioGroup: React__default.FC<SmartRadioGroupProps>;
|
|
47
57
|
|
|
@@ -60,33 +70,46 @@ interface SmartSelectProps {
|
|
|
60
70
|
defaultValue?: string;
|
|
61
71
|
info?: string;
|
|
62
72
|
subLabel?: string;
|
|
73
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
74
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
63
75
|
}
|
|
64
76
|
declare const SmartSelect: React__default.FC<SmartSelectProps>;
|
|
65
77
|
|
|
66
|
-
interface
|
|
78
|
+
interface SmartComboboxOption {
|
|
79
|
+
value: string;
|
|
80
|
+
label: string;
|
|
81
|
+
}
|
|
82
|
+
interface SmartComboboxProps {
|
|
67
83
|
field: string;
|
|
68
84
|
label?: string;
|
|
85
|
+
options: SmartComboboxOption[];
|
|
69
86
|
className?: string;
|
|
70
87
|
placeholder?: string;
|
|
88
|
+
allowCustom?: boolean;
|
|
71
89
|
validation?: any;
|
|
72
90
|
required?: boolean;
|
|
73
|
-
|
|
74
|
-
allowFuture?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* When true, value will be stored/returned as ISO string (yyyy-MM-dd).
|
|
77
|
-
* Otherwise the underlying form value will be a Date instance.
|
|
78
|
-
*/
|
|
79
|
-
valueAsString?: boolean;
|
|
80
|
-
/** Optional minimum selectable date */
|
|
81
|
-
minDate?: Date;
|
|
82
|
-
/** Optional maximum selectable date */
|
|
83
|
-
maxDate?: Date;
|
|
84
|
-
/** Default value for the date picker (can be Date or string depending on valueAsString) */
|
|
85
|
-
defaultValue?: Date | string;
|
|
91
|
+
defaultValue?: string;
|
|
86
92
|
info?: string;
|
|
87
93
|
subLabel?: string;
|
|
94
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
95
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
88
96
|
}
|
|
89
|
-
declare const
|
|
97
|
+
declare const SmartCombobox: React__default.FC<SmartComboboxProps>;
|
|
98
|
+
|
|
99
|
+
type SmartDatePickerProps = {
|
|
100
|
+
field: string;
|
|
101
|
+
label?: string;
|
|
102
|
+
placeholder?: string;
|
|
103
|
+
validation?: any;
|
|
104
|
+
className?: string;
|
|
105
|
+
required?: boolean;
|
|
106
|
+
defaultValue?: any;
|
|
107
|
+
info?: string;
|
|
108
|
+
subLabel?: string;
|
|
109
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
110
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
111
|
+
};
|
|
112
|
+
declare const SmartDatePicker: ({ field, label, className, ...props }: SmartDatePickerProps) => react_jsx_runtime.JSX.Element;
|
|
90
113
|
|
|
91
114
|
interface SmartTagsProps {
|
|
92
115
|
field: string;
|
|
@@ -100,7 +123,8 @@ interface SmartTagsProps {
|
|
|
100
123
|
maxLength?: number;
|
|
101
124
|
minLength?: number;
|
|
102
125
|
allowDuplicates?: boolean;
|
|
103
|
-
disabled?: boolean;
|
|
126
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
127
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
104
128
|
onTagAdd?: (tagText: string) => void;
|
|
105
129
|
onTagRemove?: (tagText: string) => void;
|
|
106
130
|
info?: string;
|
|
@@ -108,4 +132,4 @@ interface SmartTagsProps {
|
|
|
108
132
|
}
|
|
109
133
|
declare const SmartTags: React__default.FC<SmartTagsProps>;
|
|
110
134
|
|
|
111
|
-
export { SmartInput as S, SmartCheckbox as a, SmartRadioGroup as b, SmartSelect as c,
|
|
135
|
+
export { SmartInput as S, SmartCheckbox as a, SmartRadioGroup as b, SmartSelect as c, SmartCombobox as d, SmartDatePicker as e, SmartTags as f, type SmartInputProps as g, type SmartTagsProps as h, type SmartDatePickerProps as i, type SmartComboboxProps as j, type SmartComboboxOption as k };
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
interface SmartInputProps {
|
|
4
5
|
field: string;
|
|
5
6
|
label?: string;
|
|
6
|
-
type?: 'text' | 'email' | 'password' | 'tel' | 'number' | 'textarea';
|
|
7
|
+
type?: 'text' | 'email' | 'password' | 'tel' | 'number' | 'textarea' | 'date';
|
|
7
8
|
placeholder?: string;
|
|
8
9
|
validation?: any;
|
|
9
10
|
className?: string;
|
|
10
11
|
required?: boolean;
|
|
11
12
|
defaultValue?: any;
|
|
13
|
+
syncValue?: any;
|
|
12
14
|
info?: string;
|
|
13
15
|
subLabel?: string;
|
|
16
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
17
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
18
|
+
icon?: React__default.ReactNode;
|
|
19
|
+
iconPosition?: 'left' | 'right';
|
|
14
20
|
}
|
|
15
21
|
declare const SmartInput: React__default.FC<SmartInputProps>;
|
|
16
22
|
|
|
@@ -23,6 +29,8 @@ interface SmartCheckboxProps {
|
|
|
23
29
|
defaultValue?: boolean;
|
|
24
30
|
info?: string;
|
|
25
31
|
subLabel?: string;
|
|
32
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
33
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
26
34
|
}
|
|
27
35
|
declare const SmartCheckbox: React__default.FC<SmartCheckboxProps>;
|
|
28
36
|
|
|
@@ -42,6 +50,8 @@ interface SmartRadioGroupProps {
|
|
|
42
50
|
defaultValue?: string;
|
|
43
51
|
info?: string;
|
|
44
52
|
subLabel?: string;
|
|
53
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
54
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
45
55
|
}
|
|
46
56
|
declare const SmartRadioGroup: React__default.FC<SmartRadioGroupProps>;
|
|
47
57
|
|
|
@@ -60,33 +70,46 @@ interface SmartSelectProps {
|
|
|
60
70
|
defaultValue?: string;
|
|
61
71
|
info?: string;
|
|
62
72
|
subLabel?: string;
|
|
73
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
74
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
63
75
|
}
|
|
64
76
|
declare const SmartSelect: React__default.FC<SmartSelectProps>;
|
|
65
77
|
|
|
66
|
-
interface
|
|
78
|
+
interface SmartComboboxOption {
|
|
79
|
+
value: string;
|
|
80
|
+
label: string;
|
|
81
|
+
}
|
|
82
|
+
interface SmartComboboxProps {
|
|
67
83
|
field: string;
|
|
68
84
|
label?: string;
|
|
85
|
+
options: SmartComboboxOption[];
|
|
69
86
|
className?: string;
|
|
70
87
|
placeholder?: string;
|
|
88
|
+
allowCustom?: boolean;
|
|
71
89
|
validation?: any;
|
|
72
90
|
required?: boolean;
|
|
73
|
-
|
|
74
|
-
allowFuture?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* When true, value will be stored/returned as ISO string (yyyy-MM-dd).
|
|
77
|
-
* Otherwise the underlying form value will be a Date instance.
|
|
78
|
-
*/
|
|
79
|
-
valueAsString?: boolean;
|
|
80
|
-
/** Optional minimum selectable date */
|
|
81
|
-
minDate?: Date;
|
|
82
|
-
/** Optional maximum selectable date */
|
|
83
|
-
maxDate?: Date;
|
|
84
|
-
/** Default value for the date picker (can be Date or string depending on valueAsString) */
|
|
85
|
-
defaultValue?: Date | string;
|
|
91
|
+
defaultValue?: string;
|
|
86
92
|
info?: string;
|
|
87
93
|
subLabel?: string;
|
|
94
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
95
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
88
96
|
}
|
|
89
|
-
declare const
|
|
97
|
+
declare const SmartCombobox: React__default.FC<SmartComboboxProps>;
|
|
98
|
+
|
|
99
|
+
type SmartDatePickerProps = {
|
|
100
|
+
field: string;
|
|
101
|
+
label?: string;
|
|
102
|
+
placeholder?: string;
|
|
103
|
+
validation?: any;
|
|
104
|
+
className?: string;
|
|
105
|
+
required?: boolean;
|
|
106
|
+
defaultValue?: any;
|
|
107
|
+
info?: string;
|
|
108
|
+
subLabel?: string;
|
|
109
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
110
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
111
|
+
};
|
|
112
|
+
declare const SmartDatePicker: ({ field, label, className, ...props }: SmartDatePickerProps) => react_jsx_runtime.JSX.Element;
|
|
90
113
|
|
|
91
114
|
interface SmartTagsProps {
|
|
92
115
|
field: string;
|
|
@@ -100,7 +123,8 @@ interface SmartTagsProps {
|
|
|
100
123
|
maxLength?: number;
|
|
101
124
|
minLength?: number;
|
|
102
125
|
allowDuplicates?: boolean;
|
|
103
|
-
disabled?: boolean;
|
|
126
|
+
disabled?: boolean | ((formData: any) => boolean);
|
|
127
|
+
hidden?: boolean | ((formData: any) => boolean);
|
|
104
128
|
onTagAdd?: (tagText: string) => void;
|
|
105
129
|
onTagRemove?: (tagText: string) => void;
|
|
106
130
|
info?: string;
|
|
@@ -108,4 +132,4 @@ interface SmartTagsProps {
|
|
|
108
132
|
}
|
|
109
133
|
declare const SmartTags: React__default.FC<SmartTagsProps>;
|
|
110
134
|
|
|
111
|
-
export { SmartInput as S, SmartCheckbox as a, SmartRadioGroup as b, SmartSelect as c,
|
|
135
|
+
export { SmartInput as S, SmartCheckbox as a, SmartRadioGroup as b, SmartSelect as c, SmartCombobox as d, SmartDatePicker as e, SmartTags as f, type SmartInputProps as g, type SmartTagsProps as h, type SmartDatePickerProps as i, type SmartComboboxProps as j, type SmartComboboxOption as k };
|