groundfloor-react-ui 1.2.8 → 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 +461 -430
- package/dist/index.js +469 -438
- 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 -339
- package/components/Inputs/ColorInput.js +0 -145
- package/components/Inputs/DateSelect.js +0 -461
- package/components/Inputs/DropdownSelect.js +0 -690
- package/components/Inputs/DropzoneInput.js +0 -450
- package/components/Inputs/NumericInput.js +0 -166
- package/components/Inputs/PasswordInput.js +0 -242
- 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 -235
- package/components/Inputs/TimeInput.js +0 -186
- package/components/Inputs/ToggleSwitch.js +0 -157
- 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 -801
- 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,63 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from 'react';
|
|
2
|
-
import { PrimaryButton, SecondaryButton } from '../Button';
|
|
3
|
-
import { SubmitButtonContainer } from '../DesignComponent';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const SubmitComponent = ({ formData, onSubmit, onReset, style, ...props }) => {
|
|
7
|
-
|
|
8
|
-
const SubmitInput = (item) => {
|
|
9
|
-
return (
|
|
10
|
-
<PrimaryButton
|
|
11
|
-
block={item.block}
|
|
12
|
-
style={item.style}
|
|
13
|
-
disabled={item.disabled}
|
|
14
|
-
type="submit"
|
|
15
|
-
children={item.children}
|
|
16
|
-
onClick={() => { item.onClick() }} />
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const ResetInput = (item) => {
|
|
21
|
-
return (
|
|
22
|
-
<SecondaryButton
|
|
23
|
-
block={item.block}
|
|
24
|
-
disabled={props.disabled}
|
|
25
|
-
children={item.children}
|
|
26
|
-
onClick={() => { item.onClick() }} />
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const CancelInput = (item) => {
|
|
31
|
-
return (
|
|
32
|
-
<SecondaryButton
|
|
33
|
-
block={item.block}
|
|
34
|
-
disabled={props.disabled}
|
|
35
|
-
children={item.children}
|
|
36
|
-
onClick={() => { item.onClick() }} />
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const submitComponent = (item) => {
|
|
41
|
-
switch (item.type) {
|
|
42
|
-
case 'submit':
|
|
43
|
-
return SubmitInput(item)
|
|
44
|
-
case 'reset':
|
|
45
|
-
return ResetInput(item)
|
|
46
|
-
case 'cancel':
|
|
47
|
-
return CancelInput(item)
|
|
48
|
-
default:
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return <Fragment>
|
|
53
|
-
<SubmitButtonContainer style={style}>
|
|
54
|
-
{formData && formData.map((row, i) => {
|
|
55
|
-
return row.map((item, i) => {
|
|
56
|
-
return submitComponent(item)
|
|
57
|
-
})
|
|
58
|
-
})}
|
|
59
|
-
</SubmitButtonContainer>
|
|
60
|
-
</Fragment>
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
package/components/Form/index.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styled, { useTheme } from 'styled-components';
|
|
4
|
-
import { Avatar } from '../Avatar';
|
|
5
|
-
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
|
-
/**
|
|
7
|
-
* Primary UI component for user interaction
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const StyledContainer = styled.span`
|
|
11
|
-
background: transparent;
|
|
12
|
-
position: relative;
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
|
|
16
|
-
&>span:not(:first-of-type){
|
|
17
|
-
margin-left: -13px;
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
const StyledQty = styled.p`
|
|
22
|
-
color: ${({ theme, variantQty }) => theme.variant[variantQty]};
|
|
23
|
-
margin: 0;
|
|
24
|
-
margin-left: 7px;
|
|
25
|
-
font-size: 16px;
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
export const GroupAvatars = ({ items, block, size, variantCircle, variantName, variantQty, flagName, user, colorCircle, colorBorderCircle, ...props }) => {
|
|
29
|
-
const activeTheme = useTheme() || defaultThemeColor;
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<StyledContainer block={block} {...props}>
|
|
33
|
-
{items?.map((user, i) => {
|
|
34
|
-
|
|
35
|
-
let customStylesCircle = {}
|
|
36
|
-
let customStylesImage = {}
|
|
37
|
-
|
|
38
|
-
if (colorCircle) {
|
|
39
|
-
customStylesCircle.backgroundColor = `${activeTheme.variant[colorCircle]}`
|
|
40
|
-
} else {
|
|
41
|
-
customStylesCircle.backgroundColor = `${activeTheme.variant[variantCircle]}`
|
|
42
|
-
}
|
|
43
|
-
if (i !== 0) {
|
|
44
|
-
customStylesCircle.border = colorBorderCircle ? `2px solid ${colorBorderCircle}` : `2px solid ${activeTheme.variant[variantCircle]}`
|
|
45
|
-
customStylesImage.border = colorBorderCircle ? `2px solid ${colorBorderCircle}` : `2px solid ${activeTheme.variant[variantCircle]}`
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
//If only one user display its avatar and the name
|
|
50
|
-
(items.length === 1) ? (
|
|
51
|
-
<Avatar
|
|
52
|
-
key={user.id}
|
|
53
|
-
// variantCircle={variantCircle}
|
|
54
|
-
customStylesContainer={{ width: 'auto' }}
|
|
55
|
-
customStylesName={{ color: `${activeTheme.variant[{ variantName }]}` }}
|
|
56
|
-
// block={false}
|
|
57
|
-
size={size}
|
|
58
|
-
toggleName={true}
|
|
59
|
-
user={user}
|
|
60
|
-
customStylesCircle={customStylesCircle}
|
|
61
|
-
customStylesImage={customStylesImage}
|
|
62
|
-
// customStylesCircle={colorCircle ? {backgroundColor: `${theme.variant[colorCircle]}`} : {backgroundColor: `${theme.variant[variantCircle]}`}}
|
|
63
|
-
// colorBorderCircle={i !== 0 ? colorBorderCircle : colorCircle ? colorCircle : variantCircle}
|
|
64
|
-
/>) : (i <= 3) ? (
|
|
65
|
-
//else display just the avatar
|
|
66
|
-
<Avatar
|
|
67
|
-
key={user.id}
|
|
68
|
-
// variantCircle={variantCircle}
|
|
69
|
-
// variantName={variantName}
|
|
70
|
-
customStylesContainer={{ width: 'auto' }}
|
|
71
|
-
customStylesName={{ color: `${activeTheme.variant[{ variantName }]}` }}
|
|
72
|
-
// block={false}
|
|
73
|
-
size={size}
|
|
74
|
-
toggleName={false}
|
|
75
|
-
user={user}
|
|
76
|
-
customStylesCircle={customStylesCircle}
|
|
77
|
-
customStylesImage={customStylesImage}
|
|
78
|
-
// colorCircle={colorCircle}
|
|
79
|
-
// colorBorderCircle={i !== 0 ? colorBorderCircle : colorCircle ? colorCircle : variantCircle}
|
|
80
|
-
/>
|
|
81
|
-
//display only 4 avatars if more than 4 users then just display the quantity
|
|
82
|
-
) : (null)
|
|
83
|
-
)
|
|
84
|
-
})}
|
|
85
|
-
{(items.length - 4) > 0 ? (<StyledQty theme={activeTheme} variantQty={variantQty}>+{items.length - 4}</StyledQty>) : null}
|
|
86
|
-
</StyledContainer>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
GroupAvatars.propTypes = {
|
|
91
|
-
/**
|
|
92
|
-
* Background color of circle base on variant. primary-1, 2, error, etc.
|
|
93
|
-
*/
|
|
94
|
-
variantCircle: PropTypes.string,
|
|
95
|
-
/**
|
|
96
|
-
* Color of the text name base on variant. primary-1, 2, error, etc.
|
|
97
|
-
*/
|
|
98
|
-
variantName: PropTypes.string,
|
|
99
|
-
/**
|
|
100
|
-
* How large should the Avatar be?
|
|
101
|
-
*/
|
|
102
|
-
size: PropTypes.oneOf(['SM', 'MD', 'LG']),
|
|
103
|
-
/**
|
|
104
|
-
* Object with user information. To display the user's picture need a key "url". To display the name need a key "userName"
|
|
105
|
-
*/
|
|
106
|
-
user: PropTypes.object,
|
|
107
|
-
/**
|
|
108
|
-
* Theme object
|
|
109
|
-
*/
|
|
110
|
-
theme: PropTypes.object,
|
|
111
|
-
/**
|
|
112
|
-
* Optional Custom color of the circle
|
|
113
|
-
*/
|
|
114
|
-
colorCircle: PropTypes.string,
|
|
115
|
-
/**
|
|
116
|
-
* Optional Custom color of the border circle (if missing no border displayed)
|
|
117
|
-
*/
|
|
118
|
-
colorBorderCircle: PropTypes.string,
|
|
119
|
-
/**
|
|
120
|
-
* Optional variantQty color of the text for the quantity
|
|
121
|
-
*/
|
|
122
|
-
variantQty: PropTypes.string,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
GroupAvatars.defaultProps = {
|
|
128
|
-
variantCircle: 'primary-1',
|
|
129
|
-
variantName: 'primary-2',
|
|
130
|
-
block: false,
|
|
131
|
-
size: 'MD',
|
|
132
|
-
flagName: false,
|
|
133
|
-
user: {
|
|
134
|
-
userName: "1",
|
|
135
|
-
},
|
|
136
|
-
colorCircle: null,
|
|
137
|
-
colorBorderCircle: "#FFFFFF",
|
|
138
|
-
variantQty: 'primary-1'
|
|
139
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './GroupAvatars';
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
4
|
-
import styled, { useTheme } from 'styled-components';
|
|
5
|
-
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Primary UI component for user interaction
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const buttonDisabledBg = '#BBC4CF';
|
|
12
|
-
|
|
13
|
-
const StyledTooltip = styled.div`
|
|
14
|
-
max-width: inherit;
|
|
15
|
-
width: inherit;
|
|
16
|
-
font-size: 14px;
|
|
17
|
-
padding: 4px 8px;
|
|
18
|
-
color: ${({ theme, variantTPtext }) => variantTPtext ? theme.variant[variantTPtext] : '#fff'};
|
|
19
|
-
text-align: center;
|
|
20
|
-
background-color: ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'};
|
|
21
|
-
border-radius: 4px;
|
|
22
|
-
border: 1px solid ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'};
|
|
23
|
-
|
|
24
|
-
&[data-popper-placement*='bottom'] .tooltip-arrow::before {
|
|
25
|
-
border-color: transparent transparent ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'} transparent;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&[data-popper-placement*='bottom'] .tooltip-arrow::after {
|
|
29
|
-
border-color: transparent transparent ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'} transparent;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&[data-popper-placement*='top'] .tooltip-arrow::before {
|
|
33
|
-
border-color: ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'} transparent transparent transparent;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&[data-popper-placement*='top'] .tooltip-arrow::after {
|
|
37
|
-
border-color: ${({ theme, variantTPbg }) => variantTPbg ? theme.variant[variantTPbg] : '#6b747f'} transparent transparent transparent;
|
|
38
|
-
}
|
|
39
|
-
`
|
|
40
|
-
|
|
41
|
-
const StyledButton = styled.div`
|
|
42
|
-
display: flex;
|
|
43
|
-
color: ${({ theme, disabled, variant, variantDisable }) => disabled ? theme.variant[variantDisable] : theme.variant[variant]};
|
|
44
|
-
background: ${({ theme, disabled, bgVariant, variantBgDisable }) => disabled ? theme.variant[variantBgDisable] : theme.variant[bgVariant]};
|
|
45
|
-
justify-content: space-evenly;
|
|
46
|
-
align-items: center;
|
|
47
|
-
cursor: ${({ disabled }) => disabled ? 'not-allowed' : 'pointer'};
|
|
48
|
-
border: none;
|
|
49
|
-
margin: 0;
|
|
50
|
-
padding: 0;
|
|
51
|
-
flex-grow: 1;
|
|
52
|
-
|
|
53
|
-
svg path {
|
|
54
|
-
fill: ${({ theme, disabled, variant, variantDisable }) => disabled ? theme.variant[variantDisable] : theme.variant[variant]};
|
|
55
|
-
}
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
const StyledItem = styled.div`
|
|
59
|
-
display: flex;
|
|
60
|
-
justify-content: space-evenly;
|
|
61
|
-
flex-grow: 1;
|
|
62
|
-
align-items: stretch;
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
export const ButtonPopup = ({ label, index, style, items, variant, borderVariant, bgVariant, variantDisable, variantBgDisable, disabled, divider, indexPrefix, onClick, icon, variantTPtext, variantTPbg, ...props }) => {
|
|
66
|
-
const theme = useTheme() || defaultThemeColor;
|
|
67
|
-
|
|
68
|
-
const {
|
|
69
|
-
getArrowProps,
|
|
70
|
-
getTooltipProps,
|
|
71
|
-
setTooltipRef,
|
|
72
|
-
setTriggerRef,
|
|
73
|
-
visible,
|
|
74
|
-
} = usePopperTooltip();
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<>
|
|
78
|
-
<StyledItem ref={setTriggerRef}
|
|
79
|
-
>
|
|
80
|
-
<StyledButton
|
|
81
|
-
variant={variant}
|
|
82
|
-
borderVariant={borderVariant}
|
|
83
|
-
bgVariant={bgVariant}
|
|
84
|
-
variantDisable={variantDisable}
|
|
85
|
-
variantBgDisable={variantBgDisable}
|
|
86
|
-
// title={item.label}
|
|
87
|
-
disabled={disabled}
|
|
88
|
-
onClick={disabled ? null : () => { onClick(onClick) }}
|
|
89
|
-
>
|
|
90
|
-
{icon}
|
|
91
|
-
</StyledButton>
|
|
92
|
-
{divider}
|
|
93
|
-
</StyledItem>
|
|
94
|
-
{visible && (
|
|
95
|
-
<StyledTooltip
|
|
96
|
-
variantTPtext={variantTPtext}
|
|
97
|
-
variantTPbg={variantTPbg}
|
|
98
|
-
ref={setTooltipRef}
|
|
99
|
-
{...getTooltipProps({ className: 'tooltip-container' })}
|
|
100
|
-
>
|
|
101
|
-
{label}
|
|
102
|
-
<div {...getArrowProps({ className: 'tooltip-arrow' })} />
|
|
103
|
-
</StyledTooltip>
|
|
104
|
-
)}
|
|
105
|
-
</>
|
|
106
|
-
);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
ButtonPopup.propTypes = {
|
|
110
|
-
/**
|
|
111
|
-
* Common color of icons. primary-1, 2, error, etc.
|
|
112
|
-
* If this props is not pass each Icon will have its own color
|
|
113
|
-
*/
|
|
114
|
-
variant: PropTypes.string,
|
|
115
|
-
/**
|
|
116
|
-
* Color of the border. primary-1, 2, error, etc.
|
|
117
|
-
*/
|
|
118
|
-
borderVariant: PropTypes.string,
|
|
119
|
-
/**
|
|
120
|
-
* Color of the background. primary-1, 2, error, etc.
|
|
121
|
-
*/
|
|
122
|
-
bgVariant: PropTypes.string,
|
|
123
|
-
/**
|
|
124
|
-
* Color of icon when disabled. primary-1, 2, error, etc.
|
|
125
|
-
*/
|
|
126
|
-
variantDisable: PropTypes.string,
|
|
127
|
-
/**
|
|
128
|
-
* Color of background when disabled. primary-1, 2, error, etc.
|
|
129
|
-
*/
|
|
130
|
-
variantBgDisable: PropTypes.string,
|
|
131
|
-
/**
|
|
132
|
-
* String to prefix the index number in the map function
|
|
133
|
-
*/
|
|
134
|
-
indexPrefix: PropTypes.string,
|
|
135
|
-
/**
|
|
136
|
-
* Theme object
|
|
137
|
-
*/
|
|
138
|
-
theme: PropTypes.object,
|
|
139
|
-
/**
|
|
140
|
-
* Array of items. Each item must be an object in this format:
|
|
141
|
-
* {
|
|
142
|
-
* label: "Test1",
|
|
143
|
-
* icon: <Icon icon='plus-outlined' size={18} />,
|
|
144
|
-
* disabled: true
|
|
145
|
-
* }
|
|
146
|
-
*/
|
|
147
|
-
items: PropTypes.array,
|
|
148
|
-
/**
|
|
149
|
-
* Optional boolean to disable all buttons
|
|
150
|
-
*/
|
|
151
|
-
allDisabled: PropTypes.bool,
|
|
152
|
-
/**
|
|
153
|
-
* Divider component with vertical prop
|
|
154
|
-
*/
|
|
155
|
-
divider: PropTypes.any,
|
|
156
|
-
/**
|
|
157
|
-
* onClick function to handle click
|
|
158
|
-
*/
|
|
159
|
-
onClick: PropTypes.func,
|
|
160
|
-
/**
|
|
161
|
-
* Color of the text of the tooltip. primary-1, 2, error, etc.
|
|
162
|
-
*/
|
|
163
|
-
variantTPtext: PropTypes.string,
|
|
164
|
-
/**
|
|
165
|
-
* Color of the background of the tooltip. primary-1, 2, error, etc.
|
|
166
|
-
*/
|
|
167
|
-
variantTPbg: PropTypes.string,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
StyledItem.defaultProps = {
|
|
171
|
-
theme: defaultThemeColor,
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
StyledButton.defaultProps = {
|
|
175
|
-
theme: defaultThemeColor,
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
StyledTooltip.defaultProps = {
|
|
179
|
-
theme: defaultThemeColor,
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
ButtonPopup.defaultProps = {
|
|
183
|
-
theme: defaultThemeColor,
|
|
184
|
-
indexPrefix: 'btn-group',
|
|
185
|
-
borderVariant: 'neutral-4',
|
|
186
|
-
bgVariant: 'bgColor',
|
|
187
|
-
variantDisable: 'neutral-2',
|
|
188
|
-
variantBgDisable: 'bgColor',
|
|
189
|
-
variantTPtext: null,
|
|
190
|
-
variantTPbg: null,
|
|
191
|
-
};
|
|
@@ -1,150 +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
|
-
/**
|
|
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
|
-
|