@agility/plenum-ui 1.3.15 → 1.3.18
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
|
|
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 };
|
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
|
|
|
@@ -12443,6 +12445,12 @@ var TextInput = function (_a, ref) {
|
|
|
12443
12445
|
var _d = useState(false); _d[0]; var setIsActive = _d[1];
|
|
12444
12446
|
var _e = useState(externalValue || defaultValue || ""), value = _e[0], setValue = _e[1];
|
|
12445
12447
|
var inputRef = useRef(null);
|
|
12448
|
+
useEffect(function () {
|
|
12449
|
+
//if the external value is updated by the parent component, reset the value in here...
|
|
12450
|
+
if (externalValue !== undefined && externalValue !== null) {
|
|
12451
|
+
setValue(externalValue);
|
|
12452
|
+
}
|
|
12453
|
+
}, [externalValue]);
|
|
12446
12454
|
// set force focus
|
|
12447
12455
|
useEffect(function () {
|
|
12448
12456
|
var input = inputRef.current;
|
|
@@ -12731,13 +12739,18 @@ var _Textarea = forwardRef(Textarea);
|
|
|
12731
12739
|
|
|
12732
12740
|
/** Comment */
|
|
12733
12741
|
var Select = function (_a) {
|
|
12734
|
-
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;
|
|
12735
|
-
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;
|
|
12743
|
+
var _b = useState(value || options[0].value), selectedOption = _b[0], setSelectedOption = _b[1];
|
|
12736
12744
|
var uniqueID = useId();
|
|
12737
12745
|
if (!id)
|
|
12738
12746
|
id = "select-".concat(uniqueID);
|
|
12739
12747
|
if (!name)
|
|
12740
12748
|
name = id;
|
|
12749
|
+
useEffect(function () {
|
|
12750
|
+
if (value !== undefined && value !== null) {
|
|
12751
|
+
setSelectedOption(value);
|
|
12752
|
+
}
|
|
12753
|
+
}, [value]);
|
|
12741
12754
|
var handleChange = function (e) {
|
|
12742
12755
|
var targetValue = e.target.value;
|
|
12743
12756
|
typeof onChange == "function" && onChange(targetValue);
|