@rhc-shared-components/form-select-component 0.2.0 → 1.0.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.
@@ -22,6 +22,8 @@ export interface FormSelectProps {
22
22
  onChange?: (_event: any, selection: any) => void;
23
23
  extraProps?: any;
24
24
  selectOptionExtraProps?: any;
25
+ isFullWidth?: boolean;
26
+ isFullHeight?: boolean;
25
27
  }
26
28
  declare const FormSelect: React.FC<FormSelectProps>;
27
29
  export default FormSelect;
package/dist/index.js CHANGED
@@ -41,22 +41,6 @@ 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
-
60
44
  function _objectWithoutPropertiesLoose(source, excluded) {
61
45
  if (source == null) return {};
62
46
  var target = {};
@@ -9543,140 +9527,75 @@ if(freeModule){// Export for Node.js.
9543
9527
  freeExports._=_;}else {// Export to the global object.
9544
9528
  root._=_;}}).call(commonjsGlobal);});
9545
9529
 
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.
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.
9559
9543
  ***************************************************************************** */
9544
+
9560
9545
  function __rest(s, e) {
9561
9546
  var t = {};
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
- }
9547
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
9548
+ t[p] = s[p];
9549
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
9550
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
9551
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9552
+ t[p[i]] = s[p[i]];
9553
+ }
9570
9554
  return t;
9571
9555
  }
9572
9556
 
9573
- var IconSize;
9574
-
9575
- (function (IconSize) {
9576
- IconSize["sm"] = "sm";
9577
- IconSize["md"] = "md";
9578
- IconSize["lg"] = "lg";
9579
- IconSize["xl"] = "xl";
9580
- })(IconSize || (IconSize = {}));
9581
-
9582
- var getSize = function getSize(size) {
9583
- switch (size) {
9584
- case IconSize.sm:
9585
- return '1em';
9586
-
9587
- case IconSize.md:
9588
- return '1.5em';
9589
-
9590
- case IconSize.lg:
9591
- return '2em';
9592
-
9593
- case IconSize.xl:
9594
- return '3em';
9595
-
9596
- default:
9597
- return '1em';
9598
- }
9557
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
9558
+ var e = new Error(message);
9559
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
9599
9560
  };
9600
- var currentId = 0;
9561
+
9562
+ let currentId = 0;
9601
9563
  /**
9602
9564
  * Factory to create Icon class components for consumers
9603
9565
  */
9604
-
9605
- function createIcon(_ref) {
9606
- var name = _ref.name,
9607
- _ref$xOffset = _ref.xOffset,
9608
- xOffset = _ref$xOffset === void 0 ? 0 : _ref$xOffset,
9609
- _ref$yOffset = _ref.yOffset,
9610
- yOffset = _ref$yOffset === void 0 ? 0 : _ref$yOffset,
9611
- width = _ref.width,
9612
- height = _ref.height,
9613
- svgPath = _ref.svgPath;
9614
-
9615
- var _a;
9616
-
9617
- return _a = /*#__PURE__*/function (_React$Component) {
9618
- _inheritsLoose(SVGIcon, _React$Component);
9619
-
9620
- function SVGIcon() {
9621
- var _this;
9622
-
9623
- _this = _React$Component.apply(this, arguments) || this;
9624
- _this.id = "icon-title-" + currentId++;
9625
- return _this;
9626
- }
9627
-
9628
- var _proto = SVGIcon.prototype;
9629
-
9630
- _proto.render = function render() {
9631
- var _a = this.props,
9632
- size = _a.size,
9633
- color = _a.color,
9634
- title = _a.title,
9635
- noVerticalAlign = _a.noVerticalAlign,
9636
- props = __rest(_a, ["size", "color", "title", "noVerticalAlign"]);
9637
-
9638
- var hasTitle = Boolean(title);
9639
- var heightWidth = getSize(size);
9640
- var baseAlign = -0.125 * Number.parseFloat(heightWidth);
9641
- var style = noVerticalAlign ? null : {
9642
- verticalAlign: baseAlign + "em"
9643
- };
9644
- var viewBox = [xOffset, yOffset, width, height].join(' ');
9645
- return React__namespace.createElement("svg", Object.assign({
9646
- style: style,
9647
- fill: color,
9648
- height: heightWidth,
9649
- width: heightWidth,
9650
- viewBox: viewBox,
9651
- "aria-labelledby": hasTitle ? this.id : null,
9652
- "aria-hidden": hasTitle ? null : true,
9653
- role: "img"
9654
- }, props), hasTitle && React__namespace.createElement("title", {
9655
- id: this.id
9656
- }, title), React__namespace.createElement("path", {
9657
- d: svgPath
9658
- }));
9659
- };
9660
-
9661
- return SVGIcon;
9662
- }(React__namespace.Component), _a.displayName = name, _a.defaultProps = {
9663
- color: 'currentColor',
9664
- size: IconSize.sm,
9665
- noVerticalAlign: false
9666
- }, _a;
9566
+ function createIcon({ name, xOffset = 0, yOffset = 0, width, height, svgPath }) {
9567
+ var _a;
9568
+ return _a = class SVGIcon extends React__namespace.Component {
9569
+ constructor() {
9570
+ super(...arguments);
9571
+ this.id = `icon-title-${currentId++}`;
9572
+ }
9573
+ render() {
9574
+ const _a = this.props, { title, className } = _a, props = __rest(_a, ["title", "className"]);
9575
+ const classes = className ? `pf-v5-svg ${className}` : 'pf-v5-svg';
9576
+ const hasTitle = Boolean(title);
9577
+ const viewBox = [xOffset, yOffset, width, height].join(' ');
9578
+ return (React__namespace.createElement("svg", Object.assign({ className: classes, viewBox: viewBox, fill: "currentColor", "aria-labelledby": hasTitle ? this.id : null, "aria-hidden": hasTitle ? null : true, role: "img", width: "1em", height: "1em" }, props),
9579
+ hasTitle && React__namespace.createElement("title", { id: this.id }, title),
9580
+ React__namespace.createElement("path", { d: svgPath })));
9581
+ }
9582
+ },
9583
+ _a.displayName = name,
9584
+ _a;
9667
9585
  }
9668
9586
 
9669
- var InfoCircleIconConfig = {
9587
+ const InfoCircleIconConfig = {
9670
9588
  name: 'InfoCircleIcon',
9671
9589
  height: 512,
9672
9590
  width: 512,
9673
9591
  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',
9674
9592
  yOffset: 0,
9675
- xOffset: 0
9593
+ xOffset: 0,
9676
9594
  };
9677
- var InfoCircleIcon = createIcon(InfoCircleIconConfig);
9678
9595
 
9679
- var _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange", "extraProps", "selectOptionExtraProps"];
9596
+ const InfoCircleIcon = createIcon(InfoCircleIconConfig);
9597
+
9598
+ var _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange", "extraProps", "selectOptionExtraProps", "isFullWidth", "isFullHeight"];
9680
9599
 
9681
9600
  var FormSelect = function FormSelect(_ref) {
9682
9601
  var label = _ref.label,
@@ -9691,6 +9610,8 @@ var FormSelect = function FormSelect(_ref) {
9691
9610
  onChange = _ref.onChange,
9692
9611
  extraProps = _ref.extraProps,
9693
9612
  selectOptionExtraProps = _ref.selectOptionExtraProps,
9613
+ isFullWidth = _ref.isFullWidth,
9614
+ isFullHeight = _ref.isFullHeight,
9694
9615
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
9695
9616
 
9696
9617
  var _useField = formik.useField(rest),
@@ -9722,17 +9643,21 @@ var FormSelect = function FormSelect(_ref) {
9722
9643
  onToggle();
9723
9644
  };
9724
9645
 
9646
+ var toggle = function toggle(toggleRef) {
9647
+ return React__namespace.createElement(reactCore.MenuToggle, {
9648
+ ref: toggleRef,
9649
+ onClick: onToggle,
9650
+ placeholder: placeholder || 'Select an option',
9651
+ isExpanded: isOpen,
9652
+ isFullWidth: isFullWidth,
9653
+ isFullHeight: isFullHeight,
9654
+ isDisabled: isSubmitting
9655
+ }, selected);
9656
+ };
9657
+
9725
9658
  React__namespace.useEffect(function () {
9726
9659
  setSelected(value);
9727
- }, [value]); // React.useEffect(() => {
9728
- // // Code to reset check mark when the options are changed
9729
- // if (value) {
9730
- // setFieldValue(rest.name, '');
9731
- // validateField(rest.name);
9732
- // }
9733
- // // eslint-disable-next-line
9734
- // }, [selectOptions]);
9735
-
9660
+ }, [value]);
9736
9661
  return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(formGroupContainer.FormGroupContainer, {
9737
9662
  validated: meta.touched && meta.error ? reactCore.ValidatedOptions.error : reactCore.ValidatedOptions["default"],
9738
9663
  helperTextInvalid: meta.error,
@@ -9750,17 +9675,19 @@ var FormSelect = function FormSelect(_ref) {
9750
9675
  })), React__namespace.createElement(reactCore.SplitItem, {
9751
9676
  isFilled: true
9752
9677
  }, subInfo))), React__namespace.createElement(reactCore.Select, Object.assign({
9753
- variant: reactCore.SelectVariant.single,
9754
9678
  "aria-labelledby": rest.name,
9755
- typeAheadAriaLabel: placeholder || 'Select an option',
9756
- placeholderText: placeholder || 'Select an option',
9757
- onToggle: onToggle,
9679
+ toggle: toggle,
9758
9680
  onSelect: onSelect,
9759
- selections: selected,
9681
+ selected: selected,
9760
9682
  isOpen: isOpen,
9761
- isDisabled: isSubmitting,
9762
- "aria-label": ariaLabel
9763
- }, extraProps && _extends({}, extraProps), rest), lodash.map(selectOptions, function (option, index) {
9683
+ popperProps: {
9684
+ enableFlip: false
9685
+ },
9686
+ "aria-label": ariaLabel,
9687
+ onOpenChange: function onOpenChange() {
9688
+ return setIsOpen(!isOpen);
9689
+ }
9690
+ }, extraProps && _extends({}, extraProps), rest), React__namespace.createElement(reactCore.SelectList, null, lodash.map(selectOptions, function (option, index) {
9764
9691
  return React__namespace.createElement(reactCore.SelectOption, Object.assign({
9765
9692
  key: index,
9766
9693
  value: option.value,
@@ -9771,8 +9698,8 @@ var FormSelect = function FormSelect(_ref) {
9771
9698
  isPlaceholder: option.isPlaceholder
9772
9699
  }, option.isDisabled && {
9773
9700
  isDisabled: option.isDisabled
9774
- }, selectOptionExtraProps && _extends({}, selectOptionExtraProps)));
9775
- }))));
9701
+ }, selectOptionExtraProps && _extends({}, selectOptionExtraProps)), option.value);
9702
+ })))));
9776
9703
  };
9777
9704
 
9778
9705
  exports.FormSelect = FormSelect;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useField, useFormikContext } from 'formik';
3
- import { ValidatedOptions, Split, SplitItem, Select, SelectVariant, SelectOption } from '@patternfly/react-core';
3
+ import { ValidatedOptions, Split, SplitItem, Select, SelectList, SelectOption, MenuToggle } from '@patternfly/react-core';
4
4
  import { FormGroupContainer } from '@rhc-shared-components/form-group-container';
5
5
 
6
6
  function _extends() {
@@ -9507,117 +9507,61 @@ 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
+
9524
9525
  function __rest(s, e) {
9525
9526
  var t = {};
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
- }
9527
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
9528
+ t[p] = s[p];
9529
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
9530
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
9531
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9532
+ t[p[i]] = s[p[i]];
9533
+ }
9532
9534
  return t;
9533
9535
  }
9534
9536
 
9535
- var IconSize;
9536
-
9537
- (function (IconSize) {
9538
- IconSize["sm"] = "sm";
9539
- IconSize["md"] = "md";
9540
- IconSize["lg"] = "lg";
9541
- IconSize["xl"] = "xl";
9542
- })(IconSize || (IconSize = {}));
9543
-
9544
- const getSize = size => {
9545
- switch (size) {
9546
- case IconSize.sm:
9547
- return '1em';
9548
-
9549
- case IconSize.md:
9550
- return '1.5em';
9551
-
9552
- case IconSize.lg:
9553
- return '2em';
9554
-
9555
- case IconSize.xl:
9556
- return '3em';
9557
-
9558
- default:
9559
- return '1em';
9560
- }
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;
9561
9540
  };
9541
+
9562
9542
  let currentId = 0;
9563
9543
  /**
9564
9544
  * Factory to create Icon class components for consumers
9565
9545
  */
9566
-
9567
- function createIcon({
9568
- name,
9569
- xOffset = 0,
9570
- yOffset = 0,
9571
- width,
9572
- height,
9573
- svgPath
9574
- }) {
9575
- var _a;
9576
-
9577
- return _a = class SVGIcon extends React.Component {
9578
- constructor() {
9579
- super(...arguments);
9580
- this.id = `icon-title-${currentId++}`;
9581
- }
9582
-
9583
- render() {
9584
- const _a = this.props,
9585
- {
9586
- size,
9587
- color,
9588
- title,
9589
- noVerticalAlign
9590
- } = _a,
9591
- props = __rest(_a, ["size", "color", "title", "noVerticalAlign"]);
9592
-
9593
- const hasTitle = Boolean(title);
9594
- const heightWidth = getSize(size);
9595
- const baseAlign = -0.125 * Number.parseFloat(heightWidth);
9596
- const style = noVerticalAlign ? null : {
9597
- verticalAlign: `${baseAlign}em`
9598
- };
9599
- const viewBox = [xOffset, yOffset, width, height].join(' ');
9600
- return React.createElement("svg", Object.assign({
9601
- style: style,
9602
- fill: color,
9603
- height: heightWidth,
9604
- width: heightWidth,
9605
- viewBox: viewBox,
9606
- "aria-labelledby": hasTitle ? this.id : null,
9607
- "aria-hidden": hasTitle ? null : true,
9608
- role: "img"
9609
- }, props), hasTitle && React.createElement("title", {
9610
- id: this.id
9611
- }, title), React.createElement("path", {
9612
- d: svgPath
9613
- }));
9614
- }
9615
-
9616
- }, _a.displayName = name, _a.defaultProps = {
9617
- color: 'currentColor',
9618
- size: IconSize.sm,
9619
- noVerticalAlign: false
9620
- }, _a;
9546
+ function createIcon({ name, xOffset = 0, yOffset = 0, width, height, svgPath }) {
9547
+ var _a;
9548
+ return _a = class SVGIcon extends React.Component {
9549
+ constructor() {
9550
+ super(...arguments);
9551
+ this.id = `icon-title-${currentId++}`;
9552
+ }
9553
+ render() {
9554
+ const _a = this.props, { title, className } = _a, props = __rest(_a, ["title", "className"]);
9555
+ const classes = className ? `pf-v5-svg ${className}` : 'pf-v5-svg';
9556
+ const hasTitle = Boolean(title);
9557
+ const viewBox = [xOffset, yOffset, width, height].join(' ');
9558
+ return (React.createElement("svg", Object.assign({ className: classes, viewBox: viewBox, fill: "currentColor", "aria-labelledby": hasTitle ? this.id : null, "aria-hidden": hasTitle ? null : true, role: "img", width: "1em", height: "1em" }, props),
9559
+ hasTitle && React.createElement("title", { id: this.id }, title),
9560
+ React.createElement("path", { d: svgPath })));
9561
+ }
9562
+ },
9563
+ _a.displayName = name,
9564
+ _a;
9621
9565
  }
9622
9566
 
9623
9567
  const InfoCircleIconConfig = {
@@ -9626,11 +9570,12 @@ const InfoCircleIconConfig = {
9626
9570
  width: 512,
9627
9571
  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',
9628
9572
  yOffset: 0,
9629
- xOffset: 0
9573
+ xOffset: 0,
9630
9574
  };
9575
+
9631
9576
  const InfoCircleIcon = createIcon(InfoCircleIconConfig);
9632
9577
 
9633
- const _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange", "extraProps", "selectOptionExtraProps"];
9578
+ const _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "subLabel", "subInfo", "onChange", "extraProps", "selectOptionExtraProps", "isFullWidth", "isFullHeight"];
9634
9579
 
9635
9580
  const FormSelect = _ref => {
9636
9581
  let {
@@ -9644,7 +9589,9 @@ const FormSelect = _ref => {
9644
9589
  subInfo,
9645
9590
  onChange,
9646
9591
  extraProps,
9647
- selectOptionExtraProps
9592
+ selectOptionExtraProps,
9593
+ isFullWidth,
9594
+ isFullHeight
9648
9595
  } = _ref,
9649
9596
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
9650
9597
 
@@ -9671,17 +9618,19 @@ const FormSelect = _ref => {
9671
9618
  onToggle();
9672
9619
  };
9673
9620
 
9621
+ const toggle = toggleRef => React.createElement(MenuToggle, {
9622
+ ref: toggleRef,
9623
+ onClick: onToggle,
9624
+ placeholder: placeholder || 'Select an option',
9625
+ isExpanded: isOpen,
9626
+ isFullWidth: isFullWidth,
9627
+ isFullHeight: isFullHeight,
9628
+ isDisabled: isSubmitting
9629
+ }, selected);
9630
+
9674
9631
  React.useEffect(() => {
9675
9632
  setSelected(value);
9676
- }, [value]); // React.useEffect(() => {
9677
- // // Code to reset check mark when the options are changed
9678
- // if (value) {
9679
- // setFieldValue(rest.name, '');
9680
- // validateField(rest.name);
9681
- // }
9682
- // // eslint-disable-next-line
9683
- // }, [selectOptions]);
9684
-
9633
+ }, [value]);
9685
9634
  return React.createElement(React.Fragment, null, React.createElement(FormGroupContainer, {
9686
9635
  validated: meta.touched && meta.error ? ValidatedOptions.error : ValidatedOptions.default,
9687
9636
  helperTextInvalid: meta.error,
@@ -9699,17 +9648,17 @@ const FormSelect = _ref => {
9699
9648
  })), React.createElement(SplitItem, {
9700
9649
  isFilled: true
9701
9650
  }, subInfo))), React.createElement(Select, Object.assign({
9702
- variant: SelectVariant.single,
9703
9651
  "aria-labelledby": rest.name,
9704
- typeAheadAriaLabel: placeholder || 'Select an option',
9705
- placeholderText: placeholder || 'Select an option',
9706
- onToggle: onToggle,
9652
+ toggle: toggle,
9707
9653
  onSelect: onSelect,
9708
- selections: selected,
9654
+ selected: selected,
9709
9655
  isOpen: isOpen,
9710
- isDisabled: isSubmitting,
9711
- "aria-label": ariaLabel
9712
- }, extraProps && _extends({}, extraProps), rest), lodash.map(selectOptions, (option, index) => React.createElement(SelectOption, Object.assign({
9656
+ popperProps: {
9657
+ enableFlip: false
9658
+ },
9659
+ "aria-label": ariaLabel,
9660
+ onOpenChange: () => setIsOpen(!isOpen)
9661
+ }, extraProps && _extends({}, extraProps), rest), React.createElement(SelectList, null, lodash.map(selectOptions, (option, index) => React.createElement(SelectOption, Object.assign({
9713
9662
  key: index,
9714
9663
  value: option.value,
9715
9664
  "data-testid": option.key
@@ -9719,7 +9668,7 @@ const FormSelect = _ref => {
9719
9668
  isPlaceholder: option.isPlaceholder
9720
9669
  }, option.isDisabled && {
9721
9670
  isDisabled: option.isDisabled
9722
- }, selectOptionExtraProps && _extends({}, selectOptionExtraProps)))))));
9671
+ }, selectOptionExtraProps && _extends({}, selectOptionExtraProps)), option.value))))));
9723
9672
  };
9724
9673
 
9725
9674
  export { FormSelect };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhc-shared-components/form-select-component",
3
- "version": "0.2.0",
3
+ "version": "1.0.0",
4
4
  "description": "project description",
5
5
  "author": "redhatofficial",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "predeploy": "cd example && yarn install && yarn run build"
25
25
  },
26
26
  "peerDependencies": {
27
- "@patternfly/react-core": ">=4.101.3",
27
+ "@patternfly/react-core": ">=5.3.4",
28
28
  "formik": ">=2.1.4",
29
29
  "react": ">=16.13.1",
30
30
  "react-dom": ">=16.13.1"
@@ -62,7 +62,7 @@
62
62
  "typescript": "^3.7.5"
63
63
  },
64
64
  "dependencies": {
65
- "@patternfly/react-core": "^4.276.6",
65
+ "@patternfly/react-core": "5.3.4",
66
66
  "@rhc-shared-components/form-group-container": "^1.0.1",
67
67
  "formik": "^2.1.4",
68
68
  "react": "^16.13.1",