@fixefy/fixefy-ui-components 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/FxStatusBar/FxStatusBar.jsx +64 -0
- package/dist-cjs/FxStatusBar/helpers/constants.js +15 -0
- package/dist-cjs/FxStatusBar/index.js +5 -0
- package/dist-cjs/FxStatusBar/styles/statusBar.styles.jsx +39 -0
- package/dist-cjs/FxTextField/FxTextField.jsx +62 -0
- package/dist-cjs/FxTextField/index.js +5 -0
- package/dist-cjs/FxTodo/FxTodo.jsx +46 -0
- package/dist-cjs/FxTodo/index.js +5 -0
- package/dist-cjs/FxTodo/styles/todo.styles.jsx +75 -0
- package/dist-cjs/FxWizard/FxWizard.jsx +49 -0
- package/dist-cjs/FxWizard/WizardContext.jsx +86 -0
- package/dist-cjs/FxWizard/index.js +8 -0
- package/dist-cjs/FxWizard/styles/wizard.styles.jsx +17 -0
- package/dist-es/FxStatusBar/FxStatusBar.jsx +59 -0
- package/dist-es/FxStatusBar/helpers/constants.js +12 -0
- package/dist-es/FxStatusBar/index.js +1 -0
- package/dist-es/FxStatusBar/styles/statusBar.styles.jsx +39 -0
- package/dist-es/FxTextField/FxTextField.jsx +63 -0
- package/dist-es/FxTextField/index.js +1 -0
- package/dist-es/FxTodo/FxTodo.jsx +41 -0
- package/dist-es/FxTodo/index.js +1 -0
- package/dist-es/FxTodo/styles/todo.styles.jsx +97 -0
- package/dist-es/FxWizard/FxWizard.jsx +46 -0
- package/dist-es/FxWizard/WizardContext.jsx +84 -0
- package/dist-es/FxWizard/index.js +2 -0
- package/dist-es/FxWizard/styles/wizard.styles.jsx +18 -0
- package/dist-types/FxStatusBar/FxStatusBar.d.ts +3 -0
- package/dist-types/FxStatusBar/helpers/constants.d.ts +12 -0
- package/dist-types/FxStatusBar/index.d.ts +1 -0
- package/dist-types/FxStatusBar/styles/statusBar.styles.d.ts +3 -0
- package/dist-types/FxTextField/FxTextField.d.ts +4 -0
- package/dist-types/FxTextField/index.d.ts +2 -0
- package/dist-types/FxTodo/FxTodo.d.ts +3 -0
- package/dist-types/FxTodo/index.d.ts +2 -0
- package/dist-types/FxTodo/styles/todo.styles.d.ts +8 -0
- package/dist-types/FxWizard/FxWizard.d.ts +3 -0
- package/dist-types/FxWizard/WizardContext.d.ts +6 -0
- package/dist-types/FxWizard/index.d.ts +3 -0
- package/dist-types/FxWizard/styles/wizard.styles.d.ts +2 -0
- package/package.json +3 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatusBar = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const FxChip_1 = require("../FxChip");
|
|
8
|
+
const constants_1 = require("./helpers/constants");
|
|
9
|
+
const fixefy_ui_utils_1 = require("@fixefy/fixefy-ui-utils");
|
|
10
|
+
const statusBar_styles_1 = require("./styles/statusBar.styles");
|
|
11
|
+
const StatusBar = ({ onChangeStatus, onSearch, defaultStatus, title, options, chipsVariant = 'filled' }) => {
|
|
12
|
+
const [selectedStatus, setSelectedStatus] = (0, react_1.useState)([]);
|
|
13
|
+
const [searchValue, setSearchValue] = (0, react_1.useState)('');
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
if (defaultStatus) {
|
|
16
|
+
typeof defaultStatus === 'string' ? setSelectedStatus([defaultStatus]) : setSelectedStatus(defaultStatus);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
setSelectedStatus(['all']);
|
|
20
|
+
}
|
|
21
|
+
}, [defaultStatus]);
|
|
22
|
+
const onStatusClick = (status) => {
|
|
23
|
+
if (status === 'all') {
|
|
24
|
+
setSelectedStatus(() => {
|
|
25
|
+
if (selectedStatus.includes(status)) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return ['all'];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
setSelectedStatus((prevState) => {
|
|
35
|
+
if (selectedStatus.includes(status)) {
|
|
36
|
+
const rv = prevState.filter((_status) => _status !== status && _status !== 'all');
|
|
37
|
+
return rv.length == 0 ? ['all'] : rv;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const rv = prevState.filter((_status) => _status !== status && _status !== 'all');
|
|
41
|
+
return [...rv, status];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
(0, react_1.useEffect)(() => {
|
|
47
|
+
onChangeStatus(selectedStatus);
|
|
48
|
+
}, [selectedStatus]);
|
|
49
|
+
(0, react_1.useEffect)(() => {
|
|
50
|
+
onSearch && onSearch(searchValue);
|
|
51
|
+
}, [searchValue]);
|
|
52
|
+
const __options = options !== null && options !== void 0 ? options : constants_1.statuses;
|
|
53
|
+
return (<statusBar_styles_1.StatusBarCard>
|
|
54
|
+
{title && <statusBar_styles_1.StatusBarTitle style={{ marginRight: '8px' }}>{(0, fixefy_ui_utils_1.titleCase)(title)}</statusBar_styles_1.StatusBarTitle>}
|
|
55
|
+
|
|
56
|
+
<material_1.Stack direction="row" spacing={1}>
|
|
57
|
+
<statusBar_styles_1.StatusChipStyled onClick={() => onStatusClick('all')} label="All" variant={selectedStatus.includes('all') ? 'filled' : 'outlined'}/>
|
|
58
|
+
{Object.keys(__options).map((key, index) => {
|
|
59
|
+
return <FxChip_1.FxChip onClick={() => onStatusClick(__options[key])} key={index} label={(0, fixefy_ui_utils_1.titleCase)(key)} variant={chipsVariant} status={selectedStatus.includes(__options[key]) ? __options[key] : ''}/>;
|
|
60
|
+
})}
|
|
61
|
+
</material_1.Stack>
|
|
62
|
+
</statusBar_styles_1.StatusBarCard>);
|
|
63
|
+
};
|
|
64
|
+
exports.StatusBar = StatusBar;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.statuses = void 0;
|
|
4
|
+
exports.statuses = {
|
|
5
|
+
Declined: 'declined',
|
|
6
|
+
Pending: 'pending',
|
|
7
|
+
Approved: 'approved',
|
|
8
|
+
Active: 'active',
|
|
9
|
+
Challenge: 'challenged',
|
|
10
|
+
in_review: 'in_review',
|
|
11
|
+
Discrepancy: 'discrepancy',
|
|
12
|
+
no_pricing: 'no_pricing',
|
|
13
|
+
in_progress: 'in_progress',
|
|
14
|
+
Duplicated: 'duplicated',
|
|
15
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatusBar = void 0;
|
|
4
|
+
var FxStatusBar_1 = require("./FxStatusBar");
|
|
5
|
+
Object.defineProperty(exports, "StatusBar", { enumerable: true, get: function () { return FxStatusBar_1.StatusBar; } });
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatusChipStyled = exports.StatusBarTitle = exports.StatusBarCard = void 0;
|
|
4
|
+
const styles_1 = require("@mui/material/styles");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
exports.StatusBarCard = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
7
|
+
background: theme.palette.common.white,
|
|
8
|
+
borderRadius: 4,
|
|
9
|
+
padding: 16,
|
|
10
|
+
boxShadow: "0px 0px 10px rgba(86, 135, 147, 0.3)",
|
|
11
|
+
display: "flex",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
width: "fit-content",
|
|
14
|
+
}));
|
|
15
|
+
exports.StatusBarTitle = (0, styles_1.styled)("span")(({ theme }) => (Object.assign(Object.assign({}, theme.typography.body1), { color: theme.palette.common.black })));
|
|
16
|
+
exports.StatusChipStyled = (0, styles_1.styled)(material_1.Chip)(({ theme, variant }) => {
|
|
17
|
+
let backgroundColor, border, labelColor;
|
|
18
|
+
if (variant === "filled") {
|
|
19
|
+
backgroundColor = theme.palette.primary.light;
|
|
20
|
+
labelColor = theme.palette.common.white;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
backgroundColor = theme.palette.common.white;
|
|
24
|
+
}
|
|
25
|
+
border = "#F0F0F0";
|
|
26
|
+
return {
|
|
27
|
+
height: 20,
|
|
28
|
+
minWidth: 34,
|
|
29
|
+
maxWidth: 120,
|
|
30
|
+
["& .MuiChip-label"]: {
|
|
31
|
+
fontSize: 9,
|
|
32
|
+
fontWeight: 600,
|
|
33
|
+
lineHeight: "12px",
|
|
34
|
+
color: labelColor ? labelColor : theme.palette["statistics"].label,
|
|
35
|
+
},
|
|
36
|
+
backgroundColor,
|
|
37
|
+
border: `1px solid ${border}`,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FxTextField = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const fixefy_ui_utils_1 = require("@fixefy/fixefy-ui-utils");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const ErrorRounded_1 = tslib_1.__importDefault(require("@mui/icons-material/ErrorRounded"));
|
|
9
|
+
const FxTextField = ({ autoFocus, droppedItem, defaultValue = '', onChange, structure, endAdornment, startAdornment, required, helperText, error = false, errorText, disabled }) => {
|
|
10
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
11
|
+
const { input_type, extended: { placeholder, title_path }, title, } = structure;
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
if (droppedItem) {
|
|
14
|
+
const { item, type } = droppedItem;
|
|
15
|
+
setValue(item[title_path]);
|
|
16
|
+
}
|
|
17
|
+
}, [droppedItem]);
|
|
18
|
+
const _onChange = (e) => {
|
|
19
|
+
onChange && onChange(e);
|
|
20
|
+
setValue(e.target.value);
|
|
21
|
+
};
|
|
22
|
+
return (<material_1.FormControl variant="standard" error={error}>
|
|
23
|
+
{title && (<material_1.InputLabel shrink htmlFor={title} sx={(theme) => (Object.assign(Object.assign(Object.assign({ color: theme.palette.greyscale.light, '&.Mui-focused': {
|
|
24
|
+
color: theme.palette.greyscale.light,
|
|
25
|
+
} }, (disabled && { opacity: '0.3' })), { '&.Mui-error': { color: theme.palette.greyscale.light } }), (required && {
|
|
26
|
+
'&:before': {
|
|
27
|
+
content: "'*'",
|
|
28
|
+
color: theme.palette.redscale.main,
|
|
29
|
+
display: 'inline-block',
|
|
30
|
+
marginRight: '5px',
|
|
31
|
+
},
|
|
32
|
+
})))}>
|
|
33
|
+
{(0, fixefy_ui_utils_1.titleCase)(title)}
|
|
34
|
+
</material_1.InputLabel>)}
|
|
35
|
+
<material_1.InputBase endAdornment={endAdornment} startAdornment={startAdornment} id={title} autoFocus={autoFocus ? autoFocus : false} placeholder={(0, fixefy_ui_utils_1.titleCase)(placeholder)} onChange={_onChange} type={input_type && input_type.value} value={value} error={error}/>
|
|
36
|
+
{error && errorText ? (<material_1.FormHelperText sx={(theme) => ({
|
|
37
|
+
'&.Mui-error': {
|
|
38
|
+
color: theme.palette.redscale.main,
|
|
39
|
+
},
|
|
40
|
+
display: 'grid',
|
|
41
|
+
gridAutoFlow: 'column',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
justifyContent: 'left',
|
|
44
|
+
columnGap: theme.spacing(0.6),
|
|
45
|
+
fontSize: '11px',
|
|
46
|
+
})}>
|
|
47
|
+
<ErrorRounded_1.default sx={(theme) => ({
|
|
48
|
+
color: theme.palette.redscale.main,
|
|
49
|
+
width: 10,
|
|
50
|
+
height: 10,
|
|
51
|
+
})}/>
|
|
52
|
+
{(0, fixefy_ui_utils_1.titleCase)(errorText)}
|
|
53
|
+
</material_1.FormHelperText>) : (<material_1.FormHelperText sx={(theme) => ({
|
|
54
|
+
color: theme.palette.greyscale.light,
|
|
55
|
+
fontSize: '11px',
|
|
56
|
+
})}>
|
|
57
|
+
{helperText}
|
|
58
|
+
</material_1.FormHelperText>)}
|
|
59
|
+
</material_1.FormControl>);
|
|
60
|
+
};
|
|
61
|
+
exports.FxTextField = FxTextField;
|
|
62
|
+
exports.default = exports.FxTextField;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FxTextField = void 0;
|
|
4
|
+
var FxTextField_1 = require("./FxTextField");
|
|
5
|
+
Object.defineProperty(exports, "FxTextField", { enumerable: true, get: function () { return FxTextField_1.FxTextField; } });
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FxTodo = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const image_1 = tslib_1.__importDefault(require("next/image"));
|
|
7
|
+
const FxAvatar_1 = require("../FxAvatar");
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const fixefy_ui_utils_1 = require("@fixefy/fixefy-ui-utils");
|
|
10
|
+
const todo_styles_1 = require("./styles/todo.styles");
|
|
11
|
+
function FxTodo({ todo }) {
|
|
12
|
+
return (<todo_styles_1.TodoCard>
|
|
13
|
+
<todo_styles_1.TodoCardHeader>
|
|
14
|
+
<todo_styles_1.TodoCardPriority priority={todo.priority}>
|
|
15
|
+
<image_1.default alt={todo.title} width={16} height={16} loader={() => (0, fixefy_ui_utils_1.imageLoader)({
|
|
16
|
+
root: 'https://cdn-dev.fixefy.me/',
|
|
17
|
+
src: 'invoices/severity_low.svg',
|
|
18
|
+
})} src={`invoices/severity_${todo.priority}.svg`} onLoad={() => console.log('loaded')} onError={(e) => console.log('error:', e)}/>
|
|
19
|
+
|
|
20
|
+
{(0, fixefy_ui_utils_1.titleCase)(todo.priority)}
|
|
21
|
+
</todo_styles_1.TodoCardPriority>
|
|
22
|
+
{todo.isNew && <todo_styles_1.TodoCardTag>New</todo_styles_1.TodoCardTag>}
|
|
23
|
+
</todo_styles_1.TodoCardHeader>
|
|
24
|
+
<todo_styles_1.TodoCardContent>
|
|
25
|
+
<p>{(0, fixefy_ui_utils_1.titleCase)(todo.title)}</p>
|
|
26
|
+
<span>{(0, fixefy_ui_utils_1.titleCase)(todo.description)}</span>
|
|
27
|
+
{todo.actionTitle && (<todo_styles_1.TodoCardContentButton size="small" onClick={todo.action ? todo.action : () => { }}>
|
|
28
|
+
{todo.actionTitle}
|
|
29
|
+
</todo_styles_1.TodoCardContentButton>)}
|
|
30
|
+
</todo_styles_1.TodoCardContent>
|
|
31
|
+
<material_1.Divider sx={{ mb: '16px' }}/>
|
|
32
|
+
<todo_styles_1.TodoCardFooter>
|
|
33
|
+
<todo_styles_1.TodoCardFooterDueDate>
|
|
34
|
+
<span>Due Date</span>
|
|
35
|
+
<p>
|
|
36
|
+
{(0, fixefy_ui_utils_1.normalizeTimestamp)(todo.created_date, {
|
|
37
|
+
dateOnly: true,
|
|
38
|
+
format: 'dd.mm.yyyy',
|
|
39
|
+
})}
|
|
40
|
+
</p>
|
|
41
|
+
</todo_styles_1.TodoCardFooterDueDate>
|
|
42
|
+
<FxAvatar_1.FxAvatar max={4} isEditable={todo.isUserEditable} users={todo.users}/>
|
|
43
|
+
</todo_styles_1.TodoCardFooter>
|
|
44
|
+
</todo_styles_1.TodoCard>);
|
|
45
|
+
}
|
|
46
|
+
exports.FxTodo = FxTodo;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TodoCardFooterDueDate = exports.TodoCardFooter = exports.TodoCardContentButton = exports.TodoCardContent = exports.TodoCardTag = exports.TodoCardPriority = exports.TodoCardHeader = exports.TodoCard = void 0;
|
|
4
|
+
const styles_1 = require("@mui/material/styles");
|
|
5
|
+
const FxButton_1 = require("../../FxButton");
|
|
6
|
+
exports.TodoCard = (0, styles_1.styled)('div')(({ theme }) => ({
|
|
7
|
+
background: theme.palette.common.white,
|
|
8
|
+
borderRadius: 8,
|
|
9
|
+
padding: 16,
|
|
10
|
+
marginBottom: 4,
|
|
11
|
+
}));
|
|
12
|
+
exports.TodoCardHeader = (0, styles_1.styled)('div')(({ theme }) => ({
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'space-between',
|
|
16
|
+
marginBottom: 16,
|
|
17
|
+
}));
|
|
18
|
+
exports.TodoCardPriority = (0, styles_1.styled)('div')(({ theme, priority }) => (Object.assign(Object.assign({ display: 'flex', alignItems: 'center', justifyContent: 'center' }, theme.typography.table), { color: theme.palette.priority[priority], ['& img']: {
|
|
19
|
+
marginRight: 4,
|
|
20
|
+
} })));
|
|
21
|
+
exports.TodoCardTag = (0, styles_1.styled)('div')(({ theme }) => (Object.assign(Object.assign({}, theme.typography.table), { color: theme.palette.common.white, width: 42, height: 18, background: '#6FCF97', borderRadius: 50, display: 'flex', alignItems: 'center', justifyContent: 'center' })));
|
|
22
|
+
exports.TodoCardContent = (0, styles_1.styled)('div')(({ theme }) => ({
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'flex-start',
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
marginBottom: 16,
|
|
28
|
+
['& p']: {
|
|
29
|
+
fontStyle: 'normal',
|
|
30
|
+
fontSize: 14,
|
|
31
|
+
letterSpacing: '0.15px',
|
|
32
|
+
color: theme.palette.typography.title,
|
|
33
|
+
fontWeight: 700,
|
|
34
|
+
lineHeight: '16px',
|
|
35
|
+
margin: 0,
|
|
36
|
+
},
|
|
37
|
+
['& span']: {
|
|
38
|
+
fontStyle: 'normal',
|
|
39
|
+
fontSize: 14,
|
|
40
|
+
letterSpacing: '0.15px',
|
|
41
|
+
color: theme.palette.typography.title,
|
|
42
|
+
fontWeight: 400,
|
|
43
|
+
lineHeight: '20px',
|
|
44
|
+
marginBottom: 16,
|
|
45
|
+
},
|
|
46
|
+
}));
|
|
47
|
+
exports.TodoCardContentButton = (0, styles_1.styled)(FxButton_1.FxButton)(({ theme }) => (Object.assign(Object.assign({}, theme.typography.button), { color: '#568793', fontSize: 12, maxHeight: 32, minHeight: 32, paddingLeft: 12, paddingRight: 12 })));
|
|
48
|
+
exports.TodoCardFooter = (0, styles_1.styled)('div')(({ theme }) => ({
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'space-between',
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
}));
|
|
54
|
+
exports.TodoCardFooterDueDate = (0, styles_1.styled)('div')(({ theme }) => ({
|
|
55
|
+
display: 'flex',
|
|
56
|
+
alignItems: 'flex-start',
|
|
57
|
+
flexDirection: 'column',
|
|
58
|
+
['& p']: {
|
|
59
|
+
fontWeight: 'normal',
|
|
60
|
+
fontStyle: 'normal',
|
|
61
|
+
fontSize: 11,
|
|
62
|
+
lineHeight: '16px',
|
|
63
|
+
letterSpacing: '0.1px',
|
|
64
|
+
color: theme.palette.typography.title,
|
|
65
|
+
margin: 0,
|
|
66
|
+
},
|
|
67
|
+
['& span']: {
|
|
68
|
+
fontWeight: 'normal',
|
|
69
|
+
fontStyle: 'normal',
|
|
70
|
+
fontSize: 14,
|
|
71
|
+
lineHeight: '24px',
|
|
72
|
+
letterSpacing: '0.15px',
|
|
73
|
+
color: theme.palette.statistics.label,
|
|
74
|
+
},
|
|
75
|
+
}));
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Wizard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const web_1 = require("@react-spring/web");
|
|
8
|
+
const wizard_styles_1 = require("./styles/wizard.styles");
|
|
9
|
+
const Animations = {
|
|
10
|
+
rightToLeft: {
|
|
11
|
+
from: {
|
|
12
|
+
opacity: 0,
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
transform: 'translate3d(20%,0,0)',
|
|
15
|
+
width: '100%',
|
|
16
|
+
},
|
|
17
|
+
enter: {
|
|
18
|
+
opacity: 1,
|
|
19
|
+
transform: 'translate3d(0%,0,0)',
|
|
20
|
+
},
|
|
21
|
+
leave: {
|
|
22
|
+
opacity: 0,
|
|
23
|
+
transform: 'translate3d(-10%,0,0)',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
leftToRight: {
|
|
27
|
+
from: { opacity: 0, position: 'absolute', width: '100%' },
|
|
28
|
+
enter: {
|
|
29
|
+
opacity: 1,
|
|
30
|
+
transform: 'translate3d(0%,0,0)',
|
|
31
|
+
},
|
|
32
|
+
leave: {
|
|
33
|
+
opacity: 0,
|
|
34
|
+
transform: 'translate3d(20%,0,0)',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
function Wizard(_a) {
|
|
39
|
+
var { open, content = [], currentPage = 0, reverse = false, onCancel, title, actions, icon, componentStyles, divider = true } = _a, rest = tslib_1.__rest(_a, ["open", "content", "currentPage", "reverse", "onCancel", "title", "actions", "icon", "componentStyles", "divider"]);
|
|
40
|
+
const transitions = (0, web_1.useTransition)(content[currentPage], Object.assign(Object.assign({}, Animations[reverse ? 'leftToRight' : 'rightToLeft']), { keys: null }));
|
|
41
|
+
return (<wizard_styles_1.StyledModal {...rest} title={title} actions={actions} icon={icon} isOpen={Boolean(open)} isIconTitleInline onClose={(e) => onCancel(e, '')}>
|
|
42
|
+
{divider && <material_1.Divider sx={{ mb: '32px', mt: '16px' }}/>}
|
|
43
|
+
<wizard_styles_1.StyledContent style={Object.assign({}, componentStyles)}>
|
|
44
|
+
{transitions((style, item) => (<web_1.animated.div style={style}>{item}</web_1.animated.div>))}
|
|
45
|
+
</wizard_styles_1.StyledContent>
|
|
46
|
+
{divider && <material_1.Divider sx={{ mb: '8px', mt: '32px' }}/>}
|
|
47
|
+
</wizard_styles_1.StyledModal>);
|
|
48
|
+
}
|
|
49
|
+
exports.Wizard = Wizard;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WizardContextProvider = exports.WizardContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const FxWizard_1 = require("./FxWizard");
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
exports.WizardContext = (0, react_1.createContext)({});
|
|
8
|
+
const WizardContextProvider = ({ children }) => {
|
|
9
|
+
const [currentPage, setCurrentPage] = (0, react_1.useState)(0);
|
|
10
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
11
|
+
const [content, setContent] = (0, react_1.useState)([]);
|
|
12
|
+
const [reverse, setReverse] = (0, react_1.useState)(false);
|
|
13
|
+
const [options, setOptions] = (0, react_1.useState)({});
|
|
14
|
+
const [modalProps, _setModalProps] = (0, react_1.useState)({
|
|
15
|
+
shouldCloseOnBackdropClick: true,
|
|
16
|
+
shouldCloseOnEscapeKeyDown: true,
|
|
17
|
+
});
|
|
18
|
+
const [componentStyles, setComponentStyles] = (0, react_1.useState)({
|
|
19
|
+
width: '100%',
|
|
20
|
+
height: 500,
|
|
21
|
+
contain: 'content',
|
|
22
|
+
overflow: 'scroll',
|
|
23
|
+
});
|
|
24
|
+
const onCancel = (event, reason) => {
|
|
25
|
+
switch (reason) {
|
|
26
|
+
case 'escapeKeyDown': {
|
|
27
|
+
if (modalProps.shouldCloseOnEscapeKeyDown) {
|
|
28
|
+
return setOpen(false);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
case 'backdropClick': {
|
|
35
|
+
if (modalProps.shouldCloseOnBackdropClick) {
|
|
36
|
+
return setOpen(false);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
default: {
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const onOpen = () => {
|
|
47
|
+
setOpen(true);
|
|
48
|
+
};
|
|
49
|
+
const nextPage = () => {
|
|
50
|
+
console.log('nextPage');
|
|
51
|
+
};
|
|
52
|
+
const prevPage = () => {
|
|
53
|
+
console.log('prevPage');
|
|
54
|
+
};
|
|
55
|
+
const setModalProps = (newState) => {
|
|
56
|
+
_setModalProps((prevState) => (Object.assign(Object.assign({}, prevState), newState)));
|
|
57
|
+
};
|
|
58
|
+
const setPage = (page, option) => {
|
|
59
|
+
if (option) {
|
|
60
|
+
setOptions(Object.assign(Object.assign({}, options), option));
|
|
61
|
+
}
|
|
62
|
+
setCurrentPage((prevCurrentPage) => {
|
|
63
|
+
setReverse(page < prevCurrentPage);
|
|
64
|
+
return page;
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const _state = {
|
|
68
|
+
currentPage,
|
|
69
|
+
nextPage,
|
|
70
|
+
prevPage,
|
|
71
|
+
onOpen,
|
|
72
|
+
open,
|
|
73
|
+
setOpen,
|
|
74
|
+
setContent,
|
|
75
|
+
setPage,
|
|
76
|
+
options,
|
|
77
|
+
setModalProps,
|
|
78
|
+
setComponentStyles,
|
|
79
|
+
setOptions,
|
|
80
|
+
};
|
|
81
|
+
return (<exports.WizardContext.Provider value={_state}>
|
|
82
|
+
{children}
|
|
83
|
+
<FxWizard_1.Wizard {...modalProps} componentStyles={componentStyles} currentPage={currentPage} reverse={reverse} open={open} onCancel={onCancel} content={content}/>
|
|
84
|
+
</exports.WizardContext.Provider>);
|
|
85
|
+
};
|
|
86
|
+
exports.WizardContextProvider = WizardContextProvider;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WizardContextProvider = exports.WizardContext = exports.Wizard = void 0;
|
|
4
|
+
var FxWizard_1 = require("./FxWizard");
|
|
5
|
+
Object.defineProperty(exports, "Wizard", { enumerable: true, get: function () { return FxWizard_1.Wizard; } });
|
|
6
|
+
var WizardContext_1 = require("./WizardContext");
|
|
7
|
+
Object.defineProperty(exports, "WizardContext", { enumerable: true, get: function () { return WizardContext_1.WizardContext; } });
|
|
8
|
+
Object.defineProperty(exports, "WizardContextProvider", { enumerable: true, get: function () { return WizardContext_1.WizardContextProvider; } });
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StyledModal = exports.StyledContent = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const FxModal_1 = require("../../FxModal");
|
|
7
|
+
exports.StyledContent = (0, styles_1.styled)(material_1.Box) ``;
|
|
8
|
+
exports.StyledModal = (0, styles_1.styled)(FxModal_1.FxModal)(({ theme }) => ({
|
|
9
|
+
'& #customized-dialog-title': Object.assign(Object.assign({}, theme.typography.h5), { color: theme.palette.typography.title, padding: 0 }),
|
|
10
|
+
'& .MuiDialog-paper': {
|
|
11
|
+
maxWidth: '74% !important',
|
|
12
|
+
position: 'relative',
|
|
13
|
+
},
|
|
14
|
+
'& .MuiDialogContent-root': {
|
|
15
|
+
position: 'relative',
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Stack } from '@mui/material';
|
|
3
|
+
import { FxChip } from '../FxChip';
|
|
4
|
+
import { statuses } from './helpers/constants';
|
|
5
|
+
import { titleCase } from '@fixefy/fixefy-ui-utils';
|
|
6
|
+
import { StatusBarCard, StatusBarTitle, StatusChipStyled } from './styles/statusBar.styles';
|
|
7
|
+
export const StatusBar = ({ onChangeStatus, onSearch, defaultStatus, title, options, chipsVariant = 'filled' }) => {
|
|
8
|
+
const [selectedStatus, setSelectedStatus] = useState([]);
|
|
9
|
+
const [searchValue, setSearchValue] = useState('');
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (defaultStatus) {
|
|
12
|
+
typeof defaultStatus === 'string' ? setSelectedStatus([defaultStatus]) : setSelectedStatus(defaultStatus);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
setSelectedStatus(['all']);
|
|
16
|
+
}
|
|
17
|
+
}, [defaultStatus]);
|
|
18
|
+
const onStatusClick = (status) => {
|
|
19
|
+
if (status === 'all') {
|
|
20
|
+
setSelectedStatus(() => {
|
|
21
|
+
if (selectedStatus.includes(status)) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return ['all'];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
setSelectedStatus((prevState) => {
|
|
31
|
+
if (selectedStatus.includes(status)) {
|
|
32
|
+
const rv = prevState.filter((_status) => _status !== status && _status !== 'all');
|
|
33
|
+
return rv.length == 0 ? ['all'] : rv;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
const rv = prevState.filter((_status) => _status !== status && _status !== 'all');
|
|
37
|
+
return [...rv, status];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
onChangeStatus(selectedStatus);
|
|
44
|
+
}, [selectedStatus]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
onSearch && onSearch(searchValue);
|
|
47
|
+
}, [searchValue]);
|
|
48
|
+
const __options = options ?? statuses;
|
|
49
|
+
return (<StatusBarCard>
|
|
50
|
+
{title && <StatusBarTitle style={{ marginRight: '8px' }}>{titleCase(title)}</StatusBarTitle>}
|
|
51
|
+
|
|
52
|
+
<Stack direction="row" spacing={1}>
|
|
53
|
+
<StatusChipStyled onClick={() => onStatusClick('all')} label="All" variant={selectedStatus.includes('all') ? 'filled' : 'outlined'}/>
|
|
54
|
+
{Object.keys(__options).map((key, index) => {
|
|
55
|
+
return <FxChip onClick={() => onStatusClick(__options[key])} key={index} label={titleCase(key)} variant={chipsVariant} status={selectedStatus.includes(__options[key]) ? __options[key] : ''}/>;
|
|
56
|
+
})}
|
|
57
|
+
</Stack>
|
|
58
|
+
</StatusBarCard>);
|
|
59
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StatusBar } from "./FxStatusBar";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { Box, Chip as MuiChip } from "@mui/material";
|
|
3
|
+
export const StatusBarCard = styled(Box)(({ theme }) => ({
|
|
4
|
+
background: theme.palette.common.white,
|
|
5
|
+
borderRadius: 4,
|
|
6
|
+
padding: 16,
|
|
7
|
+
boxShadow: "0px 0px 10px rgba(86, 135, 147, 0.3)",
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
width: "fit-content",
|
|
11
|
+
}));
|
|
12
|
+
export const StatusBarTitle = styled("span")(({ theme }) => ({
|
|
13
|
+
...theme.typography.body1,
|
|
14
|
+
color: theme.palette.common.black,
|
|
15
|
+
}));
|
|
16
|
+
export const StatusChipStyled = styled(MuiChip)(({ theme, variant }) => {
|
|
17
|
+
let backgroundColor, border, labelColor;
|
|
18
|
+
if (variant === "filled") {
|
|
19
|
+
backgroundColor = theme.palette.primary.light;
|
|
20
|
+
labelColor = theme.palette.common.white;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
backgroundColor = theme.palette.common.white;
|
|
24
|
+
}
|
|
25
|
+
border = "#F0F0F0";
|
|
26
|
+
return {
|
|
27
|
+
height: 20,
|
|
28
|
+
minWidth: 34,
|
|
29
|
+
maxWidth: 120,
|
|
30
|
+
["& .MuiChip-label"]: {
|
|
31
|
+
fontSize: 9,
|
|
32
|
+
fontWeight: 600,
|
|
33
|
+
lineHeight: "12px",
|
|
34
|
+
color: labelColor ? labelColor : theme.palette["statistics"].label,
|
|
35
|
+
},
|
|
36
|
+
backgroundColor,
|
|
37
|
+
border: `1px solid ${border}`,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { titleCase } from '@fixefy/fixefy-ui-utils';
|
|
3
|
+
import { FormControl, FormHelperText, InputBase, InputLabel } from '@mui/material';
|
|
4
|
+
import ErrorRoundedIcon from '@mui/icons-material/ErrorRounded';
|
|
5
|
+
export const FxTextField = ({ autoFocus, droppedItem, defaultValue = '', onChange, structure, endAdornment, startAdornment, required, helperText, error = false, errorText, disabled }) => {
|
|
6
|
+
const [value, setValue] = useState(defaultValue);
|
|
7
|
+
const { input_type, extended: { placeholder, title_path }, title, } = structure;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (droppedItem) {
|
|
10
|
+
const { item, type } = droppedItem;
|
|
11
|
+
setValue(item[title_path]);
|
|
12
|
+
}
|
|
13
|
+
}, [droppedItem]);
|
|
14
|
+
const _onChange = (e) => {
|
|
15
|
+
onChange && onChange(e);
|
|
16
|
+
setValue(e.target.value);
|
|
17
|
+
};
|
|
18
|
+
return (<FormControl variant="standard" error={error}>
|
|
19
|
+
{title && (<InputLabel shrink htmlFor={title} sx={(theme) => ({
|
|
20
|
+
color: theme.palette.greyscale.light,
|
|
21
|
+
'&.Mui-focused': {
|
|
22
|
+
color: theme.palette.greyscale.light,
|
|
23
|
+
},
|
|
24
|
+
...(disabled && { opacity: '0.3' }),
|
|
25
|
+
'&.Mui-error': { color: theme.palette.greyscale.light },
|
|
26
|
+
...(required && {
|
|
27
|
+
'&:before': {
|
|
28
|
+
content: "'*'",
|
|
29
|
+
color: theme.palette.redscale.main,
|
|
30
|
+
display: 'inline-block',
|
|
31
|
+
marginRight: '5px',
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
})}>
|
|
35
|
+
{titleCase(title)}
|
|
36
|
+
</InputLabel>)}
|
|
37
|
+
<InputBase endAdornment={endAdornment} startAdornment={startAdornment} id={title} autoFocus={autoFocus ? autoFocus : false} placeholder={titleCase(placeholder)} onChange={_onChange} type={input_type && input_type.value} value={value} error={error}/>
|
|
38
|
+
{error && errorText ? (<FormHelperText sx={(theme) => ({
|
|
39
|
+
'&.Mui-error': {
|
|
40
|
+
color: theme.palette.redscale.main,
|
|
41
|
+
},
|
|
42
|
+
display: 'grid',
|
|
43
|
+
gridAutoFlow: 'column',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
justifyContent: 'left',
|
|
46
|
+
columnGap: theme.spacing(0.6),
|
|
47
|
+
fontSize: '11px',
|
|
48
|
+
})}>
|
|
49
|
+
<ErrorRoundedIcon sx={(theme) => ({
|
|
50
|
+
color: theme.palette.redscale.main,
|
|
51
|
+
width: 10,
|
|
52
|
+
height: 10,
|
|
53
|
+
})}/>
|
|
54
|
+
{titleCase(errorText)}
|
|
55
|
+
</FormHelperText>) : (<FormHelperText sx={(theme) => ({
|
|
56
|
+
color: theme.palette.greyscale.light,
|
|
57
|
+
fontSize: '11px',
|
|
58
|
+
})}>
|
|
59
|
+
{helperText}
|
|
60
|
+
</FormHelperText>)}
|
|
61
|
+
</FormControl>);
|
|
62
|
+
};
|
|
63
|
+
export default FxTextField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FxTextField } from './FxTextField';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import { FxAvatar } from '../FxAvatar';
|
|
4
|
+
import { Divider } from '@mui/material';
|
|
5
|
+
import { imageLoader, normalizeTimestamp, titleCase } from '@fixefy/fixefy-ui-utils';
|
|
6
|
+
import { TodoCard, TodoCardHeader, TodoCardContent, TodoCardPriority, TodoCardTag, TodoCardFooter, TodoCardFooterDueDate, TodoCardContentButton } from './styles/todo.styles';
|
|
7
|
+
export function FxTodo({ todo }) {
|
|
8
|
+
return (<TodoCard>
|
|
9
|
+
<TodoCardHeader>
|
|
10
|
+
<TodoCardPriority priority={todo.priority}>
|
|
11
|
+
<Image alt={todo.title} width={16} height={16} loader={() => imageLoader({
|
|
12
|
+
root: 'https://cdn-dev.fixefy.me/',
|
|
13
|
+
src: 'invoices/severity_low.svg',
|
|
14
|
+
})} src={`invoices/severity_${todo.priority}.svg`} onLoad={() => console.log('loaded')} onError={(e) => console.log('error:', e)}/>
|
|
15
|
+
|
|
16
|
+
{titleCase(todo.priority)}
|
|
17
|
+
</TodoCardPriority>
|
|
18
|
+
{todo.isNew && <TodoCardTag>New</TodoCardTag>}
|
|
19
|
+
</TodoCardHeader>
|
|
20
|
+
<TodoCardContent>
|
|
21
|
+
<p>{titleCase(todo.title)}</p>
|
|
22
|
+
<span>{titleCase(todo.description)}</span>
|
|
23
|
+
{todo.actionTitle && (<TodoCardContentButton size="small" onClick={todo.action ? todo.action : () => { }}>
|
|
24
|
+
{todo.actionTitle}
|
|
25
|
+
</TodoCardContentButton>)}
|
|
26
|
+
</TodoCardContent>
|
|
27
|
+
<Divider sx={{ mb: '16px' }}/>
|
|
28
|
+
<TodoCardFooter>
|
|
29
|
+
<TodoCardFooterDueDate>
|
|
30
|
+
<span>Due Date</span>
|
|
31
|
+
<p>
|
|
32
|
+
{normalizeTimestamp(todo.created_date, {
|
|
33
|
+
dateOnly: true,
|
|
34
|
+
format: 'dd.mm.yyyy',
|
|
35
|
+
})}
|
|
36
|
+
</p>
|
|
37
|
+
</TodoCardFooterDueDate>
|
|
38
|
+
<FxAvatar max={4} isEditable={todo.isUserEditable} users={todo.users}/>
|
|
39
|
+
</TodoCardFooter>
|
|
40
|
+
</TodoCard>);
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FxTodo } from './FxTodo';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { styled } from '@mui/material/styles';
|
|
2
|
+
import { FxButton } from '../../FxButton';
|
|
3
|
+
export const TodoCard = styled('div')(({ theme }) => ({
|
|
4
|
+
background: theme.palette.common.white,
|
|
5
|
+
borderRadius: 8,
|
|
6
|
+
padding: 16,
|
|
7
|
+
marginBottom: 4,
|
|
8
|
+
}));
|
|
9
|
+
export const TodoCardHeader = styled('div')(({ theme }) => ({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'space-between',
|
|
13
|
+
marginBottom: 16,
|
|
14
|
+
}));
|
|
15
|
+
export const TodoCardPriority = styled('div')(({ theme, priority }) => ({
|
|
16
|
+
display: 'flex',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
...theme.typography.table,
|
|
20
|
+
color: theme.palette.priority[priority],
|
|
21
|
+
['& img']: {
|
|
22
|
+
marginRight: 4,
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
export const TodoCardTag = styled('div')(({ theme }) => ({
|
|
26
|
+
...theme.typography.table,
|
|
27
|
+
color: theme.palette.common.white,
|
|
28
|
+
width: 42,
|
|
29
|
+
height: 18,
|
|
30
|
+
background: '#6FCF97',
|
|
31
|
+
borderRadius: 50,
|
|
32
|
+
display: 'flex',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
}));
|
|
36
|
+
export const TodoCardContent = styled('div')(({ theme }) => ({
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'flex-start',
|
|
39
|
+
justifyContent: 'space-between',
|
|
40
|
+
flexDirection: 'column',
|
|
41
|
+
marginBottom: 16,
|
|
42
|
+
['& p']: {
|
|
43
|
+
fontStyle: 'normal',
|
|
44
|
+
fontSize: 14,
|
|
45
|
+
letterSpacing: '0.15px',
|
|
46
|
+
color: theme.palette.typography.title,
|
|
47
|
+
fontWeight: 700,
|
|
48
|
+
lineHeight: '16px',
|
|
49
|
+
margin: 0,
|
|
50
|
+
},
|
|
51
|
+
['& span']: {
|
|
52
|
+
fontStyle: 'normal',
|
|
53
|
+
fontSize: 14,
|
|
54
|
+
letterSpacing: '0.15px',
|
|
55
|
+
color: theme.palette.typography.title,
|
|
56
|
+
fontWeight: 400,
|
|
57
|
+
lineHeight: '20px',
|
|
58
|
+
marginBottom: 16,
|
|
59
|
+
},
|
|
60
|
+
}));
|
|
61
|
+
export const TodoCardContentButton = styled(FxButton)(({ theme }) => ({
|
|
62
|
+
...theme.typography.button,
|
|
63
|
+
color: '#568793',
|
|
64
|
+
fontSize: 12,
|
|
65
|
+
maxHeight: 32,
|
|
66
|
+
minHeight: 32,
|
|
67
|
+
paddingLeft: 12,
|
|
68
|
+
paddingRight: 12,
|
|
69
|
+
}));
|
|
70
|
+
export const TodoCardFooter = styled('div')(({ theme }) => ({
|
|
71
|
+
display: 'flex',
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
justifyContent: 'space-between',
|
|
74
|
+
flexDirection: 'row',
|
|
75
|
+
}));
|
|
76
|
+
export const TodoCardFooterDueDate = styled('div')(({ theme }) => ({
|
|
77
|
+
display: 'flex',
|
|
78
|
+
alignItems: 'flex-start',
|
|
79
|
+
flexDirection: 'column',
|
|
80
|
+
['& p']: {
|
|
81
|
+
fontWeight: 'normal',
|
|
82
|
+
fontStyle: 'normal',
|
|
83
|
+
fontSize: 11,
|
|
84
|
+
lineHeight: '16px',
|
|
85
|
+
letterSpacing: '0.1px',
|
|
86
|
+
color: theme.palette.typography.title,
|
|
87
|
+
margin: 0,
|
|
88
|
+
},
|
|
89
|
+
['& span']: {
|
|
90
|
+
fontWeight: 'normal',
|
|
91
|
+
fontStyle: 'normal',
|
|
92
|
+
fontSize: 14,
|
|
93
|
+
lineHeight: '24px',
|
|
94
|
+
letterSpacing: '0.15px',
|
|
95
|
+
color: theme.palette.statistics.label,
|
|
96
|
+
},
|
|
97
|
+
}));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Divider } from '@mui/material';
|
|
3
|
+
import { useTransition, animated } from '@react-spring/web';
|
|
4
|
+
import { StyledModal, StyledContent } from './styles/wizard.styles';
|
|
5
|
+
const Animations = {
|
|
6
|
+
rightToLeft: {
|
|
7
|
+
from: {
|
|
8
|
+
opacity: 0,
|
|
9
|
+
position: 'absolute',
|
|
10
|
+
transform: 'translate3d(20%,0,0)',
|
|
11
|
+
width: '100%',
|
|
12
|
+
},
|
|
13
|
+
enter: {
|
|
14
|
+
opacity: 1,
|
|
15
|
+
transform: 'translate3d(0%,0,0)',
|
|
16
|
+
},
|
|
17
|
+
leave: {
|
|
18
|
+
opacity: 0,
|
|
19
|
+
transform: 'translate3d(-10%,0,0)',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
leftToRight: {
|
|
23
|
+
from: { opacity: 0, position: 'absolute', width: '100%' },
|
|
24
|
+
enter: {
|
|
25
|
+
opacity: 1,
|
|
26
|
+
transform: 'translate3d(0%,0,0)',
|
|
27
|
+
},
|
|
28
|
+
leave: {
|
|
29
|
+
opacity: 0,
|
|
30
|
+
transform: 'translate3d(20%,0,0)',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export function Wizard({ open, content = [], currentPage = 0, reverse = false, onCancel, title, actions, icon, componentStyles, divider = true, ...rest }) {
|
|
35
|
+
const transitions = useTransition(content[currentPage], {
|
|
36
|
+
...Animations[reverse ? 'leftToRight' : 'rightToLeft'],
|
|
37
|
+
keys: null,
|
|
38
|
+
});
|
|
39
|
+
return (<StyledModal {...rest} title={title} actions={actions} icon={icon} isOpen={Boolean(open)} isIconTitleInline onClose={(e) => onCancel(e, '')}>
|
|
40
|
+
{divider && <Divider sx={{ mb: '32px', mt: '16px' }}/>}
|
|
41
|
+
<StyledContent style={{ ...componentStyles }}>
|
|
42
|
+
{transitions((style, item) => (<animated.div style={style}>{item}</animated.div>))}
|
|
43
|
+
</StyledContent>
|
|
44
|
+
{divider && <Divider sx={{ mb: '8px', mt: '32px' }}/>}
|
|
45
|
+
</StyledModal>);
|
|
46
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Wizard } from './FxWizard';
|
|
2
|
+
import React, { createContext, useState } from 'react';
|
|
3
|
+
export const WizardContext = createContext({});
|
|
4
|
+
export const WizardContextProvider = ({ children }) => {
|
|
5
|
+
const [currentPage, setCurrentPage] = useState(0);
|
|
6
|
+
const [open, setOpen] = useState(false);
|
|
7
|
+
const [content, setContent] = useState([]);
|
|
8
|
+
const [reverse, setReverse] = useState(false);
|
|
9
|
+
const [options, setOptions] = useState({});
|
|
10
|
+
const [modalProps, _setModalProps] = useState({
|
|
11
|
+
shouldCloseOnBackdropClick: true,
|
|
12
|
+
shouldCloseOnEscapeKeyDown: true,
|
|
13
|
+
});
|
|
14
|
+
const [componentStyles, setComponentStyles] = useState({
|
|
15
|
+
width: '100%',
|
|
16
|
+
height: 500,
|
|
17
|
+
contain: 'content',
|
|
18
|
+
overflow: 'scroll',
|
|
19
|
+
});
|
|
20
|
+
const onCancel = (event, reason) => {
|
|
21
|
+
switch (reason) {
|
|
22
|
+
case 'escapeKeyDown': {
|
|
23
|
+
if (modalProps.shouldCloseOnEscapeKeyDown) {
|
|
24
|
+
return setOpen(false);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
case 'backdropClick': {
|
|
31
|
+
if (modalProps.shouldCloseOnBackdropClick) {
|
|
32
|
+
return setOpen(false);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
default: {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const onOpen = () => {
|
|
43
|
+
setOpen(true);
|
|
44
|
+
};
|
|
45
|
+
const nextPage = () => {
|
|
46
|
+
console.log('nextPage');
|
|
47
|
+
};
|
|
48
|
+
const prevPage = () => {
|
|
49
|
+
console.log('prevPage');
|
|
50
|
+
};
|
|
51
|
+
const setModalProps = (newState) => {
|
|
52
|
+
_setModalProps((prevState) => ({
|
|
53
|
+
...prevState,
|
|
54
|
+
...newState,
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
const setPage = (page, option) => {
|
|
58
|
+
if (option) {
|
|
59
|
+
setOptions({ ...options, ...option });
|
|
60
|
+
}
|
|
61
|
+
setCurrentPage((prevCurrentPage) => {
|
|
62
|
+
setReverse(page < prevCurrentPage);
|
|
63
|
+
return page;
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const _state = {
|
|
67
|
+
currentPage,
|
|
68
|
+
nextPage,
|
|
69
|
+
prevPage,
|
|
70
|
+
onOpen,
|
|
71
|
+
open,
|
|
72
|
+
setOpen,
|
|
73
|
+
setContent,
|
|
74
|
+
setPage,
|
|
75
|
+
options,
|
|
76
|
+
setModalProps,
|
|
77
|
+
setComponentStyles,
|
|
78
|
+
setOptions,
|
|
79
|
+
};
|
|
80
|
+
return (<WizardContext.Provider value={_state}>
|
|
81
|
+
{children}
|
|
82
|
+
<Wizard {...modalProps} componentStyles={componentStyles} currentPage={currentPage} reverse={reverse} open={open} onCancel={onCancel} content={content}/>
|
|
83
|
+
</WizardContext.Provider>);
|
|
84
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import { FxModal } from '../../FxModal';
|
|
4
|
+
export const StyledContent = styled(Box) ``;
|
|
5
|
+
export const StyledModal = styled(FxModal)(({ theme }) => ({
|
|
6
|
+
'& #customized-dialog-title': {
|
|
7
|
+
...theme.typography.h5,
|
|
8
|
+
color: theme.palette.typography.title,
|
|
9
|
+
padding: 0,
|
|
10
|
+
},
|
|
11
|
+
'& .MuiDialog-paper': {
|
|
12
|
+
maxWidth: '74% !important',
|
|
13
|
+
position: 'relative',
|
|
14
|
+
},
|
|
15
|
+
'& .MuiDialogContent-root': {
|
|
16
|
+
position: 'relative',
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StatusBar } from "./FxStatusBar";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const StatusBarCard: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
2
|
+
export declare const StatusBarTitle: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
3
|
+
export declare const StatusChipStyled: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextFieldPropsType } from './text_field_types';
|
|
3
|
+
export declare const FxTextField: ({ autoFocus, droppedItem, defaultValue, onChange, structure, endAdornment, startAdornment, required, helperText, error, errorText, disabled }: TextFieldPropsType) => React.JSX.Element;
|
|
4
|
+
export default FxTextField;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const TodoCard: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
2
|
+
export declare const TodoCardHeader: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
3
|
+
export declare const TodoCardPriority: StyledComponent<ComponentProps & AdditionalProps, SpecificComponentProps, JSXProps>;
|
|
4
|
+
export declare const TodoCardTag: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
5
|
+
export declare const TodoCardContent: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
6
|
+
export declare const TodoCardContentButton: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
7
|
+
export declare const TodoCardFooter: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
|
8
|
+
export declare const TodoCardFooterDueDate: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
|
package/package.json
CHANGED
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@apollo/client": "^3.8.4",
|
|
8
|
-
"@fixefy/fixefy-ui-utils": "^0.0.
|
|
8
|
+
"@fixefy/fixefy-ui-utils": "^0.0.6",
|
|
9
9
|
"@mui/icons-material": "^5.14.11",
|
|
10
10
|
"@mui/material": "^5.14.11",
|
|
11
11
|
"@mui/styled-engine": "^5.14.11",
|
|
12
12
|
"@mui/styles": "^5.14.11",
|
|
13
|
+
"@react-spring/web": "^9.7.3",
|
|
13
14
|
"graphql-tag": "^2.12.6",
|
|
14
15
|
"next": "^13.5.3",
|
|
15
16
|
"react": "^18.2.0",
|
|
@@ -61,5 +62,5 @@
|
|
|
61
62
|
}
|
|
62
63
|
},
|
|
63
64
|
"types": "./dist-types/index.d.ts",
|
|
64
|
-
"version": "0.0.
|
|
65
|
+
"version": "0.0.7"
|
|
65
66
|
}
|