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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/{index-00f6c6f1.js → index-06b58d35.js} +5 -5
  3. package/dist/cjs/{index-d71963b7.js → index-cdb046b4.js} +149 -44
  4. package/dist/cjs/loader.cjs.js +5 -3
  5. package/dist/cjs/uofg-alert.cjs.entry.js +11 -10
  6. package/dist/cjs/uofg-back-to-top_5.cjs.entry.js +1374 -0
  7. package/dist/cjs/uofg-modal.cjs.entry.js +152 -142
  8. package/dist/cjs/uofg-web-components.cjs.js +6 -4
  9. package/dist/cjs/utils-3d4b7e2e.js +16 -0
  10. package/dist/collection/collection-manifest.json +2 -2
  11. package/dist/collection/components/uofg-alert/uofg-alert.css +1 -75
  12. package/dist/collection/components/uofg-alert/uofg-alert.js +15 -15
  13. package/dist/collection/components/uofg-back-to-top/uofg-back-to-top.css +1 -40
  14. package/dist/collection/components/uofg-back-to-top/uofg-back-to-top.js +66 -63
  15. package/dist/collection/components/uofg-card/uofg-card.css +1 -95
  16. package/dist/collection/components/uofg-card/uofg-card.js +42 -40
  17. package/dist/collection/components/uofg-footer/uofg-footer.css +1 -249
  18. package/dist/collection/components/uofg-footer/uofg-footer.js +132 -40
  19. package/dist/collection/components/uofg-header/logo-full.svg +1 -1
  20. package/dist/collection/components/uofg-header/uofg-header.css +1 -542
  21. package/dist/collection/components/uofg-header/uofg-header.js +238 -157
  22. package/dist/collection/components/uofg-menu/uofg-menu.js +414 -410
  23. package/dist/collection/components/uofg-modal/uofg-modal.css +1 -113
  24. package/dist/collection/components/uofg-modal/uofg-modal.js +393 -386
  25. package/dist/collection/utils/font-awesome-icon.js +4 -4
  26. package/dist/collection/utils/utils.js +5 -5
  27. package/dist/components/font-awesome-icon.js +4 -4
  28. package/dist/components/uofg-alert.d.ts +2 -2
  29. package/dist/components/uofg-alert.js +22 -21
  30. package/dist/components/uofg-back-to-top.d.ts +2 -2
  31. package/dist/components/uofg-back-to-top.js +38 -34
  32. package/dist/components/uofg-card.d.ts +2 -2
  33. package/dist/components/uofg-card.js +28 -25
  34. package/dist/components/uofg-footer.d.ts +2 -2
  35. package/dist/components/uofg-footer.js +243 -115
  36. package/dist/components/uofg-header.d.ts +2 -2
  37. package/dist/components/uofg-header.js +235 -144
  38. package/dist/components/uofg-menu.d.ts +2 -2
  39. package/dist/components/uofg-menu2.js +245 -239
  40. package/dist/components/uofg-modal.d.ts +2 -2
  41. package/dist/components/uofg-modal.js +176 -166
  42. package/dist/components/utils.js +4 -4
  43. package/dist/esm/app-globals-0f993ce5.js +3 -0
  44. package/dist/esm/{index-284464b7.js → index-0b0002d2.js} +149 -44
  45. package/dist/esm/{index-a0a2924b.js → index-e685921a.js} +5 -5
  46. package/dist/esm/loader.js +6 -4
  47. package/dist/esm/uofg-alert.entry.js +11 -10
  48. package/dist/esm/uofg-back-to-top_5.entry.js +1366 -0
  49. package/dist/esm/uofg-modal.entry.js +152 -142
  50. package/dist/esm/uofg-web-components.js +7 -5
  51. package/dist/esm/utils-379bb71a.js +12 -0
  52. package/dist/types/components/uofg-alert/uofg-alert.d.ts +1 -1
  53. package/dist/types/components/uofg-back-to-top/uofg-back-to-top.d.ts +8 -8
  54. package/dist/types/components/uofg-card/uofg-card.d.ts +5 -5
  55. package/dist/types/components/uofg-footer/uofg-footer.d.ts +6 -6
  56. package/dist/types/components/uofg-header/uofg-header.d.ts +30 -29
  57. package/dist/types/components/uofg-menu/uofg-menu.d.ts +65 -65
  58. package/dist/types/components/uofg-modal/uofg-modal.d.ts +70 -70
  59. package/dist/types/components.d.ts +27 -1
  60. package/dist/types/stencil-public-runtime.d.ts +29 -0
  61. package/dist/types/utils/font-awesome-icon.d.ts +1 -1
  62. package/dist/uofg-web-components/{p-8bb65209.js → p-6fa0f8f6.js} +1 -1
  63. package/dist/uofg-web-components/p-7569d8f2.entry.js +1 -0
  64. package/dist/uofg-web-components/p-bce5df9d.entry.js +1 -0
  65. package/dist/uofg-web-components/p-e1255160.js +1 -0
  66. package/dist/uofg-web-components/p-ee27db22.js +2 -0
  67. package/dist/uofg-web-components/p-fde6370b.entry.js +1 -0
  68. package/dist/uofg-web-components/uofg-web-components.css +1 -1
  69. package/dist/uofg-web-components/uofg-web-components.esm.js +1 -1
  70. package/package.json +12 -7
  71. package/dist/cjs/uofg-back-to-top_4.cjs.entry.js +0 -1139
  72. package/dist/cjs/uofg-card.cjs.entry.js +0 -21
  73. package/dist/cjs/utils-582c8cb9.js +0 -16
  74. package/dist/components/_commonjsHelpers.js +0 -15
  75. package/dist/esm/uofg-back-to-top_4.entry.js +0 -1132
  76. package/dist/esm/uofg-card.entry.js +0 -17
  77. package/dist/esm/utils-cfa32fa2.js +0 -12
  78. package/dist/uofg-web-components/p-204e5cf7.entry.js +0 -1
  79. package/dist/uofg-web-components/p-3d5269a9.entry.js +0 -1
  80. package/dist/uofg-web-components/p-9429a69e.entry.js +0 -1
  81. package/dist/uofg-web-components/p-ba36e942.js +0 -2
  82. package/dist/uofg-web-components/p-e063f0e4.entry.js +0 -1
  83. /package/dist/uofg-web-components/{p-826dc478.js → p-fec87f9d.js} +0 -0
@@ -7,166 +7,247 @@ import { faBars } from "@fortawesome/free-solid-svg-icons/faBars";
7
7
  import { faRightToBracket } from "@fortawesome/free-solid-svg-icons/faRightToBracket";
8
8
  import { faSearch } from "@fortawesome/free-solid-svg-icons/faSearch";
9
9
  import { faCaretDown } from "@fortawesome/free-solid-svg-icons/faCaretDown";
10
- const TopLinks = () => (h("ul", null, h("li", null, h("a", { href: "https://uoguelph.ca/apply/" }, "APPLY")), h("li", null, h("a", { href: "https://bbis.alumni.uoguelph.ca/BBIS_Cannon/give/uofg" }, "GIVE")), h("li", null, h("a", { href: "https://news.uoguelph.ca/" }, "NEWS"))));
11
- const HelloMenu = props => (h("uofg-menu", { class: "uofg-header-hello-you-menu", "auto-collapse": props.autoCollapse }, h("button", { slot: "button" }, h("span", null, "HELLO!"), 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://www.uoguelph.ca/students" }, "Current Students")), h("li", null, h("a", { href: "https://alumni.uoguelph.ca/" }, "Alumni & Donors")), h("li", null, h("a", { href: "https://www.uoguelph.ca/faculty" }, "Faculty & Staff")), h("li", null, h("a", { href: "https://cecs.uoguelph.ca/employers-institutions" }, "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://www.uoguelph.ca/explore-all-programs/" }, "Academics")), h("li", null, h("a", { href: "https://uoguelph.ca/admissions" }, "Admission")), h("li", null, h("a", { href: "https://uoguelph.ca/research" }, "Research")), h("li", null, h("a", { href: "https://www.uoguelph.ca/studentexperience/" }, "Student Life"))));
13
- const AccountLink = () => (h("a", { href: "https://intranet.uoguelph.ca", "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" }, item.links.map(link => (h("li", null, h("a", Object.assign({ href: link.href }, link.attributes), link.text))))))));
25
- }).filter(Boolean)));
26
- };
27
10
  const TRANSITION_BREAKPOINT = 1024;
28
11
  const MAX_CONTENT_WIDTH = 1320;
12
+ const MENU_CHAR_LIMIT = 35;
13
+ const topLinks = [
14
+ {
15
+ text: 'GIVE',
16
+ href: 'https://bbis.alumni.uoguelph.ca/BBIS_Cannon/give/uofg',
17
+ },
18
+ {
19
+ text: 'NEWS',
20
+ href: 'https://news.uoguelph.ca/',
21
+ },
22
+ {
23
+ text: 'APPLY',
24
+ href: 'https://uoguelph.ca/apply/',
25
+ highlight: true,
26
+ },
27
+ ];
28
+ const mainLinks = [
29
+ {
30
+ text: 'About',
31
+ href: 'https://uoguelph.ca/about',
32
+ },
33
+ {
34
+ text: 'Academics',
35
+ href: 'https://www.uoguelph.ca/explore-all-programs/',
36
+ },
37
+ {
38
+ text: 'Admission',
39
+ href: 'https://uoguelph.ca/admissions',
40
+ },
41
+ {
42
+ text: 'Research',
43
+ href: 'https://uoguelph.ca/research',
44
+ },
45
+ {
46
+ text: 'Student Life',
47
+ href: 'https://www.uoguelph.ca/studentexperience/',
48
+ },
49
+ ];
50
+ const iconButtons = [
51
+ {
52
+ text: 'University of Guelph Intranet',
53
+ href: 'https://intranet.uoguelph.ca/',
54
+ icon: faRightToBracket,
55
+ },
56
+ {
57
+ text: 'Search the University of Guelph',
58
+ href: 'https://uoguelph.ca/search',
59
+ icon: faSearch,
60
+ },
61
+ ];
62
+ const resources = [
63
+ {
64
+ text: 'Future Students',
65
+ href: 'https://uoguelph.ca/future-students',
66
+ },
67
+ {
68
+ text: 'Current Students',
69
+ href: 'https://www.uoguelph.ca/students',
70
+ },
71
+ {
72
+ text: 'Alumni & Donors',
73
+ href: 'https://alumni.uoguelph.ca/',
74
+ },
75
+ {
76
+ text: 'Faculty & Staff',
77
+ href: 'https://www.uoguelph.ca/faculty',
78
+ },
79
+ {
80
+ text: 'Employers & Partners',
81
+ href: 'https://cecs.uoguelph.ca/employers-institutions',
82
+ },
83
+ ];
29
84
  export class UofgHeader {
30
- constructor() {
31
- this.subContainerOverflowWidth = NaN;
32
- this.needsOverflowWidthUpdate = false;
33
- this.pageTitle = '';
34
- this.pageUrl = '';
35
- this.isFullSize = false;
36
- this.pageSpecificContent = undefined;
37
- this.isSubContainerOverflowing = false;
38
- }
39
- connectedCallback() {
40
- var _a;
41
- this.updateFullSize();
42
- this.updatePageSpecificContent();
43
- (_a = this.observer) !== null && _a !== void 0 ? _a : (this.observer = new MutationObserver(() => {
44
- this.updatePageSpecificContent();
45
- this.subContainerOverflowWidth = NaN; // Reset overflow width as it will have changed and needs to be recalculated
46
- this.needsOverflowWidthUpdate = true;
47
- }));
48
- this.observer.observe(this.el, { childList: true, subtree: true });
49
- }
50
- componentDidLoad() {
51
- this.updateSubContainerOverflow();
52
- }
53
- updateFullSize() {
54
- this.isFullSize = window.innerWidth >= TRANSITION_BREAKPOINT;
55
- this.updateSubContainerOverflow();
56
- }
57
- updateSubContainerOverflow() {
58
- if (this.isFullSize && this.subContainer) {
59
- const { clientWidth, scrollWidth } = this.subContainer;
60
- if (scrollWidth > clientWidth) {
61
- this.subContainerOverflowWidth = scrollWidth;
62
- }
63
- this.isSubContainerOverflowing = this.subContainerOverflowWidth > Math.min(clientWidth, MAX_CONTENT_WIDTH);
85
+ constructor() {
86
+ this.subContainerOverflowWidth = NaN;
87
+ this.needsOverflowWidthUpdate = false;
88
+ this.pageTitle = '';
89
+ this.pageUrl = '';
90
+ this.isFullSize = false;
91
+ this.pageSpecificContent = undefined;
92
+ this.isSubContainerOverflowing = false;
93
+ }
94
+ connectedCallback() {
95
+ var _a;
96
+ this.updateFullSize();
97
+ this.updatePageSpecificContent();
98
+ (_a = this.observer) !== null && _a !== void 0 ? _a : (this.observer = new MutationObserver(() => {
99
+ this.updatePageSpecificContent();
100
+ this.subContainerOverflowWidth = NaN; // Reset overflow width as it will have changed and needs to be recalculated
101
+ this.needsOverflowWidthUpdate = true;
102
+ }));
103
+ this.observer.observe(this.el, { childList: true, subtree: true });
104
+ }
105
+ componentDidLoad() {
106
+ this.updateSubContainerOverflow();
107
+ }
108
+ updateFullSize() {
109
+ this.isFullSize = window.innerWidth >= TRANSITION_BREAKPOINT;
110
+ this.updateSubContainerOverflow();
111
+ }
112
+ updateSubContainerOverflow() {
113
+ if (this.isFullSize && this.subContainer) {
114
+ const { clientWidth, scrollWidth } = this.subContainer;
115
+ if (scrollWidth > clientWidth) {
116
+ this.subContainerOverflowWidth = scrollWidth;
117
+ }
118
+ this.isSubContainerOverflowing = this.subContainerOverflowWidth > Math.min(clientWidth, MAX_CONTENT_WIDTH);
119
+ }
120
+ }
121
+ componentDidRender() {
122
+ if (this.needsOverflowWidthUpdate) {
123
+ window.requestAnimationFrame(() => this.updateSubContainerOverflow());
124
+ this.needsOverflowWidthUpdate = false;
125
+ }
126
+ }
127
+ updatePageSpecificContent() {
128
+ var _a;
129
+ const aToPageSpecificLink = (a) => {
130
+ const attributes = {};
131
+ a.getAttributeNames()
132
+ .filter(name => name !== 'href')
133
+ .forEach(name => (attributes[name] = a.getAttribute(name)));
134
+ return {
135
+ href: a.getAttribute('href'),
136
+ text: a.textContent,
137
+ attributes,
138
+ };
139
+ };
140
+ this.pageSpecificContent = Array.from((_a = this.el) === null || _a === void 0 ? void 0 : _a.children)
141
+ .filter(child => child.tagName === 'A' || child.tagName === 'UL')
142
+ .map(child => {
143
+ switch (child.tagName) {
144
+ case 'A':
145
+ return aToPageSpecificLink(child);
146
+ case 'UL':
147
+ const value = {
148
+ title: child.getAttribute('data-title'),
149
+ links: Array.from(child.querySelectorAll('a')).map(aToPageSpecificLink),
150
+ };
151
+ value.wrapContent = value.links.reduce((shouldWrap, link) => {
152
+ if (link.text.length > MENU_CHAR_LIMIT) {
153
+ shouldWrap = true;
154
+ }
155
+ return shouldWrap;
156
+ }, false);
157
+ return value;
158
+ }
159
+ })
160
+ .filter(val => Boolean(val));
161
+ }
162
+ render() {
163
+ var _a, _b;
164
+ return (h("header", { key: 'd35a681463c288077d5350f451042e836354adc0', class: "tw-relative tw-z-[1000] tw-w-full tw-font-condensed tw-text-2xl" }, this.isFullSize && (h("div", { class: "tw-flex tw-h-16 tw-justify-end tw-bg-white tw-px-[calc((100%-1320px)/2)] tw-text-3xl" }, h("uofg-menu", { class: "tw-relative tw-block tw-h-full", "auto-collapse": true }, h("button", { class: "tw-flex tw-h-full tw-items-center tw-justify-center tw-gap-2 tw-transition-colors hover:tw-bg-uofg-grey aria-expanded:tw-bg-uofg-grey [&>svg]:tw-h-[1em] [&>svg]:tw-fill-current [&>svg]:tw-transition-transform [&>svg]:aria-expanded:tw-rotate-180", slot: "button" }, h("span", null, "Resources"), h(FontAwesomeIcon, { icon: faCaretDown })), h("ul", { slot: "content", class: "tw-absolute tw-right-0 tw-top-full tw-z-50 tw-flex tw-min-w-[20rem] tw-flex-col tw-bg-uofg-grey [&>li]:tw-contents" }, resources.map(item => (h("li", null, h("a", { class: "tw-border-0 tw-border-b tw-border-solid tw-border-uofg-grey-500 tw-p-4 tw-transition-colors hover:tw-bg-uofg-yellow", href: item.href }, item.text)))))), h("ul", { class: "tw-contents [&>li]:tw-contents" }, topLinks.map(item => (h("li", null, h("a", { href: item.href, class: `tw-flex tw-items-center tw-justify-center tw-p-4 tw-transition-colors hover:tw-bg-uofg-grey ${item.highlight ? 'tw-bg-uofg-yellow' : ''}` }, item.text))))))), h("nav", { key: 'ee10d9e2a71f96f356d1ab66086b6efb6ca75703', class: {
165
+ 'tw-h-[10rem]': this.isFullSize,
166
+ 'tw-h-[5rem]': !this.isFullSize,
167
+ 'tw-relative tw-flex tw-justify-between tw-bg-black tw-px-[calc((100%-1320px)/2)] tw-text-3xl tw-text-white': true,
168
+ }, "aria-label": "Main" }, h("div", { key: '3cdd4fc2c9f4f7211a0eb7cd5ce6d5ed1d7a9396', class: "tw-flex" }, this.isFullSize && (h("div", { class: "tw-left-0 tw-h-full tw-w-[7.5rem] min-[1320px]:tw-absolute [&>svg]:tw-h-full", innerHTML: Decoration })), h("a", { key: '106b18dafb1991baaed4c6ed03040c8cf04ee9c1', class: "tw-left-[max(calc((100%-1320px)/2),7.5rem)] tw-h-full tw-transition-opacity hocus:tw-opacity-75 min-[1320px]:tw-absolute [&>svg]:tw-h-full", href: "https://www.uoguelph.ca", innerHTML: this.isFullSize ? FullSizeLogo : ReducedSizeLogo, "aria-label": "University of Guelph Home Page" })), this.isFullSize ? (h("ul", { class: "tw-flex tw-items-center tw-justify-center tw-text-4xl [&>li]:tw-contents" }, mainLinks.map(item => (h("li", null, h("a", { href: item.href, class: "tw-flex tw-h-full tw-items-center tw-justify-center tw-border-0 tw-border-b-8 tw-border-solid tw-border-transparent tw-p-4 tw-pt-8 tw-transition-colors hover:tw-border-uofg-yellow hover:tw-text-uofg-yellow" }, item.text)))), iconButtons.map(item => (h("li", null, h("a", { class: "tw-flex tw-h-full tw-items-center tw-justify-center tw-border-0 tw-border-b-8 tw-border-solid tw-border-transparent tw-p-4 tw-pt-8 tw-text-uofg-yellow tw-transition-colors hover:tw-border-uofg-yellow hover:tw-text-white [&>svg]:tw-h-[1em] [&>svg]:tw-fill-current", href: item.href, "aria-label": item.text }, h(FontAwesomeIcon, { icon: item.icon }))))))) : (h("div", { class: "tw-flex tw-h-full" }, iconButtons.map(item => (h("a", { class: "tw-flex tw-aspect-square tw-h-full tw-items-center tw-justify-center tw-border-0 tw-border-l tw-border-solid tw-border-uofg-grey-950 tw-px-5 tw-transition-colors [&>svg]:tw-h-[1em] [&>svg]:tw-fill-current", href: item.href, "aria-label": item.text }, h(FontAwesomeIcon, { icon: item.icon })))), h("uofg-menu", { class: "tw-block tw-h-full", "auto-collapse": true }, h("button", { slot: "button", "aria-label": "Main Menu", class: "tw-flex tw-aspect-square tw-h-full tw-items-center tw-justify-center tw-border-0 tw-border-l tw-border-solid tw-border-uofg-grey-950 tw-px-5 tw-transition-colors aria-expanded:tw-bg-white aria-expanded:tw-text-black [&>svg]:tw-h-[1em] [&>svg]:tw-fill-current" }, h(FontAwesomeIcon, { icon: faBars })), h("div", { slot: "content", class: "tw-absolute tw-left-0 tw-top-full tw-z-50 tw-flex tw-w-full tw-flex-col tw-bg-white tw-px-4 tw-text-black tw-shadow-md" }, h("span", { class: "tw-my-4 tw-text-4xl tw-font-bold" }, "University of Guelph"), h("ul", { class: "tw-flex tw-w-full tw-flex-col [&>li]:tw-contents" }, mainLinks.concat(topLinks).map(item => (h("li", null, h("a", { href: item.href, class: `tw-w-full tw-border-0 tw-border-b tw-border-solid tw-border-uofg-grey-400 tw-p-5 tw-transition-colors hover:tw-bg-uofg-grey ${(item === null || item === void 0 ? void 0 : item.highlight) ? 'tw-bg-uofg-yellow' : ''}` }, item.text))))), h("uofg-menu", { class: "tw-relative tw-block tw-h-full tw-pb-6 tw-text-black", "auto-collapse": false }, h("button", { class: "tw-flex tw-h-auto tw-w-full tw-items-center tw-justify-between tw-border-0 tw-border-b tw-border-solid tw-border-uofg-grey-400 tw-p-5 tw-transition-colors hover:tw-bg-uofg-grey aria-expanded:tw-bg-uofg-grey [&>svg]:tw-h-[1em] [&>svg]:tw-fill-current [&>svg]:tw-transition-transform [&>svg]:aria-expanded:tw-rotate-180", slot: "button" }, h("span", null, "Resources"), h(FontAwesomeIcon, { icon: faCaretDown })), h("ul", { slot: "content", class: "tw-flex tw-w-full tw-flex-col [&>li]:tw-contents" }, resources.map(item => (h("li", null, h("a", { class: "tw-border-0 tw-border-b tw-border-solid tw-border-uofg-grey-400 tw-p-5 tw-transition-colors hover:tw-bg-uofg-grey", href: item.href }, item.text))))))))))), this.pageSpecificContent.length > 0 && (h("nav", { ref: node => (this.subContainer = node), "aria-label": "Department/Topic", class: "tw-align-items tw-relative tw-flex tw-h-[5rem] tw-justify-end tw-bg-uofg-grey tw-px-[calc((100%-1320px)/2)] tw-text-3xl lg:tw-h-16" }, this.pageTitle &&
169
+ (this.pageUrl != '' ? (h("a", { class: "tw-mr-auto tw-flex tw-h-full tw-items-center tw-justify-center tw-px-4 tw-font-bold tw-transition-colors hover:tw-bg-uofg-yellow", href: this.pageUrl }, this.pageTitle)) : (h("span", { class: "tw-mr-auto tw-flex tw-h-full tw-items-center tw-justify-center tw-px-4" }, this.pageTitle))), this.isFullSize && !this.isSubContainerOverflowing ? (h("ul", { class: "tw-flex tw-items-center tw-justify-center [&>li]:tw-contents" }, (_a = this.pageSpecificContent) === null || _a === void 0 ? void 0 : _a.map(item => {
170
+ if ('text' in item) {
171
+ return (h("li", null, h("a", Object.assign({ class: "tw-flex tw-h-full tw-items-center tw-justify-center tw-gap-2 tw-px-4 tw-transition-colors hover:tw-bg-uofg-yellow", href: item.href }, item.attributes), item.text)));
172
+ }
173
+ return (h("li", null, h("uofg-menu", { class: "tw-relative tw-h-full", "auto-collapse": true }, h("button", { class: "tw-flex tw-h-full tw-items-center tw-justify-center tw-gap-2 tw-px-4 tw-transition-colors hover:tw-bg-uofg-yellow aria-expanded:tw-bg-uofg-yellow [&>svg]:tw-h-[1em] [&>svg]:tw-fill-current", slot: "button" }, h("span", null, item === null || item === void 0 ? void 0 : item.title), h(FontAwesomeIcon, { icon: faCaretDown })), h("ul", { slot: "content", class: {
174
+ 'tw-absolute tw-right-0 tw-top-full tw-z-50 tw-flex tw-min-w-[20rem] tw-flex-col tw-bg-uofg-grey [&>li]:tw-contents': true,
175
+ 'wrap-content': item.wrapContent || false,
176
+ } }, item.links.map(link => (h("li", null, h("a", Object.assign({ class: "tw-border-0 tw-border-b tw-border-solid tw-border-uofg-grey-500 tw-p-4 tw-transition-colors hover:tw-bg-uofg-yellow", href: link.href }, link.attributes), link.text))))))));
177
+ }))) : (h("uofg-menu", { class: "tw-block tw-h-full lg:tw-relative", "auto-collapse": true }, h("button", { class: "tw-flex tw-aspect-square tw-h-full tw-items-center tw-justify-center tw-border-0 tw-border-l tw-border-solid tw-border-uofg-grey-300 tw-px-6 tw-transition-colors aria-expanded:tw-bg-uofg-yellow lg:tw-border-l-0 [&>svg]:tw-h-[1em] [&>svg]:tw-fill-current", slot: "button", "aria-label": this.pageTitle + ' Menu' }, h(FontAwesomeIcon, { icon: faBars })), h("ul", { class: "tw-absolute tw-right-0 tw-top-full tw-z-50 tw-flex tw-w-full tw-flex-col tw-bg-white tw-px-4 tw-text-black tw-shadow-md lg:tw-w-[30rem] [&>li]:tw-contents", slot: "content" }, (_b = this.pageSpecificContent) === null || _b === void 0 ? void 0 : _b.map(item => {
178
+ if ('text' in item) {
179
+ return (h("li", { class: "[&>a]:last:tw-pb-4" }, h("a", { href: item.href, class: "tw-w-full tw-border-0 tw-border-b tw-border-solid tw-border-uofg-grey-400 tw-p-5 tw-transition-colors hover:tw-bg-uofg-grey" }, item.text)));
180
+ }
181
+ return (h("li", { class: "[&>uofg-menu]:last:tw-pb-6" }, h("uofg-menu", { class: "tw-relative tw-block tw-h-full tw-text-black", "auto-collapse": false }, h("button", { class: "tw-flex tw-h-auto tw-w-full tw-items-center tw-justify-between tw-border-0 tw-border-b tw-border-solid tw-border-uofg-grey-400 tw-p-5 tw-transition-colors hover:tw-bg-uofg-grey aria-expanded:tw-bg-uofg-grey [&>svg]:tw-h-[1em] [&>svg]:tw-fill-current [&>svg]:tw-transition-transform [&>svg]:aria-expanded:tw-rotate-180", slot: "button" }, h("span", null, item.title), h(FontAwesomeIcon, { icon: faCaretDown })), h("ul", { slot: "content", class: "tw-flex tw-w-full tw-flex-col [&>li]:tw-contents" }, item.links.map(item => (h("li", null, h("a", { class: "tw-border-0 tw-border-b tw-border-solid tw-border-uofg-grey-400 tw-p-5 tw-transition-colors hover:tw-bg-uofg-grey", href: item.href }, item.text))))))));
182
+ }))))))));
183
+ }
184
+ static get is() { return "uofg-header"; }
185
+ static get encapsulation() { return "shadow"; }
186
+ static get originalStyleUrls() {
187
+ return {
188
+ "$": ["uofg-header.css"]
189
+ };
190
+ }
191
+ static get styleUrls() {
192
+ return {
193
+ "$": ["uofg-header.css"]
194
+ };
195
+ }
196
+ static get properties() {
197
+ return {
198
+ "pageTitle": {
199
+ "type": "string",
200
+ "mutable": false,
201
+ "complexType": {
202
+ "original": "string",
203
+ "resolved": "string",
204
+ "references": {}
205
+ },
206
+ "required": false,
207
+ "optional": false,
208
+ "docs": {
209
+ "tags": [],
210
+ "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\"."
211
+ },
212
+ "attribute": "page-title",
213
+ "reflect": false,
214
+ "defaultValue": "''"
215
+ },
216
+ "pageUrl": {
217
+ "type": "string",
218
+ "mutable": false,
219
+ "complexType": {
220
+ "original": "string",
221
+ "resolved": "string",
222
+ "references": {}
223
+ },
224
+ "required": false,
225
+ "optional": false,
226
+ "docs": {
227
+ "tags": [],
228
+ "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/\"."
229
+ },
230
+ "attribute": "page-url",
231
+ "reflect": false,
232
+ "defaultValue": "''"
233
+ }
234
+ };
235
+ }
236
+ static get states() {
237
+ return {
238
+ "isFullSize": {},
239
+ "pageSpecificContent": {},
240
+ "isSubContainerOverflowing": {}
241
+ };
64
242
  }
65
- }
66
- componentDidRender() {
67
- if (this.needsOverflowWidthUpdate) {
68
- window.requestAnimationFrame(() => this.updateSubContainerOverflow());
69
- this.needsOverflowWidthUpdate = false;
243
+ static get elementRef() { return "el"; }
244
+ static get listeners() {
245
+ return [{
246
+ "name": "resize",
247
+ "method": "updateFullSize",
248
+ "target": "window",
249
+ "capture": false,
250
+ "passive": true
251
+ }];
70
252
  }
71
- }
72
- updatePageSpecificContent() {
73
- var _a;
74
- const aToPageSpecificLink = (a) => {
75
- const attributes = {};
76
- a.getAttributeNames()
77
- .filter(name => name !== 'href')
78
- .forEach(name => (attributes[name] = a.getAttribute(name)));
79
- return {
80
- href: a.getAttribute('href'),
81
- text: a.textContent,
82
- attributes,
83
- };
84
- };
85
- this.pageSpecificContent = Array.from((_a = this.el) === null || _a === void 0 ? void 0 : _a.children)
86
- .filter(child => child.tagName === 'A' || child.tagName === 'UL')
87
- .map(child => {
88
- switch (child.tagName) {
89
- case 'A':
90
- return aToPageSpecificLink(child);
91
- case 'UL':
92
- return {
93
- title: child.getAttribute('data-title'),
94
- links: Array.from(child.querySelectorAll('a')).map(aToPageSpecificLink),
95
- };
96
- }
97
- });
98
- }
99
- render() {
100
- return (h("header", { id: "uofg-header" }, this.isFullSize && (h("div", { id: "uofg-header-top-content-container" }, h(TopLinks, null), h(HelloMenu, { autoCollapse: true }))), h("nav", { id: "uofg-header-main-content-container", class: { 'full-height': this.isFullSize }, "aria-label": "Main" }, 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(HelloMenu, { autoCollapse: false })))))), this.pageSpecificContent.length > 0 && (h("nav", { id: "uofg-header-sub-content-container", ref: node => (this.subContainer = node), "aria-label": "Department/Topic" }, this.pageTitle &&
101
- (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 && !this.isSubContainerOverflowing ? (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, class: { overflowed: this.isSubContainerOverflowing && this.isFullSize } }, h("button", { slot: "button", "aria-label": this.pageTitle + ' Menu' }, h(FontAwesomeIcon, { icon: faBars })), h("div", { slot: "content" }, h(PageSpecific, { content: this.pageSpecificContent })))))))));
102
- }
103
- static get is() { return "uofg-header"; }
104
- static get encapsulation() { return "shadow"; }
105
- static get originalStyleUrls() {
106
- return {
107
- "$": ["uofg-header.scss"]
108
- };
109
- }
110
- static get styleUrls() {
111
- return {
112
- "$": ["uofg-header.css"]
113
- };
114
- }
115
- static get properties() {
116
- return {
117
- "pageTitle": {
118
- "type": "string",
119
- "mutable": false,
120
- "complexType": {
121
- "original": "string",
122
- "resolved": "string",
123
- "references": {}
124
- },
125
- "required": false,
126
- "optional": false,
127
- "docs": {
128
- "tags": [],
129
- "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\"."
130
- },
131
- "attribute": "page-title",
132
- "reflect": false,
133
- "defaultValue": "''"
134
- },
135
- "pageUrl": {
136
- "type": "string",
137
- "mutable": false,
138
- "complexType": {
139
- "original": "string",
140
- "resolved": "string",
141
- "references": {}
142
- },
143
- "required": false,
144
- "optional": false,
145
- "docs": {
146
- "tags": [],
147
- "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/\"."
148
- },
149
- "attribute": "page-url",
150
- "reflect": false,
151
- "defaultValue": "''"
152
- }
153
- };
154
- }
155
- static get states() {
156
- return {
157
- "isFullSize": {},
158
- "pageSpecificContent": {},
159
- "isSubContainerOverflowing": {}
160
- };
161
- }
162
- static get elementRef() { return "el"; }
163
- static get listeners() {
164
- return [{
165
- "name": "resize",
166
- "method": "updateFullSize",
167
- "target": "window",
168
- "capture": false,
169
- "passive": true
170
- }];
171
- }
172
253
  }