@tellescope/react-components 1.185.1 → 1.186.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/forms.js +2 -2
- package/lib/cjs/Forms/forms.js.map +1 -1
- package/lib/cjs/Forms/hooks.d.ts +1 -1
- package/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +1 -0
- 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 +19 -1
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/form_responses.d.ts +1 -0
- package/lib/esm/Forms/form_responses.d.ts.map +1 -1
- package/lib/esm/Forms/forms.d.ts +3 -3
- package/lib/esm/Forms/forms.js +2 -2
- package/lib/esm/Forms/forms.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +1 -1
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +1 -0
- 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 +19 -1
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/controls.d.ts +2 -2
- package/lib/esm/inputs.d.ts +1 -1
- package/lib/esm/inputs.native.d.ts +1 -0
- package/lib/esm/inputs.native.d.ts.map +1 -1
- package/lib/esm/layout.d.ts +1 -1
- package/lib/esm/state.d.ts +84 -84
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/forms.tsx +2 -2
- package/src/Forms/hooks.tsx +2 -1
- package/src/Forms/inputs.tsx +43 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.186.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.186.0",
|
|
51
|
+
"@tellescope/sdk": "^1.186.0",
|
|
52
|
+
"@tellescope/types-client": "^1.186.0",
|
|
53
|
+
"@tellescope/types-models": "^1.186.0",
|
|
54
|
+
"@tellescope/types-utilities": "^1.186.0",
|
|
55
|
+
"@tellescope/utilities": "^1.186.0",
|
|
56
|
+
"@tellescope/validation": "^1.186.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": "7cb921210c5f676cf20d4e460b895a92cca57ac5",
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
}
|
package/src/Forms/forms.tsx
CHANGED
|
@@ -531,7 +531,7 @@ export const TellescopeSingleQuestionFlow: typeof TellescopeForm = ({
|
|
|
531
531
|
if (activeField.value.type === 'stringLong') return //
|
|
532
532
|
if (activeField.value.type === 'Question Group') return // ensure enter is allowed in stringLong at end of a question group before next
|
|
533
533
|
if (isNextDisabled()) return
|
|
534
|
-
goToNextField()
|
|
534
|
+
goToNextField(undefined)
|
|
535
535
|
}
|
|
536
536
|
}, [activeField, isNextDisabled, goToNextField, isPreviousDisabled, goToPreviousField])
|
|
537
537
|
|
|
@@ -617,7 +617,7 @@ export const TellescopeSingleQuestionFlow: typeof TellescopeForm = ({
|
|
|
617
617
|
/>
|
|
618
618
|
)
|
|
619
619
|
: (
|
|
620
|
-
<Button variant="contained" disabled={isNextDisabled()} onClick={goToNextField}
|
|
620
|
+
<Button variant="contained" disabled={isNextDisabled()} onClick={() => goToNextField(undefined)}
|
|
621
621
|
style={{ ...defaultButtonStyles, width: 100 }}
|
|
622
622
|
>
|
|
623
623
|
{form_display_text_for_language(form, "Next")}
|
package/src/Forms/hooks.tsx
CHANGED
|
@@ -1301,7 +1301,8 @@ export const useTellescopeForm = ({ isPublicForm, form, urlLogicValue, customiza
|
|
|
1301
1301
|
}, [activeField, validateField, uploadingFiles])
|
|
1302
1302
|
|
|
1303
1303
|
const autoAdvanceRef = useRef(false)
|
|
1304
|
-
|
|
1304
|
+
// don't make option, to avoid user passing invalid data, like an onclick event
|
|
1305
|
+
const goToNextField = useCallback((answer: FormResponseValue['answer'] | undefined) => {
|
|
1305
1306
|
if (!currentValue) return
|
|
1306
1307
|
if (isNextDisabled() && currentValue?.answer.type !== 'Hidden Value') return
|
|
1307
1308
|
|
package/src/Forms/inputs.tsx
CHANGED
|
@@ -485,26 +485,49 @@ export const EmailInput = ({ field, value, onChange, form, ...props }: FormInput
|
|
|
485
485
|
/>
|
|
486
486
|
)
|
|
487
487
|
|
|
488
|
-
export const NumberInput = ({ field, value, onChange, form, ...props }: FormInputProps<'number'>) =>
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
)
|
|
488
|
+
export const NumberInput = ({ field, value, onChange, form, ...props }: FormInputProps<'number'>) => {
|
|
489
|
+
// Prevent the default scroll behavior when focused on this input
|
|
490
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
491
|
+
useEffect(() => {
|
|
492
|
+
const handleWheel = (e: any) => {
|
|
493
|
+
e?.preventDefault?.();
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
// Get the actual input element inside the TextField
|
|
497
|
+
const inputElement = inputRef.current?.querySelector('input');
|
|
498
|
+
|
|
499
|
+
if (inputElement) {
|
|
500
|
+
inputElement.addEventListener('wheel', handleWheel, { passive: false });
|
|
501
|
+
|
|
502
|
+
// Clean up event listener when component unmounts
|
|
503
|
+
return () => {
|
|
504
|
+
inputElement.removeEventListener('wheel', handleWheel);
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
}, []);
|
|
508
|
+
|
|
509
|
+
return (
|
|
510
|
+
<TextField ref={inputRef} autoFocus InputProps={defaultInputProps} {...props} required={!field.isOptional} fullWidth type="number" value={value}
|
|
511
|
+
onChange={e => onChange(parseInt(e.target.value), field.id)}
|
|
512
|
+
label={(!field.title && field.placeholder) ? field.placeholder : props.label}
|
|
513
|
+
placeholder={field.placeholder || form_display_text_for_language(form, "Enter a number...", '')}
|
|
514
|
+
onScroll={e => e.preventDefault()} // prevent scroll on number input
|
|
515
|
+
sx={{
|
|
516
|
+
'& input[type=number]': {
|
|
517
|
+
'-moz-appearance': 'textfield'
|
|
518
|
+
},
|
|
519
|
+
'& input[type=number]::-webkit-outer-spin-button': {
|
|
520
|
+
'-webkit-appearance': 'none',
|
|
521
|
+
margin: 0
|
|
522
|
+
},
|
|
523
|
+
'& input[type=number]::-webkit-inner-spin-button': {
|
|
524
|
+
'-webkit-appearance': 'none',
|
|
525
|
+
margin: 0
|
|
526
|
+
}
|
|
527
|
+
}}
|
|
528
|
+
/>
|
|
529
|
+
)
|
|
530
|
+
}
|
|
508
531
|
|
|
509
532
|
export const InsuranceInput = ({ field, value, onChange, form, responses, enduser, ...props }: FormInputProps<'Insurance'>) => {
|
|
510
533
|
const session = useResolvedSession()
|