@indico-data/design-system 1.0.55 → 1.0.57
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/.yarn/sdks/prettier/package.json +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +15 -0
- package/lib/components/Tooltip/Tooltip.stories.d.ts +9 -0
- package/lib/components/Tooltip/Tooltip.styles.d.ts +2 -0
- package/lib/components/Tooltip/index.d.ts +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/inputs/RadioButtons/RadioButtons.styles.d.ts +1 -1
- package/lib/components/text-truncate/TextTruncate.d.ts +2 -1
- package/lib/index.d.ts +160 -60
- package/lib/index.esm.js +2030 -213
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +2032 -211
- package/lib/index.js.map +1 -1
- package/package.json +32 -31
- package/src/components/Tooltip/Tooltip.stories.tsx +107 -0
- package/src/components/Tooltip/Tooltip.styles.ts +76 -0
- package/src/components/Tooltip/Tooltip.tsx +71 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Wizard/Wizard.stories.tsx +1 -1
- package/src/components/index.ts +3 -0
- package/src/components/text-truncate/TextTruncate.tsx +3 -2
- package/src/index.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indico-data/design-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -24,29 +24,30 @@
|
|
|
24
24
|
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
|
25
25
|
"@indico-data/utils": "^0.0.5",
|
|
26
26
|
"@popperjs/core": "^2.11.8",
|
|
27
|
-
"@react-aria/radio": "^3.10.
|
|
28
|
-
"@react-aria/visually-hidden": "^3.8.
|
|
29
|
-
"@react-types/button": "^3.9.
|
|
30
|
-
"@react-types/checkbox": "^3.
|
|
31
|
-
"@react-types/radio": "^3.7.
|
|
27
|
+
"@react-aria/radio": "^3.10.2",
|
|
28
|
+
"@react-aria/visually-hidden": "^3.8.10",
|
|
29
|
+
"@react-types/button": "^3.9.2",
|
|
30
|
+
"@react-types/checkbox": "^3.7.1",
|
|
31
|
+
"@react-types/radio": "^3.7.1",
|
|
32
32
|
"classnames": "^2.5.1",
|
|
33
33
|
"date-fns": "^3.3.1",
|
|
34
34
|
"focus-trap-react": "^10.2.3",
|
|
35
35
|
"html-webpack-plugin": "^5.6.0",
|
|
36
36
|
"prop-types": "^15.8.1",
|
|
37
|
-
"react-aria-components": "^1.
|
|
37
|
+
"react-aria-components": "^1.1.1",
|
|
38
38
|
"react-day-picker": "^8.10.0",
|
|
39
39
|
"react-modal": "^3.16.1",
|
|
40
40
|
"react-popper": "^2.3.0",
|
|
41
|
-
"react-stately": "^3.
|
|
41
|
+
"react-stately": "^3.30.1",
|
|
42
|
+
"react-tooltip": "5.26.3",
|
|
42
43
|
"simple-zustand-devtools": "^1.1.0",
|
|
43
44
|
"svgo": "^3.2.0",
|
|
44
45
|
"ts-jest": "^29.1.2",
|
|
45
46
|
"tslib": "^2.6.2",
|
|
46
47
|
"uuid": "^9.0.1",
|
|
47
|
-
"webpack": "^5.90.
|
|
48
|
+
"webpack": "^5.90.3",
|
|
48
49
|
"webpack-cli": "^5.1.4",
|
|
49
|
-
"webpack-dev-server": "^
|
|
50
|
+
"webpack-dev-server": "^5.0.2"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@babel/core": "^7.23.9",
|
|
@@ -54,40 +55,40 @@
|
|
|
54
55
|
"@babel/preset-env": "^7.23.9",
|
|
55
56
|
"@babel/preset-react": "^7.23.3",
|
|
56
57
|
"@babel/preset-typescript": "^7.23.3",
|
|
57
|
-
"@react-aria/button": "^3.9.
|
|
58
|
-
"@react-aria/focus": "^3.16.
|
|
58
|
+
"@react-aria/button": "^3.9.3",
|
|
59
|
+
"@react-aria/focus": "^3.16.2",
|
|
59
60
|
"@rollup/plugin-babel": "^6.0.4",
|
|
60
61
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
61
62
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
62
63
|
"@rollup/plugin-terser": "^0.4.4",
|
|
63
64
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
64
|
-
"@storybook/addon-a11y": "^7.6.
|
|
65
|
-
"@storybook/addon-docs": "^7.6.
|
|
66
|
-
"@storybook/addon-essentials": "^7.6.
|
|
67
|
-
"@storybook/addon-interactions": "^7.6.
|
|
68
|
-
"@storybook/addon-links": "^7.6.
|
|
65
|
+
"@storybook/addon-a11y": "^7.6.17",
|
|
66
|
+
"@storybook/addon-docs": "^7.6.17",
|
|
67
|
+
"@storybook/addon-essentials": "^7.6.17",
|
|
68
|
+
"@storybook/addon-interactions": "^7.6.17",
|
|
69
|
+
"@storybook/addon-links": "^7.6.17",
|
|
69
70
|
"@storybook/addon-onboarding": "^1.0.11",
|
|
70
71
|
"@storybook/addon-styling": "^1.3.7",
|
|
71
72
|
"@storybook/addon-styling-webpack": "^0.0.6",
|
|
72
|
-
"@storybook/addon-themes": "^7.6.
|
|
73
|
-
"@storybook/blocks": "^7.6.
|
|
74
|
-
"@storybook/react": "^7.6.
|
|
75
|
-
"@storybook/react-webpack5": "^7.6.
|
|
76
|
-
"@storybook/test": "^7.6.
|
|
73
|
+
"@storybook/addon-themes": "^7.6.17",
|
|
74
|
+
"@storybook/blocks": "^7.6.17",
|
|
75
|
+
"@storybook/react": "^7.6.17",
|
|
76
|
+
"@storybook/react-webpack5": "^7.6.17",
|
|
77
|
+
"@storybook/test": "^7.6.17",
|
|
77
78
|
"@storybook/test-runner": "^0.16.0",
|
|
78
79
|
"@testing-library/dom": "^9.3.4",
|
|
79
80
|
"@testing-library/jest-dom": "^6.4.2",
|
|
80
81
|
"@testing-library/react": "^14.2.1",
|
|
81
82
|
"@testing-library/user-event": "^14.5.2",
|
|
82
83
|
"@types/jest": "^29.5.12",
|
|
83
|
-
"@types/prop-types": "^15",
|
|
84
|
-
"@types/react": "^18.2.
|
|
85
|
-
"@types/react-dom": "^18.2.
|
|
84
|
+
"@types/prop-types": "^15.7.11",
|
|
85
|
+
"@types/react": "^18.2.57",
|
|
86
|
+
"@types/react-dom": "^18.2.19",
|
|
86
87
|
"@types/react-modal": "^3.16.3",
|
|
87
88
|
"@types/styled-components": "^5.1.34",
|
|
88
89
|
"@types/uuid": "^9.0.8",
|
|
89
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
90
|
-
"@typescript-eslint/parser": "^
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
|
91
|
+
"@typescript-eslint/parser": "^7.0.2",
|
|
91
92
|
"babel-loader": "^9.1.3",
|
|
92
93
|
"babel-plugin-styled-components": "^2.1.4",
|
|
93
94
|
"babel-preset-react-app": "^10.0.1",
|
|
@@ -97,17 +98,17 @@
|
|
|
97
98
|
"jest": "^29.7.0",
|
|
98
99
|
"jest-environment-jsdom": "^29.7.0",
|
|
99
100
|
"lint-staged": "^15.2.2",
|
|
100
|
-
"postcss": "^8.4.
|
|
101
|
+
"postcss": "^8.4.35",
|
|
101
102
|
"prettier": "3.2.5",
|
|
102
103
|
"react": "^18.2.0",
|
|
103
104
|
"react-dom": "^18.2.0",
|
|
104
|
-
"react-router-dom": "^6.22.
|
|
105
|
+
"react-router-dom": "^6.22.1",
|
|
105
106
|
"react-select": "^5.8.0",
|
|
106
|
-
"rollup": "^4.
|
|
107
|
+
"rollup": "^4.12.0",
|
|
107
108
|
"rollup-plugin-dts": "^6.1.0",
|
|
108
109
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
109
110
|
"rollup-plugin-postcss": "^4.0.2",
|
|
110
|
-
"storybook": "^7.6.
|
|
111
|
+
"storybook": "^7.6.17",
|
|
111
112
|
"styled-components": "^6.1.8",
|
|
112
113
|
"ts-loader": "^9.5.1",
|
|
113
114
|
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { Tooltip } from './Tooltip';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Tooltip> = {
|
|
7
|
+
component: Tooltip,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
title: 'Tooltip',
|
|
10
|
+
args: {},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof Tooltip>;
|
|
15
|
+
|
|
16
|
+
function RenderQuestionMark(props: any) {
|
|
17
|
+
return (
|
|
18
|
+
<div style={{ height: '500px' }}>
|
|
19
|
+
<Tooltip for="example-tooltip" {...props}>
|
|
20
|
+
This is a paragraph
|
|
21
|
+
</Tooltip>
|
|
22
|
+
|
|
23
|
+
<p data-tip data-for="example-tooltip">
|
|
24
|
+
Hover on text to see tooltip
|
|
25
|
+
</p>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function RenderNoQuestionMark(props: any) {
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Tooltip for="example-tooltip">
|
|
34
|
+
<p>This is a paragraph</p>
|
|
35
|
+
</Tooltip>
|
|
36
|
+
|
|
37
|
+
<p
|
|
38
|
+
data-tooltip-id="example-tooltip"
|
|
39
|
+
data-tooltip-place={props.place}
|
|
40
|
+
style={{ display: 'inline-block', marginTop: '100px' }}
|
|
41
|
+
>
|
|
42
|
+
Hover on text to see tooltip
|
|
43
|
+
</p>
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const Single: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
questionMark: true,
|
|
51
|
+
for: 'example-tooltip',
|
|
52
|
+
place: 'top',
|
|
53
|
+
clickToShow: false,
|
|
54
|
+
delayHide: 0,
|
|
55
|
+
questionMarkClassName: 'question-mark',
|
|
56
|
+
children: 'This is a paragraph',
|
|
57
|
+
block: false,
|
|
58
|
+
},
|
|
59
|
+
render: (args) => {
|
|
60
|
+
return <RenderQuestionMark {...args} />;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const NoQuestionMark: Story = {
|
|
65
|
+
args: {
|
|
66
|
+
questionMark: false,
|
|
67
|
+
for: 'example-tooltip',
|
|
68
|
+
place: 'top',
|
|
69
|
+
clickToShow: false,
|
|
70
|
+
delayHide: 0,
|
|
71
|
+
children: 'This is a paragraph',
|
|
72
|
+
block: false,
|
|
73
|
+
},
|
|
74
|
+
render: (args) => {
|
|
75
|
+
return <RenderNoQuestionMark {...args} />;
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const Bottom: Story = {
|
|
80
|
+
args: {
|
|
81
|
+
questionMark: false,
|
|
82
|
+
for: 'example-tooltip',
|
|
83
|
+
place: 'bottom',
|
|
84
|
+
clickToShow: false,
|
|
85
|
+
delayHide: 0,
|
|
86
|
+
children: 'This is a paragraph',
|
|
87
|
+
block: false,
|
|
88
|
+
},
|
|
89
|
+
render: (args) => {
|
|
90
|
+
return <RenderNoQuestionMark {...args} />;
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const Right: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
questionMark: false,
|
|
97
|
+
for: 'example-tooltip',
|
|
98
|
+
place: 'right',
|
|
99
|
+
clickToShow: false,
|
|
100
|
+
delayHide: 0,
|
|
101
|
+
children: 'This is a paragraph',
|
|
102
|
+
block: false,
|
|
103
|
+
},
|
|
104
|
+
render: (args) => {
|
|
105
|
+
return <RenderNoQuestionMark {...args} />;
|
|
106
|
+
},
|
|
107
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { COLORS } from '@/index';
|
|
4
|
+
|
|
5
|
+
export const StyledTooltip = styled.div`
|
|
6
|
+
display: inline-block;
|
|
7
|
+
|
|
8
|
+
i:hover {
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
p {
|
|
13
|
+
line-height: 1.4;
|
|
14
|
+
font-size: 13px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tool {
|
|
18
|
+
background: ${COLORS.oxfordBlue} !important;
|
|
19
|
+
border: 1px solid ${COLORS.baliHai} !important;
|
|
20
|
+
border-radius: 2px !important;
|
|
21
|
+
padding: 8px 11px !important;
|
|
22
|
+
opacity: 1 !important;
|
|
23
|
+
|
|
24
|
+
&.place-left:after {
|
|
25
|
+
border-left-color: ${COLORS.oxfordBlue} !important;
|
|
26
|
+
border-top: 5px solid transparent !important;
|
|
27
|
+
border-bottom: 5px solid transparent !important;
|
|
28
|
+
right: -6px !important;
|
|
29
|
+
top: 50% !important;
|
|
30
|
+
margin-top: -9px !important;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.place-left:before {
|
|
34
|
+
border-left-color: ${COLORS.baliHai} !important;
|
|
35
|
+
border-left-width: 8px !important;
|
|
36
|
+
border-left-style: solid !important;
|
|
37
|
+
margin-top: -10px !important;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.place-right:after {
|
|
41
|
+
border-right-color: ${COLORS.oxfordBlue} !important;
|
|
42
|
+
border-top: 5px solid transparent !important;
|
|
43
|
+
border-bottom: 5px solid transparent !important;
|
|
44
|
+
left: -6px !important;
|
|
45
|
+
top: 50% !important;
|
|
46
|
+
margin-top: -9px !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.place-right:before {
|
|
50
|
+
border-right-color: ${COLORS.baliHai} !important;
|
|
51
|
+
border-right-width: 8px !important;
|
|
52
|
+
border-right-style: solid !important;
|
|
53
|
+
margin-top: -10px !important;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.place-top:after {
|
|
57
|
+
border-top-color: ${COLORS.oxfordBlue} !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.place-top:before {
|
|
61
|
+
border-top-color: ${COLORS.baliHai} !important;
|
|
62
|
+
border-top-width: 8px !important;
|
|
63
|
+
border-top-style: solid !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.place-bottom:after {
|
|
67
|
+
border-bottom-color: ${COLORS.oxfordBlue} !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&.place-bottom:before {
|
|
71
|
+
border-bottom-color: ${COLORS.baliHai} !important;
|
|
72
|
+
border-bottom-width: 8px !important;
|
|
73
|
+
border-bottom-style: solid !important;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// TODO: This component's migration was fast-tracked for Insights. Assess for potential refactor and documentation.
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { Icon, COLORS } from '@/index';
|
|
6
|
+
import { PermafrostComponent } from '@/types';
|
|
7
|
+
import { Tooltip as ReactTooltip } from 'react-tooltip';
|
|
8
|
+
|
|
9
|
+
import { StyledTooltip } from './Tooltip.styles';
|
|
10
|
+
|
|
11
|
+
enum PlacesType {
|
|
12
|
+
top = 'top',
|
|
13
|
+
'top-start' = 'top-start',
|
|
14
|
+
'top-end' = 'top-end',
|
|
15
|
+
right = 'right',
|
|
16
|
+
'right-start' = 'right-start',
|
|
17
|
+
'right-end' = 'right-end',
|
|
18
|
+
bottom = 'bottom',
|
|
19
|
+
'bottom-start' = 'bottom-start',
|
|
20
|
+
'bottom-end' = 'bottom-end',
|
|
21
|
+
left = 'left',
|
|
22
|
+
'left-start' = 'left-start',
|
|
23
|
+
'left-end' = 'left-end',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type Props = PermafrostComponent & {
|
|
27
|
+
questionMark?: boolean;
|
|
28
|
+
for?: string | null;
|
|
29
|
+
place?: string;
|
|
30
|
+
clickToShow?: boolean;
|
|
31
|
+
delayShow?: number;
|
|
32
|
+
delayHide?: number;
|
|
33
|
+
questionMarkClassName?: string;
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
block?: boolean;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Tooltip = (props: Props) => {
|
|
39
|
+
return (
|
|
40
|
+
<StyledTooltip
|
|
41
|
+
className={props.className}
|
|
42
|
+
data-cy={props['data-cy']}
|
|
43
|
+
id={props.id}
|
|
44
|
+
// this was done in a hurry, consider refactor on next pass.
|
|
45
|
+
style={{ display: props.block ? 'block' : 'inline-block' }}
|
|
46
|
+
>
|
|
47
|
+
{props.questionMark && (
|
|
48
|
+
<i
|
|
49
|
+
style={{ color: COLORS.curiousBlue }}
|
|
50
|
+
className={props.questionMarkClassName}
|
|
51
|
+
// data-tip={props.clickToShow ? 'custom show' : ''}
|
|
52
|
+
data-tooltip-id={props.for as string | undefined}
|
|
53
|
+
data-tooltip-place={(props.place as PlacesType) || 'top'}
|
|
54
|
+
>
|
|
55
|
+
<Icon name="fa-question-circle" />
|
|
56
|
+
</i>
|
|
57
|
+
)}
|
|
58
|
+
<ReactTooltip
|
|
59
|
+
className="tool"
|
|
60
|
+
// globalEventOff={props.clickToShow ? 'click' : ''}
|
|
61
|
+
// place={(props.place as PlacesType) || 'top'}
|
|
62
|
+
openOnClick={props.clickToShow}
|
|
63
|
+
id={props.for as string | undefined}
|
|
64
|
+
delayShow={props.delayShow}
|
|
65
|
+
delayHide={props.delayHide}
|
|
66
|
+
>
|
|
67
|
+
{props.children}
|
|
68
|
+
</ReactTooltip>
|
|
69
|
+
</StyledTooltip>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tooltip } from './Tooltip';
|
package/src/components/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Tooltip } from 'react-aria-components';
|
|
2
|
+
|
|
1
3
|
export { Accordion } from './Accordion';
|
|
2
4
|
export { Section, SectionBlock, SectionBody, SectionHeader, SectionTable } from './basic-section';
|
|
3
5
|
export { Button, IconButton } from './buttons';
|
|
@@ -34,3 +36,4 @@ export { WizardWithSidebar } from './WizardWithSidebar';
|
|
|
34
36
|
export { Drawer } from './Navigation/Drawer';
|
|
35
37
|
export { TextTruncate } from './text-truncate';
|
|
36
38
|
export { Toggle } from './Toggle';
|
|
39
|
+
export { Tooltip } from './Tooltip';
|
|
@@ -5,11 +5,12 @@ interface TextTruncateProps {
|
|
|
5
5
|
string: string;
|
|
6
6
|
maxChars: number;
|
|
7
7
|
children?: any;
|
|
8
|
+
noTitle?: boolean;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export function TextTruncate({ string, maxChars, children }: TextTruncateProps) {
|
|
11
|
+
export function TextTruncate({ string, maxChars, children, noTitle }: TextTruncateProps) {
|
|
11
12
|
return string.length > maxChars ? (
|
|
12
|
-
<StyledTextTruncate title={string}>
|
|
13
|
+
<StyledTextTruncate title={noTitle ? undefined : string}>
|
|
13
14
|
{`${string.substring(0, maxChars)}...`}
|
|
14
15
|
{children}
|
|
15
16
|
</StyledTextTruncate>
|