@dktunited-techoff/techoff-suite-ui 1.13.11 → 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.
@@ -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,4 @@
1
+ import * as React from 'react';
2
+ import { TsModalProps } from './TsModal.types';
3
+ import './TsModal.css';
4
+ export declare const TsModal: ({ children, actionLabel, actionIcon, style, title, onAction, onClose }: TsModalProps) => React.JSX.Element;
@@ -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,9 @@
1
+ import { CSSProperties, PropsWithChildren } from 'react';
2
+ export type TsModalProps = {
3
+ actionLabel: string;
4
+ actionIcon?: string;
5
+ style?: CSSProperties;
6
+ title: string;
7
+ onAction: () => void;
8
+ onClose?: () => void;
9
+ } & PropsWithChildren;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TsModal.types.js.map
@@ -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"}
@@ -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,4 @@
1
+ import * as React from 'react';
2
+ import { TsModalProps } from './TsModal.types';
3
+ import './TsModal.css';
4
+ export declare const TsModal: ({ children, actionLabel, actionIcon, style, title, onAction, onClose }: TsModalProps) => React.JSX.Element;
@@ -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,9 @@
1
+ import { CSSProperties, PropsWithChildren } from 'react';
2
+ export type TsModalProps = {
3
+ actionLabel: string;
4
+ actionIcon?: string;
5
+ style?: CSSProperties;
6
+ title: string;
7
+ onAction: () => void;
8
+ onClose?: () => void;
9
+ } & PropsWithChildren;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=TsModal.types.js.map
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dktunited-techoff/techoff-suite-ui",
3
- "version": "1.13.11",
3
+ "version": "1.14.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib",
6
6
  "module": "esm/index.js",
@@ -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,10 @@
1
+ import { CSSProperties, PropsWithChildren } from 'react';
2
+
3
+ export type TsModalProps = {
4
+ actionLabel: string;
5
+ actionIcon?: string;
6
+ style?: CSSProperties;
7
+ title: string;
8
+ onAction: () => void;
9
+ onClose?: () => void;
10
+ } & PropsWithChildren;
@@ -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';