@dtdot/lego 2.0.0-3 → 2.0.0-30

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 (95) hide show
  1. package/build/components/ActionMenu/ActionMenu.component.d.ts +4 -4
  2. package/build/components/ActionMenu/ActionMenu.component.js +3 -3
  3. package/build/components/ActionMenu/_ActionMenuCheckbox.component.d.ts +2 -2
  4. package/build/components/ActionMenu/_ActionMenuCheckbox.component.js +2 -2
  5. package/build/components/ActionMenu/_ActionMenuItem.component.d.ts +2 -2
  6. package/build/components/ActionMenu/_ActionMenuItem.component.js +2 -2
  7. package/build/components/ActionMenu/_ActionMenuPanel.component.js +1 -1
  8. package/build/components/ActionMessage/ActionMessage.component.js +1 -1
  9. package/build/components/Alert/Alert.component.js +3 -3
  10. package/build/components/Badge/Badge.component.js +1 -1
  11. package/build/components/BadgeSelector/BadgeSelector.component.js +1 -1
  12. package/build/components/Button/Button.component.d.ts +1 -1
  13. package/build/components/Button/Button.component.js +19 -11
  14. package/build/components/Button/Button.context.d.ts +1 -0
  15. package/build/components/Button/Button.context.js +1 -0
  16. package/build/components/Card/Card.component.d.ts +7 -6
  17. package/build/components/Card/Card.component.js +2 -2
  18. package/build/components/Card/_CardHeader.component.js +4 -2
  19. package/build/components/Card/_CardToggleSection.component.d.ts +6 -5
  20. package/build/components/Card/_CardToggleSection.component.js +2 -2
  21. package/build/components/Checklist/Checklist.component.js +1 -1
  22. package/build/components/Checklist/_ChecklistItem.component.js +1 -1
  23. package/build/components/ControlLine/ControlLine.component.d.ts +7 -0
  24. package/build/components/ControlLine/ControlLine.component.js +33 -0
  25. package/build/components/FancyCheckbox/FancyCheckbox.component.js +1 -1
  26. package/build/components/Form/Form.component.d.ts +4 -1
  27. package/build/components/Form/Form.component.js +2 -0
  28. package/build/components/Form/_NestedFormArray.d.ts +8 -0
  29. package/build/components/Form/_NestedFormArray.js +23 -0
  30. package/build/components/Heading/Heading.component.d.ts +1 -0
  31. package/build/components/Heading/Heading.component.js +2 -0
  32. package/build/components/Heading/_DividerHeading.component.d.ts +2 -0
  33. package/build/components/Heading/_DividerHeading.component.js +15 -0
  34. package/build/components/ImageUpload/ImageUpload.component.d.ts +2 -2
  35. package/build/components/ImageUpload/ImageUpload.component.js +10 -10
  36. package/build/components/InlineCard/InlineCard.component.d.ts +8 -7
  37. package/build/components/InlineCard/InlineCard.component.js +2 -2
  38. package/build/components/InlineCard/_InlineCardContent.component.js +2 -0
  39. package/build/components/InlineCard/_InlineCardMeta.component.js +1 -0
  40. package/build/components/Input/Input.component.d.ts +5 -1
  41. package/build/components/Input/Input.component.js +38 -8
  42. package/build/components/LiveInput/LiveInput.component.d.ts +2 -2
  43. package/build/components/LiveInput/LiveInput.component.js +2 -2
  44. package/build/components/LiveList/LiveList.component.js +2 -2
  45. package/build/components/LiveList/_LiveListRow.js +3 -3
  46. package/build/components/Loader/Loader.component.d.ts +9 -1
  47. package/build/components/Loader/Loader.component.js +38 -6
  48. package/build/components/Menu/_MenuHeading.component.js +2 -2
  49. package/build/components/Menu/_MenuItem.component.js +1 -1
  50. package/build/components/Menu/_MenuPanel.component.js +1 -1
  51. package/build/components/MinimalMenu/MinimalMenu.component.d.ts +2 -1
  52. package/build/components/MinimalMenu/MinimalMenu.component.js +2 -0
  53. package/build/components/MinimalMenu/_MinimalMenuHeader.component.d.ts +15 -0
  54. package/build/components/MinimalMenu/_MinimalMenuHeader.component.js +31 -0
  55. package/build/components/MinimalMenu/_MinimalMenuItem.component.d.ts +2 -2
  56. package/build/components/MinimalMenu/_MinimalMenuItem.component.js +3 -3
  57. package/build/components/MinimalMenu/desktop/_DesktopMinimalMenuItem.component.d.ts +2 -2
  58. package/build/components/MinimalMenu/desktop/_DesktopMinimalMenuItem.component.js +2 -2
  59. package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.d.ts +2 -2
  60. package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.js +2 -2
  61. package/build/components/Modal/Modal.component.d.ts +6 -5
  62. package/build/components/Modal/Modal.component.js +2 -2
  63. package/build/components/Modal/_ModalHeader.component.js +2 -2
  64. package/build/components/Notification/Notification.component.js +1 -1
  65. package/build/components/ProfileImage/ProfileImage.component.js +2 -2
  66. package/build/components/QrCode/QrCode.component.js +2 -2
  67. package/build/components/Select/Select.component.d.ts +2 -5
  68. package/build/components/Select/Select.component.js +12 -29
  69. package/build/components/Spacer/Spacer.component.d.ts +1 -1
  70. package/build/components/Spacer/Spacer.component.js +2 -0
  71. package/build/components/SquareButton/SquareButton.component.d.ts +2 -2
  72. package/build/components/SquareButton/SquareButton.component.js +2 -2
  73. package/build/components/Table/Table.component.d.ts +5 -3
  74. package/build/components/Table/Table.component.js +15 -0
  75. package/build/components/Table/_TableAction.d.ts +7 -3
  76. package/build/components/Table/_TableAction.js +6 -3
  77. package/build/components/Table/_TableActionMenu.d.ts +2 -2
  78. package/build/components/Table/_TableActionMenu.js +2 -2
  79. package/build/components/Table/_TableRow.component.d.ts +3 -2
  80. package/build/components/Table/_TableRow.component.js +10 -4
  81. package/build/components/Text/Text.component.d.ts +5 -3
  82. package/build/components/Text/Text.component.js +21 -3
  83. package/build/components/TextArea/TextArea.component.d.ts +1 -1
  84. package/build/components/TextArea/TextArea.component.js +5 -5
  85. package/build/components/Toggle/Toggle.component.js +1 -1
  86. package/build/components/common/Options.component.d.ts +19 -0
  87. package/build/components/common/Options.component.js +50 -0
  88. package/build/index.d.ts +1 -0
  89. package/build/index.js +1 -0
  90. package/build/screens/Login/Login.screen.js +4 -4
  91. package/build/screens/Register/Register.screen.js +3 -3
  92. package/build/screens/Verification/Verification.screen.js +2 -2
  93. package/build/shared/ControlStyles.js +1 -1
  94. package/build/theme/dark.theme.js +4 -2
  95. package/package.json +5 -12
@@ -105,7 +105,7 @@ const SelectIconContainer = styled.div `
105
105
 
106
106
  color: ${(props) => props.theme.colours.statusInfo.contrast};
107
107
  `;
108
- const InlineCard = ({ children, size, value, onClick, gestureLeftIcon, gestureLeftVariant, onGestureLeft, }) => {
108
+ const InlineCard = ({ children, size, value, onClick, gestureLeftIcon, gestureLeftVariant, onGestureLeft, 'data-testid': dataTestId, }) => {
109
109
  const { value: selectedValues, onToggle } = useContext(InlineCardSelectionContext);
110
110
  const isSelectable = !!onToggle;
111
111
  const isSelected = selectedValues?.length && value && selectedValues.includes(value);
@@ -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-cy": 'inline-card' }, children),
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": dataTestId || '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));
@@ -9,6 +9,8 @@ const ContentContainer = styled.div `
9
9
  font-size: ${(props) => props.theme.fonts.default.size};
10
10
  color: ${(props) => props.theme.colours.defaultFont};
11
11
 
12
+ min-width: 0;
13
+
12
14
  ${(props) => props.center &&
13
15
  `
14
16
  display: flex;
@@ -8,6 +8,7 @@ const ContentContainer = styled.div `
8
8
  display: flex;
9
9
  align-items: center;
10
10
  margin-left: auto;
11
+ flex-shrink: 0;
11
12
  `;
12
13
  const InlineCardMeta = ({ children }) => {
13
14
  return React.createElement(ContentContainer, null, children);
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { SelectOption } from '../common/Options.component';
2
3
  export interface IInputProps {
3
4
  'name'?: string;
4
5
  'label'?: string;
@@ -12,7 +13,10 @@ export interface IInputProps {
12
13
  'onChange'?: (value: any) => void;
13
14
  'onFocus'?: () => void;
14
15
  'onBlur'?: () => void;
15
- 'data-cy'?: string;
16
+ 'data-testid'?: string;
17
+ 'suggestions'?: SelectOption[];
18
+ 'loading'?: boolean;
19
+ 'loadingVariant'?: 'default' | 'background';
16
20
  }
17
21
  declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<HTMLInputElement>>;
18
22
  export default Input;
@@ -8,9 +8,11 @@ import ControlDescription from '../../shared/ControlDescription';
8
8
  import ControlLabel from '../../shared/ControlLabel';
9
9
  import { ControlStyles } from '../../shared/ControlStyles';
10
10
  import useFormNode, { getValue } from '../Form/useFormNode.hook';
11
+ import { OptionsPopper } from '../common/Options.component';
12
+ import Loader from '../Loader/Loader.component';
11
13
  const InputContainer = styled.div `
12
14
  position: relative;
13
- margin: 2px 0;
15
+ border-radius: 2px;
14
16
 
15
17
  background-color: ${(props) => props.theme.colours.controlBackground};
16
18
  `;
@@ -51,6 +53,16 @@ const ErrorInner = styled.div `
51
53
  align-items: center;
52
54
  cursor: pointer;
53
55
  `;
56
+ const LoadingContainer = styled.div `
57
+ position: absolute;
58
+ top: 0;
59
+ right: 0;
60
+ height: 100%;
61
+ width: 40px;
62
+ display: flex;
63
+ justify-content: center;
64
+ align-items: center;
65
+ `;
54
66
  const errorVariants = {
55
67
  show: { opacity: 1, x: 10 },
56
68
  };
@@ -62,11 +74,22 @@ const messageVariants = {
62
74
  errorFocus: { opacity: 1, y: -4 },
63
75
  };
64
76
  const Input = React.forwardRef(function ForwardRefInput(props, ref) {
65
- const { label, name, description, placeholder, disabled, type = 'text', autoFocus, value, 'error': propsError, onChange, onFocus, onBlur, 'data-cy': dataCy, } = props;
77
+ const { label, name, description, placeholder, disabled, type = 'text', autoFocus, value, 'error': propsError, onChange, onFocus, onBlur, 'data-testid': dataTestId, suggestions, loading, loadingVariant, } = props;
78
+ const [isOpen, setIsOpen] = useState(false);
66
79
  const [isFocused, setIsFocused] = useState(false);
80
+ const [referenceElement, setReferenceElement] = useState();
67
81
  const { value: contextValue, error: contextError, onChange: contextOnChange } = useFormNode(name);
68
82
  const error = contextError || propsError;
69
83
  const splitDescription = description ? description.split('\\n').map((str) => str.trim()) : undefined;
84
+ const handleSetSuggestion = (value) => {
85
+ setIsOpen(false);
86
+ if (onChange) {
87
+ onChange(value);
88
+ }
89
+ if (contextOnChange) {
90
+ contextOnChange(value);
91
+ }
92
+ };
70
93
  const handleChange = (e) => {
71
94
  if (onChange) {
72
95
  onChange(e.target.value);
@@ -87,17 +110,24 @@ const Input = React.forwardRef(function ForwardRefInput(props, ref) {
87
110
  onBlur();
88
111
  }
89
112
  };
113
+ const handleClick = () => {
114
+ setIsOpen(true);
115
+ };
90
116
  const animationVariant = error ? (isFocused ? 'errorFocus' : 'error') : undefined;
117
+ const filteredOptions = suggestions?.filter((option) => !value || option.label.toLowerCase().includes(value.toLowerCase()));
91
118
  return (React.createElement("div", null,
92
119
  label && React.createElement(ControlLabel, { htmlFor: name }, label),
93
- React.createElement(InputContainer, { "data-cy": dataCy },
94
- 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, autoFocus: autoFocus, "data-cy": 'input' }),
95
- React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 }, "data-cy": 'error-indicator' },
120
+ React.createElement(InputContainer, { "data-testid": dataTestId, ref: setReferenceElement },
121
+ 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' }),
122
+ React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 }, "data-testid": 'error-indicator' },
96
123
  React.createElement(ErrorInner, null,
97
124
  React.createElement(FontAwesomeIcon, { icon: faExclamationCircle }))),
98
- error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, animate: animationVariant, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-cy": 'error-message' }, error))),
99
- splitDescription && (React.createElement(ControlDescription, null, splitDescription.map((line, index) => (React.createElement(React.Fragment, null,
125
+ error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, animate: animationVariant, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-testid": 'error-message' }, error)),
126
+ loading && (React.createElement(LoadingContainer, null,
127
+ React.createElement(Loader, { size: 'sm', variant: loadingVariant })))),
128
+ splitDescription && (React.createElement(ControlDescription, null, splitDescription.map((line, index) => (React.createElement("span", { key: index },
100
129
  index !== 0 && React.createElement("br", null),
101
- line)))))));
130
+ line))))),
131
+ filteredOptions && isOpen && (React.createElement(OptionsPopper, { referenceElement: referenceElement, options: filteredOptions, onSelect: handleSetSuggestion, onClose: () => setIsOpen(false) }))));
102
132
  });
103
133
  export default Input;
@@ -5,7 +5,7 @@ interface LiveInputProps {
5
5
  'type'?: string;
6
6
  'value'?: string;
7
7
  'onChange'?: (value: string) => void;
8
- 'data-cy'?: string;
8
+ 'data-testid'?: string;
9
9
  }
10
- declare const LiveInput: ({ name, type, placeholder, value, onChange, "data-cy": dataCy }: LiveInputProps) => JSX.Element;
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-cy': dataCy }) => {
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-cy": dataCy || 'live-input' })));
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-cy": 'live-list' },
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-cy": 'button-add-list-item' },
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-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' }),
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-cy": 'live-list-remove' },
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;
@@ -1,3 +1,11 @@
1
1
  /// <reference types="react" />
2
- declare const Loader: () => JSX.Element;
2
+ export interface BaseLoaderProps {
3
+ variant?: 'default' | 'background';
4
+ size: 'sm' | 'md';
5
+ }
6
+ export interface LoaderProps {
7
+ variant?: 'page-loader' | 'default' | 'background';
8
+ size?: 'sm' | 'md';
9
+ }
10
+ declare const Loader: ({ variant, size }: LoaderProps) => JSX.Element;
3
11
  export default Loader;
@@ -1,6 +1,13 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { motion } from 'framer-motion';
3
+ import styled from 'styled-components';
3
4
  import colours from '../../colours/colours';
5
+ const PageLoaderContainer = styled.div `
6
+ display: flex;
7
+ height: 300px;
8
+ justify-content: center;
9
+ align-items: center;
10
+ `;
4
11
  const loadingContainer = {
5
12
  width: '40px',
6
13
  height: '26px',
@@ -40,10 +47,35 @@ const loadingCircleTransition = {
40
47
  repeatType: 'reverse',
41
48
  ease: 'easeInOut',
42
49
  }; // Framer motion isn't accepting 'repeatType' but animation breaks without it
43
- const Loader = () => {
44
- return (React.createElement(motion.div, { style: loadingContainer, variants: loadingContainerVariants, initial: 'start', animate: 'end', "data-cy": 'loader' },
45
- React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition }),
46
- React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition }),
47
- React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition })));
50
+ const BaseLoader = ({ size, variant }) => {
51
+ const loadingCircleWithSize = useMemo(() => {
52
+ const sizePx = size === 'md' ? '10px' : '5px';
53
+ return {
54
+ ...loadingCircle,
55
+ width: sizePx,
56
+ height: sizePx,
57
+ backgroundColor: variant === 'default' ? colours.grey30 : colours.grey50,
58
+ };
59
+ }, [size, variant]);
60
+ const loadingContainerWithSize = useMemo(() => {
61
+ const widthPx = size === 'md' ? '40px' : '20px';
62
+ const heightPx = size === 'md' ? '26px' : '13px';
63
+ return {
64
+ ...loadingContainer,
65
+ width: widthPx,
66
+ height: heightPx,
67
+ };
68
+ }, [size]);
69
+ return (React.createElement(motion.div, { style: loadingContainerWithSize, variants: loadingContainerVariants, initial: 'start', animate: 'end', "data-testid": 'loader' },
70
+ React.createElement(motion.span, { style: loadingCircleWithSize, variants: loadingCircleVariants, transition: loadingCircleTransition }),
71
+ React.createElement(motion.span, { style: loadingCircleWithSize, variants: loadingCircleVariants, transition: loadingCircleTransition }),
72
+ React.createElement(motion.span, { style: loadingCircleWithSize, variants: loadingCircleVariants, transition: loadingCircleTransition })));
73
+ };
74
+ const Loader = ({ variant = 'default', size = 'md' }) => {
75
+ if (variant === 'page-loader') {
76
+ return (React.createElement(PageLoaderContainer, null,
77
+ React.createElement(BaseLoader, { size: size })));
78
+ }
79
+ return React.createElement(BaseLoader, { size: size, variant: variant });
48
80
  };
49
81
  export default Loader;
@@ -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-cy": 'button-menu-close' },
42
- React.createElement(FontAwesomeIcon, { icon: faBars }))) : (React.createElement(MenuToggle, { onClick: onOpen, "data-cy": 'button-menu-open' },
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-cy": 'menu-item' },
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-cy": 'menu-panel' }, children));
58
+ return (React.createElement(MenuPanelDiv, { panelSize: panelSize, scrollable: scrollable, "data-testid": 'menu-panel' }, children));
59
59
  };
60
60
  export default MenuPanel;
@@ -4,7 +4,8 @@ export interface MinimalMenuProps {
4
4
  }
5
5
  declare const MinimalMenu: {
6
6
  ({ children }: MinimalMenuProps): JSX.Element;
7
- Item: ({ icon, active, onClick, "data-cy": dataCy }: import("./_MinimalMenuItem.component").MinimalMenuItemProps) => JSX.Element;
7
+ Header: ({ hiddenMenu, text, rightContent }: import("./_MinimalMenuHeader.component").MinimalMenuHeaderProps) => JSX.Element;
8
+ Item: ({ icon, active, onClick, "data-testid": dataTestId }: import("./_MinimalMenuItem.component").MinimalMenuItemProps) => JSX.Element;
8
9
  Page: ({ children, hiddenMenu }: import("./_MinimalMenuPage.component").MinimalMenuPageProps) => JSX.Element;
9
10
  };
10
11
  export default MinimalMenu;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useIsScreenSize } from '../../responsive/responsive';
3
+ import MinimalMenuHeader from './_MinimalMenuHeader.component';
3
4
  import MinimalMenuItem from './_MinimalMenuItem.component';
4
5
  import MinimalMenuPage from './_MinimalMenuPage.component';
5
6
  import DesktopMinimalMenuContainer from './desktop/_DesktopMinimalMenuContainer.component';
@@ -11,6 +12,7 @@ const MinimalMenu = ({ children }) => {
11
12
  }
12
13
  return React.createElement(DesktopMinimalMenuContainer, null, children);
13
14
  };
15
+ MinimalMenu.Header = MinimalMenuHeader;
14
16
  MinimalMenu.Item = MinimalMenuItem;
15
17
  MinimalMenu.Page = MinimalMenuPage;
16
18
  export default MinimalMenu;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export interface MinimalMenuHeaderProps {
3
+ /** Set the page to be in hidden menu mode.
4
+ * This is useful for rendering your app and preventing re-renders between a un-authenticated no-menu mode and the regular authenticated mode
5
+ **/
6
+ hiddenMenu?: boolean;
7
+ text?: string;
8
+ rightContent?: React.ReactNode;
9
+ }
10
+ /**
11
+ * A header that is designed to be nested within the page content.
12
+ * You can use a header per page or simply use a single header for your entire application.
13
+ */
14
+ declare const MinimalMenuHeader: ({ hiddenMenu, text, rightContent }: MinimalMenuHeaderProps) => JSX.Element;
15
+ export default MinimalMenuHeader;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ const MinimalMenuHeaderContainer = styled.div ``;
4
+ const Header = styled.div `
5
+ height: 48px;
6
+ background-color: ${(props) => props.theme.colours.cardBackground};
7
+
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: space-between;
11
+ `;
12
+ const HeaderItem = styled.div `
13
+ padding: 0 16px;
14
+ `;
15
+ const TitleText = styled.div `
16
+ font-family: ${(props) => props.theme.fonts.subHeading.family};
17
+ font-size: ${(props) => props.theme.fonts.subHeading.size};
18
+ font-weight: ${(props) => props.theme.fonts.subHeading.weight};
19
+ color: ${(props) => props.theme.colours.defaultFont};
20
+ `;
21
+ /**
22
+ * A header that is designed to be nested within the page content.
23
+ * You can use a header per page or simply use a single header for your entire application.
24
+ */
25
+ const MinimalMenuHeader = ({ hiddenMenu, text, rightContent }) => {
26
+ return (React.createElement(MinimalMenuHeaderContainer, { hiddenMenu: !!hiddenMenu },
27
+ React.createElement(Header, null,
28
+ React.createElement(HeaderItem, null, text && React.createElement(TitleText, null, text)),
29
+ React.createElement(HeaderItem, null, rightContent))));
30
+ };
31
+ export default MinimalMenuHeader;
@@ -4,7 +4,7 @@ export interface MinimalMenuItemProps {
4
4
  'icon'?: IconProp;
5
5
  'active'?: boolean;
6
6
  'onClick'?: () => void;
7
- 'data-cy'?: string;
7
+ 'data-testid'?: string;
8
8
  }
9
- declare const MinimalMenuItem: ({ icon, active, onClick, "data-cy": dataCy }: MinimalMenuItemProps) => JSX.Element;
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-cy': dataCy }) => {
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-cy": dataCy });
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-cy": dataCy });
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-cy'?: string;
7
+ 'data-testid'?: string;
8
8
  }
9
- declare const DesktopMinimalMenuItem: ({ icon, active, onClick, "data-cy": dataCy }: DesktopMinimalMenuItemProps) => JSX.Element;
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-cy': dataCy }) => {
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-cy": dataCy || 'menu-item' },
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-cy'?: string;
7
+ 'data-testid'?: string;
8
8
  }
9
- declare const MobileMinimalMenuItem: ({ icon, active, onClick, "data-cy": dataCy }: MobileMinimalMenuItemProps) => JSX.Element;
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-cy': dataCy }) => {
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-cy": dataCy || 'menu-item' }, 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-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;
@@ -1,13 +1,14 @@
1
1
  import React from 'react';
2
2
  export type ModalSize = 'sm' | 'md' | 'lg';
3
3
  export interface ModalProps {
4
- children: React.ReactNode;
5
- size?: ModalSize;
6
- loading?: boolean;
7
- onClose: () => void;
4
+ 'children': React.ReactNode;
5
+ 'size'?: ModalSize;
6
+ 'loading'?: boolean;
7
+ 'onClose': () => void;
8
+ 'data-testid'?: string;
8
9
  }
9
10
  declare const Modal: {
10
- ({ children, size, loading, onClose }: ModalProps): React.ReactPortal;
11
+ ({ children, size, loading, onClose, "data-testid": dataTestId }: ModalProps): React.ReactPortal;
11
12
  Body: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
12
13
  Header: ({ header, subHeader }: import("./_ModalHeader.component").ModalHeaderProps) => JSX.Element;
13
14
  };
@@ -76,7 +76,7 @@ const SpinnerContainer = styled.div `
76
76
  justify-content: center;
77
77
  align-items: center;
78
78
  `;
79
- const Modal = ({ children, size, loading, onClose }) => {
79
+ const Modal = ({ children, size, loading, onClose, 'data-testid': dataTestId }) => {
80
80
  const handleModalClick = (event) => {
81
81
  event.modalClicked = true;
82
82
  };
@@ -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-cy": 'modal' },
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": dataTestId || '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-cy": 'modal-header' },
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-cy": 'button-modal-close' },
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-cy": 'notification' },
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-cy": 'profile-image' },
47
+ return (React.createElement(ImageContainer, { "data-testid": 'profile-image' },
48
48
  React.createElement(Image, { src: image })));
49
49
  }
50
- return (React.createElement(ImageContainer, { "data-cy": 'profile-image' },
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-cy": 'qrcode' },
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-cy": 'input-qrcode-hidden' }),
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;
@@ -1,8 +1,5 @@
1
1
  /// <reference types="react" />
2
- export type SelectOption = {
3
- value: string;
4
- label: string;
5
- };
2
+ import { SelectOption } from '../common/Options.component';
6
3
  export interface ISelectProps {
7
4
  'name'?: string;
8
5
  'label'?: string;
@@ -10,7 +7,7 @@ export interface ISelectProps {
10
7
  'placeholder'?: string;
11
8
  'value'?: string;
12
9
  'onChange'?: (value: any) => void;
13
- 'data-cy'?: string;
10
+ 'data-testid'?: string;
14
11
  'options': SelectOption[];
15
12
  }
16
13
  declare const Select: (props: ISelectProps) => JSX.Element;