@mlw-packages/react-components 1.8.10 → 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
@@ -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
@@ -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,9 +7639,10 @@ 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);
@@ -7491,50 +7655,86 @@ function ScrollColumn({ value, onChange, max, label }) {
7491
7655
  };
7492
7656
  const handleMove = (pageY) => {
7493
7657
  if (!isDragging || !containerRef.current) return;
7494
- containerRef.current.scrollTop = scrollTop + (startY - pageY) * 2;
7658
+ const multiplier = isTouchRef.current ? 0.6 : 1;
7659
+ containerRef.current.scrollTop = scrollTop + (startY - pageY) * multiplier;
7495
7660
  };
7496
7661
  const handleEnd = () => {
7497
7662
  if (!containerRef.current) return;
7498
7663
  setIsDragging(false);
7499
7664
  requestAnimationFrame(() => {
7500
7665
  if (!containerRef.current) return;
7501
- const newValue = Math.round(containerRef.current.scrollTop / itemHeight);
7502
- if (newValue >= 0 && newValue < max) {
7503
- 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;
7504
7670
  onChange(newValue);
7505
7671
  }
7506
7672
  });
7507
7673
  };
7508
- const handleMouseDown = (e) => {
7509
- handleStart(e.pageY);
7510
- };
7511
- const handleMouseMove = (e) => {
7512
- if (isDragging) {
7513
- e.preventDefault();
7514
- handleMove(e.pageY);
7515
- }
7516
- };
7517
- const handleMouseUp = () => {
7518
- handleEnd();
7519
- };
7520
- const handleMouseLeave = () => {
7521
- if (isDragging) handleEnd();
7522
- };
7523
- const handleTouchStart = (e) => {
7524
- handleStart(e.touches[0].pageY);
7525
- };
7526
- const handleTouchMove = (e) => {
7527
- if (isDragging) {
7528
- if (e.cancelable) e.preventDefault();
7529
- handleMove(e.touches[0].pageY);
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();
7530
7704
  }
7531
7705
  };
7532
- const handleTouchEnd = () => {
7533
- handleEnd();
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;
7534
7710
  };
7535
- const handleWheel = (e) => {
7536
- e.stopPropagation();
7711
+ return {
7712
+ items,
7713
+ containerRef,
7714
+ isDragging,
7715
+ itemHeight,
7716
+ containerHeight,
7717
+ centerIndex,
7718
+ handlers,
7719
+ scrollToIndex
7537
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 });
7538
7738
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
7539
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 }),
7540
7740
  /* @__PURE__ */ jsx("div", { className: cn("relative w-20 sm:w-16"), children: /* @__PURE__ */ jsx(
@@ -7542,22 +7742,22 @@ function ScrollColumn({ value, onChange, max, label }) {
7542
7742
  {
7543
7743
  ref: containerRef,
7544
7744
  className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] touch-action-pan-y",
7545
- onScroll: handleScroll,
7546
- onWheel: handleWheel,
7547
- onMouseDown: handleMouseDown,
7548
- onMouseMove: handleMouseMove,
7549
- onMouseUp: handleMouseUp,
7550
- onMouseLeave: handleMouseLeave,
7551
- onTouchStart: handleTouchStart,
7552
- onTouchMove: handleTouchMove,
7553
- onTouchEnd: handleTouchEnd,
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,
7554
7754
  style: {
7555
7755
  height: `${containerHeight}px`,
7556
7756
  paddingTop: `${centerIndex * itemHeight}px`,
7557
7757
  paddingBottom: `${centerIndex * itemHeight}px`,
7558
7758
  cursor: isDragging ? "grabbing" : ""
7559
7759
  },
7560
- children: items.map((item) => {
7760
+ children: items.map((item, idx) => {
7561
7761
  const isSelected = item === value;
7562
7762
  return /* @__PURE__ */ jsx(
7563
7763
  "div",
@@ -7568,7 +7768,11 @@ function ScrollColumn({ value, onChange, max, label }) {
7568
7768
  isSelected ? "text-lg sm:text-xl text-foreground scale-110" : "text-sm sm:text-base text-muted-foreground opacity-60"
7569
7769
  ),
7570
7770
  style: { height: `${itemHeight}px` },
7571
- onClick: () => !isDragging && onChange(item),
7771
+ onClick: () => {
7772
+ if (isDragging || !containerRef.current) return;
7773
+ containerRef.current.scrollTop = idx * itemHeight;
7774
+ onChange(item);
7775
+ },
7572
7776
  children: item.toString().padStart(2, "0")
7573
7777
  },
7574
7778
  item
@@ -7593,7 +7797,7 @@ function TimeScrollPicker({
7593
7797
  else newDate.setSeconds(value);
7594
7798
  setDate(newDate);
7595
7799
  };
7596
- 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: [
7597
7801
  /* @__PURE__ */ jsx(
7598
7802
  "div",
7599
7803
  {
@@ -7620,6 +7824,7 @@ function TimeScrollPicker({
7620
7824
  value: currentDate.getMinutes(),
7621
7825
  onChange: (v) => handleTimeChange("minutes", v),
7622
7826
  max: 60,
7827
+ step: 5,
7623
7828
  label: "Min",
7624
7829
  hideSeconds
7625
7830
  }
@@ -7763,7 +7968,7 @@ function DateTimePicker({
7763
7968
  }
7764
7969
  );
7765
7970
  const renderPickerContent = () => /* @__PURE__ */ jsxs("div", { className: "p-2 sm:p-3 border border-border rounded-md", children: [
7766
- 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: [
7767
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: [
7768
7973
  format(internalDate, "dd 'de' MMMM 'de' yyyy", {
7769
7974
  locale: ptBR
@@ -7797,7 +8002,7 @@ function DateTimePicker({
7797
8002
  className: cn("w-full rounded-none border-none")
7798
8003
  }
7799
8004
  ) }),
7800
- /* @__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(
7801
8006
  TimeScrollPicker,
7802
8007
  {
7803
8008
  setDate: (d) => handleTimeChange(d ?? null),
@@ -7927,7 +8132,7 @@ function DateTimePicker({
7927
8132
  }
7928
8133
  ),
7929
8134
  /* @__PURE__ */ jsx(ErrorMessage_default, { error }),
7930
- /* @__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() }) })
7931
8136
  ] }) : /* @__PURE__ */ jsxs(PopoverBase, { open, onOpenChange: setOpen, children: [
7932
8137
  /* @__PURE__ */ jsx(
7933
8138
  PopoverTriggerBase,
@@ -8197,145 +8402,6 @@ function RangePicker({
8197
8402
  ] });
8198
8403
  }
8199
8404
  RangePicker.displayName = "RangePicker";
8200
-
8201
- // src/components/ui/picker/utils/time-picker-utils.ts
8202
- function isValidHour(value) {
8203
- return /^(0[0-9]|1[0-9]|2[0-3])$/.test(value);
8204
- }
8205
- function isValid12Hour(value) {
8206
- return /^(0[1-9]|1[0-2])$/.test(value);
8207
- }
8208
- function isValidMinuteOrSecond(value) {
8209
- return /^[0-5][0-9]$/.test(value);
8210
- }
8211
- function getValidNumber(value, { max, min = 0, loop = false }) {
8212
- let numericValue = parseInt(value, 10);
8213
- if (!isNaN(numericValue)) {
8214
- if (!loop) {
8215
- if (numericValue > max) numericValue = max;
8216
- if (numericValue < min) numericValue = min;
8217
- } else {
8218
- if (numericValue > max) numericValue = min;
8219
- if (numericValue < min) numericValue = max;
8220
- }
8221
- return numericValue.toString().padStart(2, "0");
8222
- }
8223
- return "00";
8224
- }
8225
- function getValidHour(value) {
8226
- if (isValidHour(value)) return value;
8227
- return getValidNumber(value, { max: 23 });
8228
- }
8229
- function getValid12Hour(value) {
8230
- if (isValid12Hour(value)) return value;
8231
- return getValidNumber(value, { min: 1, max: 12 });
8232
- }
8233
- function getValidMinuteOrSecond(value) {
8234
- if (isValidMinuteOrSecond(value)) return value;
8235
- return getValidNumber(value, { max: 59 });
8236
- }
8237
- function getValidArrowNumber(value, { min, max, step }) {
8238
- let numericValue = parseInt(value, 10);
8239
- if (!isNaN(numericValue)) {
8240
- numericValue += step;
8241
- return getValidNumber(String(numericValue), { min, max, loop: true });
8242
- }
8243
- return "00";
8244
- }
8245
- function getValidArrowHour(value, step) {
8246
- return getValidArrowNumber(value, { min: 0, max: 23, step });
8247
- }
8248
- function getValidArrow12Hour(value, step) {
8249
- return getValidArrowNumber(value, { min: 1, max: 12, step });
8250
- }
8251
- function getValidArrowMinuteOrSecond(value, step) {
8252
- return getValidArrowNumber(value, { min: 0, max: 59, step });
8253
- }
8254
- function setMinutes(date, value) {
8255
- const minutes = getValidMinuteOrSecond(value);
8256
- date.setMinutes(parseInt(minutes, 10));
8257
- return date;
8258
- }
8259
- function setSeconds(date, value) {
8260
- const seconds = getValidMinuteOrSecond(value);
8261
- date.setSeconds(parseInt(seconds, 10));
8262
- return date;
8263
- }
8264
- function setHours(date, value) {
8265
- const hours = getValidHour(value);
8266
- date.setHours(parseInt(hours, 10));
8267
- return date;
8268
- }
8269
- function set12Hours(date, value, period) {
8270
- const hours = parseInt(getValid12Hour(value), 10);
8271
- const convertedHours = convert12HourTo24Hour(hours, period);
8272
- date.setHours(convertedHours);
8273
- return date;
8274
- }
8275
- function setDateByType(date, value, type, period) {
8276
- switch (type) {
8277
- case "minutes":
8278
- return setMinutes(date, value);
8279
- case "seconds":
8280
- return setSeconds(date, value);
8281
- case "hours":
8282
- return setHours(date, value);
8283
- case "12hours": {
8284
- if (!period) return date;
8285
- return set12Hours(date, value, period);
8286
- }
8287
- default:
8288
- return date;
8289
- }
8290
- }
8291
- function getDateByType(date, type) {
8292
- switch (type) {
8293
- case "minutes":
8294
- return getValidMinuteOrSecond(String(date.getMinutes()));
8295
- case "seconds":
8296
- return getValidMinuteOrSecond(String(date.getSeconds()));
8297
- case "hours":
8298
- return getValidHour(String(date.getHours()));
8299
- case "12hours":
8300
- const hours = display12HourValue(date.getHours());
8301
- return getValid12Hour(String(hours));
8302
- default:
8303
- return "00";
8304
- }
8305
- }
8306
- function getArrowByType(value, step, type) {
8307
- switch (type) {
8308
- case "minutes":
8309
- return getValidArrowMinuteOrSecond(value, step);
8310
- case "seconds":
8311
- return getValidArrowMinuteOrSecond(value, step);
8312
- case "hours":
8313
- return getValidArrowHour(value, step);
8314
- case "12hours":
8315
- return getValidArrow12Hour(value, step);
8316
- default:
8317
- return "00";
8318
- }
8319
- }
8320
- function convert12HourTo24Hour(hour, period) {
8321
- if (period === "PM") {
8322
- if (hour <= 11) {
8323
- return hour + 12;
8324
- } else {
8325
- return hour;
8326
- }
8327
- } else if (period === "AM") {
8328
- if (hour === 12) return 0;
8329
- return hour;
8330
- }
8331
- return hour;
8332
- }
8333
- function display12HourValue(hours) {
8334
- if (hours === 0 || hours === 12) return "12";
8335
- if (hours >= 22) return `${hours - 12}`;
8336
- if (hours % 12 > 9) return `${hours}`;
8337
- return `0${hours % 12}`;
8338
- }
8339
8405
  var TimePickerInput = React33__default.forwardRef(
8340
8406
  ({
8341
8407
  className,
@@ -8633,16 +8699,6 @@ function TimePicker({
8633
8699
  }
8634
8700
  );
8635
8701
  }
8636
-
8637
- // src/components/ui/picker/utils/pickerUtils.ts
8638
- function visualForItem(item, value) {
8639
- const distance = Math.abs(item - value);
8640
- const capped = Math.min(distance, 4);
8641
- const scale = 1 - capped * 0.08;
8642
- const opacity = 1 - capped * 0.18;
8643
- const translateY = item === value ? -2 : 0;
8644
- return { scale, opacity, translateY, distance };
8645
- }
8646
8702
  function Agenda({
8647
8703
  currentDate,
8648
8704
  events,
@@ -18861,4 +18917,4 @@ function Leaderboard({
18861
18917
  );
18862
18918
  }
18863
18919
 
18864
- 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
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "1.8.10",
7
+ "version": "1.8.11",
8
8
  "homepage": "https://main--68e80310a069c2f10b546ef3.chromatic.com/",
9
9
  "repository": {
10
10
  "type": "git",