@mlw-packages/react-components 1.10.23 → 1.10.24

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
@@ -1018,6 +1018,7 @@ interface EventCalendarProps$1 {
1018
1018
  className?: string;
1019
1019
  initialView?: CalendarViewAgenda;
1020
1020
  initialDate?: Date;
1021
+ optionsViewEvents?: CalendarViewAgenda[];
1021
1022
  onClick?: ((event: CalendarEventAgenda, e?: React__default.MouseEvent) => void) | React__default.ReactElement<ModalLikeProps>;
1022
1023
  showYearView?: boolean;
1023
1024
  noTime?: boolean;
@@ -1033,7 +1034,7 @@ interface ModalLikeProps {
1033
1034
  onClose?: () => void;
1034
1035
  [key: string]: unknown;
1035
1036
  }
1036
- declare function EventAgenda({ events, onEventUpdate, className, initialView, initialDate, onClick, showYearView, noTime, onlyDay, onlyMonth, onlyWeek, onlyAgenda, onlyYear, allowCellClick, }: EventCalendarProps$1): react_jsx_runtime.JSX.Element;
1037
+ declare function EventAgenda({ events, optionsViewEvents, onEventUpdate, className, initialView, initialDate, onClick, showYearView, noTime, onlyDay, onlyMonth, onlyWeek, onlyAgenda, onlyYear, allowCellClick, }: EventCalendarProps$1): react_jsx_runtime.JSX.Element;
1037
1038
 
1038
1039
  interface EventItemProps$1 {
1039
1040
  event: CalendarEventAgenda;
package/dist/index.d.ts CHANGED
@@ -1018,6 +1018,7 @@ interface EventCalendarProps$1 {
1018
1018
  className?: string;
1019
1019
  initialView?: CalendarViewAgenda;
1020
1020
  initialDate?: Date;
1021
+ optionsViewEvents?: CalendarViewAgenda[];
1021
1022
  onClick?: ((event: CalendarEventAgenda, e?: React__default.MouseEvent) => void) | React__default.ReactElement<ModalLikeProps>;
1022
1023
  showYearView?: boolean;
1023
1024
  noTime?: boolean;
@@ -1033,7 +1034,7 @@ interface ModalLikeProps {
1033
1034
  onClose?: () => void;
1034
1035
  [key: string]: unknown;
1035
1036
  }
1036
- declare function EventAgenda({ events, onEventUpdate, className, initialView, initialDate, onClick, showYearView, noTime, onlyDay, onlyMonth, onlyWeek, onlyAgenda, onlyYear, allowCellClick, }: EventCalendarProps$1): react_jsx_runtime.JSX.Element;
1037
+ declare function EventAgenda({ events, optionsViewEvents, onEventUpdate, className, initialView, initialDate, onClick, showYearView, noTime, onlyDay, onlyMonth, onlyWeek, onlyAgenda, onlyYear, allowCellClick, }: EventCalendarProps$1): react_jsx_runtime.JSX.Element;
1037
1038
 
1038
1039
  interface EventItemProps$1 {
1039
1040
  event: CalendarEventAgenda;
package/dist/index.js CHANGED
@@ -10227,6 +10227,7 @@ function Select({
10227
10227
  }
10228
10228
  function EventAgenda({
10229
10229
  events = [],
10230
+ optionsViewEvents,
10230
10231
  onEventUpdate,
10231
10232
  className,
10232
10233
  initialView = "month",
@@ -10239,7 +10240,7 @@ function EventAgenda({
10239
10240
  onlyWeek,
10240
10241
  onlyAgenda,
10241
10242
  onlyYear,
10242
- allowCellClick = false
10243
+ allowCellClick = true
10243
10244
  }) {
10244
10245
  const lockedView = onlyDay ? "day" : onlyMonth ? "month" : onlyWeek ? "week" : onlyAgenda ? "agenda" : onlyYear ? "year" : void 0;
10245
10246
  const [currentDate, setCurrentDate] = React32.useState(
@@ -10334,7 +10335,10 @@ function EventAgenda({
10334
10335
  }
10335
10336
  return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10336
10337
  }, [currentDate, activeView]);
10337
- const availableViews = showYearView ? ["year", "month", "week", "day", "agenda"] : ["month", "week", "day", "agenda"];
10338
+ let availableViews;
10339
+ if (optionsViewEvents?.length == 0 || !optionsViewEvents)
10340
+ availableViews = showYearView ? ["year", "month", "week", "day", "agenda"] : ["month", "week", "day", "agenda"];
10341
+ else availableViews = [...new Set(optionsViewEvents.map((options) => options))];
10338
10342
  const selectItems = availableViews.map(
10339
10343
  (v) => ({
10340
10344
  label: viewLabel(v),
@@ -10433,12 +10437,7 @@ function EventAgenda({
10433
10437
  events,
10434
10438
  onEventSelect: handleEventSelect,
10435
10439
  noTime,
10436
- onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10437
- start: d,
10438
- end: d,
10439
- title: "Novo Evento",
10440
- id: crypto.randomUUID()
10441
- }) : void 0
10440
+ onEventCreate: allowCellClick ? (d) => console.log(d) : void 0
10442
10441
  }
10443
10442
  ),
10444
10443
  activeView === "agenda" && /* @__PURE__ */ jsxRuntime.jsx(
package/dist/index.mjs CHANGED
@@ -10185,6 +10185,7 @@ function Select({
10185
10185
  }
10186
10186
  function EventAgenda({
10187
10187
  events = [],
10188
+ optionsViewEvents,
10188
10189
  onEventUpdate,
10189
10190
  className,
10190
10191
  initialView = "month",
@@ -10197,7 +10198,7 @@ function EventAgenda({
10197
10198
  onlyWeek,
10198
10199
  onlyAgenda,
10199
10200
  onlyYear,
10200
- allowCellClick = false
10201
+ allowCellClick = true
10201
10202
  }) {
10202
10203
  const lockedView = onlyDay ? "day" : onlyMonth ? "month" : onlyWeek ? "week" : onlyAgenda ? "agenda" : onlyYear ? "year" : void 0;
10203
10204
  const [currentDate, setCurrentDate] = useState(
@@ -10292,7 +10293,10 @@ function EventAgenda({
10292
10293
  }
10293
10294
  return capitalize2(format(currentDate, "MMMM yyyy", { locale: ptBR }));
10294
10295
  }, [currentDate, activeView]);
10295
- const availableViews = showYearView ? ["year", "month", "week", "day", "agenda"] : ["month", "week", "day", "agenda"];
10296
+ let availableViews;
10297
+ if (optionsViewEvents?.length == 0 || !optionsViewEvents)
10298
+ availableViews = showYearView ? ["year", "month", "week", "day", "agenda"] : ["month", "week", "day", "agenda"];
10299
+ else availableViews = [...new Set(optionsViewEvents.map((options) => options))];
10296
10300
  const selectItems = availableViews.map(
10297
10301
  (v) => ({
10298
10302
  label: viewLabel(v),
@@ -10391,12 +10395,7 @@ function EventAgenda({
10391
10395
  events,
10392
10396
  onEventSelect: handleEventSelect,
10393
10397
  noTime,
10394
- onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10395
- start: d,
10396
- end: d,
10397
- title: "Novo Evento",
10398
- id: crypto.randomUUID()
10399
- }) : void 0
10398
+ onEventCreate: allowCellClick ? (d) => console.log(d) : void 0
10400
10399
  }
10401
10400
  ),
10402
10401
  activeView === "agenda" && /* @__PURE__ */ jsx(
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "access": "public",
6
6
  "type": "module"
7
7
  },
8
- "version": "1.10.23",
8
+ "version": "1.10.24",
9
9
  "homepage": "https://main--68e80310a069c2f10b546ef3.chromatic.com/",
10
10
  "repository": {
11
11
  "type": "git",