dry-ux 1.76.0 → 1.78.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.
@@ -1,9 +1,37 @@
1
1
  import * as React from "react";
2
- /**
3
- * Renders a formatted dollar amount with a dollar sign and parentheses if the amount is negative.
4
- */
5
- export declare const Money: React.FC<{
2
+ type MoneyProps = {
3
+ /**
4
+ * Numeric amount to display. Negative values are wrapped in parentheses and styled using negativeColor/negativeStyles.
5
+ */
6
6
  amount: number;
7
+ /**
8
+ * Whether to include decimal places in the formatted output. When true, the helper will format with standard cents precision.
9
+ * Defaults to false.
10
+ */
7
11
  decimal_places?: boolean;
12
+ /**
13
+ * Currency symbol prefix to display before the formatted amount. Defaults to "$".
14
+ */
8
15
  currency?: string;
9
- }>;
16
+ /**
17
+ * Fallback text color applied when the amount is negative (unless overridden via negativeStyles). Defaults to Bootstrap danger-like red.
18
+ */
19
+ negativeColor?: string;
20
+ /**
21
+ * Base styles applied to the <span>. These are merged last and can override sign-specific styles.
22
+ */
23
+ styles?: React.CSSProperties;
24
+ /**
25
+ * Additional styles merged when amount is negative (after negativeColor). Overridden by properties in styles if conflicts occur.
26
+ */
27
+ negativeStyles?: React.CSSProperties;
28
+ /**
29
+ * Additional styles merged when amount is zero or positive. Overridden by properties in styles if conflicts occur.
30
+ */
31
+ positiveStyles?: React.CSSProperties;
32
+ };
33
+ /**
34
+ * Renders a formatted dollar amount with a currency symbol and parentheses if the amount is negative.
35
+ */
36
+ export declare const Money: React.FC<MoneyProps>;
37
+ export {};
@@ -4,10 +4,10 @@ exports.Money = void 0;
4
4
  const React = require("react");
5
5
  const utilities_1 = require("../helpers/utilities");
6
6
  /**
7
- * Renders a formatted dollar amount with a dollar sign and parentheses if the amount is negative.
7
+ * Renders a formatted dollar amount with a currency symbol and parentheses if the amount is negative.
8
8
  */
9
- exports.Money = React.memo(({ amount, decimal_places = false, currency = "$" }) => {
9
+ exports.Money = React.memo(({ amount, decimal_places = false, currency = "$", negativeColor = "#d9534f", styles = {}, negativeStyles = {}, positiveStyles = {}, }) => {
10
10
  const isNegative = amount < 0;
11
11
  const converted = `${currency}${(0, utilities_1.formatDollar)(Math.abs(amount), decimal_places)}`;
12
- return (React.createElement("span", { style: Object.assign({}, (isNegative && { color: "#d9534f" })) }, isNegative ? `(${converted})` : converted));
12
+ return (React.createElement("span", { style: Object.assign(Object.assign({}, styles), (isNegative ? Object.assign({ color: negativeColor }, negativeStyles) : positiveStyles)) }, isNegative ? `(${converted})` : converted));
13
13
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dry-ux",
3
- "version": "1.76.0",
3
+ "version": "1.78.0",
4
4
  "description": "",
5
5
  "main": "dist/index",
6
6
  "scripts": {