@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.esm.js CHANGED
@@ -12201,6 +12201,61 @@ var TreeView = function (_a, ref) {
12201
12201
  };
12202
12202
  var _TreeView = forwardRef(TreeView);
12203
12203
 
12204
+ /**
12205
+ * Avatar component that shows profile image or name initials of the user
12206
+ */
12207
+ var Avatar = function (_a) {
12208
+ 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;
12209
+ var imageStyles = cn$1('rounded-full', {
12210
+ 'h-6 w-6': size === 'xxs',
12211
+ 'h-8 w-8': size === 'xs',
12212
+ 'h-10 w-10': size === 'sm',
12213
+ 'h-12 w-12': size === 'md',
12214
+ 'h-14 w-14': size === 'lg',
12215
+ 'h-16 w-16': size === 'xl'
12216
+ });
12217
+ var initialsStyles = cn$1('inline-flex items-center justify-center rounded-full bg-gray-500', {
12218
+ 'h-6 w-6': size === 'xxs',
12219
+ 'h-8 w-8': size === 'xs',
12220
+ 'h-10 w-10': size === 'sm',
12221
+ 'h-12 w-12': size === 'md',
12222
+ 'h-14 w-14': size === 'lg',
12223
+ 'h-16 w-16': size === 'xl'
12224
+ });
12225
+ var fontStyles = cn$1('font-medium leading-none text-white uppercase', {
12226
+ 'text-xs': size === 'xxs' || size === 'xs',
12227
+ 'text-sm': size === 'sm',
12228
+ 'text-base': size === 'md',
12229
+ 'text-lg': size === 'lg',
12230
+ 'text-xl': size === 'xl'
12231
+ });
12232
+ var defaultAvatarStyles = cn$1('inline-block rounded-full overflow-hidden bg-gray-100', {
12233
+ 'h-6 w-6': size === 'xxs',
12234
+ 'h-8 w-8': size === 'xs',
12235
+ 'h-10 w-10': size === 'sm',
12236
+ 'h-12 w-12': size === 'md',
12237
+ 'h-14 w-14': size === 'lg',
12238
+ 'h-16 w-16': size === 'xl'
12239
+ });
12240
+ var statusStyles = cn$1('absolute top-0 right-0 block rounded-full ring-2 ring-white', {
12241
+ 'h-1.5 w-1.5': size === 'xxs',
12242
+ 'h-2 w-2': size === 'xs',
12243
+ 'h-2.5 w-2.5': size === 'sm',
12244
+ 'h-3 w-3': size === 'md',
12245
+ 'h-3.5 w-3.5': size === 'lg',
12246
+ 'h-4 w-4': size === 'xl',
12247
+ 'bg-gray-300': status === 'offline',
12248
+ 'bg-red-400': status === 'busy',
12249
+ 'bg-green-400': status === 'online'
12250
+ });
12251
+ return (React__default.createElement("span", { className: "inline-block relative" },
12252
+ src ? (React__default.createElement("img", { className: imageStyles, src: src, alt: alt })) : initials ? (React__default.createElement("span", { className: initialsStyles },
12253
+ React__default.createElement("span", { className: fontStyles }, initials))) : (React__default.createElement("span", { className: defaultAvatarStyles },
12254
+ React__default.createElement("svg", { className: "h-full w-full text-gray-300", fill: "currentColor", viewBox: "0 0 24 24" },
12255
+ React__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" })))),
12256
+ status && React__default.createElement("span", { className: statusStyles })));
12257
+ };
12258
+
12204
12259
  /** Primary UI component for user interaction */
12205
12260
  var InputCounter = function (_a) {
12206
12261
  var _b = _a.current, current = _b === void 0 ? 0 : _b, limit = _a.limit;
@@ -12218,7 +12273,7 @@ var InputCounter = function (_a) {
12218
12273
  var defaultStyles = 'border py-2 px-3 rounded-md text-sm leading-5 font-normal w-full border-gray-300 shadow-sm';
12219
12274
  /** Base input field component */
12220
12275
  var BaseField = function (_a, ref) {
12221
- 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;
12276
+ 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;
12222
12277
  var handleChange = function (e) {
12223
12278
  var targetValue = e.currentTarget.value;
12224
12279
  onChange && onChange(targetValue);
@@ -12236,16 +12291,19 @@ var BaseField = function (_a, ref) {
12236
12291
  });
12237
12292
  return (React__default.createElement("input", { onFocus: handleFocus, onBlur: handleBlur, onChange: function (e) {
12238
12293
  handleChange(e);
12239
- }, placeholder: placeholder, ref: ref, type: type, name: name, id: id, className: scopedtyles, disabled: isDisabled, defaultValue: defaultValue, maxLength: maxLength, autoComplete: "off" }));
12294
+ }, placeholder: placeholder, ref: ref, type: type, name: name, id: id, className: scopedtyles, disabled: isDisabled, value: value, defaultValue: defaultValue, maxLength: maxLength, autoComplete: "off" }));
12240
12295
  };
12241
12296
  var _BaseField = forwardRef(BaseField);
12242
12297
 
12243
- var TextInput = function (_a) {
12244
- 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;
12298
+ var TextInput = function (_a, ref) {
12299
+ 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;
12245
12300
  var _c = useState(Boolean(isFocused)), isFocus = _c[0], setIsFocus = _c[1];
12246
- var _d = useState(false), isActive = _d[0], setIsActive = _d[1];
12247
- var _e = useState(defaultValue), value = _e[0], setValue = _e[1];
12301
+ var _d = useState(false); _d[0]; var setIsActive = _d[1];
12302
+ var _e = useState(defaultValue || ''), value = _e[0], setValue = _e[1];
12248
12303
  var inputRef = useRef(null);
12304
+ useEffect(function () {
12305
+ setValue(externalValue);
12306
+ }, [externalValue]);
12249
12307
  // set force focus
12250
12308
  useEffect(function () {
12251
12309
  var input = inputRef.current;
@@ -12278,14 +12336,15 @@ var TextInput = function (_a) {
12278
12336
  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 });
12279
12337
  var discriptionStyles = cn$1('text-sm mt-1 block', { 'text-gray-500': !isError }, { 'text-red-500': isError });
12280
12338
  return (React__default.createElement("div", null,
12281
- React__default.createElement(InputLabel, { isPlaceholder: true, label: label, isRequired: isRequired, id: id, isError: isError, isActive: isActive, isDisabled: isDisabled }),
12339
+ React__default.createElement(InputLabel, { isPlaceholder: true, label: label, isRequired: isRequired, id: id, isError: isError, isActive: true, isDisabled: isDisabled }),
12282
12340
  React__default.createElement("div", null,
12283
- React__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 }),
12341
+ React__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 }),
12284
12342
  React__default.createElement("div", { className: "flex flex-row space-x-3" },
12285
12343
  React__default.createElement("div", { className: "grow" }, message && React__default.createElement("span", { className: discriptionStyles }, message)),
12286
12344
  isShowCounter && (React__default.createElement("div", { className: "shrink-0" },
12287
12345
  React__default.createElement(InputCounter, { current: Number(value === null || value === void 0 ? void 0 : value.length), limit: maxLength })))))));
12288
- };
12346
+ };
12347
+ var _TextInput = forwardRef(TextInput);
12289
12348
 
12290
12349
  /** Comment */
12291
12350
  var InputCta = function (_a) {
@@ -12315,11 +12374,14 @@ var InputCta = function (_a) {
12315
12374
  ctaLabel && React__default.createElement("span", null, ctaLabel)));
12316
12375
  };
12317
12376
 
12318
- var TextInputAddon = function (_a) {
12319
- 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;
12377
+ var TextInputAddon = function (_a, ref) {
12378
+ 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;
12320
12379
  var _d = useState(Boolean(isFocused)), isFocus = _d[0], setIsFocus = _d[1];
12321
- var _e = useState(defaultValue), value = _e[0], setValue = _e[1];
12380
+ var _e = useState(defaultValue || ''), value = _e[0], setValue = _e[1];
12322
12381
  var inputRef = useRef(null);
12382
+ useEffect(function () {
12383
+ setValue(externalValue);
12384
+ }, [externalValue]);
12323
12385
  // set force focus
12324
12386
  useEffect(function () {
12325
12387
  var input = inputRef.current;
@@ -12355,13 +12417,14 @@ var TextInputAddon = function (_a) {
12355
12417
  React__default.createElement("div", { className: "flex-grow focus-within:z-20 relative" },
12356
12418
  inlineIcon && (React__default.createElement("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none" },
12357
12419
  React__default.createElement(DynamicIcons, { icon: inlineIcon, className: "h-5 w-5 text-gray-400", outline: false }))),
12358
- React__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 })),
12420
+ React__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 })),
12359
12421
  (trailIcon || trailLabel) && (React__default.createElement(InputCta, { icon: trailIcon, ctaLabel: trailLabel, align: "right", isClear: clearCta === 'right' || clearCta === 'both', onClickHandler: onCtaClick }))),
12360
12422
  React__default.createElement("div", { className: "flex flex-row space-x-3" },
12361
12423
  React__default.createElement("div", { className: "grow" }, message && React__default.createElement("span", { className: discriptionStyles }, message)),
12362
12424
  isShowCounter && (React__default.createElement("div", { className: "shrink-0" },
12363
12425
  React__default.createElement(InputCounter, { current: Number(value === null || value === void 0 ? void 0 : value.length), limit: maxLength }))))));
12364
- };
12426
+ };
12427
+ var _TextInputAddon = forwardRef(TextInputAddon);
12365
12428
 
12366
12429
  /** Comment */
12367
12430
  var InputSelect = function (_a) {
@@ -12379,10 +12442,13 @@ var InputSelect = function (_a) {
12379
12442
  };
12380
12443
 
12381
12444
  var TextInputSelect = function (_a) {
12382
- 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;
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, 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;
12383
12446
  var _d = useState(Boolean(isFocused)), isFocus = _d[0], setIsFocus = _d[1];
12384
- var _e = useState(defaultValue), value = _e[0], setValue = _e[1];
12447
+ var _e = useState(defaultValue || ''), value = _e[0], setValue = _e[1];
12385
12448
  var inputRef = useRef(null);
12449
+ useEffect(function () {
12450
+ setValue(externalValue);
12451
+ }, [externalValue]);
12386
12452
  // set force focus
12387
12453
  useEffect(function () {
12388
12454
  var input = inputRef.current;
@@ -12423,7 +12489,7 @@ var TextInputSelect = function (_a) {
12423
12489
  React__default.createElement("div", { className: "flex-grow focus-within:z-20 relative" },
12424
12490
  prefix && (React__default.createElement("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none" },
12425
12491
  React__default.createElement("span", { className: "text-gray-500 sm:text-sm" }, prefix))),
12426
- React__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 })),
12492
+ React__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 })),
12427
12493
  (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.length) && selectLocation === 'right' && (React__default.createElement(InputSelect, { inputOptions: inputOptions, align: 'right', onSelectOption: onSelectOption }))),
12428
12494
  React__default.createElement("div", { className: "flex flex-row space-x-3" },
12429
12495
  React__default.createElement("div", { className: "grow" }, message && React__default.createElement("span", { className: discriptionStyles }, message)),
@@ -12522,5 +12588,5 @@ var Checkbox = function (_a) {
12522
12588
  message && (React__default.createElement("p", { id: "".concat(id, "-description"), className: "text-gray-500" }, message)))));
12523
12589
  };
12524
12590
 
12525
- export { Button, Checkbox, Combobox, Dropdown, Placeholder, Radio, Select, Switch, TextInput, TextInputAddon, TextInputSelect, _Textarea as Textarea, _TreeView as TreeView };
12591
+ export { Avatar, Button, Checkbox, Combobox, Dropdown, Placeholder, Radio, Select, Switch, _TextInput as TextInput, _TextInputAddon as TextInputAddon, TextInputSelect, _Textarea as Textarea, _TreeView as TreeView };
12526
12592
  //# sourceMappingURL=index.esm.js.map