@mattilsynet/design 0.5.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mtds/card/card.stories.d.ts +3 -2
- package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js +250 -0
- package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js.map +1 -0
- package/mtds/external/@u-elements/u-tags/dist/u-tags.js +367 -0
- package/mtds/external/@u-elements/u-tags/dist/u-tags.js.map +1 -0
- package/mtds/field/field-observer.js +42 -31
- package/mtds/field/field-observer.js.map +1 -1
- package/mtds/field/field.stories.d.ts +2 -0
- package/mtds/helptext/helptext-observer.d.ts +1 -0
- package/mtds/helptext/helptext.d.ts +2 -0
- package/mtds/{togglegroup/togglegroup.stories.d.ts → helptext/helptext.story.d.ts} +3 -0
- package/mtds/index.d.ts +7 -4
- package/mtds/index.iife.js +5 -2
- package/mtds/index.iife.js.map +1 -1
- package/mtds/index.js.map +1 -1
- package/mtds/input/input.stories.d.ts +2 -0
- package/mtds/layout/layout-observer.js +21 -13
- package/mtds/layout/layout-observer.js.map +1 -1
- package/mtds/layout/layout.d.ts +4 -3
- package/mtds/layout/layout.js.map +1 -1
- package/mtds/logo/logo-observer.js +16 -16
- package/mtds/logo/logo-observer.js.map +1 -1
- package/mtds/popover/popover.js +3 -3
- package/mtds/popover/popover.js.map +1 -1
- package/mtds/popover/popover.stories.d.ts +1 -0
- package/mtds/react.d.ts +1 -1
- package/mtds/react.js +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +34 -33
- package/mtds/styles.module.css.js +67 -65
- package/mtds/styles.module.css.js.map +1 -1
- package/mtds/{heading/heading.js → typography/typography.js} +1 -1
- package/mtds/typography/typography.js.map +1 -0
- package/mtds/{heading/heading.stories.d.ts → typography/typography.stories.d.ts} +2 -1
- package/mtds/utils.d.ts +2 -2
- package/mtds/utils.js.map +1 -1
- package/mtds/validation/validation.stories.d.ts +1 -0
- package/package.json +17 -17
- package/mtds/heading/heading.js.map +0 -1
- /package/mtds/{heading/heading.d.ts → typography/typography.d.ts} +0 -0
package/mtds/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ badge: string;
|
|
|
5
5
|
breadcrumbs: string;
|
|
6
6
|
button: string;
|
|
7
7
|
card: string;
|
|
8
|
+
info: string;
|
|
8
9
|
group: string;
|
|
9
10
|
chip: string;
|
|
10
11
|
details: string;
|
|
@@ -13,14 +14,12 @@ divider: string;
|
|
|
13
14
|
errorsummary: string;
|
|
14
15
|
field: string;
|
|
15
16
|
affixes: string;
|
|
16
|
-
count: string;
|
|
17
17
|
fieldset: string;
|
|
18
|
-
|
|
19
|
-
typostack: string;
|
|
18
|
+
helptext: string;
|
|
20
19
|
input: string;
|
|
20
|
+
app: string;
|
|
21
21
|
grid: string;
|
|
22
22
|
flex: string;
|
|
23
|
-
app: string;
|
|
24
23
|
link: string;
|
|
25
24
|
logo: string;
|
|
26
25
|
pagination: string;
|
|
@@ -30,9 +29,13 @@ spinner: string;
|
|
|
30
29
|
table: string;
|
|
31
30
|
tabs: string;
|
|
32
31
|
tag: string;
|
|
32
|
+
heading: string;
|
|
33
|
+
prose: string;
|
|
33
34
|
validation: string;
|
|
34
35
|
body: string;
|
|
35
36
|
};
|
|
36
37
|
export { pagination } from './pagination/pagination-helper';
|
|
38
|
+
export type Size = "sm" | "md" | "lg";
|
|
39
|
+
export type HeadingSize = "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
37
40
|
export declare function observe(el: Element): void;
|
|
38
41
|
export declare function unobserve(el: Element): void;
|
package/mtds/index.iife.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
var mtds=function(
|
|
1
|
+
var mtds=function(x){"use strict";const Mt="_alert_atd08_1 _ds-alert_z5gp5_1",Dt="_avatar_atd08_1 _ds-avatar_z5gp5_1",Pt="_badge_atd08_1",Rt="_breadcrumbs_atd08_1 _ds-breadcrumbs_z5gp5_1",Ht="_button_atd08_1 _ds-button_z5gp5_1",Nt="_card_atd08_1",Bt="_info_atd08_1",Ft="_group_atd08_1",Ut="_chip_atd08_1 _ds-chip_z5gp5_1",Vt="_details_atd08_1 _ds-details_z5gp5_1",zt="_dialog_atd08_1 _ds-dialog_z5gp5_1",Yt="_divider_atd08_1",Kt="_errorsummary_atd08_1 _ds-error-summary_z5gp5_1",jt="_field_atd08_1 _ds-field_z5gp5_1",Wt="_affixes_atd08_1 _ds-field-affixes_z5gp5_1",Xt="_fieldset_atd08_1 _ds-fieldset_z5gp5_1",qt="_helptext_atd08_1 _ds-focus_z5gp5_1",Gt="_input_atd08_1 _ds-input_z5gp5_1",Qt="_app_atd08_1",Jt="_grid_atd08_1",Zt="_flex_atd08_1",te="_link_atd08_1",ee="_logo_atd08_1",ne="_pagination_atd08_1 _ds-pagination_z5gp5_1",oe="_popover_atd08_1",ie="_skeleton_atd08_1 _ds-skeleton_z5gp5_1",se="_spinner_atd08_1",ae="_table_atd08_1 _ds-table_z5gp5_1",re="__scrollShadow_atd08_1",le="_tabs_atd08_1 _ds-tabs_z5gp5_1",de="_tag_atd08_1 _ds-tag_z5gp5_1",ue="__tooltip_atd08_1",ce="_heading_atd08_1 _ds-heading_z5gp5_1",fe="_prose_atd08_1",pe="_validation_atd08_1 _ds-validation-message_z5gp5_1",he="_body_atd08_106",g={alert:Mt,avatar:Dt,badge:Pt,breadcrumbs:Rt,button:Ht,card:Nt,info:Bt,group:Ft,chip:Ut,details:Vt,dialog:zt,divider:Yt,errorsummary:Kt,field:jt,affixes:Wt,fieldset:Xt,helptext:qt,input:Gt,app:Qt,grid:Jt,flex:Zt,link:te,logo:ee,pagination:ne,popover:oe,skeleton:ie,spinner:se,table:ae,_scrollShadow:re,tabs:le,tag:de,_tooltip:ue,heading:ce,prose:fe,validation:pe,body:he},Mn=Object.freeze(Object.defineProperty({__proto__:null,_scrollShadow:re,_tooltip:ue,affixes:Wt,alert:Mt,app:Qt,avatar:Dt,badge:Pt,body:he,breadcrumbs:Rt,button:Ht,card:Nt,chip:Ut,default:g,details:Vt,dialog:zt,divider:Yt,errorsummary:Kt,field:jt,fieldset:Xt,flex:Zt,grid:Jt,group:Ft,heading:ce,helptext:qt,info:Bt,input:Gt,link:te,logo:ee,pagination:ne,popover:oe,prose:fe,skeleton:ie,spinner:se,table:ae,tabs:le,tag:de,validation:pe},Symbol.toStringTag,{value:"Module"})),Dn=(t,e,n)=>{const o=(n-1)/2,i=Math.max(Math.min(t-Math.floor(o),e-n+1),1),a=Math.min(Math.max(t+Math.ceil(o),n),e),s=Array.from({length:a+1-i},(r,d)=>d+i);return n>4&&i>1&&s.splice(0,2,1,0),n>3&&a<e&&s.splice(-2,2,0,e),s},Pn=({current:t=1,total:e=10,show:n=7})=>({prev:t>1?t-1:0,next:t<e?t+1:0,pages:Dn(t,e,n).map((o,i)=>({current:o===t&&"page",key:`key-${o}-${i}`,page:o}))}),P=typeof window<"u"&&typeof document<"u",v={capture:!0,passive:!0};function f(t,e,n){return n===void 0?t.getAttribute(e)??null:(n===null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n),null)}let Rn=0;const Hn=`${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`;function R(t){return t.id||(t.id=`${Hn}${++Rn}`),t.id}const _e=(t,e,n)=>{for(const o of n[0].split(","))n[0]=o,e[`${t}EventListener`](...n)},b=(t,...e)=>_e("add",t,e),L=(t,...e)=>_e("remove",t,e),W=new Map,E=P?document.createElement("div"):null;E&&f(E,"style","position:absolute;padding:1px;top:0;left:0px"),P&&b(window,"load,resize,scroll",()=>{for(const[t,e]of W)e()},v);const A={top:0,right:1,bottom:2,left:3};function H(t,e,n){var On;if(!e||!e.isConnected||!t.isConnected)return W.delete(t);if(E!=null&&E.isConnected||document.body.append(E||""),!W.has(t)){const fi=A[n]??A.bottom;return(On=W.set(t,()=>H(t,e,fi)).get(t))==null?void 0:On()}const{offsetWidth:o,offsetHeight:i}=t,{offsetWidth:a,offsetHeight:s}=e,{width:r,height:d,left:l,top:u}=e.getBoundingClientRect(),h=Math.round(l-(a-r)/2),m=Math.round(u-(s-d)/2),S=h-o>0,Ot=a+a+o<window.innerWidth,D=m-i>0,at=m+s+i<window.innerHeight,_=n===A.bottom&&Ot||!S,K=n===A.bottom&&at||!D,j=Math.min(Math.max(10,h-(o-a)/2),window.innerWidth-o-10),rt=Math.min(Math.max(10,m-(i-s)/2),window.innerHeight-i-10),lt=n===A.top||n===A.bottom;t.style.left=`${Math.round(lt?j:_?h+a:h-o)}px`,t.style.top=`${Math.round(lt?K?m+s:m-i:rt)}px`,E==null||E.style.setProperty("translate",`${Math.round(window.scrollX+h+a+o+30)} ${Math.round(window.scrollY+m+s+i+30)}px`)}function Nn(t){let e=0;const n=()=>setTimeout(o,200),o=()=>{t([],i),e=0},i=new MutationObserver(()=>{e||(e=requestAnimationFrame(n))});return i}const X=new WeakMap,Bn=t=>{var n;const e=X.get(t);if(!e||!t.isConnected)(n=e==null?void 0:e.observer)==null||n.disconnect(),X.delete(t);else for(const[,o]of e.collections)o()},T=(t,e,n)=>{const o=t.getElementsByClassName(e);let i=X.get(t);i||(i={collections:new Map,observer:Nn(()=>Bn(t))},i.observer.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),X.set(t,i)),n?i.collections.set(e,()=>n(o)):i.collections.delete(e)},dt=t=>t instanceof HTMLElement&&"validity"in t&&!(t instanceof HTMLButtonElement),Fn=g._tooltip.split(" "),me="aria-describedby",ve="Escape",q="aria-labelledby",Un="--mtds-tooltip-position",Vn=300,G="mtds-tooltip";let $=null,ge=Number.NEGATIVE_INFINITY,be=0,y=null;function ut({target:t,type:e,key:n}){if(e==="keydown"&&n!==ve)return;const o=ge+Vn-Date.now();clearTimeout(be),be=setTimeout(zn,Math.max(o,0),n===ve?null:t)}function zn(t){var r;if(ge=Date.now(),!y||t===y)return;let e=((r=t==null?void 0:t.closest)==null?void 0:r.call(t,"[data-tooltip]"))||null;if(e===$)return;const n=e&&f(e,"data-tooltip")||"",o=e&&f(e,"data-tooltip-position")||window.getComputedStyle(e||document.body).getPropertyValue(Un)||"top";(!n||n==="false"||n==="true"||o==="none")&&(e=null),e&&(y.textContent=n);const a=$&&f($,q)===G,s=!!(e!=null&&e.innerText.trim())||(e==null?void 0:e.hasAttribute(q))||(e==null?void 0:e.hasAttribute("aria-label"));$==null||$.removeAttribute(a?q:me),H(y,!1),$=e,$&&f($,s?me:q,G),y.togglePopover(!!e),H(y,e,o)}P&&!document.getElementById(G)&&(y=document.body.appendChild(document.createElement("div")),y.classList.add(...Fn),y.id=G,f(y,"popover","manual"),b(document,"blur,focus,mouseout,mouseover",ut,v),b(window,"keydown",ut,v),b(window,"blur",ut,v));var ye=typeof window<"u"&&typeof window.document<"u"&&typeof window.navigator<"u",Ee;ye&&/^Mac/i.test(((Ee=navigator.userAgentData)==null?void 0:Ee.platform)||navigator.platform);var Yn=":host(:not([hidden])) { display: block }",$e=typeof HTMLElement>"u"?class{}:HTMLElement;function I(t,e,n){var o;return n===void 0?(o=t.getAttribute(e))!=null?o:null:(n===null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n),null)}var Te=(t,e,n)=>{for(const o of n[0].split(","))n[0]=o,Element.prototype[`${t}EventListener`].apply(e,n)},we=(t,...e)=>Te("add",t,e),Se=(t,...e)=>Te("remove",t,e),Kn=t=>{const e="key"in t&&(t.key===" "||t.key==="Enter");return e&&t.preventDefault(),e&&t.target instanceof HTMLElement&&t.target.click(),e},jn=t=>{var e;const n=((e=t.getRootNode)==null?void 0:e.call(t))||t.ownerDocument;return n instanceof Document||n instanceof ShadowRoot?n:document},ct=(t,e,n)=>{const o=document.createElement(t);if(e&&(o.textContent=e),n)for(const[i,a]of Object.entries(n))I(o,i,a);return o},Ie={define:(t,e)=>!ye||window.customElements.get(t)||window.customElements.define(t,e)},Wn=class extends $e{constructor(){super(),this._content=null,this.attachShadow({mode:"open"}).append(ct("slot",null,{name:"summary"}),ct("slot",null,{part:"details-content"}),ct("style",`${Yn}
|
|
2
2
|
::slotted(u-summary) { cursor: pointer; display: list-item; counter-increment: list-item 0; list-style: disclosure-closed inside }
|
|
3
3
|
::slotted(u-summary[aria-expanded="true"]) { list-style-type: disclosure-open }
|
|
4
|
-
:host > [part="details-content"]:not([hidden=""]) { display: block }`))}static get observedAttributes(){return["open"]}connectedCallback(){var t;this._content=(t=this.shadowRoot)==null?void 0:t.children[1],Lt(this._content,"beforematch",this),Lt(this,"click,keydown",this),this.attributeChangedCallback()}disconnectedCallback(){this._content&&Ct(this._content,"beforematch",this),Ct(this,"click,keydown",this),this._content=null}attributeChangedCallback(t,e,o){const n="onbeforematch"in this?"until-found":!0,s=this.open;for(const c of this.children)c.nodeName==="U-SUMMARY"&&v(c,"aria-expanded",`${s}`);if(this._content&&(v(this._content,"aria-hidden",`${!s}`),this._content.hidden=s?!1:n),s&&this.name){const c=ce(this).querySelectorAll(`${this.nodeName}[name="${this.name}"]`);for(const i of c)i!==this&&(i.open=!1)}t==="open"&&e===null!=(o===null)&&this.dispatchEvent(new Event("toggle"))}handleEvent(t){const e=this.querySelector(":scope > u-summary"),o=e==null?void 0:e.contains(t.target);t.defaultPrevented||(t.type==="beforematch"&&(this.open=!0),o&&t.type==="keydown"&&ie(t),o&&t.type==="click"&&(this.open=!this.open))}get open(){return this.hasAttribute("open")}set open(t){v(this,"open",t?"":null)}get name(){return v(this,"name")||""}set name(t){v(this,"name",t)}},le=class extends kt{connectedCallback(){v(this,"role","button"),this.slot="summary",this.tabIndex=0}};Mt.define("u-details",ae),Mt.define("u-summary",le);const It=({clientX:t,clientY:e,target:o})=>{var n;if(o instanceof HTMLDialogElement&&a(o,"data-closedby")==="any"){const{top:s,right:c,bottom:i,left:r}=o.getBoundingClientRect();s<=e&&e<=i&&r<=t&&t<=c||o.close()}else o instanceof Element&&o.closest('button[data-command="close"]')&&((n=o==null?void 0:o.closest("dialog"))==null||n.close())};function re(t){u(t,"click",It,l)}function de(t){w(t,"click",It,l)}const D=d.field.split(" ")[0],ue="--mtds-text-count-over",fe="--mtds-text-count-under",jt=d.validation.split(" "),pe=jt[0];function _e(t){for(const e of t){const o=[],n=[];let s=null,c=!0;for(const i of e.getElementsByTagName("*"))i instanceof HTMLLabelElement?o.push(i):j(i)?s=i:i.classList.contains(pe)?(c=a(i,"data-color")==="success",n.unshift($(i))):i instanceof HTMLParagraphElement&&n.push($(i));if(s){for(const i of o)i.htmlFor=$(s);Ot(s),a(s,"aria-describedby",n.join(" ")),a(s,"aria-invalid",`${!c}`)}}}function At({target:t}){j(t)&&Ot(t)}function Ot(t){var n,s;const e=t==null?void 0:t.nextElementSibling,o=e&&a(e,"data-count");if(e&&o){const c=Number(o)-t.value.length,i=c<0,r=a(e,"aria-live")==="polite",p=window.getComputedStyle(e||t),T=((n=p.getPropertyValue(ue))==null?void 0:n.slice(1,-1))||"",k=((s=p.getPropertyValue(fe))==null?void 0:s.slice(1,-1))||"";if(r!==i){a(e,"aria-live",i?"polite":"off");for(const h of jt)e.classList.toggle(h,i)}e.textContent=(i?T:k).replace("%d",`${Math.abs(c)}`)}}function Dt(t){var e,o;(o=(e=t.target)==null?void 0:e.closest)!=null&&o.call(e,`.${D}`)&&t.preventDefault()}function me(t){b(t,D,_e),u(t,"input",At,l),u(t,"invalid",Dt,!0)}function he(t){b(t,D,!1),w(t,"input",At,l),w(t,"invalid",Dt,!0)}const Pt=d.fieldset.split(" ")[0],be=d.validation.split(" ")[0];function ge(t){for(const e of t){const o=[];let n=null;for(const s of e.getElementsByTagName("*"))s.classList.contains(be)?n=$(s):j(s)&&o.push(s);for(const s of o)a(s,"aria-describedby",n),a(s,"aria-invalid",`${!!n}`)}}const ve=t=>b(t,Pt,ge),ye=t=>b(t,Pt,!1),Bt=d.app.split(" ")[0],we=`.${Bt} > header + :not(main) > button:empty:first-child`,Nt=({target:t})=>{const e=(t==null?void 0:t.nodeName)==="BUTTON"&&(t==null?void 0:t.closest(we));if(!e)return;const o=e.closest(`.${Bt} > *`),n=()=>o&&a(o,"data-expanded",`${a(o,"data-expanded")==="false"}`);document.startViewTransition?document.startViewTransition(()=>n()):n()};function Se(t){u(t,"click",Nt,l)}function Te(t){w(t,"click",Nt,l)}const P=d.logo.split(" ")[0];let B;function Rt(t){var i,r,p;const e=(i=t[0])==null?void 0:i.firstElementChild;if(!e)return;if(!B){const{head:T}=((r=window.top)==null?void 0:r.document)||document,k=T.getElementsByTagName("link[rel~='icon']"),h=document.createElement("link");for(const g of k)g.remove();B=T.appendChild(Object.assign(h,{rel:"icon"}))}const o=(p=e.parentElement)==null?void 0:p.hasAttribute("data-color"),n=window.getComputedStyle(e),s=n.getPropertyValue("color"),c=n.getPropertyValue("background-color");B.href=`data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 55 55'><rect fill='${o?"none":c}' width='51' height='51' x='2' y='2' stroke='${s}' stroke-dasharray='0.09 6.38' stroke-linecap='round' stroke-opacity='${o?.6:0}' stroke-width='2.3' rx='25.5'/><g transform="translate(7.5 7.5)">${encodeURIComponent(e.outerHTML.replace(/(fill|width|height|xmlns)=\S+/gi,"").replace("<svg",`<svg width="40" height="40" fill="${s}"`))}</g></svg>`}x&&setTimeout(()=>Rt(document.getElementsByClassName(P)),300);const xe=t=>b(t,P,Rt),Ee=t=>b(t,P,!1),Ht=d.popover.split(" ")[0];function ke(t){u(t,"toggle",Vt,l),u(t,"click",Ut)}function $e(t){w(t,"toggle",Vt,l),w(t,"click",Ut)}function Vt({target:t,newState:e}){var o;if(t instanceof HTMLElement&&t.classList.contains(Ht)){const n=(o=t.getRootNode())==null?void 0:o.querySelector(`[popovertarget="${t.id}"]`);e==="closed"?E(t,!1):n&&E(t,n,a(t,"data-position")||"bottom")}}function Ut({target:t}){var o,n;const e=(o=t==null?void 0:t.closest)==null?void 0:o.call(t,"a");if(e){const s=e.getRootNode(),c=((n=s.getElementById)==null?void 0:n.call(s,a(e,"popovertarget")||""))||e.closest(`.${Ht}`),i=a(e,"popovertargetaction")||"toggle";c==null||c.togglePopover(i==="show"||(i==="hide"?!1:void 0))}}const Yt=d.table.split(" ")[0];function Le(t){for(const e of t){const o=[];a(e,"role","table"),e.caption&&a(e.caption,"role","caption");for(const n of[e.tHead,e.tFoot,...e.tBodies])if(n){a(n,"role","rowgroup");const s=n.nodeName==="TBODY";for(const c of n.rows){a(c,"role","row");for(const i of c.cells)s?a(i,"data-th",o[i.cellIndex]||":empty"):o.push(i.innerText.trim()),i.nodeName==="TD"?a(i,"role","cell"):(a(i,"role",s?"rowheader":"columnheader"),a(i,"scope",s?"row":"col"))}}}}const Ce=t=>b(t,Yt,Le),Me=t=>b(t,Yt,!1);if(x){const t=document.readyState==="loading",e=()=>Ft(document.body);t?document.addEventListener("DOMContentLoaded",e):e()}function Ft(t){re(t),me(t),ve(t),Se(t),xe(t),ke(t),Ce(t)}function Ie(t){de(t),he(t),ye(t),Te(t),Ee(t),$e(t),Me(t)}return y.observe=Ft,y.pagination=zt,y.styles=Gt,y.unobserve=Ie,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}),y}({});
|
|
4
|
+
:host > [part="details-content"]:not([hidden=""]) { display: block }`))}static get observedAttributes(){return["open"]}connectedCallback(){var t;this._content=(t=this.shadowRoot)==null?void 0:t.children[1],we(this._content,"beforematch",this),we(this,"click,keydown",this),this.attributeChangedCallback()}disconnectedCallback(){this._content&&Se(this._content,"beforematch",this),Se(this,"click,keydown",this),this._content=null}attributeChangedCallback(t,e,n){const o="onbeforematch"in this?"until-found":!0,i=this.open;for(const a of this.children)a.nodeName==="U-SUMMARY"&&I(a,"aria-expanded",`${i}`);if(this._content&&(I(this._content,"aria-hidden",`${!i}`),this._content.hidden=i?!1:o),i&&this.name){const a=jn(this).querySelectorAll(`${this.nodeName}[name="${this.name}"]`);for(const s of a)s!==this&&(s.open=!1)}t==="open"&&e===null!=(n===null)&&this.dispatchEvent(new Event("toggle"))}handleEvent(t){const e=this.querySelector(":scope > u-summary"),n=e==null?void 0:e.contains(t.target);t.defaultPrevented||(t.type==="beforematch"&&(this.open=!0),n&&t.type==="keydown"&&Kn(t),n&&t.type==="click"&&(this.open=!this.open))}get open(){return this.hasAttribute("open")}set open(t){I(this,"open",t?"":null)}get name(){return I(this,"name")||""}set name(t){I(this,"name",t)}},Xn=class extends $e{connectedCallback(){I(this,"role","button"),this.slot="summary",this.tabIndex=0}};Ie.define("u-details",Wn),Ie.define("u-summary",Xn);const Ce=({clientX:t,clientY:e,target:n})=>{var o;if(n instanceof HTMLDialogElement&&f(n,"data-closedby")==="any"){const{top:i,right:a,bottom:s,left:r}=n.getBoundingClientRect();i<=e&&e<=s&&r<=t&&t<=a||n.close()}else n instanceof Element&&n.closest('button[data-command="close"]')&&((o=n==null?void 0:n.closest("dialog"))==null||o.close())};function qn(t){b(t,"click",Ce,v)}function Gn(t){L(t,"click",Ce,v)}var Qn=Object.defineProperty,xe=Object.getOwnPropertySymbols,Jn=Object.prototype.hasOwnProperty,Zn=Object.prototype.propertyIsEnumerable,Le=(t,e,n)=>e in t?Qn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,to=(t,e)=>{for(var n in e||(e={}))Jn.call(e,n)&&Le(t,n,e[n]);if(xe)for(var n of xe(e))Zn.call(e,n)&&Le(t,n,e[n]);return t},C=typeof window<"u"&&typeof window.document<"u"&&typeof window.navigator<"u",eo=C&&/android/i.test(navigator.userAgent),ft=C&&/iPad|iPhone|iPod/.test(navigator.userAgent),Ae=C&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),ke;C&&/^Mac/i.test(((ke=navigator.userAgentData)==null?void 0:ke.platform)||navigator.platform);var no=`${eo?"data":"aria"}-labelledby`,Oe=`${Ae?"aria":"data"}-multiselectable`,Me=":host(:not([hidden])) { display: block }",oo="outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color",De=typeof HTMLElement>"u"?class{}:HTMLElement;function p(t,e,n){var o;return n===void 0?(o=t.getAttribute(e))!=null?o:null:(n===null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n),null)}var Pe=(t,e,n)=>{for(const o of n[0].split(","))n[0]=o,Element.prototype[`${t}EventListener`].apply(e,n)},pt=(t,...e)=>Pe("add",t,e),ht=(t,...e)=>Pe("remove",t,e),Re=(t,e)=>t.attachShadow({mode:"open"}).append(mt("slot"),mt("style",e)),Q=new WeakMap,He=(t,e)=>{if(e===void 0)return Q.get(t);try{Q.get(t).disconnect(),Q.delete(t)}catch{}if(e){const n=new MutationObserver(o=>t.handleEvent({type:"mutation",detail:o}));n.observe(t,e),Q.set(t,n)}},Ne=t=>{var e;const n=((e=t.getRootNode)==null?void 0:e.call(t))||t.ownerDocument;return n instanceof Document||n instanceof ShadowRoot?n:document},io=0,_t=t=>t?(t.id||(t.id=`:${t.nodeName.toLowerCase()}${(++io).toString(32)}`),t.id):"",mt=(t,e,n)=>{const o=document.createElement(t);return e&&(o.textContent=e),o},Be={define:(t,e)=>!C||window.customElements.get(t)||window.customElements.define(t,e)},so=t=>{if(!C)return null;const e=mt("div");return e.style.cssText="position:fixed;overflow:hidden;width:1px;white-space:nowrap",p(e,"aria-live",t),document.body.appendChild(e)};function Fe(t,e,n){if(!e)return Object.keys(t).map(i=>`data-sr-${i}`);const o=(e==null?void 0:e.startsWith("data-sr-"))&&e.slice(8);return o&&n&&t[o]&&(t[o]=n),[]}var vt="disabled",N="selected",ao=class extends De{static get observedAttributes(){return[vt,N]}constructor(){super(),Re(this,`${Me}:host(:focus){${oo}}:host{ cursor: pointer }`)}connectedCallback(){ft||(this.tabIndex=-1),p(this,"role")||p(this,"role","option"),this.attributeChangedCallback()}attributeChangedCallback(){p(this,"aria-disabled",`${this.disabled}`),p(this,"aria-selected",`${this.selected}`)}get defaultSelected(){return this[N]}set defaultSelected(e){this[N]=e}get disabled(){return p(this,vt)!==null}set disabled(e){p(this,vt,e?"":null)}get form(){return this.closest("form")}get index(){var e;const n=(e=this.closest("u-datalist"))==null?void 0:e.getElementsByTagName("u-option");return Array.from(n||[this]).indexOf(this)}get label(){return p(this,"label")||this.text}set label(e){p(this,"label",e)}get selected(){return p(this,N)!==null}set selected(e){p(this,N,e?"":null)}get text(){var e;return((e=this.textContent)==null?void 0:e.trim())||""}set text(e){this.textContent=e}get value(){return p(this,"value")||this.text}set value(e){p(this,"value",e)}};Be.define("u-option",ao);var gt=!1,Ue,ro=0,B=so("assertive"),lo=Ae&&!ft,Ve="click,focusout,input,keydown,mousedown,mouseup",ze={singular:"%d hit",plural:"%d hits"},Ye=class extends De{constructor(){super(),this._blurTimer=0,this._input=null,this._root=null,this._value="",this._texts=to({},ze),Re(this,`${Me}::slotted(u-option[disabled]) { display: none !important }`)}static get observedAttributes(){return["id",...Fe(ze)]}connectedCallback(){this.hidden=!0,this._root=Ne(this),B&&!B.isConnected&&document.body.append(B),p(this,"role","listbox"),pt(this._root,"focusin",this),pt(this._root,"focus",this,!0),setTimeout(()=>this.attributeChangedCallback())}disconnectedCallback(){ht(this._root||this,"focus",this,!0),ht(this._root||this,"focusin",this),bt(this),this._root=null}attributeChangedCallback(e,n,o){var i;Fe(this._texts,e,o);const a=(i=this._root)==null?void 0:i.querySelectorAll(`input[list="${this.id}"]`);for(const s of a||[])je(this,s)}handleEvent(e){const{type:n}=e;e.defaultPrevented||(n==="click"&&fo(this,e),(n==="focus"||n==="focusin")&&uo(this,e),n==="focusout"&&co(this),n==="keydown"&&po(this,e),(n==="mutation"||n==="input")&&Xe(this,e),n==="mouseup"&&(gt=!1),n==="mousedown"&&(gt=this.contains(e.target)))}get options(){return this.getElementsByTagName("u-option")}},uo=(t,{target:e})=>{var n;const o=t._input===e;if(o||t.contains(e))return clearTimeout(t._blurTimer);!o&&e instanceof HTMLInputElement&&p(e,"list")===t.id&&(t._input&&bt(t),t._input=e,p(t,no,_t((n=t._input.labels)==null?void 0:n[0])),pt(t._root||t,Ve,t),He(t,{attributeFilter:["value"],attributes:!0,childList:!0,subtree:!0}),k(t,!0))},co=t=>{gt||(t._blurTimer=setTimeout(()=>bt(t)))},fo=(t,{target:e})=>{var n,o,i,a,s;const r=p(t,Oe)!=="true",d=[...t.options].find(l=>l.contains(e));if(t._input===e)k(t,!0);else if(d&&J(d)){for(const l of t.options)l===d?l.selected=!0:r&&(l.selected=!1);(o=(n=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:n.set)==null||o.call(t._input,d.value),r&&((i=t._input)==null||i.focus(),k(t,!1)),(a=t._input)==null||a.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),(s=t._input)==null||s.dispatchEvent(new Event("change",{bubbles:!0}))}},po=(t,e)=>{var n,o;if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;e.key!=="Escape"&&k(t,!0);const{key:i}=e,a=(n=t._root)==null?void 0:n.activeElement,s=Ke(t),r=s.indexOf(a);let d=-1;if(i==="ArrowDown"&&(d=(r+1)%s.length),i==="ArrowUp"&&(d=(~r?r:s.length)-1),~r&&((i==="Home"||i==="PageUp")&&(d=0),(i==="End"||i==="PageDown")&&(d=s.length-1),i==="Enter"))return s[r].click(),e.preventDefault();if(s[d])for(const l of s)l.tabIndex=-1;s[d]&&e.preventDefault(),(o=s[d]||t._input)==null||o.focus(),i==="Escape"&&k(t,!1)},k=(t,e)=>{t.hidden=!e,t.popover&&t.togglePopover(e),t._input&&je(t,t._input,e),e&&Xe(t)},bt=t=>{ht(t._root||t,Ve,t),He(t,!1),k(t,!1),t._input=null},Ke=t=>[...t.options].filter(e=>!e.disabled&&e.offsetWidth&&e.offsetHeight),J=t=>t instanceof HTMLOptionElement||t.getAttribute("role")==="option",je=(t,e,n=!1)=>{p(e,"popovertarget",_t(t)),p(e,"aria-autocomplete","list"),p(e,"aria-controls",_t(t)),p(e,"aria-expanded",`${lo||n}`),p(e,"autocomplete","off"),p(e,"role","combobox")},We=t=>(t==null?void 0:t.toLowerCase().trim())||"",Xe=(t,e)=>{var n;const o=We((n=t._input)==null?void 0:n.value);if(!((e==null?void 0:e.type)==="mutation"||t._value!==o))return;const a=t.hidden,s=p(t,Oe)!=="true",r=e instanceof InputEvent&&!mo(e);t.hidden=!0,t._value=o;for(const l of t.options){const u=[l.value,l.label,l.text].map(We);l.hidden=!u.some(h=>h.includes(o)),s&&r&&J(l)&&(l.selected=u.includes(o))}t.hidden=a;const d=Ke(t);clearTimeout(Ue),Ue=setTimeout(()=>{const{length:l}=d.filter(J),u=++ro%2?" ":"",h=`${`${t._texts[l===1?"singular":"plural"]}`.replace("%d",`${l}`)}`;B&&(B.textContent=`${!l&&t.innerText.trim()||h}${u}`)},1e3),ft&&d.map((l,u,h)=>{l.title=`${u+1}/${h}`})};C&&Object.defineProperty(HTMLInputElement.prototype,"list",{configurable:!0,enumerable:!0,get(){return Ne(this).getElementById(p(this,"list")||"")}}),Be.define("u-datalist",Ye);var ho=" ".repeat(100),_o="insertReplacementText";function mo(t){var e;const n=t instanceof Event&&t.type==="input"&&t.target instanceof HTMLInputElement&&(!t.inputType||t.inputType===_o);if(n){const o=t.target.value,i=Array.from(((e=t.target.list)==null?void 0:e.options)||[]).some(a=>a.value===o&&!J(a));t.target.value=o.split(ho)[i?1:0]}return n}var vo=Object.defineProperty,qe=Object.getOwnPropertySymbols,go=Object.prototype.hasOwnProperty,bo=Object.prototype.propertyIsEnumerable,Ge=(t,e,n)=>e in t?vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qe=(t,e)=>{for(var n in e||(e={}))go.call(e,n)&&Ge(t,n,e[n]);if(qe)for(var n of qe(e))bo.call(e,n)&&Ge(t,n,e[n]);return t},w=typeof window<"u"&&typeof window.document<"u"&&typeof window.navigator<"u",Je=w&&/android/i.test(navigator.userAgent),yo=w&&/firefox/i.test(navigator.userAgent),Z=w&&/iPad|iPhone|iPod/.test(navigator.userAgent),Ze=w&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),tn,Eo=w&&/^Mac/i.test(((tn=navigator.userAgentData)==null?void 0:tn.platform)||navigator.platform),$o=`${Je?"data":"aria"}-labelledby`,yt=`${Ze?"aria":"data"}-multiselectable`,en=":host(:not([hidden])) { display: block }",nn="outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color",Et=typeof HTMLElement>"u"?class{}:HTMLElement;function c(t,e,n){var o;return n===void 0?(o=t.getAttribute(e))!=null?o:null:(n===null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n),null)}var on=(t,e,n)=>{for(const o of n[0].split(","))n[0]=o,Element.prototype[`${t}EventListener`].apply(e,n)},F=(t,...e)=>on("add",t,e),U=(t,...e)=>on("remove",t,e),sn=(t,e)=>t.attachShadow({mode:"open"}).append(O("slot"),O("style",e)),tt=new WeakMap,et=(t,e)=>{if(e===void 0)return tt.get(t);try{tt.get(t).disconnect(),tt.delete(t)}catch{}if(e){const n=new MutationObserver(o=>t.handleEvent({type:"mutation",detail:o}));n.observe(t,e),tt.set(t,n)}},To=t=>{const e="key"in t&&(t.key===" "||t.key==="Enter");return e&&t.preventDefault(),e&&t.target instanceof HTMLElement&&t.target.click(),e},nt=t=>{var e;const n=((e=t.getRootNode)==null?void 0:e.call(t))||t.ownerDocument;return n instanceof Document||n instanceof ShadowRoot?n:document},wo=0,$t=t=>t?(t.id||(t.id=`:${t.nodeName.toLowerCase()}${(++wo).toString(32)}`),t.id):"",O=(t,e,n)=>{const o=document.createElement(t);if(e&&(o.textContent=e),n)for(const[i,a]of Object.entries(n))c(o,i,a);return o},Tt={define:(t,e)=>!w||window.customElements.get(t)||window.customElements.define(t,e)},an=t=>{if(!w)return null;const e=O("div");return e.style.cssText="position:fixed;overflow:hidden;width:1px;white-space:nowrap",c(e,"aria-live",t),document.body.appendChild(e)};function ot(t,e,n){if(!e)return Object.keys(t).map(i=>`data-sr-${i}`);const o=(e==null?void 0:e.startsWith("data-sr-"))&&e.slice(8);return o&&n&&t[o]&&(t[o]=n),[]}var wt="disabled",V="selected",So=class extends Et{static get observedAttributes(){return[wt,V]}constructor(){super(),sn(this,`${en}:host(:focus){${nn}}:host{ cursor: pointer }`)}connectedCallback(){Z||(this.tabIndex=-1),c(this,"role")||c(this,"role","option"),this.attributeChangedCallback()}attributeChangedCallback(){c(this,"aria-disabled",`${this.disabled}`),c(this,"aria-selected",`${this.selected}`)}get defaultSelected(){return this[V]}set defaultSelected(t){this[V]=t}get disabled(){return c(this,wt)!==null}set disabled(t){c(this,wt,t?"":null)}get form(){return this.closest("form")}get index(){var t;const e=(t=this.closest("u-datalist"))==null?void 0:t.getElementsByTagName("u-option");return Array.from(e||[this]).indexOf(this)}get label(){return c(this,"label")||this.text}set label(t){c(this,"label",t)}get selected(){return c(this,V)!==null}set selected(t){c(this,V,t?"":null)}get text(){var t;return((t=this.textContent)==null?void 0:t.trim())||""}set text(t){this.textContent=t}get value(){return c(this,"value")||this.text}set value(t){c(this,"value",t)}};Tt.define("u-option",So);var St=!1,rn,Io=0,z=an("assertive"),Co=Ze&&!Z,ln="click,focusout,input,keydown,mousedown,mouseup",dn={singular:"%d hit",plural:"%d hits"},xo=class extends Et{constructor(){super(),this._blurTimer=0,this._input=null,this._root=null,this._value="",this._texts=Qe({},dn),sn(this,`${en}::slotted(u-option[disabled]) { display: none !important }`)}static get observedAttributes(){return["id",...ot(dn)]}connectedCallback(){this.hidden=!0,this._root=nt(this),z&&!z.isConnected&&document.body.append(z),c(this,"role","listbox"),F(this._root,"focusin",this),F(this._root,"focus",this,!0),setTimeout(()=>this.attributeChangedCallback())}disconnectedCallback(){U(this._root||this,"focus",this,!0),U(this._root||this,"focusin",this),It(this),this._root=null}attributeChangedCallback(t,e,n){var o;ot(this._texts,t,n);const i=(o=this._root)==null?void 0:o.querySelectorAll(`input[list="${this.id}"]`);for(const a of i||[])cn(this,a)}handleEvent(t){const{type:e}=t;t.defaultPrevented||(e==="click"&&ko(this,t),(e==="focus"||e==="focusin")&&Lo(this,t),e==="focusout"&&Ao(this),e==="keydown"&&Oo(this,t),(e==="mutation"||e==="input")&&pn(this,t),e==="mouseup"&&(St=!1),e==="mousedown"&&(St=this.contains(t.target)))}get options(){return this.getElementsByTagName("u-option")}},Lo=(t,{target:e})=>{var n;const o=t._input===e;if(o||t.contains(e))return clearTimeout(t._blurTimer);!o&&e instanceof HTMLInputElement&&c(e,"list")===t.id&&(t._input&&It(t),t._input=e,c(t,$o,$t((n=t._input.labels)==null?void 0:n[0])),F(t._root||t,ln,t),et(t,{attributeFilter:["value"],attributes:!0,childList:!0,subtree:!0}),M(t,!0))},Ao=t=>{St||(t._blurTimer=setTimeout(()=>It(t)))},ko=(t,{target:e})=>{var n,o,i,a,s;const r=c(t,yt)!=="true",d=[...t.options].find(l=>l.contains(e));if(t._input===e)M(t,!0);else if(d&&it(d)){for(const l of t.options)l===d?l.selected=!0:r&&(l.selected=!1);(o=(n=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:n.set)==null||o.call(t._input,d.value),r&&((i=t._input)==null||i.focus(),M(t,!1)),(a=t._input)==null||a.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),(s=t._input)==null||s.dispatchEvent(new Event("change",{bubbles:!0}))}},Oo=(t,e)=>{var n,o;if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;e.key!=="Escape"&&M(t,!0);const{key:i}=e,a=(n=t._root)==null?void 0:n.activeElement,s=un(t),r=s.indexOf(a);let d=-1;if(i==="ArrowDown"&&(d=(r+1)%s.length),i==="ArrowUp"&&(d=(~r?r:s.length)-1),~r&&((i==="Home"||i==="PageUp")&&(d=0),(i==="End"||i==="PageDown")&&(d=s.length-1),i==="Enter"))return s[r].click(),e.preventDefault();if(s[d])for(const l of s)l.tabIndex=-1;s[d]&&e.preventDefault(),(o=s[d]||t._input)==null||o.focus(),i==="Escape"&&M(t,!1)},M=(t,e)=>{t.hidden=!e,t.popover&&t.togglePopover(e),t._input&&cn(t,t._input,e),e&&pn(t)},It=t=>{U(t._root||t,ln,t),et(t,!1),M(t,!1),t._input=null},un=t=>[...t.options].filter(e=>!e.disabled&&e.offsetWidth&&e.offsetHeight),it=t=>t instanceof HTMLOptionElement||t.getAttribute("role")==="option",cn=(t,e,n=!1)=>{c(e,"popovertarget",$t(t)),c(e,"aria-autocomplete","list"),c(e,"aria-controls",$t(t)),c(e,"aria-expanded",`${Co||n}`),c(e,"autocomplete","off"),c(e,"role","combobox")},fn=t=>(t==null?void 0:t.toLowerCase().trim())||"",pn=(t,e)=>{var n;const o=fn((n=t._input)==null?void 0:n.value);if(!((e==null?void 0:e.type)==="mutation"||t._value!==o))return;const a=t.hidden,s=c(t,yt)!=="true",r=e instanceof InputEvent&&!_n(e);t.hidden=!0,t._value=o;for(const l of t.options){const u=[l.value,l.label,l.text].map(fn);l.hidden=!u.some(h=>h.includes(o)),s&&r&&it(l)&&(l.selected=u.includes(o))}t.hidden=a;const d=un(t);clearTimeout(rn),rn=setTimeout(()=>{const{length:l}=d.filter(it),u=++Io%2?" ":"",h=`${`${t._texts[l===1?"singular":"plural"]}`.replace("%d",`${l}`)}`;z&&(z.textContent=`${!l&&t.innerText.trim()||h}${u}`)},1e3),Z&&d.map((l,u,h)=>{l.title=`${u+1}/${h}`})};w&&Object.defineProperty(HTMLInputElement.prototype,"list",{configurable:!0,enumerable:!0,get(){return nt(this).getElementById(c(this,"list")||"")}}),Tt.define("u-datalist",xo);var hn=" ".repeat(100),Mo="insertReplacementText",Ct=({value:t})=>t.split(hn)[0];function _n(t){var e;const n=t instanceof Event&&t.type==="input"&&t.target instanceof HTMLInputElement&&(!t.inputType||t.inputType===Mo);if(n){const o=t.target.value,i=Array.from(((e=t.target.list)==null?void 0:e.options)||[]).some(a=>a.value===o&&!it(a));t.target.value=o.split(hn)[i?1:0]}return n}var Do=Je||Z,Po=yo||Eo,Y=an("polite"),mn="input,focusin,focusout,keydown",vn={added:"Added",remove:"Press to remove",removed:"Removed",empty:"No selected",found:"Navigate left to find %d selected",of:"of"},Ro=class extends Et{constructor(){super(),this._blurAnnounceReset=!1,this._blurTimer=0,this._focusIndex=null,this._root=null,this._texts=Qe({},vn),this.attachShadow({mode:"open"}).append(O("slot"),O("style",`:host(:not([hidden])){ display: inline-block }
|
|
5
|
+
::slotted(data) { cursor: pointer; display: inline-block; outline: none; pointer-events: none }
|
|
6
|
+
::slotted(data)::after { content: '\\00D7'; content: '\\00D7' / ''; padding-inline: .5ch; pointer-events: auto }
|
|
7
|
+
::slotted(data:focus)::after { ${nn} }`))}static get observedAttributes(){return ot(vn)}connectedCallback(){this._root=nt(this),Y&&!Y.isConnected&&document.body.append(Y),et(this,{childList:!0}),F(this._root,"click",this),F(this,mn,this),setTimeout(()=>st(this))}attributeChangedCallback(t,e,n){ot(this._texts,t,n)}disconnectedCallback(){et(this,!1),U(this._root||this,"click",this),U(this,mn,this),this._root=null}handleEvent(t){t.defaultPrevented||(t.type==="click"&&Bo(this,t),t.type==="focusin"&&Ho(this,t),t.type==="focusout"&&No(this),t.type==="input"&&Fo(this,t),t.type==="keydown"&&Uo(this,t),t.type==="mutation"&&st(this,t))}get items(){return this.querySelectorAll("data")}get control(){return this.querySelector("input")}},xt=(t,e)=>t.dispatchEvent(new CustomEvent("tags",{bubbles:!0,cancelable:!0,detail:{item:e,action:e.isConnected?"remove":"add"}})),st=(t,e)=>{var n,o,i,a,s;const r=t._texts,d=Number.isNaN(t._focusIndex)?null:e==null?void 0:e.detail[0],l=(d==null?void 0:d.addedNodes[0])||(d==null?void 0:d.removedNodes[0]),u=`${l?`${l.isConnected?r.added:r.removed} ${l.textContent}, `:""}`,h=((i=(o=(n=t.control)==null?void 0:n.labels)==null?void 0:o[0])==null?void 0:i.textContent)||"",m=[];c(t,"role","group"),c(t,"aria-label",h),t.items.forEach((_,K,{length:j})=>{var rt;const lt=`${u}${_.textContent}, ${r.remove}, ${K+1} ${r.of} ${j}`;c(_,"aria-label",lt),c(_,"role","button"),_.tabIndex=-1,_.value=_.value||((rt=_.textContent)==null?void 0:rt.trim())||"",m.push(_.value)});const S=t.control,Ot=`${u}${h}, ${m.length?r.found.replace("%d",`${m.length}`):r.empty}`,D=S&&document.getElementById(c(S,"list")||""),at=D==null?void 0:D.children;S&&c(S,"aria-label",Ot),D&&c(D,yt,"true");for(const _ of at||[])_.selected=m.includes(Ct(_));if(u){const _=t.items[(t._focusIndex||1)-1]||S,K=_===((a=nt(t))==null?void 0:a.activeElement),j=at||t.items;t._blurAnnounceReset=!1,_===S?(K&&(Do&&Y?Y.textContent=u:(s=j[0])==null||s.focus()),setTimeout(()=>_==null?void 0:_.focus(),100)):_==null||_.focus(),setTimeout(()=>{if(!Po)return st(t);t._blurAnnounceReset=!0},500)}},Ho=(t,{target:e})=>{clearTimeout(t._blurTimer),t._focusIndex=[...t.items].indexOf(e)},No=t=>{t._blurAnnounceReset&&st(t),t._blurTimer=setTimeout(()=>{t._focusIndex=null})},Bo=(t,{target:e,clientX:n,clientY:o})=>{var i;const a=t.contains(e)?[...t.items]:null,s=a==null?void 0:a.find(d=>d.contains(e)),r=a==null?void 0:a.find(d=>{const{top:l,right:u,bottom:h,left:m}=d.getBoundingClientRect();return o>=l&&o<=h&&n>=m&&n<=u});s?xt(t,s)&&s.remove():r?r.focus():e===t&&((i=t.control)==null||i.focus())},Fo=(t,e)=>{var n;const o=e.target;if(!_n(e)||!(o!=null&&o.value.trim()))return;const i=Ct(o),a=[...t.items],r=[...((n=o==null?void 0:o.list)==null?void 0:n.children)||[]].find(u=>Ct(u)===i),d=a.find(u=>u.value===i),l=O("data",(r==null?void 0:r.text)||i,{value:i});if(o.value="",!!xt(t,d||l)){if(d)return d.remove();if(!a[0])return t.prepend(l);a[a.length-1].insertAdjacentElement("afterend",l)}},Uo=(t,e)=>{var n,o;const{key:i,repeat:a,target:s}=e,r=t.control===s?t.control:null,d=r==null?void 0:r.selectionEnd;let l=r?t.items.length:(n=t._focusIndex)!=null?n:-1;if(!(l===-1||!r&&To(e))){if(i==="ArrowRight"&&!r)l+=1;else if(i==="ArrowLeft"&&!d)l-=1;else{if(i==="Enter"&&r)return e.preventDefault(),r.dispatchEvent(new Event("input",{bubbles:!0}));if((i==="Backspace"||i==="Delete")&&!d){const u=!a&&t.items[l];if(e.preventDefault(),u)return xt(t,u)&&u.remove();r&&(l-=1)}else return}e.preventDefault(),(o=t.items[Math.max(0,l)]||t.control)==null||o.focus()}};Tt.define("u-tags",Ro);const Lt=g.field.split(" ")[0],Vo="--mtds-text-count-over",zo="--mtds-text-count-under",gn=g.validation.split(" "),Yo=gn[0];function Ko(t){for(const e of t){const n=[],o=[];let i=null,a=null,s=!0;for(const r of e.getElementsByTagName("*"))r instanceof HTMLLabelElement?n.push(r):r instanceof Ye?a=r:dt(r)?i=r:r.classList.contains(Yo)?(s=f(r,"data-color")==="success",o.unshift(R(r))):r instanceof HTMLParagraphElement&&o.push(R(r));if(i){for(const r of n)r.htmlFor=R(i);jo(i,a),yn(i),bn(i),f(i,"aria-describedby",o.join(" ")),f(i,"aria-invalid",`${!s}`)}}}function bn(t){t instanceof HTMLTextAreaElement&&(t.style.height="auto",t.style.height=`${t.scrollHeight}px`)}function jo(t,e){if(f(t,"list",e?R(e):null),!e)return;t.hasAttribute("placeholder")||f(t,"placeholder","");const n=window.getComputedStyle(e),o=n.getPropertyValue("--mtds-text-datalist-singular"),i=n.getPropertyValue("--mtds-text-datalist-plural");f(e,"data-sr-plural",i),f(e,"data-sr-singular",o)}function yn(t){var o,i;const e=t==null?void 0:t.nextElementSibling,n=e&&f(e,"data-count");if(e&&n){const a=Number(n)-t.value.length,s=a<0,r=f(e,"aria-live")==="polite",d=window.getComputedStyle(e||t),l=((o=d.getPropertyValue(Vo))==null?void 0:o.slice(1,-1))||"",u=((i=d.getPropertyValue(zo))==null?void 0:i.slice(1,-1))||"";if(r!==s){f(e,"aria-live",s?"polite":"off");for(const h of gn)e.classList.toggle(h,s)}e.textContent=(s?l:u).replace("%d",`${Math.abs(a)}`)}}function En({target:t}){dt(t)&&(yn(t),bn(t))}function $n(t){var e,n;(n=(e=t.target)==null?void 0:e.closest)!=null&&n.call(e,`.${Lt}`)&&t.preventDefault()}function Wo(t){T(t,Lt,Ko),b(t,"input",En,v),b(t,"invalid",$n,!0)}function Xo(t){T(t,Lt,!1),L(t,"input",En,v),L(t,"invalid",$n,!0)}const Tn=g.fieldset.split(" ")[0],qo=g.validation.split(" ")[0];function Go(t){for(const e of t){const n=[];let o=null;for(const i of e.getElementsByTagName("*"))i.classList.contains(qo)?o=R(i):dt(i)&&n.push(i);for(const i of n)f(i,"aria-describedby",o),f(i,"aria-invalid",`${!!o}`)}}const Qo=t=>T(t,Tn,Go),Jo=t=>T(t,Tn,!1),wn=g.app.split(" ")[0],Zo=`.${wn} > header + :not(main) > button:empty:first-child`,ti="mtds-app-menu",Sn=({target:t})=>{const e=(t==null?void 0:t.nodeName)==="BUTTON"&&(t==null?void 0:t.closest(Zo));if(!e)return;const n=e.closest(`.${wn} > *`),o=`${n&&f(n,"data-expanded")==="false"}`,i=()=>n&&f(n,"data-expanded",o);ei(ti,o),document.startViewTransition?document.startViewTransition(()=>i()):i()};function ei(t,e){try{if(e)window.localStorage.setItem(t,e);else return window.localStorage.getItem(t)}catch{return null}}function ni(t){b(t,"click",Sn,v)}function oi(t){L(t,"click",Sn,v)}const At=g.logo.split(" ")[0];let kt;function In(t){var s,r;const e=(s=t[0])==null?void 0:s.firstElementChild;if(!e)return;if(!kt){const d=document.head.getElementsByTagName("link[rel~='icon']"),l=document.createElement("link");for(const u of d)u.remove();kt=document.head.appendChild(Object.assign(l,{rel:"icon"}))}const n=(r=e.parentElement)==null?void 0:r.hasAttribute("data-color"),o=window.getComputedStyle(e),i=o.getPropertyValue("color"),a=o.getPropertyValue("background-color");kt.href=`data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 55 55'><rect fill='${n?"none":a}' width='51' height='51' x='2' y='2' stroke='${i}' stroke-dasharray='0.09 6.38' stroke-linecap='round' stroke-opacity='${n?.6:0}' stroke-width='2.3' rx='25.5'/><g transform="translate(7.5 7.5)">${encodeURIComponent(e.outerHTML.replace(/(fill|width|height|xmlns)=\S+/gi,"").replace("<svg",`<svg width="40" height="40" fill="${i}"`))}</g></svg>`}P&&setTimeout(()=>In(document.getElementsByClassName(At)),300);const ii=t=>T(t,At,In),si=t=>T(t,At,!1),Cn=g.popover.split(" ")[0];function ai(t){b(t,"toggle",xn,v),b(t,"click",Ln)}function ri(t){L(t,"toggle",xn,v),L(t,"click",Ln)}function xn({target:t,newState:e}){var n;if(t instanceof HTMLElement&&t.classList.contains(Cn)){const o=(n=t.getRootNode())==null?void 0:n.querySelector(`[popovertarget="${t.id}"]`);e==="closed"?H(t,!1):o&&H(t,o,f(t,"data-position")||"bottom")}}function Ln({target:t}){var n,o;const e=(n=t==null?void 0:t.closest)==null?void 0:n.call(t,"a");if(e){const i=e.getRootNode(),a=((o=i.getElementById)==null?void 0:o.call(i,f(e,"popovertarget")||""))||e.closest(`.${Cn}`),s=f(e,"popovertargetaction")||"toggle";a==null||a.togglePopover(s==="show"||(s==="hide"?!1:void 0))}}const An=g.table.split(" ")[0];function li(t){for(const e of t){const n=[];f(e,"role","table"),e.caption&&f(e.caption,"role","caption");for(const o of[e.tHead,e.tFoot,...e.tBodies])if(o){f(o,"role","rowgroup");const i=o.nodeName==="TBODY";for(const a of o.rows){f(a,"role","row");for(const s of a.cells)i?f(s,"data-th",n[s.cellIndex]||":empty"):n.push(s.innerText.trim()),s.nodeName==="TD"?f(s,"role","cell"):(f(s,"role",i?"rowheader":"columnheader"),f(s,"scope",i?"row":"col"))}}}}const di=t=>T(t,An,li),ui=t=>T(t,An,!1);if(P){const t=document.readyState==="loading",e=()=>kn(document.body);t?document.addEventListener("DOMContentLoaded",e):e()}function kn(t){qn(t),Wo(t),Qo(t),ni(t),ii(t),ai(t),di(t)}function ci(t){Gn(t),Xo(t),Jo(t),oi(t),si(t),ri(t),ui(t)}return x.observe=kn,x.pagination=Pn,x.styles=Mn,x.unobserve=ci,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}),x}({});
|
|
5
8
|
//# sourceMappingURL=index.iife.js.map
|