@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.
- package/dist/cjs/{index-c68ebbb8.js → index-52617c57.js} +7 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{uofg-back-to-top_4.cjs.entry.js → uofg-alert_6.cjs.entry.js} +161 -41
- package/dist/cjs/uofg-web-components.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/uofg-alert/uofg-alert.css +46 -0
- package/dist/collection/components/uofg-alert/uofg-alert.js +20 -0
- package/dist/collection/components/uofg-menu/uofg-menu.js +28 -50
- package/dist/collection/components/uofg-modal/uofg-modal.css +80 -0
- package/dist/collection/components/uofg-modal/uofg-modal.js +325 -0
- package/dist/collection/utils/utils.js +6 -0
- package/dist/components/font-awesome-icon.js +10 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index2.js +7 -10
- package/dist/components/uofg-alert.d.ts +11 -0
- package/dist/components/uofg-alert.js +40 -0
- package/dist/components/uofg-back-to-top.js +2 -1
- package/dist/components/uofg-footer.js +2 -1
- package/dist/components/uofg-header.js +2 -1
- package/dist/components/uofg-menu2.js +31 -46
- package/dist/components/uofg-modal.d.ts +11 -0
- package/dist/components/uofg-modal.js +139 -0
- package/dist/components/utils.js +8 -0
- package/dist/esm/{index-8ff56dd3.js → index-ebf79156.js} +7 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{uofg-back-to-top_4.entry.js → uofg-alert_6.entry.js} +160 -42
- package/dist/esm/uofg-web-components.js +3 -3
- package/dist/types/components/uofg-alert/uofg-alert.d.ts +3 -0
- package/dist/types/components/uofg-menu/uofg-menu.d.ts +4 -4
- package/dist/types/components/uofg-modal/uofg-modal.d.ts +61 -0
- package/dist/types/components.d.ts +91 -0
- package/dist/types/utils/{feature-check.d.ts → utils.d.ts} +1 -0
- package/dist/uofg-web-components/p-2c75433c.entry.js +1 -0
- package/dist/uofg-web-components/p-bc82feb9.js +2 -0
- package/dist/uofg-web-components/uofg-web-components.css +1 -1
- package/dist/uofg-web-components/uofg-web-components.esm.js +1 -1
- package/package.json +2 -2
- package/dist/collection/utils/feature-check.js +0 -2
- package/dist/uofg-web-components/p-19e62111.js +0 -2
- package/dist/uofg-web-components/p-f8060888.entry.js +0 -1
|
@@ -939,7 +939,9 @@ const patch = (oldVNode, newVNode) => {
|
|
|
939
939
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
940
940
|
}
|
|
941
941
|
{
|
|
942
|
-
|
|
942
|
+
if (tag === 'slot')
|
|
943
|
+
;
|
|
944
|
+
else {
|
|
943
945
|
// either this is the first render of an element OR it's an update
|
|
944
946
|
// AND we already know it's possible it could have changed
|
|
945
947
|
// this updates the element's css classes, attrs, props, listeners, etc.
|
|
@@ -1517,12 +1519,16 @@ const connectedCallback = (elm) => {
|
|
|
1517
1519
|
const disconnectedCallback = (elm) => {
|
|
1518
1520
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1519
1521
|
const hostRef = getHostRef(elm);
|
|
1522
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1520
1523
|
{
|
|
1521
1524
|
if (hostRef.$rmListeners$) {
|
|
1522
1525
|
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1523
1526
|
hostRef.$rmListeners$ = undefined;
|
|
1524
1527
|
}
|
|
1525
1528
|
}
|
|
1529
|
+
{
|
|
1530
|
+
safeCall(instance, 'disconnectedCallback');
|
|
1531
|
+
}
|
|
1526
1532
|
}
|
|
1527
1533
|
};
|
|
1528
1534
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-52617c57.js');
|
|
6
6
|
|
|
7
7
|
const defineCustomElements = (win, options) => {
|
|
8
8
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
9
|
-
return index.bootstrapLazy([["uofg-
|
|
9
|
+
return index.bootstrapLazy([["uofg-alert_6.cjs",[[1,"uofg-header",{"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"isFullSize":[32],"pageSpecificContent":[32]},[[9,"resize","updateFullSize"]]],[1,"uofg-alert"],[1,"uofg-back-to-top",{"threshold":[2],"isVisible":[32]},[[9,"scroll","onScroll"]]],[1,"uofg-footer"],[1,"uofg-modal",{"label":[1],"alertDialog":[4,"alert-dialog"],"centered":[4],"staticBackdrop":[4,"static-backdrop"],"autoOpen":[4,"auto-open"],"isOpen":[32],"getState":[64],"setState":[64],"toggle":[64],"close":[64],"open":[64]}],[0,"uofg-menu",{"autoCollapse":[4,"auto-collapse"],"isExpanded":[32],"getExpanded":[64],"setExpanded":[64],"toggle":[64],"collapse":[64],"expand":[64]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-52617c57.js');
|
|
6
6
|
|
|
7
7
|
const FontAwesomeIcon = props => {
|
|
8
8
|
const width = props.icon.icon[0];
|
|
@@ -11,6 +11,24 @@ const FontAwesomeIcon = props => {
|
|
|
11
11
|
return (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}` }, Array.isArray(iconPathData) ? (iconPathData.map(path => index.h("path", { d: path }))) : (index.h("path", { d: iconPathData }))));
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
var faCircleExclamation = {
|
|
15
|
+
prefix: 'far',
|
|
16
|
+
iconName: 'circle-exclamation',
|
|
17
|
+
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"]
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
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}";
|
|
21
|
+
|
|
22
|
+
const UofgAlert = class {
|
|
23
|
+
constructor(hostRef) {
|
|
24
|
+
index.registerInstance(this, hostRef);
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
return (index.h("div", { id: "uofg-alert" }, index.h("div", { id: "uofg-alert-title" }, index.h(FontAwesomeIcon, { icon: faCircleExclamation }), index.h("slot", { name: "title" })), index.h("div", { id: "uofg-alert-body" }, index.h("slot", { name: "subtitle" }), index.h("slot", { name: "message" })), index.h("div", { id: "uofg-alert-footer" }, index.h("slot", { name: "footer" }))));
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
UofgAlert.style = uofgAlertCss;
|
|
31
|
+
|
|
14
32
|
var faTrees = {
|
|
15
33
|
prefix: 'fas',
|
|
16
34
|
iconName: 'trees',
|
|
@@ -82,6 +100,12 @@ var faMagnifyingGlass = {
|
|
|
82
100
|
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"]
|
|
83
101
|
};
|
|
84
102
|
var faSearch = faMagnifyingGlass;
|
|
103
|
+
var faXmark = {
|
|
104
|
+
prefix: 'fas',
|
|
105
|
+
iconName: 'xmark',
|
|
106
|
+
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"]
|
|
107
|
+
};
|
|
108
|
+
var faTimes = faXmark;
|
|
85
109
|
var faBriefcase = {
|
|
86
110
|
prefix: 'fas',
|
|
87
111
|
iconName: 'briefcase',
|
|
@@ -311,17 +335,13 @@ UofgHeader.style = uofgHeaderCss;
|
|
|
311
335
|
|
|
312
336
|
const WEB_ANIMATIONS_SUPPORTED = 'animate' in HTMLElement.prototype;
|
|
313
337
|
const PREFERS_REDUCED_MOTION = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
338
|
+
const getAllFocusableElements = (container) => {
|
|
339
|
+
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"])';
|
|
340
|
+
return Array.from(container.querySelectorAll(query));
|
|
341
|
+
};
|
|
314
342
|
|
|
315
343
|
const DURATION_REGEX = /^(\d*\.?\d+)(s|ms)$/;
|
|
316
344
|
const EASING_FUNCTION_REGEX = /^cubic-bezier\((\s*-?\d*\.?\d+\s*,){3}\s*-?\d*\.?\d+\s*\)$|^steps\(\s*\d+\s*(,\s*(start|end))?\s*\)$/;
|
|
317
|
-
const observer = new MutationObserver(mutations => {
|
|
318
|
-
for (const mutation of mutations) {
|
|
319
|
-
mutation.target.dispatchEvent(new CustomEvent('childListChange', { bubbles: false }));
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
const observerConfig = {
|
|
323
|
-
childList: true,
|
|
324
|
-
};
|
|
325
345
|
const UofgMenu = class {
|
|
326
346
|
constructor(hostRef) {
|
|
327
347
|
index.registerInstance(this, hostRef);
|
|
@@ -333,50 +353,31 @@ const UofgMenu = class {
|
|
|
333
353
|
this.button = null;
|
|
334
354
|
this.content = null;
|
|
335
355
|
this.contentComputedStyle = null;
|
|
356
|
+
this.observer = new MutationObserver(this.handleMutation);
|
|
336
357
|
this.isExpanded = false;
|
|
337
358
|
this.autoCollapse = false;
|
|
338
359
|
}
|
|
339
360
|
connectedCallback() {
|
|
340
361
|
// Bind functions so that "this" correctly refers to the component's instance.
|
|
341
|
-
this.
|
|
342
|
-
this.
|
|
343
|
-
this.updateContent = this.updateContent.bind(this);
|
|
344
|
-
this.handleButtonClick = this.handleButtonClick.bind(this);
|
|
362
|
+
this.handleMutation = this.handleMutation.bind(this);
|
|
363
|
+
this.handleClick = this.handleClick.bind(this);
|
|
345
364
|
this.handleFocusout = this.handleFocusout.bind(this);
|
|
346
365
|
this.handleKeyUp = this.handleKeyUp.bind(this);
|
|
347
366
|
this.computedStyle = window.getComputedStyle(this.el);
|
|
348
|
-
this.
|
|
349
|
-
this.
|
|
350
|
-
observer.observe(this.el, observerConfig);
|
|
367
|
+
this.handleMutation();
|
|
368
|
+
this.observer.observe(this.el, { childList: true });
|
|
351
369
|
}
|
|
352
|
-
|
|
353
|
-
this.
|
|
354
|
-
this.updateContent();
|
|
370
|
+
disconnectedCallback() {
|
|
371
|
+
this.observer.disconnect();
|
|
355
372
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
this.isExpanded = false;
|
|
359
|
-
if (e.target !== this.button) {
|
|
360
|
-
e.stopPropagation();
|
|
361
|
-
this.isExpanded = false;
|
|
362
|
-
this.button && this.button.focus();
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
updateButton() {
|
|
367
|
-
var _a, _b, _c;
|
|
373
|
+
handleMutation() {
|
|
374
|
+
// Update the button element
|
|
368
375
|
const button = this.el.querySelector('[slot="button"]');
|
|
369
|
-
// Clean up the old button before setting the new one
|
|
370
|
-
(_a = this.button) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', this.handleButtonClick);
|
|
371
|
-
(_b = this.button) === null || _b === void 0 ? void 0 : _b.removeAttribute('aria-expanded');
|
|
372
|
-
(_c = this.button) === null || _c === void 0 ? void 0 : _c.removeAttribute('aria-haspopup');
|
|
373
376
|
// Set up the new button
|
|
374
377
|
button === null || button === void 0 ? void 0 : button.setAttribute('aria-expanded', this.isExpanded ? 'true' : 'false');
|
|
375
378
|
button === null || button === void 0 ? void 0 : button.setAttribute('aria-haspopup', 'true');
|
|
376
|
-
button === null || button === void 0 ? void 0 : button.addEventListener('click', this.handleButtonClick);
|
|
377
379
|
this.button = button;
|
|
378
|
-
|
|
379
|
-
updateContent() {
|
|
380
|
+
// Update the content element
|
|
380
381
|
const content = this.el.querySelector('[slot="content"]');
|
|
381
382
|
if (content == null) {
|
|
382
383
|
this.content = null;
|
|
@@ -388,8 +389,22 @@ const UofgMenu = class {
|
|
|
388
389
|
this.contentComputedStyle = window.getComputedStyle(this.content);
|
|
389
390
|
}
|
|
390
391
|
}
|
|
391
|
-
|
|
392
|
-
|
|
392
|
+
handleKeyUp(e) {
|
|
393
|
+
if (e.key === 'Escape') {
|
|
394
|
+
this.isExpanded = false;
|
|
395
|
+
if (e.target !== this.button) {
|
|
396
|
+
e.stopPropagation();
|
|
397
|
+
this.isExpanded = false;
|
|
398
|
+
this.button && this.button.focus();
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
handleClick(e) {
|
|
403
|
+
//Check if the click was on the button or a descendant of the button
|
|
404
|
+
if (this.button && this.button.contains(e.target)) {
|
|
405
|
+
this.isExpanded = !this.isExpanded;
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
393
408
|
}
|
|
394
409
|
handleFocusout(e) {
|
|
395
410
|
if (this.autoCollapse && !this.el.contains(e.relatedTarget)) {
|
|
@@ -515,7 +530,7 @@ const UofgMenu = class {
|
|
|
515
530
|
};
|
|
516
531
|
}
|
|
517
532
|
render() {
|
|
518
|
-
return (index.h(index.Host, {
|
|
533
|
+
return (index.h(index.Host, { "data-expanded": this.isExpanded, tabindex: -1, onFocusout: this.handleFocusout, onKeyUp: this.handleKeyUp, onClick: this.handleClick }));
|
|
519
534
|
}
|
|
520
535
|
/**
|
|
521
536
|
* Get the current expanded state of the menu.
|
|
@@ -559,7 +574,112 @@ const UofgMenu = class {
|
|
|
559
574
|
}; }
|
|
560
575
|
};
|
|
561
576
|
|
|
577
|
+
const uofgModalCss = ":host{visibility:visible !important;position:relative !important}:focus-visible{outline:2px solid #ffc72a}*{box-sizing:border-box}#uofg-modal{display:flex;position:fixed;top:0;left:0;z-index:10000;width:100vw;height:100vh;background-color:rgba(0, 0, 0, 0.5);visibility:hidden;opacity:0;padding:2rem;transition-duration:0.3s;transition-timing-function:ease-in-out;transition-property:visibility, opacity}#uofg-modal #uofg-modal-dismiss{display:flex;justify-content:center;align-items:center;position:absolute;top:0;right:0;padding:0.5rem;height:3.5rem;width:3.5rem;font-size:2rem;line-height:1;color:var(--uofg-modal-dismiss-color, #fff);background-color:transparent;border:none;cursor:pointer;z-index:2}#uofg-modal #uofg-modal-dismiss>svg{display:block;height:1em;fill:currentColor}#uofg-modal>#uofg-modal-content{position:absolute;left:50%;transition:transform 0.3s ease-in-out;transform:translate(-50%, -50px);z-index:1}@media (prefers-reduced-motion: reduce){#uofg-modal>#uofg-modal-content{transition:none}}#uofg-modal>#uofg-modal-content.centered{top:50%;transform:translate(-50%, calc(-50% - 50px))}#uofg-modal.open{visibility:visible;opacity:1}#uofg-modal.open #uofg-modal-content{visibility:visible;opacity:1;transform:translate(-50%, 0)}#uofg-modal.open #uofg-modal-content.centered{transform:translate(-50%, -50%)}";
|
|
578
|
+
|
|
579
|
+
const UofgModal = class {
|
|
580
|
+
constructor(hostRef) {
|
|
581
|
+
index.registerInstance(this, hostRef);
|
|
582
|
+
this.label = undefined;
|
|
583
|
+
this.alertDialog = false;
|
|
584
|
+
this.centered = false;
|
|
585
|
+
this.staticBackdrop = false;
|
|
586
|
+
this.autoOpen = false;
|
|
587
|
+
this.isOpen = false;
|
|
588
|
+
}
|
|
589
|
+
connectedCallback() {
|
|
590
|
+
// Bind event handlers so that 'this' is always the component instance.
|
|
591
|
+
this.handleClick = this.handleClick.bind(this);
|
|
592
|
+
this.handleKeyUp = this.handleKeyUp.bind(this);
|
|
593
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
594
|
+
if (this.autoOpen) {
|
|
595
|
+
this.isOpen = true;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
handleClick(e) {
|
|
599
|
+
if (!this.staticBackdrop && e.target === e.currentTarget) {
|
|
600
|
+
this.isOpen = false;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
handleKeyUp(e) {
|
|
604
|
+
if (e.key === 'Escape') {
|
|
605
|
+
this.isOpen = false;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
handleKeyDown(e) {
|
|
609
|
+
if (e.key === 'Tab') {
|
|
610
|
+
const focusableElements = getAllFocusableElements(this.el);
|
|
611
|
+
const firstFocusable = this.dismissButton; // The dismiss button is always the first focusable element in the modal.
|
|
612
|
+
const lastFocusable = focusableElements[focusableElements.length - 1];
|
|
613
|
+
if (e.target === firstFocusable && e.shiftKey) {
|
|
614
|
+
e.preventDefault();
|
|
615
|
+
lastFocusable === null || lastFocusable === void 0 ? void 0 : lastFocusable.focus();
|
|
616
|
+
}
|
|
617
|
+
else if (e.target === lastFocusable && !e.shiftKey) {
|
|
618
|
+
e.preventDefault();
|
|
619
|
+
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
handleIsOpenChange(newValue) {
|
|
624
|
+
if (newValue === true) {
|
|
625
|
+
window.requestAnimationFrame(() => {
|
|
626
|
+
window.requestAnimationFrame(() => {
|
|
627
|
+
window.requestAnimationFrame(() => {
|
|
628
|
+
this.dismissButton.focus();
|
|
629
|
+
});
|
|
630
|
+
});
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
render() {
|
|
635
|
+
return (index.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 }, index.h("div", { id: "uofg-modal-content", class: { centered: this.centered } }, index.h("button", { id: "uofg-modal-dismiss", "aria-label": "Close modal", ref: (el) => (this.dismissButton = el), onClick: () => (this.isOpen = false) }, index.h(FontAwesomeIcon, { icon: faTimes })), index.h("slot", null))));
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Get the current state of the modal.
|
|
639
|
+
* @returns A promise which will resolve to true when the modal is open, or false when the modal is closed.
|
|
640
|
+
*/
|
|
641
|
+
async getState() {
|
|
642
|
+
return this.isOpen;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Set the state of the modal.
|
|
646
|
+
* @param value The new state, set it to true to open the modal, or false to close the modal.
|
|
647
|
+
*/
|
|
648
|
+
async setState(value) {
|
|
649
|
+
this.isOpen = value;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Toggle the state of the modal.
|
|
653
|
+
* @returns A promise which will resolve to true (if the modal opened) or false (if the modal closed).
|
|
654
|
+
*/
|
|
655
|
+
async toggle() {
|
|
656
|
+
this.isOpen = !this.isOpen;
|
|
657
|
+
return this.isOpen;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Closes the modal.
|
|
661
|
+
* @returns empty Promise.
|
|
662
|
+
*/
|
|
663
|
+
async close() {
|
|
664
|
+
this.isOpen = false;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Opens the modal.
|
|
668
|
+
* @returns empty Promise.
|
|
669
|
+
*/
|
|
670
|
+
async open() {
|
|
671
|
+
this.isOpen = true;
|
|
672
|
+
}
|
|
673
|
+
get el() { return index.getElement(this); }
|
|
674
|
+
static get watchers() { return {
|
|
675
|
+
"isOpen": ["handleIsOpenChange"]
|
|
676
|
+
}; }
|
|
677
|
+
};
|
|
678
|
+
UofgModal.style = uofgModalCss;
|
|
679
|
+
|
|
680
|
+
exports.uofg_alert = UofgAlert;
|
|
562
681
|
exports.uofg_back_to_top = UofgBackToTop;
|
|
563
682
|
exports.uofg_footer = UofgFooter;
|
|
564
683
|
exports.uofg_header = UofgHeader;
|
|
565
684
|
exports.uofg_menu = UofgMenu;
|
|
685
|
+
exports.uofg_modal = UofgModal;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-52617c57.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Browser v4.0.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy([["uofg-
|
|
20
|
+
return index.bootstrapLazy([["uofg-alert_6.cjs",[[1,"uofg-header",{"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"isFullSize":[32],"pageSpecificContent":[32]},[[9,"resize","updateFullSize"]]],[1,"uofg-alert"],[1,"uofg-back-to-top",{"threshold":[2],"isVisible":[32]},[[9,"scroll","onScroll"]]],[1,"uofg-footer"],[1,"uofg-modal",{"label":[1],"alertDialog":[4,"alert-dialog"],"centered":[4],"staticBackdrop":[4,"static-backdrop"],"autoOpen":[4,"auto-open"],"isOpen":[32],"getState":[64],"setState":[64],"toggle":[64],"close":[64],"open":[64]}],[0,"uofg-menu",{"autoCollapse":[4,"auto-collapse"],"isExpanded":[32],"getExpanded":[64],"setExpanded":[64],"toggle":[64],"collapse":[64],"expand":[64]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
|
+
"components/uofg-alert/uofg-alert.js",
|
|
3
4
|
"components/uofg-back-to-top/uofg-back-to-top.js",
|
|
4
5
|
"components/uofg-footer/uofg-footer.js",
|
|
5
6
|
"components/uofg-header/uofg-header.js",
|
|
6
|
-
"components/uofg-menu/uofg-menu.js"
|
|
7
|
+
"components/uofg-menu/uofg-menu.js",
|
|
8
|
+
"components/uofg-modal/uofg-modal.js"
|
|
7
9
|
],
|
|
8
10
|
"compiler": {
|
|
9
11
|
"name": "@stencil/core",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
* {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#uofg-alert {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
font-size: 2rem;
|
|
13
|
+
}
|
|
14
|
+
#uofg-alert #uofg-alert-title {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
font-size: 2.25rem;
|
|
18
|
+
padding: 2rem;
|
|
19
|
+
color: white;
|
|
20
|
+
background-color: #C10631;
|
|
21
|
+
}
|
|
22
|
+
#uofg-alert #uofg-alert-title > svg {
|
|
23
|
+
margin-right: 1rem;
|
|
24
|
+
fill: currentColor;
|
|
25
|
+
height: 1.5em;
|
|
26
|
+
}
|
|
27
|
+
#uofg-alert #uofg-alert-body {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
padding: 1.5rem 2rem;
|
|
31
|
+
background-color: white;
|
|
32
|
+
}
|
|
33
|
+
#uofg-alert #uofg-alert-body slot[name=subtitle]::slotted(*) {
|
|
34
|
+
font-size: 2rem;
|
|
35
|
+
margin-bottom: 2rem;
|
|
36
|
+
font-weight: bold;
|
|
37
|
+
}
|
|
38
|
+
#uofg-alert #uofg-alert-body slot[name=message]::slotted(*) {
|
|
39
|
+
font-size: 1.6rem;
|
|
40
|
+
}
|
|
41
|
+
#uofg-alert #uofg-alert-footer {
|
|
42
|
+
display: flex;
|
|
43
|
+
padding: 1rem 2rem;
|
|
44
|
+
background-color: #DDDDDD;
|
|
45
|
+
font-size: 1.4rem;
|
|
46
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { FontAwesomeIcon } from "../../utils/font-awesome-icon";
|
|
3
|
+
import { faCircleExclamation } from "@fortawesome/pro-regular-svg-icons";
|
|
4
|
+
export class UofgAlert {
|
|
5
|
+
render() {
|
|
6
|
+
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" }))));
|
|
7
|
+
}
|
|
8
|
+
static get is() { return "uofg-alert"; }
|
|
9
|
+
static get encapsulation() { return "shadow"; }
|
|
10
|
+
static get originalStyleUrls() {
|
|
11
|
+
return {
|
|
12
|
+
"$": ["uofg-alert.scss"]
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
static get styleUrls() {
|
|
16
|
+
return {
|
|
17
|
+
"$": ["uofg-alert.css"]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,65 +1,38 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { PREFERS_REDUCED_MOTION, WEB_ANIMATIONS_SUPPORTED } from "../../utils/
|
|
2
|
+
import { PREFERS_REDUCED_MOTION, WEB_ANIMATIONS_SUPPORTED } from "../../utils/utils";
|
|
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
|
-
const observer = new MutationObserver(mutations => {
|
|
6
|
-
for (const mutation of mutations) {
|
|
7
|
-
mutation.target.dispatchEvent(new CustomEvent('childListChange', { bubbles: false }));
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
const observerConfig = {
|
|
11
|
-
childList: true,
|
|
12
|
-
};
|
|
13
5
|
export class UofgMenu {
|
|
14
6
|
constructor() {
|
|
15
7
|
this.computedStyle = null;
|
|
16
8
|
this.button = null;
|
|
17
9
|
this.content = null;
|
|
18
10
|
this.contentComputedStyle = null;
|
|
11
|
+
this.observer = new MutationObserver(this.handleMutation);
|
|
19
12
|
this.isExpanded = false;
|
|
20
13
|
this.autoCollapse = false;
|
|
21
14
|
}
|
|
22
15
|
connectedCallback() {
|
|
23
16
|
// Bind functions so that "this" correctly refers to the component's instance.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.updateContent = this.updateContent.bind(this);
|
|
27
|
-
this.handleButtonClick = this.handleButtonClick.bind(this);
|
|
17
|
+
this.handleMutation = this.handleMutation.bind(this);
|
|
18
|
+
this.handleClick = this.handleClick.bind(this);
|
|
28
19
|
this.handleFocusout = this.handleFocusout.bind(this);
|
|
29
20
|
this.handleKeyUp = this.handleKeyUp.bind(this);
|
|
30
21
|
this.computedStyle = window.getComputedStyle(this.el);
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
observer.observe(this.el, observerConfig);
|
|
22
|
+
this.handleMutation();
|
|
23
|
+
this.observer.observe(this.el, { childList: true });
|
|
34
24
|
}
|
|
35
|
-
|
|
36
|
-
this.
|
|
37
|
-
this.updateContent();
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
this.observer.disconnect();
|
|
38
27
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.isExpanded = false;
|
|
42
|
-
if (e.target !== this.button) {
|
|
43
|
-
e.stopPropagation();
|
|
44
|
-
this.isExpanded = false;
|
|
45
|
-
this.button && this.button.focus();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
updateButton() {
|
|
50
|
-
var _a, _b, _c;
|
|
28
|
+
handleMutation() {
|
|
29
|
+
// Update the button element
|
|
51
30
|
const button = this.el.querySelector('[slot="button"]');
|
|
52
|
-
// Clean up the old button before setting the new one
|
|
53
|
-
(_a = this.button) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', this.handleButtonClick);
|
|
54
|
-
(_b = this.button) === null || _b === void 0 ? void 0 : _b.removeAttribute('aria-expanded');
|
|
55
|
-
(_c = this.button) === null || _c === void 0 ? void 0 : _c.removeAttribute('aria-haspopup');
|
|
56
31
|
// Set up the new button
|
|
57
32
|
button === null || button === void 0 ? void 0 : button.setAttribute('aria-expanded', this.isExpanded ? 'true' : 'false');
|
|
58
33
|
button === null || button === void 0 ? void 0 : button.setAttribute('aria-haspopup', 'true');
|
|
59
|
-
button === null || button === void 0 ? void 0 : button.addEventListener('click', this.handleButtonClick);
|
|
60
34
|
this.button = button;
|
|
61
|
-
|
|
62
|
-
updateContent() {
|
|
35
|
+
// Update the content element
|
|
63
36
|
const content = this.el.querySelector('[slot="content"]');
|
|
64
37
|
if (content == null) {
|
|
65
38
|
this.content = null;
|
|
@@ -71,8 +44,22 @@ export class UofgMenu {
|
|
|
71
44
|
this.contentComputedStyle = window.getComputedStyle(this.content);
|
|
72
45
|
}
|
|
73
46
|
}
|
|
74
|
-
|
|
75
|
-
|
|
47
|
+
handleKeyUp(e) {
|
|
48
|
+
if (e.key === 'Escape') {
|
|
49
|
+
this.isExpanded = false;
|
|
50
|
+
if (e.target !== this.button) {
|
|
51
|
+
e.stopPropagation();
|
|
52
|
+
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
|
+
}
|
|
76
63
|
}
|
|
77
64
|
handleFocusout(e) {
|
|
78
65
|
if (this.autoCollapse && !this.el.contains(e.relatedTarget)) {
|
|
@@ -198,7 +185,7 @@ export class UofgMenu {
|
|
|
198
185
|
};
|
|
199
186
|
}
|
|
200
187
|
render() {
|
|
201
|
-
return (h(Host, {
|
|
188
|
+
return (h(Host, { "data-expanded": this.isExpanded, tabindex: -1, onFocusout: this.handleFocusout, onKeyUp: this.handleKeyUp, onClick: this.handleClick }));
|
|
202
189
|
}
|
|
203
190
|
/**
|
|
204
191
|
* Get the current expanded state of the menu.
|
|
@@ -444,13 +431,4 @@ export class UofgMenu {
|
|
|
444
431
|
"methodName": "handleIsExpandedChange"
|
|
445
432
|
}];
|
|
446
433
|
}
|
|
447
|
-
static get listeners() {
|
|
448
|
-
return [{
|
|
449
|
-
"name": "onChildListChange",
|
|
450
|
-
"method": "handleChildListChange",
|
|
451
|
-
"target": undefined,
|
|
452
|
-
"capture": false,
|
|
453
|
-
"passive": false
|
|
454
|
-
}];
|
|
455
|
-
}
|
|
456
434
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
visibility: visible !important;
|
|
3
|
+
position: relative !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:focus-visible {
|
|
7
|
+
outline: 2px solid #ffc72a;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
* {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#uofg-modal {
|
|
15
|
+
display: flex;
|
|
16
|
+
position: fixed;
|
|
17
|
+
top: 0;
|
|
18
|
+
left: 0;
|
|
19
|
+
z-index: 10000;
|
|
20
|
+
width: 100vw;
|
|
21
|
+
height: 100vh;
|
|
22
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
23
|
+
visibility: hidden;
|
|
24
|
+
opacity: 0;
|
|
25
|
+
padding: 2rem;
|
|
26
|
+
transition-duration: 0.3s;
|
|
27
|
+
transition-timing-function: ease-in-out;
|
|
28
|
+
transition-property: visibility, opacity;
|
|
29
|
+
}
|
|
30
|
+
#uofg-modal #uofg-modal-dismiss {
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
align-items: center;
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 0;
|
|
36
|
+
right: 0;
|
|
37
|
+
padding: 0.5rem;
|
|
38
|
+
height: 3.5rem;
|
|
39
|
+
width: 3.5rem;
|
|
40
|
+
font-size: 2rem;
|
|
41
|
+
line-height: 1;
|
|
42
|
+
color: var(--uofg-modal-dismiss-color, #fff);
|
|
43
|
+
background-color: transparent;
|
|
44
|
+
border: none;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
z-index: 2;
|
|
47
|
+
}
|
|
48
|
+
#uofg-modal #uofg-modal-dismiss > svg {
|
|
49
|
+
display: block;
|
|
50
|
+
height: 1em;
|
|
51
|
+
fill: currentColor;
|
|
52
|
+
}
|
|
53
|
+
#uofg-modal > #uofg-modal-content {
|
|
54
|
+
position: absolute;
|
|
55
|
+
left: 50%;
|
|
56
|
+
transition: transform 0.3s ease-in-out;
|
|
57
|
+
transform: translate(-50%, -50px);
|
|
58
|
+
z-index: 1;
|
|
59
|
+
}
|
|
60
|
+
@media (prefers-reduced-motion: reduce) {
|
|
61
|
+
#uofg-modal > #uofg-modal-content {
|
|
62
|
+
transition: none;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
#uofg-modal > #uofg-modal-content.centered {
|
|
66
|
+
top: 50%;
|
|
67
|
+
transform: translate(-50%, calc(-50% - 50px));
|
|
68
|
+
}
|
|
69
|
+
#uofg-modal.open {
|
|
70
|
+
visibility: visible;
|
|
71
|
+
opacity: 1;
|
|
72
|
+
}
|
|
73
|
+
#uofg-modal.open #uofg-modal-content {
|
|
74
|
+
visibility: visible;
|
|
75
|
+
opacity: 1;
|
|
76
|
+
transform: translate(-50%, 0);
|
|
77
|
+
}
|
|
78
|
+
#uofg-modal.open #uofg-modal-content.centered {
|
|
79
|
+
transform: translate(-50%, -50%);
|
|
80
|
+
}
|