@uoguelph/web-components 0.0.25 → 0.0.27

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 (45) hide show
  1. package/dist/cjs/uofg-alert_6.cjs.entry.js +802 -197
  2. package/dist/collection/components/uofg-alert/uofg-alert.css +9 -6
  3. package/dist/collection/components/uofg-footer/uofg-footer.css +32 -14
  4. package/dist/collection/components/uofg-footer/uofg-footer.js +19 -4
  5. package/dist/collection/components/uofg-header/uofg-header.css +18 -82
  6. package/dist/collection/components/uofg-header/uofg-header.js +25 -9
  7. package/dist/collection/components/uofg-menu/uofg-menu.js +1 -1
  8. package/dist/collection/components/uofg-modal/uofg-modal.css +40 -15
  9. package/dist/collection/components/uofg-modal/uofg-modal.js +41 -2
  10. package/dist/collection/utils/utils.js +9 -2
  11. package/dist/components/_commonjsHelpers.js +15 -0
  12. package/dist/components/font-awesome-icon.js +10 -0
  13. package/dist/components/index2.js +1 -81
  14. package/dist/components/uofg-alert.js +3 -2
  15. package/dist/components/uofg-back-to-top.js +2 -1
  16. package/dist/components/uofg-footer.js +569 -64
  17. package/dist/components/uofg-header.js +173 -60
  18. package/dist/components/uofg-menu2.js +1 -1
  19. package/dist/components/uofg-modal.js +44 -4
  20. package/dist/components/utils.js +10 -3
  21. package/dist/esm/uofg-alert_6.entry.js +802 -197
  22. package/dist/types/components/uofg-header/uofg-header.d.ts +11 -1
  23. package/dist/types/components/uofg-modal/uofg-modal.d.ts +2 -0
  24. package/dist/types/utils/utils.d.ts +3 -2
  25. package/dist/uofg-web-components/p-d1e2ecf9.entry.js +1 -0
  26. package/dist/uofg-web-components/uofg-web-components.css +1 -1
  27. package/dist/uofg-web-components/uofg-web-components.esm.js +1 -1
  28. package/package.json +5 -2
  29. package/dist/collection/components/uofg-footer/footer-links.js +0 -5
  30. package/dist/collection/components/uofg-footer/social-links.js +0 -5
  31. package/dist/collection/components/uofg-header/global-links.js +0 -2
  32. package/dist/collection/components/uofg-header/hello-you.js +0 -4
  33. package/dist/collection/components/uofg-header/page-specific.js +0 -15
  34. package/dist/collection/components/uofg-header/search.js +0 -4
  35. package/dist/collection/components/uofg-header/single-sign-on.js +0 -2
  36. package/dist/types/components/uofg-footer/footer-links.d.ts +0 -2
  37. package/dist/types/components/uofg-footer/social-links.d.ts +0 -2
  38. package/dist/types/components/uofg-header/global-links.d.ts +0 -2
  39. package/dist/types/components/uofg-header/hello-you.d.ts +0 -6
  40. package/dist/types/components/uofg-header/page-specific.d.ts +0 -17
  41. package/dist/types/components/uofg-header/search.d.ts +0 -2
  42. package/dist/types/components/uofg-header/single-sign-on.d.ts +0 -2
  43. package/dist/uofg-web-components/p-6936e654.entry.js +0 -1
  44. /package/dist/collection/components/uofg-header/{logo-full-size.svg → logo-full.svg} +0 -0
  45. /package/dist/collection/components/uofg-header/{logo-reduced-size.svg → logo-reduced.svg} +0 -0
@@ -12,7 +12,8 @@
12
12
  flex-direction: column;
13
13
  font-size: 2rem;
14
14
  }
15
- #uofg-alert #uofg-alert-title {
15
+
16
+ #uofg-alert-title {
16
17
  display: flex;
17
18
  align-items: center;
18
19
  font-size: 2.25rem;
@@ -20,26 +21,28 @@
20
21
  color: white;
21
22
  background-color: #c10631;
22
23
  }
23
- #uofg-alert #uofg-alert-title > svg {
24
+ #uofg-alert-title > svg {
24
25
  margin-right: 1rem;
25
26
  fill: currentColor;
26
27
  height: 1.5em;
27
28
  }
28
- #uofg-alert #uofg-alert-body {
29
+
30
+ #uofg-alert-body {
29
31
  display: flex;
30
32
  flex-direction: column;
31
33
  padding: 1.5rem 2rem;
32
34
  background-color: white;
33
35
  }
34
- #uofg-alert #uofg-alert-body slot[name=subtitle]::slotted(*) {
36
+ #uofg-alert-body slot[name=subtitle]::slotted(*) {
35
37
  font-size: 2rem;
36
38
  margin-bottom: 2rem;
37
39
  font-weight: bold;
38
40
  }
39
- #uofg-alert #uofg-alert-body slot[name=message]::slotted(*) {
41
+ #uofg-alert-body slot[name=message]::slotted(*) {
40
42
  font-size: 1.6rem;
41
43
  }
42
- #uofg-alert #uofg-alert-footer {
44
+
45
+ #uofg-alert-footer {
43
46
  display: flex;
44
47
  padding: 1rem 2rem;
45
48
  background-color: #dddddd;
@@ -5,13 +5,33 @@
5
5
  font-family: sans-serif;
6
6
  }
7
7
 
8
+ :focus-visible {
9
+ outline: 2px solid #ffc72a;
10
+ outline-offset: 0.5rem;
11
+ }
12
+
8
13
  * {
9
14
  box-sizing: border-box;
10
15
  }
11
16
 
12
- :focus-visible {
13
- outline: 2px solid #ffc72a;
14
- outline-offset: 0.5rem;
17
+ button {
18
+ border: none;
19
+ background-color: transparent;
20
+ cursor: pointer;
21
+ }
22
+
23
+ a {
24
+ color: inherit;
25
+ text-decoration: none;
26
+ }
27
+
28
+ ul {
29
+ list-style: none;
30
+ padding: 0;
31
+ margin: unset;
32
+ }
33
+ ul > li {
34
+ display: contents;
15
35
  }
16
36
 
17
37
  a {
@@ -19,14 +39,13 @@ a {
19
39
  align-items: center;
20
40
  gap: 0.5rem;
21
41
  border-bottom: 2px dotted transparent;
22
- transition-property: border-color;
23
42
  width: fit-content;
24
43
  color: inherit;
25
- transition-duration: 200ms;
26
- transition-timing-function: ease-in-out;
27
- text-decoration: none;
28
44
  white-space: nowrap;
29
45
  padding-bottom: 0.2rem;
46
+ transition-property: border-color;
47
+ transition-duration: 0.2s;
48
+ transition-timing-function: ease-in-out;
30
49
  }
31
50
  a:hover, a:focus {
32
51
  border-color: currentColor;
@@ -37,12 +56,7 @@ svg {
37
56
  height: 1.6rem;
38
57
  }
39
58
 
40
- ul {
41
- list-style: none;
42
- padding: 0;
43
- margin: unset;
44
- }
45
- ul li {
59
+ li {
46
60
  display: contents;
47
61
  }
48
62
 
@@ -60,7 +74,7 @@ ul li {
60
74
  grid-template-columns: 1fr;
61
75
  gap: 2rem;
62
76
  width: 100%;
63
- max-width: 1370px;
77
+ max-width: 1500px;
64
78
  }
65
79
  @media (min-width: 570px) {
66
80
  #uofg-footer-content {
@@ -84,6 +98,8 @@ ul li {
84
98
 
85
99
  #uofg-footer-improve-life {
86
100
  transition-property: opacity;
101
+ transition-duration: 0.2s;
102
+ transition-timing-function: ease-in-out;
87
103
  border: 0;
88
104
  }
89
105
  #uofg-footer-improve-life > svg {
@@ -103,6 +119,8 @@ ul li {
103
119
  }
104
120
  #uofg-footer-social-links a {
105
121
  transition-property: color;
122
+ transition-duration: 0.2s;
123
+ transition-timing-function: ease-in-out;
106
124
  border: 0;
107
125
  }
108
126
  #uofg-footer-social-links a:hover, #uofg-footer-social-links a:focus {
@@ -1,12 +1,27 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { FontAwesomeIcon } from "../../utils/font-awesome-icon";
3
- import { SocialLinks } from "./social-links";
4
- import { FooterLinks } from "./footer-links";
5
- import { faPhoneFlip } from "@fortawesome/free-solid-svg-icons";
6
3
  import improveLifeLogo from "./improve-life.svg";
4
+ import { faBriefcase } from "@fortawesome/free-solid-svg-icons/faBriefcase";
5
+ import { faCalendar } from "@fortawesome/free-solid-svg-icons/faCalendar";
6
+ import { faCircleCheck } from "@fortawesome/free-solid-svg-icons/faCircleCheck";
7
+ import { faHandHoldingHeart } from "@fortawesome/free-solid-svg-icons/faHandHoldingHeart";
8
+ import { faKey } from "@fortawesome/free-solid-svg-icons/faKey";
9
+ import { faList } from "@fortawesome/free-solid-svg-icons/faList";
10
+ import { faSitemap } from "@fortawesome/free-solid-svg-icons/faSitemap";
11
+ import { faTree } from "@fortawesome/free-solid-svg-icons/faTree";
12
+ import { faUniversalAccess } from "@fortawesome/free-solid-svg-icons/faUniversalAccess";
13
+ import { faPhoneFlip } from "@fortawesome/free-solid-svg-icons/faPhoneFlip";
14
+ import { faFacebookSquare } from "@fortawesome/free-brands-svg-icons/faFacebookSquare";
15
+ import { faInstagram } from "@fortawesome/free-brands-svg-icons/faInstagram";
16
+ import { faLinkedin } from "@fortawesome/free-brands-svg-icons/faLinkedin";
17
+ import { faTiktok } from "@fortawesome/free-brands-svg-icons/faTiktok";
18
+ import { faTwitterSquare } from "@fortawesome/free-brands-svg-icons/faTwitterSquare";
19
+ import { faYoutube } from "@fortawesome/free-brands-svg-icons/faYoutube";
20
+ const SocialLink = props => (h("li", null, h("a", { href: props.url, "aria-label": props.name }, h(FontAwesomeIcon, { icon: props.icon }))));
21
+ const FooterLink = props => (h("li", null, h("a", { href: props.url, title: props.title }, h(FontAwesomeIcon, { icon: props.icon }), h("span", null, props.text))));
7
22
  export class UofgFooter {
8
23
  render() {
9
- return (h("footer", { id: "uofg-footer" }, h("div", { id: "uofg-footer-content" }, h("div", { id: "uofg-footer-social", class: "uofg-footer-content-separator" }, h("a", { id: "uofg-footer-improve-life", href: "//www.uoguelph.ca/improve-life", "aria-label": "Improve Life", innerHTML: improveLifeLogo }), h(SocialLinks, null), h("a", { href: "https://www.uoguelph.ca/web/socialmedia/" }, "Social Media Directory"), h("a", { href: "//www.uoguelph.ca/web/" }, "\u00A9 ", new Date().getFullYear(), " University of Guelph")), h(FooterLinks, null), h("address", { id: "uofg-footer-address", class: "uofg-footer-content-separator" }, h("strong", null, "University of Guelph"), h("span", null, "50 Stone Road East,"), h("span", null, "Guelph, Ontario, Canada"), h("span", null, "N1G 2W1"), h("a", { href: "tel:1-519-824-4120" }, h(FontAwesomeIcon, { icon: faPhoneFlip }), h("span", null, "519-824-4120"))))));
24
+ return (h("footer", { id: "uofg-footer" }, h("div", { id: "uofg-footer-content" }, h("div", { id: "uofg-footer-social", class: "uofg-footer-content-separator" }, h("a", { id: "uofg-footer-improve-life", href: "//www.uoguelph.ca/improve-life", "aria-label": "Improve Life", innerHTML: improveLifeLogo }), h("ul", { id: "uofg-footer-social-links" }, h(SocialLink, { name: "Twitter", url: "https://twitter.com/uofg", icon: faTwitterSquare }), h(SocialLink, { name: "Facebook", url: "https://www.facebook.com/uofguelph", icon: faFacebookSquare }), h(SocialLink, { name: "Instagram", url: "https://www.instagram.com/uofguelph/", icon: faInstagram }), h(SocialLink, { name: "Youtube", url: "https://www.youtube.com/user/uofguelph", icon: faYoutube }), h(SocialLink, { name: "LinkedIn", url: "https://www.linkedin.com/school/university-of-guelph/", icon: faLinkedin }), h(SocialLink, { name: "TikTok", url: "https://www.tiktok.com/@uofguelph", icon: faTiktok })), h("a", { href: "https://www.uoguelph.ca/web/socialmedia/" }, "Social Media Directory"), h("a", { href: "//www.uoguelph.ca/web/" }, "\u00A9 ", new Date().getFullYear(), " University of Guelph")), h("ul", { id: "uofg-footer-links", class: "uofg-footer-content-separator" }, h(FooterLink, { text: "Accessibility", url: "https://www.uoguelph.ca/diversity-human-rights/accessibility-u-g", icon: faUniversalAccess }), h(FooterLink, { text: "Privacy", url: "https://www.uoguelph.ca/web/privacy/", icon: faKey }), h(FooterLink, { text: "Site Map", url: "https://www.uoguelph.ca/site-map/", icon: faSitemap }), h(FooterLink, { text: "Status Page", url: "https://uoguelph.statuspage.io/", icon: faCircleCheck }), h(FooterLink, { text: "Land Acknowledgement", url: "https://www.uoguelph.ca/land-acknowledgement/", icon: faTree, title: "The University of Guelph resides on the treaty lands and territory of the Mississaugas of the Credit. We recognize that today this gathering place is home to many First Nations, Inuit and M\u00E9tis peoples and acknowledging them reminds us of our collective responsibility to the land where we learn and work." }), h(FooterLink, { text: "Careers", url: "https://www.uoguelph.ca/hr/careers-guelph/current-opportunities", icon: faBriefcase }), h(FooterLink, { text: "Undergraduate Calendar", url: "https://www.uoguelph.ca/registrar/calendars/undergraduate/current/", icon: faCalendar }), h(FooterLink, { text: "Graduate Calendar", url: "https://www.uoguelph.ca/registrar/calendars/graduate/current/", icon: faCalendar }), h(FooterLink, { text: "Program Plans", url: "https://admission.uoguelph.ca/programs", icon: faList }), h(FooterLink, { text: "Give to U of G", url: "https://www.alumni.uoguelph.ca/give-to-guelph/how-to-give", icon: faHandHoldingHeart })), h("address", { id: "uofg-footer-address", class: "uofg-footer-content-separator" }, h("strong", null, "University of Guelph"), h("span", null, "50 Stone Road East,"), h("span", null, "Guelph, Ontario, Canada"), h("span", null, "N1G 2W1"), h("a", { href: "tel:1-519-824-4120" }, h(FontAwesomeIcon, { icon: faPhoneFlip }), h("span", null, "519-824-4120"))))));
10
25
  }
11
26
  static get is() { return "uofg-footer"; }
12
27
  static get encapsulation() { return "shadow"; }
@@ -6,30 +6,38 @@
6
6
  box-sizing: border-box;
7
7
  }
8
8
 
9
- :focus-visible {
10
- outline: 2px solid #ffc72a;
11
- outline-offset: 0.5rem;
9
+ button {
10
+ border: none;
11
+ background-color: transparent;
12
+ cursor: pointer;
12
13
  }
13
14
 
14
15
  a {
15
- display: flex;
16
- align-items: center;
17
- text-decoration: none;
18
16
  color: inherit;
19
- transition-property: color, background-color;
20
- transition-duration: 0.2s;
21
- transition-timing-function: ease-in-out;
17
+ text-decoration: none;
22
18
  }
23
19
 
24
20
  ul {
25
21
  list-style: none;
26
- margin: 0;
27
22
  padding: 0;
23
+ margin: unset;
28
24
  }
29
25
  ul > li {
30
26
  display: contents;
31
27
  }
32
28
 
29
+ a {
30
+ display: flex;
31
+ align-items: center;
32
+ transition-property: color, background-color;
33
+ transition-duration: 0.2s;
34
+ transition-timing-function: ease-in-out;
35
+ }
36
+
37
+ li {
38
+ display: contents;
39
+ }
40
+
33
41
  button {
34
42
  border: none;
35
43
  background: none;
@@ -44,32 +52,6 @@ button {
44
52
  transition-duration: 0.2s;
45
53
  transition-timing-function: ease-in-out;
46
54
  }
47
- button[type=submit] {
48
- display: flex;
49
- align-items: center;
50
- justify-content: center;
51
- background-color: #d50029;
52
- color: #fff;
53
- padding: 0.5rem;
54
- font-size: inherit;
55
- font-family: inherit;
56
- }
57
-
58
- input[type=text],
59
- input[type=password] {
60
- background-color: #eff6f7;
61
- border: 1px solid #69a3b9;
62
- padding: 1rem;
63
- color: #555555;
64
- font-size: inherit;
65
- font-family: inherit;
66
- }
67
- input[type=text]:focus-visible, input[type=text]:focus,
68
- input[type=password]:focus-visible,
69
- input[type=password]:focus {
70
- outline: none;
71
- background-color: #fffdf7;
72
- }
73
55
 
74
56
  uofg-menu {
75
57
  --uofg-menu-animation-type: slide;
@@ -375,52 +357,6 @@ uofg-menu > [slot=content] {
375
357
  background-color: rgba(0, 0, 0, 0.1);
376
358
  }
377
359
 
378
- /*
379
- .uofg-header-account-menu {
380
- .uofg-header-single-sign-on {
381
- display: flex;
382
- flex-direction: column;
383
- width: 100%;
384
- gap: 1rem;
385
-
386
- label {
387
- display: flex;
388
- flex-direction: column;
389
- gap: 0.5rem;
390
- }
391
-
392
- > input[type='text'],
393
- > input[type='password'] {
394
- height: 4rem;
395
- width: 100%;
396
- }
397
-
398
- > button[type='submit'] {
399
- height: 4rem;
400
- width: 100%;
401
- margin-top: 1rem;
402
- }
403
-
404
- > a {
405
- color: #69a3b9;
406
- text-decoration: underline;
407
- }
408
- }
409
- }
410
- */
411
- .uofg-header-search-menu .uofg-header-search-bar {
412
- display: flex;
413
- align-items: center;
414
- justify-content: center;
415
- }
416
- .uofg-header-search-menu .uofg-header-search-bar > input {
417
- flex: 1;
418
- }
419
- .uofg-header-search-menu .uofg-header-search-bar > button[type=submit] {
420
- width: 4rem;
421
- height: 4rem;
422
- }
423
-
424
360
  #uofg-header-sub-content-container {
425
361
  height: 4rem;
426
362
  background-color: #ddd;
@@ -1,13 +1,29 @@
1
1
  import { h } from "@stencil/core";
2
- import { PageSpecific, } from "./page-specific";
3
2
  import Decoration from "./decoration.svg";
4
- import FullSizeLogo from "./logo-full-size.svg";
5
- import ReducedSizeLogo from "./logo-reduced-size.svg";
6
- import { GlobalLinks } from "./global-links";
3
+ import FullSizeLogo from "./logo-full.svg";
4
+ import ReducedSizeLogo from "./logo-reduced.svg";
7
5
  import { FontAwesomeIcon } from "../../utils/font-awesome-icon";
8
- import { faBars, faRightToBracket, faSearch } from "@fortawesome/free-solid-svg-icons";
9
- import { HelloYou } from "./hello-you";
10
- import { SearchBar } from "./search";
6
+ import { faBars } from "@fortawesome/free-solid-svg-icons/faBars";
7
+ import { faRightToBracket } from "@fortawesome/free-solid-svg-icons/faRightToBracket";
8
+ import { faSearch } from "@fortawesome/free-solid-svg-icons/faSearch";
9
+ import { faCaretDown } from "@fortawesome/free-solid-svg-icons/faCaretDown";
10
+ const TopLinks = () => (h("ul", null, h("li", null, h("a", { href: "https://bbis.alumni.uoguelph.ca/BBIS_Cannon/give/uofg" }, "GIVE")), h("li", null, h("a", { href: "https://uoguelph.ca/apply" }, "APPLY")), h("li", null, h("a", { href: "https://news.uoguelph.ca/" }, "NEWS"))));
11
+ const HelloYouMenu = props => (h("uofg-menu", { class: "uofg-header-hello-you-menu", "auto-collapse": props.autoCollapse }, h("button", { slot: "button", "aria-label": "Hello, YOU! menu" }, h("span", null, "Hello, YOU!"), h(FontAwesomeIcon, { icon: faCaretDown })), h("ul", { slot: "content" }, h("li", null, h("a", { href: "https://uoguelph.ca/future-students" }, "Future Students")), h("li", null, h("a", { href: "https://uoguelph.ca/current-students" }, "Current Students")), h("li", null, h("a", { href: "https://uoguelph.ca/alumni-and-donors" }, "Alumni & Donors")), h("li", null, h("a", { href: "https://uoguelph.ca/staff-and-faculty" }, "Staff & Faculty")), h("li", null, h("a", { href: "https://uoguelph.ca/parents-and-visitors" }, "Parents & Visitors")), h("li", null, h("a", { href: "https://uoguelph.ca/employers-and-partners" }, "Employers & Partners")))));
12
+ const MainLinks = () => (h("ul", { class: "uofg-header-global-links" }, h("li", null, h("a", { href: "https://uoguelph.ca/about" }, "About")), h("li", null, h("a", { href: "https://uoguelph.ca/academics" }, "Academics")), h("li", null, h("a", { href: "https://uoguelph.ca/admissions" }, "Admissions")), h("li", null, h("a", { href: "https://uoguelph.ca/research" }, "Research")), h("li", null, h("a", { href: "https://uoguelph.ca/student-life" }, "Student Life"))));
13
+ const AccountLink = () => (h("a", { href: "https://uoguelph.ca/intranet", "aria-label": "University of Guelph Intranet" }, h(FontAwesomeIcon, { icon: faRightToBracket })));
14
+ const SearchLink = () => (h("a", { href: "https://uoguelph.ca/search", "aria-label": "Search University of Guelph" }, h(FontAwesomeIcon, { icon: faSearch })));
15
+ const PageSpecific = props => {
16
+ var _a;
17
+ return (h("ul", { class: "uofg-header-page-specific" }, (_a = props.content) === null || _a === void 0 ? void 0 : _a.map(item => {
18
+ if (!item) {
19
+ return null;
20
+ }
21
+ if ('text' in item) {
22
+ return (h("li", null, h("a", Object.assign({ href: item.href }, item.attributes), item.text)));
23
+ }
24
+ return (h("li", null, h("uofg-menu", { autoCollapse: props.autoCollapse }, h("button", { slot: "button" }, h("span", null, item.title), h(FontAwesomeIcon, { icon: faCaretDown })), h("ul", { slot: "content", role: "menu" }, item.links.map(link => (h("li", null, h("a", Object.assign({ href: link.href }, link.attributes), link.text))))))));
25
+ }).filter(Boolean)));
26
+ };
11
27
  export class UofgHeader {
12
28
  constructor() {
13
29
  this.pageTitle = '';
@@ -55,8 +71,8 @@ export class UofgHeader {
55
71
  });
56
72
  }
57
73
  render() {
58
- return (h("header", { id: "uofg-header" }, this.isFullSize && (h("div", { id: "uofg-header-top-content-container" }, h("ul", null, h("li", null, h("a", { href: "https://bbis.alumni.uoguelph.ca/BBIS_Cannon/give/uofg" }, "GIVE")), h("li", null, h("a", { href: "https://uoguelph.ca/apply" }, "APPLY")), h("li", null, h("a", { href: "https://news.uoguelph.ca/" }, "NEWS"))), h(HelloYou, { autoCollapse: true }))), h("div", { id: "uofg-header-main-content-container", class: { 'full-height': this.isFullSize } }, h("div", { id: "uofg-header-logo-container" }, this.isFullSize && h("div", { id: "uofg-header-decorative-img", innerHTML: Decoration }), h("a", { id: "uofg-header-logo", href: "https://www.uoguelph.ca", innerHTML: this.isFullSize ? FullSizeLogo : ReducedSizeLogo, "aria-label": "University of Guelph Home Page" })), this.isFullSize ? (h("div", { id: "uofg-header-full-main-content", class: "uofg-header-main-content" }, h(GlobalLinks, null), h("a", { href: "https://intranet.uoguelph.ca", "aria-label": "Intranet" }, h(FontAwesomeIcon, { icon: faRightToBracket })), h("uofg-menu", { class: "uofg-header-search-menu", "auto-collapse": true }, h("button", { slot: "button", "aria-label": "Search Menu" }, h(FontAwesomeIcon, { icon: faSearch })), h("div", { slot: "content" }, h("span", null, "Search the University of Guelph"), h(SearchBar, null))))) : (h("div", { id: "uofg-header-reduced-main-content", class: "uofg-header-main-content" }, h("a", { href: "https://intranet.uoguelph.ca", "aria-label": "Intranet" }, h(FontAwesomeIcon, { icon: faRightToBracket })), h("uofg-menu", { class: "uofg-header-search-menu", "auto-collapse": true }, h("button", { slot: "button", "aria-label": "Search Menu" }, h(FontAwesomeIcon, { icon: faSearch })), h("div", { slot: "content" }, h("span", null, "Search the University of Guelph"), h(SearchBar, null))), h("uofg-menu", { id: "uofg-header-main-menu", "auto-collapse": true }, h("button", { slot: "button", "aria-label": "Main Menu" }, h(FontAwesomeIcon, { icon: faBars })), h("div", { slot: "content" }, h("span", null, "University of Guelph"), h(GlobalLinks, null), h(HelloYou, { autoCollapse: false })))))), this.pageSpecificContent.length > 0 && (h("div", { id: "uofg-header-sub-content-container" }, this.pageTitle &&
59
- (this.pageUrl ? (h("a", { id: "uofg-header-page-title", href: this.pageUrl }, this.pageTitle)) : (h("span", { id: "uofg-header-page-title" }, this.pageTitle))), this.isFullSize ? (h("div", { id: "uofg-header-full-sub-content", class: "uofg-header-sub-content" }, h(PageSpecific, { content: this.pageSpecificContent, autoCollapseMenus: true }))) : (h("div", { id: "uofg-header-reduced-sub-content", class: "uofg-header-sub-content" }, h("uofg-menu", { id: "uofg-header-sub-menu", "auto-collapse": true }, h("button", { slot: "button", "aria-label": this.pageTitle + ' Menu' }, h(FontAwesomeIcon, { icon: faBars })), h("div", { slot: "content" }, h(PageSpecific, { content: this.pageSpecificContent })))))))));
74
+ return (h("header", { id: "uofg-header" }, this.isFullSize && (h("div", { id: "uofg-header-top-content-container" }, h(TopLinks, null), h(HelloYouMenu, { autoCollapse: true }))), h("div", { id: "uofg-header-main-content-container", class: { 'full-height': this.isFullSize } }, h("div", { id: "uofg-header-logo-container" }, this.isFullSize && h("div", { id: "uofg-header-decorative-img", innerHTML: Decoration }), h("a", { id: "uofg-header-logo", href: "https://www.uoguelph.ca", innerHTML: this.isFullSize ? FullSizeLogo : ReducedSizeLogo, "aria-label": "University of Guelph Home Page" })), this.isFullSize ? (h("div", { id: "uofg-header-full-main-content", class: "uofg-header-main-content" }, h(MainLinks, null), h(AccountLink, null), h(SearchLink, null))) : (h("div", { id: "uofg-header-reduced-main-content", class: "uofg-header-main-content" }, h(AccountLink, null), h(SearchLink, null), h("uofg-menu", { id: "uofg-header-main-menu", "auto-collapse": true }, h("button", { slot: "button", "aria-label": "Main Menu" }, h(FontAwesomeIcon, { icon: faBars })), h("div", { slot: "content" }, h("span", null, "University of Guelph"), h(MainLinks, null), h(HelloYouMenu, { autoCollapse: false })))))), this.pageSpecificContent.length > 0 && (h("div", { id: "uofg-header-sub-content-container" }, this.pageTitle &&
75
+ (this.pageUrl ? (h("a", { id: "uofg-header-page-title", href: this.pageUrl }, this.pageTitle)) : (h("span", { id: "uofg-header-page-title" }, this.pageTitle))), this.isFullSize ? (h("div", { id: "uofg-header-full-sub-content", class: "uofg-header-sub-content" }, h(PageSpecific, { content: this.pageSpecificContent, autoCollapse: true }))) : (h("div", { id: "uofg-header-reduced-sub-content", class: "uofg-header-sub-content" }, h("uofg-menu", { id: "uofg-header-sub-menu", "auto-collapse": true }, h("button", { slot: "button", "aria-label": this.pageTitle + ' Menu' }, h(FontAwesomeIcon, { icon: faBars })), h("div", { slot: "content" }, h(PageSpecific, { content: this.pageSpecificContent })))))))));
60
76
  }
61
77
  static get is() { return "uofg-header"; }
62
78
  static get encapsulation() { return "shadow"; }
@@ -77,7 +77,7 @@ export class UofgMenu {
77
77
  // Determine what animation type the user wants.
78
78
  const type = this.getAnimationType();
79
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') {
80
+ if (!WEB_ANIMATIONS_SUPPORTED() || PREFERS_REDUCED_MOTION() || type === 'none') {
81
81
  this.content.style.display = newValue ? '' : 'none';
82
82
  return;
83
83
  }
@@ -6,12 +6,33 @@
6
6
 
7
7
  :focus-visible {
8
8
  outline: 2px solid #ffc72a;
9
+ outline-offset: 0.5rem;
9
10
  }
10
11
 
11
12
  * {
12
13
  box-sizing: border-box;
13
14
  }
14
15
 
16
+ button {
17
+ border: none;
18
+ background-color: transparent;
19
+ cursor: pointer;
20
+ }
21
+
22
+ a {
23
+ color: inherit;
24
+ text-decoration: none;
25
+ }
26
+
27
+ ul {
28
+ list-style: none;
29
+ padding: 0;
30
+ margin: unset;
31
+ }
32
+ ul > li {
33
+ display: contents;
34
+ }
35
+
15
36
  #uofg-modal {
16
37
  display: flex;
17
38
  position: fixed;
@@ -23,11 +44,16 @@
23
44
  background-color: rgba(0, 0, 0, 0.5);
24
45
  visibility: hidden;
25
46
  opacity: 0;
26
- transition-duration: 0.3s;
47
+ transition-property: opacity, visibility;
48
+ transition-duration: 0.2s;
27
49
  transition-timing-function: ease-in-out;
28
- transition-property: visibility, opacity;
29
50
  }
30
- #uofg-modal #uofg-modal-dismiss {
51
+ #uofg-modal.open {
52
+ visibility: visible;
53
+ opacity: 1;
54
+ }
55
+
56
+ #uofg-modal-dismiss {
31
57
  display: flex;
32
58
  justify-content: center;
33
59
  align-items: center;
@@ -40,41 +66,40 @@
40
66
  font-size: 2rem;
41
67
  line-height: 1;
42
68
  color: var(--uofg-modal-dismiss-color, #fff);
43
- background-color: transparent;
44
- border: none;
45
- cursor: pointer;
46
69
  z-index: 2;
47
70
  }
48
- #uofg-modal #uofg-modal-dismiss > svg {
71
+ #uofg-modal-dismiss > svg {
49
72
  display: block;
50
73
  height: 1em;
51
74
  fill: currentColor;
52
75
  }
53
- #uofg-modal > #uofg-modal-content {
76
+
77
+ #uofg-modal-content {
54
78
  position: absolute;
55
79
  width: fit-content;
56
80
  height: fit-content;
81
+ width: -moz-max-content;
82
+ height: -moz-max-content;
57
83
  padding: 2rem;
58
84
  max-width: 100%;
59
85
  max-height: 100%;
60
86
  left: 50%;
61
- transition: transform 0.3s ease-in-out;
62
87
  transform: translate(-50%, -50px);
63
88
  z-index: 1;
89
+ overflow: auto;
90
+ transition-property: transform;
91
+ transition-duration: 0.2s;
92
+ transition-timing-function: ease-in-out;
64
93
  }
65
94
  @media (prefers-reduced-motion: reduce) {
66
- #uofg-modal > #uofg-modal-content {
95
+ #uofg-modal-content {
67
96
  transition: none;
68
97
  }
69
98
  }
70
- #uofg-modal > #uofg-modal-content.centered {
99
+ #uofg-modal-content.centered {
71
100
  top: 50%;
72
101
  transform: translate(-50%, calc(-50% - 50px));
73
102
  }
74
- #uofg-modal.open {
75
- visibility: visible;
76
- opacity: 1;
77
- }
78
103
  #uofg-modal.open #uofg-modal-content {
79
104
  visibility: visible;
80
105
  opacity: 1;
@@ -1,9 +1,10 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { FontAwesomeIcon } from "../../utils/font-awesome-icon";
3
3
  import { faTimes } from "@fortawesome/free-solid-svg-icons";
4
- import { getAllFocusableElements } from "../../utils/utils";
4
+ import { getAllFocusableElements, IS_INERT_SUPPORTED } from "../../utils/utils";
5
5
  export class UofgModal {
6
6
  constructor() {
7
+ this.inertElements = [];
7
8
  this.label = undefined;
8
9
  this.alertDialog = false;
9
10
  this.centered = false;
@@ -20,6 +21,12 @@ export class UofgModal {
20
21
  this.isOpen = true;
21
22
  }
22
23
  }
24
+ disconnectedCallback() {
25
+ // 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.
26
+ for (const element of this.inertElements) {
27
+ element.removeAttribute('inert');
28
+ }
29
+ }
23
30
  handleClick(e) {
24
31
  if (!this.staticBackdrop && e.target === e.currentTarget) {
25
32
  this.isOpen = false;
@@ -61,12 +68,44 @@ export class UofgModal {
61
68
  });
62
69
  });
63
70
  });
71
+ // Mark outer elements as inert when the modal is open.
72
+ let current = this.el;
73
+ // We want to mark all elements outside of the modal as inert, so we need to traverse up the DOM tree until we reach the body element.
74
+ while (current !== null && current !== document.body) {
75
+ const parent = current.parentElement;
76
+ // 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.
77
+ if (parent === null) {
78
+ const root = current.getRootNode();
79
+ if (root instanceof ShadowRoot) {
80
+ current = root.host;
81
+ continue;
82
+ }
83
+ }
84
+ if (parent !== null) {
85
+ for (const child of parent.children) {
86
+ if (child !== current && !child.inert) {
87
+ // Mark the element as inert and store it in an array so that we can remove the inert attribute when the modal closes.
88
+ child.inert = true;
89
+ this.inertElements.push(child);
90
+ }
91
+ }
92
+ }
93
+ current = parent;
94
+ }
95
+ }
96
+ else {
97
+ // Remove the inert attribute from all elements that we marked as inert when the modal was opened.
98
+ for (const element of this.inertElements) {
99
+ element.removeAttribute('inert');
100
+ }
101
+ // 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.
102
+ this.inertElements = [];
64
103
  }
65
104
  // Prevent scrolling of the body when the modal is open.
66
105
  document.body.style.overflow = newValue ? 'hidden' : '';
67
106
  }
68
107
  render() {
69
- 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, ref: (el) => (this.container = el) }, h("div", { id: "uofg-modal-content", part: "content", class: { centered: this.centered } }, h("button", { id: "uofg-modal-dismiss", part: "dismiss-button", "aria-label": "Close modal", ref: (el) => (this.dismissButton = el), onClick: () => (this.isOpen = false) }, h(FontAwesomeIcon, { icon: faTimes })), h("slot", null))));
108
+ return (h("div", { id: "uofg-modal", class: { open: this.isOpen }, role: this.alertDialog ? 'alertdialog' : 'dialog', "aria-modal": this.isOpen ? 'true' : '', "aria-label": this.label, tabIndex: -1, onClick: this.handleClick, onKeyUp: this.handleKeyUp, onKeyDown: IS_INERT_SUPPORTED() ? undefined : this.handleKeyDown, ref: (el) => (this.container = el) }, h("div", { id: "uofg-modal-content", part: "content", class: { centered: this.centered } }, h("button", { id: "uofg-modal-dismiss", part: "dismiss-button", "aria-label": "Close modal", ref: (el) => (this.dismissButton = el), onClick: () => (this.isOpen = false) }, h(FontAwesomeIcon, { icon: faTimes })), h("slot", null))));
70
109
  }
71
110
  /**
72
111
  * Get the current state of the modal.
@@ -1,5 +1,12 @@
1
- export const WEB_ANIMATIONS_SUPPORTED = 'animate' in HTMLElement.prototype;
2
- export const PREFERS_REDUCED_MOTION = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
1
+ export const WEB_ANIMATIONS_SUPPORTED = () => {
2
+ return typeof window !== 'undefined' && 'animate' in HTMLElement.prototype;
3
+ };
4
+ export const PREFERS_REDUCED_MOTION = () => {
5
+ return typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
6
+ };
7
+ export const IS_INERT_SUPPORTED = () => {
8
+ return typeof window !== 'undefined' && 'inert' in HTMLElement.prototype;
9
+ };
3
10
  export const getAllFocusableElements = (container) => {
4
11
  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
12
  return Array.from(container.querySelectorAll(query));
@@ -0,0 +1,15 @@
1
+ function createCommonjsModule(fn, basedir, module) {
2
+ return module = {
3
+ path: basedir,
4
+ exports: {},
5
+ require: function (path, base) {
6
+ return commonjsRequire();
7
+ }
8
+ }, fn(module, module.exports), module.exports;
9
+ }
10
+
11
+ function commonjsRequire () {
12
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
13
+ }
14
+
15
+ export { createCommonjsModule as c };
@@ -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 };