@ongov/ontario-design-system-component-library 5.0.0-alpha.1 → 5.0.0-alpha.4
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/app-globals-6f6b30a8.js.map +1 -1
- package/dist/cjs/ontario-accordion_44.cjs.entry.js +19 -7
- package/dist/cjs/ontario-accordion_44.cjs.entry.js.map +1 -1
- package/dist/collection/components/ontario-date-input/test/ontario-date-input.spec.js +58 -0
- package/dist/collection/components/ontario-date-input/test/ontario-date-input.spec.js.map +1 -1
- package/dist/collection/components/ontario-date-input/utils/date-validation-utils.js +14 -4
- package/dist/collection/components/ontario-date-input/utils/date-validation-utils.js.map +1 -1
- package/dist/collection/components/ontario-footer/test/ontario-footer.spec.js +4 -4
- package/dist/collection/components/ontario-footer/test/ontario-footer.spec.js.map +1 -1
- package/dist/collection/fonts/open-sans-400/LICENSE.txt +0 -0
- package/dist/collection/fonts/open-sans-400/open-sans-400.eot +0 -0
- package/dist/collection/fonts/open-sans-400/open-sans-400.svg +0 -0
- package/dist/collection/fonts/open-sans-400/open-sans-400.ttf +0 -0
- package/dist/collection/fonts/open-sans-400/open-sans-400.woff +0 -0
- package/dist/collection/fonts/open-sans-400/open-sans-400.woff2 +0 -0
- package/dist/collection/fonts/open-sans-700/LICENSE.txt +0 -0
- package/dist/collection/fonts/open-sans-700/open-sans-700.eot +0 -0
- package/dist/collection/fonts/open-sans-700/open-sans-700.svg +0 -0
- package/dist/collection/fonts/open-sans-700/open-sans-700.ttf +0 -0
- package/dist/collection/utils/helper/utils.js +4 -2
- package/dist/collection/utils/helper/utils.js.map +1 -1
- package/dist/collection/utils/helper/utils.spec.js +99 -1
- package/dist/collection/utils/helper/utils.spec.js.map +1 -1
- package/dist/components/ontario-date-input.js +13 -3
- package/dist/components/ontario-date-input.js.map +1 -1
- package/dist/components/ontario-header.js +2 -2
- package/dist/components/ontario-header.js.map +1 -1
- package/dist/components/utils.js +4 -2
- package/dist/components/utils.js.map +1 -1
- package/dist/esm/app-globals-70748594.js.map +1 -1
- package/dist/esm/ontario-accordion_44.entry.js +19 -7
- package/dist/esm/ontario-accordion_44.entry.js.map +1 -1
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/ontario-design-system-components/fonts/open-sans-400/LICENSE.txt +0 -0
- package/dist/ontario-design-system-components/fonts/open-sans-400/open-sans-400.eot +0 -0
- package/dist/ontario-design-system-components/fonts/open-sans-400/open-sans-400.svg +0 -0
- package/dist/ontario-design-system-components/fonts/open-sans-400/open-sans-400.ttf +0 -0
- package/dist/ontario-design-system-components/fonts/open-sans-400/open-sans-400.woff +0 -0
- package/dist/ontario-design-system-components/fonts/open-sans-400/open-sans-400.woff2 +0 -0
- package/dist/ontario-design-system-components/fonts/open-sans-700/LICENSE.txt +0 -0
- package/dist/ontario-design-system-components/fonts/open-sans-700/open-sans-700.eot +0 -0
- package/dist/ontario-design-system-components/fonts/open-sans-700/open-sans-700.svg +0 -0
- package/dist/ontario-design-system-components/fonts/open-sans-700/open-sans-700.ttf +0 -0
- package/dist/ontario-design-system-components/ontario-design-system-components.esm.js +1 -1
- package/dist/ontario-design-system-components/p-103a233b.js.map +1 -1
- package/dist/ontario-design-system-components/{p-9c3a1be9.entry.js → p-ac4e76b2.entry.js} +8 -6
- package/dist/ontario-design-system-components/p-ac4e76b2.entry.js.map +1 -0
- package/dist/types/components/ontario-date-input/utils/date-validation-utils.d.ts +14 -0
- package/package.json +3 -3
- package/src/components/ontario-date-input/test/ontario-date-input.spec.tsx +76 -0
- package/src/components/ontario-date-input/utils/date-validation-utils.ts +18 -4
- package/src/components/ontario-footer/test/ontario-footer.spec.tsx +4 -4
- package/src/components/ontario-header/ontario-header.scss +4 -4
- package/src/config.json +1 -4
- package/src/utils/helper/utils.spec.ts +127 -1
- package/src/utils/helper/utils.ts +4 -2
- package/www/build/ontario-design-system-components.esm.js +1 -1
- package/www/build/p-103a233b.js.map +1 -1
- package/www/build/{p-9c3a1be9.entry.js → p-ac4e76b2.entry.js} +8 -6
- package/www/build/p-ac4e76b2.entry.js.map +1 -0
- package/www/build/{p-84035ac3.js → p-c9a9b857.js} +1 -1
- package/www/fonts/open-sans-400/LICENSE.txt +0 -0
- package/www/fonts/open-sans-400/open-sans-400.eot +0 -0
- package/www/fonts/open-sans-400/open-sans-400.svg +0 -0
- package/www/fonts/open-sans-400/open-sans-400.ttf +0 -0
- package/www/fonts/open-sans-400/open-sans-400.woff +0 -0
- package/www/fonts/open-sans-400/open-sans-400.woff2 +0 -0
- package/www/fonts/open-sans-700/LICENSE.txt +0 -0
- package/www/fonts/open-sans-700/open-sans-700.eot +0 -0
- package/www/fonts/open-sans-700/open-sans-700.svg +0 -0
- package/www/fonts/open-sans-700/open-sans-700.ttf +0 -0
- package/www/index.html +2 -2
- package/dist/ontario-design-system-components/p-9c3a1be9.entry.js.map +0 -1
- package/www/build/p-9c3a1be9.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../../src/utils/helper/utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../../src/utils/helper/utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE7D,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,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;QAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAC1D,MAAM,cAAc,GAAG,IAAI,KAAK,CAAS,CAAC,CAAC,CAAC;QAC5C,MAAM,UAAU,GAAQ,IAAI,CAAC;QAE7B,MAAM,MAAM,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QACjD,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAExF,MAAM,MAAM,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QACnD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC9C,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAExF,MAAM,MAAM,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;QAClD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { format, isNumber, retrieveEnumKeys } from './utils';\n\ndescribe('format', () => {\n\tit('returns empty string for no names defined', () => {\n\t\texpect(format(undefined, undefined, undefined)).toEqual('');\n\t});\n\n\tit('formats just first names', () => {\n\t\texpect(format('Joseph', undefined, undefined)).toEqual('Joseph');\n\t});\n\n\tit('formats first and last names', () => {\n\t\texpect(format('Joseph', undefined, 'Publique')).toEqual('Joseph Publique');\n\t});\n\n\tit('formats first, middle and last names', () => {\n\t\texpect(format('Joseph', 'Quincy', 'Publique')).toEqual('Joseph Quincy Publique');\n\t});\n});\n\ndescribe('isNumber', () => {\n\tit('should return false if value is undefined', () => {\n\t\tconst value: any = undefined;\n\n\t\tconst result = isNumber(value);\n\t\texpect(result).toEqual(false);\n\t});\n\n\tit('should return false if value that is null', () => {\n\t\tconst value: any = null;\n\n\t\tconst result = isNumber(value);\n\t\texpect(result).toEqual(false);\n\t});\n\n\tit('should return true if value is a number', () => {\n\t\tconst value: number = 2000;\n\n\t\tconst result = isNumber(value);\n\t\texpect(result).toEqual(true);\n\t});\n\n\tit('should return true if value is a number as a string', () => {\n\t\tconst value: string = '2000';\n\n\t\tconst result = isNumber(value);\n\t\texpect(result).toEqual(true);\n\t});\n\n\tit('should return false if value is not a number string', () => {\n\t\tconst value: string = 'two-thousand';\n\n\t\tconst result = isNumber(value);\n\t\texpect(result).toEqual(false);\n\t});\n});\n\ndescribe('isNumber', () => {\n\tit('should return false if value is undefined', () => {\n\t\tconst value: any = undefined;\n\n\t\tconst result = isNumber(value);\n\t\texpect(result).toEqual(false);\n\t});\n\n\tit('should return false if value that is null', () => {\n\t\tconst value: any = null;\n\n\t\tconst result = isNumber(value);\n\t\texpect(result).toEqual(false);\n\t});\n\n\tit('should return true if value is a number', () => {\n\t\tconst value: number = 2000;\n\n\t\tconst result = isNumber(value);\n\t\texpect(result).toEqual(true);\n\t});\n\n\tit('should return true if value is a number as a string', () => {\n\t\tconst value: string = '2000';\n\n\t\tconst result = isNumber(value);\n\t\texpect(result).toEqual(true);\n\t});\n\n\tit('should return false if value is not a number string', () => {\n\t\tconst value: string = 'two-thousand';\n\n\t\tconst result = isNumber(value);\n\t\texpect(result).toEqual(false);\n\t});\n});\n\nenum ColourEnumNumeric {\n\tRED,\n\tORANGE,\n\tYELLOW,\n\tGREEN,\n\tBLUE,\n\tINDIGO,\n\tVIOLET,\n}\n\nenum ColourEnumString {\n\t'red' = 'Red',\n\t'orange' = 'Orange',\n\t'yellow' = 'Yellow',\n\t'green' = 'Green',\n\t'blue' = 'Blue',\n\t'indigo' = 'Indigo',\n\t'violet' = 'Violet',\n}\n\ndescribe('retrieveEnumKeys', () => {\n\tit('should return empty array if enumObject is undefined', () => {\n\t\tconst expectedResult = new Array<string>(0);\n\t\tconst enumObject: any = undefined;\n\n\t\tconst result = retrieveEnumKeys(enumObject);\n\t\texpect(result).toEqual(expectedResult);\n\t});\n\n\tit('should return empty array if enumObject is null', () => {\n\t\tconst expectedResult = new Array<string>(0);\n\t\tconst enumObject: any = null;\n\n\t\tconst result = retrieveEnumKeys(enumObject);\n\t\texpect(result).toEqual(expectedResult);\n\t});\n\n\tit('should return keys from numerical enum', () => {\n\t\tconst expectedResult = ['RED', 'ORANGE', 'YELLOW', 'GREEN', 'BLUE', 'INDIGO', 'VIOLET'];\n\n\t\tconst result = retrieveEnumKeys(ColourEnumNumeric);\n\t\texpect(result).toEqual(expectedResult);\n\t});\n\n\tit('should return keys from string enum', () => {\n\t\tconst expectedResult = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];\n\n\t\tconst result = retrieveEnumKeys(ColourEnumString);\n\t\texpect(result).toEqual(expectedResult);\n\t});\n});\n"]}
|
|
@@ -89,15 +89,25 @@ const isInvalidMonth = (value) => {
|
|
|
89
89
|
const month = Number(value);
|
|
90
90
|
return month < MONTH_MIN_VALUE || month > MONTH_MAX_VALUE;
|
|
91
91
|
};
|
|
92
|
-
|
|
93
|
-
*
|
|
92
|
+
/**
|
|
93
|
+
* Valid value year against minimum and maximum year range (defaulted if not provided.)
|
|
94
|
+
*
|
|
95
|
+
* Year field should be a number and not written out; it has no concept of positive and negative.
|
|
96
|
+
*
|
|
97
|
+
* Suggestion:
|
|
98
|
+
* - `< 0` B.C.E.
|
|
99
|
+
* - `>= 0` A.C.E.
|
|
100
|
+
*
|
|
101
|
+
* @param value value to check for validity
|
|
102
|
+
* @param minYear minimum valid year to validate against
|
|
103
|
+
* @param maxYear maximum valid year to validate against
|
|
94
104
|
*/
|
|
95
105
|
const isInvalidYear = (value, minYear = YEAR_MIN_VALUE, maxYear = YEAR_MAX_VALUE) => {
|
|
96
106
|
if (!isNumber(value)) {
|
|
97
107
|
return true;
|
|
98
108
|
}
|
|
99
109
|
const year = Number(value);
|
|
100
|
-
return year
|
|
110
|
+
return year < minYear || year > maxYear;
|
|
101
111
|
};
|
|
102
112
|
/**
|
|
103
113
|
* Helper function to get error message for birthdate validation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"ontario-date-input.js","mappings":";;;;;;;;;;;AAmBO,MAAM,KAAK,GAAoC,CAAC,EACtD,EAAE,EACF,IAAI,EACJ,KAAK,EACL,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,QAAQ,EACR,OAAO,EACP,MAAM,EACN,eAAe,EACf,KAAK,GAAG,KAAK,EACb,QAAQ,GAAG,KAAK,GAChB;IACA,MAAM,gBAAgB,GAAG,CAAC,KAAY;;QACrC,MAAM,QAAQ,GAAG,MAAA,MAAC,KAAK,CAAC,MAA2B,0CAAE,KAAK,mCAAI,EAAE,CAAC;QACjE,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;KACxB,CAAC;IAEF,MAAM,iBAAiB,GAAG,CAAC,KAAY;;QACtC,MAAM,QAAQ,GAAG,MAAA,MAAC,KAAK,CAAC,MAA2B,0CAAE,KAAK,mCAAI,EAAE,CAAC;QACjE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;KACzB,CAAC;IAEF,MAAM,gBAAgB,GAAG;QACxB,OAAO,CAAC,IAAI,CAAC,CAAC;KACd,CAAC;IAEF,MAAM,eAAe,GAAG;QACvB,MAAM,CAAC,IAAI,CAAC,CAAC;KACb,CAAC;IAEF,QACC,WAAK,KAAK,EAAE,6BAA6B,KAAK,GAAG,qBA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,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,KAAK,EAAE,IAAI,CAAC,YAAY,EACxB,WAAW,EAAE,eAAe,CAAC,KAAK,EAClC,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAChC,MAAM,EAAE,IAAI,CAAC,cAAc,EAC3B,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,eAAe,EAAE,UAAU,GAC1B,CACF,EACA,UAAU,KACV,EAAC,KAAK,IACL,EAAE,EAAE,KAAK,EACT,IAAI,EAAC,KAAK,EACV,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EACtC,kBAAkB,EAAE,WAAW,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,EAC3D,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,KAAK,EAAE,IAAI,CAAC,UAAU,EACtB,WAAW,EAAE,eAAe,CAAC,GAAG,EAChC,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAChC,MAAM,EAAE,IAAI,CAAC,cAAc,EAC3B,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,eAAe,EAAE,UAAU,GAC1B,CACF,CACI,CACI,CACN,EACL;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CommonInput","OntarioDateInput","uuid"],"sources":["src/components/ontario-date-input/components/input.tsx","src/components/ontario-date-input/constants/date-input-constants.ts","src/components/ontario-date-input/utils/date-validation-utils.ts","src/components/ontario-date-input/utils/date-options-utils.ts","src/components/ontario-date-input/ontario-date-input.scss?tag=ontario-date-input&encapsulation=shadow","src/components/ontario-date-input/ontario-date-input.tsx"],"sourcesContent":["import { FunctionalComponent, h } from '@stencil/core';\nimport { DateInputFieldType } from '../ontario-date-input-interface';\nimport { Input as CommonInput } from '../../../utils/common/input/input';\n\nexport type InputProps = {\n\tid: string;\n\ttype: DateInputFieldType;\n\tlabel: string;\n\taccessibilityLabel: string;\n\terror?: boolean;\n\tonInput: (value: string, fieldType: DateInputFieldType) => void;\n\tonChange: (value: string, fieldType: DateInputFieldType) => void;\n\tonBlur: (fieldType: DateInputFieldType) => void;\n\tonFocus: (fieldType: DateInputFieldType) => void;\n\tplaceholder?: string;\n\trequired?: boolean;\n\tariaDescribedBy?: string;\n};\n\nexport const Input: FunctionalComponent<InputProps> = ({\n\tid,\n\ttype,\n\tlabel,\n\taccessibilityLabel,\n\tplaceholder,\n\tonInput,\n\tonChange,\n\tonFocus,\n\tonBlur,\n\tariaDescribedBy,\n\terror = false,\n\trequired = false,\n}) => {\n\tconst handleInputInput = (event: Event) => {\n\t\tconst newValue = (event.target as HTMLInputElement)?.value ?? '';\n\t\tonInput(newValue, type);\n\t};\n\n\tconst handleInputChange = (event: Event) => {\n\t\tconst newValue = (event.target as HTMLInputElement)?.value ?? '';\n\t\tonChange(newValue, type);\n\t};\n\n\tconst handleInputFocus = () => {\n\t\tonFocus(type);\n\t};\n\n\tconst handleInputBlur = () => {\n\t\tonBlur(type);\n\t};\n\n\treturn (\n\t\t<div class={`ontario-date__group-input ${error ? 'ontario-date--error' : ''}`}>\n\t\t\t<label htmlFor={id}>\n\t\t\t\t{label}\n\t\t\t\t<span class=\"ontario-show-for-sr\">({accessibilityLabel})</span>\n\t\t\t</label>\n\t\t\t<CommonInput\n\t\t\t\tclassName=\"ontario-input ontario-input--4-char-width\"\n\t\t\t\ttype=\"text\"\n\t\t\t\tinputMode=\"numeric\"\n\t\t\t\tid={id}\n\t\t\t\trequired={!!required}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\tonInput={handleInputInput}\n\t\t\t\tonChange={handleInputChange}\n\t\t\t\tonFocus={handleInputFocus}\n\t\t\t\tonBlur={handleInputBlur}\n\t\t\t\tariaInvalid={error}\n\t\t\t\tariaDescribedBy={ariaDescribedBy}\n\t\t\t/>\n\t\t</div>\n\t);\n};\n","export const DAY_MIN_VALUE = 1;\nexport const DAY_MAX_VALUE = 31;\nexport const MONTH_MIN_VALUE = 1;\nexport const MONTH_MAX_VALUE = 12;\nexport const YEAR_MIN_VALUE = 999;\nexport const YEAR_MAX_VALUE = 9999;\n","import {\n\tDAY_MIN_VALUE,\n\tDAY_MAX_VALUE,\n\tMONTH_MIN_VALUE,\n\tMONTH_MAX_VALUE,\n\tYEAR_MIN_VALUE,\n\tYEAR_MAX_VALUE,\n} from '../constants';\nimport { DateValidatorReturnType } from '../ontario-date-input-interface';\nimport { isNumber, isEmpty } from '../../../utils/helper/utils';\nimport { Translations } from '../../../translations';\n/*\n * Day field should be a number, not negative, no greater than “31”\n */\nconst isInvalidDay = (value: string) => {\n\tif (!isNumber(value)) {\n\t\treturn true;\n\t}\n\n\tconst day = Number(value);\n\n\treturn day < DAY_MIN_VALUE || day > DAY_MAX_VALUE;\n};\n\n/*\n * Month field should be a number, not negative, no greater than “12”\n */\nconst isInvalidMonth = (value: string) => {\n\tif (!isNumber(value)) {\n\t\treturn true;\n\t}\n\n\tconst month = Number(value);\n\n\treturn month < MONTH_MIN_VALUE || month > MONTH_MAX_VALUE;\n};\n\n/*\n * Year field should be a number, not negative, at length at least 4 digits\n */\nconst isInvalidYear = (value: string, minYear: number = YEAR_MIN_VALUE, maxYear: number = YEAR_MAX_VALUE) => {\n\tif (!isNumber(value)) {\n\t\treturn true;\n\t}\n\n\tconst year = Number(value);\n\n\treturn year <= minYear || year > maxYear;\n};\n\ntype GetDateErrorArg = {\n\tdayValue: string;\n\tmonthValue: string;\n\tyearValue: string;\n\terrorMessages: Translations['dateInput']['error']['en'];\n\tminYear?: number;\n\tmaxYear?: number;\n\tdayVisible: boolean;\n\tmonthVisible: boolean;\n\tyearVisible: boolean;\n};\n/**\n * Helper function to get error message for birthdate validation\n */\nexport const getDateErrorMessage = ({\n\tdayValue,\n\tmonthValue,\n\tyearValue,\n\terrorMessages,\n\tminYear,\n\tmaxYear,\n\tdayVisible,\n\tmonthVisible,\n\tyearVisible,\n}: GetDateErrorArg): DateValidatorReturnType => {\n\tconst {\n\t\temptyDay,\n\t\temptyMonth,\n\t\temptyYear,\n\t\temptyDayAndMonth,\n\t\temptyDayAndYear,\n\t\temptyMonthAndYear,\n\t\tinvalidDate,\n\t\tinvalidDay,\n\t\tinvalidMonth,\n\t\tinvalidYear,\n\t} = errorMessages;\n\n\tlet error = '';\n\tlet dayInvalid = false;\n\tlet monthInvalid = false;\n\tlet yearInvalid = false;\n\n\tconst isDayEmpty = dayVisible && isEmpty(dayValue);\n\tconst isMonthEmpty = monthVisible && isEmpty(monthValue);\n\tconst isYearEmpty = yearVisible && isEmpty(yearValue);\n\t/*\n\t * If one ore more fields are valid but others are empty:\n\t * 1 field empty:\n\t * Day as empty - “Enter the day.”\n\t * Month as empty - “Enter the month.”\n\t * Year as empty - “Enter the year.”\n\t * 2 fields empty:\n\t * Month and day empty - “Enter the month and day.”\n\t * Year and day empty - “Enter the year and day.”\n\t * Year and month empty - “Enter the year and month.”\n\t */\n\tif (isDayEmpty && isMonthEmpty && isYearEmpty) {\n\t\terror = invalidDate;\n\t\tdayInvalid = true;\n\t\tmonthInvalid = true;\n\t\tyearInvalid = true;\n\t} else if (isDayEmpty && isMonthEmpty) {\n\t\terror = emptyDayAndMonth;\n\t\tdayInvalid = true;\n\t\tmonthInvalid = true;\n\t} else if (isDayEmpty && isYearEmpty) {\n\t\terror = emptyDayAndYear;\n\t\tdayInvalid = true;\n\t\tyearInvalid = true;\n\t} else if (isMonthEmpty && isYearEmpty) {\n\t\terror = emptyMonthAndYear;\n\t\tyearInvalid = true;\n\t\tmonthInvalid = true;\n\t} else if (isDayEmpty) {\n\t\terror = emptyDay;\n\t\tdayInvalid = true;\n\t} else if (isMonthEmpty) {\n\t\terror = emptyMonth;\n\t\tmonthInvalid = true;\n\t} else if (isYearEmpty) {\n\t\terror = emptyYear;\n\t\tyearInvalid = true;\n\t}\n\n\tconst isDayInvalid = dayVisible && isInvalidDay(dayValue);\n\tconst isMonthInvalid = monthVisible && isInvalidMonth(monthValue);\n\tconst isYearInvalid = yearVisible && isInvalidYear(yearValue, minYear, maxYear);\n\t/*\n\t * If only one error, specify where the error occurs\n\t * E.g. “Enter a valid day.”, “Enter a valid month.” Or “Enter a valid year.”\n\t * If 2 or more fields have error (or all 3), say “Enter a valid date.”\n\t * If one or more fields are invalid but the others are empty say: “Enter a valid date.”\n\t */\n\tif (isEmpty(error)) {\n\t\tif (isDayInvalid && isMonthInvalid && isYearInvalid) {\n\t\t\terror = invalidDate;\n\t\t\tdayInvalid = true;\n\t\t\tmonthInvalid = true;\n\t\t\tyearInvalid = true;\n\t\t} else if (isDayInvalid && isMonthInvalid) {\n\t\t\terror = invalidDate;\n\t\t\tdayInvalid = true;\n\t\t\tmonthInvalid = true;\n\t\t} else if (isDayInvalid && isYearInvalid) {\n\t\t\terror = invalidDate;\n\t\t\tdayInvalid = true;\n\t\t\tyearInvalid = true;\n\t\t} else if (isMonthInvalid && isYearInvalid) {\n\t\t\terror = invalidDate;\n\t\t\tmonthInvalid = true;\n\t\t\tyearInvalid = true;\n\t\t} else if (isYearInvalid) {\n\t\t\terror = invalidYear;\n\t\t\tyearInvalid = true;\n\t\t} else if (isMonthInvalid) {\n\t\t\terror = invalidMonth;\n\t\t\tmonthInvalid = true;\n\t\t} else if (isDayInvalid) {\n\t\t\terror = invalidDay;\n\t\t\tdayInvalid = true;\n\t\t}\n\t}\n\n\treturn { errorMessage: error, dayInvalid, monthInvalid, yearInvalid };\n};\n","import { DateInputFieldType } from '../ontario-date-input-interface';\n\nexport const getVisibleDateFields = (dateOptions: Array<DateInputFieldType>) => {\n\tconst dayVisible = dateOptions.includes('day');\n\tconst monthVisible = dateOptions.includes('month');\n\tconst yearVisible = dateOptions.includes('year');\n\n\treturn { dayVisible, monthVisible, yearVisible };\n};\n","@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/colours.variables' as colours;\n@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/spacing.variables' as spacing;\n@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/font-weights.variables' as fontWeights;\n@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/global.variables' as globalVariables;\n@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/4-elements/_global.elements.scss';\n@use '../../styles/form.scss';\n@forward '../../utils/components/error-message/error-message';\n\n.ontario-date__group {\n\tdisplay: flex;\n\n\tlabel {\n\t\tfont-weight: fontWeights.$ontario-font-weights-semi-bold;\n\t}\n\n\tinput {\n\t\tmargin-top: spacing.$spacing-4;\n\t}\n}\n\n.ontario-date__group-input {\n\tdisplay: flex;\n\tflex-direction: column;\n\tmargin-right: spacing.$spacing-5;\n}\n\n.ontario-date--error {\n\tinput {\n\t\tborder: 0.125rem solid colours.$ontario-colour-alert;\n\t}\n}\n","import { Component, EventEmitter, Element, Watch, Event, Prop, h, State, Listen, AttachInternals } from '@stencil/core';\nimport { v4 as uuid } from 'uuid';\nimport { Language } from '../../utils/common/language-types';\nimport { validateLanguage } from '../../utils/validation/validation-functions';\nimport { translations, Translations } from '../../translations';\nimport { Input } from './components';\nimport { getDateErrorMessage, getVisibleDateFields } from './utils';\nimport { DateInputFieldType, DateInputPlaceholder, DateValidatorReturnType } from './ontario-date-input-interface';\nimport { ErrorMessage } from '../../utils/components/error-message/error-message';\nimport { ConsoleMessageClass } from '../../utils/console-message/console-message';\nimport { ConsoleType } from '../../utils/console-message/console-message.enum';\nimport { InputCaption } from '../../utils/common/input-caption/input-caption';\nimport { Caption } from '../../utils/common/input-caption/caption.interface';\nimport { emitEvent } from '../../utils/events/event-handler';\n\n@Component({\n\ttag: 'ontario-date-input',\n\tstyleUrl: 'ontario-date-input.scss',\n\tshadow: true,\n\tformAssociated: true,\n})\nexport class OntarioDateInput {\n\t@Element() element: HTMLElement;\n\t@AttachInternals() internals: ElementInternals;\n\n\t/**\n\t * The language of the component.\n\t * This is used for translations, and is by default set through event listeners checking for a language property from the header. If none are passed, it will default to English.\n\t */\n\t@Prop({ mutable: true }) language?: Language;\n\n\t/**\n\t * A boolean value to determine whether or not the date input is required.\n\t *\n\t * This is optional. If no prop is passed, it will default to `false`.\n\t */\n\t@Prop() required?: boolean = false;\n\n\t/**\n\t * An object value used to set the placeholder text for the day, month and year input fields. Any combination of the three input fields (i.e day, month, year)\n\t * of the date component can be overridden.\n\t *\n\t * This is optional. If no prop is passed, it will not display any placeholder text.\n\t */\n\t@Prop() placeholder?: DateInputPlaceholder | string;\n\n\t/**\n\t * The text to display as the input label\n\t *\n\t * @example\n\t * <ontario-date-input\n\t * caption='{\n\t * \"captionText\": \"Exact Date\",\n\t * \"captionType\": \"heading\",\n\t * }\n\t * required=\"true\"\n\t * ...>\n\t * </ontario-date-input>\n\t */\n\t@Prop() caption: Caption | string;\n\n\t/**\n\t * The unique identifier of the input. This is optional - if no ID is passed, one will be generated.\n\t */\n\t@Prop({ mutable: true }) elementId?: string;\n\n\t/**\n\t * A number value indicating minimum value allowed for year input field of the date component.\n\t *\n\t * This is optional. If no prop is passed, it will default to `999`.\n\t */\n\t@Prop() minYear?: number;\n\n\t/**\n\t * A number value indicating maximum value allowed for year input field of the date component.\n\t *\n\t * This is optional. If no prop is passed, it will default to `9999`.\n\t */\n\t@Prop() maxYear?: number;\n\n\t/**\n\t * Used to include the ontario-hint-text component for the date input group.\n\t *\n\t * This is optional.\n\t */\n\t@Prop() hintText?: string;\n\n\t/**\n\t * An array value used to display date options. For example, only the day and month fields can be displayed by\n\t * specifying the dateOptions as `[\"day\", \"month\"]`, etc.\n\t *\n\t * This is optional. If no prop for `dateOptions` is passed, it will default to `[\"day\", \"month\", \"year\"]`.\n\t */\n\t@Prop() dateOptions?: string | Array<DateInputFieldType> = ['day', 'month', 'year'];\n\n\t/**\n\t * A function used to override internal date validation logic, which takes three arguments (i.e day, month and year) and returns\n\t * an object of type `DateValidatorReturnType`\n\t *\n\t * This is optional. If no prop for `dateValidator` is passed, it will default to internal validation function to validate\n\t * the date input.\n\t */\n\t@Prop() dateValidator?: (day: string, month: string, year: string) => DateValidatorReturnType;\n\n\t/**\n\t * Emitted when an `input` event occurs within the component.\n\t */\n\t@Event() inputOnInput: EventEmitter<{\n\t\tvalue: string;\n\t\tfieldType: 'day' | 'month' | 'year';\n\t}>;\n\n\t/**\n\t * Emitted when a `change` event occurs within the component.\n\t */\n\t@Event() inputOnChange: EventEmitter<{\n\t\tvalue: string;\n\t\tfieldType: 'day' | 'month' | 'year';\n\t}>;\n\n\t/**\n\t * Emitted when a keyboard input event occurs when an input has lost focus.\n\t */\n\t@Event() inputOnBlur: EventEmitter<'day' | 'month' | 'year'>;\n\n\t/**\n\t * Emitted when a keyboard input event occurs when an input has gained focus.\n\t */\n\t@Event() inputOnFocus: EventEmitter<'day' | 'month' | 'year'>;\n\n\t/**\n\t * Emitted when an error message is reported to the component.\n\t */\n\t@Event() inputErrorOccurred: EventEmitter<{ inputId: string; errorMessage: string }>;\n\n\t@Watch('errorMessage')\n\tbroadcastInputErrorOccurredEvent() {\n\t\t// Emit event to notify anyone who wants to listen for errors occurring\n\t\tthis.inputErrorOccurred.emit({ inputId: this.getId(), errorMessage: this.errorMessage ?? '' });\n\t}\n\n\t/**\n\t * This listens for the `setAppLanguage` event sent from the test language toggler when it is is connected to the DOM. It is used for the initial language when the input component loads.\n\t */\n\t@Listen('setAppLanguage', { target: 'window' })\n\thandleSetAppLanguage(event: CustomEvent<Language>) {\n\t\tif (!this.language) {\n\t\t\tthis.language = validateLanguage(event);\n\t\t}\n\t}\n\n\t@Listen('headerLanguageToggled', { target: 'window' })\n\thandleHeaderLanguageToggled(event: CustomEvent<Language>) {\n\t\tthis.language = validateLanguage(event);\n\t}\n\n\t@Listen('blur', { capture: true })\n\thandleComponentBlur() {\n\t\tconst { day, month, year, minYear, maxYear, dateValidator, dateOptionsState } = this;\n\t\tconst { dayVisible, monthVisible, yearVisible } = getVisibleDateFields(dateOptionsState);\n\n\t\t// if user has not interacted with the component, skip validation\n\t\tif (!this.isDateTyped) {\n\t\t\treturn;\n\t\t}\n\t\tconst errorMessages = translations.dateInput.error[this.getLanguage()];\n\t\tconst { dayInvalid, monthInvalid, yearInvalid, errorMessage } = dateValidator\n\t\t\t? dateValidator(day, month, year)\n\t\t\t: getDateErrorMessage({\n\t\t\t\t\tdayValue: day,\n\t\t\t\t\tmonthValue: month,\n\t\t\t\t\tyearValue: year,\n\t\t\t\t\terrorMessages,\n\t\t\t\t\tminYear,\n\t\t\t\t\tmaxYear,\n\t\t\t\t\tdayVisible,\n\t\t\t\t\tmonthVisible,\n\t\t\t\t\tyearVisible,\n\t\t\t });\n\n\t\tthis.dayInvalid = dayInvalid;\n\t\tthis.monthInvalid = monthInvalid;\n\t\tthis.yearInvalid = yearInvalid;\n\t\tthis.errorMessage = errorMessage;\n\t}\n\n\t@State() private translations: Translations = translations;\n\t@State() private captionState: InputCaption;\n\n\t@State() private isDateTyped: boolean = false;\n\t@State() private dayInvalid: boolean = false;\n\t@State() private monthInvalid: boolean = false;\n\t@State() private yearInvalid: boolean = false;\n\t@State() private errorMessage: string | undefined;\n\n\t@State() private day: string = '';\n\t@State() private month: string = '';\n\t@State() private year: string = '';\n\n\t@State() private placeholderState: DateInputPlaceholder;\n\t@State() private dateOptionsState: Array<DateInputFieldType>;\n\n\t/**\n\t * Watch for changes to the `caption` prop.\n\t *\n\t * The caption will be run through the InputCaption constructor to convert it to the correct format, and set the result to the `captionState` state.\n\t * @param newValue: Caption | string\n\t */\n\t@Watch('caption')\n\tprivate updateCaptionState(newValue: Caption | string) {\n\t\tthis.captionState = new InputCaption(\n\t\t\tthis.element.tagName,\n\t\t\tnewValue,\n\t\t\ttranslations,\n\t\t\tthis.language,\n\t\t\ttrue,\n\t\t\tthis.required,\n\t\t);\n\t}\n\n\t/**\n\t * Watch for changes in the `language` prop to render either the English or French translations\n\t */\n\t@Watch('language')\n\tupdateLanguage() {\n\t\tthis.updateCaptionState(this.caption);\n\t}\n\n\tprivate processPlaceholder() {\n\t\tthis.parseOptions(this.placeholder);\n\t}\n\n\tprivate processDateOptions() {\n\t\tthis.parseOptions(this.dateOptions);\n\t}\n\n\tprivate parseOptions(options: any) {\n\t\tconst isString = typeof options === 'string';\n\t\tif (!options) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tif (options === this.placeholder) {\n\t\t\t\tthis.placeholderState = isString ? JSON.parse(options) : options;\n\t\t\t} else if (options === this.dateOptions) {\n\t\t\t\tthis.dateOptionsState = isString ? JSON.parse(options) : options;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst message = new ConsoleMessageClass();\n\t\t\tmessage\n\t\t\t\t.addDesignSystemTag()\n\t\t\t\t.addRegularText(' failed to parse props for ')\n\t\t\t\t.addMonospaceText('<ontario-date-input>')\n\t\t\t\t.addRegularText(' in ')\n\t\t\t\t.addMonospaceText('parseOptions()')\n\t\t\t\t.addRegularText(' method \\n ')\n\t\t\t\t.addMonospaceText(error.stack)\n\t\t\t\t.printMessage(ConsoleType.Error);\n\t\t}\n\t}\n\n\tprivate isInvalidDate = () => {\n\t\treturn this.dayInvalid || this.monthInvalid || this.yearInvalid;\n\t};\n\n\tprivate resetErrorState = () => {\n\t\tif (!this.isInvalidDate()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.dayInvalid = false;\n\t\tthis.monthInvalid = false;\n\t\tthis.yearInvalid = false;\n\t\tthis.errorMessage = '';\n\t};\n\n\tprivate updateDateState = (value: string, inputFieldType: DateInputFieldType) => {\n\t\tswitch (inputFieldType) {\n\t\t\tcase 'day':\n\t\t\t\tthis.day = value;\n\t\t\t\tbreak;\n\t\t\tcase 'month':\n\t\t\t\tthis.month = value;\n\t\t\t\tbreak;\n\t\t\tcase 'year':\n\t\t\t\tthis.year = value;\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\tprivate handleDateUpdates = (value: string, fieldType: DateInputFieldType) => {\n\t\t// set boolean indicating user interaction with the component for validation\n\t\tif (!this.isDateTyped) {\n\t\t\tthis.isDateTyped = true;\n\t\t}\n\n\t\t// reset error state when user starts typing\n\t\tthis.resetErrorState();\n\n\t\t// update date state\n\t\tthis.updateDateState(value, fieldType);\n\n\t\t// TODO: verify are all the values numbers?\n\t\tif (this.year && this.month && this.day) {\n\t\t\tconst desiredDate = new Date(\n\t\t\t\tDate.UTC(parseInt(this.year), parseInt(this.month) - 1, parseInt(this.day), 0, 0, 0, 0),\n\t\t\t);\n\t\t\tthis.internals?.setFormValue?.(desiredDate.toISOString());\n\t\t}\n\t};\n\n\tprivate handleDateInput = (value: string, fieldType: DateInputFieldType) => {\n\t\tthis.handleDateUpdates(value, fieldType);\n\n\t\t// emit date change event\n\t\tthis.inputOnInput.emit({ value, fieldType });\n\t};\n\n\tprivate handleDateChanged = (value: string, fieldType: DateInputFieldType) => {\n\t\tthis.handleDateUpdates(value, fieldType);\n\n\t\t// emit date change event\n\t\tthis.inputOnChange.emit({ value, fieldType });\n\n\t\t// emit change event\n\t\temitEvent(this.element, 'change', { value, fieldType });\n\t};\n\n\tprivate handleDateFocus = (fieldType: DateInputFieldType) => {\n\t\t// emit date field focus event\n\t\tthis.inputOnFocus.emit(fieldType);\n\t};\n\n\tprivate handleDateBlur = (fieldType: DateInputFieldType) => {\n\t\t// emit date field focus event\n\t\tthis.inputOnBlur.emit(fieldType);\n\t};\n\n\tprivate getLanguage(): Language {\n\t\treturn this.language ?? 'en';\n\t}\n\n\tprivate getCaption(): Caption | string {\n\t\tconst language = this.getLanguage();\n\t\tconst captionText = translations.dateInput.caption[language];\n\n\t\treturn this.caption ?? { captionText, captionType: 'default' };\n\t}\n\n\tprivate getId(): string {\n\t\treturn this.elementId ?? '';\n\t}\n\n\tprivate getHintTextId(): string {\n\t\treturn `date-input-hint-${this.getId()}`;\n\t}\n\n\tprivate getInputIds() {\n\t\tconst id = this.getId();\n\n\t\tconst dayId = `day-${id}`;\n\t\tconst monthId = `month-${id}`;\n\t\tconst yearId = `year-${id}`;\n\n\t\treturn { dayId, monthId, yearId };\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.processPlaceholder();\n\t\tthis.processDateOptions();\n\n\t\tthis.updateCaptionState(this.getCaption());\n\t\tthis.elementId = this.elementId ?? uuid();\n\n\t\tthis.language = validateLanguage(this.language) as Language;\n\t}\n\n\trender() {\n\t\tconst { dateOptionsState, required, translations, hintText, placeholderState } = this;\n\t\tconst language = this.getLanguage();\n\t\tconst dateStrings = translations.dateInput;\n\t\tconst placeholderText = placeholderState ?? {};\n\t\tconst { dayVisible, monthVisible, yearVisible } = getVisibleDateFields(dateOptionsState);\n\t\tconst { dayId, monthId, yearId } = this.getInputIds();\n\t\tconst hintTextId = this.getHintTextId();\n\n\t\treturn (\n\t\t\t<div class=\"ontario-form-group\">\n\t\t\t\t<fieldset role=\"group\" class=\"ontario-fieldset\">\n\t\t\t\t\t{this.captionState.getCaption()}\n\t\t\t\t\t{!!hintText && (\n\t\t\t\t\t\t<p id={hintTextId} class=\"ontario-hint\">\n\t\t\t\t\t\t\t{hintText}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t)}\n\t\t\t\t\t<ErrorMessage message={this.errorMessage} error={this.isInvalidDate()} />\n\t\t\t\t\t<div class=\"ontario-date__group\">\n\t\t\t\t\t\t{yearVisible && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tid={yearId}\n\t\t\t\t\t\t\t\ttype=\"year\"\n\t\t\t\t\t\t\t\tlabel={dateStrings.year.label[language]}\n\t\t\t\t\t\t\t\taccessibilityLabel={dateStrings.year.accessibility[language]}\n\t\t\t\t\t\t\t\trequired={!!required}\n\t\t\t\t\t\t\t\terror={this.yearInvalid}\n\t\t\t\t\t\t\t\tplaceholder={placeholderText.year}\n\t\t\t\t\t\t\t\tonInput={this.handleDateInput}\n\t\t\t\t\t\t\t\tonChange={this.handleDateChanged}\n\t\t\t\t\t\t\t\tonBlur={this.handleDateBlur}\n\t\t\t\t\t\t\t\tonFocus={this.handleDateFocus}\n\t\t\t\t\t\t\t\tariaDescribedBy={hintTextId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{monthVisible && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tid={monthId}\n\t\t\t\t\t\t\t\ttype=\"month\"\n\t\t\t\t\t\t\t\tlabel={dateStrings.month.label[language]}\n\t\t\t\t\t\t\t\taccessibilityLabel={dateStrings.month.accessibility[language]}\n\t\t\t\t\t\t\t\trequired={!!required}\n\t\t\t\t\t\t\t\terror={this.monthInvalid}\n\t\t\t\t\t\t\t\tplaceholder={placeholderText.month}\n\t\t\t\t\t\t\t\tonInput={this.handleDateInput}\n\t\t\t\t\t\t\t\tonChange={this.handleDateChanged}\n\t\t\t\t\t\t\t\tonBlur={this.handleDateBlur}\n\t\t\t\t\t\t\t\tonFocus={this.handleDateFocus}\n\t\t\t\t\t\t\t\tariaDescribedBy={hintTextId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{dayVisible && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tid={dayId}\n\t\t\t\t\t\t\t\ttype=\"day\"\n\t\t\t\t\t\t\t\tlabel={dateStrings.day.label[language]}\n\t\t\t\t\t\t\t\taccessibilityLabel={dateStrings.day.accessibility[language]}\n\t\t\t\t\t\t\t\trequired={!!required}\n\t\t\t\t\t\t\t\terror={this.dayInvalid}\n\t\t\t\t\t\t\t\tplaceholder={placeholderText.day}\n\t\t\t\t\t\t\t\tonInput={this.handleDateInput}\n\t\t\t\t\t\t\t\tonChange={this.handleDateChanged}\n\t\t\t\t\t\t\t\tonBlur={this.handleDateBlur}\n\t\t\t\t\t\t\t\tonFocus={this.handleDateFocus}\n\t\t\t\t\t\t\t\tariaDescribedBy={hintTextId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</fieldset>\n\t\t\t</div>\n\t\t);\n\t}\n}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AAE,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EACtC,kBAAkB,EAAE,WAAW,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,EAC3D,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,KAAK,EAAE,IAAI,CAAC,UAAU,EACtB,WAAW,EAAE,eAAe,CAAC,GAAG,EAChC,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAChC,MAAM,EAAE,IAAI,CAAC,cAAc,EAC3B,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,eAAe,EAAE,UAAU,GAC1B,CACF,CACI,CACI,CACN,EACL;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CommonInput","OntarioDateInput","uuid"],"sources":["src/components/ontario-date-input/components/input.tsx","src/components/ontario-date-input/constants/date-input-constants.ts","src/components/ontario-date-input/utils/date-validation-utils.ts","src/components/ontario-date-input/utils/date-options-utils.ts","src/components/ontario-date-input/ontario-date-input.scss?tag=ontario-date-input&encapsulation=shadow","src/components/ontario-date-input/ontario-date-input.tsx"],"sourcesContent":["import { FunctionalComponent, h } from '@stencil/core';\nimport { DateInputFieldType } from '../ontario-date-input-interface';\nimport { Input as CommonInput } from '../../../utils/common/input/input';\n\nexport type InputProps = {\n\tid: string;\n\ttype: DateInputFieldType;\n\tlabel: string;\n\taccessibilityLabel: string;\n\terror?: boolean;\n\tonInput: (value: string, fieldType: DateInputFieldType) => void;\n\tonChange: (value: string, fieldType: DateInputFieldType) => void;\n\tonBlur: (fieldType: DateInputFieldType) => void;\n\tonFocus: (fieldType: DateInputFieldType) => void;\n\tplaceholder?: string;\n\trequired?: boolean;\n\tariaDescribedBy?: string;\n};\n\nexport const Input: FunctionalComponent<InputProps> = ({\n\tid,\n\ttype,\n\tlabel,\n\taccessibilityLabel,\n\tplaceholder,\n\tonInput,\n\tonChange,\n\tonFocus,\n\tonBlur,\n\tariaDescribedBy,\n\terror = false,\n\trequired = false,\n}) => {\n\tconst handleInputInput = (event: Event) => {\n\t\tconst newValue = (event.target as HTMLInputElement)?.value ?? '';\n\t\tonInput(newValue, type);\n\t};\n\n\tconst handleInputChange = (event: Event) => {\n\t\tconst newValue = (event.target as HTMLInputElement)?.value ?? '';\n\t\tonChange(newValue, type);\n\t};\n\n\tconst handleInputFocus = () => {\n\t\tonFocus(type);\n\t};\n\n\tconst handleInputBlur = () => {\n\t\tonBlur(type);\n\t};\n\n\treturn (\n\t\t<div class={`ontario-date__group-input ${error ? 'ontario-date--error' : ''}`}>\n\t\t\t<label htmlFor={id}>\n\t\t\t\t{label}\n\t\t\t\t<span class=\"ontario-show-for-sr\">({accessibilityLabel})</span>\n\t\t\t</label>\n\t\t\t<CommonInput\n\t\t\t\tclassName=\"ontario-input ontario-input--4-char-width\"\n\t\t\t\ttype=\"text\"\n\t\t\t\tinputMode=\"numeric\"\n\t\t\t\tid={id}\n\t\t\t\trequired={!!required}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\tonInput={handleInputInput}\n\t\t\t\tonChange={handleInputChange}\n\t\t\t\tonFocus={handleInputFocus}\n\t\t\t\tonBlur={handleInputBlur}\n\t\t\t\tariaInvalid={error}\n\t\t\t\tariaDescribedBy={ariaDescribedBy}\n\t\t\t/>\n\t\t</div>\n\t);\n};\n","export const DAY_MIN_VALUE = 1;\nexport const DAY_MAX_VALUE = 31;\nexport const MONTH_MIN_VALUE = 1;\nexport const MONTH_MAX_VALUE = 12;\nexport const YEAR_MIN_VALUE = 999;\nexport const YEAR_MAX_VALUE = 9999;\n","import {\n\tDAY_MIN_VALUE,\n\tDAY_MAX_VALUE,\n\tMONTH_MIN_VALUE,\n\tMONTH_MAX_VALUE,\n\tYEAR_MIN_VALUE,\n\tYEAR_MAX_VALUE,\n} from '../constants';\nimport { DateValidatorReturnType } from '../ontario-date-input-interface';\nimport { isNumber, isEmpty } from '../../../utils/helper/utils';\nimport { Translations } from '../../../translations';\n/*\n * Day field should be a number, not negative, no greater than “31”\n */\nconst isInvalidDay = (value: string) => {\n\tif (!isNumber(value)) {\n\t\treturn true;\n\t}\n\n\tconst day = Number(value);\n\n\treturn day < DAY_MIN_VALUE || day > DAY_MAX_VALUE;\n};\n\n/*\n * Month field should be a number, not negative, no greater than “12”\n */\nconst isInvalidMonth = (value: string) => {\n\tif (!isNumber(value)) {\n\t\treturn true;\n\t}\n\n\tconst month = Number(value);\n\n\treturn month < MONTH_MIN_VALUE || month > MONTH_MAX_VALUE;\n};\n\n/**\n * Valid value year against minimum and maximum year range (defaulted if not provided.)\n *\n * Year field should be a number and not written out; it has no concept of positive and negative.\n *\n * Suggestion:\n * - `< 0` B.C.E.\n * - `>= 0` A.C.E.\n *\n * @param value value to check for validity\n * @param minYear minimum valid year to validate against\n * @param maxYear maximum valid year to validate against\n */\nexport const isInvalidYear = (\n\tvalue: string | number,\n\tminYear: number = YEAR_MIN_VALUE,\n\tmaxYear: number = YEAR_MAX_VALUE,\n) => {\n\tif (!isNumber(value)) {\n\t\treturn true;\n\t}\n\n\tconst year = Number(value);\n\n\treturn year < minYear || year > maxYear;\n};\n\ntype GetDateErrorArg = {\n\tdayValue: string;\n\tmonthValue: string;\n\tyearValue: string;\n\terrorMessages: Translations['dateInput']['error']['en'];\n\tminYear?: number;\n\tmaxYear?: number;\n\tdayVisible: boolean;\n\tmonthVisible: boolean;\n\tyearVisible: boolean;\n};\n/**\n * Helper function to get error message for birthdate validation\n */\nexport const getDateErrorMessage = ({\n\tdayValue,\n\tmonthValue,\n\tyearValue,\n\terrorMessages,\n\tminYear,\n\tmaxYear,\n\tdayVisible,\n\tmonthVisible,\n\tyearVisible,\n}: GetDateErrorArg): DateValidatorReturnType => {\n\tconst {\n\t\temptyDay,\n\t\temptyMonth,\n\t\temptyYear,\n\t\temptyDayAndMonth,\n\t\temptyDayAndYear,\n\t\temptyMonthAndYear,\n\t\tinvalidDate,\n\t\tinvalidDay,\n\t\tinvalidMonth,\n\t\tinvalidYear,\n\t} = errorMessages;\n\n\tlet error = '';\n\tlet dayInvalid = false;\n\tlet monthInvalid = false;\n\tlet yearInvalid = false;\n\n\tconst isDayEmpty = dayVisible && isEmpty(dayValue);\n\tconst isMonthEmpty = monthVisible && isEmpty(monthValue);\n\tconst isYearEmpty = yearVisible && isEmpty(yearValue);\n\t/*\n\t * If one ore more fields are valid but others are empty:\n\t * 1 field empty:\n\t * Day as empty - “Enter the day.”\n\t * Month as empty - “Enter the month.”\n\t * Year as empty - “Enter the year.”\n\t * 2 fields empty:\n\t * Month and day empty - “Enter the month and day.”\n\t * Year and day empty - “Enter the year and day.”\n\t * Year and month empty - “Enter the year and month.”\n\t */\n\tif (isDayEmpty && isMonthEmpty && isYearEmpty) {\n\t\terror = invalidDate;\n\t\tdayInvalid = true;\n\t\tmonthInvalid = true;\n\t\tyearInvalid = true;\n\t} else if (isDayEmpty && isMonthEmpty) {\n\t\terror = emptyDayAndMonth;\n\t\tdayInvalid = true;\n\t\tmonthInvalid = true;\n\t} else if (isDayEmpty && isYearEmpty) {\n\t\terror = emptyDayAndYear;\n\t\tdayInvalid = true;\n\t\tyearInvalid = true;\n\t} else if (isMonthEmpty && isYearEmpty) {\n\t\terror = emptyMonthAndYear;\n\t\tyearInvalid = true;\n\t\tmonthInvalid = true;\n\t} else if (isDayEmpty) {\n\t\terror = emptyDay;\n\t\tdayInvalid = true;\n\t} else if (isMonthEmpty) {\n\t\terror = emptyMonth;\n\t\tmonthInvalid = true;\n\t} else if (isYearEmpty) {\n\t\terror = emptyYear;\n\t\tyearInvalid = true;\n\t}\n\n\tconst isDayInvalid = dayVisible && isInvalidDay(dayValue);\n\tconst isMonthInvalid = monthVisible && isInvalidMonth(monthValue);\n\tconst isYearInvalid = yearVisible && isInvalidYear(yearValue, minYear, maxYear);\n\t/*\n\t * If only one error, specify where the error occurs\n\t * E.g. “Enter a valid day.”, “Enter a valid month.” Or “Enter a valid year.”\n\t * If 2 or more fields have error (or all 3), say “Enter a valid date.”\n\t * If one or more fields are invalid but the others are empty say: “Enter a valid date.”\n\t */\n\tif (isEmpty(error)) {\n\t\tif (isDayInvalid && isMonthInvalid && isYearInvalid) {\n\t\t\terror = invalidDate;\n\t\t\tdayInvalid = true;\n\t\t\tmonthInvalid = true;\n\t\t\tyearInvalid = true;\n\t\t} else if (isDayInvalid && isMonthInvalid) {\n\t\t\terror = invalidDate;\n\t\t\tdayInvalid = true;\n\t\t\tmonthInvalid = true;\n\t\t} else if (isDayInvalid && isYearInvalid) {\n\t\t\terror = invalidDate;\n\t\t\tdayInvalid = true;\n\t\t\tyearInvalid = true;\n\t\t} else if (isMonthInvalid && isYearInvalid) {\n\t\t\terror = invalidDate;\n\t\t\tmonthInvalid = true;\n\t\t\tyearInvalid = true;\n\t\t} else if (isYearInvalid) {\n\t\t\terror = invalidYear;\n\t\t\tyearInvalid = true;\n\t\t} else if (isMonthInvalid) {\n\t\t\terror = invalidMonth;\n\t\t\tmonthInvalid = true;\n\t\t} else if (isDayInvalid) {\n\t\t\terror = invalidDay;\n\t\t\tdayInvalid = true;\n\t\t}\n\t}\n\n\treturn { errorMessage: error, dayInvalid, monthInvalid, yearInvalid };\n};\n","import { DateInputFieldType } from '../ontario-date-input-interface';\n\nexport const getVisibleDateFields = (dateOptions: Array<DateInputFieldType>) => {\n\tconst dayVisible = dateOptions.includes('day');\n\tconst monthVisible = dateOptions.includes('month');\n\tconst yearVisible = dateOptions.includes('year');\n\n\treturn { dayVisible, monthVisible, yearVisible };\n};\n","@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/colours.variables' as colours;\n@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/spacing.variables' as spacing;\n@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/font-weights.variables' as fontWeights;\n@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/global.variables' as globalVariables;\n@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/4-elements/_global.elements.scss';\n@use '../../styles/form.scss';\n@forward '../../utils/components/error-message/error-message';\n\n.ontario-date__group {\n\tdisplay: flex;\n\n\tlabel {\n\t\tfont-weight: fontWeights.$ontario-font-weights-semi-bold;\n\t}\n\n\tinput {\n\t\tmargin-top: spacing.$spacing-4;\n\t}\n}\n\n.ontario-date__group-input {\n\tdisplay: flex;\n\tflex-direction: column;\n\tmargin-right: spacing.$spacing-5;\n}\n\n.ontario-date--error {\n\tinput {\n\t\tborder: 0.125rem solid colours.$ontario-colour-alert;\n\t}\n}\n","import { Component, EventEmitter, Element, Watch, Event, Prop, h, State, Listen, AttachInternals } from '@stencil/core';\nimport { v4 as uuid } from 'uuid';\nimport { Language } from '../../utils/common/language-types';\nimport { validateLanguage } from '../../utils/validation/validation-functions';\nimport { translations, Translations } from '../../translations';\nimport { Input } from './components';\nimport { getDateErrorMessage, getVisibleDateFields } from './utils';\nimport { DateInputFieldType, DateInputPlaceholder, DateValidatorReturnType } from './ontario-date-input-interface';\nimport { ErrorMessage } from '../../utils/components/error-message/error-message';\nimport { ConsoleMessageClass } from '../../utils/console-message/console-message';\nimport { ConsoleType } from '../../utils/console-message/console-message.enum';\nimport { InputCaption } from '../../utils/common/input-caption/input-caption';\nimport { Caption } from '../../utils/common/input-caption/caption.interface';\nimport { emitEvent } from '../../utils/events/event-handler';\n\n@Component({\n\ttag: 'ontario-date-input',\n\tstyleUrl: 'ontario-date-input.scss',\n\tshadow: true,\n\tformAssociated: true,\n})\nexport class OntarioDateInput {\n\t@Element() element: HTMLElement;\n\t@AttachInternals() internals: ElementInternals;\n\n\t/**\n\t * The language of the component.\n\t * This is used for translations, and is by default set through event listeners checking for a language property from the header. If none are passed, it will default to English.\n\t */\n\t@Prop({ mutable: true }) language?: Language;\n\n\t/**\n\t * A boolean value to determine whether or not the date input is required.\n\t *\n\t * This is optional. If no prop is passed, it will default to `false`.\n\t */\n\t@Prop() required?: boolean = false;\n\n\t/**\n\t * An object value used to set the placeholder text for the day, month and year input fields. Any combination of the three input fields (i.e day, month, year)\n\t * of the date component can be overridden.\n\t *\n\t * This is optional. If no prop is passed, it will not display any placeholder text.\n\t */\n\t@Prop() placeholder?: DateInputPlaceholder | string;\n\n\t/**\n\t * The text to display as the input label\n\t *\n\t * @example\n\t * <ontario-date-input\n\t * caption='{\n\t * \"captionText\": \"Exact Date\",\n\t * \"captionType\": \"heading\",\n\t * }\n\t * required=\"true\"\n\t * ...>\n\t * </ontario-date-input>\n\t */\n\t@Prop() caption: Caption | string;\n\n\t/**\n\t * The unique identifier of the input. This is optional - if no ID is passed, one will be generated.\n\t */\n\t@Prop({ mutable: true }) elementId?: string;\n\n\t/**\n\t * A number value indicating minimum value allowed for year input field of the date component.\n\t *\n\t * This is optional. If no prop is passed, it will default to `999`.\n\t */\n\t@Prop() minYear?: number;\n\n\t/**\n\t * A number value indicating maximum value allowed for year input field of the date component.\n\t *\n\t * This is optional. If no prop is passed, it will default to `9999`.\n\t */\n\t@Prop() maxYear?: number;\n\n\t/**\n\t * Used to include the ontario-hint-text component for the date input group.\n\t *\n\t * This is optional.\n\t */\n\t@Prop() hintText?: string;\n\n\t/**\n\t * An array value used to display date options. For example, only the day and month fields can be displayed by\n\t * specifying the dateOptions as `[\"day\", \"month\"]`, etc.\n\t *\n\t * This is optional. If no prop for `dateOptions` is passed, it will default to `[\"day\", \"month\", \"year\"]`.\n\t */\n\t@Prop() dateOptions?: string | Array<DateInputFieldType> = ['day', 'month', 'year'];\n\n\t/**\n\t * A function used to override internal date validation logic, which takes three arguments (i.e day, month and year) and returns\n\t * an object of type `DateValidatorReturnType`\n\t *\n\t * This is optional. If no prop for `dateValidator` is passed, it will default to internal validation function to validate\n\t * the date input.\n\t */\n\t@Prop() dateValidator?: (day: string, month: string, year: string) => DateValidatorReturnType;\n\n\t/**\n\t * Emitted when an `input` event occurs within the component.\n\t */\n\t@Event() inputOnInput: EventEmitter<{\n\t\tvalue: string;\n\t\tfieldType: 'day' | 'month' | 'year';\n\t}>;\n\n\t/**\n\t * Emitted when a `change` event occurs within the component.\n\t */\n\t@Event() inputOnChange: EventEmitter<{\n\t\tvalue: string;\n\t\tfieldType: 'day' | 'month' | 'year';\n\t}>;\n\n\t/**\n\t * Emitted when a keyboard input event occurs when an input has lost focus.\n\t */\n\t@Event() inputOnBlur: EventEmitter<'day' | 'month' | 'year'>;\n\n\t/**\n\t * Emitted when a keyboard input event occurs when an input has gained focus.\n\t */\n\t@Event() inputOnFocus: EventEmitter<'day' | 'month' | 'year'>;\n\n\t/**\n\t * Emitted when an error message is reported to the component.\n\t */\n\t@Event() inputErrorOccurred: EventEmitter<{ inputId: string; errorMessage: string }>;\n\n\t@Watch('errorMessage')\n\tbroadcastInputErrorOccurredEvent() {\n\t\t// Emit event to notify anyone who wants to listen for errors occurring\n\t\tthis.inputErrorOccurred.emit({ inputId: this.getId(), errorMessage: this.errorMessage ?? '' });\n\t}\n\n\t/**\n\t * This listens for the `setAppLanguage` event sent from the test language toggler when it is is connected to the DOM. It is used for the initial language when the input component loads.\n\t */\n\t@Listen('setAppLanguage', { target: 'window' })\n\thandleSetAppLanguage(event: CustomEvent<Language>) {\n\t\tif (!this.language) {\n\t\t\tthis.language = validateLanguage(event);\n\t\t}\n\t}\n\n\t@Listen('headerLanguageToggled', { target: 'window' })\n\thandleHeaderLanguageToggled(event: CustomEvent<Language>) {\n\t\tthis.language = validateLanguage(event);\n\t}\n\n\t@Listen('blur', { capture: true })\n\thandleComponentBlur() {\n\t\tconst { day, month, year, minYear, maxYear, dateValidator, dateOptionsState } = this;\n\t\tconst { dayVisible, monthVisible, yearVisible } = getVisibleDateFields(dateOptionsState);\n\n\t\t// if user has not interacted with the component, skip validation\n\t\tif (!this.isDateTyped) {\n\t\t\treturn;\n\t\t}\n\t\tconst errorMessages = translations.dateInput.error[this.getLanguage()];\n\t\tconst { dayInvalid, monthInvalid, yearInvalid, errorMessage } = dateValidator\n\t\t\t? dateValidator(day, month, year)\n\t\t\t: getDateErrorMessage({\n\t\t\t\t\tdayValue: day,\n\t\t\t\t\tmonthValue: month,\n\t\t\t\t\tyearValue: year,\n\t\t\t\t\terrorMessages,\n\t\t\t\t\tminYear,\n\t\t\t\t\tmaxYear,\n\t\t\t\t\tdayVisible,\n\t\t\t\t\tmonthVisible,\n\t\t\t\t\tyearVisible,\n\t\t\t });\n\n\t\tthis.dayInvalid = dayInvalid;\n\t\tthis.monthInvalid = monthInvalid;\n\t\tthis.yearInvalid = yearInvalid;\n\t\tthis.errorMessage = errorMessage;\n\t}\n\n\t@State() private translations: Translations = translations;\n\t@State() private captionState: InputCaption;\n\n\t@State() private isDateTyped: boolean = false;\n\t@State() private dayInvalid: boolean = false;\n\t@State() private monthInvalid: boolean = false;\n\t@State() private yearInvalid: boolean = false;\n\t@State() private errorMessage: string | undefined;\n\n\t@State() private day: string = '';\n\t@State() private month: string = '';\n\t@State() private year: string = '';\n\n\t@State() private placeholderState: DateInputPlaceholder;\n\t@State() private dateOptionsState: Array<DateInputFieldType>;\n\n\t/**\n\t * Watch for changes to the `caption` prop.\n\t *\n\t * The caption will be run through the InputCaption constructor to convert it to the correct format, and set the result to the `captionState` state.\n\t * @param newValue: Caption | string\n\t */\n\t@Watch('caption')\n\tprivate updateCaptionState(newValue: Caption | string) {\n\t\tthis.captionState = new InputCaption(\n\t\t\tthis.element.tagName,\n\t\t\tnewValue,\n\t\t\ttranslations,\n\t\t\tthis.language,\n\t\t\ttrue,\n\t\t\tthis.required,\n\t\t);\n\t}\n\n\t/**\n\t * Watch for changes in the `language` prop to render either the English or French translations\n\t */\n\t@Watch('language')\n\tupdateLanguage() {\n\t\tthis.updateCaptionState(this.caption);\n\t}\n\n\tprivate processPlaceholder() {\n\t\tthis.parseOptions(this.placeholder);\n\t}\n\n\tprivate processDateOptions() {\n\t\tthis.parseOptions(this.dateOptions);\n\t}\n\n\tprivate parseOptions(options: any) {\n\t\tconst isString = typeof options === 'string';\n\t\tif (!options) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tif (options === this.placeholder) {\n\t\t\t\tthis.placeholderState = isString ? JSON.parse(options) : options;\n\t\t\t} else if (options === this.dateOptions) {\n\t\t\t\tthis.dateOptionsState = isString ? JSON.parse(options) : options;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst message = new ConsoleMessageClass();\n\t\t\tmessage\n\t\t\t\t.addDesignSystemTag()\n\t\t\t\t.addRegularText(' failed to parse props for ')\n\t\t\t\t.addMonospaceText('<ontario-date-input>')\n\t\t\t\t.addRegularText(' in ')\n\t\t\t\t.addMonospaceText('parseOptions()')\n\t\t\t\t.addRegularText(' method \\n ')\n\t\t\t\t.addMonospaceText(error.stack)\n\t\t\t\t.printMessage(ConsoleType.Error);\n\t\t}\n\t}\n\n\tprivate isInvalidDate = () => {\n\t\treturn this.dayInvalid || this.monthInvalid || this.yearInvalid;\n\t};\n\n\tprivate resetErrorState = () => {\n\t\tif (!this.isInvalidDate()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.dayInvalid = false;\n\t\tthis.monthInvalid = false;\n\t\tthis.yearInvalid = false;\n\t\tthis.errorMessage = '';\n\t};\n\n\tprivate updateDateState = (value: string, inputFieldType: DateInputFieldType) => {\n\t\tswitch (inputFieldType) {\n\t\t\tcase 'day':\n\t\t\t\tthis.day = value;\n\t\t\t\tbreak;\n\t\t\tcase 'month':\n\t\t\t\tthis.month = value;\n\t\t\t\tbreak;\n\t\t\tcase 'year':\n\t\t\t\tthis.year = value;\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\tprivate handleDateUpdates = (value: string, fieldType: DateInputFieldType) => {\n\t\t// set boolean indicating user interaction with the component for validation\n\t\tif (!this.isDateTyped) {\n\t\t\tthis.isDateTyped = true;\n\t\t}\n\n\t\t// reset error state when user starts typing\n\t\tthis.resetErrorState();\n\n\t\t// update date state\n\t\tthis.updateDateState(value, fieldType);\n\n\t\t// TODO: verify are all the values numbers?\n\t\tif (this.year && this.month && this.day) {\n\t\t\tconst desiredDate = new Date(\n\t\t\t\tDate.UTC(parseInt(this.year), parseInt(this.month) - 1, parseInt(this.day), 0, 0, 0, 0),\n\t\t\t);\n\t\t\tthis.internals?.setFormValue?.(desiredDate.toISOString());\n\t\t}\n\t};\n\n\tprivate handleDateInput = (value: string, fieldType: DateInputFieldType) => {\n\t\tthis.handleDateUpdates(value, fieldType);\n\n\t\t// emit date change event\n\t\tthis.inputOnInput.emit({ value, fieldType });\n\t};\n\n\tprivate handleDateChanged = (value: string, fieldType: DateInputFieldType) => {\n\t\tthis.handleDateUpdates(value, fieldType);\n\n\t\t// emit date change event\n\t\tthis.inputOnChange.emit({ value, fieldType });\n\n\t\t// emit change event\n\t\temitEvent(this.element, 'change', { value, fieldType });\n\t};\n\n\tprivate handleDateFocus = (fieldType: DateInputFieldType) => {\n\t\t// emit date field focus event\n\t\tthis.inputOnFocus.emit(fieldType);\n\t};\n\n\tprivate handleDateBlur = (fieldType: DateInputFieldType) => {\n\t\t// emit date field focus event\n\t\tthis.inputOnBlur.emit(fieldType);\n\t};\n\n\tprivate getLanguage(): Language {\n\t\treturn this.language ?? 'en';\n\t}\n\n\tprivate getCaption(): Caption | string {\n\t\tconst language = this.getLanguage();\n\t\tconst captionText = translations.dateInput.caption[language];\n\n\t\treturn this.caption ?? { captionText, captionType: 'default' };\n\t}\n\n\tprivate getId(): string {\n\t\treturn this.elementId ?? '';\n\t}\n\n\tprivate getHintTextId(): string {\n\t\treturn `date-input-hint-${this.getId()}`;\n\t}\n\n\tprivate getInputIds() {\n\t\tconst id = this.getId();\n\n\t\tconst dayId = `day-${id}`;\n\t\tconst monthId = `month-${id}`;\n\t\tconst yearId = `year-${id}`;\n\n\t\treturn { dayId, monthId, yearId };\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.processPlaceholder();\n\t\tthis.processDateOptions();\n\n\t\tthis.updateCaptionState(this.getCaption());\n\t\tthis.elementId = this.elementId ?? uuid();\n\n\t\tthis.language = validateLanguage(this.language) as Language;\n\t}\n\n\trender() {\n\t\tconst { dateOptionsState, required, translations, hintText, placeholderState } = this;\n\t\tconst language = this.getLanguage();\n\t\tconst dateStrings = translations.dateInput;\n\t\tconst placeholderText = placeholderState ?? {};\n\t\tconst { dayVisible, monthVisible, yearVisible } = getVisibleDateFields(dateOptionsState);\n\t\tconst { dayId, monthId, yearId } = this.getInputIds();\n\t\tconst hintTextId = this.getHintTextId();\n\n\t\treturn (\n\t\t\t<div class=\"ontario-form-group\">\n\t\t\t\t<fieldset role=\"group\" class=\"ontario-fieldset\">\n\t\t\t\t\t{this.captionState.getCaption()}\n\t\t\t\t\t{!!hintText && (\n\t\t\t\t\t\t<p id={hintTextId} class=\"ontario-hint\">\n\t\t\t\t\t\t\t{hintText}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t)}\n\t\t\t\t\t<ErrorMessage message={this.errorMessage} error={this.isInvalidDate()} />\n\t\t\t\t\t<div class=\"ontario-date__group\">\n\t\t\t\t\t\t{yearVisible && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tid={yearId}\n\t\t\t\t\t\t\t\ttype=\"year\"\n\t\t\t\t\t\t\t\tlabel={dateStrings.year.label[language]}\n\t\t\t\t\t\t\t\taccessibilityLabel={dateStrings.year.accessibility[language]}\n\t\t\t\t\t\t\t\trequired={!!required}\n\t\t\t\t\t\t\t\terror={this.yearInvalid}\n\t\t\t\t\t\t\t\tplaceholder={placeholderText.year}\n\t\t\t\t\t\t\t\tonInput={this.handleDateInput}\n\t\t\t\t\t\t\t\tonChange={this.handleDateChanged}\n\t\t\t\t\t\t\t\tonBlur={this.handleDateBlur}\n\t\t\t\t\t\t\t\tonFocus={this.handleDateFocus}\n\t\t\t\t\t\t\t\tariaDescribedBy={hintTextId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{monthVisible && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tid={monthId}\n\t\t\t\t\t\t\t\ttype=\"month\"\n\t\t\t\t\t\t\t\tlabel={dateStrings.month.label[language]}\n\t\t\t\t\t\t\t\taccessibilityLabel={dateStrings.month.accessibility[language]}\n\t\t\t\t\t\t\t\trequired={!!required}\n\t\t\t\t\t\t\t\terror={this.monthInvalid}\n\t\t\t\t\t\t\t\tplaceholder={placeholderText.month}\n\t\t\t\t\t\t\t\tonInput={this.handleDateInput}\n\t\t\t\t\t\t\t\tonChange={this.handleDateChanged}\n\t\t\t\t\t\t\t\tonBlur={this.handleDateBlur}\n\t\t\t\t\t\t\t\tonFocus={this.handleDateFocus}\n\t\t\t\t\t\t\t\tariaDescribedBy={hintTextId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{dayVisible && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tid={dayId}\n\t\t\t\t\t\t\t\ttype=\"day\"\n\t\t\t\t\t\t\t\tlabel={dateStrings.day.label[language]}\n\t\t\t\t\t\t\t\taccessibilityLabel={dateStrings.day.accessibility[language]}\n\t\t\t\t\t\t\t\trequired={!!required}\n\t\t\t\t\t\t\t\terror={this.dayInvalid}\n\t\t\t\t\t\t\t\tplaceholder={placeholderText.day}\n\t\t\t\t\t\t\t\tonInput={this.handleDateInput}\n\t\t\t\t\t\t\t\tonChange={this.handleDateChanged}\n\t\t\t\t\t\t\t\tonBlur={this.handleDateBlur}\n\t\t\t\t\t\t\t\tonFocus={this.handleDateFocus}\n\t\t\t\t\t\t\t\tariaDescribedBy={hintTextId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</fieldset>\n\t\t\t</div>\n\t\t);\n\t}\n}\n"],"version":3}
|
|
@@ -134,8 +134,8 @@ const OntarioHeaderDefaultData = {
|
|
|
134
134
|
fr: fr,
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
const ONTARIO_HEADER_API_URL_EN = '
|
|
138
|
-
const ONTARIO_HEADER_API_URL_FR = '
|
|
137
|
+
const ONTARIO_HEADER_API_URL_EN = '';
|
|
138
|
+
const ONTARIO_HEADER_API_URL_FR = '';
|
|
139
139
|
const config = {
|
|
140
140
|
ONTARIO_HEADER_API_URL_EN: ONTARIO_HEADER_API_URL_EN,
|
|
141
141
|
ONTARIO_HEADER_API_URL_FR: ONTARIO_HEADER_API_URL_FR,
|