@agility/plenum-ui 1.3.40 → 1.3.42

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.
@@ -31,6 +31,8 @@ export interface TextInputProps {
31
31
  onChange?(value: string): void;
32
32
  /** input value */
33
33
  value?: string;
34
+ /**Placeholder input text*/
35
+ placeholder: string;
34
36
  className?: string;
35
37
  }
36
38
  declare const _TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
package/lib/index.esm.js CHANGED
@@ -12419,7 +12419,7 @@ var InputCounter = function (_a) {
12419
12419
  var defaultStyles = "border py-2 px-3 rounded text-sm leading-5 font-normal w-full border-gray-300 shadow-sm";
12420
12420
  /** Base input field component */
12421
12421
  var BaseField = function (_a, ref) {
12422
- 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;
12422
+ 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, maxLength = _a.maxLength, placeholder = _a.placeholder, _b = _a.className, className = _b === void 0 ? defaultStyles : _b, onChange = _a.onChange, onValueChange = _a.onValueChange;
12423
12423
  var handleChange = function (e) {
12424
12424
  var targetValue = e.currentTarget.value;
12425
12425
  onChange && onChange(targetValue);
@@ -12451,11 +12451,10 @@ var useId = function () {
12451
12451
  };
12452
12452
 
12453
12453
  var TextInput = function (_a, ref) {
12454
- 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, maxLength = _a.maxLength, onChange = _a.onChange, externalValue = _a.value, className = _a.className;
12454
+ 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, maxLength = _a.maxLength, onChange = _a.onChange, placeholder = _a.placeholder, externalValue = _a.value, className = _a.className;
12455
12455
  var uniqueID = useId();
12456
12456
  var _b = useState(Boolean(isFocused)), isFocus = _b[0], setIsFocus = _b[1];
12457
- var _c = useState(false); _c[0]; var setIsActive = _c[1];
12458
- var _d = useState(externalValue || defaultValue || ""), value = _d[0], setValue = _d[1];
12457
+ var _c = useState(externalValue || defaultValue || ""), value = _c[0], setValue = _c[1];
12459
12458
  var inputRef = useRef(null);
12460
12459
  useEffect(function () {
12461
12460
  //if the external value is updated by the parent component, reset the value in here...
@@ -12470,7 +12469,6 @@ var TextInput = function (_a, ref) {
12470
12469
  return;
12471
12470
  if (isFocus) {
12472
12471
  input.focus();
12473
- setIsActive(true);
12474
12472
  }
12475
12473
  else {
12476
12474
  input.blur();
@@ -12481,28 +12479,21 @@ var TextInput = function (_a, ref) {
12481
12479
  var input = inputRef.current;
12482
12480
  if (!input || defaultValue === undefined || defaultValue === "")
12483
12481
  return;
12484
- setIsActive(true);
12485
12482
  }, [defaultValue]);
12486
- var handleInputFocus = function () {
12487
- setIsFocus(true);
12488
- // add other focus effects here
12489
- };
12490
- var handleInputBlur = function () {
12491
- var input = inputRef.current;
12492
- setIsFocus(false);
12493
- setIsActive(!(input && input.value === ""));
12494
- };
12483
+ var handleInputFocus = function () { return setIsFocus(true); };
12484
+ // add other focus effects here
12485
+ var handleInputBlur = function () { return setIsFocus(false); };
12495
12486
  if (!id)
12496
12487
  id = "input-".concat(uniqueID);
12497
12488
  if (!name)
12498
12489
  name = id;
12499
- return (React__default.createElement(React__default.Fragment, null,
12490
+ return (React__default.createElement("div", { className: "relative" },
12500
12491
  React__default.createElement(InputLabel, { isPlaceholder: true, label: label, isRequired: isRequired, id: id, isError: isError, isActive: true, isDisabled: isDisabled }),
12501
12492
  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 py-2 px-3 text-sm font-normal leading-5", { "border-gray-300": !isFocus && !isError }, {
12502
- "border-purple-500 shadow-none outline-purple-500 focus:ring-purple-500": isFocus && !isError
12493
+ "!border-purple-500 shadow-none outline-purple-500 focus:!ring-purple-500": isFocus && !isError
12503
12494
  }, {
12504
12495
  "!border-red-500 shadow-none focus:ring-red-500": isError
12505
- }, className), isDisabled: isDisabled, isReadonly: isReadonly, value: value, defaultValue: defaultValue, maxLength: maxLength }),
12496
+ }, className), isDisabled: isDisabled, isReadonly: isReadonly, value: value, defaultValue: defaultValue, maxLength: maxLength, placeholder: placeholder }),
12506
12497
  React__default.createElement("div", { className: "flex flex-row space-x-3" },
12507
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))),
12508
12499
  isShowCounter && (React__default.createElement("div", { className: "shrink-0" },
@@ -12539,9 +12530,9 @@ var InputCta = function (_a) {
12539
12530
  };
12540
12531
 
12541
12532
  var TextInputAddon = function (_a, ref) {
12542
- 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, inlineTrailingIcon = _a.inlineTrailingIcon, 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;
12543
- var _d = useState(Boolean(isFocused)), isFocus = _d[0], setIsFocus = _d[1];
12544
- var _e = useState(defaultValue || ""), value = _e[0], setValue = _e[1];
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, maxLength = _a.maxLength, placeholder = _a.placeholder, leadIcon = _a.leadIcon, trailIcon = _a.trailIcon, inlineIcon = _a.inlineIcon, inlineTrailingIcon = _a.inlineTrailingIcon, trailLabel = _a.trailLabel, leadLabel = _a.leadLabel, _b = _a.clearCta, clearCta = _b === void 0 ? "none" : _b, onChange = _a.onChange, onCtaClick = _a.onCtaClick, externalValue = _a.value, className = _a.className;
12534
+ var _c = useState(Boolean(isFocused)), isFocus = _c[0], setIsFocus = _c[1];
12535
+ var _d = useState(defaultValue || ""), value = _d[0], setValue = _d[1];
12545
12536
  var inputRef = useRef(null);
12546
12537
  var uniqueID = useId();
12547
12538
  if (!id)
@@ -12629,9 +12620,9 @@ var InputSelect = function (_a) {
12629
12620
  };
12630
12621
 
12631
12622
  var TextInputSelect = function (_a) {
12632
- 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, inputOptions = _a.inputOptions, _c = _a.selectLocation, selectLocation = _c === void 0 ? "right" : _c, prefix = _a.prefix, onChange = _a.onChange, onSelectOption = _a.onSelectOption, externalValue = _a.value;
12633
- var _d = useState(Boolean(isFocused)), isFocus = _d[0], setIsFocus = _d[1];
12634
- var _e = useState(defaultValue || ""), value = _e[0], setValue = _e[1];
12623
+ 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, maxLength = _a.maxLength, placeholder = _a.placeholder, inputOptions = _a.inputOptions, _b = _a.selectLocation, selectLocation = _b === void 0 ? "right" : _b, prefix = _a.prefix, onChange = _a.onChange, onSelectOption = _a.onSelectOption, externalValue = _a.value;
12624
+ var _c = useState(Boolean(isFocused)), isFocus = _c[0], setIsFocus = _c[1];
12625
+ var _d = useState(defaultValue || ""), value = _d[0], setValue = _d[1];
12635
12626
  var inputRef = useRef(null);
12636
12627
  var uniqueID = useId();
12637
12628
  if (!id)
@@ -12728,9 +12719,9 @@ var Radio = function (_a) {
12728
12719
  };
12729
12720
 
12730
12721
  var Textarea = function (_a, ref) {
12731
- var id = _a.id, name = _a.name, label = _a.label, isError = _a.isError, isRequired = _a.isRequired, isDisabled = _a.isDisabled, defaultValue = _a.defaultValue, message = _a.message, isShowCounter = _a.isShowCounter, _b = _a.maxLength, maxLength = _b === void 0 ? 500 : _b, _c = _a.rows, rows = _c === void 0 ? 4 : _c, onChange = _a.onChange, externalValue = _a.value, placeholder = _a.placeholder, className = _a.className;
12722
+ var id = _a.id, name = _a.name, label = _a.label, isError = _a.isError, isRequired = _a.isRequired, isDisabled = _a.isDisabled, defaultValue = _a.defaultValue, message = _a.message, isShowCounter = _a.isShowCounter, maxLength = _a.maxLength, _b = _a.rows, rows = _b === void 0 ? 4 : _b, onChange = _a.onChange, externalValue = _a.value, placeholder = _a.placeholder, className = _a.className;
12732
12723
  var uniqueID = useId();
12733
- var _d = useState(externalValue || defaultValue || ""), value = _d[0], setValue = _d[1];
12724
+ var _c = useState(externalValue || defaultValue || ""), value = _c[0], setValue = _c[1];
12734
12725
  var handleOnchange = function (e) {
12735
12726
  var targetValue = e.currentTarget.value;
12736
12727
  typeof onChange === "function" && onChange(targetValue);