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,192 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
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
|
+
|
|
12
|
+
const buttonDisabledBg = '#BBC4CF';
|
|
13
|
+
|
|
14
|
+
const StyledTooltip = styled.div`
|
|
15
|
+
max-width: inherit;
|
|
16
|
+
width: inherit;
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
padding: 4px 8px;
|
|
19
|
+
color: ${({ theme, variantTPtext }) => variantTPtext ? theme.variant[variantTPtext] : '#fff'};
|
|
20
|
+
text-align: center;
|
|
21
|
+
background-color: ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'};
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
border: 1px solid ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'};
|
|
24
|
+
|
|
25
|
+
&[data-popper-placement*='bottom'] .tooltip-arrow::before {
|
|
26
|
+
border-color: transparent transparent ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'} transparent;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&[data-popper-placement*='bottom'] .tooltip-arrow::after {
|
|
30
|
+
border-color: transparent transparent ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'} transparent;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&[data-popper-placement*='top'] .tooltip-arrow::before {
|
|
34
|
+
border-color: ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'} transparent transparent transparent;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&[data-popper-placement*='top'] .tooltip-arrow::after {
|
|
38
|
+
border-color: ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'} transparent transparent transparent;
|
|
39
|
+
}
|
|
40
|
+
`
|
|
41
|
+
|
|
42
|
+
const StyledButton = styled.div`
|
|
43
|
+
display: flex;
|
|
44
|
+
color: ${({ theme, disabled, variant, variantDisable }) => disabled ? theme.variant[variantDisable] : theme.variant[variant]};
|
|
45
|
+
background: ${({ theme, disabled, bgVariant, variantBgDisable }) => disabled ? theme.variant[variantBgDisable] : theme.variant[bgVariant]};
|
|
46
|
+
justify-content: space-evenly;
|
|
47
|
+
align-items: center;
|
|
48
|
+
cursor: ${({ disabled }) => disabled ? 'not-allowed' : 'pointer'};
|
|
49
|
+
border: none;
|
|
50
|
+
margin: 0;
|
|
51
|
+
padding: 0;
|
|
52
|
+
flex-grow: 1;
|
|
53
|
+
|
|
54
|
+
svg path {
|
|
55
|
+
fill: ${({ theme, disabled, variant, variantDisable }) => disabled ? theme.variant[variantDisable] : theme.variant[variant]};
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
const StyledItem = styled.div`
|
|
60
|
+
display: flex;
|
|
61
|
+
justify-content: space-evenly;
|
|
62
|
+
flex-grow: 1;
|
|
63
|
+
align-items: stretch;
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
export const ButtonPopup = ({ label, index, style, items, variant, borderVariant, bgVariant, variantDisable, variantBgDisable, disabled, divider, indexPrefix, onClick, icon, variantTPtext, variantTPbg, ...props }) => {
|
|
67
|
+
const theme = useTheme() || defaultThemeColor;
|
|
68
|
+
|
|
69
|
+
const {
|
|
70
|
+
getArrowProps,
|
|
71
|
+
getTooltipProps,
|
|
72
|
+
setTooltipRef,
|
|
73
|
+
setTriggerRef,
|
|
74
|
+
visible,
|
|
75
|
+
} = usePopperTooltip();
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
<StyledItem ref={setTriggerRef}
|
|
80
|
+
>
|
|
81
|
+
<StyledButton
|
|
82
|
+
variant={variant}
|
|
83
|
+
borderVariant={borderVariant}
|
|
84
|
+
bgVariant={bgVariant}
|
|
85
|
+
variantDisable={variantDisable}
|
|
86
|
+
variantBgDisable={variantBgDisable}
|
|
87
|
+
// title={item.label}
|
|
88
|
+
disabled={disabled}
|
|
89
|
+
onClick={disabled ? null : () => { onClick(onClick) }}
|
|
90
|
+
>
|
|
91
|
+
{icon}
|
|
92
|
+
</StyledButton>
|
|
93
|
+
{divider}
|
|
94
|
+
</StyledItem>
|
|
95
|
+
{visible && (
|
|
96
|
+
<StyledTooltip
|
|
97
|
+
variantTPtext={variantTPtext}
|
|
98
|
+
variantTPbg={variantTPbg}
|
|
99
|
+
ref={setTooltipRef}
|
|
100
|
+
{...getTooltipProps({ className: 'tooltip-container' })}
|
|
101
|
+
>
|
|
102
|
+
{label}
|
|
103
|
+
<div {...getArrowProps({ className: 'tooltip-arrow' })} />
|
|
104
|
+
</StyledTooltip>
|
|
105
|
+
)}
|
|
106
|
+
</>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
ButtonPopup.propTypes = {
|
|
111
|
+
/**
|
|
112
|
+
* Common color of icons. primary-1, 2, error, etc.
|
|
113
|
+
* If this props is not pass each Icon will have its own color
|
|
114
|
+
*/
|
|
115
|
+
variant: PropTypes.string,
|
|
116
|
+
/**
|
|
117
|
+
* Color of the border. primary-1, 2, error, etc.
|
|
118
|
+
*/
|
|
119
|
+
borderVariant: PropTypes.string,
|
|
120
|
+
/**
|
|
121
|
+
* Color of the background. primary-1, 2, error, etc.
|
|
122
|
+
*/
|
|
123
|
+
bgVariant: PropTypes.string,
|
|
124
|
+
/**
|
|
125
|
+
* Color of icon when disabled. primary-1, 2, error, etc.
|
|
126
|
+
*/
|
|
127
|
+
variantDisable: PropTypes.string,
|
|
128
|
+
/**
|
|
129
|
+
* Color of background when disabled. primary-1, 2, error, etc.
|
|
130
|
+
*/
|
|
131
|
+
variantBgDisable: PropTypes.string,
|
|
132
|
+
/**
|
|
133
|
+
* String to prefix the index number in the map function
|
|
134
|
+
*/
|
|
135
|
+
indexPrefix: PropTypes.string,
|
|
136
|
+
/**
|
|
137
|
+
* Theme object
|
|
138
|
+
*/
|
|
139
|
+
theme: PropTypes.object,
|
|
140
|
+
/**
|
|
141
|
+
* Array of items. Each item must be an object in this format:
|
|
142
|
+
* {
|
|
143
|
+
* label: "Test1",
|
|
144
|
+
* icon: <Icon icon='plus-outlined' size={18} />,
|
|
145
|
+
* disabled: true
|
|
146
|
+
* }
|
|
147
|
+
*/
|
|
148
|
+
items: PropTypes.array,
|
|
149
|
+
/**
|
|
150
|
+
* Optional boolean to disable all buttons
|
|
151
|
+
*/
|
|
152
|
+
allDisabled: PropTypes.bool,
|
|
153
|
+
/**
|
|
154
|
+
* Divider component with vertical prop
|
|
155
|
+
*/
|
|
156
|
+
divider: PropTypes.any,
|
|
157
|
+
/**
|
|
158
|
+
* onClick function to handle click
|
|
159
|
+
*/
|
|
160
|
+
onClick: PropTypes.func,
|
|
161
|
+
/**
|
|
162
|
+
* Color of the text of the tooltip. primary-1, 2, error, etc.
|
|
163
|
+
*/
|
|
164
|
+
variantTPtext: PropTypes.string,
|
|
165
|
+
/**
|
|
166
|
+
* Color of the background of the tooltip. primary-1, 2, error, etc.
|
|
167
|
+
*/
|
|
168
|
+
variantTPbg: PropTypes.string,
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
StyledItem.defaultProps = {
|
|
172
|
+
theme: defaultThemeColor,
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
StyledButton.defaultProps = {
|
|
176
|
+
theme: defaultThemeColor,
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
StyledTooltip.defaultProps = {
|
|
180
|
+
theme: defaultThemeColor,
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
ButtonPopup.defaultProps = {
|
|
184
|
+
theme: defaultThemeColor,
|
|
185
|
+
indexPrefix: 'btn-group',
|
|
186
|
+
borderVariant: 'neutral-4',
|
|
187
|
+
bgVariant: 'bgColor',
|
|
188
|
+
variantDisable: 'neutral-2',
|
|
189
|
+
variantBgDisable: 'bgColor',
|
|
190
|
+
variantTPtext: null,
|
|
191
|
+
variantTPbg: null,
|
|
192
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Primary UI component for user interaction
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const buttonDisabledBg = '#BBC4CF';
|
|
11
|
+
|
|
12
|
+
const StyledContainer = styled.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: space-evenly;
|
|
15
|
+
align-items: stretch;
|
|
16
|
+
height: 42px;
|
|
17
|
+
border: 1px solid ${({ theme, borderVariant }) => theme.variant[borderVariant]};
|
|
18
|
+
border-radius: 3px;
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
const StyledItem = styled.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: space-evenly;
|
|
24
|
+
flex-grow: 1;
|
|
25
|
+
align-items: stretch;
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const StyledButton = styled.div`
|
|
29
|
+
display: flex;
|
|
30
|
+
color: ${({ theme, disabled, variant, variantDisable }) => disabled ? theme.variant[variantDisable] : theme.variant[variant]};
|
|
31
|
+
background: ${({ theme, disabled, bgVariant, variantBgDisable }) => disabled ? theme.variant[variantBgDisable] : theme.variant[bgVariant]};
|
|
32
|
+
justify-content: space-evenly;
|
|
33
|
+
align-items: center;
|
|
34
|
+
cursor: ${({ disabled }) => disabled ? 'not-allowed' : 'pointer'};
|
|
35
|
+
border: none;
|
|
36
|
+
margin: 0;
|
|
37
|
+
padding: 0;
|
|
38
|
+
flex-grow: 1;
|
|
39
|
+
|
|
40
|
+
svg path {
|
|
41
|
+
fill: ${({ theme, disabled, variant, variantDisable }) => disabled ? theme.variant[variantDisable] : theme.variant[variant]};
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
export const GroupButtons = ({ style, items, variant, borderVariant, bgVariant, variantDisable, variantBgDisable, allDisabled, divider, indexPrefix, onClick, ...props }) => {
|
|
46
|
+
const theme = useTheme() || defaultThemeColor;
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<StyledContainer
|
|
50
|
+
variant={variant}
|
|
51
|
+
borderVariant={borderVariant}
|
|
52
|
+
{...props}
|
|
53
|
+
>
|
|
54
|
+
{items?.map((item, i) => {
|
|
55
|
+
return (
|
|
56
|
+
<StyledItem key={indexPrefix.concat(i)}>
|
|
57
|
+
<StyledButton
|
|
58
|
+
variant={variant}
|
|
59
|
+
borderVariant={borderVariant}
|
|
60
|
+
bgVariant={bgVariant}
|
|
61
|
+
variantDisable={variantDisable}
|
|
62
|
+
variantBgDisable={variantBgDisable}
|
|
63
|
+
title={item.label}
|
|
64
|
+
disabled={allDisabled || item.disabled}
|
|
65
|
+
onClick={allDisabled || item.disabled ? null : () => onClick(item.label)}
|
|
66
|
+
>
|
|
67
|
+
{item.icon}
|
|
68
|
+
</StyledButton>
|
|
69
|
+
{items?.length - 1 !== i && divider}
|
|
70
|
+
</StyledItem>
|
|
71
|
+
);
|
|
72
|
+
})}
|
|
73
|
+
</StyledContainer>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
GroupButtons.propTypes = {
|
|
78
|
+
/**
|
|
79
|
+
* Common color of icons. primary-1, 2, error, etc.
|
|
80
|
+
* If this props is not pass each Icon will have its own color
|
|
81
|
+
*/
|
|
82
|
+
variant: PropTypes.string,
|
|
83
|
+
/**
|
|
84
|
+
* Color of the border. primary-1, 2, error, etc.
|
|
85
|
+
*/
|
|
86
|
+
borderVariant: PropTypes.string,
|
|
87
|
+
/**
|
|
88
|
+
* Color of the background. primary-1, 2, error, etc.
|
|
89
|
+
*/
|
|
90
|
+
bgVariant: PropTypes.string,
|
|
91
|
+
/**
|
|
92
|
+
* Color of icon when disabled. primary-1, 2, error, etc.
|
|
93
|
+
*/
|
|
94
|
+
variantDisable: PropTypes.string,
|
|
95
|
+
/**
|
|
96
|
+
* Color of background when disabled. primary-1, 2, error, etc.
|
|
97
|
+
*/
|
|
98
|
+
variantBgDisable: PropTypes.string,
|
|
99
|
+
/**
|
|
100
|
+
* String to prefix the index number in the map function
|
|
101
|
+
*/
|
|
102
|
+
indexPrefix: PropTypes.string,
|
|
103
|
+
/**
|
|
104
|
+
* Theme object
|
|
105
|
+
*/
|
|
106
|
+
theme: PropTypes.object,
|
|
107
|
+
/**
|
|
108
|
+
* Array of items. Each item must be an object in this format:
|
|
109
|
+
* {
|
|
110
|
+
* label: "Test1",
|
|
111
|
+
* icon: <Icon icon='plus-outlined' size={18} />,
|
|
112
|
+
* disabled: true
|
|
113
|
+
* }
|
|
114
|
+
*/
|
|
115
|
+
items: PropTypes.array,
|
|
116
|
+
/**
|
|
117
|
+
* Optional boolean to disable all buttons
|
|
118
|
+
*/
|
|
119
|
+
allDisabled: PropTypes.bool,
|
|
120
|
+
/**
|
|
121
|
+
* Divider component with vertical prop
|
|
122
|
+
*/
|
|
123
|
+
divider: PropTypes.any,
|
|
124
|
+
/**
|
|
125
|
+
* onClick function to handle click
|
|
126
|
+
*/
|
|
127
|
+
onClick: PropTypes.func,
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
StyledContainer.defaultProps = {
|
|
131
|
+
theme: defaultThemeColor,
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
StyledItem.defaultProps = {
|
|
135
|
+
theme: defaultThemeColor,
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
StyledButton.defaultProps = {
|
|
139
|
+
theme: defaultThemeColor,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
GroupButtons.defaultProps = {
|
|
143
|
+
theme: defaultThemeColor,
|
|
144
|
+
indexPrefix: 'btn-group',
|
|
145
|
+
borderVariant: 'neutral-4',
|
|
146
|
+
bgVariant: 'bgColor',
|
|
147
|
+
variantDisable: 'neutral-2',
|
|
148
|
+
variantBgDisable: 'bgColor',
|
|
149
|
+
};
|
|
150
|
+
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
+
import { ButtonPopup } from './ButtonPopup';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Primary UI component for user interaction
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const buttonDisabledBg = '#BBC4CF';
|
|
12
|
+
|
|
13
|
+
const StyledContainer = styled.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: space-evenly;
|
|
16
|
+
align-items: stretch;
|
|
17
|
+
height: 42px;
|
|
18
|
+
border: 1px solid ${({ theme, borderVariant }) => theme.variant[borderVariant]};
|
|
19
|
+
border-radius: 3px;
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const StyledTooltip = styled.div`
|
|
23
|
+
background-color: indianred;
|
|
24
|
+
visibility: hidden;
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
const StyledItem = styled.div`
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: space-evenly;
|
|
31
|
+
flex-grow: 1;
|
|
32
|
+
align-items: stretch;
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
const StyledButton = styled.div`
|
|
36
|
+
display: flex;
|
|
37
|
+
color: ${({ theme, disabled, variant, variantDisable }) => disabled ? theme.variant[variantDisable] : theme.variant[variant]};
|
|
38
|
+
background: ${({ theme, disabled, bgVariant, variantBgDisable }) => disabled ? theme.variant[variantBgDisable] : theme.variant[bgVariant]};
|
|
39
|
+
justify-content: space-evenly;
|
|
40
|
+
align-items: center;
|
|
41
|
+
cursor: ${({ disabled }) => disabled ? 'not-allowed' : 'pointer'};
|
|
42
|
+
border: none;
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0;
|
|
45
|
+
flex-grow: 1;
|
|
46
|
+
|
|
47
|
+
svg path {
|
|
48
|
+
fill: ${({ theme, disabled, variant, variantDisable }) => disabled ? theme.variant[variantDisable] : theme.variant[variant]};
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
export const GroupButtonsPopup = ({ style, items, variant, borderVariant, bgVariant, variantDisable, variantBgDisable, allDisabled, divider, indexPrefix, onClick, variantTPtext, variantTPbg, ...props }) => {
|
|
53
|
+
const theme = useTheme() || defaultThemeColor;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<StyledContainer
|
|
57
|
+
variant={variant}
|
|
58
|
+
borderVariant={borderVariant}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
{items?.map((item, i) => {
|
|
62
|
+
return (
|
|
63
|
+
<ButtonPopup
|
|
64
|
+
key={indexPrefix.concat(i)}
|
|
65
|
+
variant={variant}
|
|
66
|
+
borderVariant={borderVariant}
|
|
67
|
+
bgVariant={bgVariant}
|
|
68
|
+
variantDisable={variantDisable}
|
|
69
|
+
variantBgDisable={variantBgDisable}
|
|
70
|
+
// title={item.label}
|
|
71
|
+
disabled={allDisabled || item.disabled}
|
|
72
|
+
onClick={allDisabled || item.disabled ? null : () => { onClick(item.label) }}
|
|
73
|
+
divider={items?.length - 1 !== i && divider}
|
|
74
|
+
icon={item.icon}
|
|
75
|
+
index={i}
|
|
76
|
+
label={item.label}
|
|
77
|
+
variantTPtext={variantTPtext}
|
|
78
|
+
variantTPbg={variantTPbg}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
})}
|
|
82
|
+
</StyledContainer>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
GroupButtonsPopup.propTypes = {
|
|
87
|
+
/**
|
|
88
|
+
* Common color of icons. primary-1, 2, error, etc.
|
|
89
|
+
* If this props is not pass each Icon will have its own color
|
|
90
|
+
*/
|
|
91
|
+
variant: PropTypes.string,
|
|
92
|
+
/**
|
|
93
|
+
* Color of the border. primary-1, 2, error, etc.
|
|
94
|
+
*/
|
|
95
|
+
borderVariant: PropTypes.string,
|
|
96
|
+
/**
|
|
97
|
+
* Color of the background. primary-1, 2, error, etc.
|
|
98
|
+
*/
|
|
99
|
+
bgVariant: PropTypes.string,
|
|
100
|
+
/**
|
|
101
|
+
* Color of icon when disabled. primary-1, 2, error, etc.
|
|
102
|
+
*/
|
|
103
|
+
variantDisable: PropTypes.string,
|
|
104
|
+
/**
|
|
105
|
+
* Color of background when disabled. primary-1, 2, error, etc.
|
|
106
|
+
*/
|
|
107
|
+
variantBgDisable: PropTypes.string,
|
|
108
|
+
/**
|
|
109
|
+
* String to prefix the index number in the map function
|
|
110
|
+
*/
|
|
111
|
+
indexPrefix: PropTypes.string,
|
|
112
|
+
/**
|
|
113
|
+
* Theme object
|
|
114
|
+
*/
|
|
115
|
+
theme: PropTypes.object,
|
|
116
|
+
/**
|
|
117
|
+
* Array of items. Each item must be an object in this format:
|
|
118
|
+
* {
|
|
119
|
+
* label: "Test1",
|
|
120
|
+
* icon: <Icon icon='plus-outlined' size={18} />,
|
|
121
|
+
* disabled: true
|
|
122
|
+
* }
|
|
123
|
+
*/
|
|
124
|
+
items: PropTypes.array,
|
|
125
|
+
/**
|
|
126
|
+
* Optional boolean to disable all buttons
|
|
127
|
+
*/
|
|
128
|
+
allDisabled: PropTypes.bool,
|
|
129
|
+
/**
|
|
130
|
+
* Divider component with vertical prop
|
|
131
|
+
*/
|
|
132
|
+
divider: PropTypes.any,
|
|
133
|
+
/**
|
|
134
|
+
* onClick function to handle click
|
|
135
|
+
*/
|
|
136
|
+
onClick: PropTypes.func,
|
|
137
|
+
/**
|
|
138
|
+
* Color of the text of the tooltip. primary-1, 2, error, etc.
|
|
139
|
+
*/
|
|
140
|
+
variantTPtext: PropTypes.string,
|
|
141
|
+
/**
|
|
142
|
+
* Color of the background of the tooltip. primary-1, 2, error, etc.
|
|
143
|
+
*/
|
|
144
|
+
variantTPbg: PropTypes.string,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
StyledContainer.defaultProps = {
|
|
148
|
+
theme: defaultThemeColor,
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
StyledItem.defaultProps = {
|
|
152
|
+
theme: defaultThemeColor,
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
StyledButton.defaultProps = {
|
|
156
|
+
theme: defaultThemeColor,
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
GroupButtonsPopup.defaultProps = {
|
|
160
|
+
theme: defaultThemeColor,
|
|
161
|
+
indexPrefix: 'btn-group',
|
|
162
|
+
borderVariant: 'neutral-4',
|
|
163
|
+
bgVariant: 'bgColor',
|
|
164
|
+
variantDisable: 'neutral-2',
|
|
165
|
+
variantBgDisable: 'bgColor',
|
|
166
|
+
variantTPtext: null,
|
|
167
|
+
variantTPbg: null,
|
|
168
|
+
};
|
|
169
|
+
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
+
import { StatusCircle } from '../StatusCircle';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Primary UI component for user interaction
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const StyledDiv = styled.div`
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
background-color: transparent;
|
|
16
|
+
min-height: 24px;
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
const StyledContainer = styled.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: space-evenly;
|
|
22
|
+
width: 69px;
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
const StyledText = styled.p`
|
|
26
|
+
display: flex;
|
|
27
|
+
color: ${({ theme, variantText, colorText }) => colorText ? colorText : theme.variant[variantText]};
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
margin: 0 5px;
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
export const GroupStatusCircle = ({ style, variantCircle, variantText, level, textArray, colorArray, indexPrefix, colorText, ...props }) => {
|
|
33
|
+
const theme = useTheme() || defaultThemeColor;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<StyledDiv
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
<StyledContainer>
|
|
40
|
+
{[1, 2, 3, 4].map((el, i) => {
|
|
41
|
+
|
|
42
|
+
let colorBorder = '#D4D7E3';
|
|
43
|
+
let colorBg = null;
|
|
44
|
+
let colorBgVariant = null;
|
|
45
|
+
|
|
46
|
+
// Limit level value between 0 and 4
|
|
47
|
+
if (level <= 0) level = 0;
|
|
48
|
+
if (level >= 4) level = 4;
|
|
49
|
+
|
|
50
|
+
if (colorArray) {
|
|
51
|
+
if (level >= el) {
|
|
52
|
+
colorBg = colorArray[level]
|
|
53
|
+
colorBorder = colorArray[level]
|
|
54
|
+
} else {
|
|
55
|
+
colorBg = colorArray[0]
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
//If level 0 cannot apply variant to keep the circle white
|
|
59
|
+
if (level >= el) {
|
|
60
|
+
colorBgVariant = variantCircle
|
|
61
|
+
colorBorder = variantCircle
|
|
62
|
+
} else {
|
|
63
|
+
colorBgVariant = '#FFFFFF'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<StatusCircle
|
|
69
|
+
key={indexPrefix.concat(i)}
|
|
70
|
+
variant={colorBgVariant}
|
|
71
|
+
borderColor={colorBorder}
|
|
72
|
+
bgColor={colorBg}
|
|
73
|
+
size={11}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
})}
|
|
77
|
+
</StyledContainer>
|
|
78
|
+
{textArray && <StyledText variantText={variantText} colorText={colorText}>{textArray[level]}</StyledText>}
|
|
79
|
+
</StyledDiv>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
GroupStatusCircle.propTypes = {
|
|
84
|
+
/**
|
|
85
|
+
* Color of Circle. primary-1, 2, error, etc.
|
|
86
|
+
*/
|
|
87
|
+
variantCircle: PropTypes.string,
|
|
88
|
+
/**
|
|
89
|
+
* Color of Text. primary-1, 2, error, etc.
|
|
90
|
+
*/
|
|
91
|
+
variantText: PropTypes.string,
|
|
92
|
+
/**
|
|
93
|
+
* Level value min 0, max 4
|
|
94
|
+
*/
|
|
95
|
+
level: PropTypes.number,
|
|
96
|
+
/**
|
|
97
|
+
* String to prefix the index number in the map function
|
|
98
|
+
*/
|
|
99
|
+
indexPrefix: PropTypes.string,
|
|
100
|
+
/**
|
|
101
|
+
* Theme object
|
|
102
|
+
*/
|
|
103
|
+
theme: PropTypes.object,
|
|
104
|
+
/**
|
|
105
|
+
* Optional width selector
|
|
106
|
+
*/
|
|
107
|
+
block: PropTypes.bool,
|
|
108
|
+
/**
|
|
109
|
+
* Optional text array. If present the text of each index will be show for the corresponding level
|
|
110
|
+
*/
|
|
111
|
+
textArray: PropTypes.array,
|
|
112
|
+
/**
|
|
113
|
+
* Optional color array. If present the circle color of the level will match the index color of the array.
|
|
114
|
+
* If no colorArray the color of the circles will be the variant color.
|
|
115
|
+
*/
|
|
116
|
+
colorArray: PropTypes.array,
|
|
117
|
+
/**
|
|
118
|
+
* Optional Custom color of the text
|
|
119
|
+
*/
|
|
120
|
+
colorText: PropTypes.string,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
StyledText.defaultProps = {
|
|
124
|
+
theme: defaultThemeColor,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
GroupStatusCircle.defaultProps = {
|
|
128
|
+
theme: defaultThemeColor,
|
|
129
|
+
variantCircle: 'primary-1',
|
|
130
|
+
variantText: 'primary-2',
|
|
131
|
+
block: false,
|
|
132
|
+
level: 0,
|
|
133
|
+
indexPrefix: 'circle-group'
|
|
134
|
+
};
|
|
135
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GroupStatusCircle';
|
|
@@ -0,0 +1,58 @@
|
|
|
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 getDefaultStyles from '../constants/utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Primary UI component for user interaction
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const StyledHeader = styled.header`
|
|
12
|
+
//Set the styles from the default styles object
|
|
13
|
+
${({ theme, type }) => {
|
|
14
|
+
return getDefaultStyles(theme,type);
|
|
15
|
+
}}
|
|
16
|
+
// custom styles
|
|
17
|
+
${({ customStyles }) => customStyles}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
export const Header = ({ theme, type, customStyles, ...props }) => {
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<StyledHeader
|
|
24
|
+
theme={theme}
|
|
25
|
+
type='header'
|
|
26
|
+
customStyles={customStyles}
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
{props.children}
|
|
30
|
+
</StyledHeader>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
Header.propTypes = {
|
|
35
|
+
/**
|
|
36
|
+
* Theme props
|
|
37
|
+
*/
|
|
38
|
+
theme: PropTypes.object,
|
|
39
|
+
/**
|
|
40
|
+
* Custom style object
|
|
41
|
+
*/
|
|
42
|
+
customStyles: PropTypes.object,
|
|
43
|
+
/**
|
|
44
|
+
* Type of the component which define the default style
|
|
45
|
+
*/
|
|
46
|
+
type: PropTypes.string,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
StyledHeader.defaultProps = {
|
|
50
|
+
theme: PropTypes.object,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Header.defaultProps = {
|
|
54
|
+
theme: defaultStyles,
|
|
55
|
+
type: 'header',
|
|
56
|
+
customStyles: null,
|
|
57
|
+
|
|
58
|
+
};
|