@oslokommune/punkt-react 11.9.2 → 11.9.3
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
CHANGED
|
@@ -5,6 +5,24 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [11.9.3](https://github.com/oslokommune/punkt/compare/11.9.2...11.9.3) (2024-03-14)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
* PktButton isLoading viser ikke spinner når `label-only` (#1583).
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
Ingen
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
|
|
8
26
|
## [11.9.1](https://github.com/oslokommune/punkt/compare/11.9.0...11.9.1) (2024-03-12)
|
|
9
27
|
|
|
10
28
|
### ⚠ BREAKING CHANGES
|
package/dist/punkt-react.es.js
CHANGED
package/dist/punkt-react.umd.js
CHANGED
|
@@ -51,7 +51,7 @@ Check the top-level render call using <`+m+">.")}return p}}function Ut(t,p){{if(
|
|
|
51
51
|
* LICENSE.md file in the root directory of this source tree.
|
|
52
52
|
*
|
|
53
53
|
* @license MIT
|
|
54
|
-
*/function ae(){return ae=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(e[l]=a[l])}return e},ae.apply(this,arguments)}function We(e,n){if(e==null)return{};var a={},l=Object.keys(e),r,o;for(o=0;o<l.length;o++)r=l[o],!(n.indexOf(r)>=0)&&(a[r]=e[r]);return a}const ve="get",_e="application/x-www-form-urlencoded";function be(e){return e!=null&&typeof e.tagName=="string"}function hn(e){return be(e)&&e.tagName.toLowerCase()==="button"}function kn(e){return be(e)&&e.tagName.toLowerCase()==="form"}function vn(e){return be(e)&&e.tagName.toLowerCase()==="input"}function _n(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function bn(e,n){return e.button===0&&(!n||n==="_self")&&!_n(e)}let ge=null;function gn(){if(ge===null)try{new FormData(document.createElement("form"),0),ge=!1}catch{ge=!0}return ge}const Nn=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Be(e){return e!=null&&!Nn.has(e)?(process.env.NODE_ENV!=="production"&&ne(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+_e+'"')),null):e}function yn(e,n){let a,l,r,o,s;if(kn(e)){let c=e.getAttribute("action");l=c?ue(c,n):null,a=e.getAttribute("method")||ve,r=Be(e.getAttribute("enctype"))||_e,o=new FormData(e)}else if(hn(e)||vn(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||c.getAttribute("action");if(l=f?ue(f,n):null,a=e.getAttribute("formmethod")||c.getAttribute("method")||ve,r=Be(e.getAttribute("formenctype"))||Be(c.getAttribute("enctype"))||_e,o=new FormData(c,e),!gn()){let{name:u,type:d,value:k}=e;if(d==="image"){let v=u?u+".":"";o.append(v+"x","0"),o.append(v+"y","0")}else u&&o.append(u,k)}}else{if(be(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=ve,l=null,r=_e,s=e}return o&&r==="text/plain"&&(s=o,o=void 0),{action:l,method:a.toLowerCase(),encType:r,formData:o,body:s}}const wn=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],En=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],Cn=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"],mt=y.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(mt.displayName="ViewTransition");const xn=y.createContext(new Map);process.env.NODE_ENV!=="production"&&(xn.displayName="Fetchers"),process.env.NODE_ENV;const Pn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Sn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ne=y.forwardRef(function(n,a){let{onClick:l,relative:r,reloadDocument:o,replace:s,state:c,target:f,to:u,preventScrollReset:d,unstable_viewTransition:k}=n,v=We(n,wn),{basename:S}=y.useContext(Z),x,$=!1;if(typeof u=="string"&&Sn.test(u)&&(x=u,Pn))try{let _=new URL(window.location.href),j=u.startsWith("//")?new URL(_.protocol+u):new URL(u),V=ue(j.pathname,S);j.origin===_.origin&&V!=null?u=V+j.search+j.hash:$=!0}catch{process.env.NODE_ENV!=="production"&&ne(!1,'<Link to="'+u+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let I=sn(u,{relative:r}),E=$n(u,{replace:s,state:c,target:f,preventScrollReset:d,relative:r,unstable_viewTransition:k});function C(_){l&&l(_),_.defaultPrevented||E(_)}return y.createElement("a",ae({},v,{href:x||I,onClick:$||o?l:C,ref:a,target:f}))});process.env.NODE_ENV!=="production"&&(Ne.displayName="Link");const Rn=y.forwardRef(function(n,a){let{"aria-current":l="page",caseSensitive:r=!1,className:o="",end:s=!1,style:c,to:f,unstable_viewTransition:u,children:d}=n,k=We(n,En),v=pe(f,{relative:k.relative}),S=fe(),x=y.useContext(st),{navigator:$}=y.useContext(Z),I=x!=null&&Un(v)&&u===!0,E=$.encodeLocation?$.encodeLocation(v).pathname:v.pathname,C=S.pathname,_=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;r||(C=C.toLowerCase(),_=_?_.toLowerCase():null,E=E.toLowerCase());const j=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let V=C===E||!s&&C.startsWith(E)&&C.charAt(j)==="/",W=_!=null&&(_===E||!s&&_.startsWith(E)&&_.charAt(E.length)==="/"),B={isActive:V,isPending:W,isTransitioning:I},J=V?l:void 0,M;typeof o=="function"?M=o(B):M=[o,V?"active":null,W?"pending":null,I?"transitioning":null].filter(Boolean).join(" ");let G=typeof c=="function"?c(B):c;return y.createElement(Ne,ae({},k,{"aria-current":J,className:M,ref:a,style:G,to:f,unstable_viewTransition:u}),typeof d=="function"?d(B):d)});process.env.NODE_ENV!=="production"&&(Rn.displayName="NavLink");const Tn=y.forwardRef((e,n)=>{let{fetcherKey:a,navigate:l,reloadDocument:r,replace:o,state:s,method:c=ve,action:f,onSubmit:u,relative:d,preventScrollReset:k,unstable_viewTransition:v}=e,S=We(e,Cn),x=Ln(),$=Fn(f,{relative:d}),I=c.toLowerCase()==="get"?"get":"post",E=C=>{if(u&&u(C),C.defaultPrevented)return;C.preventDefault();let _=C.nativeEvent.submitter,j=(_==null?void 0:_.getAttribute("formmethod"))||c;x(_||C.currentTarget,{fetcherKey:a,method:j,navigate:l,replace:o,state:s,relative:d,preventScrollReset:k,unstable_viewTransition:v})};return y.createElement("form",ae({ref:n,method:I,action:$,onSubmit:r?u:E},S))});process.env.NODE_ENV!=="production"&&(Tn.displayName="Form"),process.env.NODE_ENV;var ye;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ye||(ye={}));var ht;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ht||(ht={}));function On(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function kt(e){let n=y.useContext(ke);return n||(process.env.NODE_ENV!=="production"?F(!1,On(e)):F(!1)),n}function $n(e,n){let{target:a,replace:l,state:r,preventScrollReset:o,relative:s,unstable_viewTransition:c}=n===void 0?{}:n,f=cn(),u=fe(),d=pe(e,{relative:s});return y.useCallback(k=>{if(bn(k,a)){k.preventDefault();let v=l!==void 0?l:De(u)===De(d);f(e,{replace:v,state:r,preventScrollReset:o,relative:s,unstable_viewTransition:c})}},[u,f,d,l,r,a,e,o,s,c])}function jn(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let Dn=0,In=()=>"__"+String(++Dn)+"__";function Ln(){let{router:e}=kt(ye.UseSubmit),{basename:n}=y.useContext(Z),a=dn();return y.useCallback(function(l,r){r===void 0&&(r={}),jn();let{action:o,method:s,encType:c,formData:f,body:u}=yn(l,n);if(r.navigate===!1){let d=r.fetcherKey||In();e.fetch(d,a,r.action||o,{preventScrollReset:r.preventScrollReset,formData:f,body:u,formMethod:r.method||s,formEncType:r.encType||c,unstable_flushSync:r.unstable_flushSync})}else e.navigate(r.action||o,{preventScrollReset:r.preventScrollReset,formData:f,body:u,formMethod:r.method||s,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:a,unstable_flushSync:r.unstable_flushSync,unstable_viewTransition:r.unstable_viewTransition})},[e,n,a])}function Fn(e,n){let{relative:a}=n===void 0?{}:n,{basename:l}=y.useContext(Z),r=y.useContext(re);r||(process.env.NODE_ENV!=="production"?F(!1,"useFormAction must be used inside a RouteContext"):F(!1));let[o]=r.matches.slice(-1),s=ae({},pe(e||".",{relative:a})),c=fe();if(e==null){s.search=c.search;let f=new URLSearchParams(s.search);f.has("index")&&f.get("index")===""&&(f.delete("index"),s.search=f.toString()?"?"+f.toString():"")}return(!e||e===".")&&o.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),l!=="/"&&(s.pathname=s.pathname==="/"?l:Le([l,s.pathname])),De(s)}function Un(e,n){n===void 0&&(n={});let a=y.useContext(mt);a==null&&(process.env.NODE_ENV!=="production"?F(!1,"`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):F(!1));let{basename:l}=kt(ye.useViewTransitionState),r=pe(e,{relative:n.relative});if(!a.isTransitioning)return!1;let o=ue(a.currentLocation.pathname,l)||a.currentLocation.pathname,s=ue(a.nextLocation.pathname,l)||a.nextLocation.pathname;return at(r.pathname,s)!=null||at(r.pathname,o)!=null}const An=b.forwardRef(({breadcrumbs:e,navigationType:n,className:a,...l},r)=>{const o=e.slice(0,4),s=o[o.length-2],c=[a,"pkt-breadcrumbs"].filter(Boolean).join(" ");return h("nav",{ref:r,"aria-label":"brødsmulemeny",className:c,children:[i("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:o.map((f,u)=>i("li",{className:"pkt-breadcrumbs__item",children:u===o.length-1?i("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:i("span",{className:"pkt-breadcrumbs__text",children:f.text})}):n==="router"?h(Ne,{to:f.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...l,children:[i(w,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),i("span",{className:"pkt-breadcrumbs__text",children:f.text})]}):h("a",{href:f.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...l,children:[i(w,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),i("span",{className:"pkt-breadcrumbs__text",children:f.text})]})},`breadcrumb-${u}`))}),n==="router"?h(Ne,{to:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...l,children:[i(w,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),i("span",{className:"pkt-breadcrumbs__text",children:s.text})]}):h("a",{href:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...l,children:[i(w,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),i("span",{className:"pkt-breadcrumbs__text",children:s.text})]})]})}),le=b.forwardRef(({children:e,className:n,iconName:a="user",secondIconName:l="user",size:r="medium",skin:o="primary",type:s="button",variant:c="label-only",color:f,isLoading:u=!1,...d},k)=>{const v=[n,"pkt-btn",r&&`pkt-btn--${r}`,o&&`pkt-btn--${o}`,c&&`pkt-btn--${c}`,f&&`pkt-btn--${f}`,u&&"pkt-btn--active"].filter(Boolean).join(" ");return h("button",{...d,className:v,type:s,ref:k,children:[u&&i(w,{className:"pkt-btn__icon",name:"spinner-blue",path:"https://punkt-cdn.oslo.kommune.no/11.9/animations/"}),c!=="label-only"&&i(w,{className:"pkt-btn__icon",name:a}),i("span",{className:"pkt-btn__text",children:e}),c==="icons-right-and-left"&&i(w,{className:"pkt-btn__icon",name:l})]})});le.displayName="PktButton";const vt=b.forwardRef(({id:e,hasTile:n=!1,disabled:a=!1,label:l,labelPosition:r="right",hideLabel:o=!1,checkHelptext:s,hasError:c=!1,isSwitch:f=!1,className:u,...d},k)=>{const v=[u,"pkt-input-check"].filter(Boolean).join(" ");return i("div",{className:v,children:h("div",{className:`pkt-input-check__input ${n?"pkt-input-check__input--tile":""} ${a&&n?"pkt-input-check__input--tile-disabled":""}`,children:[l&&r==="left"&&h("label",{className:`pkt-input-check__input-label ${o?"pkt-sr-only":""}`,htmlFor:e,children:[l,s&&i("div",{className:"pkt-input-check__input-helptext",children:s})]}),i("input",{ref:k,className:`pkt-input-check__input-checkbox ${c?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",role:f?"switch":"checkbox",id:e,disabled:a,...d}),l&&r==="right"&&h("label",{className:`pkt-input-check__input-label ${o?"pkt-sr-only":""}`,htmlFor:e,children:[l,s&&i("div",{className:"pkt-input-check__input-helptext",children:s})]})]})})});vt.displayName="PktCheckbox";const Vn=({columnOne:e,columnTwo:n,socialLinks:a,className:l,personvernOgInfoLink:r="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:o="https://www.oslo.kommune.no/tilgjengelighet/"})=>{var c,f;const s=[l,"pkt-footer"].filter(Boolean).join(" ");return i("footer",{className:s,"data-mode":"dark",children:h("div",{className:"pkt-footer__container",children:[h("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[h("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[i("h2",{className:"pkt-footer__title",children:e.title}),h("ul",{className:"pkt-footer__list",children:[e.text&&i("li",{className:"pkt-footer__text",children:e.text}),(c=e.links)==null?void 0:c.map((u,d)=>i("li",{className:"pkt-footer__list-item",children:h("a",{className:`pkt-footer__link ${u.external?"pkt-link--external":""}`,href:u.href,target:u.openInNewTab?"_blank":"_self",rel:u.openInNewTab?"noopener noreferrer":void 0,children:[i(w,{className:"pkt-footer__link-icon",name:"chevron-right"}),u.text]})},`links-${d}`))]})]}),h("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[i("h2",{className:"pkt-footer__title",children:n.title}),h("ul",{className:"pkt-footer__list",children:[n.text&&i("li",{className:"pkt-footer__text",children:n.text}),(f=n.links)==null?void 0:f.map((u,d)=>i("li",{className:"pkt-footer__list-item",children:h("a",{className:`pkt-footer__link ${u.external?"pkt-link--external":""}`,href:u.href,target:u.openInNewTab?"_blank":"_self",rel:u.openInNewTab?"noopener noreferrer":void 0,children:[i(w,{className:"pkt-footer__link-icon",name:"chevron-right"}),u.text]})},`links-${d}`))]})]}),h("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[i("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),h("ul",{className:"pkt-footer__list",children:[i("li",{className:"pkt-footer__list-item",children:h("a",{className:"pkt-footer__link",href:r,children:[i(w,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),i("li",{className:"pkt-footer__list-item",children:h("a",{className:"pkt-footer__link",href:o,children:[i(w,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),a&&h("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[i("div",{className:"pkt-footer__social-languages",children:a.filter(u=>u.language).map((u,d)=>i("div",{className:"pkt-footer__social-language",children:i("a",{href:u.href,"aria-label":`til ${u.language} versjon av nettsiden`,target:u.openInNewTab?"_blank":"_self",rel:u.openInNewTab?"noopener noreferrer":void 0,children:u.language})},`sociallinks-language-${d}`))}),i("div",{className:"pkt-footer__social-icons",children:a.filter(u=>u.iconName).map((u,d)=>i(b.Fragment,{children:i("a",{href:u.href,"aria-label":`til ${u.iconName}`,className:"pkt-footer__social-icon-link",target:u.openInNewTab?"_blank":"_self",rel:u.openInNewTab?"noopener noreferrer":void 0,children:i(w,{className:"pkt-footer__social-icon",name:u.iconName})})},`sociallinks-${d}`))})]})]})})},Wn=({links:e=[],personvernOgInfoLink:n="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:a="https://www.oslo.kommune.no/tilgjengelighet/",className:l})=>{const r=[l,"pkt-footer-simple"].filter(Boolean).join(" ");return i("footer",{className:r,"data-mode":"dark",children:i("div",{className:"pkt-footer-simple__container",children:h("ul",{className:"pkt-footer-simple__list",children:[e.map((o,s)=>i("li",{className:"pkt-footer-simple__list-item",children:h("a",{className:`pkt-footer-simple__link ${o.external?" pkt-link--external":""}`,href:o.href,target:o.openInNewTab?"_blank":"_self",rel:o.openInNewTab?"noopener noreferrer":void 0,children:[i(w,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),o.text]})},s)),i("li",{className:"pkt-footer-simple__list-item",children:h("a",{className:"pkt-footer-simple__link",href:n,children:[i(w,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),i("li",{className:"pkt-footer-simple__list-item",children:h("a",{className:"pkt-footer-simple__link",href:a,children:[i(w,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})})};var _t={exports:{}};/*!
|
|
54
|
+
*/function ae(){return ae=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(e[l]=a[l])}return e},ae.apply(this,arguments)}function We(e,n){if(e==null)return{};var a={},l=Object.keys(e),r,o;for(o=0;o<l.length;o++)r=l[o],!(n.indexOf(r)>=0)&&(a[r]=e[r]);return a}const ve="get",_e="application/x-www-form-urlencoded";function be(e){return e!=null&&typeof e.tagName=="string"}function hn(e){return be(e)&&e.tagName.toLowerCase()==="button"}function kn(e){return be(e)&&e.tagName.toLowerCase()==="form"}function vn(e){return be(e)&&e.tagName.toLowerCase()==="input"}function _n(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function bn(e,n){return e.button===0&&(!n||n==="_self")&&!_n(e)}let ge=null;function gn(){if(ge===null)try{new FormData(document.createElement("form"),0),ge=!1}catch{ge=!0}return ge}const Nn=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Be(e){return e!=null&&!Nn.has(e)?(process.env.NODE_ENV!=="production"&&ne(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+_e+'"')),null):e}function yn(e,n){let a,l,r,o,s;if(kn(e)){let c=e.getAttribute("action");l=c?ue(c,n):null,a=e.getAttribute("method")||ve,r=Be(e.getAttribute("enctype"))||_e,o=new FormData(e)}else if(hn(e)||vn(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||c.getAttribute("action");if(l=f?ue(f,n):null,a=e.getAttribute("formmethod")||c.getAttribute("method")||ve,r=Be(e.getAttribute("formenctype"))||Be(c.getAttribute("enctype"))||_e,o=new FormData(c,e),!gn()){let{name:u,type:d,value:k}=e;if(d==="image"){let v=u?u+".":"";o.append(v+"x","0"),o.append(v+"y","0")}else u&&o.append(u,k)}}else{if(be(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=ve,l=null,r=_e,s=e}return o&&r==="text/plain"&&(s=o,o=void 0),{action:l,method:a.toLowerCase(),encType:r,formData:o,body:s}}const wn=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],En=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],Cn=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"],mt=y.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(mt.displayName="ViewTransition");const xn=y.createContext(new Map);process.env.NODE_ENV!=="production"&&(xn.displayName="Fetchers"),process.env.NODE_ENV;const Pn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Sn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ne=y.forwardRef(function(n,a){let{onClick:l,relative:r,reloadDocument:o,replace:s,state:c,target:f,to:u,preventScrollReset:d,unstable_viewTransition:k}=n,v=We(n,wn),{basename:S}=y.useContext(Z),x,$=!1;if(typeof u=="string"&&Sn.test(u)&&(x=u,Pn))try{let _=new URL(window.location.href),j=u.startsWith("//")?new URL(_.protocol+u):new URL(u),V=ue(j.pathname,S);j.origin===_.origin&&V!=null?u=V+j.search+j.hash:$=!0}catch{process.env.NODE_ENV!=="production"&&ne(!1,'<Link to="'+u+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let I=sn(u,{relative:r}),E=$n(u,{replace:s,state:c,target:f,preventScrollReset:d,relative:r,unstable_viewTransition:k});function C(_){l&&l(_),_.defaultPrevented||E(_)}return y.createElement("a",ae({},v,{href:x||I,onClick:$||o?l:C,ref:a,target:f}))});process.env.NODE_ENV!=="production"&&(Ne.displayName="Link");const Rn=y.forwardRef(function(n,a){let{"aria-current":l="page",caseSensitive:r=!1,className:o="",end:s=!1,style:c,to:f,unstable_viewTransition:u,children:d}=n,k=We(n,En),v=pe(f,{relative:k.relative}),S=fe(),x=y.useContext(st),{navigator:$}=y.useContext(Z),I=x!=null&&Un(v)&&u===!0,E=$.encodeLocation?$.encodeLocation(v).pathname:v.pathname,C=S.pathname,_=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;r||(C=C.toLowerCase(),_=_?_.toLowerCase():null,E=E.toLowerCase());const j=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let V=C===E||!s&&C.startsWith(E)&&C.charAt(j)==="/",W=_!=null&&(_===E||!s&&_.startsWith(E)&&_.charAt(E.length)==="/"),B={isActive:V,isPending:W,isTransitioning:I},J=V?l:void 0,M;typeof o=="function"?M=o(B):M=[o,V?"active":null,W?"pending":null,I?"transitioning":null].filter(Boolean).join(" ");let G=typeof c=="function"?c(B):c;return y.createElement(Ne,ae({},k,{"aria-current":J,className:M,ref:a,style:G,to:f,unstable_viewTransition:u}),typeof d=="function"?d(B):d)});process.env.NODE_ENV!=="production"&&(Rn.displayName="NavLink");const Tn=y.forwardRef((e,n)=>{let{fetcherKey:a,navigate:l,reloadDocument:r,replace:o,state:s,method:c=ve,action:f,onSubmit:u,relative:d,preventScrollReset:k,unstable_viewTransition:v}=e,S=We(e,Cn),x=Ln(),$=Fn(f,{relative:d}),I=c.toLowerCase()==="get"?"get":"post",E=C=>{if(u&&u(C),C.defaultPrevented)return;C.preventDefault();let _=C.nativeEvent.submitter,j=(_==null?void 0:_.getAttribute("formmethod"))||c;x(_||C.currentTarget,{fetcherKey:a,method:j,navigate:l,replace:o,state:s,relative:d,preventScrollReset:k,unstable_viewTransition:v})};return y.createElement("form",ae({ref:n,method:I,action:$,onSubmit:r?u:E},S))});process.env.NODE_ENV!=="production"&&(Tn.displayName="Form"),process.env.NODE_ENV;var ye;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ye||(ye={}));var ht;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ht||(ht={}));function On(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function kt(e){let n=y.useContext(ke);return n||(process.env.NODE_ENV!=="production"?F(!1,On(e)):F(!1)),n}function $n(e,n){let{target:a,replace:l,state:r,preventScrollReset:o,relative:s,unstable_viewTransition:c}=n===void 0?{}:n,f=cn(),u=fe(),d=pe(e,{relative:s});return y.useCallback(k=>{if(bn(k,a)){k.preventDefault();let v=l!==void 0?l:De(u)===De(d);f(e,{replace:v,state:r,preventScrollReset:o,relative:s,unstable_viewTransition:c})}},[u,f,d,l,r,a,e,o,s,c])}function jn(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let Dn=0,In=()=>"__"+String(++Dn)+"__";function Ln(){let{router:e}=kt(ye.UseSubmit),{basename:n}=y.useContext(Z),a=dn();return y.useCallback(function(l,r){r===void 0&&(r={}),jn();let{action:o,method:s,encType:c,formData:f,body:u}=yn(l,n);if(r.navigate===!1){let d=r.fetcherKey||In();e.fetch(d,a,r.action||o,{preventScrollReset:r.preventScrollReset,formData:f,body:u,formMethod:r.method||s,formEncType:r.encType||c,unstable_flushSync:r.unstable_flushSync})}else e.navigate(r.action||o,{preventScrollReset:r.preventScrollReset,formData:f,body:u,formMethod:r.method||s,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:a,unstable_flushSync:r.unstable_flushSync,unstable_viewTransition:r.unstable_viewTransition})},[e,n,a])}function Fn(e,n){let{relative:a}=n===void 0?{}:n,{basename:l}=y.useContext(Z),r=y.useContext(re);r||(process.env.NODE_ENV!=="production"?F(!1,"useFormAction must be used inside a RouteContext"):F(!1));let[o]=r.matches.slice(-1),s=ae({},pe(e||".",{relative:a})),c=fe();if(e==null){s.search=c.search;let f=new URLSearchParams(s.search);f.has("index")&&f.get("index")===""&&(f.delete("index"),s.search=f.toString()?"?"+f.toString():"")}return(!e||e===".")&&o.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),l!=="/"&&(s.pathname=s.pathname==="/"?l:Le([l,s.pathname])),De(s)}function Un(e,n){n===void 0&&(n={});let a=y.useContext(mt);a==null&&(process.env.NODE_ENV!=="production"?F(!1,"`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):F(!1));let{basename:l}=kt(ye.useViewTransitionState),r=pe(e,{relative:n.relative});if(!a.isTransitioning)return!1;let o=ue(a.currentLocation.pathname,l)||a.currentLocation.pathname,s=ue(a.nextLocation.pathname,l)||a.nextLocation.pathname;return at(r.pathname,s)!=null||at(r.pathname,o)!=null}const An=b.forwardRef(({breadcrumbs:e,navigationType:n,className:a,...l},r)=>{const o=e.slice(0,4),s=o[o.length-2],c=[a,"pkt-breadcrumbs"].filter(Boolean).join(" ");return h("nav",{ref:r,"aria-label":"brødsmulemeny",className:c,children:[i("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:o.map((f,u)=>i("li",{className:"pkt-breadcrumbs__item",children:u===o.length-1?i("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:i("span",{className:"pkt-breadcrumbs__text",children:f.text})}):n==="router"?h(Ne,{to:f.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...l,children:[i(w,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),i("span",{className:"pkt-breadcrumbs__text",children:f.text})]}):h("a",{href:f.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",...l,children:[i(w,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),i("span",{className:"pkt-breadcrumbs__text",children:f.text})]})},`breadcrumb-${u}`))}),n==="router"?h(Ne,{to:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...l,children:[i(w,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),i("span",{className:"pkt-breadcrumbs__text",children:s.text})]}):h("a",{href:s.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",...l,children:[i(w,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),i("span",{className:"pkt-breadcrumbs__text",children:s.text})]})]})}),le=b.forwardRef(({children:e,className:n,iconName:a="user",secondIconName:l="user",size:r="medium",skin:o="primary",type:s="button",variant:c="label-only",color:f,isLoading:u=!1,...d},k)=>{const v=[n,"pkt-btn",r&&`pkt-btn--${r}`,o&&`pkt-btn--${o}`,c&&`pkt-btn--${c}`,f&&`pkt-btn--${f}`,u&&"pkt-btn--active"].filter(Boolean).join(" ");return h("button",{...d,className:v,type:s,ref:k,children:[u&&i(w,{className:"pkt-btn__icon pkt-btn__spinner",name:"spinner-blue",path:"https://punkt-cdn.oslo.kommune.no/11.9/animations/"}),c!=="label-only"&&i(w,{className:"pkt-btn__icon",name:a}),i("span",{className:"pkt-btn__text",children:e}),c==="icons-right-and-left"&&i(w,{className:"pkt-btn__icon",name:l})]})});le.displayName="PktButton";const vt=b.forwardRef(({id:e,hasTile:n=!1,disabled:a=!1,label:l,labelPosition:r="right",hideLabel:o=!1,checkHelptext:s,hasError:c=!1,isSwitch:f=!1,className:u,...d},k)=>{const v=[u,"pkt-input-check"].filter(Boolean).join(" ");return i("div",{className:v,children:h("div",{className:`pkt-input-check__input ${n?"pkt-input-check__input--tile":""} ${a&&n?"pkt-input-check__input--tile-disabled":""}`,children:[l&&r==="left"&&h("label",{className:`pkt-input-check__input-label ${o?"pkt-sr-only":""}`,htmlFor:e,children:[l,s&&i("div",{className:"pkt-input-check__input-helptext",children:s})]}),i("input",{ref:k,className:`pkt-input-check__input-checkbox ${c?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",role:f?"switch":"checkbox",id:e,disabled:a,...d}),l&&r==="right"&&h("label",{className:`pkt-input-check__input-label ${o?"pkt-sr-only":""}`,htmlFor:e,children:[l,s&&i("div",{className:"pkt-input-check__input-helptext",children:s})]})]})})});vt.displayName="PktCheckbox";const Vn=({columnOne:e,columnTwo:n,socialLinks:a,className:l,personvernOgInfoLink:r="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:o="https://www.oslo.kommune.no/tilgjengelighet/"})=>{var c,f;const s=[l,"pkt-footer"].filter(Boolean).join(" ");return i("footer",{className:s,"data-mode":"dark",children:h("div",{className:"pkt-footer__container",children:[h("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[h("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[i("h2",{className:"pkt-footer__title",children:e.title}),h("ul",{className:"pkt-footer__list",children:[e.text&&i("li",{className:"pkt-footer__text",children:e.text}),(c=e.links)==null?void 0:c.map((u,d)=>i("li",{className:"pkt-footer__list-item",children:h("a",{className:`pkt-footer__link ${u.external?"pkt-link--external":""}`,href:u.href,target:u.openInNewTab?"_blank":"_self",rel:u.openInNewTab?"noopener noreferrer":void 0,children:[i(w,{className:"pkt-footer__link-icon",name:"chevron-right"}),u.text]})},`links-${d}`))]})]}),h("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[i("h2",{className:"pkt-footer__title",children:n.title}),h("ul",{className:"pkt-footer__list",children:[n.text&&i("li",{className:"pkt-footer__text",children:n.text}),(f=n.links)==null?void 0:f.map((u,d)=>i("li",{className:"pkt-footer__list-item",children:h("a",{className:`pkt-footer__link ${u.external?"pkt-link--external":""}`,href:u.href,target:u.openInNewTab?"_blank":"_self",rel:u.openInNewTab?"noopener noreferrer":void 0,children:[i(w,{className:"pkt-footer__link-icon",name:"chevron-right"}),u.text]})},`links-${d}`))]})]}),h("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[i("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),h("ul",{className:"pkt-footer__list",children:[i("li",{className:"pkt-footer__list-item",children:h("a",{className:"pkt-footer__link",href:r,children:[i(w,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),i("li",{className:"pkt-footer__list-item",children:h("a",{className:"pkt-footer__link",href:o,children:[i(w,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})]})]}),a&&h("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[i("div",{className:"pkt-footer__social-languages",children:a.filter(u=>u.language).map((u,d)=>i("div",{className:"pkt-footer__social-language",children:i("a",{href:u.href,"aria-label":`til ${u.language} versjon av nettsiden`,target:u.openInNewTab?"_blank":"_self",rel:u.openInNewTab?"noopener noreferrer":void 0,children:u.language})},`sociallinks-language-${d}`))}),i("div",{className:"pkt-footer__social-icons",children:a.filter(u=>u.iconName).map((u,d)=>i(b.Fragment,{children:i("a",{href:u.href,"aria-label":`til ${u.iconName}`,className:"pkt-footer__social-icon-link",target:u.openInNewTab?"_blank":"_self",rel:u.openInNewTab?"noopener noreferrer":void 0,children:i(w,{className:"pkt-footer__social-icon",name:u.iconName})})},`sociallinks-${d}`))})]})]})})},Wn=({links:e=[],personvernOgInfoLink:n="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:a="https://www.oslo.kommune.no/tilgjengelighet/",className:l})=>{const r=[l,"pkt-footer-simple"].filter(Boolean).join(" ");return i("footer",{className:r,"data-mode":"dark",children:i("div",{className:"pkt-footer-simple__container",children:h("ul",{className:"pkt-footer-simple__list",children:[e.map((o,s)=>i("li",{className:"pkt-footer-simple__list-item",children:h("a",{className:`pkt-footer-simple__link ${o.external?" pkt-link--external":""}`,href:o.href,target:o.openInNewTab?"_blank":"_self",rel:o.openInNewTab?"noopener noreferrer":void 0,children:[i(w,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),o.text]})},s)),i("li",{className:"pkt-footer-simple__list-item",children:h("a",{className:"pkt-footer-simple__link",href:n,children:[i(w,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),i("li",{className:"pkt-footer-simple__list-item",children:h("a",{className:"pkt-footer-simple__link",href:a,children:[i(w,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})})]})})})};var _t={exports:{}};/*!
|
|
55
55
|
Copyright (c) 2018 Jed Watson.
|
|
56
56
|
Licensed under the MIT License (MIT), see
|
|
57
57
|
http://jedwatson.github.io/classnames
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "11.9.
|
|
3
|
+
"version": "11.9.3",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@oslokommune/punkt-assets": "^11.5.0",
|
|
36
|
-
"@oslokommune/punkt-css": "^11.9.
|
|
36
|
+
"@oslokommune/punkt-css": "^11.9.3",
|
|
37
37
|
"@testing-library/jest-dom": "^5.16.5",
|
|
38
38
|
"@testing-library/react": "^14.0.0",
|
|
39
39
|
"@testing-library/user-event": "^14.4.3",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
92
92
|
},
|
|
93
93
|
"license": "MIT",
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "9564f4bd08eb3b2d42a0e534af16b04dbb8f3bbf"
|
|
95
95
|
}
|
|
@@ -61,16 +61,14 @@ export const PktButton = forwardRef(
|
|
|
61
61
|
<button {...props} className={classes} type={type} ref={ref}>
|
|
62
62
|
{isLoading && (
|
|
63
63
|
<PktIcon
|
|
64
|
-
className="pkt-btn__icon"
|
|
64
|
+
className="pkt-btn__icon pkt-btn__spinner"
|
|
65
65
|
name="spinner-blue"
|
|
66
66
|
path="https://punkt-cdn.oslo.kommune.no/latest/animations/"
|
|
67
67
|
/>
|
|
68
68
|
)}
|
|
69
69
|
{variant !== 'label-only' && <PktIcon className="pkt-btn__icon" name={iconName}></PktIcon>}
|
|
70
70
|
<span className="pkt-btn__text">{children}</span>
|
|
71
|
-
{variant === 'icons-right-and-left' &&
|
|
72
|
-
<PktIcon className="pkt-btn__icon" name={secondIconName}></PktIcon>
|
|
73
|
-
)}
|
|
71
|
+
{variant === 'icons-right-and-left' && <PktIcon className="pkt-btn__icon" name={secondIconName}></PktIcon>}
|
|
74
72
|
</button>
|
|
75
73
|
)
|
|
76
74
|
},
|