@mesob/ui 0.5.10 → 0.5.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/components.d.ts +9 -0
- package/dist/components.js +156 -59
- package/dist/components.js.map +1 -1
- package/package.json +2 -2
package/dist/components.d.ts
CHANGED
|
@@ -941,6 +941,10 @@ interface DateTimePickerProps {
|
|
|
941
941
|
clearable?: boolean;
|
|
942
942
|
withSeconds?: boolean;
|
|
943
943
|
presets?: DateTimePickerPreset[];
|
|
944
|
+
/** Minimum allowed date-time (inclusive). */
|
|
945
|
+
minDateTime?: Date;
|
|
946
|
+
/** Maximum allowed date-time (inclusive). */
|
|
947
|
+
maxDateTime?: Date;
|
|
944
948
|
valueFormat?: (date: Date) => string;
|
|
945
949
|
description?: string;
|
|
946
950
|
error?: string;
|
|
@@ -1405,6 +1409,7 @@ interface DateTimeDropdownContentProps {
|
|
|
1405
1409
|
onNext: () => void;
|
|
1406
1410
|
onHeaderClick: () => void;
|
|
1407
1411
|
onDayClick: (cell: CalendarCell) => void;
|
|
1412
|
+
isDayDisabled?: (cell: CalendarCell) => boolean;
|
|
1408
1413
|
onMonthSelect: (i: number) => void;
|
|
1409
1414
|
onYearSelect: (y: number) => void;
|
|
1410
1415
|
onCalendarTypeChange: (type: CalendarType) => void;
|
|
@@ -1541,6 +1546,10 @@ type TimeInputProps = {
|
|
|
1541
1546
|
withSeconds?: boolean;
|
|
1542
1547
|
/** 12-hour format with AM/PM, or 24-hour format. @default '24h' */
|
|
1543
1548
|
format?: '12h' | '24h';
|
|
1549
|
+
/** Minimum allowed time as `HH:mm` or `HH:mm:ss` (24h). */
|
|
1550
|
+
min?: string;
|
|
1551
|
+
/** Maximum allowed time as `HH:mm` or `HH:mm:ss` (24h). */
|
|
1552
|
+
max?: string;
|
|
1544
1553
|
disabled?: boolean;
|
|
1545
1554
|
/** @default today */
|
|
1546
1555
|
baseDate?: Date;
|
package/dist/components.js
CHANGED
|
@@ -12572,6 +12572,7 @@ function DateTimeDropdownContent({
|
|
|
12572
12572
|
onNext,
|
|
12573
12573
|
onHeaderClick,
|
|
12574
12574
|
onDayClick,
|
|
12575
|
+
isDayDisabled,
|
|
12575
12576
|
onMonthSelect,
|
|
12576
12577
|
onYearSelect,
|
|
12577
12578
|
onCalendarTypeChange,
|
|
@@ -12653,23 +12654,28 @@ function DateTimeDropdownContent({
|
|
|
12653
12654
|
},
|
|
12654
12655
|
wd
|
|
12655
12656
|
)) }),
|
|
12656
|
-
/* @__PURE__ */ jsx103("div", { className: "grid grid-cols-7", children: cells.map((cell) =>
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
|
|
12665
|
-
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12669
|
-
|
|
12670
|
-
|
|
12671
|
-
|
|
12672
|
-
|
|
12657
|
+
/* @__PURE__ */ jsx103("div", { className: "grid grid-cols-7", children: cells.map((cell) => {
|
|
12658
|
+
const disabled = isDayDisabled?.(cell) ?? false;
|
|
12659
|
+
return /* @__PURE__ */ jsx103(
|
|
12660
|
+
"button",
|
|
12661
|
+
{
|
|
12662
|
+
type: "button",
|
|
12663
|
+
onClick: () => onDayClick(cell),
|
|
12664
|
+
disabled,
|
|
12665
|
+
className: cn(
|
|
12666
|
+
"flex size-9 items-center justify-center rounded-full text-sm transition-colors",
|
|
12667
|
+
disabled && "cursor-not-allowed text-muted-foreground/50 hover:bg-transparent",
|
|
12668
|
+
cell.isSelected && "bg-primary font-medium text-primary-foreground ring-2 ring-primary/30",
|
|
12669
|
+
!cell.isSelected && cell.isToday && "font-semibold text-foreground ring-1 ring-inset ring-primary/45",
|
|
12670
|
+
!(cell.isSelected || cell.isToday || disabled) && cell.current && cell.weekend && "text-destructive/80 hover:bg-muted",
|
|
12671
|
+
!(cell.isSelected || cell.isToday || disabled) && cell.current && !cell.weekend && "text-foreground hover:bg-muted",
|
|
12672
|
+
!(cell.isSelected || cell.current || disabled) && "text-muted-foreground hover:bg-muted/50"
|
|
12673
|
+
),
|
|
12674
|
+
children: cell.day
|
|
12675
|
+
},
|
|
12676
|
+
`${cell.gcDate.getTime()}-${cell.day}-${cell.month}-${cell.year}`
|
|
12677
|
+
);
|
|
12678
|
+
}) })
|
|
12673
12679
|
] }),
|
|
12674
12680
|
view === "months" && /* @__PURE__ */ jsx103("div", { className: "grid grid-cols-3 gap-1 py-2", children: monthShortList.map((m, i) => {
|
|
12675
12681
|
const sel = calendarType === "EC" ? (() => {
|
|
@@ -12787,15 +12793,10 @@ function DateTimeDropdownContent({
|
|
|
12787
12793
|
import { useCallback as useCallback11, useEffect as useEffect16, useRef as useRef13, useState as useState29 } from "react";
|
|
12788
12794
|
|
|
12789
12795
|
// src/components/date-time/datetime-picker/format-display.ts
|
|
12790
|
-
function formatDateTimeDisplay(d,
|
|
12791
|
-
const
|
|
12792
|
-
|
|
12793
|
-
|
|
12794
|
-
d.getDate()
|
|
12795
|
-
);
|
|
12796
|
-
const dd = calendarType === "EC" ? pad2(ecDay) : pad2(d.getDate());
|
|
12797
|
-
const mm = calendarType === "EC" ? pad2(ecMonth) : pad2(d.getMonth() + 1);
|
|
12798
|
-
const yyyy = calendarType === "EC" ? ecYear : d.getFullYear();
|
|
12796
|
+
function formatDateTimeDisplay(d, withSeconds) {
|
|
12797
|
+
const dd = pad2(d.getDate());
|
|
12798
|
+
const mm = pad2(d.getMonth() + 1);
|
|
12799
|
+
const yyyy = d.getFullYear();
|
|
12799
12800
|
const hh = pad2(d.getHours());
|
|
12800
12801
|
const min = pad2(d.getMinutes());
|
|
12801
12802
|
const sec = pad2(d.getSeconds());
|
|
@@ -12832,13 +12833,42 @@ function clampAndPad(raw, max) {
|
|
|
12832
12833
|
}
|
|
12833
12834
|
|
|
12834
12835
|
// src/components/date-time/datetime-picker/use-datetime-picker.ts
|
|
12836
|
+
function getStartOfDay(d) {
|
|
12837
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0);
|
|
12838
|
+
}
|
|
12839
|
+
function getEndOfDay(d) {
|
|
12840
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 23, 59, 59, 999);
|
|
12841
|
+
}
|
|
12842
|
+
function isDayCompletelyOutOfRange(day, minDateTime, maxDateTime) {
|
|
12843
|
+
const dayStart = getStartOfDay(day).getTime();
|
|
12844
|
+
const dayEnd = getEndOfDay(day).getTime();
|
|
12845
|
+
if (minDateTime && dayEnd < minDateTime.getTime()) {
|
|
12846
|
+
return true;
|
|
12847
|
+
}
|
|
12848
|
+
if (maxDateTime && dayStart > maxDateTime.getTime()) {
|
|
12849
|
+
return true;
|
|
12850
|
+
}
|
|
12851
|
+
return false;
|
|
12852
|
+
}
|
|
12853
|
+
function clampToDateTimeRange(value, minDateTime, maxDateTime) {
|
|
12854
|
+
const t = value.getTime();
|
|
12855
|
+
if (minDateTime && t < minDateTime.getTime()) {
|
|
12856
|
+
return new Date(minDateTime);
|
|
12857
|
+
}
|
|
12858
|
+
if (maxDateTime && t > maxDateTime.getTime()) {
|
|
12859
|
+
return new Date(maxDateTime);
|
|
12860
|
+
}
|
|
12861
|
+
return value;
|
|
12862
|
+
}
|
|
12835
12863
|
function useDateTimePicker(props) {
|
|
12836
12864
|
const {
|
|
12837
12865
|
value: controlledValue,
|
|
12838
12866
|
defaultValue = null,
|
|
12839
12867
|
onChange,
|
|
12840
12868
|
withSeconds = false,
|
|
12841
|
-
live: liveProp
|
|
12869
|
+
live: liveProp,
|
|
12870
|
+
minDateTime: minDateTimeProp,
|
|
12871
|
+
maxDateTime: maxDateTimeProp
|
|
12842
12872
|
} = props;
|
|
12843
12873
|
const live = liveProp === true;
|
|
12844
12874
|
const isControlled = controlledValue !== void 0;
|
|
@@ -12878,6 +12908,9 @@ function useDateTimePicker(props) {
|
|
|
12878
12908
|
timeHRef.current = timeH;
|
|
12879
12909
|
timeMRef.current = timeM;
|
|
12880
12910
|
timeSRef.current = timeS;
|
|
12911
|
+
const hasInvalidRange = !!(minDateTimeProp && maxDateTimeProp) && minDateTimeProp.getTime() > maxDateTimeProp.getTime();
|
|
12912
|
+
const minDateTime = hasInvalidRange ? null : minDateTimeProp ?? null;
|
|
12913
|
+
const maxDateTime = hasInvalidRange ? null : maxDateTimeProp ?? null;
|
|
12881
12914
|
useEffect16(() => {
|
|
12882
12915
|
if (!committed) {
|
|
12883
12916
|
return;
|
|
@@ -12922,8 +12955,12 @@ function useDateTimePicker(props) {
|
|
|
12922
12955
|
return `${decadeStart} \u2013 ${decadeStart + 9}`;
|
|
12923
12956
|
};
|
|
12924
12957
|
const formatDisplay = useCallback11(
|
|
12925
|
-
(d) => formatDateTimeDisplay(d,
|
|
12926
|
-
[
|
|
12958
|
+
(d) => formatDateTimeDisplay(d, withSeconds),
|
|
12959
|
+
[withSeconds]
|
|
12960
|
+
);
|
|
12961
|
+
const isDayDisabled = useCallback11(
|
|
12962
|
+
(cell) => isDayCompletelyOutOfRange(cell.gcDate, minDateTime, maxDateTime),
|
|
12963
|
+
[minDateTime, maxDateTime]
|
|
12927
12964
|
);
|
|
12928
12965
|
const setTimeH = useCallback11(
|
|
12929
12966
|
(h) => {
|
|
@@ -12936,7 +12973,7 @@ function useDateTimePicker(props) {
|
|
|
12936
12973
|
const hh = h ? Math.min(Number.parseInt(h, 10) || 0, 23) : 0;
|
|
12937
12974
|
const mm = timeMRef.current ? Math.min(Number.parseInt(timeMRef.current, 10) || 0, 59) : 0;
|
|
12938
12975
|
const ss = withSeconds && timeSRef.current ? Math.min(Number.parseInt(timeSRef.current, 10) || 0, 59) : 0;
|
|
12939
|
-
|
|
12976
|
+
const next = new Date(
|
|
12940
12977
|
base.getFullYear(),
|
|
12941
12978
|
base.getMonth(),
|
|
12942
12979
|
base.getDate(),
|
|
@@ -12944,9 +12981,10 @@ function useDateTimePicker(props) {
|
|
|
12944
12981
|
mm,
|
|
12945
12982
|
ss
|
|
12946
12983
|
);
|
|
12984
|
+
return clampToDateTimeRange(next, minDateTime, maxDateTime);
|
|
12947
12985
|
});
|
|
12948
12986
|
},
|
|
12949
|
-
[live, open, now, withSeconds]
|
|
12987
|
+
[live, open, now, withSeconds, minDateTime, maxDateTime]
|
|
12950
12988
|
);
|
|
12951
12989
|
const setTimeM = useCallback11(
|
|
12952
12990
|
(m) => {
|
|
@@ -12959,7 +12997,7 @@ function useDateTimePicker(props) {
|
|
|
12959
12997
|
const hh = timeHRef.current ? Math.min(Number.parseInt(timeHRef.current, 10) || 0, 23) : 0;
|
|
12960
12998
|
const mm = m ? Math.min(Number.parseInt(m, 10) || 0, 59) : 0;
|
|
12961
12999
|
const ss = withSeconds && timeSRef.current ? Math.min(Number.parseInt(timeSRef.current, 10) || 0, 59) : 0;
|
|
12962
|
-
|
|
13000
|
+
const next = new Date(
|
|
12963
13001
|
base.getFullYear(),
|
|
12964
13002
|
base.getMonth(),
|
|
12965
13003
|
base.getDate(),
|
|
@@ -12967,9 +13005,10 @@ function useDateTimePicker(props) {
|
|
|
12967
13005
|
mm,
|
|
12968
13006
|
ss
|
|
12969
13007
|
);
|
|
13008
|
+
return clampToDateTimeRange(next, minDateTime, maxDateTime);
|
|
12970
13009
|
});
|
|
12971
13010
|
},
|
|
12972
|
-
[live, open, now, withSeconds]
|
|
13011
|
+
[live, open, now, withSeconds, minDateTime, maxDateTime]
|
|
12973
13012
|
);
|
|
12974
13013
|
const setTimeS = useCallback11(
|
|
12975
13014
|
(s) => {
|
|
@@ -12982,7 +13021,7 @@ function useDateTimePicker(props) {
|
|
|
12982
13021
|
const hh = timeHRef.current ? Math.min(Number.parseInt(timeHRef.current, 10) || 0, 23) : 0;
|
|
12983
13022
|
const mm = timeMRef.current ? Math.min(Number.parseInt(timeMRef.current, 10) || 0, 59) : 0;
|
|
12984
13023
|
const ss = withSeconds && s ? Math.min(Number.parseInt(s, 10) || 0, 59) : 0;
|
|
12985
|
-
|
|
13024
|
+
const next = new Date(
|
|
12986
13025
|
base.getFullYear(),
|
|
12987
13026
|
base.getMonth(),
|
|
12988
13027
|
base.getDate(),
|
|
@@ -12990,15 +13029,19 @@ function useDateTimePicker(props) {
|
|
|
12990
13029
|
mm,
|
|
12991
13030
|
ss
|
|
12992
13031
|
);
|
|
13032
|
+
return clampToDateTimeRange(next, minDateTime, maxDateTime);
|
|
12993
13033
|
});
|
|
12994
13034
|
},
|
|
12995
|
-
[live, open, now, withSeconds]
|
|
13035
|
+
[live, open, now, withSeconds, minDateTime, maxDateTime]
|
|
12996
13036
|
);
|
|
12997
13037
|
function handleDayClick(cell) {
|
|
13038
|
+
if (isDayCompletelyOutOfRange(cell.gcDate, minDateTime, maxDateTime)) {
|
|
13039
|
+
return;
|
|
13040
|
+
}
|
|
12998
13041
|
const h = timeH ? Math.min(Number.parseInt(timeH, 10) || 0, 23) : 0;
|
|
12999
13042
|
const m = timeM ? Math.min(Number.parseInt(timeM, 10) || 0, 59) : 0;
|
|
13000
13043
|
const s = withSeconds && timeS ? Math.min(Number.parseInt(timeS, 10) || 0, 59) : 0;
|
|
13001
|
-
const
|
|
13044
|
+
const selectedRaw = new Date(
|
|
13002
13045
|
cell.gcDate.getFullYear(),
|
|
13003
13046
|
cell.gcDate.getMonth(),
|
|
13004
13047
|
cell.gcDate.getDate(),
|
|
@@ -13006,6 +13049,11 @@ function useDateTimePicker(props) {
|
|
|
13006
13049
|
m,
|
|
13007
13050
|
s
|
|
13008
13051
|
);
|
|
13052
|
+
const selected = clampToDateTimeRange(
|
|
13053
|
+
selectedRaw,
|
|
13054
|
+
minDateTime,
|
|
13055
|
+
maxDateTime
|
|
13056
|
+
);
|
|
13009
13057
|
if (!live) {
|
|
13010
13058
|
setDraft(selected);
|
|
13011
13059
|
setGcViewMonth(selected.getMonth());
|
|
@@ -13186,7 +13234,7 @@ function useDateTimePicker(props) {
|
|
|
13186
13234
|
sec,
|
|
13187
13235
|
0
|
|
13188
13236
|
);
|
|
13189
|
-
return d;
|
|
13237
|
+
return clampToDateTimeRange(d, minDateTime, maxDateTime);
|
|
13190
13238
|
});
|
|
13191
13239
|
return;
|
|
13192
13240
|
}
|
|
@@ -13200,7 +13248,7 @@ function useDateTimePicker(props) {
|
|
|
13200
13248
|
} else {
|
|
13201
13249
|
d.setSeconds(Number.parseInt(padded, 10));
|
|
13202
13250
|
}
|
|
13203
|
-
updateValue(d);
|
|
13251
|
+
updateValue(clampToDateTimeRange(d, minDateTime, maxDateTime));
|
|
13204
13252
|
}
|
|
13205
13253
|
}
|
|
13206
13254
|
function handleConfirm() {
|
|
@@ -13226,8 +13274,9 @@ function useDateTimePicker(props) {
|
|
|
13226
13274
|
withSeconds ? secNum : 0,
|
|
13227
13275
|
0
|
|
13228
13276
|
);
|
|
13277
|
+
const next = clampToDateTimeRange(d, minDateTime, maxDateTime);
|
|
13229
13278
|
if (draft || committed || h || m || withSeconds && s) {
|
|
13230
|
-
updateValue(
|
|
13279
|
+
updateValue(next);
|
|
13231
13280
|
}
|
|
13232
13281
|
setDraft(null);
|
|
13233
13282
|
setOpen(false);
|
|
@@ -13244,15 +13293,16 @@ function useDateTimePicker(props) {
|
|
|
13244
13293
|
withSeconds ? secNumLive : 0,
|
|
13245
13294
|
0
|
|
13246
13295
|
);
|
|
13296
|
+
const nextLive = clampToDateTimeRange(dLive, minDateTime, maxDateTime);
|
|
13247
13297
|
if (committed || h || m || withSeconds && s) {
|
|
13248
|
-
updateValue(
|
|
13298
|
+
updateValue(nextLive);
|
|
13249
13299
|
if (!committed) {
|
|
13250
|
-
setGcViewYear(
|
|
13251
|
-
setGcViewMonth(
|
|
13300
|
+
setGcViewYear(nextLive.getFullYear());
|
|
13301
|
+
setGcViewMonth(nextLive.getMonth());
|
|
13252
13302
|
const [ecY, ecM] = toEC(
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13303
|
+
nextLive.getFullYear(),
|
|
13304
|
+
nextLive.getMonth() + 1,
|
|
13305
|
+
nextLive.getDate()
|
|
13256
13306
|
);
|
|
13257
13307
|
setEcViewYear(ecY);
|
|
13258
13308
|
setEcViewMonth(ecM);
|
|
@@ -13304,7 +13354,7 @@ function useDateTimePicker(props) {
|
|
|
13304
13354
|
[live, now, updatePreferredSide, setOpen]
|
|
13305
13355
|
);
|
|
13306
13356
|
function handlePresetClick(preset) {
|
|
13307
|
-
const d = preset.value;
|
|
13357
|
+
const d = clampToDateTimeRange(preset.value, minDateTime, maxDateTime);
|
|
13308
13358
|
if (!live) {
|
|
13309
13359
|
setDraft(new Date(d));
|
|
13310
13360
|
setTimeHState(pad2(d.getHours()));
|
|
@@ -13360,6 +13410,7 @@ function useDateTimePicker(props) {
|
|
|
13360
13410
|
decadeStart,
|
|
13361
13411
|
activeViewYear,
|
|
13362
13412
|
headerLabel,
|
|
13413
|
+
isDayDisabled,
|
|
13363
13414
|
handleDayClick,
|
|
13364
13415
|
handleMonthSelect,
|
|
13365
13416
|
handleYearSelect,
|
|
@@ -13450,6 +13501,7 @@ var DateTimePicker = forwardRef7(function DateTimePicker2(props, ref) {
|
|
|
13450
13501
|
onNext: state2.handleNext,
|
|
13451
13502
|
onHeaderClick: state2.handleHeaderClick,
|
|
13452
13503
|
onDayClick: state2.handleDayClick,
|
|
13504
|
+
isDayDisabled: state2.isDayDisabled,
|
|
13453
13505
|
onMonthSelect: state2.handleMonthSelect,
|
|
13454
13506
|
onYearSelect: state2.handleYearSelect,
|
|
13455
13507
|
onCalendarTypeChange: state2.handleCalendarTypeChange,
|
|
@@ -13806,12 +13858,55 @@ function to24h(h12, amPm) {
|
|
|
13806
13858
|
}
|
|
13807
13859
|
return h12 === 12 ? 12 : h12 + 12;
|
|
13808
13860
|
}
|
|
13861
|
+
function parseTimeString(str) {
|
|
13862
|
+
const parts = str.trim().split(":");
|
|
13863
|
+
if (parts.length < 2) {
|
|
13864
|
+
return null;
|
|
13865
|
+
}
|
|
13866
|
+
const h = Number.parseInt(parts[0], 10);
|
|
13867
|
+
const m = Number.parseInt(parts[1], 10);
|
|
13868
|
+
const s = parts[2] ? Number.parseInt(parts[2], 10) : 0;
|
|
13869
|
+
if (Number.isNaN(h) || Number.isNaN(m) || Number.isNaN(s)) {
|
|
13870
|
+
return null;
|
|
13871
|
+
}
|
|
13872
|
+
return { h, m, s };
|
|
13873
|
+
}
|
|
13874
|
+
function toSeconds(d) {
|
|
13875
|
+
return d.getHours() * 3600 + d.getMinutes() * 60 + d.getSeconds();
|
|
13876
|
+
}
|
|
13877
|
+
function clampToTimeRange(date, min, max) {
|
|
13878
|
+
const minParsed = min ? parseTimeString(min) : null;
|
|
13879
|
+
const maxParsed = max ? parseTimeString(max) : null;
|
|
13880
|
+
if (minParsed && maxParsed && minParsed.h * 3600 + minParsed.m * 60 + minParsed.s > maxParsed.h * 3600 + maxParsed.m * 60 + maxParsed.s) {
|
|
13881
|
+
return date;
|
|
13882
|
+
}
|
|
13883
|
+
const current = toSeconds(date);
|
|
13884
|
+
if (minParsed) {
|
|
13885
|
+
const minSec = minParsed.h * 3600 + minParsed.m * 60 + minParsed.s;
|
|
13886
|
+
if (current < minSec) {
|
|
13887
|
+
const d = new Date(date);
|
|
13888
|
+
d.setHours(minParsed.h, minParsed.m, minParsed.s, 0);
|
|
13889
|
+
return d;
|
|
13890
|
+
}
|
|
13891
|
+
}
|
|
13892
|
+
if (maxParsed) {
|
|
13893
|
+
const maxSec = maxParsed.h * 3600 + maxParsed.m * 60 + maxParsed.s;
|
|
13894
|
+
if (current > maxSec) {
|
|
13895
|
+
const d = new Date(date);
|
|
13896
|
+
d.setHours(maxParsed.h, maxParsed.m, maxParsed.s, 0);
|
|
13897
|
+
return d;
|
|
13898
|
+
}
|
|
13899
|
+
}
|
|
13900
|
+
return date;
|
|
13901
|
+
}
|
|
13809
13902
|
var TimeInput = forwardRef8(
|
|
13810
13903
|
function TimeInput2({
|
|
13811
13904
|
value,
|
|
13812
13905
|
onChange,
|
|
13813
13906
|
withSeconds = false,
|
|
13814
13907
|
format = "24h",
|
|
13908
|
+
min,
|
|
13909
|
+
max,
|
|
13815
13910
|
disabled = false,
|
|
13816
13911
|
baseDate = /* @__PURE__ */ new Date(),
|
|
13817
13912
|
leftSection,
|
|
@@ -13872,9 +13967,9 @@ var TimeInput = forwardRef8(
|
|
|
13872
13967
|
const hour24 = is12h ? to24h(h12Raw === 0 ? 12 : h12Raw, ap) : Number.parseInt(clampAndPad(hh, 23), 10);
|
|
13873
13968
|
const d = new Date(base);
|
|
13874
13969
|
d.setHours(hour24, Number.parseInt(nm, 10), Number.parseInt(ns, 10), 0);
|
|
13875
|
-
onChange?.(d);
|
|
13970
|
+
onChange?.(clampToTimeRange(d, min, max));
|
|
13876
13971
|
},
|
|
13877
|
-
[base, onChange, withSeconds, is12h]
|
|
13972
|
+
[base, onChange, withSeconds, is12h, min, max]
|
|
13878
13973
|
);
|
|
13879
13974
|
const handleBlur = useCallback13(() => {
|
|
13880
13975
|
setFocus(null);
|
|
@@ -13917,9 +14012,9 @@ var TimeInput = forwardRef8(
|
|
|
13917
14012
|
Number.parseInt(ss, 10),
|
|
13918
14013
|
0
|
|
13919
14014
|
);
|
|
13920
|
-
onChange?.(d);
|
|
14015
|
+
onChange?.(clampToTimeRange(d, min, max));
|
|
13921
14016
|
},
|
|
13922
|
-
[base, onChange]
|
|
14017
|
+
[base, onChange, min, max]
|
|
13923
14018
|
);
|
|
13924
14019
|
const fieldset = /* @__PURE__ */ jsxs70(
|
|
13925
14020
|
"fieldset",
|
|
@@ -14071,7 +14166,7 @@ function to12h3(hour24) {
|
|
|
14071
14166
|
}
|
|
14072
14167
|
return { h: hour24 - 12, amPm: "PM" };
|
|
14073
14168
|
}
|
|
14074
|
-
function
|
|
14169
|
+
function parseTimeString2(str) {
|
|
14075
14170
|
const parts = str.trim().split(":");
|
|
14076
14171
|
if (parts.length < 2) {
|
|
14077
14172
|
return null;
|
|
@@ -14099,7 +14194,7 @@ function TimeValue({
|
|
|
14099
14194
|
m = value.getMinutes();
|
|
14100
14195
|
s = value.getSeconds();
|
|
14101
14196
|
} else {
|
|
14102
|
-
const parsed =
|
|
14197
|
+
const parsed = parseTimeString2(value);
|
|
14103
14198
|
if (!parsed) {
|
|
14104
14199
|
return /* @__PURE__ */ jsx108("span", { className, children: "--:--" });
|
|
14105
14200
|
}
|
|
@@ -15584,7 +15679,7 @@ function to24h2(h12, amPm) {
|
|
|
15584
15679
|
}
|
|
15585
15680
|
return h12 === 12 ? 12 : h12 + 12;
|
|
15586
15681
|
}
|
|
15587
|
-
function
|
|
15682
|
+
function parseTimeString3(str) {
|
|
15588
15683
|
const parts = str.trim().split(":");
|
|
15589
15684
|
if (parts.length < 2) {
|
|
15590
15685
|
return null;
|
|
@@ -15710,7 +15805,7 @@ function useTimePicker(props) {
|
|
|
15710
15805
|
}
|
|
15711
15806
|
const mins = d.getHours() * 60 + d.getMinutes() + d.getSeconds() / 60;
|
|
15712
15807
|
if (min) {
|
|
15713
|
-
const p =
|
|
15808
|
+
const p = parseTimeString3(min);
|
|
15714
15809
|
if (p) {
|
|
15715
15810
|
const minMins = p.h * 60 + p.m + p.s / 60;
|
|
15716
15811
|
if (mins < minMins) {
|
|
@@ -15719,7 +15814,7 @@ function useTimePicker(props) {
|
|
|
15719
15814
|
}
|
|
15720
15815
|
}
|
|
15721
15816
|
if (max) {
|
|
15722
|
-
const p =
|
|
15817
|
+
const p = parseTimeString3(max);
|
|
15723
15818
|
if (p) {
|
|
15724
15819
|
const maxMins = p.h * 60 + p.m + p.s / 60;
|
|
15725
15820
|
if (mins > maxMins) {
|
|
@@ -15877,7 +15972,7 @@ function useTimePicker(props) {
|
|
|
15877
15972
|
}
|
|
15878
15973
|
}
|
|
15879
15974
|
function handlePresetClick(presetStr) {
|
|
15880
|
-
const p =
|
|
15975
|
+
const p = parseTimeString3(presetStr);
|
|
15881
15976
|
if (!p) {
|
|
15882
15977
|
return;
|
|
15883
15978
|
}
|
|
@@ -20956,12 +21051,14 @@ function FilePreviewSurface({
|
|
|
20956
21051
|
) });
|
|
20957
21052
|
}
|
|
20958
21053
|
if (item.url && item.type.includes("pdf")) {
|
|
21054
|
+
const pdfUrl = item.url.includes("#") ? `${item.url}&toolbar=0&navpanes=0&scrollbar=0` : `${item.url}#toolbar=0&navpanes=0&scrollbar=0`;
|
|
20959
21055
|
return /* @__PURE__ */ jsx152("div", { className, children: /* @__PURE__ */ jsx152(
|
|
20960
21056
|
"iframe",
|
|
20961
21057
|
{
|
|
20962
|
-
src:
|
|
21058
|
+
src: pdfUrl,
|
|
20963
21059
|
title: item.name,
|
|
20964
|
-
className: "size-full",
|
|
21060
|
+
className: "size-full overflow-hidden",
|
|
21061
|
+
scrolling: "no",
|
|
20965
21062
|
loading: "lazy"
|
|
20966
21063
|
}
|
|
20967
21064
|
) });
|
|
@@ -21288,7 +21385,7 @@ function FileInput({
|
|
|
21288
21385
|
defaultFiles = [],
|
|
21289
21386
|
previewItems = [],
|
|
21290
21387
|
leftSection,
|
|
21291
|
-
placeholder = "
|
|
21388
|
+
placeholder = "Select a file",
|
|
21292
21389
|
cropAspect = 1,
|
|
21293
21390
|
editImageOnSelect = true,
|
|
21294
21391
|
imageOutputScale = 0.7,
|