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

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 (103) hide show
  1. package/README.md +0 -63
  2. package/dist/uofg-web-components/index-ClyJk2_i.js +977 -0
  3. package/dist/uofg-web-components/uofg-alert.esm.js +154 -0
  4. package/dist/uofg-web-components/uofg-footer.esm.js +429 -0
  5. package/dist/uofg-web-components/uofg-header.esm.js +2404 -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 -35
  10. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  11. package/dist/cjs/index-06b58d35.js +0 -32
  12. package/dist/cjs/index-cdb046b4.js +0 -2092
  13. package/dist/cjs/index.cjs.js +0 -2
  14. package/dist/cjs/loader.cjs.js +0 -15
  15. package/dist/cjs/uofg-alert.cjs.entry.js +0 -21
  16. package/dist/cjs/uofg-back-to-top_5.cjs.entry.js +0 -1374
  17. package/dist/cjs/uofg-modal.cjs.entry.js +0 -172
  18. package/dist/cjs/uofg-web-components.cjs.js +0 -25
  19. package/dist/cjs/utils-3d4b7e2e.js +0 -16
  20. package/dist/collection/collection-manifest.json +0 -18
  21. package/dist/collection/components/uofg-alert/uofg-alert.css +0 -1
  22. package/dist/collection/components/uofg-alert/uofg-alert.js +0 -20
  23. package/dist/collection/components/uofg-back-to-top/uofg-back-to-top.css +0 -1
  24. package/dist/collection/components/uofg-back-to-top/uofg-back-to-top.js +0 -71
  25. package/dist/collection/components/uofg-card/uofg-card.css +0 -1
  26. package/dist/collection/components/uofg-card/uofg-card.js +0 -45
  27. package/dist/collection/components/uofg-footer/improve-life.svg +0 -4
  28. package/dist/collection/components/uofg-footer/uofg-footer.css +0 -1
  29. package/dist/collection/components/uofg-footer/uofg-footer.js +0 -153
  30. package/dist/collection/components/uofg-header/decoration.svg +0 -1
  31. package/dist/collection/components/uofg-header/logo-full.svg +0 -1
  32. package/dist/collection/components/uofg-header/logo-reduced.svg +0 -1
  33. package/dist/collection/components/uofg-header/uofg-header.css +0 -1
  34. package/dist/collection/components/uofg-header/uofg-header.js +0 -253
  35. package/dist/collection/components/uofg-menu/uofg-menu.js +0 -438
  36. package/dist/collection/components/uofg-modal/uofg-modal.css +0 -1
  37. package/dist/collection/components/uofg-modal/uofg-modal.js +0 -417
  38. package/dist/collection/index.js +0 -1
  39. package/dist/collection/utils/font-awesome-icon.js +0 -7
  40. package/dist/collection/utils/utils.js +0 -13
  41. package/dist/components/font-awesome-icon.js +0 -10
  42. package/dist/components/index.d.ts +0 -50
  43. package/dist/components/index.js +0 -8
  44. package/dist/components/index2.js +0 -18
  45. package/dist/components/uofg-alert.d.ts +0 -11
  46. package/dist/components/uofg-alert.js +0 -36
  47. package/dist/components/uofg-back-to-top.d.ts +0 -11
  48. package/dist/components/uofg-back-to-top.js +0 -52
  49. package/dist/components/uofg-card.d.ts +0 -11
  50. package/dist/components/uofg-card.js +0 -40
  51. package/dist/components/uofg-footer.d.ts +0 -11
  52. package/dist/components/uofg-footer.js +0 -751
  53. package/dist/components/uofg-header.d.ts +0 -11
  54. package/dist/components/uofg-header.js +0 -385
  55. package/dist/components/uofg-menu.d.ts +0 -11
  56. package/dist/components/uofg-menu.js +0 -6
  57. package/dist/components/uofg-menu2.js +0 -268
  58. package/dist/components/uofg-modal.d.ts +0 -11
  59. package/dist/components/uofg-modal.js +0 -201
  60. package/dist/components/utils.js +0 -12
  61. package/dist/esm/app-globals-0f993ce5.js +0 -3
  62. package/dist/esm/index-0b0002d2.js +0 -2062
  63. package/dist/esm/index-e685921a.js +0 -27
  64. package/dist/esm/index.js +0 -1
  65. package/dist/esm/loader.js +0 -11
  66. package/dist/esm/polyfills/core-js.js +0 -11
  67. package/dist/esm/polyfills/dom.js +0 -79
  68. package/dist/esm/polyfills/es5-html-element.js +0 -1
  69. package/dist/esm/polyfills/index.js +0 -34
  70. package/dist/esm/polyfills/system.js +0 -6
  71. package/dist/esm/uofg-alert.entry.js +0 -17
  72. package/dist/esm/uofg-back-to-top_5.entry.js +0 -1366
  73. package/dist/esm/uofg-modal.entry.js +0 -168
  74. package/dist/esm/uofg-web-components.js +0 -20
  75. package/dist/esm/utils-379bb71a.js +0 -12
  76. package/dist/index.cjs.js +0 -1
  77. package/dist/index.js +0 -1
  78. package/dist/types/components/uofg-alert/uofg-alert.d.ts +0 -3
  79. package/dist/types/components/uofg-back-to-top/uofg-back-to-top.d.ts +0 -10
  80. package/dist/types/components/uofg-card/uofg-card.d.ts +0 -7
  81. package/dist/types/components/uofg-footer/uofg-footer.d.ts +0 -8
  82. package/dist/types/components/uofg-header/uofg-header.d.ts +0 -37
  83. package/dist/types/components/uofg-menu/uofg-menu.d.ts +0 -68
  84. package/dist/types/components/uofg-modal/uofg-modal.d.ts +0 -77
  85. package/dist/types/components.d.ts +0 -303
  86. package/dist/types/index.d.ts +0 -1
  87. package/dist/types/stencil-public-runtime.d.ts +0 -1681
  88. package/dist/types/utils/font-awesome-icon.d.ts +0 -5
  89. package/dist/types/utils/utils.d.ts +0 -4
  90. package/dist/uofg-web-components/index.esm.js +0 -0
  91. package/dist/uofg-web-components/p-6fa0f8f6.js +0 -1
  92. package/dist/uofg-web-components/p-7569d8f2.entry.js +0 -1
  93. package/dist/uofg-web-components/p-bce5df9d.entry.js +0 -1
  94. package/dist/uofg-web-components/p-e1255160.js +0 -1
  95. package/dist/uofg-web-components/p-ee27db22.js +0 -2
  96. package/dist/uofg-web-components/p-fde6370b.entry.js +0 -1
  97. package/dist/uofg-web-components/p-fec87f9d.js +0 -1
  98. package/loader/cdn.js +0 -3
  99. package/loader/index.cjs.js +0 -3
  100. package/loader/index.d.ts +0 -21
  101. package/loader/index.es2017.js +0 -3
  102. package/loader/index.js +0 -4
  103. package/loader/package.json +0 -11
@@ -1,268 +0,0 @@
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';
3
-
4
- const DURATION_REGEX = /^(\d*\.?\d+)(s|ms)$/;
5
- const EASING_FUNCTION_REGEX = /^cubic-bezier\((\s*-?\d*\.?\d+\s*,){3}\s*-?\d*\.?\d+\s*\)$|^steps\(\s*\d+\s*(,\s*(start|end))?\s*\)$/;
6
- const UofgMenu = /*@__PURE__*/ proxyCustomElement(class UofgMenu extends HTMLElement {
7
- constructor() {
8
- super();
9
- this.__registerHost();
10
- this.expanded = createEvent(this, "expanded", 2);
11
- this.collapsed = createEvent(this, "collapsed", 2);
12
- this.animationStarted = createEvent(this, "animationStarted", 2);
13
- this.animationEnded = createEvent(this, "animationEnded", 2);
14
- this.computedStyle = null;
15
- this.button = null;
16
- this.content = null;
17
- this.contentComputedStyle = null;
18
- this.observer = new MutationObserver(this.handleMutation);
19
- this.isExpanded = false;
20
- this.autoCollapse = false;
21
- }
22
- connectedCallback() {
23
- // Bind functions so that "this" correctly refers to the component's instance.
24
- this.handleMutation = this.handleMutation.bind(this);
25
- this.handleClick = this.handleClick.bind(this);
26
- this.handleFocusout = this.handleFocusout.bind(this);
27
- this.handleKeyUp = this.handleKeyUp.bind(this);
28
- this.computedStyle = window.getComputedStyle(this.el);
29
- this.handleMutation();
30
- this.observer.observe(this.el, { childList: true });
31
- }
32
- disconnectedCallback() {
33
- this.observer.disconnect();
34
- }
35
- handleMutation() {
36
- // Update the button element
37
- const button = this.el.querySelector('[slot="button"]');
38
- // Set up the new button
39
- button === null || button === void 0 ? void 0 : button.setAttribute('aria-expanded', this.isExpanded ? 'true' : 'false');
40
- button === null || button === void 0 ? void 0 : button.setAttribute('aria-haspopup', 'true');
41
- this.button = button;
42
- // Update the content element
43
- const content = this.el.querySelector('[slot="content"]');
44
- if (content == null) {
45
- this.content = null;
46
- this.contentComputedStyle = null;
47
- }
48
- else {
49
- this.content = content;
50
- this.isExpanded
51
- ? this.content.style.removeProperty('display')
52
- : this.content.style.setProperty('display', 'none', 'important');
53
- this.contentComputedStyle = window.getComputedStyle(this.content);
54
- }
55
- }
56
- handleKeyUp(e) {
57
- if (e.key === 'Escape') {
58
- this.isExpanded = false;
59
- if (e.target !== this.button) {
60
- e.stopPropagation();
61
- this.isExpanded = false;
62
- this.button && this.button.focus();
63
- }
64
- }
65
- }
66
- handleClick(e) {
67
- //Check if the click was on the button or a descendant of the button
68
- if (this.button && this.button.contains(e.target)) {
69
- this.isExpanded = !this.isExpanded;
70
- return;
71
- }
72
- }
73
- handleFocusout(e) {
74
- if (this.autoCollapse && !this.el.contains(e.relatedTarget)) {
75
- this.isExpanded = false;
76
- }
77
- }
78
- handleIsExpandedChange(newValue) {
79
- var _a, _b, _c;
80
- (_a = this.button) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', newValue ? 'true' : 'false');
81
- newValue ? this.expanded.emit() : this.collapsed.emit();
82
- // No content is slotted, so we don't need to do anything else.
83
- if (this.content == null) {
84
- return;
85
- }
86
- // Determine what animation type the user wants.
87
- const type = this.getAnimationType();
88
- // If Web Animations API isn't supported, or the user requested no animation, we can simply set display style
89
- if (!WEB_ANIMATIONS_SUPPORTED() || PREFERS_REDUCED_MOTION() || type === 'none') {
90
- newValue
91
- ? this.content.style.removeProperty('display')
92
- : this.content.style.setProperty('display', 'none', 'important');
93
- return;
94
- }
95
- // Check if we are in the middle of an animation.
96
- const animations = (_b = this.content) === null || _b === void 0 ? void 0 : _b.getAnimations().filter(animation => animation.id === 'uofg-menu-animation');
97
- // If we are, then we want to reverse the existing one rather than starting a new animation.
98
- if (animations.length > 0) {
99
- animations === null || animations === void 0 ? void 0 : animations.forEach(animation => animation.reverse());
100
- return;
101
- }
102
- let animationDef;
103
- const options = {
104
- id: 'uofg-menu-animation',
105
- duration: this.getAnimationDuration(),
106
- fill: 'none',
107
- easing: this.getAnimationEasing(),
108
- direction: newValue ? 'normal' : 'reverse',
109
- };
110
- // Need to remove display none, otherwise keyframe values won't be calculated correctly.
111
- this.content.style.removeProperty('display');
112
- switch (type) {
113
- case 'fade':
114
- animationDef = this.fadeAnimation();
115
- break;
116
- case 'slide':
117
- animationDef = this.slideAnimation();
118
- break;
119
- default:
120
- animationDef = this.fadeAnimation();
121
- }
122
- // We can start the animation.
123
- this.animationStarted.emit(newValue);
124
- (_c = this.content) === null || _c === void 0 ? void 0 : _c.animate(animationDef.keyframes, options).finished.finally(() => {
125
- var _a;
126
- // Once the animation is done (or something went wrong during it), we update the content's display style.
127
- if (this.content) {
128
- this.isExpanded
129
- ? this.content.style.removeProperty('display')
130
- : this.content.style.setProperty('display', 'none', 'important');
131
- (_a = animationDef.callback) === null || _a === void 0 ? void 0 : _a.call(animationDef);
132
- this.animationEnded.emit(this.isExpanded);
133
- }
134
- });
135
- }
136
- getAnimationType() {
137
- var _a;
138
- const str = ((_a = this.computedStyle) === null || _a === void 0 ? void 0 : _a.getPropertyValue('--uofg-menu-animation-type')) || '';
139
- switch (str) {
140
- case 'slide':
141
- case 'fade':
142
- return str;
143
- default:
144
- return 'none';
145
- }
146
- }
147
- getAnimationDuration() {
148
- var _a;
149
- const str = ((_a = this.computedStyle) === null || _a === void 0 ? void 0 : _a.getPropertyValue('--uofg-menu-animation-duration')) || '';
150
- const matches = DURATION_REGEX.exec(str);
151
- if (matches == null) {
152
- return 200;
153
- }
154
- return Number.parseFloat(matches[1]) * (matches[2] == 's' ? 1000 : 1);
155
- }
156
- getAnimationEasing() {
157
- var _a;
158
- const str = ((_a = this.computedStyle) === null || _a === void 0 ? void 0 : _a.getPropertyValue('--uofg-menu-animation-easing')) || '';
159
- switch (str) {
160
- case 'linear':
161
- case 'ease':
162
- case 'ease-in':
163
- case 'ease-out':
164
- case 'ease-in-out':
165
- case 'step-start':
166
- case 'step-end':
167
- return str;
168
- default:
169
- return EASING_FUNCTION_REGEX.test(str) ? str : 'ease-in-out';
170
- }
171
- }
172
- fadeAnimation() {
173
- return { keyframes: [{ opacity: 0 }, { opacity: 1 }] };
174
- }
175
- slideAnimation() {
176
- var _a, _b, _c, _d, _e;
177
- this.content && this.content.style.setProperty('overflow-y', 'hidden', 'important');
178
- return {
179
- keyframes: [
180
- {
181
- height: 0,
182
- paddingTop: 0,
183
- paddingBottom: 0,
184
- marginTop: 0,
185
- marginBottom: 0,
186
- },
187
- {
188
- height: ((_a = this.contentComputedStyle) === null || _a === void 0 ? void 0 : _a.height) || 0,
189
- paddingTop: ((_b = this.contentComputedStyle) === null || _b === void 0 ? void 0 : _b.paddingTop) || 0,
190
- paddingBottom: ((_c = this.contentComputedStyle) === null || _c === void 0 ? void 0 : _c.paddingBottom) || 0,
191
- marginTop: ((_d = this.contentComputedStyle) === null || _d === void 0 ? void 0 : _d.marginTop) || 0,
192
- marginBottom: ((_e = this.contentComputedStyle) === null || _e === void 0 ? void 0 : _e.marginBottom) || 0,
193
- },
194
- ],
195
- callback: () => {
196
- this.content && this.content.style.removeProperty('overflow-y');
197
- },
198
- };
199
- }
200
- render() {
201
- return (h(Host, { key: '40c0e7a6dd7f457145ed744aaf86595f72566f8c', "data-expanded": this.isExpanded, tabindex: -1, onFocusout: this.handleFocusout, onKeyUp: this.handleKeyUp, onClick: this.handleClick }));
202
- }
203
- /**
204
- * Get the current expanded state of the menu.
205
- * @returns A promise which will resolve to the current expanded state.
206
- */
207
- async getExpanded() {
208
- return this.isExpanded;
209
- }
210
- /**
211
- * Set the expanded state of the menu.
212
- * @param value The new expanded state.
213
- */
214
- async setExpanded(value) {
215
- this.isExpanded = value;
216
- }
217
- /**
218
- * Toggle the expanded state of the menu.
219
- * @returns A promise which will resolve to the new expanded state.
220
- */
221
- async toggle() {
222
- this.isExpanded = !this.isExpanded;
223
- return this.isExpanded;
224
- }
225
- /**
226
- * Collapse the menu. This is the same as setting the expanded state to false.
227
- * @returns empty Promise.
228
- */
229
- async collapse() {
230
- this.isExpanded = false;
231
- }
232
- /**
233
- * Expand the menu. This is the same as setting the expanded state to true.
234
- * @returns empty Promise.
235
- */
236
- async expand() {
237
- this.isExpanded = true;
238
- }
239
- get el() { return this; }
240
- static get watchers() { return {
241
- "isExpanded": ["handleIsExpandedChange"]
242
- }; }
243
- }, [0, "uofg-menu", {
244
- "autoCollapse": [4, "auto-collapse"],
245
- "isExpanded": [32],
246
- "getExpanded": [64],
247
- "setExpanded": [64],
248
- "toggle": [64],
249
- "collapse": [64],
250
- "expand": [64]
251
- }, undefined, {
252
- "isExpanded": ["handleIsExpandedChange"]
253
- }]);
254
- function defineCustomElement() {
255
- if (typeof customElements === "undefined") {
256
- return;
257
- }
258
- const components = ["uofg-menu"];
259
- components.forEach(tagName => { switch (tagName) {
260
- case "uofg-menu":
261
- if (!customElements.get(tagName)) {
262
- customElements.define(tagName, UofgMenu);
263
- }
264
- break;
265
- } });
266
- }
267
-
268
- export { UofgMenu as U, defineCustomElement as d };
@@ -1,11 +0,0 @@
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;
@@ -1,201 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { F as FontAwesomeIcon } from './font-awesome-icon.js';
3
- import { b as faTimes } from './index2.js';
4
- import { g as getAllFocusableElements } from './utils.js';
5
-
6
- const uofgModalCss = ":host{visibility:visible !important;position:relative !important;z-index:100000 !important}@defaults border-spacing{--tw-border-spacing-x:0;--tw-border-spacing-y:0}@defaults transform{--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1}@defaults touch-action{}@defaults scroll-snap-type{--tw-scroll-snap-strictness:proximity}@defaults gradient-color-stops{}@defaults font-variant-numeric{}@defaults box-shadow{--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}@defaults ring-width{--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}@defaults filter{}@defaults backdrop-filter{}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}.tw-visible{visibility:visible!important}.tw-invisible{visibility:hidden!important}.tw-fixed{position:fixed!important}.tw-absolute{position:absolute!important}.tw-left-0{left:0!important}.tw-left-1\\/2{left:50%!important}.tw-right-8{right:2rem!important}.tw-top-0{top:0!important}.tw-top-8{top:2rem!important}.tw-z-\\[1000\\]{z-index:1000!important}.tw-z-\\[2\\]{z-index:2!important}.tw-flex{display:flex!important}.tw-h-12{height:3rem!important}.tw-h-fit{height:fit-content!important}.tw-h-screen{height:100vh!important}.tw-max-h-full{max-height:100%!important}.tw-w-12{width:3rem!important}.tw-w-fit{width:fit-content!important}.tw-w-screen{width:100vw!important}.tw-max-w-full{max-width:100%!important}.-tw-translate-x-1\\/2{--tw-translate-x:-50%!important}.-tw-translate-x-1\\/2,.tw-translate-y-\\[-50px\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.tw-translate-y-\\[-50px\\]{--tw-translate-y:-50px!important}.tw-translate-y-\\[calc\\(-50\\%_-_50px\\)\\]{--tw-translate-y:calc(-50% - 50px)!important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.tw-items-center{align-items:center!important}.tw-justify-center{justify-content:center!important}.tw-overflow-auto{overflow:auto!important}.tw-border-0{border-width:0!important}.tw-bg-black{--tw-bg-opacity:1!important;background-color:rgb(0 0 0/var(--tw-bg-opacity))!important}.tw-bg-transparent{background-color:transparent!important}.tw-bg-opacity-50{--tw-bg-opacity:0.5!important}.tw-p-2{padding:.5rem!important}.tw-p-8{padding:2rem!important}.tw-text-3xl{font-size:1.875rem!important;line-height:2.25rem!important}.tw-text-\\[var\\(--uofg-modal-dismiss-color\\,white\\)\\]{color:var(--uofg-modal-dismiss-color,#fff)!important}.tw-opacity-0{opacity:0!important}.tw-opacity-100{opacity:1!important}.tw-transition-\\[opacity\\,visibility\\]{transition-duration:.15s!important;transition-property:opacity,visibility!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important}.tw-transition-transform{transition-duration:.15s!important;transition-property:transform!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important}@media (prefers-reduced-motion:reduce){.motion-reduce\\:tw-transition-none{transition-property:none!important}}.\\[\\&\\>svg\\]\\:tw-h-\\[1em\\]>svg{height:1em!important}.\\[\\&\\>svg\\]\\:tw-fill-current>svg{fill:currentColor!important}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}";
7
- const UofgModalStyle0 = uofgModalCss;
8
-
9
- const UofgModal$1 = /*@__PURE__*/ proxyCustomElement(class UofgModal extends HTMLElement {
10
- constructor() {
11
- super();
12
- this.__registerHost();
13
- this.__attachShadow();
14
- this.opened = createEvent(this, "opened", 2);
15
- this.closed = createEvent(this, "closed", 2);
16
- this.inertElements = [];
17
- this.label = undefined;
18
- this.alertDialog = false;
19
- this.centered = false;
20
- this.staticBackdrop = false;
21
- this.autoOpen = false;
22
- this.isOpen = false;
23
- }
24
- connectedCallback() {
25
- // Bind event handlers so that 'this' is always the component instance.
26
- this.handleClick = this.handleClick.bind(this);
27
- this.handleKeyUp = this.handleKeyUp.bind(this);
28
- this.handleFocusOut = this.handleFocusOut.bind(this);
29
- if (this.autoOpen) {
30
- this.isOpen = true;
31
- }
32
- }
33
- disconnectedCallback() {
34
- // Just in case the modal is removed from the DOM before it is closed, make sure to remove the inert attribute from all elements that we marked as inert when the modal was opened.
35
- for (const element of this.inertElements) {
36
- element.removeAttribute('inert');
37
- }
38
- }
39
- handleClick(e) {
40
- if (!this.staticBackdrop && e.target === e.currentTarget) {
41
- this.isOpen = false;
42
- }
43
- }
44
- handleKeyUp(e) {
45
- if (e.key === 'Escape') {
46
- this.isOpen = false;
47
- }
48
- }
49
- handleFocusOut(e) {
50
- var _a;
51
- if (!this.isOpen)
52
- return; // Don't do anything if the modal is closed.
53
- const relatedTarget = e.relatedTarget;
54
- // If the focus is moving outside the modal
55
- if (!this.container.contains(relatedTarget) && !this.el.contains(relatedTarget)) {
56
- e.preventDefault();
57
- // If the focus is moving away from the dismiss button, focus the last focusable element in the modal.
58
- if (e.target === this.dismissButton) {
59
- const focusableElements = getAllFocusableElements(this.el);
60
- (_a = focusableElements[focusableElements.length - 1]) === null || _a === void 0 ? void 0 : _a.focus();
61
- }
62
- else {
63
- // Otherwise, focus the dismiss button.
64
- this.dismissButton.focus();
65
- }
66
- }
67
- }
68
- handleIsOpenChange(newValue) {
69
- if (newValue) {
70
- window.requestAnimationFrame(() => {
71
- window.requestAnimationFrame(() => {
72
- window.requestAnimationFrame(() => {
73
- // Focus the container element when the modal is opened, so that the screen reader's will announce the modal when it opens.
74
- this.container.focus();
75
- });
76
- });
77
- });
78
- // Mark outer elements as inert when the modal is open.
79
- let current = this.el;
80
- // We want to mark all elements outside the modal as inert, so we need to traverse up the DOM tree until we reach the body element.
81
- while (current !== null && current !== document.body) {
82
- const parent = current.parentElement;
83
- // If parent is null, then we may be inside a shadow root. If so, we get the host element and continue traversing up the DOM tree.
84
- if (parent === null) {
85
- const root = current.getRootNode();
86
- if (root instanceof ShadowRoot) {
87
- current = root.host;
88
- continue;
89
- }
90
- }
91
- if (parent !== null) {
92
- for (const child of parent.children) {
93
- if (child !== current && !child.inert) {
94
- // Mark the element as inert and store it in an array so that we can remove the inert attribute when the modal closes.
95
- child.inert = true;
96
- this.inertElements.push(child);
97
- }
98
- }
99
- }
100
- current = parent;
101
- this.opened.emit();
102
- }
103
- }
104
- else {
105
- // Remove the inert attribute from all elements that we marked as inert when the modal was opened.
106
- for (const element of this.inertElements) {
107
- element.removeAttribute('inert');
108
- }
109
- // Clear the array of inert elements. This is important because we don't want to keep a reference to elements as they may be removed from the DOM and we could cause a memory leak.
110
- this.inertElements = [];
111
- this.closed.emit();
112
- }
113
- // Prevent scrolling of the body when the modal is open.
114
- document.body.style.overflow = newValue ? 'hidden' : '';
115
- }
116
- render() {
117
- return (h("div", { key: 'c66f0986068658cc29b9c12715381a0fd40678c9', class: {
118
- 'tw-visible tw-opacity-100': this.isOpen,
119
- 'tw-invisible tw-opacity-0': !this.isOpen,
120
- 'tw-fixed tw-left-0 tw-top-0 tw-z-[1000] tw-flex tw-h-screen tw-w-screen tw-bg-black tw-bg-opacity-50 tw-transition-[opacity,visibility]': true,
121
- }, role: this.alertDialog ? 'alertdialog' : 'dialog', "aria-modal": this.isOpen ? 'true' : '', "aria-label": this.label, tabIndex: -1, onClick: this.handleClick, onKeyUp: this.handleKeyUp, onFocusout: this.handleFocusOut, ref: (el) => (this.container = el) }, h("div", { key: 'f6d05f9834e3d5398aa5cd0897605d5b16014c2e', part: "content", class: {
122
- 'tw-visible tw-opacity-100': this.isOpen,
123
- 'tw-translate-y-[calc(-50%_-_50px)]': !this.isOpen && this.centered,
124
- 'tw-translate-y-[-50px]': (!this.isOpen && !this.centered) || (this.isOpen && this.centered),
125
- 'tw-z-1 tw-absolute tw-left-1/2 tw-h-fit tw-max-h-full tw-w-fit tw-max-w-full -tw-translate-x-1/2 tw-overflow-auto tw-p-8 tw-transition-transform motion-reduce:tw-transition-none': true,
126
- } }, h("button", { key: 'eecbcc13c724410cb085bec5e26f6a2a4c55c32a', class: "[&>svg]:h-[1em] tw-absolute tw-right-8 tw-top-8 tw-z-[2] tw-flex tw-h-12 tw-w-12 tw-items-center tw-justify-center tw-border-0 tw-bg-transparent tw-text-3xl tw-p-2 tw-text-[var(--uofg-modal-dismiss-color,white)] [&>svg]:tw-h-[1em] [&>svg]:tw-fill-current", part: "dismiss-button", "aria-label": "Close modal", ref: (el) => (this.dismissButton = el), onClick: () => (this.isOpen = false) }, h(FontAwesomeIcon, { key: '735ceec0b5bbace91a40db729d7b530767b8593a', icon: faTimes })), h("slot", { key: 'b3b156aa4d3859a1d827a9d826a8d91b8f379f18' }))));
127
- }
128
- /**
129
- * Get the current state of the modal.
130
- * @returns A promise which will resolve to true when the modal is open, or false when the modal is closed.
131
- */
132
- async getState() {
133
- return this.isOpen;
134
- }
135
- /**
136
- * Set the state of the modal.
137
- * @param value The new state, set it to true to open the modal, or false to close the modal.
138
- */
139
- async setState(value) {
140
- this.isOpen = value;
141
- }
142
- /**
143
- * Toggle the state of the modal.
144
- * @returns A promise which will resolve to true (if the modal opened) or false (if the modal closed).
145
- */
146
- async toggle() {
147
- this.isOpen = !this.isOpen;
148
- return this.isOpen;
149
- }
150
- /**
151
- * Closes the modal.
152
- * @returns empty Promise.
153
- */
154
- async close() {
155
- this.isOpen = false;
156
- }
157
- /**
158
- * Opens the modal.
159
- * @returns empty Promise.
160
- */
161
- async open() {
162
- this.isOpen = true;
163
- }
164
- get el() { return this; }
165
- static get watchers() { return {
166
- "isOpen": ["handleIsOpenChange"]
167
- }; }
168
- static get style() { return UofgModalStyle0; }
169
- }, [1, "uofg-modal", {
170
- "label": [1],
171
- "alertDialog": [4, "alert-dialog"],
172
- "centered": [4],
173
- "staticBackdrop": [4, "static-backdrop"],
174
- "autoOpen": [4, "auto-open"],
175
- "isOpen": [32],
176
- "getState": [64],
177
- "setState": [64],
178
- "toggle": [64],
179
- "close": [64],
180
- "open": [64]
181
- }, undefined, {
182
- "isOpen": ["handleIsOpenChange"]
183
- }]);
184
- function defineCustomElement$1() {
185
- if (typeof customElements === "undefined") {
186
- return;
187
- }
188
- const components = ["uofg-modal"];
189
- components.forEach(tagName => { switch (tagName) {
190
- case "uofg-modal":
191
- if (!customElements.get(tagName)) {
192
- customElements.define(tagName, UofgModal$1);
193
- }
194
- break;
195
- } });
196
- }
197
-
198
- const UofgModal = UofgModal$1;
199
- const defineCustomElement = defineCustomElement$1;
200
-
201
- export { UofgModal, defineCustomElement };
@@ -1,12 +0,0 @@
1
- const WEB_ANIMATIONS_SUPPORTED = () => {
2
- return typeof window !== 'undefined' && 'animate' in HTMLElement.prototype;
3
- };
4
- const PREFERS_REDUCED_MOTION = () => {
5
- return typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
6
- };
7
- const getAllFocusableElements = (container) => {
8
- 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"])';
9
- return Array.from(container.querySelectorAll(query));
10
- };
11
-
12
- export { PREFERS_REDUCED_MOTION as P, WEB_ANIMATIONS_SUPPORTED as W, getAllFocusableElements as g };
@@ -1,3 +0,0 @@
1
- const globalScripts = () => {};
2
-
3
- export { globalScripts as g };