@uoguelph/web-components 0.0.16 → 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/README.md +8 -0
- package/dist/cjs/{index-f0452ddd.js → index-52617c57.js} +11 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{uofg-footer_3.cjs.entry.js → uofg-alert_6.cjs.entry.js} +230 -82
- package/dist/cjs/uofg-web-components.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +4 -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-back-to-top/uofg-back-to-top.css +40 -0
- package/dist/collection/components/uofg-back-to-top/uofg-back-to-top.js +68 -0
- package/dist/collection/components/uofg-header/uofg-header.js +2 -2
- 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 +6 -0
- package/dist/components/index.js +3 -0
- package/dist/components/index2.js +12 -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.d.ts +11 -0
- package/dist/components/uofg-back-to-top.js +48 -0
- 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-24999f13.js → index-ebf79156.js} +11 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{uofg-footer_3.entry.js → uofg-alert_6.entry.js} +228 -83
- 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-back-to-top/uofg-back-to-top.d.ts +10 -0
- package/dist/types/components/uofg-header/uofg-header.d.ts +2 -2
- 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 +116 -4
- 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 +4 -3
- package/dist/collection/utils/feature-check.js +0 -2
- package/dist/uofg-web-components/p-b7dfbfdc.js +0 -2
- package/dist/uofg-web-components/p-d87070ab.entry.js +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { FontAwesomeIcon } from "../../utils/font-awesome-icon";
|
|
3
|
+
import { faChevronUp } from "@fortawesome/pro-solid-svg-icons";
|
|
4
|
+
export class UofgBackToTop {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.threshold = 50;
|
|
7
|
+
this.isVisible = false;
|
|
8
|
+
}
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
this.onScroll();
|
|
11
|
+
}
|
|
12
|
+
onScroll() {
|
|
13
|
+
this.isVisible = window.scrollY >= this.threshold;
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return (h("button", { id: "uofg-back-to-top", "aria-label": "Go back to the top", class: { visible: this.isVisible }, onClick: () => {
|
|
17
|
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
18
|
+
} }, h(FontAwesomeIcon, { icon: faChevronUp })));
|
|
19
|
+
}
|
|
20
|
+
static get is() { return "uofg-back-to-top"; }
|
|
21
|
+
static get encapsulation() { return "shadow"; }
|
|
22
|
+
static get originalStyleUrls() {
|
|
23
|
+
return {
|
|
24
|
+
"$": ["uofg-back-to-top.scss"]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
static get styleUrls() {
|
|
28
|
+
return {
|
|
29
|
+
"$": ["uofg-back-to-top.css"]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static get properties() {
|
|
33
|
+
return {
|
|
34
|
+
"threshold": {
|
|
35
|
+
"type": "number",
|
|
36
|
+
"mutable": false,
|
|
37
|
+
"complexType": {
|
|
38
|
+
"original": "number",
|
|
39
|
+
"resolved": "number",
|
|
40
|
+
"references": {}
|
|
41
|
+
},
|
|
42
|
+
"required": false,
|
|
43
|
+
"optional": false,
|
|
44
|
+
"docs": {
|
|
45
|
+
"tags": [],
|
|
46
|
+
"text": "The number of pixels the user has to scroll down before the button appears."
|
|
47
|
+
},
|
|
48
|
+
"attribute": "threshold",
|
|
49
|
+
"reflect": false,
|
|
50
|
+
"defaultValue": "50"
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
static get states() {
|
|
55
|
+
return {
|
|
56
|
+
"isVisible": {}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static get listeners() {
|
|
60
|
+
return [{
|
|
61
|
+
"name": "scroll",
|
|
62
|
+
"method": "onScroll",
|
|
63
|
+
"target": "window",
|
|
64
|
+
"capture": false,
|
|
65
|
+
"passive": true
|
|
66
|
+
}];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -84,7 +84,7 @@ export class UofgHeader {
|
|
|
84
84
|
"optional": false,
|
|
85
85
|
"docs": {
|
|
86
86
|
"tags": [],
|
|
87
|
-
"text": "The title of the
|
|
87
|
+
"text": "The title of the department/topic that the header is being used for. For example, for the Convocation pages, this would be set to \"Convocation\"."
|
|
88
88
|
},
|
|
89
89
|
"attribute": "page-title",
|
|
90
90
|
"reflect": false,
|
|
@@ -102,7 +102,7 @@ export class UofgHeader {
|
|
|
102
102
|
"optional": false,
|
|
103
103
|
"docs": {
|
|
104
104
|
"tags": [],
|
|
105
|
-
"text": "The URL to the home/landing page
|
|
105
|
+
"text": "The URL to the home/landing page of the department/topic the header is being used for. For example, for the Convocation pages, this would be set to \"https://www.uoguelph.ca/convocation/\"."
|
|
106
106
|
},
|
|
107
107
|
"attribute": "page-url",
|
|
108
108
|
"reflect": false,
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { FontAwesomeIcon } from "../../utils/font-awesome-icon";
|
|
3
|
+
import { faTimes } from "@fortawesome/pro-solid-svg-icons";
|
|
4
|
+
import { getAllFocusableElements } from "../../utils/utils";
|
|
5
|
+
export class UofgModal {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.label = undefined;
|
|
8
|
+
this.alertDialog = false;
|
|
9
|
+
this.centered = false;
|
|
10
|
+
this.staticBackdrop = false;
|
|
11
|
+
this.autoOpen = false;
|
|
12
|
+
this.isOpen = false;
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
// Bind event handlers so that 'this' is always the component instance.
|
|
16
|
+
this.handleClick = this.handleClick.bind(this);
|
|
17
|
+
this.handleKeyUp = this.handleKeyUp.bind(this);
|
|
18
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
19
|
+
if (this.autoOpen) {
|
|
20
|
+
this.isOpen = true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
handleClick(e) {
|
|
24
|
+
if (!this.staticBackdrop && e.target === e.currentTarget) {
|
|
25
|
+
this.isOpen = false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
handleKeyUp(e) {
|
|
29
|
+
if (e.key === 'Escape') {
|
|
30
|
+
this.isOpen = false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
handleKeyDown(e) {
|
|
34
|
+
if (e.key === 'Tab') {
|
|
35
|
+
const focusableElements = getAllFocusableElements(this.el);
|
|
36
|
+
const firstFocusable = this.dismissButton; // The dismiss button is always the first focusable element in the modal.
|
|
37
|
+
const lastFocusable = focusableElements[focusableElements.length - 1];
|
|
38
|
+
if (e.target === firstFocusable && e.shiftKey) {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
lastFocusable === null || lastFocusable === void 0 ? void 0 : lastFocusable.focus();
|
|
41
|
+
}
|
|
42
|
+
else if (e.target === lastFocusable && !e.shiftKey) {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
handleIsOpenChange(newValue) {
|
|
49
|
+
if (newValue === true) {
|
|
50
|
+
window.requestAnimationFrame(() => {
|
|
51
|
+
window.requestAnimationFrame(() => {
|
|
52
|
+
window.requestAnimationFrame(() => {
|
|
53
|
+
this.dismissButton.focus();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
render() {
|
|
60
|
+
return (h("div", { id: "uofg-modal", class: { open: this.isOpen }, role: this.isOpen ? (this.alertDialog ? 'alertdialog' : 'dialog') : '', "aria-modal": this.isOpen, "aria-label": this.label, "aria-hidden": !this.isOpen, tabIndex: -1, onClick: this.handleClick, onKeyUp: this.handleKeyUp, onKeyDown: this.handleKeyDown }, h("div", { id: "uofg-modal-content", class: { centered: this.centered } }, h("button", { id: "uofg-modal-dismiss", "aria-label": "Close modal", ref: (el) => (this.dismissButton = el), onClick: () => (this.isOpen = false) }, h(FontAwesomeIcon, { icon: faTimes })), h("slot", null))));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get the current state of the modal.
|
|
64
|
+
* @returns A promise which will resolve to true when the modal is open, or false when the modal is closed.
|
|
65
|
+
*/
|
|
66
|
+
async getState() {
|
|
67
|
+
return this.isOpen;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Set the state of the modal.
|
|
71
|
+
* @param value The new state, set it to true to open the modal, or false to close the modal.
|
|
72
|
+
*/
|
|
73
|
+
async setState(value) {
|
|
74
|
+
this.isOpen = value;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Toggle the state of the modal.
|
|
78
|
+
* @returns A promise which will resolve to true (if the modal opened) or false (if the modal closed).
|
|
79
|
+
*/
|
|
80
|
+
async toggle() {
|
|
81
|
+
this.isOpen = !this.isOpen;
|
|
82
|
+
return this.isOpen;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Closes the modal.
|
|
86
|
+
* @returns empty Promise.
|
|
87
|
+
*/
|
|
88
|
+
async close() {
|
|
89
|
+
this.isOpen = false;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Opens the modal.
|
|
93
|
+
* @returns empty Promise.
|
|
94
|
+
*/
|
|
95
|
+
async open() {
|
|
96
|
+
this.isOpen = true;
|
|
97
|
+
}
|
|
98
|
+
static get is() { return "uofg-modal"; }
|
|
99
|
+
static get encapsulation() { return "shadow"; }
|
|
100
|
+
static get originalStyleUrls() {
|
|
101
|
+
return {
|
|
102
|
+
"$": ["uofg-modal.scss"]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
static get styleUrls() {
|
|
106
|
+
return {
|
|
107
|
+
"$": ["uofg-modal.css"]
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
static get properties() {
|
|
111
|
+
return {
|
|
112
|
+
"label": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"mutable": false,
|
|
115
|
+
"complexType": {
|
|
116
|
+
"original": "string",
|
|
117
|
+
"resolved": "string",
|
|
118
|
+
"references": {}
|
|
119
|
+
},
|
|
120
|
+
"required": false,
|
|
121
|
+
"optional": false,
|
|
122
|
+
"docs": {
|
|
123
|
+
"tags": [],
|
|
124
|
+
"text": "The label for the modal. It is recommended that you set this to describe the modal's content.\nThis is required for accessibility."
|
|
125
|
+
},
|
|
126
|
+
"attribute": "label",
|
|
127
|
+
"reflect": false
|
|
128
|
+
},
|
|
129
|
+
"alertDialog": {
|
|
130
|
+
"type": "boolean",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "boolean",
|
|
134
|
+
"resolved": "boolean",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": "Used to determine whether the modal should be rendered as an alert dialog.\nThis is useful for when you want to use the modal to alert the user of something, rather than to ask the user to make a decision.\nIf this is set to true, the modal will be rendered with a role of \"alertdialog\" instead of \"dialog\"."
|
|
142
|
+
},
|
|
143
|
+
"attribute": "alert-dialog",
|
|
144
|
+
"reflect": false,
|
|
145
|
+
"defaultValue": "false"
|
|
146
|
+
},
|
|
147
|
+
"centered": {
|
|
148
|
+
"type": "boolean",
|
|
149
|
+
"mutable": false,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "boolean",
|
|
152
|
+
"resolved": "boolean",
|
|
153
|
+
"references": {}
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"optional": false,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [],
|
|
159
|
+
"text": "Used to determine whether the modal content is centered vertically."
|
|
160
|
+
},
|
|
161
|
+
"attribute": "centered",
|
|
162
|
+
"reflect": false,
|
|
163
|
+
"defaultValue": "false"
|
|
164
|
+
},
|
|
165
|
+
"staticBackdrop": {
|
|
166
|
+
"type": "boolean",
|
|
167
|
+
"mutable": false,
|
|
168
|
+
"complexType": {
|
|
169
|
+
"original": "boolean",
|
|
170
|
+
"resolved": "boolean",
|
|
171
|
+
"references": {}
|
|
172
|
+
},
|
|
173
|
+
"required": false,
|
|
174
|
+
"optional": false,
|
|
175
|
+
"docs": {
|
|
176
|
+
"tags": [],
|
|
177
|
+
"text": "Used to determine whether clicking on the backdrop of the modal will close the modal.\nIf this is set to true, clicking on the backdrop will NOT close the modal."
|
|
178
|
+
},
|
|
179
|
+
"attribute": "static-backdrop",
|
|
180
|
+
"reflect": false,
|
|
181
|
+
"defaultValue": "false"
|
|
182
|
+
},
|
|
183
|
+
"autoOpen": {
|
|
184
|
+
"type": "boolean",
|
|
185
|
+
"mutable": false,
|
|
186
|
+
"complexType": {
|
|
187
|
+
"original": "boolean",
|
|
188
|
+
"resolved": "boolean",
|
|
189
|
+
"references": {}
|
|
190
|
+
},
|
|
191
|
+
"required": false,
|
|
192
|
+
"optional": false,
|
|
193
|
+
"docs": {
|
|
194
|
+
"tags": [],
|
|
195
|
+
"text": "Used to determine whether the modal should open automatically when the component is first rendered.\nIt is important to ensure this is only set to true for ONE modal on the page."
|
|
196
|
+
},
|
|
197
|
+
"attribute": "auto-open",
|
|
198
|
+
"reflect": false,
|
|
199
|
+
"defaultValue": "false"
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
static get states() {
|
|
204
|
+
return {
|
|
205
|
+
"isOpen": {}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
static get methods() {
|
|
209
|
+
return {
|
|
210
|
+
"getState": {
|
|
211
|
+
"complexType": {
|
|
212
|
+
"signature": "() => Promise<boolean>",
|
|
213
|
+
"parameters": [],
|
|
214
|
+
"references": {
|
|
215
|
+
"Promise": {
|
|
216
|
+
"location": "global",
|
|
217
|
+
"id": "global::Promise"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"return": "Promise<boolean>"
|
|
221
|
+
},
|
|
222
|
+
"docs": {
|
|
223
|
+
"text": "Get the current state of the modal.",
|
|
224
|
+
"tags": [{
|
|
225
|
+
"name": "returns",
|
|
226
|
+
"text": "A promise which will resolve to true when the modal is open, or false when the modal is closed."
|
|
227
|
+
}]
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"setState": {
|
|
231
|
+
"complexType": {
|
|
232
|
+
"signature": "(value: boolean) => Promise<void>",
|
|
233
|
+
"parameters": [{
|
|
234
|
+
"tags": [{
|
|
235
|
+
"name": "param",
|
|
236
|
+
"text": "value The new state, set it to true to open the modal, or false to close the modal."
|
|
237
|
+
}],
|
|
238
|
+
"text": "The new state, set it to true to open the modal, or false to close the modal."
|
|
239
|
+
}],
|
|
240
|
+
"references": {
|
|
241
|
+
"Promise": {
|
|
242
|
+
"location": "global",
|
|
243
|
+
"id": "global::Promise"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"return": "Promise<void>"
|
|
247
|
+
},
|
|
248
|
+
"docs": {
|
|
249
|
+
"text": "Set the state of the modal.",
|
|
250
|
+
"tags": [{
|
|
251
|
+
"name": "param",
|
|
252
|
+
"text": "value The new state, set it to true to open the modal, or false to close the modal."
|
|
253
|
+
}]
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
"toggle": {
|
|
257
|
+
"complexType": {
|
|
258
|
+
"signature": "() => Promise<boolean>",
|
|
259
|
+
"parameters": [],
|
|
260
|
+
"references": {
|
|
261
|
+
"Promise": {
|
|
262
|
+
"location": "global",
|
|
263
|
+
"id": "global::Promise"
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"return": "Promise<boolean>"
|
|
267
|
+
},
|
|
268
|
+
"docs": {
|
|
269
|
+
"text": "Toggle the state of the modal.",
|
|
270
|
+
"tags": [{
|
|
271
|
+
"name": "returns",
|
|
272
|
+
"text": "A promise which will resolve to true (if the modal opened) or false (if the modal closed)."
|
|
273
|
+
}]
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
"close": {
|
|
277
|
+
"complexType": {
|
|
278
|
+
"signature": "() => Promise<void>",
|
|
279
|
+
"parameters": [],
|
|
280
|
+
"references": {
|
|
281
|
+
"Promise": {
|
|
282
|
+
"location": "global",
|
|
283
|
+
"id": "global::Promise"
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
"return": "Promise<void>"
|
|
287
|
+
},
|
|
288
|
+
"docs": {
|
|
289
|
+
"text": "Closes the modal.",
|
|
290
|
+
"tags": [{
|
|
291
|
+
"name": "returns",
|
|
292
|
+
"text": "empty Promise."
|
|
293
|
+
}]
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"open": {
|
|
297
|
+
"complexType": {
|
|
298
|
+
"signature": "() => Promise<void>",
|
|
299
|
+
"parameters": [],
|
|
300
|
+
"references": {
|
|
301
|
+
"Promise": {
|
|
302
|
+
"location": "global",
|
|
303
|
+
"id": "global::Promise"
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"return": "Promise<void>"
|
|
307
|
+
},
|
|
308
|
+
"docs": {
|
|
309
|
+
"text": "Opens the modal.",
|
|
310
|
+
"tags": [{
|
|
311
|
+
"name": "returns",
|
|
312
|
+
"text": "empty Promise."
|
|
313
|
+
}]
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
static get elementRef() { return "el"; }
|
|
319
|
+
static get watchers() {
|
|
320
|
+
return [{
|
|
321
|
+
"propName": "isOpen",
|
|
322
|
+
"methodName": "handleIsOpenChange"
|
|
323
|
+
}];
|
|
324
|
+
}
|
|
325
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const WEB_ANIMATIONS_SUPPORTED = 'animate' in HTMLElement.prototype;
|
|
2
|
+
export const PREFERS_REDUCED_MOTION = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
3
|
+
export const getAllFocusableElements = (container) => {
|
|
4
|
+
const query = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [contenteditable], audio[controls], video[controls], details, summary, [tabindex]:not([tabindex="-1"])';
|
|
5
|
+
return Array.from(container.querySelectorAll(query));
|
|
6
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const FontAwesomeIcon = props => {
|
|
4
|
+
const width = props.icon.icon[0];
|
|
5
|
+
const height = props.icon.icon[1];
|
|
6
|
+
const iconPathData = props.icon.icon[4];
|
|
7
|
+
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}` }, Array.isArray(iconPathData) ? (iconPathData.map(path => h("path", { d: path }))) : (h("path", { d: iconPathData }))));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { FontAwesomeIcon as F };
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/* UofgWebComponents custom elements */
|
|
2
|
+
export { UofgAlert as UofgAlert } from '../types/components/uofg-alert/uofg-alert';
|
|
3
|
+
export { defineCustomElement as defineCustomElementUofgAlert } from './uofg-alert';
|
|
4
|
+
export { UofgBackToTop as UofgBackToTop } from '../types/components/uofg-back-to-top/uofg-back-to-top';
|
|
5
|
+
export { defineCustomElement as defineCustomElementUofgBackToTop } from './uofg-back-to-top';
|
|
2
6
|
export { UofgFooter as UofgFooter } from '../types/components/uofg-footer/uofg-footer';
|
|
3
7
|
export { defineCustomElement as defineCustomElementUofgFooter } from './uofg-footer';
|
|
4
8
|
export { UofgHeader as UofgHeader } from '../types/components/uofg-header/uofg-header';
|
|
5
9
|
export { defineCustomElement as defineCustomElementUofgHeader } from './uofg-header';
|
|
6
10
|
export { UofgMenu as UofgMenu } from '../types/components/uofg-menu/uofg-menu';
|
|
7
11
|
export { defineCustomElement as defineCustomElementUofgMenu } from './uofg-menu';
|
|
12
|
+
export { UofgModal as UofgModal } from '../types/components/uofg-modal/uofg-modal';
|
|
13
|
+
export { defineCustomElement as defineCustomElementUofgModal } from './uofg-modal';
|
|
8
14
|
|
|
9
15
|
/**
|
|
10
16
|
* Used to manually set the base path where assets can be found.
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
+
export { UofgAlert, defineCustomElement as defineCustomElementUofgAlert } from './uofg-alert.js';
|
|
3
|
+
export { UofgBackToTop, defineCustomElement as defineCustomElementUofgBackToTop } from './uofg-back-to-top.js';
|
|
2
4
|
export { UofgFooter, defineCustomElement as defineCustomElementUofgFooter } from './uofg-footer.js';
|
|
3
5
|
export { UofgHeader, defineCustomElement as defineCustomElementUofgHeader } from './uofg-header.js';
|
|
4
6
|
export { UofgMenu, defineCustomElement as defineCustomElementUofgMenu } from './uofg-menu.js';
|
|
7
|
+
export { UofgModal, defineCustomElement as defineCustomElementUofgModal } from './uofg-modal.js';
|