@julien-wiegandt/open-ui 0.1.18 → 0.1.19
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 +9 -2
- package/dist/open-ui.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/open-ui.js
CHANGED
|
@@ -4351,7 +4351,6 @@ const vc = Ge(ne)`
|
|
|
4351
4351
|
ne,
|
|
4352
4352
|
{
|
|
4353
4353
|
direction: "row",
|
|
4354
|
-
gap: 1,
|
|
4355
4354
|
align: "center",
|
|
4356
4355
|
style: {
|
|
4357
4356
|
minWidth: "248px"
|
|
@@ -4367,11 +4366,19 @@ const vc = Ge(ne)`
|
|
|
4367
4366
|
children: t.startIcon
|
|
4368
4367
|
}
|
|
4369
4368
|
),
|
|
4370
|
-
t.title && /* @__PURE__ */ C.jsx(
|
|
4369
|
+
t.title && /* @__PURE__ */ C.jsx(
|
|
4370
|
+
Re,
|
|
4371
|
+
{
|
|
4372
|
+
size: "14",
|
|
4373
|
+
p: 1.5,
|
|
4374
|
+
children: t.title
|
|
4375
|
+
}
|
|
4376
|
+
),
|
|
4371
4377
|
t.endIcon && /* @__PURE__ */ C.jsx(
|
|
4372
4378
|
ne,
|
|
4373
4379
|
{
|
|
4374
4380
|
p: 1.5,
|
|
4381
|
+
ml: "auto",
|
|
4375
4382
|
style: {
|
|
4376
4383
|
backgroundColor: `${i.palette[t.color ?? "default"].light}44`
|
|
4377
4384
|
},
|
package/dist/open-ui.umd.cjs
CHANGED
|
@@ -280,4 +280,4 @@ See https://s-c.sh/2BAXzed for more info.`),window[Mr]+=1);const ee=n=>typeof n=
|
|
|
280
280
|
svg {
|
|
281
281
|
stroke: ${({theme:n,color:e})=>n.palette[e??"default"].main};
|
|
282
282
|
}
|
|
283
|
-
`,ni=C.forwardRef(({children:n,style:e,...t},r)=>{const i=Dt();return O.jsxs(pc,{ref:r,p:.5,elevation:3,...t,style:{...e},children:[t.onClose&&O.jsx(Dr,{size:"sm",variant:"text",color:"default",startIcon:O.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[O.jsx("path",{d:"M18 6 6 18"}),O.jsx("path",{d:"m6 6 12 12"})]}),onClick:t.onClose,style:{position:"absolute",top:"0px",right:"0px",cursor:"pointer"}}),n,!n&&O.jsxs(ne,{direction:"row",
|
|
283
|
+
`,ni=C.forwardRef(({children:n,style:e,...t},r)=>{const i=Dt();return O.jsxs(pc,{ref:r,p:.5,elevation:3,...t,style:{...e},children:[t.onClose&&O.jsx(Dr,{size:"sm",variant:"text",color:"default",startIcon:O.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[O.jsx("path",{d:"M18 6 6 18"}),O.jsx("path",{d:"m6 6 12 12"})]}),onClick:t.onClose,style:{position:"absolute",top:"0px",right:"0px",cursor:"pointer"}}),n,!n&&O.jsxs(ne,{direction:"row",align:"center",style:{minWidth:"248px"},children:[t.startIcon&&O.jsx(ne,{p:1.5,style:{backgroundColor:`${i.palette[t.color??"default"].light}44`},children:t.startIcon}),t.title&&O.jsx(Oe,{size:"14",p:1.5,children:t.title}),t.endIcon&&O.jsx(ne,{p:1.5,ml:"auto",style:{backgroundColor:`${i.palette[t.color??"default"].light}44`},children:t.endIcon})]})]})});ni.displayName="Toast",qe.registerPlugin(Gt);const ko=C.createContext({toasts:[],addToast:()=>{}}),Po=({children:n})=>{const[e,t]=C.useState([]),r=C.useCallback(s=>{t(o=>o.filter(a=>a.id!==s))},[]),i=C.useMemo(()=>({toasts:e,addToast:s=>{const o={...s,id:`toast-${Date.now()}-${Math.random()}`};t(a=>[...a,o])}}),[e]);return O.jsxs(ko.Provider,{value:i,children:[n," ",O.jsx(Co,{toasts:e,removeToast:r})]})},Co=({toasts:n,removeToast:e})=>{const t=C.useRef(new Map),r=C.useRef(null),[i,s]=C.useState(!1);C.useEffect(()=>{n.forEach(a=>{const u=t.current.get(a.id);u&&!u.dataset.animatedIn&&(u.dataset.animatedIn="true",qe.fromTo(u,{opacity:0,y:100},{opacity:1,y:0,duration:.5,ease:"power2.out",onComplete:()=>{qe.timeline({delay:a.duration||10,onComplete:()=>{e(a.id),t.current.delete(a.id)}}).to(u,{opacity:0,y:50,duration:.3,ease:"power2.in"})}}))})},[n,e]);const o=n.slice(-5);return Gt(()=>{qe.to(".toast-item",{marginTop:a=>i||a===0?0:-48,duration:.3,ease:"power2.out",stagger:.05})},{dependencies:[i,o],scope:r}),C.useEffect(()=>{o.length===0&&i&&s(!1)},[o,i]),O.jsx(ne,{ref:r,gap:.5,style:{position:"fixed",bottom:"8px",right:"8px",zIndex:99999},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:o.map((a,u)=>O.jsx(ni,{className:"toast-item",onClose:()=>e(a.id),ref:c=>{c&&t.current.set(a.id,c)},...a,style:{position:"relative",zIndex:u,marginTop:u>0?"-48px":"0"}},a.id))})},_c=({children:n,theme:e})=>O.jsx(Ia,{theme:e,children:O.jsxs(Po,{children:[O.jsx("div",{id:"modal"}),n]})});K.Button=Dr,K.Chip=Ji,K.Flex=ne,K.Input=es,K.Modal=wo,K.OpenUIProvider=_c,K.ProgressBar=hc,K.Select=To,K.Text=Oe,K.TextArea=So,K.Title=ts,K.Toast=ni,K.ToastContext=ko,K.ToastContextProvider=Po,K.ToastProvider=Co,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})}));
|