@oslokommune/punkt-elements 16.6.1 → 16.6.2
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/CHANGELOG.md +17 -0
- package/dist/index.d.ts +1 -1
- package/dist/pkt-header.cjs +30 -31
- package/dist/pkt-header.js +121 -121
- package/package.json +2 -2
- package/src/components/header/header-service.ts +39 -35
- package/src/components/header/header.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [16.6.2](https://github.com/oslokommune/punkt/compare/16.6.1...16.6.2) (2026-04-10)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
Ingen
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
Ingen
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
|
|
8
25
|
## [16.6.1](https://github.com/oslokommune/punkt/compare/16.6.0...16.6.1) (2026-04-07)
|
|
9
26
|
|
|
10
27
|
### ⚠ BREAKING CHANGES
|
package/dist/index.d.ts
CHANGED
|
@@ -1111,7 +1111,7 @@ export declare class PktHeaderService extends PktElementWithSlot<IPktHeader> imp
|
|
|
1111
1111
|
private renderSearch;
|
|
1112
1112
|
private renderUserButton;
|
|
1113
1113
|
private renderHeader;
|
|
1114
|
-
render():
|
|
1114
|
+
render(): TemplateResult_2<1>;
|
|
1115
1115
|
}
|
|
1116
1116
|
|
|
1117
1117
|
export declare class PktHeaderUserMenu extends PktElement<IPktHeaderUserMenu> implements IPktHeaderUserMenu {
|
package/dist/pkt-header.cjs
CHANGED
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
<span class="pkt-header-service__service-name" @click=${this.handleServiceClick}>
|
|
124
124
|
<span class="pkt-header-service__service-link">${this.serviceName}</span>
|
|
125
125
|
</span>
|
|
126
|
-
`:t.A}renderSlotContainer(){const e=p.e({"pkt-header-service__slot-container":!0,"is-open":this.openMenu==="slot"}),s=p.e({"pkt-header-service__slot-content":!0,"align-right":this.alignSlotRight});return t.b`
|
|
126
|
+
`:t.A}renderSlotContainer(){if(!this.hasSlotContent())return t.A;const e=p.e({"pkt-header-service__slot-container":!0,"is-open":this.openMenu==="slot"}),s=p.e({"pkt-header-service__slot-content":!0,"align-right":this.alignSlotRight});return t.b`
|
|
127
127
|
<div
|
|
128
128
|
class=${e}
|
|
129
129
|
@focusout=${n=>this.handleFocusOut(n,"slot")}
|
|
@@ -241,35 +241,34 @@
|
|
|
241
241
|
<header class=${e} ${c.n(this.headerRef)}>
|
|
242
242
|
<div class=${s}>${this.renderLogo()} ${this.renderServiceName()}</div>
|
|
243
243
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
</div>
|
|
244
|
+
${this.hasSlotContent()||this.showSearch||this.showLogoutInHeader?t.b`<div class="pkt-header-service__content">
|
|
245
|
+
${this.renderSlotContainer()} ${this.renderSearch()}
|
|
246
|
+
${this.isTablet&&this.showLogoutInHeader?t.b`
|
|
247
|
+
<pkt-button
|
|
248
|
+
skin="secondary"
|
|
249
|
+
size=${this.isMobile?"small":"medium"}
|
|
250
|
+
variant="icon-only"
|
|
251
|
+
iconName="exit"
|
|
252
|
+
@click=${this.handleLogout}
|
|
253
|
+
>
|
|
254
|
+
Logg ut
|
|
255
|
+
</pkt-button>
|
|
256
|
+
`:t.A}
|
|
257
|
+
</div>`:t.A}
|
|
258
|
+
${this.user||!this.isTablet&&this.showLogoutInHeader?t.b`<div class="pkt-header-service__user">
|
|
259
|
+
${this.renderUserButton()}
|
|
260
|
+
${!this.isTablet&&this.showLogoutInHeader?t.b`
|
|
261
|
+
<pkt-button
|
|
262
|
+
skin="tertiary"
|
|
263
|
+
size="medium"
|
|
264
|
+
variant="icon-right"
|
|
265
|
+
iconName="exit"
|
|
266
|
+
@click=${this.handleLogout}
|
|
267
|
+
>
|
|
268
|
+
Logg ut
|
|
269
|
+
</pkt-button>
|
|
270
|
+
`:t.A}
|
|
271
|
+
</div>`:t.A}
|
|
273
272
|
</header>
|
|
274
273
|
`}render(){const e=this.renderHeader();if(this.isFixed){const s=p.e({"pkt-header-service-spacer":!0,"pkt-header-service-spacer--compact":this.compact,"pkt-header-service-spacer--has-user":!!this.user,"pkt-header-service-spacer--mobile":this.isMobile});return t.b`
|
|
275
274
|
<div class="pkt-header-service-wrapper">
|
|
@@ -300,6 +299,6 @@
|
|
|
300
299
|
.userMenu=${this.effectiveUserMenu}
|
|
301
300
|
.representing=${this.representing}
|
|
302
301
|
>
|
|
303
|
-
|
|
302
|
+
${this.hasSlotContent()?t.b`<div class="pkt-contents">${v.slotContent(this)}</div>`:t.A}
|
|
304
303
|
</pkt-header-service>
|
|
305
304
|
`}};a([t.n({type:String,attribute:"service-name"})],exports.PktHeader.prototype,"serviceName",2);a([t.n({type:String,attribute:"service-link"})],exports.PktHeader.prototype,"serviceLink",2);a([t.n({type:String,attribute:"logo-link"})],exports.PktHeader.prototype,"logoLink",2);a([t.n({type:String,attribute:"search-placeholder"})],exports.PktHeader.prototype,"searchPlaceholder",2);a([t.n({type:String,attribute:"search-value"})],exports.PktHeader.prototype,"searchValue",2);a([t.n({type:Number,attribute:"mobile-breakpoint"})],exports.PktHeader.prototype,"mobileBreakpoint",2);a([t.n({type:Number,attribute:"tablet-breakpoint"})],exports.PktHeader.prototype,"tabletBreakpoint",2);a([t.n({type:String,attribute:"opened-menu"})],exports.PktHeader.prototype,"openedMenu",2);a([t.n({type:String,attribute:"log-out-button-placement"})],exports.PktHeader.prototype,"logOutButtonPlacement",2);a([t.n({type:String})],exports.PktHeader.prototype,"position",2);a([t.n({type:String,attribute:"scroll-behavior"})],exports.PktHeader.prototype,"scrollBehavior",2);a([t.n({type:String,attribute:"slot-menu-variant"})],exports.PktHeader.prototype,"slotMenuVariant",2);a([t.n({type:String,attribute:"slot-menu-text"})],exports.PktHeader.prototype,"slotMenuText",2);a([t.n({type:Boolean,attribute:"hide-logo",converter:u.booleanishConverter})],exports.PktHeader.prototype,"hideLogo",2);a([t.n({type:Boolean,converter:u.booleanishConverter})],exports.PktHeader.prototype,"compact",2);a([t.n({type:Boolean,attribute:"show-search",converter:u.booleanishConverter})],exports.PktHeader.prototype,"showSearch",2);a([t.n({type:Boolean,attribute:"can-change-representation",converter:u.booleanishConverter})],exports.PktHeader.prototype,"canChangeRepresentation",2);a([t.n({type:Boolean,attribute:"has-log-out",converter:u.booleanishConverter})],exports.PktHeader.prototype,"hasLogOut",2);a([t.n({type:Object})],exports.PktHeader.prototype,"user",2);a([t.n({type:Array,attribute:"user-menu"})],exports.PktHeader.prototype,"userMenu",2);a([t.n({type:Object})],exports.PktHeader.prototype,"representing",2);a([t.n({type:Array,attribute:"user-menu-footer"})],exports.PktHeader.prototype,"userMenuFooter",2);a([t.n({type:Array,attribute:"user-options"})],exports.PktHeader.prototype,"userOptions",2);exports.PktHeader=a([t.t("pkt-header")],exports.PktHeader);exports.formatLastLoggedIn=g;
|
package/dist/pkt-header.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as M, s as S } from "./element-with-slot-1djk8KXi.js";
|
|
2
|
-
import { P as C, A as
|
|
2
|
+
import { P as C, A as l, b as n, n as s, t as _ } from "./element-CV9utnHJ.js";
|
|
3
3
|
import { o as $ } from "./if-defined-rXcLNTzN.js";
|
|
4
4
|
import { b as d } from "./booleanish-C9R0tdXH.js";
|
|
5
5
|
import { r as k } from "./state-l4hGZdFJ.js";
|
|
@@ -21,10 +21,10 @@ const L = (e) => typeof e.target == "string" ? { title: e.title, iconName: e.ico
|
|
|
21
21
|
minute: "2-digit"
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
|
-
var R = Object.defineProperty, B = Object.getOwnPropertyDescriptor, b = (e, t, i,
|
|
25
|
-
for (var a =
|
|
26
|
-
(m = e[p]) && (a = (
|
|
27
|
-
return
|
|
24
|
+
var R = Object.defineProperty, B = Object.getOwnPropertyDescriptor, b = (e, t, i, u) => {
|
|
25
|
+
for (var a = u > 1 ? void 0 : u ? B(t, i) : t, p = e.length - 1, m; p >= 0; p--)
|
|
26
|
+
(m = e[p]) && (a = (u ? m(t, i, a) : m(a)) || a);
|
|
27
|
+
return u && a && R(t, i, a), a;
|
|
28
28
|
};
|
|
29
29
|
let v = class extends C {
|
|
30
30
|
constructor() {
|
|
@@ -50,7 +50,7 @@ let v = class extends C {
|
|
|
50
50
|
"onClick" in e && typeof e.onClick == "function" && e.onClick();
|
|
51
51
|
}
|
|
52
52
|
renderLinkOrButton(e, t) {
|
|
53
|
-
const i = "href" in e,
|
|
53
|
+
const i = "href" in e, u = g({
|
|
54
54
|
"pkt-user-menu__link": !0,
|
|
55
55
|
"pkt-link-button": !i,
|
|
56
56
|
"pkt-link": !i,
|
|
@@ -59,7 +59,7 @@ let v = class extends C {
|
|
|
59
59
|
});
|
|
60
60
|
return i ? n`
|
|
61
61
|
<pkt-link
|
|
62
|
-
icon-name=${e.iconName ||
|
|
62
|
+
icon-name=${e.iconName || l}
|
|
63
63
|
href=${e.href}
|
|
64
64
|
aria-hidden="true"
|
|
65
65
|
class="pkt-user-menu__link ${t || ""}"
|
|
@@ -67,12 +67,12 @@ let v = class extends C {
|
|
|
67
67
|
${e.title}
|
|
68
68
|
</pkt-link>
|
|
69
69
|
` : n`
|
|
70
|
-
<button class=${
|
|
70
|
+
<button class=${u} type="button" @click=${() => this.handleMenuItemClick(e)}>
|
|
71
71
|
${e.iconName ? n`<pkt-icon
|
|
72
72
|
name=${e.iconName}
|
|
73
73
|
class="pkt-link__icon"
|
|
74
74
|
aria-hidden="true"
|
|
75
|
-
></pkt-icon>` :
|
|
75
|
+
></pkt-icon>` : l}
|
|
76
76
|
${e.title}
|
|
77
77
|
</button>
|
|
78
78
|
`;
|
|
@@ -103,14 +103,14 @@ let v = class extends C {
|
|
|
103
103
|
<div class="pkt-user-menu__last-logged-in">
|
|
104
104
|
Sist pålogget: <time>${this.formattedLastLoggedIn}</time>
|
|
105
105
|
</div>
|
|
106
|
-
` :
|
|
106
|
+
` : l}
|
|
107
107
|
</li>
|
|
108
|
-
` :
|
|
108
|
+
` : l}
|
|
109
109
|
|
|
110
110
|
<!-- User menu items -->
|
|
111
111
|
${e && e.length > 0 ? n`
|
|
112
112
|
<li class="pkt-user-menu__item">${this.renderLinkSection(e)}</li>
|
|
113
|
-
` :
|
|
113
|
+
` : l}
|
|
114
114
|
|
|
115
115
|
<!-- Representing section -->
|
|
116
116
|
${this.representing ? n`
|
|
@@ -119,7 +119,7 @@ let v = class extends C {
|
|
|
119
119
|
<div class="pkt-user-menu__name" translate="no">${this.representing.name}</div>
|
|
120
120
|
${this.representing.orgNumber ? n`<div class="pkt-user-menu__org-number">
|
|
121
121
|
Org.nr. ${this.representing.orgNumber}
|
|
122
|
-
</div>` :
|
|
122
|
+
</div>` : l}
|
|
123
123
|
${this.canChangeRepresentation ? n`
|
|
124
124
|
<ul class="pkt-user-menu__sublist mt-size-16">
|
|
125
125
|
<li class="pkt-user-menu__subitem">
|
|
@@ -130,9 +130,9 @@ let v = class extends C {
|
|
|
130
130
|
})}
|
|
131
131
|
</li>
|
|
132
132
|
</ul>
|
|
133
|
-
` :
|
|
133
|
+
` : l}
|
|
134
134
|
</li>
|
|
135
|
-
` :
|
|
135
|
+
` : l}
|
|
136
136
|
|
|
137
137
|
<!-- Change representation without representing object -->
|
|
138
138
|
${!this.representing && this.canChangeRepresentation ? n`
|
|
@@ -147,7 +147,7 @@ let v = class extends C {
|
|
|
147
147
|
</li>
|
|
148
148
|
</ul>
|
|
149
149
|
</li>
|
|
150
|
-
` :
|
|
150
|
+
` : l}
|
|
151
151
|
|
|
152
152
|
<!-- Logout -->
|
|
153
153
|
${this.logoutOnClick ? n`
|
|
@@ -158,7 +158,7 @@ let v = class extends C {
|
|
|
158
158
|
onClick: () => this.handleLogout()
|
|
159
159
|
})}
|
|
160
160
|
</li>
|
|
161
|
-
` :
|
|
161
|
+
` : l}
|
|
162
162
|
</ul>
|
|
163
163
|
</nav>
|
|
164
164
|
`;
|
|
@@ -189,10 +189,10 @@ b([
|
|
|
189
189
|
v = b([
|
|
190
190
|
_("pkt-header-user-menu")
|
|
191
191
|
], v);
|
|
192
|
-
var E = Object.defineProperty, P = Object.getOwnPropertyDescriptor, r = (e, t, i,
|
|
193
|
-
for (var a =
|
|
194
|
-
(m = e[p]) && (a = (
|
|
195
|
-
return
|
|
192
|
+
var E = Object.defineProperty, P = Object.getOwnPropertyDescriptor, r = (e, t, i, u) => {
|
|
193
|
+
for (var a = u > 1 ? void 0 : u ? P(t, i) : t, p = e.length - 1, m; p >= 0; p--)
|
|
194
|
+
(m = e[p]) && (a = (u ? m(t, i, a) : m(a)) || a);
|
|
195
|
+
return u && a && E(t, i, a), a;
|
|
196
196
|
};
|
|
197
197
|
const x = "https://punkt-cdn.oslo.kommune.no/latest/logos/";
|
|
198
198
|
let o = class extends M {
|
|
@@ -206,21 +206,21 @@ let o = class extends M {
|
|
|
206
206
|
this.user && this.openMenu === "user" && !t.closest(".pkt-header-service__user-container") && (this.openMenu = "none"), this.openMenu === "slot" && !t.closest(".pkt-header-service__slot-container") && (this.openMenu = "none"), this.openMenu === "search" && !t.closest(".pkt-header-service__search-container") && !t.closest(".pkt-header-service__search-input") && (this.openMenu = "none");
|
|
207
207
|
}, this.handleFocusOut = (e, t) => {
|
|
208
208
|
const i = e.relatedTarget;
|
|
209
|
-
let
|
|
209
|
+
let u;
|
|
210
210
|
switch (t) {
|
|
211
211
|
case "user":
|
|
212
|
-
|
|
212
|
+
u = this.userContainerRef;
|
|
213
213
|
break;
|
|
214
214
|
case "slot":
|
|
215
|
-
|
|
215
|
+
u = this.slotContainerRef;
|
|
216
216
|
break;
|
|
217
217
|
case "search":
|
|
218
|
-
|
|
218
|
+
u = this.searchContainerRef;
|
|
219
219
|
break;
|
|
220
220
|
default:
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
|
-
const a =
|
|
223
|
+
const a = u.value;
|
|
224
224
|
a && (!i || !a.contains(i)) && (this.openMenu = "none");
|
|
225
225
|
}, this.handleEscapeKey = (e) => {
|
|
226
226
|
e.key === "Escape" && this.openMenu !== "none" && (e.preventDefault(), this.shouldRestoreFocus = !0, this.openMenu = "none");
|
|
@@ -280,7 +280,7 @@ let o = class extends M {
|
|
|
280
280
|
checkDropdownAlignment(e) {
|
|
281
281
|
const t = e === "slot" ? this.slotContainerRef : this.searchContainerRef, i = e === "slot" ? this.slotContentRef : this.searchMenuRef;
|
|
282
282
|
if (!t.value || !i.value || !this.isTablet || this.isMobile) return;
|
|
283
|
-
const
|
|
283
|
+
const u = t.value.getBoundingClientRect(), a = i.value.offsetWidth, p = u.left + a > window.innerWidth;
|
|
284
284
|
e === "slot" ? this.alignSlotRight = p : this.alignSearchRight = p;
|
|
285
285
|
}
|
|
286
286
|
handleMenuToggle(e) {
|
|
@@ -354,7 +354,7 @@ let o = class extends M {
|
|
|
354
354
|
return this.hasLogOut && (this.logOutButtonPlacement === "userMenu" || this.logOutButtonPlacement === "both");
|
|
355
355
|
}
|
|
356
356
|
renderLogo() {
|
|
357
|
-
if (this.hideLogo) return
|
|
357
|
+
if (this.hideLogo) return l;
|
|
358
358
|
const e = n`
|
|
359
359
|
<pkt-icon name="oslologo" aria-hidden="true" path=${x}></pkt-icon>
|
|
360
360
|
`;
|
|
@@ -402,9 +402,10 @@ let o = class extends M {
|
|
|
402
402
|
<span class="pkt-header-service__service-name" @click=${this.handleServiceClick}>
|
|
403
403
|
<span class="pkt-header-service__service-link">${this.serviceName}</span>
|
|
404
404
|
</span>
|
|
405
|
-
` :
|
|
405
|
+
` : l;
|
|
406
406
|
}
|
|
407
407
|
renderSlotContainer() {
|
|
408
|
+
if (!this.hasSlotContent()) return l;
|
|
408
409
|
const e = g({
|
|
409
410
|
"pkt-header-service__slot-container": !0,
|
|
410
411
|
"is-open": this.openMenu === "slot"
|
|
@@ -432,12 +433,12 @@ let o = class extends M {
|
|
|
432
433
|
>
|
|
433
434
|
${this.slotMenuText}
|
|
434
435
|
</pkt-button>
|
|
435
|
-
` :
|
|
436
|
+
` : l}
|
|
436
437
|
<div
|
|
437
438
|
class=${t}
|
|
438
439
|
id="mobile-slot-menu"
|
|
439
|
-
role=${this.isTablet ? "menu" :
|
|
440
|
-
aria-label=${this.isTablet ? "Meny" :
|
|
440
|
+
role=${this.isTablet ? "menu" : l}
|
|
441
|
+
aria-label=${this.isTablet ? "Meny" : l}
|
|
441
442
|
${y(this.slotContentRef)}
|
|
442
443
|
>
|
|
443
444
|
${S(this)}
|
|
@@ -446,7 +447,7 @@ let o = class extends M {
|
|
|
446
447
|
`;
|
|
447
448
|
}
|
|
448
449
|
renderSearch() {
|
|
449
|
-
if (!this.showSearch) return
|
|
450
|
+
if (!this.showSearch) return l;
|
|
450
451
|
if (this.isTablet) {
|
|
451
452
|
const e = g({
|
|
452
453
|
"pkt-header-service__search-container": !0,
|
|
@@ -492,7 +493,7 @@ let o = class extends M {
|
|
|
492
493
|
i.key === "Enter" && this.handleSearch(i.target.value);
|
|
493
494
|
}}
|
|
494
495
|
></pkt-textinput>
|
|
495
|
-
` :
|
|
496
|
+
` : l}
|
|
496
497
|
</div>
|
|
497
498
|
</div>
|
|
498
499
|
`;
|
|
@@ -513,7 +514,7 @@ let o = class extends M {
|
|
|
513
514
|
}
|
|
514
515
|
renderUserButton() {
|
|
515
516
|
var t;
|
|
516
|
-
if (!this.user) return
|
|
517
|
+
if (!this.user) return l;
|
|
517
518
|
const e = g({
|
|
518
519
|
"pkt-header-service__user-menu": this.isMobile === !1,
|
|
519
520
|
"pkt-header-service__mobile-menu": this.isMobile === !0,
|
|
@@ -545,7 +546,7 @@ let o = class extends M {
|
|
|
545
546
|
<div class=${e}>
|
|
546
547
|
<pkt-header-user-menu
|
|
547
548
|
.user=${this.user}
|
|
548
|
-
formatted-last-logged-in=${this.formattedLastLoggedIn ||
|
|
549
|
+
formatted-last-logged-in=${this.formattedLastLoggedIn || l}
|
|
549
550
|
.representing=${this.representing}
|
|
550
551
|
.userMenu=${this.userMenu}
|
|
551
552
|
?can-change-representation=${this.canChangeRepresentation}
|
|
@@ -556,7 +557,7 @@ let o = class extends M {
|
|
|
556
557
|
@log-out=${this.handleLogout}
|
|
557
558
|
></pkt-header-user-menu>
|
|
558
559
|
</div>
|
|
559
|
-
` :
|
|
560
|
+
` : l}
|
|
560
561
|
</div>
|
|
561
562
|
`;
|
|
562
563
|
}
|
|
@@ -577,35 +578,34 @@ let o = class extends M {
|
|
|
577
578
|
<header class=${e} ${y(this.headerRef)}>
|
|
578
579
|
<div class=${t}>${this.renderLogo()} ${this.renderServiceName()}</div>
|
|
579
580
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
</div>
|
|
581
|
+
${this.hasSlotContent() || this.showSearch || this.showLogoutInHeader ? n`<div class="pkt-header-service__content">
|
|
582
|
+
${this.renderSlotContainer()} ${this.renderSearch()}
|
|
583
|
+
${this.isTablet && this.showLogoutInHeader ? n`
|
|
584
|
+
<pkt-button
|
|
585
|
+
skin="secondary"
|
|
586
|
+
size=${this.isMobile ? "small" : "medium"}
|
|
587
|
+
variant="icon-only"
|
|
588
|
+
iconName="exit"
|
|
589
|
+
@click=${this.handleLogout}
|
|
590
|
+
>
|
|
591
|
+
Logg ut
|
|
592
|
+
</pkt-button>
|
|
593
|
+
` : l}
|
|
594
|
+
</div>` : l}
|
|
595
|
+
${this.user || !this.isTablet && this.showLogoutInHeader ? n`<div class="pkt-header-service__user">
|
|
596
|
+
${this.renderUserButton()}
|
|
597
|
+
${!this.isTablet && this.showLogoutInHeader ? n`
|
|
598
|
+
<pkt-button
|
|
599
|
+
skin="tertiary"
|
|
600
|
+
size="medium"
|
|
601
|
+
variant="icon-right"
|
|
602
|
+
iconName="exit"
|
|
603
|
+
@click=${this.handleLogout}
|
|
604
|
+
>
|
|
605
|
+
Logg ut
|
|
606
|
+
</pkt-button>
|
|
607
|
+
` : l}
|
|
608
|
+
</div>` : l}
|
|
609
609
|
</header>
|
|
610
610
|
`;
|
|
611
611
|
}
|
|
@@ -719,12 +719,12 @@ r([
|
|
|
719
719
|
o = r([
|
|
720
720
|
_("pkt-header-service")
|
|
721
721
|
], o);
|
|
722
|
-
var N = Object.defineProperty, T = Object.getOwnPropertyDescriptor,
|
|
723
|
-
for (var a =
|
|
724
|
-
(m = e[p]) && (a = (
|
|
725
|
-
return
|
|
722
|
+
var N = Object.defineProperty, T = Object.getOwnPropertyDescriptor, c = (e, t, i, u) => {
|
|
723
|
+
for (var a = u > 1 ? void 0 : u ? T(t, i) : t, p = e.length - 1, m; p >= 0; p--)
|
|
724
|
+
(m = e[p]) && (a = (u ? m(t, i, a) : m(a)) || a);
|
|
725
|
+
return u && a && N(t, i, a), a;
|
|
726
726
|
};
|
|
727
|
-
let
|
|
727
|
+
let h = class extends M {
|
|
728
728
|
constructor() {
|
|
729
729
|
super(...arguments), this.searchPlaceholder = "Søk", this.searchValue = "", this.mobileBreakpoint = 768, this.tabletBreakpoint = 1280, this.openedMenu = "none", this.logOutButtonPlacement = "none", this.position = "fixed", this.scrollBehavior = "hide", this.slotMenuVariant = "icon-only", this.slotMenuText = "Meny", this.hideLogo = !1, this.compact = !1, this.showSearch = !1, this.canChangeRepresentation = !1, this.hasLogOut = !1;
|
|
730
730
|
}
|
|
@@ -766,89 +766,89 @@ let l = class extends M {
|
|
|
766
766
|
.userMenu=${this.effectiveUserMenu}
|
|
767
767
|
.representing=${this.representing}
|
|
768
768
|
>
|
|
769
|
-
|
|
769
|
+
${this.hasSlotContent() ? n`<div class="pkt-contents">${S(this)}</div>` : l}
|
|
770
770
|
</pkt-header-service>
|
|
771
771
|
`;
|
|
772
772
|
}
|
|
773
773
|
};
|
|
774
|
-
|
|
774
|
+
c([
|
|
775
775
|
s({ type: String, attribute: "service-name" })
|
|
776
|
-
],
|
|
777
|
-
|
|
776
|
+
], h.prototype, "serviceName", 2);
|
|
777
|
+
c([
|
|
778
778
|
s({ type: String, attribute: "service-link" })
|
|
779
|
-
],
|
|
780
|
-
|
|
779
|
+
], h.prototype, "serviceLink", 2);
|
|
780
|
+
c([
|
|
781
781
|
s({ type: String, attribute: "logo-link" })
|
|
782
|
-
],
|
|
783
|
-
|
|
782
|
+
], h.prototype, "logoLink", 2);
|
|
783
|
+
c([
|
|
784
784
|
s({ type: String, attribute: "search-placeholder" })
|
|
785
|
-
],
|
|
786
|
-
|
|
785
|
+
], h.prototype, "searchPlaceholder", 2);
|
|
786
|
+
c([
|
|
787
787
|
s({ type: String, attribute: "search-value" })
|
|
788
|
-
],
|
|
789
|
-
|
|
788
|
+
], h.prototype, "searchValue", 2);
|
|
789
|
+
c([
|
|
790
790
|
s({ type: Number, attribute: "mobile-breakpoint" })
|
|
791
|
-
],
|
|
792
|
-
|
|
791
|
+
], h.prototype, "mobileBreakpoint", 2);
|
|
792
|
+
c([
|
|
793
793
|
s({ type: Number, attribute: "tablet-breakpoint" })
|
|
794
|
-
],
|
|
795
|
-
|
|
794
|
+
], h.prototype, "tabletBreakpoint", 2);
|
|
795
|
+
c([
|
|
796
796
|
s({ type: String, attribute: "opened-menu" })
|
|
797
|
-
],
|
|
798
|
-
|
|
797
|
+
], h.prototype, "openedMenu", 2);
|
|
798
|
+
c([
|
|
799
799
|
s({ type: String, attribute: "log-out-button-placement" })
|
|
800
|
-
],
|
|
801
|
-
|
|
800
|
+
], h.prototype, "logOutButtonPlacement", 2);
|
|
801
|
+
c([
|
|
802
802
|
s({ type: String })
|
|
803
|
-
],
|
|
804
|
-
|
|
803
|
+
], h.prototype, "position", 2);
|
|
804
|
+
c([
|
|
805
805
|
s({ type: String, attribute: "scroll-behavior" })
|
|
806
|
-
],
|
|
807
|
-
|
|
806
|
+
], h.prototype, "scrollBehavior", 2);
|
|
807
|
+
c([
|
|
808
808
|
s({ type: String, attribute: "slot-menu-variant" })
|
|
809
|
-
],
|
|
810
|
-
|
|
809
|
+
], h.prototype, "slotMenuVariant", 2);
|
|
810
|
+
c([
|
|
811
811
|
s({ type: String, attribute: "slot-menu-text" })
|
|
812
|
-
],
|
|
813
|
-
|
|
812
|
+
], h.prototype, "slotMenuText", 2);
|
|
813
|
+
c([
|
|
814
814
|
s({ type: Boolean, attribute: "hide-logo", converter: d })
|
|
815
|
-
],
|
|
816
|
-
|
|
815
|
+
], h.prototype, "hideLogo", 2);
|
|
816
|
+
c([
|
|
817
817
|
s({ type: Boolean, converter: d })
|
|
818
|
-
],
|
|
819
|
-
|
|
818
|
+
], h.prototype, "compact", 2);
|
|
819
|
+
c([
|
|
820
820
|
s({ type: Boolean, attribute: "show-search", converter: d })
|
|
821
|
-
],
|
|
822
|
-
|
|
821
|
+
], h.prototype, "showSearch", 2);
|
|
822
|
+
c([
|
|
823
823
|
s({
|
|
824
824
|
type: Boolean,
|
|
825
825
|
attribute: "can-change-representation",
|
|
826
826
|
converter: d
|
|
827
827
|
})
|
|
828
|
-
],
|
|
829
|
-
|
|
828
|
+
], h.prototype, "canChangeRepresentation", 2);
|
|
829
|
+
c([
|
|
830
830
|
s({ type: Boolean, attribute: "has-log-out", converter: d })
|
|
831
|
-
],
|
|
832
|
-
|
|
831
|
+
], h.prototype, "hasLogOut", 2);
|
|
832
|
+
c([
|
|
833
833
|
s({ type: Object })
|
|
834
|
-
],
|
|
835
|
-
|
|
834
|
+
], h.prototype, "user", 2);
|
|
835
|
+
c([
|
|
836
836
|
s({ type: Array, attribute: "user-menu" })
|
|
837
|
-
],
|
|
838
|
-
|
|
837
|
+
], h.prototype, "userMenu", 2);
|
|
838
|
+
c([
|
|
839
839
|
s({ type: Object })
|
|
840
|
-
],
|
|
841
|
-
|
|
840
|
+
], h.prototype, "representing", 2);
|
|
841
|
+
c([
|
|
842
842
|
s({ type: Array, attribute: "user-menu-footer" })
|
|
843
|
-
],
|
|
844
|
-
|
|
843
|
+
], h.prototype, "userMenuFooter", 2);
|
|
844
|
+
c([
|
|
845
845
|
s({ type: Array, attribute: "user-options" })
|
|
846
|
-
],
|
|
847
|
-
|
|
846
|
+
], h.prototype, "userOptions", 2);
|
|
847
|
+
h = c([
|
|
848
848
|
_("pkt-header")
|
|
849
|
-
],
|
|
849
|
+
], h);
|
|
850
850
|
export {
|
|
851
|
-
|
|
851
|
+
h as PktHeader,
|
|
852
852
|
o as PktHeaderService,
|
|
853
853
|
v as PktHeaderUserMenu,
|
|
854
854
|
O as formatLastLoggedIn
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "16.6.
|
|
3
|
+
"version": "16.6.2",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
80
80
|
},
|
|
81
81
|
"license": "MIT",
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "420cd507db8426491e86687bf18f3483202f5c25"
|
|
83
83
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PktElementWithSlot } from '@/base-elements/element-with-slot'
|
|
2
|
-
import { html, nothing, PropertyValues } from 'lit'
|
|
2
|
+
import { html, nothing, type PropertyValues, type TemplateResult } from 'lit'
|
|
3
3
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js'
|
|
5
5
|
import { createRef, Ref, ref } from 'lit/directives/ref.js'
|
|
@@ -490,7 +490,8 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
|
|
|
490
490
|
`
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
-
private renderSlotContainer() {
|
|
493
|
+
private renderSlotContainer(): TemplateResult | typeof nothing {
|
|
494
|
+
if (!this.hasSlotContent()) return nothing
|
|
494
495
|
const slotContainerClasses = classMap({
|
|
495
496
|
'pkt-header-service__slot-container': true,
|
|
496
497
|
'is-open': this.openMenu === 'slot',
|
|
@@ -687,39 +688,42 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
|
|
|
687
688
|
<header class=${headerClasses} ${ref(this.headerRef)}>
|
|
688
689
|
<div class=${logoAreaClasses}>${this.renderLogo()} ${this.renderServiceName()}</div>
|
|
689
690
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
691
|
+
${this.hasSlotContent() || this.showSearch || this.showLogoutInHeader
|
|
692
|
+
? html`<div class="pkt-header-service__content">
|
|
693
|
+
${this.renderSlotContainer()} ${this.renderSearch()}
|
|
694
|
+
${this.isTablet && this.showLogoutInHeader
|
|
695
|
+
? html`
|
|
696
|
+
<pkt-button
|
|
697
|
+
skin="secondary"
|
|
698
|
+
size=${this.isMobile ? 'small' : 'medium'}
|
|
699
|
+
variant="icon-only"
|
|
700
|
+
iconName="exit"
|
|
701
|
+
@click=${this.handleLogout}
|
|
702
|
+
>
|
|
703
|
+
Logg ut
|
|
704
|
+
</pkt-button>
|
|
705
|
+
`
|
|
706
|
+
: nothing}
|
|
707
|
+
</div>`
|
|
708
|
+
: nothing}
|
|
709
|
+
${this.user || (!this.isTablet && this.showLogoutInHeader)
|
|
710
|
+
? html`<div class="pkt-header-service__user">
|
|
711
|
+
${this.renderUserButton()}
|
|
712
|
+
${!this.isTablet && this.showLogoutInHeader
|
|
713
|
+
? html`
|
|
714
|
+
<pkt-button
|
|
715
|
+
skin="tertiary"
|
|
716
|
+
size="medium"
|
|
717
|
+
variant="icon-right"
|
|
718
|
+
iconName="exit"
|
|
719
|
+
@click=${this.handleLogout}
|
|
720
|
+
>
|
|
721
|
+
Logg ut
|
|
722
|
+
</pkt-button>
|
|
723
|
+
`
|
|
724
|
+
: nothing}
|
|
725
|
+
</div>`
|
|
726
|
+
: nothing}
|
|
723
727
|
</header>
|
|
724
728
|
`
|
|
725
729
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PktElementWithSlot } from '@/base-elements/element-with-slot'
|
|
2
2
|
import { slotContent } from '@/directives/slot-content'
|
|
3
|
-
import { html, PropertyValues } from 'lit'
|
|
3
|
+
import { html, nothing, PropertyValues } from 'lit'
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js'
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
6
6
|
import {
|
|
@@ -127,7 +127,9 @@ export class PktHeader extends PktElementWithSlot<IPktHeader> implements IPktHea
|
|
|
127
127
|
.userMenu=${this.effectiveUserMenu}
|
|
128
128
|
.representing=${this.representing}
|
|
129
129
|
>
|
|
130
|
-
|
|
130
|
+
${this.hasSlotContent()
|
|
131
|
+
? html`<div class="pkt-contents">${slotContent(this)}</div>`
|
|
132
|
+
: nothing}
|
|
131
133
|
</pkt-header-service>
|
|
132
134
|
`
|
|
133
135
|
}
|