@ucd-lib/theme-elements 0.0.7 → 0.0.10
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/brand/ucd-theme-breadcrumbs/ucd-theme-breadcrumbs.js +28 -0
- package/brand/ucd-theme-breadcrumbs/ucd-theme-breadcrumbs.tpl.js +24 -0
- package/brand/ucd-theme-focal-link/ucd-theme-focal-link.js +28 -0
- package/brand/ucd-theme-focal-link/ucd-theme-focal-link.tpl.js +25 -0
- package/brand/ucd-theme-header/ucd-theme-header.js +47 -3
- package/brand/ucd-theme-list-accordion/ucd-theme-list-accordion.js +14 -25
- package/brand/ucd-theme-list-accordion/ucd-theme-list-accordion.tpl.js +0 -2
- package/package.json +1 -1
- package/ucdlib/ucdlib-icons/editor.js +305 -0
- package/ucdlib/ucdlib-icons/sitefarm.js +63 -62
- package/ucdlib/ucdlib-icons/utils.js +3 -2
- package/ucdlib/ucdlib-iconset/ucdlib-iconset.js +14 -0
- package/ucdlib/ucdlib-sils-search-redirect/ucdlib-sils-search-redirect.js +138 -0
- package/ucdlib/ucdlib-sils-search-redirect/ucdlib-sils-search-redirect.tpl.js +108 -0
- package/utils/controllers/index.js +5 -0
- package/utils/controllers/popstate-observer.js +51 -0
- package/utils/controllers/sils-primo.js +124 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import {render, styles} from "./ucd-theme-breadcrumbs.tpl";
|
|
3
|
+
|
|
4
|
+
import {Mixin, MainDomElement} from '../../elements/utils/mixins';
|
|
5
|
+
import {BrandedPageElement } from "../utils/index.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export default class PageBrandBreadcrumbs extends Mixin(LitElement)
|
|
9
|
+
.with(MainDomElement, BrandedPageElement ) {
|
|
10
|
+
|
|
11
|
+
static get properties() {
|
|
12
|
+
return {
|
|
13
|
+
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static get styles() {
|
|
18
|
+
return styles();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
this.render = render.bind(this);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
customElements.define('page-brand-breadcrumbs', PageBrandBreadcrumbs);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
|
|
3
|
+
import formStyles from "@ucd-lib/theme-sass/1_base_html/_forms.css.js";
|
|
4
|
+
import breadcrumbsStyles from "@ucd-lib/theme-sass/";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export function styles() {
|
|
8
|
+
const elementStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
return [
|
|
15
|
+
formStyles,
|
|
16
|
+
focalLinkStyles,
|
|
17
|
+
vertLinkStyles,
|
|
18
|
+
elementStyles];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function render() {
|
|
22
|
+
return html`
|
|
23
|
+
|
|
24
|
+
`;}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import {render, styles} from "./ucd-theme-focal-link.tpl";
|
|
3
|
+
|
|
4
|
+
import {Mixin, MainDomElement} from '../../elements/utils/mixins';
|
|
5
|
+
import {BrandedPageElement } from "../utils/index.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export default class PageBrandFocalLink extends Mixin(LitElement)
|
|
9
|
+
.with(MainDomElement, BrandedPageElement ) {
|
|
10
|
+
|
|
11
|
+
static get properties() {
|
|
12
|
+
return {
|
|
13
|
+
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static get styles() {
|
|
18
|
+
return styles();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
this.render = render.bind(this);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
customElements.define('page-brand-focal-link', PageBrandFocalLink);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
|
|
3
|
+
import formStyles from "@ucd-lib/theme-sass/1_base_html/_forms.css.js";
|
|
4
|
+
import focalLinkStyles from "@ucd-lib/theme-sass/4_component/_focal-link.css.js";
|
|
5
|
+
import vertLinkStyles from "@ucd-lib/theme-sass/4_component/_vertical-link.css.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export function styles() {
|
|
9
|
+
const elementStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
return [
|
|
16
|
+
formStyles,
|
|
17
|
+
focalLinkStyles,
|
|
18
|
+
vertLinkStyles,
|
|
19
|
+
elementStyles];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function render() {
|
|
23
|
+
return html`
|
|
24
|
+
|
|
25
|
+
`;}
|
|
@@ -4,6 +4,7 @@ import {render, styles} from "./ucd-theme-header.tpl.js";
|
|
|
4
4
|
import {
|
|
5
5
|
IntersectionObserverController,
|
|
6
6
|
MutationObserverController,
|
|
7
|
+
PopStateObserverController,
|
|
7
8
|
WaitController } from '../../utils/controllers';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -51,10 +52,12 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
51
52
|
preventFixed: {type: Boolean, attribute: "prevent-fixed"},
|
|
52
53
|
isDemo: {type: Boolean, attribute: "is-demo"},
|
|
53
54
|
_transitioning: {type: Boolean, state: true},
|
|
55
|
+
_hasPrimaryNav: {type: Boolean, state: true},
|
|
54
56
|
_hasSlottedBranding: {type: Boolean, state: true},
|
|
55
57
|
_hasQuickLinks: {type: Boolean, state: true},
|
|
56
58
|
_hasSearch: {type: Boolean, state: true},
|
|
57
|
-
_brandingBarInView: {type: Boolean, state: true}
|
|
59
|
+
_brandingBarInView: {type: Boolean, state: true},
|
|
60
|
+
_components: {type: Object, state: true}
|
|
58
61
|
};
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -68,6 +71,7 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
68
71
|
|
|
69
72
|
this.mutationObserver = new MutationObserverController(this);
|
|
70
73
|
this.wait = new WaitController(this);
|
|
74
|
+
new PopStateObserverController(this, "_onLocationChange");
|
|
71
75
|
|
|
72
76
|
this.siteName = "";
|
|
73
77
|
this.siteUrl = "/";
|
|
@@ -77,14 +81,21 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
77
81
|
this.isDemo = false;
|
|
78
82
|
|
|
79
83
|
this._transitioning = false;
|
|
84
|
+
this._hasPrimaryNav = false;
|
|
80
85
|
this._hasSlottedBranding = false;
|
|
81
86
|
this._hasQuickLinks = false;
|
|
82
87
|
this._hasSearch = false;
|
|
83
88
|
this._animationDuration = 500;
|
|
84
89
|
this._brandingBarInView = false;
|
|
90
|
+
this._slottedComponents = {};
|
|
85
91
|
|
|
86
92
|
}
|
|
87
93
|
|
|
94
|
+
/**
|
|
95
|
+
* @method connectedCallback
|
|
96
|
+
* @private
|
|
97
|
+
* @description Custom element lifecycle method
|
|
98
|
+
*/
|
|
88
99
|
connectedCallback(){
|
|
89
100
|
super.connectedCallback();
|
|
90
101
|
if ( !this.preventFixed ) {
|
|
@@ -92,6 +103,11 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
92
103
|
}
|
|
93
104
|
}
|
|
94
105
|
|
|
106
|
+
/**
|
|
107
|
+
* @method firstUpdated
|
|
108
|
+
* @private
|
|
109
|
+
* @description Lit lifecycle hook
|
|
110
|
+
*/
|
|
95
111
|
firstUpdated(){
|
|
96
112
|
if ( !this.preventFixed ) {
|
|
97
113
|
let aboveNav = this.renderRoot.getElementById('branding-bar-container');
|
|
@@ -99,11 +115,33 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
99
115
|
}
|
|
100
116
|
}
|
|
101
117
|
|
|
118
|
+
/**
|
|
119
|
+
* @method _onLocationChange
|
|
120
|
+
* @description Called when url changes by popstate controller
|
|
121
|
+
*/
|
|
122
|
+
_onLocationChange(){
|
|
123
|
+
this.close();
|
|
124
|
+
if ( this._hasQuickLinks ){
|
|
125
|
+
this._slottedComponents.quickLinks.close();
|
|
126
|
+
}
|
|
127
|
+
if ( this._hasSearch ){
|
|
128
|
+
this._slottedComponents.search.close();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @method _onBrandingBarIntersection
|
|
134
|
+
* @private
|
|
135
|
+
* @description Called by intersection observer when branding bar enters/exits screen
|
|
136
|
+
* @param {*} entries
|
|
137
|
+
*/
|
|
102
138
|
_onBrandingBarIntersection(entries){
|
|
103
139
|
let offSetValue = 0;
|
|
104
140
|
try {
|
|
105
141
|
offSetValue = this.renderRoot.getElementById('nav-bar').getBoundingClientRect().height;
|
|
106
|
-
} catch (error) {
|
|
142
|
+
} catch (error) {
|
|
143
|
+
//
|
|
144
|
+
}
|
|
107
145
|
if ( offSetValue > 150 ) offSetValue = 0;
|
|
108
146
|
entries.forEach(entry => {
|
|
109
147
|
this._brandingBarInView = entry.isIntersecting;
|
|
@@ -112,7 +150,7 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
112
150
|
} else {
|
|
113
151
|
this.style.marginBottom = offSetValue + "px";
|
|
114
152
|
}
|
|
115
|
-
})
|
|
153
|
+
});
|
|
116
154
|
}
|
|
117
155
|
|
|
118
156
|
/**
|
|
@@ -232,14 +270,18 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
232
270
|
let primaryNav = this.querySelector('ucd-theme-primary-nav');
|
|
233
271
|
if ( primaryNav ) {
|
|
234
272
|
primaryNav.setAttribute('slot', 'primary-nav');
|
|
273
|
+
this._hasPrimaryNav = true;
|
|
274
|
+
this._slottedComponents.primaryNav = primaryNav;
|
|
235
275
|
} else {
|
|
236
276
|
console.warn("No 'ucd-theme-primary-nav' child element found!");
|
|
277
|
+
this._hasPrimaryNav = false;
|
|
237
278
|
}
|
|
238
279
|
|
|
239
280
|
let quickLinks = this.querySelector('ucd-theme-quick-links');
|
|
240
281
|
if ( quickLinks ) {
|
|
241
282
|
quickLinks.setAttribute('slot', 'quick-links');
|
|
242
283
|
this._hasQuickLinks = true;
|
|
284
|
+
this._slottedComponents.quickLinks = quickLinks;
|
|
243
285
|
} else {
|
|
244
286
|
this._hasQuickLinks = false;
|
|
245
287
|
}
|
|
@@ -248,6 +290,7 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
248
290
|
if ( search ) {
|
|
249
291
|
search.setAttribute('slot', 'search');
|
|
250
292
|
this._hasSearch = true;
|
|
293
|
+
this._slottedComponents.search = search;
|
|
251
294
|
} else {
|
|
252
295
|
this._hasSearch = false;
|
|
253
296
|
}
|
|
@@ -256,6 +299,7 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
256
299
|
if ( UcdlibBrandingBar ) {
|
|
257
300
|
UcdlibBrandingBar.setAttribute('slot', 'branding-bar');
|
|
258
301
|
this._hasSlottedBranding = true;
|
|
302
|
+
this._slottedComponents.brandingBar = UcdlibBrandingBar;
|
|
259
303
|
} else if ( this.querySelector("*[slot='branding-bar']") ){
|
|
260
304
|
this._hasSlottedBranding = true;
|
|
261
305
|
} else {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import { render, styles } from './ucd-theme-list-accordion.tpl.js';
|
|
3
|
+
import { MutationObserverController, WaitController } from '../../utils/controllers';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @class UcdThemeListAccordion
|
|
@@ -27,16 +28,19 @@ export default class UcdThemeListAccordion extends LitElement {
|
|
|
27
28
|
_listItems: { attribute: false, state: true },
|
|
28
29
|
_availableStyles: { attribute: false, state: true },
|
|
29
30
|
_expandedItems: { attribute: false, state: true },
|
|
31
|
+
role: {type: String, reflect: true}
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
constructor() {
|
|
34
36
|
super();
|
|
35
37
|
this.render = render.bind(this);
|
|
38
|
+
this.mutationObserver = new MutationObserverController(this);
|
|
36
39
|
this._listItems = [];
|
|
37
40
|
this._availableStyles = ['accordion', 'faq'];
|
|
38
41
|
this.listStyle = this._availableStyles[0];
|
|
39
42
|
this._expandedItems = new Set();
|
|
43
|
+
this.role = 'list';
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
static get styles() {
|
|
@@ -44,11 +48,12 @@ export default class UcdThemeListAccordion extends LitElement {
|
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
/**
|
|
47
|
-
* @method
|
|
48
|
-
* @
|
|
51
|
+
* @method willUpdate
|
|
52
|
+
* @private
|
|
53
|
+
* @description Lit lifecycle method called right before an element updates
|
|
49
54
|
* @param {Map} props - properties that have changed
|
|
50
55
|
*/
|
|
51
|
-
|
|
56
|
+
willUpdate(props) {
|
|
52
57
|
if (props.has('listStyle')) {
|
|
53
58
|
if (!this._availableStyles.includes(this.listStyle.toLowerCase())) {
|
|
54
59
|
this.listStyle = this._availableStyles[0];
|
|
@@ -56,27 +61,6 @@ export default class UcdThemeListAccordion extends LitElement {
|
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
|
|
59
|
-
/**
|
|
60
|
-
* @method connectedCallback
|
|
61
|
-
* @description Native lifecycle method called when element is connected
|
|
62
|
-
*/
|
|
63
|
-
connectedCallback() {
|
|
64
|
-
super.connectedCallback();
|
|
65
|
-
this._childListObserver = new MutationObserver((mutationsList, observer) =>
|
|
66
|
-
this._onChildListMutation(mutationsList, observer)
|
|
67
|
-
);
|
|
68
|
-
this._childListObserver.observe(this, { childList: true });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @method disconnectedCallback
|
|
73
|
-
* @description Native lifecycle method called when element is disconnected
|
|
74
|
-
*/
|
|
75
|
-
disconnectedCallback() {
|
|
76
|
-
this._childListObserver.disconnect();
|
|
77
|
-
super.disconnectedCallback();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
64
|
/**
|
|
81
65
|
* @method toggleItemVisiblity
|
|
82
66
|
* @description Expands/collapses an item
|
|
@@ -116,6 +100,7 @@ export default class UcdThemeListAccordion extends LitElement {
|
|
|
116
100
|
/**
|
|
117
101
|
* @method _onTitleClick
|
|
118
102
|
* @description Attached to item title
|
|
103
|
+
* @private
|
|
119
104
|
* @param {Event} e
|
|
120
105
|
*/
|
|
121
106
|
_onTitleClick(e) {
|
|
@@ -126,6 +111,7 @@ export default class UcdThemeListAccordion extends LitElement {
|
|
|
126
111
|
/**
|
|
127
112
|
* @method _onTitleKeyUp
|
|
128
113
|
* @description Attached to item title
|
|
114
|
+
* @private
|
|
129
115
|
* @param {Event} e
|
|
130
116
|
*/
|
|
131
117
|
_onTitleKeyUp(e) {
|
|
@@ -136,12 +122,12 @@ export default class UcdThemeListAccordion extends LitElement {
|
|
|
136
122
|
|
|
137
123
|
/**
|
|
138
124
|
* @method _onChildListMutation
|
|
125
|
+
* @private
|
|
139
126
|
* @description Attached to self, responds to changes in children
|
|
140
127
|
*/
|
|
141
128
|
_onChildListMutation() {
|
|
142
129
|
let listItems = [];
|
|
143
130
|
Array.from(this.children).forEach((child, index) => {
|
|
144
|
-
if (child.tagName !== 'DIV') return;
|
|
145
131
|
child.setAttribute('slot', 'list-item-' + index);
|
|
146
132
|
if (this.listStyle === 'faq') {
|
|
147
133
|
child.style.display = 'inline';
|
|
@@ -155,6 +141,7 @@ export default class UcdThemeListAccordion extends LitElement {
|
|
|
155
141
|
/**
|
|
156
142
|
* @method _dispatchItemToggleEvent
|
|
157
143
|
* @description Fires 'item-toggle' custom event when user expands/collapses an item
|
|
144
|
+
* @private
|
|
158
145
|
* @param {Number} index - The index of the item in the _listItems array property
|
|
159
146
|
*/
|
|
160
147
|
_dispatchItemToggleEvent(index) {
|
|
@@ -178,6 +165,7 @@ export default class UcdThemeListAccordion extends LitElement {
|
|
|
178
165
|
/**
|
|
179
166
|
* @method _isTitle
|
|
180
167
|
* @description Item is title or question.
|
|
168
|
+
* @private
|
|
181
169
|
* @param {Number} i - Array index.
|
|
182
170
|
* @returns {Boolean}
|
|
183
171
|
*/
|
|
@@ -188,6 +176,7 @@ export default class UcdThemeListAccordion extends LitElement {
|
|
|
188
176
|
/**
|
|
189
177
|
* @method _isContent
|
|
190
178
|
* @description Item is content or answer.
|
|
179
|
+
* @private
|
|
191
180
|
* @param {Number} i - Array index.
|
|
192
181
|
* @returns {Boolean}
|
|
193
182
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { html, css } from 'lit';
|
|
2
2
|
|
|
3
3
|
import listCss from "@ucd-lib/theme-sass/2_base_class/_lists.css.js";
|
|
4
|
-
import { motionCollapse } from "../../utils/directives/motion-collapse";
|
|
5
4
|
|
|
6
5
|
export function styles() {
|
|
7
6
|
let customStyles = css`
|
|
@@ -40,7 +39,6 @@ ${this._listItems.map((item, index) => html`
|
|
|
40
39
|
` : html`
|
|
41
40
|
<li
|
|
42
41
|
id="accordion-${index}-panel"
|
|
43
|
-
${motionCollapse({duration: 300})}
|
|
44
42
|
class="item-content"
|
|
45
43
|
role="region"
|
|
46
44
|
aria-labelledby="accordion-${index}"
|