@oslokommune/punkt-react 8.0.12 → 9.0.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 +22 -0
- package/dist/checkbox/Checkbox.d.ts +12 -0
- package/dist/index.d.ts +2 -2
- package/dist/inputwrapper/InputWrapper.d.ts +1 -0
- package/dist/punkt-react.es.js +650 -580
- package/dist/punkt-react.umd.js +14 -14
- package/dist/radio/RadioButton.d.ts +12 -0
- package/package.json +4 -4
- package/src/components/checkbox/Checkbox.test.tsx +65 -0
- package/src/components/checkbox/Checkbox.tsx +60 -0
- package/src/components/index.ts +2 -2
- package/src/components/inputwrapper/InputWrapper.tsx +42 -39
- package/src/components/radio/RadioButton.test.tsx +53 -0
- package/src/components/radio/RadioButton.tsx +61 -0
- package/dist/radio/Radio.d.ts +0 -9
- package/dist/radioGroup/RadioGroup.d.ts +0 -8
- package/src/components/radio/Radio.tsx +0 -23
- package/src/components/radioGroup/RadioGroup.tsx +0 -17
package/dist/punkt-react.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(j,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],E):(j=typeof globalThis<"u"?globalThis:j||self,E(j["punkt-react"]={},j.React))})(this,function(j,E){"use strict";function Ut(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=Ut(E);function Bt(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 Ge;function Wt(){if(Ge)return oe;Ge=1;var e=E,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(c,f,d){var h,_={},x=null,P=null;d!==void 0&&(x=""+d),f.key!==void 0&&(x=""+f.key),f.ref!==void 0&&(P=f.ref);for(h in f)o.call(f,h)&&!i.hasOwnProperty(h)&&(_[h]=f[h]);if(c&&c.defaultProps)for(h in f=c.defaultProps,f)_[h]===void 0&&(_[h]=f[h]);return{$$typeof:n,type:c,key:x,ref:P,props:_,_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 Vt(){return Xe||(Xe=1,process.env.NODE_ENV!=="production"&&function(){var e=E,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`)
|
|
21
|
-
`+y[
|
|
17
|
+
*/var Xe;function Vt(){return Xe||(Xe=1,process.env.NODE_ENV!=="production"&&function(){var e=E,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"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),P=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 R=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(t){{for(var u=arguments.length,p=new Array(u>1?u-1:0),k=1;k<u;k++)p[k-1]=arguments[k];L("error",t,p)}}function L(t,u,p){{var k=R.ReactDebugCurrentFrame,C=k.getStackAddendum();C!==""&&(u+="%s",p=p.concat([C]));var T=p.map(function(w){return String(w)});T.unshift("Warning: "+u),Function.prototype.apply.call(console[t],console,T)}}var U=!1,V=!1,B=!1,Y=!1,q=!1,J;J=Symbol.for("react.module.reference");function K(t){return!!(typeof t=="string"||typeof t=="function"||t===o||t===i||q||t===a||t===d||t===h||Y||t===P||U||V||B||typeof t=="object"&&t!==null&&(t.$$typeof===x||t.$$typeof===_||t.$$typeof===s||t.$$typeof===c||t.$$typeof===f||t.$$typeof===J||t.getModuleId!==void 0))}function M(t,u,p){var k=t.displayName;if(k)return k;var C=u.displayName||u.name||"";return C!==""?p+"("+C+")":p}function v(t){return t.displayName||"Context"}function $(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 d:return"Suspense";case h:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case c:var u=t;return v(u)+".Consumer";case s:var p=t;return v(p._context)+".Provider";case f:return M(t,t.render,"ForwardRef");case _:var k=t.displayName||null;return k!==null?k:$(t.type)||"Memo";case x:{var C=t,T=C._payload,w=C._init;try{return $(w(T))}catch{return null}}}return null}var H=Object.assign,G=0,ee,te,ue,gt,Nt,yt,Et;function wt(){}wt.__reactDisabledLog=!0;function Bn(){{if(G===0){ee=console.log,te=console.info,ue=console.warn,gt=console.error,Nt=console.group,yt=console.groupCollapsed,Et=console.groupEnd;var t={configurable:!0,enumerable:!0,value:wt,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}G++}}function Wn(){{if(G--,G===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:ue}),error:H({},t,{value:gt}),group:H({},t,{value:Nt}),groupCollapsed:H({},t,{value:yt}),groupEnd:H({},t,{value:Et})})}G<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ve=R.ReactCurrentDispatcher,Me;function ye(t,u,p){{if(Me===void 0)try{throw Error()}catch(C){var k=C.stack.trim().match(/\n( *(at )?)/);Me=k&&k[1]||""}return`
|
|
18
|
+
`+Me+t}}var Ye=!1,Ee;{var Vn=typeof WeakMap=="function"?WeakMap:Map;Ee=new Vn}function xt(t,u){if(!t||Ye)return"";{var p=Ee.get(t);if(p!==void 0)return p}var k;Ye=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var T;T=Ve.current,Ve.current=null,Bn();try{if(u){var w=function(){throw Error()};if(Object.defineProperty(w.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(w,[])}catch(X){k=X}Reflect.construct(t,[],w)}else{try{w.call()}catch(X){k=X}t.call(w.prototype)}}else{try{throw Error()}catch(X){k=X}t()}}catch(X){if(X&&k&&typeof X.stack=="string"){for(var y=X.stack.split(`
|
|
19
|
+
`),W=k.stack.split(`
|
|
20
|
+
`),I=y.length-1,F=W.length-1;I>=1&&F>=0&&y[I]!==W[F];)F--;for(;I>=1&&F>=0;I--,F--)if(y[I]!==W[F]){if(I!==1||F!==1)do if(I--,F--,F<0||y[I]!==W[F]){var z=`
|
|
21
|
+
`+y[I].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(I>=1&&F>=0);break}}}finally{Ye=!1,Ve.current=T,Wn(),Error.prepareStackTrace=C}var le=t?t.displayName||t.name:"",At=le?ye(le):"";return typeof t=="function"&&Ee.set(t,At),At}function Mn(t,u,p){return xt(t,!1)}function Yn(t){var u=t.prototype;return!!(u&&u.isReactComponent)}function we(t,u,p){if(t==null)return"";if(typeof t=="function")return xt(t,Yn(t));if(typeof t=="string")return ye(t);switch(t){case d:return ye("Suspense");case h:return ye("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case f:return Mn(t.render);case _:return we(t.type,u,p);case x:{var k=t,C=k._payload,T=k._init;try{return we(T(C),u,p)}catch{}}}return""}var xe=Object.prototype.hasOwnProperty,Ct={},Pt=R.ReactDebugCurrentFrame;function Ce(t){if(t){var u=t._owner,p=we(t.type,t._source,u?u.type:null);Pt.setExtraStackFrame(p)}else Pt.setExtraStackFrame(null)}function Jn(t,u,p,k,C){{var T=Function.call.bind(xe);for(var w in t)if(T(t,w)){var y=void 0;try{if(typeof t[w]!="function"){var W=Error((k||"React class")+": "+p+" type `"+w+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[w]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw W.name="Invariant Violation",W}y=t[w](u,w,k,p,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(I){y=I}y&&!(y instanceof Error)&&(Ce(C),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",p,w,typeof y),Ce(null)),y instanceof Error&&!(y.message in Ct)&&(Ct[y.message]=!0,Ce(C),g("Failed %s type: %s",p,y.message),Ce(null))}}}var Hn=Array.isArray;function Je(t){return Hn(t)}function zn(t){{var u=typeof Symbol=="function"&&Symbol.toStringTag,p=u&&t[Symbol.toStringTag]||t.constructor.name||"Object";return p}}function qn(t){try{return Rt(t),!1}catch{return!0}}function Rt(t){return""+t}function St(t){if(qn(t))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",zn(t)),Rt(t)}var fe=R.ReactCurrentOwner,Kn={key:!0,ref:!0,__self:!0,__source:!0},Ot,Tt,He;He={};function Gn(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 Xn(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 Zn(t,u){if(typeof t.ref=="string"&&fe.current&&u&&fe.current.stateNode!==u){var p=$(fe.current.type);He[p]||(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',$(fe.current.type),t.ref),He[p]=!0)}}function Qn(t,u){{var p=function(){Ot||(Ot=!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))};p.isReactWarning=!0,Object.defineProperty(t,"key",{get:p,configurable:!0})}}function er(t,u){{var p=function(){Tt||(Tt=!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))};p.isReactWarning=!0,Object.defineProperty(t,"ref",{get:p,configurable:!0})}}var tr=function(t,u,p,k,C,T,w){var y={$$typeof:n,type:t,key:u,ref:p,props:w,_owner:T};return y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(y,"_self",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.defineProperty(y,"_source",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y};function nr(t,u,p,k,C){{var T,w={},y=null,W=null;p!==void 0&&(St(p),y=""+p),Xn(u)&&(St(u.key),y=""+u.key),Gn(u)&&(W=u.ref,Zn(u,C));for(T in u)xe.call(u,T)&&!Kn.hasOwnProperty(T)&&(w[T]=u[T]);if(t&&t.defaultProps){var I=t.defaultProps;for(T in I)w[T]===void 0&&(w[T]=I[T])}if(y||W){var F=typeof t=="function"?t.displayName||t.name||"Unknown":t;y&&Qn(w,F),W&&er(w,F)}return tr(t,y,W,C,k,fe.current,w)}}var ze=R.ReactCurrentOwner,jt=R.ReactDebugCurrentFrame;function ae(t){if(t){var u=t._owner,p=we(t.type,t._source,u?u.type:null);jt.setExtraStackFrame(p)}else jt.setExtraStackFrame(null)}var qe;qe=!1;function Ke(t){return typeof t=="object"&&t!==null&&t.$$typeof===n}function Dt(){{if(ze.current){var t=$(ze.current.type);if(t)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+t+"`."}return""}}function rr(t){{if(t!==void 0){var u=t.fileName.replace(/^.*[\\\/]/,""),
|
|
23
|
+
Check the render method of \``+t+"`."}return""}}function rr(t){{if(t!==void 0){var u=t.fileName.replace(/^.*[\\\/]/,""),p=t.lineNumber;return`
|
|
24
24
|
|
|
25
|
-
Check your code at `+u+":"+
|
|
25
|
+
Check your code at `+u+":"+p+"."}return""}}var $t={};function ar(t){{var u=Dt();if(!u){var p=typeof t=="string"?t:t.displayName||t.name;p&&(u=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+
|
|
27
|
+
Check the top-level render call using <`+p+">.")}return u}}function Lt(t,u){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var p=ar(u);if($t[p])return;$t[p]=!0;var k="";t&&t._owner&&t._owner!==ze.current&&(k=" It was passed a child from "+$(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.',p,k),ae(null)}}function It(t,u){{if(typeof t!="object")return;if(Je(t))for(var p=0;p<t.length;p++){var k=t[p];Ke(k)&&Lt(k,u)}else if(Ke(t))t._store&&(t._store.validated=!0);else if(t){var C=D(t);if(typeof C=="function"&&C!==t.entries)for(var T=C.call(t),w;!(w=T.next()).done;)Ke(w.value)&&Lt(w.value,u)}}}function lr(t){{var u=t.type;if(u==null||typeof u=="string")return;var p;if(typeof u=="function")p=u.propTypes;else if(typeof u=="object"&&(u.$$typeof===f||u.$$typeof===_))p=u.propTypes;else return;if(p){var k=$(u);Jn(p,t.props,"prop",k,t)}else if(u.PropTypes!==void 0&&!qe){qe=!0;var C=$(u);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",C||"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 or(t){{for(var u=Object.keys(t.props),p=0;p<u.length;p++){var k=u[p];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 Ft(t,u,p,k,C,T){{var w=K(t);if(!w){var y="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(y+=" 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 W=rr(C);W?y+=W:y+=Dt();var I;t===null?I="null":Je(t)?I="array":t!==void 0&&t.$$typeof===n?(I="<"+($(t.type)||"Unknown")+" />",y=" Did you accidentally export a JSX literal instead of a component?"):I=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",I,y)}var F=nr(t,u,p,C,T);if(F==null)return F;if(w){var z=u.children;if(z!==void 0)if(k)if(Je(z)){for(var le=0;le<z.length;le++)It(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 It(z,t)}return t===o?or(F):lr(F),F}}function ir(t,u,p){return Ft(t,u,p,!0)}function sr(t,u,p){return Ft(t,u,p,!1)}var cr=sr,ur=ir;ie.Fragment=o,ie.jsx=cr,ie.jsxs=ur}()),ie}process.env.NODE_ENV==="production"?Pe.exports=Wt():Pe.exports=Vt();var Re=Pe.exports;const Z=Re.Fragment,l=Re.jsx,m=Re.jsxs,Se={},Mt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function Yt(e,n){return!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"),Mt)).then(r=>r)),Promise.resolve(Se[e])}const N=({name:e,path:n,className:r="",...o})=>{const a="https://punkt-cdn.oslo.kommune.no/9.0/icons/",[i,s]=E.useState(null);return E.useEffect(()=>{if(!e)return;Yt(e,n||a).then(f=>s(f))},[e,n,a]),i?l("span",{className:`pkt-icon ${r}`,dangerouslySetInnerHTML:{__html:i},...o}):null},Ze=E.forwardRef(({children:e,className:n,skin:r="info",closeAlert:o=!1,onClose:a,title:i,date:s,ariaLive:c="polite",slim:f=!1,...d},h)=>{const _=[n,"pkt-alert",r&&`pkt-alert--${r}`,f&&"pkt-alert--slim"].filter(Boolean).join(" "),[x,P]=E.useState(!0),O=()=>{P(!1),a&&a()};return x?m("div",{...d,className:_,"aria-live":c,ref:h,children:[l(N,{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(N,{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&&m("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",s]})]}):null}),Jt=E.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:m("a",{href:e||"/",className:"pkt-link pkt-link--icon-left",onClick:()=>{r&&r()},...a,children:[l(N,{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
|
|
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 Qe;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Qe||(Qe={}));function A(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function pe(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 et(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 tt;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(tt||(tt={}));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 Ht(e,n){n===void 0&&(n="/");let{pathname:r,search:o="",hash:a=""}=typeof e=="string"?et(e):e;return{pathname:r?r.startsWith("/")?r:zt(r,n):n,search:qt(o),hash:Kt(a)}}function zt(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 nt(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function rt(e,n,r,o){o===void 0&&(o=!1);let a;typeof e=="string"?a=et(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,c;if(o||s==null)c=r;else{let _=n.length-1;if(s.startsWith("..")){let x=s.split("/");for(;x[0]==="..";)x.shift(),_-=1;a.pathname=x.join("/")}c=_>=0?n[_]:"/"}let f=Ht(a,c),d=s&&s!=="/"&&s.endsWith("/"),h=(i||s===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(d||h)&&(f.pathname+="/"),f}const $e=e=>e.join("/").replace(/\/\/+/g,"/"),qt=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Kt=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,at=["post","put","patch","delete"];new Set(at);const Gt=["get",...at];new Set(Gt);/**
|
|
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 Le(){return Le=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},Le.apply(this,arguments)}const de=b.createContext(null);process.env.NODE_ENV!=="production"&&(de.displayName="DataRouter");const lt=b.createContext(null);process.env.NODE_ENV!=="production"&&(lt.displayName="DataRouterState");const Xt=b.createContext(null);process.env.NODE_ENV!=="production"&&(Xt.displayName="Await");const Q=b.createContext(null);process.env.NODE_ENV!=="production"&&(Q.displayName="Navigation");const Ie=b.createContext(null);process.env.NODE_ENV!=="production"&&(Ie.displayName="Location");const re=b.createContext({outlet:null,matches:[],isDataRoute:!1});process.env.NODE_ENV!=="production"&&(re.displayName="Route");const Zt=b.createContext(null);process.env.NODE_ENV!=="production"&&(Zt.displayName="RouteError");function Qt(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:c}=me(e,{relative:r}),f=s;return o!=="/"&&(f=s==="/"?o:$e([o,s])),a.createHref({pathname:f,search:c,hash:i})}function Fe(){return b.useContext(Ie)!=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(Ie).location}const ot="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function it(e){b.useContext(Q).static||b.useLayoutEffect(e)}function en(){let{isDataRoute:e}=b.useContext(re);return e?ln():tn()}function tn(){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(de),{basename:n,navigator:r}=b.useContext(Q),{matches:o}=b.useContext(re),{pathname:a}=se(),i=JSON.stringify(nt(o).map(f=>f.pathnameBase)),s=b.useRef(!1);return it(()=>{s.current=!0}),b.useCallback(function(f,d){if(d===void 0&&(d={}),process.env.NODE_ENV!=="production"&&pe(s.current,ot),!s.current)return;if(typeof f=="number"){r.go(f);return}let h=rt(f,JSON.parse(i),a,d.relative==="path");e==null&&n!=="/"&&(h.pathname=h.pathname==="/"?n:$e([n,h.pathname])),(d.replace?r.replace:r.push)(h,d.state,d)},[n,r,i,a,e])}function me(e,n){let{relative:r}=n===void 0?{}:n,{matches:o}=b.useContext(re),{pathname:a}=se(),i=JSON.stringify(nt(o).map(s=>s.pathnameBase));return b.useMemo(()=>rt(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 he;(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"})(he||(he={}));function st(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function nn(e){let n=b.useContext(de);return n||(process.env.NODE_ENV!=="production"?A(!1,st(e)):A(!1)),n}function rn(e){let n=b.useContext(re);return n||(process.env.NODE_ENV!=="production"?A(!1,st(e)):A(!1)),n}function ct(e){let n=rn(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 an(){return ct(he.UseRouteId)}function ln(){let{router:e}=nn(Ae.UseNavigateStable),n=ct(he.UseNavigateStable),r=b.useRef(!1);return it(()=>{r.current=!0}),b.useCallback(function(a,i){i===void 0&&(i={}),process.env.NODE_ENV!=="production"&&pe(r.current,ot),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Le({fromRouteId:n},i)))},[e,n])}var ut;(function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"})(ut||(ut={})),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 te(){return te=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e},te.apply(this,arguments)}function Ue(e,n){if(e==null)return{};var r={},l=Object.keys(e),a,i;for(i=0;i<l.length;i++)a=l[i],!(n.indexOf(a)>=0)&&(r[a]=e[a]);return r}const ke="get",ve="application/x-www-form-urlencoded";function _e(e){return e!=null&&typeof e.tagName=="string"}function on(e){return _e(e)&&e.tagName.toLowerCase()==="button"}function ln(e){return _e(e)&&e.tagName.toLowerCase()==="form"}function sn(e){return _e(e)&&e.tagName.toLowerCase()==="input"}function cn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function un(e,n){return e.button===0&&(!n||n==="_self")&&!cn(e)}let be=null;function fn(){if(be===null)try{new FormData(document.createElement("form"),0),be=!1}catch{be=!0}return be}const dn=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function We(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 "'+ve+'"')),null):e}function pn(e,n){let r,l,a,i,s;if(ln(e)){let c=e.getAttribute("action");l=c?je(c,n):null,r=e.getAttribute("method")||ke,a=We(e.getAttribute("enctype"))||ve,i=new FormData(e)}else if(on(e)||sn(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||c.getAttribute("action");if(l=f?je(f,n):null,r=e.getAttribute("formmethod")||c.getAttribute("method")||ke,a=We(e.getAttribute("formenctype"))||We(c.getAttribute("enctype"))||ve,i=new FormData(c,e),!fn()){let{name:p,type:h,value:_}=e;if(h==="image"){let x=p?p+".":"";i.append(x+"x","0"),i.append(x+"y","0")}else p&&i.append(p,_)}}else{if(_e(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ke,l=null,a=ve,s=e}return i&&a==="text/plain"&&(s=i,i=void 0),{action:l,method:r.toLowerCase(),encType:a,formData:i,body:s}}const mn=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],hn=["aria-current","caseSensitive","className","end","style","to","children"],kn=["reloadDocument","replace","method","action","onSubmit","submit","relative","preventScrollReset"];process.env.NODE_ENV;const vn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",_n=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ge=g.forwardRef(function(n,r){let{onClick:l,relative:a,reloadDocument:i,replace:s,state:c,target:f,to:p,preventScrollReset:h}=n,_=Ue(n,mn),{basename:x}=g.useContext(Z),P,S=!1;if(typeof p=="string"&&_n.test(p)&&(P=p,vn))try{let b=new URL(window.location.href),A=p.startsWith("//")?new URL(b.protocol+p):new URL(p),W=je(A.pathname,x);A.origin===b.origin&&W!=null?p=W+A.search+A.hash:S=!0}catch{process.env.NODE_ENV!=="production"&&de(!1,'<Link to="'+p+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let R=Zt(p,{relative:a}),D=En(p,{replace:s,state:c,target:f,preventScrollReset:h,relative:a});function j(b){l&&l(b),b.defaultPrevented||D(b)}return g.createElement("a",te({},_,{href:P||R,onClick:S||i?l:j,ref:r,target:f}))});process.env.NODE_ENV!=="production"&&(ge.displayName="Link");const bn=g.forwardRef(function(n,r){let{"aria-current":l="page",caseSensitive:a=!1,className:i="",end:s=!1,style:c,to:f,children:p}=n,h=Ue(n,hn),_=me(f,{relative:h.relative}),x=se(),P=g.useContext(ot),{navigator:S}=g.useContext(Z),R=S.encodeLocation?S.encodeLocation(_).pathname:_.pathname,D=x.pathname,j=P&&P.navigation&&P.navigation.location?P.navigation.location.pathname:null;a||(D=D.toLowerCase(),j=j?j.toLowerCase():null,R=R.toLowerCase());let b=D===R||!s&&D.startsWith(R)&&D.charAt(R.length)==="/",A=j!=null&&(j===R||!s&&j.startsWith(R)&&j.charAt(R.length)==="/"),W=b?l:void 0,M;typeof i=="function"?M=i({isActive:b,isPending:A}):M=[i,b?"active":null,A?"pending":null].filter(Boolean).join(" ");let U=typeof c=="function"?c({isActive:b,isPending:A}):c;return g.createElement(ge,te({},h,{"aria-current":W,className:M,ref:r,style:U,to:f}),typeof p=="function"?p({isActive:b,isPending:A}):p)});process.env.NODE_ENV!=="production"&&(bn.displayName="NavLink");const gn=g.forwardRef((e,n)=>{let r=xn();return g.createElement(ft,te({},e,{submit:r,ref:n}))});process.env.NODE_ENV!=="production"&&(gn.displayName="Form");const ft=g.forwardRef((e,n)=>{let{reloadDocument:r,replace:l,method:a=ke,action:i,onSubmit:s,submit:c,relative:f,preventScrollReset:p}=e,h=Ue(e,kn),_=a.toLowerCase()==="get"?"get":"post",x=Cn(i,{relative:f}),P=S=>{if(s&&s(S),S.defaultPrevented)return;S.preventDefault();let R=S.nativeEvent.submitter,D=(R==null?void 0:R.getAttribute("formmethod"))||a;c(R||S.currentTarget,{method:D,replace:l,relative:f,preventScrollReset:p})};return g.createElement("form",te({ref:n,method:_,action:x,onSubmit:r?s:P},h))});process.env.NODE_ENV!=="production"&&(ft.displayName="FormImpl"),process.env.NODE_ENV;var Ve;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher"})(Ve||(Ve={}));var dt;(function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(dt||(dt={}));function Nn(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function yn(e){let n=g.useContext(pe);return n||(process.env.NODE_ENV!=="production"?F(!1,Nn(e)):F(!1)),n}function En(e,n){let{target:r,replace:l,state:a,preventScrollReset:i,relative:s}=n===void 0?{}:n,c=Qt(),f=se(),p=me(e,{relative:s});return g.useCallback(h=>{if(un(h,r)){h.preventDefault();let _=l!==void 0?l:Te(f)===Te(p);c(e,{replace:_,state:a,preventScrollReset:i,relative:s})}},[f,c,p,l,a,r,e,i,s])}function wn(){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 xn(){let{router:e}=yn(Ve.UseSubmit),{basename:n}=g.useContext(Z),r=rn();return g.useCallback(function(l,a){a===void 0&&(a={}),wn();let{action:i,method:s,encType:c,formData:f,body:p}=pn(l,n);e.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:f,body:p,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,fromRouteId:r})},[e,n,r])}function Cn(e,n){let{relative:r}=n===void 0?{}:n,{basename:l}=g.useContext(Z),a=g.useContext(re);a||(process.env.NODE_ENV!=="production"?F(!1,"useFormAction must be used inside a RouteContext"):F(!1));let[i]=a.matches.slice(-1),s=te({},me(e||".",{relative:r})),c=se();if(e==null&&(s.search=c.search,s.hash=c.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"),l!=="/"&&(s.pathname=s.pathname==="/"?l:Le([l,s.pathname])),Te(s)}const Pn=E.forwardRef(({breadcrumbs:e,navigationType:n,className:r,...l},a)=>{const i=e.slice(0,4),s=i[i.length-2],c=[r,"pkt-breadcrumbs"].filter(Boolean).join(" ");return m("nav",{ref:a,"aria-label":"brødsmulemeny",className:c,children:[o("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:i.map((f,p)=>o("li",{className:"pkt-breadcrumbs__item",children:p===i.length-1?o("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:o("span",{className:"pkt-breadcrumbs__text",children:f.text})}):n==="router"?m(ge,{to:f.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...l,children:[o(N,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),o("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",...l,children:[o(N,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),o("span",{className:"pkt-breadcrumbs__text",children:f.text})]})},`breadcrumb-${p}`))}),n==="router"?m(ge,{to:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...l,children:[o(N,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),o("span",{className:"pkt-breadcrumbs__text",children:s.text})]}):m("a",{href:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...l,children:[o(N,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),o("span",{className:"pkt-breadcrumbs__text",children:s.text})]})]})}),ce=E.forwardRef(({children:e,className:n,iconName:r="user",secondIconName:l="user",size:a="medium",skin:i="primary",type:s="button",variant:c="label-only",color:f,...p},h)=>{const _=[n,"pkt-btn",a&&`pkt-btn--${a}`,i&&`pkt-btn--${i}`,c&&`pkt-btn--${c}`,f&&`pkt-btn--${f}`].filter(Boolean).join(" ");return m("button",{...p,className:_,type:s,ref:h,children:[c!=="label-only"&&o(N,{className:"pkt-btn__icon",name:r}),o("span",{className:"pkt-btn__text",children:e}),c==="icons-right-and-left"&&o(N,{className:"pkt-btn__icon",name:l})]})});ce.displayName="PktButton";const Rn=({columnOne:e,columnTwo:n,socialLinks:r,className:l})=>{var i,s;const a=[l,"pkt-footer"].filter(Boolean).join(" ");return o("footer",{className:a,"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:[o("h2",{className:"pkt-footer__title",children:e.title}),m("ul",{className:"pkt-footer__list",children:[e.text&&o("li",{className:"pkt-footer__text",children:e.text}),(i=e.links)==null?void 0:i.map((c,f)=>o("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:[o(N,{className:"pkt-footer__link-icon",name:"chevron-right"}),c.text]})},`links-${f}`))]})]}),m("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o("h2",{className:"pkt-footer__title",children:n.title}),m("ul",{className:"pkt-footer__list",children:[n.text&&o("li",{className:"pkt-footer__text",children:n.text}),(s=n.links)==null?void 0:s.map((c,f)=>o("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:[o(N,{className:"pkt-footer__link-icon",name:"chevron-right"}),c.text]})},`links-${f}`))]})]}),m("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),m("ul",{className:"pkt-footer__list",children:[o("li",{className:"pkt-footer__list-item",children:m("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[o(N,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o("li",{className:"pkt-footer__list-item",children:m("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[o(N,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),r&&m("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[o("div",{className:"pkt-footer__social-languages",children:r.filter(c=>c.language).map((c,f)=>o("div",{className:"pkt-footer__social-language",children:o("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-${f}`))}),o("div",{className:"pkt-footer__social-icons",children:r.filter(c=>c.iconName).map((c,f)=>o(E.Fragment,{children:o("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:o(N,{className:"pkt-footer__social-icon",name:c.iconName})})},`sociallinks-${f}`))})]})]})})},Sn=({links:e=[],className:n})=>{const r=[n,"pkt-footer-simple"].filter(Boolean).join(" ");return o("footer",{className:r,"data-mode":"dark",children:o("div",{className:"pkt-footer-simple__container",children:m("ul",{className:"pkt-footer-simple__list",children:[e.map((l,a)=>o("li",{className:"pkt-footer-simple__list-item",children:m("a",{className:`pkt-footer-simple__link ${l.external?" pkt-link--external":""}`,href:l.href,target:l.openInNewTab?"_blank":"_self",rel:l.openInNewTab?"noopener noreferrer":void 0,children:[o(N,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),l.text]})},a)),o("li",{className:"pkt-footer-simple__list-item",children:m("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[o(N,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o("li",{className:"pkt-footer-simple__list-item",children:m("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[o(N,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})})};var pt={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 ke="get",ve="application/x-www-form-urlencoded";function _e(e){return e!=null&&typeof e.tagName=="string"}function on(e){return _e(e)&&e.tagName.toLowerCase()==="button"}function sn(e){return _e(e)&&e.tagName.toLowerCase()==="form"}function cn(e){return _e(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 be=null;function pn(){if(be===null)try{new FormData(document.createElement("form"),0),be=!1}catch{be=!0}return be}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"&&pe(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+ve+'"')),null):e}function mn(e,n){let r,o,a,i,s;if(sn(e)){let c=e.getAttribute("action");o=c?je(c,n):null,r=e.getAttribute("method")||ke,a=Be(e.getAttribute("enctype"))||ve,i=new FormData(e)}else if(on(e)||cn(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||c.getAttribute("action");if(o=f?je(f,n):null,r=e.getAttribute("formmethod")||c.getAttribute("method")||ke,a=Be(e.getAttribute("formenctype"))||Be(c.getAttribute("enctype"))||ve,i=new FormData(c,e),!pn()){let{name:d,type:h,value:_}=e;if(h==="image"){let x=d?d+".":"";i.append(x+"x","0"),i.append(x+"y","0")}else d&&i.append(d,_)}}else{if(_e(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ke,o=null,a=ve,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,ge=b.forwardRef(function(n,r){let{onClick:o,relative:a,reloadDocument:i,replace:s,state:c,target:f,to:d,preventScrollReset:h}=n,_=Ue(n,hn),{basename:x}=b.useContext(Q),P,O=!1;if(typeof d=="string"&&bn.test(d)&&(P=d,_n))try{let g=new URL(window.location.href),L=d.startsWith("//")?new URL(g.protocol+d):new URL(d),U=je(L.pathname,x);L.origin===g.origin&&U!=null?d=U+L.search+L.hash:O=!0}catch{process.env.NODE_ENV!=="production"&&pe(!1,'<Link to="'+d+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let S=Qt(d,{relative:a}),D=wn(d,{replace:s,state:c,target:f,preventScrollReset:h,relative:a});function R(g){o&&o(g),g.defaultPrevented||D(g)}return b.createElement("a",ne({},_,{href:P||S,onClick:O||i?o:R,ref:r,target:f}))});process.env.NODE_ENV!=="production"&&(ge.displayName="Link");const gn=b.forwardRef(function(n,r){let{"aria-current":o="page",caseSensitive:a=!1,className:i="",end:s=!1,style:c,to:f,children:d}=n,h=Ue(n,kn),_=me(f,{relative:h.relative}),x=se(),P=b.useContext(lt),{navigator:O}=b.useContext(Q),S=O.encodeLocation?O.encodeLocation(_).pathname:_.pathname,D=x.pathname,R=P&&P.navigation&&P.navigation.location?P.navigation.location.pathname:null;a||(D=D.toLowerCase(),R=R?R.toLowerCase():null,S=S.toLowerCase());let g=D===S||!s&&D.startsWith(S)&&D.charAt(S.length)==="/",L=R!=null&&(R===S||!s&&R.startsWith(S)&&R.charAt(S.length)==="/"),U=g?o:void 0,V;typeof i=="function"?V=i({isActive:g,isPending:L}):V=[i,g?"active":null,L?"pending":null].filter(Boolean).join(" ");let B=typeof c=="function"?c({isActive:g,isPending:L}):c;return b.createElement(ge,ne({},h,{"aria-current":U,className:V,ref:r,style:B,to:f}),typeof d=="function"?d({isActive:g,isPending:L}):d)});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=ke,action:i,onSubmit:s,submit:c,relative:f,preventScrollReset:d}=e,h=Ue(e,vn),_=a.toLowerCase()==="get"?"get":"post",x=Pn(i,{relative:f}),P=O=>{if(s&&s(O),O.defaultPrevented)return;O.preventDefault();let S=O.nativeEvent.submitter,D=(S==null?void 0:S.getAttribute("formmethod"))||a;c(S||O.currentTarget,{method:D,replace:o,relative:f,preventScrollReset:d})};return b.createElement("form",ne({ref:n,method:_,action:x,onSubmit:r?s:P},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(de);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,c=en(),f=se(),d=me(e,{relative:s});return b.useCallback(h=>{if(fn(h,r)){h.preventDefault();let _=o!==void 0?o:Te(f)===Te(d);c(e,{replace:_,state:a,preventScrollReset:i,relative:s})}},[f,c,d,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:c,formData:f,body:d}=mn(o,n);e.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:f,body:d,formMethod:a.method||s,formEncType:a.encType||c,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({},me(e||".",{relative:r})),c=se();if(e==null&&(s.search=c.search,s.hash=c.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=E.forwardRef(({breadcrumbs:e,navigationType:n,className:r,...o},a)=>{const i=e.slice(0,4),s=i[i.length-2],c=[r,"pkt-breadcrumbs"].filter(Boolean).join(" ");return m("nav",{ref:a,"aria-label":"brødsmulemeny",className:c,children:[l("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:i.map((f,d)=>l("li",{className:"pkt-breadcrumbs__item",children:d===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(ge,{to:f.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...o,children:[l(N,{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(N,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),l("span",{className:"pkt-breadcrumbs__text",children:f.text})]})},`breadcrumb-${d}`))}),n==="router"?m(ge,{to:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...o,children:[l(N,{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(N,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),l("span",{className:"pkt-breadcrumbs__text",children:s.text})]})]})}),ce=E.forwardRef(({children:e,className:n,iconName:r="user",secondIconName:o="user",size:a="medium",skin:i="primary",type:s="button",variant:c="label-only",color:f,...d},h)=>{const _=[n,"pkt-btn",a&&`pkt-btn--${a}`,i&&`pkt-btn--${i}`,c&&`pkt-btn--${c}`,f&&`pkt-btn--${f}`].filter(Boolean).join(" ");return m("button",{...d,className:_,type:s,ref:h,children:[c!=="label-only"&&l(N,{className:"pkt-btn__icon",name:r}),l("span",{className:"pkt-btn__text",children:e}),c==="icons-right-and-left"&&l(N,{className:"pkt-btn__icon",name:o})]})});ce.displayName="PktButton";const dt=E.forwardRef(({id:e,hasTile:n=!1,disabled:r=!1,label:o,checkHelptext:a,hasError:i=!1,className:s,...c},f)=>{const d=[s,"pkt-input-check"].filter(Boolean).join(" ");return l("div",{className:d,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,...c}),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})=>{var i,s;const a=[o,"pkt-footer"].filter(Boolean).join(" ");return l("footer",{className:a,"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}),(i=e.links)==null?void 0:i.map((c,f)=>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(N,{className:"pkt-footer__link-icon",name:"chevron-right"}),c.text]})},`links-${f}`))]})]}),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}),(s=n.links)==null?void 0:s.map((c,f)=>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(N,{className:"pkt-footer__link-icon",name:"chevron-right"}),c.text]})},`links-${f}`))]})]}),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:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[l(N,{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:"https://www.oslo.kommune.no/tilgjengelighet/",children:[l(N,{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,f)=>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-${f}`))}),l("div",{className:"pkt-footer__social-icons",children:r.filter(c=>c.iconName).map((c,f)=>l(E.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(N,{className:"pkt-footer__social-icon",name:c.iconName})})},`sociallinks-${f}`))})]})]})})},On=({links:e=[],className:n})=>{const r=[n,"pkt-footer-simple"].filter(Boolean).join(" ");return l("footer",{className:r,"data-mode":"dark",children:l("div",{className:"pkt-footer-simple__container",children:m("ul",{className:"pkt-footer-simple__list",children:[e.map((o,a)=>l("li",{className:"pkt-footer-simple__list-item",children:m("a",{className:`pkt-footer-simple__link ${o.external?" pkt-link--external":""}`,href:o.href,target:o.openInNewTab?"_blank":"_self",rel:o.openInNewTab?"noopener noreferrer":void 0,children:[l(N,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),o.text]})},a)),l("li",{className:"pkt-footer-simple__list-item",children:m("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[l(N,{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:"https://www.oslo.kommune.no/tilgjengelighet/",children:[l(N,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})})};var mt={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 l=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")l.push(i);else if(Array.isArray(i)){if(i.length){var c=r.apply(null,i);c&&l.push(c)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){l.push(i.toString());continue}for(var f in i)n.call(i,f)&&i[f]&&l.push(f)}}}return l.join(" ")}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(pt);var On=pt.exports;const mt=Ut(On),Tn=E.forwardRef(({logoLink:e="https://www.oslo.kommune.no/",serviceName:n,fixed:r=!0,scrollToHide:l=!0,user:a,userMenu:i,representing:s,userOptions:c,userMenuFooter:f,canChangeRepresentation:p=!0,showMenuButton:h=!1,showLogOutButton:_=!1,openMenu:x,logOut:P,changeRepresentation:S,...R},D)=>{const j=E.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]),[b,A]=E.useState(!1),[W,M]=E.useState(0),[U,z]=E.useState(!1),G=E.useRef(null);E.useEffect(()=>(document.addEventListener("mouseup",B),window.addEventListener("scroll",q),()=>{document.removeEventListener("mouseup",B),window.removeEventListener("scroll",q)}));const H=()=>{z(!U)},B=v=>{G.current&&!G.current.contains(v.target)&&z(!1)},q=()=>{if(l){const v=window.pageYOffset||document.documentElement.scrollTop;if(v<0||Math.abs(v-W)<60)return;A(v>W),M(v)}};return m("header",{...R,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:mt("pkt-header",{"pkt-header--fixed":r,"pkt-header--scroll-to-hide":l,"pkt-header--hidden":b}),ref:D,children:[m("div",{className:"pkt-header__logo",children:[typeof e=="string"?o("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:e,children:o(N,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/8.0/logos/"})}):o("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header__logo-link",onClick:e,children:o(N,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/8.0/logos/"})}),o("span",{className:"pkt-header__logo-service",children:n})]}),o("nav",{className:"pkt-header__actions",children:m("ul",{className:"pkt-header__actions-row",children:[h&&o("li",{children:o(ce,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:x,children:"Meny"})}),(a||s)&&m("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${U&&!b?"pkt-header--open-dropdown":""}`,ref:G,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":U,onClick:H,children:[o(N,{name:"user",className:"pkt-btn__icon"}),o("span",{className:"pkt-header__user-fullname",children:(s==null?void 0:s.name)||(a==null?void 0:a.name)}),o("span",{className:"pkt-header__user-shortname",children:(s==null?void 0:s.shortname)||(a==null?void 0:a.shortname)}),o(N,{name:"chevron-thin-down",className:"pkt-btn--closed"}),o(N,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),m("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[a&&m("li",{children:[o("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),o("div",{className:"pkt-user-menu__name",children:a.name}),a.lastLoggedIn&&m("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",o("time",{children:j})]})]}),i&&o("li",{children:o("ul",{className:"pkt-list",children:i.map((v,L)=>o("li",{children:typeof v.target=="string"?m("a",{href:v.target,className:"pkt-link",children:[v.iconName&&o(N,{name:v.iconName,className:"pkt-link__icon"}),v.title]}):m("button",{className:"pkt-link-button pkt-link",onClick:v.target,children:[v.iconName&&o(N,{name:v.iconName,className:"pkt-link__icon"}),v.title]})},`userMenu-${L}`))})}),(s||p)&&m("li",{children:[s&&m(K,{children:[o("div",{className:"pkt-user-menu__label",children:"Representerer"}),o("div",{className:"pkt-user-menu__name",children:s.name}),s.orgNumber&&m("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",s.orgNumber]})]}),o("ul",{className:"pkt-list mt-size-16",children:p&&o("li",{children:m("button",{className:"pkt-link-button pkt-link",onClick:S,children:[o(N,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),o("li",{children:o("ul",{className:"pkt-list",children:(c||!_)&&m(K,{children:[c==null?void 0:c.map((v,L)=>o("li",{children:typeof v.target=="string"?m("a",{href:v.target,className:"pkt-link",children:[v.iconName&&o(N,{name:v.iconName,className:"pkt-link__icon"}),v.title]}):m("button",{className:"pkt-link-button pkt-link",onClick:v.target,children:[v.iconName&&o(N,{name:v.iconName,className:"pkt-link__icon"}),v.title]})},`userOptions-${L}`)),!_&&o("li",{children:m("button",{className:"pkt-link-button pkt-link",onClick:P,children:[o(N,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),f&&o("li",{className:"footer",children:o("ul",{className:"pkt-list-horizontal bordered",children:f.map((v,L)=>o("li",{children:typeof v.target=="string"?o("a",{href:v.target,className:"pkt-link",children:v.title}):o("button",{className:"pkt-link-button pkt-link",onClick:v.target,children:v.title})},`userMenuFooter-${L}`))})})]})]}),_&&o("li",{children:o(ce,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:P,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),ht=E.forwardRef(({label:e,id:n,children:r,...l},a)=>m("div",{className:"pkt-form-group",children:[o("label",{htmlFor:n,className:"pkt-form-label",children:e}),o("input",{className:"pkt-form-input",id:n,...l,ref:a}),r]}));ht.displayName="PktInput";const Ne=E.forwardRef(({forId:e,label:n,helptext:r,helptextDropdown:l,helptextDropdownButton:a,optional:i,optionalText:s="Valgfritt",required:c,requiredText:f="Må fylles ut",hasError:p,errorMessage:h,disabled:_,inline:x,ariaDescribedby:P,useWrapper:S=!0,children:R,className:D},j)=>{const[b,A]=E.useState(!1),W=()=>{A(!b)},M=()=>i?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":c?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",U=i?s:c?f:"",z=_?"pkt-inputwrapper--disabled":"",G=x?"pkt-inputwrapper--inline":"",H=p?"pkt-inputwrapper--error":"",B=!!l&&l!=="",q=a||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',v=B?"div":"label",L=B?"h2":"span",Y=P||(r?`${e}-helptext`:void 0);return m("div",{className:["pkt-inputwrapper",D,z,G,H].join(" "),ref:j,children:[S?m(K,{children:[o(v,{htmlFor:e,className:"pkt-inputwrapper__label","aria-describedby":B?"":P,children:m(L,{id:`${e}-label`,children:[n,U!==""&&o("span",{className:M(),children:U})]})}),r&&o("div",{className:"pkt-inputwrapper__helptext",id:`${e}-helptext`,dangerouslySetInnerHTML:{__html:r}}),B&&l!==""&&m("div",{children:[o(ce,{skin:"tertiary",size:"small",variant:"icon-right",iconName:b?"chevron-thin-up":"chevron-thin-down",className:"pkt-inputwrapper__helptext-expandable pkt-link pkt-link--icon-right",onClick:W,children:o("span",{dangerouslySetInnerHTML:{__html:q}})}),o("div",{className:`pkt-inputwrapper__helptext ${b?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:o("span",{dangerouslySetInnerHTML:{__html:l}})}),o("label",{htmlFor:e,className:"pkt-sr-only","aria-describedby":Y,children:n})]}),o(K,{children:R})]}):m(K,{children:[o("label",{htmlFor:e,className:"pkt-sr-only","aria-describedby":Y,id:`${e}-label`,children:n}),R]}),p&&h&&o("div",{children:o(Ze,{skin:"error","aria-live":"assertive",id:`${e}-error`,slim:!0,children:h})})]})});Ne.displayName="PktInputWrapper";const kt=E.forwardRef(({children:e,className:n,iconName:r="user",openInNewTab:l=!1,skin:a="normal",href:i="#",external:s=!1,title:c},f)=>{const p=[n,"pkt-linkcard",a&&`pkt-linkcard--${a}`].filter(Boolean).join(" ");return m("a",{href:i,className:`pkt-linkcard pkt-link ${p}`,target:l?"_blank":"_self",rel:l?"noopener noreferrer":void 0,ref:f,children:[o(N,{className:"pkt-link__icon",name:r}),m("div",{className:"pkt-linkcard__content",children:[o("div",{className:`pkt-linkcard__title ${s?"pkt-link pkt-link--external":""}`,children:c}),o("div",{className:"pkt-linkcard__text",children:e})]})]})});kt.displayName="PktLinkCard";const jn=({children:e,skin:n="beige",title:r,className:l,...a})=>{const i=["pkt-messagebox",n&&`pkt-messagebox--${n}`,l].filter(Boolean).join(" ");return m("div",{...a,className:i,children:[o("div",{className:"pkt-messagebox__title",children:r}),o("div",{className:"pkt-messagebox__text",children:e})]})},vt=E.forwardRef(({id:e,name:n,label:r,value:l,...a},i)=>m("div",{className:"pkt-form-group",children:[o("input",{type:"radio",className:"pkt-form-check-input",id:e,name:n,value:l,ref:i,...a}),o("label",{className:"pkt-form-label",htmlFor:e,children:r})]}));vt.displayName="PktRadio";const Dn=({label:e,children:n})=>m(K,{children:[o("p",{children:e}),o("div",{className:"pkt-form-group",children:n})]}),Ln=({isResponsive:e,children:n})=>e?o("div",{className:"pkt-table-container",children:n}):o(K,{children:n}),$n=({isResponsive:e,modifiers:{info:n=!1,success:r=!1,strong:l=!1,shadow:a=!1}={},children:i})=>o(Ln,{isResponsive:e,children:o("table",{className:mt("pkt-table",{"pkt-table--info":n,"pkt-table--success":r,"pkt-table--strong":l,"pkt-table--shadow":a}),children:i})}),In=({children:e})=>o("td",{className:"pkt-table__th",children:e}),Fn=({children:e})=>o("th",{className:"pkt-table__th",children:e}),_t=E.forwardRef(({children:e,className:n,skin:r="blue",textStyle:l="normal-text",size:a="medium",closeTag:i=!1,iconName:s="",type:c="button",ariaLabel:f="close",onClick:p=()=>{}},h)=>{const[_,x]=E.useState(!1),P=j=>{x(!0),p(j)},S=["pkt-tag",a&&`pkt-tag--${a}`,r&&`pkt-tag--${r}`,l&&`pkt-tag--${l}`,n].filter(Boolean).join(" "),R=["pkt-tag","pkt-btn","pkt-btn--tertiary",a&&`pkt-tag--${a}`,r&&`pkt-tag--${r}`,l&&`pkt-tag--${l}`,s&&i?"pkt-btn--icons-right-and-left":null,i&&!s?"pkt-btn--icon-right":null,n].filter(Boolean).join(" "),D=!_;return i&&s?o(K,{children:D&&m("button",{className:R,type:c,"aria-label":f,onClick:P,ref:h,children:[o(N,{className:"pkt-tag__icon",name:s}),e,o(N,{className:"pkt-tag__close-btn",name:"close"})]})}):i?o(K,{children:D&&m("button",{className:R,type:c,"aria-label":f,onClick:P,ref:h,children:[o(N,{className:"pkt-tag__close-btn",name:"close"}),e]})}):s?m("span",{className:S,children:[o(N,{className:"pkt-tag__icon",name:s}),e]}):o("span",{className:S,children:e})});_t.displayName="PktTag";const An=E.forwardRef(({id:e,ariaDescribedby:n,ariaLabelledby:r,counter:l,counterMaxLength:a,className:i,disabled:s,errorMessage:c,hasError:f,helptext:p,helptextDropdown:h,helptextDropdownButton:_,inline:x,fullwidth:P=!1,label:S,name:R,optional:D=!1,optionalText:j,required:b=!1,requiredText:A,placeholder:W,rows:M,useWrapper:U,onChange:z,...G},H)=>{const B=[i,"pkt-textinput","pkt-textarea"].join(" "),q=r||`${e}-label`,v=E.useRef(null),[L,Y]=E.useState(0),ne=Q=>{var ee,ue;if(l&&Y(((ue=(ee=Q.currentTarget)==null?void 0:ee.value)==null?void 0:ue.length)||0),z)return z(Q)};return E.useEffect(()=>{var Q,ee;typeof H=="function"&&H(v.current),l&&Y(((ee=(Q=v==null?void 0:v.current)==null?void 0:Q.value)==null?void 0:ee.length)||0)},[H]),m(Ne,{ariaDescribedby:n,className:B,disabled:s,errorMessage:c,forId:e,hasError:f,helptext:p,helptextDropdown:h,helptextDropdownButton:_,inline:x,label:S,optional:D,optionalText:j,required:b,requiredText:A,useWrapper:U,children:[o("textarea",{ref:v,className:`pkt-input ${P?"pkt-input--fullwidth":""} ${a&&L>a?"pkt-input--counter-error":""}`,name:R||e,id:e,placeholder:W,disabled:s,rows:M,"aria-labelledby":q,"aria-invalid":f,"aria-errormessage":`${e}-error`,"aria-required":b,...G,onChange:ne}),l&&m("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":!0,children:[L||0,a&&`/${a}`]})]})}),Un=E.forwardRef(({id:e,ariaDescribedby:n,ariaLabelledby:r,autocomplete:l="off",className:a,disabled:i=!1,errorMessage:s,hasError:c=!1,helptext:f,helptextDropdown:p,helptextDropdownButton:h,iconNameRight:_,inline:x=!1,fullwidth:P=!1,label:S,name:R,optional:D=!1,optionalText:j,required:b=!1,requiredText:A,placeholder:W,prefix:M,suffix:U,type:z="text",useWrapper:G=!0,value:H,...B},q)=>{const v=[a,"pkt-textinput"].join(" "),L=r||`${e}-label`;return o(Ne,{ariaDescribedby:n,className:v,disabled:i,errorMessage:s,forId:e,hasError:c,helptext:f,helptextDropdown:p,helptextDropdownButton:h,inline:x,label:S,optional:D,optionalText:j,required:b,requiredText:A,useWrapper:G,children:m("div",{className:"pkt-input__container",children:[M&&o("div",{className:"pkt-input-prefix",children:M}),o("input",{ref:q,className:`pkt-input ${P?"pkt-input--fullwidth":""}`,type:z,name:R||e,id:e,placeholder:W,autoComplete:l,value:H,disabled:i,"aria-required":b,"aria-invalid":c,"aria-errormessage":`${e}-error`,"aria-labelledby":L,...B}),U&&m("p",{className:"pkt-input-suffix",children:[U,_&&o(N,{className:"pkt-input-suffix-icon",name:_})]}),!U&&_&&o(N,{className:"pkt-input-icon",name:_})]})})});T.PktAlert=Ze,T.PktBackLink=Yt,T.PktBreadcrumbs=Pn,T.PktButton=ce,T.PktFooter=Rn,T.PktFooterSimple=Sn,T.PktHeader=Tn,T.PktIcon=N,T.PktInput=ht,T.PktInputWrapper=Ne,T.PktLinkCard=kt,T.PktMessagebox=jn,T.PktRadio=vt,T.PktRadioGroup=Dn,T.PktTable=$n,T.PktTableData=In,T.PktTableHeader=Fn,T.PktTag=_t,T.PktTextarea=An,T.PktTextinput=Un,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 c=r.apply(null,i);c&&o.push(c)}}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=E.forwardRef(({logoLink:e="https://www.oslo.kommune.no/",serviceName:n,fixed:r=!0,scrollToHide:o=!0,user:a,userMenu:i,representing:s,userOptions:c,userMenuFooter:f,canChangeRepresentation:d=!0,showMenuButton:h=!1,showLogOutButton:_=!1,openMenu:x,logOut:P,changeRepresentation:O,...S},D)=>{const R=E.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,L]=E.useState(!1),[U,V]=E.useState(0),[B,Y]=E.useState(!1),q=E.useRef(null);E.useEffect(()=>(document.addEventListener("mouseup",K),window.addEventListener("scroll",M),()=>{document.removeEventListener("mouseup",K),window.removeEventListener("scroll",M)}));const J=()=>{Y(!B)},K=v=>{q.current&&!q.current.contains(v.target)&&Y(!1)},M=()=>{if(o){const v=window.pageYOffset||document.documentElement.scrollTop;if(v<0||Math.abs(v-U)<60)return;L(v>U),V(v)}};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(N,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/9.0/logos/"})}):l("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header__logo-link",onClick:e,children:l(N,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/9.0/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:x,children:"Meny"})}),(a||s)&&m("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${B&&!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":B,onClick:J,children:[l(N,{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(N,{name:"chevron-thin-down",className:"pkt-btn--closed"}),l(N,{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:R})]})]}),i&&l("li",{children:l("ul",{className:"pkt-list",children:i.map((v,$)=>l("li",{children:typeof v.target=="string"?m("a",{href:v.target,className:"pkt-link",children:[v.iconName&&l(N,{name:v.iconName,className:"pkt-link__icon"}),v.title]}):m("button",{className:"pkt-link-button pkt-link",onClick:v.target,children:[v.iconName&&l(N,{name:v.iconName,className:"pkt-link__icon"}),v.title]})},`userMenu-${$}`))})}),(s||d)&&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:d&&l("li",{children:m("button",{className:"pkt-link-button pkt-link",onClick:O,children:[l(N,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),l("li",{children:l("ul",{className:"pkt-list",children:(c||!_)&&m(Z,{children:[c==null?void 0:c.map((v,$)=>l("li",{children:typeof v.target=="string"?m("a",{href:v.target,className:"pkt-link",children:[v.iconName&&l(N,{name:v.iconName,className:"pkt-link__icon"}),v.title]}):m("button",{className:"pkt-link-button pkt-link",onClick:v.target,children:[v.iconName&&l(N,{name:v.iconName,className:"pkt-link__icon"}),v.title]})},`userOptions-${$}`)),!_&&l("li",{children:m("button",{className:"pkt-link-button pkt-link",onClick:P,children:[l(N,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),f&&l("li",{className:"footer",children:l("ul",{className:"pkt-list-horizontal bordered",children:f.map((v,$)=>l("li",{children:typeof v.target=="string"?l("a",{href:v.target,className:"pkt-link",children:v.title}):l("button",{className:"pkt-link-button pkt-link",onClick:v.target,children:v.title})},`userMenuFooter-${$}`))})})]})]}),_&&l("li",{children:l(ce,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:P,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),kt=E.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 Ne=E.forwardRef(({forId:e,label:n,helptext:r,helptextDropdown:o,helptextDropdownButton:a,optional:i,optionalText:s="Valgfritt",required:c,requiredText:f="Må fylles ut",hasError:d,errorMessage:h,disabled:_,inline:x,ariaDescribedby:P,useWrapper:O=!0,children:S,className:D,hasFieldset:R=!1},g)=>{const[L,U]=E.useState(!1),V=()=>{U(!L)},B=()=>i?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":c?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",Y=i?s:c?f:"",q=_?"pkt-inputwrapper--disabled":"",J=x?"pkt-inputwrapper--inline":"",K=d?"pkt-inputwrapper--error":"",M=!!o&&o!=="",v=a||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',$=R?"fieldset":M?"div":"label",H=R?"legend":M?"h2":"span",G=P||(r?`${e}-helptext`:void 0);return m("div",{className:["pkt-inputwrapper",D,q,J,K].join(" "),ref:g,children:[O?l(Z,{children:m($,{htmlFor:e,"aria-describedby":M?"":P,className:`pkt-inputwrapper__label${R?" pkt-inputwrapper__fieldset":""}`,children:[m(H,{id:`${e}-label`,className:`${R?" pkt-inputwrapper__legend":""}`,children:[n,Y!==""&&l("span",{className:B(),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:L?"chevron-thin-up":"chevron-thin-down",className:"pkt-inputwrapper__helptext-expandable pkt-link pkt-link--icon-right",onClick:V,children:l("span",{dangerouslySetInnerHTML:{__html:v}})}),l("div",{className:`pkt-inputwrapper__helptext ${L?"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]}),d&&h&&l("div",{children:l(Ze,{skin:"error","aria-live":"assertive",id:`${e}-error`,slim:!0,children:h})})]})});Ne.displayName="PktInputWrapper";const vt=E.forwardRef(({children:e,className:n,iconName:r="user",openInNewTab:o=!1,skin:a="normal",href:i="#",external:s=!1,title:c},f)=>{const d=[n,"pkt-linkcard",a&&`pkt-linkcard--${a}`].filter(Boolean).join(" ");return m("a",{href:i,className:`pkt-linkcard pkt-link ${d}`,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,ref:f,children:[l(N,{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:c}),l("div",{className:"pkt-linkcard__text",children:e})]})]})});vt.displayName="PktLinkCard";const Dn=({children:e,skin:n="beige",title:r,className:o,...a})=>{const i=["pkt-messagebox",n&&`pkt-messagebox--${n}`,o].filter(Boolean).join(" ");return m("div",{...a,className:i,children:[l("div",{className:"pkt-messagebox__title",children:r}),l("div",{className:"pkt-messagebox__text",children:e})]})},_t=E.forwardRef(({id:e,name:n,label:r,className:o,hasTile:a=!1,disabled:i=!1,checkHelptext:s,hasError:c=!1,...f},d)=>{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:d,className:`pkt-input-check__input-checkbox ${c?"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=({isResponsive:e,children:n})=>e?l("div",{className:"pkt-table-container",children:n}):l(Z,{children:n}),Ln=({isResponsive:e,modifiers:{info:n=!1,success:r=!1,strong:o=!1,shadow:a=!1}={},children:i})=>l($n,{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})}),In=({children:e})=>l("td",{className:"pkt-table__th",children:e}),Fn=({children:e})=>l("th",{className:"pkt-table__th",children:e}),bt=E.forwardRef(({children:e,className:n,skin:r="blue",textStyle:o="normal-text",size:a="medium",closeTag:i=!1,iconName:s="",type:c="button",ariaLabel:f="close",onClick:d=()=>{}},h)=>{const[_,x]=E.useState(!1),P=R=>{x(!0),d(R)},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=!_;return i&&s?l(Z,{children:D&&m("button",{className:S,type:c,"aria-label":f,onClick:P,ref:h,children:[l(N,{className:"pkt-tag__icon",name:s}),e,l(N,{className:"pkt-tag__close-btn",name:"close"})]})}):i?l(Z,{children:D&&m("button",{className:S,type:c,"aria-label":f,onClick:P,ref:h,children:[l(N,{className:"pkt-tag__close-btn",name:"close"}),e]})}):s?m("span",{className:O,children:[l(N,{className:"pkt-tag__icon",name:s}),e]}):l("span",{className:O,children:e})});bt.displayName="PktTag";const An=E.forwardRef(({id:e,ariaDescribedby:n,ariaLabelledby:r,counter:o,counterMaxLength:a,className:i,disabled:s,errorMessage:c,hasError:f,helptext:d,helptextDropdown:h,helptextDropdownButton:_,inline:x,fullwidth:P=!1,label:O,name:S,optional:D=!1,optionalText:R,required:g=!1,requiredText:L,placeholder:U,rows:V,useWrapper:B,onChange:Y,...q},J)=>{const K=[i,"pkt-textinput","pkt-textarea"].join(" "),M=r||`${e}-label`,v=E.useRef(null),[$,H]=E.useState(0),G=ee=>{var te,ue;if(o&&H(((ue=(te=ee.currentTarget)==null?void 0:te.value)==null?void 0:ue.length)||0),Y)return Y(ee)};return E.useEffect(()=>{var ee,te;typeof J=="function"&&J(v.current),o&&H(((te=(ee=v==null?void 0:v.current)==null?void 0:ee.value)==null?void 0:te.length)||0)},[J]),m(Ne,{ariaDescribedby:n,className:K,disabled:s,errorMessage:c,forId:e,hasError:f,helptext:d,helptextDropdown:h,helptextDropdownButton:_,inline:x,label:O,optional:D,optionalText:R,required:g,requiredText:L,useWrapper:B,children:[l("textarea",{ref:v,className:`pkt-input ${P?"pkt-input--fullwidth":""} ${a&&$>a?"pkt-input--counter-error":""}`,name:S||e,id:e,placeholder:U,disabled:s,rows:V,"aria-labelledby":M,"aria-invalid":f,"aria-errormessage":`${e}-error`,"aria-required":g,...q,onChange:G}),o&&m("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":!0,children:[$||0,a&&`/${a}`]})]})}),Un=E.forwardRef(({id:e,ariaDescribedby:n,ariaLabelledby:r,autocomplete:o="off",className:a,disabled:i=!1,errorMessage:s,hasError:c=!1,helptext:f,helptextDropdown:d,helptextDropdownButton:h,iconNameRight:_,inline:x=!1,fullwidth:P=!1,label:O,name:S,optional:D=!1,optionalText:R,required:g=!1,requiredText:L,placeholder:U,prefix:V,suffix:B,type:Y="text",useWrapper:q=!0,value:J,...K},M)=>{const v=[a,"pkt-textinput"].join(" "),$=r||`${e}-label`;return l(Ne,{ariaDescribedby:n,className:v,disabled:i,errorMessage:s,forId:e,hasError:c,helptext:f,helptextDropdown:d,helptextDropdownButton:h,inline:x,label:O,optional:D,optionalText:R,required:g,requiredText:L,useWrapper:q,children:m("div",{className:"pkt-input__container",children:[V&&l("div",{className:"pkt-input-prefix",children:V}),l("input",{ref:M,className:`pkt-input ${P?"pkt-input--fullwidth":""}`,type:Y,name:S||e,id:e,placeholder:U,autoComplete:o,value:J,disabled:i,"aria-required":g,"aria-invalid":c,"aria-errormessage":`${e}-error`,"aria-labelledby":$,...K}),B&&m("p",{className:"pkt-input-suffix",children:[B,_&&l(N,{className:"pkt-input-suffix-icon",name:_})]}),!B&&_&&l(N,{className:"pkt-input-icon",name:_})]})})});j.PktAlert=Ze,j.PktBackLink=Jt,j.PktBreadcrumbs=Rn,j.PktButton=ce,j.PktCheckbox=dt,j.PktFooter=Sn,j.PktFooterSimple=On,j.PktHeader=jn,j.PktIcon=N,j.PktInput=kt,j.PktInputWrapper=Ne,j.PktLinkCard=vt,j.PktMessagebox=Dn,j.PktRadioButton=_t,j.PktTable=Ln,j.PktTableData=In,j.PktTableHeader=Fn,j.PktTag=bt,j.PktTextarea=An,j.PktTextinput=Un,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IRadio extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
label: string;
|
|
6
|
+
hasTile?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
checkHelptext?: string;
|
|
9
|
+
hasError?: boolean;
|
|
10
|
+
value?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const PktRadioButton: React.ForwardRefExoticComponent<IRadio & React.RefAttributes<HTMLInputElement>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.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",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"test": "react-scripts test --env=jsdom"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@oslokommune/punkt-assets": "^
|
|
36
|
-
"@oslokommune/punkt-css": "^
|
|
35
|
+
"@oslokommune/punkt-assets": "^9.0.0",
|
|
36
|
+
"@oslokommune/punkt-css": "^9.0.0",
|
|
37
37
|
"@testing-library/jest-dom": "^5.16.5",
|
|
38
38
|
"@testing-library/react": "^14.0.0",
|
|
39
39
|
"@testing-library/user-event": "^14.4.3",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
92
92
|
},
|
|
93
93
|
"license": "MIT",
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "2c085a50eaada0c831c21d33b6093d1b4ad44a34"
|
|
95
95
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
2
|
+
|
|
3
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
4
|
+
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
5
|
+
|
|
6
|
+
import { PktCheckbox } from './Checkbox';
|
|
7
|
+
|
|
8
|
+
expect.extend(toHaveNoViolations)
|
|
9
|
+
|
|
10
|
+
describe('PktCheckbox', () => {
|
|
11
|
+
// Test case for rendering a basic checkbox
|
|
12
|
+
it('renders a basic checkbox with label', () => {
|
|
13
|
+
const { getByLabelText } = render(<PktCheckbox id="myCheckbox" label="My Checkbox" />);
|
|
14
|
+
|
|
15
|
+
// Check if the label is present in the document
|
|
16
|
+
const checkboxLabel = getByLabelText('My Checkbox');
|
|
17
|
+
expect(checkboxLabel).toBeInTheDocument();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
it('renders an error state checkbox', () => {
|
|
22
|
+
render(<PktCheckbox id="myCheckbox" label="My Checkbox" hasError />);
|
|
23
|
+
const checkbox = screen.getByRole('checkbox', { name: 'My Checkbox' });
|
|
24
|
+
|
|
25
|
+
// Verify that the error class is applied to the checkbox
|
|
26
|
+
expect(checkbox).toHaveClass('pkt-input-check__input-checkbox--error');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('renders a default checked checkbox', () => {
|
|
30
|
+
const { getByRole } = render(
|
|
31
|
+
<PktCheckbox id="myCheckbox" label="My Checkbox" defaultChecked={true} />
|
|
32
|
+
);
|
|
33
|
+
// Find the checkbox element by its "checkbox" role
|
|
34
|
+
const checkbox = getByRole('checkbox') as HTMLInputElement;
|
|
35
|
+
// Verify that the checkbox is initially checked
|
|
36
|
+
expect(checkbox).toBeChecked();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('handles onClick callback', () => {
|
|
40
|
+
const onClickMock = jest.fn();
|
|
41
|
+
const { getByLabelText } = render(
|
|
42
|
+
<PktCheckbox id="myCheckbox" label="My Checkbox" onClick={onClickMock} />
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// Get the checkbox label element
|
|
46
|
+
const checkboxLabel = getByLabelText('My Checkbox');
|
|
47
|
+
|
|
48
|
+
// Simulate a click event on the checkbox label
|
|
49
|
+
fireEvent.click(checkboxLabel);
|
|
50
|
+
|
|
51
|
+
// Verify that the onClick callback is called
|
|
52
|
+
expect(onClickMock).toHaveBeenCalledTimes(1);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
describe('accessibility', () => {
|
|
57
|
+
it('renders with no wcag errors with axe', async () => {
|
|
58
|
+
const { container } = render(<PktCheckbox id="accessibilityTest" label="My checkkbox"></PktCheckbox>)
|
|
59
|
+
const results = await axe(container)
|
|
60
|
+
|
|
61
|
+
expect(results).toHaveNoViolations()
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
})
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { ForwardedRef, forwardRef } from 'react'
|
|
2
|
+
|
|
3
|
+
export interface IPktCheckbox extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
id: string;
|
|
5
|
+
hasTile?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
checkHelptext?: string;
|
|
9
|
+
hasError?: boolean;
|
|
10
|
+
defaultChecked?: boolean;
|
|
11
|
+
value?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const PktCheckbox = forwardRef(
|
|
15
|
+
({
|
|
16
|
+
id,
|
|
17
|
+
hasTile = false,
|
|
18
|
+
disabled = false,
|
|
19
|
+
label,
|
|
20
|
+
checkHelptext,
|
|
21
|
+
hasError = false,
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: IPktCheckbox,
|
|
25
|
+
ref: ForwardedRef<HTMLInputElement>,
|
|
26
|
+
): React.ReactElement => {
|
|
27
|
+
|
|
28
|
+
// Define the classes
|
|
29
|
+
const classes = [
|
|
30
|
+
className,
|
|
31
|
+
'pkt-input-check',
|
|
32
|
+
].filter(Boolean)
|
|
33
|
+
.join(' ')
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div className={classes}>
|
|
37
|
+
<div className={`pkt-input-check__input ${hasTile ? 'pkt-input-check__input--tile' : ''}`}>
|
|
38
|
+
<input
|
|
39
|
+
ref={ref}
|
|
40
|
+
className={`pkt-input-check__input-checkbox ${hasError ? 'pkt-input-check__input-checkbox--error' : ''}`}
|
|
41
|
+
type="checkbox"
|
|
42
|
+
id={id}
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
<label className="pkt-input-check__input-label" htmlFor={id}>
|
|
47
|
+
{label}
|
|
48
|
+
{checkHelptext && (
|
|
49
|
+
<div className="pkt-input-check__input-helptext">
|
|
50
|
+
{checkHelptext}
|
|
51
|
+
</div>
|
|
52
|
+
)}
|
|
53
|
+
</label>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
PktCheckbox.displayName = 'PktCheckbox'
|
package/src/components/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { PktAlert } from './alert/Alert'
|
|
|
2
2
|
export { PktBackLink } from './backlink/BackLink'
|
|
3
3
|
export { PktBreadcrumbs } from './breadcrumbs/Breadcrumbs'
|
|
4
4
|
export { PktButton } from './button/Button'
|
|
5
|
+
export { PktCheckbox } from './checkbox/Checkbox'
|
|
5
6
|
export { PktFooter } from './footer/Footer'
|
|
6
7
|
export { PktFooterSimple } from './footerSimple/FooterSimple'
|
|
7
8
|
export { PktHeader } from './header/Header'
|
|
@@ -10,8 +11,7 @@ export { PktInput } from './input/Input'
|
|
|
10
11
|
export { PktInputWrapper } from './inputwrapper/InputWrapper'
|
|
11
12
|
export { PktLinkCard } from './linkcard/LinkCard'
|
|
12
13
|
export { PktMessagebox } from './messagebox/Messagebox'
|
|
13
|
-
export {
|
|
14
|
-
export { PktRadioGroup } from './radioGroup/RadioGroup'
|
|
14
|
+
export { PktRadioButton } from './radio/RadioButton'
|
|
15
15
|
export { PktTable } from './table/Table'
|
|
16
16
|
export { PktTableData } from './table/TableData'
|
|
17
17
|
export { PktTableHeader } from './table/TableHeader'
|