@dktunited-techoff/techoff-suite-ui 1.13.10 → 1.14.0
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/esm/components/TsMenuButton/TsMenuButton.js +5 -1
- package/esm/components/TsMenuButton/TsMenuButton.js.map +1 -1
- package/esm/components/TsModal/TsModal.css +65 -0
- package/esm/components/TsModal/TsModal.d.ts +4 -0
- package/esm/components/TsModal/TsModal.js +17 -0
- package/esm/components/TsModal/TsModal.js.map +1 -0
- package/esm/components/TsModal/TsModal.types.d.ts +9 -0
- package/esm/components/TsModal/TsModal.types.js +2 -0
- package/esm/components/TsModal/TsModal.types.js.map +1 -0
- package/esm/components/TsModal/__stories__/TsModal.stories.mdx +60 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/lib/components/TsMenuButton/TsMenuButton.js +5 -1
- package/lib/components/TsMenuButton/TsMenuButton.js.map +1 -1
- package/lib/components/TsModal/TsModal.css +65 -0
- package/lib/components/TsModal/TsModal.d.ts +4 -0
- package/lib/components/TsModal/TsModal.js +21 -0
- package/lib/components/TsModal/TsModal.js.map +1 -0
- package/lib/components/TsModal/TsModal.types.d.ts +9 -0
- package/lib/components/TsModal/TsModal.types.js +3 -0
- package/lib/components/TsModal/TsModal.types.js.map +1 -0
- package/lib/components/TsModal/__stories__/TsModal.stories.mdx +60 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/TsMenuButton/TsMenuButton.tsx +5 -1
- package/src/components/TsModal/TsModal.css +65 -0
- package/src/components/TsModal/TsModal.tsx +32 -0
- package/src/components/TsModal/TsModal.types.ts +10 -0
- package/src/components/TsModal/__stories__/TsModal.stories.mdx +60 -0
- package/src/index.ts +1 -0
|
@@ -32,12 +32,16 @@ export const TsMenuButton = ({ actions, buttonProps, menuAlignment }) => {
|
|
|
32
32
|
const menu = showMenu && (React.createElement(React.Fragment, null,
|
|
33
33
|
React.createElement("div", { className: `ts-menu-button-menu ts-menu-button-menu--${menuAlignment}`, style: menuStyle, ref: menuRef }, actions.map(action => !action.divider ? (React.createElement("button", { className: "ts-menu-item", onClick: e => {
|
|
34
34
|
e.stopPropagation();
|
|
35
|
+
setShowMenu(false);
|
|
35
36
|
action.onClick && action.onClick(e);
|
|
36
37
|
} },
|
|
37
38
|
action.icon && (React.createElement("div", { className: "ts-menu-item-icon" },
|
|
38
39
|
React.createElement(TsIcon, { name: action.icon, size: "16" }))),
|
|
39
40
|
React.createElement("div", { className: "ts-menu-item-label" }, action.label))) : (React.createElement("div", { className: "ts-menu-divider" })))),
|
|
40
|
-
React.createElement("div", { onClick:
|
|
41
|
+
React.createElement("div", { onClick: e => {
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
setShowMenu(false);
|
|
44
|
+
}, style: {
|
|
41
45
|
position: 'fixed',
|
|
42
46
|
top: 0,
|
|
43
47
|
left: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsMenuButton.js","sourceRoot":"","sources":["../../../src/components/TsMenuButton/TsMenuButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAA6B,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAqB,EAAE,EAAE;IACzF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACzD,MAAM,CAAC,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+
position: fixed;
|
|
9
|
+
inset: 0;
|
|
10
|
+
background: #4e5d6b;
|
|
11
|
+
opacity: 80%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ts-modal {
|
|
15
|
+
position: fixed;
|
|
16
|
+
top: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
bottom: 0;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
width: 485px;
|
|
22
|
+
padding: 40px 64px;
|
|
23
|
+
box-shadow: 0px 12px 9px 0px #10101012;
|
|
24
|
+
background: #ffffff;
|
|
25
|
+
z-index: 600;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ts-modal-header {
|
|
29
|
+
display: flex;
|
|
30
|
+
padding-bottom: 24px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ts-modal-title {
|
|
34
|
+
flex: 1;
|
|
35
|
+
font-weight: 600;
|
|
36
|
+
font-size: 24px;
|
|
37
|
+
line-height: 32px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ts-modal-content {
|
|
41
|
+
flex: 1;
|
|
42
|
+
padding: 16px 32px 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ts-modal-footer {
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
padding-top: 24px;
|
|
49
|
+
}
|
|
50
|
+
.ts-modal-footer > * {
|
|
51
|
+
margin-right: 16px;
|
|
52
|
+
}
|
|
53
|
+
.ts-modal-footer > *:last-child {
|
|
54
|
+
margin-right: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* ######### */
|
|
58
|
+
/* GLOBALS */
|
|
59
|
+
* {
|
|
60
|
+
font-size: 14px;
|
|
61
|
+
outline: none;
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
64
|
+
'Helvetica Neue', sans-serif;
|
|
65
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TsButton } from '../TsButton/TsButton';
|
|
3
|
+
import './TsModal.css';
|
|
4
|
+
export const TsModal = ({ children, actionLabel, actionIcon, style, title, onAction, onClose }) => {
|
|
5
|
+
// Rendering
|
|
6
|
+
return (React.createElement("div", { className: "ts-modal-container" },
|
|
7
|
+
React.createElement("div", { className: "ts-modal-blur" }),
|
|
8
|
+
React.createElement("div", { className: "ts-modal", style: style },
|
|
9
|
+
React.createElement("div", { className: "ts-modal-header" },
|
|
10
|
+
React.createElement("div", { className: "ts-modal-title" }, title),
|
|
11
|
+
React.createElement(TsButton, { icon: "close", variant: "ghost", rounded: true, onClick: onClose })),
|
|
12
|
+
React.createElement("div", { className: "ts-modal-content" }, children),
|
|
13
|
+
React.createElement("div", { className: "ts-modal-footer" },
|
|
14
|
+
React.createElement(TsButton, { variant: "secondary", onClick: onClose }, "Cancel"),
|
|
15
|
+
React.createElement(TsButton, { icon: actionIcon, variant: "primary", onClick: onAction }, actionLabel)))));
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=TsModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsModal.js","sourceRoot":"","sources":["../../../src/components/TsModal/TsModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAgB,EAAE,EAAE;IAC9G,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAC,oBAAoB;QACjC,6BAAK,SAAS,EAAC,eAAe,GAAG;QAEjC,6BAAK,SAAS,EAAC,UAAU,EAAC,KAAK,EAAE,KAAK;YACpC,6BAAK,SAAS,EAAC,iBAAiB;gBAC9B,6BAAK,SAAS,EAAC,gBAAgB,IAAE,KAAK,CAAO;gBAE7C,oBAAC,QAAQ,IAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,QAAC,OAAO,EAAE,OAAO,GAAI,CAC/D;YAEN,6BAAK,SAAS,EAAC,kBAAkB,IAAE,QAAQ,CAAO;YAElD,6BAAK,SAAS,EAAC,iBAAiB;gBAC9B,oBAAC,QAAQ,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,OAAO,aAEnC;gBACX,oBAAC,QAAQ,IAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,QAAQ,IAC5D,WAAW,CACH,CACP,CACF,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsModal.types.js","sourceRoot":"","sources":["../../../src/components/TsModal/TsModal.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
+
import { TsModal } from '../TsModal';
|
|
4
|
+
import { icons } from '../../TsIcon/icons';
|
|
5
|
+
|
|
6
|
+
<Meta title="Components/Modal" />
|
|
7
|
+
|
|
8
|
+
export const modalArgTypes = {
|
|
9
|
+
actionIcon: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: Object.keys(icons),
|
|
12
|
+
description: 'Icon of the button.',
|
|
13
|
+
},
|
|
14
|
+
actionLabel: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Label of the modal action button.',
|
|
17
|
+
},
|
|
18
|
+
title: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Title of the modal.',
|
|
21
|
+
},
|
|
22
|
+
onCancel: {
|
|
23
|
+
control: 'function',
|
|
24
|
+
description: 'Handle action when canceling or closing the modal',
|
|
25
|
+
},
|
|
26
|
+
onAction: {
|
|
27
|
+
control: 'function',
|
|
28
|
+
description: 'Handle action when clicking on action button',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
# Modal
|
|
33
|
+
|
|
34
|
+
The Modal Component is the main Component of the Overlay pattern and is used to display a secondary window over the content. It can be used with or without an Illustration and adapts its content accordingly.
|
|
35
|
+
|
|
36
|
+
## Overview
|
|
37
|
+
|
|
38
|
+
<Canvas>
|
|
39
|
+
<Story
|
|
40
|
+
name="Overview"
|
|
41
|
+
args={{
|
|
42
|
+
title: 'New modal',
|
|
43
|
+
actionIcon: 'add',
|
|
44
|
+
actionLabel: 'Create',
|
|
45
|
+
onAction: () => console.log('Action !'),
|
|
46
|
+
onClose: () => console.log('Close !'),
|
|
47
|
+
}}
|
|
48
|
+
argTypes={modalArgTypes}
|
|
49
|
+
>
|
|
50
|
+
{args => (
|
|
51
|
+
<div style={{ height: '500px' }}>
|
|
52
|
+
<TsModal {...args}>{args.children}</TsModal>
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
55
|
+
</Story>
|
|
56
|
+
</Canvas>
|
|
57
|
+
|
|
58
|
+
## Props
|
|
59
|
+
|
|
60
|
+
<ArgsTable story="Overview" of={TsModal} />
|
package/esm/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './components/TsInput/TsBooleanInput/TsBooleanInput';
|
|
|
7
7
|
export * from './components/TsInput/TsInput/TsInput';
|
|
8
8
|
export * from './components/TsLoader/TsLoader';
|
|
9
9
|
export * from './components/TsMenuButton/TsMenuButton';
|
|
10
|
+
export * from './components/TsModal/TsModal';
|
|
10
11
|
export * from './components/TsSwitcher/TsSwitcher';
|
|
11
12
|
export * from './components/TsTabs/TsTabs';
|
|
12
13
|
export * from './components/TsTooltip/TsTooltip';
|
package/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './components/TsInput/TsBooleanInput/TsBooleanInput';
|
|
|
7
7
|
export * from './components/TsInput/TsInput/TsInput';
|
|
8
8
|
export * from './components/TsLoader/TsLoader';
|
|
9
9
|
export * from './components/TsMenuButton/TsMenuButton';
|
|
10
|
+
export * from './components/TsModal/TsModal';
|
|
10
11
|
export * from './components/TsSwitcher/TsSwitcher';
|
|
11
12
|
export * from './components/TsTabs/TsTabs';
|
|
12
13
|
export * from './components/TsTooltip/TsTooltip';
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oDAAoD,CAAC;AACnE,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oDAAoD,CAAC;AACnE,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wCAAwC,CAAC;AACvD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC"}
|
|
@@ -35,12 +35,16 @@ const TsMenuButton = ({ actions, buttonProps, menuAlignment }) => {
|
|
|
35
35
|
const menu = showMenu && (React.createElement(React.Fragment, null,
|
|
36
36
|
React.createElement("div", { className: `ts-menu-button-menu ts-menu-button-menu--${menuAlignment}`, style: menuStyle, ref: menuRef }, actions.map(action => !action.divider ? (React.createElement("button", { className: "ts-menu-item", onClick: e => {
|
|
37
37
|
e.stopPropagation();
|
|
38
|
+
setShowMenu(false);
|
|
38
39
|
action.onClick && action.onClick(e);
|
|
39
40
|
} },
|
|
40
41
|
action.icon && (React.createElement("div", { className: "ts-menu-item-icon" },
|
|
41
42
|
React.createElement(TsIcon_1.TsIcon, { name: action.icon, size: "16" }))),
|
|
42
43
|
React.createElement("div", { className: "ts-menu-item-label" }, action.label))) : (React.createElement("div", { className: "ts-menu-divider" })))),
|
|
43
|
-
React.createElement("div", { onClick:
|
|
44
|
+
React.createElement("div", { onClick: e => {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
setShowMenu(false);
|
|
47
|
+
}, style: {
|
|
44
48
|
position: 'fixed',
|
|
45
49
|
top: 0,
|
|
46
50
|
left: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsMenuButton.js","sourceRoot":"","sources":["../../../src/components/TsMenuButton/TsMenuButton.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,iCAA+E;AAC/E,yCAAyC;AACzC,mDAAgD;AAChD,6CAA0C;AAE1C,8BAA4B;AAErB,MAAM,YAAY,GAAG,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAqB,EAAE,EAAE;IACzF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,C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
|
|
13
|
+
|
|
14
|
+
.ts-modal {
|
|
15
|
+
position: fixed;
|
|
16
|
+
top: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
bottom: 0;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
width: 485px;
|
|
22
|
+
padding: 40px 64px;
|
|
23
|
+
box-shadow: 0px 12px 9px 0px #10101012;
|
|
24
|
+
background: #ffffff;
|
|
25
|
+
z-index: 600;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ts-modal-header {
|
|
29
|
+
display: flex;
|
|
30
|
+
padding-bottom: 24px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ts-modal-title {
|
|
34
|
+
flex: 1;
|
|
35
|
+
font-weight: 600;
|
|
36
|
+
font-size: 24px;
|
|
37
|
+
line-height: 32px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ts-modal-content {
|
|
41
|
+
flex: 1;
|
|
42
|
+
padding: 16px 32px 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ts-modal-footer {
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
padding-top: 24px;
|
|
49
|
+
}
|
|
50
|
+
.ts-modal-footer > * {
|
|
51
|
+
margin-right: 16px;
|
|
52
|
+
}
|
|
53
|
+
.ts-modal-footer > *:last-child {
|
|
54
|
+
margin-right: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* ######### */
|
|
58
|
+
/* GLOBALS */
|
|
59
|
+
* {
|
|
60
|
+
font-size: 14px;
|
|
61
|
+
outline: none;
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
64
|
+
'Helvetica Neue', sans-serif;
|
|
65
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TsModal = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const TsButton_1 = require("../TsButton/TsButton");
|
|
6
|
+
require("./TsModal.css");
|
|
7
|
+
const TsModal = ({ children, actionLabel, actionIcon, style, title, onAction, onClose }) => {
|
|
8
|
+
// Rendering
|
|
9
|
+
return (React.createElement("div", { className: "ts-modal-container" },
|
|
10
|
+
React.createElement("div", { className: "ts-modal-blur" }),
|
|
11
|
+
React.createElement("div", { className: "ts-modal", style: style },
|
|
12
|
+
React.createElement("div", { className: "ts-modal-header" },
|
|
13
|
+
React.createElement("div", { className: "ts-modal-title" }, title),
|
|
14
|
+
React.createElement(TsButton_1.TsButton, { icon: "close", variant: "ghost", rounded: true, onClick: onClose })),
|
|
15
|
+
React.createElement("div", { className: "ts-modal-content" }, children),
|
|
16
|
+
React.createElement("div", { className: "ts-modal-footer" },
|
|
17
|
+
React.createElement(TsButton_1.TsButton, { variant: "secondary", onClick: onClose }, "Cancel"),
|
|
18
|
+
React.createElement(TsButton_1.TsButton, { icon: actionIcon, variant: "primary", onClick: onAction }, actionLabel)))));
|
|
19
|
+
};
|
|
20
|
+
exports.TsModal = TsModal;
|
|
21
|
+
//# sourceMappingURL=TsModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsModal.js","sourceRoot":"","sources":["../../../src/components/TsModal/TsModal.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B,mDAAgD;AAChD,yBAAuB;AAEhB,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAgB,EAAE,EAAE;IAC9G,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAC,oBAAoB;QACjC,6BAAK,SAAS,EAAC,eAAe,GAAG;QAEjC,6BAAK,SAAS,EAAC,UAAU,EAAC,KAAK,EAAE,KAAK;YACpC,6BAAK,SAAS,EAAC,iBAAiB;gBAC9B,6BAAK,SAAS,EAAC,gBAAgB,IAAE,KAAK,CAAO;gBAE7C,oBAAC,mBAAQ,IAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,QAAC,OAAO,EAAE,OAAO,GAAI,CAC/D;YAEN,6BAAK,SAAS,EAAC,kBAAkB,IAAE,QAAQ,CAAO;YAElD,6BAAK,SAAS,EAAC,iBAAiB;gBAC9B,oBAAC,mBAAQ,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,OAAO,aAEnC;gBACX,oBAAC,mBAAQ,IAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,QAAQ,IAC5D,WAAW,CACH,CACP,CACF,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,OAAO,WA0BlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsModal.types.js","sourceRoot":"","sources":["../../../src/components/TsModal/TsModal.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
+
import { TsModal } from '../TsModal';
|
|
4
|
+
import { icons } from '../../TsIcon/icons';
|
|
5
|
+
|
|
6
|
+
<Meta title="Components/Modal" />
|
|
7
|
+
|
|
8
|
+
export const modalArgTypes = {
|
|
9
|
+
actionIcon: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: Object.keys(icons),
|
|
12
|
+
description: 'Icon of the button.',
|
|
13
|
+
},
|
|
14
|
+
actionLabel: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Label of the modal action button.',
|
|
17
|
+
},
|
|
18
|
+
title: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Title of the modal.',
|
|
21
|
+
},
|
|
22
|
+
onCancel: {
|
|
23
|
+
control: 'function',
|
|
24
|
+
description: 'Handle action when canceling or closing the modal',
|
|
25
|
+
},
|
|
26
|
+
onAction: {
|
|
27
|
+
control: 'function',
|
|
28
|
+
description: 'Handle action when clicking on action button',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
# Modal
|
|
33
|
+
|
|
34
|
+
The Modal Component is the main Component of the Overlay pattern and is used to display a secondary window over the content. It can be used with or without an Illustration and adapts its content accordingly.
|
|
35
|
+
|
|
36
|
+
## Overview
|
|
37
|
+
|
|
38
|
+
<Canvas>
|
|
39
|
+
<Story
|
|
40
|
+
name="Overview"
|
|
41
|
+
args={{
|
|
42
|
+
title: 'New modal',
|
|
43
|
+
actionIcon: 'add',
|
|
44
|
+
actionLabel: 'Create',
|
|
45
|
+
onAction: () => console.log('Action !'),
|
|
46
|
+
onClose: () => console.log('Close !'),
|
|
47
|
+
}}
|
|
48
|
+
argTypes={modalArgTypes}
|
|
49
|
+
>
|
|
50
|
+
{args => (
|
|
51
|
+
<div style={{ height: '500px' }}>
|
|
52
|
+
<TsModal {...args}>{args.children}</TsModal>
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
55
|
+
</Story>
|
|
56
|
+
</Canvas>
|
|
57
|
+
|
|
58
|
+
## Props
|
|
59
|
+
|
|
60
|
+
<ArgsTable story="Overview" of={TsModal} />
|
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './components/TsInput/TsBooleanInput/TsBooleanInput';
|
|
|
7
7
|
export * from './components/TsInput/TsInput/TsInput';
|
|
8
8
|
export * from './components/TsLoader/TsLoader';
|
|
9
9
|
export * from './components/TsMenuButton/TsMenuButton';
|
|
10
|
+
export * from './components/TsModal/TsModal';
|
|
10
11
|
export * from './components/TsSwitcher/TsSwitcher';
|
|
11
12
|
export * from './components/TsTabs/TsTabs';
|
|
12
13
|
export * from './components/TsTooltip/TsTooltip';
|
package/lib/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __exportStar(require("./components/TsInput/TsBooleanInput/TsBooleanInput"), expo
|
|
|
23
23
|
__exportStar(require("./components/TsInput/TsInput/TsInput"), exports);
|
|
24
24
|
__exportStar(require("./components/TsLoader/TsLoader"), exports);
|
|
25
25
|
__exportStar(require("./components/TsMenuButton/TsMenuButton"), exports);
|
|
26
|
+
__exportStar(require("./components/TsModal/TsModal"), exports);
|
|
26
27
|
__exportStar(require("./components/TsSwitcher/TsSwitcher"), exports);
|
|
27
28
|
__exportStar(require("./components/TsTabs/TsTabs"), exports);
|
|
28
29
|
__exportStar(require("./components/TsTooltip/TsTooltip"), exports);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,qEAAmD;AACnD,iFAA+D;AAC/D,6FAA2E;AAC3E,6DAA2C;AAC3C,qFAAmE;AACnE,uEAAqD;AACrD,iEAA+C;AAC/C,yEAAuD;AACvD,qEAAmD;AACnD,6DAA2C;AAC3C,mEAAiD;AACjD,8DAA4C;AAC5C,qEAAmD;AACnD,sEAAoD;AACpD,0EAAwD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,qEAAmD;AACnD,iFAA+D;AAC/D,6FAA2E;AAC3E,6DAA2C;AAC3C,qFAAmE;AACnE,uEAAqD;AACrD,iEAA+C;AAC/C,yEAAuD;AACvD,+DAA6C;AAC7C,qEAAmD;AACnD,6DAA2C;AAC3C,mEAAiD;AACjD,8DAA4C;AAC5C,qEAAmD;AACnD,sEAAoD;AACpD,0EAAwD"}
|
package/package.json
CHANGED
|
@@ -44,6 +44,7 @@ export const TsMenuButton = ({ actions, buttonProps, menuAlignment }: TsMenuButt
|
|
|
44
44
|
className="ts-menu-item"
|
|
45
45
|
onClick={e => {
|
|
46
46
|
e.stopPropagation();
|
|
47
|
+
setShowMenu(false);
|
|
47
48
|
action.onClick && action.onClick(e);
|
|
48
49
|
}}
|
|
49
50
|
>
|
|
@@ -63,7 +64,10 @@ export const TsMenuButton = ({ actions, buttonProps, menuAlignment }: TsMenuButt
|
|
|
63
64
|
|
|
64
65
|
{/* Outside click layer */}
|
|
65
66
|
<div
|
|
66
|
-
onClick={
|
|
67
|
+
onClick={e => {
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
setShowMenu(false);
|
|
70
|
+
}}
|
|
67
71
|
style={{
|
|
68
72
|
position: 'fixed',
|
|
69
73
|
top: 0,
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.ts-modal-container {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
z-index: 500;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ts-modal-blur {
|
|
8
|
+
position: fixed;
|
|
9
|
+
inset: 0;
|
|
10
|
+
background: #4e5d6b;
|
|
11
|
+
opacity: 80%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ts-modal {
|
|
15
|
+
position: fixed;
|
|
16
|
+
top: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
bottom: 0;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
width: 485px;
|
|
22
|
+
padding: 40px 64px;
|
|
23
|
+
box-shadow: 0px 12px 9px 0px #10101012;
|
|
24
|
+
background: #ffffff;
|
|
25
|
+
z-index: 600;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ts-modal-header {
|
|
29
|
+
display: flex;
|
|
30
|
+
padding-bottom: 24px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ts-modal-title {
|
|
34
|
+
flex: 1;
|
|
35
|
+
font-weight: 600;
|
|
36
|
+
font-size: 24px;
|
|
37
|
+
line-height: 32px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ts-modal-content {
|
|
41
|
+
flex: 1;
|
|
42
|
+
padding: 16px 32px 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ts-modal-footer {
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
padding-top: 24px;
|
|
49
|
+
}
|
|
50
|
+
.ts-modal-footer > * {
|
|
51
|
+
margin-right: 16px;
|
|
52
|
+
}
|
|
53
|
+
.ts-modal-footer > *:last-child {
|
|
54
|
+
margin-right: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* ######### */
|
|
58
|
+
/* GLOBALS */
|
|
59
|
+
* {
|
|
60
|
+
font-size: 14px;
|
|
61
|
+
outline: none;
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
64
|
+
'Helvetica Neue', sans-serif;
|
|
65
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TsModalProps } from './TsModal.types';
|
|
3
|
+
import { TsButton } from '../TsButton/TsButton';
|
|
4
|
+
import './TsModal.css';
|
|
5
|
+
|
|
6
|
+
export const TsModal = ({ children, actionLabel, actionIcon, style, title, onAction, onClose }: TsModalProps) => {
|
|
7
|
+
// Rendering
|
|
8
|
+
return (
|
|
9
|
+
<div className="ts-modal-container">
|
|
10
|
+
<div className="ts-modal-blur" />
|
|
11
|
+
|
|
12
|
+
<div className="ts-modal" style={style}>
|
|
13
|
+
<div className="ts-modal-header">
|
|
14
|
+
<div className="ts-modal-title">{title}</div>
|
|
15
|
+
|
|
16
|
+
<TsButton icon="close" variant="ghost" rounded onClick={onClose} />
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div className="ts-modal-content">{children}</div>
|
|
20
|
+
|
|
21
|
+
<div className="ts-modal-footer">
|
|
22
|
+
<TsButton variant="secondary" onClick={onClose}>
|
|
23
|
+
Cancel
|
|
24
|
+
</TsButton>
|
|
25
|
+
<TsButton icon={actionIcon} variant="primary" onClick={onAction}>
|
|
26
|
+
{actionLabel}
|
|
27
|
+
</TsButton>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
+
import { TsModal } from '../TsModal';
|
|
4
|
+
import { icons } from '../../TsIcon/icons';
|
|
5
|
+
|
|
6
|
+
<Meta title="Components/Modal" />
|
|
7
|
+
|
|
8
|
+
export const modalArgTypes = {
|
|
9
|
+
actionIcon: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: Object.keys(icons),
|
|
12
|
+
description: 'Icon of the button.',
|
|
13
|
+
},
|
|
14
|
+
actionLabel: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Label of the modal action button.',
|
|
17
|
+
},
|
|
18
|
+
title: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Title of the modal.',
|
|
21
|
+
},
|
|
22
|
+
onCancel: {
|
|
23
|
+
control: 'function',
|
|
24
|
+
description: 'Handle action when canceling or closing the modal',
|
|
25
|
+
},
|
|
26
|
+
onAction: {
|
|
27
|
+
control: 'function',
|
|
28
|
+
description: 'Handle action when clicking on action button',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
# Modal
|
|
33
|
+
|
|
34
|
+
The Modal Component is the main Component of the Overlay pattern and is used to display a secondary window over the content. It can be used with or without an Illustration and adapts its content accordingly.
|
|
35
|
+
|
|
36
|
+
## Overview
|
|
37
|
+
|
|
38
|
+
<Canvas>
|
|
39
|
+
<Story
|
|
40
|
+
name="Overview"
|
|
41
|
+
args={{
|
|
42
|
+
title: 'New modal',
|
|
43
|
+
actionIcon: 'add',
|
|
44
|
+
actionLabel: 'Create',
|
|
45
|
+
onAction: () => console.log('Action !'),
|
|
46
|
+
onClose: () => console.log('Close !'),
|
|
47
|
+
}}
|
|
48
|
+
argTypes={modalArgTypes}
|
|
49
|
+
>
|
|
50
|
+
{args => (
|
|
51
|
+
<div style={{ height: '500px' }}>
|
|
52
|
+
<TsModal {...args}>{args.children}</TsModal>
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
55
|
+
</Story>
|
|
56
|
+
</Canvas>
|
|
57
|
+
|
|
58
|
+
## Props
|
|
59
|
+
|
|
60
|
+
<ArgsTable story="Overview" of={TsModal} />
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './components/TsInput/TsBooleanInput/TsBooleanInput';
|
|
|
7
7
|
export * from './components/TsInput/TsInput/TsInput';
|
|
8
8
|
export * from './components/TsLoader/TsLoader';
|
|
9
9
|
export * from './components/TsMenuButton/TsMenuButton';
|
|
10
|
+
export * from './components/TsModal/TsModal';
|
|
10
11
|
export * from './components/TsSwitcher/TsSwitcher';
|
|
11
12
|
export * from './components/TsTabs/TsTabs';
|
|
12
13
|
export * from './components/TsTooltip/TsTooltip';
|