@agility/plenum-ui 1.3.17 → 1.3.18

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/lib/index.js CHANGED
@@ -7076,9 +7076,9 @@ function Loader(_a) {
7076
7076
  * Primary UI component for user interaction
7077
7077
  */
7078
7078
  var Button = function (_a, ref) {
7079
- var _b = _a.type, type = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "base" : _c, onClick = _a.onClick, label = _a.label, isDisabled = _a.isDisabled, icon = _a.icon, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, _e = _a.isSubmit, isSubmit = _e === void 0 ? false : _e, _f = _a.isWidthFull, isWidthFull = _f === void 0 ? false : _f, className = _a.className;
7079
+ var _b = _a.type, type = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "base" : _c, onClick = _a.onClick, label = _a.label, isDisabled = _a.isDisabled, icon = _a.icon, iconObj = _a.iconObj, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, _e = _a.isSubmit, isSubmit = _e === void 0 ? false : _e, _f = _a.isWidthFull, isWidthFull = _f === void 0 ? false : _f, className = _a.className, title = _a.title;
7080
7080
  var iconStyles = cn("h-5 w-5", { "text-white": type === "primary" || type === "danger" }, { "text-purple-700": type === "secondary" }, { "text-gray-700": type === "alternative" });
7081
- return (React__default["default"].createElement("button", { ref: ref, type: isSubmit ? "submit" : "button", className: cn("inline-flex items-center justify-center space-x-2 rounded border transition-all", { "w-full": isWidthFull === true }, { "px-4 py-2 text-sm": size === "sm" }, { "px-5 py-2 text-base": size === "base" }, { "px-5 py-2 text-lg": size === "lg" }, { "cursor-auto opacity-50": isDisabled }, {
7081
+ return (React__default["default"].createElement("button", { ref: ref, type: isSubmit ? "submit" : "button", title: title, className: cn("inline-flex items-center justify-center space-x-2 rounded border transition-all", { "w-full": isWidthFull === true }, { "px-4 py-2 text-sm": size === "sm" }, { "px-5 py-2 text-base": size === "base" }, { "px-5 py-2 text-lg": size === "lg" }, { "cursor-auto opacity-50": isDisabled }, {
7082
7082
  "border-purple-600 bg-purple-600 text-white hover:border-purple-700 hover:bg-purple-700 active:border-purple-800 active:bg-purple-800": type === "primary"
7083
7083
  }, {
7084
7084
  "border-purple-100 bg-purple-100 text-purple-700 hover:border-purple-200 hover:bg-purple-200 hover:text-purple-700 active:border-purple-300 active:bg-purple-300": type === "secondary"
@@ -7090,9 +7090,10 @@ var Button = function (_a, ref) {
7090
7090
  ? onClick
7091
7091
  : function () {
7092
7092
  } },
7093
+ iconObj &&
7094
+ (isLoading ? (React__default["default"].createElement(Loader, { classes: "h-5 w-5 border-2" })) : (React__default["default"].createElement(React__default["default"].Fragment, null, iconObj))),
7093
7095
  icon ? (isLoading ? (React__default["default"].createElement(Loader, { classes: "h-5 w-5 border-2" })) : (React__default["default"].createElement(DynamicIcons, { icon: icon, className: iconStyles, outline: false }))) : (isLoading && React__default["default"].createElement(Loader, { classes: "h-5 w-5 border-2" })),
7094
- label &&
7095
- React__default["default"].createElement("span", null, label)));
7096
+ label && React__default["default"].createElement("span", null, label)));
7096
7097
  };
7097
7098
  var _Button = React.forwardRef(Button);
7098
7099
 
@@ -12764,13 +12765,18 @@ var _Textarea = React.forwardRef(Textarea);
12764
12765
 
12765
12766
  /** Comment */
12766
12767
  var Select = function (_a) {
12767
- var label = _a.label, id = _a.id, name = _a.name, options = _a.options, onChange = _a.onChange, isDisabled = _a.isDisabled, isError = _a.isError, isRequired = _a.isRequired;
12768
- var _b = React.useState(options[0].value), selectedOption = _b[0], setSelectedOption = _b[1];
12768
+ var label = _a.label, id = _a.id, name = _a.name, options = _a.options, onChange = _a.onChange, isDisabled = _a.isDisabled, isError = _a.isError, isRequired = _a.isRequired, value = _a.value;
12769
+ var _b = React.useState(value || options[0].value), selectedOption = _b[0], setSelectedOption = _b[1];
12769
12770
  var uniqueID = useId();
12770
12771
  if (!id)
12771
12772
  id = "select-".concat(uniqueID);
12772
12773
  if (!name)
12773
12774
  name = id;
12775
+ React.useEffect(function () {
12776
+ if (value !== undefined && value !== null) {
12777
+ setSelectedOption(value);
12778
+ }
12779
+ }, [value]);
12774
12780
  var handleChange = function (e) {
12775
12781
  var targetValue = e.target.value;
12776
12782
  typeof onChange == "function" && onChange(targetValue);