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,101 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled, { useTheme } from 'styled-components';
|
|
4
|
-
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
-
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
|
-
import { hexToRGB } from '../constants/utils';
|
|
7
|
-
import { Label } from '../Label';
|
|
8
|
-
|
|
9
|
-
const WrapperDiv = styled.div`
|
|
10
|
-
height: 10px;
|
|
11
|
-
border-radius: 10px;
|
|
12
|
-
margin-top: 13px;
|
|
13
|
-
margin-left: 13px;
|
|
14
|
-
margin-right: 13px;
|
|
15
|
-
width: inherit;
|
|
16
|
-
background-color: ${({ color, theme }) =>
|
|
17
|
-
color ? hexToRGB(color, 0.5) : hexToRGB(theme.primary['primary-1'], 0.5)};
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
const Container = styled.div`
|
|
21
|
-
height: inherit;
|
|
22
|
-
width: inherit;
|
|
23
|
-
transition: width 1s ease-in-out;
|
|
24
|
-
border-radius: inherit;
|
|
25
|
-
text-align: right;
|
|
26
|
-
|
|
27
|
-
// custom styles
|
|
28
|
-
${({ progressBarStyle }) => progressBarStyle}
|
|
29
|
-
width: ${({ now }) => now + '%'};
|
|
30
|
-
background-color: ${({ color, theme }) =>
|
|
31
|
-
color ? color : theme.primary['primary-1']};
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
export const ProgressBar = ({
|
|
35
|
-
labelStyle,
|
|
36
|
-
progressBarStyle,
|
|
37
|
-
label,
|
|
38
|
-
now,
|
|
39
|
-
color,
|
|
40
|
-
...props
|
|
41
|
-
}) => {
|
|
42
|
-
const activeTheme = useTheme() || defaultThemeColor;
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div>
|
|
46
|
-
<Label
|
|
47
|
-
inBuiltCss={defaultStyles}
|
|
48
|
-
customStyles={labelStyle}
|
|
49
|
-
type={'progressbarLabel'}
|
|
50
|
-
text={label}
|
|
51
|
-
{...props}
|
|
52
|
-
/>
|
|
53
|
-
<WrapperDiv
|
|
54
|
-
progressBarStyle={progressBarStyle}
|
|
55
|
-
theme={activeTheme}
|
|
56
|
-
color={color}
|
|
57
|
-
{...props}
|
|
58
|
-
>
|
|
59
|
-
<Container
|
|
60
|
-
progressBarStyle={progressBarStyle}
|
|
61
|
-
now={now}
|
|
62
|
-
theme={activeTheme}
|
|
63
|
-
color={color}
|
|
64
|
-
{...props}
|
|
65
|
-
/>
|
|
66
|
-
</WrapperDiv>
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
ProgressBar.propTypes = {
|
|
72
|
-
/**
|
|
73
|
-
* Custom style of the label of the progressBar
|
|
74
|
-
*/
|
|
75
|
-
labelStyle: PropTypes.object,
|
|
76
|
-
/**
|
|
77
|
-
* Custom style of the progressBar
|
|
78
|
-
*/
|
|
79
|
-
progressBarStyle: PropTypes.object,
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Custom color(HEX format) of the progressBar
|
|
83
|
-
*/
|
|
84
|
-
color: PropTypes.string,
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* label props
|
|
88
|
-
*/
|
|
89
|
-
label: PropTypes.string,
|
|
90
|
-
/**
|
|
91
|
-
* Progress number
|
|
92
|
-
*/
|
|
93
|
-
now: PropTypes.number,
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
ProgressBar.defaultProps = {
|
|
97
|
-
labelStyle: {},
|
|
98
|
-
progressBarStyle: {},
|
|
99
|
-
label: '',
|
|
100
|
-
now: 0,
|
|
101
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ProgressBar';
|
|
@@ -1,121 +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 StyledContainer = styled.div`
|
|
11
|
-
background: transparent;
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
width: ${({ block }) => block ? '100%' : 'fit-content'};
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
const StyledText = styled.div`
|
|
18
|
-
margin: 0;
|
|
19
|
-
color: ${({ theme, variantOff }) => theme.variant[variantOff]};
|
|
20
|
-
white-space: nowrap;
|
|
21
|
-
display: flex;
|
|
22
|
-
justify-content: space-between;
|
|
23
|
-
|
|
24
|
-
&>div{
|
|
25
|
-
font-weight: 600;
|
|
26
|
-
min-width: 13px;
|
|
27
|
-
text-align: center;
|
|
28
|
-
margin-left: 3px;
|
|
29
|
-
margin-right: 3px;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&>div:first-of-type{
|
|
33
|
-
color: ${({ theme, variantOn }) => theme.variant[variantOn]};
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const StyledSteps = styled.div`
|
|
38
|
-
display: flex;
|
|
39
|
-
margin-left: 20px;
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
const StyledStep = styled.div`
|
|
43
|
-
height: 6px;
|
|
44
|
-
width: ${({ widthStep }) => widthStep}px;
|
|
45
|
-
margin: 0 3px;
|
|
46
|
-
background-color: ${({ theme, isActive, variantOn, variantOff }) => isActive ? theme.variant[variantOn] : theme.variant[variantOff]};
|
|
47
|
-
border-radius: 19px;
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
export const ProgressSteps = ({ block, variantOn, variantOff, currentStep, totalSteps, widthStep, style, ...props }) => {
|
|
51
|
-
const theme = useTheme() || defaultThemeColor;
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<StyledContainer block={block} {...props} style={style}>
|
|
55
|
-
<StyledText {...props} variantOn={variantOn} variantOff={variantOff}>Page <div>{currentStep}</div> of <div>{totalSteps}</div></StyledText>
|
|
56
|
-
<StyledSteps {...props} >
|
|
57
|
-
{Array.from(Array(totalSteps).keys()).map((index => {
|
|
58
|
-
return <StyledStep key={'formSteps'.concat(index)} isActive={currentStep === index + 1} variantOn={variantOn} variantOff={variantOff} widthStep={widthStep} />
|
|
59
|
-
}))}
|
|
60
|
-
</StyledSteps>
|
|
61
|
-
</StyledContainer>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
ProgressSteps.propTypes = {
|
|
66
|
-
/**
|
|
67
|
-
* Background color of the step and text active base on variant. primary-1, 2, error, etc.
|
|
68
|
-
*/
|
|
69
|
-
variantOn: PropTypes.string,
|
|
70
|
-
/**
|
|
71
|
-
* Background color of the step and text not active base on variant. primary-1, 2, error, etc.
|
|
72
|
-
*/
|
|
73
|
-
variantOff: PropTypes.string,
|
|
74
|
-
/**
|
|
75
|
-
* Optional Block width
|
|
76
|
-
*/
|
|
77
|
-
block: PropTypes.bool,
|
|
78
|
-
/**
|
|
79
|
-
* Theme object
|
|
80
|
-
*/
|
|
81
|
-
theme: PropTypes.object,
|
|
82
|
-
/**
|
|
83
|
-
* Optional value of the current step
|
|
84
|
-
*/
|
|
85
|
-
currentStep: PropTypes.number,
|
|
86
|
-
/**
|
|
87
|
-
* Optional value of the total steps
|
|
88
|
-
*/
|
|
89
|
-
totalSteps: PropTypes.number,
|
|
90
|
-
/**
|
|
91
|
-
* Optional value of width of each step in px
|
|
92
|
-
*/
|
|
93
|
-
widthStep: PropTypes.number,
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
StyledContainer.defaultProps = {
|
|
97
|
-
theme: defaultThemeColor,
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
StyledText.defaultProps = {
|
|
101
|
-
theme: defaultThemeColor,
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
StyledSteps.defaultProps = {
|
|
105
|
-
theme: defaultThemeColor,
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
StyledStep.defaultProps = {
|
|
109
|
-
theme: defaultThemeColor,
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
ProgressSteps.defaultProps = {
|
|
113
|
-
theme: defaultThemeColor,
|
|
114
|
-
variantOn: 'primary-1',
|
|
115
|
-
variantOff: 'neutral-2',
|
|
116
|
-
block: false,
|
|
117
|
-
currentStep: 1,
|
|
118
|
-
totalSteps: 4,
|
|
119
|
-
widthStep: 43,
|
|
120
|
-
};
|
|
121
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ProgressSteps';
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React, { useEffect, useState } from 'react';
|
|
3
|
-
import styled, { css, useTheme } from 'styled-components';
|
|
4
|
-
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
-
|
|
6
|
-
const StyledContainer = styled.div`
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
display: flex;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
align-items: center;
|
|
11
|
-
width: auto;
|
|
12
|
-
|
|
13
|
-
${({ size }) => css`height: ${size}px;`}
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
const StyledPercentage = styled.div`
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
const StyledStar = styled.div`
|
|
20
|
-
box-sizing: border-box;
|
|
21
|
-
display: flex;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
align-items: center;
|
|
24
|
-
${({ size }) =>
|
|
25
|
-
css`
|
|
26
|
-
width: ${size}px;
|
|
27
|
-
height: ${size}px;
|
|
28
|
-
`}
|
|
29
|
-
cursor: ${({ toggleSet }) => toggleSet ? 'pointer' : 'default'};
|
|
30
|
-
|
|
31
|
-
svg {
|
|
32
|
-
fill: black;
|
|
33
|
-
|
|
34
|
-
${({ size }) =>
|
|
35
|
-
size &&
|
|
36
|
-
css`
|
|
37
|
-
width: ${size}px;
|
|
38
|
-
height: ${size}px;
|
|
39
|
-
`}
|
|
40
|
-
|
|
41
|
-
${({ transform }) =>
|
|
42
|
-
transform &&
|
|
43
|
-
css`
|
|
44
|
-
transform: ${transform};
|
|
45
|
-
`}
|
|
46
|
-
|
|
47
|
-
path {
|
|
48
|
-
${({ color }) =>
|
|
49
|
-
color &&
|
|
50
|
-
css`
|
|
51
|
-
fill: ${color};
|
|
52
|
-
`}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
const Star = ({ theme, toggleSet, slide, color, size, transform, ratingValue, starVal, hover, ...props }) => {
|
|
58
|
-
return (
|
|
59
|
-
<StyledStar
|
|
60
|
-
theme={theme}
|
|
61
|
-
ratingValue={ratingValue}
|
|
62
|
-
starVal={starVal}
|
|
63
|
-
hover={hover}
|
|
64
|
-
toggleSet={toggleSet}
|
|
65
|
-
color={color}
|
|
66
|
-
size={size}
|
|
67
|
-
transform={transform}
|
|
68
|
-
{...props}>
|
|
69
|
-
<svg width="24px" height="24px" viewBox="0 0 24 24" id="star_filled" data-name="star filled" xmlns="http://www.w3.org/2000/svg">
|
|
70
|
-
<defs>
|
|
71
|
-
<clipPath id="starFilled">
|
|
72
|
-
<path id="Star" d="M10,15,4.122,18.09l1.123-6.545L.489,6.91l6.572-.955L10,0l2.939,5.955,6.572.955-4.755,4.635,1.123,6.545Z" transform="translate(2 3)" stroke="#000" strokeMiterlimit="10" strokeWidth="1.5" />
|
|
73
|
-
</clipPath>
|
|
74
|
-
</defs>
|
|
75
|
-
<rect x="0" y="0" fill="rgb(217,217,217)" width="100%" height="100%" clipPath="url(#starFilled)" />
|
|
76
|
-
<rect x={slide} y="0" fill={color} width="100%" height="100%" clipPath="url(#starFilled)" />
|
|
77
|
-
</svg>
|
|
78
|
-
</StyledStar>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function getStarArray(value, maxRange) {
|
|
83
|
-
//Convert the value from the actual range to the 0-5 range for the stars
|
|
84
|
-
let newVal = value * 5 / maxRange;
|
|
85
|
-
const starArr = [];
|
|
86
|
-
const valueStars = newVal;
|
|
87
|
-
//create array of 1 element each element has the value to fill the star
|
|
88
|
-
//convert the value to fill the star into the value to pass to the svg
|
|
89
|
-
//base on the way the svg is donethe range is:
|
|
90
|
-
//slide '-24' 0% 0
|
|
91
|
-
// slide '-12' 50% 0.5
|
|
92
|
-
// slide '0' 100% 1
|
|
93
|
-
for (let i = 0; i < 5; i++) {
|
|
94
|
-
if (newVal - 1 >= 0) {
|
|
95
|
-
starArr.push('0');
|
|
96
|
-
} else if (newVal - 1 < 0 && newVal - 1 > -1) {
|
|
97
|
-
const tmpVal = ((newVal * 24) - 24).toString();
|
|
98
|
-
starArr.push(tmpVal);
|
|
99
|
-
} else {
|
|
100
|
-
starArr.push('-24');
|
|
101
|
-
}
|
|
102
|
-
newVal = newVal - 1;
|
|
103
|
-
}
|
|
104
|
-
return { array: starArr, value: valueStars };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function getPercentage(value, maxRange) {
|
|
108
|
-
//Convert the value from the actual range to the 0-5 range for the stars
|
|
109
|
-
let newVal = value * 100 / maxRange;
|
|
110
|
-
return newVal;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export const Rating = ({
|
|
114
|
-
type,
|
|
115
|
-
customStylesContainer,
|
|
116
|
-
customStylesStar,
|
|
117
|
-
customStylesPercentage,
|
|
118
|
-
color,
|
|
119
|
-
size,
|
|
120
|
-
handleClick,
|
|
121
|
-
transform,
|
|
122
|
-
maxRange,
|
|
123
|
-
value,
|
|
124
|
-
toggleStar,
|
|
125
|
-
toggleSet,
|
|
126
|
-
identifier,
|
|
127
|
-
...props }) => {
|
|
128
|
-
const activeTheme = useTheme() || defaultThemeColor;
|
|
129
|
-
|
|
130
|
-
const [starArr, setStarArr] = useState(undefined);
|
|
131
|
-
const [starVal, setStarVal] = useState(undefined);
|
|
132
|
-
const [percentage, setPercentage] = useState(undefined);
|
|
133
|
-
const [hover, setHover] = useState(undefined);
|
|
134
|
-
|
|
135
|
-
useEffect(() => {
|
|
136
|
-
setStarArr(getStarArray(value, maxRange).array);
|
|
137
|
-
setStarVal(getStarArray(value, maxRange).value);
|
|
138
|
-
setPercentage(getPercentage(value, maxRange));
|
|
139
|
-
}, [value, maxRange]);
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* When hover the stars the actual value is ovveridden by the value of the
|
|
143
|
-
* hover star, but it go back to the original value if no click
|
|
144
|
-
* Also assume that if the original value is not 0 a previous rating was done already
|
|
145
|
-
* therefore cannot give less than 1 star
|
|
146
|
-
*/
|
|
147
|
-
useEffect(() => {
|
|
148
|
-
if (hover) {
|
|
149
|
-
setStarArr(getStarArray(hover, maxRange).array);
|
|
150
|
-
} else {
|
|
151
|
-
setStarArr(getStarArray(value, maxRange).array);
|
|
152
|
-
setStarVal(getStarArray(value, maxRange).value);
|
|
153
|
-
setPercentage(getPercentage(value, maxRange));
|
|
154
|
-
}
|
|
155
|
-
}, [hover]);
|
|
156
|
-
|
|
157
|
-
const stars =
|
|
158
|
-
<>
|
|
159
|
-
{starArr?.map((val, i) => {
|
|
160
|
-
const ratingValue = (i + 1) * 20;
|
|
161
|
-
return (
|
|
162
|
-
<Star
|
|
163
|
-
ratingValue={ratingValue}
|
|
164
|
-
starVal={starVal}
|
|
165
|
-
hover={hover}
|
|
166
|
-
toggleSet={toggleSet}
|
|
167
|
-
onClick={toggleSet ? () => handleClick(ratingValue) : null}
|
|
168
|
-
onMouseEnter={toggleSet ? () => { setHover(ratingValue); } : null}
|
|
169
|
-
onMouseLeave={toggleSet ? () => { setHover(null); } : null}
|
|
170
|
-
slide={val}
|
|
171
|
-
color={color}
|
|
172
|
-
className={'star'}
|
|
173
|
-
size={size}
|
|
174
|
-
transform={transform}
|
|
175
|
-
key={identifier?.concat(i)}
|
|
176
|
-
customStyles={customStylesStar}
|
|
177
|
-
/>
|
|
178
|
-
)
|
|
179
|
-
})
|
|
180
|
-
}
|
|
181
|
-
</>
|
|
182
|
-
|
|
183
|
-
return (
|
|
184
|
-
<StyledContainer customStyles={customStylesContainer} type={type} size={size} {...props} className={'container'} >
|
|
185
|
-
{toggleStar ? stars :
|
|
186
|
-
<StyledPercentage type={type} customStyles={customStylesPercentage}>{percentage}%</StyledPercentage>}
|
|
187
|
-
</StyledContainer>
|
|
188
|
-
)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
Rating.propTypes = {
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Custom style object for container
|
|
195
|
-
*/
|
|
196
|
-
customStylesContainer: PropTypes.object,
|
|
197
|
-
/**
|
|
198
|
-
* Custom style object for start
|
|
199
|
-
*/
|
|
200
|
-
customStylesStar: PropTypes.object,
|
|
201
|
-
/**
|
|
202
|
-
* Custom style object for percentage
|
|
203
|
-
*/
|
|
204
|
-
customStylesPercentage: PropTypes.object,
|
|
205
|
-
/**
|
|
206
|
-
* type of component to define styling
|
|
207
|
-
*/
|
|
208
|
-
type: PropTypes.string,
|
|
209
|
-
/**
|
|
210
|
-
* color of the star when rated
|
|
211
|
-
*/
|
|
212
|
-
color: PropTypes.string,
|
|
213
|
-
/**
|
|
214
|
-
* size of the star
|
|
215
|
-
*/
|
|
216
|
-
size: PropTypes.number,
|
|
217
|
-
/**
|
|
218
|
-
* object to translate the icon if required
|
|
219
|
-
*/
|
|
220
|
-
transform: PropTypes.object,
|
|
221
|
-
/**
|
|
222
|
-
* Function to manage the click of the star
|
|
223
|
-
*/
|
|
224
|
-
handleClick: PropTypes.func,
|
|
225
|
-
/**
|
|
226
|
-
* Value to define the max range. The min is always 0
|
|
227
|
-
*/
|
|
228
|
-
maxRange: PropTypes.number,
|
|
229
|
-
/**
|
|
230
|
-
* Value of the rating
|
|
231
|
-
*/
|
|
232
|
-
value: PropTypes.number,
|
|
233
|
-
/**
|
|
234
|
-
* If true the component display starts, else a number in percentage
|
|
235
|
-
*/
|
|
236
|
-
toggleStar: PropTypes.bool,
|
|
237
|
-
/**
|
|
238
|
-
* If true the user can click on the stars and set a new rating value
|
|
239
|
-
*/
|
|
240
|
-
toggleSet: PropTypes.bool,
|
|
241
|
-
/**
|
|
242
|
-
* String to use as key for the mapping
|
|
243
|
-
*/
|
|
244
|
-
identifier: PropTypes.string,
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
Rating.defaultProps = {
|
|
248
|
-
customStylesContainer: null,
|
|
249
|
-
customStylesStar: null,
|
|
250
|
-
customStylesPercentage: null,
|
|
251
|
-
type: 'star',
|
|
252
|
-
maxRange: 100,
|
|
253
|
-
value: 0,
|
|
254
|
-
identifier: 'ratingKey',
|
|
255
|
-
toggleStar: true,
|
|
256
|
-
toggleSet: false,
|
|
257
|
-
color: '#F7B001'
|
|
258
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Rating';
|
|
@@ -1,97 +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 StyledButton = styled.button`
|
|
13
|
-
background: ${({ disabled, theme, bgVariant }) => disabled ? buttonDisabledBg : theme.variant[bgVariant]};
|
|
14
|
-
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
15
|
-
padding: 6px 17px;
|
|
16
|
-
border: 1px solid ${({ theme, bgVariant }) => theme.variant[bgVariant]};
|
|
17
|
-
border-radius: 999px;
|
|
18
|
-
font-size: 14px;
|
|
19
|
-
line-height: 17px;
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
width: ${({ block }) => block ? '100%' : 'auto'};
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
|
|
25
|
-
&:disabled {
|
|
26
|
-
color: #929EAC;
|
|
27
|
-
background: ${buttonDisabledBg};
|
|
28
|
-
border: 1px solid ${buttonDisabledBg};
|
|
29
|
-
cursor: not-allowed;
|
|
30
|
-
|
|
31
|
-
svg>path{
|
|
32
|
-
fill: #929EAC;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
* {
|
|
37
|
-
outline: none;
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
export const DarkSecondaryLink = ({ block, style, variant, bgVariant, disabled, ...props }) => {
|
|
42
|
-
const theme = useTheme() || defaultThemeColor;
|
|
43
|
-
return (
|
|
44
|
-
<StyledButton
|
|
45
|
-
block={block}
|
|
46
|
-
variant={variant}
|
|
47
|
-
bgVariant={bgVariant}
|
|
48
|
-
type="button"
|
|
49
|
-
style={style}
|
|
50
|
-
disabled={disabled}
|
|
51
|
-
{...props}
|
|
52
|
-
>
|
|
53
|
-
{props.children}
|
|
54
|
-
</StyledButton>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
DarkSecondaryLink.propTypes = {
|
|
59
|
-
/**
|
|
60
|
-
* Type of Button. primary-1, 2, error, etc.
|
|
61
|
-
*/
|
|
62
|
-
variant: PropTypes.string,
|
|
63
|
-
/**
|
|
64
|
-
* Color background. primary-1, 2, error, etc.
|
|
65
|
-
*/
|
|
66
|
-
bgVariant: PropTypes.string,
|
|
67
|
-
/**
|
|
68
|
-
* Is the button disabled?
|
|
69
|
-
*/
|
|
70
|
-
disabled: PropTypes.bool,
|
|
71
|
-
/**
|
|
72
|
-
* Optional click handler
|
|
73
|
-
*/
|
|
74
|
-
block: PropTypes.bool,
|
|
75
|
-
/**
|
|
76
|
-
* Optional click handler
|
|
77
|
-
*/
|
|
78
|
-
onClick: PropTypes.func,
|
|
79
|
-
/**
|
|
80
|
-
* Theme object
|
|
81
|
-
*/
|
|
82
|
-
theme: PropTypes.object,
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
StyledButton.defaultProps = {
|
|
86
|
-
theme: defaultThemeColor,
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
DarkSecondaryLink.defaultProps = {
|
|
90
|
-
theme: defaultThemeColor,
|
|
91
|
-
variant: 'primary-2',
|
|
92
|
-
bgVariant: 'neutral-4',
|
|
93
|
-
block: false,
|
|
94
|
-
disabled: false,
|
|
95
|
-
onClick: undefined,
|
|
96
|
-
};
|
|
97
|
-
|
|
@@ -1,93 +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 StyledButton = styled.button`
|
|
13
|
-
background: ${({ disabled, theme }) => disabled ? buttonDisabledBg : theme.bgColor};
|
|
14
|
-
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
15
|
-
padding: 6px 17px;
|
|
16
|
-
border: 1px solid ${({ theme, borderVariant }) => theme.variant[borderVariant]};
|
|
17
|
-
border-radius: 999px;
|
|
18
|
-
font-size: 14px;
|
|
19
|
-
line-height: 17px;
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
width: ${({ block }) => block ? '100%' : 'auto'};
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
|
|
25
|
-
&:disabled {
|
|
26
|
-
color: #929EAC;
|
|
27
|
-
background: ${buttonDisabledBg};
|
|
28
|
-
border: 1px solid ${buttonDisabledBg};
|
|
29
|
-
cursor: not-allowed;
|
|
30
|
-
|
|
31
|
-
svg>path{
|
|
32
|
-
fill: #929EAC;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
export const LightSecondaryLink = ({ block, style, variant, borderVariant, disabled, ...props }) => {
|
|
38
|
-
const theme = useTheme() || defaultThemeColor;
|
|
39
|
-
return (
|
|
40
|
-
<StyledButton
|
|
41
|
-
block={block}
|
|
42
|
-
variant={variant}
|
|
43
|
-
borderVariant={borderVariant}
|
|
44
|
-
type="button"
|
|
45
|
-
style={style}
|
|
46
|
-
disabled={disabled}
|
|
47
|
-
{...props}
|
|
48
|
-
>
|
|
49
|
-
{props.children}
|
|
50
|
-
</StyledButton>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
LightSecondaryLink.propTypes = {
|
|
55
|
-
/**
|
|
56
|
-
* Color text. primary-1, 2, error, etc.
|
|
57
|
-
*/
|
|
58
|
-
variant: PropTypes.string,
|
|
59
|
-
/**
|
|
60
|
-
* Color border. primary-1, 2, error, etc.
|
|
61
|
-
*/
|
|
62
|
-
borderVariant: PropTypes.string,
|
|
63
|
-
/**
|
|
64
|
-
* Is the button disabled?
|
|
65
|
-
*/
|
|
66
|
-
disabled: PropTypes.bool,
|
|
67
|
-
/**
|
|
68
|
-
* Optional click handler
|
|
69
|
-
*/
|
|
70
|
-
block: PropTypes.bool,
|
|
71
|
-
/**
|
|
72
|
-
* Optional click handler
|
|
73
|
-
*/
|
|
74
|
-
onClick: PropTypes.func,
|
|
75
|
-
/**
|
|
76
|
-
* Theme object
|
|
77
|
-
*/
|
|
78
|
-
theme: PropTypes.object,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
StyledButton.defaultProps = {
|
|
82
|
-
theme: defaultThemeColor,
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
LightSecondaryLink.defaultProps = {
|
|
86
|
-
theme: defaultThemeColor,
|
|
87
|
-
variant: 'primary-2',
|
|
88
|
-
borderVariant: 'neutral-3',
|
|
89
|
-
block: false,
|
|
90
|
-
disabled: false,
|
|
91
|
-
onClick: undefined,
|
|
92
|
-
};
|
|
93
|
-
|