componentes-sinco 1.2.0 → 1.2.2

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
@@ -97,6 +97,7 @@ interface CalendarProps {
97
97
  isLoading?: boolean;
98
98
  startHour?: number;
99
99
  endHour?: number;
100
+ seeDays?: boolean;
100
101
  }
101
102
 
102
103
  declare const Calendar: React__default.FC<CalendarProps>;
package/dist/index.d.ts CHANGED
@@ -97,6 +97,7 @@ interface CalendarProps {
97
97
  isLoading?: boolean;
98
98
  startHour?: number;
99
99
  endHour?: number;
100
+ seeDays?: boolean;
100
101
  }
101
102
 
102
103
  declare const Calendar: React__default.FC<CalendarProps>;
package/dist/index.js CHANGED
@@ -2535,6 +2535,7 @@ function SCAutocomplete({
2535
2535
  ) || null;
2536
2536
  const [open, setOpen] = React15.useState(false);
2537
2537
  const componentClickActiveRef = React15.useRef(false);
2538
+ const listboxScrollRef = React15.useRef(null);
2538
2539
  const containerRef = React15.useRef(null);
2539
2540
  const [chipLimit, setChipLimit] = React15.useState(2);
2540
2541
  const outsideChipsMeasureRef = React15.useRef(null);
@@ -2700,12 +2701,18 @@ function SCAutocomplete({
2700
2701
  event2.defaultMuiPrevented = true;
2701
2702
  },
2702
2703
  onClick: (event2) => {
2703
- var _a2;
2704
+ var _a2, _b, _c;
2704
2705
  event2.preventDefault();
2705
2706
  event2.stopPropagation();
2706
2707
  event2.defaultMuiPrevented = true;
2707
- (_a2 = item.onComponentClick) == null ? void 0 : _a2.call(item, event2, option);
2708
+ const savedScroll = (_b = (_a2 = listboxScrollRef.current) == null ? void 0 : _a2.scrollTop) != null ? _b : 0;
2709
+ (_c = item.onComponentClick) == null ? void 0 : _c.call(item, event2, option);
2708
2710
  setOpen(true);
2711
+ requestAnimationFrame(() => {
2712
+ if (listboxScrollRef.current) {
2713
+ listboxScrollRef.current.scrollTop = savedScroll;
2714
+ }
2715
+ });
2709
2716
  setTimeout(() => {
2710
2717
  componentClickActiveRef.current = false;
2711
2718
  }, 200);
@@ -2746,7 +2753,11 @@ function SCAutocomplete({
2746
2753
  return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
2747
2754
  Box11,
2748
2755
  __spreadProps(__spreadValues({
2749
- ref
2756
+ ref: (node) => {
2757
+ listboxScrollRef.current = node;
2758
+ if (typeof ref === "function") ref(node);
2759
+ else if (ref) ref.current = node;
2760
+ }
2750
2761
  }, props), {
2751
2762
  sx: __spreadValues({
2752
2763
  position: "relative",
@@ -3639,14 +3650,14 @@ var clampEventToVisibleRange = (event2, currentDate, startHour, endHour) => {
3639
3650
 
3640
3651
  // src/Components/Calendario/Views/MonthView.tsx
3641
3652
  dayjs5.extend(localeData);
3642
- var MonthView = ({ events, isLoading, onDayClick, onMoreClick, currentDate, onEventClick, onEventHover }) => {
3653
+ var MonthView = ({ events, isLoading, onDayClick, onMoreClick, currentDate, onEventClick, onEventHover, seeDays = false }) => {
3643
3654
  const noEvents = events.length === 0;
3644
3655
  const days = getMonthDays(currentDate);
3645
3656
  const weekDays = Array.from({ length: 7 }, (_, i) => dayjs5().day(i));
3646
3657
  const [openDrawer, setOpenDrawer] = React28.useState(false);
3647
3658
  const [selectedDay, setSelectedDay] = React28.useState(null);
3648
3659
  const [selectedEvents, setSelectedEvents] = React28.useState([]);
3649
- return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Box16, { width: "100%", sx: { overflowX: "auto" } }, /* @__PURE__ */ React28.createElement(Box16, { minWidth: CALENDAR_CONSTANTS.MIN_WIDTH }, /* @__PURE__ */ React28.createElement(Box16, { display: "grid", gridTemplateColumns: CALENDAR_CONSTANTS.GRID_TEMPLATE, gap: 0.5, mb: 1 }, weekDays.map((day) => /* @__PURE__ */ React28.createElement(Box16, { key: day.day(), textAlign: "center", py: 0.5 }, /* @__PURE__ */ React28.createElement(Typography14, { variant: "caption", color: "text.secondary" }, day.format("dddd"))))), isLoading ? /* @__PURE__ */ React28.createElement(Box16, { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: CALENDAR_CONSTANTS.LOADING_CONTAINER_HEIGHT }, /* @__PURE__ */ React28.createElement(CircularProgress2, { sx: { width: CALENDAR_CONSTANTS.LOADING_SPINNER_SIZE, height: CALENDAR_CONSTANTS.LOADING_SPINNER_SIZE }, variant: "indeterminate" })) : !isLoading && noEvents ? /* @__PURE__ */ React28.createElement(
3660
+ return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Box16, { width: "100%", sx: { overflowX: "auto" } }, /* @__PURE__ */ React28.createElement(Box16, { minWidth: CALENDAR_CONSTANTS.MIN_WIDTH }, /* @__PURE__ */ React28.createElement(Box16, { display: "grid", gridTemplateColumns: CALENDAR_CONSTANTS.GRID_TEMPLATE, gap: 0.5, mb: 1 }, weekDays.map((day) => /* @__PURE__ */ React28.createElement(Box16, { key: day.day(), textAlign: "center", py: 0.5 }, /* @__PURE__ */ React28.createElement(Typography14, { variant: "caption", color: "text.secondary" }, day.format("dddd"))))), isLoading ? /* @__PURE__ */ React28.createElement(Box16, { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: CALENDAR_CONSTANTS.LOADING_CONTAINER_HEIGHT }, /* @__PURE__ */ React28.createElement(CircularProgress2, { sx: { width: CALENDAR_CONSTANTS.LOADING_SPINNER_SIZE, height: CALENDAR_CONSTANTS.LOADING_SPINNER_SIZE }, variant: "indeterminate" })) : seeDays == false ? /* @__PURE__ */ React28.createElement(
3650
3661
  EmptyState,
3651
3662
  {
3652
3663
  containerHeight: "calc(100vh - 130px)",
@@ -3654,7 +3665,7 @@ var MonthView = ({ events, isLoading, onDayClick, onMoreClick, currentDate, onEv
3654
3665
  subtitle: "Selecciona un mec\xE1nico y as\xEDgnale las actividades a realizar.",
3655
3666
  icon: /* @__PURE__ */ React28.createElement(LogoCalendario, null)
3656
3667
  }
3657
- ) : /* @__PURE__ */ React28.createElement(Box16, { display: "grid", gridTemplateColumns: CALENDAR_CONSTANTS.GRID_TEMPLATE, gap: 0.5 }, days.map((day) => {
3668
+ ) : seeDays == true ? /* @__PURE__ */ React28.createElement(Box16, { display: "grid", gridTemplateColumns: CALENDAR_CONSTANTS.GRID_TEMPLATE, gap: 0.5 }, days.map((day) => {
3658
3669
  const dayEvents = filterEventsForDay(events, day);
3659
3670
  const isCurrentMonth = day.month() === currentDate.month();
3660
3671
  return /* @__PURE__ */ React28.createElement(
@@ -3745,7 +3756,7 @@ var MonthView = ({ events, isLoading, onDayClick, onMoreClick, currentDate, onEv
3745
3756
  )
3746
3757
  )
3747
3758
  );
3748
- })))), selectedDay && /* @__PURE__ */ React28.createElement(
3759
+ })) : null)), selectedDay && /* @__PURE__ */ React28.createElement(
3749
3760
  SCDrawer,
3750
3761
  {
3751
3762
  width: CALENDAR_CONSTANTS.DRAWER_WIDTH,
@@ -3786,7 +3797,8 @@ var WeekView = ({
3786
3797
  onEventClick,
3787
3798
  onEventHover,
3788
3799
  startHour = 0,
3789
- endHour = 23
3800
+ endHour = 23,
3801
+ seeDays = false
3790
3802
  }) => {
3791
3803
  const noEvents = events.length === 0;
3792
3804
  const todayString = dayjs6().format("YYYY-MM-DD");
@@ -3830,7 +3842,7 @@ var WeekView = ({
3830
3842
  /* @__PURE__ */ React29.createElement(Typography15, { variant: "h6", color: "text.primary" }, day.format("D")),
3831
3843
  /* @__PURE__ */ React29.createElement(Typography15, { variant: "caption", color: "text.secondary" }, day.format("dddd"))
3832
3844
  );
3833
- })), isLoading ? /* @__PURE__ */ React29.createElement(Box17, { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "450px" }, /* @__PURE__ */ React29.createElement(CircularProgress3, { sx: { width: "60px", height: "60px" }, variant: "indeterminate" })) : !isLoading && noEvents ? /* @__PURE__ */ React29.createElement(
3845
+ })), isLoading ? /* @__PURE__ */ React29.createElement(Box17, { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "450px" }, /* @__PURE__ */ React29.createElement(CircularProgress3, { sx: { width: "60px", height: "60px" }, variant: "indeterminate" })) : !isLoading && seeDays == false ? /* @__PURE__ */ React29.createElement(
3834
3846
  EmptyState,
3835
3847
  {
3836
3848
  containerHeight: "calc(100vh - 130px)",
@@ -3923,12 +3935,13 @@ var DayView = ({
3923
3935
  onEventClick,
3924
3936
  onEventHover,
3925
3937
  startHour = CALENDAR_CONSTANTS.DEFAULT_START_HOUR,
3926
- endHour = CALENDAR_CONSTANTS.DEFAULT_END_HOUR
3938
+ endHour = CALENDAR_CONSTANTS.DEFAULT_END_HOUR,
3939
+ seeDays
3927
3940
  }) => {
3928
3941
  const hours = Array.from({ length: endHour - startHour + 1 }, (_, i) => startHour + i);
3929
3942
  const dayEvents = filterEventsForDay(events, currentDate);
3930
3943
  const noEvents = events.length === 0;
3931
- return /* @__PURE__ */ React30.createElement(Box18, { display: "flex", flexDirection: "column", height: "100%" }, /* @__PURE__ */ React30.createElement(Box18, { display: "flex", borderBottom: "1px solid", borderColor: "primary.main", bgcolor: "background.paper" }, /* @__PURE__ */ React30.createElement(Box18, { width: CALENDAR_CONSTANTS.SIDEBAR_WIDTH, bgcolor: "background.default", borderBottom: "1px solid", borderColor: "transparent" }), /* @__PURE__ */ React30.createElement(Box18, { flex: 1, display: "flex", flexDirection: "column", textAlign: "start", gap: 0.5, py: 1, bgcolor: "primary.50" }, /* @__PURE__ */ React30.createElement(Typography16, { variant: "h6", color: "text.secondary" }, currentDate.format("D")), /* @__PURE__ */ React30.createElement(Typography16, { variant: "caption", color: "text.secondary" }, currentDate.format("dddd")))), isLoading ? /* @__PURE__ */ React30.createElement(Box18, { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: CALENDAR_CONSTANTS.LOADING_CONTAINER_HEIGHT }, /* @__PURE__ */ React30.createElement(CircularProgress4, { sx: { width: CALENDAR_CONSTANTS.LOADING_SPINNER_SIZE, height: CALENDAR_CONSTANTS.LOADING_SPINNER_SIZE }, variant: "indeterminate" })) : noEvents ? /* @__PURE__ */ React30.createElement(
3944
+ return /* @__PURE__ */ React30.createElement(Box18, { display: "flex", flexDirection: "column", height: "100%" }, /* @__PURE__ */ React30.createElement(Box18, { display: "flex", borderBottom: "1px solid", borderColor: "primary.main", bgcolor: "background.paper" }, /* @__PURE__ */ React30.createElement(Box18, { width: CALENDAR_CONSTANTS.SIDEBAR_WIDTH, bgcolor: "background.default", borderBottom: "1px solid", borderColor: "transparent" }), /* @__PURE__ */ React30.createElement(Box18, { flex: 1, display: "flex", flexDirection: "column", textAlign: "start", gap: 0.5, py: 1, bgcolor: "primary.50" }, /* @__PURE__ */ React30.createElement(Typography16, { variant: "h6", color: "text.secondary" }, currentDate.format("D")), /* @__PURE__ */ React30.createElement(Typography16, { variant: "caption", color: "text.secondary" }, currentDate.format("dddd")))), isLoading ? /* @__PURE__ */ React30.createElement(Box18, { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: CALENDAR_CONSTANTS.LOADING_CONTAINER_HEIGHT }, /* @__PURE__ */ React30.createElement(CircularProgress4, { sx: { width: CALENDAR_CONSTANTS.LOADING_SPINNER_SIZE, height: CALENDAR_CONSTANTS.LOADING_SPINNER_SIZE }, variant: "indeterminate" })) : seeDays == false ? /* @__PURE__ */ React30.createElement(
3932
3945
  EmptyState,
3933
3946
  {
3934
3947
  containerHeight: "calc(100vh - 140px)",
@@ -4043,7 +4056,8 @@ var Calendar = ({
4043
4056
  toolbar,
4044
4057
  isLoading = false,
4045
4058
  startHour = CALENDAR_CONSTANTS.DEFAULT_START_HOUR,
4046
- endHour = CALENDAR_CONSTANTS.DEFAULT_END_HOUR
4059
+ endHour = CALENDAR_CONSTANTS.DEFAULT_END_HOUR,
4060
+ seeDays = false
4047
4061
  }) => {
4048
4062
  const [view, setView] = useState14(initialView);
4049
4063
  const { currentDate, navigateDate } = useCalendarNavigation(dayjs9(), onDateChange);
@@ -4092,7 +4106,8 @@ var Calendar = ({
4092
4106
  onDayClick,
4093
4107
  onMoreClick,
4094
4108
  onEventClick,
4095
- onEventHover
4109
+ onEventHover,
4110
+ seeDays
4096
4111
  }
4097
4112
  ), view === "week" && /* @__PURE__ */ React31.createElement(
4098
4113
  WeekView,
@@ -4104,7 +4119,8 @@ var Calendar = ({
4104
4119
  onEventClick,
4105
4120
  onEventHover,
4106
4121
  startHour,
4107
- endHour
4122
+ endHour,
4123
+ seeDays
4108
4124
  }
4109
4125
  ), view === "day" && /* @__PURE__ */ React31.createElement(
4110
4126
  DayView,
@@ -4114,7 +4130,8 @@ var Calendar = ({
4114
4130
  onEventClick,
4115
4131
  onEventHover,
4116
4132
  startHour,
4117
- endHour
4133
+ endHour,
4134
+ seeDays
4118
4135
  }
4119
4136
  )));
4120
4137
  };