@popmenu/common-ui 0.127.0 → 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/Avatar/AvatarProps.d.ts +2 -2
- package/build/cjs/components/Button/Button.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/Chip/Chip.d.ts +1 -1
- package/build/cjs/components/Chip/ChipProps.d.ts +2 -2
- package/build/cjs/components/CollapsibleText/CollapsibleTextStyles.d.ts +2 -2
- package/build/cjs/components/Divider/DividerProps.d.ts +1 -1
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationAltActions.d.ts +0 -1
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationBody.d.ts +0 -1
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationCloseButton.d.ts +0 -1
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationDialog.d.ts +0 -1
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationDialogProps.d.ts +6 -6
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationFooter.d.ts +0 -1
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationForm.d.ts +0 -1
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.d.ts +0 -1
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationInfo.d.ts +0 -1
- package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationTitle.d.ts +0 -1
- package/build/cjs/components/FollowerAuthenticationDialog/context.d.ts +0 -1
- package/build/cjs/components/Icon/IconStyles.d.ts +1 -1
- package/build/cjs/components/IconButton/IconButtonProps.d.ts +1 -1
- package/build/cjs/components/Link/LinkStyles.d.ts +1 -1
- package/build/cjs/components/NumberField/NumberField.d.ts +0 -1
- package/build/cjs/components/NumberField/NumberFieldStyles.d.ts +1 -1
- package/build/cjs/components/SplitInput/SplitInputStyles.d.ts +1 -1
- package/build/cjs/components/Tooltip/TooltipProps.d.ts +1 -1
- package/build/cjs/components/Typography/Typography.d.ts +1 -1
- package/build/cjs/components/Typography/TypographyProps.d.ts +3 -3
- package/build/cjs/components/Typography/TypographyStyles.d.ts +1 -1
- package/build/cjs/hooks/useTabs/useTabsResult.d.ts +3 -3
- package/build/cjs/index.js +412 -437
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/types/index.d.ts +2 -2
- package/build/esm/components/Avatar/Avatar.js +9 -10
- package/build/esm/components/Avatar/Avatar.js.map +1 -1
- package/build/esm/components/Avatar/AvatarProps.d.ts +2 -2
- package/build/esm/components/Avatar/avatar.styles.js +11 -11
- package/build/esm/components/Avatar/avatar.styles.js.map +1 -1
- package/build/esm/components/Avatar/util/useImageProps.js +9 -8
- package/build/esm/components/Avatar/util/useImageProps.js.map +1 -1
- package/build/esm/components/BrowserSilhouette/BrowserSilhouette.js +2 -3
- package/build/esm/components/BrowserSilhouette/BrowserSilhouette.js.map +1 -1
- package/build/esm/components/BrowserSilhouette/browserSilhouette.styles.js +5 -5
- package/build/esm/components/BrowserSilhouette/browserSilhouette.styles.js.map +1 -1
- package/build/esm/components/Button/Button.d.ts +1 -1
- package/build/esm/components/Button/Button.js +7 -8
- 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 +3 -6
- package/build/esm/components/Button/ButtonStyles.js.map +1 -1
- package/build/esm/components/Checkbox/Checkbox.js +5 -5
- package/build/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/build/esm/components/Chip/Chip.d.ts +1 -1
- package/build/esm/components/Chip/Chip.js +7 -8
- package/build/esm/components/Chip/Chip.js.map +1 -1
- package/build/esm/components/Chip/ChipProps.d.ts +2 -2
- package/build/esm/components/Chip/ChipStyles.js +19 -19
- package/build/esm/components/Chip/ChipStyles.js.map +1 -1
- package/build/esm/components/CollapsibleText/CollapsibleText.js +19 -20
- package/build/esm/components/CollapsibleText/CollapsibleText.js.map +1 -1
- package/build/esm/components/CollapsibleText/CollapsibleTextStyles.d.ts +2 -2
- package/build/esm/components/CollapsibleText/CollapsibleTextStyles.js +5 -6
- package/build/esm/components/CollapsibleText/CollapsibleTextStyles.js.map +1 -1
- package/build/esm/components/Divider/Divider.js +11 -15
- package/build/esm/components/Divider/Divider.js.map +1 -1
- package/build/esm/components/Divider/DividerProps.d.ts +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationAltActions.d.ts +0 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationAltActions.js +26 -26
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationAltActions.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationBody.d.ts +0 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationBody.js +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationBody.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationCloseButton.d.ts +0 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationCloseButton.js +6 -6
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationCloseButton.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationContent.js +4 -4
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationContent.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationDialog.d.ts +0 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationDialog.js +11 -15
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationDialog.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationDialogProps.d.ts +6 -6
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationFooter.d.ts +0 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationFooter.js +2 -2
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationFooter.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationForm.d.ts +0 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationForm.js +49 -52
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationForm.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.d.ts +0 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.js +4 -4
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationInfo.d.ts +0 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationInfo.js +3 -3
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationInfo.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationTitle.d.ts +0 -1
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationTitle.js +3 -3
- package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationTitle.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/context.d.ts +0 -1
- package/build/esm/components/FollowerAuthenticationDialog/context.js +4 -4
- package/build/esm/components/FollowerAuthenticationDialog/context.js.map +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/theme.js +1 -1
- package/build/esm/components/FollowerAuthenticationDialog/theme.js.map +1 -1
- package/build/esm/components/Icon/Icon.js +12 -8
- package/build/esm/components/Icon/Icon.js.map +1 -1
- package/build/esm/components/Icon/IconStyles.d.ts +1 -1
- package/build/esm/components/Icon/IconStyles.js +7 -9
- package/build/esm/components/Icon/IconStyles.js.map +1 -1
- package/build/esm/components/IconButton/IconButton.js +2 -3
- package/build/esm/components/IconButton/IconButton.js.map +1 -1
- package/build/esm/components/IconButton/IconButtonProps.d.ts +1 -1
- package/build/esm/components/Link/Link.js +4 -5
- package/build/esm/components/Link/Link.js.map +1 -1
- package/build/esm/components/Link/LinkStyles.d.ts +1 -1
- package/build/esm/components/Link/LinkStyles.js +8 -8
- package/build/esm/components/Link/LinkStyles.js.map +1 -1
- package/build/esm/components/NumberField/NumberField.d.ts +0 -1
- package/build/esm/components/NumberField/NumberField.js +14 -9
- package/build/esm/components/NumberField/NumberField.js.map +1 -1
- package/build/esm/components/NumberField/NumberFieldStyles.d.ts +1 -1
- package/build/esm/components/NumberField/NumberFieldStyles.js +4 -4
- package/build/esm/components/NumberField/NumberFieldStyles.js.map +1 -1
- package/build/esm/components/Paper/Paper.js +12 -16
- package/build/esm/components/Paper/Paper.js.map +1 -1
- package/build/esm/components/PaperContent/PaperContent.js +2 -2
- package/build/esm/components/PaperContent/PaperContent.js.map +1 -1
- package/build/esm/components/Radio/Radio.js +5 -5
- package/build/esm/components/Radio/Radio.js.map +1 -1
- package/build/esm/components/SplitInput/SplitInput.js +4 -6
- package/build/esm/components/SplitInput/SplitInput.js.map +1 -1
- package/build/esm/components/SplitInput/SplitInputStyles.d.ts +1 -1
- package/build/esm/components/SplitInput/SplitInputStyles.js +4 -4
- package/build/esm/components/SplitInput/SplitInputStyles.js.map +1 -1
- package/build/esm/components/Switch/Switch.js +6 -6
- package/build/esm/components/Switch/Switch.js.map +1 -1
- package/build/esm/components/Switch/switch.styles.js +2 -2
- package/build/esm/components/Switch/switch.styles.js.map +1 -1
- package/build/esm/components/TabPanel/TabPanel.js +2 -2
- package/build/esm/components/TabPanel/TabPanel.js.map +1 -1
- package/build/esm/components/ToggleButton/ToggleButton.js +5 -6
- package/build/esm/components/ToggleButton/ToggleButton.js.map +1 -1
- package/build/esm/components/ToggleButton/ToggleButtonStyles.js +4 -4
- package/build/esm/components/ToggleButton/ToggleButtonStyles.js.map +1 -1
- package/build/esm/components/ToggleButtonGroup/ToggleButtonGroup.js +6 -7
- package/build/esm/components/ToggleButtonGroup/ToggleButtonGroup.js.map +1 -1
- package/build/esm/components/ToggleButtonGroup/ToggleButtonGroupStyles.js +2 -2
- package/build/esm/components/ToggleButtonGroup/ToggleButtonGroupStyles.js.map +1 -1
- package/build/esm/components/Tooltip/Tooltip.js +3 -4
- package/build/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/build/esm/components/Tooltip/TooltipProps.d.ts +1 -1
- package/build/esm/components/Tooltip/TooltipStyles.js +5 -8
- package/build/esm/components/Tooltip/TooltipStyles.js.map +1 -1
- package/build/esm/components/Typography/Typography.d.ts +1 -1
- package/build/esm/components/Typography/Typography.js +4 -6
- package/build/esm/components/Typography/Typography.js.map +1 -1
- package/build/esm/components/Typography/TypographyProps.d.ts +3 -3
- package/build/esm/components/Typography/TypographyStyles.d.ts +1 -1
- package/build/esm/components/Typography/TypographyStyles.js +29 -47
- package/build/esm/components/Typography/TypographyStyles.js.map +1 -1
- package/build/esm/hooks/useCollapsibleText.js +7 -7
- package/build/esm/hooks/useCollapsibleText.js.map +1 -1
- package/build/esm/hooks/useTabs/useTabs.js +15 -15
- package/build/esm/hooks/useTabs/useTabs.js.map +1 -1
- package/build/esm/hooks/useTabs/useTabsResult.d.ts +3 -3
- package/build/esm/types/index.d.ts +2 -2
- package/package.json +2 -2
package/build/cjs/index.js
CHANGED
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@material-ui/core');
|
|
4
4
|
var lab = require('@material-ui/lab');
|
|
5
|
-
var tslib = require('tslib');
|
|
6
5
|
var webIcons = require('@popmenu/web-icons');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var classNames = require('classnames');
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var size = _a.size;
|
|
14
|
-
var sizes = {
|
|
9
|
+
const useIconStyles = core.makeStyles(({ spacing, palette }) => {
|
|
10
|
+
const getFontSize = ({ size }) => {
|
|
11
|
+
const sizes = {
|
|
15
12
|
inherit: 'inherit',
|
|
16
13
|
small: spacing(1.5),
|
|
17
14
|
medium: spacing(2),
|
|
@@ -22,12 +19,12 @@ var useIconStyles = core.makeStyles(function (_a) {
|
|
|
22
19
|
return 'inherit';
|
|
23
20
|
return sizes[size];
|
|
24
21
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const getColor = (props) => {
|
|
23
|
+
const semanticColors = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
|
|
24
|
+
let value = 'inherit';
|
|
28
25
|
if (props.color) {
|
|
29
26
|
if (semanticColors.includes(props.color.split('.')[0])) {
|
|
30
|
-
|
|
27
|
+
const [color, variant = 'main'] = props.color.split('.');
|
|
31
28
|
// @ts-expect-error - todo.
|
|
32
29
|
value = palette[color][variant];
|
|
33
30
|
}
|
|
@@ -48,20 +45,25 @@ var useIconStyles = core.makeStyles(function (_a) {
|
|
|
48
45
|
};
|
|
49
46
|
});
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var hasAccessibleAttr = Boolean(restProps['aria-describedby'] || restProps['aria-label']);
|
|
48
|
+
const iconStaticClassName = 'pop-icon';
|
|
49
|
+
const Icon = ({ className, color = 'inherit', icon, size = 'inherit', ...restProps }) => {
|
|
50
|
+
const hasAccessibleAttr = Boolean(restProps['aria-describedby'] || restProps['aria-label']);
|
|
55
51
|
if (!hasAccessibleAttr && restProps['aria-hidden'] === undefined) {
|
|
56
52
|
restProps['aria-hidden'] = true;
|
|
57
53
|
}
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
const classes = useIconStyles({ color, size });
|
|
55
|
+
let isValid = true;
|
|
60
56
|
if (!icon || (typeof icon === 'function' && icon({}) === undefined)) {
|
|
61
57
|
isValid = false;
|
|
62
58
|
}
|
|
63
59
|
return isValid
|
|
64
|
-
? React.createElement(icon,
|
|
60
|
+
? React.createElement(icon, {
|
|
61
|
+
className: classNames([classes.root, iconStaticClassName, className]),
|
|
62
|
+
color,
|
|
63
|
+
width: undefined,
|
|
64
|
+
height: undefined,
|
|
65
|
+
...restProps,
|
|
66
|
+
})
|
|
65
67
|
: null;
|
|
66
68
|
};
|
|
67
69
|
Icon.displayName = 'Icon';
|
|
@@ -72,29 +74,31 @@ var LoadingStatus;
|
|
|
72
74
|
LoadingStatus["LOADED"] = "LOADED";
|
|
73
75
|
LoadingStatus["PENDING"] = "PENDING";
|
|
74
76
|
})(LoadingStatus || (LoadingStatus = {}));
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const useImgProps = (avatarProps) => {
|
|
78
|
+
const [loaded, setLoaded] = React.useState(LoadingStatus.PENDING);
|
|
79
|
+
const imgProps = {
|
|
80
|
+
...avatarProps.imgProps,
|
|
81
|
+
onLoad: (event) => {
|
|
79
82
|
setLoaded(LoadingStatus.LOADED);
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
+
avatarProps.imgProps?.onLoad?.(event);
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
return { imgProps, loaded };
|
|
83
87
|
};
|
|
84
88
|
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
const getAvatarDimensions = (theme, props) => {
|
|
90
|
+
const factors = {
|
|
87
91
|
'extra-small': 3,
|
|
88
92
|
small: 4,
|
|
89
93
|
medium: 5,
|
|
90
94
|
large: 6,
|
|
91
95
|
'extra-large': 12.5,
|
|
92
96
|
};
|
|
93
|
-
|
|
97
|
+
const sizeFactor = factors[props.size || 'medium'];
|
|
94
98
|
return theme.spacing(sizeFactor);
|
|
95
99
|
};
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
const getAvatarFontSize = (props) => {
|
|
101
|
+
const fontSizes = {
|
|
98
102
|
'extra-small': '0.75rem',
|
|
99
103
|
small: '1rem',
|
|
100
104
|
medium: '1rem',
|
|
@@ -103,29 +107,29 @@ var getAvatarFontSize = function (props) {
|
|
|
103
107
|
};
|
|
104
108
|
return fontSizes[props.size];
|
|
105
109
|
};
|
|
106
|
-
|
|
107
|
-
root:
|
|
110
|
+
const useAvatarStyles = core.makeStyles((theme) => ({
|
|
111
|
+
root: (props) => ({
|
|
108
112
|
width: getAvatarDimensions(theme, props),
|
|
109
113
|
height: getAvatarDimensions(theme, props),
|
|
110
114
|
fontSize: getAvatarFontSize(props),
|
|
111
115
|
backgroundColor: props.loaded === LoadingStatus.LOADED ? 'transparent' : props.background,
|
|
112
116
|
color: theme.palette.getContrastText(props.background),
|
|
113
117
|
objectFit: props.fit,
|
|
114
|
-
})
|
|
115
|
-
fallback:
|
|
118
|
+
}),
|
|
119
|
+
fallback: (props) => ({
|
|
116
120
|
fontSize: getAvatarDimensions(theme, props),
|
|
117
121
|
strokeWidth: 1,
|
|
118
|
-
})
|
|
119
|
-
})
|
|
122
|
+
}),
|
|
123
|
+
}));
|
|
120
124
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
const Avatar = React.forwardRef((props, ref) => {
|
|
126
|
+
const { children, src, alt, fallback, ...muiProps } = props;
|
|
127
|
+
const { imgProps, loaded } = useImgProps(props);
|
|
128
|
+
const classes = useAvatarStyles({ ...props, loaded });
|
|
129
|
+
const displayAltTextFallback = src && alt;
|
|
130
|
+
const displayNoFallback = fallback === 'none';
|
|
131
|
+
const displayCustomFallback = fallback !== 'none' && typeof fallback !== 'undefined';
|
|
132
|
+
let Fallback;
|
|
129
133
|
if (displayAltTextFallback) {
|
|
130
134
|
Fallback = null;
|
|
131
135
|
}
|
|
@@ -138,7 +142,7 @@ var Avatar = React.forwardRef(function (props, ref) {
|
|
|
138
142
|
else {
|
|
139
143
|
Fallback = React.createElement(Icon, { icon: webIcons.User, className: classes.fallback });
|
|
140
144
|
}
|
|
141
|
-
return (React.createElement(core.Avatar,
|
|
145
|
+
return (React.createElement(core.Avatar, { ref: ref, classes: { root: classes.root }, src: src, alt: alt, ...muiProps, imgProps: imgProps }, children || Fallback));
|
|
142
146
|
});
|
|
143
147
|
Avatar.defaultProps = {
|
|
144
148
|
size: 'medium',
|
|
@@ -147,30 +151,29 @@ Avatar.defaultProps = {
|
|
|
147
151
|
};
|
|
148
152
|
Avatar.displayName = 'Avatar';
|
|
149
153
|
|
|
150
|
-
|
|
154
|
+
const useBrowserSilhouetteStyles = core.makeStyles((theme) => ({
|
|
151
155
|
circle: {
|
|
152
156
|
backgroundColor: theme.palette.grey[300],
|
|
153
157
|
borderRadius: '50%',
|
|
154
158
|
height: theme.spacing(0.65),
|
|
155
159
|
width: theme.spacing(0.65),
|
|
156
|
-
margin: theme.spacing(1)
|
|
160
|
+
margin: `${theme.spacing(1)}px 0 ${theme.spacing(1)}px ${theme.spacing(1)}px`,
|
|
157
161
|
},
|
|
158
162
|
container: {
|
|
159
|
-
border:
|
|
163
|
+
border: `1px solid ${theme.palette.secondary.light}`,
|
|
160
164
|
borderRadius: theme.spacing(0.5),
|
|
161
165
|
flexGrow: 1,
|
|
162
166
|
},
|
|
163
167
|
titleBar: {
|
|
164
168
|
display: 'flex',
|
|
165
169
|
flexDirection: 'row',
|
|
166
|
-
borderBottom:
|
|
170
|
+
borderBottom: `1px solid ${theme.palette.secondary.light}`,
|
|
167
171
|
width: '100%',
|
|
168
172
|
},
|
|
169
|
-
})
|
|
173
|
+
}));
|
|
170
174
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
var classes = useBrowserSilhouetteStyles();
|
|
175
|
+
const BrowserSilhouette = ({ children }) => {
|
|
176
|
+
const classes = useBrowserSilhouetteStyles();
|
|
174
177
|
return (React.createElement(core.Box, { display: "flex" },
|
|
175
178
|
React.createElement("div", { className: classes.container },
|
|
176
179
|
React.createElement("div", { className: classes.titleBar },
|
|
@@ -180,42 +183,40 @@ var BrowserSilhouette = function (_a) {
|
|
|
180
183
|
children)));
|
|
181
184
|
};
|
|
182
185
|
|
|
183
|
-
|
|
186
|
+
const useButtonStyles = core.makeStyles(() => ({
|
|
184
187
|
root: {
|
|
185
188
|
minWidth: 'unset',
|
|
186
189
|
},
|
|
187
190
|
label: {
|
|
188
|
-
textTransform:
|
|
189
|
-
var textTransform = _a.textTransform;
|
|
190
|
-
return textTransform;
|
|
191
|
-
},
|
|
191
|
+
textTransform: ({ textTransform }) => textTransform,
|
|
192
192
|
},
|
|
193
|
-
})
|
|
193
|
+
}));
|
|
194
194
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
const Button = (props) => {
|
|
196
|
+
const { textTransform, loading, classes: classesOverride, className, ButtonRef, ...muiProps } = props;
|
|
197
|
+
const { classes: remove, ...styleProps } = props;
|
|
198
|
+
const classes = useButtonStyles(styleProps);
|
|
199
|
+
const { typography } = core.useTheme();
|
|
200
|
+
const loadingIndicator = {
|
|
201
201
|
startIcon: React.createElement(core.CircularProgress, { color: "inherit", size: typography.button.fontSize }),
|
|
202
202
|
disabled: true,
|
|
203
203
|
};
|
|
204
|
-
return (React.createElement(core.Button,
|
|
204
|
+
return (React.createElement(core.Button, { ref: ButtonRef, classes: { ...classes, ...classesOverride }, className: classNames([className, 'pm-button']), ...muiProps, ...(loading && loadingIndicator) }));
|
|
205
205
|
};
|
|
206
206
|
Button.displayName = 'Button';
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
const Checkbox = React.forwardRef((props, ref) => {
|
|
209
|
+
const { disabled, LabelProps, ...muiProps } = props;
|
|
210
|
+
const label = LabelProps?.label || props.label;
|
|
211
|
+
const control = React.createElement(core.Checkbox, { disabled: label ? undefined : disabled, ...muiProps });
|
|
212
|
+
return label ? (React.createElement(core.FormControlLabel, { disabled: disabled, inputRef: ref, control: control, ...LabelProps, label: label })) : (control);
|
|
212
213
|
});
|
|
213
214
|
Checkbox.displayName = 'Checkbox';
|
|
214
215
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
const getBackground = (theme) => (props) => {
|
|
217
|
+
const { variant, severity } = props;
|
|
218
|
+
let background = theme.palette.grey[100];
|
|
219
|
+
const backgrounds = {
|
|
219
220
|
outlined: 'none',
|
|
220
221
|
error: 'error.main',
|
|
221
222
|
warning: 'warning.main',
|
|
@@ -226,17 +227,17 @@ var getBackground = function (theme) { return function (props) {
|
|
|
226
227
|
background = backgrounds[variant];
|
|
227
228
|
}
|
|
228
229
|
else if (severity) {
|
|
229
|
-
|
|
230
|
+
const [color, colorVariant] = backgrounds[severity].split('.');
|
|
230
231
|
// @ts-expect-error - todo.
|
|
231
232
|
background = theme.palette[color][colorVariant];
|
|
232
233
|
}
|
|
233
234
|
return background;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
};
|
|
236
|
+
const getColor = (theme) => (props) => {
|
|
237
|
+
const { variant, severity } = props;
|
|
238
|
+
let textColor;
|
|
238
239
|
if (variant === 'outlined' && severity) {
|
|
239
|
-
|
|
240
|
+
const textColors = {
|
|
240
241
|
error: theme.palette.error.main,
|
|
241
242
|
info: theme.palette.info.main,
|
|
242
243
|
warning: theme.palette.warning.dark,
|
|
@@ -248,7 +249,7 @@ var getColor = function (theme) { return function (props) {
|
|
|
248
249
|
textColor = theme.palette.grey[700];
|
|
249
250
|
}
|
|
250
251
|
else if ((variant === 'default' || variant === undefined) && severity) {
|
|
251
|
-
|
|
252
|
+
const textColors = {
|
|
252
253
|
error: theme.palette.common.white,
|
|
253
254
|
info: theme.palette.secondary.main,
|
|
254
255
|
warning: theme.palette.secondary.main,
|
|
@@ -257,12 +258,12 @@ var getColor = function (theme) { return function (props) {
|
|
|
257
258
|
textColor = textColors[severity];
|
|
258
259
|
}
|
|
259
260
|
return textColor;
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
261
|
+
};
|
|
262
|
+
const getBorder = (theme) => (props) => {
|
|
263
|
+
const { variant, severity } = props;
|
|
264
|
+
let borderColor;
|
|
264
265
|
if (variant === 'outlined' && severity) {
|
|
265
|
-
|
|
266
|
+
const borderColors = {
|
|
266
267
|
error: theme.palette.error.main,
|
|
267
268
|
info: theme.palette.info.main,
|
|
268
269
|
warning: theme.palette.warning.dark,
|
|
@@ -271,10 +272,10 @@ var getBorder = function (theme) { return function (props) {
|
|
|
271
272
|
borderColor = borderColors[severity];
|
|
272
273
|
}
|
|
273
274
|
return borderColor;
|
|
274
|
-
};
|
|
275
|
+
};
|
|
275
276
|
// using `any` here is a bit of cheating but it doesn't matter since this doesn't depend on
|
|
276
277
|
// any component-specific props
|
|
277
|
-
|
|
278
|
+
const useChipStyles = core.makeStyles((theme) => ({
|
|
278
279
|
root: {
|
|
279
280
|
background: getBackground(theme),
|
|
280
281
|
color: getColor(theme),
|
|
@@ -289,44 +290,44 @@ var useChipStyles = core.makeStyles(function (theme) { return ({
|
|
|
289
290
|
deleteIcon: {
|
|
290
291
|
color: theme.palette.grey[500],
|
|
291
292
|
},
|
|
292
|
-
})
|
|
293
|
+
}));
|
|
293
294
|
|
|
294
|
-
|
|
295
|
+
const IconDictionary = {
|
|
295
296
|
error: webIcons.Error,
|
|
296
297
|
info: webIcons.Info,
|
|
297
298
|
success: webIcons.CheckCircle,
|
|
298
299
|
warning: webIcons.Warning,
|
|
299
300
|
};
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
return React.createElement(core.Chip,
|
|
301
|
+
const Chip = (props) => {
|
|
302
|
+
const { severity, ...restProps } = props;
|
|
303
|
+
const classes = useChipStyles(props);
|
|
304
|
+
const icon = severity ? React.createElement(IconDictionary[severity]) : undefined;
|
|
305
|
+
const deleteIcon = React.createElement(webIcons.XCircle);
|
|
306
|
+
return React.createElement(core.Chip, { classes: classes, icon: icon, deleteIcon: deleteIcon, ...restProps });
|
|
306
307
|
};
|
|
307
308
|
Chip.displayName = 'Chip';
|
|
308
309
|
|
|
309
|
-
|
|
310
|
+
const weights = {
|
|
310
311
|
regular: 400,
|
|
311
312
|
medium: 500,
|
|
312
313
|
'semi-bold': 600,
|
|
313
314
|
bold: 700,
|
|
314
315
|
};
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
316
|
+
const getCustomColor = (theme, color) => {
|
|
317
|
+
const isCommonColor = color && ['white', 'black'].includes(color);
|
|
318
|
+
const isGreyColor = color && color.match(/^grey\.\d{3}/);
|
|
319
|
+
const isSemanticColor = color && color.match(/(primary|secondary|info|success|error|warning).?(light|dark)?/);
|
|
320
|
+
const isTextColor = color && ['textPrimary', 'textSecondary'].includes(color);
|
|
320
321
|
switch (true) {
|
|
321
322
|
case isCommonColor:
|
|
322
323
|
// @ts-expect-error - todo.
|
|
323
324
|
return theme.palette.common[color];
|
|
324
325
|
case Boolean(isGreyColor):
|
|
325
|
-
|
|
326
|
+
const scale = color.split('.')[1];
|
|
326
327
|
// @ts-expect-error - todo.
|
|
327
328
|
return theme.palette.grey[scale] || theme.palette.grey[900];
|
|
328
329
|
case Boolean(isSemanticColor):
|
|
329
|
-
|
|
330
|
+
const [paletteKey, variant = 'main'] = color.split('.');
|
|
330
331
|
// @ts-expect-error - todo.
|
|
331
332
|
return theme.palette[paletteKey][variant];
|
|
332
333
|
case isTextColor:
|
|
@@ -336,102 +337,82 @@ var getCustomColor = function (theme, color) {
|
|
|
336
337
|
return undefined;
|
|
337
338
|
}
|
|
338
339
|
};
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
padding: '0 0.125em',
|
|
347
|
-
boxSizing: 'content-box',
|
|
348
|
-
},
|
|
349
|
-
_a.fontFamily = theme.typography.fontFamily,
|
|
350
|
-
_a.fontWeight = function (_a) {
|
|
351
|
-
var variant = _a.variant, weight = _a.weight;
|
|
352
|
-
return (weight ? weights[weight] : theme.typography[variant].fontWeight);
|
|
353
|
-
},
|
|
354
|
-
_a.fontSize = function (_a) {
|
|
355
|
-
var variant = _a.variant;
|
|
356
|
-
return theme.typography[variant].fontSize;
|
|
357
|
-
},
|
|
358
|
-
_a.lineHeight = function (_a) {
|
|
359
|
-
var variant = _a.variant;
|
|
360
|
-
return theme.typography[variant].lineHeight;
|
|
361
|
-
},
|
|
362
|
-
_a.textTransform = function (_a) {
|
|
363
|
-
var variant = _a.variant;
|
|
364
|
-
return theme.typography[variant].textTransform;
|
|
365
|
-
},
|
|
366
|
-
_a.color = function (_a) {
|
|
367
|
-
var color = _a.color, variant = _a.variant;
|
|
368
|
-
return (color && getCustomColor(theme, color)) || theme.typography[variant].color;
|
|
369
|
-
},
|
|
370
|
-
_a),
|
|
371
|
-
caption: {
|
|
372
|
-
display: 'inline',
|
|
373
|
-
},
|
|
374
|
-
overline: {
|
|
375
|
-
display: 'inline',
|
|
340
|
+
const useTypographyStyles = core.makeStyles((theme) => ({
|
|
341
|
+
root: {
|
|
342
|
+
[`& .${iconStaticClassName}`]: {
|
|
343
|
+
position: 'relative',
|
|
344
|
+
top: '0.125em',
|
|
345
|
+
padding: '0 0.125em',
|
|
346
|
+
boxSizing: 'content-box',
|
|
376
347
|
},
|
|
377
|
-
|
|
378
|
-
})
|
|
348
|
+
fontFamily: theme.typography.fontFamily,
|
|
349
|
+
fontWeight: ({ variant, weight }) => (weight ? weights[weight] : theme.typography[variant].fontWeight),
|
|
350
|
+
fontSize: ({ variant }) => theme.typography[variant].fontSize,
|
|
351
|
+
lineHeight: ({ variant }) => theme.typography[variant].lineHeight,
|
|
352
|
+
textTransform: ({ variant }) => theme.typography[variant].textTransform,
|
|
353
|
+
color: ({ color, variant }) => (color && getCustomColor(theme, color)) || theme.typography[variant].color,
|
|
354
|
+
},
|
|
355
|
+
caption: {
|
|
356
|
+
display: 'inline',
|
|
357
|
+
},
|
|
358
|
+
overline: {
|
|
359
|
+
display: 'inline',
|
|
360
|
+
},
|
|
361
|
+
}));
|
|
379
362
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
return (React.createElement(core.Typography, tslib.__assign({ classes: classes, variant: variant, variantMapping: variantMapping, ref: TypographyRef }, restProps)));
|
|
363
|
+
const Typography = ({ TypographyRef, color, variant = 'body1', weight, ...restProps }) => {
|
|
364
|
+
const classes = useTypographyStyles({ color, variant, weight });
|
|
365
|
+
const variantMapping = { subtitle1: 'p' };
|
|
366
|
+
return (React.createElement(core.Typography, { classes: classes, variant: variant, variantMapping: variantMapping, ref: TypographyRef, ...restProps }));
|
|
385
367
|
};
|
|
386
368
|
Typography.displayName = 'Typography';
|
|
387
369
|
|
|
388
|
-
|
|
389
|
-
var typography = _a.typography;
|
|
370
|
+
const getFadeStop = ({ typography }, typographyVariant) => {
|
|
390
371
|
// @ts-expect-error - todo.
|
|
391
372
|
return !isNaN(Number(typography[typographyVariant].lineHeight))
|
|
392
373
|
? // @ts-expect-error - todo.
|
|
393
|
-
typography[typographyVariant].lineHeight
|
|
374
|
+
`${typography[typographyVariant].lineHeight}rem`
|
|
394
375
|
: // @ts-expect-error - todo.
|
|
395
376
|
typography[typographyVariant].lineHeight;
|
|
396
377
|
};
|
|
397
|
-
|
|
378
|
+
const useCollapsibleTextStyles = core.makeStyles((theme) => ({
|
|
398
379
|
overlay: {
|
|
399
380
|
position: 'absolute',
|
|
400
381
|
top: 0,
|
|
401
382
|
left: 0,
|
|
402
383
|
height: '100%',
|
|
403
384
|
width: '100%',
|
|
404
|
-
background:
|
|
385
|
+
background: (props) => `linear-gradient(to top, white, #FFF0 ${getFadeStop(theme, props.typographyVariant)})`,
|
|
405
386
|
},
|
|
406
|
-
})
|
|
387
|
+
}));
|
|
407
388
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
React.useEffect(
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
389
|
+
const CollapsibleText = (props) => {
|
|
390
|
+
const { text, open, previewLines = 2, typographyVariant = 'body1', collapseState: _exclude, ...restProps } = props;
|
|
391
|
+
const collapseState = React.useState(false);
|
|
392
|
+
const typographyRef = React.useRef(null);
|
|
393
|
+
const classes = useCollapsibleTextStyles({ ...props, previewLines, typographyVariant });
|
|
394
|
+
const theme = core.useTheme();
|
|
395
|
+
const [collapsible, setCollapsible] = props.collapseState ? props.collapseState : collapseState;
|
|
396
|
+
const typographyEntryLineHeightRem = parseFloat(theme.typography[typographyVariant].lineHeight);
|
|
397
|
+
const collapsedSizeRem = previewLines * typographyEntryLineHeightRem;
|
|
398
|
+
const documentFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
399
|
+
const collapsedSizePx = collapsedSizeRem * documentFontSize;
|
|
400
|
+
React.useEffect(() => {
|
|
401
|
+
const typographyNode = typographyRef.current;
|
|
402
|
+
const observer = new ResizeObserver((entries) => {
|
|
403
|
+
const typographyEntry = entries.find((entry) => entry.target === typographyNode);
|
|
423
404
|
if (typographyEntry) {
|
|
424
|
-
|
|
425
|
-
|
|
405
|
+
const typographyEntryHeight = typographyEntry.contentRect.height;
|
|
406
|
+
const isCollapsible = typographyEntryHeight > collapsedSizePx;
|
|
426
407
|
setCollapsible(isCollapsible);
|
|
427
408
|
}
|
|
428
409
|
});
|
|
429
410
|
observer.observe(typographyNode);
|
|
430
|
-
return
|
|
411
|
+
return () => {
|
|
431
412
|
observer.unobserve(typographyNode);
|
|
432
413
|
};
|
|
433
414
|
}, []);
|
|
434
|
-
return (React.createElement(core.Box,
|
|
415
|
+
return (React.createElement(core.Box, { position: "relative", overflow: "hidden", ...restProps },
|
|
435
416
|
React.createElement(core.Collapse, { in: open, collapsedSize: collapsedSizePx + 'px' },
|
|
436
417
|
React.createElement(Typography, { TypographyRef: typographyRef, variant: typographyVariant }, text)),
|
|
437
418
|
collapsible && !open && React.createElement(core.Box, { className: classes.overlay })));
|
|
@@ -446,15 +427,14 @@ var SemanticColors;
|
|
|
446
427
|
SemanticColors["SECONDARY_DARK"] = "secondary.dark";
|
|
447
428
|
SemanticColors["SECONDARY_LIGHT"] = "secondary.light";
|
|
448
429
|
})(SemanticColors || (SemanticColors = {}));
|
|
449
|
-
|
|
430
|
+
const useStyles$5 = core.makeStyles((theme) => ({
|
|
450
431
|
dividerRoot: {
|
|
451
432
|
gap: theme.spacing(2),
|
|
452
433
|
},
|
|
453
434
|
textRoot: {
|
|
454
|
-
color:
|
|
455
|
-
var textColor = _a.textColor;
|
|
435
|
+
color: ({ textColor }) => {
|
|
456
436
|
if (textColor && Object.values(SemanticColors).includes(textColor)) {
|
|
457
|
-
|
|
437
|
+
const [semanticColor, shade] = textColor.split('.');
|
|
458
438
|
// @ts-expect-error - todo.
|
|
459
439
|
return theme.palette[semanticColor][shade];
|
|
460
440
|
}
|
|
@@ -465,13 +445,12 @@ var useStyles$5 = core.makeStyles(function (theme) { return ({
|
|
|
465
445
|
return 'black';
|
|
466
446
|
}
|
|
467
447
|
},
|
|
468
|
-
textTransform:
|
|
448
|
+
textTransform: (props) => props.textTransform,
|
|
469
449
|
},
|
|
470
450
|
dividerLine: {
|
|
471
|
-
backgroundColor:
|
|
472
|
-
var dividerColor = _a.dividerColor;
|
|
451
|
+
backgroundColor: ({ dividerColor }) => {
|
|
473
452
|
if (dividerColor && Object.values(SemanticColors).includes(dividerColor)) {
|
|
474
|
-
|
|
453
|
+
const [semanticColor, shade] = dividerColor.split('.');
|
|
475
454
|
// @ts-expect-error - todo.
|
|
476
455
|
return theme.palette[semanticColor][shade];
|
|
477
456
|
}
|
|
@@ -483,52 +462,29 @@ var useStyles$5 = core.makeStyles(function (theme) { return ({
|
|
|
483
462
|
}
|
|
484
463
|
},
|
|
485
464
|
},
|
|
486
|
-
})
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
var casingOffset = textTransform === 'lowercase' ? '.25rem' : 'unset';
|
|
465
|
+
}));
|
|
466
|
+
const Divider = ({ TypographyProps, className, dividerColor, text, textColor, textTransform = 'lowercase', }) => {
|
|
467
|
+
const classes = useStyles$5({ dividerColor, textColor, textTransform });
|
|
468
|
+
const casingOffset = textTransform === 'lowercase' ? '.25rem' : 'unset';
|
|
491
469
|
return (React.createElement(core.Box, { className: classNames([classes.dividerRoot, className]), display: "flex", alignItems: "center" },
|
|
492
470
|
React.createElement(core.Box, { className: classes.dividerLine, display: "flex", flexGrow: 1, height: "1px", marginTop: casingOffset }),
|
|
493
471
|
text && (React.createElement(React.Fragment, null,
|
|
494
|
-
React.createElement(Typography,
|
|
472
|
+
React.createElement(Typography, { className: classes.textRoot, ...TypographyProps }, text),
|
|
495
473
|
React.createElement(core.Box, { className: classes.dividerLine, display: "flex", flexGrow: 1, height: "1px", marginTop: casingOffset })))));
|
|
496
474
|
};
|
|
497
475
|
Divider.displayName = 'Divider';
|
|
498
476
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
alignItems: 'center',
|
|
504
|
-
gridGap: 16,
|
|
505
|
-
},
|
|
506
|
-
}); });
|
|
507
|
-
var FollowerAuthenticationContent = function (props) {
|
|
508
|
-
var classes = useStyles$4();
|
|
509
|
-
return React.createElement(core.DialogContent, { classes: classes }, props.children);
|
|
510
|
-
};
|
|
511
|
-
|
|
512
|
-
var FollowerAuthenticationDialogContext = React.createContext(null);
|
|
513
|
-
var FollowerAuthenticationDialogContextProvider = FollowerAuthenticationDialogContext.Provider;
|
|
514
|
-
var useFollowerAuthenticationDialogContext = function () {
|
|
515
|
-
var context = React.useContext(FollowerAuthenticationDialogContext);
|
|
477
|
+
const FollowerAuthenticationDialogContext = React.createContext(null);
|
|
478
|
+
const FollowerAuthenticationDialogContextProvider = FollowerAuthenticationDialogContext.Provider;
|
|
479
|
+
const useFollowerAuthenticationDialogContext = () => {
|
|
480
|
+
const context = React.useContext(FollowerAuthenticationDialogContext);
|
|
516
481
|
if (!context) {
|
|
517
482
|
throw new Error('useFollowerAuthenticationDialogContext must be called within FollowerAuthenticationDialogContextProvider');
|
|
518
483
|
}
|
|
519
484
|
return context;
|
|
520
485
|
};
|
|
521
486
|
|
|
522
|
-
|
|
523
|
-
var _a = useFollowerAuthenticationDialogContext(), state = _a.state, messages = _a.messages, graphics = _a.graphics;
|
|
524
|
-
var graphic = graphics[state.value];
|
|
525
|
-
if (!graphic)
|
|
526
|
-
return null;
|
|
527
|
-
return (React.createElement(core.Box, null,
|
|
528
|
-
React.createElement("img", { src: graphic, alt: messages[state.value + "GraphicAlt"] })));
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
var useStyles$3 = core.makeStyles(function () { return ({
|
|
487
|
+
const useStyles$4 = core.makeStyles(() => ({
|
|
532
488
|
form: {
|
|
533
489
|
display: 'flex',
|
|
534
490
|
flexDirection: 'column',
|
|
@@ -536,38 +492,37 @@ var useStyles$3 = core.makeStyles(function () { return ({
|
|
|
536
492
|
width: '100%',
|
|
537
493
|
gridGap: 16,
|
|
538
494
|
},
|
|
539
|
-
})
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
495
|
+
}));
|
|
496
|
+
const northAmericanPhoneRegex = /^(\()?[2-9]{1}\d{2}(\))?[-\s.]?[2-9]{1}\d{2}[-\s.]?\d{4}$/;
|
|
497
|
+
const ukPhoneRegex = /^((\+?44\s?|0044\s?)(\s?\d{3,5}|\(\d{3,5}\))(\s?\d{3,4})(\s?\d{3,4})$|^07\d{9}$)/;
|
|
498
|
+
const validatePhoneNumber = (phone) => {
|
|
543
499
|
if (!phone)
|
|
544
500
|
return false;
|
|
545
501
|
return northAmericanPhoneRegex.test(phone) || ukPhoneRegex.test(phone);
|
|
546
502
|
};
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
503
|
+
const FollowerAuthenticationForm = () => {
|
|
504
|
+
const { state, messages, locationOptions, onActionButtonClick, loading } = useFollowerAuthenticationDialogContext();
|
|
505
|
+
const classes = useStyles$4();
|
|
550
506
|
// sign-up form state
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
var fieldValue = e.target.value;
|
|
507
|
+
const formRef = React.useRef(null);
|
|
508
|
+
const [formValidity, setFormValidity] = React.useState(false);
|
|
509
|
+
const [showPhoneErrorText, setShowPhoneErrorText] = React.useState();
|
|
510
|
+
const [showEmailErrorText, setShowEmailErrorText] = React.useState();
|
|
511
|
+
const [showLocationErrorText, setShowLocationErrorText] = React.useState();
|
|
512
|
+
const [signUpPhoneValue, setSignUpPhoneValue] = React.useState(state.context.phone || '');
|
|
513
|
+
const [signUpEmailValue, setSignUpEmailValue] = React.useState(state.context.email || '');
|
|
514
|
+
const checkFieldValidity = (e) => {
|
|
515
|
+
const fieldName = e.target.name;
|
|
516
|
+
const fieldValue = e.target.value;
|
|
562
517
|
switch (fieldName) {
|
|
563
518
|
case 'phone':
|
|
564
|
-
|
|
519
|
+
const isPhoneValid = validatePhoneNumber(fieldValue);
|
|
565
520
|
setSignUpPhoneValue(fieldValue);
|
|
566
521
|
setShowPhoneErrorText(!isPhoneValid && fieldValue.length > 0);
|
|
567
522
|
break;
|
|
568
523
|
case 'email':
|
|
569
|
-
|
|
570
|
-
|
|
524
|
+
const emailField = formRef.current?.elements.namedItem(fieldName);
|
|
525
|
+
const isEmailValid = emailField?.validity.valid ?? false;
|
|
571
526
|
setSignUpEmailValue(fieldValue);
|
|
572
527
|
setShowEmailErrorText(!isEmailValid && fieldValue.length > 0);
|
|
573
528
|
break;
|
|
@@ -576,52 +531,51 @@ var FollowerAuthenticationForm = function () {
|
|
|
576
531
|
break;
|
|
577
532
|
}
|
|
578
533
|
};
|
|
579
|
-
React.useEffect(
|
|
534
|
+
React.useEffect(() => {
|
|
580
535
|
setSignUpPhoneValue(state.context.phone || '');
|
|
581
536
|
setSignUpEmailValue(state.context.email || '');
|
|
582
537
|
}, [state.context.phone, state.context.email]);
|
|
583
|
-
React.useEffect(
|
|
584
|
-
var _a, _b, _c;
|
|
538
|
+
React.useEffect(() => {
|
|
585
539
|
// Validate pre-filled values (only in signUp state)
|
|
586
540
|
if (state.value === 'signUp') {
|
|
587
541
|
if (signUpPhoneValue) {
|
|
588
|
-
|
|
542
|
+
const isPhoneValid = validatePhoneNumber(signUpPhoneValue);
|
|
589
543
|
setShowPhoneErrorText(!isPhoneValid);
|
|
590
544
|
}
|
|
591
545
|
if (signUpEmailValue) {
|
|
592
|
-
|
|
593
|
-
|
|
546
|
+
const emailField = formRef.current?.elements.namedItem('email');
|
|
547
|
+
const isEmailValid = emailField?.validity.valid ?? false;
|
|
594
548
|
setShowEmailErrorText(!isEmailValid);
|
|
595
549
|
}
|
|
596
550
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
551
|
+
const hasValidPhone = Boolean(signUpPhoneValue) && !showPhoneErrorText;
|
|
552
|
+
const hasValidEmail = Boolean(signUpEmailValue) && !showEmailErrorText;
|
|
553
|
+
const locationField = formRef.current?.elements.namedItem('location');
|
|
554
|
+
const hasValidLocation = locationField ? Boolean(locationField.value) : true;
|
|
555
|
+
const hasValidContact = hasValidPhone || hasValidEmail;
|
|
602
556
|
setFormValidity(hasValidContact && hasValidLocation);
|
|
603
557
|
}, [state.value, signUpPhoneValue, signUpEmailValue, showPhoneErrorText, showEmailErrorText, showLocationErrorText]);
|
|
604
|
-
|
|
558
|
+
const handleSubmit = (e) => {
|
|
605
559
|
e.preventDefault();
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
560
|
+
const form = e.target;
|
|
561
|
+
const formData = new FormData(form);
|
|
562
|
+
const values = Object.fromEntries(formData.entries());
|
|
609
563
|
onActionButtonClick('submit-form', values);
|
|
610
564
|
};
|
|
611
|
-
|
|
565
|
+
const formProps = {
|
|
612
566
|
id: 'follower-authentication-form',
|
|
613
567
|
className: classes.form,
|
|
614
568
|
onSubmit: handleSubmit,
|
|
615
569
|
};
|
|
616
570
|
switch (state.value) {
|
|
617
571
|
case 'initial':
|
|
618
|
-
return (React.createElement("form",
|
|
572
|
+
return (React.createElement("form", { ...formProps },
|
|
619
573
|
React.createElement(core.TextField, { disabled: loading, label: messages.initialInputLabel, key: "identifier-input", id: "identifier-input", name: "identifier" }),
|
|
620
574
|
React.createElement(core.Button, { disabled: loading, type: "submit" }, messages.initialCtaButtonLabel)));
|
|
621
575
|
case 'signUp':
|
|
622
|
-
return (React.createElement("form",
|
|
576
|
+
return (React.createElement("form", { ref: formRef, ...formProps, onInvalid: (e) => {
|
|
623
577
|
e.preventDefault();
|
|
624
|
-
} }
|
|
578
|
+
} },
|
|
625
579
|
React.createElement(core.TextField, { disabled: loading, label: messages.signUpPhoneInputLabel, key: "phone-input", id: "phone-input", name: "phone", onChange: checkFieldValidity, error: showPhoneErrorText, helperText: showPhoneErrorText && messages.signUpPhoneErrorText, inputProps: {
|
|
626
580
|
required: signUpEmailValue ? false : true,
|
|
627
581
|
}, defaultValue: state.context.phone }),
|
|
@@ -630,27 +584,27 @@ var FollowerAuthenticationForm = function () {
|
|
|
630
584
|
required: signUpPhoneValue ? false : true,
|
|
631
585
|
type: 'email',
|
|
632
586
|
}, defaultValue: state.context.email }),
|
|
633
|
-
React.createElement(core.TextField, { disabled: loading, select: true, onChange: checkFieldValidity, label: messages.signUpLocationInputLabel, error: showLocationErrorText, helperText: showLocationErrorText && messages.signUpLocationErrorText, key: "location-input", id: "location-input", inputProps: { required: true }, name: "location" }, locationOptions.map(
|
|
587
|
+
React.createElement(core.TextField, { disabled: loading, select: true, onChange: checkFieldValidity, label: messages.signUpLocationInputLabel, error: showLocationErrorText, helperText: showLocationErrorText && messages.signUpLocationErrorText, key: "location-input", id: "location-input", inputProps: { required: true }, name: "location" }, locationOptions.map((locationOption) => (React.createElement(core.MenuItem, { "data-cy": 'option', key: locationOption.value, value: locationOption.value }, locationOption.label)))),
|
|
634
588
|
React.createElement(core.Typography, { style: { alignSelf: 'start' } }, messages.signUpBirthdaySectionLabel),
|
|
635
589
|
React.createElement(core.TextField, { disabled: loading, label: messages.signUpMonthInputLabel, key: "birthday-month-input", id: "birthday-month-input", name: "birthdayMonth" }),
|
|
636
590
|
React.createElement(core.TextField, { disabled: loading, label: messages.signUpDayInputLabel, key: "birthday-date-input", id: "birthday-date-input", name: "birthdayDate" }),
|
|
637
591
|
React.createElement(core.Button, { disabled: loading || !formValidity, type: "submit" }, messages.signUp)));
|
|
638
592
|
case 'emailFound':
|
|
639
|
-
return (React.createElement("form",
|
|
593
|
+
return (React.createElement("form", { ...formProps },
|
|
640
594
|
React.createElement(core.TextField, { disabled: loading, label: messages.emailFoundInputLabel, key: "email-input", id: "email-input", name: "email", value: state.context.email }),
|
|
641
595
|
React.createElement(core.Button, { disabled: loading, type: "submit" }, messages.emailFoundCtaButtonLabel)));
|
|
642
596
|
case 'emailAuthCode':
|
|
643
|
-
return (React.createElement("form",
|
|
597
|
+
return (React.createElement("form", { ...formProps },
|
|
644
598
|
React.createElement(core.TextField, { disabled: loading, label: messages.emailAuthCodeInputLabel, key: "code-input", id: "code-input", name: "code" }),
|
|
645
599
|
React.createElement(core.Button, { disabled: loading, type: "submit" }, messages.signIn)));
|
|
646
600
|
case 'indirectUserFound': {
|
|
647
601
|
if (state.context.email) {
|
|
648
|
-
return (React.createElement("form",
|
|
602
|
+
return (React.createElement("form", { ...formProps },
|
|
649
603
|
React.createElement(core.TextField, { disabled: loading, label: messages.emailFoundInputLabel, key: "email-input", id: "email-input", name: "email", value: state.context.email }),
|
|
650
604
|
React.createElement(core.Button, { disabled: loading, type: "submit" }, messages.indirectUserFoundCtaButtonLabel)));
|
|
651
605
|
}
|
|
652
606
|
else if (state.context.phone) {
|
|
653
|
-
return (React.createElement("form",
|
|
607
|
+
return (React.createElement("form", { ...formProps },
|
|
654
608
|
React.createElement(core.TextField, { disabled: loading, label: messages.phoneFoundInputLabel, key: "phone-input", id: "phone-input", name: "phone", value: state.context.phone }),
|
|
655
609
|
React.createElement(core.Button, { disabled: loading, type: "submit" }, messages.indirectUserFoundCtaButtonLabel)));
|
|
656
610
|
}
|
|
@@ -658,25 +612,25 @@ var FollowerAuthenticationForm = function () {
|
|
|
658
612
|
return null;
|
|
659
613
|
}
|
|
660
614
|
case 'emailPasswordSignIn':
|
|
661
|
-
return (React.createElement("form",
|
|
615
|
+
return (React.createElement("form", { ...formProps },
|
|
662
616
|
React.createElement(core.TextField, { disabled: loading, label: messages.emailFoundInputLabel, key: "email-input", id: "email-input", name: "email", value: state.context.email, InputLabelProps: { shrink: true } }),
|
|
663
617
|
React.createElement(core.TextField, { disabled: loading, label: messages.passwordInputLabel, key: "password-input", id: "password-input", name: "password", inputProps: { type: 'password' } }),
|
|
664
618
|
React.createElement(core.Button, { disabled: loading, type: "submit" }, messages.signIn)));
|
|
665
619
|
case 'phoneFound':
|
|
666
|
-
return (React.createElement("form",
|
|
620
|
+
return (React.createElement("form", { ...formProps },
|
|
667
621
|
React.createElement(core.TextField, { disabled: loading, label: messages.phoneFoundInputLabel, key: "phone-input", id: "phone-input", name: "phone", value: state.context.phone }),
|
|
668
622
|
React.createElement(core.Button, { disabled: loading, type: "submit" }, messages.phoneFoundCtaButtonLabel)));
|
|
669
623
|
case 'phoneAuthCode':
|
|
670
|
-
return (React.createElement("form",
|
|
624
|
+
return (React.createElement("form", { ...formProps },
|
|
671
625
|
React.createElement(core.TextField, { disabled: loading, label: messages.phoneAuthCodeInputLabel, key: "code-input", id: "code-input", name: "code", autoComplete: "one-time-code" }),
|
|
672
626
|
React.createElement(core.Button, { disabled: loading, type: "submit" }, messages.signIn)));
|
|
673
627
|
case 'phonePasswordSignIn':
|
|
674
|
-
return (React.createElement("form",
|
|
628
|
+
return (React.createElement("form", { ...formProps },
|
|
675
629
|
React.createElement(core.TextField, { disabled: loading, label: messages.phoneFoundInputLabel, key: "phone-input", id: "phone-input", name: "phone", value: state.context.phone, InputLabelProps: { shrink: true } }),
|
|
676
630
|
React.createElement(core.TextField, { disabled: loading, label: messages.passwordInputLabel, key: "password-input", id: "password-input", name: "password", inputProps: { type: 'password' } }),
|
|
677
631
|
React.createElement(core.Button, { disabled: loading, type: "submit" }, messages.signIn)));
|
|
678
632
|
case 'requirePhone':
|
|
679
|
-
return (React.createElement("form",
|
|
633
|
+
return (React.createElement("form", { ...formProps },
|
|
680
634
|
React.createElement(core.TextField, { disabled: loading, label: messages.requirePhoneInputLabel, key: "phone-input", id: "phone-input", name: "phone", value: state.context.phone }),
|
|
681
635
|
React.createElement(core.Button, { disabled: loading, type: "submit" }, messages.requirePhoneCtaButtonLabel)));
|
|
682
636
|
case 'welcome':
|
|
@@ -686,25 +640,25 @@ var FollowerAuthenticationForm = function () {
|
|
|
686
640
|
}
|
|
687
641
|
};
|
|
688
642
|
|
|
689
|
-
|
|
643
|
+
const useStyles$3 = core.makeStyles(() => ({
|
|
690
644
|
main: {
|
|
691
645
|
width: '100%',
|
|
692
646
|
display: 'flex',
|
|
693
647
|
flexDirection: 'column',
|
|
694
648
|
gridGap: 16,
|
|
695
649
|
},
|
|
696
|
-
})
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
650
|
+
}));
|
|
651
|
+
const FollowerAuthenticationAltActions = () => {
|
|
652
|
+
const { state, messages, logos, loading, onActionButtonClick } = useFollowerAuthenticationDialogContext();
|
|
653
|
+
const classes = useStyles$3();
|
|
700
654
|
switch (state.value) {
|
|
701
655
|
case 'initial':
|
|
702
656
|
return (React.createElement(core.Box, { className: classes.main },
|
|
703
657
|
React.createElement(core.Divider, null),
|
|
704
|
-
React.createElement(core.Button, { variant: "outlined", startIcon: logos.facebook, onClick:
|
|
658
|
+
React.createElement(core.Button, { variant: "outlined", startIcon: logos.facebook, onClick: () => {
|
|
705
659
|
onActionButtonClick('sign-in-with-facebook');
|
|
706
660
|
} }, messages.continueWithFacebookButtonLabel),
|
|
707
|
-
React.createElement(core.Button, { variant: "outlined", startIcon: logos.google, onClick:
|
|
661
|
+
React.createElement(core.Button, { variant: "outlined", startIcon: logos.google, onClick: () => {
|
|
708
662
|
onActionButtonClick('sign-in-with-google');
|
|
709
663
|
} }, messages.continueWithGoogleButtonLabel)));
|
|
710
664
|
case 'signUp':
|
|
@@ -712,53 +666,53 @@ var FollowerAuthenticationAltActions = function () {
|
|
|
712
666
|
case 'emailFound':
|
|
713
667
|
return (React.createElement(core.Box, { className: classes.main },
|
|
714
668
|
React.createElement(core.Divider, null),
|
|
715
|
-
React.createElement(core.Button, { variant: "outlined", onClick:
|
|
669
|
+
React.createElement(core.Button, { variant: "outlined", onClick: () => {
|
|
716
670
|
onActionButtonClick('sign-in-with-password');
|
|
717
671
|
} }, messages.signInWithPassword)));
|
|
718
672
|
case 'emailAuthCode':
|
|
719
673
|
return (React.createElement(core.Box, { className: classes.main },
|
|
720
|
-
React.createElement(core.Button, { disabled: loading, variant: "outlined", onClick:
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
674
|
+
React.createElement(core.Button, { disabled: loading, variant: "outlined", onClick: () => {
|
|
675
|
+
const form = document.querySelector('#follower-authentication-form');
|
|
676
|
+
const formData = new FormData(form);
|
|
677
|
+
const values = Object.fromEntries(formData.entries());
|
|
724
678
|
onActionButtonClick('request-auth-code-email', values);
|
|
725
679
|
} }, messages.resendAuthCode)));
|
|
726
680
|
case 'indirectUserFound':
|
|
727
681
|
return (React.createElement(core.Box, { className: classes.main },
|
|
728
682
|
React.createElement(core.Divider, null),
|
|
729
|
-
React.createElement(core.Button, { variant: "outlined", onClick:
|
|
683
|
+
React.createElement(core.Button, { variant: "outlined", onClick: () => {
|
|
730
684
|
onActionButtonClick('use-different-account');
|
|
731
685
|
} }, messages.indirectUserFoundCtaButtonLabelAlt)));
|
|
732
686
|
case 'emailPasswordSignIn':
|
|
733
687
|
return (React.createElement(core.Box, { className: classes.main },
|
|
734
688
|
React.createElement(core.Divider, null),
|
|
735
|
-
React.createElement(core.Button, { variant: "outlined", onClick:
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
689
|
+
React.createElement(core.Button, { variant: "outlined", onClick: () => {
|
|
690
|
+
const form = document.querySelector('#follower-authentication-form');
|
|
691
|
+
const formData = new FormData(form);
|
|
692
|
+
const values = Object.fromEntries(formData.entries());
|
|
739
693
|
onActionButtonClick('request-auth-code-email', values);
|
|
740
694
|
} }, messages.emailFoundCtaButtonLabel)));
|
|
741
695
|
case 'phoneFound':
|
|
742
696
|
return null;
|
|
743
697
|
case 'phoneAuthCode':
|
|
744
698
|
return (React.createElement(core.Box, { className: classes.main },
|
|
745
|
-
React.createElement(core.Button, { disabled: loading, variant: "outlined", onClick:
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
699
|
+
React.createElement(core.Button, { disabled: loading, variant: "outlined", onClick: () => {
|
|
700
|
+
const form = document.querySelector('#follower-authentication-form');
|
|
701
|
+
const formData = new FormData(form);
|
|
702
|
+
const values = Object.fromEntries(formData.entries());
|
|
749
703
|
onActionButtonClick('request-auth-code-sms', values);
|
|
750
704
|
} }, messages.resendAuthCode)));
|
|
751
705
|
case 'phonePasswordSignIn':
|
|
752
706
|
return (React.createElement(core.Box, { className: classes.main },
|
|
753
707
|
React.createElement(core.Divider, null),
|
|
754
|
-
React.createElement(core.Button, { variant: "outlined", onClick:
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
708
|
+
React.createElement(core.Button, { variant: "outlined", onClick: () => {
|
|
709
|
+
const form = document.querySelector('#follower-authentication-form');
|
|
710
|
+
const formData = new FormData(form);
|
|
711
|
+
const values = Object.fromEntries(formData.entries());
|
|
758
712
|
onActionButtonClick('request-auth-code-sms', values);
|
|
759
713
|
} }, messages.phoneFoundCtaButtonLabel)));
|
|
760
714
|
case 'welcome':
|
|
761
|
-
return (React.createElement(core.Button, { onClick:
|
|
715
|
+
return (React.createElement(core.Button, { onClick: () => {
|
|
762
716
|
onActionButtonClick('close');
|
|
763
717
|
} }, messages.done));
|
|
764
718
|
default:
|
|
@@ -766,53 +720,75 @@ var FollowerAuthenticationAltActions = function () {
|
|
|
766
720
|
}
|
|
767
721
|
};
|
|
768
722
|
|
|
769
|
-
|
|
723
|
+
const FollowerAuthenticationBody = () => {
|
|
770
724
|
return (React.createElement(React.Fragment, null,
|
|
771
725
|
React.createElement(FollowerAuthenticationForm, null),
|
|
772
726
|
React.createElement(FollowerAuthenticationAltActions, null)));
|
|
773
727
|
};
|
|
774
728
|
|
|
775
|
-
|
|
776
|
-
|
|
729
|
+
const useStyles$2 = core.makeStyles(() => ({
|
|
730
|
+
root: {
|
|
731
|
+
position: 'absolute',
|
|
732
|
+
top: 0,
|
|
733
|
+
right: 0,
|
|
734
|
+
},
|
|
735
|
+
}));
|
|
736
|
+
const FollowerAuthenticationCloseButton = () => {
|
|
737
|
+
const { messages, onActionButtonClick } = useFollowerAuthenticationDialogContext();
|
|
738
|
+
const classes = useStyles$2();
|
|
739
|
+
const handleClose = () => {
|
|
740
|
+
onActionButtonClick('close');
|
|
741
|
+
};
|
|
742
|
+
return (React.createElement(core.IconButton, { classes: classes, "aria-label": messages.closeButtonLabel, onClick: handleClose },
|
|
743
|
+
React.createElement(webIcons.X, null)));
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
const useStyles$1 = core.makeStyles(() => ({
|
|
747
|
+
root: {
|
|
748
|
+
display: 'flex',
|
|
749
|
+
flexDirection: 'column',
|
|
750
|
+
alignItems: 'center',
|
|
751
|
+
gridGap: 16,
|
|
752
|
+
},
|
|
753
|
+
}));
|
|
754
|
+
const FollowerAuthenticationContent = (props) => {
|
|
755
|
+
const classes = useStyles$1();
|
|
756
|
+
return React.createElement(core.DialogContent, { classes: classes }, props.children);
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
const FollowerAuthenticationFooter = () => {
|
|
760
|
+
const { messages, logos } = useFollowerAuthenticationDialogContext();
|
|
777
761
|
return (React.createElement(core.Box, { display: "flex", gridGap: 8 },
|
|
778
762
|
React.createElement(core.Typography, { variant: "body2" }, messages.poweredBy),
|
|
779
763
|
logos.popmenu));
|
|
780
764
|
};
|
|
781
765
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
766
|
+
const FollowerAuthenticationGraphic = () => {
|
|
767
|
+
const { state, messages, graphics } = useFollowerAuthenticationDialogContext();
|
|
768
|
+
const graphic = graphics[state.value];
|
|
769
|
+
if (!graphic)
|
|
770
|
+
return null;
|
|
785
771
|
return (React.createElement(core.Box, null,
|
|
786
|
-
React.createElement(
|
|
772
|
+
React.createElement("img", { src: graphic, alt: messages[`${state.value}GraphicAlt`] })));
|
|
787
773
|
};
|
|
788
774
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
775
|
+
const FollowerAuthenticationInfo = () => {
|
|
776
|
+
const { state, messages } = useFollowerAuthenticationDialogContext();
|
|
777
|
+
const info = messages[`${state.value}Info`];
|
|
792
778
|
if (!info)
|
|
793
779
|
return null;
|
|
794
780
|
return (React.createElement(core.Box, null,
|
|
795
781
|
React.createElement(core.Typography, { align: "center" }, info)));
|
|
796
782
|
};
|
|
797
783
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
},
|
|
804
|
-
}); });
|
|
805
|
-
var FollowerAuthenticationCloseButton = function () {
|
|
806
|
-
var _a = useFollowerAuthenticationDialogContext(), messages = _a.messages, onActionButtonClick = _a.onActionButtonClick;
|
|
807
|
-
var classes = useStyles$1();
|
|
808
|
-
var handleClose = function () {
|
|
809
|
-
onActionButtonClick('close');
|
|
810
|
-
};
|
|
811
|
-
return (React.createElement(core.IconButton, { classes: classes, "aria-label": messages.closeButtonLabel, onClick: handleClose },
|
|
812
|
-
React.createElement(webIcons.X, null)));
|
|
784
|
+
const FollowerAuthenticationTitle = () => {
|
|
785
|
+
const { state, messages } = useFollowerAuthenticationDialogContext();
|
|
786
|
+
const title = messages[`${state.value}Title`];
|
|
787
|
+
return (React.createElement(core.Box, null,
|
|
788
|
+
React.createElement(core.Typography, { variant: "h1", align: "center" }, title)));
|
|
813
789
|
};
|
|
814
790
|
|
|
815
|
-
|
|
791
|
+
const theme = {
|
|
816
792
|
palette: {
|
|
817
793
|
primary: { main: '#2E3042' },
|
|
818
794
|
},
|
|
@@ -846,14 +822,11 @@ var theme = {
|
|
|
846
822
|
},
|
|
847
823
|
};
|
|
848
824
|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
return breakpoints.down('sm');
|
|
855
|
-
});
|
|
856
|
-
var handleClose = function () {
|
|
825
|
+
const FollowerAuthenticationDialog = (props) => {
|
|
826
|
+
const { open, ...restProps } = props;
|
|
827
|
+
const theme$1 = core.createTheme(theme);
|
|
828
|
+
const fullScreen = core.useMediaQuery((theme) => theme.breakpoints.down('sm'));
|
|
829
|
+
const handleClose = () => {
|
|
857
830
|
restProps.onActionButtonClick('close');
|
|
858
831
|
};
|
|
859
832
|
return (React.createElement(core.ThemeProvider, { theme: theme$1 },
|
|
@@ -868,40 +841,41 @@ var FollowerAuthenticationDialog = function (props) {
|
|
|
868
841
|
React.createElement(FollowerAuthenticationFooter, null))))));
|
|
869
842
|
};
|
|
870
843
|
|
|
871
|
-
|
|
872
|
-
return React.createElement(core.IconButton,
|
|
844
|
+
const IconButton = React.forwardRef((props, ref) => {
|
|
845
|
+
return React.createElement(core.IconButton, { ref: ref, ...props });
|
|
873
846
|
});
|
|
874
847
|
IconButton.displayName = 'IconButton';
|
|
875
848
|
IconButton.defaultProps = {
|
|
876
849
|
color: 'secondary',
|
|
877
850
|
};
|
|
878
851
|
|
|
879
|
-
|
|
880
|
-
root:
|
|
881
|
-
|
|
882
|
-
|
|
852
|
+
const useLinkStyles = core.makeStyles((theme) => ({
|
|
853
|
+
root: (props) => ({
|
|
854
|
+
display: 'flex',
|
|
855
|
+
...(props.color === undefined && { color: theme.palette.info.main }),
|
|
856
|
+
[`& .${iconStaticClassName}`]: {
|
|
883
857
|
alignSelf: 'center',
|
|
884
|
-
},
|
|
885
|
-
},
|
|
886
|
-
})
|
|
858
|
+
},
|
|
859
|
+
}),
|
|
860
|
+
}));
|
|
887
861
|
|
|
888
862
|
// eslint-disable-next-line react/display-name -- false positive
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
return (React.createElement(core.Link,
|
|
863
|
+
const Link = React.forwardRef((props, ref) => {
|
|
864
|
+
const { children, ...muiProps } = props;
|
|
865
|
+
const classes = useLinkStyles(props);
|
|
866
|
+
return (React.createElement(core.Link, { ref: ref, classes: { root: classes.root }, ...muiProps }, children));
|
|
893
867
|
});
|
|
894
868
|
Link.defaultProps = {
|
|
895
869
|
variant: 'body1',
|
|
896
870
|
};
|
|
897
871
|
Link.displayName = 'Link';
|
|
898
872
|
|
|
899
|
-
|
|
873
|
+
const useNumberFieldStyles = core.makeStyles(() => ({
|
|
900
874
|
root: {
|
|
901
875
|
height: 56,
|
|
902
876
|
},
|
|
903
|
-
})
|
|
904
|
-
|
|
877
|
+
}));
|
|
878
|
+
const useNumberInputStyles = core.makeStyles((theme) => ({
|
|
905
879
|
root: {
|
|
906
880
|
height: '100%',
|
|
907
881
|
width: 'min-content',
|
|
@@ -922,55 +896,59 @@ var useNumberInputStyles = core.makeStyles(function (theme) { return ({
|
|
|
922
896
|
adornedEnd: {
|
|
923
897
|
padding: 0,
|
|
924
898
|
},
|
|
925
|
-
})
|
|
899
|
+
}));
|
|
926
900
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
return (React.createElement(core.TextField,
|
|
933
|
-
|
|
934
|
-
|
|
901
|
+
const NumberField = (props) => {
|
|
902
|
+
const { onIncrement, onDecrement, endAdornmentButtonProps = {}, startAdornmentButtonProps = {}, InputProps = {}, classes, ...restProps } = props;
|
|
903
|
+
const { classes: inputClassesOverride, ...restInputProps } = InputProps;
|
|
904
|
+
const fieldClasses = useNumberFieldStyles(props);
|
|
905
|
+
const inputClasses = useNumberInputStyles(props);
|
|
906
|
+
return (React.createElement(core.TextField, { classes: { ...fieldClasses, ...classes }, variant: "filled", type: "number", defaultValue: 0, InputProps: {
|
|
907
|
+
classes: { ...inputClasses, ...inputClassesOverride },
|
|
908
|
+
disableUnderline: true,
|
|
909
|
+
endAdornment: (React.createElement(IconButton, { style: { fontSize: 20 }, onClick: onIncrement, ...endAdornmentButtonProps },
|
|
910
|
+
React.createElement(Icon, { icon: webIcons.PlusCircle }))),
|
|
911
|
+
startAdornment: (React.createElement(IconButton, { style: { fontSize: 20 }, onClick: onDecrement, ...startAdornmentButtonProps },
|
|
912
|
+
React.createElement(Icon, { icon: webIcons.MinusCircle }))),
|
|
913
|
+
...restInputProps,
|
|
914
|
+
}, ...restProps }));
|
|
935
915
|
};
|
|
936
916
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
'&:last-child': {
|
|
942
|
-
marginBottom: 0,
|
|
943
|
-
},
|
|
944
|
-
marginBottom: spacing(4),
|
|
945
|
-
padding: spacing(4),
|
|
917
|
+
const useStyles = core.makeStyles(({ spacing }) => ({
|
|
918
|
+
root: {
|
|
919
|
+
'&:last-child': {
|
|
920
|
+
marginBottom: 0,
|
|
946
921
|
},
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
922
|
+
marginBottom: spacing(4),
|
|
923
|
+
padding: spacing(4),
|
|
924
|
+
},
|
|
925
|
+
}));
|
|
926
|
+
const Paper = React.forwardRef((props, ref) => {
|
|
927
|
+
const { legacyStyles, ...restProps } = props;
|
|
928
|
+
const classes = useStyles(props);
|
|
929
|
+
return React.createElement(core.Paper, { ...ref, classes: { ...(legacyStyles && classes) }, ...restProps });
|
|
953
930
|
});
|
|
954
931
|
Paper.displayName = 'Paper';
|
|
955
932
|
Paper.defaultProps = {
|
|
956
933
|
legacyStyles: false,
|
|
957
934
|
};
|
|
958
935
|
|
|
959
|
-
|
|
960
|
-
|
|
936
|
+
const PaperContent = (props) => {
|
|
937
|
+
const { children } = props;
|
|
961
938
|
return React.createElement(core.Box, { padding: 4 }, children);
|
|
962
939
|
};
|
|
963
940
|
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
941
|
+
const Radio = React.forwardRef((props, ref) => {
|
|
942
|
+
const { disabled, LabelProps, ...muiProps } = props;
|
|
943
|
+
const label = LabelProps?.label || props.label;
|
|
944
|
+
const control = React.createElement(core.Radio, { disabled: label ? undefined : disabled, ...muiProps });
|
|
945
|
+
return label ? (React.createElement(core.FormControlLabel, { disabled: disabled, inputRef: ref, control: control, ...LabelProps, label: label })) : (control);
|
|
968
946
|
});
|
|
969
947
|
Radio.displayName = 'Radio';
|
|
970
948
|
|
|
971
|
-
|
|
949
|
+
const useSplitInputStyles = core.makeStyles(() => ({
|
|
972
950
|
textfield: {
|
|
973
|
-
background:
|
|
951
|
+
background: (props) => (props.backgroundTransparency ? '#FFFFFF44' : 'none'),
|
|
974
952
|
borderTopLeftRadius: 4,
|
|
975
953
|
borderBottomLeftRadius: 4,
|
|
976
954
|
'& fieldset': {
|
|
@@ -985,24 +963,23 @@ var useSplitInputStyles = core.makeStyles(function () { return ({
|
|
|
985
963
|
alignSelf: 'stretch',
|
|
986
964
|
},
|
|
987
965
|
input: {
|
|
988
|
-
color:
|
|
966
|
+
color: (props) => props.inputTextColor || 'inherit',
|
|
989
967
|
'&$focused fieldset': {
|
|
990
968
|
top: -4,
|
|
991
969
|
},
|
|
992
970
|
},
|
|
993
971
|
focused: {},
|
|
994
|
-
})
|
|
972
|
+
}));
|
|
995
973
|
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
var classes = useSplitInputStyles({ backgroundTransparency: backgroundTransparency, inputTextColor: inputTextColor });
|
|
974
|
+
const SplitInput = ({ ButtonProps, TextFieldProps, backgroundTransparency = true, buttonLabel, color = 'primary', inputTextColor, onChange, onClick, }) => {
|
|
975
|
+
const classes = useSplitInputStyles({ backgroundTransparency, inputTextColor });
|
|
999
976
|
return (React.createElement(core.Box, { display: "flex" },
|
|
1000
|
-
React.createElement(core.TextField,
|
|
1001
|
-
React.createElement(Button,
|
|
977
|
+
React.createElement(core.TextField, { classes: { root: classes.textfield }, InputProps: { classes: { root: classes.input, focused: classes.focused } }, color: color, variant: "outlined", onChange: onChange, ...TextFieldProps }),
|
|
978
|
+
React.createElement(Button, { classes: { root: classes.button }, disableElevation: true, color: color, variant: "contained", onClick: onClick, ...ButtonProps }, buttonLabel)));
|
|
1002
979
|
};
|
|
1003
980
|
SplitInput.displayName = 'SplitInput';
|
|
1004
981
|
|
|
1005
|
-
|
|
982
|
+
const useSwitchStyles = core.makeStyles((theme) => ({
|
|
1006
983
|
checked: {
|
|
1007
984
|
'& $thumb': {
|
|
1008
985
|
background: theme.palette.success.main,
|
|
@@ -1013,115 +990,113 @@ var useSwitchStyles = core.makeStyles(function (theme) { return ({
|
|
|
1013
990
|
},
|
|
1014
991
|
thumb: {},
|
|
1015
992
|
track: {},
|
|
1016
|
-
})
|
|
993
|
+
}));
|
|
1017
994
|
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
995
|
+
const Switch = React.forwardRef((props, ref) => {
|
|
996
|
+
const { disabled, LabelProps, ...muiProps } = props;
|
|
997
|
+
const label = LabelProps?.label || props.label;
|
|
998
|
+
const classes = useSwitchStyles(props);
|
|
999
|
+
const control = React.createElement(core.Switch, { classes: classes, disabled: label ? undefined : disabled, ...muiProps });
|
|
1000
|
+
return label ? (React.createElement(core.FormControlLabel, { disabled: disabled, inputRef: ref, control: control, ...LabelProps, label: label })) : (control);
|
|
1023
1001
|
});
|
|
1024
1002
|
Switch.displayName = 'Switch';
|
|
1025
1003
|
|
|
1026
|
-
|
|
1027
|
-
|
|
1004
|
+
const TabPanel = (props) => {
|
|
1005
|
+
const { children, show } = props;
|
|
1028
1006
|
return show ? React.createElement(core.Box, null, children) : null;
|
|
1029
1007
|
};
|
|
1030
1008
|
|
|
1031
|
-
|
|
1009
|
+
const useToggleButtonStyles = core.makeStyles((theme) => ({
|
|
1032
1010
|
root: {
|
|
1033
1011
|
color: theme.palette.text.primary,
|
|
1034
1012
|
},
|
|
1035
1013
|
selected: {
|
|
1036
1014
|
'&&': {
|
|
1037
1015
|
'&:hover': {
|
|
1038
|
-
backgroundColor:
|
|
1016
|
+
backgroundColor: (props) => theme.palette[props.color || 'primary'].dark,
|
|
1039
1017
|
},
|
|
1040
|
-
backgroundColor:
|
|
1018
|
+
backgroundColor: (props) => theme.palette[props.color || 'primary'].main,
|
|
1041
1019
|
color: 'white',
|
|
1042
1020
|
},
|
|
1043
1021
|
},
|
|
1044
|
-
})
|
|
1022
|
+
}));
|
|
1045
1023
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
return (React.createElement(lab.ToggleButton,
|
|
1024
|
+
const ToggleButton = React.forwardRef((props, ref) => {
|
|
1025
|
+
const { children, ...muiProps } = props;
|
|
1026
|
+
const classes = useToggleButtonStyles(props);
|
|
1027
|
+
return (React.createElement(lab.ToggleButton, { ref: ref, classes: {
|
|
1050
1028
|
root: classes.root,
|
|
1051
1029
|
selected: classes.selected,
|
|
1052
|
-
}
|
|
1030
|
+
}, ...muiProps }, children));
|
|
1053
1031
|
});
|
|
1054
1032
|
ToggleButton.defaultProps = {
|
|
1055
1033
|
color: 'primary',
|
|
1056
1034
|
};
|
|
1057
1035
|
ToggleButton.displayName = 'ToggleButton';
|
|
1058
1036
|
|
|
1059
|
-
|
|
1037
|
+
const useToggleButtonGroupStyles = core.makeStyles((theme) => ({
|
|
1060
1038
|
root: {
|
|
1061
1039
|
'&&': {
|
|
1062
1040
|
backgroundColor: theme.palette.grey[300],
|
|
1063
1041
|
},
|
|
1064
1042
|
},
|
|
1065
|
-
})
|
|
1043
|
+
}));
|
|
1066
1044
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1045
|
+
const ToggleButtonGroup = React.forwardRef((props, ref) => {
|
|
1046
|
+
const { children, color = 'primary', ...muiProps } = props;
|
|
1047
|
+
const classes = useToggleButtonGroupStyles(props);
|
|
1048
|
+
const childrenWithProps = React.Children.map(children, (child) => {
|
|
1071
1049
|
if (!React.isValidElement(child)) {
|
|
1072
1050
|
return null;
|
|
1073
1051
|
}
|
|
1074
|
-
return React.cloneElement(child, { color
|
|
1052
|
+
return React.cloneElement(child, { color });
|
|
1075
1053
|
});
|
|
1076
|
-
return (React.createElement(lab.ToggleButtonGroup,
|
|
1054
|
+
return (React.createElement(lab.ToggleButtonGroup, { ref: ref, classes: { root: classes.root }, ...muiProps }, childrenWithProps));
|
|
1077
1055
|
});
|
|
1078
1056
|
ToggleButtonGroup.displayName = 'ToggleButtonGroup';
|
|
1079
1057
|
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
},
|
|
1086
|
-
});
|
|
1087
|
-
});
|
|
1058
|
+
const useTooltipStyles = core.makeStyles(({ typography }) => ({
|
|
1059
|
+
tooltip: {
|
|
1060
|
+
fontSize: typography.pxToRem(16),
|
|
1061
|
+
},
|
|
1062
|
+
}));
|
|
1088
1063
|
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
return React.createElement(core.Tooltip,
|
|
1064
|
+
const Tooltip = React.forwardRef((props, ref) => {
|
|
1065
|
+
const classes = useTooltipStyles(props);
|
|
1066
|
+
return React.createElement(core.Tooltip, { ref: ref, classes: classes, ...props });
|
|
1092
1067
|
});
|
|
1093
1068
|
Tooltip.displayName = 'Tooltip';
|
|
1094
1069
|
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1070
|
+
const useCollapsibleText = () => {
|
|
1071
|
+
const [open, setOpen] = React.useState(false);
|
|
1072
|
+
const collapseState = React.useState(false);
|
|
1073
|
+
const toggle = () => collapseState[0] && setOpen(!open);
|
|
1099
1074
|
return {
|
|
1100
1075
|
collapsibleText: {
|
|
1101
|
-
open
|
|
1102
|
-
collapseState
|
|
1076
|
+
open,
|
|
1077
|
+
collapseState,
|
|
1103
1078
|
},
|
|
1104
|
-
toggle
|
|
1079
|
+
toggle,
|
|
1105
1080
|
};
|
|
1106
1081
|
};
|
|
1107
1082
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1083
|
+
const useTabs = (options) => {
|
|
1084
|
+
const { initialTab } = options;
|
|
1085
|
+
const genTabId = (id) => `tab-${id}`.toLowerCase().replace(/ /g, '-');
|
|
1086
|
+
const genPanelId = (id) => `tab-panel-${id}`.toLowerCase().replace(/ /g, '-');
|
|
1087
|
+
const [activeTab, setActiveTab] = React.useState(genTabId(initialTab));
|
|
1088
|
+
const handleChange = (_, nextTab) => setActiveTab(nextTab);
|
|
1089
|
+
const TabsProps = { onChange: handleChange, value: activeTab };
|
|
1090
|
+
const useTab = (baseId) => {
|
|
1091
|
+
const tabId = genTabId(baseId);
|
|
1092
|
+
const tabPanelId = genPanelId(baseId);
|
|
1093
|
+
const tabProps = {
|
|
1119
1094
|
id: tabId,
|
|
1120
1095
|
label: baseId,
|
|
1121
1096
|
value: tabId,
|
|
1122
1097
|
'aria-controls': tabPanelId,
|
|
1123
1098
|
};
|
|
1124
|
-
|
|
1099
|
+
const panelProps = {
|
|
1125
1100
|
id: tabPanelId,
|
|
1126
1101
|
role: 'tabpanel',
|
|
1127
1102
|
show: activeTab === tabId,
|
|
@@ -1130,9 +1105,9 @@ var useTabs = function (options) {
|
|
|
1130
1105
|
return [tabProps, panelProps];
|
|
1131
1106
|
};
|
|
1132
1107
|
return {
|
|
1133
|
-
TabsProps
|
|
1134
|
-
useTab
|
|
1135
|
-
setActiveTab:
|
|
1108
|
+
TabsProps,
|
|
1109
|
+
useTab,
|
|
1110
|
+
setActiveTab: (tabId) => setActiveTab(tabId),
|
|
1136
1111
|
};
|
|
1137
1112
|
};
|
|
1138
1113
|
|