@julien-wiegandt/open-ui 0.1.43 → 0.1.45
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/open-ui.js +4 -2
- package/dist/open-ui.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/open-ui.js
CHANGED
|
@@ -4244,7 +4244,8 @@ const Ta = $e(({ icon: n, animation: e, color: t, size: r }, i) => n && /* @__PU
|
|
|
4244
4244
|
size: er[r.size ?? "md"].fontSize,
|
|
4245
4245
|
...t,
|
|
4246
4246
|
children: r.label
|
|
4247
|
-
}
|
|
4247
|
+
},
|
|
4248
|
+
r.label
|
|
4248
4249
|
),
|
|
4249
4250
|
h && /* @__PURE__ */ A.jsx(Pe, { align: "center", justify: "center", width: `${y}px`, children: /* @__PURE__ */ A.jsx(
|
|
4250
4251
|
pc,
|
|
@@ -4404,7 +4405,8 @@ const Pd = St.input`
|
|
|
4404
4405
|
color: n.error ? t.palette.error.main : t.palette[n.color ?? "default"].main,
|
|
4405
4406
|
size: "12",
|
|
4406
4407
|
children: n.label
|
|
4407
|
-
}
|
|
4408
|
+
},
|
|
4409
|
+
n.label
|
|
4408
4410
|
),
|
|
4409
4411
|
n.required && /* @__PURE__ */ A.jsx(bt, { color: t.palette.error.main, size: "12", children: "*" })
|
|
4410
4412
|
]
|
package/dist/open-ui.umd.cjs
CHANGED
|
@@ -186,7 +186,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[wi]+=1);const Zt={none:"0px",
|
|
|
186
186
|
&:active {
|
|
187
187
|
${({variant:n,color:e,theme:t})=>It({color:e,theme:t})[n].onActive}
|
|
188
188
|
}
|
|
189
|
-
`;J.registerPlugin(Ps);const Xl=R.forwardRef(({icon:n,animation:e,color:t,size:r},i)=>n&&D.jsxs(we,{ref:i,align:"center",justify:"center",children:[typeof n!="string"&&n,n==="bell"&&D.jsx(Ll,{hasNotification:e,size:r,color:t,animated:!0}),n==="check"&&D.jsx(Vs,{isVisible:e,size:r,animated:e,color:t}),n==="hamburger"&&D.jsx(Fl,{isOpen:e,size:r,animated:!0,color:t}),n==="heart"&&D.jsx(zl,{isLiked:e,size:r,animated:!0,color:t})]})),Ti=R.forwardRef(({onClick:n,loading:e=!0,labelProps:t,...r},i)=>{const s=$t(),o=R.useRef(null),a=R.useRef(null),u=R.useRef(null),c=R.useRef(null),[f,d]=R.useState(!1),[h,l]=R.useState(!1),[g,p]=R.useState(!1),[y,x]=R.useState(void 0),S=typeof r.starticon=="string"&&["heart","hamburger"].includes(r.starticon)||typeof r.endicon=="string"&&["heart","hamburger"].includes(r.endicon),k=Bl(i,o);R.useEffect(()=>{if(a.current){const v=new Ps(a.current,{type:"chars"});return f&&(J.set(a.current,{opacity:1}),J.to(v.chars,{opacity:.6,stagger:{each:.05,from:"start",repeat:-1},ease:"power1.inOut"})),()=>{J.killTweensOf(v.chars),v.revert(),J.set(a.current,{opacity:1,y:0})}}},[f,r.label]),R.useEffect(()=>{u.current&&r.starticon&&!r.endicon&&x(u.current.getBoundingClientRect().width)},[r.starticon,r.endicon]),R.useEffect(()=>{c.current&&r.endicon&&x(c.current.getBoundingClientRect().width)},[r.endicon]);const C=R.useMemo(()=>It({color:r.color,theme:s}),[r.color,s]),_=async v=>{e&&d(!0);try{n&&await n(v)}finally{e&&d(!1),r.endanimation&&l(!0),p(S?!g:!0),await new Promise(b=>setTimeout(b,1e3)),r.endanimation&&l(!1),S||p(!1)}},w=R.useCallback(v=>{!r.starticon&&!r.endicon&&!h&&x(v.width)},[r.starticon,r.endicon,h]);return D.jsxs(_d,{ref:k,onClick:_,...r,disabled:f||r.disabled,children:[!h&&D.jsx(Xl,{ref:u,icon:r.starticon,animation:g,color:It({color:r.color,theme:s})[r.variant].color,size:Jt[r.size??"md"].height??24}),r.label&&(!h||h&&r.starticon||h&&r.endicon)&&D.jsx(ut,{ref:a,onSizeChange:w,width:"100%",align:r.align??"center",size:Jt[r.size??"md"].fontSize,...t,children:r.label}),h&&D.jsx(we,{align:"center",justify:"center",width:`${y}px`,children:D.jsx(Vs,{isVisible:h,color:C[r.variant].color,size:Jt[r.size??"md"].height??24,animated:!0})}),!h&&D.jsx(Xl,{ref:c,icon:r.endicon,animation:g,color:It({color:r.color,theme:s})[r.variant].color,size:Jt[r.size??"md"].height??24})]})});Ti.displayName="Button";const Hs=({color:n,theme:e})=>({contained:{bgColor:e.palette[n].main,color:"#FFFFFF"},outlined:{bgColor:"#FFFFFF",border:`2px solid ${e.palette[n].main}`,color:e.palette[n].main},text:{bgColor:"transparent",color:e.palette[n].main}}),yd={sm:{padding:"3px 0.25rem"},md:{padding:"3.5px 0.25rem"},lg:{padding:"4px 0.5rem"}},xd=gt.div`
|
|
189
|
+
`;J.registerPlugin(Ps);const Xl=R.forwardRef(({icon:n,animation:e,color:t,size:r},i)=>n&&D.jsxs(we,{ref:i,align:"center",justify:"center",children:[typeof n!="string"&&n,n==="bell"&&D.jsx(Ll,{hasNotification:e,size:r,color:t,animated:!0}),n==="check"&&D.jsx(Vs,{isVisible:e,size:r,animated:e,color:t}),n==="hamburger"&&D.jsx(Fl,{isOpen:e,size:r,animated:!0,color:t}),n==="heart"&&D.jsx(zl,{isLiked:e,size:r,animated:!0,color:t})]})),Ti=R.forwardRef(({onClick:n,loading:e=!0,labelProps:t,...r},i)=>{const s=$t(),o=R.useRef(null),a=R.useRef(null),u=R.useRef(null),c=R.useRef(null),[f,d]=R.useState(!1),[h,l]=R.useState(!1),[g,p]=R.useState(!1),[y,x]=R.useState(void 0),S=typeof r.starticon=="string"&&["heart","hamburger"].includes(r.starticon)||typeof r.endicon=="string"&&["heart","hamburger"].includes(r.endicon),k=Bl(i,o);R.useEffect(()=>{if(a.current){const v=new Ps(a.current,{type:"chars"});return f&&(J.set(a.current,{opacity:1}),J.to(v.chars,{opacity:.6,stagger:{each:.05,from:"start",repeat:-1},ease:"power1.inOut"})),()=>{J.killTweensOf(v.chars),v.revert(),J.set(a.current,{opacity:1,y:0})}}},[f,r.label]),R.useEffect(()=>{u.current&&r.starticon&&!r.endicon&&x(u.current.getBoundingClientRect().width)},[r.starticon,r.endicon]),R.useEffect(()=>{c.current&&r.endicon&&x(c.current.getBoundingClientRect().width)},[r.endicon]);const C=R.useMemo(()=>It({color:r.color,theme:s}),[r.color,s]),_=async v=>{e&&d(!0);try{n&&await n(v)}finally{e&&d(!1),r.endanimation&&l(!0),p(S?!g:!0),await new Promise(b=>setTimeout(b,1e3)),r.endanimation&&l(!1),S||p(!1)}},w=R.useCallback(v=>{!r.starticon&&!r.endicon&&!h&&x(v.width)},[r.starticon,r.endicon,h]);return D.jsxs(_d,{ref:k,onClick:_,...r,disabled:f||r.disabled,children:[!h&&D.jsx(Xl,{ref:u,icon:r.starticon,animation:g,color:It({color:r.color,theme:s})[r.variant].color,size:Jt[r.size??"md"].height??24}),r.label&&(!h||h&&r.starticon||h&&r.endicon)&&D.jsx(ut,{ref:a,onSizeChange:w,width:"100%",align:r.align??"center",size:Jt[r.size??"md"].fontSize,...t,children:r.label},r.label),h&&D.jsx(we,{align:"center",justify:"center",width:`${y}px`,children:D.jsx(Vs,{isVisible:h,color:C[r.variant].color,size:Jt[r.size??"md"].height??24,animated:!0})}),!h&&D.jsx(Xl,{ref:c,icon:r.endicon,animation:g,color:It({color:r.color,theme:s})[r.variant].color,size:Jt[r.size??"md"].height??24})]})});Ti.displayName="Button";const Hs=({color:n,theme:e})=>({contained:{bgColor:e.palette[n].main,color:"#FFFFFF"},outlined:{bgColor:"#FFFFFF",border:`2px solid ${e.palette[n].main}`,color:e.palette[n].main},text:{bgColor:"transparent",color:e.palette[n].main}}),yd={sm:{padding:"3px 0.25rem"},md:{padding:"3.5px 0.25rem"},lg:{padding:"4px 0.5rem"}},xd=gt.div`
|
|
190
190
|
all: unset;
|
|
191
191
|
padding: ${({size:n})=>yd[n??"md"].padding};
|
|
192
192
|
display: flex;
|
|
@@ -237,7 +237,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[wi]+=1);const Zt={none:"0px",
|
|
|
237
237
|
background-position: center;
|
|
238
238
|
cursor: pointer;
|
|
239
239
|
}
|
|
240
|
-
`,Ul=R.forwardRef((n,e)=>{const t=$t();return D.jsxs(we,{direction:"column",children:[(n.label||n.required)&&D.jsxs(we,{direction:"row",gap:.5,align:"center",mb:n.type==="color"?"0px":"4px",style:{minHeight:"1.2em"},children:[n.label&&D.jsx(ut,{color:n.error?t.palette.error.main:t.palette[n.color??"default"].main,size:"12",children:n.label}),n.required&&D.jsx(ut,{color:t.palette.error.main,size:"12",children:"*"})]}),D.jsx(vd,{ref:e,...n}),n.error&&D.jsx(ut,{color:t.palette.error.main,size:"10",mt:n.type==="color"?"0px":"4px",style:{minHeight:"1.2em"},children:n.error})]})});Ul.displayName="Input";const wd=(n,e)=>{switch(n){case 1:return e==="sm"?"28px":"32px";case 2:return e==="sm"?"22px":"24px";case 3:return"20px";case 4:return"18px";case 5:return"16px";case 6:return"14px";default:return"1rem"}},bd=gt.h1`
|
|
240
|
+
`,Ul=R.forwardRef((n,e)=>{const t=$t();return D.jsxs(we,{direction:"column",children:[(n.label||n.required)&&D.jsxs(we,{direction:"row",gap:.5,align:"center",mb:n.type==="color"?"0px":"4px",style:{minHeight:"1.2em"},children:[n.label&&D.jsx(ut,{color:n.error?t.palette.error.main:t.palette[n.color??"default"].main,size:"12",children:n.label},n.label),n.required&&D.jsx(ut,{color:t.palette.error.main,size:"12",children:"*"})]}),D.jsx(vd,{ref:e,...n}),n.error&&D.jsx(ut,{color:t.palette.error.main,size:"10",mt:n.type==="color"?"0px":"4px",style:{minHeight:"1.2em"},children:n.error})]})});Ul.displayName="Input";const wd=(n,e)=>{switch(n){case 1:return e==="sm"?"28px":"32px";case 2:return e==="sm"?"22px":"24px";case 3:return"20px";case 4:return"18px";case 5:return"16px";case 6:return"14px";default:return"1rem"}},bd=gt.h1`
|
|
241
241
|
font-family: ${({theme:n})=>n.title.fontFamily};
|
|
242
242
|
margin: 0;
|
|
243
243
|
color: ${({color:n})=>n};
|