@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
|
@@ -42,6 +42,7 @@ export interface TextInputAddonProps {
|
|
|
42
42
|
leadLabel?: string;
|
|
43
43
|
/** Remove bg and border from CTA */
|
|
44
44
|
clearCta?: "left" | "right" | "both" | "none";
|
|
45
|
+
className?: string;
|
|
45
46
|
/** Callback on change */
|
|
46
47
|
onChange?(value: string): void;
|
|
47
48
|
/** Callback on Cta click */
|
package/lib/index.esm.js
CHANGED
|
@@ -12410,7 +12410,7 @@ var InputCounter = function (_a) {
|
|
|
12410
12410
|
var defaultStyles = "border py-2 px-3 rounded text-sm leading-5 font-normal w-full border-gray-300 shadow-sm";
|
|
12411
12411
|
/** Base input field component */
|
|
12412
12412
|
var BaseField = function (_a, ref) {
|
|
12413
|
-
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;
|
|
12413
|
+
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;
|
|
12414
12414
|
var handleChange = function (e) {
|
|
12415
12415
|
var targetValue = e.currentTarget.value;
|
|
12416
12416
|
onChange && onChange(targetValue);
|
|
@@ -12424,7 +12424,7 @@ var BaseField = function (_a, ref) {
|
|
|
12424
12424
|
};
|
|
12425
12425
|
return (React__default.createElement("input", { onFocus: handleFocus, onBlur: handleBlur, onChange: function (e) {
|
|
12426
12426
|
handleChange(e);
|
|
12427
|
-
}, placeholder: placeholder, ref: ref, type: type, name: name, id: id, className: cn(
|
|
12427
|
+
}, 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" }));
|
|
12428
12428
|
};
|
|
12429
12429
|
var _BaseField = forwardRef(BaseField);
|
|
12430
12430
|
|
|
@@ -12442,7 +12442,7 @@ var useId = function () {
|
|
|
12442
12442
|
};
|
|
12443
12443
|
|
|
12444
12444
|
var TextInput = function (_a, ref) {
|
|
12445
|
-
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;
|
|
12445
|
+
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;
|
|
12446
12446
|
var uniqueID = useId();
|
|
12447
12447
|
var _c = useState(Boolean(isFocused)), isFocus = _c[0], setIsFocus = _c[1];
|
|
12448
12448
|
var _d = useState(false); _d[0]; var setIsActive = _d[1];
|
|
@@ -12493,7 +12493,7 @@ var TextInput = function (_a, ref) {
|
|
|
12493
12493
|
"border-purple-500 shadow-none outline-purple-500 focus:ring-purple-500": isFocus && !isError
|
|
12494
12494
|
}, {
|
|
12495
12495
|
"!border-red-500 shadow-none focus:ring-red-500": isError
|
|
12496
|
-
}, className), isDisabled: isDisabled, value: value, defaultValue: defaultValue, maxLength: maxLength }),
|
|
12496
|
+
}, className), isDisabled: isDisabled, isReadonly: isReadonly, value: value, defaultValue: defaultValue, maxLength: maxLength }),
|
|
12497
12497
|
React__default.createElement("div", { className: "flex flex-row space-x-3" },
|
|
12498
12498
|
React__default.createElement("div", { className: "grow" }, message && (React__default.createElement("span", { className: cn("mt-1 block text-sm", isError ? "text-red-500" : "text-gray-500") }, message))),
|
|
12499
12499
|
isShowCounter && (React__default.createElement("div", { className: "shrink-0" },
|
|
@@ -12507,10 +12507,10 @@ var InputCta = function (_a) {
|
|
|
12507
12507
|
var handleClick = function () {
|
|
12508
12508
|
onClickHandler && onClickHandler();
|
|
12509
12509
|
};
|
|
12510
|
-
var buttonStyle = cn('relative
|
|
12510
|
+
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', {
|
|
12511
12511
|
'rounded-r text-gray-700 -ml-px': align === 'right'
|
|
12512
12512
|
}, {
|
|
12513
|
-
'rounded-l text-gray-500 -mr-px
|
|
12513
|
+
'rounded-l text-gray-500 -mr-px': align === 'left'
|
|
12514
12514
|
}, {
|
|
12515
12515
|
'cursor-default': !onClickHandler
|
|
12516
12516
|
}, {
|
|
@@ -12530,7 +12530,7 @@ var InputCta = function (_a) {
|
|
|
12530
12530
|
};
|
|
12531
12531
|
|
|
12532
12532
|
var TextInputAddon = function (_a, ref) {
|
|
12533
|
-
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;
|
|
12533
|
+
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;
|
|
12534
12534
|
var _d = useState(Boolean(isFocused)), isFocus = _d[0], setIsFocus = _d[1];
|
|
12535
12535
|
var _e = useState(defaultValue || ""), value = _e[0], setValue = _e[1];
|
|
12536
12536
|
var inputRef = useRef(null);
|
|
@@ -12571,22 +12571,26 @@ var TextInputAddon = function (_a, ref) {
|
|
|
12571
12571
|
setIsFocus(false);
|
|
12572
12572
|
// add other focus effects here
|
|
12573
12573
|
};
|
|
12574
|
-
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 ", {
|
|
12575
|
-
"focus:ring-red-500 !border-red-500 !outline-red-500 shadow-none": isError
|
|
12576
|
-
}, { "pl-10": inlineIcon }, {
|
|
12577
|
-
"!rounded-r-none !rounded-l": (trailIcon || trailLabel) && !(leadIcon || leadLabel)
|
|
12578
|
-
}, {
|
|
12579
|
-
"!rounded-r-none !rounded-r": !(trailIcon || trailLabel) && (leadIcon || leadLabel)
|
|
12580
|
-
}, { "rounded-none": (trailIcon || trailLabel) && (leadIcon || leadLabel) });
|
|
12581
12574
|
var discriptionStyles = cn("text-sm mt-1 block", { "text-gray-500": !isError }, { "text-red-500": isError });
|
|
12582
12575
|
return (React__default.createElement("div", null,
|
|
12583
12576
|
label && (React__default.createElement(InputLabel, { label: label, isRequired: isRequired, id: id, isError: isError, isDisabled: isDisabled })),
|
|
12584
12577
|
React__default.createElement("div", { className: "flex" },
|
|
12585
12578
|
(leadIcon || leadLabel) && (React__default.createElement(InputCta, { icon: leadIcon, ctaLabel: leadLabel, align: "left", isClear: clearCta === "left" || clearCta === "both" })),
|
|
12586
|
-
React__default.createElement("div", { className: "relative flex-grow
|
|
12579
|
+
React__default.createElement("div", { className: "relative flex-grow" },
|
|
12587
12580
|
inlineIcon && (React__default.createElement("div", { className: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3" },
|
|
12588
12581
|
React__default.createElement(DynamicIcons, { icon: inlineIcon, className: "h-5 w-5 text-gray-400", outline: false }))),
|
|
12589
|
-
React__default.createElement(_BaseField, { onFocus: handleInputFocus, onBlur: handleInputBlur, onChange: onChange, onValueChange: setValue, ref: ref, type: type, name: name, id: id, className:
|
|
12582
|
+
React__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 ", {
|
|
12583
|
+
"!border-red-500 shadow-none !outline-red-500 focus:ring-red-500": isError
|
|
12584
|
+
}, { "pl-10": inlineIcon }, {
|
|
12585
|
+
"!rounded-r-none !rounded-l": (trailIcon || trailLabel) &&
|
|
12586
|
+
!(leadIcon || leadLabel)
|
|
12587
|
+
}, {
|
|
12588
|
+
"!rounded-r-none !rounded-r": !(trailIcon || trailLabel) &&
|
|
12589
|
+
(leadIcon || leadLabel)
|
|
12590
|
+
}, {
|
|
12591
|
+
"rounded-none": (trailIcon || trailLabel) &&
|
|
12592
|
+
(leadIcon || leadLabel)
|
|
12593
|
+
}, className), isDisabled: isDisabled, value: value, defaultValue: defaultValue, maxLength: maxLength, placeholder: placeholder })),
|
|
12590
12594
|
(trailIcon || trailLabel) && (React__default.createElement(InputCta, { icon: trailIcon, ctaLabel: trailLabel, align: "right", isClear: clearCta === "right" || clearCta === "both", onClickHandler: onCtaClick }))),
|
|
12591
12595
|
React__default.createElement("div", { className: "flex flex-row space-x-3" },
|
|
12592
12596
|
React__default.createElement("div", { className: "grow" }, message && (React__default.createElement("span", { className: discriptionStyles }, message))),
|