pds-dev-kit-web 2.2.200 → 2.2.201
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/desktop/components/PriceTextField/PriceTextField.d.ts +3 -2
- package/dist/src/desktop/components/PriceTextField/PriceTextField.js +32 -14
- package/dist/src/mobile/components/PriceTextField/PriceTextField.d.ts +3 -2
- package/dist/src/mobile/components/PriceTextField/PriceTextField.js +32 -14
- package/package.json +1 -1
- package/release-note.md +3 -2
|
@@ -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'
|
|
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.
|
|
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
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
var
|
|
75
|
-
var
|
|
76
|
-
var
|
|
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
|
|
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 = {};
|
|
@@ -364,22 +364,40 @@ function PriceTextField(_a) {
|
|
|
364
364
|
}
|
|
365
365
|
var getArrowIconColorKey = function () {
|
|
366
366
|
if (colorTheme === 'dark') {
|
|
367
|
-
if (dropdownState === '
|
|
367
|
+
if (dropdownState === 'read_only') {
|
|
368
368
|
return 'ui_cpnt_dropdown_text_darktheme_disabled';
|
|
369
369
|
}
|
|
370
370
|
return 'ui_cpnt_dropdown_icon_darktheme_default';
|
|
371
371
|
}
|
|
372
372
|
if (colorTheme === 'transparent') {
|
|
373
|
-
if (dropdownState === '
|
|
373
|
+
if (dropdownState === 'read_only') {
|
|
374
374
|
return 'ui_cpnt_dropdown_icon_02';
|
|
375
375
|
}
|
|
376
376
|
return 'ui_cpnt_dropdown_icon_white_default';
|
|
377
377
|
}
|
|
378
|
-
if (dropdownState === '
|
|
378
|
+
if (dropdownState === 'read_only') {
|
|
379
379
|
return 'ui_cpnt_dropdown_icon_02';
|
|
380
380
|
}
|
|
381
381
|
return 'ui_cpnt_dropdown_icon_01';
|
|
382
382
|
};
|
|
383
|
+
var getDropdownTextColorKey = function () {
|
|
384
|
+
if (colorTheme === 'dark') {
|
|
385
|
+
if (dropdownState === 'read_only') {
|
|
386
|
+
return 'ui_cpnt_button_text_darktheme_default';
|
|
387
|
+
}
|
|
388
|
+
return 'ui_cpnt_button_text_darktheme_enabled';
|
|
389
|
+
}
|
|
390
|
+
if (colorTheme === 'transparent') {
|
|
391
|
+
if (dropdownState === 'read_only') {
|
|
392
|
+
return 'ui_cpnt_button_text_disabled';
|
|
393
|
+
}
|
|
394
|
+
return 'ui_cpnt_button_text_enabled';
|
|
395
|
+
}
|
|
396
|
+
if (dropdownState === 'read_only') {
|
|
397
|
+
return 'ui_cpnt_button_text_disabled';
|
|
398
|
+
}
|
|
399
|
+
return 'ui_cpnt_button_text_enabled';
|
|
400
|
+
};
|
|
383
401
|
var getDropdownContextMenuCustomWidth = function () {
|
|
384
402
|
var _a;
|
|
385
403
|
if (customWidth) {
|
|
@@ -391,7 +409,7 @@ function PriceTextField(_a) {
|
|
|
391
409
|
return '';
|
|
392
410
|
};
|
|
393
411
|
var handleDropdownClick = function () {
|
|
394
|
-
if (dropdownState === '
|
|
412
|
+
if (dropdownState === 'read_only') {
|
|
395
413
|
return;
|
|
396
414
|
}
|
|
397
415
|
setIsDropdownFocused(!isDropdownFocused);
|
|
@@ -422,7 +440,7 @@ function PriceTextField(_a) {
|
|
|
422
440
|
amount: minPriceAmount || (baseCurrency === pricing_1.CurrencyCode.KRW ? 300 : 5),
|
|
423
441
|
currency: baseCurrency
|
|
424
442
|
})
|
|
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: "
|
|
443
|
+
}), 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
444
|
(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
445
|
}
|
|
428
446
|
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'
|
|
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.
|
|
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
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
var
|
|
75
|
-
var
|
|
76
|
-
var
|
|
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
|
|
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 = {};
|
|
@@ -361,22 +361,40 @@ function PriceTextField(_a) {
|
|
|
361
361
|
}
|
|
362
362
|
var getArrowIconColorKey = function () {
|
|
363
363
|
if (colorTheme === 'dark') {
|
|
364
|
-
if (dropdownState === '
|
|
364
|
+
if (dropdownState === 'read_only') {
|
|
365
365
|
return 'ui_cpnt_dropdown_text_darktheme_disabled';
|
|
366
366
|
}
|
|
367
367
|
return 'ui_cpnt_dropdown_icon_darktheme_default';
|
|
368
368
|
}
|
|
369
369
|
if (colorTheme === 'transparent') {
|
|
370
|
-
if (dropdownState === '
|
|
370
|
+
if (dropdownState === 'read_only') {
|
|
371
371
|
return 'ui_cpnt_dropdown_icon_02';
|
|
372
372
|
}
|
|
373
373
|
return 'ui_cpnt_dropdown_icon_white_default';
|
|
374
374
|
}
|
|
375
|
-
if (dropdownState === '
|
|
375
|
+
if (dropdownState === 'read_only') {
|
|
376
376
|
return 'ui_cpnt_dropdown_icon_02';
|
|
377
377
|
}
|
|
378
378
|
return 'ui_cpnt_dropdown_icon_01';
|
|
379
379
|
};
|
|
380
|
+
var getDropdownTextColorKey = function () {
|
|
381
|
+
if (colorTheme === 'dark') {
|
|
382
|
+
if (dropdownState === 'read_only') {
|
|
383
|
+
return 'ui_cpnt_button_text_darktheme_default';
|
|
384
|
+
}
|
|
385
|
+
return 'ui_cpnt_button_text_darktheme_enabled';
|
|
386
|
+
}
|
|
387
|
+
if (colorTheme === 'transparent') {
|
|
388
|
+
if (dropdownState === 'read_only') {
|
|
389
|
+
return 'ui_cpnt_button_text_disabled';
|
|
390
|
+
}
|
|
391
|
+
return 'ui_cpnt_button_text_enabled';
|
|
392
|
+
}
|
|
393
|
+
if (dropdownState === 'read_only') {
|
|
394
|
+
return 'ui_cpnt_button_text_disabled';
|
|
395
|
+
}
|
|
396
|
+
return 'ui_cpnt_button_text_enabled';
|
|
397
|
+
};
|
|
380
398
|
var getDropdownContextMenuCustomWidth = function () {
|
|
381
399
|
var _a;
|
|
382
400
|
if (customWidth) {
|
|
@@ -388,7 +406,7 @@ function PriceTextField(_a) {
|
|
|
388
406
|
return '';
|
|
389
407
|
};
|
|
390
408
|
var handleDropdownClick = function () {
|
|
391
|
-
if (dropdownState === '
|
|
409
|
+
if (dropdownState === 'read_only') {
|
|
392
410
|
return;
|
|
393
411
|
}
|
|
394
412
|
setIsDropdownFocused(!isDropdownFocused);
|
|
@@ -419,7 +437,7 @@ function PriceTextField(_a) {
|
|
|
419
437
|
amount: minPriceAmount || (baseCurrency === pricing_1.CurrencyCode.KRW ? 300 : 5),
|
|
420
438
|
currency: baseCurrency
|
|
421
439
|
})
|
|
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: "
|
|
440
|
+
}), 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
441
|
(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
442
|
}
|
|
425
443
|
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
package/release-note.md
CHANGED