@agility/plenum-ui 1.3.15 → 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,8 +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
- React__default["default"].createElement("span", null, label)));
7096
+ label && React__default["default"].createElement("span", null, label)));
7095
7097
  };
7096
7098
  var _Button = React.forwardRef(Button);
7097
7099
 
@@ -12469,6 +12471,12 @@ var TextInput = function (_a, ref) {
12469
12471
  var _d = React.useState(false); _d[0]; var setIsActive = _d[1];
12470
12472
  var _e = React.useState(externalValue || defaultValue || ""), value = _e[0], setValue = _e[1];
12471
12473
  var inputRef = React.useRef(null);
12474
+ React.useEffect(function () {
12475
+ //if the external value is updated by the parent component, reset the value in here...
12476
+ if (externalValue !== undefined && externalValue !== null) {
12477
+ setValue(externalValue);
12478
+ }
12479
+ }, [externalValue]);
12472
12480
  // set force focus
12473
12481
  React.useEffect(function () {
12474
12482
  var input = inputRef.current;
@@ -12757,13 +12765,18 @@ var _Textarea = React.forwardRef(Textarea);
12757
12765
 
12758
12766
  /** Comment */
12759
12767
  var Select = function (_a) {
12760
- 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;
12761
- 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];
12762
12770
  var uniqueID = useId();
12763
12771
  if (!id)
12764
12772
  id = "select-".concat(uniqueID);
12765
12773
  if (!name)
12766
12774
  name = id;
12775
+ React.useEffect(function () {
12776
+ if (value !== undefined && value !== null) {
12777
+ setSelectedOption(value);
12778
+ }
12779
+ }, [value]);
12767
12780
  var handleChange = function (e) {
12768
12781
  var targetValue = e.target.value;
12769
12782
  typeof onChange == "function" && onChange(targetValue);