@via-profit/ui-kit 0.1.0-rc.24 → 0.1.0-rc.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/Modal/ConfirmBox/ConfirmBoxContainer.d.ts +14 -0
- package/Modal/ConfirmBox/ConfirmBoxContainer.js +28 -0
- package/Modal/ConfirmBox/ConfirmBoxContent.d.ts +14 -0
- package/Modal/ConfirmBox/ConfirmBoxContent.js +27 -0
- package/Modal/ConfirmBox/ConfirmBoxFooter.d.ts +50 -0
- package/Modal/ConfirmBox/ConfirmBoxFooter.js +46 -0
- package/Modal/ConfirmBox/ConfirmBoxHeader.d.ts +14 -0
- package/Modal/ConfirmBox/ConfirmBoxHeader.js +31 -0
- package/Modal/ConfirmBox/index.d.ts +55 -0
- package/Modal/ConfirmBox/index.js +99 -0
- package/Modal/Dialog/index.d.ts +8 -0
- package/Modal/{ModalDialog.js → Dialog/index.js} +6 -6
- package/Modal/Drawer/DrawerContainer.d.ts +4 -0
- package/Modal/Drawer/DrawerContainer.js +29 -0
- package/Modal/Drawer/DrawerContent.d.ts +4 -0
- package/Modal/Drawer/DrawerContent.js +30 -0
- package/Modal/Drawer/DrawerFooter.d.ts +4 -0
- package/Modal/Drawer/DrawerFooter.js +26 -0
- package/Modal/Drawer/DrawerHeader.d.ts +30 -0
- package/Modal/Drawer/DrawerHeader.js +60 -0
- package/Modal/Drawer/index.d.ts +53 -0
- package/Modal/{ModalDrawer.js → Drawer/index.js} +19 -59
- package/Modal/MessageBox/MessageBoxContainer.d.ts +14 -0
- package/Modal/MessageBox/MessageBoxContainer.js +28 -0
- package/Modal/MessageBox/MessageBoxContent.d.ts +14 -0
- package/Modal/MessageBox/MessageBoxContent.js +27 -0
- package/Modal/MessageBox/MessageBoxFooter.d.ts +32 -0
- package/Modal/MessageBox/MessageBoxFooter.js +45 -0
- package/Modal/MessageBox/MessageBoxHeader.d.ts +14 -0
- package/Modal/MessageBox/MessageBoxHeader.js +31 -0
- package/Modal/MessageBox/index.d.ts +46 -0
- package/Modal/{ModalMessageBox.js → MessageBox/index.js} +18 -48
- package/Modal/index.d.ts +9 -5
- package/Modal/index.js +15 -8
- package/PhoneField/index.js +2 -2
- package/package.json +40 -40
- package/Modal/ModalConfirmBox.d.ts +0 -9
- package/Modal/ModalConfirmBox.js +0 -148
- package/Modal/ModalDialog.d.ts +0 -7
- package/Modal/ModalDrawer.d.ts +0 -11
- package/Modal/ModalMessageBox.d.ts +0 -8
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ConfirmBoxContainerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
/**
|
|
4
|
+
* Dialog unique ID
|
|
5
|
+
*/
|
|
6
|
+
readonly dialogID: string;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
/**
|
|
10
|
+
* Dialog unique ID
|
|
11
|
+
*/
|
|
12
|
+
readonly dialogID: string;
|
|
13
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Container = styled_1.default.div `
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-flow: column;
|
|
22
|
+
min-width: 20em;
|
|
23
|
+
`;
|
|
24
|
+
const ConfirmBoxContainer = (props, ref) => {
|
|
25
|
+
const { children, dialogID } = props, nativeProps = __rest(props, ["children", "dialogID"]);
|
|
26
|
+
return (react_1.default.createElement(Container, Object.assign({ role: "modal-confirmbox", "aria-labelledby": `${dialogID}-title`, "aria-describedby": `${dialogID}-description` }, nativeProps, { ref: ref }), children));
|
|
27
|
+
};
|
|
28
|
+
exports.default = react_1.default.forwardRef(ConfirmBoxContainer);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ConfirmBoxContentProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
/**
|
|
4
|
+
* Dialog unique ID
|
|
5
|
+
*/
|
|
6
|
+
readonly dialogID: string;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
/**
|
|
10
|
+
* Dialog unique ID
|
|
11
|
+
*/
|
|
12
|
+
readonly dialogID: string;
|
|
13
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Content = styled_1.default.div `
|
|
20
|
+
flex: 1;
|
|
21
|
+
padding: 1em 1em;
|
|
22
|
+
`;
|
|
23
|
+
const ConfirmBoxContent = (props, ref) => {
|
|
24
|
+
const { children, dialogID } = props, nativeProps = __rest(props, ["children", "dialogID"]);
|
|
25
|
+
return (react_1.default.createElement(Content, Object.assign({ id: `${dialogID}-description` }, nativeProps, { ref: ref }), children));
|
|
26
|
+
};
|
|
27
|
+
exports.default = react_1.default.forwardRef(ConfirmBoxContent);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ConfirmBoxFooterProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
3
|
+
/**
|
|
4
|
+
* Dialog unique ID
|
|
5
|
+
*/
|
|
6
|
+
readonly dialogID: string;
|
|
7
|
+
/**
|
|
8
|
+
* On confirmation event
|
|
9
|
+
*/
|
|
10
|
+
readonly onRequestYes: React.MouseEventHandler<HTMLButtonElement>;
|
|
11
|
+
/**
|
|
12
|
+
* On close request
|
|
13
|
+
*/
|
|
14
|
+
readonly onRequestClose: (event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Label of Dissmiss button
|
|
17
|
+
* **Default**: `"Dismiss"`
|
|
18
|
+
*/
|
|
19
|
+
readonly dismissButtonLabel?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Label of Confirmation button
|
|
22
|
+
* **Default**: `"Confirm"`
|
|
23
|
+
*/
|
|
24
|
+
readonly confirmButtonLabel?: React.ReactNode;
|
|
25
|
+
};
|
|
26
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
27
|
+
/**
|
|
28
|
+
* Dialog unique ID
|
|
29
|
+
*/
|
|
30
|
+
readonly dialogID: string;
|
|
31
|
+
/**
|
|
32
|
+
* On confirmation event
|
|
33
|
+
*/
|
|
34
|
+
readonly onRequestYes: React.MouseEventHandler<HTMLButtonElement>;
|
|
35
|
+
/**
|
|
36
|
+
* On close request
|
|
37
|
+
*/
|
|
38
|
+
readonly onRequestClose: (event: React.KeyboardEvent<Element> | React.MouseEvent<Element, MouseEvent>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Label of Dissmiss button
|
|
41
|
+
* **Default**: `"Dismiss"`
|
|
42
|
+
*/
|
|
43
|
+
readonly dismissButtonLabel?: React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Label of Confirmation button
|
|
46
|
+
* **Default**: `"Confirm"`
|
|
47
|
+
*/
|
|
48
|
+
readonly confirmButtonLabel?: React.ReactNode;
|
|
49
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Button_1 = __importDefault(require("../../Button"));
|
|
20
|
+
const Footer = styled_1.default.div `
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: flex-end;
|
|
23
|
+
align-items: center;
|
|
24
|
+
padding: 1em 1em 1em 1em;
|
|
25
|
+
|
|
26
|
+
& > button {
|
|
27
|
+
border-radius: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
& > button:first-of-type {
|
|
31
|
+
border-top-left-radius: 1em;
|
|
32
|
+
border-bottom-left-radius: 1em;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
& > button:last-child {
|
|
36
|
+
border-top-right-radius: 1em;
|
|
37
|
+
border-bottom-right-radius: 1em;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
const ConfirmBoxFooter = (props, ref) => {
|
|
41
|
+
const { onRequestClose, onRequestYes, dismissButtonLabel, confirmButtonLabel } = props, nativeProps = __rest(props, ["onRequestClose", "onRequestYes", "dismissButtonLabel", "confirmButtonLabel"]);
|
|
42
|
+
return (react_1.default.createElement(Footer, Object.assign({}, nativeProps, { ref: ref }),
|
|
43
|
+
react_1.default.createElement(Button_1.default, { onClick: onRequestClose }, typeof dismissButtonLabel === 'undefined' ? 'Dismiss' : dismissButtonLabel),
|
|
44
|
+
react_1.default.createElement(Button_1.default, { color: "primary", onClick: onRequestYes }, typeof confirmButtonLabel === 'undefined' ? 'Confirm' : confirmButtonLabel)));
|
|
45
|
+
};
|
|
46
|
+
exports.default = react_1.default.forwardRef(ConfirmBoxFooter);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ConfirmBoxHeaderProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
/**
|
|
4
|
+
* Dialog unique ID
|
|
5
|
+
*/
|
|
6
|
+
readonly dialogID: string;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
/**
|
|
10
|
+
* Dialog unique ID
|
|
11
|
+
*/
|
|
12
|
+
readonly dialogID: string;
|
|
13
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Header = styled_1.default.div `
|
|
20
|
+
padding: 1em 1em 0 1em;
|
|
21
|
+
`;
|
|
22
|
+
const HeaderTitle = styled_1.default.div `
|
|
23
|
+
font-size: 1.4rem;
|
|
24
|
+
font-weight: 600;
|
|
25
|
+
`;
|
|
26
|
+
const ConfirmBoxHeader = (props, ref) => {
|
|
27
|
+
const { children, dialogID } = props, nativeProps = __rest(props, ["children", "dialogID"]);
|
|
28
|
+
return (react_1.default.createElement(Header, null,
|
|
29
|
+
react_1.default.createElement(HeaderTitle, Object.assign({}, nativeProps, { id: `${dialogID}-title`, ref: ref }), children)));
|
|
30
|
+
};
|
|
31
|
+
exports.default = react_1.default.forwardRef(ConfirmBoxHeader);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactModal from 'react-modal';
|
|
3
|
+
import { ConfirmBoxContainerProps } from './ConfirmBoxContainer';
|
|
4
|
+
import { ConfirmBoxContentProps } from './ConfirmBoxContent';
|
|
5
|
+
import { ConfirmBoxFooterProps } from './ConfirmBoxFooter';
|
|
6
|
+
import { ConfirmBoxHeaderProps } from './ConfirmBoxHeader';
|
|
7
|
+
export interface ConfirmBoxProps extends ReactModal.Props {
|
|
8
|
+
readonly variant: 'confirm-box';
|
|
9
|
+
/**
|
|
10
|
+
* Dialog title
|
|
11
|
+
*/
|
|
12
|
+
readonly title: string;
|
|
13
|
+
/**
|
|
14
|
+
* On confirmation event
|
|
15
|
+
*/
|
|
16
|
+
readonly onRequestYes: React.MouseEventHandler<HTMLButtonElement>;
|
|
17
|
+
/**
|
|
18
|
+
* On close request
|
|
19
|
+
*/
|
|
20
|
+
readonly onRequestClose: (event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Label of Dissmiss button
|
|
23
|
+
* **Default**: `"Dismiss"`
|
|
24
|
+
*/
|
|
25
|
+
readonly dismissButtonLabel?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Label of Confirmation button
|
|
28
|
+
* **Default**: `"Confirm"`
|
|
29
|
+
*/
|
|
30
|
+
readonly confirmButtonLabel?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Overridable components map
|
|
33
|
+
*/
|
|
34
|
+
readonly overrides?: ConfirmBoxOverrides;
|
|
35
|
+
}
|
|
36
|
+
export interface ConfirmBoxOverrides {
|
|
37
|
+
/**
|
|
38
|
+
* Element container
|
|
39
|
+
*/
|
|
40
|
+
readonly Container?: React.ForwardRefExoticComponent<ConfirmBoxContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
41
|
+
/**
|
|
42
|
+
* Element ontent
|
|
43
|
+
*/
|
|
44
|
+
readonly Content?: React.ForwardRefExoticComponent<ConfirmBoxContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
/**
|
|
46
|
+
* Element footer
|
|
47
|
+
*/
|
|
48
|
+
readonly Footer?: React.ForwardRefExoticComponent<ConfirmBoxFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
49
|
+
/**
|
|
50
|
+
* Element header
|
|
51
|
+
*/
|
|
52
|
+
readonly Header?: React.ForwardRefExoticComponent<ConfirmBoxHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
}
|
|
54
|
+
declare const _default: React.ForwardRefExoticComponent<ConfirmBoxProps & React.RefAttributes<ReactModal>>;
|
|
55
|
+
export default _default;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const react_2 = require("@emotion/react");
|
|
19
|
+
const react_modal_1 = __importDefault(require("react-modal"));
|
|
20
|
+
const ConfirmBoxContainer_1 = __importDefault(require("./ConfirmBoxContainer"));
|
|
21
|
+
const ConfirmBoxContent_1 = __importDefault(require("./ConfirmBoxContent"));
|
|
22
|
+
const ConfirmBoxFooter_1 = __importDefault(require("./ConfirmBoxFooter"));
|
|
23
|
+
const ConfirmBoxHeader_1 = __importDefault(require("./ConfirmBoxHeader"));
|
|
24
|
+
const ConfirmBox = (props, ref) => {
|
|
25
|
+
const { title, children, onRequestYes, onRequestClose, overrides, isOpen, dismissButtonLabel, confirmButtonLabel } = props, otherProps = __rest(props, ["title", "children", "onRequestYes", "onRequestClose", "overrides", "isOpen", "dismissButtonLabel", "confirmButtonLabel"]);
|
|
26
|
+
const dialogID = react_1.default.useMemo(() => `dialog-confirm-${new Date().getTime()}`, []);
|
|
27
|
+
const buttonRef = react_1.default.useRef(null);
|
|
28
|
+
const theme = (0, react_2.useTheme)();
|
|
29
|
+
const overridesMap = react_1.default.useMemo(() => (Object.assign({ Container: ConfirmBoxContainer_1.default,
|
|
30
|
+
Content: ConfirmBoxContent_1.default,
|
|
31
|
+
Footer: ConfirmBoxFooter_1.default,
|
|
32
|
+
Header: ConfirmBoxHeader_1.default }, overrides)), [overrides]);
|
|
33
|
+
react_1.default.useEffect(() => {
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
if (isOpen && buttonRef.current) {
|
|
36
|
+
buttonRef.current.focus();
|
|
37
|
+
}
|
|
38
|
+
}, 15);
|
|
39
|
+
}, [isOpen]);
|
|
40
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
41
|
+
react_1.default.createElement(react_modal_1.default, Object.assign({ ref: ref, portalClassName: "modal-confirmbox", closeTimeoutMS: 200, shouldCloseOnEsc: true, shouldCloseOnOverlayClick: false, onRequestClose: onRequestClose, isOpen: isOpen }, otherProps),
|
|
42
|
+
react_1.default.createElement(overridesMap.Container, { dialogID: dialogID },
|
|
43
|
+
react_1.default.useMemo(() => (react_1.default.createElement(overridesMap.Header, { dialogID: dialogID }, title)), [overridesMap, dialogID, title]),
|
|
44
|
+
react_1.default.useMemo(() => (react_1.default.createElement(overridesMap.Content, { dialogID: dialogID }, children)), [dialogID, children, overridesMap]),
|
|
45
|
+
react_1.default.useMemo(() => (react_1.default.createElement(overridesMap.Footer, { dialogID: dialogID, onRequestClose: onRequestClose, onRequestYes: onRequestYes, dismissButtonLabel: dismissButtonLabel, confirmButtonLabel: confirmButtonLabel })), [
|
|
46
|
+
confirmButtonLabel,
|
|
47
|
+
dialogID,
|
|
48
|
+
dismissButtonLabel,
|
|
49
|
+
onRequestClose,
|
|
50
|
+
onRequestYes,
|
|
51
|
+
overridesMap,
|
|
52
|
+
]))),
|
|
53
|
+
react_1.default.createElement(react_2.Global, { styles: (0, react_2.css) `
|
|
54
|
+
.modal-confirmbox .ReactModal__Overlay {
|
|
55
|
+
position: fixed !important;
|
|
56
|
+
inset: 0 !important;
|
|
57
|
+
z-index: ${theme.zIndex.modal} !important;
|
|
58
|
+
transition: background-color 120ms ease-in-out !important;
|
|
59
|
+
background-color: ${theme.color.textPrimary.alpha(0).toString()}!important;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.modal-confirmbox .ReactModal__Overlay--after-open {
|
|
63
|
+
background-color: ${theme.color.textPrimary.alpha(0.5).toString()}!important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.modal-confirmbox .ReactModal__Overlay--before-close {
|
|
67
|
+
background-color: ${theme.color.textPrimary.alpha(0).toString()}!important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.modal-confirmbox .ReactModal__Content {
|
|
71
|
+
inset: initial !important;
|
|
72
|
+
border: none !important;
|
|
73
|
+
position: absolute !important;
|
|
74
|
+
top: 50% !important;
|
|
75
|
+
padding: 0 !important;
|
|
76
|
+
left: 50% !important;
|
|
77
|
+
opacity: 0 !important;
|
|
78
|
+
overflow: auto !important;
|
|
79
|
+
-webkit-overflow-scrolling: touch !important;
|
|
80
|
+
outline: none !important;
|
|
81
|
+
background: ${theme.color.surface.toString()} !important;
|
|
82
|
+
border-radius: 1em !important;
|
|
83
|
+
transform: translate(-50%, -40%) !important;
|
|
84
|
+
transition: transform 100ms ease-in-out, opacity 100ms ease-in-out !important;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.modal-confirmbox .ReactModal__Content--after-open {
|
|
88
|
+
opacity: 1 !important;
|
|
89
|
+
transform: translate(-50%, -50%) !important;
|
|
90
|
+
transition-duration: 160ms !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.modal-confirmbox .ReactModal__Content--before-close {
|
|
94
|
+
opacity: 0 !important;
|
|
95
|
+
transform: translate(-50%, 300px) !important;
|
|
96
|
+
}
|
|
97
|
+
` })));
|
|
98
|
+
};
|
|
99
|
+
exports.default = react_1.default.forwardRef(ConfirmBox);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import ReactModal from 'react-modal';
|
|
3
|
+
export interface DialogProps extends ReactModal.Props {
|
|
4
|
+
readonly variant: 'dialog';
|
|
5
|
+
readonly children: React.ReactNode | React.ReactNode[];
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<ReactModal>>;
|
|
8
|
+
export default _default;
|
|
@@ -38,16 +38,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
const React = __importStar(require("react"));
|
|
41
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
42
41
|
const react_1 = require("@emotion/react");
|
|
43
42
|
const react_modal_1 = __importDefault(require("react-modal"));
|
|
44
|
-
const
|
|
45
|
-
const ModalDialog = (props, ref) => {
|
|
43
|
+
const Dialog = (props, ref) => {
|
|
46
44
|
const { children } = props, otherProps = __rest(props, ["children"]);
|
|
47
45
|
const theme = (0, react_1.useTheme)();
|
|
48
46
|
return (React.createElement(React.Fragment, null,
|
|
49
47
|
React.createElement(react_modal_1.default, Object.assign({ ref: ref, closeTimeoutMS: 200, portalClassName: "modal-dialog" }, otherProps),
|
|
50
|
-
React.createElement(
|
|
48
|
+
React.createElement("div", null, children)),
|
|
51
49
|
React.createElement(react_1.Global, { styles: (0, react_1.css) `
|
|
52
50
|
.modal-dialog .ReactModal__Overlay {
|
|
53
51
|
position: fixed !important;
|
|
@@ -80,7 +78,9 @@ const ModalDialog = (props, ref) => {
|
|
|
80
78
|
background: ${theme.color.surface.toString()} !important;
|
|
81
79
|
border-radius: 1em !important;
|
|
82
80
|
transform: translate(-50%, -40%) !important;
|
|
83
|
-
transition:
|
|
81
|
+
transition:
|
|
82
|
+
transform 100ms ease-in-out,
|
|
83
|
+
opacity 100ms ease-in-out !important;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
.modal-dialog .ReactModal__Content--after-open {
|
|
@@ -95,4 +95,4 @@ const ModalDialog = (props, ref) => {
|
|
|
95
95
|
}
|
|
96
96
|
` })));
|
|
97
97
|
};
|
|
98
|
-
exports.default = React.forwardRef(
|
|
98
|
+
exports.default = React.forwardRef(Dialog);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Container = styled_1.default.div `
|
|
20
|
+
min-height: 2rem;
|
|
21
|
+
height: 100%;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-flow: column;
|
|
24
|
+
`;
|
|
25
|
+
const DrawerContainer = (props, ref) => {
|
|
26
|
+
const { children } = props, nativeProps = __rest(props, ["children"]);
|
|
27
|
+
return (react_1.default.createElement(Container, Object.assign({}, nativeProps, { ref: ref }), children));
|
|
28
|
+
};
|
|
29
|
+
exports.default = react_1.default.forwardRef(DrawerContainer);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Content = styled_1.default.div `
|
|
20
|
+
overflow-y: auto;
|
|
21
|
+
flex: 1;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
padding: 0.5em 1em;
|
|
25
|
+
`;
|
|
26
|
+
const DrawerContent = (props, ref) => {
|
|
27
|
+
const { children } = props, nativeProps = __rest(props, ["children"]);
|
|
28
|
+
return (react_1.default.createElement(Content, Object.assign({}, nativeProps, { ref: ref }), children));
|
|
29
|
+
};
|
|
30
|
+
exports.default = react_1.default.forwardRef(DrawerContent);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Footer = styled_1.default.div `
|
|
20
|
+
padding: 0.5em 1em;
|
|
21
|
+
`;
|
|
22
|
+
const DrawerFooter = (props, ref) => {
|
|
23
|
+
const { children } = props, nativeProps = __rest(props, ["children"]);
|
|
24
|
+
return (react_1.default.createElement(Footer, Object.assign({}, nativeProps, { ref: ref }), children));
|
|
25
|
+
};
|
|
26
|
+
exports.default = react_1.default.forwardRef(DrawerFooter);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type DrawerHeaderProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> & {
|
|
3
|
+
/**
|
|
4
|
+
* Drawer title
|
|
5
|
+
*/
|
|
6
|
+
readonly title?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Display close button in the header
|
|
9
|
+
*/
|
|
10
|
+
readonly showCloseButton?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* On close request
|
|
13
|
+
*/
|
|
14
|
+
readonly onRequestClose?: (event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => void;
|
|
15
|
+
};
|
|
16
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "title"> & {
|
|
17
|
+
/**
|
|
18
|
+
* Drawer title
|
|
19
|
+
*/
|
|
20
|
+
readonly title?: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Display close button in the header
|
|
23
|
+
*/
|
|
24
|
+
readonly showCloseButton?: boolean | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* On close request
|
|
27
|
+
*/
|
|
28
|
+
readonly onRequestClose?: ((event: React.KeyboardEvent<Element> | React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
29
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const CloseIcon_1 = __importDefault(require("../CloseIcon"));
|
|
20
|
+
const Button_1 = __importDefault(require("../../Button"));
|
|
21
|
+
const Header = styled_1.default.div `
|
|
22
|
+
padding: 1em;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
`;
|
|
27
|
+
const Title = styled_1.default.div `
|
|
28
|
+
font-size: 1.3em;
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
margin-right: 1em;
|
|
31
|
+
`;
|
|
32
|
+
const Toolbar = styled_1.default.div `
|
|
33
|
+
flex: 1;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: flex-end;
|
|
37
|
+
`;
|
|
38
|
+
const CloseButton = (0, styled_1.default)(Button_1.default) `
|
|
39
|
+
margin-left: ${props => (props.$withToolbar ? '1em' : 0)};
|
|
40
|
+
color: ${props => props.theme.color.textPrimary.toString()};
|
|
41
|
+
background: none;
|
|
42
|
+
width: auto;
|
|
43
|
+
height: auto;
|
|
44
|
+
padding: 0.6em;
|
|
45
|
+
font-size: 1em;
|
|
46
|
+
border-radius: 100%;
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
align-items: center;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
`;
|
|
52
|
+
const DrawerHeader = (props, ref) => {
|
|
53
|
+
const { title, children, showCloseButton, onRequestClose } = props, nativeProps = __rest(props, ["title", "children", "showCloseButton", "onRequestClose"]);
|
|
54
|
+
return (react_1.default.createElement(Header, Object.assign({}, nativeProps, { ref: ref }),
|
|
55
|
+
typeof title === 'string' && react_1.default.createElement(Title, null, title),
|
|
56
|
+
react_1.default.createElement(Toolbar, null, children),
|
|
57
|
+
typeof onRequestClose === 'function' && showCloseButton && (react_1.default.createElement(CloseButton, { type: "button", "$withToolbar": Boolean(toolbar), onClick: onRequestClose },
|
|
58
|
+
react_1.default.createElement(CloseIcon_1.default, null)))));
|
|
59
|
+
};
|
|
60
|
+
exports.default = react_1.default.forwardRef(DrawerHeader);
|