@eintrek/erp-theme 1.4.11 → 1.4.13

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.js CHANGED
@@ -1436,8 +1436,24 @@ const th = {
1436
1436
  },
1437
1437
  };
1438
1438
 
1439
- function Input({ className, type, ...props }) {
1440
- return (require$$1.jsx("input", { type: type, "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 }));
1439
+ function Input({ className, type, onWheel, ...props }) {
1440
+ // Scrolling the page with the pointer over a FOCUSED number input makes the
1441
+ // browser step its value — the user is just moving down the form and the
1442
+ // quantity or price they typed silently changes under the cursor. Blink only
1443
+ // does this for discrete wheel notches, so a mouse (Windows, typically) hits
1444
+ // it constantly while a trackpad (macOS) almost never does, which is why it
1445
+ // reads as a platform bug.
1446
+ //
1447
+ // Blurring drops the focus the stepping depends on, so the wheel goes back to
1448
+ // scrolling the page. preventDefault() is not an option: React attaches wheel
1449
+ // listeners passively, and blocking it would trap the page under the cursor.
1450
+ const handleWheel = (event) => {
1451
+ onWheel?.(event);
1452
+ if (type === "number" && document.activeElement === event.currentTarget) {
1453
+ event.currentTarget.blur();
1454
+ }
1455
+ };
1456
+ 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
1457
  }
1442
1458
 
1443
1459
  function Popover({ ...props }) {
@@ -1450,7 +1466,18 @@ function PopoverContent({ className, align = "center", sideOffset = 4, ...props
1450
1466
  return (require$$1.jsx(PopoverPrimitive__namespace.Portal, { children: require$$1.jsx(PopoverPrimitive__namespace.Content, { "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: cn$1("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", className), ...props }) }));
1451
1467
  }
1452
1468
 
1453
- const defaultDisabledDates = (date) => date > new Date() || date < new Date("1900-01-01");
1469
+ /**
1470
+ * Only the lower bound is universal. Rejecting future dates by default made
1471
+ * every forward-looking field — due dates, expiry, delivery, installment
1472
+ * schedules — silently unusable unless the caller remembered to override it,
1473
+ * and several forms already carried `d => d < new Date("1900-01-01")` purely
1474
+ * to undo it. A field that must stay in the past says so with its own
1475
+ * `disabledDates`; the picker no longer guesses.
1476
+ */
1477
+ const defaultDisabledDates = (date) => date < new Date("1900-01-01");
1478
+ /** Ready-made matcher for fields that genuinely cannot be in the future
1479
+ * (date of birth, an issue date on a document already in hand). */
1480
+ const disallowFutureDates = (date) => date > new Date() || date < new Date("1900-01-01");
1454
1481
  const defaultFormatDate = (date) => new Intl.DateTimeFormat("th-TH", {
1455
1482
  day: "numeric",
1456
1483
  month: "long",
@@ -35165,6 +35192,7 @@ exports.convertFileToUploadedFile = convertFileToUploadedFile;
35165
35192
  exports.convertFilesToUploadedFiles = convertFilesToUploadedFiles;
35166
35193
  exports.dataTableConfig = dataTableConfig;
35167
35194
  exports.databasePrefix = databasePrefix;
35195
+ exports.disallowFutureDates = disallowFutureDates;
35168
35196
  exports.flagConfig = flagConfig;
35169
35197
  exports.formatCurrency = formatCurrency;
35170
35198
  exports.formatDate = formatDate;