kamotive_ui 1.2.27 → 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.
- package/dist/components/Comment/Comment.js +4 -2
- package/dist/components/Comment/Comment.module.css +12 -0
- package/dist/components/Dropdown/Dropdown.js +4 -2
- package/dist/components/Link/Link.js +2 -2
- package/dist/components/List/List.js +12 -16
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -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:
|
|
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;
|
|
@@ -367,7 +367,7 @@ export const Dropdown = ({ options, id, label, placeholder, required = false, va
|
|
|
367
367
|
}, onBlur: (e) => {
|
|
368
368
|
e.stopPropagation();
|
|
369
369
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
370
|
-
}, onKeyDown: handleKeyDown, autoFocus: true })) : selectedItem ? (getComparisonValue(selectedItem, getOptionLabel)) : (searchValue || ((
|
|
370
|
+
}, onKeyDown: handleKeyDown, autoFocus: true })) : selectedItem ? (getComparisonValue(selectedItem, getOptionLabel)) : (searchValue || ((_a = placeholder !== null && placeholder !== void 0 ? placeholder : label) !== null && _a !== void 0 ? _a : (lng === 'ru' ? 'Выберите значение' : 'Select value')))));
|
|
371
371
|
return showSelectedTooltip ? (React.createElement("div", { className: styles.textField },
|
|
372
372
|
React.createElement(Tooltip, { label: ((_b = getComparisonValue(selectedItem, getOptionLabel)) === null || _b === void 0 ? void 0 : _b.toString()) || '', position: "bottom-left", style: { width: '100% !important' } }, textFieldContent))) : (textFieldContent);
|
|
373
373
|
};
|
|
@@ -376,7 +376,9 @@ export const Dropdown = ({ options, id, label, placeholder, required = false, va
|
|
|
376
376
|
const menu = isOpen && (React.createElement("div", { className: dropdownClassess }, optionsToRender && optionsToRender.length > 0 ? (optionsToRender.map((optionsToRender, index) => {
|
|
377
377
|
var _a;
|
|
378
378
|
return (React.createElement(DropdownListItem, { key: (_a = optionsToRender === null || optionsToRender === void 0 ? void 0 : optionsToRender.key) !== null && _a !== void 0 ? _a : index, item: optionsToRender, getOptionLabel: getOptionLabel, size: size, selectedItem: selectedItem, variant: variant, onChange: onChangeHandler, isActive: activeIndex === index, activeIndex: activeIndex, index: index }));
|
|
379
|
-
})) : (React.createElement("div", { className: `${styles['item-container']} ${styles['item-block']}`, style: { paddingLeft: '15px' } }, lng === 'ru' || lng.includes('ru')
|
|
379
|
+
})) : (React.createElement("div", { className: `${styles['item-container']} ${styles['item-block']}`, style: { paddingLeft: '15px' } }, lng === 'ru' || lng.includes('ru')
|
|
380
|
+
? noOptionsText || 'Нет вариантов для выбора'
|
|
381
|
+
: noOptionsText || 'No options to select'))));
|
|
380
382
|
return isOpen ? menu : null;
|
|
381
383
|
};
|
|
382
384
|
useEffect(() => {
|
|
@@ -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 ||
|
|
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
|
-
|
|
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
|
}))));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
/** Вариант шрифта */
|