@mage-ui/components 1.0.112 → 1.0.114

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,2 +1,2 @@
1
- import{Tooltip as e}from"../../overlays/tooltip/Tooltip.mjs";import{cx as t}from"@mage-ui/styled-system/css";import{calendar as n,calendarAgenda as r,calendarEvent as i,calendarMonth as a,calendarPopup as o,calendarRoot as s,calendarTimeGrid as c,calendarToolbar as l}from"@mage-ui/styled-system/recipes";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useState as f}from"react";import p from"dayjs";import"dayjs/locale/es";import"dayjs/locale/ca";import"dayjs/locale/en";import{Calendar as m,dayjsLocalizer as h}from"react-big-calendar";const g=h(p),_=e=>({monthHeaderFormat:t=>p(t).locale(e).format(`MMMM [de] YYYY`).replace(/^./,e=>e.toUpperCase()),dayHeaderFormat:t=>p(t).locale(e).format(`dddd D [de] MMMM`),timeGutterFormat:`HH:mm`}),v=(e,t,n)=>{let r=t.title?.(e)??e.title,i=t.start?.(e)??e.start,a=t.end?.(e)??e.end,o=!e.allDay&&i&&a;return!r&&!o?null:d(`div`,{children:[o?d(`div`,{children:[p(i).locale(n).format(`HH:mm`),` -`,` `,p(a).locale(n).format(`HH:mm`)]}):null,r?u(`strong`,{children:r}):null]})},y=({classNames:d,culture:p=`es`,defaultView:h=`month`,components:y,eventPropGetter:b,formats:x,onView:S,tooltipAccessor:C,view:w,...T})=>{let[E,D]=f(w??h??`month`),O=w??E,k=O===`month`||O===`week`||O===`day`,A=k?({event:t,accessors:n,children:r})=>{let i=v(t,n,p);return!r||!i?r??null:u(e,{label:i,position:`top`,withArrow:!0,children:r})}:void 0,j=!k||(y?.eventWrapper||A)&&C===void 0?null:C,M={..._(p),...x??{}},N=A||y?.eventWrapper?{...y,eventWrapper:y?.eventWrapper??A}:y;return u(m,{className:t(d?.calendar??n(),d?.root??s(),d?.toolbar??l(),d?.month??a(),d?.agenda??r(),d?.timeGrid??c(),d?.popup??o()),localizer:g,culture:p,defaultView:h,eventPropGetter:(e,n,r,a)=>{let o=b?.(e,n,r,a);return{...o,className:t(d?.event,i(),o?.className)}},formats:M,onView:e=>{w===void 0&&D(e),S?.(e)},components:N,tooltipAccessor:j,view:w,...T})};export{y as Calendar};
1
+ import{Tooltip as e}from"../../overlays/tooltip/Tooltip.mjs";import{cx as t}from"@mage-ui/styled-system/css";import{calendar as n,calendarAgenda as r,calendarEvent as i,calendarMonth as a,calendarPopup as o,calendarRoot as s,calendarTimeGrid as c,calendarToolbar as l}from"@mage-ui/styled-system/recipes";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useState as f}from"react";import p from"dayjs";import"dayjs/locale/es";import"dayjs/locale/ca";import"dayjs/locale/en";import{Calendar as m,dayjsLocalizer as h}from"react-big-calendar";const g=h(p),_=e=>({monthHeaderFormat:t=>p(t).locale(e).format(`MMMM [de] YYYY`).replace(/^./,e=>e.toUpperCase()),dayHeaderFormat:t=>p(t).locale(e).format(`dddd D [de] MMMM`),timeGutterFormat:`HH:mm`}),v=(e,t,n)=>{let r=t.title?.(e)??e.title,i=t.start?.(e)??e.start,a=t.end?.(e)??e.end,o=!e.allDay&&i&&a;return!r&&!o?null:d(`div`,{children:[o?d(`div`,{children:[p(i).locale(n).format(`HH:mm`),` -`,` `,p(a).locale(n).format(`HH:mm`)]}):null,r?u(`strong`,{children:r}):null]})},y=({classNames:d,culture:p=`es`,defaultView:h=`month`,components:y,eventPropGetter:b,formats:x,onView:S,tooltipAccessor:C,view:w,...T})=>{let[E,D]=f(w??h??`month`),O=w??E,k=O===`month`||O===`week`||O===`day`,A=k?({event:t,accessors:n,children:r})=>{let i=v(t,n,p);return!r||!i?r??null:u(e,{label:i,position:`top`,multiline:!0,withArrow:!0,children:r})}:void 0,j=!k||(y?.eventWrapper||A)&&C===void 0?null:C,M={..._(p),...x??{}},N=A||y?.eventWrapper?{...y,eventWrapper:y?.eventWrapper??A}:y;return u(m,{className:t(d?.calendar??n(),d?.root??s(),d?.toolbar??l(),d?.month??a(),d?.agenda??r(),d?.timeGrid??c(),d?.popup??o()),localizer:g,culture:p,defaultView:h,eventPropGetter:(e,n,r,a)=>{let o=b?.(e,n,r,a);return{...o,className:t(d?.event,i(),o?.className)}},formats:M,onView:e=>{w===void 0&&D(e),S?.(e)},components:N,tooltipAccessor:j,view:w,...T})};export{y as Calendar};
2
2
  //# sourceMappingURL=Calendar.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.mjs","names":["Calendar","BigCalendar"],"sources":["../../../../src/components/data-display/calendar/Calendar.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { type ReactNode, useState } from 'react';\nimport 'dayjs/locale/es';\nimport 'dayjs/locale/ca';\nimport 'dayjs/locale/en';\nimport {\n Calendar as BigCalendar,\n type CalendarProps as BigCalendarProps,\n dayjsLocalizer,\n type Event,\n type EventWrapperProps,\n type View,\n} from 'react-big-calendar';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n calendar,\n calendarAgenda,\n calendarEvent,\n calendarMonth,\n calendarPopup,\n calendarRoot,\n calendarTimeGrid,\n calendarToolbar,\n} from '@mage-ui/styled-system/recipes';\n\nimport { Tooltip } from '../../overlays/tooltip/Tooltip';\n\nexport type { DateLocalizer, Event as CalendarEvent } from 'react-big-calendar';\n\nconst localizer = dayjsLocalizer(dayjs);\n\nconst getDefaultFormats = (culture: string) => {\n return {\n monthHeaderFormat: (date: Date) =>\n dayjs(date)\n .locale(culture)\n .format('MMMM [de] YYYY')\n .replace(/^./, (str) => str.toUpperCase()),\n dayHeaderFormat: (date: Date) =>\n dayjs(date).locale(culture).format('dddd D [de] MMMM'),\n timeGutterFormat: 'HH:mm',\n };\n};\n\nexport type CalendarView = View;\n\ntype CalendarEventWrapperProps = EventWrapperProps<Event> & {\n children?: ReactNode;\n type?: 'date' | 'time';\n};\n\nexport type CalendarProps = Omit<BigCalendarProps<Event>, 'localizer'> & {\n classNames?: {\n calendar?: string;\n root?: string;\n toolbar?: string;\n month?: string;\n event?: string;\n agenda?: string;\n timeGrid?: string;\n popup?: string;\n };\n};\n\nconst getEventTooltipContent = (\n event: Event,\n accessors: CalendarEventWrapperProps['accessors'],\n culture: string,\n) => {\n const title = accessors.title?.(event) ?? event.title;\n const start = accessors.start?.(event) ?? event.start;\n const end = accessors.end?.(event) ?? event.end;\n const showTimeRange = !event.allDay && start && end;\n\n if (!title && !showTimeRange) {\n return null;\n }\n\n return (\n <div>\n {showTimeRange ? (\n <div>\n {dayjs(start).locale(culture).format('HH:mm')} -{' '}\n {dayjs(end).locale(culture).format('HH:mm')}\n </div>\n ) : null}\n {title ? <strong>{title}</strong> : null}\n </div>\n );\n};\n\nexport const Calendar = ({\n classNames,\n culture = 'es',\n defaultView = 'month',\n components,\n eventPropGetter,\n formats,\n onView,\n tooltipAccessor,\n view,\n ...props\n}: CalendarProps) => {\n const [internalView, setInternalView] = useState<CalendarView>(\n view ?? defaultView ?? 'month',\n );\n const currentView = view ?? internalView;\n const showTooltip =\n currentView === 'month' || currentView === 'week' || currentView === 'day';\n const defaultEventWrapper = showTooltip\n ? ({ event, accessors, children }: CalendarEventWrapperProps) => {\n const label = getEventTooltipContent(event, accessors, culture);\n\n if (!children || !label) {\n return children ?? null;\n }\n\n return (\n <Tooltip label={label} position='top' withArrow>\n {children}\n </Tooltip>\n );\n }\n : undefined;\n const resolvedTooltipAccessor =\n !showTooltip ||\n ((components?.eventWrapper || defaultEventWrapper) &&\n tooltipAccessor === undefined)\n ? null\n : tooltipAccessor;\n const mergedFormats = {\n ...getDefaultFormats(culture),\n ...(formats ?? {}),\n };\n const resolvedComponents =\n defaultEventWrapper || components?.eventWrapper\n ? {\n ...components,\n eventWrapper: components?.eventWrapper ?? defaultEventWrapper,\n }\n : components;\n\n const handleView = (nextView: CalendarView) => {\n if (view === undefined) {\n setInternalView(nextView);\n }\n\n onView?.(nextView);\n };\n\n const handleEventProps = (\n event: Event,\n start: Date,\n end: Date,\n isSelected: boolean,\n ) => {\n const customProps = eventPropGetter?.(event, start, end, isSelected);\n\n return {\n ...customProps,\n className: cx(classNames?.event, calendarEvent(), customProps?.className),\n };\n };\n\n return (\n <BigCalendar\n className={cx(\n classNames?.calendar ?? calendar(),\n classNames?.root ?? calendarRoot(),\n classNames?.toolbar ?? calendarToolbar(),\n classNames?.month ?? calendarMonth(),\n classNames?.agenda ?? calendarAgenda(),\n classNames?.timeGrid ?? calendarTimeGrid(),\n classNames?.popup ?? calendarPopup(),\n )}\n localizer={localizer}\n culture={culture}\n defaultView={defaultView}\n eventPropGetter={handleEventProps}\n formats={mergedFormats}\n onView={handleView}\n components={resolvedComponents}\n tooltipAccessor={resolvedTooltipAccessor}\n view={view}\n {...props}\n />\n );\n};\n"],"mappings":"miBA8BA,MAAM,EAAY,EAAe,EAAM,CAEjC,EAAqB,IAClB,CACL,kBAAoB,GAClB,EAAM,EAAK,CACR,OAAO,EAAQ,CACf,OAAO,iBAAiB,CACxB,QAAQ,KAAO,GAAQ,EAAI,aAAa,CAAC,CAC9C,gBAAkB,GAChB,EAAM,EAAK,CAAC,OAAO,EAAQ,CAAC,OAAO,mBAAmB,CACxD,iBAAkB,QACnB,EAuBG,GACJ,EACA,EACA,IACG,CACH,IAAM,EAAQ,EAAU,QAAQ,EAAM,EAAI,EAAM,MAC1C,EAAQ,EAAU,QAAQ,EAAM,EAAI,EAAM,MAC1C,EAAM,EAAU,MAAM,EAAM,EAAI,EAAM,IACtC,EAAgB,CAAC,EAAM,QAAU,GAAS,EAMhD,MAJI,CAAC,GAAS,CAAC,EACN,KAIP,EAAC,MAAD,CAAA,SAAA,CACG,EACC,EAAC,MAAD,CAAA,SAAA,CACG,EAAM,EAAM,CAAC,OAAO,EAAQ,CAAC,OAAO,QAAQ,CAAC,KAAG,IAChD,EAAM,EAAI,CAAC,OAAO,EAAQ,CAAC,OAAO,QAAQ,CACvC,CAAA,CAAA,CACJ,KACH,EAAQ,EAAC,SAAD,CAAA,SAAS,EAAe,CAAA,CAAG,KAChC,CAAA,CAAA,EAIGA,GAAY,CACvB,aACA,UAAU,KACV,cAAc,QACd,aACA,kBACA,UACA,SACA,kBACA,OACA,GAAG,KACgB,CACnB,GAAM,CAAC,EAAc,GAAmB,EACtC,GAAQ,GAAe,QACxB,CACK,EAAc,GAAQ,EACtB,EACJ,IAAgB,SAAW,IAAgB,QAAU,IAAgB,MACjE,EAAsB,GACvB,CAAE,QAAO,YAAW,cAA0C,CAC7D,IAAM,EAAQ,EAAuB,EAAO,EAAW,EAAQ,CAM/D,MAJI,CAAC,GAAY,CAAC,EACT,GAAY,KAInB,EAAC,EAAD,CAAgB,QAAO,SAAS,MAAM,UAAA,GACnC,WACO,CAAA,EAGd,IAAA,GACE,EACJ,CAAC,IACC,GAAY,cAAgB,IAC5B,IAAoB,IAAA,GAClB,KACA,EACA,EAAgB,CACpB,GAAG,EAAkB,EAAQ,CAC7B,GAAI,GAAW,EAAE,CAClB,CACK,EACJ,GAAuB,GAAY,aAC/B,CACE,GAAG,EACH,aAAc,GAAY,cAAgB,EAC3C,CACD,EAwBN,OACE,EAACC,EAAD,CACE,UAAW,EACT,GAAY,UAAY,GAAU,CAClC,GAAY,MAAQ,GAAc,CAClC,GAAY,SAAW,GAAiB,CACxC,GAAY,OAAS,GAAe,CACpC,GAAY,QAAU,GAAgB,CACtC,GAAY,UAAY,GAAkB,CAC1C,GAAY,OAAS,GAAe,CACrC,CACU,YACF,UACI,cACb,iBA3BF,EACA,EACA,EACA,IACG,CACH,IAAM,EAAc,IAAkB,EAAO,EAAO,EAAK,EAAW,CAEpE,MAAO,CACL,GAAG,EACH,UAAW,EAAG,GAAY,MAAO,GAAe,CAAE,GAAa,UAAU,CAC1E,EAkBC,QAAS,EACT,OAtCgB,GAA2B,CACzC,IAAS,IAAA,IACX,EAAgB,EAAS,CAG3B,IAAS,EAAS,EAkChB,WAAY,EACZ,gBAAiB,EACX,OACN,GAAI,EACJ,CAAA"}
1
+ {"version":3,"file":"Calendar.mjs","names":["Calendar","BigCalendar"],"sources":["../../../../src/components/data-display/calendar/Calendar.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { type ReactNode, useState } from 'react';\nimport 'dayjs/locale/es';\nimport 'dayjs/locale/ca';\nimport 'dayjs/locale/en';\nimport {\n Calendar as BigCalendar,\n type CalendarProps as BigCalendarProps,\n dayjsLocalizer,\n type Event,\n type EventWrapperProps,\n type View,\n} from 'react-big-calendar';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n calendar,\n calendarAgenda,\n calendarEvent,\n calendarMonth,\n calendarPopup,\n calendarRoot,\n calendarTimeGrid,\n calendarToolbar,\n} from '@mage-ui/styled-system/recipes';\n\nimport { Tooltip } from '../../overlays/tooltip/Tooltip';\n\nexport type { DateLocalizer, Event as CalendarEvent } from 'react-big-calendar';\n\nconst localizer = dayjsLocalizer(dayjs);\n\nconst getDefaultFormats = (culture: string) => {\n return {\n monthHeaderFormat: (date: Date) =>\n dayjs(date)\n .locale(culture)\n .format('MMMM [de] YYYY')\n .replace(/^./, (str) => str.toUpperCase()),\n dayHeaderFormat: (date: Date) =>\n dayjs(date).locale(culture).format('dddd D [de] MMMM'),\n timeGutterFormat: 'HH:mm',\n };\n};\n\nexport type CalendarView = View;\n\ntype CalendarEventWrapperProps = EventWrapperProps<Event> & {\n children?: ReactNode;\n type?: 'date' | 'time';\n};\n\nexport type CalendarProps = Omit<BigCalendarProps<Event>, 'localizer'> & {\n classNames?: {\n calendar?: string;\n root?: string;\n toolbar?: string;\n month?: string;\n event?: string;\n agenda?: string;\n timeGrid?: string;\n popup?: string;\n };\n};\n\nconst getEventTooltipContent = (\n event: Event,\n accessors: CalendarEventWrapperProps['accessors'],\n culture: string,\n) => {\n const title = accessors.title?.(event) ?? event.title;\n const start = accessors.start?.(event) ?? event.start;\n const end = accessors.end?.(event) ?? event.end;\n const showTimeRange = !event.allDay && start && end;\n\n if (!title && !showTimeRange) {\n return null;\n }\n\n return (\n <div>\n {showTimeRange ? (\n <div>\n {dayjs(start).locale(culture).format('HH:mm')} -{' '}\n {dayjs(end).locale(culture).format('HH:mm')}\n </div>\n ) : null}\n {title ? <strong>{title}</strong> : null}\n </div>\n );\n};\n\nexport const Calendar = ({\n classNames,\n culture = 'es',\n defaultView = 'month',\n components,\n eventPropGetter,\n formats,\n onView,\n tooltipAccessor,\n view,\n ...props\n}: CalendarProps) => {\n const [internalView, setInternalView] = useState<CalendarView>(\n view ?? defaultView ?? 'month',\n );\n const currentView = view ?? internalView;\n const showTooltip =\n currentView === 'month' || currentView === 'week' || currentView === 'day';\n const defaultEventWrapper = showTooltip\n ? ({ event, accessors, children }: CalendarEventWrapperProps) => {\n const label = getEventTooltipContent(event, accessors, culture);\n\n if (!children || !label) {\n return children ?? null;\n }\n\n return (\n <Tooltip label={label} position='top' multiline withArrow>\n {children}\n </Tooltip>\n );\n }\n : undefined;\n const resolvedTooltipAccessor =\n !showTooltip ||\n ((components?.eventWrapper || defaultEventWrapper) &&\n tooltipAccessor === undefined)\n ? null\n : tooltipAccessor;\n const mergedFormats = {\n ...getDefaultFormats(culture),\n ...(formats ?? {}),\n };\n const resolvedComponents =\n defaultEventWrapper || components?.eventWrapper\n ? {\n ...components,\n eventWrapper: components?.eventWrapper ?? defaultEventWrapper,\n }\n : components;\n\n const handleView = (nextView: CalendarView) => {\n if (view === undefined) {\n setInternalView(nextView);\n }\n\n onView?.(nextView);\n };\n\n const handleEventProps = (\n event: Event,\n start: Date,\n end: Date,\n isSelected: boolean,\n ) => {\n const customProps = eventPropGetter?.(event, start, end, isSelected);\n\n return {\n ...customProps,\n className: cx(classNames?.event, calendarEvent(), customProps?.className),\n };\n };\n\n return (\n <BigCalendar\n className={cx(\n classNames?.calendar ?? calendar(),\n classNames?.root ?? calendarRoot(),\n classNames?.toolbar ?? calendarToolbar(),\n classNames?.month ?? calendarMonth(),\n classNames?.agenda ?? calendarAgenda(),\n classNames?.timeGrid ?? calendarTimeGrid(),\n classNames?.popup ?? calendarPopup(),\n )}\n localizer={localizer}\n culture={culture}\n defaultView={defaultView}\n eventPropGetter={handleEventProps}\n formats={mergedFormats}\n onView={handleView}\n components={resolvedComponents}\n tooltipAccessor={resolvedTooltipAccessor}\n view={view}\n {...props}\n />\n );\n};\n"],"mappings":"miBA8BA,MAAM,EAAY,EAAe,EAAM,CAEjC,EAAqB,IAClB,CACL,kBAAoB,GAClB,EAAM,EAAK,CACR,OAAO,EAAQ,CACf,OAAO,iBAAiB,CACxB,QAAQ,KAAO,GAAQ,EAAI,aAAa,CAAC,CAC9C,gBAAkB,GAChB,EAAM,EAAK,CAAC,OAAO,EAAQ,CAAC,OAAO,mBAAmB,CACxD,iBAAkB,QACnB,EAuBG,GACJ,EACA,EACA,IACG,CACH,IAAM,EAAQ,EAAU,QAAQ,EAAM,EAAI,EAAM,MAC1C,EAAQ,EAAU,QAAQ,EAAM,EAAI,EAAM,MAC1C,EAAM,EAAU,MAAM,EAAM,EAAI,EAAM,IACtC,EAAgB,CAAC,EAAM,QAAU,GAAS,EAMhD,MAJI,CAAC,GAAS,CAAC,EACN,KAIP,EAAC,MAAD,CAAA,SAAA,CACG,EACC,EAAC,MAAD,CAAA,SAAA,CACG,EAAM,EAAM,CAAC,OAAO,EAAQ,CAAC,OAAO,QAAQ,CAAC,KAAG,IAChD,EAAM,EAAI,CAAC,OAAO,EAAQ,CAAC,OAAO,QAAQ,CACvC,CAAA,CAAA,CACJ,KACH,EAAQ,EAAC,SAAD,CAAA,SAAS,EAAe,CAAA,CAAG,KAChC,CAAA,CAAA,EAIGA,GAAY,CACvB,aACA,UAAU,KACV,cAAc,QACd,aACA,kBACA,UACA,SACA,kBACA,OACA,GAAG,KACgB,CACnB,GAAM,CAAC,EAAc,GAAmB,EACtC,GAAQ,GAAe,QACxB,CACK,EAAc,GAAQ,EACtB,EACJ,IAAgB,SAAW,IAAgB,QAAU,IAAgB,MACjE,EAAsB,GACvB,CAAE,QAAO,YAAW,cAA0C,CAC7D,IAAM,EAAQ,EAAuB,EAAO,EAAW,EAAQ,CAM/D,MAJI,CAAC,GAAY,CAAC,EACT,GAAY,KAInB,EAAC,EAAD,CAAgB,QAAO,SAAS,MAAM,UAAA,GAAU,UAAA,GAC7C,WACO,CAAA,EAGd,IAAA,GACE,EACJ,CAAC,IACC,GAAY,cAAgB,IAC5B,IAAoB,IAAA,GAClB,KACA,EACA,EAAgB,CACpB,GAAG,EAAkB,EAAQ,CAC7B,GAAI,GAAW,EAAE,CAClB,CACK,EACJ,GAAuB,GAAY,aAC/B,CACE,GAAG,EACH,aAAc,GAAY,cAAgB,EAC3C,CACD,EAwBN,OACE,EAACC,EAAD,CACE,UAAW,EACT,GAAY,UAAY,GAAU,CAClC,GAAY,MAAQ,GAAc,CAClC,GAAY,SAAW,GAAiB,CACxC,GAAY,OAAS,GAAe,CACpC,GAAY,QAAU,GAAgB,CACtC,GAAY,UAAY,GAAkB,CAC1C,GAAY,OAAS,GAAe,CACrC,CACU,YACF,UACI,cACb,iBA3BF,EACA,EACA,EACA,IACG,CACH,IAAM,EAAc,IAAkB,EAAO,EAAO,EAAK,EAAW,CAEpE,MAAO,CACL,GAAG,EACH,UAAW,EAAG,GAAY,MAAO,GAAe,CAAE,GAAa,UAAU,CAC1E,EAkBC,QAAS,EACT,OAtCgB,GAA2B,CACzC,IAAS,IAAA,IACX,EAAgB,EAAS,CAG3B,IAAS,EAAS,EAkChB,WAAY,EACZ,gBAAiB,EACX,OACN,GAAI,EACJ,CAAA"}
@@ -1,2 +1,2 @@
1
- "use client";import{cx as e}from"@mage-ui/styled-system/css";import{toast as t,toastBody as n,toastCloseButton as r,toastDescription as i,toastIcon as a,toastLoader as o,toastNotifications as s,toastRoot as c,toastTitle as l}from"@mage-ui/styled-system/recipes";import{jsx as u}from"react/jsx-runtime";import{Notifications as d,notifications as f}from"@mantine/notifications";const p={neutral:`neutral`,info:`info`,success:`success`,warning:`warning`,danger:`danger`},m=(s,u)=>{let d=s&&s!==`default`?p[s]:void 0,f=d?c({intent:d}):c();return{root:e(u?.toast??t(),u?.root??f),icon:e(u?.icon??a()),loader:e(u?.loader??o()),body:e(u?.body??n()),title:e(u?.title??l()),description:e(u?.description??i()),closeButton:e(u?.closeButton??r())}},h={Provider:({position:e=`top-right`,autoClose:t=5e3,limit:n=5,zIndex:r,transitionDuration:i=250,notificationMaxHeight:a=200})=>u(d,{position:e,autoClose:t,limit:n,zIndex:r,transitionDuration:i,notificationMaxHeight:a,classNames:{root:s()}}),show:({color:e,classNames:t,intent:n,...r})=>f.show({...r,classNames:m(n,t)}),update:({color:e,classNames:t,intent:n,...r})=>{f.update({...r,classNames:m(n,t)})},hide:e=>{f.hide(e)},clean:()=>{f.clean()},cleanQueue:()=>{f.cleanQueue()}};export{h as Toast};
1
+ "use client";import{cx as e}from"@mage-ui/styled-system/css";import{toast as t,toastBody as n,toastCloseButton as r,toastDescription as i,toastIcon as a,toastLoader as o,toastNotifications as s,toastRoot as c,toastTitle as l}from"@mage-ui/styled-system/recipes";import{jsx as u}from"react/jsx-runtime";import{Notifications as d,notifications as f}from"@mantine/notifications";const p={neutral:`neutral`,info:`info`,success:`success`,warning:`warning`,danger:`danger`},m=(s,u)=>{let d=s&&s!==`default`?p[s]:void 0,f=d?c({intent:d}):c();return{root:e(u?.toast??t(),u?.root??f),icon:e(u?.icon??a()),loader:e(u?.loader??o()),body:e(u?.body??n()),title:e(u?.title??l()),description:e(u?.description??i()),closeButton:e(u?.closeButton??r())}},h={Provider:({position:e=`top-right`,autoClose:t=1e4,limit:n=5,zIndex:r,transitionDuration:i=250,notificationMaxHeight:a=200})=>u(d,{position:e,autoClose:t,limit:n,zIndex:r,transitionDuration:i,notificationMaxHeight:a,classNames:{root:s()}}),show:({color:e,classNames:t,intent:n,...r})=>f.show({...r,classNames:m(n,t)}),update:({color:e,classNames:t,intent:n,...r})=>{f.update({...r,classNames:m(n,t)})},hide:e=>{f.hide(e)},clean:()=>{f.clean()},cleanQueue:()=>{f.cleanQueue()}};export{h as Toast};
2
2
  //# sourceMappingURL=Toast.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.mjs","names":["toastRecipe"],"sources":["../../../../src/components/overlays/toast/Toast.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n toastBody,\n toastCloseButton,\n toastDescription,\n toastIcon,\n toastLoader,\n toastNotifications,\n toast as toastRecipe,\n toastRoot,\n toastTitle,\n} from '@mage-ui/styled-system/recipes';\nimport { Notifications, notifications } from '@mantine/notifications';\n\nexport type ToastIntent =\n | 'default'\n | 'neutral'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger';\n\nexport type ToastOptions = {\n id?: string;\n title?: ReactNode;\n message: ReactNode;\n color?: string;\n icon?: ReactNode;\n loading?: boolean;\n autoClose?: number | false;\n withCloseButton?: boolean;\n withBorder?: boolean;\n intent?: ToastIntent;\n onClose?: () => void;\n onOpen?: () => void;\n classNames?: {\n toast?: string;\n root?: string;\n icon?: string;\n loader?: string;\n body?: string;\n title?: string;\n description?: string;\n closeButton?: string;\n };\n};\n\nexport type ToastProviderProps = {\n position?:\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center';\n autoClose?: number | false;\n limit?: number;\n zIndex?: number;\n transitionDuration?: number;\n notificationMaxHeight?: number | string;\n};\n\nconst intentColorMap: Record<\n Exclude<ToastIntent, 'default'>,\n 'neutral' | 'info' | 'success' | 'warning' | 'danger'\n> = {\n neutral: 'neutral',\n info: 'info',\n success: 'success',\n warning: 'warning',\n danger: 'danger',\n};\n\nconst applyClassNames = (\n intent?: ToastIntent,\n classNames?: ToastOptions['classNames'],\n) => {\n const intentColor =\n intent && intent !== 'default' ? intentColorMap[intent] : undefined;\n const rootClass = intentColor\n ? toastRoot({ intent: intentColor })\n : toastRoot();\n return {\n root: cx(classNames?.toast ?? toastRecipe(), classNames?.root ?? rootClass),\n icon: cx(classNames?.icon ?? toastIcon()),\n loader: cx(classNames?.loader ?? toastLoader()),\n body: cx(classNames?.body ?? toastBody()),\n title: cx(classNames?.title ?? toastTitle()),\n description: cx(classNames?.description ?? toastDescription()),\n closeButton: cx(classNames?.closeButton ?? toastCloseButton()),\n };\n};\n\nconst ToastProvider = ({\n position = 'top-right',\n autoClose = 5000,\n limit = 5,\n zIndex,\n transitionDuration = 250,\n notificationMaxHeight = 200,\n}: ToastProviderProps) => {\n return (\n <Notifications\n position={position}\n autoClose={autoClose}\n limit={limit}\n zIndex={zIndex}\n transitionDuration={transitionDuration}\n notificationMaxHeight={notificationMaxHeight}\n classNames={{\n root: toastNotifications(),\n }}\n />\n );\n};\n\nexport const Toast = {\n Provider: ToastProvider,\n\n show: ({ color, classNames, intent, ...props }: ToastOptions) => {\n return notifications.show({\n ...props,\n classNames: applyClassNames(intent, classNames),\n });\n },\n\n update: ({ color, classNames, intent, ...props }: ToastOptions) => {\n notifications.update({\n ...props,\n classNames: applyClassNames(intent, classNames),\n });\n },\n\n hide: (id: string) => {\n notifications.hide(id);\n },\n\n clean: () => {\n notifications.clean();\n },\n\n cleanQueue: () => {\n notifications.cleanQueue();\n },\n};\n"],"mappings":"wXAkEA,MAAM,EAGF,CACF,QAAS,UACT,KAAM,OACN,QAAS,UACT,QAAS,UACT,OAAQ,SACT,CAEK,GACJ,EACA,IACG,CACH,IAAM,EACJ,GAAU,IAAW,UAAY,EAAe,GAAU,IAAA,GACtD,EAAY,EACd,EAAU,CAAE,OAAQ,EAAa,CAAC,CAClC,GAAW,CACf,MAAO,CACL,KAAM,EAAG,GAAY,OAASA,GAAa,CAAE,GAAY,MAAQ,EAAU,CAC3E,KAAM,EAAG,GAAY,MAAQ,GAAW,CAAC,CACzC,OAAQ,EAAG,GAAY,QAAU,GAAa,CAAC,CAC/C,KAAM,EAAG,GAAY,MAAQ,GAAW,CAAC,CACzC,MAAO,EAAG,GAAY,OAAS,GAAY,CAAC,CAC5C,YAAa,EAAG,GAAY,aAAe,GAAkB,CAAC,CAC9D,YAAa,EAAG,GAAY,aAAe,GAAkB,CAAC,CAC/D,EA0BU,EAAQ,CACnB,UAxBqB,CACrB,WAAW,YACX,YAAY,IACZ,QAAQ,EACR,SACA,qBAAqB,IACrB,wBAAwB,OAGtB,EAAC,EAAD,CACY,WACC,YACJ,QACC,SACY,qBACG,wBACvB,WAAY,CACV,KAAM,GAAoB,CAC3B,CACD,CAAA,CAOJ,MAAO,CAAE,QAAO,aAAY,SAAQ,GAAG,KAC9B,EAAc,KAAK,CACxB,GAAG,EACH,WAAY,EAAgB,EAAQ,EAAW,CAChD,CAAC,CAGJ,QAAS,CAAE,QAAO,aAAY,SAAQ,GAAG,KAA0B,CACjE,EAAc,OAAO,CACnB,GAAG,EACH,WAAY,EAAgB,EAAQ,EAAW,CAChD,CAAC,EAGJ,KAAO,GAAe,CACpB,EAAc,KAAK,EAAG,EAGxB,UAAa,CACX,EAAc,OAAO,EAGvB,eAAkB,CAChB,EAAc,YAAY,EAE7B"}
1
+ {"version":3,"file":"Toast.mjs","names":["toastRecipe"],"sources":["../../../../src/components/overlays/toast/Toast.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n toastBody,\n toastCloseButton,\n toastDescription,\n toastIcon,\n toastLoader,\n toastNotifications,\n toast as toastRecipe,\n toastRoot,\n toastTitle,\n} from '@mage-ui/styled-system/recipes';\nimport { Notifications, notifications } from '@mantine/notifications';\n\nexport type ToastIntent =\n | 'default'\n | 'neutral'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger';\n\nexport type ToastOptions = {\n id?: string;\n title?: ReactNode;\n message: ReactNode;\n color?: string;\n icon?: ReactNode;\n loading?: boolean;\n autoClose?: number | false;\n withCloseButton?: boolean;\n withBorder?: boolean;\n intent?: ToastIntent;\n onClose?: () => void;\n onOpen?: () => void;\n classNames?: {\n toast?: string;\n root?: string;\n icon?: string;\n loader?: string;\n body?: string;\n title?: string;\n description?: string;\n closeButton?: string;\n };\n};\n\nexport type ToastProviderProps = {\n position?:\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center';\n autoClose?: number | false;\n limit?: number;\n zIndex?: number;\n transitionDuration?: number;\n notificationMaxHeight?: number | string;\n};\n\nconst intentColorMap: Record<\n Exclude<ToastIntent, 'default'>,\n 'neutral' | 'info' | 'success' | 'warning' | 'danger'\n> = {\n neutral: 'neutral',\n info: 'info',\n success: 'success',\n warning: 'warning',\n danger: 'danger',\n};\n\nconst applyClassNames = (\n intent?: ToastIntent,\n classNames?: ToastOptions['classNames'],\n) => {\n const intentColor =\n intent && intent !== 'default' ? intentColorMap[intent] : undefined;\n const rootClass = intentColor\n ? toastRoot({ intent: intentColor })\n : toastRoot();\n return {\n root: cx(classNames?.toast ?? toastRecipe(), classNames?.root ?? rootClass),\n icon: cx(classNames?.icon ?? toastIcon()),\n loader: cx(classNames?.loader ?? toastLoader()),\n body: cx(classNames?.body ?? toastBody()),\n title: cx(classNames?.title ?? toastTitle()),\n description: cx(classNames?.description ?? toastDescription()),\n closeButton: cx(classNames?.closeButton ?? toastCloseButton()),\n };\n};\n\nconst ToastProvider = ({\n position = 'top-right',\n autoClose = 10000,\n limit = 5,\n zIndex,\n transitionDuration = 250,\n notificationMaxHeight = 200,\n}: ToastProviderProps) => {\n return (\n <Notifications\n position={position}\n autoClose={autoClose}\n limit={limit}\n zIndex={zIndex}\n transitionDuration={transitionDuration}\n notificationMaxHeight={notificationMaxHeight}\n classNames={{\n root: toastNotifications(),\n }}\n />\n );\n};\n\nexport const Toast = {\n Provider: ToastProvider,\n\n show: ({ color, classNames, intent, ...props }: ToastOptions) => {\n return notifications.show({\n ...props,\n classNames: applyClassNames(intent, classNames),\n });\n },\n\n update: ({ color, classNames, intent, ...props }: ToastOptions) => {\n notifications.update({\n ...props,\n classNames: applyClassNames(intent, classNames),\n });\n },\n\n hide: (id: string) => {\n notifications.hide(id);\n },\n\n clean: () => {\n notifications.clean();\n },\n\n cleanQueue: () => {\n notifications.cleanQueue();\n },\n};\n"],"mappings":"wXAkEA,MAAM,EAGF,CACF,QAAS,UACT,KAAM,OACN,QAAS,UACT,QAAS,UACT,OAAQ,SACT,CAEK,GACJ,EACA,IACG,CACH,IAAM,EACJ,GAAU,IAAW,UAAY,EAAe,GAAU,IAAA,GACtD,EAAY,EACd,EAAU,CAAE,OAAQ,EAAa,CAAC,CAClC,GAAW,CACf,MAAO,CACL,KAAM,EAAG,GAAY,OAASA,GAAa,CAAE,GAAY,MAAQ,EAAU,CAC3E,KAAM,EAAG,GAAY,MAAQ,GAAW,CAAC,CACzC,OAAQ,EAAG,GAAY,QAAU,GAAa,CAAC,CAC/C,KAAM,EAAG,GAAY,MAAQ,GAAW,CAAC,CACzC,MAAO,EAAG,GAAY,OAAS,GAAY,CAAC,CAC5C,YAAa,EAAG,GAAY,aAAe,GAAkB,CAAC,CAC9D,YAAa,EAAG,GAAY,aAAe,GAAkB,CAAC,CAC/D,EA0BU,EAAQ,CACnB,UAxBqB,CACrB,WAAW,YACX,YAAY,IACZ,QAAQ,EACR,SACA,qBAAqB,IACrB,wBAAwB,OAGtB,EAAC,EAAD,CACY,WACC,YACJ,QACC,SACY,qBACG,wBACvB,WAAY,CACV,KAAM,GAAoB,CAC3B,CACD,CAAA,CAOJ,MAAO,CAAE,QAAO,aAAY,SAAQ,GAAG,KAC9B,EAAc,KAAK,CACxB,GAAG,EACH,WAAY,EAAgB,EAAQ,EAAW,CAChD,CAAC,CAGJ,QAAS,CAAE,QAAO,aAAY,SAAQ,GAAG,KAA0B,CACjE,EAAc,OAAO,CACnB,GAAG,EACH,WAAY,EAAgB,EAAQ,EAAW,CAChD,CAAC,EAGJ,KAAO,GAAe,CACpB,EAAc,KAAK,EAAG,EAGxB,UAAa,CACX,EAAc,OAAO,EAGvB,eAAkB,CAChB,EAAc,YAAY,EAE7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mage-ui/components",
3
- "version": "1.0.112",
3
+ "version": "1.0.114",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -25,7 +25,7 @@
25
25
  "rimraf": "^6.1.3",
26
26
  "tsdown": "^0.21.4",
27
27
  "typescript": "^5.9.3",
28
- "@mage-ui/preset": "1.0.112",
28
+ "@mage-ui/preset": "1.0.114",
29
29
  "@mage-ui/styled-system": "1.0.8"
30
30
  },
31
31
  "peerDependencies": {