@ucd-lib/theme-elements 1.0.2 → 1.1.1

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.
@@ -18,6 +18,7 @@ import {
18
18
  * @property {String} slogan - Optional text to display below site name
19
19
  * @property {String} figureSrc - Site logo/icon to display next to site name
20
20
  * @property {String} siteUrl - Url to use for links around site name and figure
21
+ * @property {Boolean} silenceWarnings - Console warnings will be silences
21
22
  * @property {Boolean} opened - Whether header is open in the mobile view
22
23
  * @property {Boolean} preventFixed - Navbar will not be fixed to top of screen in desktop view
23
24
  *
@@ -49,6 +50,7 @@ export default class UcdThemeHeader extends LitElement {
49
50
  figureSrc: {type: String, attribute: "figure-src"},
50
51
  siteUrl: {type: String, attribute: "site-url"},
51
52
  opened: {type: Boolean},
53
+ silenceWarnings: {type: Boolean, attribute: 'silence-warnings'},
52
54
  preventFixed: {type: Boolean, attribute: "prevent-fixed"},
53
55
  isDemo: {type: Boolean, attribute: "is-demo"},
54
56
  _transitioning: {type: Boolean, state: true},
@@ -57,6 +59,8 @@ export default class UcdThemeHeader extends LitElement {
57
59
  _hasQuickLinks: {type: Boolean, state: true},
58
60
  _hasSearch: {type: Boolean, state: true},
59
61
  _brandingBarInView: {type: Boolean, state: true},
62
+ _brandingBarLinks: {type: Array, state: true},
63
+ _brandingBarListener: {type: Boolean, state: true},
60
64
  _components: {type: Object, state: true}
61
65
  };
62
66
  }
@@ -79,6 +83,7 @@ export default class UcdThemeHeader extends LitElement {
79
83
  this.figureSrc = "";
80
84
  this.opened = false;
81
85
  this.isDemo = false;
86
+ this.silenceWarnings = false;
82
87
 
83
88
  this._transitioning = false;
84
89
  this._hasPrimaryNav = false;
@@ -87,6 +92,8 @@ export default class UcdThemeHeader extends LitElement {
87
92
  this._hasSearch = false;
88
93
  this._animationDuration = 500;
89
94
  this._brandingBarInView = false;
95
+ this._brandingBarLinks = [];
96
+ this._brandingBarListener = false;
90
97
  this._slottedComponents = {};
91
98
 
92
99
  }
@@ -261,6 +268,21 @@ export default class UcdThemeHeader extends LitElement {
261
268
 
262
269
  }
263
270
 
271
+ /**
272
+ * @method _onBrandingBarUpdate
273
+ * @description Listens to nav item changes to the ucdlib-branding-bar element (if applicable)
274
+ * @private
275
+ * @param {Element} ele - ucdlib-branding-bar element
276
+ */
277
+ _onBrandingBarUpdate(ele) {
278
+ if ( ele.navItems ) {
279
+ this._brandingBarLinks = ele.navItems;
280
+ } else {
281
+ this._brandingBarLinks = [];
282
+ }
283
+ console.log(ele.navItems);
284
+ }
285
+
264
286
  /**
265
287
  * @method _onChildListMutation
266
288
  * @description Fires when there are changes to this element's non-shadow DOM children
@@ -273,7 +295,9 @@ export default class UcdThemeHeader extends LitElement {
273
295
  this._hasPrimaryNav = true;
274
296
  this._slottedComponents.primaryNav = primaryNav;
275
297
  } else {
276
- console.warn("No 'ucd-theme-primary-nav' child element found!");
298
+ if ( !this.silenceWarnings ) {
299
+ console.warn("No 'ucd-theme-primary-nav' child element found!");
300
+ }
277
301
  this._hasPrimaryNav = false;
278
302
  }
279
303
 
@@ -300,10 +324,18 @@ export default class UcdThemeHeader extends LitElement {
300
324
  UcdlibBrandingBar.setAttribute('slot', 'branding-bar');
301
325
  this._hasSlottedBranding = true;
302
326
  this._slottedComponents.brandingBar = UcdlibBrandingBar;
327
+ if ( !this._brandingBarListener ){
328
+ this._onBrandingBarUpdate(UcdlibBrandingBar);
329
+ UcdlibBrandingBar.addEventListener('nav-update', (e) => {this._onBrandingBarUpdate(e.target);});
330
+ this._brandingBarListener = true;
331
+ }
332
+
303
333
  } else if ( this.querySelector("*[slot='branding-bar']") ){
304
334
  this._hasSlottedBranding = true;
335
+ this._brandingBarLinks = [];
305
336
  } else {
306
337
  this._hasSlottedBranding = false;
338
+ this._brandingBarLinks = [];
307
339
  }
308
340
  }
309
341
 
@@ -1,5 +1,6 @@
1
1
  import { html, css } from 'lit';
2
2
  import { classMap } from 'lit/directives/class-map.js';
3
+ import { ifDefined } from 'lit/directives/if-defined.js';
3
4
 
4
5
  import headingStyles from "@ucd-lib/theme-sass/1_base_html/_headings.css.js";
5
6
  import headerStyles from "@ucd-lib/theme-sass/4_component/_header.css.js";
@@ -40,6 +41,9 @@ export function styles() {
40
41
  .fixed-mobile .l-header__branding {
41
42
  margin-top: 55px;
42
43
  }
44
+ .branding-bar-mobile-links {
45
+ display: block;
46
+ }
43
47
  }
44
48
 
45
49
  @media (min-width: 992px) {
@@ -51,6 +55,36 @@ export function styles() {
51
55
  left: 0;
52
56
  width: 100%;
53
57
  }
58
+ .branding-bar-mobile-links {
59
+ display: none;
60
+ }
61
+ }
62
+ .branding-bar-mobile-links ul {
63
+ margin: 0px;
64
+ padding: 0px;
65
+ list-style: none;
66
+ }
67
+ .branding-bar-mobile-links li {
68
+ margin: 0px;
69
+ padding: 0px;
70
+ list-style: none;
71
+ }
72
+ .branding-bar-mobile-links a {
73
+ display: flex;
74
+ align-items: center;
75
+ padding: 0.75rem;
76
+ border-bottom: 0.15rem solid rgb(219, 234, 247);
77
+ background-color: #fff;
78
+ color: rgb(2, 40, 81);
79
+ font-weight: 700;
80
+ line-height: 1.5rem;
81
+ text-decoration: none;
82
+ }
83
+ .branding-bar-mobile-links a:hover {
84
+ background-color: rgb(255, 191, 0);
85
+ }
86
+ .branding-bar-mobile-links li:last-child a {
87
+ border-bottom: none;
54
88
  }
55
89
 
56
90
  `;
@@ -137,6 +171,19 @@ ${this.isDemo ? html`
137
171
  <div class="l-nav-horizontal__primary-nav">
138
172
  <slot name="primary-nav"></slot>
139
173
  </div>
174
+ ${this._brandingBarLinks.length ? html`
175
+ <div class='branding-bar-mobile-links'>
176
+ <ul>
177
+ ${this._brandingBarLinks.map(link => html`
178
+ <li><a
179
+ href=${ifDefined(link.href ? link.href : null)}
180
+ target=${ifDefined(link.newTab ? "_blank": null)}
181
+ >${link.linkText}</a></li>
182
+ `)}
183
+ </ul>
184
+
185
+ </div>
186
+ ` : html``}
140
187
  </div>
141
188
  </div>
142
189
  </div>
@@ -17,6 +17,9 @@ export function styles() {
17
17
  button[disabled] {
18
18
  pointer-events: none;
19
19
  }
20
+ .submenu-toggle__icon {
21
+ min-width: 40%;
22
+ }
20
23
  @media (min-width: 992px) {
21
24
  nav.primary-nav--mega li.depth-0 > ul.menu {
22
25
  opacity: 1;
@@ -29,6 +29,9 @@ export function styles() {
29
29
  .click-attached {
30
30
  cursor: pointer;
31
31
  }
32
+ .submenu-toggle__icon {
33
+ min-width: 40%;
34
+ }
32
35
  @media (min-width: 992px) {
33
36
  .slot-parent {
34
37
  display: block;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucd-lib/theme-elements",
3
- "version": "1.0.2",
3
+ "version": "1.1.1",
4
4
  "description": "Custom elements for the UCD brand theme",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  import {html, LitElement} from 'lit';
2
- import {render, styles} from "./ucd-theme-author-profile.tpl.js";
2
+ import {render, styles} from "./ucdlib-author-profile.tpl.js";
3
3
  import {TaskController} from '../../utils/controllers/task.js';
4
4
 
5
5
  /**
@@ -29,7 +29,8 @@ export default class UcdlibAuthorProfile extends LitElement {
29
29
  positionTitle: {type: String},
30
30
  photo: {type: Object},
31
31
  department: {type: String},
32
- domain: {type: String}
32
+ domain: {type: String},
33
+ sidebar: {type: Boolean}
33
34
  };
34
35
  }
35
36
 
@@ -46,6 +47,7 @@ export default class UcdlibAuthorProfile extends LitElement {
46
47
  this.results = {};
47
48
  this.email = '';
48
49
  this.domain = '';
50
+
49
51
  this.errorMessage = 'This is not an email.';
50
52
 
51
53
  this.svgIcon = {
@@ -149,7 +151,6 @@ export default class UcdlibAuthorProfile extends LitElement {
149
151
  this.PENDING = false;
150
152
  this.LOADING = false;
151
153
 
152
-
153
154
  this.id = this.results.id;
154
155
 
155
156
  this.nameLast = this.results.nameLast;
@@ -217,4 +218,4 @@ export default class UcdlibAuthorProfile extends LitElement {
217
218
 
218
219
  }
219
220
 
220
- customElements.define('ucdlib-theme-author-profile', UcdlibAuthorProfile);
221
+ customElements.define('ucdlib-author-profile', UcdlibAuthorProfile);
@@ -40,6 +40,11 @@ export function render() {
40
40
  width: 33.3%;
41
41
  height:18px;
42
42
  }
43
+ .side-bar{
44
+ display: inline-grid;
45
+ grid-template-columns: 15% 85%;
46
+ width:100%;
47
+ }
43
48
  .container {
44
49
  display: inline-grid;
45
50
  grid-template-columns: 15% 85%;
@@ -75,14 +80,14 @@ export function render() {
75
80
  display:inline-block;
76
81
  }
77
82
  .name {
78
- color:var(--ucd-blue-80);
83
+ color: #13639e;
79
84
  margin-bottom:0;
80
85
  }
81
86
  .title {
82
87
  margin-bottom:0;
83
88
  }
84
89
  .info {
85
- color:var(--ucd-blue-80);
90
+ color: #13639e;
86
91
  margin-bottom:0;
87
92
  }
88
93
  .svg-icon {
@@ -106,6 +111,12 @@ export function render() {
106
111
  display:none;
107
112
  }
108
113
 
114
+ @media (min-width:992px) {
115
+ .container{
116
+ grid-template-columns: 25% 75%;
117
+ }
118
+ }
119
+
109
120
  @media (max-width: 800px) {
110
121
 
111
122
  .contact-list {
@@ -127,6 +138,7 @@ export function render() {
127
138
  .container {
128
139
  grid-template-columns: 35% 65%;
129
140
  }
141
+
130
142
  .photo {
131
143
  width:80%;
132
144
  height:80%;
@@ -151,21 +163,21 @@ ${this.eController ? html`
151
163
  ${!this.LOADING ? html`
152
164
  ${this.photo != "Empty" && this.photo != undefined ?
153
165
  html`
154
- <div class="container">
155
- <div class="photo"><img src="${this.photo.link}" alt="${this.photoAlt}"></div>
156
- <div class="text_container">
157
- <h3 class="name"><a class="name" href="">${this.nameFirst} ${this.nameLast}</a></h3>
158
- <p class="title">${this.positionTitle} <span class="pipe">&#124;</span> ${this.department}</p>
159
- <p class="contact-list">${this.contactPhone ? html`${this.svgIcon.phone} <a class="info" href="tel:${this.contactPhone}">${this.contactPhone}</a> <span class="pipe">&#124;</span>`: html``}</p>
160
- <p class="contact-list">${this.contactEmail ? html`${this.svgIcon.email} <a class="info" href="mailto:${this.contactEmail}">${this.contactEmail}</a> ${this.contactAppointmentUrl ? html`<span class="pipe">&#124;</span>`:html`<span class="noApp-pipe">&#124;</span>`}`: html``}</p>
161
- <p class="contact-list">${this.contactAppointmentUrl ? html`${this.svgIcon.calendar} <a class="info" href="${this.contactAppointmentUrl ? this.contactAppointmentUrl:"#"}">Book an Appointment</a>`: html``}</p>
166
+ <div class="${this.sidebar ? 'side-bar':'container'}">
167
+ <div class="photo"><img src="${this.photo.link}" alt="${this.photoAlt}"></div>
168
+ <div class="text_container">
169
+ <h3 class="name"><a class="name" href="">${this.nameFirst} ${this.nameLast}</a></h3>
170
+ <p class="title">${this.positionTitle} <span class="pipe">&#124;</span> ${this.department}</p>
171
+ <p class="contact-list">${this.contactPhone ? html`${this.svgIcon.phone} <a class="info" href="tel:${this.contactPhone}">${this.contactPhone}</a> <span class="pipe">&#124;</span>`: html``}</p>
172
+ <p class="contact-list">${this.contactEmail ? html`${this.svgIcon.email} <a class="info" href="mailto:${this.contactEmail}">${this.contactEmail}</a> ${this.contactAppointmentUrl ? html`<span class="pipe">&#124;</span>`:html`<span class="noApp-pipe">&#124;</span>`}`: html``}</p>
173
+ <p class="contact-list">${this.contactAppointmentUrl ? html`${this.svgIcon.calendar} <a class="info" href="${this.contactAppointmentUrl ? this.contactAppointmentUrl:"#"}">Book an Appointment</a>`: html``}</p>
174
+ </div>
162
175
  </div>
163
- </div>
164
176
  `
165
177
  :html`
166
178
  <div class="container-no-image">
167
179
  <div class="text_container">
168
- <h3 class="name"><a class="name" href="">${this.nameFirst} ${this.nameLast}</a></h3>
180
+ <h3 class="name"><a class="name" href="${this.link}">${this.nameFirst} ${this.nameLast}</a></h3>
169
181
  <p class="title">${this.positionTitle} <span class="pipe">&#124;</span> ${this.department}</p>
170
182
  <p class="contact-list">${this.contactPhone ? html`${this.svgIcon.phone} <a class="info" href="tel:${this.contactPhone}">${this.contactPhone}</a> <span class="pipe">&#124;</span> `: html``}</p>
171
183
  <p class="contact-list">${this.contactEmail ? html`${this.svgIcon.email} <a class="info" href="mailto:${this.contactEmail}">${this.contactEmail}</a> ${this.contactAppointmentUrl ? html`<span class="pipe">&#124;</span>`:html`<span class="noApp-pipe">&#124;</span>`}`: html``}</p>
@@ -92,7 +92,12 @@ export default class UcdlibBrandingBar extends Mixin(LitElement)
92
92
  */
93
93
  _onChildListMutation(){
94
94
  let navItems = this.parseNavChildren();
95
- if ( navItems.length ) this.navItems = navItems;
95
+ if ( navItems.length ) {
96
+ this.navItems = navItems;
97
+ } else {
98
+ this.navItems = [];
99
+ }
100
+ this.dispatchEvent(new CustomEvent('nav-update', {bubbles: true, composed: false}));
96
101
  }
97
102
 
98
103
  }
@@ -13,7 +13,7 @@ export function styles() {
13
13
  const elementStyles = css`
14
14
  :host {
15
15
  display: block;
16
- max-width: 500px;
16
+ max-width: 33rem;
17
17
  margin: auto;
18
18
  }
19
19
  h2 {
@@ -44,8 +44,9 @@ export function styles() {
44
44
  justify-content: space-between;
45
45
  }
46
46
  .search-options label {
47
- color: ${unsafeCSS(categoryBrands.primary.hex)};
47
+ font-weight: 700;
48
48
  padding-bottom: 0;
49
+ color: ${unsafeCSS(categoryBrands.primary.hex)};
49
50
  }
50
51
  input[type=checkbox] {
51
52
  margin-right: 0;
@@ -53,13 +54,15 @@ export function styles() {
53
54
  .search-options button {
54
55
  border: none;
55
56
  background-color: inherit;
56
- color: ${unsafeCSS(categoryBrands.primary.hex)};
57
+ font-weight: 700;
57
58
  text-decoration: underline;
58
59
  padding: 0;
59
60
  font-family: inherit;
61
+ color: ${unsafeCSS(categoryBrands.primary.hex)};
60
62
  }
61
63
  .checkbox label::before {
62
64
  background-color: white;
65
+ border: 1px solid rgb(153, 153, 153);
63
66
  }
64
67
  .dark h2 {
65
68
  color: ${unsafeCSS(categoryBrands.secondary.hex)}