groundfloor-react-ui 1.0.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/README.md +20 -0
- package/assets/fonts/Averta/Averta-Black.woff2 +0 -0
- package/assets/fonts/Averta/Averta-BlackItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Bold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-BoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraBold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraBoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraThin.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraThinItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Light.woff2 +0 -0
- package/assets/fonts/Averta/Averta-LightItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Regular.woff2 +0 -0
- package/assets/fonts/Averta/Averta-RegularItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-SemiBold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-SemiBoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Thin.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ThinItalic.woff2 +0 -0
- package/assets/fonts/Beauty/BeautyDemo.woff +0 -0
- package/assets/icons/app-logo.svg +3 -0
- package/assets/icons/arrow-down.svg +3 -0
- package/assets/icons/arrow-rotate.svg +1 -0
- package/assets/icons/arrow-up.svg +3 -0
- package/assets/icons/bell.svg +3 -0
- package/assets/icons/check.svg +3 -0
- package/assets/icons/checkmark.svg +3 -0
- package/assets/icons/chevron-down.svg +3 -0
- package/assets/icons/chevron-left.svg +3 -0
- package/assets/icons/chevron-right.svg +3 -0
- package/assets/icons/cloud-icon.svg +3 -0
- package/assets/icons/connection.svg +3 -0
- package/assets/icons/cross-icon.svg +3 -0
- package/assets/icons/door-internal-active.svg +1 -0
- package/assets/icons/edit-icon.svg +3 -0
- package/assets/icons/ellipses-horizontal.svg +3 -0
- package/assets/icons/ellipses.svg +3 -0
- package/assets/icons/email.svg +3 -0
- package/assets/icons/eye-hide-view.svg +1 -0
- package/assets/icons/eye-hide.svg +1 -0
- package/assets/icons/file-attach-white.svg +3 -0
- package/assets/icons/file-attach.svg +3 -0
- package/assets/icons/functional-equation-regular.svg +147 -0
- package/assets/icons/hamburger-menu.svg +3 -0
- package/assets/icons/heart.svg +18 -0
- package/assets/icons/image.svg +3 -0
- package/assets/icons/info.svg +3 -0
- package/assets/icons/jpg-icon.svg +3 -0
- package/assets/icons/magnifier.svg +3 -0
- package/assets/icons/menu-ellipse-two.svg +1 -0
- package/assets/icons/menu-ellipse.svg +53 -0
- package/assets/icons/pause-all.svg +1 -0
- package/assets/icons/pdf-icon.svg +3 -0
- package/assets/icons/pen-icon.svg +3 -0
- package/assets/icons/plus-outlined.svg +3 -0
- package/assets/icons/resume.svg +1 -0
- package/assets/icons/sign-icon.svg +3 -0
- package/assets/icons/star.svg +3 -0
- package/assets/icons/trash-icon.svg +59 -0
- package/assets/icons/triangle-down.svg +3 -0
- package/assets/icons/users.svg +11 -0
- package/assets/icons/view.svg +3 -0
- package/assets/icons/watcher.svg +3 -0
- package/assets/icons/zoom-in-white.svg +1 -0
- package/assets/styles/global.css +0 -0
- package/assets/styles/global.scss +0 -0
- package/components/Accordion/Accordion.js +114 -0
- package/components/Accordion/AccordionSB.js +168 -0
- package/components/Accordion/AccordionSBfooter.js +171 -0
- package/components/Accordion/index.js +4 -0
- package/components/ArrowBar/ArrowBar.js +293 -0
- package/components/ArrowBar/index.js +2 -0
- package/components/Avatar/Avatar.js +167 -0
- package/components/Avatar/AvatarSB.js +226 -0
- package/components/Avatar/AvatarSBfooter.js +226 -0
- package/components/Avatar/index.js +4 -0
- package/components/Banner/Banner.js +65 -0
- package/components/Banner/index.js +2 -0
- package/components/Breadcrumb/Breadcrumb.js +192 -0
- package/components/Breadcrumb/index.js +2 -0
- package/components/Button/PrimaryButton.js +125 -0
- package/components/Button/SecondaryButton.js +114 -0
- package/components/Button/TinyButton.js +94 -0
- package/components/Button/index.js +6 -0
- package/components/Cards/Card.js +48 -0
- package/components/Cards/CardRef.js +64 -0
- package/components/Cards/DocumentCard.js +221 -0
- package/components/Cards/index.js +5 -0
- package/components/Content/Content.js +51 -0
- package/components/Content/index.js +1 -0
- package/components/Divider/Divider.js +63 -0
- package/components/Divider/index.js +2 -0
- package/components/Drawer/Drawer.js +93 -0
- package/components/Drawer/index.js +2 -0
- package/components/ErrorBoundary/ErrorBoundary.js +44 -0
- package/components/ErrorBoundary/index.js +1 -0
- package/components/FilterChip/FilterChip.js +68 -0
- package/components/FilterChip/index.js +1 -0
- package/components/Footer/Footer.js +58 -0
- package/components/Footer/FooterContentLev3.js +96 -0
- package/components/Footer/index.js +2 -0
- package/components/Form/FormComponent.js +273 -0
- package/components/Form/HeaderComponent.js +39 -0
- package/components/Form/StyledComponent.js +323 -0
- package/components/Form/SubmitComponent.js +63 -0
- package/components/Form/index.js +4 -0
- package/components/GroupAvatars/GroupAvatars.js +143 -0
- package/components/GroupAvatars/index.js +1 -0
- package/components/GroupButtons/ButtonPopup.js +192 -0
- package/components/GroupButtons/GroupButtons.js +150 -0
- package/components/GroupButtons/GroupButtonsPopup.js +169 -0
- package/components/GroupButtons/index.js +3 -0
- package/components/GroupStatusCircle/GroupStatusCircle.js +135 -0
- package/components/GroupStatusCircle/index.js +1 -0
- package/components/Header/Header.js +58 -0
- package/components/Header/index.js +1 -0
- package/components/HyperLink/HyperLink.js +114 -0
- package/components/HyperLink/index.js +1 -0
- package/components/Icon/Icon.js +161 -0
- package/components/Icon/index.js +1 -0
- package/components/Images/Image.js +112 -0
- package/components/Images/index.js +2 -0
- package/components/Inputs/CheckBoxEditableInput.js +352 -0
- package/components/Inputs/CheckBoxInput.js +195 -0
- package/components/Inputs/CheckBoxInputMS.js +160 -0
- package/components/Inputs/DateSelect.js +411 -0
- package/components/Inputs/DropdownSelect.js +466 -0
- package/components/Inputs/DropzoneInput.js +335 -0
- package/components/Inputs/NumericInput.js +155 -0
- package/components/Inputs/RadioInput.js +205 -0
- package/components/Inputs/SearchInput.js +18 -0
- package/components/Inputs/Signature.js +278 -0
- package/components/Inputs/TextArea.js +196 -0
- package/components/Inputs/TextInput.js +182 -0
- package/components/Inputs/TextInputClicable.js +198 -0
- package/components/Inputs/TextInputClicableMS.js +255 -0
- package/components/Inputs/TimeInput.js +181 -0
- package/components/Inputs/ToggleSwitch.js +123 -0
- package/components/Inputs/index.js +13 -0
- package/components/Label/Label.js +48 -0
- package/components/Label/index.js +1 -0
- package/components/Loaders/Loader.js +179 -0
- package/components/Loaders/index.js +2 -0
- package/components/Modal/Modal.js +116 -0
- package/components/Modal/ModalComp.js +158 -0
- package/components/Modal/index.js +2 -0
- package/components/Overlay/Overlay.js +159 -0
- package/components/Overlay/index.js +1 -0
- package/components/Pagination/Pagination.js +83 -0
- package/components/Pagination/index.js +1 -0
- package/components/ProgressBar/ProgressBar.js +84 -0
- package/components/ProgressBar/index.js +1 -0
- package/components/ProgressSteps/ProgressSteps.js +121 -0
- package/components/ProgressSteps/index.js +1 -0
- package/components/Rating/Rating.js +264 -0
- package/components/Rating/index.js +1 -0
- package/components/SecondaryLink/DarkSecondaryLink.js +97 -0
- package/components/SecondaryLink/LightSecondaryLink.js +93 -0
- package/components/SecondaryLink/index.js +3 -0
- package/components/Sidebar/Navbar.js +328 -0
- package/components/Sidebar/Sidebar.js +180 -0
- package/components/Sidebar/index.js +3 -0
- package/components/StatusChip/PrimaryStatusChip.js +78 -0
- package/components/StatusChip/SecondaryStatusChip.js +78 -0
- package/components/StatusChip/SlimPrimaryStatusChip.js +92 -0
- package/components/StatusChip/SlimSecondaryStatusChip.js +93 -0
- package/components/StatusChip/index.js +6 -0
- package/components/StatusCircle/StatusCircle.js +64 -0
- package/components/StatusCircle/index.js +1 -0
- package/components/Tables/Table.js +156 -0
- package/components/Tables/index.js +1 -0
- package/components/Tooltip/Tooltip.js +479 -0
- package/components/Tooltip/index.js +1 -0
- package/components/Typography/Typography.js +78 -0
- package/components/Typography/index.js +2 -0
- package/components/constants/colors.js +33 -0
- package/components/constants/defaultStyle.js +781 -0
- package/components/constants/defaultThemeColor.js +15 -0
- package/components/constants/index.js +7 -0
- package/components/constants/utils.js +31 -0
- package/components/global/FontStyle.js +131 -0
- package/components/global/index.js +1 -0
- package/dist/index.es.js +2302 -0
- package/dist/index.js +2302 -0
- package/index.js +40 -0
- package/package.json +67 -0
- package/rollup.config.js +53 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
6
|
+
// import 'react-popper-tooltip/dist/styles.css';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Primary UI component for user interaction
|
|
10
|
+
*/
|
|
11
|
+
const TooltipContainer = styled.div`
|
|
12
|
+
${({ theme, type, customStylesTPContainer }) => {
|
|
13
|
+
if (theme) {
|
|
14
|
+
let tempObj = {};
|
|
15
|
+
if (theme['tooltip-container']) {
|
|
16
|
+
for (const property in theme['common']) {
|
|
17
|
+
tempObj[property] = theme['common'][property]
|
|
18
|
+
}
|
|
19
|
+
for (const property in theme['tooltip-container']) {
|
|
20
|
+
tempObj[property] = theme['tooltip-container'][property]
|
|
21
|
+
delete theme.common[property]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return { ...tempObj, ...customStylesTPContainer };
|
|
25
|
+
}
|
|
26
|
+
}}
|
|
27
|
+
|
|
28
|
+
&[data-popper-placement*='bottom'] .tooltip-arrow {
|
|
29
|
+
${({ theme, type, customStylesTPAbottom }) => {
|
|
30
|
+
if (theme) {
|
|
31
|
+
let tempObj = {};
|
|
32
|
+
if (theme['tp-cont-bottom-arrow']) {
|
|
33
|
+
for (const property in theme['common']) {
|
|
34
|
+
tempObj[property] = theme['common'][property]
|
|
35
|
+
}
|
|
36
|
+
for (const property in theme['tp-cont-bottom-arrow']) {
|
|
37
|
+
tempObj[property] = theme['tp-cont-bottom-arrow'][property]
|
|
38
|
+
delete theme.common[property]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { ...tempObj, ...customStylesTPAbottom };
|
|
42
|
+
}
|
|
43
|
+
}}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&[data-popper-placement*='bottom'] .tooltip-arrow::before {
|
|
47
|
+
${({ theme, type, customStylesTPAbottomBefore }) => {
|
|
48
|
+
if (theme) {
|
|
49
|
+
let tempObj = {};
|
|
50
|
+
if (theme['tp-cont-bottom-arrow-before']) {
|
|
51
|
+
for (const property in theme['common']) {
|
|
52
|
+
tempObj[property] = theme['common'][property]
|
|
53
|
+
}
|
|
54
|
+
for (const property in theme['tp-cont-bottom-arrow-before']) {
|
|
55
|
+
tempObj[property] = theme['tp-cont-bottom-arrow-before'][property]
|
|
56
|
+
delete theme.common[property]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return { ...tempObj, ...customStylesTPAbottomBefore };
|
|
60
|
+
}
|
|
61
|
+
}}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&[data-popper-placement*='bottom'] .tooltip-arrow::after {
|
|
65
|
+
${({ theme, type, customStylesTPAbottomAfter }) => {
|
|
66
|
+
if (theme) {
|
|
67
|
+
let tempObj = {};
|
|
68
|
+
if (theme['tp-cont-bottom-arrow-before']) {
|
|
69
|
+
for (const property in theme['common']) {
|
|
70
|
+
tempObj[property] = theme['common'][property]
|
|
71
|
+
}
|
|
72
|
+
for (const property in theme['tp-cont-bottom-arrow-after']) {
|
|
73
|
+
tempObj[property] = theme['tp-cont-bottom-arrow-after'][property]
|
|
74
|
+
delete theme.common[property]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return { ...tempObj, ...customStylesTPAbottomAfter };
|
|
78
|
+
}
|
|
79
|
+
}}
|
|
80
|
+
}
|
|
81
|
+
&[data-popper-placement*='top'] .tooltip-arrow {
|
|
82
|
+
${({ theme, type, customStylesTPAtop }) => {
|
|
83
|
+
if (theme) {
|
|
84
|
+
let tempObj = {};
|
|
85
|
+
if (theme['tp-cont-top-arrow']) {
|
|
86
|
+
for (const property in theme['common']) {
|
|
87
|
+
tempObj[property] = theme['common'][property]
|
|
88
|
+
}
|
|
89
|
+
for (const property in theme['tp-cont-top-arrow']) {
|
|
90
|
+
tempObj[property] = theme['tp-cont-top-arrow'][property]
|
|
91
|
+
delete theme.common[property]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { ...tempObj, ...customStylesTPAtop };
|
|
95
|
+
}
|
|
96
|
+
}}
|
|
97
|
+
}
|
|
98
|
+
&[data-popper-placement*='top'] .tooltip-arrow::before {
|
|
99
|
+
${({ theme, type, customStylesTPAtopBefore }) => {
|
|
100
|
+
if (theme) {
|
|
101
|
+
let tempObj = {};
|
|
102
|
+
if (theme['tp-cont-top-arrow-before']) {
|
|
103
|
+
for (const property in theme['common']) {
|
|
104
|
+
tempObj[property] = theme['common'][property]
|
|
105
|
+
}
|
|
106
|
+
for (const property in theme['tp-cont-top-arrow-before']) {
|
|
107
|
+
tempObj[property] = theme['tp-cont-top-arrow-before'][property]
|
|
108
|
+
delete theme.common[property]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return { ...tempObj, ...customStylesTPAtopBefore };
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
114
|
+
}
|
|
115
|
+
&[data-popper-placement*='top'] .tooltip-arrow::after {
|
|
116
|
+
${({ theme, type, customStylesTPAtopAfter }) => {
|
|
117
|
+
if (theme) {
|
|
118
|
+
let tempObj = {};
|
|
119
|
+
if (theme['tp-cont-top-arrow-before']) {
|
|
120
|
+
for (const property in theme['common']) {
|
|
121
|
+
tempObj[property] = theme['common'][property]
|
|
122
|
+
}
|
|
123
|
+
for (const property in theme['tp-cont-top-arrow-after']) {
|
|
124
|
+
tempObj[property] = theme['tp-cont-top-arrow-after'][property]
|
|
125
|
+
delete theme.common[property]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return { ...tempObj, ...customStylesTPAtopAfter };
|
|
129
|
+
}
|
|
130
|
+
}}
|
|
131
|
+
}
|
|
132
|
+
&[data-popper-placement*='right'] .tooltip-arrow {
|
|
133
|
+
${({ theme, type, customStylesTPAright }) => {
|
|
134
|
+
if (theme) {
|
|
135
|
+
let tempObj = {};
|
|
136
|
+
if (theme['tp-cont-right-arrow']) {
|
|
137
|
+
for (const property in theme['common']) {
|
|
138
|
+
tempObj[property] = theme['common'][property]
|
|
139
|
+
}
|
|
140
|
+
for (const property in theme['tp-cont-right-arrow']) {
|
|
141
|
+
tempObj[property] = theme['tp-cont-right-arrow'][property]
|
|
142
|
+
delete theme.common[property]
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return { ...tempObj, ...customStylesTPAright };
|
|
146
|
+
}
|
|
147
|
+
}}
|
|
148
|
+
}
|
|
149
|
+
&[data-popper-placement*='right'] .tooltip-arrow::before {
|
|
150
|
+
${({ theme, type, customStylesTPArightBefore }) => {
|
|
151
|
+
if (theme) {
|
|
152
|
+
let tempObj = {};
|
|
153
|
+
if (theme['tp-cont-right-arrow-before']) {
|
|
154
|
+
for (const property in theme['common']) {
|
|
155
|
+
tempObj[property] = theme['common'][property]
|
|
156
|
+
}
|
|
157
|
+
for (const property in theme['tp-cont-right-arrow-before']) {
|
|
158
|
+
tempObj[property] = theme['tp-cont-right-arrow-before'][property]
|
|
159
|
+
delete theme.common[property]
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return { ...tempObj, ...customStylesTPArightBefore };
|
|
163
|
+
}
|
|
164
|
+
}}
|
|
165
|
+
}
|
|
166
|
+
&[data-popper-placement*='right'] .tooltip-arrow::after {
|
|
167
|
+
${({ theme, type, customStylesTPArightAfter }) => {
|
|
168
|
+
if (theme) {
|
|
169
|
+
let tempObj = {};
|
|
170
|
+
if (theme['tp-cont-right-arrow-before']) {
|
|
171
|
+
for (const property in theme['common']) {
|
|
172
|
+
tempObj[property] = theme['common'][property]
|
|
173
|
+
}
|
|
174
|
+
for (const property in theme['tp-cont-right-arrow-after']) {
|
|
175
|
+
tempObj[property] = theme['tp-cont-right-arrow-after'][property]
|
|
176
|
+
delete theme.common[property]
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return { ...tempObj, ...customStylesTPArightAfter };
|
|
180
|
+
}
|
|
181
|
+
}}
|
|
182
|
+
}
|
|
183
|
+
&[data-popper-placement*='left'] .tooltip-arrow {
|
|
184
|
+
${({ theme, type, customStylesTPAleft }) => {
|
|
185
|
+
if (theme) {
|
|
186
|
+
let tempObj = {};
|
|
187
|
+
if (theme['tp-cont-left-arrow']) {
|
|
188
|
+
for (const property in theme['common']) {
|
|
189
|
+
tempObj[property] = theme['common'][property]
|
|
190
|
+
}
|
|
191
|
+
for (const property in theme['tp-cont-left-arrow']) {
|
|
192
|
+
tempObj[property] = theme['tp-cont-left-arrow'][property]
|
|
193
|
+
delete theme.common[property]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return { ...tempObj, ...customStylesTPAleft };
|
|
197
|
+
}
|
|
198
|
+
}}
|
|
199
|
+
}
|
|
200
|
+
&[data-popper-placement*='left'] .tooltip-arrow::before {
|
|
201
|
+
${({ theme, type, customStylesTPAleftBefore }) => {
|
|
202
|
+
if (theme) {
|
|
203
|
+
let tempObj = {};
|
|
204
|
+
if (theme['tp-cont-left-arrow-before']) {
|
|
205
|
+
for (const property in theme['common']) {
|
|
206
|
+
tempObj[property] = theme['common'][property]
|
|
207
|
+
}
|
|
208
|
+
for (const property in theme['tp-cont-left-arrow-before']) {
|
|
209
|
+
tempObj[property] = theme['tp-cont-left-arrow-before'][property]
|
|
210
|
+
delete theme.common[property]
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return { ...tempObj, ...customStylesTPAleftBefore };
|
|
214
|
+
}
|
|
215
|
+
}}
|
|
216
|
+
}
|
|
217
|
+
&[data-popper-placement*='left'] .tooltip-arrow::after {
|
|
218
|
+
${({ theme, type, customStylesTPAleftAfter }) => {
|
|
219
|
+
if (theme) {
|
|
220
|
+
let tempObj = {};
|
|
221
|
+
if (theme['tp-cont-left-arrow-before']) {
|
|
222
|
+
for (const property in theme['common']) {
|
|
223
|
+
tempObj[property] = theme['common'][property]
|
|
224
|
+
}
|
|
225
|
+
for (const property in theme['tp-cont-left-arrow-after']) {
|
|
226
|
+
tempObj[property] = theme['tp-cont-left-arrow-after'][property]
|
|
227
|
+
delete theme.common[property]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return { ...tempObj, ...customStylesTPAleftAfter };
|
|
231
|
+
}
|
|
232
|
+
}}
|
|
233
|
+
}
|
|
234
|
+
`;
|
|
235
|
+
|
|
236
|
+
const TooltipArrow = styled.div`
|
|
237
|
+
|
|
238
|
+
${({ theme, type, customStylesTPArrow }) => {
|
|
239
|
+
if (theme) {
|
|
240
|
+
let tempObj = {};
|
|
241
|
+
if (theme['tooltip-arrow']) {
|
|
242
|
+
for (const property in theme['common']) {
|
|
243
|
+
tempObj[property] = theme['common'][property]
|
|
244
|
+
}
|
|
245
|
+
for (const property in theme['tooltip-arrow']) {
|
|
246
|
+
tempObj[property] = theme['tooltip-arrow'][property]
|
|
247
|
+
delete theme.common[property]
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return { ...tempObj, ...customStylesTPArrow };
|
|
251
|
+
}
|
|
252
|
+
}}
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
&::before{
|
|
256
|
+
${({ theme, type, customStylesTPAbefore }) => {
|
|
257
|
+
if (theme) {
|
|
258
|
+
let tempObj = {};
|
|
259
|
+
if (theme['tooltip-arrow-before']) {
|
|
260
|
+
for (const property in theme['common']) {
|
|
261
|
+
tempObj[property] = theme['common'][property]
|
|
262
|
+
}
|
|
263
|
+
for (const property in theme['tooltip-arrow-before']) {
|
|
264
|
+
tempObj[property] = theme['tooltip-arrow-before'][property]
|
|
265
|
+
delete theme.common[property]
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return { ...tempObj, ...customStylesTPAbefore };
|
|
269
|
+
}
|
|
270
|
+
}}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
&::after{
|
|
274
|
+
${({ theme, type, customStylesTPAafter }) => {
|
|
275
|
+
if (theme) {
|
|
276
|
+
let tempObj = {};
|
|
277
|
+
if (theme['tooltip-arrow-after']) {
|
|
278
|
+
for (const property in theme['common']) {
|
|
279
|
+
tempObj[property] = theme['common'][property]
|
|
280
|
+
}
|
|
281
|
+
for (const property in theme['tooltip-arrow-after']) {
|
|
282
|
+
tempObj[property] = theme['tooltip-arrow-after'][property]
|
|
283
|
+
delete theme.common[property]
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return { ...tempObj, ...customStylesTPAafter };
|
|
287
|
+
}
|
|
288
|
+
}}
|
|
289
|
+
}
|
|
290
|
+
`;
|
|
291
|
+
|
|
292
|
+
export const Tooltip = ({
|
|
293
|
+
theme,
|
|
294
|
+
contentTrigger,
|
|
295
|
+
contentTooltip,
|
|
296
|
+
popperOptionsP,
|
|
297
|
+
settings,
|
|
298
|
+
customStylesTPContainer,
|
|
299
|
+
customStylesTPAbottom,
|
|
300
|
+
customStylesTPAbottomBefore,
|
|
301
|
+
customStylesTPAbottomAfter,
|
|
302
|
+
customStylesTPAtop,
|
|
303
|
+
customStylesTPAtopBefore,
|
|
304
|
+
customStylesTPAtopAfter,
|
|
305
|
+
customStylesTPAright,
|
|
306
|
+
customStylesTPArightBefore,
|
|
307
|
+
customStylesTPArightAfter,
|
|
308
|
+
customStylesTPAleft,
|
|
309
|
+
customStylesTPAleftBefore,
|
|
310
|
+
customStylesTPAleftAfter,
|
|
311
|
+
customStylesTPArrow,
|
|
312
|
+
customStylesTPAbefore,
|
|
313
|
+
customStylesTPAafter,
|
|
314
|
+
...props
|
|
315
|
+
}) => {
|
|
316
|
+
|
|
317
|
+
const popperOptions = {
|
|
318
|
+
modifiers: [
|
|
319
|
+
{
|
|
320
|
+
name: 'offset',
|
|
321
|
+
options: {
|
|
322
|
+
offset: [0, 23],
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
strategy: 'absolute'
|
|
327
|
+
, ...popperOptionsP
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const {
|
|
331
|
+
getArrowProps,
|
|
332
|
+
getTooltipProps,
|
|
333
|
+
setTooltipRef,
|
|
334
|
+
setTriggerRef,
|
|
335
|
+
visible,
|
|
336
|
+
} = usePopperTooltip({
|
|
337
|
+
...settings
|
|
338
|
+
}, popperOptions);
|
|
339
|
+
|
|
340
|
+
return (
|
|
341
|
+
<>
|
|
342
|
+
<div ref={setTriggerRef}
|
|
343
|
+
style={{ width: 'fit-content', height: 'fit-content', display: 'inline-block' }}
|
|
344
|
+
>
|
|
345
|
+
{contentTrigger}
|
|
346
|
+
</div>
|
|
347
|
+
{visible && (
|
|
348
|
+
<TooltipContainer
|
|
349
|
+
theme={theme}
|
|
350
|
+
ref={setTooltipRef}
|
|
351
|
+
{...getTooltipProps({ className: 'tooltip-container' })}
|
|
352
|
+
customStylesTPContainer={customStylesTPContainer}
|
|
353
|
+
customStylesTPAbottom={customStylesTPAbottom}
|
|
354
|
+
customStylesTPAbottomBefore={customStylesTPAbottomBefore}
|
|
355
|
+
customStylesTPAbottomAfter={customStylesTPAbottomAfter}
|
|
356
|
+
customStylesTPAtop={customStylesTPAtop}
|
|
357
|
+
customStylesTPAtopBefore={customStylesTPAtopBefore}
|
|
358
|
+
customStylesTPAtopAfter={customStylesTPAtopAfter}
|
|
359
|
+
customStylesTPAright={customStylesTPAright}
|
|
360
|
+
customStylesTPArightBefore={customStylesTPArightBefore}
|
|
361
|
+
customStylesTPArightAfter={customStylesTPArightAfter}
|
|
362
|
+
customStylesTPAleft={customStylesTPAleft}
|
|
363
|
+
customStylesTPAleftBefore={customStylesTPAleftBefore}
|
|
364
|
+
customStylesTPAleftAfter={customStylesTPAleftAfter}
|
|
365
|
+
>
|
|
366
|
+
<TooltipArrow
|
|
367
|
+
theme={theme}
|
|
368
|
+
{...getArrowProps({ className: 'tooltip-arrow' })}
|
|
369
|
+
customStylesTPArrow={customStylesTPArrow}
|
|
370
|
+
customStylesTPAbefore={customStylesTPAbefore}
|
|
371
|
+
customStylesTPAafter={customStylesTPAafter}
|
|
372
|
+
/>
|
|
373
|
+
{contentTooltip}
|
|
374
|
+
</TooltipContainer>
|
|
375
|
+
)}
|
|
376
|
+
</>
|
|
377
|
+
);
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
Tooltip.propTypes = {
|
|
381
|
+
/**
|
|
382
|
+
* Theme object
|
|
383
|
+
*/
|
|
384
|
+
theme: PropTypes.object,
|
|
385
|
+
/**
|
|
386
|
+
* The element where to attach the tooltip
|
|
387
|
+
*/
|
|
388
|
+
contentTrigger: PropTypes.any,
|
|
389
|
+
/**
|
|
390
|
+
* The element to put inside the tooltip
|
|
391
|
+
*/
|
|
392
|
+
contentTooltip: PropTypes.any,
|
|
393
|
+
/**
|
|
394
|
+
* Object to customize the behaviour of the tooltip
|
|
395
|
+
* For more reference see:
|
|
396
|
+
* https://github.com/mohsinulhaq/react-popper-tooltip#readme
|
|
397
|
+
* https://popper.js.org/docs/v2/tutorial/
|
|
398
|
+
*/
|
|
399
|
+
popperOptionsP: PropTypes.object,
|
|
400
|
+
/**
|
|
401
|
+
* Object to customize the settings of the tooltip
|
|
402
|
+
* For more reference see:
|
|
403
|
+
* https://github.com/mohsinulhaq/react-popper-tooltip#readme
|
|
404
|
+
* https://popper.js.org/docs/v2/tutorial/
|
|
405
|
+
*/
|
|
406
|
+
settings: PropTypes.object,
|
|
407
|
+
/**
|
|
408
|
+
* Object to pass custom style to the Tooltip container
|
|
409
|
+
*/
|
|
410
|
+
customStylesTPContainer: PropTypes.object,
|
|
411
|
+
/**
|
|
412
|
+
* Object to pass custom style to the Tooltip arrow bottom
|
|
413
|
+
*/
|
|
414
|
+
customStylesTPAbottom: PropTypes.object,
|
|
415
|
+
/**
|
|
416
|
+
* Object to pass custom style to the Tooltip arrow bottom ::before
|
|
417
|
+
*/
|
|
418
|
+
customStylesTPAbottomBefore: PropTypes.object,
|
|
419
|
+
/**
|
|
420
|
+
* Object to pass custom style to the Tooltip arrow bottom ::after
|
|
421
|
+
*/
|
|
422
|
+
customStylesTPAbottomAfter: PropTypes.object,
|
|
423
|
+
/**
|
|
424
|
+
* Object to pass custom style to the Tooltip arrow top
|
|
425
|
+
*/
|
|
426
|
+
customStylesTPAtop: PropTypes.object,
|
|
427
|
+
/**
|
|
428
|
+
* Object to pass custom style to the Tooltip arrow top ::before
|
|
429
|
+
*/
|
|
430
|
+
customStylesTPAtopBefore: PropTypes.object,
|
|
431
|
+
/**
|
|
432
|
+
* Object to pass custom style to the Tooltip arrow top ::after
|
|
433
|
+
*/
|
|
434
|
+
customStylesTPAtopAfter: PropTypes.object,
|
|
435
|
+
/**
|
|
436
|
+
* Object to pass custom style to the Tooltip arrow right
|
|
437
|
+
*/
|
|
438
|
+
customStylesTPAright: PropTypes.object,
|
|
439
|
+
/**
|
|
440
|
+
* Object to pass custom style to the Tooltip arrow right ::before
|
|
441
|
+
*/
|
|
442
|
+
customStylesTPArightBefore: PropTypes.object,
|
|
443
|
+
/**
|
|
444
|
+
* Object to pass custom style to the Tooltip arrow right ::after
|
|
445
|
+
*/
|
|
446
|
+
customStylesTPArightAfter: PropTypes.object,
|
|
447
|
+
/**
|
|
448
|
+
* Object to pass custom style to the Tooltip arrow left
|
|
449
|
+
*/
|
|
450
|
+
customStylesTPAleft: PropTypes.object,
|
|
451
|
+
/**
|
|
452
|
+
* Object to pass custom style to the Tooltip arrow left ::before
|
|
453
|
+
*/
|
|
454
|
+
customStylesTPAleftBefore: PropTypes.object,
|
|
455
|
+
/**
|
|
456
|
+
* Object to pass custom style to the Tooltip arrow left ::after
|
|
457
|
+
*/
|
|
458
|
+
customStylesTPAleftAfter: PropTypes.object,
|
|
459
|
+
/**
|
|
460
|
+
* Object to pass custom style to the Tooltip arrow
|
|
461
|
+
*/
|
|
462
|
+
customStylesTPArrow: PropTypes.object,
|
|
463
|
+
/**
|
|
464
|
+
* Object to pass custom style to the Tooltip arrow ::before
|
|
465
|
+
*/
|
|
466
|
+
customStylesTPAbefore: PropTypes.object,
|
|
467
|
+
/**
|
|
468
|
+
* Object to pass custom style to the Tooltip arrow ::after
|
|
469
|
+
*/
|
|
470
|
+
customStylesTPAafter: PropTypes.object,
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
Tooltip.defaultProps = {
|
|
474
|
+
theme: defaultStyles,
|
|
475
|
+
contentTrigger: <div>Trigger</div>,
|
|
476
|
+
contentTooltip: <div>I am the tooltip</div>,
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
export default Tooltip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tooltip';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
|
+
import FontStyles from '../global/FontStyle';
|
|
5
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
|
+
|
|
7
|
+
const sizes = {
|
|
8
|
+
xs: {
|
|
9
|
+
fontSize: '12px',
|
|
10
|
+
lineHeight: '120%'
|
|
11
|
+
},
|
|
12
|
+
sm: {
|
|
13
|
+
fontSize: '14px',
|
|
14
|
+
lineHeight: '120%'
|
|
15
|
+
},
|
|
16
|
+
md: {
|
|
17
|
+
fontSize: '16px',
|
|
18
|
+
lineHeight: '140%'
|
|
19
|
+
},
|
|
20
|
+
lg: {
|
|
21
|
+
fontSize: '18px',
|
|
22
|
+
lineHeight: '120%'
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const Box = styled.div`
|
|
27
|
+
color: ${({ theme, text }) => text ? theme.variant[text] : theme.textColor};
|
|
28
|
+
background: ${({ theme, bg }) => bg ? theme.variant[bg] : theme.bgColor};
|
|
29
|
+
font-size: ${({ size }) => sizes[size].fontSize};
|
|
30
|
+
line-height: ${({ size }) => sizes[size].lineHeight};
|
|
31
|
+
`
|
|
32
|
+
|
|
33
|
+
export const Typography = ({ size, children, bg, text, ...props }) => {
|
|
34
|
+
return (
|
|
35
|
+
<Box
|
|
36
|
+
bg={bg}
|
|
37
|
+
text={text}
|
|
38
|
+
size={size}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
<FontStyles />
|
|
42
|
+
{children}
|
|
43
|
+
</Box>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
Typography.propTypes = {
|
|
48
|
+
/**
|
|
49
|
+
* How large should the font be?
|
|
50
|
+
*/
|
|
51
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
52
|
+
/**
|
|
53
|
+
* Text Color variant. primary-1, 2, etc.
|
|
54
|
+
*/
|
|
55
|
+
text: PropTypes.string,
|
|
56
|
+
/**
|
|
57
|
+
* Background Color variant. primary-1, 2, etc.
|
|
58
|
+
*/
|
|
59
|
+
bg: PropTypes.string,
|
|
60
|
+
/**
|
|
61
|
+
* Typography contents
|
|
62
|
+
*/
|
|
63
|
+
children: PropTypes.any,
|
|
64
|
+
/**
|
|
65
|
+
* Theme object
|
|
66
|
+
*/
|
|
67
|
+
theme: PropTypes.object,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
Box.defaultProps = {
|
|
71
|
+
theme: defaultThemeColor,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
Typography.defaultProps = {
|
|
75
|
+
theme: defaultThemeColor,
|
|
76
|
+
size: 'md',
|
|
77
|
+
};
|
|
78
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
export const primaryColor = {
|
|
3
|
+
"primary-1": "#2E56F4",
|
|
4
|
+
"primary-2": "#081348",
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const uiColor = {
|
|
8
|
+
"error": "#DD0000",
|
|
9
|
+
"success": "#00B904 ",
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const neutralColor = {
|
|
13
|
+
"neutral-1": "#39424D",
|
|
14
|
+
"neutral-2": "#929EAC",
|
|
15
|
+
"neutral-3": "#BBC4CF",
|
|
16
|
+
"neutral-4": "#E2E6F5",
|
|
17
|
+
"neutral-5": "#F0F3F8",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const shadeColor = {
|
|
21
|
+
"insight-purple": "#F8F2FF",
|
|
22
|
+
"insight-yellow": "#FFFAF2",
|
|
23
|
+
"error-bg": "#FCF2F2",
|
|
24
|
+
"selection-bg": "#F2F4FE",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const graphColor = {
|
|
28
|
+
"graph-1": "#2E56F4",
|
|
29
|
+
"graph-2": "#00D7F7",
|
|
30
|
+
"graph-3": "#8B2DFF",
|
|
31
|
+
"graph-4": "#FB9A00",
|
|
32
|
+
"graph-5": "#00B904",
|
|
33
|
+
}
|