@mlw-packages/react-components 1.10.30 → 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.js CHANGED
@@ -9795,6 +9795,88 @@ function DroppableCellAgenda({
9795
9795
  }
9796
9796
  );
9797
9797
  }
9798
+ var PEEK_HEIGHT = 22;
9799
+ var PADDING = 6;
9800
+ function AllDayStack({
9801
+ day,
9802
+ events,
9803
+ expandedDay,
9804
+ onExpand,
9805
+ onEventSelect,
9806
+ noTime
9807
+ }) {
9808
+ const isExpanded = expandedDay ? dateFns.isSameDay(expandedDay, day) : false;
9809
+ const containerRef = React32.useRef(null);
9810
+ React32.useEffect(() => {
9811
+ if (!isExpanded) return;
9812
+ const handler = (e) => {
9813
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
9814
+ onExpand(null);
9815
+ }
9816
+ };
9817
+ document.addEventListener("mousedown", handler);
9818
+ return () => document.removeEventListener("mousedown", handler);
9819
+ }, [isExpanded, onExpand]);
9820
+ if (events.length === 0) return null;
9821
+ const single = events.length === 1;
9822
+ return /* @__PURE__ */ jsxRuntime.jsx(
9823
+ "div",
9824
+ {
9825
+ className: "absolute inset-0",
9826
+ ref: containerRef,
9827
+ style: { zIndex: isExpanded ? 50 : 10 },
9828
+ children: events.map((event, i) => {
9829
+ const top = PADDING + i * PEEK_HEIGHT;
9830
+ const bottom = PADDING;
9831
+ const zIndex = i + 1;
9832
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { delayDuration: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
9833
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
9834
+ "div",
9835
+ {
9836
+ className: "absolute left-1.5 right-1.5 cursor-pointer",
9837
+ style: { top, bottom, zIndex },
9838
+ onClick: (e) => {
9839
+ e.stopPropagation();
9840
+ if (isExpanded || single) {
9841
+ onEventSelect(event, e);
9842
+ } else {
9843
+ onExpand(day);
9844
+ }
9845
+ },
9846
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9847
+ EventItemAgenda,
9848
+ {
9849
+ event,
9850
+ isFirstDay: true,
9851
+ isLastDay: true,
9852
+ view: "day",
9853
+ noTime,
9854
+ className: "flex justify-start items-start rounded-sm py-1 h-full w-full pointer-events-none"
9855
+ }
9856
+ )
9857
+ }
9858
+ ) }),
9859
+ /* @__PURE__ */ jsxRuntime.jsxs(TooltipContentBase, { side: "top", sideOffset: 6, className: "max-w-[220px] space-y-0.5", children: [
9860
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-sm leading-snug", children: event.title }),
9861
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-90", children: formatDurationAgenda(event) }),
9862
+ event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs flex items-center gap-2", children: [
9863
+ /* @__PURE__ */ jsxRuntime.jsx(ssr.MapPinIcon, { size: 15 }),
9864
+ " ",
9865
+ event.location
9866
+ ] }),
9867
+ event.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-75 line-clamp-2", children: event.description })
9868
+ ] })
9869
+ ] }) }, event.id);
9870
+ })
9871
+ }
9872
+ );
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
+ });
9798
9880
  function DayViewAgenda({
9799
9881
  currentDate,
9800
9882
  events,
@@ -9802,8 +9884,10 @@ function DayViewAgenda({
9802
9884
  showUndatedEvents,
9803
9885
  noTime = false,
9804
9886
  onEventCreate,
9805
- allDayCell = false
9887
+ allDayCell = false,
9888
+ timePlus
9806
9889
  }) {
9890
+ const [expandedDay, setExpandedDay] = React32.useState(null);
9807
9891
  const hours = React32.useMemo(() => {
9808
9892
  const dayStart = dateFns.startOfDay(currentDate);
9809
9893
  return dateFns.eachHourOfInterval({
@@ -9964,52 +10048,17 @@ function DayViewAgenda({
9964
10048
  hour.toString()
9965
10049
  )) }),
9966
10050
  showAllDaySection && allDayCell ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
9967
- allDayEvents.map((event) => {
9968
- const eventStart = new Date(event.start);
9969
- const eventEnd = new Date(new Date(event.end).setHours(23, 59));
9970
- const isFirstDay = dateFns.isSameDay(currentDate, eventStart);
9971
- const isLastDay = dateFns.isSameDay(currentDate, eventEnd);
9972
- return /* @__PURE__ */ jsxRuntime.jsx(
9973
- "div",
9974
- {
9975
- className: "absolute z-10 px-0.5",
9976
- style: { height: "100%", width: "100%", padding: "10px" },
9977
- children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { delayDuration: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
9978
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full", children: /* @__PURE__ */ jsxRuntime.jsx(
9979
- EventItemAgenda,
9980
- {
9981
- event,
9982
- view: "day",
9983
- isFirstDay,
9984
- isLastDay,
9985
- onClick: (e) => handleEventClick(event, e),
9986
- noTime,
9987
- className: "flex justify-start items-start rounded-sm p-2"
9988
- }
9989
- ) }) }),
9990
- /* @__PURE__ */ jsxRuntime.jsxs(
9991
- TooltipContentBase,
9992
- {
9993
- side: "top",
9994
- sideOffset: 6,
9995
- className: "max-w-[220px] space-y-0.5",
9996
- children: [
9997
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-sm leading-snug", children: event.title }),
9998
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-90", children: formatDurationAgenda(event) }),
9999
- event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs flex items-center gap-2", children: [
10000
- /* @__PURE__ */ jsxRuntime.jsx(react.MapPinIcon, { size: 15 }),
10001
- " ",
10002
- event.location
10003
- ] }),
10004
- event.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-75 line-clamp-2", children: event.description })
10005
- ]
10006
- }
10007
- )
10008
- ] }) })
10009
- },
10010
- `spanning-${event.id}`
10011
- );
10012
- }),
10051
+ /* @__PURE__ */ jsxRuntime.jsx(
10052
+ AllDayStack,
10053
+ {
10054
+ day: currentDate,
10055
+ events: allDayEvents,
10056
+ expandedDay,
10057
+ onExpand: setExpandedDay,
10058
+ onEventSelect: handleEventClick,
10059
+ noTime
10060
+ }
10061
+ ),
10013
10062
  currentTimeVisible && /* @__PURE__ */ jsxRuntime.jsx(
10014
10063
  "div",
10015
10064
  {
@@ -10145,6 +10194,11 @@ function DayViewAgenda({
10145
10194
  const startTime = new Date(currentDate);
10146
10195
  startTime.setHours(hourValue);
10147
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
+ }
10148
10202
  if (onEventCreate) onEventCreate(startTime);
10149
10203
  },
10150
10204
  time: quarterHourTime
@@ -10411,7 +10465,8 @@ function EventAgenda({
10411
10465
  onlyAgenda,
10412
10466
  onlyYear,
10413
10467
  allowCellClick = true,
10414
- allDayCell = false
10468
+ allDayCell = false,
10469
+ timePlus
10415
10470
  }) {
10416
10471
  const lockedView = onlyDay ? "day" : onlyMonth ? "month" : onlyWeek ? "week" : onlyAgenda ? "agenda" : onlyYear ? "year" : void 0;
10417
10472
  const [currentDate, setCurrentDate] = React32.useState(
@@ -10593,6 +10648,7 @@ function EventAgenda({
10593
10648
  onEventSelect: handleEventSelect,
10594
10649
  noTime,
10595
10650
  allDayCell,
10651
+ timePlus,
10596
10652
  onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10597
10653
  start: d,
10598
10654
  end: d,
@@ -10609,6 +10665,7 @@ function EventAgenda({
10609
10665
  onEventSelect: handleEventSelect,
10610
10666
  noTime,
10611
10667
  allDayCell,
10668
+ timePlus,
10612
10669
  onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10613
10670
  start: d,
10614
10671
  end: d,
@@ -11318,8 +11375,10 @@ function WeekViewAgenda({
11318
11375
  allDayCell = false,
11319
11376
  onEventCreate,
11320
11377
  showUndatedEvents,
11321
- noTime = false
11378
+ noTime = false,
11379
+ timePlus
11322
11380
  }) {
11381
+ const [expandedDay, setExpandedDay] = React32.useState(null);
11323
11382
  const days = React32.useMemo(() => {
11324
11383
  const weekStart = dateFns.startOfWeek(currentDate, { weekStartsOn: 0 });
11325
11384
  const weekEnd = dateFns.endOfWeek(currentDate, { weekStartsOn: 0 });
@@ -11366,11 +11425,6 @@ function WeekViewAgenda({
11366
11425
  [allDayEvents]
11367
11426
  );
11368
11427
  const rowH = EventHeightAgenda + EventGapAgenda;
11369
- const allDayBarData = React32.useMemo(() => {
11370
- const bars = computeMultiDayBars(trueAllDayEvents, days);
11371
- const maxSlot = bars.length > 0 ? Math.max(...bars.map((b) => b.slot)) : 0;
11372
- return { bars, sectionH: (maxSlot + 1) * rowH + EventGapAgenda * 2 };
11373
- }, [trueAllDayEvents, days, rowH]);
11374
11428
  const multiDayBarData = React32.useMemo(() => {
11375
11429
  const bars = computeMultiDayBars(multiDayTimedEvents, days);
11376
11430
  const maxSlot = bars.length > 0 ? Math.max(...bars.map((b) => b.slot)) : 0;
@@ -11493,76 +11547,31 @@ function WeekViewAgenda({
11493
11547
  showAllDaySection && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border/70 border-b bg-muted/50", children: [
11494
11548
  trueAllDayEvents.length > 0 && !allDayCell && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-8", children: [
11495
11549
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative border-border/70 border-r flex items-center justify-center p-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-center text-[10px] text-muted-foreground/70 sm:text-xs", children: "Todo dia" }) }),
11496
- /* @__PURE__ */ jsxRuntime.jsxs(
11497
- "div",
11498
- {
11499
- className: "col-span-7 relative",
11500
- style: { height: allDayBarData.sectionH },
11501
- children: [
11502
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 grid grid-cols-7 pointer-events-none", children: days.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
11503
- "div",
11550
+ days.map((day) => {
11551
+ const dayEvents = trueAllDayEvents.filter((event) => {
11552
+ const start = getEventStartDate(event);
11553
+ return start ? dateFns.isSameDay(day, start) : false;
11554
+ });
11555
+ return /* @__PURE__ */ jsxRuntime.jsx(
11556
+ "div",
11557
+ {
11558
+ className: "relative border-r last:border-r-0 border-border/70 overflow-visible py-0.5",
11559
+ "data-today": dateFns.isToday(day) || void 0,
11560
+ children: /* @__PURE__ */ jsxRuntime.jsx(
11561
+ AllDayStack,
11504
11562
  {
11505
- className: "border-r last:border-r-0 border-border/70",
11506
- "data-today": dateFns.isToday(day) || void 0
11507
- },
11508
- day.toString()
11509
- )) }),
11510
- allDayBarData.bars.map((bar) => {
11511
- const {
11512
- event,
11513
- colStart,
11514
- colSpan,
11515
- isFirstDay,
11516
- isLastDay,
11517
- slot
11518
- } = bar;
11519
- const showTitle = isFirstDay || !isFirstDay && colStart === 0;
11520
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { delayDuration: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
11521
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
11522
- "div",
11523
- {
11524
- className: "absolute px-0.5",
11525
- style: {
11526
- left: `calc(${colStart / 7 * 100}% + 2px)`,
11527
- width: `calc(${colSpan / 7 * 100}% - 4px)`,
11528
- top: EventGapAgenda + slot * rowH,
11529
- height: EventHeightAgenda
11530
- },
11531
- children: /* @__PURE__ */ jsxRuntime.jsx(
11532
- EventItemAgenda,
11533
- {
11534
- event,
11535
- isFirstDay,
11536
- isLastDay,
11537
- onClick: (e) => {
11538
- e.stopPropagation();
11539
- handleEventClick(event, e);
11540
- },
11541
- view: "month",
11542
- className: "h-full",
11543
- children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 min-w-0 w-full", children: [
11544
- !isFirstDay && colStart === 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[11px] font-bold opacity-60", children: /* @__PURE__ */ jsxRuntime.jsx(ssr.CaretLeftIcon, {}) }),
11545
- showTitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-medium", children: event.title }),
11546
- !isLastDay && colStart + colSpan === 7 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 ml-auto text-[11px] font-bold opacity-60", children: /* @__PURE__ */ jsxRuntime.jsx(ssr.CaretRightIcon, {}) })
11547
- ] })
11548
- }
11549
- )
11550
- }
11551
- ) }),
11552
- /* @__PURE__ */ jsxRuntime.jsxs(TooltipContentBase, { side: "top", children: [
11553
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold truncate max-w-[200px]", children: event.title }),
11554
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "opacity-80 mt-0.5 leading-snug", children: formatDurationAgenda(event) }),
11555
- event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "opacity-60 mt-0.5 truncate text-[11px] max-w-[200px] flex items-center gap-1", children: [
11556
- /* @__PURE__ */ jsxRuntime.jsx(ssr.MapPinIcon, { size: 14 }),
11557
- " ",
11558
- event.location
11559
- ] })
11560
- ] })
11561
- ] }) }, event.id);
11562
- })
11563
- ]
11564
- }
11565
- )
11563
+ day,
11564
+ events: dayEvents,
11565
+ expandedDay,
11566
+ onExpand: setExpandedDay,
11567
+ onEventSelect: handleEventClick,
11568
+ noTime
11569
+ }
11570
+ )
11571
+ },
11572
+ day.toString()
11573
+ );
11574
+ })
11566
11575
  ] }),
11567
11576
  multiDayTimedEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
11568
11577
  "div",
@@ -11679,60 +11688,19 @@ function WeekViewAgenda({
11679
11688
  className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
11680
11689
  "data-today": dateFns.isToday(day) || void 0,
11681
11690
  children: [
11682
- trueAllDayEvents.length > 0 && allDayCell && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: trueAllDayEvents.filter(
11683
- (event) => event.start?.toLocaleDateString() == new Date(day).toLocaleDateString()
11684
- )?.map((event) => {
11685
- const eventStart = new Date(event.start);
11686
- const eventEnd = new Date(
11687
- new Date(event.end).setHours(23, 59)
11688
- );
11689
- const isFirstDay = dateFns.isSameDay(currentDate, eventStart);
11690
- const isLastDay = dateFns.isSameDay(currentDate, eventEnd);
11691
- return /* @__PURE__ */ jsxRuntime.jsx(
11692
- "div",
11693
- {
11694
- className: "absolute z-10 px-0.5",
11695
- style: {
11696
- height: "100%",
11697
- width: "100%",
11698
- padding: "10px"
11699
- },
11700
- children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { delayDuration: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
11701
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full", children: /* @__PURE__ */ jsxRuntime.jsx(
11702
- EventItemAgenda,
11703
- {
11704
- event,
11705
- view: "day",
11706
- isFirstDay,
11707
- isLastDay,
11708
- onClick: (e) => handleEventClick(event, e),
11709
- noTime,
11710
- className: "flex justify-start items-start rounded-sm py-1"
11711
- }
11712
- ) }) }),
11713
- /* @__PURE__ */ jsxRuntime.jsxs(
11714
- TooltipContentBase,
11715
- {
11716
- side: "top",
11717
- sideOffset: 6,
11718
- className: "max-w-[220px] space-y-0.5",
11719
- children: [
11720
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-sm leading-snug", children: event.title }),
11721
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-90", children: formatDurationAgenda(event) }),
11722
- event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs flex items-center gap-2", children: [
11723
- /* @__PURE__ */ jsxRuntime.jsx(ssr.MapPinIcon, { size: 15 }),
11724
- " ",
11725
- event.location
11726
- ] }),
11727
- event.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-75 line-clamp-2", children: event.description })
11728
- ]
11729
- }
11730
- )
11731
- ] }) })
11732
- },
11733
- `spanning-${event.id}`
11734
- );
11735
- }) }),
11691
+ trueAllDayEvents.length > 0 && allDayCell && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 overflow-visible", children: /* @__PURE__ */ jsxRuntime.jsx(
11692
+ AllDayStack,
11693
+ {
11694
+ day,
11695
+ events: trueAllDayEvents.filter(
11696
+ (event) => event.start?.toLocaleDateString() === new Date(day).toLocaleDateString()
11697
+ ),
11698
+ expandedDay,
11699
+ onExpand: setExpandedDay,
11700
+ onEventSelect: handleEventClick,
11701
+ noTime
11702
+ }
11703
+ ) }),
11736
11704
  (processedDayEvents[dayIndex] ?? []).map((positionedEvent) => {
11737
11705
  const timeLabel = formatDurationAgenda(positionedEvent.event);
11738
11706
  return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { delayDuration: 250, children: [
@@ -11818,6 +11786,11 @@ function WeekViewAgenda({
11818
11786
  const startTime = new Date(day);
11819
11787
  startTime.setHours(hourValue);
11820
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
+ }
11821
11794
  if (onEventCreate) onEventCreate(startTime);
11822
11795
  },
11823
11796
  time: quarterHourTime
@@ -21094,6 +21067,102 @@ var TagInput = React32__namespace.forwardRef(
21094
21067
  }
21095
21068
  );
21096
21069
  TagInput.displayName = "TagInput";
21070
+ function MaskedInput({
21071
+ value,
21072
+ onChange,
21073
+ mask,
21074
+ label,
21075
+ className,
21076
+ error,
21077
+ isLoading,
21078
+ disabled,
21079
+ hideConfirm = false
21080
+ }) {
21081
+ const [internalValue, setInternalValue] = React32.useState(value);
21082
+ React32.useEffect(() => {
21083
+ setInternalValue(applyMask(value, mask));
21084
+ }, [value, mask]);
21085
+ const hasChanged = internalValue !== applyMask(value, mask);
21086
+ const handleSave = () => {
21087
+ if (!hasChanged || isLoading || disabled) return;
21088
+ onChange(internalValue.replace(/\D/g, ""));
21089
+ };
21090
+ function applyMask(value2, type) {
21091
+ let valueMasked = value2.replace(/\D/g, "");
21092
+ switch (type) {
21093
+ case "cpf":
21094
+ valueMasked = valueMasked.replace(/(\d{3})(\d)/, "$1.$2");
21095
+ valueMasked = valueMasked.replace(/(\d{3})(\d)/, "$1.$2");
21096
+ valueMasked = valueMasked.replace(/(\d{3})(\d{1,2})$/, "$1-$2");
21097
+ return valueMasked.substring(0, 14);
21098
+ case "cnpj":
21099
+ valueMasked = valueMasked.replace(/^(\d{2})(\d)/, "$1.$2");
21100
+ valueMasked = valueMasked.replace(/^(\d{2})\.(\d{3})(\d)/, "$1.$2.$3");
21101
+ valueMasked = valueMasked.replace(/\.(\d{3})(\d)/, ".$1/$2");
21102
+ valueMasked = valueMasked.replace(/(\d{4})(\d)/, "$1-$2");
21103
+ return valueMasked.substring(0, 18);
21104
+ case "cep":
21105
+ valueMasked = valueMasked.replace(/(\d{5})(\d)/, "$1-$2");
21106
+ return valueMasked.substring(0, 9);
21107
+ case "phone":
21108
+ valueMasked = valueMasked.replace(/^(\d{2})(\d)/g, "($1) $2");
21109
+ valueMasked = valueMasked.replace(/(\d)(\d{4})$/, "$1-$2");
21110
+ return valueMasked.substring(0, 15);
21111
+ case "rg":
21112
+ valueMasked = valueMasked.replace(/(\d{2})(\d)/, "$1.$2");
21113
+ valueMasked = valueMasked.replace(/(\d{3})(\d)/, "$1.$2");
21114
+ valueMasked = valueMasked.replace(/(\d{3})(\d{1})$/, "$1-$2");
21115
+ return valueMasked.substring(0, 12);
21116
+ default:
21117
+ return valueMasked;
21118
+ }
21119
+ }
21120
+ function blurOnEnter(e) {
21121
+ if (e.key === "Enter") {
21122
+ e.currentTarget.blur();
21123
+ }
21124
+ }
21125
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className} flex flex-col`, children: [
21126
+ label && /* @__PURE__ */ jsxRuntime.jsx(LabelBase_default, { children: label }),
21127
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
21128
+ /* @__PURE__ */ jsxRuntime.jsx(
21129
+ InputBase,
21130
+ {
21131
+ value: internalValue,
21132
+ onChange: (e) => {
21133
+ const masked = applyMask(e.currentTarget.value, mask);
21134
+ setInternalValue(masked);
21135
+ },
21136
+ onBlur: handleSave,
21137
+ onKeyDown: blurOnEnter,
21138
+ rightIcon: /* @__PURE__ */ jsxRuntime.jsx(react.PencilSimpleIcon, { size: 12, className: "mr-2" }),
21139
+ error,
21140
+ disabled,
21141
+ inputMode: "numeric"
21142
+ }
21143
+ ),
21144
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: hasChanged && !hideConfirm && /* @__PURE__ */ jsxRuntime.jsx(
21145
+ framerMotion.motion.div,
21146
+ {
21147
+ initial: { opacity: 0, scale: 0.8 },
21148
+ animate: { opacity: 1, scale: 1 },
21149
+ exit: { opacity: 0, scale: 0.8 },
21150
+ transition: { type: "spring", stiffness: 500, damping: 30 },
21151
+ children: /* @__PURE__ */ jsxRuntime.jsx(
21152
+ ButtonBase,
21153
+ {
21154
+ onClick: handleSave,
21155
+ className: "h-9 w-9 bg-green-600 text-white hover:bg-green-700 rounded-md flex items-center justify-center",
21156
+ size: "icon",
21157
+ isLoading,
21158
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.CheckIcon, { size: 14 })
21159
+ }
21160
+ )
21161
+ }
21162
+ ) })
21163
+ ] })
21164
+ ] });
21165
+ }
21097
21166
  function Leaderboard({
21098
21167
  items,
21099
21168
  order: initialOrder = "desc",
@@ -22748,23 +22817,28 @@ function useCommandPalette({
22748
22817
  React32.useEffect(() => {
22749
22818
  stateRef.current = { activeIndex, page, flatItems, query, selectedItems };
22750
22819
  }, [activeIndex, page, flatItems, query, selectedItems]);
22751
- const executeBulkAction = React32.useCallback(() => {
22820
+ const executeBulkAction = React32__namespace.useCallback(() => {
22752
22821
  if (!onSelectMultiple || selectedItems.length === 0) return;
22753
22822
  onSelectMultiple(selectedItems);
22754
22823
  onOpenChange?.(false);
22755
22824
  }, [onSelectMultiple, selectedItems, onOpenChange]);
22756
- const handleSelect = React32.useCallback(
22825
+ const handleCheckboxToggle = React32__namespace.useCallback(
22826
+ (item) => {
22827
+ toggleSelection(item.id);
22828
+ },
22829
+ [toggleSelection]
22830
+ );
22831
+ const handleSelect = React32__namespace.useCallback(
22757
22832
  (item, event) => {
22758
22833
  if (!item) return;
22759
22834
  if (multiSelect) {
22760
- const isCmdKey = event && ("ctrlKey" in event || "metaKey" in event || "shiftKey" in event) && (event.ctrlKey || event.metaKey || event.shiftKey);
22761
- if (isCmdKey) {
22835
+ if (event && ("ctrlKey" in event || "metaKey" in event || "shiftKey" in event) && (event.ctrlKey || event.metaKey || event.shiftKey)) {
22762
22836
  toggleSelection(item.id);
22763
22837
  return;
22764
22838
  }
22765
22839
  if (selectedItems.length > 0) {
22766
- const finalItems = selectedItemIds.has(item.id) ? selectedItems : [...selectedItems, item];
22767
- onSelectMultiple?.(finalItems);
22840
+ const itemsToSubmit = selectedItemIds.has(item.id) ? selectedItems : [...selectedItems, item];
22841
+ onSelectMultiple?.(itemsToSubmit);
22768
22842
  onOpenChange?.(false);
22769
22843
  return;
22770
22844
  }
@@ -22783,12 +22857,12 @@ function useCommandPalette({
22783
22857
  multiSelect,
22784
22858
  selectedItems,
22785
22859
  selectedItemIds,
22860
+ toggleSelection,
22786
22861
  onSelectMultiple,
22787
22862
  onOpenChange,
22788
22863
  onRecentItemsChange,
22789
22864
  recentItems,
22790
- maxRecentItems,
22791
- toggleSelection
22865
+ maxRecentItems
22792
22866
  ]
22793
22867
  );
22794
22868
  React32.useEffect(() => {
@@ -22877,6 +22951,7 @@ function useCommandPalette({
22877
22951
  totalItems,
22878
22952
  totalPages,
22879
22953
  handleSelect,
22954
+ handleCheckboxToggle,
22880
22955
  selectedItemIds,
22881
22956
  toggleSelection,
22882
22957
  selectedItems,
@@ -23469,6 +23544,7 @@ exports.Leaderboard = Leaderboard;
23469
23544
  exports.LikeButton = LikeButton;
23470
23545
  exports.LoadingBase = LoadingBase;
23471
23546
  exports.LockButton = LockButton;
23547
+ exports.MaskedInput = MaskedInput;
23472
23548
  exports.ModalBase = ModalBase;
23473
23549
  exports.ModalCloseBase = ModalCloseBase;
23474
23550
  exports.ModalContentBase = ModalContentBase;