@ncds/ui-admin 1.8.21-alpha.16 → 1.8.21-alpha.17

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.
@@ -12,12 +12,18 @@ var _color = require("../../../../constant/color");
12
12
  var _HintText = require("../../shared/hintText/HintText");
13
13
  var _Label = require("../../shared/label/Label");
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- // 슬롯 아이콘(leadingElement/trailingElement) 상태 아이콘(clear·validation·destructive)은 같은 크기를 쓴다.
15
+ // 슬롯 아이콘(leadingElement/trailingElement) 인풋 크기에 맞춰 커진다.
16
16
  // slot.size 를 명시하면 그 값이 우선한다.
17
17
  const iconSvgSize = {
18
18
  xs: 14,
19
19
  sm: 20
20
20
  };
21
+ // 상태 아이콘(clear·validation·destructive)은 인풋 크기와 무관하게 16px 로 고정한다.
22
+ // 슬롯 아이콘은 sm 에서 20px 로 커지므로 두 상수를 하나로 합치지 않는다.
23
+ const statusIconSvgSize = {
24
+ xs: 14,
25
+ sm: 16
26
+ };
21
27
  const InputBase = exports.InputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
22
28
  let {
23
29
  size = 'xs',
@@ -125,8 +131,8 @@ const InputBase = exports.InputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref,
125
131
  onClick: onClearText,
126
132
  children: (0, _jsxRuntime.jsx)(_uiAdminIcon.X, {
127
133
  className: "ncua-input__clear-icon",
128
- width: iconSvgSize[size],
129
- height: iconSvgSize[size]
134
+ width: statusIconSvgSize[size],
135
+ height: statusIconSvgSize[size]
130
136
  })
131
137
  });
132
138
  };
@@ -136,8 +142,8 @@ const InputBase = exports.InputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref,
136
142
  className: "ncua-input__icon-wrap ncua-input__right-icon",
137
143
  children: (0, _jsxRuntime.jsx)(_uiAdminIcon.InfoCircle, {
138
144
  className: "ncua-input__destructive-icon",
139
- width: iconSvgSize[size],
140
- height: iconSvgSize[size]
145
+ width: statusIconSvgSize[size],
146
+ height: statusIconSvgSize[size]
141
147
  })
142
148
  });
143
149
  }
@@ -146,8 +152,8 @@ const InputBase = exports.InputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref,
146
152
  className: "ncua-input__icon-wrap ncua-input__right-icon",
147
153
  children: (0, _jsxRuntime.jsx)(_uiAdminIcon.CheckCircle, {
148
154
  className: "ncua-input__validation-icon",
149
- width: iconSvgSize[size],
150
- height: iconSvgSize[size]
155
+ width: statusIconSvgSize[size],
156
+ height: statusIconSvgSize[size]
151
157
  })
152
158
  });
153
159
  }
@@ -80,8 +80,9 @@ function mountInputBase() {
80
80
  height: svg?.getAttribute('height')
81
81
  };
82
82
  };
83
- // 슬롯 아이콘과 상태 아이콘은 같은 크기를 쓴다 과거 상태 아이콘만 sm=16으로 어긋나 있었다
84
- _vitest.it.each([['xs', '14'], ['sm', '20']])('size=%s 때 슬롯 아이콘과 상태 아이콘이 모두 %spx렌더된다', (size, expected) => {
83
+ // 슬롯 아이콘은 인풋 크기에 연동돼 sm 에서 20px 커지지만,
84
+ // 상태 아이콘(clear·validation·destructive) 16px고정한다.
85
+ _vitest.it.each([['xs', '14', '14'], ['sm', '20', '16']])('size=%s 일 때 슬롯 아이콘은 %spx, 상태 아이콘은 %spx로 렌더된다', (size, slotExpected, statusExpected) => {
85
86
  // Given/When: 슬롯 아이콘과 clear 버튼, destructive 상태를 함께 렌더하면
86
87
  const view = mountInputBase({
87
88
  size,
@@ -93,23 +94,27 @@ function mountInputBase() {
93
94
  icon: _uiAdminIcon.SearchLg
94
95
  }
95
96
  });
96
- // Then: 슬롯·clear·destructive 아이콘의 크기가 서로 어긋나지 않는다
97
- const expectedSize = {
98
- width: expected,
99
- height: expected
97
+ // Then: 슬롯 아이콘만 인풋 크기를 따라가고, 상태 아이콘은 16px 을 넘지 않는다
98
+ const slotSize = {
99
+ width: slotExpected,
100
+ height: slotExpected
101
+ };
102
+ const statusSize = {
103
+ width: statusExpected,
104
+ height: statusExpected
100
105
  };
101
- (0, _vitest.expect)(iconSizeOf(view.container, '.ncua-input__left-icon')).toEqual(expectedSize);
102
- (0, _vitest.expect)(iconSizeOf(view.container, '.ncua-input__clear-icon')).toEqual(expectedSize);
103
- (0, _vitest.expect)(iconSizeOf(view.container, '.ncua-input__destructive-icon')).toEqual(expectedSize);
106
+ (0, _vitest.expect)(iconSizeOf(view.container, '.ncua-input__left-icon')).toEqual(slotSize);
107
+ (0, _vitest.expect)(iconSizeOf(view.container, '.ncua-input__clear-icon')).toEqual(statusSize);
108
+ (0, _vitest.expect)(iconSizeOf(view.container, '.ncua-input__destructive-icon')).toEqual(statusSize);
104
109
  view.unmount();
105
110
  });
106
- _vitest.it.each([['xs', '14'], ['sm', '20']])('size=%s 일 때 validation 아이콘도 %spx로 렌더된다', (size, expected) => {
111
+ _vitest.it.each([['xs', '14'], ['sm', '16']])('size=%s 일 때 validation 아이콘은 %spx로 렌더된다', (size, expected) => {
107
112
  // Given/When: validation 상태로 렌더하면
108
113
  const view = mountInputBase({
109
114
  size,
110
115
  validation: true
111
116
  });
112
- // Then: 다른 아이콘과 같은 크기다
117
+ // Then: 다른 상태 아이콘과 같은 크기다
113
118
  (0, _vitest.expect)(iconSizeOf(view.container, '.ncua-input__validation-icon')).toEqual({
114
119
  width: expected,
115
120
  height: expected
@@ -171,6 +171,8 @@ const PostcodeSearchModal = _ref2 => {
171
171
  size: "sm",
172
172
  fullWidth: true,
173
173
  value: searchQuery,
174
+ clearText: !!searchQuery,
175
+ onClearText: () => onSearchQueryChange(''),
174
176
  onChange: handleSearchQueryChange,
175
177
  onKeyDown: handleSearchKeyDown,
176
178
  placeholder: SEARCH_PLACEHOLDER,