@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.
@@ -39,6 +39,8 @@ export interface ButtonProps {
39
39
  * Add on classes
40
40
  */
41
41
  className?: string;
42
+ iconObj?: React.ReactNode;
43
+ title?: string;
42
44
  }
43
45
  declare const _Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
44
46
  export { _Button as Button };
@@ -20,6 +20,7 @@ export interface SimpleSelectProps {
20
20
  isError?: boolean;
21
21
  /** Select required state */
22
22
  isRequired?: boolean;
23
+ value?: string;
23
24
  }
24
25
  /** Comment */
25
26
  export declare const Select: FC<SimpleSelectProps>;
package/lib/index.esm.js CHANGED
@@ -7050,9 +7050,9 @@ function Loader(_a) {
7050
7050
  * Primary UI component for user interaction
7051
7051
  */
7052
7052
  var Button = function (_a, ref) {
7053
- 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;
7053
+ 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;
7054
7054
  var iconStyles = cn("h-5 w-5", { "text-white": type === "primary" || type === "danger" }, { "text-purple-700": type === "secondary" }, { "text-gray-700": type === "alternative" });
7055
- return (React__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 }, {
7055
+ return (React__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 }, {
7056
7056
  "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"
7057
7057
  }, {
7058
7058
  "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"
@@ -7064,9 +7064,10 @@ var Button = function (_a, ref) {
7064
7064
  ? onClick
7065
7065
  : function () {
7066
7066
  } },
7067
+ iconObj &&
7068
+ (isLoading ? (React__default.createElement(Loader, { classes: "h-5 w-5 border-2" })) : (React__default.createElement(React__default.Fragment, null, iconObj))),
7067
7069
  icon ? (isLoading ? (React__default.createElement(Loader, { classes: "h-5 w-5 border-2" })) : (React__default.createElement(DynamicIcons, { icon: icon, className: iconStyles, outline: false }))) : (isLoading && React__default.createElement(Loader, { classes: "h-5 w-5 border-2" })),
7068
- label &&
7069
- React__default.createElement("span", null, label)));
7070
+ label && React__default.createElement("span", null, label)));
7070
7071
  };
7071
7072
  var _Button = forwardRef(Button);
7072
7073
 
@@ -12738,13 +12739,18 @@ var _Textarea = forwardRef(Textarea);
12738
12739
 
12739
12740
  /** Comment */
12740
12741
  var Select = function (_a) {
12741
- 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;
12742
- var _b = useState(options[0].value), selectedOption = _b[0], setSelectedOption = _b[1];
12742
+ 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;
12743
+ var _b = useState(value || options[0].value), selectedOption = _b[0], setSelectedOption = _b[1];
12743
12744
  var uniqueID = useId();
12744
12745
  if (!id)
12745
12746
  id = "select-".concat(uniqueID);
12746
12747
  if (!name)
12747
12748
  name = id;
12749
+ useEffect(function () {
12750
+ if (value !== undefined && value !== null) {
12751
+ setSelectedOption(value);
12752
+ }
12753
+ }, [value]);
12748
12754
  var handleChange = function (e) {
12749
12755
  var targetValue = e.target.value;
12750
12756
  typeof onChange == "function" && onChange(targetValue);