@stella-source/stellasource-dsl 1.3.2 → 1.4.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/cjs/index.js +8 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/TextField/NumberInput/types.d.ts +3 -3
- package/dist/cjs/types/components/TextField/types.d.ts +2 -17
- package/dist/cjs/types/index.d.ts +1 -2
- package/dist/esm/index.esm.js +8 -2
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/types/components/TextField/NumberInput/types.d.ts +3 -3
- package/dist/esm/types/components/TextField/types.d.ts +2 -17
- package/dist/esm/types/index.d.ts +1 -2
- package/dist/index.d.ts +21 -36
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
import { StellaIconDefinition } from "../../StellaIcon/types";
|
|
3
|
-
import { TextFieldAlignments
|
|
3
|
+
import { TextFieldAlignments } from "../types";
|
|
4
4
|
export interface NumberInputProps {
|
|
5
5
|
id: string;
|
|
6
6
|
label: string;
|
|
@@ -23,8 +23,8 @@ export interface NumberInputProps {
|
|
|
23
23
|
endIcon?: `${StellaIconDefinition}`;
|
|
24
24
|
hasError?: boolean;
|
|
25
25
|
textAlign?: `${TextFieldAlignments}`;
|
|
26
|
-
leftCategory?:
|
|
27
|
-
rightCategory?:
|
|
26
|
+
leftCategory?: string;
|
|
27
|
+
rightCategory?: string;
|
|
28
28
|
thousandSeparator?: boolean;
|
|
29
29
|
decimalPlaces?: number;
|
|
30
30
|
allowNegativeNumbers?: boolean;
|
|
@@ -4,21 +4,6 @@ export declare enum TextFieldAlignments {
|
|
|
4
4
|
CENTER = "center",
|
|
5
5
|
RIGHT = "right"
|
|
6
6
|
}
|
|
7
|
-
export declare enum TextFieldLeftCategory {
|
|
8
|
-
US_CURRENCY = "$"
|
|
9
|
-
}
|
|
10
|
-
export declare enum TextFieldRightCategory {
|
|
11
|
-
FEET = "ft",
|
|
12
|
-
CENTIMETERS = "cm",
|
|
13
|
-
INCHES = "in",
|
|
14
|
-
FULL_INCHES = "inches",
|
|
15
|
-
PERCENTAGE = "%",
|
|
16
|
-
POUNDS_FEET = "lbs/ft",
|
|
17
|
-
HUNDREDWEIGHT = "CWT",
|
|
18
|
-
DPH = "$/hr",
|
|
19
|
-
MINUTES = "min",
|
|
20
|
-
HOURS = "hr"
|
|
21
|
-
}
|
|
22
7
|
export interface TextFieldContainerProps {
|
|
23
8
|
children: React.ReactNode;
|
|
24
9
|
id: string;
|
|
@@ -26,8 +11,8 @@ export interface TextFieldContainerProps {
|
|
|
26
11
|
hideLabel?: boolean;
|
|
27
12
|
disabled?: boolean;
|
|
28
13
|
dataTestId?: string;
|
|
29
|
-
rightCategory?:
|
|
30
|
-
leftCategory?:
|
|
14
|
+
rightCategory?: string;
|
|
15
|
+
leftCategory?: string;
|
|
31
16
|
tooltipText?: string;
|
|
32
17
|
isRequired?: boolean;
|
|
33
18
|
helperText?: string;
|
|
@@ -14,13 +14,12 @@ import Table from "./components/Table/Table";
|
|
|
14
14
|
import Pagination from "./components/Pagination/Pagination";
|
|
15
15
|
import Sync from "./components/Sync/Sync";
|
|
16
16
|
import TableUnitsAndTotals from "./components/TableUnitsAndTotals/TableUnitsAndTotals";
|
|
17
|
+
import PaymentStatus from "./components/PaymentStatus/PaymentStatus";
|
|
17
18
|
/** Types */
|
|
18
19
|
import { StellaButtonVariant } from "./components/StellaButton/types";
|
|
19
20
|
/** Tokens */
|
|
20
21
|
import { Styles } from "./shared/tokens";
|
|
21
22
|
import "./shared/tokens/tokens.css";
|
|
22
|
-
import PaymentStatus from "./components/PaymentStatus/PaymentStatus";
|
|
23
23
|
/**Exports */
|
|
24
|
-
export * from "./components/TableUnitsAndTotals/types";
|
|
25
24
|
export type { StellaIconDefinition } from "./components/StellaIcon/types";
|
|
26
25
|
export { Label, StellaButton, IconButton, Loader, HelperText, Tooltip, StellaIcon, TextInput, PasswordInput, NumberInput, Table, Pagination, Sync, TableUnitsAndTotals, StellaButtonVariant, PaymentStatus, Styles, };
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -17311,7 +17311,13 @@ const PasswordInput = ({ id, className, htmlProps, label, placeholder = "Enter P
|
|
|
17311
17311
|
const formatDynamicNumbersWithCommas = (num, decimalPlaces) => {
|
|
17312
17312
|
const onlyDigitNum = num.toString().replace(/[^\d.-]/g, "");
|
|
17313
17313
|
const decimalEnding = onlyDigitNum.endsWith(".");
|
|
17314
|
-
const
|
|
17314
|
+
const zeroEnding = onlyDigitNum.includes(".") && onlyDigitNum.endsWith("0");
|
|
17315
|
+
let decimalTrailingZeros = "";
|
|
17316
|
+
if (zeroEnding) {
|
|
17317
|
+
const match = onlyDigitNum.match(/0+$/);
|
|
17318
|
+
decimalTrailingZeros = match ? match[0] : "";
|
|
17319
|
+
}
|
|
17320
|
+
const decimalZero = onlyDigitNum.endsWith(`.${decimalTrailingZeros.length > 0 ? decimalTrailingZeros : "0"}`);
|
|
17315
17321
|
if (onlyDigitNum === "" || onlyDigitNum === "-" || onlyDigitNum === ".") {
|
|
17316
17322
|
return onlyDigitNum;
|
|
17317
17323
|
}
|
|
@@ -17322,7 +17328,7 @@ const formatDynamicNumbersWithCommas = (num, decimalPlaces) => {
|
|
|
17322
17328
|
? `${Number(onlyDigitNum).toLocaleString("en-US", {
|
|
17323
17329
|
minimumFractionDigits: 0,
|
|
17324
17330
|
maximumFractionDigits: decimalPlaces,
|
|
17325
|
-
})}${decimalEnding ? "." : ""}${decimalZero ? "
|
|
17331
|
+
})}${decimalEnding ? "." : ""}${decimalZero ? "." : ""}${zeroEnding ? `${decimalTrailingZeros}` : ""}`
|
|
17326
17332
|
: "";
|
|
17327
17333
|
};
|
|
17328
17334
|
|