@dtdot/lego 0.19.0 → 0.19.3

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.
Files changed (48) hide show
  1. package/build/components/ActionMenu/ActionMenu.component.js +1 -1
  2. package/build/components/ActionMenu/_ActionMenuItem.component.js +1 -1
  3. package/build/components/ActionMenu/_ActionMenuPanel.component.js +1 -1
  4. package/build/components/ActionMessage/ActionMessage.component.js +1 -1
  5. package/build/components/Alert/Alert.component.js +3 -3
  6. package/build/components/Badge/Badge.component.js +1 -1
  7. package/build/components/BadgeSelector/BadgeSelector.component.js +1 -1
  8. package/build/components/Button/Button.component.d.ts +6 -5
  9. package/build/components/Button/Button.component.js +2 -2
  10. package/build/components/Card/Card.component.js +1 -1
  11. package/build/components/Checklist/Checklist.component.js +1 -1
  12. package/build/components/Checklist/_ChecklistItem.component.js +1 -1
  13. package/build/components/FancyCheckbox/FancyCheckbox.component.js +1 -1
  14. package/build/components/ImageUpload/ImageUpload.component.js +3 -3
  15. package/build/components/InlineCard/InlineCard.component.js +1 -1
  16. package/build/components/Input/Input.component.d.ts +11 -10
  17. package/build/components/Input/Input.component.js +2 -2
  18. package/build/components/LiveInput/LiveInput.component.d.ts +7 -6
  19. package/build/components/LiveInput/LiveInput.component.js +2 -2
  20. package/build/components/LiveList/LiveList.component.js +1 -1
  21. package/build/components/LiveList/_LiveListRow.js +3 -3
  22. package/build/components/Loader/Loader.component.js +1 -1
  23. package/build/components/Menu/_MenuHeading.component.js +2 -2
  24. package/build/components/Menu/_MenuItem.component.js +1 -1
  25. package/build/components/Menu/_MenuPanel.component.js +1 -1
  26. package/build/components/MinimalMenu/MinimalMenu.component.d.ts +1 -1
  27. package/build/components/MinimalMenu/_MinimalMenuItem.component.d.ts +5 -4
  28. package/build/components/MinimalMenu/_MinimalMenuItem.component.js +3 -3
  29. package/build/components/MinimalMenu/desktop/_DesktopMinimalMenuItem.component.d.ts +5 -4
  30. package/build/components/MinimalMenu/desktop/_DesktopMinimalMenuItem.component.js +2 -2
  31. package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.d.ts +5 -4
  32. package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.js +2 -2
  33. package/build/components/Modal/Modal.component.js +1 -1
  34. package/build/components/Modal/_ModalHeader.component.js +2 -2
  35. package/build/components/Notification/Notification.component.js +1 -1
  36. package/build/components/ProfileImage/ProfileImage.component.js +2 -2
  37. package/build/components/QrCode/QrCode.component.js +2 -2
  38. package/build/components/SquareButton/SquareButton.component.d.ts +5 -4
  39. package/build/components/SquareButton/SquareButton.component.js +2 -2
  40. package/build/components/Table/Table.component.d.ts +2 -2
  41. package/build/components/Table/_TableAction.d.ts +4 -3
  42. package/build/components/Table/_TableAction.js +2 -2
  43. package/build/components/Table/_TableRow.component.d.ts +3 -2
  44. package/build/components/Table/_TableRow.component.js +2 -2
  45. package/build/screens/Login/Login.screen.js +5 -5
  46. package/build/screens/Register/Register.screen.js +3 -3
  47. package/build/screens/Verification/Verification.screen.js +2 -2
  48. package/package.json +1 -1
@@ -43,7 +43,7 @@ const ActionMenu = ({ items, variant }) => {
43
43
  },
44
44
  }));
45
45
  return (React.createElement(React.Fragment, null,
46
- React.createElement(Button, { variant: variant, ref: setReferenceElement, onClick: () => setShown(true) },
46
+ React.createElement(Button, { variant: variant, "data-cy": 'action-menu-button', ref: setReferenceElement, onClick: () => setShown(true) },
47
47
  React.createElement(StyledIcon, { icon: faEllipsisV })),
48
48
  shown &&
49
49
  ReactDOM.createPortal(React.createElement("div", { ref: setPopperElement, style: styles.popper, ...attributes.popper },
@@ -13,6 +13,6 @@ const ActionMenuItemOuter = styled(motion.div) `
13
13
  const ActionMenuItem = ({ label, onClick }) => {
14
14
  const theme = useTheme();
15
15
  return (React.createElement(React.Fragment, null,
16
- React.createElement(ActionMenuItemOuter, { style: { backgroundColor: theme.colours.tertiary.main }, whileHover: { backgroundColor: theme.colours.tertiary.hover }, onClick: onClick }, label)));
16
+ React.createElement(ActionMenuItemOuter, { style: { backgroundColor: theme.colours.tertiary.main }, whileHover: { backgroundColor: theme.colours.tertiary.hover }, onClick: onClick, "data-cy": 'action-menu-item' }, label)));
17
17
  };
18
18
  export default ActionMenuItem;
@@ -5,5 +5,5 @@ const ActionMenuPanelOuter = styled.div `
5
5
  background-color: ${(props) => props.theme.colours.tertiary.main};
6
6
  min-width: 160px;
7
7
  `;
8
- const ActionMenuPanel = ({ items }) => (React.createElement(ActionMenuPanelOuter, null, items.map((item) => (React.createElement(ActionMenuItem, { key: item.label, label: item.label, onClick: item.onClick })))));
8
+ const ActionMenuPanel = ({ items }) => (React.createElement(ActionMenuPanelOuter, { "data-cy": 'action-menu-popover' }, items.map((item) => (React.createElement(ActionMenuItem, { key: item.label, label: item.label, onClick: item.onClick })))));
9
9
  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, null,
17
+ return (React.createElement(ActionMessageContainer, { "data-cy": '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 },
50
- React.createElement(MessageContainer, null, message),
51
- action && React.createElement(ActionContainer, { onClick: onAction }, action),
49
+ return (React.createElement(AlertContainer, { colour: colour, "data-cy": 'alert' },
50
+ React.createElement(MessageContainer, { "data-cy": 'alert-message' }, message),
51
+ action && (React.createElement(ActionContainer, { onClick: onAction, "data-cy": 'alert-action' }, action)),
52
52
  count && count > 1 && React.createElement(CountContainer, { colour: colour }, count)));
53
53
  };
54
54
  export default Alert;
@@ -15,6 +15,6 @@ export const BadgeSpan = styled.span `
15
15
  text-transform: lowercase;
16
16
  `;
17
17
  const Badge = ({ children, variant }) => {
18
- return React.createElement(BadgeSpan, { variant: variant }, children);
18
+ return (React.createElement(BadgeSpan, { variant: variant, "data-cy": 'badge' }, children));
19
19
  };
20
20
  export default Badge;
@@ -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, null, options.map((option) => (React.createElement(InteractiveBadge, { key: option.value, variant: option.variant, inactive: !value.includes(option.value), onClick: () => handleClick(option.value) }, option.name)))));
27
+ return (React.createElement(BadgeSelectorOuter, { "data-cy": 'badge-selector' }, options.map((option) => (React.createElement(InteractiveBadge, { key: option.value, variant: option.variant, inactive: !value.includes(option.value), onClick: () => handleClick(option.value), "data-cy": value.includes(option.value) ? 'badge-selected' : 'badge' }, option.name)))));
28
28
  };
29
29
  export default BadgeSelector;
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import { ColourVariant } from '../../theme/theme.types';
3
3
  export interface ButtonProps {
4
- children: React.ReactChild;
5
- loading?: boolean;
6
- variant?: ColourVariant;
7
- type?: 'submit' | 'button';
8
- onClick?: () => void;
4
+ 'children': React.ReactChild;
5
+ 'loading'?: boolean;
6
+ 'variant'?: ColourVariant;
7
+ 'type'?: 'submit' | 'button';
8
+ 'onClick'?: () => void;
9
+ 'data-cy'?: string;
9
10
  }
10
11
  declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<unknown>>;
11
12
  export default Button;
@@ -54,8 +54,8 @@ const ButtonSpinner = styled.div `
54
54
  }
55
55
  `;
56
56
  const Button = React.forwardRef(function Button(props, ref) {
57
- const { children, loading, variant = 'primary', type = 'button', onClick } = props;
57
+ const { children, loading, variant = 'primary', type = 'button', onClick, 'data-cy': dataCy } = props;
58
58
  const { width, height, alignSelf, marginTop } = useContext(ButtonContext);
59
- return (React.createElement(StyledButton, { ref: ref, width: width, height: height, alignSelf: alignSelf, marginTop: marginTop, variant: variant, type: type, onClick: onClick }, loading ? React.createElement(ButtonSpinner, { variant: variant }) : children));
59
+ return (React.createElement(StyledButton, { ref: ref, width: width, height: height, alignSelf: alignSelf, marginTop: marginTop, variant: variant, type: type, onClick: onClick, "data-cy": dataCy || 'button' }, loading ? React.createElement(ButtonSpinner, { variant: variant }) : children));
60
60
  });
61
61
  export default Button;
@@ -93,7 +93,7 @@ const Card = ({ children, padded, size = 'sm', onClick }) => {
93
93
  scale: 1.005,
94
94
  boxShadow: theme.shadows.xlarge,
95
95
  }
96
- : {}, size: size, padded: padded, onClick: handleClick, usePointer: !!onClick },
96
+ : {}, size: size, padded: padded, onClick: handleClick, usePointer: !!onClick, "data-cy": 'card' },
97
97
  React.createElement(CardActionsContainer, { ref: actionsRef }),
98
98
  React.createElement(CardInner, null, children))));
99
99
  };
@@ -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, null,
38
+ return (React.createElement(LayoutGroup, { "data-cy": '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,
@@ -69,7 +69,7 @@ const ChecklistItem = ({ label, value, onChange, large }) => {
69
69
  onChange(false);
70
70
  }
71
71
  };
72
- return (React.createElement(Outerlabel, { checked: value, whileHover: { backgroundColor: theme.colours.cardBackground } },
72
+ return (React.createElement(Outerlabel, { checked: value, whileHover: { backgroundColor: theme.colours.cardBackground }, "data-cy": value ? 'checklist-item-checked' : 'checklist-item' },
73
73
  React.createElement(Checkmark, { checked: value, large: large }),
74
74
  label,
75
75
  React.createElement(HiddenCheckbox, { type: 'checkbox', checked: value, onChange: handleChange }),
@@ -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, null, options.map((option) => (React.createElement(StyledButton, { selected: option.value === selectedValue, key: option.value, onClick: () => handleChange(option.value) }, option.label))))));
51
+ React.createElement(ButtonGroup, { "data-cy": 'checkbox-group' }, options.map((option) => (React.createElement(StyledButton, { selected: option.value === selectedValue, key: option.value, onClick: () => handleChange(option.value), "data-cy": option.value === selectedValue ? 'checkbox-selected' : 'checkbox' }, option.label))))));
52
52
  };
53
53
  export default FancyCheckbox;
@@ -80,13 +80,13 @@ const ImageUpload = ({ name, value, onChange, onSearch }) => {
80
80
  if (!internalValue) {
81
81
  return (React.createElement(UploadContainer, null,
82
82
  React.createElement(UploadInnerContainer, null,
83
- React.createElement(IconContainer, { whileHover: { scale: 1.05 }, onClick: handleUploadClicked },
83
+ React.createElement(IconContainer, { whileHover: { scale: 1.05 }, onClick: handleUploadClicked, "data-cy": 'button-image-upload' },
84
84
  React.createElement(FontAwesomeIcon, { icon: faCloudUploadAlt })),
85
85
  onSearch && (React.createElement(React.Fragment, null,
86
86
  React.createElement(UploadVerticalDivider, null),
87
- React.createElement(IconContainer, { whileHover: { scale: 1.05 }, onClick: onSearch },
87
+ React.createElement(IconContainer, { whileHover: { scale: 1.05 }, onClick: onSearch, "data-cy": 'button-image-search' },
88
88
  React.createElement(FontAwesomeIcon, { icon: faSearch }))))),
89
- React.createElement(HiddenInput, { value: '', ref: inputRef, type: 'file', onChange: handleUpload })));
89
+ React.createElement(HiddenInput, { value: '', ref: inputRef, type: 'file', onChange: handleUpload, "data-cy": 'input-image-hidden' })));
90
90
  }
91
91
  return React.createElement(Image, { src: getUrl(internalValue) });
92
92
  };
@@ -133,7 +133,7 @@ const InlineCard = ({ children, size, value, onClick, gestureLeftIcon, gestureLe
133
133
  };
134
134
  return (React.createElement(CardWrapper, { size: size },
135
135
  React.createElement(CardActionBackground, { style: { opacity, backgroundColor: gestureLeftTheme.main } }, gestureLeftIcon && (React.createElement(FontAwesomeIcon, { style: { fontSize: '20px', color: gestureLeftTheme.contrast }, icon: gestureLeftIcon }))),
136
- 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 }, children),
136
+ 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-cy": 'inline-card' }, children),
137
137
  isSelectable && isSelected ? (React.createElement(SelectChecked, null,
138
138
  React.createElement(SelectIconContainer, null,
139
139
  React.createElement(FontAwesomeIcon, { icon: faCheck })))) : null));
@@ -2,16 +2,17 @@ import React from 'react';
2
2
  export declare const INPUT_HEIGHT = 48;
3
3
  export declare const InputStyles: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
4
4
  export interface IInputProps {
5
- name?: string;
6
- label?: string;
7
- placeholder?: string;
8
- type?: string;
9
- autoFocus?: boolean;
10
- value?: string;
11
- error?: string;
12
- onChange?: (value: any) => void;
13
- onFocus?: () => void;
14
- onBlur?: () => void;
5
+ 'name'?: string;
6
+ 'label'?: string;
7
+ 'placeholder'?: string;
8
+ 'type'?: string;
9
+ 'autoFocus'?: boolean;
10
+ 'value'?: string;
11
+ 'error'?: string;
12
+ 'onChange'?: (value: any) => void;
13
+ 'onFocus'?: () => void;
14
+ 'onBlur'?: () => void;
15
+ 'data-cy'?: string;
15
16
  }
16
17
  declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<HTMLInputElement>>;
17
18
  export default Input;
@@ -93,7 +93,7 @@ const messageVariants = {
93
93
  errorFocus: { opacity: 1, y: -4 },
94
94
  };
95
95
  const Input = React.forwardRef(function ForwardRefInput(props, ref) {
96
- const { label, name, placeholder, type = 'text', autoFocus, value, error: propsError, onChange, onFocus, onBlur, } = props;
96
+ const { label, name, placeholder, type = 'text', autoFocus, value, 'error': propsError, onChange, onFocus, onBlur, 'data-cy': dataCy, } = props;
97
97
  const [isFocused, setIsFocused] = useState(false);
98
98
  const { value: contextValue, error: contextError, onChange: contextOnChange } = useFormNode(name);
99
99
  const error = contextError || propsError;
@@ -120,7 +120,7 @@ const Input = React.forwardRef(function ForwardRefInput(props, ref) {
120
120
  return (React.createElement("div", null,
121
121
  label && React.createElement(InputLabel, { htmlFor: name }, label),
122
122
  React.createElement(InputContainer, { animate: error ? (isFocused ? 'errorFocus' : 'error') : undefined },
123
- React.createElement(StyledInput, { ref: ref, variants: inputVariants, transition: { type: 'spring', duration: 0.3 }, type: type, name: name, placeholder: placeholder, value: getValue(value, contextValue), onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, autoFocus: autoFocus }),
123
+ React.createElement(StyledInput, { ref: ref, variants: inputVariants, transition: { type: 'spring', duration: 0.3 }, type: type, name: name, placeholder: placeholder, value: getValue(value, contextValue), onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, autoFocus: autoFocus, "data-cy": dataCy || 'input' }),
124
124
  React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 } },
125
125
  React.createElement(ErrorInner, null,
126
126
  React.createElement(FontAwesomeIcon, { icon: faExclamationCircle }))),
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  interface LiveInputProps {
3
- name: string;
4
- placeholder: string;
5
- type?: string;
6
- value?: string;
7
- onChange?: (value: string) => void;
3
+ 'name': string;
4
+ 'placeholder': string;
5
+ 'type'?: string;
6
+ 'value'?: string;
7
+ 'onChange'?: (value: string) => void;
8
+ 'data-cy'?: string;
8
9
  }
9
- declare const LiveInput: ({ name, type, placeholder, value, onChange }: LiveInputProps) => JSX.Element;
10
+ declare const LiveInput: ({ name, type, placeholder, value, onChange, "data-cy": dataCy }: LiveInputProps) => JSX.Element;
10
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 }) => {
17
+ const LiveInput = ({ name, type = 'text', placeholder, value, onChange, 'data-cy': dataCy }) => {
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 }) => {
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 })));
28
+ React.createElement(StyledInput, { name: name, type: type, value: value || contextValue, placeholder: placeholder, onChange: handleChange, "data-cy": dataCy || 'live-input' })));
29
29
  };
30
30
  export default LiveInput;
@@ -100,7 +100,7 @@ const LiveList = ({ value: inputValue, name, onChange: propsOnChange }) => {
100
100
  if (!value?.length) {
101
101
  return null;
102
102
  }
103
- return (React.createElement("div", null,
103
+ return (React.createElement("div", { "data-cy": '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
106
  React.createElement(AddRowInner, { style: { scale: 1 }, whileHover: 'hover', variants: addVariants, onClick: handleRowAdd },
@@ -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' },
63
- React.createElement(Input, { onFocus: handleFocus, onBlur: handleBlur, ref: inputRef, value: value || '', error: error, onChange: handleChange }),
62
+ return (React.createElement(InputContainer, { whileHover: 'hover', "data-cy": 'live-list-row' },
63
+ React.createElement(Input, { onFocus: handleFocus, onBlur: handleBlur, ref: inputRef, value: value || '', error: error, onChange: handleChange, "data-cy": '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 },
65
+ React.createElement(RemoveInner, { onClick: onRemove, "data-cy": 'live-list-remove' },
66
66
  React.createElement(FontAwesomeIcon, { icon: faTimes })))));
67
67
  };
68
68
  export default LiveListRow;
@@ -40,7 +40,7 @@ const loadingCircleTransition = {
40
40
  ease: 'easeInOut',
41
41
  };
42
42
  const Loader = () => {
43
- return (React.createElement(motion.div, { style: loadingContainer, variants: loadingContainerVariants, initial: 'start', animate: 'end' },
43
+ return (React.createElement(motion.div, { style: loadingContainer, variants: loadingContainerVariants, initial: 'start', animate: 'end', "data-cy": 'loader' },
44
44
  React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition }),
45
45
  React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition }),
46
46
  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 },
42
- React.createElement(FontAwesomeIcon, { icon: faBars }))) : (React.createElement(MenuToggle, { onClick: onOpen },
41
+ isOpen ? (React.createElement(MenuToggle, { onClick: onClose, "data-cy": 'button-menu-close' },
42
+ React.createElement(FontAwesomeIcon, { icon: faBars }))) : (React.createElement(MenuToggle, { onClick: onOpen, "data-cy": '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 },
44
+ const MenuItem = ({ children, icon, active, onClick }) => (React.createElement(MenuItemOuter, { onClick: onClick, "data-cy": '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 }, children));
58
+ return (React.createElement(MenuPanelDiv, { panelSize: panelSize, scrollable: scrollable, "data-cy": 'menu-panel' }, children));
59
59
  };
60
60
  export default MenuPanel;
@@ -4,7 +4,7 @@ export interface MinimalMenuProps {
4
4
  }
5
5
  declare const MinimalMenu: {
6
6
  ({ children }: MinimalMenuProps): JSX.Element;
7
- Item: ({ icon, active, onClick }: import("./_MinimalMenuItem.component").MinimalMenuItemProps) => JSX.Element;
7
+ Item: ({ icon, active, onClick, "data-cy": dataCy }: import("./_MinimalMenuItem.component").MinimalMenuItemProps) => JSX.Element;
8
8
  Page: ({ children }: import("./_MinimalMenuPage.component").MinimalMenuPageProps) => JSX.Element;
9
9
  };
10
10
  export default MinimalMenu;
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { IconProp } from '@fortawesome/fontawesome-svg-core';
3
3
  export interface MinimalMenuItemProps {
4
- icon?: IconProp;
5
- active?: boolean;
6
- onClick?: () => void;
4
+ 'icon'?: IconProp;
5
+ 'active'?: boolean;
6
+ 'onClick'?: () => void;
7
+ 'data-cy'?: string;
7
8
  }
8
- declare const MinimalMenuItem: ({ icon, active, onClick }: MinimalMenuItemProps) => JSX.Element;
9
+ declare const MinimalMenuItem: ({ icon, active, onClick, "data-cy": dataCy }: MinimalMenuItemProps) => JSX.Element;
9
10
  export default MinimalMenuItem;
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { useIsScreenSize } from '../../responsive/responsive';
3
3
  import MobileMinimalMenuItem from './mobile/_MobileMinimalMenuItem.component';
4
4
  import DesktopMinimalMenuItem from './desktop/_DesktopMinimalMenuItem.component';
5
- const MinimalMenuItem = ({ icon, active, onClick }) => {
5
+ const MinimalMenuItem = ({ icon, active, onClick, 'data-cy': dataCy }) => {
6
6
  const isMobile = useIsScreenSize('mobile');
7
7
  if (isMobile) {
8
- return React.createElement(MobileMinimalMenuItem, { icon: icon, active: active, onClick: onClick });
8
+ return React.createElement(MobileMinimalMenuItem, { icon: icon, active: active, onClick: onClick, "data-cy": dataCy });
9
9
  }
10
- return React.createElement(DesktopMinimalMenuItem, { icon: icon, active: active, onClick: onClick });
10
+ return React.createElement(DesktopMinimalMenuItem, { icon: icon, active: active, onClick: onClick, "data-cy": dataCy });
11
11
  };
12
12
  export default MinimalMenuItem;
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { IconProp } from '@fortawesome/fontawesome-svg-core';
3
3
  export interface DesktopMinimalMenuItemProps {
4
- icon?: IconProp;
5
- active?: boolean;
6
- onClick?: () => void;
4
+ 'icon'?: IconProp;
5
+ 'active'?: boolean;
6
+ 'onClick'?: () => void;
7
+ 'data-cy'?: string;
7
8
  }
8
- declare const DesktopMinimalMenuItem: ({ icon, active, onClick }: DesktopMinimalMenuItemProps) => JSX.Element;
9
+ declare const DesktopMinimalMenuItem: ({ icon, active, onClick, "data-cy": dataCy }: DesktopMinimalMenuItemProps) => JSX.Element;
9
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 }) => {
30
+ const DesktopMinimalMenuItem = ({ icon, active, onClick, 'data-cy': dataCy }) => {
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 },
37
+ return (React.createElement(ItemContainer, { whileHover: active ? 'hoverActive' : 'hover', animate: active ? 'active' : undefined, onClick: onClick, "data-cy": dataCy || '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 })))));
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { IconProp } from '@fortawesome/fontawesome-svg-core';
3
3
  export interface MobileMinimalMenuItemProps {
4
- icon?: IconProp;
5
- active?: boolean;
6
- onClick?: () => void;
4
+ 'icon'?: IconProp;
5
+ 'active'?: boolean;
6
+ 'onClick'?: () => void;
7
+ 'data-cy'?: string;
7
8
  }
8
- declare const MobileMinimalMenuItem: ({ icon, active, onClick }: MobileMinimalMenuItemProps) => JSX.Element;
9
+ declare const MobileMinimalMenuItem: ({ icon, active, onClick, "data-cy": dataCy }: MobileMinimalMenuItemProps) => JSX.Element;
9
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 }) => {
23
+ const MobileMinimalMenuItem = ({ icon, active, onClick, 'data-cy': dataCy }) => {
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 }) => {
36
36
  }
37
37
  };
38
38
  }, [active, setBumpX, width]);
39
- return (React.createElement(ItemContainer, { onClick: onClick, ref: itemRef }, icon && (React.createElement(motion.div, { animate: active ? 'active' : undefined, style: { fontSize: '20px' }, variants: iconContainerVariants, transition: mobileMenuDefaultTransition },
39
+ return (React.createElement(ItemContainer, { onClick: onClick, ref: itemRef, "data-cy": dataCy || '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 },
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-cy": '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, null,
46
+ return (React.createElement(HeaderContainer, { "data-cy": '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 },
51
+ React.createElement(IconClickableArea, { onClick: onClose, "data-cy": '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, null,
13
+ const Notification = (props) => (React.createElement(NotificationContainer, { "data-cy": '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, null,
47
+ return (React.createElement(ImageContainer, { "data-cy": 'profile-image' },
48
48
  React.createElement(Image, { src: image })));
49
49
  }
50
- return (React.createElement(ImageContainer, null,
50
+ return (React.createElement(ImageContainer, { "data-cy": '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() },
64
+ return (React.createElement(Container, { onClick: () => showHint(), "data-cy": '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 }),
68
+ React.createElement(CopyInput, { readOnly: true, ref: inputRef, value: value, "data-cy": 'input-qrcode-hidden' }),
69
69
  React.createElement(StyledCanvas, { ref: ref })));
70
70
  };
71
71
  export default QrCode;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { ColourVariant } from '../../theme/theme.types';
3
3
  export interface SquareButtonProps {
4
- children: React.ReactChild;
5
- variant?: ColourVariant;
6
- onClick?: () => void;
4
+ 'children': React.ReactChild;
5
+ 'variant'?: ColourVariant;
6
+ 'onClick'?: () => void;
7
+ 'data-cy'?: string;
7
8
  }
8
- declare const SquareButton: ({ children, variant, onClick }: SquareButtonProps) => JSX.Element;
9
+ declare const SquareButton: ({ children, variant, onClick, "data-cy": dataCy }: SquareButtonProps) => JSX.Element;
9
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 }) => {
29
- return (React.createElement(StyledButton, { variant: variant, onClick: onClick }, children));
28
+ const SquareButton = ({ children, variant = 'primary', onClick, 'data-cy': dataCy }) => {
29
+ return (React.createElement(StyledButton, { variant: variant, onClick: onClick, "data-cy": dataCy || 'button' }, children));
30
30
  };
31
31
  export default SquareButton;
@@ -10,8 +10,8 @@ export interface TableCellProps {
10
10
  }
11
11
  declare const Table: {
12
12
  ({ children, variant }: TableProps): JSX.Element;
13
- Row: ({ children }: import("./_TableRow.component").TableRowProps) => JSX.Element;
13
+ Row: ({ children, "data-cy": dataCy }: import("./_TableRow.component").TableRowProps) => JSX.Element;
14
14
  Cell: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, TableCellProps, never>;
15
- Action: ({ text, onClick }: import("./_TableAction").TableActionProps) => JSX.Element;
15
+ Action: ({ text, onClick, "data-cy": dataCy }: import("./_TableAction").TableActionProps) => JSX.Element;
16
16
  };
17
17
  export default Table;
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  export interface TableActionProps {
3
- text: string;
4
- onClick: () => void;
3
+ 'text': string;
4
+ 'onClick': () => void;
5
+ 'data-cy'?: string;
5
6
  }
6
- declare const TableAction: ({ text, onClick }: TableActionProps) => JSX.Element;
7
+ declare const TableAction: ({ text, onClick, "data-cy": dataCy }: TableActionProps) => JSX.Element;
7
8
  export default TableAction;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import Button from '../Button/Button.component';
3
- const TableAction = ({ text, onClick }) => {
4
- return (React.createElement(Button, { variant: 'tertiary', onClick: onClick }, text));
3
+ const TableAction = ({ text, onClick, 'data-cy': dataCy }) => {
4
+ return (React.createElement(Button, { variant: 'tertiary', onClick: onClick, "data-cy": dataCy || 'button-table-action' }, text));
5
5
  };
6
6
  export default TableAction;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  export interface TableRowProps {
3
- children: React.ReactNode;
3
+ 'children': React.ReactNode;
4
+ 'data-cy'?: string;
4
5
  }
5
- declare const TableRow: ({ children }: TableRowProps) => JSX.Element;
6
+ declare const TableRow: ({ children, "data-cy": dataCy }: TableRowProps) => JSX.Element;
6
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 }) => {
13
+ const TableRow = ({ children, 'data-cy': dataCy }) => {
14
14
  const { variant } = useContext(TableContext);
15
- return React.createElement(StyledRow, { variant: variant }, children);
15
+ return (React.createElement(StyledRow, { variant: variant, "data-cy": dataCy }, children));
16
16
  };
17
17
  export default TableRow;
@@ -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' }),
51
- React.createElement(Input, { name: 'password', placeholder: 'Password', type: 'password' }),
50
+ React.createElement(Input, { name: 'email', placeholder: 'Email', type: 'text', "data-cy": 'input-email' }),
51
+ React.createElement(Input, { name: 'password', placeholder: 'Password', type: 'password', "data-cy": 'input-password' }),
52
52
  React.createElement(ControlGroup.Spacer, null),
53
- React.createElement(Button, { type: 'submit', loading: loading }, "Login"))),
53
+ React.createElement(Button, { type: 'submit', loading: loading, "data-cy": 'button-login' }, "Login"))),
54
54
  React.createElement(Spacer, { size: '6x' }),
55
55
  React.createElement(CreateAccountMessage, null,
56
56
  `Don't have an account?`,
57
- " ",
58
- React.createElement(CreateAccountButton, { onClick: onRegisterClicked }, "sign up now"))));
57
+ ' ',
58
+ React.createElement(CreateAccountButton, { onClick: onRegisterClicked, "data-cy": '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' }),
28
- React.createElement(Input, { name: 'password', placeholder: 'Password', type: 'password' }),
27
+ React.createElement(Input, { name: 'email', placeholder: 'Email', type: 'text', "data-cy": 'input-email' }),
28
+ React.createElement(Input, { name: 'password', placeholder: 'Password', type: 'password', "data-cy": 'input-password' }),
29
29
  React.createElement(ControlGroup.Spacer, null),
30
- React.createElement(Button, { type: 'submit', loading: loading }, "Create Account")))));
30
+ React.createElement(Button, { type: 'submit', loading: loading, "data-cy": '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' }),
35
+ React.createElement(Input, { name: 'code', placeholder: 'code', type: 'text', "data-cy": 'input-verification-code' }),
36
36
  React.createElement(ControlGroup.Spacer, null),
37
- React.createElement(Button, { type: 'submit', loading: loading }, "Verify")))));
37
+ React.createElement(Button, { type: 'submit', loading: loading, "data-cy": 'button-verify' }, "Verify")))));
38
38
  };
39
39
  export default VerificationScreen;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtdot/lego",
3
- "version": "0.19.0",
3
+ "version": "0.19.3",
4
4
  "description": "Some reusable components for building my applications",
5
5
  "main": "build/index.js",
6
6
  "scripts": {