@agility/plenum-ui 1.1.61 → 1.1.71

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.
Files changed (37) hide show
  1. package/coverage/agility-component-lib-react/index.html +1 -1
  2. package/coverage/agility-component-lib-react/src/components/Button/Button.tsx.html +23 -17
  3. package/coverage/agility-component-lib-react/src/components/Button/index.html +5 -5
  4. package/coverage/agility-component-lib-react/src/components/Forms/BaseField/BaseField.tsx.html +18 -6
  5. package/coverage/agility-component-lib-react/src/components/Forms/BaseField/index.html +11 -11
  6. package/coverage/agility-component-lib-react/src/components/Forms/Checkbox/Checkbox.tsx.html +63 -12
  7. package/coverage/agility-component-lib-react/src/components/Forms/Checkbox/index.html +19 -19
  8. package/coverage/agility-component-lib-react/src/components/Forms/InputCounter/InputCounter.tsx.html +1 -1
  9. package/coverage/agility-component-lib-react/src/components/Forms/InputCounter/index.html +1 -1
  10. package/coverage/agility-component-lib-react/src/components/Forms/InputLabel/InputLabel.tsx.html +1 -1
  11. package/coverage/agility-component-lib-react/src/components/Forms/InputLabel/index.html +1 -1
  12. package/coverage/agility-component-lib-react/src/components/Forms/InputLabel/index.ts.html +1 -1
  13. package/coverage/agility-component-lib-react/src/components/Forms/Radio/Radio.tsx.html +90 -12
  14. package/coverage/agility-component-lib-react/src/components/Forms/Radio/index.html +21 -21
  15. package/coverage/agility-component-lib-react/src/components/Forms/Select/Select.tsx.html +6 -6
  16. package/coverage/agility-component-lib-react/src/components/Forms/Select/index.html +1 -1
  17. package/coverage/agility-component-lib-react/src/components/Forms/TextInputAddon/InputCta/InputCta.tsx.html +4 -4
  18. package/coverage/agility-component-lib-react/src/components/Forms/TextInputAddon/InputCta/index.html +1 -1
  19. package/coverage/agility-component-lib-react/src/components/Forms/TextInputSelect/InputSelect/InputSelect.tsx.html +2 -2
  20. package/coverage/agility-component-lib-react/src/components/Forms/TextInputSelect/InputSelect/index.html +1 -1
  21. package/coverage/agility-component-lib-react/src/components/Switch/Switch.tsx.html +37 -10
  22. package/coverage/agility-component-lib-react/src/components/Switch/index.html +9 -9
  23. package/coverage/agility-component-lib-react/src/util/DynamicIcons.tsx.html +5 -5
  24. package/coverage/agility-component-lib-react/src/util/Loader.tsx.html +1 -1
  25. package/coverage/agility-component-lib-react/src/util/index.html +1 -1
  26. package/coverage/agility-component-lib-react/styleMock.js.html +1 -1
  27. package/coverage/coverage-final.json +12 -2
  28. package/coverage/index.html +147 -12
  29. package/lib/components/Forms/BaseField/BaseField.d.ts +2 -0
  30. package/lib/components/Forms/TextInput/TextInput.d.ts +4 -3
  31. package/lib/components/Forms/TextInputAddon/TextInputAddon.d.ts +5 -2
  32. package/lib/components/Forms/TextInputSelect/TextInputSelect.d.ts +2 -0
  33. package/lib/index.esm.js +29 -18
  34. package/lib/index.esm.js.map +1 -1
  35. package/lib/index.js +30 -19
  36. package/lib/index.js.map +1 -1
  37. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -12299,7 +12299,7 @@ var InputCounter = function (_a) {
12299
12299
  var defaultStyles = 'border py-2 px-3 rounded-md text-sm leading-5 font-normal w-full border-gray-300 shadow-sm';
12300
12300
  /** Base input field component */
12301
12301
  var BaseField = function (_a, ref) {
12302
- var onFocus = _a.onFocus, onBlur = _a.onBlur, id = _a.id, name = _a.name, type = _a.type, defaultValue = _a.defaultValue, isDisabled = _a.isDisabled, _b = _a.maxLength, maxLength = _b === void 0 ? 100 : _b, placeholder = _a.placeholder, _c = _a.inputStyles, inputStyles = _c === void 0 ? defaultStyles : _c, onChange = _a.onChange, onValueChange = _a.onValueChange;
12302
+ 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.inputStyles, inputStyles = _c === void 0 ? defaultStyles : _c, onChange = _a.onChange, onValueChange = _a.onValueChange;
12303
12303
  var handleChange = function (e) {
12304
12304
  var targetValue = e.currentTarget.value;
12305
12305
  onChange && onChange(targetValue);
@@ -12317,16 +12317,19 @@ var BaseField = function (_a, ref) {
12317
12317
  });
12318
12318
  return (React__default["default"].createElement("input", { onFocus: handleFocus, onBlur: handleBlur, onChange: function (e) {
12319
12319
  handleChange(e);
12320
- }, placeholder: placeholder, ref: ref, type: type, name: name, id: id, className: scopedtyles, disabled: isDisabled, defaultValue: defaultValue, maxLength: maxLength, autoComplete: "off" }));
12320
+ }, placeholder: placeholder, ref: ref, type: type, name: name, id: id, className: scopedtyles, disabled: isDisabled, value: value, defaultValue: defaultValue, maxLength: maxLength, autoComplete: "off" }));
12321
12321
  };
12322
12322
  var _BaseField = React.forwardRef(BaseField);
12323
12323
 
12324
- var TextInput = function (_a) {
12325
- 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;
12324
+ var TextInput = function (_a, ref) {
12325
+ 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;
12326
12326
  var _c = React.useState(Boolean(isFocused)), isFocus = _c[0], setIsFocus = _c[1];
12327
- var _d = React.useState(false), isActive = _d[0], setIsActive = _d[1];
12328
- var _e = React.useState(defaultValue), value = _e[0], setValue = _e[1];
12327
+ var _d = React.useState(false); _d[0]; var setIsActive = _d[1];
12328
+ var _e = React.useState(defaultValue || ''), value = _e[0], setValue = _e[1];
12329
12329
  var inputRef = React.useRef(null);
12330
+ React.useEffect(function () {
12331
+ setValue(externalValue);
12332
+ }, [externalValue]);
12330
12333
  // set force focus
12331
12334
  React.useEffect(function () {
12332
12335
  var input = inputRef.current;
@@ -12359,14 +12362,15 @@ var TextInput = function (_a) {
12359
12362
  var inputStyles = cn$1('border py-2 px-3 rounded-md text-sm leading-5 font-normal w-full', { 'border-gray-300 shadow-sm': !isFocus && !isError }, { 'focus:ring-purple-500 border-purple-500 outline-purple-500 shadow-none': isFocus && !isError }, { 'focus:ring-red-500 !border-red-500 shadow-none': isError });
12360
12363
  var discriptionStyles = cn$1('text-sm mt-1 block', { 'text-gray-500': !isError }, { 'text-red-500': isError });
12361
12364
  return (React__default["default"].createElement("div", null,
12362
- React__default["default"].createElement(InputLabel, { isPlaceholder: true, label: label, isRequired: isRequired, id: id, isError: isError, isActive: isActive, isDisabled: isDisabled }),
12365
+ React__default["default"].createElement(InputLabel, { isPlaceholder: true, label: label, isRequired: isRequired, id: id, isError: isError, isActive: true, isDisabled: isDisabled }),
12363
12366
  React__default["default"].createElement("div", null,
12364
- React__default["default"].createElement(_BaseField, { onFocus: handleInputFocus, onBlur: handleInputBlur, onChange: onChange, onValueChange: setValue, ref: inputRef, type: type, name: name, id: id, inputStyles: inputStyles, isDisabled: isDisabled, defaultValue: defaultValue, maxLength: maxLength }),
12367
+ React__default["default"].createElement(_BaseField, { onFocus: handleInputFocus, onBlur: handleInputBlur, onChange: onChange, onValueChange: setValue, ref: ref, type: type, name: name, id: id, inputStyles: inputStyles, isDisabled: isDisabled, value: value, defaultValue: defaultValue, maxLength: maxLength }),
12365
12368
  React__default["default"].createElement("div", { className: "flex flex-row space-x-3" },
12366
12369
  React__default["default"].createElement("div", { className: "grow" }, message && React__default["default"].createElement("span", { className: discriptionStyles }, message)),
12367
12370
  isShowCounter && (React__default["default"].createElement("div", { className: "shrink-0" },
12368
12371
  React__default["default"].createElement(InputCounter, { current: Number(value === null || value === void 0 ? void 0 : value.length), limit: maxLength })))))));
12369
- };
12372
+ };
12373
+ var _TextInput = React.forwardRef(TextInput);
12370
12374
 
12371
12375
  /** Comment */
12372
12376
  var InputCta = function (_a) {
@@ -12396,11 +12400,14 @@ var InputCta = function (_a) {
12396
12400
  ctaLabel && React__default["default"].createElement("span", null, ctaLabel)));
12397
12401
  };
12398
12402
 
12399
- var TextInputAddon = function (_a) {
12400
- 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;
12403
+ var TextInputAddon = function (_a, ref) {
12404
+ 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;
12401
12405
  var _d = React.useState(Boolean(isFocused)), isFocus = _d[0], setIsFocus = _d[1];
12402
- var _e = React.useState(defaultValue), value = _e[0], setValue = _e[1];
12406
+ var _e = React.useState(defaultValue || ''), value = _e[0], setValue = _e[1];
12403
12407
  var inputRef = React.useRef(null);
12408
+ React.useEffect(function () {
12409
+ setValue(externalValue);
12410
+ }, [externalValue]);
12404
12411
  // set force focus
12405
12412
  React.useEffect(function () {
12406
12413
  var input = inputRef.current;
@@ -12436,13 +12443,14 @@ var TextInputAddon = function (_a) {
12436
12443
  React__default["default"].createElement("div", { className: "flex-grow focus-within:z-20 relative" },
12437
12444
  inlineIcon && (React__default["default"].createElement("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none" },
12438
12445
  React__default["default"].createElement(DynamicIcons, { icon: inlineIcon, className: "h-5 w-5 text-gray-400", outline: false }))),
12439
- React__default["default"].createElement(_BaseField, { onFocus: handleInputFocus, onBlur: handleInputBlur, onChange: onChange, onValueChange: setValue, ref: inputRef, type: type, name: name, id: id, inputStyles: inputStyles, isDisabled: isDisabled, defaultValue: defaultValue, maxLength: maxLength, placeholder: placeholder })),
12446
+ React__default["default"].createElement(_BaseField, { onFocus: handleInputFocus, onBlur: handleInputBlur, onChange: onChange, onValueChange: setValue, ref: ref, type: type, name: name, id: id, inputStyles: inputStyles, isDisabled: isDisabled, value: value, defaultValue: defaultValue, maxLength: maxLength, placeholder: placeholder })),
12440
12447
  (trailIcon || trailLabel) && (React__default["default"].createElement(InputCta, { icon: trailIcon, ctaLabel: trailLabel, align: "right", isClear: clearCta === 'right' || clearCta === 'both', onClickHandler: onCtaClick }))),
12441
12448
  React__default["default"].createElement("div", { className: "flex flex-row space-x-3" },
12442
12449
  React__default["default"].createElement("div", { className: "grow" }, message && React__default["default"].createElement("span", { className: discriptionStyles }, message)),
12443
12450
  isShowCounter && (React__default["default"].createElement("div", { className: "shrink-0" },
12444
12451
  React__default["default"].createElement(InputCounter, { current: Number(value === null || value === void 0 ? void 0 : value.length), limit: maxLength }))))));
12445
- };
12452
+ };
12453
+ var _TextInputAddon = React.forwardRef(TextInputAddon);
12446
12454
 
12447
12455
  /** Comment */
12448
12456
  var InputSelect = function (_a) {
@@ -12460,10 +12468,13 @@ var InputSelect = function (_a) {
12460
12468
  };
12461
12469
 
12462
12470
  var TextInputSelect = function (_a) {
12463
- 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;
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, 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;
12464
12472
  var _d = React.useState(Boolean(isFocused)), isFocus = _d[0], setIsFocus = _d[1];
12465
- var _e = React.useState(defaultValue), value = _e[0], setValue = _e[1];
12473
+ var _e = React.useState(defaultValue || ''), value = _e[0], setValue = _e[1];
12466
12474
  var inputRef = React.useRef(null);
12475
+ React.useEffect(function () {
12476
+ setValue(externalValue);
12477
+ }, [externalValue]);
12467
12478
  // set force focus
12468
12479
  React.useEffect(function () {
12469
12480
  var input = inputRef.current;
@@ -12504,7 +12515,7 @@ var TextInputSelect = function (_a) {
12504
12515
  React__default["default"].createElement("div", { className: "flex-grow focus-within:z-20 relative" },
12505
12516
  prefix && (React__default["default"].createElement("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none" },
12506
12517
  React__default["default"].createElement("span", { className: "text-gray-500 sm:text-sm" }, prefix))),
12507
- React__default["default"].createElement(_BaseField, { onFocus: handleInputFocus, onBlur: handleInputBlur, onChange: onChange, onValueChange: setValue, ref: inputRef, type: type, name: name, id: id, inputStyles: inputStyles, isDisabled: isDisabled, defaultValue: defaultValue, maxLength: maxLength, placeholder: placeholder })),
12518
+ React__default["default"].createElement(_BaseField, { onFocus: handleInputFocus, onBlur: handleInputBlur, onChange: onChange, onValueChange: setValue, ref: inputRef, type: type, name: name, id: id, inputStyles: inputStyles, isDisabled: isDisabled, defaultValue: defaultValue, value: value, maxLength: maxLength, placeholder: placeholder })),
12508
12519
  (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.length) && selectLocation === 'right' && (React__default["default"].createElement(InputSelect, { inputOptions: inputOptions, align: 'right', onSelectOption: onSelectOption }))),
12509
12520
  React__default["default"].createElement("div", { className: "flex flex-row space-x-3" },
12510
12521
  React__default["default"].createElement("div", { className: "grow" }, message && React__default["default"].createElement("span", { className: discriptionStyles }, message)),
@@ -12612,8 +12623,8 @@ exports.Placeholder = Placeholder;
12612
12623
  exports.Radio = Radio;
12613
12624
  exports.Select = Select;
12614
12625
  exports.Switch = Switch;
12615
- exports.TextInput = TextInput;
12616
- exports.TextInputAddon = TextInputAddon;
12626
+ exports.TextInput = _TextInput;
12627
+ exports.TextInputAddon = _TextInputAddon;
12617
12628
  exports.TextInputSelect = TextInputSelect;
12618
12629
  exports.Textarea = _Textarea;
12619
12630
  exports.TreeView = _TreeView;