@uoguelph/web-components 0.0.17 → 0.0.18

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 (41) hide show
  1. package/dist/cjs/{index-c68ebbb8.js → index-52617c57.js} +7 -1
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/{uofg-back-to-top_4.cjs.entry.js → uofg-alert_6.cjs.entry.js} +161 -41
  4. package/dist/cjs/uofg-web-components.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +3 -1
  6. package/dist/collection/components/uofg-alert/uofg-alert.css +46 -0
  7. package/dist/collection/components/uofg-alert/uofg-alert.js +20 -0
  8. package/dist/collection/components/uofg-menu/uofg-menu.js +28 -50
  9. package/dist/collection/components/uofg-modal/uofg-modal.css +80 -0
  10. package/dist/collection/components/uofg-modal/uofg-modal.js +325 -0
  11. package/dist/collection/utils/utils.js +6 -0
  12. package/dist/components/font-awesome-icon.js +10 -0
  13. package/dist/components/index.d.ts +4 -0
  14. package/dist/components/index.js +2 -0
  15. package/dist/components/index2.js +7 -10
  16. package/dist/components/uofg-alert.d.ts +11 -0
  17. package/dist/components/uofg-alert.js +40 -0
  18. package/dist/components/uofg-back-to-top.js +2 -1
  19. package/dist/components/uofg-footer.js +2 -1
  20. package/dist/components/uofg-header.js +2 -1
  21. package/dist/components/uofg-menu2.js +31 -46
  22. package/dist/components/uofg-modal.d.ts +11 -0
  23. package/dist/components/uofg-modal.js +139 -0
  24. package/dist/components/utils.js +8 -0
  25. package/dist/esm/{index-8ff56dd3.js → index-ebf79156.js} +7 -1
  26. package/dist/esm/loader.js +3 -3
  27. package/dist/esm/{uofg-back-to-top_4.entry.js → uofg-alert_6.entry.js} +160 -42
  28. package/dist/esm/uofg-web-components.js +3 -3
  29. package/dist/types/components/uofg-alert/uofg-alert.d.ts +3 -0
  30. package/dist/types/components/uofg-menu/uofg-menu.d.ts +4 -4
  31. package/dist/types/components/uofg-modal/uofg-modal.d.ts +61 -0
  32. package/dist/types/components.d.ts +91 -0
  33. package/dist/types/utils/{feature-check.d.ts → utils.d.ts} +1 -0
  34. package/dist/uofg-web-components/p-2c75433c.entry.js +1 -0
  35. package/dist/uofg-web-components/p-bc82feb9.js +2 -0
  36. package/dist/uofg-web-components/uofg-web-components.css +1 -1
  37. package/dist/uofg-web-components/uofg-web-components.esm.js +1 -1
  38. package/package.json +2 -2
  39. package/dist/collection/utils/feature-check.js +0 -2
  40. package/dist/uofg-web-components/p-19e62111.js +0 -2
  41. package/dist/uofg-web-components/p-f8060888.entry.js +0 -1
@@ -0,0 +1,325 @@
1
+ import { h } from "@stencil/core";
2
+ import { FontAwesomeIcon } from "../../utils/font-awesome-icon";
3
+ import { faTimes } from "@fortawesome/pro-solid-svg-icons";
4
+ import { getAllFocusableElements } from "../../utils/utils";
5
+ export class UofgModal {
6
+ constructor() {
7
+ this.label = undefined;
8
+ this.alertDialog = false;
9
+ this.centered = false;
10
+ this.staticBackdrop = false;
11
+ this.autoOpen = false;
12
+ this.isOpen = false;
13
+ }
14
+ connectedCallback() {
15
+ // Bind event handlers so that 'this' is always the component instance.
16
+ this.handleClick = this.handleClick.bind(this);
17
+ this.handleKeyUp = this.handleKeyUp.bind(this);
18
+ this.handleKeyDown = this.handleKeyDown.bind(this);
19
+ if (this.autoOpen) {
20
+ this.isOpen = true;
21
+ }
22
+ }
23
+ handleClick(e) {
24
+ if (!this.staticBackdrop && e.target === e.currentTarget) {
25
+ this.isOpen = false;
26
+ }
27
+ }
28
+ handleKeyUp(e) {
29
+ if (e.key === 'Escape') {
30
+ this.isOpen = false;
31
+ }
32
+ }
33
+ handleKeyDown(e) {
34
+ if (e.key === 'Tab') {
35
+ const focusableElements = getAllFocusableElements(this.el);
36
+ const firstFocusable = this.dismissButton; // The dismiss button is always the first focusable element in the modal.
37
+ const lastFocusable = focusableElements[focusableElements.length - 1];
38
+ if (e.target === firstFocusable && e.shiftKey) {
39
+ e.preventDefault();
40
+ lastFocusable === null || lastFocusable === void 0 ? void 0 : lastFocusable.focus();
41
+ }
42
+ else if (e.target === lastFocusable && !e.shiftKey) {
43
+ e.preventDefault();
44
+ firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
45
+ }
46
+ }
47
+ }
48
+ handleIsOpenChange(newValue) {
49
+ if (newValue === true) {
50
+ window.requestAnimationFrame(() => {
51
+ window.requestAnimationFrame(() => {
52
+ window.requestAnimationFrame(() => {
53
+ this.dismissButton.focus();
54
+ });
55
+ });
56
+ });
57
+ }
58
+ }
59
+ render() {
60
+ return (h("div", { id: "uofg-modal", class: { open: this.isOpen }, role: this.isOpen ? (this.alertDialog ? 'alertdialog' : 'dialog') : '', "aria-modal": this.isOpen, "aria-label": this.label, "aria-hidden": !this.isOpen, tabIndex: -1, onClick: this.handleClick, onKeyUp: this.handleKeyUp, onKeyDown: this.handleKeyDown }, h("div", { id: "uofg-modal-content", class: { centered: this.centered } }, h("button", { id: "uofg-modal-dismiss", "aria-label": "Close modal", ref: (el) => (this.dismissButton = el), onClick: () => (this.isOpen = false) }, h(FontAwesomeIcon, { icon: faTimes })), h("slot", null))));
61
+ }
62
+ /**
63
+ * Get the current state of the modal.
64
+ * @returns A promise which will resolve to true when the modal is open, or false when the modal is closed.
65
+ */
66
+ async getState() {
67
+ return this.isOpen;
68
+ }
69
+ /**
70
+ * Set the state of the modal.
71
+ * @param value The new state, set it to true to open the modal, or false to close the modal.
72
+ */
73
+ async setState(value) {
74
+ this.isOpen = value;
75
+ }
76
+ /**
77
+ * Toggle the state of the modal.
78
+ * @returns A promise which will resolve to true (if the modal opened) or false (if the modal closed).
79
+ */
80
+ async toggle() {
81
+ this.isOpen = !this.isOpen;
82
+ return this.isOpen;
83
+ }
84
+ /**
85
+ * Closes the modal.
86
+ * @returns empty Promise.
87
+ */
88
+ async close() {
89
+ this.isOpen = false;
90
+ }
91
+ /**
92
+ * Opens the modal.
93
+ * @returns empty Promise.
94
+ */
95
+ async open() {
96
+ this.isOpen = true;
97
+ }
98
+ static get is() { return "uofg-modal"; }
99
+ static get encapsulation() { return "shadow"; }
100
+ static get originalStyleUrls() {
101
+ return {
102
+ "$": ["uofg-modal.scss"]
103
+ };
104
+ }
105
+ static get styleUrls() {
106
+ return {
107
+ "$": ["uofg-modal.css"]
108
+ };
109
+ }
110
+ static get properties() {
111
+ return {
112
+ "label": {
113
+ "type": "string",
114
+ "mutable": false,
115
+ "complexType": {
116
+ "original": "string",
117
+ "resolved": "string",
118
+ "references": {}
119
+ },
120
+ "required": false,
121
+ "optional": false,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": "The label for the modal. It is recommended that you set this to describe the modal's content.\nThis is required for accessibility."
125
+ },
126
+ "attribute": "label",
127
+ "reflect": false
128
+ },
129
+ "alertDialog": {
130
+ "type": "boolean",
131
+ "mutable": false,
132
+ "complexType": {
133
+ "original": "boolean",
134
+ "resolved": "boolean",
135
+ "references": {}
136
+ },
137
+ "required": false,
138
+ "optional": false,
139
+ "docs": {
140
+ "tags": [],
141
+ "text": "Used to determine whether the modal should be rendered as an alert dialog.\nThis is useful for when you want to use the modal to alert the user of something, rather than to ask the user to make a decision.\nIf this is set to true, the modal will be rendered with a role of \"alertdialog\" instead of \"dialog\"."
142
+ },
143
+ "attribute": "alert-dialog",
144
+ "reflect": false,
145
+ "defaultValue": "false"
146
+ },
147
+ "centered": {
148
+ "type": "boolean",
149
+ "mutable": false,
150
+ "complexType": {
151
+ "original": "boolean",
152
+ "resolved": "boolean",
153
+ "references": {}
154
+ },
155
+ "required": false,
156
+ "optional": false,
157
+ "docs": {
158
+ "tags": [],
159
+ "text": "Used to determine whether the modal content is centered vertically."
160
+ },
161
+ "attribute": "centered",
162
+ "reflect": false,
163
+ "defaultValue": "false"
164
+ },
165
+ "staticBackdrop": {
166
+ "type": "boolean",
167
+ "mutable": false,
168
+ "complexType": {
169
+ "original": "boolean",
170
+ "resolved": "boolean",
171
+ "references": {}
172
+ },
173
+ "required": false,
174
+ "optional": false,
175
+ "docs": {
176
+ "tags": [],
177
+ "text": "Used to determine whether clicking on the backdrop of the modal will close the modal.\nIf this is set to true, clicking on the backdrop will NOT close the modal."
178
+ },
179
+ "attribute": "static-backdrop",
180
+ "reflect": false,
181
+ "defaultValue": "false"
182
+ },
183
+ "autoOpen": {
184
+ "type": "boolean",
185
+ "mutable": false,
186
+ "complexType": {
187
+ "original": "boolean",
188
+ "resolved": "boolean",
189
+ "references": {}
190
+ },
191
+ "required": false,
192
+ "optional": false,
193
+ "docs": {
194
+ "tags": [],
195
+ "text": "Used to determine whether the modal should open automatically when the component is first rendered.\nIt is important to ensure this is only set to true for ONE modal on the page."
196
+ },
197
+ "attribute": "auto-open",
198
+ "reflect": false,
199
+ "defaultValue": "false"
200
+ }
201
+ };
202
+ }
203
+ static get states() {
204
+ return {
205
+ "isOpen": {}
206
+ };
207
+ }
208
+ static get methods() {
209
+ return {
210
+ "getState": {
211
+ "complexType": {
212
+ "signature": "() => Promise<boolean>",
213
+ "parameters": [],
214
+ "references": {
215
+ "Promise": {
216
+ "location": "global",
217
+ "id": "global::Promise"
218
+ }
219
+ },
220
+ "return": "Promise<boolean>"
221
+ },
222
+ "docs": {
223
+ "text": "Get the current state of the modal.",
224
+ "tags": [{
225
+ "name": "returns",
226
+ "text": "A promise which will resolve to true when the modal is open, or false when the modal is closed."
227
+ }]
228
+ }
229
+ },
230
+ "setState": {
231
+ "complexType": {
232
+ "signature": "(value: boolean) => Promise<void>",
233
+ "parameters": [{
234
+ "tags": [{
235
+ "name": "param",
236
+ "text": "value The new state, set it to true to open the modal, or false to close the modal."
237
+ }],
238
+ "text": "The new state, set it to true to open the modal, or false to close the modal."
239
+ }],
240
+ "references": {
241
+ "Promise": {
242
+ "location": "global",
243
+ "id": "global::Promise"
244
+ }
245
+ },
246
+ "return": "Promise<void>"
247
+ },
248
+ "docs": {
249
+ "text": "Set the state of the modal.",
250
+ "tags": [{
251
+ "name": "param",
252
+ "text": "value The new state, set it to true to open the modal, or false to close the modal."
253
+ }]
254
+ }
255
+ },
256
+ "toggle": {
257
+ "complexType": {
258
+ "signature": "() => Promise<boolean>",
259
+ "parameters": [],
260
+ "references": {
261
+ "Promise": {
262
+ "location": "global",
263
+ "id": "global::Promise"
264
+ }
265
+ },
266
+ "return": "Promise<boolean>"
267
+ },
268
+ "docs": {
269
+ "text": "Toggle the state of the modal.",
270
+ "tags": [{
271
+ "name": "returns",
272
+ "text": "A promise which will resolve to true (if the modal opened) or false (if the modal closed)."
273
+ }]
274
+ }
275
+ },
276
+ "close": {
277
+ "complexType": {
278
+ "signature": "() => Promise<void>",
279
+ "parameters": [],
280
+ "references": {
281
+ "Promise": {
282
+ "location": "global",
283
+ "id": "global::Promise"
284
+ }
285
+ },
286
+ "return": "Promise<void>"
287
+ },
288
+ "docs": {
289
+ "text": "Closes the modal.",
290
+ "tags": [{
291
+ "name": "returns",
292
+ "text": "empty Promise."
293
+ }]
294
+ }
295
+ },
296
+ "open": {
297
+ "complexType": {
298
+ "signature": "() => Promise<void>",
299
+ "parameters": [],
300
+ "references": {
301
+ "Promise": {
302
+ "location": "global",
303
+ "id": "global::Promise"
304
+ }
305
+ },
306
+ "return": "Promise<void>"
307
+ },
308
+ "docs": {
309
+ "text": "Opens the modal.",
310
+ "tags": [{
311
+ "name": "returns",
312
+ "text": "empty Promise."
313
+ }]
314
+ }
315
+ }
316
+ };
317
+ }
318
+ static get elementRef() { return "el"; }
319
+ static get watchers() {
320
+ return [{
321
+ "propName": "isOpen",
322
+ "methodName": "handleIsOpenChange"
323
+ }];
324
+ }
325
+ }
@@ -0,0 +1,6 @@
1
+ export const WEB_ANIMATIONS_SUPPORTED = 'animate' in HTMLElement.prototype;
2
+ export const PREFERS_REDUCED_MOTION = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
3
+ export const getAllFocusableElements = (container) => {
4
+ const query = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [contenteditable], audio[controls], video[controls], details, summary, [tabindex]:not([tabindex="-1"])';
5
+ return Array.from(container.querySelectorAll(query));
6
+ };
@@ -0,0 +1,10 @@
1
+ import { h } from '@stencil/core/internal/client';
2
+
3
+ const FontAwesomeIcon = props => {
4
+ const width = props.icon.icon[0];
5
+ const height = props.icon.icon[1];
6
+ const iconPathData = props.icon.icon[4];
7
+ return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}` }, Array.isArray(iconPathData) ? (iconPathData.map(path => h("path", { d: path }))) : (h("path", { d: iconPathData }))));
8
+ };
9
+
10
+ export { FontAwesomeIcon as F };
@@ -1,4 +1,6 @@
1
1
  /* UofgWebComponents custom elements */
2
+ export { UofgAlert as UofgAlert } from '../types/components/uofg-alert/uofg-alert';
3
+ export { defineCustomElement as defineCustomElementUofgAlert } from './uofg-alert';
2
4
  export { UofgBackToTop as UofgBackToTop } from '../types/components/uofg-back-to-top/uofg-back-to-top';
3
5
  export { defineCustomElement as defineCustomElementUofgBackToTop } from './uofg-back-to-top';
4
6
  export { UofgFooter as UofgFooter } from '../types/components/uofg-footer/uofg-footer';
@@ -7,6 +9,8 @@ export { UofgHeader as UofgHeader } from '../types/components/uofg-header/uofg-h
7
9
  export { defineCustomElement as defineCustomElementUofgHeader } from './uofg-header';
8
10
  export { UofgMenu as UofgMenu } from '../types/components/uofg-menu/uofg-menu';
9
11
  export { defineCustomElement as defineCustomElementUofgMenu } from './uofg-menu';
12
+ export { UofgModal as UofgModal } from '../types/components/uofg-modal/uofg-modal';
13
+ export { defineCustomElement as defineCustomElementUofgModal } from './uofg-modal';
10
14
 
11
15
  /**
12
16
  * Used to manually set the base path where assets can be found.
@@ -1,5 +1,7 @@
1
1
  export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
2
+ export { UofgAlert, defineCustomElement as defineCustomElementUofgAlert } from './uofg-alert.js';
2
3
  export { UofgBackToTop, defineCustomElement as defineCustomElementUofgBackToTop } from './uofg-back-to-top.js';
3
4
  export { UofgFooter, defineCustomElement as defineCustomElementUofgFooter } from './uofg-footer.js';
4
5
  export { UofgHeader, defineCustomElement as defineCustomElementUofgHeader } from './uofg-header.js';
5
6
  export { UofgMenu, defineCustomElement as defineCustomElementUofgMenu } from './uofg-menu.js';
7
+ export { UofgModal, defineCustomElement as defineCustomElementUofgModal } from './uofg-modal.js';
@@ -1,12 +1,3 @@
1
- import { h } from '@stencil/core/internal/client';
2
-
3
- const FontAwesomeIcon = props => {
4
- const width = props.icon.icon[0];
5
- const height = props.icon.icon[1];
6
- const iconPathData = props.icon.icon[4];
7
- return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}` }, Array.isArray(iconPathData) ? (iconPathData.map(path => h("path", { d: path }))) : (h("path", { d: iconPathData }))));
8
- };
9
-
10
1
  var faTrees = {
11
2
  prefix: 'fas',
12
3
  iconName: 'trees',
@@ -78,10 +69,16 @@ var faMagnifyingGlass = {
78
69
  icon: [512, 512, [128269, "search"], "f002", "M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"]
79
70
  };
80
71
  var faSearch = faMagnifyingGlass;
72
+ var faXmark = {
73
+ prefix: 'fas',
74
+ iconName: 'xmark',
75
+ icon: [384, 512, [128473, 10005, 10006, 10060, 215, "close", "multiply", "remove", "times"], "f00d", "M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"]
76
+ };
77
+ var faTimes = faXmark;
81
78
  var faBriefcase = {
82
79
  prefix: 'fas',
83
80
  iconName: 'briefcase',
84
81
  icon: [512, 512, [128188], "f0b1", "M184 48H328c4.4 0 8 3.6 8 8V96H176V56c0-4.4 3.6-8 8-8zm-56 8V96H64C28.7 96 0 124.7 0 160v96H192 320 512V160c0-35.3-28.7-64-64-64H384V56c0-30.9-25.1-56-56-56H184c-30.9 0-56 25.1-56 56zM512 288H320v32c0 17.7-14.3 32-32 32H224c-17.7 0-32-14.3-32-32V288H0V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V288z"]
85
82
  };
86
83
 
87
- export { FontAwesomeIcon as F, faUniversalAccess as a, faKey as b, faSitemap as c, faCircleCheck as d, faTrees as e, faChevronUp as f, faBriefcase as g, faCalendarRange as h, faList as i, faHandHoldingHeart as j, faPhoneFlip as k, faCaretDown as l, faSearch as m, faRightToBracket as n, faBars as o };
84
+ export { faUniversalAccess as a, faKey as b, faSitemap as c, faCircleCheck as d, faTrees as e, faChevronUp as f, faBriefcase as g, faCalendarRange as h, faList as i, faHandHoldingHeart as j, faPhoneFlip as k, faCaretDown as l, faSearch as m, faRightToBracket as n, faBars as o, faTimes as p };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface UofgAlert extends Components.UofgAlert, HTMLElement {}
4
+ export const UofgAlert: {
5
+ prototype: UofgAlert;
6
+ new (): UofgAlert;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,40 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+ import { F as FontAwesomeIcon } from './font-awesome-icon.js';
3
+
4
+ var faCircleExclamation = {
5
+ prefix: 'far',
6
+ iconName: 'circle-exclamation',
7
+ icon: [512, 512, ["exclamation-circle"], "f06a", "M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c-13.3 0-24 10.7-24 24V264c0 13.3 10.7 24 24 24s24-10.7 24-24V152c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"]
8
+ };
9
+
10
+ const uofgAlertCss = ":host{display:block}*{box-sizing:border-box}#uofg-alert{display:flex;flex-direction:column;font-size:2rem}#uofg-alert #uofg-alert-title{display:flex;align-items:center;font-size:2.25rem;padding:2rem;color:white;background-color:#C10631}#uofg-alert #uofg-alert-title>svg{margin-right:1rem;fill:currentColor;height:1.5em}#uofg-alert #uofg-alert-body{display:flex;flex-direction:column;padding:1.5rem 2rem;background-color:white}#uofg-alert #uofg-alert-body slot[name=subtitle]::slotted(*){font-size:2rem;margin-bottom:2rem;font-weight:bold}#uofg-alert #uofg-alert-body slot[name=message]::slotted(*){font-size:1.6rem}#uofg-alert #uofg-alert-footer{display:flex;padding:1rem 2rem;background-color:#DDDDDD;font-size:1.4rem}";
11
+
12
+ const UofgAlert$1 = /*@__PURE__*/ proxyCustomElement(class UofgAlert extends HTMLElement {
13
+ constructor() {
14
+ super();
15
+ this.__registerHost();
16
+ this.__attachShadow();
17
+ }
18
+ render() {
19
+ return (h("div", { id: "uofg-alert" }, h("div", { id: "uofg-alert-title" }, h(FontAwesomeIcon, { icon: faCircleExclamation }), h("slot", { name: "title" })), h("div", { id: "uofg-alert-body" }, h("slot", { name: "subtitle" }), h("slot", { name: "message" })), h("div", { id: "uofg-alert-footer" }, h("slot", { name: "footer" }))));
20
+ }
21
+ static get style() { return uofgAlertCss; }
22
+ }, [1, "uofg-alert"]);
23
+ function defineCustomElement$1() {
24
+ if (typeof customElements === "undefined") {
25
+ return;
26
+ }
27
+ const components = ["uofg-alert"];
28
+ components.forEach(tagName => { switch (tagName) {
29
+ case "uofg-alert":
30
+ if (!customElements.get(tagName)) {
31
+ customElements.define(tagName, UofgAlert$1);
32
+ }
33
+ break;
34
+ } });
35
+ }
36
+
37
+ const UofgAlert = UofgAlert$1;
38
+ const defineCustomElement = defineCustomElement$1;
39
+
40
+ export { UofgAlert, defineCustomElement };
@@ -1,5 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { F as FontAwesomeIcon, f as faChevronUp } from './index2.js';
2
+ import { F as FontAwesomeIcon } from './font-awesome-icon.js';
3
+ import { f as faChevronUp } from './index2.js';
3
4
 
4
5
  const uofgBackToTopCss = ":host{display:block}:focus-visible{outline:2px solid #ffc72a;outline-offset:0.5rem}#uofg-back-to-top{position:fixed;margin:10px;height:35px;width:35px;right:0;bottom:0;z-index:1000;cursor:pointer;background-color:black;color:white;transition-duration:0.3s;transition-timing-function:ease-in-out;transition-property:opacity, visibility, background-color;opacity:0;visibility:hidden;border-radius:50%;border:1px solid #fff}#uofg-back-to-top:hover{background-color:#d50029}#uofg-back-to-top>svg{width:1em;height:1em;fill:currentColor}#uofg-back-to-top.visible{opacity:1;visibility:visible}";
5
6
 
@@ -1,5 +1,6 @@
1
1
  import { h, proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
2
- import { F as FontAwesomeIcon, a as faUniversalAccess, b as faKey, c as faSitemap, d as faCircleCheck, e as faTrees, g as faBriefcase, h as faCalendarRange, i as faList, j as faHandHoldingHeart, k as faPhoneFlip } from './index2.js';
2
+ import { F as FontAwesomeIcon } from './font-awesome-icon.js';
3
+ import { a as faUniversalAccess, b as faKey, c as faSitemap, d as faCircleCheck, e as faTrees, g as faBriefcase, h as faCalendarRange, i as faList, j as faHandHoldingHeart, k as faPhoneFlip } from './index2.js';
3
4
 
4
5
  var faSquareTwitter = {
5
6
  prefix: 'fab',
@@ -1,5 +1,6 @@
1
1
  import { h, proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
2
- import { F as FontAwesomeIcon, l as faCaretDown, m as faSearch, n as faRightToBracket, o as faBars } from './index2.js';
2
+ import { F as FontAwesomeIcon } from './font-awesome-icon.js';
3
+ import { l as faCaretDown, m as faSearch, n as faRightToBracket, o as faBars } from './index2.js';
3
4
  import { d as defineCustomElement$2 } from './uofg-menu2.js';
4
5
 
5
6
  const PageSpecific = props => {
@@ -1,19 +1,9 @@
1
- import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h, Host } from '@stencil/core/internal/client';
2
-
3
- const WEB_ANIMATIONS_SUPPORTED = 'animate' in HTMLElement.prototype;
4
- const PREFERS_REDUCED_MOTION = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { W as WEB_ANIMATIONS_SUPPORTED, P as PREFERS_REDUCED_MOTION } from './utils.js';
5
3
 
6
4
  const DURATION_REGEX = /^(\d*\.?\d+)(s|ms)$/;
7
5
  const EASING_FUNCTION_REGEX = /^cubic-bezier\((\s*-?\d*\.?\d+\s*,){3}\s*-?\d*\.?\d+\s*\)$|^steps\(\s*\d+\s*(,\s*(start|end))?\s*\)$/;
8
- const observer = new MutationObserver(mutations => {
9
- for (const mutation of mutations) {
10
- mutation.target.dispatchEvent(new CustomEvent('childListChange', { bubbles: false }));
11
- }
12
- });
13
- const observerConfig = {
14
- childList: true,
15
- };
16
- const UofgMenu = /*@__PURE__*/ proxyCustomElement(class UofgMenu extends HTMLElement$1 {
6
+ const UofgMenu = /*@__PURE__*/ proxyCustomElement(class UofgMenu extends HTMLElement {
17
7
  constructor() {
18
8
  super();
19
9
  this.__registerHost();
@@ -25,50 +15,31 @@ const UofgMenu = /*@__PURE__*/ proxyCustomElement(class UofgMenu extends HTMLEle
25
15
  this.button = null;
26
16
  this.content = null;
27
17
  this.contentComputedStyle = null;
18
+ this.observer = new MutationObserver(this.handleMutation);
28
19
  this.isExpanded = false;
29
20
  this.autoCollapse = false;
30
21
  }
31
22
  connectedCallback() {
32
23
  // Bind functions so that "this" correctly refers to the component's instance.
33
- this.handleChildListChange = this.handleChildListChange.bind(this);
34
- this.updateButton = this.updateButton.bind(this);
35
- this.updateContent = this.updateContent.bind(this);
36
- this.handleButtonClick = this.handleButtonClick.bind(this);
24
+ this.handleMutation = this.handleMutation.bind(this);
25
+ this.handleClick = this.handleClick.bind(this);
37
26
  this.handleFocusout = this.handleFocusout.bind(this);
38
27
  this.handleKeyUp = this.handleKeyUp.bind(this);
39
28
  this.computedStyle = window.getComputedStyle(this.el);
40
- this.isExpanded = false;
41
- this.handleChildListChange();
42
- observer.observe(this.el, observerConfig);
43
- }
44
- handleChildListChange() {
45
- this.updateButton();
46
- this.updateContent();
29
+ this.handleMutation();
30
+ this.observer.observe(this.el, { childList: true });
47
31
  }
48
- handleKeyUp(e) {
49
- if (e.key === 'Escape') {
50
- this.isExpanded = false;
51
- if (e.target !== this.button) {
52
- e.stopPropagation();
53
- this.isExpanded = false;
54
- this.button && this.button.focus();
55
- }
56
- }
32
+ disconnectedCallback() {
33
+ this.observer.disconnect();
57
34
  }
58
- updateButton() {
59
- var _a, _b, _c;
35
+ handleMutation() {
36
+ // Update the button element
60
37
  const button = this.el.querySelector('[slot="button"]');
61
- // Clean up the old button before setting the new one
62
- (_a = this.button) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', this.handleButtonClick);
63
- (_b = this.button) === null || _b === void 0 ? void 0 : _b.removeAttribute('aria-expanded');
64
- (_c = this.button) === null || _c === void 0 ? void 0 : _c.removeAttribute('aria-haspopup');
65
38
  // Set up the new button
66
39
  button === null || button === void 0 ? void 0 : button.setAttribute('aria-expanded', this.isExpanded ? 'true' : 'false');
67
40
  button === null || button === void 0 ? void 0 : button.setAttribute('aria-haspopup', 'true');
68
- button === null || button === void 0 ? void 0 : button.addEventListener('click', this.handleButtonClick);
69
41
  this.button = button;
70
- }
71
- updateContent() {
42
+ // Update the content element
72
43
  const content = this.el.querySelector('[slot="content"]');
73
44
  if (content == null) {
74
45
  this.content = null;
@@ -80,8 +51,22 @@ const UofgMenu = /*@__PURE__*/ proxyCustomElement(class UofgMenu extends HTMLEle
80
51
  this.contentComputedStyle = window.getComputedStyle(this.content);
81
52
  }
82
53
  }
83
- handleButtonClick() {
84
- this.isExpanded = !this.isExpanded;
54
+ handleKeyUp(e) {
55
+ if (e.key === 'Escape') {
56
+ this.isExpanded = false;
57
+ if (e.target !== this.button) {
58
+ e.stopPropagation();
59
+ this.isExpanded = false;
60
+ this.button && this.button.focus();
61
+ }
62
+ }
63
+ }
64
+ handleClick(e) {
65
+ //Check if the click was on the button or a descendant of the button
66
+ if (this.button && this.button.contains(e.target)) {
67
+ this.isExpanded = !this.isExpanded;
68
+ return;
69
+ }
85
70
  }
86
71
  handleFocusout(e) {
87
72
  if (this.autoCollapse && !this.el.contains(e.relatedTarget)) {
@@ -207,7 +192,7 @@ const UofgMenu = /*@__PURE__*/ proxyCustomElement(class UofgMenu extends HTMLEle
207
192
  };
208
193
  }
209
194
  render() {
210
- return (h(Host, { tabindex: -1, "data-expanded": this.isExpanded, onFocusout: this.handleFocusout, onKeyUp: this.handleKeyUp }));
195
+ return (h(Host, { "data-expanded": this.isExpanded, tabindex: -1, onFocusout: this.handleFocusout, onKeyUp: this.handleKeyUp, onClick: this.handleClick }));
211
196
  }
212
197
  /**
213
198
  * Get the current expanded state of the menu.
@@ -257,7 +242,7 @@ const UofgMenu = /*@__PURE__*/ proxyCustomElement(class UofgMenu extends HTMLEle
257
242
  "toggle": [64],
258
243
  "collapse": [64],
259
244
  "expand": [64]
260
- }, [[0, "onChildListChange", "handleChildListChange"]]]);
245
+ }]);
261
246
  function defineCustomElement() {
262
247
  if (typeof customElements === "undefined") {
263
248
  return;
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface UofgModal extends Components.UofgModal, HTMLElement {}
4
+ export const UofgModal: {
5
+ prototype: UofgModal;
6
+ new (): UofgModal;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;