groundfloor-react-ui 1.2.9 → 1.2.11

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.
Files changed (186) hide show
  1. package/dist/index.es.js +432 -422
  2. package/dist/index.js +459 -449
  3. package/package.json +15 -43
  4. package/rollup.config.js +6 -6
  5. package/assets/fonts/Averta/Averta-Black.woff2 +0 -0
  6. package/assets/fonts/Averta/Averta-BlackItalic.woff2 +0 -0
  7. package/assets/fonts/Averta/Averta-Bold.woff2 +0 -0
  8. package/assets/fonts/Averta/Averta-BoldItalic.woff2 +0 -0
  9. package/assets/fonts/Averta/Averta-ExtraBold.woff2 +0 -0
  10. package/assets/fonts/Averta/Averta-ExtraBoldItalic.woff2 +0 -0
  11. package/assets/fonts/Averta/Averta-ExtraThin.woff2 +0 -0
  12. package/assets/fonts/Averta/Averta-ExtraThinItalic.woff2 +0 -0
  13. package/assets/fonts/Averta/Averta-Light.woff2 +0 -0
  14. package/assets/fonts/Averta/Averta-LightItalic.woff2 +0 -0
  15. package/assets/fonts/Averta/Averta-Regular.woff2 +0 -0
  16. package/assets/fonts/Averta/Averta-RegularItalic.woff2 +0 -0
  17. package/assets/fonts/Averta/Averta-SemiBold.woff2 +0 -0
  18. package/assets/fonts/Averta/Averta-SemiBoldItalic.woff2 +0 -0
  19. package/assets/fonts/Averta/Averta-Thin.woff2 +0 -0
  20. package/assets/fonts/Averta/Averta-ThinItalic.woff2 +0 -0
  21. package/assets/fonts/Beauty/BeautyDemo.woff +0 -0
  22. package/assets/icons/app-logo.svg +0 -3
  23. package/assets/icons/arrow-down.svg +0 -3
  24. package/assets/icons/arrow-rotate.svg +0 -1
  25. package/assets/icons/arrow-up.svg +0 -3
  26. package/assets/icons/bell.svg +0 -3
  27. package/assets/icons/check.svg +0 -3
  28. package/assets/icons/checkmark.svg +0 -3
  29. package/assets/icons/chevron-down.svg +0 -3
  30. package/assets/icons/chevron-left.svg +0 -3
  31. package/assets/icons/chevron-right.svg +0 -3
  32. package/assets/icons/cloud-icon.svg +0 -3
  33. package/assets/icons/connection.svg +0 -3
  34. package/assets/icons/cross-icon.svg +0 -3
  35. package/assets/icons/default.svg +0 -1
  36. package/assets/icons/door-internal-active.svg +0 -1
  37. package/assets/icons/edit-icon.svg +0 -3
  38. package/assets/icons/ellipses-horizontal.svg +0 -3
  39. package/assets/icons/ellipses.svg +0 -3
  40. package/assets/icons/email.svg +0 -3
  41. package/assets/icons/eye-hide-view.svg +0 -1
  42. package/assets/icons/eye-hide.svg +0 -1
  43. package/assets/icons/file-attach-white.svg +0 -3
  44. package/assets/icons/file-attach.svg +0 -3
  45. package/assets/icons/file-icon.svg +0 -1
  46. package/assets/icons/file-upload.svg +0 -3
  47. package/assets/icons/functional-equation-regular.svg +0 -147
  48. package/assets/icons/hamburger-menu.svg +0 -3
  49. package/assets/icons/heart.svg +0 -18
  50. package/assets/icons/image.svg +0 -3
  51. package/assets/icons/info.svg +0 -3
  52. package/assets/icons/jpg-icon.svg +0 -3
  53. package/assets/icons/magnifier.svg +0 -3
  54. package/assets/icons/menu-ellipse-two.svg +0 -1
  55. package/assets/icons/menu-ellipse.svg +0 -53
  56. package/assets/icons/pause-all.svg +0 -1
  57. package/assets/icons/pdf-icon.svg +0 -3
  58. package/assets/icons/pen-icon.svg +0 -3
  59. package/assets/icons/plus-outlined.svg +0 -3
  60. package/assets/icons/resume.svg +0 -1
  61. package/assets/icons/sign-icon.svg +0 -3
  62. package/assets/icons/star.svg +0 -3
  63. package/assets/icons/trash-icon.svg +0 -59
  64. package/assets/icons/triangle-down.svg +0 -3
  65. package/assets/icons/users.svg +0 -11
  66. package/assets/icons/view.svg +0 -3
  67. package/assets/icons/watcher.svg +0 -3
  68. package/assets/icons/zoom-in-white.svg +0 -1
  69. package/assets/styles/global.css +0 -0
  70. package/assets/styles/global.scss +0 -0
  71. package/components/Accordion/Accordion.js +0 -167
  72. package/components/Accordion/AccordionSB.js +0 -170
  73. package/components/Accordion/AccordionSBfooter.js +0 -171
  74. package/components/Accordion/index.js +0 -4
  75. package/components/ArrowBar/ArrowBar.js +0 -276
  76. package/components/ArrowBar/index.js +0 -2
  77. package/components/Avatar/Avatar.js +0 -171
  78. package/components/Avatar/AvatarSB.js +0 -255
  79. package/components/Avatar/AvatarSBfooter.js +0 -279
  80. package/components/Avatar/index.js +0 -4
  81. package/components/Banner/Banner.js +0 -70
  82. package/components/Banner/index.js +0 -2
  83. package/components/Breadcrumb/Breadcrumb.js +0 -225
  84. package/components/Breadcrumb/index.js +0 -2
  85. package/components/Button/PrimaryButton.js +0 -167
  86. package/components/Button/SecondaryButton.js +0 -156
  87. package/components/Button/TinyButton.js +0 -101
  88. package/components/Button/index.js +0 -6
  89. package/components/Cards/Card.js +0 -43
  90. package/components/Cards/CardRef.js +0 -71
  91. package/components/Cards/DocumentCard.js +0 -215
  92. package/components/Cards/index.js +0 -5
  93. package/components/Content/Content.js +0 -50
  94. package/components/Content/index.js +0 -1
  95. package/components/DesignComponent/StyledComponent/StyledComponent.js +0 -326
  96. package/components/DesignComponent/StyledComponent/index.js +0 -1
  97. package/components/DesignComponent/index.js +0 -1
  98. package/components/Divider/Divider.js +0 -56
  99. package/components/Divider/index.js +0 -2
  100. package/components/Drawer/Drawer.js +0 -84
  101. package/components/Drawer/index.js +0 -2
  102. package/components/ErrorBoundary/ErrorBoundary.js +0 -44
  103. package/components/ErrorBoundary/index.js +0 -1
  104. package/components/FilterChip/FilterChip.js +0 -70
  105. package/components/FilterChip/index.js +0 -1
  106. package/components/Footer/Footer.js +0 -57
  107. package/components/Footer/FooterContent.js +0 -98
  108. package/components/Footer/index.js +0 -3
  109. package/components/Form/FormComponent.js +0 -244
  110. package/components/Form/HeaderComponent.js +0 -64
  111. package/components/Form/SubmitComponent.js +0 -63
  112. package/components/Form/index.js +0 -5
  113. package/components/GroupAvatars/GroupAvatars.js +0 -139
  114. package/components/GroupAvatars/index.js +0 -1
  115. package/components/GroupButtons/ButtonPopup.js +0 -191
  116. package/components/GroupButtons/GroupButtons.js +0 -150
  117. package/components/GroupButtons/GroupButtonsPopup.js +0 -163
  118. package/components/GroupButtons/index.js +0 -3
  119. package/components/GroupStatusCircle/GroupStatusCircle.js +0 -135
  120. package/components/GroupStatusCircle/index.js +0 -1
  121. package/components/Header/Header.js +0 -58
  122. package/components/Header/index.js +0 -1
  123. package/components/HyperLink/HyperLink.js +0 -114
  124. package/components/HyperLink/index.js +0 -1
  125. package/components/Icon/Icon.js +0 -176
  126. package/components/Icon/index.js +0 -1
  127. package/components/Images/Image.js +0 -107
  128. package/components/Images/index.js +0 -2
  129. package/components/Inputs/CheckBoxInput.js +0 -341
  130. package/components/Inputs/ColorInput.js +0 -145
  131. package/components/Inputs/DateSelect.js +0 -461
  132. package/components/Inputs/DropdownSelect.js +0 -689
  133. package/components/Inputs/DropzoneInput.js +0 -450
  134. package/components/Inputs/NumericInput.js +0 -177
  135. package/components/Inputs/PasswordInput.js +0 -267
  136. package/components/Inputs/RadioInput.js +0 -292
  137. package/components/Inputs/SearchInput.js +0 -19
  138. package/components/Inputs/Signature.js +0 -369
  139. package/components/Inputs/TextArea.js +0 -214
  140. package/components/Inputs/TextInput.js +0 -251
  141. package/components/Inputs/TimeInput.js +0 -186
  142. package/components/Inputs/ToggleSwitch.js +0 -189
  143. package/components/Inputs/index.js +0 -15
  144. package/components/Label/Label.js +0 -48
  145. package/components/Label/index.js +0 -1
  146. package/components/Loaders/Loader.js +0 -179
  147. package/components/Loaders/index.js +0 -2
  148. package/components/Modal/ModalComp.js +0 -216
  149. package/components/Modal/index.js +0 -1
  150. package/components/Overlay/Overlay.js +0 -158
  151. package/components/Overlay/index.js +0 -1
  152. package/components/Pagination/Pagination.js +0 -59
  153. package/components/Pagination/index.js +0 -1
  154. package/components/ProgressBar/ProgressBar.js +0 -101
  155. package/components/ProgressBar/index.js +0 -1
  156. package/components/ProgressSteps/ProgressSteps.js +0 -121
  157. package/components/ProgressSteps/index.js +0 -1
  158. package/components/Rating/Rating.js +0 -258
  159. package/components/Rating/index.js +0 -1
  160. package/components/SecondaryLink/DarkSecondaryLink.js +0 -97
  161. package/components/SecondaryLink/LightSecondaryLink.js +0 -93
  162. package/components/SecondaryLink/index.js +0 -3
  163. package/components/Sidebar/Navbar.js +0 -306
  164. package/components/Sidebar/Sidebar.js +0 -207
  165. package/components/Sidebar/index.js +0 -3
  166. package/components/StatusChip/PrimaryStatusChip.js +0 -78
  167. package/components/StatusChip/SecondaryStatusChip.js +0 -78
  168. package/components/StatusChip/SlimPrimaryStatusChip.js +0 -92
  169. package/components/StatusChip/SlimSecondaryStatusChip.js +0 -93
  170. package/components/StatusChip/index.js +0 -6
  171. package/components/StatusCircle/StatusCircle.js +0 -64
  172. package/components/StatusCircle/index.js +0 -1
  173. package/components/Tables/Table.js +0 -178
  174. package/components/Tables/index.js +0 -1
  175. package/components/Tooltip/Tooltip.js +0 -581
  176. package/components/Tooltip/index.js +0 -1
  177. package/components/Typography/Typography.js +0 -77
  178. package/components/Typography/index.js +0 -2
  179. package/components/constants/colors.js +0 -33
  180. package/components/constants/defaultStyle.js +0 -804
  181. package/components/constants/defaultThemeColor.js +0 -16
  182. package/components/constants/index.js +0 -7
  183. package/components/constants/utils.js +0 -31
  184. package/components/global/FontStyle.js +0 -131
  185. package/components/global/index.js +0 -1
  186. 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,4 +0,0 @@
1
- export * from './Avatar';
2
- export * from './AvatarSB';
3
- export * from './AvatarSBfooter';
4
-
@@ -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,2 +0,0 @@
1
- export * from './Banner';
2
-
@@ -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
- };
@@ -1,2 +0,0 @@
1
- export * from './Breadcrumb';
2
-