@dtdot/lego 0.18.8 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) 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.d.ts +3 -1
  12. package/build/components/Checklist/Checklist.component.js +5 -5
  13. package/build/components/Checklist/_ChecklistItem.component.d.ts +2 -1
  14. package/build/components/Checklist/_ChecklistItem.component.js +11 -11
  15. package/build/components/FancyCheckbox/FancyCheckbox.component.js +1 -1
  16. package/build/components/ImageUpload/ImageUpload.component.js +2 -2
  17. package/build/components/InlineCard/InlineCard.component.js +1 -1
  18. package/build/components/Input/Input.component.d.ts +11 -10
  19. package/build/components/Input/Input.component.js +2 -2
  20. package/build/components/LiveInput/LiveInput.component.d.ts +7 -6
  21. package/build/components/LiveInput/LiveInput.component.js +2 -2
  22. package/build/components/LiveList/LiveList.component.js +1 -1
  23. package/build/components/LiveList/_LiveListRow.js +3 -3
  24. package/build/components/Loader/Loader.component.js +1 -1
  25. package/build/components/Menu/_MenuHeading.component.js +2 -2
  26. package/build/components/Menu/_MenuItem.component.js +1 -1
  27. package/build/components/Menu/_MenuPanel.component.js +1 -1
  28. package/build/components/MinimalMenu/desktop/_DesktopMinimalMenuItem.component.js +1 -1
  29. package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.js +1 -1
  30. package/build/components/Modal/Modal.component.js +1 -1
  31. package/build/components/Modal/_ModalHeader.component.js +2 -2
  32. package/build/components/Notification/Notification.component.js +1 -1
  33. package/build/components/ProfileImage/ProfileImage.component.js +2 -2
  34. package/build/components/QrCode/QrCode.component.js +2 -2
  35. package/build/components/SquareButton/SquareButton.component.d.ts +5 -4
  36. package/build/components/SquareButton/SquareButton.component.js +2 -2
  37. package/build/components/Table/Table.component.d.ts +2 -2
  38. package/build/components/Table/_TableAction.d.ts +4 -3
  39. package/build/components/Table/_TableAction.js +2 -2
  40. package/build/components/Table/_TableRow.component.d.ts +3 -2
  41. package/build/components/Table/_TableRow.component.js +2 -2
  42. package/build/screens/Login/Login.screen.js +5 -5
  43. package/build/screens/Register/Register.screen.js +3 -3
  44. package/build/screens/Verification/Verification.screen.js +2 -2
  45. package/package.json +1 -1
  46. package/build/components/ActionMenu/ActionMenu.stories.d.ts +0 -6
  47. package/build/components/ActionMenu/ActionMenu.stories.js +0 -48
  48. package/build/components/ActionMessage/ActionMessage.stories.d.ts +0 -6
  49. package/build/components/ActionMessage/ActionMessage.stories.js +0 -19
  50. package/build/components/Alert/Alert.stories.d.ts +0 -8
  51. package/build/components/Alert/Alert.stories.js +0 -21
  52. package/build/components/Badge/Badge.stories.d.ts +0 -5
  53. package/build/components/Badge/Badge.stories.js +0 -18
  54. package/build/components/BadgeSelector/BadgeSelector.stories.d.ts +0 -6
  55. package/build/components/BadgeSelector/BadgeSelector.stories.js +0 -94
  56. package/build/components/Button/Button.stories.d.ts +0 -7
  57. package/build/components/Button/Button.stories.js +0 -27
  58. package/build/components/ButtonGroup/ButtonGroup.stories.d.ts +0 -8
  59. package/build/components/ButtonGroup/ButtonGroup.stories.js +0 -20
  60. package/build/components/Card/Card.stories.d.ts +0 -9
  61. package/build/components/Card/Card.stories.js +0 -84
  62. package/build/components/Checklist/Checklist.stories.d.ts +0 -5
  63. package/build/components/Checklist/Checklist.stories.js +0 -42
  64. package/build/components/ControlGroup/ControlGroup.stories.d.ts +0 -7
  65. package/build/components/ControlGroup/ControlGroup.stories.js +0 -24
  66. package/build/components/FancyCheckbox/FancyCheckbox.stories.d.ts +0 -5
  67. package/build/components/FancyCheckbox/FancyCheckbox.stories.js +0 -29
  68. package/build/components/Form/Form.stories.d.ts +0 -5
  69. package/build/components/Form/Form.stories.js +0 -21
  70. package/build/components/Heading/Heading.stories.d.ts +0 -7
  71. package/build/components/Heading/Heading.stories.js +0 -9
  72. package/build/components/ImageUpload/ImageUpload.stories.d.ts +0 -8
  73. package/build/components/ImageUpload/ImageUpload.stories.js +0 -49
  74. package/build/components/InlineCard/InlineCard.stories.d.ts +0 -7
  75. package/build/components/InlineCard/InlineCard.stories.js +0 -52
  76. package/build/components/Input/Input.stories.d.ts +0 -7
  77. package/build/components/Input/Input.stories.js +0 -28
  78. package/build/components/LiveInput/LiveInput.stories.d.ts +0 -6
  79. package/build/components/LiveInput/LiveInput.stories.js +0 -12
  80. package/build/components/LiveList/LiveList.stories.d.ts +0 -8
  81. package/build/components/LiveList/LiveList.stories.js +0 -57
  82. package/build/components/Loader/Loader.stories.d.ts +0 -5
  83. package/build/components/Loader/Loader.stories.js +0 -9
  84. package/build/components/Menu/Menu.stories.d.ts +0 -7
  85. package/build/components/Menu/Menu.stories.js +0 -95
  86. package/build/components/MinimalMenu/MinimalMenu.stories.d.ts +0 -5
  87. package/build/components/MinimalMenu/MinimalMenu.stories.js +0 -46
  88. package/build/components/Modal/Modal.stories.d.ts +0 -6
  89. package/build/components/Modal/Modal.stories.js +0 -55
  90. package/build/components/Notification/Notification.stories.d.ts +0 -8
  91. package/build/components/Notification/Notification.stories.js +0 -28
  92. package/build/components/Notifications/Notifications.stories.d.ts +0 -7
  93. package/build/components/Notifications/Notifications.stories.js +0 -96
  94. package/build/components/PageHeader/PageHeader.stories.d.ts +0 -6
  95. package/build/components/PageHeader/PageHeader.stories.js +0 -13
  96. package/build/components/ProfileImage/ProfileImage.stories.d.ts +0 -6
  97. package/build/components/ProfileImage/ProfileImage.stories.js +0 -8
  98. package/build/components/QrCode/QrCode.stories.d.ts +0 -5
  99. package/build/components/QrCode/QrCode.stories.js +0 -8
  100. package/build/components/SquareButton/SquareButton.stories.d.ts +0 -5
  101. package/build/components/SquareButton/SquareButton.stories.js +0 -14
  102. package/build/components/Swimlane/Swimlane.stories.d.ts +0 -6
  103. package/build/components/Swimlane/Swimlane.stories.js +0 -102
  104. package/build/components/Table/Table.stories.d.ts +0 -8
  105. package/build/components/Table/Table.stories.js +0 -75
  106. package/build/components/Text/Text.stories.d.ts +0 -6
  107. package/build/components/Text/Text.stories.js +0 -11
  108. package/build/examples/Form.stories.d.ts +0 -5
  109. package/build/examples/Form.stories.js +0 -19
  110. package/build/examples/Modal.stories.d.ts +0 -5
  111. package/build/examples/Modal.stories.js +0 -37
  112. package/build/layouts/Action/Action.stories.d.ts +0 -6
  113. package/build/layouts/Action/Action.stories.js +0 -17
  114. package/build/layouts/Centered/Centered.stories.d.ts +0 -5
  115. package/build/layouts/Centered/Centered.stories.js +0 -11
  116. package/build/layouts/Column/Column.stories.d.ts +0 -5
  117. package/build/layouts/Column/Column.stories.js +0 -11
  118. package/build/layouts/Content/Content.stories.d.ts +0 -9
  119. package/build/layouts/Content/Content.stories.js +0 -40
  120. package/build/layouts/Focus/Focus.stories.d.ts +0 -5
  121. package/build/layouts/Focus/Focus.stories.js +0 -19
  122. package/build/layouts/Padded/Padded.stories.d.ts +0 -6
  123. package/build/layouts/Padded/Padded.stories.js +0 -13
  124. package/build/layouts/WidthLimit/WidthLimit.stories.d.ts +0 -8
  125. package/build/layouts/WidthLimit/WidthLimit.stories.js +0 -43
@@ -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
  };
@@ -7,6 +7,8 @@ export interface ChecklistProps {
7
7
  items: ChecklistItemProps[];
8
8
  value: string[];
9
9
  onChange: (value: string[]) => void;
10
+ noSplitGap?: boolean;
11
+ large?: boolean;
10
12
  }
11
- declare const Checklist: ({ items, value, onChange }: ChecklistProps) => JSX.Element;
13
+ declare const Checklist: ({ items, value, onChange, noSplitGap, large }: ChecklistProps) => JSX.Element;
12
14
  export default Checklist;
@@ -8,7 +8,7 @@ const ListDivider = styled.div `
8
8
 
9
9
  padding: 20px 0;
10
10
  `;
11
- const Checklist = ({ items, value, onChange }) => {
11
+ const Checklist = ({ items, value, onChange, noSplitGap, large }) => {
12
12
  const [checkedOrder, setCheckedOrder] = useState([]);
13
13
  useEffect(() => {
14
14
  if (value.some((id) => !checkedOrder.includes(id))) {
@@ -35,11 +35,11 @@ const Checklist = ({ items, value, onChange }) => {
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
- React.createElement(ChecklistItem, { label: item.label, value: value.includes(item.id), onChange: (checked) => handleChange(item.id, checked) })))),
41
- checkedItems.length ? React.createElement(ListDivider, null) : null,
40
+ React.createElement(ChecklistItem, { label: item.label, value: value.includes(item.id), onChange: (checked) => handleChange(item.id, checked), large: !!large })))),
41
+ checkedItems.length && !noSplitGap ? React.createElement(ListDivider, null) : null,
42
42
  checkedItems.map((item) => (React.createElement(motion.div, { layoutId: item.id, key: item.id },
43
- React.createElement(ChecklistItem, { label: item.label, value: value.includes(item.id), onChange: (checked) => handleChange(item.id, checked) }))))));
43
+ React.createElement(ChecklistItem, { label: item.label, value: value.includes(item.id), onChange: (checked) => handleChange(item.id, checked), large: !!large }))))));
44
44
  };
45
45
  export default Checklist;
@@ -3,6 +3,7 @@ export interface ChecklistItemProps {
3
3
  label: string;
4
4
  value: boolean;
5
5
  onChange: (value: boolean) => void;
6
+ large: boolean;
6
7
  }
7
- declare const ChecklistItem: ({ label, value, onChange }: ChecklistItemProps) => JSX.Element;
8
+ declare const ChecklistItem: ({ label, value, onChange, large }: ChecklistItemProps) => JSX.Element;
8
9
  export default ChecklistItem;
@@ -28,8 +28,8 @@ const HiddenCheckbox = styled.input `
28
28
  `;
29
29
  const Checkmark = styled.div `
30
30
  position: relative;
31
- height: 24px;
32
- width: 24px;
31
+ height: ${(props) => (props.large ? '36px' : '24px')};
32
+ width: ${(props) => (props.large ? '36px' : '24px')};
33
33
  margin-right: 8px;
34
34
  background-color: ${(props) => props.theme.colours.cardBackground};
35
35
 
@@ -38,10 +38,10 @@ const Checkmark = styled.div `
38
38
  position: absolute;
39
39
  display: ${(props) => (props.checked ? 'block' : 'none')};
40
40
 
41
- left: 9px;
42
- top: 5px;
43
- width: 5px;
44
- height: 10px;
41
+ left: ${(props) => (props.large ? '14px' : '9px')};
42
+ top: ${(props) => (props.large ? '7px' : '5px')};
43
+ width: ${(props) => (props.large ? '7px' : '5px')};
44
+ height: ${(props) => (props.large ? '16px' : '10px')};
45
45
  border: solid ${(props) => props.theme.colours.defaultFont};
46
46
  border-width: 0 3px 3px 0;
47
47
  -webkit-transform: rotate(45deg);
@@ -54,12 +54,12 @@ const Strikethrough = styled.div `
54
54
  color: transparent;
55
55
  height: 1px;
56
56
 
57
- margin-left: 30px;
57
+ margin-left: ${(props) => (props.large ? '42px' : '30px')};
58
58
  padding-right: 2px;
59
59
  padding-left: 2px;
60
60
  background-color: ${(props) => props.theme.colours.defaultBorder};
61
61
  `;
62
- const ChecklistItem = ({ label, value, onChange }) => {
62
+ const ChecklistItem = ({ label, value, onChange, large }) => {
63
63
  const theme = useTheme();
64
64
  const handleChange = (event) => {
65
65
  if (event.target.checked) {
@@ -69,10 +69,10 @@ const ChecklistItem = ({ label, value, onChange }) => {
69
69
  onChange(false);
70
70
  }
71
71
  };
72
- return (React.createElement(Outerlabel, { checked: value, whileHover: { backgroundColor: theme.colours.cardBackground } },
73
- React.createElement(Checkmark, { checked: value }),
72
+ return (React.createElement(Outerlabel, { checked: value, whileHover: { backgroundColor: theme.colours.cardBackground }, "data-cy": value ? 'checklist-item-checked' : 'checklist-item' },
73
+ React.createElement(Checkmark, { checked: value, large: large }),
74
74
  label,
75
75
  React.createElement(HiddenCheckbox, { type: 'checkbox', checked: value, onChange: handleChange }),
76
- value && React.createElement(Strikethrough, null, label)));
76
+ value && React.createElement(Strikethrough, { large: large }, label)));
77
77
  };
78
78
  export default ChecklistItem;
@@ -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,11 +80,11 @@ 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
89
  React.createElement(HiddenInput, { value: '', ref: inputRef, type: 'file', onChange: handleUpload })));
90
90
  }
@@ -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;
@@ -34,7 +34,7 @@ const DesktopMinimalMenuItem = ({ icon, active, onClick }) => {
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": '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 })))));
@@ -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": '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;