@agility/plenum-ui 1.3.17 → 1.3.20
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/components/Button/Button.d.ts +2 -0
- package/lib/components/Forms/Checkbox/Checkbox.d.ts +1 -1
- package/lib/components/Forms/Select/Select.d.ts +2 -0
- package/lib/index.esm.js +16 -8
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +16 -8
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
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,23 +12765,27 @@ 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, className = _a.className;
|
|
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);
|
|
12777
12783
|
setSelectedOption(targetValue);
|
|
12778
12784
|
};
|
|
12779
|
-
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 });
|
|
12780
12785
|
var wrapperStyle = cn({ "opacity-50": isDisabled });
|
|
12781
12786
|
return (React__default["default"].createElement("div", { className: wrapperStyle },
|
|
12782
12787
|
label && (React__default["default"].createElement(InputLabel, { isPlaceholder: true, isActive: true, label: label, isRequired: isRequired, id: id, isError: isError, isDisabled: isDisabled })),
|
|
12783
|
-
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) {
|
|
12784
12789
|
var value = _a.value, label = _a.label;
|
|
12785
12790
|
return (React__default["default"].createElement("option", { key: value, value: value }, label));
|
|
12786
12791
|
}))));
|
|
@@ -12789,6 +12794,9 @@ var Select = function (_a) {
|
|
|
12789
12794
|
/** Comment */
|
|
12790
12795
|
var Checkbox = function (_a) {
|
|
12791
12796
|
var label = _a.label, id = _a.id, isDisabled = _a.isDisabled, isChecked = _a.isChecked, isRequired = _a.isRequired, isError = _a.isError, message = _a.message, value = _a.value, onChange = _a.onChange;
|
|
12797
|
+
var uniqueID = useId();
|
|
12798
|
+
if (!id)
|
|
12799
|
+
id = "cb-".concat(uniqueID);
|
|
12792
12800
|
var checboxStyles = cn('focus:ring-purple-500 h-4 w-4 text-purple-600 border-gray-300 rounded', { 'border-red-500 shadow-none': isError });
|
|
12793
12801
|
var wrapperStyles = cn('relative flex items-start', { 'opacity-50': isDisabled });
|
|
12794
12802
|
var handleChange = function (e) {
|