@mlw-packages/react-components 1.10.31 → 1.10.32

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.mts CHANGED
@@ -1007,8 +1007,9 @@ interface DayViewProps$1 {
1007
1007
  noTime?: boolean;
1008
1008
  allDayCell?: boolean;
1009
1009
  onEventCreate?: (startTime: Date) => void;
1010
+ timePlus?: number;
1010
1011
  }
1011
- declare function DayViewAgenda({ currentDate, events, onEventSelect, showUndatedEvents, noTime, onEventCreate, allDayCell, }: DayViewProps$1): react_jsx_runtime.JSX.Element;
1012
+ declare function DayViewAgenda({ currentDate, events, onEventSelect, showUndatedEvents, noTime, onEventCreate, allDayCell, timePlus }: DayViewProps$1): react_jsx_runtime.JSX.Element;
1012
1013
 
1013
1014
  interface DroppableCellProps$1 {
1014
1015
  id: string;
@@ -1037,13 +1038,14 @@ interface EventCalendarProps$1 {
1037
1038
  onlyYear?: boolean;
1038
1039
  allowCellClick?: boolean;
1039
1040
  allDayCell?: boolean;
1041
+ timePlus?: number;
1040
1042
  }
1041
1043
  interface ModalLikeProps {
1042
1044
  event?: CalendarEventAgenda;
1043
1045
  onClose?: () => void;
1044
1046
  [key: string]: unknown;
1045
1047
  }
1046
- declare function EventAgenda({ events, optionsViewEvents, onEventUpdate, className, initialView, initialDate, onClick, showYearView, noTime, onlyDay, onlyMonth, onlyWeek, onlyAgenda, onlyYear, allowCellClick, allDayCell, }: EventCalendarProps$1): react_jsx_runtime.JSX.Element;
1048
+ declare function EventAgenda({ events, optionsViewEvents, onEventUpdate, className, initialView, initialDate, onClick, showYearView, noTime, onlyDay, onlyMonth, onlyWeek, onlyAgenda, onlyYear, allowCellClick, allDayCell, timePlus }: EventCalendarProps$1): react_jsx_runtime.JSX.Element;
1047
1049
 
1048
1050
  interface EventItemProps$1 {
1049
1051
  event: CalendarEventAgenda;
@@ -1159,8 +1161,9 @@ interface WeekViewProps$1 {
1159
1161
  allDayCell?: boolean;
1160
1162
  /** When true, hides event times */
1161
1163
  noTime?: boolean;
1164
+ timePlus?: number;
1162
1165
  }
1163
- declare function WeekViewAgenda({ currentDate, events, onEventSelect, allDayCell, onEventCreate, showUndatedEvents, noTime, }: WeekViewProps$1): react_jsx_runtime.JSX.Element;
1166
+ declare function WeekViewAgenda({ currentDate, events, onEventSelect, allDayCell, onEventCreate, showUndatedEvents, noTime, timePlus }: WeekViewProps$1): react_jsx_runtime.JSX.Element;
1164
1167
 
1165
1168
  interface YearViewProps {
1166
1169
  currentDate: Date;
package/dist/index.d.ts CHANGED
@@ -1007,8 +1007,9 @@ interface DayViewProps$1 {
1007
1007
  noTime?: boolean;
1008
1008
  allDayCell?: boolean;
1009
1009
  onEventCreate?: (startTime: Date) => void;
1010
+ timePlus?: number;
1010
1011
  }
1011
- declare function DayViewAgenda({ currentDate, events, onEventSelect, showUndatedEvents, noTime, onEventCreate, allDayCell, }: DayViewProps$1): react_jsx_runtime.JSX.Element;
1012
+ declare function DayViewAgenda({ currentDate, events, onEventSelect, showUndatedEvents, noTime, onEventCreate, allDayCell, timePlus }: DayViewProps$1): react_jsx_runtime.JSX.Element;
1012
1013
 
1013
1014
  interface DroppableCellProps$1 {
1014
1015
  id: string;
@@ -1037,13 +1038,14 @@ interface EventCalendarProps$1 {
1037
1038
  onlyYear?: boolean;
1038
1039
  allowCellClick?: boolean;
1039
1040
  allDayCell?: boolean;
1041
+ timePlus?: number;
1040
1042
  }
1041
1043
  interface ModalLikeProps {
1042
1044
  event?: CalendarEventAgenda;
1043
1045
  onClose?: () => void;
1044
1046
  [key: string]: unknown;
1045
1047
  }
1046
- declare function EventAgenda({ events, optionsViewEvents, onEventUpdate, className, initialView, initialDate, onClick, showYearView, noTime, onlyDay, onlyMonth, onlyWeek, onlyAgenda, onlyYear, allowCellClick, allDayCell, }: EventCalendarProps$1): react_jsx_runtime.JSX.Element;
1048
+ declare function EventAgenda({ events, optionsViewEvents, onEventUpdate, className, initialView, initialDate, onClick, showYearView, noTime, onlyDay, onlyMonth, onlyWeek, onlyAgenda, onlyYear, allowCellClick, allDayCell, timePlus }: EventCalendarProps$1): react_jsx_runtime.JSX.Element;
1047
1049
 
1048
1050
  interface EventItemProps$1 {
1049
1051
  event: CalendarEventAgenda;
@@ -1159,8 +1161,9 @@ interface WeekViewProps$1 {
1159
1161
  allDayCell?: boolean;
1160
1162
  /** When true, hides event times */
1161
1163
  noTime?: boolean;
1164
+ timePlus?: number;
1162
1165
  }
1163
- declare function WeekViewAgenda({ currentDate, events, onEventSelect, allDayCell, onEventCreate, showUndatedEvents, noTime, }: WeekViewProps$1): react_jsx_runtime.JSX.Element;
1166
+ declare function WeekViewAgenda({ currentDate, events, onEventSelect, allDayCell, onEventCreate, showUndatedEvents, noTime, timePlus }: WeekViewProps$1): react_jsx_runtime.JSX.Element;
1164
1167
 
1165
1168
  interface YearViewProps {
1166
1169
  currentDate: Date;
package/dist/index.js CHANGED
@@ -9871,6 +9871,12 @@ function AllDayStack({
9871
9871
  }
9872
9872
  );
9873
9873
  }
9874
+
9875
+ // src/components/ui/event-calendar-view/helpers.ts
9876
+ var formatterDate = Intl.DateTimeFormat("pt-BR", {
9877
+ minute: "numeric",
9878
+ hour: "numeric"
9879
+ });
9874
9880
  function DayViewAgenda({
9875
9881
  currentDate,
9876
9882
  events,
@@ -9878,7 +9884,8 @@ function DayViewAgenda({
9878
9884
  showUndatedEvents,
9879
9885
  noTime = false,
9880
9886
  onEventCreate,
9881
- allDayCell = false
9887
+ allDayCell = false,
9888
+ timePlus
9882
9889
  }) {
9883
9890
  const [expandedDay, setExpandedDay] = React32.useState(null);
9884
9891
  const hours = React32.useMemo(() => {
@@ -10187,6 +10194,11 @@ function DayViewAgenda({
10187
10194
  const startTime = new Date(currentDate);
10188
10195
  startTime.setHours(hourValue);
10189
10196
  startTime.setMinutes(quarter * 15);
10197
+ if (timePlus) {
10198
+ const eventsOnHour = positionedEvents.filter((evt) => formatterDate.format(evt.event.start).split(":")[0] == formatterDate.format(startTime).split(":")[0]).findLast((evt) => parseInt(formatterDate.format(evt.event.start).split(":")[1]) <= parseInt(formatterDate.format(startTime).split(":")[1]));
10199
+ if (eventsOnHour)
10200
+ startTime.setMinutes((eventsOnHour?.event?.end?.getMinutes() ?? 0) + timePlus);
10201
+ }
10190
10202
  if (onEventCreate) onEventCreate(startTime);
10191
10203
  },
10192
10204
  time: quarterHourTime
@@ -10453,7 +10465,8 @@ function EventAgenda({
10453
10465
  onlyAgenda,
10454
10466
  onlyYear,
10455
10467
  allowCellClick = true,
10456
- allDayCell = false
10468
+ allDayCell = false,
10469
+ timePlus
10457
10470
  }) {
10458
10471
  const lockedView = onlyDay ? "day" : onlyMonth ? "month" : onlyWeek ? "week" : onlyAgenda ? "agenda" : onlyYear ? "year" : void 0;
10459
10472
  const [currentDate, setCurrentDate] = React32.useState(
@@ -10635,6 +10648,7 @@ function EventAgenda({
10635
10648
  onEventSelect: handleEventSelect,
10636
10649
  noTime,
10637
10650
  allDayCell,
10651
+ timePlus,
10638
10652
  onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10639
10653
  start: d,
10640
10654
  end: d,
@@ -10651,6 +10665,7 @@ function EventAgenda({
10651
10665
  onEventSelect: handleEventSelect,
10652
10666
  noTime,
10653
10667
  allDayCell,
10668
+ timePlus,
10654
10669
  onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10655
10670
  start: d,
10656
10671
  end: d,
@@ -11360,7 +11375,8 @@ function WeekViewAgenda({
11360
11375
  allDayCell = false,
11361
11376
  onEventCreate,
11362
11377
  showUndatedEvents,
11363
- noTime = false
11378
+ noTime = false,
11379
+ timePlus
11364
11380
  }) {
11365
11381
  const [expandedDay, setExpandedDay] = React32.useState(null);
11366
11382
  const days = React32.useMemo(() => {
@@ -11770,6 +11786,11 @@ function WeekViewAgenda({
11770
11786
  const startTime = new Date(day);
11771
11787
  startTime.setHours(hourValue);
11772
11788
  startTime.setMinutes(quarter * 15);
11789
+ if (timePlus) {
11790
+ const eventsOnHour = processedDayEvents[dayIndex].filter((evt) => formatterDate.format(evt.event.start).split(":")[0] == formatterDate.format(startTime).split(":")[0]).findLast((evt) => parseInt(formatterDate.format(evt.event.start).split(":")[1]) <= parseInt(formatterDate.format(startTime).split(":")[1]));
11791
+ if (eventsOnHour)
11792
+ startTime.setMinutes((eventsOnHour?.event?.end?.getMinutes() ?? 0) + timePlus);
11793
+ }
11773
11794
  if (onEventCreate) onEventCreate(startTime);
11774
11795
  },
11775
11796
  time: quarterHourTime
package/dist/index.mjs CHANGED
@@ -9829,6 +9829,12 @@ function AllDayStack({
9829
9829
  }
9830
9830
  );
9831
9831
  }
9832
+
9833
+ // src/components/ui/event-calendar-view/helpers.ts
9834
+ var formatterDate = Intl.DateTimeFormat("pt-BR", {
9835
+ minute: "numeric",
9836
+ hour: "numeric"
9837
+ });
9832
9838
  function DayViewAgenda({
9833
9839
  currentDate,
9834
9840
  events,
@@ -9836,7 +9842,8 @@ function DayViewAgenda({
9836
9842
  showUndatedEvents,
9837
9843
  noTime = false,
9838
9844
  onEventCreate,
9839
- allDayCell = false
9845
+ allDayCell = false,
9846
+ timePlus
9840
9847
  }) {
9841
9848
  const [expandedDay, setExpandedDay] = useState(null);
9842
9849
  const hours = useMemo(() => {
@@ -10145,6 +10152,11 @@ function DayViewAgenda({
10145
10152
  const startTime = new Date(currentDate);
10146
10153
  startTime.setHours(hourValue);
10147
10154
  startTime.setMinutes(quarter * 15);
10155
+ if (timePlus) {
10156
+ const eventsOnHour = positionedEvents.filter((evt) => formatterDate.format(evt.event.start).split(":")[0] == formatterDate.format(startTime).split(":")[0]).findLast((evt) => parseInt(formatterDate.format(evt.event.start).split(":")[1]) <= parseInt(formatterDate.format(startTime).split(":")[1]));
10157
+ if (eventsOnHour)
10158
+ startTime.setMinutes((eventsOnHour?.event?.end?.getMinutes() ?? 0) + timePlus);
10159
+ }
10148
10160
  if (onEventCreate) onEventCreate(startTime);
10149
10161
  },
10150
10162
  time: quarterHourTime
@@ -10411,7 +10423,8 @@ function EventAgenda({
10411
10423
  onlyAgenda,
10412
10424
  onlyYear,
10413
10425
  allowCellClick = true,
10414
- allDayCell = false
10426
+ allDayCell = false,
10427
+ timePlus
10415
10428
  }) {
10416
10429
  const lockedView = onlyDay ? "day" : onlyMonth ? "month" : onlyWeek ? "week" : onlyAgenda ? "agenda" : onlyYear ? "year" : void 0;
10417
10430
  const [currentDate, setCurrentDate] = useState(
@@ -10593,6 +10606,7 @@ function EventAgenda({
10593
10606
  onEventSelect: handleEventSelect,
10594
10607
  noTime,
10595
10608
  allDayCell,
10609
+ timePlus,
10596
10610
  onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10597
10611
  start: d,
10598
10612
  end: d,
@@ -10609,6 +10623,7 @@ function EventAgenda({
10609
10623
  onEventSelect: handleEventSelect,
10610
10624
  noTime,
10611
10625
  allDayCell,
10626
+ timePlus,
10612
10627
  onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10613
10628
  start: d,
10614
10629
  end: d,
@@ -11318,7 +11333,8 @@ function WeekViewAgenda({
11318
11333
  allDayCell = false,
11319
11334
  onEventCreate,
11320
11335
  showUndatedEvents,
11321
- noTime = false
11336
+ noTime = false,
11337
+ timePlus
11322
11338
  }) {
11323
11339
  const [expandedDay, setExpandedDay] = useState(null);
11324
11340
  const days = useMemo(() => {
@@ -11728,6 +11744,11 @@ function WeekViewAgenda({
11728
11744
  const startTime = new Date(day);
11729
11745
  startTime.setHours(hourValue);
11730
11746
  startTime.setMinutes(quarter * 15);
11747
+ if (timePlus) {
11748
+ const eventsOnHour = processedDayEvents[dayIndex].filter((evt) => formatterDate.format(evt.event.start).split(":")[0] == formatterDate.format(startTime).split(":")[0]).findLast((evt) => parseInt(formatterDate.format(evt.event.start).split(":")[1]) <= parseInt(formatterDate.format(startTime).split(":")[1]));
11749
+ if (eventsOnHour)
11750
+ startTime.setMinutes((eventsOnHour?.event?.end?.getMinutes() ?? 0) + timePlus);
11751
+ }
11731
11752
  if (onEventCreate) onEventCreate(startTime);
11732
11753
  },
11733
11754
  time: quarterHourTime
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "access": "public",
6
6
  "type": "module"
7
7
  },
8
- "version": "1.10.31",
8
+ "version": "1.10.32",
9
9
  "homepage": "https://main--68e80310a069c2f10b546ef3.chromatic.com/",
10
10
  "repository": {
11
11
  "type": "git",