@xjur-ui/react 2.2.0 → 2.2.1

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{chunk-DT44JTXB.js → chunk-4M3WR2KJ.js} +2 -2
  3. package/dist/{chunk-DT44JTXB.js.map → chunk-4M3WR2KJ.js.map} +1 -1
  4. package/dist/{chunk-7HG6Y3VV.js → chunk-BYXTOSM6.js} +2 -2
  5. package/dist/{chunk-7HG6Y3VV.js.map → chunk-BYXTOSM6.js.map} +1 -1
  6. package/dist/{chunk-4PTFZTVU.js → chunk-HLWHETF5.js} +2 -2
  7. package/dist/{chunk-4PTFZTVU.js.map → chunk-HLWHETF5.js.map} +1 -1
  8. package/dist/{chunk-ASZAHSU5.js → chunk-SLMHDBWO.js} +2 -2
  9. package/dist/{chunk-ASZAHSU5.js.map → chunk-SLMHDBWO.js.map} +1 -1
  10. package/dist/{chunk-MQ7YTZBI.js → chunk-TTKENFBF.js} +2 -2
  11. package/dist/{chunk-MQ7YTZBI.js.map → chunk-TTKENFBF.js.map} +1 -1
  12. package/dist/components/accordion.d.ts +54 -0
  13. package/dist/components/accordion.js +2 -0
  14. package/dist/components/accordion.js.map +1 -0
  15. package/dist/components/badge.d.ts +1 -1
  16. package/dist/components/controls/rating.d.ts +137 -0
  17. package/dist/components/controls/rating.js +2 -0
  18. package/dist/components/controls/rating.js.map +1 -0
  19. package/dist/components/controls/rich-editor.js +1 -1
  20. package/dist/components/controls/slider.d.ts +172 -0
  21. package/dist/components/controls/slider.js +2 -0
  22. package/dist/components/controls/slider.js.map +1 -0
  23. package/dist/components/custom/pessoa/index.js +1 -1
  24. package/dist/components/drag-and-drop/index.js +1 -1
  25. package/dist/components/full-calendar/calendar-cell.js +1 -1
  26. package/dist/components/full-calendar/calendar-day-view.js +1 -1
  27. package/dist/components/full-calendar/calendar-month-view.js +1 -1
  28. package/dist/components/full-calendar/calendar-view-renderer.js +1 -1
  29. package/dist/components/full-calendar/calendar-week-view.js +1 -1
  30. package/dist/components/full-calendar/index.js +1 -1
  31. package/dist/components/selection-bar.d.ts +1 -1
  32. package/dist/components/status.d.ts +1 -1
  33. package/dist/components/steps/index.js +1 -1
  34. package/dist/components/table/index.js +1 -1
  35. package/dist/components/toast.d.ts +27 -0
  36. package/dist/components/toast.js +2 -0
  37. package/dist/components/toast.js.map +1 -0
  38. package/dist/components/typography.d.ts +1 -1
  39. package/dist/components/upload.js +1 -1
  40. package/dist/index.css +1 -1
  41. package/dist/index.css.map +1 -1
  42. package/package.json +19 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @xjur-ui/react
2
2
 
3
+ ## 2.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - f9c52ad: Criação dos componentes de toast, slider, accordion e rating
8
+
3
9
  ## 2.2.0
4
10
 
5
11
  ### Minor Changes
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-ZVVPUP7V.js';import {a as a$1}from'./chunk-MZSV4LNY.js';import {a as a$3}from'./chunk-MQ7YTZBI.js';import {p,q,l}from'./chunk-EXC2XOL6.js';import {b}from'./chunk-SXGSWVMZ.js';import {a as a$2}from'./chunk-EIG6CBTQ.js';import {useMemo,useCallback}from'react';import {cx}from'@xjur-ui/util';import {jsx,jsxs}from'react/jsx-runtime';function I(){let{selectedDate:t,events:o}=b(),d=useMemo(()=>p(t),[t]),g=useCallback((e,a)=>q(o,e,a),[o]),C=useCallback((e,a$1)=>({...e,date:a(e.date,a$1)}),[]);return jsx("div",{className:"bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border",children:jsxs("div",{className:"flex flex-1 flex-col",children:[jsx("div",{className:cx("bg-layer-2-hover sticky top-0 grid [grid-template-columns:64px_repeat(7,1fr)]","[&>*]:border-border-layer-2","[&>*]:border-l"),"data-slot":"week-header",children:d.map((e,a)=>jsx(a$1,{date:e.date,style:{gridColumnStart:a+2}},e.date.getDay()))}),jsx("div",{className:"overflow-hidden",children:l.map(({hour:e,label:a})=>jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"px-small flex h-full w-[64px] items-start justify-end",children:jsx(a$2,{size:"sm-1x",variant:"label",weight:"medium",children:a})}),jsx("div",{className:cx("grid flex-1 grid-cols-7","[&>*]:border-border-layer-2","[&>*]:border-t","[&>*]:border-l"),children:d.map(l=>jsx(a$3,{cell:C(l,e),events:g(l.date,e)},l.date.toISOString()))})]},e))})]})})}export{I as a};//# sourceMappingURL=chunk-DT44JTXB.js.map
2
- //# sourceMappingURL=chunk-DT44JTXB.js.map
1
+ import {a}from'./chunk-ZVVPUP7V.js';import {a as a$1}from'./chunk-MZSV4LNY.js';import {a as a$3}from'./chunk-TTKENFBF.js';import {p,q,l}from'./chunk-EXC2XOL6.js';import {b}from'./chunk-SXGSWVMZ.js';import {a as a$2}from'./chunk-EIG6CBTQ.js';import {useMemo,useCallback}from'react';import {cx}from'@xjur-ui/util';import {jsx,jsxs}from'react/jsx-runtime';function I(){let{selectedDate:t,events:o}=b(),d=useMemo(()=>p(t),[t]),g=useCallback((e,a)=>q(o,e,a),[o]),C=useCallback((e,a$1)=>({...e,date:a(e.date,a$1)}),[]);return jsx("div",{className:"bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border",children:jsxs("div",{className:"flex flex-1 flex-col",children:[jsx("div",{className:cx("bg-layer-2-hover sticky top-0 grid [grid-template-columns:64px_repeat(7,1fr)]","[&>*]:border-border-layer-2","[&>*]:border-l"),"data-slot":"week-header",children:d.map((e,a)=>jsx(a$1,{date:e.date,style:{gridColumnStart:a+2}},e.date.getDay()))}),jsx("div",{className:"overflow-hidden",children:l.map(({hour:e,label:a})=>jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"px-small flex h-full w-[64px] items-start justify-end",children:jsx(a$2,{size:"sm-1x",variant:"label",weight:"medium",children:a})}),jsx("div",{className:cx("grid flex-1 grid-cols-7","[&>*]:border-border-layer-2","[&>*]:border-t","[&>*]:border-l"),children:d.map(l=>jsx(a$3,{cell:C(l,e),events:g(l.date,e)},l.date.toISOString()))})]},e))})]})})}export{I as a};//# sourceMappingURL=chunk-4M3WR2KJ.js.map
2
+ //# sourceMappingURL=chunk-4M3WR2KJ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/full-calendar/calendar-week-view.tsx"],"names":["CalendarWeekView","selectedDate","events","useFullCalendar","monthWeekDaysCells","useMemo","getWeekDaysInMonth","getEventsForDayAndHourCallback","useCallback","date","hour","getEventsForDayAndHour","cellsWithHour","cell","setHours","jsx","jsxs","cx","index","CalendarWeekDay","WEEK_HOURS","label","Typography","CalendarCell"],"mappings":"iWAcO,SAASA,CAAAA,EAAmB,CACjC,GAAM,CAAE,aAAAC,CAAAA,CAAc,MAAA,CAAAC,CAAO,CAAA,CAAIC,CAAAA,GAE3BC,CAAAA,CAAqBC,OAAAA,CACzB,IAAMC,CAAAA,CAAmBL,CAAY,EACrC,CAACA,CAAY,CACf,CAAA,CAEMM,CAAAA,CAAiCC,YACrC,CAACC,CAAAA,CAAYC,IACJC,CAAAA,CAAuBT,CAAAA,CAAQO,EAAMC,CAAI,CAAA,CAElD,CAACR,CAAM,CACT,EAEMU,CAAAA,CAAgBJ,WAAAA,CAAY,CAACK,CAAAA,CAAqBH,GAAAA,IAC/C,CACL,GAAGG,CAAAA,CACH,KAAMC,CAAAA,CAASD,CAAAA,CAAK,KAAMH,GAAI,CAChC,GACC,EAAE,EAEL,OACEK,GAAAA,CAAC,OAAI,SAAA,CAAU,6FAAA,CACb,SAAAC,IAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,sBAAA,CACb,QAAA,CAAA,CAAAD,IAAC,KAAA,CAAA,CACC,SAAA,CAAWE,GACT,+EAAA,CACA,6BAAA,CACA,gBACF,CAAA,CACA,WAAA,CAAU,cAET,QAAA,CAAAb,CAAAA,CAAmB,GAAA,CAAI,CAACS,CAAAA,CAAMK,CAAAA,GAC7BH,IAACI,GAAAA,CAAA,CACC,KAAMN,CAAAA,CAAK,IAAA,CAEX,MAAO,CAAE,eAAA,CAAiBK,EAAQ,CAAE,CAAA,CAAA,CAD/BL,EAAK,IAAA,CAAK,MAAA,EAEjB,CACD,CAAA,CACH,EAEAE,GAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,iBAAA,CACZ,QAAA,CAAAK,EAAW,GAAA,CAAI,CAAC,CAAE,IAAA,CAAAV,CAAAA,CAAM,MAAAW,CAAM,CAAA,GAC7BL,KAAC,KAAA,CAAA,CAAI,SAAA,CAAU,mBACb,QAAA,CAAA,CAAAD,GAAAA,CAAC,OAAI,SAAA,CAAU,uDAAA,CACb,SAAAA,GAAAA,CAACO,GAAAA,CAAA,CAAW,IAAA,CAAK,OAAA,CAAQ,QAAQ,OAAA,CAAQ,MAAA,CAAO,SAC7C,QAAA,CAAAD,CAAAA,CACH,EACF,CAAA,CAEAN,GAAAA,CAAC,OACC,SAAA,CAAWE,EAAAA,CACT,0BACA,6BAAA,CACA,gBAAA,CACA,gBACF,CAAA,CAEC,QAAA,CAAAb,EAAmB,GAAA,CAAIS,CAAAA,EACtBE,IAACQ,GAAAA,CAAA,CACC,KAAMX,CAAAA,CAAcC,CAAAA,CAAMH,CAAI,CAAA,CAC9B,MAAA,CAAQH,EAA+BM,CAAAA,CAAK,IAAA,CAAMH,CAAI,CAAA,CAAA,CACjDG,CAAAA,CAAK,KAAK,WAAA,EACjB,CACD,CAAA,CACH,CAAA,CAAA,CAAA,CAtBqCH,CAuBvC,CACD,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CACF,CAEJ","file":"chunk-DT44JTXB.js","sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { cx } from '@xjur-ui/util'\nimport { setHours } from 'date-fns'\nimport { Typography } from '../typography'\nimport {\n WEEK_HOURS,\n getWeekDaysInMonth,\n getEventsForDayAndHour\n} from './helpers/calendar'\nimport { useFullCalendar } from './calendar-root'\nimport { CalendarWeekDay } from './calendar-week-day'\nimport { CalendarCell } from './calendar-cell'\nimport type { ICalendarCell } from './types/calendar-cell'\n\nexport function CalendarWeekView() {\n const { selectedDate, events } = useFullCalendar()\n\n const monthWeekDaysCells = useMemo(\n () => getWeekDaysInMonth(selectedDate),\n [selectedDate]\n )\n\n const getEventsForDayAndHourCallback = useCallback(\n (date: Date, hour: number) => {\n return getEventsForDayAndHour(events, date, hour)\n },\n [events]\n )\n\n const cellsWithHour = useCallback((cell: ICalendarCell, hour: number) => {\n return {\n ...cell,\n date: setHours(cell.date, hour)\n }\n }, [])\n\n return (\n <div className=\"bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border\">\n <div className=\"flex flex-1 flex-col\">\n <div\n className={cx(\n 'bg-layer-2-hover sticky top-0 grid [grid-template-columns:64px_repeat(7,1fr)]',\n '[&>*]:border-border-layer-2',\n '[&>*]:border-l'\n )}\n data-slot=\"week-header\"\n >\n {monthWeekDaysCells.map((cell, index) => (\n <CalendarWeekDay\n date={cell.date}\n key={cell.date.getDay()}\n style={{ gridColumnStart: index + 2 }}\n />\n ))}\n </div>\n\n <div className=\"overflow-hidden\">\n {WEEK_HOURS.map(({ hour, label }) => (\n <div className=\"flex items-start\" key={hour}>\n <div className=\"px-small flex h-full w-[64px] items-start justify-end\">\n <Typography size=\"sm-1x\" variant=\"label\" weight=\"medium\">\n {label}\n </Typography>\n </div>\n\n <div\n className={cx(\n 'grid flex-1 grid-cols-7',\n '[&>*]:border-border-layer-2',\n '[&>*]:border-t',\n '[&>*]:border-l'\n )}\n >\n {monthWeekDaysCells.map(cell => (\n <CalendarCell\n cell={cellsWithHour(cell, hour)}\n events={getEventsForDayAndHourCallback(cell.date, hour)}\n key={cell.date.toISOString()}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/full-calendar/calendar-week-view.tsx"],"names":["CalendarWeekView","selectedDate","events","useFullCalendar","monthWeekDaysCells","useMemo","getWeekDaysInMonth","getEventsForDayAndHourCallback","useCallback","date","hour","getEventsForDayAndHour","cellsWithHour","cell","setHours","jsx","jsxs","cx","index","CalendarWeekDay","WEEK_HOURS","label","Typography","CalendarCell"],"mappings":"iWAcO,SAASA,CAAAA,EAAmB,CACjC,GAAM,CAAE,aAAAC,CAAAA,CAAc,MAAA,CAAAC,CAAO,CAAA,CAAIC,CAAAA,GAE3BC,CAAAA,CAAqBC,OAAAA,CACzB,IAAMC,CAAAA,CAAmBL,CAAY,EACrC,CAACA,CAAY,CACf,CAAA,CAEMM,CAAAA,CAAiCC,YACrC,CAACC,CAAAA,CAAYC,IACJC,CAAAA,CAAuBT,CAAAA,CAAQO,EAAMC,CAAI,CAAA,CAElD,CAACR,CAAM,CACT,EAEMU,CAAAA,CAAgBJ,WAAAA,CAAY,CAACK,CAAAA,CAAqBH,GAAAA,IAC/C,CACL,GAAGG,CAAAA,CACH,KAAMC,CAAAA,CAASD,CAAAA,CAAK,KAAMH,GAAI,CAChC,GACC,EAAE,EAEL,OACEK,GAAAA,CAAC,OAAI,SAAA,CAAU,6FAAA,CACb,SAAAC,IAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,sBAAA,CACb,QAAA,CAAA,CAAAD,IAAC,KAAA,CAAA,CACC,SAAA,CAAWE,GACT,+EAAA,CACA,6BAAA,CACA,gBACF,CAAA,CACA,WAAA,CAAU,cAET,QAAA,CAAAb,CAAAA,CAAmB,GAAA,CAAI,CAACS,CAAAA,CAAMK,CAAAA,GAC7BH,IAACI,GAAAA,CAAA,CACC,KAAMN,CAAAA,CAAK,IAAA,CAEX,MAAO,CAAE,eAAA,CAAiBK,EAAQ,CAAE,CAAA,CAAA,CAD/BL,EAAK,IAAA,CAAK,MAAA,EAEjB,CACD,CAAA,CACH,EAEAE,GAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,iBAAA,CACZ,QAAA,CAAAK,EAAW,GAAA,CAAI,CAAC,CAAE,IAAA,CAAAV,CAAAA,CAAM,MAAAW,CAAM,CAAA,GAC7BL,KAAC,KAAA,CAAA,CAAI,SAAA,CAAU,mBACb,QAAA,CAAA,CAAAD,GAAAA,CAAC,OAAI,SAAA,CAAU,uDAAA,CACb,SAAAA,GAAAA,CAACO,GAAAA,CAAA,CAAW,IAAA,CAAK,OAAA,CAAQ,QAAQ,OAAA,CAAQ,MAAA,CAAO,SAC7C,QAAA,CAAAD,CAAAA,CACH,EACF,CAAA,CAEAN,GAAAA,CAAC,OACC,SAAA,CAAWE,EAAAA,CACT,0BACA,6BAAA,CACA,gBAAA,CACA,gBACF,CAAA,CAEC,QAAA,CAAAb,EAAmB,GAAA,CAAIS,CAAAA,EACtBE,IAACQ,GAAAA,CAAA,CACC,KAAMX,CAAAA,CAAcC,CAAAA,CAAMH,CAAI,CAAA,CAC9B,MAAA,CAAQH,EAA+BM,CAAAA,CAAK,IAAA,CAAMH,CAAI,CAAA,CAAA,CACjDG,CAAAA,CAAK,KAAK,WAAA,EACjB,CACD,CAAA,CACH,CAAA,CAAA,CAAA,CAtBqCH,CAuBvC,CACD,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CACF,CAEJ","file":"chunk-4M3WR2KJ.js","sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { cx } from '@xjur-ui/util'\nimport { setHours } from 'date-fns'\nimport { Typography } from '../typography'\nimport {\n WEEK_HOURS,\n getWeekDaysInMonth,\n getEventsForDayAndHour\n} from './helpers/calendar'\nimport { useFullCalendar } from './calendar-root'\nimport { CalendarWeekDay } from './calendar-week-day'\nimport { CalendarCell } from './calendar-cell'\nimport type { ICalendarCell } from './types/calendar-cell'\n\nexport function CalendarWeekView() {\n const { selectedDate, events } = useFullCalendar()\n\n const monthWeekDaysCells = useMemo(\n () => getWeekDaysInMonth(selectedDate),\n [selectedDate]\n )\n\n const getEventsForDayAndHourCallback = useCallback(\n (date: Date, hour: number) => {\n return getEventsForDayAndHour(events, date, hour)\n },\n [events]\n )\n\n const cellsWithHour = useCallback((cell: ICalendarCell, hour: number) => {\n return {\n ...cell,\n date: setHours(cell.date, hour)\n }\n }, [])\n\n return (\n <div className=\"bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border\">\n <div className=\"flex flex-1 flex-col\">\n <div\n className={cx(\n 'bg-layer-2-hover sticky top-0 grid [grid-template-columns:64px_repeat(7,1fr)]',\n '[&>*]:border-border-layer-2',\n '[&>*]:border-l'\n )}\n data-slot=\"week-header\"\n >\n {monthWeekDaysCells.map((cell, index) => (\n <CalendarWeekDay\n date={cell.date}\n key={cell.date.getDay()}\n style={{ gridColumnStart: index + 2 }}\n />\n ))}\n </div>\n\n <div className=\"overflow-hidden\">\n {WEEK_HOURS.map(({ hour, label }) => (\n <div className=\"flex items-start\" key={hour}>\n <div className=\"px-small flex h-full w-[64px] items-start justify-end\">\n <Typography size=\"sm-1x\" variant=\"label\" weight=\"medium\">\n {label}\n </Typography>\n </div>\n\n <div\n className={cx(\n 'grid flex-1 grid-cols-7',\n '[&>*]:border-border-layer-2',\n '[&>*]:border-t',\n '[&>*]:border-l'\n )}\n >\n {monthWeekDaysCells.map(cell => (\n <CalendarCell\n cell={cellsWithHour(cell, hour)}\n events={getEventsForDayAndHourCallback(cell.date, hour)}\n key={cell.date.toISOString()}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {a as a$1}from'./chunk-MQ7YTZBI.js';import {m,n,k}from'./chunk-EXC2XOL6.js';import {b}from'./chunk-SXGSWVMZ.js';import {a}from'./chunk-EIG6CBTQ.js';import {useMemo,useCallback}from'react';import {cx}from'@xjur-ui/util';import {jsxs,jsx}from'react/jsx-runtime';function w(){let{selectedDate:a$2,events:o}=b(),p=useMemo(()=>m(a$2),[a$2]),y=useCallback(r=>n(o,r.date),[o]);return jsxs("div",{className:"rounded-small-1x scrollbar-hide border-border-layer-2 h-full w-full border",children:[jsx("div",{className:"bg-layer-2-hover h-large-4x rounded-t-small-1x sticky top-0 grid grid-cols-7","data-slot":"month-header",children:k.map(r=>jsx("div",{className:cx("p-small b border-border-layer-2 flex items-center justify-center border-r last:border-r-0"),"data-slot":"month-header-weekday",children:jsx(a,{size:"sm",variant:"label",weight:"medium",children:r})},r))}),jsx("div",{className:"grid h-full grid-cols-7 overflow-hidden","data-slot":"month-day-cells",children:p.map((r,l)=>{let b=(l+1)%7===0,h=(l+1)%7===1;return jsx("div",{className:cx("border-border-layer-2 border-t border-r",b&&"pr-small-2x border-r-0",h&&"pl-small-2x"),children:jsx(a$1,{cell:r,events:y(r)})},`${r.date.toISOString()}-${l}`)})})]})}export{w as a};//# sourceMappingURL=chunk-7HG6Y3VV.js.map
2
- //# sourceMappingURL=chunk-7HG6Y3VV.js.map
1
+ import {a as a$1}from'./chunk-TTKENFBF.js';import {m,n,k}from'./chunk-EXC2XOL6.js';import {b}from'./chunk-SXGSWVMZ.js';import {a}from'./chunk-EIG6CBTQ.js';import {useMemo,useCallback}from'react';import {cx}from'@xjur-ui/util';import {jsxs,jsx}from'react/jsx-runtime';function w(){let{selectedDate:a$2,events:o}=b(),p=useMemo(()=>m(a$2),[a$2]),y=useCallback(r=>n(o,r.date),[o]);return jsxs("div",{className:"rounded-small-1x scrollbar-hide border-border-layer-2 h-full w-full border",children:[jsx("div",{className:"bg-layer-2-hover h-large-4x rounded-t-small-1x sticky top-0 grid grid-cols-7","data-slot":"month-header",children:k.map(r=>jsx("div",{className:cx("p-small b border-border-layer-2 flex items-center justify-center border-r last:border-r-0"),"data-slot":"month-header-weekday",children:jsx(a,{size:"sm",variant:"label",weight:"medium",children:r})},r))}),jsx("div",{className:"grid h-full grid-cols-7 overflow-hidden","data-slot":"month-day-cells",children:p.map((r,l)=>{let b=(l+1)%7===0,h=(l+1)%7===1;return jsx("div",{className:cx("border-border-layer-2 border-t border-r",b&&"pr-small-2x border-r-0",h&&"pl-small-2x"),children:jsx(a$1,{cell:r,events:y(r)})},`${r.date.toISOString()}-${l}`)})})]})}export{w as a};//# sourceMappingURL=chunk-BYXTOSM6.js.map
2
+ //# sourceMappingURL=chunk-BYXTOSM6.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/full-calendar/calendar-month-view.tsx"],"names":["CalendarMonthView","selectedDate","events","useFullCalendar","monthDaysCells","useMemo","getDaysInMonth","getEventsForDayCell","useCallback","cell","getEventsForDay","jsxs","jsx","WEEKDAYS","weekday","cx","Typography","index","isLastColumn","isFirstColumn","CalendarCell"],"mappings":"2QAQO,SAASA,CAAAA,EAAoB,CAClC,GAAM,CAAE,YAAA,CAAAC,GAAAA,CAAc,MAAA,CAAAC,CAAO,CAAA,CAAIC,CAAAA,EAAgB,CAE3CC,CAAAA,CAAiBC,QACrB,IAAMC,CAAAA,CAAeL,GAAY,CAAA,CACjC,CAACA,GAAY,CACf,CAAA,CAEMM,CAAAA,CAAsBC,WAAAA,CACzBC,CAAAA,EACQC,CAAAA,CAAgBR,CAAAA,CAAQO,EAAK,IAAI,CAAA,CAE1C,CAACP,CAAM,CACT,CAAA,CAEA,OACES,IAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,4EAAA,CACb,QAAA,CAAA,CAAAC,GAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAU,8EAAA,CACV,WAAA,CAAU,cAAA,CAET,SAAAC,CAAAA,CAAS,GAAA,CAAIC,CAAAA,EACZF,GAAAA,CAAC,OACC,SAAA,CAAWG,EAAAA,CACT,2FACF,CAAA,CACA,YAAU,sBAAA,CAGV,QAAA,CAAAH,GAAAA,CAACI,CAAAA,CAAA,CAAW,IAAA,CAAK,IAAA,CAAK,OAAA,CAAQ,QAAQ,MAAA,CAAO,QAAA,CAC1C,QAAA,CAAAF,CAAAA,CACH,GAJKA,CAKP,CACD,CAAA,CACH,CAAA,CAEAF,IAAC,KAAA,CAAA,CACC,SAAA,CAAU,yCAAA,CACV,WAAA,CAAU,iBAAA,CAET,QAAA,CAAAR,CAAAA,CAAe,GAAA,CAAI,CAACK,CAAAA,CAAMQ,CAAAA,GAAU,CACnC,IAAMC,GAAgBD,CAAAA,CAAQ,CAAA,EAAK,CAAA,GAAM,CAAA,CACnCE,GAAiBF,CAAAA,CAAQ,CAAA,EAAK,CAAA,GAAM,CAAA,CAE1C,OACEL,GAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAWG,GACT,yCAAA,CACAG,CAAAA,EAAgB,wBAAA,CAChBC,CAAAA,EAAiB,aACnB,CAAA,CAGA,QAAA,CAAAP,GAAAA,CAACQ,GAAAA,CAAA,CAAa,IAAA,CAAMX,CAAAA,CAAM,MAAA,CAAQF,CAAAA,CAAoBE,CAAI,CAAA,CAAG,CAAA,CAAA,CAFxD,CAAA,EAAGA,EAAK,IAAA,CAAK,WAAA,EAAa,CAAA,CAAA,EAAIQ,CAAK,CAAA,CAG1C,CAEJ,CAAC,CAAA,CACH,GACF,CAEJ","file":"chunk-7HG6Y3VV.js","sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { cx } from '@xjur-ui/util'\nimport { Typography } from '../typography'\nimport { getDaysInMonth, getEventsForDay, WEEKDAYS } from './helpers/calendar'\nimport { useFullCalendar } from './calendar-root'\nimport { CalendarCell } from './calendar-cell'\nimport type { ICalendarCell } from './types/calendar-cell'\n\nexport function CalendarMonthView() {\n const { selectedDate, events } = useFullCalendar()\n\n const monthDaysCells = useMemo(\n () => getDaysInMonth(selectedDate),\n [selectedDate]\n )\n\n const getEventsForDayCell = useCallback(\n (cell: ICalendarCell) => {\n return getEventsForDay(events, cell.date)\n },\n [events]\n )\n\n return (\n <div className=\"rounded-small-1x scrollbar-hide border-border-layer-2 h-full w-full border\">\n <div\n className=\"bg-layer-2-hover h-large-4x rounded-t-small-1x sticky top-0 grid grid-cols-7\"\n data-slot=\"month-header\"\n >\n {WEEKDAYS.map(weekday => (\n <div\n className={cx(\n 'p-small b border-border-layer-2 flex items-center justify-center border-r last:border-r-0'\n )}\n data-slot=\"month-header-weekday\"\n key={weekday}\n >\n <Typography size=\"sm\" variant=\"label\" weight=\"medium\">\n {weekday}\n </Typography>\n </div>\n ))}\n </div>\n\n <div\n className=\"grid h-full grid-cols-7 overflow-hidden\"\n data-slot=\"month-day-cells\"\n >\n {monthDaysCells.map((cell, index) => {\n const isLastColumn = (index + 1) % 7 === 0\n const isFirstColumn = (index + 1) % 7 === 1\n\n return (\n <div\n className={cx(\n 'border-border-layer-2 border-t border-r',\n isLastColumn && 'pr-small-2x border-r-0',\n isFirstColumn && 'pl-small-2x'\n )}\n key={`${cell.date.toISOString()}-${index}`}\n >\n <CalendarCell cell={cell} events={getEventsForDayCell(cell)} />\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/full-calendar/calendar-month-view.tsx"],"names":["CalendarMonthView","selectedDate","events","useFullCalendar","monthDaysCells","useMemo","getDaysInMonth","getEventsForDayCell","useCallback","cell","getEventsForDay","jsxs","jsx","WEEKDAYS","weekday","cx","Typography","index","isLastColumn","isFirstColumn","CalendarCell"],"mappings":"2QAQO,SAASA,CAAAA,EAAoB,CAClC,GAAM,CAAE,YAAA,CAAAC,GAAAA,CAAc,MAAA,CAAAC,CAAO,CAAA,CAAIC,CAAAA,EAAgB,CAE3CC,CAAAA,CAAiBC,QACrB,IAAMC,CAAAA,CAAeL,GAAY,CAAA,CACjC,CAACA,GAAY,CACf,CAAA,CAEMM,CAAAA,CAAsBC,WAAAA,CACzBC,CAAAA,EACQC,CAAAA,CAAgBR,CAAAA,CAAQO,EAAK,IAAI,CAAA,CAE1C,CAACP,CAAM,CACT,CAAA,CAEA,OACES,IAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,4EAAA,CACb,QAAA,CAAA,CAAAC,GAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAU,8EAAA,CACV,WAAA,CAAU,cAAA,CAET,SAAAC,CAAAA,CAAS,GAAA,CAAIC,CAAAA,EACZF,GAAAA,CAAC,OACC,SAAA,CAAWG,EAAAA,CACT,2FACF,CAAA,CACA,YAAU,sBAAA,CAGV,QAAA,CAAAH,GAAAA,CAACI,CAAAA,CAAA,CAAW,IAAA,CAAK,IAAA,CAAK,OAAA,CAAQ,QAAQ,MAAA,CAAO,QAAA,CAC1C,QAAA,CAAAF,CAAAA,CACH,GAJKA,CAKP,CACD,CAAA,CACH,CAAA,CAEAF,IAAC,KAAA,CAAA,CACC,SAAA,CAAU,yCAAA,CACV,WAAA,CAAU,iBAAA,CAET,QAAA,CAAAR,CAAAA,CAAe,GAAA,CAAI,CAACK,CAAAA,CAAMQ,CAAAA,GAAU,CACnC,IAAMC,GAAgBD,CAAAA,CAAQ,CAAA,EAAK,CAAA,GAAM,CAAA,CACnCE,GAAiBF,CAAAA,CAAQ,CAAA,EAAK,CAAA,GAAM,CAAA,CAE1C,OACEL,GAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAWG,GACT,yCAAA,CACAG,CAAAA,EAAgB,wBAAA,CAChBC,CAAAA,EAAiB,aACnB,CAAA,CAGA,QAAA,CAAAP,GAAAA,CAACQ,GAAAA,CAAA,CAAa,IAAA,CAAMX,CAAAA,CAAM,MAAA,CAAQF,CAAAA,CAAoBE,CAAI,CAAA,CAAG,CAAA,CAAA,CAFxD,CAAA,EAAGA,EAAK,IAAA,CAAK,WAAA,EAAa,CAAA,CAAA,EAAIQ,CAAK,CAAA,CAG1C,CAEJ,CAAC,CAAA,CACH,GACF,CAEJ","file":"chunk-BYXTOSM6.js","sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { cx } from '@xjur-ui/util'\nimport { Typography } from '../typography'\nimport { getDaysInMonth, getEventsForDay, WEEKDAYS } from './helpers/calendar'\nimport { useFullCalendar } from './calendar-root'\nimport { CalendarCell } from './calendar-cell'\nimport type { ICalendarCell } from './types/calendar-cell'\n\nexport function CalendarMonthView() {\n const { selectedDate, events } = useFullCalendar()\n\n const monthDaysCells = useMemo(\n () => getDaysInMonth(selectedDate),\n [selectedDate]\n )\n\n const getEventsForDayCell = useCallback(\n (cell: ICalendarCell) => {\n return getEventsForDay(events, cell.date)\n },\n [events]\n )\n\n return (\n <div className=\"rounded-small-1x scrollbar-hide border-border-layer-2 h-full w-full border\">\n <div\n className=\"bg-layer-2-hover h-large-4x rounded-t-small-1x sticky top-0 grid grid-cols-7\"\n data-slot=\"month-header\"\n >\n {WEEKDAYS.map(weekday => (\n <div\n className={cx(\n 'p-small b border-border-layer-2 flex items-center justify-center border-r last:border-r-0'\n )}\n data-slot=\"month-header-weekday\"\n key={weekday}\n >\n <Typography size=\"sm\" variant=\"label\" weight=\"medium\">\n {weekday}\n </Typography>\n </div>\n ))}\n </div>\n\n <div\n className=\"grid h-full grid-cols-7 overflow-hidden\"\n data-slot=\"month-day-cells\"\n >\n {monthDaysCells.map((cell, index) => {\n const isLastColumn = (index + 1) % 7 === 0\n const isFirstColumn = (index + 1) % 7 === 1\n\n return (\n <div\n className={cx(\n 'border-border-layer-2 border-t border-r',\n isLastColumn && 'pr-small-2x border-r-0',\n isFirstColumn && 'pl-small-2x'\n )}\n key={`${cell.date.toISOString()}-${index}`}\n >\n <CalendarCell cell={cell} events={getEventsForDayCell(cell)} />\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {a as a$2}from'./chunk-DT44JTXB.js';import {a}from'./chunk-7HG6Y3VV.js';import {a as a$1}from'./chunk-ASZAHSU5.js';import {b}from'./chunk-SXGSWVMZ.js';import {jsx}from'react/jsx-runtime';function u(){let{calendarView:t}=b();switch(t){case "month":return jsx(a,{});case "week":return jsx(a$2,{});case "day":return jsx(a$1,{});default:return jsx(a,{})}}export{u as a};//# sourceMappingURL=chunk-4PTFZTVU.js.map
2
- //# sourceMappingURL=chunk-4PTFZTVU.js.map
1
+ import {a as a$2}from'./chunk-4M3WR2KJ.js';import {a as a$1}from'./chunk-SLMHDBWO.js';import {a}from'./chunk-BYXTOSM6.js';import {b}from'./chunk-SXGSWVMZ.js';import {jsx}from'react/jsx-runtime';function u(){let{calendarView:t}=b();switch(t){case "month":return jsx(a,{});case "week":return jsx(a$2,{});case "day":return jsx(a$1,{});default:return jsx(a,{})}}export{u as a};//# sourceMappingURL=chunk-HLWHETF5.js.map
2
+ //# sourceMappingURL=chunk-HLWHETF5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/full-calendar/calendar-view-renderer.tsx"],"names":["CalendarViewRenderer","calendarView","useFullCalendar","jsx","CalendarMonthView","CalendarWeekView","CalendarDayView"],"mappings":"kMAKO,SAASA,GAAuB,CACrC,GAAM,CAAE,YAAA,CAAAC,CAAa,EAAIC,CAAAA,EAAgB,CAEzC,OAAQD,CAAAA,EACN,KAAK,OAAA,CACH,OAAOE,IAACC,CAAAA,CAAA,EAAkB,CAAA,CAC5B,KAAK,OACH,OAAOD,GAAAA,CAACE,IAAA,EAAiB,CAAA,CAC3B,KAAK,KAAA,CACH,OAAOF,IAACG,GAAAA,CAAA,EAAgB,EAC1B,QACE,OAAOH,IAACC,CAAAA,CAAA,EAAkB,CAC9B,CACF","file":"chunk-4PTFZTVU.js","sourcesContent":["import { useFullCalendar } from './calendar-root'\nimport { CalendarMonthView } from './calendar-month-view'\nimport { CalendarWeekView } from './calendar-week-view'\nimport { CalendarDayView } from './calendar-day-view'\n\nexport function CalendarViewRenderer() {\n const { calendarView } = useFullCalendar()\n\n switch (calendarView) {\n case 'month':\n return <CalendarMonthView />\n case 'week':\n return <CalendarWeekView />\n case 'day':\n return <CalendarDayView />\n default:\n return <CalendarMonthView />\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/components/full-calendar/calendar-view-renderer.tsx"],"names":["CalendarViewRenderer","calendarView","useFullCalendar","jsx","CalendarMonthView","CalendarWeekView","CalendarDayView"],"mappings":"kMAKO,SAASA,GAAuB,CACrC,GAAM,CAAE,YAAA,CAAAC,CAAa,EAAIC,CAAAA,EAAgB,CAEzC,OAAQD,CAAAA,EACN,KAAK,OAAA,CACH,OAAOE,IAACC,CAAAA,CAAA,EAAkB,CAAA,CAC5B,KAAK,OACH,OAAOD,GAAAA,CAACE,IAAA,EAAiB,CAAA,CAC3B,KAAK,KAAA,CACH,OAAOF,IAACG,GAAAA,CAAA,EAAgB,EAC1B,QACE,OAAOH,IAACC,CAAAA,CAAA,EAAkB,CAC9B,CACF","file":"chunk-HLWHETF5.js","sourcesContent":["import { useFullCalendar } from './calendar-root'\nimport { CalendarMonthView } from './calendar-month-view'\nimport { CalendarWeekView } from './calendar-week-view'\nimport { CalendarDayView } from './calendar-day-view'\n\nexport function CalendarViewRenderer() {\n const { calendarView } = useFullCalendar()\n\n switch (calendarView) {\n case 'month':\n return <CalendarMonthView />\n case 'week':\n return <CalendarWeekView />\n case 'day':\n return <CalendarDayView />\n default:\n return <CalendarMonthView />\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-ZVVPUP7V.js';import {a as a$1}from'./chunk-MZSV4LNY.js';import {a as a$3}from'./chunk-MQ7YTZBI.js';import {q,l}from'./chunk-EXC2XOL6.js';import {b}from'./chunk-SXGSWVMZ.js';import {a as a$2}from'./chunk-EIG6CBTQ.js';import {useCallback}from'react';import {cx}from'@xjur-ui/util';import {jsx,jsxs}from'react/jsx-runtime';function D(){let{selectedDate:a$4,events:d}=b(),p=useCallback((e,l)=>q(d,e,l),[d]),y=useCallback((e,l)=>({...e,date:a(e.date,l)}),[]);return jsx("div",{className:"bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border",children:jsxs("div",{className:"flex flex-1 flex-col",children:[jsxs("div",{className:"bg-layer-2-hover sticky top-0 z-10 flex w-full","data-slot":"week-header",children:[jsx("div",{className:"w-[64px]"}),jsx(a$1,{className:"border-border-layer-2 items-start border-l",date:a$4})]}),jsx("div",{className:"overflow-hidden",children:l.map(({hour:e,label:l})=>jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"px-small flex h-full w-[64px] items-start justify-end",children:jsx(a$2,{size:"sm-1x",variant:"label",weight:"medium",children:l})}),jsx("div",{className:cx("flex flex-1","[&>*]:border-border-layer-2","[&>*]:border-t","[&>*]:border-l"),children:jsx(a$3,{cell:y({date:a$4,type:"day"},e),events:p(a$4,e)})})]},e))})]})})}export{D as a};//# sourceMappingURL=chunk-ASZAHSU5.js.map
2
- //# sourceMappingURL=chunk-ASZAHSU5.js.map
1
+ import {a}from'./chunk-ZVVPUP7V.js';import {a as a$1}from'./chunk-MZSV4LNY.js';import {a as a$3}from'./chunk-TTKENFBF.js';import {q,l}from'./chunk-EXC2XOL6.js';import {b}from'./chunk-SXGSWVMZ.js';import {a as a$2}from'./chunk-EIG6CBTQ.js';import {useCallback}from'react';import {cx}from'@xjur-ui/util';import {jsx,jsxs}from'react/jsx-runtime';function D(){let{selectedDate:a$4,events:d}=b(),p=useCallback((e,l)=>q(d,e,l),[d]),y=useCallback((e,l)=>({...e,date:a(e.date,l)}),[]);return jsx("div",{className:"bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border",children:jsxs("div",{className:"flex flex-1 flex-col",children:[jsxs("div",{className:"bg-layer-2-hover sticky top-0 z-10 flex w-full","data-slot":"week-header",children:[jsx("div",{className:"w-[64px]"}),jsx(a$1,{className:"border-border-layer-2 items-start border-l",date:a$4})]}),jsx("div",{className:"overflow-hidden",children:l.map(({hour:e,label:l})=>jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"px-small flex h-full w-[64px] items-start justify-end",children:jsx(a$2,{size:"sm-1x",variant:"label",weight:"medium",children:l})}),jsx("div",{className:cx("flex flex-1","[&>*]:border-border-layer-2","[&>*]:border-t","[&>*]:border-l"),children:jsx(a$3,{cell:y({date:a$4,type:"day"},e),events:p(a$4,e)})})]},e))})]})})}export{D as a};//# sourceMappingURL=chunk-SLMHDBWO.js.map
2
+ //# sourceMappingURL=chunk-SLMHDBWO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/full-calendar/calendar-day-view.tsx"],"names":["CalendarDayView","selectedDate","events","useFullCalendar","getEventsForDayAndHourCallback","useCallback","date","hour","get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AAK,OAAA,CAAQ,QAAQ,OAAA,CAAQ,MAAA,CAAO,QAAA,CAC7C,QAAA,CAAAD,EACH,CAAA,CACF,CAAA,CAEAJ,GAAAA,CAAC,KAAA,CAAA,CACC,UAAWM,EAAAA,CACT,aAAA,CACA,6BAAA,CACA,gBAAA,CACA,gBACF,CAAA,CAEA,QAAA,CAAAN,IAACO,GAAAA,CAAA,CACC,KAAMV,CAAAA,CACJ,CACE,IAAA,CAAMR,GAAAA,CACN,KAAM,KACR,CAAA,CACAM,CACF,CAAA,CACA,OAAQH,CAAAA,CAA+BH,GAAAA,CAAcM,CAAI,CAAA,CAC3D,EACF,CAAA,CAAA,CAAA,CAzBqCA,CA0BvC,CACD,CAAA,CACH,CAAA,CAAA,CACF,EACF,CAEJ","file":"chunk-ASZAHSU5.js","sourcesContent":["import { useCallback } from 'react'\nimport { cx } from '@xjur-ui/util'\nimport { setHours } from 'date-fns'\nimport { Typography } from '../typography'\nimport { WEEK_HOURS, getEventsForDayAndHour } from './helpers/calendar'\nimport { useFullCalendar } from './calendar-root'\nimport { CalendarWeekDay } from './calendar-week-day'\nimport { CalendarCell } from './calendar-cell'\nimport type { ICalendarCell } from './types/calendar-cell'\n\nexport function CalendarDayView() {\n const { selectedDate, events } = useFullCalendar()\n\n const getEventsForDayAndHourCallback = useCallback(\n (date: Date, hour: number) => {\n return getEventsForDayAndHour(events, date, hour)\n },\n [events]\n )\n\n const cellsWithHour = useCallback((cell: ICalendarCell, hour: number) => {\n return {\n ...cell,\n date: setHours(cell.date, hour)\n }\n }, [])\n\n return (\n <div className=\"bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border\">\n <div className=\"flex flex-1 flex-col\">\n <div\n className=\"bg-layer-2-hover sticky top-0 z-10 flex w-full\"\n data-slot=\"week-header\"\n >\n <div className=\"w-[64px]\" />\n <CalendarWeekDay\n className=\"border-border-layer-2 items-start border-l\"\n date={selectedDate}\n />\n </div>\n\n <div className=\"overflow-hidden\">\n {WEEK_HOURS.map(({ hour, label }) => (\n <div className=\"flex items-start\" key={hour}>\n <div className=\"px-small flex h-full w-[64px] items-start justify-end\">\n <Typography size=\"sm-1x\" variant=\"label\" weight=\"medium\">\n {label}\n </Typography>\n </div>\n\n <div\n className={cx(\n 'flex flex-1',\n '[&>*]:border-border-layer-2',\n '[&>*]:border-t',\n '[&>*]:border-l'\n )}\n >\n <CalendarCell\n cell={cellsWithHour(\n {\n date: selectedDate,\n type: 'day'\n },\n hour\n )}\n events={getEventsForDayAndHourCallback(selectedDate, hour)}\n />\n </div>\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/full-calendar/calendar-day-view.tsx"],"names":["CalendarDayView","selectedDate","events","useFullCalendar","getEventsForDayAndHourCallback","useCallback","date","hour","getEventsForDayAndHour","cellsWithHour","cell","setHours","jsx","jsxs","CalendarWeekDay","WEEK_HOURS","label","Typography","cx","CalendarCell"],"mappings":"uVAUO,SAASA,CAAAA,EAAkB,CAChC,GAAM,CAAE,YAAA,CAAAC,GAAAA,CAAc,OAAAC,CAAO,CAAA,CAAIC,CAAAA,EAAgB,CAE3CC,EAAiCC,WAAAA,CACrC,CAACC,CAAAA,CAAYC,CAAAA,GACJC,EAAuBN,CAAAA,CAAQI,CAAAA,CAAMC,CAAI,CAAA,CAElD,CAACL,CAAM,CACT,CAAA,CAEMO,CAAAA,CAAgBJ,WAAAA,CAAY,CAACK,CAAAA,CAAqBH,CAAAA,IAC/C,CACL,GAAGG,EACH,IAAA,CAAMC,CAAAA,CAASD,CAAAA,CAAK,IAAA,CAAMH,CAAI,CAChC,CAAA,CAAA,CACC,EAAE,EAEL,OACEK,GAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,8FACb,QAAA,CAAAC,IAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,uBACb,QAAA,CAAA,CAAAA,IAAAA,CAAC,KAAA,CAAA,CACC,SAAA,CAAU,iDACV,WAAA,CAAU,aAAA,CAEV,UAAAD,GAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,UAAA,CAAW,CAAA,CAC1BA,GAAAA,CAACE,GAAAA,CAAA,CACC,SAAA,CAAU,4CAAA,CACV,IAAA,CAAMb,GAAAA,CACR,GACF,CAAA,CAEAW,GAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,kBACZ,QAAA,CAAAG,CAAAA,CAAW,GAAA,CAAI,CAAC,CAAE,IAAA,CAAAR,CAAAA,CAAM,KAAA,CAAAS,CAAM,IAC7BH,IAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,kBAAA,CACb,UAAAD,GAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,uDAAA,CACb,SAAAA,GAAAA,CAACK,GAAAA,CAAA,CAAW,IAAA,CAAK,OAAA,CAAQ,QAAQ,OAAA,CAAQ,MAAA,CAAO,QAAA,CAC7C,QAAA,CAAAD,EACH,CAAA,CACF,CAAA,CAEAJ,GAAAA,CAAC,KAAA,CAAA,CACC,UAAWM,EAAAA,CACT,aAAA,CACA,6BAAA,CACA,gBAAA,CACA,gBACF,CAAA,CAEA,QAAA,CAAAN,IAACO,GAAAA,CAAA,CACC,KAAMV,CAAAA,CACJ,CACE,IAAA,CAAMR,GAAAA,CACN,KAAM,KACR,CAAA,CACAM,CACF,CAAA,CACA,OAAQH,CAAAA,CAA+BH,GAAAA,CAAcM,CAAI,CAAA,CAC3D,EACF,CAAA,CAAA,CAAA,CAzBqCA,CA0BvC,CACD,CAAA,CACH,CAAA,CAAA,CACF,EACF,CAEJ","file":"chunk-SLMHDBWO.js","sourcesContent":["import { useCallback } from 'react'\nimport { cx } from '@xjur-ui/util'\nimport { setHours } from 'date-fns'\nimport { Typography } from '../typography'\nimport { WEEK_HOURS, getEventsForDayAndHour } from './helpers/calendar'\nimport { useFullCalendar } from './calendar-root'\nimport { CalendarWeekDay } from './calendar-week-day'\nimport { CalendarCell } from './calendar-cell'\nimport type { ICalendarCell } from './types/calendar-cell'\n\nexport function CalendarDayView() {\n const { selectedDate, events } = useFullCalendar()\n\n const getEventsForDayAndHourCallback = useCallback(\n (date: Date, hour: number) => {\n return getEventsForDayAndHour(events, date, hour)\n },\n [events]\n )\n\n const cellsWithHour = useCallback((cell: ICalendarCell, hour: number) => {\n return {\n ...cell,\n date: setHours(cell.date, hour)\n }\n }, [])\n\n return (\n <div className=\"bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border\">\n <div className=\"flex flex-1 flex-col\">\n <div\n className=\"bg-layer-2-hover sticky top-0 z-10 flex w-full\"\n data-slot=\"week-header\"\n >\n <div className=\"w-[64px]\" />\n <CalendarWeekDay\n className=\"border-border-layer-2 items-start border-l\"\n date={selectedDate}\n />\n </div>\n\n <div className=\"overflow-hidden\">\n {WEEK_HOURS.map(({ hour, label }) => (\n <div className=\"flex items-start\" key={hour}>\n <div className=\"px-small flex h-full w-[64px] items-start justify-end\">\n <Typography size=\"sm-1x\" variant=\"label\" weight=\"medium\">\n {label}\n </Typography>\n </div>\n\n <div\n className={cx(\n 'flex flex-1',\n '[&>*]:border-border-layer-2',\n '[&>*]:border-t',\n '[&>*]:border-l'\n )}\n >\n <CalendarCell\n cell={cellsWithHour(\n {\n date: selectedDate,\n type: 'day'\n },\n hour\n )}\n events={getEventsForDayAndHourCallback(selectedDate, hour)}\n />\n </div>\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {a as a$1}from'./chunk-OKSGVAQQ.js';import {o,f}from'./chunk-EXC2XOL6.js';import {b as b$1}from'./chunk-SXGSWVMZ.js';import {b as b$2}from'./chunk-M6ZI7M3R.js';import {b as b$3}from'./chunk-DVDHTP4C.js';import {a}from'./chunk-EIG6CBTQ.js';import {useMemo,Fragment}from'react';import {useDroppable}from'@dnd-kit/core';import {tv,cx}from'@xjur-ui/util';import {jsxs,jsx}from'react/jsx-runtime';function b(r){return +f(r)<Date.now()}var j=tv({base:"group/calendar-cell p-small flex flex-col gap-small-1x w-full bg-layer-2-idle ",variants:{type:{month:"h-[212px]",week:"min-h-[64px] max-h-[212px]",day:"min-h-[64px] max-h-[212px]"}}});function Q({cell:r,events:t}){let{date:e,type:n}=r,{renderEvent:D,activeEventId:m,onAddEvent:c,disableEventCreationInPast:p}=b$1(),f=useMemo(()=>t.slice(0,2),[t]),E=t.length>=3,{isOver:N,setNodeRef:I}=useDroppable({id:`calendar-cell-${n}-${e.toISOString()}`,data:{date:e,type:n}}),w=useMemo(()=>{let l=t.find(o=>o.id===m);if(!l)return false;let u=o=>o.toLocaleDateString("pt-BR",{year:"numeric",month:"2-digit",day:"2-digit"}),T=u(e),k=u(l.eventDate);return T===k},[m,e,t]),P=j({type:n}),S=useMemo(()=>p&&b(e)&&!o(e),[p,e]);return jsxs("div",{className:P,"data-slot":"calendar-cell",ref:I,children:[n==="month"&&jsx("div",{className:"flex items-center justify-center",children:jsx("div",{className:cx("size-large-2x rounded-circle bg-layer-2-idle flex items-center justify-center",o(e)&&"bg-primary-idle text-neutral-label"),children:jsx(a,{size:"sm",variant:"label",weight:"medium",children:r.date.getDate()})})}),jsxs("div",{className:"gap-small-1x flex flex-col",children:[f.map(l=>jsx(Fragment,{children:D(l)},l.id)),N&&f.length<2&&!w&&jsx("div",{className:"border-border-layer-4 rounded-small-2x h-[68px] w-full border border-dashed"})]}),jsxs("div",{className:"mt-auto flex items-center justify-between",children:[E&&jsx(a$1,{events:t.slice(2)}),c&&!S&&jsx("div",{className:"invisible ml-auto transition-opacity duration-100 ease-in-out group-hover/calendar-cell:visible",children:jsx(b$2,{size:"icon_sm",variant:"outlined",onClick:()=>c(e),children:jsx(b$3,{className:"text-icon-neutral-3",name:"add"})})})]})]})}export{Q as a};//# sourceMappingURL=chunk-MQ7YTZBI.js.map
2
- //# sourceMappingURL=chunk-MQ7YTZBI.js.map
1
+ import {a as a$1}from'./chunk-OKSGVAQQ.js';import {o,f}from'./chunk-EXC2XOL6.js';import {b as b$1}from'./chunk-SXGSWVMZ.js';import {b as b$2}from'./chunk-M6ZI7M3R.js';import {b as b$3}from'./chunk-DVDHTP4C.js';import {a}from'./chunk-EIG6CBTQ.js';import {useMemo,Fragment}from'react';import {useDroppable}from'@dnd-kit/core';import {tv,cx}from'@xjur-ui/util';import {jsxs,jsx}from'react/jsx-runtime';function b(r){return +f(r)<Date.now()}var j=tv({base:"group/calendar-cell p-small flex flex-col gap-small-1x w-full bg-layer-2-idle ",variants:{type:{month:"h-[212px]",week:"min-h-[64px] max-h-[212px]",day:"min-h-[64px] max-h-[212px]"}}});function Q({cell:r,events:t}){let{date:e,type:n}=r,{renderEvent:D,activeEventId:m,onAddEvent:c,disableEventCreationInPast:p}=b$1(),f=useMemo(()=>t.slice(0,2),[t]),E=t.length>=3,{isOver:N,setNodeRef:I}=useDroppable({id:`calendar-cell-${n}-${e.toISOString()}`,data:{date:e,type:n}}),w=useMemo(()=>{let l=t.find(o=>o.id===m);if(!l)return false;let u=o=>o.toLocaleDateString("pt-BR",{year:"numeric",month:"2-digit",day:"2-digit"}),T=u(e),k=u(l.eventDate);return T===k},[m,e,t]),P=j({type:n}),S=useMemo(()=>p&&b(e)&&!o(e),[p,e]);return jsxs("div",{className:P,"data-slot":"calendar-cell",ref:I,children:[n==="month"&&jsx("div",{className:"flex items-center justify-center",children:jsx("div",{className:cx("size-large-2x rounded-circle bg-layer-2-idle flex items-center justify-center",o(e)&&"bg-primary-idle text-neutral-label"),children:jsx(a,{size:"sm",variant:"label",weight:"medium",children:r.date.getDate()})})}),jsxs("div",{className:"gap-small-1x flex flex-col",children:[f.map(l=>jsx(Fragment,{children:D(l)},l.id)),N&&f.length<2&&!w&&jsx("div",{className:"border-border-layer-4 rounded-small-2x h-[68px] w-full border border-dashed"})]}),jsxs("div",{className:"mt-auto flex items-center justify-between",children:[E&&jsx(a$1,{events:t.slice(2)}),c&&!S&&jsx("div",{className:"invisible ml-auto transition-opacity duration-100 ease-in-out group-hover/calendar-cell:visible",children:jsx(b$2,{size:"icon_sm",variant:"outlined",onClick:()=>c(e),children:jsx(b$3,{className:"text-icon-neutral-3",name:"add"})})})]})]})}export{Q as a};//# sourceMappingURL=chunk-TTKENFBF.js.map
2
+ //# sourceMappingURL=chunk-TTKENFBF.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/date-fns/isPast.js","../src/components/full-calendar/calendar-cell.tsx"],"names":["isPast","date","toDate","calendarCellVariants","tv","CalendarCell","cell","events","type","renderEvent","activeEventId","onAddEvent","disableEventCreationInPast","useFullCalendar","eventsToShow","useMemo","hasMore","isOver","setNodeRef","useDroppable","isDraggingInCell","cellEvent","event","formatDate","cellDate","cellEventDate","calendarCellClassNames","disableEventCreation","isToday","jsxs","jsx","cx","Typography","Fragment","CalendarMoreEventsDropdown","Button","Icon"],"mappings":"+YAoBO,SAASA,CAAAA,CAAOC,CAAAA,CAAM,CAC3B,OAAO,CAACC,CAAAA,CAAOD,CAAI,CAAA,CAAI,IAAA,CAAK,KAC9B,CCJA,IAAME,CAAAA,CAAuBC,GAAG,CAC9B,IAAA,CAAM,gFAAA,CACN,QAAA,CAAU,CACR,IAAA,CAAM,CACJ,KAAA,CAAO,WAAA,CACP,KAAM,4BAAA,CACN,GAAA,CAAK,4BACP,CACF,CACF,CAAC,CAAA,CAEM,SAASC,CAAAA,CAAa,CAAE,IAAA,CAAAC,CAAAA,CAAM,MAAA,CAAAC,CAAO,EAAsB,CAChE,GAAM,CAAE,IAAA,CAAAN,EAAM,IAAA,CAAAO,CAAK,CAAA,CAAIF,CAAAA,CAEjB,CAAE,WAAA,CAAAG,CAAAA,CAAa,cAAAC,CAAAA,CAAe,UAAA,CAAAC,EAAY,0BAAA,CAAAC,CAA2B,CAAA,CACzEC,GAAAA,GACIC,CAAAA,CAAeC,OAAAA,CAAQ,IAAMR,CAAAA,CAAO,MAAM,CAAA,CAAG,CAAC,CAAA,CAAG,CAACA,CAAM,CAAC,CAAA,CACzDS,CAAAA,CAAUT,CA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MQ7YTZBI.js","sourcesContent":["import { toDate } from \"./toDate.js\";\n\n/**\n * @name isPast\n * @category Common Helpers\n * @summary Is the given date in the past?\n * @pure false\n *\n * @description\n * Is the given date in the past?\n *\n * @param date - The date to check\n *\n * @returns The date is in the past\n *\n * @example\n * // If today is 6 October 2014, is 2 July 2014 in the past?\n * const result = isPast(new Date(2014, 6, 2))\n * //=> true\n */\nexport function isPast(date) {\n return +toDate(date) < Date.now();\n}\n\n// Fallback for modularized imports:\nexport default isPast;\n","import { Fragment, useMemo } from 'react'\nimport { useDroppable } from '@dnd-kit/core'\nimport { cx, tv } from '@xjur-ui/util'\nimport { isPast } from 'date-fns'\nimport { Typography } from '../typography'\nimport { Button } from '../controls/button'\nimport { Icon } from '../icon'\nimport { isToday } from './helpers/calendar'\nimport { useFullCalendar } from './calendar-root'\nimport type { ICalendarCell } from './types/calendar-cell'\nimport type { ICalendarEvent } from './types/calendar-event'\nimport { CalendarMoreEventsDropdown } from './calendar-more-events-dropdown'\n\ninterface CalendarCellProps {\n events: ICalendarEvent[]\n cell: ICalendarCell\n}\n\nconst calendarCellVariants = tv({\n base: 'group/calendar-cell p-small flex flex-col gap-small-1x w-full bg-layer-2-idle ',\n variants: {\n type: {\n month: 'h-[212px]',\n week: 'min-h-[64px] max-h-[212px]',\n day: 'min-h-[64px] max-h-[212px]'\n }\n }\n})\n\nexport function CalendarCell({ cell, events }: CalendarCellProps) {\n const { date, type } = cell\n\n const { renderEvent, activeEventId, onAddEvent, disableEventCreationInPast } =\n useFullCalendar()\n const eventsToShow = useMemo(() => events.slice(0, 2), [events])\n const hasMore = events.length >= 3\n\n const { isOver, setNodeRef } = useDroppable({\n id: `calendar-cell-${type}-${date.toISOString()}`,\n data: {\n date,\n type\n }\n })\n\n const isDraggingInCell = useMemo(() => {\n const cellEvent = events.find(event => event.id === activeEventId)\n\n if (!cellEvent) return false\n\n const formatDate = (date: Date) => {\n return date.toLocaleDateString('pt-BR', {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit'\n })\n }\n\n const cellDate = formatDate(date)\n const cellEventDate = formatDate(cellEvent.eventDate)\n\n return cellDate === cellEventDate\n }, [activeEventId, date, events])\n\n const calendarCellClassNames = calendarCellVariants({ type })\n\n const disableEventCreation = useMemo(\n () => disableEventCreationInPast && isPast(date) && !isToday(date),\n [disableEventCreationInPast, date]\n )\n\n return (\n <div\n className={calendarCellClassNames}\n data-slot=\"calendar-cell\"\n ref={setNodeRef}\n >\n {type === 'month' && (\n <div className=\"flex items-center justify-center\">\n <div\n className={cx(\n 'size-large-2x rounded-circle bg-layer-2-idle flex items-center justify-center',\n isToday(date) && 'bg-primary-idle text-neutral-label'\n )}\n >\n <Typography size=\"sm\" variant=\"label\" weight=\"medium\">\n {cell.date.getDate()}\n </Typography>\n </div>\n </div>\n )}\n\n <div className=\"gap-small-1x flex flex-col\">\n {eventsToShow.map(event => (\n <Fragment key={event.id}>{renderEvent(event)}</Fragment>\n ))}\n\n {isOver && eventsToShow.length < 2 && !isDraggingInCell && (\n <div className=\"border-border-layer-4 rounded-small-2x h-[68px] w-full border border-dashed\" />\n )}\n </div>\n\n <div className=\"mt-auto flex items-center justify-between\">\n {hasMore && <CalendarMoreEventsDropdown events={events.slice(2)} />}\n\n {onAddEvent && !disableEventCreation && (\n <div className=\"invisible ml-auto transition-opacity duration-100 ease-in-out group-hover/calendar-cell:visible\">\n <Button\n size=\"icon_sm\"\n variant=\"outlined\"\n onClick={() => onAddEvent(date)}\n >\n <Icon className=\"text-icon-neutral-3\" name=\"add\" />\n </Button>\n </div>\n )}\n </div>\n </div>\n )\n}\n"]}
1
+ {"version":3,"sources":["../../../node_modules/date-fns/isPast.js","../src/components/full-calendar/calendar-cell.tsx"],"names":["isPast","date","toDate","calendarCellVariants","tv","CalendarCell","cell","events","type","renderEvent","activeEventId","onAddEvent","disableEventCreationInPast","useFullCalendar","eventsToShow","useMemo","hasMore","isOver","setNodeRef","useDroppable","isDraggingInCell","cellEvent","event","formatDate","cellDate","cellEventDate","calendarCellClassNames","disableEventCreation","isToday","jsxs","jsx","cx","Typography","Fragment","CalendarMoreEventsDropdown","Button","Icon"],"mappings":"+YAoBO,SAASA,CAAAA,CAAOC,CAAAA,CAAM,CAC3B,OAAO,CAACC,CAAAA,CAAOD,CAAI,CAAA,CAAI,IAAA,CAAK,KAC9B,CCJA,IAAME,CAAAA,CAAuBC,GAAG,CAC9B,IAAA,CAAM,gFAAA,CACN,QAAA,CAAU,CACR,IAAA,CAAM,CACJ,KAAA,CAAO,WAAA,CACP,KAAM,4BAAA,CACN,GAAA,CAAK,4BACP,CACF,CACF,CAAC,CAAA,CAEM,SAASC,CAAAA,CAAa,CAAE,IAAA,CAAAC,CAAAA,CAAM,MAAA,CAAAC,CAAO,EAAsB,CAChE,GAAM,CAAE,IAAA,CAAAN,EAAM,IAAA,CAAAO,CAAK,CAAA,CAAIF,CAAAA,CAEjB,CAAE,WAAA,CAAAG,CAAAA,CAAa,cAAAC,CAAAA,CAAe,UAAA,CAAAC,EAAY,0BAAA,CAAAC,CAA2B,CAAA,CACzEC,GAAAA,GACIC,CAAAA,CAAeC,OAAAA,CAAQ,IAAMR,CAAAA,CAAO,MAAM,CAAA,CAAG,CAAC,CAAA,CAAG,CAACA,CAAM,CAAC,CAAA,CACzDS,CAAAA,CAAUT,CAAAA,CAAO,QAAU,CAAA,CAE3B,CAAE,MAAA,CAAAU,CAAAA,CAAQ,WAAAC,CAAW,CAAA,CAAIC,YAAAA,CAAa,CAC1C,GAAI,CAAA,cAAA,EAAiBX,CAAI,CAAA,CAAA,EAAIP,CAAAA,CAAK,aAAa,CAAA,CAAA,CAC/C,IAAA,CAAM,CACJ,KAAAA,CAAAA,CACA,IAAA,CAAAO,CACF,CACF,CAAC,CAAA,CAEKY,CAAAA,CAAmBL,OAAAA,CAAQ,IAAM,CACrC,IAAMM,CAAAA,CAAYd,CAAAA,CAAO,IAAA,CAAKe,GAASA,CAAAA,CAAM,EAAA,GAAOZ,CAAa,CAAA,CAEjE,GA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AChBQ,GAAAA,CAACG,QAAAA,CAAA,CAAyB,QAAA,CAAAxB,CAAAA,CAAYa,CAAK,CAAA,CAAA,CAA5BA,EAAM,EAAwB,CAC9C,CAAA,CAEAL,CAAAA,EAAUH,EAAa,MAAA,CAAS,CAAA,EAAK,CAACM,CAAAA,EACrCU,IAAC,KAAA,CAAA,CAAI,SAAA,CAAU,6EAAA,CAA8E,CAAA,CAAA,CAEjG,EAEAD,IAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,2CAAA,CACZ,QAAA,CAAA,CAAAb,GAAWc,GAAAA,CAACI,GAAAA,CAAA,CAA2B,MAAA,CAAQ3B,EAAO,KAAA,CAAM,CAAC,CAAA,CAAG,CAAA,CAEhEI,GAAc,CAACgB,CAAAA,EACdG,GAAAA,CAAC,KAAA,CAAA,CAAI,UAAU,iGAAA,CACb,QAAA,CAAAA,GAAAA,CAACK,GAAAA,CAAA,CACC,IAAA,CAAK,SAAA,CACL,OAAA,CAAQ,UAAA,CACR,QAAS,IAAMxB,CAAAA,CAAWV,CAAI,CAAA,CAE9B,SAAA6B,GAAAA,CAACM,GAAAA,CAAA,CAAK,SAAA,CAAU,sBAAsB,IAAA,CAAK,KAAA,CAAM,EACnD,CAAA,CACF,CAAA,CAAA,CAEJ,GACF,CAEJ","file":"chunk-TTKENFBF.js","sourcesContent":["import { toDate } from \"./toDate.js\";\n\n/**\n * @name isPast\n * @category Common Helpers\n * @summary Is the given date in the past?\n * @pure false\n *\n * @description\n * Is the given date in the past?\n *\n * @param date - The date to check\n *\n * @returns The date is in the past\n *\n * @example\n * // If today is 6 October 2014, is 2 July 2014 in the past?\n * const result = isPast(new Date(2014, 6, 2))\n * //=> true\n */\nexport function isPast(date) {\n return +toDate(date) < Date.now();\n}\n\n// Fallback for modularized imports:\nexport default isPast;\n","import { Fragment, useMemo } from 'react'\nimport { useDroppable } from '@dnd-kit/core'\nimport { cx, tv } from '@xjur-ui/util'\nimport { isPast } from 'date-fns'\nimport { Typography } from '../typography'\nimport { Button } from '../controls/button'\nimport { Icon } from '../icon'\nimport { isToday } from './helpers/calendar'\nimport { useFullCalendar } from './calendar-root'\nimport type { ICalendarCell } from './types/calendar-cell'\nimport type { ICalendarEvent } from './types/calendar-event'\nimport { CalendarMoreEventsDropdown } from './calendar-more-events-dropdown'\n\ninterface CalendarCellProps {\n events: ICalendarEvent[]\n cell: ICalendarCell\n}\n\nconst calendarCellVariants = tv({\n base: 'group/calendar-cell p-small flex flex-col gap-small-1x w-full bg-layer-2-idle ',\n variants: {\n type: {\n month: 'h-[212px]',\n week: 'min-h-[64px] max-h-[212px]',\n day: 'min-h-[64px] max-h-[212px]'\n }\n }\n})\n\nexport function CalendarCell({ cell, events }: CalendarCellProps) {\n const { date, type } = cell\n\n const { renderEvent, activeEventId, onAddEvent, disableEventCreationInPast } =\n useFullCalendar()\n const eventsToShow = useMemo(() => events.slice(0, 2), [events])\n const hasMore = events.length >= 3\n\n const { isOver, setNodeRef } = useDroppable({\n id: `calendar-cell-${type}-${date.toISOString()}`,\n data: {\n date,\n type\n }\n })\n\n const isDraggingInCell = useMemo(() => {\n const cellEvent = events.find(event => event.id === activeEventId)\n\n if (!cellEvent) return false\n\n const formatDate = (date: Date) => {\n return date.toLocaleDateString('pt-BR', {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit'\n })\n }\n\n const cellDate = formatDate(date)\n const cellEventDate = formatDate(cellEvent.eventDate)\n\n return cellDate === cellEventDate\n }, [activeEventId, date, events])\n\n const calendarCellClassNames = calendarCellVariants({ type })\n\n const disableEventCreation = useMemo(\n () => disableEventCreationInPast && isPast(date) && !isToday(date),\n [disableEventCreationInPast, date]\n )\n\n return (\n <div\n className={calendarCellClassNames}\n data-slot=\"calendar-cell\"\n ref={setNodeRef}\n >\n {type === 'month' && (\n <div className=\"flex items-center justify-center\">\n <div\n className={cx(\n 'size-large-2x rounded-circle bg-layer-2-idle flex items-center justify-center',\n isToday(date) && 'bg-primary-idle text-neutral-label'\n )}\n >\n <Typography size=\"sm\" variant=\"label\" weight=\"medium\">\n {cell.date.getDate()}\n </Typography>\n </div>\n </div>\n )}\n\n <div className=\"gap-small-1x flex flex-col\">\n {eventsToShow.map(event => (\n <Fragment key={event.id}>{renderEvent(event)}</Fragment>\n ))}\n\n {isOver && eventsToShow.length < 2 && !isDraggingInCell && (\n <div className=\"border-border-layer-4 rounded-small-2x h-[68px] w-full border border-dashed\" />\n )}\n </div>\n\n <div className=\"mt-auto flex items-center justify-between\">\n {hasMore && <CalendarMoreEventsDropdown events={events.slice(2)} />}\n\n {onAddEvent && !disableEventCreation && (\n <div className=\"invisible ml-auto transition-opacity duration-100 ease-in-out group-hover/calendar-cell:visible\">\n <Button\n size=\"icon_sm\"\n variant=\"outlined\"\n onClick={() => onAddEvent(date)}\n >\n <Icon className=\"text-icon-neutral-3\" name=\"add\" />\n </Button>\n </div>\n )}\n </div>\n </div>\n )\n}\n"]}
@@ -0,0 +1,54 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ interface AccordionRootProps {
5
+ variant?: 'default' | 'tabheader';
6
+ className?: string;
7
+ type?: 'single' | 'multiple';
8
+ collapsible?: boolean;
9
+ defaultValue?: string | string[];
10
+ value?: string | string[];
11
+ onValueChange?: (value: string | string[]) => void;
12
+ children?: React.ReactNode;
13
+ }
14
+ declare function AccordionRoot({ variant, className, type, ...props }: AccordionRootProps): react_jsx_runtime.JSX.Element;
15
+ interface AccordionItemProps {
16
+ variant?: 'default' | 'tabheader';
17
+ className?: string;
18
+ value: string;
19
+ children?: React.ReactNode;
20
+ }
21
+ declare function AccordionItem({ variant, className, ...props }: AccordionItemProps): react_jsx_runtime.JSX.Element;
22
+ interface AccordionTriggerProps {
23
+ variant?: 'default' | 'tabheader';
24
+ showIcon?: boolean;
25
+ iconPosition?: 'left' | 'right';
26
+ iconName?: 'keyboard_arrow_down' | 'chevron_right' | 'add' | 'remove';
27
+ className?: string;
28
+ children?: React.ReactNode;
29
+ }
30
+ declare function AccordionTrigger({ variant, showIcon, iconPosition, iconName, className, children, ...props }: AccordionTriggerProps): react_jsx_runtime.JSX.Element;
31
+ interface AccordionContentProps {
32
+ variant?: 'default' | 'tabheader';
33
+ className?: string;
34
+ children?: React.ReactNode;
35
+ }
36
+ declare function AccordionContent({ variant, className, children, ...props }: AccordionContentProps): react_jsx_runtime.JSX.Element;
37
+ interface AccordionTabHeaderProps {
38
+ items: Array<{
39
+ value: string;
40
+ title: string;
41
+ content: React.ReactNode;
42
+ iconVariant?: 'chevron' | 'triangle' | 'plus';
43
+ iconColor?: 'gray' | 'orange';
44
+ iconDirection?: 'right' | 'down';
45
+ }>;
46
+ variant?: 'default' | 'tabheader';
47
+ type?: 'single' | 'multiple';
48
+ defaultValue?: string | string[];
49
+ value?: string | string[];
50
+ onValueChange?: (value: string | string[]) => void;
51
+ }
52
+ declare function AccordionTabHeader({ items, variant, type, defaultValue, value, onValueChange: handleValueChange, ...props }: AccordionTabHeaderProps): react_jsx_runtime.JSX.Element;
53
+
54
+ export { AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, AccordionRoot, type AccordionRootProps, AccordionTabHeader, type AccordionTabHeaderProps, AccordionTrigger, type AccordionTriggerProps };
@@ -0,0 +1,2 @@
1
+ import {b}from'../chunk-DVDHTP4C.js';import'react';import*as c from'@radix-ui/react-accordion';import {cx}from'@xjur-ui/util';import {jsx,jsxs}from'react/jsx-runtime';var p=(r="default")=>{let e={root:"w-full",item:"border-b border-neutral-border last:border-b-0",trigger:"flex flex-1 items-center justify-between py-medium px-0 font-medium transition-all hover:no-underline [&[data-state=open]>svg]:rotate-180",content:"overflow-hidden text-sm transition-all data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",contentInner:"pb-medium pt-0"};return r==="tabheader"?{...e,trigger:e.trigger+" bg-layer-2-idle text-neutral-dark rounded-small-1x px-medium py-small hover:bg-layer-2-hover data-[state=open]:bg-layer-2-active"}:{...e,trigger:e.trigger+" text-neutral-dark hover:text-primary-active"}};function A({variant:r="default",className:e,type:a="single",...n}){let i=p(r);if(a==="multiple"){let{value:t,defaultValue:g,onValueChange:f,...b}=n;return jsx(c.Root,{className:cx(i.root,e),defaultValue:g,type:"multiple",value:t,...b,onValueChange:f})}let{value:s,defaultValue:d,onValueChange:u,...l}=n;return jsx(c.Root,{className:cx(i.root,e),defaultValue:d,type:"single",value:s,...l,onValueChange:u})}function y({variant:r="default",className:e,...a}){let n=p(r);return jsx(c.Item,{className:cx(n.item,e),...a})}function x({variant:r="default",showIcon:e=true,iconPosition:a="right",iconName:n="keyboard_arrow_down",className:i,children:s,...d}){let u=p(r),l=e?jsx(b,{className:"h-4 w-4 shrink-0 transition-transform duration-200",name:n}):null;return jsxs(c.Trigger,{className:cx(u.trigger,i),...d,children:[a==="left"&&l,jsx("span",{className:"flex-1 text-left",children:s}),a==="right"&&l]})}function w({variant:r="default",className:e,children:a,...n}){let i=p(r);return jsx(c.Content,{className:cx(i.content,e),...n,children:jsx("div",{className:i.contentInner,children:a})})}function V({items:r,variant:e="tabheader",type:a="single",defaultValue:n,value:i,onValueChange:s,...d}){let u=(t,g)=>{switch(t){case "chevron":return g==="right"?"chevron_right":"keyboard_arrow_down";case "triangle":return g==="right"?"chevron_right":"keyboard_arrow_down";case "plus":return g==="right"?"add":"remove";default:return "keyboard_arrow_down"}},l=t=>{switch(t){case "gray":return "text-neutral-medium";case "orange":return "text-orange-500";default:return "text-neutral-dark"}};return jsx(A,{defaultValue:n,type:a,value:i,variant:e,...d,onValueChange:s,children:r.map(t=>jsxs(y,{value:t.value,variant:e,children:[jsx(x,{className:l(t.iconColor||"gray"),iconName:u(t.iconVariant||"chevron",t.iconDirection||"down"),variant:e,children:t.title}),jsx(w,{variant:e,children:t.content})]},t.value))})}export{w as AccordionContent,y as AccordionItem,A as AccordionRoot,V as AccordionTabHeader,x as AccordionTrigger};//# sourceMappingURL=accordion.js.map
2
+ //# sourceMappingURL=accordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/accordion.tsx"],"names":["getAccordionStyles","variant","baseStyles","AccordionRoot","className","type","props","styles","value","defaultValue","handleValueChange","restProps","jsx","cx","AccordionItem","AccordionTrigger","showIcon","iconPosition","iconName","children","iconElement","Icon","jsxs","AccordionContent","AccordionTabHeader","items","getIconName","iconVariant","iconDirection","getIconColor","iconColor","item"],"mappings":"uKAKA,IAAMA,EAAqB,CAACC,CAAAA,CAAmC,YAAc,CAC3E,IAAMC,CAAAA,CAAa,CACjB,IAAA,CAAM,QAAA,CACN,KAAM,gDAAA,CACN,OAAA,CACE,4IACF,OAAA,CACE,8HAAA,CACF,aAAc,gBAChB,CAAA,CAEA,OAAID,CAAAA,GAAY,WAAA,CACP,CACL,GAAGC,CAAAA,CACH,OAAA,CACEA,CAAAA,CAAW,OAAA,CACX,mIACJ,CAAA,CAGK,CACL,GAAGA,CAAAA,CACH,OAAA,CAASA,CAAAA,CAAW,OAAA,CAAU,8CAChC,CACF,CAAA,CAaO,SAASC,EAAc,CAC5B,OAAA,CAAAF,EAAU,SAAA,CACV,SAAA,CAAAG,CAAAA,CACA,IAAA,CAAAC,CAAAA,CAAO,QAAA,CACP,GAAGC,CACL,CAAA,CAAuB,CACrB,IAAMC,CAAAA,CAASP,CAAAA,CAAmBC,CAAO,CAAA,CAEzC,GAAII,CAAAA,GAAS,UAAA,CAAY,CACvB,GAAM,CACJ,KAAA,CAAAG,CAAAA,CACA,aAAAC,CAAAA,CACA,aAAA,CAAeC,EACf,GAAGC,CACL,CAAA,CAAIL,CAAAA,CACJ,OACEM,GAAAA,CAAoB,OAAnB,CACC,SAAA,CAAWC,EAAAA,CAAGN,CAAAA,CAAO,IAAA,CAAMH,CAAS,EACpC,YAAA,CAAcK,CAAAA,CACd,IAAA,CAAK,UAAA,CACL,KAAA,CAAOD,CAAAA,CACN,GAAGG,CAAAA,CACJ,aAAA,CAAeD,EACjB,CAEJ,CAEA,GAAM,CACJ,KAAA,CAAAF,CAAAA,CACA,YA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,OACElB,GAAAA,CAACT,CAAAA,CAAA,CACC,YAAA,CAAcM,CAAAA,CACd,IAAA,CAAMJ,EACN,KAAA,CAAOG,CAAAA,CACP,OAAA,CAASP,CAAAA,CACR,GAAGK,CAAAA,CACJ,cAAeI,CAAAA,CAEd,QAAA,CAAAe,EAAM,GAAA,CAAIM,CAAAA,EACTT,KAACR,CAAAA,CAAA,CAA+B,KAAA,CAAOiB,CAAAA,CAAK,KAAA,CAAO,OAAA,CAAS9B,EAC1D,QAAA,CAAA,CAAAW,GAAAA,CAACG,CAAAA,CAAA,CACC,SAAA,CAAWc,CAAAA,CAAaE,EAAK,SAAA,EAAa,MAAM,CAAA,CAChD,QAAA,CAAUL,CAAAA,CACRK,CAAAA,CAAK,aAAe,SAAA,CACpBA,CAAAA,CAAK,eAAiB,MACxB,CAAA,CACA,QAAS9B,CAAAA,CAER,QAAA,CAAA8B,CAAAA,CAAK,KAAA,CACR,CAAA,CACAnB,GAAAA,CAACW,EAAA,CAAiB,OAAA,CAAStB,CAAAA,CAAU,QAAA,CAAA8B,CAAAA,CAAK,OAAA,CAAQ,IAXhCA,CAAAA,CAAK,KAYzB,CACD,CAAA,CACH,CAEJ","file":"accordion.js","sourcesContent":["import * as React from 'react'\nimport * as AccordionPrimitive from '@radix-ui/react-accordion'\nimport { cx } from '@xjur-ui/util'\nimport { Icon } from './icon'\n\nconst getAccordionStyles = (variant: 'default' | 'tabheader' = 'default') => {\n const baseStyles = {\n root: 'w-full',\n item: 'border-b border-neutral-border last:border-b-0',\n trigger:\n 'flex flex-1 items-center justify-between py-medium px-0 font-medium transition-all hover:no-underline [&[data-state=open]>svg]:rotate-180',\n content:\n 'overflow-hidden text-sm transition-all data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down',\n contentInner: 'pb-medium pt-0'\n }\n\n if (variant === 'tabheader') {\n return {\n ...baseStyles,\n trigger:\n baseStyles.trigger +\n ' bg-layer-2-idle text-neutral-dark rounded-small-1x px-medium py-small hover:bg-layer-2-hover data-[state=open]:bg-layer-2-active'\n }\n }\n\n return {\n ...baseStyles,\n trigger: baseStyles.trigger + ' text-neutral-dark hover:text-primary-active'\n }\n}\n\nexport interface AccordionRootProps {\n variant?: 'default' | 'tabheader'\n className?: string\n type?: 'single' | 'multiple'\n collapsible?: boolean\n defaultValue?: string | string[]\n value?: string | string[]\n onValueChange?: (value: string | string[]) => void\n children?: React.ReactNode\n}\n\nexport function AccordionRoot({\n variant = 'default',\n className,\n type = 'single',\n ...props\n}: AccordionRootProps) {\n const styles = getAccordionStyles(variant)\n\n if (type === 'multiple') {\n const {\n value,\n defaultValue,\n onValueChange: handleValueChange,\n ...restProps\n } = props\n return (\n <AccordionPrimitive.Root\n className={cx(styles.root, className)}\n defaultValue={defaultValue as string[]}\n type=\"multiple\"\n value={value as string[]}\n {...restProps}\n onValueChange={handleValueChange}\n />\n )\n }\n\n const {\n value,\n defaultValue,\n onValueChange: handleValueChange,\n ...restProps\n } = props\n return (\n <AccordionPrimitive.Root\n className={cx(styles.root, className)}\n defaultValue={defaultValue as string}\n type=\"single\"\n value={value as string}\n {...restProps}\n onValueChange={handleValueChange}\n />\n )\n}\n\nexport interface AccordionItemProps {\n variant?: 'default' | 'tabheader'\n className?: string\n value: string\n children?: React.ReactNode\n}\n\nexport function AccordionItem({\n variant = 'default',\n className,\n ...props\n}: AccordionItemProps) {\n const styles = getAccordionStyles(variant)\n return (\n <AccordionPrimitive.Item\n className={cx(styles.item, className)}\n {...props}\n />\n )\n}\n\nexport interface AccordionTriggerProps {\n variant?: 'default' | 'tabheader'\n showIcon?: boolean\n iconPosition?: 'left' | 'right'\n iconName?: 'keyboard_arrow_down' | 'chevron_right' | 'add' | 'remove'\n className?: string\n children?: React.ReactNode\n}\n\nexport function AccordionTrigger({\n variant = 'default',\n showIcon = true,\n iconPosition = 'right',\n iconName = 'keyboard_arrow_down',\n className,\n children,\n ...props\n}: AccordionTriggerProps) {\n const styles = getAccordionStyles(variant)\n\n const iconElement = showIcon ? (\n <Icon\n className=\"h-4 w-4 shrink-0 transition-transform duration-200\"\n name={iconName}\n />\n ) : null\n\n return (\n <AccordionPrimitive.Trigger\n className={cx(styles.trigger, className)}\n {...props}\n >\n {iconPosition === 'left' && iconElement}\n <span className=\"flex-1 text-left\">{children}</span>\n {iconPosition === 'right' && iconElement}\n </AccordionPrimitive.Trigger>\n )\n}\n\nexport interface AccordionContentProps {\n variant?: 'default' | 'tabheader'\n className?: string\n children?: React.ReactNode\n}\n\nexport function AccordionContent({\n variant = 'default',\n className,\n children,\n ...props\n}: AccordionContentProps) {\n const styles = getAccordionStyles(variant)\n return (\n <AccordionPrimitive.Content\n className={cx(styles.content, className)}\n {...props}\n >\n <div className={styles.contentInner}>{children}</div>\n </AccordionPrimitive.Content>\n )\n}\n\nexport interface AccordionTabHeaderProps {\n items: Array<{\n value: string\n title: string\n content: React.ReactNode\n iconVariant?: 'chevron' | 'triangle' | 'plus'\n iconColor?: 'gray' | 'orange'\n iconDirection?: 'right' | 'down'\n }>\n variant?: 'default' | 'tabheader'\n type?: 'single' | 'multiple'\n defaultValue?: string | string[]\n value?: string | string[]\n onValueChange?: (value: string | string[]) => void\n}\n\nexport function AccordionTabHeader({\n items,\n variant = 'tabheader',\n type = 'single',\n defaultValue,\n value,\n onValueChange: handleValueChange,\n ...props\n}: AccordionTabHeaderProps) {\n const getIconName = (iconVariant: string, iconDirection: string) => {\n switch (iconVariant) {\n case 'chevron':\n return iconDirection === 'right'\n ? 'chevron_right'\n : 'keyboard_arrow_down'\n case 'triangle':\n return iconDirection === 'right'\n ? 'chevron_right'\n : 'keyboard_arrow_down'\n case 'plus':\n return iconDirection === 'right' ? 'add' : 'remove'\n default:\n return 'keyboard_arrow_down'\n }\n }\n\n const getIconColor = (iconColor: string) => {\n switch (iconColor) {\n case 'gray':\n return 'text-neutral-medium'\n case 'orange':\n return 'text-orange-500'\n default:\n return 'text-neutral-dark'\n }\n }\n\n return (\n <AccordionRoot\n defaultValue={defaultValue}\n type={type}\n value={value}\n variant={variant}\n {...props}\n onValueChange={handleValueChange}\n >\n {items.map(item => (\n <AccordionItem key={item.value} value={item.value} variant={variant}>\n <AccordionTrigger\n className={getIconColor(item.iconColor || 'gray')}\n iconName={getIconName(\n item.iconVariant || 'chevron',\n item.iconDirection || 'down'\n )}\n variant={variant}\n >\n {item.title}\n </AccordionTrigger>\n <AccordionContent variant={variant}>{item.content}</AccordionContent>\n </AccordionItem>\n ))}\n </AccordionRoot>\n )\n}\n"]}
@@ -3,7 +3,7 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
3
3
  import { ClassVariantProps } from '@xjur-ui/util';
4
4
 
5
5
  declare const badgeVariants: (props?: ({
6
- variant?: "primary" | "secondary" | "neutral" | "success" | "warning" | "danger" | null | undefined;
6
+ variant?: "warning" | "primary" | "secondary" | "neutral" | "success" | "danger" | null | undefined;
7
7
  } & class_variance_authority_types.ClassProp) | undefined) => string;
8
8
  declare function Badge({ variant, children, className }: ClassVariantProps<typeof badgeVariants> & {
9
9
  children: string;
@@ -0,0 +1,137 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as tailwind_variants from 'tailwind-variants';
3
+ import { ComponentProps } from 'react';
4
+ import { FloatingLabel } from './floating-label.js';
5
+
6
+ declare const rating: tailwind_variants.TVReturnType<{
7
+ state: {
8
+ normal: {
9
+ star: string;
10
+ };
11
+ error: {
12
+ star: string;
13
+ caption: string;
14
+ };
15
+ disabled: {
16
+ star: string;
17
+ };
18
+ };
19
+ size: {
20
+ sm: {
21
+ star: string;
22
+ };
23
+ md: {
24
+ star: string;
25
+ };
26
+ lg: {
27
+ star: string;
28
+ };
29
+ };
30
+ }, {
31
+ wrapper: string;
32
+ root: string;
33
+ star: string;
34
+ caption: string;
35
+ }, undefined, {
36
+ state: {
37
+ normal: {
38
+ star: string;
39
+ };
40
+ error: {
41
+ star: string;
42
+ caption: string;
43
+ };
44
+ disabled: {
45
+ star: string;
46
+ };
47
+ };
48
+ size: {
49
+ sm: {
50
+ star: string;
51
+ };
52
+ md: {
53
+ star: string;
54
+ };
55
+ lg: {
56
+ star: string;
57
+ };
58
+ };
59
+ }, {
60
+ wrapper: string;
61
+ root: string;
62
+ star: string;
63
+ caption: string;
64
+ }, tailwind_variants.TVReturnType<{
65
+ state: {
66
+ normal: {
67
+ star: string;
68
+ };
69
+ error: {
70
+ star: string;
71
+ caption: string;
72
+ };
73
+ disabled: {
74
+ star: string;
75
+ };
76
+ };
77
+ size: {
78
+ sm: {
79
+ star: string;
80
+ };
81
+ md: {
82
+ star: string;
83
+ };
84
+ lg: {
85
+ star: string;
86
+ };
87
+ };
88
+ }, {
89
+ wrapper: string;
90
+ root: string;
91
+ star: string;
92
+ caption: string;
93
+ }, undefined, unknown, unknown, undefined>>;
94
+ interface RatingRootProps {
95
+ value?: number;
96
+ defaultValue?: number;
97
+ onValueChange?: (value: number) => void;
98
+ max?: number;
99
+ state?: 'normal' | 'error' | 'disabled';
100
+ size?: 'sm' | 'md' | 'lg';
101
+ disabled?: boolean;
102
+ className?: string;
103
+ id?: string;
104
+ children: React.ReactNode;
105
+ }
106
+ declare function RatingRoot({ value: controlledValue, defaultValue, onValueChange: handleValueChange, max, state, size, disabled, className, id, children, ...props }: RatingRootProps): react_jsx_runtime.JSX.Element;
107
+ interface RatingTrackProps {
108
+ className?: string;
109
+ }
110
+ declare function RatingTrack({ className }: RatingTrackProps): react_jsx_runtime.JSX.Element;
111
+ interface RatingStarProps {
112
+ value: number;
113
+ className?: string;
114
+ }
115
+ declare function RatingStar({ value, className }: RatingStarProps): react_jsx_runtime.JSX.Element;
116
+ type RatingLabelProps = ComponentProps<typeof FloatingLabel>;
117
+ declare function RatingLabel(props: RatingLabelProps): react_jsx_runtime.JSX.Element;
118
+ interface RatingCaptionProps extends ComponentProps<'p'> {
119
+ className?: string;
120
+ }
121
+ declare function RatingCaption({ className, ...props }: RatingCaptionProps): react_jsx_runtime.JSX.Element;
122
+ interface RatingProps {
123
+ value?: number;
124
+ defaultValue?: number;
125
+ onValueChange?: (value: number) => void;
126
+ max?: number;
127
+ state?: 'normal' | 'error' | 'disabled';
128
+ size?: 'sm' | 'md' | 'lg';
129
+ label?: string;
130
+ caption?: string;
131
+ className?: string;
132
+ disabled?: boolean;
133
+ id?: string;
134
+ }
135
+ declare function Rating({ value, defaultValue, onValueChange: handleValueChange, max, state, size, label, caption, className, disabled, id, ...props }: RatingProps): react_jsx_runtime.JSX.Element;
136
+
137
+ export { Rating, RatingCaption, type RatingCaptionProps, RatingLabel, type RatingLabelProps, type RatingProps, RatingRoot, type RatingRootProps, RatingStar, type RatingStarProps, RatingTrack, type RatingTrackProps, rating };
@@ -0,0 +1,2 @@
1
+ import {a as a$1}from'../../chunk-JGPHBUVM.js';import {b,a}from'../../chunk-2JQVYVAT.js';import {b as b$1}from'../../chunk-DVDHTP4C.js';import {tv}from'@xjur-ui/util';import {createContext,useState,useContext}from'react';import {jsx,jsxs}from'react/jsx-runtime';var F=tv({slots:{wrapper:"group flex w-full flex-col gap-small-2x",root:"relative flex w-full items-center gap-small-1x",star:"cursor-pointer transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-orange-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",caption:"!text-size-body-sm font-normal"},variants:{state:{normal:{star:"text-neutral-border hover:text-orange-400 focus-visible:ring-orange-500"},error:{star:"text-danger-idle hover:text-danger-idle focus-visible:ring-danger-idle",caption:"text-danger-label-idle"},disabled:{star:"text-neutral-border opacity-50"}},size:{sm:{star:"text-size-body-sm"},md:{star:"text-size-body-lg"},lg:{star:"text-size-heading-sm"}}}}),{wrapper:L,root:k,star:T,caption:$}=F(),P=createContext(null);function c(){let e=useContext(P);if(!e)throw new Error("Rating components must be used within a RatingRoot");return e}function A({value:e,defaultValue:a$1=0,onValueChange:n,max:i=5,state:s="normal",size:o="md",disabled:r=false,className:l,id:d,children:u,...g}){let[m,p]=useState(a$1),h=e??m,V=f=>{e===void 0&&p(f),n?.(f);},y=b(),b$1=r?"disabled":y?.state??s;return jsx(a.Provider,{value:{state:b$1},children:jsx(P.Provider,{value:{value:h,max:i,onValueChange:V,state:b$1,size:o,disabled:r},children:jsx("div",{className:L({className:l}),id:d,...g,children:u})})})}function E({className:e}){let{max:a,state:n,size:i}=c();return jsx("div",{className:k({state:n,size:i,className:e}),children:Array.from({length:a},(s,o)=>jsx(I,{value:o+1},o))})}function I({value:e,className:a}){let{value:n,onValueChange:i,state:s,size:o,disabled:r}=c(),l=e<=n;return jsx("button",{"aria-label":`Rate ${e} star${e>1?"s":""}`,className:T({state:s,size:o,className:a}),disabled:r,type:"button",onClick:()=>!r&&i(e),children:jsx(b$1,{filled:l,name:"star"})})}function U(e){return jsx(a$1,{...e})}function _({className:e,...a}){let{state:n}=c();return jsx("p",{className:$({state:n,className:e}),...a})}function K({value:e,defaultValue:a=0,onValueChange:n,max:i=5,state:s="normal",size:o="md",label:r,caption:l,className:d,disabled:u,id:g,...m}){return jsxs(A,{className:d,defaultValue:a,disabled:u,id:g,max:i,size:o,state:u?"disabled":s,value:e,onValueChange:n,...m,children:[r&&jsx(U,{children:r}),jsx(E,{}),l&&jsx(_,{children:l})]})}export{K as Rating,_ as RatingCaption,U as RatingLabel,A as RatingRoot,I as RatingStar,E as RatingTrack,F as rating};//# sourceMappingURL=rating.js.map
2
+ //# sourceMappingURL=rating.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/controls/rating.tsx"],"names":["rating","tv","wrapper","root","star","caption","RatingContext","createContext","useRatingContext","context","useContext","RatingRoot","controlledValue","defaultValue","handleValueChange","max","state","size","disabled","className","id","children","props","uncontrolledValue","setUncontrolledValue","useState","value","onValueChange","newValue","fieldState","useFieldContext","ratingState","jsx","FieldContext","RatingTrack","_","index","RatingStar","currentValue","isFilled","Icon","RatingLabel","FloatingLabel","RatingCaption","Rating","label","jsxs"],"mappings":"sQAOO,IAAMA,CAAAA,CAASC,EAAAA,CAAG,CACvB,KAAA,CAAO,CACL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AC,GAAA,CAAA,CAAE,SAAA,CAAW3B,CAAAA,CAAQ,CAAE,MAAAW,CAAAA,CAAO,SAAA,CAAAG,CAAU,CAAC,CAAA,CAAI,GAAGG,CAAAA,CAAO,CACjE,CAgBO,SAASsB,CAAAA,CAAO,CACrB,KAAA,CAAAlB,CAAAA,CACA,aAAAb,CAAAA,CAAe,CAAA,CACf,aAAA,CAAeC,CAAAA,CACf,GAAA,CAAAC,CAAAA,CAAM,CAAA,CACN,KAAA,CAAAC,CAAAA,CAAQ,QAAA,CACR,IAAA,CAAAC,CAAAA,CAAO,IAAA,CACP,KAAA,CAAA4B,EACA,OAAA,CAAAxC,CAAAA,CACA,SAAA,CAAAc,CAAAA,CACA,QAAA,CAAAD,CAAAA,CACA,EAAA,CAAAE,CAAAA,CACA,GAAGE,CACL,CAAA,CAAgB,CAGd,OACEwB,IAAAA,CAACnC,EAAA,CACC,SAAA,CAAWQ,CAAAA,CACX,YAAA,CAAcN,CAAAA,CACd,QAAA,CAAUK,CAAAA,CACV,EAAA,CAAIE,CAAAA,CACJ,GAAA,CAAKL,CAAAA,CACL,IAAA,CAAME,CAAAA,CACN,KAAA,CAVgBC,EAAW,UAAA,CAAaF,CAAAA,CAWxC,KAAA,CAAOU,CAAAA,CACP,aAAA,CAAeZ,CAAAA,CACd,GAAGQ,CAAAA,CAEH,QAAA,CAAA,CAAAuB,CAAAA,EAASb,GAAAA,CAACS,CAAAA,CAAA,CAAa,QAAA,CAAAI,EAAM,CAAA,CAC9Bb,GAAAA,CAACE,CAAAA,CAAA,EAAY,CAAA,CACZ7B,CAAAA,EAAW2B,GAAAA,CAACW,CAAAA,CAAA,CAAe,QAAA,CAAAtC,CAAAA,CAAQ,CAAA,CAAA,CACtC,CAEJ","file":"rating.js","sourcesContent":["import { tv } from '@xjur-ui/util'\nimport type { ComponentProps } from 'react'\nimport { createContext, useContext, useState } from 'react'\nimport { Icon } from '../icon'\nimport { FieldContext, useFieldContext } from './context/field.context'\nimport { FloatingLabel } from './floating-label'\n\nexport const rating = tv({\n slots: {\n wrapper: 'group flex w-full flex-col gap-small-2x',\n root: 'relative flex w-full items-center gap-small-1x',\n star: 'cursor-pointer transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-orange-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n caption: '!text-size-body-sm font-normal'\n },\n variants: {\n state: {\n normal: {\n star: 'text-neutral-border hover:text-orange-400 focus-visible:ring-orange-500'\n },\n error: {\n star: 'text-danger-idle hover:text-danger-idle focus-visible:ring-danger-idle',\n caption: 'text-danger-label-idle'\n },\n disabled: {\n star: 'text-neutral-border opacity-50'\n }\n },\n size: {\n sm: {\n star: 'text-size-body-sm'\n },\n md: {\n star: 'text-size-body-lg'\n },\n lg: {\n star: 'text-size-heading-sm'\n }\n }\n }\n})\n\nconst { wrapper, root, star, caption } = rating()\n\ninterface RatingContextValue {\n value: number\n max: number\n onValueChange: (value: number) => void\n state: 'normal' | 'error' | 'disabled'\n size: 'sm' | 'md' | 'lg'\n disabled: boolean\n}\n\nconst RatingContext = createContext<RatingContextValue | null>(null)\n\nfunction useRatingContext() {\n const context = useContext(RatingContext)\n if (!context) {\n throw new Error('Rating components must be used within a RatingRoot')\n }\n return context\n}\n\nexport interface RatingRootProps {\n value?: number\n defaultValue?: number\n onValueChange?: (value: number) => void\n max?: number\n state?: 'normal' | 'error' | 'disabled'\n size?: 'sm' | 'md' | 'lg'\n disabled?: boolean\n className?: string\n id?: string\n children: React.ReactNode\n}\n\nexport function RatingRoot({\n value: controlledValue,\n defaultValue = 0,\n onValueChange: handleValueChange,\n max = 5,\n state = 'normal',\n size = 'md',\n disabled = false,\n className,\n id,\n children,\n ...props\n}: RatingRootProps) {\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue)\n const value = controlledValue ?? uncontrolledValue\n\n const onValueChange = (newValue: number) => {\n if (controlledValue === undefined) {\n setUncontrolledValue(newValue)\n }\n handleValueChange?.(newValue)\n }\n\n const fieldState = useFieldContext()\n const ratingState = disabled ? 'disabled' : (fieldState?.state ?? state)\n\n return (\n <FieldContext.Provider value={{ state: ratingState }}>\n <RatingContext.Provider\n value={{\n value,\n max,\n onValueChange,\n state: ratingState,\n size,\n disabled\n }}\n >\n <div className={wrapper({ className })} id={id} {...props}>\n {children}\n </div>\n </RatingContext.Provider>\n </FieldContext.Provider>\n )\n}\n\nexport interface RatingTrackProps {\n className?: string\n}\n\nexport function RatingTrack({ className }: RatingTrackProps) {\n const { max, state, size } = useRatingContext()\n\n return (\n <div className={root({ state, size, className })}>\n {Array.from({ length: max }, (_, index) => (\n <RatingStar key={index} value={index + 1} />\n ))}\n </div>\n )\n}\n\nexport interface RatingStarProps {\n value: number\n className?: string\n}\n\nexport function RatingStar({ value, className }: RatingStarProps) {\n const {\n value: currentValue,\n onValueChange,\n state,\n size,\n disabled\n } = useRatingContext()\n const isFilled = value <= currentValue\n\n return (\n <button\n aria-label={`Rate ${value} star${value > 1 ? 's' : ''}`}\n className={star({ state, size, className })}\n disabled={disabled}\n type=\"button\"\n onClick={() => !disabled && onValueChange(value)}\n >\n <Icon filled={isFilled} name=\"star\" />\n </button>\n )\n}\n\nexport type RatingLabelProps = ComponentProps<typeof FloatingLabel>\n\nexport function RatingLabel(props: RatingLabelProps) {\n return <FloatingLabel {...props} />\n}\n\nexport interface RatingCaptionProps extends ComponentProps<'p'> {\n className?: string\n}\n\nexport function RatingCaption({ className, ...props }: RatingCaptionProps) {\n const { state } = useRatingContext()\n return <p className={caption({ state, className })} {...props} />\n}\n\nexport interface RatingProps {\n value?: number\n defaultValue?: number\n onValueChange?: (value: number) => void\n max?: number\n state?: 'normal' | 'error' | 'disabled'\n size?: 'sm' | 'md' | 'lg'\n label?: string\n caption?: string\n className?: string\n disabled?: boolean\n id?: string\n}\n\nexport function Rating({\n value,\n defaultValue = 0,\n onValueChange: handleValueChange,\n max = 5,\n state = 'normal',\n size = 'md',\n label,\n caption,\n className,\n disabled,\n id,\n ...props\n}: RatingProps) {\n const ratingState = disabled ? 'disabled' : state\n\n return (\n <RatingRoot\n className={className}\n defaultValue={defaultValue}\n disabled={disabled}\n id={id}\n max={max}\n size={size}\n state={ratingState}\n value={value}\n onValueChange={handleValueChange}\n {...props}\n >\n {label && <RatingLabel>{label}</RatingLabel>}\n <RatingTrack />\n {caption && <RatingCaption>{caption}</RatingCaption>}\n </RatingRoot>\n )\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {b as b$1,c as c$1,d}from'../../chunk-NELCN6E2.js';import {a}from'../../chunk-KS6WGBHQ.js';import {a as a$2,c as c$2,d as d$1,e,h,i}from'../../chunk-6PHXO2YA.js';import'../../chunk-CBFC4QME.js';import'../../chunk-YOLTIAFT.js';import {b}from'../../chunk-M6ZI7M3R.js';import {b as b$2}from'../../chunk-DVDHTP4C.js';import {a as a$1}from'../../chunk-EIG6CBTQ.js';import {cx}from'@xjur-ui/util';import {useMemo,useCallback,useState}from'react';import {useEditor,EditorContext,useCurrentEditor,EditorContent,useEditorState}from'@tiptap/react';export{useCurrentEditor as useRichTextEditor,useEditorState as useRichTextEditorState}from'@tiptap/react';import {StarterKit}from'@tiptap/starter-kit';import {Heading}from'@tiptap/extension-heading';import {Placeholder}from'@tiptap/extension-placeholder';import {jsx,jsxs}from'react/jsx-runtime';var c={1:"text-size-body-md",2:"text-size-title-lg",3:"text-size-headline-lg"};function X({className:t,editorOptions:n,...r}){let i=useEditor({...n,extensions:[StarterKit.configure({bulletList:{HTMLAttributes:{class:"list-disc list-outside pl-large-1x"}},orderedList:{HTMLAttributes:{class:"list-decimal list-outside pl-large-1x"}},heading:false}),Placeholder.configure({placeholder:({node:o,editor:s})=>o.type.name==="paragraph"&&s.isEmpty?"Digite aqui\u2026":"",showOnlyWhenEditable:true,includeChildren:false,emptyNodeClass:"before:content-[attr(data-placeholder)] before:absolute before:top-0 before:left-0 before:text-neutral-placeholder first:before:float-left first:before:content-[attr(data-placeholder)] first:before:pointer-events-none"}),Heading.configure({levels:[1,2,3]}).extend({renderHTML({node:o,HTMLAttributes:s}){let u=o.attrs.level??1;return ["h",{...s,class:c[u]},0]}}),...n?.extensions??[]]}),a=useMemo(()=>({editor:i}),[i]);return jsx(EditorContext.Provider,{value:a,children:jsx("div",{className:cx("gap-small flex w-full flex-col",t),"data-slot":"text-area-root",...r})})}function j({className:t,...n}){return jsx("div",{className:cx("bg-layer-2-hover py-small_1x-alt px-small rounded-small-1x min-h-[116px] w-full border border-transparent","hover:border-border-layer-2 transition-colors duration-200","[&_ul_ul]:list-[circle]","[&_ul_ul_ul]:list-[square]","[&_ol_ol]:list-[lower-alpha]","[&_ol_ol_ol]:list-[lower-roman]","gap-small flex flex-col overflow-x-hidden overflow-y-auto",t),"data-slot":"text-area-content",...n})}function ee({className:t,...n}){return jsx("p",{...n,className:cx("text-size-body-sm text-neutral-dark font-normal",t),"data-slot":"text-area-caption"})}function te({className:t,...n}){let{editor:r}=useCurrentEditor();return jsx(EditorContent,{className:cx("text-size-body-md text-neutral-dark max-h-[116px] *:h-full *:w-full *:outline-0",t),editor:r,...n})}function oe({className:t,...n}){return jsx("div",{className:cx("h-large-4x gap-small-1x h-large-6px scrollbar-hide flex flex-nowrap items-center overflow-x-auto overflow-y-hidden",t),"data-slot":"text-area-toolbar",...n})}function $({appearance:t="ghost",variant:n="secondary",onMouseDown:r,onPointerDown:i,...a}){return jsx(b,{appearance:t,size:"icon_md",tabIndex:-1,type:"button",variant:n,onMouseDown:o=>{o.preventDefault(),r?.(o);},onPointerDown:o=>{o.preventDefault(),i?.(o);},...a})}function re({name:t,...n}){let{editor:r}=useCurrentEditor(),{shortcut:i}=a(),a$2=useEditorState({editor:r,selector:d=>d.editor?.isActive(t)??false}),o=useMemo(()=>new Map([["bold","format_bold"],["italic","format_italic"],["underline","format_underlined"],["strike","format_strikethrough"],["bulletList","format_list_bulleted"],["orderedList","format_list_numbered"],["undo","undo"],["redo","redo"]]).get(t),[t]),s=useMemo(()=>new Map([["bold",`Negrito (${i} + B)`],["italic",`It\xE1lico (${i} + I)`],["underline",`Sublinhado (${i} + U)`],["strike",`Tachado (${i} + S)`],["bulletList",`Lista (${i} + Shift + 7)`],["orderedList",`Lista numerada (${i} + Shift + 8)`],["undo",`Desfazer (${i} + Z)`],["redo",`Refazer (${i} + Y)`]]).get(t),[t,i]),u=useCallback(()=>{if(!r)throw new Error("Editor not found");new Map([["bold",()=>r.chain().focus().toggleBold().run()],["italic",()=>r.chain().focus().toggleItalic().run()],["underline",()=>r.chain().focus().toggleUnderline().run()],["strike",()=>r.chain().focus().toggleStrike().run()],["bulletList",()=>r.chain().focus().toggleBulletList().run()],["orderedList",()=>r.chain().focus().toggleOrderedList().run()],["undo",()=>r.chain().focus().undo().run()],["redo",()=>r.chain().focus().redo().run()]]).get(t)?.();},[r,t]);return jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx($,{onClick:u,...a$2&&{appearance:"solid"},...n,children:o&&jsx(b$2,{className:"text-icon-neutral-3",name:o})})}),jsx(d,{children:s&&jsx(a$1,{size:"sm",children:s})})]})}function ne({appearance:t="ghost",variant:n="secondary",...r}){let[i$1,a]=useState(false),{editor:o}=useCurrentEditor(),s=useEditorState({editor:o,selector:l=>l.editor?.isActive("heading")??false}),u=useCallback(l=>{if(!o)throw new Error("Editor not found");return o.isActive("heading",{level:l})},[o]),d$2=useCallback(l=>{if(!o)throw new Error("Editor not found");a(false),setTimeout(()=>{o.chain().focus().toggleHeading({level:l}).run();},0);},[o]),P=[{level:1,label:"Normal",className:c[1]},{level:2,label:"Grande",className:c[2]},{level:3,label:"Enorme",className:c[3]}];return jsxs(a$2,{open:i$1,onOpenChange:l=>a(l),children:[jsx(c$2,{asChild:true,children:jsx(b,{appearance:s?"solid":t,size:"icon_md",tabIndex:-1,type:"button",variant:n,...r,children:jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx(b$2,{className:"text-icon-neutral-3",name:"format_size"})}),jsx(d,{children:jsx(a$1,{size:"sm",children:"Tamanho"})})]})})}),jsx(d$1,{children:jsx(e,{children:P.map(l=>jsx(h,{isActive:u(l.level),onPointerDown:()=>d$2(l.level),children:jsx(i,{className:l.className,children:l.label})},l.level))})})]})}export{ne as HeadingButton,te as RichEditorAreaText,ee as RichEditorCaption,j as RichEditorContent,X as RichEditorRoot,oe as RichEditorToolbar,re as ToggleButton,$ as ToolbarButton};//# sourceMappingURL=rich-editor.js.map
1
+ import {a}from'../../chunk-KS6WGBHQ.js';import {b as b$1,c as c$1,d}from'../../chunk-NELCN6E2.js';import {a as a$2,c as c$2,d as d$1,e,h,i}from'../../chunk-6PHXO2YA.js';import'../../chunk-CBFC4QME.js';import'../../chunk-YOLTIAFT.js';import {b}from'../../chunk-M6ZI7M3R.js';import {b as b$2}from'../../chunk-DVDHTP4C.js';import {a as a$1}from'../../chunk-EIG6CBTQ.js';import {cx}from'@xjur-ui/util';import {useMemo,useCallback,useState}from'react';import {useEditor,EditorContext,useCurrentEditor,EditorContent,useEditorState}from'@tiptap/react';export{useCurrentEditor as useRichTextEditor,useEditorState as useRichTextEditorState}from'@tiptap/react';import {StarterKit}from'@tiptap/starter-kit';import {Heading}from'@tiptap/extension-heading';import {Placeholder}from'@tiptap/extension-placeholder';import {jsx,jsxs}from'react/jsx-runtime';var c={1:"text-size-body-md",2:"text-size-title-lg",3:"text-size-headline-lg"};function X({className:t,editorOptions:n,...r}){let i=useEditor({...n,extensions:[StarterKit.configure({bulletList:{HTMLAttributes:{class:"list-disc list-outside pl-large-1x"}},orderedList:{HTMLAttributes:{class:"list-decimal list-outside pl-large-1x"}},heading:false}),Placeholder.configure({placeholder:({node:o,editor:s})=>o.type.name==="paragraph"&&s.isEmpty?"Digite aqui\u2026":"",showOnlyWhenEditable:true,includeChildren:false,emptyNodeClass:"before:content-[attr(data-placeholder)] before:absolute before:top-0 before:left-0 before:text-neutral-placeholder first:before:float-left first:before:content-[attr(data-placeholder)] first:before:pointer-events-none"}),Heading.configure({levels:[1,2,3]}).extend({renderHTML({node:o,HTMLAttributes:s}){let u=o.attrs.level??1;return ["h",{...s,class:c[u]},0]}}),...n?.extensions??[]]}),a=useMemo(()=>({editor:i}),[i]);return jsx(EditorContext.Provider,{value:a,children:jsx("div",{className:cx("gap-small flex w-full flex-col",t),"data-slot":"text-area-root",...r})})}function j({className:t,...n}){return jsx("div",{className:cx("bg-layer-2-hover py-small_1x-alt px-small rounded-small-1x min-h-[116px] w-full border border-transparent","hover:border-border-layer-2 transition-colors duration-200","[&_ul_ul]:list-[circle]","[&_ul_ul_ul]:list-[square]","[&_ol_ol]:list-[lower-alpha]","[&_ol_ol_ol]:list-[lower-roman]","gap-small flex flex-col overflow-x-hidden overflow-y-auto",t),"data-slot":"text-area-content",...n})}function ee({className:t,...n}){return jsx("p",{...n,className:cx("text-size-body-sm text-neutral-dark font-normal",t),"data-slot":"text-area-caption"})}function te({className:t,...n}){let{editor:r}=useCurrentEditor();return jsx(EditorContent,{className:cx("text-size-body-md text-neutral-dark max-h-[116px] *:h-full *:w-full *:outline-0",t),editor:r,...n})}function oe({className:t,...n}){return jsx("div",{className:cx("h-large-4x gap-small-1x h-large-6px scrollbar-hide flex flex-nowrap items-center overflow-x-auto overflow-y-hidden",t),"data-slot":"text-area-toolbar",...n})}function $({appearance:t="ghost",variant:n="secondary",onMouseDown:r,onPointerDown:i,...a}){return jsx(b,{appearance:t,size:"icon_md",tabIndex:-1,type:"button",variant:n,onMouseDown:o=>{o.preventDefault(),r?.(o);},onPointerDown:o=>{o.preventDefault(),i?.(o);},...a})}function re({name:t,...n}){let{editor:r}=useCurrentEditor(),{shortcut:i}=a(),a$2=useEditorState({editor:r,selector:d=>d.editor?.isActive(t)??false}),o=useMemo(()=>new Map([["bold","format_bold"],["italic","format_italic"],["underline","format_underlined"],["strike","format_strikethrough"],["bulletList","format_list_bulleted"],["orderedList","format_list_numbered"],["undo","undo"],["redo","redo"]]).get(t),[t]),s=useMemo(()=>new Map([["bold",`Negrito (${i} + B)`],["italic",`It\xE1lico (${i} + I)`],["underline",`Sublinhado (${i} + U)`],["strike",`Tachado (${i} + S)`],["bulletList",`Lista (${i} + Shift + 7)`],["orderedList",`Lista numerada (${i} + Shift + 8)`],["undo",`Desfazer (${i} + Z)`],["redo",`Refazer (${i} + Y)`]]).get(t),[t,i]),u=useCallback(()=>{if(!r)throw new Error("Editor not found");new Map([["bold",()=>r.chain().focus().toggleBold().run()],["italic",()=>r.chain().focus().toggleItalic().run()],["underline",()=>r.chain().focus().toggleUnderline().run()],["strike",()=>r.chain().focus().toggleStrike().run()],["bulletList",()=>r.chain().focus().toggleBulletList().run()],["orderedList",()=>r.chain().focus().toggleOrderedList().run()],["undo",()=>r.chain().focus().undo().run()],["redo",()=>r.chain().focus().redo().run()]]).get(t)?.();},[r,t]);return jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx($,{onClick:u,...a$2&&{appearance:"solid"},...n,children:o&&jsx(b$2,{className:"text-icon-neutral-3",name:o})})}),jsx(d,{children:s&&jsx(a$1,{size:"sm",children:s})})]})}function ne({appearance:t="ghost",variant:n="secondary",...r}){let[i$1,a]=useState(false),{editor:o}=useCurrentEditor(),s=useEditorState({editor:o,selector:l=>l.editor?.isActive("heading")??false}),u=useCallback(l=>{if(!o)throw new Error("Editor not found");return o.isActive("heading",{level:l})},[o]),d$2=useCallback(l=>{if(!o)throw new Error("Editor not found");a(false),setTimeout(()=>{o.chain().focus().toggleHeading({level:l}).run();},0);},[o]),P=[{level:1,label:"Normal",className:c[1]},{level:2,label:"Grande",className:c[2]},{level:3,label:"Enorme",className:c[3]}];return jsxs(a$2,{open:i$1,onOpenChange:l=>a(l),children:[jsx(c$2,{asChild:true,children:jsx(b,{appearance:s?"solid":t,size:"icon_md",tabIndex:-1,type:"button",variant:n,...r,children:jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx(b$2,{className:"text-icon-neutral-3",name:"format_size"})}),jsx(d,{children:jsx(a$1,{size:"sm",children:"Tamanho"})})]})})}),jsx(d$1,{children:jsx(e,{children:P.map(l=>jsx(h,{isActive:u(l.level),onPointerDown:()=>d$2(l.level),children:jsx(i,{className:l.className,children:l.label})},l.level))})})]})}export{ne as HeadingButton,te as RichEditorAreaText,ee as RichEditorCaption,j as RichEditorContent,X as RichEditorRoot,oe as RichEditorToolbar,re as ToggleButton,$ as ToolbarButton};//# sourceMappingURL=rich-editor.js.map
2
2
  //# sourceMappingURL=rich-editor.js.map