@oslokommune/punkt-react 3.4.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/footer/Footer.d.ts +23 -0
- package/dist/footerSimple/FooterSimple.d.ts +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/punkt-react.es.js +546 -455
- package/dist/punkt-react.umd.js +11 -11
- package/package.json +4 -4
- package/src/components/footer/Footer.test.tsx +123 -0
- package/src/components/footer/Footer.tsx +123 -0
- package/src/components/footer/__snapshots__/Footer.test.tsx.snap +218 -0
- package/src/components/footerSimple/FooterSimple.test.tsx +66 -0
- package/src/components/footerSimple/FooterSimple.tsx +50 -0
- package/src/components/footerSimple/__snapshots__/FooterSimple.test.tsx.snap +109 -0
- package/src/components/index.ts +2 -0
package/dist/punkt-react.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(b,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],w):(b=typeof globalThis<"u"?globalThis:b||self,w(b["punkt-react"]={},b.React))})(this,function(b,w){"use strict";function Ie(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var H={exports:{}},W={};/**
|
|
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 ae;function
|
|
9
|
+
*/var ae;function $e(){if(ae)return W;ae=1;var i=w,l=Symbol.for("react.element"),s=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,p=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};function v(N,_,x){var R,j={},S=null,D=null;x!==void 0&&(S=""+x),_.key!==void 0&&(S=""+_.key),_.ref!==void 0&&(D=_.ref);for(R in _)c.call(_,R)&&!n.hasOwnProperty(R)&&(j[R]=_[R]);if(N&&N.defaultProps)for(R in _=N.defaultProps,_)j[R]===void 0&&(j[R]=_[R]);return{$$typeof:l,type:N,key:S,ref:D,props:j,_owner:p.current}}return W.Fragment=s,W.jsx=v,W.jsxs=v,W}var Y={};/**
|
|
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 ne;function We(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&function(){var i=
|
|
18
|
-
`+X+e}}var
|
|
19
|
-
`),P=
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var ne;function We(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&function(){var i=w,l=Symbol.for("react.element"),s=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),v=Symbol.for("react.provider"),N=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),D=Symbol.for("react.offscreen"),fe=Symbol.iterator,qe="@@iterator";function Qe(e){if(e===null||typeof e!="object")return null;var t=fe&&e[fe]||e[qe];return typeof t=="function"?t:null}var A=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(e){{for(var t=arguments.length,a=new Array(t>1?t-1:0),o=1;o<t;o++)a[o-1]=arguments[o];et("error",e,a)}}function et(e,t,a){{var o=A.ReactDebugCurrentFrame,m=o.getStackAddendum();m!==""&&(t+="%s",a=a.concat([m]));var h=a.map(function(f){return String(f)});h.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,h)}}var tt=!1,rt=!1,at=!1,nt=!1,it=!1,de;de=Symbol.for("react.module.reference");function ot(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===n||it||e===p||e===x||e===R||nt||e===D||tt||rt||at||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===j||e.$$typeof===v||e.$$typeof===N||e.$$typeof===_||e.$$typeof===de||e.getModuleId!==void 0))}function lt(e,t,a){var o=e.displayName;if(o)return o;var m=t.displayName||t.name||"";return m!==""?a+"("+m+")":a}function pe(e){return e.displayName||"Context"}function O(e){if(e==null)return null;if(typeof e.tag=="number"&&E("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 c:return"Fragment";case s:return"Portal";case n:return"Profiler";case p:return"StrictMode";case x:return"Suspense";case R:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case N:var t=e;return pe(t)+".Consumer";case v:var a=e;return pe(a._context)+".Provider";case _:return lt(e,e.render,"ForwardRef");case j:var o=e.displayName||null;return o!==null?o:O(e.type)||"Memo";case S:{var m=e,h=m._payload,f=m._init;try{return O(f(h))}catch{return null}}}return null}var F=Object.assign,B=0,me,he,ve,_e,ke,be,ge;function Ne(){}Ne.__reactDisabledLog=!0;function st(){{if(B===0){me=console.log,he=console.info,ve=console.warn,_e=console.error,ke=console.group,be=console.groupCollapsed,ge=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ne,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}B++}}function ct(){{if(B--,B===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:me}),info:F({},e,{value:he}),warn:F({},e,{value:ve}),error:F({},e,{value:_e}),group:F({},e,{value:ke}),groupCollapsed:F({},e,{value:be}),groupEnd:F({},e,{value:ge})})}B<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=A.ReactCurrentDispatcher,X;function L(e,t,a){{if(X===void 0)try{throw Error()}catch(m){var o=m.stack.trim().match(/\n( *(at )?)/);X=o&&o[1]||""}return`
|
|
18
|
+
`+X+e}}var Z=!1,V;{var ut=typeof WeakMap=="function"?WeakMap:Map;V=new ut}function ye(e,t){if(!e||Z)return"";{var a=V.get(e);if(a!==void 0)return a}var o;Z=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var h;h=K.current,K.current=null,st();try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(C){o=C}Reflect.construct(e,[],f)}else{try{f.call()}catch(C){o=C}e.call(f.prototype)}}else{try{throw Error()}catch(C){o=C}e()}}catch(C){if(C&&o&&typeof C.stack=="string"){for(var u=C.stack.split(`
|
|
19
|
+
`),P=o.stack.split(`
|
|
20
|
+
`),k=u.length-1,g=P.length-1;k>=1&&g>=0&&u[k]!==P[g];)g--;for(;k>=1&&g>=0;k--,g--)if(u[k]!==P[g]){if(k!==1||g!==1)do if(k--,g--,g<0||u[k]!==P[g]){var T=`
|
|
21
|
+
`+u[k].replace(" at new "," at ");return e.displayName&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",e.displayName)),typeof e=="function"&&V.set(e,T),T}while(k>=1&&g>=0);break}}}finally{Z=!1,K.current=h,ct(),Error.prepareStackTrace=m}var $=e?e.displayName||e.name:"",Ae=$?L($):"";return typeof e=="function"&&V.set(e,Ae),Ae}function ft(e,t,a){return ye(e,!1)}function dt(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function U(e,t,a){if(e==null)return"";if(typeof e=="function")return ye(e,dt(e));if(typeof e=="string")return L(e);switch(e){case x:return L("Suspense");case R:return L("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case _:return ft(e.render);case j:return U(e.type,t,a);case S:{var o=e,m=o._payload,h=o._init;try{return U(h(m),t,a)}catch{}}}return""}var G=Object.prototype.hasOwnProperty,Re={},Ee=A.ReactDebugCurrentFrame;function z(e){if(e){var t=e._owner,a=U(e.type,e._source,t?t.type:null);Ee.setExtraStackFrame(a)}else Ee.setExtraStackFrame(null)}function pt(e,t,a,o,m){{var h=Function.call.bind(G);for(var f in e)if(h(e,f)){var u=void 0;try{if(typeof e[f]!="function"){var P=Error((o||"React class")+": "+a+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}u=e[f](t,f,o,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(k){u=k}u&&!(u instanceof Error)&&(z(m),E("%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).",o||"React class",a,f,typeof u),z(null)),u instanceof Error&&!(u.message in Re)&&(Re[u.message]=!0,z(m),E("Failed %s type: %s",a,u.message),z(null))}}}var mt=Array.isArray;function q(e){return mt(e)}function ht(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,a=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function vt(e){try{return Pe(e),!1}catch{return!0}}function Pe(e){return""+e}function we(e){if(vt(e))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ht(e)),Pe(e)}var M=A.ReactCurrentOwner,_t={key:!0,ref:!0,__self:!0,__source:!0},xe,Te,Q;Q={};function kt(e){if(G.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function bt(e){if(G.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function gt(e,t){if(typeof e.ref=="string"&&M.current&&t&&M.current.stateNode!==t){var a=O(M.current.type);Q[a]||(E('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',O(M.current.type),e.ref),Q[a]=!0)}}function Nt(e,t){{var a=function(){xe||(xe=!0,E("%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)",t))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function yt(e,t){{var a=function(){Te||(Te=!0,E("%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)",t))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var Rt=function(e,t,a,o,m,h,f){var u={$$typeof:l,type:e,key:t,ref:a,props:f,_owner:h};return u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function Et(e,t,a,o,m){{var h,f={},u=null,P=null;a!==void 0&&(we(a),u=""+a),bt(t)&&(we(t.key),u=""+t.key),kt(t)&&(P=t.ref,gt(t,m));for(h in t)G.call(t,h)&&!_t.hasOwnProperty(h)&&(f[h]=t[h]);if(e&&e.defaultProps){var k=e.defaultProps;for(h in k)f[h]===void 0&&(f[h]=k[h])}if(u||P){var g=typeof e=="function"?e.displayName||e.name||"Unknown":e;u&&Nt(f,g),P&&yt(f,g)}return Rt(e,u,P,m,o,M.current,f)}}var ee=A.ReactCurrentOwner,je=A.ReactDebugCurrentFrame;function I(e){if(e){var t=e._owner,a=U(e.type,e._source,t?t.type:null);je.setExtraStackFrame(a)}else je.setExtraStackFrame(null)}var te;te=!1;function re(e){return typeof e=="object"&&e!==null&&e.$$typeof===l}function Se(){{if(ee.current){var e=O(ee.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 Pt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),a=e.lineNumber;return`
|
|
24
24
|
|
|
25
|
-
Check your code at `+
|
|
25
|
+
Check your code at `+t+":"+a+"."}return""}}var Oe={};function wt(e){{var t=Se();if(!t){var a=typeof e=="string"?e:e.displayName||e.name;a&&(t=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+t+">.")}return r}}function Ce(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=Er(r);if(Oe[t])return;Oe[t]=!0;var n="";e&&e._owner&&e._owner!==ee.current&&(n=" It was passed a child from "+C(e._owner.type)+"."),I(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),I(null)}}function je(e,r){{if(typeof e!="object")return;if(Z(e))for(var t=0;t<e.length;t++){var n=e[t];te(n)&&Ce(n,r)}else if(te(e))e._store&&(e._store.validated=!0);else if(e){var d=Xe(e);if(typeof d=="function"&&d!==e.entries)for(var v=d.call(e),u;!(u=v.next()).done;)te(u.value)&&Ce(u.value,r)}}}function Pr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===m||r.$$typeof===x))t=r.propTypes;else return;if(t){var n=C(r);ur(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!re){re=!0;var d=C(r);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",d||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){I(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),I(null);break}}e.ref!==null&&(I(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}function De(e,r,t,n,d,v){{var u=ar(e);if(!u){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=Rr(d);P?o+=P:o+=Se();var h;e===null?h="null":Z(e)?h="array":e!==void 0&&e.$$typeof===c?(h="<"+(C(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):h=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",h,o)}var b=yr(e,r,t,d,v);if(b==null)return b;if(u){var w=r.children;if(w!==void 0)if(n)if(Z(w)){for(var W=0;W<w.length;W++)je(w[W],e);Object.freeze&&Object.freeze(w)}else E("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(w,e)}return e===l?Tr(b):Pr(b),b}}function Nr(e,r,t){return De(e,r,t,!0)}function wr(e,r,t){return De(e,r,t,!1)}var xr=wr,Sr=Nr;B.Fragment=l,B.jsx=xr,B.jsxs=Sr}()),B}(function(i){process.env.NODE_ENV==="production"?i.exports=Ie():i.exports=We()})(Ae);const ie=Y.Fragment,a=Y.jsx,R=Y.jsxs,S=({className:i,name:c,viewBox:s="0 0 32 32",...l})=>{const p=[i].filter(Boolean).join(" ");return a("svg",{...l,className:p,viewBox:s,children:a("use",{href:`#${c}`})})},Ye=T.forwardRef(({children:i,className:c,skin:s="info",closeAlert:l=!1,onClose:p,title:f,date:k,ariaLive:g="polite",...m},N)=>{const y=[c,"pkt-alert",s&&`pkt-alert--${s}`].filter(Boolean).join(" "),[x,O]=T.useState(!0),F=()=>{O(!1),p&&p()};return x?R("div",{...m,className:y,"aria-live":g,ref:N,children:[a("div",{className:"pkt-alert__icon",children:a(S,{name:s==="info"?"alert-information":`alert-${s}`})}),l&&a("div",{className:"pkt-alert__close",children:a("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:F,children:a(S,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),f&&a("div",{className:"pkt-alert__title",children:f}),a("div",{className:"pkt-alert__text",children:i}),k&&R("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",k]})]}):null}),oe=T.forwardRef(({children:i,className:c,iconName:s="user",secondIconName:l="user",size:p="medium",skin:f="primary",type:k="button",variant:g="label-only",...m},N)=>{const y=[c,"pkt-btn",p&&`pkt-btn--${p}`,f&&`pkt-btn--${f}`,g&&`pkt-btn--${g}`].filter(Boolean).join(" ");return R("button",{...m,className:y,type:k,ref:N,children:[a(S,{className:"pkt-btn__icon",name:s}),a("span",{className:"pkt-btn__text",children:i}),g==="icons-right-and-left"&&a(S,{className:"pkt-btn__icon",name:l})]})});oe.displayName="PktButton";const Le=({className:i,logoLink:c="https://www.oslo.kommune.no/",isLoggedIn:s=!1,representing:l="",canChangeRepresentation:p=!1,showLogInButton:f=!0,onLogIn:k,onLogOut:g,onChangeRepresentation:m})=>{const N=[i,"pkt-header"].filter(Boolean).join(" ");return R("header",{id:"pkt-header",className:N,"aria-label":"Topp",children:[a("div",{className:"pkt-header__logo",children:a("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:c,children:a(S,{name:"oslologo",className:"pkt-header__logo-svg",viewBox:"0 0 60 31","aria-hidden":"true"})})}),R("div",{className:"pkt-header__actions",children:[s&&p&&R("button",{className:"pkt-btn pkt-btn--secondary pkt-btn--icon-right","aria-label":`Bytt bruker fra ${l}`,onClick:m,children:[a(S,{name:"user",className:"pkt-btn__icon pkt-show-tablet-up"}),a("span",{className:"pkt-header__action-change pkt-hide pkt-show-tablet-up ml-size-15",children:"Endre"}),a("span",{className:"pkt-btn__text pkt-hide-tablet-up",children:"Endre"}),a("span",{className:"pkt-btn__text--representing pkt-hide pkt-show-tablet-up",children:l})]}),s&&!p&&R("div",{className:"pkt-header__action",children:[a("span",{className:"pkt-header__action-text",children:a("span",{className:"pkt-btn__text pkt-header__action-textrow text-row-inline pkt-truncate-text",children:l})}),a("span",{className:"pkt-header__action-icon pkt-show-phablet-up",children:a(S,{name:"user"})})]}),f&&s&&R("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg ut",onClick:g,children:[a(S,{className:"pkt-btn__icon pkt-show-tablet-up",name:"exit"}),a("span",{className:"pkt-btn__text",children:"Logg ut"})]}),f&&!s&&R("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg inn",onClick:k,children:[a(S,{className:"pkt-btn__icon",name:"user"}),a("span",{className:"pkt-btn__text",children:"Logg inn"})]})]})]})},se=T.forwardRef(({label:i,id:c,children:s,...l},p)=>R("div",{className:"pkt-form-group",children:[a("label",{htmlFor:c,className:"pkt-form-label",children:i}),a("input",{className:"pkt-form-input",id:c,...l,ref:p}),s]}));se.displayName="PktInput";const Be=({children:i,className:c,iconName:s="user",skin:l="",href:p="#",title:f})=>{const k=[c,"pkt-linkcard",l&&`pkt-linkcard--${l}`].filter(Boolean).join(" ");return R("a",{href:p,className:`pkt-linkcard pkt-link ${k}`,children:[a(S,{className:"pkt-link__icon",name:s}),R("div",{className:"pkt-linkcard__content",children:[a("div",{className:"pkt-linkcard__title",children:f}),a("div",{className:"pkt-linkcard__text",children:i})]})]})},Me=({children:i,skin:c="beige",title:s,...l})=>{const p=["pkt-messagebox",c&&`pkt-messagebox--${c}`].filter(Boolean).join(" ");return R("div",{...l,className:p,children:[a("div",{className:"pkt-messagebox__title",children:s}),a("div",{className:"pkt-messagebox__text",children:i})]})},le=T.forwardRef(({id:i,name:c,label:s,value:l,...p},f)=>R("div",{className:"pkt-form-group",children:[a("input",{type:"radio",className:"pkt-form-check-input",id:i,name:c,value:l,ref:f,...p}),a("label",{className:"pkt-form-label",htmlFor:i,children:s})]}));le.displayName="PktRadio";const $e=({label:i,children:c})=>R(ie,{children:[a("p",{children:i}),a("div",{className:"pkt-form-group",children:c})]});var z={},Ve={get exports(){return z},set exports(i){z=i}};/*!
|
|
27
|
+
Check the top-level render call using <`+a+">.")}return t}}function Ce(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=wt(t);if(Oe[a])return;Oe[a]=!0;var o="";e&&e._owner&&e._owner!==ee.current&&(o=" It was passed a child from "+O(e._owner.type)+"."),I(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,o),I(null)}}function Fe(e,t){{if(typeof e!="object")return;if(q(e))for(var a=0;a<e.length;a++){var o=e[a];re(o)&&Ce(o,t)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var m=Qe(e);if(typeof m=="function"&&m!==e.entries)for(var h=m.call(e),f;!(f=h.next()).done;)re(f.value)&&Ce(f.value,t)}}}function xt(e){{var t=e.type;if(t==null||typeof t=="string")return;var a;if(typeof t=="function")a=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===_||t.$$typeof===j))a=t.propTypes;else return;if(a){var o=O(t);pt(a,e.props,"prop",o,e)}else if(t.PropTypes!==void 0&&!te){te=!0;var m=O(t);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tt(e){{for(var t=Object.keys(e.props),a=0;a<t.length;a++){var o=t[a];if(o!=="children"&&o!=="key"){I(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),I(null);break}}e.ref!==null&&(I(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}function De(e,t,a,o,m,h){{var f=ot(e);if(!f){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=Pt(m);P?u+=P:u+=Se();var k;e===null?k="null":q(e)?k="array":e!==void 0&&e.$$typeof===l?(k="<"+(O(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):k=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",k,u)}var g=Et(e,t,a,m,h);if(g==null)return g;if(f){var T=t.children;if(T!==void 0)if(o)if(q(T)){for(var $=0;$<T.length;$++)Fe(T[$],e);Object.freeze&&Object.freeze(T)}else E("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 Fe(T,e)}return e===c?Tt(g):xt(g),g}}function jt(e,t,a){return De(e,t,a,!0)}function St(e,t,a){return De(e,t,a,!1)}var Ot=St,Ct=jt;Y.Fragment=c,Y.jsx=Ot,Y.jsxs=Ct}()),Y}process.env.NODE_ENV==="production"?H.exports=$e():H.exports=We();var J=H.exports;const ie=J.Fragment,r=J.jsx,d=J.jsxs,y=({className:i,name:l,viewBox:s="0 0 32 32",...c})=>{const p=[i].filter(Boolean).join(" ");return r("svg",{...c,className:p,viewBox:s,children:r("use",{href:`#${l}`})})},Ye=w.forwardRef(({children:i,className:l,skin:s="info",closeAlert:c=!1,onClose:p,title:n,date:v,ariaLive:N="polite",..._},x)=>{const R=[l,"pkt-alert",s&&`pkt-alert--${s}`].filter(Boolean).join(" "),[j,S]=w.useState(!0),D=()=>{S(!1),p&&p()};return j?d("div",{..._,className:R,"aria-live":N,ref:x,children:[r("div",{className:"pkt-alert__icon",children:r(y,{name:s==="info"?"alert-information":`alert-${s}`})}),c&&r("div",{className:"pkt-alert__close",children:r("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:D,children:r(y,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),n&&r("div",{className:"pkt-alert__title",children:n}),r("div",{className:"pkt-alert__text",children:i}),v&&d("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",v]})]}):null}),oe=w.forwardRef(({children:i,className:l,iconName:s="user",secondIconName:c="user",size:p="medium",skin:n="primary",type:v="button",variant:N="label-only",..._},x)=>{const R=[l,"pkt-btn",p&&`pkt-btn--${p}`,n&&`pkt-btn--${n}`,N&&`pkt-btn--${N}`].filter(Boolean).join(" ");return d("button",{..._,className:R,type:v,ref:x,children:[r(y,{className:"pkt-btn__icon",name:s}),r("span",{className:"pkt-btn__text",children:i}),N==="icons-right-and-left"&&r(y,{className:"pkt-btn__icon",name:c})]})});oe.displayName="PktButton";const Be=({links:i=[]})=>r("footer",{className:"pkt-footer-simple","data-mode":"dark",children:r("div",{className:"pkt-footer-simple__container",children:d("ul",{className:"pkt-footer-simple__list",children:[i.map((l,s)=>r("li",{className:"pkt-footer-simple__list-item",children:d("a",{className:`pkt-footer-simple__link ${l.external?" pkt-link--external":""}`,href:l.href,children:[r(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),l.text]})},s)),r("li",{className:"pkt-footer-simple__list-item",children:d("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[r(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),r("li",{className:"pkt-footer-simple__list-item",children:d("a",{className:"pkt-footer-simple__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[r(y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})}),Me=({columnOne:i,columnTwo:l,socialLinks:s})=>{var c,p;return r("footer",{className:"pkt-footer","data-mode":"dark",children:d("div",{className:"pkt-footer__container",children:[d("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[d("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[r("h2",{className:"pkt-footer__title",children:i.title}),d("ul",{className:"pkt-footer__list",children:[i.text&&r("li",{className:"pkt-footer__text",children:i.text}),(c=i.links)==null?void 0:c.map((n,v)=>r("li",{className:"pkt-footer__list-item",children:d("a",{className:`pkt-footer__link ${n.external?"pkt-link--external":""}`,href:n.href,children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),n.text]})},`links-${v}`))]})]}),d("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[r("h2",{className:"pkt-footer__title",children:l.title}),d("ul",{className:"pkt-footer__list",children:[l.text&&r("li",{className:"pkt-footer__text",children:l.text}),(p=l.links)==null?void 0:p.map((n,v)=>r("li",{className:"pkt-footer__list-item",children:d("a",{className:`pkt-footer__link ${n.external?"pkt-link--external":""}`,href:n.href,children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),n.text]})},`links-${v}`))]})]}),d("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[r("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),d("ul",{className:"pkt-footer__list",children:[r("li",{className:"pkt-footer__list-item",children:d("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),r("li",{className:"pkt-footer__list-item",children:d("a",{className:"pkt-footer__link",href:"https://www.oslo.kommune.no/tilgjengelighet/",children:[r(y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),s&&d("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[r("div",{className:"pkt-footer__social-languages",children:s.filter(n=>n.language).map((n,v)=>r("div",{className:"pkt-footer__social-language",children:r("a",{href:n.href,"aria-label":`til ${n.language} versjon av nettsiden`,children:n.language})},`sociallinks-language-${v}`))}),r("div",{className:"pkt-footer__social-icons",children:s.filter(n=>n.iconName).map((n,v)=>r(w.Fragment,{children:r("a",{href:n.href,"aria-label":`til ${n.iconName}`,className:"pkt-footer__social-icon-link",children:r("svg",{className:"pkt-footer__social-icon",viewBox:"0 0 32 32","aria-hidden":"true",children:r("use",{href:`#${n.iconName}`})})})},`sociallinks-${v}`))})]})]})})},Le=({className:i,logoLink:l="https://www.oslo.kommune.no/",isLoggedIn:s=!1,representing:c="",canChangeRepresentation:p=!1,showLogInButton:n=!0,onLogIn:v,onLogOut:N,onChangeRepresentation:_})=>{const x=[i,"pkt-header"].filter(Boolean).join(" ");return d("header",{id:"pkt-header",className:x,"aria-label":"Topp",children:[r("div",{className:"pkt-header__logo",children:r("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:l,children:r(y,{name:"oslologo",className:"pkt-header__logo-svg",viewBox:"0 0 60 31","aria-hidden":"true"})})}),d("div",{className:"pkt-header__actions",children:[s&&p&&d("button",{className:"pkt-btn pkt-btn--secondary pkt-btn--icon-right","aria-label":`Bytt bruker fra ${c}`,onClick:_,children:[r(y,{name:"user",className:"pkt-btn__icon pkt-show-tablet-up"}),r("span",{className:"pkt-header__action-change pkt-hide pkt-show-tablet-up ml-size-15",children:"Endre"}),r("span",{className:"pkt-btn__text pkt-hide-tablet-up",children:"Endre"}),r("span",{className:"pkt-btn__text--representing pkt-hide pkt-show-tablet-up",children:c})]}),s&&!p&&d("div",{className:"pkt-header__action",children:[r("span",{className:"pkt-header__action-text",children:r("span",{className:"pkt-btn__text pkt-header__action-textrow text-row-inline pkt-truncate-text",children:c})}),r("span",{className:"pkt-header__action-icon pkt-show-phablet-up",children:r(y,{name:"user"})})]}),n&&s&&d("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg ut",onClick:N,children:[r(y,{className:"pkt-btn__icon pkt-show-tablet-up",name:"exit"}),r("span",{className:"pkt-btn__text",children:"Logg ut"})]}),n&&!s&&d("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg inn",onClick:v,children:[r(y,{className:"pkt-btn__icon",name:"user"}),r("span",{className:"pkt-btn__text",children:"Logg inn"})]})]})]})},le=w.forwardRef(({label:i,id:l,children:s,...c},p)=>d("div",{className:"pkt-form-group",children:[r("label",{htmlFor:l,className:"pkt-form-label",children:i}),r("input",{className:"pkt-form-input",id:l,...c,ref:p}),s]}));le.displayName="PktInput";const Ve=({children:i,className:l,iconName:s="user",skin:c="",href:p="#",title:n})=>{const v=[l,"pkt-linkcard",c&&`pkt-linkcard--${c}`].filter(Boolean).join(" ");return d("a",{href:p,className:`pkt-linkcard pkt-link ${v}`,children:[r(y,{className:"pkt-link__icon",name:s}),d("div",{className:"pkt-linkcard__content",children:[r("div",{className:"pkt-linkcard__title",children:n}),r("div",{className:"pkt-linkcard__text",children:i})]})]})},Ue=({children:i,skin:l="beige",title:s,...c})=>{const p=["pkt-messagebox",l&&`pkt-messagebox--${l}`].filter(Boolean).join(" ");return d("div",{...c,className:p,children:[r("div",{className:"pkt-messagebox__title",children:s}),r("div",{className:"pkt-messagebox__text",children:i})]})},se=w.forwardRef(({id:i,name:l,label:s,value:c,...p},n)=>d("div",{className:"pkt-form-group",children:[r("input",{type:"radio",className:"pkt-form-check-input",id:i,name:l,value:c,ref:n,...p}),r("label",{className:"pkt-form-label",htmlFor:i,children:s})]}));se.displayName="PktRadio";const Ge=({label:i,children:l})=>d(ie,{children:[r("p",{children:i}),r("div",{className:"pkt-form-group",children:l})]});var ce={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(i){(function(){var
|
|
31
|
+
*/(function(i){(function(){var l={}.hasOwnProperty;function s(){for(var c=[],p=0;p<arguments.length;p++){var n=arguments[p];if(n){var v=typeof n;if(v==="string"||v==="number")c.push(n);else if(Array.isArray(n)){if(n.length){var N=s.apply(null,n);N&&c.push(N)}}else if(v==="object"){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){c.push(n.toString());continue}for(var _ in n)l.call(n,_)&&n[_]&&c.push(_)}}}return c.join(" ")}i.exports?(s.default=s,i.exports=s):window.classNames=s})()})(ce);var ze=ce.exports;const He=Ie(ze),Je=({isResponsive:i,children:l})=>i?r("div",{className:"pkt-table-container",children:l}):r(ie,{children:l}),Ke=({isResponsive:i,modifiers:{info:l=!1,success:s=!1,strong:c=!1,shadow:p=!1}={},children:n})=>r(Je,{isResponsive:i,children:r("table",{className:He("pkt-table",{"pkt-table--info":l,"pkt-table--success":s,"pkt-table--strong":c,"pkt-table--shadow":p}),children:n})}),Xe=({children:i})=>r("td",{className:"pkt-table__th",children:i}),Ze=({children:i})=>r("th",{className:"pkt-table__th",children:i}),ue=w.forwardRef(({id:i,label:l,...s},c)=>d("div",{className:"pkt-form-group",children:[r("label",{htmlFor:i,className:"pkt-form-label",children:l}),r("textarea",{className:"pkt-form-textarea",id:i,ref:c,...s})]}));ue.displayName="PktTextarea",b.PktAlert=Ye,b.PktButton=oe,b.PktFooter=Me,b.PktFooterSimple=Be,b.PktHeader=Le,b.PktInput=le,b.PktLinkCard=Ve,b.PktMessagebox=Ue,b.PktRadio=se,b.PktRadioGroup=Ge,b.PktTable=Ke,b.PktTableData=Xe,b.PktTableHeader=Ze,b.PktTextarea=ue,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"test": "react-scripts test --env=jsdom"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@oslokommune/punkt-assets": "^
|
|
35
|
-
"@oslokommune/punkt-css": "^
|
|
34
|
+
"@oslokommune/punkt-assets": "^4.0.0",
|
|
35
|
+
"@oslokommune/punkt-css": "^4.0.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": "5de20e7298e204d7770f89bd47df267ca1544f54"
|
|
94
94
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Test med axe https://www.npmjs.com/package/jest-axe
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import { render, screen } from '@testing-library/react'
|
|
4
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
|
+
|
|
6
|
+
import { PktFooter } from './Footer'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const { axe, toHaveNoViolations } = require('jest-axe')
|
|
10
|
+
expect.extend(toHaveNoViolations)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
describe('PktFooterSimple', () => {
|
|
15
|
+
|
|
16
|
+
const columnOne = {
|
|
17
|
+
title: 'Column One',
|
|
18
|
+
links: [
|
|
19
|
+
{
|
|
20
|
+
href: 'https://example.com',
|
|
21
|
+
text: 'Link 1',
|
|
22
|
+
external: true,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
href: 'https://example.com',
|
|
26
|
+
text: 'Link 2',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
text: 'Column One Text',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const columnTwo = {
|
|
33
|
+
title: 'Column Two',
|
|
34
|
+
links: [
|
|
35
|
+
{
|
|
36
|
+
href: 'https://example.com',
|
|
37
|
+
text: 'Link 3',
|
|
38
|
+
external: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
href: 'https://example.com',
|
|
42
|
+
text: 'Link 4',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
text: 'Column Two Text',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const socialLinks = [
|
|
49
|
+
{
|
|
50
|
+
href: 'https://example.com',
|
|
51
|
+
iconName: 'facebook',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
href: 'https://example.com',
|
|
55
|
+
iconName: 'twitter',
|
|
56
|
+
},
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
describe('basic rendering', () => {
|
|
61
|
+
it('should render columns and social links', () => {
|
|
62
|
+
render(<PktFooter columnOne={columnOne} columnTwo={columnTwo} socialLinks={socialLinks} />)
|
|
63
|
+
|
|
64
|
+
const columnOneElement = screen.getByText('Column One')
|
|
65
|
+
expect(columnOneElement).toBeInTheDocument()
|
|
66
|
+
|
|
67
|
+
const columnOneLink1Element = screen.getByText('Link 1')
|
|
68
|
+
expect(columnOneLink1Element).toHaveAttribute('href', 'https://example.com')
|
|
69
|
+
expect(columnOneLink1Element).toHaveClass('pkt-link--external')
|
|
70
|
+
|
|
71
|
+
const columnOneLink2Element = screen.getByText('Link 2')
|
|
72
|
+
expect(columnOneLink2Element).toHaveAttribute('href', 'https://example.com')
|
|
73
|
+
expect(columnOneLink2Element).not.toHaveClass('pkt-link--external')
|
|
74
|
+
|
|
75
|
+
const columnOneTextElement = screen.getByText('Column One Text')
|
|
76
|
+
expect(columnOneTextElement).toBeInTheDocument()
|
|
77
|
+
|
|
78
|
+
const columnTwoElement = screen.getByText('Column Two')
|
|
79
|
+
expect(columnTwoElement).toBeInTheDocument()
|
|
80
|
+
|
|
81
|
+
const columnTwoLink3Element = screen.getByText('Link 3')
|
|
82
|
+
expect(columnTwoLink3Element).toHaveAttribute('href', 'https://example.com')
|
|
83
|
+
expect(columnTwoLink3Element).toHaveClass('pkt-link--external')
|
|
84
|
+
|
|
85
|
+
const columnTwoLink4Element = screen.getByText('Link 4')
|
|
86
|
+
expect(columnTwoLink4Element).toHaveAttribute('href', 'https://example.com')
|
|
87
|
+
expect(columnTwoLink4Element).not.toHaveClass('pkt-link--external')
|
|
88
|
+
|
|
89
|
+
const columnTwoTextElement = screen.getByText('Column Two Text')
|
|
90
|
+
expect(columnTwoTextElement).toBeInTheDocument()
|
|
91
|
+
|
|
92
|
+
const personvernLink = screen.getByText('Personvern og informasjonskapsler');
|
|
93
|
+
expect(personvernLink).toBeInTheDocument();
|
|
94
|
+
|
|
95
|
+
const tilgjengelighetLink = screen.getByText('Tilgjengelighet');
|
|
96
|
+
expect(tilgjengelighetLink).toBeInTheDocument();
|
|
97
|
+
|
|
98
|
+
const socialLinksElement = screen.getByLabelText('standard lenker')
|
|
99
|
+
expect(socialLinksElement).toBeInTheDocument()
|
|
100
|
+
|
|
101
|
+
const socialLinksFacebookElement = screen.getByLabelText('til facebook')
|
|
102
|
+
expect(socialLinksFacebookElement).toHaveAttribute('href', 'https://example.com')
|
|
103
|
+
|
|
104
|
+
const socialLinksTwitterElement = screen.getByLabelText('til twitter')
|
|
105
|
+
expect(socialLinksTwitterElement).toHaveAttribute('href', 'https://example.com')
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
describe('accessibility', () => {
|
|
110
|
+
it('renders with no wcag errors with axe', async () => {
|
|
111
|
+
const { container } = render(<PktFooter columnOne={columnOne} columnTwo={columnTwo} socialLinks={socialLinks}/>);
|
|
112
|
+
const results = await axe(container);
|
|
113
|
+
expect(results).toHaveNoViolations();
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
describe('snapshot', () => {
|
|
118
|
+
it('renders correctly', () => {
|
|
119
|
+
const { container } = render(<PktFooter columnOne={columnOne} columnTwo={columnTwo} socialLinks={socialLinks} />);
|
|
120
|
+
expect(container).toMatchSnapshot();
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
});
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { PktIcon } from '../icon/Icon'
|
|
3
|
+
|
|
4
|
+
interface Link {
|
|
5
|
+
href: string
|
|
6
|
+
text: string
|
|
7
|
+
external?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Column {
|
|
11
|
+
title: string
|
|
12
|
+
links?: Link[]
|
|
13
|
+
text?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface SocialLink {
|
|
17
|
+
href: string
|
|
18
|
+
iconName?: string
|
|
19
|
+
language?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IPktFooter extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
|
+
columnOne: Column
|
|
24
|
+
columnTwo: Column
|
|
25
|
+
socialLinks?: SocialLink[]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const PktFooter: React.FC<IPktFooter> = ({ columnOne, columnTwo, socialLinks }) => {
|
|
29
|
+
return (
|
|
30
|
+
<footer className="pkt-footer" data-mode="dark">
|
|
31
|
+
<div className="pkt-footer__container">
|
|
32
|
+
<div className="pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16">
|
|
33
|
+
<div className="pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up">
|
|
34
|
+
<h2 className="pkt-footer__title">{columnOne.title}</h2>
|
|
35
|
+
<ul className="pkt-footer__list">
|
|
36
|
+
{columnOne.text && <li className="pkt-footer__text">{columnOne.text}</li>}
|
|
37
|
+
{columnOne.links?.map((link, index) => (
|
|
38
|
+
<li className="pkt-footer__list-item" key={`links-${index}`}>
|
|
39
|
+
<a
|
|
40
|
+
className={`pkt-footer__link ${link.external ? 'pkt-link--external' : ''}`}
|
|
41
|
+
href={link.href}
|
|
42
|
+
>
|
|
43
|
+
<PktIcon className="pkt-footer__link-icon" name="chevron-right" />
|
|
44
|
+
{link.text}
|
|
45
|
+
</a>
|
|
46
|
+
</li>
|
|
47
|
+
))}
|
|
48
|
+
</ul>
|
|
49
|
+
</div>
|
|
50
|
+
<div className="pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up">
|
|
51
|
+
<h2 className="pkt-footer__title">{columnTwo.title}</h2>
|
|
52
|
+
<ul className="pkt-footer__list">
|
|
53
|
+
{columnTwo.text && <li className="pkt-footer__text">{columnTwo.text}</li>}
|
|
54
|
+
{columnTwo.links?.map((link, index) => (
|
|
55
|
+
<li className="pkt-footer__list-item" key={`links-${index}`}>
|
|
56
|
+
<a
|
|
57
|
+
className={`pkt-footer__link ${link.external ? 'pkt-link--external' : ''}`}
|
|
58
|
+
href={link.href}
|
|
59
|
+
>
|
|
60
|
+
<PktIcon className="pkt-footer__link-icon" name="chevron-right" />
|
|
61
|
+
{link.text}
|
|
62
|
+
</a>
|
|
63
|
+
</li>
|
|
64
|
+
))}
|
|
65
|
+
</ul>
|
|
66
|
+
</div>
|
|
67
|
+
<div className="pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up">
|
|
68
|
+
<h2 className="pkt-footer__title">Om nettstedet</h2>
|
|
69
|
+
<ul className="pkt-footer__list">
|
|
70
|
+
<li className="pkt-footer__list-item">
|
|
71
|
+
<a
|
|
72
|
+
className="pkt-footer__link"
|
|
73
|
+
href="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/"
|
|
74
|
+
>
|
|
75
|
+
<PktIcon className="pkt-footer__link-icon" name="chevron-right" />
|
|
76
|
+
Personvern og informasjonskapsler
|
|
77
|
+
</a>
|
|
78
|
+
</li>
|
|
79
|
+
<li className="pkt-footer__list-item">
|
|
80
|
+
<a className="pkt-footer__link" href="https://www.oslo.kommune.no/tilgjengelighet/">
|
|
81
|
+
<PktIcon className="pkt-footer__link-icon" name="chevron-right" />
|
|
82
|
+
Tilgjengelighet
|
|
83
|
+
</a>
|
|
84
|
+
</li>
|
|
85
|
+
</ul>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
{socialLinks && (
|
|
89
|
+
<div className="pkt-footer__social" aria-label="standard lenker">
|
|
90
|
+
<div className="pkt-footer__social-languages">
|
|
91
|
+
{socialLinks
|
|
92
|
+
.filter((link) => link.language)
|
|
93
|
+
.map((link, index) => (
|
|
94
|
+
<div key={`sociallinks-language-${index}`} className="pkt-footer__social-language">
|
|
95
|
+
<a href={link.href} aria-label={`til ${link.language} versjon av nettsiden`}>
|
|
96
|
+
{link.language}
|
|
97
|
+
</a>
|
|
98
|
+
</div>
|
|
99
|
+
))}
|
|
100
|
+
</div>
|
|
101
|
+
<div className="pkt-footer__social-icons">
|
|
102
|
+
{socialLinks
|
|
103
|
+
.filter((link) => link.iconName)
|
|
104
|
+
.map((link, index) => (
|
|
105
|
+
<React.Fragment key={`sociallinks-${index}`}>
|
|
106
|
+
<a
|
|
107
|
+
href={link.href}
|
|
108
|
+
aria-label={`til ${link.iconName}`}
|
|
109
|
+
className="pkt-footer__social-icon-link"
|
|
110
|
+
>
|
|
111
|
+
<svg className="pkt-footer__social-icon" viewBox="0 0 32 32" aria-hidden="true">
|
|
112
|
+
<use href={`#${link.iconName}`}></use>
|
|
113
|
+
</svg>
|
|
114
|
+
</a>
|
|
115
|
+
</React.Fragment>
|
|
116
|
+
))}
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
)}
|
|
120
|
+
</div>
|
|
121
|
+
</footer>
|
|
122
|
+
)
|
|
123
|
+
}
|