kamotive_ui 17.3.26 → 19.5.26

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 (43) hide show
  1. package/dist/components/AttachedFilesPreview/AttachedFilesPreview.d.ts +1 -0
  2. package/dist/components/AttachedFilesPreview/AttachedFilesPreview.js +4 -4
  3. package/dist/components/Breadcrumb/Breadcrumb.js +4 -4
  4. package/dist/components/Breadcrumbs/Breadcrumbs.js +10 -4
  5. package/dist/components/Button/Button.d.ts +1 -1
  6. package/dist/components/Button/Button.js +11 -10
  7. package/dist/components/Button/Button.module.css +2 -1
  8. package/dist/components/Checkbox/Checkbox.js +4 -4
  9. package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -0
  10. package/dist/components/Checkbox/Checkbox.stories.js +1 -0
  11. package/dist/components/ColorPicker/ColorPicker.js +9 -8
  12. package/dist/components/Comment/Comment.js +13 -13
  13. package/dist/components/DateInput/DateInput.js +20 -19
  14. package/dist/components/Dialog/Dialog.js +5 -5
  15. package/dist/components/Dropdown/Dropdown.d.ts +3 -2
  16. package/dist/components/Dropdown/Dropdown.js +132 -52
  17. package/dist/components/Dropdown/Dropdown.module.css +12 -4
  18. package/dist/components/FileAttach/FileAttach.js +4 -4
  19. package/dist/components/FileItem/FileItem.js +8 -8
  20. package/dist/components/FileListAttached/FileListAtta/321/201hed.js +5 -5
  21. package/dist/components/FileLoader/FileLoader.js +16 -15
  22. package/dist/components/IconButton/IconButton.js +5 -2
  23. package/dist/components/Input/Input.js +6 -6
  24. package/dist/components/Link/Link.js +5 -5
  25. package/dist/components/List/List.js +13 -11
  26. package/dist/components/ListItem/ListItem.js +8 -8
  27. package/dist/components/ProgressBar/ProgressBar.js +4 -4
  28. package/dist/components/ProgressLoader/ProgressLoader.js +4 -4
  29. package/dist/components/RadioButton/RadioButton.js +4 -4
  30. package/dist/components/SettingTag/SettingTag.js +4 -4
  31. package/dist/components/Snackbar/Snackbar.js +7 -7
  32. package/dist/components/Spinner/Spinner.js +3 -3
  33. package/dist/components/Tab/Tab.js +3 -3
  34. package/dist/components/TableFilterSidebar/TableFilterSidebar.js +11 -11
  35. package/dist/components/Tabs/Tabs.js +14 -8
  36. package/dist/components/Tag/Tag.js +7 -7
  37. package/dist/components/TextEditor/TextEditor.js +179 -578
  38. package/dist/components/TextEditor/TextEditor.module.css +8 -7
  39. package/dist/components/ToggleButton/ToggleButton.js +4 -4
  40. package/dist/components/Tooltip/Tooltip.js +3 -3
  41. package/dist/components/Typography/Typography.js +2 -2
  42. package/dist/types/index.d.ts +56 -14
  43. package/package.json +5 -1
@@ -17,6 +17,7 @@ interface AttachedFilesProps {
17
17
  className?: string;
18
18
  maxFileCount?: number;
19
19
  lng: string;
20
+ testId?: string;
20
21
  }
21
22
  export declare const AttachedFilesPreview: React.FC<AttachedFilesProps>;
22
23
  export {};
@@ -16,15 +16,15 @@ export const formatFileSize = (bytes, lng) => {
16
16
  const sizes = lng === 'ru' || (lng === null || lng === void 0 ? void 0 : lng.includes('ru')) ? sizesRu : sizesEn;
17
17
  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
18
18
  };
19
- export const AttachedFilesPreview = ({ files, onDownload, allowDelete = false, onDelete, style, className, maxFileCount = 5, lng, }) => {
20
- return (React.createElement("div", { className: className, style: style, title: "" },
19
+ export const AttachedFilesPreview = ({ files, onDownload, allowDelete = false, onDelete, style, className, maxFileCount = 5, lng, testId = 'default' }) => {
20
+ return (React.createElement("div", { className: className, style: style, title: "", "data-test-id": `${testId}-files-preview-list` },
21
21
  files.map((file, index) => {
22
22
  var _a;
23
23
  return (React.createElement(FileItem, { key: `${index + ((_a = file.filename) !== null && _a !== void 0 ? _a : '')}`, file: file, error: file.error, canDelete: allowDelete, canDownload: Boolean(onDownload), onDelete: (id) => allowDelete && (onDelete === null || onDelete === void 0 ? void 0 : onDelete(id)), onDownload: (file) => onDownload === null || onDownload === void 0 ? void 0 : onDownload(file), style: {
24
24
  border: !file.error ? 'none' : undefined,
25
25
  padding: !file.error ? '5px 5px' : '5px 5px',
26
26
  borderRadius: '5px'
27
- }, isRejectedFile: file.error, isComment: true, lng: lng }));
27
+ }, isRejectedFile: file.error, isComment: true, lng: lng, testId: `${testId}-files-preview-${index}` }));
28
28
  }),
29
- files.length > maxFileCount && (React.createElement(Typography, { variant: "Caption", color: "var(--error-main)" }, (lng === 'ru' || lng.includes('ru')) ? `Максимальное количество файлов ${maxFileCount}` : `Maximum number of files ${maxFileCount}`))));
29
+ files.length > maxFileCount && (React.createElement(Typography, { variant: "Caption", color: "var(--error-main)", testId: `${testId}-files-preview-error` }, (lng === 'ru' || lng.includes('ru')) ? `Максимальное количество файлов ${maxFileCount}` : `Maximum number of files ${maxFileCount}`))));
30
30
  };
@@ -3,7 +3,7 @@ import styles from './Breadcrumb.module.css';
3
3
  import classNames from 'classnames';
4
4
  ;
5
5
  import { Typography } from '../Typography/Typography';
6
- export const Breadcrumb = ({ onClick, active, label, icon, children }) => {
6
+ export const Breadcrumb = ({ onClick, active, label, icon, children, testId = 'default' }) => {
7
7
  const handleClick = (e) => {
8
8
  if (!active && onClick) {
9
9
  onClick();
@@ -11,7 +11,7 @@ export const Breadcrumb = ({ onClick, active, label, icon, children }) => {
11
11
  };
12
12
  const childrenClassNames = classNames(active ? styles['children--active'] : styles['children--inactive'], styles.children);
13
13
  const iconClassNames = classNames(childrenClassNames, styles.icon);
14
- return (React.createElement("button", { className: classNames(styles.breadcrumb), onClick: handleClick },
15
- icon && React.createElement("span", { className: iconClassNames }, icon),
16
- React.createElement(Typography, { variant: "Body1-Medium", className: childrenClassNames }, label || children)));
14
+ return (React.createElement("button", { "data-test-id": `${testId}-breadcrumb-button`, className: classNames(styles.breadcrumb), onClick: handleClick },
15
+ icon && React.createElement("span", { "data-test-id": `${testId}-breadcrumb-icon`, className: iconClassNames }, icon),
16
+ React.createElement(Typography, { testId: `${testId}-breadcrumb`, variant: "Body1-Medium", className: childrenClassNames }, label || children)));
17
17
  };
@@ -1,10 +1,16 @@
1
1
  import React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import styles from './Breadcrumbs.module.css';
4
- export const Breadcrumbs = ({ className, separator = '/', children }) => {
5
- return (React.createElement("nav", { className: classNames(styles.breadcrumbs, className) }, React.Children.map(children, (child, index) => {
4
+ export const Breadcrumbs = ({ className, separator = '/', children, testId = 'default' }) => {
5
+ return (React.createElement("nav", { "data-test-id": `${testId}-breadcrumbs-block`, className: classNames(styles.breadcrumbs, className) }, React.Children.map(children, (child, index) => {
6
+ const isReactElement = React.isValidElement(child);
6
7
  return (React.createElement(React.Fragment, { key: index },
7
- child,
8
- index < children.length - 1 && (React.createElement("span", { className: styles.separator }, separator))));
8
+ isReactElement
9
+ ? React.cloneElement(child, {
10
+ // Передаем testId родителя внутрь ребенка, если у ребенка нет своего
11
+ testId: child.props.testId || testId
12
+ })
13
+ : child,
14
+ index < children.length - 1 && (React.createElement("span", { "data-test-id": `${testId}-breadcrumbs-separator`, className: styles.separator }, separator))));
9
15
  })));
10
16
  };
@@ -3,4 +3,4 @@ import { ButtonProps } from '../../types';
3
3
  /**
4
4
  * Компонент Button представляет собой кнопку, которую можно настроить с помощью различных параметров (размер, иконки, стили, состояние).
5
5
  */
6
- export declare const Button: React.FC<ButtonProps>;
6
+ export declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -5,7 +5,7 @@ import { Typography } from '../Typography/Typography';
5
5
  /**
6
6
  * Компонент Button представляет собой кнопку, которую можно настроить с помощью различных параметров (размер, иконки, стили, состояние).
7
7
  */
8
- export const Button = ({ label, variant = 'fill', size = 'md', mode, style, condition, icon, disabled = false, onClick, children, error, color, name, type = 'button', form }) => {
8
+ export const Button = React.forwardRef(({ label, variant = 'fill', size = 'md', mode, style, condition, icon, disabled = false, onClick, children, error, color, name, type = 'button', form, className, active, testId = 'default' }, ref) => {
9
9
  const btnIcon = icon || typeof children === 'object' && children;
10
10
  let modeStyle = 'text';
11
11
  if (mode) {
@@ -15,9 +15,10 @@ export const Button = ({ label, variant = 'fill', size = 'md', mode, style, cond
15
15
  modeStyle = (!label && !children) ? 'icon' : 'default';
16
16
  }
17
17
  const buttonCondition = error ? 'error' : (condition || 'default');
18
- const buttonClasses = classNames(styles['button'], styles[`button--${size}`], styles[`button--${modeStyle}`], {
18
+ const buttonClasses = classNames(styles['button'], styles[`button--${size}`], styles[`button--${modeStyle}`], className, {
19
19
  [styles[`button--${variant}-${buttonCondition}`]]: buttonCondition && !color,
20
- [styles[`button--${variant}-custom`]]: color && !error
20
+ [styles[`button--${variant}-custom`]]: color && !error,
21
+ [styles[`button--${variant}-${buttonCondition}--active`]]: active && buttonCondition && !color,
21
22
  });
22
23
  const iconColorFn = () => {
23
24
  if (buttonCondition && !color) {
@@ -57,10 +58,10 @@ export const Button = ({ label, variant = 'fill', size = 'md', mode, style, cond
57
58
  };
58
59
  const iconColorStyle = iconColorFn();
59
60
  if (!modeStyle) {
60
- return (React.createElement("button", { className: buttonClasses },
61
- React.createElement(Typography, { variant: "Body1" }, "\u041A\u043D\u043E\u043F\u043A\u0430")));
61
+ return (React.createElement("button", { "data-test-id": `${testId}-button`, className: buttonClasses },
62
+ React.createElement(Typography, { variant: "Body1", testId: `${testId}-button` }, "\u041A\u043D\u043E\u043F\u043A\u0430")));
62
63
  }
63
- return (React.createElement("button", { className: buttonClasses, style: Object.assign(Object.assign({}, style), (color && !error ? {
64
+ return (React.createElement("button", { "data-test-id": `${testId}-button`, className: buttonClasses, ref: ref, style: Object.assign(Object.assign({}, style), (color && !error ? {
64
65
  '--button-color': color,
65
66
  '--button-hover-color': variant === 'fill' || variant === 'link' ? `color-mix(in srgb, ${color} 90%, black)` : `color-mix(in srgb, ${color} 10%, transparent)`,
66
67
  '--button-active-color': variant === 'fill' || variant === 'link' ? `color-mix(in srgb, ${color} 80%, black)` : `color-mix(in srgb, ${color} 20%, transparent)`,
@@ -71,10 +72,10 @@ export const Button = ({ label, variant = 'fill', size = 'md', mode, style, cond
71
72
  var _a;
72
73
  const iconElement = btnIcon;
73
74
  const defaultStrokeWidth = size === 'lg' ? '0.5' : size === 'md' ? '0.3' : '0.0';
74
- return React.cloneElement(iconElement, {
75
+ return (React.createElement("span", { "data-test-id": `${testId}-button-icon`, className: "button-icon-wrapper", style: { display: 'inline-flex' } }, React.cloneElement(iconElement, {
75
76
  htmlColor: iconColorStyle,
76
77
  strokeWidth: (_a = iconElement.props.strokeWidth) !== null && _a !== void 0 ? _a : defaultStrokeWidth,
77
- });
78
+ })));
78
79
  })(),
79
- (modeStyle === 'text' || modeStyle === 'default') && (React.createElement(Typography, { variant: "Body1" }, label ? label : typeof children === 'string' && children))));
80
- };
80
+ (modeStyle === 'text' || modeStyle === 'default') && (React.createElement(Typography, { testId: `${testId}-button`, variant: "Body1" }, label ? label : typeof children === 'string' && children))));
81
+ });
@@ -200,7 +200,8 @@
200
200
  color: var(--blue-main);
201
201
  border: 1px solid var(--blue-main);
202
202
  }
203
- .button--outline-default:hover {
203
+ .button--outline-default:hover,
204
+ .button--outline-default--active {
204
205
  background-color: rgba(13, 153, 255, 0.07);
205
206
  color: var(--blue-main);
206
207
  border: 1px solid var(--blue-main);
@@ -3,7 +3,7 @@ import styles from './Checkbox.module.css';
3
3
  import classNames from 'classnames';
4
4
  ;
5
5
  import { Typography } from '../Typography/Typography';
6
- export const Checkbox = ({ checked, onChange, disabled = false, size = 'sm', label, color, filled }) => {
6
+ export const Checkbox = ({ checked, onChange, disabled = false, size = 'sm', label, color, filled, testId = 'default' }) => {
7
7
  const handleChange = (e) => {
8
8
  if (onChange) {
9
9
  onChange(e);
@@ -21,7 +21,7 @@ export const Checkbox = ({ checked, onChange, disabled = false, size = 'sm', lab
21
21
  '--arrow-color-hover': filled ? 'var(--white)' : 'var(--border-color-hover)',
22
22
  '--arrow-color-disabled': filled ? 'var(--white)' : 'var(--border-color-disabled)',
23
23
  };
24
- return (React.createElement("label", { className: styles.checkbox, style: checkboxStyles },
25
- React.createElement("input", { type: "checkbox", checked: checked, onChange: handleChange, disabled: disabled, className: classNames(styles.input, styles[size]) }),
26
- React.createElement(Typography, { variant: 'Body2' }, label)));
24
+ return (React.createElement("label", { "data-test-id": `${testId}-checkbox`, className: styles.checkbox, style: checkboxStyles },
25
+ React.createElement("input", { type: "checkbox", name: 'checkbox', checked: checked, onChange: handleChange, disabled: disabled, className: classNames(styles.input, styles[size]), "data-test-id": `${testId}-checkbox-input` }),
26
+ React.createElement(Typography, { testId: `${testId}-checkbox`, variant: 'Body2' }, label)));
27
27
  };
@@ -11,6 +11,7 @@ export interface CheckboxProps {
11
11
  size?: 'sm' | 'md';
12
12
  /** Текст лейбла */
13
13
  label?: string;
14
+ testId?: string;
14
15
  }
15
16
  declare const meta: Meta<CheckboxProps>;
16
17
  export default meta;
@@ -18,6 +18,7 @@ const meta = {
18
18
  args: {
19
19
  size: 'sm',
20
20
  disabled: false,
21
+ testId: 'storybook'
21
22
  },
22
23
  argTypes: {
23
24
  size: {
@@ -59,7 +59,7 @@ const mouseLeaveTimer = (callback, delay) => {
59
59
  /**
60
60
  * Компонент ColorPicker представляет собой элемент управления для выбора цвета.
61
61
  */
62
- export const ColorPicker = ({ color = '#ffffff', mainColor, recentColors, setIsHovered, width = 10, height = 10, autoOpen = false, onChange, onColorChange, }) => {
62
+ export const ColorPicker = ({ color = '#ffffff', mainColor, recentColors, setIsHovered, width = 10, height = 10, autoOpen = false, onChange, onColorChange, testId = 'default' }) => {
63
63
  const [colorValue, setColorValue] = useState(mainColor);
64
64
  const [selectedColor, setSelectedColor] = useState(color);
65
65
  const [isColorChanged, setIsColorChanged] = useState(false);
@@ -131,30 +131,31 @@ export const ColorPicker = ({ color = '#ffffff', mainColor, recentColors, setIsH
131
131
  setSelectedColor(newColor);
132
132
  onColorChange === null || onColorChange === void 0 ? void 0 : onColorChange(newColor);
133
133
  };
134
- return (React.createElement("div", { className: (mainColor || recentColors) && styles.colorPickerWrapper, ref: divRef },
134
+ return (React.createElement("div", { className: (mainColor || recentColors) && styles.colorPickerWrapper, ref: divRef, "data-test-id": `${testId}-color-block` },
135
135
  mainColor && (React.createElement("div", { className: mainColorClasses, style: {
136
136
  width: `${width}px`,
137
137
  height: `${height}px`,
138
138
  backgroundColor: (colorValue === null || colorValue === void 0 ? void 0 : colorValue.startsWith('#')) ? colorValue : `var(--${colorValue})`,
139
- } })),
139
+ }, "data-test-id": `${testId}-color-current` })),
140
140
  recentColors &&
141
141
  recentColors.map((color, index) => (React.createElement("div", { key: index, className: styles.circle, style: {
142
142
  width: `${width}px`,
143
143
  height: `${height}px`,
144
144
  backgroundColor: color.startsWith('#') ? color : `var(--${color})`,
145
- }, onClick: () => colorChangeHandler(color) }))),
145
+ }, onClick: () => colorChangeHandler(color), "data-test-id": `${testId}-color-${index}-circle` }))),
146
146
  React.createElement("div", { className: styles.colorPicker },
147
147
  React.createElement("div", { ref: circleRef, className: colorCircleDefaultClasses, onClick: () => setIsOpen(!isOpen), style: {
148
148
  width: `${width}px`,
149
149
  height: `${height}px`,
150
- } }),
151
- isOpen && (React.createElement("div", { ref: popoverRef, className: popoverClassess },
150
+ }, "data-test-id": `${testId}-color-button` }),
151
+ isOpen && (React.createElement("div", { "data-test-id": `${testId}-color-popover`, ref: popoverRef, className: popoverClassess },
152
152
  isOpen && React.createElement(IconColorPicker, { className: styles.colorPickerIcon, htmlColor: 'var(--white)' }),
153
- React.createElement(Chrome, { color: selectedColor, placement: GithubPlacement.Right, onChange: colorChangeHandler, className: styles.customChrome, showEyeDropper: false }),
153
+ React.createElement("div", { "data-test-id": `${testId}-color-chrome` },
154
+ React.createElement(Chrome, { color: selectedColor, placement: GithubPlacement.Right, onChange: colorChangeHandler, className: styles.customChrome, showEyeDropper: false })),
154
155
  React.createElement("div", { className: styles.hex, style: { padding: '0 10px 0 20px' } },
155
156
  React.createElement(EditableInput, { value: hexaToHex(selectedColor), style: { width: 68, alignItems: 'flex-start' }, onChange: (e, color) => {
156
157
  const formattedColor = hexaToHex(color.toString());
157
158
  colorChangeHandler(formattedColor);
158
- } })))))));
159
+ }, "data-test-id": `${testId}-color-input` })))))));
159
160
  };
160
161
  export default ColorPicker;
@@ -6,7 +6,7 @@ import { TextEditor } from '../TextEditor/TextEditor';
6
6
  import { AttachedFilesPreview } from '../AttachedFilesPreview/AttachedFilesPreview';
7
7
  import { IconAccount, IconDelete, IconPencil, IconPencilCancel } from '../../Icons';
8
8
  import { IconButton } from '../IconButton/IconButton';
9
- export const Comment = ({ comment, avatar, creationDate, canAttachFiles = true, canEdit = false, isEdit = false, error = false, setError, helperText, onSubmit, onDelete, onEdit, onDownload, canDeleteFile, onFileDelete, maxFileCount, maxFileSize, lng = 'ru', style, className, }) => {
9
+ export const Comment = ({ comment, avatar, creationDate, canAttachFiles = true, canEdit = false, isEdit = false, error = false, setError, helperText, onSubmit, onDelete, onEdit, onDownload, canDeleteFile, onFileDelete, maxFileCount, maxFileSize, lng = 'ru', style, className, testId = 'default' }) => {
10
10
  var _a, _b, _c, _d;
11
11
  const [isEditMode, setIsEditMode] = useState(isEdit);
12
12
  const [imageError, setImageError] = useState(false);
@@ -34,19 +34,19 @@ export const Comment = ({ comment, avatar, creationDate, canAttachFiles = true,
34
34
  useEffect(() => {
35
35
  onEdit === null || onEdit === void 0 ? void 0 : onEdit(isEditMode);
36
36
  }, [isEditMode]);
37
- return (React.createElement("div", { className: wrapperClassess, style: style },
38
- React.createElement("div", { style: { display: 'flex', justifyContent: 'space-between' } },
37
+ return (React.createElement("div", { "data-test-id": `${testId}-comment-section`, className: wrapperClassess, style: style },
38
+ React.createElement("div", { "data-test-id": `${testId}-comment-section-header`, style: { display: 'flex', justifyContent: 'space-between' } },
39
39
  React.createElement("div", { className: styles.labelWrapper },
40
- React.createElement("div", { className: styles.flexBox }, avatar && !imageError ? (React.createElement("img", { src: avatar, alt: "Avatar", className: styles.avatar, onError: () => setImageError(true) })) : (React.createElement("div", { className: `${styles.avatar} ${styles.avatarIcon} ${styles.flexBox}` },
40
+ React.createElement("div", { className: styles.flexBox }, avatar && !imageError ? (React.createElement("img", { "data-test-id": `${testId}-comment-avatar`, src: avatar, alt: "Avatar", className: styles.avatar, onError: () => setImageError(true) })) : (React.createElement("div", { "data-test-id": `${testId}-comment-avatar-placeholder`, className: `${styles.avatar} ${styles.avatarIcon} ${styles.flexBox}` },
41
41
  React.createElement(IconAccount, null)))),
42
- React.createElement("div", { className: styles.infoWrapper },
43
- React.createElement(Typography, { variant: "Body2-Medium", className: labelClasses }, (_b = (_a = comment === null || comment === void 0 ? void 0 : comment.authorUser) === null || _a === void 0 ? void 0 : _a.fullName) !== null && _b !== void 0 ? _b : ''),
44
- React.createElement(Typography, { variant: "Caption", className: styles.label, style: { color: '#8E8E93' } }, creationDate))),
42
+ React.createElement("div", { "data-test-id": `${testId}-comment-info-block`, className: styles.infoWrapper },
43
+ React.createElement(Typography, { testId: `${testId}-comment-author`, variant: "Body2-Medium", className: labelClasses }, (_b = (_a = comment === null || comment === void 0 ? void 0 : comment.authorUser) === null || _a === void 0 ? void 0 : _a.fullName) !== null && _b !== void 0 ? _b : ''),
44
+ React.createElement(Typography, { testId: `${testId}-comment-date`, variant: "Caption", className: styles.label, style: { color: '#8E8E93' } }, creationDate))),
45
45
  canEdit && (React.createElement("div", { className: styles.iconsWrapper },
46
- React.createElement(IconButton, { icon: isEditMode ? React.createElement(IconPencilCancel, { width: '14', height: '14' }) : React.createElement(IconPencil, { width: '14', height: '14' }), title: isEditMode ? lng === 'ru' ? 'Закрыть редактирование' : 'Close edit' : lng === 'ru' ? 'Редактировать' : 'Edit', onClick: handleEditClick, style: { width: '30px', height: '30px', padding: '5px' }, color: "var(--icons-grey)" }),
47
- React.createElement(IconButton, { icon: React.createElement(IconDelete, { width: '14', height: '14', strokeWidth: '0.5' }), title: lng === 'ru' ? 'Удалить' : 'Delete', onClick: handleDeleteClick, size: "sm", style: { width: '30px', height: '30px', padding: '5px' }, color: "var(--icons-grey)" })))),
48
- isEditMode ? (React.createElement(TextEditor, { defaultValue: (_c = comment === null || comment === void 0 ? void 0 : comment.text) !== null && _c !== void 0 ? _c : '', attachedFiles: comment.attachFiles, onSubmit: handleSubmit, onCancel: handleCancel, onDelete: onFileDelete, error: error, setError: setError, helperText: helperText, isEditMode: isEditMode, canAttachFiles: canAttachFiles, maxFileCount: maxFileCount, maxFileSize: maxFileSize, lng: lng })) : (React.createElement("div", { className: styles.commentWrapper },
49
- comment.attachFiles && ((_d = comment.attachFiles) === null || _d === void 0 ? void 0 : _d.length) > 0 && (React.createElement(AttachedFilesPreview, { files: comment.attachFiles, onDownload: onDownload, allowDelete: canDeleteFile, onDelete: onFileDelete, className: styles.attachedFilesContainer, maxFileCount: maxFileCount, lng: lng })),
50
- React.createElement("div", { id: `comment-${comment.id}`, className: inputClassess, dangerouslySetInnerHTML: { __html: comment.text || '' } }))),
51
- error && helperText && (React.createElement(Typography, { variant: "Caption", className: classNames(styles.helperText) }, helperText))));
46
+ React.createElement(IconButton, { icon: isEditMode ? React.createElement(IconPencilCancel, { width: '14', height: '14' }) : React.createElement(IconPencil, { width: '14', height: '14' }), title: isEditMode ? lng === 'ru' ? 'Закрыть редактирование' : 'Close edit' : lng === 'ru' ? 'Редактировать' : 'Edit', onClick: handleEditClick, style: { width: '30px', height: '30px', padding: '5px' }, color: "var(--icons-grey)", "data-test-id": `${testId}-comment-edit-button` }),
47
+ React.createElement(IconButton, { icon: React.createElement(IconDelete, { width: '14', height: '14', strokeWidth: '0.5' }), title: lng === 'ru' ? 'Удалить' : 'Delete', onClick: handleDeleteClick, size: "sm", style: { width: '30px', height: '30px', padding: '5px' }, color: "var(--icons-grey)", "data-test-id": `${testId}-comment-delete-button` })))),
48
+ isEditMode ? (React.createElement(TextEditor, { defaultValue: (_c = comment === null || comment === void 0 ? void 0 : comment.text) !== null && _c !== void 0 ? _c : '', attachedFiles: comment.attachFiles, onSubmit: handleSubmit, onCancel: handleCancel, onDelete: onFileDelete, error: error, setError: setError, helperText: helperText, isEditMode: isEditMode, canAttachFiles: canAttachFiles, maxFileCount: maxFileCount, maxFileSize: maxFileSize, lng: lng, testId: `${testId}-comment-editor` })) : (React.createElement("div", { className: styles.commentWrapper },
49
+ comment.attachFiles && ((_d = comment.attachFiles) === null || _d === void 0 ? void 0 : _d.length) > 0 && (React.createElement(AttachedFilesPreview, { files: comment.attachFiles, onDownload: onDownload, allowDelete: canDeleteFile, onDelete: onFileDelete, className: styles.attachedFilesContainer, maxFileCount: maxFileCount, lng: lng, testId: `${testId}-comment-attached` })),
50
+ React.createElement("div", { "data-test-id": `${testId}-comment-text`, id: `comment-${comment.id}`, className: inputClassess, dangerouslySetInnerHTML: { __html: comment.text || '' } }))),
51
+ error && helperText && (React.createElement(Typography, { variant: "Caption", className: classNames(styles.helperText), testId: `${testId}-comment-error` }, helperText))));
52
52
  };
@@ -4,6 +4,7 @@ import classNames from 'classnames';
4
4
  import { Typography } from '../Typography/Typography';
5
5
  import DatePicker from 'react-datepicker';
6
6
  import { IconCalendar } from '../../Icons/IconCalendar/IconCalendar';
7
+ // @ts-ignore
7
8
  import 'react-datepicker/dist/react-datepicker.css';
8
9
  import { registerLocale } from 'react-datepicker';
9
10
  import { ru } from 'date-fns/locale/ru';
@@ -13,7 +14,7 @@ import { ChevronLeft } from '../../Icons/ChevronLeft/ChevronLeft';
13
14
  import { Button } from '../Button/Button';
14
15
  registerLocale('ru', ru);
15
16
  registerLocale('en', enUS);
16
- const CustomInput = forwardRef(({ value = '', lng, onClick, onDateChange, onClose, className, disabled = false, readOnly = false, dateFormat = 'dd.MM.yyyy' }, ref) => {
17
+ const CustomInput = forwardRef(({ value = '', lng, onClick, onDateChange, onClose, className, disabled = false, readOnly = false, dateFormat = 'dd.MM.yyyy', testId = 'default' }, ref) => {
17
18
  const inputRef = useRef(null);
18
19
  const [selectedPart, setSelectedPart] = useState(null);
19
20
  const [tempInput, setTempInput] = useState('');
@@ -199,9 +200,9 @@ const CustomInput = forwardRef(({ value = '', lng, onClick, onDateChange, onClos
199
200
  useImperativeHandle(ref, () => ({
200
201
  removeSelection,
201
202
  }), [removeSelection]);
202
- return (React.createElement("input", { ref: inputRef, value: input || displayValue, onClick: handleClick, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, onChange: () => { }, readOnly: !value || readOnly, disabled: disabled, className: className }));
203
+ return (React.createElement("input", { ref: inputRef, name: 'date', value: input || displayValue, onClick: handleClick, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, onChange: () => { }, readOnly: !value || readOnly, disabled: disabled, className: className, "data-test-id": `${testId}-input` }));
203
204
  });
204
- export const DateInput = ({ id, label = 'Выберите дату', size = 'lg', value, style, className, disabled = false, readOnly = false, isLeftLabel = false, icon, error = false, helperText, onChange, onBlur, required = false, lng = 'ru', minDate = new Date('1975-12-31'), maxDate = new Date('2074-12-31'), inputClassName, calendarClassName, dateFormat = 'dd.MM.yyyy', }) => {
205
+ export const DateInput = ({ id, label = 'Выберите дату', size = 'lg', value, style, className, disabled = false, readOnly = false, isLeftLabel = false, icon, error = false, helperText, onChange, onBlur, required = false, lng = 'ru', minDate = new Date('1975-12-31'), maxDate = new Date('2074-12-31'), inputClassName, calendarClassName, dateFormat = 'dd.MM.yyyy', testId = 'dafault' }) => {
205
206
  const wrapperClassess = classNames(styles['wrapper--input'], className, {
206
207
  [styles['wrapper--left']]: isLeftLabel,
207
208
  [styles['wrapper--input-label']]: label && !isLeftLabel && !required,
@@ -306,52 +307,52 @@ export const DateInput = ({ id, label = 'Выберите дату', size = 'lg'
306
307
  });
307
308
  }
308
309
  }, [currentMonth]);
309
- return (React.createElement("div", { className: `${styles.monthPicker} ${styles.calendar}` },
310
+ return (React.createElement("div", { "data-test-id": `${testId}-monthpicker-popover`, className: `${styles.monthPicker} ${styles.calendar}` },
310
311
  React.createElement("div", { className: styles.monthPickerWrapper },
311
- React.createElement("div", { className: styles.monthContainer }, months.map((month, index) => {
312
+ React.createElement("div", { "data-test-id": `${testId}-months-list`, className: styles.monthContainer }, months.map((month, index) => {
312
313
  const monthClasses = itemClasses('month', months.indexOf(month) === currentMonth);
313
314
  return (React.createElement("div", { key: month, ref: getRef(monthRefs, index), className: monthClasses, onClick: () => {
314
315
  setCurrentMonth(months.indexOf(month));
315
- } }, month));
316
+ }, "data-test-id": `${testId}-month-${month}-cell` }, month));
316
317
  })),
317
318
  React.createElement("div", { className: styles.monthContainer }, years.map((year, index) => {
318
319
  const yearClasses = itemClasses('year', year === currentYear);
319
320
  return (React.createElement("div", { key: year, ref: getRef(yearRefs, index), className: yearClasses, onClick: () => {
320
321
  setCurrentYear(year);
321
- } }, year));
322
+ }, "data-test-id": `${testId}-year-${year}-cell` }, year));
322
323
  }))),
323
324
  React.createElement("div", { className: styles.buttonContainer },
324
325
  React.createElement(Button, { condition: "info", onClick: () => {
325
326
  setIsMonthPickerOpen(false);
326
- } }, lng === 'ru' ? "Отмена" : "Cancel"),
327
+ }, testId: `${testId}-monthpicker-cancel` }, lng === 'ru' ? "Отмена" : "Cancel"),
327
328
  React.createElement(Button, { onClick: () => {
328
329
  date.setMonth(currentMonth);
329
330
  date.setFullYear(currentYear);
330
331
  setIsMonthPickerOpen(false);
331
- } }, lng === 'ru' ? "Применить" : "Apply"))));
332
+ }, testId: `${testId}-monthpicker-apply` }, lng === 'ru' ? "Применить" : "Apply"))));
332
333
  };
333
334
  const getMonthPickerWithDate = (date) => {
334
335
  return () => React.createElement(MonthPicker, { date: date });
335
336
  };
336
337
  const renderCustomHeader = ({ date, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, }) => {
337
- return (React.createElement("div", { className: styles.calendarHeader },
338
- React.createElement("button", { type: "button", onClick: decreaseMonth, disabled: prevMonthButtonDisabled, className: styles.calendarNavButton },
338
+ return (React.createElement("div", { "data-test-id": `${testId}-calendar-header`, className: styles.calendarHeader },
339
+ React.createElement("button", { type: "button", onClick: decreaseMonth, disabled: prevMonthButtonDisabled, className: styles.calendarNavButton, "data-test-id": `${testId}-prev-month-button` },
339
340
  React.createElement(ChevronLeft, null)),
340
341
  React.createElement("div", { className: styles.monthDisplay, onClick: () => {
341
342
  setIsMonthPickerOpen(true);
342
- } },
343
+ }, "data-test-id": `${testId}-current-month-button` },
343
344
  months[date.getMonth()],
344
345
  ", ",
345
346
  date.getFullYear()),
346
- React.createElement("button", { type: "button", onClick: increaseMonth, disabled: nextMonthButtonDisabled, className: styles.calendarNavButton },
347
+ React.createElement("button", { type: "button", onClick: increaseMonth, disabled: nextMonthButtonDisabled, className: styles.calendarNavButton, "data-test-id": `${testId}-next-month-button` },
347
348
  React.createElement(ChevronRight, null))));
348
349
  };
349
350
  const renderDayContents = (day, date) => {
350
- return React.createElement("div", { className: styles.calendarDay }, day);
351
+ return React.createElement("div", { "data-test-id": `${testId}-day-${day}-cell`, className: styles.calendarDay }, day);
351
352
  };
352
- return (React.createElement("div", { className: wrapperClassess, style: style },
353
- label && (React.createElement(Typography, { variant: "Caption", className: labelClasses }, label)),
354
- React.createElement("div", { className: styles.icon, onClick: () => { var _a; return (_a = datePickerRef.current) === null || _a === void 0 ? void 0 : _a.setOpen(true); } }, icon || React.createElement(IconCalendar, null)),
353
+ return (React.createElement("div", { "data-test-id": `${testId}-dateInput-block`, className: wrapperClassess, style: style },
354
+ label && (React.createElement(Typography, { testId: `${testId}-dateInput`, variant: "Caption", className: labelClasses }, label)),
355
+ React.createElement("div", { "data-test-id": `${testId}-dateInput-icon-trigger`, className: styles.icon, onClick: () => { var _a; return (_a = datePickerRef.current) === null || _a === void 0 ? void 0 : _a.setOpen(true); } }, icon || React.createElement(IconCalendar, null)),
355
356
  React.createElement(DatePicker, Object.assign({ id: id, ref: datePickerRef, selected: selectedDate, onChange: handleDateChange, onBlur: onBlur, dateFormat: dateFormat, locale: lng === 'ru' ? 'ru' : 'en', readOnly: readOnly, disabled: disabled, showPopperArrow: false, calendarClassName: classNames(styles.calendar, calendarClassName), popperClassName: styles.calendarPopper, onCalendarClose: () => setIsMonthPickerOpen(false), minDate: minDate, maxDate: maxDate, inline: false, calendarStartDay: 1, formatWeekDay: (dayName) => {
356
357
  const dayIndex = ['понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота', 'воскресенье']
357
358
  .findIndex(day => day === dayName);
@@ -365,6 +366,6 @@ export const DateInput = ({ id, label = 'Выберите дату', size = 'lg'
365
366
  : {
366
367
  renderCustomHeader: renderCustomHeader,
367
368
  renderDayContents: renderDayContents,
368
- }), { customInput: React.createElement(CustomInput, { ref: inputRef, lng: lng, className: classNames(inputClassess, inputClassName), onDateChange: handleCustomInputChange, onClose: handleCloseDatePicker, disabled: disabled, readOnly: readOnly, dateFormat: dateFormat }) })),
369
- error && helperText && (React.createElement(Typography, { variant: "Caption", className: classNames(styles.helperText, styles[size]) }, helperText))));
369
+ }), { customInput: React.createElement(CustomInput, { ref: inputRef, lng: lng, className: classNames(inputClassess, inputClassName), onDateChange: handleCustomInputChange, onClose: handleCloseDatePicker, disabled: disabled, readOnly: readOnly, dateFormat: dateFormat, testId: `${testId}-dateInput` }) })),
370
+ error && helperText && (React.createElement(Typography, { variant: "Caption", className: classNames(styles.helperText, styles[size]), testId: `${testId}-dateInput-error` }, helperText))));
370
371
  };
@@ -4,14 +4,14 @@ import classNames from 'classnames';
4
4
  import { Spinner } from '../Spinner/Spinner';
5
5
  import { IconButton } from '../IconButton/IconButton';
6
6
  import { IconClose } from '../../Icons/IconClose/IconClose';
7
- export const Dialog = ({ open, onClose, maxWidth = 'md', children, style, className, overlay = true, fullWidth = false, isLoading = false }) => {
7
+ export const Dialog = ({ open, onClose, maxWidth = 'md', children, style, className, overlay = true, fullWidth = false, isLoading = false, testId = 'default' }) => {
8
8
  const isMaxWidthInPx = typeof maxWidth === 'string' && !isNaN(Number(maxWidth.replace('px', '')));
9
9
  return (React.createElement(React.Fragment, null,
10
10
  open && overlay && React.createElement("div", { className: styles.dialogOverlay }),
11
- React.createElement("dialog", { open: open, className: classNames(styles['dialog'], !isMaxWidthInPx && styles[`maxWidth--${maxWidth}`], isLoading && styles['dialogLoading'], className), style: Object.assign(Object.assign({}, style), { maxWidth: isMaxWidthInPx ? maxWidth : '', width: fullWidth ? '100%' : '' }) },
11
+ React.createElement("dialog", { open: open, className: classNames(styles['dialog'], !isMaxWidthInPx && styles[`maxWidth--${maxWidth}`], isLoading && styles['dialogLoading'], className), style: Object.assign(Object.assign({}, style), { maxWidth: isMaxWidthInPx ? maxWidth : '', width: fullWidth ? '100%' : '' }), "data-test-id": `${testId}-modal` },
12
12
  onClose && (React.createElement("div", { className: styles.closeButtonWrapper },
13
- React.createElement(IconButton, { onClick: onClose, icon: React.createElement(IconClose, null), color: "var(--icons-grey)", size: "lg" }))),
14
- isLoading && React.createElement("div", { className: styles['loader'] },
13
+ React.createElement(IconButton, { onClick: onClose, icon: React.createElement(IconClose, null), color: "var(--icons-grey)", size: "lg", "data-test-id": `${testId}-modal-close-button` }))),
14
+ isLoading && React.createElement("div", { className: styles['loader'], "data-test-id": `${testId}-modal-spinner` },
15
15
  React.createElement(Spinner, null)),
16
- React.createElement("div", { className: styles['content'] }, children))));
16
+ React.createElement("div", { className: styles['content'], "data-test-id": `${testId}-modal-content` }, children))));
17
17
  };
@@ -14,6 +14,7 @@ export interface DropdownListItemProps<T extends BaseOptions> {
14
14
  activeIndex?: number;
15
15
  index?: number;
16
16
  isChild?: boolean;
17
+ testId?: string;
17
18
  }
18
- export declare const DropdownListItem: <T extends BaseOptions>({ item, getOptionLabel, size, selectedItem, variant, onChange, isActive, activeIndex, index, isChild, }: DropdownListItemProps<T>) => React.JSX.Element;
19
- export declare const Dropdown: <T extends BaseOptions>({ options, id, label, placeholder, required, value, defaultValue, onChange, showLoadMore, loadMore, getOptionLabel, variant, size, style, className, isLeftLabel, isDivider, disabled, readOnly, isOpened, error, helperText, onOpen, onClick, onBlur, onFocus, onClose, clearable, enableAutocomplete, onSearch, isLoadMoreLoading, isSearchLoading, noOptionsText, lng, multiple, limitTags, }: DropdownProps<T>) => React.JSX.Element;
19
+ export declare const DropdownListItem: <T extends BaseOptions>({ item, getOptionLabel, size, selectedItem, variant, onChange, isActive, activeIndex, index, isChild, testId }: DropdownListItemProps<T>) => React.JSX.Element;
20
+ export declare const Dropdown: <T extends BaseOptions>({ options, id, label, placeholder, required, value, defaultValue, onChange, showLoadMore, loadMore, getOptionLabel, variant, size, style, className, isLeftLabel, isDivider, disabled, readOnly, isOpened, error, helperText, onOpen, onClick, onBlur, onFocus, onClose, clearable, enableAutocomplete, onSearch, isOptionsLoading, isSearchLoading, noOptionsText, lng, multiple, limitTags, testId }: DropdownProps<T>) => React.JSX.Element;