@agility/plenum-ui 1.3.24 → 1.3.27
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/Forms/BaseField/BaseField.d.ts +2 -0
- package/lib/components/Forms/TextInput/TextInput.d.ts +2 -0
- package/lib/components/Forms/TextInputAddon/TextInputAddon.d.ts +1 -0
- package/lib/index.esm.js +20 -16
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +20 -16
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -12436,7 +12436,7 @@ var InputCounter = function (_a) {
|
|
|
12436
12436
|
var defaultStyles = "border py-2 px-3 rounded text-sm leading-5 font-normal w-full border-gray-300 shadow-sm";
|
|
12437
12437
|
/** Base input field component */
|
|
12438
12438
|
var BaseField = function (_a, ref) {
|
|
12439
|
-
var onFocus = _a.onFocus, onBlur = _a.onBlur, id = _a.id, name = _a.name, type = _a.type, value = _a.value, defaultValue = _a.defaultValue, isDisabled = _a.isDisabled, _b = _a.maxLength, maxLength = _b === void 0 ? 100 : _b, placeholder = _a.placeholder, _c = _a.className, className = _c === void 0 ? defaultStyles : _c, onChange = _a.onChange, onValueChange = _a.onValueChange;
|
|
12439
|
+
var onFocus = _a.onFocus, onBlur = _a.onBlur, id = _a.id, name = _a.name, type = _a.type, value = _a.value, defaultValue = _a.defaultValue, isDisabled = _a.isDisabled, isReadonly = _a.isReadonly, _b = _a.maxLength, maxLength = _b === void 0 ? 100 : _b, placeholder = _a.placeholder, _c = _a.className, className = _c === void 0 ? defaultStyles : _c, onChange = _a.onChange, onValueChange = _a.onValueChange;
|
|
12440
12440
|
var handleChange = function (e) {
|
|
12441
12441
|
var targetValue = e.currentTarget.value;
|
|
12442
12442
|
onChange && onChange(targetValue);
|
|
@@ -12450,7 +12450,7 @@ var BaseField = function (_a, ref) {
|
|
|
12450
12450
|
};
|
|
12451
12451
|
return (React__default["default"].createElement("input", { onFocus: handleFocus, onBlur: handleBlur, onChange: function (e) {
|
|
12452
12452
|
handleChange(e);
|
|
12453
|
-
}, placeholder: placeholder, ref: ref, type: type, name: name, id: id, className: cn(
|
|
12453
|
+
}, placeholder: placeholder, ref: ref, type: type, name: name, id: id, className: cn(isDisabled ? "opacity-50" : "", className), disabled: isDisabled, readOnly: isReadonly, value: value, defaultValue: defaultValue, maxLength: maxLength, autoComplete: "off" }));
|
|
12454
12454
|
};
|
|
12455
12455
|
var _BaseField = React.forwardRef(BaseField);
|
|
12456
12456
|
|
|
@@ -12468,7 +12468,7 @@ var useId = function () {
|
|
|
12468
12468
|
};
|
|
12469
12469
|
|
|
12470
12470
|
var TextInput = function (_a, ref) {
|
|
12471
|
-
var label = _a.label, isFocused = _a.isFocused, isError = _a.isError, id = _a.id, name = _a.name, isRequired = _a.isRequired, type = _a.type, defaultValue = _a.defaultValue, isDisabled = _a.isDisabled, message = _a.message, isShowCounter = _a.isShowCounter, _b = _a.maxLength, maxLength = _b === void 0 ? 100 : _b, onChange = _a.onChange, externalValue = _a.value, className = _a.className;
|
|
12471
|
+
var label = _a.label, isFocused = _a.isFocused, isError = _a.isError, id = _a.id, name = _a.name, isRequired = _a.isRequired, type = _a.type, defaultValue = _a.defaultValue, isDisabled = _a.isDisabled, isReadonly = _a.isReadonly, message = _a.message, isShowCounter = _a.isShowCounter, _b = _a.maxLength, maxLength = _b === void 0 ? 100 : _b, onChange = _a.onChange, externalValue = _a.value, className = _a.className;
|
|
12472
12472
|
var uniqueID = useId();
|
|
12473
12473
|
var _c = React.useState(Boolean(isFocused)), isFocus = _c[0], setIsFocus = _c[1];
|
|
12474
12474
|
var _d = React.useState(false); _d[0]; var setIsActive = _d[1];
|
|
@@ -12519,7 +12519,7 @@ var TextInput = function (_a, ref) {
|
|
|
12519
12519
|
"border-purple-500 shadow-none outline-purple-500 focus:ring-purple-500": isFocus && !isError
|
|
12520
12520
|
}, {
|
|
12521
12521
|
"!border-red-500 shadow-none focus:ring-red-500": isError
|
|
12522
|
-
}, className), isDisabled: isDisabled, value: value, defaultValue: defaultValue, maxLength: maxLength }),
|
|
12522
|
+
}, className), isDisabled: isDisabled, isReadonly: isReadonly, value: value, defaultValue: defaultValue, maxLength: maxLength }),
|
|
12523
12523
|
React__default["default"].createElement("div", { className: "flex flex-row space-x-3" },
|
|
12524
12524
|
React__default["default"].createElement("div", { className: "grow" }, message && (React__default["default"].createElement("span", { className: cn("mt-1 block text-sm", isError ? "text-red-500" : "text-gray-500") }, message))),
|
|
12525
12525
|
isShowCounter && (React__default["default"].createElement("div", { className: "shrink-0" },
|
|
@@ -12533,10 +12533,10 @@ var InputCta = function (_a) {
|
|
|
12533
12533
|
var handleClick = function () {
|
|
12534
12534
|
onClickHandler && onClickHandler();
|
|
12535
12535
|
};
|
|
12536
|
-
var buttonStyle = cn('relative
|
|
12536
|
+
var buttonStyle = cn('relative inline-flex items-center space-x-2 px-4 py-2 border border-gray-300 text-sm font-medium focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-purple-500', {
|
|
12537
12537
|
'rounded-r text-gray-700 -ml-px': align === 'right'
|
|
12538
12538
|
}, {
|
|
12539
|
-
'rounded-l text-gray-500 -mr-px
|
|
12539
|
+
'rounded-l text-gray-500 -mr-px': align === 'left'
|
|
12540
12540
|
}, {
|
|
12541
12541
|
'cursor-default': !onClickHandler
|
|
12542
12542
|
}, {
|
|
@@ -12556,7 +12556,7 @@ var InputCta = function (_a) {
|
|
|
12556
12556
|
};
|
|
12557
12557
|
|
|
12558
12558
|
var TextInputAddon = function (_a, ref) {
|
|
12559
|
-
var label = _a.label, isFocused = _a.isFocused, isError = _a.isError, id = _a.id, name = _a.name, isRequired = _a.isRequired, type = _a.type, defaultValue = _a.defaultValue, isDisabled = _a.isDisabled, message = _a.message, isShowCounter = _a.isShowCounter, _b = _a.maxLength, maxLength = _b === void 0 ? 100 : _b, placeholder = _a.placeholder, leadIcon = _a.leadIcon, trailIcon = _a.trailIcon, inlineIcon = _a.inlineIcon, trailLabel = _a.trailLabel, leadLabel = _a.leadLabel, _c = _a.clearCta, clearCta = _c === void 0 ? "none" : _c, onChange = _a.onChange, onCtaClick = _a.onCtaClick, externalValue = _a.value;
|
|
12559
|
+
var label = _a.label, isFocused = _a.isFocused, isError = _a.isError, id = _a.id, name = _a.name, isRequired = _a.isRequired, type = _a.type, defaultValue = _a.defaultValue, isDisabled = _a.isDisabled, message = _a.message, isShowCounter = _a.isShowCounter, _b = _a.maxLength, maxLength = _b === void 0 ? 100 : _b, placeholder = _a.placeholder, leadIcon = _a.leadIcon, trailIcon = _a.trailIcon, inlineIcon = _a.inlineIcon, trailLabel = _a.trailLabel, leadLabel = _a.leadLabel, _c = _a.clearCta, clearCta = _c === void 0 ? "none" : _c, onChange = _a.onChange, onCtaClick = _a.onCtaClick, externalValue = _a.value, className = _a.className;
|
|
12560
12560
|
var _d = React.useState(Boolean(isFocused)), isFocus = _d[0], setIsFocus = _d[1];
|
|
12561
12561
|
var _e = React.useState(defaultValue || ""), value = _e[0], setValue = _e[1];
|
|
12562
12562
|
var inputRef = React.useRef(null);
|
|
@@ -12597,22 +12597,26 @@ var TextInputAddon = function (_a, ref) {
|
|
|
12597
12597
|
setIsFocus(false);
|
|
12598
12598
|
// add other focus effects here
|
|
12599
12599
|
};
|
|
12600
|
-
var className = cn("border py-2 px-3 rounded text-sm leading-5 font-normal w-full border-gray-300 outline-purple-500 focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-purple-500 ", {
|
|
12601
|
-
"focus:ring-red-500 !border-red-500 !outline-red-500 shadow-none": isError
|
|
12602
|
-
}, { "pl-10": inlineIcon }, {
|
|
12603
|
-
"!rounded-r-none !rounded-l": (trailIcon || trailLabel) && !(leadIcon || leadLabel)
|
|
12604
|
-
}, {
|
|
12605
|
-
"!rounded-r-none !rounded-r": !(trailIcon || trailLabel) && (leadIcon || leadLabel)
|
|
12606
|
-
}, { "rounded-none": (trailIcon || trailLabel) && (leadIcon || leadLabel) });
|
|
12607
12600
|
var discriptionStyles = cn("text-sm mt-1 block", { "text-gray-500": !isError }, { "text-red-500": isError });
|
|
12608
12601
|
return (React__default["default"].createElement("div", null,
|
|
12609
12602
|
label && (React__default["default"].createElement(InputLabel, { label: label, isRequired: isRequired, id: id, isError: isError, isDisabled: isDisabled })),
|
|
12610
12603
|
React__default["default"].createElement("div", { className: "flex" },
|
|
12611
12604
|
(leadIcon || leadLabel) && (React__default["default"].createElement(InputCta, { icon: leadIcon, ctaLabel: leadLabel, align: "left", isClear: clearCta === "left" || clearCta === "both" })),
|
|
12612
|
-
React__default["default"].createElement("div", { className: "relative flex-grow
|
|
12605
|
+
React__default["default"].createElement("div", { className: "relative flex-grow" },
|
|
12613
12606
|
inlineIcon && (React__default["default"].createElement("div", { className: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3" },
|
|
12614
12607
|
React__default["default"].createElement(DynamicIcons, { icon: inlineIcon, className: "h-5 w-5 text-gray-400", outline: false }))),
|
|
12615
|
-
React__default["default"].createElement(_BaseField, { onFocus: handleInputFocus, onBlur: handleInputBlur, onChange: onChange, onValueChange: setValue, ref: ref, type: type, name: name, id: id, className:
|
|
12608
|
+
React__default["default"].createElement(_BaseField, { onFocus: handleInputFocus, onBlur: handleInputBlur, onChange: onChange, onValueChange: setValue, ref: ref, type: type, name: name, id: id, className: cn("w-full rounded border border-gray-300 py-2 px-3 text-sm font-normal leading-5 outline-purple-500 focus:border-purple-500 focus:outline-none focus:ring-1 focus:ring-purple-500 ", {
|
|
12609
|
+
"!border-red-500 shadow-none !outline-red-500 focus:ring-red-500": isError
|
|
12610
|
+
}, { "pl-10": inlineIcon }, {
|
|
12611
|
+
"!rounded-r-none !rounded-l": (trailIcon || trailLabel) &&
|
|
12612
|
+
!(leadIcon || leadLabel)
|
|
12613
|
+
}, {
|
|
12614
|
+
"!rounded-r-none !rounded-r": !(trailIcon || trailLabel) &&
|
|
12615
|
+
(leadIcon || leadLabel)
|
|
12616
|
+
}, {
|
|
12617
|
+
"rounded-none": (trailIcon || trailLabel) &&
|
|
12618
|
+
(leadIcon || leadLabel)
|
|
12619
|
+
}, className), isDisabled: isDisabled, value: value, defaultValue: defaultValue, maxLength: maxLength, placeholder: placeholder })),
|
|
12616
12620
|
(trailIcon || trailLabel) && (React__default["default"].createElement(InputCta, { icon: trailIcon, ctaLabel: trailLabel, align: "right", isClear: clearCta === "right" || clearCta === "both", onClickHandler: onCtaClick }))),
|
|
12617
12621
|
React__default["default"].createElement("div", { className: "flex flex-row space-x-3" },
|
|
12618
12622
|
React__default["default"].createElement("div", { className: "grow" }, message && (React__default["default"].createElement("span", { className: discriptionStyles }, message))),
|