@oslokommune/punkt-react 16.9.1 → 16.11.0

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,41 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [16.11.0](https://github.com/oslokommune/punkt/compare/16.10.0...16.11.0) (2026-04-29)
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.10.0](https://github.com/oslokommune/punkt/compare/16.9.1...16.10.0) (2026-04-22)
26
+
27
+ ### ⚠ BREAKING CHANGES
28
+ Ingen
29
+
30
+ ### Features
31
+ * Legger til støtte for "fit-content" som størrelse på modal (#3433).
32
+
33
+
34
+ ### Bug Fixes
35
+ Ingen
36
+
37
+ ### Chores
38
+ Ingen
39
+
40
+ ---
41
+
42
+
8
43
  ## [16.9.1](https://github.com/oslokommune/punkt/compare/16.9.0...16.9.1) (2026-04-22)
9
44
 
10
45
  ### ⚠ BREAKING CHANGES
package/dist/index.d.ts CHANGED
@@ -618,7 +618,7 @@ export declare interface IPktModal extends Omit<HTMLAttributes<HTMLDialogElement
618
618
  headingText?: string;
619
619
  hideCloseButton?: boolean;
620
620
  closeOnBackdropClick?: boolean;
621
- size?: 'small' | 'medium' | 'large';
621
+ size?: 'small' | 'medium' | 'large' | 'fit-content';
622
622
  removePadding?: boolean;
623
623
  closeButtonSkin?: 'blue' | 'yellow-filled';
624
624
  variant?: 'dialog' | 'drawer';
@@ -772,6 +772,8 @@ declare interface IPktTabItem {
772
772
  declare interface IPktTabs {
773
773
  arrowNav?: boolean;
774
774
  disableArrowNav?: boolean;
775
+ separatorIconName?: string;
776
+ separatorIconPath?: string;
775
777
  tabs?: IPktTab[];
776
778
  onTabSelected?: (index: number) => void;
777
779
  children?: ReactNode;
@@ -1084,7 +1084,7 @@ var Ut = class extends ft {
1084
1084
  Ut.directiveName = "unsafeHTML", Ut.resultType = 1;
1085
1085
  var Wt = dt(Ut), Gt = class extends Ut {};
1086
1086
  Gt.directiveName = "unsafeSVG", Gt.resultType = 2;
1087
- var Kt = dt(Gt), qt = "https://punkt-cdn.oslo.kommune.no/16.9/icons/";
1087
+ var Kt = dt(Gt), qt = "https://punkt-cdn.oslo.kommune.no/16.11/icons/";
1088
1088
  typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || qt);
1089
1089
  var Jt = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>", Yt = {}, Xt = 2, Zt = 1500, Qt = typeof Storage < "u" && typeof sessionStorage < "u", $t = (e) => window.pktFetch(e).then((t) => {
1090
1090
  if (!t.ok) throw Error("Missing icon: " + e);
@@ -1146,7 +1146,7 @@ try {
1146
1146
  var X = (e) => e ?? V;
1147
1147
  //#endregion
1148
1148
  //#region ../elements/dist/button-BIpd1xJh.js
1149
- window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.9/animations/";
1149
+ window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.11/animations/";
1150
1150
  var rn = class extends Vt {
1151
1151
  constructor(...e) {
1152
1152
  super(...e), this.iconName = "user", this.secondIconName = "user", this.mode = "light", this.size = "medium", this.fullWidth = !1, this.fullWidthOnMobile = !1, this.skin = "primary", this.variant = "label-only", this.state = "normal", this.type = "button", this.form = void 0, this.isLoading = !1, this.disabled = !1, this.loadingAnimationPath = window.pktAnimationPath;
@@ -6918,7 +6918,7 @@ try {
6918
6918
  } catch {
6919
6919
  console.warn("Forsøker å definere <pkt-header-user-menu>, men den er allerede definert");
6920
6920
  }
6921
- var Oa = "https://punkt-cdn.oslo.kommune.no/16.9/logos/", ka = class extends Vt {
6921
+ var Oa = "https://punkt-cdn.oslo.kommune.no/16.11/logos/", ka = class extends Vt {
6922
6922
  constructor(...e) {
6923
6923
  super(...e), 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, this.isMobile = !1, this.isTablet = !1, this.openMenu = "none", this.isHidden = !1, this.componentWidth = typeof window < "u" ? window.innerWidth : 0, this.alignSlotRight = !1, this.alignSearchRight = !1, this.headerRef = sn(), this.userContainerRef = sn(), this.slotContainerRef = sn(), this.searchContainerRef = sn(), this.slotContentRef = sn(), this.searchMenuRef = sn(), this.lastScrollPosition = 0, this.savedScrollY = 0, this.lastFocusedElement = null, this.shouldRestoreFocus = !1, this.handleScroll = () => {
6924
6924
  if (!this.shouldHideOnScroll) return;
@@ -8958,7 +8958,7 @@ try {
8958
8958
  }
8959
8959
  //#endregion
8960
8960
  //#region ../elements/dist/loader-6kFZUErT.js
8961
- window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.9/animations/";
8961
+ window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.11/animations/";
8962
8962
  var po = class extends Vt {
8963
8963
  constructor(...e) {
8964
8964
  super(...e), this.delay = 0, this.inline = !1, this.isLoading = !0, this.message = null, this.size = "medium", this.variant = "shapes", this.loadingAnimationPath = window.pktAnimationPath, this._shouldDisplayLoader = !1;
@@ -9117,7 +9117,7 @@ try {
9117
9117
  console.warn("Forsøker å definere <pkt-messagebox>, men den er allerede definert");
9118
9118
  }
9119
9119
  //#endregion
9120
- //#region ../elements/dist/modal-C_wtsh9m.js
9120
+ //#region ../elements/dist/modal-pPp8nia6.js
9121
9121
  var go = {
9122
9122
  name: "pkt-modal",
9123
9123
  react: "PktModal",
@@ -9169,7 +9169,8 @@ var go = {
9169
9169
  type: [
9170
9170
  "small",
9171
9171
  "medium",
9172
- "large"
9172
+ "large",
9173
+ "fit-content"
9173
9174
  ],
9174
9175
  category: "ui",
9175
9176
  default: "medium"
@@ -9298,10 +9299,9 @@ var go = {
9298
9299
  </div>`}
9299
9300
  </div>` : V}
9300
9301
  <div class="pkt-modal__container">
9301
- <div
9302
- id="pkt-modal__content"
9303
- class=${Y(n)}
9304
- >${Bt(this)}</div>
9302
+ <div id="pkt-modal__content" class=${Y(n)}>
9303
+ ${Bt(this)}
9304
+ </div>
9305
9305
  </div>
9306
9306
  </div>
9307
9307
  </dialog>
@@ -9497,7 +9497,7 @@ try {
9497
9497
  console.warn("Forsøker å definere <pkt-radiobutton>, men den er allerede definert");
9498
9498
  }
9499
9499
  //#endregion
9500
- //#region ../elements/dist/tabs-C0DWPmn2.js
9500
+ //#region ../elements/dist/tabs-Rc9N9HWa.js
9501
9501
  var Co = class extends Event {
9502
9502
  constructor(e, t, n, r) {
9503
9503
  super("context-request", {
@@ -9656,7 +9656,7 @@ function Ao({ context: e, subscribe: t }) {
9656
9656
  }
9657
9657
  var jo = wo(Symbol("pkt-tabs-context")), Mo = class extends Vt {
9658
9658
  constructor(...e) {
9659
- super(...e), this.arrowNav = !0, this.disableArrowNav = !1, this.tabRefs = [], this.disabledMap = {}, this.tabCount = 0, this.context = {
9659
+ super(...e), this.arrowNav = !0, this.disableArrowNav = !1, this.separatorIconName = "", this.separatorIconPath = "", this.tabRefs = [], this.disabledMap = {}, this.tabCount = 0, this.context = {
9660
9660
  useArrowNav: this.useArrowNav,
9661
9661
  registerTab: this.registerTab.bind(this),
9662
9662
  handleClick: this.handleClick.bind(this),
@@ -9670,7 +9670,23 @@ var jo = wo(Symbol("pkt-tabs-context")), Mo = class extends Vt {
9670
9670
  (e.has("arrowNav") || e.has("disableArrowNav")) && (this.context = {
9671
9671
  ...this.context,
9672
9672
  useArrowNav: this.useArrowNav
9673
- });
9673
+ }), this.updateComplete.then(() => this.syncSeparators());
9674
+ }
9675
+ syncSeparators() {
9676
+ let e = this.querySelector(".pkt-tabs__list");
9677
+ if (!e || (e.querySelectorAll(".pkt-tabs__separator").forEach((e) => e.remove()), !(this.separatorIconName || this.separatorIconPath))) return;
9678
+ let t = Array.from(e.children).filter((e) => !e.classList.contains("pkt-tabs__separator"));
9679
+ for (let e = 0; e < t.length - 1; e++) {
9680
+ let n = document.createElement("span");
9681
+ if (n.className = "pkt-tabs__separator", n.setAttribute("aria-hidden", "true"), n.setAttribute("role", "presentation"), this.separatorIconPath) {
9682
+ let e = document.createElement("img");
9683
+ e.setAttribute("src", this.separatorIconPath), e.setAttribute("alt", ""), e.setAttribute("aria-hidden", "true"), n.appendChild(e);
9684
+ } else if (this.separatorIconName) {
9685
+ let e = document.createElement("pkt-icon");
9686
+ e.setAttribute("name", this.separatorIconName), e.classList.add("pkt-tabs__separator-icon"), n.appendChild(e);
9687
+ }
9688
+ t[e].after(n);
9689
+ }
9674
9690
  }
9675
9691
  registerTab(e, t, n = !1) {
9676
9692
  this.tabRefs[t] = e, this.disabledMap[t] = n, this.tabCount = Math.max(this.tabCount, t + 1);
@@ -9709,9 +9725,10 @@ var jo = wo(Symbol("pkt-tabs-context")), Mo = class extends Vt {
9709
9725
  }
9710
9726
  }
9711
9727
  render() {
9728
+ let e = this.useArrowNav ? "tablist" : "navigation";
9712
9729
  return z`
9713
- <div class="pkt-tabs">
9714
- <div class="pkt-tabs__list" role=${this.useArrowNav ? "tablist" : "navigation"}>${Bt(this)}</div>
9730
+ <div class=${this.separatorIconName || this.separatorIconPath ? "pkt-tabs pkt-tabs--with-separator" : "pkt-tabs"}>
9731
+ <div class="pkt-tabs__list" role=${e}>${Bt(this)}</div>
9715
9732
  </div>
9716
9733
  `;
9717
9734
  }
@@ -9724,7 +9741,15 @@ J([K({
9724
9741
  type: Boolean,
9725
9742
  reflect: !0,
9726
9743
  attribute: "disable-arrow-nav"
9727
- })], Mo.prototype, "disableArrowNav", void 0), J([q()], Mo.prototype, "tabRefs", void 0), J([q()], Mo.prototype, "disabledMap", void 0), J([q()], Mo.prototype, "tabCount", void 0), J([ko({ context: jo }), q()], Mo.prototype, "context", void 0);
9744
+ })], Mo.prototype, "disableArrowNav", void 0), J([K({
9745
+ type: String,
9746
+ reflect: !0,
9747
+ attribute: "separator-icon-name"
9748
+ })], Mo.prototype, "separatorIconName", void 0), J([K({
9749
+ type: String,
9750
+ reflect: !0,
9751
+ attribute: "separator-icon-path"
9752
+ })], Mo.prototype, "separatorIconPath", void 0), J([q()], Mo.prototype, "tabRefs", void 0), J([q()], Mo.prototype, "disabledMap", void 0), J([q()], Mo.prototype, "tabCount", void 0), J([ko({ context: jo }), q()], Mo.prototype, "context", void 0);
9728
9753
  try {
9729
9754
  G("pkt-tabs")(Mo);
9730
9755
  } catch {
@@ -9757,8 +9782,8 @@ var No = class extends Vt {
9757
9782
  this.context && this.context.handleKeyUp(e, this.index);
9758
9783
  }
9759
9784
  render() {
9760
- let e = this.context?.useArrowNav ?? !0, t = this.active && !this.disabled, n = [t ? "active" : "", this.disabled ? "pkt-tabs__item--disabled" : ""].filter(Boolean).join(" "), r = e ? "tab" : void 0, i = e ? t : void 0, a = this.disabled ? -1 : t || !e ? void 0 : -1, o = z`
9761
- ${this.icon ? z`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>` : ""}
9785
+ let e = this.context?.useArrowNav ?? !0, t = this.active && !this.disabled, n = [t ? "active" : "", this.disabled ? "pkt-tabs__item--disabled" : ""].filter(Boolean).join(" "), r = e ? "tab" : void 0, i = e ? t : void 0, a = this.disabled ? -1 : t || !e ? void 0 : -1, o = `pkt-icon--small ${this.icon === "check" ? "pkt-tabs__status-icon" : ""}`, s = z`
9786
+ ${this.icon ? z`<pkt-icon name=${this.icon} class=${o}></pkt-icon>` : ""}
9762
9787
  <span>${Bt(this)}</span>
9763
9788
  ${this.tag ? z`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
9764
9789
  `;
@@ -9775,7 +9800,7 @@ var No = class extends Vt {
9775
9800
  @click=${this.handleClick}
9776
9801
  @keydown=${this.handleKeyDown}
9777
9802
  >
9778
- ${o}
9803
+ ${s}
9779
9804
  </a>
9780
9805
  ` : z`
9781
9806
  <button
@@ -9791,7 +9816,7 @@ var No = class extends Vt {
9791
9816
  @click=${this.handleClick}
9792
9817
  @keydown=${this.handleKeyDown}
9793
9818
  >
9794
- ${o}
9819
+ ${s}
9795
9820
  </button>
9796
9821
  `;
9797
9822
  }
@@ -10807,7 +10832,7 @@ var Jo = s(({ breadcrumbs: e, navigationType: t, renderLink: n, className: r, ..
10807
10832
  });
10808
10833
  //#endregion
10809
10834
  //#region src/components/button/Button.tsx
10810
- Jo.displayName = "PktBreadcrumbs", window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.9/animations/";
10835
+ Jo.displayName = "PktBreadcrumbs", window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.11/animations/";
10811
10836
  var Yo = s(({ children: e, className: t, iconName: n = "user", secondIconName: r = "user", iconPath: i, secondIconPath: a, size: o = "medium", fullWidth: s = !1, fullWidthOnMobile: c = !1, skin: l = "primary", type: u = "button", variant: d = "label-only", state: f, color: p, isLoading: m = void 0, disabled: h = void 0, loadingAnimationPath: g = window.pktAnimationPath, ..._ }, v) => {
10812
10837
  let x = [
10813
10838
  t,
@@ -16450,7 +16475,7 @@ var _d = s(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
16450
16475
  children: /* @__PURE__ */ y(Q, {
16451
16476
  name: "oslologo",
16452
16477
  "aria-hidden": "true",
16453
- path: "https://punkt-cdn.oslo.kommune.no/16.9/logos/"
16478
+ path: "https://punkt-cdn.oslo.kommune.no/16.11/logos/"
16454
16479
  })
16455
16480
  }) : re ? /* @__PURE__ */ y("button", {
16456
16481
  "aria-label": "Tilbake til forside",
@@ -16459,12 +16484,12 @@ var _d = s(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
16459
16484
  children: /* @__PURE__ */ y(Q, {
16460
16485
  name: "oslologo",
16461
16486
  "aria-hidden": "true",
16462
- path: "https://punkt-cdn.oslo.kommune.no/16.9/logos/"
16487
+ path: "https://punkt-cdn.oslo.kommune.no/16.11/logos/"
16463
16488
  })
16464
16489
  }) : /* @__PURE__ */ y(Q, {
16465
16490
  name: "oslologo",
16466
16491
  "aria-hidden": "true",
16467
- path: "https://punkt-cdn.oslo.kommune.no/16.9/logos/"
16492
+ path: "https://punkt-cdn.oslo.kommune.no/16.11/logos/"
16468
16493
  })
16469
16494
  }), T && /* @__PURE__ */ y("span", {
16470
16495
  className: "pkt-header-service__service-name",
@@ -17138,7 +17163,7 @@ var zd = ({ className: e, compact: t = !1, skin: n = "basic", responsiveView: r
17138
17163
  }, _ = /* @__PURE__ */ b(v, { children: [
17139
17164
  a && /* @__PURE__ */ y(Q, {
17140
17165
  name: a,
17141
- className: "pkt-icon--small"
17166
+ className: `pkt-icon--small ${a === "check" ? "pkt-tabs__status-icon" : ""}`
17142
17167
  }),
17143
17168
  e,
17144
17169
  s && /* @__PURE__ */ y(dl, {
@@ -17169,42 +17194,54 @@ var Kd = i(null), qd = () => {
17169
17194
  let e = u(Kd);
17170
17195
  if (!e) throw Error("TabItem must be used within a Tabs component");
17171
17196
  return e;
17172
- }, Jd = s(({ arrowNav: e = !0, disableArrowNav: n = !1, tabs: r, onTabSelected: i, children: a }, o) => {
17173
- let s = g([]), c = g({}), l = e && !n, u = a && t.count(a) > 0 ? t.count(a) : r?.length || 0;
17197
+ }, Jd = s(({ arrowNav: e = !0, disableArrowNav: n = !1, separatorIconName: r, separatorIconPath: i, tabs: a, onTabSelected: o, children: s }, c) => {
17198
+ let l = g([]), u = g({}), f = e && !n, p = t.toArray(s), m = p.length > 0, h = m ? p.length : a?.length || 0, _ = !!(r || i);
17174
17199
  d(() => {
17175
- s.current = s.current.slice(0, u), Object.keys(c.current).forEach((e) => {
17200
+ l.current = l.current.slice(0, h), Object.keys(u.current).forEach((e) => {
17176
17201
  let t = Number(e);
17177
- t >= u && delete c.current[t];
17202
+ t >= h && delete u.current[t];
17178
17203
  });
17179
- }, [u]);
17180
- let f = (e) => r ? !!r[e]?.disabled : !!c.current[e], p = (e) => {
17181
- if (f(e)) return;
17182
- let t = r?.[e];
17183
- t?.action && t.action(e), i && i(e);
17184
- }, m = (e, t) => {
17204
+ }, [h]);
17205
+ let v = (e) => a ? !!a[e]?.disabled : !!u.current[e], b = (e) => {
17206
+ if (v(e)) return;
17207
+ let t = a?.[e];
17208
+ t?.action && t.action(e), o && o(e);
17209
+ }, x = (e, t) => {
17185
17210
  let n = e + t;
17186
- for (; n >= 0 && n < u;) {
17187
- if (!f(n)) return n;
17211
+ for (; n >= 0 && n < h;) {
17212
+ if (!v(n)) return n;
17188
17213
  n += t;
17189
17214
  }
17190
17215
  return null;
17191
- }, h = (e, t) => {
17192
- if (l) {
17216
+ }, S = (e, t) => {
17217
+ if (f) {
17193
17218
  if (t.key === "ArrowLeft") {
17194
17219
  t.preventDefault();
17195
- let n = m(e, -1);
17196
- n !== null && s.current[n]?.focus();
17220
+ let n = x(e, -1);
17221
+ n !== null && l.current[n]?.focus();
17197
17222
  }
17198
17223
  if (t.key === "ArrowRight") {
17199
17224
  t.preventDefault();
17200
- let n = m(e, 1);
17201
- n !== null && s.current[n]?.focus();
17225
+ let n = x(e, 1);
17226
+ n !== null && l.current[n]?.focus();
17202
17227
  }
17203
- (t.key === "Enter" || t.key === " " || t.key === "Spacebar" || t.key === "ArrowDown") && (t.preventDefault(), f(e) || p(e));
17228
+ (t.key === "Enter" || t.key === " " || t.key === "Spacebar" || t.key === "ArrowDown") && (t.preventDefault(), v(e) || b(e));
17204
17229
  }
17205
- }, _ = (e, t, n = !1) => {
17206
- s.current[e] = t, c.current[e] = n;
17207
- }, v = r?.map((e, t) => /* @__PURE__ */ y(Gd, {
17230
+ }, C = (e, t, n = !1) => {
17231
+ l.current[e] = t, u.current[e] = n;
17232
+ }, w = (e) => /* @__PURE__ */ y("span", {
17233
+ className: "pkt-tabs__separator",
17234
+ "aria-hidden": "true",
17235
+ role: "presentation",
17236
+ children: i ? /* @__PURE__ */ y("img", {
17237
+ src: i,
17238
+ alt: "",
17239
+ "aria-hidden": "true"
17240
+ }) : r ? /* @__PURE__ */ y(Q, {
17241
+ name: r,
17242
+ className: "pkt-tabs__separator-icon"
17243
+ }) : null
17244
+ }, e), T = (e) => !_ || e.length <= 1 ? e : e.flatMap((t, n) => n < e.length - 1 ? [t, w(`separator-${n}`)] : [t]), E = a?.map((e, t) => /* @__PURE__ */ y(Gd, {
17208
17245
  active: e.disabled ? !1 : e.active,
17209
17246
  disabled: e.disabled,
17210
17247
  href: e.href,
@@ -17214,21 +17251,21 @@ var Kd = i(null), qd = () => {
17214
17251
  tagSkin: e.tag?.skin,
17215
17252
  index: t,
17216
17253
  children: e.text
17217
- }, t));
17254
+ }, t)), ee = ["pkt-tabs", _ && "pkt-tabs--with-separator"].filter(Boolean).join(" "), D = T(m ? p : E || []);
17218
17255
  return /* @__PURE__ */ y(Kd.Provider, {
17219
17256
  value: {
17220
- arrowNav: l,
17221
- registerTabRef: _,
17222
- handleKeyPress: h,
17223
- selectTab: p
17257
+ arrowNav: f,
17258
+ registerTabRef: C,
17259
+ handleKeyPress: S,
17260
+ selectTab: b
17224
17261
  },
17225
17262
  children: /* @__PURE__ */ y("div", {
17226
- className: "pkt-tabs",
17227
- ref: o,
17263
+ className: ee,
17264
+ ref: c,
17228
17265
  children: /* @__PURE__ */ y("div", {
17229
17266
  className: "pkt-tabs__list",
17230
- role: l ? "tablist" : "navigation",
17231
- children: a || v
17267
+ role: f ? "tablist" : "navigation",
17268
+ children: D
17232
17269
  })
17233
17270
  })
17234
17271
  });