@invoicebox/ui 0.1.0-alpha.321 → 0.1.0-alpha.325
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/components/form/CountrySelect/components/CountryItem/index.d.ts +2 -1
- package/dist/components/form/CountrySelect/components/CountryItem/index.js +11 -4
- package/dist/components/form/CountrySelect/components/CountryItem/stlyes.d.ts +4 -0
- package/dist/components/form/CountrySelect/components/CountryItem/stlyes.js +18 -7
- package/dist/components/form/CountrySelect/index.d.ts +7 -0
- package/dist/components/form/CountrySelect/index.js +16 -4
- package/dist/components/form/CountrySelect/index.test.d.ts +1 -0
- package/dist/components/form/CountrySelect/index.test.js +85 -0
- package/dist/components/form/DateInput/index.d.ts +1 -1
- package/dist/components/form/DateInput/index.js +7 -1
- package/dist/components/form/DateInput/index.test.d.ts +1 -0
- package/dist/components/form/DateInput/index.test.js +71 -0
- package/dist/components/form/PhoneInput/index.d.ts +2 -1
- package/dist/components/form/PhoneInput/index.js +2 -1
- package/dist/components/form/PhoneInput/index.stories.js +2 -1
- package/dist/components/form/PhoneInput/phoneInputLogic.d.ts +2 -0
- package/dist/components/form/PhoneInput/types.d.ts +1 -0
- package/dist/components/form/PositiveIntegerInput/index.d.ts +4 -0
- package/dist/components/form/PositiveIntegerInput/index.js +46 -6
- package/dist/components/form/PositiveIntegerInput/index.test.d.ts +1 -0
- package/dist/components/form/PositiveIntegerInput/index.test.js +81 -0
- package/dist/components/form/PositiveIntegerInput/styles.d.ts +1 -3
- package/dist/components/form/PositiveIntegerInput/styles.js +8 -10
- package/dist/components/form/Select/index.js +23 -6
- package/dist/esm/components/form/CountrySelect/components/CountryItem/index.js +11 -4
- package/dist/esm/components/form/CountrySelect/components/CountryItem/stlyes.js +17 -6
- package/dist/esm/components/form/CountrySelect/index.js +17 -5
- package/dist/esm/components/form/CountrySelect/index.test.js +82 -0
- package/dist/esm/components/form/DateInput/index.js +7 -1
- package/dist/esm/components/form/DateInput/index.test.js +69 -0
- package/dist/esm/components/form/PhoneInput/index.js +2 -1
- package/dist/esm/components/form/PhoneInput/index.stories.js +2 -1
- package/dist/esm/components/form/PositiveIntegerInput/index.js +46 -6
- package/dist/esm/components/form/PositiveIntegerInput/index.test.js +78 -0
- package/dist/esm/components/form/PositiveIntegerInput/styles.js +7 -7
- package/dist/esm/components/form/Select/index.js +23 -6
- package/package.json +1 -1
|
@@ -148,13 +148,20 @@ var SelectInner = function SelectInner(props) {
|
|
|
148
148
|
}, [activeIndex, baseId]);
|
|
149
149
|
var dropdownRef = useRef(null);
|
|
150
150
|
var wrapperRef = useOutsideClick(handleHide, [dropdownRef]);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
|
|
152
|
+
// Список не открывается на фокус (WCAG 2.4.11): иначе при переходе по Tab он перекрывает
|
|
153
|
+
// следующие элементы. Открытие — кликом, Enter, пробелом или стрелками
|
|
154
|
+
var handleFocus = focusHandler;
|
|
155
155
|
var handleBlur = useCallback(function (event) {
|
|
156
|
+
var _wrapperRef$current, _dropdownRef$current;
|
|
156
157
|
var relatedTarget = event.relatedTarget;
|
|
157
158
|
var isOptionClick = (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.dataset.optionIdentifier) === OPTION_IDENTIFIER;
|
|
159
|
+
|
|
160
|
+
// Фокус ушёл на другой элемент вне поля и списка — закрываем список. Без relatedTarget
|
|
161
|
+
// (клик по неактивной области списка, уход из окна) не закрываем: клик снаружи
|
|
162
|
+
// обрабатывает useOutsideClick
|
|
163
|
+
var isFocusOutside = !!relatedTarget && !((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(relatedTarget)) && !((_dropdownRef$current = dropdownRef.current) !== null && _dropdownRef$current !== void 0 && _dropdownRef$current.contains(relatedTarget));
|
|
164
|
+
if (isFocusOutside) handleHide();
|
|
158
165
|
if (!isOptionClick) {
|
|
159
166
|
blurHandler(event);
|
|
160
167
|
return;
|
|
@@ -162,7 +169,7 @@ var SelectInner = function SelectInner(props) {
|
|
|
162
169
|
delayBlur.current = function () {
|
|
163
170
|
return blurHandler(event);
|
|
164
171
|
};
|
|
165
|
-
}, [blurHandler]);
|
|
172
|
+
}, [blurHandler, handleHide, wrapperRef]);
|
|
166
173
|
var selectValue = useCallback(function (newValue) {
|
|
167
174
|
if (isMultiple) {
|
|
168
175
|
var next = multipleValue.includes(newValue) ? multipleValue.filter(function (item) {
|
|
@@ -214,6 +221,10 @@ var SelectInner = function SelectInner(props) {
|
|
|
214
221
|
handleHide();
|
|
215
222
|
}
|
|
216
223
|
break;
|
|
224
|
+
case 'Tab':
|
|
225
|
+
// фокус уходит дальше по странице — список не должен оставаться поверх
|
|
226
|
+
if (isOpen) handleHide();
|
|
227
|
+
break;
|
|
217
228
|
default:
|
|
218
229
|
break;
|
|
219
230
|
}
|
|
@@ -231,6 +242,12 @@ var SelectInner = function SelectInner(props) {
|
|
|
231
242
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.blur();
|
|
232
243
|
handleShow();
|
|
233
244
|
};
|
|
245
|
+
|
|
246
|
+
// Раньше список открывался фокусом, который ставит и клик; теперь клик открывает его сам.
|
|
247
|
+
// Повторный клик по полю закрывает список, как у нативного select
|
|
248
|
+
var handleToggleClick = function handleToggleClick() {
|
|
249
|
+
if (isOpen) handleHide();else handleShow();
|
|
250
|
+
};
|
|
234
251
|
var handleOptionRender = function handleOptionRender(option) {
|
|
235
252
|
if (renderOption) {
|
|
236
253
|
if (!option.entity) {
|
|
@@ -357,7 +374,7 @@ var SelectInner = function SelectInner(props) {
|
|
|
357
374
|
isOpen: isOpen,
|
|
358
375
|
onReset: isResetButtonEnabled ? handleReset : undefined,
|
|
359
376
|
size: fieldSize,
|
|
360
|
-
onClick: isDrawerOptions || !!renderedValue ? handleInputClick :
|
|
377
|
+
onClick: isDrawerOptions || !!renderedValue ? handleInputClick : handleToggleClick,
|
|
361
378
|
required: required,
|
|
362
379
|
useModernStyles: useModernStyles,
|
|
363
380
|
comboboxProps: {
|