kamotive_ui 1.2.12 → 1.2.13
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/Dialog/Dialog.d.ts +3 -0
- package/dist/components/Dialog/Dialog.js +10 -0
- package/dist/components/Dialog/Dialog.module.css +47 -0
- package/dist/components/IconButton/IconButton.d.ts +3 -0
- package/dist/components/IconButton/IconButton.js +10 -0
- package/dist/components/IconButton/IconButton.module.css +26 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/types/index.d.ts +33 -1
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from './Dialog.module.css';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
export const Dialog = ({ open, maxWidth = 'md', children, style, className, overlay = true, fullWidth = false }) => {
|
|
5
|
+
const isMaxWidthInPx = typeof maxWidth === 'string' && !isNaN(Number(maxWidth.replace('px', '')));
|
|
6
|
+
return (React.createElement(React.Fragment, null,
|
|
7
|
+
open && overlay && React.createElement("div", { className: styles.dialogOverlay }),
|
|
8
|
+
React.createElement("dialog", { open: open, className: classNames(styles['dialog'], !isMaxWidthInPx && styles[`maxWidth--${maxWidth}`], className), style: Object.assign(Object.assign({}, style), { maxWidth: isMaxWidthInPx ? maxWidth : '', width: fullWidth ? '100%' : '' }) },
|
|
9
|
+
React.createElement("div", { className: styles['content'] }, children))));
|
|
10
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.dialogOverlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
background-color: var(--dialog-overlay);
|
|
8
|
+
z-index: 999;
|
|
9
|
+
}
|
|
10
|
+
.dialog {
|
|
11
|
+
border: none;
|
|
12
|
+
border-radius: 15px;
|
|
13
|
+
box-shadow: 0px 4px 16px var(--dialog-overlay);
|
|
14
|
+
padding: 30px;
|
|
15
|
+
background-color: var(--white);
|
|
16
|
+
z-index: 1000;
|
|
17
|
+
position: fixed;
|
|
18
|
+
top: 50%;
|
|
19
|
+
left: 50%;
|
|
20
|
+
transform: translate(-50%, -50%);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.content {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: 1rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.maxWidth--xs {
|
|
30
|
+
max-width: 300px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.maxWidth--sm {
|
|
34
|
+
max-width: 400px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.maxWidth--md {
|
|
38
|
+
max-width: 500px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.maxWidth--lg {
|
|
42
|
+
max-width: 600px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.maxWidth--xl {
|
|
46
|
+
max-width: 800px;
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import styles from './IconButton.module.css';
|
|
4
|
+
export const IconButton = ({ icon, size = 'md', color, style, disabled = false, onClick, children, }) => {
|
|
5
|
+
return (React.createElement("button", { className: classNames(styles['iconButton'], styles[`iconButton--${size}`]), disabled: disabled, "aria-disabled": disabled, type: "button", onClick: onClick, style: style }, (icon || (typeof children === 'object' && children)) &&
|
|
6
|
+
React.cloneElement(icon, {
|
|
7
|
+
htmlColor: color,
|
|
8
|
+
strokeWidth: size === 'lg' ? '0.5' : size === 'md' ? '0.3' : '0.0',
|
|
9
|
+
})));
|
|
10
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.iconButton {
|
|
2
|
+
cursor: pointer;
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
background-color: var(--white);
|
|
5
|
+
border: none;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.iconButton--sm svg{
|
|
9
|
+
width: 14px;
|
|
10
|
+
height: 14px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.iconButton--md svg{
|
|
14
|
+
width: 16px;
|
|
15
|
+
height: 16px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.iconButton--lg svg{
|
|
19
|
+
width: 18px;
|
|
20
|
+
height: 18px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.iconButton:disabled {
|
|
24
|
+
cursor: not-allowed;
|
|
25
|
+
box-shadow: none;
|
|
26
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,5 +17,7 @@ export { Typography as Typography } from './components/Typography/Typography';
|
|
|
17
17
|
export { Loader as Loader } from './components/Loader/Loader';
|
|
18
18
|
export { FileAttach as FileAttach } from './components/FileAttach/FileAttach';
|
|
19
19
|
export { Spinner as Spinner } from './components/Spinner/Spinner';
|
|
20
|
-
export
|
|
20
|
+
export { Dialog as Dialog } from './components/Dialog/Dialog';
|
|
21
|
+
export { IconButton as IconButton } from './components/IconButton/IconButton';
|
|
22
|
+
export type { ButtonProps, InputProps, DateInputProps, TagProps, SettingTagProps, ToggleButtonProps, BaseOptions, TOptions, DropdownProps, TypographyProps, ProgressBarProps, ProgressLoaderProps, RadioProps, TabsProps, ColorPickerProps, SnackbarProps, LoaderProps, FileAttachProps, SpinnerProps, DialogProps, IconButtonProps, } from './types';
|
|
21
23
|
import './fonts.css';
|
package/dist/index.js
CHANGED
|
@@ -17,4 +17,6 @@ export { Typography as Typography } from './components/Typography/Typography';
|
|
|
17
17
|
export { Loader as Loader } from './components/Loader/Loader';
|
|
18
18
|
export { FileAttach as FileAttach } from './components/FileAttach/FileAttach';
|
|
19
19
|
export { Spinner as Spinner } from './components/Spinner/Spinner';
|
|
20
|
+
export { Dialog as Dialog } from './components/Dialog/Dialog';
|
|
21
|
+
export { IconButton as IconButton } from './components/IconButton/IconButton';
|
|
20
22
|
import './fonts.css';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -369,7 +369,7 @@ export interface FileAttachProps {
|
|
|
369
369
|
acceptedFormats?: Accept;
|
|
370
370
|
/**Добавленные файлы */
|
|
371
371
|
addedFiles: File[];
|
|
372
|
-
|
|
372
|
+
/**Состояние для добавления файлов */
|
|
373
373
|
setAddedFiles: (addedFiles: File[]) => void;
|
|
374
374
|
/**Заблокировано добавление файлов*/
|
|
375
375
|
disabled?: boolean;
|
|
@@ -378,3 +378,35 @@ export interface FileAttachProps {
|
|
|
378
378
|
/** Стили передаваемые напрямую */
|
|
379
379
|
style?: CSSProperties;
|
|
380
380
|
}
|
|
381
|
+
export interface DialogProps {
|
|
382
|
+
/** Флаг открытия окна */
|
|
383
|
+
open: boolean;
|
|
384
|
+
/** Максимальная ширина окна */
|
|
385
|
+
maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | string;
|
|
386
|
+
/** Содержимое окна */
|
|
387
|
+
children?: React.ReactNode;
|
|
388
|
+
/** Стили передаваемые напрямую */
|
|
389
|
+
style?: CSSProperties;
|
|
390
|
+
/** Дополнительный класс */
|
|
391
|
+
className?: string;
|
|
392
|
+
/**Задний фон окна */
|
|
393
|
+
overlay?: boolean;
|
|
394
|
+
/**Окно растягивается до максимальной ширины*/
|
|
395
|
+
fullWidth?: boolean;
|
|
396
|
+
}
|
|
397
|
+
export interface IconButtonProps {
|
|
398
|
+
/** Иконка кнопки */
|
|
399
|
+
icon?: React.ReactNode;
|
|
400
|
+
/** Размер кнопки */
|
|
401
|
+
size?: 'sm' | 'md' | 'lg';
|
|
402
|
+
/**Цвет кнопки */
|
|
403
|
+
color?: string;
|
|
404
|
+
/** Стиль кнопки иконки*/
|
|
405
|
+
style?: CSSProperties;
|
|
406
|
+
/** Заблокированная кнопка */
|
|
407
|
+
disabled?: boolean;
|
|
408
|
+
/** Callback, который будет вызван при клике по кнопке */
|
|
409
|
+
onClick: () => void;
|
|
410
|
+
/** Дочерние элементы */
|
|
411
|
+
children?: ReactNode;
|
|
412
|
+
}
|