@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
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare function Input({ className, type, ...props }: React.ComponentProps<"input">): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function Input({ className, type, onWheel, ...props }: React.ComponentProps<"input">): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export { Input };
|
package/dist/index.esm.js
CHANGED
|
@@ -746,7 +746,13 @@ function getInitialMonth(selected) {
|
|
|
746
746
|
selected.from instanceof Date) {
|
|
747
747
|
return new Date(selected.from.getFullYear(), selected.from.getMonth(), 1);
|
|
748
748
|
}
|
|
749
|
-
|
|
749
|
+
// The first of this month, not today.
|
|
750
|
+
//
|
|
751
|
+
// Returning today carried its day-of-month into the month arrows, which is
|
|
752
|
+
// what made an untouched calendar skip a month while one with a date
|
|
753
|
+
// already chosen behaved — the selected branches above all pin the day to 1.
|
|
754
|
+
const now = new Date();
|
|
755
|
+
return new Date(now.getFullYear(), now.getMonth(), 1);
|
|
750
756
|
}
|
|
751
757
|
function Calendar({ className, selected, onSelect, mode = "single", disabled, fromYear = 1900, toYear, }) {
|
|
752
758
|
const maxYear = toYear ?? new Date().getFullYear() + 10;
|
|
@@ -859,16 +865,15 @@ function Calendar({ className, selected, onSelect, mode = "single", disabled, fr
|
|
|
859
865
|
}
|
|
860
866
|
};
|
|
861
867
|
const navigateMonth = (direction) => {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
});
|
|
868
|
+
// Built from year and month with the day pinned to 1, never by shifting
|
|
869
|
+
// the month on a copy of the current date.
|
|
870
|
+
//
|
|
871
|
+
// setMonth keeps the day-of-month, so from the 31st it lands on a date
|
|
872
|
+
// that does not exist in a 30-day month and JavaScript rolls it forward:
|
|
873
|
+
// 31 Aug + 1 month became 1 Oct, and September could not be reached at
|
|
874
|
+
// all. It bit every calendar opened with no value selected, because that
|
|
875
|
+
// starting point was today — including today's day-of-month.
|
|
876
|
+
setCurrentMonth((prev) => new Date(prev.getFullYear(), prev.getMonth() + (direction === "next" ? 1 : -1), 1));
|
|
872
877
|
};
|
|
873
878
|
const handleMonthChange = (monthStr) => {
|
|
874
879
|
const nextMonth = Number.parseInt(monthStr, 10);
|
|
@@ -1391,8 +1396,24 @@ const th = {
|
|
|
1391
1396
|
},
|
|
1392
1397
|
};
|
|
1393
1398
|
|
|
1394
|
-
function Input({ className, type, ...props }) {
|
|
1395
|
-
|
|
1399
|
+
function Input({ className, type, onWheel, ...props }) {
|
|
1400
|
+
// Scrolling the page with the pointer over a FOCUSED number input makes the
|
|
1401
|
+
// browser step its value — the user is just moving down the form and the
|
|
1402
|
+
// quantity or price they typed silently changes under the cursor. Blink only
|
|
1403
|
+
// does this for discrete wheel notches, so a mouse (Windows, typically) hits
|
|
1404
|
+
// it constantly while a trackpad (macOS) almost never does, which is why it
|
|
1405
|
+
// reads as a platform bug.
|
|
1406
|
+
//
|
|
1407
|
+
// Blurring drops the focus the stepping depends on, so the wheel goes back to
|
|
1408
|
+
// scrolling the page. preventDefault() is not an option: React attaches wheel
|
|
1409
|
+
// listeners passively, and blocking it would trap the page under the cursor.
|
|
1410
|
+
const handleWheel = (event) => {
|
|
1411
|
+
onWheel?.(event);
|
|
1412
|
+
if (type === "number" && document.activeElement === event.currentTarget) {
|
|
1413
|
+
event.currentTarget.blur();
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
return (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 }));
|
|
1396
1417
|
}
|
|
1397
1418
|
|
|
1398
1419
|
function Popover({ ...props }) {
|