@fixefy/fixefy-ui-components 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist-cjs/ActionsTray/{actions_tray.jsx → ActionsTray.jsx} +46 -46
  2. package/dist-cjs/ActionsTray/index.js +4 -0
  3. package/dist-cjs/ActionsTray/styles/{actionsTray.styles.jsx → actions_tray.styles.jsx} +1 -1
  4. package/dist-cjs/AggregationsBar/Aggregations.jsx +27 -0
  5. package/dist-cjs/AggregationsBar/helpers/structureReader.jsx +41 -0
  6. package/dist-cjs/AggregationsBar/index.js +5 -0
  7. package/dist-cjs/AggregationsBar/operations/query.js +66 -0
  8. package/dist-cjs/AsyncDropdown/AsyncDropdown.jsx +209 -0
  9. package/dist-cjs/AsyncDropdown/helpers/helpers.js +81 -0
  10. package/dist-cjs/AsyncDropdown/index.js +5 -0
  11. package/dist-cjs/AsyncDropdown/styles/dropdown.styles.jsx +130 -0
  12. package/dist-cjs/FxAvatar/FxAvatar.jsx +34 -0
  13. package/dist-cjs/FxAvatar/helpers/stringToColor.js +17 -0
  14. package/dist-cjs/FxAvatar/index.js +5 -0
  15. package/dist-cjs/FxAvatar/styles/avatar.styles.jsx +75 -0
  16. package/dist-cjs/FxButton/{button.jsx → FxButton.jsx} +3 -3
  17. package/dist-cjs/FxButton/index.js +3 -3
  18. package/dist-cjs/FxChip/FxChip.jsx +14 -0
  19. package/dist-cjs/FxChip/index.js +5 -0
  20. package/dist-cjs/FxChip/styles/chip.styles.jsx +48 -0
  21. package/dist-cjs/FxIcon/FxIcon.jsx +29 -0
  22. package/dist-cjs/FxIcon/content/dynamic_icon.jsx +7 -0
  23. package/dist-cjs/FxIcon/content/index.js +7 -0
  24. package/dist-cjs/FxIcon/content/lazy_icon.jsx +22 -0
  25. package/dist-cjs/FxIcon/index.js +5 -0
  26. package/dist-cjs/FxModal/FxModal.jsx +36 -0
  27. package/dist-cjs/FxModal/index.js +5 -0
  28. package/dist-cjs/FxModal/styles/modal.style.jsx +34 -0
  29. package/dist-cjs/FxNotes/FxNotes.jsx +101 -0
  30. package/dist-cjs/FxNotes/helpers/stringToColor.js +20 -0
  31. package/dist-cjs/FxNotes/index.js +5 -0
  32. package/dist-cjs/FxNotes/operations/queries.js +24 -0
  33. package/dist-cjs/FxNotes/styles/notes.styles.jsx +120 -0
  34. package/dist-cjs/FxNumberField/FxNumberField.jsx +30 -0
  35. package/dist-cjs/FxNumberField/index.js +5 -0
  36. package/dist-cjs/FxNumberField/styles/number_field.styles.js +87 -0
  37. package/dist-cjs/FxProgressCircle/FxProgressCircle.jsx +28 -0
  38. package/dist-cjs/FxProgressCircle/index.js +5 -0
  39. package/dist-cjs/FxProgressCircle/styles/progress_circle.styles.jsx +27 -0
  40. package/dist-cjs/FxProgressCounter/ProgressCounter.jsx +45 -0
  41. package/dist-cjs/FxProgressCounter/index.js +5 -0
  42. package/dist-cjs/FxProgressCounter/styles/progress_counter.styles.js +36 -0
  43. package/dist-cjs/FxShowMore/FxShowMore.jsx +47 -0
  44. package/dist-cjs/FxShowMore/index.js +5 -0
  45. package/dist-cjs/FxShowMore/styles/show_more.styles.js +43 -0
  46. package/dist-cjs/FxSlider/FxSlider.jsx +10 -0
  47. package/dist-cjs/FxSlider/index.js +5 -0
  48. package/dist-cjs/Score/Score.jsx +57 -0
  49. package/dist-cjs/Score/index.js +5 -0
  50. package/dist-cjs/Score/styles/score.styles.js +33 -0
  51. package/dist-cjs/StatisticsBar/StatisticsBar.jsx +95 -0
  52. package/dist-cjs/StatisticsBar/index.js +5 -0
  53. package/dist-cjs/StatisticsBar/styles/statistics.styles.js +33 -0
  54. package/dist-cjs/Tag/Tag.jsx +6 -6
  55. package/dist-cjs/index.js +15 -3
  56. package/dist-es/ActionsTray/{actions_tray.jsx → ActionsTray.jsx} +1 -1
  57. package/dist-es/ActionsTray/index.js +1 -1
  58. package/dist-es/ActionsTray/styles/{actionsTray.styles.jsx → actions_tray.styles.jsx} +2 -2
  59. package/dist-es/AggregationsBar/Aggregations.jsx +22 -0
  60. package/dist-es/AggregationsBar/helpers/structureReader.jsx +32 -0
  61. package/dist-es/AggregationsBar/index.js +1 -0
  62. package/dist-es/AggregationsBar/operations/query.js +63 -0
  63. package/dist-es/AsyncDropdown/AsyncDropdown.jsx +228 -0
  64. package/dist-es/AsyncDropdown/helpers/helpers.js +77 -0
  65. package/dist-es/AsyncDropdown/index.js +1 -0
  66. package/dist-es/AsyncDropdown/styles/dropdown.styles.jsx +143 -0
  67. package/dist-es/FxAvatar/FxAvatar.jsx +32 -0
  68. package/dist-es/FxAvatar/helpers/stringToColor.js +13 -0
  69. package/dist-es/FxAvatar/index.js +1 -0
  70. package/dist-es/FxAvatar/styles/avatar.styles.jsx +68 -0
  71. package/dist-es/FxButton/{button.jsx → FxButton.jsx} +1 -1
  72. package/dist-es/FxButton/index.js +1 -1
  73. package/dist-es/FxChip/FxChip.jsx +9 -0
  74. package/dist-es/FxChip/index.js +1 -0
  75. package/dist-es/FxChip/styles/chip.styles.jsx +45 -0
  76. package/dist-es/FxIcon/FxIcon.jsx +24 -0
  77. package/dist-es/FxIcon/content/dynamic_icon.jsx +2 -0
  78. package/dist-es/FxIcon/content/index.js +2 -0
  79. package/dist-es/FxIcon/content/lazy_icon.jsx +17 -0
  80. package/dist-es/FxIcon/index.js +1 -0
  81. package/dist-es/FxModal/FxModal.jsx +30 -0
  82. package/dist-es/FxModal/index.js +1 -0
  83. package/dist-es/FxModal/styles/modal.style.jsx +31 -0
  84. package/dist-es/FxNotes/FxNotes.jsx +102 -0
  85. package/dist-es/FxNotes/helpers/stringToColor.js +16 -0
  86. package/dist-es/FxNotes/index.js +1 -0
  87. package/dist-es/FxNotes/operations/queries.js +20 -0
  88. package/dist-es/FxNotes/styles/notes.styles.jsx +116 -0
  89. package/dist-es/FxNumberField/FxNumberField.jsx +25 -0
  90. package/dist-es/FxNumberField/index.js +1 -0
  91. package/dist-es/FxNumberField/styles/number_field.styles.js +84 -0
  92. package/dist-es/FxProgressCircle/FxProgressCircle.jsx +23 -0
  93. package/dist-es/FxProgressCircle/index.js +1 -0
  94. package/dist-es/FxProgressCircle/styles/progress_circle.styles.jsx +28 -0
  95. package/dist-es/FxProgressCounter/ProgressCounter.jsx +38 -0
  96. package/dist-es/FxProgressCounter/index.js +1 -0
  97. package/dist-es/FxProgressCounter/styles/progress_counter.styles.js +33 -0
  98. package/dist-es/FxShowMore/FxShowMore.jsx +42 -0
  99. package/dist-es/FxShowMore/index.js +1 -0
  100. package/dist-es/FxShowMore/styles/show_more.styles.js +53 -0
  101. package/dist-es/FxSlider/FxSlider.jsx +5 -0
  102. package/dist-es/FxSlider/index.js +1 -0
  103. package/dist-es/Score/Score.jsx +57 -0
  104. package/dist-es/Score/index.js +1 -0
  105. package/dist-es/Score/styles/score.styles.js +35 -0
  106. package/dist-es/StatisticsBar/StatisticsBar.jsx +91 -0
  107. package/dist-es/StatisticsBar/index.js +1 -0
  108. package/dist-es/StatisticsBar/styles/statistics.styles.js +38 -0
  109. package/dist-es/Tag/Tag.jsx +6 -6
  110. package/dist-es/index.js +7 -1
  111. package/dist-types/ActionsTray/{actions_tray.d.ts → ActionsTray.d.ts} +2 -2
  112. package/dist-types/ActionsTray/index.d.ts +2 -0
  113. package/dist-types/AggregationsBar/Aggregations.d.ts +3 -0
  114. package/dist-types/AggregationsBar/helpers/structureReader.d.ts +1 -0
  115. package/dist-types/AggregationsBar/index.d.ts +2 -0
  116. package/dist-types/AggregationsBar/operations/query.d.ts +1 -0
  117. package/dist-types/AsyncDropdown/AsyncDropdown.d.ts +3 -0
  118. package/dist-types/AsyncDropdown/helpers/helpers.d.ts +4 -0
  119. package/dist-types/AsyncDropdown/index.d.ts +2 -0
  120. package/dist-types/AsyncDropdown/styles/dropdown.styles.d.ts +7 -0
  121. package/dist-types/FxAvatar/FxAvatar.d.ts +3 -0
  122. package/dist-types/FxAvatar/helpers/stringToColor.d.ts +1 -0
  123. package/dist-types/FxAvatar/index.d.ts +2 -0
  124. package/dist-types/FxAvatar/styles/avatar.styles.d.ts +7 -0
  125. package/dist-types/FxButton/FxButton.d.ts +6 -0
  126. package/dist-types/FxButton/index.d.ts +2 -2
  127. package/dist-types/FxChip/FxChip.d.ts +3 -0
  128. package/dist-types/FxChip/index.d.ts +2 -0
  129. package/dist-types/FxChip/styles/chip.styles.d.ts +3 -0
  130. package/dist-types/FxIcon/FxIcon.d.ts +3 -0
  131. package/dist-types/FxIcon/content/dynamic_icon.d.ts +5 -0
  132. package/dist-types/FxIcon/content/index.d.ts +2 -0
  133. package/dist-types/FxIcon/content/lazy_icon.d.ts +9 -0
  134. package/dist-types/FxIcon/index.d.ts +1 -0
  135. package/dist-types/FxModal/FxModal.d.ts +3 -0
  136. package/dist-types/FxModal/index.d.ts +2 -0
  137. package/dist-types/FxModal/styles/modal.style.d.ts +4 -0
  138. package/dist-types/FxNotes/FxNotes.d.ts +3 -0
  139. package/dist-types/FxNotes/helpers/stringToColor.d.ts +1 -0
  140. package/dist-types/FxNotes/index.d.ts +2 -0
  141. package/dist-types/FxNotes/operations/queries.d.ts +1 -0
  142. package/dist-types/FxNotes/styles/notes.styles.d.ts +13 -0
  143. package/dist-types/FxNumberField/FxNumberField.d.ts +3 -0
  144. package/dist-types/FxNumberField/index.d.ts +2 -0
  145. package/dist-types/FxNumberField/styles/number_field.styles.d.ts +1 -0
  146. package/dist-types/FxProgressCircle/FxProgressCircle.d.ts +3 -0
  147. package/dist-types/FxProgressCircle/index.d.ts +2 -0
  148. package/dist-types/FxProgressCircle/styles/progress_circle.styles.d.ts +5 -0
  149. package/dist-types/FxProgressCounter/ProgressCounter.d.ts +3 -0
  150. package/dist-types/FxProgressCounter/index.d.ts +2 -0
  151. package/dist-types/FxProgressCounter/styles/progress_counter.styles.d.ts +5 -0
  152. package/dist-types/FxShowMore/FxShowMore.d.ts +3 -0
  153. package/dist-types/FxShowMore/index.d.ts +2 -0
  154. package/dist-types/FxShowMore/styles/show_more.styles.d.ts +6 -0
  155. package/dist-types/FxSlider/FxSlider.d.ts +3 -0
  156. package/dist-types/FxSlider/index.d.ts +2 -0
  157. package/dist-types/Score/Score.d.ts +3 -0
  158. package/dist-types/Score/index.d.ts +2 -0
  159. package/dist-types/Score/styles/score.styles.d.ts +7 -0
  160. package/dist-types/StatisticsBar/StatisticsBar.d.ts +3 -0
  161. package/dist-types/StatisticsBar/index.d.ts +2 -0
  162. package/dist-types/StatisticsBar/styles/statistics.styles.d.ts +2 -0
  163. package/dist-types/Tag/Tag.d.ts +2 -2
  164. package/dist-types/Tag/index.d.ts +1 -1
  165. package/dist-types/index.d.ts +9 -4
  166. package/package.json +5 -2
  167. package/dist-types/FxButton/button.d.ts +0 -6
  168. /package/dist-types/ActionsTray/styles/{actionsTray.styles.d.ts → actions_tray.styles.d.ts} +0 -0
@@ -0,0 +1,116 @@
1
+ import Popover from '@mui/material/Popover';
2
+ import { styled } from '@mui/material/styles';
3
+ import { Avatar as _Avatar } from '@mui/material';
4
+ import '@fixefy/fxutils.page_context';
5
+ export const CommentsContainer = styled('div')(() => ({
6
+ display: 'flex',
7
+ flexDirection: 'column',
8
+ marginTop: 16,
9
+ justifyContent: 'space-between',
10
+ alignItems: 'flex-start',
11
+ }));
12
+ export const CommentsWrapper = styled('div')(({ theme }) => ({
13
+ display: 'flex',
14
+ alignItems: 'flex-start',
15
+ flexDirection: 'column',
16
+ justifyContent: 'center',
17
+ width: '100%',
18
+ }));
19
+ export const CommentsScrollWrapper = styled('div')(({ theme }) => ({
20
+ maxHeight: 170,
21
+ overflow: 'auto',
22
+ width: '100%',
23
+ }));
24
+ export const UserCommentWrapper = styled('div')(({ theme }) => ({
25
+ display: 'flex',
26
+ alignItems: 'flex-start',
27
+ marginTop: 16,
28
+ '&:first-of-type': {
29
+ marginTop: 0,
30
+ },
31
+ }));
32
+ export const CommentWrapper = styled('div')(({ theme }) => ({
33
+ display: 'flex',
34
+ alignItems: 'center',
35
+ width: '100%',
36
+ marginBottom: 16,
37
+ }));
38
+ export const CommentInput = styled('input')(({ theme }) => ({
39
+ background: theme.palette.common.white,
40
+ border: '1px solid #F0F0F0',
41
+ borderRadius: '4px',
42
+ height: 36,
43
+ padding: '0 16px',
44
+ fontStyle: 'normal',
45
+ fontWeight: 'normal',
46
+ fontSize: 14,
47
+ lineHeight: '20px',
48
+ letterSpacing: '0.15px',
49
+ color: '#172326',
50
+ width: '100%',
51
+ '&::focus-visible': {
52
+ outline: 'unset',
53
+ },
54
+ }));
55
+ export const StyledAvatar = styled(_Avatar)(({ theme }) => ({
56
+ width: 32,
57
+ height: 32,
58
+ border: `2px solid ${theme.palette.common.white}`,
59
+ marginRight: '8px',
60
+ fontFamily: 'Open Sans',
61
+ fontStyle: 'normal',
62
+ fontWeight: 'normal',
63
+ fontSize: 14,
64
+ lineHeight: '20px',
65
+ letterSpacing: '0.15px',
66
+ }));
67
+ export const UserComment = styled('div')(({ theme }) => ({
68
+ background: theme.palette.greyscale.contrastText,
69
+ border: '1px solid #F0F0F0',
70
+ borderRadius: '4px',
71
+ padding: '8px 16px',
72
+ minWidth: 300,
73
+ display: 'flex',
74
+ alignItems: 'flex-start',
75
+ flexDirection: 'column',
76
+ justifyContent: 'center',
77
+ }));
78
+ export const CommentUserTitle = styled('div')(({ theme }) => ({
79
+ fontStyle: 'normal',
80
+ fontWeight: 'normal',
81
+ fontSize: 11,
82
+ lineHeight: '16px',
83
+ letterSpacing: '0.15px',
84
+ color: '#172326',
85
+ }));
86
+ export const CommentDate = styled('div')(({ theme }) => ({
87
+ fontStyle: 'normal',
88
+ fontWeight: 'normal',
89
+ fontSize: 11,
90
+ lineHeight: '16px',
91
+ letterSpacing: '0.15px',
92
+ color: '#898989',
93
+ }));
94
+ export const CommentDesc = styled('div')(({ theme }) => ({
95
+ fontStyle: 'normal',
96
+ fontWeight: 'normal',
97
+ fontSize: 14,
98
+ lineHeight: '20px',
99
+ letterSpacing: '0.15px',
100
+ color: '#172326',
101
+ }));
102
+ export const StyledPopover = styled(Popover)(({ theme }) => ({
103
+ position: 'absolute',
104
+ right: 12,
105
+ width: 80,
106
+ height: 16,
107
+ background: '#F7F7F7',
108
+ borderRadius: 4,
109
+ fontFamily: 'Open Sans',
110
+ fontStyle: 'normal',
111
+ fontWeight: 'normal',
112
+ fontSize: 11,
113
+ lineHeight: '16px',
114
+ letterSpacing: '0.1px',
115
+ color: theme.palette.primary.light,
116
+ }));
@@ -0,0 +1,25 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { useStyles } from './styles/number_field.styles';
3
+ import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
4
+ export function FxNumberField({ placeholder, defaultValue, label, hint, onChange }) {
5
+ const _classes = useStyles();
6
+ const [value, setValue] = useState(defaultValue || 0);
7
+ useEffect(() => {
8
+ onChange && onChange(value);
9
+ }, [value]);
10
+ return (<div className={_classes.container}>
11
+ {label && <span className={_classes.label}>{label}</span>}
12
+ <div className={_classes.inputWrapper}>
13
+ <input type="number" placeholder={placeholder} value={value} onChange={(e) => setValue(e.target.value)}/>
14
+ <div className={_classes.inputActions}>
15
+ <button className={_classes.inputActionsPlus} onClick={() => setValue(value + 1)}>
16
+ <KeyboardArrowRightIcon />
17
+ </button>
18
+ <button className={_classes.inputActionsMinus} onClick={() => setValue(value - 1)}>
19
+ <KeyboardArrowRightIcon />
20
+ </button>
21
+ </div>
22
+ </div>
23
+ {hint && <span className={_classes.hint}>{hint}</span>}
24
+ </div>);
25
+ }
@@ -0,0 +1 @@
1
+ export { FxNumberField as Numberfield } from './FxNumberField';
@@ -0,0 +1,84 @@
1
+ import { makeStyles } from '@mui/styles';
2
+ export const useStyles = makeStyles(() => ({
3
+ container: {},
4
+ label: {
5
+ fontFamily: 'Open Sans',
6
+ fontStyle: 'normal',
7
+ fontWeight: 'normal',
8
+ fontSize: 11,
9
+ lineHeight: '16px',
10
+ letterSpacing: 0.1,
11
+ color: '#505050',
12
+ },
13
+ hint: {
14
+ fontStyle: 'normal',
15
+ fontWeight: 'normal',
16
+ fontSize: 11,
17
+ lineHeight: '16px',
18
+ display: 'flex',
19
+ alignItems: 'center',
20
+ letterSpacing: 0.1,
21
+ color: '#8A8A8A',
22
+ },
23
+ inputWrapper: {
24
+ background: '#FFFFFF',
25
+ border: '1px solid #EEEEEE',
26
+ borderRadius: 5,
27
+ height: 40,
28
+ display: 'flex',
29
+ width: 'fit-content',
30
+ ['& input']: {
31
+ border: 'none',
32
+ paddingLeft: 10,
33
+ borderRadius: 5,
34
+ ['&:focus-visible']: {
35
+ outline: 'none',
36
+ },
37
+ ['&::-webkit-inner-spin-button']: {
38
+ '-webkit-appearance': 'none',
39
+ },
40
+ ['&::-webkit-outer-spin-button']: {
41
+ '-webkit-appearance': 'none',
42
+ },
43
+ },
44
+ },
45
+ inputActions: {
46
+ display: 'flex',
47
+ flexDirection: 'column',
48
+ alignItems: 'center',
49
+ justifyContent: 'center',
50
+ },
51
+ inputActionsPlus: {
52
+ cursor: 'pointer',
53
+ background: '#FFFFFF',
54
+ height: '50%',
55
+ padding: 0,
56
+ width: 36,
57
+ border: 'none',
58
+ borderLeft: '1px solid #EEEEEE',
59
+ borderBottom: '1px solid #EEEEEE',
60
+ borderRadius: '0 5px 0 0',
61
+ color: '#568793',
62
+ ['& svg']: {
63
+ transform: 'rotate(270deg)',
64
+ width: 20,
65
+ height: 20,
66
+ },
67
+ },
68
+ inputActionsMinus: {
69
+ cursor: 'pointer',
70
+ background: '#FFFFFF',
71
+ height: '50%',
72
+ padding: 0,
73
+ width: 36,
74
+ border: 'none',
75
+ borderLeft: '1px solid #EEEEEE',
76
+ borderRadius: '0 0 5px 0',
77
+ color: '#568793',
78
+ ['& svg']: {
79
+ transform: 'rotate(90deg)',
80
+ width: 20,
81
+ height: 20,
82
+ },
83
+ },
84
+ }));
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { Container, Label, Slider, SliderCircle, SliderBar } from './styles/progress_circle.styles';
3
+ export function ProgressCircle({ radius = 70, border = 70, value, hasLabel = true, max = 100, color, type = 'progress' }) {
4
+ const _value = value ? value / max : 0;
5
+ const p = 2 * Math.PI * (radius - border / 2);
6
+ const strokeWidth = border;
7
+ const strokeDashoffset = p * (1 - _value);
8
+ const strokeDasharray = p;
9
+ const label = type === 'progress' ? `${value}/${max}` : `${value.toFixed()}%`;
10
+ return (<Container>
11
+ {hasLabel && type === 'progress' && <Label>{label}</Label>}
12
+ <Slider viewBox={`0 0 ${radius * 2} ${radius * 2}`}>
13
+ <SliderCircle style={{ strokeWidth }} r={radius - border / 2} cx={radius} cy={radius} color={color}/>
14
+
15
+ <SliderBar style={{
16
+ strokeWidth,
17
+ strokeDashoffset,
18
+ strokeDasharray,
19
+ }} r={radius - border / 2} cx={radius} cy={radius} color={color}/>
20
+ </Slider>
21
+ {hasLabel && type === 'percentage' && <Label sx={{ ml: 1 }}>{label}</Label>}
22
+ </Container>);
23
+ }
@@ -0,0 +1 @@
1
+ export { ProgressCircle } from './FxProgressCircle';
@@ -0,0 +1,28 @@
1
+ import { styled } from "@mui/material/styles";
2
+ export const Container = styled("div")(({ theme }) => ({
3
+ display: "flex",
4
+ alignItems: "center",
5
+ justifyContent: "center",
6
+ }));
7
+ export const Label = styled("span")(({ theme }) => ({
8
+ ...theme.typography.body1,
9
+ color: theme.palette.typography.title,
10
+ marginRight: 8,
11
+ }));
12
+ export const Slider = styled("svg")(({ theme }) => ({
13
+ display: "block",
14
+ width: 22,
15
+ height: 22,
16
+ transform: "rotate(-90deg)",
17
+ }));
18
+ export const SliderCircle = styled("circle")(({ theme, color }) => ({
19
+ fill: "transparent",
20
+ stroke: color ?? theme.palette.green2scale.main,
21
+ opacity: 0.1,
22
+ }));
23
+ export const SliderBar = styled("circle")(({ theme, color }) => ({
24
+ fill: "transparent",
25
+ stroke: color ?? theme.palette.green2scale.main,
26
+ strokeDashoffset: 0,
27
+ strokeDasharray: 0,
28
+ }));
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import { Box, Typography } from '@mui/material';
3
+ import { imageLoader } from '@fixefy/fxutils.images';
4
+ import { Container, ProgressContainer, MainBar, BackgroundBar } from './styles/progress_counter.styles';
5
+ import Image from 'next/image';
6
+ export function FxProgressCounter({ values, structure, filter, ...rest }) {
7
+ const initialValues = {
8
+ count: values?.count ?? 0,
9
+ current: values?.current ?? 0,
10
+ };
11
+ const normalizeNumber = (number) => {
12
+ return (number / initialValues.count) * 100;
13
+ };
14
+ return (<Container>
15
+
16
+ <Box position={'relative'} textAlign={'center'} justifyContent={'center'} mt={1.2}>
17
+ <Image alt={'approve'} width={16} height={16} loader={() => imageLoader({
18
+ root: 'https://cdn-dev.fixefy.me/',
19
+ src: 'invoices/approve-small-white.svg',
20
+ })} src={'invoices/approve-small-white.svg'} onLoad={() => console.log('loaded')} onError={(e) => console.log('error:', e)}/>
21
+
22
+ <Box mt={0.5}>
23
+ <Typography fontSize={19} fontWeight={600}>
24
+ {initialValues.current}/{initialValues.count}
25
+ </Typography>
26
+ </Box>
27
+
28
+ <Typography fontSize={11} sx={{ opacity: 0.6 }}>
29
+ Charges
30
+ </Typography>
31
+ </Box>
32
+
33
+ <ProgressContainer>
34
+ <MainBar variant="determinate" value={normalizeNumber(initialValues.current)} color={'inherit'} {...rest}/>
35
+ <BackgroundBar variant="determinate" value={initialValues.count > 100 ? 100 : initialValues.count} color={'inherit'} {...rest}/>
36
+ </ProgressContainer>
37
+ </Container>);
38
+ }
@@ -0,0 +1 @@
1
+ export { FxProgressCounter } from './ProgressCounter';
@@ -0,0 +1,33 @@
1
+ import { styled } from '@mui/material/styles';
2
+ import { Box, LinearProgress } from '@mui/material';
3
+ export const BaseProgress = styled(LinearProgress)(({ theme }) => ({
4
+ borderRadius: '8px',
5
+ width: '70%',
6
+ position: 'absolute',
7
+ zIndex: 2,
8
+ height: 3,
9
+ }));
10
+ export const MainBar = styled(BaseProgress)(({ theme }) => ({
11
+ opacity: 1,
12
+ }));
13
+ export const BackgroundBar = styled(BaseProgress)(({ theme }) => ({
14
+ opacity: 0.2,
15
+ }));
16
+ export const ProgressContainer = styled(Box)(({ theme }) => ({
17
+ alignItems: 'center',
18
+ display: 'flex',
19
+ width: '100%',
20
+ margin: '8px 0',
21
+ position: 'relative',
22
+ justifyContent: 'center',
23
+ }));
24
+ export const Container = styled(Box)(({ theme }) => ({
25
+ width: 104,
26
+ height: 104,
27
+ minWidth: 104,
28
+ maxWidth: 104,
29
+ borderRadius: 8,
30
+ position: 'relative',
31
+ color: theme.palette.common.white,
32
+ backgroundColor: theme.palette.score.excellent,
33
+ }));
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { Typography } from '@mui/material';
3
+ import { ShowMoreWrapper, ShowMoreBtn, ShowMoreIcon, StyledPopover, StyledDivider, StyledLabel } from './styles/show_more.styles';
4
+ import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
5
+ export function ShowMore({ items, label, children, title }) {
6
+ const [anchorEl, setAnchorEl] = React.useState(null);
7
+ const handleClick = (event) => {
8
+ setAnchorEl(event.currentTarget);
9
+ };
10
+ const handleClose = () => {
11
+ setAnchorEl(null);
12
+ };
13
+ const open = Boolean(anchorEl);
14
+ const id = open ? 'simple-popover' : undefined;
15
+ return (<ShowMoreWrapper>
16
+ {children}
17
+
18
+ <ShowMoreBtn onClick={handleClick}>
19
+ <ShowMoreIcon isOpen={open}>
20
+ <KeyboardArrowDownIcon />
21
+ </ShowMoreIcon>
22
+ {title ? title : 'SHOW MORE'}
23
+ </ShowMoreBtn>
24
+
25
+ <StyledPopover id={id} open={open} anchorEl={anchorEl} onClose={handleClose} anchorOrigin={{
26
+ vertical: 'bottom',
27
+ horizontal: 'center',
28
+ }} transformOrigin={{
29
+ vertical: 'top',
30
+ horizontal: 'center',
31
+ }}>
32
+ <StyledLabel>
33
+ {label} ({items.length})
34
+ </StyledLabel>
35
+ <StyledDivider />
36
+ {items?.map((item, index) => (<div key={index}>
37
+ <Typography variant="body1">{item}</Typography>
38
+ {index + 1 !== items.length && <StyledDivider />}
39
+ </div>))}
40
+ </StyledPopover>
41
+ </ShowMoreWrapper>);
42
+ }
@@ -0,0 +1 @@
1
+ export { ShowMore } from './FxShowMore';
@@ -0,0 +1,53 @@
1
+ import { styled } from '@mui/material/styles';
2
+ import { Box, Popover, Divider, Typography, Button } from '@mui/material';
3
+ export const ShowMoreWrapper = styled(Box)(({ theme }) => ({
4
+ borderRadius: '8px',
5
+ }));
6
+ export const ShowMoreBtn = styled(Button)(({ theme }) => ({
7
+ ...theme.typography.button,
8
+ fontWeight: 600,
9
+ fontSize: 12,
10
+ textTransform: 'uppercase',
11
+ color: theme.palette.primary[800],
12
+ padding: 0,
13
+ display: 'flex',
14
+ justifyContent: 'flex-start',
15
+ alignItems: 'center',
16
+ }));
17
+ export const ShowMoreIcon = styled(Box)(({ theme, isOpen }) => ({
18
+ width: 16,
19
+ height: 16,
20
+ color: theme.palette.primary[800],
21
+ borderRadius: '50%',
22
+ border: '1px solid',
23
+ display: 'flex',
24
+ justifyContent: 'center',
25
+ alignItems: 'center',
26
+ marginRight: 8,
27
+ ['& svg']: {
28
+ width: 14,
29
+ height: 14,
30
+ color: theme.palette.primary[800],
31
+ transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
32
+ transition: 'all 0.5s',
33
+ },
34
+ }));
35
+ export const StyledPopover = styled(Popover)(({ theme }) => ({
36
+ ['.MuiPaper-root']: {
37
+ background: theme.palette.common.white,
38
+ boxShadow: '0px 0px 10px rgba(86, 135, 147, 0.3)',
39
+ borderRadius: 8,
40
+ padding: 24,
41
+ marginTop: 8,
42
+ minWidth: 226,
43
+ maxWidth: 328,
44
+ },
45
+ }));
46
+ export const StyledDivider = styled(Divider)(({ theme }) => ({
47
+ marginTop: 8,
48
+ marginBottom: 8,
49
+ }));
50
+ export const StyledLabel = styled(Typography)(({ theme }) => ({
51
+ ...theme.typography.overLineCaption,
52
+ color: '#8B9092',
53
+ }));
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { Slider as _Slider } from '@mui/material';
3
+ export function Slider(props) {
4
+ return <_Slider {...props}/>;
5
+ }
@@ -0,0 +1 @@
1
+ export { Slider } from './FxSlider';
@@ -0,0 +1,57 @@
1
+ import React, { useEffect } from 'react';
2
+ import { gql } from 'graphql-tag';
3
+ import { useLazyQuery } from '@apollo/client';
4
+ import { useStyles } from './styles/score.styles';
5
+ import { getScoreColor, titleCase } from '@fixefy/fixefy-ui-utils';
6
+ import { Box, CircularProgress, Skeleton, Typography } from '@mui/material';
7
+ export const Score = ({ value, structure, filter, variant = 'box', hasLabel = true, title: propsTitle = 'score', Sizes: propsSizes = {}, ...rest }) => {
8
+ const Sizes = {
9
+ box: {
10
+ boxWidth: 104,
11
+ progressWidth: 68,
12
+ },
13
+ circle: { boxWidth: 40, progressWidth: 36 },
14
+ ...propsSizes,
15
+ };
16
+ const { extended, title } = structure || {};
17
+ const { gql_operation, object_path: objectPath, title_path: titlePath, filter: structureFilter } = extended || {};
18
+ const gqlOperation = gql_operation ?? 'query GET_SCORE($where: Json) { score: chargesAvg( where: $where data: { fields: ["score"], fragment: "{ score }" } ) }';
19
+ let _filter = structureFilter;
20
+ if (filter) {
21
+ _filter = {
22
+ ..._filter,
23
+ ...filter,
24
+ };
25
+ }
26
+ const [fetchData, { data, error, loading }] = useLazyQuery(gql(gqlOperation));
27
+ useEffect(() => {
28
+ if (!value && structure) {
29
+ fetchData({
30
+ variables: {
31
+ where: { ..._filter },
32
+ },
33
+ });
34
+ }
35
+ }, []);
36
+ const ScoreValue = data ? data[objectPath] * 100 : value;
37
+ const _classes = useStyles({
38
+ scoreColor: getScoreColor(ScoreValue || 0),
39
+ variant,
40
+ });
41
+ return loading ? (<Box className={_classes.container}>
42
+ <Skeleton animation="wave" variant="circular" width={68} height={68}/>
43
+ </Box>) : (<Box className={_classes.container} sx={{
44
+ width: Sizes[variant].boxWidth,
45
+ height: Sizes[variant].boxWidth,
46
+ minWidth: Sizes[variant].boxWidth,
47
+ maxWidth: Sizes[variant].boxWidth,
48
+ borderRadius: variant === 'box' ? '8px' : '50%',
49
+ }}>
50
+ <CircularProgress size={Sizes[variant].progressWidth} variant="determinate" value={ScoreValue} color="inherit" thickness={2} className={_classes.mainCircle} {...rest}/>
51
+ <CircularProgress size={Sizes[variant].progressWidth} variant="determinate" value={100} color="inherit" thickness={2} className={_classes.backgroundCircle} {...rest}/>
52
+ <Box className={_classes.content}>
53
+ <Typography variant={variant === 'box' ? 'h5' : 'table'} className={_classes.scoreNumber}>{`${Math.round(Number(ScoreValue)) ?? 0}%`}</Typography>
54
+ {hasLabel && <Typography className={_classes.scoreText}>{titleCase(title ?? propsTitle)}</Typography>}
55
+ </Box>
56
+ </Box>);
57
+ };
@@ -0,0 +1 @@
1
+ export { Score } from './Score';
@@ -0,0 +1,35 @@
1
+ import { makeStyles } from '@mui/styles';
2
+ export const useStyles = makeStyles((theme) => ({
3
+ container: {
4
+ display: 'flex',
5
+ justifyContent: 'center',
6
+ alignItems: 'center',
7
+ position: 'relative',
8
+ color: theme.palette.common.white,
9
+ backgroundColor: (props) => theme.palette.score[props.scoreColor],
10
+ },
11
+ content: {
12
+ position: 'absolute',
13
+ display: 'flex',
14
+ justifyContent: 'center',
15
+ alignItems: 'center',
16
+ flexDirection: 'column',
17
+ },
18
+ scoreNumber: {
19
+ color: theme.palette.common.white,
20
+ },
21
+ scoreText: {
22
+ ...theme.typography.table,
23
+ fontWeight: 400,
24
+ color: theme.palette.common.white,
25
+ opacity: 0.6,
26
+ },
27
+ mainCircle: {
28
+ position: 'absolute',
29
+ zIndex: 2,
30
+ },
31
+ backgroundCircle: {
32
+ position: 'absolute',
33
+ opacity: 0.2,
34
+ },
35
+ }));
@@ -0,0 +1,91 @@
1
+ import React, { useEffect } from 'react';
2
+ import { gql } from 'graphql-tag';
3
+ import { useLazyQuery } from '@apollo/client';
4
+ import { Box, Skeleton } from '@mui/material';
5
+ import { titleCase } from '@fixefy/fixefy-ui-utils';
6
+ import { getCurrency } from '@fixefy/fixefy-ui-utils';
7
+ import { useStyles } from './styles/statistics.styles';
8
+ export function StatisticsBar({ value, type = 'currency', label, structure, collapsed, filter }) {
9
+ const _classes = useStyles();
10
+ const { extended, input_type, title } = structure || {};
11
+ const { gql_operation, object_path, filter: structurefilter, variables } = extended || {};
12
+ const gqlOperation = gql_operation ?? 'query GET_SCORE($where: Json) { score: chargesAvg( where: $where data: { fields: ["score"], fragment: "{ score }" } ) }';
13
+ let _filter = structurefilter;
14
+ if (filter) {
15
+ _filter = {
16
+ ..._filter,
17
+ ...filter,
18
+ };
19
+ }
20
+ const [fetchData, { data, error, loading }] = useLazyQuery(gql(gqlOperation));
21
+ const convertValue = (value) => {
22
+ let newValue = '';
23
+ let sign = '';
24
+ if (value < 1000) {
25
+ newValue = value;
26
+ }
27
+ else if (value >= 1000 && value < 1000000) {
28
+ newValue = (value / 1000).toFixed(2);
29
+ sign = 'K';
30
+ }
31
+ else {
32
+ newValue = (value / 1000000).toFixed(2);
33
+ sign = 'M';
34
+ }
35
+ return (new Intl.NumberFormat('en-US', {
36
+ style: 'currency',
37
+ currency: getCurrency(null)?.code.toUpperCase() || 'USD',
38
+ }).format(Number(newValue)) + sign);
39
+ };
40
+ const checkIsCollapsed = () => {
41
+ let collapsedFromStructureIsDefined = false;
42
+ if (variables && variables.collapsed !== undefined && variables.collapsed !== null) {
43
+ collapsedFromStructureIsDefined = true;
44
+ }
45
+ if (collapsedFromStructureIsDefined) {
46
+ return variables.collapsed;
47
+ }
48
+ else {
49
+ return collapsed;
50
+ }
51
+ };
52
+ const getValue = (value) => {
53
+ const statisticsType = input_type?.value || type;
54
+ switch (statisticsType) {
55
+ case 'percentage': {
56
+ return new Intl.NumberFormat('en-US', {
57
+ style: 'percent',
58
+ }).format(Number(value));
59
+ }
60
+ case 'currency': {
61
+ if (checkIsCollapsed()) {
62
+ return convertValue(value);
63
+ }
64
+ else {
65
+ return new Intl.NumberFormat('en-US', {
66
+ style: 'currency',
67
+ currency: getCurrency(null)?.code.toUpperCase() || 'USD',
68
+ }).format(Number(value));
69
+ }
70
+ }
71
+ }
72
+ };
73
+ useEffect(() => {
74
+ if (!value && structure) {
75
+ fetchData({
76
+ variables: {
77
+ where: { ..._filter },
78
+ },
79
+ });
80
+ }
81
+ }, []);
82
+ const statisticsTitle = label ? label : title;
83
+ const statisticsValue = data && data[object_path] != null ? getValue(data[object_path]) : getValue(value);
84
+ return loading ? (<Box sx={{ width: 100 }}>
85
+ <Skeleton animation="wave" width={100} height={30}/>
86
+ <Skeleton animation="wave" width={100} height={20}/>
87
+ </Box>) : (<div className={_classes.container}>
88
+ <span className={variables?.contrast ? _classes.contrastValue : _classes.value}>{statisticsValue}</span>
89
+ <span className={variables?.contrast ? _classes.contrastLabel : _classes.label}>{titleCase(statisticsTitle)}</span>
90
+ </div>);
91
+ }
@@ -0,0 +1 @@
1
+ export { StatisticsBar } from './StatisticsBar';