@julien-wiegandt/open-ui 0.3.2 → 0.3.3

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 CHANGED
@@ -4480,7 +4480,7 @@ const Da = fe(({ icon: n, animation: e, size: t }, r) => n && /* @__PURE__ */ re
4480
4480
  ...o
4481
4481
  } = mn("button", n), { color: s = "default", variant: a = "contained", ...c } = o, u = W(null), f = W(null), d = W(null), p = W(null), [l, g] = me(!1), [h, _] = me(!1), [x, w] = me(!1), [b, C] = me(void 0), m = r !== void 0, v = m ? r : l, S = typeof c.starticon == "string" && ["heart", "hamburger"].includes(c.starticon) || typeof c.endicon == "string" && ["heart", "hamburger"].includes(c.endicon), T = ei(e, u), P = xt(
4482
4482
  u,
4483
- !!n.color || !!i?.color
4483
+ !!i?.color
4484
4484
  );
4485
4485
  Oe(() => {
4486
4486
  if (f.current) {
@@ -4544,8 +4544,8 @@ const Da = fe(({ icon: n, animation: e, size: t }, r) => n && /* @__PURE__ */ re
4544
4544
  width: "100%",
4545
4545
  align: c.align ?? "center",
4546
4546
  size: or[c.size ?? "md"].fontSize,
4547
- color: P,
4548
4547
  ...i,
4548
+ color: i?.color ?? P,
4549
4549
  children: c.label
4550
4550
  },
4551
4551
  c.label
@@ -164,7 +164,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Ci]+=1);const xe=n=>typeof n=
164
164
  &:active {
165
165
  ${({variant:n,color:e,theme:t})=>An({color:e??"default",theme:t})[n??"contained"].onActive}
166
166
  }
167
- `,on=(n,e)=>{const{theme:t}=x.useContext(rn);return{...t.components?.[n]||{},...e}};B.registerPlugin(Io);const fc=x.forwardRef(({icon:n,animation:e,size:t},r)=>n&&k.jsxs(de,{ref:r,align:"center",justify:"center",children:[typeof n!="string"&&n,n==="bell"&&k.jsx(tc,{hasNotification:e,size:t,animated:!0}),n==="check"&&k.jsx(Ei,{isVisible:e,size:t,animated:e}),n==="hamburger"&&k.jsx(ic,{isOpen:e,size:t,animated:!0}),n==="heart"&&k.jsx(oc,{isLiked:e,size:t,animated:!0}),n==="sync"&&k.jsx(lc,{isSyncing:e,size:t,animated:!0}),n==="sparkles"&&k.jsx(ac,{size:t,animated:e}),n==="dots"&&k.jsx(nc,{size:t,animated:e}),n==="send"&&k.jsx(sc,{size:t,animated:e}),n==="copy"&&k.jsx(rc,{isCopied:e,size:t,animated:!0})]})),Oi=x.forwardRef((n,e)=>{const{onClick:t,loading:r,labelProps:i,...o}=on("button",n),{color:s="default",variant:a="contained",...c}=o,u=x.useRef(null),f=x.useRef(null),d=x.useRef(null),p=x.useRef(null),[l,g]=x.useState(!1),[h,_]=x.useState(!1),[v,b]=x.useState(!1),[S,P]=x.useState(void 0),m=r!==void 0,w=m?r:l,T=typeof c.starticon=="string"&&["heart","hamburger"].includes(c.starticon)||typeof c.endicon=="string"&&["heart","hamburger"].includes(c.endicon),C=Dn(e,u),M=ft(u,!!n.color||!!i?.color);x.useEffect(()=>{if(f.current){const $=new Io(f.current,{type:"chars"});return w&&(B.set(f.current,{opacity:1}),B.to($.chars,{opacity:.6,stagger:{each:.05,from:"start",repeat:-1},ease:"power1.inOut"})),()=>{B.killTweensOf($.chars),$.revert(),B.set(f.current,{opacity:1,y:0})}}},[w,c.label]),x.useEffect(()=>{d.current&&c.starticon&&!c.endicon&&P(d.current.getBoundingClientRect().width)},[c.starticon,c.endicon]),x.useEffect(()=>{p.current&&c.endicon&&P(p.current.getBoundingClientRect().width)},[c.endicon]);const N=async $=>{m||g(!0);try{t&&await t($)}finally{m||g(!1),c.endanimation&&_(!0),b(T?!v:!0),await new Promise(O=>setTimeout(O,1e3)),c.endanimation&&_(!1),T||b(!1)}},R=x.useCallback($=>{!c.starticon&&!c.endicon&&!h&&P($.width)},[c.starticon,c.endicon,h]);return k.jsxs(Yd,{ref:C,onClick:N,variant:a,color:s,...c,disabled:c.disabled??w,children:[!h&&k.jsx(fc,{ref:d,icon:c.starticon,animation:v,size:tr[c.size??"md"].height??24}),c.label&&(!h||h&&c.starticon||h&&c.endicon)&&k.jsx(Re,{ref:f,onSizeChange:R,width:"100%",align:c.align??"center",size:tr[c.size??"md"].fontSize,color:M,...i,children:c.label},c.label),h&&k.jsx(de,{align:"center",justify:"center",width:`${S}px`,children:k.jsx(Ei,{isVisible:h,size:tr[c.size??"md"].height??24,animated:!0})}),!h&&k.jsx(fc,{ref:p,icon:c.endicon,animation:v,size:tr[c.size??"md"].height??24})]})});Oi.displayName="Button";const rs=({color:n,theme:e})=>{const t=ve(n,e);return{borderColor:t.main,bgColor:t.main,checkColor:Pi(t.main)}},dc={none:"0px",sm:"4px",md:"6px",lg:"10px",full:"42px"},ns={sm:{size:16,fontSize:"12",iconSize:14,gap:"8px"},md:{size:20,fontSize:"14",iconSize:18,gap:"10px"},lg:{size:24,fontSize:"16",iconSize:22,gap:"12px"}},is=Be.label`
167
+ `,on=(n,e)=>{const{theme:t}=x.useContext(rn);return{...t.components?.[n]||{},...e}};B.registerPlugin(Io);const fc=x.forwardRef(({icon:n,animation:e,size:t},r)=>n&&k.jsxs(de,{ref:r,align:"center",justify:"center",children:[typeof n!="string"&&n,n==="bell"&&k.jsx(tc,{hasNotification:e,size:t,animated:!0}),n==="check"&&k.jsx(Ei,{isVisible:e,size:t,animated:e}),n==="hamburger"&&k.jsx(ic,{isOpen:e,size:t,animated:!0}),n==="heart"&&k.jsx(oc,{isLiked:e,size:t,animated:!0}),n==="sync"&&k.jsx(lc,{isSyncing:e,size:t,animated:!0}),n==="sparkles"&&k.jsx(ac,{size:t,animated:e}),n==="dots"&&k.jsx(nc,{size:t,animated:e}),n==="send"&&k.jsx(sc,{size:t,animated:e}),n==="copy"&&k.jsx(rc,{isCopied:e,size:t,animated:!0})]})),Oi=x.forwardRef((n,e)=>{const{onClick:t,loading:r,labelProps:i,...o}=on("button",n),{color:s="default",variant:a="contained",...c}=o,u=x.useRef(null),f=x.useRef(null),d=x.useRef(null),p=x.useRef(null),[l,g]=x.useState(!1),[h,_]=x.useState(!1),[v,b]=x.useState(!1),[S,P]=x.useState(void 0),m=r!==void 0,w=m?r:l,T=typeof c.starticon=="string"&&["heart","hamburger"].includes(c.starticon)||typeof c.endicon=="string"&&["heart","hamburger"].includes(c.endicon),C=Dn(e,u),M=ft(u,!!i?.color);x.useEffect(()=>{if(f.current){const $=new Io(f.current,{type:"chars"});return w&&(B.set(f.current,{opacity:1}),B.to($.chars,{opacity:.6,stagger:{each:.05,from:"start",repeat:-1},ease:"power1.inOut"})),()=>{B.killTweensOf($.chars),$.revert(),B.set(f.current,{opacity:1,y:0})}}},[w,c.label]),x.useEffect(()=>{d.current&&c.starticon&&!c.endicon&&P(d.current.getBoundingClientRect().width)},[c.starticon,c.endicon]),x.useEffect(()=>{p.current&&c.endicon&&P(p.current.getBoundingClientRect().width)},[c.endicon]);const N=async $=>{m||g(!0);try{t&&await t($)}finally{m||g(!1),c.endanimation&&_(!0),b(T?!v:!0),await new Promise(O=>setTimeout(O,1e3)),c.endanimation&&_(!1),T||b(!1)}},R=x.useCallback($=>{!c.starticon&&!c.endicon&&!h&&P($.width)},[c.starticon,c.endicon,h]);return k.jsxs(Yd,{ref:C,onClick:N,variant:a,color:s,...c,disabled:c.disabled??w,children:[!h&&k.jsx(fc,{ref:d,icon:c.starticon,animation:v,size:tr[c.size??"md"].height??24}),c.label&&(!h||h&&c.starticon||h&&c.endicon)&&k.jsx(Re,{ref:f,onSizeChange:R,width:"100%",align:c.align??"center",size:tr[c.size??"md"].fontSize,...i,color:i?.color??M,children:c.label},c.label),h&&k.jsx(de,{align:"center",justify:"center",width:`${S}px`,children:k.jsx(Ei,{isVisible:h,size:tr[c.size??"md"].height??24,animated:!0})}),!h&&k.jsx(fc,{ref:p,icon:c.endicon,animation:v,size:tr[c.size??"md"].height??24})]})});Oi.displayName="Button";const rs=({color:n,theme:e})=>{const t=ve(n,e);return{borderColor:t.main,bgColor:t.main,checkColor:Pi(t.main)}},dc={none:"0px",sm:"4px",md:"6px",lg:"10px",full:"42px"},ns={sm:{size:16,fontSize:"12",iconSize:14,gap:"8px"},md:{size:20,fontSize:"14",iconSize:18,gap:"10px"},lg:{size:24,fontSize:"16",iconSize:22,gap:"12px"}},is=Be.label`
168
168
  display: flex;
169
169
  align-items: center;
170
170
  gap: ${({gap:n})=>n??"10px"};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@julien-wiegandt/open-ui",
3
3
  "private": false,
4
- "version": "0.3.2",
4
+ "version": "0.3.3",
5
5
  "description": "The best open source react UI library",
6
6
  "type": "module",
7
7
  "main": "./dist/open-ui.umd.cjs",