@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.
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
|
|
|
@@ -12763,23 +12765,27 @@ var _Textarea = React.forwardRef(Textarea);
|
|
|
12763
12765
|
|
|
12764
12766
|
/** Comment */
|
|
12765
12767
|
var Select = function (_a) {
|
|
12766
|
-
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;
|
|
12767
|
-
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, className = _a.className;
|
|
12769
|
+
var _b = React.useState(value || options[0].value), selectedOption = _b[0], setSelectedOption = _b[1];
|
|
12768
12770
|
var uniqueID = useId();
|
|
12769
12771
|
if (!id)
|
|
12770
12772
|
id = "select-".concat(uniqueID);
|
|
12771
12773
|
if (!name)
|
|
12772
12774
|
name = id;
|
|
12775
|
+
React.useEffect(function () {
|
|
12776
|
+
if (value !== undefined && value !== null) {
|
|
12777
|
+
setSelectedOption(value);
|
|
12778
|
+
}
|
|
12779
|
+
}, [value]);
|
|
12773
12780
|
var handleChange = function (e) {
|
|
12774
12781
|
var targetValue = e.target.value;
|
|
12775
12782
|
typeof onChange == "function" && onChange(targetValue);
|
|
12776
12783
|
setSelectedOption(targetValue);
|
|
12777
12784
|
};
|
|
12778
|
-
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 });
|
|
12779
12785
|
var wrapperStyle = cn({ "opacity-50": isDisabled });
|
|
12780
12786
|
return (React__default["default"].createElement("div", { className: wrapperStyle },
|
|
12781
12787
|
label && (React__default["default"].createElement(InputLabel, { isPlaceholder: true, isActive: true, label: label, isRequired: isRequired, id: id, isError: isError, isDisabled: isDisabled })),
|
|
12782
|
-
React__default["default"].createElement("select", { id: id, name: name, className:
|
|
12788
|
+
React__default["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) {
|
|
12783
12789
|
var value = _a.value, label = _a.label;
|
|
12784
12790
|
return (React__default["default"].createElement("option", { key: value, value: value }, label));
|
|
12785
12791
|
}))));
|