@agility/plenum-ui 1.1.6 → 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 (38) 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.d.ts +1 -0
  34. package/lib/index.esm.js +84 -18
  35. package/lib/index.esm.js.map +1 -1
  36. package/lib/index.js +86 -19
  37. package/lib/index.js.map +1 -1
  38. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -12227,6 +12227,61 @@ var TreeView = function (_a, ref) {
12227
12227
  };
12228
12228
  var _TreeView = React.forwardRef(TreeView);
12229
12229
 
12230
+ /**
12231
+ * Avatar component that shows profile image or name initials of the user
12232
+ */
12233
+ var Avatar = function (_a) {
12234
+ var src = _a.src, status = _a.status, _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.alt, alt = _c === void 0 ? 'Avatar image' : _c, initials = _a.initials;
12235
+ var imageStyles = cn$1('rounded-full', {
12236
+ 'h-6 w-6': size === 'xxs',
12237
+ 'h-8 w-8': size === 'xs',
12238
+ 'h-10 w-10': size === 'sm',
12239
+ 'h-12 w-12': size === 'md',
12240
+ 'h-14 w-14': size === 'lg',
12241
+ 'h-16 w-16': size === 'xl'
12242
+ });
12243
+ var initialsStyles = cn$1('inline-flex items-center justify-center rounded-full bg-gray-500', {
12244
+ 'h-6 w-6': size === 'xxs',
12245
+ 'h-8 w-8': size === 'xs',
12246
+ 'h-10 w-10': size === 'sm',
12247
+ 'h-12 w-12': size === 'md',
12248
+ 'h-14 w-14': size === 'lg',
12249
+ 'h-16 w-16': size === 'xl'
12250
+ });
12251
+ var fontStyles = cn$1('font-medium leading-none text-white uppercase', {
12252
+ 'text-xs': size === 'xxs' || size === 'xs',
12253
+ 'text-sm': size === 'sm',
12254
+ 'text-base': size === 'md',
12255
+ 'text-lg': size === 'lg',
12256
+ 'text-xl': size === 'xl'
12257
+ });
12258
+ var defaultAvatarStyles = cn$1('inline-block rounded-full overflow-hidden bg-gray-100', {
12259
+ 'h-6 w-6': size === 'xxs',
12260
+ 'h-8 w-8': size === 'xs',
12261
+ 'h-10 w-10': size === 'sm',
12262
+ 'h-12 w-12': size === 'md',
12263
+ 'h-14 w-14': size === 'lg',
12264
+ 'h-16 w-16': size === 'xl'
12265
+ });
12266
+ var statusStyles = cn$1('absolute top-0 right-0 block rounded-full ring-2 ring-white', {
12267
+ 'h-1.5 w-1.5': size === 'xxs',
12268
+ 'h-2 w-2': size === 'xs',
12269
+ 'h-2.5 w-2.5': size === 'sm',
12270
+ 'h-3 w-3': size === 'md',
12271
+ 'h-3.5 w-3.5': size === 'lg',
12272
+ 'h-4 w-4': size === 'xl',
12273
+ 'bg-gray-300': status === 'offline',
12274
+ 'bg-red-400': status === 'busy',
12275
+ 'bg-green-400': status === 'online'
12276
+ });
12277
+ return (React__default["default"].createElement("span", { className: "inline-block relative" },
12278
+ src ? (React__default["default"].createElement("img", { className: imageStyles, src: src, alt: alt })) : initials ? (React__default["default"].createElement("span", { className: initialsStyles },
12279
+ React__default["default"].createElement("span", { className: fontStyles }, initials))) : (React__default["default"].createElement("span", { className: defaultAvatarStyles },
12280
+ React__default["default"].createElement("svg", { className: "h-full w-full text-gray-300", fill: "currentColor", viewBox: "0 0 24 24" },
12281
+ React__default["default"].createElement("path", { d: "M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z" })))),
12282
+ status && React__default["default"].createElement("span", { className: statusStyles })));
12283
+ };
12284
+
12230
12285
  /** Primary UI component for user interaction */
12231
12286
  var InputCounter = function (_a) {
12232
12287
  var _b = _a.current, current = _b === void 0 ? 0 : _b, limit = _a.limit;
@@ -12244,7 +12299,7 @@ var InputCounter = function (_a) {
12244
12299
  var defaultStyles = 'border py-2 px-3 rounded-md text-sm leading-5 font-normal w-full border-gray-300 shadow-sm';
12245
12300
  /** Base input field component */
12246
12301
  var BaseField = function (_a, ref) {
12247
- 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;
12248
12303
  var handleChange = function (e) {
12249
12304
  var targetValue = e.currentTarget.value;
12250
12305
  onChange && onChange(targetValue);
@@ -12262,16 +12317,19 @@ var BaseField = function (_a, ref) {
12262
12317
  });
12263
12318
  return (React__default["default"].createElement("input", { onFocus: handleFocus, onBlur: handleBlur, onChange: function (e) {
12264
12319
  handleChange(e);
12265
- }, 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" }));
12266
12321
  };
12267
12322
  var _BaseField = React.forwardRef(BaseField);
12268
12323
 
12269
- var TextInput = function (_a) {
12270
- 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;
12271
12326
  var _c = React.useState(Boolean(isFocused)), isFocus = _c[0], setIsFocus = _c[1];
12272
- var _d = React.useState(false), isActive = _d[0], setIsActive = _d[1];
12273
- 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];
12274
12329
  var inputRef = React.useRef(null);
12330
+ React.useEffect(function () {
12331
+ setValue(externalValue);
12332
+ }, [externalValue]);
12275
12333
  // set force focus
12276
12334
  React.useEffect(function () {
12277
12335
  var input = inputRef.current;
@@ -12304,14 +12362,15 @@ var TextInput = function (_a) {
12304
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 });
12305
12363
  var discriptionStyles = cn$1('text-sm mt-1 block', { 'text-gray-500': !isError }, { 'text-red-500': isError });
12306
12364
  return (React__default["default"].createElement("div", null,
12307
- 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 }),
12308
12366
  React__default["default"].createElement("div", null,
12309
- 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 }),
12310
12368
  React__default["default"].createElement("div", { className: "flex flex-row space-x-3" },
12311
12369
  React__default["default"].createElement("div", { className: "grow" }, message && React__default["default"].createElement("span", { className: discriptionStyles }, message)),
12312
12370
  isShowCounter && (React__default["default"].createElement("div", { className: "shrink-0" },
12313
12371
  React__default["default"].createElement(InputCounter, { current: Number(value === null || value === void 0 ? void 0 : value.length), limit: maxLength })))))));
12314
- };
12372
+ };
12373
+ var _TextInput = React.forwardRef(TextInput);
12315
12374
 
12316
12375
  /** Comment */
12317
12376
  var InputCta = function (_a) {
@@ -12341,11 +12400,14 @@ var InputCta = function (_a) {
12341
12400
  ctaLabel && React__default["default"].createElement("span", null, ctaLabel)));
12342
12401
  };
12343
12402
 
12344
- var TextInputAddon = function (_a) {
12345
- 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;
12346
12405
  var _d = React.useState(Boolean(isFocused)), isFocus = _d[0], setIsFocus = _d[1];
12347
- var _e = React.useState(defaultValue), value = _e[0], setValue = _e[1];
12406
+ var _e = React.useState(defaultValue || ''), value = _e[0], setValue = _e[1];
12348
12407
  var inputRef = React.useRef(null);
12408
+ React.useEffect(function () {
12409
+ setValue(externalValue);
12410
+ }, [externalValue]);
12349
12411
  // set force focus
12350
12412
  React.useEffect(function () {
12351
12413
  var input = inputRef.current;
@@ -12381,13 +12443,14 @@ var TextInputAddon = function (_a) {
12381
12443
  React__default["default"].createElement("div", { className: "flex-grow focus-within:z-20 relative" },
12382
12444
  inlineIcon && (React__default["default"].createElement("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none" },
12383
12445
  React__default["default"].createElement(DynamicIcons, { icon: inlineIcon, className: "h-5 w-5 text-gray-400", outline: false }))),
12384
- 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 })),
12385
12447
  (trailIcon || trailLabel) && (React__default["default"].createElement(InputCta, { icon: trailIcon, ctaLabel: trailLabel, align: "right", isClear: clearCta === 'right' || clearCta === 'both', onClickHandler: onCtaClick }))),
12386
12448
  React__default["default"].createElement("div", { className: "flex flex-row space-x-3" },
12387
12449
  React__default["default"].createElement("div", { className: "grow" }, message && React__default["default"].createElement("span", { className: discriptionStyles }, message)),
12388
12450
  isShowCounter && (React__default["default"].createElement("div", { className: "shrink-0" },
12389
12451
  React__default["default"].createElement(InputCounter, { current: Number(value === null || value === void 0 ? void 0 : value.length), limit: maxLength }))))));
12390
- };
12452
+ };
12453
+ var _TextInputAddon = React.forwardRef(TextInputAddon);
12391
12454
 
12392
12455
  /** Comment */
12393
12456
  var InputSelect = function (_a) {
@@ -12405,10 +12468,13 @@ var InputSelect = function (_a) {
12405
12468
  };
12406
12469
 
12407
12470
  var TextInputSelect = function (_a) {
12408
- 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;
12409
12472
  var _d = React.useState(Boolean(isFocused)), isFocus = _d[0], setIsFocus = _d[1];
12410
- var _e = React.useState(defaultValue), value = _e[0], setValue = _e[1];
12473
+ var _e = React.useState(defaultValue || ''), value = _e[0], setValue = _e[1];
12411
12474
  var inputRef = React.useRef(null);
12475
+ React.useEffect(function () {
12476
+ setValue(externalValue);
12477
+ }, [externalValue]);
12412
12478
  // set force focus
12413
12479
  React.useEffect(function () {
12414
12480
  var input = inputRef.current;
@@ -12449,7 +12515,7 @@ var TextInputSelect = function (_a) {
12449
12515
  React__default["default"].createElement("div", { className: "flex-grow focus-within:z-20 relative" },
12450
12516
  prefix && (React__default["default"].createElement("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none" },
12451
12517
  React__default["default"].createElement("span", { className: "text-gray-500 sm:text-sm" }, prefix))),
12452
- 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 })),
12453
12519
  (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.length) && selectLocation === 'right' && (React__default["default"].createElement(InputSelect, { inputOptions: inputOptions, align: 'right', onSelectOption: onSelectOption }))),
12454
12520
  React__default["default"].createElement("div", { className: "flex flex-row space-x-3" },
12455
12521
  React__default["default"].createElement("div", { className: "grow" }, message && React__default["default"].createElement("span", { className: discriptionStyles }, message)),
@@ -12548,6 +12614,7 @@ var Checkbox = function (_a) {
12548
12614
  message && (React__default["default"].createElement("p", { id: "".concat(id, "-description"), className: "text-gray-500" }, message)))));
12549
12615
  };
12550
12616
 
12617
+ exports.Avatar = Avatar;
12551
12618
  exports.Button = Button;
12552
12619
  exports.Checkbox = Checkbox;
12553
12620
  exports.Combobox = Combobox;
@@ -12556,8 +12623,8 @@ exports.Placeholder = Placeholder;
12556
12623
  exports.Radio = Radio;
12557
12624
  exports.Select = Select;
12558
12625
  exports.Switch = Switch;
12559
- exports.TextInput = TextInput;
12560
- exports.TextInputAddon = TextInputAddon;
12626
+ exports.TextInput = _TextInput;
12627
+ exports.TextInputAddon = _TextInputAddon;
12561
12628
  exports.TextInputSelect = TextInputSelect;
12562
12629
  exports.Textarea = _Textarea;
12563
12630
  exports.TreeView = _TreeView;