@mattilsynet/design 0.2.21 → 0.3.1

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.
@@ -0,0 +1,2 @@
1
+ export declare function observe(el: Element): void;
2
+ export declare function unobserve(el: Element): void;
@@ -0,0 +1,18 @@
1
+ import { on as d, QUICK_EVENT as c, attr as a, off as r } from "../utils.js";
2
+ const e = ({ clientX: n, clientY: i, target: o }) => {
3
+ if (o instanceof HTMLDialogElement && a(o, "data-closedby") === "any") {
4
+ const { top: t, right: l, bottom: s, left: f } = o.getBoundingClientRect();
5
+ t <= i && i <= s && f <= n && n <= l || o.close();
6
+ }
7
+ };
8
+ function m(n) {
9
+ d(n, "click", e, c);
10
+ }
11
+ function p(n) {
12
+ r(n, "click", e, c);
13
+ }
14
+ export {
15
+ m as observe,
16
+ p as unobserve
17
+ };
18
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sources":["../../designsystem/dialog/dialog.ts"],"sourcesContent":["import { QUICK_EVENT, attr, off, on } from '../utils';\n\nconst handleBackdropClick = ({ clientX: x, clientY: y, target }: MouseEvent) => {\n if (target instanceof HTMLDialogElement && attr(target, 'data-closedby') === 'any') {\n const { top, right, bottom, left } = target.getBoundingClientRect();\n const isInside = top <= y && y <= bottom && left <= x && x <= right;\n\n if (!isInside) target.close();\n }\n};\n\nexport function observe(el: Element) {\n on(el, 'click', handleBackdropClick as EventListener, QUICK_EVENT);\n}\n\nexport function unobserve(el: Element) {\n off(el, 'click', handleBackdropClick as EventListener, QUICK_EVENT);\n}"],"names":["handleBackdropClick","x","y","target","attr","top","right","bottom","left","observe","el","on","QUICK_EVENT","unobserve","off"],"mappings":";AAEA,MAAMA,IAAsB,CAAC,EAAE,SAASC,GAAG,SAASC,GAAG,QAAAC,QAAyB;AAC9E,MAAIA,aAAkB,qBAAqBC,EAAKD,GAAQ,eAAe,MAAM,OAAO;AAClF,UAAM,EAAE,KAAAE,GAAK,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,EAAK,IAAIL,EAAO,sBAAsB;AAG9D,IAFaE,KAAOH,KAAKA,KAAKK,KAAUC,KAAQP,KAAKA,KAAKK,KAE/CH,EAAO,MAAM;AAAA,EAAA;AAEhC;AAEO,SAASM,EAAQC,GAAa;AAChC,EAAAC,EAAAD,GAAI,SAASV,GAAsCY,CAAW;AACnE;AAEO,SAASC,EAAUH,GAAa;AACjC,EAAAI,EAAAJ,GAAI,SAASV,GAAsCY,CAAW;AACpE;"}
@@ -6,3 +6,4 @@ export default meta;
6
6
  type Story = StoryObj<typeof meta>;
7
7
  export declare const Default: Story;
8
8
  export declare const WithClose: Story;
9
+ export declare const WithBackdropClose: Story;
@@ -0,0 +1,11 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ parameters: {
5
+ layout: string;
6
+ };
7
+ };
8
+ export default meta;
9
+ type Story = StoryObj<typeof meta>;
10
+ export declare const Default: Story;
11
+ export declare const Gap: Story;
@@ -5,3 +5,4 @@ declare const meta: {
5
5
  export default meta;
6
6
  type Story = StoryObj<typeof meta>;
7
7
  export declare const Default: Story;
8
+ export declare const WithForm: Story;
@@ -1,5 +1,5 @@
1
1
  import f from "../styles.module.css.js";
2
- import { onMutation as c, on as I, QUICK_EVENT as u, off as g, isInputLike as d, attr as r, useId as l } from "../utils.js";
2
+ import { onMutation as c, on as I, QUICK_EVENT as u, isInputLike as d, attr as r, off as g, useId as l } from "../utils.js";
3
3
  const m = f.field.split(" ")[0], b = f.validation.split(" "), L = b[0];
4
4
  function h(t) {
5
5
  for (const i of t) {
package/mtds/index.d.ts CHANGED
@@ -9,6 +9,8 @@ button: string;
9
9
  card: string;
10
10
  chip: string;
11
11
  details: string;
12
+ dialog: string;
13
+ divider: string;
12
14
  errorsummary: string;
13
15
  field: string;
14
16
  affixes: string;
@@ -20,14 +22,15 @@ grid: string;
20
22
  flex: string;
21
23
  link: string;
22
24
  logo: string;
23
- modal: string;
24
25
  pagination: string;
25
26
  popover: string;
26
27
  skeleton: string;
28
+ spinner: string;
27
29
  table: string;
28
30
  scrollShadow: string;
29
31
  tabs: string;
30
32
  tag: string;
33
+ togglegroup: string;
31
34
  validation: string;
32
35
  body: string;
33
36
  };
@@ -1,2 +1,2 @@
1
- var mtds=function(u){"use strict";const $="_alert_ipkht_1 _ds-alert_1w6ss_1",O="_avatar_ipkht_1 _ds-avatar_1w6ss_1",C="_badge_ipkht_1",x="_breadcrumbs_ipkht_1 _ds-breadcrumbs_1w6ss_1",B="_button_ipkht_1 _ds-button_1w6ss_1",P="_card_ipkht_1",D="_chip_ipkht_1 _ds-chip_1w6ss_1",H="_details_ipkht_1 _ds-details_1w6ss_1",N="_errorsummary_ipkht_1 _ds-error-summary_1w6ss_1",V="_field_ipkht_1 _ds-field_1w6ss_1",W="_affixes_ipkht_1 _ds-field-affixes_1w6ss_1",Y="_count_ipkht_1",F="_fieldset_ipkht_1 _ds-fieldset_1w6ss_1",R="_heading_ipkht_1 _ds-heading_1w6ss_1",U="_input_ipkht_1 _ds-input_1w6ss_1",j="_grid_ipkht_1",q="_flex_ipkht_1",z="_link_ipkht_1",X="_logo_ipkht_1 _ds-focus_1w6ss_1",G="_modal_ipkht_1 _ds-modal_1w6ss_1",K="_pagination_ipkht_1 _ds-pagination_1w6ss_1",Q="_popover_ipkht_1",J="_skeleton_ipkht_1 _ds-skeleton_1w6ss_1",Z="_table_ipkht_1 _ds-table_1w6ss_1",tt="_scrollShadow_ipkht_1",ot="_tabs_ipkht_1 _ds-tabs_1w6ss_1",et="_tag_ipkht_1 _ds-tag_1w6ss_1",nt="_tooltip_ipkht_1",st="_validation_ipkht_1 _ds-validation-message_1w6ss_1",it="_body_ipkht_115",_={alert:$,avatar:O,badge:C,breadcrumbs:x,button:B,card:P,chip:D,details:H,errorsummary:N,field:V,affixes:W,count:Y,fieldset:F,heading:R,input:U,grid:j,flex:q,link:z,logo:X,modal:G,pagination:K,popover:Q,skeleton:J,table:Z,scrollShadow:tt,tabs:ot,tag:et,tooltip:nt,validation:st,body:it},kt=Object.freeze(Object.defineProperty({__proto__:null,affixes:W,alert:$,avatar:O,badge:C,body:it,breadcrumbs:x,button:B,card:P,chip:D,count:Y,default:_,details:H,errorsummary:N,field:V,fieldset:F,flex:q,grid:j,heading:R,input:U,link:z,logo:X,modal:G,pagination:K,popover:Q,scrollShadow:tt,skeleton:J,table:Z,tabs:ot,tag:et,tooltip:nt,validation:st},Symbol.toStringTag,{value:"Module"})),y=typeof window<"u"&&typeof document<"u",f={capture:!0,passive:!0};function a(t,o,e){return e===void 0?t.getAttribute(o)??null:(e===null?t.removeAttribute(o):t.getAttribute(o)!==e&&t.setAttribute(o,e),null)}let St=0;const Mt=`${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`;function T(t){return t.id||(t.id=`${Mt}${++St}`),t.id}const ct=(t,o,e)=>{for(const s of e[0].split(","))e[0]=s,o[`${t}EventListener`](...e)},p=(t,...o)=>ct("add",t,o),A=(t,...o)=>ct("remove",t,o),k=new Map,d=y?document.createElement("div"):null;d&&a(d,"style","position:absolute;padding:1px;top:0;left:0px"),y&&p(window,"load,resize,scroll",()=>{for(const[t,o]of k)o()},f);const b={top:0,right:1,bottom:2,left:3};function g(t,o,e){var Tt;if(!o||!o.isConnected||!t.isConnected)return k.delete(t);if(d!=null&&d.isConnected||document.body.append(d||""),!k.has(t)){const so=b[e]??b.bottom;return(Tt=k.set(t,()=>g(t,o,so)).get(t))==null?void 0:Tt()}const{offsetWidth:s,offsetHeight:n}=t,{offsetWidth:c,offsetHeight:i}=o,{width:v,height:E,left:Xt,top:Gt}=o.getBoundingClientRect(),w=Math.round(Xt-(c-v)/2),m=Math.round(Gt-(i-E)/2),Kt=w-s>0,Qt=c+c+s<window.innerWidth,Jt=m-n>0,Zt=m+i+n<window.innerHeight,to=e===b.bottom&&Qt||!Kt,oo=e===b.bottom&&Zt||!Jt,eo=Math.min(Math.max(10,w-(s-c)/2),window.innerWidth-s-10),no=Math.min(Math.max(10,m-(n-i)/2),window.innerHeight-n-10),yt=e===b.top||e===b.bottom;t.style.left=`${Math.round(yt?eo:to?w+c:w-s)}px`,t.style.top=`${Math.round(yt?oo?m+i:m-n:no)}px`,d==null||d.style.setProperty("translate",`${Math.round(window.scrollX+w+c+s+30)} ${Math.round(window.scrollY+m+i+n+30)}px`)}function Lt(t){let o=0;const e=()=>setTimeout(s,200),s=()=>{t([],n),o=0},n=new MutationObserver(()=>{o||(o=requestAnimationFrame(e))});return n}const S=new WeakMap,At=t=>{var e;const o=S.get(t);if(!o||!t.isConnected)(e=o==null?void 0:o.observer)==null||e.disconnect(),S.delete(t);else for(const[,s]of o.collections)s()},h=(t,o,e)=>{const s=t.getElementsByClassName(o);let n=S.get(t);n||(n={collections:new Map,observer:Lt(()=>At(t))},n.observer.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),S.set(t,n)),e?n.collections.set(o,()=>e(s)):n.collections.delete(o)},I=t=>t instanceof HTMLElement&&"validity"in t&&!(t instanceof HTMLButtonElement),at=_.field.split(" ")[0],lt=_.validation.split(" "),It=lt[0];function Et(t){for(const o of t){const e=[],s=[];let n=null,c=!0;for(const i of o.getElementsByTagName("*"))i instanceof HTMLLabelElement?e.push(i):I(i)?n=i:i.classList.contains(It)?(c=i.getAttribute("data-color")==="success",s.unshift(T(i))):i instanceof HTMLParagraphElement&&s.push(T(i));if(n){for(const i of e)i.htmlFor=T(n);rt(n),a(n,"aria-describedby",s.join(" ")),a(n,"aria-invalid",`${!c}`)}}}function dt({target:t}){I(t)&&rt(t)}function rt(t){const o=t==null?void 0:t.nextElementSibling,e=o==null?void 0:o.getAttribute("data-count");if(o&&e){const s=Number(e)-t.value.length,n=s<0;if(o.getAttribute("aria-live")==="polite"!==n){a(o,"aria-live",n?"polite":"off");for(const i of lt)o.classList.toggle(i,n)}o.textContent=`${Math.abs(s)} tegn ${n?"for mye":"igjen"}`}}function $t(t){h(t,at,Et),p(t,"input",dt,f)}function Ot(t){h(t,at,!1),A(t,"input",dt,f)}const _t=_.fieldset.split(" ")[0],Ct=_.validation.split(" ")[0];function xt(t){for(const o of t){const e=[];let s="";for(const n of o.getElementsByTagName("*"))n.classList.contains(Ct)?s=T(n):I(n)&&e.push(n);if(s)for(const n of e)a(n,"aria-describedby",s),a(n,"aria-invalid","true")}}const Bt=t=>h(t,_t,xt),Pt=t=>h(t,_t,!1);function Dt(t){p(t,"toggle",ut,f),p(t,"click",pt)}function Ht(t){A(t,"toggle",ut,f),A(t,"click",pt)}const ft=_.popover.split(" ")[0];function ut({target:t,newState:o}){var e;if(t instanceof HTMLElement&&t.classList.contains(ft)){const s=(e=t.getRootNode())==null?void 0:e.querySelector(`[popovertarget="${t.id}"]`);o==="closed"?g(t,!1):s&&g(t,s,t.getAttribute("data-position")||"bottom")}}function pt({target:t}){var e,s;const o=(e=t==null?void 0:t.closest)==null?void 0:e.call(t,"a");if(o){const n=o.getRootNode(),c=((s=n.getElementById)==null?void 0:s.call(n,a(o,"popovertarget")||""))||o.closest(`.${ft}`),i=a(o,"popovertargetaction")||"toggle";c==null||c.togglePopover(i==="show"||(i==="hide"?!1:void 0))}}const bt=_.table.split(" ")[0];function Nt(t){var o,e;for(const s of t)if(s instanceof HTMLTableElement){const n=Array.from(((e=(o=s.tHead)==null?void 0:o.rows[0])==null?void 0:e.cells)||[],c=>{var i;return(i=c.innerText)==null?void 0:i.trim()});for(const c of s.tBodies)for(const i of c.rows)for(const v of i.cells)a(v,"data-th",n[v.cellIndex]||":empty")}}const Vt=t=>h(t,bt,Nt),Wt=t=>h(t,bt,!1),Yt={tooltip:"_tooltip_1pse6_5"},ht="aria-describedby",M="aria-labelledby",Ft="--mtds-tooltip-position",Rt=100,L="mtds-tooltip";let r=null,mt=Number.NEGATIVE_INFINITY,gt=0,l=null;function vt({target:t}){const o=mt+Rt-Date.now();clearTimeout(gt),gt=setTimeout(Ut,Math.max(o,0),t)}function Ut(t){var c;if(mt=Date.now(),!l||t===l)return;let o=((c=t==null?void 0:t.closest)==null?void 0:c.call(t,"[data-tooltip]"))||null;if(o===r)return;const e=(o==null?void 0:o.getAttribute("data-tooltip"))||"",s=(o==null?void 0:o.getAttribute("data-tooltip-position"))||window.getComputedStyle(o||document.body).getPropertyValue(Ft)||"top",n=!!(o!=null&&o.innerText.trim())||(o==null?void 0:o.hasAttribute(M))||(o==null?void 0:o.hasAttribute("aria-label"));(!e||e==="false"||e==="true"||s==="none")&&(o=null),o&&(l.textContent=e),r==null||r.removeAttribute(r.getAttribute(M)===L?M:ht),g(l,!1),r=o,r==null||r.setAttribute(n?ht:M,L),l.togglePopover(!!o),g(l,o,s)}y&&!document.getElementById(L)&&(l=document.body.appendChild(document.createElement("div")),l.classList.add(...Yt.tooltip.split(" ")),l.id=L,a(l,"popover","manual"),p(document,"blur,focus,mouseout,mouseover",vt,f),p(window,"blur",vt,f));const jt=(t,o,e)=>{const s=(e-1)/2,n=Math.max(Math.min(t-Math.floor(s),o-e+1),1),c=Math.min(Math.max(t+Math.ceil(s),e),o),i=Array.from({length:c+1-n},(v,E)=>E+n);return e>4&&n>1&&i.splice(0,2,1,0),e>3&&c<o&&i.splice(-2,2,0,o),i},qt=({current:t=1,total:o=10,show:e=7})=>({prev:t>1?t-1:0,next:t<o?t+1:0,pages:jt(t,o,e).map((s,n)=>({current:s===t&&"page",key:`key-${s}-${n}`,page:s}))});if(y){const t=document.readyState==="loading",o=()=>wt(document.body);t?document.addEventListener("DOMContentLoaded",o):o()}function wt(t){$t(t),Bt(t),Dt(t),Vt(t)}function zt(t){Ot(t),Pt(t),Ht(t),Wt(t)}return u.observe=wt,u.pagination=qt,u.styles=kt,u.unobserve=zt,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),u}({});
1
+ var mtds=function(b){"use strict";const T=typeof window<"u"&&typeof document<"u",l={capture:!0,passive:!0};function a(t,o,e){return e===void 0?t.getAttribute(o)??null:(e===null?t.removeAttribute(o):t.getAttribute(o)!==e&&t.setAttribute(o,e),null)}let $t=0;const kt=`${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`;function S(t){return t.id||(t.id=`${kt}${++$t}`),t.id}const C=(t,o,e)=>{for(const s of e[0].split(","))e[0]=s,o[`${t}EventListener`](...e)},r=(t,...o)=>C("add",t,o),v=(t,...o)=>C("remove",t,o),M=new Map,_=T?document.createElement("div"):null;_&&a(_,"style","position:absolute;padding:1px;top:0;left:0px"),T&&r(window,"load,resize,scroll",()=>{for(const[t,o]of M)o()},l);const p={top:0,right:1,bottom:2,left:3};function h(t,o,e){var At;if(!o||!o.isConnected||!t.isConnected)return M.delete(t);if(_!=null&&_.isConnected||document.body.append(_||""),!M.has(t)){const po=p[e]??p.bottom;return(At=M.set(t,()=>h(t,o,po)).get(t))==null?void 0:At()}const{offsetWidth:s,offsetHeight:n}=t,{offsetWidth:c,offsetHeight:i}=o,{width:w,height:k,left:so,top:io}=o.getBoundingClientRect(),y=Math.round(so-(c-w)/2),m=Math.round(io-(i-k)/2),co=y-s>0,lo=c+c+s<window.innerWidth,ao=m-n>0,ro=m+i+n<window.innerHeight,_o=e===p.bottom&&lo||!co,fo=e===p.bottom&&ro||!ao,uo=Math.min(Math.max(10,y-(s-c)/2),window.innerWidth-s-10),bo=Math.min(Math.max(10,m-(n-i)/2),window.innerHeight-n-10),It=e===p.top||e===p.bottom;t.style.left=`${Math.round(It?uo:_o?y+c:y-s)}px`,t.style.top=`${Math.round(It?fo?m+i:m-n:bo)}px`,_==null||_.style.setProperty("translate",`${Math.round(window.scrollX+y+c+s+30)} ${Math.round(window.scrollY+m+i+n+30)}px`)}function Ct(t){let o=0;const e=()=>setTimeout(s,200),s=()=>{t([],n),o=0},n=new MutationObserver(()=>{o||(o=requestAnimationFrame(e))});return n}const L=new WeakMap,Ot=t=>{var e;const o=L.get(t);if(!o||!t.isConnected)(e=o==null?void 0:o.observer)==null||e.disconnect(),L.delete(t);else for(const[,s]of o.collections)s()},g=(t,o,e)=>{const s=t.getElementsByClassName(o);let n=L.get(t);n||(n={collections:new Map,observer:Ct(()=>Ot(t))},n.observer.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),L.set(t,n)),e?n.collections.set(o,()=>e(s)):n.collections.delete(o)},A=t=>t instanceof HTMLElement&&"validity"in t&&!(t instanceof HTMLButtonElement),O=({clientX:t,clientY:o,target:e})=>{if(e instanceof HTMLDialogElement&&a(e,"data-closedby")==="any"){const{top:s,right:n,bottom:c,left:i}=e.getBoundingClientRect();s<=o&&o<=c&&i<=t&&t<=n||e.close()}};function Bt(t){r(t,"click",O,l)}function xt(t){v(t,"click",O,l)}const B="_alert_wob7g_1 _ds-alert_1w6ss_1",x="_avatar_wob7g_1 _ds-avatar_1w6ss_1",D="_badge_wob7g_1",P="_breadcrumbs_wob7g_1 _ds-breadcrumbs_1w6ss_1",H="_button_wob7g_1 _ds-button_1w6ss_1",N="_card_wob7g_1",Y="_chip_wob7g_1 _ds-chip_1w6ss_1",R="_details_wob7g_1 _ds-details_1w6ss_1",V="_dialog_wob7g_1 _ds-modal_1w6ss_1",W="_divider_wob7g_1",F="_errorsummary_wob7g_1 _ds-error-summary_1w6ss_1",U="_field_wob7g_1 _ds-field_1w6ss_1",j="_affixes_wob7g_1 _ds-field-affixes_1w6ss_1",X="_count_wob7g_1",q="_fieldset_wob7g_1 _ds-fieldset_1w6ss_1",z="_heading_wob7g_1 _ds-heading_1w6ss_1",G="_input_wob7g_1 _ds-input_1w6ss_1",K="_grid_wob7g_1",Q="_flex_wob7g_1",J="_link_wob7g_1",Z="_logo_wob7g_1 _ds-focus_1w6ss_1",tt="_pagination_wob7g_1 _ds-pagination_1w6ss_1",ot="_popover_wob7g_1",et="_skeleton_wob7g_1 _ds-skeleton_1w6ss_1",nt="_spinner_wob7g_1",st="_table_wob7g_1 _ds-table_1w6ss_1",it="_scrollShadow_wob7g_1",ct="_tabs_wob7g_1 _ds-tabs_1w6ss_1",lt="_tag_wob7g_1 _ds-tag_1w6ss_1",at="_togglegroup_wob7g_1",dt="_tooltip_wob7g_1",rt="_validation_wob7g_1 _ds-validation-message_1w6ss_1",_t="_body_wob7g_120",u={alert:B,avatar:x,badge:D,breadcrumbs:P,button:H,card:N,chip:Y,details:R,dialog:V,divider:W,errorsummary:F,field:U,affixes:j,count:X,fieldset:q,heading:z,input:G,grid:K,flex:Q,link:J,logo:Z,pagination:tt,popover:ot,skeleton:et,spinner:nt,table:st,scrollShadow:it,tabs:ct,tag:lt,togglegroup:at,tooltip:dt,validation:rt,body:_t},Dt=Object.freeze(Object.defineProperty({__proto__:null,affixes:j,alert:B,avatar:x,badge:D,body:_t,breadcrumbs:P,button:H,card:N,chip:Y,count:X,default:u,details:R,dialog:V,divider:W,errorsummary:F,field:U,fieldset:q,flex:Q,grid:K,heading:z,input:G,link:J,logo:Z,pagination:tt,popover:ot,scrollShadow:it,skeleton:et,spinner:nt,table:st,tabs:ct,tag:lt,togglegroup:at,tooltip:dt,validation:rt},Symbol.toStringTag,{value:"Module"})),ft=u.field.split(" ")[0],ut=u.validation.split(" "),Pt=ut[0];function Ht(t){for(const o of t){const e=[],s=[];let n=null,c=!0;for(const i of o.getElementsByTagName("*"))i instanceof HTMLLabelElement?e.push(i):A(i)?n=i:i.classList.contains(Pt)?(c=i.getAttribute("data-color")==="success",s.unshift(S(i))):i instanceof HTMLParagraphElement&&s.push(S(i));if(n){for(const i of e)i.htmlFor=S(n);pt(n),a(n,"aria-describedby",s.join(" ")),a(n,"aria-invalid",`${!c}`)}}}function bt({target:t}){A(t)&&pt(t)}function pt(t){const o=t==null?void 0:t.nextElementSibling,e=o==null?void 0:o.getAttribute("data-count");if(o&&e){const s=Number(e)-t.value.length,n=s<0;if(o.getAttribute("aria-live")==="polite"!==n){a(o,"aria-live",n?"polite":"off");for(const i of ut)o.classList.toggle(i,n)}o.textContent=`${Math.abs(s)} tegn ${n?"for mye":"igjen"}`}}function Nt(t){g(t,ft,Ht),r(t,"input",bt,l)}function Yt(t){g(t,ft,!1),v(t,"input",bt,l)}const gt=u.fieldset.split(" ")[0],Rt=u.validation.split(" ")[0];function Vt(t){for(const o of t){const e=[];let s="";for(const n of o.getElementsByTagName("*"))n.classList.contains(Rt)?s=S(n):A(n)&&e.push(n);if(s)for(const n of e)a(n,"aria-describedby",s),a(n,"aria-invalid","true")}}const Wt=t=>g(t,gt,Vt),Ft=t=>g(t,gt,!1),wt=({target:t})=>{};function Ut(t){r(t,"click",wt,l)}function jt(t){v(t,"click",wt,l)}function Xt(t){r(t,"toggle",vt,l),r(t,"click",ht)}function qt(t){v(t,"toggle",vt,l),v(t,"click",ht)}const mt=u.popover.split(" ")[0];function vt({target:t,newState:o}){var e;if(t instanceof HTMLElement&&t.classList.contains(mt)){const s=(e=t.getRootNode())==null?void 0:e.querySelector(`[popovertarget="${t.id}"]`);o==="closed"?h(t,!1):s&&h(t,s,t.getAttribute("data-position")||"bottom")}}function ht({target:t}){var e,s;const o=(e=t==null?void 0:t.closest)==null?void 0:e.call(t,"a");if(o){const n=o.getRootNode(),c=((s=n.getElementById)==null?void 0:s.call(n,a(o,"popovertarget")||""))||o.closest(`.${mt}`),i=a(o,"popovertargetaction")||"toggle";c==null||c.togglePopover(i==="show"||(i==="hide"?!1:void 0))}}const yt=u.table.split(" ")[0];function zt(t){var o,e;for(const s of t)if(s instanceof HTMLTableElement){const n=Array.from(((e=(o=s.tHead)==null?void 0:o.rows[0])==null?void 0:e.cells)||[],c=>{var i;return(i=c.innerText)==null?void 0:i.trim()});for(const c of s.tBodies)for(const i of c.rows)for(const w of i.cells)a(w,"data-th",n[w.cellIndex]||":empty")}}const Gt=t=>g(t,yt,zt),Kt=t=>g(t,yt,!1),Qt={tooltip:"_tooltip_1pse6_5"},Tt="aria-describedby",E="aria-labelledby",Jt="--mtds-tooltip-position",Zt=100,I="mtds-tooltip",St="Escape";let f=null,Mt=Number.NEGATIVE_INFINITY,Lt=0,d=null;function $({target:t,type:o,key:e}){if(o==="keydown"&&e!==St)return;const s=Mt+Zt-Date.now();clearTimeout(Lt),Lt=setTimeout(to,Math.max(s,0),e===St?null:t)}function to(t){var c;if(Mt=Date.now(),!d||t===d)return;let o=((c=t==null?void 0:t.closest)==null?void 0:c.call(t,"[data-tooltip]"))||null;if(o===f)return;const e=(o==null?void 0:o.getAttribute("data-tooltip"))||"",s=(o==null?void 0:o.getAttribute("data-tooltip-position"))||window.getComputedStyle(o||document.body).getPropertyValue(Jt)||"top",n=!!(o!=null&&o.innerText.trim())||(o==null?void 0:o.hasAttribute(E))||(o==null?void 0:o.hasAttribute("aria-label"));(!e||e==="false"||e==="true"||s==="none")&&(o=null),o&&(d.textContent=e),f==null||f.removeAttribute(f.getAttribute(E)===I?E:Tt),h(d,!1),f=o,f==null||f.setAttribute(n?Tt:E,I),d.togglePopover(!!o),h(d,o,s)}T&&!document.getElementById(I)&&(d=document.body.appendChild(document.createElement("div")),d.classList.add(...Qt.tooltip.split(" ")),d.id=I,a(d,"popover","manual"),r(document,"blur,focus,mouseout,mouseover",$,l),r(window,"keydown",$,l),r(window,"blur",$,l));const oo=(t,o,e)=>{const s=(e-1)/2,n=Math.max(Math.min(t-Math.floor(s),o-e+1),1),c=Math.min(Math.max(t+Math.ceil(s),e),o),i=Array.from({length:c+1-n},(w,k)=>k+n);return e>4&&n>1&&i.splice(0,2,1,0),e>3&&c<o&&i.splice(-2,2,0,o),i},eo=({current:t=1,total:o=10,show:e=7})=>({prev:t>1?t-1:0,next:t<o?t+1:0,pages:oo(t,o,e).map((s,n)=>({current:s===t&&"page",key:`key-${s}-${n}`,page:s}))});if(T){const t=document.readyState==="loading",o=()=>Et(document.body);t?document.addEventListener("DOMContentLoaded",o):o()}function Et(t){Bt(t),Nt(t),Wt(t),Ut(t),Xt(t),Gt(t)}function no(t){xt(t),Yt(t),Ft(t),jt(t),qt(t),Kt(t)}return b.observe=Et,b.pagination=eo,b.styles=Dt,b.unobserve=no,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}),b}({});
2
2
  //# sourceMappingURL=index.iife.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.iife.js","sources":["../designsystem/utils.ts","../designsystem/field/field.ts","../designsystem/fieldset/fieldset.ts","../designsystem/popover/popover.ts","../designsystem/table/table.ts","../designsystem/tooltip/tooltip.ts","../designsystem/pagination/pagination.ts","../designsystem/index.ts"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';\nexport const QUICK_EVENT = { capture: true, passive: true };\n\n/**\n * attr\n * @description Utility to quickly get, set and remove attributes\n * @param el The Element to use as EventTarget\n * @param name The attribute name to get, set or remove, or a object to set multiple attributes\n * @param value A valid attribute value or null to remove attribute\n */\nexport function attr(\n\tel: Element,\n\tname: string,\n\tvalue?: string | null,\n): string | null {\n\tif (value === undefined) return el.getAttribute(name) ?? null; // Fallback to null only if el is undefined\n\tif (value === null) el.removeAttribute(name);\n\telse if (el.getAttribute(name) !== value) el.setAttribute(name, value);\n\treturn null;\n}\n\n/**\n * useId\n * @return A generated unique ID\n */\nlet id = 0;\nconst UUID = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;\nexport function useId (el: Element) {\n if (!el.id) el.id = `${UUID}${++id}`;\n\treturn el.id;\n};\n\n// Internal helper for on / off\nconst events = (\n\taction: \"add\" | \"remove\",\n\telement: Node | Window,\n\trest: Parameters<typeof Element.prototype.addEventListener>,\n): void => {\n\tfor (const type of rest[0].split(\",\")) {\n\t\trest[0] = type;\n\t\telement[`${action}EventListener`](...rest);\n\t}\n};\n\n/**\n * on\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.addEventListener>\n): void => events(\"add\", element, rest);\n\n/**\n * off\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => events(\"remove\", element, rest);\n\n\nconst TARGETS = new Map<Element, () => void>(); // Store current open poppers and their update functions\nconst SCROLLER = IS_BROWSER ? document.createElement('div') : null // Used to ensure we have scrollability under\nif (SCROLLER) attr(SCROLLER, 'style', 'position:absolute;padding:1px;top:0;left:0px');\n\nif (IS_BROWSER){\n\ton(window, 'load,resize,scroll', () => {\n\t\tfor (const [_, update] of TARGETS) update();\n\t}, QUICK_EVENT);}\n\t\n/**\n * anchorPosition\n * @param target The Element to position\n * @param anchor The Element to use as anchor\n */\nconst POSITION = { top: 0, right: 1, bottom: 2, left: 3 }; // Speed up by using a const map\n\nexport function anchorPosition (target: HTMLElement, anchor: HTMLElement | null | false, position?: string | number) {\n\tif (!anchor || !anchor.isConnected || !target.isConnected) return TARGETS.delete(target); // Stop watchning if anchor is removed from DOM\n\tif (!SCROLLER?.isConnected) document.body.append(SCROLLER || ''); // Ensure we have t´he scroller\n\tif (!TARGETS.has(target)) { // Setup new target or update position\n\t\tconst place = POSITION[position as keyof typeof POSITION] ?? POSITION.bottom; // Use CSS property to store position for more flexibility\n\t\treturn TARGETS.set(target, () => anchorPosition(target, anchor, place)).get(target)?.(); // Start watching if not already watching\n\t}\n\n const { offsetWidth: targetW, offsetHeight: targetH } = target;\n const { offsetWidth: anchorW, offsetHeight: anchorH } = anchor;\n const { width, height, left, top } = anchor.getBoundingClientRect();\n\tconst anchorX = Math.round(left - (anchorW - width) / 2); // Correct for CSS transform scale\n const anchorY = Math.round(top - (anchorH - height) / 2); // Correct for CSS transform scale\n\n\tconst hasSpaceLeft = anchorX - targetW > 0\n\tconst hasSpaceRight = anchorW + anchorW + targetW < window.innerWidth;\n\tconst hasSpaceOver = anchorY - targetH > 0\n\tconst hasSpaceUnder = anchorY + anchorH + targetH < window.innerHeight;\n\tconst positionRight = (position === POSITION.bottom && hasSpaceRight) || !hasSpaceLeft // Always position right when no hasSpaceLeft, as no OS scrolls further up than 0\n\tconst positionUnder = (position === POSITION.bottom && hasSpaceUnder) || !hasSpaceOver // Always position under when no hasSpaceOver, as no OS scrolls further up than 0\n\tconst centerX = Math.min(Math.max(10, anchorX - (targetW - anchorW) / 2), window.innerWidth - targetW - 10);\n\tconst centerY = Math.min(Math.max(10, anchorY - (targetH - anchorH) / 2), window.innerHeight - targetH - 10);\n\tconst isVertical = position === POSITION.top || position === POSITION.bottom;\n\n\ttarget.style.left = `${Math.round(isVertical ? centerX : (positionRight ? anchorX + anchorW : anchorX - targetW))}px`\n target.style.top = `${Math.round(isVertical ? (positionUnder ? anchorY + anchorH : anchorY - targetH) : centerY)}px`\n SCROLLER?.style.setProperty('translate', `${Math.round(window.scrollX + anchorX + anchorW + targetW + 30)} ${Math.round(window.scrollY + anchorY + anchorH + targetH + 30)}px`);\n}\n\n/**\n * Speed up MutationObserver by debouncing and only running when page is visible\n * @return new MutaionObserver\n */\nexport function createOptimizedMutationObserver(callback: MutationCallback) {\n let queue = 0;\n\n\tconst onFrame = () => setTimeout(onTimer, 200); // Use both requestAnimationFrame and setTimeout to debounce and only run when visible\n\tconst onTimer = () => {\n\t\tcallback([], observer);\n\t\tqueue = 0;\n\t};\n const observer = new MutationObserver(() => {\n if (!queue) queue = requestAnimationFrame(onFrame);\n });\n\n return observer;\n}\n\ntype Mutator = { observer: MutationObserver, collections: Map<string, () => void> };\nconst MUTATORS = new WeakMap<Element, Mutator>();\nconst MUTATORS_CALLBACK = (element: Element) => {\n\tconst mutator = MUTATORS.get(element);\n\n\tif (!mutator || !element.isConnected) {\n\t\tmutator?.observer?.disconnect();\n\t\tMUTATORS.delete(element);\n\t} else for(const [, callback] of mutator.collections) callback();\n};\n\n/**\n * onMutation\n * @description Utility to quickly observe mutations on a specific class name\n * @param element The Element to use as EventTarget\n * @param className The class name to observe\n * @param callback The callback to run when mutations are detected or false to stop observing\n */\nexport const onMutation = (\n\telement: Element,\n\tclassName: string,\n\tcallback: ((collection: HTMLCollection) => void) | false\n) => {\n\tconst collection = element.getElementsByClassName(className);\n\tlet mutator = MUTATORS.get(element);\n\n\tif (!mutator) {\n\t\tmutator = { collections: new Map(), observer: createOptimizedMutationObserver(() => MUTATORS_CALLBACK(element)) };\n\t\tmutator.observer.observe(element, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] });\n\t\tMUTATORS.set(element, mutator);\n\t}\n\tif (callback) mutator.collections.set(className, () => callback(collection));\n\telse mutator.collections.delete(className);\n}\n\nexport const isInputLike = (el: unknown): el is HTMLInputElement =>\n\tel instanceof HTMLElement && 'validity' in el && !(el instanceof HTMLButtonElement);\n\n// Make React support popover=\"\"target attribute\n// https://github.com/facebook/react/issues/27479\ntype Popover = \"\" | \"auto\" | \"manual\" | undefined;\ndeclare global {\n\tnamespace React.JSX {\n\t\tinterface IntrinsicAttributes {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: Popover;\n\t\t}\n\t}\n\tnamespace React {\n\t\tinterface HTMLAttributes<T> {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: Popover;\n\t\t}\n\t}\n}","import styles from '../styles.module.css';\nimport { QUICK_EVENT, attr, isInputLike, off, on, onMutation, useId } from '../utils';\n\nconst CSS_FIELD = styles.field.split(' ')[0];\nconst CSS_VALIDATIONS = styles.validation.split(' ');\nconst CSS_VALIDATION = CSS_VALIDATIONS[0];\n\nfunction renderAria(fields: HTMLCollectionOf<Element>) {\n for(const field of fields) {\n const labels: HTMLLabelElement[] = [];\n const descs: string[] = [];\n let input: HTMLInputElement | null = null;\n let valid = true;\n\n for (const el of field.getElementsByTagName('*')) {\n if (el instanceof HTMLLabelElement) labels.push(el);\n else if (isInputLike(el)) input = el;\n else if (el.classList.contains(CSS_VALIDATION)) { // Must be before instanceof HTMLParagraphElement since validation can also be a <p>\n valid = el.getAttribute('data-color') === 'success';\n descs.unshift(useId(el));\n } else if (el instanceof HTMLParagraphElement) descs.push(useId(el));\n }\n\n if (input) {\n for (const label of labels) label.htmlFor = useId(input);\n renderCounter(input);\n attr(input, 'aria-describedby', descs.join(' '));\n attr(input, 'aria-invalid', `${!valid}`);\n }\n }\n}\nfunction handleInput({ target }: Event) {\n if (isInputLike(target)) renderCounter(target);\n}\n\nfunction renderCounter(input: HTMLInputElement) {\n const el = input?.nextElementSibling;\n const limit = el?.getAttribute('data-count');\n\n if (el && limit) {\n const remainder = Number(limit) - input.value.length;\n const nextInvalid = remainder < 0;\n const prevInvalid = el.getAttribute('aria-live') === 'polite';\n\n if (prevInvalid !== nextInvalid) {\n attr(el, 'aria-live', nextInvalid ? 'polite' : 'off');\n for (const css of CSS_VALIDATIONS) el.classList.toggle(css, nextInvalid);\n }\n el.textContent = `${Math.abs(remainder)} tegn ${nextInvalid ? 'for mye' : 'igjen'}`;\n }\n}\n\nexport function observe (el: Element) {\n onMutation(el, CSS_FIELD, renderAria);\n on(el, 'input', handleInput, QUICK_EVENT);\n}\n\nexport function unobserve (el: Element) {\n onMutation(el, CSS_FIELD, false);\n off(el, 'input', handleInput, QUICK_EVENT);\n}\n","import styles from '../styles.module.css';\nimport { attr, isInputLike, onMutation, useId } from '../utils';\nconst CSS_FIELDSET = styles.fieldset.split(' ')[0];\nconst CSS_VALIDATION = styles.validation.split(' ')[0];\n\nfunction process(fieldsets: HTMLCollectionOf<Element>) {\n for(const fieldset of fieldsets) {\n const inputs: HTMLInputElement[] = [];\n let validationId = '';\n\n for (const el of fieldset.getElementsByTagName('*')) {\n if (el.classList.contains(CSS_VALIDATION)) validationId = useId(el);\n else if (isInputLike(el)) inputs.push(el);\n }\n\n if (validationId) \n for(const input of inputs) {\n attr(input, 'aria-describedby', validationId);\n attr(input, 'aria-invalid', 'true');\n }\n }\n}\n\nexport const observe = (el: Element) => onMutation(el, CSS_FIELDSET, process);\nexport const unobserve = (el: Element) => onMutation(el, CSS_FIELDSET, false);\n","import styles from '../styles.module.css';\nimport { QUICK_EVENT, anchorPosition, attr, off, on } from '../utils';\n\nexport function observe(el: Node) {\n on(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n on(el, 'click', handleLinkClick); // Allow `<a>` to use `popovertarget` as well\n}\nexport function unobserve(el: Node) {\n off(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n off(el, 'click', handleLinkClick);\n}\n\nconst CSS_POPOVER = styles.popover.split(' ')[0];\n\nfunction handleToggle ({ target: el, newState }: Event & { newState?: string }){\n if (el instanceof HTMLElement && el.classList.contains(CSS_POPOVER)) {\n const anchor = (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(`[popovertarget=\"${el.id}\"]`);\n \n if (newState === 'closed') anchorPosition(el, false);\n else if (anchor) anchorPosition(el, anchor, el.getAttribute('data-position') || 'bottom');\n }\n}\n\n// Polyfill popovertarget for <a> (not supported by native)\n// and automatically assume popovertarget is the closest parent popover\n// but respect the popovertarget and popovertargetaction attribute\nfunction handleLinkClick ({ target }: Event){\n const link = (target as Element )?.closest?.('a');\n if (link) {\n const root = link.getRootNode() as ShadowRoot;\n const target = root.getElementById?.(attr(link, 'popovertarget') || '') || link.closest(`.${CSS_POPOVER}`);\n const action = attr(link, 'popovertargetaction') || 'toggle';\n\n target?.togglePopover(action === 'show' || (action === 'hide' ? false : undefined));\n }\n}","import styles from '../styles.module.css';\nimport { attr, onMutation } from '../utils';\nconst CSS_TABLE = styles.table.split(' ')[0];\n\nfunction process(tables: HTMLCollectionOf<Element>) {\n for(const table of tables) if (table instanceof HTMLTableElement) {\n const ths = Array.from(table.tHead?.rows[0]?.cells || [], (el) => el.innerText?.trim()); // Using innerText to only include visible text\n for (const tbody of table.tBodies) {\n for (const row of tbody.rows) {\n for (const cell of row.cells) {\n attr(cell, 'data-th', ths[cell.cellIndex] || ':empty');\n }\n }\n }\n }\n}\n\nexport const observe = (el: Element) => onMutation(el, CSS_TABLE, process);\nexport const unobserve = (el: Element) => onMutation(el, CSS_TABLE, false);\n","import { IS_BROWSER, QUICK_EVENT, anchorPosition, attr, on } from \"../utils\";\nimport styles from './tooltip.module.css';\n\nconst DESCRIBEDBY = 'aria-describedby';\nconst LABELLEDBY = 'aria-labelledby';\nconst POSITION_CSS_PROPERTY = '--mtds-tooltip-position';\nconst THROTTLE_DELAY = 100;\nconst TOOLTIP_ID = 'mtds-tooltip';\n\nlet ANCHOR: HTMLElement | null = null;\nlet LAST_CALL = Number.NEGATIVE_INFINITY;\nlet THROTTLE: number | ReturnType<typeof setTimeout> = 0;\nlet TOOLTIP: HTMLElement | null = null;\n\nfunction handleMove({ target }: Event) {\n const wait = LAST_CALL + THROTTLE_DELAY - Date.now();\n clearTimeout(THROTTLE);\n THROTTLE = setTimeout(handleMoveThrottled, Math.max(wait, 0), target);\n}\n\n// Using a throttled function to avoid performance issues\nfunction handleMoveThrottled(target: Element | null) {\n LAST_CALL = Date.now();\n\n if (!TOOLTIP || target === TOOLTIP) return; // Allow tooltip to be hovered, following https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus\n let anchor = target?.closest?.<HTMLElement>('[data-tooltip]') || null;\n \n // No need to update\n if (anchor === ANCHOR) return;\n\n const content = anchor?.getAttribute('data-tooltip') || '';\n const position = anchor?.getAttribute('data-tooltip-position') || window.getComputedStyle(anchor || document.body).getPropertyValue(POSITION_CSS_PROPERTY) || 'top';\n const hasLabel = Boolean(anchor?.innerText.trim()) || anchor?.hasAttribute(LABELLEDBY) || anchor?.hasAttribute('aria-label');\n\n if (!content || content === 'false' || content === 'true' || position === 'none') anchor = null; // Do not show tooltip if boolish value\n if (anchor) TOOLTIP.textContent = content; // Only update content if new anchor\n\n ANCHOR?.removeAttribute(ANCHOR.getAttribute(LABELLEDBY) === TOOLTIP_ID ? LABELLEDBY : DESCRIBEDBY); // Unlink previous anchor\n anchorPosition(TOOLTIP, false); // Reset anchor position\n\n ANCHOR = anchor; // Store new anchor - might be null if no new anchor\n ANCHOR?.setAttribute(hasLabel ? DESCRIBEDBY : LABELLEDBY, TOOLTIP_ID); // Use tooltip as description if allready has label\n TOOLTIP.togglePopover(!!anchor);\n anchorPosition(TOOLTIP, anchor, position);\n}\n\n// Initialize if in browser and not already initialized\nif (IS_BROWSER && !document.getElementById(TOOLTIP_ID)) {\n TOOLTIP = document.body.appendChild(document.createElement('div'));\n TOOLTIP.classList.add(...styles.tooltip.split(' '));\n TOOLTIP.id = TOOLTIP_ID;\n attr(TOOLTIP, 'popover', 'manual');\n on(document, 'blur,focus,mouseout,mouseover', handleMove, QUICK_EVENT);\n on(window, 'blur', handleMove, QUICK_EVENT);\n}","const getSteps = (now: number, max: number, show: number) => {\n const offset = (show - 1) / 2;\n const start = Math.max(Math.min(now - Math.floor(offset), max - show + 1), 1);\n const end = Math.min(Math.max(now + Math.ceil(offset), show), max);\n const pages = Array.from({ length: end + 1 - start }, (_, i) => i + start);\n\n if (show > 4 && start > 1) pages.splice(0, 2, 1, 0);\n if (show > 3 && end < max) pages.splice(-2, 2, 0, max);\n return pages;\n};\n\nexport const pagination = ({\n current = 1,\n total = 10,\n show = 7,\n}) => ({\n prev: current > 1 ? current - 1 : 0,\n next: current < total ? current + 1 : 0,\n pages: getSteps(current, total, show).map((page, index) => ({\n current: page === current && 'page' as const,\n key: `key-${page}-${index}`,\n page,\n })),\n});\n","import * as field from './field/field';\nimport * as fieldset from './fieldset/fieldset';\nimport * as popover from './popover/popover';\nimport * as table from './table/table';\nimport './tooltip/tooltip'; // Load data-tooltip behaviour\nimport { IS_BROWSER } from './utils';\nexport { pagination } from './pagination/pagination';\nexport * as styles from './styles.module.css';\n\n// Automatic observe on browser\nif (IS_BROWSER) {\n const isLoading = document.readyState === \"loading\"; // Check if the page is still loading - might happen if the script is in <head>\n const onLoaded = () => observe(document.body);\n \n if (isLoading) document.addEventListener(\"DOMContentLoaded\", onLoaded);\n else onLoaded();\n}\n\nexport function observe(el: Element) {\n field.observe(el);\n fieldset.observe(el);\n popover.observe(el);\n table.observe(el);\n}\n\nexport function unobserve(el: Element) {\n field.unobserve(el);\n fieldset.unobserve(el);\n popover.unobserve(el);\n table.unobserve(el);\n}"],"names":["IS_BROWSER","QUICK_EVENT","attr","el","name","value","id","UUID","useId","events","action","element","rest","type","on","off","TARGETS","SCROLLER","_","update","POSITION","anchorPosition","target","anchor","position","place","_a","targetW","targetH","anchorW","anchorH","width","height","left","top","anchorX","anchorY","hasSpaceLeft","hasSpaceRight","hasSpaceOver","hasSpaceUnder","positionRight","positionUnder","centerX","centerY","isVertical","createOptimizedMutationObserver","callback","queue","onFrame","onTimer","observer","MUTATORS","MUTATORS_CALLBACK","mutator","onMutation","className","collection","isInputLike","CSS_FIELD","styles","CSS_VALIDATIONS","CSS_VALIDATION","renderAria","fields","field","labels","descs","input","valid","label","renderCounter","handleInput","limit","remainder","nextInvalid","css","observe","unobserve","CSS_FIELDSET","process","fieldsets","fieldset","inputs","validationId","handleToggle","handleLinkClick","CSS_POPOVER","newState","link","root","_b","CSS_TABLE","tables","table","ths","tbody","row","cell","DESCRIBEDBY","LABELLEDBY","POSITION_CSS_PROPERTY","THROTTLE_DELAY","TOOLTIP_ID","ANCHOR","LAST_CALL","THROTTLE","TOOLTIP","handleMove","wait","handleMoveThrottled","content","hasLabel","getSteps","now","max","show","offset","start","end","pages","i","pagination","current","total","page","index","isLoading","onLoaded","field.observe","fieldset.observe","popover.observe","table.observe","field.unobserve","fieldset.unobserve","popover.unobserve","table.unobserve"],"mappings":"4sDAAaA,EAAa,OAAO,OAAW,KAAe,OAAO,SAAa,IAClEC,EAAc,CAAE,QAAS,GAAM,QAAS,EAAK,EAS1C,SAAAC,EACfC,EACAC,EACAC,EACgB,CAChB,OAAIA,IAAU,OAAkBF,EAAG,aAAaC,CAAI,GAAK,MACrDC,IAAU,KAASF,EAAA,gBAAgBC,CAAI,EAClCD,EAAG,aAAaC,CAAI,IAAMC,GAAUF,EAAA,aAAaC,EAAMC,CAAK,EAC9D,KACR,CAMA,IAAIC,GAAK,EACT,MAAMC,GAAO,GAAG,KAAK,IAAM,EAAA,SAAS,EAAE,CAAC,GAAG,KAAK,SAAS,SAAS,EAAE,EAAE,MAAM,EAA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,CAClB,CAEO,SAAS2E,GAAU3E,EAAa,CACrCkI,GAAgBlI,CAAE,EAClBmI,GAAmBnI,CAAE,EACrBoI,GAAkBpI,CAAE,EACpBqI,GAAgBrI,CAAE,CACpB"}
1
+ {"version":3,"file":"index.iife.js","sources":["../designsystem/utils.ts","../designsystem/dialog/dialog.ts","../designsystem/field/field.ts","../designsystem/fieldset/fieldset.ts","../designsystem/layout/layout.ts","../designsystem/popover/popover.ts","../designsystem/table/table.ts","../designsystem/tooltip/tooltip.ts","../designsystem/pagination/pagination.ts","../designsystem/index.ts"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';\nexport const QUICK_EVENT = { capture: true, passive: true };\n\n/**\n * attr\n * @description Utility to quickly get, set and remove attributes\n * @param el The Element to use as EventTarget\n * @param name The attribute name to get, set or remove, or a object to set multiple attributes\n * @param value A valid attribute value or null to remove attribute\n */\nexport function attr(\n\tel: Element,\n\tname: string,\n\tvalue?: string | null,\n): string | null {\n\tif (value === undefined) return el.getAttribute(name) ?? null; // Fallback to null only if el is undefined\n\tif (value === null) el.removeAttribute(name);\n\telse if (el.getAttribute(name) !== value) el.setAttribute(name, value);\n\treturn null;\n}\n\n/**\n * useId\n * @return A generated unique ID\n */\nlet id = 0;\nconst UUID = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;\nexport function useId (el: Element) {\n if (!el.id) el.id = `${UUID}${++id}`;\n\treturn el.id;\n};\n\n// Internal helper for on / off\nconst events = (\n\taction: \"add\" | \"remove\",\n\telement: Node | Window,\n\trest: Parameters<typeof Element.prototype.addEventListener>,\n): void => {\n\tfor (const type of rest[0].split(\",\")) {\n\t\trest[0] = type;\n\t\telement[`${action}EventListener`](...rest);\n\t}\n};\n\n/**\n * on\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.addEventListener>\n): void => events(\"add\", element, rest);\n\n/**\n * off\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => events(\"remove\", element, rest);\n\n\nconst TARGETS = new Map<Element, () => void>(); // Store current open poppers and their update functions\nconst SCROLLER = IS_BROWSER ? document.createElement('div') : null // Used to ensure we have scrollability under\nif (SCROLLER) attr(SCROLLER, 'style', 'position:absolute;padding:1px;top:0;left:0px');\n\nif (IS_BROWSER){\n\ton(window, 'load,resize,scroll', () => {\n\t\tfor (const [_, update] of TARGETS) update();\n\t}, QUICK_EVENT);}\n\t\n/**\n * anchorPosition\n * @param target The Element to position\n * @param anchor The Element to use as anchor\n */\nconst POSITION = { top: 0, right: 1, bottom: 2, left: 3 }; // Speed up by using a const map\n\nexport function anchorPosition (target: HTMLElement, anchor: HTMLElement | null | false, position?: string | number) {\n\tif (!anchor || !anchor.isConnected || !target.isConnected) return TARGETS.delete(target); // Stop watchning if anchor is removed from DOM\n\tif (!SCROLLER?.isConnected) document.body.append(SCROLLER || ''); // Ensure we have t´he scroller\n\tif (!TARGETS.has(target)) { // Setup new target or update position\n\t\tconst place = POSITION[position as keyof typeof POSITION] ?? POSITION.bottom; // Use CSS property to store position for more flexibility\n\t\treturn TARGETS.set(target, () => anchorPosition(target, anchor, place)).get(target)?.(); // Start watching if not already watching\n\t}\n\n const { offsetWidth: targetW, offsetHeight: targetH } = target;\n const { offsetWidth: anchorW, offsetHeight: anchorH } = anchor;\n const { width, height, left, top } = anchor.getBoundingClientRect();\n\tconst anchorX = Math.round(left - (anchorW - width) / 2); // Correct for CSS transform scale\n const anchorY = Math.round(top - (anchorH - height) / 2); // Correct for CSS transform scale\n\n\tconst hasSpaceLeft = anchorX - targetW > 0\n\tconst hasSpaceRight = anchorW + anchorW + targetW < window.innerWidth;\n\tconst hasSpaceOver = anchorY - targetH > 0\n\tconst hasSpaceUnder = anchorY + anchorH + targetH < window.innerHeight;\n\tconst positionRight = (position === POSITION.bottom && hasSpaceRight) || !hasSpaceLeft // Always position right when no hasSpaceLeft, as no OS scrolls further up than 0\n\tconst positionUnder = (position === POSITION.bottom && hasSpaceUnder) || !hasSpaceOver // Always position under when no hasSpaceOver, as no OS scrolls further up than 0\n\tconst centerX = Math.min(Math.max(10, anchorX - (targetW - anchorW) / 2), window.innerWidth - targetW - 10);\n\tconst centerY = Math.min(Math.max(10, anchorY - (targetH - anchorH) / 2), window.innerHeight - targetH - 10);\n\tconst isVertical = position === POSITION.top || position === POSITION.bottom;\n\n\ttarget.style.left = `${Math.round(isVertical ? centerX : (positionRight ? anchorX + anchorW : anchorX - targetW))}px`\n target.style.top = `${Math.round(isVertical ? (positionUnder ? anchorY + anchorH : anchorY - targetH) : centerY)}px`\n SCROLLER?.style.setProperty('translate', `${Math.round(window.scrollX + anchorX + anchorW + targetW + 30)} ${Math.round(window.scrollY + anchorY + anchorH + targetH + 30)}px`);\n}\n\n/**\n * Speed up MutationObserver by debouncing and only running when page is visible\n * @return new MutaionObserver\n */\nexport function createOptimizedMutationObserver(callback: MutationCallback) {\n let queue = 0;\n\n\tconst onFrame = () => setTimeout(onTimer, 200); // Use both requestAnimationFrame and setTimeout to debounce and only run when visible\n\tconst onTimer = () => {\n\t\tcallback([], observer);\n\t\tqueue = 0;\n\t};\n const observer = new MutationObserver(() => {\n if (!queue) queue = requestAnimationFrame(onFrame);\n });\n\n return observer;\n}\n\ntype Mutator = { observer: MutationObserver, collections: Map<string, () => void> };\nconst MUTATORS = new WeakMap<Element, Mutator>();\nconst MUTATORS_CALLBACK = (element: Element) => {\n\tconst mutator = MUTATORS.get(element);\n\n\tif (!mutator || !element.isConnected) {\n\t\tmutator?.observer?.disconnect();\n\t\tMUTATORS.delete(element);\n\t} else for(const [, callback] of mutator.collections) callback();\n};\n\n/**\n * onMutation\n * @description Utility to quickly observe mutations on a specific class name\n * @param element The Element to use as EventTarget\n * @param className The class name to observe\n * @param callback The callback to run when mutations are detected or false to stop observing\n */\nexport const onMutation = (\n\telement: Element,\n\tclassName: string,\n\tcallback: ((collection: HTMLCollection) => void) | false\n) => {\n\tconst collection = element.getElementsByClassName(className);\n\tlet mutator = MUTATORS.get(element);\n\n\tif (!mutator) {\n\t\tmutator = { collections: new Map(), observer: createOptimizedMutationObserver(() => MUTATORS_CALLBACK(element)) };\n\t\tmutator.observer.observe(element, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] });\n\t\tMUTATORS.set(element, mutator);\n\t}\n\tif (callback) mutator.collections.set(className, () => callback(collection));\n\telse mutator.collections.delete(className);\n}\n\nexport const isInputLike = (el: unknown): el is HTMLInputElement =>\n\tel instanceof HTMLElement && 'validity' in el && !(el instanceof HTMLButtonElement);\n\n// Make React support popover=\"\"target attribute\n// https://github.com/facebook/react/issues/27479\ntype Popover = \"\" | \"auto\" | \"manual\" | undefined;\ndeclare global {\n\tnamespace React.JSX {\n\t\tinterface IntrinsicAttributes {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: Popover;\n\t\t}\n\t}\n\tnamespace React {\n\t\tinterface HTMLAttributes<T> {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: Popover;\n\t\t}\n\t}\n}","import { QUICK_EVENT, attr, off, on } from '../utils';\n\nconst handleBackdropClick = ({ clientX: x, clientY: y, target }: MouseEvent) => {\n if (target instanceof HTMLDialogElement && attr(target, 'data-closedby') === 'any') {\n const { top, right, bottom, left } = target.getBoundingClientRect();\n const isInside = top <= y && y <= bottom && left <= x && x <= right;\n\n if (!isInside) target.close();\n }\n};\n\nexport function observe(el: Element) {\n on(el, 'click', handleBackdropClick as EventListener, QUICK_EVENT);\n}\n\nexport function unobserve(el: Element) {\n off(el, 'click', handleBackdropClick as EventListener, QUICK_EVENT);\n}","import styles from '../styles.module.css';\nimport { QUICK_EVENT, attr, isInputLike, off, on, onMutation, useId } from '../utils';\n\nconst CSS_FIELD = styles.field.split(' ')[0];\nconst CSS_VALIDATIONS = styles.validation.split(' ');\nconst CSS_VALIDATION = CSS_VALIDATIONS[0];\n\nfunction renderAria(fields: HTMLCollectionOf<Element>) {\n for(const field of fields) {\n const labels: HTMLLabelElement[] = [];\n const descs: string[] = [];\n let input: HTMLInputElement | null = null;\n let valid = true;\n\n for (const el of field.getElementsByTagName('*')) {\n if (el instanceof HTMLLabelElement) labels.push(el);\n else if (isInputLike(el)) input = el;\n else if (el.classList.contains(CSS_VALIDATION)) { // Must be before instanceof HTMLParagraphElement since validation can also be a <p>\n valid = el.getAttribute('data-color') === 'success';\n descs.unshift(useId(el));\n } else if (el instanceof HTMLParagraphElement) descs.push(useId(el));\n }\n\n if (input) {\n for (const label of labels) label.htmlFor = useId(input);\n renderCounter(input);\n attr(input, 'aria-describedby', descs.join(' '));\n attr(input, 'aria-invalid', `${!valid}`);\n }\n }\n}\nfunction handleInput({ target }: Event) {\n if (isInputLike(target)) renderCounter(target);\n}\n\nfunction renderCounter(input: HTMLInputElement) {\n const el = input?.nextElementSibling;\n const limit = el?.getAttribute('data-count');\n\n if (el && limit) {\n const remainder = Number(limit) - input.value.length;\n const nextInvalid = remainder < 0;\n const prevInvalid = el.getAttribute('aria-live') === 'polite';\n\n if (prevInvalid !== nextInvalid) {\n attr(el, 'aria-live', nextInvalid ? 'polite' : 'off');\n for (const css of CSS_VALIDATIONS) el.classList.toggle(css, nextInvalid);\n }\n el.textContent = `${Math.abs(remainder)} tegn ${nextInvalid ? 'for mye' : 'igjen'}`;\n }\n}\n\nexport function observe (el: Element) {\n onMutation(el, CSS_FIELD, renderAria);\n on(el, 'input', handleInput, QUICK_EVENT);\n}\n\nexport function unobserve (el: Element) {\n onMutation(el, CSS_FIELD, false);\n off(el, 'input', handleInput, QUICK_EVENT);\n}\n","import styles from '../styles.module.css';\nimport { attr, isInputLike, onMutation, useId } from '../utils';\nconst CSS_FIELDSET = styles.fieldset.split(' ')[0];\nconst CSS_VALIDATION = styles.validation.split(' ')[0];\n\nfunction process(fieldsets: HTMLCollectionOf<Element>) {\n for(const fieldset of fieldsets) {\n const inputs: HTMLInputElement[] = [];\n let validationId = '';\n\n for (const el of fieldset.getElementsByTagName('*')) {\n if (el.classList.contains(CSS_VALIDATION)) validationId = useId(el);\n else if (isInputLike(el)) inputs.push(el);\n }\n\n if (validationId) \n for(const input of inputs) {\n attr(input, 'aria-describedby', validationId);\n attr(input, 'aria-invalid', 'true');\n }\n }\n}\n\nexport const observe = (el: Element) => onMutation(el, CSS_FIELDSET, process);\nexport const unobserve = (el: Element) => onMutation(el, CSS_FIELDSET, false);\n","import { QUICK_EVENT, off, on } from '../utils';\n\nconst handleToggleClick = ({ target }: Event) => {\n // const el =\n // (target as Element)?.closest(\"nav\") ||\n // document.querySelector(\"aside\"); // \"nav,aside,header,footer\"\n // const toggle = () =>\n // el?.setAttribute(\n // \"data-expanded\",\n // `${el?.getAttribute(\"data-expanded\") === \"false\"}`,\n // );\n\n // if (!document.startViewTransition) toggle();\n // else document.startViewTransition(() => toggle());\n};\n\nexport function observe(el: Element) {\n on(el, 'click', handleToggleClick, QUICK_EVENT);\n}\n\nexport function unobserve(el: Element) {\n off(el, 'click', handleToggleClick, QUICK_EVENT);\n}\n","import styles from '../styles.module.css';\nimport { QUICK_EVENT, anchorPosition, attr, off, on } from '../utils';\n\nexport function observe(el: Node) {\n on(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n on(el, 'click', handleLinkClick); // Allow `<a>` to use `popovertarget` as well\n}\nexport function unobserve(el: Node) {\n off(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n off(el, 'click', handleLinkClick);\n}\n\nconst CSS_POPOVER = styles.popover.split(' ')[0];\n\nfunction handleToggle ({ target: el, newState }: Event & { newState?: string }){\n if (el instanceof HTMLElement && el.classList.contains(CSS_POPOVER)) {\n const anchor = (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(`[popovertarget=\"${el.id}\"]`);\n \n if (newState === 'closed') anchorPosition(el, false);\n else if (anchor) anchorPosition(el, anchor, el.getAttribute('data-position') || 'bottom');\n }\n}\n\n// Polyfill popovertarget for <a> (not supported by native)\n// and automatically assume popovertarget is the closest parent popover\n// but respect the popovertarget and popovertargetaction attribute\nfunction handleLinkClick ({ target }: Event){\n const link = (target as Element )?.closest?.('a');\n if (link) {\n const root = link.getRootNode() as ShadowRoot;\n const target = root.getElementById?.(attr(link, 'popovertarget') || '') || link.closest(`.${CSS_POPOVER}`);\n const action = attr(link, 'popovertargetaction') || 'toggle';\n\n target?.togglePopover(action === 'show' || (action === 'hide' ? false : undefined));\n }\n}","import styles from '../styles.module.css';\nimport { attr, onMutation } from '../utils';\nconst CSS_TABLE = styles.table.split(' ')[0];\n\nfunction process(tables: HTMLCollectionOf<Element>) {\n for(const table of tables) if (table instanceof HTMLTableElement) {\n const ths = Array.from(table.tHead?.rows[0]?.cells || [], (el) => el.innerText?.trim()); // Using innerText to only include visible text\n for (const tbody of table.tBodies) {\n for (const row of tbody.rows) {\n for (const cell of row.cells) {\n attr(cell, 'data-th', ths[cell.cellIndex] || ':empty');\n }\n }\n }\n }\n}\n\nexport const observe = (el: Element) => onMutation(el, CSS_TABLE, process);\nexport const unobserve = (el: Element) => onMutation(el, CSS_TABLE, false);\n","import { IS_BROWSER, QUICK_EVENT, anchorPosition, attr, on } from \"../utils\";\nimport styles from './tooltip.module.css';\n\nconst DESCRIBEDBY = 'aria-describedby';\nconst LABELLEDBY = 'aria-labelledby';\nconst POSITION_CSS_PROPERTY = '--mtds-tooltip-position';\nconst THROTTLE_DELAY = 100;\nconst TOOLTIP_ID = 'mtds-tooltip';\nconst ESC = 'Escape';\n\nlet ANCHOR: HTMLElement | null = null;\nlet LAST_CALL = Number.NEGATIVE_INFINITY;\nlet THROTTLE: number | ReturnType<typeof setTimeout> = 0;\nlet TOOLTIP: HTMLElement | null = null;\n\nfunction handleMove({ target, type, key }: Event & { key?: string }) {\n if (type === 'keydown' && key !== ESC) return; // Allow ESC dismiss to follow https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/\n const wait = LAST_CALL + THROTTLE_DELAY - Date.now();\n clearTimeout(THROTTLE);\n THROTTLE = setTimeout(handleMoveThrottled, Math.max(wait, 0), key === ESC ? null : target);\n}\n\n// Using a throttled function to avoid performance issues\nfunction handleMoveThrottled(target: Element | null) {\n LAST_CALL = Date.now();\n\n if (!TOOLTIP || target === TOOLTIP) return; // Allow tooltip to be hovered, following https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus\n let anchor = target?.closest?.<HTMLElement>('[data-tooltip]') || null;\n \n // No need to update\n if (anchor === ANCHOR) return;\n\n const content = anchor?.getAttribute('data-tooltip') || '';\n const position = anchor?.getAttribute('data-tooltip-position') || window.getComputedStyle(anchor || document.body).getPropertyValue(POSITION_CSS_PROPERTY) || 'top';\n const hasLabel = Boolean(anchor?.innerText.trim()) || anchor?.hasAttribute(LABELLEDBY) || anchor?.hasAttribute('aria-label');\n\n if (!content || content === 'false' || content === 'true' || position === 'none') anchor = null; // Do not show tooltip if boolish value\n if (anchor) TOOLTIP.textContent = content; // Only update content if new anchor\n\n ANCHOR?.removeAttribute(ANCHOR.getAttribute(LABELLEDBY) === TOOLTIP_ID ? LABELLEDBY : DESCRIBEDBY); // Unlink previous anchor\n anchorPosition(TOOLTIP, false); // Reset anchor position\n\n ANCHOR = anchor; // Store new anchor - might be null if no new anchor\n ANCHOR?.setAttribute(hasLabel ? DESCRIBEDBY : LABELLEDBY, TOOLTIP_ID); // Use tooltip as description if allready has label\n TOOLTIP.togglePopover(!!anchor);\n anchorPosition(TOOLTIP, anchor, position);\n}\n\n// Initialize if in browser and not already initialized\nif (IS_BROWSER && !document.getElementById(TOOLTIP_ID)) {\n TOOLTIP = document.body.appendChild(document.createElement('div'));\n TOOLTIP.classList.add(...styles.tooltip.split(' '));\n TOOLTIP.id = TOOLTIP_ID;\n attr(TOOLTIP, 'popover', 'manual');\n on(document, 'blur,focus,mouseout,mouseover', handleMove, QUICK_EVENT);\n on(window, 'keydown', handleMove, QUICK_EVENT);\n on(window, 'blur', handleMove, QUICK_EVENT);\n}","const getSteps = (now: number, max: number, show: number) => {\n const offset = (show - 1) / 2;\n const start = Math.max(Math.min(now - Math.floor(offset), max - show + 1), 1);\n const end = Math.min(Math.max(now + Math.ceil(offset), show), max);\n const pages = Array.from({ length: end + 1 - start }, (_, i) => i + start);\n\n if (show > 4 && start > 1) pages.splice(0, 2, 1, 0);\n if (show > 3 && end < max) pages.splice(-2, 2, 0, max);\n return pages;\n};\n\nexport const pagination = ({\n current = 1,\n total = 10,\n show = 7,\n}) => ({\n prev: current > 1 ? current - 1 : 0,\n next: current < total ? current + 1 : 0,\n pages: getSteps(current, total, show).map((page, index) => ({\n current: page === current && 'page' as const,\n key: `key-${page}-${index}`,\n page,\n })),\n});\n","import * as dialog from './dialog/dialog';\nimport * as field from './field/field';\nimport * as fieldset from './fieldset/fieldset';\nimport * as layout from './layout/layout';\nimport * as popover from './popover/popover';\nimport * as table from './table/table';\nimport './tooltip/tooltip'; // Load data-tooltip behaviour\nimport { IS_BROWSER } from './utils';\nexport { pagination } from './pagination/pagination';\nexport * as styles from './styles.module.css';\n\n// Automatic observe on browser\nif (IS_BROWSER) {\n const isLoading = document.readyState === \"loading\"; // Check if the page is still loading - might happen if the script is in <head>\n const onLoaded = () => observe(document.body);\n \n if (isLoading) document.addEventListener(\"DOMContentLoaded\", onLoaded);\n else onLoaded();\n}\n\nexport function observe(el: Element) {\n dialog.observe(el);\n field.observe(el);\n fieldset.observe(el);\n layout.observe(el);\n popover.observe(el);\n table.observe(el);\n}\n\nexport function unobserve(el: Element) {\n dialog.unobserve(el);\n field.unobserve(el);\n fieldset.unobserve(el);\n layout.unobserve(el);\n popover.unobserve(el);\n table.unobserve(el);\n}"],"names":["IS_BROWSER","QUICK_EVENT","attr","el","name","value","id","UUID","useId","events","action","element","rest","type","on","off","TARGETS","SCROLLER","_","update","POSITION","anchorPosition","target","anchor","position","place","_a","targetW","targetH","anchorW","anchorH","width","height","left","top","anchorX","anchorY","hasSpaceLeft","hasSpaceRight","hasSpaceOver","hasSpaceUnder","positionRight","positionUnder","centerX","centerY","isVertical","createOptimizedMutationObserver","callback","queue","onFrame","onTimer","observer","MUTATORS","MUTATORS_CALLBACK","mutator","onMutation","className","collection","isInputLike","handleBackdropClick","x","y","right","bottom","observe","unobserve","CSS_FIELD","styles","CSS_VALIDATIONS","CSS_VALIDATION","renderAria","fields","field","labels","descs","input","valid","label","renderCounter","handleInput","limit","remainder","nextInvalid","css","CSS_FIELDSET","process","fieldsets","fieldset","inputs","validationId","handleToggleClick","handleToggle","handleLinkClick","CSS_POPOVER","newState","link","root","_b","CSS_TABLE","tables","table","ths","tbody","row","cell","DESCRIBEDBY","LABELLEDBY","POSITION_CSS_PROPERTY","THROTTLE_DELAY","TOOLTIP_ID","ESC","ANCHOR","LAST_CALL","THROTTLE","TOOLTIP","handleMove","key","wait","handleMoveThrottled","content","hasLabel","getSteps","now","max","show","offset","start","end","pages","i","pagination","current","total","page","index","isLoading","onLoaded","dialog.observe","field.observe","fieldset.observe","layout.observe","popover.observe","table.observe","dialog.unobserve","field.unobserve","fieldset.unobserve","layout.unobserve","popover.unobserve","table.unobserve"],"mappings":"kCAAO,MAAMA,EAAa,OAAO,OAAW,KAAe,OAAO,SAAa,IAClEC,EAAc,CAAE,QAAS,GAAM,QAAS,EAAK,EAS1C,SAAAC,EACfC,EACAC,EACAC,EACgB,CAChB,OAAIA,IAAU,OAAkBF,EAAG,aAAaC,CAAI,GAAK,MACrDC,IAAU,KAASF,EAAA,gBAAgBC,CAAI,EAClCD,EAAG,aAAaC,CAAI,IAAMC,GAAUF,EAAA,aAAaC,EAAMC,CAAK,EAC9D,KACR,CAMA,IAAIC,GAAK,EACT,MAAMC,GAAO,GAAG,KAAK,IAAM,EAAA,SAAS,EAAE,CAAC,GAAG,KAAK,SAAS,SAAS,EAAE,EAAE,MAAM,EAAG,CAAC,CAA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AM,KAAK,CAAE,OAAQD,EAAM,EAAID,CAAS,EAAA,CAAC5G,EAAG+G,IAAMA,EAAIH,CAAK,EAErE,OAAAF,EAAO,GAAKE,EAAQ,KAAS,OAAO,EAAG,EAAG,EAAG,CAAC,EAC9CF,EAAO,GAAKG,EAAMJ,KAAW,OAAO,GAAI,EAAG,EAAGA,CAAG,EAC9CK,CACT,EAEaE,GAAa,CAAC,CACzB,QAAAC,EAAU,EACV,MAAAC,EAAQ,GACR,KAAAR,EAAO,CACT,KAAO,CACL,KAAMO,EAAU,EAAIA,EAAU,EAAI,EAClC,KAAMA,EAAUC,EAAQD,EAAU,EAAI,EACtC,MAAOV,GAASU,EAASC,EAAOR,CAAI,EAAE,IAAI,CAACS,EAAMC,KAAW,CAC1D,QAASD,IAASF,GAAW,OAC7B,IAAK,OAAOE,CAAI,IAAIC,CAAK,GACzB,KAAAD,CAAA,EACA,CACJ,GCXA,GAAIrI,EAAY,CACR,MAAAuI,EAAY,SAAS,aAAe,UACpCC,EAAW,IAAMxE,GAAQ,SAAS,IAAI,EAExCuE,EAAW,SAAS,iBAAiB,mBAAoBC,CAAQ,EACvDA,EAAA,CAChB,CAEO,SAASxE,GAAQ7D,EAAa,CACnCsI,GAAetI,CAAE,EACjBuI,GAAcvI,CAAE,EAChBwI,GAAiBxI,CAAE,EACnByI,GAAezI,CAAE,EACjB0I,GAAgB1I,CAAE,EAClB2I,GAAc3I,CAAE,CAClB,CAEO,SAAS8D,GAAU9D,EAAa,CACrC4I,GAAiB5I,CAAE,EACnB6I,GAAgB7I,CAAE,EAClB8I,GAAmB9I,CAAE,EACrB+I,GAAiB/I,CAAE,EACnBgJ,GAAkBhJ,CAAE,EACpBiJ,GAAgBjJ,CAAE,CACpB"}
package/mtds/index.js CHANGED
@@ -1,25 +1,27 @@
1
- import { observe as r, unobserve as s } from "./field/field.js";
2
- import { observe as n, unobserve as t } from "./fieldset/fieldset.js";
3
- import { observe as a, unobserve as b } from "./popover/popover.js";
4
- import { observe as v, unobserve as m } from "./table/table.js";
1
+ import { observe as r, unobserve as s } from "./dialog/dialog.js";
2
+ import { observe as n, unobserve as t } from "./field/field.js";
3
+ import { observe as b, unobserve as v } from "./fieldset/fieldset.js";
4
+ import { observe as a, unobserve as m } from "./layout/layout.js";
5
+ import { observe as i, unobserve as u } from "./popover/popover.js";
6
+ import { observe as d, unobserve as f } from "./table/table.js";
5
7
  import "./tooltip/tooltip.js";
6
- import { IS_BROWSER as i } from "./utils.js";
7
- import { pagination as E } from "./pagination/pagination.js";
8
- import * as L from "./styles.module.css.js";
9
- if (i) {
10
- const o = document.readyState === "loading", e = () => u(document.body);
8
+ import { IS_BROWSER as p } from "./utils.js";
9
+ import { pagination as D } from "./pagination/pagination.js";
10
+ import * as R from "./styles.module.css.js";
11
+ if (p) {
12
+ const o = document.readyState === "loading", e = () => $(document.body);
11
13
  o ? document.addEventListener("DOMContentLoaded", e) : e();
12
14
  }
13
- function u(o) {
14
- r(o), n(o), a(o), v(o);
15
+ function $(o) {
16
+ r(o), n(o), b(o), a(o), i(o), d(o);
15
17
  }
16
- function g(o) {
17
- s(o), t(o), b(o), m(o);
18
+ function _(o) {
19
+ s(o), t(o), v(o), m(o), u(o), f(o);
18
20
  }
19
21
  export {
20
- u as observe,
21
- E as pagination,
22
- L as styles,
23
- g as unobserve
22
+ $ as observe,
23
+ D as pagination,
24
+ R as styles,
25
+ _ as unobserve
24
26
  };
25
27
  //# sourceMappingURL=index.js.map
package/mtds/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../designsystem/index.ts"],"sourcesContent":["import * as field from './field/field';\nimport * as fieldset from './fieldset/fieldset';\nimport * as popover from './popover/popover';\nimport * as table from './table/table';\nimport './tooltip/tooltip'; // Load data-tooltip behaviour\nimport { IS_BROWSER } from './utils';\nexport { pagination } from './pagination/pagination';\nexport * as styles from './styles.module.css';\n\n// Automatic observe on browser\nif (IS_BROWSER) {\n const isLoading = document.readyState === \"loading\"; // Check if the page is still loading - might happen if the script is in <head>\n const onLoaded = () => observe(document.body);\n \n if (isLoading) document.addEventListener(\"DOMContentLoaded\", onLoaded);\n else onLoaded();\n}\n\nexport function observe(el: Element) {\n field.observe(el);\n fieldset.observe(el);\n popover.observe(el);\n table.observe(el);\n}\n\nexport function unobserve(el: Element) {\n field.unobserve(el);\n fieldset.unobserve(el);\n popover.unobserve(el);\n table.unobserve(el);\n}"],"names":["IS_BROWSER","isLoading","onLoaded","observe","el","field.observe","fieldset.observe","popover.observe","table.observe","unobserve","field.unobserve","fieldset.unobserve","popover.unobserve","table.unobserve"],"mappings":";;;;;;;;AAUA,IAAIA,GAAY;AACR,QAAAC,IAAY,SAAS,eAAe,WACpCC,IAAW,MAAMC,EAAQ,SAAS,IAAI;AAE5C,EAAIF,IAAW,SAAS,iBAAiB,oBAAoBC,CAAQ,IACvDA,EAAA;AAChB;AAEO,SAASC,EAAQC,GAAa;AACnCC,EAAAA,EAAcD,CAAE,GAChBE,EAAiBF,CAAE,GACnBG,EAAgBH,CAAE,GAClBI,EAAcJ,CAAE;AAClB;AAEO,SAASK,EAAUL,GAAa;AACrCM,EAAAA,EAAgBN,CAAE,GAClBO,EAAmBP,CAAE,GACrBQ,EAAkBR,CAAE,GACpBS,EAAgBT,CAAE;AACpB;"}
1
+ {"version":3,"file":"index.js","sources":["../designsystem/index.ts"],"sourcesContent":["import * as dialog from './dialog/dialog';\nimport * as field from './field/field';\nimport * as fieldset from './fieldset/fieldset';\nimport * as layout from './layout/layout';\nimport * as popover from './popover/popover';\nimport * as table from './table/table';\nimport './tooltip/tooltip'; // Load data-tooltip behaviour\nimport { IS_BROWSER } from './utils';\nexport { pagination } from './pagination/pagination';\nexport * as styles from './styles.module.css';\n\n// Automatic observe on browser\nif (IS_BROWSER) {\n const isLoading = document.readyState === \"loading\"; // Check if the page is still loading - might happen if the script is in <head>\n const onLoaded = () => observe(document.body);\n \n if (isLoading) document.addEventListener(\"DOMContentLoaded\", onLoaded);\n else onLoaded();\n}\n\nexport function observe(el: Element) {\n dialog.observe(el);\n field.observe(el);\n fieldset.observe(el);\n layout.observe(el);\n popover.observe(el);\n table.observe(el);\n}\n\nexport function unobserve(el: Element) {\n dialog.unobserve(el);\n field.unobserve(el);\n fieldset.unobserve(el);\n layout.unobserve(el);\n popover.unobserve(el);\n table.unobserve(el);\n}"],"names":["IS_BROWSER","isLoading","onLoaded","observe","el","dialog.observe","field.observe","fieldset.observe","layout.observe","popover.observe","table.observe","unobserve","dialog.unobserve","field.unobserve","fieldset.unobserve","layout.unobserve","popover.unobserve","table.unobserve"],"mappings":";;;;;;;;;;AAYA,IAAIA,GAAY;AACR,QAAAC,IAAY,SAAS,eAAe,WACpCC,IAAW,MAAMC,EAAQ,SAAS,IAAI;AAE5C,EAAIF,IAAW,SAAS,iBAAiB,oBAAoBC,CAAQ,IACvDA,EAAA;AAChB;AAEO,SAASC,EAAQC,GAAa;AACnCC,EAAAA,EAAeD,CAAE,GACjBE,EAAcF,CAAE,GAChBG,EAAiBH,CAAE,GACnBI,EAAeJ,CAAE,GACjBK,EAAgBL,CAAE,GAClBM,EAAcN,CAAE;AAClB;AAEO,SAASO,EAAUP,GAAa;AACrCQ,EAAAA,EAAiBR,CAAE,GACnBS,EAAgBT,CAAE,GAClBU,EAAmBV,CAAE,GACrBW,EAAiBX,CAAE,GACnBY,EAAkBZ,CAAE,GACpBa,EAAgBb,CAAE;AACpB;"}
@@ -1 +1,2 @@
1
- export {};
1
+ export declare function observe(el: Element): void;
2
+ export declare function unobserve(el: Element): void;
@@ -0,0 +1,14 @@
1
+ import { on as n, QUICK_EVENT as c, off as t } from "../utils.js";
2
+ const e = ({ target: o }) => {
3
+ };
4
+ function r(o) {
5
+ n(o, "click", e, c);
6
+ }
7
+ function f(o) {
8
+ t(o, "click", e, c);
9
+ }
10
+ export {
11
+ r as observe,
12
+ f as unobserve
13
+ };
14
+ //# sourceMappingURL=layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.js","sources":["../../designsystem/layout/layout.ts"],"sourcesContent":["import { QUICK_EVENT, off, on } from '../utils';\n\nconst handleToggleClick = ({ target }: Event) => {\n // const el =\n // (target as Element)?.closest(\"nav\") ||\n // document.querySelector(\"aside\"); // \"nav,aside,header,footer\"\n // const toggle = () =>\n // el?.setAttribute(\n // \"data-expanded\",\n // `${el?.getAttribute(\"data-expanded\") === \"false\"}`,\n // );\n\n // if (!document.startViewTransition) toggle();\n // else document.startViewTransition(() => toggle());\n};\n\nexport function observe(el: Element) {\n on(el, 'click', handleToggleClick, QUICK_EVENT);\n}\n\nexport function unobserve(el: Element) {\n off(el, 'click', handleToggleClick, QUICK_EVENT);\n}\n"],"names":["handleToggleClick","target","observe","el","on","QUICK_EVENT","unobserve","off"],"mappings":";AAEA,MAAMA,IAAoB,CAAC,EAAE,QAAAC,QAAoB;AAYjD;AAEO,SAASC,EAAQC,GAAa;AAChC,EAAAC,EAAAD,GAAI,SAASH,GAAmBK,CAAW;AAChD;AAEO,SAASC,EAAUH,GAAa;AACjC,EAAAI,EAAAJ,GAAI,SAASH,GAAmBK,CAAW;AACjD;"}
@@ -1,24 +1,24 @@
1
1
  import m from "../styles.module.css.js";
2
- import { on as f, QUICK_EVENT as a, off as l, anchorPosition as p, attr as r } from "../utils.js";
2
+ import { on as f, QUICK_EVENT as d, anchorPosition as l, attr as p, off as r } from "../utils.js";
3
3
  function k(o) {
4
- f(o, "toggle", g, a), f(o, "click", v);
4
+ f(o, "toggle", g, d), f(o, "click", u);
5
5
  }
6
6
  function E(o) {
7
- l(o, "toggle", g, a), l(o, "click", v);
7
+ r(o, "toggle", g, d), r(o, "click", u);
8
8
  }
9
- const d = m.popover.split(" ")[0];
10
- function g({ target: o, newState: t }) {
11
- var n;
12
- if (o instanceof HTMLElement && o.classList.contains(d)) {
13
- const i = (n = o.getRootNode()) == null ? void 0 : n.querySelector(`[popovertarget="${o.id}"]`);
14
- t === "closed" ? p(o, !1) : i && p(o, i, o.getAttribute("data-position") || "bottom");
9
+ const a = m.popover.split(" ")[0];
10
+ function g({ target: o, newState: n }) {
11
+ var t;
12
+ if (o instanceof HTMLElement && o.classList.contains(a)) {
13
+ const e = (t = o.getRootNode()) == null ? void 0 : t.querySelector(`[popovertarget="${o.id}"]`);
14
+ n === "closed" ? l(o, !1) : e && l(o, e, o.getAttribute("data-position") || "bottom");
15
15
  }
16
16
  }
17
- function v({ target: o }) {
18
- var n, i;
19
- const t = (n = o == null ? void 0 : o.closest) == null ? void 0 : n.call(o, "a");
20
- if (t) {
21
- const e = t.getRootNode(), s = ((i = e.getElementById) == null ? void 0 : i.call(e, r(t, "popovertarget") || "")) || t.closest(`.${d}`), c = r(t, "popovertargetaction") || "toggle";
17
+ function u({ target: o }) {
18
+ var t, e;
19
+ const n = (t = o == null ? void 0 : o.closest) == null ? void 0 : t.call(o, "a");
20
+ if (n) {
21
+ const i = n.getRootNode(), s = ((e = i.getElementById) == null ? void 0 : e.call(i, p(n, "popovertarget") || "")) || n.closest(`.${a}`), c = p(n, "popovertargetaction") || "toggle";
22
22
  s == null || s.togglePopover(c === "show" || (c === "hide" ? !1 : void 0));
23
23
  }
24
24
  }
@@ -0,0 +1,9 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ declare const meta: {
3
+ title: string;
4
+ };
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
8
+ export declare const Sizes: Story;
9
+ export declare const Text: Story;