@ongov/ontario-design-system-complete-styles 4.2.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.
- package/LICENSE +201 -0
- package/README.md +88 -0
- package/dist/assets/footer-default-supergraphic-logo.svg +11 -0
- package/dist/assets/footer-expanded-supergraphic-logo.svg +11 -0
- package/dist/assets/highlight-indicator.svg +9 -0
- package/dist/assets/ontario-logo--desktop.svg +40 -0
- package/dist/assets/ontario-logo--mobile.svg +6 -0
- package/dist/assets/ontario-material-dropdown-arrow-48px.svg +1 -0
- package/dist/favicons/apple-touch-icon.png +0 -0
- package/dist/favicons/favicon-192x192.png +0 -0
- package/dist/favicons/favicon-48x48.png +0 -0
- package/dist/favicons/favicon-512x512.png +0 -0
- package/dist/favicons/favicon.ico +0 -0
- package/dist/favicons/favicon.svg +60 -0
- package/dist/favicons/manifest.json +17 -0
- package/dist/fonts/courier-prime-400/CourierPrime-Regular.ttf +0 -0
- package/dist/fonts/courier-prime-400/OFL.txt +93 -0
- package/dist/fonts/courier-prime-400--italic/CourierPrime-Italic.ttf +0 -0
- package/dist/fonts/courier-prime-400--italic/OFL.txt +93 -0
- package/dist/fonts/courier-prime-700/CourierPrime-Bold.ttf +0 -0
- package/dist/fonts/courier-prime-700/OFL.txt +93 -0
- package/dist/fonts/courier-prime-700--italic/CourierPrime-BoldItalic.ttf +0 -0
- package/dist/fonts/courier-prime-700--italic/OFL.txt +93 -0
- package/dist/fonts/open-sans-400/LICENSE.txt +202 -0
- package/dist/fonts/open-sans-400/open-sans-400.eot +0 -0
- package/dist/fonts/open-sans-400/open-sans-400.svg +1637 -0
- package/dist/fonts/open-sans-400/open-sans-400.ttf +0 -0
- package/dist/fonts/open-sans-400/open-sans-400.woff +0 -0
- package/dist/fonts/open-sans-400/open-sans-400.woff2 +0 -0
- package/dist/fonts/open-sans-400--italic/LICENSE.txt +202 -0
- package/dist/fonts/open-sans-400--italic/open-sans-400--italic.eot +0 -0
- package/dist/fonts/open-sans-400--italic/open-sans-400--italic.svg +1650 -0
- package/dist/fonts/open-sans-400--italic/open-sans-400--italic.ttf +0 -0
- package/dist/fonts/open-sans-400--italic/open-sans-400--italic.woff +0 -0
- package/dist/fonts/open-sans-400--italic/open-sans-400--italic.woff2 +0 -0
- package/dist/fonts/open-sans-600/LICENSE.txt +202 -0
- package/dist/fonts/open-sans-600/open-sans-600.eot +0 -0
- package/dist/fonts/open-sans-600/open-sans-600.svg +1637 -0
- package/dist/fonts/open-sans-600/open-sans-600.ttf +0 -0
- package/dist/fonts/open-sans-600/open-sans-600.woff +0 -0
- package/dist/fonts/open-sans-600/open-sans-600.woff2 +0 -0
- package/dist/fonts/open-sans-700/LICENSE.txt +202 -0
- package/dist/fonts/open-sans-700/open-sans-700.eot +0 -0
- package/dist/fonts/open-sans-700/open-sans-700.svg +548 -0
- package/dist/fonts/open-sans-700/open-sans-700.ttf +0 -0
- package/dist/fonts/open-sans-700/open-sans-700.woff +0 -0
- package/dist/fonts/open-sans-700/open-sans-700.woff2 +0 -0
- package/dist/fonts/raleway-modified-400/LICENSE.txt +95 -0
- package/dist/fonts/raleway-modified-400/raleway-modified-400.svg +630 -0
- package/dist/fonts/raleway-modified-400/raleway-modified-400.ttf +0 -0
- package/dist/fonts/raleway-modified-400/raleway-modified-400.woff +0 -0
- package/dist/fonts/raleway-modified-400/raleway-modified-400.woff2 +0 -0
- package/dist/fonts/raleway-modified-600/LICENSE.txt +95 -0
- package/dist/fonts/raleway-modified-600/raleway-modified-600.svg +625 -0
- package/dist/fonts/raleway-modified-600/raleway-modified-600.ttf +0 -0
- package/dist/fonts/raleway-modified-600/raleway-modified-600.woff +0 -0
- package/dist/fonts/raleway-modified-600/raleway-modified-600.woff2 +0 -0
- package/dist/fonts/raleway-modified-700/LICENSE.txt +95 -0
- package/dist/fonts/raleway-modified-700/raleway-modified-700.svg +621 -0
- package/dist/fonts/raleway-modified-700/raleway-modified-700.ttf +0 -0
- package/dist/fonts/raleway-modified-700/raleway-modified-700.woff +0 -0
- package/dist/fonts/raleway-modified-700/raleway-modified-700.woff2 +0 -0
- package/dist/scripts/back-to-top.js +8 -0
- package/dist/scripts/ontario-a11y.js +74 -0
- package/dist/scripts/ontario-expand-collapse.js +150 -0
- package/dist/scripts/ontario-header.js +204 -0
- package/dist/scripts/ontario-search.js +5 -0
- package/dist/scripts/svgxuse.js +139 -0
- package/dist/scripts/tables.js +31 -0
- package/dist/styles/components/ontario-accordion/ontario-accordion.scss +158 -0
- package/dist/styles/components/ontario-aside/ontario-aside.scss +47 -0
- package/dist/styles/components/ontario-back-to-top/ontario-back-to-top.scss +103 -0
- package/dist/styles/components/ontario-blockquote/ontario-blockquote.scss +78 -0
- package/dist/styles/components/ontario-button/ontario-button.scss +161 -0
- package/dist/styles/components/ontario-callout/ontario-callout.scss +41 -0
- package/dist/styles/components/ontario-card/ontario-card.scss +229 -0
- package/dist/styles/components/ontario-card-collection/ontario-card-collection.scss +40 -0
- package/dist/styles/components/ontario-checkbox/ontario-checkboxes.scss +137 -0
- package/dist/styles/components/ontario-critical-alert/ontario-critical-alert.scss +68 -0
- package/dist/styles/components/ontario-date-input/ontario-date-input.scss +31 -0
- package/dist/styles/components/ontario-dropdown-list/ontario-dropdown-list.scss +26 -0
- package/dist/styles/components/ontario-fieldset/ontario-fieldset.scss +2 -0
- package/dist/styles/components/ontario-footer/ontario-footer.scss +342 -0
- package/dist/styles/components/ontario-header/ontario-application-header.scss +633 -0
- package/dist/styles/components/ontario-header/ontario-header.scss +781 -0
- package/dist/styles/components/ontario-header/service-ontario-header.scss +228 -0
- package/dist/styles/components/ontario-hint-expander/ontario-hint-expander.scss +121 -0
- package/dist/styles/components/ontario-hint-text/ontario-hint-text.scss +31 -0
- package/dist/styles/components/ontario-icon/ontario-icon.scss +39 -0
- package/dist/styles/components/ontario-input/ontario-input.scss +72 -0
- package/dist/styles/components/ontario-language-toggle/ontario-language-toggle.scss +65 -0
- package/dist/styles/components/ontario-loading-indicator/ontario-loading-indicator.scss +96 -0
- package/dist/styles/components/ontario-page-alert/ontario-page-alert.scss +106 -0
- package/dist/styles/components/ontario-radio-buttons/ontario-radio-buttons.scss +125 -0
- package/dist/styles/components/ontario-step-indicator/ontario-step-indicator.scss +67 -0
- package/dist/styles/components/ontario-table/ontario-table.scss +370 -0
- package/dist/styles/components/ontario-textarea/ontario-textarea.scss +36 -0
- package/dist/styles/css/compiled/ontario-theme.css +9694 -0
- package/dist/styles/css/compiled/ontario-theme.min.css +1 -0
- package/dist/styles/global.scss +1 -0
- package/dist/styles/scss/1-variables/_breakpoints.variables.scss +16 -0
- package/dist/styles/scss/1-variables/_colours.variables.scss +109 -0
- package/dist/styles/scss/1-variables/_font-sizes.variables.scss +12 -0
- package/dist/styles/scss/1-variables/_font-weights.variables.scss +9 -0
- package/dist/styles/scss/1-variables/_global.variables.scss +37 -0
- package/dist/styles/scss/1-variables/_grid.variables.scss +58 -0
- package/dist/styles/scss/1-variables/_letter-spacing.variables.scss +13 -0
- package/dist/styles/scss/1-variables/_line-heights.variables.scss +16 -0
- package/dist/styles/scss/1-variables/_spacing.variables.scss +19 -0
- package/dist/styles/scss/1-variables/_tokens.variables.scss +1 -0
- package/dist/styles/scss/1-variables/_typography.variables.scss +125 -0
- package/dist/styles/scss/1-variables/_z-index.variables.scss +12 -0
- package/dist/styles/scss/2-tools/functions/_asset-helper.functions.scss +56 -0
- package/dist/styles/scss/2-tools/functions/_global.functions.scss +22 -0
- package/dist/styles/scss/2-tools/functions/_grid.functions.scss +42 -0
- package/dist/styles/scss/2-tools/mixins/_global.mixins.scss +44 -0
- package/dist/styles/scss/2-tools/mixins/_grid.mixins.scss +263 -0
- package/dist/styles/scss/2-tools/placeholder/_focus.placeholders.scss +16 -0
- package/dist/styles/scss/3-generics/_colours.generics.scss +148 -0
- package/dist/styles/scss/3-generics/_typography.generics.scss +117 -0
- package/dist/styles/scss/4-elements/_global.elements.scss +284 -0
- package/dist/styles/scss/5-layout/_grid.layout.scss +71 -0
- package/dist/styles/scss/6-components/_all.component.scss +60 -0
- package/dist/styles/scss/6-components/_callouts-asides.scss +16 -0
- package/dist/styles/scss/6-components/_form.component.scss +71 -0
- package/dist/styles/scss/6-components/_labels.component.scss +57 -0
- package/dist/styles/scss/6-components/_page-alerts.component.scss +43 -0
- package/dist/styles/scss/6-components/_text-inputs.component.scss +63 -0
- package/dist/styles/scss/7-overrides/_spacing.overrides.scss +416 -0
- package/dist/styles/scss/7-overrides/_visibility.overrides.scss +128 -0
- package/dist/styles/scss/theme.scss +57 -0
- package/dist/styles/styles/common.scss +2 -0
- package/dist/styles/styles/form.scss +4 -0
- package/dist/styles/styles/grid.scss +1 -0
- package/dist/styles/utils/components/error-message/error-message.scss +23 -0
- package/package.json +52 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
window.addEventListener('scroll', function () {
|
|
2
|
+
let scroll = document.getElementById('actual-btt-button');
|
|
3
|
+
scroll.classList.toggle('active', window.scrollY > 200);
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
function scrollToTop() {
|
|
7
|
+
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
|
|
8
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A11Y handling
|
|
3
|
+
*/
|
|
4
|
+
var KEYCODE = {
|
|
5
|
+
TAB: 9,
|
|
6
|
+
ENTER: 13,
|
|
7
|
+
ESCAPE: 27,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function addA11y(element) {
|
|
11
|
+
element.setAttribute('aria-hidden', true);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function removeA11y(element) {
|
|
15
|
+
element.removeAttribute('aria-hidden');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function addA11yVisibility(element) {
|
|
19
|
+
element.setAttribute('aria-hidden', false);
|
|
20
|
+
element.setAttribute('tabindex', -1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function removeA11yVisibility(element) {
|
|
24
|
+
element.setAttribute('aria-hidden', true);
|
|
25
|
+
element.removeAttribute('tabindex');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// keyboard utility to Trap focus
|
|
29
|
+
function focusUser(config) {
|
|
30
|
+
if (!config) {
|
|
31
|
+
throw new Error('Unable to initialize focus-trapping - missing config');
|
|
32
|
+
}
|
|
33
|
+
var element = config.element,
|
|
34
|
+
escapeCallback = config.callbackOnEscape;
|
|
35
|
+
|
|
36
|
+
if (escapeCallback && !(escapeCallback instanceof Function)) {
|
|
37
|
+
throw new Error('Unable to initialize focus-trapping - callback is not a function');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var focusableElements = element.querySelectorAll(
|
|
41
|
+
"a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, [tabindex='0'], [contenteditable]",
|
|
42
|
+
);
|
|
43
|
+
var keyboardHandler;
|
|
44
|
+
|
|
45
|
+
if (focusableElements.length > 0) {
|
|
46
|
+
var firstFocusableElement = focusableElements[0],
|
|
47
|
+
lastFocusableElement = focusableElements[focusableElements.length - 1];
|
|
48
|
+
|
|
49
|
+
firstFocusableElement.focus();
|
|
50
|
+
|
|
51
|
+
keyboardHandler = function keyboardHandler(e) {
|
|
52
|
+
if (e.key === 'Escape' || e.keyCode === KEYCODE.ESCAPE) {
|
|
53
|
+
return escapeCallback();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (e.key === 'Tab' || e.keyCode === KEYCODE.TAB) {
|
|
57
|
+
if (e.shiftKey && document.activeElement === firstFocusableElement) {
|
|
58
|
+
lastFocusableElement.focus();
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
} else if (!e.shiftKey && document.activeElement === lastFocusableElement) {
|
|
61
|
+
firstFocusableElement.focus();
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
element.addEventListener('keydown', keyboardHandler);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return function cleanUpEventListener() {
|
|
70
|
+
if (keyboardHandler) {
|
|
71
|
+
element.removeEventListener('keydown', keyboardHandler);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
function findElement(arr, callback) {
|
|
3
|
+
for (var i = 0; i < arr.length; i++) {
|
|
4
|
+
var match = callback(arr[i]);
|
|
5
|
+
if (match) {
|
|
6
|
+
return arr[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function openAllAccordions(item, content) {
|
|
12
|
+
item.classList.remove('ontario-expander--active');
|
|
13
|
+
item.classList.add('ontario-expander--active');
|
|
14
|
+
item.firstElementChild.setAttribute('aria-expanded', 'true');
|
|
15
|
+
|
|
16
|
+
content.forEach(function (item) {
|
|
17
|
+
item.classList.remove('ontario-expander__content--opened');
|
|
18
|
+
item.classList.add('ontario-expander__content--opened');
|
|
19
|
+
|
|
20
|
+
item.setAttribute('aria-hidden', 'false');
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function closeAllAccordions(item, content) {
|
|
25
|
+
item.classList.remove('ontario-expander--active');
|
|
26
|
+
item.firstElementChild.setAttribute('aria-expanded', 'false');
|
|
27
|
+
|
|
28
|
+
content.forEach(function (item) {
|
|
29
|
+
item.classList.remove('ontario-expander__content--opened');
|
|
30
|
+
|
|
31
|
+
item.setAttribute('aria-hidden', 'true');
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function toggleExpandAllButton(accordionExpandAllButton) {
|
|
36
|
+
// toggle expand all button class
|
|
37
|
+
accordionExpandAllButton.parentNode.classList.toggle('ontario-accordion__controls--active');
|
|
38
|
+
|
|
39
|
+
// toggle aria-expanded value of expand all button class if it contains active class
|
|
40
|
+
accordionExpandAllButton.parentNode.classList.contains('ontario-accordion__controls--active')
|
|
41
|
+
? accordionExpandAllButton.setAttribute('aria-expanded', 'true')
|
|
42
|
+
: accordionExpandAllButton.setAttribute('aria-expanded', 'false');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function allAccordionsOpenCheck() {
|
|
46
|
+
// get all open accordions
|
|
47
|
+
var openExpanders = document.getElementsByClassName('ontario-expander--active');
|
|
48
|
+
|
|
49
|
+
// get total accordions
|
|
50
|
+
var accordionContainers = Array.prototype.slice.call(document.querySelectorAll('.ontario-accordion'));
|
|
51
|
+
|
|
52
|
+
if (openExpanders.length === accordionContainers.length) {
|
|
53
|
+
toggleExpandAllButton(document.getElementsByClassName('ontario-accordion__button--expand-all')[0]);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (openExpanders.length === 0) {
|
|
57
|
+
var accordionExpandAllButton = document.getElementsByClassName('ontario-accordion__button--expand-all')[0];
|
|
58
|
+
|
|
59
|
+
accordionExpandAllButton.setAttribute('aria-expanded', 'false');
|
|
60
|
+
|
|
61
|
+
accordionExpandAllButton.parentElement.classList.remove('ontario-accordion__controls--active');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function toggleExpanderByLink(links, expandableItems) {
|
|
66
|
+
var accordions = Array.prototype.slice.call(document.querySelectorAll('.ontario-accordion'));
|
|
67
|
+
|
|
68
|
+
links.forEach(function (link) {
|
|
69
|
+
link.addEventListener('click', function () {
|
|
70
|
+
var id = this.hash.substring(1);
|
|
71
|
+
|
|
72
|
+
var relatedAccordion = findElement(accordions, function (accordion) {
|
|
73
|
+
return accordion.id === id;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
relatedAccordion.classList.add('ontario-expander--active');
|
|
77
|
+
|
|
78
|
+
window.setTimeout(function () {
|
|
79
|
+
relatedAccordion.firstElementChild.focus();
|
|
80
|
+
}, 0);
|
|
81
|
+
|
|
82
|
+
var content = relatedAccordion.querySelector("[data-toggle='ontario-expander-content']");
|
|
83
|
+
|
|
84
|
+
content.classList.add('ontario-expander__content--opened');
|
|
85
|
+
content.setAttribute('aria-hidden', 'false');
|
|
86
|
+
relatedAccordion.setAttribute('aria-expanded', 'true');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function toggleExpander(expanders) {
|
|
92
|
+
expanders.forEach(function (item, index) {
|
|
93
|
+
item.addEventListener('click', function () {
|
|
94
|
+
item.parentNode.classList.toggle('ontario-expander--active');
|
|
95
|
+
var content = item.parentNode.parentNode.querySelector("[data-toggle='ontario-expander-content']");
|
|
96
|
+
|
|
97
|
+
content.classList.toggle('ontario-expander__content--opened');
|
|
98
|
+
content.classList.contains('ontario-expander__content--opened')
|
|
99
|
+
? content.setAttribute('aria-hidden', 'false')
|
|
100
|
+
: content.setAttribute('aria-hidden', 'true');
|
|
101
|
+
|
|
102
|
+
this.parentNode.classList.contains('ontario-expander--active')
|
|
103
|
+
? this.setAttribute('aria-expanded', 'true')
|
|
104
|
+
: this.setAttribute('aria-expanded', 'false');
|
|
105
|
+
|
|
106
|
+
// if expander is an accordion
|
|
107
|
+
if (document.getElementsByClassName('ontario-accordion__button--expand-all').length) {
|
|
108
|
+
allAccordionsOpenCheck();
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function toggleAllAccordions(expandAllButton) {
|
|
115
|
+
expandAllButton.forEach(function (button, index) {
|
|
116
|
+
button.addEventListener('click', function () {
|
|
117
|
+
var accordionContainer = this.parentNode.parentNode;
|
|
118
|
+
var accordionExpandAllButton = this;
|
|
119
|
+
var accordionItems = Array.prototype.slice.call(
|
|
120
|
+
accordionContainer.querySelectorAll('.ontario-accordion-heading'),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
toggleExpandAllButton(accordionExpandAllButton);
|
|
124
|
+
|
|
125
|
+
// loop over every accordion item, add correct classes + aria attribuutes if the expand all button is active or not
|
|
126
|
+
accordionItems.forEach(function (item, index) {
|
|
127
|
+
var content = Array.prototype.slice.call(
|
|
128
|
+
item.parentNode.querySelectorAll("[data-toggle='ontario-expander-content']"),
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
accordionExpandAllButton.parentNode.classList.contains('ontario-accordion__controls--active')
|
|
132
|
+
? openAllAccordions(item, content)
|
|
133
|
+
: closeAllAccordions(item, content);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
window.addEventListener('DOMContentLoaded', function () {
|
|
140
|
+
var expandableItems = Array.prototype.slice.call(document.querySelectorAll("[data-toggle='ontario-collapse']"));
|
|
141
|
+
var expandAllButtons = Array.prototype.slice.call(
|
|
142
|
+
document.querySelectorAll('.ontario-accordion__button--expand-all'),
|
|
143
|
+
);
|
|
144
|
+
var accordionLinks = Array.prototype.slice.call(document.querySelectorAll('.ontario-accordion-link'));
|
|
145
|
+
|
|
146
|
+
toggleExpander(expandableItems);
|
|
147
|
+
toggleAllAccordions(expandAllButtons);
|
|
148
|
+
toggleExpanderByLink(accordionLinks);
|
|
149
|
+
});
|
|
150
|
+
})();
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// run asynchronously
|
|
2
|
+
function deferInFn(fn) {
|
|
3
|
+
if (typeof fn === 'function') setTimeout(fn, 0);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
Header
|
|
8
|
+
*/
|
|
9
|
+
(function () {
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
if (!('addEventListener' in window) || !document.documentElement.classList) return;
|
|
13
|
+
|
|
14
|
+
var navPanelSelector = 'ontario-navigation',
|
|
15
|
+
isReadyClass = 'ontario-navigation--is-ready',
|
|
16
|
+
isActiveClass = 'ontario-navigation--open',
|
|
17
|
+
mobileMenuActiveClass = 'ontario-navigation--open';
|
|
18
|
+
|
|
19
|
+
var header = document.getElementById('ontario-header'),
|
|
20
|
+
nav = document.getElementById(navPanelSelector),
|
|
21
|
+
openBttnToggler = document.getElementById('ontario-header-menu-toggler'),
|
|
22
|
+
closeBttnToggler = document.getElementById('ontario-header-nav-toggler'),
|
|
23
|
+
body = document.getElementsByTagName('body')[0];
|
|
24
|
+
|
|
25
|
+
if (!nav) return;
|
|
26
|
+
|
|
27
|
+
var currentTogger = null,
|
|
28
|
+
currentDomEl = null;
|
|
29
|
+
|
|
30
|
+
function showNavPanel(navpanel) {
|
|
31
|
+
body.classList.add(mobileMenuActiveClass);
|
|
32
|
+
header.parentNode.classList.add(isActiveClass);
|
|
33
|
+
|
|
34
|
+
navpanel.classList.add('ontario-navigation--open');
|
|
35
|
+
|
|
36
|
+
addA11yVisibility(navpanel);
|
|
37
|
+
|
|
38
|
+
focusUser({
|
|
39
|
+
element: navpanel,
|
|
40
|
+
callbackOnEscape: hideNavPanel,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
closeBttnToggler.focus();
|
|
44
|
+
|
|
45
|
+
deferInFn(unbindOpenBttnToggler);
|
|
46
|
+
|
|
47
|
+
// bind clickables: document, closebttn - asynchronously
|
|
48
|
+
deferInFn(bindDocumentKeydown);
|
|
49
|
+
deferInFn(bindDocumentClick);
|
|
50
|
+
deferInFn(bindCloseBttnToggler);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function hideNavPanel(navpanel, returnToToggler) {
|
|
54
|
+
var navpanelDomEl = navpanel ? navpanel : currentDomEl;
|
|
55
|
+
var returnFocusToToggler = returnToToggler !== undefined;
|
|
56
|
+
|
|
57
|
+
body.classList.remove(mobileMenuActiveClass);
|
|
58
|
+
header.parentNode.classList.remove(isActiveClass);
|
|
59
|
+
|
|
60
|
+
var navigation = navpanelDomEl.querySelector('.ontario-navigation')
|
|
61
|
+
? navpanelDomEl.querySelector('.ontario-navigation')
|
|
62
|
+
: navpanelDomEl;
|
|
63
|
+
|
|
64
|
+
navpanelDomEl.querySelector('.ontario-navigation').classList.remove('ontario-navigation--open');
|
|
65
|
+
|
|
66
|
+
removeA11yVisibility(navigation);
|
|
67
|
+
|
|
68
|
+
// unbind clickables: document, closebttn
|
|
69
|
+
unbindCloseBttnToggler();
|
|
70
|
+
unbindDocumentClick();
|
|
71
|
+
unbindDocumentKeydown();
|
|
72
|
+
|
|
73
|
+
bindOpenBttnToggler();
|
|
74
|
+
|
|
75
|
+
// return focus to toggler
|
|
76
|
+
if (returnFocusToToggler) {
|
|
77
|
+
currentTogger.focus();
|
|
78
|
+
currentTogger = null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function openMenu(e) {
|
|
83
|
+
var navpanelId = e.currentTarget.getAttribute('aria-controls');
|
|
84
|
+
var navpanel = document.getElementById(navpanelId);
|
|
85
|
+
|
|
86
|
+
if (currentDomEl) {
|
|
87
|
+
hideNavPanel(currentDomEl, false);
|
|
88
|
+
}
|
|
89
|
+
currentTogger = e.currentTarget;
|
|
90
|
+
currentDomEl = document.querySelector('.ontario-header__container');
|
|
91
|
+
showNavPanel(navpanel);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function closeMenu() {
|
|
95
|
+
hideNavPanel(currentDomEl);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function onClickHandler(e) {
|
|
99
|
+
hideNavPanel();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function onKeyboardHandler(e) {
|
|
103
|
+
if (e.key === 'Escape' || e.keyCode === KEYCODE.ESCAPE) hideNavPanel();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// bind-unbind events
|
|
107
|
+
function bindOpenBttnToggler() {
|
|
108
|
+
openBttnToggler.addEventListener('click', openMenu);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function unbindOpenBttnToggler() {
|
|
112
|
+
openBttnToggler.removeEventListener('click', openMenu);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function bindCloseBttnToggler() {
|
|
116
|
+
closeBttnToggler.addEventListener('click', closeMenu);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function unbindCloseBttnToggler() {
|
|
120
|
+
closeBttnToggler.removeEventListener('click', closeMenu);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function bindDocumentClick() {
|
|
124
|
+
document.addEventListener('click', onClickHandler);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function unbindDocumentClick() {
|
|
128
|
+
document.removeEventListener('click', onClickHandler);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function bindDocumentKeydown() {
|
|
132
|
+
document.addEventListener('keydown', onKeyboardHandler);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function unbindDocumentKeydown() {
|
|
136
|
+
document.removeEventListener('keydown', onKeyboardHandler);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function init() {
|
|
140
|
+
addA11y(nav);
|
|
141
|
+
bindOpenBttnToggler(nav);
|
|
142
|
+
nav.classList.add(isReadyClass);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
init();
|
|
146
|
+
})();
|
|
147
|
+
|
|
148
|
+
/*
|
|
149
|
+
Search
|
|
150
|
+
*/
|
|
151
|
+
(function () {
|
|
152
|
+
'use strict';
|
|
153
|
+
|
|
154
|
+
// review browser support
|
|
155
|
+
if (!('addEventListener' in window) || !document.documentElement.classList) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
var header = document.getElementById('ontario-header'),
|
|
160
|
+
searchFormContainer = document.getElementById('ontario-search-form-container'),
|
|
161
|
+
searchInputField = document.getElementById('ontario-search-input-field'),
|
|
162
|
+
searchReset = document.getElementById('ontario-search-reset'),
|
|
163
|
+
searchToggler = document.getElementById('ontario-header-search-toggler'),
|
|
164
|
+
searchClose = document.getElementById('ontario-header-search-close'),
|
|
165
|
+
searchOpenClass = 'ontario-header--search-open';
|
|
166
|
+
|
|
167
|
+
if (!searchFormContainer || !searchInputField || !searchReset) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
searchInputField.addEventListener('keyup', function (e) {
|
|
172
|
+
if (e.key === 'Escape' || e.keyCode === KEYCODE.ESCAPE) {
|
|
173
|
+
searchReset.click();
|
|
174
|
+
}
|
|
175
|
+
if (!e.target.value) {
|
|
176
|
+
searchInputField.value = '';
|
|
177
|
+
searchInputField.focus();
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Mobile handling
|
|
182
|
+
function toggleSearchForm(newState) {
|
|
183
|
+
header.classList.toggle(searchOpenClass);
|
|
184
|
+
if (newState === 'expand') {
|
|
185
|
+
removeA11y(searchFormContainer);
|
|
186
|
+
searchInputField.focus();
|
|
187
|
+
} else {
|
|
188
|
+
addA11y(searchFormContainer);
|
|
189
|
+
searchToggler.focus();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
searchToggler.addEventListener('click', function (e) {
|
|
194
|
+
toggleSearchForm('expand');
|
|
195
|
+
});
|
|
196
|
+
searchClose.addEventListener('click', function (e) {
|
|
197
|
+
toggleSearchForm('collapse');
|
|
198
|
+
});
|
|
199
|
+
searchClose.addEventListener('keyup', function (e) {
|
|
200
|
+
if (e.key === 'Enter' || e.keyCode === KEYCODE.ENTER) {
|
|
201
|
+
toggleSearchForm('collapse');
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
})();
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @copyright Copyright (c) 2017 IcoMoon.io
|
|
3
|
+
* @license Licensed under MIT license
|
|
4
|
+
* See https://github.com/Keyamoon/svgxuse
|
|
5
|
+
* @version 1.2.6
|
|
6
|
+
*/
|
|
7
|
+
(function () {
|
|
8
|
+
if ('undefined' !== typeof window && window.addEventListener) {
|
|
9
|
+
var e = Object.create(null),
|
|
10
|
+
l,
|
|
11
|
+
d = function () {
|
|
12
|
+
clearTimeout(l);
|
|
13
|
+
l = setTimeout(n, 100);
|
|
14
|
+
},
|
|
15
|
+
m = function () {},
|
|
16
|
+
t = function () {
|
|
17
|
+
window.addEventListener('resize', d, !1);
|
|
18
|
+
window.addEventListener('orientationchange', d, !1);
|
|
19
|
+
if (window.MutationObserver) {
|
|
20
|
+
var k = new MutationObserver(d);
|
|
21
|
+
k.observe(document.documentElement, { childList: !0, subtree: !0, attributes: !0 });
|
|
22
|
+
m = function () {
|
|
23
|
+
try {
|
|
24
|
+
k.disconnect(),
|
|
25
|
+
window.removeEventListener('resize', d, !1),
|
|
26
|
+
window.removeEventListener('orientationchange', d, !1);
|
|
27
|
+
} catch (v) {}
|
|
28
|
+
};
|
|
29
|
+
} else
|
|
30
|
+
document.documentElement.addEventListener('DOMSubtreeModified', d, !1),
|
|
31
|
+
(m = function () {
|
|
32
|
+
document.documentElement.removeEventListener('DOMSubtreeModified', d, !1);
|
|
33
|
+
window.removeEventListener('resize', d, !1);
|
|
34
|
+
window.removeEventListener('orientationchange', d, !1);
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
u = function (k) {
|
|
38
|
+
function e(a) {
|
|
39
|
+
if (void 0 !== a.protocol) var c = a;
|
|
40
|
+
else (c = document.createElement('a')), (c.href = a);
|
|
41
|
+
return c.protocol.replace(/:/g, '') + c.host;
|
|
42
|
+
}
|
|
43
|
+
if (window.XMLHttpRequest) {
|
|
44
|
+
var d = new XMLHttpRequest();
|
|
45
|
+
var m = e(location);
|
|
46
|
+
k = e(k);
|
|
47
|
+
d = void 0 === d.withCredentials && '' !== k && k !== m ? XDomainRequest || void 0 : XMLHttpRequest;
|
|
48
|
+
}
|
|
49
|
+
return d;
|
|
50
|
+
};
|
|
51
|
+
var n = function () {
|
|
52
|
+
function d() {
|
|
53
|
+
--q;
|
|
54
|
+
0 === q && (m(), t());
|
|
55
|
+
}
|
|
56
|
+
function l(a) {
|
|
57
|
+
return function () {
|
|
58
|
+
!0 !== e[a.base] &&
|
|
59
|
+
(a.useEl.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + a.hash),
|
|
60
|
+
a.useEl.hasAttribute('href') && a.useEl.setAttribute('href', '#' + a.hash));
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function p(a) {
|
|
64
|
+
return function () {
|
|
65
|
+
var c = document.body,
|
|
66
|
+
b = document.createElement('x');
|
|
67
|
+
a.onload = null;
|
|
68
|
+
b.innerHTML = a.responseText;
|
|
69
|
+
if ((b = b.getElementsByTagName('svg')[0]))
|
|
70
|
+
b.setAttribute('aria-hidden', 'true'),
|
|
71
|
+
(b.style.position = 'absolute'),
|
|
72
|
+
(b.style.width = 0),
|
|
73
|
+
(b.style.height = 0),
|
|
74
|
+
(b.style.overflow = 'hidden'),
|
|
75
|
+
c.insertBefore(b, c.firstChild);
|
|
76
|
+
d();
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function n(a) {
|
|
80
|
+
return function () {
|
|
81
|
+
a.onerror = null;
|
|
82
|
+
a.ontimeout = null;
|
|
83
|
+
d();
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
var a,
|
|
87
|
+
c,
|
|
88
|
+
q = 0;
|
|
89
|
+
m();
|
|
90
|
+
var f = document.getElementsByTagName('use');
|
|
91
|
+
for (c = 0; c < f.length; c += 1) {
|
|
92
|
+
try {
|
|
93
|
+
var g = f[c].getBoundingClientRect();
|
|
94
|
+
} catch (w) {
|
|
95
|
+
g = !1;
|
|
96
|
+
}
|
|
97
|
+
var h =
|
|
98
|
+
(a =
|
|
99
|
+
f[c].getAttribute('href') ||
|
|
100
|
+
f[c].getAttributeNS('http://www.w3.org/1999/xlink', 'href') ||
|
|
101
|
+
f[c].getAttribute('href')) && a.split
|
|
102
|
+
? a.split('#')
|
|
103
|
+
: ['', ''];
|
|
104
|
+
var b = h[0];
|
|
105
|
+
h = h[1];
|
|
106
|
+
var r = g && 0 === g.left && 0 === g.right && 0 === g.top && 0 === g.bottom;
|
|
107
|
+
g && 0 === g.width && 0 === g.height && !r
|
|
108
|
+
? (f[c].hasAttribute('href') && f[c].setAttributeNS('http://www.w3.org/1999/xlink', 'href', a),
|
|
109
|
+
b.length &&
|
|
110
|
+
((a = e[b]),
|
|
111
|
+
!0 !== a && setTimeout(l({ useEl: f[c], base: b, hash: h }), 0),
|
|
112
|
+
void 0 === a &&
|
|
113
|
+
((h = u(b)),
|
|
114
|
+
void 0 !== h &&
|
|
115
|
+
((a = new h()),
|
|
116
|
+
(e[b] = a),
|
|
117
|
+
(a.onload = p(a)),
|
|
118
|
+
(a.onerror = n(a)),
|
|
119
|
+
(a.ontimeout = n(a)),
|
|
120
|
+
a.open('GET', b),
|
|
121
|
+
a.send(),
|
|
122
|
+
(q += 1)))))
|
|
123
|
+
: r
|
|
124
|
+
? b.length && e[b] && setTimeout(l({ useEl: f[c], base: b, hash: h }), 0)
|
|
125
|
+
: void 0 === e[b]
|
|
126
|
+
? (e[b] = !0)
|
|
127
|
+
: e[b].onload && (e[b].abort(), delete e[b].onload, (e[b] = !0));
|
|
128
|
+
}
|
|
129
|
+
f = '';
|
|
130
|
+
q += 1;
|
|
131
|
+
d();
|
|
132
|
+
};
|
|
133
|
+
var p = function () {
|
|
134
|
+
window.removeEventListener('load', p, !1);
|
|
135
|
+
l = setTimeout(n, 0);
|
|
136
|
+
};
|
|
137
|
+
'complete' !== document.readyState ? window.addEventListener('load', p, !1) : p();
|
|
138
|
+
}
|
|
139
|
+
})();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const tables = document.querySelectorAll('.ontario-table-div');
|
|
2
|
+
const scrollerDiv = document.querySelectorAll('.ontario-table-scroll--div');
|
|
3
|
+
const scrollerWrapper = document.querySelectorAll('.ontario-table-scroll--wrapper');
|
|
4
|
+
let ro = new ResizeObserver((entries) => {
|
|
5
|
+
tables.forEach((element, index) => {
|
|
6
|
+
applyScrollbar(index);
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
tables.forEach((element, index) => {
|
|
11
|
+
applyScrollbar(index);
|
|
12
|
+
ro.observe(document.querySelectorAll('table')[index]);
|
|
13
|
+
|
|
14
|
+
tables[index].addEventListener('scroll', (event) => {
|
|
15
|
+
applyScrollbar(index);
|
|
16
|
+
|
|
17
|
+
scrollerWrapper[index].scrollLeft = tables[index].scrollLeft;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
scrollerWrapper[index].addEventListener('scroll', (event) => {
|
|
21
|
+
applyScrollbar(index);
|
|
22
|
+
|
|
23
|
+
tables[index].scrollLeft = scrollerWrapper[index].scrollLeft;
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
function applyScrollbar(index) {
|
|
28
|
+
scrollerDiv[index].style.visibility = 'visible';
|
|
29
|
+
scrollerDiv[index].style.height = '20px';
|
|
30
|
+
scrollerDiv[index].style.width = `${tables[index].scrollWidth}px`;
|
|
31
|
+
}
|