@rhc-shared-components/form-select-component 0.2.6 → 0.2.8
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 +29 -28
- package/dist/index.d.ts +3 -3
- package/dist/index.js +108 -56
- package/dist/index.modern.js +79 -54
- package/package.json +2 -2
- package/CHANGELOG.md +0 -70
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface ISelectItem {
|
|
3
|
-
value: string;
|
|
4
|
-
key?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
isDisabled?: boolean;
|
|
7
|
-
isPlaceholder?: boolean;
|
|
8
|
-
extraProps?: any;
|
|
9
|
-
selectOptionExtraProps?: any;
|
|
10
|
-
}
|
|
11
|
-
export interface FormSelectProps {
|
|
12
|
-
name: string;
|
|
13
|
-
label: string;
|
|
14
|
-
isRequired?: boolean;
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
selectOptions: ISelectItem[];
|
|
17
|
-
subLabel?: string | React.ReactNode;
|
|
18
|
-
subInfo?: string;
|
|
19
|
-
ariaLabel?: string;
|
|
20
|
-
helperText?: string;
|
|
21
|
-
onChange?: (_event: any, selection: any) => void;
|
|
22
|
-
extraProps?: any;
|
|
23
|
-
selectOptionExtraProps?: any;
|
|
24
|
-
isFullWidth?: boolean;
|
|
25
|
-
isFullHeight?: boolean;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface ISelectItem {
|
|
3
|
+
value: string;
|
|
4
|
+
key?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
isPlaceholder?: boolean;
|
|
8
|
+
extraProps?: any;
|
|
9
|
+
selectOptionExtraProps?: any;
|
|
10
|
+
}
|
|
11
|
+
export interface FormSelectProps {
|
|
12
|
+
name: string;
|
|
13
|
+
label: string;
|
|
14
|
+
isRequired?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
selectOptions: ISelectItem[];
|
|
17
|
+
subLabel?: string | React.ReactNode;
|
|
18
|
+
subInfo?: string;
|
|
19
|
+
ariaLabel?: string;
|
|
20
|
+
helperText?: string;
|
|
21
|
+
onChange?: (_event: any, selection: any) => void;
|
|
22
|
+
extraProps?: any;
|
|
23
|
+
selectOptionExtraProps?: any;
|
|
24
|
+
isFullWidth?: boolean;
|
|
25
|
+
isFullHeight?: boolean;
|
|
26
|
+
isDisabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare const FormSelect: React.FC<FormSelectProps>;
|
|
29
|
+
export default FormSelect;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import FormSelect, { ISelectItem } from './FormSelectComponent';
|
|
2
|
-
export { FormSelect };
|
|
3
|
-
export type { ISelectItem };
|
|
1
|
+
import FormSelect, { ISelectItem } from './FormSelectComponent';
|
|
2
|
+
export { FormSelect };
|
|
3
|
+
export type { ISelectItem };
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,22 @@ function _extends() {
|
|
|
41
41
|
return _extends.apply(this, arguments);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
function _inheritsLoose(subClass, superClass) {
|
|
45
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
46
|
+
subClass.prototype.constructor = subClass;
|
|
47
|
+
|
|
48
|
+
_setPrototypeOf(subClass, superClass);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function _setPrototypeOf(o, p) {
|
|
52
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
53
|
+
o.__proto__ = p;
|
|
54
|
+
return o;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return _setPrototypeOf(o, p);
|
|
58
|
+
}
|
|
59
|
+
|
|
44
60
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
45
61
|
if (source == null) return {};
|
|
46
62
|
var target = {};
|
|
@@ -9527,75 +9543,103 @@ if(freeModule){// Export for Node.js.
|
|
|
9527
9543
|
freeExports._=_;}else {// Export to the global object.
|
|
9528
9544
|
root._=_;}}).call(commonjsGlobal);});
|
|
9529
9545
|
|
|
9530
|
-
|
|
9531
|
-
Copyright (c) Microsoft Corporation.
|
|
9532
|
-
|
|
9533
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
9534
|
-
purpose with or without fee is hereby granted.
|
|
9535
|
-
|
|
9536
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9537
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9538
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
9539
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
9540
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
9541
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
9542
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
9546
|
+
/*! *****************************************************************************
|
|
9547
|
+
Copyright (c) Microsoft Corporation.
|
|
9548
|
+
|
|
9549
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
9550
|
+
purpose with or without fee is hereby granted.
|
|
9551
|
+
|
|
9552
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9553
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9554
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
9555
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
9556
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
9557
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
9558
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
9543
9559
|
***************************************************************************** */
|
|
9544
|
-
|
|
9545
9560
|
function __rest(s, e) {
|
|
9546
9561
|
var t = {};
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9562
|
+
|
|
9563
|
+
for (var p in s) {
|
|
9564
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
9565
|
+
}
|
|
9566
|
+
|
|
9567
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9568
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
9569
|
+
}
|
|
9554
9570
|
return t;
|
|
9555
9571
|
}
|
|
9556
9572
|
|
|
9557
|
-
|
|
9558
|
-
var e = new Error(message);
|
|
9559
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
9560
|
-
};
|
|
9561
|
-
|
|
9562
|
-
let currentId = 0;
|
|
9573
|
+
var currentId = 0;
|
|
9563
9574
|
/**
|
|
9564
9575
|
* Factory to create Icon class components for consumers
|
|
9565
9576
|
*/
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9577
|
+
|
|
9578
|
+
function createIcon(_ref) {
|
|
9579
|
+
var name = _ref.name,
|
|
9580
|
+
_ref$xOffset = _ref.xOffset,
|
|
9581
|
+
xOffset = _ref$xOffset === void 0 ? 0 : _ref$xOffset,
|
|
9582
|
+
_ref$yOffset = _ref.yOffset,
|
|
9583
|
+
yOffset = _ref$yOffset === void 0 ? 0 : _ref$yOffset,
|
|
9584
|
+
width = _ref.width,
|
|
9585
|
+
height = _ref.height,
|
|
9586
|
+
svgPath = _ref.svgPath;
|
|
9587
|
+
|
|
9588
|
+
var _a;
|
|
9589
|
+
|
|
9590
|
+
return _a = /*#__PURE__*/function (_React$Component) {
|
|
9591
|
+
_inheritsLoose(SVGIcon, _React$Component);
|
|
9592
|
+
|
|
9593
|
+
function SVGIcon() {
|
|
9594
|
+
var _this;
|
|
9595
|
+
|
|
9596
|
+
_this = _React$Component.apply(this, arguments) || this;
|
|
9597
|
+
_this.id = "icon-title-" + currentId++;
|
|
9598
|
+
return _this;
|
|
9599
|
+
}
|
|
9600
|
+
|
|
9601
|
+
var _proto = SVGIcon.prototype;
|
|
9602
|
+
|
|
9603
|
+
_proto.render = function render() {
|
|
9604
|
+
var _a = this.props,
|
|
9605
|
+
title = _a.title,
|
|
9606
|
+
className = _a.className,
|
|
9607
|
+
props = __rest(_a, ["title", "className"]);
|
|
9608
|
+
|
|
9609
|
+
var classes = className ? "pf-v5-svg " + className : 'pf-v5-svg';
|
|
9610
|
+
var hasTitle = Boolean(title);
|
|
9611
|
+
var viewBox = [xOffset, yOffset, width, height].join(' ');
|
|
9612
|
+
return React__namespace.createElement("svg", Object.assign({
|
|
9613
|
+
className: classes,
|
|
9614
|
+
viewBox: viewBox,
|
|
9615
|
+
fill: "currentColor",
|
|
9616
|
+
"aria-labelledby": hasTitle ? this.id : null,
|
|
9617
|
+
"aria-hidden": hasTitle ? null : true,
|
|
9618
|
+
role: "img",
|
|
9619
|
+
width: "1em",
|
|
9620
|
+
height: "1em"
|
|
9621
|
+
}, props), hasTitle && React__namespace.createElement("title", {
|
|
9622
|
+
id: this.id
|
|
9623
|
+
}, title), React__namespace.createElement("path", {
|
|
9624
|
+
d: svgPath
|
|
9625
|
+
}));
|
|
9626
|
+
};
|
|
9627
|
+
|
|
9628
|
+
return SVGIcon;
|
|
9629
|
+
}(React__namespace.Component), _a.displayName = name, _a;
|
|
9585
9630
|
}
|
|
9586
9631
|
|
|
9587
|
-
|
|
9632
|
+
var InfoCircleIconConfig = {
|
|
9588
9633
|
name: 'InfoCircleIcon',
|
|
9589
9634
|
height: 512,
|
|
9590
9635
|
width: 512,
|
|
9591
9636
|
svgPath: 'M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z',
|
|
9592
9637
|
yOffset: 0,
|
|
9593
|
-
xOffset: 0
|
|
9638
|
+
xOffset: 0
|
|
9594
9639
|
};
|
|
9640
|
+
var InfoCircleIcon = createIcon(InfoCircleIconConfig);
|
|
9595
9641
|
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
var _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange", "extraProps", "selectOptionExtraProps", "isFullWidth", "isFullHeight"];
|
|
9642
|
+
var _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange", "extraProps", "selectOptionExtraProps", "isFullWidth", "isFullHeight", "isDisabled"];
|
|
9599
9643
|
|
|
9600
9644
|
var FormSelect = function FormSelect(_ref) {
|
|
9601
9645
|
var label = _ref.label,
|
|
@@ -9613,6 +9657,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
9613
9657
|
selectOptionExtraProps = _ref.selectOptionExtraProps,
|
|
9614
9658
|
isFullWidth = _ref.isFullWidth,
|
|
9615
9659
|
isFullHeight = _ref.isFullHeight,
|
|
9660
|
+
isDisabled = _ref.isDisabled,
|
|
9616
9661
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
9617
9662
|
|
|
9618
9663
|
var _useField = formik.useField(rest),
|
|
@@ -9629,15 +9674,21 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
9629
9674
|
isOpen = _React$useState[0],
|
|
9630
9675
|
setIsOpen = _React$useState[1];
|
|
9631
9676
|
|
|
9677
|
+
var selectRef = React__namespace.useRef(null);
|
|
9678
|
+
|
|
9632
9679
|
var onToggle = function onToggle() {
|
|
9633
9680
|
setIsOpen(!isOpen);
|
|
9634
9681
|
};
|
|
9635
9682
|
|
|
9636
9683
|
var onSelect = function onSelect(_event, selection) {
|
|
9684
|
+
var _selectRef$current, _selectRef$current$pa, _selectRef$current$pa2;
|
|
9685
|
+
|
|
9637
9686
|
if (onChange) onChange(_event, selection);
|
|
9638
9687
|
setFieldValue(rest.name, selection);
|
|
9639
9688
|
validateField(rest.name);
|
|
9640
|
-
onToggle();
|
|
9689
|
+
onToggle(); // eslint-disable-next-line no-unused-expressions
|
|
9690
|
+
|
|
9691
|
+
selectRef == null ? void 0 : (_selectRef$current = selectRef.current) == null ? void 0 : (_selectRef$current$pa = _selectRef$current.parentNode) == null ? void 0 : (_selectRef$current$pa2 = _selectRef$current$pa.querySelector('button')) == null ? void 0 : _selectRef$current$pa2.focus();
|
|
9641
9692
|
};
|
|
9642
9693
|
|
|
9643
9694
|
var toggle = function toggle(toggleRef) {
|
|
@@ -9647,7 +9698,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
9647
9698
|
isExpanded: isOpen,
|
|
9648
9699
|
isFullWidth: isFullWidth,
|
|
9649
9700
|
isFullHeight: isFullHeight,
|
|
9650
|
-
isDisabled: isSubmitting
|
|
9701
|
+
isDisabled: isSubmitting || isDisabled
|
|
9651
9702
|
}, value || placeholder);
|
|
9652
9703
|
};
|
|
9653
9704
|
|
|
@@ -9667,7 +9718,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
9667
9718
|
className: 'from-group-custom__sub_info__info_icon'
|
|
9668
9719
|
})), React__namespace.createElement(reactCore.SplitItem, {
|
|
9669
9720
|
isFilled: true
|
|
9670
|
-
}, subInfo))), React__namespace.createElement(reactCore.Select,
|
|
9721
|
+
}, subInfo))), React__namespace.createElement(reactCore.Select, _extends({
|
|
9671
9722
|
"aria-labelledby": rest.name,
|
|
9672
9723
|
toggle: toggle,
|
|
9673
9724
|
onSelect: onSelect,
|
|
@@ -9679,9 +9730,10 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
9679
9730
|
"aria-label": ariaLabel,
|
|
9680
9731
|
onOpenChange: function onOpenChange() {
|
|
9681
9732
|
return setIsOpen(!isOpen);
|
|
9682
|
-
}
|
|
9733
|
+
},
|
|
9734
|
+
innerRef: selectRef
|
|
9683
9735
|
}, extraProps && _extends({}, extraProps), rest), React__namespace.createElement(reactCore.SelectList, null, lodash.map(selectOptions, function (option, index) {
|
|
9684
|
-
return React__namespace.createElement(reactCore.SelectOption,
|
|
9736
|
+
return React__namespace.createElement(reactCore.SelectOption, _extends({
|
|
9685
9737
|
key: index,
|
|
9686
9738
|
value: option.value,
|
|
9687
9739
|
"data-testid": option.key
|
package/dist/index.modern.js
CHANGED
|
@@ -9507,61 +9507,80 @@ if(freeModule){// Export for Node.js.
|
|
|
9507
9507
|
freeExports._=_;}else {// Export to the global object.
|
|
9508
9508
|
root._=_;}}).call(commonjsGlobal);});
|
|
9509
9509
|
|
|
9510
|
-
|
|
9511
|
-
Copyright (c) Microsoft Corporation.
|
|
9512
|
-
|
|
9513
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
9514
|
-
purpose with or without fee is hereby granted.
|
|
9515
|
-
|
|
9516
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9517
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9518
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
9519
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
9520
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
9521
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
9522
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
9510
|
+
/*! *****************************************************************************
|
|
9511
|
+
Copyright (c) Microsoft Corporation.
|
|
9512
|
+
|
|
9513
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
9514
|
+
purpose with or without fee is hereby granted.
|
|
9515
|
+
|
|
9516
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9517
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9518
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
9519
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
9520
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
9521
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
9522
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
9523
9523
|
***************************************************************************** */
|
|
9524
|
-
|
|
9525
9524
|
function __rest(s, e) {
|
|
9526
9525
|
var t = {};
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
}
|
|
9526
|
+
|
|
9527
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
9528
|
+
|
|
9529
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9530
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
9531
|
+
}
|
|
9534
9532
|
return t;
|
|
9535
9533
|
}
|
|
9536
9534
|
|
|
9537
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
9538
|
-
var e = new Error(message);
|
|
9539
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
9540
|
-
};
|
|
9541
|
-
|
|
9542
9535
|
let currentId = 0;
|
|
9543
9536
|
/**
|
|
9544
9537
|
* Factory to create Icon class components for consumers
|
|
9545
9538
|
*/
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9539
|
+
|
|
9540
|
+
function createIcon({
|
|
9541
|
+
name,
|
|
9542
|
+
xOffset = 0,
|
|
9543
|
+
yOffset = 0,
|
|
9544
|
+
width,
|
|
9545
|
+
height,
|
|
9546
|
+
svgPath
|
|
9547
|
+
}) {
|
|
9548
|
+
var _a;
|
|
9549
|
+
|
|
9550
|
+
return _a = class SVGIcon extends React.Component {
|
|
9551
|
+
constructor() {
|
|
9552
|
+
super(...arguments);
|
|
9553
|
+
this.id = `icon-title-${currentId++}`;
|
|
9554
|
+
}
|
|
9555
|
+
|
|
9556
|
+
render() {
|
|
9557
|
+
const _a = this.props,
|
|
9558
|
+
{
|
|
9559
|
+
title,
|
|
9560
|
+
className
|
|
9561
|
+
} = _a,
|
|
9562
|
+
props = __rest(_a, ["title", "className"]);
|
|
9563
|
+
|
|
9564
|
+
const classes = className ? `pf-v5-svg ${className}` : 'pf-v5-svg';
|
|
9565
|
+
const hasTitle = Boolean(title);
|
|
9566
|
+
const viewBox = [xOffset, yOffset, width, height].join(' ');
|
|
9567
|
+
return React.createElement("svg", Object.assign({
|
|
9568
|
+
className: classes,
|
|
9569
|
+
viewBox: viewBox,
|
|
9570
|
+
fill: "currentColor",
|
|
9571
|
+
"aria-labelledby": hasTitle ? this.id : null,
|
|
9572
|
+
"aria-hidden": hasTitle ? null : true,
|
|
9573
|
+
role: "img",
|
|
9574
|
+
width: "1em",
|
|
9575
|
+
height: "1em"
|
|
9576
|
+
}, props), hasTitle && React.createElement("title", {
|
|
9577
|
+
id: this.id
|
|
9578
|
+
}, title), React.createElement("path", {
|
|
9579
|
+
d: svgPath
|
|
9580
|
+
}));
|
|
9581
|
+
}
|
|
9582
|
+
|
|
9583
|
+
}, _a.displayName = name, _a;
|
|
9565
9584
|
}
|
|
9566
9585
|
|
|
9567
9586
|
const InfoCircleIconConfig = {
|
|
@@ -9570,12 +9589,11 @@ const InfoCircleIconConfig = {
|
|
|
9570
9589
|
width: 512,
|
|
9571
9590
|
svgPath: 'M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z',
|
|
9572
9591
|
yOffset: 0,
|
|
9573
|
-
xOffset: 0
|
|
9592
|
+
xOffset: 0
|
|
9574
9593
|
};
|
|
9575
|
-
|
|
9576
9594
|
const InfoCircleIcon = createIcon(InfoCircleIconConfig);
|
|
9577
9595
|
|
|
9578
|
-
const _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange", "extraProps", "selectOptionExtraProps", "isFullWidth", "isFullHeight"];
|
|
9596
|
+
const _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange", "extraProps", "selectOptionExtraProps", "isFullWidth", "isFullHeight", "isDisabled"];
|
|
9579
9597
|
|
|
9580
9598
|
const FormSelect = _ref => {
|
|
9581
9599
|
let {
|
|
@@ -9591,7 +9609,8 @@ const FormSelect = _ref => {
|
|
|
9591
9609
|
extraProps,
|
|
9592
9610
|
selectOptionExtraProps,
|
|
9593
9611
|
isFullWidth,
|
|
9594
|
-
isFullHeight
|
|
9612
|
+
isFullHeight,
|
|
9613
|
+
isDisabled
|
|
9595
9614
|
} = _ref,
|
|
9596
9615
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
9597
9616
|
|
|
@@ -9605,16 +9624,21 @@ const FormSelect = _ref => {
|
|
|
9605
9624
|
validateField
|
|
9606
9625
|
} = useFormikContext();
|
|
9607
9626
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
9627
|
+
const selectRef = React.useRef(null);
|
|
9608
9628
|
|
|
9609
9629
|
const onToggle = () => {
|
|
9610
9630
|
setIsOpen(!isOpen);
|
|
9611
9631
|
};
|
|
9612
9632
|
|
|
9613
9633
|
const onSelect = (_event, selection) => {
|
|
9634
|
+
var _selectRef$current, _selectRef$current$pa, _selectRef$current$pa2;
|
|
9635
|
+
|
|
9614
9636
|
if (onChange) onChange(_event, selection);
|
|
9615
9637
|
setFieldValue(rest.name, selection);
|
|
9616
9638
|
validateField(rest.name);
|
|
9617
|
-
onToggle();
|
|
9639
|
+
onToggle(); // eslint-disable-next-line no-unused-expressions
|
|
9640
|
+
|
|
9641
|
+
selectRef == null ? void 0 : (_selectRef$current = selectRef.current) == null ? void 0 : (_selectRef$current$pa = _selectRef$current.parentNode) == null ? void 0 : (_selectRef$current$pa2 = _selectRef$current$pa.querySelector('button')) == null ? void 0 : _selectRef$current$pa2.focus();
|
|
9618
9642
|
};
|
|
9619
9643
|
|
|
9620
9644
|
const toggle = toggleRef => React.createElement(MenuToggle, {
|
|
@@ -9623,7 +9647,7 @@ const FormSelect = _ref => {
|
|
|
9623
9647
|
isExpanded: isOpen,
|
|
9624
9648
|
isFullWidth: isFullWidth,
|
|
9625
9649
|
isFullHeight: isFullHeight,
|
|
9626
|
-
isDisabled: isSubmitting
|
|
9650
|
+
isDisabled: isSubmitting || isDisabled
|
|
9627
9651
|
}, value || placeholder);
|
|
9628
9652
|
|
|
9629
9653
|
return React.createElement(FormGroupContainer, {
|
|
@@ -9642,7 +9666,7 @@ const FormSelect = _ref => {
|
|
|
9642
9666
|
className: 'from-group-custom__sub_info__info_icon'
|
|
9643
9667
|
})), React.createElement(SplitItem, {
|
|
9644
9668
|
isFilled: true
|
|
9645
|
-
}, subInfo))), React.createElement(Select,
|
|
9669
|
+
}, subInfo))), React.createElement(Select, _extends({
|
|
9646
9670
|
"aria-labelledby": rest.name,
|
|
9647
9671
|
toggle: toggle,
|
|
9648
9672
|
onSelect: onSelect,
|
|
@@ -9652,8 +9676,9 @@ const FormSelect = _ref => {
|
|
|
9652
9676
|
enableFlip: false
|
|
9653
9677
|
},
|
|
9654
9678
|
"aria-label": ariaLabel,
|
|
9655
|
-
onOpenChange: () => setIsOpen(!isOpen)
|
|
9656
|
-
|
|
9679
|
+
onOpenChange: () => setIsOpen(!isOpen),
|
|
9680
|
+
innerRef: selectRef
|
|
9681
|
+
}, extraProps && _extends({}, extraProps), rest), React.createElement(SelectList, null, lodash.map(selectOptions, (option, index) => React.createElement(SelectOption, _extends({
|
|
9657
9682
|
key: index,
|
|
9658
9683
|
value: option.value,
|
|
9659
9684
|
"data-testid": option.key
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhc-shared-components/form-select-component",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "project description",
|
|
5
5
|
"author": "redhatofficial",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"react-scripts": "^3.4.1",
|
|
59
59
|
"rimraf": "^3.0.2",
|
|
60
60
|
"sass": "^1.57.1",
|
|
61
|
-
"typescript": "
|
|
61
|
+
"typescript": "~5.7.2"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@patternfly/react-core": "5.3.4",
|
package/CHANGELOG.md
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [0.1.1](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/form-select-component@0.1.0...@rhc-shared-components/form-select-component@0.1.1) (2022-10-20)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @rhc-shared-components/form-select-component
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [0.1.0](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/form-select-component@0.0.4...@rhc-shared-components/form-select-component@0.1.0) (2022-10-20)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### Features
|
|
18
|
-
|
|
19
|
-
* adding order prop for vulnerability summaries severity ([24e0c7c](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/24e0c7c992058f0c3e42e8c7ba6ad1bd98e70c4f))
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## [0.0.6](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/form-select-component@0.0.5...@rhc-shared-components/form-select-component@0.0.6) (2022-08-22)
|
|
26
|
-
|
|
27
|
-
**Note:** Version bump only for package @rhc-shared-components/form-select-component
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## [0.0.5](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/form-select-component@0.0.4...@rhc-shared-components/form-select-component@0.0.5) (2022-08-22)
|
|
34
|
-
|
|
35
|
-
**Note:** Version bump only for package @rhc-shared-components/form-select-component
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## [0.0.4](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/form-select-component@0.0.3...@rhc-shared-components/form-select-component@0.0.4) (2022-08-22)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### Bug Fixes
|
|
45
|
-
|
|
46
|
-
* added ReactNode type to subLabel prop for formselect component ([060d955](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/060d9557e708e8f1a722f158c6f07ff6416aed60))
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## [0.0.3](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/form-select-component@0.0.2...@rhc-shared-components/form-select-component@0.0.3) (2022-01-05)
|
|
53
|
-
|
|
54
|
-
**Note:** Version bump only for package @rhc-shared-components/form-select-component
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
## [0.0.2](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/form-select-component@0.0.1...@rhc-shared-components/form-select-component@0.0.2) (2021-12-29)
|
|
61
|
-
|
|
62
|
-
**Note:** Version bump only for package @rhc-shared-components/form-select-component
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
## 0.0.1 (2021-12-06)
|
|
69
|
-
|
|
70
|
-
**Note:** Version bump only for package @rhc-shared-components/form-select-component
|