@tellescope/react-components 1.185.2 → 1.187.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/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/CMS/components.d.ts +0 -1
- package/lib/esm/CMS/components.d.ts.map +1 -1
- package/lib/esm/Forms/form_responses.d.ts +0 -1
- package/lib/esm/Forms/form_responses.d.ts.map +1 -1
- package/lib/esm/Forms/forms.d.ts +3 -3
- 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 +0 -1
- package/lib/esm/inputs.native.d.ts.map +1 -1
- package/lib/esm/state.d.ts +40 -40
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- 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.187.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.187.0",
|
|
51
|
+
"@tellescope/sdk": "^1.187.0",
|
|
52
|
+
"@tellescope/types-client": "^1.187.0",
|
|
53
|
+
"@tellescope/types-models": "^1.187.0",
|
|
54
|
+
"@tellescope/types-utilities": "^1.187.0",
|
|
55
|
+
"@tellescope/utilities": "^1.187.0",
|
|
56
|
+
"@tellescope/validation": "^1.187.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": "fbb905922b74dd70b690751a272ede269ef9fcb1",
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
}
|
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()
|