@ucd-lib/theme-elements 0.0.1 → 0.0.5
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/{ucd-theme-alert → brand/ucd-theme-alert}/ucd-theme-alert.js +0 -0
- package/{ucd-theme-alert → brand/ucd-theme-alert}/ucd-theme-alert.tpl.js +0 -0
- package/{ucd-theme-collapse → brand/ucd-theme-collapse}/ucd-theme-collapse.js +20 -21
- package/{ucd-theme-collapse → brand/ucd-theme-collapse}/ucd-theme-collapse.tpl.js +1 -1
- package/brand/ucd-theme-header/ucd-theme-header.js +268 -0
- package/brand/ucd-theme-header/ucd-theme-header.tpl.js +146 -0
- package/{ucd-theme-image-gallery → brand/ucd-theme-image-gallery}/ucd-theme-image-gallery.js +0 -0
- package/{ucd-theme-image-gallery → brand/ucd-theme-image-gallery}/ucd-theme-image-gallery.tpl.js +0 -0
- package/{ucd-theme-list-accordion → brand/ucd-theme-list-accordion}/ucd-theme-list-accordion.js +47 -44
- package/{ucd-theme-list-accordion → brand/ucd-theme-list-accordion}/ucd-theme-list-accordion.tpl.js +2 -2
- package/{ucd-theme-message-area → brand/ucd-theme-message-area}/ucd-theme-message-area.js +0 -0
- package/{ucd-theme-message-area → brand/ucd-theme-message-area}/ucd-theme-message-area.tpl.js +0 -0
- package/brand/ucd-theme-pagination/ucd-theme-pagination.js +284 -0
- package/brand/ucd-theme-pagination/ucd-theme-pagination.tpl.js +93 -0
- package/brand/ucd-theme-primary-nav/ucd-theme-primary-nav.js +589 -0
- package/brand/ucd-theme-primary-nav/ucd-theme-primary-nav.tpl.js +106 -0
- package/brand/ucd-theme-quick-links/ucd-theme-quick-links.js +269 -0
- package/brand/ucd-theme-quick-links/ucd-theme-quick-links.tpl.js +114 -0
- package/{ucd-theme-form-search/ucd-theme-form-search.js → brand/ucd-theme-search-form/ucd-theme-search-form.js} +14 -15
- package/{ucd-theme-form-search/ucd-theme-form-search.tpl.js → brand/ucd-theme-search-form/ucd-theme-search-form.tpl.js} +0 -0
- package/brand/ucd-theme-search-popup/ucd-theme-search-popup.js +91 -0
- package/{ucd-theme-header-search-popup/ucd-theme-header-search-popup.tpl.js → brand/ucd-theme-search-popup/ucd-theme-search-popup.tpl.js} +8 -1
- package/brand/ucd-theme-slim-select/ucd-theme-slim-select.js +58 -0
- package/brand/ucd-theme-slim-select/ucd-theme-slim-select.tpl.js +26 -0
- package/brand/ucd-theme-subnav/ucd-theme-subnav.js +196 -0
- package/brand/ucd-theme-subnav/ucd-theme-subnav.tpl.js +60 -0
- package/package.json +6 -4
- package/ucdlib/ucdlib-branding-bar/book.js +4 -0
- package/ucdlib/ucdlib-branding-bar/logo.js +67 -0
- package/ucdlib/ucdlib-branding-bar/ucdlib-branding-bar.js +101 -0
- package/ucdlib/ucdlib-branding-bar/ucdlib-branding-bar.tpl.js +102 -0
- package/ucdlib/ucdlib-icon/ucdlib-icon.js +138 -0
- package/ucdlib/ucdlib-icon/ucdlib-icon.tpl.js +22 -0
- package/ucdlib/ucdlib-icons/academic.js +154 -0
- package/ucdlib/ucdlib-icons/ucdlib-icons.js +78 -0
- package/ucdlib/ucdlib-icons/utils.js +29 -0
- package/ucdlib/ucdlib-iconset/ucdlib-iconset.js +170 -0
- package/ucdlib/ucdlib-pages/ucdlib-pages.js +150 -0
- package/utils/controllers/break-points.js +26 -0
- package/utils/controllers/index.js +11 -0
- package/utils/controllers/intersection-observer.js +58 -0
- package/utils/controllers/mutation-observer.js +52 -0
- package/utils/controllers/wait.js +43 -0
- package/utils/directives/motion-collapse.js +1 -1
- package/utils/mixins/index.js +8 -0
- package/utils/mixins/main-dom-element.js +23 -0
- package/utils/mixins/mixin.js +21 -0
- package/utils/mixins/nav-element.js +103 -0
- package/ucd-theme-header-search-popup/ucd-theme-header-search-popup.js +0 -40
|
File without changes
|
|
File without changes
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import {render, styles} from
|
|
2
|
+
import { render, styles } from './ucd-theme-collapse.tpl.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @class UcdThemeCollapse
|
|
6
6
|
* @classdesc UI component class for a collapsable panel box
|
|
7
7
|
* Pattern Lab Url: http://dev.webstyleguide.ucdavis.edu/redesign/?p=molecules-collapse
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* @property {String} title - The panel title
|
|
10
10
|
* @property {Boolean} opened - Whether the panel content is expanded
|
|
11
11
|
* @property {String} brandClass - Any additional class modifers
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* @example
|
|
14
14
|
* html`
|
|
15
15
|
* <ucd-theme-collapse title="I am the panel title">
|
|
@@ -18,12 +18,11 @@ import {render, styles} from "./ucd-theme-collapse.tpl.js";
|
|
|
18
18
|
* `
|
|
19
19
|
*/
|
|
20
20
|
export default class UcdThemeCollapse extends LitElement {
|
|
21
|
-
|
|
22
21
|
static get properties() {
|
|
23
22
|
return {
|
|
24
|
-
title: {type: String},
|
|
25
|
-
opened: {type: Boolean, reflect: true},
|
|
26
|
-
brandClass: {type: String, attribute:
|
|
23
|
+
title: { type: String },
|
|
24
|
+
opened: { type: Boolean, reflect: true },
|
|
25
|
+
brandClass: { type: String, attribute: 'brand-class' },
|
|
27
26
|
};
|
|
28
27
|
}
|
|
29
28
|
|
|
@@ -34,7 +33,7 @@ export default class UcdThemeCollapse extends LitElement {
|
|
|
34
33
|
constructor() {
|
|
35
34
|
super();
|
|
36
35
|
this.render = render.bind(this);
|
|
37
|
-
this.title =
|
|
36
|
+
this.title = '';
|
|
38
37
|
this.opened = false;
|
|
39
38
|
}
|
|
40
39
|
|
|
@@ -50,7 +49,7 @@ export default class UcdThemeCollapse extends LitElement {
|
|
|
50
49
|
* @method close
|
|
51
50
|
* @description Collapses the panel content
|
|
52
51
|
*/
|
|
53
|
-
close(){
|
|
52
|
+
close() {
|
|
54
53
|
this.opened = false;
|
|
55
54
|
}
|
|
56
55
|
|
|
@@ -58,7 +57,7 @@ export default class UcdThemeCollapse extends LitElement {
|
|
|
58
57
|
* @method toggle
|
|
59
58
|
* @description Toggles the visibility of the panel content
|
|
60
59
|
*/
|
|
61
|
-
toggle(){
|
|
60
|
+
toggle() {
|
|
62
61
|
this.opened = !this.opened;
|
|
63
62
|
}
|
|
64
63
|
|
|
@@ -66,7 +65,7 @@ export default class UcdThemeCollapse extends LitElement {
|
|
|
66
65
|
* @method _onTitleClick
|
|
67
66
|
* @description Attached to the panel title
|
|
68
67
|
*/
|
|
69
|
-
_onTitleClick(){
|
|
68
|
+
_onTitleClick() {
|
|
70
69
|
this.toggle();
|
|
71
70
|
this._dispatchToggleEvent();
|
|
72
71
|
}
|
|
@@ -74,11 +73,11 @@ export default class UcdThemeCollapse extends LitElement {
|
|
|
74
73
|
/**
|
|
75
74
|
* @method _onTitleKeyUp
|
|
76
75
|
* @description Attached to the panel title
|
|
77
|
-
*
|
|
76
|
+
*
|
|
78
77
|
* @param {Event} e - keyup event
|
|
79
78
|
*/
|
|
80
|
-
_onTitleKeyUp(e){
|
|
81
|
-
if(
|
|
79
|
+
_onTitleKeyUp(e) {
|
|
80
|
+
if (e.which !== 13) return;
|
|
82
81
|
this.toggle();
|
|
83
82
|
this._dispatchToggleEvent();
|
|
84
83
|
}
|
|
@@ -87,17 +86,17 @@ export default class UcdThemeCollapse extends LitElement {
|
|
|
87
86
|
* @method _dispatchToggleEvent
|
|
88
87
|
* @description Emits custom 'accordion-toggle' event when user toggles content visibilty.
|
|
89
88
|
*/
|
|
90
|
-
_dispatchToggleEvent(){
|
|
89
|
+
_dispatchToggleEvent() {
|
|
91
90
|
let e = new CustomEvent('accordion-toggle', {
|
|
92
|
-
detail: {
|
|
93
|
-
message: 'Content area has been expanded or collapsed',
|
|
94
|
-
isOpen: this.opened
|
|
91
|
+
detail: {
|
|
92
|
+
message: 'Content area has been expanded or collapsed',
|
|
93
|
+
isOpen: this.opened,
|
|
95
94
|
},
|
|
96
95
|
bubbles: true,
|
|
97
|
-
composed: true
|
|
96
|
+
composed: true,
|
|
97
|
+
});
|
|
98
98
|
this.dispatchEvent(e);
|
|
99
99
|
}
|
|
100
|
-
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
customElements.define('ucd-theme-collapse', UcdThemeCollapse);
|
|
102
|
+
customElements.define('ucd-theme-collapse', UcdThemeCollapse);
|
|
@@ -3,7 +3,7 @@ import { html, css } from 'lit';
|
|
|
3
3
|
import collapseStyles from "@ucd-lib/theme-sass/4_component/_collapse.css.js";
|
|
4
4
|
import colorStyles from "@ucd-lib/theme-sass/4_component/_category-brand.css.js";
|
|
5
5
|
|
|
6
|
-
import { motionCollapse } from "
|
|
6
|
+
import { motionCollapse } from "../../utils/directives/motion-collapse";
|
|
7
7
|
|
|
8
8
|
export function styles() {
|
|
9
9
|
const elementStyles = css`
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import {render, styles} from "./ucd-theme-header.tpl.js";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
IntersectionObserverController,
|
|
6
|
+
MutationObserverController,
|
|
7
|
+
WaitController } from '../../utils/controllers';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @class UcdThemeHeader
|
|
11
|
+
* @classdesc Component class for displaying the site header
|
|
12
|
+
*
|
|
13
|
+
* PatternLab Url:
|
|
14
|
+
* - http://dev.webstyleguide.ucdavis.edu/redesign/?p=organisms-header
|
|
15
|
+
*
|
|
16
|
+
* @property {String} siteName - Name of website to display
|
|
17
|
+
* @property {String} slogan - Optional text to display below site name
|
|
18
|
+
* @property {String} figureSrc - Site logo/icon to display next to site name
|
|
19
|
+
* @property {String} siteUrl - Url to use for links around site name and figure
|
|
20
|
+
* @property {Boolean} opened - Whether header is open in the mobile view
|
|
21
|
+
* @property {Boolean} preventFixed - Navbar will not be fixed to top of screen in desktop view
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <ucd-theme-header site-name="A UC Davis Website">
|
|
25
|
+
* <ucd-theme-primary-nav>
|
|
26
|
+
* <a href="#">LINK 1</a>
|
|
27
|
+
* <a href="#">LINK 2</a>
|
|
28
|
+
* <a href="#">LINK 3</a>
|
|
29
|
+
* </ucd-theme-primary-nav>
|
|
30
|
+
* <ucd-theme-search-popup>
|
|
31
|
+
* <ucd-theme-search-form>
|
|
32
|
+
* </ucd-theme-search-form>
|
|
33
|
+
* </ucd-theme-search-popup>
|
|
34
|
+
* <ucd-theme-quick-links>
|
|
35
|
+
* <a href="#">LINK 4</a>
|
|
36
|
+
* <a href="#">LINK 5</a>
|
|
37
|
+
* <a href="#">LINK 6</a>
|
|
38
|
+
* </ucd-theme-quick-links>
|
|
39
|
+
* </ucd-theme-header>
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
export default class UcdThemeHeader extends LitElement {
|
|
43
|
+
|
|
44
|
+
mutationObserver = new MutationObserverController(this);
|
|
45
|
+
wait = new WaitController(this);
|
|
46
|
+
|
|
47
|
+
static get properties() {
|
|
48
|
+
return {
|
|
49
|
+
siteName: {type: String, attribute: "site-name"},
|
|
50
|
+
slogan: {type: String},
|
|
51
|
+
figureSrc: {type: String, attribute: "figure-src"},
|
|
52
|
+
siteUrl: {type: String, attribute: "site-url"},
|
|
53
|
+
opened: {type: Boolean},
|
|
54
|
+
preventFixed: {type: Boolean, attribute: "prevent-fixed"},
|
|
55
|
+
isDemo: {type: Boolean, attribute: "is-demo"},
|
|
56
|
+
_transitioning: {type: Boolean, state: true},
|
|
57
|
+
_hasSlottedBranding: {type: Boolean, state: true},
|
|
58
|
+
_hasQuickLinks: {type: Boolean, state: true},
|
|
59
|
+
_hasSearch: {type: Boolean, state: true},
|
|
60
|
+
_brandingBarInView: {type: Boolean, state: true}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static get styles() {
|
|
65
|
+
return styles();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
constructor() {
|
|
69
|
+
super();
|
|
70
|
+
this.render = render.bind(this);
|
|
71
|
+
|
|
72
|
+
this.siteName = "";
|
|
73
|
+
this.siteUrl = "/";
|
|
74
|
+
this.slogan = "";
|
|
75
|
+
this.figureSrc = "";
|
|
76
|
+
this.opened = false;
|
|
77
|
+
this.isDemo = false;
|
|
78
|
+
|
|
79
|
+
this._transitioning = false;
|
|
80
|
+
this._hasSlottedBranding = false;
|
|
81
|
+
this._hasQuickLinks = false;
|
|
82
|
+
this._hasSearch = false;
|
|
83
|
+
this._animationDuration = 500;
|
|
84
|
+
this._brandingBarInView = false;
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
connectedCallback(){
|
|
89
|
+
super.connectedCallback();
|
|
90
|
+
if ( !this.preventFixed ) {
|
|
91
|
+
this.intersectionObserver = new IntersectionObserverController(this, {}, "_onBrandingBarIntersection", false);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
firstUpdated(){
|
|
96
|
+
if ( !this.preventFixed ) {
|
|
97
|
+
let aboveNav = this.renderRoot.getElementById('branding-bar-container');
|
|
98
|
+
this.intersectionObserver.observer.observe(aboveNav);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
_onBrandingBarIntersection(entries){
|
|
103
|
+
let offSetValue = 0;
|
|
104
|
+
try {
|
|
105
|
+
offSetValue = this.renderRoot.getElementById('nav-bar').getBoundingClientRect().height;
|
|
106
|
+
} catch (error) {}
|
|
107
|
+
if ( offSetValue > 150 ) offSetValue = 0;
|
|
108
|
+
entries.forEach(entry => {
|
|
109
|
+
this._brandingBarInView = entry.isIntersecting;
|
|
110
|
+
if (this._brandingBarInView) {
|
|
111
|
+
this.style.marginBottom = '0px';
|
|
112
|
+
} else {
|
|
113
|
+
this.style.marginBottom = offSetValue + "px";
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @method open
|
|
120
|
+
* @description Opens header menu in mobile
|
|
121
|
+
* @returns {Promise}
|
|
122
|
+
*/
|
|
123
|
+
async open(){
|
|
124
|
+
if ( this._transitioning || this.opened ) return false;
|
|
125
|
+
|
|
126
|
+
this.opened = true;
|
|
127
|
+
this._transitioning = true;
|
|
128
|
+
await this.wait.wait(this._animationDuration);
|
|
129
|
+
this._transitioning = false;
|
|
130
|
+
return true;
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @method close
|
|
136
|
+
* @description Closes heaader menu in mobile
|
|
137
|
+
* @returns {Promise}
|
|
138
|
+
*/
|
|
139
|
+
async close(){
|
|
140
|
+
if ( this._transitioning || !this.opened ) return false;
|
|
141
|
+
|
|
142
|
+
this.opened = false;
|
|
143
|
+
this._transitioning = true;
|
|
144
|
+
await this.wait.wait(this._animationDuration);
|
|
145
|
+
this._transitioning = false;
|
|
146
|
+
return true;
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @method _onBtnClick
|
|
152
|
+
* @private
|
|
153
|
+
* @description Attached to menu open/close button
|
|
154
|
+
*/
|
|
155
|
+
async _onBtnClick(){
|
|
156
|
+
let didToggle;
|
|
157
|
+
if ( this.opened ) {
|
|
158
|
+
didToggle = await this.close();
|
|
159
|
+
} else {
|
|
160
|
+
didToggle = await this.open();
|
|
161
|
+
}
|
|
162
|
+
if ( didToggle ) {
|
|
163
|
+
this.dispatchEvent(new CustomEvent('toggle', {
|
|
164
|
+
detail : {open: this.opened}
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @method _getNavbarClasses
|
|
171
|
+
* @description Get classes to be assigned to the navbar container
|
|
172
|
+
* @private
|
|
173
|
+
* @returns {Object}
|
|
174
|
+
*/
|
|
175
|
+
_getNavbarClasses(){
|
|
176
|
+
let classes = {
|
|
177
|
+
"l-navbar": true,
|
|
178
|
+
"header__navbar": true
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
if (this.opened) {
|
|
182
|
+
classes['menu--open'] = true;
|
|
183
|
+
} else {
|
|
184
|
+
if ( !this._transitioning ) classes['menu--hidden'] = true;
|
|
185
|
+
classes['menu--closed'] = true;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return classes;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @method _getHeaderClasses
|
|
193
|
+
* @description Get classes to be assigned to the header element
|
|
194
|
+
* @private
|
|
195
|
+
* @returns {Object}
|
|
196
|
+
*/
|
|
197
|
+
_getHeaderClasses(){
|
|
198
|
+
let classes = {
|
|
199
|
+
"l-header": true,
|
|
200
|
+
"header": true
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
classes['fixed-mobile'] = !this.preventFixed;
|
|
204
|
+
classes['fixed-desktop'] = !this.preventFixed && !this._brandingBarInView;
|
|
205
|
+
|
|
206
|
+
return classes;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* @method _ucdLogo
|
|
211
|
+
* @description Returns URI-encoded svg string of UC Davis logo
|
|
212
|
+
* @private
|
|
213
|
+
* @param {String} color - Color of logo. 'blue' or 'gold'.
|
|
214
|
+
* @returns {String}
|
|
215
|
+
*/
|
|
216
|
+
_ucdLogo(color="blue"){
|
|
217
|
+
const colors = {
|
|
218
|
+
"blue": "#022851",
|
|
219
|
+
"gold": "#FFBF00"
|
|
220
|
+
};
|
|
221
|
+
return encodeURIComponent(
|
|
222
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="16.157"><path fill="${colors[color]}" d="M58.865 4.877c.101.661 1.101 5.405 1.101 5.405h-2.194l1.093-5.405zm-8.328 11.03h5.806l.438-1.947h4.144l.554 1.947h5.806L61.846.403h-6.087l-5.222 15.504zM36.284.402h5.624c5.107 0 9.007 2.277 9.007 7.974 0 4.591-3.18 7.529-7.645 7.529l-6.986-.009V.402zm5.524 11.052h.376c1.843 0 3.207-1.072 3.207-3.096 0-2.179-1.21-3.395-3.234-3.395h-.349v6.491zM32.941.888l.296 2.545c.071.604.426 2.052-.011 1.858-.276-.121-.502-.776-.726-1.36-.114-.295-.658-1.695-.801-1.799-.685-.501-2.401-1.064-3.561-1.069-3.521-.013-5.847 2.509-5.847 6.982 0 3.208 1.582 7.061 5.607 7.061 1.441 0 4.201-.443 4.952-2.436.339-.9.65-1.703.876-1.459.166.177-.05.899-.15 1.289-.474 1.847-.501 2.406-.65 2.479-1.818.885-4.15 1.178-6.191 1.178-6.485 0-8.726-3.678-8.726-7.354 0-6.379 4.032-9.021 10.286-8.791 1.58.058 3.163.334 4.646.876M13.784 1.171L12.745.819c-.35-.306.075-.391.075-.391s1.5.271 5.24-.036c0 0 .328.062.103.319l-1.228.511c-.798.338-.798.143-.798.994l-.007 7.902c0 6.178-6.47 6.039-7.73 6.039-.6 0-6.488 0-6.488-4.961V2.834c0-1.46.159-1.419-.338-1.591L.071.695S-.183.347.269.368c1.227.06 3.004.316 7.133.024 0 0 .362.085.125.342l-1.201.339c-.95.414-.825.098-.849 1.045l.028 8.248c0 2.021 1.07 4.524 4.395 4.524 4.585 0 4.627-3.854 4.627-4.71l.009-8.167c.049-.77-.052-.551-.752-.842M87.65 14.715l1.6-4.111.281.23c.982.781 2.316 1.443 3.574 1.471 1.127.023 1.676-.268 1.527-1.191-.113-.693-.916-.812-1.417-.91l-1.103-.213c-2.143-.39-3.941-1.673-3.941-4.104 0-3.677 3.262-5.737 6.544-5.737 1.726 0 3.306.424 4.786 1.36L98.11 5.156c-.762-.533-1.918-1.285-3.377-1.337-.482-.018-1.58.229-1.229 1.312.152.462.833.657 1.252.755l1.241.292c2.325.526 4.003 1.81 4.003 4.432 0 3.699-3.281 5.529-6.542 5.529-1.901 0-4.106-.527-5.808-1.424M80.979.403h5.492v15.504h-5.492zM74.684.402h5.72l-5.843 15.503h-4.644L64.09.402h5.704l2.442 9.354z"/></svg>`);
|
|
223
|
+
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @method _onChildListMutation
|
|
228
|
+
* @description Fires when there are changes to this element's non-shadow DOM children
|
|
229
|
+
* @private
|
|
230
|
+
*/
|
|
231
|
+
_onChildListMutation(){
|
|
232
|
+
let primaryNav = this.querySelector('ucd-theme-primary-nav');
|
|
233
|
+
if ( primaryNav ) {
|
|
234
|
+
primaryNav.setAttribute('slot', 'primary-nav');
|
|
235
|
+
} else {
|
|
236
|
+
console.warn("No 'ucd-theme-primary-nav' child element found!");
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
let quickLinks = this.querySelector('ucd-theme-quick-links');
|
|
240
|
+
if ( quickLinks ) {
|
|
241
|
+
quickLinks.setAttribute('slot', 'quick-links');
|
|
242
|
+
this._hasQuickLinks = true;
|
|
243
|
+
} else {
|
|
244
|
+
this._hasQuickLinks = false;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
let search = this.querySelector('ucd-theme-search-popup');
|
|
248
|
+
if ( search ) {
|
|
249
|
+
search.setAttribute('slot', 'search');
|
|
250
|
+
this._hasSearch = true;
|
|
251
|
+
} else {
|
|
252
|
+
this._hasSearch = false;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
let UcdlibBrandingBar = this.querySelector('ucdlib-branding-bar');
|
|
256
|
+
if ( UcdlibBrandingBar ) {
|
|
257
|
+
UcdlibBrandingBar.setAttribute('slot', 'branding-bar');
|
|
258
|
+
this._hasSlottedBranding = true;
|
|
259
|
+
} else if ( this.querySelector("*[slot='branding-bar']") ){
|
|
260
|
+
this._hasSlottedBranding = true;
|
|
261
|
+
} else {
|
|
262
|
+
this._hasSlottedBranding = false;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
customElements.define('ucd-theme-header', UcdThemeHeader);
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
3
|
+
|
|
4
|
+
import headingStyles from "@ucd-lib/theme-sass/1_base_html/_headings.css.js";
|
|
5
|
+
import headerStyles from "@ucd-lib/theme-sass/4_component/_header.css.js";
|
|
6
|
+
import headerLayoutStyles from "@ucd-lib/theme-sass/5_layout/_l-header.css.js"
|
|
7
|
+
import brandingStyles from "@ucd-lib/theme-sass/4_component/_site-branding.css.js"
|
|
8
|
+
import mobileBarStyles from "@ucd-lib/theme-sass/4_component/_mobile-bar.css.js";
|
|
9
|
+
import navToggleStyles from "@ucd-lib/theme-sass/4_component/_nav-toggle.css.js"
|
|
10
|
+
import offCanvasStyles from "@ucd-lib/theme-sass/4_component/_nav-off-canvas.css.js"
|
|
11
|
+
|
|
12
|
+
export function styles() {
|
|
13
|
+
const elementStyles = css`
|
|
14
|
+
:host {
|
|
15
|
+
display: block;
|
|
16
|
+
}
|
|
17
|
+
[hidden] {
|
|
18
|
+
display: none !important;
|
|
19
|
+
}
|
|
20
|
+
button {
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
}
|
|
23
|
+
::slotted(ucdlib-branding-bar){
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media (max-width: 991px) {
|
|
28
|
+
.fixed-mobile .mobile-bar {
|
|
29
|
+
position: fixed;
|
|
30
|
+
width: 100%;
|
|
31
|
+
z-index: 1000;
|
|
32
|
+
top: 0;
|
|
33
|
+
}
|
|
34
|
+
.fixed-mobile .off-canvas {
|
|
35
|
+
position: fixed;
|
|
36
|
+
overflow: auto;
|
|
37
|
+
z-index: 1000;
|
|
38
|
+
top: 55px;
|
|
39
|
+
}
|
|
40
|
+
.fixed-mobile .l-header__branding {
|
|
41
|
+
margin-top: 55px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (min-width: 992px) {
|
|
46
|
+
.fixed-desktop .l-navbar {
|
|
47
|
+
position: fixed;
|
|
48
|
+
z-index: 1000;
|
|
49
|
+
top: 0;
|
|
50
|
+
right: 0;
|
|
51
|
+
left: 0;
|
|
52
|
+
width: 100%;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
return [
|
|
59
|
+
headingStyles,
|
|
60
|
+
headerStyles,
|
|
61
|
+
headerLayoutStyles,
|
|
62
|
+
brandingStyles,
|
|
63
|
+
mobileBarStyles,
|
|
64
|
+
navToggleStyles,
|
|
65
|
+
offCanvasStyles,
|
|
66
|
+
elementStyles
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function render() {
|
|
71
|
+
return html`
|
|
72
|
+
${this.isDemo ? html`
|
|
73
|
+
<style>
|
|
74
|
+
.l-navbar { top: auto !important}
|
|
75
|
+
</style>
|
|
76
|
+
` : html``}
|
|
77
|
+
<header class=${classMap(this._getHeaderClasses())}>
|
|
78
|
+
<div class="mobile-bar">
|
|
79
|
+
<div class="mobile-bar__nav-toggle">
|
|
80
|
+
<button
|
|
81
|
+
@click=${this._onBtnClick}
|
|
82
|
+
class="nav-toggle ${this.opened ? 'nav-toggle--active' : ''}"
|
|
83
|
+
aria-controls="primary-nav"
|
|
84
|
+
aria-expanded="${this.opened ? 'true' : 'false'}"
|
|
85
|
+
aria-label="Toggle Main Menu">
|
|
86
|
+
<span class="nav-toggle__icon nav-toggle__icon--menu">Menu</span>
|
|
87
|
+
</button>
|
|
88
|
+
</div>
|
|
89
|
+
<div class="mobile-bar__fixed-site-name"><a href=${this.siteUrl}>${this.siteName}</a></div>
|
|
90
|
+
<div class="mobile-bar__university">
|
|
91
|
+
<a href="https://www.ucdavis.edu/">
|
|
92
|
+
<img class="ucd-logo" src='data:image/svg+xml;utf8,${this._ucdLogo('gold')}'>
|
|
93
|
+
</a>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div id="branding-bar-container">
|
|
98
|
+
<div class="header__bar">
|
|
99
|
+
<div class="header__university">
|
|
100
|
+
<a href="https://www.ucdavis.edu/">
|
|
101
|
+
<img class="ucd-logo" src='data:image/svg+xml;utf8,${this._ucdLogo()}'>
|
|
102
|
+
</a>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
<div class="l-header__branding">
|
|
106
|
+
${this._hasSlottedBranding ? html`
|
|
107
|
+
<slot name="branding-bar"></slot>
|
|
108
|
+
` : html`
|
|
109
|
+
<div class="site-branding">
|
|
110
|
+
<div class="site-branding__figure" ?hidden=${!this.figureSrc}>
|
|
111
|
+
<a href="${this.siteUrl}" class=""><img src=${this.figureSrc} class="site-logo" alt="Site Logo" /></a>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="site-branding__body">
|
|
114
|
+
<h1 class="site-branding__site-name" ?hidden=${!this.siteName}>
|
|
115
|
+
<a href=${this.siteUrl}>${this.siteName}</a>
|
|
116
|
+
</h1>
|
|
117
|
+
<div class="site-branding__slogan" ?hidden=${!this.slogan}>${this.slogan}</div>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
`}
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<div class="${classMap(this._getNavbarClasses())}" id="nav-bar">
|
|
125
|
+
<div class="l-container--navigation off-canvas off-canvas--left">
|
|
126
|
+
<div class="off-canvas__container l-nav-horizontal">
|
|
127
|
+
${this._hasSearch ? html`
|
|
128
|
+
<div class="l-nav-horizontal__search-popup">
|
|
129
|
+
<slot name="search"></slot>
|
|
130
|
+
</div>
|
|
131
|
+
` : html``}
|
|
132
|
+
${this._hasQuickLinks ? html`
|
|
133
|
+
<div class="l-nav-horizontal__quick-links">
|
|
134
|
+
<slot name="quick-links"></slot>
|
|
135
|
+
</div>
|
|
136
|
+
` : html``}
|
|
137
|
+
<div class="l-nav-horizontal__primary-nav">
|
|
138
|
+
<slot name="primary-nav"></slot>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</header>
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
`;}
|
package/{ucd-theme-image-gallery → brand/ucd-theme-image-gallery}/ucd-theme-image-gallery.js
RENAMED
|
File without changes
|
package/{ucd-theme-image-gallery → brand/ucd-theme-image-gallery}/ucd-theme-image-gallery.tpl.js
RENAMED
|
File without changes
|