@eintrek/erp-theme 1.4.12 → 1.4.14
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/ui/Input.d.ts +1 -1
- package/dist/index.esm.js +34 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +34 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -791,7 +791,13 @@ function getInitialMonth(selected) {
|
|
|
791
791
|
selected.from instanceof Date) {
|
|
792
792
|
return new Date(selected.from.getFullYear(), selected.from.getMonth(), 1);
|
|
793
793
|
}
|
|
794
|
-
|
|
794
|
+
// The first of this month, not today.
|
|
795
|
+
//
|
|
796
|
+
// Returning today carried its day-of-month into the month arrows, which is
|
|
797
|
+
// what made an untouched calendar skip a month while one with a date
|
|
798
|
+
// already chosen behaved — the selected branches above all pin the day to 1.
|
|
799
|
+
const now = new Date();
|
|
800
|
+
return new Date(now.getFullYear(), now.getMonth(), 1);
|
|
795
801
|
}
|
|
796
802
|
function Calendar({ className, selected, onSelect, mode = "single", disabled, fromYear = 1900, toYear, }) {
|
|
797
803
|
const maxYear = toYear ?? new Date().getFullYear() + 10;
|
|
@@ -904,16 +910,15 @@ function Calendar({ className, selected, onSelect, mode = "single", disabled, fr
|
|
|
904
910
|
}
|
|
905
911
|
};
|
|
906
912
|
const navigateMonth = (direction) => {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
});
|
|
913
|
+
// Built from year and month with the day pinned to 1, never by shifting
|
|
914
|
+
// the month on a copy of the current date.
|
|
915
|
+
//
|
|
916
|
+
// setMonth keeps the day-of-month, so from the 31st it lands on a date
|
|
917
|
+
// that does not exist in a 30-day month and JavaScript rolls it forward:
|
|
918
|
+
// 31 Aug + 1 month became 1 Oct, and September could not be reached at
|
|
919
|
+
// all. It bit every calendar opened with no value selected, because that
|
|
920
|
+
// starting point was today — including today's day-of-month.
|
|
921
|
+
setCurrentMonth((prev) => new Date(prev.getFullYear(), prev.getMonth() + (direction === "next" ? 1 : -1), 1));
|
|
917
922
|
};
|
|
918
923
|
const handleMonthChange = (monthStr) => {
|
|
919
924
|
const nextMonth = Number.parseInt(monthStr, 10);
|
|
@@ -1436,8 +1441,24 @@ const th = {
|
|
|
1436
1441
|
},
|
|
1437
1442
|
};
|
|
1438
1443
|
|
|
1439
|
-
function Input({ className, type, ...props }) {
|
|
1440
|
-
|
|
1444
|
+
function Input({ className, type, onWheel, ...props }) {
|
|
1445
|
+
// Scrolling the page with the pointer over a FOCUSED number input makes the
|
|
1446
|
+
// browser step its value — the user is just moving down the form and the
|
|
1447
|
+
// quantity or price they typed silently changes under the cursor. Blink only
|
|
1448
|
+
// does this for discrete wheel notches, so a mouse (Windows, typically) hits
|
|
1449
|
+
// it constantly while a trackpad (macOS) almost never does, which is why it
|
|
1450
|
+
// reads as a platform bug.
|
|
1451
|
+
//
|
|
1452
|
+
// Blurring drops the focus the stepping depends on, so the wheel goes back to
|
|
1453
|
+
// scrolling the page. preventDefault() is not an option: React attaches wheel
|
|
1454
|
+
// listeners passively, and blocking it would trap the page under the cursor.
|
|
1455
|
+
const handleWheel = (event) => {
|
|
1456
|
+
onWheel?.(event);
|
|
1457
|
+
if (type === "number" && document.activeElement === event.currentTarget) {
|
|
1458
|
+
event.currentTarget.blur();
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
return (require$$1.jsx("input", { type: type, onWheel: handleWheel, "data-slot": "input", className: cn$1("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className), ...props }));
|
|
1441
1462
|
}
|
|
1442
1463
|
|
|
1443
1464
|
function Popover({ ...props }) {
|