@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.
@@ -11,6 +11,8 @@ export interface BaseFieldProps {
11
11
  placeholder?: string;
12
12
  /** Disabled state */
13
13
  isDisabled?: boolean;
14
+ /** Readonly state */
15
+ isReadonly?: boolean;
14
16
  /** Set value */
15
17
  value?: string;
16
18
  /** Set default value */
@@ -17,6 +17,8 @@ export interface TextInputProps {
17
17
  isRequired?: boolean;
18
18
  /** Disabled state */
19
19
  isDisabled?: boolean;
20
+ /** Readonly state */
21
+ isReadonly?: boolean;
20
22
  /** Set default value */
21
23
  defaultValue?: string;
22
24
  /** Message shown under the text field */
@@ -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(className, isDisabled ? "opacity-50" : ""), disabled: isDisabled, value: value, defaultValue: defaultValue, maxLength: maxLength, autoComplete: "off" }));
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 z-10 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', {
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 focus-within:z-10': align === 'left'
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 focus-within:z-20" },
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: className, isDisabled: isDisabled, value: value, defaultValue: defaultValue, maxLength: maxLength, placeholder: placeholder })),
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))),