@dmsi/wedgekit-react 0.0.1009 → 0.0.1011

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.
Files changed (52) hide show
  1. package/dist/{chunk-FHXCCVOG.js → chunk-72WLEGGU.js} +1 -1
  2. package/dist/{chunk-5NRKL5CJ.js → chunk-FFCSDPXR.js} +1 -1
  3. package/dist/{chunk-FZ2TEKOE.js → chunk-IEKZBWVL.js} +1 -1
  4. package/dist/{chunk-7T5RGDCN.js → chunk-NEMOTB6U.js} +75 -13
  5. package/dist/{chunk-RLJU65SD.js → chunk-PJQHRERH.js} +4 -4
  6. package/dist/components/CalendarRange.cjs +75 -13
  7. package/dist/components/CalendarRange.js +5 -5
  8. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +75 -13
  9. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +5 -5
  10. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +75 -13
  11. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +5 -5
  12. package/dist/components/DataGrid/PinnedColumns.cjs +75 -13
  13. package/dist/components/DataGrid/PinnedColumns.js +5 -5
  14. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +75 -13
  15. package/dist/components/DataGrid/TableBody/LoadingCell.js +5 -5
  16. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +75 -13
  17. package/dist/components/DataGrid/TableBody/TableBodyRow.js +5 -5
  18. package/dist/components/DataGrid/TableBody/index.cjs +75 -13
  19. package/dist/components/DataGrid/TableBody/index.js +5 -5
  20. package/dist/components/DataGrid/index.cjs +75 -13
  21. package/dist/components/DataGrid/index.js +5 -5
  22. package/dist/components/DataGrid/utils.cjs +75 -13
  23. package/dist/components/DataGrid/utils.js +5 -5
  24. package/dist/components/DataGridCell.cjs +75 -13
  25. package/dist/components/DataGridCell.js +3 -3
  26. package/dist/components/DateInput.cjs +75 -13
  27. package/dist/components/DateInput.js +5 -5
  28. package/dist/components/DateRangeInput.cjs +75 -13
  29. package/dist/components/DateRangeInput.js +5 -5
  30. package/dist/components/FilterGroup.cjs +75 -13
  31. package/dist/components/FilterGroup.js +2 -2
  32. package/dist/components/Input.cjs +75 -13
  33. package/dist/components/Input.js +1 -1
  34. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +75 -13
  35. package/dist/components/MobileDataGrid/ColumnSelector/index.js +5 -5
  36. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +75 -13
  37. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +5 -5
  38. package/dist/components/MobileDataGrid/index.cjs +75 -13
  39. package/dist/components/MobileDataGrid/index.js +5 -5
  40. package/dist/components/Password.cjs +75 -13
  41. package/dist/components/Password.js +1 -1
  42. package/dist/components/Search.cjs +75 -13
  43. package/dist/components/Search.js +2 -2
  44. package/dist/components/Select.cjs +75 -13
  45. package/dist/components/Select.js +2 -2
  46. package/dist/components/Stepper.cjs +75 -13
  47. package/dist/components/Stepper.js +1 -1
  48. package/dist/components/Time.cjs +75 -13
  49. package/dist/components/Time.js +1 -1
  50. package/dist/components/index.cjs +75 -13
  51. package/dist/components/index.js +5 -5
  52. package/package.json +1 -1
@@ -569,6 +569,7 @@ var Input = (_a) => {
569
569
  variant = "default",
570
570
  decimals,
571
571
  uom,
572
+ currencyFormat = false,
572
573
  removeSearchIcon,
573
574
  value: propValue,
574
575
  onChange,
@@ -581,6 +582,7 @@ var Input = (_a) => {
581
582
  "variant",
582
583
  "decimals",
583
584
  "uom",
585
+ "currencyFormat",
584
586
  "removeSearchIcon",
585
587
  "value",
586
588
  "onChange",
@@ -595,22 +597,21 @@ var Input = (_a) => {
595
597
  (0, import_react.useEffect)(() => {
596
598
  var _a2;
597
599
  const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
598
- setInternalValue(stringValue);
599
- setDisplayValue(stringValue);
600
- }, [propValue]);
601
- (0, import_react.useEffect)(() => {
602
- var _a2;
603
- if (variant !== "currency") {
600
+ const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
601
+ if (!stringValue) {
602
+ setInternalValue("");
603
+ setDisplayValue("");
604
604
  return;
605
605
  }
606
- const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
607
- if (!stringValue) {
606
+ if (!shouldUseThousandsFormatting) {
607
+ setInternalValue(stringValue);
608
+ setDisplayValue(stringValue);
608
609
  return;
609
610
  }
610
611
  const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
611
612
  setInternalValue(formatted);
612
613
  setDisplayValue(formatCurrencyDisplay(formatted));
613
- }, []);
614
+ }, [propValue, variant, currencyFormat, decimals]);
614
615
  const getInputProps = () => {
615
616
  var _a2;
616
617
  const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
@@ -636,8 +637,9 @@ var Input = (_a) => {
636
637
  case "percentage":
637
638
  case "uom":
638
639
  return __spreadProps(__spreadValues({}, baseProps), {
639
- type: "number",
640
- align: "right"
640
+ type: currencyFormat ? "text" : "number",
641
+ align: "right",
642
+ value: currencyFormat ? displayValue : propValue
641
643
  });
642
644
  default:
643
645
  return baseProps;
@@ -650,6 +652,8 @@ var Input = (_a) => {
650
652
  return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "search" }) }) : null;
651
653
  case "currency":
652
654
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "attach_money" }) });
655
+ case "uom":
656
+ return currencyFormat ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "attach_money" }) }) : null;
653
657
  default:
654
658
  return null;
655
659
  }
@@ -741,6 +745,51 @@ var Input = (_a) => {
741
745
  }
742
746
  return;
743
747
  }
748
+ if (variant === "uom" && currencyFormat) {
749
+ const raw = rawValue.replace(/,/g, "");
750
+ if (raw === "") {
751
+ setInternalValue("");
752
+ setDisplayValue("");
753
+ if (onChange) {
754
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
755
+ target: __spreadProps(__spreadValues({}, e.target), { value: "" })
756
+ });
757
+ onChange(syntheticEvent);
758
+ }
759
+ return;
760
+ }
761
+ const regex = /^\d*\.?\d*$/;
762
+ if (!regex.test(raw)) return;
763
+ const parts = raw.split(".");
764
+ const currentDecimals = decimals != null ? decimals : 2;
765
+ if (parts.length === 2 && parts[1].length > currentDecimals) return;
766
+ const asNumber = Number(raw);
767
+ if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
768
+ const clamped = maxNumber;
769
+ const formattedClamped = formatDecimalValue(
770
+ clamped.toString(),
771
+ currentDecimals
772
+ );
773
+ setInternalValue(formattedClamped);
774
+ setDisplayValue(formatCurrencyDisplay(formattedClamped));
775
+ if (onChange) {
776
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
777
+ target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
778
+ });
779
+ onChange(syntheticEvent);
780
+ }
781
+ return;
782
+ }
783
+ setInternalValue(raw);
784
+ setDisplayValue(formatCurrencyDisplay(raw));
785
+ if (!isNaN(asNumber) && onChange) {
786
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
787
+ target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
788
+ });
789
+ onChange(syntheticEvent);
790
+ }
791
+ return;
792
+ }
744
793
  if (variant === "uom" && e.target.type === "number") {
745
794
  const numeric = Number(rawValue);
746
795
  if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
@@ -789,8 +838,21 @@ var Input = (_a) => {
789
838
  onChange(syntheticEvent);
790
839
  }
791
840
  } else if (variant === "uom") {
792
- const formattedValue = formatDecimalValue(e.target.value, decimals);
793
- e.target.value = formattedValue;
841
+ if (currencyFormat) {
842
+ const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
843
+ setInternalValue(formatted);
844
+ setDisplayValue(formatCurrencyDisplay(formatted));
845
+ const asNumber = Number(formatted);
846
+ if (!isNaN(asNumber) && onChange) {
847
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
848
+ target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
849
+ });
850
+ onChange(syntheticEvent);
851
+ }
852
+ } else {
853
+ const formattedValue = formatDecimalValue(e.target.value, decimals);
854
+ e.target.value = formattedValue;
855
+ }
794
856
  }
795
857
  onBlur == null ? void 0 : onBlur(e);
796
858
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InputBase
3
- } from "../chunk-7T5RGDCN.js";
3
+ } from "../chunk-NEMOTB6U.js";
4
4
  import "../chunk-HXGJVYGQ.js";
5
5
  import {
6
6
  findDocumentRoot
@@ -2139,6 +2139,7 @@ var Input = (_a) => {
2139
2139
  variant = "default",
2140
2140
  decimals,
2141
2141
  uom,
2142
+ currencyFormat = false,
2142
2143
  removeSearchIcon,
2143
2144
  value: propValue,
2144
2145
  onChange,
@@ -2151,6 +2152,7 @@ var Input = (_a) => {
2151
2152
  "variant",
2152
2153
  "decimals",
2153
2154
  "uom",
2155
+ "currencyFormat",
2154
2156
  "removeSearchIcon",
2155
2157
  "value",
2156
2158
  "onChange",
@@ -2165,22 +2167,21 @@ var Input = (_a) => {
2165
2167
  (0, import_react10.useEffect)(() => {
2166
2168
  var _a2;
2167
2169
  const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
2168
- setInternalValue(stringValue);
2169
- setDisplayValue(stringValue);
2170
- }, [propValue]);
2171
- (0, import_react10.useEffect)(() => {
2172
- var _a2;
2173
- if (variant !== "currency") {
2170
+ const shouldUseThousandsFormatting = variant === "currency" || variant === "uom" && currencyFormat;
2171
+ if (!stringValue) {
2172
+ setInternalValue("");
2173
+ setDisplayValue("");
2174
2174
  return;
2175
2175
  }
2176
- const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
2177
- if (!stringValue) {
2176
+ if (!shouldUseThousandsFormatting) {
2177
+ setInternalValue(stringValue);
2178
+ setDisplayValue(stringValue);
2178
2179
  return;
2179
2180
  }
2180
2181
  const formatted = formatDecimalValue(stringValue, decimals != null ? decimals : 2);
2181
2182
  setInternalValue(formatted);
2182
2183
  setDisplayValue(formatCurrencyDisplay(formatted));
2183
- }, []);
2184
+ }, [propValue, variant, currencyFormat, decimals]);
2184
2185
  const getInputProps = () => {
2185
2186
  var _a2;
2186
2187
  const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
@@ -2206,8 +2207,9 @@ var Input = (_a) => {
2206
2207
  case "percentage":
2207
2208
  case "uom":
2208
2209
  return __spreadProps(__spreadValues({}, baseProps), {
2209
- type: "number",
2210
- align: "right"
2210
+ type: currencyFormat ? "text" : "number",
2211
+ align: "right",
2212
+ value: currencyFormat ? displayValue : propValue
2211
2213
  });
2212
2214
  default:
2213
2215
  return baseProps;
@@ -2220,6 +2222,8 @@ var Input = (_a) => {
2220
2222
  return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "search" }) }) : null;
2221
2223
  case "currency":
2222
2224
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "attach_money" }) });
2225
+ case "uom":
2226
+ return currencyFormat ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "attach_money" }) }) : null;
2223
2227
  default:
2224
2228
  return null;
2225
2229
  }
@@ -2311,6 +2315,51 @@ var Input = (_a) => {
2311
2315
  }
2312
2316
  return;
2313
2317
  }
2318
+ if (variant === "uom" && currencyFormat) {
2319
+ const raw = rawValue.replace(/,/g, "");
2320
+ if (raw === "") {
2321
+ setInternalValue("");
2322
+ setDisplayValue("");
2323
+ if (onChange) {
2324
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
2325
+ target: __spreadProps(__spreadValues({}, e.target), { value: "" })
2326
+ });
2327
+ onChange(syntheticEvent);
2328
+ }
2329
+ return;
2330
+ }
2331
+ const regex = /^\d*\.?\d*$/;
2332
+ if (!regex.test(raw)) return;
2333
+ const parts = raw.split(".");
2334
+ const currentDecimals = decimals != null ? decimals : 2;
2335
+ if (parts.length === 2 && parts[1].length > currentDecimals) return;
2336
+ const asNumber = Number(raw);
2337
+ if (!isNaN(asNumber) && maxNumber != null && asNumber > maxNumber) {
2338
+ const clamped = maxNumber;
2339
+ const formattedClamped = formatDecimalValue(
2340
+ clamped.toString(),
2341
+ currentDecimals
2342
+ );
2343
+ setInternalValue(formattedClamped);
2344
+ setDisplayValue(formatCurrencyDisplay(formattedClamped));
2345
+ if (onChange) {
2346
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
2347
+ target: __spreadProps(__spreadValues({}, e.target), { value: clamped.toString() })
2348
+ });
2349
+ onChange(syntheticEvent);
2350
+ }
2351
+ return;
2352
+ }
2353
+ setInternalValue(raw);
2354
+ setDisplayValue(formatCurrencyDisplay(raw));
2355
+ if (!isNaN(asNumber) && onChange) {
2356
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
2357
+ target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
2358
+ });
2359
+ onChange(syntheticEvent);
2360
+ }
2361
+ return;
2362
+ }
2314
2363
  if (variant === "uom" && e.target.type === "number") {
2315
2364
  const numeric = Number(rawValue);
2316
2365
  if (!isNaN(numeric) && maxNumber != null && numeric > maxNumber) {
@@ -2359,8 +2408,21 @@ var Input = (_a) => {
2359
2408
  onChange(syntheticEvent);
2360
2409
  }
2361
2410
  } else if (variant === "uom") {
2362
- const formattedValue = formatDecimalValue(e.target.value, decimals);
2363
- e.target.value = formattedValue;
2411
+ if (currencyFormat) {
2412
+ const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
2413
+ setInternalValue(formatted);
2414
+ setDisplayValue(formatCurrencyDisplay(formatted));
2415
+ const asNumber = Number(formatted);
2416
+ if (!isNaN(asNumber) && onChange) {
2417
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
2418
+ target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
2419
+ });
2420
+ onChange(syntheticEvent);
2421
+ }
2422
+ } else {
2423
+ const formattedValue = formatDecimalValue(e.target.value, decimals);
2424
+ e.target.value = formattedValue;
2425
+ }
2364
2426
  }
2365
2427
  onBlur == null ? void 0 : onBlur(e);
2366
2428
  };
@@ -2,7 +2,7 @@ import {
2
2
  DataGrid,
3
3
  DateInput,
4
4
  MobileDataGrid
5
- } from "../chunk-RLJU65SD.js";
5
+ } from "../chunk-PJQHRERH.js";
6
6
  import "../chunk-2UNLVJU5.js";
7
7
  import "../chunk-POZD6R3P.js";
8
8
  import "../chunk-M7INAUAJ.js";
@@ -33,7 +33,7 @@ import "../chunk-AT4AWD6B.js";
33
33
  import "../chunk-EWGHVZL5.js";
34
34
  import {
35
35
  Select
36
- } from "../chunk-FZ2TEKOE.js";
36
+ } from "../chunk-IEKZBWVL.js";
37
37
  import {
38
38
  SimpleTable
39
39
  } from "../chunk-I57U5THY.js";
@@ -71,7 +71,7 @@ import {
71
71
  DataGridCell,
72
72
  DragAlongCell,
73
73
  DraggableCellHeader
74
- } from "../chunk-5NRKL5CJ.js";
74
+ } from "../chunk-FFCSDPXR.js";
75
75
  import {
76
76
  Menu
77
77
  } from "../chunk-OM7QLLI2.js";
@@ -81,10 +81,10 @@ import {
81
81
  } from "../chunk-X3NDEFVA.js";
82
82
  import {
83
83
  Search
84
- } from "../chunk-FHXCCVOG.js";
84
+ } from "../chunk-72WLEGGU.js";
85
85
  import {
86
86
  Input
87
- } from "../chunk-7T5RGDCN.js";
87
+ } from "../chunk-NEMOTB6U.js";
88
88
  import {
89
89
  Label
90
90
  } from "../chunk-HXGJVYGQ.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.1009",
4
+ "version": "0.0.1011",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",