@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,64 @@
1
+ import React from 'react';
2
+ import { Card, CardGroup, LiveInput, Badge } from '../..';
3
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
+ import { faPen, faTrash } from '@fortawesome/free-solid-svg-icons';
5
+ export const Standard = () => (React.createElement(CardGroup, null,
6
+ React.createElement(Card, { size: 'sm' },
7
+ React.createElement(Card.Content, null, "Some content"),
8
+ React.createElement(Card.Spacer, null),
9
+ React.createElement(Card.Content, null, "Some more content..."),
10
+ React.createElement(Card.Spacer, null),
11
+ React.createElement(Card.SubContent, null, "Some sub content...")),
12
+ React.createElement(Card, { size: 'sm' },
13
+ React.createElement(Card.Media, null,
14
+ React.createElement("img", { src: 'https://www.jotform.com/blog/wp-content/uploads/2012/07/mario-luigi-yoschi-figures-163036.jpeg' })),
15
+ React.createElement(Card.Content, null,
16
+ React.createElement(LiveInput, { name: 'test', placeholder: 'Name of characters' })))));
17
+ export const Sizes = () => (React.createElement(CardGroup, null,
18
+ React.createElement(Card, { size: 'sm' },
19
+ React.createElement(Card.Media, null,
20
+ React.createElement("img", { src: 'https://www.jotform.com/blog/wp-content/uploads/2012/07/mario-luigi-yoschi-figures-163036.jpeg' })),
21
+ React.createElement(Card.Content, null, "A small card!")),
22
+ React.createElement(Card, { size: 'md' },
23
+ React.createElement(Card.Media, null,
24
+ React.createElement("img", { src: 'https://www.jotform.com/blog/wp-content/uploads/2012/07/mario-luigi-yoschi-figures-163036.jpeg' })),
25
+ React.createElement(Card.Content, null, "A medium card..")),
26
+ React.createElement(Card, { size: 'lg' },
27
+ React.createElement(Card.Media, null,
28
+ React.createElement("img", { src: 'https://www.jotform.com/blog/wp-content/uploads/2012/07/mario-luigi-yoschi-figures-163036.jpeg' })),
29
+ React.createElement(Card.Content, null, "A large card."))));
30
+ export const CardHeader = () => (React.createElement(CardGroup, null,
31
+ React.createElement(Card, { size: 'sm' },
32
+ React.createElement(Card.Header, { image: 'https://www.jotform.com/blog/wp-content/uploads/2012/07/mario-luigi-yoschi-figures-163036.jpeg', heading: 'Mario & Luigi', subHeading: 'mario@gmail.com', meta: React.createElement(Badge, { variant: 'success' }, "approved") }),
33
+ React.createElement(Card.Content, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."),
34
+ React.createElement(Card.Content, null, "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.")),
35
+ React.createElement(Card, { size: 'sm' },
36
+ React.createElement(Card.Header, { heading: 'Mario & Luigi', subHeading: 'mario@gmail.com', meta: React.createElement(Badge, { variant: 'success' }, "approved") }),
37
+ React.createElement(Card.Content, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."),
38
+ React.createElement(Card.Content, null, "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."))));
39
+ export const Clickable = () => (React.createElement(CardGroup, null,
40
+ React.createElement(Card, { size: 'sm', onClick: () => console.log('test') },
41
+ React.createElement(Card.Content, null, "Some content"),
42
+ React.createElement(Card.Spacer, null),
43
+ React.createElement(Card.Content, null, "Some more content..."),
44
+ React.createElement(Card.Spacer, null),
45
+ React.createElement(Card.SubContent, null, "Some sub content..."))));
46
+ export const WithActions = () => (React.createElement(React.Fragment, null,
47
+ React.createElement("br", null),
48
+ React.createElement("br", null),
49
+ React.createElement(CardGroup, null,
50
+ React.createElement(Card, { size: 'sm', onClick: () => console.log('Card Clicked') },
51
+ React.createElement(Card.Actions, null,
52
+ React.createElement(Card.Action, { onClick: () => console.log('Edit Clicked') },
53
+ React.createElement(FontAwesomeIcon, { icon: faPen })),
54
+ React.createElement(Card.Action, { onClick: () => console.log('Delete Clicked') },
55
+ React.createElement(FontAwesomeIcon, { icon: faTrash }))),
56
+ React.createElement(Card.Content, null, "Some content"),
57
+ React.createElement(Card.Spacer, null),
58
+ React.createElement(Card.Content, null, "Some more content..."),
59
+ React.createElement(Card.Spacer, null),
60
+ React.createElement(Card.SubContent, null, "Some sub content...")))));
61
+ export default {
62
+ title: 'Components/Card',
63
+ component: Card,
64
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface CardGroupProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const CardGroup: {
6
+ ({ children }: CardGroupProps): JSX.Element;
7
+ Small: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
8
+ };
9
+ export default CardGroup;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ const GroupSmall = 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 Group = styled.div `
17
+ display: flex;
18
+ flex-direction: column;
19
+ align-items: center;
20
+
21
+ & > * {
22
+ margin-bottom: 16px;
23
+
24
+ &:last-child {
25
+ margin-bottom: 0;
26
+ }
27
+ }
28
+ `;
29
+ const CardGroup = ({ children }) => React.createElement(Group, null, children);
30
+ CardGroup.Small = GroupSmall;
31
+ export default CardGroup;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface CardActionsProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare const CardActions: ({ children }: CardActionsProps) => React.ReactPortal | null;
6
+ export interface CardActionProps {
7
+ children: React.ReactNode;
8
+ onClick?: () => void;
9
+ }
10
+ export declare const CardAction: ({ children, onClick }: CardActionProps) => JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { AnimatePresence, motion } from 'framer-motion';
2
+ import React, { useContext } from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import styled from 'styled-components';
5
+ import CardContext from './Card.context';
6
+ const actionsHeight = 32;
7
+ const ActionsContainer = styled(motion.div) `
8
+ display: flex;
9
+ padding: 0 8px;
10
+
11
+ cursor: default;
12
+ `;
13
+ const ActionContainer = styled.div `
14
+ height: ${actionsHeight}px;
15
+ width: 48px;
16
+
17
+ display: flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+
21
+ color: ${(props) => props.theme.colours.defaultFont};
22
+ background-color: ${(props) => props.theme.colours.cardBackground};
23
+ padding: 4px;
24
+ border-radius: 4px 4px 0 0;
25
+
26
+ margin-right: 8px;
27
+ cursor: pointer;
28
+ `;
29
+ export const CardActions = ({ children }) => {
30
+ const { actionsRef, showActions } = useContext(CardContext);
31
+ if (!showActions) {
32
+ return null;
33
+ }
34
+ if (!actionsRef) {
35
+ return null;
36
+ }
37
+ return createPortal(React.createElement(AnimatePresence, null,
38
+ React.createElement(ActionsContainer, { key: 'modal', initial: { y: actionsHeight }, animate: { y: 0 }, exit: { y: actionsHeight }, transition: { type: 'spring', bounce: 0, duration: 0.6 } }, children)), actionsRef);
39
+ };
40
+ export const CardAction = ({ children, onClick }) => {
41
+ const handleClick = (e) => {
42
+ e.isActionClick = true;
43
+ if (onClick) {
44
+ onClick();
45
+ }
46
+ };
47
+ return (React.createElement(ActionContainer, { onClick: handleClick }, children));
48
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface CardContentProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const CardContent: ({ children }: CardContentProps) => JSX.Element;
6
+ export default CardContent;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ const ContentInner = styled.div `
4
+ padding: 0 16px;
5
+ margin-bottom: 4px;
6
+
7
+ &:first-child {
8
+ padding-top: 16px;
9
+ }
10
+
11
+ &:last-child {
12
+ padding-bottom: 16px;
13
+ margin-bottom: 0;
14
+ }
15
+
16
+ font-family: ${(props) => props.theme.fonts.default.family};
17
+ font-weight: ${(props) => props.theme.fonts.default.weight};
18
+ font-size: ${(props) => props.theme.fonts.default.size};
19
+ color: ${(props) => props.theme.colours.defaultFont};
20
+ `;
21
+ const CardContent = ({ children }) => {
22
+ return React.createElement(ContentInner, null, children);
23
+ };
24
+ export default CardContent;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface CardHeaderProps {
3
+ image?: string;
4
+ heading: string;
5
+ subHeading: string;
6
+ meta?: React.ReactNode;
7
+ }
8
+ declare const CardHeader: ({ image, heading, subHeading, meta }: CardHeaderProps) => JSX.Element;
9
+ export default CardHeader;
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Text } from '../..';
4
+ const HeaderRow = styled.div `
5
+ display: flex;
6
+ justify-content: space-between;
7
+ padding: 8px 16px;
8
+ margin-bottom: 8px;
9
+
10
+ border-bottom: thin solid ${(props) => props.theme.colours.defaultBorder};
11
+ `;
12
+ const LeftContainer = styled.div `
13
+ display: flex;
14
+ `;
15
+ const ImageContainer = styled.div `
16
+ width: 36px;
17
+ height: 36px;
18
+ margin-right: 8px;
19
+ `;
20
+ const Image = styled.img `
21
+ width: 36px;
22
+ height: 36px;
23
+ object-fit: cover;
24
+ border-radius: 50%;
25
+ `;
26
+ const TextContainer = styled.div `
27
+ display: flex;
28
+ flex-direction: column;
29
+ justify-content: flex-end;
30
+ `;
31
+ const MetaContainer = styled.div `
32
+ margin-left: 8px;
33
+ display: flex;
34
+ align-items: center;
35
+ `;
36
+ const CardHeader = ({ image, heading, subHeading, meta }) => {
37
+ return (React.createElement(HeaderRow, null,
38
+ React.createElement(LeftContainer, null,
39
+ image && (React.createElement(ImageContainer, null,
40
+ React.createElement(Image, { src: image }))),
41
+ React.createElement(TextContainer, null,
42
+ React.createElement("div", null,
43
+ React.createElement(Text, null, heading)),
44
+ React.createElement("div", null,
45
+ React.createElement(Text, { variant: 'secondary' }, subHeading)))),
46
+ meta && React.createElement(MetaContainer, null, meta)));
47
+ };
48
+ export default CardHeader;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface CardMediaProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const CardMedia: ({ children }: CardMediaProps) => JSX.Element;
6
+ export default CardMedia;
@@ -0,0 +1,48 @@
1
+ import React, { useContext } from 'react';
2
+ import styled from 'styled-components';
3
+ import responsive from '../../responsive/responsive';
4
+ import CardContext from './Card.context';
5
+ const MediaContainer = styled.div `
6
+ ${(props) => {
7
+ switch (props.size) {
8
+ case 'sm':
9
+ return `
10
+ height: 160px;
11
+ `;
12
+ case 'md':
13
+ return `
14
+ height: 260px;
15
+
16
+ ${responsive.useStylesFor('mobile').andSmaller(`
17
+ height: 160px;
18
+ `)}
19
+ `;
20
+ case 'lg':
21
+ default:
22
+ return `
23
+ height: 400px;
24
+
25
+ ${responsive.useStylesFor('tablet').andSmaller(`
26
+ height: 260px;
27
+ `)}
28
+
29
+ ${responsive.useStylesFor('mobile').andSmaller(`
30
+ height: 160px;
31
+ `)}
32
+ `;
33
+ }
34
+ }}
35
+
36
+ margin-bottom: 16px;
37
+
38
+ img {
39
+ width: 100%;
40
+ height: 100%;
41
+ object-fit: cover;
42
+ }
43
+ `;
44
+ const CardMedia = ({ children }) => {
45
+ const { size } = useContext(CardContext);
46
+ return React.createElement(MediaContainer, { size: size }, children);
47
+ };
48
+ export default CardMedia;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const CardSpacer: () => JSX.Element;
3
+ export default CardSpacer;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { Spacer } from '../..';
3
+ const CardSpacer = () => React.createElement(Spacer, { size: '1x' });
4
+ export default CardSpacer;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface CardSubContentProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const CardSubContent: ({ children }: CardSubContentProps) => JSX.Element;
6
+ export default CardSubContent;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ const ContentInner = styled.div `
4
+ padding: 0 16px;
5
+ margin-bottom: 4px;
6
+
7
+ &:first-child {
8
+ padding-top: 16px;
9
+ }
10
+
11
+ &:last-child {
12
+ padding-bottom: 16px;
13
+ margin-bottom: 0;
14
+ }
15
+
16
+ font-family: ${(props) => props.theme.fonts.default.family};
17
+ font-weight: ${(props) => props.theme.fonts.default.weight};
18
+ font-size: ${(props) => props.theme.fonts.default.size};
19
+ color: ${(props) => props.theme.colours.secondaryFont};
20
+ `;
21
+ const CardSubContent = ({ children }) => {
22
+ return React.createElement(ContentInner, null, children);
23
+ };
24
+ export default CardSubContent;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export declare type ControlGroupVariation = 'focus' | 'submission' | 'comfortable';
3
+ export interface ControlGroupProps {
4
+ children: React.ReactNode;
5
+ variation?: ControlGroupVariation;
6
+ }
7
+ declare const ControlGroup: {
8
+ ({ children, variation }: ControlGroupProps): JSX.Element | null;
9
+ Spacer: () => JSX.Element;
10
+ };
11
+ export default ControlGroup;
@@ -0,0 +1,75 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import ButtonContext from '../Button/Button.context';
4
+ import SubHeading from '../SubHeading/SubHeading.component';
5
+ import ControlGroupSpacer from './_ControlGroupSpacer.component';
6
+ const ComfortableContainer = styled.div `
7
+ display: flex;
8
+ flex-direction: column;
9
+
10
+ ${SubHeading} {
11
+ margin-top: 16px;
12
+ margin-bottom: 16px;
13
+ }
14
+
15
+ & > * {
16
+ margin-bottom: 16px;
17
+
18
+ &:last-child {
19
+ margin-bottom: 0;
20
+ }
21
+
22
+ &:first-child {
23
+ margin-top: 0;
24
+ }
25
+ }
26
+ `;
27
+ const SubmissionContainer = styled.div `
28
+ display: flex;
29
+ flex-direction: column;
30
+
31
+ & > * {
32
+ margin-bottom: 8px;
33
+
34
+ &:last-child {
35
+ margin-bottom: 0;
36
+ }
37
+ }
38
+ `;
39
+ const FocusContainer = styled.div `
40
+ & > * {
41
+ margin-bottom: 8px;
42
+
43
+ &:last-child {
44
+ margin-bottom: 0;
45
+ }
46
+ }
47
+ `;
48
+ const ControlGroup = ({ children, variation = 'focus' }) => {
49
+ if (variation === 'focus') {
50
+ const buttonContextValue = {
51
+ width: '100%',
52
+ };
53
+ return (React.createElement(ButtonContext.Provider, { value: buttonContextValue },
54
+ React.createElement(FocusContainer, null, children)));
55
+ }
56
+ if (variation === 'submission') {
57
+ const buttonContextValue = {
58
+ alignSelf: 'flex-end',
59
+ marginTop: '24px',
60
+ };
61
+ return (React.createElement(ButtonContext.Provider, { value: buttonContextValue },
62
+ React.createElement(SubmissionContainer, null, children)));
63
+ }
64
+ if (variation === 'comfortable') {
65
+ const buttonContextValue = {
66
+ alignSelf: 'flex-end',
67
+ marginTop: '24px',
68
+ };
69
+ return (React.createElement(ButtonContext.Provider, { value: buttonContextValue },
70
+ React.createElement(ComfortableContainer, null, children)));
71
+ }
72
+ return null;
73
+ };
74
+ ControlGroup.Spacer = ControlGroupSpacer;
75
+ export default ControlGroup;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { Meta } from '@storybook/react/types-6-0';
3
+ export declare const Focus: () => JSX.Element;
4
+ export declare const Submission: () => JSX.Element;
5
+ export declare const Spaced: () => JSX.Element;
6
+ declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
7
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { ControlGroup, Input, Button } from '../..';
3
+ /* eslint-disable @typescript-eslint/no-empty-function */
4
+ export const Focus = () => (React.createElement(React.Fragment, null,
5
+ React.createElement(ControlGroup, null,
6
+ React.createElement(Input, { placeholder: 'username', name: 'username' }),
7
+ React.createElement(Input, { placeholder: 'password', name: 'password' }),
8
+ React.createElement(ControlGroup.Spacer, null),
9
+ React.createElement(Button, null, "Submit"))));
10
+ export const Submission = () => (React.createElement(React.Fragment, null,
11
+ React.createElement(ControlGroup, { variation: 'submission' },
12
+ React.createElement(Input, { placeholder: 'username', name: 'username' }),
13
+ React.createElement(Input, { placeholder: 'password', name: 'password' }),
14
+ React.createElement(ControlGroup.Spacer, null),
15
+ React.createElement(Button, null, "Submit"))));
16
+ export const Spaced = () => (React.createElement(React.Fragment, null,
17
+ React.createElement(ControlGroup, { variation: 'comfortable' },
18
+ React.createElement(Input, { label: 'username', placeholder: 'username', name: 'username' }),
19
+ React.createElement(Input, { label: 'password', placeholder: 'password', name: 'password' }),
20
+ React.createElement(Button, null, "Submit"))));
21
+ export default {
22
+ title: 'Components/ControlGroup',
23
+ component: ControlGroup,
24
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const ControlGroupSpacer: () => JSX.Element;
3
+ export default ControlGroupSpacer;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { Spacer } from '../..';
3
+ const ControlGroupSpacer = () => React.createElement(Spacer, { size: '1x' });
4
+ export default ControlGroupSpacer;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ interface Option {
3
+ value: string | number;
4
+ label: string;
5
+ }
6
+ export interface FancyCheckboxProps {
7
+ name: string;
8
+ label?: string;
9
+ options: Option[];
10
+ value?: string;
11
+ onChange?: (value: any) => void;
12
+ }
13
+ declare const FancyCheckbox: ({ name, label, options, value, onChange }: FancyCheckboxProps) => JSX.Element;
14
+ export default FancyCheckbox;
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import getThemeControlColours from '../../theme/helpers/getThemeControlColours';
4
+ import ButtonGroup from '../ButtonGroup/ButtonGroup.component';
5
+ import useFormNode from '../Form/useFormNode.hook';
6
+ const FancyCheckboxLabel = 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 StyledButton = styled.button `
15
+ height: 128px;
16
+ width: 128px;
17
+
18
+ outline: none;
19
+ box-shadow: none;
20
+ border: none;
21
+
22
+ cursor: pointer;
23
+
24
+ padding: 0 24px;
25
+
26
+ font-size: ${(props) => props.theme.fonts.default.size};
27
+ font: ${(props) => props.theme.fonts.default.family};
28
+
29
+ color: ${(props) => props.selected ? props.theme.colours.primary.contrastText : props.theme.colours.tertiary.contrastText};
30
+ background-color: ${(props) => props.selected ? props.theme.colours.primary.main : props.theme.colours.tertiary.main};
31
+
32
+ border-radius: 2px;
33
+
34
+ &:hover {
35
+ background-color: ${(props) => props.selected ? props.theme.colours.primary.main : props.theme.colours.tertiary.hover};
36
+ }
37
+ `;
38
+ const FancyCheckbox = ({ name, label, options, value, onChange }) => {
39
+ const { value: contextValue, onChange: contextOnChange } = useFormNode(name);
40
+ const handleChange = (_value) => {
41
+ if (onChange) {
42
+ onChange(_value);
43
+ }
44
+ if (contextOnChange) {
45
+ contextOnChange(_value);
46
+ }
47
+ };
48
+ const selectedValue = value || contextValue;
49
+ return (React.createElement("div", null,
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))))));
52
+ };
53
+ export default FancyCheckbox;
@@ -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,29 @@
1
+ import React, { useState } from 'react';
2
+ import { FancyCheckbox, Form } from '../..';
3
+ const options = [
4
+ {
5
+ value: 'fireball',
6
+ label: 'Chinese Fireball',
7
+ },
8
+ {
9
+ value: 'longhorn',
10
+ label: 'Romanian Longhorn',
11
+ },
12
+ {
13
+ value: 'ridgeback',
14
+ label: 'Norwegian Ridgeback',
15
+ },
16
+ {
17
+ value: 'horntail',
18
+ label: 'Hungarian Horntail',
19
+ },
20
+ ];
21
+ export const Standard = () => {
22
+ const [value, setValue] = useState({ dragon: '' });
23
+ return (React.createElement(Form, { value: value, onChange: setValue },
24
+ React.createElement(FancyCheckbox, { name: 'dragon', options: options })));
25
+ };
26
+ export default {
27
+ title: 'Components/FancyCheckbox',
28
+ component: FancyCheckbox,
29
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface FormProps {
3
+ value: any;
4
+ onChange: (value: any) => void;
5
+ onSubmit?: () => void;
6
+ children: React.ReactNode;
7
+ }
8
+ declare const Form: ({ value, onChange, onSubmit, children }: FormProps) => JSX.Element;
9
+ export default Form;
@@ -0,0 +1,24 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
2
+ import React from 'react';
3
+ import FormStateContext from './FormState.context';
4
+ const Form = ({ value, onChange, onSubmit, children }) => {
5
+ const onChangeFn = (key, fieldValue) => {
6
+ onChange({
7
+ ...value,
8
+ [key]: fieldValue,
9
+ });
10
+ };
11
+ const onSubmitFn = (event) => {
12
+ event.preventDefault();
13
+ if (onSubmit) {
14
+ onSubmit();
15
+ }
16
+ };
17
+ const contextValue = {
18
+ value,
19
+ onChange: onChangeFn,
20
+ };
21
+ return (React.createElement(FormStateContext.Provider, { value: contextValue },
22
+ React.createElement("form", { onSubmit: onSubmitFn }, children)));
23
+ };
24
+ export default Form;
@@ -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;