componentes-sinco 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@ import React__default, { ComponentType, ReactNode } from 'react';
3
3
  import * as Muicon from '@mui/icons-material';
4
4
  import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
5
5
  import * as _mui_material from '@mui/material';
6
- import { Dayjs } from 'dayjs';
6
+ import dayjs, { Dayjs } from 'dayjs';
7
7
  import * as _mui_material_styles from '@mui/material/styles';
8
8
 
9
9
  type ReplyPalette$1 = "primary" | "secondary" | "warning" | "info" | "success" | "error" | any;
@@ -457,8 +457,28 @@ interface SCTabsProps {
457
457
  }
458
458
  declare const SCTabs: ({ options, defaultOption, typeIcon, background, iconPosition, colorTab, orientation, variant, scrollButtons, children }: SCTabsProps) => React__default.JSX.Element;
459
459
 
460
+ type CalendarView = 'month' | 'week' | 'day';
461
+ interface CalendarEvent {
462
+ id: string;
463
+ title: string;
464
+ start: dayjs.Dayjs;
465
+ end: dayjs.Dayjs;
466
+ state: 'EnProgreso' | 'Finalizado' | 'Vencida' | 'Asignada';
467
+ }
468
+ interface CalendarProps {
469
+ events: CalendarEvent[];
470
+ view?: CalendarView;
471
+ toolbar?: React.ReactNode;
472
+ onDayClick?: (date: dayjs.Dayjs) => void;
473
+ onMoreClick?: (date: dayjs.Dayjs, events: CalendarEvent[]) => void;
474
+ onViewChange?: (view: CalendarView) => void;
475
+ onEventClick?: (event: CalendarEvent, date?: dayjs.Dayjs) => void;
476
+ }
477
+
478
+ declare const Calendar: React__default.FC<CalendarProps>;
479
+
460
480
  declare const SincoTheme: _mui_material_styles.Theme;
461
481
  declare let AdproSincoTheme: _mui_material_styles.Theme;
462
482
  declare let ADCSincoTheme: _mui_material_styles.Theme;
463
483
 
464
- export { ADCSincoTheme, AdproSincoTheme, EmptyState, type EmptyStateProperties, type EmptyStateSize, type EmptyStateStates, FooterAction, type FooterActionsProperties, type ModalProps, type ModalStates, MultiSelect, type MultiSelectProps, PageHeader, type PageheaderProperties, type ReplyPalette$1 as ReplyPalette, type ReplyTextPalette, type ReplyVariants, type RepplyButtonVariants, SCAutocomplete, SCCalendarSwipeable, SCDataGrid, SCDataGridInitial, SCDateRange, SCDialog, SCDrawer, SCMenu, SCModal, SCSelect, SCTabs, SCTextArea, type SCTextAreaProps, SCTextField, type SCTextFieldProps, SCToastNotification, SincoTheme, type ToastBaseProperties, ToastProgress, type ToastType, capitalize, getButtonColor, getIcon, getIconComponent, getIconMultiSelect, getModalColor, modalStateConfig, useFilteredItems, useMultiSelectHandlers, useProgress };
484
+ export { ADCSincoTheme, AdproSincoTheme, Calendar, type CalendarEvent, type CalendarProps, type CalendarView, EmptyState, type EmptyStateProperties, type EmptyStateSize, type EmptyStateStates, FooterAction, type FooterActionsProperties, type ModalProps, type ModalStates, MultiSelect, type MultiSelectProps, PageHeader, type PageheaderProperties, type ReplyPalette$1 as ReplyPalette, type ReplyTextPalette, type ReplyVariants, type RepplyButtonVariants, SCAutocomplete, SCCalendarSwipeable, SCDataGrid, SCDataGridInitial, SCDateRange, SCDialog, SCDrawer, SCMenu, SCModal, SCSelect, SCTabs, SCTextArea, type SCTextAreaProps, SCTextField, type SCTextFieldProps, SCToastNotification, SincoTheme, type ToastBaseProperties, ToastProgress, type ToastType, capitalize, getButtonColor, getIcon, getIconComponent, getIconMultiSelect, getModalColor, modalStateConfig, useFilteredItems, useMultiSelectHandlers, useProgress };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import React__default, { ComponentType, ReactNode } from 'react';
3
3
  import * as Muicon from '@mui/icons-material';
4
4
  import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
5
5
  import * as _mui_material from '@mui/material';
6
- import { Dayjs } from 'dayjs';
6
+ import dayjs, { Dayjs } from 'dayjs';
7
7
  import * as _mui_material_styles from '@mui/material/styles';
8
8
 
9
9
  type ReplyPalette$1 = "primary" | "secondary" | "warning" | "info" | "success" | "error" | any;
@@ -457,8 +457,28 @@ interface SCTabsProps {
457
457
  }
458
458
  declare const SCTabs: ({ options, defaultOption, typeIcon, background, iconPosition, colorTab, orientation, variant, scrollButtons, children }: SCTabsProps) => React__default.JSX.Element;
459
459
 
460
+ type CalendarView = 'month' | 'week' | 'day';
461
+ interface CalendarEvent {
462
+ id: string;
463
+ title: string;
464
+ start: dayjs.Dayjs;
465
+ end: dayjs.Dayjs;
466
+ state: 'EnProgreso' | 'Finalizado' | 'Vencida' | 'Asignada';
467
+ }
468
+ interface CalendarProps {
469
+ events: CalendarEvent[];
470
+ view?: CalendarView;
471
+ toolbar?: React.ReactNode;
472
+ onDayClick?: (date: dayjs.Dayjs) => void;
473
+ onMoreClick?: (date: dayjs.Dayjs, events: CalendarEvent[]) => void;
474
+ onViewChange?: (view: CalendarView) => void;
475
+ onEventClick?: (event: CalendarEvent, date?: dayjs.Dayjs) => void;
476
+ }
477
+
478
+ declare const Calendar: React__default.FC<CalendarProps>;
479
+
460
480
  declare const SincoTheme: _mui_material_styles.Theme;
461
481
  declare let AdproSincoTheme: _mui_material_styles.Theme;
462
482
  declare let ADCSincoTheme: _mui_material_styles.Theme;
463
483
 
464
- export { ADCSincoTheme, AdproSincoTheme, EmptyState, type EmptyStateProperties, type EmptyStateSize, type EmptyStateStates, FooterAction, type FooterActionsProperties, type ModalProps, type ModalStates, MultiSelect, type MultiSelectProps, PageHeader, type PageheaderProperties, type ReplyPalette$1 as ReplyPalette, type ReplyTextPalette, type ReplyVariants, type RepplyButtonVariants, SCAutocomplete, SCCalendarSwipeable, SCDataGrid, SCDataGridInitial, SCDateRange, SCDialog, SCDrawer, SCMenu, SCModal, SCSelect, SCTabs, SCTextArea, type SCTextAreaProps, SCTextField, type SCTextFieldProps, SCToastNotification, SincoTheme, type ToastBaseProperties, ToastProgress, type ToastType, capitalize, getButtonColor, getIcon, getIconComponent, getIconMultiSelect, getModalColor, modalStateConfig, useFilteredItems, useMultiSelectHandlers, useProgress };
484
+ export { ADCSincoTheme, AdproSincoTheme, Calendar, type CalendarEvent, type CalendarProps, type CalendarView, EmptyState, type EmptyStateProperties, type EmptyStateSize, type EmptyStateStates, FooterAction, type FooterActionsProperties, type ModalProps, type ModalStates, MultiSelect, type MultiSelectProps, PageHeader, type PageheaderProperties, type ReplyPalette$1 as ReplyPalette, type ReplyTextPalette, type ReplyVariants, type RepplyButtonVariants, SCAutocomplete, SCCalendarSwipeable, SCDataGrid, SCDataGridInitial, SCDateRange, SCDialog, SCDrawer, SCMenu, SCModal, SCSelect, SCTabs, SCTextArea, type SCTextAreaProps, SCTextField, type SCTextFieldProps, SCToastNotification, SincoTheme, type ToastBaseProperties, ToastProgress, type ToastType, capitalize, getButtonColor, getIcon, getIconComponent, getIconMultiSelect, getModalColor, modalStateConfig, useFilteredItems, useMultiSelectHandlers, useProgress };
package/dist/index.js CHANGED
@@ -2542,11 +2542,562 @@ var SCTabs = ({ options, defaultOption, typeIcon, background, iconPosition, colo
2542
2542
  )))) : /* @__PURE__ */ React18.createElement(Box13, { sx: { height: "200px" } }, toast && /* @__PURE__ */ React18.createElement(SCToastNotification, __spreadValues({ "data-testid": "error-tab-message" }, toast))));
2543
2543
  };
2544
2544
 
2545
+ // src/Components/Calendario/Calendar.tsx
2546
+ import React24, { useState as useState12 } from "react";
2547
+ import { Box as Box19 } from "@mui/material";
2548
+ import dayjs7 from "dayjs";
2549
+
2550
+ // src/Components/Calendario/CalendarToolbar.tsx
2551
+ import React19, { useState as useState11 } from "react";
2552
+ import { ChevronLeft, ChevronRight, KeyboardArrowDown as KeyboardArrowDown2, LightModeOutlined } from "@mui/icons-material";
2553
+ import { Box as Box14, Chip as Chip3, IconButton as IconButton9, Menu, MenuItem as MenuItem5, Stack as Stack8, Typography as Typography16 } from "@mui/material";
2554
+ import dayjs2 from "dayjs";
2555
+ import "dayjs/locale/es";
2556
+ dayjs2.locale("es");
2557
+ var CalendarToolbar = ({
2558
+ labelDate,
2559
+ view,
2560
+ onView,
2561
+ onNavigate,
2562
+ children
2563
+ }) => {
2564
+ const [anchorEl, setAnchorEl] = useState11(null);
2565
+ const open = Boolean(anchorEl);
2566
+ const handleMenuOpen = (event2) => {
2567
+ setAnchorEl(event2.currentTarget);
2568
+ };
2569
+ const handleMenuClose = () => {
2570
+ setAnchorEl(null);
2571
+ };
2572
+ const handleViewChange = (newView) => {
2573
+ onView(newView);
2574
+ handleMenuClose();
2575
+ };
2576
+ const getFormattedDate = () => {
2577
+ if (view === "month") {
2578
+ return labelDate.format("MMMM YYYY");
2579
+ }
2580
+ if (view === "week") {
2581
+ return `${labelDate.startOf("week").add(1, "day").format("DD MMM")} - ${labelDate.endOf("week").format("DD MMM YYYY")}`;
2582
+ }
2583
+ return labelDate.format(" DD MMMM YYYY");
2584
+ };
2585
+ return /* @__PURE__ */ React19.createElement(Stack8, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 0.5, px: 1, py: 0.5 }, /* @__PURE__ */ React19.createElement(Box14, null, /* @__PURE__ */ React19.createElement(
2586
+ Chip3,
2587
+ {
2588
+ label: "Hoy",
2589
+ icon: /* @__PURE__ */ React19.createElement(LightModeOutlined, { fontSize: "small" }),
2590
+ color: "primary",
2591
+ onClick: () => onNavigate("TODAY")
2592
+ }
2593
+ )), /* @__PURE__ */ React19.createElement(Stack8, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React19.createElement(IconButton9, { "aria-label": "Anterior", onClick: () => onNavigate("PREV"), size: "small", color: "primary" }, /* @__PURE__ */ React19.createElement(ChevronLeft, { fontSize: "small" })), /* @__PURE__ */ React19.createElement(IconButton9, { "aria-label": "Siguiente", onClick: () => onNavigate("NEXT"), size: "small", color: "primary" }, /* @__PURE__ */ React19.createElement(ChevronRight, { fontSize: "small" })), /* @__PURE__ */ React19.createElement(Typography16, { variant: "h6", color: "primary", "data-testid": "currentDate" }, getFormattedDate()), /* @__PURE__ */ React19.createElement(IconButton9, { onClick: handleMenuOpen, size: "small", color: "primary", "aria-label": "Cambiar vista" }, /* @__PURE__ */ React19.createElement(KeyboardArrowDown2, { fontSize: "small" })), /* @__PURE__ */ React19.createElement(
2594
+ Menu,
2595
+ {
2596
+ anchorEl,
2597
+ open,
2598
+ onClose: handleMenuClose,
2599
+ anchorOrigin: { vertical: "bottom", horizontal: "center" },
2600
+ transformOrigin: { vertical: "top", horizontal: "center" }
2601
+ },
2602
+ /* @__PURE__ */ React19.createElement(MenuItem5, { onClick: () => handleViewChange("month") }, "Mes"),
2603
+ /* @__PURE__ */ React19.createElement(MenuItem5, { onClick: () => handleViewChange("week") }, "Semana"),
2604
+ /* @__PURE__ */ React19.createElement(MenuItem5, { onClick: () => handleViewChange("day") }, "D\xEDa")
2605
+ )), children ? /* @__PURE__ */ React19.createElement(Box14, null, children) : /* @__PURE__ */ React19.createElement(Box14, { width: "24px" }), " ");
2606
+ };
2607
+
2608
+ // src/Components/Calendario/Views/MonthView.tsx
2609
+ import React21 from "react";
2610
+ import { Box as Box16, Typography as Typography18, IconButton as IconButton10, Paper as Paper2, Tooltip as Tooltip4, Stack as Stack10, Divider as Divider6 } from "@mui/material";
2611
+ import AddIcon from "@mui/icons-material/Add";
2612
+ import dayjs4 from "dayjs";
2613
+ import localeData from "dayjs/plugin/localeData";
2614
+ import isBetween from "dayjs/plugin/isBetween";
2615
+
2616
+ // src/Components/Calendario/Utils.tsx
2617
+ import dayjs3 from "dayjs";
2618
+ function getMonthDays(date) {
2619
+ const start = date.startOf("month").day(0);
2620
+ const end = date.endOf("month").day(6);
2621
+ const days = [];
2622
+ let current = start;
2623
+ while (current.isBefore(end) || current.isSame(end, "day")) {
2624
+ days.push(current);
2625
+ current = current.add(1, "day");
2626
+ }
2627
+ return days;
2628
+ }
2629
+ var isToday = (date) => {
2630
+ return date.isSame(dayjs3(), "day");
2631
+ };
2632
+ var stateColors = {
2633
+ Asignada: "warning.main",
2634
+ Finalizado: "primary.main",
2635
+ Vencida: "error.main",
2636
+ EnProgreso: "success.main"
2637
+ };
2638
+
2639
+ // src/Components/Calendario/Event.tsx
2640
+ import React20 from "react";
2641
+ import { Box as Box15, Stack as Stack9, Typography as Typography17, Divider as Divider5 } from "@mui/material";
2642
+ var CalendarEventCard = ({ event: event2, color, sx, onClick }) => {
2643
+ return /* @__PURE__ */ React20.createElement(
2644
+ Stack9,
2645
+ {
2646
+ direction: "row",
2647
+ padding: 0.5,
2648
+ borderRadius: 0.5,
2649
+ alignItems: "flex-start",
2650
+ minHeight: "20px",
2651
+ onClick: (e) => {
2652
+ e.stopPropagation();
2653
+ onClick == null ? void 0 : onClick(event2);
2654
+ },
2655
+ sx: (theme) => __spreadValues({
2656
+ backgroundColor: theme.palette.common.white,
2657
+ boxShadow: theme.shadows[2],
2658
+ color: theme.palette.text.secondary,
2659
+ overflow: "hidden",
2660
+ cursor: onClick ? "pointer" : "default"
2661
+ }, sx)
2662
+ },
2663
+ /* @__PURE__ */ React20.createElement(
2664
+ Divider5,
2665
+ {
2666
+ orientation: "vertical",
2667
+ flexItem: true,
2668
+ sx: {
2669
+ width: "2px",
2670
+ backgroundColor: color != null ? color : "primary.main",
2671
+ borderRadius: "2px"
2672
+ }
2673
+ }
2674
+ ),
2675
+ /* @__PURE__ */ React20.createElement(
2676
+ Box15,
2677
+ {
2678
+ px: 1,
2679
+ py: 0.5,
2680
+ flex: "1",
2681
+ minWidth: 0,
2682
+ display: "flex",
2683
+ alignItems: "center"
2684
+ },
2685
+ /* @__PURE__ */ React20.createElement(
2686
+ Typography17,
2687
+ {
2688
+ color: "text.primary",
2689
+ variant: "caption",
2690
+ noWrap: true,
2691
+ sx: {
2692
+ overflow: "hidden",
2693
+ textOverflow: "ellipsis",
2694
+ whiteSpace: "nowrap"
2695
+ }
2696
+ },
2697
+ capitalize(event2.title)
2698
+ )
2699
+ )
2700
+ );
2701
+ };
2702
+
2703
+ // src/Components/Calendario/Views/MonthView.tsx
2704
+ dayjs4.extend(localeData);
2705
+ dayjs4.extend(isBetween);
2706
+ var MonthView = ({ events, onDayClick, onMoreClick, currentDate, onEventClick }) => {
2707
+ const days = getMonthDays(currentDate);
2708
+ const weekDays = Array.from({ length: 7 }, (_, i) => dayjs4().day(i));
2709
+ const [openDrawer, setOpenDrawer] = React21.useState(false);
2710
+ const [selectedDay, setSelectedDay] = React21.useState(null);
2711
+ const [selectedEvents, setSelectedEvents] = React21.useState([]);
2712
+ return /* @__PURE__ */ React21.createElement(Box16, { width: "100%", sx: { overflowX: "auto" } }, /* @__PURE__ */ React21.createElement(Box16, { minWidth: "1050px" }, /* @__PURE__ */ React21.createElement(Box16, { display: "grid", gridTemplateColumns: "repeat(7, minmax(150px, 1fr))", gap: 0.5, mb: 1 }, weekDays.map((day) => /* @__PURE__ */ React21.createElement(Box16, { key: day.day(), textAlign: "center", py: 0.5 }, /* @__PURE__ */ React21.createElement(Typography18, { variant: "caption", color: "text.secondary" }, day.format("dddd"))))), /* @__PURE__ */ React21.createElement(Box16, { display: "grid", gridTemplateColumns: "repeat(7, minmax(150px, 1fr))", gap: 0.5 }, days.map((day) => {
2713
+ const dayEvents = events.filter(
2714
+ (e) => day.isBetween(e.start.startOf("day"), e.end.endOf("day"), null, "[]")
2715
+ );
2716
+ const isCurrentMonth = day.month() === currentDate.month();
2717
+ return /* @__PURE__ */ React21.createElement(
2718
+ Paper2,
2719
+ {
2720
+ key: day.toString(),
2721
+ onClick: () => onDayClick == null ? void 0 : onDayClick(day),
2722
+ sx: {
2723
+ minHeight: 120,
2724
+ display: "flex",
2725
+ flexDirection: "column",
2726
+ justifyContent: "space-between",
2727
+ boxShadow: "none",
2728
+ bgcolor: isCurrentMonth ? "grey.50" : "background.default",
2729
+ cursor: "pointer",
2730
+ "&:hover": { bgcolor: "primary.50" },
2731
+ overflow: "hidden"
2732
+ }
2733
+ },
2734
+ /* @__PURE__ */ React21.createElement(Box16, { p: 1, flexShrink: 0 }, /* @__PURE__ */ React21.createElement(Box16, { display: "flex", alignItems: "center", justifyContent: "flex-start" }, /* @__PURE__ */ React21.createElement(
2735
+ Box16,
2736
+ {
2737
+ sx: {
2738
+ width: 24,
2739
+ height: 24,
2740
+ borderRadius: "50%",
2741
+ backgroundColor: isToday(day) ? "primary.main" : void 0,
2742
+ display: "flex",
2743
+ alignItems: "center",
2744
+ justifyContent: "center"
2745
+ }
2746
+ },
2747
+ /* @__PURE__ */ React21.createElement(
2748
+ Typography18,
2749
+ {
2750
+ variant: "body2",
2751
+ sx: { color: isToday(day) ? "white" : "text.secondary" }
2752
+ },
2753
+ day.date()
2754
+ )
2755
+ ), dayEvents.length > 2 && /* @__PURE__ */ React21.createElement(Tooltip4, { title: "M\xE1s eventos" }, /* @__PURE__ */ React21.createElement(
2756
+ IconButton10,
2757
+ {
2758
+ color: "primary",
2759
+ size: "small",
2760
+ onClick: (e) => {
2761
+ e.stopPropagation();
2762
+ onMoreClick == null ? void 0 : onMoreClick(day, dayEvents);
2763
+ setSelectedDay(day);
2764
+ setSelectedEvents(dayEvents);
2765
+ }
2766
+ },
2767
+ /* @__PURE__ */ React21.createElement(AddIcon, { fontSize: "small" })
2768
+ )))),
2769
+ /* @__PURE__ */ React21.createElement(Box16, { display: "flex", flexDirection: "column", gap: 0.5, p: 1, pt: 0, overflow: "hidden" }, dayEvents.slice(0, 2).map((event2) => /* @__PURE__ */ React21.createElement(
2770
+ CalendarEventCard,
2771
+ {
2772
+ key: `${event2.id}-${day.toString()}`,
2773
+ event: event2,
2774
+ color: stateColors[event2.state],
2775
+ onClick: () => onEventClick == null ? void 0 : onEventClick(event2, day)
2776
+ }
2777
+ ))),
2778
+ dayEvents.length > 2 && /* @__PURE__ */ React21.createElement(Stack10, { justifyContent: "flex-end", px: 1, pb: 0.5, onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React21.createElement(
2779
+ SCDrawer,
2780
+ {
2781
+ width: "350px",
2782
+ title: day.format("DD [de] MMMM YYYY"),
2783
+ open: openDrawer,
2784
+ buttonDrawer: { text: `+ ${dayEvents.length}` },
2785
+ anchor: "right",
2786
+ actions: false,
2787
+ arrayElements: [{
2788
+ component: (() => {
2789
+ const [first, ...rest] = dayEvents;
2790
+ return /* @__PURE__ */ React21.createElement(Box16, { display: "flex", width: "100%", flexDirection: "column", height: "100%", pr: 1.5 }, /* @__PURE__ */ React21.createElement(Typography18, { width: "100%", color: "text.secondary" }, " Proximo evento "), first && /* @__PURE__ */ React21.createElement(Box16, { p: 1, pb: 1, width: "100%" }, /* @__PURE__ */ React21.createElement(
2791
+ CalendarEventCard,
2792
+ {
2793
+ event: first,
2794
+ color: stateColors[first.state],
2795
+ onClick: () => onEventClick == null ? void 0 : onEventClick(first, day),
2796
+ sx: {
2797
+ whiteSpace: "normal",
2798
+ "& .MuiTypography-root": {
2799
+ whiteSpace: "normal",
2800
+ overflow: "visible",
2801
+ textOverflow: "unset"
2802
+ }
2803
+ }
2804
+ }
2805
+ )), /* @__PURE__ */ React21.createElement(Divider6, { flexItem: true, sx: { width: "100%" } }), /* @__PURE__ */ React21.createElement(Typography18, { width: "100%", py: 1, color: "text.secondary" }, " Eventos restantes "), /* @__PURE__ */ React21.createElement(
2806
+ Box16,
2807
+ {
2808
+ width: "100%",
2809
+ height: "100%",
2810
+ flex: 1,
2811
+ overflow: "auto",
2812
+ p: 1,
2813
+ pt: 1,
2814
+ display: "flex",
2815
+ flexDirection: "column",
2816
+ gap: 1.5
2817
+ },
2818
+ rest.map((event2) => /* @__PURE__ */ React21.createElement(
2819
+ CalendarEventCard,
2820
+ {
2821
+ key: `${event2.id}-${day.toString()}`,
2822
+ event: event2,
2823
+ color: stateColors[event2.state],
2824
+ onClick: () => onEventClick == null ? void 0 : onEventClick(event2, day),
2825
+ sx: {
2826
+ whiteSpace: "normal",
2827
+ "& .MuiTypography-root": {
2828
+ whiteSpace: "normal",
2829
+ overflow: "visible",
2830
+ textOverflow: "unset"
2831
+ }
2832
+ }
2833
+ }
2834
+ ))
2835
+ ));
2836
+ })()
2837
+ }]
2838
+ }
2839
+ ))
2840
+ );
2841
+ }))));
2842
+ };
2843
+
2844
+ // src/Components/Calendario/Views/WeekView.tsx
2845
+ import React22 from "react";
2846
+ import { Box as Box17, Typography as Typography19 } from "@mui/material";
2847
+ import dayjs5 from "dayjs";
2848
+ import localeData2 from "dayjs/plugin/localeData";
2849
+ dayjs5.extend(localeData2);
2850
+ var WeekView = ({ events, currentDate, onDayClick, onEventClick }) => {
2851
+ const startOfWeek2 = currentDate.startOf("week");
2852
+ const days = Array.from({ length: 7 }, (_, i) => startOfWeek2.add(i, "day"));
2853
+ const hours2 = Array.from({ length: 24 }, (_, i) => i);
2854
+ const getCellBorderType = (cellHour, dayEvents) => {
2855
+ for (const event2 of dayEvents) {
2856
+ const start = event2.start.hour() + event2.start.minute() / 60;
2857
+ const end = event2.end.hour() + event2.end.minute() / 60;
2858
+ const cellStart = cellHour;
2859
+ const cellEnd = cellHour + 1;
2860
+ if (cellEnd > start && cellStart < end) {
2861
+ if (Math.abs(cellStart - start) < 0.01 && Math.abs(cellEnd - end) < 0.01)
2862
+ return "full";
2863
+ if (Math.abs(cellStart - start) < 0.01) return "start";
2864
+ if (Math.abs(cellEnd - end) < 0.01) return "end";
2865
+ return "middle";
2866
+ }
2867
+ }
2868
+ return "none";
2869
+ };
2870
+ return /* @__PURE__ */ React22.createElement(Box17, { display: "flex", flexDirection: "column", height: "100%" }, /* @__PURE__ */ React22.createElement(Box17, { display: "flex", bgcolor: "background.default" }, /* @__PURE__ */ React22.createElement(Box17, { width: 45, bgcolor: "background.default" }), days.map((day) => /* @__PURE__ */ React22.createElement(
2871
+ Box17,
2872
+ {
2873
+ key: day.toString(),
2874
+ height: 40,
2875
+ flex: 1,
2876
+ pl: 0.5,
2877
+ textAlign: "center",
2878
+ display: "flex",
2879
+ flexDirection: "column",
2880
+ justifyContent: "center",
2881
+ alignItems: "flex-start"
2882
+ },
2883
+ /* @__PURE__ */ React22.createElement(Typography19, { variant: "caption", color: "text.secondary" }, day.format("dddd"))
2884
+ ))), /* @__PURE__ */ React22.createElement(Box17, { display: "flex", flex: 1 }, /* @__PURE__ */ React22.createElement(Box17, { width: 45, bgcolor: "background.default" }, hours2.map((h) => /* @__PURE__ */ React22.createElement(
2885
+ Box17,
2886
+ {
2887
+ key: h,
2888
+ height: 60,
2889
+ textAlign: "right",
2890
+ pr: 1,
2891
+ borderTop: "1px solid",
2892
+ borderColor: "divider"
2893
+ },
2894
+ /* @__PURE__ */ React22.createElement(Typography19, { variant: "caption", color: "text.secondary" }, dayjs5().hour(h).format("h A"))
2895
+ ))), days.map((day) => {
2896
+ const dayEvents = events.filter(
2897
+ (event2) => day.isBetween(event2.start.startOf("day"), event2.end.endOf("day"), null, "[]")
2898
+ );
2899
+ return /* @__PURE__ */ React22.createElement(
2900
+ Box17,
2901
+ {
2902
+ key: day.toString(),
2903
+ flex: 1,
2904
+ borderLeft: "1px solid",
2905
+ borderColor: "divider",
2906
+ position: "relative",
2907
+ "data-testid": `week-day-column-${day.format("YYYY-MM-DD")}`,
2908
+ onClick: () => onDayClick == null ? void 0 : onDayClick(day)
2909
+ },
2910
+ hours2.map((hourIdx) => {
2911
+ const borderType = getCellBorderType(hourIdx, dayEvents);
2912
+ return /* @__PURE__ */ React22.createElement(
2913
+ Box17,
2914
+ {
2915
+ key: hourIdx,
2916
+ height: 60,
2917
+ borderTop: "1px solid",
2918
+ borderColor: borderType === "start" || borderType === "full" || borderType === "none" ? "divider" : "transparent",
2919
+ borderBottom: borderType === "end" || borderType === "full" ? "1px solid divider" : void 0
2920
+ }
2921
+ );
2922
+ }),
2923
+ dayEvents.map((event2) => {
2924
+ const eventStart = day.isSame(event2.start, "day") ? event2.start : day.startOf("day").hour(0).minute(0);
2925
+ const eventEnd = day.isSame(event2.end, "day") ? event2.end : day.endOf("day").hour(23).minute(59);
2926
+ const startMinutes = eventStart.hour() * 60 + eventStart.minute();
2927
+ const durationMinutes = eventEnd.diff(eventStart, "minute");
2928
+ return /* @__PURE__ */ React22.createElement(
2929
+ CalendarEventCard,
2930
+ {
2931
+ key: `${event2.id}-${day.toString()}`,
2932
+ event: event2,
2933
+ color: stateColors[event2.state],
2934
+ onClick: () => onEventClick == null ? void 0 : onEventClick(event2, day),
2935
+ sx: {
2936
+ position: "absolute",
2937
+ top: `${startMinutes + 15}px`,
2938
+ left: 4,
2939
+ right: 4,
2940
+ cursor: "pointer",
2941
+ height: "auto"
2942
+ }
2943
+ }
2944
+ );
2945
+ })
2946
+ );
2947
+ })));
2948
+ };
2949
+
2950
+ // src/Components/Calendario/Views/DayView.tsx
2951
+ import React23 from "react";
2952
+ import { Box as Box18, Typography as Typography20 } from "@mui/material";
2953
+ import dayjs6 from "dayjs";
2954
+ var hours = Array.from({ length: 24 }, (_, i) => i);
2955
+ var DayView = ({ events, currentDate, onEventClick }) => {
2956
+ const getCellBorderType = (cellHour, dayEvents2) => {
2957
+ for (const event2 of dayEvents2) {
2958
+ const start = event2.start.hour() + event2.start.minute() / 60;
2959
+ const end = event2.end.hour() + event2.end.minute() / 60;
2960
+ const cellStart = cellHour;
2961
+ const cellEnd = cellHour + 1;
2962
+ if (cellEnd > start && cellStart < end) {
2963
+ if (Math.abs(cellStart - start) < 0.01 && Math.abs(cellEnd - end) < 0.01)
2964
+ return "full";
2965
+ if (Math.abs(cellStart - start) < 0.01) return "start";
2966
+ if (Math.abs(cellEnd - end) < 0.01) return "end";
2967
+ return "middle";
2968
+ }
2969
+ }
2970
+ return "none";
2971
+ };
2972
+ const dayEvents = events.filter(
2973
+ (event2) => currentDate.isBetween(event2.start.startOf("day"), event2.end.endOf("day"), null, "[]")
2974
+ );
2975
+ return /* @__PURE__ */ React23.createElement(Box18, { display: "flex", flexDirection: "column", height: "100%" }, /* @__PURE__ */ React23.createElement(Box18, { display: "flex", borderBottom: "1px solid", borderColor: "primary.main", bgcolor: "background.paper" }, /* @__PURE__ */ React23.createElement(Box18, { width: 47, bgcolor: "background.default", borderBottom: "1px solid", borderColor: "transparent" }), /* @__PURE__ */ React23.createElement(
2976
+ Box18,
2977
+ {
2978
+ flex: 1,
2979
+ display: "flex",
2980
+ flexDirection: "column",
2981
+ textAlign: "start",
2982
+ gap: 0.5,
2983
+ py: 1,
2984
+ bgcolor: "primary.50"
2985
+ },
2986
+ /* @__PURE__ */ React23.createElement(Typography20, { variant: "h6", color: "text.secondary" }, currentDate.format("D")),
2987
+ /* @__PURE__ */ React23.createElement(Typography20, { variant: "caption", color: "text.secondary" }, currentDate.format("dddd"))
2988
+ )), /* @__PURE__ */ React23.createElement(Box18, { display: "flex", flex: 1 }, /* @__PURE__ */ React23.createElement(Box18, { width: 47, bgcolor: "background.default" }, hours.map((h) => /* @__PURE__ */ React23.createElement(
2989
+ Box18,
2990
+ {
2991
+ key: h,
2992
+ height: 60,
2993
+ textAlign: "right",
2994
+ pr: 1,
2995
+ borderTop: "1px solid",
2996
+ borderRight: "1px solid",
2997
+ borderColor: "divider"
2998
+ },
2999
+ /* @__PURE__ */ React23.createElement(Typography20, { variant: "caption", color: "text.secondary" }, dayjs6().hour(h).format("h A"))
3000
+ ))), /* @__PURE__ */ React23.createElement(Box18, { flex: 1, position: "relative" }, hours.map((hourIdx) => {
3001
+ const borderType = getCellBorderType(hourIdx, dayEvents);
3002
+ return /* @__PURE__ */ React23.createElement(
3003
+ Box18,
3004
+ {
3005
+ key: hourIdx,
3006
+ height: 60,
3007
+ borderTop: "1px solid",
3008
+ borderColor: borderType === "start" || borderType === "full" || borderType === "none" ? "divider" : "transparent",
3009
+ borderBottom: borderType === "end" || borderType === "full" ? "1px solid divider" : void 0
3010
+ }
3011
+ );
3012
+ }), dayEvents.map((event2) => {
3013
+ const eventStart = currentDate.isSame(event2.start, "day") ? event2.start : currentDate.startOf("day").hour(0).minute(0);
3014
+ const eventEnd = currentDate.isSame(event2.end, "day") ? event2.end : currentDate.endOf("day").hour(23).minute(59);
3015
+ const startMinutes = eventStart.hour() * 60 + eventStart.minute();
3016
+ const durationMinutes = eventEnd.diff(eventStart, "minute");
3017
+ return /* @__PURE__ */ React23.createElement(
3018
+ CalendarEventCard,
3019
+ {
3020
+ key: `${event2.id}-${currentDate.toString()}`,
3021
+ event: event2,
3022
+ color: stateColors[event2.state],
3023
+ onClick: () => onEventClick == null ? void 0 : onEventClick(event2),
3024
+ sx: {
3025
+ position: "absolute",
3026
+ top: `${startMinutes + 15}px`,
3027
+ left: 4,
3028
+ right: 4
3029
+ }
3030
+ }
3031
+ );
3032
+ }))));
3033
+ };
3034
+
3035
+ // src/Components/Calendario/Calendar.tsx
3036
+ var Calendar = ({
3037
+ events,
3038
+ onDayClick,
3039
+ onMoreClick,
3040
+ onEventClick,
3041
+ view: initialView = "month",
3042
+ onViewChange,
3043
+ toolbar
3044
+ }) => {
3045
+ const [view, setView] = useState12(initialView);
3046
+ const [currentDate, setCurrentDate] = useState12(dayjs7());
3047
+ const handleViewChange = (newView) => {
3048
+ setView(newView);
3049
+ onViewChange == null ? void 0 : onViewChange(newView);
3050
+ };
3051
+ const handleNavigate = (action) => {
3052
+ let newDate = currentDate;
3053
+ const unit = view === "month" ? "month" : "day";
3054
+ if (action === "PREV") newDate = currentDate.subtract(1, unit);
3055
+ else if (action === "NEXT") newDate = currentDate.add(1, unit);
3056
+ else if (action === "TODAY") newDate = dayjs7();
3057
+ setCurrentDate(newDate);
3058
+ };
3059
+ return /* @__PURE__ */ React24.createElement(Box19, null, /* @__PURE__ */ React24.createElement(
3060
+ CalendarToolbar,
3061
+ {
3062
+ labelDate: currentDate,
3063
+ view,
3064
+ onView: handleViewChange,
3065
+ onNavigate: handleNavigate
3066
+ },
3067
+ toolbar
3068
+ ), view === "month" && /* @__PURE__ */ React24.createElement(
3069
+ MonthView,
3070
+ {
3071
+ events,
3072
+ onDayClick,
3073
+ onMoreClick,
3074
+ onEventClick,
3075
+ currentDate
3076
+ }
3077
+ ), view === "week" && /* @__PURE__ */ React24.createElement(
3078
+ WeekView,
3079
+ {
3080
+ events,
3081
+ currentDate,
3082
+ onDayClick,
3083
+ onMoreClick,
3084
+ onEventClick
3085
+ }
3086
+ ), view === "day" && /* @__PURE__ */ React24.createElement(
3087
+ DayView,
3088
+ {
3089
+ events,
3090
+ currentDate,
3091
+ onEventClick
3092
+ }
3093
+ ));
3094
+ };
3095
+
2545
3096
  // src/Theme/index.ts
2546
3097
  import { createTheme } from "@mui/material/styles";
2547
3098
 
2548
3099
  // src/Theme/components.ts
2549
- import React19 from "react";
3100
+ import React25 from "react";
2550
3101
  import {
2551
3102
  InfoRounded as InfoRounded2,
2552
3103
  CheckCircleRounded as CheckCircleRounded2,
@@ -3249,10 +3800,10 @@ var components = {
3249
3800
  MuiAlert: {
3250
3801
  defaultProps: {
3251
3802
  iconMapping: {
3252
- success: React19.createElement(CheckCircleRounded2),
3253
- error: React19.createElement(ErrorRounded2),
3254
- warning: React19.createElement(WarningRounded2),
3255
- info: React19.createElement(InfoRounded2)
3803
+ success: React25.createElement(CheckCircleRounded2),
3804
+ error: React25.createElement(ErrorRounded2),
3805
+ warning: React25.createElement(WarningRounded2),
3806
+ info: React25.createElement(InfoRounded2)
3256
3807
  }
3257
3808
  },
3258
3809
  variants: [
@@ -4293,6 +4844,7 @@ var ADCSincoTheme = createTheme(__spreadValues({}, ADCTheme));
4293
4844
  export {
4294
4845
  ADCSincoTheme,
4295
4846
  AdproSincoTheme,
4847
+ Calendar,
4296
4848
  EmptyState,
4297
4849
  FooterAction,
4298
4850
  MultiSelect,