@agility/plenum-ui 1.3.16 → 1.3.19

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.
@@ -13,7 +13,7 @@ export interface ButtonProps {
13
13
  /**
14
14
  * Button contents
15
15
  */
16
- label: string;
16
+ label?: string;
17
17
  /**
18
18
  * An optional icon
19
19
  */
@@ -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,8 @@ export interface SimpleSelectProps {
20
20
  isError?: boolean;
21
21
  /** Select required state */
22
22
  isRequired?: boolean;
23
+ value?: string;
24
+ className?: string;
23
25
  }
24
26
  /** Comment */
25
27
  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,8 +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
- React__default.createElement("span", null, label)));
7070
+ label && React__default.createElement("span", null, label)));
7069
7071
  };
7070
7072
  var _Button = forwardRef(Button);
7071
7073
 
@@ -12737,23 +12739,27 @@ var _Textarea = forwardRef(Textarea);
12737
12739
 
12738
12740
  /** Comment */
12739
12741
  var Select = function (_a) {
12740
- 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;
12741
- 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, className = _a.className;
12743
+ var _b = useState(value || options[0].value), selectedOption = _b[0], setSelectedOption = _b[1];
12742
12744
  var uniqueID = useId();
12743
12745
  if (!id)
12744
12746
  id = "select-".concat(uniqueID);
12745
12747
  if (!name)
12746
12748
  name = id;
12749
+ useEffect(function () {
12750
+ if (value !== undefined && value !== null) {
12751
+ setSelectedOption(value);
12752
+ }
12753
+ }, [value]);
12747
12754
  var handleChange = function (e) {
12748
12755
  var targetValue = e.target.value;
12749
12756
  typeof onChange == "function" && onChange(targetValue);
12750
12757
  setSelectedOption(targetValue);
12751
12758
  };
12752
- var selectStyles = cn("block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none", "focus:ring-purple-500 focus:border-purple-500 sm:text-sm rounded", { "border-red-500": isError }, { "border-gray-300": !isError });
12753
12759
  var wrapperStyle = cn({ "opacity-50": isDisabled });
12754
12760
  return (React__default.createElement("div", { className: wrapperStyle },
12755
12761
  label && (React__default.createElement(InputLabel, { isPlaceholder: true, isActive: true, label: label, isRequired: isRequired, id: id, isError: isError, isDisabled: isDisabled })),
12756
- React__default.createElement("select", { id: id, name: name, className: selectStyles, onChange: handleChange, disabled: isDisabled, value: selectedOption }, options.map(function (_a) {
12762
+ React__default.createElement("select", { id: id, name: name, className: cn("block w-full border-gray-300 py-2 pl-3 pr-10 text-base focus:outline-none", "rounded focus:border-purple-500 focus:ring-purple-500 sm:text-sm", { "border-red-500": isError }, { "border-gray-300": !isError }, className), onChange: handleChange, disabled: isDisabled, value: selectedOption }, options.map(function (_a) {
12757
12763
  var value = _a.value, label = _a.label;
12758
12764
  return (React__default.createElement("option", { key: value, value: value }, label));
12759
12765
  }))));