@oslokommune/punkt-react 11.13.6 → 11.13.9

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,47 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [11.13.9](https://github.com/oslokommune/punkt/compare/11.13.8...11.13.9) (2024-06-03)
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
+ ## [11.13.8](https://github.com/oslokommune/punkt/compare/11.13.7...11.13.8) (2024-05-30)
26
+
27
+ ### ⚠ BREAKING CHANGES
28
+ Ingen
29
+
30
+ ### Features
31
+ Ingen
32
+
33
+ ### Bug Fixes
34
+ * remove uneccessary aria labels (#1724). * fix(react): remove uneccessary aria labels
35
+
36
+ * fix(react): update react test
37
+
38
+ * fix(react): fix ts
39
+
40
+ * fix(react): update test
41
+
42
+
43
+ ### Chores
44
+ Ingen
45
+
46
+ ---
47
+
48
+
8
49
  ## [11.13.6](https://github.com/oslokommune/punkt/compare/11.13.5...11.13.6) (2024-05-30)
9
50
 
10
51
  ### ⚠ BREAKING CHANGES
@@ -1,7 +1,6 @@
1
- import { default as React, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
 
3
3
  export interface IPktAccordion {
4
- ariaLabelledById?: string;
5
4
  className?: string;
6
5
  children: ReactNode | ReactNode[];
7
6
  /**
@@ -13,4 +12,4 @@ export interface IPktAccordion {
13
12
  */
14
13
  skin?: 'borderless' | 'outlined' | 'beige' | 'blue';
15
14
  }
16
- export declare const PktAccordion: React.ForwardRefExoticComponent<IPktAccordion & React.RefAttributes<HTMLDivElement>>;
15
+ export declare const PktAccordion: import('react').ForwardRefExoticComponent<IPktAccordion & import('react').RefAttributes<HTMLDivElement>>;
@@ -13,8 +13,8 @@ export interface IPktAccordionToggleProps {
13
13
  export interface IPktAccordionItem {
14
14
  children?: React.ReactNode | React.ReactNode[];
15
15
  className?: string;
16
- id: string;
17
16
  defaultOpen?: boolean;
17
+ id: string;
18
18
  title: string | React.ReactNode;
19
19
  toggleProps?: IPktAccordionToggleProps;
20
20
  }
@@ -1319,7 +1319,7 @@ const de = D(
1319
1319
  dangerouslySetInnerHTML: { __html: d }
1320
1320
  }
1321
1321
  ),
1322
- V && p !== "" && /* @__PURE__ */ e.jsxs("div", { children: [
1322
+ V && p !== "" && /* @__PURE__ */ e.jsxs("div", { className: "pkt-inputwrapper__helptext-expandable", children: [
1323
1323
  /* @__PURE__ */ e.jsx(
1324
1324
  ie,
1325
1325
  {
@@ -1327,7 +1327,7 @@ const de = D(
1327
1327
  size: "small",
1328
1328
  variant: "icon-right",
1329
1329
  iconName: j ? "chevron-thin-up" : "chevron-thin-down",
1330
- className: "pkt-inputwrapper__helptext-expandable pkt-link pkt-link--icon-right",
1330
+ className: "pkt-link pkt-link--icon-right",
1331
1331
  onClick: U,
1332
1332
  children: /* @__PURE__ */ e.jsx("span", { dangerouslySetInnerHTML: { __html: A } })
1333
1333
  }
@@ -33,4 +33,4 @@ React keys must be passed directly to JSX without using spread:
33
33
  Copyright (c) 2018 Jed Watson.
34
34
  Licensed under the MIT License (MIT), see
35
35
  http://jedwatson.github.io/classnames
36
- */(function(r){(function(){var l={}.hasOwnProperty;function f(){for(var n="",c=0;c<arguments.length;c++){var a=arguments[c];a&&(n=u(n,p(a)))}return n}function p(n){if(typeof n=="string"||typeof n=="number")return n;if(typeof n!="object")return"";if(Array.isArray(n))return f.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var c="";for(var a in n)l.call(n,a)&&n[a]&&(c=u(c,a));return c}function u(n,c){return c?n?n+" "+c:n+c:n}r.exports?(f.default=f,r.exports=f):window.classNames=f})()})($e);var pt=$e.exports;const X=et(pt),ft=m.forwardRef(({className:r,logoLink:l="https://www.oslo.kommune.no/",serviceName:f,fixed:p=!0,scrollToHide:u=!0,user:n,userMenu:c,representing:a,userOptions:o,userMenuFooter:i,canChangeRepresentation:k=!0,showMenuButton:b=!1,showLogOutButton:g=!1,openMenu:T,logOut:S,changeRepresentation:F,children:A,...C},P)=>{const N=m.useMemo(()=>typeof(n==null?void 0:n.lastLoggedIn)=="string"?n.lastLoggedIn:n!=null&&n.lastLoggedIn?new Date(n.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"}):"",[n]),[D,Y]=m.useState(!1),[W,V]=m.useState(0),[z,U]=m.useState(!1),J=m.useRef(null);m.useEffect(()=>(document.addEventListener("mouseup",L),window.addEventListener("scroll",R),()=>{document.removeEventListener("mouseup",L),window.removeEventListener("scroll",R)}));const H=()=>{U(!z)},L=h=>{J.current&&!J.current.contains(h.target)&&U(!1)},R=()=>{if(u){const h=window.pageYOffset||document.documentElement.scrollTop;if(h<0||Math.abs(h-W)<60)return;Y(h>W),V(h)}};return e.jsxs("header",{...C,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:X(r,"pkt-header",{"pkt-header--fixed":p,"pkt-header--scroll-to-hide":u,"pkt-header--hidden":D}),ref:P,children:[e.jsxs("div",{className:"pkt-header__logo",children:[typeof l=="string"?e.jsx("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:l,children:e.jsx(v,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/11.13/logos/"})}):e.jsx("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header__logo-link",onClick:l,children:e.jsx(v,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/11.13/logos/"})}),e.jsx("span",{className:"pkt-header__logo-service",children:f})]}),e.jsx("nav",{className:"pkt-header__actions",children:e.jsxs("ul",{className:"pkt-header__actions-row",children:[b&&e.jsx("li",{children:e.jsx(Q,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:T,children:"Meny"})}),(n||a)&&e.jsxs("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${z&&!D?"pkt-header--open-dropdown":""}`,ref:J,children:[e.jsxs("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":z,onClick:H,children:[e.jsx(v,{name:"user",className:"pkt-btn__icon"}),e.jsx("span",{className:"pkt-header__user-fullname",children:(a==null?void 0:a.name)||(n==null?void 0:n.name)}),e.jsx("span",{className:"pkt-header__user-shortname",children:(a==null?void 0:a.shortname)||(n==null?void 0:n.shortname)}),e.jsx(v,{name:"chevron-thin-down",className:"pkt-btn--closed"}),e.jsx(v,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),e.jsxs("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[n&&e.jsxs("li",{children:[e.jsx("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),e.jsx("div",{className:"pkt-user-menu__name",children:n.name}),n.lastLoggedIn&&e.jsxs("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",e.jsx("time",{children:N})]})]}),c&&e.jsx("li",{children:e.jsx("ul",{className:"pkt-list",children:c.map((h,I)=>e.jsx("li",{children:typeof h.target=="string"?e.jsxs("a",{href:h.target,className:"pkt-link",children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]}):e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]})},`userMenu-${I}`))})}),(a||k)&&e.jsxs("li",{children:[a&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pkt-user-menu__label",children:"Representerer"}),e.jsx("div",{className:"pkt-user-menu__name",children:a.name}),a.orgNumber&&e.jsxs("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",a.orgNumber]})]}),e.jsx("ul",{className:"pkt-list mt-size-16",children:k&&e.jsx("li",{children:e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:F,children:[e.jsx(v,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),e.jsx("li",{children:e.jsx("ul",{className:"pkt-list",children:(o||!g)&&e.jsxs(e.Fragment,{children:[o==null?void 0:o.map((h,I)=>e.jsx("li",{children:typeof h.target=="string"?e.jsxs("a",{href:h.target,className:"pkt-link",children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]}):e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]})},`userOptions-${I}`)),!g&&e.jsx("li",{children:e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:S,children:[e.jsx(v,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),i&&e.jsx("li",{className:"footer",children:e.jsx("ul",{className:"pkt-list-horizontal bordered",children:i.map((h,I)=>e.jsx("li",{children:typeof h.target=="string"?e.jsx("a",{href:h.target,className:"pkt-link",children:h.title}):e.jsx("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:h.title})},`userMenuFooter-${I}`))})})]})]}),A&&e.jsx("li",{children:A}),g&&e.jsx("li",{children:e.jsx(Q,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:S,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),Re=m.forwardRef(({label:r,id:l,children:f,...p},u)=>e.jsxs("div",{className:"pkt-form-group",children:[e.jsx("label",{htmlFor:l,className:"pkt-form-label",children:r}),e.jsx("input",{className:"pkt-form-input",id:l,...p,ref:u}),f]}));Re.displayName="PktInput";const ae=m.forwardRef(({forId:r,label:l,helptext:f,helptextDropdown:p,helptextDropdownButton:u,optionalTag:n=!1,optionalText:c="Valgfritt",requiredTag:a=!1,requiredText:o="Må fylles ut",hasError:i,errorMessage:k,disabled:b,inline:g,ariaDescribedby:T,useWrapper:S=!0,children:F,className:A,hasFieldset:C=!1},P)=>{const[N,D]=m.useState(!1),Y=()=>{D(!N)},W=()=>n?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":a?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",V=n?c:a?o:"",z=b?"pkt-inputwrapper--disabled":"",U=g?"pkt-inputwrapper--inline":"",J=i?"pkt-inputwrapper--error":"",H=!!p&&p!=="",L=u||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',R=C?"fieldset":H?"div":"label",h=C?"legend":H?"h2":"span",I=T||(f?`${r}-helptext`:void 0);return e.jsxs("div",{className:["pkt-inputwrapper",A,z,U,J].join(" "),ref:P,children:[S?e.jsx(e.Fragment,{children:e.jsxs(R,{htmlFor:C?void 0:r,"aria-describedby":H?void 0:T,className:`pkt-inputwrapper__label${C?" pkt-inputwrapper__fieldset":""}`,children:[e.jsxs(h,{id:`${r}-label`,className:`${C?" pkt-inputwrapper__legend":""}`,children:[l,V!==""&&e.jsx("span",{className:W(),children:V})]}),f&&e.jsx("div",{className:"pkt-inputwrapper__helptext",id:`${r}-helptext`,dangerouslySetInnerHTML:{__html:f}}),H&&p!==""&&e.jsxs("div",{children:[e.jsx(Q,{skin:"tertiary",size:"small",variant:"icon-right",iconName:N?"chevron-thin-up":"chevron-thin-down",className:"pkt-inputwrapper__helptext-expandable pkt-link pkt-link--icon-right",onClick:Y,children:e.jsx("span",{dangerouslySetInnerHTML:{__html:L}})}),e.jsx("div",{className:`pkt-inputwrapper__helptext ${N?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:e.jsx("span",{dangerouslySetInnerHTML:{__html:p}})}),!C&&e.jsx("label",{htmlFor:r,className:"pkt-sr-only","aria-describedby":I,children:l})]}),e.jsx(e.Fragment,{children:F})]})}):e.jsxs(e.Fragment,{children:[!C&&e.jsx("label",{htmlFor:r,className:"pkt-sr-only","aria-describedby":I,id:`${r}-label`,children:l}),F]}),i&&k&&e.jsx("div",{children:e.jsx(Te,{skin:"error","aria-live":"assertive",id:`${r}-error`,compact:!0,children:k})})]})});ae.displayName="PktInputWrapper";const Oe=m.forwardRef(({children:r,className:l,iconName:f="user",openInNewTab:p=!1,skin:u="normal",href:n="#",external:c=!1,title:a,...o},i)=>{const k=[l,"pkt-linkcard",u&&`pkt-linkcard--${u}`].filter(Boolean).join(" ");return e.jsxs("a",{...o,href:n,className:`pkt-linkcard pkt-link ${k}`,target:p?"_blank":"_self",rel:p?"noopener noreferrer":void 0,ref:i,children:[e.jsx(v,{className:"pkt-link__icon",name:f}),e.jsxs("div",{className:"pkt-linkcard__content",children:[e.jsx("div",{className:`pkt-linkcard__title ${c?"pkt-link pkt-link--external":""}`,children:a}),e.jsx("div",{className:"pkt-linkcard__text",children:r})]})]})});Oe.displayName="PktLinkCard";const dt=m.forwardRef(({className:r,message:l,size:f="medium",inline:p=!1,isLoading:u=!0,variant:n="rainbow",delay:c=0,children:a,...o},i)=>{const k=`pkt-loader pkt-loader--${f}`,[b,g]=m.useState(!(c>0));c>0&&setTimeout(()=>{g(!0)},c);const T=S=>S==="shapes"?"loader":S==="blue"?"spinner-blue":"spinner";return e.jsx("div",{role:"status","aria-live":"polite","aria-busy":u,className:`pkt-loader--${p?"inline":"box"} ${r||""}`,children:u?e.jsx(e.Fragment,{children:b?e.jsxs("div",{className:k,"data-testid":"pkt-loader",ref:i,...o,children:[e.jsx(v,{name:T(n),"aria-label":"loading",path:"https://punkt-cdn.oslo.kommune.no/11.13/animations/",className:`pkt-loader__svg pkt-loader__${n}`}),l&&e.jsx("p",{children:l})]}):null}):a})}),kt=m.forwardRef(({children:r,className:l,compact:f=!1,closable:p=!1,skin:u="beige",title:n,onClose:c,...a},o)=>{const[i,k]=m.useState(!0),b=()=>{k(!1),c&&c()},g=[l,"pkt-messagebox",u&&`pkt-messagebox--${u}`,f&&"pkt-messagebox--compact"].filter(Boolean).join(" ");return i?e.jsxs("div",{...a,className:g,ref:o,children:[p&&e.jsx("div",{className:"pkt-messagebox__close",children:e.jsx("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:b,children:e.jsx(v,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),n&&e.jsx("div",{className:"pkt-messagebox__title",children:n}),e.jsx("div",{className:"pkt-messagebox__text",children:r})]}):null}),Ie=m.forwardRef(({id:r,name:l,label:f,className:p,hasTile:u=!1,disabled:n=!1,checkHelptext:c,hasError:a=!1,...o},i)=>{const k=[p,"pkt-input-check"].filter(Boolean).join(" ");return e.jsx("div",{className:k,children:e.jsxs("div",{className:`pkt-input-check__input ${u?"pkt-input-check__input--tile":""} ${n&&u?"pkt-input-check__input--tile-disabled":""}`,children:[e.jsx("input",{ref:i,className:`pkt-input-check__input-checkbox ${a?"pkt-input-check__input-checkbox--error":""}`,type:"radio",id:r,disabled:n,name:l,...o}),e.jsxs("label",{className:"pkt-input-check__input-label",htmlFor:r,children:[f,c&&e.jsx("div",{className:"pkt-input-check__input-helptext",children:c})]})]})})});Ie.displayName="PktRadioButton";const mt=m.forwardRef(({action:r,appearance:l="local",disabled:f=!1,fullwidth:p=!1,id:u,label:n,method:c="get",name:a,placeholder:o="Søk…",suggestions:i,value:k="",onSearch:b,onSuggestionClick:g,...T},S)=>{const F=(N,D)=>{N?N():g&&g(D)},A=`pkt-searchinput pkt-searchinput--${l} ${p?"pkt-searchinput--fullwidth":""}`,C=r?"form":"div",P=n?"label":"div";return e.jsxs(C,{className:A,onSubmit:b&&(()=>b(k)),action:r||void 0,method:r?c:void 0,role:"search",ref:S,...T,children:[e.jsxs(P,{htmlFor:n?u:void 0,className:n?"pkt-inputwrapper__label":"",children:[n&&e.jsx(e.Fragment,{children:n}),e.jsxs("div",{className:l==="local"?"pkt-input__container":"pkt-searchinput__field",children:[e.jsx("input",{className:`pkt-input ${p?"pkt-input--fullwidth":""}`,type:"search",name:a||u,id:u,placeholder:o,defaultValue:k,disabled:f,onInput:b&&(N=>b(N.currentTarget.value)),autoComplete:"off","aria-autocomplete":"list","aria-controls":`${u}-suggestions`}),e.jsx(Q,{className:`pkt-searchinput__button ${l==="local"?"pkt-input-icon":""}`,variant:"icon-only",iconName:"magnifying-glass-big",skin:l==="local"?"tertiary":"primary",color:l==="global"?"yellow":void 0,type:"submit",disabled:f,onClick:b&&(()=>b(k)),onKeyUp:b&&(N=>N.key==="Enter"&&b(k)),children:n||o})]})]}),i&&e.jsx("ul",{id:`${u}-suggestions`,className:"pkt-searchinput__suggestions","aria-live":"assertive",children:i.map((N,D)=>e.jsx("li",{children:m.createElement(N.href?"a":N.onClick?"button":"div",{href:N.href,className:`pkt-searchinput__suggestion ${N.onClick?"pkt-link-button":""} ${N.href||N.onClick?"pkt-searchinput__suggestion--has-hover":""}`,type:N.onClick?"button":void 0,onClick:()=>F(N.onClick,D),onKeyUp:()=>F(N.onClick,D)},e.jsxs(e.Fragment,{children:[N.title&&e.jsx("h3",{className:"pkt-searchinput__suggestion-title",children:N.title}),N.text&&e.jsx("p",{className:"pkt-searchinput__suggestion-text",children:N.text})]}))},`search-suggestion-${D}`))})]})}),ht=m.forwardRef(({ariaDescribedby:r,ariaLabelledby:l,children:f,className:p,disabled:u=!1,errorMessage:n,hasError:c,helptext:a,helptextDropdown:o,helptextDropdownButton:i,id:k,inline:b=!1,fullwidth:g=!1,label:T,name:S,optionalTag:F=!1,optionalText:A,requiredTag:C=!1,requiredText:P,...N},D)=>{const Y=[p,"pkt-select"].join(" ");return e.jsx(ae,{className:Y,forId:k,label:T,helptext:a,helptextDropdown:o,helptextDropdownButton:i,optionalTag:F,optionalText:A,requiredTag:C,requiredText:P,hasError:c,errorMessage:n,disabled:u,inline:b,ariaDescribedby:r,children:e.jsx("select",{ref:D,className:`pkt-input ${g?"pkt-input--fullwidth":""}`,"aria-invalid":c,"aria-errormessage":`${k}-error`,"aria-labelledby":l||`${k}-label`,disabled:u,id:k,name:S||k,...N,children:f})})}),_t=({className:r,compact:l=!1,skin:f="basic",responsiveView:p=!0,children:u})=>e.jsx("table",{"data-testid":"pkt-table",className:X(r,"pkt-table",{"pkt-table--responsive":p,"pkt-table--compact":l,"pkt-table--basic":f==="basic","pkt-table--zebra-blue":f==="zebra-blue"}),role:"table",children:u}),bt=({children:r,className:l,dataLabel:f})=>e.jsx("td",{className:X(l,"pkt-table__data-cell",{}),"data-label":f,role:"cell","data-testid":"pkt-table__data-cell",children:r}),vt=({className:r,children:l})=>e.jsx("th",{className:X(r,"pkt-table__header-cell",{}),role:"columnheader",children:l}),xt=({className:r,children:l})=>e.jsx("thead",{className:X(r,"pkt-table__header",{}),role:"rowgroup",children:l}),jt=({className:r,children:l})=>e.jsx("tr",{className:X(r,"pkt-table__row",{}),role:"row",children:l}),gt=({children:r,className:l})=>e.jsx("tbody",{className:X(l,"pkt-table__body",{}),role:"rowgroup",children:r}),oe=m.forwardRef(({children:r,className:l,skin:f="blue",textStyle:p="normal-text",size:u="medium",closeTag:n=!1,iconName:c="",type:a="button",ariaLabel:o="close",onClick:i=()=>{}},k)=>{const[b,g]=m.useState(!1),T=C=>{g(!0),i(C)},S=["pkt-tag",u&&`pkt-tag--${u}`,f&&`pkt-tag--${f}`,p&&`pkt-tag--${p}`,l].filter(Boolean).join(" "),F=["pkt-tag","pkt-btn","pkt-btn--tertiary",u&&`pkt-tag--${u}`,f&&`pkt-tag--${f}`,p&&`pkt-tag--${p}`,c&&n?"pkt-btn--icons-right-and-left":null,n&&!c?"pkt-btn--icon-right":null,l].filter(Boolean).join(" "),A=!b;return n&&c?e.jsx(e.Fragment,{children:A&&e.jsxs("button",{className:F,type:a,"aria-label":o,onClick:T,ref:k,children:[e.jsx(v,{className:"pkt-tag__icon",name:c}),r,e.jsx(v,{className:"pkt-tag__close-btn",name:"close"})]})}):n?e.jsx(e.Fragment,{children:A&&e.jsxs("button",{className:F,type:a,"aria-label":o,onClick:T,ref:k,children:[e.jsx(v,{className:"pkt-tag__close-btn",name:"close"}),r]})}):c?e.jsxs("span",{className:S,children:[e.jsx(v,{className:"pkt-tag__icon",name:c}),r]}):e.jsx("span",{className:S,children:r})});oe.displayName="PktTag";const Nt=m.forwardRef(({arrowNav:r=!0,tabs:l,onTabSelected:f},p)=>{const u=m.useRef([]);m.useEffect(()=>{u.current=u.current.slice(0,l.length)},[l]);const n=(a,o)=>{o.action&&o.action(a),f&&f(a)},c=(a,o)=>{var i,k;r&&(o.code==="ArrowLeft"&&a!==0&&((i=u.current[a-1])==null||i.focus()),o.code==="ArrowRight"&&a<l.length-1&&((k=u.current[a+1])==null||k.focus()),(o.code==="ArrowDown"||o.code==="Space")&&n(a,l[a]))};return e.jsx("div",{className:"pkt-tabs",ref:p,children:e.jsx("div",{className:"pkt-tabs__list",role:r?"tablist":"navigation",children:l.map((a,o)=>e.jsx(m.Fragment,{children:a.href?e.jsxs("a",{"aria-selected":!!a.active,role:r?"tab":void 0,href:a.href,"aria-controls":a.controls,className:`pkt-tabs__link ${a.active?"active":""}`,onKeyUp:i=>c(o,i),onClick:()=>n(o,a),tabIndex:a.active||!r?void 0:-1,ref:i=>{u.current[o]=i},children:[a.icon&&e.jsx(v,{name:a.icon,className:"pkt-icon--small"}),a.text,a.tag&&e.jsx(oe,{skin:a.tag.skin,size:"small",children:a.tag.text})]}):e.jsxs("button",{"aria-selected":!!a.active,role:r?"tab":void 0,type:"button","aria-controls":a.controls,className:`pkt-tabs__button pkt-link-button ${a.active?"active":""}`,onKeyUp:i=>c(o,i),onClick:()=>n(o,a),tabIndex:a.active||!r?void 0:-1,ref:i=>{u.current[o]=i},children:[a.icon&&e.jsx(v,{name:a.icon,className:"pkt-icon--small"}),a.text,a.tag&&e.jsx(oe,{skin:a.tag.skin,size:"small",children:a.tag.text})]},"b-"+o)},o))})})}),yt=m.forwardRef(({id:r,ariaDescribedby:l,ariaLabelledby:f,counter:p,counterMaxLength:u,className:n,disabled:c,errorMessage:a,hasError:o,helptext:i,helptextDropdown:k,helptextDropdownButton:b,inline:g,fullwidth:T=!1,label:S,name:F,optionalTag:A=!1,optionalText:C,requiredTag:P=!1,requiredText:N,placeholder:D,rows:Y,useWrapper:W=!0,onChange:V,...z},U)=>{const J=[n,"pkt-textinput","pkt-textarea"].join(" "),H=f||`${r}-label`,L=m.useRef(null),[R,h]=m.useState(0),I=q=>{var G,se;if(p&&h(((se=(G=q.currentTarget)==null?void 0:G.value)==null?void 0:se.length)||0),V)return V(q)};return m.useEffect(()=>{var q,G;typeof U=="function"&&U(L.current),p&&h(((G=(q=L==null?void 0:L.current)==null?void 0:q.value)==null?void 0:G.length)||0)},[U]),e.jsxs(ae,{ariaDescribedby:l,className:J,disabled:c,errorMessage:a,forId:r,hasError:o,helptext:i,helptextDropdown:k,helptextDropdownButton:b,inline:g,label:S,optionalTag:A,optionalText:C,requiredTag:P,requiredText:N,useWrapper:W,children:[e.jsx("textarea",{ref:L,className:`pkt-input ${T?"pkt-input--fullwidth":""} ${u&&R>u?"pkt-input--counter-error":""}`,name:F||r,id:r,placeholder:D,disabled:c,rows:Y,"aria-labelledby":H,"aria-invalid":o,"aria-errormessage":`${r}-error`,...z,onChange:I}),p&&e.jsxs("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":!0,children:[R||0,u&&`/${u}`]})]})}),wt=m.forwardRef(({id:r,ariaDescribedby:l,ariaLabelledby:f,autocomplete:p="off",className:u,disabled:n=!1,errorMessage:c,hasError:a=!1,helptext:o,helptextDropdown:i,helptextDropdownButton:k,iconNameRight:b,inline:g=!1,fullwidth:T=!1,label:S,name:F,optionalTag:A=!1,optionalText:C,requiredTag:P=!1,requiredText:N,placeholder:D,prefix:Y,suffix:W,type:V="text",useWrapper:z=!0,omitSearchIcon:U=!1,value:J,...H},L)=>{const R=[u,"pkt-textinput"].join(" "),h=f||`${r}-label`,I=V==="search"&&!b&&!U;return e.jsx(ae,{ariaDescribedby:l,className:R,disabled:n,errorMessage:c,forId:r,hasError:a,helptext:o,helptextDropdown:i,helptextDropdownButton:k,inline:g,label:S,optionalTag:A,optionalText:C,requiredTag:P,requiredText:N,useWrapper:z,children:e.jsxs("div",{className:"pkt-input__container",children:[Y&&e.jsx("div",{className:"pkt-input-prefix",children:Y}),e.jsx("input",{ref:L,className:`pkt-input ${T?"pkt-input--fullwidth":""}`,type:V,name:F||r,id:r,placeholder:D,autoComplete:p,value:J,disabled:n,"aria-invalid":a,"aria-errormessage":`${r}-error`,"aria-labelledby":h,...H}),W&&e.jsxs("p",{className:"pkt-input-suffix",children:[W,b&&e.jsx(v,{className:"pkt-input-suffix-icon",name:b}),I&&e.jsx(v,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!W&&b&&e.jsx(v,{className:"pkt-input-icon",name:b}),!W&&I&&e.jsx(v,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});j.PktAlert=Te,j.PktBackLink=it,j.PktBreadcrumbs=ot,j.PktButton=Q,j.PktCheckbox=Se,j.PktFooter=ct,j.PktFooterSimple=ut,j.PktHeader=ft,j.PktIcon=v,j.PktIconContext=Ce,j.PktInput=Re,j.PktInputWrapper=ae,j.PktLinkCard=Oe,j.PktLoader=dt,j.PktMessagebox=kt,j.PktRadioButton=Ie,j.PktSearchInput=mt,j.PktSelect=ht,j.PktTable=_t,j.PktTableBody=gt,j.PktTableDataCell=bt,j.PktTableHeader=xt,j.PktTableHeaderCell=vt,j.PktTableRow=jt,j.PktTabs=Nt,j.PktTag=oe,j.PktTextarea=yt,j.PktTextinput=wt,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
36
+ */(function(r){(function(){var l={}.hasOwnProperty;function f(){for(var n="",c=0;c<arguments.length;c++){var a=arguments[c];a&&(n=u(n,p(a)))}return n}function p(n){if(typeof n=="string"||typeof n=="number")return n;if(typeof n!="object")return"";if(Array.isArray(n))return f.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var c="";for(var a in n)l.call(n,a)&&n[a]&&(c=u(c,a));return c}function u(n,c){return c?n?n+" "+c:n+c:n}r.exports?(f.default=f,r.exports=f):window.classNames=f})()})($e);var pt=$e.exports;const X=et(pt),ft=m.forwardRef(({className:r,logoLink:l="https://www.oslo.kommune.no/",serviceName:f,fixed:p=!0,scrollToHide:u=!0,user:n,userMenu:c,representing:a,userOptions:o,userMenuFooter:i,canChangeRepresentation:k=!0,showMenuButton:b=!1,showLogOutButton:g=!1,openMenu:T,logOut:S,changeRepresentation:F,children:A,...C},P)=>{const N=m.useMemo(()=>typeof(n==null?void 0:n.lastLoggedIn)=="string"?n.lastLoggedIn:n!=null&&n.lastLoggedIn?new Date(n.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"}):"",[n]),[D,Y]=m.useState(!1),[W,V]=m.useState(0),[z,U]=m.useState(!1),J=m.useRef(null);m.useEffect(()=>(document.addEventListener("mouseup",L),window.addEventListener("scroll",R),()=>{document.removeEventListener("mouseup",L),window.removeEventListener("scroll",R)}));const H=()=>{U(!z)},L=h=>{J.current&&!J.current.contains(h.target)&&U(!1)},R=()=>{if(u){const h=window.pageYOffset||document.documentElement.scrollTop;if(h<0||Math.abs(h-W)<60)return;Y(h>W),V(h)}};return e.jsxs("header",{...C,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:X(r,"pkt-header",{"pkt-header--fixed":p,"pkt-header--scroll-to-hide":u,"pkt-header--hidden":D}),ref:P,children:[e.jsxs("div",{className:"pkt-header__logo",children:[typeof l=="string"?e.jsx("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:l,children:e.jsx(v,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/11.13/logos/"})}):e.jsx("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header__logo-link",onClick:l,children:e.jsx(v,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/11.13/logos/"})}),e.jsx("span",{className:"pkt-header__logo-service",children:f})]}),e.jsx("nav",{className:"pkt-header__actions",children:e.jsxs("ul",{className:"pkt-header__actions-row",children:[b&&e.jsx("li",{children:e.jsx(Q,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:T,children:"Meny"})}),(n||a)&&e.jsxs("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${z&&!D?"pkt-header--open-dropdown":""}`,ref:J,children:[e.jsxs("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":z,onClick:H,children:[e.jsx(v,{name:"user",className:"pkt-btn__icon"}),e.jsx("span",{className:"pkt-header__user-fullname",children:(a==null?void 0:a.name)||(n==null?void 0:n.name)}),e.jsx("span",{className:"pkt-header__user-shortname",children:(a==null?void 0:a.shortname)||(n==null?void 0:n.shortname)}),e.jsx(v,{name:"chevron-thin-down",className:"pkt-btn--closed"}),e.jsx(v,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),e.jsxs("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[n&&e.jsxs("li",{children:[e.jsx("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),e.jsx("div",{className:"pkt-user-menu__name",children:n.name}),n.lastLoggedIn&&e.jsxs("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",e.jsx("time",{children:N})]})]}),c&&e.jsx("li",{children:e.jsx("ul",{className:"pkt-list",children:c.map((h,I)=>e.jsx("li",{children:typeof h.target=="string"?e.jsxs("a",{href:h.target,className:"pkt-link",children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]}):e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]})},`userMenu-${I}`))})}),(a||k)&&e.jsxs("li",{children:[a&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pkt-user-menu__label",children:"Representerer"}),e.jsx("div",{className:"pkt-user-menu__name",children:a.name}),a.orgNumber&&e.jsxs("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",a.orgNumber]})]}),e.jsx("ul",{className:"pkt-list mt-size-16",children:k&&e.jsx("li",{children:e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:F,children:[e.jsx(v,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),e.jsx("li",{children:e.jsx("ul",{className:"pkt-list",children:(o||!g)&&e.jsxs(e.Fragment,{children:[o==null?void 0:o.map((h,I)=>e.jsx("li",{children:typeof h.target=="string"?e.jsxs("a",{href:h.target,className:"pkt-link",children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]}):e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]})},`userOptions-${I}`)),!g&&e.jsx("li",{children:e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:S,children:[e.jsx(v,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),i&&e.jsx("li",{className:"footer",children:e.jsx("ul",{className:"pkt-list-horizontal bordered",children:i.map((h,I)=>e.jsx("li",{children:typeof h.target=="string"?e.jsx("a",{href:h.target,className:"pkt-link",children:h.title}):e.jsx("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:h.title})},`userMenuFooter-${I}`))})})]})]}),A&&e.jsx("li",{children:A}),g&&e.jsx("li",{children:e.jsx(Q,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:S,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),Re=m.forwardRef(({label:r,id:l,children:f,...p},u)=>e.jsxs("div",{className:"pkt-form-group",children:[e.jsx("label",{htmlFor:l,className:"pkt-form-label",children:r}),e.jsx("input",{className:"pkt-form-input",id:l,...p,ref:u}),f]}));Re.displayName="PktInput";const ae=m.forwardRef(({forId:r,label:l,helptext:f,helptextDropdown:p,helptextDropdownButton:u,optionalTag:n=!1,optionalText:c="Valgfritt",requiredTag:a=!1,requiredText:o="Må fylles ut",hasError:i,errorMessage:k,disabled:b,inline:g,ariaDescribedby:T,useWrapper:S=!0,children:F,className:A,hasFieldset:C=!1},P)=>{const[N,D]=m.useState(!1),Y=()=>{D(!N)},W=()=>n?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":a?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",V=n?c:a?o:"",z=b?"pkt-inputwrapper--disabled":"",U=g?"pkt-inputwrapper--inline":"",J=i?"pkt-inputwrapper--error":"",H=!!p&&p!=="",L=u||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',R=C?"fieldset":H?"div":"label",h=C?"legend":H?"h2":"span",I=T||(f?`${r}-helptext`:void 0);return e.jsxs("div",{className:["pkt-inputwrapper",A,z,U,J].join(" "),ref:P,children:[S?e.jsx(e.Fragment,{children:e.jsxs(R,{htmlFor:C?void 0:r,"aria-describedby":H?void 0:T,className:`pkt-inputwrapper__label${C?" pkt-inputwrapper__fieldset":""}`,children:[e.jsxs(h,{id:`${r}-label`,className:`${C?" pkt-inputwrapper__legend":""}`,children:[l,V!==""&&e.jsx("span",{className:W(),children:V})]}),f&&e.jsx("div",{className:"pkt-inputwrapper__helptext",id:`${r}-helptext`,dangerouslySetInnerHTML:{__html:f}}),H&&p!==""&&e.jsxs("div",{className:"pkt-inputwrapper__helptext-expandable",children:[e.jsx(Q,{skin:"tertiary",size:"small",variant:"icon-right",iconName:N?"chevron-thin-up":"chevron-thin-down",className:"pkt-link pkt-link--icon-right",onClick:Y,children:e.jsx("span",{dangerouslySetInnerHTML:{__html:L}})}),e.jsx("div",{className:`pkt-inputwrapper__helptext ${N?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:e.jsx("span",{dangerouslySetInnerHTML:{__html:p}})}),!C&&e.jsx("label",{htmlFor:r,className:"pkt-sr-only","aria-describedby":I,children:l})]}),e.jsx(e.Fragment,{children:F})]})}):e.jsxs(e.Fragment,{children:[!C&&e.jsx("label",{htmlFor:r,className:"pkt-sr-only","aria-describedby":I,id:`${r}-label`,children:l}),F]}),i&&k&&e.jsx("div",{children:e.jsx(Te,{skin:"error","aria-live":"assertive",id:`${r}-error`,compact:!0,children:k})})]})});ae.displayName="PktInputWrapper";const Oe=m.forwardRef(({children:r,className:l,iconName:f="user",openInNewTab:p=!1,skin:u="normal",href:n="#",external:c=!1,title:a,...o},i)=>{const k=[l,"pkt-linkcard",u&&`pkt-linkcard--${u}`].filter(Boolean).join(" ");return e.jsxs("a",{...o,href:n,className:`pkt-linkcard pkt-link ${k}`,target:p?"_blank":"_self",rel:p?"noopener noreferrer":void 0,ref:i,children:[e.jsx(v,{className:"pkt-link__icon",name:f}),e.jsxs("div",{className:"pkt-linkcard__content",children:[e.jsx("div",{className:`pkt-linkcard__title ${c?"pkt-link pkt-link--external":""}`,children:a}),e.jsx("div",{className:"pkt-linkcard__text",children:r})]})]})});Oe.displayName="PktLinkCard";const dt=m.forwardRef(({className:r,message:l,size:f="medium",inline:p=!1,isLoading:u=!0,variant:n="rainbow",delay:c=0,children:a,...o},i)=>{const k=`pkt-loader pkt-loader--${f}`,[b,g]=m.useState(!(c>0));c>0&&setTimeout(()=>{g(!0)},c);const T=S=>S==="shapes"?"loader":S==="blue"?"spinner-blue":"spinner";return e.jsx("div",{role:"status","aria-live":"polite","aria-busy":u,className:`pkt-loader--${p?"inline":"box"} ${r||""}`,children:u?e.jsx(e.Fragment,{children:b?e.jsxs("div",{className:k,"data-testid":"pkt-loader",ref:i,...o,children:[e.jsx(v,{name:T(n),"aria-label":"loading",path:"https://punkt-cdn.oslo.kommune.no/11.13/animations/",className:`pkt-loader__svg pkt-loader__${n}`}),l&&e.jsx("p",{children:l})]}):null}):a})}),kt=m.forwardRef(({children:r,className:l,compact:f=!1,closable:p=!1,skin:u="beige",title:n,onClose:c,...a},o)=>{const[i,k]=m.useState(!0),b=()=>{k(!1),c&&c()},g=[l,"pkt-messagebox",u&&`pkt-messagebox--${u}`,f&&"pkt-messagebox--compact"].filter(Boolean).join(" ");return i?e.jsxs("div",{...a,className:g,ref:o,children:[p&&e.jsx("div",{className:"pkt-messagebox__close",children:e.jsx("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:b,children:e.jsx(v,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),n&&e.jsx("div",{className:"pkt-messagebox__title",children:n}),e.jsx("div",{className:"pkt-messagebox__text",children:r})]}):null}),Ie=m.forwardRef(({id:r,name:l,label:f,className:p,hasTile:u=!1,disabled:n=!1,checkHelptext:c,hasError:a=!1,...o},i)=>{const k=[p,"pkt-input-check"].filter(Boolean).join(" ");return e.jsx("div",{className:k,children:e.jsxs("div",{className:`pkt-input-check__input ${u?"pkt-input-check__input--tile":""} ${n&&u?"pkt-input-check__input--tile-disabled":""}`,children:[e.jsx("input",{ref:i,className:`pkt-input-check__input-checkbox ${a?"pkt-input-check__input-checkbox--error":""}`,type:"radio",id:r,disabled:n,name:l,...o}),e.jsxs("label",{className:"pkt-input-check__input-label",htmlFor:r,children:[f,c&&e.jsx("div",{className:"pkt-input-check__input-helptext",children:c})]})]})})});Ie.displayName="PktRadioButton";const mt=m.forwardRef(({action:r,appearance:l="local",disabled:f=!1,fullwidth:p=!1,id:u,label:n,method:c="get",name:a,placeholder:o="Søk…",suggestions:i,value:k="",onSearch:b,onSuggestionClick:g,...T},S)=>{const F=(N,D)=>{N?N():g&&g(D)},A=`pkt-searchinput pkt-searchinput--${l} ${p?"pkt-searchinput--fullwidth":""}`,C=r?"form":"div",P=n?"label":"div";return e.jsxs(C,{className:A,onSubmit:b&&(()=>b(k)),action:r||void 0,method:r?c:void 0,role:"search",ref:S,...T,children:[e.jsxs(P,{htmlFor:n?u:void 0,className:n?"pkt-inputwrapper__label":"",children:[n&&e.jsx(e.Fragment,{children:n}),e.jsxs("div",{className:l==="local"?"pkt-input__container":"pkt-searchinput__field",children:[e.jsx("input",{className:`pkt-input ${p?"pkt-input--fullwidth":""}`,type:"search",name:a||u,id:u,placeholder:o,defaultValue:k,disabled:f,onInput:b&&(N=>b(N.currentTarget.value)),autoComplete:"off","aria-autocomplete":"list","aria-controls":`${u}-suggestions`}),e.jsx(Q,{className:`pkt-searchinput__button ${l==="local"?"pkt-input-icon":""}`,variant:"icon-only",iconName:"magnifying-glass-big",skin:l==="local"?"tertiary":"primary",color:l==="global"?"yellow":void 0,type:"submit",disabled:f,onClick:b&&(()=>b(k)),onKeyUp:b&&(N=>N.key==="Enter"&&b(k)),children:n||o})]})]}),i&&e.jsx("ul",{id:`${u}-suggestions`,className:"pkt-searchinput__suggestions","aria-live":"assertive",children:i.map((N,D)=>e.jsx("li",{children:m.createElement(N.href?"a":N.onClick?"button":"div",{href:N.href,className:`pkt-searchinput__suggestion ${N.onClick?"pkt-link-button":""} ${N.href||N.onClick?"pkt-searchinput__suggestion--has-hover":""}`,type:N.onClick?"button":void 0,onClick:()=>F(N.onClick,D),onKeyUp:()=>F(N.onClick,D)},e.jsxs(e.Fragment,{children:[N.title&&e.jsx("h3",{className:"pkt-searchinput__suggestion-title",children:N.title}),N.text&&e.jsx("p",{className:"pkt-searchinput__suggestion-text",children:N.text})]}))},`search-suggestion-${D}`))})]})}),ht=m.forwardRef(({ariaDescribedby:r,ariaLabelledby:l,children:f,className:p,disabled:u=!1,errorMessage:n,hasError:c,helptext:a,helptextDropdown:o,helptextDropdownButton:i,id:k,inline:b=!1,fullwidth:g=!1,label:T,name:S,optionalTag:F=!1,optionalText:A,requiredTag:C=!1,requiredText:P,...N},D)=>{const Y=[p,"pkt-select"].join(" ");return e.jsx(ae,{className:Y,forId:k,label:T,helptext:a,helptextDropdown:o,helptextDropdownButton:i,optionalTag:F,optionalText:A,requiredTag:C,requiredText:P,hasError:c,errorMessage:n,disabled:u,inline:b,ariaDescribedby:r,children:e.jsx("select",{ref:D,className:`pkt-input ${g?"pkt-input--fullwidth":""}`,"aria-invalid":c,"aria-errormessage":`${k}-error`,"aria-labelledby":l||`${k}-label`,disabled:u,id:k,name:S||k,...N,children:f})})}),_t=({className:r,compact:l=!1,skin:f="basic",responsiveView:p=!0,children:u})=>e.jsx("table",{"data-testid":"pkt-table",className:X(r,"pkt-table",{"pkt-table--responsive":p,"pkt-table--compact":l,"pkt-table--basic":f==="basic","pkt-table--zebra-blue":f==="zebra-blue"}),role:"table",children:u}),bt=({children:r,className:l,dataLabel:f})=>e.jsx("td",{className:X(l,"pkt-table__data-cell",{}),"data-label":f,role:"cell","data-testid":"pkt-table__data-cell",children:r}),vt=({className:r,children:l})=>e.jsx("th",{className:X(r,"pkt-table__header-cell",{}),role:"columnheader",children:l}),xt=({className:r,children:l})=>e.jsx("thead",{className:X(r,"pkt-table__header",{}),role:"rowgroup",children:l}),jt=({className:r,children:l})=>e.jsx("tr",{className:X(r,"pkt-table__row",{}),role:"row",children:l}),gt=({children:r,className:l})=>e.jsx("tbody",{className:X(l,"pkt-table__body",{}),role:"rowgroup",children:r}),oe=m.forwardRef(({children:r,className:l,skin:f="blue",textStyle:p="normal-text",size:u="medium",closeTag:n=!1,iconName:c="",type:a="button",ariaLabel:o="close",onClick:i=()=>{}},k)=>{const[b,g]=m.useState(!1),T=C=>{g(!0),i(C)},S=["pkt-tag",u&&`pkt-tag--${u}`,f&&`pkt-tag--${f}`,p&&`pkt-tag--${p}`,l].filter(Boolean).join(" "),F=["pkt-tag","pkt-btn","pkt-btn--tertiary",u&&`pkt-tag--${u}`,f&&`pkt-tag--${f}`,p&&`pkt-tag--${p}`,c&&n?"pkt-btn--icons-right-and-left":null,n&&!c?"pkt-btn--icon-right":null,l].filter(Boolean).join(" "),A=!b;return n&&c?e.jsx(e.Fragment,{children:A&&e.jsxs("button",{className:F,type:a,"aria-label":o,onClick:T,ref:k,children:[e.jsx(v,{className:"pkt-tag__icon",name:c}),r,e.jsx(v,{className:"pkt-tag__close-btn",name:"close"})]})}):n?e.jsx(e.Fragment,{children:A&&e.jsxs("button",{className:F,type:a,"aria-label":o,onClick:T,ref:k,children:[e.jsx(v,{className:"pkt-tag__close-btn",name:"close"}),r]})}):c?e.jsxs("span",{className:S,children:[e.jsx(v,{className:"pkt-tag__icon",name:c}),r]}):e.jsx("span",{className:S,children:r})});oe.displayName="PktTag";const Nt=m.forwardRef(({arrowNav:r=!0,tabs:l,onTabSelected:f},p)=>{const u=m.useRef([]);m.useEffect(()=>{u.current=u.current.slice(0,l.length)},[l]);const n=(a,o)=>{o.action&&o.action(a),f&&f(a)},c=(a,o)=>{var i,k;r&&(o.code==="ArrowLeft"&&a!==0&&((i=u.current[a-1])==null||i.focus()),o.code==="ArrowRight"&&a<l.length-1&&((k=u.current[a+1])==null||k.focus()),(o.code==="ArrowDown"||o.code==="Space")&&n(a,l[a]))};return e.jsx("div",{className:"pkt-tabs",ref:p,children:e.jsx("div",{className:"pkt-tabs__list",role:r?"tablist":"navigation",children:l.map((a,o)=>e.jsx(m.Fragment,{children:a.href?e.jsxs("a",{"aria-selected":!!a.active,role:r?"tab":void 0,href:a.href,"aria-controls":a.controls,className:`pkt-tabs__link ${a.active?"active":""}`,onKeyUp:i=>c(o,i),onClick:()=>n(o,a),tabIndex:a.active||!r?void 0:-1,ref:i=>{u.current[o]=i},children:[a.icon&&e.jsx(v,{name:a.icon,className:"pkt-icon--small"}),a.text,a.tag&&e.jsx(oe,{skin:a.tag.skin,size:"small",children:a.tag.text})]}):e.jsxs("button",{"aria-selected":!!a.active,role:r?"tab":void 0,type:"button","aria-controls":a.controls,className:`pkt-tabs__button pkt-link-button ${a.active?"active":""}`,onKeyUp:i=>c(o,i),onClick:()=>n(o,a),tabIndex:a.active||!r?void 0:-1,ref:i=>{u.current[o]=i},children:[a.icon&&e.jsx(v,{name:a.icon,className:"pkt-icon--small"}),a.text,a.tag&&e.jsx(oe,{skin:a.tag.skin,size:"small",children:a.tag.text})]},"b-"+o)},o))})})}),yt=m.forwardRef(({id:r,ariaDescribedby:l,ariaLabelledby:f,counter:p,counterMaxLength:u,className:n,disabled:c,errorMessage:a,hasError:o,helptext:i,helptextDropdown:k,helptextDropdownButton:b,inline:g,fullwidth:T=!1,label:S,name:F,optionalTag:A=!1,optionalText:C,requiredTag:P=!1,requiredText:N,placeholder:D,rows:Y,useWrapper:W=!0,onChange:V,...z},U)=>{const J=[n,"pkt-textinput","pkt-textarea"].join(" "),H=f||`${r}-label`,L=m.useRef(null),[R,h]=m.useState(0),I=q=>{var G,se;if(p&&h(((se=(G=q.currentTarget)==null?void 0:G.value)==null?void 0:se.length)||0),V)return V(q)};return m.useEffect(()=>{var q,G;typeof U=="function"&&U(L.current),p&&h(((G=(q=L==null?void 0:L.current)==null?void 0:q.value)==null?void 0:G.length)||0)},[U]),e.jsxs(ae,{ariaDescribedby:l,className:J,disabled:c,errorMessage:a,forId:r,hasError:o,helptext:i,helptextDropdown:k,helptextDropdownButton:b,inline:g,label:S,optionalTag:A,optionalText:C,requiredTag:P,requiredText:N,useWrapper:W,children:[e.jsx("textarea",{ref:L,className:`pkt-input ${T?"pkt-input--fullwidth":""} ${u&&R>u?"pkt-input--counter-error":""}`,name:F||r,id:r,placeholder:D,disabled:c,rows:Y,"aria-labelledby":H,"aria-invalid":o,"aria-errormessage":`${r}-error`,...z,onChange:I}),p&&e.jsxs("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":!0,children:[R||0,u&&`/${u}`]})]})}),wt=m.forwardRef(({id:r,ariaDescribedby:l,ariaLabelledby:f,autocomplete:p="off",className:u,disabled:n=!1,errorMessage:c,hasError:a=!1,helptext:o,helptextDropdown:i,helptextDropdownButton:k,iconNameRight:b,inline:g=!1,fullwidth:T=!1,label:S,name:F,optionalTag:A=!1,optionalText:C,requiredTag:P=!1,requiredText:N,placeholder:D,prefix:Y,suffix:W,type:V="text",useWrapper:z=!0,omitSearchIcon:U=!1,value:J,...H},L)=>{const R=[u,"pkt-textinput"].join(" "),h=f||`${r}-label`,I=V==="search"&&!b&&!U;return e.jsx(ae,{ariaDescribedby:l,className:R,disabled:n,errorMessage:c,forId:r,hasError:a,helptext:o,helptextDropdown:i,helptextDropdownButton:k,inline:g,label:S,optionalTag:A,optionalText:C,requiredTag:P,requiredText:N,useWrapper:z,children:e.jsxs("div",{className:"pkt-input__container",children:[Y&&e.jsx("div",{className:"pkt-input-prefix",children:Y}),e.jsx("input",{ref:L,className:`pkt-input ${T?"pkt-input--fullwidth":""}`,type:V,name:F||r,id:r,placeholder:D,autoComplete:p,value:J,disabled:n,"aria-invalid":a,"aria-errormessage":`${r}-error`,"aria-labelledby":h,...H}),W&&e.jsxs("p",{className:"pkt-input-suffix",children:[W,b&&e.jsx(v,{className:"pkt-input-suffix-icon",name:b}),I&&e.jsx(v,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!W&&b&&e.jsx(v,{className:"pkt-input-icon",name:b}),!W&&I&&e.jsx(v,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});j.PktAlert=Te,j.PktBackLink=it,j.PktBreadcrumbs=ot,j.PktButton=Q,j.PktCheckbox=Se,j.PktFooter=ct,j.PktFooterSimple=ut,j.PktHeader=ft,j.PktIcon=v,j.PktIconContext=Ce,j.PktInput=Re,j.PktInputWrapper=ae,j.PktLinkCard=Oe,j.PktLoader=dt,j.PktMessagebox=kt,j.PktRadioButton=Ie,j.PktSearchInput=mt,j.PktSelect=ht,j.PktTable=_t,j.PktTableBody=gt,j.PktTableDataCell=bt,j.PktTableHeader=xt,j.PktTableHeaderCell=vt,j.PktTableRow=jt,j.PktTabs=Nt,j.PktTag=oe,j.PktTextarea=yt,j.PktTextinput=wt,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "11.13.6",
3
+ "version": "11.13.9",
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",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@oslokommune/punkt-assets": "^11.13.2",
36
- "@oslokommune/punkt-css": "^11.13.3",
36
+ "@oslokommune/punkt-css": "^11.13.9",
37
37
  "@testing-library/jest-dom": "^6.4.5",
38
38
  "@testing-library/react": "^15.0.7",
39
39
  "@testing-library/user-event": "^14.5.2",
@@ -91,5 +91,5 @@
91
91
  "url": "https://github.com/oslokommune/punkt/issues"
92
92
  },
93
93
  "license": "MIT",
94
- "gitHead": "c9436a924a1fe4b2b009009fb0bf23222dddd40a"
94
+ "gitHead": "c0476c2b76e167c83493b01a59f267aa0b0845b1"
95
95
  }
@@ -48,13 +48,13 @@ describe('PktAccordion', () => {
48
48
  expect(screen.getByText('Content 2')).toBeInTheDocument()
49
49
  })
50
50
 
51
- test('applies compact, skin and ariaLabelledBy prop', () => {
51
+ test('applies compact and skin ', () => {
52
52
  const mockToggleOpen = jest.fn()
53
53
 
54
54
  render(
55
55
  <>
56
56
  <h3 id="accordion-heading">Accordion Heading</h3>
57
- <PktAccordion ariaLabelledById="accordion-heading" skin="outlined" compact>
57
+ <PktAccordion skin="outlined" compact>
58
58
  <PktAccordionItem title="Title" id="item1">
59
59
  Content
60
60
  </PktAccordionItem>
@@ -64,7 +64,6 @@ describe('PktAccordion', () => {
64
64
  // Assert that the Accordion component applies the props correctly
65
65
  expect(screen.getByTestId('pkt-accordion')).toHaveClass('pkt-accordion--compact')
66
66
  expect(screen.getByTestId('pkt-accordion')).toHaveClass('pkt-accordion--outlined')
67
- expect(screen.getByTestId('pkt-accordion')).toHaveAttribute('aria-labelledby', 'accordion-heading')
68
67
  })
69
68
 
70
69
  describe('accessibility', () => {
@@ -1,8 +1,6 @@
1
- import React, { FC, ReactNode, Ref, forwardRef, useState } from 'react'
2
- import { PktAccordionItem } from './AccordionItem'
1
+ import { ReactNode, Ref, forwardRef } from 'react'
3
2
 
4
3
  export interface IPktAccordion {
5
- ariaLabelledById?: string
6
4
  className?: string
7
5
  children: ReactNode | ReactNode[]
8
6
  /**
@@ -19,10 +17,7 @@ export interface IPktAccordion {
19
17
  }
20
18
 
21
19
  export const PktAccordion = forwardRef(
22
- (
23
- { compact = false, skin = 'borderless', className, ariaLabelledById, children }: IPktAccordion,
24
- ref: Ref<HTMLDivElement>,
25
- ) => {
20
+ ({ compact = false, skin = 'borderless', className, children }: IPktAccordion, ref: Ref<HTMLDivElement>) => {
26
21
  const stylingClasses = [
27
22
  className,
28
23
  'pkt-accordion',
@@ -33,7 +28,7 @@ export const PktAccordion = forwardRef(
33
28
  .join(' ')
34
29
 
35
30
  return (
36
- <div data-testid="pkt-accordion" className={stylingClasses} aria-labelledby={ariaLabelledById} ref={ref}>
31
+ <div data-testid="pkt-accordion" className={stylingClasses} ref={ref}>
37
32
  {children}
38
33
  </div>
39
34
  )
@@ -17,8 +17,8 @@ export interface IPktAccordionToggleProps {
17
17
  export interface IPktAccordionItem {
18
18
  children?: React.ReactNode | React.ReactNode[]
19
19
  className?: string
20
- id: string
21
20
  defaultOpen?: boolean
21
+ id: string
22
22
  title: string | React.ReactNode
23
23
  toggleProps?: IPktAccordionToggleProps
24
24
  }
@@ -61,15 +61,12 @@ export const PktAccordionItem = forwardRef(
61
61
 
62
62
  return (
63
63
  <details
64
- aria-controls={`pkt-accordion-item-content-${id}`}
65
- aria-expanded={openToggleProp}
66
64
  className={accordionItemClass}
67
65
  ref={ref}
68
- id={`pkt-accordion-item-header-${id}`}
66
+ id={id}
69
67
  open={toggleProps ? returnTrueIfOpen(toggleProps.isOpen) : returnTrueIfOpen(isOpen)}
70
68
  >
71
69
  <summary
72
- aria-labelledby={`pkt-accordion-item-header-${id}`}
73
70
  className="pkt-accordion-item__title"
74
71
  id={`pkt-accordion-item-summary-${id}`}
75
72
  onClick={(e) => handleToggleClick(e, id)}
@@ -100,13 +100,13 @@ export const PktInputWrapper = forwardRef(
100
100
  ></div>
101
101
  )}
102
102
  {hasDropDown && helptextDropdown !== '' && (
103
- <div>
103
+ <div className="pkt-inputwrapper__helptext-expandable">
104
104
  <PktButton
105
105
  skin="tertiary"
106
106
  size="small"
107
107
  variant="icon-right"
108
108
  iconName={isHelpTextOpen ? 'chevron-thin-up' : 'chevron-thin-down'}
109
- className="pkt-inputwrapper__helptext-expandable pkt-link pkt-link--icon-right"
109
+ className="pkt-link pkt-link--icon-right"
110
110
  onClick={toggleHelpText}
111
111
  >
112
112
  <span dangerouslySetInnerHTML={{ __html: dropdownButton }} />