@mlw-packages/react-components 1.8.9 → 1.8.11

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.mjs CHANGED
@@ -1027,7 +1027,7 @@ var ProgressBase = React33.forwardRef(
1027
1027
  ]
1028
1028
  }
1029
1029
  ),
1030
- showValue && valuePosition === "right" && /* @__PURE__ */ jsxs("div", { className: "w-12 text-sm font-extrabold text-left", children: [
1030
+ showValue && valuePosition === "right" && /* @__PURE__ */ jsxs("div", { className: " text-sm font-bold text-left", children: [
1031
1031
  Math.round(value || 0),
1032
1032
  "%"
1033
1033
  ] }),
@@ -1814,6 +1814,7 @@ var InputBase = React33.forwardRef(
1814
1814
  leftIcon,
1815
1815
  rightIcon,
1816
1816
  "data-testid": dataTestId,
1817
+ numericKeyboard,
1817
1818
  error,
1818
1819
  ...props
1819
1820
  }, ref) => {
@@ -1833,6 +1834,8 @@ var InputBase = React33.forwardRef(
1833
1834
  "input",
1834
1835
  {
1835
1836
  type,
1837
+ inputMode: numericKeyboard ? "numeric" : void 0,
1838
+ pattern: numericKeyboard ? "[0-9]*" : void 0,
1836
1839
  className: cn(
1837
1840
  "w-full flex-1 text-sm p-1.5 px-3 focus:outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 bg-background text-foreground",
1838
1841
  className
@@ -3242,7 +3245,7 @@ function ModeToggleBase({
3242
3245
  DropDownMenuContentBase,
3243
3246
  {
3244
3247
  align: "end",
3245
- className: "border-border bg-popover text-popover-foreground min-w-[140px]",
3248
+ className: "border-border bg-popover text-popover-foreground min-w-[140px] ",
3246
3249
  children: themes.map((theme) => {
3247
3250
  const isActive = currentTheme === theme;
3248
3251
  return /* @__PURE__ */ jsxs(
@@ -3250,8 +3253,8 @@ function ModeToggleBase({
3250
3253
  {
3251
3254
  onClick: () => toggleTheme(theme),
3252
3255
  className: cn(
3253
- "gap-3 transition-all duration-200",
3254
- isActive ? "bg-accent/80 text-accent-foreground border-l-2 border-primary font-medium pl-1.5" : "hover:bg-accent hover:text-accent-foreground"
3256
+ "gap-2 transition-all duration-200",
3257
+ isActive ? "bg-accent/80 text-accent-foreground border-l-2 border-primary font-medium pl-1.5 my-0.5" : "hover:bg-accent hover:text-accent-foreground"
3255
3258
  ),
3256
3259
  children: [
3257
3260
  /* @__PURE__ */ jsx(ThemeIcon, { theme }),
@@ -7438,16 +7441,176 @@ function CalendarBase2({
7438
7441
  );
7439
7442
  }
7440
7443
  CalendarBase2.displayName = "CalendarBase";
7444
+
7445
+ // src/components/ui/picker/utils/time-picker-utils.ts
7446
+ function isValidHour(value) {
7447
+ return /^(0[0-9]|1[0-9]|2[0-3])$/.test(value);
7448
+ }
7449
+ function isValid12Hour(value) {
7450
+ return /^(0[1-9]|1[0-2])$/.test(value);
7451
+ }
7452
+ function isValidMinuteOrSecond(value) {
7453
+ return /^[0-5][0-9]$/.test(value);
7454
+ }
7455
+ function getValidNumber(value, { max, min = 0, loop = false }) {
7456
+ let numericValue = parseInt(value, 10);
7457
+ if (!isNaN(numericValue)) {
7458
+ if (!loop) {
7459
+ if (numericValue > max) numericValue = max;
7460
+ if (numericValue < min) numericValue = min;
7461
+ } else {
7462
+ if (numericValue > max) numericValue = min;
7463
+ if (numericValue < min) numericValue = max;
7464
+ }
7465
+ return numericValue.toString().padStart(2, "0");
7466
+ }
7467
+ return "00";
7468
+ }
7469
+ function getValidHour(value) {
7470
+ if (isValidHour(value)) return value;
7471
+ return getValidNumber(value, { max: 23 });
7472
+ }
7473
+ function getValid12Hour(value) {
7474
+ if (isValid12Hour(value)) return value;
7475
+ return getValidNumber(value, { min: 1, max: 12 });
7476
+ }
7477
+ function getValidMinuteOrSecond(value) {
7478
+ if (isValidMinuteOrSecond(value)) return value;
7479
+ return getValidNumber(value, { max: 59 });
7480
+ }
7481
+ function getValidArrowNumber(value, { min, max, step }) {
7482
+ let numericValue = parseInt(value, 10);
7483
+ if (!isNaN(numericValue)) {
7484
+ numericValue += step;
7485
+ return getValidNumber(String(numericValue), { min, max, loop: true });
7486
+ }
7487
+ return "00";
7488
+ }
7489
+ function getValidArrowHour(value, step) {
7490
+ return getValidArrowNumber(value, { min: 0, max: 23, step });
7491
+ }
7492
+ function getValidArrow12Hour(value, step) {
7493
+ return getValidArrowNumber(value, { min: 1, max: 12, step });
7494
+ }
7495
+ function getValidArrowMinuteOrSecond(value, step) {
7496
+ return getValidArrowNumber(value, { min: 0, max: 59, step });
7497
+ }
7498
+ function setMinutes(date, value) {
7499
+ const minutes = getValidMinuteOrSecond(value);
7500
+ date.setMinutes(parseInt(minutes, 10));
7501
+ return date;
7502
+ }
7503
+ function setSeconds(date, value) {
7504
+ const seconds = getValidMinuteOrSecond(value);
7505
+ date.setSeconds(parseInt(seconds, 10));
7506
+ return date;
7507
+ }
7508
+ function setHours(date, value) {
7509
+ const hours = getValidHour(value);
7510
+ date.setHours(parseInt(hours, 10));
7511
+ return date;
7512
+ }
7513
+ function set12Hours(date, value, period) {
7514
+ const hours = parseInt(getValid12Hour(value), 10);
7515
+ const convertedHours = convert12HourTo24Hour(hours, period);
7516
+ date.setHours(convertedHours);
7517
+ return date;
7518
+ }
7519
+ function setDateByType(date, value, type, period) {
7520
+ switch (type) {
7521
+ case "minutes":
7522
+ return setMinutes(date, value);
7523
+ case "seconds":
7524
+ return setSeconds(date, value);
7525
+ case "hours":
7526
+ return setHours(date, value);
7527
+ case "12hours": {
7528
+ if (!period) return date;
7529
+ return set12Hours(date, value, period);
7530
+ }
7531
+ default:
7532
+ return date;
7533
+ }
7534
+ }
7535
+ function getDateByType(date, type) {
7536
+ switch (type) {
7537
+ case "minutes":
7538
+ return getValidMinuteOrSecond(String(date.getMinutes()));
7539
+ case "seconds":
7540
+ return getValidMinuteOrSecond(String(date.getSeconds()));
7541
+ case "hours":
7542
+ return getValidHour(String(date.getHours()));
7543
+ case "12hours":
7544
+ const hours = display12HourValue(date.getHours());
7545
+ return getValid12Hour(String(hours));
7546
+ default:
7547
+ return "00";
7548
+ }
7549
+ }
7550
+ function getArrowByType(value, step, type) {
7551
+ switch (type) {
7552
+ case "minutes":
7553
+ return getValidArrowMinuteOrSecond(value, step);
7554
+ case "seconds":
7555
+ return getValidArrowMinuteOrSecond(value, step);
7556
+ case "hours":
7557
+ return getValidArrowHour(value, step);
7558
+ case "12hours":
7559
+ return getValidArrow12Hour(value, step);
7560
+ default:
7561
+ return "00";
7562
+ }
7563
+ }
7564
+ function convert12HourTo24Hour(hour, period) {
7565
+ if (period === "PM") {
7566
+ if (hour <= 11) {
7567
+ return hour + 12;
7568
+ } else {
7569
+ return hour;
7570
+ }
7571
+ } else if (period === "AM") {
7572
+ if (hour === 12) return 0;
7573
+ return hour;
7574
+ }
7575
+ return hour;
7576
+ }
7577
+ function display12HourValue(hours) {
7578
+ if (hours === 0 || hours === 12) return "12";
7579
+ if (hours >= 22) return `${hours - 12}`;
7580
+ if (hours % 12 > 9) return `${hours}`;
7581
+ return `0${hours % 12}`;
7582
+ }
7583
+
7584
+ // src/components/ui/picker/utils/pickerUtils.ts
7585
+ function visualForItem(item, value) {
7586
+ const distance = Math.abs(item - value);
7587
+ const capped = Math.min(distance, 4);
7588
+ const scale = 1 - capped * 0.08;
7589
+ const opacity = 1 - capped * 0.18;
7590
+ const translateY = item === value ? -2 : 0;
7591
+ return { scale, opacity, translateY, distance };
7592
+ }
7441
7593
  var ITEM_HEIGHT = 38.5;
7442
7594
  var VISIBLE_ITEMS = 5;
7443
7595
  var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
7444
- function ScrollColumn({ value, onChange, max, label }) {
7596
+ function getItems(max, step = 1) {
7597
+ return Array.from({ length: Math.ceil(max / step) }, (_, i) => i * step);
7598
+ }
7599
+
7600
+ // src/components/ui/picker/hooks/useScrollColumn.tsx
7601
+ function useScrollColumn({
7602
+ value,
7603
+ onChange,
7604
+ max,
7605
+ step = 1
7606
+ }) {
7445
7607
  const containerRef = useRef(null);
7446
- const items = Array.from({ length: max }, (_, i) => i);
7608
+ const items = getItems(max, step);
7447
7609
  const [isDragging, setIsDragging] = useState(false);
7448
7610
  const [startY, setStartY] = useState(0);
7449
7611
  const [scrollTop, setScrollTop] = useState(0);
7450
7612
  const scrollTimeoutRef = useRef(null);
7613
+ const isTouchRef = useRef(false);
7451
7614
  const itemHeight = ITEM_HEIGHT;
7452
7615
  const centerIndex = CENTER_INDEX;
7453
7616
  const visibleItems = VISIBLE_ITEMS;
@@ -7456,17 +7619,17 @@ function ScrollColumn({ value, onChange, max, label }) {
7456
7619
  if (containerRef.current && !isDragging) {
7457
7620
  requestAnimationFrame(() => {
7458
7621
  if (containerRef.current) {
7459
- const scrollPosition = value * itemHeight;
7622
+ const index = Math.round(value / step);
7623
+ const clampedIndex = Math.max(0, Math.min(items.length - 1, index));
7624
+ const scrollPosition = clampedIndex * itemHeight;
7460
7625
  containerRef.current.scrollTop = scrollPosition;
7461
7626
  }
7462
7627
  });
7463
7628
  }
7464
- }, [value, isDragging, itemHeight]);
7629
+ }, [value, isDragging, itemHeight, step, items.length]);
7465
7630
  useEffect(() => {
7466
7631
  return () => {
7467
- if (scrollTimeoutRef.current) {
7468
- clearTimeout(scrollTimeoutRef.current);
7469
- }
7632
+ if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
7470
7633
  };
7471
7634
  }, []);
7472
7635
  const handleScroll = (e) => {
@@ -7476,42 +7639,102 @@ function ScrollColumn({ value, onChange, max, label }) {
7476
7639
  if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
7477
7640
  scrollTimeoutRef.current = setTimeout(() => {
7478
7641
  if (!containerRef.current) return;
7479
- const newValue = Math.round(containerRef.current.scrollTop / itemHeight);
7480
- if (newValue >= 0 && newValue < max) {
7481
- containerRef.current.scrollTop = newValue * itemHeight;
7642
+ const newIndex = Math.round(containerRef.current.scrollTop / itemHeight);
7643
+ const newValue = items[newIndex];
7644
+ if (newValue !== void 0) {
7645
+ containerRef.current.scrollTop = newIndex * itemHeight;
7482
7646
  if (newValue !== value) onChange(newValue);
7483
7647
  }
7484
7648
  }, 100);
7485
7649
  };
7486
- const handleMouseDown = (e) => {
7650
+ const handleStart = (pageY) => {
7487
7651
  if (!containerRef.current) return;
7488
7652
  setIsDragging(true);
7489
- setStartY(e.pageY);
7653
+ setStartY(pageY);
7490
7654
  setScrollTop(containerRef.current.scrollTop);
7491
7655
  };
7492
- const handleMouseMove = (e) => {
7656
+ const handleMove = (pageY) => {
7493
7657
  if (!isDragging || !containerRef.current) return;
7494
- e.preventDefault();
7495
- containerRef.current.scrollTop = scrollTop + (startY - e.pageY) * 2;
7658
+ const multiplier = isTouchRef.current ? 0.6 : 1;
7659
+ containerRef.current.scrollTop = scrollTop + (startY - pageY) * multiplier;
7496
7660
  };
7497
- const handleMouseUp = () => {
7661
+ const handleEnd = () => {
7498
7662
  if (!containerRef.current) return;
7499
7663
  setIsDragging(false);
7500
7664
  requestAnimationFrame(() => {
7501
7665
  if (!containerRef.current) return;
7502
- const newValue = Math.round(containerRef.current.scrollTop / itemHeight);
7503
- if (newValue >= 0 && newValue < max) {
7504
- containerRef.current.scrollTop = newValue * itemHeight;
7666
+ const newIndex = Math.round(containerRef.current.scrollTop / itemHeight);
7667
+ const newValue = items[newIndex];
7668
+ if (newValue !== void 0) {
7669
+ containerRef.current.scrollTop = newIndex * itemHeight;
7505
7670
  onChange(newValue);
7506
7671
  }
7507
7672
  });
7508
7673
  };
7509
- const handleMouseLeave = () => {
7510
- if (isDragging) handleMouseUp();
7674
+ const handlers = {
7675
+ onScroll: handleScroll,
7676
+ onWheel: (e) => e.stopPropagation(),
7677
+ onMouseDown: (e) => {
7678
+ isTouchRef.current = false;
7679
+ handleStart(e.pageY);
7680
+ },
7681
+ onMouseMove: (e) => {
7682
+ if (isDragging) {
7683
+ e.preventDefault();
7684
+ handleMove(e.pageY);
7685
+ }
7686
+ },
7687
+ onMouseUp: () => handleEnd(),
7688
+ onMouseLeave: () => {
7689
+ if (isDragging) handleEnd();
7690
+ },
7691
+ onTouchStart: (e) => {
7692
+ isTouchRef.current = true;
7693
+ handleStart(e.touches[0].pageY);
7694
+ },
7695
+ onTouchMove: (e) => {
7696
+ if (isDragging) {
7697
+ if (e.cancelable) e.preventDefault();
7698
+ handleMove(e.touches[0].pageY);
7699
+ }
7700
+ },
7701
+ onTouchEnd: () => {
7702
+ isTouchRef.current = false;
7703
+ handleEnd();
7704
+ }
7511
7705
  };
7512
- const handleWheel = (e) => {
7513
- e.stopPropagation();
7706
+ const scrollToIndex = (index) => {
7707
+ if (!containerRef.current) return;
7708
+ const clamped = Math.max(0, Math.min(items.length - 1, index));
7709
+ containerRef.current.scrollTop = clamped * itemHeight;
7514
7710
  };
7711
+ return {
7712
+ items,
7713
+ containerRef,
7714
+ isDragging,
7715
+ itemHeight,
7716
+ containerHeight,
7717
+ centerIndex,
7718
+ handlers,
7719
+ scrollToIndex
7720
+ };
7721
+ }
7722
+ function ScrollColumn({
7723
+ value,
7724
+ onChange,
7725
+ max,
7726
+ label,
7727
+ step = 1
7728
+ }) {
7729
+ const {
7730
+ items,
7731
+ containerRef,
7732
+ isDragging,
7733
+ itemHeight,
7734
+ containerHeight,
7735
+ centerIndex,
7736
+ handlers
7737
+ } = useScrollColumn({ value, onChange, max, step });
7515
7738
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
7516
7739
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground rounded-md font-semibold text-sm sm:text-sm text-center pb-2 uppercase tracking-wider", children: label }),
7517
7740
  /* @__PURE__ */ jsx("div", { className: cn("relative w-20 sm:w-16"), children: /* @__PURE__ */ jsx(
@@ -7519,19 +7742,22 @@ function ScrollColumn({ value, onChange, max, label }) {
7519
7742
  {
7520
7743
  ref: containerRef,
7521
7744
  className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] touch-action-pan-y",
7522
- onScroll: handleScroll,
7523
- onWheel: handleWheel,
7524
- onMouseDown: handleMouseDown,
7525
- onMouseMove: handleMouseMove,
7526
- onMouseUp: handleMouseUp,
7527
- onMouseLeave: handleMouseLeave,
7745
+ onScroll: handlers.onScroll,
7746
+ onWheel: handlers.onWheel,
7747
+ onMouseDown: handlers.onMouseDown,
7748
+ onMouseMove: handlers.onMouseMove,
7749
+ onMouseUp: handlers.onMouseUp,
7750
+ onMouseLeave: handlers.onMouseLeave,
7751
+ onTouchStart: handlers.onTouchStart,
7752
+ onTouchMove: handlers.onTouchMove,
7753
+ onTouchEnd: handlers.onTouchEnd,
7528
7754
  style: {
7529
7755
  height: `${containerHeight}px`,
7530
7756
  paddingTop: `${centerIndex * itemHeight}px`,
7531
7757
  paddingBottom: `${centerIndex * itemHeight}px`,
7532
7758
  cursor: isDragging ? "grabbing" : ""
7533
7759
  },
7534
- children: items.map((item) => {
7760
+ children: items.map((item, idx) => {
7535
7761
  const isSelected = item === value;
7536
7762
  return /* @__PURE__ */ jsx(
7537
7763
  "div",
@@ -7542,7 +7768,11 @@ function ScrollColumn({ value, onChange, max, label }) {
7542
7768
  isSelected ? "text-lg sm:text-xl text-foreground scale-110" : "text-sm sm:text-base text-muted-foreground opacity-60"
7543
7769
  ),
7544
7770
  style: { height: `${itemHeight}px` },
7545
- onClick: () => !isDragging && onChange(item),
7771
+ onClick: () => {
7772
+ if (isDragging || !containerRef.current) return;
7773
+ containerRef.current.scrollTop = idx * itemHeight;
7774
+ onChange(item);
7775
+ },
7546
7776
  children: item.toString().padStart(2, "0")
7547
7777
  },
7548
7778
  item
@@ -7567,7 +7797,7 @@ function TimeScrollPicker({
7567
7797
  else newDate.setSeconds(value);
7568
7798
  setDate(newDate);
7569
7799
  };
7570
- return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-2 p-3 sm:p-4", children: /* @__PURE__ */ jsxs("div", { className: cn("relative flex gap-4 sm:gap-3"), children: [
7800
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-2 p-1.5 sm:p-4", children: /* @__PURE__ */ jsxs("div", { className: cn("relative flex gap-2 sm:gap-3"), children: [
7571
7801
  /* @__PURE__ */ jsx(
7572
7802
  "div",
7573
7803
  {
@@ -7594,6 +7824,7 @@ function TimeScrollPicker({
7594
7824
  value: currentDate.getMinutes(),
7595
7825
  onChange: (v) => handleTimeChange("minutes", v),
7596
7826
  max: 60,
7827
+ step: 5,
7597
7828
  label: "Min",
7598
7829
  hideSeconds
7599
7830
  }
@@ -7737,7 +7968,7 @@ function DateTimePicker({
7737
7968
  }
7738
7969
  );
7739
7970
  const renderPickerContent = () => /* @__PURE__ */ jsxs("div", { className: "p-2 sm:p-3 border border-border rounded-md", children: [
7740
- isMobile && !hideTime ? /* @__PURE__ */ jsxs("div", { className: "min-h-[380px] max-h-[calc(400px)]", children: [
7971
+ isMobile && !hideTime ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-h-0", children: [
7741
7972
  internalDate && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 px-4 py-3 rounded-lg ", children: /* @__PURE__ */ jsxs("span", { className: "text-md font-semibold", children: [
7742
7973
  format(internalDate, "dd 'de' MMMM 'de' yyyy", {
7743
7974
  locale: ptBR
@@ -7771,7 +8002,7 @@ function DateTimePicker({
7771
8002
  className: cn("w-full rounded-none border-none")
7772
8003
  }
7773
8004
  ) }),
7774
- /* @__PURE__ */ jsx(TabsContentBase, { value: "time", className: "mt-0", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center gap-4 py-2 min-h-[330px]", children: /* @__PURE__ */ jsx(
8005
+ /* @__PURE__ */ jsx(TabsContentBase, { value: "time", className: "mt-0", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center gap-4 py-2", children: /* @__PURE__ */ jsx(
7775
8006
  TimeScrollPicker,
7776
8007
  {
7777
8008
  setDate: (d) => handleTimeChange(d ?? null),
@@ -7901,7 +8132,7 @@ function DateTimePicker({
7901
8132
  }
7902
8133
  ),
7903
8134
  /* @__PURE__ */ jsx(ErrorMessage_default, { error }),
7904
- /* @__PURE__ */ jsx(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[95vh] overflow-y-auto", children: renderPickerContent() })
8135
+ /* @__PURE__ */ jsx(DialogContentBase, { className: "p-0 max-h-[65vh] w-[calc(100vw-24px)] sm:w-[calc(100vw-32px)] overflow-hidden flex flex-col", children: /* @__PURE__ */ jsx("div", { className: "overflow-y-auto flex-1", children: renderPickerContent() }) })
7905
8136
  ] }) : /* @__PURE__ */ jsxs(PopoverBase, { open, onOpenChange: setOpen, children: [
7906
8137
  /* @__PURE__ */ jsx(
7907
8138
  PopoverTriggerBase,
@@ -8171,145 +8402,6 @@ function RangePicker({
8171
8402
  ] });
8172
8403
  }
8173
8404
  RangePicker.displayName = "RangePicker";
8174
-
8175
- // src/components/ui/picker/utils/time-picker-utils.ts
8176
- function isValidHour(value) {
8177
- return /^(0[0-9]|1[0-9]|2[0-3])$/.test(value);
8178
- }
8179
- function isValid12Hour(value) {
8180
- return /^(0[1-9]|1[0-2])$/.test(value);
8181
- }
8182
- function isValidMinuteOrSecond(value) {
8183
- return /^[0-5][0-9]$/.test(value);
8184
- }
8185
- function getValidNumber(value, { max, min = 0, loop = false }) {
8186
- let numericValue = parseInt(value, 10);
8187
- if (!isNaN(numericValue)) {
8188
- if (!loop) {
8189
- if (numericValue > max) numericValue = max;
8190
- if (numericValue < min) numericValue = min;
8191
- } else {
8192
- if (numericValue > max) numericValue = min;
8193
- if (numericValue < min) numericValue = max;
8194
- }
8195
- return numericValue.toString().padStart(2, "0");
8196
- }
8197
- return "00";
8198
- }
8199
- function getValidHour(value) {
8200
- if (isValidHour(value)) return value;
8201
- return getValidNumber(value, { max: 23 });
8202
- }
8203
- function getValid12Hour(value) {
8204
- if (isValid12Hour(value)) return value;
8205
- return getValidNumber(value, { min: 1, max: 12 });
8206
- }
8207
- function getValidMinuteOrSecond(value) {
8208
- if (isValidMinuteOrSecond(value)) return value;
8209
- return getValidNumber(value, { max: 59 });
8210
- }
8211
- function getValidArrowNumber(value, { min, max, step }) {
8212
- let numericValue = parseInt(value, 10);
8213
- if (!isNaN(numericValue)) {
8214
- numericValue += step;
8215
- return getValidNumber(String(numericValue), { min, max, loop: true });
8216
- }
8217
- return "00";
8218
- }
8219
- function getValidArrowHour(value, step) {
8220
- return getValidArrowNumber(value, { min: 0, max: 23, step });
8221
- }
8222
- function getValidArrow12Hour(value, step) {
8223
- return getValidArrowNumber(value, { min: 1, max: 12, step });
8224
- }
8225
- function getValidArrowMinuteOrSecond(value, step) {
8226
- return getValidArrowNumber(value, { min: 0, max: 59, step });
8227
- }
8228
- function setMinutes(date, value) {
8229
- const minutes = getValidMinuteOrSecond(value);
8230
- date.setMinutes(parseInt(minutes, 10));
8231
- return date;
8232
- }
8233
- function setSeconds(date, value) {
8234
- const seconds = getValidMinuteOrSecond(value);
8235
- date.setSeconds(parseInt(seconds, 10));
8236
- return date;
8237
- }
8238
- function setHours(date, value) {
8239
- const hours = getValidHour(value);
8240
- date.setHours(parseInt(hours, 10));
8241
- return date;
8242
- }
8243
- function set12Hours(date, value, period) {
8244
- const hours = parseInt(getValid12Hour(value), 10);
8245
- const convertedHours = convert12HourTo24Hour(hours, period);
8246
- date.setHours(convertedHours);
8247
- return date;
8248
- }
8249
- function setDateByType(date, value, type, period) {
8250
- switch (type) {
8251
- case "minutes":
8252
- return setMinutes(date, value);
8253
- case "seconds":
8254
- return setSeconds(date, value);
8255
- case "hours":
8256
- return setHours(date, value);
8257
- case "12hours": {
8258
- if (!period) return date;
8259
- return set12Hours(date, value, period);
8260
- }
8261
- default:
8262
- return date;
8263
- }
8264
- }
8265
- function getDateByType(date, type) {
8266
- switch (type) {
8267
- case "minutes":
8268
- return getValidMinuteOrSecond(String(date.getMinutes()));
8269
- case "seconds":
8270
- return getValidMinuteOrSecond(String(date.getSeconds()));
8271
- case "hours":
8272
- return getValidHour(String(date.getHours()));
8273
- case "12hours":
8274
- const hours = display12HourValue(date.getHours());
8275
- return getValid12Hour(String(hours));
8276
- default:
8277
- return "00";
8278
- }
8279
- }
8280
- function getArrowByType(value, step, type) {
8281
- switch (type) {
8282
- case "minutes":
8283
- return getValidArrowMinuteOrSecond(value, step);
8284
- case "seconds":
8285
- return getValidArrowMinuteOrSecond(value, step);
8286
- case "hours":
8287
- return getValidArrowHour(value, step);
8288
- case "12hours":
8289
- return getValidArrow12Hour(value, step);
8290
- default:
8291
- return "00";
8292
- }
8293
- }
8294
- function convert12HourTo24Hour(hour, period) {
8295
- if (period === "PM") {
8296
- if (hour <= 11) {
8297
- return hour + 12;
8298
- } else {
8299
- return hour;
8300
- }
8301
- } else if (period === "AM") {
8302
- if (hour === 12) return 0;
8303
- return hour;
8304
- }
8305
- return hour;
8306
- }
8307
- function display12HourValue(hours) {
8308
- if (hours === 0 || hours === 12) return "12";
8309
- if (hours >= 22) return `${hours - 12}`;
8310
- if (hours % 12 > 9) return `${hours}`;
8311
- return `0${hours % 12}`;
8312
- }
8313
8405
  var TimePickerInput = React33__default.forwardRef(
8314
8406
  ({
8315
8407
  className,
@@ -8607,16 +8699,6 @@ function TimePicker({
8607
8699
  }
8608
8700
  );
8609
8701
  }
8610
-
8611
- // src/components/ui/picker/utils/pickerUtils.ts
8612
- function visualForItem(item, value) {
8613
- const distance = Math.abs(item - value);
8614
- const capped = Math.min(distance, 4);
8615
- const scale = 1 - capped * 0.08;
8616
- const opacity = 1 - capped * 0.18;
8617
- const translateY = item === value ? -2 : 0;
8618
- return { scale, opacity, translateY, distance };
8619
- }
8620
8702
  function Agenda({
8621
8703
  currentDate,
8622
8704
  events,
@@ -18835,4 +18917,4 @@ function Leaderboard({
18835
18917
  );
18836
18918
  }
18837
18919
 
18838
- export { AddButton, Agenda, AgendaDaysToShow, AgendaDaysToShowAgenda, AgendaView, AlertDialogActionBase, AlertDialogBase, AlertDialogCancelBase, AlertDialogContentBase, AlertDialogDescriptionBase, AlertDialogFooterBase, AlertDialogHeaderBase, AlertDialogOverlayBase, AlertDialogPortalBase, AlertDialogTitleBase, AlertDialogTriggerBase, AvatarBase, AvatarCombobox, AvatarFallbackBase, AvatarImageBase, BackButton, Badge, BarChart_default as BarChart, BreadcrumbBase, BreadcrumbEllipsisBase, BreadcrumbItemBase, BreadcrumbLinkBase, BreadcrumbListBase, BreadcrumbPageBase, BreadcrumbSeparatorBase, Brush_default as Brush, ButtonBase, ButtonGroupBase, CalendarBase, CalendarDndProvider, CalendarDndProviderAgenda, CardBase, CardContentBase, CardDescriptionBase, CardFooterBase, CardHeaderBase, CardTitleBase, CarouselBase, CarouselContentBase, CarouselItemBase, CarouselNextBase, CarouselPreviousBase, ChangeButton, Chart_default as Chart, ChartTotalLegend_default as ChartTotalLegend, CheckButton, CheckboxBase, CheckboxTree, CloseAllButton_default as CloseAllButton, CloseButton, CodeBlock, CollapsibleBase, CollapsibleContentBase, CollapsibleTriggerBase, Combobox, CommandBase, CommandDialogBase, CommandEmptyBase, CommandGroupBase, CommandInputBase, CommandItemBase, CommandListBase, CommandSeparatorBase, CommandShortcutBase, ContextMenuBase, ContextMenuCheckboxItemBase, ContextMenuContentBase, ContextMenuGroupBase, ContextMenuItemBase, ContextMenuLabelBase, ContextMenuPortalBase, ContextMenuRadioGroupBase, ContextMenuRadioItemBase, ContextMenuSeparatorBase, ContextMenuShortcutBase, ContextMenuSubBase, ContextMenuSubContentBase, ContextMenuSubTriggerBase, ContextMenuTriggerBase, CopyButton, DateTimePicker, DayView, DayViewAgenda, DebouncedInput, DefaultEndHour, DefaultEndHourAgenda, DefaultStartHour, DefaultStartHourAgenda, DestructiveDialog, DialogBase, DialogCloseBase, DialogContentBase, DialogDescriptionBase, DialogFooterBase, DialogHeaderBase, DialogOverlayBase, DialogPortalBase, DialogTitleBase, DialogTriggerBase, DownloadButton, DraggableEvent2 as DraggableEvent, DraggableTooltip_default as DraggableTooltip, DrawerBase, DrawerCloseBase, DrawerContentBase, DrawerDescriptionBase, DrawerFooterBase, DrawerHeaderBase, DrawerOverlayBase, DrawerPortalBase, DrawerTitleBase, DrawerTriggerBase, DropDownMenuBase, DropDownMenuCheckboxItemBase, DropDownMenuContentBase, DropDownMenuGroupBase, DropDownMenuItemBase, DropDownMenuLabelBase, DropDownMenuPortalBase, DropDownMenuRadioGroupBase, DropDownMenuRadioItemBase, DropDownMenuSeparatorBase, DropDownMenuShortcutBase, DropDownMenuSubBase, DropDownMenuSubContentBase, DropDownMenuSubTriggerBase, DropDownMenuTriggerBase, DroppableCell, DroppableCellAgenda, EditButton, EndHour, EndHourAgenda, ErrorMessage_default as ErrorMessage, EventAgenda, EventCalendar, EventDialog, EventGap, EventGapAgenda, EventHeight, EventHeightAgenda, EventItem, EventItemAgenda, EventsPopup, FavoriteButton, FileUploader, FilterButton, HideButton, Highlights_default as Highlights, HoverCardBase, HoverCardContentBase, HoverCardTriggerBase, InputBase, InputOTPBase, InputOTPGroupBase, InputOTPSeparatorBase, InputOTPSlotBase, LabelBase_default as LabelBase, Leaderboard, LikeButton, LineChart_default as LineChart, LoadingBase, LockButton, ModalBase, ModalCloseBase, ModalContentBase, ModalDescriptionBase, ModalFooterBase, ModalHeaderBase, ModalOverlayBase, ModalPortalBase, ModalTitleBase, ModalTriggerBase, ModeToggleBase, MonthView, MonthViewAgenda, MoreButton, MultiCombobox, MultiSelect, MultiSelectBase, MultiSelectContentBase, MultiSelectGroupBase, MultiSelectItemBase, MultiSelectSeparatorBase, MultiSelectTriggerBase, MultiSelectValueBase, NavigationMenuBase, NavigationMenuContentBase, NavigationMenuIndicatorBase, NavigationMenuItemBase, NavigationMenuLinkBase, NavigationMenuListBase, NavigationMenuTriggerBase, NavigationMenuViewportBase, NoData_default as NoData, NotificationButton, PeriodsDropdown_default as PeriodsDropdown, PieChart_default as PieChart, PopoverAnchorBase, PopoverBase, PopoverContentBase, PopoverTriggerBase, ProgressBase, ProgressCirclesBase, ProgressPanelsBase, ProgressSegmentsBase, RangePicker, RefreshButton, SaveButton, ScrollAreaBase, ScrollBarBase, SearchButton, Select, SelectBase, SelectContentBase, SelectGroupBase, SelectItemBase, SelectLabelBase, SelectScrollDownButtonBase, SelectScrollUpButtonBase, SelectSeparatorBase, SelectTriggerBase, SelectValueBase, SeparatorBase, SettingsButton, SheetBase, SheetCloseBase, SheetContentBase, SheetDescriptionBase, SheetFooterBase, SheetHeaderBase, SheetOverlayBase, SheetPortalBase, SheetTitleBase, SheetTriggerBase, ShowOnly_default as ShowOnly, SidebarBase, SidebarContentBase, SidebarFooterBase, SidebarGroupActionBase, SidebarGroupBase, SidebarGroupContentBase, SidebarGroupLabelBase, SidebarHeaderBase, SidebarInputBase, SidebarInsetBase, SidebarMenuActionBase, SidebarMenuBadgeBase, SidebarMenuBase, SidebarMenuButtonBase, SidebarMenuItemBase, SidebarMenuSkeletonBase, SidebarMenuSubBase, SidebarMenuSubButtonBase, SidebarMenuSubItemBase, SidebarProviderBase, SidebarRailBase, SidebarSeparatorBase, SidebarTriggerBase, SkeletonBase, SlideBase, StartHour, StartHourAgenda, StatusIndicator, SwitchBase, SystemTooltip_default as SystemTooltip, TableBase, TableBodyBase, TableCaptionBase, TableCellBase, TableFooterBase, TableHeadBase, TableHeaderBase, TableRowBase, TabsBase, TabsContentBase, TabsListBase, TabsTriggerBase, TextAreaBase, ThemeProviderBase, TimePicker, TimePickerInput, TimeSeries_default as TimeSeries, Toaster, TooltipBase, TooltipContentBase, TooltipProviderBase, TooltipSimple_default as TooltipSimple, TooltipTriggerBase, TooltipWithTotal_default as TooltipWithTotal, UndatedEvents, UniversalTooltipRenderer, UnlockButton, UploadButton, UseSideBarBase, ViewButton, VisibilityButton, WeekCellsHeight, WeekCellsHeightAgenda, WeekView, WeekViewAgenda, adaptDataForTooltip, addHoursToDate, addHoursToDateAgenda, addMinutesToDateAgenda, badgeVariants, buttonVariantsBase, compactTick, computeChartWidth, computeNiceMax, computeYAxisTickWidth, convert12HourTo24Hour, createValueFormatter, createYTickFormatter, detectDataFields, detectXAxis, display12HourValue, formatFieldName, generateAdditionalColors, generateColorMap, getAgendaEventsForDay, getAgendaEventsForDayAgenda, getAllEventsForDay, getAllEventsForDayAgenda, getArrowByType, getBorderRadiusClasses, getBorderRadiusClassesAgenda, getDateByType, getEventColorClasses, getEventColorClassesAgenda, getEventEndDate, getEventStartDate, getEventsForDay, getEventsForDayAgenda, getMaxDataValue, getMinDataValue, getSpanningEventsForDay, getSpanningEventsForDayAgenda, getValid12Hour, getValidArrow12Hour, getValidArrowHour, getValidArrowMinuteOrSecond, getValidArrowNumber, getValidHour, getValidMinuteOrSecond, getValidNumber, isMultiDayEvent, isMultiDayEventAgenda, isValid12Hour, isValidHour, isValidMinuteOrSecond, niceCeil, normalizeAttendDate, renderInsideBarLabel, pillLabelRenderer_default as renderPillLabel, resolveChartMargins, resolveContainerPaddingLeft, set12Hours, setDateByType, setHours, setMinutes, setSeconds, sortEvents, sortEventsAgenda, toast, useCalendarDnd, useCalendarDndAgenda, useChartClick, useChartDimensions, useChartHighlights, useChartTooltips, useCurrentTimeIndicator, useCurrentTimeIndicatorAgenda, useDrag, useEventVisibility, useEventVisibilityAgenda, useIsMobile, useTheme, useTimeSeriesRange, visualForItem };
18920
+ export { AddButton, Agenda, AgendaDaysToShow, AgendaDaysToShowAgenda, AgendaView, AlertDialogActionBase, AlertDialogBase, AlertDialogCancelBase, AlertDialogContentBase, AlertDialogDescriptionBase, AlertDialogFooterBase, AlertDialogHeaderBase, AlertDialogOverlayBase, AlertDialogPortalBase, AlertDialogTitleBase, AlertDialogTriggerBase, AvatarBase, AvatarCombobox, AvatarFallbackBase, AvatarImageBase, BackButton, Badge, BarChart_default as BarChart, BreadcrumbBase, BreadcrumbEllipsisBase, BreadcrumbItemBase, BreadcrumbLinkBase, BreadcrumbListBase, BreadcrumbPageBase, BreadcrumbSeparatorBase, Brush_default as Brush, ButtonBase, ButtonGroupBase, CENTER_INDEX, CalendarBase, CalendarDndProvider, CalendarDndProviderAgenda, CardBase, CardContentBase, CardDescriptionBase, CardFooterBase, CardHeaderBase, CardTitleBase, CarouselBase, CarouselContentBase, CarouselItemBase, CarouselNextBase, CarouselPreviousBase, ChangeButton, Chart_default as Chart, ChartTotalLegend_default as ChartTotalLegend, CheckButton, CheckboxBase, CheckboxTree, CloseAllButton_default as CloseAllButton, CloseButton, CodeBlock, CollapsibleBase, CollapsibleContentBase, CollapsibleTriggerBase, Combobox, CommandBase, CommandDialogBase, CommandEmptyBase, CommandGroupBase, CommandInputBase, CommandItemBase, CommandListBase, CommandSeparatorBase, CommandShortcutBase, ContextMenuBase, ContextMenuCheckboxItemBase, ContextMenuContentBase, ContextMenuGroupBase, ContextMenuItemBase, ContextMenuLabelBase, ContextMenuPortalBase, ContextMenuRadioGroupBase, ContextMenuRadioItemBase, ContextMenuSeparatorBase, ContextMenuShortcutBase, ContextMenuSubBase, ContextMenuSubContentBase, ContextMenuSubTriggerBase, ContextMenuTriggerBase, CopyButton, DateTimePicker, DayView, DayViewAgenda, DebouncedInput, DefaultEndHour, DefaultEndHourAgenda, DefaultStartHour, DefaultStartHourAgenda, DestructiveDialog, DialogBase, DialogCloseBase, DialogContentBase, DialogDescriptionBase, DialogFooterBase, DialogHeaderBase, DialogOverlayBase, DialogPortalBase, DialogTitleBase, DialogTriggerBase, DownloadButton, DraggableEvent2 as DraggableEvent, DraggableTooltip_default as DraggableTooltip, DrawerBase, DrawerCloseBase, DrawerContentBase, DrawerDescriptionBase, DrawerFooterBase, DrawerHeaderBase, DrawerOverlayBase, DrawerPortalBase, DrawerTitleBase, DrawerTriggerBase, DropDownMenuBase, DropDownMenuCheckboxItemBase, DropDownMenuContentBase, DropDownMenuGroupBase, DropDownMenuItemBase, DropDownMenuLabelBase, DropDownMenuPortalBase, DropDownMenuRadioGroupBase, DropDownMenuRadioItemBase, DropDownMenuSeparatorBase, DropDownMenuShortcutBase, DropDownMenuSubBase, DropDownMenuSubContentBase, DropDownMenuSubTriggerBase, DropDownMenuTriggerBase, DroppableCell, DroppableCellAgenda, EditButton, EndHour, EndHourAgenda, ErrorMessage_default as ErrorMessage, EventAgenda, EventCalendar, EventDialog, EventGap, EventGapAgenda, EventHeight, EventHeightAgenda, EventItem, EventItemAgenda, EventsPopup, FavoriteButton, FileUploader, FilterButton, HideButton, Highlights_default as Highlights, HoverCardBase, HoverCardContentBase, HoverCardTriggerBase, ITEM_HEIGHT, InputBase, InputOTPBase, InputOTPGroupBase, InputOTPSeparatorBase, InputOTPSlotBase, LabelBase_default as LabelBase, Leaderboard, LikeButton, LineChart_default as LineChart, LoadingBase, LockButton, ModalBase, ModalCloseBase, ModalContentBase, ModalDescriptionBase, ModalFooterBase, ModalHeaderBase, ModalOverlayBase, ModalPortalBase, ModalTitleBase, ModalTriggerBase, ModeToggleBase, MonthView, MonthViewAgenda, MoreButton, MultiCombobox, MultiSelect, MultiSelectBase, MultiSelectContentBase, MultiSelectGroupBase, MultiSelectItemBase, MultiSelectSeparatorBase, MultiSelectTriggerBase, MultiSelectValueBase, NavigationMenuBase, NavigationMenuContentBase, NavigationMenuIndicatorBase, NavigationMenuItemBase, NavigationMenuLinkBase, NavigationMenuListBase, NavigationMenuTriggerBase, NavigationMenuViewportBase, NoData_default as NoData, NotificationButton, PeriodsDropdown_default as PeriodsDropdown, PieChart_default as PieChart, PopoverAnchorBase, PopoverBase, PopoverContentBase, PopoverTriggerBase, ProgressBase, ProgressCirclesBase, ProgressPanelsBase, ProgressSegmentsBase, RangePicker, RefreshButton, SaveButton, ScrollAreaBase, ScrollBarBase, SearchButton, Select, SelectBase, SelectContentBase, SelectGroupBase, SelectItemBase, SelectLabelBase, SelectScrollDownButtonBase, SelectScrollUpButtonBase, SelectSeparatorBase, SelectTriggerBase, SelectValueBase, SeparatorBase, SettingsButton, SheetBase, SheetCloseBase, SheetContentBase, SheetDescriptionBase, SheetFooterBase, SheetHeaderBase, SheetOverlayBase, SheetPortalBase, SheetTitleBase, SheetTriggerBase, ShowOnly_default as ShowOnly, SidebarBase, SidebarContentBase, SidebarFooterBase, SidebarGroupActionBase, SidebarGroupBase, SidebarGroupContentBase, SidebarGroupLabelBase, SidebarHeaderBase, SidebarInputBase, SidebarInsetBase, SidebarMenuActionBase, SidebarMenuBadgeBase, SidebarMenuBase, SidebarMenuButtonBase, SidebarMenuItemBase, SidebarMenuSkeletonBase, SidebarMenuSubBase, SidebarMenuSubButtonBase, SidebarMenuSubItemBase, SidebarProviderBase, SidebarRailBase, SidebarSeparatorBase, SidebarTriggerBase, SkeletonBase, SlideBase, StartHour, StartHourAgenda, StatusIndicator, SwitchBase, SystemTooltip_default as SystemTooltip, TableBase, TableBodyBase, TableCaptionBase, TableCellBase, TableFooterBase, TableHeadBase, TableHeaderBase, TableRowBase, TabsBase, TabsContentBase, TabsListBase, TabsTriggerBase, TextAreaBase, ThemeProviderBase, TimePicker, TimePickerInput, TimeSeries_default as TimeSeries, Toaster, TooltipBase, TooltipContentBase, TooltipProviderBase, TooltipSimple_default as TooltipSimple, TooltipTriggerBase, TooltipWithTotal_default as TooltipWithTotal, UndatedEvents, UniversalTooltipRenderer, UnlockButton, UploadButton, UseSideBarBase, VISIBLE_ITEMS, ViewButton, VisibilityButton, WeekCellsHeight, WeekCellsHeightAgenda, WeekView, WeekViewAgenda, adaptDataForTooltip, addHoursToDate, addHoursToDateAgenda, addMinutesToDateAgenda, badgeVariants, buttonVariantsBase, compactTick, computeChartWidth, computeNiceMax, computeYAxisTickWidth, convert12HourTo24Hour, createValueFormatter, createYTickFormatter, detectDataFields, detectXAxis, display12HourValue, formatFieldName, generateAdditionalColors, generateColorMap, getAgendaEventsForDay, getAgendaEventsForDayAgenda, getAllEventsForDay, getAllEventsForDayAgenda, getArrowByType, getBorderRadiusClasses, getBorderRadiusClassesAgenda, getDateByType, getEventColorClasses, getEventColorClassesAgenda, getEventEndDate, getEventStartDate, getEventsForDay, getEventsForDayAgenda, getItems, getMaxDataValue, getMinDataValue, getSpanningEventsForDay, getSpanningEventsForDayAgenda, getValid12Hour, getValidArrow12Hour, getValidArrowHour, getValidArrowMinuteOrSecond, getValidArrowNumber, getValidHour, getValidMinuteOrSecond, getValidNumber, isMultiDayEvent, isMultiDayEventAgenda, isValid12Hour, isValidHour, isValidMinuteOrSecond, niceCeil, normalizeAttendDate, renderInsideBarLabel, pillLabelRenderer_default as renderPillLabel, resolveChartMargins, resolveContainerPaddingLeft, set12Hours, setDateByType, setHours, setMinutes, setSeconds, sortEvents, sortEventsAgenda, toast, useCalendarDnd, useCalendarDndAgenda, useChartClick, useChartDimensions, useChartHighlights, useChartTooltips, useCurrentTimeIndicator, useCurrentTimeIndicatorAgenda, useDrag, useEventVisibility, useEventVisibilityAgenda, useIsMobile, useTheme, useTimeSeriesRange, visualForItem };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@mlw-packages/react-components",
3
- "developer": "Eduardo Ronchi de Araujo - Desenvolvidor de Sistemas Junio",
3
+ "developer": "Eduardo Junio",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "1.8.9",
7
+ "version": "1.8.11",
8
8
  "homepage": "https://main--68e80310a069c2f10b546ef3.chromatic.com/",
9
9
  "repository": {
10
10
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  "types": "dist/index.d.ts",
16
16
  "style": "dist/global.css",
17
17
  "files": [
18
- "dist"
18
+ "dist"
19
19
  ],
20
20
  "scripts": {
21
21
  "dev": "vite",