@sme.up/ketchup2 2.0.0-SNAPSHOT-20250606104824 → 2.0.0-SNAPSHOT-20250606143603
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAA;AAEzD,OAAO,cAAc,CAAA;AAErB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAA;AAEzD,OAAO,cAAc,CAAA;AAErB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAoMxC,CAAA"}
|
package/dist/ketchup2.cjs.js
CHANGED
|
@@ -47,4 +47,4 @@ Valid keys: `+JSON.stringify(Object.keys(d),null," "));var C=re(M,H,T,P,N+"."+H
|
|
|
47
47
|
${d?"smp-datepickercalendar-td-selected":""}
|
|
48
48
|
${m?"smp-datepickercalendar-td-focused":""}
|
|
49
49
|
${S?"smp-datepickercalendar-td-disabled":""}`},G=()=>`${b[u]} ${p.toString()}`;return x.jsxs("div",{className:W.wrapper,ref:s,role:"dialog",tabIndex:-1,"aria-modal":"true","data-component":"datepicker-calendar",children:[x.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[x.jsx(Ce,{onClick:A,ariaLabel:a(ut.PREVIOUS_MONTH),bindValue:"<",appearance:"ghost",variant:"base"}),x.jsx("div",{"aria-label":G(),className:W.label,children:G()}),x.jsx(Ce,{onClick:k,ariaLabel:a(ut.NEXT_MONTH),bindValue:">",appearance:"ghost",variant:"base"})]}),x.jsxs("table",{ref:w,role:"grid","aria-label":`${a(gt.CALENDAR_FOR)} ${b[u]} ${p}`,className:W.table,children:[x.jsx("thead",{children:x.jsx("tr",{children:O.map(I=>x.jsx("th",{scope:"col",abbr:I.full,className:W.th,children:I.value},I.value))})}),x.jsx("tbody",{children:ne.map((I,d)=>x.jsx("tr",{children:I.map((m,S)=>{const D=d*7+S;if(m===null)return x.jsx("td",{className:W.td(!1,!1,!1,!0)},`empty-${S}`);const T=m.getDate()===i.getDate()&&m.getMonth()===i.getMonth()&&m.getFullYear()===i.getFullYear(),P=l&&m.getDate()===l.getDate()&&m.getMonth()===l.getMonth()&&m.getFullYear()===l.getFullYear(),N=h===m.getDate(),M=R(m);return x.jsx("td",{role:"gridcell","aria-selected":P,tabIndex:N?0:-1,onClick:()=>v(m),onKeyDown:L=>_(L,D),"aria-label":`${m.getDate()} ${b[m.getMonth()]} ${m.getFullYear()}`,"data-selected":P,"aria-disabled":M,ref:L=>{E.current[D]=L},className:W.td(T,P,N,M),children:m.getDate()},`day-${S}`)})},`week-${d}`))})]})]})}const mr=({bindValue:r,placeholder:e,onChange:t,disabledDateRanges:n,...s})=>{const[a,o]=j.useState(!1),[i,l]=j.useState(r||""),[c,u]=j.useState(""),{anchorRef:f,targetRef:p}=dt({position:"bottom",enabled:a});We(p,()=>{o(!1)}),We(f,()=>{if(typeof f=="object"&&f!==null&&"current"in f){const A=f.current.querySelector("input");A&&A===document.activeElement&&E()}}),dr(a,p);const{format:g,getCurrentLanguage:h}=Je(),y=j.useCallback(A=>{const k=A.length>5&&Ar(A,h())||A,Y=g(k,void 0,void 0,{type:"date"}),V=typeof k!="string",$=V&&k.toISOString().substring(0,10)||"";return{isValid:V,formattedDate:Y,isoDate:$,normalizedDate:k}},[h,g]);j.useEffect(()=>{const{formattedDate:A,isoDate:k,isValid:Y}=y(r);l(Y&&k||r),u(Y&&A||r)},[r,g,y]);const w=()=>o(A=>!A),E=()=>{O(c)},b=A=>{O(A),o(!1)},O=A=>{const{isoDate:k,isValid:Y}=y(A);t&&t(Y&&k||A)},R=A=>{u(A)},v=A=>{A.key==="Enter"&&(A.preventDefault(),O(c))};return x.jsxs("div",{"data-component":"date-picker",children:[x.jsx(be,{bindValue:c,placeholder:e,onBlur:E,onChange:R,onKeyDown:v,shapeIcon:"calendar",onShapeIconClick:w,ref:f,...s}),a&&x.jsx(Un,{disabledDateRanges:n,onDateChange:b,initialValue:ft(i)&&i||"",targetRef:p})]})},Wn=({elements:r,displayMode:e,minimumChars:t,listDisplayMode:n,placeholder:s,fun:a,onOptionsRequest:o,onChange:i})=>{const l=r.map(f=>f.bindValue),c=(f,p)=>{const g=[...r];if(f=="")g.pop();else{const h=g.findIndex(y=>y.bindValue===f&&y.optionalDisplayValue===p);h>=0?g.splice(h,1):g.push({bindValue:f,optionalDisplayValue:p})}i==null||i(g)},u={container:"smp-multipleAutocomplete-container"};return x.jsxs("div",{className:u.container,"data-component":"multiple-autocomplete",children:[x.jsx(fr,{elements:r,displayMode:e,isEditable:!0,onChange:f=>{i==null||i(f)}}),x.jsx(ht,{bindValue:"",fun:a,onChange:c,_changeOnEnter:!0,listDisplayMode:n,minimumChars:t,placeholder:s,onOptionsRequest:o,_multiActiveIndex:l})]})},yr=({...r})=>{const[e,t]=j.useState(!1),n=e?"visibility-off":"visibility";return x.jsx(be,{...r,inputType:e?"text":"password",shapeIcon:n,onShapeIconClick:()=>t(!e),ariaLabel:"password","data-component":"password"})},Hn=({...r})=>{const[e,t]=j.useState(r.bindValue),{translate:n}=Je(),s=a=>{var o;a.key==="Enter"&&(a.preventDefault(),(o=r.onEnter)==null||o.call(r,e))};return x.jsx(be,{...r,placeholder:r.placeholder?r.placeholder:n(gt.SPOTLIGHT_DEFAULT_PLACEHOLDER),icon:"magnify",inputType:"search",bindValue:e,onChange:t,onKeyDown:s,ariaLabel:"search bar",_dataComponent:"search-bar"})};class ve{constructor(e,t){ye(this,"class");ye(this,"value");this.class=e,this.value=t}static fromDataObj(e){return new ve(e,e.k.split(";"))}static fromString(e){return new ve({t:"",p:""},e.split(";"))}getValue(){return this.value}getLegacyValue(){return this.value.join(";")}}const Ve=(r,e,t)=>({obj:{t:r.obj.t,p:r.obj.p,k:e},decode:t||r.decode,shape:r.shape}),er=r=>{const e=ve.fromDataObj(r.obj),t=r.decode?ve.fromString(r.decode).getValue():[];return e.getValue().map((n,s)=>({bindValue:n,optionalDisplayValue:t.length>=s?t[s]:""}))},qn=(r,e)=>{const t=new ve(r.obj,e.map(s=>s.bindValue)).getLegacyValue(),n=new ve(r.obj,e.map(s=>s.optionalDisplayValue?s.optionalDisplayValue:"")).getLegacyValue();return Ve(r,t,n)},vr=({decode:r,shape:e,obj:t,data:n,icon:s,fun:a,placeholderIcon:o,label:i,onChange:l,onClick:c,onEnter:u,onBlur:f,onOptionsRequest:p})=>{const g={obj:t,shape:e,decode:r},h={onBlur:f,onOptionsRequest:p,fun:a,icon:s,label:i,...n},y=(b,O)=>Pr(t)?Ve(g,new Ue(t,b).getLegacyValue()):Ve(g,b,O),w=b=>Ve(g,new Ye(t,b).getLegacyValue()),E=b=>qn(g,b);switch(e){case oe.AUTOCOMPLETE:{const b={...h,bindValue:t.k,optionalDisplayValue:r,onChange:(O,R)=>{l==null||l(y(O,R))}};return x.jsx(ht,{...b})}case oe.BUTTON:{const b={...h,bindValue:t.k,optionalDisplayValue:r,onClick:()=>{c==null||c(y(t.k))}};return x.jsx(Ce,{...b})}case oe.COMBOBOX:{const b={...h,bindValue:t.k,optionalDisplayValue:r,onChange:(O,R)=>{l==null||l(y(O,R))}};return x.jsx(pr,{...b})}case oe.CHECKBOX:{const b={...h,bindValue:Ye.fromDataObj(t).getValue(),optionalDisplayValue:r,onChange:O=>{l==null||l(w(O))}};return x.jsx(ur,{...b})}case oe.CHIP:{const b={...h,elements:er(g)};return x.jsx(fr,{...b})}case oe.DATE:{const b={...h,bindValue:Ue.fromDataObj(t).getValue(),onChange:O=>{l==null||l(y(O))}};return x.jsx(mr,{...b})}case oe.ICON:case oe.IMAGE:{const b={...h,icon:s,placeholderIcon:o,isInteractable:!!h.fun,onClick:()=>{c==null||c(y(t.k))}};return x.jsx(de,{...b})}case oe.MULTI_AUTOCOMPLETE:{const b={...h,elements:er(g),onChange:O=>{l==null||l(E(O))}};return x.jsx(Wn,{...b})}case oe.PASSWORD:{const b={...h,bindValue:t.k,onChange:O=>{l==null||l(y(O))}};return x.jsx(yr,{...b})}case oe.SPOTLIGHT:{const b={...h,bindValue:t.k,onEnter:O=>{u==null||u(y(O))}};return x.jsx(Hn,{...b})}case oe.TEXT_FIELD:case void 0:{const b={...h,bindValue:t.k,onChange:O=>{l==null||l(y(O))}};return x.jsx(be,{...b})}}},Kn=(r,e)=>{const t=[];for(let n=0;n<r.length;n+=e)t.push(r.slice(n,n+e));return t},br=(r,e)=>r.map(t=>{var a,o;if((a=t.sections)!=null&&a.length)return{...t,sections:br(t.sections,e),content:t.content};let n=t.sections,s=t.content;return(o=t.content)!=null&&o.length&&t.columns&&+t.columns>1&&(n=Kn(t.content.filter(l=>!!e[l.id]),+t.columns).map((l,c)=>({...t,id:`${t.id}-${c}`,content:l,gridCols:t.columns,horizontal:!0})),s=[]),{...t,sections:n,content:s}}),tr=(r,e)=>{if(!e)return{};const t=r.some(n=>n.dim)?r.map(n=>n.dim||"auto").join(" "):`repeat(${r.length}, 1fr)`;return{[e]:t}},rr=r=>r.some(e=>e.dim&&!e.dim.endsWith("%")),ue={"smp-layout":"_smp-layout_xrjwg_1","smp-layout-horizontal":"_smp-layout-horizontal_xrjwg_9","smp-layout-vertical":"_smp-layout-vertical_xrjwg_13","smp-layout-section-grid":"_smp-layout-section-grid_xrjwg_18","smp-layout-section-vertical":"_smp-layout-section-vertical_xrjwg_20","smp-layout-section-horizontal":"_smp-layout-section-horizontal_xrjwg_24","smp-layout-section-flex":"_smp-layout-section-flex_xrjwg_29","smp-layout-cell-container":"_smp-layout-cell-container_xrjwg_34","smp-grid-template-cols":"_smp-grid-template-cols_xrjwg_44","smp-grid-template-rows":"_smp-grid-template-rows_xrjwg_48","smp-layout-section-with-title":"_smp-layout-section-with-title_xrjwg_52","smp-layout-section-title":"_smp-layout-section-title_xrjwg_58"},xr=({layout:r,cells:e})=>{var f;if(!((f=r.sections)!=null&&f.length))return x.jsx(x.Fragment,{});const t="--smp-grid-template-cols",n="--smp-grid-template-rows",s=br(r.sections,e),a=p=>p==null?void 0:p.reduce((g,h)=>{var O,R;let y="",w={},E={},b="";return(O=h.sections)!=null&&O.length?(y=ue["smp-layout-section-grid"],w=a(h.sections),h.gridCols==null&&(b=`${ue[h.horizontal?"smp-grid-template-cols":"smp-grid-template-rows"]}`,(h.horizontal||rr(h.sections))&&(E=tr(h.sections,h.horizontal?t:n)))):(R=h.content)!=null&&R.length&&(h.gridCols!==void 0&&h.gridCols>0?(y=ue["smp-layout-section-grid"],b=`${ue["smp-grid-template-cols"]}`,E={[t]:`repeat(${h.gridCols}, 1fr)`}):y=ue["smp-layout-section-flex"]),{...g,...w,[h.id]:{classes:`${y} ${ue[h.horizontal?"smp-layout-section-horizontal":"smp-layout-section-vertical"]} ${b} ${h.hdsp?`smp-justifyContent-${h.hdsp}`:""} ${h.vdsp?`smp-alignItems-${h.vdsp}`:""}`,styles:E}}},{}),o=a(s),i={container:`${ue["smp-layout"]} ${r.horizontal?ue["smp-layout-horizontal"]:ue["smp-layout-vertical"]}`,sections:o},l=r.horizontal||rr(r.sections)?tr(s,r.horizontal?t:n):{},c=p=>{var h;const g=x.jsx("div",{"smp-id":"section-"+p.id,className:i.sections[p.id].classes,style:i.sections[p.id].styles,children:(h=p.sections)!=null&&h.length?p.sections.map(y=>c(y)):p.content.map(y=>u(y,e[y.id],p.hdsp,p.vdsp))},"section-"+p.id);return p.title?x.jsxs("div",{className:`${ue["smp-layout-section-with-title"]}`,children:[x.jsx("span",{className:`${ue["smp-layout-section-title"]} ${p.hdsp?`smp-justifyContent-${p.hdsp}`:""} ${p.vdsp?`smp-alignItems-${p.vdsp}`:""}`,children:x.jsx(nr,{label:p.title})}),g]}):g},u=(p,g,h,y)=>{const w=p.colSpan!==void 0?p.colSpan>0?p.colSpan:p.colStart!==void 0&&p.colStart<1?1:null:null,E=w!==null?`span ${w}`:p.colStart,b=p.colEnd!==void 0&&p.colEnd>0?p.colEnd:"",O={gridColumnStart:E,gridColumnEnd:b},R=`${ue["smp-layout-cell-container"]} ${h?`smp-justifyContent-${h}`:""} ${y?`smp-alignItems-${y}`:""}`;return g?x.jsx("div",{className:R,style:{...O},"smp-id":p.id,children:x.jsx(vr,{...g})},p.id):x.jsx(x.Fragment,{})};return x.jsx("div",{className:i.container,style:l,"smp-id":"layout",children:s==null?void 0:s.map(p=>c(p))})},Bn=({data:r,onClick:e,onEnter:t})=>{var o,i;const[n,s]=j.useState(),a=j.useCallback(l=>{var u,f;if(!((u=l.rows)!=null&&u.length)||!((f=l.columns)!=null&&f.length))return{};const c=l.rows[0];return l.columns.filter(p=>p.visible).reduce((p,g)=>{const h=c.cells[g.name],y={...h,onChange:w=>{s(E=>E&&{...E,[g.name]:{...E[g.name],obj:{...E[g.name].obj,k:w.obj.k}}})},onClick:()=>{h.fun&&e&&e({...h})},onEnter:w=>{t&&t(w)}};return{...p,[g.name]:y}},{})},[e,t]);return j.useEffect(()=>{s(a(r))},[r,a]),!((o=r==null?void 0:r.rows)!=null&&o.length)||!((i=r.columns)!=null&&i.length)?null:n&&x.jsx("header",{className:"smp-appbar","aria-label":"App Bar",children:x.jsx(xr,{layout:r.rows[0].layout,cells:n})})},Pe=r=>r==null?!1:typeof r=="string"?r.toLocaleLowerCase()=="yes":r,Gn=({ColumnsNumber:r=1,data:e={},ForceText:t,TextColName:n,TextColor:s="var(--smp-dashList-color-base)",Fillspace:a,FontSize:o,Horizontal:i,ForceIcon:l,IconColName:c,IconColor:u="var(--smp-dashList-color-base)",NumberFormat:f,ForceUM:p,UmColName:g,UmColor:h="var(--smp-dashList-color-base)",ForceValue:y,ValueColName:w,ValueColor:E="var(--smp-dashList-color-base)",SelectLayout:b="1",onClick:O})=>{const R="N/A",v=(e==null?void 0:e.columns)||[],A=(e==null?void 0:e.rows)||[],k=A.length>0,Y="--smp-dashList-color",V="smp-layout",$="descr",_="icon",U="um",X="value",K=o||"1em",ne="18px",J="--smp-dashList-columns",W="--smp-dashList-fontSize",G={dash:(F="1")=>{const z=d(F),ee=z,te=m(z,$),ce=m(z,_),ge=m(z,U),fe=m(z,X);return{container:ee,descr:te,icon:ce,um:ge,value:fe}},dashList:`smp-dash-list ${Pe(a)?"smp-dash-list-fill-space":""}
|
|
50
|
-
${Pe(i)?"smp-dash-list-horizontal":""}`},{format:I}=Je(),d=F=>`${V}-${F}`,m=(F,z)=>`${F}__${z}`,S=F=>`${Y}-${F}`,D=F=>{const z=/R(\d{1,3})G(\d{1,3})B(\d{1,3})/;if(z.test(F)){const te=F.match(z)||[];if((te==null?void 0:te.length)>3)return"rgb("+te[1]+","+te[2]+","+te[3]+")"}return F},T=F=>{if(!f)return F;const[z,ee]=P(f).map(xe=>parseInt(xe||"0")),te="0,0"+(ee?"."+"0".repeat(ee):""),ce=I(F,te,"it");if(!z)return ce;const[ge,fe]=ce.split(",");return ge+(fe?`,${fe}`:"")},P=F=>F.includes(";")?F.split(";"):[F],N=F=>{const z=te=>{var ce;if(te)return(ce=F==null?void 0:F.cells[te])==null?void 0:ce.obj.k},ee=te=>{var ce,ge;if(!(v.length<=te))return(ge=(ce=F==null?void 0:F.cells[v[te].name])==null?void 0:ce.obj)==null?void 0:ge.k};return{descr:t||z(n)||ee(2)||"",icon:l||z(c)||ee(3)||"",um:p||z(g)||ee(1)||"",value:y||z(w)||ee(0)||""}},M=F=>{O==null||O(F)},L=(F,z)=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),F.stopPropagation(),M(z))},H=(F=>{const z=G.dash(F);return{className:z,descr:ee=>x.jsx("div",{className:z.descr,children:ee},`${F}-${$}`),icon:ee=>x.jsx("div",{className:z.icon,children:x.jsx(de,{color:u,height:ne,icon:ee,width:ne})},`${F}-${_}`),um:ee=>x.jsx("div",{className:z.um,children:ee},`${F}-${U}`),value:ee=>x.jsx("div",{className:z.value,children:ee},`${F}-${X}`)}})(b),re=F=>{const{descr:z,icon:ee,um:te,value:ce}=N(F),ge={[S($)]:D(s),[S(U)]:D(h),[S(X)]:D(E)},fe=[],xe=T(ce);switch(b){case"2":ee&&fe.push(H.icon(ee)),fe.push(H.descr(z)),fe.push(H.value(te?xe+" "+te:xe));break;default:case"1":fe.push(H.descr(z)),fe.push(H.value(te?xe+" "+te:xe))}return x.jsx("div",{className:H.className.container,role:"button",style:ge,tabIndex:0,onClick:()=>M(F),onKeyDown:Sr=>L(Sr,F),children:fe},F.id)},C={[J]:String(r),[W]:K};return x.jsx("div",{className:G.dashList,style:C,children:k?A.map(F=>re(F)):R})},zn=({data:r,logo:e,open:t,minifiedOnClose:n=!0,customHeight:s="100vh",onClick:a,onEnter:o,onClose:i})=>{var b,O;const[l,c]=j.useState(),[u,f]=j.useState(t??!0),p=j.useRef(null),g=s.trim()?s:"100vh",h=j.useCallback(R=>{var A,k;if(!((A=R.rows)!=null&&A.length)||!((k=R.columns)!=null&&k.length))return{};const v=R.rows[0];return R.columns.filter(Y=>Y.visible).reduce((Y,V)=>{const $=v.cells[V.name];if(!u&&n&&$.shape!==oe.BUTTON)return Y;const _={...$,onChange:U=>{c(X=>{const K={...X};return K!=null&&K[V.name]&&(K[V.name].obj.k=U.obj.k),K})},onClick:()=>{$.fun&&a&&a({...$})},onEnter:U=>{o&&o(U)}};return!u&&n&&(_.data={..._.data,showText:!1}),{...Y,[V.name]:_}},{})},[a,o,u,n]),y=j.useCallback(()=>{i==null||i()},[i]),w=()=>{n?f(R=>!R):(f(!1),i==null||i())};if(j.useEffect(()=>{c(h(r))},[r]),j.useEffect(()=>{if(!p.current)return;if(!n){c(h(r));return}const R=getComputedStyle(p.current).getPropertyValue("--smp-drawer-slide-transition");let v=Number(R);R.endsWith("ms")?v=parseFloat(R):R.endsWith("s")&&(v=parseFloat(R)*1e3),setTimeout(()=>{c(h(r))},v/2)},[u,n]),j.useEffect(()=>{t!==void 0&&!n&&f(t)},[n,t]),!((b=r==null?void 0:r.rows)!=null&&b.length)||!((O=r.columns)!=null&&O.length))return null;const E={drawer:`smp-drawer ${n?"smp-drawer-minified":"smp-drawer-fixed"} ${u?"smp-drawer-open":""}`,container:"smp-drawer-container",containerHeader:"smp-drawer-container-header",containerIcon:`${u?"":"smp-drawer-container-icon-close"} smp-drawer-container-icon`,containerLayout:"smp-drawer-container-layout",containerLogo:"smp-drawer-container-logo",backdrop:`smp-drawer-backdrop ${u?"smp-drawer-backdrop-open":""}`};return l&&x.jsxs(x.Fragment,{children:[!n&&x.jsx("div",{"aria-hidden":"true","aria-label":"drawer-backdrop",className:E.backdrop,onClick:y}),x.jsx("aside",{ref:p,className:E.drawer,style:{height:g},"aria-label":"Drawer",children:x.jsxs("div",{className:E.container,children:[x.jsxs("div",{className:E.containerHeader,children:[e&&x.jsx("div",{className:E.containerLogo,children:x.jsx(de,{icon:e,title:"drawer_logo",width:"100%",height:24})}),x.jsx("div",{className:E.containerIcon,children:x.jsx(de,{icon:n?"menu_close":"close",title:"drawer_icon",rotated:!u,isInteractable:!0,onClick:w,width:20,height:20})})]}),x.jsx("div",{className:E.containerLayout,children:x.jsx(xr,{layout:r.rows[0].layout,cells:l})})]})})]})},Jn=({data:r,Type:e,ShowSubmit:t=!1,SubmitPosition:n="Right",DefaultValue:s,Label:a,LabelPosition:o="Left",onBlur:i,onClick:l,onOptionsRequest:c})=>{const[u,f]=j.useState();j.useEffect(()=>{f(()=>{const y={...r};return e&&(y.shape=e),s&&(y.obj=Cr(s)),y})},[r,s,e]);const g={container:`smp-field-container ${Pe(t)?`smp-field-position-${n}`:""}`},h=()=>{Pe(t)||i==null||i(u)};if(u)return x.jsxs("div",{className:g.container,children:[x.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",font:"var(--smp-fontLabel-base)"},children:x.jsx(vr,{...u,onChange:f,onOptionsRequest:c,fun:r.fun,onBlur:h,label:a,labelPosition:o})}),Pe(t)&&x.jsx(Ce,{bindValue:"Confirm",onClick:()=>l==null?void 0:l(u)})]})};exports.AppBar=Bn;exports.Autocomplete=ht;exports.Button=Ce;exports.Checkbox=ur;exports.Combobox=pr;exports.DashList=Gn;exports.DatePicker=mr;exports.Drawer=zn;exports.Field=Jn;exports.Icon=de;exports.Password=yr;exports.Textfield=be;exports.configurePaths=rn;
|
|
50
|
+
${Pe(i)?"smp-dash-list-horizontal":""}`},{format:I}=Je(),d=F=>`${V}-${F}`,m=(F,z)=>`${F}__${z}`,S=F=>`${Y}-${F}`,D=F=>{const z=/R(\d{1,3})G(\d{1,3})B(\d{1,3})/;if(z.test(F)){const te=F.match(z)||[];if((te==null?void 0:te.length)>3)return"rgb("+te[1]+","+te[2]+","+te[3]+")"}return F},T=F=>{if(!f)return F;const[z,ee]=P(f).map(xe=>parseInt(xe||"0")),te="0,0"+(ee?"."+"0".repeat(ee):""),ce=I(F,te,"it");if(!z)return ce;const[ge,fe]=ce.split(",");return ge+(fe?`,${fe}`:"")},P=F=>F.includes(";")?F.split(";"):[F],N=F=>{const z=te=>{var ce;if(te)return(ce=F==null?void 0:F.cells[te])==null?void 0:ce.obj.k},ee=te=>{var ce,ge;if(!(v.length<=te))return(ge=(ce=F==null?void 0:F.cells[v[te].name])==null?void 0:ce.obj)==null?void 0:ge.k};return{descr:t||z(n)||ee(2)||"",icon:l||z(c)||ee(3)||"",um:p||z(g)||ee(1)||"",value:y||z(w)||ee(0)||""}},M=F=>{O==null||O(F)},L=(F,z)=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),F.stopPropagation(),M(z))},H=(F=>{const z=G.dash(F);return{className:z,descr:ee=>x.jsx("div",{className:z.descr,children:ee},`${F}-${$}`),icon:ee=>x.jsx("div",{className:z.icon,children:x.jsx(de,{color:u,height:ne,icon:ee,width:ne})},`${F}-${_}`),um:ee=>x.jsx("div",{className:z.um,children:ee},`${F}-${U}`),value:ee=>x.jsx("div",{className:z.value,children:ee},`${F}-${X}`)}})(b),re=F=>{const{descr:z,icon:ee,um:te,value:ce}=N(F),ge={[S($)]:D(s),[S(U)]:D(h),[S(X)]:D(E)},fe=[],xe=T(ce);switch(b){case"2":ee&&fe.push(H.icon(ee)),fe.push(H.descr(z)),fe.push(H.value(te?xe+" "+te:xe));break;default:case"1":fe.push(H.descr(z)),fe.push(H.value(te?xe+" "+te:xe))}return x.jsx("div",{className:H.className.container,role:"button",style:ge,tabIndex:0,onClick:()=>M(F),onKeyDown:Sr=>L(Sr,F),children:fe},F.id)},C={[J]:String(r),[W]:K};return x.jsx("div",{className:G.dashList,style:C,children:k?A.map(F=>re(F)):R})},zn=({data:r,logo:e,open:t,minifiedOnClose:n=!0,customHeight:s="100vh",onClick:a,onEnter:o,onClose:i})=>{var b,O;const[l,c]=j.useState(),[u,f]=j.useState(t??!0),p=j.useRef(null),g=s.trim()?s:"100vh",h=j.useCallback(R=>{var A,k;if(!((A=R.rows)!=null&&A.length)||!((k=R.columns)!=null&&k.length))return{};const v=R.rows[0];return R.columns.filter(Y=>Y.visible).reduce((Y,V)=>{const $=v.cells[V.name];if(!u&&n&&$.shape!==oe.BUTTON)return Y;const _={...$,onChange:U=>{c(X=>{const K={...X};return K!=null&&K[V.name]&&(K[V.name].obj.k=U.obj.k),K})},onClick:()=>{$.fun&&a&&a({...$})},onEnter:U=>{o&&o(U)}};return!u&&n&&(_.data={..._.data,showText:!1}),{...Y,[V.name]:_}},{})},[a,o,u,n]),y=j.useCallback(()=>{i==null||i()},[i]),w=()=>{n?f(R=>!R):(f(!1),i==null||i())};if(j.useEffect(()=>{c(h(r))},[r]),j.useEffect(()=>{if(!p.current)return;if(!n){c(h(r));return}const R=getComputedStyle(p.current).getPropertyValue("--smp-drawer-slide-transition");let v=Number(R);R.endsWith("ms")?v=parseFloat(R):R.endsWith("s")&&(v=parseFloat(R)*1e3),setTimeout(()=>{c(h(r))},v/2)},[u,n]),j.useEffect(()=>{t!==void 0&&!n&&f(t)},[n,t]),!((b=r==null?void 0:r.rows)!=null&&b.length)||!((O=r.columns)!=null&&O.length))return null;const E={drawer:`smp-drawer ${n?"smp-drawer-minified":"smp-drawer-fixed"} ${u?"smp-drawer-open":""}`,container:"smp-drawer-container",containerHeader:"smp-drawer-container-header",containerIcon:`${u?"":"smp-drawer-container-icon-close"} smp-drawer-container-icon`,containerLayout:"smp-drawer-container-layout",containerLogo:"smp-drawer-container-logo",backdrop:`smp-drawer-backdrop ${u?"smp-drawer-backdrop-open":""}`};return l&&x.jsxs(x.Fragment,{children:[!n&&x.jsx("div",{"aria-hidden":"true","aria-label":"drawer-backdrop",className:E.backdrop,onClick:y}),x.jsx("aside",{ref:p,className:E.drawer,style:{height:g},"aria-label":"Drawer","smp-id":"drawer",children:x.jsxs("div",{className:E.container,children:[x.jsxs("div",{className:E.containerHeader,children:[e&&x.jsx("div",{className:E.containerLogo,children:x.jsx(de,{icon:e,title:"drawer_logo",width:"100%",height:24})}),x.jsx("div",{className:E.containerIcon,children:x.jsx(de,{icon:n?"menu_close":"close",title:"drawer_icon",rotated:!u,isInteractable:!0,onClick:w,width:20,height:20})})]}),x.jsx("div",{className:E.containerLayout,children:x.jsx(xr,{layout:r.rows[0].layout,cells:l})})]})})]})},Jn=({data:r,Type:e,ShowSubmit:t=!1,SubmitPosition:n="Right",DefaultValue:s,Label:a,LabelPosition:o="Left",onBlur:i,onClick:l,onOptionsRequest:c})=>{const[u,f]=j.useState();j.useEffect(()=>{f(()=>{const y={...r};return e&&(y.shape=e),s&&(y.obj=Cr(s)),y})},[r,s,e]);const g={container:`smp-field-container ${Pe(t)?`smp-field-position-${n}`:""}`},h=()=>{Pe(t)||i==null||i(u)};if(u)return x.jsxs("div",{className:g.container,children:[x.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",font:"var(--smp-fontLabel-base)"},children:x.jsx(vr,{...u,onChange:f,onOptionsRequest:c,fun:r.fun,onBlur:h,label:a,labelPosition:o})}),Pe(t)&&x.jsx(Ce,{bindValue:"Confirm",onClick:()=>l==null?void 0:l(u)})]})};exports.AppBar=Bn;exports.Autocomplete=ht;exports.Button=Ce;exports.Checkbox=ur;exports.Combobox=pr;exports.DashList=Gn;exports.DatePicker=mr;exports.Drawer=zn;exports.Field=Jn;exports.Icon=de;exports.Password=yr;exports.Textfield=be;exports.configurePaths=rn;
|
package/dist/ketchup2.es.js
CHANGED
|
@@ -4805,6 +4805,7 @@ const Ue = (r, e, t) => ({
|
|
|
4805
4805
|
className: E.drawer,
|
|
4806
4806
|
style: { height: g },
|
|
4807
4807
|
"aria-label": "Drawer",
|
|
4808
|
+
"smp-id": "drawer",
|
|
4808
4809
|
children: /* @__PURE__ */ x.jsxs("div", { className: E.container, children: [
|
|
4809
4810
|
/* @__PURE__ */ x.jsxs("div", { className: E.containerHeader, children: [
|
|
4810
4811
|
e && /* @__PURE__ */ x.jsx("div", { className: E.containerLogo, children: /* @__PURE__ */ x.jsx(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sme.up/ketchup2",
|
|
3
|
-
"version": "2.0.0-SNAPSHOT-
|
|
3
|
+
"version": "2.0.0-SNAPSHOT-20250606143603",
|
|
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/)",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"react-svg": "^16.3.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@eslint/js": "9.
|
|
34
|
+
"@eslint/js": "9.28.0",
|
|
35
35
|
"@storybook/addon-a11y": "9.0.4",
|
|
36
36
|
"@storybook/addon-docs": "9.0.4",
|
|
37
37
|
"@storybook/react-vite": "9.0.4",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint": "9.27.0",
|
|
47
47
|
"eslint-config-prettier": "10.1.5",
|
|
48
48
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
49
|
-
"eslint-plugin-prettier": "5.4.
|
|
49
|
+
"eslint-plugin-prettier": "5.4.1",
|
|
50
50
|
"eslint-plugin-react": "7.37.5",
|
|
51
51
|
"eslint-plugin-react-hooks": "5.2.0",
|
|
52
52
|
"eslint-plugin-react-refresh": "0.4.20",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"i18next": "25",
|
|
56
56
|
"jsdom": "26.1.0",
|
|
57
57
|
"playwright": "1.52.0",
|
|
58
|
-
"postcss": "8.5.
|
|
58
|
+
"postcss": "8.5.4",
|
|
59
59
|
"postcss-preset-env": "10.2.0",
|
|
60
60
|
"prettier": "3.5.3",
|
|
61
61
|
"rimraf": "6.0.1",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"stylelint-config-standard": "38.0.0",
|
|
65
65
|
"stylelint-order": "7.0.0",
|
|
66
66
|
"typescript": "5.8.3",
|
|
67
|
-
"typescript-eslint": "8.33.
|
|
67
|
+
"typescript-eslint": "8.33.1",
|
|
68
68
|
"vite": "^6.3.5",
|
|
69
69
|
"vite-plugin-dts": "4.5.4",
|
|
70
70
|
"vitest": "3.1.4"
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
]
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|
|
83
|
-
"node": "
|
|
83
|
+
"node": "22"
|
|
84
84
|
},
|
|
85
85
|
"overrides": {
|
|
86
86
|
"storybook": "$storybook"
|