@fixefy/fixefy-ui-components 0.0.42 → 0.0.44
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/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,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,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
|
-
}
|
package/src/FxAvatar/index.ts
DELETED
|
@@ -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
|
-
}
|
package/src/FxButton/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ButtonStyled = void 0;
|
|
4
|
-
const material_1 = require("@mui/material");
|
|
5
|
-
const styles_1 = require("@mui/material/styles");
|
|
6
|
-
exports.ButtonStyled = (0, styles_1.styled)(material_1.Button)(({ theme, variant }) => {
|
|
7
|
-
const border = variant === 'text' ? `0px solid #0000` : `1px solid ${theme.palette.primary.main}`;
|
|
8
|
-
return {
|
|
9
|
-
border,
|
|
10
|
-
minHeight: '40px',
|
|
11
|
-
borderRadius: '100px',
|
|
12
|
-
minWidth: '87px',
|
|
13
|
-
fontSize: '12px',
|
|
14
|
-
letterSpacing: '0.5px',
|
|
15
|
-
};
|
|
16
|
-
});
|
|
@@ -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
|
-
})
|
package/src/FxChip/FxChip.tsx
DELETED
|
@@ -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
|
-
}
|
package/src/FxChip/index.ts
DELETED
|
@@ -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
|
-
})
|
package/src/FxIcon/FxIcon.tsx
DELETED
|
@@ -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,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
|
-
}
|
package/src/FxIcon/index.ts
DELETED
package/src/FxModal/FxModal.tsx
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { ModalPropsType } from '.'
|
|
3
|
-
import { Box, DialogContent } from '@mui/material'
|
|
4
|
-
import { FxDialog, DialogActionsStyled, StyledDialogTitle, StyledInlineDialogTitle } from './styles/modal.style'
|
|
5
|
-
|
|
6
|
-
//////////////
|
|
7
|
-
|
|
8
|
-
const FxDialogTitle = (props: any) => {
|
|
9
|
-
const { children, ...other } = props
|
|
10
|
-
return <StyledDialogTitle {...other}>{children}</StyledDialogTitle>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const FxInlineDialogTitle = (props: any) => {
|
|
14
|
-
const { children, ...other } = props
|
|
15
|
-
return <StyledInlineDialogTitle {...other}>{children}</StyledInlineDialogTitle>
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const IconTitle = ({ icon, title, inline }: { icon: string; title?: string; inline: boolean }) => {
|
|
19
|
-
const renderObject = inline ? (
|
|
20
|
-
<Box sx={{ display: 'flex', alignItems: 'center' }}>
|
|
21
|
-
{icon}
|
|
22
|
-
<FxInlineDialogTitle id="customized-dialog-title">{title}</FxInlineDialogTitle>
|
|
23
|
-
</Box>
|
|
24
|
-
) : (
|
|
25
|
-
<>
|
|
26
|
-
{icon && icon}
|
|
27
|
-
{title && <FxDialogTitle id="customized-dialog-title">{title}</FxDialogTitle>}
|
|
28
|
-
</>
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
return renderObject
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const FxModal = ({ isOpen = false, isIconTitleInline = false, icon, onClose, children, title, actions, ...rest }: ModalPropsType) => {
|
|
35
|
-
return (
|
|
36
|
-
<div>
|
|
37
|
-
<FxDialog {...rest} fullWidth onClose={onClose} aria-labelledby="customized-dialog-title" open={isOpen}>
|
|
38
|
-
<IconTitle icon={icon} title={title} inline={isIconTitleInline} />
|
|
39
|
-
<DialogContent>{children}</DialogContent>
|
|
40
|
-
{actions && <DialogActionsStyled>{actions}</DialogActionsStyled>}
|
|
41
|
-
</FxDialog>
|
|
42
|
-
</div>
|
|
43
|
-
)
|
|
44
|
-
}
|
package/src/FxModal/index.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { styled } from '@mui/material/styles'
|
|
2
|
-
import { Dialog, DialogActions, DialogTitle } from '@mui/material'
|
|
3
|
-
|
|
4
|
-
export const FxDialog = styled(Dialog)(() => ({
|
|
5
|
-
'& .MuiDialog-paper': {
|
|
6
|
-
borderRadius: 8,
|
|
7
|
-
padding: '24px',
|
|
8
|
-
// minWidth: "370px",
|
|
9
|
-
maxWidth: 'fit-content',
|
|
10
|
-
// height: "262px",
|
|
11
|
-
},
|
|
12
|
-
'& .MuiDialogContent-root': {
|
|
13
|
-
padding: 0,
|
|
14
|
-
},
|
|
15
|
-
// "& .MuiDialogTitle-root": {
|
|
16
|
-
// margin: "8px 0",
|
|
17
|
-
// },
|
|
18
|
-
'& .MuiDialogActions-root': {
|
|
19
|
-
margin: '24px 0 0 0',
|
|
20
|
-
padding: 0,
|
|
21
|
-
},
|
|
22
|
-
}))
|
|
23
|
-
|
|
24
|
-
export const StyledDialogTitle = styled(DialogTitle)(() => ({
|
|
25
|
-
fontSize: 14,
|
|
26
|
-
fontWeight: 900,
|
|
27
|
-
margin: '8px 0',
|
|
28
|
-
}))
|
|
29
|
-
|
|
30
|
-
export const StyledInlineDialogTitle = styled(DialogTitle)(() => ({
|
|
31
|
-
fontSize: 19,
|
|
32
|
-
fontWeight: 600,
|
|
33
|
-
color: '#568793',
|
|
34
|
-
margin: '8px 16px',
|
|
35
|
-
padding: 0,
|
|
36
|
-
}))
|
|
37
|
-
|
|
38
|
-
export const DialogActionsStyled = styled(DialogActions)(({}) => ({
|
|
39
|
-
justifyContent: 'flex-start',
|
|
40
|
-
}))
|