@rhc-shared-components/form-multi-select-component 1.0.1 → 1.0.2
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/FormMultiSelectInput.d.ts +2 -1
- package/dist/index.js +8 -4
- package/dist/index.modern.js +8 -4
- package/package.json +2 -2
|
@@ -9,11 +9,12 @@ export interface FormMultiSelectInputProps {
|
|
|
9
9
|
selectMenuOptions: IMultiSelectInputOptionProps[];
|
|
10
10
|
ariaLabel?: string;
|
|
11
11
|
helperText?: string;
|
|
12
|
-
maxHeight?: string
|
|
12
|
+
maxHeight?: string;
|
|
13
13
|
isDisabled?: boolean;
|
|
14
14
|
classNames?: string;
|
|
15
15
|
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
16
16
|
extraProps?: any;
|
|
17
|
+
isScrollable?: boolean;
|
|
17
18
|
}
|
|
18
19
|
declare const FormMultiSelectInput: React.FunctionComponent<FormMultiSelectInputProps>;
|
|
19
20
|
export { FormMultiSelectInput, IMultiSelectInputOptionProps };
|
package/dist/index.js
CHANGED
|
@@ -111,7 +111,7 @@ const TimesIcon = createIcon(TimesIconConfig);
|
|
|
111
111
|
|
|
112
112
|
var TimesIcon$1 = TimesIcon;
|
|
113
113
|
|
|
114
|
-
var _excluded = ["label", "isRequired", "children", "selectMenuOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo", "extraProps"];
|
|
114
|
+
var _excluded = ["label", "isRequired", "children", "selectMenuOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo", "extraProps", "isScrollable"];
|
|
115
115
|
|
|
116
116
|
var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
117
117
|
var label = _ref.label,
|
|
@@ -119,6 +119,7 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
119
119
|
selectMenuOptions = _ref.selectMenuOptions,
|
|
120
120
|
placeholder = _ref.placeholder,
|
|
121
121
|
helperText = _ref.helperText,
|
|
122
|
+
maxHeight = _ref.maxHeight,
|
|
122
123
|
isDisabled = _ref.isDisabled,
|
|
123
124
|
menuAppendTo = _ref.menuAppendTo,
|
|
124
125
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
@@ -183,7 +184,7 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
183
184
|
setSelectOptions(newSelectOptions);
|
|
184
185
|
setFocusedItemIndex(null);
|
|
185
186
|
setActiveItem(null);
|
|
186
|
-
}, [inputValue]);
|
|
187
|
+
}, [inputValue, selectMenuOptions]);
|
|
187
188
|
React__default["default"].useEffect(function () {
|
|
188
189
|
if ((value == null ? void 0 : value.length) > 0) {
|
|
189
190
|
setFieldValue(rest.name, value, true);
|
|
@@ -327,6 +328,7 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
327
328
|
setSelected([]); // eslint-disable-next-line no-unused-expressions
|
|
328
329
|
|
|
329
330
|
textInputRef == null ? void 0 : (_textInputRef$current2 = textInputRef.current) == null ? void 0 : _textInputRef$current2.focus();
|
|
331
|
+
setFieldValue(rest.name, [], true);
|
|
330
332
|
},
|
|
331
333
|
"aria-label": 'Clear input value'
|
|
332
334
|
}, React__default["default"].createElement(TimesIcon$1, {
|
|
@@ -351,13 +353,15 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
351
353
|
onOpenChange: function onOpenChange() {
|
|
352
354
|
return setIsOpen(false);
|
|
353
355
|
},
|
|
354
|
-
toggle: toggle
|
|
356
|
+
toggle: toggle,
|
|
357
|
+
isScrollable: true,
|
|
358
|
+
maxMenuHeight: maxHeight
|
|
355
359
|
}, menuAppendTo && {
|
|
356
360
|
menuAppendTo: menuAppendTo
|
|
357
361
|
}), React__default["default"].createElement(reactCore.SelectList, {
|
|
358
362
|
isAriaMultiselectable: true,
|
|
359
363
|
id: 'select-multi-typeahead-listbox'
|
|
360
|
-
}, selectOptions.map(function (option, index) {
|
|
364
|
+
}, selectOptions == null ? void 0 : selectOptions.map(function (option, index) {
|
|
361
365
|
return React__default["default"].createElement(reactCore.SelectOption, Object.assign({
|
|
362
366
|
key: option.value || option.children,
|
|
363
367
|
isFocused: focusedItemIndex === index,
|
package/dist/index.modern.js
CHANGED
|
@@ -89,7 +89,7 @@ const TimesIcon = createIcon(TimesIconConfig);
|
|
|
89
89
|
|
|
90
90
|
var TimesIcon$1 = TimesIcon;
|
|
91
91
|
|
|
92
|
-
const _excluded = ["label", "isRequired", "children", "selectMenuOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo", "extraProps"];
|
|
92
|
+
const _excluded = ["label", "isRequired", "children", "selectMenuOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo", "extraProps", "isScrollable"];
|
|
93
93
|
|
|
94
94
|
const FormMultiSelectInput = _ref => {
|
|
95
95
|
let {
|
|
@@ -99,6 +99,7 @@ const FormMultiSelectInput = _ref => {
|
|
|
99
99
|
ariaLabel = 'Select Input',
|
|
100
100
|
placeholder,
|
|
101
101
|
helperText,
|
|
102
|
+
maxHeight,
|
|
102
103
|
isDisabled,
|
|
103
104
|
menuAppendTo
|
|
104
105
|
} = _ref,
|
|
@@ -143,7 +144,7 @@ const FormMultiSelectInput = _ref => {
|
|
|
143
144
|
setSelectOptions(newSelectOptions);
|
|
144
145
|
setFocusedItemIndex(null);
|
|
145
146
|
setActiveItem(null);
|
|
146
|
-
}, [inputValue]);
|
|
147
|
+
}, [inputValue, selectMenuOptions]);
|
|
147
148
|
React__default.useEffect(() => {
|
|
148
149
|
if ((value == null ? void 0 : value.length) > 0) {
|
|
149
150
|
setFieldValue(rest.name, value, true);
|
|
@@ -275,6 +276,7 @@ const FormMultiSelectInput = _ref => {
|
|
|
275
276
|
setSelected([]); // eslint-disable-next-line no-unused-expressions
|
|
276
277
|
|
|
277
278
|
textInputRef == null ? void 0 : (_textInputRef$current2 = textInputRef.current) == null ? void 0 : _textInputRef$current2.focus();
|
|
279
|
+
setFieldValue(rest.name, [], true);
|
|
278
280
|
},
|
|
279
281
|
"aria-label": 'Clear input value'
|
|
280
282
|
}, React__default.createElement(TimesIcon$1, {
|
|
@@ -294,13 +296,15 @@ const FormMultiSelectInput = _ref => {
|
|
|
294
296
|
selected: selected,
|
|
295
297
|
onSelect: (_ev, selection) => onSelect(selection),
|
|
296
298
|
onOpenChange: () => setIsOpen(false),
|
|
297
|
-
toggle: toggle
|
|
299
|
+
toggle: toggle,
|
|
300
|
+
isScrollable: true,
|
|
301
|
+
maxMenuHeight: maxHeight
|
|
298
302
|
}, menuAppendTo && {
|
|
299
303
|
menuAppendTo
|
|
300
304
|
}), React__default.createElement(SelectList, {
|
|
301
305
|
isAriaMultiselectable: true,
|
|
302
306
|
id: 'select-multi-typeahead-listbox'
|
|
303
|
-
}, selectOptions.map((option, index) => React__default.createElement(SelectOption, Object.assign({
|
|
307
|
+
}, selectOptions == null ? void 0 : selectOptions.map((option, index) => React__default.createElement(SelectOption, Object.assign({
|
|
304
308
|
key: option.value || option.children,
|
|
305
309
|
isFocused: focusedItemIndex === index,
|
|
306
310
|
id: `select-multi-typeahead-${option.value.replace(' ', '-')}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhc-shared-components/form-multi-select-component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "project description",
|
|
5
5
|
"author": "shkale",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@patternfly/react-core": "5.3.0",
|
|
66
|
-
"@rhc-shared-components/form-group-container": "^0.
|
|
66
|
+
"@rhc-shared-components/form-group-container": "^1.0.1",
|
|
67
67
|
"@types/lodash": "^4.14.177",
|
|
68
68
|
"formik": "^2.1.4",
|
|
69
69
|
"lodash": "^4.17.21",
|