@sme.up/ketchup2 2.0.0-SNAPSHOT-20250521153648 → 2.0.0-SNAPSHOT-20250522154022

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.
@@ -3,4 +3,5 @@ export declare const defaultLayout: LayoutProps;
3
3
  export declare const complexLayout: LayoutProps;
4
4
  export declare const gridLayout: LayoutProps;
5
5
  export declare const columnsLayout: LayoutProps;
6
+ export declare const columnsNestedLayout: LayoutProps;
6
7
  //# sourceMappingURL=layoutAssets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layoutAssets.d.ts","sourceRoot":"","sources":["../../src/assets/layoutAssets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAA;AAG1E,eAAO,MAAM,aAAa,EAAE,WA8D3B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,WAmlB3B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,WAgHxB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,WAwG3B,CAAA"}
1
+ {"version":3,"file":"layoutAssets.d.ts","sourceRoot":"","sources":["../../src/assets/layoutAssets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAA;AAG1E,eAAO,MAAM,aAAa,EAAE,WA8D3B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,WAmlB3B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,WAgHxB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,WAwG3B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,WA6GjC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/functional-components/layout/layout.tsx"],"names":[],"mappings":"AAUA,OAAO,EAEL,WAAW,EAEZ,MAAM,gBAAgB,CAAA;AAIvB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA6IxC,CAAA"}
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/functional-components/layout/layout.tsx"],"names":[],"mappings":"AAUA,OAAO,EAEL,WAAW,EAEZ,MAAM,gBAAgB,CAAA;AAIvB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAmJxC,CAAA"}
@@ -46,5 +46,5 @@ Valid keys: `+JSON.stringify(Object.keys(d),null," "));var P=re(I,H,_,R,L+"."+H
46
46
  ${k?he["smp-datepickercalendar-td-today"]:""}
47
47
  ${d?he["smp-datepickercalendar-td-selected"]:""}
48
48
  ${g?he["smp-datepickercalendar-td-focused"]:""}
49
- ${x?he["smp-datepickercalendar-td-disabled"]:""}`},z=()=>`${v[f]} ${h.toString()}`;return E.jsxs("div",{className:Y.wrapper,ref:s,role:"dialog",tabIndex:-1,"aria-modal":"true",children:[E.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[E.jsx(Le,{onClick:C,ariaLabel:a(bt.PREVIOUS_MONTH),bindValue:"<",appearance:"ghost",variant:"base"}),E.jsx("div",{"aria-label":z(),className:Y.label,children:z()}),E.jsx(Le,{onClick:j,ariaLabel:a(bt.NEXT_MONTH),bindValue:">",appearance:"ghost",variant:"base"})]}),E.jsxs("table",{ref:S,role:"grid","aria-label":`${a(Et.CALENDAR_FOR)} ${v[f]} ${h}`,className:Y.table,children:[E.jsx("thead",{children:E.jsx("tr",{children:O.map(k=>E.jsx("th",{scope:"col",abbr:k.full,className:Y.th,children:k.value},k.value))})}),E.jsx("tbody",{children:ne.map((k,d)=>E.jsx("tr",{children:k.map((g,x)=>{const T=d*7+x;if(g===null)return E.jsx("td",{className:Y.td(!1,!1,!1,!0)},`empty-${x}`);const _=g.getDate()===o.getDate()&&g.getMonth()===o.getMonth()&&g.getFullYear()===o.getFullYear(),R=l&&g.getDate()===l.getDate()&&g.getMonth()===l.getMonth()&&g.getFullYear()===l.getFullYear(),L=m===g.getDate(),I=D(g);return E.jsx("td",{role:"gridcell","aria-selected":R,tabIndex:L?0:-1,onClick:()=>b(g),onKeyDown:A=>F(A,T),"aria-label":`${g.getDate()} ${v[g.getMonth()]} ${g.getFullYear()}`,"data-selected":R,"aria-disabled":I,ref:A=>{w.current[T]=A},className:Y.td(_,R,L,I),children:g.getDate()},`day-${x}`)})},`week-${d}`))})]})]})}const wr=({bindValue:n,placeholder:e,onChange:t,disabledDateRanges:r,...s})=>{const[a,i]=M.useState(!1),[o,l]=M.useState(n||""),[u,f]=M.useState(""),{anchorRef:c,targetRef:h}=xt({position:"bottom",enabled:a});ze(h,()=>{i(!1)}),ze(c,()=>{if(typeof c=="object"&&c!==null&&"current"in c){const C=c.current.querySelector("input");C&&C===document.activeElement&&w()}}),xr(a,h);const{format:p,getCurrentLanguage:m}=rt(),y=M.useCallback(C=>{const j=C.length>5&&Nr(C,m())||C,U=p(j,void 0,void 0,{type:"date"}),V=typeof j!="string",$=V&&j.toISOString().substring(0,10)||"";return{isValid:V,formattedDate:U,isoDate:$,normalizedDate:j}},[m,p]);M.useEffect(()=>{const{formattedDate:C,isoDate:j,isValid:U}=y(n);l(U&&j||n),f(U&&C||n)},[n,p,y]);const S=()=>i(C=>!C),w=()=>{O(u)},v=C=>{O(C),i(!1)},O=C=>{const{isoDate:j,isValid:U}=y(C);t&&t(U&&j||C)},D=C=>{f(C)},b=C=>{C.key==="Enter"&&(C.preventDefault(),O(u))};return E.jsxs("div",{children:[E.jsx(Se,{bindValue:u,placeholder:e,onBlur:w,onChange:D,onKeyDown:b,shapeIcon:"calendar",onShapeIconClick:S,ref:c,...s}),a&&E.jsx(Gn,{disabledDateRanges:r,onDateChange:v,initialValue:vt(o)&&o||"",targetRef:h})]})},Jn={"smp-multipleAutocomplete-container":"_smp-multipleAutocomplete-container_1mtv2_1"},Xn=({elements:n,displayMode:e,minimumChars:t,listDisplayMode:r,placeholder:s,fun:a,onOptionsRequest:i,onChange:o})=>{const l=n.map(c=>c.bindValue),u=(c,h)=>{const p=[...n];if(c=="")p.pop();else{const m=p.findIndex(y=>y.bindValue===c&&y.optionalDisplayValue===h);m>=0?p.splice(m,1):p.push({bindValue:c,optionalDisplayValue:h})}o==null||o(p)},f={container:`${Jn["smp-multipleAutocomplete-container"]}`};return E.jsxs("div",{className:f.container,children:[E.jsx(vr,{elements:n,displayMode:e,isEditable:!0,onChange:c=>{o==null||o(c)}}),E.jsx(_t,{bindValue:"",fun:a,onChange:u,_changeOnEnter:!0,listDisplayMode:r,minimumChars:t,placeholder:s,onOptionsRequest:i,_multiActiveIndex:l})]})},Or=({...n})=>{const[e,t]=M.useState(!1),r=e?"visibility-off":"visibility";return E.jsx(Se,{...n,inputType:e?"text":"password",shapeIcon:r,onShapeIconClick:()=>t(!e),ariaLabel:"password"})},Zn=({...n})=>{const[e,t]=M.useState(n.bindValue),{translate:r}=rt(),s=a=>{var i;a.key==="Enter"&&(a.preventDefault(),(i=n.onEnter)==null||i.call(n,e))};return E.jsx(Se,{...n,placeholder:n.placeholder?n.placeholder:r(Et.SPOTLIGHT_DEFAULT_PLACEHOLDER),icon:"magnify",inputType:"search",bindValue:e,onChange:t,onKeyDown:s,ariaLabel:"search bar"})};class xe{constructor(e,t){ve(this,"class");ve(this,"value");this.class=e,this.value=t}static fromDataObj(e){return new xe(e,e.k.split(";"))}static fromString(e){return new xe({t:"",p:""},e.split(";"))}getValue(){return this.value}getLegacyValue(){return this.value.join(";")}}const qe=(n,e,t)=>({obj:{t:n.obj.t,p:n.obj.p,k:e},decode:t||n.decode,shape:n.shape}),lr=n=>{const e=xe.fromDataObj(n.obj),t=n.decode?xe.fromString(n.decode).getValue():[];return e.getValue().map((r,s)=>({bindValue:r,optionalDisplayValue:t.length>=s?t[s]:""}))},Qn=(n,e)=>{const t=new xe(n.obj,e.map(s=>s.bindValue)).getLegacyValue(),r=new xe(n.obj,e.map(s=>s.optionalDisplayValue?s.optionalDisplayValue:"")).getLegacyValue();return qe(n,t,r)},Tr=({decode:n,shape:e,obj:t,data:r,icon:s,fun:a,placeholderIcon:i,label:o,onChange:l,onClick:u,onEnter:f,onBlur:c,onOptionsRequest:h})=>{const p={obj:t,shape:e,decode:n},m={onBlur:c,onOptionsRequest:h,fun:a,icon:s,label:o,...r},y=(v,O)=>jr(t)?qe(p,new Be(t,v).getLegacyValue()):qe(p,v,O),S=v=>qe(p,new Ke(t,v).getLegacyValue()),w=v=>Qn(p,v);switch(e){case ue.AUTOCOMPLETE:{const v={...m,bindValue:t.k,optionalDisplayValue:n,onChange:(O,D)=>{l==null||l(y(O,D))}};return E.jsx(_t,{...v})}case ue.BUTTON:{const v={...m,bindValue:t.k,optionalDisplayValue:n,onClick:()=>{u==null||u(y(t.k))}};return E.jsx(Le,{...v})}case ue.COMBOBOX:{const v={...m,bindValue:t.k,optionalDisplayValue:n,onChange:(O,D)=>{l==null||l(y(O,D))}};return E.jsx(Sr,{...v})}case ue.CHECKBOX:{const v={...m,bindValue:Ke.fromDataObj(t).getValue(),optionalDisplayValue:n,onChange:O=>{l==null||l(S(O))}};return E.jsx(br,{...v})}case ue.CHIP:{const v={...m,elements:lr(p)};return E.jsx(vr,{...v})}case ue.DATE:{const v={...m,bindValue:Be.fromDataObj(t).getValue(),onChange:O=>{l==null||l(y(O))}};return E.jsx(wr,{...v})}case ue.ICON:{const v={...m,icon:s,placeholderIcon:i,onClick:()=>{u==null||u(y(t.k))}};return E.jsx(ge,{...v})}case ue.MULTI_AUTOCOMPLETE:{const v={...m,elements:lr(p),onChange:O=>{l==null||l(w(O))}};return E.jsx(Xn,{...v})}case ue.PASSWORD:{const v={...m,bindValue:t.k,onChange:O=>{l==null||l(y(O))}};return E.jsx(Or,{...v})}case ue.SPOTLIGHT:{const v={...m,bindValue:t.k,onEnter:O=>{f==null||f(y(O))}};return E.jsx(Zn,{...v})}case ue.TEXT_FIELD:case void 0:{const v={...m,bindValue:t.k,onChange:O=>{l==null||l(y(O))}};return E.jsx(Se,{...v})}}},es=(n,e)=>{const t=[];for(let r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t},Rr=(n,e)=>n.map(t=>{var a,i;if((a=t.sections)!=null&&a.length)return{...t,sections:Rr(t.sections,e),content:t.content};let r=t.sections,s=t.content;return(i=t.content)!=null&&i.length&&t.columns&&+t.columns>1&&(r=es(t.content.filter(l=>!!e[l.id]),+t.columns).map((l,u)=>({...t,id:`${t.id}-${u}`,content:l,gridCols:t.columns,horizontal:!0})),s=[]),{...t,sections:r,content:s}}),cr=(n,e)=>{const t=n.some(r=>r.dim)?n.map(r=>r.dim||"auto").join(" "):`repeat(${n.length}, 1fr)`;return{[e]:t}},fe={"smp-layout":"_smp-layout_1trbe_1","smp-layout-horizontal":"_smp-layout-horizontal_1trbe_10","smp-layout-section-grid":"_smp-layout-section-grid_1trbe_15","smp-layout-section-vertical":"_smp-layout-section-vertical_1trbe_17","smp-layout-section-horizontal":"_smp-layout-section-horizontal_1trbe_21","smp-layout-section-flex":"_smp-layout-section-flex_1trbe_26","smp-grid-template-cols":"_smp-grid-template-cols_1trbe_38","smp-grid-template-rows":"_smp-grid-template-rows_1trbe_42","smp-layout-section-with-title":"_smp-layout-section-with-title_1trbe_46","smp-layout-section-title":"_smp-layout-section-title_1trbe_52","smp-layout-cell-container":"_smp-layout-cell-container_1trbe_58"},ts=({layout:n,cells:e})=>{var f;if(!((f=n.sections)!=null&&f.length))return E.jsx(E.Fragment,{});const t="--smp-grid-template-cols",r=Rr(n.sections,e),s=c=>c==null?void 0:c.reduce((h,p)=>{var v,O;let m="",y={},S={},w="";return(v=p.sections)!=null&&v.length?(m=fe["smp-layout-section-grid"],y=s(p.sections),p.gridCols==null&&p.horizontal&&(w=`${fe["smp-grid-template-cols"]}`,S=cr(p.sections,t))):(O=p.content)!=null&&O.length&&(p.gridCols&&p.gridCols>0?(m=fe["smp-layout-section-grid"],w=`${fe["smp-grid-template-cols"]}`,S={[t]:`repeat(${p.gridCols}, 1fr)`}):m=fe["smp-layout-section-flex"]),{...h,...y,[p.id]:{classes:`${m} ${fe[p.horizontal?"smp-layout-section-horizontal":"smp-layout-section-vertical"]} ${w} ${p.hdsp?`smp-justifyContent-${p.hdsp}`:""} ${p.vdsp?`smp-alignItems-${p.vdsp}`:""}`,styles:S}}},{}),a=s(r),i={container:`${fe["smp-layout"]} ${n.horizontal?fe["smp-layout-horizontal"]:""}`,sections:a},o=cr(r,t),l=c=>{var p;const h=E.jsx("div",{className:i.sections[c.id].classes,style:i.sections[c.id].styles,children:(p=c.sections)!=null&&p.length?c.sections.map(m=>l(m)):c.content.map(m=>u(m,e[m.id],c.hdsp,c.vdsp))},"section-"+c.id);return c.title?E.jsxs("div",{className:`${fe["smp-layout-section-with-title"]}`,children:[E.jsx("span",{className:`${fe["smp-layout-section-title"]} ${c.hdsp?`smp-justifyContent-${c.hdsp}`:""} ${c.vdsp?`smp-alignItems-${c.vdsp}`:""}`,children:E.jsx(fr,{label:c.title})}),h]}):h},u=(c,h,p,m)=>{const y=c.colSpan!==void 0?c.colSpan>0?c.colSpan:c.colStart!==void 0&&c.colStart<1?1:null:null,S=y!==null?`span ${y}`:c.colStart,w=c.colEnd!==void 0&&c.colEnd>0?c.colEnd:"",v={gridColumnStart:S,gridColumnEnd:w},O=`${fe["smp-layout-cell-container"]} ${p?`smp-justifyContent-${p}`:""} ${m?`smp-alignItems-${m}`:""}`;return E.jsx("div",{className:O,style:{...v},children:h?E.jsx(Tr,{...h}):E.jsx(E.Fragment,{})},c.id)};return E.jsx("div",{className:i.container,style:o,children:r==null?void 0:r.map(c=>l(c))})},rs={"smp-appbar":"_smp-appbar_u7bbt_1"},ns=({data:n,onClick:e,onEnter:t})=>{var i,o;const[r,s]=M.useState(),a=M.useCallback(l=>{var f,c;if(!((f=l.rows)!=null&&f.length)||!((c=l.columns)!=null&&c.length))return{};const u=l.rows[0];return l.columns.filter(h=>h.visible).reduce((h,p)=>{const m=u.cells[p.name],y={...m,onChange:S=>{s(w=>w&&{...w,[p.name]:{...w[p.name],obj:{...w[p.name].obj,k:S.obj.k}}})},onClick:()=>{m.fun&&e&&e({...m})},onEnter:S=>{t&&t(S)}};return{...h,[p.name]:y}},{})},[e,t]);return M.useEffect(()=>{s(a(n))},[n,a]),!((i=n==null?void 0:n.rows)!=null&&i.length)||!((o=n.columns)!=null&&o.length)?null:r&&E.jsx("header",{className:rs["smp-appbar"],"aria-label":"App Bar",children:E.jsx(ts,{layout:n.rows[0].layout,cells:r})})},$e={"smp-dash-list":"_smp-dash-list_ajkcc_1","smp-dash-list-fill-space":"_smp-dash-list-fill-space_ajkcc_25","smp-dash-list-horizontal":"_smp-dash-list-horizontal_ajkcc_30","smp-layout-1":"_smp-layout-1_ajkcc_34","smp-layout-2":"_smp-layout-2_ajkcc_38","smp-layout-1__descr":"_smp-layout-1__descr_ajkcc_67","smp-layout-2__descr":"_smp-layout-2__descr_ajkcc_68","smp-layout-1__value":"_smp-layout-1__value_ajkcc_76","smp-layout-2__value":"_smp-layout-2__value_ajkcc_77","smp-layout-2__icon":"_smp-layout-2__icon_ajkcc_84"},ke=n=>n==null?!1:typeof n=="string"?n.toLocaleLowerCase()=="yes":n,ss=({ColumnsNumber:n=1,data:e={},ForceText:t,TextColName:r,TextColor:s="var(--smp-dashList-color-base)",Fillspace:a,FontSize:i,Horizontal:o,ForceIcon:l,IconColName:u,IconColor:f="var(--smp-dashList-color-base)",NumberFormat:c,ForceUM:h,UmColName:p,UmColor:m="var(--smp-dashList-color-base)",ForceValue:y,ValueColName:S,ValueColor:w="var(--smp-dashList-color-base)",SelectLayout:v="1",onClick:O})=>{const D="N/A",b=(e==null?void 0:e.columns)||[],C=(e==null?void 0:e.rows)||[],j=C.length>0,U="--smp-dashList-color",V="smp-layout",$="descr",F="icon",W="um",X="value",B=i||"1em",ne="18px",J="--smp-dashList-columns",Y="--smp-dashList-fontSize",z={dash:(N="1")=>{const G=d(N),ee=$e[G],te=g(G,$),le=g(G,F),ye=g(G,W),ce=g(G,X);return{container:ee,descr:te,icon:le,um:ye,value:ce}},dashList:`${$e["smp-dash-list"]} ${ke(a)?$e["smp-dash-list-fill-space"]:""}
49
+ ${x?he["smp-datepickercalendar-td-disabled"]:""}`},z=()=>`${v[f]} ${h.toString()}`;return E.jsxs("div",{className:Y.wrapper,ref:s,role:"dialog",tabIndex:-1,"aria-modal":"true",children:[E.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[E.jsx(Le,{onClick:C,ariaLabel:a(bt.PREVIOUS_MONTH),bindValue:"<",appearance:"ghost",variant:"base"}),E.jsx("div",{"aria-label":z(),className:Y.label,children:z()}),E.jsx(Le,{onClick:j,ariaLabel:a(bt.NEXT_MONTH),bindValue:">",appearance:"ghost",variant:"base"})]}),E.jsxs("table",{ref:S,role:"grid","aria-label":`${a(Et.CALENDAR_FOR)} ${v[f]} ${h}`,className:Y.table,children:[E.jsx("thead",{children:E.jsx("tr",{children:O.map(k=>E.jsx("th",{scope:"col",abbr:k.full,className:Y.th,children:k.value},k.value))})}),E.jsx("tbody",{children:ne.map((k,d)=>E.jsx("tr",{children:k.map((g,x)=>{const T=d*7+x;if(g===null)return E.jsx("td",{className:Y.td(!1,!1,!1,!0)},`empty-${x}`);const _=g.getDate()===o.getDate()&&g.getMonth()===o.getMonth()&&g.getFullYear()===o.getFullYear(),R=l&&g.getDate()===l.getDate()&&g.getMonth()===l.getMonth()&&g.getFullYear()===l.getFullYear(),L=m===g.getDate(),I=D(g);return E.jsx("td",{role:"gridcell","aria-selected":R,tabIndex:L?0:-1,onClick:()=>b(g),onKeyDown:A=>F(A,T),"aria-label":`${g.getDate()} ${v[g.getMonth()]} ${g.getFullYear()}`,"data-selected":R,"aria-disabled":I,ref:A=>{w.current[T]=A},className:Y.td(_,R,L,I),children:g.getDate()},`day-${x}`)})},`week-${d}`))})]})]})}const wr=({bindValue:n,placeholder:e,onChange:t,disabledDateRanges:r,...s})=>{const[a,i]=M.useState(!1),[o,l]=M.useState(n||""),[u,f]=M.useState(""),{anchorRef:c,targetRef:h}=xt({position:"bottom",enabled:a});ze(h,()=>{i(!1)}),ze(c,()=>{if(typeof c=="object"&&c!==null&&"current"in c){const C=c.current.querySelector("input");C&&C===document.activeElement&&w()}}),xr(a,h);const{format:p,getCurrentLanguage:m}=rt(),y=M.useCallback(C=>{const j=C.length>5&&Nr(C,m())||C,U=p(j,void 0,void 0,{type:"date"}),V=typeof j!="string",$=V&&j.toISOString().substring(0,10)||"";return{isValid:V,formattedDate:U,isoDate:$,normalizedDate:j}},[m,p]);M.useEffect(()=>{const{formattedDate:C,isoDate:j,isValid:U}=y(n);l(U&&j||n),f(U&&C||n)},[n,p,y]);const S=()=>i(C=>!C),w=()=>{O(u)},v=C=>{O(C),i(!1)},O=C=>{const{isoDate:j,isValid:U}=y(C);t&&t(U&&j||C)},D=C=>{f(C)},b=C=>{C.key==="Enter"&&(C.preventDefault(),O(u))};return E.jsxs("div",{children:[E.jsx(Se,{bindValue:u,placeholder:e,onBlur:w,onChange:D,onKeyDown:b,shapeIcon:"calendar",onShapeIconClick:S,ref:c,...s}),a&&E.jsx(Gn,{disabledDateRanges:r,onDateChange:v,initialValue:vt(o)&&o||"",targetRef:h})]})},Jn={"smp-multipleAutocomplete-container":"_smp-multipleAutocomplete-container_1mtv2_1"},Xn=({elements:n,displayMode:e,minimumChars:t,listDisplayMode:r,placeholder:s,fun:a,onOptionsRequest:i,onChange:o})=>{const l=n.map(c=>c.bindValue),u=(c,h)=>{const p=[...n];if(c=="")p.pop();else{const m=p.findIndex(y=>y.bindValue===c&&y.optionalDisplayValue===h);m>=0?p.splice(m,1):p.push({bindValue:c,optionalDisplayValue:h})}o==null||o(p)},f={container:`${Jn["smp-multipleAutocomplete-container"]}`};return E.jsxs("div",{className:f.container,children:[E.jsx(vr,{elements:n,displayMode:e,isEditable:!0,onChange:c=>{o==null||o(c)}}),E.jsx(_t,{bindValue:"",fun:a,onChange:u,_changeOnEnter:!0,listDisplayMode:r,minimumChars:t,placeholder:s,onOptionsRequest:i,_multiActiveIndex:l})]})},Or=({...n})=>{const[e,t]=M.useState(!1),r=e?"visibility-off":"visibility";return E.jsx(Se,{...n,inputType:e?"text":"password",shapeIcon:r,onShapeIconClick:()=>t(!e),ariaLabel:"password"})},Zn=({...n})=>{const[e,t]=M.useState(n.bindValue),{translate:r}=rt(),s=a=>{var i;a.key==="Enter"&&(a.preventDefault(),(i=n.onEnter)==null||i.call(n,e))};return E.jsx(Se,{...n,placeholder:n.placeholder?n.placeholder:r(Et.SPOTLIGHT_DEFAULT_PLACEHOLDER),icon:"magnify",inputType:"search",bindValue:e,onChange:t,onKeyDown:s,ariaLabel:"search bar"})};class xe{constructor(e,t){ve(this,"class");ve(this,"value");this.class=e,this.value=t}static fromDataObj(e){return new xe(e,e.k.split(";"))}static fromString(e){return new xe({t:"",p:""},e.split(";"))}getValue(){return this.value}getLegacyValue(){return this.value.join(";")}}const qe=(n,e,t)=>({obj:{t:n.obj.t,p:n.obj.p,k:e},decode:t||n.decode,shape:n.shape}),lr=n=>{const e=xe.fromDataObj(n.obj),t=n.decode?xe.fromString(n.decode).getValue():[];return e.getValue().map((r,s)=>({bindValue:r,optionalDisplayValue:t.length>=s?t[s]:""}))},Qn=(n,e)=>{const t=new xe(n.obj,e.map(s=>s.bindValue)).getLegacyValue(),r=new xe(n.obj,e.map(s=>s.optionalDisplayValue?s.optionalDisplayValue:"")).getLegacyValue();return qe(n,t,r)},Tr=({decode:n,shape:e,obj:t,data:r,icon:s,fun:a,placeholderIcon:i,label:o,onChange:l,onClick:u,onEnter:f,onBlur:c,onOptionsRequest:h})=>{const p={obj:t,shape:e,decode:n},m={onBlur:c,onOptionsRequest:h,fun:a,icon:s,label:o,...r},y=(v,O)=>jr(t)?qe(p,new Be(t,v).getLegacyValue()):qe(p,v,O),S=v=>qe(p,new Ke(t,v).getLegacyValue()),w=v=>Qn(p,v);switch(e){case ue.AUTOCOMPLETE:{const v={...m,bindValue:t.k,optionalDisplayValue:n,onChange:(O,D)=>{l==null||l(y(O,D))}};return E.jsx(_t,{...v})}case ue.BUTTON:{const v={...m,bindValue:t.k,optionalDisplayValue:n,onClick:()=>{u==null||u(y(t.k))}};return E.jsx(Le,{...v})}case ue.COMBOBOX:{const v={...m,bindValue:t.k,optionalDisplayValue:n,onChange:(O,D)=>{l==null||l(y(O,D))}};return E.jsx(Sr,{...v})}case ue.CHECKBOX:{const v={...m,bindValue:Ke.fromDataObj(t).getValue(),optionalDisplayValue:n,onChange:O=>{l==null||l(S(O))}};return E.jsx(br,{...v})}case ue.CHIP:{const v={...m,elements:lr(p)};return E.jsx(vr,{...v})}case ue.DATE:{const v={...m,bindValue:Be.fromDataObj(t).getValue(),onChange:O=>{l==null||l(y(O))}};return E.jsx(wr,{...v})}case ue.ICON:{const v={...m,icon:s,placeholderIcon:i,onClick:()=>{u==null||u(y(t.k))}};return E.jsx(ge,{...v})}case ue.MULTI_AUTOCOMPLETE:{const v={...m,elements:lr(p),onChange:O=>{l==null||l(w(O))}};return E.jsx(Xn,{...v})}case ue.PASSWORD:{const v={...m,bindValue:t.k,onChange:O=>{l==null||l(y(O))}};return E.jsx(Or,{...v})}case ue.SPOTLIGHT:{const v={...m,bindValue:t.k,onEnter:O=>{f==null||f(y(O))}};return E.jsx(Zn,{...v})}case ue.TEXT_FIELD:case void 0:{const v={...m,bindValue:t.k,onChange:O=>{l==null||l(y(O))}};return E.jsx(Se,{...v})}}},es=(n,e)=>{const t=[];for(let r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t},Rr=(n,e)=>n.map(t=>{var a,i;if((a=t.sections)!=null&&a.length)return{...t,sections:Rr(t.sections,e),content:t.content};let r=t.sections,s=t.content;return(i=t.content)!=null&&i.length&&t.columns&&+t.columns>1&&(r=es(t.content.filter(l=>!!e[l.id]),+t.columns).map((l,u)=>({...t,id:`${t.id}-${u}`,content:l,gridCols:t.columns,horizontal:!0})),s=[]),{...t,sections:r,content:s}}),cr=(n,e)=>{const t=n.some(r=>r.dim)?n.map(r=>r.dim||"auto").join(" "):`repeat(${n.length}, 1fr)`;return{[e]:t}},fe={"smp-layout":"_smp-layout_1trbe_1","smp-layout-horizontal":"_smp-layout-horizontal_1trbe_10","smp-layout-section-grid":"_smp-layout-section-grid_1trbe_15","smp-layout-section-vertical":"_smp-layout-section-vertical_1trbe_17","smp-layout-section-horizontal":"_smp-layout-section-horizontal_1trbe_21","smp-layout-section-flex":"_smp-layout-section-flex_1trbe_26","smp-grid-template-cols":"_smp-grid-template-cols_1trbe_38","smp-grid-template-rows":"_smp-grid-template-rows_1trbe_42","smp-layout-section-with-title":"_smp-layout-section-with-title_1trbe_46","smp-layout-section-title":"_smp-layout-section-title_1trbe_52","smp-layout-cell-container":"_smp-layout-cell-container_1trbe_58"},ts=({layout:n,cells:e})=>{var f;if(!((f=n.sections)!=null&&f.length))return E.jsx(E.Fragment,{});const t="--smp-grid-template-cols",r=Rr(n.sections,e),s=c=>c==null?void 0:c.reduce((h,p)=>{var v,O;let m="",y={},S={},w="";return(v=p.sections)!=null&&v.length?(m=fe["smp-layout-section-grid"],y=s(p.sections),p.gridCols==null&&p.horizontal&&(w=`${fe["smp-grid-template-cols"]}`,S=cr(p.sections,t))):(O=p.content)!=null&&O.length&&(p.gridCols&&p.gridCols>0?(m=fe["smp-layout-section-grid"],w=`${fe["smp-grid-template-cols"]}`,S={[t]:`repeat(${p.gridCols}, 1fr)`}):m=fe["smp-layout-section-flex"]),{...h,...y,[p.id]:{classes:`${m} ${fe[p.horizontal?"smp-layout-section-horizontal":"smp-layout-section-vertical"]} ${w} ${p.hdsp?`smp-justifyContent-${p.hdsp}`:""} ${p.vdsp?`smp-alignItems-${p.vdsp}`:""}`,styles:S}}},{}),a=s(r),i={container:`${fe["smp-layout"]} ${n.horizontal?fe["smp-layout-horizontal"]:""}`,sections:a},o=cr(r,t),l=c=>{var p;const h=E.jsx("div",{"smp-id":"section-"+c.id,className:i.sections[c.id].classes,style:i.sections[c.id].styles,children:(p=c.sections)!=null&&p.length?c.sections.map(m=>l(m)):c.content.map(m=>u(m,e[m.id],c.hdsp,c.vdsp))},"section-"+c.id);return c.title?E.jsxs("div",{className:`${fe["smp-layout-section-with-title"]}`,children:[E.jsx("span",{className:`${fe["smp-layout-section-title"]} ${c.hdsp?`smp-justifyContent-${c.hdsp}`:""} ${c.vdsp?`smp-alignItems-${c.vdsp}`:""}`,children:E.jsx(fr,{label:c.title})}),h]}):h},u=(c,h,p,m)=>{const y=c.colSpan!==void 0?c.colSpan>0?c.colSpan:c.colStart!==void 0&&c.colStart<1?1:null:null,S=y!==null?`span ${y}`:c.colStart,w=c.colEnd!==void 0&&c.colEnd>0?c.colEnd:"",v={gridColumnStart:S,gridColumnEnd:w},O=`${fe["smp-layout-cell-container"]} ${p?`smp-justifyContent-${p}`:""} ${m?`smp-alignItems-${m}`:""}`;return E.jsx("div",{className:O,style:{...v},"smp-id":c.id,children:h?E.jsx(Tr,{...h}):E.jsx(E.Fragment,{})},c.id)};return E.jsx("div",{className:i.container,style:o,"smp-id":"layout",children:r==null?void 0:r.map(c=>l(c))})},rs={"smp-appbar":"_smp-appbar_u7bbt_1"},ns=({data:n,onClick:e,onEnter:t})=>{var i,o;const[r,s]=M.useState(),a=M.useCallback(l=>{var f,c;if(!((f=l.rows)!=null&&f.length)||!((c=l.columns)!=null&&c.length))return{};const u=l.rows[0];return l.columns.filter(h=>h.visible).reduce((h,p)=>{const m=u.cells[p.name],y={...m,onChange:S=>{s(w=>w&&{...w,[p.name]:{...w[p.name],obj:{...w[p.name].obj,k:S.obj.k}}})},onClick:()=>{m.fun&&e&&e({...m})},onEnter:S=>{t&&t(S)}};return{...h,[p.name]:y}},{})},[e,t]);return M.useEffect(()=>{s(a(n))},[n,a]),!((i=n==null?void 0:n.rows)!=null&&i.length)||!((o=n.columns)!=null&&o.length)?null:r&&E.jsx("header",{className:rs["smp-appbar"],"aria-label":"App Bar",children:E.jsx(ts,{layout:n.rows[0].layout,cells:r})})},$e={"smp-dash-list":"_smp-dash-list_ajkcc_1","smp-dash-list-fill-space":"_smp-dash-list-fill-space_ajkcc_25","smp-dash-list-horizontal":"_smp-dash-list-horizontal_ajkcc_30","smp-layout-1":"_smp-layout-1_ajkcc_34","smp-layout-2":"_smp-layout-2_ajkcc_38","smp-layout-1__descr":"_smp-layout-1__descr_ajkcc_67","smp-layout-2__descr":"_smp-layout-2__descr_ajkcc_68","smp-layout-1__value":"_smp-layout-1__value_ajkcc_76","smp-layout-2__value":"_smp-layout-2__value_ajkcc_77","smp-layout-2__icon":"_smp-layout-2__icon_ajkcc_84"},ke=n=>n==null?!1:typeof n=="string"?n.toLocaleLowerCase()=="yes":n,ss=({ColumnsNumber:n=1,data:e={},ForceText:t,TextColName:r,TextColor:s="var(--smp-dashList-color-base)",Fillspace:a,FontSize:i,Horizontal:o,ForceIcon:l,IconColName:u,IconColor:f="var(--smp-dashList-color-base)",NumberFormat:c,ForceUM:h,UmColName:p,UmColor:m="var(--smp-dashList-color-base)",ForceValue:y,ValueColName:S,ValueColor:w="var(--smp-dashList-color-base)",SelectLayout:v="1",onClick:O})=>{const D="N/A",b=(e==null?void 0:e.columns)||[],C=(e==null?void 0:e.rows)||[],j=C.length>0,U="--smp-dashList-color",V="smp-layout",$="descr",F="icon",W="um",X="value",B=i||"1em",ne="18px",J="--smp-dashList-columns",Y="--smp-dashList-fontSize",z={dash:(N="1")=>{const G=d(N),ee=$e[G],te=g(G,$),le=g(G,F),ye=g(G,W),ce=g(G,X);return{container:ee,descr:te,icon:le,um:ye,value:ce}},dashList:`${$e["smp-dash-list"]} ${ke(a)?$e["smp-dash-list-fill-space"]:""}
50
50
  ${ke(o)?$e["smp-dash-list-horizontal"]:""}`},{format:k}=rt(),d=N=>`${V}-${N}`,g=(N,G)=>$e[`${N}__${G}`],x=N=>`${U}-${N}`,T=N=>{const G=/R(\d{1,3})G(\d{1,3})B(\d{1,3})/;if(G.test(N)){const te=N.match(G)||[];if((te==null?void 0:te.length)>3)return"rgb("+te[1]+","+te[2]+","+te[3]+")"}return N},_=N=>{if(!c)return N;const[G,ee]=R(c).map(_e=>parseInt(_e||"0")),te="0,0"+(ee?"."+"0".repeat(ee):""),le=k(N,te,"it");if(!G)return le;const[ye,ce]=le.split(",");return ye+(ce?`,${ce}`:"")},R=N=>N.includes(";")?N.split(";"):[N],L=N=>{const G=te=>{var le;if(te)return(le=N==null?void 0:N.cells[te])==null?void 0:le.obj.k},ee=te=>{var le,ye;if(!(b.length<=te))return(ye=(le=N==null?void 0:N.cells[b[te].name])==null?void 0:le.obj)==null?void 0:ye.k};return{descr:t||G(r)||ee(2)||"",icon:l||G(u)||ee(3)||"",um:h||G(p)||ee(1)||"",value:y||G(S)||ee(0)||""}},I=N=>{O==null||O(N)},A=(N,G)=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),N.stopPropagation(),I(G))},H=(N=>{const G=z.dash(N);return{className:G,descr:ee=>E.jsx("div",{className:G.descr,children:ee},`${N}-${$}`),icon:ee=>E.jsx("div",{className:G.icon,children:E.jsx(ge,{color:f,height:ne,icon:ee,width:ne})},`${N}-${F}`),um:ee=>E.jsx("div",{className:G.um,children:ee},`${N}-${W}`),value:ee=>E.jsx("div",{className:G.value,children:ee},`${N}-${X}`)}})(v),re=N=>{const{descr:G,icon:ee,um:te,value:le}=L(N),ye={[x($)]:T(s),[x(W)]:T(m),[x(X)]:T(w)},ce=[],_e=_(le);switch(v){case"2":ee&&ce.push(H.icon(ee)),ce.push(H.descr(G)),ce.push(H.value(te?_e+" "+te:_e));break;default:case"1":ce.push(H.descr(G)),ce.push(H.value(te?_e+" "+te:_e))}return E.jsx("div",{className:H.className.container,role:"button",style:ye,tabIndex:0,onClick:()=>I(N),onKeyDown:Dr=>A(Dr,N),children:ce},N.id)},P={[J]:String(n),[Y]:B};return E.jsx("div",{className:z.dashList,style:P,children:j?C.map(N=>re(N)):D})},ur={"smp-field-container":"_smp-field-container_2ay2r_1","smp-field-position-Left":"_smp-field-position-Left_2ay2r_6","smp-field-position-Right":"_smp-field-position-Right_2ay2r_10","smp-field-position-Top":"_smp-field-position-Top_2ay2r_14","smp-field-position-Bottom":"_smp-field-position-Bottom_2ay2r_18"},as=({data:n,Type:e,ShowSubmit:t=!1,SubmitPosition:r="Right",DefaultValue:s,Label:a,LabelPosition:i="Left",onBlur:o,onClick:l,onOptionsRequest:u})=>{const[f,c]=M.useState();M.useEffect(()=>{c(()=>{const y={...n};return e&&(y.shape=e),s&&(y.obj=Ir(s)),y})},[n,s,e]);const h=ke(t)?ur[`smp-field-position-${r}`]:"",p={container:`${ur["smp-field-container"]} ${h}`},m=()=>{ke(t)||o==null||o(f)};if(f)return E.jsxs("div",{className:p.container,children:[E.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",font:"var(--smp-fontLabel-base)"},children:E.jsx(Tr,{...f,onChange:c,onOptionsRequest:u,fun:n.fun,onBlur:m,label:a,labelPosition:i})}),ke(t)&&E.jsx(Le,{bindValue:"Confirm",onClick:()=>l==null?void 0:l(f)})]})};exports.AppBar=ns;exports.Autocomplete=_t;exports.Button=Le;exports.Checkbox=br;exports.Combobox=Sr;exports.DashList=ss;exports.DatePicker=wr;exports.Field=as;exports.Icon=ge;exports.Password=Or;exports.Textfield=Se;exports.configurePaths=un;
@@ -4496,6 +4496,7 @@ const Be = (n, e, t) => ({
4496
4496
  const h = /* @__PURE__ */ E.jsx(
4497
4497
  "div",
4498
4498
  {
4499
+ "smp-id": "section-" + c.id,
4499
4500
  className: i.sections[c.id].classes,
4500
4501
  style: i.sections[c.id].styles,
4501
4502
  children: (p = c.sections) != null && p.length ? c.sections.map((m) => l(m)) : c.content.map(
@@ -4519,9 +4520,18 @@ const Be = (n, e, t) => ({
4519
4520
  gridColumnStart: S,
4520
4521
  gridColumnEnd: w
4521
4522
  }, T = `${fe["smp-layout-cell-container"]} ${p ? `smp-justifyContent-${p}` : ""} ${m ? `smp-alignItems-${m}` : ""}`;
4522
- return /* @__PURE__ */ E.jsx("div", { className: T, style: { ...b }, children: h ? /* @__PURE__ */ E.jsx(Or, { ...h }) : /* @__PURE__ */ E.jsx(E.Fragment, {}) }, c.id);
4523
+ return /* @__PURE__ */ E.jsx(
4524
+ "div",
4525
+ {
4526
+ className: T,
4527
+ style: { ...b },
4528
+ "smp-id": c.id,
4529
+ children: h ? /* @__PURE__ */ E.jsx(Or, { ...h }) : /* @__PURE__ */ E.jsx(E.Fragment, {})
4530
+ },
4531
+ c.id
4532
+ );
4523
4533
  };
4524
- return /* @__PURE__ */ E.jsx("div", { className: i.container, style: o, children: r == null ? void 0 : r.map((c) => l(c)) });
4534
+ return /* @__PURE__ */ E.jsx("div", { className: i.container, style: o, "smp-id": "layout", children: r == null ? void 0 : r.map((c) => l(c)) });
4525
4535
  }, is = {
4526
4536
  "smp-appbar": "_smp-appbar_u7bbt_1"
4527
4537
  }, us = ({ data: n, onClick: e, onEnter: t }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sme.up/ketchup2",
3
- "version": "2.0.0-SNAPSHOT-20250521153648",
3
+ "version": "2.0.0-SNAPSHOT-20250522154022",
4
4
  "description": "Sme.UP web components library",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Smeup LAB <info@smeup.com> (https://www.smeup.com/)",