@rhc-shared-components/form-multi-select-component 0.0.9 → 0.1.1
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 +4 -0
- package/dist/index.js +27 -3
- package/dist/index.modern.js +28 -4
- package/package.json +1 -2
|
@@ -3,6 +3,8 @@ import './styles.scss';
|
|
|
3
3
|
export interface IMultiSelectItem {
|
|
4
4
|
value: string;
|
|
5
5
|
description?: string;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
extraProps?: any;
|
|
6
8
|
}
|
|
7
9
|
export interface FormMultiSelectInputProps {
|
|
8
10
|
name: string;
|
|
@@ -16,6 +18,8 @@ export interface FormMultiSelectInputProps {
|
|
|
16
18
|
isDisabled?: boolean;
|
|
17
19
|
classNames?: string;
|
|
18
20
|
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
21
|
+
chipGroupComponent?: React.ReactNode;
|
|
22
|
+
extraProps?: any;
|
|
19
23
|
}
|
|
20
24
|
declare const FormMultiSelectInput: React.FC<FormMultiSelectInputProps>;
|
|
21
25
|
export default FormMultiSelectInput;
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,24 @@ function _interopNamespace(e) {
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
|
+
function _extends() {
|
|
28
|
+
_extends = Object.assign || function (target) {
|
|
29
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
30
|
+
var source = arguments[i];
|
|
31
|
+
|
|
32
|
+
for (var key in source) {
|
|
33
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
34
|
+
target[key] = source[key];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return target;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return _extends.apply(this, arguments);
|
|
43
|
+
}
|
|
44
|
+
|
|
27
45
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
28
46
|
if (source == null) return {};
|
|
29
47
|
var target = {};
|
|
@@ -39,7 +57,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
39
57
|
return target;
|
|
40
58
|
}
|
|
41
59
|
|
|
42
|
-
var _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo"];
|
|
60
|
+
var _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo", "chipGroupComponent", "extraProps"];
|
|
43
61
|
|
|
44
62
|
var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
45
63
|
var label = _ref.label,
|
|
@@ -53,6 +71,8 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
53
71
|
isDisabled = _ref.isDisabled,
|
|
54
72
|
classNames = _ref.classNames,
|
|
55
73
|
menuAppendTo = _ref.menuAppendTo,
|
|
74
|
+
chipGroupComponent = _ref.chipGroupComponent,
|
|
75
|
+
extraProps = _ref.extraProps,
|
|
56
76
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
57
77
|
|
|
58
78
|
var _useField = formik.useField(rest),
|
|
@@ -108,18 +128,22 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
108
128
|
}, {
|
|
109
129
|
isDisabled: isSubmitting || isDisabled,
|
|
110
130
|
"aria-label": ariaLabel
|
|
131
|
+
}, chipGroupComponent && {
|
|
132
|
+
chipGroupComponent: chipGroupComponent
|
|
111
133
|
}, classNames && {
|
|
112
134
|
className: classNames
|
|
113
135
|
}, menuAppendTo && {
|
|
114
136
|
menuAppendTo: menuAppendTo
|
|
115
|
-
}, rest), lodash.map(selectOptions, function (option, index) {
|
|
137
|
+
}, extraProps && _extends({}, extraProps), rest), lodash.map(selectOptions, function (option, index) {
|
|
116
138
|
return React__namespace.createElement(reactCore.SelectOption, Object.assign({
|
|
117
139
|
key: index,
|
|
118
140
|
value: option.value,
|
|
119
141
|
label: option.value
|
|
120
142
|
}, option.description && {
|
|
121
143
|
description: option.description
|
|
122
|
-
}
|
|
144
|
+
}, option.isDisabled && {
|
|
145
|
+
isDisabled: option.isDisabled
|
|
146
|
+
}, option.extraProps && _extends({}, option.extraProps)));
|
|
123
147
|
}))));
|
|
124
148
|
};
|
|
125
149
|
|
package/dist/index.modern.js
CHANGED
|
@@ -4,6 +4,24 @@ import { ValidatedOptions, Select, SelectVariant, SelectOption } from '@patternf
|
|
|
4
4
|
import { FormGroupContainer } from '@rhc-shared-components/form-group-container';
|
|
5
5
|
import { map } from 'lodash';
|
|
6
6
|
|
|
7
|
+
function _extends() {
|
|
8
|
+
_extends = Object.assign || function (target) {
|
|
9
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
10
|
+
var source = arguments[i];
|
|
11
|
+
|
|
12
|
+
for (var key in source) {
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
14
|
+
target[key] = source[key];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return _extends.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
|
|
7
25
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
8
26
|
if (source == null) return {};
|
|
9
27
|
var target = {};
|
|
@@ -19,7 +37,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
19
37
|
return target;
|
|
20
38
|
}
|
|
21
39
|
|
|
22
|
-
const _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo"];
|
|
40
|
+
const _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo", "chipGroupComponent", "extraProps"];
|
|
23
41
|
|
|
24
42
|
const FormMultiSelectInput = _ref => {
|
|
25
43
|
let {
|
|
@@ -32,7 +50,9 @@ const FormMultiSelectInput = _ref => {
|
|
|
32
50
|
maxHeight,
|
|
33
51
|
isDisabled,
|
|
34
52
|
classNames,
|
|
35
|
-
menuAppendTo
|
|
53
|
+
menuAppendTo,
|
|
54
|
+
chipGroupComponent,
|
|
55
|
+
extraProps
|
|
36
56
|
} = _ref,
|
|
37
57
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
38
58
|
|
|
@@ -84,17 +104,21 @@ const FormMultiSelectInput = _ref => {
|
|
|
84
104
|
}, {
|
|
85
105
|
isDisabled: isSubmitting || isDisabled,
|
|
86
106
|
"aria-label": ariaLabel
|
|
107
|
+
}, chipGroupComponent && {
|
|
108
|
+
chipGroupComponent
|
|
87
109
|
}, classNames && {
|
|
88
110
|
className: classNames
|
|
89
111
|
}, menuAppendTo && {
|
|
90
112
|
menuAppendTo
|
|
91
|
-
}, rest), map(selectOptions, (option, index) => React.createElement(SelectOption, Object.assign({
|
|
113
|
+
}, extraProps && _extends({}, extraProps), rest), map(selectOptions, (option, index) => React.createElement(SelectOption, Object.assign({
|
|
92
114
|
key: index,
|
|
93
115
|
value: option.value,
|
|
94
116
|
label: option.value
|
|
95
117
|
}, option.description && {
|
|
96
118
|
description: option.description
|
|
97
|
-
}
|
|
119
|
+
}, option.isDisabled && {
|
|
120
|
+
isDisabled: option.isDisabled
|
|
121
|
+
}, option.extraProps && _extends({}, option.extraProps)))))));
|
|
98
122
|
};
|
|
99
123
|
|
|
100
124
|
export { FormMultiSelectInput };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhc-shared-components/form-multi-select-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "project description",
|
|
5
5
|
"author": "shkale",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"react-dom": ">=16.13.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@rhc-shared-components/form-group-container": "^0.2.9",
|
|
34
33
|
"@testing-library/jest-dom": "^4.2.4",
|
|
35
34
|
"@testing-library/react": "^9.5.0",
|
|
36
35
|
"@testing-library/user-event": "^7.2.1",
|