@oslokommune/punkt-react 7.0.0 → 7.1.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 +36 -0
- package/dist/backlink/BackLink.d.ts +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/punkt-react.es.js +404 -390
- package/dist/punkt-react.umd.js +9 -9
- package/package.json +3 -3
- package/src/components/backlink/BackLink.test.tsx +50 -0
- package/src/components/backlink/BackLink.tsx +42 -0
- package/src/components/index.ts +1 -0
- package/src/components/textarea/Textarea.tsx +9 -6
package/dist/punkt-react.umd.js
CHANGED
|
@@ -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 Ne;function Ze(){if(Ne)return Z;Ne=1;var n=N,
|
|
9
|
+
*/var Ne;function Ze(){if(Ne)return Z;Ne=1;var n=N,p=Symbol.for("react.element"),c=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,l=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function f(i,d,x){var y,b={},S=null,j=null;x!==void 0&&(S=""+x),d.key!==void 0&&(S=""+d.key),d.ref!==void 0&&(j=d.ref);for(y in d)s.call(d,y)&&!u.hasOwnProperty(y)&&(b[y]=d[y]);if(i&&i.defaultProps)for(y in d=i.defaultProps,d)b[y]===void 0&&(b[y]=d[y]);return{$$typeof:p,type:i,key:S,ref:j,props:b,_owner:l.current}}return Z.Fragment=c,Z.jsx=f,Z.jsxs=f,Z}var Q={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,18 +14,18 @@
|
|
|
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 ye;function Qe(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&function(){var n=N,
|
|
18
|
-
`+me+e}}var ke=!1,le;{var
|
|
17
|
+
*/var ye;function Qe(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&function(){var n=N,p=Symbol.for("react.element"),c=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),i=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),j=Symbol.for("react.offscreen"),F=Symbol.iterator,W="@@iterator";function $(e){if(e===null||typeof e!="object")return null;var r=F&&e[F]||e[W];return typeof r=="function"?r:null}var R=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(e){{for(var r=arguments.length,a=new Array(r>1?r-1:0),m=1;m<r;m++)a[m-1]=arguments[m];L("error",e,a)}}function L(e,r,a){{var m=R.ReactDebugCurrentFrame,g=m.getStackAddendum();g!==""&&(r+="%s",a=a.concat([g]));var P=a.map(function(_){return String(_)});P.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,P)}}var O=!1,G=!1,M=!1,B=!1,I=!1,U;U=Symbol.for("react.module.reference");function V(e){return!!(typeof e=="string"||typeof e=="function"||e===s||e===u||I||e===l||e===x||e===y||B||e===j||O||G||M||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===b||e.$$typeof===f||e.$$typeof===i||e.$$typeof===d||e.$$typeof===U||e.getModuleId!==void 0))}function z(e,r,a){var m=e.displayName;if(m)return m;var g=r.displayName||r.name||"";return g!==""?a+"("+g+")":a}function k(e){return e.displayName||"Context"}function D(e){if(e==null)return null;if(typeof e.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case s:return"Fragment";case c:return"Portal";case u:return"Profiler";case l:return"StrictMode";case x:return"Suspense";case y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case i:var r=e;return k(r)+".Consumer";case f:var a=e;return k(a._context)+".Provider";case d:return z(e,e.render,"ForwardRef");case b:var m=e.displayName||null;return m!==null?m:D(e.type)||"Memo";case S:{var g=e,P=g._payload,_=g._init;try{return D(_(P))}catch{return null}}}return null}var J=Object.assign,te=0,Ce,Se,je,Oe,$e,Ie,Fe;function De(){}De.__reactDisabledLog=!0;function kt(){{if(te===0){Ce=console.log,Se=console.info,je=console.warn,Oe=console.error,$e=console.group,Ie=console.groupCollapsed,Fe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:De,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}te++}}function ht(){{if(te--,te===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},e,{value:Ce}),info:J({},e,{value:Se}),warn:J({},e,{value:je}),error:J({},e,{value:Oe}),group:J({},e,{value:$e}),groupCollapsed:J({},e,{value:Ie}),groupEnd:J({},e,{value:Fe})})}te<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var de=R.ReactCurrentDispatcher,me;function ae(e,r,a){{if(me===void 0)try{throw Error()}catch(g){var m=g.stack.trim().match(/\n( *(at )?)/);me=m&&m[1]||""}return`
|
|
18
|
+
`+me+e}}var ke=!1,le;{var _t=typeof WeakMap=="function"?WeakMap:Map;le=new _t}function Ae(e,r){if(!e||ke)return"";{var a=le.get(e);if(a!==void 0)return a}var m;ke=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var P;P=de.current,de.current=null,kt();try{if(r){var _=function(){throw Error()};if(Object.defineProperty(_.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_,[])}catch(q){m=q}Reflect.construct(e,[],_)}else{try{_.call()}catch(q){m=q}e.call(_.prototype)}}else{try{throw Error()}catch(q){m=q}e()}}catch(q){if(q&&m&&typeof q.stack=="string"){for(var h=q.stack.split(`
|
|
19
19
|
`),A=m.stack.split(`
|
|
20
|
-
`),T=h.length-1,C=A.length-1;T>=1&&C>=0&&h[T]!==A[C];)C--;for(;T>=1&&C>=0;T--,C--)if(h[T]!==A[C]){if(T!==1||C!==1)do if(T--,C--,C<0||h[T]!==A[C]){var
|
|
21
|
-
`+h[T].replace(" at new "," at ");return e.displayName&&
|
|
20
|
+
`),T=h.length-1,C=A.length-1;T>=1&&C>=0&&h[T]!==A[C];)C--;for(;T>=1&&C>=0;T--,C--)if(h[T]!==A[C]){if(T!==1||C!==1)do if(T--,C--,C<0||h[T]!==A[C]){var Y=`
|
|
21
|
+
`+h[T].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),typeof e=="function"&&le.set(e,Y),Y}while(T>=1&&C>=0);break}}}finally{ke=!1,de.current=P,ht(),Error.prepareStackTrace=g}var X=e?e.displayName||e.name:"",Ke=X?ae(X):"";return typeof e=="function"&&le.set(e,Ke),Ke}function vt(e,r,a){return Ae(e,!1)}function bt(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function ie(e,r,a){if(e==null)return"";if(typeof e=="function")return Ae(e,bt(e));if(typeof e=="string")return ae(e);switch(e){case x:return ae("Suspense");case y:return ae("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return vt(e.render);case b:return ie(e.type,r,a);case S:{var m=e,g=m._payload,P=m._init;try{return ie(P(g),r,a)}catch{}}}return""}var oe=Object.prototype.hasOwnProperty,Le={},Me=R.ReactDebugCurrentFrame;function se(e){if(e){var r=e._owner,a=ie(e.type,e._source,r?r.type:null);Me.setExtraStackFrame(a)}else Me.setExtraStackFrame(null)}function gt(e,r,a,m,g){{var P=Function.call.bind(oe);for(var _ in e)if(P(e,_)){var h=void 0;try{if(typeof e[_]!="function"){var A=Error((m||"React class")+": "+a+" type `"+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[_]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw A.name="Invariant Violation",A}h=e[_](r,_,m,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(T){h=T}h&&!(h instanceof Error)&&(se(g),w("%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).",m||"React class",a,_,typeof h),se(null)),h instanceof Error&&!(h.message in Le)&&(Le[h.message]=!0,se(g),w("Failed %s type: %s",a,h.message),se(null))}}}var Nt=Array.isArray;function he(e){return Nt(e)}function yt(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,a=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function wt(e){try{return We(e),!1}catch{return!0}}function We(e){return""+e}function Be(e){if(wt(e))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",yt(e)),We(e)}var re=R.ReactCurrentOwner,Pt={key:!0,ref:!0,__self:!0,__source:!0},Ye,Ue,_e;_e={};function Et(e){if(oe.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function xt(e){if(oe.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Tt(e,r){if(typeof e.ref=="string"&&re.current&&r&&re.current.stateNode!==r){var a=D(re.current.type);_e[a]||(w('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',D(re.current.type),e.ref),_e[a]=!0)}}function Rt(e,r){{var a=function(){Ye||(Ye=!0,w("%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)",r))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function Ct(e,r){{var a=function(){Ue||(Ue=!0,w("%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)",r))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var St=function(e,r,a,m,g,P,_){var h={$$typeof:p,type:e,key:r,ref:a,props:_,_owner:P};return h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(h,"_self",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.defineProperty(h,"_source",{configurable:!1,enumerable:!1,writable:!1,value:g}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h};function jt(e,r,a,m,g){{var P,_={},h=null,A=null;a!==void 0&&(Be(a),h=""+a),xt(r)&&(Be(r.key),h=""+r.key),Et(r)&&(A=r.ref,Tt(r,g));for(P in r)oe.call(r,P)&&!Pt.hasOwnProperty(P)&&(_[P]=r[P]);if(e&&e.defaultProps){var T=e.defaultProps;for(P in T)_[P]===void 0&&(_[P]=T[P])}if(h||A){var C=typeof e=="function"?e.displayName||e.name||"Unknown":e;h&&Rt(_,C),A&&Ct(_,C)}return St(e,h,A,g,m,re.current,_)}}var ve=R.ReactCurrentOwner,Ve=R.ReactDebugCurrentFrame;function K(e){if(e){var r=e._owner,a=ie(e.type,e._source,r?r.type:null);Ve.setExtraStackFrame(a)}else Ve.setExtraStackFrame(null)}var be;be=!1;function ge(e){return typeof e=="object"&&e!==null&&e.$$typeof===p}function He(){{if(ve.current){var e=D(ve.current.type);if(e)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function Ot(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),a=e.lineNumber;return`
|
|
24
24
|
|
|
25
|
-
Check your code at `+r+":"+a+"."}return""}}var Ge={};function
|
|
25
|
+
Check your code at `+r+":"+a+"."}return""}}var Ge={};function $t(e){{var r=He();if(!r){var a=typeof e=="string"?e:e.displayName||e.name;a&&(r=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+a+">.")}return r}}function qe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a
|
|
27
|
+
Check the top-level render call using <`+a+">.")}return r}}function qe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=$t(r);if(Ge[a])return;Ge[a]=!0;var m="";e&&e._owner&&e._owner!==ve.current&&(m=" It was passed a child from "+D(e._owner.type)+"."),K(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,m),K(null)}}function Je(e,r){{if(typeof e!="object")return;if(he(e))for(var a=0;a<e.length;a++){var m=e[a];ge(m)&&qe(m,r)}else if(ge(e))e._store&&(e._store.validated=!0);else if(e){var g=$(e);if(typeof g=="function"&&g!==e.entries)for(var P=g.call(e),_;!(_=P.next()).done;)ge(_.value)&&qe(_.value,r)}}}function It(e){{var r=e.type;if(r==null||typeof r=="string")return;var a;if(typeof r=="function")a=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===d||r.$$typeof===b))a=r.propTypes;else return;if(a){var m=D(r);gt(a,e.props,"prop",m,e)}else if(r.PropTypes!==void 0&&!be){be=!0;var g=D(r);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",g||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ft(e){{for(var r=Object.keys(e.props),a=0;a<r.length;a++){var m=r[a];if(m!=="children"&&m!=="key"){K(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",m),K(null);break}}e.ref!==null&&(K(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),K(null))}}function ze(e,r,a,m,g,P){{var _=V(e);if(!_){var h="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(h+=" 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 A=Ot(g);A?h+=A:h+=He();var T;e===null?T="null":he(e)?T="array":e!==void 0&&e.$$typeof===p?(T="<"+(D(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):T=typeof e,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,h)}var C=jt(e,r,a,g,P);if(C==null)return C;if(_){var Y=r.children;if(Y!==void 0)if(m)if(he(Y)){for(var X=0;X<Y.length;X++)Je(Y[X],e);Object.freeze&&Object.freeze(Y)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Je(Y,e)}return e===s?Ft(C):It(C),C}}function Dt(e,r,a){return ze(e,r,a,!0)}function At(e,r,a){return ze(e,r,a,!1)}var Lt=At,Mt=Dt;Q.Fragment=s,Q.jsx=Lt,Q.jsxs=Mt}()),Q}process.env.NODE_ENV==="production"?ce.exports=Ze():ce.exports=Qe();var ue=ce.exports;const H=ue.Fragment,t=ue.jsx,o=ue.jsxs,pe={},et='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function tt(n,p){return!pe[n]&&typeof window.fetch=="function"&&(pe[n]=window.fetch(p+n+".svg").then(c=>c.ok?c.text():(console.error("Missing icon: "+p+n+".svg"),et)).then(c=>c)),Promise.resolve(pe[n])}const v=({name:n,path:p,className:c="",...s})=>{const l="https://punkt-cdn.oslo.kommune.no/7.1/icons/",[u,f]=N.useState(null);return N.useEffect(()=>{if(!n)return;tt(n,p||l).then(d=>f(d))},[n,p,l]),u?t("span",{className:`pkt-icon ${c}`,dangerouslySetInnerHTML:{__html:u},...s}):null},fe=N.forwardRef(({children:n,className:p,skin:c="info",closeAlert:s=!1,onClose:l,title:u,date:f,ariaLive:i="polite",...d},x)=>{const y=[p,"pkt-alert",c&&`pkt-alert--${c}`].filter(Boolean).join(" "),[b,S]=N.useState(!0),j=()=>{S(!1),l&&l()};return b?o("div",{...d,className:y,"aria-live":i,ref:x,children:[t(v,{className:"pkt-alert__icon",name:c==="info"?"alert-information":`alert-${c}`}),s&&t("div",{className:"pkt-alert__close",children:t("button",{type:"button",className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:j,children:t(v,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),u&&t("div",{className:"pkt-alert__title",children:u}),t("div",{className:"pkt-alert__text",children:n}),f&&o("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",f]})]}):null}),rt=N.forwardRef(({href:n,text:p,onClick:c,className:s,...l},u)=>{const f=[s,"pkt-back-link"].filter(Boolean).join(" ");return t("nav",{ref:u,className:f,"aria-label":"Gå tilbake et steg",children:o("a",{href:n||"/",className:"pkt-link pkt-link--icon-left",onClick:()=>{c&&c()},...l,children:[t(v,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left","aria-hidden":"true"}),t("span",{className:"pkt-back-link__text",children:p||"Forsiden"})]})})}),ee=N.forwardRef(({children:n,className:p,iconName:c="user",secondIconName:s="user",size:l="medium",skin:u="primary",type:f="button",variant:i="label-only",color:d,...x},y)=>{const b=[p,"pkt-btn",l&&`pkt-btn--${l}`,u&&`pkt-btn--${u}`,i&&`pkt-btn--${i}`,d&&`pkt-btn--${d}`].filter(Boolean).join(" ");return o("button",{...x,className:b,type:f,ref:y,children:[i!=="label-only"&&t(v,{className:"pkt-btn__icon",name:c}),t("span",{className:"pkt-btn__text",children:n}),i==="icons-right-and-left"&&t(v,{className:"pkt-btn__icon",name:s})]})});ee.displayName="PktButton";const nt=({columnOne:n,columnTwo:p,socialLinks:c,className:s})=>{var u,f;const l=[s,"pkt-footer"].filter(Boolean).join(" ");return t("footer",{className:l,"data-mode":"dark",children:o("div",{className:"pkt-footer__container",children:[o("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[o("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[t("h2",{className:"pkt-footer__title",children:n.title}),o("ul",{className:"pkt-footer__list",children:[n.text&&t("li",{className:"pkt-footer__text",children:n.text}),(u=n.links)==null?void 0:u.map((i,d)=>t("li",{className:"pkt-footer__list-item",children:o("a",{className:`pkt-footer__link ${i.external?"pkt-link--external":""}`,href:i.href,target:i.openInNewTab?"_blank":"_self",rel:i.openInNewTab?"noopener noreferrer":void 0,children:[t(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),i.text]})},`links-${d}`))]})]}),o("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[t("h2",{className:"pkt-footer__title",children:p.title}),o("ul",{className:"pkt-footer__list",children:[p.text&&t("li",{className:"pkt-footer__text",children:p.text}),(f=p.links)==null?void 0:f.map((i,d)=>t("li",{className:"pkt-footer__list-item",children:o("a",{className:`pkt-footer__link ${i.external?"pkt-link--external":""}`,href:i.href,target:i.openInNewTab?"_blank":"_self",rel:i.openInNewTab?"noopener noreferrer":void 0,children:[t(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),i.text]})},`links-${d}`))]})]}),o("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[t("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),o("ul",{className:"pkt-footer__list",children:[t("li",{className:"pkt-footer__list-item",children:o("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[t(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),t("li",{className:"pkt-footer__list-item",children:o("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[t(v,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),c&&o("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[t("div",{className:"pkt-footer__social-languages",children:c.filter(i=>i.language).map((i,d)=>t("div",{className:"pkt-footer__social-language",children:t("a",{href:i.href,"aria-label":`til ${i.language} versjon av nettsiden`,target:i.openInNewTab?"_blank":"_self",rel:i.openInNewTab?"noopener noreferrer":void 0,children:i.language})},`sociallinks-language-${d}`))}),t("div",{className:"pkt-footer__social-icons",children:c.filter(i=>i.iconName).map((i,d)=>t(N.Fragment,{children:t("a",{href:i.href,"aria-label":`til ${i.iconName}`,className:"pkt-footer__social-icon-link",target:i.openInNewTab?"_blank":"_self",rel:i.openInNewTab?"noopener noreferrer":void 0,children:t(v,{className:"pkt-footer__social-icon",name:i.iconName})})},`sociallinks-${d}`))})]})]})})},at=({links:n=[],className:p})=>{const c=[p,"pkt-footer-simple"].filter(Boolean).join(" ");return t("footer",{className:c,"data-mode":"dark",children:t("div",{className:"pkt-footer-simple__container",children:o("ul",{className:"pkt-footer-simple__list",children:[n.map((s,l)=>t("li",{className:"pkt-footer-simple__list-item",children:o("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:[t(v,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),s.text]})},l)),t("li",{className:"pkt-footer-simple__list-item",children:o("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[t(v,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),t("li",{className:"pkt-footer-simple__list-item",children:o("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[t(v,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})})};var we={exports:{}};/*!
|
|
28
28
|
Copyright (c) 2018 Jed Watson.
|
|
29
29
|
Licensed under the MIT License (MIT), see
|
|
30
30
|
http://jedwatson.github.io/classnames
|
|
31
|
-
*/(function(n){(function(){var u={}.hasOwnProperty;function p(){for(var s=[],l=0;l<arguments.length;l++){var c=arguments[l];if(c){var f=typeof c;if(f==="string"||f==="number")s.push(c);else if(Array.isArray(c)){if(c.length){var o=p.apply(null,c);o&&s.push(o)}}else if(f==="object"){if(c.toString!==Object.prototype.toString&&!c.toString.toString().includes("[native code]")){s.push(c.toString());continue}for(var d in c)u.call(c,d)&&c[d]&&s.push(d)}}}return s.join(" ")}n.exports?(p.default=p,n.exports=p):window.classNames=p})()})(we);var at=we.exports;const Pe=Xe(at),lt=N.forwardRef(({logoLink:n="https://www.oslo.kommune.no/",serviceName:u,fixed:p=!0,scrollToHide:s=!0,user:l,userMenu:c,representing:f,userOptions:o,userMenuFooter:d,canChangeRepresentation:x=!0,showMenuButton:y=!1,showLogOutButton:v=!1,openMenu:S,logOut:j,changeRepresentation:F,...W},$)=>{const R=N.useMemo(()=>typeof(l==null?void 0:l.lastLoggedIn)=="string"?l.lastLoggedIn:l!=null&&l.lastLoggedIn?new Date(l.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"}):"",[l]),[w,L]=N.useState(!1),[O,H]=N.useState(0),[M,Y]=N.useState(!1),I=N.useRef(null);N.useEffect(()=>(document.addEventListener("mouseup",U),window.addEventListener("scroll",z),()=>{document.removeEventListener("mouseup",U),window.removeEventListener("scroll",z)}));const q=()=>{Y(!M)},U=k=>{I.current&&!I.current.contains(k.target)&&Y(!1)},z=()=>{if(s){const k=window.pageYOffset||document.documentElement.scrollTop;if(k<0||Math.abs(k-O)<60)return;L(k>O),H(k)}};return i("header",{...W,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:Pe("pkt-header",{"pkt-header--fixed":p,"pkt-header--scroll-to-hide":s,"pkt-header--hidden":w}),ref:$,children:[i("div",{className:"pkt-header__logo",children:[typeof n=="string"?t("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:n,children:t(b,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/7.0/logos/"})}):t("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header__logo-link",onClick:n,children:t(b,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/7.0/logos/"})}),t("span",{className:"pkt-header__logo-service",children:u})]}),t("nav",{className:"pkt-header__actions",children:i("ul",{className:"pkt-header__actions-row",children:[y&&t("li",{children:t(ee,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:S,children:"Meny"})}),(l||f)&&i("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${M&&!w?"pkt-header--open-dropdown":""}`,ref:I,children:[i("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":M,onClick:q,children:[t(b,{name:"user",className:"pkt-btn__icon"}),t("span",{className:"pkt-header__user-fullname",children:(f==null?void 0:f.name)||(l==null?void 0:l.name)}),t("span",{className:"pkt-header__user-shortname",children:(f==null?void 0:f.shortname)||(l==null?void 0:l.shortname)}),t(b,{name:"chevron-thin-down",className:"pkt-btn--closed"}),t(b,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),i("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[l&&i("li",{children:[t("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),t("div",{className:"pkt-user-menu__name",children:l.name}),l.lastLoggedIn&&i("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",t("time",{children:R})]})]}),c&&t("li",{children:t("ul",{className:"pkt-list",children:c.map((k,D)=>t("li",{children:typeof k.target=="string"?i("a",{href:k.target,className:"pkt-link",children:[k.iconName&&t(b,{name:k.iconName,className:"pkt-link__icon"}),k.title]}):i("button",{className:"pkt-link-button pkt-link",onClick:k.target,children:[k.iconName&&t(b,{name:k.iconName,className:"pkt-link__icon"}),k.title]})},`userMenu-${D}`))})}),(f||x)&&i("li",{children:[f&&i(V,{children:[t("div",{className:"pkt-user-menu__label",children:"Representerer"}),t("div",{className:"pkt-user-menu__name",children:f.name}),f.orgNumber&&i("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",f.orgNumber]})]}),t("ul",{className:"pkt-list mt-size-16",children:x&&t("li",{children:i("button",{className:"pkt-link-button pkt-link",onClick:F,children:[t(b,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),t("li",{children:t("ul",{className:"pkt-list",children:(o||!v)&&i(V,{children:[o==null?void 0:o.map((k,D)=>t("li",{children:typeof k.target=="string"?i("a",{href:k.target,className:"pkt-link",children:[k.iconName&&t(b,{name:k.iconName,className:"pkt-link__icon"}),k.title]}):i("button",{className:"pkt-link-button pkt-link",onClick:k.target,children:[k.iconName&&t(b,{name:k.iconName,className:"pkt-link__icon"}),k.title]})},`userOptions-${D}`)),!v&&t("li",{children:i("button",{className:"pkt-link-button pkt-link",onClick:j,children:[t(b,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),d&&t("li",{className:"footer",children:t("ul",{className:"pkt-list-horizontal bordered",children:d.map((k,D)=>t("li",{children:typeof k.target=="string"?t("a",{href:k.target,className:"pkt-link",children:k.title}):t("button",{className:"pkt-link-button pkt-link",onClick:k.target,children:k.title})},`userMenuFooter-${D}`))})})]})]}),v&&t("li",{children:t(ee,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:j,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),Ee=N.forwardRef(({label:n,id:u,children:p,...s},l)=>i("div",{className:"pkt-form-group",children:[t("label",{htmlFor:u,className:"pkt-form-label",children:n}),t("input",{className:"pkt-form-input",id:u,...s,ref:l}),p]}));Ee.displayName="PktInput";const ne=N.forwardRef(({forId:n,label:u,helptext:p,helptextDropdown:s,helptextDropdownButton:l,optional:c,required:f,hasError:o,errorMessage:d,disabled:x,inline:y,ariaDescribedby:v,useWrapper:S=!0,children:j,className:F},W)=>{const[$,R]=N.useState(!1),w=()=>{R(!$)},L=()=>c?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":f?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",O=c?"Valgfritt":f?"Må fylles ut":"",H=x?"pkt-inputwrapper--disabled":"",M=y?"pkt-inputwrapper--inline":"",Y=o?"pkt-inputwrapper--error":"",I=!!s&&s!=="",q=l||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',U=I?"div":"label",z=I?"h2":"span",k=v||(p?`${n}-helptext`:void 0);return i("div",{className:["pkt-inputwrapper",F,H,M,Y].join(" "),ref:W,children:[S?i(V,{children:[t(U,{htmlFor:n,className:"pkt-inputwrapper__label","aria-describedby":I?"":v,children:i(z,{id:`${n}-label`,children:[u,O!==""&&t("span",{className:L(),children:O})]})}),p&&t("div",{className:"pkt-inputwrapper__helptext",id:`${n}-helptext`,children:p}),I&&s!==""&&i("div",{children:[t(ee,{skin:"tertiary",size:"small",variant:"icon-right",iconName:$?"chevron-thin-up":"chevron-thin-down",className:"pkt-inputwrapper__helptext-expandable pkt-link pkt-link--icon-right",onClick:w,children:t("span",{dangerouslySetInnerHTML:{__html:q}})}),t("div",{className:`pkt-inputwrapper__helptext ${$?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:t(fe,{children:t("span",{dangerouslySetInnerHTML:{__html:s}})})}),t("label",{htmlFor:n,className:"pkt-sr-only","aria-describedby":k,children:u})]}),t(V,{children:j})]}):i(V,{children:[t("label",{htmlFor:n,className:"pkt-sr-only","aria-describedby":k,id:`${n}-label`,children:u}),j]}),o&&t("div",{children:t(fe,{skin:"error","aria-live":"assertive",children:d})})]})});ne.displayName="PktInputWrapper";const xe=N.forwardRef(({children:n,className:u,iconName:p="user",openInNewTab:s=!1,skin:l="normal",href:c="#",external:f=!1,title:o},d)=>{const x=[u,"pkt-linkcard",l&&`pkt-linkcard--${l}`].filter(Boolean).join(" ");return i("a",{href:c,className:`pkt-linkcard pkt-link ${x}`,target:s?"_blank":"_self",rel:s?"noopener noreferrer":void 0,ref:d,children:[t(b,{className:"pkt-link__icon",name:p}),i("div",{className:"pkt-linkcard__content",children:[t("div",{className:`pkt-linkcard__title ${f?"pkt-link pkt-link--external":""}`,children:o}),t("div",{className:"pkt-linkcard__text",children:n})]})]})});xe.displayName="PktLinkCard";const ot=({children:n,skin:u="beige",title:p,className:s,...l})=>{const c=["pkt-messagebox",u&&`pkt-messagebox--${u}`,s].filter(Boolean).join(" ");return i("div",{...l,className:c,children:[t("div",{className:"pkt-messagebox__title",children:p}),t("div",{className:"pkt-messagebox__text",children:n})]})},Te=N.forwardRef(({id:n,name:u,label:p,value:s,...l},c)=>i("div",{className:"pkt-form-group",children:[t("input",{type:"radio",className:"pkt-form-check-input",id:n,name:u,value:s,ref:c,...l}),t("label",{className:"pkt-form-label",htmlFor:n,children:p})]}));Te.displayName="PktRadio";const it=({label:n,children:u})=>i(V,{children:[t("p",{children:n}),t("div",{className:"pkt-form-group",children:u})]}),st=({isResponsive:n,children:u})=>n?t("div",{className:"pkt-table-container",children:u}):t(V,{children:u}),ct=({isResponsive:n,modifiers:{info:u=!1,success:p=!1,strong:s=!1,shadow:l=!1}={},children:c})=>t(st,{isResponsive:n,children:t("table",{className:Pe("pkt-table",{"pkt-table--info":u,"pkt-table--success":p,"pkt-table--strong":s,"pkt-table--shadow":l}),children:c})}),ut=({children:n})=>t("td",{className:"pkt-table__th",children:n}),pt=({children:n})=>t("th",{className:"pkt-table__th",children:n}),Re=N.forwardRef(({children:n,className:u,skin:p="blue",textStyle:s="normal-text",size:l="medium",closeTag:c=!1,iconName:f="",type:o="button",ariaLabel:d="close",onClick:x=()=>{}},y)=>{const[v,S]=N.useState(!1),j=R=>{S(!0),x(R)},F=["pkt-tag",l&&`pkt-tag--${l}`,p&&`pkt-tag--${p}`,s&&`pkt-tag--${s}`,u].filter(Boolean).join(" "),W=["pkt-tag","pkt-btn","pkt-btn--tertiary",l&&`pkt-tag--${l}`,p&&`pkt-tag--${p}`,s&&`pkt-tag--${s}`,f&&c?"pkt-btn--icons-right-and-left":null,c&&!f?"pkt-btn--icon-right":null,u].filter(Boolean).join(" "),$=!v;return c&&f?t(V,{children:$&&i("button",{className:W,type:o,"aria-label":d,onClick:j,ref:y,children:[t(b,{className:"pkt-tag__icon",name:f}),n,t(b,{className:"pkt-tag__close-btn",name:"close"})]})}):c?t(V,{children:$&&i("button",{className:W,type:o,"aria-label":d,onClick:j,ref:y,children:[t(b,{className:"pkt-tag__close-btn",name:"close"}),n]})}):f?i("span",{className:F,children:[t(b,{className:"pkt-tag__icon",name:f}),n]}):t("span",{className:F,children:n})});Re.displayName="PktTag";const ft=N.forwardRef(({id:n,ariaDescribedby:u,ariaLabelledby:p,counter:s,counterMaxLength:l,className:c,disabled:f,errorMessage:o,hasError:d,helptext:x,helptextDropdown:y,helptextDropdownButton:v,inline:S,label:j,name:F,optional:W,placeholder:$,required:R,rows:w,useWrapper:L,value:O="",...H},M)=>{const Y=[c,"pkt-textinput","pkt-textarea"].join(" "),I=p||`${n}-label`;return i(ne,{ariaDescribedby:u,className:Y,disabled:f,errorMessage:o,forId:n,hasError:d,helptext:x,helptextDropdown:y,helptextDropdownButton:v,inline:S,label:j,optional:W,required:R,useWrapper:L,children:[t("textarea",{ref:M,className:`pkt-textinput__input ${l&&(O==null?void 0:O.length)>l?"pkt-textinput__input--counter-error":""}`,name:F||n,id:n,placeholder:$,value:O,disabled:f,rows:w,"aria-labelledby":I,"aria-invalid":d,"aria-required":R,...H}),s&&i("div",{className:"pkt-textinput__counter","aria-live":"polite","aria-atomic":!0,children:[(O==null?void 0:O.length)||0,l&&`/${l}`]})]})}),dt=N.forwardRef(({id:n,ariaDescribedby:u,ariaLabelledby:p,autocomplete:s="off",className:l,disabled:c=!1,errorMessage:f,hasError:o=!1,helptext:d,helptextDropdown:x,helptextDropdownButton:y,iconNameRight:v,inline:S=!1,label:j,name:F,optional:W=!1,placeholder:$,prefix:R,required:w=!1,suffix:L,type:O="text",useWrapper:H=!0,value:M,...Y},I)=>{const q=[l,"pkt-textinput"].join(" "),U=p||`${n}-label`;return i(ne,{ariaDescribedby:u,className:q,disabled:c,errorMessage:f,forId:n,hasError:o,helptext:d,helptextDropdown:x,helptextDropdownButton:y,inline:S,label:j,optional:W,required:w,useWrapper:H,children:[R&&i("div",{className:"pkt-textinput__input-prefix-wrapper",children:[t("div",{className:"pkt-textinput__input-prefix",children:R}),t("input",{ref:I,className:"pkt-textinput__input",type:O,name:F||n,id:n,placeholder:$,autoComplete:s,value:M,disabled:c,"aria-required":w,"aria-invalid":o,"aria-labelledby":U,...Y})]}),!R&&(L||v)&&i("div",{className:"pkt-textinput__input-suffix-wrapper",children:[t("input",{ref:I,className:"pkt-textinput__input",type:O,name:F||n,id:n,placeholder:$,autoComplete:s,value:M,disabled:c,"aria-required":w,"aria-invalid":o,"aria-labelledby":U,...Y}),L&&i("p",{className:"pkt-textinput__input-suffix",children:[L,v&&t(b,{className:"pkt-textinput__input-suffix-icon",name:v})]}),!L&&v&&t(b,{className:"pkt-textinput__input-icon",name:v})]}),!R&&!L&&!v&&t("input",{ref:I,className:"pkt-textinput__input",type:O,name:F||n,id:n,placeholder:$,autoComplete:s,value:M,disabled:c,"aria-required":w,"aria-invalid":o,"aria-labelledby":U,...Y})]})});E.PktAlert=fe,E.PktButton=ee,E.PktFooter=rt,E.PktFooterSimple=nt,E.PktHeader=lt,E.PktIcon=b,E.PktInput=Ee,E.PktInputWrapper=ne,E.PktLinkCard=xe,E.PktMessagebox=ot,E.PktRadio=Te,E.PktRadioGroup=it,E.PktTable=ct,E.PktTableData=ut,E.PktTableHeader=pt,E.PktTag=Re,E.PktTextarea=ft,E.PktTextinput=dt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
31
|
+
*/(function(n){(function(){var p={}.hasOwnProperty;function c(){for(var s=[],l=0;l<arguments.length;l++){var u=arguments[l];if(u){var f=typeof u;if(f==="string"||f==="number")s.push(u);else if(Array.isArray(u)){if(u.length){var i=c.apply(null,u);i&&s.push(i)}}else if(f==="object"){if(u.toString!==Object.prototype.toString&&!u.toString.toString().includes("[native code]")){s.push(u.toString());continue}for(var d in u)p.call(u,d)&&u[d]&&s.push(d)}}}return s.join(" ")}n.exports?(c.default=c,n.exports=c):window.classNames=c})()})(we);var lt=we.exports;const Pe=Xe(lt),it=N.forwardRef(({logoLink:n="https://www.oslo.kommune.no/",serviceName:p,fixed:c=!0,scrollToHide:s=!0,user:l,userMenu:u,representing:f,userOptions:i,userMenuFooter:d,canChangeRepresentation:x=!0,showMenuButton:y=!1,showLogOutButton:b=!1,openMenu:S,logOut:j,changeRepresentation:F,...W},$)=>{const R=N.useMemo(()=>typeof(l==null?void 0:l.lastLoggedIn)=="string"?l.lastLoggedIn:l!=null&&l.lastLoggedIn?new Date(l.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"}):"",[l]),[w,L]=N.useState(!1),[O,G]=N.useState(0),[M,B]=N.useState(!1),I=N.useRef(null);N.useEffect(()=>(document.addEventListener("mouseup",V),window.addEventListener("scroll",z),()=>{document.removeEventListener("mouseup",V),window.removeEventListener("scroll",z)}));const U=()=>{B(!M)},V=k=>{I.current&&!I.current.contains(k.target)&&B(!1)},z=()=>{if(s){const k=window.pageYOffset||document.documentElement.scrollTop;if(k<0||Math.abs(k-O)<60)return;L(k>O),G(k)}};return o("header",{...W,id:"pkt-header","data-testid":"pkt-header","aria-label":"Topp",className:Pe("pkt-header",{"pkt-header--fixed":c,"pkt-header--scroll-to-hide":s,"pkt-header--hidden":w}),ref:$,children:[o("div",{className:"pkt-header__logo",children:[typeof n=="string"?t("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:n,children:t(v,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/7.1/logos/"})}):t("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header__logo-link",onClick:n,children:t(v,{name:"oslologo",className:"pkt-header__logo-svg","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/7.1/logos/"})}),t("span",{className:"pkt-header__logo-service",children:p})]}),t("nav",{className:"pkt-header__actions",children:o("ul",{className:"pkt-header__actions-row",children:[y&&t("li",{children:t(ee,{className:"pkt-header__menu-btn",skin:"secondary",variant:"icon-right",iconName:"menu",onClick:S,children:"Meny"})}),(l||f)&&o("li",{"data-testid":"usermenu",className:`pkt-header--has-dropdown ${M&&!w?"pkt-header--open-dropdown":""}`,ref:I,children:[o("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":M,onClick:U,children:[t(v,{name:"user",className:"pkt-btn__icon"}),t("span",{className:"pkt-header__user-fullname",children:(f==null?void 0:f.name)||(l==null?void 0:l.name)}),t("span",{className:"pkt-header__user-shortname",children:(f==null?void 0:f.shortname)||(l==null?void 0:l.shortname)}),t(v,{name:"chevron-thin-down",className:"pkt-btn--closed"}),t(v,{name:"chevron-thin-up",className:"pkt-btn--open"})]}),o("ul",{id:"pktUserDropdown",className:"pkt-header__dropdown pkt-user-menu",children:[l&&o("li",{children:[t("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),t("div",{className:"pkt-user-menu__name",children:l.name}),l.lastLoggedIn&&o("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",t("time",{children:R})]})]}),u&&t("li",{children:t("ul",{className:"pkt-list",children:u.map((k,D)=>t("li",{children:typeof k.target=="string"?o("a",{href:k.target,className:"pkt-link",children:[k.iconName&&t(v,{name:k.iconName,className:"pkt-link__icon"}),k.title]}):o("button",{className:"pkt-link-button pkt-link",onClick:k.target,children:[k.iconName&&t(v,{name:k.iconName,className:"pkt-link__icon"}),k.title]})},`userMenu-${D}`))})}),(f||x)&&o("li",{children:[f&&o(H,{children:[t("div",{className:"pkt-user-menu__label",children:"Representerer"}),t("div",{className:"pkt-user-menu__name",children:f.name}),f.orgNumber&&o("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",f.orgNumber]})]}),t("ul",{className:"pkt-list mt-size-16",children:x&&t("li",{children:o("button",{className:"pkt-link-button pkt-link",onClick:F,children:[t(v,{name:"cogwheel",className:"pkt-link__icon"}),"Endre organisasjon"]})})})]}),t("li",{children:t("ul",{className:"pkt-list",children:(i||!b)&&o(H,{children:[i==null?void 0:i.map((k,D)=>t("li",{children:typeof k.target=="string"?o("a",{href:k.target,className:"pkt-link",children:[k.iconName&&t(v,{name:k.iconName,className:"pkt-link__icon"}),k.title]}):o("button",{className:"pkt-link-button pkt-link",onClick:k.target,children:[k.iconName&&t(v,{name:k.iconName,className:"pkt-link__icon"}),k.title]})},`userOptions-${D}`)),!b&&t("li",{children:o("button",{className:"pkt-link-button pkt-link",onClick:j,children:[t(v,{name:"exit",className:"pkt-link__icon"}),"Logg ut"]})})]})})}),d&&t("li",{className:"footer",children:t("ul",{className:"pkt-list-horizontal bordered",children:d.map((k,D)=>t("li",{children:typeof k.target=="string"?t("a",{href:k.target,className:"pkt-link",children:k.title}):t("button",{className:"pkt-link-button pkt-link",onClick:k.target,children:k.title})},`userMenuFooter-${D}`))})})]})]}),b&&t("li",{children:t(ee,{className:"pkt-header__user-btn pkt-header__user-btn-logout",iconName:"exit",role:"button",onClick:j,skin:"secondary",variant:"icon-right",children:"Logg ut"})})]})})]})}),Ee=N.forwardRef(({label:n,id:p,children:c,...s},l)=>o("div",{className:"pkt-form-group",children:[t("label",{htmlFor:p,className:"pkt-form-label",children:n}),t("input",{className:"pkt-form-input",id:p,...s,ref:l}),c]}));Ee.displayName="PktInput";const ne=N.forwardRef(({forId:n,label:p,helptext:c,helptextDropdown:s,helptextDropdownButton:l,optional:u,required:f,hasError:i,errorMessage:d,disabled:x,inline:y,ariaDescribedby:b,useWrapper:S=!0,children:j,className:F},W)=>{const[$,R]=N.useState(!1),w=()=>{R(!$)},L=()=>u?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light":f?"pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige":"",O=u?"Valgfritt":f?"Må fylles ut":"",G=x?"pkt-inputwrapper--disabled":"",M=y?"pkt-inputwrapper--inline":"",B=i?"pkt-inputwrapper--error":"",I=!!s&&s!=="",U=l||'Les mer <span class="pkt-sr-only">om inputfeltet</span>',V=I?"div":"label",z=I?"h2":"span",k=b||(c?`${n}-helptext`:void 0);return o("div",{className:["pkt-inputwrapper",F,G,M,B].join(" "),ref:W,children:[S?o(H,{children:[t(V,{htmlFor:n,className:"pkt-inputwrapper__label","aria-describedby":I?"":b,children:o(z,{id:`${n}-label`,children:[p,O!==""&&t("span",{className:L(),children:O})]})}),c&&t("div",{className:"pkt-inputwrapper__helptext",id:`${n}-helptext`,children:c}),I&&s!==""&&o("div",{children:[t(ee,{skin:"tertiary",size:"small",variant:"icon-right",iconName:$?"chevron-thin-up":"chevron-thin-down",className:"pkt-inputwrapper__helptext-expandable pkt-link pkt-link--icon-right",onClick:w,children:t("span",{dangerouslySetInnerHTML:{__html:U}})}),t("div",{className:`pkt-inputwrapper__helptext ${$?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:t(fe,{children:t("span",{dangerouslySetInnerHTML:{__html:s}})})}),t("label",{htmlFor:n,className:"pkt-sr-only","aria-describedby":k,children:p})]}),t(H,{children:j})]}):o(H,{children:[t("label",{htmlFor:n,className:"pkt-sr-only","aria-describedby":k,id:`${n}-label`,children:p}),j]}),i&&t("div",{children:t(fe,{skin:"error","aria-live":"assertive",children:d})})]})});ne.displayName="PktInputWrapper";const xe=N.forwardRef(({children:n,className:p,iconName:c="user",openInNewTab:s=!1,skin:l="normal",href:u="#",external:f=!1,title:i},d)=>{const x=[p,"pkt-linkcard",l&&`pkt-linkcard--${l}`].filter(Boolean).join(" ");return o("a",{href:u,className:`pkt-linkcard pkt-link ${x}`,target:s?"_blank":"_self",rel:s?"noopener noreferrer":void 0,ref:d,children:[t(v,{className:"pkt-link__icon",name:c}),o("div",{className:"pkt-linkcard__content",children:[t("div",{className:`pkt-linkcard__title ${f?"pkt-link pkt-link--external":""}`,children:i}),t("div",{className:"pkt-linkcard__text",children:n})]})]})});xe.displayName="PktLinkCard";const ot=({children:n,skin:p="beige",title:c,className:s,...l})=>{const u=["pkt-messagebox",p&&`pkt-messagebox--${p}`,s].filter(Boolean).join(" ");return o("div",{...l,className:u,children:[t("div",{className:"pkt-messagebox__title",children:c}),t("div",{className:"pkt-messagebox__text",children:n})]})},Te=N.forwardRef(({id:n,name:p,label:c,value:s,...l},u)=>o("div",{className:"pkt-form-group",children:[t("input",{type:"radio",className:"pkt-form-check-input",id:n,name:p,value:s,ref:u,...l}),t("label",{className:"pkt-form-label",htmlFor:n,children:c})]}));Te.displayName="PktRadio";const st=({label:n,children:p})=>o(H,{children:[t("p",{children:n}),t("div",{className:"pkt-form-group",children:p})]}),ct=({isResponsive:n,children:p})=>n?t("div",{className:"pkt-table-container",children:p}):t(H,{children:p}),ut=({isResponsive:n,modifiers:{info:p=!1,success:c=!1,strong:s=!1,shadow:l=!1}={},children:u})=>t(ct,{isResponsive:n,children:t("table",{className:Pe("pkt-table",{"pkt-table--info":p,"pkt-table--success":c,"pkt-table--strong":s,"pkt-table--shadow":l}),children:u})}),pt=({children:n})=>t("td",{className:"pkt-table__th",children:n}),ft=({children:n})=>t("th",{className:"pkt-table__th",children:n}),Re=N.forwardRef(({children:n,className:p,skin:c="blue",textStyle:s="normal-text",size:l="medium",closeTag:u=!1,iconName:f="",type:i="button",ariaLabel:d="close",onClick:x=()=>{}},y)=>{const[b,S]=N.useState(!1),j=R=>{S(!0),x(R)},F=["pkt-tag",l&&`pkt-tag--${l}`,c&&`pkt-tag--${c}`,s&&`pkt-tag--${s}`,p].filter(Boolean).join(" "),W=["pkt-tag","pkt-btn","pkt-btn--tertiary",l&&`pkt-tag--${l}`,c&&`pkt-tag--${c}`,s&&`pkt-tag--${s}`,f&&u?"pkt-btn--icons-right-and-left":null,u&&!f?"pkt-btn--icon-right":null,p].filter(Boolean).join(" "),$=!b;return u&&f?t(H,{children:$&&o("button",{className:W,type:i,"aria-label":d,onClick:j,ref:y,children:[t(v,{className:"pkt-tag__icon",name:f}),n,t(v,{className:"pkt-tag__close-btn",name:"close"})]})}):u?t(H,{children:$&&o("button",{className:W,type:i,"aria-label":d,onClick:j,ref:y,children:[t(v,{className:"pkt-tag__close-btn",name:"close"}),n]})}):f?o("span",{className:F,children:[t(v,{className:"pkt-tag__icon",name:f}),n]}):t("span",{className:F,children:n})});Re.displayName="PktTag";const dt=N.forwardRef(({id:n,ariaDescribedby:p,ariaLabelledby:c,counter:s,counterMaxLength:l,className:u,disabled:f,errorMessage:i,hasError:d,helptext:x,helptextDropdown:y,helptextDropdownButton:b,inline:S,label:j,name:F,optional:W,placeholder:$,required:R,rows:w,useWrapper:L,value:O,...G},M)=>{const B=[u,"pkt-textinput","pkt-textarea"].join(" "),I=c||`${n}-label`,U=(O==null?void 0:O.length)||0;return o(ne,{ariaDescribedby:p,className:B,disabled:f,errorMessage:i,forId:n,hasError:d,helptext:x,helptextDropdown:y,helptextDropdownButton:b,inline:S,label:j,optional:W,required:R,useWrapper:L,children:[t("textarea",{ref:M,className:`pkt-textinput__input ${l&&U>l?"pkt-textinput__input--counter-error":""}`,name:F||n,id:n,placeholder:$,value:O,disabled:f,rows:w,"aria-labelledby":I,"aria-invalid":d,"aria-required":R,...G}),s&&o("div",{className:"pkt-textinput__counter","aria-live":"polite","aria-atomic":!0,children:[(O==null?void 0:O.length)||0,l&&`/${l}`]})]})}),mt=N.forwardRef(({id:n,ariaDescribedby:p,ariaLabelledby:c,autocomplete:s="off",className:l,disabled:u=!1,errorMessage:f,hasError:i=!1,helptext:d,helptextDropdown:x,helptextDropdownButton:y,iconNameRight:b,inline:S=!1,label:j,name:F,optional:W=!1,placeholder:$,prefix:R,required:w=!1,suffix:L,type:O="text",useWrapper:G=!0,value:M,...B},I)=>{const U=[l,"pkt-textinput"].join(" "),V=c||`${n}-label`;return o(ne,{ariaDescribedby:p,className:U,disabled:u,errorMessage:f,forId:n,hasError:i,helptext:d,helptextDropdown:x,helptextDropdownButton:y,inline:S,label:j,optional:W,required:w,useWrapper:G,children:[R&&o("div",{className:"pkt-textinput__input-prefix-wrapper",children:[t("div",{className:"pkt-textinput__input-prefix",children:R}),t("input",{ref:I,className:"pkt-textinput__input",type:O,name:F||n,id:n,placeholder:$,autoComplete:s,value:M,disabled:u,"aria-required":w,"aria-invalid":i,"aria-labelledby":V,...B})]}),!R&&(L||b)&&o("div",{className:"pkt-textinput__input-suffix-wrapper",children:[t("input",{ref:I,className:"pkt-textinput__input",type:O,name:F||n,id:n,placeholder:$,autoComplete:s,value:M,disabled:u,"aria-required":w,"aria-invalid":i,"aria-labelledby":V,...B}),L&&o("p",{className:"pkt-textinput__input-suffix",children:[L,b&&t(v,{className:"pkt-textinput__input-suffix-icon",name:b})]}),!L&&b&&t(v,{className:"pkt-textinput__input-icon",name:b})]}),!R&&!L&&!b&&t("input",{ref:I,className:"pkt-textinput__input",type:O,name:F||n,id:n,placeholder:$,autoComplete:s,value:M,disabled:u,"aria-required":w,"aria-invalid":i,"aria-labelledby":V,...B})]})});E.PktAlert=fe,E.PktBackLink=rt,E.PktButton=ee,E.PktFooter=nt,E.PktFooterSimple=at,E.PktHeader=it,E.PktIcon=v,E.PktInput=Ee,E.PktInputWrapper=ne,E.PktLinkCard=xe,E.PktMessagebox=ot,E.PktRadio=Te,E.PktRadioGroup=st,E.PktTable=ut,E.PktTableData=pt,E.PktTableHeader=ft,E.PktTag=Re,E.PktTextarea=dt,E.PktTextinput=mt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.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",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@oslokommune/punkt-assets": "^7.0.0",
|
|
35
|
-
"@oslokommune/punkt-css": "^7.
|
|
35
|
+
"@oslokommune/punkt-css": "^7.1.0",
|
|
36
36
|
"@testing-library/jest-dom": "^5.16.5",
|
|
37
37
|
"@testing-library/react": "^14.0.0",
|
|
38
38
|
"@testing-library/user-event": "^14.4.3",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
91
91
|
},
|
|
92
92
|
"license": "MIT",
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "a6c4f825e2e9342bd90d04727e578669f72d0ba7"
|
|
94
94
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
3
|
+
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
4
|
+
|
|
5
|
+
import { PktBackLink } from './BackLink';
|
|
6
|
+
|
|
7
|
+
expect.extend(toHaveNoViolations)
|
|
8
|
+
|
|
9
|
+
describe('PktBackLink', () => {
|
|
10
|
+
it('renders with default text and href', () => {
|
|
11
|
+
const { getByRole } = render(<PktBackLink />);
|
|
12
|
+
|
|
13
|
+
const link = getByRole('link');
|
|
14
|
+
expect(link.textContent).toBe('Forsiden');
|
|
15
|
+
expect(link.getAttribute('href')).toBe('/');
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('renders with custom text and href', () => {
|
|
20
|
+
const { getByRole } = render(
|
|
21
|
+
<PktBackLink href="/custom-url" text="Custom Text" />
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const link = getByRole('link');
|
|
25
|
+
expect(link.textContent).toBe('Custom Text');
|
|
26
|
+
expect(link.getAttribute('href')).toBe('/custom-url');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('calls onClick when clicked', () => {
|
|
30
|
+
const onClickMock = jest.fn();
|
|
31
|
+
|
|
32
|
+
const { getByText } = render(
|
|
33
|
+
<PktBackLink text="Back" onClick={onClickMock} />
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const link = getByText('Back');
|
|
37
|
+
fireEvent.click(link);
|
|
38
|
+
|
|
39
|
+
expect(onClickMock).toHaveBeenCalledTimes(1);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('accessibility', () => {
|
|
43
|
+
it('renders with no wcag errors with axe', async () => {
|
|
44
|
+
const { container } = render(<PktBackLink text="Tilbake" href="/" />)
|
|
45
|
+
const results = await axe(container)
|
|
46
|
+
|
|
47
|
+
expect(results).toHaveNoViolations()
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { ForwardedRef, forwardRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { PktIcon } from '../icon/Icon'
|
|
4
|
+
|
|
5
|
+
export interface IPktBackLink extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
6
|
+
href?: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
onClick?: () => void; // Custom navigation handler
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export const PktBackLink = forwardRef(
|
|
14
|
+
(
|
|
15
|
+
{ href, text, onClick, className, ...rest }: IPktBackLink,
|
|
16
|
+
ref: ForwardedRef<HTMLAnchorElement>
|
|
17
|
+
) => {
|
|
18
|
+
|
|
19
|
+
const classes = [
|
|
20
|
+
className,
|
|
21
|
+
'pkt-back-link',
|
|
22
|
+
].filter(Boolean)
|
|
23
|
+
.join(' ')
|
|
24
|
+
|
|
25
|
+
const handleClick = () => {
|
|
26
|
+
if (onClick) {
|
|
27
|
+
onClick();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<nav ref={ref} className={classes} aria-label="Gå tilbake et steg">
|
|
33
|
+
<a href={href || '/'} className="pkt-link pkt-link--icon-left" onClick={handleClick} {...rest}>
|
|
34
|
+
<PktIcon className='pkt-back-link__icon pkt-icon pkt-link__icon' name="chevron-thin-left" aria-hidden="true" />
|
|
35
|
+
<span className="pkt-back-link__text">{text || 'Forsiden'}</span>
|
|
36
|
+
</a>
|
|
37
|
+
</nav>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export default PktBackLink;
|
package/src/components/index.ts
CHANGED
|
@@ -48,13 +48,17 @@ export const PktTextarea = forwardRef(
|
|
|
48
48
|
required,
|
|
49
49
|
rows,
|
|
50
50
|
useWrapper,
|
|
51
|
-
value
|
|
51
|
+
value,
|
|
52
52
|
...props
|
|
53
53
|
}: IPktTextareaProps,
|
|
54
54
|
ref: ForwardedRef<HTMLTextAreaElement>,
|
|
55
55
|
) => {
|
|
56
56
|
const classNames = [className, 'pkt-textinput', 'pkt-textarea'].join(' ')
|
|
57
57
|
const labelledBy = ariaLabelledby || `${id}-label`
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const counterCurrent = value?.length || 0
|
|
61
|
+
|
|
58
62
|
return (
|
|
59
63
|
<PktInputWrapper
|
|
60
64
|
ariaDescribedby={ariaDescribedby}
|
|
@@ -74,11 +78,10 @@ export const PktTextarea = forwardRef(
|
|
|
74
78
|
>
|
|
75
79
|
<textarea
|
|
76
80
|
ref={ref}
|
|
77
|
-
className={`pkt-textinput__input ${
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}`}
|
|
81
|
+
className={`pkt-textinput__input ${counterMaxLength && counterCurrent > counterMaxLength
|
|
82
|
+
? 'pkt-textinput__input--counter-error'
|
|
83
|
+
: ''
|
|
84
|
+
}`}
|
|
82
85
|
name={name || id}
|
|
83
86
|
id={id}
|
|
84
87
|
placeholder={placeholder}
|