@oslokommune/punkt-react 11.14.1 → 11.14.2
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 +129 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/stepper/Step.d.ts +21 -0
- package/dist/components/stepper/Stepper.d.ts +28 -0
- package/dist/components/stepper/Stepper.test.d.ts +1 -0
- package/dist/punkt-react.es.js +820 -783
- package/dist/punkt-react.umd.js +12 -12
- package/package.json +3 -3
- package/src/components/accordion/Accordion.test.tsx +1 -4
- package/src/components/index.ts +2 -0
- package/src/components/stepper/Step.tsx +59 -0
- package/src/components/stepper/Stepper.test.tsx +93 -0
- package/src/components/stepper/Stepper.tsx +67 -0
package/dist/punkt-react.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(x,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom"],m):(x=typeof globalThis<"u"?globalThis:x||self,m(x["punkt-react"]={},x.React,x.reactRouterDom))})(this,function(x,m,Ee){"use strict";function
|
|
1
|
+
(function(x,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom"],m):(x=typeof globalThis<"u"?globalThis:x||self,m(x["punkt-react"]={},x.React,x.reactRouterDom))})(this,function(x,m,Ee){"use strict";function st(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var me={exports:{}},ne={};/**
|
|
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 Se;function at(){if(Se)return ne;Se=1;var r=m,n=Symbol.for("react.element"),o=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,c=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(a,u,p){var k,_={},j=null,y=null;p!==void 0&&(j=""+p),u.key!==void 0&&(j=""+u.key),u.ref!==void 0&&(y=u.ref);for(k in u)l.call(u,k)&&!s.hasOwnProperty(k)&&(_[k]=u[k]);if(a&&a.defaultProps)for(k in u=a.defaultProps,u)_[k]===void 0&&(_[k]=u[k]);return{$$typeof:n,type:a,key:j,ref:y,props:_,_owner:c.current}}return ne.Fragment=o,ne.jsx=d,ne.jsxs=d,ne}var se={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,23 +14,23 @@
|
|
|
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
|
|
18
|
-
`+xe+t}}var je=!1,de;{var
|
|
19
|
-
`),
|
|
20
|
-
`),I=N.length-1,D=
|
|
21
|
-
`+N[I].replace(" at new "," at ");return t.displayName&&
|
|
17
|
+
*/var Te;function lt(){return Te||(Te=1,process.env.NODE_ENV!=="production"&&function(){var r=m,n=Symbol.for("react.element"),o=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),S=Symbol.iterator,O="@@iterator";function R(t){if(t===null||typeof t!="object")return null;var i=S&&t[S]||t[O];return typeof i=="function"?i:null}var E=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(t){{for(var i=arguments.length,f=new Array(i>1?i-1:0),b=1;b<i;b++)f[b-1]=arguments[b];g("error",t,f)}}function g(t,i,f){{var b=E.ReactDebugCurrentFrame,P=b.getStackAddendum();P!==""&&(i+="%s",f=f.concat([P]));var T=f.map(function(w){return String(w)});T.unshift("Warning: "+i),Function.prototype.apply.call(console[t],console,T)}}var F=!1,H=!1,W=!1,V=!1,G=!1,M;M=Symbol.for("react.module.reference");function J(t){return!!(typeof t=="string"||typeof t=="function"||t===l||t===s||G||t===c||t===p||t===k||V||t===y||F||H||W||typeof t=="object"&&t!==null&&(t.$$typeof===j||t.$$typeof===_||t.$$typeof===d||t.$$typeof===a||t.$$typeof===u||t.$$typeof===M||t.getModuleId!==void 0))}function z(t,i,f){var b=t.displayName;if(b)return b;var P=i.displayName||i.name||"";return P!==""?f+"("+P+")":f}function U(t){return t.displayName||"Context"}function $(t){if(t==null)return null;if(typeof t.tag=="number"&&C("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 l:return"Fragment";case o:return"Portal";case s:return"Profiler";case c:return"StrictMode";case p:return"Suspense";case k:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case a:var i=t;return U(i)+".Consumer";case d:var f=t;return U(f._context)+".Provider";case u:return z(t,t.render,"ForwardRef");case _:var b=t.displayName||null;return b!==null?b:$(t.type)||"Memo";case j:{var P=t,T=P._payload,w=P._init;try{return $(w(T))}catch{return null}}}return null}var h=Object.assign,A=0,X,Z,le,Be,Ue,We,Ve;function Me(){}Me.__reactDisabledLog=!0;function Mt(){{if(A===0){X=console.log,Z=console.info,le=console.warn,Be=console.error,Ue=console.group,We=console.groupCollapsed,Ve=console.groupEnd;var t={configurable:!0,enumerable:!0,value:Me,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}A++}}function Yt(){{if(A--,A===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:h({},t,{value:X}),info:h({},t,{value:Z}),warn:h({},t,{value:le}),error:h({},t,{value:Be}),group:h({},t,{value:Ue}),groupCollapsed:h({},t,{value:We}),groupEnd:h({},t,{value:Ve})})}A<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ve=E.ReactCurrentDispatcher,xe;function ue(t,i,f){{if(xe===void 0)try{throw Error()}catch(P){var b=P.stack.trim().match(/\n( *(at )?)/);xe=b&&b[1]||""}return`
|
|
18
|
+
`+xe+t}}var je=!1,de;{var Ht=typeof WeakMap=="function"?WeakMap:Map;de=new Ht}function Ye(t,i){if(!t||je)return"";{var f=de.get(t);if(f!==void 0)return f}var b;je=!0;var P=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var T;T=ve.current,ve.current=null,Mt();try{if(i){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(K){b=K}Reflect.construct(t,[],w)}else{try{w.call()}catch(K){b=K}t.call(w.prototype)}}else{try{throw Error()}catch(K){b=K}t()}}catch(K){if(K&&b&&typeof K.stack=="string"){for(var N=K.stack.split(`
|
|
19
|
+
`),Y=b.stack.split(`
|
|
20
|
+
`),I=N.length-1,D=Y.length-1;I>=1&&D>=0&&N[I]!==Y[D];)D--;for(;I>=1&&D>=0;I--,D--)if(N[I]!==Y[D]){if(I!==1||D!==1)do if(I--,D--,D<0||N[I]!==Y[D]){var q=`
|
|
21
|
+
`+N[I].replace(" at new "," at ");return t.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",t.displayName)),typeof t=="function"&&de.set(t,q),q}while(I>=1&&D>=0);break}}}finally{je=!1,ve.current=T,Yt(),Error.prepareStackTrace=P}var re=t?t.displayName||t.name:"",Q=re?ue(re):"";return typeof t=="function"&&de.set(t,Q),Q}function zt(t,i,f){return Ye(t,!1)}function Kt(t){var i=t.prototype;return!!(i&&i.isReactComponent)}function fe(t,i,f){if(t==null)return"";if(typeof t=="function")return Ye(t,Kt(t));if(typeof t=="string")return ue(t);switch(t){case p:return ue("Suspense");case k:return ue("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case u:return zt(t.render);case _:return fe(t.type,i,f);case j:{var b=t,P=b._payload,T=b._init;try{return fe(T(P),i,f)}catch{}}}return""}var ie=Object.prototype.hasOwnProperty,He={},ze=E.ReactDebugCurrentFrame;function ke(t){if(t){var i=t._owner,f=fe(t.type,t._source,i?i.type:null);ze.setExtraStackFrame(f)}else ze.setExtraStackFrame(null)}function Gt(t,i,f,b,P){{var T=Function.call.bind(ie);for(var w in t)if(T(t,w)){var N=void 0;try{if(typeof t[w]!="function"){var Y=Error((b||"React class")+": "+f+" 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 Y.name="Invariant Violation",Y}N=t[w](i,w,b,f,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(I){N=I}N&&!(N instanceof Error)&&(ke(P),C("%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).",b||"React class",f,w,typeof N),ke(null)),N instanceof Error&&!(N.message in He)&&(He[N.message]=!0,ke(P),C("Failed %s type: %s",f,N.message),ke(null))}}}var Jt=Array.isArray;function ge(t){return Jt(t)}function qt(t){{var i=typeof Symbol=="function"&&Symbol.toStringTag,f=i&&t[Symbol.toStringTag]||t.constructor.name||"Object";return f}}function Xt(t){try{return Ke(t),!1}catch{return!0}}function Ke(t){return""+t}function Ge(t){if(Xt(t))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qt(t)),Ke(t)}var oe=E.ReactCurrentOwner,Zt={key:!0,ref:!0,__self:!0,__source:!0},Je,qe,Ne;Ne={};function Qt(t){if(ie.call(t,"ref")){var i=Object.getOwnPropertyDescriptor(t,"ref").get;if(i&&i.isReactWarning)return!1}return t.ref!==void 0}function er(t){if(ie.call(t,"key")){var i=Object.getOwnPropertyDescriptor(t,"key").get;if(i&&i.isReactWarning)return!1}return t.key!==void 0}function tr(t,i){if(typeof t.ref=="string"&&oe.current&&i&&oe.current.stateNode!==i){var f=$(oe.current.type);Ne[f]||(C('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',$(oe.current.type),t.ref),Ne[f]=!0)}}function rr(t,i){{var f=function(){Je||(Je=!0,C("%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)",i))};f.isReactWarning=!0,Object.defineProperty(t,"key",{get:f,configurable:!0})}}function nr(t,i){{var f=function(){qe||(qe=!0,C("%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)",i))};f.isReactWarning=!0,Object.defineProperty(t,"ref",{get:f,configurable:!0})}}var sr=function(t,i,f,b,P,T,w){var N={$$typeof:n,type:t,key:i,ref:f,props:w,_owner:T};return N._store={},Object.defineProperty(N._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(N,"_self",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.defineProperty(N,"_source",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.freeze&&(Object.freeze(N.props),Object.freeze(N)),N};function ar(t,i,f,b,P){{var T,w={},N=null,Y=null;f!==void 0&&(Ge(f),N=""+f),er(i)&&(Ge(i.key),N=""+i.key),Qt(i)&&(Y=i.ref,tr(i,P));for(T in i)ie.call(i,T)&&!Zt.hasOwnProperty(T)&&(w[T]=i[T]);if(t&&t.defaultProps){var I=t.defaultProps;for(T in I)w[T]===void 0&&(w[T]=I[T])}if(N||Y){var D=typeof t=="function"?t.displayName||t.name||"Unknown":t;N&&rr(w,D),Y&&nr(w,D)}return sr(t,N,Y,P,b,oe.current,w)}}var ye=E.ReactCurrentOwner,Xe=E.ReactDebugCurrentFrame;function te(t){if(t){var i=t._owner,f=fe(t.type,t._source,i?i.type:null);Xe.setExtraStackFrame(f)}else Xe.setExtraStackFrame(null)}var we;we=!1;function Pe(t){return typeof t=="object"&&t!==null&&t.$$typeof===n}function Ze(){{if(ye.current){var t=$(ye.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 lr(t){{if(t!==void 0){var i=t.fileName.replace(/^.*[\\\/]/,""),f=t.lineNumber;return`
|
|
24
24
|
|
|
25
|
-
Check your code at `+
|
|
25
|
+
Check your code at `+i+":"+f+"."}return""}}var Qe={};function ir(t){{var i=Ze();if(!i){var f=typeof t=="string"?t:t.displayName||t.name;f&&(i=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+f+">.")}return
|
|
27
|
+
Check the top-level render call using <`+f+">.")}return i}}function et(t,i){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var f=ir(i);if(Qe[f])return;Qe[f]=!0;var b="";t&&t._owner&&t._owner!==ye.current&&(b=" It was passed a child from "+$(t._owner.type)+"."),te(t),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',f,b),te(null)}}function tt(t,i){{if(typeof t!="object")return;if(ge(t))for(var f=0;f<t.length;f++){var b=t[f];Pe(b)&&et(b,i)}else if(Pe(t))t._store&&(t._store.validated=!0);else if(t){var P=R(t);if(typeof P=="function"&&P!==t.entries)for(var T=P.call(t),w;!(w=T.next()).done;)Pe(w.value)&&et(w.value,i)}}}function or(t){{var i=t.type;if(i==null||typeof i=="string")return;var f;if(typeof i=="function")f=i.propTypes;else if(typeof i=="object"&&(i.$$typeof===u||i.$$typeof===_))f=i.propTypes;else return;if(f){var b=$(i);Gt(f,t.props,"prop",b,t)}else if(i.PropTypes!==void 0&&!we){we=!0;var P=$(i);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",P||"Unknown")}typeof i.getDefaultProps=="function"&&!i.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function cr(t){{for(var i=Object.keys(t.props),f=0;f<i.length;f++){var b=i[f];if(b!=="children"&&b!=="key"){te(t),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",b),te(null);break}}t.ref!==null&&(te(t),C("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}}var rt={};function nt(t,i,f,b,P,T){{var w=J(t);if(!w){var N="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(N+=" 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 Y=lr(P);Y?N+=Y:N+=Ze();var I;t===null?I="null":ge(t)?I="array":t!==void 0&&t.$$typeof===n?(I="<"+($(t.type)||"Unknown")+" />",N=" Did you accidentally export a JSX literal instead of a component?"):I=typeof t,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",I,N)}var D=ar(t,i,f,P,T);if(D==null)return D;if(w){var q=i.children;if(q!==void 0)if(b)if(ge(q)){for(var re=0;re<q.length;re++)tt(q[re],t);Object.freeze&&Object.freeze(q)}else C("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 tt(q,t)}if(ie.call(i,"key")){var Q=$(t),K=Object.keys(i).filter(function(mr){return mr!=="key"}),Ce=K.length>0?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}";if(!rt[Q+Ce]){var kr=K.length>0?"{"+K.join(": ..., ")+": ...}":"{}";C(`A props object containing a "key" prop is being spread into JSX:
|
|
28
28
|
let props = %s;
|
|
29
29
|
<%s {...props} />
|
|
30
30
|
React keys must be passed directly to JSX without using spread:
|
|
31
31
|
let props = %s;
|
|
32
|
-
<%s key={someKey} {...props} />`,Ce,Q,
|
|
32
|
+
<%s key={someKey} {...props} />`,Ce,Q,kr,Q),rt[Q+Ce]=!0}}return t===l?cr(D):or(D),D}}function pr(t,i,f){return nt(t,i,f,!0)}function ur(t,i,f){return nt(t,i,f,!1)}var dr=ur,fr=pr;se.Fragment=l,se.jsx=dr,se.jsxs=fr}()),se}process.env.NODE_ENV==="production"?me.exports=at():me.exports=lt();var e=me.exports;const it=m.forwardRef(({compact:r=!1,skin:n="borderless",className:o,children:l},c)=>{const s=[o,"pkt-accordion",r&&"pkt-accordion--compact",n&&`pkt-accordion--${n}`].filter(Boolean).join(" ");return e.jsx("div",{"data-testid":"pkt-accordion",className:s,ref:c,children:l})}),he='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',ot="https://punkt-cdn.oslo.kommune.no/11.14/icons/";function ct(r){return new Promise(n=>setTimeout(n,r))}const _e={},pt=async(r,n)=>{let o=0;for(;_e[n+r+".svg"]==="fetching"&&(o++,!(o>50));)await ct(50);return localStorage.getItem(n+r+".svg")?Promise.resolve(localStorage.getItem(n+r+".svg")):typeof window.fetch=="function"?(_e[n+r+".svg"]="fetching",Promise.resolve(fetch(n+r+".svg").then(l=>l.ok?l.text():(console.error("Missing icon: "+n+r+".svg"),he)).then(l=>(l!==he&&localStorage.setItem(n+r+".svg",l),_e[n+r+".svg"]="fetched",l)))):Promise.resolve(he)},ut={fetchIcon:async(r,n)=>pt(r,n||ot)},$e=m.createContext(ut),v=({name:r,path:n,className:o="",...l})=>{const[c,s]=m.useState(null),d=m.useContext($e);return m.useEffect(()=>{r?d.fetchIcon(r,n).then(s):s(null)},[r,n]),c?e.jsx("span",{className:`pkt-icon ${o}`,dangerouslySetInnerHTML:{__html:c},...l}):null};var Re={exports:{}};/*!
|
|
33
33
|
Copyright (c) 2018 Jed Watson.
|
|
34
34
|
Licensed under the MIT License (MIT), see
|
|
35
35
|
http://jedwatson.github.io/classnames
|
|
36
|
-
*/(function(r){(function(){var n={}.hasOwnProperty;function c(){for(var a="",d=0;d<arguments.length;d++){var s=arguments[d];s&&(a=o(a,i(s)))}return a}function i(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return c.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var d="";for(var s in a)n.call(a,s)&&a[s]&&(d=o(d,s));return d}function o(a,d){return d?a?a+" "+d:a+d:a}r.exports?(c.default=c,r.exports=c):window.classNames=c})()})(Re);var dt=Re.exports;const z=at(dt),ft=m.forwardRef(({title:r,className:n,children:c,toggleProps:i,defaultOpen:o=!1,id:a},d)=>{const[s,u]=m.useState(o),p=i?i.isOpen:s,k=y=>y??void 0,_=(y,T)=>{y.preventDefault(),i!==void 0&&i.onToggleClick(y,T),u(!p)},j=z(n,"pkt-accordion-item");return e.jsxs("details",{className:j,ref:d,id:a,open:k(i?i.isOpen:s),children:[e.jsxs("summary",{className:"pkt-accordion-item__title",id:`pkt-accordion-item-summary-${a}`,onClick:y=>_(y,a),children:[r,e.jsx(v,{name:"chevron-thin-down",className:"pkt-accordion-item__icon","aria-hidden":"true"})]}),e.jsx("div",{id:`pkt-accordion-item-content-${a}`,role:"region",className:"pkt-accordion-item__content",children:c})]})}),Ie=m.forwardRef(({children:r,className:n,skin:c="info",closeAlert:i=!1,onClose:o,title:a,date:d,ariaLive:s="polite",compact:u=!1,...p},k)=>{const _=[n,"pkt-alert",c&&`pkt-alert--${c}`,u&&"pkt-alert--compact"].filter(Boolean).join(" "),[j,y]=m.useState(!0),T=()=>{y(!1),o&&o()};return j?e.jsxs("div",{...p,className:_,"aria-live":s,ref:k,children:[e.jsx(v,{className:"pkt-alert__icon",name:c==="info"?"alert-information":`alert-${c}`}),i&&e.jsx("div",{className:"pkt-alert__close",children:e.jsx("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:T,children:e.jsx(v,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),a&&e.jsx("div",{className:"pkt-alert__title",children:a}),e.jsx("div",{className:"pkt-alert__text",children:r}),d&&e.jsxs("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",d]})]}):null}),kt=m.forwardRef(({href:r,text:n,onClick:c,className:i,...o},a)=>{const d=[i,"pkt-back-link"].filter(Boolean).join(" "),s=u=>{c&&c(u)};return e.jsx("nav",{ref:a,className:d,"aria-label":"Gå tilbake et steg",children:e.jsxs("a",{href:r||"/",className:"pkt-link pkt-link--icon-left",onClick:s,...o,children:[e.jsx(v,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left","aria-hidden":"true"}),e.jsx("span",{className:"pkt-back-link__text",children:n||"Forsiden"})]})})}),mt=m.forwardRef(({breadcrumbs:r,navigationType:n,className:c,...i},o)=>{const a=r.slice(0,4),d=a[a.length-2],s=[c,"pkt-breadcrumbs"].filter(Boolean).join(" ");return e.jsxs("nav",{ref:o,"aria-label":"brødsmulemeny",className:s,children:[e.jsx("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:a.map((u,p)=>e.jsx("li",{className:"pkt-breadcrumbs__item",children:p===a.length-1?e.jsx("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:e.jsx("span",{className:"pkt-breadcrumbs__text",children:u.text})}):n==="router"?e.jsxs(Ee.Link,{to:u.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...i,children:[e.jsx(v,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),e.jsx("span",{className:"pkt-breadcrumbs__text",children:u.text})]}):e.jsxs("a",{href:u.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...i,children:[e.jsx(v,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),e.jsx("span",{className:"pkt-breadcrumbs__text",children:u.text})]})},`breadcrumb-${p}`))}),n==="router"?e.jsxs(Ee.Link,{to:d.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...i,children:[e.jsx(v,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),e.jsx("span",{className:"pkt-breadcrumbs__text",children:d.text})]}):e.jsxs("a",{href:d.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...i,children:[e.jsx(v,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),e.jsx("span",{className:"pkt-breadcrumbs__text",children:d.text})]})]})}),ee=m.forwardRef(({children:r,className:n,iconName:c="user",secondIconName:i="user",size:o="medium",skin:a="primary",type:d="button",variant:s="label-only",color:u,isLoading:p=!1,...k},_)=>{const j=[n,"pkt-btn",o&&`pkt-btn--${o}`,a&&`pkt-btn--${a}`,s&&`pkt-btn--${s}`,u&&`pkt-btn--${u}`,p&&"pkt-btn--active"].filter(Boolean).join(" ");return e.jsxs("button",{...k,className:j,type:d,ref:_,children:[p&&e.jsx(v,{className:"pkt-btn__icon pkt-btn__spinner",name:"spinner-blue",path:"https://punkt-cdn.oslo.kommune.no/11.14/animations/"}),s!=="label-only"&&e.jsx(v,{className:"pkt-btn__icon",name:c}),e.jsx("span",{className:"pkt-btn__text",children:r}),s==="icons-right-and-left"&&e.jsx(v,{className:"pkt-btn__icon",name:i})]})});ee.displayName="PktButton";const Oe=m.forwardRef(({id:r,hasTile:n=!1,disabled:c=!1,label:i,labelPosition:o="right",hideLabel:a=!1,checkHelptext:d,hasError:s=!1,isSwitch:u=!1,className:p,...k},_)=>{const j=[p,"pkt-input-check"].filter(Boolean).join(" ");return e.jsx("div",{className:j,children:e.jsxs("div",{className:`pkt-input-check__input ${n?"pkt-input-check__input--tile":""} ${c&&n?"pkt-input-check__input--tile-disabled":""}`,children:[i&&o==="left"&&e.jsxs("label",{className:`pkt-input-check__input-label ${a?"pkt-sr-only":""}`,htmlFor:r,children:[i,d&&e.jsx("div",{className:"pkt-input-check__input-helptext",children:d})]}),e.jsx("input",{ref:_,className:`pkt-input-check__input-checkbox ${s?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",role:u?"switch":"checkbox",id:r,disabled:c,...k}),i&&o==="right"&&e.jsxs("label",{className:`pkt-input-check__input-label ${a?"pkt-sr-only":""}`,htmlFor:r,children:[i,d&&e.jsx("div",{className:"pkt-input-check__input-helptext",children:d})]})]})})});Oe.displayName="PktCheckbox";const ht=({columnOne:r,columnTwo:n,socialLinks:c,className:i,personvernOgInfoLink:o="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:a="https://www.oslo.kommune.no/tilgjengelighet/"})=>{var s,u;const d=[i,"pkt-footer"].filter(Boolean).join(" ");return e.jsx("footer",{className:d,"data-mode":"dark",children:e.jsxs("div",{className:"pkt-footer__container",children:[e.jsxs("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[e.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[e.jsx("h2",{className:"pkt-footer__title",children:r.title}),e.jsxs("ul",{className:"pkt-footer__list",children:[r.text&&e.jsx("li",{className:"pkt-footer__text",children:r.text}),(s=r.links)==null?void 0:s.map((p,k)=>e.jsx("li",{className:"pkt-footer__list-item",children:e.jsxs("a",{className:`pkt-footer__link ${p.external?"pkt-link--external":""}`,href:p.href,target:p.openInNewTab?"_blank":"_self",rel:p.openInNewTab?"noopener noreferrer":void 0,children:[e.jsx(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),p.text]})},`links-${k}`))]})]}),e.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[e.jsx("h2",{className:"pkt-footer__title",children:n.title}),e.jsxs("ul",{className:"pkt-footer__list",children:[n.text&&e.jsx("li",{className:"pkt-footer__text",children:n.text}),(u=n.links)==null?void 0:u.map((p,k)=>e.jsx("li",{className:"pkt-footer__list-item",children:e.jsxs("a",{className:`pkt-footer__link ${p.external?"pkt-link--external":""}`,href:p.href,target:p.openInNewTab?"_blank":"_self",rel:p.openInNewTab?"noopener noreferrer":void 0,children:[e.jsx(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),p.text]})},`links-${k}`))]})]}),e.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[e.jsx("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),e.jsxs("ul",{className:"pkt-footer__list",children:[e.jsx("li",{className:"pkt-footer__list-item",children:e.jsxs("a",{className:"pkt-footer__link",href:o,children:[e.jsx(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),e.jsx("li",{className:"pkt-footer__list-item",children:e.jsxs("a",{className:"pkt-footer__link",href:a,children:[e.jsx(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),c&&e.jsxs("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[e.jsx("div",{className:"pkt-footer__social-languages",children:c.filter(p=>p.language).map((p,k)=>e.jsx("div",{className:"pkt-footer__social-language",children:e.jsx("a",{href:p.href,"aria-label":`til ${p.language} versjon av nettsiden`,target:p.openInNewTab?"_blank":"_self",rel:p.openInNewTab?"noopener noreferrer":void 0,children:p.language})},`sociallinks-language-${k}`))}),e.jsx("div",{className:"pkt-footer__social-icons",children:c.filter(p=>p.iconName).map((p,k)=>e.jsx(m.Fragment,{children:e.jsx("a",{href:p.href,"aria-label":`til ${p.iconName}`,className:"pkt-footer__social-icon-link",target:p.openInNewTab?"_blank":"_self",rel:p.openInNewTab?"noopener noreferrer":void 0,children:e.jsx(v,{className:"pkt-footer__social-icon",name:p.iconName})})},`sociallinks-${k}`))})]})]})})},_t=({links:r=[],personvernOgInfoLink:n="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:c="https://www.oslo.kommune.no/tilgjengelighet/",className:i})=>{const o=[i,"pkt-footer-simple"].filter(Boolean).join(" ");return e.jsx("footer",{className:o,"data-mode":"dark",children:e.jsx("div",{className:"pkt-footer-simple__container",children:e.jsxs("ul",{className:"pkt-footer-simple__list",children:[r.map((a,d)=>e.jsx("li",{className:"pkt-footer-simple__list-item",children:e.jsxs("a",{className:`pkt-footer-simple__link ${a.external?" pkt-link--external":""}`,href:a.href,target:a.openInNewTab?"_blank":"_self",rel:a.openInNewTab?"noopener noreferrer":void 0,children:[e.jsx(v,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),a.text]})},d)),e.jsx("li",{className:"pkt-footer-simple__list-item",children:e.jsxs("a",{className:"pkt-footer-simple__link",href:n,children:[e.jsx(v,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),e.jsx("li",{className:"pkt-footer-simple__list-item",children:e.jsxs("a",{className:"pkt-footer-simple__link",href:c,children:[e.jsx(v,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})})},bt=m.forwardRef(({className:r,logoLink:n="https://www.oslo.kommune.no/",serviceName:c,fixed:i=!0,scrollToHide:o=!0,user:a,userMenu:d,representing:s,userOptions:u,userMenuFooter:p,canChangeRepresentation:k=!0,showMenuButton:_=!1,showLogOutButton:j=!1,openMenu:y,logOut:T,changeRepresentation:O,children:R,...E},C)=>{const g=m.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]),[F,Y]=m.useState(!1),[U,W]=m.useState(0),[J,M]=m.useState(!1),q=m.useRef(null);m.useEffect(()=>(document.addEventListener("mouseup",B),window.addEventListener("scroll",$),()=>{document.removeEventListener("mouseup",B),window.removeEventListener("scroll",$)}));const H=()=>{M(!J)},B=h=>{q.current&&!q.current.contains(h.target)&&M(!1)},$=()=>{if(o){const h=window.pageYOffset||document.documentElement.scrollTop;if(h<0||Math.abs(h-U)<60)return;Y(h>U),W(h)}};return e.jsxs("header",{...E,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:z(r,"pkt-header",{"pkt-header--fixed":i,"pkt-header--scroll-to-hide":o,"pkt-header--hidden":F}),ref:C,children:[e.jsxs("div",{className:"pkt-header__logo",children:[typeof n=="string"?e.jsx("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:n,children:e.jsx(v,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/11.14/logos/"})}):e.jsx("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header__logo-link",onClick:n,children:e.jsx(v,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/11.14/logos/"})}),e.jsx("span",{className:"pkt-header__logo-service",children:c})]}),e.jsx("nav",{className:"pkt-header__actions",children:e.jsxs("ul",{className:"pkt-header__actions-row",children:[_&&e.jsx("li",{children:e.jsx(ee,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:y,children:"Meny"})}),(a||s)&&e.jsxs("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${J&&!F?"pkt-header--open-dropdown":""}`,ref:q,children:[e.jsxs("button",{className:"pkt-header__user-btn pkt-btn pkt-btn--secondary pkt-btn--icons-right-and-left",type:"button",role:"button","aria-controls":"pktUserDropdown","aria-expanded":J,onClick:H,children:[e.jsx(v,{name:"user",className:"pkt-btn__icon"}),e.jsx("span",{className:"pkt-header__user-fullname",children:(s==null?void 0:s.name)||(a==null?void 0:a.name)}),e.jsx("span",{className:"pkt-header__user-shortname",children:(s==null?void 0:s.shortname)||(a==null?void 0:a.shortname)}),e.jsx(v,{name:"chevron-thin-down",className:"pkt-btn--closed"}),e.jsx(v,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),e.jsxs("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[a&&e.jsxs("li",{children:[e.jsx("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),e.jsx("div",{className:"pkt-user-menu__name",children:a.name}),a.lastLoggedIn&&e.jsxs("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",e.jsx("time",{children:g})]})]}),d&&e.jsx("li",{children:e.jsx("ul",{className:"pkt-list",children:d.map((h,A)=>e.jsx("li",{children:typeof h.target=="string"?e.jsxs("a",{href:h.target,className:"pkt-link",children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]}):e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]})},`userMenu-${A}`))})}),(s||k)&&e.jsxs("li",{children:[s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pkt-user-menu__label",children:"Representerer"}),e.jsx("div",{className:"pkt-user-menu__name",children:s.name}),s.orgNumber&&e.jsxs("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",s.orgNumber]})]}),e.jsx("ul",{className:"pkt-list mt-size-16",children:k&&e.jsx("li",{children:e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:O,children:[e.jsx(v,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),e.jsx("li",{children:e.jsx("ul",{className:"pkt-list",children:(u||!j)&&e.jsxs(e.Fragment,{children:[u==null?void 0:u.map((h,A)=>e.jsx("li",{children:typeof h.target=="string"?e.jsxs("a",{href:h.target,className:"pkt-link",children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]}):e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]})},`userOptions-${A}`)),!j&&e.jsx("li",{children:e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:T,children:[e.jsx(v,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),p&&e.jsx("li",{className:"footer",children:e.jsx("ul",{className:"pkt-list-horizontal bordered",children:p.map((h,A)=>e.jsx("li",{children:typeof h.target=="string"?e.jsx("a",{href:h.target,className:"pkt-link",children:h.title}):e.jsx("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:h.title})},`userMenuFooter-${A}`))})})]})]}),R&&e.jsx("li",{children:R}),j&&e.jsx("li",{children:e.jsx(ee,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:T,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),Fe=m.forwardRef(({label:r,id:n,children:c,...i},o)=>e.jsxs("div",{className:"pkt-form-group",children:[e.jsx("label",{htmlFor:n,className:"pkt-form-label",children:r}),e.jsx("input",{className:"pkt-form-input",id:n,...i,ref:o}),c]}));Fe.displayName="PktInput";const se=m.forwardRef(({forId:r,label:n,helptext:c,helptextDropdown:i,helptextDropdownButton:o,optionalTag:a=!1,optionalText:d="Valgfritt",requiredTag:s=!1,requiredText:u="Må fylles ut",hasError:p,errorMessage:k,disabled:_,inline:j,ariaDescribedby:y,useWrapper:T=!0,children:O,className:R,hasFieldset:E=!1},C)=>{const[g,F]=m.useState(!1),Y=()=>{F(!g)},U=()=>a?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":s?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",W=a?d:s?u:"",J=_?"pkt-inputwrapper--disabled":"",M=j?"pkt-inputwrapper--inline":"",q=p?"pkt-inputwrapper--error":"",H=!!i&&i!=="",B=o||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',$=E?"fieldset":H?"div":"label",h=E?"legend":H?"h2":"span",A=y||(c?`${r}-helptext`:void 0);return e.jsxs("div",{className:["pkt-inputwrapper",R,J,M,q].join(" "),ref:C,children:[T?e.jsx(e.Fragment,{children:e.jsxs($,{htmlFor:E?void 0:r,"aria-describedby":H?void 0:y,className:`pkt-inputwrapper__label${E?" pkt-inputwrapper__fieldset":""}`,children:[e.jsxs(h,{id:`${r}-label`,className:`${E?" pkt-inputwrapper__legend":""}`,children:[n,W!==""&&e.jsx("span",{className:U(),children:W})]}),c&&e.jsx("div",{className:"pkt-inputwrapper__helptext",id:`${r}-helptext`,dangerouslySetInnerHTML:{__html:c}}),H&&i!==""&&e.jsxs("div",{className:"pkt-inputwrapper__helptext-expandable",children:[e.jsx(ee,{skin:"tertiary",size:"small",variant:"icon-right",iconName:g?"chevron-thin-up":"chevron-thin-down",className:"pkt-link pkt-link--icon-right",onClick:Y,children:e.jsx("span",{dangerouslySetInnerHTML:{__html:B}})}),e.jsx("div",{className:`pkt-inputwrapper__helptext ${g?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:e.jsx("span",{dangerouslySetInnerHTML:{__html:i}})}),!E&&e.jsx("label",{htmlFor:r,className:"pkt-sr-only","aria-describedby":A,children:n})]}),e.jsx(e.Fragment,{children:O})]})}):e.jsxs(e.Fragment,{children:[!E&&e.jsx("label",{htmlFor:r,className:"pkt-sr-only","aria-describedby":A,id:`${r}-label`,children:n}),O]}),p&&k&&e.jsx("div",{children:e.jsx(Ie,{skin:"error","aria-live":"assertive",id:`${r}-error`,compact:!0,children:k})})]})});se.displayName="PktInputWrapper";const De=m.forwardRef(({children:r,className:n,iconName:c="user",openInNewTab:i=!1,skin:o="normal",href:a="#",external:d=!1,title:s,...u},p)=>{const k=[n,"pkt-linkcard",o&&`pkt-linkcard--${o}`].filter(Boolean).join(" ");return e.jsxs("a",{...u,href:a,className:`pkt-linkcard pkt-link ${k}`,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,ref:p,children:[e.jsx(v,{className:"pkt-link__icon",name:c}),e.jsxs("div",{className:"pkt-linkcard__content",children:[e.jsx("div",{className:`pkt-linkcard__title ${d?"pkt-link pkt-link--external":""}`,children:s}),e.jsx("div",{className:"pkt-linkcard__text",children:r})]})]})});De.displayName="PktLinkCard";const vt=m.forwardRef(({className:r,message:n,size:c="medium",inline:i=!1,isLoading:o=!0,variant:a="rainbow",delay:d=0,children:s,...u},p)=>{const k=`pkt-loader pkt-loader--${c}`,[_,j]=m.useState(!(d>0));d>0&&setTimeout(()=>{j(!0)},d);const y=T=>T==="shapes"?"loader":T==="blue"?"spinner-blue":"spinner";return e.jsx("div",{role:"status","aria-live":"polite","aria-busy":o,className:`pkt-loader--${i?"inline":"box"} ${r||""}`,children:o?e.jsx(e.Fragment,{children:_?e.jsxs("div",{className:k,"data-testid":"pkt-loader",ref:p,...u,children:[e.jsx(v,{name:y(a),"aria-label":"loading",path:"https://punkt-cdn.oslo.kommune.no/11.14/animations/",className:`pkt-loader__svg pkt-loader__${a}`}),n&&e.jsx("p",{children:n})]}):null}):s})}),xt=m.forwardRef(({children:r,className:n,compact:c=!1,closable:i=!1,skin:o="beige",title:a,onClose:d,...s},u)=>{const[p,k]=m.useState(!0),_=()=>{k(!1),d&&d()},j=[n,"pkt-messagebox",o&&`pkt-messagebox--${o}`,c&&"pkt-messagebox--compact"].filter(Boolean).join(" ");return p?e.jsxs("div",{...s,className:j,ref:u,children:[i&&e.jsx("div",{className:"pkt-messagebox__close",children:e.jsx("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:_,children:e.jsx(v,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),a&&e.jsx("div",{className:"pkt-messagebox__title",children:a}),e.jsx("div",{className:"pkt-messagebox__text",children:r})]}):null});for(var L=[],be=0;be<256;++be)L.push((be+256).toString(16).slice(1));function jt(r,n=0){return(L[r[n+0]]+L[r[n+1]]+L[r[n+2]]+L[r[n+3]]+"-"+L[r[n+4]]+L[r[n+5]]+"-"+L[r[n+6]]+L[r[n+7]]+"-"+L[r[n+8]]+L[r[n+9]]+"-"+L[r[n+10]]+L[r[n+11]]+L[r[n+12]]+L[r[n+13]]+L[r[n+14]]+L[r[n+15]]).toLowerCase()}var ce,gt=new Uint8Array(16);function Nt(){if(!ce&&(ce=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ce))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ce(gt)}var yt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ae={randomUUID:yt};function wt(r,n,c){if(Ae.randomUUID&&!n&&!r)return Ae.randomUUID();r=r||{};var i=r.random||(r.rng||Nt)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,n){c=c||0;for(var o=0;o<16;++o)n[c+o]=i[o];return n}return jt(i)}const Pt=m.forwardRef(({valueCurrent:r,valueMin:n=0,valueMax:c=100,skin:i="dark-blue",title:o,titlePosition:a="left",statusType:d="none",statusPlacement:s="following",id:u,ariaLabel:p,ariaLabelledby:k,role:_="progressbar",className:j,ariaValueText:y,...T},O)=>{const R=m.useRef(null),[E,C]=m.useState(0),[g,F]=m.useState(u);m.useEffect(()=>{u||F(wt())},[u]),m.useEffect(()=>{if(R.current){const h=R.current;C(h.getBoundingClientRect().width)}});const Y=c-n,U=r/Y*100,W=c!==100||n!==0?Math.round(U):r,J=`${r} av ${c}`,M=d!=="none",q=z("pkt-progressbar__bar",{[`pkt-progressbar__bar--${i}`]:i}),H=z("pkt-progressbar__title",{"pkt-progressbar__title-center":a==="center"}),B=z("pkt-progressbar__status",{"pkt-progressbar__status--center":s==="center"}),$=z({"pkt-progressbar__status-placement--following":s==="following","pkt-progressbar__status-placement--center":s==="center","pkt-progressbar__status-placement--left":s==="left"});return e.jsxs("div",{...T,ref:O,className:z("pkt-progressbar__container",j),id:g,style:{"--pkt-progress-label-width":`${E}px`,"--pkt-progress-width":`${W}%`},children:[o&&e.jsx("p",{id:`${g}-title`,className:H,children:o}),e.jsx("div",{role:_,className:"pkt-progressbar__bar-wrapper","aria-valuemin":n,"aria-valuemax":c,"aria-valuenow":r,"aria-labelledby":k||o&&`${g}-title`,"aria-label":p,"aria-valuetext":y,children:e.jsx("div",{className:q})}),M&&e.jsx("div",{className:B,children:e.jsx("span",{className:$,ref:R,children:d==="percentage"?`${W}%`:J})})]})}),Le=m.forwardRef(({id:r,name:n,label:c,className:i,hasTile:o=!1,disabled:a=!1,checkHelptext:d,hasError:s=!1,...u},p)=>{const k=[i,"pkt-input-check"].filter(Boolean).join(" ");return e.jsx("div",{className:k,children:e.jsxs("div",{className:`pkt-input-check__input ${o?"pkt-input-check__input--tile":""} ${a&&o?"pkt-input-check__input--tile-disabled":""}`,children:[e.jsx("input",{ref:p,className:`pkt-input-check__input-checkbox ${s?"pkt-input-check__input-checkbox--error":""}`,type:"radio",id:r,disabled:a,name:n,...u}),e.jsxs("label",{className:"pkt-input-check__input-label",htmlFor:r,children:[c,d&&e.jsx("div",{className:"pkt-input-check__input-helptext",children:d})]})]})})});Le.displayName="PktRadioButton";const Ct=m.forwardRef(({action:r,appearance:n="local",disabled:c=!1,fullwidth:i=!1,id:o,label:a,method:d="get",name:s,placeholder:u="Søk…",suggestions:p,value:k="",onSearch:_,onSuggestionClick:j,...y},T)=>{const O=(g,F)=>{g?g():j&&j(F)},R=`pkt-searchinput pkt-searchinput--${n} ${i?"pkt-searchinput--fullwidth":""}`,E=r?"form":"div",C=a?"label":"div";return e.jsxs(E,{className:R,onSubmit:_&&(()=>_(k)),action:r||void 0,method:r?d:void 0,role:"search",ref:T,...y,children:[e.jsxs(C,{htmlFor:a?o:void 0,className:a?"pkt-inputwrapper__label":"",children:[a&&e.jsx(e.Fragment,{children:a}),e.jsxs("div",{className:n==="local"?"pkt-input__container":"pkt-searchinput__field",children:[e.jsx("input",{className:`pkt-input ${i?"pkt-input--fullwidth":""}`,type:"search",name:s||o,id:o,placeholder:u,defaultValue:k,disabled:c,onInput:_&&(g=>_(g.currentTarget.value)),autoComplete:"off","aria-autocomplete":"list","aria-controls":`${o}-suggestions`}),e.jsx(ee,{className:`pkt-searchinput__button ${n==="local"?"pkt-input-icon":""}`,variant:"icon-only",iconName:"magnifying-glass-big",skin:n==="local"?"tertiary":"primary",color:n==="global"?"yellow":void 0,type:"submit",disabled:c,onClick:_&&(()=>_(k)),onKeyUp:_&&(g=>g.key==="Enter"&&_(k)),children:a||u})]})]}),p&&e.jsx("ul",{id:`${o}-suggestions`,className:"pkt-searchinput__suggestions","aria-live":"assertive",children:p.map((g,F)=>e.jsx("li",{children:m.createElement(g.href?"a":g.onClick?"button":"div",{href:g.href,className:`pkt-searchinput__suggestion ${g.onClick?"pkt-link-button":""} ${g.href||g.onClick?"pkt-searchinput__suggestion--has-hover":""}`,type:g.onClick?"button":void 0,onClick:()=>O(g.onClick,F),onKeyUp:()=>O(g.onClick,F)},e.jsxs(e.Fragment,{children:[g.title&&e.jsx("h3",{className:"pkt-searchinput__suggestion-title",children:g.title}),g.text&&e.jsx("p",{className:"pkt-searchinput__suggestion-text",children:g.text})]}))},`search-suggestion-${F}`))})]})}),Et=m.forwardRef(({ariaDescribedby:r,ariaLabelledby:n,children:c,className:i,disabled:o=!1,errorMessage:a,hasError:d,helptext:s,helptextDropdown:u,helptextDropdownButton:p,id:k,inline:_=!1,fullwidth:j=!1,label:y,name:T,optionalTag:O=!1,optionalText:R,requiredTag:E=!1,requiredText:C,...g},F)=>{const Y=[i,"pkt-select"].join(" ");return e.jsx(se,{className:Y,forId:k,label:y,helptext:s,helptextDropdown:u,helptextDropdownButton:p,optionalTag:O,optionalText:R,requiredTag:E,requiredText:C,hasError:d,errorMessage:a,disabled:o,inline:_,ariaDescribedby:r,children:e.jsx("select",{ref:F,className:`pkt-input ${j?"pkt-input--fullwidth":""}`,"aria-invalid":d,"aria-errormessage":`${k}-error`,"aria-labelledby":n||`${k}-label`,disabled:o,id:k,name:T||k,...g,children:c})})}),Tt=({className:r,compact:n=!1,skin:c="basic",responsiveView:i=!0,children:o})=>e.jsx("table",{"data-testid":"pkt-table",className:z(r,"pkt-table",{"pkt-table--responsive":i,"pkt-table--compact":n,"pkt-table--basic":c==="basic","pkt-table--zebra-blue":c==="zebra-blue"}),role:"table",children:o}),St=({children:r,className:n,dataLabel:c})=>e.jsx("td",{className:z(n,"pkt-table__data-cell",{}),"data-label":c,role:"cell","data-testid":"pkt-table__data-cell",children:r}),$t=({className:r,children:n})=>e.jsx("th",{className:z(r,"pkt-table__header-cell",{}),role:"columnheader",children:n}),Rt=({className:r,children:n})=>e.jsx("thead",{className:z(r,"pkt-table__header",{}),role:"rowgroup",children:n}),It=({className:r,children:n})=>e.jsx("tr",{className:z(r,"pkt-table__row",{}),role:"row",children:n}),Ot=({children:r,className:n})=>e.jsx("tbody",{className:z(n,"pkt-table__body",{}),role:"rowgroup",children:r}),ue=m.forwardRef(({children:r,className:n,skin:c="blue",textStyle:i="normal-text",size:o="medium",closeTag:a=!1,iconName:d="",type:s="button",ariaLabel:u="close",onClick:p=()=>{}},k)=>{const[_,j]=m.useState(!1),y=E=>{j(!0),p(E)},T=["pkt-tag",o&&`pkt-tag--${o}`,c&&`pkt-tag--${c}`,i&&`pkt-tag--${i}`,n].filter(Boolean).join(" "),O=["pkt-tag","pkt-btn","pkt-btn--tertiary",o&&`pkt-tag--${o}`,c&&`pkt-tag--${c}`,i&&`pkt-tag--${i}`,d&&a?"pkt-btn--icons-right-and-left":null,a&&!d?"pkt-btn--icon-right":null,n].filter(Boolean).join(" "),R=!_;return a&&d?e.jsx(e.Fragment,{children:R&&e.jsxs("button",{className:O,type:s,"aria-label":u,onClick:y,ref:k,children:[e.jsx(v,{className:"pkt-tag__icon",name:d}),r,e.jsx(v,{className:"pkt-tag__close-btn",name:"close"})]})}):a?e.jsx(e.Fragment,{children:R&&e.jsxs("button",{className:O,type:s,"aria-label":u,onClick:y,ref:k,children:[e.jsx(v,{className:"pkt-tag__close-btn",name:"close"}),r]})}):d?e.jsxs("span",{className:T,children:[e.jsx(v,{className:"pkt-tag__icon",name:d}),r]}):e.jsx("span",{className:T,children:r})});ue.displayName="PktTag";const Ft=m.forwardRef(({arrowNav:r=!0,tabs:n,onTabSelected:c},i)=>{const o=m.useRef([]);m.useEffect(()=>{o.current=o.current.slice(0,n.length)},[n]);const a=(s,u)=>{u.action&&u.action(s),c&&c(s)},d=(s,u)=>{var p,k;r&&(u.code==="ArrowLeft"&&s!==0&&((p=o.current[s-1])==null||p.focus()),u.code==="ArrowRight"&&s<n.length-1&&((k=o.current[s+1])==null||k.focus()),(u.code==="ArrowDown"||u.code==="Space")&&a(s,n[s]))};return e.jsx("div",{className:"pkt-tabs",ref:i,children:e.jsx("div",{className:"pkt-tabs__list",role:r?"tablist":"navigation",children:n.map((s,u)=>e.jsx(m.Fragment,{children:s.href?e.jsxs("a",{"aria-selected":!!s.active,role:r?"tab":void 0,href:s.href,"aria-controls":s.controls,className:`pkt-tabs__link ${s.active?"active":""}`,onKeyUp:p=>d(u,p),onClick:()=>a(u,s),tabIndex:s.active||!r?void 0:-1,ref:p=>{o.current[u]=p},children:[s.icon&&e.jsx(v,{name:s.icon,className:"pkt-icon--small"}),s.text,s.tag&&e.jsx(ue,{skin:s.tag.skin,size:"small",children:s.tag.text})]}):e.jsxs("button",{"aria-selected":!!s.active,role:r?"tab":void 0,type:"button","aria-controls":s.controls,className:`pkt-tabs__button pkt-link-button ${s.active?"active":""}`,onKeyUp:p=>d(u,p),onClick:()=>a(u,s),tabIndex:s.active||!r?void 0:-1,ref:p=>{o.current[u]=p},children:[s.icon&&e.jsx(v,{name:s.icon,className:"pkt-icon--small"}),s.text,s.tag&&e.jsx(ue,{skin:s.tag.skin,size:"small",children:s.tag.text})]},"b-"+u)},u))})})}),Dt=m.forwardRef(({id:r,ariaDescribedby:n,ariaLabelledby:c,counter:i,counterMaxLength:o,className:a,disabled:d,errorMessage:s,hasError:u,helptext:p,helptextDropdown:k,helptextDropdownButton:_,inline:j,fullwidth:y=!1,label:T,name:O,optionalTag:R=!1,optionalText:E,requiredTag:C=!1,requiredText:g,placeholder:F,rows:Y,useWrapper:U=!0,onChange:W,...J},M)=>{const q=[a,"pkt-textinput","pkt-textarea"].join(" "),H=c||`${r}-label`,B=m.useRef(null),[$,h]=m.useState(0),A=X=>{var Z,le;if(i&&h(((le=(Z=X.currentTarget)==null?void 0:Z.value)==null?void 0:le.length)||0),W)return W(X)};return m.useEffect(()=>{var X,Z;typeof M=="function"&&M(B.current),i&&h(((Z=(X=B==null?void 0:B.current)==null?void 0:X.value)==null?void 0:Z.length)||0)},[M]),e.jsxs(se,{ariaDescribedby:n,className:q,disabled:d,errorMessage:s,forId:r,hasError:u,helptext:p,helptextDropdown:k,helptextDropdownButton:_,inline:j,label:T,optionalTag:R,optionalText:E,requiredTag:C,requiredText:g,useWrapper:U,children:[e.jsx("textarea",{ref:B,className:`pkt-input ${y?"pkt-input--fullwidth":""} ${o&&$>o?"pkt-input--counter-error":""}`,name:O||r,id:r,placeholder:F,disabled:d,rows:Y,"aria-labelledby":H,"aria-invalid":u,"aria-errormessage":`${r}-error`,...J,onChange:A}),i&&e.jsxs("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":!0,children:[$||0,o&&`/${o}`]})]})}),At=m.forwardRef(({id:r,ariaDescribedby:n,ariaLabelledby:c,autocomplete:i="off",className:o,disabled:a=!1,errorMessage:d,hasError:s=!1,helptext:u,helptextDropdown:p,helptextDropdownButton:k,iconNameRight:_,inline:j=!1,fullwidth:y=!1,label:T,name:O,optionalTag:R=!1,optionalText:E,requiredTag:C=!1,requiredText:g,placeholder:F,prefix:Y,suffix:U,type:W="text",useWrapper:J=!0,omitSearchIcon:M=!1,value:q,...H},B)=>{const $=[o,"pkt-textinput"].join(" "),h=c||`${r}-label`,A=W==="search"&&!_&&!M;return e.jsx(se,{ariaDescribedby:n,className:$,disabled:a,errorMessage:d,forId:r,hasError:s,helptext:u,helptextDropdown:p,helptextDropdownButton:k,inline:j,label:T,optionalTag:R,optionalText:E,requiredTag:C,requiredText:g,useWrapper:J,children:e.jsxs("div",{className:"pkt-input__container",children:[Y&&e.jsx("div",{className:"pkt-input-prefix",children:Y}),e.jsx("input",{ref:B,className:`pkt-input ${y?"pkt-input--fullwidth":""}`,type:W,name:O||r,id:r,placeholder:F,autoComplete:i,value:q,disabled:a,"aria-invalid":s,"aria-errormessage":`${r}-error`,"aria-labelledby":h,...H}),U&&e.jsxs("p",{className:"pkt-input-suffix",children:[U,_&&e.jsx(v,{className:"pkt-input-suffix-icon",name:_}),A&&e.jsx(v,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!U&&_&&e.jsx(v,{className:"pkt-input-icon",name:_}),!U&&A&&e.jsx(v,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});x.PktAccordion=it,x.PktAccordionItem=ft,x.PktAlert=Ie,x.PktBackLink=kt,x.PktBreadcrumbs=mt,x.PktButton=ee,x.PktCheckbox=Oe,x.PktFooter=ht,x.PktFooterSimple=_t,x.PktHeader=bt,x.PktIcon=v,x.PktIconContext=$e,x.PktInput=Fe,x.PktInputWrapper=se,x.PktLinkCard=De,x.PktLoader=vt,x.PktMessagebox=xt,x.PktProgressbar=Pt,x.PktRadioButton=Le,x.PktSearchInput=Ct,x.PktSelect=Et,x.PktTable=Tt,x.PktTableBody=Ot,x.PktTableDataCell=St,x.PktTableHeader=Rt,x.PktTableHeaderCell=$t,x.PktTableRow=It,x.PktTabs=Ft,x.PktTag=ue,x.PktTextarea=Dt,x.PktTextinput=At,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
36
|
+
*/(function(r){(function(){var n={}.hasOwnProperty;function o(){for(var s="",d=0;d<arguments.length;d++){var a=arguments[d];a&&(s=c(s,l(a)))}return s}function l(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return o.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var d="";for(var a in s)n.call(s,a)&&s[a]&&(d=c(d,a));return d}function c(s,d){return d?s?s+" "+d:s+d:s}r.exports?(o.default=o,r.exports=o):window.classNames=o})()})(Re);var dt=Re.exports;const L=st(dt),ft=m.forwardRef(({title:r,className:n,children:o,toggleProps:l,defaultOpen:c=!1,id:s},d)=>{const[a,u]=m.useState(c),p=l?l.isOpen:a,k=y=>y??void 0,_=(y,S)=>{y.preventDefault(),l!==void 0&&l.onToggleClick(y,S),u(!p)},j=L(n,"pkt-accordion-item");return e.jsxs("details",{className:j,ref:d,id:s,open:k(l?l.isOpen:a),children:[e.jsxs("summary",{className:"pkt-accordion-item__title",id:`pkt-accordion-item-summary-${s}`,onClick:y=>_(y,s),children:[r,e.jsx(v,{name:"chevron-thin-down",className:"pkt-accordion-item__icon","aria-hidden":"true"})]}),e.jsx("div",{id:`pkt-accordion-item-content-${s}`,role:"region",className:"pkt-accordion-item__content",children:o})]})}),Ie=m.forwardRef(({children:r,className:n,skin:o="info",closeAlert:l=!1,onClose:c,title:s,date:d,ariaLive:a="polite",compact:u=!1,...p},k)=>{const _=[n,"pkt-alert",o&&`pkt-alert--${o}`,u&&"pkt-alert--compact"].filter(Boolean).join(" "),[j,y]=m.useState(!0),S=()=>{y(!1),c&&c()};return j?e.jsxs("div",{...p,className:_,"aria-live":a,ref:k,children:[e.jsx(v,{className:"pkt-alert__icon",name:o==="info"?"alert-information":`alert-${o}`}),l&&e.jsx("div",{className:"pkt-alert__close",children:e.jsx("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:S,children:e.jsx(v,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),s&&e.jsx("div",{className:"pkt-alert__title",children:s}),e.jsx("div",{className:"pkt-alert__text",children:r}),d&&e.jsxs("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",d]})]}):null}),kt=m.forwardRef(({href:r,text:n,onClick:o,className:l,...c},s)=>{const d=[l,"pkt-back-link"].filter(Boolean).join(" "),a=u=>{o&&o(u)};return e.jsx("nav",{ref:s,className:d,"aria-label":"Gå tilbake et steg",children:e.jsxs("a",{href:r||"/",className:"pkt-link pkt-link--icon-left",onClick:a,...c,children:[e.jsx(v,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left","aria-hidden":"true"}),e.jsx("span",{className:"pkt-back-link__text",children:n||"Forsiden"})]})})}),mt=m.forwardRef(({breadcrumbs:r,navigationType:n,className:o,...l},c)=>{const s=r.slice(0,4),d=s[s.length-2],a=[o,"pkt-breadcrumbs"].filter(Boolean).join(" ");return e.jsxs("nav",{ref:c,"aria-label":"brødsmulemeny",className:a,children:[e.jsx("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:s.map((u,p)=>e.jsx("li",{className:"pkt-breadcrumbs__item",children:p===s.length-1?e.jsx("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:e.jsx("span",{className:"pkt-breadcrumbs__text",children:u.text})}):n==="router"?e.jsxs(Ee.Link,{to:u.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...l,children:[e.jsx(v,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),e.jsx("span",{className:"pkt-breadcrumbs__text",children:u.text})]}):e.jsxs("a",{href:u.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...l,children:[e.jsx(v,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),e.jsx("span",{className:"pkt-breadcrumbs__text",children:u.text})]})},`breadcrumb-${p}`))}),n==="router"?e.jsxs(Ee.Link,{to:d.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...l,children:[e.jsx(v,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),e.jsx("span",{className:"pkt-breadcrumbs__text",children:d.text})]}):e.jsxs("a",{href:d.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...l,children:[e.jsx(v,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),e.jsx("span",{className:"pkt-breadcrumbs__text",children:d.text})]})]})}),ee=m.forwardRef(({children:r,className:n,iconName:o="user",secondIconName:l="user",size:c="medium",skin:s="primary",type:d="button",variant:a="label-only",color:u,isLoading:p=!1,...k},_)=>{const j=[n,"pkt-btn",c&&`pkt-btn--${c}`,s&&`pkt-btn--${s}`,a&&`pkt-btn--${a}`,u&&`pkt-btn--${u}`,p&&"pkt-btn--active"].filter(Boolean).join(" ");return e.jsxs("button",{...k,className:j,type:d,ref:_,children:[p&&e.jsx(v,{className:"pkt-btn__icon pkt-btn__spinner",name:"spinner-blue",path:"https://punkt-cdn.oslo.kommune.no/11.14/animations/"}),a!=="label-only"&&e.jsx(v,{className:"pkt-btn__icon",name:o}),e.jsx("span",{className:"pkt-btn__text",children:r}),a==="icons-right-and-left"&&e.jsx(v,{className:"pkt-btn__icon",name:l})]})});ee.displayName="PktButton";const Oe=m.forwardRef(({id:r,hasTile:n=!1,disabled:o=!1,label:l,labelPosition:c="right",hideLabel:s=!1,checkHelptext:d,hasError:a=!1,isSwitch:u=!1,className:p,...k},_)=>{const j=[p,"pkt-input-check"].filter(Boolean).join(" ");return e.jsx("div",{className:j,children:e.jsxs("div",{className:`pkt-input-check__input ${n?"pkt-input-check__input--tile":""} ${o&&n?"pkt-input-check__input--tile-disabled":""}`,children:[l&&c==="left"&&e.jsxs("label",{className:`pkt-input-check__input-label ${s?"pkt-sr-only":""}`,htmlFor:r,children:[l,d&&e.jsx("div",{className:"pkt-input-check__input-helptext",children:d})]}),e.jsx("input",{ref:_,className:`pkt-input-check__input-checkbox ${a?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",role:u?"switch":"checkbox",id:r,disabled:o,...k}),l&&c==="right"&&e.jsxs("label",{className:`pkt-input-check__input-label ${s?"pkt-sr-only":""}`,htmlFor:r,children:[l,d&&e.jsx("div",{className:"pkt-input-check__input-helptext",children:d})]})]})})});Oe.displayName="PktCheckbox";const ht=({columnOne:r,columnTwo:n,socialLinks:o,className:l,personvernOgInfoLink:c="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:s="https://www.oslo.kommune.no/tilgjengelighet/"})=>{var a,u;const d=[l,"pkt-footer"].filter(Boolean).join(" ");return e.jsx("footer",{className:d,"data-mode":"dark",children:e.jsxs("div",{className:"pkt-footer__container",children:[e.jsxs("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[e.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[e.jsx("h2",{className:"pkt-footer__title",children:r.title}),e.jsxs("ul",{className:"pkt-footer__list",children:[r.text&&e.jsx("li",{className:"pkt-footer__text",children:r.text}),(a=r.links)==null?void 0:a.map((p,k)=>e.jsx("li",{className:"pkt-footer__list-item",children:e.jsxs("a",{className:`pkt-footer__link ${p.external?"pkt-link--external":""}`,href:p.href,target:p.openInNewTab?"_blank":"_self",rel:p.openInNewTab?"noopener noreferrer":void 0,children:[e.jsx(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),p.text]})},`links-${k}`))]})]}),e.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[e.jsx("h2",{className:"pkt-footer__title",children:n.title}),e.jsxs("ul",{className:"pkt-footer__list",children:[n.text&&e.jsx("li",{className:"pkt-footer__text",children:n.text}),(u=n.links)==null?void 0:u.map((p,k)=>e.jsx("li",{className:"pkt-footer__list-item",children:e.jsxs("a",{className:`pkt-footer__link ${p.external?"pkt-link--external":""}`,href:p.href,target:p.openInNewTab?"_blank":"_self",rel:p.openInNewTab?"noopener noreferrer":void 0,children:[e.jsx(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),p.text]})},`links-${k}`))]})]}),e.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[e.jsx("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),e.jsxs("ul",{className:"pkt-footer__list",children:[e.jsx("li",{className:"pkt-footer__list-item",children:e.jsxs("a",{className:"pkt-footer__link",href:c,children:[e.jsx(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),e.jsx("li",{className:"pkt-footer__list-item",children:e.jsxs("a",{className:"pkt-footer__link",href:s,children:[e.jsx(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),o&&e.jsxs("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[e.jsx("div",{className:"pkt-footer__social-languages",children:o.filter(p=>p.language).map((p,k)=>e.jsx("div",{className:"pkt-footer__social-language",children:e.jsx("a",{href:p.href,"aria-label":`til ${p.language} versjon av nettsiden`,target:p.openInNewTab?"_blank":"_self",rel:p.openInNewTab?"noopener noreferrer":void 0,children:p.language})},`sociallinks-language-${k}`))}),e.jsx("div",{className:"pkt-footer__social-icons",children:o.filter(p=>p.iconName).map((p,k)=>e.jsx(m.Fragment,{children:e.jsx("a",{href:p.href,"aria-label":`til ${p.iconName}`,className:"pkt-footer__social-icon-link",target:p.openInNewTab?"_blank":"_self",rel:p.openInNewTab?"noopener noreferrer":void 0,children:e.jsx(v,{className:"pkt-footer__social-icon",name:p.iconName})})},`sociallinks-${k}`))})]})]})})},_t=({links:r=[],personvernOgInfoLink:n="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:o="https://www.oslo.kommune.no/tilgjengelighet/",className:l})=>{const c=[l,"pkt-footer-simple"].filter(Boolean).join(" ");return e.jsx("footer",{className:c,"data-mode":"dark",children:e.jsx("div",{className:"pkt-footer-simple__container",children:e.jsxs("ul",{className:"pkt-footer-simple__list",children:[r.map((s,d)=>e.jsx("li",{className:"pkt-footer-simple__list-item",children:e.jsxs("a",{className:`pkt-footer-simple__link ${s.external?" pkt-link--external":""}`,href:s.href,target:s.openInNewTab?"_blank":"_self",rel:s.openInNewTab?"noopener noreferrer":void 0,children:[e.jsx(v,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),s.text]})},d)),e.jsx("li",{className:"pkt-footer-simple__list-item",children:e.jsxs("a",{className:"pkt-footer-simple__link",href:n,children:[e.jsx(v,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),e.jsx("li",{className:"pkt-footer-simple__list-item",children:e.jsxs("a",{className:"pkt-footer-simple__link",href:o,children:[e.jsx(v,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})})},bt=m.forwardRef(({className:r,logoLink:n="https://www.oslo.kommune.no/",serviceName:o,fixed:l=!0,scrollToHide:c=!0,user:s,userMenu:d,representing:a,userOptions:u,userMenuFooter:p,canChangeRepresentation:k=!0,showMenuButton:_=!1,showLogOutButton:j=!1,openMenu:y,logOut:S,changeRepresentation:O,children:R,...E},C)=>{const g=m.useMemo(()=>typeof(s==null?void 0:s.lastLoggedIn)=="string"?s.lastLoggedIn:s!=null&&s.lastLoggedIn?new Date(s.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"}):"",[s]),[F,H]=m.useState(!1),[W,V]=m.useState(0),[G,M]=m.useState(!1),J=m.useRef(null);m.useEffect(()=>(document.addEventListener("mouseup",U),window.addEventListener("scroll",$),()=>{document.removeEventListener("mouseup",U),window.removeEventListener("scroll",$)}));const z=()=>{M(!G)},U=h=>{J.current&&!J.current.contains(h.target)&&M(!1)},$=()=>{if(c){const h=window.pageYOffset||document.documentElement.scrollTop;if(h<0||Math.abs(h-W)<60)return;H(h>W),V(h)}};return e.jsxs("header",{...E,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:L(r,"pkt-header",{"pkt-header--fixed":l,"pkt-header--scroll-to-hide":c,"pkt-header--hidden":F}),ref:C,children:[e.jsxs("div",{className:"pkt-header__logo",children:[typeof n=="string"?e.jsx("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:n,children:e.jsx(v,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/11.14/logos/"})}):e.jsx("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header__logo-link",onClick:n,children:e.jsx(v,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/11.14/logos/"})}),e.jsx("span",{className:"pkt-header__logo-service",children:o})]}),e.jsx("nav",{className:"pkt-header__actions",children:e.jsxs("ul",{className:"pkt-header__actions-row",children:[_&&e.jsx("li",{children:e.jsx(ee,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:y,children:"Meny"})}),(s||a)&&e.jsxs("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${G&&!F?"pkt-header--open-dropdown":""}`,ref:J,children:[e.jsxs("button",{className:"pkt-header__user-btn pkt-btn pkt-btn--secondary pkt-btn--icons-right-and-left",type:"button",role:"button","aria-controls":"pktUserDropdown","aria-expanded":G,onClick:z,children:[e.jsx(v,{name:"user",className:"pkt-btn__icon"}),e.jsx("span",{className:"pkt-header__user-fullname",children:(a==null?void 0:a.name)||(s==null?void 0:s.name)}),e.jsx("span",{className:"pkt-header__user-shortname",children:(a==null?void 0:a.shortname)||(s==null?void 0:s.shortname)}),e.jsx(v,{name:"chevron-thin-down",className:"pkt-btn--closed"}),e.jsx(v,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),e.jsxs("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[s&&e.jsxs("li",{children:[e.jsx("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),e.jsx("div",{className:"pkt-user-menu__name",children:s.name}),s.lastLoggedIn&&e.jsxs("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",e.jsx("time",{children:g})]})]}),d&&e.jsx("li",{children:e.jsx("ul",{className:"pkt-list",children:d.map((h,A)=>e.jsx("li",{children:typeof h.target=="string"?e.jsxs("a",{href:h.target,className:"pkt-link",children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]}):e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]})},`userMenu-${A}`))})}),(a||k)&&e.jsxs("li",{children:[a&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pkt-user-menu__label",children:"Representerer"}),e.jsx("div",{className:"pkt-user-menu__name",children:a.name}),a.orgNumber&&e.jsxs("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",a.orgNumber]})]}),e.jsx("ul",{className:"pkt-list mt-size-16",children:k&&e.jsx("li",{children:e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:O,children:[e.jsx(v,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),e.jsx("li",{children:e.jsx("ul",{className:"pkt-list",children:(u||!j)&&e.jsxs(e.Fragment,{children:[u==null?void 0:u.map((h,A)=>e.jsx("li",{children:typeof h.target=="string"?e.jsxs("a",{href:h.target,className:"pkt-link",children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]}):e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:[h.iconName&&e.jsx(v,{name:h.iconName,className:"pkt-link__icon"}),h.title]})},`userOptions-${A}`)),!j&&e.jsx("li",{children:e.jsxs("button",{className:"pkt-link-button pkt-link",onClick:S,children:[e.jsx(v,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),p&&e.jsx("li",{className:"footer",children:e.jsx("ul",{className:"pkt-list-horizontal bordered",children:p.map((h,A)=>e.jsx("li",{children:typeof h.target=="string"?e.jsx("a",{href:h.target,className:"pkt-link",children:h.title}):e.jsx("button",{className:"pkt-link-button pkt-link",onClick:h.target,children:h.title})},`userMenuFooter-${A}`))})})]})]}),R&&e.jsx("li",{children:R}),j&&e.jsx("li",{children:e.jsx(ee,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:S,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),Fe=m.forwardRef(({label:r,id:n,children:o,...l},c)=>e.jsxs("div",{className:"pkt-form-group",children:[e.jsx("label",{htmlFor:n,className:"pkt-form-label",children:r}),e.jsx("input",{className:"pkt-form-input",id:n,...l,ref:c}),o]}));Fe.displayName="PktInput";const ae=m.forwardRef(({forId:r,label:n,helptext:o,helptextDropdown:l,helptextDropdownButton:c,optionalTag:s=!1,optionalText:d="Valgfritt",requiredTag:a=!1,requiredText:u="Må fylles ut",hasError:p,errorMessage:k,disabled:_,inline:j,ariaDescribedby:y,useWrapper:S=!0,children:O,className:R,hasFieldset:E=!1},C)=>{const[g,F]=m.useState(!1),H=()=>{F(!g)},W=()=>s?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":a?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",V=s?d:a?u:"",G=_?"pkt-inputwrapper--disabled":"",M=j?"pkt-inputwrapper--inline":"",J=p?"pkt-inputwrapper--error":"",z=!!l&&l!=="",U=c||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',$=E?"fieldset":z?"div":"label",h=E?"legend":z?"h2":"span",A=y||(o?`${r}-helptext`:void 0);return e.jsxs("div",{className:["pkt-inputwrapper",R,G,M,J].join(" "),ref:C,children:[S?e.jsx(e.Fragment,{children:e.jsxs($,{htmlFor:E?void 0:r,"aria-describedby":z?void 0:y,className:`pkt-inputwrapper__label${E?" pkt-inputwrapper__fieldset":""}`,children:[e.jsxs(h,{id:`${r}-label`,className:`${E?" pkt-inputwrapper__legend":""}`,children:[n,V!==""&&e.jsx("span",{className:W(),children:V})]}),o&&e.jsx("div",{className:"pkt-inputwrapper__helptext",id:`${r}-helptext`,dangerouslySetInnerHTML:{__html:o}}),z&&l!==""&&e.jsxs("div",{className:"pkt-inputwrapper__helptext-expandable",children:[e.jsx(ee,{skin:"tertiary",size:"small",variant:"icon-right",iconName:g?"chevron-thin-up":"chevron-thin-down",className:"pkt-link pkt-link--icon-right",onClick:H,children:e.jsx("span",{dangerouslySetInnerHTML:{__html:U}})}),e.jsx("div",{className:`pkt-inputwrapper__helptext ${g?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:e.jsx("span",{dangerouslySetInnerHTML:{__html:l}})}),!E&&e.jsx("label",{htmlFor:r,className:"pkt-sr-only","aria-describedby":A,children:n})]}),e.jsx(e.Fragment,{children:O})]})}):e.jsxs(e.Fragment,{children:[!E&&e.jsx("label",{htmlFor:r,className:"pkt-sr-only","aria-describedby":A,id:`${r}-label`,children:n}),O]}),p&&k&&e.jsx("div",{children:e.jsx(Ie,{skin:"error","aria-live":"assertive",id:`${r}-error`,compact:!0,children:k})})]})});ae.displayName="PktInputWrapper";const De=m.forwardRef(({children:r,className:n,iconName:o="user",openInNewTab:l=!1,skin:c="normal",href:s="#",external:d=!1,title:a,...u},p)=>{const k=[n,"pkt-linkcard",c&&`pkt-linkcard--${c}`].filter(Boolean).join(" ");return e.jsxs("a",{...u,href:s,className:`pkt-linkcard pkt-link ${k}`,target:l?"_blank":"_self",rel:l?"noopener noreferrer":void 0,ref:p,children:[e.jsx(v,{className:"pkt-link__icon",name:o}),e.jsxs("div",{className:"pkt-linkcard__content",children:[e.jsx("div",{className:`pkt-linkcard__title ${d?"pkt-link pkt-link--external":""}`,children:a}),e.jsx("div",{className:"pkt-linkcard__text",children:r})]})]})});De.displayName="PktLinkCard";const vt=m.forwardRef(({className:r,message:n,size:o="medium",inline:l=!1,isLoading:c=!0,variant:s="rainbow",delay:d=0,children:a,...u},p)=>{const k=`pkt-loader pkt-loader--${o}`,[_,j]=m.useState(!(d>0));d>0&&setTimeout(()=>{j(!0)},d);const y=S=>S==="shapes"?"loader":S==="blue"?"spinner-blue":"spinner";return e.jsx("div",{role:"status","aria-live":"polite","aria-busy":c,className:`pkt-loader--${l?"inline":"box"} ${r||""}`,children:c?e.jsx(e.Fragment,{children:_?e.jsxs("div",{className:k,"data-testid":"pkt-loader",ref:p,...u,children:[e.jsx(v,{name:y(s),"aria-label":"loading",path:"https://punkt-cdn.oslo.kommune.no/11.14/animations/",className:`pkt-loader__svg pkt-loader__${s}`}),n&&e.jsx("p",{children:n})]}):null}):a})}),xt=m.forwardRef(({children:r,className:n,compact:o=!1,closable:l=!1,skin:c="beige",title:s,onClose:d,...a},u)=>{const[p,k]=m.useState(!0),_=()=>{k(!1),d&&d()},j=[n,"pkt-messagebox",c&&`pkt-messagebox--${c}`,o&&"pkt-messagebox--compact"].filter(Boolean).join(" ");return p?e.jsxs("div",{...a,className:j,ref:u,children:[l&&e.jsx("div",{className:"pkt-messagebox__close",children:e.jsx("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:_,children:e.jsx(v,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),s&&e.jsx("div",{className:"pkt-messagebox__title",children:s}),e.jsx("div",{className:"pkt-messagebox__text",children:r})]}):null});for(var B=[],be=0;be<256;++be)B.push((be+256).toString(16).slice(1));function jt(r,n=0){return(B[r[n+0]]+B[r[n+1]]+B[r[n+2]]+B[r[n+3]]+"-"+B[r[n+4]]+B[r[n+5]]+"-"+B[r[n+6]]+B[r[n+7]]+"-"+B[r[n+8]]+B[r[n+9]]+"-"+B[r[n+10]]+B[r[n+11]]+B[r[n+12]]+B[r[n+13]]+B[r[n+14]]+B[r[n+15]]).toLowerCase()}var ce,gt=new Uint8Array(16);function Nt(){if(!ce&&(ce=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ce))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ce(gt)}var yt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ae={randomUUID:yt};function wt(r,n,o){if(Ae.randomUUID&&!n&&!r)return Ae.randomUUID();r=r||{};var l=r.random||(r.rng||Nt)();if(l[6]=l[6]&15|64,l[8]=l[8]&63|128,n){o=o||0;for(var c=0;c<16;++c)n[o+c]=l[c];return n}return jt(l)}const Pt=m.forwardRef(({valueCurrent:r,valueMin:n=0,valueMax:o=100,skin:l="dark-blue",title:c,titlePosition:s="left",statusType:d="none",statusPlacement:a="following",id:u,ariaLabel:p,ariaLabelledby:k,role:_="progressbar",className:j,ariaValueText:y,...S},O)=>{const R=m.useRef(null),[E,C]=m.useState(0),[g,F]=m.useState(u);m.useEffect(()=>{u||F(wt())},[u]),m.useEffect(()=>{if(R.current){const h=R.current;C(h.getBoundingClientRect().width)}});const H=o-n,W=r/H*100,V=o!==100||n!==0?Math.round(W):r,G=`${r} av ${o}`,M=d!=="none",J=L("pkt-progressbar__bar",{[`pkt-progressbar__bar--${l}`]:l}),z=L("pkt-progressbar__title",{"pkt-progressbar__title-center":s==="center"}),U=L("pkt-progressbar__status",{"pkt-progressbar__status--center":a==="center"}),$=L({"pkt-progressbar__status-placement--following":a==="following","pkt-progressbar__status-placement--center":a==="center","pkt-progressbar__status-placement--left":a==="left"});return e.jsxs("div",{...S,ref:O,className:L("pkt-progressbar__container",j),id:g,style:{"--pkt-progress-label-width":`${E}px`,"--pkt-progress-width":`${V}%`},children:[c&&e.jsx("p",{id:`${g}-title`,className:z,children:c}),e.jsx("div",{role:_,className:"pkt-progressbar__bar-wrapper","aria-valuemin":n,"aria-valuemax":o,"aria-valuenow":r,"aria-labelledby":k||c&&`${g}-title`,"aria-label":p,"aria-valuetext":y,children:e.jsx("div",{className:J})}),M&&e.jsx("div",{className:U,children:e.jsx("span",{className:$,ref:R,children:d==="percentage"?`${V}%`:G})})]})}),Le=m.forwardRef(({id:r,name:n,label:o,className:l,hasTile:c=!1,disabled:s=!1,checkHelptext:d,hasError:a=!1,...u},p)=>{const k=[l,"pkt-input-check"].filter(Boolean).join(" ");return e.jsx("div",{className:k,children:e.jsxs("div",{className:`pkt-input-check__input ${c?"pkt-input-check__input--tile":""} ${s&&c?"pkt-input-check__input--tile-disabled":""}`,children:[e.jsx("input",{ref:p,className:`pkt-input-check__input-checkbox ${a?"pkt-input-check__input-checkbox--error":""}`,type:"radio",id:r,disabled:s,name:n,...u}),e.jsxs("label",{className:"pkt-input-check__input-label",htmlFor:r,children:[o,d&&e.jsx("div",{className:"pkt-input-check__input-helptext",children:d})]})]})})});Le.displayName="PktRadioButton";const Ct=m.forwardRef(({action:r,appearance:n="local",disabled:o=!1,fullwidth:l=!1,id:c,label:s,method:d="get",name:a,placeholder:u="Søk…",suggestions:p,value:k="",onSearch:_,onSuggestionClick:j,...y},S)=>{const O=(g,F)=>{g?g():j&&j(F)},R=`pkt-searchinput pkt-searchinput--${n} ${l?"pkt-searchinput--fullwidth":""}`,E=r?"form":"div",C=s?"label":"div";return e.jsxs(E,{className:R,onSubmit:_&&(()=>_(k)),action:r||void 0,method:r?d:void 0,role:"search",ref:S,...y,children:[e.jsxs(C,{htmlFor:s?c:void 0,className:s?"pkt-inputwrapper__label":"",children:[s&&e.jsx(e.Fragment,{children:s}),e.jsxs("div",{className:n==="local"?"pkt-input__container":"pkt-searchinput__field",children:[e.jsx("input",{className:`pkt-input ${l?"pkt-input--fullwidth":""}`,type:"search",name:a||c,id:c,placeholder:u,defaultValue:k,disabled:o,onInput:_&&(g=>_(g.currentTarget.value)),autoComplete:"off","aria-autocomplete":"list","aria-controls":`${c}-suggestions`}),e.jsx(ee,{className:`pkt-searchinput__button ${n==="local"?"pkt-input-icon":""}`,variant:"icon-only",iconName:"magnifying-glass-big",skin:n==="local"?"tertiary":"primary",color:n==="global"?"yellow":void 0,type:"submit",disabled:o,onClick:_&&(()=>_(k)),onKeyUp:_&&(g=>g.key==="Enter"&&_(k)),children:s||u})]})]}),p&&e.jsx("ul",{id:`${c}-suggestions`,className:"pkt-searchinput__suggestions","aria-live":"assertive",children:p.map((g,F)=>e.jsx("li",{children:m.createElement(g.href?"a":g.onClick?"button":"div",{href:g.href,className:`pkt-searchinput__suggestion ${g.onClick?"pkt-link-button":""} ${g.href||g.onClick?"pkt-searchinput__suggestion--has-hover":""}`,type:g.onClick?"button":void 0,onClick:()=>O(g.onClick,F),onKeyUp:()=>O(g.onClick,F)},e.jsxs(e.Fragment,{children:[g.title&&e.jsx("h3",{className:"pkt-searchinput__suggestion-title",children:g.title}),g.text&&e.jsx("p",{className:"pkt-searchinput__suggestion-text",children:g.text})]}))},`search-suggestion-${F}`))})]})}),Et=m.forwardRef(({ariaDescribedby:r,ariaLabelledby:n,children:o,className:l,disabled:c=!1,errorMessage:s,hasError:d,helptext:a,helptextDropdown:u,helptextDropdownButton:p,id:k,inline:_=!1,fullwidth:j=!1,label:y,name:S,optionalTag:O=!1,optionalText:R,requiredTag:E=!1,requiredText:C,...g},F)=>{const H=[l,"pkt-select"].join(" ");return e.jsx(ae,{className:H,forId:k,label:y,helptext:a,helptextDropdown:u,helptextDropdownButton:p,optionalTag:O,optionalText:R,requiredTag:E,requiredText:C,hasError:d,errorMessage:s,disabled:c,inline:_,ariaDescribedby:r,children:e.jsx("select",{ref:F,className:`pkt-input ${j?"pkt-input--fullwidth":""}`,"aria-invalid":d,"aria-errormessage":`${k}-error`,"aria-labelledby":n||`${k}-label`,disabled:c,id:k,name:S||k,...g,children:o})})}),St=m.forwardRef(({activeStep:r,className:n,children:o,hideNonActiveStepsContent:l=!0,orientation:c="vertical",...s},d)=>{const a=L(n,"pkt-stepper",c==="horizontal"?"pkt-stepper--horizontal":"pkt-stepper--vertical"),u=m.Children.map(o,(p,k)=>m.isValidElement(p)?m.cloneElement(p,{className:L(p.props.className,{"pkt-step--hidden":l&&k!==r})}):p);return e.jsx("ol",{"data-testid":"pkt-stepper",className:a,ref:d,...s,children:u})}),Tt=e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:e.jsx("circle",{cx:"12",cy:"12",r:"7",style:{fill:"var(--pkt-color-grays-grey-200, #CCC)"}})}),$t=e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[e.jsx("circle",{opacity:".15",cx:"12",cy:"12",r:"12",fill:"#2A2859"}),e.jsx("circle",{cx:"12",cy:"12",r:"6",fill:"#2A2859"})]}),Rt=e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[e.jsx("path",{fill:"#2A2859",d:"M3 3h18v18H3z"}),e.jsx("path",{d:"m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z",fill:"#F1FDFF"})]}),It=({children:r,className:n,status:o="incomplete",title:l})=>e.jsxs("li",{className:L("pkt-step",n,`pkt-step--${o}`),"data-testid":"pkt-step",children:[e.jsx("span",{className:"pkt-step__line pkt-step__line--1"}),e.jsx("span",{className:"pkt-step__line pkt-step__line--2"}),e.jsx("span",{className:L("pkt-step__indicator"),children:o==="current"?$t:o==="completed"?Rt:Tt}),e.jsx("span",{className:"pkt-step__line pkt-step__line--3",role:"separator"}),e.jsxs("div",{className:"pkt-step__wrapper",children:[e.jsx("div",{className:"pkt-step__title",children:l}),e.jsx("div",{className:"pkt-step__content",children:r})]})]}),Ot=({className:r,compact:n=!1,skin:o="basic",responsiveView:l=!0,children:c})=>e.jsx("table",{"data-testid":"pkt-table",className:L(r,"pkt-table",{"pkt-table--responsive":l,"pkt-table--compact":n,"pkt-table--basic":o==="basic","pkt-table--zebra-blue":o==="zebra-blue"}),role:"table",children:c}),Ft=({children:r,className:n,dataLabel:o})=>e.jsx("td",{className:L(n,"pkt-table__data-cell",{}),"data-label":o,role:"cell","data-testid":"pkt-table__data-cell",children:r}),Dt=({className:r,children:n})=>e.jsx("th",{className:L(r,"pkt-table__header-cell",{}),role:"columnheader",children:n}),At=({className:r,children:n})=>e.jsx("thead",{className:L(r,"pkt-table__header",{}),role:"rowgroup",children:n}),Lt=({className:r,children:n})=>e.jsx("tr",{className:L(r,"pkt-table__row",{}),role:"row",children:n}),Bt=({children:r,className:n})=>e.jsx("tbody",{className:L(n,"pkt-table__body",{}),role:"rowgroup",children:r}),pe=m.forwardRef(({children:r,className:n,skin:o="blue",textStyle:l="normal-text",size:c="medium",closeTag:s=!1,iconName:d="",type:a="button",ariaLabel:u="close",onClick:p=()=>{}},k)=>{const[_,j]=m.useState(!1),y=E=>{j(!0),p(E)},S=["pkt-tag",c&&`pkt-tag--${c}`,o&&`pkt-tag--${o}`,l&&`pkt-tag--${l}`,n].filter(Boolean).join(" "),O=["pkt-tag","pkt-btn","pkt-btn--tertiary",c&&`pkt-tag--${c}`,o&&`pkt-tag--${o}`,l&&`pkt-tag--${l}`,d&&s?"pkt-btn--icons-right-and-left":null,s&&!d?"pkt-btn--icon-right":null,n].filter(Boolean).join(" "),R=!_;return s&&d?e.jsx(e.Fragment,{children:R&&e.jsxs("button",{className:O,type:a,"aria-label":u,onClick:y,ref:k,children:[e.jsx(v,{className:"pkt-tag__icon",name:d}),r,e.jsx(v,{className:"pkt-tag__close-btn",name:"close"})]})}):s?e.jsx(e.Fragment,{children:R&&e.jsxs("button",{className:O,type:a,"aria-label":u,onClick:y,ref:k,children:[e.jsx(v,{className:"pkt-tag__close-btn",name:"close"}),r]})}):d?e.jsxs("span",{className:S,children:[e.jsx(v,{className:"pkt-tag__icon",name:d}),r]}):e.jsx("span",{className:S,children:r})});pe.displayName="PktTag";const Ut=m.forwardRef(({arrowNav:r=!0,tabs:n,onTabSelected:o},l)=>{const c=m.useRef([]);m.useEffect(()=>{c.current=c.current.slice(0,n.length)},[n]);const s=(a,u)=>{u.action&&u.action(a),o&&o(a)},d=(a,u)=>{var p,k;r&&(u.code==="ArrowLeft"&&a!==0&&((p=c.current[a-1])==null||p.focus()),u.code==="ArrowRight"&&a<n.length-1&&((k=c.current[a+1])==null||k.focus()),(u.code==="ArrowDown"||u.code==="Space")&&s(a,n[a]))};return e.jsx("div",{className:"pkt-tabs",ref:l,children:e.jsx("div",{className:"pkt-tabs__list",role:r?"tablist":"navigation",children:n.map((a,u)=>e.jsx(m.Fragment,{children:a.href?e.jsxs("a",{"aria-selected":!!a.active,role:r?"tab":void 0,href:a.href,"aria-controls":a.controls,className:`pkt-tabs__link ${a.active?"active":""}`,onKeyUp:p=>d(u,p),onClick:()=>s(u,a),tabIndex:a.active||!r?void 0:-1,ref:p=>{c.current[u]=p},children:[a.icon&&e.jsx(v,{name:a.icon,className:"pkt-icon--small"}),a.text,a.tag&&e.jsx(pe,{skin:a.tag.skin,size:"small",children:a.tag.text})]}):e.jsxs("button",{"aria-selected":!!a.active,role:r?"tab":void 0,type:"button","aria-controls":a.controls,className:`pkt-tabs__button pkt-link-button ${a.active?"active":""}`,onKeyUp:p=>d(u,p),onClick:()=>s(u,a),tabIndex:a.active||!r?void 0:-1,ref:p=>{c.current[u]=p},children:[a.icon&&e.jsx(v,{name:a.icon,className:"pkt-icon--small"}),a.text,a.tag&&e.jsx(pe,{skin:a.tag.skin,size:"small",children:a.tag.text})]},"b-"+u)},u))})})}),Wt=m.forwardRef(({id:r,ariaDescribedby:n,ariaLabelledby:o,counter:l,counterMaxLength:c,className:s,disabled:d,errorMessage:a,hasError:u,helptext:p,helptextDropdown:k,helptextDropdownButton:_,inline:j,fullwidth:y=!1,label:S,name:O,optionalTag:R=!1,optionalText:E,requiredTag:C=!1,requiredText:g,placeholder:F,rows:H,useWrapper:W=!0,onChange:V,...G},M)=>{const J=[s,"pkt-textinput","pkt-textarea"].join(" "),z=o||`${r}-label`,U=m.useRef(null),[$,h]=m.useState(0),A=X=>{var Z,le;if(l&&h(((le=(Z=X.currentTarget)==null?void 0:Z.value)==null?void 0:le.length)||0),V)return V(X)};return m.useEffect(()=>{var X,Z;typeof M=="function"&&M(U.current),l&&h(((Z=(X=U==null?void 0:U.current)==null?void 0:X.value)==null?void 0:Z.length)||0)},[M]),e.jsxs(ae,{ariaDescribedby:n,className:J,disabled:d,errorMessage:a,forId:r,hasError:u,helptext:p,helptextDropdown:k,helptextDropdownButton:_,inline:j,label:S,optionalTag:R,optionalText:E,requiredTag:C,requiredText:g,useWrapper:W,children:[e.jsx("textarea",{ref:U,className:`pkt-input ${y?"pkt-input--fullwidth":""} ${c&&$>c?"pkt-input--counter-error":""}`,name:O||r,id:r,placeholder:F,disabled:d,rows:H,"aria-labelledby":z,"aria-invalid":u,"aria-errormessage":`${r}-error`,...G,onChange:A}),l&&e.jsxs("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":!0,children:[$||0,c&&`/${c}`]})]})}),Vt=m.forwardRef(({id:r,ariaDescribedby:n,ariaLabelledby:o,autocomplete:l="off",className:c,disabled:s=!1,errorMessage:d,hasError:a=!1,helptext:u,helptextDropdown:p,helptextDropdownButton:k,iconNameRight:_,inline:j=!1,fullwidth:y=!1,label:S,name:O,optionalTag:R=!1,optionalText:E,requiredTag:C=!1,requiredText:g,placeholder:F,prefix:H,suffix:W,type:V="text",useWrapper:G=!0,omitSearchIcon:M=!1,value:J,...z},U)=>{const $=[c,"pkt-textinput"].join(" "),h=o||`${r}-label`,A=V==="search"&&!_&&!M;return e.jsx(ae,{ariaDescribedby:n,className:$,disabled:s,errorMessage:d,forId:r,hasError:a,helptext:u,helptextDropdown:p,helptextDropdownButton:k,inline:j,label:S,optionalTag:R,optionalText:E,requiredTag:C,requiredText:g,useWrapper:G,children:e.jsxs("div",{className:"pkt-input__container",children:[H&&e.jsx("div",{className:"pkt-input-prefix",children:H}),e.jsx("input",{ref:U,className:`pkt-input ${y?"pkt-input--fullwidth":""}`,type:V,name:O||r,id:r,placeholder:F,autoComplete:l,value:J,disabled:s,"aria-invalid":a,"aria-errormessage":`${r}-error`,"aria-labelledby":h,...z}),W&&e.jsxs("p",{className:"pkt-input-suffix",children:[W,_&&e.jsx(v,{className:"pkt-input-suffix-icon",name:_}),A&&e.jsx(v,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!W&&_&&e.jsx(v,{className:"pkt-input-icon",name:_}),!W&&A&&e.jsx(v,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});x.PktAccordion=it,x.PktAccordionItem=ft,x.PktAlert=Ie,x.PktBackLink=kt,x.PktBreadcrumbs=mt,x.PktButton=ee,x.PktCheckbox=Oe,x.PktFooter=ht,x.PktFooterSimple=_t,x.PktHeader=bt,x.PktIcon=v,x.PktIconContext=$e,x.PktInput=Fe,x.PktInputWrapper=ae,x.PktLinkCard=De,x.PktLoader=vt,x.PktMessagebox=xt,x.PktProgressbar=Pt,x.PktRadioButton=Le,x.PktSearchInput=Ct,x.PktSelect=Et,x.PktStep=It,x.PktStepper=St,x.PktTable=Ot,x.PktTableBody=Bt,x.PktTableDataCell=Ft,x.PktTableHeader=At,x.PktTableHeaderCell=Dt,x.PktTableRow=Lt,x.PktTabs=Ut,x.PktTag=pe,x.PktTextarea=Wt,x.PktTextinput=Vt,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "11.14.
|
|
3
|
+
"version": "11.14.2",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@oslokommune/punkt-assets": "^11.13.14",
|
|
36
|
-
"@oslokommune/punkt-css": "^11.14.
|
|
36
|
+
"@oslokommune/punkt-css": "^11.14.2",
|
|
37
37
|
"@testing-library/jest-dom": "^6.4.5",
|
|
38
38
|
"@testing-library/react": "^15.0.7",
|
|
39
39
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
92
92
|
},
|
|
93
93
|
"license": "MIT",
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "817b273dbc62a68c7c9bf259e08bacd26bc538a1"
|
|
95
95
|
}
|
|
@@ -2,7 +2,7 @@ import '@testing-library/jest-dom'
|
|
|
2
2
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
3
|
import { PktAccordion } from './Accordion'
|
|
4
4
|
import { PktAccordionItem } from './AccordionItem'
|
|
5
|
-
import { render, screen
|
|
5
|
+
import { render, screen } from '@testing-library/react'
|
|
6
6
|
import React, { createRef } from 'react'
|
|
7
7
|
|
|
8
8
|
expect.extend(toHaveNoViolations)
|
|
@@ -49,8 +49,6 @@ describe('PktAccordion', () => {
|
|
|
49
49
|
})
|
|
50
50
|
|
|
51
51
|
test('applies compact and skin ', () => {
|
|
52
|
-
const mockToggleOpen = jest.fn()
|
|
53
|
-
|
|
54
52
|
render(
|
|
55
53
|
<>
|
|
56
54
|
<h3 id="accordion-heading">Accordion Heading</h3>
|
|
@@ -68,7 +66,6 @@ describe('PktAccordion', () => {
|
|
|
68
66
|
|
|
69
67
|
describe('accessibility', () => {
|
|
70
68
|
it('renders with no wcag errors with axe', async () => {
|
|
71
|
-
const mockToggleOpen = jest.fn()
|
|
72
69
|
const { container } = render(
|
|
73
70
|
<PktAccordion>
|
|
74
71
|
<PktAccordionItem title="Title 1" id="item1">
|
package/src/components/index.ts
CHANGED
|
@@ -19,6 +19,8 @@ export { PktProgressbar } from './progressbar/Progressbar'
|
|
|
19
19
|
export { PktRadioButton } from './radio/RadioButton'
|
|
20
20
|
export { PktSearchInput } from './searchinput/SearchInput'
|
|
21
21
|
export { PktSelect } from './select/Select'
|
|
22
|
+
export { PktStepper } from './stepper/Stepper'
|
|
23
|
+
export { PktStep } from './stepper/Step'
|
|
22
24
|
export { PktTable } from './table/Table'
|
|
23
25
|
export { PktTableDataCell } from './table/TableDataCell'
|
|
24
26
|
export { PktTableHeaderCell } from './table/TableHeaderCell'
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import cn from 'classnames'
|
|
2
|
+
|
|
3
|
+
export type TStepStatus = 'completed' | 'incomplete' | 'current'
|
|
4
|
+
|
|
5
|
+
export interface IPktStep {
|
|
6
|
+
/**
|
|
7
|
+
* Step content. Can be a string, a React component or an element.
|
|
8
|
+
*/
|
|
9
|
+
children?: React.ReactNode
|
|
10
|
+
/**
|
|
11
|
+
* Additional class names
|
|
12
|
+
*/
|
|
13
|
+
className?: string
|
|
14
|
+
/**
|
|
15
|
+
* Step status. Can be 'completed', 'incomplete' or 'current'
|
|
16
|
+
*/
|
|
17
|
+
status: TStepStatus
|
|
18
|
+
/**
|
|
19
|
+
* Title of the step
|
|
20
|
+
*/
|
|
21
|
+
title: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const incompleteStepSVG = (
|
|
25
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
|
|
26
|
+
<circle cx="12" cy="12" r="7" style={{ fill: 'var(--pkt-color-grays-grey-200, #CCC)' }} />
|
|
27
|
+
</svg>
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const currentStepSVG = (
|
|
31
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
|
|
32
|
+
<circle opacity=".15" cx="12" cy="12" r="12" fill="#2A2859" />
|
|
33
|
+
<circle cx="12" cy="12" r="6" fill="#2A2859" />
|
|
34
|
+
</svg>
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
const completedStepSVG = (
|
|
38
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
|
|
39
|
+
<path fill="#2A2859" d="M3 3h18v18H3z" />
|
|
40
|
+
<path d="m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z" fill="#F1FDFF" />
|
|
41
|
+
</svg>
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
export const PktStep = ({ children, className, status = 'incomplete', title }: IPktStep) => {
|
|
45
|
+
return (
|
|
46
|
+
<li className={cn('pkt-step', className, `pkt-step--${status}`)} data-testid="pkt-step">
|
|
47
|
+
<span className="pkt-step__line pkt-step__line--1"></span>
|
|
48
|
+
<span className="pkt-step__line pkt-step__line--2"></span>
|
|
49
|
+
<span className={cn('pkt-step__indicator')}>
|
|
50
|
+
{status === 'current' ? currentStepSVG : status === 'completed' ? completedStepSVG : incompleteStepSVG}
|
|
51
|
+
</span>
|
|
52
|
+
<span className="pkt-step__line pkt-step__line--3" role="separator" />
|
|
53
|
+
<div className="pkt-step__wrapper">
|
|
54
|
+
<div className="pkt-step__title">{title}</div>
|
|
55
|
+
<div className="pkt-step__content">{children}</div>
|
|
56
|
+
</div>
|
|
57
|
+
</li>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
|
+
import { PktStepper } from './Stepper'
|
|
4
|
+
import { PktStep } from './Step'
|
|
5
|
+
import { render, screen } from '@testing-library/react'
|
|
6
|
+
import { createRef } from 'react'
|
|
7
|
+
|
|
8
|
+
expect.extend(toHaveNoViolations)
|
|
9
|
+
|
|
10
|
+
describe('PktStepper', () => {
|
|
11
|
+
test('renders without errors', () => {
|
|
12
|
+
render(
|
|
13
|
+
<PktStepper activeStep={0}>
|
|
14
|
+
<PktStep title="test" status="completed">
|
|
15
|
+
content
|
|
16
|
+
</PktStep>
|
|
17
|
+
<PktStep title="test" status="current">
|
|
18
|
+
content
|
|
19
|
+
</PktStep>
|
|
20
|
+
<PktStep title="test" status="incomplete">
|
|
21
|
+
content
|
|
22
|
+
</PktStep>
|
|
23
|
+
</PktStepper>,
|
|
24
|
+
)
|
|
25
|
+
// Assert that the Stepper component renders without throwing any errors
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('ref works correctly', () => {
|
|
29
|
+
const ref = createRef<HTMLOListElement>()
|
|
30
|
+
const { unmount } = render(
|
|
31
|
+
<PktStepper ref={ref} activeStep={0}>
|
|
32
|
+
<PktStep title="test" status="current">
|
|
33
|
+
content
|
|
34
|
+
</PktStep>
|
|
35
|
+
</PktStepper>,
|
|
36
|
+
)
|
|
37
|
+
expect(ref.current).toBeInstanceOf(HTMLOListElement)
|
|
38
|
+
|
|
39
|
+
unmount()
|
|
40
|
+
expect(ref.current).toBe(null)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test('renders children', () => {
|
|
44
|
+
render(
|
|
45
|
+
<PktStepper activeStep={0}>
|
|
46
|
+
<PktStep title="Title 1" status="completed">
|
|
47
|
+
Content 1
|
|
48
|
+
</PktStep>
|
|
49
|
+
<PktStep title="Title 2" status="current">
|
|
50
|
+
Content 2
|
|
51
|
+
</PktStep>
|
|
52
|
+
</PktStepper>,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
// Assert that the Step component renders its children correctly
|
|
56
|
+
expect(screen.getByText('Title 1')).toBeInTheDocument()
|
|
57
|
+
expect(screen.getByText('Content 1')).toBeInTheDocument()
|
|
58
|
+
expect(screen.getByText('Title 2')).toBeInTheDocument()
|
|
59
|
+
expect(screen.getByText('Content 2')).toBeInTheDocument()
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
test('applies orientation and status correctly ', () => {
|
|
63
|
+
render(
|
|
64
|
+
<>
|
|
65
|
+
<PktStepper orientation="horizontal" activeStep={0}>
|
|
66
|
+
<PktStep title="Title" status="current">
|
|
67
|
+
Content
|
|
68
|
+
</PktStep>
|
|
69
|
+
</PktStepper>
|
|
70
|
+
</>,
|
|
71
|
+
)
|
|
72
|
+
// Assert that the Accordion component applies the props correctly
|
|
73
|
+
expect(screen.getByTestId('pkt-stepper')).toHaveClass('pkt-stepper--horizontal')
|
|
74
|
+
expect(screen.getByTestId('pkt-step')).toHaveClass('pkt-step--current')
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
describe('accessibility', () => {
|
|
78
|
+
it('renders with no wcag errors with axe', async () => {
|
|
79
|
+
const { container } = render(
|
|
80
|
+
<PktStepper activeStep={0}>
|
|
81
|
+
<PktStep title="Title 1" status="completed">
|
|
82
|
+
Content 1
|
|
83
|
+
</PktStep>
|
|
84
|
+
<PktStep title="Title 2" status="current">
|
|
85
|
+
Content 2
|
|
86
|
+
</PktStep>
|
|
87
|
+
</PktStepper>,
|
|
88
|
+
)
|
|
89
|
+
const results = await axe(container)
|
|
90
|
+
expect(results).toHaveNoViolations()
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ReactElement, Ref, forwardRef } from 'react'
|
|
2
|
+
import { IPktStep } from './Step'
|
|
3
|
+
import classNames from 'classnames'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
export interface IPktStepper extends React.HTMLAttributes<HTMLOListElement> {
|
|
7
|
+
/**
|
|
8
|
+
* The index of the current active step
|
|
9
|
+
*/
|
|
10
|
+
activeStep: number
|
|
11
|
+
/**
|
|
12
|
+
* Children of the Stepper must be Step items. Either an Array of Step items or a single Step item.
|
|
13
|
+
*/
|
|
14
|
+
children: ReactElement<IPktStep>[] | ReactElement<IPktStep>
|
|
15
|
+
/**
|
|
16
|
+
* Additional class names
|
|
17
|
+
*/
|
|
18
|
+
className?: string
|
|
19
|
+
/**
|
|
20
|
+
* Boolean to hide the content of non-active steps
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
hideNonActiveStepsContent?: boolean
|
|
24
|
+
/**
|
|
25
|
+
* Orientation of the stepper.
|
|
26
|
+
* @default vertical
|
|
27
|
+
*/
|
|
28
|
+
orientation?: 'horizontal' | 'vertical' // default vertical
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const PktStepper = forwardRef(
|
|
32
|
+
(
|
|
33
|
+
{
|
|
34
|
+
activeStep,
|
|
35
|
+
className,
|
|
36
|
+
children,
|
|
37
|
+
hideNonActiveStepsContent = true,
|
|
38
|
+
orientation = 'vertical',
|
|
39
|
+
|
|
40
|
+
...restProps
|
|
41
|
+
}: IPktStepper,
|
|
42
|
+
ref: Ref<HTMLOListElement>,
|
|
43
|
+
) => {
|
|
44
|
+
const stylingClasses = classNames(
|
|
45
|
+
className,
|
|
46
|
+
'pkt-stepper',
|
|
47
|
+
orientation === 'horizontal' ? 'pkt-stepper--horizontal' : 'pkt-stepper--vertical',
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
const childrenWithProps = React.Children.map(children, (child, index) => {
|
|
51
|
+
if (React.isValidElement(child)) {
|
|
52
|
+
return React.cloneElement(child, {
|
|
53
|
+
className: classNames(child.props.className, {
|
|
54
|
+
'pkt-step--hidden': hideNonActiveStepsContent && index !== activeStep,
|
|
55
|
+
}),
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
return child
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<ol data-testid="pkt-stepper" className={stylingClasses} ref={ref} {...restProps}>
|
|
63
|
+
{childrenWithProps}
|
|
64
|
+
</ol>
|
|
65
|
+
)
|
|
66
|
+
},
|
|
67
|
+
)
|