@tellescope/react-components 1.178.0 → 1.180.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/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +6 -1
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +9 -8
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/esm/CMS/components.d.ts +0 -1
- package/lib/esm/CMS/components.d.ts.map +1 -1
- package/lib/esm/Forms/forms.d.ts +3 -3
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +6 -1
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +1 -1
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +9 -8
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/inputs.native.d.ts +0 -1
- package/lib/esm/Forms/inputs.native.d.ts.map +1 -1
- package/lib/esm/controls.d.ts +2 -2
- package/lib/esm/inputs.d.ts +1 -1
- package/lib/esm/layout.d.ts +1 -1
- package/lib/esm/state.d.ts +289 -289
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/hooks.tsx +6 -1
- package/src/Forms/inputs.tsx +10 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.180.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"@reduxjs/toolkit": "^1.6.2",
|
|
48
48
|
"@stripe/react-stripe-js": "^2.9.0",
|
|
49
49
|
"@stripe/stripe-js": "^1.52.1",
|
|
50
|
-
"@tellescope/constants": "^1.
|
|
51
|
-
"@tellescope/sdk": "^1.
|
|
52
|
-
"@tellescope/types-client": "^1.
|
|
53
|
-
"@tellescope/types-models": "^1.
|
|
54
|
-
"@tellescope/types-utilities": "^1.
|
|
55
|
-
"@tellescope/utilities": "^1.
|
|
56
|
-
"@tellescope/validation": "^1.
|
|
50
|
+
"@tellescope/constants": "^1.180.0",
|
|
51
|
+
"@tellescope/sdk": "^1.180.0",
|
|
52
|
+
"@tellescope/types-client": "^1.180.0",
|
|
53
|
+
"@tellescope/types-models": "^1.180.0",
|
|
54
|
+
"@tellescope/types-utilities": "^1.180.0",
|
|
55
|
+
"@tellescope/utilities": "^1.180.0",
|
|
56
|
+
"@tellescope/validation": "^1.180.0",
|
|
57
57
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
58
58
|
"@typescript-eslint/parser": "^4.33.0",
|
|
59
59
|
"css-to-react-native": "^3.0.0",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
85
85
|
"react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "552ac02d3991ba26c6b32f7323d3cd36e884a94a",
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
}
|
package/src/Forms/hooks.tsx
CHANGED
|
@@ -636,7 +636,9 @@ export const useTellescopeForm = ({ isPublicForm, form, urlLogicValue, customiza
|
|
|
636
636
|
? parseInt(f.options.default)
|
|
637
637
|
: (f.options?.from || 1)
|
|
638
638
|
)
|
|
639
|
-
:
|
|
639
|
+
: f.type === 'Related Contacts'
|
|
640
|
+
? (f.isOptional ? [] : [{}])
|
|
641
|
+
: '' as any // null flag that the response was not filled out
|
|
640
642
|
)
|
|
641
643
|
),
|
|
642
644
|
} as FormResponseValueAnswer,
|
|
@@ -924,6 +926,9 @@ export const useTellescopeForm = ({ isPublicForm, form, urlLogicValue, customiza
|
|
|
924
926
|
if (errorMessage) {
|
|
925
927
|
return `Contact ${i+1}: ${errorMessage}`
|
|
926
928
|
}
|
|
929
|
+
if (Object.values(contact).every(v => !v)) {
|
|
930
|
+
return `Contact ${i+1}: At least one field is required`
|
|
931
|
+
}
|
|
927
932
|
}
|
|
928
933
|
}
|
|
929
934
|
|
package/src/Forms/inputs.tsx
CHANGED
|
@@ -2573,7 +2573,12 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, ...props
|
|
|
2573
2573
|
// safeguard against any rogue values like empty string
|
|
2574
2574
|
const value = Array.isArray(_value) ? _value : []
|
|
2575
2575
|
|
|
2576
|
-
const [editing, setEditing] = useState(-1)
|
|
2576
|
+
const [editing, setEditing] = useState(value.length === 1 ? 0 : -1)
|
|
2577
|
+
|
|
2578
|
+
const handleAddContact = useCallback(() => {
|
|
2579
|
+
onChange([...value, {}], field.id, true)
|
|
2580
|
+
setEditing(value.length)
|
|
2581
|
+
}, [onChange, value, field?.id])
|
|
2577
2582
|
|
|
2578
2583
|
if (value[editing]) {
|
|
2579
2584
|
const { fname, lname, email, phone, fields={}, dateOfBirth='', relationships } = value[editing]
|
|
@@ -2644,8 +2649,8 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, ...props
|
|
|
2644
2649
|
{(field.options?.tableChoices || []).length > 0 &&
|
|
2645
2650
|
<Grid item>
|
|
2646
2651
|
<Grid container spacing={1}>
|
|
2647
|
-
{(field.options?.tableChoices || []).map(({ info, label, type}) => (
|
|
2648
|
-
<Grid item xs={6}>
|
|
2652
|
+
{(field.options?.tableChoices || []).map(({ info, label, type}, i) => (
|
|
2653
|
+
<Grid item xs={6} key={i}>
|
|
2649
2654
|
{type === 'Text'
|
|
2650
2655
|
? (
|
|
2651
2656
|
<TextField label={label} size="small" fullWidth
|
|
@@ -2656,7 +2661,7 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, ...props
|
|
|
2656
2661
|
)
|
|
2657
2662
|
: type === 'Date' ? (
|
|
2658
2663
|
<DateStringInput label={label} size="small" fullWidth
|
|
2659
|
-
field={field}
|
|
2664
|
+
field={{ ...field, isOptional: true }}
|
|
2660
2665
|
value={fields[label] as string || ''}
|
|
2661
2666
|
onChange={(e='') => onChange(value.map((v, i) => i === editing ? { ...v, fields: { ...fields, [label]: e } } : v), field.id)}
|
|
2662
2667
|
/>
|
|
@@ -2729,10 +2734,7 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, ...props
|
|
|
2729
2734
|
</Grid>
|
|
2730
2735
|
|
|
2731
2736
|
<Grid item>
|
|
2732
|
-
<Button variant="contained" onClick={
|
|
2733
|
-
onChange([...value, {}], field.id, true)
|
|
2734
|
-
setEditing(value.length)
|
|
2735
|
-
}}>
|
|
2737
|
+
<Button variant="contained" onClick={handleAddContact}>
|
|
2736
2738
|
Add Contact
|
|
2737
2739
|
</Button>
|
|
2738
2740
|
</Grid>
|