@agility/plenum-ui 1.3.34 → 1.3.35
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 +9 -1
- package/lib/index.esm.js +18 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +18 -2
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { HTMLAttributeAnchorTarget } from "react";
|
|
2
2
|
import { IconName } from "../../util/DynamicIcons";
|
|
3
3
|
export interface ButtonProps {
|
|
4
4
|
/**
|
|
@@ -40,6 +40,14 @@ export interface ButtonProps {
|
|
|
40
40
|
className?: string;
|
|
41
41
|
iconObj?: React.ReactNode;
|
|
42
42
|
title?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Optionally render as anchor tag
|
|
45
|
+
*/
|
|
46
|
+
asLink?: {
|
|
47
|
+
href: string;
|
|
48
|
+
target: HTMLAttributeAnchorTarget;
|
|
49
|
+
title?: string;
|
|
50
|
+
};
|
|
43
51
|
}
|
|
44
52
|
declare const _Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
45
53
|
export { _Button as Button };
|
package/lib/index.esm.js
CHANGED
|
@@ -7020,9 +7020,9 @@ function Loader(_a) {
|
|
|
7020
7020
|
* Primary UI component for user interaction
|
|
7021
7021
|
*/
|
|
7022
7022
|
var Button = function (_a, ref) {
|
|
7023
|
-
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;
|
|
7023
|
+
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, asLink = _a.asLink;
|
|
7024
7024
|
var iconStyles = cn("h-5 w-5", { "text-white": type === "primary" || type === "danger" }, { "text-purple-700": type === "secondary" }, { "text-gray-700": type === "alternative" });
|
|
7025
|
-
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" }, {
|
|
7025
|
+
return !asLink ? (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" }, {
|
|
7026
7026
|
"cursor-auto opacity-50": isDisabled
|
|
7027
7027
|
}, {
|
|
7028
7028
|
"active: 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"
|
|
@@ -7041,6 +7041,22 @@ var Button = function (_a, ref) {
|
|
|
7041
7041
|
icon &&
|
|
7042
7042
|
(isLoading ? (React__default.createElement(Loader, { classes: "h-5 w-5 border-2" })) : (React__default.createElement(DynamicIcons, { icon: icon, className: iconStyles, outline: false }))),
|
|
7043
7043
|
!icon && !iconObj && isLoading && (React__default.createElement(Loader, { classes: "h-5 w-5 border-2" })),
|
|
7044
|
+
label && React__default.createElement("span", null, label))) : (React__default.createElement("a", { type: isSubmit ? "submit" : "button", title: asLink.title || title, href: asLink.href, 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" }, {
|
|
7045
|
+
"cursor-auto opacity-50": isDisabled
|
|
7046
|
+
}, {
|
|
7047
|
+
"active: 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"
|
|
7048
|
+
}, {
|
|
7049
|
+
"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"
|
|
7050
|
+
}, {
|
|
7051
|
+
"border-gray-300 bg-white text-gray-700 hover:bg-gray-50 hover:text-gray-700 active:bg-gray-100": type === "alternative"
|
|
7052
|
+
}, {
|
|
7053
|
+
"border-red-300 bg-red-600 text-white hover:bg-red-700 hover:text-white": type === "danger"
|
|
7054
|
+
}, className), "aria-disabled": isDisabled },
|
|
7055
|
+
iconObj &&
|
|
7056
|
+
(isLoading ? (React__default.createElement(Loader, { classes: "h-5 w-5 border-2" })) : (React__default.createElement(React__default.Fragment, null, iconObj))),
|
|
7057
|
+
icon &&
|
|
7058
|
+
(isLoading ? (React__default.createElement(Loader, { classes: "h-5 w-5 border-2" })) : (React__default.createElement(DynamicIcons, { icon: icon, className: iconStyles, outline: false }))),
|
|
7059
|
+
!icon && !iconObj && isLoading && (React__default.createElement(Loader, { classes: "h-5 w-5 border-2" })),
|
|
7044
7060
|
label && React__default.createElement("span", null, label)));
|
|
7045
7061
|
};
|
|
7046
7062
|
var _Button = forwardRef(Button);
|