@mlw-packages/react-components 1.10.29 → 1.10.31

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,14 +9795,92 @@ 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
+ }
9798
9874
  function DayViewAgenda({
9799
9875
  currentDate,
9800
9876
  events,
9801
9877
  onEventSelect,
9802
9878
  showUndatedEvents,
9803
9879
  noTime = false,
9804
- onEventCreate
9880
+ onEventCreate,
9881
+ allDayCell = false
9805
9882
  }) {
9883
+ const [expandedDay, setExpandedDay] = React32.useState(null);
9806
9884
  const hours = React32.useMemo(() => {
9807
9885
  const dayStart = dateFns.startOfDay(currentDate);
9808
9886
  return dateFns.eachHourOfInterval({
@@ -9915,7 +9993,7 @@ function DayViewAgenda({
9915
9993
  const showAllDaySection = allDayEvents.length > 0;
9916
9994
  const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(currentDate, "day");
9917
9995
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "contents", "data-slot": "day-view", children: [
9918
- showAllDaySection && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border/70 border-t bg-muted/50", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[3rem_1fr] sm:grid-cols-[4rem_1fr]", children: [
9996
+ showAllDaySection && !allDayCell && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border/70 border-t bg-muted/50", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[3rem_1fr] sm:grid-cols-[4rem_1fr]", children: [
9919
9997
  /* @__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" }) }),
9920
9998
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative border-border/70 border-r p-1 last:border-r-0", children: allDayEvents.map((event) => {
9921
9999
  const eventStart = getEventStartDate(event);
@@ -9962,7 +10040,65 @@ function DayViewAgenda({
9962
10040
  },
9963
10041
  hour.toString()
9964
10042
  )) }),
9965
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
10043
+ showAllDaySection && allDayCell ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
10044
+ /* @__PURE__ */ jsxRuntime.jsx(
10045
+ AllDayStack,
10046
+ {
10047
+ day: currentDate,
10048
+ events: allDayEvents,
10049
+ expandedDay,
10050
+ onExpand: setExpandedDay,
10051
+ onEventSelect: handleEventClick,
10052
+ noTime
10053
+ }
10054
+ ),
10055
+ currentTimeVisible && /* @__PURE__ */ jsxRuntime.jsx(
10056
+ "div",
10057
+ {
10058
+ className: "pointer-events-none absolute right-0 left-0 z-20",
10059
+ style: { top: `${currentTimePosition}%` },
10060
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
10061
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-left-1 absolute h-2 w-2 rounded-full bg-primary" }),
10062
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[2px] w-full bg-primary" })
10063
+ ] })
10064
+ }
10065
+ ),
10066
+ hours.map((hour) => {
10067
+ const hourValue = dateFns.getHours(hour);
10068
+ return /* @__PURE__ */ jsxRuntime.jsx(
10069
+ "div",
10070
+ {
10071
+ className: "relative h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
10072
+ children: [0, 1, 2, 3].map((quarter) => {
10073
+ const quarterHourTime = hourValue + quarter * 0.25;
10074
+ return /* @__PURE__ */ jsxRuntime.jsx(
10075
+ DroppableCellAgenda,
10076
+ {
10077
+ className: cn(
10078
+ "absolute h-[calc(var(--week-cells-height)/4)] w-full",
10079
+ quarter === 0 && "top-0",
10080
+ quarter === 1 && "top-[calc(var(--week-cells-height)/4)]",
10081
+ quarter === 2 && "top-[calc(var(--week-cells-height)/4*2)]",
10082
+ quarter === 3 && "top-[calc(var(--week-cells-height)/4*3)]"
10083
+ ),
10084
+ date: currentDate,
10085
+ id: `day-cell-${currentDate.toISOString()}-${quarterHourTime}`,
10086
+ onClick: () => {
10087
+ const startTime = new Date(currentDate);
10088
+ startTime.setHours(hourValue);
10089
+ startTime.setMinutes(quarter * 15);
10090
+ if (onEventCreate) onEventCreate(startTime);
10091
+ },
10092
+ time: quarterHourTime
10093
+ },
10094
+ `${hour.toString()}-${quarter}`
10095
+ );
10096
+ })
10097
+ },
10098
+ hour.toString()
10099
+ );
10100
+ })
10101
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
9966
10102
  positionedEvents.map((positionedEvent) => {
9967
10103
  const evt = positionedEvent.event;
9968
10104
  const eventStart = new Date(evt.start ?? evt.end ?? Date.now());
@@ -10316,7 +10452,8 @@ function EventAgenda({
10316
10452
  onlyWeek,
10317
10453
  onlyAgenda,
10318
10454
  onlyYear,
10319
- allowCellClick = true
10455
+ allowCellClick = true,
10456
+ allDayCell = false
10320
10457
  }) {
10321
10458
  const lockedView = onlyDay ? "day" : onlyMonth ? "month" : onlyWeek ? "week" : onlyAgenda ? "agenda" : onlyYear ? "year" : void 0;
10322
10459
  const [currentDate, setCurrentDate] = React32.useState(
@@ -10436,9 +10573,10 @@ function EventAgenda({
10436
10573
  },
10437
10574
  children: [
10438
10575
  /* @__PURE__ */ jsxRuntime.jsxs(CalendarDndProviderAgenda, { onEventUpdate: handleEventUpdate, children: [
10439
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between p-2 sm:p-4", children: [
10440
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 sm:gap-4 min-w-0", children: [
10441
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center sm:gap-2", children: [
10576
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 px-2 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-4 sm:py-4", children: [
10577
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-semibold text-base sm:text-lg md:text-xl lg:text-2xl truncate", children: viewTitle }),
10578
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between sm:justify-end gap-2", children: [
10579
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
10442
10580
  /* @__PURE__ */ jsxRuntime.jsx(
10443
10581
  ButtonBase,
10444
10582
  {
@@ -10460,21 +10598,18 @@ function EventAgenda({
10460
10598
  }
10461
10599
  )
10462
10600
  ] }),
10463
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-semibold text-sm sm:text-base md:text-lg lg:text-xl xl:text-2xl min-w-0 truncate sm:whitespace-normal", children: viewTitle })
10464
- ] }),
10465
- !lockedView && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
10466
- Select,
10467
- {
10468
- selected: activeView,
10469
- onChange: (v) => {
10470
- setView(v);
10471
- },
10472
- items: selectItems,
10473
- placeholder: viewLabel(activeView),
10474
- className: "min-w-24",
10475
- hideClear: true
10476
- }
10477
- ) })
10601
+ !lockedView && /* @__PURE__ */ jsxRuntime.jsx(
10602
+ Select,
10603
+ {
10604
+ selected: activeView,
10605
+ onChange: (v) => setView(v),
10606
+ items: selectItems,
10607
+ placeholder: viewLabel(activeView),
10608
+ className: "min-w-24",
10609
+ hideClear: true
10610
+ }
10611
+ )
10612
+ ] })
10478
10613
  ] }),
10479
10614
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col transition-all duration-200 ease-in-out", children: [
10480
10615
  activeView === "month" && /* @__PURE__ */ jsxRuntime.jsx(
@@ -10499,6 +10634,7 @@ function EventAgenda({
10499
10634
  events,
10500
10635
  onEventSelect: handleEventSelect,
10501
10636
  noTime,
10637
+ allDayCell,
10502
10638
  onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10503
10639
  start: d,
10504
10640
  end: d,
@@ -10514,6 +10650,7 @@ function EventAgenda({
10514
10650
  events,
10515
10651
  onEventSelect: handleEventSelect,
10516
10652
  noTime,
10653
+ allDayCell,
10517
10654
  onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10518
10655
  start: d,
10519
10656
  end: d,
@@ -11220,10 +11357,12 @@ function WeekViewAgenda({
11220
11357
  currentDate,
11221
11358
  events,
11222
11359
  onEventSelect,
11360
+ allDayCell = false,
11223
11361
  onEventCreate,
11224
11362
  showUndatedEvents,
11225
11363
  noTime = false
11226
11364
  }) {
11365
+ const [expandedDay, setExpandedDay] = React32.useState(null);
11227
11366
  const days = React32.useMemo(() => {
11228
11367
  const weekStart = dateFns.startOfWeek(currentDate, { weekStartsOn: 0 });
11229
11368
  const weekEnd = dateFns.endOfWeek(currentDate, { weekStartsOn: 0 });
@@ -11270,11 +11409,6 @@ function WeekViewAgenda({
11270
11409
  [allDayEvents]
11271
11410
  );
11272
11411
  const rowH = EventHeightAgenda + EventGapAgenda;
11273
- const allDayBarData = React32.useMemo(() => {
11274
- const bars = computeMultiDayBars(trueAllDayEvents, days);
11275
- const maxSlot = bars.length > 0 ? Math.max(...bars.map((b) => b.slot)) : 0;
11276
- return { bars, sectionH: (maxSlot + 1) * rowH + EventGapAgenda * 2 };
11277
- }, [trueAllDayEvents, days, rowH]);
11278
11412
  const multiDayBarData = React32.useMemo(() => {
11279
11413
  const bars = computeMultiDayBars(multiDayTimedEvents, days);
11280
11414
  const maxSlot = bars.length > 0 ? Math.max(...bars.map((b) => b.slot)) : 0;
@@ -11395,78 +11529,33 @@ function WeekViewAgenda({
11395
11529
  ))
11396
11530
  ] }),
11397
11531
  showAllDaySection && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border/70 border-b bg-muted/50", children: [
11398
- trueAllDayEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-8", children: [
11532
+ trueAllDayEvents.length > 0 && !allDayCell && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-8", children: [
11399
11533
  /* @__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" }) }),
11400
- /* @__PURE__ */ jsxRuntime.jsxs(
11401
- "div",
11402
- {
11403
- className: "col-span-7 relative",
11404
- style: { height: allDayBarData.sectionH },
11405
- children: [
11406
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 grid grid-cols-7 pointer-events-none", children: days.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
11407
- "div",
11534
+ days.map((day) => {
11535
+ const dayEvents = trueAllDayEvents.filter((event) => {
11536
+ const start = getEventStartDate(event);
11537
+ return start ? dateFns.isSameDay(day, start) : false;
11538
+ });
11539
+ return /* @__PURE__ */ jsxRuntime.jsx(
11540
+ "div",
11541
+ {
11542
+ className: "relative border-r last:border-r-0 border-border/70 overflow-visible py-0.5",
11543
+ "data-today": dateFns.isToday(day) || void 0,
11544
+ children: /* @__PURE__ */ jsxRuntime.jsx(
11545
+ AllDayStack,
11408
11546
  {
11409
- className: "border-r last:border-r-0 border-border/70",
11410
- "data-today": dateFns.isToday(day) || void 0
11411
- },
11412
- day.toString()
11413
- )) }),
11414
- allDayBarData.bars.map((bar) => {
11415
- const {
11416
- event,
11417
- colStart,
11418
- colSpan,
11419
- isFirstDay,
11420
- isLastDay,
11421
- slot
11422
- } = bar;
11423
- const showTitle = isFirstDay || !isFirstDay && colStart === 0;
11424
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { delayDuration: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
11425
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
11426
- "div",
11427
- {
11428
- className: "absolute px-0.5",
11429
- style: {
11430
- left: `calc(${colStart / 7 * 100}% + 2px)`,
11431
- width: `calc(${colSpan / 7 * 100}% - 4px)`,
11432
- top: EventGapAgenda + slot * rowH,
11433
- height: EventHeightAgenda
11434
- },
11435
- children: /* @__PURE__ */ jsxRuntime.jsx(
11436
- EventItemAgenda,
11437
- {
11438
- event,
11439
- isFirstDay,
11440
- isLastDay,
11441
- onClick: (e) => {
11442
- e.stopPropagation();
11443
- handleEventClick(event, e);
11444
- },
11445
- view: "month",
11446
- className: "h-full",
11447
- children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 min-w-0 w-full", children: [
11448
- !isFirstDay && colStart === 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[11px] font-bold opacity-60", children: /* @__PURE__ */ jsxRuntime.jsx(ssr.CaretLeftIcon, {}) }),
11449
- showTitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-medium", children: event.title }),
11450
- !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, {}) })
11451
- ] })
11452
- }
11453
- )
11454
- }
11455
- ) }),
11456
- /* @__PURE__ */ jsxRuntime.jsxs(TooltipContentBase, { side: "top", children: [
11457
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold truncate max-w-[200px]", children: event.title }),
11458
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "opacity-80 mt-0.5 leading-snug", children: formatDurationAgenda(event) }),
11459
- event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "opacity-60 mt-0.5 truncate text-[11px] max-w-[200px] flex items-center gap-1", children: [
11460
- /* @__PURE__ */ jsxRuntime.jsx(ssr.MapPinIcon, { size: 14 }),
11461
- " ",
11462
- event.location
11463
- ] })
11464
- ] })
11465
- ] }) }, event.id);
11466
- })
11467
- ]
11468
- }
11469
- )
11547
+ day,
11548
+ events: dayEvents,
11549
+ expandedDay,
11550
+ onExpand: setExpandedDay,
11551
+ onEventSelect: handleEventClick,
11552
+ noTime
11553
+ }
11554
+ )
11555
+ },
11556
+ day.toString()
11557
+ );
11558
+ })
11470
11559
  ] }),
11471
11560
  multiDayTimedEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
11472
11561
  "div",
@@ -11583,6 +11672,19 @@ function WeekViewAgenda({
11583
11672
  className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
11584
11673
  "data-today": dateFns.isToday(day) || void 0,
11585
11674
  children: [
11675
+ trueAllDayEvents.length > 0 && allDayCell && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 overflow-visible", children: /* @__PURE__ */ jsxRuntime.jsx(
11676
+ AllDayStack,
11677
+ {
11678
+ day,
11679
+ events: trueAllDayEvents.filter(
11680
+ (event) => event.start?.toLocaleDateString() === new Date(day).toLocaleDateString()
11681
+ ),
11682
+ expandedDay,
11683
+ onExpand: setExpandedDay,
11684
+ onEventSelect: handleEventClick,
11685
+ noTime
11686
+ }
11687
+ ) }),
11586
11688
  (processedDayEvents[dayIndex] ?? []).map((positionedEvent) => {
11587
11689
  const timeLabel = formatDurationAgenda(positionedEvent.event);
11588
11690
  return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { delayDuration: 250, children: [
@@ -20944,6 +21046,102 @@ var TagInput = React32__namespace.forwardRef(
20944
21046
  }
20945
21047
  );
20946
21048
  TagInput.displayName = "TagInput";
21049
+ function MaskedInput({
21050
+ value,
21051
+ onChange,
21052
+ mask,
21053
+ label,
21054
+ className,
21055
+ error,
21056
+ isLoading,
21057
+ disabled,
21058
+ hideConfirm = false
21059
+ }) {
21060
+ const [internalValue, setInternalValue] = React32.useState(value);
21061
+ React32.useEffect(() => {
21062
+ setInternalValue(applyMask(value, mask));
21063
+ }, [value, mask]);
21064
+ const hasChanged = internalValue !== applyMask(value, mask);
21065
+ const handleSave = () => {
21066
+ if (!hasChanged || isLoading || disabled) return;
21067
+ onChange(internalValue.replace(/\D/g, ""));
21068
+ };
21069
+ function applyMask(value2, type) {
21070
+ let valueMasked = value2.replace(/\D/g, "");
21071
+ switch (type) {
21072
+ case "cpf":
21073
+ valueMasked = valueMasked.replace(/(\d{3})(\d)/, "$1.$2");
21074
+ valueMasked = valueMasked.replace(/(\d{3})(\d)/, "$1.$2");
21075
+ valueMasked = valueMasked.replace(/(\d{3})(\d{1,2})$/, "$1-$2");
21076
+ return valueMasked.substring(0, 14);
21077
+ case "cnpj":
21078
+ valueMasked = valueMasked.replace(/^(\d{2})(\d)/, "$1.$2");
21079
+ valueMasked = valueMasked.replace(/^(\d{2})\.(\d{3})(\d)/, "$1.$2.$3");
21080
+ valueMasked = valueMasked.replace(/\.(\d{3})(\d)/, ".$1/$2");
21081
+ valueMasked = valueMasked.replace(/(\d{4})(\d)/, "$1-$2");
21082
+ return valueMasked.substring(0, 18);
21083
+ case "cep":
21084
+ valueMasked = valueMasked.replace(/(\d{5})(\d)/, "$1-$2");
21085
+ return valueMasked.substring(0, 9);
21086
+ case "phone":
21087
+ valueMasked = valueMasked.replace(/^(\d{2})(\d)/g, "($1) $2");
21088
+ valueMasked = valueMasked.replace(/(\d)(\d{4})$/, "$1-$2");
21089
+ return valueMasked.substring(0, 15);
21090
+ case "rg":
21091
+ valueMasked = valueMasked.replace(/(\d{2})(\d)/, "$1.$2");
21092
+ valueMasked = valueMasked.replace(/(\d{3})(\d)/, "$1.$2");
21093
+ valueMasked = valueMasked.replace(/(\d{3})(\d{1})$/, "$1-$2");
21094
+ return valueMasked.substring(0, 12);
21095
+ default:
21096
+ return valueMasked;
21097
+ }
21098
+ }
21099
+ function blurOnEnter(e) {
21100
+ if (e.key === "Enter") {
21101
+ e.currentTarget.blur();
21102
+ }
21103
+ }
21104
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className} flex flex-col`, children: [
21105
+ label && /* @__PURE__ */ jsxRuntime.jsx(LabelBase_default, { children: label }),
21106
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
21107
+ /* @__PURE__ */ jsxRuntime.jsx(
21108
+ InputBase,
21109
+ {
21110
+ value: internalValue,
21111
+ onChange: (e) => {
21112
+ const masked = applyMask(e.currentTarget.value, mask);
21113
+ setInternalValue(masked);
21114
+ },
21115
+ onBlur: handleSave,
21116
+ onKeyDown: blurOnEnter,
21117
+ rightIcon: /* @__PURE__ */ jsxRuntime.jsx(react.PencilSimpleIcon, { size: 12, className: "mr-2" }),
21118
+ error,
21119
+ disabled,
21120
+ inputMode: "numeric"
21121
+ }
21122
+ ),
21123
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: hasChanged && !hideConfirm && /* @__PURE__ */ jsxRuntime.jsx(
21124
+ framerMotion.motion.div,
21125
+ {
21126
+ initial: { opacity: 0, scale: 0.8 },
21127
+ animate: { opacity: 1, scale: 1 },
21128
+ exit: { opacity: 0, scale: 0.8 },
21129
+ transition: { type: "spring", stiffness: 500, damping: 30 },
21130
+ children: /* @__PURE__ */ jsxRuntime.jsx(
21131
+ ButtonBase,
21132
+ {
21133
+ onClick: handleSave,
21134
+ className: "h-9 w-9 bg-green-600 text-white hover:bg-green-700 rounded-md flex items-center justify-center",
21135
+ size: "icon",
21136
+ isLoading,
21137
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.CheckIcon, { size: 14 })
21138
+ }
21139
+ )
21140
+ }
21141
+ ) })
21142
+ ] })
21143
+ ] });
21144
+ }
20947
21145
  function Leaderboard({
20948
21146
  items,
20949
21147
  order: initialOrder = "desc",
@@ -22598,23 +22796,28 @@ function useCommandPalette({
22598
22796
  React32.useEffect(() => {
22599
22797
  stateRef.current = { activeIndex, page, flatItems, query, selectedItems };
22600
22798
  }, [activeIndex, page, flatItems, query, selectedItems]);
22601
- const executeBulkAction = React32.useCallback(() => {
22799
+ const executeBulkAction = React32__namespace.useCallback(() => {
22602
22800
  if (!onSelectMultiple || selectedItems.length === 0) return;
22603
22801
  onSelectMultiple(selectedItems);
22604
22802
  onOpenChange?.(false);
22605
22803
  }, [onSelectMultiple, selectedItems, onOpenChange]);
22606
- const handleSelect = React32.useCallback(
22804
+ const handleCheckboxToggle = React32__namespace.useCallback(
22805
+ (item) => {
22806
+ toggleSelection(item.id);
22807
+ },
22808
+ [toggleSelection]
22809
+ );
22810
+ const handleSelect = React32__namespace.useCallback(
22607
22811
  (item, event) => {
22608
22812
  if (!item) return;
22609
22813
  if (multiSelect) {
22610
- const isCmdKey = event && ("ctrlKey" in event || "metaKey" in event || "shiftKey" in event) && (event.ctrlKey || event.metaKey || event.shiftKey);
22611
- if (isCmdKey) {
22814
+ if (event && ("ctrlKey" in event || "metaKey" in event || "shiftKey" in event) && (event.ctrlKey || event.metaKey || event.shiftKey)) {
22612
22815
  toggleSelection(item.id);
22613
22816
  return;
22614
22817
  }
22615
22818
  if (selectedItems.length > 0) {
22616
- const finalItems = selectedItemIds.has(item.id) ? selectedItems : [...selectedItems, item];
22617
- onSelectMultiple?.(finalItems);
22819
+ const itemsToSubmit = selectedItemIds.has(item.id) ? selectedItems : [...selectedItems, item];
22820
+ onSelectMultiple?.(itemsToSubmit);
22618
22821
  onOpenChange?.(false);
22619
22822
  return;
22620
22823
  }
@@ -22633,12 +22836,12 @@ function useCommandPalette({
22633
22836
  multiSelect,
22634
22837
  selectedItems,
22635
22838
  selectedItemIds,
22839
+ toggleSelection,
22636
22840
  onSelectMultiple,
22637
22841
  onOpenChange,
22638
22842
  onRecentItemsChange,
22639
22843
  recentItems,
22640
- maxRecentItems,
22641
- toggleSelection
22844
+ maxRecentItems
22642
22845
  ]
22643
22846
  );
22644
22847
  React32.useEffect(() => {
@@ -22727,6 +22930,7 @@ function useCommandPalette({
22727
22930
  totalItems,
22728
22931
  totalPages,
22729
22932
  handleSelect,
22933
+ handleCheckboxToggle,
22730
22934
  selectedItemIds,
22731
22935
  toggleSelection,
22732
22936
  selectedItems,
@@ -23319,6 +23523,7 @@ exports.Leaderboard = Leaderboard;
23319
23523
  exports.LikeButton = LikeButton;
23320
23524
  exports.LoadingBase = LoadingBase;
23321
23525
  exports.LockButton = LockButton;
23526
+ exports.MaskedInput = MaskedInput;
23322
23527
  exports.ModalBase = ModalBase;
23323
23528
  exports.ModalCloseBase = ModalCloseBase;
23324
23529
  exports.ModalContentBase = ModalContentBase;