@sortsys/ui 0.1.4 → 0.1.5

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/dist/index.d.ts CHANGED
@@ -99,7 +99,7 @@ interface SSFormContext {
99
99
  process: (action: (context: SSFormContext) => PromiseOr$1<void>) => Promise<void>;
100
100
  field<T = any>(name: string): SSFormField<T> | null;
101
101
  setValues: (values: Record<string, any>) => void;
102
- getValues: () => Record<string, any>;
102
+ getValues: () => Promise<Record<string, any>>;
103
103
  validate: () => Promise<void>;
104
104
  hasError: () => boolean;
105
105
  submit: () => void;
@@ -164,7 +164,7 @@ declare const SSForm: {
164
164
  process: (action: (context: SSFormContext) => PromiseOr$1<void>) => Promise<void>;
165
165
  field<T = any>(name: string): SSFormField<T> | null;
166
166
  setValues: (values: Record<string, any>) => void;
167
- getValues: () => Record<string, any>;
167
+ getValues: () => Promise<Record<string, any>>;
168
168
  validate: () => Promise<void>;
169
169
  hasError: () => boolean;
170
170
  submit: () => void;
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import {template,delegateEvents,insert,memo,effect,setAttribute,use,createComponent,addEventListener,className,spread,mergeProps,style,setStyleProperty,Portal}from'solid-js/web';import {createContext,useContext,createSignal,onMount,onCleanup,createEffect,createUniqueId,For,untrack,createMemo,Show,createResource}from'solid-js';import {useLocation,A,useNavigate}from'@solidjs/router';var wt=template("<button>");function U(e){let t=()=>["ss_button",e.isIconOnly?"ss_button--icon":"",e.class??""].filter(Boolean).join(" ");return (()=>{var r=wt();return addEventListener(r,"click",e.onclick,true),insert(r,()=>e.children),effect(l=>{var i=e.type??"button",n=t(),c=e.disabled,f=e.ariaLabel,v=e.form;return i!==l.e&&setAttribute(r,"type",l.e=i),n!==l.t&&className(r,l.t=n),c!==l.a&&(r.disabled=l.a=c),f!==l.o&&setAttribute(r,"aria-label",l.o=f),v!==l.i&&setAttribute(r,"form",l.i=v),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r})()}delegateEvents(["click"]);var yt=template("<div><span class=ss_callout__icon></span><div class=ss_callout__content><span>");function St(e){let{icon:t,color:r,class:l,style:i,children:n,...c}=e;return (()=>{var f=yt(),v=f.firstChild,g=v.nextSibling,a=g.firstChild;return spread(f,mergeProps(c,{class:`ss_callout ss_callout--${r} ${l??""}`,style:i}),false,true),insert(v,t),insert(a,n),f})()}var Et=template("<button type=button><span class=ss_chip__label>"),Dt=template("<div><span class=ss_chip__label>"),Lt=template('<button type=button class=ss_chip__dismiss aria-label=Entfernen><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-x"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M18 6l-12 12"></path><path d="M6 6l12 12">');function Tt(e){let t=`ss_chip ss_chip--${e.color??"blue"} ${e.class??""}`;return "onclick"in e&&e.onclick?(()=>{var r=Et(),l=r.firstChild;return addEventListener(r,"click",e.onclick,true),className(r,`${t} ss_chip--clickable`),insert(l,()=>e.children),effect(i=>style(r,e.style,i)),r})():(()=>{var r=Dt(),l=r.firstChild;return className(r,t),insert(l,()=>e.children),insert(r,(()=>{var i=memo(()=>!!("ondismiss"in e&&e.ondismiss));return ()=>i()&&(()=>{var n=Lt();return addEventListener(n,"click",e.ondismiss,true),n})()})(),null),effect(i=>style(r,e.style,i)),r})()}delegateEvents(["click"]);var At=template("<div>"),Ht=template('<div class=ss_table__pagination><button type=button class=ss_table__page_button aria-label="Erste Seite"><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left-pipe"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M7 6v12"></path><path d="M18 6l-6 6l6 6"></path></svg></button><button type=button class=ss_table__page_button aria-label="Vorherige Seite"><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M15 6l-6 6l6 6"></path></svg></button><span class=ss_table__page_info>Seite <!> von </span><button type=button class=ss_table__page_button aria-label="N\xE4chste Seite"><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M9 6l6 6l-6 6"></path></svg></button><button type=button class=ss_table__page_button aria-label="Letzte Seite"><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right-pipe"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M6 6l6 6l-6 6"></path><path d="M17 5v13">'),Pt=template("<div><div class=ss_table__scroll><table><thead><tr></tr></thead><tbody>"),Nt=template("<th>"),zt=template("<button type=button class=ss_table__sort_button><span class=ss_table__sort_icon aria-hidden=true>"),Ot=template('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M6 9l6 6l6 -6">'),Vt=template('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-up"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M6 15l6 -6l6 6">'),jt=template('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-selector"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M8 9l4 -4l4 4"></path><path d="M16 15l-4 4l-4 -4">'),qt=template("<span class=ss_table__header_label>"),Yt=template("<tr>"),Rt=template("<td>");function Jt(e){let t=createMemo(()=>e.render(e.row)),[r]=createResource(async()=>{let l=t();return l&&typeof l.then=="function"?await l:null});return (()=>{var l=At();return insert(l,()=>{let i=t();return i&&typeof i.then=="function"?r()??"":i}),l})()}function Wt(e){let[t,r]=createSignal(-1),[l,i]=createSignal(null),[n,c]=createSignal(1),f=()=>Math.max(1,e.pageSize??25),v=createMemo(()=>{let x=t(),M=l();if(x<0||!M)return e.rows;let D=e.columns[x];if(!D?.sortKey)return e.rows;let $=e.rows.map((C,d)=>({row:C,idx:d,key:D.sortKey(C)}));return $.sort((C,d)=>C.key===d.key?C.idx-d.idx:C.key<d.key?M==="asc"?-1:1:M==="asc"?1:-1),$.map(C=>C.row)}),g=createMemo(()=>Math.max(1,Math.ceil(v().length/f()))),a=createMemo(()=>{let M=(Math.min(n(),g())-1)*f();return v().slice(M,M+f())});createEffect(()=>{n()>g()&&c(g());});let s=x=>{if(t()!==x){r(x),i("asc"),c(1);return}if(l()==="asc"){i("desc");return}if(l()==="desc"){r(-1),i(null),c(1);return}i("asc"),c(1);},o=x=>{let M=Math.min(Math.max(1,x),g());c(M);},p=()=>e.paginationPosition??"bottom",k=()=>`ss_table ${p()==="top"?"ss_table--pagination-top":""} ${e.class??""}`,m=()=>(()=>{var x=Ht(),M=x.firstChild,D=M.nextSibling,$=D.nextSibling,C=$.firstChild,d=C.nextSibling;d.nextSibling;var w=$.nextSibling,b=w.nextSibling;return M.$$click=()=>o(1),D.$$click=()=>o(n()-1),insert($,n,d),insert($,g,null),w.$$click=()=>o(n()+1),b.$$click=()=>o(g()),effect(u=>{var h=n()===1,y=n()===1,S=n()===g(),L=n()===g();return h!==u.e&&(M.disabled=u.e=h),y!==u.t&&(D.disabled=u.t=y),S!==u.a&&(w.disabled=u.a=S),L!==u.o&&(b.disabled=u.o=L),u},{e:void 0,t:void 0,a:void 0,o:void 0}),x})();return (()=>{var x=Pt(),M=x.firstChild,D=M.firstChild,$=D.firstChild,C=$.firstChild,d=$.nextSibling;return insert(x,(()=>{var _=memo(()=>p()==="top");return ()=>_()&&m()})(),M),insert(C,createComponent(For,{get each(){return e.columns},children:(_,w)=>{let b=!!_.sortKey,u=()=>t()===w(),h=()=>u()?l():null;return (()=>{var y=Nt();return insert(y,b?(()=>{var S=zt(),L=S.firstChild;return S.$$click=()=>s(w()),insert(S,()=>_.label,L),insert(L,(()=>{var T=memo(()=>h()==="asc");return ()=>T()?Ot():memo(()=>h()==="desc")()?Vt():jt()})()),effect(T=>{var B=h()==="asc"?"ascending":h()==="desc"?"descending":"none",I=h()??"none";return B!==T.e&&setAttribute(S,"aria-sort",T.e=B),I!==T.t&&setAttribute(S,"data-sort",T.t=I),T},{e:void 0,t:void 0}),S})():(()=>{var S=qt();return insert(S,()=>_.label),S})()),y})()}})),insert(d,createComponent(For,{get each(){return a()},children:_=>(()=>{var w=Yt();return w.$$click=()=>e.onRowClick?.(_),insert(w,createComponent(For,{get each(){return e.columns},children:b=>(()=>{var u=Rt();return insert(u,createComponent(Jt,{row:_,get render(){return b.render}})),u})()})),effect(()=>setAttribute(w,"data-clickable",e.onRowClick?"true":void 0)),w})()})),insert(x,(()=>{var _=memo(()=>p()==="bottom");return ()=>_()&&m()})(),null),effect(_=>{var w=k(),b=e.style;return w!==_.e&&className(x,_.e=w),_.t=style(x,b,_.t),_},{e:void 0,t:void 0}),x})()}delegateEvents(["click"]);var tn=template("<div class=ss_dropdown__menu role=menu>"),nn=template('<div><button type=button class="ss_dropdown__trigger ss_button ss_button--icon"aria-haspopup=menu>'),rn=template('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path><path d="M11 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path><path d="M11 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0">'),ln=template("<button type=button class=ss_dropdown__item><span class=ss_dropdown__item_icon></span><span class=ss_dropdown__item_label>"),sn=template('<span class=ss_dropdown__item_check aria-hidden=true><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-check"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M5 12l5 5l10 -10">');function un(e){let[t,r]=createSignal(false),[l,i]=createSignal(false),[n,c]=createSignal("closed"),f,v=()=>r(false);return createEffect(()=>{if(t()){i(true),requestAnimationFrame(()=>c("open"));return}if(!l())return;c("closed");let g=window.setTimeout(()=>i(false),160);onCleanup(()=>window.clearTimeout(g));}),onMount(()=>{let g=s=>{let o=s.target;!f||!o||f.contains(o)||v();},a=s=>{s.key==="Escape"&&v();};document.addEventListener("mousedown",g),window.addEventListener("keydown",a),onCleanup(()=>{document.removeEventListener("mousedown",g),window.removeEventListener("keydown",a);});}),(()=>{var g=nn(),a=g.firstChild;return use(s=>f=s,g),a.$$click=()=>r(s=>!s),insert(a,()=>e.icon??rn()),insert(g,createComponent(Show,{get when(){return l()},get children(){var s=tn();return insert(s,createComponent(For,{get each(){return e.items},children:o=>(()=>{var p=ln(),k=p.firstChild,m=k.nextSibling;return p.$$click=async()=>{v(),await o.onclick?.();},insert(k,()=>o.icon),insert(m,()=>o.label),insert(p,(()=>{var x=memo(()=>!!o.checked);return ()=>x()&&sn()})(),null),effect(x=>{var M=o.checked?"menuitemcheckbox":"menuitem",D=o.checked?"true":void 0;return M!==x.e&&setAttribute(p,"role",x.e=M),D!==x.t&&setAttribute(p,"aria-checked",x.t=D),x},{e:void 0,t:void 0}),p})()})),effect(()=>setAttribute(s,"data-state",n())),s}}),null),effect(s=>{var o=`ss_dropdown ${e.class??""}`,p=e.style,k=t(),m=e.ariaLabel??"Aktionen \xF6ffnen";return o!==s.e&&className(g,s.e=o),s.t=style(g,p,s.t),k!==s.a&&setAttribute(a,"aria-expanded",s.a=k),m!==s.o&&setAttribute(a,"aria-label",s.o=m),s},{e:void 0,t:void 0,a:void 0,o:void 0}),g})()}delegateEvents(["click"]);var bn=template("<div><div class=ss_expandable__header role=button tabindex=0><span class=ss_expandable__icon aria-hidden=true></span><span class=ss_expandable__title></span></div><div class=ss_expandable__content style=transition-duration:200ms><div class=ss_expandable__divider_wrapper><div class=ss_expandable__divider>"),wn=template('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M6 9l6 6l6 -6">'),kn=template('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M9 6l6 6l-6 6">'),Sn=200;function Cn(e){let[t,r]=createSignal(e.initiallyExpanded?"auto":0),l=createMemo(()=>t()!==0),i,n,c=()=>{n&&clearTimeout(n);let f=i?.scrollHeight??0;if(l()){r(f),n=window.setTimeout(()=>r(0),1);return}r(f),n=window.setTimeout(()=>r("auto"),Sn);};return onCleanup(()=>{n&&clearTimeout(n);}),(()=>{var f=bn(),v=f.firstChild,g=v.firstChild,a=g.nextSibling,s=v.nextSibling,o=s.firstChild;o.firstChild;return v.$$keydown=k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),c());},v.$$click=c,insert(g,(()=>{var k=memo(()=>!!l());return ()=>k()?wn():kn()})()),insert(a,()=>e.title),use(k=>i=k,s),insert(o,()=>e.children,null),effect(k=>{var m=`ss_expandable ${e.class??""}`,x=e.style,M=l()?"open":"closed",D=l(),$=typeof t()=="number"?`${t()}px`:t();return m!==k.e&&className(f,k.e=m),k.t=style(f,x,k.t),M!==k.a&&setAttribute(f,"data-state",k.a=M),D!==k.o&&setAttribute(v,"aria-expanded",k.o=D),$!==k.i&&setStyleProperty(s,"height",k.i=$),k},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),f})()}delegateEvents(["click","keydown"]);function pe(){let[e,t]=createSignal(false);return [e,async r=>{if(!e())try{t(!0),await r();}finally{t(false);}}]}var Dn=template("<form class=ss_form>"),Ln=template("<div class=ss_form_input><label></label><div class=ss__wrapper>"),Tn=template("<textarea>"),In=template("<input>"),tt=template("<ul class=ss__suggestions>"),nt=template("<li>"),me=template("<span role=alert>"),Fn=template('<div class=ss_form_date><label></label><div class=ss__wrapper><input type=text inputmode=numeric autocomplete=off placeholder=TT.MM.JJJJ><button type=button class=ss_form_date__icon aria-label="Kalender \xF6ffnen"aria-haspopup=dialog><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=currentColor class="icon icon-tabler icons-tabler-filled icon-tabler-calendar-week"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M16 2c.183 0 .355 .05 .502 .135l.033 .02c.28 .177 .465 .49 .465 .845v1h1a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h1v-1a1 1 0 0 1 .514 -.874l.093 -.046l.066 -.025l.1 -.029l.107 -.019l.12 -.007q .083 0 .161 .013l.122 .029l.04 .012l.06 .023c.328 .135 .568 .44 .61 .806l.007 .117v1h6v-1a1 1 0 0 1 1 -1m3 7h-14v9.625c0 .705 .386 1.286 .883 1.366l.117 .009h12c.513 0 .936 -.53 .993 -1.215l.007 -.16z"></path><path d="M9.015 13a1 1 0 0 1 -1 1a1.001 1.001 0 1 1 -.005 -2c.557 0 1.005 .448 1.005 1"></path><path d="M13.015 13a1 1 0 0 1 -1 1a1.001 1.001 0 1 1 -.005 -2c.557 0 1.005 .448 1.005 1"></path><path d="M17.02 13a1 1 0 0 1 -1 1a1.001 1.001 0 1 1 -.005 -2c.557 0 1.005 .448 1.005 1"></path><path d="M12.02 15a1 1 0 0 1 0 2a1.001 1.001 0 1 1 -.005 -2z"></path><path d="M9.015 16a1 1 0 0 1 -1 1a1.001 1.001 0 1 1 -.005 -2c.557 0 1.005 .448 1.005 1">'),Bn=template('<div class=ss_form_date__picker role=dialog aria-label="Datum ausw\xE4hlen"><div class=ss_form_date__header><div class=ss_form_date__nav_group><button type=button class=ss_form_date__nav><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left-pipe"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M7 6v12"></path><path d="M18 6l-6 6l6 6"></path></svg></button><button type=button class=ss_form_date__nav><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M15 6l-6 6l6 6"></path></svg></button></div><div class=ss_form_date__title></div><div class=ss_form_date__nav_group><button type=button class=ss_form_date__nav><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M9 6l6 6l-6 6"></path></svg></button><button type=button class=ss_form_date__nav><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right-pipe"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M6 6l6 6l-6 6"></path><path d="M17 5v13"></path></svg></button></div></div><div class=ss_form_date__weekdays></div><div class=ss_form_date__grid>'),An=template("<span>"),Hn=template("<button type=button class=ss_form_date__day>"),Pn=template('<span class="ss_form_date__day is-empty">'),Nn=template("<div class=ss_form_checkbox><div class=ss__wrapper><input type=checkbox><label>"),zn=template('<div class=ss_form_select><label></label><div class=ss_form_select__field><select></select><span class=ss_form_select__icon aria-hidden=true><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M6 9l6 6l6 -6">'),On=template("<option>"),Vn=template("<div class=ss_form_ac_select><label>"),jn=template('<div class=ss__selection><div class=ss__content></div><button type=button class=ss__clear aria-label="Auswahl entfernen">\xD7'),qn=template("<div class=ss__wrapper><div class=ss__input_row><input>"),Yn=template("<span class=ss__prefix role=button>"),X=createContext(),O=function(e){let[t,r]=pe(),l={},i={loading:t,process:n=>r(()=>n(i)),field:n=>l[n]??null,setField:(n,c)=>{l[n]=c;},delField:n=>{delete l[n];},setValues:n=>Object.entries(n).forEach(([c,f])=>l[c]?.setValue(f)),getValues:async()=>{let n=Object.entries(l),c=await Promise.all(n.map(([,f])=>f.getValue()));return Object.fromEntries(n.map(([f],v)=>[f,c[v]]))},validate:()=>Promise.all(Object.values(l).map(n=>n.validate())).then(),hasError:()=>Object.values(l).some(n=>n.hasError()),submit:()=>r(async()=>{await i.validate(),!i.hasError()&&await e.onsubmit?.(i);})};return (()=>{var n=Dn();return n.addEventListener("submit",c=>{c.preventDefault(),i.submit();}),insert(n,createComponent(X.Provider,{value:i,get children(){return e.children}})),n})()};O.Input=function(e){let t=useContext(X),[r,l]=createSignal(""),[i,n]=createSignal(null),c={getValue:()=>{let $=r().trim();return $||null},setValue:$=>{if(typeof $=="number"){l($.toLocaleString());return}l(`${$}`);},hasError:()=>!!i(),validate:async()=>{let $=[...e.rules??[]];e.required&&$.unshift(O.rules.required);let C=await c.getValue();for(let d of $){let _=await d(C);if(_){n(_);return}}n(null);}};if(e.name&&t){let $=e.name;onMount(()=>t.setField($,c)),onCleanup(()=>t.delField($));}let f=null,[v,g]=createSignal([]),[a,s]=createSignal(-1),o;if(e.suggestions){let $=e.suggestions,[C,d]=createSignal(!$.prepare);$.prepare&&onMount(async()=>{$.prepare&&(f=await $.prepare(),d(true));});let _;createEffect(()=>{if(clearTimeout(_??void 0),!C())return;g([]);let w=r().trim().toLowerCase();w&&(_=setTimeout(async()=>{let b=await $.getItems({query:w,init:f});g(b);},250));}),onCleanup(()=>clearTimeout(_??void 0));}createEffect(()=>{let $=v();if(!$.length){s(-1);return}a()>=$.length&&s($.length-1);});let p=$=>{let C=o;if(!C||$<0)return;let d=C.querySelectorAll("li")[$];if(!d)return;let _=d.offsetTop,w=_+d.offsetHeight,b=C.scrollTop,u=b+C.clientHeight;_<b?C.scrollTop=_:w>u&&(C.scrollTop=w-C.clientHeight);},k=$=>{let C=v();if(!C.length)return;let d=Math.max(-1,Math.min(a()+$,C.length-1));s(d),p(d);},m=$=>{l(e.suggestions.stringify({item:$,init:f})),s(-1);},x=$=>{if(v().length)if($.key==="ArrowDown")$.preventDefault(),k(1);else if($.key==="ArrowUp")$.preventDefault(),k(-1);else if($.key==="Enter"&&a()>=0){$.preventDefault();let C=v()[a()];C&&m(C);}else $.key==="Escape"&&s(-1);},M=$=>{l($),s(-1);},D=createUniqueId();return (()=>{var $=Ln(),C=$.firstChild,d=C.nextSibling;return insert(C,()=>e.label),insert(d,(()=>{var _=memo(()=>!!e.textArea);return ()=>_()?(()=>{var w=Tn();return w.$$keydown=x,w.$$input=b=>M(b.target.value),effect(b=>{var u=e.id||D,h=e.disabled||t?.loading();return u!==b.e&&setAttribute(w,"id",b.e=u),h!==b.t&&(w.disabled=b.t=h),b},{e:void 0,t:void 0}),effect(()=>w.value=r()),w})():(()=>{var w=In();return w.$$keydown=x,w.$$input=b=>M(b.target.value),effect(b=>{var u=e.id||D,h=e.disabled||t?.loading(),y=e.type;return u!==b.e&&setAttribute(w,"id",b.e=u),h!==b.t&&(w.disabled=b.t=h),y!==b.a&&setAttribute(w,"type",b.a=y),b},{e:void 0,t:void 0,a:void 0}),effect(()=>w.value=r()),w})()})(),null),insert(d,(()=>{var _=memo(()=>!!v().length);return ()=>_()&&(()=>{var w=tt();return use(b=>o=b,w),insert(w,createComponent(For,{get each(){return v()},children:(b,u)=>{let h=()=>{let y=document.activeElement;y instanceof HTMLElement&&y.blur(),m(b);};return (()=>{var y=nt();return y.$$click=h,y.$$pointerdown=S=>S.preventDefault(),insert(y,()=>e.suggestions.stringify({item:b,init:f})),effect(()=>y.classList.toggle("ss__hovered",u()===a())),y})()}})),w})()})(),null),insert($,(()=>{var _=memo(()=>!!i());return ()=>_()&&(()=>{var w=me();return insert(w,i),w})()})(),null),effect(()=>setAttribute(C,"for",e.id||D)),$})()};O.Date=function(e){let t=useContext(X),[r,l]=createSignal(""),[i,n]=createSignal(null),[c,f]=createSignal(false),[v,g]=createSignal(new Date),a,s=d=>`${d}`.padStart(2,"0"),o=d=>{let _=s(d.getDate()),w=s(d.getMonth()+1),b=d.getFullYear();return `${_}.${w}.${b}`},p=d=>{let _=d.trim();if(!_)return null;let w=/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/.exec(_);if(!w)return null;let b=Number(w[1]),u=Number(w[2]),h=Number(w[3]);if(!b||!u)return null;let y=new Date(h,u-1,b);return y.getFullYear()!==h||y.getMonth()!==u-1||y.getDate()!==b?null:y};createEffect(()=>{if(!c())return;let d=p(r());g(d??new Date);});let k={getValue:()=>{let d=r().trim();return d||null},setValue:d=>{if(d instanceof Date){l(o(d));return}l(`${d??""}`);},hasError:()=>!!i(),validate:async()=>{let d=[...e.rules??[]];e.required&&d.unshift(O.rules.required);let _=await k.getValue();for(let w of d){let b=await w(_);if(b){n(b);return}}if(_&&!p(_)){n("Ung\xFCltiges Datum");return}n(null);}};if(e.name&&t){let d=e.name;onMount(()=>t.setField(d,k)),onCleanup(()=>t.delField(d));}let m=createUniqueId(),x=d=>{let _=p(r());return _?_.getFullYear()===v().getFullYear()&&_.getMonth()===v().getMonth()&&_.getDate()===d:false},M=d=>{let _=new Date;return _.getFullYear()===v().getFullYear()&&_.getMonth()===v().getMonth()&&_.getDate()===d},D=()=>{let d=v(),_=d.getFullYear(),w=d.getMonth(),b=new Date(_,w,1),u=new Date(_,w+1,0).getDate(),h=(b.getDay()+6)%7,y=[];for(let S=0;S<h;S+=1)y.push(null);for(let S=1;S<=u;S+=1)y.push(S);for(;y.length%7!==0;)y.push(null);return y},$=()=>v().toLocaleDateString("de-DE",{month:"long",year:"numeric"}),C=d=>{let _=new Date(v().getFullYear(),v().getMonth(),d);l(o(_)),f(false);};return onMount(()=>{let d=w=>{if(!c())return;let b=w.target;a&&b&&!a.contains(b)&&f(false);},_=w=>{w.key==="Escape"&&f(false);};document.addEventListener("mousedown",d),window.addEventListener("keydown",_),onCleanup(()=>{document.removeEventListener("mousedown",d),window.removeEventListener("keydown",_);});}),(()=>{var d=Fn(),_=d.firstChild,w=_.nextSibling,b=w.firstChild,u=b.nextSibling;return use(h=>a=h,d),insert(_,()=>e.label),b.addEventListener("focus",()=>f(true)),b.$$input=h=>l(h.target.value),u.$$click=()=>f(h=>!h),insert(d,(()=>{var h=memo(()=>!!c());return ()=>h()&&(()=>{var y=Bn(),S=y.firstChild,L=S.firstChild,T=L.firstChild,B=T.nextSibling,I=L.nextSibling,A=I.nextSibling,ee=A.firstChild,le=ee.nextSibling,J=S.nextSibling,W=J.nextSibling;return T.$$click=()=>{let F=v();g(new Date(F.getFullYear()-1,F.getMonth(),1));},B.$$click=()=>{let F=v();g(new Date(F.getFullYear(),F.getMonth()-1,1));},insert(I,$),ee.$$click=()=>{let F=v();g(new Date(F.getFullYear(),F.getMonth()+1,1));},le.$$click=()=>{let F=v();g(new Date(F.getFullYear()+1,F.getMonth(),1));},insert(J,()=>["Mo","Di","Mi","Do","Fr","Sa","So"].map(F=>(()=>{var Y=An();return insert(Y,F),Y})())),insert(W,()=>D().map(F=>F?(()=>{var Y=Hn();return Y.$$click=()=>C(F),insert(Y,F),effect(ce=>{var Re=!!x(F),Ke=!!M(F);return Re!==ce.e&&Y.classList.toggle("is-selected",ce.e=Re),Ke!==ce.t&&Y.classList.toggle("is-today",ce.t=Ke),ce},{e:void 0,t:void 0}),Y})():Pn())),y})()})(),null),insert(d,(()=>{var h=memo(()=>!!i());return ()=>h()&&(()=>{var y=me();return insert(y,i),y})()})(),null),effect(h=>{var y=e.id||m,S=e.id||m,L=e.disabled||t?.loading(),T=!e.editable,B=c(),I=e.disabled||t?.loading();return y!==h.e&&setAttribute(_,"for",h.e=y),S!==h.t&&setAttribute(b,"id",h.t=S),L!==h.a&&(b.disabled=h.a=L),T!==h.o&&(b.readOnly=h.o=T),B!==h.i&&setAttribute(u,"aria-expanded",h.i=B),I!==h.n&&(u.disabled=h.n=I),h},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),effect(()=>b.value=r()),d})()};O.Checkbox=function(e){let t=useContext(X),[r,l]=createSignal(false),[i,n]=createSignal(null),c={getValue:()=>r(),setValue:v=>l(!!v),hasError:()=>!!i(),validate:async()=>{let v=[...e.rules??[]];e.required&&v.unshift(O.rules.required);let g=await c.getValue();for(let a of v){let s=await a(g);if(s){n(s);return}}n(null);}};if(e.name&&t){let v=e.name;onMount(()=>t.setField(v,c)),onCleanup(()=>t.delField(v));}let f=createUniqueId();return (()=>{var v=Nn(),g=v.firstChild,a=g.firstChild,s=a.nextSibling;return a.addEventListener("change",o=>l(o.target.checked)),insert(s,()=>e.label),insert(v,(()=>{var o=memo(()=>!!i());return ()=>o()&&(()=>{var p=me();return insert(p,i),p})()})(),null),effect(o=>{var p=e.id||f,k=e.disabled||t?.loading(),m=e.id||f;return p!==o.e&&setAttribute(a,"id",o.e=p),k!==o.t&&(a.disabled=o.t=k),m!==o.a&&setAttribute(s,"for",o.a=m),o},{e:void 0,t:void 0,a:void 0}),effect(()=>a.checked=r()),v})()};O.useContext=function(){let e=useContext(X);if(!e)return null;let{setField:t,delField:r,...l}=e;return l};O.Select=function(e){let t=useContext(X),[r,l]=createSignal([]),[i,n]=createSignal(null),[c,f]=createSignal(null),v=s=>{let o=s.map(p=>({id:p.id,label:e.buildOption(p)}));if(l(o),!s.length){n(null);return}i()&&o.some(p=>p.id===i())||n(o[0].id);};createEffect(()=>{let s=e.getOptions();"then"in s&&typeof s.then=="function"||s instanceof Promise?s.then(v):v(s);});let g={getValue:()=>{let s=i();return r().some(p=>p.id===s)?s:null},setValue:s=>{let o=r();if(!o.length){n(null);return}let p=o[0].id;if(typeof s!="string"){n(p);return}let k=s.trim();if(!o.some(m=>m.id===k)){n(p);return}n(k);},hasError:()=>!!c(),validate:async()=>{let s=r(),o=await g.getValue();if(!o){f("Pflichtfeld");return}if(!s.some(p=>p.id===o)){f("Option nicht verf\xFCgbar");return}for(let p of e.rules??[]){let k=await p(o);if(k){f(k);return}}f(null);}};if(g.setOptions=v,e.name&&t){let s=e.name;onMount(()=>t.setField(s,g)),onCleanup(()=>t.delField(s));}let a=createUniqueId();return (()=>{var s=zn(),o=s.firstChild,p=o.nextSibling,k=p.firstChild;return insert(o,()=>e.label),k.addEventListener("change",m=>n(m.target.value)),insert(k,createComponent(For,{get each(){return r()},children:m=>(()=>{var x=On();return insert(x,()=>m.label),effect(()=>x.selected=i()===m.id),effect(()=>x.value=m.id),x})()})),insert(s,(()=>{var m=memo(()=>!!c());return ()=>m()&&(()=>{var x=me();return insert(x,c),x})()})(),null),effect(m=>{var x=e.id||a,M=e.id||a,D=e.disabled||t?.loading();return x!==m.e&&setAttribute(o,"for",m.e=x),M!==m.t&&setAttribute(k,"id",m.t=M),D!==m.a&&(k.disabled=m.a=D),m},{e:void 0,t:void 0,a:void 0}),s})()};O.ACSelect=function(e){let t=useContext(X),[r,l]=createSignal(""),[i,n]=createSignal([]),[c,f]=createSignal(null),v={getValue:()=>i(),setValue:u=>n(u),hasError:()=>!!c(),validate:async()=>{let u=await v.getValue(),h=e.minSelectedItems,y=e.maxSelectedItems;if(h&&u.length<h){f(`Mindestens ${h} ${h>1?"Elemente m\xFCssen":"Element muss"} ausgew\xE4hlt werden`);return}if(y&&u.length>y){f(`Maximal ${y} ${y>1?"Elemente d\xFCrfen":"Element darf"} ausgew\xE4hlt werden`);return}for(let S of e.rules??[]){let L=await S(u);if(L){f(L);return}}f(null);}};if(e.name&&t){let u=e.name;onMount(()=>t.setField(u,v)),onCleanup(()=>t.delField(u));}let g=null,[a,s]=createSignal(!e.prepare);e.prepare&&onMount(async()=>{e.prepare&&(g=await e.prepare(),s(true));});let[o,p]=createSignal([]),[k,m]=createSignal(-1),x,M;createEffect(()=>{if(!a())return;clearTimeout(M);let u=r().trim().toLowerCase();if(!u){p(untrack(()=>i()));return}p([]),M=setTimeout(async()=>{let h=await e.getOptions({query:u,init:g});p(h);},250);}),createEffect(()=>{r().trim().toLowerCase()||o().length!==i().length&&p(i());}),onCleanup(()=>clearTimeout(M)),createEffect(()=>{let u=o();if(!u.length){m(-1);return}k()>=u.length&&m(u.length-1);});let D=u=>{let h=x;if(!h||u<0)return;let y=h.querySelectorAll("li")[u];if(!y)return;let S=y.offsetTop,L=S+y.offsetHeight,T=h.scrollTop,B=T+h.clientHeight;S<T?h.scrollTop=S:L>B&&(h.scrollTop=L-h.clientHeight);},$=u=>{let h=o();if(!h.length)return;let y=Math.max(-1,Math.min(k()+u,h.length-1));m(y),D(y);},C=createUniqueId(),d=createMemo(()=>new Set(i().map(({id:u})=>u))),_=(u,h=true)=>{let y=d().has(u.id);if(e.maxSelectedItems===1){n(y?[]:[u]),l(""),h&&m(-1);return}n(y?S=>S.filter(({id:L})=>L!==u.id):S=>[...S.filter(({id:L})=>L!==u.id),u]),h&&m(-1);},w=u=>{if(o().length)if(u.key==="ArrowDown")u.preventDefault(),$(1);else if(u.key==="ArrowUp")u.preventDefault(),$(-1);else if(u.key==="Enter"&&k()>=0){u.preventDefault();let h=o()[k()];h&&_(h,false);}else u.key==="Escape"&&m(-1);},b=()=>e.disabled||t?.loading();return (()=>{var u=Vn(),h=u.firstChild;return insert(h,()=>e.label),insert(u,(()=>{var y=memo(()=>!!(e.maxSelectedItems===1&&e.renderSelection&&i().length===1));return ()=>y()?(()=>{var S=jn(),L=S.firstChild,T=L.nextSibling;return insert(L,()=>e.renderSelection({item:i()[0],init:g})),T.$$click=()=>{n([]),l(""),setTimeout(()=>document.getElementById(e.id||C)?.focus(),0);},effect(()=>T.disabled=b()),S})():(()=>{var S=qn(),L=S.firstChild,T=L.firstChild;return insert(L,(()=>{var B=memo(()=>!!i().length);return ()=>B()&&(()=>{var I=Yn();return I.$$click=()=>{b()||n([]);},I.$$keydown=A=>{b()||(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),n([]));},insert(I,()=>i().length),effect(A=>{var ee=b()?-1:0,le=b()?"true":void 0;return ee!==A.e&&setAttribute(I,"tabindex",A.e=ee),le!==A.t&&setAttribute(I,"aria-disabled",A.t=le),A},{e:void 0,t:void 0}),I})()})(),T),T.$$keydown=w,T.$$input=B=>{b()||(l(B.target.value),m(-1));},insert(S,(()=>{var B=memo(()=>!!o().length);return ()=>B()&&(()=>{var I=tt();return use(A=>x=A,I),insert(I,createComponent(For,{get each(){return o()},children:(A,ee)=>{let le=()=>{b()||(_(A),document.getElementById(e.id||C)?.focus());};return (()=>{var J=nt();return J.$$click=le,J.$$pointerdown=W=>W.preventDefault(),insert(J,()=>e.renderItem({item:A,init:g})),effect(W=>{var F=!!d().has(A.id),Y=ee()===k();return F!==W.e&&J.classList.toggle("ss__selected",W.e=F),Y!==W.t&&J.classList.toggle("ss__hovered",W.t=Y),W},{e:void 0,t:void 0}),J})()}})),I})()})(),null),effect(B=>{var I=e.id||C,A=b();return I!==B.e&&setAttribute(T,"id",B.e=I),A!==B.t&&(T.disabled=B.t=A),B},{e:void 0,t:void 0}),effect(()=>T.value=r()),S})()})(),null),insert(u,(()=>{var y=memo(()=>!!c());return ()=>y()&&(()=>{var S=me();return insert(S,c),S})()})(),null),effect(()=>setAttribute(h,"for",e.id||C)),u})()};O.SubmitButton=function(e){let t=useContext(X);return createComponent(U,{type:"submit",class:"ss_form_submit",get disabled(){return e.disabled||t?.loading()},get children(){return e.children}})};O.rules={required:e=>e?null:"Pflichtfeld",minLength:e=>t=>{if(t===null&&(t=""),typeof t!="string")throw new Error(`invalid rule minLength(..) for non-string value ${t}`);return t.length<e?`Mindestens ${e} Zeichen`:null},maxLength:e=>t=>{if(t===null&&(t=""),typeof t!="string")throw new Error(`invalid rule maxLength(..) for non-string value ${t}`);return t.length<e?`Maximal ${e} Zeichen`:null},pattern:e=>t=>{if(t===null&&(t=""),typeof t!="string")throw new Error(`invalid rule pattern(..) for non-string value ${t}`);return e.test(t)?null:"Eingabe widerspricht erwartetem Muster"}};delegateEvents(["input","keydown","pointerdown","click"]);var Qn=template("<div><div class=ss_header__text><h3 class=ss_header__title></h3></div><div class=ss_header__actions>"),Xn=template("<h5 class=ss_header__subtitle>");function er(e){return (()=>{var t=Qn(),r=t.firstChild,l=r.firstChild,i=r.nextSibling;return insert(l,()=>e.title),insert(r,(()=>{var n=memo(()=>!!e.subtitle);return ()=>n()&&(()=>{var c=Xn();return insert(c,()=>e.subtitle),c})()})(),null),insert(i,()=>e.actions),effect(n=>{var c=`ss_header ${e.class??""}`,f=e.style;return c!==n.e&&className(t,n.e=c),n.t=style(t,f,n.t),n},{e:void 0,t:void 0}),t})()}var lr=template("<div class=ss_modal__footer>"),ir=template("<div class=ss_modal><div class=ss_modal__backdrop></div><div class=ss_modal__panel role=dialog aria-modal=true tabindex=-1><div class=ss_modal__body><div class=ss_modal__body_inner>"),sr=template('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-x"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M18 6l-12 12"></path><path d="M6 6l12 12">'),or=template("<div class=ss_modal__header>"),ar=template("<h2 class=ss_modal__title>"),mr=180;function Se(e){let[t,r]=createSignal(e.open),[l,i]=createSignal("closed"),n=createUniqueId(),c,f,v;createEffect(()=>{c&&clearTimeout(c),f&&cancelAnimationFrame(f),e.open?(t()||r(true),i("closed"),f=requestAnimationFrame(()=>i("open"))):(i("closed"),t()&&(c=window.setTimeout(()=>r(false),mr)));}),onMount(()=>{if(!e.open)return;if(e.lockScroll!==false){let s=document.body.style.overflowY;document.body.style.overflowY="hidden",onCleanup(()=>{document.body.style.overflowY=s;});}f=requestAnimationFrame(()=>v?.focus());let a=s=>{s.key==="Escape"&&e.dismissible!==false&&e.onClose?.();};window.addEventListener("keydown",a),onCleanup(()=>window.removeEventListener("keydown",a));}),onCleanup(()=>{c&&clearTimeout(c),f&&cancelAnimationFrame(f);});let g=()=>{e.dismissible!==false&&e.onClose?.();};return createComponent(Show,{get when(){return t()},get children(){return createComponent(Portal,{get children(){var a=ir(),s=a.firstChild,o=s.nextSibling,p=o.firstChild,k=p.firstChild;return s.$$click=g,use(m=>v=m,o),insert(o,(()=>{var m=memo(()=>!!(e.title||e.onClose));return ()=>m()&&(()=>{var x=or();return insert(x,(()=>{var M=memo(()=>!!e.title);return ()=>M()&&(()=>{var D=ar();return setAttribute(D,"id",n),insert(D,()=>e.title),D})()})(),null),insert(x,createComponent(Show,{get when(){return e.onClose},get children(){return createComponent(U,{type:"button",class:"ss_modal__close",isIconOnly:true,ariaLabel:"Dialog schlie\xDFen",onclick:()=>{e.dismissible!==false&&e.onClose?.();},get children(){return sr()}})}}),null),x})()})(),p),insert(k,()=>e.children),insert(o,createComponent(Show,{get when(){return e.footer},get children(){var m=lr();return insert(m,()=>e.footer),m}}),null),effect(m=>{var x=l(),M=l()==="closed",D=e.size==="sm",$=e.size==="lg",C=!!e.fullscreen,d=!!e.disableResponsiveFullscreen,_=e.title?n:void 0;return x!==m.e&&setAttribute(a,"data-state",m.e=x),M!==m.t&&setAttribute(a,"aria-hidden",m.t=M),D!==m.a&&o.classList.toggle("ss_modal__panel--sm",m.a=D),$!==m.o&&o.classList.toggle("ss_modal__panel--lg",m.o=$),C!==m.i&&o.classList.toggle("ss_modal__panel--fullscreen",m.i=C),d!==m.n&&o.classList.toggle("ss_modal__panel--no-fullscreen",m.n=d),_!==m.s&&setAttribute(o,"aria-labelledby",m.s=_),m},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),a}})}})}delegateEvents(["click"]);var dt=createContext(),br=0,wr=()=>`ss-modal-${br++}`;function kr(){let e=useContext(dt);if(!e)throw new Error("useSSModals must be used within SSModalsProvider");return e}function pr(e){let t=useNavigate(),r=useLocation(),[l,i]=pe(),n=()=>e.config.modalProps?.({hide:e.hide})??{},{primaryButtonText:c,secondaryButtonText:f,hideSecondaryButton:v,danger:g,...a}=n();return createComponent(Se,mergeProps({get open(){return e.visible()},get onClose(){return e.hide}},a,{get footer(){return [!v&&createComponent(U,{class:"secondary",get onclick(){return e.hide},children:f??"Abbrechen"}),createComponent(U,{class:g?"danger":void 0,onclick:()=>i(()=>e.config.onPrimaryAction?.({hide:e.hide,navigate:t,pathname:r.pathname})??e.hide()),get disabled(){return l()},children:c??"Weiter"})]},get children(){return e.config.content({hide:e.hide})}}))}function xr(e){let t=useNavigate(),r=useLocation();return createComponent(O,{onsubmit:l=>e.config.onSubmit({hide:e.hide,context:l,navigate:t,pathname:r.pathname}),get children(){return createComponent(yr,{get visible(){return e.visible},get hide(){return e.hide},get config(){return e.config}})}})}function yr(e){let t=O.useContext();if(!t)return null;let r=()=>e.config.modalProps?.({hide:e.hide,context:t})??{},{primaryButtonText:l,secondaryButtonText:i,hideSecondaryButton:n,danger:c,...f}=r();return createComponent(Se,mergeProps({get open(){return e.visible()},get onClose(){return e.hide}},f,{get footer(){return [!n&&createComponent(U,{class:"secondary",get onclick(){return e.hide},get disabled(){return t.loading()},children:i??"Abbrechen"}),createComponent(U,{class:c?"danger":void 0,onclick:()=>t.submit(),get disabled(){return t.loading()},children:l??"Speichern"})]},get children(){return e.config.content({hide:e.hide,context:t})}}))}function Sr(e){let[t,r]=createSignal([]),l=new Map,i=new Map,n=220,c=a=>{let s=l.get(a);if(!s)return;s.setVisible(false);let o=i.get(a);o&&window.clearTimeout(o);let p=window.setTimeout(()=>{r(k=>k.filter(m=>m.id!==a)),l.delete(a),i.delete(a);},n);i.set(a,p);},f=a=>{let s=wr(),[o,p]=createSignal(true),k={id:s,visible:o,setVisible:p,render:a};return l.set(s,k),r(m=>[...m,k]),s},v=a=>f(({hide:s,visible:o})=>createComponent(pr,{visible:o,hide:s,config:a})),g=a=>f(({hide:s,visible:o})=>createComponent(xr,{visible:o,hide:s,config:a}));return onCleanup(()=>{i.forEach(a=>window.clearTimeout(a)),i.clear();}),createComponent(dt.Provider,{value:{show:f,showDefault:v,showForm:g,hide:c},get children(){return [memo(()=>e.children),createComponent(For,{get each(){return t()},children:a=>{let s=()=>c(a.id);return a.render({id:a.id,hide:s,visible:a.visible})}})]}})}var Lr=template('<div><input type=checkbox class=ss_shell__drawer_toggle_input><header class=ss_shell__header><div class=ss_shell__header_left><label class="ss_shell__drawer_toggle ss_button ss_button--icon"aria-label="Navigation \xF6ffnen"role=button tabindex=0><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="icon icon-tabler icons-tabler-outline icon-tabler-menu-2"><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M4 6l16 0"></path><path d="M4 12l16 0"></path><path d="M4 18l16 0"></path></svg></label><div class=ss_shell__title></div></div><div class=ss_shell__actions></div></header><div class=ss_shell__body><nav class=ss_shell__nav aria-label=Hauptnavigation><div class=ss_shell__nav_inner></div></nav><div class=ss_shell__main></div><label class=ss_shell__scrim aria-label="Navigation schlie\xDFen">'),Tr=template("<div class=ss_shell__nav_list>"),Ir=template("<a class=ss_shell__nav_item><span class=ss_shell__nav_label>"),qe=template("<span class=ss_shell__nav_icon>"),Fr=template("<button type=button class=ss_shell__nav_item><span class=ss_shell__nav_label>"),Br=template('<details class=ss_shell__nav_group><summary class=ss_shell__nav_group_header><span class=ss_shell__nav_label></span><span class=ss_shell__nav_group_chevron aria-hidden=true><svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class=ss_shell__nav_group_chevron_svg><path stroke=none d="M0 0h24v24H0z"fill=none></path><path d="M9 6l6 6l-6 6"></path></svg></span></summary><div class=ss_shell__nav_group_items>'),Ye=createContext();function ge(e){let t=createUniqueId(),r=useLocation(),[l,i]=createSignal([]),n=()=>{let g=document.getElementById(t);g&&(g.checked=false);},c=g=>{i(a=>a.includes(g)?a:[...a,g]);},f=g=>{i(a=>a.filter(s=>s!==g));},v=createMemo(()=>{let g=r.pathname,a=null;for(let s of l())g.startsWith(s)&&(!a||s.length>a.length)&&(a=s);return a});return createComponent(Ye.Provider,{value:{closeDrawer:n,activeHref:v,registerHref:c,unregisterHref:f},get children(){var g=Lr(),a=g.firstChild,s=a.nextSibling,o=s.firstChild,p=o.firstChild,k=p.nextSibling,m=o.nextSibling,x=s.nextSibling,M=x.firstChild,D=M.firstChild,$=M.nextSibling,C=$.nextSibling;return setAttribute(a,"id",t),setAttribute(p,"for",t),insert(k,()=>e.title),insert(m,()=>e.actions),insert(D,()=>e.nav),insert($,()=>e.children),setAttribute(C,"for",t),effect(d=>{var _=`ss_shell ${e.class??""}`,w=e.style;return _!==d.e&&className(g,d.e=_),d.t=style(g,w,d.t),d},{e:void 0,t:void 0}),g}})}ge.Nav=function(e){return (()=>{var t=Tr();return insert(t,()=>e.children),t})()};ge.NavLink=function(e){let t=useContext(Ye);onMount(()=>t?.registerHref(e.href)),onCleanup(()=>t?.unregisterHref(e.href));let r=()=>t?.activeHref()===e.href;return (()=>{var l=Ir(),i=l.firstChild;return l.$$click=()=>{e.onclick?.(),t?.closeDrawer();},insert(l,(()=>{var n=memo(()=>!!e.icon);return ()=>n()&&(()=>{var c=qe();return insert(c,()=>e.icon),c})()})(),i),insert(i,()=>e.children),effect(n=>{var c=!!r(),f=e.href;return c!==n.e&&l.classList.toggle("ss_shell__nav_item--active",n.e=c),f!==n.t&&setAttribute(l,"href",n.t=f),n},{e:void 0,t:void 0}),l})()};ge.NavAction=function(e){let t=useContext(Ye);return (()=>{var r=Fr(),l=r.firstChild;return r.$$click=()=>{e.onclick(),t?.closeDrawer();},insert(r,(()=>{var i=memo(()=>!!e.icon);return ()=>i()&&(()=>{var n=qe();return insert(n,()=>e.icon),n})()})(),l),insert(l,()=>e.children),r})()};ge.NavGroup=function(e){return (()=>{var t=Br(),r=t.firstChild,l=r.firstChild,i=r.nextSibling;return insert(r,(()=>{var n=memo(()=>!!e.icon);return ()=>n()&&(()=>{var c=qe();return insert(c,()=>e.icon),c})()})(),l),insert(l,()=>e.title),insert(i,()=>e.children),effect(()=>t.open=e.initiallyExpanded),t})()};delegateEvents(["click"]);var Ur=template("<div>");function Jr(e){return (()=>{var t=Ur();return insert(t,()=>e.children),effect(r=>{var l=`ss_surface ${e.class??""}`,i=e.style;return l!==r.e&&className(t,r.e=l),r.t=style(t,i,r.t),r},{e:void 0,t:void 0}),t})()}var Xr=template("<div><div class=ss_tile__row><div class=ss_tile__content>"),el=template("<span class=ss_tile__icon>"),tl=template("<h5 class=ss_tile__title>"),nl=template("<h5 class=ss_tile__title><span class=ss_tile__text>"),rl=template("<div class=ss_tile__subtitle>"),ll=template("<div class=ss_tile__trailing>");function mt(e){return (()=>{var t=Xr(),r=t.firstChild,l=r.firstChild;return insert(r,(()=>{var i=memo(()=>!!e.icon);return ()=>i()&&(()=>{var n=el();return insert(n,()=>e.icon),n})()})(),l),insert(l,(()=>{var i=memo(()=>!!e.href);return ()=>i()?(()=>{var n=tl();return insert(n,createComponent(A,{class:"ss_tile__link",get href(){return e.href},get onclick(){return e.onLinkClick},get children(){return e.title}})),n})():(()=>{var n=nl(),c=n.firstChild;return insert(c,()=>e.title),n})()})(),null),insert(l,(()=>{var i=memo(()=>!!e.subtitle);return ()=>i()&&(()=>{var n=rl();return insert(n,()=>e.subtitle),n})()})(),null),insert(r,(()=>{var i=memo(()=>!!e.trailing);return ()=>i()&&(()=>{var n=ll();return insert(n,()=>e.trailing),n})()})(),null),effect(i=>{var n=`ss_tile ${e.class??""}`,c=e.style;return n!==i.e&&className(t,i.e=n),i.t=style(t,c,i.t),i},{e:void 0,t:void 0}),t})()}function sl(e){return function(t){let r=e(t.data);return createComponent(mt,mergeProps(r,{get onLinkClick(){return t.onLinkClick??r.onLinkClick},get href(){return memo(()=>!!t.noLink)()?void 0:r.href},get icon(){return memo(()=>!!t.noIcon)()?void 0:r.icon}}))}}
2
+ export{U as SSButton,St as SSCallout,Tt as SSChip,Wt as SSDataTable,un as SSDropdown,Cn as SSExpandable,O as SSForm,er as SSHeader,Se as SSModal,Sr as SSModalsProvider,ge as SSShell,Jr as SSSurface,mt as SSTile,sl as createSSTile,kr as useSSModals};