@mattilsynet/design 0.0.12 → 0.0.13

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.
@@ -1,4 +1,4 @@
1
- var mtds=function(a){"use strict";const L="_alert_1h1lt_1 _ds-alert_whhdm_1",M="_breadcrumbs_1h1lt_1 _ds-breadcrumbs_whhdm_1",R="_button_1h1lt_1 _ds-button_whhdm_1",C="_details_1h1lt_1 _ds-details_whhdm_1",F="_field_1h1lt_1 _ds-field_whhdm_1",I="_fieldset_1h1lt_1 _ds-fieldset_whhdm_1",T="_autolayout_1h1lt_1",P="_input_1h1lt_1 _ds-input_whhdm_1",A="_link_1h1lt_1",B="_logo_1h1lt_1 _ds-focus_whhdm_1",N="_popover_1h1lt_1",D="_validation_1h1lt_1",H="_body_1h1lt_50",_={alert:L,breadcrumbs:M,button:R,details:C,field:F,fieldset:I,autolayout:T,input:P,link:A,logo:B,popover:N,validation:D,body:H},Q=Object.freeze(Object.defineProperty({__proto__:null,alert:L,autolayout:T,body:H,breadcrumbs:M,button:R,default:_,details:C,field:F,fieldset:I,input:P,link:A,logo:B,popover:N,validation:D},Symbol.toStringTag,{value:"Module"})),j=typeof window<"u"&&typeof document<"u";let X=0;const Y=`${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`;function b(t){return t.id||(t.id=`${Y}${++X}`),t.id}function Z(t){const e=[],n=new MutationObserver(o=>{e[0]||requestAnimationFrame(i),e.push(...o)}),i=()=>{t(e,n),e.length=0};return n}const k=(t,e,n)=>{for(const i of n[0].split(","))n[0]=i,Element.prototype[`${t}EventListener`].apply(e,n)},p=(t,...e)=>k("add",t,e),g=(t,...e)=>k("remove",t,e),tt=_.field.split(" ")[0],et=_.validation.split(" ")[0],v=new WeakMap;function z(t){for(const e of t){const n=[],i=[];let o=null,d=!0;for(const s of e.getElementsByTagName("*"))s instanceof HTMLLabelElement?n.push(s):"validity"in s&&!(s instanceof HTMLButtonElement)?o=s:s.classList.contains(et)?(d=s.getAttribute("data-color")==="success",i.unshift(b(s))):s instanceof HTMLParagraphElement&&i.push(b(s));if(o)for(const s of n)s.htmlFor=b(o);o==null||o.setAttribute("aria-describedby",i.join(" ")),o==null||o.setAttribute("aria-invalid",`${!d}`)}}j&&q(document.body);function q(t){if(v.has(t))return;const e=t.getElementsByClassName(tt),n=Z(()=>z(e));n.observe(t,{attributeFilter:["class"],attributes:!0,childList:!0,subtree:!0}),z(e),v.set(t,n)}function ot(t){var e;(e=v.get(t))==null||e.disconnect()}/*! NanoPop 2.4.2 MIT | https://github.com/Simonwep/nanopop */const nt={variantFlipOrder:{start:"sme",middle:"mse",end:"ems"},positionFlipOrder:{top:"tbrl",right:"rltb",bottom:"btrl",left:"lrbt"},position:"bottom",margin:8,padding:0},it=(t,e,n)=>{const{container:i,arrow:o,margin:d,padding:s,position:ft,variantFlipOrder:ht,positionFlipOrder:_t}={container:document.documentElement.getBoundingClientRect(),...nt,...n},{left:mt,top:bt}=e.style;e.style.left="0",e.style.top="0";const l=t.getBoundingClientRect(),r=e.getBoundingClientRect(),pt={t:l.top-r.height-d,b:l.bottom+d,r:l.right+d,l:l.left-r.width-d},gt={vs:l.left,vm:l.left+l.width/2-r.width/2,ve:l.left+l.width-r.width,hs:l.top,hm:l.bottom-l.height/2-r.height/2,he:l.bottom-r.height},[vt,yt="middle"]=ft.split("-"),wt=_t[vt],Ot=ht[yt],{top:x,left:J,bottom:U,right:G}=i;for(const u of wt){const c=u==="t"||u==="b";let f=pt[u];const[y,w]=c?["top","left"]:["left","top"],[O,S]=c?[r.height,r.width]:[r.width,r.height],[St,Et]=c?[U,G]:[G,U],[$t,Lt]=c?[x,J]:[J,x];if(!(f<$t||f+O+s>St))for(const E of Ot){let h=gt[(c?"v":"h")+E];if(!(h<Lt||h+S+s>Et)){if(h-=r[w],f-=r[y],e.style[w]=`${h}px`,e.style[y]=`${f}px`,o){const $=c?l.width/2:l.height/2,m=S/2,K=$>m,Mt={s:K?m:$,m,e:K?m:S-$},Rt={t:O,b:0,r:0,l:O},Ct=h+Mt[E],Ft=f+Rt[u];o.style[w]=`${Ct}px`,o.style[y]=`${Ft}px`}return u+E}}}return e.style.left=mt,e.style.top=bt,null},st=_.popover.split(" ")[0],lt={toJSON:()=>"",bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},rt=/(top|right|bottom|left)-(start|middle|end)/;j&&W(document);function dt(t,e){const n=e.getAttribute("data-position")||"bottom-start";if(!rt.test(n))return console.error(`Found invalid data-position="${n}"
1
+ var mtds=function(a){"use strict";const q="_alert_1q289_1 _ds-alert_whhdm_1",L="_breadcrumbs_1q289_1 _ds-breadcrumbs_whhdm_1",M="_button_1q289_1 _ds-button_whhdm_1",R="_details_1q289_1 _ds-details_whhdm_1",C="_field_1q289_1 _ds-field_whhdm_1",F="_fieldset_1q289_1 _ds-fieldset_whhdm_1",I="_autolayout_1q289_1",T="_input_1q289_1 _ds-input_whhdm_1",P="_link_1q289_1",A="_logo_1q289_1 _ds-focus_whhdm_1",B="_popover_1q289_1",N="_validation_1q289_1",D="_body_1q289_50",h={alert:q,breadcrumbs:L,button:M,details:R,field:C,fieldset:F,autolayout:I,input:T,link:P,logo:A,popover:B,validation:N,body:D},Q=Object.freeze(Object.defineProperty({__proto__:null,alert:q,autolayout:I,body:D,breadcrumbs:L,button:M,default:h,details:R,field:C,fieldset:F,input:T,link:P,logo:A,popover:B,validation:N},Symbol.toStringTag,{value:"Module"})),H=typeof window<"u"&&typeof document<"u";let X=0;const Y=`${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`;function b(t){return t.id||(t.id=`${Y}${++X}`),t.id}function Z(t){const e=[],n=new MutationObserver(o=>{e[0]||requestAnimationFrame(i),e.push(...o)}),i=()=>{t(e,n),e.length=0};return n}const j=(t,e,n)=>{for(const i of n[0].split(","))n[0]=i,Element.prototype[`${t}EventListener`].apply(e,n)},p=(t,...e)=>j("add",t,e),g=(t,...e)=>j("remove",t,e),tt=h.field.split(" ")[0],et=h.validation.split(" ")[0],v=new WeakMap;function k(t){for(const e of t){const n=[],i=[];let o=null,l=!0;for(const s of e.getElementsByTagName("*"))s instanceof HTMLLabelElement?n.push(s):"validity"in s&&!(s instanceof HTMLButtonElement)?o=s:s.classList.contains(et)?(l=s.getAttribute("data-color")==="success",i.unshift(b(s))):s instanceof HTMLParagraphElement&&i.push(b(s));if(o)for(const s of n)s.htmlFor=b(o);o==null||o.setAttribute("aria-describedby",i.join(" ")),o==null||o.setAttribute("aria-invalid",`${!l}`)}}H&&z(document.body);function z(t){if(v.has(t))return;const e=t.getElementsByClassName(tt),n=Z(()=>k(e));n.observe(t,{attributeFilter:["class"],attributes:!0,childList:!0,subtree:!0}),k(e),v.set(t,n)}function ot(t){var e;(e=v.get(t))==null||e.disconnect()}/*! NanoPop 2.4.2 MIT | https://github.com/Simonwep/nanopop */const nt={variantFlipOrder:{start:"sme",middle:"mse",end:"ems"},positionFlipOrder:{top:"tbrl",right:"rltb",bottom:"btrl",left:"lrbt"},position:"bottom",margin:8,padding:0},it=(t,e,n)=>{const{container:i,arrow:o,margin:l,padding:s,position:ft,variantFlipOrder:_t,positionFlipOrder:ht}={container:document.documentElement.getBoundingClientRect(),...nt,...n},{left:mt,top:bt}=e.style;e.style.left="0",e.style.top="0";const r=t.getBoundingClientRect(),d=e.getBoundingClientRect(),pt={t:r.top-d.height-l,b:r.bottom+l,r:r.right+l,l:r.left-d.width-l},gt={vs:r.left,vm:r.left+r.width/2-d.width/2,ve:r.left+r.width-d.width,hs:r.top,hm:r.bottom-r.height/2-d.height/2,he:r.bottom-d.height},[vt,yt="middle"]=ft.split("-"),wt=ht[vt],Ot=_t[yt],{top:x,left:J,bottom:U,right:G}=i;for(const u of wt){const c=u==="t"||u==="b";let f=pt[u];const[y,w]=c?["top","left"]:["left","top"],[O,S]=c?[d.height,d.width]:[d.width,d.height],[St,Et]=c?[U,G]:[G,U],[$t,qt]=c?[x,J]:[J,x];if(!(f<$t||f+O+s>St))for(const E of Ot){let _=gt[(c?"v":"h")+E];if(!(_<qt||_+S+s>Et)){if(_-=d[w],f-=d[y],e.style[w]=`${_}px`,e.style[y]=`${f}px`,o){const $=c?r.width/2:r.height/2,m=S/2,K=$>m,Lt={s:K?m:$,m,e:K?m:S-$},Mt={t:O,b:0,r:0,l:O},Rt=_+Lt[E],Ct=f+Mt[u];o.style[w]=`${Rt}px`,o.style[y]=`${Ct}px`}return u+E}}}return e.style.left=mt,e.style.top=bt,null},st=h.popover.split(" ")[0],rt={toJSON:()=>"",bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},dt=/(top|right|bottom|left)-(start|middle|end)/;H&&W(document);function lt(t,e){const n=e.getAttribute("data-position")||"bottom-start";if(!dt.test(n))return console.error(`Found invalid data-position="${n}"
2
2
  - It must be [top|right|bottom|left]-[start|middle|end]
3
- - Found on element:`,e);const i=()=>it(t,e,{container:{...lt,bottom:window.innerHeight,right:window.innerWidth},margin:4,padding:16,position:n}),o=({newState:d})=>{d!=="open"&&(g(document,"DOMContentReady",i),g(e,"toggle",o),g(window,"load,resize,scroll",i,!0))};document.fonts.ready.then(i),p(document,"DOMContentReady",i),p(e,"toggle",o),p(window,"load,resize,scroll",i,!0)}function V({target:t,newState:e}){var o;const i=e==="open"&&t instanceof HTMLElement&&t.classList.contains(st)&&((o=t.getRootNode())==null?void 0:o.querySelector(`[popovertarget="${t.id}"]`));i&&dt(i,t)}function W(t){t.addEventListener("toggle",V,!0)}function ct(t){t.removeEventListener("toggle",V,!0)}function at(t){q(t),W(t)}function ut(t){ot(t),ct(t)}return a.observe=at,a.styles=Q,a.unobserve=ut,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),a}({});
3
+ - Found on element:`,e);const i=()=>it(t,e,{container:{...rt,bottom:window.innerHeight,right:window.innerWidth},margin:4,padding:16,position:n}),o=({newState:l})=>{l!=="open"&&(g(document,"DOMContentReady",i),g(e,"toggle",o),g(window,"load,resize,scroll",i,!0))};document.fonts.ready.then(i),p(document,"DOMContentReady",i),p(e,"toggle",o),p(window,"load,resize,scroll",i,!0)}function V({target:t,newState:e}){var o;const i=e==="open"&&t instanceof HTMLElement&&t.classList.contains(st)&&((o=t.getRootNode())==null?void 0:o.querySelector(`[popovertarget="${t.id}"]`));i&&lt(i,t)}function W(t){t.addEventListener("toggle",V,!0)}function ct(t){t.removeEventListener("toggle",V,!0)}function at(t){z(t),W(t)}function ut(t){ot(t),ct(t)}return a.observe=at,a.styles=Q,a.unobserve=ut,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),a}({});
4
4
  //# sourceMappingURL=index.iife.js.map