@ongov/ontario-design-system-component-library 4.3.0-alpha.3 → 4.3.1-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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ontario-accordion_43.cjs.entry.js +404 -223
- package/dist/cjs/ontario-accordion_43.cjs.entry.js.map +1 -1
- package/dist/cjs/ontario-design-system-components.cjs.js +1 -1
- package/dist/collection/components/ontario-card/ontario-card.css +13 -5
- package/dist/collection/components/ontario-card/ontario-card.js +10 -10
- package/dist/collection/components/ontario-card/ontario-card.js.map +1 -1
- package/dist/collection/components/ontario-card/test/ontario-cards.spec.js +1 -1
- package/dist/collection/components/ontario-card/test/ontario-cards.spec.js.map +1 -1
- package/dist/collection/components/ontario-header/ontario-header.js +17 -3
- package/dist/collection/components/ontario-header/ontario-header.js.map +1 -1
- package/dist/collection/components/ontario-header/test/ontario-header.spec.js +3 -3
- package/dist/collection/components/ontario-header/test/ontario-header.spec.js.map +1 -1
- package/dist/collection/components/ontario-language-toggle/ontario-language-toggle.js +193 -47
- package/dist/collection/components/ontario-language-toggle/ontario-language-toggle.js.map +1 -1
- package/dist/collection/components/ontario-language-toggle/test/ontario-language-toggle.spec.js +16 -3
- package/dist/collection/components/ontario-language-toggle/test/ontario-language-toggle.spec.js.map +1 -1
- package/dist/collection/i18n/global.i18n.json +172 -162
- package/dist/collection/utils/common/language-types.js +1 -1
- package/dist/collection/utils/common/language-types.js.map +1 -1
- package/dist/collection/utils/helper/utils-types.js +2 -0
- package/dist/collection/utils/helper/utils-types.js.map +1 -0
- package/dist/collection/utils/helper/utils.js +26 -0
- package/dist/collection/utils/helper/utils.js.map +1 -1
- package/dist/components/global.i18n.js +184 -173
- package/dist/components/global.i18n.js.map +1 -1
- package/dist/components/ontario-card.js +11 -11
- package/dist/components/ontario-card.js.map +1 -1
- package/dist/components/ontario-header.js +11 -3
- package/dist/components/ontario-header.js.map +1 -1
- package/dist/components/ontario-language-toggle2.js +180 -37
- package/dist/components/ontario-language-toggle2.js.map +1 -1
- package/dist/components/utils.js +28 -0
- package/dist/components/utils.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ontario-accordion_43.entry.js +404 -223
- package/dist/esm/ontario-accordion_43.entry.js.map +1 -1
- package/dist/esm/ontario-design-system-components.js +1 -1
- package/dist/ontario-design-system-components/i18n/global.i18n.json +172 -162
- package/dist/ontario-design-system-components/ontario-design-system-components.esm.js +1 -1
- package/dist/ontario-design-system-components/ontario-design-system-components.esm.js.map +1 -1
- package/dist/ontario-design-system-components/{p-cff41424.entry.js → p-abe58ec9.entry.js} +697 -608
- package/dist/ontario-design-system-components/p-abe58ec9.entry.js.map +1 -0
- package/dist/types/components/ontario-header/ontario-header.d.ts +13 -2
- package/dist/types/components/ontario-language-toggle/ontario-language-toggle.d.ts +75 -8
- package/dist/types/components.d.ts +12 -6
- package/dist/types/utils/common/language-types.d.ts +2 -1
- package/dist/types/utils/helper/utils-types.d.ts +2 -0
- package/dist/types/utils/helper/utils.d.ts +21 -0
- package/package.json +3 -3
- package/src/components/ontario-card/ontario-card.scss +13 -6
- package/src/components/ontario-card/ontario-card.tsx +8 -6
- package/src/components/ontario-card/test/ontario-cards.spec.tsx +1 -1
- package/src/components/ontario-header/ontario-header.tsx +13 -4
- package/src/components/ontario-header/test/ontario-header.spec.tsx +3 -3
- package/src/components/ontario-language-toggle/ontario-language-toggle.tsx +192 -45
- package/src/components/ontario-language-toggle/readme.md +10 -10
- package/src/components/ontario-language-toggle/test/__snapshots__/ontario-language-toggle.spec.tsx.snap +1 -1
- package/src/components/ontario-language-toggle/test/ontario-language-toggle.spec.tsx +17 -3
- package/src/components.d.ts +12 -6
- package/src/french.html +37 -0
- package/src/index.html +19 -0
- package/src/translations/global.i18n.json +172 -162
- package/src/utils/common/language-types.ts +2 -1
- package/src/utils/helper/utils-types.ts +2 -0
- package/src/utils/helper/utils.ts +30 -0
- package/www/build/ontario-design-system-components.esm.js +1 -1
- package/www/build/ontario-design-system-components.esm.js.map +1 -1
- package/www/build/{p-cff41424.entry.js → p-abe58ec9.entry.js} +697 -608
- package/www/build/p-abe58ec9.entry.js.map +1 -0
- package/www/build/{p-b61db0f6.js → p-fdc9ab6d.js} +1 -1
- package/www/french.html +37 -0
- package/www/i18n/global.i18n.json +172 -162
- package/www/index.html +21 -2
- package/dist/ontario-design-system-components/p-cff41424.entry.js.map +0 -1
- package/www/build/p-cff41424.entry.js.map +0 -1
|
@@ -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": "
|
|
71
|
-
"fr": "
|
|
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
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"en": "
|
|
87
|
-
"fr": "
|
|
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
|
-
"
|
|
94
|
-
"en": "
|
|
95
|
-
"fr": "
|
|
31
|
+
"expand": {
|
|
32
|
+
"en": "Expand all",
|
|
33
|
+
"fr": "Agrandir tout"
|
|
96
34
|
},
|
|
97
|
-
"
|
|
98
|
-
"en": "
|
|
99
|
-
"fr": "
|
|
35
|
+
"expandCollapseAriaLabel": {
|
|
36
|
+
"en": "Expand or collapse the accordion",
|
|
37
|
+
"fr": "Agrandissez ou réduisez l'accordéon"
|
|
100
38
|
}
|
|
101
39
|
},
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"en": "
|
|
105
|
-
"fr": "
|
|
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
|
-
"
|
|
144
|
-
"en": "
|
|
145
|
-
"fr": "
|
|
45
|
+
"top": {
|
|
46
|
+
"en": "Top",
|
|
47
|
+
"fr": "Haut"
|
|
146
48
|
}
|
|
147
49
|
},
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
|
|
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": "
|
|
182
|
-
"fr": "
|
|
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
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"en": "
|
|
219
|
-
"fr": "
|
|
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
|
-
"
|
|
222
|
-
"en": "
|
|
223
|
-
"fr": "
|
|
127
|
+
"close": {
|
|
128
|
+
"en": "close",
|
|
129
|
+
"fr": "fermer"
|
|
224
130
|
},
|
|
225
|
-
"
|
|
226
|
-
"en": "
|
|
227
|
-
"fr": "
|
|
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
|
}
|
|
@@ -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
|
|
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 @@
|
|
|
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"]}
|
|
@@ -71,4 +71,30 @@ export function isEmpty(str) {
|
|
|
71
71
|
export function retrieveEnumKeys(enumObject) {
|
|
72
72
|
return Object.keys(enumObject).filter(isNumber);
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Prints an array as a comma delimited list, with the last element being preceded by a conjunction.
|
|
76
|
+
* As per ontario.ca content guidelines, there is no Oxford comma.
|
|
77
|
+
*
|
|
78
|
+
* @param {Array<any>} arr - The array that you wish to print.
|
|
79
|
+
* @param {Conjunction} conjunctionType - Whether you want the sentence to end with 'and value.' or 'or value.'
|
|
80
|
+
*
|
|
81
|
+
* @returns {string}
|
|
82
|
+
*/
|
|
83
|
+
export function printArray(arr, conjunctionType = 'and') {
|
|
84
|
+
return [...arr].reduce(
|
|
85
|
+
(text, value, i, array) => text + (i < array.length - 1 ? ', ' : ` ${conjunctionType} `) + value,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Grabs the HTML element of the page.
|
|
90
|
+
*
|
|
91
|
+
* More targetted than document.documentElement as the documentElement could
|
|
92
|
+
* in theory be any element that is the top level. e.g. <div> if the page is not
|
|
93
|
+
* set up to be semantically correct.
|
|
94
|
+
*
|
|
95
|
+
* @returns {HTMLElement}
|
|
96
|
+
*/
|
|
97
|
+
export function getRootHTMLElement() {
|
|
98
|
+
return document.getElementsByTagName('html')[0];
|
|
99
|
+
}
|
|
74
100
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/helper/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/helper/utils.ts"],"names":[],"mappings":"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","sourcesContent":["import { Conjunction } from './utils-types';\n\nexport function format(first: string | undefined, middle: string | undefined, last: string | undefined): string {\n\treturn (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');\n}\n\nexport function hasMultipleTrueValues<T>(arr: T[], key: keyof T): boolean {\n\tlet count = 0;\n\n\tfor (const obj of arr) {\n\t\tif (obj[key] === true || obj[key] === 'true') {\n\t\t\tcount++;\n\t\t\tif (count > 1) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}\n\nexport function extractValuesByKey<T>(objects: T[], key: keyof T): Array<T[keyof T]> {\n\treturn objects.map((obj) => obj[key]);\n}\n\nexport function organizeObjectKeys(data: any[], columns: string[]): any[] {\n\treturn data.map((item) => {\n\t\tconst newData: any = {};\n\t\tconst otherKeys: any = {};\n\n\t\t// Iterate through each key in the item\n\t\tObject.keys(item).forEach((key) => {\n\t\t\tif (key === 'data') {\n\t\t\t\t// Organize keys in the 'data' object\n\t\t\t\tcolumns.forEach((column) => {\n\t\t\t\t\tif (column in item.data) {\n\t\t\t\t\t\tnewData[column] = item.data[column];\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Preserve other keys\n\t\t\t\totherKeys[key] = item[key];\n\t\t\t}\n\t\t});\n\n\t\treturn { data: newData, ...otherKeys };\n\t});\n}\n\nexport function removeObjectsBySpecificKey<T>(objects: T[], key: keyof T, value: boolean | 'true'): [T[], T[]] {\n\tconst removedObjects: T[] = [];\n\tconst filteredObjects = objects.filter((obj) => {\n\t\tif (obj[key] === value) {\n\t\t\tremovedObjects.push(obj);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\treturn [filteredObjects, removedObjects];\n}\n\n/**\n * Takes an input value and determines whether or not it is a number.\n *\n * @param {string | number} value - The value you would like to test against.\n *\n * @returns {boolean}\n */\nexport function isNumber(value: string | number): boolean {\n\treturn isNaN(Number(value)) === true;\n}\n\nexport function isEmpty(str: string | undefined | null): boolean {\n\treturn !str || str?.length <= 0;\n}\n\n/**\n * Retrieves the keys from an enum and lists them in an array.\n *\n * @param {object} enumObject - The enum you wish to get the keys of.\n *\n * @returns {string[]}\n */\nexport function retrieveEnumKeys(enumObject: object): string[] {\n\treturn Object.keys(enumObject).filter(isNumber);\n}\n\n/**\n * Prints an array as a comma delimited list, with the last element being preceded by a conjunction.\n * As per ontario.ca content guidelines, there is no Oxford comma.\n *\n * @param {Array<any>} arr - The array that you wish to print.\n * @param {Conjunction} conjunctionType - Whether you want the sentence to end with 'and value.' or 'or value.'\n *\n * @returns {string}\n */\nexport function printArray(arr: Array<any>, conjunctionType: Conjunction = 'and'): string {\n\treturn [...arr].reduce(\n\t\t(text, value, i, array) => text + (i < array.length - 1 ? ', ' : ` ${conjunctionType} `) + value,\n\t);\n}\n\n/**\n * Grabs the HTML element of the page.\n *\n * More targetted than document.documentElement as the documentElement could\n * in theory be any element that is the top level. e.g. <div> if the page is not\n * set up to be semantically correct.\n *\n * @returns {HTMLElement}\n */\nexport function getRootHTMLElement(): HTMLElement {\n\treturn document.getElementsByTagName('html')[0];\n}\n"]}
|