@uoguelph/web-components 1.2.0-rc.7 → 1.2.0-rc.9

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 (94) hide show
  1. package/README.md +0 -63
  2. package/dist/uofg-web-components/index-CSn7dBx6.js +981 -0
  3. package/dist/uofg-web-components/uofg-alert.esm.js +154 -0
  4. package/dist/uofg-web-components/uofg-footer.esm.js +403 -0
  5. package/dist/uofg-web-components/uofg-header.esm.js +2306 -0
  6. package/dist/uofg-web-components/uofg-modal.esm.js +329 -0
  7. package/dist/uofg-web-components/uofg-web-components.css +1 -1
  8. package/dist/uofg-web-components/uofg-web-components.esm.js +8 -1
  9. package/package.json +21 -33
  10. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  11. package/dist/cjs/index-eb919017.js +0 -1990
  12. package/dist/cjs/index.cjs.js +0 -2
  13. package/dist/cjs/loader.cjs.js +0 -15
  14. package/dist/cjs/uofg-alert.cjs.entry.js +0 -21
  15. package/dist/cjs/uofg-back-to-top_5.cjs.entry.js +0 -1400
  16. package/dist/cjs/uofg-modal.cjs.entry.js +0 -168
  17. package/dist/cjs/uofg-web-components.cjs.js +0 -25
  18. package/dist/cjs/utils-93383c5b.js +0 -65
  19. package/dist/collection/collection-manifest.json +0 -18
  20. package/dist/collection/components/uofg-alert/uofg-alert.js +0 -15
  21. package/dist/collection/components/uofg-back-to-top/uofg-back-to-top.js +0 -64
  22. package/dist/collection/components/uofg-card/uofg-card.js +0 -40
  23. package/dist/collection/components/uofg-footer/uofg-footer.js +0 -145
  24. package/dist/collection/components/uofg-header/uofg-header.js +0 -280
  25. package/dist/collection/components/uofg-menu/uofg-menu.js +0 -438
  26. package/dist/collection/components/uofg-modal/uofg-modal.js +0 -408
  27. package/dist/collection/index.js +0 -1
  28. package/dist/collection/utils/font-awesome-icon.js +0 -7
  29. package/dist/collection/utils/utils.js +0 -29
  30. package/dist/components/font-awesome-icon.js +0 -10
  31. package/dist/components/index.d.ts +0 -50
  32. package/dist/components/index.js +0 -8
  33. package/dist/components/index2.js +0 -18
  34. package/dist/components/uofg-alert.d.ts +0 -11
  35. package/dist/components/uofg-alert.js +0 -37
  36. package/dist/components/uofg-back-to-top.d.ts +0 -11
  37. package/dist/components/uofg-back-to-top.js +0 -51
  38. package/dist/components/uofg-card.d.ts +0 -11
  39. package/dist/components/uofg-card.js +0 -41
  40. package/dist/components/uofg-footer.d.ts +0 -11
  41. package/dist/components/uofg-footer.js +0 -749
  42. package/dist/components/uofg-header.d.ts +0 -11
  43. package/dist/components/uofg-header.js +0 -418
  44. package/dist/components/uofg-menu.d.ts +0 -11
  45. package/dist/components/uofg-menu.js +0 -6
  46. package/dist/components/uofg-menu2.js +0 -268
  47. package/dist/components/uofg-modal.d.ts +0 -11
  48. package/dist/components/uofg-modal.js +0 -198
  49. package/dist/components/utils.js +0 -30
  50. package/dist/esm/app-globals-0f993ce5.js +0 -3
  51. package/dist/esm/index-06ec28fa.js +0 -1960
  52. package/dist/esm/index.js +0 -1
  53. package/dist/esm/loader.js +0 -11
  54. package/dist/esm/polyfills/core-js.js +0 -11
  55. package/dist/esm/polyfills/dom.js +0 -79
  56. package/dist/esm/polyfills/es5-html-element.js +0 -1
  57. package/dist/esm/polyfills/index.js +0 -34
  58. package/dist/esm/polyfills/system.js +0 -6
  59. package/dist/esm/uofg-alert.entry.js +0 -17
  60. package/dist/esm/uofg-back-to-top_5.entry.js +0 -1392
  61. package/dist/esm/uofg-modal.entry.js +0 -164
  62. package/dist/esm/uofg-web-components.js +0 -20
  63. package/dist/esm/utils-acd1ee82.js +0 -56
  64. package/dist/index.cjs.js +0 -1
  65. package/dist/index.js +0 -1
  66. package/dist/types/components/uofg-alert/uofg-alert.d.ts +0 -5
  67. package/dist/types/components/uofg-back-to-top/uofg-back-to-top.d.ts +0 -11
  68. package/dist/types/components/uofg-card/uofg-card.d.ts +0 -9
  69. package/dist/types/components/uofg-footer/uofg-footer.d.ts +0 -8
  70. package/dist/types/components/uofg-header/uofg-header.d.ts +0 -37
  71. package/dist/types/components/uofg-menu/uofg-menu.d.ts +0 -68
  72. package/dist/types/components/uofg-modal/uofg-modal.d.ts +0 -77
  73. package/dist/types/components.d.ts +0 -303
  74. package/dist/types/index.d.ts +0 -1
  75. package/dist/types/stencil-public-runtime.d.ts +0 -1681
  76. package/dist/types/utils/font-awesome-icon.d.ts +0 -5
  77. package/dist/types/utils/utils.d.ts +0 -5
  78. package/dist/uofg-web-components/index.esm.js +0 -0
  79. package/dist/uofg-web-components/p-4a896033.js +0 -2
  80. package/dist/uofg-web-components/p-4e0da5c7.entry.js +0 -1
  81. package/dist/uofg-web-components/p-663d722e.entry.js +0 -1
  82. package/dist/uofg-web-components/p-84b2d8d2.js +0 -1
  83. package/dist/uofg-web-components/p-b0718d71.entry.js +0 -1
  84. package/dist/uofg-web-components/p-e1255160.js +0 -1
  85. package/loader/cdn.js +0 -3
  86. package/loader/index.cjs.js +0 -3
  87. package/loader/index.d.ts +0 -21
  88. package/loader/index.es2017.js +0 -3
  89. package/loader/index.js +0 -4
  90. package/loader/package.json +0 -11
  91. /package/dist/{collection/components/uofg-header/decoration.svg → uofg-web-components/decorative.svg} +0 -0
  92. /package/dist/{collection/components/uofg-footer → uofg-web-components}/improve-life.svg +0 -0
  93. /package/dist/{collection/components/uofg-header/logo-reduced.svg → uofg-web-components/logo-small.svg} +0 -0
  94. /package/dist/{collection/components/uofg-header/logo-full.svg → uofg-web-components/logo.svg} +0 -0
@@ -1,438 +0,0 @@
1
- import { h, Host } from "@stencil/core";
2
- import { PREFERS_REDUCED_MOTION, WEB_ANIMATIONS_SUPPORTED } from "../../utils/utils";
3
- const DURATION_REGEX = /^(\d*\.?\d+)(s|ms)$/;
4
- const EASING_FUNCTION_REGEX = /^cubic-bezier\((\s*-?\d*\.?\d+\s*,){3}\s*-?\d*\.?\d+\s*\)$|^steps\(\s*\d+\s*(,\s*(start|end))?\s*\)$/;
5
- export class UofgMenu {
6
- constructor() {
7
- this.computedStyle = null;
8
- this.button = null;
9
- this.content = null;
10
- this.contentComputedStyle = null;
11
- this.observer = new MutationObserver(this.handleMutation);
12
- this.isExpanded = false;
13
- this.autoCollapse = false;
14
- }
15
- connectedCallback() {
16
- // Bind functions so that "this" correctly refers to the component's instance.
17
- this.handleMutation = this.handleMutation.bind(this);
18
- this.handleClick = this.handleClick.bind(this);
19
- this.handleFocusout = this.handleFocusout.bind(this);
20
- this.handleKeyUp = this.handleKeyUp.bind(this);
21
- this.computedStyle = window.getComputedStyle(this.el);
22
- this.handleMutation();
23
- this.observer.observe(this.el, { childList: true });
24
- }
25
- disconnectedCallback() {
26
- this.observer.disconnect();
27
- }
28
- handleMutation() {
29
- // Update the button element
30
- const button = this.el.querySelector('[slot="button"]');
31
- // Set up the new button
32
- button === null || button === void 0 ? void 0 : button.setAttribute('aria-expanded', this.isExpanded ? 'true' : 'false');
33
- button === null || button === void 0 ? void 0 : button.setAttribute('aria-haspopup', 'true');
34
- this.button = button;
35
- // Update the content element
36
- const content = this.el.querySelector('[slot="content"]');
37
- if (content == null) {
38
- this.content = null;
39
- this.contentComputedStyle = null;
40
- }
41
- else {
42
- this.content = content;
43
- this.isExpanded
44
- ? this.content.style.removeProperty('display')
45
- : this.content.style.setProperty('display', 'none', 'important');
46
- this.contentComputedStyle = window.getComputedStyle(this.content);
47
- }
48
- }
49
- handleKeyUp(e) {
50
- if (e.key === 'Escape') {
51
- this.isExpanded = false;
52
- if (e.target !== this.button) {
53
- e.stopPropagation();
54
- this.isExpanded = false;
55
- this.button && this.button.focus();
56
- }
57
- }
58
- }
59
- handleClick(e) {
60
- //Check if the click was on the button or a descendant of the button
61
- if (this.button && this.button.contains(e.target)) {
62
- this.isExpanded = !this.isExpanded;
63
- return;
64
- }
65
- }
66
- handleFocusout(e) {
67
- if (this.autoCollapse && !this.el.contains(e.relatedTarget)) {
68
- this.isExpanded = false;
69
- }
70
- }
71
- handleIsExpandedChange(newValue) {
72
- var _a, _b, _c;
73
- (_a = this.button) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', newValue ? 'true' : 'false');
74
- newValue ? this.expanded.emit() : this.collapsed.emit();
75
- // No content is slotted, so we don't need to do anything else.
76
- if (this.content == null) {
77
- return;
78
- }
79
- // Determine what animation type the user wants.
80
- const type = this.getAnimationType();
81
- // If Web Animations API isn't supported, or the user requested no animation, we can simply set display style
82
- if (!WEB_ANIMATIONS_SUPPORTED() || PREFERS_REDUCED_MOTION() || type === 'none') {
83
- newValue
84
- ? this.content.style.removeProperty('display')
85
- : this.content.style.setProperty('display', 'none', 'important');
86
- return;
87
- }
88
- // Check if we are in the middle of an animation.
89
- const animations = (_b = this.content) === null || _b === void 0 ? void 0 : _b.getAnimations().filter(animation => animation.id === 'uofg-menu-animation');
90
- // If we are, then we want to reverse the existing one rather than starting a new animation.
91
- if (animations.length > 0) {
92
- animations === null || animations === void 0 ? void 0 : animations.forEach(animation => animation.reverse());
93
- return;
94
- }
95
- let animationDef;
96
- const options = {
97
- id: 'uofg-menu-animation',
98
- duration: this.getAnimationDuration(),
99
- fill: 'none',
100
- easing: this.getAnimationEasing(),
101
- direction: newValue ? 'normal' : 'reverse',
102
- };
103
- // Need to remove display none, otherwise keyframe values won't be calculated correctly.
104
- this.content.style.removeProperty('display');
105
- switch (type) {
106
- case 'fade':
107
- animationDef = this.fadeAnimation();
108
- break;
109
- case 'slide':
110
- animationDef = this.slideAnimation();
111
- break;
112
- default:
113
- animationDef = this.fadeAnimation();
114
- }
115
- // We can start the animation.
116
- this.animationStarted.emit(newValue);
117
- (_c = this.content) === null || _c === void 0 ? void 0 : _c.animate(animationDef.keyframes, options).finished.finally(() => {
118
- var _a;
119
- // Once the animation is done (or something went wrong during it), we update the content's display style.
120
- if (this.content) {
121
- this.isExpanded
122
- ? this.content.style.removeProperty('display')
123
- : this.content.style.setProperty('display', 'none', 'important');
124
- (_a = animationDef.callback) === null || _a === void 0 ? void 0 : _a.call(animationDef);
125
- this.animationEnded.emit(this.isExpanded);
126
- }
127
- });
128
- }
129
- getAnimationType() {
130
- var _a;
131
- const str = ((_a = this.computedStyle) === null || _a === void 0 ? void 0 : _a.getPropertyValue('--uofg-menu-animation-type')) || '';
132
- switch (str) {
133
- case 'slide':
134
- case 'fade':
135
- return str;
136
- default:
137
- return 'none';
138
- }
139
- }
140
- getAnimationDuration() {
141
- var _a;
142
- const str = ((_a = this.computedStyle) === null || _a === void 0 ? void 0 : _a.getPropertyValue('--uofg-menu-animation-duration')) || '';
143
- const matches = DURATION_REGEX.exec(str);
144
- if (matches == null) {
145
- return 200;
146
- }
147
- return Number.parseFloat(matches[1]) * (matches[2] == 's' ? 1000 : 1);
148
- }
149
- getAnimationEasing() {
150
- var _a;
151
- const str = ((_a = this.computedStyle) === null || _a === void 0 ? void 0 : _a.getPropertyValue('--uofg-menu-animation-easing')) || '';
152
- switch (str) {
153
- case 'linear':
154
- case 'ease':
155
- case 'ease-in':
156
- case 'ease-out':
157
- case 'ease-in-out':
158
- case 'step-start':
159
- case 'step-end':
160
- return str;
161
- default:
162
- return EASING_FUNCTION_REGEX.test(str) ? str : 'ease-in-out';
163
- }
164
- }
165
- fadeAnimation() {
166
- return { keyframes: [{ opacity: 0 }, { opacity: 1 }] };
167
- }
168
- slideAnimation() {
169
- var _a, _b, _c, _d, _e;
170
- this.content && this.content.style.setProperty('overflow-y', 'hidden', 'important');
171
- return {
172
- keyframes: [
173
- {
174
- height: 0,
175
- paddingTop: 0,
176
- paddingBottom: 0,
177
- marginTop: 0,
178
- marginBottom: 0,
179
- },
180
- {
181
- height: ((_a = this.contentComputedStyle) === null || _a === void 0 ? void 0 : _a.height) || 0,
182
- paddingTop: ((_b = this.contentComputedStyle) === null || _b === void 0 ? void 0 : _b.paddingTop) || 0,
183
- paddingBottom: ((_c = this.contentComputedStyle) === null || _c === void 0 ? void 0 : _c.paddingBottom) || 0,
184
- marginTop: ((_d = this.contentComputedStyle) === null || _d === void 0 ? void 0 : _d.marginTop) || 0,
185
- marginBottom: ((_e = this.contentComputedStyle) === null || _e === void 0 ? void 0 : _e.marginBottom) || 0,
186
- },
187
- ],
188
- callback: () => {
189
- this.content && this.content.style.removeProperty('overflow-y');
190
- },
191
- };
192
- }
193
- render() {
194
- return (h(Host, { key: '40c0e7a6dd7f457145ed744aaf86595f72566f8c', "data-expanded": this.isExpanded, tabindex: -1, onFocusout: this.handleFocusout, onKeyUp: this.handleKeyUp, onClick: this.handleClick }));
195
- }
196
- /**
197
- * Get the current expanded state of the menu.
198
- * @returns A promise which will resolve to the current expanded state.
199
- */
200
- async getExpanded() {
201
- return this.isExpanded;
202
- }
203
- /**
204
- * Set the expanded state of the menu.
205
- * @param value The new expanded state.
206
- */
207
- async setExpanded(value) {
208
- this.isExpanded = value;
209
- }
210
- /**
211
- * Toggle the expanded state of the menu.
212
- * @returns A promise which will resolve to the new expanded state.
213
- */
214
- async toggle() {
215
- this.isExpanded = !this.isExpanded;
216
- return this.isExpanded;
217
- }
218
- /**
219
- * Collapse the menu. This is the same as setting the expanded state to false.
220
- * @returns empty Promise.
221
- */
222
- async collapse() {
223
- this.isExpanded = false;
224
- }
225
- /**
226
- * Expand the menu. This is the same as setting the expanded state to true.
227
- * @returns empty Promise.
228
- */
229
- async expand() {
230
- this.isExpanded = true;
231
- }
232
- static get is() { return "uofg-menu"; }
233
- static get properties() {
234
- return {
235
- "autoCollapse": {
236
- "type": "boolean",
237
- "mutable": false,
238
- "complexType": {
239
- "original": "boolean",
240
- "resolved": "boolean",
241
- "references": {}
242
- },
243
- "required": false,
244
- "optional": false,
245
- "docs": {
246
- "tags": [],
247
- "text": "Controls whether the menu should automatically collapse when the focused element in the page is not contained within the menu (e.g. it's button or content). This is useful for when you want the menu to collapse whenever a user interacts with any other part of the page."
248
- },
249
- "attribute": "auto-collapse",
250
- "reflect": false,
251
- "defaultValue": "false"
252
- }
253
- };
254
- }
255
- static get states() {
256
- return {
257
- "isExpanded": {}
258
- };
259
- }
260
- static get events() {
261
- return [{
262
- "method": "expanded",
263
- "name": "expanded",
264
- "bubbles": false,
265
- "cancelable": false,
266
- "composed": true,
267
- "docs": {
268
- "tags": [],
269
- "text": "Dispatched whenever the menu is expanded whether by user interaction or or programmatically (e.g. expand())."
270
- },
271
- "complexType": {
272
- "original": "void",
273
- "resolved": "void",
274
- "references": {}
275
- }
276
- }, {
277
- "method": "collapsed",
278
- "name": "collapsed",
279
- "bubbles": false,
280
- "cancelable": false,
281
- "composed": true,
282
- "docs": {
283
- "tags": [],
284
- "text": "Dispatched whenever the menu is collapsed whether by user interaction or programmatically (e.g. collapse())."
285
- },
286
- "complexType": {
287
- "original": "void",
288
- "resolved": "void",
289
- "references": {}
290
- }
291
- }, {
292
- "method": "animationStarted",
293
- "name": "animationStarted",
294
- "bubbles": false,
295
- "cancelable": false,
296
- "composed": true,
297
- "docs": {
298
- "tags": [],
299
- "text": "Dispatched whenever the menu is expanding or collapsing and the animation has started. This event is not dispatched if the animation is disabled (e.g. due to reduced motion, css variable set to none, or lack of Web Animations API support)."
300
- },
301
- "complexType": {
302
- "original": "boolean",
303
- "resolved": "boolean",
304
- "references": {}
305
- }
306
- }, {
307
- "method": "animationEnded",
308
- "name": "animationEnded",
309
- "bubbles": false,
310
- "cancelable": false,
311
- "composed": true,
312
- "docs": {
313
- "tags": [],
314
- "text": "Dispatched whenever the menu is expanding or collapsing and the animation has ended. This event is not dispatched if the animation is disabled (e.g. due to reduced motion, css variable set to none, or lack of Web Animations API support)."
315
- },
316
- "complexType": {
317
- "original": "boolean",
318
- "resolved": "boolean",
319
- "references": {}
320
- }
321
- }];
322
- }
323
- static get methods() {
324
- return {
325
- "getExpanded": {
326
- "complexType": {
327
- "signature": "() => Promise<boolean>",
328
- "parameters": [],
329
- "references": {
330
- "Promise": {
331
- "location": "global",
332
- "id": "global::Promise"
333
- }
334
- },
335
- "return": "Promise<boolean>"
336
- },
337
- "docs": {
338
- "text": "Get the current expanded state of the menu.",
339
- "tags": [{
340
- "name": "returns",
341
- "text": "A promise which will resolve to the current expanded state."
342
- }]
343
- }
344
- },
345
- "setExpanded": {
346
- "complexType": {
347
- "signature": "(value: boolean) => Promise<void>",
348
- "parameters": [{
349
- "name": "value",
350
- "type": "boolean",
351
- "docs": "The new expanded state."
352
- }],
353
- "references": {
354
- "Promise": {
355
- "location": "global",
356
- "id": "global::Promise"
357
- }
358
- },
359
- "return": "Promise<void>"
360
- },
361
- "docs": {
362
- "text": "Set the expanded state of the menu.",
363
- "tags": [{
364
- "name": "param",
365
- "text": "value The new expanded state."
366
- }]
367
- }
368
- },
369
- "toggle": {
370
- "complexType": {
371
- "signature": "() => Promise<boolean>",
372
- "parameters": [],
373
- "references": {
374
- "Promise": {
375
- "location": "global",
376
- "id": "global::Promise"
377
- }
378
- },
379
- "return": "Promise<boolean>"
380
- },
381
- "docs": {
382
- "text": "Toggle the expanded state of the menu.",
383
- "tags": [{
384
- "name": "returns",
385
- "text": "A promise which will resolve to the new expanded state."
386
- }]
387
- }
388
- },
389
- "collapse": {
390
- "complexType": {
391
- "signature": "() => Promise<void>",
392
- "parameters": [],
393
- "references": {
394
- "Promise": {
395
- "location": "global",
396
- "id": "global::Promise"
397
- }
398
- },
399
- "return": "Promise<void>"
400
- },
401
- "docs": {
402
- "text": "Collapse the menu. This is the same as setting the expanded state to false.",
403
- "tags": [{
404
- "name": "returns",
405
- "text": "empty Promise."
406
- }]
407
- }
408
- },
409
- "expand": {
410
- "complexType": {
411
- "signature": "() => Promise<void>",
412
- "parameters": [],
413
- "references": {
414
- "Promise": {
415
- "location": "global",
416
- "id": "global::Promise"
417
- }
418
- },
419
- "return": "Promise<void>"
420
- },
421
- "docs": {
422
- "text": "Expand the menu. This is the same as setting the expanded state to true.",
423
- "tags": [{
424
- "name": "returns",
425
- "text": "empty Promise."
426
- }]
427
- }
428
- }
429
- };
430
- }
431
- static get elementRef() { return "el"; }
432
- static get watchers() {
433
- return [{
434
- "propName": "isExpanded",
435
- "methodName": "handleIsExpandedChange"
436
- }];
437
- }
438
- }