@dktunited-techoff/techoff-suite-ui 1.9.6 → 1.10.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/TsTooltip/TsTooltip.css +59 -0
- package/esm/components/TsTooltip/TsTooltip.d.ts +5 -0
- package/esm/components/TsTooltip/TsTooltip.js +13 -0
- package/esm/components/TsTooltip/TsTooltip.js.map +1 -0
- package/esm/components/TsTooltip/TsTooltip.types.d.ts +4 -0
- package/esm/components/TsTooltip/TsTooltip.types.js +2 -0
- package/esm/components/TsTooltip/TsTooltip.types.js.map +1 -0
- package/esm/components/TsTooltip/__stories__/TsTooltip.stories.mdx +50 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/lib/components/TsTooltip/TsTooltip.css +59 -0
- package/lib/components/TsTooltip/TsTooltip.d.ts +5 -0
- package/lib/components/TsTooltip/TsTooltip.js +17 -0
- package/lib/components/TsTooltip/TsTooltip.js.map +1 -0
- package/lib/components/TsTooltip/TsTooltip.types.d.ts +4 -0
- package/lib/components/TsTooltip/TsTooltip.types.js +3 -0
- package/lib/components/TsTooltip/TsTooltip.types.js.map +1 -0
- package/lib/components/TsTooltip/__stories__/TsTooltip.stories.mdx +50 -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/TsTooltip/TsTooltip.css +59 -0
- package/src/components/TsTooltip/TsTooltip.tsx +19 -0
- package/src/components/TsTooltip/TsTooltip.types.ts +12 -0
- package/src/components/TsTooltip/__stories__/TsTooltip.stories.mdx +50 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.ts-tooltip {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 20px;
|
|
4
|
+
height: 20px;
|
|
5
|
+
color: #3643ba;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ts-tooltip-container {
|
|
9
|
+
position: absolute;
|
|
10
|
+
width: max-content;
|
|
11
|
+
max-width: 300px;
|
|
12
|
+
padding: 8px 10px;
|
|
13
|
+
box-shadow: 0px 8px 9px 0px #1010101a;
|
|
14
|
+
background: #f3f4fa;
|
|
15
|
+
white-space: normal;
|
|
16
|
+
z-index: 10;
|
|
17
|
+
}
|
|
18
|
+
.ts-tooltip-container--bottom-right {
|
|
19
|
+
top: 24px;
|
|
20
|
+
left: 0;
|
|
21
|
+
}
|
|
22
|
+
.ts-tooltip-container--bottom-left {
|
|
23
|
+
top: 24px;
|
|
24
|
+
right: 0;
|
|
25
|
+
}
|
|
26
|
+
.ts-tooltip-container--left-bottom {
|
|
27
|
+
top: 0;
|
|
28
|
+
right: 24px;
|
|
29
|
+
}
|
|
30
|
+
.ts-tooltip-container--left-top {
|
|
31
|
+
bottom: 0;
|
|
32
|
+
right: 24px;
|
|
33
|
+
}
|
|
34
|
+
.ts-tooltip-container--top-left {
|
|
35
|
+
bottom: 24px;
|
|
36
|
+
right: 0;
|
|
37
|
+
}
|
|
38
|
+
.ts-tooltip-container--top-right {
|
|
39
|
+
bottom: 24px;
|
|
40
|
+
left: 0;
|
|
41
|
+
}
|
|
42
|
+
.ts-tooltip-container--right-top {
|
|
43
|
+
bottom: 0;
|
|
44
|
+
left: 24px;
|
|
45
|
+
}
|
|
46
|
+
.ts-tooltip-container--right-bottom {
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 24px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* ######### */
|
|
52
|
+
/* GLOBALS */
|
|
53
|
+
* {
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
outline: none;
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
58
|
+
'Helvetica Neue', sans-serif;
|
|
59
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { TsTooltipProps } from './TsTooltip.types';
|
|
4
|
+
import './TsTooltip.css';
|
|
5
|
+
export declare const TsTooltip: ({ children, align, icon }: TsTooltipProps & PropsWithChildren) => React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { TsIcon } from '../TsIcon/TsIcon';
|
|
4
|
+
import './TsTooltip.css';
|
|
5
|
+
export const TsTooltip = ({ children, align, icon = 'information-circle' }) => {
|
|
6
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
7
|
+
// #########
|
|
8
|
+
// Rendering
|
|
9
|
+
return (React.createElement("div", { className: "ts-tooltip", onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false) },
|
|
10
|
+
React.createElement(TsIcon, { name: icon }),
|
|
11
|
+
showTooltip && React.createElement("div", { className: `ts-tooltip-container ts-tooltip-container--${align}` }, children)));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=TsTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsTooltip.js","sourceRoot":"","sources":["../../../src/components/TsTooltip/TsTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAqB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,GAAG,oBAAoB,EAAsC,EAAE,EAAE;IAChH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE/D,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAC,YAAY,EAAC,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC;QAC7G,oBAAC,MAAM,IAAC,IAAI,EAAE,IAAI,GAAI;QAErB,WAAW,IAAI,6BAAK,SAAS,EAAE,8CAA8C,KAAK,EAAE,IAAG,QAAQ,CAAO,CACnG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsTooltip.types.js","sourceRoot":"","sources":["../../../src/components/TsTooltip/TsTooltip.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
+
import { TsTooltip } from '../TsTooltip';
|
|
4
|
+
import { icons } from '../../TsIcon/icons';
|
|
5
|
+
|
|
6
|
+
<Meta title="Components/Tooltip" />
|
|
7
|
+
|
|
8
|
+
export const tooltipArgTypes = {
|
|
9
|
+
children: { control: 'text', description: 'Child of the tooltip.' },
|
|
10
|
+
icon: {
|
|
11
|
+
control: 'select',
|
|
12
|
+
options: Object.keys(icons),
|
|
13
|
+
description: 'Icon of the tooltip.',
|
|
14
|
+
table: { defaultValue: { summary: 'information-circle' } },
|
|
15
|
+
},
|
|
16
|
+
align: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: [
|
|
19
|
+
'top-left',
|
|
20
|
+
'top-right',
|
|
21
|
+
'bottom-left',
|
|
22
|
+
'bottom-right',
|
|
23
|
+
'left-bottom',
|
|
24
|
+
'left-top',
|
|
25
|
+
'right-bottom',
|
|
26
|
+
'right-top',
|
|
27
|
+
],
|
|
28
|
+
description: 'Define the align of the content.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
# Tooltip
|
|
33
|
+
|
|
34
|
+
Tooltip show a complementary information that will help the user better understand what he sees / reads (e.g. definition, explication concerning the UI / wording).
|
|
35
|
+
|
|
36
|
+
## Overview
|
|
37
|
+
|
|
38
|
+
<Canvas>
|
|
39
|
+
<Story name="Overview" args={{ children: 'This is a tooltip', align: 'bottom-right' }} argTypes={tooltipArgTypes}>
|
|
40
|
+
{args => (
|
|
41
|
+
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '250px' }}>
|
|
42
|
+
<TsTooltip {...args}>{args.children}</TsTooltip>
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
</Story>
|
|
46
|
+
</Canvas>
|
|
47
|
+
|
|
48
|
+
## Props
|
|
49
|
+
|
|
50
|
+
<ArgsTable story="Overview" of={TsTooltip} />
|
package/esm/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './components/TsInput/TsInput/TsInput';
|
|
|
8
8
|
export * from './components/TsLoader/TsLoader';
|
|
9
9
|
export * from './components/TsSwitcher/TsSwitcher';
|
|
10
10
|
export * from './components/TsTabs/TsTabs';
|
|
11
|
+
export * from './components/TsTooltip/TsTooltip';
|
|
11
12
|
export * from './layouts/TsHeader/TsHeader';
|
|
12
13
|
export * from './layouts/TsHeader/TsHeaderProfile';
|
|
13
14
|
export * from './layouts/TsNavigation/TsNavigation';
|
package/esm/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from './components/TsInput/TsInput/TsInput';
|
|
|
8
8
|
export * from './components/TsLoader/TsLoader';
|
|
9
9
|
export * from './components/TsSwitcher/TsSwitcher';
|
|
10
10
|
export * from './components/TsTabs/TsTabs';
|
|
11
|
+
export * from './components/TsTooltip/TsTooltip';
|
|
11
12
|
export * from './layouts/TsHeader/TsHeader';
|
|
12
13
|
export * from './layouts/TsHeader/TsHeaderProfile';
|
|
13
14
|
export * from './layouts/TsNavigation/TsNavigation';
|
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,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,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,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.ts-tooltip {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 20px;
|
|
4
|
+
height: 20px;
|
|
5
|
+
color: #3643ba;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ts-tooltip-container {
|
|
9
|
+
position: absolute;
|
|
10
|
+
width: max-content;
|
|
11
|
+
max-width: 300px;
|
|
12
|
+
padding: 8px 10px;
|
|
13
|
+
box-shadow: 0px 8px 9px 0px #1010101a;
|
|
14
|
+
background: #f3f4fa;
|
|
15
|
+
white-space: normal;
|
|
16
|
+
z-index: 10;
|
|
17
|
+
}
|
|
18
|
+
.ts-tooltip-container--bottom-right {
|
|
19
|
+
top: 24px;
|
|
20
|
+
left: 0;
|
|
21
|
+
}
|
|
22
|
+
.ts-tooltip-container--bottom-left {
|
|
23
|
+
top: 24px;
|
|
24
|
+
right: 0;
|
|
25
|
+
}
|
|
26
|
+
.ts-tooltip-container--left-bottom {
|
|
27
|
+
top: 0;
|
|
28
|
+
right: 24px;
|
|
29
|
+
}
|
|
30
|
+
.ts-tooltip-container--left-top {
|
|
31
|
+
bottom: 0;
|
|
32
|
+
right: 24px;
|
|
33
|
+
}
|
|
34
|
+
.ts-tooltip-container--top-left {
|
|
35
|
+
bottom: 24px;
|
|
36
|
+
right: 0;
|
|
37
|
+
}
|
|
38
|
+
.ts-tooltip-container--top-right {
|
|
39
|
+
bottom: 24px;
|
|
40
|
+
left: 0;
|
|
41
|
+
}
|
|
42
|
+
.ts-tooltip-container--right-top {
|
|
43
|
+
bottom: 0;
|
|
44
|
+
left: 24px;
|
|
45
|
+
}
|
|
46
|
+
.ts-tooltip-container--right-bottom {
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 24px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* ######### */
|
|
52
|
+
/* GLOBALS */
|
|
53
|
+
* {
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
outline: none;
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
58
|
+
'Helvetica Neue', sans-serif;
|
|
59
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { TsTooltipProps } from './TsTooltip.types';
|
|
4
|
+
import './TsTooltip.css';
|
|
5
|
+
export declare const TsTooltip: ({ children, align, icon }: TsTooltipProps & PropsWithChildren) => React.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TsTooltip = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const TsIcon_1 = require("../TsIcon/TsIcon");
|
|
7
|
+
require("./TsTooltip.css");
|
|
8
|
+
const TsTooltip = ({ children, align, icon = 'information-circle' }) => {
|
|
9
|
+
const [showTooltip, setShowTooltip] = (0, react_1.useState)(false);
|
|
10
|
+
// #########
|
|
11
|
+
// Rendering
|
|
12
|
+
return (React.createElement("div", { className: "ts-tooltip", onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false) },
|
|
13
|
+
React.createElement(TsIcon_1.TsIcon, { name: icon }),
|
|
14
|
+
showTooltip && React.createElement("div", { className: `ts-tooltip-container ts-tooltip-container--${align}` }, children)));
|
|
15
|
+
};
|
|
16
|
+
exports.TsTooltip = TsTooltip;
|
|
17
|
+
//# sourceMappingURL=TsTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsTooltip.js","sourceRoot":"","sources":["../../../src/components/TsTooltip/TsTooltip.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,iCAAoD;AAEpD,6CAA0C;AAC1C,2BAAyB;AAElB,MAAM,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,GAAG,oBAAoB,EAAsC,EAAE,EAAE;IAChH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IAE/D,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAC,YAAY,EAAC,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC;QAC7G,oBAAC,eAAM,IAAC,IAAI,EAAE,IAAI,GAAI;QAErB,WAAW,IAAI,6BAAK,SAAS,EAAE,8CAA8C,KAAK,EAAE,IAAG,QAAQ,CAAO,CACnG,CACP,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,SAAS,aAYpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsTooltip.types.js","sourceRoot":"","sources":["../../../src/components/TsTooltip/TsTooltip.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
+
import { TsTooltip } from '../TsTooltip';
|
|
4
|
+
import { icons } from '../../TsIcon/icons';
|
|
5
|
+
|
|
6
|
+
<Meta title="Components/Tooltip" />
|
|
7
|
+
|
|
8
|
+
export const tooltipArgTypes = {
|
|
9
|
+
children: { control: 'text', description: 'Child of the tooltip.' },
|
|
10
|
+
icon: {
|
|
11
|
+
control: 'select',
|
|
12
|
+
options: Object.keys(icons),
|
|
13
|
+
description: 'Icon of the tooltip.',
|
|
14
|
+
table: { defaultValue: { summary: 'information-circle' } },
|
|
15
|
+
},
|
|
16
|
+
align: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: [
|
|
19
|
+
'top-left',
|
|
20
|
+
'top-right',
|
|
21
|
+
'bottom-left',
|
|
22
|
+
'bottom-right',
|
|
23
|
+
'left-bottom',
|
|
24
|
+
'left-top',
|
|
25
|
+
'right-bottom',
|
|
26
|
+
'right-top',
|
|
27
|
+
],
|
|
28
|
+
description: 'Define the align of the content.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
# Tooltip
|
|
33
|
+
|
|
34
|
+
Tooltip show a complementary information that will help the user better understand what he sees / reads (e.g. definition, explication concerning the UI / wording).
|
|
35
|
+
|
|
36
|
+
## Overview
|
|
37
|
+
|
|
38
|
+
<Canvas>
|
|
39
|
+
<Story name="Overview" args={{ children: 'This is a tooltip', align: 'bottom-right' }} argTypes={tooltipArgTypes}>
|
|
40
|
+
{args => (
|
|
41
|
+
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '250px' }}>
|
|
42
|
+
<TsTooltip {...args}>{args.children}</TsTooltip>
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
</Story>
|
|
46
|
+
</Canvas>
|
|
47
|
+
|
|
48
|
+
## Props
|
|
49
|
+
|
|
50
|
+
<ArgsTable story="Overview" of={TsTooltip} />
|
package/lib/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './components/TsInput/TsInput/TsInput';
|
|
|
8
8
|
export * from './components/TsLoader/TsLoader';
|
|
9
9
|
export * from './components/TsSwitcher/TsSwitcher';
|
|
10
10
|
export * from './components/TsTabs/TsTabs';
|
|
11
|
+
export * from './components/TsTooltip/TsTooltip';
|
|
11
12
|
export * from './layouts/TsHeader/TsHeader';
|
|
12
13
|
export * from './layouts/TsHeader/TsHeaderProfile';
|
|
13
14
|
export * from './layouts/TsNavigation/TsNavigation';
|
package/lib/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __exportStar(require("./components/TsInput/TsInput/TsInput"), exports);
|
|
|
24
24
|
__exportStar(require("./components/TsLoader/TsLoader"), exports);
|
|
25
25
|
__exportStar(require("./components/TsSwitcher/TsSwitcher"), exports);
|
|
26
26
|
__exportStar(require("./components/TsTabs/TsTabs"), exports);
|
|
27
|
+
__exportStar(require("./components/TsTooltip/TsTooltip"), exports);
|
|
27
28
|
__exportStar(require("./layouts/TsHeader/TsHeader"), exports);
|
|
28
29
|
__exportStar(require("./layouts/TsHeader/TsHeaderProfile"), exports);
|
|
29
30
|
__exportStar(require("./layouts/TsNavigation/TsNavigation"), 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,qEAAmD;AACnD,6DAA2C;AAC3C,8DAA4C;AAC5C,qEAAmD;AACnD,sEAAoD"}
|
|
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,qEAAmD;AACnD,6DAA2C;AAC3C,mEAAiD;AACjD,8DAA4C;AAC5C,qEAAmD;AACnD,sEAAoD"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.ts-tooltip {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 20px;
|
|
4
|
+
height: 20px;
|
|
5
|
+
color: #3643ba;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ts-tooltip-container {
|
|
9
|
+
position: absolute;
|
|
10
|
+
width: max-content;
|
|
11
|
+
max-width: 300px;
|
|
12
|
+
padding: 8px 10px;
|
|
13
|
+
box-shadow: 0px 8px 9px 0px #1010101a;
|
|
14
|
+
background: #f3f4fa;
|
|
15
|
+
white-space: normal;
|
|
16
|
+
z-index: 10;
|
|
17
|
+
}
|
|
18
|
+
.ts-tooltip-container--bottom-right {
|
|
19
|
+
top: 24px;
|
|
20
|
+
left: 0;
|
|
21
|
+
}
|
|
22
|
+
.ts-tooltip-container--bottom-left {
|
|
23
|
+
top: 24px;
|
|
24
|
+
right: 0;
|
|
25
|
+
}
|
|
26
|
+
.ts-tooltip-container--left-bottom {
|
|
27
|
+
top: 0;
|
|
28
|
+
right: 24px;
|
|
29
|
+
}
|
|
30
|
+
.ts-tooltip-container--left-top {
|
|
31
|
+
bottom: 0;
|
|
32
|
+
right: 24px;
|
|
33
|
+
}
|
|
34
|
+
.ts-tooltip-container--top-left {
|
|
35
|
+
bottom: 24px;
|
|
36
|
+
right: 0;
|
|
37
|
+
}
|
|
38
|
+
.ts-tooltip-container--top-right {
|
|
39
|
+
bottom: 24px;
|
|
40
|
+
left: 0;
|
|
41
|
+
}
|
|
42
|
+
.ts-tooltip-container--right-top {
|
|
43
|
+
bottom: 0;
|
|
44
|
+
left: 24px;
|
|
45
|
+
}
|
|
46
|
+
.ts-tooltip-container--right-bottom {
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 24px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* ######### */
|
|
52
|
+
/* GLOBALS */
|
|
53
|
+
* {
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
outline: none;
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
58
|
+
'Helvetica Neue', sans-serif;
|
|
59
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsWithChildren, useState } from 'react';
|
|
3
|
+
import { TsTooltipProps } from './TsTooltip.types';
|
|
4
|
+
import { TsIcon } from '../TsIcon/TsIcon';
|
|
5
|
+
import './TsTooltip.css';
|
|
6
|
+
|
|
7
|
+
export const TsTooltip = ({ children, align, icon = 'information-circle' }: TsTooltipProps & PropsWithChildren) => {
|
|
8
|
+
const [showTooltip, setShowTooltip] = useState<boolean>(false);
|
|
9
|
+
|
|
10
|
+
// #########
|
|
11
|
+
// Rendering
|
|
12
|
+
return (
|
|
13
|
+
<div className="ts-tooltip" onMouseEnter={() => setShowTooltip(true)} onMouseLeave={() => setShowTooltip(false)}>
|
|
14
|
+
<TsIcon name={icon} />
|
|
15
|
+
|
|
16
|
+
{showTooltip && <div className={`ts-tooltip-container ts-tooltip-container--${align}`}>{children}</div>}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
+
import { TsTooltip } from '../TsTooltip';
|
|
4
|
+
import { icons } from '../../TsIcon/icons';
|
|
5
|
+
|
|
6
|
+
<Meta title="Components/Tooltip" />
|
|
7
|
+
|
|
8
|
+
export const tooltipArgTypes = {
|
|
9
|
+
children: { control: 'text', description: 'Child of the tooltip.' },
|
|
10
|
+
icon: {
|
|
11
|
+
control: 'select',
|
|
12
|
+
options: Object.keys(icons),
|
|
13
|
+
description: 'Icon of the tooltip.',
|
|
14
|
+
table: { defaultValue: { summary: 'information-circle' } },
|
|
15
|
+
},
|
|
16
|
+
align: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: [
|
|
19
|
+
'top-left',
|
|
20
|
+
'top-right',
|
|
21
|
+
'bottom-left',
|
|
22
|
+
'bottom-right',
|
|
23
|
+
'left-bottom',
|
|
24
|
+
'left-top',
|
|
25
|
+
'right-bottom',
|
|
26
|
+
'right-top',
|
|
27
|
+
],
|
|
28
|
+
description: 'Define the align of the content.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
# Tooltip
|
|
33
|
+
|
|
34
|
+
Tooltip show a complementary information that will help the user better understand what he sees / reads (e.g. definition, explication concerning the UI / wording).
|
|
35
|
+
|
|
36
|
+
## Overview
|
|
37
|
+
|
|
38
|
+
<Canvas>
|
|
39
|
+
<Story name="Overview" args={{ children: 'This is a tooltip', align: 'bottom-right' }} argTypes={tooltipArgTypes}>
|
|
40
|
+
{args => (
|
|
41
|
+
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '250px' }}>
|
|
42
|
+
<TsTooltip {...args}>{args.children}</TsTooltip>
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
</Story>
|
|
46
|
+
</Canvas>
|
|
47
|
+
|
|
48
|
+
## Props
|
|
49
|
+
|
|
50
|
+
<ArgsTable story="Overview" of={TsTooltip} />
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './components/TsInput/TsInput/TsInput';
|
|
|
8
8
|
export * from './components/TsLoader/TsLoader';
|
|
9
9
|
export * from './components/TsSwitcher/TsSwitcher';
|
|
10
10
|
export * from './components/TsTabs/TsTabs';
|
|
11
|
+
export * from './components/TsTooltip/TsTooltip';
|
|
11
12
|
export * from './layouts/TsHeader/TsHeader';
|
|
12
13
|
export * from './layouts/TsHeader/TsHeaderProfile';
|
|
13
14
|
export * from './layouts/TsNavigation/TsNavigation';
|