pds-dev-kit-web 2.2.195 → 2.2.197
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/src/core/pricing/translator.d.ts +1 -1
- package/dist/src/core/pricing/translator.js +1 -1
- package/dist/src/desktop/components/PriceTextField/PriceTextField.d.ts +2 -1
- package/dist/src/desktop/components/PriceTextField/PriceTextField.js +4 -1
- package/dist/src/desktop/components/PriceTextLabel/PriceTextLabel.d.ts +2 -3
- package/dist/src/desktop/components/PriceTextLabel/PriceTextLabel.js +4 -2
- package/dist/src/mobile/components/PriceTextLabel/PriceTextLabel.d.ts +2 -3
- package/dist/src/mobile/components/PriceTextLabel/PriceTextLabel.js +4 -2
- package/package.json +1 -1
- package/release-note.md +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CurrencyCodeType, Price, TranslationType } from './types';
|
|
2
2
|
export interface PricingTranslateOptions {
|
|
3
3
|
friendly?: boolean;
|
|
4
|
-
|
|
4
|
+
translation?: TranslationType;
|
|
5
5
|
}
|
|
6
6
|
export declare class PricingTranslator {
|
|
7
7
|
private static browserLanguage;
|
|
@@ -29,7 +29,7 @@ var PricingTranslator = /** @class */ (function () {
|
|
|
29
29
|
PricingTranslator.currency = function (code, opts) {
|
|
30
30
|
var currency = types_1.CURRENCY_MAP[code];
|
|
31
31
|
if (opts === null || opts === void 0 ? void 0 : opts.friendly) {
|
|
32
|
-
return currency.friendlyName(opts.
|
|
32
|
+
return currency.friendlyName(opts.translation);
|
|
33
33
|
}
|
|
34
34
|
return currency.name;
|
|
35
35
|
};
|
|
@@ -26,6 +26,7 @@ type Props = {
|
|
|
26
26
|
returnType?: 'object' | 'string' | 'rawValue';
|
|
27
27
|
deleteBtnMode?: 'none' | 'use';
|
|
28
28
|
minPriceAmount?: string | number;
|
|
29
|
+
onExChange?: (e: React.ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
29
30
|
onChange?: (value: string) => void;
|
|
30
31
|
onBlur?: (e: React.FocusEvent<HTMLInputElement> | React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
31
32
|
onFocus?: (e: React.FocusEvent<HTMLInputElement> | React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
@@ -37,5 +38,5 @@ type Props = {
|
|
|
37
38
|
displayValue: string;
|
|
38
39
|
}) => void;
|
|
39
40
|
} & Omit<Partial<TextFieldBaseProps>, 'textAlign' | 'preventBlankMode' | 'enterSubmitMode' | 'multiRows' | 'colorTheme'>;
|
|
40
|
-
declare function PriceTextField({ name, hintText, defaultAmount, colorTheme, size, fontWeight, hintTextFontWeight, responsiveMode, state, dropdownState, customWidth, baseCurrency, currencies, decimalPlaces, exchangeRates, textAlign, validation, useRequiredValidation, returnType, deleteBtnMode, minPriceAmount, onChange, onBlur, onFocus, onTarget, onCurrencyChange, onValueChange }: Props): JSX.Element;
|
|
41
|
+
declare function PriceTextField({ name, hintText, defaultAmount, colorTheme, size, fontWeight, hintTextFontWeight, responsiveMode, state, dropdownState, customWidth, baseCurrency, currencies, decimalPlaces, exchangeRates, textAlign, validation, useRequiredValidation, returnType, deleteBtnMode, minPriceAmount, onChange, onExChange, onBlur, onFocus, onTarget, onCurrencyChange, onValueChange }: Props): JSX.Element;
|
|
41
42
|
export default PriceTextField;
|
|
@@ -65,7 +65,7 @@ exports.DEFAULT_DECIMAL_PLACES = {
|
|
|
65
65
|
function PriceTextField(_a) {
|
|
66
66
|
var _b;
|
|
67
67
|
var _c;
|
|
68
|
-
var name = _a.name, hintText = _a.hintText, defaultAmount = _a.defaultAmount, _d = _a.colorTheme, colorTheme = _d === void 0 ? 'none' : _d, _e = _a.size, size = _e === void 0 ? 'large' : _e, _f = _a.fontWeight, fontWeight = _f === void 0 ? 'bold' : _f, _g = _a.hintTextFontWeight, hintTextFontWeight = _g === void 0 ? 'normal' : _g, _h = _a.responsiveMode, responsiveMode = _h === void 0 ? 'none' : _h, _j = _a.state, state = _j === void 0 ? 'normal' : _j, _k = _a.dropdownState, dropdownState = _k === void 0 ? 'normal' : _k, customWidth = _a.customWidth, _l = _a.baseCurrency, baseCurrency = _l === void 0 ? pricing_1.CurrencyCode.KRW : _l, _m = _a.currencies, currencies = _m === void 0 ? [pricing_1.CurrencyCode.KRW, pricing_1.CurrencyCode.USD] : _m, _o = _a.decimalPlaces, decimalPlaces = _o === void 0 ? exports.DEFAULT_DECIMAL_PLACES : _o, _p = _a.exchangeRates, exchangeRates = _p === void 0 ? (_b = {}, _b[pricing_1.CurrencyCode.KRW] = 1300, _b[pricing_1.CurrencyCode.USD] = 1, _b) : _p, _q = _a.textAlign, textAlign = _q === void 0 ? 'right' : _q, validation = _a.validation, _r = _a.useRequiredValidation, useRequiredValidation = _r === void 0 ? 'use' : _r, _s = _a.returnType, returnType = _s === void 0 ? 'object' : _s, _t = _a.deleteBtnMode, deleteBtnMode = _t === void 0 ? 'use' : _t, minPriceAmount = _a.minPriceAmount, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, onTarget = _a.onTarget, onCurrencyChange = _a.onCurrencyChange, onValueChange = _a.onValueChange;
|
|
68
|
+
var name = _a.name, hintText = _a.hintText, defaultAmount = _a.defaultAmount, _d = _a.colorTheme, colorTheme = _d === void 0 ? 'none' : _d, _e = _a.size, size = _e === void 0 ? 'large' : _e, _f = _a.fontWeight, fontWeight = _f === void 0 ? 'bold' : _f, _g = _a.hintTextFontWeight, hintTextFontWeight = _g === void 0 ? 'normal' : _g, _h = _a.responsiveMode, responsiveMode = _h === void 0 ? 'none' : _h, _j = _a.state, state = _j === void 0 ? 'normal' : _j, _k = _a.dropdownState, dropdownState = _k === void 0 ? 'normal' : _k, customWidth = _a.customWidth, _l = _a.baseCurrency, baseCurrency = _l === void 0 ? pricing_1.CurrencyCode.KRW : _l, _m = _a.currencies, currencies = _m === void 0 ? [pricing_1.CurrencyCode.KRW, pricing_1.CurrencyCode.USD] : _m, _o = _a.decimalPlaces, decimalPlaces = _o === void 0 ? exports.DEFAULT_DECIMAL_PLACES : _o, _p = _a.exchangeRates, exchangeRates = _p === void 0 ? (_b = {}, _b[pricing_1.CurrencyCode.KRW] = 1300, _b[pricing_1.CurrencyCode.USD] = 1, _b) : _p, _q = _a.textAlign, textAlign = _q === void 0 ? 'right' : _q, validation = _a.validation, _r = _a.useRequiredValidation, useRequiredValidation = _r === void 0 ? 'use' : _r, _s = _a.returnType, returnType = _s === void 0 ? 'object' : _s, _t = _a.deleteBtnMode, deleteBtnMode = _t === void 0 ? 'use' : _t, minPriceAmount = _a.minPriceAmount, onChange = _a.onChange, onExChange = _a.onExChange, onBlur = _a.onBlur, onFocus = _a.onFocus, onTarget = _a.onTarget, onCurrencyChange = _a.onCurrencyChange, onValueChange = _a.onValueChange;
|
|
69
69
|
var t = (0, react_i18next_1.useTranslation)('translation').t;
|
|
70
70
|
var _u = (0, react_1.useState)(defaultAmount ? String(defaultAmount) : ''), baseCurrencyValue = _u[0], setBaseCurrencyValue = _u[1];
|
|
71
71
|
var _v = (0, react_1.useState)(''), displayValue = _v[0], setDisplayValue = _v[1];
|
|
@@ -321,6 +321,9 @@ function PriceTextField(_a) {
|
|
|
321
321
|
}
|
|
322
322
|
}, 0);
|
|
323
323
|
}
|
|
324
|
+
if (onExChange) {
|
|
325
|
+
onExChange(e);
|
|
326
|
+
}
|
|
324
327
|
};
|
|
325
328
|
var handleBlur = function (e) {
|
|
326
329
|
setIsInputFocused(false);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CurrencyCode, ExchangeRateMap, Price
|
|
2
|
+
import { CurrencyCode, ExchangeRateMap, Price } from '../../../core/pricing';
|
|
3
3
|
import type { TextLabelProps } from '../TextLabel/TextLabel';
|
|
4
4
|
type PriceTextLabelProps = Omit<TextLabelProps, 'text' | 'ellipsisMode' | 'lineLimit' | 'userSelectMode' | 'requirementMode' | 'bulletPointMode' | 'wordBreak'> & {
|
|
5
5
|
price: Price;
|
|
6
6
|
useFriendlyName?: 'none' | 'use';
|
|
7
7
|
useMinus?: 'none' | 'use';
|
|
8
|
-
translate?: TranslationType;
|
|
9
8
|
};
|
|
10
|
-
declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode,
|
|
9
|
+
declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode, ...args }: PriceTextLabelProps & {
|
|
11
10
|
selectedCurrency?: CurrencyCode;
|
|
12
11
|
exchangeRates?: ExchangeRateMap;
|
|
13
12
|
userCountryCode?: string;
|
|
@@ -23,10 +23,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
26
|
+
var react_i18next_1 = require("react-i18next");
|
|
26
27
|
var pricing_1 = require("../../../core/pricing");
|
|
27
28
|
var TextLabel_1 = require("../TextLabel");
|
|
28
29
|
function PriceTextLabel(_a) {
|
|
29
|
-
var price = _a.price, _b = _a.useFriendlyName, useFriendlyName = _b === void 0 ? 'none' : _b, _c = _a.useMinus, useMinus = _c === void 0 ? 'none' : _c, selectedCurrency = _a.selectedCurrency, exchangeRates = _a.exchangeRates, userCountryCode = _a.userCountryCode,
|
|
30
|
+
var price = _a.price, _b = _a.useFriendlyName, useFriendlyName = _b === void 0 ? 'none' : _b, _c = _a.useMinus, useMinus = _c === void 0 ? 'none' : _c, selectedCurrency = _a.selectedCurrency, exchangeRates = _a.exchangeRates, userCountryCode = _a.userCountryCode, args = __rest(_a, ["price", "useFriendlyName", "useMinus", "selectedCurrency", "exchangeRates", "userCountryCode"]);
|
|
31
|
+
var t = (0, react_i18next_1.useTranslation)('translation').t;
|
|
30
32
|
var targetPrice = price;
|
|
31
33
|
var formattedAmount = useMinus === 'use' ? "-".concat(targetPrice.amount) : targetPrice.amount;
|
|
32
34
|
var priceText = pricing_1.PricingService.translate.priceWithCurrency(exchangeRates && selectedCurrency
|
|
@@ -38,7 +40,7 @@ function PriceTextLabel(_a) {
|
|
|
38
40
|
: price.currency
|
|
39
41
|
}, {
|
|
40
42
|
friendly: useFriendlyName === 'use' ? true : false,
|
|
41
|
-
|
|
43
|
+
translation: t
|
|
42
44
|
});
|
|
43
45
|
return (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, __assign({}, args, { text: priceText }));
|
|
44
46
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CurrencyCode, ExchangeRateMap, Price
|
|
2
|
+
import { CurrencyCode, ExchangeRateMap, Price } from '../../../core/pricing';
|
|
3
3
|
import type { TextLabelProps } from '../TextLabel/TextLabel';
|
|
4
4
|
type PriceTextLabelProps = Omit<TextLabelProps, 'text' | 'ellipsisMode' | 'lineLimit' | 'userSelectMode' | 'requirementMode' | 'bulletPointMode' | 'wordBreak'> & {
|
|
5
5
|
price: Price;
|
|
6
6
|
useFriendlyName?: 'none' | 'use';
|
|
7
7
|
useMinus?: 'none' | 'use';
|
|
8
|
-
translate?: TranslationType;
|
|
9
8
|
};
|
|
10
|
-
declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode,
|
|
9
|
+
declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode, ...args }: PriceTextLabelProps & {
|
|
11
10
|
selectedCurrency?: CurrencyCode;
|
|
12
11
|
exchangeRates?: ExchangeRateMap;
|
|
13
12
|
userCountryCode?: string;
|
|
@@ -23,10 +23,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
26
|
+
var react_i18next_1 = require("react-i18next");
|
|
26
27
|
var pricing_1 = require("../../../core/pricing");
|
|
27
28
|
var TextLabel_1 = require("../TextLabel");
|
|
28
29
|
function PriceTextLabel(_a) {
|
|
29
|
-
var price = _a.price, _b = _a.useFriendlyName, useFriendlyName = _b === void 0 ? 'none' : _b, _c = _a.useMinus, useMinus = _c === void 0 ? 'none' : _c, selectedCurrency = _a.selectedCurrency, exchangeRates = _a.exchangeRates, userCountryCode = _a.userCountryCode,
|
|
30
|
+
var price = _a.price, _b = _a.useFriendlyName, useFriendlyName = _b === void 0 ? 'none' : _b, _c = _a.useMinus, useMinus = _c === void 0 ? 'none' : _c, selectedCurrency = _a.selectedCurrency, exchangeRates = _a.exchangeRates, userCountryCode = _a.userCountryCode, args = __rest(_a, ["price", "useFriendlyName", "useMinus", "selectedCurrency", "exchangeRates", "userCountryCode"]);
|
|
31
|
+
var t = (0, react_i18next_1.useTranslation)('translation').t;
|
|
30
32
|
var targetPrice = price;
|
|
31
33
|
var formattedAmount = useMinus === 'use' ? "-".concat(targetPrice.amount) : targetPrice.amount;
|
|
32
34
|
var priceText = pricing_1.PricingService.translate.priceWithCurrency(exchangeRates && selectedCurrency
|
|
@@ -38,7 +40,7 @@ function PriceTextLabel(_a) {
|
|
|
38
40
|
: price.currency
|
|
39
41
|
}, {
|
|
40
42
|
friendly: useFriendlyName === 'use' ? true : false,
|
|
41
|
-
|
|
43
|
+
translation: t
|
|
42
44
|
});
|
|
43
45
|
return (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, __assign({}, args, { text: priceText }));
|
|
44
46
|
}
|
package/package.json
CHANGED