@ndlib/component-library 0.0.105 → 0.0.106
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.
|
@@ -10,3 +10,6 @@ export default meta;
|
|
|
10
10
|
export const Default = {
|
|
11
11
|
render: () => (_jsx(AlertsProvider, Object.assign({ startTime: new Date('2022-01-01').toISOString(), endTime: new Date('2022-01-01').toISOString(), endpoint: "http://localhost:1337/graphql" }, { children: _jsx(Alerts, {}) }))),
|
|
12
12
|
};
|
|
13
|
+
export const CustomizeAlertStyles = {
|
|
14
|
+
render: () => (_jsx(AlertsProvider, Object.assign({ startTime: new Date('2022-01-01').toISOString(), endTime: new Date('2022-01-01').toISOString(), endpoint: "http://localhost:1337/graphql" }, { children: _jsx(Alerts, { alertStyles: { borderRadius: '0px' } }) }))),
|
|
15
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ALERT_TYPE } from '../../providers/alerts';
|
|
3
|
-
import { StyledElementProps } from '../../../theme';
|
|
3
|
+
import { StyledElementProps, StylesProp } from '../../../theme';
|
|
4
4
|
type AlertsProps = StyledElementProps<HTMLDivElement, {
|
|
5
5
|
pageAlerts?: string[];
|
|
6
|
+
alertStyles?: StylesProp;
|
|
6
7
|
}>;
|
|
7
8
|
export declare const Alerts: React.FC<AlertsProps>;
|
|
8
9
|
type AlertProps = StyledElementProps<HTMLDivElement, {
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import _WarningIcon from '@mui/icons-material/Warning';
|
|
14
14
|
import _InfoIcon from '@mui/icons-material/Info';
|
|
15
15
|
import _SuccessIcon from '@mui/icons-material/CheckCircle';
|
|
@@ -22,17 +22,16 @@ import { useAlerts, ALERT_TYPE } from '../../providers/alerts';
|
|
|
22
22
|
import { useTheme } from '../../../theme';
|
|
23
23
|
import { BUTTON_TYPE, Button } from '../Button';
|
|
24
24
|
import { importedDefaultComponentShim } from '../../../utils/misc';
|
|
25
|
+
import { Box } from '../layout/Box';
|
|
25
26
|
const WarningIcon = importedDefaultComponentShim(_WarningIcon);
|
|
26
27
|
const InfoIcon = importedDefaultComponentShim(_InfoIcon);
|
|
27
28
|
const SuccessIcon = importedDefaultComponentShim(_SuccessIcon);
|
|
28
29
|
export const Alerts = (_a) => {
|
|
29
|
-
var { pageAlerts } = _a, rest = __rest(_a, ["pageAlerts"]);
|
|
30
|
+
var { pageAlerts, alertStyles } = _a, rest = __rest(_a, ["pageAlerts", "alertStyles"]);
|
|
30
31
|
const { alerts, dismiss } = useAlerts(pageAlerts);
|
|
31
|
-
return (_jsx(
|
|
32
|
+
return (_jsx(Box, Object.assign({}, rest, { children: alerts.map((alert, i) => {
|
|
32
33
|
const { type, description } = alert;
|
|
33
|
-
return (_jsx(Alert, { type: type, description: description,
|
|
34
|
-
marginTop: i ? '4px' : 0,
|
|
35
|
-
}, dismiss: () => {
|
|
34
|
+
return (_jsx(Alert, { type: type, description: description, sx: Object.assign({ mt: i ? '4px' : 0 }, alertStyles), dismiss: () => {
|
|
36
35
|
dismiss(alert.uuid);
|
|
37
36
|
} }, i));
|
|
38
37
|
}) })));
|
|
@@ -44,7 +43,6 @@ export const Alert = (_a) => {
|
|
|
44
43
|
backgroundColor: COLOR.ALERT_INFORMATIONAL_BG,
|
|
45
44
|
boxShadow: theme.boxShadow.NORMAL,
|
|
46
45
|
border: '2px solid',
|
|
47
|
-
borderRadius: '4px',
|
|
48
46
|
borderColor: COLOR.ALERT_INFORMATIONAL_BORDER,
|
|
49
47
|
m: 0,
|
|
50
48
|
p: '1rem',
|
|
@@ -73,9 +71,5 @@ export const Alert = (_a) => {
|
|
|
73
71
|
pl: '.5rem',
|
|
74
72
|
pr: '.5rem',
|
|
75
73
|
width: '100%',
|
|
76
|
-
'@media screen and (min-width: 1212px)': {
|
|
77
|
-
maxWidth: '1200px',
|
|
78
|
-
padding: '0',
|
|
79
|
-
},
|
|
80
74
|
} }, { children: [icon && _jsx(Icon, { icon: icon, sx: { mr: 4 }, size: FONT_SIZE.LG }), _jsx(Row, Object.assign({ sx: { flexGrow: 1, justifyContent: 'center' } }, { children: _jsx(Markdown, { content: description }) })), _jsx(Button, Object.assign({ type: BUTTON_TYPE.TEXT, onClick: dismiss, sx: { ml: 4 } }, { children: "Dismiss" }))] })) })));
|
|
81
75
|
};
|