@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.css +13 -67
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +274 -188
- package/dist/index.mjs +271 -189
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1070,7 +1070,7 @@ var ProgressBase = React33__namespace.forwardRef(
|
|
|
1070
1070
|
]
|
|
1071
1071
|
}
|
|
1072
1072
|
),
|
|
1073
|
-
showValue && valuePosition === "right" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
1073
|
+
showValue && valuePosition === "right" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: " text-sm font-bold text-left", children: [
|
|
1074
1074
|
Math.round(value || 0),
|
|
1075
1075
|
"%"
|
|
1076
1076
|
] }),
|
|
@@ -1857,6 +1857,7 @@ var InputBase = React33__namespace.forwardRef(
|
|
|
1857
1857
|
leftIcon,
|
|
1858
1858
|
rightIcon,
|
|
1859
1859
|
"data-testid": dataTestId,
|
|
1860
|
+
numericKeyboard,
|
|
1860
1861
|
error,
|
|
1861
1862
|
...props
|
|
1862
1863
|
}, ref) => {
|
|
@@ -1876,6 +1877,8 @@ var InputBase = React33__namespace.forwardRef(
|
|
|
1876
1877
|
"input",
|
|
1877
1878
|
{
|
|
1878
1879
|
type,
|
|
1880
|
+
inputMode: numericKeyboard ? "numeric" : void 0,
|
|
1881
|
+
pattern: numericKeyboard ? "[0-9]*" : void 0,
|
|
1879
1882
|
className: cn(
|
|
1880
1883
|
"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",
|
|
1881
1884
|
className
|
|
@@ -3285,7 +3288,7 @@ function ModeToggleBase({
|
|
|
3285
3288
|
DropDownMenuContentBase,
|
|
3286
3289
|
{
|
|
3287
3290
|
align: "end",
|
|
3288
|
-
className: "border-border bg-popover text-popover-foreground min-w-[140px]",
|
|
3291
|
+
className: "border-border bg-popover text-popover-foreground min-w-[140px] ",
|
|
3289
3292
|
children: themes.map((theme) => {
|
|
3290
3293
|
const isActive = currentTheme === theme;
|
|
3291
3294
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3293,8 +3296,8 @@ function ModeToggleBase({
|
|
|
3293
3296
|
{
|
|
3294
3297
|
onClick: () => toggleTheme(theme),
|
|
3295
3298
|
className: cn(
|
|
3296
|
-
"gap-
|
|
3297
|
-
isActive ? "bg-accent/80 text-accent-foreground border-l-2 border-primary font-medium pl-1.5" : "hover:bg-accent hover:text-accent-foreground"
|
|
3299
|
+
"gap-2 transition-all duration-200",
|
|
3300
|
+
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"
|
|
3298
3301
|
),
|
|
3299
3302
|
children: [
|
|
3300
3303
|
/* @__PURE__ */ jsxRuntime.jsx(ThemeIcon, { theme }),
|
|
@@ -7481,16 +7484,176 @@ function CalendarBase2({
|
|
|
7481
7484
|
);
|
|
7482
7485
|
}
|
|
7483
7486
|
CalendarBase2.displayName = "CalendarBase";
|
|
7487
|
+
|
|
7488
|
+
// src/components/ui/picker/utils/time-picker-utils.ts
|
|
7489
|
+
function isValidHour(value) {
|
|
7490
|
+
return /^(0[0-9]|1[0-9]|2[0-3])$/.test(value);
|
|
7491
|
+
}
|
|
7492
|
+
function isValid12Hour(value) {
|
|
7493
|
+
return /^(0[1-9]|1[0-2])$/.test(value);
|
|
7494
|
+
}
|
|
7495
|
+
function isValidMinuteOrSecond(value) {
|
|
7496
|
+
return /^[0-5][0-9]$/.test(value);
|
|
7497
|
+
}
|
|
7498
|
+
function getValidNumber(value, { max, min = 0, loop = false }) {
|
|
7499
|
+
let numericValue = parseInt(value, 10);
|
|
7500
|
+
if (!isNaN(numericValue)) {
|
|
7501
|
+
if (!loop) {
|
|
7502
|
+
if (numericValue > max) numericValue = max;
|
|
7503
|
+
if (numericValue < min) numericValue = min;
|
|
7504
|
+
} else {
|
|
7505
|
+
if (numericValue > max) numericValue = min;
|
|
7506
|
+
if (numericValue < min) numericValue = max;
|
|
7507
|
+
}
|
|
7508
|
+
return numericValue.toString().padStart(2, "0");
|
|
7509
|
+
}
|
|
7510
|
+
return "00";
|
|
7511
|
+
}
|
|
7512
|
+
function getValidHour(value) {
|
|
7513
|
+
if (isValidHour(value)) return value;
|
|
7514
|
+
return getValidNumber(value, { max: 23 });
|
|
7515
|
+
}
|
|
7516
|
+
function getValid12Hour(value) {
|
|
7517
|
+
if (isValid12Hour(value)) return value;
|
|
7518
|
+
return getValidNumber(value, { min: 1, max: 12 });
|
|
7519
|
+
}
|
|
7520
|
+
function getValidMinuteOrSecond(value) {
|
|
7521
|
+
if (isValidMinuteOrSecond(value)) return value;
|
|
7522
|
+
return getValidNumber(value, { max: 59 });
|
|
7523
|
+
}
|
|
7524
|
+
function getValidArrowNumber(value, { min, max, step }) {
|
|
7525
|
+
let numericValue = parseInt(value, 10);
|
|
7526
|
+
if (!isNaN(numericValue)) {
|
|
7527
|
+
numericValue += step;
|
|
7528
|
+
return getValidNumber(String(numericValue), { min, max, loop: true });
|
|
7529
|
+
}
|
|
7530
|
+
return "00";
|
|
7531
|
+
}
|
|
7532
|
+
function getValidArrowHour(value, step) {
|
|
7533
|
+
return getValidArrowNumber(value, { min: 0, max: 23, step });
|
|
7534
|
+
}
|
|
7535
|
+
function getValidArrow12Hour(value, step) {
|
|
7536
|
+
return getValidArrowNumber(value, { min: 1, max: 12, step });
|
|
7537
|
+
}
|
|
7538
|
+
function getValidArrowMinuteOrSecond(value, step) {
|
|
7539
|
+
return getValidArrowNumber(value, { min: 0, max: 59, step });
|
|
7540
|
+
}
|
|
7541
|
+
function setMinutes(date, value) {
|
|
7542
|
+
const minutes = getValidMinuteOrSecond(value);
|
|
7543
|
+
date.setMinutes(parseInt(minutes, 10));
|
|
7544
|
+
return date;
|
|
7545
|
+
}
|
|
7546
|
+
function setSeconds(date, value) {
|
|
7547
|
+
const seconds = getValidMinuteOrSecond(value);
|
|
7548
|
+
date.setSeconds(parseInt(seconds, 10));
|
|
7549
|
+
return date;
|
|
7550
|
+
}
|
|
7551
|
+
function setHours(date, value) {
|
|
7552
|
+
const hours = getValidHour(value);
|
|
7553
|
+
date.setHours(parseInt(hours, 10));
|
|
7554
|
+
return date;
|
|
7555
|
+
}
|
|
7556
|
+
function set12Hours(date, value, period) {
|
|
7557
|
+
const hours = parseInt(getValid12Hour(value), 10);
|
|
7558
|
+
const convertedHours = convert12HourTo24Hour(hours, period);
|
|
7559
|
+
date.setHours(convertedHours);
|
|
7560
|
+
return date;
|
|
7561
|
+
}
|
|
7562
|
+
function setDateByType(date, value, type, period) {
|
|
7563
|
+
switch (type) {
|
|
7564
|
+
case "minutes":
|
|
7565
|
+
return setMinutes(date, value);
|
|
7566
|
+
case "seconds":
|
|
7567
|
+
return setSeconds(date, value);
|
|
7568
|
+
case "hours":
|
|
7569
|
+
return setHours(date, value);
|
|
7570
|
+
case "12hours": {
|
|
7571
|
+
if (!period) return date;
|
|
7572
|
+
return set12Hours(date, value, period);
|
|
7573
|
+
}
|
|
7574
|
+
default:
|
|
7575
|
+
return date;
|
|
7576
|
+
}
|
|
7577
|
+
}
|
|
7578
|
+
function getDateByType(date, type) {
|
|
7579
|
+
switch (type) {
|
|
7580
|
+
case "minutes":
|
|
7581
|
+
return getValidMinuteOrSecond(String(date.getMinutes()));
|
|
7582
|
+
case "seconds":
|
|
7583
|
+
return getValidMinuteOrSecond(String(date.getSeconds()));
|
|
7584
|
+
case "hours":
|
|
7585
|
+
return getValidHour(String(date.getHours()));
|
|
7586
|
+
case "12hours":
|
|
7587
|
+
const hours = display12HourValue(date.getHours());
|
|
7588
|
+
return getValid12Hour(String(hours));
|
|
7589
|
+
default:
|
|
7590
|
+
return "00";
|
|
7591
|
+
}
|
|
7592
|
+
}
|
|
7593
|
+
function getArrowByType(value, step, type) {
|
|
7594
|
+
switch (type) {
|
|
7595
|
+
case "minutes":
|
|
7596
|
+
return getValidArrowMinuteOrSecond(value, step);
|
|
7597
|
+
case "seconds":
|
|
7598
|
+
return getValidArrowMinuteOrSecond(value, step);
|
|
7599
|
+
case "hours":
|
|
7600
|
+
return getValidArrowHour(value, step);
|
|
7601
|
+
case "12hours":
|
|
7602
|
+
return getValidArrow12Hour(value, step);
|
|
7603
|
+
default:
|
|
7604
|
+
return "00";
|
|
7605
|
+
}
|
|
7606
|
+
}
|
|
7607
|
+
function convert12HourTo24Hour(hour, period) {
|
|
7608
|
+
if (period === "PM") {
|
|
7609
|
+
if (hour <= 11) {
|
|
7610
|
+
return hour + 12;
|
|
7611
|
+
} else {
|
|
7612
|
+
return hour;
|
|
7613
|
+
}
|
|
7614
|
+
} else if (period === "AM") {
|
|
7615
|
+
if (hour === 12) return 0;
|
|
7616
|
+
return hour;
|
|
7617
|
+
}
|
|
7618
|
+
return hour;
|
|
7619
|
+
}
|
|
7620
|
+
function display12HourValue(hours) {
|
|
7621
|
+
if (hours === 0 || hours === 12) return "12";
|
|
7622
|
+
if (hours >= 22) return `${hours - 12}`;
|
|
7623
|
+
if (hours % 12 > 9) return `${hours}`;
|
|
7624
|
+
return `0${hours % 12}`;
|
|
7625
|
+
}
|
|
7626
|
+
|
|
7627
|
+
// src/components/ui/picker/utils/pickerUtils.ts
|
|
7628
|
+
function visualForItem(item, value) {
|
|
7629
|
+
const distance = Math.abs(item - value);
|
|
7630
|
+
const capped = Math.min(distance, 4);
|
|
7631
|
+
const scale = 1 - capped * 0.08;
|
|
7632
|
+
const opacity = 1 - capped * 0.18;
|
|
7633
|
+
const translateY = item === value ? -2 : 0;
|
|
7634
|
+
return { scale, opacity, translateY, distance };
|
|
7635
|
+
}
|
|
7484
7636
|
var ITEM_HEIGHT = 38.5;
|
|
7485
7637
|
var VISIBLE_ITEMS = 5;
|
|
7486
7638
|
var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
|
|
7487
|
-
function
|
|
7639
|
+
function getItems(max, step = 1) {
|
|
7640
|
+
return Array.from({ length: Math.ceil(max / step) }, (_, i) => i * step);
|
|
7641
|
+
}
|
|
7642
|
+
|
|
7643
|
+
// src/components/ui/picker/hooks/useScrollColumn.tsx
|
|
7644
|
+
function useScrollColumn({
|
|
7645
|
+
value,
|
|
7646
|
+
onChange,
|
|
7647
|
+
max,
|
|
7648
|
+
step = 1
|
|
7649
|
+
}) {
|
|
7488
7650
|
const containerRef = React33.useRef(null);
|
|
7489
|
-
const items =
|
|
7651
|
+
const items = getItems(max, step);
|
|
7490
7652
|
const [isDragging, setIsDragging] = React33.useState(false);
|
|
7491
7653
|
const [startY, setStartY] = React33.useState(0);
|
|
7492
7654
|
const [scrollTop, setScrollTop] = React33.useState(0);
|
|
7493
7655
|
const scrollTimeoutRef = React33.useRef(null);
|
|
7656
|
+
const isTouchRef = React33.useRef(false);
|
|
7494
7657
|
const itemHeight = ITEM_HEIGHT;
|
|
7495
7658
|
const centerIndex = CENTER_INDEX;
|
|
7496
7659
|
const visibleItems = VISIBLE_ITEMS;
|
|
@@ -7499,17 +7662,17 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7499
7662
|
if (containerRef.current && !isDragging) {
|
|
7500
7663
|
requestAnimationFrame(() => {
|
|
7501
7664
|
if (containerRef.current) {
|
|
7502
|
-
const
|
|
7665
|
+
const index = Math.round(value / step);
|
|
7666
|
+
const clampedIndex = Math.max(0, Math.min(items.length - 1, index));
|
|
7667
|
+
const scrollPosition = clampedIndex * itemHeight;
|
|
7503
7668
|
containerRef.current.scrollTop = scrollPosition;
|
|
7504
7669
|
}
|
|
7505
7670
|
});
|
|
7506
7671
|
}
|
|
7507
|
-
}, [value, isDragging, itemHeight]);
|
|
7672
|
+
}, [value, isDragging, itemHeight, step, items.length]);
|
|
7508
7673
|
React33.useEffect(() => {
|
|
7509
7674
|
return () => {
|
|
7510
|
-
if (scrollTimeoutRef.current)
|
|
7511
|
-
clearTimeout(scrollTimeoutRef.current);
|
|
7512
|
-
}
|
|
7675
|
+
if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
|
|
7513
7676
|
};
|
|
7514
7677
|
}, []);
|
|
7515
7678
|
const handleScroll = (e) => {
|
|
@@ -7519,42 +7682,102 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7519
7682
|
if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
|
|
7520
7683
|
scrollTimeoutRef.current = setTimeout(() => {
|
|
7521
7684
|
if (!containerRef.current) return;
|
|
7522
|
-
const
|
|
7523
|
-
|
|
7524
|
-
|
|
7685
|
+
const newIndex = Math.round(containerRef.current.scrollTop / itemHeight);
|
|
7686
|
+
const newValue = items[newIndex];
|
|
7687
|
+
if (newValue !== void 0) {
|
|
7688
|
+
containerRef.current.scrollTop = newIndex * itemHeight;
|
|
7525
7689
|
if (newValue !== value) onChange(newValue);
|
|
7526
7690
|
}
|
|
7527
7691
|
}, 100);
|
|
7528
7692
|
};
|
|
7529
|
-
const
|
|
7693
|
+
const handleStart = (pageY) => {
|
|
7530
7694
|
if (!containerRef.current) return;
|
|
7531
7695
|
setIsDragging(true);
|
|
7532
|
-
setStartY(
|
|
7696
|
+
setStartY(pageY);
|
|
7533
7697
|
setScrollTop(containerRef.current.scrollTop);
|
|
7534
7698
|
};
|
|
7535
|
-
const
|
|
7699
|
+
const handleMove = (pageY) => {
|
|
7536
7700
|
if (!isDragging || !containerRef.current) return;
|
|
7537
|
-
|
|
7538
|
-
containerRef.current.scrollTop = scrollTop + (startY -
|
|
7701
|
+
const multiplier = isTouchRef.current ? 0.6 : 1;
|
|
7702
|
+
containerRef.current.scrollTop = scrollTop + (startY - pageY) * multiplier;
|
|
7539
7703
|
};
|
|
7540
|
-
const
|
|
7704
|
+
const handleEnd = () => {
|
|
7541
7705
|
if (!containerRef.current) return;
|
|
7542
7706
|
setIsDragging(false);
|
|
7543
7707
|
requestAnimationFrame(() => {
|
|
7544
7708
|
if (!containerRef.current) return;
|
|
7545
|
-
const
|
|
7546
|
-
|
|
7547
|
-
|
|
7709
|
+
const newIndex = Math.round(containerRef.current.scrollTop / itemHeight);
|
|
7710
|
+
const newValue = items[newIndex];
|
|
7711
|
+
if (newValue !== void 0) {
|
|
7712
|
+
containerRef.current.scrollTop = newIndex * itemHeight;
|
|
7548
7713
|
onChange(newValue);
|
|
7549
7714
|
}
|
|
7550
7715
|
});
|
|
7551
7716
|
};
|
|
7552
|
-
const
|
|
7553
|
-
|
|
7717
|
+
const handlers = {
|
|
7718
|
+
onScroll: handleScroll,
|
|
7719
|
+
onWheel: (e) => e.stopPropagation(),
|
|
7720
|
+
onMouseDown: (e) => {
|
|
7721
|
+
isTouchRef.current = false;
|
|
7722
|
+
handleStart(e.pageY);
|
|
7723
|
+
},
|
|
7724
|
+
onMouseMove: (e) => {
|
|
7725
|
+
if (isDragging) {
|
|
7726
|
+
e.preventDefault();
|
|
7727
|
+
handleMove(e.pageY);
|
|
7728
|
+
}
|
|
7729
|
+
},
|
|
7730
|
+
onMouseUp: () => handleEnd(),
|
|
7731
|
+
onMouseLeave: () => {
|
|
7732
|
+
if (isDragging) handleEnd();
|
|
7733
|
+
},
|
|
7734
|
+
onTouchStart: (e) => {
|
|
7735
|
+
isTouchRef.current = true;
|
|
7736
|
+
handleStart(e.touches[0].pageY);
|
|
7737
|
+
},
|
|
7738
|
+
onTouchMove: (e) => {
|
|
7739
|
+
if (isDragging) {
|
|
7740
|
+
if (e.cancelable) e.preventDefault();
|
|
7741
|
+
handleMove(e.touches[0].pageY);
|
|
7742
|
+
}
|
|
7743
|
+
},
|
|
7744
|
+
onTouchEnd: () => {
|
|
7745
|
+
isTouchRef.current = false;
|
|
7746
|
+
handleEnd();
|
|
7747
|
+
}
|
|
7554
7748
|
};
|
|
7555
|
-
const
|
|
7556
|
-
|
|
7749
|
+
const scrollToIndex = (index) => {
|
|
7750
|
+
if (!containerRef.current) return;
|
|
7751
|
+
const clamped = Math.max(0, Math.min(items.length - 1, index));
|
|
7752
|
+
containerRef.current.scrollTop = clamped * itemHeight;
|
|
7557
7753
|
};
|
|
7754
|
+
return {
|
|
7755
|
+
items,
|
|
7756
|
+
containerRef,
|
|
7757
|
+
isDragging,
|
|
7758
|
+
itemHeight,
|
|
7759
|
+
containerHeight,
|
|
7760
|
+
centerIndex,
|
|
7761
|
+
handlers,
|
|
7762
|
+
scrollToIndex
|
|
7763
|
+
};
|
|
7764
|
+
}
|
|
7765
|
+
function ScrollColumn({
|
|
7766
|
+
value,
|
|
7767
|
+
onChange,
|
|
7768
|
+
max,
|
|
7769
|
+
label,
|
|
7770
|
+
step = 1
|
|
7771
|
+
}) {
|
|
7772
|
+
const {
|
|
7773
|
+
items,
|
|
7774
|
+
containerRef,
|
|
7775
|
+
isDragging,
|
|
7776
|
+
itemHeight,
|
|
7777
|
+
containerHeight,
|
|
7778
|
+
centerIndex,
|
|
7779
|
+
handlers
|
|
7780
|
+
} = useScrollColumn({ value, onChange, max, step });
|
|
7558
7781
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
7559
7782
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground rounded-md font-semibold text-sm sm:text-sm text-center pb-2 uppercase tracking-wider", children: label }),
|
|
7560
7783
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative w-20 sm:w-16"), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7562,19 +7785,22 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7562
7785
|
{
|
|
7563
7786
|
ref: containerRef,
|
|
7564
7787
|
className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] touch-action-pan-y",
|
|
7565
|
-
onScroll:
|
|
7566
|
-
onWheel:
|
|
7567
|
-
onMouseDown:
|
|
7568
|
-
onMouseMove:
|
|
7569
|
-
onMouseUp:
|
|
7570
|
-
onMouseLeave:
|
|
7788
|
+
onScroll: handlers.onScroll,
|
|
7789
|
+
onWheel: handlers.onWheel,
|
|
7790
|
+
onMouseDown: handlers.onMouseDown,
|
|
7791
|
+
onMouseMove: handlers.onMouseMove,
|
|
7792
|
+
onMouseUp: handlers.onMouseUp,
|
|
7793
|
+
onMouseLeave: handlers.onMouseLeave,
|
|
7794
|
+
onTouchStart: handlers.onTouchStart,
|
|
7795
|
+
onTouchMove: handlers.onTouchMove,
|
|
7796
|
+
onTouchEnd: handlers.onTouchEnd,
|
|
7571
7797
|
style: {
|
|
7572
7798
|
height: `${containerHeight}px`,
|
|
7573
7799
|
paddingTop: `${centerIndex * itemHeight}px`,
|
|
7574
7800
|
paddingBottom: `${centerIndex * itemHeight}px`,
|
|
7575
7801
|
cursor: isDragging ? "grabbing" : ""
|
|
7576
7802
|
},
|
|
7577
|
-
children: items.map((item) => {
|
|
7803
|
+
children: items.map((item, idx) => {
|
|
7578
7804
|
const isSelected = item === value;
|
|
7579
7805
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7580
7806
|
"div",
|
|
@@ -7585,7 +7811,11 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7585
7811
|
isSelected ? "text-lg sm:text-xl text-foreground scale-110" : "text-sm sm:text-base text-muted-foreground opacity-60"
|
|
7586
7812
|
),
|
|
7587
7813
|
style: { height: `${itemHeight}px` },
|
|
7588
|
-
onClick: () =>
|
|
7814
|
+
onClick: () => {
|
|
7815
|
+
if (isDragging || !containerRef.current) return;
|
|
7816
|
+
containerRef.current.scrollTop = idx * itemHeight;
|
|
7817
|
+
onChange(item);
|
|
7818
|
+
},
|
|
7589
7819
|
children: item.toString().padStart(2, "0")
|
|
7590
7820
|
},
|
|
7591
7821
|
item
|
|
@@ -7610,7 +7840,7 @@ function TimeScrollPicker({
|
|
|
7610
7840
|
else newDate.setSeconds(value);
|
|
7611
7841
|
setDate(newDate);
|
|
7612
7842
|
};
|
|
7613
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center gap-2 p-
|
|
7843
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center gap-2 p-1.5 sm:p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative flex gap-2 sm:gap-3"), children: [
|
|
7614
7844
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7615
7845
|
"div",
|
|
7616
7846
|
{
|
|
@@ -7637,6 +7867,7 @@ function TimeScrollPicker({
|
|
|
7637
7867
|
value: currentDate.getMinutes(),
|
|
7638
7868
|
onChange: (v) => handleTimeChange("minutes", v),
|
|
7639
7869
|
max: 60,
|
|
7870
|
+
step: 5,
|
|
7640
7871
|
label: "Min",
|
|
7641
7872
|
hideSeconds
|
|
7642
7873
|
}
|
|
@@ -7780,7 +8011,7 @@ function DateTimePicker({
|
|
|
7780
8011
|
}
|
|
7781
8012
|
);
|
|
7782
8013
|
const renderPickerContent = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2 sm:p-3 border border-border rounded-md", children: [
|
|
7783
|
-
isMobile && !hideTime ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
8014
|
+
isMobile && !hideTime ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-h-0", children: [
|
|
7784
8015
|
internalDate && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3 px-4 py-3 rounded-lg ", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-md font-semibold", children: [
|
|
7785
8016
|
dateFns.format(internalDate, "dd 'de' MMMM 'de' yyyy", {
|
|
7786
8017
|
locale: locale.ptBR
|
|
@@ -7814,7 +8045,7 @@ function DateTimePicker({
|
|
|
7814
8045
|
className: cn("w-full rounded-none border-none")
|
|
7815
8046
|
}
|
|
7816
8047
|
) }),
|
|
7817
|
-
/* @__PURE__ */ jsxRuntime.jsx(TabsContentBase, { value: "time", className: "mt-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center gap-4 py-2
|
|
8048
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsContentBase, { value: "time", className: "mt-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center gap-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7818
8049
|
TimeScrollPicker,
|
|
7819
8050
|
{
|
|
7820
8051
|
setDate: (d) => handleTimeChange(d ?? null),
|
|
@@ -7944,7 +8175,7 @@ function DateTimePicker({
|
|
|
7944
8175
|
}
|
|
7945
8176
|
),
|
|
7946
8177
|
/* @__PURE__ */ jsxRuntime.jsx(ErrorMessage_default, { error }),
|
|
7947
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogContentBase, { className: "p-0 max-w-[
|
|
8178
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogContentBase, { className: "p-0 max-h-[65vh] w-[calc(100vw-24px)] sm:w-[calc(100vw-32px)] overflow-hidden flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto flex-1", children: renderPickerContent() }) })
|
|
7948
8179
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
7949
8180
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7950
8181
|
PopoverTriggerBase,
|
|
@@ -8214,145 +8445,6 @@ function RangePicker({
|
|
|
8214
8445
|
] });
|
|
8215
8446
|
}
|
|
8216
8447
|
RangePicker.displayName = "RangePicker";
|
|
8217
|
-
|
|
8218
|
-
// src/components/ui/picker/utils/time-picker-utils.ts
|
|
8219
|
-
function isValidHour(value) {
|
|
8220
|
-
return /^(0[0-9]|1[0-9]|2[0-3])$/.test(value);
|
|
8221
|
-
}
|
|
8222
|
-
function isValid12Hour(value) {
|
|
8223
|
-
return /^(0[1-9]|1[0-2])$/.test(value);
|
|
8224
|
-
}
|
|
8225
|
-
function isValidMinuteOrSecond(value) {
|
|
8226
|
-
return /^[0-5][0-9]$/.test(value);
|
|
8227
|
-
}
|
|
8228
|
-
function getValidNumber(value, { max, min = 0, loop = false }) {
|
|
8229
|
-
let numericValue = parseInt(value, 10);
|
|
8230
|
-
if (!isNaN(numericValue)) {
|
|
8231
|
-
if (!loop) {
|
|
8232
|
-
if (numericValue > max) numericValue = max;
|
|
8233
|
-
if (numericValue < min) numericValue = min;
|
|
8234
|
-
} else {
|
|
8235
|
-
if (numericValue > max) numericValue = min;
|
|
8236
|
-
if (numericValue < min) numericValue = max;
|
|
8237
|
-
}
|
|
8238
|
-
return numericValue.toString().padStart(2, "0");
|
|
8239
|
-
}
|
|
8240
|
-
return "00";
|
|
8241
|
-
}
|
|
8242
|
-
function getValidHour(value) {
|
|
8243
|
-
if (isValidHour(value)) return value;
|
|
8244
|
-
return getValidNumber(value, { max: 23 });
|
|
8245
|
-
}
|
|
8246
|
-
function getValid12Hour(value) {
|
|
8247
|
-
if (isValid12Hour(value)) return value;
|
|
8248
|
-
return getValidNumber(value, { min: 1, max: 12 });
|
|
8249
|
-
}
|
|
8250
|
-
function getValidMinuteOrSecond(value) {
|
|
8251
|
-
if (isValidMinuteOrSecond(value)) return value;
|
|
8252
|
-
return getValidNumber(value, { max: 59 });
|
|
8253
|
-
}
|
|
8254
|
-
function getValidArrowNumber(value, { min, max, step }) {
|
|
8255
|
-
let numericValue = parseInt(value, 10);
|
|
8256
|
-
if (!isNaN(numericValue)) {
|
|
8257
|
-
numericValue += step;
|
|
8258
|
-
return getValidNumber(String(numericValue), { min, max, loop: true });
|
|
8259
|
-
}
|
|
8260
|
-
return "00";
|
|
8261
|
-
}
|
|
8262
|
-
function getValidArrowHour(value, step) {
|
|
8263
|
-
return getValidArrowNumber(value, { min: 0, max: 23, step });
|
|
8264
|
-
}
|
|
8265
|
-
function getValidArrow12Hour(value, step) {
|
|
8266
|
-
return getValidArrowNumber(value, { min: 1, max: 12, step });
|
|
8267
|
-
}
|
|
8268
|
-
function getValidArrowMinuteOrSecond(value, step) {
|
|
8269
|
-
return getValidArrowNumber(value, { min: 0, max: 59, step });
|
|
8270
|
-
}
|
|
8271
|
-
function setMinutes(date, value) {
|
|
8272
|
-
const minutes = getValidMinuteOrSecond(value);
|
|
8273
|
-
date.setMinutes(parseInt(minutes, 10));
|
|
8274
|
-
return date;
|
|
8275
|
-
}
|
|
8276
|
-
function setSeconds(date, value) {
|
|
8277
|
-
const seconds = getValidMinuteOrSecond(value);
|
|
8278
|
-
date.setSeconds(parseInt(seconds, 10));
|
|
8279
|
-
return date;
|
|
8280
|
-
}
|
|
8281
|
-
function setHours(date, value) {
|
|
8282
|
-
const hours = getValidHour(value);
|
|
8283
|
-
date.setHours(parseInt(hours, 10));
|
|
8284
|
-
return date;
|
|
8285
|
-
}
|
|
8286
|
-
function set12Hours(date, value, period) {
|
|
8287
|
-
const hours = parseInt(getValid12Hour(value), 10);
|
|
8288
|
-
const convertedHours = convert12HourTo24Hour(hours, period);
|
|
8289
|
-
date.setHours(convertedHours);
|
|
8290
|
-
return date;
|
|
8291
|
-
}
|
|
8292
|
-
function setDateByType(date, value, type, period) {
|
|
8293
|
-
switch (type) {
|
|
8294
|
-
case "minutes":
|
|
8295
|
-
return setMinutes(date, value);
|
|
8296
|
-
case "seconds":
|
|
8297
|
-
return setSeconds(date, value);
|
|
8298
|
-
case "hours":
|
|
8299
|
-
return setHours(date, value);
|
|
8300
|
-
case "12hours": {
|
|
8301
|
-
if (!period) return date;
|
|
8302
|
-
return set12Hours(date, value, period);
|
|
8303
|
-
}
|
|
8304
|
-
default:
|
|
8305
|
-
return date;
|
|
8306
|
-
}
|
|
8307
|
-
}
|
|
8308
|
-
function getDateByType(date, type) {
|
|
8309
|
-
switch (type) {
|
|
8310
|
-
case "minutes":
|
|
8311
|
-
return getValidMinuteOrSecond(String(date.getMinutes()));
|
|
8312
|
-
case "seconds":
|
|
8313
|
-
return getValidMinuteOrSecond(String(date.getSeconds()));
|
|
8314
|
-
case "hours":
|
|
8315
|
-
return getValidHour(String(date.getHours()));
|
|
8316
|
-
case "12hours":
|
|
8317
|
-
const hours = display12HourValue(date.getHours());
|
|
8318
|
-
return getValid12Hour(String(hours));
|
|
8319
|
-
default:
|
|
8320
|
-
return "00";
|
|
8321
|
-
}
|
|
8322
|
-
}
|
|
8323
|
-
function getArrowByType(value, step, type) {
|
|
8324
|
-
switch (type) {
|
|
8325
|
-
case "minutes":
|
|
8326
|
-
return getValidArrowMinuteOrSecond(value, step);
|
|
8327
|
-
case "seconds":
|
|
8328
|
-
return getValidArrowMinuteOrSecond(value, step);
|
|
8329
|
-
case "hours":
|
|
8330
|
-
return getValidArrowHour(value, step);
|
|
8331
|
-
case "12hours":
|
|
8332
|
-
return getValidArrow12Hour(value, step);
|
|
8333
|
-
default:
|
|
8334
|
-
return "00";
|
|
8335
|
-
}
|
|
8336
|
-
}
|
|
8337
|
-
function convert12HourTo24Hour(hour, period) {
|
|
8338
|
-
if (period === "PM") {
|
|
8339
|
-
if (hour <= 11) {
|
|
8340
|
-
return hour + 12;
|
|
8341
|
-
} else {
|
|
8342
|
-
return hour;
|
|
8343
|
-
}
|
|
8344
|
-
} else if (period === "AM") {
|
|
8345
|
-
if (hour === 12) return 0;
|
|
8346
|
-
return hour;
|
|
8347
|
-
}
|
|
8348
|
-
return hour;
|
|
8349
|
-
}
|
|
8350
|
-
function display12HourValue(hours) {
|
|
8351
|
-
if (hours === 0 || hours === 12) return "12";
|
|
8352
|
-
if (hours >= 22) return `${hours - 12}`;
|
|
8353
|
-
if (hours % 12 > 9) return `${hours}`;
|
|
8354
|
-
return `0${hours % 12}`;
|
|
8355
|
-
}
|
|
8356
8448
|
var TimePickerInput = React33__namespace.default.forwardRef(
|
|
8357
8449
|
({
|
|
8358
8450
|
className,
|
|
@@ -8650,16 +8742,6 @@ function TimePicker({
|
|
|
8650
8742
|
}
|
|
8651
8743
|
);
|
|
8652
8744
|
}
|
|
8653
|
-
|
|
8654
|
-
// src/components/ui/picker/utils/pickerUtils.ts
|
|
8655
|
-
function visualForItem(item, value) {
|
|
8656
|
-
const distance = Math.abs(item - value);
|
|
8657
|
-
const capped = Math.min(distance, 4);
|
|
8658
|
-
const scale = 1 - capped * 0.08;
|
|
8659
|
-
const opacity = 1 - capped * 0.18;
|
|
8660
|
-
const translateY = item === value ? -2 : 0;
|
|
8661
|
-
return { scale, opacity, translateY, distance };
|
|
8662
|
-
}
|
|
8663
8745
|
function Agenda({
|
|
8664
8746
|
currentDate,
|
|
8665
8747
|
events,
|
|
@@ -18911,6 +18993,7 @@ exports.BreadcrumbSeparatorBase = BreadcrumbSeparatorBase;
|
|
|
18911
18993
|
exports.Brush = Brush_default;
|
|
18912
18994
|
exports.ButtonBase = ButtonBase;
|
|
18913
18995
|
exports.ButtonGroupBase = ButtonGroupBase;
|
|
18996
|
+
exports.CENTER_INDEX = CENTER_INDEX;
|
|
18914
18997
|
exports.CalendarBase = CalendarBase;
|
|
18915
18998
|
exports.CalendarDndProvider = CalendarDndProvider;
|
|
18916
18999
|
exports.CalendarDndProviderAgenda = CalendarDndProviderAgenda;
|
|
@@ -19034,6 +19117,7 @@ exports.Highlights = Highlights_default;
|
|
|
19034
19117
|
exports.HoverCardBase = HoverCardBase;
|
|
19035
19118
|
exports.HoverCardContentBase = HoverCardContentBase;
|
|
19036
19119
|
exports.HoverCardTriggerBase = HoverCardTriggerBase;
|
|
19120
|
+
exports.ITEM_HEIGHT = ITEM_HEIGHT;
|
|
19037
19121
|
exports.InputBase = InputBase;
|
|
19038
19122
|
exports.InputOTPBase = InputOTPBase;
|
|
19039
19123
|
exports.InputOTPGroupBase = InputOTPGroupBase;
|
|
@@ -19177,6 +19261,7 @@ exports.UniversalTooltipRenderer = UniversalTooltipRenderer;
|
|
|
19177
19261
|
exports.UnlockButton = UnlockButton;
|
|
19178
19262
|
exports.UploadButton = UploadButton;
|
|
19179
19263
|
exports.UseSideBarBase = UseSideBarBase;
|
|
19264
|
+
exports.VISIBLE_ITEMS = VISIBLE_ITEMS;
|
|
19180
19265
|
exports.ViewButton = ViewButton;
|
|
19181
19266
|
exports.VisibilityButton = VisibilityButton;
|
|
19182
19267
|
exports.WeekCellsHeight = WeekCellsHeight;
|
|
@@ -19216,6 +19301,7 @@ exports.getEventEndDate = getEventEndDate;
|
|
|
19216
19301
|
exports.getEventStartDate = getEventStartDate;
|
|
19217
19302
|
exports.getEventsForDay = getEventsForDay;
|
|
19218
19303
|
exports.getEventsForDayAgenda = getEventsForDayAgenda;
|
|
19304
|
+
exports.getItems = getItems;
|
|
19219
19305
|
exports.getMaxDataValue = getMaxDataValue;
|
|
19220
19306
|
exports.getMinDataValue = getMinDataValue;
|
|
19221
19307
|
exports.getSpanningEventsForDay = getSpanningEventsForDay;
|