@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.
- package/build/colours/colours.d.ts +16 -0
- package/build/colours/colours.js +15 -0
- package/build/components/ActionMessage/ActionMessage.component.d.ts +9 -0
- package/build/components/ActionMessage/ActionMessage.component.js +27 -0
- package/build/components/ActionMessage/ActionMessage.stories.d.ts +6 -0
- package/build/components/ActionMessage/ActionMessage.stories.js +20 -0
- package/build/components/Alert/Alert.component.d.ts +16 -0
- package/build/components/Alert/Alert.component.js +54 -0
- package/build/components/Alert/Alert.stories.d.ts +8 -0
- package/build/components/Alert/Alert.stories.js +21 -0
- package/build/components/Badge/Badge.component.d.ts +9 -0
- package/build/components/Badge/Badge.component.js +20 -0
- package/build/components/Badge/Badge.stories.d.ts +5 -0
- package/build/components/Badge/Badge.stories.js +18 -0
- package/build/components/Button/Button.component.d.ts +11 -0
- package/build/components/Button/Button.component.js +60 -0
- package/build/components/Button/Button.context.d.ts +8 -0
- package/build/components/Button/Button.context.js +7 -0
- package/build/components/Button/Button.stories.d.ts +7 -0
- package/build/components/Button/Button.stories.js +27 -0
- package/build/components/ButtonGroup/ButtonGroup.component.d.ts +6 -0
- package/build/components/ButtonGroup/ButtonGroup.component.js +17 -0
- package/build/components/ButtonGroup/ButtonGroup.stories.d.ts +7 -0
- package/build/components/ButtonGroup/ButtonGroup.stories.js +17 -0
- package/build/components/Card/Card.component.d.ts +19 -0
- package/build/components/Card/Card.component.js +101 -0
- package/build/components/Card/Card.context.d.ts +9 -0
- package/build/components/Card/Card.context.js +7 -0
- package/build/components/Card/Card.stories.d.ts +9 -0
- package/build/components/Card/Card.stories.js +64 -0
- package/build/components/Card/CardGroup.component.d.ts +9 -0
- package/build/components/Card/CardGroup.component.js +31 -0
- package/build/components/Card/_CardActions.component.d.ts +10 -0
- package/build/components/Card/_CardActions.component.js +48 -0
- package/build/components/Card/_CardContent.component.d.ts +6 -0
- package/build/components/Card/_CardContent.component.js +24 -0
- package/build/components/Card/_CardHeader.component.d.ts +9 -0
- package/build/components/Card/_CardHeader.component.js +48 -0
- package/build/components/Card/_CardMedia.component.d.ts +6 -0
- package/build/components/Card/_CardMedia.component.js +48 -0
- package/build/components/Card/_CardSpacer.component.d.ts +3 -0
- package/build/components/Card/_CardSpacer.component.js +4 -0
- package/build/components/Card/_CardSubContent.component.d.ts +6 -0
- package/build/components/Card/_CardSubContent.component.js +24 -0
- package/build/components/ControlGroup/ControlGroup.component.d.ts +11 -0
- package/build/components/ControlGroup/ControlGroup.component.js +75 -0
- package/build/components/ControlGroup/ControlGroup.stories.d.ts +7 -0
- package/build/components/ControlGroup/ControlGroup.stories.js +24 -0
- package/build/components/ControlGroup/_ControlGroupSpacer.component.d.ts +3 -0
- package/build/components/ControlGroup/_ControlGroupSpacer.component.js +4 -0
- package/build/components/FancyCheckbox/FancyCheckbox.component.d.ts +14 -0
- package/build/components/FancyCheckbox/FancyCheckbox.component.js +53 -0
- package/build/components/FancyCheckbox/FancyCheckbox.stories.d.ts +5 -0
- package/build/components/FancyCheckbox/FancyCheckbox.stories.js +29 -0
- package/build/components/Form/Form.component.d.ts +9 -0
- package/build/components/Form/Form.component.js +24 -0
- package/build/components/Form/Form.stories.d.ts +5 -0
- package/build/components/Form/Form.stories.js +21 -0
- package/build/components/Form/FormState.context.d.ts +7 -0
- package/build/components/Form/FormState.context.js +6 -0
- package/build/components/Form/useFormNode.hook.d.ts +5 -0
- package/build/components/Form/useFormNode.hook.js +16 -0
- package/build/components/Heading/Heading.component.d.ts +6 -0
- package/build/components/Heading/Heading.component.js +13 -0
- package/build/components/Heading/Heading.stories.d.ts +5 -0
- package/build/components/Heading/Heading.stories.js +7 -0
- package/build/components/ImageUpload/ImageUpload.component.d.ts +11 -0
- package/build/components/ImageUpload/ImageUpload.component.js +92 -0
- package/build/components/ImageUpload/ImageUpload.stories.d.ts +8 -0
- package/build/components/ImageUpload/ImageUpload.stories.js +49 -0
- package/build/components/InlineCard/InlineCard.component.d.ts +10 -0
- package/build/components/InlineCard/InlineCard.component.js +20 -0
- package/build/components/InlineCard/InlineCard.stories.d.ts +5 -0
- package/build/components/InlineCard/InlineCard.stories.js +17 -0
- package/build/components/InlineCard/InlineCardGroup.component.d.ts +6 -0
- package/build/components/InlineCard/InlineCardGroup.component.js +17 -0
- package/build/components/InlineCard/_InlineCardContent.component.d.ts +6 -0
- package/build/components/InlineCard/_InlineCardContent.component.js +15 -0
- package/build/components/InlineCard/_InlineCardMedia.component.d.ts +6 -0
- package/build/components/InlineCard/_InlineCardMedia.component.js +17 -0
- package/build/components/Input/Input.component.d.ts +11 -0
- package/build/components/Input/Input.component.js +57 -0
- package/build/components/Input/Input.stories.d.ts +6 -0
- package/build/components/Input/Input.stories.js +12 -0
- package/build/components/LiveInput/LiveInput.component.d.ts +10 -0
- package/build/components/LiveInput/LiveInput.component.js +22 -0
- package/build/components/LiveInput/LiveInput.stories.d.ts +6 -0
- package/build/components/LiveInput/LiveInput.stories.js +12 -0
- package/build/components/Loader/Loader.component.d.ts +3 -0
- package/build/components/Loader/Loader.component.js +48 -0
- package/build/components/Loader/Loader.stories.d.ts +5 -0
- package/build/components/Loader/Loader.stories.js +9 -0
- package/build/components/Menu/Menu.component.d.ts +13 -0
- package/build/components/Menu/Menu.component.js +26 -0
- package/build/components/Menu/Menu.stories.d.ts +7 -0
- package/build/components/Menu/Menu.stories.js +98 -0
- package/build/components/Menu/_MenuContent.component.d.ts +10 -0
- package/build/components/Menu/_MenuContent.component.js +31 -0
- package/build/components/Menu/_MenuContent.context.d.ts +7 -0
- package/build/components/Menu/_MenuContent.context.js +6 -0
- package/build/components/Menu/_MenuHeading.component.d.ts +6 -0
- package/build/components/Menu/_MenuHeading.component.js +27 -0
- package/build/components/Menu/_MenuItem.component.d.ts +10 -0
- package/build/components/Menu/_MenuItem.component.js +50 -0
- package/build/components/Menu/_MenuPage.component.d.ts +6 -0
- package/build/components/Menu/_MenuPage.component.js +39 -0
- package/build/components/Menu/_MenuPanel.component.d.ts +6 -0
- package/build/components/Menu/_MenuPanel.component.js +62 -0
- package/build/components/Menu/menu.helpers.d.ts +4 -0
- package/build/components/Menu/menu.helpers.js +10 -0
- package/build/components/Modal/Modal.component.d.ts +14 -0
- package/build/components/Modal/Modal.component.js +100 -0
- package/build/components/Modal/Modal.stories.d.ts +6 -0
- package/build/components/Modal/Modal.stories.js +55 -0
- package/build/components/Modal/_Modal.context.d.ts +6 -0
- package/build/components/Modal/_Modal.context.js +6 -0
- package/build/components/Modal/_ModalBody.component.d.ts +2 -0
- package/build/components/Modal/_ModalBody.component.js +5 -0
- package/build/components/Modal/_ModalHeader.component.d.ts +7 -0
- package/build/components/Modal/_ModalHeader.component.js +54 -0
- package/build/components/Notification/Notification.component.d.ts +6 -0
- package/build/components/Notification/Notification.component.js +15 -0
- package/build/components/Notification/Notification.stories.d.ts +8 -0
- package/build/components/Notification/Notification.stories.js +28 -0
- package/build/components/Notifications/Notifications.component.d.ts +15 -0
- package/build/components/Notifications/Notifications.component.js +37 -0
- package/build/components/Notifications/Notifications.stories.d.ts +7 -0
- package/build/components/Notifications/Notifications.stories.js +99 -0
- package/build/components/ProfileImage/ProfileImage.component.d.ts +7 -0
- package/build/components/ProfileImage/ProfileImage.component.js +53 -0
- package/build/components/ProfileImage/ProfileImage.stories.d.ts +6 -0
- package/build/components/ProfileImage/ProfileImage.stories.js +8 -0
- package/build/components/QrCode/QrCode.component.d.ts +6 -0
- package/build/components/QrCode/QrCode.component.js +71 -0
- package/build/components/QrCode/QrCode.stories.d.ts +5 -0
- package/build/components/QrCode/QrCode.stories.js +8 -0
- package/build/components/Spacer/Spacer.component.d.ts +7 -0
- package/build/components/Spacer/Spacer.component.js +25 -0
- package/build/components/SquareButton/SquareButton.component.d.ts +9 -0
- package/build/components/SquareButton/SquareButton.component.js +31 -0
- package/build/components/SquareButton/SquareButton.stories.d.ts +5 -0
- package/build/components/SquareButton/SquareButton.stories.js +14 -0
- package/build/components/SubHeading/SubHeading.component.d.ts +2 -0
- package/build/components/SubHeading/SubHeading.component.js +11 -0
- package/build/components/SubHeading/SubHeading.stories.d.ts +5 -0
- package/build/components/SubHeading/SubHeading.stories.js +7 -0
- package/build/components/Table/Table.component.d.ts +16 -0
- package/build/components/Table/Table.component.js +24 -0
- package/build/components/Table/Table.stories.d.ts +7 -0
- package/build/components/Table/Table.stories.js +39 -0
- package/build/components/Table/_Table.context.d.ts +7 -0
- package/build/components/Table/_Table.context.js +5 -0
- package/build/components/Table/_TableRow.component.d.ts +6 -0
- package/build/components/Table/_TableRow.component.js +17 -0
- package/build/components/Text/Text.component.d.ts +8 -0
- package/build/components/Text/Text.component.js +26 -0
- package/build/components/Text/Text.stories.d.ts +6 -0
- package/build/components/Text/Text.stories.js +11 -0
- package/build/constants/zIndex.constants.d.ts +6 -0
- package/build/constants/zIndex.constants.js +5 -0
- package/build/contexts/File.context.d.ts +7 -0
- package/build/contexts/File.context.js +8 -0
- package/build/examples/Modal.stories.d.ts +5 -0
- package/build/examples/Modal.stories.js +37 -0
- package/build/global/BodyStyle.component.d.ts +2 -0
- package/build/global/BodyStyle.component.js +16 -0
- package/build/hooks/useForm.d.ts +7 -0
- package/build/hooks/useForm.js +20 -0
- package/build/index.d.ts +47 -0
- package/build/index.js +43 -0
- package/build/layouts/Action/Action.layout.d.ts +17 -0
- package/build/layouts/Action/Action.layout.js +45 -0
- package/build/layouts/Action/Action.stories.d.ts +6 -0
- package/build/layouts/Action/Action.stories.js +14 -0
- package/build/layouts/Centered/Centered.layout.d.ts +2 -0
- package/build/layouts/Centered/Centered.layout.js +6 -0
- package/build/layouts/Centered/Centered.stories.d.ts +5 -0
- package/build/layouts/Centered/Centered.stories.js +8 -0
- package/build/layouts/Column/Column.layout.d.ts +6 -0
- package/build/layouts/Column/Column.layout.js +5 -0
- package/build/layouts/Column/Column.stories.d.ts +5 -0
- package/build/layouts/Column/Column.stories.js +8 -0
- package/build/layouts/Content/Content.layout.d.ts +10 -0
- package/build/layouts/Content/Content.layout.js +11 -0
- package/build/layouts/Content/Content.stories.d.ts +9 -0
- package/build/layouts/Content/Content.stories.js +37 -0
- package/build/layouts/Content/_ContentContent.component.d.ts +8 -0
- package/build/layouts/Content/_ContentContent.component.js +29 -0
- package/build/layouts/Content/_ContentHeader.component.d.ts +7 -0
- package/build/layouts/Content/_ContentHeader.component.js +17 -0
- package/build/layouts/Emphasis/Emphasis.layout.d.ts +6 -0
- package/build/layouts/Emphasis/Emphasis.layout.js +39 -0
- package/build/layouts/Focus/Focus.layout.d.ts +6 -0
- package/build/layouts/Focus/Focus.layout.js +28 -0
- package/build/layouts/Focus/Focus.stories.d.ts +5 -0
- package/build/layouts/Focus/Focus.stories.js +16 -0
- package/build/layouts/Padded/Padded.layout.d.ts +9 -0
- package/build/layouts/Padded/Padded.layout.js +11 -0
- package/build/layouts/Padded/Padded.stories.d.ts +6 -0
- package/build/layouts/Padded/Padded.stories.js +10 -0
- package/build/responsive/responsive.d.ts +13 -0
- package/build/responsive/responsive.js +63 -0
- package/build/screens/Login/Login.screen.d.ts +13 -0
- package/build/screens/Login/Login.screen.js +60 -0
- package/build/screens/Register/Register.screen.d.ts +12 -0
- package/build/screens/Register/Register.screen.js +32 -0
- package/build/screens/Verification/Verification.screen.d.ts +12 -0
- package/build/screens/Verification/Verification.screen.js +39 -0
- package/build/theme/dark.theme.d.ts +3 -0
- package/build/theme/dark.theme.js +73 -0
- package/build/theme/default.theme.d.ts +3 -0
- package/build/theme/default.theme.js +74 -0
- package/build/theme/helpers/getThemeControlColours.d.ts +10 -0
- package/build/theme/helpers/getThemeControlColours.js +10 -0
- package/build/theme/helpers/getThemeStatusColour.d.ts +4 -0
- package/build/theme/helpers/getThemeStatusColour.js +14 -0
- package/build/theme/helpers/getThemeVariantColours.d.ts +8 -0
- package/build/theme/helpers/getThemeVariantColours.js +23 -0
- package/build/theme/theme.types.d.ts +2 -0
- package/build/theme/theme.types.js +1 -0
- package/build/theme/themes.d.ts +5 -0
- package/build/theme/themes.js +7 -0
- package/package.json +65 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
white: string;
|
|
3
|
+
grey10: string;
|
|
4
|
+
grey20: string;
|
|
5
|
+
grey30: string;
|
|
6
|
+
grey35: string;
|
|
7
|
+
grey40: string;
|
|
8
|
+
grey50: string;
|
|
9
|
+
grey70: string;
|
|
10
|
+
grey90: string;
|
|
11
|
+
yellow: string;
|
|
12
|
+
green: string;
|
|
13
|
+
red: string;
|
|
14
|
+
blue: string;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
white: '#FFFFFF',
|
|
3
|
+
grey10: '#F6F7F9',
|
|
4
|
+
grey20: '#cbd5df',
|
|
5
|
+
grey30: '#d0d0d0',
|
|
6
|
+
grey35: '#c1c1c1',
|
|
7
|
+
grey40: '#a7a7a7',
|
|
8
|
+
grey50: '#889aac',
|
|
9
|
+
grey70: '#60758a',
|
|
10
|
+
grey90: '#2e3842',
|
|
11
|
+
yellow: '#ffcb77',
|
|
12
|
+
green: '#8ACB88',
|
|
13
|
+
red: '#FE6D73',
|
|
14
|
+
blue: '#90BEDE',
|
|
15
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ActionMessageProps {
|
|
3
|
+
header: string;
|
|
4
|
+
info?: string;
|
|
5
|
+
action?: string;
|
|
6
|
+
onAction?: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const ActionMessage: ({ header, info, action, onAction }: ActionMessageProps) => JSX.Element;
|
|
9
|
+
export default ActionMessage;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Button, Spacer, SubHeading, Text } from '../..';
|
|
4
|
+
const ActionMessageContainer = styled.div `
|
|
5
|
+
width: 100%;
|
|
6
|
+
padding: 64px 0;
|
|
7
|
+
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
align-items: center;
|
|
11
|
+
|
|
12
|
+
span {
|
|
13
|
+
text-align: center;
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const ActionMessage = ({ header, info, action, onAction }) => {
|
|
17
|
+
return (React.createElement(ActionMessageContainer, null,
|
|
18
|
+
React.createElement("div", null,
|
|
19
|
+
React.createElement(SubHeading, null, header)),
|
|
20
|
+
info && (React.createElement(React.Fragment, null,
|
|
21
|
+
React.createElement(Spacer, { size: '1x' }),
|
|
22
|
+
React.createElement(Text, null, info))),
|
|
23
|
+
action && (React.createElement(React.Fragment, null,
|
|
24
|
+
React.createElement(Spacer, { size: '4x' }),
|
|
25
|
+
React.createElement(Button, { onClick: onAction }, action)))));
|
|
26
|
+
};
|
|
27
|
+
export default ActionMessage;
|
|
@@ -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 InPanel: () => JSX.Element;
|
|
5
|
+
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActionMessage, Menu } from '../..';
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
export const Standard = () => (React.createElement(React.Fragment, null,
|
|
5
|
+
React.createElement(ActionMessage, { header: 'Create an asset', info: "It looks like you don't have any assets, create one to get started", action: 'Create', onAction: () => {
|
|
6
|
+
console.log('testing');
|
|
7
|
+
} })));
|
|
8
|
+
export const InPanel = () => (React.createElement(React.Fragment, null,
|
|
9
|
+
React.createElement(Menu, null,
|
|
10
|
+
React.createElement(Menu.Heading, null, "Action Message")),
|
|
11
|
+
React.createElement(Menu.Content, { panelSize: 'sm' },
|
|
12
|
+
React.createElement(Menu.Panel, null,
|
|
13
|
+
React.createElement(ActionMessage, { header: 'Create an asset', info: "It looks like you don't have any assets, create one to get started", action: 'Create', onAction: () => {
|
|
14
|
+
console.log('testing');
|
|
15
|
+
} })),
|
|
16
|
+
React.createElement(Menu.Page, null, "some content..."))));
|
|
17
|
+
export default {
|
|
18
|
+
title: 'Components/ActionMessage',
|
|
19
|
+
component: ActionMessage,
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Status } from '../../theme/theme.types';
|
|
3
|
+
export declare type AlertVariant = Status;
|
|
4
|
+
export interface AlertProps {
|
|
5
|
+
variant: AlertVariant;
|
|
6
|
+
message: string;
|
|
7
|
+
count?: number;
|
|
8
|
+
action?: string;
|
|
9
|
+
onAction?: () => void;
|
|
10
|
+
}
|
|
11
|
+
interface AlertContainerProps {
|
|
12
|
+
colour: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const AlertContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, AlertContainerProps, never>;
|
|
15
|
+
declare const Alert: ({ variant, message, count, action, onAction }: AlertProps) => JSX.Element;
|
|
16
|
+
export default Alert;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { useTheme } from 'styled-components';
|
|
3
|
+
import getThemeStatusColour from '../../theme/helpers/getThemeStatusColour';
|
|
4
|
+
export const AlertContainer = styled.div `
|
|
5
|
+
position: relative;
|
|
6
|
+
padding: 12px;
|
|
7
|
+
background-color: ${(props) => props.theme.colours.cardBackground};
|
|
8
|
+
|
|
9
|
+
font-family: ${(props) => props.theme.fonts.default.family};
|
|
10
|
+
font-size: ${(props) => props.theme.fonts.default.size};
|
|
11
|
+
font-weight: ${(props) => props.theme.fonts.default.weight};
|
|
12
|
+
|
|
13
|
+
border-left: solid 3px ${(props) => props.colour};
|
|
14
|
+
box-shadow: 1px 1px 2px #0000000f;
|
|
15
|
+
`;
|
|
16
|
+
const MessageContainer = styled.div `
|
|
17
|
+
color: ${(props) => props.theme.colours.defaultFont};
|
|
18
|
+
`;
|
|
19
|
+
const ActionContainer = styled.div `
|
|
20
|
+
text-align: right;
|
|
21
|
+
font-style: italic;
|
|
22
|
+
color: ${(props) => props.theme.colours.secondaryFont};
|
|
23
|
+
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
padding-top: 8px;
|
|
26
|
+
`;
|
|
27
|
+
const CountContainer = styled.div `
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 0px;
|
|
34
|
+
right: -8px;
|
|
35
|
+
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
color: ${(props) => props.theme.colours.defaultFont};
|
|
38
|
+
font-family: ${(props) => props.theme.fonts.default.family};
|
|
39
|
+
|
|
40
|
+
height: 24px;
|
|
41
|
+
width: 24px;
|
|
42
|
+
border: 2px solid ${(props) => props.colour};
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
background-color: ${(props) => props.theme.colours.cardBackground};
|
|
45
|
+
`;
|
|
46
|
+
const Alert = ({ variant, message, count, action, onAction }) => {
|
|
47
|
+
const theme = useTheme();
|
|
48
|
+
const colour = getThemeStatusColour(variant, theme).main;
|
|
49
|
+
return (React.createElement(AlertContainer, { colour: colour },
|
|
50
|
+
React.createElement(MessageContainer, null, message),
|
|
51
|
+
action && React.createElement(ActionContainer, { onClick: onAction }, action),
|
|
52
|
+
count && count > 1 && React.createElement(CountContainer, { colour: colour }, count)));
|
|
53
|
+
};
|
|
54
|
+
export default Alert;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Meta } from '@storybook/react/types-6-0';
|
|
3
|
+
export declare const Standard: () => JSX.Element;
|
|
4
|
+
export declare const Variants: () => JSX.Element;
|
|
5
|
+
export declare const WithCount: () => JSX.Element;
|
|
6
|
+
export declare const WithAction: () => JSX.Element;
|
|
7
|
+
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Alert } from '../..';
|
|
3
|
+
/* eslint-disable no-alert */
|
|
4
|
+
export const Standard = () => (React.createElement(React.Fragment, null,
|
|
5
|
+
React.createElement(Alert, { variant: 'info', message: 'This is a base alert' }),
|
|
6
|
+
React.createElement("br", null),
|
|
7
|
+
React.createElement(Alert, { variant: 'info', message: 'This is a base alert with quite a bit of content. It may wrap around to the next line...' })));
|
|
8
|
+
export const Variants = () => (React.createElement(React.Fragment, null,
|
|
9
|
+
React.createElement(Alert, { variant: 'info', message: 'This is an info alert' }),
|
|
10
|
+
React.createElement("br", null),
|
|
11
|
+
React.createElement(Alert, { variant: 'success', message: 'This is a success alert' }),
|
|
12
|
+
React.createElement("br", null),
|
|
13
|
+
React.createElement(Alert, { variant: 'warn', message: 'This is a warn alert' }),
|
|
14
|
+
React.createElement("br", null),
|
|
15
|
+
React.createElement(Alert, { variant: 'danger', message: 'This is a danger alert' })));
|
|
16
|
+
export const WithCount = () => React.createElement(Alert, { variant: 'info', count: 5, message: 'This is a alert with a count' });
|
|
17
|
+
export const WithAction = () => (React.createElement(Alert, { variant: 'info', message: 'This is a alert with an action', action: 'Undo', onAction: () => alert('Undoing...') }));
|
|
18
|
+
export default {
|
|
19
|
+
title: 'Components/Alert',
|
|
20
|
+
component: Alert,
|
|
21
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Status } from '../../theme/theme.types';
|
|
3
|
+
export declare type BadgeVariant = Status;
|
|
4
|
+
export interface BadgeProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
variant: BadgeVariant;
|
|
7
|
+
}
|
|
8
|
+
declare const Badge: ({ children, variant }: BadgeProps) => JSX.Element;
|
|
9
|
+
export default Badge;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import getThemeStatusColour from '../../theme/helpers/getThemeStatusColour';
|
|
4
|
+
const BadgeSpan = styled.span `
|
|
5
|
+
padding: 4px 8px;
|
|
6
|
+
border-radius: 2px;
|
|
7
|
+
|
|
8
|
+
background-color: ${(props) => getThemeStatusColour(props.variant, props.theme).main};
|
|
9
|
+
color: ${(props) => getThemeStatusColour(props.variant, props.theme).contrast};
|
|
10
|
+
|
|
11
|
+
font-family: ${(props) => props.theme.fonts.default.family};
|
|
12
|
+
font-size: ${(props) => props.theme.fonts.default.size};
|
|
13
|
+
font-weight: ${(props) => props.theme.fonts.default.weight};
|
|
14
|
+
|
|
15
|
+
text-transform: lowercase;
|
|
16
|
+
`;
|
|
17
|
+
const Badge = ({ children, variant }) => {
|
|
18
|
+
return React.createElement(BadgeSpan, { variant: variant }, children);
|
|
19
|
+
};
|
|
20
|
+
export default Badge;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Badge } from '../..';
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
4
|
+
export const Standard = () => (React.createElement(React.Fragment, null,
|
|
5
|
+
React.createElement(Badge, { variant: 'info' }, "Pending"),
|
|
6
|
+
React.createElement("br", null),
|
|
7
|
+
React.createElement("br", null),
|
|
8
|
+
React.createElement(Badge, { variant: 'success' }, "Accepted"),
|
|
9
|
+
React.createElement("br", null),
|
|
10
|
+
React.createElement("br", null),
|
|
11
|
+
React.createElement(Badge, { variant: 'warn' }, "Expired"),
|
|
12
|
+
React.createElement("br", null),
|
|
13
|
+
React.createElement("br", null),
|
|
14
|
+
React.createElement(Badge, { variant: 'danger' }, "Rejected")));
|
|
15
|
+
export default {
|
|
16
|
+
title: 'Components/Badge',
|
|
17
|
+
component: Badge,
|
|
18
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColourVariant } from '../../theme/theme.types';
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
children: React.ReactChild;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
variant?: ColourVariant;
|
|
7
|
+
type?: 'submit';
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const Button: ({ children, loading, variant, type, onClick }: ButtonProps) => JSX.Element;
|
|
11
|
+
export default Button;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import styled, { keyframes } from 'styled-components';
|
|
3
|
+
import getThemeVariantColours from '../../theme/helpers/getThemeVariantColours';
|
|
4
|
+
import ButtonContext from './Button.context';
|
|
5
|
+
const StyledButton = styled.button `
|
|
6
|
+
height: 48px;
|
|
7
|
+
outline: none;
|
|
8
|
+
box-shadow: none;
|
|
9
|
+
border: none;
|
|
10
|
+
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
|
|
13
|
+
padding: 0 24px;
|
|
14
|
+
|
|
15
|
+
font-size: ${(props) => props.theme.fonts.default.size};
|
|
16
|
+
font-family: ${(props) => props.theme.fonts.default.family};
|
|
17
|
+
|
|
18
|
+
color: ${(props) => getThemeVariantColours(props.variant, props.theme).contrastText};
|
|
19
|
+
background-color: ${(props) => getThemeVariantColours(props.variant, props.theme).main};
|
|
20
|
+
|
|
21
|
+
border-radius: 2px;
|
|
22
|
+
|
|
23
|
+
// Props defined by the context
|
|
24
|
+
width: ${(props) => props.width};
|
|
25
|
+
align-self: ${(props) => props.alignSelf};
|
|
26
|
+
margin-top: ${(props) => props.marginTop};
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
background-color: ${(props) => getThemeVariantColours(props.variant, props.theme).hover};
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const spinAnimation = keyframes `
|
|
33
|
+
0% { transform: rotate(0deg); }
|
|
34
|
+
100% { transform: rotate(360deg); }
|
|
35
|
+
`;
|
|
36
|
+
const ButtonSpinner = styled.div `
|
|
37
|
+
display: inline-block;
|
|
38
|
+
width: 48px;
|
|
39
|
+
height: 48px;
|
|
40
|
+
|
|
41
|
+
&:after {
|
|
42
|
+
content: ' ';
|
|
43
|
+
display: block;
|
|
44
|
+
width: 24px;
|
|
45
|
+
height: 24px;
|
|
46
|
+
margin: 10px;
|
|
47
|
+
border-radius: 50%;
|
|
48
|
+
border: 2px solid ${(props) => getThemeVariantColours(props.variant, props.theme).contrastText};
|
|
49
|
+
border-color: ${(props) => getThemeVariantColours(props.variant, props.theme).contrastText} transparent
|
|
50
|
+
${(props) => getThemeVariantColours(props.variant, props.theme).contrastText} transparent;
|
|
51
|
+
animation-name: ${spinAnimation};
|
|
52
|
+
animation-duration: 1.2s;
|
|
53
|
+
animation-iteration-count: infinite;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
const Button = ({ children, loading, variant = 'primary', type, onClick }) => {
|
|
57
|
+
const { width, alignSelf, marginTop } = useContext(ButtonContext);
|
|
58
|
+
return (React.createElement(StyledButton, { width: width, alignSelf: alignSelf, marginTop: marginTop, variant: variant, type: type, onClick: onClick }, loading ? React.createElement(ButtonSpinner, { variant: variant }) : children));
|
|
59
|
+
};
|
|
60
|
+
export default Button;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Meta } from '@storybook/react/types-6-0';
|
|
3
|
+
export declare const Standard: () => JSX.Element;
|
|
4
|
+
export declare const Loading: () => JSX.Element;
|
|
5
|
+
export declare const InteractiveLoading: () => JSX.Element;
|
|
6
|
+
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Button } from '../..';
|
|
3
|
+
export const Standard = () => (React.createElement(React.Fragment, null,
|
|
4
|
+
React.createElement(Button, null, "Here is a primary button!"),
|
|
5
|
+
React.createElement("br", null),
|
|
6
|
+
React.createElement("br", null),
|
|
7
|
+
React.createElement(Button, { variant: 'secondary' }, "Here is a secondary button!"),
|
|
8
|
+
React.createElement("br", null),
|
|
9
|
+
React.createElement("br", null),
|
|
10
|
+
React.createElement(Button, { variant: 'tertiary' }, "Here is a tertiary button!")));
|
|
11
|
+
export const Loading = () => (React.createElement(React.Fragment, null,
|
|
12
|
+
React.createElement(Button, { loading: true }, "Here is a primary button!"),
|
|
13
|
+
React.createElement("br", null),
|
|
14
|
+
React.createElement("br", null),
|
|
15
|
+
React.createElement(Button, { variant: 'secondary', loading: true }, "Here is a secondary button!")));
|
|
16
|
+
export const InteractiveLoading = () => {
|
|
17
|
+
const [loading, setLoading] = useState(false);
|
|
18
|
+
const handleLoad = () => {
|
|
19
|
+
setLoading(true);
|
|
20
|
+
setTimeout(() => setLoading(false), 1000);
|
|
21
|
+
};
|
|
22
|
+
return (React.createElement(Button, { loading: loading, onClick: handleLoad }, "Click me to load!"));
|
|
23
|
+
};
|
|
24
|
+
export default {
|
|
25
|
+
title: 'Components/Button',
|
|
26
|
+
component: Button,
|
|
27
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
const ButtonGroupDiv = styled.div `
|
|
4
|
+
display: flex;
|
|
5
|
+
|
|
6
|
+
& > * {
|
|
7
|
+
margin-right: 8px;
|
|
8
|
+
|
|
9
|
+
&:last-child {
|
|
10
|
+
margin-right: 0;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
const ButtonGroup = ({ children }) => {
|
|
15
|
+
return React.createElement(ButtonGroupDiv, null, children);
|
|
16
|
+
};
|
|
17
|
+
export default ButtonGroup;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Meta } from '@storybook/react/types-6-0';
|
|
3
|
+
export declare const Standard: () => JSX.Element;
|
|
4
|
+
export declare const TwoPrimary: () => JSX.Element;
|
|
5
|
+
export declare const SquareButtons: () => JSX.Element;
|
|
6
|
+
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonGroup, Button, SquareButton } from '../..';
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
export const Standard = () => (React.createElement(ButtonGroup, null,
|
|
5
|
+
React.createElement(Button, { variant: 'secondary' }, "Cancel"),
|
|
6
|
+
React.createElement(Button, null, "Create")));
|
|
7
|
+
export const TwoPrimary = () => (React.createElement(ButtonGroup, null,
|
|
8
|
+
React.createElement(Button, null, "No"),
|
|
9
|
+
React.createElement(Button, null, "Yes")));
|
|
10
|
+
export const SquareButtons = () => (React.createElement(ButtonGroup, null,
|
|
11
|
+
React.createElement(SquareButton, null, "The first button in the group"),
|
|
12
|
+
React.createElement(SquareButton, null, "Middle one"),
|
|
13
|
+
React.createElement(SquareButton, null, "Last..")));
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Components/ButtonGroup',
|
|
16
|
+
component: ButtonGroup,
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CardSize } from './Card.context';
|
|
3
|
+
export interface CardProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
size?: CardSize;
|
|
6
|
+
padded?: boolean;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const Card: {
|
|
10
|
+
({ children, padded, size, onClick }: CardProps): JSX.Element;
|
|
11
|
+
Actions: ({ children }: import("./_CardActions.component").CardActionsProps) => React.ReactPortal | null;
|
|
12
|
+
Action: ({ children, onClick }: import("./_CardActions.component").CardActionProps) => JSX.Element;
|
|
13
|
+
Content: ({ children }: import("./_CardContent.component").CardContentProps) => JSX.Element;
|
|
14
|
+
SubContent: ({ children }: import("./_CardSubContent.component").CardSubContentProps) => JSX.Element;
|
|
15
|
+
Media: ({ children }: import("./_CardMedia.component").CardMediaProps) => JSX.Element;
|
|
16
|
+
Spacer: () => JSX.Element;
|
|
17
|
+
Header: ({ image, heading, subHeading, meta }: import("./_CardHeader.component").CardHeaderProps) => JSX.Element;
|
|
18
|
+
};
|
|
19
|
+
export default Card;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { motion } from 'framer-motion';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import responsive from '../../responsive/responsive';
|
|
5
|
+
import CardContext from './Card.context';
|
|
6
|
+
import { CardActions, CardAction } from './_CardActions.component';
|
|
7
|
+
import CardContent from './_CardContent.component';
|
|
8
|
+
import CardHeader from './_CardHeader.component';
|
|
9
|
+
import CardMedia from './_CardMedia.component';
|
|
10
|
+
import CardSpacer from './_CardSpacer.component';
|
|
11
|
+
import CardSubContent from './_CardSubContent.component';
|
|
12
|
+
const CardActionsContainer = styled.div `
|
|
13
|
+
/* width: 100%; */
|
|
14
|
+
/* height: 32px; */
|
|
15
|
+
|
|
16
|
+
position: absolute;
|
|
17
|
+
/* top: -32px; */
|
|
18
|
+
top: -32px;
|
|
19
|
+
/* z-index: 0; */
|
|
20
|
+
`;
|
|
21
|
+
const CardInner = styled.div `
|
|
22
|
+
position: relative;
|
|
23
|
+
z-index: 1;
|
|
24
|
+
width: 100%;
|
|
25
|
+
|
|
26
|
+
background-color: ${(props) => props.theme.colours.cardBackground};
|
|
27
|
+
box-shadow: ${(props) => props.theme.shadows.small};
|
|
28
|
+
`;
|
|
29
|
+
const CardOuter = styled(motion.div) `
|
|
30
|
+
${(props) => {
|
|
31
|
+
switch (props.size) {
|
|
32
|
+
case 'fill':
|
|
33
|
+
return `
|
|
34
|
+
width: 100%;
|
|
35
|
+
`;
|
|
36
|
+
case 'xs':
|
|
37
|
+
return `
|
|
38
|
+
width: 240px;
|
|
39
|
+
${responsive.useStylesFor('mobile').andSmaller(`
|
|
40
|
+
width: 100%;
|
|
41
|
+
`)}
|
|
42
|
+
`;
|
|
43
|
+
case 'sm':
|
|
44
|
+
return `
|
|
45
|
+
width: ${responsive.getWidthFor('mobile')};
|
|
46
|
+
${responsive.useStylesFor('mobile').andSmaller(`
|
|
47
|
+
width: 100%;
|
|
48
|
+
`)}
|
|
49
|
+
`;
|
|
50
|
+
case 'md':
|
|
51
|
+
return `
|
|
52
|
+
width: ${responsive.getWidthFor('tablet')};
|
|
53
|
+
${responsive.useStylesFor('tablet').andSmaller(`
|
|
54
|
+
width: 100%;
|
|
55
|
+
`)}
|
|
56
|
+
`;
|
|
57
|
+
case 'lg':
|
|
58
|
+
default:
|
|
59
|
+
return `
|
|
60
|
+
width: ${responsive.getWidthFor('desktop')};
|
|
61
|
+
${responsive.useStylesFor('desktop').andSmaller(`
|
|
62
|
+
width: 100%;
|
|
63
|
+
`)}
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
}}
|
|
67
|
+
|
|
68
|
+
position: relative;
|
|
69
|
+
cursor: ${(props) => (props.usePointer ? 'pointer' : 'default')};
|
|
70
|
+
padding: ${(props) => (props.padded ? '16px' : 0)};
|
|
71
|
+
`;
|
|
72
|
+
const Card = ({ children, padded, size = 'sm', onClick }) => {
|
|
73
|
+
const actionsRef = useRef(null);
|
|
74
|
+
const [htmlActionsRef, setHtmlActionsRef] = useState();
|
|
75
|
+
const [showActions, setShowActions] = useState(false);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (actionsRef.current) {
|
|
78
|
+
setHtmlActionsRef(actionsRef.current);
|
|
79
|
+
}
|
|
80
|
+
}, [actionsRef]);
|
|
81
|
+
const handleClick = (e) => {
|
|
82
|
+
if (e.isActionClick) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (onClick) {
|
|
86
|
+
onClick();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return (React.createElement(CardContext.Provider, { value: { size, actionsRef: htmlActionsRef, showActions } },
|
|
90
|
+
React.createElement(CardOuter, { onHoverStart: () => setShowActions(true), onHoverEnd: () => setShowActions(false), size: size, padded: padded, onClick: handleClick, usePointer: !!onClick },
|
|
91
|
+
React.createElement(CardActionsContainer, { ref: actionsRef }),
|
|
92
|
+
React.createElement(CardInner, null, children))));
|
|
93
|
+
};
|
|
94
|
+
Card.Actions = CardActions;
|
|
95
|
+
Card.Action = CardAction;
|
|
96
|
+
Card.Content = CardContent;
|
|
97
|
+
Card.SubContent = CardSubContent;
|
|
98
|
+
Card.Media = CardMedia;
|
|
99
|
+
Card.Spacer = CardSpacer;
|
|
100
|
+
Card.Header = CardHeader;
|
|
101
|
+
export default Card;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type CardSize = 'fill' | 'xs' | 'sm' | 'md' | 'lg';
|
|
3
|
+
interface CardContextProps {
|
|
4
|
+
size: CardSize;
|
|
5
|
+
actionsRef?: HTMLDivElement;
|
|
6
|
+
showActions: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const CardContext: import("react").Context<CardContextProps>;
|
|
9
|
+
export default CardContext;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Meta } from '@storybook/react/types-6-0';
|
|
3
|
+
export declare const Standard: () => JSX.Element;
|
|
4
|
+
export declare const Sizes: () => JSX.Element;
|
|
5
|
+
export declare const CardHeader: () => JSX.Element;
|
|
6
|
+
export declare const Clickable: () => JSX.Element;
|
|
7
|
+
export declare const WithActions: () => JSX.Element;
|
|
8
|
+
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
9
|
+
export default _default;
|