@uoguelph/web-components 1.1.3 → 1.2.0-rc.0

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