@dtdot/lego 0.14.0

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 (223) hide show
  1. package/build/colours/colours.d.ts +16 -0
  2. package/build/colours/colours.js +15 -0
  3. package/build/components/ActionMessage/ActionMessage.component.d.ts +9 -0
  4. package/build/components/ActionMessage/ActionMessage.component.js +27 -0
  5. package/build/components/ActionMessage/ActionMessage.stories.d.ts +6 -0
  6. package/build/components/ActionMessage/ActionMessage.stories.js +20 -0
  7. package/build/components/Alert/Alert.component.d.ts +16 -0
  8. package/build/components/Alert/Alert.component.js +54 -0
  9. package/build/components/Alert/Alert.stories.d.ts +8 -0
  10. package/build/components/Alert/Alert.stories.js +21 -0
  11. package/build/components/Badge/Badge.component.d.ts +9 -0
  12. package/build/components/Badge/Badge.component.js +20 -0
  13. package/build/components/Badge/Badge.stories.d.ts +5 -0
  14. package/build/components/Badge/Badge.stories.js +18 -0
  15. package/build/components/Button/Button.component.d.ts +11 -0
  16. package/build/components/Button/Button.component.js +60 -0
  17. package/build/components/Button/Button.context.d.ts +8 -0
  18. package/build/components/Button/Button.context.js +7 -0
  19. package/build/components/Button/Button.stories.d.ts +7 -0
  20. package/build/components/Button/Button.stories.js +27 -0
  21. package/build/components/ButtonGroup/ButtonGroup.component.d.ts +6 -0
  22. package/build/components/ButtonGroup/ButtonGroup.component.js +17 -0
  23. package/build/components/ButtonGroup/ButtonGroup.stories.d.ts +7 -0
  24. package/build/components/ButtonGroup/ButtonGroup.stories.js +17 -0
  25. package/build/components/Card/Card.component.d.ts +19 -0
  26. package/build/components/Card/Card.component.js +101 -0
  27. package/build/components/Card/Card.context.d.ts +9 -0
  28. package/build/components/Card/Card.context.js +7 -0
  29. package/build/components/Card/Card.stories.d.ts +9 -0
  30. package/build/components/Card/Card.stories.js +64 -0
  31. package/build/components/Card/CardGroup.component.d.ts +9 -0
  32. package/build/components/Card/CardGroup.component.js +31 -0
  33. package/build/components/Card/_CardActions.component.d.ts +10 -0
  34. package/build/components/Card/_CardActions.component.js +48 -0
  35. package/build/components/Card/_CardContent.component.d.ts +6 -0
  36. package/build/components/Card/_CardContent.component.js +24 -0
  37. package/build/components/Card/_CardHeader.component.d.ts +9 -0
  38. package/build/components/Card/_CardHeader.component.js +48 -0
  39. package/build/components/Card/_CardMedia.component.d.ts +6 -0
  40. package/build/components/Card/_CardMedia.component.js +48 -0
  41. package/build/components/Card/_CardSpacer.component.d.ts +3 -0
  42. package/build/components/Card/_CardSpacer.component.js +4 -0
  43. package/build/components/Card/_CardSubContent.component.d.ts +6 -0
  44. package/build/components/Card/_CardSubContent.component.js +24 -0
  45. package/build/components/ControlGroup/ControlGroup.component.d.ts +11 -0
  46. package/build/components/ControlGroup/ControlGroup.component.js +75 -0
  47. package/build/components/ControlGroup/ControlGroup.stories.d.ts +7 -0
  48. package/build/components/ControlGroup/ControlGroup.stories.js +24 -0
  49. package/build/components/ControlGroup/_ControlGroupSpacer.component.d.ts +3 -0
  50. package/build/components/ControlGroup/_ControlGroupSpacer.component.js +4 -0
  51. package/build/components/FancyCheckbox/FancyCheckbox.component.d.ts +14 -0
  52. package/build/components/FancyCheckbox/FancyCheckbox.component.js +53 -0
  53. package/build/components/FancyCheckbox/FancyCheckbox.stories.d.ts +5 -0
  54. package/build/components/FancyCheckbox/FancyCheckbox.stories.js +29 -0
  55. package/build/components/Form/Form.component.d.ts +9 -0
  56. package/build/components/Form/Form.component.js +24 -0
  57. package/build/components/Form/Form.stories.d.ts +5 -0
  58. package/build/components/Form/Form.stories.js +21 -0
  59. package/build/components/Form/FormState.context.d.ts +7 -0
  60. package/build/components/Form/FormState.context.js +6 -0
  61. package/build/components/Form/useFormNode.hook.d.ts +5 -0
  62. package/build/components/Form/useFormNode.hook.js +16 -0
  63. package/build/components/Heading/Heading.component.d.ts +6 -0
  64. package/build/components/Heading/Heading.component.js +13 -0
  65. package/build/components/Heading/Heading.stories.d.ts +5 -0
  66. package/build/components/Heading/Heading.stories.js +7 -0
  67. package/build/components/ImageUpload/ImageUpload.component.d.ts +11 -0
  68. package/build/components/ImageUpload/ImageUpload.component.js +92 -0
  69. package/build/components/ImageUpload/ImageUpload.stories.d.ts +8 -0
  70. package/build/components/ImageUpload/ImageUpload.stories.js +49 -0
  71. package/build/components/InlineCard/InlineCard.component.d.ts +10 -0
  72. package/build/components/InlineCard/InlineCard.component.js +20 -0
  73. package/build/components/InlineCard/InlineCard.stories.d.ts +5 -0
  74. package/build/components/InlineCard/InlineCard.stories.js +17 -0
  75. package/build/components/InlineCard/InlineCardGroup.component.d.ts +6 -0
  76. package/build/components/InlineCard/InlineCardGroup.component.js +17 -0
  77. package/build/components/InlineCard/_InlineCardContent.component.d.ts +6 -0
  78. package/build/components/InlineCard/_InlineCardContent.component.js +15 -0
  79. package/build/components/InlineCard/_InlineCardMedia.component.d.ts +6 -0
  80. package/build/components/InlineCard/_InlineCardMedia.component.js +17 -0
  81. package/build/components/Input/Input.component.d.ts +11 -0
  82. package/build/components/Input/Input.component.js +57 -0
  83. package/build/components/Input/Input.stories.d.ts +6 -0
  84. package/build/components/Input/Input.stories.js +12 -0
  85. package/build/components/LiveInput/LiveInput.component.d.ts +10 -0
  86. package/build/components/LiveInput/LiveInput.component.js +22 -0
  87. package/build/components/LiveInput/LiveInput.stories.d.ts +6 -0
  88. package/build/components/LiveInput/LiveInput.stories.js +12 -0
  89. package/build/components/Loader/Loader.component.d.ts +3 -0
  90. package/build/components/Loader/Loader.component.js +48 -0
  91. package/build/components/Loader/Loader.stories.d.ts +5 -0
  92. package/build/components/Loader/Loader.stories.js +9 -0
  93. package/build/components/Menu/Menu.component.d.ts +13 -0
  94. package/build/components/Menu/Menu.component.js +26 -0
  95. package/build/components/Menu/Menu.stories.d.ts +7 -0
  96. package/build/components/Menu/Menu.stories.js +98 -0
  97. package/build/components/Menu/_MenuContent.component.d.ts +10 -0
  98. package/build/components/Menu/_MenuContent.component.js +31 -0
  99. package/build/components/Menu/_MenuContent.context.d.ts +7 -0
  100. package/build/components/Menu/_MenuContent.context.js +6 -0
  101. package/build/components/Menu/_MenuHeading.component.d.ts +6 -0
  102. package/build/components/Menu/_MenuHeading.component.js +27 -0
  103. package/build/components/Menu/_MenuItem.component.d.ts +10 -0
  104. package/build/components/Menu/_MenuItem.component.js +50 -0
  105. package/build/components/Menu/_MenuPage.component.d.ts +6 -0
  106. package/build/components/Menu/_MenuPage.component.js +39 -0
  107. package/build/components/Menu/_MenuPanel.component.d.ts +6 -0
  108. package/build/components/Menu/_MenuPanel.component.js +62 -0
  109. package/build/components/Menu/menu.helpers.d.ts +4 -0
  110. package/build/components/Menu/menu.helpers.js +10 -0
  111. package/build/components/Modal/Modal.component.d.ts +14 -0
  112. package/build/components/Modal/Modal.component.js +100 -0
  113. package/build/components/Modal/Modal.stories.d.ts +6 -0
  114. package/build/components/Modal/Modal.stories.js +55 -0
  115. package/build/components/Modal/_Modal.context.d.ts +6 -0
  116. package/build/components/Modal/_Modal.context.js +6 -0
  117. package/build/components/Modal/_ModalBody.component.d.ts +2 -0
  118. package/build/components/Modal/_ModalBody.component.js +5 -0
  119. package/build/components/Modal/_ModalHeader.component.d.ts +7 -0
  120. package/build/components/Modal/_ModalHeader.component.js +54 -0
  121. package/build/components/Notification/Notification.component.d.ts +6 -0
  122. package/build/components/Notification/Notification.component.js +15 -0
  123. package/build/components/Notification/Notification.stories.d.ts +8 -0
  124. package/build/components/Notification/Notification.stories.js +28 -0
  125. package/build/components/Notifications/Notifications.component.d.ts +15 -0
  126. package/build/components/Notifications/Notifications.component.js +37 -0
  127. package/build/components/Notifications/Notifications.stories.d.ts +7 -0
  128. package/build/components/Notifications/Notifications.stories.js +99 -0
  129. package/build/components/ProfileImage/ProfileImage.component.d.ts +7 -0
  130. package/build/components/ProfileImage/ProfileImage.component.js +53 -0
  131. package/build/components/ProfileImage/ProfileImage.stories.d.ts +6 -0
  132. package/build/components/ProfileImage/ProfileImage.stories.js +8 -0
  133. package/build/components/QrCode/QrCode.component.d.ts +6 -0
  134. package/build/components/QrCode/QrCode.component.js +71 -0
  135. package/build/components/QrCode/QrCode.stories.d.ts +5 -0
  136. package/build/components/QrCode/QrCode.stories.js +8 -0
  137. package/build/components/Spacer/Spacer.component.d.ts +7 -0
  138. package/build/components/Spacer/Spacer.component.js +25 -0
  139. package/build/components/SquareButton/SquareButton.component.d.ts +9 -0
  140. package/build/components/SquareButton/SquareButton.component.js +31 -0
  141. package/build/components/SquareButton/SquareButton.stories.d.ts +5 -0
  142. package/build/components/SquareButton/SquareButton.stories.js +14 -0
  143. package/build/components/SubHeading/SubHeading.component.d.ts +2 -0
  144. package/build/components/SubHeading/SubHeading.component.js +11 -0
  145. package/build/components/SubHeading/SubHeading.stories.d.ts +5 -0
  146. package/build/components/SubHeading/SubHeading.stories.js +7 -0
  147. package/build/components/Table/Table.component.d.ts +16 -0
  148. package/build/components/Table/Table.component.js +24 -0
  149. package/build/components/Table/Table.stories.d.ts +7 -0
  150. package/build/components/Table/Table.stories.js +39 -0
  151. package/build/components/Table/_Table.context.d.ts +7 -0
  152. package/build/components/Table/_Table.context.js +5 -0
  153. package/build/components/Table/_TableRow.component.d.ts +6 -0
  154. package/build/components/Table/_TableRow.component.js +17 -0
  155. package/build/components/Text/Text.component.d.ts +8 -0
  156. package/build/components/Text/Text.component.js +26 -0
  157. package/build/components/Text/Text.stories.d.ts +6 -0
  158. package/build/components/Text/Text.stories.js +11 -0
  159. package/build/constants/zIndex.constants.d.ts +6 -0
  160. package/build/constants/zIndex.constants.js +5 -0
  161. package/build/contexts/File.context.d.ts +7 -0
  162. package/build/contexts/File.context.js +8 -0
  163. package/build/examples/Modal.stories.d.ts +5 -0
  164. package/build/examples/Modal.stories.js +37 -0
  165. package/build/global/BodyStyle.component.d.ts +2 -0
  166. package/build/global/BodyStyle.component.js +16 -0
  167. package/build/hooks/useForm.d.ts +7 -0
  168. package/build/hooks/useForm.js +20 -0
  169. package/build/index.d.ts +47 -0
  170. package/build/index.js +43 -0
  171. package/build/layouts/Action/Action.layout.d.ts +17 -0
  172. package/build/layouts/Action/Action.layout.js +45 -0
  173. package/build/layouts/Action/Action.stories.d.ts +6 -0
  174. package/build/layouts/Action/Action.stories.js +14 -0
  175. package/build/layouts/Centered/Centered.layout.d.ts +2 -0
  176. package/build/layouts/Centered/Centered.layout.js +6 -0
  177. package/build/layouts/Centered/Centered.stories.d.ts +5 -0
  178. package/build/layouts/Centered/Centered.stories.js +8 -0
  179. package/build/layouts/Column/Column.layout.d.ts +6 -0
  180. package/build/layouts/Column/Column.layout.js +5 -0
  181. package/build/layouts/Column/Column.stories.d.ts +5 -0
  182. package/build/layouts/Column/Column.stories.js +8 -0
  183. package/build/layouts/Content/Content.layout.d.ts +10 -0
  184. package/build/layouts/Content/Content.layout.js +11 -0
  185. package/build/layouts/Content/Content.stories.d.ts +9 -0
  186. package/build/layouts/Content/Content.stories.js +37 -0
  187. package/build/layouts/Content/_ContentContent.component.d.ts +8 -0
  188. package/build/layouts/Content/_ContentContent.component.js +29 -0
  189. package/build/layouts/Content/_ContentHeader.component.d.ts +7 -0
  190. package/build/layouts/Content/_ContentHeader.component.js +17 -0
  191. package/build/layouts/Emphasis/Emphasis.layout.d.ts +6 -0
  192. package/build/layouts/Emphasis/Emphasis.layout.js +39 -0
  193. package/build/layouts/Focus/Focus.layout.d.ts +6 -0
  194. package/build/layouts/Focus/Focus.layout.js +28 -0
  195. package/build/layouts/Focus/Focus.stories.d.ts +5 -0
  196. package/build/layouts/Focus/Focus.stories.js +16 -0
  197. package/build/layouts/Padded/Padded.layout.d.ts +9 -0
  198. package/build/layouts/Padded/Padded.layout.js +11 -0
  199. package/build/layouts/Padded/Padded.stories.d.ts +6 -0
  200. package/build/layouts/Padded/Padded.stories.js +10 -0
  201. package/build/responsive/responsive.d.ts +13 -0
  202. package/build/responsive/responsive.js +63 -0
  203. package/build/screens/Login/Login.screen.d.ts +13 -0
  204. package/build/screens/Login/Login.screen.js +60 -0
  205. package/build/screens/Register/Register.screen.d.ts +12 -0
  206. package/build/screens/Register/Register.screen.js +32 -0
  207. package/build/screens/Verification/Verification.screen.d.ts +12 -0
  208. package/build/screens/Verification/Verification.screen.js +39 -0
  209. package/build/theme/dark.theme.d.ts +3 -0
  210. package/build/theme/dark.theme.js +73 -0
  211. package/build/theme/default.theme.d.ts +3 -0
  212. package/build/theme/default.theme.js +74 -0
  213. package/build/theme/helpers/getThemeControlColours.d.ts +10 -0
  214. package/build/theme/helpers/getThemeControlColours.js +10 -0
  215. package/build/theme/helpers/getThemeStatusColour.d.ts +4 -0
  216. package/build/theme/helpers/getThemeStatusColour.js +14 -0
  217. package/build/theme/helpers/getThemeVariantColours.d.ts +8 -0
  218. package/build/theme/helpers/getThemeVariantColours.js +23 -0
  219. package/build/theme/theme.types.d.ts +2 -0
  220. package/build/theme/theme.types.js +1 -0
  221. package/build/theme/themes.d.ts +5 -0
  222. package/build/theme/themes.js +7 -0
  223. package/package.json +65 -0
@@ -0,0 +1,21 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, ControlGroup, Form, Input } from '../..';
3
+ /* eslint-disable @typescript-eslint/no-empty-function */
4
+ export const Standard = () => {
5
+ const [value, setValue] = useState({ name: 'Frightened Kangaroo', colour: 'Red' });
6
+ return (React.createElement(React.Fragment, null,
7
+ React.createElement(Form, { value: value, onChange: setValue },
8
+ React.createElement(ControlGroup, { variation: 'submission' },
9
+ React.createElement(Input, { name: 'name', placeholder: 'name' }),
10
+ React.createElement(Input, { name: 'colour', placeholder: 'colour' }),
11
+ React.createElement(ControlGroup.Spacer, null),
12
+ React.createElement(Button, null, "Next"))),
13
+ React.createElement("br", null),
14
+ React.createElement("br", null),
15
+ React.createElement("br", null),
16
+ React.createElement("div", null, JSON.stringify(value))));
17
+ };
18
+ export default {
19
+ title: 'Components/Form',
20
+ component: Form,
21
+ };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ interface FormStateContextProps {
3
+ value: Record<string, any>;
4
+ onChange?: (key: string, value: any) => void;
5
+ }
6
+ declare const FormStateContext: import("react").Context<FormStateContextProps>;
7
+ export default FormStateContext;
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+ const FormStateContext = createContext({
3
+ value: {},
4
+ onChange: undefined,
5
+ });
6
+ export default FormStateContext;
@@ -0,0 +1,5 @@
1
+ declare function useFormNode(key: string): {
2
+ value: any;
3
+ onChange: (_value: any) => void;
4
+ };
5
+ export default useFormNode;
@@ -0,0 +1,16 @@
1
+ import { useContext } from 'react';
2
+ import FormStateContext from './FormState.context';
3
+ function useFormNode(key) {
4
+ const { value, onChange } = useContext(FormStateContext);
5
+ const internalOnChange = (_value) => {
6
+ if (onChange) {
7
+ onChange(key, _value);
8
+ }
9
+ };
10
+ const internalValue = value[key];
11
+ return {
12
+ value: internalValue,
13
+ onChange: internalOnChange,
14
+ };
15
+ }
16
+ export default useFormNode;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface HeadingProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const Heading: ({ children }: HeadingProps) => JSX.Element;
6
+ export default Heading;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ const HeadingContainer = styled.h2 `
4
+ font-family: ${(props) => props.theme.fonts.heading.family};
5
+ font-size: ${(props) => props.theme.fonts.heading.size};
6
+ font-weight: ${(props) => props.theme.fonts.heading.weight};
7
+
8
+ color: ${(props) => props.theme.colours.defaultFont};
9
+
10
+ margin: 0;
11
+ `;
12
+ const Heading = ({ children }) => React.createElement(HeadingContainer, null, children);
13
+ export default Heading;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { Meta } from '@storybook/react/types-6-0';
3
+ export declare const Standard: () => JSX.Element;
4
+ declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
5
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { Heading } from '../..';
3
+ export const Standard = () => React.createElement(Heading, null, "A Standard Heading");
4
+ export default {
5
+ title: 'Components/Heading',
6
+ component: Heading,
7
+ };
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ export declare type ImageUploadMode = 'fill' | 'form';
3
+ interface ImageUploadProps {
4
+ name: string;
5
+ value?: string;
6
+ onChange?: (value: string) => void;
7
+ onSearch?: () => void;
8
+ uploadFn?: (file: File) => Promise<string>;
9
+ }
10
+ declare const ImageUpload: ({ name, value, onChange, onSearch }: ImageUploadProps) => JSX.Element;
11
+ export default ImageUpload;
@@ -0,0 +1,92 @@
1
+ import React, { useContext, useRef } from 'react';
2
+ import { faCloudUploadAlt, faSearch } from '@fortawesome/free-solid-svg-icons';
3
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
+ import styled from 'styled-components';
5
+ import { motion } from 'framer-motion';
6
+ import FileContext from '../../contexts/File.context';
7
+ import useFormNode from '../Form/useFormNode.hook';
8
+ const UploadContainer = styled.div `
9
+ position: relative;
10
+ min-height: 144px;
11
+ background-color: ${(props) => props.theme.colours.uploadBackground};
12
+
13
+ height: 100%;
14
+ width: 100%;
15
+
16
+ font-size: 48px;
17
+ color: ${(props) => props.theme.colours.uploadIcon};
18
+ `;
19
+ const UploadInnerContainer = styled.div `
20
+ height: 100%;
21
+ min-height: 144px;
22
+ width: 100%;
23
+ display: flex;
24
+ justify-content: space-evenly;
25
+ `;
26
+ const IconContainer = styled(motion.div) `
27
+ flex-grow: 1;
28
+ margin: 8px;
29
+
30
+ display: flex;
31
+ justify-content: space-evenly;
32
+ align-items: center;
33
+ cursor: pointer;
34
+ `;
35
+ const UploadVerticalDivider = styled.div `
36
+ margin: 8px 0;
37
+ width: 2px;
38
+ height: calc(100% - 16px);
39
+ min-height: calc(144px - 16px);
40
+ top: 10%;
41
+ background-color: ${(props) => props.theme.colours.uploadIcon};
42
+ `;
43
+ const HiddenInput = styled.input `
44
+ width: 0;
45
+ height: 0;
46
+ visibility: none;
47
+
48
+ position: fixed;
49
+ left: -99999;
50
+ top: -99999;
51
+ `;
52
+ const Image = styled.img `
53
+ width: 100%;
54
+ height: 100%;
55
+ object-fit: cover;
56
+ `;
57
+ const ImageUpload = ({ name, value, onChange, onSearch }) => {
58
+ const { upload, getUrl } = useContext(FileContext);
59
+ const { value: contextValue, onChange: contextOnChange } = useFormNode(name);
60
+ const inputRef = useRef();
61
+ const handleUploadClicked = () => {
62
+ if (inputRef && inputRef.current) {
63
+ inputRef.current.click();
64
+ }
65
+ };
66
+ const handleUpload = async (event) => {
67
+ if (event.target.files && upload) {
68
+ const file = event.target.files[0];
69
+ const url = await upload(file);
70
+ if (onChange) {
71
+ onChange(url);
72
+ }
73
+ if (contextOnChange) {
74
+ contextOnChange({ target: { value: url } });
75
+ }
76
+ }
77
+ };
78
+ const internalValue = value ? value : contextValue;
79
+ if (!internalValue) {
80
+ return (React.createElement(UploadContainer, null,
81
+ React.createElement(UploadInnerContainer, null,
82
+ React.createElement(IconContainer, { whileHover: { scale: 1.05 }, onClick: handleUploadClicked },
83
+ React.createElement(FontAwesomeIcon, { icon: faCloudUploadAlt })),
84
+ onSearch && (React.createElement(React.Fragment, null,
85
+ React.createElement(UploadVerticalDivider, null),
86
+ React.createElement(IconContainer, { whileHover: { scale: 1.05 }, onClick: onSearch },
87
+ React.createElement(FontAwesomeIcon, { icon: faSearch }))))),
88
+ React.createElement(HiddenInput, { value: '', ref: inputRef, type: 'file', onChange: handleUpload })));
89
+ }
90
+ return React.createElement(Image, { src: getUrl(internalValue) });
91
+ };
92
+ export default ImageUpload;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Meta } from '@storybook/react/types-6-0';
3
+ export declare const FillMode: () => JSX.Element;
4
+ export declare const WithAnImage: () => JSX.Element;
5
+ export declare const InALayout: () => JSX.Element;
6
+ export declare const InACard: () => JSX.Element;
7
+ declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
8
+ export default _default;
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Button, Card, CardGroup, ControlGroup, FocusLayout, Heading, ImageUpload, LiveInput, Spacer, Text, } from '../..';
4
+ import colours from '../../colours/colours';
5
+ import FileContext from '../../contexts/File.context';
6
+ const CentreContainer = styled.div `
7
+ display: flex;
8
+ width: 100%;
9
+ justify-content: center;
10
+ `;
11
+ const InnerContainer = styled.div `
12
+ width: 200px;
13
+ height: 200px;
14
+ `;
15
+ export const FillMode = () => (React.createElement(React.Fragment, null,
16
+ React.createElement("div", { style: { width: '600px', height: '300px', padding: '30px', backgroundColor: colours.grey20 } },
17
+ React.createElement(ImageUpload, { name: 'profile' }))));
18
+ export const WithAnImage = () => (React.createElement(React.Fragment, null,
19
+ React.createElement("div", { style: { width: '600px', height: '300px', padding: '30px', backgroundColor: colours.grey20 } },
20
+ React.createElement(FileContext.Provider, { value: { upload: async () => 'done', getUrl: (url) => url } },
21
+ React.createElement(ImageUpload, { name: 'profile', value: 'https://www.jotform.com/blog/wp-content/uploads/2012/07/mario-luigi-yoschi-figures-163036.jpeg' })))));
22
+ export const InALayout = () => (React.createElement(FocusLayout, null,
23
+ React.createElement(Heading, null, "Lets get setup.."),
24
+ React.createElement(Spacer, { size: '4x' }),
25
+ React.createElement(ControlGroup, { variation: 'submission' },
26
+ React.createElement(Text, null, "Lets upload your profile image. This will be the first thing that people see when connecting with you."),
27
+ React.createElement(ControlGroup.Spacer, null),
28
+ React.createElement(CentreContainer, null,
29
+ React.createElement(InnerContainer, null,
30
+ React.createElement(ImageUpload, { name: 'profile' }))),
31
+ React.createElement(ControlGroup.Spacer, null),
32
+ React.createElement(Button, null, "Next"))));
33
+ export const InACard = () => (React.createElement(CardGroup, null,
34
+ React.createElement(Card, { size: 'sm' },
35
+ React.createElement(Card.Media, null,
36
+ React.createElement(ImageUpload, { name: 'profile' })),
37
+ React.createElement(Card.Content, null,
38
+ React.createElement(LiveInput, { name: 'name', placeholder: 'Name' }))),
39
+ React.createElement(Card, { size: 'sm' },
40
+ React.createElement(Card.Media, null,
41
+ React.createElement(ImageUpload, { name: 'profile', onSearch: () => {
42
+ console.log('search');
43
+ } })),
44
+ React.createElement(Card.Content, null,
45
+ React.createElement(LiveInput, { name: 'name', placeholder: 'Name' })))));
46
+ export default {
47
+ title: 'Components/ImageUpload',
48
+ component: ImageUpload,
49
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface InlineCardProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const InlineCard: {
6
+ ({ children, onClick }: InlineCardProps): JSX.Element;
7
+ Media: ({ children }: import("./_InlineCardMedia.component").InlineCardMediaProps) => JSX.Element;
8
+ Content: ({ children }: import("./_InlineCardContent.component").InlineCardContentProps) => JSX.Element;
9
+ };
10
+ export default InlineCard;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import InlineCardContent from './_InlineCardContent.component';
4
+ import InlineCardMedia from './_InlineCardMedia.component';
5
+ const CardOuter = styled.div `
6
+ height: 64px;
7
+ width: 100%;
8
+ display: flex;
9
+
10
+ cursor: ${(props) => (props.usePointer ? 'pointer' : '')};
11
+
12
+ background-color: ${(props) => props.theme.colours.cardBackground};
13
+ box-shadow: ${(props) => props.theme.shadows.small};
14
+ `;
15
+ const InlineCard = ({ children, onClick }) => {
16
+ return (React.createElement(CardOuter, { usePointer: !!onClick, onClick: onClick }, children));
17
+ };
18
+ InlineCard.Media = InlineCardMedia;
19
+ InlineCard.Content = InlineCardContent;
20
+ export default InlineCard;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { Meta } from '@storybook/react/types-6-0';
3
+ export declare const Standard: () => JSX.Element;
4
+ declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
5
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { InlineCard, InlineCardGroup } from '../..';
3
+ export const Standard = () => (React.createElement(InlineCardGroup, null,
4
+ React.createElement(InlineCard, null,
5
+ React.createElement(InlineCard.Content, null, "Some content")),
6
+ React.createElement(InlineCard, null,
7
+ React.createElement(InlineCard.Media, null,
8
+ React.createElement("img", { src: 'https://www.jotform.com/blog/wp-content/uploads/2012/07/mario-luigi-yoschi-figures-163036.jpeg' })),
9
+ React.createElement(InlineCard.Content, null, "Some more content")),
10
+ React.createElement(InlineCard, { onClick: () => {
11
+ console.log('Clicked');
12
+ } },
13
+ React.createElement(InlineCard.Content, null, "Clickable card"))));
14
+ export default {
15
+ title: 'Components/InlineCard',
16
+ component: InlineCard,
17
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface InlineCardGroupProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const InlineCardGroup: ({ children }: InlineCardGroupProps) => JSX.Element;
6
+ export default InlineCardGroup;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ const InlineGroup = styled.div `
4
+ display: flex;
5
+ flex-direction: column;
6
+ align-items: center;
7
+
8
+ & > * {
9
+ margin-bottom: 8px;
10
+
11
+ &:last-child {
12
+ margin-bottom: 0;
13
+ }
14
+ }
15
+ `;
16
+ const InlineCardGroup = ({ children }) => React.createElement(InlineGroup, null, children);
17
+ export default InlineCardGroup;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface InlineCardContentProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const InlineCardContent: ({ children }: InlineCardContentProps) => JSX.Element;
6
+ export default InlineCardContent;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ const ContentContainer = styled.div `
4
+ height: 100%;
5
+ padding: 8px;
6
+
7
+ font-family: ${(props) => props.theme.fonts.default.family};
8
+ font-weight: ${(props) => props.theme.fonts.default.weight};
9
+ font-size: ${(props) => props.theme.fonts.default.size};
10
+ color: ${(props) => props.theme.colours.defaultFont};
11
+ `;
12
+ const InlineCardContent = ({ children }) => {
13
+ return React.createElement(ContentContainer, null, children);
14
+ };
15
+ export default InlineCardContent;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface InlineCardMediaProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const InlineCardMedia: ({ children }: InlineCardMediaProps) => JSX.Element;
6
+ export default InlineCardMedia;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ const MediaContainer = styled.div `
4
+ width: 128px;
5
+ min-width: 128px;
6
+ height: 64px;
7
+
8
+ img {
9
+ width: 100%;
10
+ height: 100%;
11
+ object-fit: cover;
12
+ }
13
+ `;
14
+ const InlineCardMedia = ({ children }) => {
15
+ return React.createElement(MediaContainer, null, children);
16
+ };
17
+ export default InlineCardMedia;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ export interface IInputProps {
3
+ name: string;
4
+ label?: string;
5
+ placeholder?: string;
6
+ type?: string;
7
+ value?: string;
8
+ onChange?: (value: any) => void;
9
+ }
10
+ declare const Input: ({ label, name, placeholder, type, value, onChange }: IInputProps) => JSX.Element;
11
+ export default Input;
@@ -0,0 +1,57 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
2
+ import React from 'react';
3
+ import styled from 'styled-components';
4
+ import getThemeControlColours from '../../theme/helpers/getThemeControlColours';
5
+ import useFormNode from '../Form/useFormNode.hook';
6
+ const InputLabel = styled.label `
7
+ display: block;
8
+ padding-bottom: 8px;
9
+
10
+ color: ${(props) => getThemeControlColours(props.theme).font};
11
+ font-family: ${(props) => props.theme.fonts.default.family};
12
+ font-size: ${(props) => props.theme.fonts.default.size};
13
+ `;
14
+ const StyledInput = styled.input `
15
+ outline: none;
16
+ box-shadow: none;
17
+
18
+ width: 100%;
19
+ height: 48px;
20
+ padding: 0 12px;
21
+
22
+ font-family: ${(props) => props.theme.fonts.default.family};
23
+ font-size: ${(props) => props.theme.fonts.default.size};
24
+
25
+ color: ${(props) => getThemeControlColours(props.theme).font};
26
+ background-color: ${(props) => getThemeControlColours(props.theme).background};
27
+
28
+ border: 1px solid ${(props) => getThemeControlColours(props.theme).border};
29
+ border-radius: 2px;
30
+
31
+ &:hover {
32
+ border: 1px solid ${(props) => getThemeControlColours(props.theme).borderHover};
33
+ }
34
+
35
+ &:focus {
36
+ border: 1px solid ${(props) => getThemeControlColours(props.theme).borderFocus};
37
+ }
38
+
39
+ &::placeholder {
40
+ color: ${(props) => getThemeControlColours(props.theme).placeholder};
41
+ }
42
+ `;
43
+ const Input = ({ label, name, placeholder, type = 'text', value, onChange }) => {
44
+ const { value: contextValue, onChange: contextOnChange } = useFormNode(name);
45
+ const handleChange = (e) => {
46
+ if (onChange) {
47
+ onChange(e.target.value);
48
+ }
49
+ if (contextOnChange) {
50
+ contextOnChange(e.target.value);
51
+ }
52
+ };
53
+ return (React.createElement("div", null,
54
+ label && React.createElement(InputLabel, { htmlFor: name }, label),
55
+ React.createElement(StyledInput, { type: type, name: name, placeholder: placeholder, value: value || contextValue, onChange: handleChange })));
56
+ };
57
+ export default Input;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { Meta } from '@storybook/react/types-6-0';
3
+ export declare const Standard: () => JSX.Element;
4
+ export declare const WithoutLabels: () => JSX.Element;
5
+ declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
6
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Input, ControlGroup } from '../..';
3
+ export const Standard = () => (React.createElement(ControlGroup, null,
4
+ React.createElement(Input, { name: 'one', label: 'A standard input' }),
5
+ React.createElement(Input, { name: 'two', label: 'Another input' })));
6
+ export const WithoutLabels = () => (React.createElement(ControlGroup, null,
7
+ React.createElement(Input, { name: 'one', placeholder: 'A standard input' }),
8
+ React.createElement(Input, { name: 'two', placeholder: 'Another input' })));
9
+ export default {
10
+ title: 'Components/Input',
11
+ component: Input,
12
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface LiveInputProps {
3
+ name: string;
4
+ placeholder: string;
5
+ type?: string;
6
+ value?: string;
7
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
8
+ }
9
+ declare const LiveInput: ({ name, type, placeholder, value, onChange }: LiveInputProps) => JSX.Element;
10
+ export default LiveInput;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import useFormNode from '../Form/useFormNode.hook';
4
+ const StyledInput = styled.input `
5
+ height: 18px;
6
+ font-size: 18px;
7
+ background-color: transparent;
8
+
9
+ border: none;
10
+ outline: none;
11
+ color: ${(props) => props.theme.colours.defaultFont};
12
+
13
+ &::placeholder {
14
+ color: ${(props) => props.theme.colours.controlPlaceholder};
15
+ }
16
+ `;
17
+ const LiveInput = ({ name, type = 'text', placeholder, value, onChange }) => {
18
+ const { value: contextValue, onChange: contextOnChange } = useFormNode(name);
19
+ return (React.createElement("div", null,
20
+ React.createElement(StyledInput, { name: name, type: type, value: value || contextValue, placeholder: placeholder, onChange: onChange || contextOnChange })));
21
+ };
22
+ export default LiveInput;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { Meta } from '@storybook/react/types-6-0';
3
+ export declare const Standard: () => JSX.Element;
4
+ export declare const WithoutLabels: () => JSX.Element;
5
+ declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
6
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { LiveInput, ControlGroup } from '../..';
3
+ export const Standard = () => (React.createElement(ControlGroup, null,
4
+ React.createElement(LiveInput, { name: 'one', placeholder: 'Some text..' }),
5
+ React.createElement(LiveInput, { name: 'two', placeholder: 'Some text..' })));
6
+ export const WithoutLabels = () => (React.createElement(ControlGroup, null,
7
+ React.createElement(LiveInput, { name: 'one', placeholder: 'A standard input' }),
8
+ React.createElement(LiveInput, { name: 'two', placeholder: 'Another input' })));
9
+ export default {
10
+ title: 'Components/LiveInput',
11
+ component: LiveInput,
12
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Loader: () => JSX.Element;
3
+ export default Loader;
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import { motion } from 'framer-motion';
3
+ import colours from '../../colours/colours';
4
+ const loadingContainer = {
5
+ width: '40px',
6
+ height: '26px',
7
+ display: 'flex',
8
+ justifyContent: 'space-around',
9
+ };
10
+ const loadingCircle = {
11
+ display: 'block',
12
+ width: '10px',
13
+ height: '10px',
14
+ backgroundColor: colours.grey30,
15
+ borderRadius: '5px',
16
+ };
17
+ const loadingContainerVariants = {
18
+ start: {
19
+ transition: {
20
+ staggerChildren: 0.2,
21
+ },
22
+ },
23
+ end: {
24
+ transition: {
25
+ staggerChildren: 0.2,
26
+ },
27
+ },
28
+ };
29
+ const loadingCircleVariants = {
30
+ start: {
31
+ y: '0%',
32
+ },
33
+ end: {
34
+ y: '150%',
35
+ },
36
+ };
37
+ const loadingCircleTransition = {
38
+ duration: 0.5,
39
+ yoyo: Infinity,
40
+ ease: 'easeInOut',
41
+ };
42
+ const Loader = () => {
43
+ return (React.createElement(motion.div, { style: loadingContainer, variants: loadingContainerVariants, initial: 'start', animate: 'end' },
44
+ React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition }),
45
+ React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition }),
46
+ React.createElement(motion.span, { style: loadingCircle, variants: loadingCircleVariants, transition: loadingCircleTransition })));
47
+ };
48
+ export default Loader;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { Meta } from '@storybook/react/types-6-0';
3
+ export declare const Standard: () => JSX.Element;
4
+ declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
5
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { Loader } from '../..';
3
+ export const Standard = () => {
4
+ return React.createElement(Loader, null);
5
+ };
6
+ export default {
7
+ title: 'Components/Loader',
8
+ component: Loader,
9
+ };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export interface MenuProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const Menu: {
6
+ ({ children }: MenuProps): JSX.Element;
7
+ Page: ({ children }: import("./_MenuPage.component").MenuPageProps) => JSX.Element;
8
+ Heading: ({ children }: import("./_MenuHeading.component").MenuHeadingProps) => JSX.Element;
9
+ Item: ({ children, icon, active, onClick }: import("./_MenuItem.component").MenuItemProps) => JSX.Element;
10
+ Content: ({ panelSize, independentScroll, children }: import("./_MenuContent.component").MenuContentProps) => JSX.Element;
11
+ Panel: ({ children }: import("./_MenuPanel.component").MenuPanelProps) => JSX.Element;
12
+ };
13
+ export default Menu;