dash-ui-kit 1.0.91 → 1.0.92
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.
|
@@ -7,6 +7,8 @@ export interface BigNumberProps {
|
|
|
7
7
|
variant?: BigNumberVariant;
|
|
8
8
|
/** Extra class names to apply to the wrapper. Use gap-* classes for spacing between groups. */
|
|
9
9
|
className?: string;
|
|
10
|
+
/** Horizontal spacing (in pixels) around the decimal point. Negative values reduce spacing. @default -2 */
|
|
11
|
+
decimalPointSpacing?: number;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Splits a numeric string into groups of three characters for display.
|
package/dist/react/index.cjs.js
CHANGED
|
@@ -9567,27 +9567,41 @@ const bigNumberStyles = classVarianceAuthority.cva('inline-flex whitespace-nowra
|
|
|
9567
9567
|
const BigNumber = ({
|
|
9568
9568
|
children,
|
|
9569
9569
|
variant = 'space',
|
|
9570
|
-
className = ''
|
|
9570
|
+
className = '',
|
|
9571
|
+
decimalPointSpacing = -2
|
|
9571
9572
|
}) => {
|
|
9572
9573
|
const {
|
|
9573
9574
|
theme
|
|
9574
9575
|
} = useTheme();
|
|
9576
|
+
const decimalPointStyle = {
|
|
9577
|
+
marginLeft: `${decimalPointSpacing}px`,
|
|
9578
|
+
marginRight: `${decimalPointSpacing}px`
|
|
9579
|
+
};
|
|
9575
9580
|
if (children === undefined || children === null) return null;
|
|
9576
9581
|
const str = children.toString();
|
|
9577
9582
|
if (variant === 'space') {
|
|
9578
|
-
//
|
|
9579
|
-
const
|
|
9583
|
+
// Split into integer and decimal parts
|
|
9584
|
+
const [intPart, fracPart] = str.split('.');
|
|
9585
|
+
// group digits every 3, right to left (only for integer part)
|
|
9586
|
+
const groups = intPart.split('').reverse().reduce((acc, char, idx) => {
|
|
9580
9587
|
if (idx % 3 === 0) acc.unshift('');
|
|
9581
9588
|
acc[0] = char + acc[0];
|
|
9582
9589
|
return acc;
|
|
9583
9590
|
}, []);
|
|
9584
|
-
return jsxRuntime.
|
|
9591
|
+
return jsxRuntime.jsxs("span", {
|
|
9585
9592
|
className: `${bigNumberStyles({
|
|
9586
9593
|
theme
|
|
9587
9594
|
})} ${className}`,
|
|
9588
|
-
children: groups.map((grp, i) => jsxRuntime.jsx("span", {
|
|
9595
|
+
children: [groups.map((grp, i) => jsxRuntime.jsx("span", {
|
|
9589
9596
|
children: grp
|
|
9590
|
-
}, i))
|
|
9597
|
+
}, i)), fracPart != null && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9598
|
+
children: [jsxRuntime.jsx("span", {
|
|
9599
|
+
style: decimalPointStyle,
|
|
9600
|
+
children: "."
|
|
9601
|
+
}), jsxRuntime.jsx("span", {
|
|
9602
|
+
children: fracPart
|
|
9603
|
+
})]
|
|
9604
|
+
})]
|
|
9591
9605
|
});
|
|
9592
9606
|
} else {
|
|
9593
9607
|
// comma variant
|
|
@@ -9609,6 +9623,7 @@ const BigNumber = ({
|
|
|
9609
9623
|
})]
|
|
9610
9624
|
}, i)), fracPart != null && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
9611
9625
|
children: [jsxRuntime.jsx("span", {
|
|
9626
|
+
style: decimalPointStyle,
|
|
9612
9627
|
children: "."
|
|
9613
9628
|
}), jsxRuntime.jsx("span", {
|
|
9614
9629
|
children: fracPart
|