@decisiv/ui-components 2.0.1-alpha.197 → 2.0.1-alpha.199
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/lib/components/Combobox/index.d.ts.map +1 -1
- package/lib/components/Combobox/index.js +26 -24
- package/lib/components/Combobox/index.test.js +3 -3
- package/lib/components/SearchInput/index.d.ts +1 -1
- package/lib/components/SearchInput/index.d.ts.map +1 -1
- package/lib/components/SearchInput/index.js +3 -1
- package/lib/components/SearchInput/schema.d.ts.map +1 -1
- package/lib/components/SearchInput/schema.js +2 -1
- package/lib/components/SearchInput/types.d.ts +1 -0
- package/lib/components/SearchInput/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Combobox/index.tsx"],"names":[],"mappings":"AASA,OAAc,EAGZ,sBAAsB,EAQvB,MAAM,OAAO,CAAC;AA2Bf,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAQ,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Combobox/index.tsx"],"names":[],"mappings":"AASA,OAAc,EAGZ,sBAAsB,EAQvB,MAAM,OAAO,CAAC;AA2Bf,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAQ,MAAM,SAAS,CAAC;AAmjBhE,QAAA,MAAM,eAAe,EAAE,sBAAsB,CAC3C,gBAAgB,EAChB,aAAa,CACS,CAAC;AAOzB,eAAe,eAAe,CAAC"}
|
|
@@ -337,45 +337,41 @@ function Combobox(props, ref) {
|
|
|
337
337
|
* Usually that's fine. In this case, we don't want that behavior.
|
|
338
338
|
*/
|
|
339
339
|
updateIsPopoverVisible(false);
|
|
340
|
-
} else if (
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
} else if (variant === 'sync' && finalComboboxRef && // @ts-ignore
|
|
341
|
+
finalComboboxRef.current === event.target) {
|
|
342
|
+
/**
|
|
343
|
+
* This prevents a double toggle when the user clicks
|
|
344
|
+
* the actual input field inside the combobox.
|
|
345
|
+
*/
|
|
346
|
+
event.preventDefault();
|
|
347
|
+
event.stopPropagation();
|
|
348
|
+
|
|
349
|
+
if (!isPopoverVisible) {
|
|
343
350
|
/**
|
|
344
|
-
* This
|
|
345
|
-
*
|
|
351
|
+
* This re-opens the popover if you first open it,
|
|
352
|
+
* then make a selection, then click the <input> again.
|
|
346
353
|
*/
|
|
347
|
-
|
|
348
|
-
event.stopPropagation();
|
|
349
|
-
|
|
350
|
-
if (!isPopoverVisible) {
|
|
351
|
-
/**
|
|
352
|
-
* This re-opens the popover if you first open it,
|
|
353
|
-
* then make a selection, then click the <input> again.
|
|
354
|
-
*/
|
|
355
|
-
updateIsPopoverVisible(true);
|
|
356
|
-
}
|
|
357
|
-
} else {
|
|
358
|
-
updateIsPopoverVisible('toggle');
|
|
354
|
+
updateIsPopoverVisible(true);
|
|
359
355
|
}
|
|
356
|
+
} else {
|
|
357
|
+
updateIsPopoverVisible('toggle');
|
|
360
358
|
}
|
|
361
359
|
|
|
362
360
|
onClick && onClick(event);
|
|
363
|
-
},
|
|
364
|
-
[isFocused, isPopoverVisible, variant, onClick, updateIsPopoverVisible]);
|
|
361
|
+
}, [finalInputContainerRef, onClick, updateIsPopoverVisible, variant, finalComboboxRef, isPopoverVisible]);
|
|
365
362
|
/**
|
|
366
363
|
* This focus handler is responsible for opening the dropdown list and tracking focus state.
|
|
367
364
|
* It's important to do this in the focus handler because the dropdown should open when the
|
|
368
365
|
* Combobox is clicked or tabbed to.
|
|
366
|
+
*
|
|
367
|
+
* [KDS-3742] Patch: Updated this handler to align the behavior with the Select component.
|
|
368
|
+
* The popover will no longer automatically show when the Combobox gains focus.
|
|
369
369
|
*/
|
|
370
370
|
|
|
371
371
|
var handleContainerFocus = (0, _react.useCallback)(function (event) {
|
|
372
|
-
if (variant === 'sync') {
|
|
373
|
-
updateIsPopoverVisible(true);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
372
|
setIsFocused(true);
|
|
377
373
|
onFocus && onFocus(event);
|
|
378
|
-
}, [onFocus
|
|
374
|
+
}, [onFocus]);
|
|
379
375
|
/**
|
|
380
376
|
* Pressing certain keys when focused on the Combobox component should trigger some actions.
|
|
381
377
|
*/
|
|
@@ -410,7 +406,13 @@ function Combobox(props, ref) {
|
|
|
410
406
|
}
|
|
411
407
|
}
|
|
412
408
|
|
|
409
|
+
if (event.key === 'Enter' && !isPopoverVisible) {
|
|
410
|
+
event.preventDefault();
|
|
411
|
+
updateIsPopoverVisible(true);
|
|
412
|
+
}
|
|
413
|
+
|
|
413
414
|
if (event.key === 'Enter' && isPopoverVisible) {
|
|
415
|
+
event.preventDefault();
|
|
414
416
|
updateSelected(activeId || '');
|
|
415
417
|
updateIsPopoverVisible(false);
|
|
416
418
|
}
|
|
@@ -110,7 +110,7 @@ describe('Combobox', function () {
|
|
|
110
110
|
expect(getByLabelText('test')).toBeVisible();
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
|
-
describe('when the input field
|
|
113
|
+
describe('when the input field is clicked', function () {
|
|
114
114
|
it('displays the list of options', function () {
|
|
115
115
|
var _render4 = render(_react.default.createElement(_.default, {
|
|
116
116
|
label: "test",
|
|
@@ -958,7 +958,7 @@ describe('Combobox', function () {
|
|
|
958
958
|
});
|
|
959
959
|
describe('when a controlled component', function () {
|
|
960
960
|
it('initializes with and prefers prop values', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
961
|
-
var newInputValue, onChangeInputValue, onChangeValue, _render32, baseElement, queryByLabelText, rerender
|
|
961
|
+
var newInputValue, onChangeInputValue, onChangeValue, _render32, baseElement, queryByLabelText, rerender;
|
|
962
962
|
|
|
963
963
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
964
964
|
while (1) {
|
|
@@ -977,7 +977,7 @@ describe('Combobox', function () {
|
|
|
977
977
|
onChangeValue: onChangeValue,
|
|
978
978
|
autoComplete: "auto-complete-test",
|
|
979
979
|
type: "search"
|
|
980
|
-
})), baseElement = _render32.baseElement, queryByLabelText = _render32.queryByLabelText, rerender = _render32.rerender
|
|
980
|
+
})), baseElement = _render32.baseElement, queryByLabelText = _render32.queryByLabelText, rerender = _render32.rerender;
|
|
981
981
|
|
|
982
982
|
_react2.fireEvent.click(queryByLabelText('test'));
|
|
983
983
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SearchInputProps, SearchItem, StyledFlexProps } from './types';
|
|
3
|
-
declare function SearchInput({ onSearch, value, onChange, size, disabled, searchDisabled, searchOn, searchByOptions, searchByLabel, searchByValue, searchByName, searchByDefaultValue, searchByWidth, onSearchByChange, warningMessage, helpMessage, zIndex, ...props }: SearchInputProps): JSX.Element;
|
|
3
|
+
declare function SearchInput({ onSearch, value, onChange, size, disabled, searchDisabled, searchOn, searchByOptions, searchByLabel, searchByValue, searchByName, searchByDefaultValue, searchByWidth, onSearchByChange, warningMessage, helpMessage, zIndex, tooltipZIndex, ...props }: SearchInputProps): JSX.Element;
|
|
4
4
|
declare namespace SearchInput {
|
|
5
5
|
var defaultProps: {
|
|
6
6
|
size: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/index.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiBxE,iBAAwB,WAAW,CAAC,EAClC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,QAAmB,EACnB,eAAoB,EACpB,aAAkB,EAClB,aAAa,EACb,YAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,MAAM,EACN,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/index.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiBxE,iBAAwB,WAAW,CAAC,EAClC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,QAAmB,EACnB,eAAoB,EACpB,aAAkB,EAClB,aAAa,EACb,YAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,MAAM,EACN,aAAa,EACb,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAwIhC;kBA5JuB,WAAW;;;;;eAAX,WAAW;AAkKnC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -81,7 +81,8 @@ function SearchInput(_ref) {
|
|
|
81
81
|
warningMessage = _ref.warningMessage,
|
|
82
82
|
helpMessage = _ref.helpMessage,
|
|
83
83
|
zIndex = _ref.zIndex,
|
|
84
|
-
|
|
84
|
+
tooltipZIndex = _ref.tooltipZIndex,
|
|
85
|
+
props = _objectWithoutProperties(_ref, ["onSearch", "value", "onChange", "size", "disabled", "searchDisabled", "searchOn", "searchByOptions", "searchByLabel", "searchByValue", "searchByName", "searchByDefaultValue", "searchByWidth", "onSearchByChange", "warningMessage", "helpMessage", "zIndex", "tooltipZIndex"]);
|
|
85
86
|
|
|
86
87
|
var translate = (0, _useTranslations.default)();
|
|
87
88
|
var handleSearch = (0, _react.useCallback)(function () {
|
|
@@ -143,6 +144,7 @@ function SearchInput(_ref) {
|
|
|
143
144
|
})), _react.default.createElement(_styles.ButtonGroup, {
|
|
144
145
|
mediumSized: mediumSized
|
|
145
146
|
}, !disabled && _react.default.createElement(_Tooltip.default, {
|
|
147
|
+
zIndex: tooltipZIndex,
|
|
146
148
|
placement: "top",
|
|
147
149
|
target: // eslint-disable-next-line react/jsx-wrap-multilines
|
|
148
150
|
_react.default.createElement(_styles.TimesIconWrapper, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAA2C,CAAC;AA4ExD,eAAe,MAAM,CAAC"}
|
|
@@ -30,7 +30,8 @@ schema.propTypes = {
|
|
|
30
30
|
value: _reactDesc.PropTypes.string.description('The value for an option in the search by list.')
|
|
31
31
|
})).description('The array of data for the options that will be rendered in the search by field'),
|
|
32
32
|
searchByDefaultValue: _reactDesc.PropTypes.string.description('The ID of the option that should be selected by default in the search by field.'),
|
|
33
|
-
searchByWidth: _reactDesc.PropTypes.string.description('A pass-through CSS value for the search by field width attribute.')
|
|
33
|
+
searchByWidth: _reactDesc.PropTypes.string.description('A pass-through CSS value for the search by field width attribute.'),
|
|
34
|
+
tooltipZIndex: _reactDesc.PropTypes.number.description('Sets the z-index style property of the tooltip component.')
|
|
34
35
|
};
|
|
35
36
|
var _default = schema;
|
|
36
37
|
exports.default = _default;
|
|
@@ -10,6 +10,7 @@ export declare type Size = 'medium' | 'small';
|
|
|
10
10
|
export declare type SearchOn = 'submit' | 'change';
|
|
11
11
|
export interface SearchInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'label'>, Omit<BaseInputFieldProps, 'children' | 'onClick' | 'label'> {
|
|
12
12
|
zIndex?: number;
|
|
13
|
+
tooltipZIndex?: number;
|
|
13
14
|
searchDisabled?: boolean;
|
|
14
15
|
searchOn?: SearchOn;
|
|
15
16
|
searchByDefaultValue?: string;
|
|
@@ -1 +1 @@
|
|
|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AAG,IAAI,CAAC;CACtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decisiv/ui-components",
|
|
3
|
-
"version": "2.0.1-alpha.
|
|
3
|
+
"version": "2.0.1-alpha.199+f09cd92",
|
|
4
4
|
"description": "Decisiv's design system React components",
|
|
5
5
|
"author": "Decisiv UI Development Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"private": false,
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "f09cd929f1f2639d02830db24dee2f900fcc3769"
|
|
75
75
|
}
|