@rhc-shared-components/form-select-component 0.1.3 → 0.2.0
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/FormSelectComponent.d.ts +4 -0
- package/dist/index.js +23 -3
- package/dist/index.modern.js +24 -4
- package/package.json +2 -2
|
@@ -6,6 +6,8 @@ export interface ISelectItem {
|
|
|
6
6
|
description?: string;
|
|
7
7
|
isDisabled?: boolean;
|
|
8
8
|
isPlaceholder?: boolean;
|
|
9
|
+
extraProps?: any;
|
|
10
|
+
selectOptionExtraProps?: any;
|
|
9
11
|
}
|
|
10
12
|
export interface FormSelectProps {
|
|
11
13
|
name: string;
|
|
@@ -18,6 +20,8 @@ export interface FormSelectProps {
|
|
|
18
20
|
ariaLabel?: string;
|
|
19
21
|
helperText?: string;
|
|
20
22
|
onChange?: (_event: any, selection: any) => void;
|
|
23
|
+
extraProps?: any;
|
|
24
|
+
selectOptionExtraProps?: any;
|
|
21
25
|
}
|
|
22
26
|
declare const FormSelect: React.FC<FormSelectProps>;
|
|
23
27
|
export default FormSelect;
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,24 @@ function _interopNamespace(e) {
|
|
|
23
23
|
|
|
24
24
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
25
25
|
|
|
26
|
+
function _extends() {
|
|
27
|
+
_extends = Object.assign || function (target) {
|
|
28
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
29
|
+
var source = arguments[i];
|
|
30
|
+
|
|
31
|
+
for (var key in source) {
|
|
32
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
33
|
+
target[key] = source[key];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return target;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return _extends.apply(this, arguments);
|
|
42
|
+
}
|
|
43
|
+
|
|
26
44
|
function _inheritsLoose(subClass, superClass) {
|
|
27
45
|
subClass.prototype = Object.create(superClass.prototype);
|
|
28
46
|
subClass.prototype.constructor = subClass;
|
|
@@ -9658,7 +9676,7 @@ var InfoCircleIconConfig = {
|
|
|
9658
9676
|
};
|
|
9659
9677
|
var InfoCircleIcon = createIcon(InfoCircleIconConfig);
|
|
9660
9678
|
|
|
9661
|
-
var _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange"];
|
|
9679
|
+
var _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange", "extraProps", "selectOptionExtraProps"];
|
|
9662
9680
|
|
|
9663
9681
|
var FormSelect = function FormSelect(_ref) {
|
|
9664
9682
|
var label = _ref.label,
|
|
@@ -9671,6 +9689,8 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
9671
9689
|
subLabel = _ref.subLabel,
|
|
9672
9690
|
subInfo = _ref.subInfo,
|
|
9673
9691
|
onChange = _ref.onChange,
|
|
9692
|
+
extraProps = _ref.extraProps,
|
|
9693
|
+
selectOptionExtraProps = _ref.selectOptionExtraProps,
|
|
9674
9694
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
9675
9695
|
|
|
9676
9696
|
var _useField = formik.useField(rest),
|
|
@@ -9740,7 +9760,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
9740
9760
|
isOpen: isOpen,
|
|
9741
9761
|
isDisabled: isSubmitting,
|
|
9742
9762
|
"aria-label": ariaLabel
|
|
9743
|
-
}, rest), lodash.map(selectOptions, function (option, index) {
|
|
9763
|
+
}, extraProps && _extends({}, extraProps), rest), lodash.map(selectOptions, function (option, index) {
|
|
9744
9764
|
return React__namespace.createElement(reactCore.SelectOption, Object.assign({
|
|
9745
9765
|
key: index,
|
|
9746
9766
|
value: option.value,
|
|
@@ -9751,7 +9771,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
9751
9771
|
isPlaceholder: option.isPlaceholder
|
|
9752
9772
|
}, option.isDisabled && {
|
|
9753
9773
|
isDisabled: option.isDisabled
|
|
9754
|
-
}));
|
|
9774
|
+
}, selectOptionExtraProps && _extends({}, selectOptionExtraProps)));
|
|
9755
9775
|
}))));
|
|
9756
9776
|
};
|
|
9757
9777
|
|
package/dist/index.modern.js
CHANGED
|
@@ -3,6 +3,24 @@ import { useField, useFormikContext } from 'formik';
|
|
|
3
3
|
import { ValidatedOptions, Split, SplitItem, Select, SelectVariant, SelectOption } from '@patternfly/react-core';
|
|
4
4
|
import { FormGroupContainer } from '@rhc-shared-components/form-group-container';
|
|
5
5
|
|
|
6
|
+
function _extends() {
|
|
7
|
+
_extends = Object.assign || function (target) {
|
|
8
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
9
|
+
var source = arguments[i];
|
|
10
|
+
|
|
11
|
+
for (var key in source) {
|
|
12
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
13
|
+
target[key] = source[key];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return _extends.apply(this, arguments);
|
|
22
|
+
}
|
|
23
|
+
|
|
6
24
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7
25
|
if (source == null) return {};
|
|
8
26
|
var target = {};
|
|
@@ -9612,7 +9630,7 @@ const InfoCircleIconConfig = {
|
|
|
9612
9630
|
};
|
|
9613
9631
|
const InfoCircleIcon = createIcon(InfoCircleIconConfig);
|
|
9614
9632
|
|
|
9615
|
-
const _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange"];
|
|
9633
|
+
const _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange", "extraProps", "selectOptionExtraProps"];
|
|
9616
9634
|
|
|
9617
9635
|
const FormSelect = _ref => {
|
|
9618
9636
|
let {
|
|
@@ -9624,7 +9642,9 @@ const FormSelect = _ref => {
|
|
|
9624
9642
|
helperText,
|
|
9625
9643
|
subLabel,
|
|
9626
9644
|
subInfo,
|
|
9627
|
-
onChange
|
|
9645
|
+
onChange,
|
|
9646
|
+
extraProps,
|
|
9647
|
+
selectOptionExtraProps
|
|
9628
9648
|
} = _ref,
|
|
9629
9649
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
9630
9650
|
|
|
@@ -9689,7 +9709,7 @@ const FormSelect = _ref => {
|
|
|
9689
9709
|
isOpen: isOpen,
|
|
9690
9710
|
isDisabled: isSubmitting,
|
|
9691
9711
|
"aria-label": ariaLabel
|
|
9692
|
-
}, rest), lodash.map(selectOptions, (option, index) => React.createElement(SelectOption, Object.assign({
|
|
9712
|
+
}, extraProps && _extends({}, extraProps), rest), lodash.map(selectOptions, (option, index) => React.createElement(SelectOption, Object.assign({
|
|
9693
9713
|
key: index,
|
|
9694
9714
|
value: option.value,
|
|
9695
9715
|
"data-testid": option.key
|
|
@@ -9699,7 +9719,7 @@ const FormSelect = _ref => {
|
|
|
9699
9719
|
isPlaceholder: option.isPlaceholder
|
|
9700
9720
|
}, option.isDisabled && {
|
|
9701
9721
|
isDisabled: option.isDisabled
|
|
9702
|
-
}))))));
|
|
9722
|
+
}, selectOptionExtraProps && _extends({}, selectOptionExtraProps)))))));
|
|
9703
9723
|
};
|
|
9704
9724
|
|
|
9705
9725
|
export { FormSelect };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhc-shared-components/form-select-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "project description",
|
|
5
5
|
"author": "redhatofficial",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@patternfly/react-core": "^4.276.6",
|
|
66
|
-
"@rhc-shared-components/form-group-container": "^0.
|
|
66
|
+
"@rhc-shared-components/form-group-container": "^1.0.1",
|
|
67
67
|
"formik": "^2.1.4",
|
|
68
68
|
"react": "^16.13.1",
|
|
69
69
|
"react-dom": "^16.13.1"
|