@stella-source/stellasource-dsl 1.3.1 → 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 +37 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/PaymentStatus/PaymentStatus.stories.d.ts +1 -1
- package/dist/cjs/types/components/PaymentStatus/types.d.ts +9 -9
- 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 +37 -13
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/types/components/PaymentStatus/PaymentStatus.stories.d.ts +1 -1
- package/dist/esm/types/components/PaymentStatus/types.d.ts +9 -9
- 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
package/dist/cjs/index.js
CHANGED
|
@@ -17331,7 +17331,13 @@ const PasswordInput = ({ id, className, htmlProps, label, placeholder = "Enter P
|
|
|
17331
17331
|
const formatDynamicNumbersWithCommas = (num, decimalPlaces) => {
|
|
17332
17332
|
const onlyDigitNum = num.toString().replace(/[^\d.-]/g, "");
|
|
17333
17333
|
const decimalEnding = onlyDigitNum.endsWith(".");
|
|
17334
|
-
const
|
|
17334
|
+
const zeroEnding = onlyDigitNum.includes(".") && onlyDigitNum.endsWith("0");
|
|
17335
|
+
let decimalTrailingZeros = "";
|
|
17336
|
+
if (zeroEnding) {
|
|
17337
|
+
const match = onlyDigitNum.match(/0+$/);
|
|
17338
|
+
decimalTrailingZeros = match ? match[0] : "";
|
|
17339
|
+
}
|
|
17340
|
+
const decimalZero = onlyDigitNum.endsWith(`.${decimalTrailingZeros.length > 0 ? decimalTrailingZeros : "0"}`);
|
|
17335
17341
|
if (onlyDigitNum === "" || onlyDigitNum === "-" || onlyDigitNum === ".") {
|
|
17336
17342
|
return onlyDigitNum;
|
|
17337
17343
|
}
|
|
@@ -17342,7 +17348,7 @@ const formatDynamicNumbersWithCommas = (num, decimalPlaces) => {
|
|
|
17342
17348
|
? `${Number(onlyDigitNum).toLocaleString("en-US", {
|
|
17343
17349
|
minimumFractionDigits: 0,
|
|
17344
17350
|
maximumFractionDigits: decimalPlaces,
|
|
17345
|
-
})}${decimalEnding ? "." : ""}${decimalZero ? "
|
|
17351
|
+
})}${decimalEnding ? "." : ""}${decimalZero ? "." : ""}${zeroEnding ? `${decimalTrailingZeros}` : ""}`
|
|
17346
17352
|
: "";
|
|
17347
17353
|
};
|
|
17348
17354
|
|
|
@@ -21898,21 +21904,39 @@ const PaymentStatusLabel = styled.span `
|
|
|
21898
21904
|
line-height: 20px;
|
|
21899
21905
|
`;
|
|
21900
21906
|
|
|
21907
|
+
var PaymentStatusVariant;
|
|
21908
|
+
(function (PaymentStatusVariant) {
|
|
21909
|
+
PaymentStatusVariant["PAYMENT_PENDING"] = "PaymentPending";
|
|
21910
|
+
PaymentStatusVariant["TERMS_APPLIED"] = "TermsApplied";
|
|
21911
|
+
PaymentStatusVariant["PAYMENT_AUTHORIZED"] = "PaymentAuthorized";
|
|
21912
|
+
PaymentStatusVariant["PAYMENT_PROCESSING"] = "PaymentProcessing";
|
|
21913
|
+
PaymentStatusVariant["PAYMENT_SETTLED"] = "PaymentSettled";
|
|
21914
|
+
PaymentStatusVariant["PAYMENT_FAILED"] = "PaymentFailed";
|
|
21915
|
+
PaymentStatusVariant["PAYMENT_CANCELED"] = "PaymentCanceled";
|
|
21916
|
+
PaymentStatusVariant["PAYMENT_WINDOW_EXPIRED"] = "PaymentWindowExpired";
|
|
21917
|
+
})(PaymentStatusVariant || (PaymentStatusVariant = {}));
|
|
21918
|
+
|
|
21901
21919
|
const STATUS_ICON_MAP = {
|
|
21902
|
-
|
|
21903
|
-
|
|
21904
|
-
|
|
21905
|
-
|
|
21906
|
-
|
|
21907
|
-
|
|
21908
|
-
|
|
21909
|
-
|
|
21920
|
+
PaymentPending: "warning",
|
|
21921
|
+
TermsApplied: "check-square",
|
|
21922
|
+
PaymentAuthorized: "check-square",
|
|
21923
|
+
PaymentProcessing: "money",
|
|
21924
|
+
PaymentSettled: "currency-dollar",
|
|
21925
|
+
PaymentFailed: "x-circle",
|
|
21926
|
+
PaymentCanceled: "empty",
|
|
21927
|
+
PaymentWindowExpired: "hourglass-simple-low",
|
|
21910
21928
|
};
|
|
21911
21929
|
const PaymentStatus = ({ variant, id, className }) => {
|
|
21912
|
-
const iconName = STATUS_ICON_MAP[variant];
|
|
21930
|
+
const iconName = variant ? STATUS_ICON_MAP[variant] : "";
|
|
21931
|
+
const labelWords = variant?.split(/(?=[A-Z])/);
|
|
21932
|
+
let label = labelWords ? labelWords.join(" ") : "--";
|
|
21933
|
+
if (variant === PaymentStatusVariant.PAYMENT_SETTLED)
|
|
21934
|
+
label = "Paid";
|
|
21935
|
+
if (variant === PaymentStatusVariant.PAYMENT_CANCELED)
|
|
21936
|
+
label = "Canceled";
|
|
21913
21937
|
return (a$l.createElement(PaymentStatusComponent, { id: id, className: className },
|
|
21914
|
-
a$l.createElement(PaymentStatusIcon, { iconName: iconName, size: 16 }),
|
|
21915
|
-
a$l.createElement(PaymentStatusLabel, null,
|
|
21938
|
+
iconName ? a$l.createElement(PaymentStatusIcon, { iconName: iconName, size: 16 }) : "",
|
|
21939
|
+
a$l.createElement(PaymentStatusLabel, null, label)));
|
|
21916
21940
|
};
|
|
21917
21941
|
|
|
21918
21942
|
exports.HelperText = HelperText;
|