pds-dev-kit-web 2.2.200 → 2.2.202

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.
@@ -14,7 +14,7 @@ type Props = {
14
14
  size?: 'large' | 'rlarge';
15
15
  responsiveMode?: 'none' | 'use';
16
16
  state?: 'normal' | 'read_only' | 'disabled';
17
- dropdownState?: 'normal' | 'read_only' | 'disabled';
17
+ dropdownState?: 'normal' | 'read_only';
18
18
  customWidth?: string;
19
19
  baseCurrency?: CurrencyCode;
20
20
  currencies?: CurrencyCode[];
@@ -23,6 +23,7 @@ type Props = {
23
23
  hintTextFontWeight?: 'normal' | 'bold';
24
24
  validation?: any;
25
25
  useRequiredValidation?: 'none' | 'use';
26
+ useDotBadge?: 'none' | 'use';
26
27
  returnType?: 'object' | 'string' | 'rawValue';
27
28
  deleteBtnMode?: 'none' | 'use';
28
29
  minPriceAmount?: string | number;
@@ -38,5 +39,5 @@ type Props = {
38
39
  displayValue: string;
39
40
  }) => void;
40
41
  } & Omit<Partial<TextFieldBaseProps>, 'textAlign' | 'preventBlankMode' | 'enterSubmitMode' | 'multiRows' | 'colorTheme'>;
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;
42
+ declare function PriceTextField({ name, hintText, defaultAmount, colorTheme, size, fontWeight, hintTextFontWeight, responsiveMode, state, dropdownState, customWidth, baseCurrency, currencies, decimalPlaces, exchangeRates, textAlign, validation, useRequiredValidation, useDotBadge, returnType, deleteBtnMode, minPriceAmount, onChange, onExChange, onBlur, onFocus, onTarget, onCurrencyChange, onValueChange }: Props): JSX.Element;
42
43
  export default PriceTextField;
@@ -65,18 +65,18 @@ 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, onExChange = _a.onExChange, 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.useDotBadge, useDotBadge = _s === void 0 ? 'use' : _s, _t = _a.returnType, returnType = _t === void 0 ? 'object' : _t, _u = _a.deleteBtnMode, deleteBtnMode = _u === void 0 ? 'use' : _u, 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
- 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];
70
+ var _v = (0, react_1.useState)(defaultAmount ? String(defaultAmount) : ''), baseCurrencyValue = _v[0], setBaseCurrencyValue = _v[1];
71
+ var _w = (0, react_1.useState)(''), displayValue = _w[0], setDisplayValue = _w[1];
72
+ var _x = (0, react_1.useState)(baseCurrency), selectedCurrency = _x[0], setSelectedCurrency = _x[1];
73
+ var _y = (0, react_1.useState)(false), isDropdownFocused = _y[0], setIsDropdownFocused = _y[1];
74
+ var _z = (0, react_1.useState)(false), isInputFocused = _z[0], setIsInputFocused = _z[1];
75
+ var _0 = (0, react_1.useState)(null), contextMenuSizeOffset = _0[0], setContextMenuSizeOffset = _0[1];
76
+ var _1 = (0, react_1.useState)(null), dropdownPositionOffset = _1[0], setDropdownPositionOffset = _1[1];
77
77
  var contextMenuRef = (0, react_1.useRef)(null);
78
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;
79
+ var _2 = (0, react_hook_form_1.useFormContext)(), register = _2.register, trigger = _2.trigger, errors = _2.formState.errors, setValue = _2.setValue;
80
80
  /** 기본 validation */
81
81
  var defaultValidation = (0, react_1.useMemo)(function () {
82
82
  var validationConfig = {};
@@ -310,16 +310,18 @@ function PriceTextField(_a) {
310
310
  if (cleanValue === '' || /^\d*\.?\d*$/.test(cleanValue)) {
311
311
  setBaseCurrencyValue(cleanValue);
312
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);
313
+ if (prevValue && prevValue !== '' && value !== cleanValue) {
314
+ setTimeout(function () {
315
+ var input = e.target;
316
+ if (input && selectionStart !== null) {
317
+ var currentValue = input.value;
318
+ var commaCount = (currentValue.match(/,/g) || []).length;
319
+ var prevCommaCount = (prevValue.match(/,/g) || []).length;
320
+ var newPosition = selectionStart + (commaCount - prevCommaCount);
321
+ input.setSelectionRange(newPosition, newPosition);
322
+ }
323
+ }, 0);
324
+ }
323
325
  }
324
326
  if (onExChange) {
325
327
  onExChange(e);
@@ -364,22 +366,40 @@ function PriceTextField(_a) {
364
366
  }
365
367
  var getArrowIconColorKey = function () {
366
368
  if (colorTheme === 'dark') {
367
- if (dropdownState === 'disabled' || dropdownState === 'read_only') {
369
+ if (dropdownState === 'read_only') {
368
370
  return 'ui_cpnt_dropdown_text_darktheme_disabled';
369
371
  }
370
372
  return 'ui_cpnt_dropdown_icon_darktheme_default';
371
373
  }
372
374
  if (colorTheme === 'transparent') {
373
- if (dropdownState === 'disabled' || dropdownState === 'read_only') {
375
+ if (dropdownState === 'read_only') {
374
376
  return 'ui_cpnt_dropdown_icon_02';
375
377
  }
376
378
  return 'ui_cpnt_dropdown_icon_white_default';
377
379
  }
378
- if (dropdownState === 'disabled' || dropdownState === 'read_only') {
380
+ if (dropdownState === 'read_only') {
379
381
  return 'ui_cpnt_dropdown_icon_02';
380
382
  }
381
383
  return 'ui_cpnt_dropdown_icon_01';
382
384
  };
385
+ var getDropdownTextColorKey = function () {
386
+ if (colorTheme === 'dark') {
387
+ if (dropdownState === 'read_only') {
388
+ return 'ui_cpnt_button_text_darktheme_default';
389
+ }
390
+ return 'ui_cpnt_button_text_darktheme_enabled';
391
+ }
392
+ if (colorTheme === 'transparent') {
393
+ if (dropdownState === 'read_only') {
394
+ return 'ui_cpnt_button_text_disabled';
395
+ }
396
+ return 'ui_cpnt_button_text_enabled';
397
+ }
398
+ if (dropdownState === 'read_only') {
399
+ return 'ui_cpnt_button_text_disabled';
400
+ }
401
+ return 'ui_cpnt_button_text_enabled';
402
+ };
383
403
  var getDropdownContextMenuCustomWidth = function () {
384
404
  var _a;
385
405
  if (customWidth) {
@@ -391,7 +411,7 @@ function PriceTextField(_a) {
391
411
  return '';
392
412
  };
393
413
  var handleDropdownClick = function () {
394
- if (dropdownState === 'disabled' || dropdownState === 'read_only') {
414
+ if (dropdownState === 'read_only') {
395
415
  return;
396
416
  }
397
417
  setIsDropdownFocused(!isDropdownFocused);
@@ -422,7 +442,7 @@ function PriceTextField(_a) {
422
442
  amount: minPriceAmount || (baseCurrency === pricing_1.CurrencyCode.KRW ? 300 : 5),
423
443
  currency: baseCurrency
424
444
  })
425
- }), 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 &&
445
+ }), 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: [useDotBadge === 'use' && 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: "form2Bold", singleLineMode: "use", colorTheme: "sysTextPrimary", ellipsisMode: "use", customFontWeight: "bold", colorOverride: getDropdownTextColorKey(), 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 &&
426
446
  (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 }))] })));
427
447
  }
428
448
  var S_PriceTextField = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n ", ";\n ", "\n"], ["\n ", ";\n ", ";\n ", "\n"])), function (_a) {
@@ -14,7 +14,7 @@ type Props = {
14
14
  size?: 'large' | 'rlarge';
15
15
  responsiveMode?: 'none' | 'use';
16
16
  state?: 'normal' | 'read_only' | 'disabled';
17
- dropdownState?: 'normal' | 'read_only' | 'disabled';
17
+ dropdownState?: 'normal' | 'read_only';
18
18
  customWidth?: string;
19
19
  baseCurrency?: CurrencyCode;
20
20
  currencies?: CurrencyCode[];
@@ -23,6 +23,7 @@ type Props = {
23
23
  hintTextFontWeight?: 'normal' | 'bold';
24
24
  validation?: any;
25
25
  useRequiredValidation?: 'none' | 'use';
26
+ useDotBadge?: 'none' | 'use';
26
27
  returnType?: 'object' | 'string' | 'rawValue';
27
28
  deleteBtnMode?: 'none' | 'use';
28
29
  minPriceAmount?: string | number;
@@ -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, useDotBadge, returnType, deleteBtnMode, minPriceAmount, onChange, onBlur, onFocus, onTarget, onCurrencyChange, onValueChange }: Props): JSX.Element;
41
42
  export default PriceTextField;
@@ -65,18 +65,18 @@ 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.useDotBadge, useDotBadge = _s === void 0 ? 'use' : _s, _t = _a.returnType, returnType = _t === void 0 ? 'object' : _t, _u = _a.deleteBtnMode, deleteBtnMode = _u === void 0 ? 'use' : _u, minPriceAmount = _a.minPriceAmount, onChange = _a.onChange, 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
- 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];
70
+ var _v = (0, react_1.useState)(defaultAmount ? String(defaultAmount) : ''), baseCurrencyValue = _v[0], setBaseCurrencyValue = _v[1];
71
+ var _w = (0, react_1.useState)(''), displayValue = _w[0], setDisplayValue = _w[1];
72
+ var _x = (0, react_1.useState)(baseCurrency), selectedCurrency = _x[0], setSelectedCurrency = _x[1];
73
+ var _y = (0, react_1.useState)(false), isDropdownFocused = _y[0], setIsDropdownFocused = _y[1];
74
+ var _z = (0, react_1.useState)(false), isInputFocused = _z[0], setIsInputFocused = _z[1];
75
+ var _0 = (0, react_1.useState)(null), contextMenuSizeOffset = _0[0], setContextMenuSizeOffset = _0[1];
76
+ var _1 = (0, react_1.useState)(null), dropdownPositionOffset = _1[0], setDropdownPositionOffset = _1[1];
77
77
  var contextMenuRef = (0, react_1.useRef)(null);
78
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;
79
+ var _2 = (0, react_hook_form_1.useFormContext)(), register = _2.register, trigger = _2.trigger, errors = _2.formState.errors, setValue = _2.setValue;
80
80
  /** 기본 validation */
81
81
  var defaultValidation = (0, react_1.useMemo)(function () {
82
82
  var validationConfig = {};
@@ -310,16 +310,18 @@ function PriceTextField(_a) {
310
310
  if (cleanValue === '' || /^\d*\.?\d*$/.test(cleanValue)) {
311
311
  setBaseCurrencyValue(cleanValue);
312
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);
313
+ if (prevValue && prevValue !== '' && value !== cleanValue) {
314
+ setTimeout(function () {
315
+ var input = e.target;
316
+ if (input && selectionStart !== null) {
317
+ var currentValue = input.value;
318
+ var commaCount = (currentValue.match(/,/g) || []).length;
319
+ var prevCommaCount = (prevValue.match(/,/g) || []).length;
320
+ var newPosition = selectionStart + (commaCount - prevCommaCount);
321
+ input.setSelectionRange(newPosition, newPosition);
322
+ }
323
+ }, 0);
324
+ }
323
325
  }
324
326
  };
325
327
  var handleBlur = function (e) {
@@ -361,22 +363,40 @@ function PriceTextField(_a) {
361
363
  }
362
364
  var getArrowIconColorKey = function () {
363
365
  if (colorTheme === 'dark') {
364
- if (dropdownState === 'disabled' || dropdownState === 'read_only') {
366
+ if (dropdownState === 'read_only') {
365
367
  return 'ui_cpnt_dropdown_text_darktheme_disabled';
366
368
  }
367
369
  return 'ui_cpnt_dropdown_icon_darktheme_default';
368
370
  }
369
371
  if (colorTheme === 'transparent') {
370
- if (dropdownState === 'disabled' || dropdownState === 'read_only') {
372
+ if (dropdownState === 'read_only') {
371
373
  return 'ui_cpnt_dropdown_icon_02';
372
374
  }
373
375
  return 'ui_cpnt_dropdown_icon_white_default';
374
376
  }
375
- if (dropdownState === 'disabled' || dropdownState === 'read_only') {
377
+ if (dropdownState === 'read_only') {
376
378
  return 'ui_cpnt_dropdown_icon_02';
377
379
  }
378
380
  return 'ui_cpnt_dropdown_icon_01';
379
381
  };
382
+ var getDropdownTextColorKey = function () {
383
+ if (colorTheme === 'dark') {
384
+ if (dropdownState === 'read_only') {
385
+ return 'ui_cpnt_button_text_darktheme_default';
386
+ }
387
+ return 'ui_cpnt_button_text_darktheme_enabled';
388
+ }
389
+ if (colorTheme === 'transparent') {
390
+ if (dropdownState === 'read_only') {
391
+ return 'ui_cpnt_button_text_disabled';
392
+ }
393
+ return 'ui_cpnt_button_text_enabled';
394
+ }
395
+ if (dropdownState === 'read_only') {
396
+ return 'ui_cpnt_button_text_disabled';
397
+ }
398
+ return 'ui_cpnt_button_text_enabled';
399
+ };
380
400
  var getDropdownContextMenuCustomWidth = function () {
381
401
  var _a;
382
402
  if (customWidth) {
@@ -388,7 +408,7 @@ function PriceTextField(_a) {
388
408
  return '';
389
409
  };
390
410
  var handleDropdownClick = function () {
391
- if (dropdownState === 'disabled' || dropdownState === 'read_only') {
411
+ if (dropdownState === 'read_only') {
392
412
  return;
393
413
  }
394
414
  setIsDropdownFocused(!isDropdownFocused);
@@ -419,7 +439,7 @@ function PriceTextField(_a) {
419
439
  amount: minPriceAmount || (baseCurrency === pricing_1.CurrencyCode.KRW ? 300 : 5),
420
440
  currency: baseCurrency
421
441
  })
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 &&
442
+ }), 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: [useDotBadge === 'use' && 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: "form2Bold", singleLineMode: "use", colorTheme: "sysTextPrimary", ellipsisMode: "use", customFontWeight: "bold", colorOverride: getDropdownTextColorKey(), 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
443
  (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
444
  }
425
445
  var S_PriceTextField = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n ", ";\n ", "\n"], ["\n ", ";\n ", ";\n ", "\n"])), function (_a) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web",
3
- "version": "2.2.200",
3
+ "version": "2.2.202",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
package/release-note.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PDS-DEV-KIT-WEB Release Notes
2
- ## [v2.2.200]
2
+ ## [v2.2.202]
3
3
  ## daily|https://design.storybook.publ.biz/
4
4
 
5
5
  ### 업데이트 사항
6
- * [PDS-1334] 스크롤 유무에 따라 레이아웃 밀림 이슈 해결
6
+ * PriceTextField cursor position 수정