@dtdot/lego 2.0.0-14 → 2.0.0-16
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/components/ActionMenu/ActionMenu.component.d.ts +4 -4
- package/build/components/ActionMenu/ActionMenu.component.js +2 -2
- package/build/components/ActionMenu/_ActionMenuCheckbox.component.d.ts +2 -2
- package/build/components/ActionMenu/_ActionMenuCheckbox.component.js +2 -2
- package/build/components/ActionMenu/_ActionMenuItem.component.d.ts +2 -2
- package/build/components/ActionMenu/_ActionMenuItem.component.js +2 -2
- package/build/components/ActionMenu/_ActionMenuPanel.component.js +1 -1
- package/build/components/ActionMessage/ActionMessage.component.js +1 -1
- package/build/components/Alert/Alert.component.js +3 -3
- package/build/components/Badge/Badge.component.js +1 -1
- package/build/components/BadgeSelector/BadgeSelector.component.js +1 -1
- package/build/components/Button/Button.component.d.ts +1 -1
- package/build/components/Button/Button.component.js +3 -3
- package/build/components/Card/Card.component.js +1 -1
- package/build/components/Checklist/Checklist.component.js +1 -1
- package/build/components/Checklist/_ChecklistItem.component.js +1 -1
- package/build/components/FancyCheckbox/FancyCheckbox.component.js +1 -1
- package/build/components/Form/_NestedFormArray.js +0 -2
- package/build/components/ImageUpload/ImageUpload.component.d.ts +2 -2
- package/build/components/ImageUpload/ImageUpload.component.js +10 -10
- package/build/components/InlineCard/InlineCard.component.js +1 -1
- package/build/components/Input/Input.component.d.ts +1 -1
- package/build/components/Input/Input.component.js +5 -5
- package/build/components/LiveInput/LiveInput.component.d.ts +2 -2
- package/build/components/LiveInput/LiveInput.component.js +2 -2
- package/build/components/LiveList/LiveList.component.js +2 -2
- package/build/components/LiveList/_LiveListRow.js +3 -3
- package/build/components/Loader/Loader.component.js +1 -1
- package/build/components/Menu/_MenuHeading.component.js +2 -2
- package/build/components/Menu/_MenuItem.component.js +1 -1
- package/build/components/Menu/_MenuPanel.component.js +1 -1
- package/build/components/MinimalMenu/MinimalMenu.component.d.ts +1 -1
- package/build/components/MinimalMenu/_MinimalMenuItem.component.d.ts +2 -2
- package/build/components/MinimalMenu/_MinimalMenuItem.component.js +3 -3
- package/build/components/MinimalMenu/desktop/_DesktopMinimalMenuItem.component.d.ts +2 -2
- package/build/components/MinimalMenu/desktop/_DesktopMinimalMenuItem.component.js +2 -2
- package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.d.ts +2 -2
- package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.js +2 -2
- package/build/components/Modal/Modal.component.js +1 -1
- package/build/components/Modal/_ModalHeader.component.js +2 -2
- package/build/components/Notification/Notification.component.js +1 -1
- package/build/components/ProfileImage/ProfileImage.component.js +2 -2
- package/build/components/QrCode/QrCode.component.js +2 -2
- package/build/components/Select/Select.component.d.ts +1 -1
- package/build/components/Select/Select.component.js +2 -2
- package/build/components/SquareButton/SquareButton.component.d.ts +2 -2
- package/build/components/SquareButton/SquareButton.component.js +2 -2
- package/build/components/Table/Table.component.d.ts +3 -3
- package/build/components/Table/_TableAction.d.ts +2 -2
- package/build/components/Table/_TableAction.js +2 -2
- package/build/components/Table/_TableActionMenu.d.ts +2 -2
- package/build/components/Table/_TableActionMenu.js +2 -2
- package/build/components/Table/_TableRow.component.d.ts +2 -2
- package/build/components/Table/_TableRow.component.js +2 -2
- package/build/components/TextArea/TextArea.component.d.ts +1 -1
- package/build/components/TextArea/TextArea.component.js +5 -5
- package/build/components/common/Options.component.js +3 -2
- package/build/screens/Login/Login.screen.js +4 -4
- package/build/screens/Register/Register.screen.js +3 -3
- package/build/screens/Verification/Verification.screen.js +2 -2
- package/package.json +1 -1
|
@@ -8,11 +8,11 @@ export interface ActionMenuProps {
|
|
|
8
8
|
'size'?: ButtonSize;
|
|
9
9
|
'icon'?: IconProp;
|
|
10
10
|
'text'?: string;
|
|
11
|
-
'data-
|
|
11
|
+
'data-testid'?: string;
|
|
12
12
|
}
|
|
13
13
|
declare const ActionMenu: {
|
|
14
|
-
({ children, variant, size, icon, text, "data-
|
|
15
|
-
Item: ({ children, onClick, "data-
|
|
16
|
-
Checkbox: ({ children, checked, onClick, "data-
|
|
14
|
+
({ children, variant, size, icon, text, "data-testid": dataTestId }: ActionMenuProps): JSX.Element;
|
|
15
|
+
Item: ({ children, onClick, "data-testid": dataTestId }: import("./_ActionMenuItem.component").ActionMenuItemProps) => JSX.Element;
|
|
16
|
+
Checkbox: ({ children, checked, onClick, "data-testid": dataTestId }: import("./_ActionMenuCheckbox.component").ActionMenuCheckboxProps) => JSX.Element;
|
|
17
17
|
};
|
|
18
18
|
export default ActionMenu;
|
|
@@ -8,7 +8,7 @@ import ActionMenuCheckbox from './_ActionMenuCheckbox.component';
|
|
|
8
8
|
import ActionMenuItem from './_ActionMenuItem.component';
|
|
9
9
|
import ActionMenuPanel from './_ActionMenuPanel.component';
|
|
10
10
|
const offsetFn = () => [70, 4];
|
|
11
|
-
const ActionMenu = ({ children, variant, size, icon, text, 'data-
|
|
11
|
+
const ActionMenu = ({ children, variant, size, icon, text, 'data-testid': dataTestId }) => {
|
|
12
12
|
const [shown, setShown] = useState(false);
|
|
13
13
|
const [referenceElement, setReferenceElement] = useState();
|
|
14
14
|
const [popperElement, setPopperElement] = useState();
|
|
@@ -34,7 +34,7 @@ const ActionMenu = ({ children, variant, size, icon, text, 'data-cy': dataCy })
|
|
|
34
34
|
};
|
|
35
35
|
}, [handleGlobalClick, popperElement]);
|
|
36
36
|
return (React.createElement(React.Fragment, null,
|
|
37
|
-
React.createElement(Button, { variant: variant, size: size, icon: icon || faEllipsisV, "data-
|
|
37
|
+
React.createElement(Button, { variant: variant, size: size, icon: icon || faEllipsisV, "data-testid": dataTestId || 'action-menu-button', ref: setReferenceElement, onClick: () => setShown(true) }, text),
|
|
38
38
|
shown &&
|
|
39
39
|
ReactDOM.createPortal(React.createElement("div", { ref: setPopperElement, style: { ...styles.popper, zIndex: 999 }, ...attributes.popper },
|
|
40
40
|
React.createElement(ActionMenuContext.Provider, { value: { closeActionMenu: () => setShown(false) } },
|
|
@@ -3,7 +3,7 @@ export interface ActionMenuCheckboxProps {
|
|
|
3
3
|
'children': React.ReactNode;
|
|
4
4
|
'checked': boolean;
|
|
5
5
|
'onClick': () => void;
|
|
6
|
-
'data-
|
|
6
|
+
'data-testid'?: string;
|
|
7
7
|
}
|
|
8
|
-
declare const ActionMenuCheckbox: ({ children, checked, onClick, "data-
|
|
8
|
+
declare const ActionMenuCheckbox: ({ children, checked, onClick, "data-testid": dataTestId }: ActionMenuCheckboxProps) => JSX.Element;
|
|
9
9
|
export default ActionMenuCheckbox;
|
|
@@ -19,10 +19,10 @@ const ActionMenuCheckboxOuter = styled(motion.div) `
|
|
|
19
19
|
const Spacer = styled.div `
|
|
20
20
|
width: 16px;
|
|
21
21
|
`;
|
|
22
|
-
const ActionMenuCheckbox = ({ children, checked, onClick, 'data-
|
|
22
|
+
const ActionMenuCheckbox = ({ children, checked, onClick, 'data-testid': dataTestId }) => {
|
|
23
23
|
const theme = useTheme();
|
|
24
24
|
return (React.createElement(React.Fragment, null,
|
|
25
|
-
React.createElement(ActionMenuCheckboxOuter, { style: { backgroundColor: theme.colours.tertiary.main }, whileHover: { backgroundColor: theme.colours.tertiary.hover }, onClick: onClick, "data-
|
|
25
|
+
React.createElement(ActionMenuCheckboxOuter, { style: { backgroundColor: theme.colours.tertiary.main }, whileHover: { backgroundColor: theme.colours.tertiary.hover }, onClick: onClick, "data-testid": dataTestId || 'action-menu-checkbox' },
|
|
26
26
|
children,
|
|
27
27
|
React.createElement(Spacer, null),
|
|
28
28
|
React.createElement(Checkmark, { checked: checked, large: false }))));
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
export interface ActionMenuItemProps {
|
|
3
3
|
'children': React.ReactNode;
|
|
4
4
|
'onClick': () => void;
|
|
5
|
-
'data-
|
|
5
|
+
'data-testid'?: string;
|
|
6
6
|
}
|
|
7
|
-
declare const ActionMenuItem: ({ children, onClick, "data-
|
|
7
|
+
declare const ActionMenuItem: ({ children, onClick, "data-testid": dataTestId }: ActionMenuItemProps) => JSX.Element;
|
|
8
8
|
export default ActionMenuItem;
|
|
@@ -15,7 +15,7 @@ const ActionMenuItemOuter = styled(motion.div) `
|
|
|
15
15
|
font-size: ${(props) => props.theme.fonts.default.size};
|
|
16
16
|
font-weight: ${(props) => props.theme.fonts.default.weight};
|
|
17
17
|
`;
|
|
18
|
-
const ActionMenuItem = ({ children, onClick, 'data-
|
|
18
|
+
const ActionMenuItem = ({ children, onClick, 'data-testid': dataTestId }) => {
|
|
19
19
|
const theme = useTheme();
|
|
20
20
|
const { closeActionMenu } = useContext(ActionMenuContext);
|
|
21
21
|
const handleClick = () => {
|
|
@@ -23,6 +23,6 @@ const ActionMenuItem = ({ children, onClick, 'data-cy': dataCy }) => {
|
|
|
23
23
|
closeActionMenu();
|
|
24
24
|
};
|
|
25
25
|
return (React.createElement(React.Fragment, null,
|
|
26
|
-
React.createElement(ActionMenuItemOuter, { style: { backgroundColor: theme.colours.tertiary.main }, whileHover: { backgroundColor: theme.colours.tertiary.hover }, onClick: handleClick, "data-
|
|
26
|
+
React.createElement(ActionMenuItemOuter, { style: { backgroundColor: theme.colours.tertiary.main }, whileHover: { backgroundColor: theme.colours.tertiary.hover }, onClick: handleClick, "data-testid": dataTestId || 'action-menu-item' }, children)));
|
|
27
27
|
};
|
|
28
28
|
export default ActionMenuItem;
|
|
@@ -4,5 +4,5 @@ const ActionMenuPanelOuter = styled.div `
|
|
|
4
4
|
background-color: ${(props) => props.theme.colours.tertiary.main};
|
|
5
5
|
min-width: 160px;
|
|
6
6
|
`;
|
|
7
|
-
const ActionMenuPanel = ({ children }) => (React.createElement(ActionMenuPanelOuter, { "data-
|
|
7
|
+
const ActionMenuPanel = ({ children }) => (React.createElement(ActionMenuPanelOuter, { "data-testid": 'action-menu-popover' }, children));
|
|
8
8
|
export default ActionMenuPanel;
|
|
@@ -14,7 +14,7 @@ const ActionMessageContainer = styled.div `
|
|
|
14
14
|
}
|
|
15
15
|
`;
|
|
16
16
|
const ActionMessage = ({ header, info, action, onAction }) => {
|
|
17
|
-
return (React.createElement(ActionMessageContainer, { "data-
|
|
17
|
+
return (React.createElement(ActionMessageContainer, { "data-testid": 'action-message' },
|
|
18
18
|
React.createElement("div", null,
|
|
19
19
|
React.createElement(Heading.SubHeading, null, header)),
|
|
20
20
|
info && (React.createElement(React.Fragment, null,
|
|
@@ -46,9 +46,9 @@ const CountContainer = styled.div `
|
|
|
46
46
|
const Alert = ({ variant, message, count, action, onAction }) => {
|
|
47
47
|
const theme = useTheme();
|
|
48
48
|
const colour = getThemeStatusColour(variant, theme).main;
|
|
49
|
-
return (React.createElement(AlertContainer, { colour: colour, "data-
|
|
50
|
-
React.createElement(MessageContainer, { "data-
|
|
51
|
-
action && (React.createElement(ActionContainer, { onClick: onAction, "data-
|
|
49
|
+
return (React.createElement(AlertContainer, { colour: colour, "data-testid": 'alert' },
|
|
50
|
+
React.createElement(MessageContainer, { "data-testid": 'alert-message' }, message),
|
|
51
|
+
action && (React.createElement(ActionContainer, { onClick: onAction, "data-testid": 'alert-action' }, action)),
|
|
52
52
|
count && count > 1 && React.createElement(CountContainer, { colour: colour }, count)));
|
|
53
53
|
};
|
|
54
54
|
export default Alert;
|
|
@@ -30,7 +30,7 @@ const ActionSpan = styled.span `
|
|
|
30
30
|
font-size: ${(props) => props.theme.fonts.default.size};
|
|
31
31
|
`;
|
|
32
32
|
const Badge = ({ children, variant, actionIcon, onAction }) => {
|
|
33
|
-
return (React.createElement(BadgeSpan, { variant: variant, useHover: !!actionIcon, "data-
|
|
33
|
+
return (React.createElement(BadgeSpan, { variant: variant, useHover: !!actionIcon, "data-testid": 'badge' },
|
|
34
34
|
children,
|
|
35
35
|
actionIcon && (React.createElement(ActionSpan, { onClick: onAction },
|
|
36
36
|
React.createElement(FontAwesomeIcon, { icon: actionIcon })))));
|
|
@@ -24,6 +24,6 @@ const BadgeSelector = ({ options, value, onChange }) => {
|
|
|
24
24
|
const handleClick = (_value) => {
|
|
25
25
|
onChange([_value]);
|
|
26
26
|
};
|
|
27
|
-
return (React.createElement(BadgeSelectorOuter, { "data-
|
|
27
|
+
return (React.createElement(BadgeSelectorOuter, { "data-testid": 'badge-selector' }, options.map((option) => (React.createElement(InteractiveBadge, { useHover: false, key: option.value, variant: option.variant, inactive: !value.includes(option.value), onClick: () => handleClick(option.value), "data-testid": value.includes(option.value) ? 'badge-selected' : 'badge' }, option.name)))));
|
|
28
28
|
};
|
|
29
29
|
export default BadgeSelector;
|
|
@@ -10,7 +10,7 @@ export interface ButtonProps {
|
|
|
10
10
|
'type'?: 'submit' | 'button';
|
|
11
11
|
'icon'?: IconProp;
|
|
12
12
|
'onClick'?: () => void;
|
|
13
|
-
'data-
|
|
13
|
+
'data-testid'?: string;
|
|
14
14
|
}
|
|
15
15
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<unknown>>;
|
|
16
16
|
export default Button;
|
|
@@ -110,10 +110,10 @@ const ButtonSpinner = styled.div `
|
|
|
110
110
|
}
|
|
111
111
|
`;
|
|
112
112
|
const Button = React.forwardRef(function Button(props, ref) {
|
|
113
|
-
const { children, loading, variant = 'primary', size = 'md', type = 'button', icon, onClick, 'data-
|
|
113
|
+
const { children, loading, variant = 'primary', size = 'md', type = 'button', icon, onClick, 'data-testid': dataTestId, } = props;
|
|
114
114
|
const { width, height, alignSelf, marginTop, noBackground } = useContext(ButtonContext);
|
|
115
|
-
return (React.createElement(StyledButton, { ref: ref, width: width, height: height, alignSelf: alignSelf, marginTop: marginTop, noBackground: noBackground, variant: variant, size: size, type: type, onClick: onClick, "data-
|
|
116
|
-
React.createElement(ButtonSpinner, { "data-
|
|
115
|
+
return (React.createElement(StyledButton, { ref: ref, width: width, height: height, alignSelf: alignSelf, marginTop: marginTop, noBackground: noBackground, variant: variant, size: size, type: type, onClick: onClick, "data-testid": dataTestId || 'button', iconOnly: !children }, loading ? (React.createElement(SpinnerContainer, null,
|
|
116
|
+
React.createElement(ButtonSpinner, { "data-testid": 'button-loading-spinner', variant: variant, size: size, iconOnly: !children }))) : (React.createElement(ButtonInner, null,
|
|
117
117
|
children && React.createElement(ButtonTextContainer, { size: size }, children),
|
|
118
118
|
icon && (React.createElement(IconOuter, { noBackground: noBackground, variant: variant, size: size, height: height, iconOnly: !children },
|
|
119
119
|
React.createElement(FontAwesomeIcon, { icon: icon })))))));
|
|
@@ -94,7 +94,7 @@ const Card = ({ children, padded, size = 'sm', onClick }) => {
|
|
|
94
94
|
scale: 1.005,
|
|
95
95
|
boxShadow: theme.shadows.xlarge,
|
|
96
96
|
}
|
|
97
|
-
: {}, size: size, padded: padded, onClick: handleClick, usePointer: !!onClick, "data-
|
|
97
|
+
: {}, size: size, padded: padded, onClick: handleClick, usePointer: !!onClick, "data-testid": 'card' },
|
|
98
98
|
React.createElement(CardActionsContainer, { ref: actionsRef }),
|
|
99
99
|
React.createElement(CardInner, null, children))));
|
|
100
100
|
};
|
|
@@ -35,7 +35,7 @@ const Checklist = ({ items, value, onChange, noSplitGap, large }) => {
|
|
|
35
35
|
.filter((item) => value.includes(item.id))
|
|
36
36
|
.sort((a, b) => checkedOrder.indexOf(a.id) - checkedOrder.indexOf(b.id));
|
|
37
37
|
const unCheckedItems = items.filter((item) => !value.includes(item.id));
|
|
38
|
-
return (React.createElement(LayoutGroup, { "data-
|
|
38
|
+
return (React.createElement(LayoutGroup, { "data-testid": 'checklist' },
|
|
39
39
|
unCheckedItems.map((item) => (React.createElement(motion.div, { layoutId: item.id, key: item.id },
|
|
40
40
|
React.createElement(ChecklistItem, { label: item.label, value: value.includes(item.id), onChange: (checked) => handleChange(item.id, checked), large: !!large })))),
|
|
41
41
|
checkedItems.length && !noSplitGap ? React.createElement(ListDivider, null) : null,
|
|
@@ -50,7 +50,7 @@ const ChecklistItem = ({ label, value, onChange, large }) => {
|
|
|
50
50
|
onChange(false);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
return (React.createElement(Outerlabel, { checked: value, whileHover: { backgroundColor: theme.colours.cardBackground }, "data-
|
|
53
|
+
return (React.createElement(Outerlabel, { checked: value, whileHover: { backgroundColor: theme.colours.cardBackground }, "data-testid": value ? 'checklist-item-checked' : 'checklist-item' },
|
|
54
54
|
React.createElement(Checkmark, { checked: value, large: large }),
|
|
55
55
|
React.createElement(Spacer, null),
|
|
56
56
|
label,
|
|
@@ -48,6 +48,6 @@ const FancyCheckbox = ({ name, label, options, value, onChange }) => {
|
|
|
48
48
|
const selectedValue = value || contextValue;
|
|
49
49
|
return (React.createElement("div", null,
|
|
50
50
|
label && React.createElement(FancyCheckboxLabel, { htmlFor: name }, label),
|
|
51
|
-
React.createElement(ButtonGroup, { "data-
|
|
51
|
+
React.createElement(ButtonGroup, { "data-testid": 'checkbox-group' }, options.map((option) => (React.createElement(StyledButton, { selected: option.value === selectedValue, key: option.value, onClick: () => handleChange(option.value), "data-testid": option.value === selectedValue ? 'checkbox-selected' : 'checkbox' }, option.label))))));
|
|
52
52
|
};
|
|
53
53
|
export default FancyCheckbox;
|
|
@@ -7,12 +7,10 @@ const NestedFormArray = ({ name, index, children }) => {
|
|
|
7
7
|
const safeError = Array.from(Array(Math.max(index + 1, value?.length || 0))).map((_, i) => error?.[i] || {});
|
|
8
8
|
const nestedValue = safeValue[index];
|
|
9
9
|
const nestedErrors = safeError[index];
|
|
10
|
-
console.log('safe', safeValue);
|
|
11
10
|
const onChangeFn = (key, fieldValue) => {
|
|
12
11
|
const newValue = [
|
|
13
12
|
...safeValue.map((item, i) => (i === index ? { ...item, [key]: fieldValue } : item)),
|
|
14
13
|
];
|
|
15
|
-
console.log(newValue);
|
|
16
14
|
onChange && onChange(newValue);
|
|
17
15
|
};
|
|
18
16
|
const contextValue = {
|
|
@@ -8,7 +8,7 @@ interface ImageUploadProps {
|
|
|
8
8
|
'onChange'?: (value: string) => void;
|
|
9
9
|
'onSearch'?: () => void;
|
|
10
10
|
'uploadFn'?: (file: File) => Promise<string>;
|
|
11
|
-
'data-
|
|
11
|
+
'data-testid'?: string;
|
|
12
12
|
}
|
|
13
|
-
declare const ImageUpload: ({ name, value, "error": propsError, "uploading": uploadingProp, onChange, onSearch, "data-
|
|
13
|
+
declare const ImageUpload: ({ name, value, "error": propsError, "uploading": uploadingProp, onChange, onSearch, "data-testid": dataTestId, }: ImageUploadProps) => JSX.Element;
|
|
14
14
|
export default ImageUpload;
|
|
@@ -94,7 +94,7 @@ const ErrorInner = styled.div `
|
|
|
94
94
|
const errorVariants = {
|
|
95
95
|
show: { opacity: 1 },
|
|
96
96
|
};
|
|
97
|
-
const ImageUpload = ({ name, value, 'error': propsError, 'uploading': uploadingProp, onChange, onSearch, 'data-
|
|
97
|
+
const ImageUpload = ({ name, value, 'error': propsError, 'uploading': uploadingProp, onChange, onSearch, 'data-testid': dataTestId, }) => {
|
|
98
98
|
const { upload, getUrl } = useContext(FileContext);
|
|
99
99
|
const [uploading, setUploading] = useState(false);
|
|
100
100
|
const { value: contextValue, error: contextError, onChange: contextOnChange } = useFormNode(name);
|
|
@@ -125,26 +125,26 @@ const ImageUpload = ({ name, value, 'error': propsError, 'uploading': uploadingP
|
|
|
125
125
|
};
|
|
126
126
|
const internalValue = value ? value : contextValue;
|
|
127
127
|
if (uploading || uploadingProp) {
|
|
128
|
-
return (React.createElement(UploadContainer, { "data-
|
|
128
|
+
return (React.createElement(UploadContainer, { "data-testid": dataTestId },
|
|
129
129
|
React.createElement(LoaderContainer, null,
|
|
130
130
|
React.createElement(Loader, null))));
|
|
131
131
|
}
|
|
132
132
|
if (!internalValue) {
|
|
133
|
-
return (React.createElement(UploadContainer, { "data-
|
|
133
|
+
return (React.createElement(UploadContainer, { "data-testid": dataTestId },
|
|
134
134
|
React.createElement(UploadInnerContainer, null,
|
|
135
|
-
React.createElement(IconContainer, { whileHover: { scale: 1.05 }, onClick: handleUploadClicked, "data-
|
|
135
|
+
React.createElement(IconContainer, { whileHover: { scale: 1.05 }, onClick: handleUploadClicked, "data-testid": 'button-image-upload' },
|
|
136
136
|
React.createElement(FontAwesomeIcon, { icon: faCloudUploadAlt })),
|
|
137
137
|
onSearch && (React.createElement(React.Fragment, null,
|
|
138
138
|
React.createElement(UploadVerticalDivider, null),
|
|
139
|
-
React.createElement(IconContainer, { whileHover: { scale: 1.05 }, onClick: onSearch, "data-
|
|
139
|
+
React.createElement(IconContainer, { whileHover: { scale: 1.05 }, onClick: onSearch, "data-testid": 'button-image-search' },
|
|
140
140
|
React.createElement(FontAwesomeIcon, { icon: faSearch }))))),
|
|
141
|
-
React.createElement(HiddenInput, { value: '', ref: inputRef, type: 'file', onChange: handleUpload, "data-
|
|
142
|
-
error && (React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 }, "data-
|
|
141
|
+
React.createElement(HiddenInput, { value: '', ref: inputRef, type: 'file', onChange: handleUpload, "data-testid": 'input-image-hidden' }),
|
|
142
|
+
error && (React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 }, "data-testid": 'error-indicator' },
|
|
143
143
|
React.createElement(ErrorInner, null,
|
|
144
144
|
React.createElement(FontAwesomeIcon, { icon: faExclamationCircle })),
|
|
145
|
-
React.createElement(ErrorMessage, { "data-
|
|
145
|
+
React.createElement(ErrorMessage, { "data-testid": 'error-message' }, error)))));
|
|
146
146
|
}
|
|
147
|
-
return (React.createElement("div", { "data-
|
|
148
|
-
React.createElement(Image, { "data-
|
|
147
|
+
return (React.createElement("div", { "data-testid": dataTestId },
|
|
148
|
+
React.createElement(Image, { "data-testid": 'uploaded-image', src: getUrl(internalValue) })));
|
|
149
149
|
};
|
|
150
150
|
export default ImageUpload;
|
|
@@ -136,7 +136,7 @@ const InlineCard = ({ children, size, value, onClick, gestureLeftIcon, gestureLe
|
|
|
136
136
|
};
|
|
137
137
|
return (React.createElement(CardWrapper, { size: size },
|
|
138
138
|
React.createElement(CardActionBackground, { style: { opacity, backgroundColor: gestureLeftTheme.main } }, gestureLeftIcon && (React.createElement(FontAwesomeIcon, { style: { fontSize: '20px', color: gestureLeftTheme.contrast }, icon: gestureLeftIcon }))),
|
|
139
|
-
React.createElement(CardOuter, { drag: onGestureLeft ? 'x' : undefined, onDragEnd: handleDragEnd, ref: ref, style: { x }, animate: { x: gestureLeftActivated ? -bounds.width : undefined, opacity: gestureLeftActivated ? 0 : undefined }, dragConstraints: { left: 0, right: 0 }, usePointer: !!onClick || isSelectable, onClick: handleClick, "data-
|
|
139
|
+
React.createElement(CardOuter, { drag: onGestureLeft ? 'x' : undefined, onDragEnd: handleDragEnd, ref: ref, style: { x }, animate: { x: gestureLeftActivated ? -bounds.width : undefined, opacity: gestureLeftActivated ? 0 : undefined }, dragConstraints: { left: 0, right: 0 }, usePointer: !!onClick || isSelectable, onClick: handleClick, "data-testid": 'inline-card' }, children),
|
|
140
140
|
isSelectable && isSelected ? (React.createElement(SelectChecked, null,
|
|
141
141
|
React.createElement(SelectIconContainer, null,
|
|
142
142
|
React.createElement(FontAwesomeIcon, { icon: faCheck })))) : null));
|
|
@@ -13,7 +13,7 @@ export interface IInputProps {
|
|
|
13
13
|
'onChange'?: (value: any) => void;
|
|
14
14
|
'onFocus'?: () => void;
|
|
15
15
|
'onBlur'?: () => void;
|
|
16
|
-
'data-
|
|
16
|
+
'data-testid'?: string;
|
|
17
17
|
'suggestions'?: SelectOption[];
|
|
18
18
|
}
|
|
19
19
|
declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -63,7 +63,7 @@ const messageVariants = {
|
|
|
63
63
|
errorFocus: { opacity: 1, y: -4 },
|
|
64
64
|
};
|
|
65
65
|
const Input = React.forwardRef(function ForwardRefInput(props, ref) {
|
|
66
|
-
const { label, name, description, placeholder, disabled, type = 'text', autoFocus, value, 'error': propsError, onChange, onFocus, onBlur, 'data-
|
|
66
|
+
const { label, name, description, placeholder, disabled, type = 'text', autoFocus, value, 'error': propsError, onChange, onFocus, onBlur, 'data-testid': dataTestId, suggestions, } = props;
|
|
67
67
|
const [isOpen, setIsOpen] = useState(false);
|
|
68
68
|
const [isFocused, setIsFocused] = useState(false);
|
|
69
69
|
const [referenceElement, setReferenceElement] = useState();
|
|
@@ -106,12 +106,12 @@ const Input = React.forwardRef(function ForwardRefInput(props, ref) {
|
|
|
106
106
|
const filteredOptions = suggestions?.filter((option) => !value || option.label.toLowerCase().includes(value.toLowerCase()));
|
|
107
107
|
return (React.createElement("div", null,
|
|
108
108
|
label && React.createElement(ControlLabel, { htmlFor: name }, label),
|
|
109
|
-
React.createElement(InputContainer, { "data-
|
|
110
|
-
React.createElement(StyledInput, { ref: ref, animate: animationVariant, variants: inputVariants, transition: { type: 'spring', duration: 0.3 }, type: type, name: name, placeholder: placeholder, disabled: disabled, value: getValue(value, contextValue), onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onClick: handleClick, autoFocus: autoFocus, "data-
|
|
111
|
-
React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 }, "data-
|
|
109
|
+
React.createElement(InputContainer, { "data-testid": dataTestId, ref: setReferenceElement },
|
|
110
|
+
React.createElement(StyledInput, { ref: ref, animate: animationVariant, variants: inputVariants, transition: { type: 'spring', duration: 0.3 }, type: type, name: name, placeholder: placeholder, disabled: disabled, value: getValue(value, contextValue), onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onClick: handleClick, autoFocus: autoFocus, "data-testid": 'input' }),
|
|
111
|
+
React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 }, "data-testid": 'error-indicator' },
|
|
112
112
|
React.createElement(ErrorInner, null,
|
|
113
113
|
React.createElement(FontAwesomeIcon, { icon: faExclamationCircle }))),
|
|
114
|
-
error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, animate: animationVariant, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-
|
|
114
|
+
error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, animate: animationVariant, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-testid": 'error-message' }, error))),
|
|
115
115
|
splitDescription && (React.createElement(ControlDescription, null, splitDescription.map((line, index) => (React.createElement(React.Fragment, null,
|
|
116
116
|
index !== 0 && React.createElement("br", null),
|
|
117
117
|
line))))),
|
|
@@ -5,7 +5,7 @@ interface LiveInputProps {
|
|
|
5
5
|
'type'?: string;
|
|
6
6
|
'value'?: string;
|
|
7
7
|
'onChange'?: (value: string) => void;
|
|
8
|
-
'data-
|
|
8
|
+
'data-testid'?: string;
|
|
9
9
|
}
|
|
10
|
-
declare const LiveInput: ({ name, type, placeholder, value, onChange, "data-
|
|
10
|
+
declare const LiveInput: ({ name, type, placeholder, value, onChange, "data-testid": dataTestId, }: LiveInputProps) => JSX.Element;
|
|
11
11
|
export default LiveInput;
|
|
@@ -14,7 +14,7 @@ const StyledInput = styled.input `
|
|
|
14
14
|
color: ${(props) => props.theme.colours.controlPlaceholder};
|
|
15
15
|
}
|
|
16
16
|
`;
|
|
17
|
-
const LiveInput = ({ name, type = 'text', placeholder, value, onChange, 'data-
|
|
17
|
+
const LiveInput = ({ name, type = 'text', placeholder, value, onChange, 'data-testid': dataTestId, }) => {
|
|
18
18
|
const { value: contextValue, onChange: contextOnChange } = useFormNode(name);
|
|
19
19
|
const handleChange = (e) => {
|
|
20
20
|
if (onChange) {
|
|
@@ -25,6 +25,6 @@ const LiveInput = ({ name, type = 'text', placeholder, value, onChange, 'data-cy
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
return (React.createElement("div", null,
|
|
28
|
-
React.createElement(StyledInput, { name: name, type: type, value: value || contextValue, placeholder: placeholder, onChange: handleChange, "data-
|
|
28
|
+
React.createElement(StyledInput, { name: name, type: type, value: value || contextValue, placeholder: placeholder, onChange: handleChange, "data-testid": dataTestId || 'live-input' })));
|
|
29
29
|
};
|
|
30
30
|
export default LiveInput;
|
|
@@ -100,10 +100,10 @@ const LiveList = ({ value: inputValue, name, onChange: propsOnChange }) => {
|
|
|
100
100
|
if (!value?.length) {
|
|
101
101
|
return null;
|
|
102
102
|
}
|
|
103
|
-
return (React.createElement("div", { "data-
|
|
103
|
+
return (React.createElement("div", { "data-testid": 'live-list' },
|
|
104
104
|
value.map((val) => (React.createElement(LiveListRow, { key: val.id, id: val.id, value: val.value, error: contextError ? contextError[val.id] : undefined, onChange: (newVal) => handleRowChange(val.id, newVal), onRemove: () => handleRowRemove(val.id) }))),
|
|
105
105
|
React.createElement(AddRow, null,
|
|
106
|
-
React.createElement(AddRowInner, { style: { scale: 1 }, whileHover: 'hover', variants: addVariants, onClick: handleRowAdd, "data-
|
|
106
|
+
React.createElement(AddRowInner, { style: { scale: 1 }, whileHover: 'hover', variants: addVariants, onClick: handleRowAdd, "data-testid": 'button-add-list-item' },
|
|
107
107
|
React.createElement(IconContainer, null,
|
|
108
108
|
React.createElement(FontAwesomeIcon, { icon: faPlusCircle })),
|
|
109
109
|
"add"))));
|
|
@@ -59,10 +59,10 @@ const LiveListRow = ({ id, value, error, onChange, onRemove }) => {
|
|
|
59
59
|
setIsFocused(false);
|
|
60
60
|
onBlur(id);
|
|
61
61
|
};
|
|
62
|
-
return (React.createElement(InputContainer, { whileHover: 'hover', "data-
|
|
63
|
-
React.createElement(Input, { onFocus: handleFocus, onBlur: handleBlur, ref: inputRef, value: value || '', error: error, onChange: handleChange, "data-
|
|
62
|
+
return (React.createElement(InputContainer, { whileHover: 'hover', "data-testid": 'live-list-row' },
|
|
63
|
+
React.createElement(Input, { onFocus: handleFocus, onBlur: handleBlur, ref: inputRef, value: value || '', error: error, onChange: handleChange, "data-testid": 'live-list-input' }),
|
|
64
64
|
React.createElement(RemoveContainer, { animate: isFocused ? 'focus' : undefined, style: { opacity: 0 }, variants: removeVariants, transition: { type: 'spring', duration: 0.3 } },
|
|
65
|
-
React.createElement(RemoveInner, { onClick: onRemove, "data-
|
|
65
|
+
React.createElement(RemoveInner, { onClick: onRemove, "data-testid": 'live-list-remove' },
|
|
66
66
|
React.createElement(FontAwesomeIcon, { icon: faTimes })))));
|
|
67
67
|
};
|
|
68
68
|
export default LiveListRow;
|
|
@@ -47,7 +47,7 @@ const loadingCircleTransition = {
|
|
|
47
47
|
repeatType: 'reverse',
|
|
48
48
|
ease: 'easeInOut',
|
|
49
49
|
}; // Framer motion isn't accepting 'repeatType' but animation breaks without it
|
|
50
|
-
const BaseLoader = () => (React.createElement(motion.div, { style: loadingContainer, variants: loadingContainerVariants, initial: 'start', animate: 'end', "data-
|
|
50
|
+
const BaseLoader = () => (React.createElement(motion.div, { style: loadingContainer, variants: loadingContainerVariants, initial: 'start', animate: 'end', "data-testid": 'loader' },
|
|
51
51
|
React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition }),
|
|
52
52
|
React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition }),
|
|
53
53
|
React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition })));
|
|
@@ -38,8 +38,8 @@ const MenuToggle = styled.div `
|
|
|
38
38
|
`;
|
|
39
39
|
const MenuHeading = ({ children, onOpen, onClose, isOpen }) => (React.createElement(MenuHeadingDiv, null,
|
|
40
40
|
React.createElement(MenuHeadingInner, null,
|
|
41
|
-
isOpen ? (React.createElement(MenuToggle, { onClick: onClose, "data-
|
|
42
|
-
React.createElement(FontAwesomeIcon, { icon: faBars }))) : (React.createElement(MenuToggle, { onClick: onOpen, "data-
|
|
41
|
+
isOpen ? (React.createElement(MenuToggle, { onClick: onClose, "data-testid": 'button-menu-close' },
|
|
42
|
+
React.createElement(FontAwesomeIcon, { icon: faBars }))) : (React.createElement(MenuToggle, { onClick: onOpen, "data-testid": 'button-menu-open' },
|
|
43
43
|
React.createElement(FontAwesomeIcon, { icon: faBars }))),
|
|
44
44
|
children)));
|
|
45
45
|
export default MenuHeading;
|
|
@@ -41,7 +41,7 @@ const MenuActivePlaceholder = styled.div `
|
|
|
41
41
|
height: 100%;
|
|
42
42
|
width: 4px;
|
|
43
43
|
`;
|
|
44
|
-
const MenuItem = ({ children, icon, active, onClick }) => (React.createElement(MenuItemOuter, { onClick: onClick, "data-
|
|
44
|
+
const MenuItem = ({ children, icon, active, onClick }) => (React.createElement(MenuItemOuter, { onClick: onClick, "data-testid": 'menu-item' },
|
|
45
45
|
active ? React.createElement(MenuActiveBar, null) : React.createElement(MenuActivePlaceholder, null),
|
|
46
46
|
React.createElement(MenuItemDiv, { active: active },
|
|
47
47
|
icon && (React.createElement(MenuIconContainer, null,
|
|
@@ -55,6 +55,6 @@ ${(props) => responsive.useStylesFor('desktop').andLarger(props.scrollable
|
|
|
55
55
|
: ``)}
|
|
56
56
|
`;
|
|
57
57
|
const MenuPanel = ({ children, scrollable, panelSize = 'sm' }) => {
|
|
58
|
-
return (React.createElement(MenuPanelDiv, { panelSize: panelSize, scrollable: scrollable, "data-
|
|
58
|
+
return (React.createElement(MenuPanelDiv, { panelSize: panelSize, scrollable: scrollable, "data-testid": 'menu-panel' }, children));
|
|
59
59
|
};
|
|
60
60
|
export default MenuPanel;
|
|
@@ -5,7 +5,7 @@ export interface MinimalMenuProps {
|
|
|
5
5
|
declare const MinimalMenu: {
|
|
6
6
|
({ children }: MinimalMenuProps): JSX.Element;
|
|
7
7
|
Header: ({ hiddenMenu, text, rightContent }: import("./_MinimalMenuHeader.component").MinimalMenuHeaderProps) => JSX.Element;
|
|
8
|
-
Item: ({ icon, active, onClick, "data-
|
|
8
|
+
Item: ({ icon, active, onClick, "data-testid": dataTestId }: import("./_MinimalMenuItem.component").MinimalMenuItemProps) => JSX.Element;
|
|
9
9
|
Page: ({ children, hiddenMenu }: import("./_MinimalMenuPage.component").MinimalMenuPageProps) => JSX.Element;
|
|
10
10
|
};
|
|
11
11
|
export default MinimalMenu;
|
|
@@ -4,7 +4,7 @@ export interface MinimalMenuItemProps {
|
|
|
4
4
|
'icon'?: IconProp;
|
|
5
5
|
'active'?: boolean;
|
|
6
6
|
'onClick'?: () => void;
|
|
7
|
-
'data-
|
|
7
|
+
'data-testid'?: string;
|
|
8
8
|
}
|
|
9
|
-
declare const MinimalMenuItem: ({ icon, active, onClick, "data-
|
|
9
|
+
declare const MinimalMenuItem: ({ icon, active, onClick, "data-testid": dataTestId }: MinimalMenuItemProps) => JSX.Element;
|
|
10
10
|
export default MinimalMenuItem;
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { useIsScreenSize } from '../../responsive/responsive';
|
|
3
3
|
import DesktopMinimalMenuItem from './desktop/_DesktopMinimalMenuItem.component';
|
|
4
4
|
import MobileMinimalMenuItem from './mobile/_MobileMinimalMenuItem.component';
|
|
5
|
-
const MinimalMenuItem = ({ icon, active, onClick, 'data-
|
|
5
|
+
const MinimalMenuItem = ({ icon, active, onClick, 'data-testid': dataTestId }) => {
|
|
6
6
|
const isMobile = useIsScreenSize('mobile');
|
|
7
7
|
if (isMobile) {
|
|
8
|
-
return React.createElement(MobileMinimalMenuItem, { icon: icon, active: active, onClick: onClick, "data-
|
|
8
|
+
return React.createElement(MobileMinimalMenuItem, { icon: icon, active: active, onClick: onClick, "data-testid": dataTestId });
|
|
9
9
|
}
|
|
10
|
-
return React.createElement(DesktopMinimalMenuItem, { icon: icon, active: active, onClick: onClick, "data-
|
|
10
|
+
return React.createElement(DesktopMinimalMenuItem, { icon: icon, active: active, onClick: onClick, "data-testid": dataTestId });
|
|
11
11
|
};
|
|
12
12
|
export default MinimalMenuItem;
|
|
@@ -4,7 +4,7 @@ export interface DesktopMinimalMenuItemProps {
|
|
|
4
4
|
'icon'?: IconProp;
|
|
5
5
|
'active'?: boolean;
|
|
6
6
|
'onClick'?: () => void;
|
|
7
|
-
'data-
|
|
7
|
+
'data-testid'?: string;
|
|
8
8
|
}
|
|
9
|
-
declare const DesktopMinimalMenuItem: ({ icon, active, onClick, "data-
|
|
9
|
+
declare const DesktopMinimalMenuItem: ({ icon, active, onClick, "data-testid": dataTestId }: DesktopMinimalMenuItemProps) => JSX.Element;
|
|
10
10
|
export default DesktopMinimalMenuItem;
|
|
@@ -27,14 +27,14 @@ const iconContainerVariants = {
|
|
|
27
27
|
active: { x: 2 },
|
|
28
28
|
hoverActive: { x: 2 },
|
|
29
29
|
};
|
|
30
|
-
const DesktopMinimalMenuItem = ({ icon, active, onClick, 'data-
|
|
30
|
+
const DesktopMinimalMenuItem = ({ icon, active, onClick, 'data-testid': dataTestId }) => {
|
|
31
31
|
const theme = useTheme();
|
|
32
32
|
const barVariants = useMemo(() => ({
|
|
33
33
|
hover: { opacity: 1, backgroundColor: theme.colours.defaultBorder, width: 4 },
|
|
34
34
|
active: { opacity: 1, backgroundColor: theme.colours.primary.main, width: 4 },
|
|
35
35
|
hoverActive: { opacity: 1, backgroundColor: theme.colours.primary.main, width: 4 },
|
|
36
36
|
}), [theme]);
|
|
37
|
-
return (React.createElement(ItemContainer, { whileHover: active ? 'hoverActive' : 'hover', animate: active ? 'active' : undefined, onClick: onClick, "data-
|
|
37
|
+
return (React.createElement(ItemContainer, { whileHover: active ? 'hoverActive' : 'hover', animate: active ? 'active' : undefined, onClick: onClick, "data-testid": dataTestId || 'menu-item' },
|
|
38
38
|
React.createElement(MenuIconBar, { style: { backgroundColor: theme.colours.cardBackground, opacity: 0 }, variants: barVariants, transition: { type: 'spring', duration: 0.3 } }),
|
|
39
39
|
icon && (React.createElement(motion.div, { variants: iconContainerVariants },
|
|
40
40
|
React.createElement(FontAwesomeIcon, { icon: icon })))));
|
|
@@ -4,7 +4,7 @@ export interface MobileMinimalMenuItemProps {
|
|
|
4
4
|
'icon'?: IconProp;
|
|
5
5
|
'active'?: boolean;
|
|
6
6
|
'onClick'?: () => void;
|
|
7
|
-
'data-
|
|
7
|
+
'data-testid'?: string;
|
|
8
8
|
}
|
|
9
|
-
declare const MobileMinimalMenuItem: ({ icon, active, onClick, "data-
|
|
9
|
+
declare const MobileMinimalMenuItem: ({ icon, active, onClick, "data-testid": dataTestId }: MobileMinimalMenuItemProps) => JSX.Element;
|
|
10
10
|
export default MobileMinimalMenuItem;
|
|
@@ -20,7 +20,7 @@ const ItemContainer = styled.div `
|
|
|
20
20
|
const iconContainerVariants = {
|
|
21
21
|
active: { fontSize: '28px', y: -8 },
|
|
22
22
|
};
|
|
23
|
-
const MobileMinimalMenuItem = ({ icon, active, onClick, 'data-
|
|
23
|
+
const MobileMinimalMenuItem = ({ icon, active, onClick, 'data-testid': dataTestId }) => {
|
|
24
24
|
const { width } = useWindowDimensions();
|
|
25
25
|
const { setBumpX } = useContext(MobileMenuBumpContext);
|
|
26
26
|
const itemRef = useRef(null);
|
|
@@ -36,7 +36,7 @@ const MobileMinimalMenuItem = ({ icon, active, onClick, 'data-cy': dataCy }) =>
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
}, [active, setBumpX, width]);
|
|
39
|
-
return (React.createElement(ItemContainer, { onClick: onClick, ref: itemRef, "data-
|
|
39
|
+
return (React.createElement(ItemContainer, { onClick: onClick, ref: itemRef, "data-testid": dataTestId || 'menu-item' }, icon && (React.createElement(motion.div, { animate: active ? 'active' : undefined, style: { fontSize: '20px' }, variants: iconContainerVariants, transition: mobileMenuDefaultTransition },
|
|
40
40
|
React.createElement(FontAwesomeIcon, { icon: icon })))));
|
|
41
41
|
};
|
|
42
42
|
export default MobileMinimalMenuItem;
|
|
@@ -90,7 +90,7 @@ const Modal = ({ children, size, loading, onClose }) => {
|
|
|
90
90
|
React.createElement(ScrollContainer, null,
|
|
91
91
|
React.createElement(ModalContext.Provider, { value: { onClose } },
|
|
92
92
|
React.createElement(ModalWrapper, { size: size || 'md' },
|
|
93
|
-
React.createElement(ModalOuter, { transition: { type: 'spring', bounce: 0, duration: 0.6 }, initial: { height: loading ? loadingHeight : 'auto' }, animate: { height: loading ? loadingHeight : 'auto' }, size: size || 'md', onClick: handleModalClick, "data-
|
|
93
|
+
React.createElement(ModalOuter, { transition: { type: 'spring', bounce: 0, duration: 0.6 }, initial: { height: loading ? loadingHeight : 'auto' }, animate: { height: loading ? loadingHeight : 'auto' }, size: size || 'md', onClick: handleModalClick, "data-testid": 'modal' },
|
|
94
94
|
!loading && children,
|
|
95
95
|
loading && (React.createElement(SpinnerContainer, null,
|
|
96
96
|
React.createElement(Loader, null))))))))), document.body);
|
|
@@ -43,12 +43,12 @@ const IconClickableArea = styled.div `
|
|
|
43
43
|
`;
|
|
44
44
|
const ModalHeader = ({ header, subHeader }) => {
|
|
45
45
|
const { onClose } = useContext(ModalContext);
|
|
46
|
-
return (React.createElement(HeaderContainer, { "data-
|
|
46
|
+
return (React.createElement(HeaderContainer, { "data-testid": 'modal-header' },
|
|
47
47
|
React.createElement(TextContainer, null,
|
|
48
48
|
React.createElement(HeaderText, null, header),
|
|
49
49
|
SubHeaderText && React.createElement(SubHeaderText, null, subHeader)),
|
|
50
50
|
React.createElement(IconContainer, null,
|
|
51
|
-
React.createElement(IconClickableArea, { onClick: onClose, "data-
|
|
51
|
+
React.createElement(IconClickableArea, { onClick: onClose, "data-testid": 'button-modal-close' },
|
|
52
52
|
React.createElement(FontAwesomeIcon, { icon: faTimes })))));
|
|
53
53
|
};
|
|
54
54
|
export default ModalHeader;
|
|
@@ -10,6 +10,6 @@ const NotificationContainer = styled.div `
|
|
|
10
10
|
`)}
|
|
11
11
|
}
|
|
12
12
|
`;
|
|
13
|
-
const Notification = (props) => (React.createElement(NotificationContainer, { "data-
|
|
13
|
+
const Notification = (props) => (React.createElement(NotificationContainer, { "data-testid": 'notification' },
|
|
14
14
|
React.createElement(Alert, { ...props })));
|
|
15
15
|
export default Notification;
|
|
@@ -44,10 +44,10 @@ const Identicon = ({ value }) => {
|
|
|
44
44
|
};
|
|
45
45
|
const ProfileImage = ({ name, image }) => {
|
|
46
46
|
if (image) {
|
|
47
|
-
return (React.createElement(ImageContainer, { "data-
|
|
47
|
+
return (React.createElement(ImageContainer, { "data-testid": 'profile-image' },
|
|
48
48
|
React.createElement(Image, { src: image })));
|
|
49
49
|
}
|
|
50
|
-
return (React.createElement(ImageContainer, { "data-
|
|
50
|
+
return (React.createElement(ImageContainer, { "data-testid": 'profile-image' },
|
|
51
51
|
React.createElement(Identicon, { value: name })));
|
|
52
52
|
};
|
|
53
53
|
export default ProfileImage;
|
|
@@ -61,11 +61,11 @@ const QrCode = ({ value }) => {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
}, [value]);
|
|
64
|
-
return (React.createElement(Container, { onClick: () => showHint(), "data-
|
|
64
|
+
return (React.createElement(Container, { onClick: () => showHint(), "data-testid": 'qrcode' },
|
|
65
65
|
copiedHint && (React.createElement(ToastContainer, null,
|
|
66
66
|
React.createElement(Toast, null,
|
|
67
67
|
React.createElement(StyledText, null, "Copied!")))),
|
|
68
|
-
React.createElement(CopyInput, { readOnly: true, ref: inputRef, value: value, "data-
|
|
68
|
+
React.createElement(CopyInput, { readOnly: true, ref: inputRef, value: value, "data-testid": 'input-qrcode-hidden' }),
|
|
69
69
|
React.createElement(StyledCanvas, { ref: ref })));
|
|
70
70
|
};
|
|
71
71
|
export default QrCode;
|
|
@@ -38,7 +38,7 @@ const ValueText = styled.div `
|
|
|
38
38
|
const Select = (props) => {
|
|
39
39
|
const [isOpen, setIsOpen] = useState(false);
|
|
40
40
|
const [referenceElement, setReferenceElement] = useState();
|
|
41
|
-
const { label, name, description, placeholder, 'value': propsValue, 'data-
|
|
41
|
+
const { label, name, description, placeholder, 'value': propsValue, 'data-testid': dataTestId, options } = props;
|
|
42
42
|
const { value: contextValue, onChange: contextOnChange } = useFormNode(name);
|
|
43
43
|
const value = getValue(propsValue, contextValue);
|
|
44
44
|
const splitDescription = description ? description.split('\\n').map((str) => str.trim()) : undefined;
|
|
@@ -55,7 +55,7 @@ const Select = (props) => {
|
|
|
55
55
|
return (React.createElement("div", null,
|
|
56
56
|
label && React.createElement(ControlLabel, { htmlFor: name }, label),
|
|
57
57
|
React.createElement(ControlOuter, { ref: setReferenceElement },
|
|
58
|
-
React.createElement(SelectControl, { "data-
|
|
58
|
+
React.createElement(SelectControl, { "data-testid": dataTestId, onClick: () => setIsOpen(!isOpen) },
|
|
59
59
|
React.createElement(TextContainer, null,
|
|
60
60
|
!value && placeholder && React.createElement(PlaceholderText, null, placeholder),
|
|
61
61
|
value && React.createElement(ValueText, null, valueLabel)),
|
|
@@ -4,7 +4,7 @@ export interface SquareButtonProps {
|
|
|
4
4
|
'children': React.ReactChild;
|
|
5
5
|
'variant'?: ColourVariant;
|
|
6
6
|
'onClick'?: () => void;
|
|
7
|
-
'data-
|
|
7
|
+
'data-testid'?: string;
|
|
8
8
|
}
|
|
9
|
-
declare const SquareButton: ({ children, variant, onClick, "data-
|
|
9
|
+
declare const SquareButton: ({ children, variant, onClick, "data-testid": dataTestId }: SquareButtonProps) => JSX.Element;
|
|
10
10
|
export default SquareButton;
|
|
@@ -25,7 +25,7 @@ const StyledButton = styled.button `
|
|
|
25
25
|
background-color: ${(props) => getThemeVariantColours(props.variant, props.theme).hover};
|
|
26
26
|
}
|
|
27
27
|
`;
|
|
28
|
-
const SquareButton = ({ children, variant = 'primary', onClick, 'data-
|
|
29
|
-
return (React.createElement(StyledButton, { variant: variant, onClick: onClick, "data-
|
|
28
|
+
const SquareButton = ({ children, variant = 'primary', onClick, 'data-testid': dataTestId }) => {
|
|
29
|
+
return (React.createElement(StyledButton, { variant: variant, onClick: onClick, "data-testid": dataTestId || 'button' }, children));
|
|
30
30
|
};
|
|
31
31
|
export default SquareButton;
|
|
@@ -11,11 +11,11 @@ export interface TableCellProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const Table: {
|
|
13
13
|
({ children, variant }: TableProps): JSX.Element;
|
|
14
|
-
Row: ({ children, "data-
|
|
14
|
+
Row: ({ children, "data-testid": dataTestId }: import("./_TableRow.component").TableRowProps) => JSX.Element;
|
|
15
15
|
Cell: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, TableCellProps, never>;
|
|
16
16
|
ActionContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
17
|
-
Action: ({ text, variant, icon, onClick, "data-
|
|
18
|
-
ActionMenu: ({ items, "data-
|
|
17
|
+
Action: ({ text, variant, icon, onClick, "data-testid": dataTestId }: TableActionProps) => JSX.Element;
|
|
18
|
+
ActionMenu: ({ items, "data-testid": dataTestId }: import("./_TableActionMenu").TableActionMenuProps) => JSX.Element;
|
|
19
19
|
HiddenAction: (props: TableActionProps) => JSX.Element;
|
|
20
20
|
};
|
|
21
21
|
export default Table;
|
|
@@ -6,7 +6,7 @@ export interface TableActionProps {
|
|
|
6
6
|
'variant'?: ColourVariant;
|
|
7
7
|
'icon'?: IconProp;
|
|
8
8
|
'onClick': () => void;
|
|
9
|
-
'data-
|
|
9
|
+
'data-testid'?: string;
|
|
10
10
|
}
|
|
11
|
-
declare const TableAction: ({ text, variant, icon, onClick, "data-
|
|
11
|
+
declare const TableAction: ({ text, variant, icon, onClick, "data-testid": dataTestId }: TableActionProps) => JSX.Element;
|
|
12
12
|
export default TableAction;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import Button from '../Button/Button.component';
|
|
3
3
|
import ButtonContext from '../Button/Button.context';
|
|
4
|
-
const TableAction = ({ text, variant, icon, onClick, 'data-
|
|
4
|
+
const TableAction = ({ text, variant, icon, onClick, 'data-testid': dataTestId }) => {
|
|
5
5
|
const buttonContextVal = useContext(ButtonContext);
|
|
6
6
|
return (React.createElement(ButtonContext.Provider, { value: { ...buttonContextVal, ...(!text && icon && { width: '32px' }) } },
|
|
7
|
-
React.createElement(Button, { variant: variant || 'tertiary', icon: icon, onClick: onClick, "data-
|
|
7
|
+
React.createElement(Button, { variant: variant || 'tertiary', icon: icon, onClick: onClick, "data-testid": dataTestId || 'button-table-action' }, text)));
|
|
8
8
|
};
|
|
9
9
|
export default TableAction;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { IActionMenuItem } from '../ActionMenu/_ActionMenu.types';
|
|
3
3
|
export interface TableActionMenuProps {
|
|
4
4
|
'items': IActionMenuItem[];
|
|
5
|
-
'data-
|
|
5
|
+
'data-testid'?: string;
|
|
6
6
|
}
|
|
7
|
-
declare const TableActionMenu: ({ items, "data-
|
|
7
|
+
declare const TableActionMenu: ({ items, "data-testid": dataTestId }: TableActionMenuProps) => JSX.Element;
|
|
8
8
|
export default TableActionMenu;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ActionMenu from '../ActionMenu/ActionMenu.component';
|
|
3
|
-
const TableActionMenu = ({ items, 'data-
|
|
4
|
-
return (React.createElement(ActionMenu, { variant: 'tertiary', "data-
|
|
3
|
+
const TableActionMenu = ({ items, 'data-testid': dataTestId }) => {
|
|
4
|
+
return (React.createElement(ActionMenu, { variant: 'tertiary', "data-testid": dataTestId }, items.map((item) => (React.createElement(ActionMenu.Item, { key: item.label, onClick: item.onClick }, item.label)))));
|
|
5
5
|
};
|
|
6
6
|
export default TableActionMenu;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface TableRowProps {
|
|
3
3
|
'children': React.ReactNode;
|
|
4
|
-
'data-
|
|
4
|
+
'data-testid'?: string;
|
|
5
5
|
}
|
|
6
|
-
declare const TableRow: ({ children, "data-
|
|
6
|
+
declare const TableRow: ({ children, "data-testid": dataTestId }: TableRowProps) => JSX.Element;
|
|
7
7
|
export default TableRow;
|
|
@@ -10,8 +10,8 @@ const StyledRow = styled.tr `
|
|
|
10
10
|
box-shadow: none;
|
|
11
11
|
}
|
|
12
12
|
`;
|
|
13
|
-
const TableRow = ({ children, 'data-
|
|
13
|
+
const TableRow = ({ children, 'data-testid': dataTestId }) => {
|
|
14
14
|
const { variant } = useContext(TableContext);
|
|
15
|
-
return (React.createElement(StyledRow, { variant: variant, "data-
|
|
15
|
+
return (React.createElement(StyledRow, { variant: variant, "data-testid": dataTestId }, children));
|
|
16
16
|
};
|
|
17
17
|
export default TableRow;
|
|
@@ -9,7 +9,7 @@ export interface ITextAreaProps {
|
|
|
9
9
|
'onChange'?: (value: any) => void;
|
|
10
10
|
'onFocus'?: () => void;
|
|
11
11
|
'onBlur'?: () => void;
|
|
12
|
-
'data-
|
|
12
|
+
'data-testid'?: string;
|
|
13
13
|
}
|
|
14
14
|
declare const TextArea: React.ForwardRefExoticComponent<ITextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
15
15
|
export default TextArea;
|
|
@@ -70,7 +70,7 @@ const messageVariants = {
|
|
|
70
70
|
errorFocus: { opacity: 1, y: -4 },
|
|
71
71
|
};
|
|
72
72
|
const TextArea = React.forwardRef(function ForwardRefTextArea(props, ref) {
|
|
73
|
-
const { label, name, placeholder, autoFocus, value, 'error': propsError, onChange, onFocus, onBlur, 'data-
|
|
73
|
+
const { label, name, placeholder, autoFocus, value, 'error': propsError, onChange, onFocus, onBlur, 'data-testid': dataTestId, } = props;
|
|
74
74
|
const [isFocused, setIsFocused] = useState(false);
|
|
75
75
|
const { value: contextValue, error: contextError, onChange: contextOnChange } = useFormNode(name);
|
|
76
76
|
const error = contextError || propsError;
|
|
@@ -97,11 +97,11 @@ const TextArea = React.forwardRef(function ForwardRefTextArea(props, ref) {
|
|
|
97
97
|
const animationVariant = error ? (isFocused ? 'errorFocus' : 'error') : undefined;
|
|
98
98
|
return (React.createElement("div", null,
|
|
99
99
|
label && React.createElement(TextAreaLabel, { htmlFor: name }, label),
|
|
100
|
-
React.createElement(TextAreaContainer, { "data-
|
|
101
|
-
React.createElement(StyledTextArea, { ref: ref, animate: animationVariant, variants: textAreaVariants, transition: { type: 'spring', duration: 0.3 }, name: name, placeholder: placeholder, value: getValue(value, contextValue), onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, autoFocus: autoFocus, "data-
|
|
102
|
-
React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 }, "data-
|
|
100
|
+
React.createElement(TextAreaContainer, { "data-testid": dataTestId },
|
|
101
|
+
React.createElement(StyledTextArea, { ref: ref, animate: animationVariant, variants: textAreaVariants, transition: { type: 'spring', duration: 0.3 }, name: name, placeholder: placeholder, value: getValue(value, contextValue), onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, autoFocus: autoFocus, "data-testid": 'text-area' }),
|
|
102
|
+
React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 }, "data-testid": 'error-indicator' },
|
|
103
103
|
React.createElement(ErrorInner, null,
|
|
104
104
|
React.createElement(FontAwesomeIcon, { icon: faExclamationCircle }))),
|
|
105
|
-
error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, animate: animationVariant, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-
|
|
105
|
+
error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, animate: animationVariant, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-testid": 'error-message' }, error)))));
|
|
106
106
|
});
|
|
107
107
|
export default TextArea;
|
|
@@ -14,11 +14,12 @@ export const OptionsContainer = styled.div `
|
|
|
14
14
|
export const Option = styled(motion.div) `
|
|
15
15
|
color: ${(props) => getThemeControlColours(props.theme).font};
|
|
16
16
|
background-color: ${(props) => props.theme.colours.controlBackgroundDisabled};
|
|
17
|
-
height: 36px;
|
|
18
17
|
display: flex;
|
|
19
18
|
align-items: center;
|
|
20
|
-
padding: 0 12px;
|
|
21
19
|
cursor: pointer;
|
|
20
|
+
|
|
21
|
+
min-height: 36px;
|
|
22
|
+
padding: 6px 12px;
|
|
22
23
|
`;
|
|
23
24
|
export const SelectOptions = ({ options, onSelect }) => {
|
|
24
25
|
const theme = useTheme();
|
|
@@ -47,14 +47,14 @@ const LoginScreen = ({ loading, error, handleLogin, onRegisterClicked }) => {
|
|
|
47
47
|
React.createElement(Form, { value: value, onChange: setValue, onSubmit: () => handleLogin(value) },
|
|
48
48
|
React.createElement(ControlGroup, null,
|
|
49
49
|
React.createElement(ErrorText, null, error),
|
|
50
|
-
React.createElement(Input, { name: 'email', placeholder: 'Email', type: 'text', "data-
|
|
51
|
-
React.createElement(Input, { name: 'password', placeholder: 'Password', type: 'password', "data-
|
|
50
|
+
React.createElement(Input, { name: 'email', placeholder: 'Email', type: 'text', "data-testid": 'input-email' }),
|
|
51
|
+
React.createElement(Input, { name: 'password', placeholder: 'Password', type: 'password', "data-testid": 'input-password' }),
|
|
52
52
|
React.createElement(ControlGroup.Spacer, null),
|
|
53
|
-
React.createElement(Button, { type: 'submit', loading: loading, "data-
|
|
53
|
+
React.createElement(Button, { type: 'submit', loading: loading, "data-testid": 'button-login' }, "Login"))),
|
|
54
54
|
React.createElement(Spacer, { size: '6x' }),
|
|
55
55
|
React.createElement(CreateAccountMessage, null,
|
|
56
56
|
`Don't have an account?`,
|
|
57
57
|
' ',
|
|
58
|
-
React.createElement(CreateAccountButton, { onClick: onRegisterClicked, "data-
|
|
58
|
+
React.createElement(CreateAccountButton, { onClick: onRegisterClicked, "data-testid": 'button-register' }, "sign up now"))));
|
|
59
59
|
};
|
|
60
60
|
export default LoginScreen;
|
|
@@ -24,9 +24,9 @@ const RegisterScreen = ({ loading, error, handleRegister }) => {
|
|
|
24
24
|
React.createElement(Form, { value: value, onChange: setValue, onSubmit: () => handleRegister(value) },
|
|
25
25
|
React.createElement(ControlGroup, null,
|
|
26
26
|
React.createElement(ErrorText, null, error),
|
|
27
|
-
React.createElement(Input, { name: 'email', placeholder: 'Email', type: 'text', "data-
|
|
28
|
-
React.createElement(Input, { name: 'password', placeholder: 'Password', type: 'password', "data-
|
|
27
|
+
React.createElement(Input, { name: 'email', placeholder: 'Email', type: 'text', "data-testid": 'input-email' }),
|
|
28
|
+
React.createElement(Input, { name: 'password', placeholder: 'Password', type: 'password', "data-testid": 'input-password' }),
|
|
29
29
|
React.createElement(ControlGroup.Spacer, null),
|
|
30
|
-
React.createElement(Button, { type: 'submit', loading: loading, "data-
|
|
30
|
+
React.createElement(Button, { type: 'submit', loading: loading, "data-testid": 'button-register' }, "Create Account")))));
|
|
31
31
|
};
|
|
32
32
|
export default RegisterScreen;
|
|
@@ -32,8 +32,8 @@ const VerificationScreen = ({ message, loading, error, handleVerification }) =>
|
|
|
32
32
|
React.createElement(Form, { value: value, onChange: setValue, onSubmit: () => handleVerification(value) },
|
|
33
33
|
React.createElement(ControlGroup, null,
|
|
34
34
|
React.createElement(ErrorText, null, error),
|
|
35
|
-
React.createElement(Input, { name: 'code', placeholder: 'code', type: 'text', "data-
|
|
35
|
+
React.createElement(Input, { name: 'code', placeholder: 'code', type: 'text', "data-testid": 'input-verification-code' }),
|
|
36
36
|
React.createElement(ControlGroup.Spacer, null),
|
|
37
|
-
React.createElement(Button, { type: 'submit', loading: loading, "data-
|
|
37
|
+
React.createElement(Button, { type: 'submit', loading: loading, "data-testid": 'button-verify' }, "Verify")))));
|
|
38
38
|
};
|
|
39
39
|
export default VerificationScreen;
|