@ongov/ontario-design-system-component-library 4.3.0 → 5.0.0-alpha.1

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.
Files changed (148) hide show
  1. package/dist/cjs/index-88d5cf20.js +2 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/{ontario-accordion_43.cjs.entry.js → ontario-accordion_44.cjs.entry.js} +738 -296
  4. package/dist/cjs/ontario-accordion_44.cjs.entry.js.map +1 -0
  5. package/dist/cjs/ontario-design-system-components.cjs.js +1 -1
  6. package/dist/collection/collection-manifest.json +1 -0
  7. package/dist/collection/components/ontario-card/ontario-card-types.js +29 -2
  8. package/dist/collection/components/ontario-card/ontario-card-types.js.map +1 -1
  9. package/dist/collection/components/ontario-card/ontario-card.css +257 -31
  10. package/dist/collection/components/ontario-card/ontario-card.js +104 -80
  11. package/dist/collection/components/ontario-card/ontario-card.js.map +1 -1
  12. package/dist/collection/components/ontario-card/test/ontario-cards.spec.js +23 -13
  13. package/dist/collection/components/ontario-card/test/ontario-cards.spec.js.map +1 -1
  14. package/dist/collection/components/ontario-header/ontario-header.js +17 -3
  15. package/dist/collection/components/ontario-header/ontario-header.js.map +1 -1
  16. package/dist/collection/components/ontario-header/service-ontario-header.css +0 -3
  17. package/dist/collection/components/ontario-header/test/ontario-header.spec.js +3 -3
  18. package/dist/collection/components/ontario-header/test/ontario-header.spec.js.map +1 -1
  19. package/dist/collection/components/ontario-language-toggle/ontario-language-toggle.js +193 -47
  20. package/dist/collection/components/ontario-language-toggle/ontario-language-toggle.js.map +1 -1
  21. package/dist/collection/components/ontario-language-toggle/test/ontario-language-toggle.spec.js +16 -3
  22. package/dist/collection/components/ontario-language-toggle/test/ontario-language-toggle.spec.js.map +1 -1
  23. package/dist/collection/components/ontario-search-box/assets/ontario-icon-close.svg +1 -0
  24. package/dist/collection/components/ontario-search-box/assets/ontario-logo--mobile.svg +6 -0
  25. package/dist/collection/components/ontario-search-box/ontario-search-box.css +823 -0
  26. package/dist/collection/components/ontario-search-box/ontario-search-box.js +584 -0
  27. package/dist/collection/components/ontario-search-box/ontario-search-box.js.map +1 -0
  28. package/dist/collection/components/ontario-search-box/test/ontario-search-box.e2e.js +20 -0
  29. package/dist/collection/components/ontario-search-box/test/ontario-search-box.e2e.js.map +1 -0
  30. package/dist/collection/components/ontario-search-box/test/ontario-search-box.spec.js +19 -0
  31. package/dist/collection/components/ontario-search-box/test/ontario-search-box.spec.js.map +1 -0
  32. package/dist/collection/components/ontario-step-indicator/ontario-step-indicator.js +5 -5
  33. package/dist/collection/components/ontario-table/ontario-table.js +5 -5
  34. package/dist/collection/components/ontario-textarea/ontario-textarea.js +3 -3
  35. package/dist/collection/i18n/global.i18n.json +172 -162
  36. package/dist/collection/utils/common/input/input.js +3 -0
  37. package/dist/collection/utils/common/input/input.js.map +1 -1
  38. package/dist/collection/utils/common/input-caption/input-caption.js +5 -3
  39. package/dist/collection/utils/common/input-caption/input-caption.js.map +1 -1
  40. package/dist/collection/utils/common/language-types.js +1 -1
  41. package/dist/collection/utils/common/language-types.js.map +1 -1
  42. package/dist/collection/utils/helper/utils-types.js +2 -0
  43. package/dist/collection/utils/helper/utils-types.js.map +1 -0
  44. package/dist/collection/utils/helper/utils.js +26 -0
  45. package/dist/collection/utils/helper/utils.js.map +1 -1
  46. package/dist/components/error-message.js +1 -324
  47. package/dist/components/error-message.js.map +1 -1
  48. package/dist/components/event-handler.js +330 -0
  49. package/dist/components/event-handler.js.map +1 -0
  50. package/dist/components/global.i18n.js +184 -173
  51. package/dist/components/global.i18n.js.map +1 -1
  52. package/dist/components/input.js +3 -0
  53. package/dist/components/input.js.map +1 -1
  54. package/dist/components/ontario-card.js +118 -66
  55. package/dist/components/ontario-card.js.map +1 -1
  56. package/dist/components/ontario-checkboxes.js +2 -1
  57. package/dist/components/ontario-checkboxes.js.map +1 -1
  58. package/dist/components/ontario-date-input.js +2 -1
  59. package/dist/components/ontario-date-input.js.map +1 -1
  60. package/dist/components/ontario-dropdown-list.js +2 -1
  61. package/dist/components/ontario-dropdown-list.js.map +1 -1
  62. package/dist/components/ontario-header.js +13 -7
  63. package/dist/components/ontario-header.js.map +1 -1
  64. package/dist/components/ontario-icon-search2.js +6 -0
  65. package/dist/components/ontario-icon-search2.js.map +1 -0
  66. package/dist/components/ontario-input.js +2 -1
  67. package/dist/components/ontario-input.js.map +1 -1
  68. package/dist/components/ontario-language-toggle2.js +180 -37
  69. package/dist/components/ontario-language-toggle2.js.map +1 -1
  70. package/dist/components/ontario-radio-buttons.js +2 -1
  71. package/dist/components/ontario-radio-buttons.js.map +1 -1
  72. package/dist/components/ontario-search-box.d.ts +11 -0
  73. package/dist/components/ontario-search-box.js +269 -0
  74. package/dist/components/ontario-search-box.js.map +1 -0
  75. package/dist/components/ontario-step-indicator.js +5 -5
  76. package/dist/components/ontario-table.js +5 -5
  77. package/dist/components/ontario-textarea.js +5 -4
  78. package/dist/components/ontario-textarea.js.map +1 -1
  79. package/dist/components/utils.js +28 -0
  80. package/dist/components/utils.js.map +1 -1
  81. package/dist/esm/index-603026f7.js +2 -2
  82. package/dist/esm/loader.js +1 -1
  83. package/dist/esm/{ontario-accordion_43.entry.js → ontario-accordion_44.entry.js} +738 -296
  84. package/dist/esm/ontario-accordion_44.entry.js.map +1 -0
  85. package/dist/esm/ontario-design-system-components.js +1 -1
  86. package/dist/ontario-design-system-components/i18n/global.i18n.json +172 -162
  87. package/dist/ontario-design-system-components/ontario-design-system-components.esm.js +1 -1
  88. package/dist/ontario-design-system-components/ontario-design-system-components.esm.js.map +1 -1
  89. package/dist/ontario-design-system-components/{p-cff41424.entry.js → p-9c3a1be9.entry.js} +2204 -1918
  90. package/dist/ontario-design-system-components/p-9c3a1be9.entry.js.map +1 -0
  91. package/dist/types/components/ontario-card/ontario-card-types.d.ts +4 -4
  92. package/dist/types/components/ontario-card/ontario-card.d.ts +40 -29
  93. package/dist/types/components/ontario-header/ontario-header.d.ts +13 -2
  94. package/dist/types/components/ontario-language-toggle/ontario-language-toggle.d.ts +75 -8
  95. package/dist/types/components/ontario-search-box/ontario-search-box.d.ts +180 -0
  96. package/dist/types/components.d.ts +211 -22
  97. package/dist/types/utils/common/input/input.d.ts +2 -1
  98. package/dist/types/utils/common/input-caption/input-caption.d.ts +7 -1
  99. package/dist/types/utils/common/language-types.d.ts +2 -1
  100. package/dist/types/utils/helper/utils-types.d.ts +2 -0
  101. package/dist/types/utils/helper/utils.d.ts +21 -0
  102. package/package.json +3 -3
  103. package/src/components/ontario-card/ontario-card-types.tsx +33 -4
  104. package/src/components/ontario-card/ontario-card.scss +59 -38
  105. package/src/components/ontario-card/ontario-card.tsx +98 -70
  106. package/src/components/ontario-card/readme.md +57 -27
  107. package/src/components/ontario-card/test/__snapshots__/ontario-cards.spec.tsx.snap +66 -0
  108. package/src/components/ontario-card/test/ontario-cards.spec.tsx +27 -13
  109. package/src/components/ontario-card-collection/readme.md +13 -13
  110. package/src/components/ontario-checkbox/ontario-checkboxes.scss +0 -1
  111. package/src/components/ontario-header/ontario-header.tsx +13 -4
  112. package/src/components/ontario-header/service-ontario-header.scss +0 -4
  113. package/src/components/ontario-header/test/ontario-header.spec.tsx +3 -3
  114. package/src/components/ontario-hint-text/readme.md +2 -0
  115. package/src/components/ontario-language-toggle/ontario-language-toggle.tsx +192 -45
  116. package/src/components/ontario-language-toggle/readme.md +10 -10
  117. package/src/components/ontario-language-toggle/test/__snapshots__/ontario-language-toggle.spec.tsx.snap +1 -1
  118. package/src/components/ontario-language-toggle/test/ontario-language-toggle.spec.tsx +17 -3
  119. package/src/components/ontario-radio-buttons/ontario-radio-buttons.scss +0 -1
  120. package/src/components/ontario-search-box/assets/ontario-icon-close.svg +1 -0
  121. package/src/components/ontario-search-box/assets/ontario-logo--mobile.svg +6 -0
  122. package/src/components/ontario-search-box/ontario-search-box.scss +141 -0
  123. package/src/components/ontario-search-box/ontario-search-box.tsx +341 -0
  124. package/src/components/ontario-search-box/readme.md +132 -0
  125. package/src/components/ontario-search-box/test/__snapshots__/ontario-search-box.spec.tsx.snap +35 -0
  126. package/src/components/ontario-search-box/test/ontario-search-box.e2e.ts +21 -0
  127. package/src/components/ontario-search-box/test/ontario-search-box.spec.tsx +22 -0
  128. package/src/components.d.ts +211 -22
  129. package/src/french.html +37 -0
  130. package/src/index.html +292 -38
  131. package/src/translations/global.i18n.json +172 -162
  132. package/src/utils/common/input/input.tsx +4 -1
  133. package/src/utils/common/input-caption/input-caption.tsx +9 -3
  134. package/src/utils/common/language-types.ts +2 -1
  135. package/src/utils/helper/utils-types.ts +2 -0
  136. package/src/utils/helper/utils.ts +30 -0
  137. package/www/build/ontario-design-system-components.esm.js +1 -1
  138. package/www/build/ontario-design-system-components.esm.js.map +1 -1
  139. package/www/build/{p-b61db0f6.js → p-84035ac3.js} +1 -1
  140. package/www/build/{p-cff41424.entry.js → p-9c3a1be9.entry.js} +2204 -1918
  141. package/www/build/p-9c3a1be9.entry.js.map +1 -0
  142. package/www/french.html +37 -0
  143. package/www/i18n/global.i18n.json +172 -162
  144. package/www/index.html +266 -38
  145. package/dist/cjs/ontario-accordion_43.cjs.entry.js.map +0 -1
  146. package/dist/esm/ontario-accordion_43.entry.js.map +0 -1
  147. package/dist/ontario-design-system-components/p-cff41424.entry.js.map +0 -1
  148. package/www/build/p-cff41424.entry.js.map +0 -1
@@ -32,17 +32,17 @@ export class OntarioStepIndicator {
32
32
  render() {
33
33
  return h(
34
34
  'div',
35
- { key: '8d853372c036d2dc56e4075fa5ba6c9e8f8ed36f', class: 'ontario-step-indicator' },
35
+ { key: '83d9f9953680f3e84f11fcb85d6aca4a050932ca', class: 'ontario-step-indicator' },
36
36
  h(
37
37
  'div',
38
- { key: '1893a801bc9e624a1fb6cf55d4fbdb60368a0657', class: 'ontario-row' },
38
+ { key: '84b130dd8af2cc708cea2f45799d04161699d703', class: 'ontario-row' },
39
39
  h(
40
40
  'div',
41
- { key: 'a2ac5f0c1c48756d5110a6d605c263ac26b8229b', class: 'ontario-columns ontario-small-12' },
41
+ { key: '12457c0b09eede669f39f7d0c9b1ebbc5dbcc6e6', class: 'ontario-columns ontario-small-12' },
42
42
  h(
43
43
  'div',
44
44
  {
45
- key: '97ec6e22254d71cec885a1a0889eda3736739a52',
45
+ key: 'a422636fc6c8d666d4e60aacf883d7b45ccddfb6',
46
46
  class: `ontario-step-indicator--with-back-button--${this.showBackButton}`,
47
47
  },
48
48
  this.showBackButton === true &&
@@ -82,7 +82,7 @@ export class OntarioStepIndicator {
82
82
  this.numberOfSteps,
83
83
  ),
84
84
  ),
85
- h('hr', { key: '7d8d1cb75517980327bbf2095fd1149b6c41e3a2' }),
85
+ h('hr', { key: '23f2d86c4d1406d607fd7f5dbb5d54450a6cd5fa' }),
86
86
  ),
87
87
  ),
88
88
  );
@@ -150,26 +150,26 @@ export class OntarioTable {
150
150
  const columns = extractValuesByKey(this.tableColumnsState, 'key');
151
151
  return h(
152
152
  'div',
153
- { key: '0a6d7c55af2732b9799e9d08b93469c07fe670a6', class: 'ontario-table-container' },
153
+ { key: 'ce676d443d6f54e6eac8c7e035ac8c192b6be473', class: 'ontario-table-container' },
154
154
  h(
155
155
  'div',
156
156
  {
157
- key: '775159ebeabc19d6a44aa59a8ad6a28879c1ac2b',
157
+ key: '0baf35972c5c3c2382103bc765007be2e76cea15',
158
158
  class: 'ontario-table-scroll--wrapper',
159
159
  ref: (el) => (this.tableScrollWrapper = el),
160
160
  },
161
161
  h('div', {
162
- key: 'eb29663f922ddfc895201f84b1c42809f1180d69',
162
+ key: '348d83ea103a82da6c29fa94f87ee1ff45b8d485',
163
163
  class: 'ontario-table-scroll--div',
164
164
  ref: (el) => (this.tableScrollDiv = el),
165
165
  }),
166
166
  ),
167
167
  h(
168
168
  'div',
169
- { key: 'e9f98cb3babe7c15a99e0f478d7f1cd076090610', class: 'ontario-table-div', ref: (el) => (this.table = el) },
169
+ { key: 'd7c72699f19d0fe8144551e8754878b42d76cb71', class: 'ontario-table-div', ref: (el) => (this.table = el) },
170
170
  h(
171
171
  'table',
172
- { key: 'cefb954da377c35d836b63f075e9d197934fa6fe', class: this.getTableClasses() },
172
+ { key: '3c3f6bb5bbb75e0673509a1a377e224de64176f2', class: this.getTableClasses() },
173
173
  this.caption && h('caption', null, this.caption),
174
174
  this.tableColumnsState &&
175
175
  h(
@@ -170,7 +170,7 @@ export class OntarioTextarea {
170
170
  return h(
171
171
  'div',
172
172
  {
173
- key: 'c5fb67c54eba0560e63e6291e15fc7dad9bc863f',
173
+ key: '63372c743a7ac103d5bec0fdcb5f1f8623d588e3',
174
174
  class: `ontario-form-group ${error ? 'ontario-textarea--error' : ''}`,
175
175
  },
176
176
  this.captionState.getCaption(this.getId(), !!this.internalHintExpander),
@@ -180,9 +180,9 @@ export class OntarioTextarea {
180
180
  hintContentType: this.internalHintText.hintContentType,
181
181
  ref: (el) => (this.hintTextRef = el),
182
182
  }),
183
- h(ErrorMessage, { key: '30484b78a53895e736e4a6531de6d3e3caa20d87', message: this.errorMessage, error: error }),
183
+ h(ErrorMessage, { key: '90cece114c1b84a2996d25cb1a9a0548eab7d10a', message: this.errorMessage, error: error }),
184
184
  h('textarea', {
185
- 'key': '2e184ceba27a2d3b099545c81a346b611f3cf38f',
185
+ 'key': 'c6bc6014372f7f4839c9ce5070a484ac253c92e6',
186
186
  'aria-describedby': this.hintTextId,
187
187
  'class': this.getClass(),
188
188
  'id': this.getId(),
@@ -1,155 +1,55 @@
1
1
  {
2
- "required": {
3
- "en": "required",
4
- "fr": "obligatoire"
5
- },
6
- "optional": {
7
- "en": "optional",
8
- "fr": "facultative"
9
- },
10
2
  "accessibility": {
11
- "moreInfo": {
12
- "en": "More information on",
13
- "fr": "Des renseignements supplémentaires sur"
14
- },
15
3
  "checkboxHintExpander": {
16
4
  "en": "is available after the last checkbox item.",
17
5
  "fr": "suivront à la dernière case à cocher."
18
6
  },
7
+ "moreInfo": {
8
+ "en": "More information on",
9
+ "fr": "Des renseignements supplémentaires sur"
10
+ },
19
11
  "singleHintExpander": {
20
12
  "en": "field is available in the next element.",
21
13
  "fr": "suivront au prochain élément."
22
14
  }
23
15
  },
24
- "backToTop": {
25
- "top": {
26
- "en": "Top",
27
- "fr": "Haut"
28
- },
29
- "ariaLabel": {
30
- "en": "Scroll back to the top",
31
- "fr": "Retour en haut de la page"
32
- }
33
- },
34
- "loading": {
35
- "en": "Loading",
36
- "fr": "Chargement"
37
- },
38
- "dropdownList": {
39
- "select": {
40
- "en": "Select",
41
- "fr": "Sélectionner"
42
- }
43
- },
44
- "contactUs": {
45
- "en": "Contact us",
46
- "fr": "Contactez-nous"
47
- },
48
16
  "accessibilityLink": {
49
- "text": {
50
- "en": "Accessibility",
51
- "fr": "Accessibilité"
52
- },
53
17
  "link": {
54
18
  "en": "https://www.ontario.ca/page/accessibility",
55
19
  "fr": "https://www.ontario.ca/fr/page/accessibilite"
56
- }
57
- },
58
- "privacyLink": {
59
- "text": {
60
- "en": "Privacy",
61
- "fr": "Confidentialité"
62
20
  },
63
- "link": {
64
- "en": "https://www.ontario.ca/page/privacy-statement",
65
- "fr": "https://www.ontario.ca/fr/page/declaration-concernant-la-protection-de-la-vie-privee"
66
- }
67
- },
68
- "printerLink": {
69
21
  "text": {
70
- "en": "King's Printer for Ontario,",
71
- "fr": "Imprimeur du Roi pour l’Ontario,"
72
- },
73
- "link": {
74
- "en": "https://www.ontario.ca/page/copyright-information",
75
- "fr": "https://www.ontario.ca/fr/page/droits-dauteur"
76
- }
77
- },
78
- "languageToggle": {
79
- "ariaLabel": {
80
- "en": "Click to switch language to French",
81
- "fr": "Cliquez pour changer de langue en anglais"
22
+ "en": "Accessibility",
23
+ "fr": "Accessibilité"
82
24
  }
83
25
  },
84
- "stepIndicator": {
85
- "back": {
86
- "en": "Back",
87
- "fr": "Retour"
88
- },
89
- "step": {
90
- "en": "Step",
91
- "fr": "Étape"
26
+ "accordion": {
27
+ "collapse": {
28
+ "en": "Collapse all",
29
+ "fr": "Réduire tout"
92
30
  },
93
- "of": {
94
- "en": "of",
95
- "fr": "sur"
31
+ "expand": {
32
+ "en": "Expand all",
33
+ "fr": "Agrandir tout"
96
34
  },
97
- "complete": {
98
- "en": "complete",
99
- "fr": "complet"
35
+ "expandCollapseAriaLabel": {
36
+ "en": "Expand or collapse the accordion",
37
+ "fr": "Agrandissez ou réduisez l'accordéon"
100
38
  }
101
39
  },
102
- "header": {
103
- "ontarioSearchURL": {
104
- "en": "https://www.ontario.ca/search/search-results?query=",
105
- "fr": "https://www.ontario.ca/fr/recherche/resultats-de-recherche/?query="
106
- },
107
- "logoLink": {
108
- "en": "https://www.ontario.ca/page/government-ontario",
109
- "fr": "https://www.ontario.ca/fr/page/gouvernement-de-lontario"
110
- },
111
- "logoAltText": {
112
- "en": "Ontario.ca homepage",
113
- "fr": "Page d’accueil Ontario.ca"
114
- },
115
- "clearSearchField": {
116
- "en": "Clear field",
117
- "fr": "Vider le champ"
118
- },
119
- "submit": {
120
- "en": "Submit",
121
- "fr": "Soumission"
122
- },
123
- "search": {
124
- "en": "Search",
125
- "fr": "Rechercher"
126
- },
127
- "serviceOntario": {
128
- "en": "ServiceOntario",
129
- "fr": "ServiceOntario"
130
- },
131
- "openMenu": {
132
- "en": "Show navigation menu",
133
- "fr": "Ouvrir le menu de navigation"
134
- },
135
- "closeMenu": {
136
- "en": "Hide navigation menu",
137
- "fr": "Fermer le menu de navigation"
138
- },
139
- "close": {
140
- "en": "close",
141
- "fr": "fermer"
40
+ "backToTop": {
41
+ "ariaLabel": {
42
+ "en": "Scroll back to the top",
43
+ "fr": "Retour en haut de la page"
142
44
  },
143
- "closeSearch": {
144
- "en": "Close search bar",
145
- "fr": "Fermer la barre de recherche"
45
+ "top": {
46
+ "en": "Top",
47
+ "fr": "Haut"
146
48
  }
147
49
  },
148
- "input": {
149
- "requiredFieldError": {
150
- "en": "This is a required field.",
151
- "fr": "Ce champ est obligatoire."
152
- }
50
+ "contactUs": {
51
+ "en": "Contact us",
52
+ "fr": "Contactez-nous"
153
53
  },
154
54
  "dateInput": {
155
55
  "caption": {
@@ -157,43 +57,23 @@
157
57
  "fr": "Dates exactes"
158
58
  },
159
59
  "day": {
160
- "label": {
161
- "en": "Day",
162
- "fr": "Jour"
163
- },
164
60
  "accessibility": {
165
61
  "en": "4 digits",
166
62
  "fr": "4 chiffres"
167
- }
168
- },
169
- "month": {
170
- "label": {
171
- "en": "Month",
172
- "fr": "Mois"
173
63
  },
174
- "accessibility": {
175
- "en": "1 or 2 digits",
176
- "fr": "1 ou 2 chiffres"
177
- }
178
- },
179
- "year": {
180
64
  "label": {
181
- "en": "Year",
182
- "fr": "Année"
183
- },
184
- "accessibility": {
185
- "en": "1 or 2 digits",
186
- "fr": "1 ou 2 chiffres"
65
+ "en": "Day",
66
+ "fr": "Jour"
187
67
  }
188
68
  },
189
69
  "error": {
190
70
  "en": {
191
71
  "emptyDay": "Enter the day.",
192
- "emptyMonth": "Enter the month.",
193
- "emptyYear": "Enter the year.",
194
72
  "emptyDayAndMonth": "Enter the month and day.",
195
73
  "emptyDayAndYear": "Enter the year and day.",
74
+ "emptyMonth": "Enter the month.",
196
75
  "emptyMonthAndYear": "Enter the year and month.",
76
+ "emptyYear": "Enter the year.",
197
77
  "invalidDate": "Enter a valid date.",
198
78
  "invalidDay": "Enter a valid day.",
199
79
  "invalidMonth": "Enter a valid month.",
@@ -201,30 +81,160 @@
201
81
  },
202
82
  "fr": {
203
83
  "emptyDay": "Saisissez le jour.",
204
- "emptyMonth": "Saisissez le mois.",
205
- "emptyYear": "Saisissez l’année.",
206
84
  "emptyDayAndMonth": "Saisissez le mois et le jour.",
207
85
  "emptyDayAndYear": "Saisissez l’année et le jour.",
86
+ "emptyMonth": "Saisissez le mois.",
208
87
  "emptyMonthAndYear": "Saisissez l’année et le mois.",
88
+ "emptyYear": "Saisissez l’année.",
209
89
  "invalidDate": "Saisissez une date valide.",
210
90
  "invalidDay": "Saisissez un jour valide.",
211
91
  "invalidMonth": "Saisissez un mois valide.",
212
92
  "invalidYear": "Saisissez une année valide."
213
93
  }
94
+ },
95
+ "month": {
96
+ "accessibility": {
97
+ "en": "1 or 2 digits",
98
+ "fr": "1 ou 2 chiffres"
99
+ },
100
+ "label": {
101
+ "en": "Month",
102
+ "fr": "Mois"
103
+ }
104
+ },
105
+ "year": {
106
+ "accessibility": {
107
+ "en": "1 or 2 digits",
108
+ "fr": "1 ou 2 chiffres"
109
+ },
110
+ "label": {
111
+ "en": "Year",
112
+ "fr": "Année"
113
+ }
214
114
  }
215
115
  },
216
- "accordion": {
217
- "expand": {
218
- "en": "Expand all",
219
- "fr": "Agrandir tout"
116
+ "dropdownList": {
117
+ "select": {
118
+ "en": "Select",
119
+ "fr": "Sélectionner"
120
+ }
121
+ },
122
+ "header": {
123
+ "clearSearchField": {
124
+ "en": "Clear field",
125
+ "fr": "Vider le champ"
220
126
  },
221
- "collapse": {
222
- "en": "Collapse all",
223
- "fr": "Réduire tout"
127
+ "close": {
128
+ "en": "close",
129
+ "fr": "fermer"
224
130
  },
225
- "expandCollapseAriaLabel": {
226
- "en": "Expand or collapse the accordion",
227
- "fr": "Agrandissez ou réduisez l'accordéon"
131
+ "closeMenu": {
132
+ "en": "Hide navigation menu",
133
+ "fr": "Fermer le menu de navigation"
134
+ },
135
+ "closeSearch": {
136
+ "en": "Close search bar",
137
+ "fr": "Fermer la barre de recherche"
138
+ },
139
+ "logoAltText": {
140
+ "en": "Ontario.ca homepage",
141
+ "fr": "Page d’accueil Ontario.ca"
142
+ },
143
+ "logoLink": {
144
+ "en": "https://www.ontario.ca/page/government-ontario",
145
+ "fr": "https://www.ontario.ca/fr/page/gouvernement-de-lontario"
146
+ },
147
+ "ontarioSearchURL": {
148
+ "en": "https://www.ontario.ca/search/search-results?query=",
149
+ "fr": "https://www.ontario.ca/fr/recherche/resultats-de-recherche/?query="
150
+ },
151
+ "openMenu": {
152
+ "en": "Show navigation menu",
153
+ "fr": "Ouvrir le menu de navigation"
154
+ },
155
+ "search": {
156
+ "en": "Search",
157
+ "fr": "Rechercher"
158
+ },
159
+ "serviceOntario": {
160
+ "en": "ServiceOntario",
161
+ "fr": "ServiceOntario"
162
+ },
163
+ "submit": {
164
+ "en": "Submit",
165
+ "fr": "Soumission"
166
+ }
167
+ },
168
+ "input": {
169
+ "requiredFieldError": {
170
+ "en": "This is a required field.",
171
+ "fr": "Ce champ est obligatoire."
172
+ }
173
+ },
174
+ "languageToggle": {
175
+ "ariaLabel": {
176
+ "en": "Click to switch the language to English",
177
+ "fr": "Cliquez pour changer la langue en français"
178
+ }
179
+ },
180
+ "loading": {
181
+ "en": "Loading",
182
+ "fr": "Chargement"
183
+ },
184
+ "optional": {
185
+ "en": "optional",
186
+ "fr": "facultative"
187
+ },
188
+ "printerLink": {
189
+ "link": {
190
+ "en": "https://www.ontario.ca/page/copyright-information",
191
+ "fr": "https://www.ontario.ca/fr/page/droits-dauteur"
192
+ },
193
+ "text": {
194
+ "en": "King's Printer for Ontario,",
195
+ "fr": "Imprimeur du Roi pour l’Ontario,"
196
+ }
197
+ },
198
+ "privacyLink": {
199
+ "link": {
200
+ "en": "https://www.ontario.ca/page/privacy-statement",
201
+ "fr": "https://www.ontario.ca/fr/page/declaration-concernant-la-protection-de-la-vie-privee"
202
+ },
203
+ "text": {
204
+ "en": "Privacy",
205
+ "fr": "Confidentialité"
206
+ }
207
+ },
208
+ "stepIndicator": {
209
+ "back": {
210
+ "en": "Back",
211
+ "fr": "Retour"
212
+ },
213
+ "complete": {
214
+ "en": "complete",
215
+ "fr": "complet"
216
+ },
217
+ "of": {
218
+ "en": "of",
219
+ "fr": "sur"
220
+ },
221
+ "step": {
222
+ "en": "Step",
223
+ "fr": "Étape"
224
+ }
225
+ },
226
+ "siteLanguage": {
227
+ "fullWord": {
228
+ "en": "English",
229
+ "fr": "Français"
230
+ },
231
+ "abbreviation": {
232
+ "en": "en",
233
+ "fr": "fr"
228
234
  }
235
+ },
236
+ "required": {
237
+ "en": "required",
238
+ "fr": "obligatoire"
229
239
  }
230
240
  }
@@ -26,6 +26,7 @@ export const Input = (_a) => {
26
26
  onChange,
27
27
  onBlur,
28
28
  onFocus,
29
+ onClick,
29
30
  ariaInvalid,
30
31
  ariaDescribedBy,
31
32
  ref,
@@ -46,6 +47,7 @@ export const Input = (_a) => {
46
47
  'onChange',
47
48
  'onBlur',
48
49
  'onFocus',
50
+ 'onClick',
49
51
  'ariaInvalid',
50
52
  'ariaDescribedBy',
51
53
  'ref',
@@ -69,6 +71,7 @@ export const Input = (_a) => {
69
71
  'onChange': onChange,
70
72
  'onBlur': onBlur,
71
73
  'onFocus': onFocus,
74
+ 'onClick': onClick,
72
75
  'inputMode': inputMode,
73
76
  'ref': ref,
74
77
  'aria-invalid': ariaInvalid,
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../src/utils/common/input/input.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AAuBvD,MAAM,CAAC,MAAM,KAAK,GAAoC,CAAC,EAoBtD,EAAE,EAAE;QApBkD,EACtD,YAAY,EACZ,SAAS,EACT,EAAE,EACF,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,WAAW,EACX,eAAe,EACf,GAAG,EACH,SAAS,OAET,EADG,KAAK,cAnB8C,iNAoBtD,CADQ;IAER,OAAO,CACN,2BACC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,kBACM,WAAW,sBACP,eAAe,IAC7B,KAAK,EACR,CACF,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { FunctionalComponent, h } from '@stencil/core';\n\nexport type InputProps = {\n\tautoComplete?: string;\n\tclassName?: string;\n\tid: string;\n\tname?: string;\n\ttype: string;\n\tvalue?: string | number;\n\tchecked?: boolean;\n\trequired?: boolean;\n\tinputMode?: string;\n\tplaceholder?: string;\n\tariaInvalid?: boolean;\n\tariaDescribedBy?: string;\n\tonKeyDown?: ((event: Event) => void) | undefined;\n\tonInput?: ((event: Event) => void) | undefined;\n\tonChange?: ((event: Event) => void) | undefined;\n\tonBlur?: ((event: Event) => void) | undefined;\n\tonFocus?: ((event: Event) => void) | undefined;\n\tref?: (el: any) => HTMLElement;\n};\n\nexport const Input: FunctionalComponent<InputProps> = ({\n\tautoComplete,\n\tclassName,\n\tid,\n\tname,\n\tplaceholder,\n\ttype,\n\tvalue,\n\tchecked,\n\trequired,\n\tonKeyDown,\n\tonInput,\n\tonChange,\n\tonBlur,\n\tonFocus,\n\tariaInvalid,\n\tariaDescribedBy,\n\tref,\n\tinputMode,\n\t...props\n}) => {\n\treturn (\n\t\t<input\n\t\t\tautoComplete={autoComplete}\n\t\t\tclass={className}\n\t\t\tid={id}\n\t\t\tname={name}\n\t\t\ttype={type}\n\t\t\tvalue={value}\n\t\t\tchecked={checked}\n\t\t\tplaceholder={placeholder}\n\t\t\trequired={!!required}\n\t\t\tonKeyDown={onKeyDown}\n\t\t\tonInput={onInput}\n\t\t\tonChange={onChange}\n\t\t\tonBlur={onBlur}\n\t\t\tonFocus={onFocus}\n\t\t\tinputMode={inputMode}\n\t\t\tref={ref}\n\t\t\taria-invalid={ariaInvalid}\n\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\n"]}
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../src/utils/common/input/input.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AAwBvD,MAAM,CAAC,MAAM,KAAK,GAAoC,CAAC,EAqBtD,EAAE,EAAE;QArBkD,EACtD,YAAY,EACZ,SAAS,EACT,EAAE,EACF,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,EACP,WAAW,EACX,eAAe,EACf,GAAG,EACH,SAAS,OAET,EADG,KAAK,cApB8C,4NAqBtD,CADQ;IAER,OAAO,CACN,2BACC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,kBACM,WAAW,sBACP,eAAe,IAC7B,KAAK,EACR,CACF,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { FunctionalComponent, h } from '@stencil/core';\n\nexport type InputProps = {\n\tautoComplete?: string;\n\tclassName?: string;\n\tid: string;\n\tname?: string;\n\ttype: string;\n\tvalue?: string | number;\n\tchecked?: boolean;\n\trequired?: boolean;\n\tinputMode?: string;\n\tplaceholder?: string;\n\tariaInvalid?: boolean;\n\tariaDescribedBy?: string;\n\tonKeyDown?: ((event: Event) => void) | undefined;\n\tonInput?: ((event: Event) => void) | undefined;\n\tonChange?: ((event: Event) => void) | undefined;\n\tonBlur?: ((event: Event) => void) | undefined;\n\tonFocus?: ((event: Event) => void) | undefined;\n\tonClick?: ((event: Event) => void) | undefined;\n\tref?: (el: HTMLInputElement) => HTMLElement;\n};\n\nexport const Input: FunctionalComponent<InputProps> = ({\n\tautoComplete,\n\tclassName,\n\tid,\n\tname,\n\tplaceholder,\n\ttype,\n\tvalue,\n\tchecked,\n\trequired,\n\tonKeyDown,\n\tonInput,\n\tonChange,\n\tonBlur,\n\tonFocus,\n\tonClick,\n\tariaInvalid,\n\tariaDescribedBy,\n\tref,\n\tinputMode,\n\t...props\n}) => {\n\treturn (\n\t\t<input\n\t\t\tautoComplete={autoComplete}\n\t\t\tclass={className}\n\t\t\tid={id}\n\t\t\tname={name}\n\t\t\ttype={type}\n\t\t\tvalue={value}\n\t\t\tchecked={checked}\n\t\t\tplaceholder={placeholder}\n\t\t\trequired={!!required}\n\t\t\tonKeyDown={onKeyDown}\n\t\t\tonInput={onInput}\n\t\t\tonChange={onChange}\n\t\t\tonBlur={onBlur}\n\t\t\tonFocus={onFocus}\n\t\t\tonClick={onClick}\n\t\t\tinputMode={inputMode}\n\t\t\tref={ref}\n\t\t\taria-invalid={ariaInvalid}\n\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\n"]}
@@ -25,23 +25,25 @@ export class InputCaption {
25
25
  /**
26
26
  * Return the `<label>` element for text inputs
27
27
  * @param captionFor Set the `htmlFor` attribute
28
+ * @param hasHintExpander Indicate whether the component the label is for has a hint expander or not
29
+ * @param disableRequiredFlag Disable the required/optional label text _(only use in highly special cases)_
28
30
  * @returns element containing the caption for the input
29
31
  */
30
- this.getCaption = (captionFor, hasHintExpander = false) => {
32
+ this.getCaption = (captionFor, hasHintExpander = false, disableRequiredFlag = false) => {
31
33
  const captionText = this.captionText && this.captionText.toLowerCase();
32
34
  const captionContent = this.isLegend
33
35
  ? h(
34
36
  'legend',
35
37
  { class: this.getClass() },
36
38
  this.captionType === 'heading' ? h('h1', null, this.captionText) : this.captionText,
37
- this.getRequiredFlagElement(),
39
+ !disableRequiredFlag && this.getRequiredFlagElement(),
38
40
  hasHintExpander && this.getHintExpanderAccessibilityText(captionText, false),
39
41
  )
40
42
  : h(
41
43
  'label',
42
44
  { htmlFor: captionFor, class: this.getClass() },
43
45
  this.captionText,
44
- this.getRequiredFlagElement(),
46
+ !disableRequiredFlag && this.getRequiredFlagElement(),
45
47
  hasHintExpander && this.getHintExpanderAccessibilityText(captionText, false),
46
48
  );
47
49
  // with `this.captionType` already set to one of the enum values, the comparison no longer needs the `toLowerCase()` transform
@@ -1 +1 @@
1
- {"version":3,"file":"input-caption.js","sourceRoot":"","sources":["../../../../src/utils/common/input-caption/input-caption.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAe,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,MAAM,OAAO,YAAY;IA+BxB;;;;OAIG;IACH,YACC,gBAAwB,EACxB,OAAyB,EACzB,YAAiB,EACjB,QAAa,EACb,WAAoB,KAAK,EACzB,WAAoB,KAAK;QApC1B;;WAEG;QACH,gBAAW,GAAiB,SAAS,CAAC;QAEtC;;WAEG;QACH,aAAQ,GAAa,KAAK,CAAC;QAE3B;;WAEG;QACH,aAAQ,GAAa,KAAK,CAAC;QAQ3B,aAAQ,GAAQ,IAAI,CAAC;QA0CrB;;;;WAIG;QACH,eAAU,GAAG,CAAC,UAA+B,EAAE,kBAA2B,KAAK,EAAe,EAAE;YAC/F,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;YACvE,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,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QAEvC,QAAQ,WAAW,EAAE,CAAC;YACrB,mJAAmJ;YACnJ,yKAAyK;YACzK,0KAA0K;YAC1K,KAAK,kBAAkB,CAAC,sBAAsB,CAAC;YAC/C,KAAK,kBAAkB,CAAC,oBAAoB,CAAC;YAC7C,KAAK,kBAAkB,CAAC,gBAAgB;gBACvC,OAAO;qBACL,cAAc,CACd,GACC,WAAW,KAAK,kBAAkB,CAAC,gBAAgB;oBAClD,CAAC,CAAC,kCAAkC;oBACpC,CAAC,CAAC,6BACJ,yBAAyB,CACzB;qBACA,gBAAgB,CAAC,IAAI,gBAAgB,GAAG,CAAC;qBACzC,cAAc,CAAC,kBAAkB,CAAC,CAAC;gBACrC,MAAM;YAEP,uIAAuI;YACvI,KAAK,kBAAkB,CAAC,oBAAoB;gBAC3C,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;gBAC/G,MAAM;YAEP,qMAAqM;YACrM,KAAK,kBAAkB,CAAC,oBAAoB;gBAC3C,OAAO;qBACL,cAAc,CAAC,oCAAoC,CAAC;qBACpD,gBAAgB,CAAC,qBAAqB,CAAC;qBACvC,cAAc,CAAC,IAAI,CAAC;qBACpB,gBAAgB,CAAC,SAAS,CAAC;qBAC3B,cAAc,CAAC,sBAAsB,CAAC;qBACtC,gBAAgB,CAAC,WAAW,CAAC;qBAC7B,cAAc,CAAC,kBAAkB,CAAC,CAAC;gBACrC,MAAM;QACR,CAAC;QAED,OAAO,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;CACD","sourcesContent":["import { h } from '@stencil/core';\nimport { CaptionType, CaptionTypes } from './input-caption.types';\nimport { MessageContentType } from './input-caption.enum';\nimport { CaptionInfo, Caption } from './caption.interface';\nimport { ConsoleMessageClass } from '../../console-message/console-message';\n\nexport class InputCaption implements CaptionInfo {\n\t/**\n\t * The text to display as caption.\n\t */\n\tcaptionText: string;\n\n\t/**\n\t * The type of caption to render.\n\t */\n\tcaptionType?: CaptionType = 'default';\n\n\t/**\n\t * Determine whether the input field is required.\n\t */\n\trequired?: boolean = false;\n\n\t/**\n\t * Determine whether the rendered element is a `<label>` or `<legend>`.\n\t */\n\tisLegend?: boolean = false;\n\n\t/**\n\t * Name of the component instantiating the class.\n\t * This is used for validation warning message.\n\t */\n\tcomponentTagName: string;\n\n\tlanguage: any = 'en';\n\n\ttranslations: any;\n\n\t/**\n\t * Set the class members\n\t * Output a console warning message if the provided `label` type is incorrect\n\t * @param caption object containing the essential data to configure the input label\n\t */\n\tconstructor(\n\t\tcomponentTagName: string,\n\t\tcaption: Caption | string,\n\t\ttranslations: any,\n\t\tlanguage: any,\n\t\tisLegend: boolean = false,\n\t\trequired: boolean = false,\n\t) {\n\t\tlet captionObject: Caption;\n\n\t\tif (typeof caption === 'string') {\n\t\t\ttry {\n\t\t\t\tcaptionObject = JSON.parse(caption) as Caption;\n\t\t\t} catch {\n\t\t\t\tcaptionObject = { captionText: caption, captionType: 'default' };\n\t\t\t}\n\t\t} else {\n\t\t\tcaptionObject = caption;\n\t\t}\n\n\t\tthis.componentTagName = componentTagName.toLocaleLowerCase();\n\t\tthis.captionText = captionObject?.captionText;\n\t\tthis.captionType =\n\t\t\t(captionObject?.captionType && CaptionTypes.find((type) => type === captionObject.captionType?.toLowerCase())) ||\n\t\t\t'default';\n\t\tthis.required = required;\n\t\tthis.isLegend = isLegend;\n\t\tthis.translations = translations;\n\t\tthis.language = language;\n\n\t\tthis.validateCaption(this);\n\t}\n\n\t/**\n\t * Return the `<label>` element for text inputs\n\t * @param captionFor Set the `htmlFor` attribute\n\t * @returns element containing the caption for the input\n\t */\n\tgetCaption = (captionFor?: string | undefined, hasHintExpander: boolean = false): HTMLElement => {\n\t\tconst captionText = this.captionText && this.captionText.toLowerCase();\n\t\tconst captionContent = this.isLegend ? (\n\t\t\t<legend class={this.getClass()}>\n\t\t\t\t{this.captionType === 'heading' ? <h1>{this.captionText}</h1> : this.captionText}\n\t\t\t\t{this.getRequiredFlagElement()}\n\t\t\t\t{hasHintExpander && this.getHintExpanderAccessibilityText(captionText, false)}\n\t\t\t</legend>\n\t\t) : (\n\t\t\t<label htmlFor={captionFor} class={this.getClass()}>\n\t\t\t\t{this.captionText}\n\t\t\t\t{this.getRequiredFlagElement()}\n\t\t\t\t{hasHintExpander && this.getHintExpanderAccessibilityText(captionText, false)}\n\t\t\t</label>\n\t\t);\n\n\t\t// with `this.captionType` already set to one of the enum values, the comparison no longer needs the `toLowerCase()` transform\n\t\treturn this.captionType === 'heading' && !this.isLegend ? <h1>{captionContent}</h1> : captionContent;\n\t};\n\n\tgetHintExpanderAccessibilityText(captionText: string, hasHintExpanderOnOption: boolean = false): HTMLElement {\n\t\tconst multipleOptionsMessage = (\n\t\t\t<span class=\"ontario-show-for-sr\">\n\t\t\t\t{this.translations.accessibility.moreInfo[this.language]} \"{captionText.toLowerCase()}\"{' '}\n\t\t\t\t{this.translations.accessibility.checkboxHintExpander[this.language]}\n\t\t\t</span>\n\t\t);\n\n\t\tconst singleOptionMessage = (\n\t\t\t<span class=\"ontario-show-for-sr\">\n\t\t\t\t{this.translations.accessibility.moreInfo[this.language]} \"{captionText.toLowerCase()}\"{' '}\n\t\t\t\t{this.translations.accessibility.singleHintExpander[this.language]}\n\t\t\t</span>\n\t\t);\n\t\treturn this.componentTagName === 'ontario-checkboxes'\n\t\t\t? !hasHintExpanderOnOption\n\t\t\t\t? multipleOptionsMessage\n\t\t\t\t: singleOptionMessage\n\t\t\t: singleOptionMessage;\n\t}\n\n\t/**\n\t * Determines which flag text to use between `required` and `optional`\n\t * @returns `required` or `optional` flag text\n\t */\n\tprivate getRequiredFlagText(): string {\n\t\treturn this.required\n\t\t\t? this.translations && `(${this.translations.required[this.language]})`\n\t\t\t: this.translations && `(${this.translations.optional[this.language]})`;\n\t}\n\n\t/**\n\t * Get the HTML for the required/optional flag.\n\t * @returns CSS class for the label/legend.\n\t */\n\tprivate getRequiredFlagElement(): HTMLElement {\n\t\treturn <span class=\"ontario-label__flag\">{this.getRequiredFlagText()}</span>;\n\t}\n\n\t/**\n\t * Get the CSS class for the `label` element.\n\t * @returns CSS class for the `label` element.\n\t */\n\tprivate getClass(): string {\n\t\treturn this.captionType === 'large' || this.captionType === 'heading'\n\t\t\t? this.isLegend\n\t\t\t\t? `ontario-fieldset__legend ontario-fieldset__legend--${this.captionType}`\n\t\t\t\t: `ontario-label ontario-label--${this.captionType}`\n\t\t\t: this.isLegend\n\t\t\t? 'ontario-fieldset__legend'\n\t\t\t: 'ontario-label';\n\t}\n\n\t/**\n\t * Validate caption input by user and output warning message to the console if:\n\t * 1. the `caption` object is not provided\n\t * 2. the `captionText` property of the `caption` object is not provided\n\t * 3. the `captionText` property of the `caption` object is empty or contain only spaces\n\t * 4. the `captionType` property of the `caption` object is not provided\n\t * 5. the `captionType` property of the `caption` object is incorrect\n\t */\n\tprivate validateCaption(caption?: InputCaption) {\n\t\tlet messageType;\n\n\t\t// undefined `caption` object\n\t\tif (!caption || Object.keys(caption).length <= 0) {\n\t\t\tmessageType = MessageContentType.UndefinedCaptionObject;\n\t\t} else {\n\t\t\t// undefined `captionText` property\n\t\t\tif (!caption.captionText) {\n\t\t\t\tmessageType = MessageContentType.UndefinedCaptionText;\n\t\t\t} else {\n\t\t\t\t// `captionText` that is empty or contains only spaces\n\t\t\t\tif (/^\\s*$/.test(caption.captionText)) {\n\t\t\t\t\tmessageType = MessageContentType.EmptyCaptionText;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// undefined `captionType`\n\t\t\tif (!caption.captionType) {\n\t\t\t\tmessageType = MessageContentType.UndefinedCaptionType;\n\t\t\t} else {\n\t\t\t\t// incorrect `captionType`\n\t\t\t\tif (!CaptionTypes.includes(caption?.captionType?.toLowerCase() as CaptionType)) {\n\t\t\t\t\tmessageType = MessageContentType.IncorrectCaptionType;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (messageType) {\n\t\t\tconst message = new ConsoleMessageClass().addDesignSystemTag();\n\n\t\t\tif (messageType !== MessageContentType.UndefinedCaptionObject) {\n\t\t\t\tmessage\n\t\t\t\t\t.addMonospaceText(\n\t\t\t\t\t\t` ${\n\t\t\t\t\t\t\tmessageType === MessageContentType.EmptyCaptionText ||\n\t\t\t\t\t\t\tmessageType === MessageContentType.UndefinedCaptionText\n\t\t\t\t\t\t\t\t? 'caption or captionText'\n\t\t\t\t\t\t\t\t: 'captionType'\n\t\t\t\t\t\t} `,\n\t\t\t\t\t)\n\t\t\t\t\t.addRegularText('object or property of');\n\t\t\t}\n\n\t\t\tmessage.addMonospaceText(' caption ').addRegularText('object on').addMonospaceText(` ${this.componentTagName} `);\n\t\t\tthis.printConsoleMessage(messageType, message, this.getRequiredFlagText());\n\t\t}\n\t}\n\n\t/**\n\t * Generate the content of warning message to be printed to the console\n\t * @param messageType determine the content of warning message to output\n\t * @param componentTagName the tag name of the component that's emitting the warning message\n\t * @param requiredFlagText accepts a string value to be used as the required flag text and defaults to `(optional)` if not set\n\t * @returns an array of `ConsoleMessage` objects containing the message and associated styles to be printed to the console\n\t */\n\tprivate printConsoleMessage(\n\t\tmessageType: MessageContentType,\n\t\tmessage: ConsoleMessageClass,\n\t\trequiredFlagText: string = '(optional)',\n\t) {\n\t\tswitch (messageType) {\n\t\t\t// undefinedCaptionObject example: caption object on <ontario-input> is required but not defined. A blank followed by a (optional) flag is assumed.\n\t\t\t// undefinedCaptionText example: captionText property of caption object on <ontario-input> is required but not defined. A blank followed by a (optional) flag is assumed.\n\t\t\t// EmptyCaptionText example: captionText property of caption object on <ontario-input> is empty or contains only spaces. A blank followed by a (optional) flag is assumed.\n\t\t\tcase MessageContentType.UndefinedCaptionObject:\n\t\t\tcase MessageContentType.UndefinedCaptionText:\n\t\t\tcase MessageContentType.EmptyCaptionText:\n\t\t\t\tmessage\n\t\t\t\t\t.addRegularText(\n\t\t\t\t\t\t`${\n\t\t\t\t\t\t\tmessageType === MessageContentType.EmptyCaptionText\n\t\t\t\t\t\t\t\t? 'is empty or contains only spaces'\n\t\t\t\t\t\t\t\t: 'is required but not defined'\n\t\t\t\t\t\t}. A blank followed by a`,\n\t\t\t\t\t)\n\t\t\t\t\t.addMonospaceText(` ${requiredFlagText} `)\n\t\t\t\t\t.addRegularText('flag is assumed.');\n\t\t\t\tbreak;\n\n\t\t\t// UndefinedCaptionType example: captionType property of caption object on <ontario-input> is not defined. The default type is assumed.\n\t\t\tcase MessageContentType.UndefinedCaptionType:\n\t\t\t\tmessage.addRegularText('is not defined. The').addMonospaceText(' default ').addRegularText('type is assumed.');\n\t\t\t\tbreak;\n\n\t\t\t// IncorrectCaptionType example: captionType property of caption object on <ontario-input> was set to an incorrect type; only default, heading or large type is allowed. The default type is assumed.\n\t\t\tcase MessageContentType.IncorrectCaptionType:\n\t\t\t\tmessage\n\t\t\t\t\t.addRegularText('was set to an incorrect type; only')\n\t\t\t\t\t.addMonospaceText(' default, heading, ')\n\t\t\t\t\t.addRegularText('or')\n\t\t\t\t\t.addMonospaceText(' large ')\n\t\t\t\t\t.addRegularText('type is allowed. The')\n\t\t\t\t\t.addMonospaceText(' default ')\n\t\t\t\t\t.addRegularText('type is assumed.');\n\t\t\t\tbreak;\n\t\t}\n\n\t\tmessage.printMessage();\n\t}\n}\n"]}
1
+ {"version":3,"file":"input-caption.js","sourceRoot":"","sources":["../../../../src/utils/common/input-caption/input-caption.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAe,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,MAAM,OAAO,YAAY;IA+BxB;;;;OAIG;IACH,YACC,gBAAwB,EACxB,OAAyB,EACzB,YAAiB,EACjB,QAAa,EACb,WAAoB,KAAK,EACzB,WAAoB,KAAK;QApC1B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I,CAAC;qBACpB,gBAAgB,CAAC,SAAS,CAAC;qBAC3B,cAAc,CAAC,sBAAsB,CAAC;qBACtC,gBAAgB,CAAC,WAAW,CAAC;qBAC7B,cAAc,CAAC,kBAAkB,CAAC,CAAC;gBACrC,MAAM;QACR,CAAC;QAED,OAAO,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;CACD","sourcesContent":["import { h } from '@stencil/core';\nimport { CaptionType, CaptionTypes } from './input-caption.types';\nimport { MessageContentType } from './input-caption.enum';\nimport { CaptionInfo, Caption } from './caption.interface';\nimport { ConsoleMessageClass } from '../../console-message/console-message';\n\nexport class InputCaption implements CaptionInfo {\n\t/**\n\t * The text to display as caption.\n\t */\n\tcaptionText: string;\n\n\t/**\n\t * The type of caption to render.\n\t */\n\tcaptionType?: CaptionType = 'default';\n\n\t/**\n\t * Determine whether the input field is required.\n\t */\n\trequired?: boolean = false;\n\n\t/**\n\t * Determine whether the rendered element is a `<label>` or `<legend>`.\n\t */\n\tisLegend?: boolean = false;\n\n\t/**\n\t * Name of the component instantiating the class.\n\t * This is used for validation warning message.\n\t */\n\tcomponentTagName: string;\n\n\tlanguage: any = 'en';\n\n\ttranslations: any;\n\n\t/**\n\t * Set the class members\n\t * Output a console warning message if the provided `label` type is incorrect\n\t * @param caption object containing the essential data to configure the input label\n\t */\n\tconstructor(\n\t\tcomponentTagName: string,\n\t\tcaption: Caption | string,\n\t\ttranslations: any,\n\t\tlanguage: any,\n\t\tisLegend: boolean = false,\n\t\trequired: boolean = false,\n\t) {\n\t\tlet captionObject: Caption;\n\n\t\tif (typeof caption === 'string') {\n\t\t\ttry {\n\t\t\t\tcaptionObject = JSON.parse(caption) as Caption;\n\t\t\t} catch {\n\t\t\t\tcaptionObject = { captionText: caption, captionType: 'default' };\n\t\t\t}\n\t\t} else {\n\t\t\tcaptionObject = caption;\n\t\t}\n\n\t\tthis.componentTagName = componentTagName.toLocaleLowerCase();\n\t\tthis.captionText = captionObject?.captionText;\n\t\tthis.captionType =\n\t\t\t(captionObject?.captionType && CaptionTypes.find((type) => type === captionObject.captionType?.toLowerCase())) ||\n\t\t\t'default';\n\t\tthis.required = required;\n\t\tthis.isLegend = isLegend;\n\t\tthis.translations = translations;\n\t\tthis.language = language;\n\n\t\tthis.validateCaption(this);\n\t}\n\n\t/**\n\t * Return the `<label>` element for text inputs\n\t * @param captionFor Set the `htmlFor` attribute\n\t * @param hasHintExpander Indicate whether the component the label is for has a hint expander or not\n\t * @param disableRequiredFlag Disable the required/optional label text _(only use in highly special cases)_\n\t * @returns element containing the caption for the input\n\t */\n\tgetCaption = (\n\t\tcaptionFor?: string | undefined,\n\t\thasHintExpander: boolean = false,\n\t\tdisableRequiredFlag: boolean = false,\n\t): HTMLElement => {\n\t\tconst captionText = this.captionText && this.captionText.toLowerCase();\n\t\tconst captionContent = this.isLegend ? (\n\t\t\t<legend class={this.getClass()}>\n\t\t\t\t{this.captionType === 'heading' ? <h1>{this.captionText}</h1> : this.captionText}\n\t\t\t\t{!disableRequiredFlag && this.getRequiredFlagElement()}\n\t\t\t\t{hasHintExpander && this.getHintExpanderAccessibilityText(captionText, false)}\n\t\t\t</legend>\n\t\t) : (\n\t\t\t<label htmlFor={captionFor} class={this.getClass()}>\n\t\t\t\t{this.captionText}\n\t\t\t\t{!disableRequiredFlag && this.getRequiredFlagElement()}\n\t\t\t\t{hasHintExpander && this.getHintExpanderAccessibilityText(captionText, false)}\n\t\t\t</label>\n\t\t);\n\n\t\t// with `this.captionType` already set to one of the enum values, the comparison no longer needs the `toLowerCase()` transform\n\t\treturn this.captionType === 'heading' && !this.isLegend ? <h1>{captionContent}</h1> : captionContent;\n\t};\n\n\tgetHintExpanderAccessibilityText(captionText: string, hasHintExpanderOnOption: boolean = false): HTMLElement {\n\t\tconst multipleOptionsMessage = (\n\t\t\t<span class=\"ontario-show-for-sr\">\n\t\t\t\t{this.translations.accessibility.moreInfo[this.language]} \"{captionText.toLowerCase()}\"{' '}\n\t\t\t\t{this.translations.accessibility.checkboxHintExpander[this.language]}\n\t\t\t</span>\n\t\t);\n\n\t\tconst singleOptionMessage = (\n\t\t\t<span class=\"ontario-show-for-sr\">\n\t\t\t\t{this.translations.accessibility.moreInfo[this.language]} \"{captionText.toLowerCase()}\"{' '}\n\t\t\t\t{this.translations.accessibility.singleHintExpander[this.language]}\n\t\t\t</span>\n\t\t);\n\t\treturn this.componentTagName === 'ontario-checkboxes'\n\t\t\t? !hasHintExpanderOnOption\n\t\t\t\t? multipleOptionsMessage\n\t\t\t\t: singleOptionMessage\n\t\t\t: singleOptionMessage;\n\t}\n\n\t/**\n\t * Determines which flag text to use between `required` and `optional`\n\t * @returns `required` or `optional` flag text\n\t */\n\tprivate getRequiredFlagText(): string {\n\t\treturn this.required\n\t\t\t? this.translations && `(${this.translations.required[this.language]})`\n\t\t\t: this.translations && `(${this.translations.optional[this.language]})`;\n\t}\n\n\t/**\n\t * Get the HTML for the required/optional flag.\n\t * @returns CSS class for the label/legend.\n\t */\n\tprivate getRequiredFlagElement(): HTMLElement {\n\t\treturn <span class=\"ontario-label__flag\">{this.getRequiredFlagText()}</span>;\n\t}\n\n\t/**\n\t * Get the CSS class for the `label` element.\n\t * @returns CSS class for the `label` element.\n\t */\n\tprivate getClass(): string {\n\t\treturn this.captionType === 'large' || this.captionType === 'heading'\n\t\t\t? this.isLegend\n\t\t\t\t? `ontario-fieldset__legend ontario-fieldset__legend--${this.captionType}`\n\t\t\t\t: `ontario-label ontario-label--${this.captionType}`\n\t\t\t: this.isLegend\n\t\t\t? 'ontario-fieldset__legend'\n\t\t\t: 'ontario-label';\n\t}\n\n\t/**\n\t * Validate caption input by user and output warning message to the console if:\n\t * 1. the `caption` object is not provided\n\t * 2. the `captionText` property of the `caption` object is not provided\n\t * 3. the `captionText` property of the `caption` object is empty or contain only spaces\n\t * 4. the `captionType` property of the `caption` object is not provided\n\t * 5. the `captionType` property of the `caption` object is incorrect\n\t */\n\tprivate validateCaption(caption?: InputCaption) {\n\t\tlet messageType;\n\n\t\t// undefined `caption` object\n\t\tif (!caption || Object.keys(caption).length <= 0) {\n\t\t\tmessageType = MessageContentType.UndefinedCaptionObject;\n\t\t} else {\n\t\t\t// undefined `captionText` property\n\t\t\tif (!caption.captionText) {\n\t\t\t\tmessageType = MessageContentType.UndefinedCaptionText;\n\t\t\t} else {\n\t\t\t\t// `captionText` that is empty or contains only spaces\n\t\t\t\tif (/^\\s*$/.test(caption.captionText)) {\n\t\t\t\t\tmessageType = MessageContentType.EmptyCaptionText;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// undefined `captionType`\n\t\t\tif (!caption.captionType) {\n\t\t\t\tmessageType = MessageContentType.UndefinedCaptionType;\n\t\t\t} else {\n\t\t\t\t// incorrect `captionType`\n\t\t\t\tif (!CaptionTypes.includes(caption?.captionType?.toLowerCase() as CaptionType)) {\n\t\t\t\t\tmessageType = MessageContentType.IncorrectCaptionType;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (messageType) {\n\t\t\tconst message = new ConsoleMessageClass().addDesignSystemTag();\n\n\t\t\tif (messageType !== MessageContentType.UndefinedCaptionObject) {\n\t\t\t\tmessage\n\t\t\t\t\t.addMonospaceText(\n\t\t\t\t\t\t` ${\n\t\t\t\t\t\t\tmessageType === MessageContentType.EmptyCaptionText ||\n\t\t\t\t\t\t\tmessageType === MessageContentType.UndefinedCaptionText\n\t\t\t\t\t\t\t\t? 'caption or captionText'\n\t\t\t\t\t\t\t\t: 'captionType'\n\t\t\t\t\t\t} `,\n\t\t\t\t\t)\n\t\t\t\t\t.addRegularText('object or property of');\n\t\t\t}\n\n\t\t\tmessage.addMonospaceText(' caption ').addRegularText('object on').addMonospaceText(` ${this.componentTagName} `);\n\t\t\tthis.printConsoleMessage(messageType, message, this.getRequiredFlagText());\n\t\t}\n\t}\n\n\t/**\n\t * Generate the content of warning message to be printed to the console\n\t * @param messageType determine the content of warning message to output\n\t * @param componentTagName the tag name of the component that's emitting the warning message\n\t * @param requiredFlagText accepts a string value to be used as the required flag text and defaults to `(optional)` if not set\n\t * @returns an array of `ConsoleMessage` objects containing the message and associated styles to be printed to the console\n\t */\n\tprivate printConsoleMessage(\n\t\tmessageType: MessageContentType,\n\t\tmessage: ConsoleMessageClass,\n\t\trequiredFlagText: string = '(optional)',\n\t) {\n\t\tswitch (messageType) {\n\t\t\t// undefinedCaptionObject example: caption object on <ontario-input> is required but not defined. A blank followed by a (optional) flag is assumed.\n\t\t\t// undefinedCaptionText example: captionText property of caption object on <ontario-input> is required but not defined. A blank followed by a (optional) flag is assumed.\n\t\t\t// EmptyCaptionText example: captionText property of caption object on <ontario-input> is empty or contains only spaces. A blank followed by a (optional) flag is assumed.\n\t\t\tcase MessageContentType.UndefinedCaptionObject:\n\t\t\tcase MessageContentType.UndefinedCaptionText:\n\t\t\tcase MessageContentType.EmptyCaptionText:\n\t\t\t\tmessage\n\t\t\t\t\t.addRegularText(\n\t\t\t\t\t\t`${\n\t\t\t\t\t\t\tmessageType === MessageContentType.EmptyCaptionText\n\t\t\t\t\t\t\t\t? 'is empty or contains only spaces'\n\t\t\t\t\t\t\t\t: 'is required but not defined'\n\t\t\t\t\t\t}. A blank followed by a`,\n\t\t\t\t\t)\n\t\t\t\t\t.addMonospaceText(` ${requiredFlagText} `)\n\t\t\t\t\t.addRegularText('flag is assumed.');\n\t\t\t\tbreak;\n\n\t\t\t// UndefinedCaptionType example: captionType property of caption object on <ontario-input> is not defined. The default type is assumed.\n\t\t\tcase MessageContentType.UndefinedCaptionType:\n\t\t\t\tmessage.addRegularText('is not defined. The').addMonospaceText(' default ').addRegularText('type is assumed.');\n\t\t\t\tbreak;\n\n\t\t\t// IncorrectCaptionType example: captionType property of caption object on <ontario-input> was set to an incorrect type; only default, heading or large type is allowed. The default type is assumed.\n\t\t\tcase MessageContentType.IncorrectCaptionType:\n\t\t\t\tmessage\n\t\t\t\t\t.addRegularText('was set to an incorrect type; only')\n\t\t\t\t\t.addMonospaceText(' default, heading, ')\n\t\t\t\t\t.addRegularText('or')\n\t\t\t\t\t.addMonospaceText(' large ')\n\t\t\t\t\t.addRegularText('type is allowed. The')\n\t\t\t\t\t.addMonospaceText(' default ')\n\t\t\t\t\t.addRegularText('type is assumed.');\n\t\t\t\tbreak;\n\t\t}\n\n\t\tmessage.printMessage();\n\t}\n}\n"]}
@@ -1,2 +1,2 @@
1
- export {};
1
+ export const supportedLanguages = ['en', 'fr'];
2
2
  //# sourceMappingURL=language-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"language-types.js","sourceRoot":"","sources":["../../../src/utils/common/language-types.ts"],"names":[],"mappings":"","sourcesContent":["export type Language = 'en' | 'fr';\n"]}
1
+ {"version":3,"file":"language-types.js","sourceRoot":"","sources":["../../../src/utils/common/language-types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,CAAU,CAAC","sourcesContent":["export const supportedLanguages = ['en', 'fr'] as const;\nexport type Language = (typeof supportedLanguages)[number];\n"]}
@@ -0,0 +1,2 @@
1
+ export const conjunctions = ['and', 'or'];
2
+ //# sourceMappingURL=utils-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-types.js","sourceRoot":"","sources":["../../../src/utils/helper/utils-types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,IAAI,CAAU,CAAC","sourcesContent":["export const conjunctions = ['and', 'or'] as const;\nexport type Conjunction = (typeof conjunctions)[number];\n"]}