@x15ventures/x15-ui-library 3.15.0 → 3.16.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/dist/cjs/autoGenerated/libraryThemes.js +12 -12
- package/dist/cjs/autoGenerated/libraryThemes.js.map +1 -1
- package/dist/cjs/autoGenerated/libraryThemes.json +12 -12
- package/dist/cjs/components/design/dialog/Dialog.js +1 -1
- package/dist/cjs/components/design/dialog/Dialog.js.map +1 -1
- package/dist/cjs/components/design/headerBar/HeaderBar.js +3 -1
- package/dist/cjs/components/design/headerBar/HeaderBar.js.map +1 -1
- package/dist/cjs/components/design/headerBar/headerBar.css +6 -1
- package/dist/cjs/components/design/tooltip/Tooltip.js +67 -15
- package/dist/cjs/components/design/tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/design/tooltip/tooltip.css +1 -1
- package/dist/cjs/components/form/formFields/formFieldWrapper/FormField.js +8 -5
- package/dist/cjs/components/form/formFields/formFieldWrapper/FormField.js.map +1 -1
- package/dist/cjs/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js +15 -11
- package/dist/cjs/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +37 -15
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/inputCheckbox.css +4 -4
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +9 -9
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js +14 -4
- package/dist/cjs/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/text/InputText.js +23 -17
- package/dist/cjs/components/form/formFields/subComponents/inputs/text/InputText.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/select/Select.js +6 -5
- package/dist/cjs/components/form/formFields/subComponents/select/Select.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/textarea/Textarea.js +55 -83
- package/dist/cjs/components/form/formFields/subComponents/textarea/Textarea.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/textarea/textarea.css +20 -0
- package/dist/cjs/components/form/hookFormWrapper/HookFormWrapper.js +22 -5
- package/dist/cjs/components/form/hookFormWrapper/HookFormWrapper.js.map +1 -1
- package/dist/cjs/components/form/validation/ValidationMessages.js +36 -38
- package/dist/cjs/components/form/validation/ValidationMessages.js.map +1 -1
- package/dist/cjs/exampleUIs/exampleComponents/DemoContactForm.js +1 -2
- package/dist/cjs/exampleUIs/exampleComponents/DemoContactForm.js.map +1 -1
- package/dist/cjs/helpers/index.js +12 -0
- package/dist/cjs/helpers/index.js.map +1 -1
- package/dist/cjs/helpers/stringHelpers.js +48 -2
- package/dist/cjs/helpers/stringHelpers.js.map +1 -1
- package/dist/cjs/hooks/EdgeProximityDetect.js +18 -10
- package/dist/cjs/hooks/EdgeProximityDetect.js.map +1 -1
- package/dist/cjs/interfaces/headerText.interface.js.map +1 -1
- package/dist/cjs/package.json +137 -151
- package/dist/cjs/styles/index.css +22 -25
- package/dist/cjs/styles/shared/_allPartials.css +22 -25
- package/dist/cjs/styles/shared/forms/_forms.css +22 -25
- package/dist/components/design/dialog/Dialog.d.ts.map +1 -1
- package/dist/components/design/dialog/Dialog.test.d.ts +5 -0
- package/dist/components/design/dialog/Dialog.test.d.ts.map +1 -0
- package/dist/components/design/headerBar/HeaderBar.d.ts.map +1 -1
- package/dist/components/design/tooltip/Tooltip.d.ts +2 -0
- package/dist/components/design/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/design/tooltip/Tooltip.test.d.ts +2 -0
- package/dist/components/design/tooltip/Tooltip.test.d.ts.map +1 -0
- package/dist/components/form/formFields/formFieldWrapper/FormField.d.ts.map +1 -1
- package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts +7 -2
- package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.test.d.ts +5 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.test.d.ts.map +1 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts +8 -6
- package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/text/InputText.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/nestedFormContext.test.d.ts +5 -0
- package/dist/components/form/formFields/subComponents/nestedFormContext.test.d.ts.map +1 -0
- package/dist/components/form/formFields/subComponents/select/Select.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/textarea/Textarea.d.ts +4 -3
- package/dist/components/form/formFields/subComponents/textarea/Textarea.d.ts.map +1 -1
- package/dist/components/form/hookFormWrapper/HookFormWrapper.d.ts +3 -0
- package/dist/components/form/hookFormWrapper/HookFormWrapper.d.ts.map +1 -1
- package/dist/components/form/hookFormWrapper/HookFormWrapper.test.d.ts +5 -0
- package/dist/components/form/hookFormWrapper/HookFormWrapper.test.d.ts.map +1 -0
- package/dist/components/form/validation/ValidationMessages.d.ts +8 -1
- package/dist/components/form/validation/ValidationMessages.d.ts.map +1 -1
- package/dist/components/form/validation/ValidationMessages.test.d.ts +5 -0
- package/dist/components/form/validation/ValidationMessages.test.d.ts.map +1 -0
- package/dist/esm/autoGenerated/libraryThemes.js +12 -12
- package/dist/esm/autoGenerated/libraryThemes.js.map +1 -1
- package/dist/esm/autoGenerated/libraryThemes.json +12 -12
- package/dist/esm/components/design/dialog/Dialog.js +1 -1
- package/dist/esm/components/design/dialog/Dialog.js.map +1 -1
- package/dist/esm/components/design/headerBar/HeaderBar.js +3 -1
- package/dist/esm/components/design/headerBar/HeaderBar.js.map +1 -1
- package/dist/esm/components/design/headerBar/headerBar.css +6 -1
- package/dist/esm/components/design/tooltip/Tooltip.js +67 -15
- package/dist/esm/components/design/tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/design/tooltip/tooltip.css +1 -1
- package/dist/esm/components/form/formFields/formFieldWrapper/FormField.js +8 -5
- package/dist/esm/components/form/formFields/formFieldWrapper/FormField.js.map +1 -1
- package/dist/esm/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js +16 -12
- package/dist/esm/components/form/formFields/subComponents/inputs/autocomplete/Autocomplete.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +37 -15
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/inputCheckbox.css +4 -4
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +8 -8
- package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js +16 -6
- package/dist/esm/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/text/InputText.js +23 -17
- package/dist/esm/components/form/formFields/subComponents/inputs/text/InputText.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/select/Select.js +6 -5
- package/dist/esm/components/form/formFields/subComponents/select/Select.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/textarea/Textarea.js +50 -78
- package/dist/esm/components/form/formFields/subComponents/textarea/Textarea.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/textarea/textarea.css +20 -0
- package/dist/esm/components/form/hookFormWrapper/HookFormWrapper.js +22 -5
- package/dist/esm/components/form/hookFormWrapper/HookFormWrapper.js.map +1 -1
- package/dist/esm/components/form/validation/ValidationMessages.js +36 -38
- package/dist/esm/components/form/validation/ValidationMessages.js.map +1 -1
- package/dist/esm/exampleUIs/exampleComponents/DemoContactForm.js +1 -2
- package/dist/esm/exampleUIs/exampleComponents/DemoContactForm.js.map +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/helpers/index.js.map +1 -1
- package/dist/esm/helpers/stringHelpers.js +44 -0
- package/dist/esm/helpers/stringHelpers.js.map +1 -1
- package/dist/esm/hooks/EdgeProximityDetect.js +19 -11
- package/dist/esm/hooks/EdgeProximityDetect.js.map +1 -1
- package/dist/esm/interfaces/headerText.interface.js.map +1 -1
- package/dist/esm/package.json +137 -151
- package/dist/esm/styles/index.css +22 -25
- package/dist/esm/styles/shared/_allPartials.css +22 -25
- package/dist/esm/styles/shared/forms/_forms.css +22 -25
- package/dist/exampleUIs/exampleComponents/DemoContactForm.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +1 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/stringHelpers.d.ts +17 -0
- package/dist/helpers/stringHelpers.d.ts.map +1 -1
- package/dist/hooks/EdgeProximityDetect.d.ts.map +1 -1
- package/dist/interfaces/headerText.interface.d.ts +1 -0
- package/dist/interfaces/headerText.interface.d.ts.map +1 -1
- package/dist/package.json +137 -151
- package/package.json +137 -151
- package/dist/cjs/components/form/formFields/utilities/formUtilities.js +0 -22
- package/dist/cjs/components/form/formFields/utilities/formUtilities.js.map +0 -1
- package/dist/components/form/formFields/utilities/formUtilities.d.ts +0 -18
- package/dist/components/form/formFields/utilities/formUtilities.d.ts.map +0 -1
- package/dist/esm/components/form/formFields/utilities/formUtilities.js +0 -16
- package/dist/esm/components/form/formFields/utilities/formUtilities.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledRadioGroup.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","default","StyledRadioGroup","_extends2","_react","_interopRequireWildcard","_reactHookForm","_hooks","_FormFieldLabel","_StyledRadioInput","_ValidationMessages","_Spinner","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","group","id","name","groupName","defaultGroupValue","label","layout","validation","showSpinner","customCssClasses","customContent","onChange","radioInputs","isTouched","setIsTouched","useState","
|
|
1
|
+
{"version":3,"file":"StyledRadioGroup.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","default","StyledRadioGroup","_extends2","_react","_interopRequireWildcard","_reactHookForm","_hooks","_FormFieldLabel","_StyledRadioInput","_ValidationMessages","_Spinner","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","group","id","name","groupName","defaultGroupValue","label","layout","validation","showSpinner","customCssClasses","customContent","onChange","radioInputs","isTouched","setIsTouched","useState","control","setValue","useFormContext","groupValue","useWatch","radioInputsGroup","useRef","useEffect","useTabbableInputGroup","groupWrappingElementRef","HandleOnChange","event","target","newValue","shouldValidate","shouldDirty","wrapperCssClass","wrapper","position","labelProps","isRequired","required","createElement","onBlur","className","hide","FormFieldLabel","ref","length","map","radioInput","StyledRadioInput","key","field","isChecked","defaultChecked","Spinner","ValidationMessages","_default"],"sources":["../../../../../../../../../src/components/form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { useFormContext, useWatch } from 'react-hook-form';\nimport { StyledRadioGroupProps } from '../radioInputsProps';\nimport { useTabbableInputGroup } from '../../../../../../../hooks';\nimport { FormFieldLabel } from '../../../labels/FormFieldLabel';\nimport { StyledRadioInput } from './StyledRadioInput';\nimport { ValidationMessages } from '../../../../../validation/ValidationMessages';\nimport { Spinner } from '../../../../../../design/spinner/Spinner';\n\nimport './styledRadioGroup.scss';\n\nexport const StyledRadioGroup: React.FC<StyledRadioGroupProps> = (\n {\n group: {\n id,\n name: groupName,\n value: defaultGroupValue,\n label,\n layout,\n validation,\n showSpinner,\n customCssClasses,\n customContent,\n onChange = () => {}\n },\n radioInputs\n }\n) => {\n const [isTouched, setIsTouched] = useState(false);\n const { control, setValue } = useFormContext();\n const groupValue = useWatch({ control, name: groupName });\n const radioInputsGroup = useRef(null);\n\n useEffect(() => {\n if (typeof defaultGroupValue !== 'undefined') {\n setValue(groupName, defaultGroupValue);\n }\n }, [defaultGroupValue, groupName, setValue]);\n\n useTabbableInputGroup({ groupWrappingElementRef: radioInputsGroup });\n\n const HandleOnChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const { target } = event;\n const newValue = target.value;\n setValue(groupName, newValue, { shouldValidate: true, shouldDirty: true });\n setIsTouched(true);\n onChange(newValue);\n };\n\n const wrapperCssClass = `formField styledRadiosGroup ${ layout || '' } ${ isTouched ? 'touched' : '' } ${ customCssClasses?.wrapper || '' } ${ label?.position || '' }`;\n\n const labelProps = {\n ...label,\n isRequired: validation && typeof validation.required !== 'undefined',\n customContent\n };\n\n return (\n <fieldset id={ id } onBlur={ () => setIsTouched(true) } className={ wrapperCssClass }>\n <span className=\"sr-only\">\n Screen reader users are advised that this radio group supports\n custom keyboard navigation between radio options via tabbing.\n </span>\n\n <legend className={ label.hide ? 'sr-only' : '' }><FormFieldLabel { ...labelProps } /></legend>\n\n <div ref={ radioInputsGroup } className={ `radioInputs radioInputs_${ radioInputs.length }` }>\n {\n radioInputs.map((radioInput) => (\n <StyledRadioInput\n key={ radioInput.field.id }\n {\n ...{\n ...radioInput,\n label: {\n ...radioInput.label,\n isChecked: groupValue === radioInput.field.value\n },\n field: {\n ...radioInput.field,\n defaultChecked: groupValue === radioInput.field.value,\n groupName,\n onChange: HandleOnChange\n }\n }\n }\n />\n ))\n }\n </div>\n\n {\n showSpinner && <Spinner />\n }\n\n <ValidationMessages name={ groupName } validation={ validation } />\n </fieldset>\n );\n};\n\nexport default StyledRadioGroup;\n"],"mappings":";AAAA,YAAY;;AAAC,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,OAAA,GAAAF,OAAA,CAAAG,gBAAA;AAAA,IAAAC,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEb,IAAAQ,MAAA,GAAAC,uBAAA,CAAAT,OAAA;AACA,IAAAU,cAAA,GAAAV,OAAA;AAEA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,eAAA,GAAAZ,OAAA;AACA,IAAAa,iBAAA,GAAAb,OAAA;AACA,IAAAc,mBAAA,GAAAd,OAAA;AACA,IAAAe,QAAA,GAAAf,OAAA;AAEAA,OAAA;AAAiC,SAAAS,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAO,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAApB,OAAA,EAAAW,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,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ireDefault(require("react"));
|
|
10
10
|
var _reactHookForm = require("react-hook-form");
|
|
11
|
-
var _formUtilities = require("../../../utilities/formUtilities");
|
|
12
11
|
var _validationHelpers = require("../../../../../../helpers/validationHelpers");
|
|
13
12
|
const InputText = ({
|
|
14
13
|
field: {
|
|
@@ -33,18 +32,19 @@ const InputText = ({
|
|
|
33
32
|
register,
|
|
34
33
|
getFieldState,
|
|
35
34
|
setValue
|
|
36
|
-
} = (0, _reactHookForm.useFormContext)()
|
|
35
|
+
} = (0, _reactHookForm.useFormContext)();
|
|
37
36
|
const fieldState = getFieldState(name);
|
|
38
37
|
const HandleAutoFill = event => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
// Some browsers trigger onAnimationStart when autofill happens.
|
|
39
|
+
// We need to notify react-hook-form of the new value.
|
|
40
|
+
if (event.animationName === 'onAutoFill') {
|
|
41
|
+
setValue(name, event.currentTarget.value, {
|
|
42
|
+
shouldValidate: true,
|
|
43
|
+
shouldDirty: true
|
|
44
|
+
});
|
|
45
|
+
onChange({
|
|
46
|
+
target: event.currentTarget
|
|
47
|
+
});
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
const HandleOnBlur = event => {
|
|
@@ -52,9 +52,14 @@ const InputText = ({
|
|
|
52
52
|
target
|
|
53
53
|
} = event;
|
|
54
54
|
if (target) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
if (type === 'text' && target.value !== target.value.trim()) {
|
|
56
|
+
const trimmedValue = target.value.trim();
|
|
57
|
+
// Keep the uncontrolled input in step with the trimmed value held in form state.
|
|
58
|
+
target.value = trimmedValue;
|
|
59
|
+
setValue(name, trimmedValue, {
|
|
60
|
+
shouldValidate: true,
|
|
61
|
+
shouldDirty: true
|
|
62
|
+
});
|
|
58
63
|
}
|
|
59
64
|
onTouched();
|
|
60
65
|
onBlur(event);
|
|
@@ -73,6 +78,7 @@ const InputText = ({
|
|
|
73
78
|
return {};
|
|
74
79
|
};
|
|
75
80
|
const inputProps = {
|
|
81
|
+
...htmlNativeDomProps,
|
|
76
82
|
type,
|
|
77
83
|
id,
|
|
78
84
|
className: cssClass,
|
|
@@ -90,12 +96,12 @@ const InputText = ({
|
|
|
90
96
|
...addLengthValidatorProps('max'),
|
|
91
97
|
...addLengthValidatorProps('min'),
|
|
92
98
|
...register(name, {
|
|
93
|
-
onChange
|
|
99
|
+
onChange,
|
|
94
100
|
onBlur: HandleOnBlur,
|
|
95
101
|
...validation
|
|
96
102
|
}),
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
onAnimationStart: HandleAutoFill,
|
|
104
|
+
onKeyDown: HandleKeyEvent
|
|
99
105
|
};
|
|
100
106
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, customContent?.preField && /*#__PURE__*/_react.default.createElement("span", {
|
|
101
107
|
className: `preField preField_${type}Input`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputText.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","InputText","_react","_reactHookForm","
|
|
1
|
+
{"version":3,"file":"InputText.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","InputText","_react","_reactHookForm","_validationHelpers","field","type","id","name","placeholder","defaultValue","disabled","onBlur","onChange","onKeyDown","onTouched","htmlNativeDomProps","validation","showSpinner","customCssClasses","customContent","register","getFieldState","setValue","useFormContext","fieldState","HandleAutoFill","event","animationName","currentTarget","shouldValidate","shouldDirty","target","HandleOnBlur","trim","trimmedValue","HandleKeyEvent","cssClass","input","invalid","addLengthValidatorProps","validatorKey","isValidationRuleWithValue","inputProps","className","required","onAnimationStart","default","createElement","Fragment","preField","postField"],"sources":["../../../../../../../../src/components/form/formFields/subComponents/inputs/text/InputText.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { FormFieldProps, ValidationKey } from '../../../formFieldWrapper/formFieldProps';\nimport { isValidationRuleWithValue } from '../../../../../../helpers/validationHelpers';\n\nexport interface InputTextProps extends FormFieldProps, React.InputHTMLAttributes<HTMLInputElement> { }\n\nexport const InputText: React.FC<InputTextProps> = (\n {\n field: {\n type = 'text',\n id,\n name,\n placeholder,\n defaultValue,\n disabled,\n onBlur = () => { },\n onChange = () => { },\n onKeyDown = () => { },\n onTouched = () => { },\n ...htmlNativeDomProps\n },\n validation,\n showSpinner,\n customCssClasses,\n customContent\n }\n) => {\n const { register, getFieldState, setValue } = useFormContext();\n const fieldState = getFieldState(name);\n\n const HandleAutoFill = (event: React.AnimationEvent<HTMLInputElement>) => {\n // Some browsers trigger onAnimationStart when autofill happens.\n // We need to notify react-hook-form of the new value.\n if (event.animationName === 'onAutoFill') {\n setValue(name, event.currentTarget.value, { shouldValidate: true, shouldDirty: true });\n onChange({ target: event.currentTarget } as unknown as React.ChangeEvent<HTMLInputElement>);\n }\n };\n\n const HandleOnBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n const { target } = event;\n if (target) {\n if (type === 'text' && target.value !== target.value.trim()) {\n const trimmedValue = target.value.trim();\n // Keep the uncontrolled input in step with the trimmed value held in form state.\n target.value = trimmedValue;\n setValue(name, trimmedValue, { shouldValidate: true, shouldDirty: true });\n }\n onTouched();\n onBlur(event);\n }\n };\n\n const HandleKeyEvent = (\n event: React.KeyboardEvent<HTMLInputElement> &\n React.KeyboardEvent<HTMLSelectElement> &\n React.KeyboardEvent<HTMLTextAreaElement>\n ) => {\n onKeyDown(event);\n };\n\n const cssClass = `${ customCssClasses?.input || '' }${ fieldState && fieldState?.invalid ? ' invalidField' : '' }`;\n\n const addLengthValidatorProps = (validatorKey: ValidationKey) => {\n if (\n validation\n && typeof validation[validatorKey] !== 'undefined'\n && isValidationRuleWithValue(validation[validatorKey])\n ) {\n return {\n [validatorKey]: validation[validatorKey]?.value\n };\n }\n return {};\n };\n\n const inputProps = {\n ...htmlNativeDomProps,\n type,\n id,\n className: cssClass,\n placeholder,\n defaultValue,\n disabled,\n ...(showSpinner ? { disabled: true } : {}),\n ...(validation && typeof validation.required !== 'undefined' ? { required: true } : {}),\n ...(addLengthValidatorProps('maxLength')),\n ...(addLengthValidatorProps('minLength')),\n ...(addLengthValidatorProps('max')),\n ...(addLengthValidatorProps('min')),\n ...register(\n name,\n {\n onChange,\n onBlur: HandleOnBlur,\n ...validation\n }\n ),\n onAnimationStart: HandleAutoFill,\n onKeyDown: HandleKeyEvent\n };\n\n return (\n <>\n {\n customContent?.preField\n && <span className={ `preField preField_${ type }Input` }>{ customContent?.preField }</span>\n }\n\n <input { ...inputProps } />\n\n {\n customContent?.postField\n && <span className={ `postField postField_${ type }Input` }>{ customContent?.postField }</span>\n }\n </>\n );\n};\n"],"mappings":";AAAA,YAAY;;AAAC,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,SAAA;AAEb,IAAAC,MAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AAEA,IAAAQ,kBAAA,GAAAR,OAAA;AAIO,MAAMK,SAAmC,GAAGA,CACjD;EACEI,KAAK,EAAE;IACLC,IAAI,GAAG,MAAM;IACbC,EAAE;IACFC,IAAI;IACJC,WAAW;IACXC,YAAY;IACZC,QAAQ;IACRC,MAAM,GAAGA,CAAA,KAAM,CAAE,CAAC;IAClBC,QAAQ,GAAGA,CAAA,KAAM,CAAE,CAAC;IACpBC,SAAS,GAAGA,CAAA,KAAM,CAAE,CAAC;IACrBC,SAAS,GAAGA,CAAA,KAAM,CAAE,CAAC;IACrB,GAAGC;EACL,CAAC;EACDC,UAAU;EACVC,WAAW;EACXC,gBAAgB;EAChBC;AACF,CAAC,KACE;EACH,MAAM;IAAEC,QAAQ;IAAEC,aAAa;IAAEC;EAAS,CAAC,GAAG,IAAAC,6BAAc,EAAC,CAAC;E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,CAAA6C,OAAA,CAAAC,aAAA;IAAMJ,SAAS,EAAG,uBAAwBtC,IAAI;EAAU,GAAGc,aAAa,EAAE+B,SAAiB,CAEhG,CAAC;AAEP,CAAC;AAACpD,OAAA,CAAAE,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -10,8 +10,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _reactHookForm = require("react-hook-form");
|
|
11
11
|
var _HookFormWrapper = require("../../../hookFormWrapper/HookFormWrapper");
|
|
12
12
|
var _objectHelpers = require("../../../../../helpers/objectHelpers");
|
|
13
|
-
|
|
14
|
-
const Select = ({
|
|
13
|
+
const SelectField = ({
|
|
15
14
|
field: {
|
|
16
15
|
id,
|
|
17
16
|
name,
|
|
@@ -33,7 +32,7 @@ const Select = ({
|
|
|
33
32
|
const {
|
|
34
33
|
register,
|
|
35
34
|
getFieldState
|
|
36
|
-
} = (0, _reactHookForm.useFormContext)()
|
|
35
|
+
} = (0, _reactHookForm.useFormContext)();
|
|
37
36
|
const fieldState = getFieldState(name);
|
|
38
37
|
const HandleAutoFill = event => {
|
|
39
38
|
const {
|
|
@@ -53,7 +52,6 @@ const Select = ({
|
|
|
53
52
|
}
|
|
54
53
|
};
|
|
55
54
|
const HandleKeyEvent = event => {
|
|
56
|
-
onTouched();
|
|
57
55
|
onKeyDown(event);
|
|
58
56
|
};
|
|
59
57
|
const cssClass = `${customCssClasses?.input || ''}${fieldState && fieldState?.invalid ? ' invalidField' : ''}`;
|
|
@@ -90,7 +88,7 @@ const Select = ({
|
|
|
90
88
|
value: option
|
|
91
89
|
}, option);
|
|
92
90
|
};
|
|
93
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, customContent?.preField && /*#__PURE__*/_react.default.createElement("span", {
|
|
94
92
|
className: "preField"
|
|
95
93
|
}, customContent?.preField), /*#__PURE__*/_react.default.createElement("select", selectProps, includeEmptyOption && /*#__PURE__*/_react.default.createElement("option", {
|
|
96
94
|
value: ""
|
|
@@ -98,5 +96,8 @@ const Select = ({
|
|
|
98
96
|
className: "postField"
|
|
99
97
|
}, customContent?.postField));
|
|
100
98
|
};
|
|
99
|
+
const Select = props => /*#__PURE__*/_react.default.createElement(_HookFormWrapper.HookFormWrapper, {
|
|
100
|
+
formContext: props.formContext
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(SelectField, props));
|
|
101
102
|
exports.Select = Select;
|
|
102
103
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","Select","_react","_reactHookForm","_HookFormWrapper","_objectHelpers","
|
|
1
|
+
{"version":3,"file":"Select.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","Select","_react","_reactHookForm","_HookFormWrapper","_objectHelpers","SelectField","field","id","name","placeholder","defaultValue","onBlur","onChange","onKeyDown","onTouched","includeEmptyOption","emptyOptionLabel","options","validation","showSpinner","customCssClasses","customContent","register","getFieldState","useFormContext","fieldState","HandleAutoFill","event","target","HandleOnBlur","HandleKeyEvent","cssClass","input","invalid","selectProps","className","disabled","required","renderOption","option","isAnObject","typedOption","default","createElement","key","JSON","stringify","label","Fragment","preField","map","postField","props","HookFormWrapper","formContext"],"sources":["../../../../../../../src/components/form/formFields/subComponents/select/Select.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { HookFormWrapper } from '../../../hookFormWrapper/HookFormWrapper';\nimport { isAnObject } from '../../../../../helpers/objectHelpers';\nimport {\n FieldProps,\n FormFieldProps,\n SelectOptionObjectType,\n SelectOptionType,\n} from '../../formFieldWrapper/formFieldProps';\n\nexport interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement>, Omit<FormFieldProps, 'field'> {\n field: Omit<FieldProps, 'type'>;\n}\n\nconst SelectField: React.FC<SelectProps> = (\n {\n field: {\n id,\n name,\n placeholder,\n defaultValue,\n onBlur = () => {},\n onChange = () => {},\n onKeyDown = () => {},\n onTouched = () => {},\n includeEmptyOption = true,\n emptyOptionLabel = 'Please select',\n options\n },\n validation,\n showSpinner,\n customCssClasses,\n customContent\n }\n) => {\n const { register, getFieldState } = useFormContext();\n const fieldState = getFieldState(name);\n\n const HandleAutoFill = (event: React.FocusEvent<HTMLInputElement>) => {\n const { target } = event;\n if (target) {\n onChange(event);\n }\n };\n\n const HandleOnBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n const { target } = event;\n if (target) {\n onTouched();\n onBlur(event);\n }\n };\n\n const HandleKeyEvent = (\n event: React.KeyboardEvent<HTMLInputElement> &\n React.KeyboardEvent<HTMLSelectElement> &\n React.KeyboardEvent<HTMLTextAreaElement>\n ) => {\n onKeyDown(event);\n };\n\n const cssClass = `${ customCssClasses?.input || '' }${ fieldState && fieldState?.invalid ? ' invalidField' : '' }`;\n\n const selectProps = {\n id,\n className: cssClass,\n placeholder,\n defaultValue,\n ...(showSpinner ? { disabled: true } : {}),\n ...(validation && typeof validation.required !== 'undefined' ? { required: true } : {}),\n ...register(\n name,\n {\n onChange: HandleAutoFill,\n onBlur: HandleOnBlur,\n ...validation\n }\n ),\n onKeyDown: HandleKeyEvent\n };\n\n const renderOption = (option: SelectOptionType) => {\n if (isAnObject(option)) {\n const typedOption = option as SelectOptionObjectType;\n return (\n <option key={ `${ id }_${ typedOption.value }` } data-option={ JSON.stringify(typedOption) } value={ typedOption.value as string }>\n { typedOption.label }\n </option>\n );\n }\n return (\n <option key={ `${ id }_${ option }` } data-option={ JSON.stringify(option) } value={ option as string }>\n { option as string }\n </option>\n );\n };\n\n return (\n <>\n { customContent?.preField && <span className=\"preField\">{ customContent?.preField }</span> }\n\n <select { ...selectProps }>\n { includeEmptyOption && <option value=\"\">{ emptyOptionLabel }</option> }\n { (options as SelectOptionType[])?.map(renderOption) }\n </select>\n\n { customContent?.postField && <span className=\"postField\">{ customContent?.postField }</span> }\n </>\n );\n};\n\nexport const Select: React.FC<SelectProps> = (props) => (\n <HookFormWrapper formContext={ props.formContext }>\n <SelectField { ...props } />\n </HookFormWrapper>\n);\n"],"mappings":";AAAA,YAAY;;AAAC,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,MAAA;AAEb,IAAAC,MAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AAYA,MAAMU,WAAkC,GAAGA,CACzC;EACEC,KAAK,EAAE;IACLC,EAAE;IACFC,IAAI;IACJC,WAAW;IACXC,YAAY;IACZC,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;IACjBC,QAAQ,GAAGA,CAAA,KAAM,CAAC,CAAC;IACnBC,SAAS,GAAGA,CAAA,KAAM,CAAC,CAAC;IACpBC,SAAS,GAAGA,CAAA,KAAM,CAAC,CAAC;IACpBC,kBAAkB,GAAG,IAAI;IACzBC,gBAAgB,GAAG,eAAe;IAClCC;EACF,CAAC;EACDC,UAAU;EACVC,WAAW;EACXC,gBAAgB;EAChBC;AACF,CAAC,KACE;EACH,MAAM;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAG,IAAAC,6BAAc,EAAC,CAAC;EACpD,MAAMC,UAAU,GAAGF,aAAa,CAACf,IAAI,CAAC;EAEtC,MAAMkB,cAAc,GAAIC,KAAyC,IAAK;IACpE,MAAM;MAAEC;IAAO,CAAC,GAAGD,KAAK;IACxB,IAAIC,MAAM,EAAE;MACVhB,QAAQ,CAACe,KAAK,CAAC;IACjB;EACF,CAAC;EAED,MAAME,YAAY,GAAIF,KAAyC,IAAK;IAClE,MAAM;MAAEC;IAAO,CAAC,GAAGD,KAAK;IACxB,IAAIC,MAAM,EAAE;MACVd,SAAS,CAAC,CAAC;MACXH,MA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M,CAAG;MAACxC,KAAK,EAAGwC;IAAkB,GACnGA,MACI,CAAC;EAEb,CAAC;EAED,oBACEtC,MAAA,CAAAyC,OAAA,CAAAC,aAAA,CAAA1C,MAAA,CAAAyC,OAAA,CAAAM,QAAA,QACI3B,aAAa,EAAE4B,QAAQ,iBAAIhD,MAAA,CAAAyC,OAAA,CAAAC,aAAA;IAAMR,SAAS,EAAC;EAAU,GAAGd,aAAa,EAAE4B,QAAgB,CAAC,eAE1FhD,MAAA,CAAAyC,OAAA,CAAAC,aAAA,WAAaT,WAAW,EACpBnB,kBAAkB,iBAAId,MAAA,CAAAyC,OAAA,CAAAC,aAAA;IAAQ5C,KAAK,EAAC;EAAE,GAAGiB,gBAA0B,CAAC,EACnEC,OAAO,EAAyBiC,GAAG,CAACZ,YAAY,CAC7C,CAAC,EAEPjB,aAAa,EAAE8B,SAAS,iBAAIlD,MAAA,CAAAyC,OAAA,CAAAC,aAAA;IAAMR,SAAS,EAAC;EAAW,GAAGd,aAAa,EAAE8B,SAAiB,CAC5F,CAAC;AAEP,CAAC;AAEM,MAAMnD,MAA6B,GAAIoD,KAAK,iBACjDnD,MAAA,CAAAyC,OAAA,CAAAC,aAAA,CAACxC,gBAAA,CAAAkD,eAAe;EAACC,WAAW,EAAGF,KAAK,CAACE;AAAa,gBAChDrD,MAAA,CAAAyC,OAAA,CAAAC,aAAA,CAACtC,WAAW,EAAM+C,KAAS,CACZ,CAClB;AAACtD,OAAA,CAAAE,MAAA,GAAAA,MAAA","ignoreList":[]}
|
|
@@ -8,36 +8,15 @@ exports.Textarea = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactHookForm = require("react-hook-form");
|
|
10
10
|
var _HookFormWrapper = require("../../../hookFormWrapper/HookFormWrapper");
|
|
11
|
-
var _formUtilities = require("../../utilities/formUtilities");
|
|
12
11
|
var _ValidationMessages = require("../../../validation/ValidationMessages");
|
|
12
|
+
var _stringHelpers = require("../../../../../helpers/stringHelpers");
|
|
13
|
+
require("./textarea.css");
|
|
13
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function getCharacterCount(value) {
|
|
20
|
-
if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {
|
|
21
|
-
const segmenter = new Intl.Segmenter(undefined, {
|
|
22
|
-
granularity: 'grapheme'
|
|
23
|
-
});
|
|
24
|
-
return Array.from(segmenter.segment(value)).length;
|
|
25
|
-
}
|
|
26
|
-
return Array.from(value).length;
|
|
27
|
-
}
|
|
28
|
-
function clampToGraphemeMax(value, maxAllowed) {
|
|
29
|
-
if (getCharacterCount(value) <= maxAllowed) {
|
|
30
|
-
return value;
|
|
31
|
-
}
|
|
32
|
-
if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {
|
|
33
|
-
const segmenter = new Intl.Segmenter(undefined, {
|
|
34
|
-
granularity: 'grapheme'
|
|
35
|
-
});
|
|
36
|
-
return Array.from(segmenter.segment(value)).slice(0, maxAllowed).map(segment => segment.segment).join('');
|
|
37
|
-
}
|
|
38
|
-
return Array.from(value).slice(0, maxAllowed).join('');
|
|
39
|
-
}
|
|
40
|
-
const Textarea = ({
|
|
15
|
+
const Textarea = props => /*#__PURE__*/_react.default.createElement(_HookFormWrapper.HookFormWrapper, {
|
|
16
|
+
formContext: props.formContext
|
|
17
|
+
}, /*#__PURE__*/_react.default.createElement(TextareaField, props));
|
|
18
|
+
exports.Textarea = Textarea;
|
|
19
|
+
const TextareaField = ({
|
|
41
20
|
field: {
|
|
42
21
|
id,
|
|
43
22
|
name,
|
|
@@ -62,20 +41,16 @@ const Textarea = ({
|
|
|
62
41
|
formState: {
|
|
63
42
|
errors
|
|
64
43
|
}
|
|
65
|
-
} = (0, _reactHookForm.useFormContext)()
|
|
44
|
+
} = (0, _reactHookForm.useFormContext)();
|
|
66
45
|
const fieldState = getFieldState(name);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
const [count, setCount] = (0, _react.useState)(() => getCharacterCount(defaultValue?.toString() || ''));
|
|
46
|
+
// getFieldState alone does not subscribe to errors, so the direct lookup keeps this in sync.
|
|
47
|
+
const isInvalid = Boolean(fieldState?.invalid || (0, _ValidationMessages.extractError)(errors, name));
|
|
48
|
+
const isRequiredError = fieldState?.error?.type === 'required';
|
|
49
|
+
const [count, setCount] = (0, _react.useState)(() => (0, _stringHelpers.getCharacterCount)(defaultValue?.toString() || ''));
|
|
72
50
|
const [hasStartedTyping, setHasStartedTyping] = (0, _react.useState)(false);
|
|
73
51
|
const hasMaxLength = typeof maxLength === 'number';
|
|
74
52
|
const isAtLimit = hasMaxLength ? count >= maxLength : false;
|
|
75
|
-
|
|
76
|
-
// should show counter instead of error message.
|
|
77
|
-
const isRequiredError = fieldState?.error?.type === 'required';
|
|
78
|
-
const characterCounter = !hasStartedTyping || !hasMaxLength || isRequiredError ? undefined : `${count}/${maxLength}`;
|
|
53
|
+
const showsCharacterCount = hasStartedTyping && hasMaxLength && !isRequiredError;
|
|
79
54
|
const cssClass = `${customCssClasses?.input || ''}${isInvalid ? ' invalidField' : ''}`;
|
|
80
55
|
const normalizedValidation = (0, _react.useMemo)(() => {
|
|
81
56
|
if (!validation || typeof validation.maxLength === 'undefined') {
|
|
@@ -87,7 +62,7 @@ const Textarea = ({
|
|
|
87
62
|
return validation;
|
|
88
63
|
}
|
|
89
64
|
const maxLengthMessage = `Maximum length is ${maxLengthValue}`;
|
|
90
|
-
const graphemeMaxLengthValidator = value => getCharacterCount(value || '') <= maxLengthValue || maxLengthMessage;
|
|
65
|
+
const graphemeMaxLengthValidator = value => (0, _stringHelpers.getCharacterCount)(value || '') <= maxLengthValue || maxLengthMessage;
|
|
91
66
|
|
|
92
67
|
// eslint-disable-next-line no-unused-vars
|
|
93
68
|
const {
|
|
@@ -121,37 +96,53 @@ const Textarea = ({
|
|
|
121
96
|
validate: graphemeMaxLengthValidator
|
|
122
97
|
};
|
|
123
98
|
}, [validation]);
|
|
124
|
-
const
|
|
99
|
+
const fieldRegistration = register(name, normalizedValidation);
|
|
125
100
|
|
|
126
101
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* can be treated as multiple characters. We avoid using native maxLength and enforce
|
|
130
|
-
* the limit here instead.
|
|
102
|
+
* Native maxLength counts UTF-16 units, so emojis and composed characters are treated as
|
|
103
|
+
* several characters. The limit is enforced here against grapheme clusters instead.
|
|
131
104
|
*/
|
|
132
105
|
const HandleBeforeInput = event => {
|
|
133
|
-
if (enforceMaxLength !== true || !hasMaxLength)
|
|
106
|
+
if (enforceMaxLength !== true || !hasMaxLength) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
134
109
|
const nativeEvent = event.nativeEvent;
|
|
135
110
|
const inserted = nativeEvent.data ?? '';
|
|
136
|
-
if (!inserted)
|
|
111
|
+
if (!inserted) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
137
114
|
const target = event.currentTarget;
|
|
138
115
|
const start = target.selectionStart ?? target.value.length;
|
|
139
116
|
const end = target.selectionEnd ?? target.value.length;
|
|
140
117
|
const nextValue = target.value.slice(0, start) + inserted + target.value.slice(end);
|
|
141
|
-
if (getCharacterCount(nextValue) > maxLength) {
|
|
118
|
+
if ((0, _stringHelpers.getCharacterCount)(nextValue) > maxLength) {
|
|
142
119
|
event.preventDefault();
|
|
143
120
|
}
|
|
144
121
|
};
|
|
145
122
|
const HandleChange = event => {
|
|
146
123
|
const rawValue = event.target.value || '';
|
|
147
|
-
const newValue = enforceMaxLength === true && hasMaxLength ? clampToGraphemeMax(rawValue, maxLength) : rawValue;
|
|
124
|
+
const newValue = enforceMaxLength === true && hasMaxLength ? (0, _stringHelpers.clampToGraphemeMax)(rawValue, maxLength) : rawValue;
|
|
148
125
|
if (newValue !== rawValue) {
|
|
149
126
|
event.target.value = newValue;
|
|
150
127
|
}
|
|
151
128
|
setHasStartedTyping(true);
|
|
152
|
-
setCount(getCharacterCount(newValue));
|
|
153
|
-
|
|
154
|
-
|
|
129
|
+
setCount((0, _stringHelpers.getCharacterCount)(newValue));
|
|
130
|
+
onChange(event);
|
|
131
|
+
fieldRegistration?.onChange?.(event);
|
|
132
|
+
};
|
|
133
|
+
const HandleAutoFill = event => {
|
|
134
|
+
// Browsers trigger onAnimationStart when autofill happens.
|
|
135
|
+
// We need to notify react-hook-form of the new value.
|
|
136
|
+
if (event.animationName === 'onAutoFill') {
|
|
137
|
+
const {
|
|
138
|
+
value
|
|
139
|
+
} = event.currentTarget;
|
|
140
|
+
setHasStartedTyping(true);
|
|
141
|
+
setCount((0, _stringHelpers.getCharacterCount)(value || ''));
|
|
142
|
+
HandleChange({
|
|
143
|
+
target: event.currentTarget
|
|
144
|
+
});
|
|
145
|
+
}
|
|
155
146
|
};
|
|
156
147
|
const HandleOnBlur = event => {
|
|
157
148
|
const {
|
|
@@ -161,17 +152,12 @@ const Textarea = ({
|
|
|
161
152
|
onTouched();
|
|
162
153
|
onBlur(event);
|
|
163
154
|
}
|
|
155
|
+
fieldRegistration?.onBlur?.(event);
|
|
164
156
|
};
|
|
165
157
|
const HandleKeyEvent = event => {
|
|
166
158
|
onTouched();
|
|
167
|
-
|
|
168
|
-
onTextareaKeyDown?.(event);
|
|
159
|
+
onKeyDown(event);
|
|
169
160
|
};
|
|
170
|
-
const characterCounterId = `${id}_characterCount`;
|
|
171
|
-
const errorsId = `${name}_errors`;
|
|
172
|
-
const existingDescribedBy = typeof htmlNativeDomProps['aria-describedby'] === 'string' ? htmlNativeDomProps['aria-describedby'] : undefined;
|
|
173
|
-
const showsRequiredError = isInvalid && isRequiredError;
|
|
174
|
-
const mergedDescribedBy = showsRequiredError ? [existingDescribedBy, errorsId].filter(Boolean).join(' ') : characterCounter !== undefined ? [existingDescribedBy, characterCounterId].filter(Boolean).join(' ') : existingDescribedBy;
|
|
175
161
|
const textareaProps = {
|
|
176
162
|
id,
|
|
177
163
|
className: cssClass,
|
|
@@ -183,40 +169,26 @@ const Textarea = ({
|
|
|
183
169
|
...(validation && typeof validation.required !== 'undefined' ? {
|
|
184
170
|
required: true
|
|
185
171
|
} : {}),
|
|
186
|
-
...
|
|
172
|
+
...htmlNativeDomProps,
|
|
173
|
+
...fieldRegistration,
|
|
187
174
|
onBeforeInput: HandleBeforeInput,
|
|
188
|
-
onChange:
|
|
189
|
-
|
|
190
|
-
registered?.onChange?.(event);
|
|
191
|
-
},
|
|
192
|
-
onBlur: event => {
|
|
193
|
-
HandleOnBlur(event);
|
|
194
|
-
registered?.onBlur?.(event);
|
|
195
|
-
},
|
|
175
|
+
onChange: HandleChange,
|
|
176
|
+
onBlur: HandleOnBlur,
|
|
196
177
|
onKeyDown: HandleKeyEvent,
|
|
197
|
-
|
|
198
|
-
'aria-describedby': mergedDescribedBy
|
|
178
|
+
onAnimationStart: HandleAutoFill
|
|
199
179
|
};
|
|
200
|
-
|
|
180
|
+
const containerCssClass = `textareaFieldContainer${showsCharacterCount ? ' withCharacterCount' : ''}`;
|
|
181
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, customContent?.preField && /*#__PURE__*/_react.default.createElement("span", {
|
|
201
182
|
className: "preField"
|
|
202
|
-
}, customContent?.preField), /*#__PURE__*/_react.default.createElement("
|
|
203
|
-
className:
|
|
204
|
-
}, /*#__PURE__*/_react.default.createElement("textarea", textareaProps), /*#__PURE__*/_react.default.createElement("
|
|
205
|
-
className: "textareaFooter"
|
|
206
|
-
}, isInvalid && isRequiredError ? /*#__PURE__*/_react.default.createElement(_ValidationMessages.ValidationMessages, {
|
|
207
|
-
name: name,
|
|
208
|
-
validation: {
|
|
209
|
-
required: validation?.required
|
|
210
|
-
}
|
|
211
|
-
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
212
|
-
id: characterCounterId,
|
|
183
|
+
}, customContent?.preField), /*#__PURE__*/_react.default.createElement("span", {
|
|
184
|
+
className: containerCssClass
|
|
185
|
+
}, /*#__PURE__*/_react.default.createElement("textarea", textareaProps), showsCharacterCount && /*#__PURE__*/_react.default.createElement("span", {
|
|
213
186
|
className: `textareaCharacterCount ${isAtLimit ? 'textareaCharacterCountExceeded' : ''}`,
|
|
214
187
|
role: isAtLimit ? 'status' : undefined,
|
|
215
188
|
"aria-live": isAtLimit ? 'polite' : undefined,
|
|
216
189
|
"aria-atomic": isAtLimit ? 'true' : undefined
|
|
217
|
-
},
|
|
190
|
+
}, `${count}/${maxLength}`)), customContent?.postField && /*#__PURE__*/_react.default.createElement("span", {
|
|
218
191
|
className: "postField"
|
|
219
192
|
}, customContent?.postField));
|
|
220
193
|
};
|
|
221
|
-
exports.Textarea = Textarea;
|
|
222
194
|
//# sourceMappingURL=Textarea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","names":["Object","defineProperty","exports","value","Textarea","_react","_interopRequireWildcard","require","_reactHookForm","_HookFormWrapper","_formUtilities","_ValidationMessages","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","getCharacterCount","Intl","segmenter","Segmenter","undefined","granularity","Array","from","segment","length","clampToGraphemeMax","maxAllowed","slice","map","join","field","id","name","placeholder","defaultValue","maxLength","enforceMaxLength","onBlur","onChange","onKeyDown","onTouched","htmlNativeDomProps","validation","showSpinner","customCssClasses","customContent","register","getFieldState","formState","errors","useFormContext","NoHookFormContext","fieldState","hasFieldError","Boolean","extractError","isInvalid","invalid","count","setCount","useState","toString","hasStartedTyping","setHasStartedTyping","hasMaxLength","isAtLimit","isRequiredError","error","type","characterCounter","cssClass","input","normalizedValidation","useMemo","maxLengthRule","maxLengthValue","Number","isNaN","maxLengthMessage","graphemeMaxLengthValidator","_maxLength","validate","restValidation","formValues","validationResult","graphemeMaxLength","registered","HandleBeforeInput","event","nativeEvent","inserted","data","target","currentTarget","start","selectionStart","end","selectionEnd","nextValue","preventDefault","HandleChange","rawValue","newValue","onTextareaChange","HandleOnBlur","HandleKeyEvent","onTextareaKeyDown","characterCounterId","errorsId","existingDescribedBy","showsRequiredError","mergedDescribedBy","filter","textareaProps","className","disabled","required","onBeforeInput","createElement","HookFormWrapper","preField","ValidationMessages","role","postField"],"sources":["../../../../../../../src/components/form/formFields/subComponents/textarea/Textarea.tsx"],"sourcesContent":["'use client';\n\nimport React, { useMemo, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { HookFormWrapper } from '../../../hookFormWrapper/HookFormWrapper';\nimport { FormFieldProps } from '../../formFieldWrapper/formFieldProps';\nimport { NoHookFormContext } from '../../utilities/formUtilities';\nimport { extractError, ValidationMessages } from '../../../validation/ValidationMessages';\n\ninterface TextareaProps extends FormFieldProps, React.TextareaHTMLAttributes<HTMLTextAreaElement> {}\n\n/**\n* Counts user-perceived characters (grapheme clusters).\n* Treats emojis and composed characters (e.g. accented letters) as a single character.\n* Falls back to basic code-point counting if Intl.Segmenter is not available.\n*/\nfunction getCharacterCount(value: string): number {\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, {\n granularity: 'grapheme',\n });\n return Array.from(segmenter.segment(value)).length;\n }\n return Array.from(value).length;\n}\n\nfunction clampToGraphemeMax(value: string, maxAllowed: number): string {\n if (getCharacterCount(value) <= maxAllowed) {\n return value;\n }\n\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, {\n granularity: 'grapheme',\n });\n\n return Array.from(segmenter.segment(value))\n .slice(0, maxAllowed)\n .map((segment) => segment.segment)\n .join('');\n }\n\n return Array.from(value).slice(0, maxAllowed).join('');\n}\n\nexport const Textarea: React.FC<TextareaProps> = (\n {\n field: {\n id,\n name,\n placeholder,\n defaultValue,\n maxLength,\n enforceMaxLength,\n onBlur = () => {},\n onChange = () => {},\n onKeyDown = () => {},\n onTouched = () => {},\n ...htmlNativeDomProps\n },\n validation,\n showSpinner,\n customCssClasses,\n customContent\n }\n) => {\n const { register, getFieldState, formState: { errors } } = useFormContext() || NoHookFormContext;\n const fieldState = getFieldState(name);\n const hasFieldError = Boolean(extractError(errors, name));\n // Combine fieldState.invalid with a direct errors lookup so this component re-renders\n // whenever formState.errors changes (getFieldState alone does not subscribe to errors).\n const isInvalid = Boolean(fieldState?.invalid ?? hasFieldError);\n const [count, setCount] = useState<number>(() =>\n getCharacterCount(defaultValue?.toString() || '')\n );\n const [hasStartedTyping, setHasStartedTyping] = useState(false);\n const hasMaxLength = typeof maxLength === 'number';\n const isAtLimit = hasMaxLength ? count >= maxLength : false;\n // Only hide counter for 'required' error. All other errors (maxLength, pattern, etc)\n // should show counter instead of error message.\n const isRequiredError = fieldState?.error?.type === 'required';\n const characterCounter =\n !hasStartedTyping || !hasMaxLength || isRequiredError\n ? undefined\n : `${ count }/${ maxLength }`;\n const cssClass = `${ customCssClasses?.input || '' }${ isInvalid ? ' invalidField' : '' }`;\n\n const normalizedValidation = useMemo(() => {\n if (!validation || typeof validation.maxLength === 'undefined') {\n return validation;\n }\n\n const maxLengthRule = validation.maxLength;\n const maxLengthValue =\n typeof maxLengthRule === 'number'\n ? maxLengthRule\n : typeof maxLengthRule === 'object' && maxLengthRule && 'value' in maxLengthRule\n ? Number(maxLengthRule.value)\n : undefined;\n\n if (typeof maxLengthValue !== 'number' || Number.isNaN(maxLengthValue)) {\n return validation;\n }\n\n const maxLengthMessage = `Maximum length is ${ maxLengthValue }`;\n\n const graphemeMaxLengthValidator = (value: string) =>\n getCharacterCount(value || '') <= maxLengthValue || maxLengthMessage;\n\n // eslint-disable-next-line no-unused-vars\n const { maxLength: _maxLength, validate, ...restValidation } = validation;\n\n if (typeof validate === 'function') {\n return {\n ...restValidation,\n validate: async (value: string, formValues?: unknown) => {\n const validationResult = await validate(value, formValues);\n if (validationResult !== true) {\n return validationResult;\n }\n return graphemeMaxLengthValidator(value);\n },\n };\n }\n\n if (validate && typeof validate === 'object') {\n return {\n ...restValidation,\n validate: {\n ...validate,\n graphemeMaxLength: graphemeMaxLengthValidator,\n },\n };\n }\n\n return {\n ...restValidation,\n validate: graphemeMaxLengthValidator,\n };\n }, [validation]);\n\n const registered = register(name, normalizedValidation);\n\n /**\n * Prevents input that would exceed the maxLength when counting grapheme clusters.\n * Native <textarea maxLength> counts UTF-16 units, so emojis and composed characters\n * can be treated as multiple characters. We avoid using native maxLength and enforce\n * the limit here instead.\n */\n const HandleBeforeInput = (event: React.FormEvent<HTMLTextAreaElement>) => {\n if (enforceMaxLength !== true || !hasMaxLength) return;\n\n const nativeEvent = event.nativeEvent as InputEvent;\n const inserted = nativeEvent.data ?? '';\n\n if (!inserted) return;\n\n const target = event.currentTarget;\n const start = target.selectionStart ?? target.value.length;\n const end = target.selectionEnd ?? target.value.length;\n\n const nextValue =\n target.value.slice(0, start) +\n inserted +\n target.value.slice(end);\n\n if (getCharacterCount(nextValue) > maxLength) {\n event.preventDefault();\n }\n };\n\n const HandleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n const rawValue = event.target.value || '';\n const newValue =\n enforceMaxLength === true && hasMaxLength\n ? clampToGraphemeMax(rawValue, maxLength)\n : rawValue;\n\n if (newValue !== rawValue) {\n event.target.value = newValue;\n }\n\n setHasStartedTyping(true);\n setCount(getCharacterCount(newValue));\n const onTextareaChange = onChange as\n | React.ChangeEventHandler<HTMLTextAreaElement>\n | undefined;\n onTextareaChange?.(event);\n };\n\n const HandleOnBlur = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n const { target } = event;\n if (target) {\n onTouched();\n onBlur(event);\n }\n };\n\n const HandleKeyEvent = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n onTouched();\n const onTextareaKeyDown = onKeyDown as\n | React.KeyboardEventHandler<HTMLTextAreaElement>\n | undefined;\n onTextareaKeyDown?.(event);\n };\n\n const characterCounterId = `${ id }_characterCount`;\n const errorsId = `${ name }_errors`;\n const existingDescribedBy =\n typeof htmlNativeDomProps['aria-describedby'] === 'string'\n ? htmlNativeDomProps['aria-describedby']\n : undefined;\n const showsRequiredError = isInvalid && isRequiredError;\n const mergedDescribedBy = showsRequiredError\n ? [existingDescribedBy, errorsId].filter(Boolean).join(' ')\n : characterCounter !== undefined\n ? [existingDescribedBy, characterCounterId].filter(Boolean).join(' ')\n : existingDescribedBy;\n \n const textareaProps = {\n id,\n className: cssClass,\n placeholder,\n defaultValue,\n ...(showSpinner ? { disabled: true } : {}),\n ...(validation && typeof validation.required !== 'undefined' ? { required: true } : {}),\n ...registered,\n onBeforeInput: HandleBeforeInput,\n onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n HandleChange(event);\n registered?.onChange?.(event);\n },\n onBlur: (event: React.FocusEvent<HTMLTextAreaElement>) => {\n HandleOnBlur(event);\n registered?.onBlur?.(event);\n },\n onKeyDown: HandleKeyEvent,\n ...htmlNativeDomProps,\n 'aria-describedby': mergedDescribedBy,\n };\n\n return (\n <HookFormWrapper>\n { customContent?.preField && <span className=\"preField\">{ customContent?.preField }</span> }\n\n <div className=\"textareaFieldContainer\">\n <textarea { ...textareaProps } /> \n\n <div className=\"textareaFooter\">\n { isInvalid && isRequiredError\n ? <ValidationMessages name={ name } validation={ { required: validation?.required } } />\n : (\n <div\n id={ characterCounterId }\n className={ `textareaCharacterCount ${\n isAtLimit\n ? 'textareaCharacterCountExceeded'\n : ''\n }` }\n role={ isAtLimit ? 'status' : undefined }\n aria-live={ isAtLimit ? 'polite' : undefined }\n aria-atomic={ isAtLimit ? 'true' : undefined }\n >\n { characterCounter }\n </div>\n )\n }\n </div>\n </div>\n\n { customContent?.postField && <span className=\"postField\">{ customContent?.postField }</span> }\n </HookFormWrapper>\n );\n};\n"],"mappings":";AAAA,YAAY;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,QAAA;AAEb,IAAAC,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AAA0F,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAlB,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAA4B,wBAAA,CAAAhB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EA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,aAAiB,CAAC,eAEjC1H,MAAA,CAAAiB,OAAA,CAAA8G,aAAA;IAAKJ,SAAS,EAAC;EAAgB,GAC3B1D,SAAS,IAAIU,eAAe,gBAC1B3E,MAAA,CAAAiB,OAAA,CAAA8G,aAAA,CAACzH,mBAAA,CAAA4H,kBAAkB;IAACzF,IAAI,EAAGA,IAAM;IAACU,UAAU,EAAG;MAAE0E,QAAQ,EAAE1E,UAAU,EAAE0E;IAAS;EAAG,CAAE,CAAC,gBAEtF7H,MAAA,CAAAiB,OAAA,CAAA8G,aAAA;IACEvF,EAAE,EAAG4E,kBAAoB;IACzBO,SAAS,EAAG,0BACVjD,SAAS,GACL,gCAAgC,GAChC,EAAE,EACJ;IACJyD,IAAI,EAAGzD,SAAS,GAAG,QAAQ,GAAG9C,SAAW;IACzC,aAAY8C,SAAS,GAAG,QAAQ,GAAG9C,SAAW;IAC9C,eAAc8C,SAAS,GAAG,MAAM,GAAG9C;EAAW,GAE5CkD,gBACC,CAGN,CACF,CAAC,EAEJxB,aAAa,EAAE8E,SAAS,iBAAIpI,MAAA,CAAAiB,OAAA,CAAA8G,aAAA;IAAMJ,SAAS,EAAC;EAAW,GAAGrE,aAAa,EAAE8E,SAAiB,CAC7E,CAAC;AAEtB,CAAC;AAACvI,OAAA,CAAAE,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Textarea.js","names":["Object","defineProperty","exports","value","Textarea","_react","_interopRequireWildcard","require","_reactHookForm","_HookFormWrapper","_ValidationMessages","_stringHelpers","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","props","createElement","HookFormWrapper","formContext","TextareaField","field","id","name","placeholder","defaultValue","maxLength","enforceMaxLength","onBlur","onChange","onKeyDown","onTouched","htmlNativeDomProps","validation","showSpinner","customCssClasses","customContent","register","getFieldState","formState","errors","useFormContext","fieldState","isInvalid","Boolean","invalid","extractError","isRequiredError","error","type","count","setCount","useState","getCharacterCount","toString","hasStartedTyping","setHasStartedTyping","hasMaxLength","isAtLimit","showsCharacterCount","cssClass","input","normalizedValidation","useMemo","maxLengthRule","maxLengthValue","Number","undefined","isNaN","maxLengthMessage","graphemeMaxLengthValidator","_maxLength","validate","restValidation","formValues","validationResult","graphemeMaxLength","fieldRegistration","HandleBeforeInput","event","nativeEvent","inserted","data","target","currentTarget","start","selectionStart","length","end","selectionEnd","nextValue","slice","preventDefault","HandleChange","rawValue","newValue","clampToGraphemeMax","HandleAutoFill","animationName","HandleOnBlur","HandleKeyEvent","textareaProps","className","disabled","required","onBeforeInput","onAnimationStart","containerCssClass","Fragment","preField","role","postField"],"sources":["../../../../../../../src/components/form/formFields/subComponents/textarea/Textarea.tsx"],"sourcesContent":["'use client';\n\nimport React, { useMemo, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { HookFormWrapper } from '../../../hookFormWrapper/HookFormWrapper';\nimport {\n FormFieldProps,\n TextareaFieldProps,\n} from '../../formFieldWrapper/formFieldProps';\nimport { extractError } from '../../../validation/ValidationMessages';\nimport { clampToGraphemeMax, getCharacterCount } from '../../../../../helpers/stringHelpers';\n\nimport './textarea.scss';\n\nexport interface TextareaProps extends Omit<FormFieldProps, 'field'> {\n field: Omit<TextareaFieldProps, 'type'>;\n}\n\nexport const Textarea: React.FC<TextareaProps> = (props) => (\n <HookFormWrapper formContext={ props.formContext }>\n <TextareaField { ...props } />\n </HookFormWrapper>\n);\n\nconst TextareaField: React.FC<TextareaProps> = (\n {\n field: {\n id,\n name,\n placeholder,\n defaultValue,\n maxLength,\n enforceMaxLength,\n onBlur = () => {},\n onChange = () => {},\n onKeyDown = () => {},\n onTouched = () => {},\n ...htmlNativeDomProps\n },\n validation,\n showSpinner,\n customCssClasses,\n customContent\n }\n) => {\n const { register, getFieldState, formState: { errors } } = useFormContext();\n const fieldState = getFieldState(name);\n // getFieldState alone does not subscribe to errors, so the direct lookup keeps this in sync.\n const isInvalid = Boolean(fieldState?.invalid || extractError(errors, name));\n const isRequiredError = fieldState?.error?.type === 'required';\n\n const [count, setCount] = useState<number>(() => getCharacterCount(defaultValue?.toString() || ''));\n const [hasStartedTyping, setHasStartedTyping] = useState(false);\n\n const hasMaxLength = typeof maxLength === 'number';\n const isAtLimit = hasMaxLength ? count >= maxLength : false;\n const showsCharacterCount = hasStartedTyping && hasMaxLength && !isRequiredError;\n\n const cssClass = `${ customCssClasses?.input || '' }${ isInvalid ? ' invalidField' : '' }`;\n\n const normalizedValidation = useMemo(() => {\n if (!validation || typeof validation.maxLength === 'undefined') {\n return validation;\n }\n\n const maxLengthRule = validation.maxLength;\n const maxLengthValue =\n typeof maxLengthRule === 'number'\n ? maxLengthRule\n : typeof maxLengthRule === 'object' && maxLengthRule && 'value' in maxLengthRule\n ? Number(maxLengthRule.value)\n : undefined;\n\n if (typeof maxLengthValue !== 'number' || Number.isNaN(maxLengthValue)) {\n return validation;\n }\n\n const maxLengthMessage = `Maximum length is ${ maxLengthValue }`;\n\n const graphemeMaxLengthValidator = (value: string) =>\n getCharacterCount(value || '') <= maxLengthValue || maxLengthMessage;\n\n // eslint-disable-next-line no-unused-vars\n const { maxLength: _maxLength, validate, ...restValidation } = validation;\n\n if (typeof validate === 'function') {\n return {\n ...restValidation,\n validate: async (value: string, formValues?: unknown) => {\n const validationResult = await validate(value, formValues);\n\n if (validationResult !== true) {\n return validationResult;\n }\n\n return graphemeMaxLengthValidator(value);\n },\n };\n }\n\n if (validate && typeof validate === 'object') {\n return {\n ...restValidation,\n validate: {\n ...validate,\n graphemeMaxLength: graphemeMaxLengthValidator,\n },\n };\n }\n\n return {\n ...restValidation,\n validate: graphemeMaxLengthValidator,\n };\n }, [validation]);\n\n const fieldRegistration = register(name, normalizedValidation);\n\n /**\n * Native maxLength counts UTF-16 units, so emojis and composed characters are treated as\n * several characters. The limit is enforced here against grapheme clusters instead.\n */\n const HandleBeforeInput = (event: React.FormEvent<HTMLTextAreaElement>) => {\n if (enforceMaxLength !== true || !hasMaxLength) {\n return;\n }\n\n const nativeEvent = event.nativeEvent as InputEvent;\n const inserted = nativeEvent.data ?? '';\n\n if (!inserted) {\n return;\n }\n\n const target = event.currentTarget;\n const start = target.selectionStart ?? target.value.length;\n const end = target.selectionEnd ?? target.value.length;\n const nextValue = target.value.slice(0, start) + inserted + target.value.slice(end);\n\n if (getCharacterCount(nextValue) > maxLength) {\n event.preventDefault();\n }\n };\n\n const HandleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n const rawValue = event.target.value || '';\n const newValue = enforceMaxLength === true && hasMaxLength\n ? clampToGraphemeMax(rawValue, maxLength)\n : rawValue;\n\n if (newValue !== rawValue) {\n event.target.value = newValue;\n }\n\n setHasStartedTyping(true);\n setCount(getCharacterCount(newValue));\n\n (onChange as React.ChangeEventHandler<HTMLTextAreaElement>)(event);\n fieldRegistration?.onChange?.(event);\n };\n\n const HandleAutoFill = (event: React.AnimationEvent<HTMLTextAreaElement>) => {\n // Browsers trigger onAnimationStart when autofill happens.\n // We need to notify react-hook-form of the new value.\n if (event.animationName === 'onAutoFill') {\n const { value } = event.currentTarget;\n setHasStartedTyping(true);\n setCount(getCharacterCount(value || ''));\n HandleChange({ target: event.currentTarget } as unknown as React.ChangeEvent<HTMLTextAreaElement>);\n }\n };\n\n const HandleOnBlur = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n const { target } = event;\n\n if (target) {\n onTouched();\n (onBlur as React.FocusEventHandler<HTMLTextAreaElement>)(event);\n }\n\n fieldRegistration?.onBlur?.(event);\n };\n\n const HandleKeyEvent = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n onTouched();\n (onKeyDown as React.KeyboardEventHandler<HTMLTextAreaElement>)(event);\n };\n\n const textareaProps = {\n id,\n className: cssClass,\n placeholder,\n defaultValue,\n ...(showSpinner ? { disabled: true } : {}),\n ...(validation && typeof validation.required !== 'undefined' ? { required: true } : {}),\n ...htmlNativeDomProps,\n ...fieldRegistration,\n onBeforeInput: HandleBeforeInput,\n onChange: HandleChange,\n onBlur: HandleOnBlur,\n onKeyDown: HandleKeyEvent,\n onAnimationStart: HandleAutoFill,\n };\n\n const containerCssClass = `textareaFieldContainer${ showsCharacterCount ? ' withCharacterCount' : '' }`;\n\n return (\n <>\n { customContent?.preField && <span className=\"preField\">{ customContent?.preField }</span> }\n\n <span className={ containerCssClass }>\n <textarea { ...textareaProps } />\n\n {\n showsCharacterCount && (\n <span\n className={ `textareaCharacterCount ${ isAtLimit ? 'textareaCharacterCountExceeded' : '' }` }\n role={ isAtLimit ? 'status' : undefined }\n aria-live={ isAtLimit ? 'polite' : undefined }\n aria-atomic={ isAtLimit ? 'true' : undefined }\n >\n { `${ count }/${ maxLength }` }\n </span>\n )\n }\n </span>\n\n { customContent?.postField && <span className=\"postField\">{ customContent?.postField }</span> }\n </>\n );\n};\n"],"mappings":";AAAA,YAAY;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,QAAA;AAEb,IAAAC,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAKA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAEAA,OAAA;AAAyB,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CA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gBAAgB,EAAET;EACpB,CAAC;EAED,MAAMU,iBAAiB,GAAG,yBAA0BhD,mBAAmB,GAAG,qBAAqB,GAAG,EAAE,EAAG;EAEvG,oBACEnE,MAAA,CAAAiB,OAAA,CAAAQ,aAAA,CAAAzB,MAAA,CAAAiB,OAAA,CAAAmG,QAAA,QACIxE,aAAa,EAAEyE,QAAQ,iBAAIrH,MAAA,CAAAiB,OAAA,CAAAQ,aAAA;IAAMqF,SAAS,EAAC;EAAU,GAAGlE,aAAa,EAAEyE,QAAgB,CAAC,eAE1FrH,MAAA,CAAAiB,OAAA,CAAAQ,aAAA;IAAMqF,SAAS,EAAGK;EAAmB,gBACnCnH,MAAA,CAAAiB,OAAA,CAAAQ,aAAA,aAAeoF,aAAiB,CAAC,EAG/B1C,mBAAmB,iBACjBnE,MAAA,CAAAiB,OAAA,CAAAQ,aAAA;IACEqF,SAAS,EAAG,0BAA2B5C,SAAS,GAAG,gCAAgC,GAAG,EAAE,EAAK;IAC7FoD,IAAI,EAAGpD,SAAS,GAAG,QAAQ,GAAGS,SAAW;IACzC,aAAYT,SAAS,GAAG,QAAQ,GAAGS,SAAW;IAC9C,eAAcT,SAAS,GAAG,MAAM,GAAGS;EAAW,GAE5C,GAAIjB,KAAK,IAAMxB,SAAS,EACtB,CAGN,CAAC,EAELU,aAAa,EAAE2E,SAAS,iBAAIvH,MAAA,CAAAiB,OAAA,CAAAQ,aAAA;IAAMqF,SAAS,EAAC;EAAW,GAAGlE,aAAa,EAAE2E,SAAiB,CAC5F,CAAC;AAEP,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.textareaFieldContainer {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
}
|
|
5
|
+
.textareaFieldContainer.withCharacterCount textarea {
|
|
6
|
+
padding-bottom: 26px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.textareaCharacterCount {
|
|
10
|
+
line-height: 15px;
|
|
11
|
+
font-size: 13px;
|
|
12
|
+
color: var(--inputLabelColor);
|
|
13
|
+
position: absolute;
|
|
14
|
+
right: 10px;
|
|
15
|
+
bottom: 10px;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
}
|
|
18
|
+
.textareaCharacterCount.textareaCharacterCountExceeded {
|
|
19
|
+
color: var(--inputErrorColor);
|
|
20
|
+
}
|