@oslokommune/punkt-react 5.0.7 → 5.0.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
+ ## [5.0.9](https://github.com/oslokommune/punkt/compare/5.0.8...5.0.9) (2023-06-06)
9
+
10
+ ### ⚠ BREAKING CHANGES
11
+ Ingen
12
+
13
+ ### Features
14
+ Ingen
15
+
16
+ ### Bug Fixes
17
+ * [938](https://github.com/oslokommune/punkt/issues/938) Sjekk om fetch eksisterer før vi kaller det i PktIcon (#939).
18
+
19
+
20
+ ### Chores
21
+ Ingen
22
+
23
+ ---
24
+
25
+
8
26
  ## [5.0.7](https://github.com/oslokommune/punkt/compare/5.0.6...5.0.7) (2023-06-02)
9
27
 
10
28
  ### ⚠ BREAKING CHANGES
@@ -101,6 +119,29 @@ Ingen
101
119
  ### ⚠ BREAKING CHANGES
102
120
  * [809](https://github.com/oslokommune/punkt/issues/809) Endre SVG oppsett (#851). BREAKING CHANGE: Ny dokumentasjon straks vi har testet dette ferdig
103
121
 
122
+ Nytt:
123
+ - Ikoner kommer med komponentene
124
+ - Oppdatert PktIcon-komponent
125
+ - Ny CSS-klasse `pkt-icon`
126
+ - Fjernet data: import av ikoner i CSS
127
+
128
+ Punkt CLI skal vedlikeholdes men ikke videreutvikles, så det er fortsatt mulig å bruke svg-oppsettet ved bruk av CLI. Men vi vil anbefale å bruke ikon-komponenten vår som dynamisk henter ikoner slik at du kan slippe å tenke på at ikoner en gang i blant må oppdateres.
129
+
130
+ Les mer om ikoner her:
131
+ https://punkt.oslo.kommune.no/5.0/ressurser/ikoner/kode/
132
+
133
+ **Hva må du gjøre?**
134
+
135
+ Alle som bruker klasser/komponenter som inneholder ikoner:
136
+ Import av ikoner i CSS henter vi nå fra vår CDN.
137
+ - Dere som har satt opp CSP må legge inn https://punkt-cdn.oslo.kommune.no/ i deres CSP.
138
+
139
+ **Vue2 og React**
140
+
141
+ Ikonene kommer nå inkludert med komponentene ved bruk av PktIcon.
142
+ Hvis du har brukt Punkt CLI til å legge til ikoner/logo i komponenter kan du nå fjerne punkt.config.json og dens svg'er. Hvis du har konfigurert CSP må du legge til CDN i din CSP. https://punkt-cdn.oslo.kommune.no/
143
+
144
+ PktIcon har blitt oppdatert med nye props.
104
145
 
105
146
  ### Features
106
147
  Ingen
@@ -631,7 +631,7 @@ process.env.NODE_ENV === "production" ? te.exports = kr() : te.exports = br();
631
631
  var ae = te.exports;
632
632
  const Fe = ae.Fragment, a = ae.jsx, d = ae.jsxs, re = {}, Ce = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';
633
633
  function gr(o, l) {
634
- return re[o] ? Promise.resolve(re[o]) : fetch(l + o + ".svg").then((i) => i.ok ? i.text() : (console.error("Missing icon: " + l + o + ".svg"), Ce)).then((i) => (i !== Ce && (re[o] = i), i));
634
+ return !re[o] && typeof fetch == "function" ? fetch(l + o + ".svg").then((i) => i.ok ? i.text() : (console.error("Missing icon: " + l + o + ".svg"), Ce)).then((i) => (i !== Ce && (re[o] = i), i)) : Promise.resolve(re[o]);
635
635
  }
636
636
  const N = ({ name: o, path: l, className: i = "", ...c }) => {
637
637
  const f = "https://punkt-cdn.oslo.kommune.no/5.0/icons/", [n, _] = Oe(null);
@@ -24,7 +24,7 @@ Check the render method of \``+e+"`."}return""}}function xt(e){{if(e!==void 0){v
24
24
 
25
25
  Check your code at `+t+":"+r+"."}return""}}var De={};function jt(e){{var t=Fe();if(!t){var r=typeof e=="string"?e:e.displayName||e.name;r&&(t=`
26
26
 
27
- Check the top-level render call using <`+r+">.")}return t}}function Ie(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=jt(t);if(De[r])return;De[r]=!0;var s="";e&&e._owner&&e._owner!==te.current&&(s=" It was passed a child from "+C(e._owner.type)+"."),A(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,s),A(null)}}function Ae(e,t){{if(typeof e!="object")return;if(q(e))for(var r=0;r<e.length;r++){var s=e[r];ae(s)&&Ie(s,t)}else if(ae(e))e._store&&(e._store.validated=!0);else if(e){var m=rt(e);if(typeof m=="function"&&m!==e.entries)for(var v=m.call(e),p;!(p=v.next()).done;)ae(p.value)&&Ie(p.value,t)}}}function St(e){{var t=e.type;if(t==null||typeof t=="string")return;var r;if(typeof t=="function")r=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===h||t.$$typeof===j))r=t.propTypes;else return;if(r){var s=C(t);_t(r,e.props,"prop",s,e)}else if(t.PropTypes!==void 0&&!re){re=!0;var m=C(t);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ct(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var s=t[r];if(s!=="children"&&s!=="key"){A(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",s),A(null);break}}e.ref!==null&&(A(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}function We(e,t,r,s,m,v){{var p=ct(e);if(!p){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=xt(m);P?u+=P:u+=Fe();var g;e===null?g="null":q(e)?g="array":e!==void 0&&e.$$typeof===l?(g="<"+(C(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):g=typeof e,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",g,u)}var N=Tt(e,t,r,m,v);if(N==null)return N;if(p){var x=t.children;if(x!==void 0)if(s)if(q(x)){for(var W=0;W<x.length;W++)Ae(x[W],e);Object.freeze&&Object.freeze(x)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ae(x,e)}return e===c?Ct(N):St(N),N}}function Ot(e,t,r){return We(e,t,r,!0)}function Ft(e,t,r){return We(e,t,r,!1)}var Dt=Ft,It=Ot;M.Fragment=c,M.jsx=Dt,M.jsxs=It}()),M}process.env.NODE_ENV==="production"?z.exports=$e():z.exports=Le();var J=z.exports;const le=J.Fragment,a=J.jsx,d=J.jsxs,K={},ie='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function Be(o,l){return K[o]?Promise.resolve(K[o]):fetch(l+o+".svg").then(i=>i.ok?i.text():(console.error("Missing icon: "+l+o+".svg"),ie)).then(i=>(i!==ie&&(K[o]=i),i))}const y=({name:o,path:l,className:i="",...c})=>{const f="https://punkt-cdn.oslo.kommune.no/5.0/icons/",[n,_]=E.useState(null);return E.useEffect(()=>{if(!o)return;Be(o,l||f).then(h=>_(h))},[o,l,f]),n?a("span",{className:`pkt-icon ${i}`,dangerouslySetInnerHTML:{__html:n},...c}):null},Ve=E.forwardRef(({children:o,className:l,skin:i="info",closeAlert:c=!1,onClose:f,title:n,date:_,ariaLive:k="polite",...h},T)=>{const R=[l,"pkt-alert",i&&`pkt-alert--${i}`].filter(Boolean).join(" "),[j,S]=E.useState(!0),D=()=>{S(!1),f&&f()};return j?d("div",{...h,className:R,"aria-live":k,ref:T,children:[a(y,{className:"pkt-alert__icon",name:i==="info"?"alert-information":`alert-${i}`}),c&&a("div",{className:"pkt-alert__close",children:a("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:D,children:a(y,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),n&&a("div",{className:"pkt-alert__title",children:n}),a("div",{className:"pkt-alert__text",children:o}),_&&d("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",_]})]}):null}),se=E.forwardRef(({children:o,className:l,iconName:i="user",secondIconName:c="user",size:f="medium",skin:n="primary",type:_="button",variant:k="label-only",...h},T)=>{const R=[l,"pkt-btn",f&&`pkt-btn--${f}`,n&&`pkt-btn--${n}`,k&&`pkt-btn--${k}`].filter(Boolean).join(" ");return d("button",{...h,className:R,type:_,ref:T,children:[k!=="label-only"&&a(y,{className:"pkt-btn__icon",name:i}),a("span",{className:"pkt-btn__text",children:o}),k==="icons-right-and-left"&&a(y,{className:"pkt-btn__icon",name:c})]})});se.displayName="PktButton";const Ue=({columnOne:o,columnTwo:l,socialLinks:i})=>{var c,f;return a("footer",{className:"pkt-footer","data-mode":"dark",children:d("div",{className:"pkt-footer__container",children:[d("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[d("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[a("h2",{className:"pkt-footer__title",children:o.title}),d("ul",{className:"pkt-footer__list",children:[o.text&&a("li",{className:"pkt-footer__text",children:o.text}),(c=o.links)==null?void 0:c.map((n,_)=>a("li",{className:"pkt-footer__list-item",children:d("a",{className:`pkt-footer__link ${n.external?"pkt-link--external":""}`,href:n.href,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:[a(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),n.text]})},`links-${_}`))]})]}),d("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[a("h2",{className:"pkt-footer__title",children:l.title}),d("ul",{className:"pkt-footer__list",children:[l.text&&a("li",{className:"pkt-footer__text",children:l.text}),(f=l.links)==null?void 0:f.map((n,_)=>a("li",{className:"pkt-footer__list-item",children:d("a",{className:`pkt-footer__link ${n.external?"pkt-link--external":""}`,href:n.href,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:[a(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),n.text]})},`links-${_}`))]})]}),d("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[a("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),d("ul",{className:"pkt-footer__list",children:[a("li",{className:"pkt-footer__list-item",children:d("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[a(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),a("li",{className:"pkt-footer__list-item",children:d("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[a(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),i&&d("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[a("div",{className:"pkt-footer__social-languages",children:i.filter(n=>n.language).map((n,_)=>a("div",{className:"pkt-footer__social-language",children:a("a",{href:n.href,"aria-label":`til ${n.language} versjon av nettsiden`,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:n.language})},`sociallinks-language-${_}`))}),a("div",{className:"pkt-footer__social-icons",children:i.filter(n=>n.iconName).map((n,_)=>a(E.Fragment,{children:a("a",{href:n.href,"aria-label":`til ${n.iconName}`,className:"pkt-footer__social-icon-link",target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:a(y,{className:"pkt-footer__social-icon",name:n.iconName})})},`sociallinks-${_}`))})]})]})})},He=({links:o=[]})=>a("footer",{className:"pkt-footer-simple","data-mode":"dark",children:a("div",{className:"pkt-footer-simple__container",children:d("ul",{className:"pkt-footer-simple__list",children:[o.map((l,i)=>a("li",{className:"pkt-footer-simple__list-item",children:d("a",{className:`pkt-footer-simple__link ${l.external?" pkt-link--external":""}`,href:l.href,target:l.openInNewTab?"_blank":"_self",rel:l.openInNewTab?"noopener noreferrer":void 0,children:[a(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),l.text]})},i)),a("li",{className:"pkt-footer-simple__list-item",children:d("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[a(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),a("li",{className:"pkt-footer-simple__list-item",children:d("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[a(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})}),Ge=({className:o,logoLink:l="https://www.oslo.kommune.no/",isLoggedIn:i=!1,representing:c="",canChangeRepresentation:f=!1,showLogInButton:n=!0,onLogIn:_,onLogOut:k,onChangeRepresentation:h})=>{const T=[o,"pkt-header"].filter(Boolean).join(" ");return d("header",{id:"pkt-header",className:T,"aria-label":"Topp",children:[a("div",{className:"pkt-header__logo",children:a("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:l,children:a(y,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/5.0/logos/"})})}),d("div",{className:"pkt-header__actions",children:[i&&f&&d("button",{className:"pkt-btn pkt-btn--secondary pkt-btn--icon-right","aria-label":`Bytt bruker fra ${c}`,onClick:h,children:[a(y,{name:"user",className:"pkt-btn__icon pkt-show-tablet-up"}),a("span",{className:"pkt-header__action-change pkt-hide pkt-show-tablet-up ml-size-15",children:"Endre"}),a("span",{className:"pkt-btn__text pkt-hide-tablet-up",children:"Endre"}),a("span",{className:"pkt-btn__text--representing pkt-hide pkt-show-tablet-up",children:c})]}),i&&!f&&d("div",{className:"pkt-header__action",children:[a("span",{className:"pkt-header__action-text",children:a("span",{className:"pkt-btn__text pkt-header__action-textrow text-row-inline pkt-truncate-text",children:c})}),a(y,{className:"pkt-header__action-icon pkt-show-phablet-up",name:"user"})]}),n&&i&&d("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg ut",onClick:k,children:[a(y,{className:"pkt-btn__icon pkt-show-tablet-up",name:"exit"}),a("span",{className:"pkt-btn__text",children:"Logg ut"})]}),n&&!i&&d("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg inn",onClick:_,children:[a(y,{className:"pkt-btn__icon",name:"user"}),a("span",{className:"pkt-btn__text",children:"Logg inn"})]})]})]})},ce=E.forwardRef(({label:o,id:l,children:i,...c},f)=>d("div",{className:"pkt-form-group",children:[a("label",{htmlFor:l,className:"pkt-form-label",children:o}),a("input",{className:"pkt-form-input",id:l,...c,ref:f}),i]}));ce.displayName="PktInput";const ue=E.forwardRef(({children:o,className:l,iconName:i="user",openInNewTab:c=!1,skin:f="normal",href:n="#",external:_=!1,title:k},h)=>{const T=[l,"pkt-linkcard",f&&`pkt-linkcard--${f}`].filter(Boolean).join(" ");return d("a",{href:n,className:`pkt-linkcard pkt-link ${T}`,target:c?"_blank":"_self",rel:c?"noopener noreferrer":void 0,ref:h,children:[a(y,{className:"pkt-link__icon",name:i}),d("div",{className:"pkt-linkcard__content",children:[a("div",{className:`pkt-linkcard__title ${_?"pkt-link pkt-link--external":""}`,children:k}),a("div",{className:"pkt-linkcard__text",children:o})]})]})});ue.displayName="PktLinkCard";const ze=({children:o,skin:l="beige",title:i,...c})=>{const f=["pkt-messagebox",l&&`pkt-messagebox--${l}`].filter(Boolean).join(" ");return d("div",{...c,className:f,children:[a("div",{className:"pkt-messagebox__title",children:i}),a("div",{className:"pkt-messagebox__text",children:o})]})},fe=E.forwardRef(({id:o,name:l,label:i,value:c,...f},n)=>d("div",{className:"pkt-form-group",children:[a("input",{type:"radio",className:"pkt-form-check-input",id:o,name:l,value:c,ref:n,...f}),a("label",{className:"pkt-form-label",htmlFor:o,children:i})]}));fe.displayName="PktRadio";const Je=({label:o,children:l})=>d(le,{children:[a("p",{children:o}),a("div",{className:"pkt-form-group",children:l})]});var pe={exports:{}};/*!
27
+ Check the top-level render call using <`+r+">.")}return t}}function Ie(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=jt(t);if(De[r])return;De[r]=!0;var s="";e&&e._owner&&e._owner!==te.current&&(s=" It was passed a child from "+C(e._owner.type)+"."),A(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,s),A(null)}}function Ae(e,t){{if(typeof e!="object")return;if(q(e))for(var r=0;r<e.length;r++){var s=e[r];ae(s)&&Ie(s,t)}else if(ae(e))e._store&&(e._store.validated=!0);else if(e){var m=rt(e);if(typeof m=="function"&&m!==e.entries)for(var v=m.call(e),p;!(p=v.next()).done;)ae(p.value)&&Ie(p.value,t)}}}function St(e){{var t=e.type;if(t==null||typeof t=="string")return;var r;if(typeof t=="function")r=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===h||t.$$typeof===j))r=t.propTypes;else return;if(r){var s=C(t);_t(r,e.props,"prop",s,e)}else if(t.PropTypes!==void 0&&!re){re=!0;var m=C(t);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ct(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var s=t[r];if(s!=="children"&&s!=="key"){A(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",s),A(null);break}}e.ref!==null&&(A(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}function We(e,t,r,s,m,v){{var p=ct(e);if(!p){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=xt(m);P?u+=P:u+=Fe();var g;e===null?g="null":q(e)?g="array":e!==void 0&&e.$$typeof===l?(g="<"+(C(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):g=typeof e,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",g,u)}var N=Tt(e,t,r,m,v);if(N==null)return N;if(p){var x=t.children;if(x!==void 0)if(s)if(q(x)){for(var W=0;W<x.length;W++)Ae(x[W],e);Object.freeze&&Object.freeze(x)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ae(x,e)}return e===c?Ct(N):St(N),N}}function Ot(e,t,r){return We(e,t,r,!0)}function Ft(e,t,r){return We(e,t,r,!1)}var Dt=Ft,It=Ot;M.Fragment=c,M.jsx=Dt,M.jsxs=It}()),M}process.env.NODE_ENV==="production"?z.exports=$e():z.exports=Le();var J=z.exports;const le=J.Fragment,a=J.jsx,d=J.jsxs,K={},ie='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function Be(o,l){return!K[o]&&typeof fetch=="function"?fetch(l+o+".svg").then(i=>i.ok?i.text():(console.error("Missing icon: "+l+o+".svg"),ie)).then(i=>(i!==ie&&(K[o]=i),i)):Promise.resolve(K[o])}const y=({name:o,path:l,className:i="",...c})=>{const f="https://punkt-cdn.oslo.kommune.no/5.0/icons/",[n,_]=E.useState(null);return E.useEffect(()=>{if(!o)return;Be(o,l||f).then(h=>_(h))},[o,l,f]),n?a("span",{className:`pkt-icon ${i}`,dangerouslySetInnerHTML:{__html:n},...c}):null},Ve=E.forwardRef(({children:o,className:l,skin:i="info",closeAlert:c=!1,onClose:f,title:n,date:_,ariaLive:k="polite",...h},T)=>{const R=[l,"pkt-alert",i&&`pkt-alert--${i}`].filter(Boolean).join(" "),[j,S]=E.useState(!0),D=()=>{S(!1),f&&f()};return j?d("div",{...h,className:R,"aria-live":k,ref:T,children:[a(y,{className:"pkt-alert__icon",name:i==="info"?"alert-information":`alert-${i}`}),c&&a("div",{className:"pkt-alert__close",children:a("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:D,children:a(y,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),n&&a("div",{className:"pkt-alert__title",children:n}),a("div",{className:"pkt-alert__text",children:o}),_&&d("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",_]})]}):null}),se=E.forwardRef(({children:o,className:l,iconName:i="user",secondIconName:c="user",size:f="medium",skin:n="primary",type:_="button",variant:k="label-only",...h},T)=>{const R=[l,"pkt-btn",f&&`pkt-btn--${f}`,n&&`pkt-btn--${n}`,k&&`pkt-btn--${k}`].filter(Boolean).join(" ");return d("button",{...h,className:R,type:_,ref:T,children:[k!=="label-only"&&a(y,{className:"pkt-btn__icon",name:i}),a("span",{className:"pkt-btn__text",children:o}),k==="icons-right-and-left"&&a(y,{className:"pkt-btn__icon",name:c})]})});se.displayName="PktButton";const Ue=({columnOne:o,columnTwo:l,socialLinks:i})=>{var c,f;return a("footer",{className:"pkt-footer","data-mode":"dark",children:d("div",{className:"pkt-footer__container",children:[d("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[d("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[a("h2",{className:"pkt-footer__title",children:o.title}),d("ul",{className:"pkt-footer__list",children:[o.text&&a("li",{className:"pkt-footer__text",children:o.text}),(c=o.links)==null?void 0:c.map((n,_)=>a("li",{className:"pkt-footer__list-item",children:d("a",{className:`pkt-footer__link ${n.external?"pkt-link--external":""}`,href:n.href,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:[a(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),n.text]})},`links-${_}`))]})]}),d("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[a("h2",{className:"pkt-footer__title",children:l.title}),d("ul",{className:"pkt-footer__list",children:[l.text&&a("li",{className:"pkt-footer__text",children:l.text}),(f=l.links)==null?void 0:f.map((n,_)=>a("li",{className:"pkt-footer__list-item",children:d("a",{className:`pkt-footer__link ${n.external?"pkt-link--external":""}`,href:n.href,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:[a(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),n.text]})},`links-${_}`))]})]}),d("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[a("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),d("ul",{className:"pkt-footer__list",children:[a("li",{className:"pkt-footer__list-item",children:d("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[a(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),a("li",{className:"pkt-footer__list-item",children:d("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[a(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),i&&d("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[a("div",{className:"pkt-footer__social-languages",children:i.filter(n=>n.language).map((n,_)=>a("div",{className:"pkt-footer__social-language",children:a("a",{href:n.href,"aria-label":`til ${n.language} versjon av nettsiden`,target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:n.language})},`sociallinks-language-${_}`))}),a("div",{className:"pkt-footer__social-icons",children:i.filter(n=>n.iconName).map((n,_)=>a(E.Fragment,{children:a("a",{href:n.href,"aria-label":`til ${n.iconName}`,className:"pkt-footer__social-icon-link",target:n.openInNewTab?"_blank":"_self",rel:n.openInNewTab?"noopener noreferrer":void 0,children:a(y,{className:"pkt-footer__social-icon",name:n.iconName})})},`sociallinks-${_}`))})]})]})})},He=({links:o=[]})=>a("footer",{className:"pkt-footer-simple","data-mode":"dark",children:a("div",{className:"pkt-footer-simple__container",children:d("ul",{className:"pkt-footer-simple__list",children:[o.map((l,i)=>a("li",{className:"pkt-footer-simple__list-item",children:d("a",{className:`pkt-footer-simple__link ${l.external?" pkt-link--external":""}`,href:l.href,target:l.openInNewTab?"_blank":"_self",rel:l.openInNewTab?"noopener noreferrer":void 0,children:[a(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),l.text]})},i)),a("li",{className:"pkt-footer-simple__list-item",children:d("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[a(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),a("li",{className:"pkt-footer-simple__list-item",children:d("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[a(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})}),Ge=({className:o,logoLink:l="https://www.oslo.kommune.no/",isLoggedIn:i=!1,representing:c="",canChangeRepresentation:f=!1,showLogInButton:n=!0,onLogIn:_,onLogOut:k,onChangeRepresentation:h})=>{const T=[o,"pkt-header"].filter(Boolean).join(" ");return d("header",{id:"pkt-header",className:T,"aria-label":"Topp",children:[a("div",{className:"pkt-header__logo",children:a("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:l,children:a(y,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/5.0/logos/"})})}),d("div",{className:"pkt-header__actions",children:[i&&f&&d("button",{className:"pkt-btn pkt-btn--secondary pkt-btn--icon-right","aria-label":`Bytt bruker fra ${c}`,onClick:h,children:[a(y,{name:"user",className:"pkt-btn__icon pkt-show-tablet-up"}),a("span",{className:"pkt-header__action-change pkt-hide pkt-show-tablet-up ml-size-15",children:"Endre"}),a("span",{className:"pkt-btn__text pkt-hide-tablet-up",children:"Endre"}),a("span",{className:"pkt-btn__text--representing pkt-hide pkt-show-tablet-up",children:c})]}),i&&!f&&d("div",{className:"pkt-header__action",children:[a("span",{className:"pkt-header__action-text",children:a("span",{className:"pkt-btn__text pkt-header__action-textrow text-row-inline pkt-truncate-text",children:c})}),a(y,{className:"pkt-header__action-icon pkt-show-phablet-up",name:"user"})]}),n&&i&&d("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg ut",onClick:k,children:[a(y,{className:"pkt-btn__icon pkt-show-tablet-up",name:"exit"}),a("span",{className:"pkt-btn__text",children:"Logg ut"})]}),n&&!i&&d("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg inn",onClick:_,children:[a(y,{className:"pkt-btn__icon",name:"user"}),a("span",{className:"pkt-btn__text",children:"Logg inn"})]})]})]})},ce=E.forwardRef(({label:o,id:l,children:i,...c},f)=>d("div",{className:"pkt-form-group",children:[a("label",{htmlFor:l,className:"pkt-form-label",children:o}),a("input",{className:"pkt-form-input",id:l,...c,ref:f}),i]}));ce.displayName="PktInput";const ue=E.forwardRef(({children:o,className:l,iconName:i="user",openInNewTab:c=!1,skin:f="normal",href:n="#",external:_=!1,title:k},h)=>{const T=[l,"pkt-linkcard",f&&`pkt-linkcard--${f}`].filter(Boolean).join(" ");return d("a",{href:n,className:`pkt-linkcard pkt-link ${T}`,target:c?"_blank":"_self",rel:c?"noopener noreferrer":void 0,ref:h,children:[a(y,{className:"pkt-link__icon",name:i}),d("div",{className:"pkt-linkcard__content",children:[a("div",{className:`pkt-linkcard__title ${_?"pkt-link pkt-link--external":""}`,children:k}),a("div",{className:"pkt-linkcard__text",children:o})]})]})});ue.displayName="PktLinkCard";const ze=({children:o,skin:l="beige",title:i,...c})=>{const f=["pkt-messagebox",l&&`pkt-messagebox--${l}`].filter(Boolean).join(" ");return d("div",{...c,className:f,children:[a("div",{className:"pkt-messagebox__title",children:i}),a("div",{className:"pkt-messagebox__text",children:o})]})},fe=E.forwardRef(({id:o,name:l,label:i,value:c,...f},n)=>d("div",{className:"pkt-form-group",children:[a("input",{type:"radio",className:"pkt-form-check-input",id:o,name:l,value:c,ref:n,...f}),a("label",{className:"pkt-form-label",htmlFor:o,children:i})]}));fe.displayName="PktRadio";const Je=({label:o,children:l})=>d(le,{children:[a("p",{children:o}),a("div",{className:"pkt-form-group",children:l})]});var pe={exports:{}};/*!
28
28
  Copyright (c) 2018 Jed Watson.
29
29
  Licensed under the MIT License (MIT), see
30
30
  http://jedwatson.github.io/classnames
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "5.0.7",
3
+ "version": "5.0.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",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@oslokommune/punkt-assets": "^5.0.2",
35
- "@oslokommune/punkt-css": "^5.0.6",
35
+ "@oslokommune/punkt-css": "^5.0.8",
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": "762f6a293d8a27680cd0082c9c24a1401fc9df52"
93
+ "gitHead": "dcb67895bdd76e8a8c5e4c0e77f8c7fc260752e1"
94
94
  }
@@ -7,7 +7,7 @@ const errorSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></
7
7
 
8
8
  function getIcon(name: string, path: string): Promise<string> {
9
9
  // Download and cache icon if not in cache
10
- if (!iconCache[name]) {
10
+ if (!iconCache[name] && typeof fetch === 'function') {
11
11
  return fetch(path + name + '.svg')
12
12
  .then((response) => {
13
13
  if (!response.ok) {