@fixefy/fixefy-ui-components 0.0.42 → 0.0.43
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/build/FxButton/styles/button.styles.js +0 -6
- package/package.json +7 -7
- package/.prettierrc.json +0 -10
- package/.swcrc +0 -20
- package/src/FxActionsTray/FxActionsTray.tsx +0 -293
- package/src/FxActionsTray/actions_tray_types.d.ts +0 -15
- package/src/FxActionsTray/index.ts +0 -3
- package/src/FxActionsTray/styles/actions_tray.styles.tsx +0 -90
- package/src/FxAggregationsBar/FxAggregations.tsx +0 -32
- package/src/FxAggregationsBar/aggregations_types.d.ts +0 -21
- package/src/FxAggregationsBar/helpers/structureReader.tsx +0 -66
- package/src/FxAggregationsBar/index.ts +0 -2
- package/src/FxAggregationsBar/operations/query.ts +0 -64
- package/src/FxAsyncDropdown/FxAsyncDropdown.tsx +0 -362
- package/src/FxAsyncDropdown/async_dropdown_types.d.ts +0 -40
- package/src/FxAsyncDropdown/helpers/helpers.ts +0 -105
- package/src/FxAsyncDropdown/index.ts +0 -2
- package/src/FxAsyncDropdown/styles/dropdown.styles.tsx +0 -162
- package/src/FxAvatar/FxAvatar.tsx +0 -50
- package/src/FxAvatar/avatar_types.d.ts +0 -11
- package/src/FxAvatar/helpers/stringToColor.ts +0 -16
- package/src/FxAvatar/index.ts +0 -2
- package/src/FxAvatar/styles/avatar.styles.tsx +0 -82
- package/src/FxButton/FxButton.tsx +0 -11
- package/src/FxButton/index.ts +0 -2
- package/src/FxButton/styles/button.styles.jsx +0 -16
- package/src/FxButton/styles/button.styles.tsx +0 -14
- package/src/FxChip/FxChip.tsx +0 -14
- package/src/FxChip/chip_types.d.ts +0 -34
- package/src/FxChip/index.ts +0 -2
- package/src/FxChip/styles/chip.styles.tsx +0 -51
- package/src/FxIcon/FxIcon.tsx +0 -34
- package/src/FxIcon/content/dynamic_icon.tsx +0 -3
- package/src/FxIcon/content/index.ts +0 -2
- package/src/FxIcon/content/lazy_icon.tsx +0 -48
- package/src/FxIcon/icon_types.d.ts +0 -10
- package/src/FxIcon/index.ts +0 -2
- package/src/FxModal/FxModal.tsx +0 -44
- package/src/FxModal/index.ts +0 -2
- package/src/FxModal/modal_types.d.ts +0 -10
- package/src/FxModal/styles/modal.style.tsx +0 -40
- package/src/FxNotes/FxNotes.tsx +0 -165
- package/src/FxNotes/helpers/stringToColor.ts +0 -19
- package/src/FxNotes/index.ts +0 -2
- package/src/FxNotes/note_types.d.ts +0 -12
- package/src/FxNotes/operations/queries.ts +0 -21
- package/src/FxNotes/styles/notes.styles.tsx +0 -135
- package/src/FxNumberField/FxNumberField.tsx +0 -37
- package/src/FxNumberField/index.ts +0 -2
- package/src/FxNumberField/number_field_types.d.ts +0 -7
- package/src/FxNumberField/styles/number_field.styles.ts +0 -85
- package/src/FxProgressCircle/FxProgressCircle.tsx +0 -40
- package/src/FxProgressCircle/index.ts +0 -2
- package/src/FxProgressCircle/progress_circle_types.d.ts +0 -9
- package/src/FxProgressCircle/styles/progress_circle.styles.tsx +0 -33
- package/src/FxProgressCounter/ProgressCounter.tsx +0 -81
- package/src/FxProgressCounter/index.ts +0 -2
- package/src/FxProgressCounter/progress_counter_types.d.ts +0 -10
- package/src/FxProgressCounter/styles/progress_counter.styles.ts +0 -40
- package/src/FxScore/FxScore.tsx +0 -75
- package/src/FxScore/index.ts +0 -2
- package/src/FxScore/score_types.d.ts +0 -16
- package/src/FxScore/styles/score.styles.ts +0 -42
- package/src/FxShowMore/FxShowMore.tsx +0 -60
- package/src/FxShowMore/index.ts +0 -2
- package/src/FxShowMore/show_more_types.d.ts +0 -8
- package/src/FxShowMore/styles/show_more.styles.ts +0 -67
- package/src/FxSlider/FxSlider.tsx +0 -8
- package/src/FxSlider/index.ts +0 -2
- package/src/FxSlider/slider_types.d.ts +0 -3
- package/src/FxStatisticsBar/FxStatisticsBar.tsx +0 -112
- package/src/FxStatisticsBar/index.ts +0 -2
- package/src/FxStatisticsBar/statistics_bar_types.d.ts +0 -8
- package/src/FxStatisticsBar/styles/statistics.styles.ts +0 -41
- package/src/FxStatusBar/FxStatusBar.tsx +0 -66
- package/src/FxStatusBar/helpers/constants.ts +0 -12
- package/src/FxStatusBar/index.ts +0 -2
- package/src/FxStatusBar/status_bar_types.d.ts +0 -14
- package/src/FxStatusBar/styles/statusBar.styles.tsx +0 -67
- package/src/FxStyledComponents/index.tsx +0 -196
- package/src/FxTag/FxTag.tsx +0 -14
- package/src/FxTag/fxtag_types.d.ts +0 -4
- package/src/FxTag/index.ts +0 -2
- package/src/FxTag/styles/tag.styles.tsx +0 -24
- package/src/FxTextField/FxTextField.tsx +0 -117
- package/src/FxTextField/index.ts +0 -2
- package/src/FxTextField/text_field_types.d.ts +0 -20
- package/src/FxTodo/FxTodo.tsx +0 -58
- package/src/FxTodo/index.ts +0 -2
- package/src/FxTodo/styles/todo.styles.tsx +0 -113
- package/src/FxTodo/todo_types.d.ts +0 -19
- package/src/FxWizard/FxWizard.tsx +0 -56
- package/src/FxWizard/WizardContext.tsx +0 -108
- package/src/FxWizard/index.ts +0 -3
- package/src/FxWizard/styles/wizard.styles.tsx +0 -22
- package/src/FxWizard/wizard_types.d.ts +0 -37
- package/src/index.ts +0 -23
- package/tsconfig.json +0 -22
- package/webpack.config.js +0 -35
- package/yarn-error.log +0 -95
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { styled } from '@mui/material/styles'
|
|
3
|
-
|
|
4
|
-
import { Box, LinearProgress } from '@mui/material'
|
|
5
|
-
|
|
6
|
-
export const BaseProgress = styled(LinearProgress)(({ theme }) => ({
|
|
7
|
-
borderRadius: '8px',
|
|
8
|
-
width: '70%',
|
|
9
|
-
position: 'absolute',
|
|
10
|
-
zIndex: 2,
|
|
11
|
-
height: 3,
|
|
12
|
-
}))
|
|
13
|
-
|
|
14
|
-
export const MainBar = styled(BaseProgress)(({ theme }) => ({
|
|
15
|
-
opacity: 1,
|
|
16
|
-
}))
|
|
17
|
-
|
|
18
|
-
export const BackgroundBar = styled(BaseProgress)(({ theme }) => ({
|
|
19
|
-
opacity: 0.2,
|
|
20
|
-
}))
|
|
21
|
-
|
|
22
|
-
export const ProgressContainer = styled(Box)(({ theme }) => ({
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
display: 'flex',
|
|
25
|
-
width: '100%',
|
|
26
|
-
margin: '8px 0',
|
|
27
|
-
position: 'relative',
|
|
28
|
-
justifyContent: 'center',
|
|
29
|
-
}))
|
|
30
|
-
|
|
31
|
-
export const Container = styled(Box)(({ theme }) => ({
|
|
32
|
-
width: 104,
|
|
33
|
-
height: 104,
|
|
34
|
-
minWidth: 104,
|
|
35
|
-
maxWidth: 104,
|
|
36
|
-
borderRadius: 8,
|
|
37
|
-
position: 'relative',
|
|
38
|
-
color: theme.palette.common.white,
|
|
39
|
-
backgroundColor: theme.palette.score.excellent,
|
|
40
|
-
}))
|
package/src/FxScore/FxScore.tsx
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react'
|
|
2
|
-
|
|
3
|
-
import { gql } from 'graphql-tag'
|
|
4
|
-
import { useLazyQuery } from '@apollo/client'
|
|
5
|
-
import { ScorePropsType } from './score_types'
|
|
6
|
-
import { useStyles } from './styles/score.styles'
|
|
7
|
-
import { getScoreColor, titleCase } from '@fixefy/fixefy-ui-utils'
|
|
8
|
-
import { Box, CircularProgress, Skeleton, Typography } from '@mui/material'
|
|
9
|
-
|
|
10
|
-
export const FxScore = ({ value, structure, filter, variant = 'box', hasLabel = true, title: propsTitle = 'score', Sizes: propsSizes = {}, ...rest }: ScorePropsType) => {
|
|
11
|
-
const Sizes = {
|
|
12
|
-
box: {
|
|
13
|
-
boxWidth: 104,
|
|
14
|
-
progressWidth: 68,
|
|
15
|
-
},
|
|
16
|
-
circle: { boxWidth: 40, progressWidth: 36 },
|
|
17
|
-
...propsSizes,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const { extended, title } = structure || {}
|
|
21
|
-
const { gql_operation, object_path: objectPath, filter: structureFilter } = extended || {}
|
|
22
|
-
|
|
23
|
-
const gqlOperation = gql_operation ?? 'query GET_SCORE($where: Json) { score: chargesAvg( where: $where data: { fields: ["score"], fragment: "{ score }" } ) }'
|
|
24
|
-
let _filter = structureFilter
|
|
25
|
-
|
|
26
|
-
if (filter) {
|
|
27
|
-
_filter = {
|
|
28
|
-
..._filter,
|
|
29
|
-
...filter,
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const [fetchData, { data, loading }] = useLazyQuery(gql(gqlOperation))
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (!value && structure) {
|
|
37
|
-
fetchData({
|
|
38
|
-
variables: {
|
|
39
|
-
where: { ..._filter },
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
}, [])
|
|
44
|
-
|
|
45
|
-
const ScoreValue: number | undefined = data ? data[objectPath] * 100 : value
|
|
46
|
-
|
|
47
|
-
const _classes = useStyles({
|
|
48
|
-
scoreColor: getScoreColor(ScoreValue || 0),
|
|
49
|
-
variant,
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
return loading ? (
|
|
53
|
-
<Box className={_classes.container}>
|
|
54
|
-
<Skeleton animation="wave" variant="circular" width={68} height={68} />
|
|
55
|
-
</Box>
|
|
56
|
-
) : (
|
|
57
|
-
<Box
|
|
58
|
-
className={_classes.container}
|
|
59
|
-
sx={{
|
|
60
|
-
width: Sizes[variant].boxWidth,
|
|
61
|
-
height: Sizes[variant].boxWidth,
|
|
62
|
-
minWidth: Sizes[variant].boxWidth,
|
|
63
|
-
maxWidth: Sizes[variant].boxWidth,
|
|
64
|
-
borderRadius: variant === 'box' ? '8px' : '50%',
|
|
65
|
-
}}
|
|
66
|
-
>
|
|
67
|
-
<CircularProgress size={Sizes[variant].progressWidth} variant="determinate" value={ScoreValue} color="inherit" thickness={2} className={_classes.mainCircle} {...rest} />
|
|
68
|
-
<CircularProgress size={Sizes[variant].progressWidth} variant="determinate" value={100} color="inherit" thickness={2} className={_classes.backgroundCircle} {...rest} />
|
|
69
|
-
<Box className={_classes.content}>
|
|
70
|
-
<Typography variant={variant === 'box' ? 'h5' : 'table'} className={_classes.scoreNumber}>{`${Math.round(Number(ScoreValue)) ?? 0}%`}</Typography>
|
|
71
|
-
{hasLabel && <Typography className={_classes.scoreText}>{titleCase(title ?? propsTitle)}</Typography>}
|
|
72
|
-
</Box>
|
|
73
|
-
</Box>
|
|
74
|
-
)
|
|
75
|
-
}
|
package/src/FxScore/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export type ScorePropsType = {
|
|
2
|
-
value?: number;
|
|
3
|
-
title?: string;
|
|
4
|
-
structure?: any;
|
|
5
|
-
hasLabel?: boolean;
|
|
6
|
-
variant?: "circle" | "box";
|
|
7
|
-
[x: string]: any;
|
|
8
|
-
filter?: object;
|
|
9
|
-
Sizes?: {
|
|
10
|
-
box?: {
|
|
11
|
-
boxWidth: number;
|
|
12
|
-
progressWidth: number;
|
|
13
|
-
};
|
|
14
|
-
circle?: { boxWidth: number; progressWidth: number };
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { makeStyles } from '@mui/styles'
|
|
2
|
-
import { ScorePaletteColorOptions, Theme } from '@mui/material/styles'
|
|
3
|
-
|
|
4
|
-
interface ScoreStylesPropsType {
|
|
5
|
-
scoreColor: keyof ScorePaletteColorOptions
|
|
6
|
-
variant: 'box' | 'circle'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const useStyles = makeStyles((theme: Theme) => ({
|
|
10
|
-
container: {
|
|
11
|
-
display: 'flex',
|
|
12
|
-
justifyContent: 'center',
|
|
13
|
-
alignItems: 'center',
|
|
14
|
-
position: 'relative',
|
|
15
|
-
color: theme.palette.common.white,
|
|
16
|
-
backgroundColor: (props: ScoreStylesPropsType) => theme.palette.score[props.scoreColor],
|
|
17
|
-
},
|
|
18
|
-
content: {
|
|
19
|
-
position: 'absolute',
|
|
20
|
-
display: 'flex',
|
|
21
|
-
justifyContent: 'center',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
flexDirection: 'column',
|
|
24
|
-
},
|
|
25
|
-
scoreNumber: {
|
|
26
|
-
color: theme.palette.common.white,
|
|
27
|
-
},
|
|
28
|
-
scoreText: {
|
|
29
|
-
...theme.typography.table,
|
|
30
|
-
fontWeight: 400,
|
|
31
|
-
color: theme.palette.common.white,
|
|
32
|
-
opacity: 0.6,
|
|
33
|
-
},
|
|
34
|
-
mainCircle: {
|
|
35
|
-
position: 'absolute',
|
|
36
|
-
zIndex: 2,
|
|
37
|
-
},
|
|
38
|
-
backgroundCircle: {
|
|
39
|
-
position: 'absolute',
|
|
40
|
-
opacity: 0.2,
|
|
41
|
-
},
|
|
42
|
-
}))
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
import { Typography } from '@mui/material'
|
|
4
|
-
import { ShowMorePropsType } from './show_more_types'
|
|
5
|
-
import { ShowMoreWrapper, ShowMoreBtn, ShowMoreIcon, StyledPopover, StyledDivider, StyledLabel } from './styles/show_more.styles'
|
|
6
|
-
|
|
7
|
-
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'
|
|
8
|
-
|
|
9
|
-
export function FxShowMore({ items, label, children, title }: ShowMorePropsType) {
|
|
10
|
-
const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(null)
|
|
11
|
-
|
|
12
|
-
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
13
|
-
setAnchorEl(event.currentTarget)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const handleClose = () => {
|
|
17
|
-
setAnchorEl(null)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const open = Boolean(anchorEl)
|
|
21
|
-
const id = open ? 'simple-popover' : undefined
|
|
22
|
-
return (
|
|
23
|
-
<ShowMoreWrapper>
|
|
24
|
-
{children}
|
|
25
|
-
|
|
26
|
-
<ShowMoreBtn onClick={handleClick}>
|
|
27
|
-
<ShowMoreIcon isOpen={open}>
|
|
28
|
-
<KeyboardArrowDownIcon />
|
|
29
|
-
</ShowMoreIcon>
|
|
30
|
-
{title ? title : 'SHOW MORE'}
|
|
31
|
-
</ShowMoreBtn>
|
|
32
|
-
|
|
33
|
-
<StyledPopover
|
|
34
|
-
id={id}
|
|
35
|
-
open={open}
|
|
36
|
-
anchorEl={anchorEl}
|
|
37
|
-
onClose={handleClose}
|
|
38
|
-
anchorOrigin={{
|
|
39
|
-
vertical: 'bottom',
|
|
40
|
-
horizontal: 'center',
|
|
41
|
-
}}
|
|
42
|
-
transformOrigin={{
|
|
43
|
-
vertical: 'top',
|
|
44
|
-
horizontal: 'center',
|
|
45
|
-
}}
|
|
46
|
-
>
|
|
47
|
-
<StyledLabel>
|
|
48
|
-
{label} ({items.length})
|
|
49
|
-
</StyledLabel>
|
|
50
|
-
<StyledDivider />
|
|
51
|
-
{items?.map((item, index) => (
|
|
52
|
-
<div key={index}>
|
|
53
|
-
<Typography variant="body1">{item}</Typography>
|
|
54
|
-
{index + 1 !== items.length && <StyledDivider />}
|
|
55
|
-
</div>
|
|
56
|
-
))}
|
|
57
|
-
</StyledPopover>
|
|
58
|
-
</ShowMoreWrapper>
|
|
59
|
-
)
|
|
60
|
-
}
|
package/src/FxShowMore/index.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// import React from 'react'
|
|
2
|
-
import { styled } from '@mui/material/styles'
|
|
3
|
-
|
|
4
|
-
import { Box, Popover, Divider, Typography, Button } from '@mui/material'
|
|
5
|
-
|
|
6
|
-
interface ShowMoreBtnProps {
|
|
7
|
-
isOpen: boolean
|
|
8
|
-
}
|
|
9
|
-
export const ShowMoreWrapper = styled(Box)(({}) => ({
|
|
10
|
-
borderRadius: '8px',
|
|
11
|
-
}))
|
|
12
|
-
|
|
13
|
-
export const ShowMoreBtn = styled(Button)(({ theme }) => ({
|
|
14
|
-
...theme.typography.button,
|
|
15
|
-
fontWeight: 600,
|
|
16
|
-
fontSize: 12,
|
|
17
|
-
textTransform: 'uppercase',
|
|
18
|
-
color: theme.palette.primary[800],
|
|
19
|
-
padding: 0,
|
|
20
|
-
|
|
21
|
-
display: 'flex',
|
|
22
|
-
justifyContent: 'flex-start',
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
}))
|
|
25
|
-
|
|
26
|
-
export const ShowMoreIcon = styled(Box)<ShowMoreBtnProps>(({ theme, isOpen }) => ({
|
|
27
|
-
width: 16,
|
|
28
|
-
height: 16,
|
|
29
|
-
color: theme.palette.primary[800],
|
|
30
|
-
borderRadius: '50%',
|
|
31
|
-
border: '1px solid',
|
|
32
|
-
|
|
33
|
-
display: 'flex',
|
|
34
|
-
justifyContent: 'center',
|
|
35
|
-
alignItems: 'center',
|
|
36
|
-
|
|
37
|
-
marginRight: 8,
|
|
38
|
-
['& svg']: {
|
|
39
|
-
width: 14,
|
|
40
|
-
height: 14,
|
|
41
|
-
color: theme.palette.primary[800],
|
|
42
|
-
|
|
43
|
-
transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
44
|
-
transition: 'all 0.5s',
|
|
45
|
-
},
|
|
46
|
-
}))
|
|
47
|
-
|
|
48
|
-
export const StyledPopover = styled(Popover)(({ theme }) => ({
|
|
49
|
-
['.MuiPaper-root']: {
|
|
50
|
-
background: theme.palette.common.white,
|
|
51
|
-
boxShadow: '0px 0px 10px rgba(86, 135, 147, 0.3)',
|
|
52
|
-
borderRadius: 8,
|
|
53
|
-
padding: 24,
|
|
54
|
-
marginTop: 8,
|
|
55
|
-
|
|
56
|
-
minWidth: 226,
|
|
57
|
-
maxWidth: 328,
|
|
58
|
-
},
|
|
59
|
-
}))
|
|
60
|
-
export const StyledDivider = styled(Divider)(({}) => ({
|
|
61
|
-
marginTop: 8,
|
|
62
|
-
marginBottom: 8,
|
|
63
|
-
}))
|
|
64
|
-
export const StyledLabel = styled(Typography)(({ theme }) => ({
|
|
65
|
-
...theme.typography.overLineCaption,
|
|
66
|
-
color: '#8B9092',
|
|
67
|
-
}))
|
package/src/FxSlider/index.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react'
|
|
2
|
-
|
|
3
|
-
import { gql } from 'graphql-tag'
|
|
4
|
-
import { useLazyQuery } from '@apollo/client'
|
|
5
|
-
import { Box, Skeleton } from '@mui/material'
|
|
6
|
-
import { titleCase } from '@fixefy/fixefy-ui-utils'
|
|
7
|
-
import { getCurrency } from '@fixefy/fixefy-ui-utils'
|
|
8
|
-
import { useStyles } from './styles/statistics.styles'
|
|
9
|
-
|
|
10
|
-
import { StatisticsPropsType } from './statistics_bar_types'
|
|
11
|
-
|
|
12
|
-
export function FxStatisticsBar({ value, type = 'currency', label, structure, collapsed, filter }: StatisticsPropsType) {
|
|
13
|
-
const _classes = useStyles()
|
|
14
|
-
const { extended, input_type, title } = structure || {}
|
|
15
|
-
const { gql_operation, object_path, filter: structurefilter, variables } = extended || {}
|
|
16
|
-
|
|
17
|
-
const gqlOperation = gql_operation ?? 'query GET_SCORE($where: Json) { score: chargesAvg( where: $where data: { fields: ["score"], fragment: "{ score }" } ) }'
|
|
18
|
-
|
|
19
|
-
let _filter = structurefilter
|
|
20
|
-
|
|
21
|
-
if (filter) {
|
|
22
|
-
_filter = {
|
|
23
|
-
..._filter,
|
|
24
|
-
...filter,
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const [fetchData, { data, loading }] = useLazyQuery(gql(gqlOperation))
|
|
29
|
-
|
|
30
|
-
const convertValue = (value: any) => {
|
|
31
|
-
let newValue = ''
|
|
32
|
-
let sign = ''
|
|
33
|
-
if (value < 1000) {
|
|
34
|
-
newValue = value
|
|
35
|
-
} else if (value >= 1000 && value < 1000000) {
|
|
36
|
-
newValue = (value / 1000).toFixed(2)
|
|
37
|
-
sign = 'K'
|
|
38
|
-
} else {
|
|
39
|
-
newValue = (value / 1000000).toFixed(2)
|
|
40
|
-
sign = 'M'
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
new Intl.NumberFormat('en-US', {
|
|
45
|
-
style: 'currency',
|
|
46
|
-
currency: getCurrency(null)?.code.toUpperCase() || 'USD',
|
|
47
|
-
}).format(Number(newValue)) + sign
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const checkIsCollapsed = () => {
|
|
52
|
-
let collapsedFromStructureIsDefined = false
|
|
53
|
-
|
|
54
|
-
if (variables && variables.collapsed !== undefined && variables.collapsed !== null) {
|
|
55
|
-
collapsedFromStructureIsDefined = true
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (collapsedFromStructureIsDefined) {
|
|
59
|
-
return variables.collapsed
|
|
60
|
-
} else {
|
|
61
|
-
return collapsed
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const getValue = (value: any) => {
|
|
66
|
-
const statisticsType = input_type?.value || type
|
|
67
|
-
switch (statisticsType) {
|
|
68
|
-
case 'percentage': {
|
|
69
|
-
return new Intl.NumberFormat('en-US', {
|
|
70
|
-
style: 'percent',
|
|
71
|
-
}).format(Number(value))
|
|
72
|
-
}
|
|
73
|
-
case 'currency': {
|
|
74
|
-
if (checkIsCollapsed()) {
|
|
75
|
-
return convertValue(value)
|
|
76
|
-
} else {
|
|
77
|
-
return new Intl.NumberFormat('en-US', {
|
|
78
|
-
style: 'currency',
|
|
79
|
-
currency: getCurrency(null)?.code.toUpperCase() || 'USD',
|
|
80
|
-
}).format(Number(value))
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
default:
|
|
84
|
-
return value
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
if (!value && structure) {
|
|
90
|
-
fetchData({
|
|
91
|
-
variables: {
|
|
92
|
-
where: { ..._filter },
|
|
93
|
-
},
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
}, [])
|
|
97
|
-
|
|
98
|
-
const statisticsTitle = label ? label : title
|
|
99
|
-
const statisticsValue = data && data[object_path] != null ? getValue(data[object_path]) : getValue(value)
|
|
100
|
-
|
|
101
|
-
return loading ? (
|
|
102
|
-
<Box sx={{ width: 100 }}>
|
|
103
|
-
<Skeleton animation="wave" width={100} height={30} />
|
|
104
|
-
<Skeleton animation="wave" width={100} height={20} />
|
|
105
|
-
</Box>
|
|
106
|
-
) : (
|
|
107
|
-
<div className={_classes.container}>
|
|
108
|
-
<span className={variables?.contrast ? _classes.contrastValue : _classes.value}>{statisticsValue}</span>
|
|
109
|
-
<span className={variables?.contrast ? _classes.contrastLabel : _classes.label}>{titleCase(statisticsTitle)}</span>
|
|
110
|
-
</div>
|
|
111
|
-
)
|
|
112
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { makeStyles } from '@mui/styles'
|
|
2
|
-
import { Theme } from '@mui/material/styles'
|
|
3
|
-
|
|
4
|
-
import '@fixefy/fixefy-ui-utils'
|
|
5
|
-
|
|
6
|
-
export const useStyles = makeStyles((theme: Theme) => ({
|
|
7
|
-
container: {
|
|
8
|
-
display: 'flex',
|
|
9
|
-
alignItems: 'center',
|
|
10
|
-
justifyContent: 'center',
|
|
11
|
-
flexDirection: 'column',
|
|
12
|
-
minHeight: 56,
|
|
13
|
-
},
|
|
14
|
-
contrastLabel: {
|
|
15
|
-
fontWeight: 'normal',
|
|
16
|
-
fontSize: 11,
|
|
17
|
-
lineHeight: '16px',
|
|
18
|
-
letterSpacing: '0.1px',
|
|
19
|
-
opacity: 0.7,
|
|
20
|
-
color: theme.palette.common.white,
|
|
21
|
-
textOverflow: 'ellipsis',
|
|
22
|
-
whiteSpace: 'nowrap',
|
|
23
|
-
},
|
|
24
|
-
contrastValue: {
|
|
25
|
-
fontWeight: 600,
|
|
26
|
-
fontSize: 19,
|
|
27
|
-
lineHeight: '28px',
|
|
28
|
-
letterSpacing: '0.15px',
|
|
29
|
-
color: theme.palette.common.white,
|
|
30
|
-
},
|
|
31
|
-
label: {
|
|
32
|
-
...theme.typography.table,
|
|
33
|
-
color: theme.palette.statistics.label,
|
|
34
|
-
textOverflow: 'ellipsis',
|
|
35
|
-
whiteSpace: 'nowrap',
|
|
36
|
-
},
|
|
37
|
-
value: {
|
|
38
|
-
...theme.typography.h5,
|
|
39
|
-
color: theme.palette.statistics.value,
|
|
40
|
-
},
|
|
41
|
-
}))
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
import { Stack } from '@mui/material'
|
|
4
|
-
import { FxChip } from '../FxChip'
|
|
5
|
-
import { statuses } from './helpers/constants'
|
|
6
|
-
import { titleCase } from '@fixefy/fixefy-ui-utils'
|
|
7
|
-
import { StatusBarPropsType } from './status_bar_types'
|
|
8
|
-
import { StatusBarCard, StatusBarTitle, StatusChipStyled } from './styles/statusBar.styles'
|
|
9
|
-
|
|
10
|
-
export const FxStatusBar = ({ onChangeStatus, onSearch, defaultStatus, title, options, chipsVariant = 'filled' }: StatusBarPropsType) => {
|
|
11
|
-
const [selectedStatus, setSelectedStatus] = useState<string[]>([])
|
|
12
|
-
const [searchValue] = useState<string>('')
|
|
13
|
-
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (defaultStatus) {
|
|
16
|
-
typeof defaultStatus === 'string' ? setSelectedStatus([defaultStatus]) : setSelectedStatus(defaultStatus)
|
|
17
|
-
} else {
|
|
18
|
-
setSelectedStatus(['all'])
|
|
19
|
-
}
|
|
20
|
-
}, [defaultStatus])
|
|
21
|
-
|
|
22
|
-
const onStatusClick = (status: string) => {
|
|
23
|
-
if (status === 'all') {
|
|
24
|
-
setSelectedStatus(() => {
|
|
25
|
-
if (selectedStatus.includes(status)) {
|
|
26
|
-
return []
|
|
27
|
-
} else {
|
|
28
|
-
return ['all']
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
} else {
|
|
32
|
-
setSelectedStatus((prevState) => {
|
|
33
|
-
if (selectedStatus.includes(status)) {
|
|
34
|
-
const rv = prevState.filter((_status) => _status !== status && _status !== 'all')
|
|
35
|
-
return rv.length == 0 ? ['all'] : rv
|
|
36
|
-
} else {
|
|
37
|
-
const rv = prevState.filter((_status) => _status !== status && _status !== 'all')
|
|
38
|
-
return [...rv, status]
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
onChangeStatus(selectedStatus)
|
|
46
|
-
}, [selectedStatus])
|
|
47
|
-
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
onSearch && onSearch(searchValue)
|
|
50
|
-
}, [searchValue])
|
|
51
|
-
|
|
52
|
-
const __options: any = options ?? statuses
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<StatusBarCard>
|
|
56
|
-
{title && <StatusBarTitle style={{ marginRight: '8px' }}>{titleCase(title)}</StatusBarTitle>}
|
|
57
|
-
|
|
58
|
-
<Stack direction="row" spacing={1}>
|
|
59
|
-
<StatusChipStyled onClick={() => onStatusClick('all')} label="All" variant={selectedStatus.includes('all') ? 'filled' : 'outlined'} />
|
|
60
|
-
{Object.keys(__options).map((key: string, index: number) => {
|
|
61
|
-
return <FxChip onClick={() => onStatusClick(__options[key])} key={index} label={titleCase(key)} variant={chipsVariant} status={selectedStatus.includes(__options[key]) ? __options[key] : ''} />
|
|
62
|
-
})}
|
|
63
|
-
</Stack>
|
|
64
|
-
</StatusBarCard>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const statuses = {
|
|
2
|
-
Declined: 'declined',
|
|
3
|
-
Pending: 'pending',
|
|
4
|
-
Approved: 'approved',
|
|
5
|
-
Active: 'active',
|
|
6
|
-
Challenge: 'challenged',
|
|
7
|
-
in_review: 'in_review',
|
|
8
|
-
Discrepancy: 'discrepancy',
|
|
9
|
-
no_pricing: 'no_pricing',
|
|
10
|
-
in_progress: 'in_progress',
|
|
11
|
-
Duplicated: 'duplicated',
|
|
12
|
-
}
|
package/src/FxStatusBar/index.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { EntityStatusType, ChargeStateType, InvoiceStateType, RecoStateType } from '@fixefy/fixefy-ui-utils'
|
|
2
|
-
|
|
3
|
-
export type StatusBarPropsType = {
|
|
4
|
-
onSearch?: (searchValue: string) => void
|
|
5
|
-
onChangeStatus: (statuses: string[]) => void
|
|
6
|
-
defaultStatus?: string | string[]
|
|
7
|
-
title?: string
|
|
8
|
-
options?: Options
|
|
9
|
-
chipsVariant?: 'outlined' | 'filled'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type Options = {
|
|
13
|
-
[x: string]: keyof EntityStatusType | keyof ChargeStateType | keyof InvoiceStateType | keyof RecoStateType | string
|
|
14
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { styled } from "@mui/material/styles";
|
|
2
|
-
import { Box, Chip as MuiChip } from "@mui/material";
|
|
3
|
-
|
|
4
|
-
export const StatusBarCard = styled(Box)(({ theme }) => ({
|
|
5
|
-
background: theme.palette.common.white,
|
|
6
|
-
borderRadius: 4,
|
|
7
|
-
padding: 16,
|
|
8
|
-
boxShadow: "0px 0px 10px rgba(86, 135, 147, 0.3)",
|
|
9
|
-
display: "flex",
|
|
10
|
-
alignItems: "center",
|
|
11
|
-
width: "fit-content",
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
|
-
export const StatusBarTitle = styled("span")(({ theme }) => ({
|
|
15
|
-
...theme.typography.body1,
|
|
16
|
-
color: theme.palette.common.black,
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
export const StatusChipStyled = styled(MuiChip)(({ theme, variant }) => {
|
|
20
|
-
let backgroundColor, border, labelColor;
|
|
21
|
-
|
|
22
|
-
if (variant === "filled") {
|
|
23
|
-
backgroundColor = theme.palette.primary.light;
|
|
24
|
-
labelColor = theme.palette.common.white;
|
|
25
|
-
} else {
|
|
26
|
-
backgroundColor = theme.palette.common.white;
|
|
27
|
-
}
|
|
28
|
-
border = "#F0F0F0";
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
height: 20,
|
|
32
|
-
minWidth: 34,
|
|
33
|
-
maxWidth: 120,
|
|
34
|
-
["& .MuiChip-label"]: {
|
|
35
|
-
fontSize: 9,
|
|
36
|
-
fontWeight: 600,
|
|
37
|
-
lineHeight: "12px",
|
|
38
|
-
color: labelColor ? labelColor : theme.palette["statistics"].label,
|
|
39
|
-
},
|
|
40
|
-
backgroundColor,
|
|
41
|
-
border: `1px solid ${border}`,
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// export const StatusBarSearchWrapper = styled("div")(({ theme }) => ({
|
|
46
|
-
// position: "relative",
|
|
47
|
-
// display: "flex",
|
|
48
|
-
// alignItems: "center",
|
|
49
|
-
// ["& input"]: {
|
|
50
|
-
// ...theme.typography.body1,
|
|
51
|
-
// color: theme.palette.statistics.label,
|
|
52
|
-
// paddingLeft: 40,
|
|
53
|
-
// width: "100%",
|
|
54
|
-
// },
|
|
55
|
-
// ["& svg"]: {å
|
|
56
|
-
// position: "absolute",
|
|
57
|
-
// left: 16,
|
|
58
|
-
// color: theme.palette.primary.light,
|
|
59
|
-
// },
|
|
60
|
-
// }));
|
|
61
|
-
|
|
62
|
-
// export const StatusBarSearchBar = styled("input")(({ theme }) => ({
|
|
63
|
-
// background: theme.palette.common.white,
|
|
64
|
-
// border: "1px solid #C6DDE2",
|
|
65
|
-
// borderRadius: 4,
|
|
66
|
-
// height: 36,
|
|
67
|
-
// }));
|