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

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.
@@ -5,12 +5,18 @@ import { forwardRef, useEffect, useRef, useState } from 'react';
5
5
  import { COLOR } from '../../../../constant/color';
6
6
  import { HintText } from '../../shared/hintText/HintText';
7
7
  import { Label } from '../../shared/label/Label';
8
- // 슬롯 아이콘(leadingElement/trailingElement) 상태 아이콘(clear·validation·destructive)은 같은 크기를 쓴다.
8
+ // 슬롯 아이콘(leadingElement/trailingElement) 인풋 크기에 맞춰 커진다.
9
9
  // slot.size 를 명시하면 그 값이 우선한다.
10
10
  const iconSvgSize = {
11
11
  xs: 14,
12
12
  sm: 20
13
13
  };
14
+ // 상태 아이콘(clear·validation·destructive)은 인풋 크기와 무관하게 16px 로 고정한다.
15
+ // 슬롯 아이콘은 sm 에서 20px 로 커지므로 두 상수를 하나로 합치지 않는다.
16
+ const statusIconSvgSize = {
17
+ xs: 14,
18
+ sm: 16
19
+ };
14
20
  const InputBase = /*#__PURE__*/forwardRef((_ref, ref) => {
15
21
  let {
16
22
  size = 'xs',
@@ -118,8 +124,8 @@ const InputBase = /*#__PURE__*/forwardRef((_ref, ref) => {
118
124
  onClick: onClearText,
119
125
  children: _jsx(X, {
120
126
  className: "ncua-input__clear-icon",
121
- width: iconSvgSize[size],
122
- height: iconSvgSize[size]
127
+ width: statusIconSvgSize[size],
128
+ height: statusIconSvgSize[size]
123
129
  })
124
130
  });
125
131
  };
@@ -129,8 +135,8 @@ const InputBase = /*#__PURE__*/forwardRef((_ref, ref) => {
129
135
  className: "ncua-input__icon-wrap ncua-input__right-icon",
130
136
  children: _jsx(InfoCircle, {
131
137
  className: "ncua-input__destructive-icon",
132
- width: iconSvgSize[size],
133
- height: iconSvgSize[size]
138
+ width: statusIconSvgSize[size],
139
+ height: statusIconSvgSize[size]
134
140
  })
135
141
  });
136
142
  }
@@ -139,8 +145,8 @@ const InputBase = /*#__PURE__*/forwardRef((_ref, ref) => {
139
145
  className: "ncua-input__icon-wrap ncua-input__right-icon",
140
146
  children: _jsx(CheckCircle, {
141
147
  className: "ncua-input__validation-icon",
142
- width: iconSvgSize[size],
143
- height: iconSvgSize[size]
148
+ width: statusIconSvgSize[size],
149
+ height: statusIconSvgSize[size]
144
150
  })
145
151
  });
146
152
  }
@@ -77,8 +77,9 @@ describe('InputBase — 아이콘 사이즈', () => {
77
77
  height: svg?.getAttribute('height')
78
78
  };
79
79
  };
80
- // 슬롯 아이콘과 상태 아이콘은 같은 크기를 쓴다 과거 상태 아이콘만 sm=16으로 어긋나 있었다
81
- it.each([['xs', '14'], ['sm', '20']])('size=%s 때 슬롯 아이콘과 상태 아이콘이 모두 %spx렌더된다', (size, expected) => {
80
+ // 슬롯 아이콘은 인풋 크기에 연동돼 sm 에서 20px 커지지만,
81
+ // 상태 아이콘(clear·validation·destructive) 16px고정한다.
82
+ it.each([['xs', '14', '14'], ['sm', '20', '16']])('size=%s 일 때 슬롯 아이콘은 %spx, 상태 아이콘은 %spx로 렌더된다', (size, slotExpected, statusExpected) => {
82
83
  // Given/When: 슬롯 아이콘과 clear 버튼, destructive 상태를 함께 렌더하면
83
84
  const view = mountInputBase({
84
85
  size,
@@ -90,23 +91,27 @@ describe('InputBase — 아이콘 사이즈', () => {
90
91
  icon: SearchLg
91
92
  }
92
93
  });
93
- // Then: 슬롯·clear·destructive 아이콘의 크기가 서로 어긋나지 않는다
94
- const expectedSize = {
95
- width: expected,
96
- height: expected
94
+ // Then: 슬롯 아이콘만 인풋 크기를 따라가고, 상태 아이콘은 16px 을 넘지 않는다
95
+ const slotSize = {
96
+ width: slotExpected,
97
+ height: slotExpected
98
+ };
99
+ const statusSize = {
100
+ width: statusExpected,
101
+ height: statusExpected
97
102
  };
98
- expect(iconSizeOf(view.container, '.ncua-input__left-icon')).toEqual(expectedSize);
99
- expect(iconSizeOf(view.container, '.ncua-input__clear-icon')).toEqual(expectedSize);
100
- expect(iconSizeOf(view.container, '.ncua-input__destructive-icon')).toEqual(expectedSize);
103
+ expect(iconSizeOf(view.container, '.ncua-input__left-icon')).toEqual(slotSize);
104
+ expect(iconSizeOf(view.container, '.ncua-input__clear-icon')).toEqual(statusSize);
105
+ expect(iconSizeOf(view.container, '.ncua-input__destructive-icon')).toEqual(statusSize);
101
106
  view.unmount();
102
107
  });
103
- it.each([['xs', '14'], ['sm', '20']])('size=%s 일 때 validation 아이콘도 %spx로 렌더된다', (size, expected) => {
108
+ it.each([['xs', '14'], ['sm', '16']])('size=%s 일 때 validation 아이콘은 %spx로 렌더된다', (size, expected) => {
104
109
  // Given/When: validation 상태로 렌더하면
105
110
  const view = mountInputBase({
106
111
  size,
107
112
  validation: true
108
113
  });
109
- // Then: 다른 아이콘과 같은 크기다
114
+ // Then: 다른 상태 아이콘과 같은 크기다
110
115
  expect(iconSizeOf(view.container, '.ncua-input__validation-icon')).toEqual({
111
116
  width: expected,
112
117
  height: expected
@@ -164,6 +164,8 @@ const PostcodeSearchModal = _ref2 => {
164
164
  size: "sm",
165
165
  fullWidth: true,
166
166
  value: searchQuery,
167
+ clearText: !!searchQuery,
168
+ onClearText: () => onSearchQueryChange(''),
167
169
  onChange: handleSearchQueryChange,
168
170
  onKeyDown: handleSearchKeyDown,
169
171
  placeholder: SEARCH_PLACEHOLDER,