pds-dev-kit-web 2.2.193 → 2.2.195

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.
Files changed (62) hide show
  1. package/dist/index.d.ts +6 -6
  2. package/dist/index.js +6 -2
  3. package/dist/src/common/index.d.ts +1 -1
  4. package/dist/src/common/services/i18n/resources/en.json +9 -1
  5. package/dist/src/common/services/i18n/resources/es.json +9 -1
  6. package/dist/src/common/services/i18n/resources/fil.json +9 -1
  7. package/dist/src/common/services/i18n/resources/index.d.ts +56 -0
  8. package/dist/src/common/services/i18n/resources/ja.json +9 -1
  9. package/dist/src/common/services/i18n/resources/ko.json +9 -1
  10. package/dist/src/common/services/i18n/resources/zh-cn.json +9 -1
  11. package/dist/src/common/services/i18n/resources/zh-tw.json +9 -1
  12. package/dist/src/common/types/text.d.ts +2 -0
  13. package/dist/src/core/pricing/formatter.d.ts +4 -0
  14. package/dist/src/core/pricing/formatter.js +18 -0
  15. package/dist/src/core/pricing/index.d.ts +2 -0
  16. package/dist/src/core/pricing/index.js +18 -0
  17. package/dist/src/core/pricing/policy.d.ts +26 -0
  18. package/dist/src/core/pricing/policy.js +98 -0
  19. package/dist/src/core/pricing/service.d.ts +62 -0
  20. package/dist/src/core/pricing/service.js +157 -0
  21. package/dist/src/core/pricing/translator.d.ts +27 -0
  22. package/dist/src/core/pricing/translator.js +53 -0
  23. package/dist/src/core/pricing/types.d.ts +19 -0
  24. package/dist/src/core/pricing/types.js +31 -0
  25. package/dist/src/core/pricing/validator.d.ts +29 -0
  26. package/dist/src/core/pricing/validator.js +105 -0
  27. package/dist/src/desktop/common/components/TextFieldBase/TextFieldBase.d.ts +3 -1
  28. package/dist/src/desktop/common/components/TextFieldBase/TextFieldBase.js +16 -11
  29. package/dist/src/desktop/components/PriceTextField/PriceTextField.d.ts +41 -0
  30. package/dist/src/desktop/components/PriceTextField/PriceTextField.js +580 -0
  31. package/dist/src/desktop/components/PriceTextField/index.d.ts +1 -0
  32. package/dist/src/desktop/components/PriceTextField/index.js +8 -0
  33. package/dist/src/desktop/components/PriceTextLabel/PriceTextLabel.d.ts +15 -0
  34. package/dist/src/desktop/components/PriceTextLabel/PriceTextLabel.js +45 -0
  35. package/dist/src/desktop/components/PriceTextLabel/index.d.ts +1 -0
  36. package/dist/src/desktop/components/PriceTextLabel/index.js +8 -0
  37. package/dist/src/desktop/components/TextField/TextField.d.ts +2 -1
  38. package/dist/src/desktop/components/TextField/TextField.js +7 -7
  39. package/dist/src/desktop/components/TextLabel/TextLabel.d.ts +3 -3
  40. package/dist/src/desktop/components/index.d.ts +3 -1
  41. package/dist/src/desktop/components/index.js +6 -2
  42. package/dist/src/desktop/index.d.ts +1 -1
  43. package/dist/src/desktop/index.js +3 -1
  44. package/dist/src/mobile/common/components/TextFieldBase/TextFieldBase.d.ts +2 -1
  45. package/dist/src/mobile/common/components/TextFieldBase/TextFieldBase.js +10 -10
  46. package/dist/src/mobile/components/PriceTextField/PriceTextField.d.ts +41 -0
  47. package/dist/src/mobile/components/PriceTextField/PriceTextField.js +570 -0
  48. package/dist/src/mobile/components/PriceTextField/index.d.ts +1 -0
  49. package/dist/src/mobile/components/PriceTextField/index.js +8 -0
  50. package/dist/src/mobile/components/PriceTextLabel/PriceTextLabel.d.ts +15 -0
  51. package/dist/src/mobile/components/PriceTextLabel/PriceTextLabel.js +45 -0
  52. package/dist/src/mobile/components/PriceTextLabel/index.d.ts +1 -0
  53. package/dist/src/mobile/components/PriceTextLabel/index.js +8 -0
  54. package/dist/src/mobile/components/TextField/TextField.d.ts +2 -1
  55. package/dist/src/mobile/components/TextField/TextField.js +7 -7
  56. package/dist/src/mobile/components/TextLabel/TextLabel.d.ts +3 -3
  57. package/dist/src/mobile/components/index.d.ts +3 -1
  58. package/dist/src/mobile/components/index.js +5 -1
  59. package/dist/src/mobile/index.d.ts +1 -1
  60. package/dist/src/mobile/index.js +4 -2
  61. package/package.json +1 -1
  62. package/release-note.md +2 -2
@@ -0,0 +1,580 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __assign = (this && this.__assign) || function () {
7
+ __assign = Object.assign || function(t) {
8
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9
+ s = arguments[i];
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
+ t[p] = s[p];
12
+ }
13
+ return t;
14
+ };
15
+ return __assign.apply(this, arguments);
16
+ };
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ var __importDefault = (this && this.__importDefault) || function (mod) {
41
+ return (mod && mod.__esModule) ? mod : { "default": mod };
42
+ };
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.DEFAULT_DECIMAL_PLACES = void 0;
45
+ var jsx_runtime_1 = require("react/jsx-runtime");
46
+ /* eslint-disable react/jsx-no-bind */
47
+ var react_1 = require("react");
48
+ var react_dom_1 = require("react-dom");
49
+ var react_hook_form_1 = require("react-hook-form");
50
+ var react_i18next_1 = require("react-i18next");
51
+ var types_1 = require("../../../common/types");
52
+ var clickTypeSystemUICssGenerator_1 = __importDefault(require("../../../common/utils/SystemUIPositionGenerator/clickTypeSystemUICssGenerator"));
53
+ var pricing_1 = require("../../../core/pricing");
54
+ var styled_components_1 = __importStar(require("styled-components"));
55
+ var transitionStyle_1 = require("../../../common/styles/movement/transitionStyle");
56
+ var hybrid_1 = require("../../../hybrid");
57
+ var components_1 = require("../../common/components");
58
+ var ContextMenu_1 = require("../ContextMenu");
59
+ var ContextMenuItem_1 = require("../ContextMenuItem");
60
+ var TextLabel_1 = require("../TextLabel");
61
+ exports.DEFAULT_DECIMAL_PLACES = {
62
+ KRW: 0,
63
+ USD: 2
64
+ };
65
+ function PriceTextField(_a) {
66
+ var _b;
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;
69
+ var t = (0, react_i18next_1.useTranslation)('translation').t;
70
+ var _u = (0, react_1.useState)(defaultAmount ? String(defaultAmount) : ''), baseCurrencyValue = _u[0], setBaseCurrencyValue = _u[1];
71
+ var _v = (0, react_1.useState)(''), displayValue = _v[0], setDisplayValue = _v[1];
72
+ var _w = (0, react_1.useState)(baseCurrency), selectedCurrency = _w[0], setSelectedCurrency = _w[1];
73
+ var _x = (0, react_1.useState)(false), isDropdownFocused = _x[0], setIsDropdownFocused = _x[1];
74
+ var _y = (0, react_1.useState)(false), isInputFocused = _y[0], setIsInputFocused = _y[1];
75
+ var _z = (0, react_1.useState)(null), contextMenuSizeOffset = _z[0], setContextMenuSizeOffset = _z[1];
76
+ var _0 = (0, react_1.useState)(null), dropdownPositionOffset = _0[0], setDropdownPositionOffset = _0[1];
77
+ var contextMenuRef = (0, react_1.useRef)(null);
78
+ var dropdownRef = (0, react_1.useRef)(null);
79
+ var _1 = (0, react_hook_form_1.useFormContext)(), register = _1.register, trigger = _1.trigger, errors = _1.formState.errors, setValue = _1.setValue;
80
+ /** 기본 validation */
81
+ var defaultValidation = (0, react_1.useMemo)(function () {
82
+ var validationConfig = {};
83
+ // Required validation
84
+ if (useRequiredValidation === 'use') {
85
+ validationConfig.required = t('str_please_enter_price');
86
+ }
87
+ validationConfig.validate = {};
88
+ // Min validation (기본값: KRW 300, USD 5)
89
+ validationConfig.validate.min = function (value) {
90
+ var minAmount = baseCurrency === pricing_1.CurrencyCode.KRW ? 300 : 5;
91
+ return pricing_1.PricingService.validate.min(value, {
92
+ minAmount: minAmount,
93
+ currency: baseCurrency
94
+ });
95
+ };
96
+ // Max validation (기본값: KRW 10,000,000, USD 10,000)
97
+ validationConfig.validate.max = function (value) {
98
+ var maxAmount = baseCurrency === pricing_1.CurrencyCode.KRW ? 10000000 : 10000.0;
99
+ return pricing_1.PricingService.validate.max(value, {
100
+ maxAmount: maxAmount,
101
+ currency: baseCurrency
102
+ });
103
+ };
104
+ // Format validation (기본값: KRW 100, USD 1)
105
+ validationConfig.validate.format = function (value) {
106
+ return pricing_1.PricingService.validate.format(value, {
107
+ paymentUnit: baseCurrency === pricing_1.CurrencyCode.KRW ? 100 : 1,
108
+ currency: baseCurrency
109
+ });
110
+ };
111
+ return validationConfig;
112
+ }, [useRequiredValidation, baseCurrency]);
113
+ /** 최종 validation */
114
+ var finalValidation = (0, react_1.useMemo)(function () {
115
+ if (!validation) {
116
+ return defaultValidation;
117
+ }
118
+ var merged = {
119
+ required: defaultValidation.required,
120
+ validate: __assign({}, defaultValidation.validate)
121
+ };
122
+ // required 오버라이드
123
+ if (validation.required !== undefined) {
124
+ merged.required = validation.required;
125
+ }
126
+ // validate 오버라이드
127
+ if (validation.validate) {
128
+ Object.keys(validation.validate).forEach(function (key) {
129
+ if (validation.validate[key]) {
130
+ merged.validate[key] = validation.validate[key];
131
+ }
132
+ });
133
+ }
134
+ return merged;
135
+ }, [defaultValidation, validation]);
136
+ var validateOnChange = register(name, finalValidation).onChange;
137
+ var isError = (0, types_1.getErrorByName)(errors, name);
138
+ var deleteIconColor = 'ui_cpnt_button_icon_disabled';
139
+ switch (colorTheme) {
140
+ case 'dark': {
141
+ deleteIconColor = 'ui_cpnt_textfield_icon_darktheme_disabled';
142
+ break;
143
+ }
144
+ case 'transparent': {
145
+ deleteIconColor = 'ui_cpnt_textfield_icon_colortheme_transparent_disabled';
146
+ break;
147
+ }
148
+ }
149
+ // 입력 필드 읽기 전용 여부 (baseCurrency가 아닌 경우)
150
+ var isInputReadOnly = selectedCurrency !== baseCurrency;
151
+ var currencyOptions = (0, react_1.useMemo)(function () {
152
+ return currencies.map(function (currency) { return ({
153
+ value: currency,
154
+ text: currency,
155
+ currency: currency,
156
+ iconName: "ic_currency_".concat(currency.toLowerCase()),
157
+ state: 'normal'
158
+ }); });
159
+ }, [currencies]);
160
+ var contextMenuPositionCss = (0, clickTypeSystemUICssGenerator_1.default)({
161
+ sizeOffset: contextMenuSizeOffset,
162
+ positionOffset: dropdownPositionOffset
163
+ });
164
+ function formatCurrency(value, currency, decimalPlaces) {
165
+ if (currency === void 0) { currency = 'KRW'; }
166
+ var decimals;
167
+ if (decimalPlaces && decimalPlaces[currency] !== undefined) {
168
+ decimals = decimalPlaces[currency];
169
+ }
170
+ else {
171
+ switch (currency) {
172
+ case 'KRW':
173
+ decimals = 0;
174
+ break;
175
+ case 'USD':
176
+ decimals = 2;
177
+ break;
178
+ default:
179
+ decimals = 0;
180
+ break;
181
+ }
182
+ }
183
+ var str = Number(value).toFixed(decimals);
184
+ if (decimals) {
185
+ return str.replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
186
+ }
187
+ return str.replace(/(\d)(?=(\d{3})+$)/g, '$1,');
188
+ }
189
+ var removeCommas = function (value) {
190
+ return value.replace(/,/g, '');
191
+ };
192
+ // 환율 계산된 값 계산 (항상 baseCurrency 기준으로)
193
+ var calculatedValue = (0, react_1.useMemo)(function () {
194
+ if (selectedCurrency === baseCurrency) {
195
+ return Number(baseCurrencyValue);
196
+ }
197
+ return pricing_1.PricingService.exchangePrice(Number(baseCurrencyValue), baseCurrency, selectedCurrency, exchangeRates);
198
+ }, [baseCurrencyValue, selectedCurrency, baseCurrency]);
199
+ /** 표시되는 값 설정 */
200
+ (0, react_1.useEffect)(function () {
201
+ if (isInputFocused && selectedCurrency === baseCurrency) {
202
+ setDisplayValue(addCommas(baseCurrencyValue) || '');
203
+ }
204
+ else if (!baseCurrencyValue || baseCurrencyValue === '') {
205
+ setDisplayValue('');
206
+ }
207
+ else {
208
+ setDisplayValue(formatCurrency(calculatedValue, selectedCurrency, decimalPlaces));
209
+ }
210
+ }, [
211
+ baseCurrencyValue,
212
+ calculatedValue,
213
+ selectedCurrency,
214
+ isInputFocused,
215
+ baseCurrency,
216
+ decimalPlaces
217
+ ]);
218
+ /** 드롭다운 위치 업데이트 */
219
+ (0, react_1.useEffect)(function () {
220
+ if (!isDropdownFocused && contextMenuRef.current) {
221
+ setContextMenuSizeOffset(null);
222
+ return;
223
+ }
224
+ if (dropdownRef.current) {
225
+ var _a = dropdownRef.current.getBoundingClientRect(), top_1 = _a.top, right = _a.right, left = _a.left, bottom = _a.bottom;
226
+ setDropdownPositionOffset({
227
+ top: top_1 + window.scrollY,
228
+ right: right + window.scrollX,
229
+ bottom: bottom + window.scrollY,
230
+ left: left + window.scrollX
231
+ });
232
+ }
233
+ if (contextMenuRef.current) {
234
+ setContextMenuSizeOffset({
235
+ height: contextMenuRef.current.offsetHeight,
236
+ width: contextMenuRef.current.offsetWidth
237
+ });
238
+ }
239
+ }, [isDropdownFocused]);
240
+ /** 포맷팅 값 */
241
+ var formattedValue = (0, react_1.useMemo)(function () {
242
+ if (!baseCurrencyValue || baseCurrencyValue === '') {
243
+ return '';
244
+ }
245
+ return formatCurrency(calculatedValue || 0, selectedCurrency, decimalPlaces);
246
+ }, [baseCurrencyValue, calculatedValue, selectedCurrency, decimalPlaces]);
247
+ /** returnType에 따른 폼 값 */
248
+ var formValue = (0, react_1.useMemo)(function () {
249
+ if (!baseCurrencyValue || baseCurrencyValue === '') {
250
+ return '';
251
+ }
252
+ switch (returnType) {
253
+ case 'string':
254
+ return formattedValue;
255
+ case 'rawValue':
256
+ return baseCurrencyValue;
257
+ case 'object':
258
+ default:
259
+ return formattedValue;
260
+ }
261
+ }, [baseCurrencyValue, formattedValue, returnType]);
262
+ /** 폼 값 업데이트 */
263
+ (0, react_1.useEffect)(function () {
264
+ setValue(name, formValue);
265
+ }, [name, setValue, formValue]);
266
+ /** onChange 콜백 처리 */
267
+ (0, react_1.useEffect)(function () {
268
+ if (!onChange)
269
+ return;
270
+ if (!baseCurrencyValue || baseCurrencyValue === '') {
271
+ onChange('');
272
+ return;
273
+ }
274
+ var callbackValue = returnType === 'object' ? formattedValue : formValue;
275
+ onChange(callbackValue);
276
+ }, [onChange, baseCurrencyValue, formattedValue, formValue, returnType]);
277
+ /** onValueChange 콜백 처리 */
278
+ (0, react_1.useEffect)(function () {
279
+ if (!onValueChange)
280
+ return;
281
+ if (!baseCurrencyValue || baseCurrencyValue === '') {
282
+ return;
283
+ }
284
+ onValueChange({
285
+ selectedCurrency: selectedCurrency,
286
+ baseCurrencyValue: Number(baseCurrencyValue),
287
+ calculatedValue: calculatedValue || 0,
288
+ displayValue: formattedValue
289
+ });
290
+ }, [baseCurrencyValue, selectedCurrency, calculatedValue, formattedValue]);
291
+ /** 입력 시 천 단위 콤마 추가 함수 */
292
+ var addCommas = function (value) {
293
+ if (!value)
294
+ return '';
295
+ var parts = value.split('.');
296
+ var integerPart = parts[0];
297
+ var decimalPart = parts[1];
298
+ // 정수 부분에 콤마 추가
299
+ var formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
300
+ // 소수점이 있으면 합치기
301
+ return decimalPart !== undefined ? "".concat(formattedInteger, ".").concat(decimalPart) : formattedInteger;
302
+ };
303
+ var handleChange = function (e) {
304
+ var _a = e.target, value = _a.value, selectionStart = _a.selectionStart;
305
+ var prevValue = displayValue;
306
+ if (selectedCurrency !== baseCurrency) {
307
+ return;
308
+ }
309
+ var cleanValue = removeCommas(value);
310
+ if (cleanValue === '' || /^\d*\.?\d*$/.test(cleanValue)) {
311
+ setBaseCurrencyValue(cleanValue);
312
+ validateOnChange(__assign(__assign({}, e), { target: __assign(__assign({}, e.target), { value: cleanValue }) }));
313
+ setTimeout(function () {
314
+ var input = e.target;
315
+ if (input && selectionStart !== null) {
316
+ var currentValue = input.value;
317
+ var commaCount = (currentValue.match(/,/g) || []).length;
318
+ var prevCommaCount = (prevValue.match(/,/g) || []).length;
319
+ var newPosition = selectionStart + (commaCount - prevCommaCount);
320
+ input.setSelectionRange(newPosition, newPosition);
321
+ }
322
+ }, 0);
323
+ }
324
+ };
325
+ var handleBlur = function (e) {
326
+ setIsInputFocused(false);
327
+ if (selectedCurrency === baseCurrency && baseCurrencyValue) {
328
+ var allowedDecimals = decimalPlaces[selectedCurrency];
329
+ var numericValue = Number(baseCurrencyValue);
330
+ if (isNaN(numericValue)) {
331
+ setBaseCurrencyValue('');
332
+ return;
333
+ }
334
+ var decimalCheckedValue = void 0;
335
+ if (allowedDecimals === 0) {
336
+ decimalCheckedValue = Math.round(Number(baseCurrencyValue)).toString();
337
+ }
338
+ else {
339
+ decimalCheckedValue = numericValue.toFixed(allowedDecimals);
340
+ }
341
+ setBaseCurrencyValue(decimalCheckedValue);
342
+ setValue(name, decimalCheckedValue, { shouldValidate: true });
343
+ }
344
+ if (onBlur) {
345
+ onBlur(e);
346
+ }
347
+ trigger(name);
348
+ };
349
+ var handleFocus = function (e) {
350
+ if (state !== 'read_only' && !isInputReadOnly) {
351
+ setIsInputFocused(true);
352
+ }
353
+ if (onFocus) {
354
+ onFocus(e);
355
+ }
356
+ };
357
+ function handleTarget() {
358
+ if (onTarget) {
359
+ onTarget();
360
+ }
361
+ }
362
+ var getArrowIconColorKey = function () {
363
+ if (colorTheme === 'dark') {
364
+ if (dropdownState === 'disabled' || dropdownState === 'read_only') {
365
+ return 'ui_cpnt_dropdown_text_darktheme_disabled';
366
+ }
367
+ return 'ui_cpnt_dropdown_icon_darktheme_default';
368
+ }
369
+ if (colorTheme === 'transparent') {
370
+ if (dropdownState === 'disabled' || dropdownState === 'read_only') {
371
+ return 'ui_cpnt_dropdown_icon_02';
372
+ }
373
+ return 'ui_cpnt_dropdown_icon_white_default';
374
+ }
375
+ if (dropdownState === 'disabled' || dropdownState === 'read_only') {
376
+ return 'ui_cpnt_dropdown_icon_02';
377
+ }
378
+ return 'ui_cpnt_dropdown_icon_01';
379
+ };
380
+ var getDropdownContextMenuCustomWidth = function () {
381
+ var _a;
382
+ if (customWidth) {
383
+ return customWidth;
384
+ }
385
+ if ((_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) {
386
+ return "".concat(dropdownRef.current.offsetWidth, "px");
387
+ }
388
+ return '';
389
+ };
390
+ var handleDropdownClick = function () {
391
+ if (dropdownState === 'disabled' || dropdownState === 'read_only') {
392
+ return;
393
+ }
394
+ setIsDropdownFocused(!isDropdownFocused);
395
+ };
396
+ var handleDropdownBlur = function () {
397
+ if (isDropdownFocused) {
398
+ setIsDropdownFocused(false);
399
+ }
400
+ setIsInputFocused(false);
401
+ };
402
+ var handleCurrencySelect = function (option) {
403
+ setIsDropdownFocused(false);
404
+ var newCurrency = option.currency;
405
+ // 통화 변경 시에는 baseCurrencyValue는 그대로 유지하고 selectedCurrency만 변경
406
+ setSelectedCurrency(newCurrency);
407
+ if (onCurrencyChange) {
408
+ onCurrencyChange(newCurrency);
409
+ }
410
+ };
411
+ var handleDelete = (0, react_1.useCallback)(function () {
412
+ setBaseCurrencyValue('');
413
+ setDisplayValue('');
414
+ setValue(name, '');
415
+ }, [name, setValue]);
416
+ return ((0, jsx_runtime_1.jsxs)(S_PriceTextField, __assign({ "x-pds-name": "PriceTextField", "x-pds-element-type": "component", "x-pds-device-type": "desktop", inputSize: size, responsiveMode: responsiveMode, customWidth: customWidth }, { children: [(0, jsx_runtime_1.jsxs)(S_ComponentBox, __assign({ inputSize: size, responsiveMode: responsiveMode, isFocused: isInputFocused, isError: Boolean(isError), state: state, customWidth: customWidth, isInputReadOnly: isInputReadOnly }, { children: [(0, jsx_runtime_1.jsx)(S_TextFieldBaseWrapper, __assign({ state: state, isError: Boolean(isError), isFocused: isInputFocused, inputSize: size, isInputReadOnly: isInputReadOnly }, { children: (0, jsx_runtime_1.jsx)(components_1.TextFieldBase, { name: name, hintText: hintText ||
417
+ t('str_channel_min_price', {
418
+ channelMinPrice: pricing_1.PricingService.format.price({
419
+ amount: minPriceAmount || (baseCurrency === pricing_1.CurrencyCode.KRW ? 300 : 5),
420
+ currency: baseCurrency
421
+ })
422
+ }), value: displayValue, textAlign: textAlign, validation: finalValidation, textLineType: "single", inputType: "text", inputMode: "decimal", preventBlankMode: "all", enterSubmitMode: "none", state: isInputReadOnly ? 'read_only' : state, colorTheme: colorTheme, textSize: "form2", textWeight: fontWeight === 'bold' ? 'bold' : 'normal', hintTextWeight: hintTextFontWeight === 'bold' ? 'bold' : 'normal', fieldPaddingRight: size === 'large' || size === 'rlarge' ? 12 : undefined, deleteIconMode: deleteBtnMode, deleteIconSize: size === 'large' || size === 'rlarge' ? 20 : 16, deleteIconColor: deleteIconColor, isFocused: isInputFocused, suffixTextRightSpacingMode: size === 'large' || size === 'rlarge' ? 'use' : 'none', onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onTarget: handleTarget, onDelete: handleDelete }) })), (0, jsx_runtime_1.jsx)(S_DropdownWrapper, __assign({ ref: dropdownRef, inputSize: size, onClick: handleDropdownClick, onBlur: handleDropdownBlur, tabIndex: 0, isFocused: isDropdownFocused, state: dropdownState, isError: Boolean(isError) }, { children: (0, jsx_runtime_1.jsxs)(S_Select, __assign({ inputSize: size }, { children: [selectedCurrency === baseCurrency && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(S_Badge, {}), (0, jsx_runtime_1.jsx)(hybrid_1.Spacing, { size: "spacing_a", spacingType: "width" })] })), (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: selectedCurrency, styleTheme: "form2Regular", singleLineMode: "use", colorTheme: "sysTextPrimary", ellipsisMode: "use", lineLimit: 1 }), (0, jsx_runtime_1.jsx)(hybrid_1.Spacing, { size: "spacing_a", spacingType: "width" }), (0, jsx_runtime_1.jsx)(hybrid_1.Icon, { size: 16, fillType: "line", iconName: isDropdownFocused ? 'ic_arrow_up' : 'ic_arrow_down', colorKey: getArrowIconColorKey() })] })) }))] })), isDropdownFocused &&
423
+ (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(S_ContextMenuWrapper, __assign({ ref: contextMenuRef, contextMenuPositionCss: contextMenuPositionCss }, { children: (0, jsx_runtime_1.jsx)(ContextMenu_1.ContextMenu, __assign({ autoWidthMode: "use", customWidth: getDropdownContextMenuCustomWidth() }, { children: currencyOptions.map(function (el) { return ((0, jsx_runtime_1.jsx)("div", __assign({ onMouseDown: function () { return handleCurrencySelect(el); } }, { children: (0, jsx_runtime_1.jsx)(ContextMenuItem_1.ContextMenuItem, { option: el, size: "large", isSelected: selectedCurrency === el.currency, state: el.state, displayType: "text_only" }) }), el.value)); }) })) })), document.body), ((_c = (0, types_1.getErrorByName)(errors, name)) === null || _c === void 0 ? void 0 : _c.message) && state === 'normal' && ((0, jsx_runtime_1.jsx)(S_Error, { children: (0, types_1.getErrorByName)(errors, name).message }))] })));
424
+ }
425
+ var S_PriceTextField = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n ", ";\n ", "\n"], ["\n ", ";\n ", ";\n ", "\n"])), function (_a) {
426
+ var inputSize = _a.inputSize;
427
+ return inputSize &&
428
+ {
429
+ small: 'width: 188px;',
430
+ medium: 'width: 188px;',
431
+ large: 'width: 432px;',
432
+ rlarge: 'width: 100%'
433
+ }[inputSize];
434
+ }, function (_a) {
435
+ var responsiveMode = _a.responsiveMode;
436
+ return responsiveMode === 'use' && 'width: 100%';
437
+ }, function (_a) {
438
+ var customWidth = _a.customWidth;
439
+ return customWidth && "width: ".concat(customWidth, ";");
440
+ });
441
+ var small = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 10px;\n height: 32px;\n width: 188px;\n"], ["\n border-radius: 10px;\n height: 32px;\n width: 188px;\n"])));
442
+ var medium = (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border-radius: 12px;\n height: 40px;\n width: 188px;\n"], ["\n border-radius: 12px;\n height: 40px;\n width: 188px;\n"])));
443
+ var large = (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border-radius: 14px;\n height: 48px;\n width: ", ";\n"], ["\n border-radius: 14px;\n height: 48px;\n width: ", ";\n"])), function (_a) {
444
+ var inputSize = _a.inputSize;
445
+ return (inputSize === 'rlarge' ? '100%' : '432px');
446
+ });
447
+ var normalActionColor = (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n"], ["\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n"])), function (_a) {
448
+ var theme = _a.theme;
449
+ return theme.ui_cpnt_textfield_base_hover;
450
+ }, function (_a) {
451
+ var theme = _a.theme;
452
+ return theme.ui_cpnt_textfield_base_pressed;
453
+ });
454
+ var S_Select = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n justify-content: space-between;\n width: 100%;\n"], ["\n align-items: center;\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
455
+ var S_ContextMenuWrapper = styled_components_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: block;\n position: absolute;\n ", ";\n"], ["\n display: block;\n position: absolute;\n ", ";\n"])), function (_a) {
456
+ var contextMenuPositionCss = _a.contextMenuPositionCss;
457
+ return contextMenuPositionCss;
458
+ });
459
+ var S_Error = styled_components_1.default.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-top: ", ";\n text-align: left;\n white-space: pre-wrap;\n"], ["\n color: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-top: ", ";\n text-align: left;\n white-space: pre-wrap;\n"])), function (_a) {
460
+ var theme = _a.theme;
461
+ return theme.ui_cpnt_textfield_text_error;
462
+ }, function (_a) {
463
+ var theme = _a.theme;
464
+ return theme.desktopFontSize.caption2;
465
+ }, function (_a) {
466
+ var theme = _a.theme;
467
+ return theme.fontWeight.normal;
468
+ }, function (_a) {
469
+ var theme = _a.theme;
470
+ return theme.desktopLineHeight.caption2;
471
+ }, function (_a) {
472
+ var theme = _a.theme;
473
+ return theme.spacing.spacingA;
474
+ });
475
+ var S_Badge = styled_components_1.default.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 8px;\n height: 6px;\n left: 0;\n width: 6px;\n"], ["\n background-color: ", ";\n border-radius: 8px;\n height: 6px;\n left: 0;\n width: 6px;\n"])), function (_a) {
476
+ var theme = _a.theme;
477
+ return theme.ui_69;
478
+ });
479
+ var S_ComponentBox = styled_components_1.default.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n align-items: center;\n border: solid 2px\n ", ";\n box-sizing: border-box;\n cursor: ", ";\n ", ";\n\n display: flex;\n\n ", "\n\n ", "\n ", ";\n ", "\n"], ["\n align-items: center;\n border: solid 2px\n ", ";\n box-sizing: border-box;\n cursor: ", ";\n ", ";\n\n display: flex;\n\n ", "\n\n ", "\n ", ";\n ", "\n"])), function (_a) {
480
+ var theme = _a.theme, isError = _a.isError, isFocused = _a.isFocused, state = _a.state;
481
+ if (state === 'disabled' || state === 'read_only') {
482
+ return theme.ui_cpnt_textfield_border_disabled;
483
+ }
484
+ if (isError) {
485
+ return theme.ui_cpnt_textfield_border_error;
486
+ }
487
+ if (isFocused) {
488
+ return theme.ui_cpnt_textfield_border_focus;
489
+ }
490
+ return theme.ui_cpnt_textfield_border_normal;
491
+ }, function (_a) {
492
+ var state = _a.state, isInputReadOnly = _a.isInputReadOnly;
493
+ if (state === 'disabled')
494
+ return 'not-allowed';
495
+ if (isInputReadOnly)
496
+ return 'default';
497
+ return 'text';
498
+ }, function (_a) {
499
+ var inputSize = _a.inputSize;
500
+ return inputSize &&
501
+ {
502
+ small: small,
503
+ medium: medium,
504
+ large: large,
505
+ rlarge: large
506
+ }[inputSize];
507
+ }, transitionStyle_1.InputTransition, function (_a) {
508
+ var state = _a.state;
509
+ return state === 'normal' && normalActionColor;
510
+ }, function (_a) {
511
+ var responsiveMode = _a.responsiveMode;
512
+ return responsiveMode === 'use' && 'width: 100%';
513
+ }, function (_a) {
514
+ var customWidth = _a.customWidth;
515
+ return customWidth && "width: ".concat(customWidth, ";");
516
+ });
517
+ var S_TextFieldBaseWrapper = styled_components_1.default.div(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n display: flex;\n flex: 1;\n height: 100%;\n\n min-width: 0;\n\n padding-left: ", ";\n\n ", "\n"], ["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n display: flex;\n flex: 1;\n height: 100%;\n\n min-width: 0;\n\n padding-left: ", ";\n\n ", "\n"])), function (_a) {
518
+ var theme = _a.theme, state = _a.state, isInputReadOnly = _a.isInputReadOnly;
519
+ if (isInputReadOnly || state === 'disabled' || state === 'read_only') {
520
+ return theme.ui_cpnt_textfield_base_disabled;
521
+ }
522
+ return theme.ui_cpnt_textfield_base_normal;
523
+ }, function (_a) {
524
+ var inputSize = _a.inputSize;
525
+ switch (inputSize) {
526
+ case 'small':
527
+ return '8px 0 0 8px';
528
+ case 'medium':
529
+ return '10px 0 0 10px';
530
+ case 'large':
531
+ case 'rlarge':
532
+ return '12px 0 0 12px';
533
+ default:
534
+ return '12px 0 0 12px';
535
+ }
536
+ }, function (_a) {
537
+ var theme = _a.theme;
538
+ return theme.spacing.spacingD;
539
+ }, function (_a) {
540
+ var state = _a.state, theme = _a.theme;
541
+ return state === 'normal' && (0, styled_components_1.css)(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n "], ["\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n "])), theme.ui_cpnt_textfield_base_hover, theme.ui_cpnt_textfield_base_pressed);
542
+ });
543
+ var S_DropdownWrapper = styled_components_1.default.div(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n\n cursor: ", ";\n\n display: flex;\n height: 100%;\n min-width: 50px;\n outline: none;\n\n padding: 0 ", ";\n\n ", "\n"], ["\n align-items: center;\n background-color: ", ";\n border-radius: ", ";\n\n cursor: ", ";\n\n display: flex;\n height: 100%;\n min-width: 50px;\n outline: none;\n\n padding: 0 ", ";\n\n ", "\n"])), function (_a) {
544
+ var theme = _a.theme, state = _a.state;
545
+ if (state === 'disabled' || state === 'read_only') {
546
+ return theme.ui_cpnt_textfield_base_disabled;
547
+ }
548
+ return theme.ui_cpnt_textfield_base_normal;
549
+ }, function (_a) {
550
+ var inputSize = _a.inputSize;
551
+ switch (inputSize) {
552
+ case 'small':
553
+ return '0 8px 8px 0';
554
+ case 'medium':
555
+ return '0 10px 10px 0';
556
+ case 'large':
557
+ case 'rlarge':
558
+ return '0 12px 12px 0';
559
+ default:
560
+ return '0 12px 12px 0';
561
+ }
562
+ }, function (_a) {
563
+ var state = _a.state;
564
+ switch (state) {
565
+ case 'disabled':
566
+ return 'not-allowed';
567
+ case 'read_only':
568
+ return 'auto';
569
+ case 'normal':
570
+ return 'pointer';
571
+ }
572
+ }, function (_a) {
573
+ var theme = _a.theme;
574
+ return theme.spacing.spacingD;
575
+ }, function (_a) {
576
+ var state = _a.state, theme = _a.theme;
577
+ return state === 'normal' && (0, styled_components_1.css)(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n "], ["\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n "])), theme.ui_cpnt_textfield_base_hover, theme.ui_cpnt_textfield_base_pressed);
578
+ });
579
+ exports.default = PriceTextField;
580
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14;
@@ -0,0 +1 @@
1
+ export { default as PriceTextField } from './PriceTextField';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PriceTextField = void 0;
7
+ var PriceTextField_1 = require("./PriceTextField");
8
+ Object.defineProperty(exports, "PriceTextField", { enumerable: true, get: function () { return __importDefault(PriceTextField_1).default; } });
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { CurrencyCode, ExchangeRateMap, Price, TranslationType } from '../../../core/pricing';
3
+ import type { TextLabelProps } from '../TextLabel/TextLabel';
4
+ type PriceTextLabelProps = Omit<TextLabelProps, 'text' | 'ellipsisMode' | 'lineLimit' | 'userSelectMode' | 'requirementMode' | 'bulletPointMode' | 'wordBreak'> & {
5
+ price: Price;
6
+ useFriendlyName?: 'none' | 'use';
7
+ useMinus?: 'none' | 'use';
8
+ translate?: TranslationType;
9
+ };
10
+ declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode, translate, ...args }: PriceTextLabelProps & {
11
+ selectedCurrency?: CurrencyCode;
12
+ exchangeRates?: ExchangeRateMap;
13
+ userCountryCode?: string;
14
+ }): JSX.Element;
15
+ export default PriceTextLabel;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ var jsx_runtime_1 = require("react/jsx-runtime");
26
+ var pricing_1 = require("../../../core/pricing");
27
+ var TextLabel_1 = require("../TextLabel");
28
+ 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, translate = _a.translate, args = __rest(_a, ["price", "useFriendlyName", "useMinus", "selectedCurrency", "exchangeRates", "userCountryCode", "translate"]);
30
+ var targetPrice = price;
31
+ var formattedAmount = useMinus === 'use' ? "-".concat(targetPrice.amount) : targetPrice.amount;
32
+ var priceText = pricing_1.PricingService.translate.priceWithCurrency(exchangeRates && selectedCurrency
33
+ ? pricing_1.PricingService.convertToPreferredPrice({ amount: formattedAmount, currency: price.currency }, selectedCurrency, exchangeRates)
34
+ : {
35
+ amount: formattedAmount,
36
+ currency: userCountryCode
37
+ ? pricing_1.PricingService.getDefaultPreferredCurrency(userCountryCode.toLocaleLowerCase())
38
+ : price.currency
39
+ }, {
40
+ friendly: useFriendlyName === 'use' ? true : false,
41
+ translate: translate
42
+ });
43
+ return (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, __assign({}, args, { text: priceText }));
44
+ }
45
+ exports.default = PriceTextLabel;
@@ -0,0 +1 @@
1
+ export { default as PriceTextLabel } from './PriceTextLabel';