@oslokommune/punkt-react 6.0.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [6.0.1](https://github.com/oslokommune/punkt/compare/6.0.0...6.0.1) (2023-08-24)
9
+
10
+ ### ⚠ BREAKING CHANGES
11
+ Ingen
12
+
13
+ ### Features
14
+ Ingen
15
+
16
+ ### Bug Fixes
17
+ * Pålogget org => Representerer, pluss headermenyposisjon (#1072). * fix(all): Pålogget org => Representerer, pluss headermenyposisjon
18
+
19
+ * Headerposisjon
20
+
21
+
22
+ ### Chores
23
+ Ingen
24
+
25
+ ---
26
+
27
+
8
28
  ## [6.0.0](https://github.com/oslokommune/punkt/compare/5.2.3...6.0.0) (2023-08-22)
9
29
 
10
30
  ### ⚠ BREAKING CHANGES
@@ -1,4 +1,4 @@
1
- import D, { useState as ue, useEffect as vt, forwardRef as V } from "react";
1
+ import D, { useState as ue, useEffect as vt, forwardRef as B } from "react";
2
2
  function gt(n) {
3
3
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
4
4
  }
@@ -40,9 +40,9 @@ var re = {};
40
40
  * This source code is licensed under the MIT license found in the
41
41
  * LICENSE file in the root directory of this source tree.
42
42
  */
43
- var Be;
43
+ var Ve;
44
44
  function Nt() {
45
- return Be || (Be = 1, process.env.NODE_ENV !== "production" && function() {
45
+ return Ve || (Ve = 1, process.env.NODE_ENV !== "production" && function() {
46
46
  var n = D, c = Symbol.for("react.element"), i = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), m = Symbol.for("react.provider"), o = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), N = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), I = Symbol.iterator, O = "@@iterator";
47
47
  function F(e) {
48
48
  if (e === null || typeof e != "object")
@@ -629,7 +629,7 @@ Check the top-level render call using <` + a + ">.");
629
629
  }
630
630
  process.env.NODE_ENV === "production" ? xe.exports = bt() : xe.exports = Nt();
631
631
  var Ee = xe.exports;
632
- const B = Ee.Fragment, t = Ee.jsx, s = Ee.jsxs, ye = {}, yt = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';
632
+ const V = Ee.Fragment, t = Ee.jsx, s = Ee.jsxs, ye = {}, yt = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';
633
633
  function xt(n, c) {
634
634
  return !ye[n] && typeof window.fetch == "function" && (ye[n] = window.fetch(c + n + ".svg").then((i) => i.ok ? i.text() : (console.error("Missing icon: " + c + n + ".svg"), yt)).then((i) => i)), Promise.resolve(ye[n]);
635
635
  }
@@ -647,7 +647,7 @@ const g = ({ name: n, path: c, className: i = "", ...u }) => {
647
647
  ...u
648
648
  }
649
649
  ) : null;
650
- }, Ve = V(
650
+ }, Be = B(
651
651
  ({
652
652
  children: n,
653
653
  className: c,
@@ -689,7 +689,7 @@ const g = ({ name: n, path: c, className: i = "", ...u }) => {
689
689
  ] })
690
690
  ] }) : null;
691
691
  }
692
- ), ce = V(
692
+ ), ce = B(
693
693
  ({
694
694
  children: n,
695
695
  className: c,
@@ -883,7 +883,7 @@ var He = { exports: {} };
883
883
  })();
884
884
  })(He);
885
885
  var Et = He.exports;
886
- const Ge = /* @__PURE__ */ gt(Et), It = V(
886
+ const Ge = /* @__PURE__ */ gt(Et), It = B(
887
887
  ({
888
888
  logoLink: n = "https://www.oslo.kommune.no/",
889
889
  serviceName: c,
@@ -1002,8 +1002,8 @@ const Ge = /* @__PURE__ */ gt(Et), It = V(
1002
1002
  h.title
1003
1003
  ] }) }, `userMenu-${P}`)) }) }),
1004
1004
  (m || y) && /* @__PURE__ */ s("li", { children: [
1005
- m && /* @__PURE__ */ s(B, { children: [
1006
- /* @__PURE__ */ t("div", { className: "pkt-user-menu__label", children: "Pålogget organisasjon" }),
1005
+ m && /* @__PURE__ */ s(V, { children: [
1006
+ /* @__PURE__ */ t("div", { className: "pkt-user-menu__label", children: "Representerer" }),
1007
1007
  /* @__PURE__ */ t("div", { className: "pkt-user-menu__name", children: m.name }),
1008
1008
  m.orgNumber && /* @__PURE__ */ s("div", { className: "pkt-user-menu__org-number", children: [
1009
1009
  "Org.nr. ",
@@ -1012,10 +1012,10 @@ const Ge = /* @__PURE__ */ gt(Et), It = V(
1012
1012
  ] }),
1013
1013
  /* @__PURE__ */ t("ul", { className: "pkt-list mt-size-16", children: y && /* @__PURE__ */ t("li", { children: /* @__PURE__ */ s("button", { className: "pkt-link", onClick: I, children: [
1014
1014
  /* @__PURE__ */ t(g, { name: "cogwheel", className: "pkt-link__icon" }),
1015
- "Bytt organisasjon"
1015
+ "Endre organisasjon"
1016
1016
  ] }) }) })
1017
1017
  ] }),
1018
- /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t("ul", { className: "pkt-list", children: (o || !E) && /* @__PURE__ */ s(B, { children: [
1018
+ /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t("ul", { className: "pkt-list", children: (o || !E) && /* @__PURE__ */ s(V, { children: [
1019
1019
  o == null ? void 0 : o.map((h, P) => /* @__PURE__ */ t("li", { children: typeof h.target == "string" ? /* @__PURE__ */ s("a", { href: h.target, className: "pkt-link", children: [
1020
1020
  h.iconName && /* @__PURE__ */ t(g, { name: h.iconName, className: "pkt-link__icon" }),
1021
1021
  h.title
@@ -1058,7 +1058,7 @@ const Ge = /* @__PURE__ */ gt(Et), It = V(
1058
1058
  ] })
1059
1059
  );
1060
1060
  wt.displayName = "PktInput";
1061
- const Rt = V(
1061
+ const Rt = B(
1062
1062
  ({
1063
1063
  children: n,
1064
1064
  className: c,
@@ -1101,17 +1101,17 @@ const Ft = ({
1101
1101
  /* @__PURE__ */ t("div", { className: "pkt-messagebox__title", children: i }),
1102
1102
  /* @__PURE__ */ t("div", { className: "pkt-messagebox__text", children: n })
1103
1103
  ] });
1104
- }, Pt = V(
1104
+ }, Pt = B(
1105
1105
  ({ id: n, name: c, label: i, value: u, ...l }, f) => /* @__PURE__ */ s("div", { className: "pkt-form-group", children: [
1106
1106
  /* @__PURE__ */ t("input", { type: "radio", className: "pkt-form-check-input", id: n, name: c, value: u, ref: f, ...l }),
1107
1107
  /* @__PURE__ */ t("label", { className: "pkt-form-label", htmlFor: n, children: i })
1108
1108
  ] })
1109
1109
  );
1110
1110
  Pt.displayName = "PktRadio";
1111
- const Dt = ({ label: n, children: c }) => /* @__PURE__ */ s(B, { children: [
1111
+ const Dt = ({ label: n, children: c }) => /* @__PURE__ */ s(V, { children: [
1112
1112
  /* @__PURE__ */ t("p", { children: n }),
1113
1113
  /* @__PURE__ */ t("div", { className: "pkt-form-group", children: c })
1114
- ] }), Tt = ({ isResponsive: n, children: c }) => n ? /* @__PURE__ */ t("div", { className: "pkt-table-container", children: c }) : /* @__PURE__ */ t(B, { children: c }), At = ({
1114
+ ] }), Tt = ({ isResponsive: n, children: c }) => n ? /* @__PURE__ */ t("div", { className: "pkt-table-container", children: c }) : /* @__PURE__ */ t(V, { children: c }), At = ({
1115
1115
  isResponsive: n,
1116
1116
  modifiers: { info: c = !1, success: i = !1, strong: u = !1, shadow: l = !1 } = {},
1117
1117
  children: f
@@ -1126,7 +1126,7 @@ const Dt = ({ label: n, children: c }) => /* @__PURE__ */ s(B, { children: [
1126
1126
  }),
1127
1127
  children: f
1128
1128
  }
1129
- ) }), Lt = ({ children: n }) => /* @__PURE__ */ t("td", { className: "pkt-table__th", children: n }), Mt = ({ children: n }) => /* @__PURE__ */ t("th", { className: "pkt-table__th", children: n }), Ct = V(({
1129
+ ) }), Lt = ({ children: n }) => /* @__PURE__ */ t("td", { className: "pkt-table__th", children: n }), Mt = ({ children: n }) => /* @__PURE__ */ t("th", { className: "pkt-table__th", children: n }), Ct = B(({
1130
1130
  children: n,
1131
1131
  className: c,
1132
1132
  skin: i = "blue",
@@ -1158,7 +1158,7 @@ const Dt = ({ label: n, children: c }) => /* @__PURE__ */ s(B, { children: [
1158
1158
  f && !m ? "pkt-btn--icon-right" : null,
1159
1159
  c
1160
1160
  ].filter(Boolean).join(" "), F = !E;
1161
- return f && m ? /* @__PURE__ */ t(B, { children: F && /* @__PURE__ */ s(
1161
+ return f && m ? /* @__PURE__ */ t(V, { children: F && /* @__PURE__ */ s(
1162
1162
  "button",
1163
1163
  {
1164
1164
  className: O,
@@ -1172,7 +1172,7 @@ const Dt = ({ label: n, children: c }) => /* @__PURE__ */ s(B, { children: [
1172
1172
  /* @__PURE__ */ t(g, { className: "pkt-tag__close-btn", name: "close" })
1173
1173
  ]
1174
1174
  }
1175
- ) }) : f ? /* @__PURE__ */ t(B, { children: F && /* @__PURE__ */ s(
1175
+ ) }) : f ? /* @__PURE__ */ t(V, { children: F && /* @__PURE__ */ s(
1176
1176
  "button",
1177
1177
  {
1178
1178
  className: O,
@@ -1191,14 +1191,14 @@ const Dt = ({ label: n, children: c }) => /* @__PURE__ */ s(B, { children: [
1191
1191
  ] }) : /* @__PURE__ */ t("span", { className: I, children: n });
1192
1192
  });
1193
1193
  Ct.displayName = "PktTag";
1194
- const jt = V(
1194
+ const jt = B(
1195
1195
  ({ id: n, label: c, ...i }, u) => /* @__PURE__ */ s("div", { className: "pkt-form-group", children: [
1196
1196
  /* @__PURE__ */ t("label", { htmlFor: n, className: "pkt-form-label", children: c }),
1197
1197
  /* @__PURE__ */ t("textarea", { className: "pkt-form-textarea", id: n, ref: u, ...i })
1198
1198
  ] })
1199
1199
  );
1200
1200
  jt.displayName = "PktTextarea";
1201
- const Wt = V(
1201
+ const Wt = B(
1202
1202
  ({
1203
1203
  id: n,
1204
1204
  label: c,
@@ -1243,7 +1243,7 @@ const Wt = V(
1243
1243
  P !== "" && /* @__PURE__ */ t("span", { className: h(), children: P })
1244
1244
  ] }),
1245
1245
  l && /* @__PURE__ */ t("div", { className: "pkt-textinput__helptext", children: l }),
1246
- G && /* @__PURE__ */ s(B, { children: [
1246
+ G && /* @__PURE__ */ s(V, { children: [
1247
1247
  /* @__PURE__ */ t(
1248
1248
  ce,
1249
1249
  {
@@ -1253,7 +1253,7 @@ const Wt = V(
1253
1253
  iconName: Y ? "chevron-thin-up" : "chevron-thin-down",
1254
1254
  className: "pkt-textinput__helptext-expandable pkt-link pkt-link--icon-right",
1255
1255
  onClick: z,
1256
- children: m || /* @__PURE__ */ s(B, { children: [
1256
+ children: m || /* @__PURE__ */ s(V, { children: [
1257
1257
  "Les mer ",
1258
1258
  /* @__PURE__ */ t("span", { className: "pkt-sr-only", children: "om inputfeltet" })
1259
1259
  ] })
@@ -1263,7 +1263,7 @@ const Wt = V(
1263
1263
  "div",
1264
1264
  {
1265
1265
  className: `pkt-textinput__helptext ${Y ? "pkt-textinput__helptext-expandable-open" : "pkt-textinput__helptext-expandable-closed"}`,
1266
- children: /* @__PURE__ */ t(Ve, { children: f })
1266
+ children: /* @__PURE__ */ t(Be, { children: f })
1267
1267
  }
1268
1268
  ),
1269
1269
  /* @__PURE__ */ t(
@@ -1343,12 +1343,12 @@ const Wt = V(
1343
1343
  ]
1344
1344
  }
1345
1345
  ),
1346
- y && /* @__PURE__ */ t(Ve, { skin: "error", "aria-live": "assertive", children: N })
1346
+ y && /* @__PURE__ */ t(Be, { skin: "error", "aria-live": "assertive", children: N })
1347
1347
  ] });
1348
1348
  }
1349
1349
  );
1350
1350
  export {
1351
- Ve as PktAlert,
1351
+ Be as PktAlert,
1352
1352
  ce as PktButton,
1353
1353
  Ot as PktFooter,
1354
1354
  $t as PktFooterSimple,
@@ -28,4 +28,4 @@ Check the top-level render call using <`+a+">.")}return r}}function qe(e,r){{if(
28
28
  Copyright (c) 2018 Jed Watson.
29
29
  Licensed under the MIT License (MIT), see
30
30
  http://jedwatson.github.io/classnames
31
- */(function(n){(function(){var c={}.hasOwnProperty;function s(){for(var u=[],l=0;l<arguments.length;l++){var f=arguments[l];if(f){var m=typeof f;if(m==="string"||m==="number")u.push(f);else if(Array.isArray(f)){if(f.length){var o=s.apply(null,f);o&&u.push(o)}}else if(m==="object"){if(f.toString!==Object.prototype.toString&&!f.toString.toString().includes("[native code]")){u.push(f.toString());continue}for(var d in f)c.call(f,d)&&f[d]&&u.push(d)}}}return u.join(" ")}n.exports?(s.default=s,n.exports=s):window.classNames=s})()})(Te);var nt=Te.exports;const Re=Xe(nt),lt=b.forwardRef(({logoLink:n="https://www.oslo.kommune.no/",serviceName:c,fixed:s=!0,scrollToHide:u=!0,user:l,userMenu:f,representing:m,userOptions:o,userMenuFooter:d,canChangeRepresentation:E=!0,showMenuButton:y=!1,showLogOutButton:x=!1,openMenu:S,logOut:O,changeRepresentation:D,...I},A)=>{const j=b.useMemo(()=>typeof(l==null?void 0:l.lastLoggedIn)=="string"?l.lastLoggedIn:l!=null&&l.lastLoggedIn?new Date(l.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"}):"",[l]),[P,re]=b.useState(!1),[Y,q]=b.useState(0),[H,U]=b.useState(!1),L=b.useRef(null);b.useEffect(()=>(document.addEventListener("mouseup",J),window.addEventListener("scroll",z),()=>{document.removeEventListener("mouseup",J),window.removeEventListener("scroll",z)}));const B=()=>{U(!H)},J=k=>{L.current&&!L.current.contains(k.target)&&U(!1)},z=()=>{if(u){const k=window.pageYOffset||document.documentElement.scrollTop;if(k<0||Math.abs(k-Y)<60)return;re(k>Y),q(k)}};return i("header",{...I,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:Re("pkt-header",{"pkt-header--fixed":s,"pkt-header--scroll-to-hide":u,"pkt-header--hidden":P}),ref:A,children:[i("div",{className:"pkt-header__logo",children:[t("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:n,children:t(g,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/6.0/logos/"})}),t("span",{className:"pkt-header__logo-service",children:c})]}),t("nav",{className:"pkt-header__actions",children:i("ul",{className:"pkt-header__actions-row",children:[y&&t("li",{children:t(te,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:S,children:"Meny"})}),(l||m)&&i("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${H&&!P?"pkt-header--open-dropdown":""}`,ref:L,children:[i("button",{className:"pkt-header__user-btn pkt-btn pkt-btn--secondary pkt-btn--icons-right-and-left",type:"button",role:"button","aria-controls":"pktUserDropdown","aria-expanded":H,onClick:B,children:[t(g,{name:"user",className:"pkt-btn__icon"}),t("span",{className:"pkt-header__user-fullname",children:(m==null?void 0:m.name)||(l==null?void 0:l.name)}),t("span",{className:"pkt-header__user-shortname",children:(m==null?void 0:m.shortname)||(l==null?void 0:l.shortname)}),t(g,{name:"chevron-thin-down",className:"pkt-btn--closed"}),t(g,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),i("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[l&&i("li",{children:[t("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),t("div",{className:"pkt-user-menu__name",children:l.name}),l.lastLoggedIn&&i("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",t("time",{children:j})]})]}),f&&t("li",{children:t("ul",{className:"pkt-list",children:f.map((k,C)=>t("li",{children:typeof k.target=="string"?i("a",{href:k.target,className:"pkt-link",children:[k.iconName&&t(g,{name:k.iconName,className:"pkt-link__icon"}),k.title]}):i("button",{className:"pkt-link",onClick:k.target,children:[k.iconName&&t(g,{name:k.iconName,className:"pkt-link__icon"}),k.title]})},`userMenu-${C}`))})}),(m||E)&&i("li",{children:[m&&i(W,{children:[t("div",{className:"pkt-user-menu__label",children:"Pålogget organisasjon"}),t("div",{className:"pkt-user-menu__name",children:m.name}),m.orgNumber&&i("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",m.orgNumber]})]}),t("ul",{className:"pkt-list mt-size-16",children:E&&t("li",{children:i("button",{className:"pkt-link",onClick:D,children:[t(g,{name:"cogwheel",className:"pkt-link__icon"}),"Bytt organisasjon"]})})})]}),t("li",{children:t("ul",{className:"pkt-list",children:(o||!x)&&i(W,{children:[o==null?void 0:o.map((k,C)=>t("li",{children:typeof k.target=="string"?i("a",{href:k.target,className:"pkt-link",children:[k.iconName&&t(g,{name:k.iconName,className:"pkt-link__icon"}),k.title]}):i("button",{className:"pkt-link",onClick:k.target,children:[k.iconName&&t(g,{name:k.iconName,className:"pkt-link__icon"}),k.title]})},`userOptions-${C}`)),!x&&t("li",{children:i("button",{className:"pkt-link",onClick:O,children:[t(g,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),d&&t("li",{className:"footer",children:t("ul",{className:"pkt-list-horizontal bordered",children:d.map((k,C)=>t("li",{children:typeof k.target=="string"?t("a",{href:k.target,className:"pkt-link",children:k.title}):t("button",{className:"pkt-link",onClick:k.target,children:k.title})},`userMenuFooter-${C}`))})})]})]}),x&&t("li",{children:t(te,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:O,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),Ce=b.forwardRef(({label:n,id:c,children:s,...u},l)=>i("div",{className:"pkt-form-group",children:[t("label",{htmlFor:c,className:"pkt-form-label",children:n}),t("input",{className:"pkt-form-input",id:c,...u,ref:l}),s]}));Ce.displayName="PktInput";const Se=b.forwardRef(({children:n,className:c,iconName:s="user",openInNewTab:u=!1,skin:l="normal",href:f="#",external:m=!1,title:o},d)=>{const E=[c,"pkt-linkcard",l&&`pkt-linkcard--${l}`].filter(Boolean).join(" ");return i("a",{href:f,className:`pkt-linkcard pkt-link ${E}`,target:u?"_blank":"_self",rel:u?"noopener noreferrer":void 0,ref:d,children:[t(g,{className:"pkt-link__icon",name:s}),i("div",{className:"pkt-linkcard__content",children:[t("div",{className:`pkt-linkcard__title ${m?"pkt-link pkt-link--external":""}`,children:o}),t("div",{className:"pkt-linkcard__text",children:n})]})]})});Se.displayName="PktLinkCard";const ot=({children:n,skin:c="beige",title:s,...u})=>{const l=["pkt-messagebox",c&&`pkt-messagebox--${c}`].filter(Boolean).join(" ");return i("div",{...u,className:l,children:[t("div",{className:"pkt-messagebox__title",children:s}),t("div",{className:"pkt-messagebox__text",children:n})]})},je=b.forwardRef(({id:n,name:c,label:s,value:u,...l},f)=>i("div",{className:"pkt-form-group",children:[t("input",{type:"radio",className:"pkt-form-check-input",id:n,name:c,value:u,ref:f,...l}),t("label",{className:"pkt-form-label",htmlFor:n,children:s})]}));je.displayName="PktRadio";const it=({label:n,children:c})=>i(W,{children:[t("p",{children:n}),t("div",{className:"pkt-form-group",children:c})]}),st=({isResponsive:n,children:c})=>n?t("div",{className:"pkt-table-container",children:c}):t(W,{children:c}),ct=({isResponsive:n,modifiers:{info:c=!1,success:s=!1,strong:u=!1,shadow:l=!1}={},children:f})=>t(st,{isResponsive:n,children:t("table",{className:Re("pkt-table",{"pkt-table--info":c,"pkt-table--success":s,"pkt-table--strong":u,"pkt-table--shadow":l}),children:f})}),ut=({children:n})=>t("td",{className:"pkt-table__th",children:n}),ft=({children:n})=>t("th",{className:"pkt-table__th",children:n}),Oe=b.forwardRef(({children:n,className:c,skin:s="blue",textStyle:u="normal-text",size:l="medium",closeTag:f=!1,iconName:m="",type:o="button",ariaLabel:d="close",onClick:E=()=>{}},y)=>{const[x,S]=b.useState(!1),O=j=>{S(!0),E(j)},D=["pkt-tag",l&&`pkt-tag--${l}`,s&&`pkt-tag--${s}`,u&&`pkt-tag--${u}`,c].filter(Boolean).join(" "),I=["pkt-tag","pkt-btn","pkt-btn--tertiary",l&&`pkt-tag--${l}`,s&&`pkt-tag--${s}`,u&&`pkt-tag--${u}`,m&&f?"pkt-btn--icons-right-and-left":null,f&&!m?"pkt-btn--icon-right":null,c].filter(Boolean).join(" "),A=!x;return f&&m?t(W,{children:A&&i("button",{className:I,type:o,"aria-label":d,onClick:O,ref:y,children:[t(g,{className:"pkt-tag__icon",name:m}),n,t(g,{className:"pkt-tag__close-btn",name:"close"})]})}):f?t(W,{children:A&&i("button",{className:I,type:o,"aria-label":d,onClick:O,ref:y,children:[t(g,{className:"pkt-tag__close-btn",name:"close"}),n]})}):m?i("span",{className:D,children:[t(g,{className:"pkt-tag__icon",name:m}),n]}):t("span",{className:D,children:n})});Oe.displayName="PktTag";const $e=b.forwardRef(({id:n,label:c,...s},u)=>i("div",{className:"pkt-form-group",children:[t("label",{htmlFor:n,className:"pkt-form-label",children:c}),t("textarea",{className:"pkt-form-textarea",id:n,ref:u,...s})]}));$e.displayName="PktTextarea";const dt=b.forwardRef(({id:n,label:c,name:s,srOnlyLabel:u=!1,helptext:l,helptextDropdown:f,helptextDropdownButton:m,optional:o=!1,required:d=!1,hasError:E=!1,errorMessage:y,placeholder:x,type:S="text",autocomplete:O="off",value:D,suffix:I,prefix:A,iconNameRight:j,disabled:P=!1,inline:re=!1,ariaLabelledby:Y,ariaDescribedby:q,className:H,...U},L)=>{const[B,J]=b.useState(!1),z=()=>{J(!B)},k=()=>o?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":d?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",C=o?"Valgfritt":d?"Må fylles ut":"",ne=[H,"pkt-textinput",P?"pkt-textinput--disabled":"",re?"pkt-textinput--inline":"",E?"pkt-textinput--error":""].join(" "),G=!!f&&f!=="";return i("div",{className:ne,children:[i(G?"div":"label",{htmlFor:n,className:`pkt-textinput__label ${u?"pkt-sr-only":""}`,"aria-describedby":G?"":q,children:[i(G?"h2":"span",{children:[c,C!==""&&t("span",{className:k(),children:C})]}),l&&t("div",{className:"pkt-textinput__helptext",children:l}),G&&i(W,{children:[t(te,{skin:"tertiary",size:"small",variant:"icon-right",iconName:B?"chevron-thin-up":"chevron-thin-down",className:"pkt-textinput__helptext-expandable pkt-link pkt-link--icon-right",onClick:z,children:m||i(W,{children:["Les mer ",t("span",{className:"pkt-sr-only",children:"om inputfeltet"})]})}),t("div",{className:`pkt-textinput__helptext ${B?"pkt-textinput__helptext-expandable-open":"pkt-textinput__helptext-expandable-closed"}`,children:t(pe,{children:f})}),t("label",{htmlFor:n,className:"pkt-textinput__label pkt-sr-only","aria-describedby":q,children:c})]}),A&&i("div",{className:"pkt-textinput__input-prefix-wrapper",children:[t("div",{className:"pkt-textinput__input-prefix",children:A}),t("input",{ref:L,className:"pkt-textinput__input",type:S,name:s||n,id:n,placeholder:x,autoComplete:O,value:D,disabled:P,"aria-required":d,"aria-invalid":E,"aria-labelledby":Y,...U})]}),!A&&(I||j)&&i("div",{className:"pkt-textinput__input-suffix-wrapper",children:[t("input",{ref:L,className:"pkt-textinput__input",type:S,name:s||n,id:n,placeholder:x,autoComplete:O,value:D,disabled:P,"aria-required":d,"aria-invalid":E,"aria-labelledby":Y,...U}),I&&i("p",{className:"pkt-textinput__input-suffix",children:[I,j&&t(g,{className:"pkt-textinput__input-suffix-icon",name:j})]}),!I&&j&&t(g,{className:"pkt-textinput__input-icon",name:j})]}),!A&&!I&&!j&&!f&&t("input",{ref:L,className:"pkt-textinput__input",type:S,name:s||n,id:n,placeholder:x,autoComplete:O,value:D,disabled:P,"aria-required":d,"aria-invalid":E,"aria-labelledby":Y,...U})]}),E&&t(pe,{skin:"error","aria-live":"assertive",children:y})]})});w.PktAlert=pe,w.PktButton=te,w.PktFooter=rt,w.PktFooterSimple=at,w.PktHeader=lt,w.PktIcon=g,w.PktInput=Ce,w.PktLinkCard=Se,w.PktMessagebox=ot,w.PktRadio=je,w.PktRadioGroup=it,w.PktTable=ct,w.PktTableData=ut,w.PktTableHeader=ft,w.PktTag=Oe,w.PktTextarea=$e,w.PktTextinput=dt,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
31
+ */(function(n){(function(){var c={}.hasOwnProperty;function s(){for(var u=[],l=0;l<arguments.length;l++){var f=arguments[l];if(f){var m=typeof f;if(m==="string"||m==="number")u.push(f);else if(Array.isArray(f)){if(f.length){var o=s.apply(null,f);o&&u.push(o)}}else if(m==="object"){if(f.toString!==Object.prototype.toString&&!f.toString.toString().includes("[native code]")){u.push(f.toString());continue}for(var d in f)c.call(f,d)&&f[d]&&u.push(d)}}}return u.join(" ")}n.exports?(s.default=s,n.exports=s):window.classNames=s})()})(Te);var nt=Te.exports;const Re=Xe(nt),lt=b.forwardRef(({logoLink:n="https://www.oslo.kommune.no/",serviceName:c,fixed:s=!0,scrollToHide:u=!0,user:l,userMenu:f,representing:m,userOptions:o,userMenuFooter:d,canChangeRepresentation:E=!0,showMenuButton:y=!1,showLogOutButton:x=!1,openMenu:S,logOut:O,changeRepresentation:D,...I},A)=>{const j=b.useMemo(()=>typeof(l==null?void 0:l.lastLoggedIn)=="string"?l.lastLoggedIn:l!=null&&l.lastLoggedIn?new Date(l.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"}):"",[l]),[P,re]=b.useState(!1),[Y,q]=b.useState(0),[H,U]=b.useState(!1),L=b.useRef(null);b.useEffect(()=>(document.addEventListener("mouseup",J),window.addEventListener("scroll",z),()=>{document.removeEventListener("mouseup",J),window.removeEventListener("scroll",z)}));const B=()=>{U(!H)},J=k=>{L.current&&!L.current.contains(k.target)&&U(!1)},z=()=>{if(u){const k=window.pageYOffset||document.documentElement.scrollTop;if(k<0||Math.abs(k-Y)<60)return;re(k>Y),q(k)}};return i("header",{...I,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:Re("pkt-header",{"pkt-header--fixed":s,"pkt-header--scroll-to-hide":u,"pkt-header--hidden":P}),ref:A,children:[i("div",{className:"pkt-header__logo",children:[t("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:n,children:t(g,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/6.0/logos/"})}),t("span",{className:"pkt-header__logo-service",children:c})]}),t("nav",{className:"pkt-header__actions",children:i("ul",{className:"pkt-header__actions-row",children:[y&&t("li",{children:t(te,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:S,children:"Meny"})}),(l||m)&&i("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${H&&!P?"pkt-header--open-dropdown":""}`,ref:L,children:[i("button",{className:"pkt-header__user-btn pkt-btn pkt-btn--secondary pkt-btn--icons-right-and-left",type:"button",role:"button","aria-controls":"pktUserDropdown","aria-expanded":H,onClick:B,children:[t(g,{name:"user",className:"pkt-btn__icon"}),t("span",{className:"pkt-header__user-fullname",children:(m==null?void 0:m.name)||(l==null?void 0:l.name)}),t("span",{className:"pkt-header__user-shortname",children:(m==null?void 0:m.shortname)||(l==null?void 0:l.shortname)}),t(g,{name:"chevron-thin-down",className:"pkt-btn--closed"}),t(g,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),i("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[l&&i("li",{children:[t("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),t("div",{className:"pkt-user-menu__name",children:l.name}),l.lastLoggedIn&&i("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",t("time",{children:j})]})]}),f&&t("li",{children:t("ul",{className:"pkt-list",children:f.map((k,C)=>t("li",{children:typeof k.target=="string"?i("a",{href:k.target,className:"pkt-link",children:[k.iconName&&t(g,{name:k.iconName,className:"pkt-link__icon"}),k.title]}):i("button",{className:"pkt-link",onClick:k.target,children:[k.iconName&&t(g,{name:k.iconName,className:"pkt-link__icon"}),k.title]})},`userMenu-${C}`))})}),(m||E)&&i("li",{children:[m&&i(W,{children:[t("div",{className:"pkt-user-menu__label",children:"Representerer"}),t("div",{className:"pkt-user-menu__name",children:m.name}),m.orgNumber&&i("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",m.orgNumber]})]}),t("ul",{className:"pkt-list mt-size-16",children:E&&t("li",{children:i("button",{className:"pkt-link",onClick:D,children:[t(g,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),t("li",{children:t("ul",{className:"pkt-list",children:(o||!x)&&i(W,{children:[o==null?void 0:o.map((k,C)=>t("li",{children:typeof k.target=="string"?i("a",{href:k.target,className:"pkt-link",children:[k.iconName&&t(g,{name:k.iconName,className:"pkt-link__icon"}),k.title]}):i("button",{className:"pkt-link",onClick:k.target,children:[k.iconName&&t(g,{name:k.iconName,className:"pkt-link__icon"}),k.title]})},`userOptions-${C}`)),!x&&t("li",{children:i("button",{className:"pkt-link",onClick:O,children:[t(g,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),d&&t("li",{className:"footer",children:t("ul",{className:"pkt-list-horizontal bordered",children:d.map((k,C)=>t("li",{children:typeof k.target=="string"?t("a",{href:k.target,className:"pkt-link",children:k.title}):t("button",{className:"pkt-link",onClick:k.target,children:k.title})},`userMenuFooter-${C}`))})})]})]}),x&&t("li",{children:t(te,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:O,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),Ce=b.forwardRef(({label:n,id:c,children:s,...u},l)=>i("div",{className:"pkt-form-group",children:[t("label",{htmlFor:c,className:"pkt-form-label",children:n}),t("input",{className:"pkt-form-input",id:c,...u,ref:l}),s]}));Ce.displayName="PktInput";const Se=b.forwardRef(({children:n,className:c,iconName:s="user",openInNewTab:u=!1,skin:l="normal",href:f="#",external:m=!1,title:o},d)=>{const E=[c,"pkt-linkcard",l&&`pkt-linkcard--${l}`].filter(Boolean).join(" ");return i("a",{href:f,className:`pkt-linkcard pkt-link ${E}`,target:u?"_blank":"_self",rel:u?"noopener noreferrer":void 0,ref:d,children:[t(g,{className:"pkt-link__icon",name:s}),i("div",{className:"pkt-linkcard__content",children:[t("div",{className:`pkt-linkcard__title ${m?"pkt-link pkt-link--external":""}`,children:o}),t("div",{className:"pkt-linkcard__text",children:n})]})]})});Se.displayName="PktLinkCard";const ot=({children:n,skin:c="beige",title:s,...u})=>{const l=["pkt-messagebox",c&&`pkt-messagebox--${c}`].filter(Boolean).join(" ");return i("div",{...u,className:l,children:[t("div",{className:"pkt-messagebox__title",children:s}),t("div",{className:"pkt-messagebox__text",children:n})]})},je=b.forwardRef(({id:n,name:c,label:s,value:u,...l},f)=>i("div",{className:"pkt-form-group",children:[t("input",{type:"radio",className:"pkt-form-check-input",id:n,name:c,value:u,ref:f,...l}),t("label",{className:"pkt-form-label",htmlFor:n,children:s})]}));je.displayName="PktRadio";const it=({label:n,children:c})=>i(W,{children:[t("p",{children:n}),t("div",{className:"pkt-form-group",children:c})]}),st=({isResponsive:n,children:c})=>n?t("div",{className:"pkt-table-container",children:c}):t(W,{children:c}),ct=({isResponsive:n,modifiers:{info:c=!1,success:s=!1,strong:u=!1,shadow:l=!1}={},children:f})=>t(st,{isResponsive:n,children:t("table",{className:Re("pkt-table",{"pkt-table--info":c,"pkt-table--success":s,"pkt-table--strong":u,"pkt-table--shadow":l}),children:f})}),ut=({children:n})=>t("td",{className:"pkt-table__th",children:n}),ft=({children:n})=>t("th",{className:"pkt-table__th",children:n}),Oe=b.forwardRef(({children:n,className:c,skin:s="blue",textStyle:u="normal-text",size:l="medium",closeTag:f=!1,iconName:m="",type:o="button",ariaLabel:d="close",onClick:E=()=>{}},y)=>{const[x,S]=b.useState(!1),O=j=>{S(!0),E(j)},D=["pkt-tag",l&&`pkt-tag--${l}`,s&&`pkt-tag--${s}`,u&&`pkt-tag--${u}`,c].filter(Boolean).join(" "),I=["pkt-tag","pkt-btn","pkt-btn--tertiary",l&&`pkt-tag--${l}`,s&&`pkt-tag--${s}`,u&&`pkt-tag--${u}`,m&&f?"pkt-btn--icons-right-and-left":null,f&&!m?"pkt-btn--icon-right":null,c].filter(Boolean).join(" "),A=!x;return f&&m?t(W,{children:A&&i("button",{className:I,type:o,"aria-label":d,onClick:O,ref:y,children:[t(g,{className:"pkt-tag__icon",name:m}),n,t(g,{className:"pkt-tag__close-btn",name:"close"})]})}):f?t(W,{children:A&&i("button",{className:I,type:o,"aria-label":d,onClick:O,ref:y,children:[t(g,{className:"pkt-tag__close-btn",name:"close"}),n]})}):m?i("span",{className:D,children:[t(g,{className:"pkt-tag__icon",name:m}),n]}):t("span",{className:D,children:n})});Oe.displayName="PktTag";const $e=b.forwardRef(({id:n,label:c,...s},u)=>i("div",{className:"pkt-form-group",children:[t("label",{htmlFor:n,className:"pkt-form-label",children:c}),t("textarea",{className:"pkt-form-textarea",id:n,ref:u,...s})]}));$e.displayName="PktTextarea";const dt=b.forwardRef(({id:n,label:c,name:s,srOnlyLabel:u=!1,helptext:l,helptextDropdown:f,helptextDropdownButton:m,optional:o=!1,required:d=!1,hasError:E=!1,errorMessage:y,placeholder:x,type:S="text",autocomplete:O="off",value:D,suffix:I,prefix:A,iconNameRight:j,disabled:P=!1,inline:re=!1,ariaLabelledby:Y,ariaDescribedby:q,className:H,...U},L)=>{const[B,J]=b.useState(!1),z=()=>{J(!B)},k=()=>o?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":d?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",C=o?"Valgfritt":d?"Må fylles ut":"",ne=[H,"pkt-textinput",P?"pkt-textinput--disabled":"",re?"pkt-textinput--inline":"",E?"pkt-textinput--error":""].join(" "),G=!!f&&f!=="";return i("div",{className:ne,children:[i(G?"div":"label",{htmlFor:n,className:`pkt-textinput__label ${u?"pkt-sr-only":""}`,"aria-describedby":G?"":q,children:[i(G?"h2":"span",{children:[c,C!==""&&t("span",{className:k(),children:C})]}),l&&t("div",{className:"pkt-textinput__helptext",children:l}),G&&i(W,{children:[t(te,{skin:"tertiary",size:"small",variant:"icon-right",iconName:B?"chevron-thin-up":"chevron-thin-down",className:"pkt-textinput__helptext-expandable pkt-link pkt-link--icon-right",onClick:z,children:m||i(W,{children:["Les mer ",t("span",{className:"pkt-sr-only",children:"om inputfeltet"})]})}),t("div",{className:`pkt-textinput__helptext ${B?"pkt-textinput__helptext-expandable-open":"pkt-textinput__helptext-expandable-closed"}`,children:t(pe,{children:f})}),t("label",{htmlFor:n,className:"pkt-textinput__label pkt-sr-only","aria-describedby":q,children:c})]}),A&&i("div",{className:"pkt-textinput__input-prefix-wrapper",children:[t("div",{className:"pkt-textinput__input-prefix",children:A}),t("input",{ref:L,className:"pkt-textinput__input",type:S,name:s||n,id:n,placeholder:x,autoComplete:O,value:D,disabled:P,"aria-required":d,"aria-invalid":E,"aria-labelledby":Y,...U})]}),!A&&(I||j)&&i("div",{className:"pkt-textinput__input-suffix-wrapper",children:[t("input",{ref:L,className:"pkt-textinput__input",type:S,name:s||n,id:n,placeholder:x,autoComplete:O,value:D,disabled:P,"aria-required":d,"aria-invalid":E,"aria-labelledby":Y,...U}),I&&i("p",{className:"pkt-textinput__input-suffix",children:[I,j&&t(g,{className:"pkt-textinput__input-suffix-icon",name:j})]}),!I&&j&&t(g,{className:"pkt-textinput__input-icon",name:j})]}),!A&&!I&&!j&&!f&&t("input",{ref:L,className:"pkt-textinput__input",type:S,name:s||n,id:n,placeholder:x,autoComplete:O,value:D,disabled:P,"aria-required":d,"aria-invalid":E,"aria-labelledby":Y,...U})]}),E&&t(pe,{skin:"error","aria-live":"assertive",children:y})]})});w.PktAlert=pe,w.PktButton=te,w.PktFooter=rt,w.PktFooterSimple=at,w.PktHeader=lt,w.PktIcon=g,w.PktInput=Ce,w.PktLinkCard=Se,w.PktMessagebox=ot,w.PktRadio=je,w.PktRadioGroup=it,w.PktTable=ct,w.PktTableData=ut,w.PktTableHeader=ft,w.PktTag=Oe,w.PktTextarea=$e,w.PktTextinput=dt,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@oslokommune/punkt-assets": "^6.0.0",
35
- "@oslokommune/punkt-css": "^6.0.0",
35
+ "@oslokommune/punkt-css": "^6.0.1",
36
36
  "@testing-library/jest-dom": "^5.16.5",
37
37
  "@testing-library/react": "^14.0.0",
38
38
  "@testing-library/user-event": "^14.4.3",
@@ -90,5 +90,5 @@
90
90
  "url": "https://github.com/oslokommune/punkt/issues"
91
91
  },
92
92
  "license": "MIT",
93
- "gitHead": "2abe615a393680210345b1662767f1fd09f22a9d"
93
+ "gitHead": "10efdb492b7e84d8339e19a74358c02b940a6bb7"
94
94
  }
@@ -225,7 +225,7 @@ export const PktHeader = forwardRef(
225
225
  <li>
226
226
  {representing && (
227
227
  <>
228
- <div className="pkt-user-menu__label">Pålogget organisasjon</div>
228
+ <div className="pkt-user-menu__label">Representerer</div>
229
229
  <div className="pkt-user-menu__name">{representing.name}</div>
230
230
  {representing.orgNumber && (
231
231
  <div className="pkt-user-menu__org-number">
@@ -239,7 +239,7 @@ export const PktHeader = forwardRef(
239
239
  <li>
240
240
  <button className="pkt-link" onClick={changeRepresentation}>
241
241
  <PktIcon name="cogwheel" className="pkt-link__icon" />
242
- Bytt organisasjon
242
+ Endre organisasjon
243
243
  </button>
244
244
  </li>
245
245
  )}
@@ -98,7 +98,7 @@ exports[`PktHeader snapshot renders correctly with all props 1`] = `
98
98
  <div
99
99
  class="pkt-user-menu__label"
100
100
  >
101
- Pålogget organisasjon
101
+ Representerer
102
102
  </div>
103
103
  <div
104
104
  class="pkt-user-menu__name"
@@ -118,7 +118,7 @@ exports[`PktHeader snapshot renders correctly with all props 1`] = `
118
118
  <button
119
119
  class="pkt-link"
120
120
  >
121
- Bytt organisasjon
121
+ Endre organisasjon
122
122
  </button>
123
123
  </li>
124
124
  </ul>