@oslokommune/punkt-react 9.2.9 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/dist/icon/DefaultIconFetcher.d.ts +4 -0
- package/dist/icon/IconContext.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/punkt-react.es.js +164 -165
- package/dist/punkt-react.umd.js +13 -13
- package/package.json +2 -2
- package/src/components/icon/DefaultIconFetcher.tsx +37 -0
- package/src/components/icon/Icon.test.tsx +78 -0
- package/src/components/icon/Icon.tsx +9 -34
- package/src/components/icon/IconContext.tsx +9 -0
- package/src/components/index.ts +1 -0
- package/src/components/linkcard/LinkCard.tsx +2 -1
package/dist/punkt-react.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(T,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],N):(T=typeof globalThis<"u"?globalThis:T||self,N(T["punkt-react"]={},T.React))})(this,function(T,N){"use strict";function
|
|
1
|
+
(function(T,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],N):(T=typeof globalThis<"u"?globalThis:T||self,N(T["punkt-react"]={},T.React))})(this,function(T,N){"use strict";function Bt(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const b=Bt(N);function Wt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pe={exports:{}},oe={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Ke;function Vt(){if(Ke)return oe;Ke=1;var e=N,n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(p,f,c){var m,v={},w=null,C=null;c!==void 0&&(w=""+c),f.key!==void 0&&(w=""+f.key),f.ref!==void 0&&(C=f.ref);for(m in f)o.call(f,m)&&!i.hasOwnProperty(m)&&(v[m]=f[m]);if(p&&p.defaultProps)for(m in f=p.defaultProps,f)v[m]===void 0&&(v[m]=f[m]);return{$$typeof:n,type:p,key:w,ref:C,props:v,_owner:a.current}}return oe.Fragment=r,oe.jsx=s,oe.jsxs=s,oe}var ie={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Xe;function
|
|
18
|
-
`+Me+t}}var Ye=!1,Ee;{var
|
|
17
|
+
*/var Xe;function Mt(){return Xe||(Xe=1,process.env.NODE_ENV!=="production"&&function(){var e=N,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),p=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),O=Symbol.iterator,S="@@iterator";function D(t){if(t===null||typeof t!="object")return null;var u=O&&t[O]||t[S];return typeof u=="function"?u:null}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(t){{for(var u=arguments.length,d=new Array(u>1?u-1:0),k=1;k<u;k++)d[k-1]=arguments[k];$("error",t,d)}}function $(t,u,d){{var k=P.ReactDebugCurrentFrame,R=k.getStackAddendum();R!==""&&(u+="%s",d=d.concat([R]));var j=d.map(function(x){return String(x)});j.unshift("Warning: "+u),Function.prototype.apply.call(console[t],console,j)}}var U=!1,B=!1,W=!1,Y=!1,q=!1,J;J=Symbol.for("react.module.reference");function G(t){return!!(typeof t=="string"||typeof t=="function"||t===o||t===i||q||t===a||t===c||t===m||Y||t===C||U||B||W||typeof t=="object"&&t!==null&&(t.$$typeof===w||t.$$typeof===v||t.$$typeof===s||t.$$typeof===p||t.$$typeof===f||t.$$typeof===J||t.getModuleId!==void 0))}function M(t,u,d){var k=t.displayName;if(k)return k;var R=u.displayName||u.name||"";return R!==""?d+"("+R+")":d}function _(t){return t.displayName||"Context"}function I(t){if(t==null)return null;if(typeof t.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case o:return"Fragment";case r:return"Portal";case i:return"Profiler";case a:return"StrictMode";case c:return"Suspense";case m:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case p:var u=t;return _(u)+".Consumer";case s:var d=t;return _(d._context)+".Provider";case f:return M(t,t.render,"ForwardRef");case v:var k=t.displayName||null;return k!==null?k:I(t.type)||"Memo";case w:{var R=t,j=R._payload,x=R._init;try{return I(x(j))}catch{return null}}}return null}var H=Object.assign,K=0,ee,te,fe,Nt,yt,Et,wt;function xt(){}xt.__reactDisabledLog=!0;function Yn(){{if(K===0){ee=console.log,te=console.info,fe=console.warn,Nt=console.error,yt=console.group,Et=console.groupCollapsed,wt=console.groupEnd;var t={configurable:!0,enumerable:!0,value:xt,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}K++}}function Jn(){{if(K--,K===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:H({},t,{value:ee}),info:H({},t,{value:te}),warn:H({},t,{value:fe}),error:H({},t,{value:Nt}),group:H({},t,{value:yt}),groupCollapsed:H({},t,{value:Et}),groupEnd:H({},t,{value:wt})})}K<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ve=P.ReactCurrentDispatcher,Me;function ye(t,u,d){{if(Me===void 0)try{throw Error()}catch(R){var k=R.stack.trim().match(/\n( *(at )?)/);Me=k&&k[1]||""}return`
|
|
18
|
+
`+Me+t}}var Ye=!1,Ee;{var Hn=typeof WeakMap=="function"?WeakMap:Map;Ee=new Hn}function Ct(t,u){if(!t||Ye)return"";{var d=Ee.get(t);if(d!==void 0)return d}var k;Ye=!0;var R=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var j;j=Ve.current,Ve.current=null,Yn();try{if(u){var x=function(){throw Error()};if(Object.defineProperty(x.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(x,[])}catch(X){k=X}Reflect.construct(t,[],x)}else{try{x.call()}catch(X){k=X}t.call(x.prototype)}}else{try{throw Error()}catch(X){k=X}t()}}catch(X){if(X&&k&&typeof X.stack=="string"){for(var E=X.stack.split(`
|
|
19
19
|
`),V=k.stack.split(`
|
|
20
|
-
`),
|
|
21
|
-
`+E[
|
|
20
|
+
`),L=E.length-1,F=V.length-1;L>=1&&F>=0&&E[L]!==V[F];)F--;for(;L>=1&&F>=0;L--,F--)if(E[L]!==V[F]){if(L!==1||F!==1)do if(L--,F--,F<0||E[L]!==V[F]){var z=`
|
|
21
|
+
`+E[L].replace(" at new "," at ");return t.displayName&&z.includes("<anonymous>")&&(z=z.replace("<anonymous>",t.displayName)),typeof t=="function"&&Ee.set(t,z),z}while(L>=1&&F>=0);break}}}finally{Ye=!1,Ve.current=j,Jn(),Error.prepareStackTrace=R}var le=t?t.displayName||t.name:"",Ut=le?ye(le):"";return typeof t=="function"&&Ee.set(t,Ut),Ut}function zn(t,u,d){return Ct(t,!1)}function qn(t){var u=t.prototype;return!!(u&&u.isReactComponent)}function we(t,u,d){if(t==null)return"";if(typeof t=="function")return Ct(t,qn(t));if(typeof t=="string")return ye(t);switch(t){case c:return ye("Suspense");case m:return ye("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case f:return zn(t.render);case v:return we(t.type,u,d);case w:{var k=t,R=k._payload,j=k._init;try{return we(j(R),u,d)}catch{}}}return""}var xe=Object.prototype.hasOwnProperty,Pt={},Rt=P.ReactDebugCurrentFrame;function Ce(t){if(t){var u=t._owner,d=we(t.type,t._source,u?u.type:null);Rt.setExtraStackFrame(d)}else Rt.setExtraStackFrame(null)}function Gn(t,u,d,k,R){{var j=Function.call.bind(xe);for(var x in t)if(j(t,x)){var E=void 0;try{if(typeof t[x]!="function"){var V=Error((k||"React class")+": "+d+" type `"+x+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[x]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw V.name="Invariant Violation",V}E=t[x](u,x,k,d,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(L){E=L}E&&!(E instanceof Error)&&(Ce(R),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",k||"React class",d,x,typeof E),Ce(null)),E instanceof Error&&!(E.message in Pt)&&(Pt[E.message]=!0,Ce(R),g("Failed %s type: %s",d,E.message),Ce(null))}}}var Kn=Array.isArray;function Je(t){return Kn(t)}function Xn(t){{var u=typeof Symbol=="function"&&Symbol.toStringTag,d=u&&t[Symbol.toStringTag]||t.constructor.name||"Object";return d}}function Zn(t){try{return St(t),!1}catch{return!0}}function St(t){return""+t}function Ot(t){if(Zn(t))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Xn(t)),St(t)}var pe=P.ReactCurrentOwner,Qn={key:!0,ref:!0,__self:!0,__source:!0},Tt,jt,He;He={};function er(t){if(xe.call(t,"ref")){var u=Object.getOwnPropertyDescriptor(t,"ref").get;if(u&&u.isReactWarning)return!1}return t.ref!==void 0}function tr(t){if(xe.call(t,"key")){var u=Object.getOwnPropertyDescriptor(t,"key").get;if(u&&u.isReactWarning)return!1}return t.key!==void 0}function nr(t,u){if(typeof t.ref=="string"&&pe.current&&u&&pe.current.stateNode!==u){var d=I(pe.current.type);He[d]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',I(pe.current.type),t.ref),He[d]=!0)}}function rr(t,u){{var d=function(){Tt||(Tt=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",u))};d.isReactWarning=!0,Object.defineProperty(t,"key",{get:d,configurable:!0})}}function ar(t,u){{var d=function(){jt||(jt=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",u))};d.isReactWarning=!0,Object.defineProperty(t,"ref",{get:d,configurable:!0})}}var lr=function(t,u,d,k,R,j,x){var E={$$typeof:n,type:t,key:u,ref:d,props:x,_owner:j};return E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(E,"_self",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.defineProperty(E,"_source",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E};function or(t,u,d,k,R){{var j,x={},E=null,V=null;d!==void 0&&(Ot(d),E=""+d),tr(u)&&(Ot(u.key),E=""+u.key),er(u)&&(V=u.ref,nr(u,R));for(j in u)xe.call(u,j)&&!Qn.hasOwnProperty(j)&&(x[j]=u[j]);if(t&&t.defaultProps){var L=t.defaultProps;for(j in L)x[j]===void 0&&(x[j]=L[j])}if(E||V){var F=typeof t=="function"?t.displayName||t.name||"Unknown":t;E&&rr(x,F),V&&ar(x,F)}return lr(t,E,V,R,k,pe.current,x)}}var ze=P.ReactCurrentOwner,Dt=P.ReactDebugCurrentFrame;function ae(t){if(t){var u=t._owner,d=we(t.type,t._source,u?u.type:null);Dt.setExtraStackFrame(d)}else Dt.setExtraStackFrame(null)}var qe;qe=!1;function Ge(t){return typeof t=="object"&&t!==null&&t.$$typeof===n}function $t(){{if(ze.current){var t=I(ze.current.type);if(t)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+t+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+t+"`."}return""}}function ir(t){{if(t!==void 0){var u=t.fileName.replace(/^.*[\\\/]/,""),d=t.lineNumber;return`
|
|
24
24
|
|
|
25
|
-
Check your code at `+u+":"+d+"."}return""}}var
|
|
25
|
+
Check your code at `+u+":"+d+"."}return""}}var It={};function sr(t){{var u=$t();if(!u){var d=typeof t=="string"?t:t.displayName||t.name;d&&(u=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+d+">.")}return u}}function Lt(t,u){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var d=
|
|
27
|
+
Check the top-level render call using <`+d+">.")}return u}}function Lt(t,u){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var d=sr(u);if(It[d])return;It[d]=!0;var k="";t&&t._owner&&t._owner!==ze.current&&(k=" It was passed a child from "+I(t._owner.type)+"."),ae(t),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',d,k),ae(null)}}function Ft(t,u){{if(typeof t!="object")return;if(Je(t))for(var d=0;d<t.length;d++){var k=t[d];Ge(k)&&Lt(k,u)}else if(Ge(t))t._store&&(t._store.validated=!0);else if(t){var R=D(t);if(typeof R=="function"&&R!==t.entries)for(var j=R.call(t),x;!(x=j.next()).done;)Ge(x.value)&&Lt(x.value,u)}}}function cr(t){{var u=t.type;if(u==null||typeof u=="string")return;var d;if(typeof u=="function")d=u.propTypes;else if(typeof u=="object"&&(u.$$typeof===f||u.$$typeof===v))d=u.propTypes;else return;if(d){var k=I(u);Gn(d,t.props,"prop",k,t)}else if(u.PropTypes!==void 0&&!qe){qe=!0;var R=I(u);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof u.getDefaultProps=="function"&&!u.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ur(t){{for(var u=Object.keys(t.props),d=0;d<u.length;d++){var k=u[d];if(k!=="children"&&k!=="key"){ae(t),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",k),ae(null);break}}t.ref!==null&&(ae(t),g("Invalid attribute `ref` supplied to `React.Fragment`."),ae(null))}}function At(t,u,d,k,R,j){{var x=G(t);if(!x){var E="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(E+=" 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 V=ir(R);V?E+=V:E+=$t();var L;t===null?L="null":Je(t)?L="array":t!==void 0&&t.$$typeof===n?(L="<"+(I(t.type)||"Unknown")+" />",E=" Did you accidentally export a JSX literal instead of a component?"):L=typeof t,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",L,E)}var F=or(t,u,d,R,j);if(F==null)return F;if(x){var z=u.children;if(z!==void 0)if(k)if(Je(z)){for(var le=0;le<z.length;le++)Ft(z[le],t);Object.freeze&&Object.freeze(z)}else g("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 Ft(z,t)}return t===o?ur(F):cr(F),F}}function fr(t,u,d){return At(t,u,d,!0)}function pr(t,u,d){return At(t,u,d,!1)}var dr=pr,mr=fr;ie.Fragment=o,ie.jsx=dr,ie.jsxs=mr}()),ie}process.env.NODE_ENV==="production"?Pe.exports=Vt():Pe.exports=Mt();var Re=Pe.exports;const Z=Re.Fragment,l=Re.jsx,h=Re.jsxs,Se={},Yt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',Jt="https://punkt-cdn.oslo.kommune.no/9.3/icons/",Ht=(e,n)=>(!Se[e]&&typeof window.fetch=="function"&&(Se[e]=window.fetch(n+e+".svg").then(r=>r.ok?r.text():(console.error("Missing icon: "+n+e+".svg"),Yt)).then(r=>r)),Promise.resolve(Se[e])),zt={fetchIcon:async(e,n)=>Ht(e,n||Jt)},Ze=N.createContext(zt),y=({name:e,path:n,className:r="",...o})=>{const[a,i]=N.useState(null),s=N.useContext(Ze);return N.useEffect(()=>{e?s.fetchIcon(e,n).then(i):i(null)},[e,n]),a?l("span",{className:`pkt-icon ${r}`,dangerouslySetInnerHTML:{__html:a},...o}):null},Qe=N.forwardRef(({children:e,className:n,skin:r="info",closeAlert:o=!1,onClose:a,title:i,date:s,ariaLive:p="polite",slim:f=!1,...c},m)=>{const v=[n,"pkt-alert",r&&`pkt-alert--${r}`,f&&"pkt-alert--slim"].filter(Boolean).join(" "),[w,C]=N.useState(!0),O=()=>{C(!1),a&&a()};return w?h("div",{...c,className:v,"aria-live":p,ref:m,children:[l(y,{className:"pkt-alert__icon",name:r==="info"?"alert-information":`alert-${r}`}),o&&l("div",{className:"pkt-alert__close",children:l("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:O,children:l(y,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),i&&l("div",{className:"pkt-alert__title",children:i}),l("div",{className:"pkt-alert__text",children:e}),s&&h("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",s]})]}):null}),qt=N.forwardRef(({href:e,text:n,onClick:r,className:o,...a},i)=>{const s=[o,"pkt-back-link"].filter(Boolean).join(" ");return l("nav",{ref:i,className:s,"aria-label":"Gå tilbake et steg",children:h("a",{href:e||"/",className:"pkt-link pkt-link--icon-left",onClick:()=>{r&&r()},...a,children:[l(y,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left","aria-hidden":"true"}),l("span",{className:"pkt-back-link__text",children:n||"Forsiden"})]})})});/**
|
|
28
28
|
* @remix-run/router v1.7.1
|
|
29
29
|
*
|
|
30
30
|
* Copyright (c) Remix Software Inc.
|
|
@@ -33,7 +33,7 @@ Check the top-level render call using <`+d+">.")}return u}}function Lt(t,u){{if(
|
|
|
33
33
|
* LICENSE.md file in the root directory of this source tree.
|
|
34
34
|
*
|
|
35
35
|
* @license MIT
|
|
36
|
-
*/function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},Oe.apply(this,arguments)}var
|
|
36
|
+
*/function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},Oe.apply(this,arguments)}var et;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(et||(et={}));function A(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function de(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Te(e){let{pathname:n="/",search:r="",hash:o=""}=e;return r&&r!=="?"&&(n+=r.charAt(0)==="?"?r:"?"+r),o&&o!=="#"&&(n+=o.charAt(0)==="#"?o:"#"+o),n}function tt(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substr(r),e=e.substr(0,r));let o=e.indexOf("?");o>=0&&(n.search=e.substr(o),e=e.substr(0,o)),e&&(n.pathname=e)}return n}var nt;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(nt||(nt={}));function je(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,o=e.charAt(r);return o&&o!=="/"?null:e.slice(r)||"/"}function Gt(e,n){n===void 0&&(n="/");let{pathname:r,search:o="",hash:a=""}=typeof e=="string"?tt(e):e;return{pathname:r?r.startsWith("/")?r:Kt(r,n):n,search:Xt(o),hash:Zt(a)}}function Kt(e,n){let r=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function De(e,n,r,o){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+n+"` field ["+JSON.stringify(o)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function rt(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function at(e,n,r,o){o===void 0&&(o=!1);let a;typeof e=="string"?a=tt(e):(a=Oe({},e),A(!a.pathname||!a.pathname.includes("?"),De("?","pathname","search",a)),A(!a.pathname||!a.pathname.includes("#"),De("#","pathname","hash",a)),A(!a.search||!a.search.includes("#"),De("#","search","hash",a)));let i=e===""||a.pathname==="",s=i?"/":a.pathname,p;if(o||s==null)p=r;else{let v=n.length-1;if(s.startsWith("..")){let w=s.split("/");for(;w[0]==="..";)w.shift(),v-=1;a.pathname=w.join("/")}p=v>=0?n[v]:"/"}let f=Gt(a,p),c=s&&s!=="/"&&s.endsWith("/"),m=(i||s===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(c||m)&&(f.pathname+="/"),f}const $e=e=>e.join("/").replace(/\/\/+/g,"/"),Xt=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Zt=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,lt=["post","put","patch","delete"];new Set(lt);const Qt=["get",...lt];new Set(Qt);/**
|
|
37
37
|
* React Router v6.14.1
|
|
38
38
|
*
|
|
39
39
|
* Copyright (c) Remix Software Inc.
|
|
@@ -42,7 +42,7 @@ Check the top-level render call using <`+d+">.")}return u}}function Lt(t,u){{if(
|
|
|
42
42
|
* LICENSE.md file in the root directory of this source tree.
|
|
43
43
|
*
|
|
44
44
|
* @license MIT
|
|
45
|
-
*/function
|
|
45
|
+
*/function Ie(){return Ie=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},Ie.apply(this,arguments)}const me=b.createContext(null);process.env.NODE_ENV!=="production"&&(me.displayName="DataRouter");const ot=b.createContext(null);process.env.NODE_ENV!=="production"&&(ot.displayName="DataRouterState");const en=b.createContext(null);process.env.NODE_ENV!=="production"&&(en.displayName="Await");const Q=b.createContext(null);process.env.NODE_ENV!=="production"&&(Q.displayName="Navigation");const Le=b.createContext(null);process.env.NODE_ENV!=="production"&&(Le.displayName="Location");const re=b.createContext({outlet:null,matches:[],isDataRoute:!1});process.env.NODE_ENV!=="production"&&(re.displayName="Route");const tn=b.createContext(null);process.env.NODE_ENV!=="production"&&(tn.displayName="RouteError");function nn(e,n){let{relative:r}=n===void 0?{}:n;Fe()||(process.env.NODE_ENV!=="production"?A(!1,"useHref() may be used only in the context of a <Router> component."):A(!1));let{basename:o,navigator:a}=b.useContext(Q),{hash:i,pathname:s,search:p}=he(e,{relative:r}),f=s;return o!=="/"&&(f=s==="/"?o:$e([o,s])),a.createHref({pathname:f,search:p,hash:i})}function Fe(){return b.useContext(Le)!=null}function se(){return Fe()||(process.env.NODE_ENV!=="production"?A(!1,"useLocation() may be used only in the context of a <Router> component."):A(!1)),b.useContext(Le).location}const it="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function st(e){b.useContext(Q).static||b.useLayoutEffect(e)}function rn(){let{isDataRoute:e}=b.useContext(re);return e?cn():an()}function an(){Fe()||(process.env.NODE_ENV!=="production"?A(!1,"useNavigate() may be used only in the context of a <Router> component."):A(!1));let e=b.useContext(me),{basename:n,navigator:r}=b.useContext(Q),{matches:o}=b.useContext(re),{pathname:a}=se(),i=JSON.stringify(rt(o).map(f=>f.pathnameBase)),s=b.useRef(!1);return st(()=>{s.current=!0}),b.useCallback(function(f,c){if(c===void 0&&(c={}),process.env.NODE_ENV!=="production"&&de(s.current,it),!s.current)return;if(typeof f=="number"){r.go(f);return}let m=at(f,JSON.parse(i),a,c.relative==="path");e==null&&n!=="/"&&(m.pathname=m.pathname==="/"?n:$e([n,m.pathname])),(c.replace?r.replace:r.push)(m,c.state,c)},[n,r,i,a,e])}function he(e,n){let{relative:r}=n===void 0?{}:n,{matches:o}=b.useContext(re),{pathname:a}=se(),i=JSON.stringify(rt(o).map(s=>s.pathnameBase));return b.useMemo(()=>at(e,JSON.parse(i),a,r==="path"),[e,i,a,r])}var Ae;(function(e){e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate"})(Ae||(Ae={}));var ke;(function(e){e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId"})(ke||(ke={}));function ct(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function ln(e){let n=b.useContext(me);return n||(process.env.NODE_ENV!=="production"?A(!1,ct(e)):A(!1)),n}function on(e){let n=b.useContext(re);return n||(process.env.NODE_ENV!=="production"?A(!1,ct(e)):A(!1)),n}function ut(e){let n=on(e),r=n.matches[n.matches.length-1];return r.route.id||(process.env.NODE_ENV!=="production"?A(!1,e+' can only be used on routes that contain a unique "id"'):A(!1)),r.route.id}function sn(){return ut(ke.UseRouteId)}function cn(){let{router:e}=ln(Ae.UseNavigateStable),n=ut(ke.UseNavigateStable),r=b.useRef(!1);return st(()=>{r.current=!0}),b.useCallback(function(a,i){i===void 0&&(i={}),process.env.NODE_ENV!=="production"&&de(r.current,it),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Ie({fromRouteId:n},i)))},[e,n])}var ft;(function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"})(ft||(ft={})),new Promise(()=>{});/**
|
|
46
46
|
* React Router DOM v6.14.1
|
|
47
47
|
*
|
|
48
48
|
* Copyright (c) Remix Software Inc.
|
|
@@ -51,8 +51,8 @@ Check the top-level render call using <`+d+">.")}return u}}function Lt(t,u){{if(
|
|
|
51
51
|
* LICENSE.md file in the root directory of this source tree.
|
|
52
52
|
*
|
|
53
53
|
* @license MIT
|
|
54
|
-
*/function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},ne.apply(this,arguments)}function Ue(e,n){if(e==null)return{};var r={},o=Object.keys(e),a,i;for(i=0;i<o.length;i++)a=o[i],!(n.indexOf(a)>=0)&&(r[a]=e[a]);return r}const ve="get",_e="application/x-www-form-urlencoded";function be(e){return e!=null&&typeof e.tagName=="string"}function on(e){return be(e)&&e.tagName.toLowerCase()==="button"}function sn(e){return be(e)&&e.tagName.toLowerCase()==="form"}function cn(e){return be(e)&&e.tagName.toLowerCase()==="input"}function un(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fn(e,n){return e.button===0&&(!n||n==="_self")&&!un(e)}let ge=null;function pn(){if(ge===null)try{new FormData(document.createElement("form"),0),ge=!1}catch{ge=!0}return ge}const dn=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Be(e){return e!=null&&!dn.has(e)?(process.env.NODE_ENV!=="production"&&de(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+_e+'"')),null):e}function mn(e,n){let r,o,a,i,s;if(sn(e)){let p=e.getAttribute("action");o=p?je(p,n):null,r=e.getAttribute("method")||ve,a=Be(e.getAttribute("enctype"))||_e,i=new FormData(e)}else if(on(e)||cn(e)&&(e.type==="submit"||e.type==="image")){let p=e.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||p.getAttribute("action");if(o=f?je(f,n):null,r=e.getAttribute("formmethod")||p.getAttribute("method")||ve,a=Be(e.getAttribute("formenctype"))||Be(p.getAttribute("enctype"))||_e,i=new FormData(p,e),!pn()){let{name:c,type:h,value:v}=e;if(h==="image"){let w=c?c+".":"";i.append(w+"x","0"),i.append(w+"y","0")}else c&&i.append(c,v)}}else{if(be(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ve,o=null,a=_e,s=e}return i&&a==="text/plain"&&(s=i,i=void 0),{action:o,method:r.toLowerCase(),encType:a,formData:i,body:s}}const hn=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],kn=["aria-current","caseSensitive","className","end","style","to","children"],vn=["reloadDocument","replace","method","action","onSubmit","submit","relative","preventScrollReset"];process.env.NODE_ENV;const _n=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",bn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ne=b.forwardRef(function(n,r){let{onClick:o,relative:a,reloadDocument:i,replace:s,state:p,target:f,to:c,preventScrollReset:h}=n,v=Ue(n,hn),{basename:w}=b.useContext(Q),C,O=!1;if(typeof c=="string"&&bn.test(c)&&(C=c,_n))try{let g=new URL(window.location.href),$=c.startsWith("//")?new URL(g.protocol+c):new URL(c),U=je($.pathname,w);$.origin===g.origin&&U!=null?c=U+$.search+$.hash:O=!0}catch{process.env.NODE_ENV!=="production"&&de(!1,'<Link to="'+c+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let S=Qt(c,{relative:a}),D=wn(c,{replace:s,state:p,target:f,preventScrollReset:h,relative:a});function P(g){o&&o(g),g.defaultPrevented||D(g)}return b.createElement("a",ne({},v,{href:C||S,onClick:O||i?o:P,ref:r,target:f}))});process.env.NODE_ENV!=="production"&&(Ne.displayName="Link");const gn=b.forwardRef(function(n,r){let{"aria-current":o="page",caseSensitive:a=!1,className:i="",end:s=!1,style:p,to:f,children:c}=n,h=Ue(n,kn),v=he(f,{relative:h.relative}),w=se(),C=b.useContext(lt),{navigator:O}=b.useContext(Q),S=O.encodeLocation?O.encodeLocation(v).pathname:v.pathname,D=w.pathname,P=C&&C.navigation&&C.navigation.location?C.navigation.location.pathname:null;a||(D=D.toLowerCase(),P=P?P.toLowerCase():null,S=S.toLowerCase());let g=D===S||!s&&D.startsWith(S)&&D.charAt(S.length)==="/",$=P!=null&&(P===S||!s&&P.startsWith(S)&&P.charAt(S.length)==="/"),U=g?o:void 0,B;typeof i=="function"?B=i({isActive:g,isPending:$}):B=[i,g?"active":null,$?"pending":null].filter(Boolean).join(" ");let W=typeof p=="function"?p({isActive:g,isPending:$}):p;return b.createElement(Ne,ne({},h,{"aria-current":U,className:B,ref:r,style:W,to:f}),typeof c=="function"?c({isActive:g,isPending:$}):c)});process.env.NODE_ENV!=="production"&&(gn.displayName="NavLink");const Nn=b.forwardRef((e,n)=>{let r=Cn();return b.createElement(ft,ne({},e,{submit:r,ref:n}))});process.env.NODE_ENV!=="production"&&(Nn.displayName="Form");const ft=b.forwardRef((e,n)=>{let{reloadDocument:r,replace:o,method:a=ve,action:i,onSubmit:s,submit:p,relative:f,preventScrollReset:c}=e,h=Ue(e,vn),v=a.toLowerCase()==="get"?"get":"post",w=Pn(i,{relative:f}),C=O=>{if(s&&s(O),O.defaultPrevented)return;O.preventDefault();let S=O.nativeEvent.submitter,D=(S==null?void 0:S.getAttribute("formmethod"))||a;p(S||O.currentTarget,{method:D,replace:o,relative:f,preventScrollReset:c})};return b.createElement("form",ne({ref:n,method:v,action:w,onSubmit:r?s:C},h))});process.env.NODE_ENV!=="production"&&(ft.displayName="FormImpl"),process.env.NODE_ENV;var We;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher"})(We||(We={}));var pt;(function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(pt||(pt={}));function yn(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function En(e){let n=b.useContext(me);return n||(process.env.NODE_ENV!=="production"?A(!1,yn(e)):A(!1)),n}function wn(e,n){let{target:r,replace:o,state:a,preventScrollReset:i,relative:s}=n===void 0?{}:n,p=en(),f=se(),c=he(e,{relative:s});return b.useCallback(h=>{if(fn(h,r)){h.preventDefault();let v=o!==void 0?o:Te(f)===Te(c);p(e,{replace:v,state:a,preventScrollReset:i,relative:s})}},[f,p,c,o,a,r,e,i,s])}function xn(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}function Cn(){let{router:e}=En(We.UseSubmit),{basename:n}=b.useContext(Q),r=an();return b.useCallback(function(o,a){a===void 0&&(a={}),xn();let{action:i,method:s,encType:p,formData:f,body:c}=mn(o,n);e.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:f,body:c,formMethod:a.method||s,formEncType:a.encType||p,replace:a.replace,fromRouteId:r})},[e,n,r])}function Pn(e,n){let{relative:r}=n===void 0?{}:n,{basename:o}=b.useContext(Q),a=b.useContext(re);a||(process.env.NODE_ENV!=="production"?A(!1,"useFormAction must be used inside a RouteContext"):A(!1));let[i]=a.matches.slice(-1),s=ne({},he(e||".",{relative:r})),p=se();if(e==null&&(s.search=p.search,s.hash=p.hash,i.route.index)){let f=new URLSearchParams(s.search);f.delete("index"),s.search=f.toString()?"?"+f.toString():""}return(!e||e===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(s.pathname=s.pathname==="/"?o:$e([o,s.pathname])),Te(s)}const Rn=N.forwardRef(({breadcrumbs:e,navigationType:n,className:r,...o},a)=>{const i=e.slice(0,4),s=i[i.length-2],p=[r,"pkt-breadcrumbs"].filter(Boolean).join(" ");return m("nav",{ref:a,"aria-label":"brødsmulemeny",className:p,children:[l("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:i.map((f,c)=>l("li",{className:"pkt-breadcrumbs__item",children:c===i.length-1?l("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:l("span",{className:"pkt-breadcrumbs__text",children:f.text})}):n==="router"?m(Ne,{to:f.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...o,children:[l(y,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),l("span",{className:"pkt-breadcrumbs__text",children:f.text})]}):m("a",{href:f.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...o,children:[l(y,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),l("span",{className:"pkt-breadcrumbs__text",children:f.text})]})},`breadcrumb-${c}`))}),n==="router"?m(Ne,{to:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...o,children:[l(y,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),l("span",{className:"pkt-breadcrumbs__text",children:s.text})]}):m("a",{href:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...o,children:[l(y,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),l("span",{className:"pkt-breadcrumbs__text",children:s.text})]})]})}),ce=N.forwardRef(({children:e,className:n,iconName:r="user",secondIconName:o="user",size:a="medium",skin:i="primary",type:s="button",variant:p="label-only",color:f,...c},h)=>{const v=[n,"pkt-btn",a&&`pkt-btn--${a}`,i&&`pkt-btn--${i}`,p&&`pkt-btn--${p}`,f&&`pkt-btn--${f}`].filter(Boolean).join(" ");return m("button",{...c,className:v,type:s,ref:h,children:[p!=="label-only"&&l(y,{className:"pkt-btn__icon",name:r}),l("span",{className:"pkt-btn__text",children:e}),p==="icons-right-and-left"&&l(y,{className:"pkt-btn__icon",name:o})]})});ce.displayName="PktButton";const dt=N.forwardRef(({id:e,hasTile:n=!1,disabled:r=!1,label:o,checkHelptext:a,hasError:i=!1,className:s,...p},f)=>{const c=[s,"pkt-input-check"].filter(Boolean).join(" ");return l("div",{className:c,children:m("div",{className:`pkt-input-check__input ${n?"pkt-input-check__input--tile":""}`,children:[l("input",{ref:f,className:`pkt-input-check__input-checkbox ${i?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",id:e,disabled:r,...p}),m("label",{className:"pkt-input-check__input-label",htmlFor:e,children:[o,a&&l("div",{className:"pkt-input-check__input-helptext",children:a})]})]})})});dt.displayName="PktCheckbox";const Sn=({columnOne:e,columnTwo:n,socialLinks:r,className:o,personvernOgInfoLink:a="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:i="https://www.oslo.kommune.no/tilgjengelighet/"})=>{var p,f;const s=[o,"pkt-footer"].filter(Boolean).join(" ");return l("footer",{className:s,"data-mode":"dark",children:m("div",{className:"pkt-footer__container",children:[m("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[m("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[l("h2",{className:"pkt-footer__title",children:e.title}),m("ul",{className:"pkt-footer__list",children:[e.text&&l("li",{className:"pkt-footer__text",children:e.text}),(p=e.links)==null?void 0:p.map((c,h)=>l("li",{className:"pkt-footer__list-item",children:m("a",{className:`pkt-footer__link ${c.external?"pkt-link--external":""}`,href:c.href,target:c.openInNewTab?"_blank":"_self",rel:c.openInNewTab?"noopener noreferrer":void 0,children:[l(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),c.text]})},`links-${h}`))]})]}),m("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[l("h2",{className:"pkt-footer__title",children:n.title}),m("ul",{className:"pkt-footer__list",children:[n.text&&l("li",{className:"pkt-footer__text",children:n.text}),(f=n.links)==null?void 0:f.map((c,h)=>l("li",{className:"pkt-footer__list-item",children:m("a",{className:`pkt-footer__link ${c.external?"pkt-link--external":""}`,href:c.href,target:c.openInNewTab?"_blank":"_self",rel:c.openInNewTab?"noopener noreferrer":void 0,children:[l(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),c.text]})},`links-${h}`))]})]}),m("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[l("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),m("ul",{className:"pkt-footer__list",children:[l("li",{className:"pkt-footer__list-item",children:m("a",{className:"pkt-footer__link",href:a,children:[l(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),l("li",{className:"pkt-footer__list-item",children:m("a",{className:"pkt-footer__link",href:i,children:[l(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),r&&m("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[l("div",{className:"pkt-footer__social-languages",children:r.filter(c=>c.language).map((c,h)=>l("div",{className:"pkt-footer__social-language",children:l("a",{href:c.href,"aria-label":`til ${c.language} versjon av nettsiden`,target:c.openInNewTab?"_blank":"_self",rel:c.openInNewTab?"noopener noreferrer":void 0,children:c.language})},`sociallinks-language-${h}`))}),l("div",{className:"pkt-footer__social-icons",children:r.filter(c=>c.iconName).map((c,h)=>l(N.Fragment,{children:l("a",{href:c.href,"aria-label":`til ${c.iconName}`,className:"pkt-footer__social-icon-link",target:c.openInNewTab?"_blank":"_self",rel:c.openInNewTab?"noopener noreferrer":void 0,children:l(y,{className:"pkt-footer__social-icon",name:c.iconName})})},`sociallinks-${h}`))})]})]})})},On=({links:e=[],personvernOgInfoLink:n="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:r="https://www.oslo.kommune.no/tilgjengelighet/",className:o})=>{const a=[o,"pkt-footer-simple"].filter(Boolean).join(" ");return l("footer",{className:a,"data-mode":"dark",children:l("div",{className:"pkt-footer-simple__container",children:m("ul",{className:"pkt-footer-simple__list",children:[e.map((i,s)=>l("li",{className:"pkt-footer-simple__list-item",children:m("a",{className:`pkt-footer-simple__link ${i.external?" pkt-link--external":""}`,href:i.href,target:i.openInNewTab?"_blank":"_self",rel:i.openInNewTab?"noopener noreferrer":void 0,children:[l(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),i.text]})},s)),l("li",{className:"pkt-footer-simple__list-item",children:m("a",{className:"pkt-footer-simple__link",href:n,children:[l(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),l("li",{className:"pkt-footer-simple__list-item",children:m("a",{className:"pkt-footer-simple__link",href:r,children:[l(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})})};var mt={exports:{}};/*!
|
|
54
|
+
*/function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},ne.apply(this,arguments)}function Ue(e,n){if(e==null)return{};var r={},o=Object.keys(e),a,i;for(i=0;i<o.length;i++)a=o[i],!(n.indexOf(a)>=0)&&(r[a]=e[a]);return r}const ve="get",_e="application/x-www-form-urlencoded";function be(e){return e!=null&&typeof e.tagName=="string"}function un(e){return be(e)&&e.tagName.toLowerCase()==="button"}function fn(e){return be(e)&&e.tagName.toLowerCase()==="form"}function pn(e){return be(e)&&e.tagName.toLowerCase()==="input"}function dn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function mn(e,n){return e.button===0&&(!n||n==="_self")&&!dn(e)}let ge=null;function hn(){if(ge===null)try{new FormData(document.createElement("form"),0),ge=!1}catch{ge=!0}return ge}const kn=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Be(e){return e!=null&&!kn.has(e)?(process.env.NODE_ENV!=="production"&&de(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+_e+'"')),null):e}function vn(e,n){let r,o,a,i,s;if(fn(e)){let p=e.getAttribute("action");o=p?je(p,n):null,r=e.getAttribute("method")||ve,a=Be(e.getAttribute("enctype"))||_e,i=new FormData(e)}else if(un(e)||pn(e)&&(e.type==="submit"||e.type==="image")){let p=e.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||p.getAttribute("action");if(o=f?je(f,n):null,r=e.getAttribute("formmethod")||p.getAttribute("method")||ve,a=Be(e.getAttribute("formenctype"))||Be(p.getAttribute("enctype"))||_e,i=new FormData(p,e),!hn()){let{name:c,type:m,value:v}=e;if(m==="image"){let w=c?c+".":"";i.append(w+"x","0"),i.append(w+"y","0")}else c&&i.append(c,v)}}else{if(be(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ve,o=null,a=_e,s=e}return i&&a==="text/plain"&&(s=i,i=void 0),{action:o,method:r.toLowerCase(),encType:a,formData:i,body:s}}const _n=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],bn=["aria-current","caseSensitive","className","end","style","to","children"],gn=["reloadDocument","replace","method","action","onSubmit","submit","relative","preventScrollReset"];process.env.NODE_ENV;const Nn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",yn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ne=b.forwardRef(function(n,r){let{onClick:o,relative:a,reloadDocument:i,replace:s,state:p,target:f,to:c,preventScrollReset:m}=n,v=Ue(n,_n),{basename:w}=b.useContext(Q),C,O=!1;if(typeof c=="string"&&yn.test(c)&&(C=c,Nn))try{let g=new URL(window.location.href),$=c.startsWith("//")?new URL(g.protocol+c):new URL(c),U=je($.pathname,w);$.origin===g.origin&&U!=null?c=U+$.search+$.hash:O=!0}catch{process.env.NODE_ENV!=="production"&&de(!1,'<Link to="'+c+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let S=nn(c,{relative:a}),D=Pn(c,{replace:s,state:p,target:f,preventScrollReset:m,relative:a});function P(g){o&&o(g),g.defaultPrevented||D(g)}return b.createElement("a",ne({},v,{href:C||S,onClick:O||i?o:P,ref:r,target:f}))});process.env.NODE_ENV!=="production"&&(Ne.displayName="Link");const En=b.forwardRef(function(n,r){let{"aria-current":o="page",caseSensitive:a=!1,className:i="",end:s=!1,style:p,to:f,children:c}=n,m=Ue(n,bn),v=he(f,{relative:m.relative}),w=se(),C=b.useContext(ot),{navigator:O}=b.useContext(Q),S=O.encodeLocation?O.encodeLocation(v).pathname:v.pathname,D=w.pathname,P=C&&C.navigation&&C.navigation.location?C.navigation.location.pathname:null;a||(D=D.toLowerCase(),P=P?P.toLowerCase():null,S=S.toLowerCase());let g=D===S||!s&&D.startsWith(S)&&D.charAt(S.length)==="/",$=P!=null&&(P===S||!s&&P.startsWith(S)&&P.charAt(S.length)==="/"),U=g?o:void 0,B;typeof i=="function"?B=i({isActive:g,isPending:$}):B=[i,g?"active":null,$?"pending":null].filter(Boolean).join(" ");let W=typeof p=="function"?p({isActive:g,isPending:$}):p;return b.createElement(Ne,ne({},m,{"aria-current":U,className:B,ref:r,style:W,to:f}),typeof c=="function"?c({isActive:g,isPending:$}):c)});process.env.NODE_ENV!=="production"&&(En.displayName="NavLink");const wn=b.forwardRef((e,n)=>{let r=Sn();return b.createElement(pt,ne({},e,{submit:r,ref:n}))});process.env.NODE_ENV!=="production"&&(wn.displayName="Form");const pt=b.forwardRef((e,n)=>{let{reloadDocument:r,replace:o,method:a=ve,action:i,onSubmit:s,submit:p,relative:f,preventScrollReset:c}=e,m=Ue(e,gn),v=a.toLowerCase()==="get"?"get":"post",w=On(i,{relative:f}),C=O=>{if(s&&s(O),O.defaultPrevented)return;O.preventDefault();let S=O.nativeEvent.submitter,D=(S==null?void 0:S.getAttribute("formmethod"))||a;p(S||O.currentTarget,{method:D,replace:o,relative:f,preventScrollReset:c})};return b.createElement("form",ne({ref:n,method:v,action:w,onSubmit:r?s:C},m))});process.env.NODE_ENV!=="production"&&(pt.displayName="FormImpl"),process.env.NODE_ENV;var We;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher"})(We||(We={}));var dt;(function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(dt||(dt={}));function xn(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function Cn(e){let n=b.useContext(me);return n||(process.env.NODE_ENV!=="production"?A(!1,xn(e)):A(!1)),n}function Pn(e,n){let{target:r,replace:o,state:a,preventScrollReset:i,relative:s}=n===void 0?{}:n,p=rn(),f=se(),c=he(e,{relative:s});return b.useCallback(m=>{if(mn(m,r)){m.preventDefault();let v=o!==void 0?o:Te(f)===Te(c);p(e,{replace:v,state:a,preventScrollReset:i,relative:s})}},[f,p,c,o,a,r,e,i,s])}function Rn(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}function Sn(){let{router:e}=Cn(We.UseSubmit),{basename:n}=b.useContext(Q),r=sn();return b.useCallback(function(o,a){a===void 0&&(a={}),Rn();let{action:i,method:s,encType:p,formData:f,body:c}=vn(o,n);e.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:f,body:c,formMethod:a.method||s,formEncType:a.encType||p,replace:a.replace,fromRouteId:r})},[e,n,r])}function On(e,n){let{relative:r}=n===void 0?{}:n,{basename:o}=b.useContext(Q),a=b.useContext(re);a||(process.env.NODE_ENV!=="production"?A(!1,"useFormAction must be used inside a RouteContext"):A(!1));let[i]=a.matches.slice(-1),s=ne({},he(e||".",{relative:r})),p=se();if(e==null&&(s.search=p.search,s.hash=p.hash,i.route.index)){let f=new URLSearchParams(s.search);f.delete("index"),s.search=f.toString()?"?"+f.toString():""}return(!e||e===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(s.pathname=s.pathname==="/"?o:$e([o,s.pathname])),Te(s)}const Tn=N.forwardRef(({breadcrumbs:e,navigationType:n,className:r,...o},a)=>{const i=e.slice(0,4),s=i[i.length-2],p=[r,"pkt-breadcrumbs"].filter(Boolean).join(" ");return h("nav",{ref:a,"aria-label":"brødsmulemeny",className:p,children:[l("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:i.map((f,c)=>l("li",{className:"pkt-breadcrumbs__item",children:c===i.length-1?l("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:l("span",{className:"pkt-breadcrumbs__text",children:f.text})}):n==="router"?h(Ne,{to:f.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...o,children:[l(y,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),l("span",{className:"pkt-breadcrumbs__text",children:f.text})]}):h("a",{href:f.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...o,children:[l(y,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),l("span",{className:"pkt-breadcrumbs__text",children:f.text})]})},`breadcrumb-${c}`))}),n==="router"?h(Ne,{to:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...o,children:[l(y,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),l("span",{className:"pkt-breadcrumbs__text",children:s.text})]}):h("a",{href:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...o,children:[l(y,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),l("span",{className:"pkt-breadcrumbs__text",children:s.text})]})]})}),ce=N.forwardRef(({children:e,className:n,iconName:r="user",secondIconName:o="user",size:a="medium",skin:i="primary",type:s="button",variant:p="label-only",color:f,...c},m)=>{const v=[n,"pkt-btn",a&&`pkt-btn--${a}`,i&&`pkt-btn--${i}`,p&&`pkt-btn--${p}`,f&&`pkt-btn--${f}`].filter(Boolean).join(" ");return h("button",{...c,className:v,type:s,ref:m,children:[p!=="label-only"&&l(y,{className:"pkt-btn__icon",name:r}),l("span",{className:"pkt-btn__text",children:e}),p==="icons-right-and-left"&&l(y,{className:"pkt-btn__icon",name:o})]})});ce.displayName="PktButton";const mt=N.forwardRef(({id:e,hasTile:n=!1,disabled:r=!1,label:o,checkHelptext:a,hasError:i=!1,className:s,...p},f)=>{const c=[s,"pkt-input-check"].filter(Boolean).join(" ");return l("div",{className:c,children:h("div",{className:`pkt-input-check__input ${n?"pkt-input-check__input--tile":""}`,children:[l("input",{ref:f,className:`pkt-input-check__input-checkbox ${i?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",id:e,disabled:r,...p}),h("label",{className:"pkt-input-check__input-label",htmlFor:e,children:[o,a&&l("div",{className:"pkt-input-check__input-helptext",children:a})]})]})})});mt.displayName="PktCheckbox";const jn=({columnOne:e,columnTwo:n,socialLinks:r,className:o,personvernOgInfoLink:a="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:i="https://www.oslo.kommune.no/tilgjengelighet/"})=>{var p,f;const s=[o,"pkt-footer"].filter(Boolean).join(" ");return l("footer",{className:s,"data-mode":"dark",children:h("div",{className:"pkt-footer__container",children:[h("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[h("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[l("h2",{className:"pkt-footer__title",children:e.title}),h("ul",{className:"pkt-footer__list",children:[e.text&&l("li",{className:"pkt-footer__text",children:e.text}),(p=e.links)==null?void 0:p.map((c,m)=>l("li",{className:"pkt-footer__list-item",children:h("a",{className:`pkt-footer__link ${c.external?"pkt-link--external":""}`,href:c.href,target:c.openInNewTab?"_blank":"_self",rel:c.openInNewTab?"noopener noreferrer":void 0,children:[l(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),c.text]})},`links-${m}`))]})]}),h("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[l("h2",{className:"pkt-footer__title",children:n.title}),h("ul",{className:"pkt-footer__list",children:[n.text&&l("li",{className:"pkt-footer__text",children:n.text}),(f=n.links)==null?void 0:f.map((c,m)=>l("li",{className:"pkt-footer__list-item",children:h("a",{className:`pkt-footer__link ${c.external?"pkt-link--external":""}`,href:c.href,target:c.openInNewTab?"_blank":"_self",rel:c.openInNewTab?"noopener noreferrer":void 0,children:[l(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),c.text]})},`links-${m}`))]})]}),h("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[l("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),h("ul",{className:"pkt-footer__list",children:[l("li",{className:"pkt-footer__list-item",children:h("a",{className:"pkt-footer__link",href:a,children:[l(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),l("li",{className:"pkt-footer__list-item",children:h("a",{className:"pkt-footer__link",href:i,children:[l(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),r&&h("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[l("div",{className:"pkt-footer__social-languages",children:r.filter(c=>c.language).map((c,m)=>l("div",{className:"pkt-footer__social-language",children:l("a",{href:c.href,"aria-label":`til ${c.language} versjon av nettsiden`,target:c.openInNewTab?"_blank":"_self",rel:c.openInNewTab?"noopener noreferrer":void 0,children:c.language})},`sociallinks-language-${m}`))}),l("div",{className:"pkt-footer__social-icons",children:r.filter(c=>c.iconName).map((c,m)=>l(N.Fragment,{children:l("a",{href:c.href,"aria-label":`til ${c.iconName}`,className:"pkt-footer__social-icon-link",target:c.openInNewTab?"_blank":"_self",rel:c.openInNewTab?"noopener noreferrer":void 0,children:l(y,{className:"pkt-footer__social-icon",name:c.iconName})})},`sociallinks-${m}`))})]})]})})},Dn=({links:e=[],personvernOgInfoLink:n="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:r="https://www.oslo.kommune.no/tilgjengelighet/",className:o})=>{const a=[o,"pkt-footer-simple"].filter(Boolean).join(" ");return l("footer",{className:a,"data-mode":"dark",children:l("div",{className:"pkt-footer-simple__container",children:h("ul",{className:"pkt-footer-simple__list",children:[e.map((i,s)=>l("li",{className:"pkt-footer-simple__list-item",children:h("a",{className:`pkt-footer-simple__link ${i.external?" pkt-link--external":""}`,href:i.href,target:i.openInNewTab?"_blank":"_self",rel:i.openInNewTab?"noopener noreferrer":void 0,children:[l(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),i.text]})},s)),l("li",{className:"pkt-footer-simple__list-item",children:h("a",{className:"pkt-footer-simple__link",href:n,children:[l(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),l("li",{className:"pkt-footer-simple__list-item",children:h("a",{className:"pkt-footer-simple__link",href:r,children:[l(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})})};var ht={exports:{}};/*!
|
|
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:[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"})});
|
|
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})()})(ht);var $n=ht.exports;const kt=Wt($n),In=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:m=!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",G),window.addEventListener("scroll",M),()=>{document.removeEventListener("mouseup",G),window.removeEventListener("scroll",M)}));const J=()=>{Y(!W)},G=_=>{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 h("header",{...S,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:kt("pkt-header",{"pkt-header--fixed":r,"pkt-header--scroll-to-hide":o,"pkt-header--hidden":g}),ref:D,children:[h("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.3/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.3/logos/"})}),l("span",{className:"pkt-header__logo-service",children:n})]}),l("nav",{className:"pkt-header__actions",children:h("ul",{className:"pkt-header__actions-row",children:[m&&l("li",{children:l(ce,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:w,children:"Meny"})}),(a||s)&&h("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${W&&!g?"pkt-header--open-dropdown":""}`,ref:q,children:[h("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"})]}),h("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[a&&h("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&&h("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((_,I)=>l("li",{children:typeof _.target=="string"?h("a",{href:_.target,className:"pkt-link",children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]}):h("button",{className:"pkt-link-button pkt-link",onClick:_.target,children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]})},`userMenu-${I}`))})}),(s||c)&&h("li",{children:[s&&h(Z,{children:[l("div",{className:"pkt-user-menu__label",children:"Representerer"}),l("div",{className:"pkt-user-menu__name",children:s.name}),s.orgNumber&&h("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:h("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)&&h(Z,{children:[p==null?void 0:p.map((_,I)=>l("li",{children:typeof _.target=="string"?h("a",{href:_.target,className:"pkt-link",children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]}):h("button",{className:"pkt-link-button pkt-link",onClick:_.target,children:[_.iconName&&l(y,{name:_.iconName,className:"pkt-link__icon"}),_.title]})},`userOptions-${I}`)),!v&&l("li",{children:h("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((_,I)=>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-${I}`))})})]})]}),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"})})]})})]})}),vt=N.forwardRef(({label:e,id:n,children:r,...o},a)=>h("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]}));vt.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:m,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":"",G=c?"pkt-inputwrapper--error":"",M=!!o&&o!=="",_=a||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',I=P?"fieldset":M?"div":"label",H=P?"legend":M?"h2":"span",K=C||(r?`${e}-helptext`:void 0);return h("div",{className:["pkt-inputwrapper",D,q,J,G].join(" "),ref:g,children:[O?l(Z,{children:h(I,{htmlFor:e,"aria-describedby":M?void 0:C,className:`pkt-inputwrapper__label${P?" pkt-inputwrapper__fieldset":""}`,children:[h(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!==""&&h("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":K,children:n})]}),l(Z,{children:S})]})}):h(Z,{children:[l("label",{htmlFor:e,className:"pkt-sr-only","aria-describedby":K,id:`${e}-label`,children:n}),S]}),c&&m&&l("div",{children:l(Qe,{skin:"error","aria-live":"assertive",id:`${e}-error`,slim:!0,children:m})})]})});ue.displayName="PktInputWrapper";const _t=N.forwardRef(({children:e,className:n,iconName:r="user",openInNewTab:o=!1,skin:a="normal",href:i="#",external:s=!1,title:p,...f},c)=>{const m=[n,"pkt-linkcard",a&&`pkt-linkcard--${a}`].filter(Boolean).join(" ");return h("a",{...f,href:i,className:`pkt-linkcard pkt-link ${m}`,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,ref:c,children:[l(y,{className:"pkt-link__icon",name:r}),h("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})]})]})});_t.displayName="PktLinkCard";const Ln=({children:e,skin:n="beige",title:r,className:o,...a})=>{const i=["pkt-messagebox",n&&`pkt-messagebox--${n}`,o].filter(Boolean).join(" ");return h("div",{...a,className:i,children:[r&&l("div",{className:"pkt-messagebox__title",children:r}),l("div",{className:"pkt-messagebox__text",children:e})]})},bt=N.forwardRef(({id:e,name:n,label:r,className:o,hasTile:a=!1,disabled:i=!1,checkHelptext:s,hasError:p=!1,...f},c)=>{const m=[o,"pkt-input-check"].filter(Boolean).join(" ");return l("div",{className:m,children:h("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}),h("label",{className:"pkt-input-check__input-label",htmlFor:e,children:[r,s&&l("div",{className:"pkt-input-check__input-helptext",children:s})]})]})})});bt.displayName="PktRadioButton";const Fn=N.forwardRef(({ariaDescribedby:e,ariaLabelledby:n,children:r,className:o,disabled:a=!1,errorMessage:i,hasError:s,helptext:p,helptextDropdown:f,helptextDropdownButton:c,id:m,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:m,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":`${m}-error`,"aria-labelledby":n||`${m}-label`,disabled:a,id:m,name:O||m,...$,children:r})})}),An=({isResponsive:e,children:n})=>e?l("div",{className:"pkt-table-container",children:n}):l(Z,{children:n}),Un=({isResponsive:e,modifiers:{info:n=!1,success:r=!1,strong:o=!1,shadow:a=!1}={},children:i})=>l(An,{isResponsive:e,children:l("table",{className:kt("pkt-table",{"pkt-table--info":n,"pkt-table--success":r,"pkt-table--strong":o,"pkt-table--shadow":a}),children:i})}),Bn=({children:e})=>l("td",{className:"pkt-table__th",children:e}),Wn=({children:e})=>l("th",{className:"pkt-table__th",children:e}),gt=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=()=>{}},m)=>{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&&h("button",{className:S,type:p,"aria-label":f,onClick:C,ref:m,children:[l(y,{className:"pkt-tag__icon",name:s}),e,l(y,{className:"pkt-tag__close-btn",name:"close"})]})}):i?l(Z,{children:D&&h("button",{className:S,type:p,"aria-label":f,onClick:C,ref:m,children:[l(y,{className:"pkt-tag__close-btn",name:"close"}),e]})}):s?h("span",{className:O,children:[l(y,{className:"pkt-tag__icon",name:s}),e]}):l("span",{className:O,children:e})});gt.displayName="PktTag";const Vn=N.forwardRef(({id:e,ariaDescribedby:n,ariaLabelledby:r,counter:o,counterMaxLength:a,className:i,disabled:s,errorMessage:p,hasError:f,helptext:c,helptextDropdown:m,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 G=[i,"pkt-textinput","pkt-textarea"].join(" "),M=r||`${e}-label`,_=N.useRef(null),[I,H]=N.useState(0),K=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]),h(ue,{ariaDescribedby:n,className:G,disabled:s,errorMessage:p,forId:e,hasError:f,helptext:c,helptextDropdown:m,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&&I>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:K}),o&&h("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":!0,children:[I||0,a&&`/${a}`]})]})}),Mn=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:m,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,...G},M)=>{const _=[a,"pkt-textinput"].join(" "),I=r||`${e}-label`;return l(ue,{ariaDescribedby:n,className:_,disabled:i,errorMessage:s,forId:e,hasError:p,helptext:f,helptextDropdown:c,helptextDropdownButton:m,inline:w,label:O,optionalTag:D,optionalText:P,requiredTag:g,requiredText:$,useWrapper:q,children:h("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":I,...G}),W&&h("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=Qe,T.PktBackLink=qt,T.PktBreadcrumbs=Tn,T.PktButton=ce,T.PktCheckbox=mt,T.PktFooter=jn,T.PktFooterSimple=Dn,T.PktHeader=In,T.PktIcon=y,T.PktIconContext=Ze,T.PktInput=vt,T.PktInputWrapper=ue,T.PktLinkCard=_t,T.PktMessagebox=Ln,T.PktRadioButton=bt,T.PktSelect=Fn,T.PktTable=Un,T.PktTableData=Bn,T.PktTableHeader=Wn,T.PktTag=gt,T.PktTextarea=Vn,T.PktTextinput=Mn,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.
|
|
3
|
+
"version": "9.3.0",
|
|
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": "
|
|
94
|
+
"gitHead": "82c3a7e9c7ce515cb86d732bfaa3783c803a623d"
|
|
95
95
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IconFetcher } from "@/components/icon/IconContext";
|
|
2
|
+
|
|
3
|
+
// Cache is a dictionary of promises that each resolves to an svg icon
|
|
4
|
+
const iconCache: { [name: string]: Promise<string> } = {}
|
|
5
|
+
const errorSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>'
|
|
6
|
+
|
|
7
|
+
export const defaultSvgPath = 'https://punkt-cdn.oslo.kommune.no/latest/icons/'
|
|
8
|
+
|
|
9
|
+
const downloadIconOrGetFromCache = (name: string, path: string): Promise<string> => {
|
|
10
|
+
// Download and cache icon if not in cache
|
|
11
|
+
if (!iconCache[name] && typeof window.fetch === 'function') {
|
|
12
|
+
iconCache[name] = window.fetch(path + name + '.svg')
|
|
13
|
+
.then((response) => {
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.error('Missing icon: ' + path + name + '.svg')
|
|
17
|
+
return errorSvg
|
|
18
|
+
}
|
|
19
|
+
return response.text()
|
|
20
|
+
})
|
|
21
|
+
.then((text) => {
|
|
22
|
+
return text;
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Return the svg promise
|
|
27
|
+
return Promise.resolve(iconCache[name])
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const defaultIconFetcher : IconFetcher = {
|
|
31
|
+
fetchIcon: async (name: string, path: string | undefined): Promise<string | null> => {
|
|
32
|
+
const iconPath = path || defaultSvgPath
|
|
33
|
+
return downloadIconOrGetFromCache(name, iconPath);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default defaultIconFetcher;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect'
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
import { PktIcon } from './Icon'
|
|
7
|
+
import { IconFetcher, PktIconContext } from './IconContext'
|
|
8
|
+
|
|
9
|
+
describe('PktIcon', () => {
|
|
10
|
+
let fetchSpy: jest.SpyInstance
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
fetchSpy = jest.spyOn(global, 'fetch')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
describe('with default fetcher', () => {
|
|
17
|
+
test('fetches SVG with default fetcher', async () => {
|
|
18
|
+
fetchSpy.mockResolvedValue(
|
|
19
|
+
new Response('<svg role="img">Her er noe SVG</svg>', {status: 200}),
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
render(<PktIcon name={'arrow'}/>)
|
|
23
|
+
|
|
24
|
+
const icon = await screen.findByRole('img')
|
|
25
|
+
expect(icon).toMatchInlineSnapshot(`
|
|
26
|
+
<svg
|
|
27
|
+
role="img"
|
|
28
|
+
>
|
|
29
|
+
Her er noe SVG
|
|
30
|
+
</svg>
|
|
31
|
+
`)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('fetches SVG and caches result', async () => {
|
|
35
|
+
fetchSpy.mockResolvedValue(
|
|
36
|
+
new Response('<svg role="img">Her er noe SVG</svg>', {status: 200}),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
render(
|
|
40
|
+
<div>
|
|
41
|
+
<PktIcon name={'some-icon'}/>
|
|
42
|
+
<PktIcon name={'some-icon'}/>
|
|
43
|
+
</div>,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
const icons = await screen.findAllByRole('img')
|
|
47
|
+
expect(icons).toHaveLength(2)
|
|
48
|
+
expect(fetchSpy).toHaveBeenCalledTimes(1)
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
describe('with custom fetcher', () => {
|
|
53
|
+
test('fetches SVG with custom fetcher', async () => {
|
|
54
|
+
const customIconFetcher: IconFetcher = {
|
|
55
|
+
fetchIcon: jest.fn((name: string, path: string | undefined) => {
|
|
56
|
+
return Promise.resolve(`<svg role="img">Her er SVGen for '${name}' fra '${path}'</svg>`)
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
render(
|
|
61
|
+
<PktIconContext.Provider value={customIconFetcher}>
|
|
62
|
+
<PktIcon name={'arrow'} path={'http://path/to/something'}/>
|
|
63
|
+
</PktIconContext.Provider>,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
const icon = await screen.findByRole('img')
|
|
67
|
+
expect(icon).toMatchInlineSnapshot(`
|
|
68
|
+
<svg
|
|
69
|
+
role="img"
|
|
70
|
+
>
|
|
71
|
+
Her er SVGen for 'arrow' fra 'http://path/to/something'
|
|
72
|
+
</svg>
|
|
73
|
+
`)
|
|
74
|
+
expect(customIconFetcher.fetchIcon).toHaveBeenCalledTimes(1)
|
|
75
|
+
expect(fetchSpy).not.toHaveBeenCalled()
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
})
|
|
@@ -1,55 +1,30 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const iconCache: { [name: string]: Promise<string> } = {}
|
|
5
|
-
|
|
6
|
-
const errorSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>'
|
|
7
|
-
|
|
8
|
-
function getIcon(name: string, path: string): Promise<string> {
|
|
9
|
-
// Download and cache icon if not in cache
|
|
10
|
-
if (!iconCache[name] && typeof window.fetch === 'function') {
|
|
11
|
-
iconCache[name] = window.fetch(path + name + '.svg')
|
|
12
|
-
.then((response) => {
|
|
13
|
-
if (!response.ok) {
|
|
14
|
-
console.error('Missing icon: ' + path + name + '.svg')
|
|
15
|
-
return errorSvg
|
|
16
|
-
}
|
|
17
|
-
return response.text()
|
|
18
|
-
})
|
|
19
|
-
.then((text) => {
|
|
20
|
-
return text;
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Return the svg promise
|
|
25
|
-
return Promise.resolve(iconCache[name])
|
|
26
|
-
}
|
|
3
|
+
import { PktIconContext } from "./IconContext";
|
|
27
4
|
|
|
28
5
|
interface PktIconProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
29
6
|
name?: string // name is now optional
|
|
30
7
|
path?: string
|
|
31
8
|
}
|
|
32
9
|
|
|
33
|
-
export const PktIcon: React.FC<PktIconProps> = ({
|
|
34
|
-
const defaultSvgPath = 'https://punkt-cdn.oslo.kommune.no/latest/icons/'
|
|
10
|
+
export const PktIcon: React.FC<PktIconProps> = ({name, path, className = '', ...props}) => {
|
|
35
11
|
const [innerHtml, setInnerHtml] = useState<string | null>(null)
|
|
12
|
+
const iconFetcherContext = useContext(PktIconContext)
|
|
36
13
|
|
|
37
14
|
useEffect(() => {
|
|
38
15
|
if (!name) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
16
|
+
setInnerHtml(null);
|
|
17
|
+
} else {
|
|
18
|
+
iconFetcherContext.fetchIcon(name, path).then(setInnerHtml);
|
|
42
19
|
}
|
|
43
|
-
|
|
44
|
-
getIcon(name, iconPath).then((svg) => setInnerHtml(svg))
|
|
45
|
-
}, [name, path, defaultSvgPath])
|
|
20
|
+
}, [name, path]);
|
|
46
21
|
|
|
47
22
|
if (!innerHtml) return null
|
|
48
23
|
|
|
49
24
|
return (
|
|
50
25
|
<span
|
|
51
26
|
className={`pkt-icon ${className}`}
|
|
52
|
-
dangerouslySetInnerHTML={{
|
|
27
|
+
dangerouslySetInnerHTML={{__html: innerHtml}}
|
|
53
28
|
{...props}
|
|
54
29
|
/>
|
|
55
30
|
)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
|
|
3
|
+
import defaultIconFetcher from "./DefaultIconFetcher";
|
|
4
|
+
|
|
5
|
+
export type IconFetcher = {
|
|
6
|
+
fetchIcon: (name: string, path: string | undefined) => Promise<string | null>
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const PktIconContext = createContext<IconFetcher>(defaultIconFetcher);
|
package/src/components/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { PktFooter } from './footer/Footer'
|
|
|
7
7
|
export { PktFooterSimple } from './footerSimple/FooterSimple'
|
|
8
8
|
export { PktHeader } from './header/Header'
|
|
9
9
|
export { PktIcon } from './icon/Icon'
|
|
10
|
+
export { PktIconContext } from './icon/IconContext';
|
|
10
11
|
export { PktInput } from './input/Input'
|
|
11
12
|
export { PktInputWrapper } from './inputwrapper/InputWrapper'
|
|
12
13
|
export { PktLinkCard } from './linkcard/LinkCard'
|
|
@@ -22,11 +22,12 @@ export const PktLinkCard = forwardRef(
|
|
|
22
22
|
href = '#',
|
|
23
23
|
external = false,
|
|
24
24
|
title,
|
|
25
|
+
...props
|
|
25
26
|
}: IPktLinkCard, ref: ForwardedRef<HTMLAnchorElement>
|
|
26
27
|
) => {
|
|
27
28
|
const classes = [className, 'pkt-linkcard', skin && `pkt-linkcard--${skin}`].filter(Boolean).join(' ')
|
|
28
29
|
return (
|
|
29
|
-
<a href={href} className={`pkt-linkcard pkt-link ${classes}`}
|
|
30
|
+
<a {...props} href={href} className={`pkt-linkcard pkt-link ${classes}`}
|
|
30
31
|
target={openInNewTab ? '_blank' : '_self'}
|
|
31
32
|
rel={openInNewTab ? 'noopener noreferrer' : undefined} ref={ref}>
|
|
32
33
|
<PktIcon className="pkt-link__icon" name={iconName}></PktIcon>
|