@x15ventures/x15-ui-library 3.13.4 → 3.14.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/banners/pageBanner/PageBanner.js +4 -1
- package/dist/cjs/components/design/banners/pageBanner/PageBanner.js.map +1 -1
- package/dist/cjs/components/form/formFields/formFieldWrapper/FormField.js +1 -1
- 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/textarea/Textarea.js +159 -18
- package/dist/cjs/components/form/formFields/subComponents/textarea/Textarea.js.map +1 -1
- package/dist/cjs/components/form/validation/ValidationMessages.js +2 -1
- package/dist/cjs/components/form/validation/ValidationMessages.js.map +1 -1
- package/dist/cjs/package.json +17 -15
- package/dist/cjs/styles/index.css +25 -0
- package/dist/cjs/styles/shared/_allPartials.css +25 -0
- package/dist/cjs/styles/shared/forms/_forms.css +25 -0
- package/dist/components/design/banners/pageBanner/PageBanner.d.ts.map +1 -1
- package/dist/components/form/formFields/formFieldWrapper/FormField.test.d.ts +5 -0
- package/dist/components/form/formFields/formFieldWrapper/FormField.test.d.ts.map +1 -0
- package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts +11 -1
- package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/textarea/Textarea.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/textarea/Textarea.test.d.ts +5 -0
- package/dist/components/form/formFields/subComponents/textarea/Textarea.test.d.ts.map +1 -0
- package/dist/components/form/validation/ValidationMessages.d.ts +2 -0
- package/dist/components/form/validation/ValidationMessages.d.ts.map +1 -1
- 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/banners/pageBanner/PageBanner.js +5 -2
- package/dist/esm/components/design/banners/pageBanner/PageBanner.js.map +1 -1
- package/dist/esm/components/form/formFields/formFieldWrapper/FormField.js +1 -1
- 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/textarea/Textarea.js +158 -17
- package/dist/esm/components/form/formFields/subComponents/textarea/Textarea.js.map +1 -1
- package/dist/esm/components/form/validation/ValidationMessages.js +1 -1
- package/dist/esm/components/form/validation/ValidationMessages.js.map +1 -1
- package/dist/esm/package.json +17 -15
- package/dist/esm/styles/index.css +25 -0
- package/dist/esm/styles/shared/_allPartials.css +25 -0
- package/dist/esm/styles/shared/forms/_forms.css +25 -0
- package/dist/package.json +17 -15
- package/package.json +17 -15
- package/readme.md +1 -0
|
@@ -17,8 +17,8 @@ const libraryThemes = exports.libraryThemes = {
|
|
|
17
17
|
"map": "index.min.css.map"
|
|
18
18
|
},
|
|
19
19
|
"versioned": {
|
|
20
|
-
"css": "index.min.3.
|
|
21
|
-
"map": "index.min.3.
|
|
20
|
+
"css": "index.min.3.14.0.css",
|
|
21
|
+
"map": "index.min.3.14.0.css.map"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"cba": {
|
|
@@ -32,8 +32,8 @@ const libraryThemes = exports.libraryThemes = {
|
|
|
32
32
|
"map": "cba.min.css.map"
|
|
33
33
|
},
|
|
34
34
|
"versioned": {
|
|
35
|
-
"css": "cba.min.3.
|
|
36
|
-
"map": "cba.min.3.
|
|
35
|
+
"css": "cba.min.3.14.0.css",
|
|
36
|
+
"map": "cba.min.3.14.0.css.map"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"creditSavvy": {
|
|
@@ -47,8 +47,8 @@ const libraryThemes = exports.libraryThemes = {
|
|
|
47
47
|
"map": "creditSavvy.min.css.map"
|
|
48
48
|
},
|
|
49
49
|
"versioned": {
|
|
50
|
-
"css": "creditSavvy.min.3.
|
|
51
|
-
"map": "creditSavvy.min.3.
|
|
50
|
+
"css": "creditSavvy.min.3.14.0.css",
|
|
51
|
+
"map": "creditSavvy.min.3.14.0.css.map"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"doshii": {
|
|
@@ -62,8 +62,8 @@ const libraryThemes = exports.libraryThemes = {
|
|
|
62
62
|
"map": "doshii.min.css.map"
|
|
63
63
|
},
|
|
64
64
|
"versioned": {
|
|
65
|
-
"css": "doshii.min.3.
|
|
66
|
-
"map": "doshii.min.3.
|
|
65
|
+
"css": "doshii.min.3.14.0.css",
|
|
66
|
+
"map": "doshii.min.3.14.0.css.map"
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"homeIn": {
|
|
@@ -77,8 +77,8 @@ const libraryThemes = exports.libraryThemes = {
|
|
|
77
77
|
"map": "homeIn.min.css.map"
|
|
78
78
|
},
|
|
79
79
|
"versioned": {
|
|
80
|
-
"css": "homeIn.min.3.
|
|
81
|
-
"map": "homeIn.min.3.
|
|
80
|
+
"css": "homeIn.min.3.14.0.css",
|
|
81
|
+
"map": "homeIn.min.3.14.0.css.map"
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"x15Core": {
|
|
@@ -92,8 +92,8 @@ const libraryThemes = exports.libraryThemes = {
|
|
|
92
92
|
"map": "x15Core.min.css.map"
|
|
93
93
|
},
|
|
94
94
|
"versioned": {
|
|
95
|
-
"css": "x15Core.min.3.
|
|
96
|
-
"map": "x15Core.min.3.
|
|
95
|
+
"css": "x15Core.min.3.14.0.css",
|
|
96
|
+
"map": "x15Core.min.3.14.0.css.map"
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libraryThemes.js","names":["libraryThemes","exports","_default","default"],"sources":["../../../src/autoGenerated/libraryThemes.ts"],"sourcesContent":["/* eslint-disable */\nexport const libraryThemes = {\n \"base\": {\n \"buildPath\": \"styles\",\n \"dev\": {\n \"css\": \"index.css\",\n \"map\": \"index.css.map\"\n },\n \"min\": {\n \"css\": \"index.min.css\",\n \"map\": \"index.min.css.map\"\n },\n \"versioned\": {\n \"css\": \"index.min.3.
|
|
1
|
+
{"version":3,"file":"libraryThemes.js","names":["libraryThemes","exports","_default","default"],"sources":["../../../src/autoGenerated/libraryThemes.ts"],"sourcesContent":["/* eslint-disable */\nexport const libraryThemes = {\n \"base\": {\n \"buildPath\": \"styles\",\n \"dev\": {\n \"css\": \"index.css\",\n \"map\": \"index.css.map\"\n },\n \"min\": {\n \"css\": \"index.min.css\",\n \"map\": \"index.min.css.map\"\n },\n \"versioned\": {\n \"css\": \"index.min.3.14.0.css\",\n \"map\": \"index.min.3.14.0.css.map\"\n }\n },\n \"cba\": {\n \"buildPath\": \"styles/themes/cba\",\n \"dev\": {\n \"css\": \"cba.css\",\n \"map\": \"cba.css.map\"\n },\n \"min\": {\n \"css\": \"cba.min.css\",\n \"map\": \"cba.min.css.map\"\n },\n \"versioned\": {\n \"css\": \"cba.min.3.14.0.css\",\n \"map\": \"cba.min.3.14.0.css.map\"\n }\n },\n \"creditSavvy\": {\n \"buildPath\": \"styles/themes/creditSavvy\",\n \"dev\": {\n \"css\": \"creditSavvy.css\",\n \"map\": \"creditSavvy.css.map\"\n },\n \"min\": {\n \"css\": \"creditSavvy.min.css\",\n \"map\": \"creditSavvy.min.css.map\"\n },\n \"versioned\": {\n \"css\": \"creditSavvy.min.3.14.0.css\",\n \"map\": \"creditSavvy.min.3.14.0.css.map\"\n }\n },\n \"doshii\": {\n \"buildPath\": \"styles/themes/doshii\",\n \"dev\": {\n \"css\": \"doshii.css\",\n \"map\": \"doshii.css.map\"\n },\n \"min\": {\n \"css\": \"doshii.min.css\",\n \"map\": \"doshii.min.css.map\"\n },\n \"versioned\": {\n \"css\": \"doshii.min.3.14.0.css\",\n \"map\": \"doshii.min.3.14.0.css.map\"\n }\n },\n \"homeIn\": {\n \"buildPath\": \"styles/themes/homeIn\",\n \"dev\": {\n \"css\": \"homeIn.css\",\n \"map\": \"homeIn.css.map\"\n },\n \"min\": {\n \"css\": \"homeIn.min.css\",\n \"map\": \"homeIn.min.css.map\"\n },\n \"versioned\": {\n \"css\": \"homeIn.min.3.14.0.css\",\n \"map\": \"homeIn.min.3.14.0.css.map\"\n }\n },\n \"x15Core\": {\n \"buildPath\": \"styles/themes/x15Core\",\n \"dev\": {\n \"css\": \"x15Core.css\",\n \"map\": \"x15Core.css.map\"\n },\n \"min\": {\n \"css\": \"x15Core.min.css\",\n \"map\": \"x15Core.min.css.map\"\n },\n \"versioned\": {\n \"css\": \"x15Core.min.3.14.0.css\",\n \"map\": \"x15Core.min.3.14.0.css.map\"\n }\n }\n}; export default libraryThemes;"],"mappings":";;;;;;AAAA;AACO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC3B,MAAM,EAAE;IACN,WAAW,EAAE,QAAQ;IACrB,KAAK,EAAE;MACL,KAAK,EAAE,WAAW;MAClB,KAAK,EAAE;IACT,CAAC;IACD,KAAK,EAAE;MACL,KAAK,EAAE,eAAe;MACtB,KAAK,EAAE;IACT,CAAC;IACD,WAAW,EAAE;MACX,KAAK,EAAE,sBAAsB;MAC7B,KAAK,EAAE;IACT;EACF,CAAC;EACD,KAAK,EAAE;IACL,WAAW,EAAE,mBAAmB;IAChC,KAAK,EAAE;MACL,KAAK,EAAE,SAAS;MAChB,KAAK,EAAE;IACT,CAAC;IACD,KAAK,EAAE;MACL,KAAK,EAAE,aAAa;MACpB,KAAK,EAAE;IACT,CAAC;IACD,WAAW,EAAE;MACX,KAAK,EAAE,oBAAoB;MAC3B,KAAK,EAAE;IACT;EACF,CAAC;EACD,aAAa,EAAE;IACb,WAAW,EAAE,2BAA2B;IACxC,KAAK,EAAE;MACL,KAAK,EAAE,iBAAiB;MACxB,KAAK,EAAE;IACT,CAAC;IACD,KAAK,EAAE;MACL,KAAK,EAAE,qBAAqB;MAC5B,KAAK,EAAE;IACT,CAAC;IACD,WAAW,EAAE;MACX,KAAK,EAAE,4BAA4B;MACnC,KAAK,EAAE;IACT;EACF,CAAC;EACD,QAAQ,EAAE;IACR,WAAW,EAAE,sBAAsB;IACnC,KAAK,EAAE;MACL,KAAK,EAAE,YAAY;MACnB,KAAK,EAAE;IACT,CAAC;IACD,KAAK,EAAE;MACL,KAAK,EAAE,gBAAgB;MACvB,KAAK,EAAE;IACT,CAAC;IACD,WAAW,EAAE;MACX,KAAK,EAAE,uBAAuB;MAC9B,KAAK,EAAE;IACT;EACF,CAAC;EACD,QAAQ,EAAE;IACR,WAAW,EAAE,sBAAsB;IACnC,KAAK,EAAE;MACL,KAAK,EAAE,YAAY;MACnB,KAAK,EAAE;IACT,CAAC;IACD,KAAK,EAAE;MACL,KAAK,EAAE,gBAAgB;MACvB,KAAK,EAAE;IACT,CAAC;IACD,WAAW,EAAE;MACX,KAAK,EAAE,uBAAuB;MAC9B,KAAK,EAAE;IACT;EACF,CAAC;EACD,SAAS,EAAE;IACT,WAAW,EAAE,uBAAuB;IACpC,KAAK,EAAE;MACL,KAAK,EAAE,aAAa;MACpB,KAAK,EAAE;IACT,CAAC;IACD,KAAK,EAAE;MACL,KAAK,EAAE,iBAAiB;MACxB,KAAK,EAAE;IACT,CAAC;IACD,WAAW,EAAE;MACX,KAAK,EAAE,wBAAwB;MAC/B,KAAK,EAAE;IACT;EACF;AACF,CAAC;AAAC,IAAAE,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAAgBH,aAAa","ignoreList":[]}
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"map": "index.min.css.map"
|
|
11
11
|
},
|
|
12
12
|
"versioned": {
|
|
13
|
-
"css": "base.min.3.
|
|
14
|
-
"map": "base.min.3.
|
|
13
|
+
"css": "base.min.3.14.0.css",
|
|
14
|
+
"map": "base.min.3.14.0.css.map"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"cba": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"map": "cba.min.css.map"
|
|
26
26
|
},
|
|
27
27
|
"versioned": {
|
|
28
|
-
"css": "cba.min.3.
|
|
29
|
-
"map": "cba.min.3.
|
|
28
|
+
"css": "cba.min.3.14.0.css",
|
|
29
|
+
"map": "cba.min.3.14.0.css.map"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"creditSavvy": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"map": "creditSavvy.min.css.map"
|
|
41
41
|
},
|
|
42
42
|
"versioned": {
|
|
43
|
-
"css": "creditSavvy.min.3.
|
|
44
|
-
"map": "creditSavvy.min.3.
|
|
43
|
+
"css": "creditSavvy.min.3.14.0.css",
|
|
44
|
+
"map": "creditSavvy.min.3.14.0.css.map"
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"doshii": {
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"map": "doshii.min.css.map"
|
|
56
56
|
},
|
|
57
57
|
"versioned": {
|
|
58
|
-
"css": "doshii.min.3.
|
|
59
|
-
"map": "doshii.min.3.
|
|
58
|
+
"css": "doshii.min.3.14.0.css",
|
|
59
|
+
"map": "doshii.min.3.14.0.css.map"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"homeIn": {
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"map": "homeIn.min.css.map"
|
|
71
71
|
},
|
|
72
72
|
"versioned": {
|
|
73
|
-
"css": "homeIn.min.3.
|
|
74
|
-
"map": "homeIn.min.3.
|
|
73
|
+
"css": "homeIn.min.3.14.0.css",
|
|
74
|
+
"map": "homeIn.min.3.14.0.css.map"
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"x15Core": {
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"map": "x15Core.min.css.map"
|
|
86
86
|
},
|
|
87
87
|
"versioned": {
|
|
88
|
-
"css": "x15Core.min.3.
|
|
89
|
-
"map": "x15Core.min.3.
|
|
88
|
+
"css": "x15Core.min.3.14.0.css",
|
|
89
|
+
"map": "x15Core.min.3.14.0.css.map"
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -26,7 +26,10 @@ const PageBanner = ({
|
|
|
26
26
|
backgroundFill = 'primary'
|
|
27
27
|
}) => {
|
|
28
28
|
const StorageKey = `pageBanner_${id}`;
|
|
29
|
-
const StorageValue =
|
|
29
|
+
const [StorageValue, setStorageValue] = (0, _react.useState)(null);
|
|
30
|
+
(0, _react.useEffect)(() => {
|
|
31
|
+
setStorageValue(localStorage.getItem(StorageKey));
|
|
32
|
+
}, [StorageKey]);
|
|
30
33
|
const UserPreferences = StorageValue && JSON.parse(StorageValue);
|
|
31
34
|
const {
|
|
32
35
|
shouldDisplay
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageBanner.js","names":["Object","defineProperty","exports","value","default","PageBanner","Banner","Alert","_react","_interopRequireWildcard","require","_Icon","_SimpleButton","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","animation","reDisplayOnClose","autoHide","autoHideDelay","children","displayMode","icon","id","position","type","disableClose","widthVariant","backgroundFill","StorageKey","StorageValue","localStorage","getItem","UserPreferences","JSON","parse","shouldDisplay","isVisible","setVisibility","
|
|
1
|
+
{"version":3,"file":"PageBanner.js","names":["Object","defineProperty","exports","value","default","PageBanner","Banner","Alert","_react","_interopRequireWildcard","require","_Icon","_SimpleButton","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","animation","reDisplayOnClose","autoHide","autoHideDelay","children","displayMode","icon","id","position","type","disableClose","widthVariant","backgroundFill","StorageKey","StorageValue","setStorageValue","useState","useEffect","localStorage","getItem","UserPreferences","JSON","parse","shouldDisplay","isVisible","setVisibility","autoHideCssClass","cssClass","handleBannerClose","setItem","stringify","createElement","className","SimpleButton","label","onClickHandler","hideLabel","leftIcon","Icon","_default"],"sources":["../../../../../../src/components/design/banners/pageBanner/PageBanner.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState, ReactNode, ReactElement, useEffect } from 'react';\nimport { Icon } from '../../icons/basicIcon/Icon';\nimport { SimpleButton } from '../../../form/buttons/SimpleButton';\n\nimport './pageBanners.scss';\n\nexport interface PageBannerProps {\n id: string;\n children: ReactNode | ReactElement;\n animation?: 'slideInLeft' | 'slideInRight' | 'growOnHover' | 'none';\n reDisplayOnClose?: boolean;\n autoHide?: boolean;\n autoHideDelay?: 1 | 3 | 5 | 10;\n displayMode?: 'fixed' | 'inline';\n icon?: string;\n position?: 'topRight' | 'topCentre' | 'bottomRight' | 'bottomLeft'; // Only applicable with fixed display\n type?: 'alert' | 'info' | 'warn' | 'error' | 'success';\n disableClose?: boolean;\n widthVariant?: 'sm' | 'md' | 'lg';\n backgroundFill?: 'primary' | 'secondary';\n}\n\nexport const PageBanner: React.FC<PageBannerProps> = ({\n animation = 'none',\n reDisplayOnClose = false,\n autoHide = false,\n autoHideDelay = 10,\n children,\n displayMode = 'fixed',\n icon = 'info',\n id = 'pageBanner',\n position = 'topCentre', \n type = 'info',\n disableClose = false,\n widthVariant = 'lg',\n backgroundFill = 'primary',\n}) => {\n const StorageKey = `pageBanner_${ id }`;\n\n const [StorageValue, setStorageValue] = useState<string | null>(null);\n\n useEffect(() => {\n setStorageValue(localStorage.getItem(StorageKey));\n }, [StorageKey]);\n\n const UserPreferences = StorageValue && JSON.parse(StorageValue);\n\n const { shouldDisplay } = UserPreferences || { shouldDisplay: true };\n\n const [isVisible, setVisibility] = useState<boolean>(shouldDisplay);\n\n const autoHideCssClass = autoHide ? `autoHide_${ autoHideDelay }` : 'noAutoHide';\n\n const cssClass = `\n pageBanner \n ${ type } \n ${ position } \n ${ displayMode } \n ${ autoHideCssClass }_${ animation }\n width_${ widthVariant }\n backgroundFill_${ backgroundFill }\n `;\n\n const handleBannerClose = () => {\n setVisibility(false);\n localStorage.setItem(StorageKey, JSON.stringify({ shouldDisplay: reDisplayOnClose }));\n };\n\n if (isVisible) {\n return (\n <aside className={ cssClass }>\n { !disableClose && (\n <SimpleButton\n cssClass=\"closeBannerButton\"\n label=\"Close page banner\"\n id={ `${ id }_CloseBannerButton` }\n onClickHandler={ handleBannerClose }\n hideLabel\n leftIcon={ { icon: 'close' } }\n />\n ) }\n\n <div className=\"pageBannerMainIcon\">\n <Icon icon={ icon } />\n </div>\n\n <div className=\"pageBannerContent\">\n { children }\n </div>\n </aside>\n );\n }\n\n return null;\n};\n\nexport default PageBanner;\n\nexport { PageBanner as Banner };\nexport { PageBanner as Alert };"],"mappings":";AAAA,YAAY;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,OAAA,GAAAF,OAAA,CAAAG,UAAA,GAAAH,OAAA,CAAAI,MAAA,GAAAJ,OAAA,CAAAK,KAAA;AAEb,IAAAC,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAEAA,OAAA;AAA4B,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAlB,OAAA,EAAAS,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,G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CAAC,eAEN3B,MAAA,CAAAJ,OAAA,CAAAwD,aAAA;MAAKC,SAAS,EAAC;IAAmB,GAC9B5B,QACC,CACA,CAAC;EAEZ;EAEA,OAAO,IAAI;AACb,CAAC;AAAC/B,OAAA,CAAAK,KAAA,GAAAL,OAAA,CAAAI,MAAA,GAAAJ,OAAA,CAAAG,UAAA,GAAAA,UAAA;AAAA,IAAA+D,QAAA,GAAAlE,OAAA,CAAAE,OAAA,GAEaC,UAAU","ignoreList":[]}
|
|
@@ -100,7 +100,7 @@ const FormField = ({
|
|
|
100
100
|
htmlFor: field.id
|
|
101
101
|
}, (!label?.position || label.position === 'left' || separateLabelAndField) && /*#__PURE__*/_react.default.createElement(_FormFieldLabel.FormFieldLabel, labelProps), !separateLabelAndField && /*#__PURE__*/_react.default.createElement("span", {
|
|
102
102
|
className: "inputContainer"
|
|
103
|
-
}, getFieldElement(), label?.position === 'inset' && /*#__PURE__*/_react.default.createElement(_FormFieldLabel.FormFieldLabel, labelProps)), label?.position === 'right' && /*#__PURE__*/_react.default.createElement(_FormFieldLabel.FormFieldLabel, labelProps), showSpinner && /*#__PURE__*/_react.default.createElement(_Spinner.Spinner, null), /*#__PURE__*/_react.default.createElement(_ValidationMessages.ValidationMessages, {
|
|
103
|
+
}, getFieldElement(), label?.position === 'inset' && /*#__PURE__*/_react.default.createElement(_FormFieldLabel.FormFieldLabel, labelProps)), label?.position === 'right' && /*#__PURE__*/_react.default.createElement(_FormFieldLabel.FormFieldLabel, labelProps), showSpinner && /*#__PURE__*/_react.default.createElement(_Spinner.Spinner, null), field.type !== 'textarea' && /*#__PURE__*/_react.default.createElement(_ValidationMessages.ValidationMessages, {
|
|
104
104
|
name: field.name,
|
|
105
105
|
validation: validation
|
|
106
106
|
})), separateLabelAndField && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","names":["Object","defineProperty","exports","value","default","FormField","_react","_interopRequireWildcard","require","_HookFormWrapper","_FormFieldLabel","_InputText","_ValidationMessages","_Spinner","_InputSearch","_InputDate","_Select","_Textarea","_Autocomplete","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","label","field","layout","showSpinner","validation","customContent","customCssClasses","separateLabelAndField","isTouched","setIsTouched","useState","wrapperCssClass","type","wrapper","position","wrapperHoverText","hide","undefined","placeholder","text","getFieldElement","fieldType","toLowerCase","fieldProps","defaultValue","onTouched","createElement","Textarea","Select","Error","InputText","InputDate","InputSearch","Autocomplete","labelProps","inputId","id","isRequired","required","HookFormWrapper","className","title","labelId","htmlFor","FormFieldLabel","Spinner","ValidationMessages","name","_default"],"sources":["../../../../../../src/components/form/formFields/formFieldWrapper/FormField.tsx"],"sourcesContent":["'use client';\n\nimport React, { ReactNode, useState } from 'react';\nimport { HookFormWrapper } from '../../hookFormWrapper/HookFormWrapper';\nimport { FormFieldLabel } from '../subComponents/labels/FormFieldLabel';\nimport { FormFieldProps } from './formFieldProps';\nimport { InputText } from '../subComponents/inputs/text/InputText';\nimport { ValidationMessages } from '../../validation/ValidationMessages';\nimport { Spinner } from '../../../design/spinner/Spinner';\nimport { InputSearch } from '../subComponents/inputs/search/InputSearch';\nimport { InputDate } from '../subComponents/inputs/date/InputDate';\nimport { Select } from '../subComponents/select/Select';\nimport { Textarea } from '../subComponents/textarea/Textarea';\nimport { Autocomplete } from '../subComponents/inputs/autocomplete/Autocomplete';\n\nexport const FormField: React.FC<FormFieldProps> = (\n {\n label,\n field,\n layout = 'stacked',\n showSpinner,\n validation,\n customContent,\n customCssClasses,\n separateLabelAndField = false\n }\n) => {\n const [isTouched, setIsTouched] = useState(false);\n\n const wrapperCssClass = `\n formField \n ${ layout } \n ${ field.type }_Field \n ${ customCssClasses?.wrapper || '' } \n ${ isTouched ? 'touched' : '' } \n ${ typeof validation !== 'undefined' ? 'withValidation' : '' } \n ${ label?.position === 'inset' ? 'insetLabel' : '' }\n `;\n\n const wrapperHoverText = (): string | undefined => {\n if (!label.hide) {\n return undefined;\n }\n\n if (field.placeholder) {\n return field.placeholder;\n }\n\n if (typeof label.text === 'string') {\n return label.text;\n }\n\n return undefined;\n };\n\n const getFieldElement = () => {\n const fieldType = field.type.toLowerCase();\n const fieldProps = {\n field: {\n ...field,\n ...(fieldType !== 'checkbox' ? { defaultValue: field.defaultValue || '' } : {}),\n onTouched: () => setIsTouched(true)\n },\n label,\n showSpinner,\n validation,\n customContent\n };\n\n switch (fieldType) {\n case 'textarea':\n return <Textarea { ...fieldProps } />;\n case 'select':\n return <Select { ...fieldProps } />;\n case 'checkbox':\n return new Error('Checkboxes require special handling. Please use the InputCheckbox component instead.');\n case 'file':\n return new Error('File inputs require special handling. Please use the DragAndDropFileUpload component instead.');\n case 'password':\n return <InputText { ...fieldProps } />;\n case 'date':\n return <InputDate { ...fieldProps } />;\n case 'search':\n return <InputSearch { ...fieldProps } />;\n case 'combobox':\n return <Autocomplete { ...fieldProps } />;\n default:\n return <InputText { ...fieldProps } />;\n }\n };\n\n const labelProps = {\n ...label,\n inputId: field.id,\n isRequired: validation && typeof validation.required !== 'undefined',\n customContent\n };\n\n return (\n <HookFormWrapper>\n <div\n className={ wrapperCssClass }\n title={ wrapperHoverText() }\n >\n <label\n id={ label.labelId || `${ field.id }_label` }\n className={ `${ customCssClasses?.label || '' } ${ showSpinner ? 'withSpinner' : '' } ${ label.hide ? 'hiddenLabel' : '' }` }\n htmlFor={ field.id }\n >\n\n { (!label?.position || label.position === 'left' || separateLabelAndField)\n && <FormFieldLabel { ...labelProps } /> }\n\n {\n !separateLabelAndField && (\n <span className=\"inputContainer\">\n {\n getFieldElement() as ReactNode\n }\n { label?.position === 'inset'\n && <FormFieldLabel { ...labelProps } /> }\n </span>\n )\n }\n\n { label?.position === 'right'\n && <FormFieldLabel { ...labelProps } /> }\n\n {\n showSpinner && <Spinner />\n }\n\n <ValidationMessages name={ field.name } validation={ validation } />\n </label>\n\n {\n separateLabelAndField && (\n <div className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c,CAClC,CACP,EAGDlC,KAAK,EAAEc,QAAQ,KAAK,OAAO,iBACxB3C,MAAA,CAAAF,OAAA,CAAAyD,aAAA,CAACnD,eAAA,CAAAqE,cAAc,EAAMV,UAAc,CAAC,EAGvC/B,WAAW,iBAAIhC,MAAA,CAAAF,OAAA,CAAAyD,aAAA,CAAChD,QAAA,CAAAmE,OAAO,MAAE,CAAC,eAG5B1E,MAAA,CAAAF,OAAA,CAAAyD,aAAA,CAACjD,mBAAA,CAAAqE,kBAAkB;IAACC,IAAI,EAAG9C,KAAK,CAAC8C,IAAM;IAAC3C,UAAU,EAAGA;EAAY,CAAE,CAC9D,CAAC,EAGNG,qBAAqB,iBACnBpC,MAAA,CAAAF,OAAA,CAAAyD,aAAA;IAAKc,SAAS,EAAC;EAAgB,GAE3BpB,eAAe,CAAC,CAEf,CAGN,CACU,CAAC;AAEtB,CAAC;AAACrD,OAAA,CAAAG,SAAA,GAAAA,SAAA;AAAA,IAAA8E,QAAA,GAAAjF,OAAA,CAAAE,OAAA,GAEaC,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FormField.js","names":["Object","defineProperty","exports","value","default","FormField","_react","_interopRequireWildcard","require","_HookFormWrapper","_FormFieldLabel","_InputText","_ValidationMessages","_Spinner","_InputSearch","_InputDate","_Select","_Textarea","_Autocomplete","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","label","field","layout","showSpinner","validation","customContent","customCssClasses","separateLabelAndField","isTouched","setIsTouched","useState","wrapperCssClass","type","wrapper","position","wrapperHoverText","hide","undefined","placeholder","text","getFieldElement","fieldType","toLowerCase","fieldProps","defaultValue","onTouched","createElement","Textarea","Select","Error","InputText","InputDate","InputSearch","Autocomplete","labelProps","inputId","id","isRequired","required","HookFormWrapper","className","title","labelId","htmlFor","FormFieldLabel","Spinner","ValidationMessages","name","_default"],"sources":["../../../../../../src/components/form/formFields/formFieldWrapper/FormField.tsx"],"sourcesContent":["'use client';\n\nimport React, { ReactNode, useState } from 'react';\nimport { HookFormWrapper } from '../../hookFormWrapper/HookFormWrapper';\nimport { FormFieldLabel } from '../subComponents/labels/FormFieldLabel';\nimport { FormFieldProps } from './formFieldProps';\nimport { InputText } from '../subComponents/inputs/text/InputText';\nimport { ValidationMessages } from '../../validation/ValidationMessages';\nimport { Spinner } from '../../../design/spinner/Spinner';\nimport { InputSearch } from '../subComponents/inputs/search/InputSearch';\nimport { InputDate } from '../subComponents/inputs/date/InputDate';\nimport { Select } from '../subComponents/select/Select';\nimport { Textarea } from '../subComponents/textarea/Textarea';\nimport { Autocomplete } from '../subComponents/inputs/autocomplete/Autocomplete';\n\nexport const FormField: React.FC<FormFieldProps> = (\n {\n label,\n field,\n layout = 'stacked',\n showSpinner,\n validation,\n customContent,\n customCssClasses,\n separateLabelAndField = false\n }\n) => {\n const [isTouched, setIsTouched] = useState(false);\n\n const wrapperCssClass = `\n formField \n ${ layout } \n ${ field.type }_Field \n ${ customCssClasses?.wrapper || '' } \n ${ isTouched ? 'touched' : '' } \n ${ typeof validation !== 'undefined' ? 'withValidation' : '' } \n ${ label?.position === 'inset' ? 'insetLabel' : '' }\n `;\n\n const wrapperHoverText = (): string | undefined => {\n if (!label.hide) {\n return undefined;\n }\n\n if (field.placeholder) {\n return field.placeholder;\n }\n\n if (typeof label.text === 'string') {\n return label.text;\n }\n\n return undefined;\n };\n\n const getFieldElement = () => {\n const fieldType = field.type.toLowerCase();\n const fieldProps = {\n field: {\n ...field,\n ...(fieldType !== 'checkbox' ? { defaultValue: field.defaultValue || '' } : {}),\n onTouched: () => setIsTouched(true)\n },\n label,\n showSpinner,\n validation,\n customContent\n };\n\n switch (fieldType) {\n case 'textarea':\n return <Textarea { ...fieldProps } />;\n case 'select':\n return <Select { ...fieldProps } />;\n case 'checkbox':\n return new Error('Checkboxes require special handling. Please use the InputCheckbox component instead.');\n case 'file':\n return new Error('File inputs require special handling. Please use the DragAndDropFileUpload component instead.');\n case 'password':\n return <InputText { ...fieldProps } />;\n case 'date':\n return <InputDate { ...fieldProps } />;\n case 'search':\n return <InputSearch { ...fieldProps } />;\n case 'combobox':\n return <Autocomplete { ...fieldProps } />;\n default:\n return <InputText { ...fieldProps } />;\n }\n };\n\n const labelProps = {\n ...label,\n inputId: field.id,\n isRequired: validation && typeof validation.required !== 'undefined',\n customContent\n };\n\n return (\n <HookFormWrapper>\n <div\n className={ wrapperCssClass }\n title={ wrapperHoverText() }\n >\n <label\n id={ label.labelId || `${ field.id }_label` }\n className={ `${ customCssClasses?.label || '' } ${ showSpinner ? 'withSpinner' : '' } ${ label.hide ? 'hiddenLabel' : '' }` }\n htmlFor={ field.id }\n >\n\n { (!label?.position || label.position === 'left' || separateLabelAndField)\n && <FormFieldLabel { ...labelProps } /> }\n\n {\n !separateLabelAndField && (\n <span className=\"inputContainer\">\n {\n getFieldElement() as ReactNode\n }\n { label?.position === 'inset'\n && <FormFieldLabel { ...labelProps } /> }\n </span>\n )\n }\n\n { label?.position === 'right'\n && <FormFieldLabel { ...labelProps } /> }\n\n {\n showSpinner && <Spinner />\n }\n\n { field.type !== 'textarea' && <ValidationMessages name={ field.name } validation={ validation } /> }\n </label>\n\n {\n separateLabelAndField && (\n <div className=\"inputContainer\">\n {\n getFieldElement() as ReactNode\n }\n </div>\n )\n }\n </div>\n </HookFormWrapper>\n );\n};\n\nexport default FormField;\n"],"mappings":";AAAA,YAAY;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,OAAA,GAAAF,OAAA,CAAAG,SAAA;AAEb,IAAAC,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;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pC,MAAA,CAAAF,OAAA,CAAAyD,aAAA;IAAKc,SAAS,EAAC;EAAgB,GAE3BpB,eAAe,CAAC,CAEf,CAGN,CACU,CAAC;AAEtB,CAAC;AAACrD,OAAA,CAAAG,SAAA,GAAAA,SAAA;AAAA,IAAA8E,QAAA,GAAAjF,OAAA,CAAAE,OAAA,GAEaC,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formFieldProps.js","names":[],"sources":["../../../../../../src/components/form/formFields/formFieldWrapper/formFieldProps.ts"],"sourcesContent":["/* eslint-disable no-unused-vars */\n\nimport {\n ChangeEvent, ChangeEventHandler, FormEventHandler,\n KeyboardEvent,\n ReactElement,\n ReactNode,\n} from 'react';\n\nimport type {\n InputHTMLAttributes,\n SelectHTMLAttributes,\n TextareaHTMLAttributes,\n} from 'react';\n\nimport {\n Message,\n Validate,\n ValidationRule\n} from 'react-hook-form';\nimport { GenericFunction } from '../../../../interfaces';\nimport { KeyboardEventHandler } from '../../../../interfaces/generic.interface';\n\n/**\n * Custom content props for additional elements around the label or field.\n */\nexport interface CustomContentProps {\n /** Element or text to display before the label. */\n preLabel?: ReactElement | string;\n /** Element or text to display after the label. */\n postLabel?: ReactElement | string;\n /** Element or text to display before the field. */\n preField?: ReactElement | string;\n /** Element or text to display after the field. */\n postField?: ReactElement | string;\n}\n\n/**\n * Props for the label element.\n */\nexport interface LabelProps {\n /** Text or element for the label. */\n text: string | ReactNode | ReactElement;\n /** The ID of the input the label is associated with. */\n inputId?: string;\n /** The ID of the label element. */\n labelId?: string;\n /** Whether to hide the label visually. */\n hide?: boolean;\n /** Position of the label relative to the field. */\n position?: 'inset' | 'left' | 'right' | string;\n /** Tooltip for the label. */\n labelTooltip?: {\n /** Text for the tooltip. */\n text: string;\n /** Optional icon for the tooltip. */\n icon?: ReactElement | string;\n };\n /** Screen reader instructions for the label. */\n srInstruction?: string;\n /** Whether the field is required. */\n isRequired?: boolean;\n /** Custom content for the label. */\n customContent?: CustomContentProps;\n}\n\n/**\n * Type for a single select option.\n */\nexport type SelectOptionObjectType = {\n /** Label of the option. */\n label: string;\n /** Value of the option. */\n value: string | number | boolean;\n};\n\n/**\n * Type for select options, which can be an object or string.\n */\nexport type SelectOptionType = SelectOptionObjectType | string;\n\n/**\n * Type for a single combobox (autocomplete) option.\n */\nexport type ComboboxOptionObjectType = {\n /** Label of the option. */\n label: string;\n /** Value of the option. */\n value: string | number | boolean;\n /** Additional data associated with the option. */\n data?: Record<string, unknown>;\n};\n\nexport type ComboboxOption = ComboboxOptionObjectType | string;\n\n// Everything we want to *override* with our own definitions in FieldProps\nexport type OverriddenKeys =\n | 'type'\n | 'id'\n | 'name'\n | 'placeholder'\n | 'defaultValue'\n | 'onChange'\n | 'onBlur'\n | 'onInput'\n | 'onKeyDown'\n | 'disabled'\n | 'readOnly'\n | 'min'\n | 'max';\n\n// All the native props we want to mix in, minus the ones we override\nexport type NativeFieldProps =\n & Omit<InputHTMLAttributes<HTMLInputElement>, OverriddenKeys>\n & Omit<SelectHTMLAttributes<HTMLSelectElement>, OverriddenKeys>\n & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, OverriddenKeys>;\n\n/**\n * Props for the field element.\n */\nexport interface FieldProps extends NativeFieldProps {\n /** The type of the input field. */\n type: string;\n /** The ID of the input field. */\n id: string;\n /** The name of the input field. */\n name: string;\n /** Placeholder text for the input field. */\n placeholder?: string;\n /** Default value for the input field. */\n defaultValue?: string | number | readonly string[];\n /** Handler for the change event. */\n onChange?: ChangeEventHandler | ((\n event: ChangeEvent<HTMLInputElement> | KeyboardEvent<HTMLSelectElement> | KeyboardEvent<HTMLTextAreaElement>\n ) => void | GenericFunction);\n /** Handler for the blur event. */\n onBlur?: GenericFunction;\n /** Handler for the input event. */\n onInput?: FormEventHandler<\n HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement\n >;\n /** Handler for the keydown event. */\n onKeyDown?: KeyboardEventHandler | ((\n event: KeyboardEvent<HTMLInputElement> | KeyboardEvent<HTMLSelectElement> | KeyboardEvent<HTMLTextAreaElement>\n ) => void | GenericFunction);\n /** Handler for marking the field as touched. */\n onTouched?: GenericFunction;\n /** Whether to include an empty option in a dropdown. */\n includeEmptyOption?: boolean;\n /** Label for the empty option. */\n emptyOptionLabel?: string;\n /** Options for a dropdown field. */\n options?: SelectOptionType[] | ComboboxOption[];\n /** Auto-complete behaviour for the field. */\n autoComplete?: string;\n /** Whether the field allows editing and interaction. Note: Setting this to true makes it invisible to screen reader users. */\n disabled?: boolean;\n /** Setting to true prevents editing and interaction whilst still making the value visible to screen reader users. */\n readonly?: boolean;\n /** Minimum value or length. */\n min?: string | number;\n /** Maximum value or length. */\n max?: string | number;\n}\n\n/**\n * Validation rules for fields.\n */\nexport type CustomValidate<TFieldValue> = (\n value: TFieldValue,\n formValues?: unknown\n) => boolean | string | Promise<boolean | string>;\n\n/**\n * Props for validation rules.\n */\n\nexport type MinMaxRule<T> = T extends boolean\n ? ValidationRule<boolean>\n : ValidationRule<number | string>;\n\nexport interface ValidationProps<\n TFieldValue = unknown | string | boolean,\n TFormValues = unknown\n> {\n /** Whether the field is required. */\n required?: Message | ValidationRule<boolean>;\n /** Minimum value or length. */\n min?: MinMaxRule<TFieldValue>;\n /** Maximum value or length. */\n max?: MinMaxRule<TFieldValue>;\n
|
|
1
|
+
{"version":3,"file":"formFieldProps.js","names":[],"sources":["../../../../../../src/components/form/formFields/formFieldWrapper/formFieldProps.ts"],"sourcesContent":["/* eslint-disable no-unused-vars */\n\nimport {\n ChangeEvent, ChangeEventHandler, FormEventHandler,\n KeyboardEvent,\n ReactElement,\n ReactNode,\n} from 'react';\n\nimport type {\n InputHTMLAttributes,\n SelectHTMLAttributes,\n TextareaHTMLAttributes,\n} from 'react';\n\nimport {\n Message,\n Validate,\n ValidationRule\n} from 'react-hook-form';\nimport { GenericFunction } from '../../../../interfaces';\nimport { KeyboardEventHandler } from '../../../../interfaces/generic.interface';\n\n/**\n * Custom content props for additional elements around the label or field.\n */\nexport interface CustomContentProps {\n /** Element or text to display before the label. */\n preLabel?: ReactElement | string;\n /** Element or text to display after the label. */\n postLabel?: ReactElement | string;\n /** Element or text to display before the field. */\n preField?: ReactElement | string;\n /** Element or text to display after the field. */\n postField?: ReactElement | string;\n}\n\n/**\n * Props for the label element.\n */\nexport interface LabelProps {\n /** Text or element for the label. */\n text: string | ReactNode | ReactElement;\n /** The ID of the input the label is associated with. */\n inputId?: string;\n /** The ID of the label element. */\n labelId?: string;\n /** Whether to hide the label visually. */\n hide?: boolean;\n /** Position of the label relative to the field. */\n position?: 'inset' | 'left' | 'right' | string;\n /** Tooltip for the label. */\n labelTooltip?: {\n /** Text for the tooltip. */\n text: string;\n /** Optional icon for the tooltip. */\n icon?: ReactElement | string;\n };\n /** Screen reader instructions for the label. */\n srInstruction?: string;\n /** Whether the field is required. */\n isRequired?: boolean;\n /** Custom content for the label. */\n customContent?: CustomContentProps;\n}\n\n/**\n * Type for a single select option.\n */\nexport type SelectOptionObjectType = {\n /** Label of the option. */\n label: string;\n /** Value of the option. */\n value: string | number | boolean;\n};\n\n/**\n * Type for select options, which can be an object or string.\n */\nexport type SelectOptionType = SelectOptionObjectType | string;\n\n/**\n * Type for a single combobox (autocomplete) option.\n */\nexport type ComboboxOptionObjectType = {\n /** Label of the option. */\n label: string;\n /** Value of the option. */\n value: string | number | boolean;\n /** Additional data associated with the option. */\n data?: Record<string, unknown>;\n};\n\nexport type ComboboxOption = ComboboxOptionObjectType | string;\n\n// Everything we want to *override* with our own definitions in FieldProps\nexport type OverriddenKeys =\n | 'type'\n | 'id'\n | 'name'\n | 'placeholder'\n | 'defaultValue'\n | 'onChange'\n | 'onBlur'\n | 'onInput'\n | 'onKeyDown'\n | 'disabled'\n | 'readOnly'\n | 'min'\n | 'max';\n\n// All the native props we want to mix in, minus the ones we override\nexport type NativeFieldProps =\n & Omit<InputHTMLAttributes<HTMLInputElement>, OverriddenKeys>\n & Omit<SelectHTMLAttributes<HTMLSelectElement>, OverriddenKeys>\n & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, OverriddenKeys>;\n\n/**\n * Props for the field element.\n */\nexport interface FieldProps extends NativeFieldProps {\n /** The type of the input field. */\n type: string;\n /** The ID of the input field. */\n id: string;\n /** The name of the input field. */\n name: string;\n /** Placeholder text for the input field. */\n placeholder?: string;\n /** Default value for the input field. */\n defaultValue?: string | number | readonly string[];\n /** Handler for the change event. */\n onChange?: ChangeEventHandler | ((\n event: ChangeEvent<HTMLInputElement> | KeyboardEvent<HTMLSelectElement> | KeyboardEvent<HTMLTextAreaElement>\n ) => void | GenericFunction);\n /** Handler for the blur event. */\n onBlur?: GenericFunction;\n /** Handler for the input event. */\n onInput?: FormEventHandler<\n HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement\n >;\n /** Handler for the keydown event. */\n onKeyDown?: KeyboardEventHandler | ((\n event: KeyboardEvent<HTMLInputElement> | KeyboardEvent<HTMLSelectElement> | KeyboardEvent<HTMLTextAreaElement>\n ) => void | GenericFunction);\n /** Handler for marking the field as touched. */\n onTouched?: GenericFunction;\n /** Whether to include an empty option in a dropdown. */\n includeEmptyOption?: boolean;\n /** Label for the empty option. */\n emptyOptionLabel?: string;\n /** Options for a dropdown field. */\n options?: SelectOptionType[] | ComboboxOption[];\n /** Auto-complete behaviour for the field. */\n autoComplete?: string;\n /** Whether the field allows editing and interaction. Note: Setting this to true makes it invisible to screen reader users. */\n disabled?: boolean;\n /** Setting to true prevents editing and interaction whilst still making the value visible to screen reader users. */\n readonly?: boolean;\n /** Minimum value or length. */\n min?: string | number;\n /** Maximum value or length. */\n max?: string | number;\n /**\n * Whether to enforce grapheme-aware max-length handling (used by textarea).\n * Uses `field.maxLength` (native field prop) as the source for the UI/input limit.\n * Keep `field.maxLength` and `validation.maxLength` aligned to avoid mixed UX/validation behaviour.\n */\n enforceMaxLength?: boolean;\n}\n\n/**\n * Validation rules for fields.\n */\nexport type CustomValidate<TFieldValue> = (\n value: TFieldValue,\n formValues?: unknown\n) => boolean | string | Promise<boolean | string>;\n\n/**\n * Props for validation rules.\n */\n\nexport type MinMaxRule<T> = T extends boolean\n ? ValidationRule<boolean>\n : ValidationRule<number | string>;\n\nexport interface ValidationProps<\n TFieldValue = unknown | string | boolean,\n TFormValues = unknown\n> {\n /** Whether the field is required. */\n required?: Message | ValidationRule<boolean>;\n /** Minimum value or length. */\n min?: MinMaxRule<TFieldValue>;\n /** Maximum value or length. */\n max?: MinMaxRule<TFieldValue>;\n /**\n * Maximum length validation rule.\n * Used for validation outcome/messages, while textarea UI/input limiting is driven by `field.maxLength`.\n * If both are provided, keep them equal.\n */\n maxLength?: ValidationRule<number>;\n /** Minimum length of the field. */\n minLength?: ValidationRule<number>;\n /** Regex pattern for validation. */\n pattern?: ValidationRule<RegExp>;\n /** Custom validation logic. */\n validate?: CustomValidate<TFieldValue> | Record<string, CustomValidate<TFieldValue>> | Validate<TFieldValue, TFormValues>;\n}\n\nexport type ValidationKey = keyof ValidationProps<unknown, unknown>; // Restrict to known keys\n\n/**\n * Custom CSS classes for the field components.\n */\nexport interface CustomFieldCssClassesProps {\n /** CSS class for the label. */\n label?: string;\n /** CSS class for the input field. */\n input?: string;\n /** CSS class for the wrapper. */\n wrapper?: string;\n}\n\n/**\n * Props for a form field component.\n */\nexport interface FormFieldProps {\n /** Props for the label. */\n label: LabelProps;\n /** Props for the field. */\n field: FieldProps;\n /** Layout style of the form field. */\n layout?: 'stacked' | 'horizontal' | string;\n /** Validation rules for the field. */\n validation?: ValidationProps;\n /** Whether to show a spinner. */\n showSpinner?: boolean;\n /** Custom CSS classes for the field. */\n customCssClasses?: CustomFieldCssClassesProps;\n /** Custom content for the field. */\n customContent?: CustomContentProps;\n /** Override the default nesting of the input inside the label. */\n separateLabelAndField?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,25 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Textarea = void 0;
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _reactHookForm = require("react-hook-form");
|
|
11
10
|
var _HookFormWrapper = require("../../../hookFormWrapper/HookFormWrapper");
|
|
12
11
|
var _formUtilities = require("../../utilities/formUtilities");
|
|
12
|
+
var _ValidationMessages = require("../../../validation/ValidationMessages");
|
|
13
|
+
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
|
+
* Counts user-perceived characters (grapheme clusters).
|
|
16
|
+
* Treats emojis and composed characters (e.g. accented letters) as a single character.
|
|
17
|
+
* Falls back to basic code-point counting if Intl.Segmenter is not available.
|
|
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
|
+
}
|
|
13
40
|
const Textarea = ({
|
|
14
41
|
field: {
|
|
15
42
|
id,
|
|
16
43
|
name,
|
|
17
44
|
placeholder,
|
|
18
45
|
defaultValue,
|
|
46
|
+
maxLength,
|
|
47
|
+
enforceMaxLength,
|
|
19
48
|
onBlur = () => {},
|
|
20
49
|
onChange = () => {},
|
|
21
50
|
onKeyDown = () => {},
|
|
22
|
-
onTouched = () => {}
|
|
51
|
+
onTouched = () => {},
|
|
52
|
+
...htmlNativeDomProps
|
|
23
53
|
},
|
|
24
54
|
validation,
|
|
25
55
|
showSpinner,
|
|
@@ -28,17 +58,101 @@ const Textarea = ({
|
|
|
28
58
|
}) => {
|
|
29
59
|
const {
|
|
30
60
|
register,
|
|
31
|
-
getFieldState
|
|
61
|
+
getFieldState,
|
|
62
|
+
formState: {
|
|
63
|
+
errors
|
|
64
|
+
}
|
|
32
65
|
} = (0, _reactHookForm.useFormContext)() || _formUtilities.NoHookFormContext;
|
|
33
66
|
const fieldState = getFieldState(name);
|
|
34
|
-
const
|
|
67
|
+
const hasFieldError = Boolean((0, _ValidationMessages.extractError)(errors, name));
|
|
68
|
+
// Combine fieldState.invalid with a direct errors lookup so this component re-renders
|
|
69
|
+
// whenever formState.errors changes (getFieldState alone does not subscribe to errors).
|
|
70
|
+
const isInvalid = Boolean(fieldState?.invalid ?? hasFieldError);
|
|
71
|
+
const [count, setCount] = (0, _react.useState)(() => getCharacterCount(defaultValue?.toString() || ''));
|
|
72
|
+
const [hasStartedTyping, setHasStartedTyping] = (0, _react.useState)(false);
|
|
73
|
+
const hasMaxLength = typeof maxLength === 'number';
|
|
74
|
+
const isAtLimit = hasMaxLength ? count >= maxLength : false;
|
|
75
|
+
// Only hide counter for 'required' error. All other errors (maxLength, pattern, etc)
|
|
76
|
+
// should show counter instead of error message.
|
|
77
|
+
const isRequiredError = fieldState?.error?.type === 'required';
|
|
78
|
+
const characterCounter = !hasStartedTyping || !hasMaxLength || isRequiredError ? undefined : `${count}/${maxLength}`;
|
|
79
|
+
const cssClass = `${customCssClasses?.input || ''}${isInvalid ? ' invalidField' : ''}`;
|
|
80
|
+
const normalizedValidation = (0, _react.useMemo)(() => {
|
|
81
|
+
if (!validation || typeof validation.maxLength === 'undefined') {
|
|
82
|
+
return validation;
|
|
83
|
+
}
|
|
84
|
+
const maxLengthRule = validation.maxLength;
|
|
85
|
+
const maxLengthValue = typeof maxLengthRule === 'number' ? maxLengthRule : typeof maxLengthRule === 'object' && maxLengthRule && 'value' in maxLengthRule ? Number(maxLengthRule.value) : undefined;
|
|
86
|
+
if (typeof maxLengthValue !== 'number' || Number.isNaN(maxLengthValue)) {
|
|
87
|
+
return validation;
|
|
88
|
+
}
|
|
89
|
+
const maxLengthMessage = `Maximum length is ${maxLengthValue}`;
|
|
90
|
+
const graphemeMaxLengthValidator = value => getCharacterCount(value || '') <= maxLengthValue || maxLengthMessage;
|
|
91
|
+
|
|
92
|
+
// eslint-disable-next-line no-unused-vars
|
|
35
93
|
const {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
94
|
+
maxLength: _maxLength,
|
|
95
|
+
validate,
|
|
96
|
+
...restValidation
|
|
97
|
+
} = validation;
|
|
98
|
+
if (typeof validate === 'function') {
|
|
99
|
+
return {
|
|
100
|
+
...restValidation,
|
|
101
|
+
validate: async (value, formValues) => {
|
|
102
|
+
const validationResult = await validate(value, formValues);
|
|
103
|
+
if (validationResult !== true) {
|
|
104
|
+
return validationResult;
|
|
105
|
+
}
|
|
106
|
+
return graphemeMaxLengthValidator(value);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
if (validate && typeof validate === 'object') {
|
|
111
|
+
return {
|
|
112
|
+
...restValidation,
|
|
113
|
+
validate: {
|
|
114
|
+
...validate,
|
|
115
|
+
graphemeMaxLength: graphemeMaxLengthValidator
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
...restValidation,
|
|
121
|
+
validate: graphemeMaxLengthValidator
|
|
122
|
+
};
|
|
123
|
+
}, [validation]);
|
|
124
|
+
const registered = register(name, normalizedValidation);
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Prevents input that would exceed the maxLength when counting grapheme clusters.
|
|
128
|
+
* Native <textarea maxLength> counts UTF-16 units, so emojis and composed characters
|
|
129
|
+
* can be treated as multiple characters. We avoid using native maxLength and enforce
|
|
130
|
+
* the limit here instead.
|
|
131
|
+
*/
|
|
132
|
+
const HandleBeforeInput = event => {
|
|
133
|
+
if (enforceMaxLength !== true || !hasMaxLength) return;
|
|
134
|
+
const nativeEvent = event.nativeEvent;
|
|
135
|
+
const inserted = nativeEvent.data ?? '';
|
|
136
|
+
if (!inserted) return;
|
|
137
|
+
const target = event.currentTarget;
|
|
138
|
+
const start = target.selectionStart ?? target.value.length;
|
|
139
|
+
const end = target.selectionEnd ?? target.value.length;
|
|
140
|
+
const nextValue = target.value.slice(0, start) + inserted + target.value.slice(end);
|
|
141
|
+
if (getCharacterCount(nextValue) > maxLength) {
|
|
142
|
+
event.preventDefault();
|
|
40
143
|
}
|
|
41
144
|
};
|
|
145
|
+
const HandleChange = event => {
|
|
146
|
+
const rawValue = event.target.value || '';
|
|
147
|
+
const newValue = enforceMaxLength === true && hasMaxLength ? clampToGraphemeMax(rawValue, maxLength) : rawValue;
|
|
148
|
+
if (newValue !== rawValue) {
|
|
149
|
+
event.target.value = newValue;
|
|
150
|
+
}
|
|
151
|
+
setHasStartedTyping(true);
|
|
152
|
+
setCount(getCharacterCount(newValue));
|
|
153
|
+
const onTextareaChange = onChange;
|
|
154
|
+
onTextareaChange?.(event);
|
|
155
|
+
};
|
|
42
156
|
const HandleOnBlur = event => {
|
|
43
157
|
const {
|
|
44
158
|
target
|
|
@@ -50,9 +164,14 @@ const Textarea = ({
|
|
|
50
164
|
};
|
|
51
165
|
const HandleKeyEvent = event => {
|
|
52
166
|
onTouched();
|
|
53
|
-
onKeyDown
|
|
167
|
+
const onTextareaKeyDown = onKeyDown;
|
|
168
|
+
onTextareaKeyDown?.(event);
|
|
54
169
|
};
|
|
55
|
-
const
|
|
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;
|
|
56
175
|
const textareaProps = {
|
|
57
176
|
id,
|
|
58
177
|
className: cssClass,
|
|
@@ -64,16 +183,38 @@ const Textarea = ({
|
|
|
64
183
|
...(validation && typeof validation.required !== 'undefined' ? {
|
|
65
184
|
required: true
|
|
66
185
|
} : {}),
|
|
67
|
-
...
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
186
|
+
...registered,
|
|
187
|
+
onBeforeInput: HandleBeforeInput,
|
|
188
|
+
onChange: event => {
|
|
189
|
+
HandleChange(event);
|
|
190
|
+
registered?.onChange?.(event);
|
|
191
|
+
},
|
|
192
|
+
onBlur: event => {
|
|
193
|
+
HandleOnBlur(event);
|
|
194
|
+
registered?.onBlur?.(event);
|
|
195
|
+
},
|
|
196
|
+
onKeyDown: HandleKeyEvent,
|
|
197
|
+
...htmlNativeDomProps,
|
|
198
|
+
'aria-describedby': mergedDescribedBy
|
|
73
199
|
};
|
|
74
200
|
return /*#__PURE__*/_react.default.createElement(_HookFormWrapper.HookFormWrapper, null, customContent?.preField && /*#__PURE__*/_react.default.createElement("span", {
|
|
75
201
|
className: "preField"
|
|
76
|
-
}, customContent?.preField), /*#__PURE__*/_react.default.createElement("
|
|
202
|
+
}, customContent?.preField), /*#__PURE__*/_react.default.createElement("div", {
|
|
203
|
+
className: "textareaFieldContainer"
|
|
204
|
+
}, /*#__PURE__*/_react.default.createElement("textarea", textareaProps), /*#__PURE__*/_react.default.createElement("div", {
|
|
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,
|
|
213
|
+
className: `textareaCharacterCount ${isAtLimit ? 'textareaCharacterCountExceeded' : ''}`,
|
|
214
|
+
role: isAtLimit ? 'status' : undefined,
|
|
215
|
+
"aria-live": isAtLimit ? 'polite' : undefined,
|
|
216
|
+
"aria-atomic": isAtLimit ? 'true' : undefined
|
|
217
|
+
}, characterCounter))), customContent?.postField && /*#__PURE__*/_react.default.createElement("span", {
|
|
77
218
|
className: "postField"
|
|
78
219
|
}, customContent?.postField));
|
|
79
220
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","Textarea","_react","_reactHookForm","_HookFormWrapper","_formUtilities","field","id","name","placeholder","defaultValue","onBlur","onChange","onKeyDown","onTouched","validation","showSpinner","customCssClasses","customContent","register","getFieldState","useFormContext","NoHookFormContext","fieldState","HandleAutoFill","event","target","HandleOnBlur","HandleKeyEvent","cssClass","input","invalid","textareaProps","className","disabled","required","default","createElement","HookFormWrapper","preField","postField"],"sources":["../../../../../../../src/components/form/formFields/subComponents/textarea/Textarea.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { HookFormWrapper } from '../../../hookFormWrapper/HookFormWrapper';\nimport { FormFieldProps } from '../../formFieldWrapper/formFieldProps';\nimport { NoHookFormContext } from '../../utilities/formUtilities';\n\ninterface TextareaProps extends FormFieldProps, React.TextareaHTMLAttributes<HTMLTextAreaElement> {}\n\nexport const Textarea: React.FC<TextareaProps> = (\n {\n field: {\n id,\n name,\n placeholder,\n defaultValue,\n onBlur = () => {},\n onChange = () => {},\n onKeyDown = () => {},\n onTouched = () => {}\n },\n validation,\n showSpinner,\n customCssClasses,\n customContent\n }\n) => {\n const { register, getFieldState } = useFormContext() || NoHookFormContext;\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 onTouched();\n onKeyDown(event);\n };\n\n const cssClass = `${ customCssClasses?.input || '' }${ fieldState && fieldState?.invalid ? ' invalidField' : '' }`;\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 ...register(\n name,\n {\n onChange: HandleAutoFill,\n onBlur: HandleOnBlur,\n ...validation\n }\n ),\n onKeyDown: HandleKeyEvent\n };\n\n return (\n <HookFormWrapper>\n { customContent?.preField && <span className=\"preField\">{ customContent?.preField }</span> }\n\n <textarea { ...textareaProps } />\n\n { customContent?.postField && <span className=\"postField\">{ customContent?.postField }</span> }\n </H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,CAAC;EAED,MAAMI,QAAQ,GAAG,GAAIZ,gBAAgB,EAAEa,KAAK,IAAI,EAAE,GAAKP,UAAU,IAAIA,UAAU,EAAEQ,OAAO,GAAG,eAAe,GAAG,EAAE,EAAG;EAElH,MAAMC,aAAa,GAAG;IACpBzB,EAAE;IACF0B,SAAS,EAAEJ,QAAQ;IACnBpB,WAAW;IACXC,YAAY;IACZ,IAAIM,WAAW,GAAG;MAAEkB,QAAQ,EAAE;IAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,IAAInB,UAAU,IAAI,OAAOA,UAAU,CAACoB,QAAQ,KAAK,WAAW,GAAG;MAAEA,QAAQ,EAAE;IAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACvF,GAAGhB,QAAQ,CACTX,IAAI,EACJ;MACEI,QAAQ,EAAEY,cAAc;MACxBb,MAAM,EAAEgB,YAAY;MACpB,GAAGZ;IACL,CACF,CAAC;IACDF,SAAS,EAAEe;EACb,CAAC;EAED,oBACE1B,MAAA,CAAAkC,OAAA,CAAAC,aAAA,CAACjC,gBAAA,CAAAkC,eAAe,QACZpB,aAAa,EAAEqB,QAAQ,iBAAIrC,MAAA,CAAAkC,OAAA,CAAAC,aAAA;IAAMJ,SAAS,EAAC;EAAU,GAAGf,aAAa,EAAEqB,QAAgB,CAAC,eAE1FrC,MAAA,CAAAkC,OAAA,CAAAC,aAAA,aAAeL,aAAiB,CAAC,EAE/Bd,aAAa,EAAEsB,SAAS,iBAAItC,MAAA,CAAAkC,OAAA,CAAAC,aAAA;IAAMJ,SAAS,EAAC;EAAW,GAAGf,aAAa,EAAEsB,SAAiB,CAC7E,CAAC;AAEtB,CAAC;AAACzC,OAAA,CAAAE,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
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,gBAAA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