@pos-360/horizon 0.30.0 → 0.30.1
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/{chunk-MOCMPGHB.js → chunk-H7KYKSHC.js} +34 -44
- package/dist/chunk-H7KYKSHC.js.map +1 -0
- package/dist/{chunk-OWU2ABN4.mjs → chunk-RA7KTV62.mjs} +35 -45
- package/dist/chunk-RA7KTV62.mjs.map +1 -0
- package/dist/index.js +106 -106
- package/dist/index.mjs +1 -1
- package/dist/primitives.js +106 -106
- package/dist/primitives.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-MOCMPGHB.js.map +0 -1
- package/dist/chunk-OWU2ABN4.mjs.map +0 -1
|
@@ -2129,12 +2129,12 @@ function to24Hour(hour12, period) {
|
|
|
2129
2129
|
function pad(n) {
|
|
2130
2130
|
return n.toString().padStart(2, "0");
|
|
2131
2131
|
}
|
|
2132
|
-
function clamp(val,
|
|
2133
|
-
return Math.max(
|
|
2132
|
+
function clamp(val, min2, max) {
|
|
2133
|
+
return Math.max(min2, Math.min(max, val));
|
|
2134
2134
|
}
|
|
2135
2135
|
function TimeInput({
|
|
2136
2136
|
value,
|
|
2137
|
-
min,
|
|
2137
|
+
min: min2,
|
|
2138
2138
|
max,
|
|
2139
2139
|
onChange,
|
|
2140
2140
|
onComplete,
|
|
@@ -2157,7 +2157,7 @@ function TimeInput({
|
|
|
2157
2157
|
return;
|
|
2158
2158
|
}
|
|
2159
2159
|
const parsed = parseInt(raw, 10);
|
|
2160
|
-
const clamped = clamp(parsed,
|
|
2160
|
+
const clamped = clamp(parsed, min2, max);
|
|
2161
2161
|
committedRef.current = true;
|
|
2162
2162
|
onChange(clamped);
|
|
2163
2163
|
setEditValue(null);
|
|
@@ -2176,7 +2176,7 @@ function TimeInput({
|
|
|
2176
2176
|
}
|
|
2177
2177
|
const parsed = parseInt(editValue, 10);
|
|
2178
2178
|
if (!isNaN(parsed)) {
|
|
2179
|
-
onChange(clamp(parsed,
|
|
2179
|
+
onChange(clamp(parsed, min2, max));
|
|
2180
2180
|
}
|
|
2181
2181
|
setEditValue(null);
|
|
2182
2182
|
};
|
|
@@ -2189,14 +2189,14 @@ function TimeInput({
|
|
|
2189
2189
|
internalRef.current?.blur();
|
|
2190
2190
|
} else if (e.key === "ArrowUp") {
|
|
2191
2191
|
e.preventDefault();
|
|
2192
|
-
const curr = value ??
|
|
2193
|
-
const next = curr >= max ?
|
|
2192
|
+
const curr = value ?? min2;
|
|
2193
|
+
const next = curr >= max ? min2 : curr + 1;
|
|
2194
2194
|
onChange(next);
|
|
2195
2195
|
setEditValue(pad(next));
|
|
2196
2196
|
} else if (e.key === "ArrowDown") {
|
|
2197
2197
|
e.preventDefault();
|
|
2198
2198
|
const curr = value ?? max;
|
|
2199
|
-
const next = curr <=
|
|
2199
|
+
const next = curr <= min2 ? max : curr - 1;
|
|
2200
2200
|
onChange(next);
|
|
2201
2201
|
setEditValue(pad(next));
|
|
2202
2202
|
}
|
|
@@ -2569,9 +2569,14 @@ function CalendarMonth({
|
|
|
2569
2569
|
onMouseLeave: () => onDayHover(void 0),
|
|
2570
2570
|
children: days.map((day, idx) => {
|
|
2571
2571
|
const outside = !dateFns.isSameMonth(day, month);
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2572
|
+
if (outside) {
|
|
2573
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-9" }, idx);
|
|
2574
|
+
}
|
|
2575
|
+
const isFuture = dateFns.isAfter(dateFns.startOfDay(day), dateFns.startOfDay(today));
|
|
2576
|
+
const disabled = isFuture;
|
|
2577
|
+
const inRange = !disabled && isInRange(day);
|
|
2578
|
+
const rangeStart = !disabled && isRangeStart(day);
|
|
2579
|
+
const rangeEnd = !disabled && isRangeEnd(day);
|
|
2575
2580
|
const isToday = dateFns.isSameDay(day, today);
|
|
2576
2581
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2577
2582
|
"div",
|
|
@@ -2586,16 +2591,17 @@ function CalendarMonth({
|
|
|
2586
2591
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2587
2592
|
"button",
|
|
2588
2593
|
{
|
|
2589
|
-
onClick: () => !
|
|
2590
|
-
onMouseEnter: () => !
|
|
2591
|
-
tabIndex:
|
|
2594
|
+
onClick: () => !disabled && onDayClick(day),
|
|
2595
|
+
onMouseEnter: () => !disabled && onDayHover(day),
|
|
2596
|
+
tabIndex: disabled ? -1 : 0,
|
|
2597
|
+
disabled,
|
|
2592
2598
|
className: chunk23BJPJOK_js.cn(
|
|
2593
2599
|
"w-8 h-8 rounded-full text-sm flex items-center justify-center transition-colors",
|
|
2594
|
-
|
|
2595
|
-
!
|
|
2596
|
-
!
|
|
2600
|
+
isFuture && "text-gray-300 dark:text-gray-600 pointer-events-none cursor-not-allowed",
|
|
2601
|
+
!disabled && !rangeStart && !rangeEnd && "text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-neutral-700",
|
|
2602
|
+
!disabled && inRange && !rangeStart && !rangeEnd && "text-blue-700 dark:text-blue-300 hover:bg-blue-100 dark:hover:bg-blue-900/50",
|
|
2597
2603
|
(rangeStart || rangeEnd) && "bg-blue-600 text-white hover:bg-blue-700 dark:hover:bg-blue-500",
|
|
2598
|
-
isToday && !rangeStart && !rangeEnd && !
|
|
2604
|
+
isToday && !rangeStart && !rangeEnd && !disabled && "font-bold"
|
|
2599
2605
|
),
|
|
2600
2606
|
children: dateFns.format(day, "d")
|
|
2601
2607
|
}
|
|
@@ -2627,7 +2633,7 @@ var DEFAULT_PRESETS = [
|
|
|
2627
2633
|
label: "This Week",
|
|
2628
2634
|
getRange: () => ({
|
|
2629
2635
|
from: dateFns.startOfWeek(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }),
|
|
2630
|
-
to: dateFns.endOfWeek(/* @__PURE__ */ new Date(), { weekStartsOn: 0 })
|
|
2636
|
+
to: dateFns.min([dateFns.endOfWeek(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), dateFns.endOfDay(/* @__PURE__ */ new Date())])
|
|
2631
2637
|
})
|
|
2632
2638
|
},
|
|
2633
2639
|
{
|
|
@@ -2644,7 +2650,7 @@ var DEFAULT_PRESETS = [
|
|
|
2644
2650
|
label: "This Month",
|
|
2645
2651
|
getRange: () => ({
|
|
2646
2652
|
from: dateFns.startOfMonth(/* @__PURE__ */ new Date()),
|
|
2647
|
-
to: dateFns.endOfMonth(/* @__PURE__ */ new Date())
|
|
2653
|
+
to: dateFns.min([dateFns.endOfMonth(/* @__PURE__ */ new Date()), dateFns.endOfDay(/* @__PURE__ */ new Date())])
|
|
2648
2654
|
})
|
|
2649
2655
|
},
|
|
2650
2656
|
{
|
|
@@ -2731,17 +2737,9 @@ function DateRangePicker({
|
|
|
2731
2737
|
};
|
|
2732
2738
|
const handlePreset = (preset) => {
|
|
2733
2739
|
const newRange = preset.getRange();
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
if (newRange.from) setLeftMonth(dateFns.startOfMonth(newRange.from));
|
|
2738
|
-
} else {
|
|
2739
|
-
if (onChange) onChange(newRange);
|
|
2740
|
-
else setInternalRange(newRange);
|
|
2741
|
-
setActivePreset(preset.label);
|
|
2742
|
-
if (newRange.from) setLeftMonth(dateFns.startOfMonth(newRange.from));
|
|
2743
|
-
setOpen(false);
|
|
2744
|
-
}
|
|
2740
|
+
setDraft(newRange);
|
|
2741
|
+
setActivePreset(preset.label);
|
|
2742
|
+
if (newRange.from) setLeftMonth(dateFns.startOfMonth(newRange.from));
|
|
2745
2743
|
};
|
|
2746
2744
|
const handleApply = () => {
|
|
2747
2745
|
if (draft.from && !draft.to) return;
|
|
@@ -2959,17 +2957,9 @@ function DateRangePickerMobile({
|
|
|
2959
2957
|
};
|
|
2960
2958
|
const handlePreset = (preset) => {
|
|
2961
2959
|
const newRange = preset.getRange();
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
if (newRange.from) setViewMonth(dateFns.startOfMonth(newRange.from));
|
|
2966
|
-
} else {
|
|
2967
|
-
if (onChange) onChange(newRange);
|
|
2968
|
-
else setInternalRange(newRange);
|
|
2969
|
-
setActivePreset(preset.label);
|
|
2970
|
-
if (newRange.from) setViewMonth(dateFns.startOfMonth(newRange.from));
|
|
2971
|
-
setOpen(false);
|
|
2972
|
-
}
|
|
2960
|
+
setDraft(newRange);
|
|
2961
|
+
setActivePreset(preset.label);
|
|
2962
|
+
if (newRange.from) setViewMonth(dateFns.startOfMonth(newRange.from));
|
|
2973
2963
|
};
|
|
2974
2964
|
const handleApply = () => {
|
|
2975
2965
|
if (draft.from && !draft.to) return;
|
|
@@ -3453,5 +3443,5 @@ exports.useColumnVisibility = useColumnVisibility;
|
|
|
3453
3443
|
exports.useFormContext = useFormContext;
|
|
3454
3444
|
exports.useFormFieldContext = useFormFieldContext;
|
|
3455
3445
|
exports.useTableSelection = useTableSelection;
|
|
3456
|
-
//# sourceMappingURL=chunk-
|
|
3457
|
-
//# sourceMappingURL=chunk-
|
|
3446
|
+
//# sourceMappingURL=chunk-H7KYKSHC.js.map
|
|
3447
|
+
//# sourceMappingURL=chunk-H7KYKSHC.js.map
|