groundfloor-react-ui 1.0.21 → 1.2.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/components/Accordion/Accordion.js +4 -1
- package/components/Accordion/AccordionSB.js +4 -0
- package/components/Accordion/AccordionSBfooter.js +4 -0
- package/components/ArrowBar/ArrowBar.js +1 -1
- package/components/Avatar/AvatarSBfooter.js +40 -6
- package/components/Breadcrumb/Breadcrumb.js +18 -0
- package/components/Button/PrimaryButton.js +8 -0
- package/components/Button/SecondaryButton.js +7 -0
- package/components/Button/TinyButton.js +8 -2
- package/components/DesignComponent/StyledComponent/StyledComponent.js +21 -7
- package/components/Form/FormComponent.js +9 -11
- package/components/Inputs/CheckBoxInput.js +1 -0
- package/components/Inputs/ColorInput.js +144 -0
- package/components/Inputs/DropdownSelect.js +57 -13
- package/components/Inputs/DropzoneInput.js +7 -0
- package/components/Inputs/NumericInput.js +7 -0
- package/components/Inputs/PasswordInput.js +21 -5
- package/components/Inputs/RadioInput.js +22 -3
- package/components/Inputs/SearchInput.js +2 -1
- package/components/Inputs/Signature.js +8 -0
- package/components/Inputs/TextArea.js +7 -0
- package/components/Inputs/TextInput.js +10 -3
- package/components/Inputs/TimeInput.js +7 -1
- package/components/Inputs/ToggleSwitch.js +6 -0
- package/components/Inputs/index.js +10 -9
- package/components/Modal/ModalComp.js +1 -1
- package/components/Tooltip/Tooltip.js +394 -285
- package/components/constants/defaultStyle.js +32 -0
- package/dist/index.es.js +1377 -1307
- package/dist/index.js +1389 -1319
- package/index.js +39 -39
- package/package.json +1 -1
|
@@ -1,292 +1,365 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
4
|
-
import styled from 'styled-components';
|
|
4
|
+
import styled, { useTheme } from 'styled-components';
|
|
5
5
|
import defaultStyles from '../constants/defaultStyle';
|
|
6
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
7
|
+
import getDefaultStyles from '../constants/utils';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Primary UI component for user interaction
|
|
9
11
|
*/
|
|
10
|
-
const TooltipContainer = styled.div`
|
|
11
|
-
${({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
12
|
+
const TooltipContainer = styled.div`
|
|
13
|
+
background-color: ${({ theme }) => theme.bgColor};
|
|
14
|
+
border: 1px solid ${({ theme }) => theme.bgColor};
|
|
15
|
+
color: ${({ theme }) => theme.black},
|
|
16
|
+
${({ inBuiltCss, type, customStylesTPContainer }) => {
|
|
17
|
+
if (inBuiltCss) {
|
|
18
|
+
let tempObj = {};
|
|
19
|
+
if (inBuiltCss['tooltip-container']) {
|
|
20
|
+
for (const property in inBuiltCss['common']) {
|
|
21
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
22
|
+
}
|
|
23
|
+
for (const property in inBuiltCss['tooltip-container']) {
|
|
24
|
+
tempObj[property] = inBuiltCss['tooltip-container'][property]
|
|
25
|
+
delete inBuiltCss.common[property]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return { ...tempObj, ...customStylesTPContainer };
|
|
29
|
+
}
|
|
30
|
+
}}
|
|
31
|
+
|
|
32
|
+
&[data-popper-placement*='bottom'] .tooltip-arrow {
|
|
33
|
+
${({ inBuiltCss, type, customStylesTPAbottom }) => {
|
|
34
|
+
if (inBuiltCss) {
|
|
35
|
+
let tempObj = {};
|
|
36
|
+
if (inBuiltCss['tp-cont-bottom-arrow']) {
|
|
37
|
+
for (const property in inBuiltCss['common']) {
|
|
38
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
39
|
+
}
|
|
40
|
+
for (const property in inBuiltCss['tp-cont-bottom-arrow']) {
|
|
41
|
+
tempObj[property] = inBuiltCss['tp-cont-bottom-arrow'][property]
|
|
42
|
+
delete inBuiltCss.common[property]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return { ...tempObj, ...customStylesTPAbottom };
|
|
46
|
+
}
|
|
47
|
+
}}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&[data-popper-placement*='bottom'] .tooltip-arrow::before {
|
|
51
|
+
border-color: transparent transparent ${({ theme }) => theme.bgColor} transparent;
|
|
52
|
+
${({ inBuiltCss, type, customStylesTPAbottomBefore, theme }) => {
|
|
53
|
+
if (inBuiltCss) {
|
|
54
|
+
let tempObj = {};
|
|
55
|
+
if (inBuiltCss['tp-cont-bottom-arrow-before']) {
|
|
56
|
+
for (const property in inBuiltCss['common']) {
|
|
57
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
58
|
+
}
|
|
59
|
+
for (const property in inBuiltCss['tp-cont-bottom-arrow-before']) {
|
|
60
|
+
tempObj[property] = inBuiltCss['tp-cont-bottom-arrow-before'][property]
|
|
61
|
+
delete inBuiltCss.common[property]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
let customStyles = customStylesTPAbottomBefore ? customStylesTPAbottomBefore : {
|
|
65
|
+
borderColor: `transparent transparent ${theme.primary['primary-1']} transparent`,
|
|
66
|
+
}
|
|
67
|
+
return { ...tempObj, ...customStyles };
|
|
68
|
+
}
|
|
69
|
+
}}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&[data-popper-placement*='bottom'] .tooltip-arrow::after {
|
|
73
|
+
border-color: transparent transparent ${({ theme }) => theme.bgColor} transparent;
|
|
74
|
+
${({ inBuiltCss, type, customStylesTPAbottomAfter, theme }) => {
|
|
75
|
+
if (inBuiltCss) {
|
|
76
|
+
let tempObj = {};
|
|
77
|
+
if (inBuiltCss['tp-cont-bottom-arrow-before']) {
|
|
78
|
+
for (const property in inBuiltCss['common']) {
|
|
79
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
80
|
+
}
|
|
81
|
+
for (const property in inBuiltCss['tp-cont-bottom-arrow-after']) {
|
|
82
|
+
tempObj[property] = inBuiltCss['tp-cont-bottom-arrow-after'][property]
|
|
83
|
+
delete inBuiltCss.common[property]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
let customStyles = customStylesTPAbottomAfter ? customStylesTPAbottomAfter : {
|
|
87
|
+
borderColor: `transparent transparent ${theme.primary['primary-1']} transparent`,
|
|
88
|
+
}
|
|
89
|
+
return { ...tempObj, ...customStyles };
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
}}
|
|
93
|
+
}
|
|
94
|
+
&[data-popper-placement*='top'] .tooltip-arrow {
|
|
95
|
+
${({ inBuiltCss, type, customStylesTPAtop }) => {
|
|
96
|
+
if (inBuiltCss) {
|
|
97
|
+
let tempObj = {};
|
|
98
|
+
if (inBuiltCss['tp-cont-top-arrow']) {
|
|
99
|
+
for (const property in inBuiltCss['common']) {
|
|
100
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
101
|
+
}
|
|
102
|
+
for (const property in inBuiltCss['tp-cont-top-arrow']) {
|
|
103
|
+
tempObj[property] = inBuiltCss['tp-cont-top-arrow'][property]
|
|
104
|
+
delete inBuiltCss.common[property]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return { ...tempObj, ...customStylesTPAtop };
|
|
108
|
+
}
|
|
109
|
+
}}
|
|
110
|
+
}
|
|
111
|
+
&[data-popper-placement*='top'] .tooltip-arrow::before {
|
|
112
|
+
border-color: ${({ theme }) => theme.bgColor} transparent transparent transparent;
|
|
113
|
+
${({ inBuiltCss, type, customStylesTPAtopBefore, theme }) => {
|
|
114
|
+
if (inBuiltCss) {
|
|
115
|
+
let tempObj = {};
|
|
116
|
+
if (inBuiltCss['tp-cont-top-arrow-before']) {
|
|
117
|
+
for (const property in inBuiltCss['common']) {
|
|
118
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
119
|
+
}
|
|
120
|
+
for (const property in inBuiltCss['tp-cont-top-arrow-before']) {
|
|
121
|
+
tempObj[property] = inBuiltCss['tp-cont-top-arrow-before'][property]
|
|
122
|
+
delete inBuiltCss.common[property]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
let customStyles = customStylesTPAtopBefore ? customStylesTPAtopBefore : {
|
|
126
|
+
borderColor: `${theme.primary['primary-1']} transparent transparent transparent`,
|
|
127
|
+
}
|
|
128
|
+
return { ...tempObj, ...customStyles };
|
|
129
|
+
}
|
|
130
|
+
}}
|
|
131
|
+
}
|
|
132
|
+
&[data-popper-placement*='top'] .tooltip-arrow::after {
|
|
133
|
+
border-color: ${({ theme }) => theme.bgColor} transparent transparent transparent;
|
|
134
|
+
${({ inBuiltCss, type, customStylesTPAtopAfter, theme }) => {
|
|
135
|
+
if (inBuiltCss) {
|
|
136
|
+
let tempObj = {};
|
|
137
|
+
if (inBuiltCss['tp-cont-top-arrow-before']) {
|
|
138
|
+
for (const property in inBuiltCss['common']) {
|
|
139
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
140
|
+
}
|
|
141
|
+
for (const property in inBuiltCss['tp-cont-top-arrow-after']) {
|
|
142
|
+
tempObj[property] = inBuiltCss['tp-cont-top-arrow-after'][property]
|
|
143
|
+
delete inBuiltCss.common[property]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let customStyles = customStylesTPAtopAfter ? customStylesTPAtopAfter : {
|
|
148
|
+
borderColor: `${theme.primary['primary-1']} transparent transparent transparent`,
|
|
149
|
+
}
|
|
150
|
+
return { ...tempObj, ...customStyles};
|
|
151
|
+
}
|
|
152
|
+
}}
|
|
153
|
+
}
|
|
154
|
+
&[data-popper-placement*='right'] .tooltip-arrow {
|
|
155
|
+
${({ inBuiltCss, type, customStylesTPAright }) => {
|
|
156
|
+
if (inBuiltCss) {
|
|
157
|
+
let tempObj = {};
|
|
158
|
+
if (inBuiltCss['tp-cont-right-arrow']) {
|
|
159
|
+
for (const property in inBuiltCss['common']) {
|
|
160
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
161
|
+
}
|
|
162
|
+
for (const property in inBuiltCss['tp-cont-right-arrow']) {
|
|
163
|
+
tempObj[property] = inBuiltCss['tp-cont-right-arrow'][property]
|
|
164
|
+
delete inBuiltCss.common[property]
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return { ...tempObj, ...customStylesTPAright };
|
|
168
|
+
}
|
|
169
|
+
}}
|
|
170
|
+
}
|
|
171
|
+
&[data-popper-placement*='right'] .tooltip-arrow::before {
|
|
172
|
+
border-color: transparent ${({ theme }) => theme.bgColor} transparent transparent;
|
|
173
|
+
${({ inBuiltCss, type, customStylesTPArightBefore, theme }) => {
|
|
174
|
+
if (inBuiltCss) {
|
|
175
|
+
let tempObj = {};
|
|
176
|
+
if (inBuiltCss['tp-cont-right-arrow-before']) {
|
|
177
|
+
for (const property in inBuiltCss['common']) {
|
|
178
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
179
|
+
}
|
|
180
|
+
for (const property in inBuiltCss['tp-cont-right-arrow-before']) {
|
|
181
|
+
tempObj[property] = inBuiltCss['tp-cont-right-arrow-before'][property]
|
|
182
|
+
delete inBuiltCss.common[property]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
let customStyles = customStylesTPArightBefore ? customStylesTPArightBefore : {
|
|
186
|
+
borderColor: `transparent ${theme.primary['primary-1']} transparent transparent`,
|
|
187
|
+
}
|
|
188
|
+
return { ...tempObj, ...customStyles };
|
|
189
|
+
|
|
190
|
+
}
|
|
191
|
+
}}
|
|
192
|
+
}
|
|
193
|
+
&[data-popper-placement*='right'] .tooltip-arrow::after {
|
|
194
|
+
border-color: transparent ${({ theme }) => theme.bgColor} transparent transparent;
|
|
195
|
+
${({ inBuiltCss, type, customStylesTPArightAfter, theme }) => {
|
|
196
|
+
if (inBuiltCss) {
|
|
197
|
+
let tempObj = {};
|
|
198
|
+
if (inBuiltCss['tp-cont-right-arrow-before']) {
|
|
199
|
+
for (const property in inBuiltCss['common']) {
|
|
200
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
201
|
+
}
|
|
202
|
+
for (const property in inBuiltCss['tp-cont-right-arrow-after']) {
|
|
203
|
+
tempObj[property] = inBuiltCss['tp-cont-right-arrow-after'][property]
|
|
204
|
+
delete inBuiltCss.common[property]
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
let customStyles = customStylesTPArightAfter ? customStylesTPArightAfter : {
|
|
208
|
+
borderColor: `transparent ${theme.primary['primary-1']} transparent transparent`,
|
|
209
|
+
}
|
|
210
|
+
return { ...tempObj, ...customStyles };
|
|
211
|
+
|
|
212
|
+
}
|
|
213
|
+
}}
|
|
214
|
+
}
|
|
215
|
+
&[data-popper-placement*='left'] .tooltip-arrow {
|
|
216
|
+
${({ inBuiltCss, type, customStylesTPAleft }) => {
|
|
217
|
+
if (inBuiltCss) {
|
|
218
|
+
let tempObj = {};
|
|
219
|
+
if (inBuiltCss['tp-cont-left-arrow']) {
|
|
220
|
+
for (const property in inBuiltCss['common']) {
|
|
221
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
222
|
+
}
|
|
223
|
+
for (const property in inBuiltCss['tp-cont-left-arrow']) {
|
|
224
|
+
tempObj[property] = inBuiltCss['tp-cont-left-arrow'][property]
|
|
225
|
+
delete inBuiltCss.common[property]
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return { ...tempObj, ...customStylesTPAleft };
|
|
229
|
+
}
|
|
230
|
+
}}
|
|
231
|
+
}
|
|
232
|
+
&[data-popper-placement*='left'] .tooltip-arrow::before {
|
|
233
|
+
|
|
234
|
+
border-color: transparent transparent transparent ${({ theme }) => theme.bgColor};
|
|
235
|
+
${({ inBuiltCss, type, customStylesTPAleftBefore, theme }) => {
|
|
236
|
+
if (inBuiltCss) {
|
|
237
|
+
let tempObj = {};
|
|
238
|
+
if (inBuiltCss['tp-cont-left-arrow-before']) {
|
|
239
|
+
for (const property in inBuiltCss['common']) {
|
|
240
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
241
|
+
}
|
|
242
|
+
for (const property in inBuiltCss['tp-cont-left-arrow-before']) {
|
|
243
|
+
tempObj[property] = inBuiltCss['tp-cont-left-arrow-before'][property]
|
|
244
|
+
delete inBuiltCss.common[property]
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
let customStyles = customStylesTPAleftBefore ? customStylesTPAleftBefore : {
|
|
248
|
+
borderColor: `transparent transparent transparent ${theme.primary['primary-1']} `,
|
|
249
|
+
}
|
|
250
|
+
return { ...tempObj, ...customStyles };
|
|
251
|
+
}
|
|
252
|
+
}}
|
|
253
|
+
}
|
|
254
|
+
&[data-popper-placement*='left'] .tooltip-arrow::after {
|
|
255
|
+
border-color: transparent transparent transparent ${({ theme }) => theme.bgColor};
|
|
256
|
+
${({ inBuiltCss, type, customStylesTPAleftAfter, theme }) => {
|
|
257
|
+
if (inBuiltCss) {
|
|
258
|
+
let tempObj = {};
|
|
259
|
+
if (inBuiltCss['tp-cont-left-arrow-before']) {
|
|
260
|
+
for (const property in inBuiltCss['common']) {
|
|
261
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
262
|
+
}
|
|
263
|
+
for (const property in inBuiltCss['tp-cont-left-arrow-after']) {
|
|
264
|
+
tempObj[property] = inBuiltCss['tp-cont-left-arrow-after'][property]
|
|
265
|
+
delete inBuiltCss.common[property]
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
let customStyles = customStylesTPAleftAfter ? customStylesTPAleftAfter : {
|
|
269
|
+
borderColor: `transparent transparent transparent ${theme.primary['primary-1']} `,
|
|
270
|
+
}
|
|
271
|
+
return { ...tempObj, ...customStyles };
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
}}
|
|
275
|
+
}
|
|
276
|
+
`;
|
|
277
|
+
|
|
278
|
+
const TooltipArrow = styled.div`
|
|
279
|
+
|
|
280
|
+
${({ inBuiltCss, type, customStylesTPArrow }) => {
|
|
281
|
+
if (inBuiltCss) {
|
|
282
|
+
let tempObj = {};
|
|
283
|
+
if (inBuiltCss['tooltip-arrow']) {
|
|
284
|
+
for (const property in inBuiltCss['common']) {
|
|
285
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
286
|
+
}
|
|
287
|
+
for (const property in inBuiltCss['tooltip-arrow']) {
|
|
288
|
+
tempObj[property] = inBuiltCss['tooltip-arrow'][property]
|
|
289
|
+
delete inBuiltCss.common[property]
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return { ...tempObj, ...customStylesTPArrow };
|
|
293
|
+
}
|
|
294
|
+
}}
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
&::before{
|
|
298
|
+
${({ inBuiltCss, type, customStylesTPAbefore }) => {
|
|
299
|
+
if (inBuiltCss) {
|
|
300
|
+
let tempObj = {};
|
|
301
|
+
if (inBuiltCss['tooltip-arrow-before']) {
|
|
302
|
+
for (const property in inBuiltCss['common']) {
|
|
303
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
304
|
+
}
|
|
305
|
+
for (const property in inBuiltCss['tooltip-arrow-before']) {
|
|
306
|
+
tempObj[property] = inBuiltCss['tooltip-arrow-before'][property]
|
|
307
|
+
delete inBuiltCss.common[property]
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return { ...tempObj, ...customStylesTPAbefore };
|
|
311
|
+
}
|
|
312
|
+
}}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&::after{
|
|
316
|
+
${({ inBuiltCss, type, customStylesTPAafter }) => {
|
|
317
|
+
if (inBuiltCss) {
|
|
318
|
+
let tempObj = {};
|
|
319
|
+
if (inBuiltCss['tooltip-arrow-after']) {
|
|
320
|
+
for (const property in inBuiltCss['common']) {
|
|
321
|
+
tempObj[property] = inBuiltCss['common'][property]
|
|
322
|
+
}
|
|
323
|
+
for (const property in inBuiltCss['tooltip-arrow-after']) {
|
|
324
|
+
tempObj[property] = inBuiltCss['tooltip-arrow-after'][property]
|
|
325
|
+
delete inBuiltCss.common[property]
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return { ...tempObj, ...customStylesTPAafter };
|
|
329
|
+
}
|
|
330
|
+
}}
|
|
331
|
+
}
|
|
332
|
+
`;
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
const TooltipContent = styled.div`
|
|
336
|
+
|
|
337
|
+
background-color: ${({ theme }) => theme.primary['primary-1']};
|
|
338
|
+
${({ inBuiltCss, defaultTooltipContentStyle }) => {
|
|
339
|
+
return getDefaultStyles(inBuiltCss, defaultTooltipContentStyle);
|
|
340
|
+
}}
|
|
341
|
+
// custom styles
|
|
342
|
+
${({ customContentStyle }) => customContentStyle}
|
|
343
|
+
`
|
|
344
|
+
|
|
345
|
+
const Header = styled.div`
|
|
346
|
+
${({ inBuiltCss, defaultTooltipHeaderStyle }) => {
|
|
347
|
+
return getDefaultStyles(inBuiltCss, defaultTooltipHeaderStyle);
|
|
348
|
+
}}
|
|
349
|
+
// custom styles
|
|
350
|
+
${({ customHeaderStyle }) => customHeaderStyle}
|
|
351
|
+
`
|
|
352
|
+
|
|
353
|
+
const Body = styled.div`
|
|
354
|
+
${({ inBuiltCss, defaultTooltipBodyStyle }) => {
|
|
355
|
+
return getDefaultStyles(inBuiltCss, defaultTooltipBodyStyle);
|
|
356
|
+
}}
|
|
357
|
+
// custom styles
|
|
358
|
+
${({ customBodyStyle }) => customBodyStyle}
|
|
359
|
+
`
|
|
360
|
+
|
|
361
|
+
const Footer = styled.div`
|
|
362
|
+
`
|
|
290
363
|
|
|
291
364
|
export const Tooltip = ({
|
|
292
365
|
inBuiltCss,
|
|
@@ -310,9 +383,17 @@ export const Tooltip = ({
|
|
|
310
383
|
customStylesTPArrow,
|
|
311
384
|
customStylesTPAbefore,
|
|
312
385
|
customStylesTPAafter,
|
|
386
|
+
customTooltipContentStyle,
|
|
387
|
+
customContentStyle,
|
|
388
|
+
customHeaderStyle,
|
|
389
|
+
customBodyStyle,
|
|
390
|
+
headerTooltip,
|
|
391
|
+
footerTooltip,
|
|
313
392
|
...props
|
|
314
393
|
}) => {
|
|
315
394
|
|
|
395
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
396
|
+
|
|
316
397
|
const popperOptions = {
|
|
317
398
|
modifiers: [
|
|
318
399
|
{
|
|
@@ -346,6 +427,7 @@ export const Tooltip = ({
|
|
|
346
427
|
{visible && (
|
|
347
428
|
<TooltipContainer
|
|
348
429
|
inBuiltCss={defaultStyles}
|
|
430
|
+
theme={activeTheme}
|
|
349
431
|
ref={setTooltipRef}
|
|
350
432
|
{...getTooltipProps({ className: 'tooltip-container' })}
|
|
351
433
|
customStylesTPContainer={customStylesTPContainer}
|
|
@@ -369,7 +451,14 @@ export const Tooltip = ({
|
|
|
369
451
|
customStylesTPAbefore={customStylesTPAbefore}
|
|
370
452
|
customStylesTPAafter={customStylesTPAafter}
|
|
371
453
|
/>
|
|
372
|
-
{
|
|
454
|
+
<TooltipContent defaultTooltipContentStyle={'popOver-Content'} theme={activeTheme} inBuiltCss={defaultStyles}
|
|
455
|
+
{...props} customContentStyle={customContentStyle}>
|
|
456
|
+
<Header defaultTooltipHeaderStyle={'popOver-header'} theme={activeTheme} inBuiltCss={defaultStyles}
|
|
457
|
+
{...props} customHeaderStyle={customHeaderStyle}>{headerTooltip}</Header>
|
|
458
|
+
<Body defaultTooltipBodyStyle={'popOver-body'} theme={activeTheme} inBuiltCss={defaultStyles}
|
|
459
|
+
{...props} customBodyStyle={customBodyStyle}>{contentTooltip}</Body>
|
|
460
|
+
<Footer >{footerTooltip}</Footer>
|
|
461
|
+
</TooltipContent>
|
|
373
462
|
</TooltipContainer>
|
|
374
463
|
)}
|
|
375
464
|
</>
|
|
@@ -383,9 +472,17 @@ Tooltip.propTypes = {
|
|
|
383
472
|
*/
|
|
384
473
|
contentTrigger: PropTypes.any,
|
|
385
474
|
/**
|
|
386
|
-
* The element to put inside the tooltip
|
|
475
|
+
* The header element to put inside the tooltip
|
|
387
476
|
*/
|
|
388
|
-
|
|
477
|
+
headerTooltip: PropTypes.any,
|
|
478
|
+
/**
|
|
479
|
+
* The Body element to put inside the tooltip
|
|
480
|
+
*/
|
|
481
|
+
contentTooltip: PropTypes.any,
|
|
482
|
+
/**
|
|
483
|
+
* The footer element to put inside the tooltip
|
|
484
|
+
*/
|
|
485
|
+
footerTooltip: PropTypes.any,
|
|
389
486
|
/**
|
|
390
487
|
* Object to customize the behaviour of the tooltip
|
|
391
488
|
* For more reference see:
|
|
@@ -400,6 +497,15 @@ Tooltip.propTypes = {
|
|
|
400
497
|
* https://popper.js.org/docs/v2/tutorial/
|
|
401
498
|
*/
|
|
402
499
|
settings: PropTypes.object,
|
|
500
|
+
/**
|
|
501
|
+
* Object to pass custom style to the Tooltip container
|
|
502
|
+
*/
|
|
503
|
+
customHeaderStyle: PropTypes.object,
|
|
504
|
+
/**
|
|
505
|
+
* Object to pass custom style to the Tooltip container
|
|
506
|
+
*/
|
|
507
|
+
customBodyStyle: PropTypes.object,
|
|
508
|
+
|
|
403
509
|
/**
|
|
404
510
|
* Object to pass custom style to the Tooltip container
|
|
405
511
|
*/
|
|
@@ -468,5 +574,8 @@ Tooltip.propTypes = {
|
|
|
468
574
|
|
|
469
575
|
Tooltip.defaultProps = {
|
|
470
576
|
contentTrigger: <div>Trigger</div>,
|
|
471
|
-
|
|
577
|
+
headerTooltip: 'Lovely tooltip title',
|
|
578
|
+
contentTooltip: '',
|
|
579
|
+
footerTooltip: '',
|
|
580
|
+
customStylesTPContainer:{border: 'none'},
|
|
472
581
|
};
|