@granto-umbrella/umbrella-components 3.0.54 → 3.0.56
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/dist/umbrella-components.es.js +17659 -17587
- package/dist/umbrella-components.umd.js +356 -339
- package/package.json +141 -141
- package/src/components/atoms/Button/Button.types.ts +27 -27
- package/src/components/atoms/Checkbox/Checkbox.types.ts +13 -13
- package/src/components/atoms/Textarea/Textarea.types.ts +6 -6
- package/src/components/atoms/Tooltip/Tooltip.tsx +60 -60
- package/src/components/atoms/Tooltip/Tootip.styles.ts +153 -153
- package/src/components/atoms/Tooltip/tooltip.types.ts +8 -8
- package/src/components/molecules/TimeLine/TimeLine.mapper.ts +61 -44
- package/src/components/molecules/TimeLine/TimeLine.registry.ts +41 -0
- package/src/components/molecules/TimeLine/TimeLine.styles.ts +55 -25
- package/src/components/molecules/TimeLine/TimeLine.tsx +18 -14
- package/src/components/molecules/TimeLine/TimeLine.types.ts +42 -101
- package/src/index.ts +159 -159
- package/src/styles/tokens/colors.ts +601 -601
package/package.json
CHANGED
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@granto-umbrella/umbrella-components",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "Umbrella Components for React",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "src/index.js",
|
|
7
|
-
"module": "src/index.js",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/grantoseguros/granto-umbrella-components.git"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"dev": "vite",
|
|
14
|
-
"build": "tsc -b && vite build",
|
|
15
|
-
"commit": "cz",
|
|
16
|
-
"pr": "node scripts/open-pr.cjs",
|
|
17
|
-
"typecheck": "npm run typecheck:app && npm run typecheck:test",
|
|
18
|
-
"typecheck:app": "tsc -p tsconfig.app.json --noEmit",
|
|
19
|
-
"typecheck:test": "tsc -p tsconfig.test.json --noEmit",
|
|
20
|
-
"test": "jest --config=jest.config.mjs",
|
|
21
|
-
"test:ci": "jest --config=jest.config.mjs --coverage",
|
|
22
|
-
"test:related": "jest --config=jest.config.mjs -o",
|
|
23
|
-
"test:coverage": "jest --config jest.config.mjs --coverage --coverageReporters",
|
|
24
|
-
"lint": "eslint .",
|
|
25
|
-
"lint:staged": "eslint --max-warnings=0 --ignore-pattern 'storybook-static/**' --ignore-pattern 'coverage/**' --ignore-pattern 'dist/**'",
|
|
26
|
-
"format": "prettier -c .",
|
|
27
|
-
"format:check": "prettier --check .",
|
|
28
|
-
"format:write": "prettier -w .",
|
|
29
|
-
"prepare": "lefthook install",
|
|
30
|
-
"preview": "vite preview",
|
|
31
|
-
"storybook": "storybook dev -p 6006",
|
|
32
|
-
"build-storybook": "storybook build",
|
|
33
|
-
"build:storybook": "storybook build -o storybook-static",
|
|
34
|
-
"predeploy": "npm run build-storybook",
|
|
35
|
-
"deploy": "gh-pages -d storybook-static",
|
|
36
|
-
"version": "npm run build && git add .",
|
|
37
|
-
"release:patch": "npm version patch && git push && git push --tags",
|
|
38
|
-
"release:minor": "npm version minor && git push && git push --tags",
|
|
39
|
-
"release:major": "npm version major && git push && git push --tags",
|
|
40
|
-
"bump:patch": "npm version patch",
|
|
41
|
-
"bump:minor": "npm version minor",
|
|
42
|
-
"bump:major": "npm version major"
|
|
43
|
-
},
|
|
44
|
-
"config": {
|
|
45
|
-
"commitizen": {
|
|
46
|
-
"path": "cz-git"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"@hello-pangea/dnd": "^18.0.1",
|
|
51
|
-
"@phosphor-icons/react": "^2.1.10",
|
|
52
|
-
"@radix-ui/react-dialog": "^1.1.15",
|
|
53
|
-
"@radix-ui/react-label": "^2.1.3",
|
|
54
|
-
"@radix-ui/react-popover": "^1.1.11",
|
|
55
|
-
"@radix-ui/react-radio-group": "^1.2.4",
|
|
56
|
-
"cpf-cnpj-validator": "^1.0.3",
|
|
57
|
-
"date-fns": "^4.1.0",
|
|
58
|
-
"lucide-react": "^0.488.0",
|
|
59
|
-
"make-mask": "^1.0.3",
|
|
60
|
-
"phosphor-react": "^1.4.1",
|
|
61
|
-
"radix": "^0.0.0",
|
|
62
|
-
"react": "^18.3.1",
|
|
63
|
-
"react-datepicker": "^8.3.0",
|
|
64
|
-
"react-day-picker": "^9.6.7",
|
|
65
|
-
"react-dom": "^18.3.1",
|
|
66
|
-
"react-hook-form": "^7.63.0",
|
|
67
|
-
"react-router": "^6.30.1",
|
|
68
|
-
"react-router-dom": "^6.30.1",
|
|
69
|
-
"react-select": "^5.10.0",
|
|
70
|
-
"recharts": "^3.2.1",
|
|
71
|
-
"tailwind-merge": "^3.2.0"
|
|
72
|
-
},
|
|
73
|
-
"devDependencies": {
|
|
74
|
-
"@chromatic-com/storybook": "4.1.3",
|
|
75
|
-
"@commitlint/cli": "^20.1.0",
|
|
76
|
-
"@commitlint/config-conventional": "^20.0.0",
|
|
77
|
-
"@eslint/js": "^9.17.0",
|
|
78
|
-
"@storybook/addon-actions": "^9.0.8",
|
|
79
|
-
"@storybook/addon-docs": "10.1.6",
|
|
80
|
-
"@storybook/addon-essentials": "^8.6.14",
|
|
81
|
-
"@storybook/addon-onboarding": "10.1.6",
|
|
82
|
-
"@storybook/react-vite": "^10.1.6",
|
|
83
|
-
"@storybook/test": "^8.6.14",
|
|
84
|
-
"@testing-library/dom": "^10.4.1",
|
|
85
|
-
"@testing-library/jest-dom": "^6.9.1",
|
|
86
|
-
"@testing-library/react": "^16.3.0",
|
|
87
|
-
"@testing-library/user-event": "^14.6.1",
|
|
88
|
-
"@types/jest": "^30.0.0",
|
|
89
|
-
"@types/mocha": "^10.0.10",
|
|
90
|
-
"@types/node": "^24.9.2",
|
|
91
|
-
"@types/react": "^18.3.17",
|
|
92
|
-
"@types/react-dom": "^18.3.5",
|
|
93
|
-
"@types/styled-components": "^5.1.34",
|
|
94
|
-
"@vitejs/plugin-react": "^4.7.0",
|
|
95
|
-
"babel-plugin-styled-components": "^2.1.4",
|
|
96
|
-
"commitizen": "^4.3.1",
|
|
97
|
-
"commitlint": "^20.1.0",
|
|
98
|
-
"cz-git": "^1.12.0",
|
|
99
|
-
"eslint": "^9.17.0",
|
|
100
|
-
"eslint-plugin-react-hooks": "^5.0.0",
|
|
101
|
-
"eslint-plugin-react-refresh": "^0.4.16",
|
|
102
|
-
"eslint-plugin-storybook": "10.1.6",
|
|
103
|
-
"gh-pages": "^6.3.0",
|
|
104
|
-
"globals": "^15.13.0",
|
|
105
|
-
"identity-obj-proxy": "^3.0.0",
|
|
106
|
-
"jest": "^29.7.0",
|
|
107
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
108
|
-
"jest-styled-components": "^7.2.0",
|
|
109
|
-
"lefthook": "^2.0.1",
|
|
110
|
-
"prettier": "^3.6.2",
|
|
111
|
-
"react-icons": "^5.4.0",
|
|
112
|
-
"storybook": "^10.1.10",
|
|
113
|
-
"styled-components": "^6.1.19",
|
|
114
|
-
"ts-jest": "^29.4.5",
|
|
115
|
-
"ts-node": "^10.9.2",
|
|
116
|
-
"typescript": "~5.6.2",
|
|
117
|
-
"typescript-eslint": "^8.18.1",
|
|
118
|
-
"vite": "^6.0.3",
|
|
119
|
-
"vite-plugin-dts": "^4.5.4"
|
|
120
|
-
},
|
|
121
|
-
"keywords": [
|
|
122
|
-
"cli",
|
|
123
|
-
"vite",
|
|
124
|
-
"components"
|
|
125
|
-
],
|
|
126
|
-
"eslintConfig": {
|
|
127
|
-
"extends": [
|
|
128
|
-
"plugin:storybook/recommended"
|
|
129
|
-
]
|
|
130
|
-
},
|
|
131
|
-
"engines": {
|
|
132
|
-
"node": "20.17.0",
|
|
133
|
-
"yarn": ">=1.22.18"
|
|
134
|
-
},
|
|
135
|
-
"files": [
|
|
136
|
-
"dist",
|
|
137
|
-
"src/**/*",
|
|
138
|
-
"!src/**/*.test.*",
|
|
139
|
-
"!src/**/*.stories.*"
|
|
140
|
-
]
|
|
141
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@granto-umbrella/umbrella-components",
|
|
3
|
+
"version": "3.0.56",
|
|
4
|
+
"description": "Umbrella Components for React",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"module": "src/index.js",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/grantoseguros/granto-umbrella-components.git"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "vite",
|
|
14
|
+
"build": "tsc -b && vite build",
|
|
15
|
+
"commit": "cz",
|
|
16
|
+
"pr": "node scripts/open-pr.cjs",
|
|
17
|
+
"typecheck": "npm run typecheck:app && npm run typecheck:test",
|
|
18
|
+
"typecheck:app": "tsc -p tsconfig.app.json --noEmit",
|
|
19
|
+
"typecheck:test": "tsc -p tsconfig.test.json --noEmit",
|
|
20
|
+
"test": "jest --config=jest.config.mjs",
|
|
21
|
+
"test:ci": "jest --config=jest.config.mjs --coverage",
|
|
22
|
+
"test:related": "jest --config=jest.config.mjs -o",
|
|
23
|
+
"test:coverage": "jest --config jest.config.mjs --coverage --coverageReporters",
|
|
24
|
+
"lint": "eslint .",
|
|
25
|
+
"lint:staged": "eslint --max-warnings=0 --ignore-pattern 'storybook-static/**' --ignore-pattern 'coverage/**' --ignore-pattern 'dist/**'",
|
|
26
|
+
"format": "prettier -c .",
|
|
27
|
+
"format:check": "prettier --check .",
|
|
28
|
+
"format:write": "prettier -w .",
|
|
29
|
+
"prepare": "lefthook install",
|
|
30
|
+
"preview": "vite preview",
|
|
31
|
+
"storybook": "storybook dev -p 6006",
|
|
32
|
+
"build-storybook": "storybook build",
|
|
33
|
+
"build:storybook": "storybook build -o storybook-static",
|
|
34
|
+
"predeploy": "npm run build-storybook",
|
|
35
|
+
"deploy": "gh-pages -d storybook-static",
|
|
36
|
+
"version": "npm run build && git add .",
|
|
37
|
+
"release:patch": "npm version patch && git push && git push --tags",
|
|
38
|
+
"release:minor": "npm version minor && git push && git push --tags",
|
|
39
|
+
"release:major": "npm version major && git push && git push --tags",
|
|
40
|
+
"bump:patch": "npm version patch",
|
|
41
|
+
"bump:minor": "npm version minor",
|
|
42
|
+
"bump:major": "npm version major"
|
|
43
|
+
},
|
|
44
|
+
"config": {
|
|
45
|
+
"commitizen": {
|
|
46
|
+
"path": "cz-git"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@hello-pangea/dnd": "^18.0.1",
|
|
51
|
+
"@phosphor-icons/react": "^2.1.10",
|
|
52
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
53
|
+
"@radix-ui/react-label": "^2.1.3",
|
|
54
|
+
"@radix-ui/react-popover": "^1.1.11",
|
|
55
|
+
"@radix-ui/react-radio-group": "^1.2.4",
|
|
56
|
+
"cpf-cnpj-validator": "^1.0.3",
|
|
57
|
+
"date-fns": "^4.1.0",
|
|
58
|
+
"lucide-react": "^0.488.0",
|
|
59
|
+
"make-mask": "^1.0.3",
|
|
60
|
+
"phosphor-react": "^1.4.1",
|
|
61
|
+
"radix": "^0.0.0",
|
|
62
|
+
"react": "^18.3.1",
|
|
63
|
+
"react-datepicker": "^8.3.0",
|
|
64
|
+
"react-day-picker": "^9.6.7",
|
|
65
|
+
"react-dom": "^18.3.1",
|
|
66
|
+
"react-hook-form": "^7.63.0",
|
|
67
|
+
"react-router": "^6.30.1",
|
|
68
|
+
"react-router-dom": "^6.30.1",
|
|
69
|
+
"react-select": "^5.10.0",
|
|
70
|
+
"recharts": "^3.2.1",
|
|
71
|
+
"tailwind-merge": "^3.2.0"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@chromatic-com/storybook": "4.1.3",
|
|
75
|
+
"@commitlint/cli": "^20.1.0",
|
|
76
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
77
|
+
"@eslint/js": "^9.17.0",
|
|
78
|
+
"@storybook/addon-actions": "^9.0.8",
|
|
79
|
+
"@storybook/addon-docs": "10.1.6",
|
|
80
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
81
|
+
"@storybook/addon-onboarding": "10.1.6",
|
|
82
|
+
"@storybook/react-vite": "^10.1.6",
|
|
83
|
+
"@storybook/test": "^8.6.14",
|
|
84
|
+
"@testing-library/dom": "^10.4.1",
|
|
85
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
86
|
+
"@testing-library/react": "^16.3.0",
|
|
87
|
+
"@testing-library/user-event": "^14.6.1",
|
|
88
|
+
"@types/jest": "^30.0.0",
|
|
89
|
+
"@types/mocha": "^10.0.10",
|
|
90
|
+
"@types/node": "^24.9.2",
|
|
91
|
+
"@types/react": "^18.3.17",
|
|
92
|
+
"@types/react-dom": "^18.3.5",
|
|
93
|
+
"@types/styled-components": "^5.1.34",
|
|
94
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
95
|
+
"babel-plugin-styled-components": "^2.1.4",
|
|
96
|
+
"commitizen": "^4.3.1",
|
|
97
|
+
"commitlint": "^20.1.0",
|
|
98
|
+
"cz-git": "^1.12.0",
|
|
99
|
+
"eslint": "^9.17.0",
|
|
100
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
101
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
102
|
+
"eslint-plugin-storybook": "10.1.6",
|
|
103
|
+
"gh-pages": "^6.3.0",
|
|
104
|
+
"globals": "^15.13.0",
|
|
105
|
+
"identity-obj-proxy": "^3.0.0",
|
|
106
|
+
"jest": "^29.7.0",
|
|
107
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
108
|
+
"jest-styled-components": "^7.2.0",
|
|
109
|
+
"lefthook": "^2.0.1",
|
|
110
|
+
"prettier": "^3.6.2",
|
|
111
|
+
"react-icons": "^5.4.0",
|
|
112
|
+
"storybook": "^10.1.10",
|
|
113
|
+
"styled-components": "^6.1.19",
|
|
114
|
+
"ts-jest": "^29.4.5",
|
|
115
|
+
"ts-node": "^10.9.2",
|
|
116
|
+
"typescript": "~5.6.2",
|
|
117
|
+
"typescript-eslint": "^8.18.1",
|
|
118
|
+
"vite": "^6.0.3",
|
|
119
|
+
"vite-plugin-dts": "^4.5.4"
|
|
120
|
+
},
|
|
121
|
+
"keywords": [
|
|
122
|
+
"cli",
|
|
123
|
+
"vite",
|
|
124
|
+
"components"
|
|
125
|
+
],
|
|
126
|
+
"eslintConfig": {
|
|
127
|
+
"extends": [
|
|
128
|
+
"plugin:storybook/recommended"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"engines": {
|
|
132
|
+
"node": "20.17.0",
|
|
133
|
+
"yarn": ">=1.22.18"
|
|
134
|
+
},
|
|
135
|
+
"files": [
|
|
136
|
+
"dist",
|
|
137
|
+
"src/**/*",
|
|
138
|
+
"!src/**/*.test.*",
|
|
139
|
+
"!src/**/*.stories.*"
|
|
140
|
+
]
|
|
141
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
-
size?: 'sm' | 'md' | 'lg';
|
|
3
|
-
variant?:
|
|
4
|
-
| 'primary'
|
|
5
|
-
| 'outline'
|
|
6
|
-
| 'outline_ghost'
|
|
7
|
-
| 'outline_ghost_disabled'
|
|
8
|
-
| 'outline_danger'
|
|
9
|
-
| 'danger'
|
|
10
|
-
| 'ghost'
|
|
11
|
-
| 'ghost_alert'
|
|
12
|
-
| 'alert'
|
|
13
|
-
| 'danger-no-fill'
|
|
14
|
-
| 'accent-outline'
|
|
15
|
-
| 'accent-fill'
|
|
16
|
-
| 'secondary-outline'
|
|
17
|
-
| 'danger-fill';
|
|
18
|
-
radius?: string;
|
|
19
|
-
isLoading?: boolean;
|
|
20
|
-
leftIcon?: string;
|
|
21
|
-
rightIcon?: string;
|
|
22
|
-
iconSize?: string;
|
|
23
|
-
fontSize?: string;
|
|
24
|
-
width?: string;
|
|
25
|
-
height?: string;
|
|
26
|
-
testId?: string;
|
|
27
|
-
}
|
|
1
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
size?: 'sm' | 'md' | 'lg';
|
|
3
|
+
variant?:
|
|
4
|
+
| 'primary'
|
|
5
|
+
| 'outline'
|
|
6
|
+
| 'outline_ghost'
|
|
7
|
+
| 'outline_ghost_disabled'
|
|
8
|
+
| 'outline_danger'
|
|
9
|
+
| 'danger'
|
|
10
|
+
| 'ghost'
|
|
11
|
+
| 'ghost_alert'
|
|
12
|
+
| 'alert'
|
|
13
|
+
| 'danger-no-fill'
|
|
14
|
+
| 'accent-outline'
|
|
15
|
+
| 'accent-fill'
|
|
16
|
+
| 'secondary-outline'
|
|
17
|
+
| 'danger-fill';
|
|
18
|
+
radius?: string;
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
leftIcon?: string;
|
|
21
|
+
rightIcon?: string;
|
|
22
|
+
iconSize?: string;
|
|
23
|
+
fontSize?: string;
|
|
24
|
+
width?: string;
|
|
25
|
+
height?: string;
|
|
26
|
+
testId?: string;
|
|
27
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
2
|
-
label?: string;
|
|
3
|
-
checked?: boolean;
|
|
4
|
-
onChange?: () => void;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface CheckboxGroupProps {
|
|
9
|
-
options: { label: string; value: string }[];
|
|
10
|
-
selected: string[];
|
|
11
|
-
setSelected: (values: string[]) => void;
|
|
12
|
-
direction?: 'vertical' | 'horizontal';
|
|
13
|
-
}
|
|
1
|
+
export interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
2
|
+
label?: string;
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
onChange?: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface CheckboxGroupProps {
|
|
9
|
+
options: { label: string; value: string }[];
|
|
10
|
+
selected: string[];
|
|
11
|
+
setSelected: (values: string[]) => void;
|
|
12
|
+
direction?: 'vertical' | 'horizontal';
|
|
13
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
2
|
-
label?: string;
|
|
3
|
-
supportingText?: string;
|
|
4
|
-
testId?: string;
|
|
5
|
-
info?: string;
|
|
6
|
-
}
|
|
1
|
+
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
2
|
+
label?: string;
|
|
3
|
+
supportingText?: string;
|
|
4
|
+
testId?: string;
|
|
5
|
+
info?: string;
|
|
6
|
+
}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
TooltipContainer,
|
|
4
|
-
TooltipTrigger,
|
|
5
|
-
TooltipContent,
|
|
6
|
-
TooltipText,
|
|
7
|
-
TooltipLink,
|
|
8
|
-
} from '../Tooltip/Tootip.styles';
|
|
9
|
-
import { TooltipProps } from './tooltip.types';
|
|
10
|
-
import { ArrowSquareOut } from '@phosphor-icons/react';
|
|
11
|
-
import info from '../../../assets/info.png';
|
|
12
|
-
|
|
13
|
-
const Tooltip: React.FC<TooltipProps> = ({
|
|
14
|
-
children,
|
|
15
|
-
content,
|
|
16
|
-
position = 'top',
|
|
17
|
-
helpLink,
|
|
18
|
-
}) => {
|
|
19
|
-
const [visible, setVisible] = useState(false);
|
|
20
|
-
|
|
21
|
-
const handleMouseEnter = () => {
|
|
22
|
-
setVisible(true);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const handleMouseLeave = () => {
|
|
26
|
-
setVisible(false);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<TooltipContainer>
|
|
31
|
-
{children}
|
|
32
|
-
<TooltipTrigger
|
|
33
|
-
onMouseEnter={handleMouseEnter}
|
|
34
|
-
onMouseLeave={handleMouseLeave}
|
|
35
|
-
>
|
|
36
|
-
<img src={info} alt="Informação" />
|
|
37
|
-
</TooltipTrigger>
|
|
38
|
-
<TooltipContent
|
|
39
|
-
$position={position}
|
|
40
|
-
$visible={visible}
|
|
41
|
-
onMouseEnter={handleMouseEnter}
|
|
42
|
-
onMouseLeave={handleMouseLeave}
|
|
43
|
-
>
|
|
44
|
-
<TooltipText>{content}</TooltipText>
|
|
45
|
-
{helpLink && (
|
|
46
|
-
<TooltipLink
|
|
47
|
-
href={helpLink}
|
|
48
|
-
target="_blank"
|
|
49
|
-
rel="noopener noreferrer"
|
|
50
|
-
>
|
|
51
|
-
Saiba mais
|
|
52
|
-
<ArrowSquareOut size={12} weight="bold" />
|
|
53
|
-
</TooltipLink>
|
|
54
|
-
)}
|
|
55
|
-
</TooltipContent>
|
|
56
|
-
</TooltipContainer>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export default Tooltip;
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
TooltipContainer,
|
|
4
|
+
TooltipTrigger,
|
|
5
|
+
TooltipContent,
|
|
6
|
+
TooltipText,
|
|
7
|
+
TooltipLink,
|
|
8
|
+
} from '../Tooltip/Tootip.styles';
|
|
9
|
+
import { TooltipProps } from './tooltip.types';
|
|
10
|
+
import { ArrowSquareOut } from '@phosphor-icons/react';
|
|
11
|
+
import info from '../../../assets/info.png';
|
|
12
|
+
|
|
13
|
+
const Tooltip: React.FC<TooltipProps> = ({
|
|
14
|
+
children,
|
|
15
|
+
content,
|
|
16
|
+
position = 'top',
|
|
17
|
+
helpLink,
|
|
18
|
+
}) => {
|
|
19
|
+
const [visible, setVisible] = useState(false);
|
|
20
|
+
|
|
21
|
+
const handleMouseEnter = () => {
|
|
22
|
+
setVisible(true);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const handleMouseLeave = () => {
|
|
26
|
+
setVisible(false);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<TooltipContainer>
|
|
31
|
+
{children}
|
|
32
|
+
<TooltipTrigger
|
|
33
|
+
onMouseEnter={handleMouseEnter}
|
|
34
|
+
onMouseLeave={handleMouseLeave}
|
|
35
|
+
>
|
|
36
|
+
<img src={info} alt="Informação" />
|
|
37
|
+
</TooltipTrigger>
|
|
38
|
+
<TooltipContent
|
|
39
|
+
$position={position}
|
|
40
|
+
$visible={visible}
|
|
41
|
+
onMouseEnter={handleMouseEnter}
|
|
42
|
+
onMouseLeave={handleMouseLeave}
|
|
43
|
+
>
|
|
44
|
+
<TooltipText>{content}</TooltipText>
|
|
45
|
+
{helpLink && (
|
|
46
|
+
<TooltipLink
|
|
47
|
+
href={helpLink}
|
|
48
|
+
target="_blank"
|
|
49
|
+
rel="noopener noreferrer"
|
|
50
|
+
>
|
|
51
|
+
Saiba mais
|
|
52
|
+
<ArrowSquareOut size={12} weight="bold" />
|
|
53
|
+
</TooltipLink>
|
|
54
|
+
)}
|
|
55
|
+
</TooltipContent>
|
|
56
|
+
</TooltipContainer>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default Tooltip;
|