groundfloor-react-ui 1.2.9 → 1.2.10
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/index.es.js +432 -422
- package/dist/index.js +444 -434
- package/package.json +15 -43
- package/rollup.config.js +6 -6
- 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 +0 -3
- package/assets/icons/arrow-down.svg +0 -3
- package/assets/icons/arrow-rotate.svg +0 -1
- package/assets/icons/arrow-up.svg +0 -3
- package/assets/icons/bell.svg +0 -3
- package/assets/icons/check.svg +0 -3
- package/assets/icons/checkmark.svg +0 -3
- package/assets/icons/chevron-down.svg +0 -3
- package/assets/icons/chevron-left.svg +0 -3
- package/assets/icons/chevron-right.svg +0 -3
- package/assets/icons/cloud-icon.svg +0 -3
- package/assets/icons/connection.svg +0 -3
- package/assets/icons/cross-icon.svg +0 -3
- package/assets/icons/default.svg +0 -1
- package/assets/icons/door-internal-active.svg +0 -1
- package/assets/icons/edit-icon.svg +0 -3
- package/assets/icons/ellipses-horizontal.svg +0 -3
- package/assets/icons/ellipses.svg +0 -3
- package/assets/icons/email.svg +0 -3
- package/assets/icons/eye-hide-view.svg +0 -1
- package/assets/icons/eye-hide.svg +0 -1
- package/assets/icons/file-attach-white.svg +0 -3
- package/assets/icons/file-attach.svg +0 -3
- package/assets/icons/file-icon.svg +0 -1
- package/assets/icons/file-upload.svg +0 -3
- package/assets/icons/functional-equation-regular.svg +0 -147
- package/assets/icons/hamburger-menu.svg +0 -3
- package/assets/icons/heart.svg +0 -18
- package/assets/icons/image.svg +0 -3
- package/assets/icons/info.svg +0 -3
- package/assets/icons/jpg-icon.svg +0 -3
- package/assets/icons/magnifier.svg +0 -3
- package/assets/icons/menu-ellipse-two.svg +0 -1
- package/assets/icons/menu-ellipse.svg +0 -53
- package/assets/icons/pause-all.svg +0 -1
- package/assets/icons/pdf-icon.svg +0 -3
- package/assets/icons/pen-icon.svg +0 -3
- package/assets/icons/plus-outlined.svg +0 -3
- package/assets/icons/resume.svg +0 -1
- package/assets/icons/sign-icon.svg +0 -3
- package/assets/icons/star.svg +0 -3
- package/assets/icons/trash-icon.svg +0 -59
- package/assets/icons/triangle-down.svg +0 -3
- package/assets/icons/users.svg +0 -11
- package/assets/icons/view.svg +0 -3
- package/assets/icons/watcher.svg +0 -3
- package/assets/icons/zoom-in-white.svg +0 -1
- package/assets/styles/global.css +0 -0
- package/assets/styles/global.scss +0 -0
- package/components/Accordion/Accordion.js +0 -167
- package/components/Accordion/AccordionSB.js +0 -170
- package/components/Accordion/AccordionSBfooter.js +0 -171
- package/components/Accordion/index.js +0 -4
- package/components/ArrowBar/ArrowBar.js +0 -276
- package/components/ArrowBar/index.js +0 -2
- package/components/Avatar/Avatar.js +0 -171
- package/components/Avatar/AvatarSB.js +0 -255
- package/components/Avatar/AvatarSBfooter.js +0 -279
- package/components/Avatar/index.js +0 -4
- package/components/Banner/Banner.js +0 -70
- package/components/Banner/index.js +0 -2
- package/components/Breadcrumb/Breadcrumb.js +0 -225
- package/components/Breadcrumb/index.js +0 -2
- package/components/Button/PrimaryButton.js +0 -167
- package/components/Button/SecondaryButton.js +0 -156
- package/components/Button/TinyButton.js +0 -101
- package/components/Button/index.js +0 -6
- package/components/Cards/Card.js +0 -43
- package/components/Cards/CardRef.js +0 -71
- package/components/Cards/DocumentCard.js +0 -215
- package/components/Cards/index.js +0 -5
- package/components/Content/Content.js +0 -50
- package/components/Content/index.js +0 -1
- package/components/DesignComponent/StyledComponent/StyledComponent.js +0 -326
- package/components/DesignComponent/StyledComponent/index.js +0 -1
- package/components/DesignComponent/index.js +0 -1
- package/components/Divider/Divider.js +0 -56
- package/components/Divider/index.js +0 -2
- package/components/Drawer/Drawer.js +0 -84
- package/components/Drawer/index.js +0 -2
- package/components/ErrorBoundary/ErrorBoundary.js +0 -44
- package/components/ErrorBoundary/index.js +0 -1
- package/components/FilterChip/FilterChip.js +0 -70
- package/components/FilterChip/index.js +0 -1
- package/components/Footer/Footer.js +0 -57
- package/components/Footer/FooterContent.js +0 -98
- package/components/Footer/index.js +0 -3
- package/components/Form/FormComponent.js +0 -244
- package/components/Form/HeaderComponent.js +0 -64
- package/components/Form/SubmitComponent.js +0 -63
- package/components/Form/index.js +0 -5
- package/components/GroupAvatars/GroupAvatars.js +0 -139
- package/components/GroupAvatars/index.js +0 -1
- package/components/GroupButtons/ButtonPopup.js +0 -191
- package/components/GroupButtons/GroupButtons.js +0 -150
- package/components/GroupButtons/GroupButtonsPopup.js +0 -163
- package/components/GroupButtons/index.js +0 -3
- package/components/GroupStatusCircle/GroupStatusCircle.js +0 -135
- package/components/GroupStatusCircle/index.js +0 -1
- package/components/Header/Header.js +0 -58
- package/components/Header/index.js +0 -1
- package/components/HyperLink/HyperLink.js +0 -114
- package/components/HyperLink/index.js +0 -1
- package/components/Icon/Icon.js +0 -176
- package/components/Icon/index.js +0 -1
- package/components/Images/Image.js +0 -107
- package/components/Images/index.js +0 -2
- package/components/Inputs/CheckBoxInput.js +0 -341
- package/components/Inputs/ColorInput.js +0 -145
- package/components/Inputs/DateSelect.js +0 -461
- package/components/Inputs/DropdownSelect.js +0 -689
- package/components/Inputs/DropzoneInput.js +0 -450
- package/components/Inputs/NumericInput.js +0 -177
- package/components/Inputs/PasswordInput.js +0 -267
- package/components/Inputs/RadioInput.js +0 -292
- package/components/Inputs/SearchInput.js +0 -19
- package/components/Inputs/Signature.js +0 -369
- package/components/Inputs/TextArea.js +0 -214
- package/components/Inputs/TextInput.js +0 -251
- package/components/Inputs/TimeInput.js +0 -186
- package/components/Inputs/ToggleSwitch.js +0 -189
- package/components/Inputs/index.js +0 -15
- package/components/Label/Label.js +0 -48
- package/components/Label/index.js +0 -1
- package/components/Loaders/Loader.js +0 -179
- package/components/Loaders/index.js +0 -2
- package/components/Modal/ModalComp.js +0 -216
- package/components/Modal/index.js +0 -1
- package/components/Overlay/Overlay.js +0 -158
- package/components/Overlay/index.js +0 -1
- package/components/Pagination/Pagination.js +0 -59
- package/components/Pagination/index.js +0 -1
- package/components/ProgressBar/ProgressBar.js +0 -101
- package/components/ProgressBar/index.js +0 -1
- package/components/ProgressSteps/ProgressSteps.js +0 -121
- package/components/ProgressSteps/index.js +0 -1
- package/components/Rating/Rating.js +0 -258
- package/components/Rating/index.js +0 -1
- package/components/SecondaryLink/DarkSecondaryLink.js +0 -97
- package/components/SecondaryLink/LightSecondaryLink.js +0 -93
- package/components/SecondaryLink/index.js +0 -3
- package/components/Sidebar/Navbar.js +0 -306
- package/components/Sidebar/Sidebar.js +0 -207
- package/components/Sidebar/index.js +0 -3
- package/components/StatusChip/PrimaryStatusChip.js +0 -78
- package/components/StatusChip/SecondaryStatusChip.js +0 -78
- package/components/StatusChip/SlimPrimaryStatusChip.js +0 -92
- package/components/StatusChip/SlimSecondaryStatusChip.js +0 -93
- package/components/StatusChip/index.js +0 -6
- package/components/StatusCircle/StatusCircle.js +0 -64
- package/components/StatusCircle/index.js +0 -1
- package/components/Tables/Table.js +0 -178
- package/components/Tables/index.js +0 -1
- package/components/Tooltip/Tooltip.js +0 -581
- package/components/Tooltip/index.js +0 -1
- package/components/Typography/Typography.js +0 -77
- package/components/Typography/index.js +0 -2
- package/components/constants/colors.js +0 -33
- package/components/constants/defaultStyle.js +0 -804
- package/components/constants/defaultThemeColor.js +0 -16
- package/components/constants/index.js +0 -7
- package/components/constants/utils.js +0 -31
- package/components/global/FontStyle.js +0 -131
- package/components/global/index.js +0 -1
- package/index.js +0 -41
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React, { useState } from "react";
|
|
3
|
-
import styled, { css, useTheme } from 'styled-components';
|
|
4
|
-
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
-
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
|
-
import { Image } from '../Images';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Primary UI component for user interaction
|
|
10
|
-
*/
|
|
11
|
-
const StyledContainer = styled.span`
|
|
12
|
-
|
|
13
|
-
${({ inBuiltCss, type, customStyles }) => {
|
|
14
|
-
|
|
15
|
-
if (inBuiltCss) {
|
|
16
|
-
let tempObj = {};
|
|
17
|
-
if (inBuiltCss[type]) {
|
|
18
|
-
for (const property in inBuiltCss['common']) {
|
|
19
|
-
|
|
20
|
-
tempObj[property] = inBuiltCss['common'][property]
|
|
21
|
-
}
|
|
22
|
-
for (const property in inBuiltCss[type]) {
|
|
23
|
-
tempObj[property] = inBuiltCss[type][property]
|
|
24
|
-
delete inBuiltCss.common[property]
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return { ...tempObj, ...customStyles };
|
|
29
|
-
}
|
|
30
|
-
}}
|
|
31
|
-
width: auto;
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
const StyledCircle = styled.div`
|
|
35
|
-
|
|
36
|
-
background-color: ${({ theme }) => theme.primary['primary-1']};
|
|
37
|
-
color: ${({ theme }) => theme.bgColor};
|
|
38
|
-
|
|
39
|
-
${({ inBuiltCss, type, size, customStyles }) => {
|
|
40
|
-
|
|
41
|
-
if (inBuiltCss) {
|
|
42
|
-
let tempObj = {};
|
|
43
|
-
if (inBuiltCss[type]) {
|
|
44
|
-
for (const property in inBuiltCss['common']) {
|
|
45
|
-
tempObj[property] = inBuiltCss['common'][property];
|
|
46
|
-
}
|
|
47
|
-
for (const property in inBuiltCss[type]) {
|
|
48
|
-
tempObj[property] = inBuiltCss[type][property];
|
|
49
|
-
delete inBuiltCss.common[property];
|
|
50
|
-
}
|
|
51
|
-
for (const property in inBuiltCss[`${type}${size}`]) {
|
|
52
|
-
tempObj[property] = inBuiltCss[`${type}${size}`][property];
|
|
53
|
-
delete inBuiltCss.common[property];
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return { ...tempObj, ...customStyles };
|
|
58
|
-
}
|
|
59
|
-
}}
|
|
60
|
-
${({ isSelected, selectedStyle, notSelectedStyle }) => {
|
|
61
|
-
if (isSelected) {
|
|
62
|
-
return css`
|
|
63
|
-
${selectedStyle}
|
|
64
|
-
|
|
65
|
-
min-width: 42px;
|
|
66
|
-
min-height: 42px;
|
|
67
|
-
`;
|
|
68
|
-
} else {
|
|
69
|
-
return css`
|
|
70
|
-
${notSelectedStyle}
|
|
71
|
-
`;
|
|
72
|
-
}
|
|
73
|
-
}}
|
|
74
|
-
font-weight: 600;
|
|
75
|
-
`;
|
|
76
|
-
|
|
77
|
-
//Create the style for the Avatar
|
|
78
|
-
|
|
79
|
-
// let customStylesCircle = {}
|
|
80
|
-
// let customStylesContainer = {}
|
|
81
|
-
// customStylesCircle.border = app.userName === selectedApp.lev1 ? `2px solid rgba(255, 255, 255, 0.3)` : `2px solid #2240CB`
|
|
82
|
-
// customStylesCircle.backgroundColor = app.userName === selectedApp.lev1 ? '#1D36AD' : '#2240CB'
|
|
83
|
-
// customStylesCircle.width = app.userName === selectedApp.lev1 ? '42px' : '38px'
|
|
84
|
-
// customStylesCircle.height = app.userName === selectedApp.lev1 ? '42px' : '38px'
|
|
85
|
-
// customStylesCircle.fontWeight = '600'
|
|
86
|
-
// customStylesContainer.width = 'auto'
|
|
87
|
-
// console.log("customStylesCircle" + i + ": ", customStylesCircle)
|
|
88
|
-
|
|
89
|
-
const StyledName = styled.span`
|
|
90
|
-
|
|
91
|
-
color: ${({ theme }) => theme.textColor};
|
|
92
|
-
|
|
93
|
-
${({ inBuiltCss, type, size, customStyles }) => {
|
|
94
|
-
|
|
95
|
-
if (inBuiltCss) {
|
|
96
|
-
let tempObj = {};
|
|
97
|
-
if (inBuiltCss[type]) {
|
|
98
|
-
for (const property in inBuiltCss['common']) {
|
|
99
|
-
|
|
100
|
-
tempObj[property] = inBuiltCss['common'][property];
|
|
101
|
-
}
|
|
102
|
-
for (const property in inBuiltCss[type]) {
|
|
103
|
-
delete inBuiltCss.common[property];
|
|
104
|
-
tempObj[property] = inBuiltCss[type][property];
|
|
105
|
-
}
|
|
106
|
-
for (const property in inBuiltCss[`${type}${size}`]) {
|
|
107
|
-
tempObj[property] = inBuiltCss[`${type}${size}`][property];
|
|
108
|
-
delete inBuiltCss.common[property];
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return { ...tempObj, ...customStyles };
|
|
113
|
-
}
|
|
114
|
-
}}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
&:hover {
|
|
118
|
-
${({ inBuiltCss, type, size, customStylesHover }) => {
|
|
119
|
-
|
|
120
|
-
if (inBuiltCss) {
|
|
121
|
-
let tempObj = {};
|
|
122
|
-
// if (inBuiltCss[type]) {
|
|
123
|
-
// for (const property in inBuiltCss['common']) {
|
|
124
|
-
// tempObj[property] = inBuiltCss['common'][property]
|
|
125
|
-
// }
|
|
126
|
-
// for (const property in inBuiltCss[type]) {
|
|
127
|
-
// delete inBuiltCss.common[property]
|
|
128
|
-
// tempObj[property] = inBuiltCss[type][property]
|
|
129
|
-
// }
|
|
130
|
-
// for (const property in inBuiltCss[`${type}${size}`]) {
|
|
131
|
-
// tempObj[property] = inBuiltCss[`${type}${size}`][property]
|
|
132
|
-
// delete inBuiltCss.common[property]
|
|
133
|
-
// }
|
|
134
|
-
// }
|
|
135
|
-
return { ...tempObj, ...customStylesHover };
|
|
136
|
-
}
|
|
137
|
-
}}
|
|
138
|
-
}
|
|
139
|
-
`;
|
|
140
|
-
|
|
141
|
-
export const AvatarSBfooter = ({
|
|
142
|
-
|
|
143
|
-
inBuiltCss,
|
|
144
|
-
|
|
145
|
-
customStylesContainer,
|
|
146
|
-
customStylesImage,
|
|
147
|
-
customStylesCircle,
|
|
148
|
-
customStylesName,
|
|
149
|
-
customStylesNameHover,
|
|
150
|
-
size,
|
|
151
|
-
toggleName,
|
|
152
|
-
user,
|
|
153
|
-
border,
|
|
154
|
-
selectedStyle,
|
|
155
|
-
notSelectedStyle,
|
|
156
|
-
isSelected,
|
|
157
|
-
value,
|
|
158
|
-
...props
|
|
159
|
-
}) => {
|
|
160
|
-
|
|
161
|
-
const activeTheme = useTheme() || defaultThemeColor;
|
|
162
|
-
const [avatarStatus, setAvatarStatus] = useState("loading");
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const handleImageStatus = (imageStatus) => {
|
|
166
|
-
setAvatarStatus(imageStatus);
|
|
167
|
-
};
|
|
168
|
-
// console.log('user', user)
|
|
169
|
-
return (
|
|
170
|
-
|
|
171
|
-
<StyledContainer
|
|
172
|
-
border={border}
|
|
173
|
-
theme={activeTheme}
|
|
174
|
-
inBuiltCss={defaultStyles}
|
|
175
|
-
customStyles={customStylesContainer}
|
|
176
|
-
type={'avatarContainer'}
|
|
177
|
-
{...props}
|
|
178
|
-
>
|
|
179
|
-
{user?.url && (
|
|
180
|
-
<Image
|
|
181
|
-
{...props}
|
|
182
|
-
inBuiltCss={defaultStyles}
|
|
183
|
-
customStyles={customStylesImage}
|
|
184
|
-
type={'imageAvatar'}
|
|
185
|
-
size={size}
|
|
186
|
-
alt='user-picture'
|
|
187
|
-
src={user.url}
|
|
188
|
-
handleImageStatus={handleImageStatus}
|
|
189
|
-
style={{
|
|
190
|
-
visibility: avatarStatus !== 'loaded' ? 'hidden' : 'visible',
|
|
191
|
-
}}
|
|
192
|
-
/>
|
|
193
|
-
)}
|
|
194
|
-
|
|
195
|
-
<StyledCircle
|
|
196
|
-
{...props}
|
|
197
|
-
theme={activeTheme}
|
|
198
|
-
inBuiltCss={defaultStyles}
|
|
199
|
-
|
|
200
|
-
type={'avatarCircle'}
|
|
201
|
-
customStyles={customStylesCircle}
|
|
202
|
-
size={size}
|
|
203
|
-
style={{ visibility: avatarStatus !== 'loaded' ? 'visible' : 'hidden' }}
|
|
204
|
-
isSelected={isSelected}
|
|
205
|
-
selectedStyle={selectedStyle}
|
|
206
|
-
notSelectedStyle={notSelectedStyle}
|
|
207
|
-
>
|
|
208
|
-
{value}
|
|
209
|
-
</StyledCircle>
|
|
210
|
-
|
|
211
|
-
{toggleName && (
|
|
212
|
-
<StyledName
|
|
213
|
-
theme={activeTheme}
|
|
214
|
-
{...props}
|
|
215
|
-
inBuiltCss={defaultStyles}
|
|
216
|
-
type={'avatarName'}
|
|
217
|
-
customStyles={customStylesName}
|
|
218
|
-
customStylesHover={customStylesNameHover}
|
|
219
|
-
size={size}
|
|
220
|
-
>
|
|
221
|
-
{user.userName}{' '}
|
|
222
|
-
</StyledName>
|
|
223
|
-
)}
|
|
224
|
-
|
|
225
|
-
</StyledContainer>
|
|
226
|
-
);
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
AvatarSBfooter.propTypes = {
|
|
230
|
-
/**
|
|
231
|
-
* Custom style for circle
|
|
232
|
-
*/
|
|
233
|
-
customStylesCircle: PropTypes.object,
|
|
234
|
-
/**
|
|
235
|
-
* Custom style for name
|
|
236
|
-
*/
|
|
237
|
-
customStylesName: PropTypes.object,
|
|
238
|
-
/**
|
|
239
|
-
* Optional Custom color of the circle
|
|
240
|
-
*/
|
|
241
|
-
customStylesContainer: PropTypes.object,
|
|
242
|
-
/**
|
|
243
|
-
* Optional Custom color of the border circle (if missing no border displayed)
|
|
244
|
-
*/
|
|
245
|
-
customStylesImage: PropTypes.object,
|
|
246
|
-
/**
|
|
247
|
-
* Toggle name visibility
|
|
248
|
-
*/
|
|
249
|
-
toggleName: PropTypes.bool,
|
|
250
|
-
/**
|
|
251
|
-
* How large should the Avatar be?
|
|
252
|
-
*/
|
|
253
|
-
size: PropTypes.oneOf(['SM', 'MD', 'LG']),
|
|
254
|
-
/**
|
|
255
|
-
* Object with user information. To display the user's picture need a key "url". To display the name need a key "userName"
|
|
256
|
-
*/
|
|
257
|
-
user: PropTypes.object,
|
|
258
|
-
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
AvatarSBfooter.defaultProps = {
|
|
262
|
-
/**
|
|
263
|
-
* inBuiltCss object
|
|
264
|
-
*/
|
|
265
|
-
inBuiltCss: PropTypes.object,
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
AvatarSBfooter.defaultProps = {
|
|
269
|
-
inBuiltCss: defaultStyles,
|
|
270
|
-
|
|
271
|
-
block: false,
|
|
272
|
-
size: 'MD',
|
|
273
|
-
toggleName: false,
|
|
274
|
-
user: null,
|
|
275
|
-
customStylesContainer: null,
|
|
276
|
-
customStylesImage: null,
|
|
277
|
-
customStylesCircle: null,
|
|
278
|
-
customStylesName: null,
|
|
279
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled, { useTheme } from 'styled-components';
|
|
4
|
-
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
-
|
|
6
|
-
const BannerWrapper = styled.div`
|
|
7
|
-
color: ${({ theme }) => theme.textColor};
|
|
8
|
-
display: flex;
|
|
9
|
-
background-color: ${({ backgroundColor, theme }) =>
|
|
10
|
-
backgroundColor ? backgroundColor : theme.variant['insight-purple']};
|
|
11
|
-
border-left: 5px solid
|
|
12
|
-
${({ borderColor, theme }) =>
|
|
13
|
-
borderColor ? borderColor : theme.variant['graph-3']};
|
|
14
|
-
padding-left: 28px;
|
|
15
|
-
padding-top: 22px;
|
|
16
|
-
padding-bottom: 22px;
|
|
17
|
-
width: inherit;
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
const BannerContent = styled.div`
|
|
21
|
-
color: ${({ theme }) => theme.textColor};
|
|
22
|
-
display: flex;
|
|
23
|
-
font-size: 16px;
|
|
24
|
-
text-align: left;
|
|
25
|
-
word-wrap: break-word;
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
export const Banner = ({
|
|
29
|
-
backgroundColor,
|
|
30
|
-
borderColor,
|
|
31
|
-
variant,
|
|
32
|
-
children,
|
|
33
|
-
...props
|
|
34
|
-
}) => {
|
|
35
|
-
const activeTheme = useTheme() || defaultThemeColor;
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<>
|
|
39
|
-
<BannerWrapper
|
|
40
|
-
theme={activeTheme}
|
|
41
|
-
backgroundColor={backgroundColor}
|
|
42
|
-
borderColor={borderColor}
|
|
43
|
-
{...props}
|
|
44
|
-
>
|
|
45
|
-
<BannerContent theme={activeTheme} {...props}>
|
|
46
|
-
{children}
|
|
47
|
-
</BannerContent>
|
|
48
|
-
</BannerWrapper>
|
|
49
|
-
</>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
Banner.propTypes = {
|
|
54
|
-
/**
|
|
55
|
-
* background color of the banner
|
|
56
|
-
*/
|
|
57
|
-
backgroundColor: PropTypes.string,
|
|
58
|
-
/**
|
|
59
|
-
* border color of the banner
|
|
60
|
-
*/
|
|
61
|
-
borderColor: PropTypes.string,
|
|
62
|
-
/**
|
|
63
|
-
* What will be rendered inside the bannaer
|
|
64
|
-
*/
|
|
65
|
-
children: PropTypes.any,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
Banner.defaultProps = {
|
|
69
|
-
children: '',
|
|
70
|
-
};
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import styled, { css, useTheme } from 'styled-components';
|
|
4
|
-
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Primary UI component for user interaction
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const StyledBreadcrumb = styled.div`
|
|
11
|
-
background: transparent;
|
|
12
|
-
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
13
|
-
font-size: ${({ isPrimary }) => (isPrimary ? '16px' : '14px')};
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
|
|
17
|
-
${({ isWrap }) => {
|
|
18
|
-
if (isWrap) {
|
|
19
|
-
return css`
|
|
20
|
-
width: ${({ block }) => (block ? 'auto' : 'fit-content')};
|
|
21
|
-
flex-wrap: wrap;
|
|
22
|
-
visibility: visible;
|
|
23
|
-
`;
|
|
24
|
-
} else {
|
|
25
|
-
return css`
|
|
26
|
-
border: 1px solid transparent;
|
|
27
|
-
overflow-x: auto;
|
|
28
|
-
overflow-y: hidden;
|
|
29
|
-
visibility: ${({ isBreadcrumbVisible }) =>
|
|
30
|
-
isBreadcrumbVisible ? 'visible' : 'hidden'};
|
|
31
|
-
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
32
|
-
&::-webkit-scrollbar {
|
|
33
|
-
display: none;
|
|
34
|
-
}
|
|
35
|
-
/* Hide scrollbar for IE, Edge and Firefox */
|
|
36
|
-
&-ms-overflow-style: none; /* IE and Edge */
|
|
37
|
-
scrollbar-width: none; /* Firefox */
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
40
|
-
}};
|
|
41
|
-
|
|
42
|
-
.breadcrumb-icon svg path {
|
|
43
|
-
fill: ${({ theme, variant }) => theme.variant[variant]};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.breadcrumb-icon-separator svg path {
|
|
47
|
-
fill: ${({ theme, variantSeparator }) => theme.variant[variantSeparator]};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.breadcrumb-icon-separator {
|
|
51
|
-
margin: 0 ${({ isPrimary }) => (isPrimary ? '12px' : '7px')};
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
const StyledCombo = styled.div`
|
|
56
|
-
display: flex;
|
|
57
|
-
flex-wrap: nowrap;
|
|
58
|
-
`;
|
|
59
|
-
|
|
60
|
-
const StyledItem = styled.div`
|
|
61
|
-
cursor: ${({ href }) => (href ? 'pointer' : 'default')};
|
|
62
|
-
list-style: none;
|
|
63
|
-
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
64
|
-
white-space: nowrap;
|
|
65
|
-
max-width: 15ch;
|
|
66
|
-
white-space: nowrap;
|
|
67
|
-
overflow: hidden;
|
|
68
|
-
text-overflow: ellipsis;
|
|
69
|
-
|
|
70
|
-
&:hover {
|
|
71
|
-
text-decoration: ${({ href }) => (href ? 'underline' : 'none')};
|
|
72
|
-
}
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
export const Breadcrumb = ({
|
|
76
|
-
wrap,
|
|
77
|
-
block,
|
|
78
|
-
style,
|
|
79
|
-
variant,
|
|
80
|
-
variantSeparator,
|
|
81
|
-
appLogo,
|
|
82
|
-
separator,
|
|
83
|
-
items,
|
|
84
|
-
onClick,
|
|
85
|
-
isPrimary,
|
|
86
|
-
...props
|
|
87
|
-
}) => {
|
|
88
|
-
const activeTheme = useTheme() || defaultThemeColor;
|
|
89
|
-
|
|
90
|
-
const breadcrumbRef = useRef(null);
|
|
91
|
-
|
|
92
|
-
const [isBreadcrumbVisible, setIsBreadcrumbVisible] = useState(undefined);
|
|
93
|
-
|
|
94
|
-
const handleWindowResize = () => {
|
|
95
|
-
if (
|
|
96
|
-
breadcrumbRef?.current?.scrollWidth < breadcrumbRef?.current?.offsetWidth
|
|
97
|
-
) {
|
|
98
|
-
setIsBreadcrumbVisible(true);
|
|
99
|
-
} else {
|
|
100
|
-
setIsBreadcrumbVisible(false);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
handleWindowResize();
|
|
106
|
-
}, [items]);
|
|
107
|
-
|
|
108
|
-
//On component mount add event listener
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
if (!wrap) {
|
|
111
|
-
// Monitor the width of the viewPort to adjust the text of the arrow accordingly
|
|
112
|
-
window.addEventListener('resize', handleWindowResize);
|
|
113
|
-
return () => window.removeEventListener('resize', handleWindowResize);
|
|
114
|
-
}
|
|
115
|
-
}, []);
|
|
116
|
-
|
|
117
|
-
const list = items
|
|
118
|
-
? items.map((item, i) => {
|
|
119
|
-
return (
|
|
120
|
-
<StyledCombo key={item.label}>
|
|
121
|
-
{i === 0 && !appLogo ? null : (
|
|
122
|
-
<div className='breadcrumb-icon-separator'>{separator}</div>
|
|
123
|
-
)}
|
|
124
|
-
<StyledItem
|
|
125
|
-
id={item.id}
|
|
126
|
-
theme={activeTheme}
|
|
127
|
-
onClick={() => {
|
|
128
|
-
if (item.href) onClick(item.href);
|
|
129
|
-
}}
|
|
130
|
-
variant={variant}
|
|
131
|
-
href={item.href}
|
|
132
|
-
title={item.label}
|
|
133
|
-
>
|
|
134
|
-
{/* If label longer than 15chs trim it by css */}
|
|
135
|
-
{item.label}
|
|
136
|
-
</StyledItem>
|
|
137
|
-
</StyledCombo>
|
|
138
|
-
);
|
|
139
|
-
})
|
|
140
|
-
: null;
|
|
141
|
-
|
|
142
|
-
return (
|
|
143
|
-
<StyledBreadcrumb
|
|
144
|
-
theme={activeTheme}
|
|
145
|
-
isWrap={wrap}
|
|
146
|
-
ref={!wrap ? breadcrumbRef : null}
|
|
147
|
-
isBreadcrumbVisible={isBreadcrumbVisible}
|
|
148
|
-
block={block}
|
|
149
|
-
variant={variant}
|
|
150
|
-
variantSeparator={variantSeparator}
|
|
151
|
-
style={style}
|
|
152
|
-
isPrimary={isPrimary}
|
|
153
|
-
{...props}
|
|
154
|
-
>
|
|
155
|
-
{appLogo && <div className='breadcrumb-icon'>{appLogo}</div>}
|
|
156
|
-
{list}
|
|
157
|
-
</StyledBreadcrumb>
|
|
158
|
-
);
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
Breadcrumb.propTypes = {
|
|
162
|
-
/**
|
|
163
|
-
* Color of text. primary-1, 2, error, etc.
|
|
164
|
-
*/
|
|
165
|
-
variant: PropTypes.string,
|
|
166
|
-
/**
|
|
167
|
-
* Color of separator. primary-1, 2, error, etc.
|
|
168
|
-
*/
|
|
169
|
-
variantSeparator: PropTypes.string,
|
|
170
|
-
/**
|
|
171
|
-
* Click handler
|
|
172
|
-
*/
|
|
173
|
-
onClick: PropTypes.func,
|
|
174
|
-
/**
|
|
175
|
-
* Optional Icon element with app icon
|
|
176
|
-
*/
|
|
177
|
-
appLogo: PropTypes.any,
|
|
178
|
-
/**
|
|
179
|
-
* Optional Icon element with separator icon
|
|
180
|
-
*/
|
|
181
|
-
separator: PropTypes.any,
|
|
182
|
-
/**
|
|
183
|
-
* List of the elements of breadcramb
|
|
184
|
-
* ex: [
|
|
185
|
-
{
|
|
186
|
-
href: '/',
|
|
187
|
-
label: 'Home',
|
|
188
|
-
id: '1'
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
href: '/level1',
|
|
192
|
-
label: 'Level 1',
|
|
193
|
-
id: '2'
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
href: null,
|
|
197
|
-
label: 'Level 2',
|
|
198
|
-
id: '3'
|
|
199
|
-
},
|
|
200
|
-
]
|
|
201
|
-
*/
|
|
202
|
-
items: PropTypes.array,
|
|
203
|
-
/**
|
|
204
|
-
* Optional width selector
|
|
205
|
-
*/
|
|
206
|
-
block: PropTypes.bool,
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* If true wrap items when shrink else hide
|
|
210
|
-
*/
|
|
211
|
-
wrap: PropTypes.bool,
|
|
212
|
-
/**
|
|
213
|
-
* If true bigger font and margin, if false it means secondary breadcrum with smaller font and less margin
|
|
214
|
-
*/
|
|
215
|
-
isPrimary: PropTypes.bool,
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
Breadcrumb.defaultProps = {
|
|
219
|
-
variant: 'neutral-2',
|
|
220
|
-
variantSeparator: 'neutral-3',
|
|
221
|
-
block: false,
|
|
222
|
-
onClick: undefined,
|
|
223
|
-
wrap: false,
|
|
224
|
-
isPrimary: true,
|
|
225
|
-
};
|