@oslokommune/punkt-react 9.2.8 → 9.2.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,24 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [9.2.9](https://github.com/oslokommune/punkt/compare/9.2.8...9.2.9) (2023-10-18)
9
+
10
+ ### ⚠ BREAKING CHANGES
11
+ Ingen
12
+
13
+ ### Features
14
+ Ingen
15
+
16
+ ### Bug Fixes
17
+ * Fjern ekstra whitespace når title ikke er satt i Messagebox.
18
+
19
+
20
+ ### Chores
21
+ Ingen
22
+
23
+ ---
24
+
25
+
8
26
  ## [9.2.8](https://github.com/oslokommune/punkt/compare/9.2.7...9.2.8) (2023-10-18)
9
27
 
10
28
  ### ⚠ BREAKING CHANGES
@@ -1969,7 +1969,7 @@ const sr = ({
1969
1969
  }) => {
1970
1970
  const i = ["pkt-messagebox", n && `pkt-messagebox--${n}`, o].filter(Boolean).join(" ");
1971
1971
  return /* @__PURE__ */ h("div", { ...a, className: i, children: [
1972
- /* @__PURE__ */ l("div", { className: "pkt-messagebox__title", children: r }),
1972
+ r && /* @__PURE__ */ l("div", { className: "pkt-messagebox__title", children: r }),
1973
1973
  /* @__PURE__ */ l("div", { className: "pkt-messagebox__text", children: e })
1974
1974
  ] });
1975
1975
  }, Qn = B(
@@ -55,4 +55,4 @@ Check the top-level render call using <`+d+">.")}return u}}function Lt(t,u){{if(
55
55
  Copyright (c) 2018 Jed Watson.
56
56
  Licensed under the MIT License (MIT), see
57
57
  http://jedwatson.github.io/classnames
58
- */(function(e){(function(){var n={}.hasOwnProperty;function r(){for(var o=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")o.push(i);else if(Array.isArray(i)){if(i.length){var p=r.apply(null,i);p&&o.push(p)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){o.push(i.toString());continue}for(var f in i)n.call(i,f)&&i[f]&&o.push(f)}}}return o.join(" ")}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(mt);var Tn=mt.exports;const ht=Bt(Tn),jn=N.forwardRef(({logoLink:e="https://www.oslo.kommune.no/",serviceName:n,fixed:r=!0,scrollToHide:o=!0,user:a,userMenu:i,representing:s,userOptions:p,userMenuFooter:f,canChangeRepresentation:c=!0,showMenuButton:h=!1,showLogOutButton:v=!1,openMenu:w,logOut:C,changeRepresentation:O,...S},D)=>{const P=N.useMemo(()=>typeof(a==null?void 0:a.lastLoggedIn)=="string"?a.lastLoggedIn:a!=null&&a.lastLoggedIn?new Date(a.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"}):"",[a]),[g,$]=N.useState(!1),[U,B]=N.useState(0),[W,Y]=N.useState(!1),q=N.useRef(null);N.useEffect(()=>(document.addEventListener("mouseup",K),window.addEventListener("scroll",M),()=>{document.removeEventListener("mouseup",K),window.removeEventListener("scroll",M)}));const J=()=>{Y(!W)},K=_=>{q.current&&!q.current.contains(_.target)&&Y(!1)},M=()=>{if(o){const _=window.pageYOffset||document.documentElement.scrollTop;if(_<0||Math.abs(_-U)<60)return;$(_>U),B(_)}};return m("header",{...S,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:ht("pkt-header",{"pkt-header--fixed":r,"pkt-header--scroll-to-hide":o,"pkt-header--hidden":g}),ref:D,children:[m("div",{className:"pkt-header__logo",children:[typeof e=="string"?l("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:e,children:l(y,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/9.2/logos/"})}):l("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header__logo-link",onClick:e,children:l(y,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/9.2/logos/"})}),l("span",{className:"pkt-header__logo-service",children:n})]}),l("nav",{className:"pkt-header__actions",children:m("ul",{className:"pkt-header__actions-row",children:[h&&l("li",{children:l(ce,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:w,children:"Meny"})}),(a||s)&&m("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${W&&!g?"pkt-header--open-dropdown":""}`,ref:q,children:[m("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":W,onClick:J,children:[l(y,{name:"user",className:"pkt-btn__icon"}),l("span",{className:"pkt-header__user-fullname",children:(s==null?void 0:s.name)||(a==null?void 0:a.name)}),l("span",{className:"pkt-header__user-shortname",children:(s==null?void 0:s.shortname)||(a==null?void 0:a.shortname)}),l(y,{name:"chevron-thin-down",className:"pkt-btn--closed"}),l(y,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),m("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[a&&m("li",{children:[l("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),l("div",{className:"pkt-user-menu__name",children:a.name}),a.lastLoggedIn&&m("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",l("time",{children:P})]})]}),i&&l("li",{children:l("ul",{className:"pkt-list",children:i.map((_,L)=>l("li",{children:typeof _.target=="string"?m("a",{href:_.target,className:"pkt-link",children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]}):m("button",{className:"pkt-link-button pkt-link",onClick:_.target,children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]})},`userMenu-${L}`))})}),(s||c)&&m("li",{children:[s&&m(Z,{children:[l("div",{className:"pkt-user-menu__label",children:"Representerer"}),l("div",{className:"pkt-user-menu__name",children:s.name}),s.orgNumber&&m("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",s.orgNumber]})]}),l("ul",{className:"pkt-list mt-size-16",children:c&&l("li",{children:m("button",{className:"pkt-link-button pkt-link",onClick:O,children:[l(y,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),l("li",{children:l("ul",{className:"pkt-list",children:(p||!v)&&m(Z,{children:[p==null?void 0:p.map((_,L)=>l("li",{children:typeof _.target=="string"?m("a",{href:_.target,className:"pkt-link",children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]}):m("button",{className:"pkt-link-button pkt-link",onClick:_.target,children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]})},`userOptions-${L}`)),!v&&l("li",{children:m("button",{className:"pkt-link-button pkt-link",onClick:C,children:[l(y,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),f&&l("li",{className:"footer",children:l("ul",{className:"pkt-list-horizontal bordered",children:f.map((_,L)=>l("li",{children:typeof _.target=="string"?l("a",{href:_.target,className:"pkt-link",children:_.title}):l("button",{className:"pkt-link-button pkt-link",onClick:_.target,children:_.title})},`userMenuFooter-${L}`))})})]})]}),v&&l("li",{children:l(ce,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:C,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),kt=N.forwardRef(({label:e,id:n,children:r,...o},a)=>m("div",{className:"pkt-form-group",children:[l("label",{htmlFor:n,className:"pkt-form-label",children:e}),l("input",{className:"pkt-form-input",id:n,...o,ref:a}),r]}));kt.displayName="PktInput";const ue=N.forwardRef(({forId:e,label:n,helptext:r,helptextDropdown:o,helptextDropdownButton:a,optionalTag:i=!1,optionalText:s="Valgfritt",requiredTag:p=!1,requiredText:f="Må fylles ut",hasError:c,errorMessage:h,disabled:v,inline:w,ariaDescribedby:C,useWrapper:O=!0,children:S,className:D,hasFieldset:P=!1},g)=>{const[$,U]=N.useState(!1),B=()=>{U(!$)},W=()=>i?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":p?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",Y=i?s:p?f:"",q=v?"pkt-inputwrapper--disabled":"",J=w?"pkt-inputwrapper--inline":"",K=c?"pkt-inputwrapper--error":"",M=!!o&&o!=="",_=a||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',L=P?"fieldset":M?"div":"label",H=P?"legend":M?"h2":"span",G=C||(r?`${e}-helptext`:void 0);return m("div",{className:["pkt-inputwrapper",D,q,J,K].join(" "),ref:g,children:[O?l(Z,{children:m(L,{htmlFor:e,"aria-describedby":M?void 0:C,className:`pkt-inputwrapper__label${P?" pkt-inputwrapper__fieldset":""}`,children:[m(H,{id:`${e}-label`,className:`${P?" pkt-inputwrapper__legend":""}`,children:[n,Y!==""&&l("span",{className:W(),children:Y})]}),r&&l("div",{className:"pkt-inputwrapper__helptext",id:`${e}-helptext`,dangerouslySetInnerHTML:{__html:r}}),M&&o!==""&&m("div",{children:[l(ce,{skin:"tertiary",size:"small",variant:"icon-right",iconName:$?"chevron-thin-up":"chevron-thin-down",className:"pkt-inputwrapper__helptext-expandable pkt-link pkt-link--icon-right",onClick:B,children:l("span",{dangerouslySetInnerHTML:{__html:_}})}),l("div",{className:`pkt-inputwrapper__helptext ${$?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:l("span",{dangerouslySetInnerHTML:{__html:o}})}),l("label",{htmlFor:e,className:"pkt-sr-only","aria-describedby":G,children:n})]}),l(Z,{children:S})]})}):m(Z,{children:[l("label",{htmlFor:e,className:"pkt-sr-only","aria-describedby":G,id:`${e}-label`,children:n}),S]}),c&&h&&l("div",{children:l(Ze,{skin:"error","aria-live":"assertive",id:`${e}-error`,slim:!0,children:h})})]})});ue.displayName="PktInputWrapper";const vt=N.forwardRef(({children:e,className:n,iconName:r="user",openInNewTab:o=!1,skin:a="normal",href:i="#",external:s=!1,title:p},f)=>{const c=[n,"pkt-linkcard",a&&`pkt-linkcard--${a}`].filter(Boolean).join(" ");return m("a",{href:i,className:`pkt-linkcard pkt-link ${c}`,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,ref:f,children:[l(y,{className:"pkt-link__icon",name:r}),m("div",{className:"pkt-linkcard__content",children:[l("div",{className:`pkt-linkcard__title ${s?"pkt-link pkt-link--external":""}`,children:p}),l("div",{className:"pkt-linkcard__text",children:e})]})]})});vt.displayName="PktLinkCard";const Dn=({children:e,skin:n="beige",title:r,className:o,...a})=>{const i=["pkt-messagebox",n&&`pkt-messagebox--${n}`,o].filter(Boolean).join(" ");return m("div",{...a,className:i,children:[l("div",{className:"pkt-messagebox__title",children:r}),l("div",{className:"pkt-messagebox__text",children:e})]})},_t=N.forwardRef(({id:e,name:n,label:r,className:o,hasTile:a=!1,disabled:i=!1,checkHelptext:s,hasError:p=!1,...f},c)=>{const h=[o,"pkt-input-check"].filter(Boolean).join(" ");return l("div",{className:h,children:m("div",{className:`pkt-input-check__input ${a?"pkt-input-check__input--tile":""}`,children:[l("input",{ref:c,className:`pkt-input-check__input-checkbox ${p?"pkt-input-check__input-checkbox--error":""}`,type:"radio",id:e,disabled:i,name:n,...f}),m("label",{className:"pkt-input-check__input-label",htmlFor:e,children:[r,s&&l("div",{className:"pkt-input-check__input-helptext",children:s})]})]})})});_t.displayName="PktRadioButton";const $n=N.forwardRef(({ariaDescribedby:e,ariaLabelledby:n,children:r,className:o,disabled:a=!1,errorMessage:i,hasError:s,helptext:p,helptextDropdown:f,helptextDropdownButton:c,id:h,inline:v=!1,fullwidth:w=!1,label:C,name:O,optionalTag:S=!1,optionalText:D,requiredTag:P=!1,requiredText:g,...$},U)=>{const B=[o,"pkt-select"].join(" ");return l(ue,{className:B,forId:h,label:C,helptext:p,helptextDropdown:f,helptextDropdownButton:c,optionalTag:S,optionalText:D,requiredTag:P,requiredText:g,hasError:s,errorMessage:i,disabled:a,inline:v,ariaDescribedby:e,children:l("select",{ref:U,className:`pkt-input ${w?"pkt-input--fullwidth":""}`,"aria-invalid":s,"aria-errormessage":`${h}-error`,"aria-labelledby":n||`${h}-label`,disabled:a,id:h,name:O||h,...$,children:r})})}),Ln=({isResponsive:e,children:n})=>e?l("div",{className:"pkt-table-container",children:n}):l(Z,{children:n}),In=({isResponsive:e,modifiers:{info:n=!1,success:r=!1,strong:o=!1,shadow:a=!1}={},children:i})=>l(Ln,{isResponsive:e,children:l("table",{className:ht("pkt-table",{"pkt-table--info":n,"pkt-table--success":r,"pkt-table--strong":o,"pkt-table--shadow":a}),children:i})}),Fn=({children:e})=>l("td",{className:"pkt-table__th",children:e}),An=({children:e})=>l("th",{className:"pkt-table__th",children:e}),bt=N.forwardRef(({children:e,className:n,skin:r="blue",textStyle:o="normal-text",size:a="medium",closeTag:i=!1,iconName:s="",type:p="button",ariaLabel:f="close",onClick:c=()=>{}},h)=>{const[v,w]=N.useState(!1),C=P=>{w(!0),c(P)},O=["pkt-tag",a&&`pkt-tag--${a}`,r&&`pkt-tag--${r}`,o&&`pkt-tag--${o}`,n].filter(Boolean).join(" "),S=["pkt-tag","pkt-btn","pkt-btn--tertiary",a&&`pkt-tag--${a}`,r&&`pkt-tag--${r}`,o&&`pkt-tag--${o}`,s&&i?"pkt-btn--icons-right-and-left":null,i&&!s?"pkt-btn--icon-right":null,n].filter(Boolean).join(" "),D=!v;return i&&s?l(Z,{children:D&&m("button",{className:S,type:p,"aria-label":f,onClick:C,ref:h,children:[l(y,{className:"pkt-tag__icon",name:s}),e,l(y,{className:"pkt-tag__close-btn",name:"close"})]})}):i?l(Z,{children:D&&m("button",{className:S,type:p,"aria-label":f,onClick:C,ref:h,children:[l(y,{className:"pkt-tag__close-btn",name:"close"}),e]})}):s?m("span",{className:O,children:[l(y,{className:"pkt-tag__icon",name:s}),e]}):l("span",{className:O,children:e})});bt.displayName="PktTag";const Un=N.forwardRef(({id:e,ariaDescribedby:n,ariaLabelledby:r,counter:o,counterMaxLength:a,className:i,disabled:s,errorMessage:p,hasError:f,helptext:c,helptextDropdown:h,helptextDropdownButton:v,inline:w,fullwidth:C=!1,label:O,name:S,optionalTag:D=!1,optionalText:P,requiredTag:g=!1,requiredText:$,placeholder:U,rows:B,useWrapper:W=!0,onChange:Y,...q},J)=>{const K=[i,"pkt-textinput","pkt-textarea"].join(" "),M=r||`${e}-label`,_=N.useRef(null),[L,H]=N.useState(0),G=ee=>{var te,fe;if(o&&H(((fe=(te=ee.currentTarget)==null?void 0:te.value)==null?void 0:fe.length)||0),Y)return Y(ee)};return N.useEffect(()=>{var ee,te;typeof J=="function"&&J(_.current),o&&H(((te=(ee=_==null?void 0:_.current)==null?void 0:ee.value)==null?void 0:te.length)||0)},[J]),m(ue,{ariaDescribedby:n,className:K,disabled:s,errorMessage:p,forId:e,hasError:f,helptext:c,helptextDropdown:h,helptextDropdownButton:v,inline:w,label:O,optionalTag:D,optionalText:P,requiredTag:g,requiredText:$,useWrapper:W,children:[l("textarea",{ref:_,className:`pkt-input ${C?"pkt-input--fullwidth":""} ${a&&L>a?"pkt-input--counter-error":""}`,name:S||e,id:e,placeholder:U,disabled:s,rows:B,"aria-labelledby":M,"aria-invalid":f,"aria-errormessage":`${e}-error`,...q,onChange:G}),o&&m("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":!0,children:[L||0,a&&`/${a}`]})]})}),Bn=N.forwardRef(({id:e,ariaDescribedby:n,ariaLabelledby:r,autocomplete:o="off",className:a,disabled:i=!1,errorMessage:s,hasError:p=!1,helptext:f,helptextDropdown:c,helptextDropdownButton:h,iconNameRight:v,inline:w=!1,fullwidth:C=!1,label:O,name:S,optionalTag:D=!1,optionalText:P,requiredTag:g=!1,requiredText:$,placeholder:U,prefix:B,suffix:W,type:Y="text",useWrapper:q=!0,value:J,...K},M)=>{const _=[a,"pkt-textinput"].join(" "),L=r||`${e}-label`;return l(ue,{ariaDescribedby:n,className:_,disabled:i,errorMessage:s,forId:e,hasError:p,helptext:f,helptextDropdown:c,helptextDropdownButton:h,inline:w,label:O,optionalTag:D,optionalText:P,requiredTag:g,requiredText:$,useWrapper:q,children:m("div",{className:"pkt-input__container",children:[B&&l("div",{className:"pkt-input-prefix",children:B}),l("input",{ref:M,className:`pkt-input ${C?"pkt-input--fullwidth":""}`,type:Y,name:S||e,id:e,placeholder:U,autoComplete:o,value:J,disabled:i,"aria-invalid":p,"aria-errormessage":`${e}-error`,"aria-labelledby":L,...K}),W&&m("p",{className:"pkt-input-suffix",children:[W,v&&l(y,{className:"pkt-input-suffix-icon",name:v})]}),!W&&v&&l(y,{className:"pkt-input-icon",name:v})]})})});T.PktAlert=Ze,T.PktBackLink=Jt,T.PktBreadcrumbs=Rn,T.PktButton=ce,T.PktCheckbox=dt,T.PktFooter=Sn,T.PktFooterSimple=On,T.PktHeader=jn,T.PktIcon=y,T.PktInput=kt,T.PktInputWrapper=ue,T.PktLinkCard=vt,T.PktMessagebox=Dn,T.PktRadioButton=_t,T.PktSelect=$n,T.PktTable=In,T.PktTableData=Fn,T.PktTableHeader=An,T.PktTag=bt,T.PktTextarea=Un,T.PktTextinput=Bn,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
58
+ */(function(e){(function(){var n={}.hasOwnProperty;function r(){for(var o=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")o.push(i);else if(Array.isArray(i)){if(i.length){var p=r.apply(null,i);p&&o.push(p)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){o.push(i.toString());continue}for(var f in i)n.call(i,f)&&i[f]&&o.push(f)}}}return o.join(" ")}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(mt);var Tn=mt.exports;const ht=Bt(Tn),jn=N.forwardRef(({logoLink:e="https://www.oslo.kommune.no/",serviceName:n,fixed:r=!0,scrollToHide:o=!0,user:a,userMenu:i,representing:s,userOptions:p,userMenuFooter:f,canChangeRepresentation:c=!0,showMenuButton:h=!1,showLogOutButton:v=!1,openMenu:w,logOut:C,changeRepresentation:O,...S},D)=>{const P=N.useMemo(()=>typeof(a==null?void 0:a.lastLoggedIn)=="string"?a.lastLoggedIn:a!=null&&a.lastLoggedIn?new Date(a.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"}):"",[a]),[g,$]=N.useState(!1),[U,B]=N.useState(0),[W,Y]=N.useState(!1),q=N.useRef(null);N.useEffect(()=>(document.addEventListener("mouseup",K),window.addEventListener("scroll",M),()=>{document.removeEventListener("mouseup",K),window.removeEventListener("scroll",M)}));const J=()=>{Y(!W)},K=_=>{q.current&&!q.current.contains(_.target)&&Y(!1)},M=()=>{if(o){const _=window.pageYOffset||document.documentElement.scrollTop;if(_<0||Math.abs(_-U)<60)return;$(_>U),B(_)}};return m("header",{...S,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:ht("pkt-header",{"pkt-header--fixed":r,"pkt-header--scroll-to-hide":o,"pkt-header--hidden":g}),ref:D,children:[m("div",{className:"pkt-header__logo",children:[typeof e=="string"?l("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:e,children:l(y,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/9.2/logos/"})}):l("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header__logo-link",onClick:e,children:l(y,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/9.2/logos/"})}),l("span",{className:"pkt-header__logo-service",children:n})]}),l("nav",{className:"pkt-header__actions",children:m("ul",{className:"pkt-header__actions-row",children:[h&&l("li",{children:l(ce,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:w,children:"Meny"})}),(a||s)&&m("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${W&&!g?"pkt-header--open-dropdown":""}`,ref:q,children:[m("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":W,onClick:J,children:[l(y,{name:"user",className:"pkt-btn__icon"}),l("span",{className:"pkt-header__user-fullname",children:(s==null?void 0:s.name)||(a==null?void 0:a.name)}),l("span",{className:"pkt-header__user-shortname",children:(s==null?void 0:s.shortname)||(a==null?void 0:a.shortname)}),l(y,{name:"chevron-thin-down",className:"pkt-btn--closed"}),l(y,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),m("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[a&&m("li",{children:[l("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),l("div",{className:"pkt-user-menu__name",children:a.name}),a.lastLoggedIn&&m("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",l("time",{children:P})]})]}),i&&l("li",{children:l("ul",{className:"pkt-list",children:i.map((_,L)=>l("li",{children:typeof _.target=="string"?m("a",{href:_.target,className:"pkt-link",children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]}):m("button",{className:"pkt-link-button pkt-link",onClick:_.target,children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]})},`userMenu-${L}`))})}),(s||c)&&m("li",{children:[s&&m(Z,{children:[l("div",{className:"pkt-user-menu__label",children:"Representerer"}),l("div",{className:"pkt-user-menu__name",children:s.name}),s.orgNumber&&m("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",s.orgNumber]})]}),l("ul",{className:"pkt-list mt-size-16",children:c&&l("li",{children:m("button",{className:"pkt-link-button pkt-link",onClick:O,children:[l(y,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),l("li",{children:l("ul",{className:"pkt-list",children:(p||!v)&&m(Z,{children:[p==null?void 0:p.map((_,L)=>l("li",{children:typeof _.target=="string"?m("a",{href:_.target,className:"pkt-link",children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]}):m("button",{className:"pkt-link-button pkt-link",onClick:_.target,children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]})},`userOptions-${L}`)),!v&&l("li",{children:m("button",{className:"pkt-link-button pkt-link",onClick:C,children:[l(y,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),f&&l("li",{className:"footer",children:l("ul",{className:"pkt-list-horizontal bordered",children:f.map((_,L)=>l("li",{children:typeof _.target=="string"?l("a",{href:_.target,className:"pkt-link",children:_.title}):l("button",{className:"pkt-link-button pkt-link",onClick:_.target,children:_.title})},`userMenuFooter-${L}`))})})]})]}),v&&l("li",{children:l(ce,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:C,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),kt=N.forwardRef(({label:e,id:n,children:r,...o},a)=>m("div",{className:"pkt-form-group",children:[l("label",{htmlFor:n,className:"pkt-form-label",children:e}),l("input",{className:"pkt-form-input",id:n,...o,ref:a}),r]}));kt.displayName="PktInput";const ue=N.forwardRef(({forId:e,label:n,helptext:r,helptextDropdown:o,helptextDropdownButton:a,optionalTag:i=!1,optionalText:s="Valgfritt",requiredTag:p=!1,requiredText:f="Må fylles ut",hasError:c,errorMessage:h,disabled:v,inline:w,ariaDescribedby:C,useWrapper:O=!0,children:S,className:D,hasFieldset:P=!1},g)=>{const[$,U]=N.useState(!1),B=()=>{U(!$)},W=()=>i?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":p?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",Y=i?s:p?f:"",q=v?"pkt-inputwrapper--disabled":"",J=w?"pkt-inputwrapper--inline":"",K=c?"pkt-inputwrapper--error":"",M=!!o&&o!=="",_=a||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',L=P?"fieldset":M?"div":"label",H=P?"legend":M?"h2":"span",G=C||(r?`${e}-helptext`:void 0);return m("div",{className:["pkt-inputwrapper",D,q,J,K].join(" "),ref:g,children:[O?l(Z,{children:m(L,{htmlFor:e,"aria-describedby":M?void 0:C,className:`pkt-inputwrapper__label${P?" pkt-inputwrapper__fieldset":""}`,children:[m(H,{id:`${e}-label`,className:`${P?" pkt-inputwrapper__legend":""}`,children:[n,Y!==""&&l("span",{className:W(),children:Y})]}),r&&l("div",{className:"pkt-inputwrapper__helptext",id:`${e}-helptext`,dangerouslySetInnerHTML:{__html:r}}),M&&o!==""&&m("div",{children:[l(ce,{skin:"tertiary",size:"small",variant:"icon-right",iconName:$?"chevron-thin-up":"chevron-thin-down",className:"pkt-inputwrapper__helptext-expandable pkt-link pkt-link--icon-right",onClick:B,children:l("span",{dangerouslySetInnerHTML:{__html:_}})}),l("div",{className:`pkt-inputwrapper__helptext ${$?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:l("span",{dangerouslySetInnerHTML:{__html:o}})}),l("label",{htmlFor:e,className:"pkt-sr-only","aria-describedby":G,children:n})]}),l(Z,{children:S})]})}):m(Z,{children:[l("label",{htmlFor:e,className:"pkt-sr-only","aria-describedby":G,id:`${e}-label`,children:n}),S]}),c&&h&&l("div",{children:l(Ze,{skin:"error","aria-live":"assertive",id:`${e}-error`,slim:!0,children:h})})]})});ue.displayName="PktInputWrapper";const vt=N.forwardRef(({children:e,className:n,iconName:r="user",openInNewTab:o=!1,skin:a="normal",href:i="#",external:s=!1,title:p},f)=>{const c=[n,"pkt-linkcard",a&&`pkt-linkcard--${a}`].filter(Boolean).join(" ");return m("a",{href:i,className:`pkt-linkcard pkt-link ${c}`,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,ref:f,children:[l(y,{className:"pkt-link__icon",name:r}),m("div",{className:"pkt-linkcard__content",children:[l("div",{className:`pkt-linkcard__title ${s?"pkt-link pkt-link--external":""}`,children:p}),l("div",{className:"pkt-linkcard__text",children:e})]})]})});vt.displayName="PktLinkCard";const Dn=({children:e,skin:n="beige",title:r,className:o,...a})=>{const i=["pkt-messagebox",n&&`pkt-messagebox--${n}`,o].filter(Boolean).join(" ");return m("div",{...a,className:i,children:[r&&l("div",{className:"pkt-messagebox__title",children:r}),l("div",{className:"pkt-messagebox__text",children:e})]})},_t=N.forwardRef(({id:e,name:n,label:r,className:o,hasTile:a=!1,disabled:i=!1,checkHelptext:s,hasError:p=!1,...f},c)=>{const h=[o,"pkt-input-check"].filter(Boolean).join(" ");return l("div",{className:h,children:m("div",{className:`pkt-input-check__input ${a?"pkt-input-check__input--tile":""}`,children:[l("input",{ref:c,className:`pkt-input-check__input-checkbox ${p?"pkt-input-check__input-checkbox--error":""}`,type:"radio",id:e,disabled:i,name:n,...f}),m("label",{className:"pkt-input-check__input-label",htmlFor:e,children:[r,s&&l("div",{className:"pkt-input-check__input-helptext",children:s})]})]})})});_t.displayName="PktRadioButton";const $n=N.forwardRef(({ariaDescribedby:e,ariaLabelledby:n,children:r,className:o,disabled:a=!1,errorMessage:i,hasError:s,helptext:p,helptextDropdown:f,helptextDropdownButton:c,id:h,inline:v=!1,fullwidth:w=!1,label:C,name:O,optionalTag:S=!1,optionalText:D,requiredTag:P=!1,requiredText:g,...$},U)=>{const B=[o,"pkt-select"].join(" ");return l(ue,{className:B,forId:h,label:C,helptext:p,helptextDropdown:f,helptextDropdownButton:c,optionalTag:S,optionalText:D,requiredTag:P,requiredText:g,hasError:s,errorMessage:i,disabled:a,inline:v,ariaDescribedby:e,children:l("select",{ref:U,className:`pkt-input ${w?"pkt-input--fullwidth":""}`,"aria-invalid":s,"aria-errormessage":`${h}-error`,"aria-labelledby":n||`${h}-label`,disabled:a,id:h,name:O||h,...$,children:r})})}),Ln=({isResponsive:e,children:n})=>e?l("div",{className:"pkt-table-container",children:n}):l(Z,{children:n}),In=({isResponsive:e,modifiers:{info:n=!1,success:r=!1,strong:o=!1,shadow:a=!1}={},children:i})=>l(Ln,{isResponsive:e,children:l("table",{className:ht("pkt-table",{"pkt-table--info":n,"pkt-table--success":r,"pkt-table--strong":o,"pkt-table--shadow":a}),children:i})}),Fn=({children:e})=>l("td",{className:"pkt-table__th",children:e}),An=({children:e})=>l("th",{className:"pkt-table__th",children:e}),bt=N.forwardRef(({children:e,className:n,skin:r="blue",textStyle:o="normal-text",size:a="medium",closeTag:i=!1,iconName:s="",type:p="button",ariaLabel:f="close",onClick:c=()=>{}},h)=>{const[v,w]=N.useState(!1),C=P=>{w(!0),c(P)},O=["pkt-tag",a&&`pkt-tag--${a}`,r&&`pkt-tag--${r}`,o&&`pkt-tag--${o}`,n].filter(Boolean).join(" "),S=["pkt-tag","pkt-btn","pkt-btn--tertiary",a&&`pkt-tag--${a}`,r&&`pkt-tag--${r}`,o&&`pkt-tag--${o}`,s&&i?"pkt-btn--icons-right-and-left":null,i&&!s?"pkt-btn--icon-right":null,n].filter(Boolean).join(" "),D=!v;return i&&s?l(Z,{children:D&&m("button",{className:S,type:p,"aria-label":f,onClick:C,ref:h,children:[l(y,{className:"pkt-tag__icon",name:s}),e,l(y,{className:"pkt-tag__close-btn",name:"close"})]})}):i?l(Z,{children:D&&m("button",{className:S,type:p,"aria-label":f,onClick:C,ref:h,children:[l(y,{className:"pkt-tag__close-btn",name:"close"}),e]})}):s?m("span",{className:O,children:[l(y,{className:"pkt-tag__icon",name:s}),e]}):l("span",{className:O,children:e})});bt.displayName="PktTag";const Un=N.forwardRef(({id:e,ariaDescribedby:n,ariaLabelledby:r,counter:o,counterMaxLength:a,className:i,disabled:s,errorMessage:p,hasError:f,helptext:c,helptextDropdown:h,helptextDropdownButton:v,inline:w,fullwidth:C=!1,label:O,name:S,optionalTag:D=!1,optionalText:P,requiredTag:g=!1,requiredText:$,placeholder:U,rows:B,useWrapper:W=!0,onChange:Y,...q},J)=>{const K=[i,"pkt-textinput","pkt-textarea"].join(" "),M=r||`${e}-label`,_=N.useRef(null),[L,H]=N.useState(0),G=ee=>{var te,fe;if(o&&H(((fe=(te=ee.currentTarget)==null?void 0:te.value)==null?void 0:fe.length)||0),Y)return Y(ee)};return N.useEffect(()=>{var ee,te;typeof J=="function"&&J(_.current),o&&H(((te=(ee=_==null?void 0:_.current)==null?void 0:ee.value)==null?void 0:te.length)||0)},[J]),m(ue,{ariaDescribedby:n,className:K,disabled:s,errorMessage:p,forId:e,hasError:f,helptext:c,helptextDropdown:h,helptextDropdownButton:v,inline:w,label:O,optionalTag:D,optionalText:P,requiredTag:g,requiredText:$,useWrapper:W,children:[l("textarea",{ref:_,className:`pkt-input ${C?"pkt-input--fullwidth":""} ${a&&L>a?"pkt-input--counter-error":""}`,name:S||e,id:e,placeholder:U,disabled:s,rows:B,"aria-labelledby":M,"aria-invalid":f,"aria-errormessage":`${e}-error`,...q,onChange:G}),o&&m("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":!0,children:[L||0,a&&`/${a}`]})]})}),Bn=N.forwardRef(({id:e,ariaDescribedby:n,ariaLabelledby:r,autocomplete:o="off",className:a,disabled:i=!1,errorMessage:s,hasError:p=!1,helptext:f,helptextDropdown:c,helptextDropdownButton:h,iconNameRight:v,inline:w=!1,fullwidth:C=!1,label:O,name:S,optionalTag:D=!1,optionalText:P,requiredTag:g=!1,requiredText:$,placeholder:U,prefix:B,suffix:W,type:Y="text",useWrapper:q=!0,value:J,...K},M)=>{const _=[a,"pkt-textinput"].join(" "),L=r||`${e}-label`;return l(ue,{ariaDescribedby:n,className:_,disabled:i,errorMessage:s,forId:e,hasError:p,helptext:f,helptextDropdown:c,helptextDropdownButton:h,inline:w,label:O,optionalTag:D,optionalText:P,requiredTag:g,requiredText:$,useWrapper:q,children:m("div",{className:"pkt-input__container",children:[B&&l("div",{className:"pkt-input-prefix",children:B}),l("input",{ref:M,className:`pkt-input ${C?"pkt-input--fullwidth":""}`,type:Y,name:S||e,id:e,placeholder:U,autoComplete:o,value:J,disabled:i,"aria-invalid":p,"aria-errormessage":`${e}-error`,"aria-labelledby":L,...K}),W&&m("p",{className:"pkt-input-suffix",children:[W,v&&l(y,{className:"pkt-input-suffix-icon",name:v})]}),!W&&v&&l(y,{className:"pkt-input-icon",name:v})]})})});T.PktAlert=Ze,T.PktBackLink=Jt,T.PktBreadcrumbs=Rn,T.PktButton=ce,T.PktCheckbox=dt,T.PktFooter=Sn,T.PktFooterSimple=On,T.PktHeader=jn,T.PktIcon=y,T.PktInput=kt,T.PktInputWrapper=ue,T.PktLinkCard=vt,T.PktMessagebox=Dn,T.PktRadioButton=_t,T.PktSelect=$n,T.PktTable=In,T.PktTableData=Fn,T.PktTableHeader=An,T.PktTag=bt,T.PktTextarea=Un,T.PktTextinput=Bn,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "9.2.8",
3
+ "version": "9.2.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",
@@ -91,5 +91,5 @@
91
91
  "url": "https://github.com/oslokommune/punkt/issues"
92
92
  },
93
93
  "license": "MIT",
94
- "gitHead": "a75f7a032f64ad423ebcf617c510a77613421bee"
94
+ "gitHead": "b2ef363c2138573c3044f181155879a102b407eb"
95
95
  }
@@ -16,7 +16,7 @@ export const PktMessagebox: React.FC<IPktMessagebox> = ({
16
16
 
17
17
  return (
18
18
  <div {...props} className={classes}>
19
- <div className="pkt-messagebox__title">{title}</div>
19
+ { title && <div className="pkt-messagebox__title">{title}</div> }
20
20
 
21
21
  <div className="pkt-messagebox__text">{children}</div>
22
22
  </div>