@popmenu/admin-ui 0.126.4 → 0.127.1
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/build/cjs/components/Alert/index.d.ts +2 -2
- package/build/cjs/components/AlertDialog/AlertDialog.d.ts +1 -1
- package/build/cjs/components/AlertDialog/index.d.ts +2 -2
- package/build/cjs/components/AlertDialogHeader/index.d.ts +1 -1
- package/build/cjs/components/AlertTitle/index.d.ts +1 -1
- package/build/cjs/components/Button/ButtonProps.d.ts +1 -1
- package/build/cjs/components/Button/ButtonStyles.d.ts +1 -1
- package/build/cjs/components/Button/index.d.ts +2 -2
- package/build/cjs/components/Button/util/deriveButtonProps.d.ts +1 -1
- package/build/cjs/components/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/build/cjs/components/ButtonGroup/index.d.ts +2 -2
- package/build/cjs/components/Dialog/index.d.ts +2 -1
- package/build/cjs/components/DialogActions/index.d.ts +1 -1
- package/build/cjs/components/DialogContent/index.d.ts +2 -1
- package/build/cjs/components/DialogTitle/index.d.ts +2 -1
- package/build/cjs/components/FeatureIntro/FeatureIntroProps.d.ts +0 -1
- package/build/cjs/components/FeatureIntro/index.d.ts +2 -2
- package/build/cjs/components/FullScreenStepper/FullScreenStepperContext.d.ts +0 -1
- package/build/cjs/components/FullScreenStepper/FullScreenStepperProps.d.ts +10 -11
- package/build/cjs/components/FullScreenStepper/index.d.ts +1 -1
- package/build/cjs/components/FullScreenStepperActions/index.d.ts +2 -2
- package/build/cjs/components/FullScreenStepperActions/util/StepperActionsCancelButton.d.ts +1 -1
- package/build/cjs/components/FullScreenStepperActions/util/StepperActionsNextButton.d.ts +1 -1
- package/build/cjs/components/FullScreenStepperActions/util/StepperActionsPreviousButton.d.ts +1 -1
- package/build/cjs/components/FullScreenStepperActions/util/augmentButtonProps.d.ts +1 -1
- package/build/cjs/components/FullScreenStepperContent/index.d.ts +1 -1
- package/build/cjs/components/FullScreenStepperHeader/index.d.ts +1 -1
- package/build/cjs/components/FullScreenStepperProgress/index.d.ts +1 -1
- package/build/cjs/components/List/List.d.ts +0 -1
- package/build/cjs/components/List/index.d.ts +1 -1
- package/build/cjs/components/PageSectionTitle/PageSectionTitle.d.ts +0 -1
- package/build/cjs/components/SelectableCard/index.d.ts +2 -2
- package/build/cjs/components/SettingsIndexCard/SettingsIndexCardProps.d.ts +1 -1
- package/build/cjs/components/SettingsIndexCard/SettingsIndexCardStyles.d.ts +1 -1
- package/build/cjs/components/SettingsIndexCard/index.d.ts +1 -1
- package/build/cjs/components/SettingsIndexCardGroup/SettingsIndexCardGroup.d.ts +0 -1
- package/build/cjs/components/StandardListItem/StandardListItem.d.ts +0 -1
- package/build/cjs/components/StandardListItem/index.d.ts +1 -1
- package/build/cjs/components/Toast/index.d.ts +2 -2
- package/build/cjs/components/index.d.ts +27 -26
- package/build/cjs/hooks/useDialog.d.ts +0 -1
- package/build/cjs/hooks/useFullScreenStepperContext.d.ts +1 -1
- package/build/cjs/index.js +431 -459
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/theme/adminDarkTheme.d.ts +1 -1
- package/build/esm/components/Alert/Alert.js +14 -15
- package/build/esm/components/Alert/Alert.js.map +1 -1
- package/build/esm/components/Alert/AlertStyles.js +5 -8
- package/build/esm/components/Alert/AlertStyles.js.map +1 -1
- package/build/esm/components/Alert/index.d.ts +2 -2
- package/build/esm/components/AlertDialog/AlertDialog.d.ts +1 -1
- package/build/esm/components/AlertDialog/AlertDialog.js +6 -7
- package/build/esm/components/AlertDialog/AlertDialog.js.map +1 -1
- package/build/esm/components/AlertDialog/AlertDialogStyles.js +3 -3
- package/build/esm/components/AlertDialog/AlertDialogStyles.js.map +1 -1
- package/build/esm/components/AlertDialog/index.d.ts +2 -2
- package/build/esm/components/AlertDialogHeader/AlertDialogHeader.js +3 -4
- package/build/esm/components/AlertDialogHeader/AlertDialogHeader.js.map +1 -1
- package/build/esm/components/AlertDialogHeader/index.d.ts +1 -1
- package/build/esm/components/AlertTitle/AlertTitle.js +3 -4
- package/build/esm/components/AlertTitle/AlertTitle.js.map +1 -1
- package/build/esm/components/AlertTitle/index.d.ts +1 -1
- package/build/esm/components/Button/Button.js +12 -7
- package/build/esm/components/Button/Button.js.map +1 -1
- package/build/esm/components/Button/ButtonProps.d.ts +1 -1
- package/build/esm/components/Button/ButtonStyles.d.ts +1 -1
- package/build/esm/components/Button/ButtonStyles.js +52 -53
- package/build/esm/components/Button/ButtonStyles.js.map +1 -1
- package/build/esm/components/Button/index.d.ts +2 -2
- package/build/esm/components/Button/util/deriveButtonProps.d.ts +1 -1
- package/build/esm/components/Button/util/deriveButtonProps.js +3 -3
- package/build/esm/components/Button/util/deriveButtonProps.js.map +1 -1
- package/build/esm/components/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/build/esm/components/ButtonGroup/ButtonGroup.js +16 -13
- package/build/esm/components/ButtonGroup/ButtonGroup.js.map +1 -1
- package/build/esm/components/ButtonGroup/ButtonGroupStyles.js +5 -5
- package/build/esm/components/ButtonGroup/ButtonGroupStyles.js.map +1 -1
- package/build/esm/components/ButtonGroup/index.d.ts +2 -2
- package/build/esm/components/Dialog/index.d.ts +2 -1
- package/build/esm/components/DialogActions/DialogActions.js +8 -12
- package/build/esm/components/DialogActions/DialogActions.js.map +1 -1
- package/build/esm/components/DialogActions/index.d.ts +1 -1
- package/build/esm/components/DialogContent/index.d.ts +2 -1
- package/build/esm/components/DialogTitle/index.d.ts +2 -1
- package/build/esm/components/FeatureIntro/FeatureIntro.js +9 -10
- package/build/esm/components/FeatureIntro/FeatureIntro.js.map +1 -1
- package/build/esm/components/FeatureIntro/FeatureIntroProps.d.ts +0 -1
- package/build/esm/components/FeatureIntro/FeatureIntroStyles.js +12 -15
- package/build/esm/components/FeatureIntro/FeatureIntroStyles.js.map +1 -1
- package/build/esm/components/FeatureIntro/index.d.ts +2 -2
- package/build/esm/components/FullScreenStepper/FullScreenStepper.js +43 -74
- package/build/esm/components/FullScreenStepper/FullScreenStepper.js.map +1 -1
- package/build/esm/components/FullScreenStepper/FullScreenStepperContext.d.ts +0 -1
- package/build/esm/components/FullScreenStepper/FullScreenStepperContext.js +1 -1
- package/build/esm/components/FullScreenStepper/FullScreenStepperContext.js.map +1 -1
- package/build/esm/components/FullScreenStepper/FullScreenStepperProps.d.ts +10 -11
- package/build/esm/components/FullScreenStepper/index.d.ts +1 -1
- package/build/esm/components/FullScreenStepperActions/FullScreenStepperActions.js +6 -7
- package/build/esm/components/FullScreenStepperActions/FullScreenStepperActions.js.map +1 -1
- package/build/esm/components/FullScreenStepperActions/FullScreenStepperActionsStyles.js +4 -4
- package/build/esm/components/FullScreenStepperActions/FullScreenStepperActionsStyles.js.map +1 -1
- package/build/esm/components/FullScreenStepperActions/index.d.ts +2 -2
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsCancelButton.d.ts +1 -1
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsCancelButton.js +4 -5
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsCancelButton.js.map +1 -1
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsNextButton.d.ts +1 -1
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsNextButton.js +8 -9
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsNextButton.js.map +1 -1
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsPreviousButton.d.ts +1 -1
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsPreviousButton.js +4 -5
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsPreviousButton.js.map +1 -1
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsStatusText.js +4 -4
- package/build/esm/components/FullScreenStepperActions/util/StepperActionsStatusText.js.map +1 -1
- package/build/esm/components/FullScreenStepperActions/util/augmentButtonProps.d.ts +1 -1
- package/build/esm/components/FullScreenStepperActions/util/augmentButtonProps.js +11 -24
- package/build/esm/components/FullScreenStepperActions/util/augmentButtonProps.js.map +1 -1
- package/build/esm/components/FullScreenStepperContent/FullScreenStepperContent.js +3 -4
- package/build/esm/components/FullScreenStepperContent/FullScreenStepperContent.js.map +1 -1
- package/build/esm/components/FullScreenStepperContent/index.d.ts +1 -1
- package/build/esm/components/FullScreenStepperHeader/FullScreenStepperHeader.js +3 -3
- package/build/esm/components/FullScreenStepperHeader/FullScreenStepperHeader.js.map +1 -1
- package/build/esm/components/FullScreenStepperHeader/FullScreenStepperHeaderStyles.js +18 -21
- package/build/esm/components/FullScreenStepperHeader/FullScreenStepperHeaderStyles.js.map +1 -1
- package/build/esm/components/FullScreenStepperHeader/index.d.ts +1 -1
- package/build/esm/components/FullScreenStepperProgress/FullScreenStepperProgress.js +2 -2
- package/build/esm/components/FullScreenStepperProgress/FullScreenStepperProgress.js.map +1 -1
- package/build/esm/components/FullScreenStepperProgress/FullScreenStepperProgressStyles.js +9 -9
- package/build/esm/components/FullScreenStepperProgress/FullScreenStepperProgressStyles.js.map +1 -1
- package/build/esm/components/FullScreenStepperProgress/index.d.ts +1 -1
- package/build/esm/components/List/List.d.ts +0 -1
- package/build/esm/components/List/List.js +4 -6
- package/build/esm/components/List/List.js.map +1 -1
- package/build/esm/components/List/index.d.ts +1 -1
- package/build/esm/components/List/styles.js +3 -3
- package/build/esm/components/List/styles.js.map +1 -1
- package/build/esm/components/Page/Page.js +3 -4
- package/build/esm/components/Page/Page.js.map +1 -1
- package/build/esm/components/PageBody/PageBody.js +3 -4
- package/build/esm/components/PageBody/PageBody.js.map +1 -1
- package/build/esm/components/PageSection/PageSection.js +4 -5
- package/build/esm/components/PageSection/PageSection.js.map +1 -1
- package/build/esm/components/PageSection/PageSectionStyles.js +8 -14
- package/build/esm/components/PageSection/PageSectionStyles.js.map +1 -1
- package/build/esm/components/PageSectionHead/PageSectionHead.js +4 -5
- package/build/esm/components/PageSectionHead/PageSectionHead.js.map +1 -1
- package/build/esm/components/PageSectionTitle/PageSectionTitle.d.ts +0 -1
- package/build/esm/components/PageSectionTitle/PageSectionTitle.js +4 -5
- package/build/esm/components/PageSectionTitle/PageSectionTitle.js.map +1 -1
- package/build/esm/components/PageSectionTitle/styles.js +2 -2
- package/build/esm/components/PageSectionTitle/styles.js.map +1 -1
- package/build/esm/components/PageSections/PageSections.js +3 -4
- package/build/esm/components/PageSections/PageSections.js.map +1 -1
- package/build/esm/components/SelectableCard/SelectableCard.js +7 -8
- package/build/esm/components/SelectableCard/SelectableCard.js.map +1 -1
- package/build/esm/components/SelectableCard/SelectableCardStyles.js +8 -20
- package/build/esm/components/SelectableCard/SelectableCardStyles.js.map +1 -1
- package/build/esm/components/SelectableCard/index.d.ts +2 -2
- package/build/esm/components/SettingsIndexCard/SettingsIndexCard.js +6 -7
- package/build/esm/components/SettingsIndexCard/SettingsIndexCard.js.map +1 -1
- package/build/esm/components/SettingsIndexCard/SettingsIndexCardProps.d.ts +1 -1
- package/build/esm/components/SettingsIndexCard/SettingsIndexCardStyles.d.ts +1 -1
- package/build/esm/components/SettingsIndexCard/SettingsIndexCardStyles.js +3 -3
- package/build/esm/components/SettingsIndexCard/SettingsIndexCardStyles.js.map +1 -1
- package/build/esm/components/SettingsIndexCard/index.d.ts +1 -1
- package/build/esm/components/SettingsIndexCardGroup/SettingsIndexCardGroup.d.ts +0 -1
- package/build/esm/components/SettingsIndexCardGroup/SettingsIndexCardGroup.js +3 -4
- package/build/esm/components/SettingsIndexCardGroup/SettingsIndexCardGroup.js.map +1 -1
- package/build/esm/components/StandardListItem/StandardListItem.d.ts +0 -1
- package/build/esm/components/StandardListItem/StandardListItem.js +7 -8
- package/build/esm/components/StandardListItem/StandardListItem.js.map +1 -1
- package/build/esm/components/StandardListItem/index.d.ts +1 -1
- package/build/esm/components/Toast/Toast.js +4 -6
- package/build/esm/components/Toast/Toast.js.map +1 -1
- package/build/esm/components/Toast/ToastStyles.js +2 -2
- package/build/esm/components/Toast/ToastStyles.js.map +1 -1
- package/build/esm/components/Toast/index.d.ts +2 -2
- package/build/esm/components/index.d.ts +27 -26
- package/build/esm/hooks/useDialog.d.ts +0 -1
- package/build/esm/hooks/useDialog.js +7 -7
- package/build/esm/hooks/useDialog.js.map +1 -1
- package/build/esm/hooks/useFullScreenStepperContext.d.ts +1 -1
- package/build/esm/hooks/useFullScreenStepperContext.js +1 -1
- package/build/esm/hooks/useFullScreenStepperContext.js.map +1 -1
- package/build/esm/hooks/useSelectableCard.js +11 -13
- package/build/esm/hooks/useSelectableCard.js.map +1 -1
- package/build/esm/theme/adminDarkTheme.d.ts +1 -1
- package/build/esm/theme/adminDarkTheme.js +19 -5
- package/build/esm/theme/adminDarkTheme.js.map +1 -1
- package/build/esm/theme/adminLightTheme.js +19 -5
- package/build/esm/theme/adminLightTheme.js.map +1 -1
- package/build/esm/theme/breakpoints.js +1 -1
- package/build/esm/theme/breakpoints.js.map +1 -1
- package/build/esm/theme/customThemeProperties.js +20 -14
- package/build/esm/theme/customThemeProperties.js.map +1 -1
- package/build/esm/theme/overrides.js +1 -1
- package/build/esm/theme/overrides.js.map +1 -1
- package/build/esm/theme/palette.js +4 -4
- package/build/esm/theme/palette.js.map +1 -1
- package/build/esm/theme/props.js +1 -1
- package/build/esm/theme/props.js.map +1 -1
- package/build/esm/theme/typography.js +2 -2
- package/build/esm/theme/typography.js.map +1 -1
- package/package.json +3 -4
package/build/cjs/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var tslib = require('tslib');
|
|
4
3
|
var React = require('react');
|
|
5
4
|
var commonUi = require('@popmenu/common-ui');
|
|
6
5
|
var webIcons = require('@popmenu/web-icons');
|
|
@@ -8,60 +7,57 @@ var core = require('@material-ui/core');
|
|
|
8
7
|
var lab = require('@material-ui/lab');
|
|
9
8
|
var classNames = require('classnames');
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
const useAlertStyles = core.makeStyles((theme) => ({
|
|
12
11
|
root: {
|
|
13
12
|
alignItems: 'center',
|
|
14
|
-
width:
|
|
15
|
-
var fullWidth = _a.fullWidth;
|
|
16
|
-
return (fullWidth ? '100%' : 'unset');
|
|
17
|
-
},
|
|
13
|
+
width: ({ fullWidth }) => (fullWidth ? '100%' : 'unset'),
|
|
18
14
|
background: 'white',
|
|
19
|
-
borderColor:
|
|
20
|
-
borderLeft: theme.spacing(1)
|
|
15
|
+
borderColor: (props) => theme.palette[props.severity || 'error'].main,
|
|
16
|
+
borderLeft: `${theme.spacing(1)}px solid`,
|
|
21
17
|
color: theme.palette.text.primary,
|
|
22
18
|
},
|
|
23
19
|
icon: {
|
|
24
20
|
alignSelf: 'start',
|
|
25
21
|
},
|
|
26
|
-
})
|
|
22
|
+
}));
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
const severityIcons$1 = {
|
|
29
25
|
info: webIcons.Info,
|
|
30
26
|
error: webIcons.Error,
|
|
31
27
|
warning: webIcons.Warning,
|
|
32
28
|
success: webIcons.CheckCircle,
|
|
33
29
|
};
|
|
34
|
-
|
|
30
|
+
const getLinkProps = (link) => {
|
|
35
31
|
if (!link)
|
|
36
32
|
return null;
|
|
37
|
-
|
|
33
|
+
const { href, onClick, text } = link;
|
|
38
34
|
if (!text)
|
|
39
35
|
return null;
|
|
40
|
-
|
|
36
|
+
const props = { children: text };
|
|
41
37
|
if (href)
|
|
42
|
-
return
|
|
38
|
+
return { ...props, href };
|
|
43
39
|
if (onClick)
|
|
44
|
-
return
|
|
40
|
+
return { ...props, onClick };
|
|
45
41
|
return null;
|
|
46
42
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
validLink && React.createElement(commonUi.Link,
|
|
43
|
+
const Alert = React.forwardRef((props, ref) => {
|
|
44
|
+
const { children, link, severity = 'error', variant = 'outlined', onClose, ...muiProps } = props;
|
|
45
|
+
const classes = useAlertStyles(props);
|
|
46
|
+
const validLink = link && getLinkProps(link);
|
|
47
|
+
const Action = (React.createElement(React.Fragment, null,
|
|
48
|
+
validLink && React.createElement(commonUi.Link, { ...validLink }),
|
|
53
49
|
onClose && (React.createElement(commonUi.IconButton, { onClick: onClose },
|
|
54
50
|
React.createElement(commonUi.Icon, { icon: webIcons.X })))));
|
|
55
|
-
return (React.createElement(commonUi.Alert,
|
|
51
|
+
return (React.createElement(commonUi.Alert, { ref: ref, classes: classes,
|
|
56
52
|
// @ts-expect-error - todo.
|
|
57
|
-
icon: React.createElement(commonUi.Icon, { icon: severityIcons$1[severity], size: "extra-large" }), action: Action, variant: variant, severity: severity
|
|
53
|
+
icon: React.createElement(commonUi.Icon, { icon: severityIcons$1[severity], size: "extra-large" }), action: Action, variant: variant, severity: severity, ...muiProps }, children));
|
|
58
54
|
});
|
|
59
55
|
Alert.displayName = 'Alert';
|
|
60
56
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
const borderWidth = 1;
|
|
58
|
+
const getColor = (palette, props) => {
|
|
59
|
+
const variant = props.variant;
|
|
60
|
+
let color = 'inherit';
|
|
65
61
|
if (['primary', 'info', 'success', 'warning', 'error'].includes(variant)) {
|
|
66
62
|
// @ts-expect-error - todo.
|
|
67
63
|
color = palette[variant].contrastText;
|
|
@@ -84,22 +80,22 @@ var getColor = function (palette, props) {
|
|
|
84
80
|
}
|
|
85
81
|
return color;
|
|
86
82
|
};
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
const getColorHover = (palette, props) => {
|
|
84
|
+
let color;
|
|
89
85
|
if (props.variant === 'secondary') {
|
|
90
86
|
color = palette.secondary.contrastText;
|
|
91
87
|
}
|
|
92
88
|
return color;
|
|
93
89
|
};
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
const getBackground = (palette, props) => {
|
|
91
|
+
let backgroundColor = 'inherit';
|
|
96
92
|
if (['info', 'success', 'warning', 'error'].includes(props.variant)) {
|
|
97
93
|
// @ts-expect-error - todo.
|
|
98
94
|
backgroundColor = palette[props.variant].main;
|
|
99
95
|
}
|
|
100
96
|
if (props.variant === 'primary') {
|
|
101
97
|
// @ts-expect-error gradient colors are included in the extended palette.
|
|
102
|
-
backgroundColor =
|
|
98
|
+
backgroundColor = `linear-gradient(97.36deg, ${palette.primary.gradientStart} 17.03%, ${palette.primary.gradientEnd} 72.96%)`;
|
|
103
99
|
}
|
|
104
100
|
if (props.variant === 'secondary') {
|
|
105
101
|
backgroundColor = 'white';
|
|
@@ -109,8 +105,8 @@ var getBackground = function (palette, props) {
|
|
|
109
105
|
}
|
|
110
106
|
return backgroundColor;
|
|
111
107
|
};
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
const getBackgroundHover = (palette, props) => {
|
|
109
|
+
let backgroundHoverColor = 'inherit';
|
|
114
110
|
if (['primary', 'info', 'success', 'warning', 'error'].includes(props.variant)) {
|
|
115
111
|
// @ts-expect-error - todo.
|
|
116
112
|
backgroundHoverColor = palette[props.variant].dark;
|
|
@@ -126,59 +122,59 @@ var getBackgroundHover = function (palette, props) {
|
|
|
126
122
|
}
|
|
127
123
|
return backgroundHoverColor;
|
|
128
124
|
};
|
|
129
|
-
|
|
125
|
+
const buttonTypography = {
|
|
130
126
|
fontWeight: 500,
|
|
131
127
|
fontSize: '0.875rem',
|
|
132
128
|
lineHeight: '1.25rem',
|
|
133
129
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
color: getColorHover(palette, props),
|
|
146
|
-
background: getBackgroundHover(palette, props),
|
|
147
|
-
},
|
|
148
|
-
}); },
|
|
149
|
-
disabled: {
|
|
150
|
-
'&$root': {
|
|
151
|
-
background: palette.action.disabled,
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
contained: {
|
|
155
|
-
padding: spacing(1, 2),
|
|
156
|
-
},
|
|
157
|
-
outlined: {
|
|
158
|
-
padding: "calc(" + spacing(1) + "px - " + borderWidth + "px) calc(" + spacing(2) + "px - " + borderWidth + "px)",
|
|
159
|
-
'&$sizeSmall': {
|
|
160
|
-
padding: "calc(" + spacing(0.5) + "px - " + borderWidth + "px) calc(" + spacing(2) + "px - " + borderWidth + "px)",
|
|
161
|
-
},
|
|
162
|
-
'&$sizeLarge': {
|
|
163
|
-
padding: "calc(" + spacing(1.5) + "px - " + borderWidth + "px) calc(" + spacing(2) + "px - " + borderWidth + "px)",
|
|
164
|
-
},
|
|
130
|
+
const useButtonStyles = core.makeStyles(({ palette, spacing }) => ({
|
|
131
|
+
root: (props) => ({
|
|
132
|
+
minWidth: 'unset',
|
|
133
|
+
color: getColor(palette, props),
|
|
134
|
+
background: getBackground(palette, props),
|
|
135
|
+
backgroundColor: props.variant === 'primary' ? palette.primary.dark : getBackground(palette, props),
|
|
136
|
+
borderRadius: spacing(6),
|
|
137
|
+
transition: 'all 200ms ease-in-out',
|
|
138
|
+
'&:hover': {
|
|
139
|
+
color: getColorHover(palette, props),
|
|
140
|
+
background: getBackgroundHover(palette, props),
|
|
165
141
|
},
|
|
166
|
-
|
|
167
|
-
|
|
142
|
+
}),
|
|
143
|
+
disabled: {
|
|
144
|
+
'&$root': {
|
|
145
|
+
background: palette.action.disabled,
|
|
168
146
|
},
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
147
|
+
},
|
|
148
|
+
contained: {
|
|
149
|
+
padding: spacing(1, 2),
|
|
150
|
+
},
|
|
151
|
+
outlined: {
|
|
152
|
+
padding: `calc(${spacing(1)}px - ${borderWidth}px) calc(${spacing(2)}px - ${borderWidth}px)`,
|
|
153
|
+
'&$sizeSmall': {
|
|
154
|
+
padding: `calc(${spacing(0.5)}px - ${borderWidth}px) calc(${spacing(2)}px - ${borderWidth}px)`,
|
|
172
155
|
},
|
|
173
|
-
sizeLarge: {
|
|
174
|
-
padding: spacing(1.5
|
|
156
|
+
'&$sizeLarge': {
|
|
157
|
+
padding: `calc(${spacing(1.5)}px - ${borderWidth}px) calc(${spacing(2)}px - ${borderWidth}px)`,
|
|
175
158
|
},
|
|
176
|
-
}
|
|
177
|
-
|
|
159
|
+
},
|
|
160
|
+
text: {
|
|
161
|
+
padding: spacing(1, 2),
|
|
162
|
+
},
|
|
163
|
+
label: {
|
|
164
|
+
...buttonTypography,
|
|
165
|
+
textTransform: (props) => props.textTransform,
|
|
166
|
+
},
|
|
167
|
+
sizeSmall: {
|
|
168
|
+
padding: spacing(0.5, 2),
|
|
169
|
+
},
|
|
170
|
+
sizeLarge: {
|
|
171
|
+
padding: spacing(1.5, 2),
|
|
172
|
+
},
|
|
173
|
+
}));
|
|
178
174
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
175
|
+
const deriveButtonProps = (buttonProps) => {
|
|
176
|
+
const { variant } = buttonProps;
|
|
177
|
+
const derived = {};
|
|
182
178
|
switch (variant) {
|
|
183
179
|
case 'primary':
|
|
184
180
|
derived.variant = 'contained';
|
|
@@ -217,12 +213,18 @@ var deriveButtonProps = function (buttonProps) {
|
|
|
217
213
|
};
|
|
218
214
|
|
|
219
215
|
// eslint-disable-next-line react/display-name -- false positive
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
216
|
+
const Button = React.forwardRef((props, ref) => {
|
|
217
|
+
const { children, variant: remove, classes: classesOverride, ...commonProps } = props;
|
|
218
|
+
const classes = useButtonStyles(props);
|
|
219
|
+
const derivedProps = deriveButtonProps(props);
|
|
220
|
+
const mergedProps = {
|
|
221
|
+
...derivedProps,
|
|
222
|
+
...commonProps,
|
|
223
|
+
};
|
|
224
|
+
return (React.createElement(commonUi.Button, { ref: ref, classes: {
|
|
225
|
+
...classes,
|
|
226
|
+
...classesOverride,
|
|
227
|
+
}, disableElevation: true, ...mergedProps }, children));
|
|
226
228
|
});
|
|
227
229
|
Button.defaultProps = {
|
|
228
230
|
textTransform: 'uppercase',
|
|
@@ -230,7 +232,7 @@ Button.defaultProps = {
|
|
|
230
232
|
};
|
|
231
233
|
Button.displayName = 'Button';
|
|
232
234
|
|
|
233
|
-
|
|
235
|
+
const useAlertDialogStyles = core.makeStyles((theme) => ({
|
|
234
236
|
cancelButton: {
|
|
235
237
|
color: theme.palette.grey[700],
|
|
236
238
|
},
|
|
@@ -241,7 +243,7 @@ var useAlertDialogStyles = core.makeStyles(function (theme) { return ({
|
|
|
241
243
|
},
|
|
242
244
|
card: {
|
|
243
245
|
borderRadius: theme.spacing(0.75),
|
|
244
|
-
borderTop:
|
|
246
|
+
borderTop: (props) => `${theme.spacing(1.25)}px solid ${theme.palette[props.severity || 'info'].main}`,
|
|
245
247
|
},
|
|
246
248
|
cardActions: {
|
|
247
249
|
background: theme.palette.grey[100],
|
|
@@ -253,18 +255,18 @@ var useAlertDialogStyles = core.makeStyles(function (theme) { return ({
|
|
|
253
255
|
root: {
|
|
254
256
|
borderRadius: theme.spacing(0.75),
|
|
255
257
|
},
|
|
256
|
-
})
|
|
258
|
+
}));
|
|
257
259
|
|
|
258
|
-
|
|
260
|
+
const severityIcons = {
|
|
259
261
|
info: webIcons.Info,
|
|
260
262
|
error: webIcons.Error,
|
|
261
263
|
warning: webIcons.Warning,
|
|
262
264
|
success: webIcons.CheckCircle,
|
|
263
265
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return (React.createElement(commonUi.Dialog,
|
|
266
|
+
const AlertDialog = React.forwardRef((props, ref) => {
|
|
267
|
+
const { cancelButtonText = 'cancel', hideCancelButton = false, children, labelId, descriptionId, severity = 'info', proceedButtonText = 'proceed', disabled = false, onClose, onCancel, onProceed, ...DialogProps } = props;
|
|
268
|
+
const classes = useAlertDialogStyles(props);
|
|
269
|
+
return (React.createElement(commonUi.Dialog, { ref: ref, classes: { paper: classes.root }, maxWidth: "sm", fullWidth: true, ...DialogProps },
|
|
268
270
|
React.createElement(commonUi.Card, { classes: { root: classes.card }, role: "alertdialog", "aria-modal": "true", "aria-labelledby": labelId, "aria-describedby": descriptionId },
|
|
269
271
|
React.createElement(commonUi.IconButton, { className: classes.cancelIcon, onClick: onClose, disabled: disabled },
|
|
270
272
|
React.createElement(commonUi.Icon, { icon: webIcons.X })),
|
|
@@ -278,16 +280,16 @@ var AlertDialog = React.forwardRef(function (props, ref) {
|
|
|
278
280
|
});
|
|
279
281
|
AlertDialog.displayName = 'AlertDialog';
|
|
280
282
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return (React.createElement(commonUi.Box,
|
|
283
|
+
const AlertDialogHeader = (props) => {
|
|
284
|
+
const { children, ...muiProps } = props;
|
|
285
|
+
return (React.createElement(commonUi.Box, { display: "flex", height: 40, alignItems: "center", ...muiProps },
|
|
284
286
|
React.createElement(commonUi.Typography, { variant: "h6" }, children)));
|
|
285
287
|
};
|
|
286
288
|
AlertDialogHeader.displayName = 'AlertDialogHeader';
|
|
287
289
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return (React.createElement(lab.AlertTitle,
|
|
290
|
+
const AlertTitle = (props) => {
|
|
291
|
+
const { children, ...muiProps } = props;
|
|
292
|
+
return (React.createElement(lab.AlertTitle, { ...muiProps },
|
|
291
293
|
React.createElement(commonUi.Typography, { variant: "h6" },
|
|
292
294
|
" ",
|
|
293
295
|
children,
|
|
@@ -295,21 +297,21 @@ var AlertTitle = function (props) {
|
|
|
295
297
|
};
|
|
296
298
|
AlertTitle.displayName = 'AlertTitle';
|
|
297
299
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
+
const getBorderColor = (palette, variant) => {
|
|
301
|
+
let borderColor = 'inherit';
|
|
300
302
|
if (['primary', 'secondary', 'info', 'success', 'warning', 'error'].includes(variant)) {
|
|
301
303
|
// @ts-expect-error - todo.
|
|
302
304
|
borderColor = palette[variant].light;
|
|
303
305
|
}
|
|
304
306
|
return borderColor;
|
|
305
307
|
};
|
|
306
|
-
|
|
308
|
+
const useButtonGroupStyles = core.makeStyles((theme) => ({
|
|
307
309
|
root: {
|
|
308
310
|
boxShadow: 'none',
|
|
309
311
|
},
|
|
310
312
|
groupedContained: {
|
|
311
313
|
'&&': {
|
|
312
|
-
borderColor:
|
|
314
|
+
borderColor: (props) => getBorderColor(theme.palette, props.variant),
|
|
313
315
|
},
|
|
314
316
|
},
|
|
315
317
|
groupedText: {
|
|
@@ -317,84 +319,82 @@ var useButtonGroupStyles = core.makeStyles(function (theme) { return ({
|
|
|
317
319
|
borderColor: theme.palette.info.main,
|
|
318
320
|
},
|
|
319
321
|
},
|
|
320
|
-
})
|
|
322
|
+
}));
|
|
321
323
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
324
|
+
const ButtonGroup = React.forwardRef((props, ref) => {
|
|
325
|
+
const { children, variant = 'primary', ...muiProps } = props;
|
|
326
|
+
const classes = useButtonGroupStyles(props);
|
|
327
|
+
const derivedProps = deriveButtonProps({ variant });
|
|
328
|
+
const { spacing } = core.useTheme();
|
|
329
|
+
const childrenWithProps = React.Children.map(children, (child, i) => {
|
|
330
|
+
const isFirst = i === 0 && props.orientation === 'vertical';
|
|
331
|
+
const isLast = i === React.Children.toArray(children).length - 1 && props.orientation === 'vertical';
|
|
332
|
+
const firstStyles = { style: { borderTopLeftRadius: spacing(2), borderTopRightRadius: spacing(2) } };
|
|
333
|
+
const lastStyles = { style: { borderBottomLeftRadius: spacing(2), borderBottomRightRadius: spacing(2) } };
|
|
332
334
|
if (!React.isValidElement(child)) {
|
|
333
335
|
return null;
|
|
334
336
|
}
|
|
335
|
-
return React.cloneElement(child,
|
|
337
|
+
return React.cloneElement(child, {
|
|
338
|
+
variant,
|
|
339
|
+
...(isFirst && firstStyles),
|
|
340
|
+
...(isLast && lastStyles),
|
|
341
|
+
});
|
|
336
342
|
});
|
|
337
|
-
return (React.createElement(commonUi.ButtonGroup,
|
|
343
|
+
return (React.createElement(commonUi.ButtonGroup, { ref: ref, classes: classes, ...derivedProps, ...muiProps }, childrenWithProps));
|
|
338
344
|
});
|
|
339
345
|
ButtonGroup.displayName = 'ButtonGroup';
|
|
340
346
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
});
|
|
349
|
-
var DialogActions = function (props) {
|
|
350
|
-
var classes = useStyles$4(props);
|
|
351
|
-
return React.createElement(commonUi.DialogActions, tslib.__assign({ classes: classes }, props));
|
|
347
|
+
const useStyles$4 = core.makeStyles(({ palette }) => ({
|
|
348
|
+
root: {
|
|
349
|
+
background: palette.grey['100'],
|
|
350
|
+
},
|
|
351
|
+
}));
|
|
352
|
+
const DialogActions = (props) => {
|
|
353
|
+
const classes = useStyles$4(props);
|
|
354
|
+
return React.createElement(commonUi.DialogActions, { classes: classes, ...props });
|
|
352
355
|
};
|
|
353
356
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
},
|
|
367
|
-
});
|
|
368
|
-
});
|
|
357
|
+
const useFeatureIntroStyles = core.makeStyles(({ spacing }) => ({
|
|
358
|
+
root: {
|
|
359
|
+
gap: spacing(3),
|
|
360
|
+
},
|
|
361
|
+
actions: {
|
|
362
|
+
gap: spacing(3),
|
|
363
|
+
},
|
|
364
|
+
image: {
|
|
365
|
+
width: '100%',
|
|
366
|
+
objectFit: 'contain',
|
|
367
|
+
},
|
|
368
|
+
}));
|
|
369
369
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
370
|
+
const FeatureIntro = (props) => {
|
|
371
|
+
const { title, body, primaryAction, secondaryAction, image } = props;
|
|
372
|
+
const { label: primaryActionLabel, ...primaryActionProps } = primaryAction;
|
|
373
|
+
const { label: secondaryActionLabel, ...secondaryActionProps } = secondaryAction || {};
|
|
374
|
+
const classes = useFeatureIntroStyles(props);
|
|
375
|
+
const validImage = image?.src && image?.alt;
|
|
376
376
|
return (React.createElement(commonUi.Box, { className: classes.root, padding: { xs: 4, sm: 8 }, flexDirection: { xs: 'column-reverse', sm: 'row' }, display: "flex", justifyContent: "center", alignItems: "center" },
|
|
377
377
|
React.createElement(commonUi.Box, { display: "flex", flexDirection: "column", width: { xs: '100%', sm: '50%' }, alignItems: { xs: 'center', sm: 'unset' } },
|
|
378
378
|
React.createElement(commonUi.Box, { textAlign: { xs: 'center', sm: 'start' }, marginBottom: 2 },
|
|
379
379
|
React.createElement(commonUi.Typography, { align: "inherit", variant: "h4" }, title)),
|
|
380
380
|
React.createElement(commonUi.Box, { textAlign: { xs: 'center', sm: 'start' }, marginBottom: 6 }, body),
|
|
381
381
|
React.createElement(commonUi.Box, { className: classes.actions, display: "flex", flexDirection: "column", width: "fit-content" },
|
|
382
|
-
primaryAction && React.createElement(Button,
|
|
383
|
-
secondaryAction && (React.createElement(Button,
|
|
382
|
+
primaryAction && React.createElement(Button, { ...primaryActionProps }, primaryActionLabel),
|
|
383
|
+
secondaryAction && (React.createElement(Button, { variant: "tertiary", ...secondaryActionProps }, secondaryActionLabel)))),
|
|
384
384
|
React.createElement(commonUi.Box, { display: "flex", width: { xs: '100%', sm: '50%' }, alignItems: "center", justifyContent: "center" },
|
|
385
385
|
React.createElement(commonUi.Box, { display: "flex", maxWidth: 450, maxHeight: 450 }, validImage && React.createElement("img", { src: image.src, alt: image.alt, className: classes.image })))));
|
|
386
386
|
};
|
|
387
387
|
FeatureIntro.displayName = 'FeatureIntro';
|
|
388
388
|
|
|
389
|
-
|
|
389
|
+
const useFullScreenStepperActionsStyles = core.makeStyles((theme) => ({
|
|
390
390
|
root: {
|
|
391
391
|
position: 'sticky',
|
|
392
392
|
background: 'white',
|
|
393
393
|
bottom: 0,
|
|
394
394
|
display: 'flex',
|
|
395
395
|
justifyContent: 'space-between',
|
|
396
|
-
padding: theme.spacing(1.5)
|
|
397
|
-
borderTop: theme.spacing(0.5)
|
|
396
|
+
padding: `${theme.spacing(1.5)}px ${theme.spacing(3)}px`,
|
|
397
|
+
borderTop: `${theme.spacing(0.5)}px solid ${theme.palette.grey[100]}`,
|
|
398
398
|
zIndex: 3,
|
|
399
399
|
},
|
|
400
400
|
inlineEndActions: {
|
|
@@ -409,83 +409,72 @@ var useFullScreenStepperActionsStyles = core.makeStyles(function (theme) { retur
|
|
|
409
409
|
marginInlineEnd: theme.spacing(2),
|
|
410
410
|
},
|
|
411
411
|
},
|
|
412
|
-
})
|
|
412
|
+
}));
|
|
413
413
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
setStepCursor(stepCursor + incrementor);
|
|
426
|
-
return [3 /*break*/, 3];
|
|
427
|
-
case 2:
|
|
428
|
-
if (typeof internalProps.onClick === 'function') {
|
|
429
|
-
internalProps.onClick();
|
|
430
|
-
}
|
|
431
|
-
_a.label = 3;
|
|
432
|
-
case 3: return [2 /*return*/];
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
}); };
|
|
414
|
+
const augmentButtonProps = (internalProps, externalProps = {}, setStepCursor, stepCursor, incrementor) => {
|
|
415
|
+
const mergedProps = { ...internalProps, ...externalProps };
|
|
416
|
+
mergedProps.onClick = async () => {
|
|
417
|
+
if (typeof externalProps.onClick === 'function') {
|
|
418
|
+
await externalProps.onClick({});
|
|
419
|
+
setStepCursor(stepCursor + incrementor);
|
|
420
|
+
}
|
|
421
|
+
else if (typeof internalProps.onClick === 'function') {
|
|
422
|
+
internalProps.onClick();
|
|
423
|
+
}
|
|
424
|
+
};
|
|
436
425
|
return mergedProps;
|
|
437
426
|
};
|
|
438
427
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
return
|
|
428
|
+
const StepperActionsCancelButton = (props) => {
|
|
429
|
+
const { setStepCursor, stepCursor, cancelButtonText, cancelButtonProps, handleCancelClick, displayCancelButton } = props;
|
|
430
|
+
const augmentedCancelButtonProps = augmentButtonProps({ onClick: handleCancelClick }, cancelButtonProps, setStepCursor, stepCursor, 0);
|
|
431
|
+
return displayCancelButton ? (React.createElement(Button, { variant: "ghost", ...augmentedCancelButtonProps }, cancelButtonText || 'cancel')) : null;
|
|
443
432
|
};
|
|
444
433
|
|
|
445
|
-
|
|
434
|
+
const StepperActionsNextButton = (props) => {
|
|
435
|
+
const { handleNextClick, nextButtonProps, setStepCursor, stepCursor, stepCount, finishButtonText, nextButtonText } = props;
|
|
436
|
+
const augmentedNextButtonProps = augmentButtonProps({ onClick: handleNextClick }, nextButtonProps, setStepCursor, stepCursor, 1);
|
|
437
|
+
const finalStep = stepCursor / stepCount === 1;
|
|
438
|
+
const finishText = finishButtonText || 'finish';
|
|
439
|
+
const nextText = nextButtonText || 'next';
|
|
440
|
+
const buttonText = finalStep ? finishText : nextText;
|
|
441
|
+
return React.createElement(Button, { ...augmentedNextButtonProps }, buttonText);
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
const StepperActionsPreviousButton = (props) => {
|
|
445
|
+
const { previousButtonText, stepCursor, handlePreviousClick, previousButtonProps, setStepCursor, displayPreviousButton, } = props;
|
|
446
|
+
const augmentedPreviousButtonProps = augmentButtonProps({ onClick: handlePreviousClick }, previousButtonProps, setStepCursor, stepCursor, -1);
|
|
447
|
+
return displayPreviousButton ? (React.createElement(Button, { variant: "tertiary", disabled: stepCursor === 1, ...augmentedPreviousButtonProps }, previousButtonText || 'previous')) : null;
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
const useStyles$3 = core.makeStyles({
|
|
446
451
|
root: {
|
|
447
452
|
fontStyle: 'italic',
|
|
448
453
|
},
|
|
449
454
|
});
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
455
|
+
const StepperActionsStatusText = (props) => {
|
|
456
|
+
const { statusText } = props;
|
|
457
|
+
const classes = useStyles$3(props);
|
|
453
458
|
return statusText ? (React.createElement(commonUi.Typography, { classes: { root: classes.root }, variant: "body2" }, statusText)) : null;
|
|
454
459
|
};
|
|
455
460
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
var finalStep = stepCursor / stepCount === 1;
|
|
460
|
-
var finishText = finishButtonText || 'finish';
|
|
461
|
-
var nextText = nextButtonText || 'next';
|
|
462
|
-
var buttonText = finalStep ? finishText : nextText;
|
|
463
|
-
return React.createElement(Button, tslib.__assign({}, augmentedNextButtonProps), buttonText);
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
var StepperActionsCancelButton = function (props) {
|
|
467
|
-
var setStepCursor = props.setStepCursor, stepCursor = props.stepCursor, cancelButtonText = props.cancelButtonText, cancelButtonProps = props.cancelButtonProps, handleCancelClick = props.handleCancelClick, displayCancelButton = props.displayCancelButton;
|
|
468
|
-
var augmentedCancelButtonProps = augmentButtonProps({ onClick: handleCancelClick }, cancelButtonProps, setStepCursor, stepCursor, 0);
|
|
469
|
-
return displayCancelButton ? (React.createElement(Button, tslib.__assign({ variant: "ghost" }, augmentedCancelButtonProps), cancelButtonText || 'cancel')) : null;
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
var FullScreenStepperActions = function (props) {
|
|
473
|
-
var stepCount = props.stepCount, stepCursor = props.stepCursor, setStepCursor = props.setStepCursor, handleNextClick = props.handleNextClick, handlePreviousClick = props.handlePreviousClick, handleCancelClick = props.handleCancelClick, actions = props.actions, callbackArgs = props.callbackArgs, cancelButtonText = props.cancelButtonText, nextButtonText = props.nextButtonText, finishButtonText = props.finishButtonText, nextButtonProps = props.nextButtonProps, previousButtonText = props.previousButtonText, previousButtonProps = props.previousButtonProps, cancelButtonProps = props.cancelButtonProps, statusText = props.statusText, displayPreviousButton = props.displayPreviousButton, displayCancelButton = props.displayCancelButton;
|
|
474
|
-
var classes = useFullScreenStepperActionsStyles(props);
|
|
461
|
+
const FullScreenStepperActions = (props) => {
|
|
462
|
+
const { stepCount, stepCursor, setStepCursor, handleNextClick, handlePreviousClick, handleCancelClick, actions, callbackArgs, cancelButtonText, nextButtonText, finishButtonText, nextButtonProps, previousButtonText, previousButtonProps, cancelButtonProps, statusText, displayPreviousButton, displayCancelButton, } = props;
|
|
463
|
+
const classes = useFullScreenStepperActionsStyles(props);
|
|
475
464
|
return (React.createElement(commonUi.Box, { className: classes.root },
|
|
476
465
|
React.createElement(commonUi.Box, { className: classes.inlineStartActions },
|
|
477
466
|
React.createElement(StepperActionsPreviousButton, { displayPreviousButton: displayPreviousButton, previousButtonText: previousButtonText, handlePreviousClick: handlePreviousClick, previousButtonProps: previousButtonProps, stepCursor: stepCursor, setStepCursor: setStepCursor }),
|
|
478
467
|
React.createElement(StepperActionsStatusText, { statusText: statusText })),
|
|
479
468
|
React.createElement(commonUi.Box, { className: classes.inlineEndActions },
|
|
480
469
|
actions &&
|
|
481
|
-
actions.map(
|
|
470
|
+
actions.map((action, i) => (React.createElement(Button, { key: `custom-action-${stepCursor}-${i}`, variant: "ghost", onClick: (event) => action.onClick(event, callbackArgs), ...action.props }, action.text))),
|
|
482
471
|
React.createElement(StepperActionsCancelButton, { setStepCursor: setStepCursor, stepCursor: stepCursor, cancelButtonText: cancelButtonText, cancelButtonProps: cancelButtonProps, handleCancelClick: handleCancelClick, displayCancelButton: displayCancelButton }),
|
|
483
472
|
React.createElement(StepperActionsNextButton, { handleNextClick: handleNextClick, nextButtonProps: nextButtonProps, setStepCursor: setStepCursor, stepCursor: stepCursor, stepCount: stepCount, finishButtonText: finishButtonText, nextButtonText: nextButtonText }))));
|
|
484
473
|
};
|
|
485
474
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
475
|
+
const getBorderRadius = (theme, props) => {
|
|
476
|
+
const { stepCursor, stepCount } = props;
|
|
477
|
+
const isFinalStep = stepCursor / stepCount === 1;
|
|
489
478
|
if (isFinalStep) {
|
|
490
479
|
return 0;
|
|
491
480
|
}
|
|
@@ -493,15 +482,15 @@ var getBorderRadius = function (theme, props) {
|
|
|
493
482
|
return theme.spacing(0.5);
|
|
494
483
|
}
|
|
495
484
|
};
|
|
496
|
-
|
|
485
|
+
const useFullScreenStepperProgressStyles = core.makeStyles((theme) => ({
|
|
497
486
|
progress: {
|
|
498
|
-
width:
|
|
487
|
+
width: (props) => `${(props.stepCursor / props.stepCount) * 100}%`,
|
|
499
488
|
transition: 'all 500ms',
|
|
500
489
|
height: theme.spacing(1),
|
|
501
490
|
// @ts-expect-error: Theme includes extended properties
|
|
502
|
-
background:
|
|
503
|
-
borderEndEndRadius:
|
|
504
|
-
borderStartEndRadius:
|
|
491
|
+
background: `linear-gradient(45deg, ${theme.palette.primary.gradientStart}, ${theme.palette.primary.gradientEnd})`,
|
|
492
|
+
borderEndEndRadius: (props) => getBorderRadius(theme, props),
|
|
493
|
+
borderStartEndRadius: (props) => getBorderRadius(theme, props),
|
|
505
494
|
},
|
|
506
495
|
track: {
|
|
507
496
|
position: 'absolute',
|
|
@@ -513,39 +502,36 @@ var useFullScreenStepperProgressStyles = core.makeStyles(function (theme) { retu
|
|
|
513
502
|
background: theme.palette.grey[100],
|
|
514
503
|
zIndex: 2,
|
|
515
504
|
},
|
|
516
|
-
})
|
|
505
|
+
}));
|
|
517
506
|
|
|
518
|
-
|
|
519
|
-
|
|
507
|
+
const FullScreenStepperProgress = (props) => {
|
|
508
|
+
const classes = useFullScreenStepperProgressStyles(props);
|
|
520
509
|
return (React.createElement(commonUi.Box, { className: classes.track },
|
|
521
510
|
React.createElement(commonUi.Box, { className: classes.progress })));
|
|
522
511
|
};
|
|
523
512
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
},
|
|
543
|
-
});
|
|
544
|
-
});
|
|
513
|
+
const useFullScreenStepperHeaderStyles = core.makeStyles(({ spacing }) => ({
|
|
514
|
+
closeButton: {
|
|
515
|
+
position: 'absolute',
|
|
516
|
+
right: 0,
|
|
517
|
+
top: 0,
|
|
518
|
+
},
|
|
519
|
+
root: {
|
|
520
|
+
alignItems: 'center',
|
|
521
|
+
background: 'white',
|
|
522
|
+
display: 'flex',
|
|
523
|
+
flexDirection: 'column',
|
|
524
|
+
justifyContent: 'center',
|
|
525
|
+
padding: spacing(1.5, 0),
|
|
526
|
+
position: 'sticky',
|
|
527
|
+
top: 0,
|
|
528
|
+
zIndex: 3,
|
|
529
|
+
},
|
|
530
|
+
}));
|
|
545
531
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
532
|
+
const FullScreenStepperHeader = (props) => {
|
|
533
|
+
const { stepCount, stepCursor, step, onClose } = props;
|
|
534
|
+
const classes = useFullScreenStepperHeaderStyles(props);
|
|
549
535
|
return (React.createElement(commonUi.Box, { className: classes.root },
|
|
550
536
|
React.createElement(commonUi.Typography, { variant: "h6" }, step.title),
|
|
551
537
|
React.createElement(commonUi.Typography, null,
|
|
@@ -557,25 +543,25 @@ var FullScreenStepperHeader = function (props) {
|
|
|
557
543
|
React.createElement(FullScreenStepperProgress, { stepCount: stepCount, stepCursor: stepCursor })));
|
|
558
544
|
};
|
|
559
545
|
|
|
560
|
-
|
|
546
|
+
const FullScreenStepperContext = React.createContext({});
|
|
561
547
|
|
|
562
548
|
/**
|
|
563
549
|
* TODO
|
|
564
550
|
* - i18n?
|
|
565
551
|
* - loading?
|
|
566
552
|
*/
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
553
|
+
const FullScreenStepper = (props) => {
|
|
554
|
+
const { children, context = {}, defaultStepCursor = 1, displayActionBar = true, displayCancelButton = true, displayPreviousButton = true, resetStepCursorOnCancel = true, resetStepCursorOnClose = true, steps, onClose, onFinish, onNext, onCancel, onPrevious, ...DialogProps } = props;
|
|
555
|
+
const [stepCursor, setStepCursor] = React.useState(defaultStepCursor);
|
|
556
|
+
const stepCount = steps.length;
|
|
557
|
+
const stepIndex = stepCursor - 1;
|
|
558
|
+
const step = steps[stepIndex];
|
|
559
|
+
const { displayActionBar: displayStepActionBar = true } = step;
|
|
560
|
+
const isFinalStep = stepCursor / stepCount === 1;
|
|
561
|
+
const callbackArgs = { setStepCursor, step, stepCount, stepIndex, steps };
|
|
562
|
+
const mergedContext = { ...context, ...callbackArgs };
|
|
563
|
+
const resetStepCursor = () => setTimeout(() => setStepCursor(1), 600);
|
|
564
|
+
const handleClose = () => {
|
|
579
565
|
if (typeof onClose === 'function') {
|
|
580
566
|
onClose(callbackArgs);
|
|
581
567
|
}
|
|
@@ -583,90 +569,60 @@ var FullScreenStepper = function (props) {
|
|
|
583
569
|
resetStepCursor();
|
|
584
570
|
}
|
|
585
571
|
};
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
if (!isFinalStep) return [3 /*break*/, 3];
|
|
591
|
-
if (!(typeof onFinish === 'function')) return [3 /*break*/, 2];
|
|
592
|
-
return [4 /*yield*/, onFinish(callbackArgs)];
|
|
593
|
-
case 1:
|
|
594
|
-
_a.sent();
|
|
595
|
-
_a.label = 2;
|
|
596
|
-
case 2:
|
|
597
|
-
if (typeof onClose === 'function') {
|
|
598
|
-
onClose(callbackArgs);
|
|
599
|
-
}
|
|
600
|
-
resetStepCursor();
|
|
601
|
-
return [3 /*break*/, 6];
|
|
602
|
-
case 3:
|
|
603
|
-
if (!(typeof onNext === 'function')) return [3 /*break*/, 5];
|
|
604
|
-
return [4 /*yield*/, onNext(callbackArgs)];
|
|
605
|
-
case 4:
|
|
606
|
-
_a.sent();
|
|
607
|
-
_a.label = 5;
|
|
608
|
-
case 5:
|
|
609
|
-
setStepCursor(stepCursor + 1);
|
|
610
|
-
_a.label = 6;
|
|
611
|
-
case 6: return [2 /*return*/];
|
|
572
|
+
const handleNextClick = async () => {
|
|
573
|
+
if (isFinalStep) {
|
|
574
|
+
if (typeof onFinish === 'function') {
|
|
575
|
+
await onFinish(callbackArgs);
|
|
612
576
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
var handlePreviousClick = function () { return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
616
|
-
return tslib.__generator(this, function (_a) {
|
|
617
|
-
switch (_a.label) {
|
|
618
|
-
case 0:
|
|
619
|
-
if (!(typeof onPrevious === 'function')) return [3 /*break*/, 2];
|
|
620
|
-
return [4 /*yield*/, onPrevious(callbackArgs)];
|
|
621
|
-
case 1:
|
|
622
|
-
_a.sent();
|
|
623
|
-
_a.label = 2;
|
|
624
|
-
case 2:
|
|
625
|
-
setStepCursor(stepCursor - 1);
|
|
626
|
-
return [2 /*return*/];
|
|
577
|
+
if (typeof onClose === 'function') {
|
|
578
|
+
onClose(callbackArgs);
|
|
627
579
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
case 0:
|
|
634
|
-
if (!(typeof onCancel === 'function')) return [3 /*break*/, 2];
|
|
635
|
-
return [4 /*yield*/, onCancel(callbackArgs)];
|
|
636
|
-
case 1:
|
|
637
|
-
_a.sent();
|
|
638
|
-
_a.label = 2;
|
|
639
|
-
case 2:
|
|
640
|
-
if (resetStepCursorOnCancel) {
|
|
641
|
-
resetStepCursor();
|
|
642
|
-
}
|
|
643
|
-
return [2 /*return*/];
|
|
580
|
+
resetStepCursor();
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
if (typeof onNext === 'function') {
|
|
584
|
+
await onNext(callbackArgs);
|
|
644
585
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
586
|
+
setStepCursor(stepCursor + 1);
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
const handlePreviousClick = async () => {
|
|
590
|
+
if (typeof onPrevious === 'function') {
|
|
591
|
+
await onPrevious(callbackArgs);
|
|
592
|
+
}
|
|
593
|
+
setStepCursor(stepCursor - 1);
|
|
594
|
+
};
|
|
595
|
+
const handleCancelClick = async () => {
|
|
596
|
+
if (typeof onCancel === 'function') {
|
|
597
|
+
await onCancel(callbackArgs);
|
|
598
|
+
}
|
|
599
|
+
if (resetStepCursorOnCancel) {
|
|
600
|
+
resetStepCursor();
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
const content = React.Children.toArray(children).find((child) => React.isValidElement(child) && child.props.name === step.name);
|
|
604
|
+
return (React.createElement(core.Dialog, { fullScreen: true, ...DialogProps },
|
|
649
605
|
React.createElement(FullScreenStepperContext.Provider, { value: mergedContext },
|
|
650
606
|
React.createElement(core.Box, { display: "flex", flexDirection: "column", flexGrow: 1 },
|
|
651
607
|
React.createElement(FullScreenStepperHeader, { stepCount: stepCount, stepCursor: stepCursor, onClose: handleClose, step: step }),
|
|
652
608
|
React.createElement(core.Box, { display: "flex", mx: 6, flexGrow: 1, alignItems: "center", flexDirection: "column" }, content),
|
|
653
|
-
displayActionBar && displayStepActionBar && (React.createElement(FullScreenStepperActions,
|
|
609
|
+
displayActionBar && displayStepActionBar && (React.createElement(FullScreenStepperActions, { ...step.actionBar, callbackArgs: callbackArgs, displayCancelButton: displayCancelButton, displayPreviousButton: displayPreviousButton, stepCount: stepCount, stepCursor: stepCursor, setStepCursor: setStepCursor, handleCancelClick: handleCancelClick, handleNextClick: handleNextClick, handlePreviousClick: handlePreviousClick }))))));
|
|
654
610
|
};
|
|
655
611
|
FullScreenStepper.displayName = 'FullScreenStepper';
|
|
656
612
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
return (React.createElement(commonUi.Box,
|
|
613
|
+
const FullScreenStepperContent = (props) => {
|
|
614
|
+
const { name: remove, ...boxProps } = props;
|
|
615
|
+
return (React.createElement(commonUi.Box, { py: 8, ...boxProps }, props.children));
|
|
660
616
|
};
|
|
661
617
|
|
|
662
|
-
|
|
618
|
+
const useStyles$2 = core.makeStyles((theme) => ({
|
|
663
619
|
root: {
|
|
664
620
|
'&$uncontained > li > *:first-child': {
|
|
665
621
|
background: theme.palette.background.paper,
|
|
666
622
|
borderRadius: theme.spacing(1),
|
|
667
623
|
},
|
|
668
624
|
'& > li > *:first-child': {
|
|
669
|
-
borderBottom:
|
|
625
|
+
borderBottom: `1px solid ${theme.palette.grey[300]}`,
|
|
670
626
|
},
|
|
671
627
|
'& > li:last-child > *:first-child': {
|
|
672
628
|
borderBottom: 'none',
|
|
@@ -677,90 +633,74 @@ var useStyles$2 = core.makeStyles(function (theme) { return ({
|
|
|
677
633
|
flexDirection: 'column',
|
|
678
634
|
gap: 16,
|
|
679
635
|
},
|
|
680
|
-
})
|
|
636
|
+
}));
|
|
681
637
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
return (React.createElement(core.List, tslib.__assign({ classes: classes, className: classNames((_a = {}, _a[classes.uncontained] = uncontained, _a), className) }, restProps), children));
|
|
638
|
+
const List = (props) => {
|
|
639
|
+
const { children, uncontained, className, ...restProps } = props;
|
|
640
|
+
const classes = useStyles$2(props);
|
|
641
|
+
return (React.createElement(core.List, { classes: classes, className: classNames({ [classes.uncontained]: uncontained }, className), ...restProps }, children));
|
|
687
642
|
};
|
|
688
643
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
return (React.createElement(commonUi.Box,
|
|
644
|
+
const Page = (props) => {
|
|
645
|
+
const { children, ...restProps } = props;
|
|
646
|
+
return (React.createElement(commonUi.Box, { marginTop: 8, display: "flex", alignItems: "center", flexDirection: "column", ...restProps }, children));
|
|
692
647
|
};
|
|
693
648
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
return (React.createElement(commonUi.Box,
|
|
649
|
+
const PageBody = (props) => {
|
|
650
|
+
const { children, ...restProps } = props;
|
|
651
|
+
return (React.createElement(commonUi.Box, { py: 2, px: 5.5, maxWidth: 1100, width: "100%", ...restProps }, children));
|
|
697
652
|
};
|
|
698
653
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
},
|
|
708
|
-
cardContent: {
|
|
709
|
-
padding: spacing(4),
|
|
710
|
-
},
|
|
711
|
-
});
|
|
712
|
-
});
|
|
654
|
+
const usePageSectionStyles = core.makeStyles(({ spacing }) => ({
|
|
655
|
+
root: {
|
|
656
|
+
background: ({ uncontained }) => (uncontained ? 'transparent' : undefined),
|
|
657
|
+
},
|
|
658
|
+
cardContent: {
|
|
659
|
+
padding: spacing(4),
|
|
660
|
+
},
|
|
661
|
+
}));
|
|
713
662
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
return (React.createElement(commonUi.Card,
|
|
663
|
+
const PageSection = React.forwardRef((props, ref) => {
|
|
664
|
+
const { children, uncontained, ...restProps } = props;
|
|
665
|
+
const classes = usePageSectionStyles(props);
|
|
666
|
+
return (React.createElement(commonUi.Card, { classes: { root: classes.root }, ref: ref, ...restProps },
|
|
718
667
|
React.createElement(commonUi.CardContent, { classes: { root: classes.cardContent } }, children)));
|
|
719
668
|
});
|
|
720
669
|
PageSection.displayName = 'PageSection';
|
|
721
670
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
return (React.createElement(commonUi.Box,
|
|
671
|
+
const PageSectionHead = (props) => {
|
|
672
|
+
const { children, ...restProps } = props;
|
|
673
|
+
const theme = core.useTheme();
|
|
674
|
+
return (React.createElement(commonUi.Box, { fontSize: theme.typography.h5.fontSize, mb: "1em", display: "flex", justifyContent: "space-between", ...restProps }, children));
|
|
726
675
|
};
|
|
727
676
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
return (React.createElement(commonUi.Box,
|
|
677
|
+
const PageSections = (props) => {
|
|
678
|
+
const { children, ...restProps } = props;
|
|
679
|
+
return (React.createElement(commonUi.Box, { display: "flex", flexDirection: "column", gridGap: 16, ...restProps }, children));
|
|
731
680
|
};
|
|
732
681
|
|
|
733
|
-
|
|
682
|
+
const useStyles$1 = core.makeStyles(() => ({
|
|
734
683
|
gutterBottom: {
|
|
735
684
|
marginBottom: '1em',
|
|
736
685
|
},
|
|
737
|
-
})
|
|
686
|
+
}));
|
|
738
687
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
return (React.createElement(commonUi.Typography,
|
|
688
|
+
const PageSectionTitle = (props) => {
|
|
689
|
+
const { children, ...restProps } = props;
|
|
690
|
+
const classes = useStyles$1();
|
|
691
|
+
return (React.createElement(commonUi.Typography, { classes: classes, gutterBottom: true, variant: "h5", ...restProps }, children));
|
|
743
692
|
};
|
|
744
693
|
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
694
|
+
const useSelectableCardStyles = core.makeStyles((theme) => {
|
|
695
|
+
const { palette: { info, grey, getContrastText }, spacing, } = theme;
|
|
696
|
+
const selectedBackgroundColor = core.lighten(theme.palette.info.light, 0.9);
|
|
697
|
+
const backgroundColor = theme.palette.surface.light;
|
|
749
698
|
return {
|
|
750
699
|
root: {
|
|
751
700
|
position: 'relative',
|
|
752
|
-
border:
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
},
|
|
756
|
-
backgroundColor: function (_a) {
|
|
757
|
-
var selected = _a.selected;
|
|
758
|
-
return (selected ? selectedBackgroundColor : backgroundColor);
|
|
759
|
-
},
|
|
760
|
-
color: function (_a) {
|
|
761
|
-
var selected = _a.selected;
|
|
762
|
-
return (selected ? getContrastText(selectedBackgroundColor) : getContrastText(backgroundColor));
|
|
763
|
-
},
|
|
701
|
+
border: ({ selected }) => (selected ? `1px solid ${info.light}` : `1px solid ${grey[700]}`),
|
|
702
|
+
backgroundColor: ({ selected }) => (selected ? selectedBackgroundColor : backgroundColor),
|
|
703
|
+
color: ({ selected }) => (selected ? getContrastText(selectedBackgroundColor) : getContrastText(backgroundColor)),
|
|
764
704
|
transition: 'none',
|
|
765
705
|
},
|
|
766
706
|
cardContent: {
|
|
@@ -774,10 +714,7 @@ var useSelectableCardStyles = core.makeStyles(function (theme) {
|
|
|
774
714
|
position: 'absolute',
|
|
775
715
|
top: spacing(2),
|
|
776
716
|
left: spacing(2),
|
|
777
|
-
color:
|
|
778
|
-
var selected = _a.selected;
|
|
779
|
-
return (selected ? info.main : grey[700]);
|
|
780
|
-
},
|
|
717
|
+
color: ({ selected }) => (selected ? info.main : grey[700]),
|
|
781
718
|
},
|
|
782
719
|
focusHighlight: {
|
|
783
720
|
backgroundColor: 'inherit',
|
|
@@ -785,23 +722,23 @@ var useSelectableCardStyles = core.makeStyles(function (theme) {
|
|
|
785
722
|
};
|
|
786
723
|
});
|
|
787
724
|
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
725
|
+
const SelectableCard = (props) => {
|
|
726
|
+
const { children, selected: selectedProp, selection = [], onClick, value, labelId, CardActionAreaProps, ...muiProps } = props;
|
|
727
|
+
const selected = typeof selectedProp === 'boolean' ? selectedProp : selection.includes(value);
|
|
728
|
+
const classes = useSelectableCardStyles({ ...props, selected });
|
|
729
|
+
const handleClick = () => {
|
|
793
730
|
onClick(value);
|
|
794
731
|
};
|
|
795
|
-
return (React.createElement(commonUi.Card,
|
|
796
|
-
React.createElement(commonUi.CardActionArea,
|
|
732
|
+
return (React.createElement(commonUi.Card, { classes: { root: classes.root }, ...muiProps },
|
|
733
|
+
React.createElement(commonUi.CardActionArea, { onClick: handleClick, classes: { focusHighlight: classes.focusHighlight }, role: "checkbox", "aria-checked": selected, "aria-labelledby": labelId, ...CardActionAreaProps },
|
|
797
734
|
React.createElement(commonUi.Icon, { className: classes.icon, icon: selected ? webIcons.CheckCircle : webIcons.Circle, size: "medium" }),
|
|
798
735
|
React.createElement(commonUi.CardContent, { classes: { root: classes.cardContent } }, children))));
|
|
799
736
|
};
|
|
800
737
|
SelectableCard.displayName = 'SelectableCard';
|
|
801
738
|
|
|
802
|
-
|
|
739
|
+
const useSettingsIndexCardStyles = core.makeStyles((theme) => ({
|
|
803
740
|
cardRoot: {
|
|
804
|
-
border:
|
|
741
|
+
border: `1px solid ${theme.palette.grey[300]}`,
|
|
805
742
|
alignSelf: 'stretch',
|
|
806
743
|
flexGrow: 1,
|
|
807
744
|
'&:hover': {
|
|
@@ -814,30 +751,30 @@ var useSettingsIndexCardStyles = core.makeStyles(function (theme) { return ({
|
|
|
814
751
|
paddingBottom: theme.spacing(4),
|
|
815
752
|
},
|
|
816
753
|
},
|
|
817
|
-
})
|
|
754
|
+
}));
|
|
818
755
|
|
|
819
756
|
// eslint-disable-next-line react/display-name -- false positive
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
return (React.createElement(commonUi.ButtonBase,
|
|
757
|
+
const SettingsIndexCard = React.forwardRef((props, ref) => {
|
|
758
|
+
const { title, description, Icon, onClick, statusLabel, ...restProps } = props;
|
|
759
|
+
const classes = useSettingsIndexCardStyles(props);
|
|
760
|
+
const showStatusLabel = statusLabel?.text && statusLabel?.color;
|
|
761
|
+
return (React.createElement(commonUi.ButtonBase, { onClick: onClick, ref: ref, ...restProps },
|
|
825
762
|
React.createElement(commonUi.Card, { classes: { root: classes.cardRoot } },
|
|
826
763
|
React.createElement(commonUi.CardContent, { classes: { root: classes.cardContentRoot } },
|
|
827
764
|
React.createElement(commonUi.Box, { fontSize: "32px", display: "flex", justifyContent: 'space-between', alignItems: "center", paddingBottom: 2 },
|
|
828
765
|
React.createElement(commonUi.Icon, { icon: Icon || webIcons.Help, size: "inherit" }),
|
|
829
|
-
showStatusLabel && (React.createElement(commonUi.Typography, { weight: "semi-bold", variant: "body2", color: statusLabel
|
|
766
|
+
showStatusLabel && (React.createElement(commonUi.Typography, { weight: "semi-bold", variant: "body2", color: statusLabel?.color }, statusLabel?.text))),
|
|
830
767
|
React.createElement(commonUi.Typography, { align: "left", variant: "h6", gutterBottom: true }, title),
|
|
831
768
|
description && (React.createElement(commonUi.Typography, { align: "left", variant: "body2", color: "grey.700" }, description))))));
|
|
832
769
|
});
|
|
833
770
|
SettingsIndexCard.displayName = 'SettingsIndexCard';
|
|
834
771
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
return (React.createElement(commonUi.Box,
|
|
772
|
+
const SettingsIndexCardGroup = (props) => {
|
|
773
|
+
const { children, ...restProps } = props;
|
|
774
|
+
return (React.createElement(commonUi.Box, { display: "grid", gridGap: 16, gridTemplateColumns: "repeat(auto-fill, minmax(250px, 1fr))", ...restProps }, children));
|
|
838
775
|
};
|
|
839
776
|
|
|
840
|
-
|
|
777
|
+
const useStyles = core.makeStyles((theme) => ({
|
|
841
778
|
chipRoot: {
|
|
842
779
|
marginRight: theme.spacing(4),
|
|
843
780
|
cursor: 'pointer',
|
|
@@ -848,16 +785,16 @@ var useStyles = core.makeStyles(function (theme) { return ({
|
|
|
848
785
|
listItemText: {
|
|
849
786
|
marginRight: '32px',
|
|
850
787
|
},
|
|
851
|
-
})
|
|
788
|
+
}));
|
|
852
789
|
/**
|
|
853
790
|
* TODO
|
|
854
791
|
* - clean props util
|
|
855
792
|
* - Avatar size and shape
|
|
856
793
|
*/
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
return (React.createElement(core.ListItem,
|
|
794
|
+
const StandardListItem = (props) => {
|
|
795
|
+
const { itemId, title, meta, body, image, status, secondaryAction, onClick, ...restProps } = props;
|
|
796
|
+
const classes = useStyles(props);
|
|
797
|
+
return (React.createElement(core.ListItem, { button: Boolean(onClick), onClick: (e) => onClick && onClick(e, props), ...restProps },
|
|
861
798
|
image && (React.createElement(core.ListItemAvatar, null,
|
|
862
799
|
React.createElement(commonUi.Avatar, { src: image.src, alt: image.alt }, image.Icon && React.createElement(commonUi.Icon, { icon: image.Icon })))),
|
|
863
800
|
React.createElement(core.ListItemText, { disableTypography: true, className: classes.listItemText },
|
|
@@ -866,11 +803,11 @@ var StandardListItem = function (props) {
|
|
|
866
803
|
body && (React.createElement(commonUi.Typography, { variant: "body2", color: "grey.700", className: classes.body }, body))),
|
|
867
804
|
status && (React.createElement(core.Chip, { classes: { root: classes.chipRoot }, icon: status.Icon && React.createElement(commonUi.Icon, { icon: status.Icon }), label: status.text })),
|
|
868
805
|
secondaryAction && (React.createElement(core.ListItemSecondaryAction, null,
|
|
869
|
-
React.createElement(core.IconButton, { style: { color: 'black' }, "aria-label": secondaryAction['aria-label'], onClick:
|
|
806
|
+
React.createElement(core.IconButton, { style: { color: 'black' }, "aria-label": secondaryAction['aria-label'], onClick: (e) => secondaryAction.onClick(e, props) },
|
|
870
807
|
React.createElement(commonUi.Icon, { icon: secondaryAction.Icon }))))));
|
|
871
808
|
};
|
|
872
809
|
|
|
873
|
-
|
|
810
|
+
const useToastStyles = core.makeStyles((theme) => ({
|
|
874
811
|
root: {
|
|
875
812
|
boxSizing: 'border-box',
|
|
876
813
|
padding: theme.spacing(0, 1.5),
|
|
@@ -880,17 +817,16 @@ var useToastStyles = core.makeStyles(function (theme) { return ({
|
|
|
880
817
|
alignItems: 'center',
|
|
881
818
|
},
|
|
882
819
|
},
|
|
883
|
-
})
|
|
820
|
+
}));
|
|
884
821
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
React.createElement(Alert, tslib.__assign({ className: classes.root, action: null, severity: severity }, AlertProps), children)));
|
|
822
|
+
const Toast = ({ AlertProps = {}, autoHideDuration = 5000, children, severity, ...muiProps }) => {
|
|
823
|
+
const classes = useToastStyles();
|
|
824
|
+
return (React.createElement(core.Snackbar, { ClickAwayListenerProps: { mouseEvent: false }, autoHideDuration: autoHideDuration, ...muiProps },
|
|
825
|
+
React.createElement(Alert, { className: classes.root, action: null, severity: severity, ...AlertProps }, children)));
|
|
890
826
|
};
|
|
891
827
|
Toast.displayName = 'Toast';
|
|
892
828
|
|
|
893
|
-
|
|
829
|
+
const useFullScreenStepperContext = () => React.useContext(FullScreenStepperContext);
|
|
894
830
|
|
|
895
831
|
/**
|
|
896
832
|
* Manages state for SelectableCards.
|
|
@@ -901,26 +837,25 @@ var useFullScreenStepperContext = function () { return React.useContext(FullScre
|
|
|
901
837
|
* @param {number} [config.maxSelectionCount] - A number to determine the maximum amount of cards to be selected.
|
|
902
838
|
* @returns {HookResult} An object with click handler and current state. Spread into a SelectableCard to use.
|
|
903
839
|
*/
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
var handleSingleSelectionMode = function (value) {
|
|
840
|
+
const useSelectableCard = (config = {}) => {
|
|
841
|
+
const { defaultSelected = [], selectionMode = 'single', maxSelectionCount } = config;
|
|
842
|
+
const initialState = Array.isArray(defaultSelected) ? defaultSelected : [defaultSelected];
|
|
843
|
+
const [selection, setSelection] = React.useState(initialState);
|
|
844
|
+
let onClick;
|
|
845
|
+
const handleSingleSelectionMode = (value) => {
|
|
911
846
|
setSelection([value]);
|
|
912
847
|
};
|
|
913
|
-
|
|
914
|
-
|
|
848
|
+
const handleMultiSelectionMode = (value) => {
|
|
849
|
+
let newSelection = [...selection];
|
|
915
850
|
if (!selection.includes(value)) {
|
|
916
851
|
if (selection.length === maxSelectionCount) {
|
|
917
852
|
newSelection.shift();
|
|
918
853
|
}
|
|
919
|
-
newSelection =
|
|
854
|
+
newSelection = [...newSelection, value];
|
|
920
855
|
setSelection(newSelection);
|
|
921
856
|
}
|
|
922
857
|
else {
|
|
923
|
-
newSelection = newSelection.filter(
|
|
858
|
+
newSelection = newSelection.filter((selected) => selected !== value);
|
|
924
859
|
setSelection(newSelection);
|
|
925
860
|
}
|
|
926
861
|
};
|
|
@@ -934,19 +869,19 @@ var useSelectableCard = function (config) {
|
|
|
934
869
|
default:
|
|
935
870
|
onClick = handleSingleSelectionMode;
|
|
936
871
|
}
|
|
937
|
-
return { card: { onClick
|
|
872
|
+
return { card: { onClick, selection }, selection, setSelection };
|
|
938
873
|
};
|
|
939
874
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
return [triggerProps, dialogProps, { open
|
|
875
|
+
const useDialog = () => {
|
|
876
|
+
const [open, setOpen] = React.useState(false);
|
|
877
|
+
const toggle = () => setOpen((current) => !current);
|
|
878
|
+
const close = () => setOpen(false);
|
|
879
|
+
const triggerProps = { onClick: toggle };
|
|
880
|
+
const dialogProps = { open, onClose: close };
|
|
881
|
+
return [triggerProps, dialogProps, { open, setOpen, toggle, close }];
|
|
947
882
|
};
|
|
948
883
|
|
|
949
|
-
|
|
884
|
+
const adminThemeBreakpoints = {
|
|
950
885
|
values: {
|
|
951
886
|
xs: 0,
|
|
952
887
|
sm: 768,
|
|
@@ -956,7 +891,7 @@ var adminThemeBreakpoints = {
|
|
|
956
891
|
},
|
|
957
892
|
};
|
|
958
893
|
|
|
959
|
-
|
|
894
|
+
const props = {
|
|
960
895
|
MuiSwitch: {
|
|
961
896
|
color: 'default',
|
|
962
897
|
},
|
|
@@ -969,17 +904,17 @@ var props = {
|
|
|
969
904
|
* These theme properties should be considered legacy. Make efforts to avoid new usage as well as refactor out existing
|
|
970
905
|
* usage.
|
|
971
906
|
*/
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
907
|
+
const adminLightPlaceholder = { placeholder: 'rgba(0, 0, 0, 1)' };
|
|
908
|
+
const adminDarkPlaceholder = { placeholder: 'rgba(255, 255, 255, 0.37)' };
|
|
909
|
+
const adminThemeStatus = {
|
|
975
910
|
status: {
|
|
976
911
|
disabled: {
|
|
977
912
|
opacity: 0.55,
|
|
978
913
|
},
|
|
979
914
|
},
|
|
980
915
|
};
|
|
981
|
-
|
|
982
|
-
|
|
916
|
+
const BASE_Z_INDEX = 1100000;
|
|
917
|
+
const adminThemeZIndex = {
|
|
983
918
|
zIndex: {
|
|
984
919
|
mobileStepper: BASE_Z_INDEX + 1000,
|
|
985
920
|
appBar: BASE_Z_INDEX + 1100,
|
|
@@ -995,26 +930,33 @@ var adminThemeZIndex = {
|
|
|
995
930
|
*
|
|
996
931
|
* props as imported from './props' are part updated design system.
|
|
997
932
|
*/
|
|
998
|
-
|
|
999
|
-
props:
|
|
933
|
+
const adminThemeDefaultProps = {
|
|
934
|
+
props: {
|
|
935
|
+
...props,
|
|
1000
936
|
// Legacy below
|
|
1001
937
|
MuiCard: {
|
|
1002
938
|
elevation: 0,
|
|
1003
|
-
},
|
|
939
|
+
},
|
|
940
|
+
MuiTooltip: {
|
|
1004
941
|
title: '',
|
|
1005
942
|
placement: 'right',
|
|
1006
|
-
},
|
|
943
|
+
},
|
|
944
|
+
MuiPaper: {
|
|
1007
945
|
elevation: 0,
|
|
1008
|
-
},
|
|
946
|
+
},
|
|
947
|
+
MuiAppBar: {
|
|
1009
948
|
position: 'static',
|
|
1010
|
-
},
|
|
949
|
+
},
|
|
950
|
+
MuiInputBase: {
|
|
1011
951
|
color: 'secondary',
|
|
1012
|
-
},
|
|
952
|
+
},
|
|
953
|
+
MuiInputLabel: {
|
|
1013
954
|
color: 'secondary',
|
|
1014
|
-
}
|
|
955
|
+
},
|
|
956
|
+
},
|
|
1015
957
|
};
|
|
1016
958
|
|
|
1017
|
-
|
|
959
|
+
const basePalette = {
|
|
1018
960
|
/** Semantic Colors */
|
|
1019
961
|
primary: {
|
|
1020
962
|
light: '#DA777E',
|
|
@@ -1081,7 +1023,7 @@ var basePalette = {
|
|
|
1081
1023
|
main: '#FFFFFF',
|
|
1082
1024
|
},
|
|
1083
1025
|
};
|
|
1084
|
-
|
|
1026
|
+
const adminLightPalette = {
|
|
1085
1027
|
type: 'light',
|
|
1086
1028
|
/** Semantic Colors */
|
|
1087
1029
|
secondary: {
|
|
@@ -1095,7 +1037,7 @@ var adminLightPalette = {
|
|
|
1095
1037
|
dark: '#2E3042',
|
|
1096
1038
|
},
|
|
1097
1039
|
};
|
|
1098
|
-
|
|
1040
|
+
const adminDarkPalette = {
|
|
1099
1041
|
type: 'dark',
|
|
1100
1042
|
/** Semantic Colors */
|
|
1101
1043
|
secondary: {
|
|
@@ -1108,7 +1050,7 @@ var adminDarkPalette = {
|
|
|
1108
1050
|
dark: '#333333',
|
|
1109
1051
|
},
|
|
1110
1052
|
};
|
|
1111
|
-
|
|
1053
|
+
const dataVizPalette = {
|
|
1112
1054
|
data: {
|
|
1113
1055
|
blue: {
|
|
1114
1056
|
light: '#A5BBFF',
|
|
@@ -1143,7 +1085,7 @@ var dataVizPalette = {
|
|
|
1143
1085
|
},
|
|
1144
1086
|
};
|
|
1145
1087
|
|
|
1146
|
-
|
|
1088
|
+
const overrides = {
|
|
1147
1089
|
MuiCssBaseline: {
|
|
1148
1090
|
'@global': {
|
|
1149
1091
|
'*::-webkit-scrollbar': {
|
|
@@ -1174,8 +1116,8 @@ var overrides = {
|
|
|
1174
1116
|
},
|
|
1175
1117
|
};
|
|
1176
1118
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1119
|
+
const fonts = ['"Poppins"', '"sans-serif"'];
|
|
1120
|
+
const adminThemeTypography = {
|
|
1179
1121
|
htmlFontSize: 16,
|
|
1180
1122
|
fontFamily: fonts.join(', '),
|
|
1181
1123
|
h1: {
|
|
@@ -1237,11 +1179,41 @@ var adminThemeTypography = {
|
|
|
1237
1179
|
},
|
|
1238
1180
|
};
|
|
1239
1181
|
|
|
1240
|
-
|
|
1241
|
-
|
|
1182
|
+
const adminLightOptions = {
|
|
1183
|
+
themeName: 'Admin Light',
|
|
1184
|
+
palette: {
|
|
1185
|
+
...basePalette,
|
|
1186
|
+
...adminLightPalette,
|
|
1187
|
+
...dataVizPalette,
|
|
1188
|
+
},
|
|
1189
|
+
breakpoints: adminThemeBreakpoints,
|
|
1190
|
+
typography: adminThemeTypography,
|
|
1191
|
+
overrides: overrides,
|
|
1192
|
+
/** Legacy Properties. Avoid new usage. */
|
|
1193
|
+
...adminLightPlaceholder,
|
|
1194
|
+
...adminThemeZIndex,
|
|
1195
|
+
...adminThemeStatus,
|
|
1196
|
+
...adminThemeDefaultProps,
|
|
1197
|
+
};
|
|
1198
|
+
const adminLight = core.createTheme(adminLightOptions);
|
|
1242
1199
|
|
|
1243
|
-
|
|
1244
|
-
|
|
1200
|
+
const adminDarkOptions = {
|
|
1201
|
+
themeName: 'Admin Dark',
|
|
1202
|
+
palette: {
|
|
1203
|
+
...basePalette,
|
|
1204
|
+
...adminDarkPalette,
|
|
1205
|
+
...dataVizPalette,
|
|
1206
|
+
},
|
|
1207
|
+
breakpoints: adminThemeBreakpoints,
|
|
1208
|
+
typography: adminThemeTypography,
|
|
1209
|
+
overrides: overrides,
|
|
1210
|
+
/** Legacy Properties. Avoid new usage. */
|
|
1211
|
+
...adminDarkPlaceholder,
|
|
1212
|
+
...adminThemeZIndex,
|
|
1213
|
+
...adminThemeStatus,
|
|
1214
|
+
...adminThemeDefaultProps,
|
|
1215
|
+
};
|
|
1216
|
+
const adminDark = core.createTheme(adminDarkOptions);
|
|
1245
1217
|
|
|
1246
1218
|
Object.defineProperty(exports, "Dialog", {
|
|
1247
1219
|
enumerable: true,
|