kamotive_ui 1.2.28 → 1.2.29

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.
@@ -4,12 +4,13 @@ import classNames from 'classnames';
4
4
  import { Typography } from '../Typography/Typography';
5
5
  import { TextEditor } from '../TextEditor/TextEditor';
6
6
  import { AttachedFilesPreview } from '../AttachedFilesPreview/AttachedFilesPreview';
7
- import { IconDeleteFilled, IconPencilFilled } from '../../Icons';
7
+ import { IconAccount, IconDeleteFilled, IconPencilFilled } from '../../Icons';
8
8
  import { IconButton } from '../IconButton/IconButton';
9
9
  export const Comment = ({ id, value, style, className, username, avatar, creationDate, canAttachFiles = false, files = [], canEdit = false, isEdit = false, label, error = false, helperText, onChange, onSubmit, onDelete, }) => {
10
10
  const [commentText, setCommentText] = useState(value || '');
11
11
  const [isEditMode, setIsEditMode] = useState(isEdit);
12
12
  const [attachedFiles, setAttachedFiles] = useState(files);
13
+ const [imageError, setImageError] = useState(false);
13
14
  const wrapperClassess = classNames(styles['wrapper--input'], className, {
14
15
  [styles['wrapper--input-label']]: label,
15
16
  [styles['wrapper--input-helperText']]: error,
@@ -38,7 +39,8 @@ export const Comment = ({ id, value, style, className, username, avatar, creatio
38
39
  return (React.createElement("div", { className: wrapperClassess, style: style },
39
40
  React.createElement("div", { style: { display: 'flex', justifyContent: 'space-between' } },
40
41
  React.createElement("div", { className: styles.labelWrapper },
41
- React.createElement("div", { className: "profile" }, avatar ? (React.createElement("img", { src: avatar, alt: "Avatar", className: styles.avatar })) : (React.createElement("div", { className: styles.avatar }, "\uD83D\uDC64"))),
42
+ 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}` },
43
+ React.createElement(IconAccount, null)))),
42
44
  React.createElement("div", { className: styles.infoWrapper },
43
45
  React.createElement(Typography, { variant: "Body2-Medium", className: labelClasses }, username),
44
46
  React.createElement(Typography, { variant: "Caption", className: styles.label, style: { color: '#8E8E93' } }, creationDate))),
@@ -39,6 +39,18 @@
39
39
  object-fit: cover;
40
40
  }
41
41
 
42
+ .avatarIcon {
43
+ background-color: var(--grey-extraLight);
44
+ border-radius: 25px;
45
+ border: none;
46
+ }
47
+
48
+ .flexBox {
49
+ align-items: center;
50
+ display: flex;
51
+ justify-content: center;
52
+ }
53
+
42
54
  .input {
43
55
  font-family: var(--font-family-content);
44
56
  font-style: normal;
@@ -4,7 +4,7 @@ import styles from './Link.module.css';
4
4
  import { Typography } from '../Typography/Typography';
5
5
  import { ETypographyVariants } from '../Typography/enums';
6
6
  import { Tooltip } from '../Tooltip/Tooltip';
7
- export const Link = ({ href, onClick, children, title, className, style, underline = 'hover', variant = ETypographyVariants.Body1, color = 'var(--text-dark)', maxWidth, size, widthInPixels, }) => {
7
+ export const Link = ({ href, onClick, children, title, className, style, contentStyle, underline = 'hover', variant = ETypographyVariants.Body1, color = 'var(--text-dark)', maxWidth, size, widthInPixels, }) => {
8
8
  const stylesUnderline = underline === 'hover' ? styles.linkHover : underline === 'none' ? styles.linkNone : '';
9
9
  const stylesTooltipWidth = maxWidth ? { maxWidth: maxWidth } : {};
10
10
  const textRef = useRef(null);
@@ -24,7 +24,7 @@ export const Link = ({ href, onClick, children, title, className, style, underli
24
24
  const shouldShow = actualSize > widthInPixels;
25
25
  return shouldShow;
26
26
  }, [actualSize, widthInPixels, size]);
27
- const linkContent = (React.createElement(Typography, { variant: variant, color: color }, children));
27
+ const linkContent = (React.createElement(Typography, { variant: variant, color: color, style: contentStyle }, children));
28
28
  const link = onClick ? (React.createElement("div", { onClick: onClick, className: classNames(styles.link, stylesUnderline, isTooltipVisible && styles.tooltipStyle, className), style: Object.assign(Object.assign({}, linkStyle), stylesTooltipWidth) },
29
29
  !size && (React.createElement("div", { ref: textRef, style: {
30
30
  position: 'absolute',
@@ -5,6 +5,7 @@ import { Typography } from '../Typography/Typography';
5
5
  import { Checkbox } from '../Checkbox/Checkbox';
6
6
  import { RadioButton } from '../RadioButton/RadioButton';
7
7
  import { ChevronDown } from '../../Icons';
8
+ import { ListItem } from '../ListItem/ListItem';
8
9
  export const List = ({ onClick, onCheck, onRadioSelect, checked = false, selected = false, disabled = false, label, id, style, className, collapsible = false, open = false, withCheckbox = false, checkboxColor, checkboxFilled, withRadioButton = false, customBullet, customItemBullet, bulletClassName, titleContent, children, isHeader = false, parentChecked = false, }) => {
9
10
  const [isOpen, setIsOpen] = useState(open);
10
11
  const [isChecked, setIsChecked] = useState(checked || parentChecked);
@@ -37,7 +38,7 @@ export const List = ({ onClick, onCheck, onRadioSelect, checked = false, selecte
37
38
  const newCheckedState = !isChecked;
38
39
  setIsChecked(newCheckedState);
39
40
  if (onCheck) {
40
- onCheck(id || "", newCheckedState);
41
+ onCheck(id || '', newCheckedState);
41
42
  }
42
43
  if (childIds.length > 0 && onCheck) {
43
44
  childIds.forEach((childId) => {
@@ -69,23 +70,18 @@ export const List = ({ onClick, onCheck, onRadioSelect, checked = false, selecte
69
70
  collapsible && (React.createElement("span", { className: styles.indicator }, isOpen ? React.createElement(ChevronDown, null) : React.createElement(ChevronDown, { rotation: 270 }))))),
70
71
  React.createElement("div", { className: collapsible ? contentClassNames : styles.content, style: { paddingLeft: !label ? 0 : '16px' } }, React.Children.map(children, (child) => {
71
72
  if (React.isValidElement(child)) {
72
- return React.cloneElement(child, {
73
- bulletClassName: classNames(styles.bullet, child.props.bulletClassName || bulletClassName),
74
- customBullet: child.props.customBullet !== undefined
75
- ? child.props.customBullet
76
- : customItemBullet !== undefined
77
- ? customItemBullet
78
- : customBullet,
79
- withCheckbox: child.props.withCheckbox !== undefined ? child.props.withCheckbox : withCheckbox,
80
- checkboxFilled: child.props.checkboxFilled !== undefined ? child.props.checkboxFilled : checkboxFilled,
81
- withRadioButton: child.props.withRadioButton !== undefined ? child.props.withRadioButton : withRadioButton,
82
- onCheck: handleChildCheck,
83
- onRadioSelect: handleChildRadioSelect,
84
- parentChecked: isChecked,
85
- selected: child.props.selected,
73
+ const commonProps = {
86
74
  style: child.props.style || style,
87
75
  className: child.props.className,
88
- });
76
+ };
77
+ if (child.type === ListItem || child.type === List) {
78
+ return React.cloneElement(child, Object.assign(Object.assign({}, commonProps), { bulletClassName: classNames(styles.bullet, child.props.bulletClassName || bulletClassName), customBullet: child.props.customBullet !== undefined
79
+ ? child.props.customBullet
80
+ : customItemBullet !== undefined
81
+ ? customItemBullet
82
+ : customBullet, withCheckbox: child.props.withCheckbox !== undefined ? child.props.withCheckbox : withCheckbox, checkboxFilled: child.props.checkboxFilled !== undefined ? child.props.checkboxFilled : checkboxFilled, withRadioButton: child.props.withRadioButton !== undefined ? child.props.withRadioButton : withRadioButton, onCheck: handleChildCheck, onRadioSelect: handleChildRadioSelect, parentChecked: isChecked, selected: child.props.selected }));
83
+ }
84
+ return React.cloneElement(child, commonProps);
89
85
  }
90
86
  return child;
91
87
  }))));
@@ -649,6 +649,8 @@ export interface LinkProps {
649
649
  className?: string;
650
650
  /** Стили передаваемые напрямую */
651
651
  style?: CSSProperties;
652
+ /** Стили текста */
653
+ contentStyle?: CSSProperties;
652
654
  /**Подчеркивание */
653
655
  underline?: 'hover' | 'underline' | 'none';
654
656
  /** Вариант шрифта */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kamotive_ui",
3
- "version": "1.2.28",
3
+ "version": "1.2.29",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [