@codapet/design-system 0.5.7 → 0.5.9
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 +30 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2174,7 +2174,7 @@ function DateInput({
|
|
|
2174
2174
|
setDate,
|
|
2175
2175
|
maxDate,
|
|
2176
2176
|
minDate,
|
|
2177
|
-
disableFuture =
|
|
2177
|
+
disableFuture = false,
|
|
2178
2178
|
className,
|
|
2179
2179
|
inputClassName,
|
|
2180
2180
|
calendarClassName,
|
|
@@ -2247,6 +2247,18 @@ function DateInput({
|
|
|
2247
2247
|
}
|
|
2248
2248
|
return null;
|
|
2249
2249
|
}, [minDate]);
|
|
2250
|
+
const dropdownStartMonth = React20.useMemo(() => {
|
|
2251
|
+
if (effectiveMinDate) return effectiveMinDate;
|
|
2252
|
+
const d = new Date(today);
|
|
2253
|
+
d.setFullYear(d.getFullYear() - 100);
|
|
2254
|
+
return d;
|
|
2255
|
+
}, [effectiveMinDate, today]);
|
|
2256
|
+
const dropdownEndMonth = React20.useMemo(() => {
|
|
2257
|
+
if (effectiveMaxDate) return effectiveMaxDate;
|
|
2258
|
+
const d = new Date(today);
|
|
2259
|
+
d.setFullYear(d.getFullYear() + 100);
|
|
2260
|
+
return d;
|
|
2261
|
+
}, [effectiveMaxDate, today]);
|
|
2250
2262
|
React20.useEffect(() => {
|
|
2251
2263
|
if (date) {
|
|
2252
2264
|
setValue(formatDate(date, dateFormat));
|
|
@@ -2284,6 +2296,8 @@ function DateInput({
|
|
|
2284
2296
|
month: effectiveMonth,
|
|
2285
2297
|
onMonthChange: onMonthChange ?? setMonthState,
|
|
2286
2298
|
showOutsideDays,
|
|
2299
|
+
startMonth: dropdownStartMonth,
|
|
2300
|
+
endMonth: dropdownEndMonth,
|
|
2287
2301
|
className: cn(
|
|
2288
2302
|
"w-auto mx-auto overflow-y-auto h-auto m-2",
|
|
2289
2303
|
calendarClassName
|
|
@@ -2439,7 +2453,7 @@ function DateRangeInput({
|
|
|
2439
2453
|
setDateRange,
|
|
2440
2454
|
maxDate,
|
|
2441
2455
|
minDate,
|
|
2442
|
-
disableFuture =
|
|
2456
|
+
disableFuture = false,
|
|
2443
2457
|
className,
|
|
2444
2458
|
inputClassName,
|
|
2445
2459
|
calendarClassName,
|
|
@@ -2502,6 +2516,18 @@ function DateRangeInput({
|
|
|
2502
2516
|
}
|
|
2503
2517
|
return null;
|
|
2504
2518
|
}, [minDate]);
|
|
2519
|
+
const dropdownStartMonth = React21.useMemo(() => {
|
|
2520
|
+
if (effectiveMinDate) return effectiveMinDate;
|
|
2521
|
+
const d = new Date(today);
|
|
2522
|
+
d.setFullYear(d.getFullYear() - 100);
|
|
2523
|
+
return d;
|
|
2524
|
+
}, [effectiveMinDate, today]);
|
|
2525
|
+
const dropdownEndMonth = React21.useMemo(() => {
|
|
2526
|
+
if (effectiveMaxDate) return effectiveMaxDate;
|
|
2527
|
+
const d = new Date(today);
|
|
2528
|
+
d.setFullYear(d.getFullYear() + 100);
|
|
2529
|
+
return d;
|
|
2530
|
+
}, [effectiveMaxDate, today]);
|
|
2505
2531
|
const effectiveMonth = month ?? monthState ?? void 0;
|
|
2506
2532
|
const effectiveSelected = selected ?? dateRange;
|
|
2507
2533
|
const isInputDisabled = inputDisabled ?? (typeof calendarDisabled === "boolean" ? calendarDisabled : false);
|
|
@@ -2536,6 +2562,8 @@ function DateRangeInput({
|
|
|
2536
2562
|
month: effectiveMonth,
|
|
2537
2563
|
onMonthChange: onMonthChange ?? setMonthState,
|
|
2538
2564
|
showOutsideDays,
|
|
2565
|
+
startMonth: dropdownStartMonth,
|
|
2566
|
+
endMonth: dropdownEndMonth,
|
|
2539
2567
|
className: cn("w-auto shrink-0 h-auto mt-2", calendarClassName),
|
|
2540
2568
|
classNames,
|
|
2541
2569
|
components,
|