@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
|
@@ -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 };
|
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,23 +12739,27 @@ 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, className = _a.className;
|
|
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);
|
|
12751
12757
|
setSelectedOption(targetValue);
|
|
12752
12758
|
};
|
|
12753
|
-
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 });
|
|
12754
12759
|
var wrapperStyle = cn({ "opacity-50": isDisabled });
|
|
12755
12760
|
return (React__default.createElement("div", { className: wrapperStyle },
|
|
12756
12761
|
label && (React__default.createElement(InputLabel, { isPlaceholder: true, isActive: true, label: label, isRequired: isRequired, id: id, isError: isError, isDisabled: isDisabled })),
|
|
12757
|
-
React__default.createElement("select", { id: id, name: name, className:
|
|
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) {
|
|
12758
12763
|
var value = _a.value, label = _a.label;
|
|
12759
12764
|
return (React__default.createElement("option", { key: value, value: value }, label));
|
|
12760
12765
|
}))));
|
|
@@ -12763,6 +12768,9 @@ var Select = function (_a) {
|
|
|
12763
12768
|
/** Comment */
|
|
12764
12769
|
var Checkbox = function (_a) {
|
|
12765
12770
|
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;
|
|
12771
|
+
var uniqueID = useId();
|
|
12772
|
+
if (!id)
|
|
12773
|
+
id = "cb-".concat(uniqueID);
|
|
12766
12774
|
var checboxStyles = cn('focus:ring-purple-500 h-4 w-4 text-purple-600 border-gray-300 rounded', { 'border-red-500 shadow-none': isError });
|
|
12767
12775
|
var wrapperStyles = cn('relative flex items-start', { 'opacity-50': isDisabled });
|
|
12768
12776
|
var handleChange = function (e) {
|