kamotive_ui 14.1.26 → 14.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.
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +20 -44
- package/dist/components/Button/Button.module.css +2 -1
- package/dist/components/Dialog/Dialog.module.css +1 -0
- package/dist/components/Dropdown/Dropdown.d.ts +10 -10
- package/dist/components/Dropdown/Dropdown.js +382 -154
- package/dist/components/Dropdown/Dropdown.module.css +196 -42
- package/dist/components/FileLoader/FileLoader.js +105 -106
- package/dist/components/Input/Input.module.css +3 -1
- package/dist/components/TableFilterSidebar/TableFilterSidebar.d.ts +3 -0
- package/dist/components/TableFilterSidebar/TableFilterSidebar.js +39 -0
- package/dist/components/TableFilterSidebar/TableFilterSidebar.module.css +52 -0
- package/dist/components/TextEditor/TextEditor.js +172 -574
- package/dist/components/TextEditor/TextEditor.module.css +8 -7
- package/dist/components/Tooltip/Tooltip.module.css +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/types/index.d.ts +75 -18
- package/package.json +5 -1
|
@@ -3,4 +3,4 @@ import { ButtonProps } from '../../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Компонент Button представляет собой кнопку, которую можно настроить с помощью различных параметров (размер, иконки, стили, состояние).
|
|
5
5
|
*/
|
|
6
|
-
export declare const Button: React.
|
|
6
|
+
export declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import styles from './Button.module.css';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { Typography } from '../Typography/Typography';
|
|
5
5
|
/**
|
|
6
6
|
* Компонент Button представляет собой кнопку, которую можно настроить с помощью различных параметров (размер, иконки, стили, состояние).
|
|
7
7
|
*/
|
|
8
|
-
export const Button = ({ label, variant = 'fill', size = 'md', style, condition, icon, disabled = false, onClick, children, error, color, name, type = 'button', form }) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
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, }, ref) => {
|
|
9
|
+
const btnIcon = icon || typeof children === 'object' && children;
|
|
10
|
+
let modeStyle = 'text';
|
|
11
|
+
if (mode) {
|
|
12
|
+
modeStyle = mode;
|
|
13
|
+
}
|
|
14
|
+
else if (btnIcon && variant !== 'link') {
|
|
15
|
+
modeStyle = (!label && !children) ? 'icon' : 'default';
|
|
16
|
+
}
|
|
17
|
+
const buttonCondition = error ? 'error' : (condition || 'default');
|
|
18
|
+
const buttonClasses = classNames(styles['button'], styles[`button--${size}`], styles[`button--${modeStyle}`], className, {
|
|
12
19
|
[styles[`button--${variant}-${buttonCondition}`]]: buttonCondition && !color,
|
|
13
|
-
[styles[`button--${variant}-custom`]]: color && !error
|
|
20
|
+
[styles[`button--${variant}-custom`]]: color && !error,
|
|
21
|
+
[styles[`button--${variant}-${buttonCondition}--active`]]: active && buttonCondition && !color,
|
|
14
22
|
});
|
|
15
23
|
const iconColorFn = () => {
|
|
16
24
|
if (buttonCondition && !color) {
|
|
@@ -48,51 +56,19 @@ export const Button = ({ label, variant = 'fill', size = 'md', style, condition,
|
|
|
48
56
|
return '#FFFFFF';
|
|
49
57
|
}
|
|
50
58
|
};
|
|
51
|
-
const btnIcon = icon || typeof children === 'object' && children;
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (!buttonStyle && style) {
|
|
54
|
-
setButtonStyle(style);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
if (btnIcon && variant !== 'link') {
|
|
58
|
-
if (!label && !(typeof children === 'string' && children)) {
|
|
59
|
-
setButtonStyle('icon');
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
setButtonStyle('default');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
setButtonStyle('text');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, [style, btnIcon, label, children]);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if (!condition) {
|
|
72
|
-
if (error) {
|
|
73
|
-
setButtonCondition('error');
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
setButtonCondition('default');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
error ? setButtonCondition('error') : setButtonCondition(condition);
|
|
81
|
-
}
|
|
82
|
-
}, [condition, error]);
|
|
83
59
|
const iconColorStyle = iconColorFn();
|
|
84
|
-
if (!
|
|
60
|
+
if (!modeStyle) {
|
|
85
61
|
return (React.createElement("button", { className: buttonClasses },
|
|
86
62
|
React.createElement(Typography, { variant: "Body1" }, "\u041A\u043D\u043E\u043F\u043A\u0430")));
|
|
87
63
|
}
|
|
88
|
-
return (React.createElement("button", { className: buttonClasses, style: color && !error ? {
|
|
64
|
+
return (React.createElement("button", { className: buttonClasses, ref: ref, style: Object.assign(Object.assign({}, style), (color && !error ? {
|
|
89
65
|
'--button-color': color,
|
|
90
66
|
'--button-hover-color': variant === 'fill' || variant === 'link' ? `color-mix(in srgb, ${color} 90%, black)` : `color-mix(in srgb, ${color} 10%, transparent)`,
|
|
91
67
|
'--button-active-color': variant === 'fill' || variant === 'link' ? `color-mix(in srgb, ${color} 80%, black)` : `color-mix(in srgb, ${color} 20%, transparent)`,
|
|
92
68
|
'--button-disabled-color': variant === 'fill' || variant === 'link' ? `color-mix(in srgb, ${color} 80%, white)` : `color-mix(in srgb, ${color} 10%, transparent)`,
|
|
93
69
|
'--button-disabled-textColor': variant === 'fill' ? `color-mix(in srgb, ${color} 80%, white)` : `color-mix(in srgb, ${color} 50%, transparent)`,
|
|
94
|
-
} : {}, onClick: onClick, disabled: disabled, "aria-disabled": disabled, type: type, name: name ? name : label ? `button-${label}` : 'button', form: form },
|
|
95
|
-
btnIcon && (
|
|
70
|
+
} : {})), onClick: (e) => onClick === null || onClick === void 0 ? void 0 : onClick(e), disabled: disabled, "aria-disabled": disabled, type: type, name: name ? name : label ? `button-${label}` : 'button', form: form },
|
|
71
|
+
btnIcon && (modeStyle === 'icon' || modeStyle === 'default') && (() => {
|
|
96
72
|
var _a;
|
|
97
73
|
const iconElement = btnIcon;
|
|
98
74
|
const defaultStrokeWidth = size === 'lg' ? '0.5' : size === 'md' ? '0.3' : '0.0';
|
|
@@ -101,5 +77,5 @@ export const Button = ({ label, variant = 'fill', size = 'md', style, condition,
|
|
|
101
77
|
strokeWidth: (_a = iconElement.props.strokeWidth) !== null && _a !== void 0 ? _a : defaultStrokeWidth,
|
|
102
78
|
});
|
|
103
79
|
})(),
|
|
104
|
-
(
|
|
105
|
-
};
|
|
80
|
+
(modeStyle === 'text' || modeStyle === 'default') && (React.createElement(Typography, { 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);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { DropdownProps,
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DropdownProps, BaseOptions } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Компонент Dropdown позволяет пользователям выбирать однин вариант из выпадающего меню
|
|
5
5
|
*/
|
|
6
|
-
export interface DropdownListItemProps {
|
|
7
|
-
item:
|
|
8
|
-
getOptionLabel?: (option:
|
|
6
|
+
export interface DropdownListItemProps<T extends BaseOptions> {
|
|
7
|
+
item: T | null;
|
|
8
|
+
getOptionLabel?: (option: T) => string;
|
|
9
9
|
size: 'md' | 'lg';
|
|
10
|
-
selectedItem:
|
|
11
|
-
variant?: 'icons' | 'text';
|
|
12
|
-
onChange: (event: React.MouseEvent<HTMLElement>, item:
|
|
10
|
+
selectedItem: T | null | T[];
|
|
11
|
+
variant?: 'icons' | 'text' | 'filter';
|
|
12
|
+
onChange: (event: React.MouseEvent<HTMLElement>, item: T | null) => void;
|
|
13
13
|
isActive?: boolean;
|
|
14
14
|
activeIndex?: number;
|
|
15
15
|
index?: number;
|
|
16
16
|
isChild?: boolean;
|
|
17
17
|
}
|
|
18
|
-
export declare const DropdownListItem:
|
|
19
|
-
export declare const Dropdown:
|
|
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, isOptionsLoading, isSearchLoading, noOptionsText, lng, multiple, limitTags, }: DropdownProps<T>) => React.JSX.Element;
|