@fixefy/fixefy-ui-components 0.0.41 → 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.
Files changed (185) hide show
  1. package/build/FxActionsTray/FxActionsTray.js +351 -0
  2. package/build/FxActionsTray/actions_tray_types.d.js +4 -0
  3. package/build/FxActionsTray/index.js +11 -0
  4. package/build/FxActionsTray/styles/actions_tray.styles.js +160 -0
  5. package/build/FxAggregationsBar/FxAggregations.js +41 -0
  6. package/build/FxAggregationsBar/aggregations_types.d.js +4 -0
  7. package/build/FxAggregationsBar/helpers/structureReader.js +78 -0
  8. package/build/FxAggregationsBar/index.js +11 -0
  9. package/{src/FxAggregationsBar/operations/query.ts → build/FxAggregationsBar/operations/query.js} +13 -4
  10. package/build/FxAsyncDropdown/FxAsyncDropdown.js +456 -0
  11. package/build/FxAsyncDropdown/async_dropdown_types.d.js +4 -0
  12. package/build/FxAsyncDropdown/helpers/helpers.js +151 -0
  13. package/build/FxAsyncDropdown/index.js +11 -0
  14. package/build/FxAsyncDropdown/styles/dropdown.styles.js +230 -0
  15. package/build/FxAvatar/FxAvatar.js +145 -0
  16. package/build/FxAvatar/avatar_types.d.js +4 -0
  17. package/build/FxAvatar/helpers/stringToColor.js +23 -0
  18. package/build/FxAvatar/index.js +11 -0
  19. package/build/FxAvatar/styles/avatar.styles.js +193 -0
  20. package/build/FxButton/FxButton.js +106 -0
  21. package/build/FxButton/index.js +11 -0
  22. package/{src/FxButton/styles/button.styles.jsx → build/FxButton/styles/button.styles.js} +5 -3
  23. package/build/FxChip/FxChip.js +37 -0
  24. package/build/FxChip/chip_types.d.js +4 -0
  25. package/build/FxChip/index.js +11 -0
  26. package/build/FxChip/styles/chip.styles.js +62 -0
  27. package/build/FxIcon/FxIcon.js +147 -0
  28. package/build/FxIcon/content/dynamic_icon.js +20 -0
  29. package/build/FxIcon/content/index.js +20 -0
  30. package/build/FxIcon/content/lazy_icon.js +137 -0
  31. package/build/FxIcon/icon_types.d.js +4 -0
  32. package/build/FxIcon/index.js +20 -0
  33. package/build/FxModal/FxModal.js +171 -0
  34. package/build/FxModal/index.js +11 -0
  35. package/build/FxModal/modal_types.d.js +4 -0
  36. package/build/FxModal/styles/modal.style.js +59 -0
  37. package/build/FxNotes/FxNotes.js +216 -0
  38. package/build/FxNotes/helpers/stringToColor.js +26 -0
  39. package/build/FxNotes/index.js +11 -0
  40. package/build/FxNotes/note_types.d.js +4 -0
  41. package/build/FxNotes/operations/queries.js +35 -0
  42. package/build/FxNotes/styles/notes.styles.js +169 -0
  43. package/build/FxNumberField/FxNumberField.js +109 -0
  44. package/build/FxNumberField/index.js +11 -0
  45. package/build/FxNumberField/number_field_types.d.js +4 -0
  46. package/build/FxNumberField/styles/number_field.styles.js +94 -0
  47. package/build/FxProgressCircle/FxProgressCircle.js +65 -0
  48. package/build/FxProgressCircle/index.js +11 -0
  49. package/build/FxProgressCircle/progress_circle_types.d.js +4 -0
  50. package/build/FxProgressCircle/styles/progress_circle.styles.js +106 -0
  51. package/build/FxProgressCounter/ProgressCounter.js +168 -0
  52. package/build/FxProgressCounter/index.js +11 -0
  53. package/build/FxProgressCounter/progress_counter_types.d.js +4 -0
  54. package/build/FxProgressCounter/styles/progress_counter.styles.js +61 -0
  55. package/build/FxScore/FxScore.js +207 -0
  56. package/build/FxScore/index.js +11 -0
  57. package/build/FxScore/score_types.d.js +4 -0
  58. package/build/FxScore/styles/score.styles.js +96 -0
  59. package/build/FxShowMore/FxShowMore.js +80 -0
  60. package/build/FxShowMore/index.js +11 -0
  61. package/build/FxShowMore/show_more_types.d.js +4 -0
  62. package/build/FxShowMore/styles/show_more.styles.js +134 -0
  63. package/build/FxSlider/FxSlider.js +49 -0
  64. package/build/FxSlider/index.js +11 -0
  65. package/build/FxSlider/slider_types.d.js +4 -0
  66. package/build/FxStatisticsBar/FxStatisticsBar.js +191 -0
  67. package/build/FxStatisticsBar/index.js +11 -0
  68. package/build/FxStatisticsBar/statistics_bar_types.d.js +4 -0
  69. package/build/FxStatisticsBar/styles/statistics.styles.js +98 -0
  70. package/build/FxStatusBar/FxStatusBar.js +143 -0
  71. package/build/FxStatusBar/helpers/constants.js +22 -0
  72. package/build/FxStatusBar/index.js +20 -0
  73. package/build/FxStatusBar/status_bar_types.d.js +4 -0
  74. package/build/FxStatusBar/styles/statusBar.styles.js +131 -0
  75. package/build/FxStyledComponents/index.js +311 -0
  76. package/build/FxTextField/FxTextField.js +208 -0
  77. package/build/FxTextField/index.js +11 -0
  78. package/build/FxTextField/text_field_types.d.js +4 -0
  79. package/build/FxTodo/FxTodo.js +95 -0
  80. package/build/FxTodo/index.js +23 -0
  81. package/build/FxTodo/styles/todo.styles.js +183 -0
  82. package/build/FxTodo/todo_types.d.js +4 -0
  83. package/build/FxWizard/FxWizard.js +179 -0
  84. package/build/FxWizard/WizardContext.js +207 -0
  85. package/build/FxWizard/index.js +23 -0
  86. package/build/FxWizard/styles/wizard.styles.js +89 -0
  87. package/build/FxWizard/wizard_types.d.js +4 -0
  88. package/build/index.js +182 -0
  89. package/package.json +8 -8
  90. package/.prettierrc.json +0 -10
  91. package/.swcrc +0 -20
  92. package/src/FxActionsTray/FxActionsTray.tsx +0 -293
  93. package/src/FxActionsTray/actions_tray_types.d.ts +0 -15
  94. package/src/FxActionsTray/index.ts +0 -3
  95. package/src/FxActionsTray/styles/actions_tray.styles.tsx +0 -90
  96. package/src/FxAggregationsBar/FxAggregations.tsx +0 -32
  97. package/src/FxAggregationsBar/aggregations_types.d.ts +0 -21
  98. package/src/FxAggregationsBar/helpers/structureReader.tsx +0 -66
  99. package/src/FxAggregationsBar/index.ts +0 -2
  100. package/src/FxAsyncDropdown/FxAsyncDropdown.tsx +0 -362
  101. package/src/FxAsyncDropdown/async_dropdown_types.d.ts +0 -40
  102. package/src/FxAsyncDropdown/helpers/helpers.ts +0 -105
  103. package/src/FxAsyncDropdown/index.ts +0 -2
  104. package/src/FxAsyncDropdown/styles/dropdown.styles.tsx +0 -162
  105. package/src/FxAvatar/FxAvatar.tsx +0 -50
  106. package/src/FxAvatar/avatar_types.d.ts +0 -11
  107. package/src/FxAvatar/helpers/stringToColor.ts +0 -16
  108. package/src/FxAvatar/index.ts +0 -2
  109. package/src/FxAvatar/styles/avatar.styles.tsx +0 -82
  110. package/src/FxButton/FxButton.tsx +0 -11
  111. package/src/FxButton/index.ts +0 -2
  112. package/src/FxButton/styles/button.styles.tsx +0 -14
  113. package/src/FxChip/FxChip.tsx +0 -14
  114. package/src/FxChip/chip_types.d.ts +0 -34
  115. package/src/FxChip/index.ts +0 -2
  116. package/src/FxChip/styles/chip.styles.tsx +0 -51
  117. package/src/FxIcon/FxIcon.tsx +0 -34
  118. package/src/FxIcon/content/dynamic_icon.tsx +0 -3
  119. package/src/FxIcon/content/index.ts +0 -2
  120. package/src/FxIcon/content/lazy_icon.tsx +0 -48
  121. package/src/FxIcon/icon_types.d.ts +0 -10
  122. package/src/FxIcon/index.ts +0 -2
  123. package/src/FxModal/FxModal.tsx +0 -44
  124. package/src/FxModal/index.ts +0 -2
  125. package/src/FxModal/modal_types.d.ts +0 -10
  126. package/src/FxModal/styles/modal.style.tsx +0 -40
  127. package/src/FxNotes/FxNotes.tsx +0 -165
  128. package/src/FxNotes/helpers/stringToColor.ts +0 -19
  129. package/src/FxNotes/index.ts +0 -2
  130. package/src/FxNotes/note_types.d.ts +0 -12
  131. package/src/FxNotes/operations/queries.ts +0 -21
  132. package/src/FxNotes/styles/notes.styles.tsx +0 -135
  133. package/src/FxNumberField/FxNumberField.tsx +0 -37
  134. package/src/FxNumberField/index.ts +0 -2
  135. package/src/FxNumberField/number_field_types.d.ts +0 -7
  136. package/src/FxNumberField/styles/number_field.styles.ts +0 -85
  137. package/src/FxProgressCircle/FxProgressCircle.tsx +0 -40
  138. package/src/FxProgressCircle/index.ts +0 -2
  139. package/src/FxProgressCircle/progress_circle_types.d.ts +0 -9
  140. package/src/FxProgressCircle/styles/progress_circle.styles.tsx +0 -33
  141. package/src/FxProgressCounter/ProgressCounter.tsx +0 -81
  142. package/src/FxProgressCounter/index.ts +0 -2
  143. package/src/FxProgressCounter/progress_counter_types.d.ts +0 -10
  144. package/src/FxProgressCounter/styles/progress_counter.styles.ts +0 -40
  145. package/src/FxScore/FxScore.tsx +0 -75
  146. package/src/FxScore/index.ts +0 -2
  147. package/src/FxScore/score_types.d.ts +0 -16
  148. package/src/FxScore/styles/score.styles.ts +0 -42
  149. package/src/FxShowMore/FxShowMore.tsx +0 -60
  150. package/src/FxShowMore/index.ts +0 -2
  151. package/src/FxShowMore/show_more_types.d.ts +0 -8
  152. package/src/FxShowMore/styles/show_more.styles.ts +0 -67
  153. package/src/FxSlider/FxSlider.tsx +0 -8
  154. package/src/FxSlider/index.ts +0 -2
  155. package/src/FxSlider/slider_types.d.ts +0 -3
  156. package/src/FxStatisticsBar/FxStatisticsBar.tsx +0 -112
  157. package/src/FxStatisticsBar/index.ts +0 -2
  158. package/src/FxStatisticsBar/statistics_bar_types.d.ts +0 -8
  159. package/src/FxStatisticsBar/styles/statistics.styles.ts +0 -41
  160. package/src/FxStatusBar/FxStatusBar.tsx +0 -66
  161. package/src/FxStatusBar/helpers/constants.ts +0 -12
  162. package/src/FxStatusBar/index.ts +0 -2
  163. package/src/FxStatusBar/status_bar_types.d.ts +0 -14
  164. package/src/FxStatusBar/styles/statusBar.styles.tsx +0 -67
  165. package/src/FxStyledComponents/index.tsx +0 -196
  166. package/src/FxTag/FxTag.tsx +0 -14
  167. package/src/FxTag/fxtag_types.d.ts +0 -4
  168. package/src/FxTag/index.ts +0 -2
  169. package/src/FxTag/styles/tag.styles.tsx +0 -24
  170. package/src/FxTextField/FxTextField.tsx +0 -117
  171. package/src/FxTextField/index.ts +0 -2
  172. package/src/FxTextField/text_field_types.d.ts +0 -20
  173. package/src/FxTodo/FxTodo.tsx +0 -58
  174. package/src/FxTodo/index.ts +0 -2
  175. package/src/FxTodo/styles/todo.styles.tsx +0 -113
  176. package/src/FxTodo/todo_types.d.ts +0 -19
  177. package/src/FxWizard/FxWizard.tsx +0 -56
  178. package/src/FxWizard/WizardContext.tsx +0 -108
  179. package/src/FxWizard/index.ts +0 -3
  180. package/src/FxWizard/styles/wizard.styles.tsx +0 -22
  181. package/src/FxWizard/wizard_types.d.ts +0 -37
  182. package/src/index.ts +0 -23
  183. package/tsconfig.json +0 -22
  184. package/webpack.config.js +0 -35
  185. package/yarn-error.log +0 -95
@@ -1,105 +0,0 @@
1
- export const getJPart = (j: any, jsonPath: string, defaultValue?: any): any => {
2
- // input check - if key is invalid - return error
3
- if (isObjectValid(j) === false) return defaultValue
4
-
5
- // convert indexes to properties
6
- jsonPath = jsonPath.replace(/\[(\w+)\]/g, '.$1')
7
-
8
- // strip a leading dot
9
- jsonPath = jsonPath.replace(/^\./, '')
10
-
11
- // split path by '.'
12
- let _isArrayValid = false
13
- let _isStringValid = false
14
- let currentPathPart: any
15
- let isLoop = true
16
-
17
- const pathParts = jsonPath.split('.')
18
-
19
- for (let i = 0, n = pathParts.length; isLoop && i < n; ++i) {
20
- currentPathPart = pathParts[i]
21
- _isStringValid = isStringValid(j)
22
- _isArrayValid = isArrayValid(j)
23
-
24
- if (_isStringValid === true || _isArrayValid === true) {
25
- if (_isStringValid === true) {
26
- j = JSON.parse(j)
27
- } else {
28
- j = j.reduce((acc: Array<any>, cur: any) => {
29
- const innerJ = getJPart(
30
- cur,
31
- pathParts.slice(i).join("."),
32
- defaultValue,
33
- );
34
-
35
- if (isArrayValid(innerJ)) {
36
- acc.push(...innerJ)
37
- } else {
38
- acc.push({
39
- ...innerJ,
40
- value: innerJ._id,
41
- })
42
- }
43
-
44
- return acc
45
- }, [])
46
-
47
- isLoop = false
48
- }
49
- } else {
50
- if (currentPathPart in j) {
51
- j = j[currentPathPart]
52
- } else {
53
- // if something in the process failed:
54
- // 1. set the rv as the default value
55
- // 2. stop the loop`
56
- j = defaultValue
57
- isLoop = false
58
- }
59
- }
60
- }
61
-
62
- return j
63
- }
64
-
65
- export const isArrayValid = (arr: any[], minLength: number = 1, maxLength: number = 0): boolean => {
66
- let rv: boolean =
67
- isObjectValid(arr) &&
68
- arr.length >= minLength &&
69
- //arr instanceof Array
70
- Object.prototype.toString.call(arr) == '[object Array]'
71
-
72
- if (maxLength > 0) {
73
- rv = rv && arr.length <= maxLength
74
- }
75
-
76
- return rv
77
- }
78
-
79
- export const isObjectValid = (obj: any, isCheckKeys: boolean = false): boolean => {
80
- let rv: boolean = typeof obj !== 'undefined' && obj !== null
81
-
82
- if (isCheckKeys) {
83
- rv = rv && Object.keys(obj).length > 0
84
- }
85
-
86
- return rv
87
- }
88
-
89
- export const isStringValid = (str: string, minLength: number | null = null, maxLength: number | null = null, isValidateType: boolean = true): boolean => {
90
- let rv = isObjectValid(str) && str.toString().length > 0 && (isValidateType ? typeof str === 'string' : true)
91
-
92
- if (rv === false) return false
93
-
94
- if (minLength && isNaN(minLength) === false && minLength > 0) {
95
- rv = rv && str.toString().length >= minLength
96
- }
97
-
98
- if (rv === false) return false
99
-
100
- if (maxLength && isNaN(maxLength) === false && maxLength > 0) {
101
- rv = rv && str.toString().length <= maxLength
102
- }
103
-
104
- return rv
105
- }
@@ -1,2 +0,0 @@
1
- export { FxAsyncDropdown } from './FxAsyncDropdown'
2
- export type { AsyncDropdownPropsType } from './async_dropdown_types'
@@ -1,162 +0,0 @@
1
- import { styled } from '@mui/material/styles'
2
-
3
- export const Root: any = styled('div')(() => ({
4
- color: 'rgba(0,0,0,.85)',
5
- fontSize: 14,
6
- }))
7
-
8
- export const Label: any = styled('label')(() => ({
9
- padding: '0 0 4px',
10
- lineHeight: '1.5',
11
- display: 'block',
12
- }))
13
-
14
- export const Loading: any = styled('div')(() => ({
15
- width: 30,
16
- height: 30,
17
- display: 'flex',
18
- alignItems: 'center',
19
- justifyContent: 'center',
20
- ['& span']: {
21
- width: '20px !important',
22
- height: '20px !important',
23
- },
24
- }))
25
-
26
- export const InputWrapper: any = styled('div')<any>(({ theme, hasValue, disabled }) => {
27
- const defaultBorder = `1px solid ${theme.palette.greyscale[200]}`
28
- const hasValueBorder = `1px solid ${theme.palette.primary[500]}`
29
- const disabledBorder = `1px solid ${theme.palette.greyscale[200]}`
30
- const activeBorder = `1px solid ${theme.palette.primary[500]}`
31
-
32
- return {
33
- border: disabled ? disabledBorder : hasValue ? hasValueBorder : defaultBorder,
34
- backgroundColor: theme.palette.common.white,
35
- borderRadius: 4,
36
- padding: 1,
37
- display: 'flex',
38
- alignItems: 'center',
39
- flexWrap: 'wrap',
40
- cursor: disabled ? 'not-allowed' : 'pointer',
41
-
42
- ['&:hover']: {
43
- border: disabled ? disabledBorder : activeBorder,
44
- borderRadius: 4,
45
- },
46
- ['&:focus']: {
47
- border: disabled ? disabledBorder : activeBorder,
48
- borderRadius: 4,
49
- },
50
- ['& > svg']: {
51
- color: disabled ? theme.palette.greyscale[300] : theme.palette.primary['500'],
52
- marginRight: 8,
53
- },
54
- ['& input']: {
55
- cursor: disabled ? 'not-allowed' : 'pointer',
56
- backgroundColor: theme.palette.common.white,
57
- color: theme.palette.typography.title,
58
- height: 36,
59
- boxSizing: 'border-box',
60
- padding: '4px 6px 4px 16px',
61
- width: 0,
62
- minWidth: 30,
63
- flexGrow: 1,
64
- border: 0,
65
- margin: 0,
66
- outline: 0,
67
-
68
- ...theme.typography.body1,
69
- lineHeight: '20px',
70
-
71
- ['& ::placeholder']: {
72
- color: hasValue ? theme.palette.typography.title : theme.palette.greyscale[400],
73
- },
74
- },
75
- }
76
- })
77
-
78
- export const Listbox: any = styled('ul')(({ theme }) => ({
79
- margin: 0,
80
- padding: 0,
81
- position: 'absolute',
82
- listStyle: 'none',
83
- backgroundColor: theme.palette.common.white,
84
- overflow: 'auto',
85
- maxHeight: 250,
86
- minHeight: 250,
87
- borderRadius: 4,
88
- boxShadow: '0px 0px 10px rgba(86, 135, 147, 0.2)',
89
- zIndex: 1,
90
- maxWidth: 270,
91
- minWidth: 270,
92
- top: 48,
93
- left: -42,
94
-
95
- ['& div']: {
96
- textOverflow: 'ellipsis',
97
- whiteSpace: 'nowrap',
98
- overflow: 'hidden',
99
- },
100
- }))
101
-
102
- export const StyledClose: any = styled('div')(() => ({
103
- position: 'absolute',
104
- bottom: 0,
105
- }))
106
-
107
- export const StyledListBox: any = styled('ul')(({ theme, hasClearBtn }: any) => ({
108
- // width: 300,
109
- margin: 0,
110
- padding: 0,
111
- // position: 'absolute',
112
- listStyle: 'none',
113
- backgroundColor: theme.palette.common.white,
114
- overflow: 'auto',
115
- maxHeight: hasClearBtn ? 190 : 230,
116
- zIndex: 1,
117
- textOverflow: 'ellipsis',
118
- whiteSpace: 'nowrap',
119
- overflowX: 'hidden',
120
- paddingTop: 8,
121
- paddingBottom: 8,
122
- maxWidth: 270,
123
- minWidth: 270,
124
-
125
- ['& div']: {
126
- textOverflow: 'ellipsis',
127
- whiteSpace: 'nowrap',
128
- overflow: 'hidden',
129
- },
130
- ['& li']: {
131
- paddingRight: 16,
132
- paddingLeft: 16,
133
- display: 'flex',
134
- alignItems: 'center',
135
- justifyContent: 'flex-start',
136
- height: 40,
137
- cursor: 'pointer',
138
- textOverflow: 'ellipsis',
139
- whiteSpace: 'nowrap',
140
- overflow: 'hidden',
141
- maxWidth: 270,
142
- minWidth: 270,
143
- },
144
-
145
- ['& li:hover']: {
146
- backgroundColor: '#F6F9FA',
147
- },
148
-
149
- ["& li[aria-selected='true']"]: {
150
- fontWeight: 900,
151
- backgroundColor: '#F6F9FA',
152
- },
153
-
154
- ["& li[data-focus='true']"]: {
155
- backgroundColor: '#F6F9FA',
156
- cursor: 'pointer',
157
-
158
- ['& svg ']: {
159
- color: 'currentColor',
160
- },
161
- },
162
- }))
@@ -1,50 +0,0 @@
1
- import React, { useState } from 'react'
2
- import { titleCase } from '@fixefy/fixefy-ui-utils'
3
- import { stringToColor } from './helpers/stringToColor'
4
-
5
- import { AvatarWrapper, StyledAvatar, StyledMoreAvatar, AvatarGroup, EditIcon, FxTooltip } from './styles/avatar.styles'
6
-
7
- import { AvatarPropsType } from './avatar_types'
8
-
9
- type BackgroundColorsType = {
10
- [key: string]: string
11
- }
12
-
13
- export function FxAvatar({ users, max = 5, isEditable = false, onEdit }: AvatarPropsType) {
14
- const [backgroundcolors, setBackgroundColors] = useState({} as BackgroundColorsType)
15
-
16
- const avatars = users.length > max ? users.slice(0, max - 1) : users
17
- const isMoreThanMax = users.length > max
18
-
19
- return (
20
- <AvatarWrapper>
21
- <AvatarGroup>
22
- {avatars.map((user, index) => {
23
- const userName = user.first_name + ' ' + user.last_name
24
- return (
25
- <FxTooltip key={index} title={titleCase(userName)}>
26
- <StyledAvatar
27
- sx={{
28
- backgroundColor: backgroundcolors[userName]
29
- ? backgroundcolors[userName]
30
- : stringToColor(userName, (color) => {
31
- setBackgroundColors({
32
- ...backgroundcolors,
33
- [userName]: color,
34
- })
35
- }),
36
- }}
37
- src={user.image_url}
38
- alt={userName}
39
- >
40
- {titleCase(userName.slice(0, 1))}
41
- </StyledAvatar>
42
- </FxTooltip>
43
- )
44
- })}
45
- {isMoreThanMax && <StyledMoreAvatar>{`+${users.length - max + 1}`}</StyledMoreAvatar>}
46
- </AvatarGroup>
47
- {isEditable && <EditIcon onClick={onEdit && onEdit} />}
48
- </AvatarWrapper>
49
- )
50
- }
@@ -1,11 +0,0 @@
1
- export type AvatarPropsType = {
2
- users: {
3
- first_name: string
4
- last_name: string
5
- image_url: string
6
- [x: string]: any
7
- }[]
8
- max?: number
9
- isEditable?: boolean
10
- onEdit?: () => void
11
- }
@@ -1,16 +0,0 @@
1
- export const stringToColor = (string: string, callBack?: (color: string) => void) => {
2
- let hash = 0
3
- let color = '#'
4
- /* eslint-disable no-bitwise */
5
- for (let i = 0; i < string.length; i += 1) {
6
- hash = string.charCodeAt(i) + ((hash << 5) - hash)
7
- }
8
-
9
- for (let i = 0; i < 3; i += 1) {
10
- const value = (hash >> (i * 8)) & 0xff
11
- color += `00${value.toString(16)}`.substr(-2)
12
- }
13
- /* eslint-enable no-bitwise */
14
- callBack && callBack(color)
15
- return color
16
- }
@@ -1,2 +0,0 @@
1
- export { FxAvatar } from './FxAvatar'
2
- export type { AvatarPropsType } from './avatar_types'
@@ -1,82 +0,0 @@
1
- import React from "react";
2
-
3
- import { styled } from "@mui/material/styles";
4
- import { Avatar as _Avatar } from "@mui/material";
5
- import { TooltipProps, tooltipClasses } from "@mui/material";
6
-
7
- import Tooltip from "@mui/material/Tooltip";
8
- import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
9
-
10
- import "@fixefy/fixefy-ui-utils";
11
-
12
- export const AvatarWrapper: any = styled("div")(() => ({
13
- display: "flex",
14
- alignItems: "center",
15
- justifyContent: "space-between",
16
- flexDirection: "row",
17
- }));
18
-
19
- export const AvatarGroup: any = styled("div")(() => ({
20
- display: "flex",
21
- alignItems: "center",
22
- justifyContent: "space-between",
23
- flexDirection: "row",
24
-
25
- "&>:first-of-type": {
26
- marginLeft: 0,
27
- },
28
- }));
29
-
30
- export const StyledAvatar: any = styled(_Avatar)(({ theme }) => ({
31
- width: 32,
32
- height: 32,
33
- border: `2px solid ${theme.palette.common.white}`,
34
- marginLeft: "-8px",
35
-
36
- fontFamily: "Open Sans",
37
- fontStyle: "normal",
38
- fontWeight: "normal",
39
- fontSize: 14,
40
- lineHeight: "20px",
41
- letterSpacing: "0.15px",
42
- }));
43
-
44
- export const StyledMoreAvatar: any = styled(_Avatar)(({ theme }) => ({
45
- width: 32,
46
- height: 32,
47
- border: `2px solid ${theme.palette.common.white}`,
48
- marginLeft: "-8px",
49
-
50
- fontFamily: "Open Sans",
51
- fontStyle: "normal",
52
- fontWeight: "normal",
53
- fontSize: 11,
54
- lineHeight: "16px",
55
- letterSpacing: "0.1px",
56
- color: theme.palette.greyscale.dark,
57
- backgroundColor: theme.palette.greyscale.light,
58
- }));
59
-
60
- export const EditIcon: any = styled(EditOutlinedIcon)(({ theme }) => ({
61
- cursor: "pointer",
62
- color: theme.palette.primary.light,
63
- }));
64
-
65
- export const FxTooltip = styled(({ className, ...props }: TooltipProps) => (
66
- <Tooltip {...props} placement="top" arrow classes={{ popper: className }} />
67
- ))(({ theme }) => ({
68
- [`& .${tooltipClasses.arrow}`]: {
69
- color: theme.palette.primary.main,
70
- },
71
- [`& .${tooltipClasses.tooltip}`]: {
72
- backgroundColor: theme.palette.primary.main,
73
- padding: 12,
74
- fontFamily: "Open Sans",
75
- fontStyle: "normal",
76
- fontWeight: "normal",
77
- fontSize: 14,
78
- lineHeight: "20px",
79
- textAlign: "center",
80
- letterSpacing: "0.15px",
81
- },
82
- }));
@@ -1,11 +0,0 @@
1
- import React from 'react'
2
- import { ButtonStyled } from './styles/button.styles'
3
-
4
- export type ButtonPropsType = {
5
- children: any
6
- [x: string]: any
7
- }
8
-
9
- export function FxButton({ type = 'primary', children, ...rest }: ButtonPropsType) {
10
- return <ButtonStyled {...rest}>{children}</ButtonStyled>
11
- }
@@ -1,2 +0,0 @@
1
- export { FxButton } from './FxButton'
2
- export type { ButtonPropsType } from './FxButton'
@@ -1,14 +0,0 @@
1
- import { Button } from '@mui/material'
2
- import { styled } from '@mui/material/styles'
3
-
4
- export const ButtonStyled = styled(Button)(({ theme, variant }) => {
5
- const border = variant === 'text' ? `0px solid #0000` : `1px solid ${theme.palette.primary.main}`
6
- return {
7
- border,
8
- minHeight: '40px',
9
- borderRadius: '100px',
10
- minWidth: '87px',
11
- fontSize: '12px',
12
- letterSpacing: '0.5px',
13
- }
14
- })
@@ -1,14 +0,0 @@
1
- import React from 'react'
2
-
3
- import { ChipPropsType } from './chip_types'
4
- import { getScoreColor, titleCase } from '@fixefy/fixefy-ui-utils'
5
- import { StatusChipStyled, ScoreChipStyled } from './styles/chip.styles'
6
-
7
- export const FxChip = (props: ChipPropsType) => {
8
- const { status, label, type = 'status', scoreValue = 0, minimized = false, variant = 'outlined', onClick } = props
9
- const newStatus = status ? (status as unknown as string).split(' ').join('_') : status
10
-
11
- const value = typeof label === 'number' ? label.toFixed(2) : (label as string)
12
-
13
- return type === 'status' ? <StatusChipStyled status={newStatus as any} label={titleCase(value)} variant={variant} onClick={onClick} /> : <ScoreChipStyled score={scoreValue} scoreLabel={getScoreColor(scoreValue) as any} label={titleCase(value)} minimized={minimized} variant={variant} onClick={onClick} />
14
- }
@@ -1,34 +0,0 @@
1
- import { EntityStatusType, ChargeStateType, InvoiceStateType, RecoStateType, ScoreType } from '@fixefy/fixefy-ui-utils'
2
-
3
- export type ChipType = {
4
- score: string
5
- status: EntityStatusType | ChargeStateType | InvoiceStateType | RecoStateType
6
- }
7
-
8
- export type ChipVariant = {
9
- outlined: string
10
- filled: string
11
- }
12
-
13
- export interface ChipPropsType {
14
- status?: EntityStatusType | ChargeStateType | InvoiceStateType | RecoStateType
15
- label: string | number
16
- variant?: 'outlined' | 'filled'
17
- type?: ChipType
18
- scoreValue?: number
19
- minimized?: boolean
20
- [x: string]: any
21
- onClick?: (e: any) => void
22
- }
23
-
24
- export interface ScoreProps {
25
- score: number
26
- scoreLabel: ScoreType
27
- minimized: boolean
28
- }
29
-
30
- export interface StatusProps {
31
- amount?: number
32
- label: string
33
- status: EntityStatusType | ChargeStateType | InvoiceStateType | RecoStateType
34
- }
@@ -1,2 +0,0 @@
1
- export { FxChip } from './FxChip'
2
- export type { ChipPropsType } from './chip_types'
@@ -1,51 +0,0 @@
1
- import { Chip as MuiChip } from '@mui/material'
2
- import { styled } from '@mui/material/styles'
3
- import { ScoreProps, StatusProps } from '../chip_types.d'
4
-
5
- import '@fixefy/fixefy-ui-utils'
6
-
7
- export const ScoreChipStyled = styled(MuiChip)<ScoreProps>(({ theme, scoreLabel, minimized }) => {
8
- const color = theme.palette.score[scoreLabel as any]
9
-
10
- return {
11
- height: 20,
12
- minWidth: minimized ? 35 : 80,
13
- maxWidth: 120,
14
- backgroundColor: color,
15
- ['& .MuiChip-label']: {
16
- color: theme.palette.common.white,
17
- fontSize: 9,
18
- fontWeight: 600,
19
- paddingLeft: minimized ? 0 : 'inherit',
20
- paddingRight: minimized ? 0 : 'inherit',
21
- },
22
- }
23
- })
24
-
25
- export const StatusChipStyled = styled(MuiChip)<StatusProps>(({ theme, status, variant }) => {
26
- let backgroundColor, border, labelColor
27
-
28
- if (theme.palette.status[status as any]) {
29
- if (variant === 'filled') {
30
- backgroundColor = theme.palette.status[status as any]['border']
31
- labelColor = theme.palette.common.white
32
- } else {
33
- backgroundColor = theme.palette.status[status as any]['background']
34
- }
35
- border = theme.palette.status[status as any]['border']
36
- }
37
-
38
- return {
39
- height: 20,
40
- minWidth: 80,
41
- maxWidth: 120,
42
- ['& .MuiChip-label']: {
43
- fontSize: 9,
44
- fontWeight: 600,
45
- lineHeight: '12px',
46
- color: labelColor ? labelColor : theme.palette.statistics.label,
47
- },
48
- backgroundColor,
49
- border: `1px solid ${border}`,
50
- }
51
- })
@@ -1,34 +0,0 @@
1
- import React from 'react'
2
-
3
- import { IconPropsType } from './icon_types'
4
- import { DynamicIcon, LazyIcon } from './content'
5
- import { toPascalCase } from '@fixefy/fixefy-ui-utils'
6
-
7
- import * as MUIIcons from '@mui/icons-material'
8
-
9
- // importing all the local icons - in the future should be removed to CDN server
10
- const iconsModule: any[] = []
11
-
12
- export const FxIcon = ({ className, color, fontSize, icon, height, sx, width }: IconPropsType) => {
13
- if (!icon) throw Error('Provide a property `icon`')
14
-
15
- let rv: JSX.Element
16
-
17
- const splittedPath = icon.split('/')
18
- const iconWithoutPath: any = toPascalCase(splittedPath[splittedPath.length - 1])
19
-
20
- // const name = toPascalCase(icon)
21
-
22
- if (iconsModule[iconWithoutPath]) {
23
- rv = <DynamicIcon icon={iconsModule[iconWithoutPath]} sx={sx} />
24
- // @ts-ignore
25
- } else if (MUIIcons[iconWithoutPath]) {
26
- // @ts-ignore
27
- const MUIIcon = MUIIcons[iconWithoutPath]
28
- rv = <MUIIcon className={className} color={color} sx={{ ...sx, fontSize }} />
29
- } else {
30
- rv = <LazyIcon icon={icon} sx={sx} width={width} height={height} />
31
- }
32
-
33
- return rv
34
- }
@@ -1,3 +0,0 @@
1
- import React from 'react'
2
- // @ts-ignore
3
- export const DynamicIcon = ({ icon: IconComponent, sx }) => (IconComponent ? <IconComponent sx={sx} /> : null)
@@ -1,2 +0,0 @@
1
- export { DynamicIcon } from "./dynamic_icon";
2
- export { LazyIcon } from "./lazy_icon";
@@ -1,48 +0,0 @@
1
- import React, { useState } from 'react'
2
-
3
- import { SxProps } from '@mui/system'
4
- import { Avatar, Typography } from '@mui/material'
5
- import { imageLoader, toInitials } from '@fixefy/fixefy-ui-utils'
6
-
7
- import Image from 'next/image'
8
-
9
- // importing all the local icons - in the future should be removed to CDN server
10
- // const iconsModule = []
11
-
12
- export const LazyIcon = ({
13
- icon,
14
- root,
15
- width,
16
- height,
17
- }: {
18
- icon: string
19
- root?: string
20
- width?: number | `${number}`
21
- height?: number | `${number}`
22
- sx?: SxProps
23
- }) => {
24
- const [isError, setError] = useState(false)
25
- const handleError = (isError: boolean) => setError(isError)
26
-
27
- if (isError) {
28
- return (
29
- <Avatar>
30
- <Typography fontSize={29} fontWeight={600}>
31
- {toInitials(icon)}
32
- </Typography>
33
- </Avatar>
34
- )
35
- }
36
-
37
- return (
38
- <Image
39
- alt={icon}
40
- width={width}
41
- height={height}
42
- loader={(obj) => imageLoader({ ...obj, root })}
43
- src={icon}
44
- onLoad={() => handleError(false)}
45
- onError={() => handleError(true)}
46
- />
47
- )
48
- }
@@ -1,10 +0,0 @@
1
- export type IconPropsType = {
2
- className?: string
3
- color?: unknown
4
- fontSize?: string | number
5
- height?: `${number}` | number
6
- icon: string
7
- sx?: any
8
- root: string
9
- width?: `${number}` | number
10
- }
@@ -1,2 +0,0 @@
1
- export { FxIcon } from './FxIcon'
2
- export { IconPropsType } from './icon_types'