@oslokommune/punkt-elements 16.6.0 → 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 CHANGED
@@ -5,6 +5,40 @@ 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
+
25
+ ## [16.6.1](https://github.com/oslokommune/punkt/compare/16.6.0...16.6.1) (2026-04-07)
26
+
27
+ ### ⚠ BREAKING CHANGES
28
+ Ingen
29
+
30
+ ### Features
31
+ Ingen
32
+
33
+ ### Bug Fixes
34
+ Ingen
35
+
36
+ ### Chores
37
+ Ingen
38
+
39
+ ---
40
+
41
+
8
42
  ## [16.6.0](https://github.com/oslokommune/punkt/compare/16.5.1...16.6.0) (2026-04-07)
9
43
 
10
44
  ### ⚠ 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(): TemplateResult<1>;
1114
+ render(): TemplateResult_2<1>;
1115
1115
  }
1116
1116
 
1117
1117
  export declare class PktHeaderUserMenu extends PktElement<IPktHeaderUserMenu> implements IPktHeaderUserMenu {
@@ -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")}
@@ -150,7 +150,9 @@
150
150
  role=${this.isTablet?"menu":t.A}
151
151
  aria-label=${this.isTablet?"Meny":t.A}
152
152
  ${c.n(this.slotContentRef)}
153
- >${v.slotContent(this)}</div>
153
+ >
154
+ ${v.slotContent(this)}
155
+ </div>
154
156
  </div>
155
157
  `}renderSearch(){if(!this.showSearch)return t.A;if(this.isTablet){const e=p.e({"pkt-header-service__search-container":!0,"is-open":this.openMenu==="search"}),s=p.e({"pkt-header-service__mobile-menu":!0,"is-open":this.openMenu==="search","align-right":this.alignSearchRight});return t.b`
156
158
  <div
@@ -218,7 +220,7 @@
218
220
  @click=${()=>this.handleMenuToggle("user")}
219
221
  >
220
222
  <span class="pkt-sr-only">Brukermeny: </span>
221
- ${((s=this.representing)==null?void 0:s.name)||this.user.name}
223
+ <span>${((s=this.representing)==null?void 0:s.name)||this.user.name}</span>
222
224
  </pkt-button>
223
225
  ${this.openMenu==="user"&&this.user?t.b`
224
226
  <div class=${e}>
@@ -239,35 +241,34 @@
239
241
  <header class=${e} ${c.n(this.headerRef)}>
240
242
  <div class=${s}>${this.renderLogo()} ${this.renderServiceName()}</div>
241
243
 
242
- <div class="pkt-header-service__content">
243
- ${this.renderSlotContainer()} ${this.renderSearch()}
244
- ${this.isTablet&&this.showLogoutInHeader?t.b`
245
- <pkt-button
246
- skin="secondary"
247
- size=${this.isMobile?"small":"medium"}
248
- variant="icon-only"
249
- iconName="exit"
250
- @click=${this.handleLogout}
251
- >
252
- Logg ut
253
- </pkt-button>
254
- `:t.A}
255
- </div>
256
-
257
- <div class="pkt-header-service__user">
258
- ${this.renderUserButton()}
259
- ${!this.isTablet&&this.showLogoutInHeader?t.b`
260
- <pkt-button
261
- skin="tertiary"
262
- size="medium"
263
- variant="icon-right"
264
- iconName="exit"
265
- @click=${this.handleLogout}
266
- >
267
- Logg ut
268
- </pkt-button>
269
- `:t.A}
270
- </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}
271
272
  </header>
272
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`
273
274
  <div class="pkt-header-service-wrapper">
@@ -298,6 +299,6 @@
298
299
  .userMenu=${this.effectiveUserMenu}
299
300
  .representing=${this.representing}
300
301
  >
301
- <div class="pkt-contents">${v.slotContent(this)}</div>
302
+ ${this.hasSlotContent()?t.b`<div class="pkt-contents">${v.slotContent(this)}</div>`:t.A}
302
303
  </pkt-header-service>
303
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;
@@ -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 u, b as n, n as s, t as _ } from "./element-CV9utnHJ.js";
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, c) => {
25
- for (var a = c > 1 ? void 0 : c ? B(t, i) : t, p = e.length - 1, m; p >= 0; p--)
26
- (m = e[p]) && (a = (c ? m(t, i, a) : m(a)) || a);
27
- return c && a && R(t, i, a), a;
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, c = g({
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 || u}
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=${c} type="button" @click=${() => this.handleMenuItemClick(e)}>
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>` : u}
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
- ` : u}
106
+ ` : l}
107
107
  </li>
108
- ` : u}
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
- ` : u}
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>` : u}
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
- ` : u}
133
+ ` : l}
134
134
  </li>
135
- ` : u}
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
- ` : u}
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
- ` : u}
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, c) => {
193
- for (var a = c > 1 ? void 0 : c ? P(t, i) : t, p = e.length - 1, m; p >= 0; p--)
194
- (m = e[p]) && (a = (c ? m(t, i, a) : m(a)) || a);
195
- return c && a && E(t, i, a), a;
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 c;
209
+ let u;
210
210
  switch (t) {
211
211
  case "user":
212
- c = this.userContainerRef;
212
+ u = this.userContainerRef;
213
213
  break;
214
214
  case "slot":
215
- c = this.slotContainerRef;
215
+ u = this.slotContainerRef;
216
216
  break;
217
217
  case "search":
218
- c = this.searchContainerRef;
218
+ u = this.searchContainerRef;
219
219
  break;
220
220
  default:
221
221
  return;
222
222
  }
223
- const a = c.value;
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 c = t.value.getBoundingClientRect(), a = i.value.offsetWidth, p = c.left + a > window.innerWidth;
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 u;
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
- ` : u;
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,19 +433,21 @@ let o = class extends M {
432
433
  >
433
434
  ${this.slotMenuText}
434
435
  </pkt-button>
435
- ` : u}
436
+ ` : l}
436
437
  <div
437
438
  class=${t}
438
439
  id="mobile-slot-menu"
439
- role=${this.isTablet ? "menu" : u}
440
- aria-label=${this.isTablet ? "Meny" : u}
440
+ role=${this.isTablet ? "menu" : l}
441
+ aria-label=${this.isTablet ? "Meny" : l}
441
442
  ${y(this.slotContentRef)}
442
- >${S(this)}</div>
443
+ >
444
+ ${S(this)}
445
+ </div>
443
446
  </div>
444
447
  `;
445
448
  }
446
449
  renderSearch() {
447
- if (!this.showSearch) return u;
450
+ if (!this.showSearch) return l;
448
451
  if (this.isTablet) {
449
452
  const e = g({
450
453
  "pkt-header-service__search-container": !0,
@@ -490,7 +493,7 @@ let o = class extends M {
490
493
  i.key === "Enter" && this.handleSearch(i.target.value);
491
494
  }}
492
495
  ></pkt-textinput>
493
- ` : u}
496
+ ` : l}
494
497
  </div>
495
498
  </div>
496
499
  `;
@@ -511,7 +514,7 @@ let o = class extends M {
511
514
  }
512
515
  renderUserButton() {
513
516
  var t;
514
- if (!this.user) return u;
517
+ if (!this.user) return l;
515
518
  const e = g({
516
519
  "pkt-header-service__user-menu": this.isMobile === !1,
517
520
  "pkt-header-service__mobile-menu": this.isMobile === !0,
@@ -537,13 +540,13 @@ let o = class extends M {
537
540
  @click=${() => this.handleMenuToggle("user")}
538
541
  >
539
542
  <span class="pkt-sr-only">Brukermeny: </span>
540
- ${((t = this.representing) == null ? void 0 : t.name) || this.user.name}
543
+ <span>${((t = this.representing) == null ? void 0 : t.name) || this.user.name}</span>
541
544
  </pkt-button>
542
545
  ${this.openMenu === "user" && this.user ? n`
543
546
  <div class=${e}>
544
547
  <pkt-header-user-menu
545
548
  .user=${this.user}
546
- formatted-last-logged-in=${this.formattedLastLoggedIn || u}
549
+ formatted-last-logged-in=${this.formattedLastLoggedIn || l}
547
550
  .representing=${this.representing}
548
551
  .userMenu=${this.userMenu}
549
552
  ?can-change-representation=${this.canChangeRepresentation}
@@ -554,7 +557,7 @@ let o = class extends M {
554
557
  @log-out=${this.handleLogout}
555
558
  ></pkt-header-user-menu>
556
559
  </div>
557
- ` : u}
560
+ ` : l}
558
561
  </div>
559
562
  `;
560
563
  }
@@ -575,35 +578,34 @@ let o = class extends M {
575
578
  <header class=${e} ${y(this.headerRef)}>
576
579
  <div class=${t}>${this.renderLogo()} ${this.renderServiceName()}</div>
577
580
 
578
- <div class="pkt-header-service__content">
579
- ${this.renderSlotContainer()} ${this.renderSearch()}
580
- ${this.isTablet && this.showLogoutInHeader ? n`
581
- <pkt-button
582
- skin="secondary"
583
- size=${this.isMobile ? "small" : "medium"}
584
- variant="icon-only"
585
- iconName="exit"
586
- @click=${this.handleLogout}
587
- >
588
- Logg ut
589
- </pkt-button>
590
- ` : u}
591
- </div>
592
-
593
- <div class="pkt-header-service__user">
594
- ${this.renderUserButton()}
595
- ${!this.isTablet && this.showLogoutInHeader ? n`
596
- <pkt-button
597
- skin="tertiary"
598
- size="medium"
599
- variant="icon-right"
600
- iconName="exit"
601
- @click=${this.handleLogout}
602
- >
603
- Logg ut
604
- </pkt-button>
605
- ` : u}
606
- </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}
607
609
  </header>
608
610
  `;
609
611
  }
@@ -717,12 +719,12 @@ r([
717
719
  o = r([
718
720
  _("pkt-header-service")
719
721
  ], o);
720
- var N = Object.defineProperty, T = Object.getOwnPropertyDescriptor, h = (e, t, i, c) => {
721
- for (var a = c > 1 ? void 0 : c ? T(t, i) : t, p = e.length - 1, m; p >= 0; p--)
722
- (m = e[p]) && (a = (c ? m(t, i, a) : m(a)) || a);
723
- return c && a && N(t, i, a), a;
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;
724
726
  };
725
- let l = class extends M {
727
+ let h = class extends M {
726
728
  constructor() {
727
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;
728
730
  }
@@ -764,89 +766,89 @@ let l = class extends M {
764
766
  .userMenu=${this.effectiveUserMenu}
765
767
  .representing=${this.representing}
766
768
  >
767
- <div class="pkt-contents">${S(this)}</div>
769
+ ${this.hasSlotContent() ? n`<div class="pkt-contents">${S(this)}</div>` : l}
768
770
  </pkt-header-service>
769
771
  `;
770
772
  }
771
773
  };
772
- h([
774
+ c([
773
775
  s({ type: String, attribute: "service-name" })
774
- ], l.prototype, "serviceName", 2);
775
- h([
776
+ ], h.prototype, "serviceName", 2);
777
+ c([
776
778
  s({ type: String, attribute: "service-link" })
777
- ], l.prototype, "serviceLink", 2);
778
- h([
779
+ ], h.prototype, "serviceLink", 2);
780
+ c([
779
781
  s({ type: String, attribute: "logo-link" })
780
- ], l.prototype, "logoLink", 2);
781
- h([
782
+ ], h.prototype, "logoLink", 2);
783
+ c([
782
784
  s({ type: String, attribute: "search-placeholder" })
783
- ], l.prototype, "searchPlaceholder", 2);
784
- h([
785
+ ], h.prototype, "searchPlaceholder", 2);
786
+ c([
785
787
  s({ type: String, attribute: "search-value" })
786
- ], l.prototype, "searchValue", 2);
787
- h([
788
+ ], h.prototype, "searchValue", 2);
789
+ c([
788
790
  s({ type: Number, attribute: "mobile-breakpoint" })
789
- ], l.prototype, "mobileBreakpoint", 2);
790
- h([
791
+ ], h.prototype, "mobileBreakpoint", 2);
792
+ c([
791
793
  s({ type: Number, attribute: "tablet-breakpoint" })
792
- ], l.prototype, "tabletBreakpoint", 2);
793
- h([
794
+ ], h.prototype, "tabletBreakpoint", 2);
795
+ c([
794
796
  s({ type: String, attribute: "opened-menu" })
795
- ], l.prototype, "openedMenu", 2);
796
- h([
797
+ ], h.prototype, "openedMenu", 2);
798
+ c([
797
799
  s({ type: String, attribute: "log-out-button-placement" })
798
- ], l.prototype, "logOutButtonPlacement", 2);
799
- h([
800
+ ], h.prototype, "logOutButtonPlacement", 2);
801
+ c([
800
802
  s({ type: String })
801
- ], l.prototype, "position", 2);
802
- h([
803
+ ], h.prototype, "position", 2);
804
+ c([
803
805
  s({ type: String, attribute: "scroll-behavior" })
804
- ], l.prototype, "scrollBehavior", 2);
805
- h([
806
+ ], h.prototype, "scrollBehavior", 2);
807
+ c([
806
808
  s({ type: String, attribute: "slot-menu-variant" })
807
- ], l.prototype, "slotMenuVariant", 2);
808
- h([
809
+ ], h.prototype, "slotMenuVariant", 2);
810
+ c([
809
811
  s({ type: String, attribute: "slot-menu-text" })
810
- ], l.prototype, "slotMenuText", 2);
811
- h([
812
+ ], h.prototype, "slotMenuText", 2);
813
+ c([
812
814
  s({ type: Boolean, attribute: "hide-logo", converter: d })
813
- ], l.prototype, "hideLogo", 2);
814
- h([
815
+ ], h.prototype, "hideLogo", 2);
816
+ c([
815
817
  s({ type: Boolean, converter: d })
816
- ], l.prototype, "compact", 2);
817
- h([
818
+ ], h.prototype, "compact", 2);
819
+ c([
818
820
  s({ type: Boolean, attribute: "show-search", converter: d })
819
- ], l.prototype, "showSearch", 2);
820
- h([
821
+ ], h.prototype, "showSearch", 2);
822
+ c([
821
823
  s({
822
824
  type: Boolean,
823
825
  attribute: "can-change-representation",
824
826
  converter: d
825
827
  })
826
- ], l.prototype, "canChangeRepresentation", 2);
827
- h([
828
+ ], h.prototype, "canChangeRepresentation", 2);
829
+ c([
828
830
  s({ type: Boolean, attribute: "has-log-out", converter: d })
829
- ], l.prototype, "hasLogOut", 2);
830
- h([
831
+ ], h.prototype, "hasLogOut", 2);
832
+ c([
831
833
  s({ type: Object })
832
- ], l.prototype, "user", 2);
833
- h([
834
+ ], h.prototype, "user", 2);
835
+ c([
834
836
  s({ type: Array, attribute: "user-menu" })
835
- ], l.prototype, "userMenu", 2);
836
- h([
837
+ ], h.prototype, "userMenu", 2);
838
+ c([
837
839
  s({ type: Object })
838
- ], l.prototype, "representing", 2);
839
- h([
840
+ ], h.prototype, "representing", 2);
841
+ c([
840
842
  s({ type: Array, attribute: "user-menu-footer" })
841
- ], l.prototype, "userMenuFooter", 2);
842
- h([
843
+ ], h.prototype, "userMenuFooter", 2);
844
+ c([
843
845
  s({ type: Array, attribute: "user-options" })
844
- ], l.prototype, "userOptions", 2);
845
- l = h([
846
+ ], h.prototype, "userOptions", 2);
847
+ h = c([
846
848
  _("pkt-header")
847
- ], l);
849
+ ], h);
848
850
  export {
849
- l as PktHeader,
851
+ h as PktHeader,
850
852
  o as PktHeaderService,
851
853
  v as PktHeaderUserMenu,
852
854
  O as formatLastLoggedIn
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "16.6.0",
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": "a5df0ac2434d55a4c73421d970a55cc9329fec0e"
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',
@@ -530,7 +531,9 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
530
531
  role=${this.isTablet ? 'menu' : nothing}
531
532
  aria-label=${this.isTablet ? 'Meny' : nothing}
532
533
  ${ref(this.slotContentRef)}
533
- >${slotContent(this)}</div>
534
+ >
535
+ ${slotContent(this)}
536
+ </div>
534
537
  </div>
535
538
  `
536
539
  }
@@ -640,7 +643,7 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
640
643
  @click=${() => this.handleMenuToggle('user')}
641
644
  >
642
645
  <span class="pkt-sr-only">Brukermeny: </span>
643
- ${this.representing?.name || this.user.name}
646
+ <span>${this.representing?.name || this.user.name}</span>
644
647
  </pkt-button>
645
648
  ${this.openMenu === 'user' && this.user
646
649
  ? html`
@@ -685,39 +688,42 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
685
688
  <header class=${headerClasses} ${ref(this.headerRef)}>
686
689
  <div class=${logoAreaClasses}>${this.renderLogo()} ${this.renderServiceName()}</div>
687
690
 
688
- <div class="pkt-header-service__content">
689
- ${this.renderSlotContainer()} ${this.renderSearch()}
690
- ${this.isTablet && this.showLogoutInHeader
691
- ? html`
692
- <pkt-button
693
- skin="secondary"
694
- size=${this.isMobile ? 'small' : 'medium'}
695
- variant="icon-only"
696
- iconName="exit"
697
- @click=${this.handleLogout}
698
- >
699
- Logg ut
700
- </pkt-button>
701
- `
702
- : nothing}
703
- </div>
704
-
705
- <div class="pkt-header-service__user">
706
- ${this.renderUserButton()}
707
- ${!this.isTablet && this.showLogoutInHeader
708
- ? html`
709
- <pkt-button
710
- skin="tertiary"
711
- size="medium"
712
- variant="icon-right"
713
- iconName="exit"
714
- @click=${this.handleLogout}
715
- >
716
- Logg ut
717
- </pkt-button>
718
- `
719
- : nothing}
720
- </div>
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}
721
727
  </header>
722
728
  `
723
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
- <div class="pkt-contents">${slotContent(this)}</div>
130
+ ${this.hasSlotContent()
131
+ ? html`<div class="pkt-contents">${slotContent(this)}</div>`
132
+ : nothing}
131
133
  </pkt-header-service>
132
134
  `
133
135
  }