@photonix/basic 3.4.0 → 3.6.0

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.css CHANGED
@@ -6260,12 +6260,15 @@
6260
6260
  .buttonContent {
6261
6261
  align-items: center;
6262
6262
  display: inline-flex;
6263
+ min-inline-size: 0;
6263
6264
  position: relative;
6264
6265
  z-index: var(--z-local-content);
6265
6266
  }
6266
6267
  .buttonText {
6267
- align-items: center;
6268
- display: inline-flex;
6268
+ display: block;
6269
+ min-inline-size: 0;
6270
+ overflow: hidden;
6271
+ text-overflow: ellipsis;
6269
6272
  }
6270
6273
  .buttonBadge {
6271
6274
  flex-shrink: 0;
package/dist/index.d.mts CHANGED
@@ -690,6 +690,8 @@ interface InputFormatOptions {
690
690
  maxDigits?: number;
691
691
  /** Allow decimal input for currency. Default: true */
692
692
  allowDecimal?: boolean;
693
+ /** Digits kept after the decimal mark for currency. Default: 2 */
694
+ maxDecimals?: number;
693
695
  /**
694
696
  * Calling code for `phone` when it is shown outside the value (a country
695
697
  * picker, say). A `leadingText` such as `+84` is picked up on its own.
package/dist/index.d.ts CHANGED
@@ -690,6 +690,8 @@ interface InputFormatOptions {
690
690
  maxDigits?: number;
691
691
  /** Allow decimal input for currency. Default: true */
692
692
  allowDecimal?: boolean;
693
+ /** Digits kept after the decimal mark for currency. Default: 2 */
694
+ maxDecimals?: number;
693
695
  /**
694
696
  * Calling code for `phone` when it is shown outside the value (a country
695
697
  * picker, say). A `leadingText` such as `+84` is picked up on its own.
package/dist/index.js CHANGED
@@ -7577,7 +7577,7 @@ var DropdownList = React235.forwardRef(
7577
7577
  DropdownList.displayName = "DropdownList";
7578
7578
 
7579
7579
  // ../ultimate/src/utils/format.utils.ts
7580
- var formatCurrency = (value, separator = ",", allowDecimal = true) => {
7580
+ var formatCurrency = (value, separator = ",", allowDecimal = true, maxDecimals = 2) => {
7581
7581
  if (!value) return "";
7582
7582
  const decimalChar = separator === "," ? "." : ",";
7583
7583
  let cleaned = value.replace(new RegExp(`[^\\d\\${decimalChar}-]`, "g"), "");
@@ -7591,7 +7591,7 @@ var formatCurrency = (value, separator = ",", allowDecimal = true) => {
7591
7591
  integerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
7592
7592
  let result = integerPart;
7593
7593
  if (allowDecimal && decimalPart !== void 0) {
7594
- result += decimalChar + decimalPart;
7594
+ result += decimalChar + decimalPart.slice(0, maxDecimals);
7595
7595
  }
7596
7596
  if (isNegative && result !== "0") {
7597
7597
  result = "-" + result;
@@ -7837,6 +7837,7 @@ var TextField = React237.forwardRef(
7837
7837
  const separator = formatOptions?.separator ?? ",";
7838
7838
  const allowDecimal = formatOptions?.allowDecimal ?? true;
7839
7839
  const maxDigits = formatOptions?.maxDigits;
7840
+ const maxDecimals = formatOptions?.maxDecimals ?? 2;
7840
7841
  const applyFormat = React237.useCallback((raw) => {
7841
7842
  switch (activeFormat) {
7842
7843
  case "currency": {
@@ -7849,7 +7850,7 @@ var TextField = React237.forwardRef(
7849
7850
  cleaned = parts.join(decimalChar);
7850
7851
  }
7851
7852
  }
7852
- return formatCurrency(cleaned, separator, allowDecimal);
7853
+ return formatCurrency(cleaned, separator, allowDecimal, maxDecimals);
7853
7854
  }
7854
7855
  case "phone":
7855
7856
  return formatPhone(raw, { countryCode: phoneCountryCode });
@@ -7862,7 +7863,7 @@ var TextField = React237.forwardRef(
7862
7863
  default:
7863
7864
  return raw;
7864
7865
  }
7865
- }, [activeFormat, separator, allowDecimal, maxDigits, phoneCountryCode]);
7866
+ }, [activeFormat, separator, allowDecimal, maxDigits, maxDecimals, phoneCountryCode]);
7866
7867
  const handleBlur = (e) => {
7867
7868
  setFocused(false);
7868
7869
  if (activeFormat && currentValue) {
package/dist/index.mjs CHANGED
@@ -7287,7 +7287,7 @@ var DropdownList = React235.forwardRef(
7287
7287
  DropdownList.displayName = "DropdownList";
7288
7288
 
7289
7289
  // ../ultimate/src/utils/format.utils.ts
7290
- var formatCurrency = (value, separator = ",", allowDecimal = true) => {
7290
+ var formatCurrency = (value, separator = ",", allowDecimal = true, maxDecimals = 2) => {
7291
7291
  if (!value) return "";
7292
7292
  const decimalChar = separator === "," ? "." : ",";
7293
7293
  let cleaned = value.replace(new RegExp(`[^\\d\\${decimalChar}-]`, "g"), "");
@@ -7301,7 +7301,7 @@ var formatCurrency = (value, separator = ",", allowDecimal = true) => {
7301
7301
  integerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
7302
7302
  let result = integerPart;
7303
7303
  if (allowDecimal && decimalPart !== void 0) {
7304
- result += decimalChar + decimalPart;
7304
+ result += decimalChar + decimalPart.slice(0, maxDecimals);
7305
7305
  }
7306
7306
  if (isNegative && result !== "0") {
7307
7307
  result = "-" + result;
@@ -7547,6 +7547,7 @@ var TextField = React237.forwardRef(
7547
7547
  const separator = formatOptions?.separator ?? ",";
7548
7548
  const allowDecimal = formatOptions?.allowDecimal ?? true;
7549
7549
  const maxDigits = formatOptions?.maxDigits;
7550
+ const maxDecimals = formatOptions?.maxDecimals ?? 2;
7550
7551
  const applyFormat = React237.useCallback((raw) => {
7551
7552
  switch (activeFormat) {
7552
7553
  case "currency": {
@@ -7559,7 +7560,7 @@ var TextField = React237.forwardRef(
7559
7560
  cleaned = parts.join(decimalChar);
7560
7561
  }
7561
7562
  }
7562
- return formatCurrency(cleaned, separator, allowDecimal);
7563
+ return formatCurrency(cleaned, separator, allowDecimal, maxDecimals);
7563
7564
  }
7564
7565
  case "phone":
7565
7566
  return formatPhone(raw, { countryCode: phoneCountryCode });
@@ -7572,7 +7573,7 @@ var TextField = React237.forwardRef(
7572
7573
  default:
7573
7574
  return raw;
7574
7575
  }
7575
- }, [activeFormat, separator, allowDecimal, maxDigits, phoneCountryCode]);
7576
+ }, [activeFormat, separator, allowDecimal, maxDigits, maxDecimals, phoneCountryCode]);
7576
7577
  const handleBlur = (e) => {
7577
7578
  setFocused(false);
7578
7579
  if (activeFormat && currentValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@photonix/basic",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
4
4
  "description": "Photonix Basic - Foundation primitives and essential UI building blocks",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -17,8 +17,8 @@
17
17
  "./dist/index.css": "./dist/index.css"
18
18
  },
19
19
  "dependencies": {
20
- "@photonix/icons": "^3.4.0",
21
- "@photonix/illustrations": "^3.4.0"
20
+ "@photonix/icons": "^3.6.0",
21
+ "@photonix/illustrations": "^3.6.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@repo/typescript-config": "*",
@@ -26,7 +26,7 @@
26
26
  "eslint": "^9.39.1",
27
27
  "tsup": "^8.0.2",
28
28
  "typescript": "5.9.2",
29
- "@photonix/ultimate": "^3.4.0"
29
+ "@photonix/ultimate": "^3.6.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": "^18.0.0 || ^19.0.0",