armtek-uikit-react 1.0.52 → 1.0.54
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/package.json +1 -1
- package/ui/BackDrop/BackDrop.js +2 -2
- package/ui/BackDrop/BackDropBase.d.ts +2 -1
- package/ui/BackDrop/BackDropBase.js +10 -1
- package/ui/Form/FormControls/FormControls.d.ts +2 -2
- package/ui/Modal/BaseModal.d.ts +2 -1
- package/ui/Modal/BaseModal.js +7 -6
- package/ui/Modal/Modal.js +2 -0
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
1
|
+
{"name":"armtek-uikit-react","version":"1.0.54","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"build":"^0.1.4","clsx":"^2.0.0","rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
|
package/ui/BackDrop/BackDrop.js
CHANGED
|
@@ -6,14 +6,14 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
6
6
|
const BackDrop = props => {
|
|
7
7
|
const {
|
|
8
8
|
children,
|
|
9
|
-
|
|
9
|
+
...backDropProps
|
|
10
10
|
} = props;
|
|
11
11
|
const childrenProp = /*#__PURE__*/isValidElement(children) ? children : /*#__PURE__*/_jsx("span", {
|
|
12
12
|
children: children
|
|
13
13
|
});
|
|
14
14
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
15
15
|
children: /*#__PURE__*/createPortal( /*#__PURE__*/_jsx(BackDropBase, {
|
|
16
|
-
|
|
16
|
+
...backDropProps,
|
|
17
17
|
children: childrenProp
|
|
18
18
|
}), document.body)
|
|
19
19
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, MouseEvent } from 'react';
|
|
2
2
|
export type BackDropProps = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
width: number;
|
|
5
|
+
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
5
6
|
};
|
|
6
7
|
export declare const BackDropBase: (props: BackDropProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,11 +5,20 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
5
5
|
export const BackDropBase = props => {
|
|
6
6
|
const {
|
|
7
7
|
children,
|
|
8
|
-
width
|
|
8
|
+
width,
|
|
9
|
+
onClick
|
|
9
10
|
} = props;
|
|
11
|
+
const handleClick = e => {
|
|
12
|
+
if (e.target instanceof Element) {
|
|
13
|
+
if (e.target.classList.contains('Arm-BackDropBase')) {
|
|
14
|
+
if (onClick) onClick(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
10
18
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
11
19
|
children: /*#__PURE__*/_jsx("div", {
|
|
12
20
|
className: clsx('Arm-BackDropBase', css.BackDropBase),
|
|
21
|
+
onClick: handleClick,
|
|
13
22
|
children: /*#__PURE__*/_jsx("div", {
|
|
14
23
|
className: css.BackDropBase__inner,
|
|
15
24
|
style: {
|
|
@@ -3,10 +3,10 @@ import { ComponentPropsWithoutRef, MouseEvent } from 'react';
|
|
|
3
3
|
export type FormControlsProps = {
|
|
4
4
|
onSubmit: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
5
5
|
onCancel?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
6
|
-
submitProps?: Omit<ButtonProps
|
|
6
|
+
submitProps?: Omit<ButtonProps<'button'>, 'children'> & {
|
|
7
7
|
text: string;
|
|
8
8
|
};
|
|
9
|
-
cancelProps?: Omit<ButtonProps
|
|
9
|
+
cancelProps?: Omit<ButtonProps<'button'>, 'children'> & {
|
|
10
10
|
text: string;
|
|
11
11
|
};
|
|
12
12
|
} & ComponentPropsWithoutRef<'div'>;
|
package/ui/Modal/BaseModal.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, MouseEvent } from 'react';
|
|
2
2
|
import { FormControlsProps } from '../../ui/Form/FormControls';
|
|
3
3
|
export type BaseModalProps = ComponentPropsWithoutRef<'div'> & FormControlsProps & {
|
|
4
|
-
onClose: (e: MouseEvent
|
|
4
|
+
onClose: (e: MouseEvent) => void;
|
|
5
|
+
classes: Record<string, string>;
|
|
5
6
|
};
|
|
6
7
|
export declare const BaseModal: (props: BaseModalProps) => import("react/jsx-runtime").JSX.Element;
|
package/ui/Modal/BaseModal.js
CHANGED
|
@@ -15,21 +15,22 @@ export const BaseModal = props => {
|
|
|
15
15
|
onCancel,
|
|
16
16
|
submitProps,
|
|
17
17
|
cancelProps,
|
|
18
|
+
classes,
|
|
18
19
|
...divProps
|
|
19
20
|
} = props;
|
|
20
21
|
const showControls = !!onSubmit || !!onCancel;
|
|
21
22
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
22
23
|
children: /*#__PURE__*/_jsxs("div", {
|
|
23
24
|
...divProps,
|
|
24
|
-
className: clsx(className, 'Arm-Modal', css.Modal),
|
|
25
|
+
className: clsx(className, 'Arm-Modal', classes['Arm-Modal'], css.Modal),
|
|
25
26
|
children: [title && /*#__PURE__*/_jsx("div", {
|
|
26
|
-
className: clsx('Arm-Modal__header', css.Modal__header),
|
|
27
|
+
className: clsx('Arm-Modal__header', classes['Arm-Modal__header'], css.Modal__header),
|
|
27
28
|
children: /*#__PURE__*/_jsxs("div", {
|
|
28
|
-
className: clsx('Arm-Modal__title', css.Modal__title),
|
|
29
|
+
className: clsx('Arm-Modal__title', classes['Arm-Modal__title'], css.Modal__title),
|
|
29
30
|
children: [title, onClose && /*#__PURE__*/_jsx(ButtonIcon, {
|
|
30
31
|
variant: 'transparent',
|
|
31
32
|
onClick: onClose,
|
|
32
|
-
className: clsx('Arm-Modal__close', css.Modal__close),
|
|
33
|
+
className: clsx('Arm-Modal__close', classes['Arm-Modal__close'], css.Modal__close),
|
|
33
34
|
color: 'neutral',
|
|
34
35
|
size: 'medium',
|
|
35
36
|
children: /*#__PURE__*/_jsx("span", {
|
|
@@ -39,12 +40,12 @@ export const BaseModal = props => {
|
|
|
39
40
|
})]
|
|
40
41
|
})
|
|
41
42
|
}), /*#__PURE__*/_jsx("div", {
|
|
42
|
-
className: clsx('Arm-Modal__body', css.Modal__body),
|
|
43
|
+
className: clsx('Arm-Modal__body', classes['Arm-Modal__body'], css.Modal__body),
|
|
43
44
|
children: /*#__PURE__*/_jsx("div", {
|
|
44
45
|
children: children
|
|
45
46
|
})
|
|
46
47
|
}), showControls && /*#__PURE__*/_jsx("div", {
|
|
47
|
-
className: clsx('Arm-Modal__footer', css.Modal__footer),
|
|
48
|
+
className: clsx('Arm-Modal__footer', classes['Arm-Modal__footer'], css.Modal__footer),
|
|
48
49
|
children: /*#__PURE__*/_jsx(FormControls, {
|
|
49
50
|
onSubmit: onSubmit,
|
|
50
51
|
onCancel: onCancel,
|
package/ui/Modal/Modal.js
CHANGED
|
@@ -2,6 +2,7 @@ import { BaseModal } from "./BaseModal";
|
|
|
2
2
|
import BackDrop from "../BackDrop";
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
//TODO Написать тесты
|
|
5
6
|
const Modal = props => {
|
|
6
7
|
const {
|
|
7
8
|
open,
|
|
@@ -12,6 +13,7 @@ const Modal = props => {
|
|
|
12
13
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
13
14
|
children: /*#__PURE__*/_jsx(BackDrop, {
|
|
14
15
|
width: width,
|
|
16
|
+
onClick: modalProps.onClose,
|
|
15
17
|
children: /*#__PURE__*/_jsx(BaseModal, {
|
|
16
18
|
...modalProps,
|
|
17
19
|
className: 'moasda'
|