imbric-theme 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.babelrc.json +3 -0
- package/.commitlintrc.json +3 -0
- package/.editorconfig +13 -0
- package/.eslintcache +1 -0
- package/.eslintrc.json +36 -0
- package/.huskyrc.json +6 -0
- package/.lintstagedrc.json +5 -0
- package/.nvmrc +1 -0
- package/.prettierrc.json +4 -0
- package/.releaserc.json +13 -0
- package/.storybook/main.js +9 -0
- package/.storybook/preview-head.html +2 -0
- package/.storybook/preview.js +32 -0
- package/.stylelintrc.json +14 -0
- package/.vscode/launch.json +15 -0
- package/CHANGELOG.md +0 -0
- package/README.md +69 -0
- package/atoms/Avatar/Avatar.js +36 -0
- package/atoms/Avatar/Avatar.module.css +3 -0
- package/atoms/Avatar/Avatar.stories.js +29 -0
- package/atoms/Avatar/__snapshots__/Avatar.stories.js.snap +105 -0
- package/atoms/Avatar/constants.js +3 -0
- package/atoms/Avatar/helpers.js +7 -0
- package/atoms/Avatar/index.js +3 -0
- package/atoms/Button/Button.js +68 -0
- package/atoms/Button/Button.module.css +63 -0
- package/atoms/Button/Button.stories.js +47 -0
- package/atoms/Button/Button.test.js +60 -0
- package/atoms/Button/__snapshots__/Button.stories.js.snap +191 -0
- package/atoms/Button/constants.js +3 -0
- package/atoms/Button/index.js +3 -0
- package/atoms/Card/Card.js +48 -0
- package/atoms/Card/Card.module.css +52 -0
- package/atoms/Card/Card.stories.js +41 -0
- package/atoms/Card/__snapshots__/Card.stories.js.snap +136 -0
- package/atoms/Card/constants.js +4 -0
- package/atoms/Card/index.js +3 -0
- package/atoms/Check/Check.js +26 -0
- package/atoms/Check/Check.module.css +11 -0
- package/atoms/Check/Check.stories.js +15 -0
- package/atoms/Check/__snapshots__/Check.stories.js.snap +67 -0
- package/atoms/Check/index.js +2 -0
- package/atoms/Divider/Divider.js +19 -0
- package/atoms/Divider/Divider.module.css +5 -0
- package/atoms/Divider/Divider.stories.js +12 -0
- package/atoms/Divider/__snapshots__/Divider.stories.js.snap +22 -0
- package/atoms/Divider/index.js +2 -0
- package/atoms/Heading/Heading.js +37 -0
- package/atoms/Heading/Heading.module.css +66 -0
- package/atoms/Heading/Heading.stories.js +46 -0
- package/atoms/Heading/__snapshots__/Heading.stories.js.snap +189 -0
- package/atoms/Heading/constants.js +5 -0
- package/atoms/Heading/index.js +3 -0
- package/atoms/Icon/Icon.js +66 -0
- package/atoms/Icon/Icon.module.css +112 -0
- package/atoms/Icon/Icon.stories.js +48 -0
- package/atoms/Icon/__snapshots__/Icon.stories.js.snap +1311 -0
- package/atoms/Icon/constants.js +486 -0
- package/atoms/Icon/helpers.js +9 -0
- package/atoms/Icon/index.js +3 -0
- package/atoms/Input/Input.js +49 -0
- package/atoms/Input/Input.module.css +27 -0
- package/atoms/Input/Input.stories.js +32 -0
- package/atoms/Input/__snapshots__/Input.stories.js.snap +101 -0
- package/atoms/Input/constants.js +3 -0
- package/atoms/Input/index.js +3 -0
- package/atoms/Link/Link.js +33 -0
- package/atoms/Link/Link.module.css +14 -0
- package/atoms/Link/Link.stories.js +30 -0
- package/atoms/Link/__snapshots__/Link.stories.js.snap +118 -0
- package/atoms/Link/constants.js +5 -0
- package/atoms/Link/index.js +3 -0
- package/atoms/Loading/Loading.js +30 -0
- package/atoms/Loading/Loading.module.css +51 -0
- package/atoms/Loading/Loading.stories.js +17 -0
- package/atoms/Loading/__snapshots__/Loading.stories.js.snap +26 -0
- package/atoms/Loading/index.js +2 -0
- package/atoms/Modal/Modal.js +98 -0
- package/atoms/Modal/Modal.module.css +85 -0
- package/atoms/Modal/Modal.stories.js +43 -0
- package/atoms/Modal/__snapshots__/Modal.stories.js.snap +239 -0
- package/atoms/Modal/constants.js +1 -0
- package/atoms/Modal/index.js +3 -0
- package/atoms/Paragraph/Paragraph.js +56 -0
- package/atoms/Paragraph/Paragraph.module.css +68 -0
- package/atoms/Paragraph/Paragraph.stories.js +52 -0
- package/atoms/Paragraph/__snapshots__/Paragraph.stories.js.snap +230 -0
- package/atoms/Paragraph/constants.js +5 -0
- package/atoms/Paragraph/index.js +3 -0
- package/atoms/Picture/Picture.js +40 -0
- package/atoms/Picture/Picture.module.css +16 -0
- package/atoms/Picture/Picture.stories.js +32 -0
- package/atoms/Picture/__snapshots__/Picture.stories.js.snap +156 -0
- package/atoms/Picture/index.js +2 -0
- package/atoms/Textarea/Textarea.js +46 -0
- package/atoms/Textarea/Textarea.module.css +25 -0
- package/atoms/Textarea/Textarea.stories.js +16 -0
- package/atoms/Textarea/__snapshots__/Textarea.stories.js.snap +25 -0
- package/atoms/Textarea/index.js +2 -0
- package/codecov.yml +2 -0
- package/helpers/storybook.js +29 -0
- package/helpers/storybook.test.js +40 -0
- package/helpers/styles.js +37 -0
- package/helpers/styles.test.js +222 -0
- package/hocs/withStyles.js +17 -0
- package/hook/useMedia.js +22 -0
- package/index.js +31 -0
- package/jest.config.js +23 -0
- package/jest.setup.js +13 -0
- package/layout/CenteredContent/CenteredContent.js +30 -0
- package/layout/CenteredContent/CenteredContent.module.css +12 -0
- package/layout/CenteredContent/CenteredContent.stories.js +22 -0
- package/layout/CenteredContent/__snapshots__/CenteredContent.stories.js.snap +27 -0
- package/layout/CenteredContent/index.js +2 -0
- package/layout/Container/Container.js +29 -0
- package/layout/Container/Container.module.css +14 -0
- package/layout/Container/Container.stories.js +22 -0
- package/layout/Container/__snapshots__/Container.stories.js.snap +27 -0
- package/layout/Container/index.js +2 -0
- package/layout/FullHeightContent/FullHeightContent.js +40 -0
- package/layout/FullHeightContent/FullHeightContent.module.css +21 -0
- package/layout/FullHeightContent/FullHeightContent.stories.js +22 -0
- package/layout/FullHeightContent/__snapshots__/FullHeightContent.stories.js.snap +41 -0
- package/layout/FullHeightContent/index.js +2 -0
- package/layout/Spacer/Spacer.js +40 -0
- package/layout/Spacer/Spacer.module.css +12 -0
- package/layout/Spacer/Spacer.stories.js +25 -0
- package/layout/Spacer/__snapshots__/Spacer.stories.js.snap +97 -0
- package/layout/Spacer/components/Horizontal/Horizontal.js +43 -0
- package/layout/Spacer/components/Horizontal/Horizontal.stories.js +32 -0
- package/layout/Spacer/components/Horizontal/__snapshots__/Horizontal.stories.js.snap +97 -0
- package/layout/Spacer/components/Horizontal/index.js +1 -0
- package/layout/Spacer/components/Vertical/Vertical.js +31 -0
- package/layout/Spacer/components/Vertical/Vertical.stories.js +25 -0
- package/layout/Spacer/components/Vertical/__snapshots__/Vertical.stories.js.snap +85 -0
- package/layout/Spacer/components/Vertical/index.js +1 -0
- package/layout/Spacer/components/index.js +2 -0
- package/layout/Spacer/constants.js +5 -0
- package/layout/Spacer/helpers.js +3 -0
- package/layout/Spacer/index.js +3 -0
- package/molecules/Accordion/Accordion.js +70 -0
- package/molecules/Accordion/Accordion.module.css +12 -0
- package/molecules/Accordion/Accordion.stories.js +31 -0
- package/molecules/Accordion/__snapshots__/Accordion.stories.js.snap +228 -0
- package/molecules/Accordion/index.js +2 -0
- package/molecules/AddButton/AddButton.js +137 -0
- package/molecules/AddButton/AddButton.module.css +128 -0
- package/molecules/AddButton/AddButton.stories.js +47 -0
- package/molecules/AddButton/__snapshots__/AddButton.stories.js.snap +326 -0
- package/molecules/AddButton/constants.js +6 -0
- package/molecules/AddButton/handlers.js +58 -0
- package/molecules/AddButton/handlers.test.js +19 -0
- package/molecules/AddButton/helpers.js +6 -0
- package/molecules/AddButton/helpers.test.js +41 -0
- package/molecules/AddButton/hooks.js +14 -0
- package/molecules/AddButton/index.js +3 -0
- package/molecules/ButtonIcon/ButtonIcon.js +41 -0
- package/molecules/ButtonIcon/ButtonIcon.stories.js +27 -0
- package/molecules/ButtonIcon/__snapshots__/ButtonIcon.stories.js.snap +178 -0
- package/molecules/ButtonIcon/constants.js +6 -0
- package/molecules/ButtonIcon/index.js +2 -0
- package/molecules/Dropdown/Dropdown.js +59 -0
- package/molecules/Dropdown/Dropdown.module.css +34 -0
- package/molecules/Dropdown/Dropdown.stories.js +41 -0
- package/molecules/Dropdown/__snapshots__/Dropdown.stories.js.snap +181 -0
- package/molecules/Dropdown/index.js +2 -0
- package/molecules/Error/Error.js +35 -0
- package/molecules/Error/Error.module.css +11 -0
- package/molecules/Error/Error.stories.js +18 -0
- package/molecules/Error/__snapshots__/Error.stories.js.snap +134 -0
- package/molecules/Error/index.js +2 -0
- package/molecules/IconLabel/IconLabel.js +83 -0
- package/molecules/IconLabel/IconLabel.module.css +16 -0
- package/molecules/IconLabel/IconLabel.stories.js +25 -0
- package/molecules/IconLabel/__snapshots__/IconLabel.stories.js.snap +211 -0
- package/molecules/IconLabel/constants.js +6 -0
- package/molecules/IconLabel/index.js +3 -0
- package/molecules/LoadingError/LoadingError.js +31 -0
- package/molecules/LoadingError/LoadingError.stories.js +24 -0
- package/molecules/LoadingError/__snapshots__/LoadingError.stories.js.snap +109 -0
- package/molecules/LoadingError/index.js +1 -0
- package/molecules/Score/Score.js +61 -0
- package/molecules/Score/Score.module.css +11 -0
- package/molecules/Score/Score.stories.js +13 -0
- package/molecules/Score/__snapshots__/Score.stories.js.snap +100 -0
- package/molecules/Score/faces/happy.svg +7 -0
- package/molecules/Score/faces/normal.svg +6 -0
- package/molecules/Score/faces/sad.svg +6 -0
- package/molecules/Score/index.js +2 -0
- package/molecules/Task/Task.js +114 -0
- package/molecules/Task/Task.module.css +47 -0
- package/molecules/Task/Task.stories.js +47 -0
- package/molecules/Task/__snapshots__/Task.stories.js.snap +953 -0
- package/molecules/Task/constants.js +1 -0
- package/molecules/Task/index.js +3 -0
- package/molecules/TaskCounter/TaskCounter.js +74 -0
- package/molecules/TaskCounter/TaskCounter.module.css +11 -0
- package/molecules/TaskCounter/TaskCounter.stories.js +26 -0
- package/molecules/TaskCounter/__snapshots__/TaskCounter.stories.js.snap +177 -0
- package/molecules/TaskCounter/index.js +2 -0
- package/package.json +102 -0
- package/scripts/build-tokens.js +40 -0
- package/scripts/create-component.js +127 -0
- package/storybook.test.js +13 -0
- package/styles/globals.css +10 -0
- package/styles/tokens.css +390 -0
- package/templates/component/Component.js +22 -0
- package/templates/component/Component.module.css +3 -0
- package/templates/component/Component.stories.js +23 -0
- package/templates/component/constants.js +1 -0
- package/templates/component/index.js +3 -0
- package/tokens/Token/Helper.js +30 -0
- package/tokens/Token/Token.js +13 -0
- package/tokens/Token/Token.module.css +64 -0
- package/tokens/Token/components/Color.js +21 -0
- package/tokens/Token/components/Color.stories.js +126 -0
- package/tokens/Token/components/FontFamily.js +24 -0
- package/tokens/Token/components/FontFamily.stories.js +32 -0
- package/tokens/Token/components/FontSize.js +24 -0
- package/tokens/Token/components/FontSize.stories.js +31 -0
- package/tokens/Token/components/FontWeight.js +24 -0
- package/tokens/Token/components/FontWeight.stories.js +31 -0
- package/tokens/Token/components/Spacing.js +24 -0
- package/tokens/Token/components/Spacing.stories.js +29 -0
- package/tokens/Token/components/__snapshots__/Color.stories.js.snap +7169 -0
- package/tokens/Token/components/__snapshots__/FontFamily.stories.js.snap +133 -0
- package/tokens/Token/components/__snapshots__/FontSize.stories.js.snap +261 -0
- package/tokens/Token/components/__snapshots__/FontWeight.stories.js.snap +317 -0
- package/tokens/Token/components/__snapshots__/Spacing.stories.js.snap +229 -0
- package/tokens/Token/components/index.js +5 -0
- package/tokens/Token/helpers.js +17 -0
- package/tokens/Token/index.js +1 -0
- package/tokens/index.js +471 -0
- package/utils/isEmpty.js +28 -0
- package/utils/isEmpty.test.js +125 -0
- package/utils/isObject.js +4 -0
- package/utils/keyboardCodes.js +6 -0
- package/utils/testUtils/matchMediaMock.js +14 -0
- package/utils/testUtils/svgrMock.js +2 -0
- package/utils/toCapitalize.js +4 -0
- package/utils/toKebabCase.js +8 -0
- package/utils/toPascalCase.js +20 -0
- package/webpack/cssModules.js +30 -0
- package/webpack/loadConfigs.js +6 -0
- package/webpack/reactInlineSvg.js +22 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
import { Horizontal } from '.'
|
2
|
+
import { options, styles } from '../..'
|
3
|
+
|
4
|
+
import {
|
5
|
+
getTemplate,
|
6
|
+
getListTemplate,
|
7
|
+
getOptionsArgTypes,
|
8
|
+
} from '../../../../helpers/storybook'
|
9
|
+
|
10
|
+
const Template = getTemplate(Horizontal, styles)
|
11
|
+
const ListTemplate = getListTemplate(Horizontal, styles)
|
12
|
+
|
13
|
+
export default {
|
14
|
+
title: 'Layout/Spacer/Horizontal',
|
15
|
+
component: Horizontal,
|
16
|
+
args: {
|
17
|
+
height: 100,
|
18
|
+
maxHeight: 100,
|
19
|
+
isPlayground: true,
|
20
|
+
},
|
21
|
+
argTypes: {
|
22
|
+
size: getOptionsArgTypes(options.sizes),
|
23
|
+
height: { control: 'number' },
|
24
|
+
maxHeight: { control: 'number' },
|
25
|
+
},
|
26
|
+
parameters: { __sb: { fd: 'row' } },
|
27
|
+
}
|
28
|
+
|
29
|
+
export const Default = Template.bind({})
|
30
|
+
|
31
|
+
export const Sizes = ListTemplate.bind({})
|
32
|
+
Sizes.args = { items: options.sizes.map((size) => ({ size })) }
|
@@ -0,0 +1,97 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`Storyshots Layout/Spacer/Horizontal Default 1`] = `
|
4
|
+
<div
|
5
|
+
style={
|
6
|
+
Object {
|
7
|
+
"alignContent": "flex-start",
|
8
|
+
"display": "flex",
|
9
|
+
"flexDirection": "row",
|
10
|
+
"flexWrap": "wrap",
|
11
|
+
"gap": "10px 30px",
|
12
|
+
"height": "100%",
|
13
|
+
"justifyContent": "flex-start",
|
14
|
+
"maxHeight": "auto",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
>
|
18
|
+
<div
|
19
|
+
className="spacer horizontal is-playground"
|
20
|
+
style={
|
21
|
+
Object {
|
22
|
+
"height": 100,
|
23
|
+
"maxHeight": 100,
|
24
|
+
"width": 0,
|
25
|
+
}
|
26
|
+
}
|
27
|
+
/>
|
28
|
+
</div>
|
29
|
+
`;
|
30
|
+
|
31
|
+
exports[`Storyshots Layout/Spacer/Horizontal Sizes 1`] = `
|
32
|
+
<div
|
33
|
+
style={
|
34
|
+
Object {
|
35
|
+
"alignContent": "flex-start",
|
36
|
+
"display": "flex",
|
37
|
+
"flexDirection": "row",
|
38
|
+
"flexWrap": "wrap",
|
39
|
+
"gap": "10px 30px",
|
40
|
+
"height": "100%",
|
41
|
+
"justifyContent": "flex-start",
|
42
|
+
"maxHeight": "auto",
|
43
|
+
}
|
44
|
+
}
|
45
|
+
>
|
46
|
+
<div
|
47
|
+
className="spacer horizontal is-playground"
|
48
|
+
style={
|
49
|
+
Object {
|
50
|
+
"height": 100,
|
51
|
+
"maxHeight": 100,
|
52
|
+
"width": 0,
|
53
|
+
}
|
54
|
+
}
|
55
|
+
/>
|
56
|
+
<div
|
57
|
+
className="spacer horizontal is-playground"
|
58
|
+
style={
|
59
|
+
Object {
|
60
|
+
"height": 100,
|
61
|
+
"maxHeight": 100,
|
62
|
+
"width": 5,
|
63
|
+
}
|
64
|
+
}
|
65
|
+
/>
|
66
|
+
<div
|
67
|
+
className="spacer horizontal is-playground"
|
68
|
+
style={
|
69
|
+
Object {
|
70
|
+
"height": 100,
|
71
|
+
"maxHeight": 100,
|
72
|
+
"width": 15,
|
73
|
+
}
|
74
|
+
}
|
75
|
+
/>
|
76
|
+
<div
|
77
|
+
className="spacer horizontal is-playground"
|
78
|
+
style={
|
79
|
+
Object {
|
80
|
+
"height": 100,
|
81
|
+
"maxHeight": 100,
|
82
|
+
"width": 20,
|
83
|
+
}
|
84
|
+
}
|
85
|
+
/>
|
86
|
+
<div
|
87
|
+
className="spacer horizontal is-playground"
|
88
|
+
style={
|
89
|
+
Object {
|
90
|
+
"height": 100,
|
91
|
+
"maxHeight": 100,
|
92
|
+
"width": 40,
|
93
|
+
}
|
94
|
+
}
|
95
|
+
/>
|
96
|
+
</div>
|
97
|
+
`;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default, Horizontal } from './Horizontal'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
import { mapSize } from '../../helpers'
|
4
|
+
|
5
|
+
import styles from '../../Spacer.module.css'
|
6
|
+
import withStyles from '../../../../hocs/withStyles'
|
7
|
+
|
8
|
+
export const Vertical = ({ getStyles, size, isPlayground }) => (
|
9
|
+
<div
|
10
|
+
className={getStyles('spacer', 'vertical', {
|
11
|
+
'is-playground': isPlayground,
|
12
|
+
})}
|
13
|
+
style={{
|
14
|
+
height: mapSize(size),
|
15
|
+
}}
|
16
|
+
/>
|
17
|
+
)
|
18
|
+
|
19
|
+
Vertical.propTypes = {
|
20
|
+
getStyles: PropTypes.func.isRequired,
|
21
|
+
size: PropTypes.string.isRequired,
|
22
|
+
isPlayground: PropTypes.bool,
|
23
|
+
}
|
24
|
+
|
25
|
+
Vertical.defaultProps = {
|
26
|
+
size: 'none',
|
27
|
+
isPlayground: false,
|
28
|
+
getStyles: () => {},
|
29
|
+
}
|
30
|
+
|
31
|
+
export default withStyles(styles)(Vertical)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { Vertical } from '.'
|
2
|
+
import { options, styles } from '../..'
|
3
|
+
|
4
|
+
import {
|
5
|
+
getTemplate,
|
6
|
+
getListTemplate,
|
7
|
+
getOptionsArgTypes,
|
8
|
+
} from '../../../../helpers/storybook'
|
9
|
+
|
10
|
+
const Template = getTemplate(Vertical, styles)
|
11
|
+
const ListTemplate = getListTemplate(Vertical, styles)
|
12
|
+
|
13
|
+
export default {
|
14
|
+
title: 'Layout/Spacer/Vertical',
|
15
|
+
component: Vertical,
|
16
|
+
args: { isPlayground: true },
|
17
|
+
argTypes: {
|
18
|
+
size: getOptionsArgTypes(options.sizes),
|
19
|
+
},
|
20
|
+
}
|
21
|
+
|
22
|
+
export const Default = Template.bind({})
|
23
|
+
|
24
|
+
export const Sizes = ListTemplate.bind({})
|
25
|
+
Sizes.args = { items: options.sizes.map((size) => ({ size })) }
|
@@ -0,0 +1,85 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`Storyshots Layout/Spacer/Vertical Default 1`] = `
|
4
|
+
<div
|
5
|
+
style={
|
6
|
+
Object {
|
7
|
+
"alignContent": "flex-start",
|
8
|
+
"display": "flex",
|
9
|
+
"flexDirection": "column",
|
10
|
+
"flexWrap": "wrap",
|
11
|
+
"gap": "10px 30px",
|
12
|
+
"height": "100%",
|
13
|
+
"justifyContent": "flex-start",
|
14
|
+
"maxHeight": "auto",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
>
|
18
|
+
<div
|
19
|
+
className="spacer vertical is-playground"
|
20
|
+
style={
|
21
|
+
Object {
|
22
|
+
"height": 0,
|
23
|
+
}
|
24
|
+
}
|
25
|
+
/>
|
26
|
+
</div>
|
27
|
+
`;
|
28
|
+
|
29
|
+
exports[`Storyshots Layout/Spacer/Vertical Sizes 1`] = `
|
30
|
+
<div
|
31
|
+
style={
|
32
|
+
Object {
|
33
|
+
"alignContent": "flex-start",
|
34
|
+
"display": "flex",
|
35
|
+
"flexDirection": "column",
|
36
|
+
"flexWrap": "wrap",
|
37
|
+
"gap": "10px 30px",
|
38
|
+
"height": "100%",
|
39
|
+
"justifyContent": "flex-start",
|
40
|
+
"maxHeight": "auto",
|
41
|
+
}
|
42
|
+
}
|
43
|
+
>
|
44
|
+
<div
|
45
|
+
className="spacer vertical is-playground"
|
46
|
+
style={
|
47
|
+
Object {
|
48
|
+
"height": 0,
|
49
|
+
}
|
50
|
+
}
|
51
|
+
/>
|
52
|
+
<div
|
53
|
+
className="spacer vertical is-playground"
|
54
|
+
style={
|
55
|
+
Object {
|
56
|
+
"height": 5,
|
57
|
+
}
|
58
|
+
}
|
59
|
+
/>
|
60
|
+
<div
|
61
|
+
className="spacer vertical is-playground"
|
62
|
+
style={
|
63
|
+
Object {
|
64
|
+
"height": 15,
|
65
|
+
}
|
66
|
+
}
|
67
|
+
/>
|
68
|
+
<div
|
69
|
+
className="spacer vertical is-playground"
|
70
|
+
style={
|
71
|
+
Object {
|
72
|
+
"height": 20,
|
73
|
+
}
|
74
|
+
}
|
75
|
+
/>
|
76
|
+
<div
|
77
|
+
className="spacer vertical is-playground"
|
78
|
+
style={
|
79
|
+
Object {
|
80
|
+
"height": 40,
|
81
|
+
}
|
82
|
+
}
|
83
|
+
/>
|
84
|
+
</div>
|
85
|
+
`;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default, Vertical } from './Vertical'
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
|
4
|
+
import Paragraph from '../../atoms/Paragraph'
|
5
|
+
import Divider from '../../atoms/Divider'
|
6
|
+
import Icon from '../../atoms/Icon'
|
7
|
+
import Spacer from '../../layout/Spacer'
|
8
|
+
|
9
|
+
import styles from './Accordion.module.css'
|
10
|
+
import withStyles from '../../hocs/withStyles'
|
11
|
+
|
12
|
+
const handleToggle = ({ onToggle, isCollapsed, setIsCollapsed }) => () => {
|
13
|
+
setIsCollapsed(!isCollapsed)
|
14
|
+
onToggle(!isCollapsed)
|
15
|
+
}
|
16
|
+
|
17
|
+
export const Accordion = ({
|
18
|
+
title,
|
19
|
+
children,
|
20
|
+
onToggle,
|
21
|
+
getStyles,
|
22
|
+
defaultIsCollapsed,
|
23
|
+
addons,
|
24
|
+
}) => {
|
25
|
+
const [isCollapsed, setIsCollapsed] = useState(defaultIsCollapsed)
|
26
|
+
|
27
|
+
return (
|
28
|
+
<div className={getStyles('accordion')}>
|
29
|
+
<div
|
30
|
+
className={getStyles('container')}
|
31
|
+
onClick={handleToggle({ onToggle, isCollapsed, setIsCollapsed })}
|
32
|
+
>
|
33
|
+
<Icon
|
34
|
+
color="inverted"
|
35
|
+
size="sm"
|
36
|
+
name={isCollapsed ? 'angleDown' : 'angleUp'}
|
37
|
+
background="muted"
|
38
|
+
/>
|
39
|
+
<Spacer.Horizontal size="sm" />
|
40
|
+
{addons && addons.prepend}
|
41
|
+
<Paragraph weight="medium">{title}</Paragraph>
|
42
|
+
{addons && addons.append}
|
43
|
+
</div>
|
44
|
+
<Spacer.Vertical size="xs" />
|
45
|
+
<Divider />
|
46
|
+
{!isCollapsed && children}
|
47
|
+
</div>
|
48
|
+
)
|
49
|
+
}
|
50
|
+
|
51
|
+
Accordion.propTypes = {
|
52
|
+
title: PropTypes.string.isRequired,
|
53
|
+
getStyles: PropTypes.func.isRequired,
|
54
|
+
children: PropTypes.node,
|
55
|
+
onToggle: PropTypes.func,
|
56
|
+
defaultIsCollapsed: PropTypes.bool,
|
57
|
+
addons: PropTypes.shape({
|
58
|
+
prepend: PropTypes.node,
|
59
|
+
append: PropTypes.node,
|
60
|
+
}),
|
61
|
+
}
|
62
|
+
|
63
|
+
Accordion.defaultProps = {
|
64
|
+
getStyles: () => {},
|
65
|
+
onToggle: () => {},
|
66
|
+
current: 0,
|
67
|
+
defaultIsCollapsed: true,
|
68
|
+
}
|
69
|
+
|
70
|
+
export default withStyles(styles)(Accordion)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { Accordion, styles } from '.'
|
2
|
+
|
3
|
+
import { getTemplate } from '../../helpers/storybook'
|
4
|
+
|
5
|
+
const Template = getTemplate(Accordion, styles)
|
6
|
+
|
7
|
+
export default {
|
8
|
+
title: 'Molecules/Accordion',
|
9
|
+
component: Accordion,
|
10
|
+
args: {
|
11
|
+
title: 'Em Sméagol body.',
|
12
|
+
children:
|
13
|
+
"Fells defeated veins this. There and Back Again. A Hobbit's Tale. Loved lucky Istari difficult lay? Dale fellow's rioting. Blanket Misty Mountain started rival wriggles flatten convinced succumbed closing? Slug town fond pipe-weed flatten recognizes Goblins! Innards pouf admirable freely nothingness sleepless exactly afternoon cruelty Bofur? Craftsmen tested fair Alfrid gets figure words winter's field offer healed squash? These galumphing Grima tread mustn't seen melt ideal picked recover employment. Nazgûl alas luckiest?",
|
14
|
+
},
|
15
|
+
}
|
16
|
+
|
17
|
+
export const Default = Template.bind({})
|
18
|
+
|
19
|
+
export const AddonPrepend = Template.bind({})
|
20
|
+
AddonPrepend.args = {
|
21
|
+
addons: {
|
22
|
+
prepend: 'Dare Erebor forgive most.',
|
23
|
+
},
|
24
|
+
}
|
25
|
+
|
26
|
+
export const AddonAppend = Template.bind({})
|
27
|
+
AddonAppend.args = {
|
28
|
+
addons: {
|
29
|
+
append: 'But ill-tempered Thengel.',
|
30
|
+
},
|
31
|
+
}
|
@@ -0,0 +1,228 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`Storyshots Molecules/Accordion Addon Append 1`] = `
|
4
|
+
<div
|
5
|
+
style={
|
6
|
+
Object {
|
7
|
+
"alignContent": "flex-start",
|
8
|
+
"display": "flex",
|
9
|
+
"flexDirection": "column",
|
10
|
+
"flexWrap": "wrap",
|
11
|
+
"gap": "10px 30px",
|
12
|
+
"height": "100%",
|
13
|
+
"justifyContent": "flex-start",
|
14
|
+
"maxHeight": "auto",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
>
|
18
|
+
<div
|
19
|
+
className="accordion"
|
20
|
+
>
|
21
|
+
<div
|
22
|
+
className="container"
|
23
|
+
onClick={[Function]}
|
24
|
+
>
|
25
|
+
<div
|
26
|
+
className="icon color-inverted size-sm background-muted"
|
27
|
+
style={
|
28
|
+
Object {
|
29
|
+
"height": 25,
|
30
|
+
"width": 25,
|
31
|
+
}
|
32
|
+
}
|
33
|
+
>
|
34
|
+
<svg
|
35
|
+
height={25}
|
36
|
+
viewBox="0 0 15 9"
|
37
|
+
width={25}
|
38
|
+
xmlns="http://www.w3.org/2000/svg"
|
39
|
+
>
|
40
|
+
<path
|
41
|
+
clipRule="evenodd"
|
42
|
+
d="M7.82633 8.70623L0.882568 1.54063L1.89405 0.496826L7.82633 6.61863L13.7586 0.496826L14.7701 1.54063L7.82633 8.70623Z"
|
43
|
+
fillRule="evenodd"
|
44
|
+
/>
|
45
|
+
</svg>
|
46
|
+
</div>
|
47
|
+
<div
|
48
|
+
className="spacer horizontal"
|
49
|
+
style={
|
50
|
+
Object {
|
51
|
+
"height": "100%",
|
52
|
+
"maxHeight": "auto",
|
53
|
+
"width": 15,
|
54
|
+
}
|
55
|
+
}
|
56
|
+
/>
|
57
|
+
<p
|
58
|
+
className="paragraph color-base size-md weight-medium"
|
59
|
+
>
|
60
|
+
Em Sméagol body.
|
61
|
+
</p>
|
62
|
+
But ill-tempered Thengel.
|
63
|
+
</div>
|
64
|
+
<div
|
65
|
+
className="spacer vertical"
|
66
|
+
style={
|
67
|
+
Object {
|
68
|
+
"height": 5,
|
69
|
+
}
|
70
|
+
}
|
71
|
+
/>
|
72
|
+
<div
|
73
|
+
className="divider"
|
74
|
+
/>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
`;
|
78
|
+
|
79
|
+
exports[`Storyshots Molecules/Accordion Addon Prepend 1`] = `
|
80
|
+
<div
|
81
|
+
style={
|
82
|
+
Object {
|
83
|
+
"alignContent": "flex-start",
|
84
|
+
"display": "flex",
|
85
|
+
"flexDirection": "column",
|
86
|
+
"flexWrap": "wrap",
|
87
|
+
"gap": "10px 30px",
|
88
|
+
"height": "100%",
|
89
|
+
"justifyContent": "flex-start",
|
90
|
+
"maxHeight": "auto",
|
91
|
+
}
|
92
|
+
}
|
93
|
+
>
|
94
|
+
<div
|
95
|
+
className="accordion"
|
96
|
+
>
|
97
|
+
<div
|
98
|
+
className="container"
|
99
|
+
onClick={[Function]}
|
100
|
+
>
|
101
|
+
<div
|
102
|
+
className="icon color-inverted size-sm background-muted"
|
103
|
+
style={
|
104
|
+
Object {
|
105
|
+
"height": 25,
|
106
|
+
"width": 25,
|
107
|
+
}
|
108
|
+
}
|
109
|
+
>
|
110
|
+
<svg
|
111
|
+
height={25}
|
112
|
+
viewBox="0 0 15 9"
|
113
|
+
width={25}
|
114
|
+
xmlns="http://www.w3.org/2000/svg"
|
115
|
+
>
|
116
|
+
<path
|
117
|
+
clipRule="evenodd"
|
118
|
+
d="M7.82633 8.70623L0.882568 1.54063L1.89405 0.496826L7.82633 6.61863L13.7586 0.496826L14.7701 1.54063L7.82633 8.70623Z"
|
119
|
+
fillRule="evenodd"
|
120
|
+
/>
|
121
|
+
</svg>
|
122
|
+
</div>
|
123
|
+
<div
|
124
|
+
className="spacer horizontal"
|
125
|
+
style={
|
126
|
+
Object {
|
127
|
+
"height": "100%",
|
128
|
+
"maxHeight": "auto",
|
129
|
+
"width": 15,
|
130
|
+
}
|
131
|
+
}
|
132
|
+
/>
|
133
|
+
Dare Erebor forgive most.
|
134
|
+
<p
|
135
|
+
className="paragraph color-base size-md weight-medium"
|
136
|
+
>
|
137
|
+
Em Sméagol body.
|
138
|
+
</p>
|
139
|
+
</div>
|
140
|
+
<div
|
141
|
+
className="spacer vertical"
|
142
|
+
style={
|
143
|
+
Object {
|
144
|
+
"height": 5,
|
145
|
+
}
|
146
|
+
}
|
147
|
+
/>
|
148
|
+
<div
|
149
|
+
className="divider"
|
150
|
+
/>
|
151
|
+
</div>
|
152
|
+
</div>
|
153
|
+
`;
|
154
|
+
|
155
|
+
exports[`Storyshots Molecules/Accordion Default 1`] = `
|
156
|
+
<div
|
157
|
+
style={
|
158
|
+
Object {
|
159
|
+
"alignContent": "flex-start",
|
160
|
+
"display": "flex",
|
161
|
+
"flexDirection": "column",
|
162
|
+
"flexWrap": "wrap",
|
163
|
+
"gap": "10px 30px",
|
164
|
+
"height": "100%",
|
165
|
+
"justifyContent": "flex-start",
|
166
|
+
"maxHeight": "auto",
|
167
|
+
}
|
168
|
+
}
|
169
|
+
>
|
170
|
+
<div
|
171
|
+
className="accordion"
|
172
|
+
>
|
173
|
+
<div
|
174
|
+
className="container"
|
175
|
+
onClick={[Function]}
|
176
|
+
>
|
177
|
+
<div
|
178
|
+
className="icon color-inverted size-sm background-muted"
|
179
|
+
style={
|
180
|
+
Object {
|
181
|
+
"height": 25,
|
182
|
+
"width": 25,
|
183
|
+
}
|
184
|
+
}
|
185
|
+
>
|
186
|
+
<svg
|
187
|
+
height={25}
|
188
|
+
viewBox="0 0 15 9"
|
189
|
+
width={25}
|
190
|
+
xmlns="http://www.w3.org/2000/svg"
|
191
|
+
>
|
192
|
+
<path
|
193
|
+
clipRule="evenodd"
|
194
|
+
d="M7.82633 8.70623L0.882568 1.54063L1.89405 0.496826L7.82633 6.61863L13.7586 0.496826L14.7701 1.54063L7.82633 8.70623Z"
|
195
|
+
fillRule="evenodd"
|
196
|
+
/>
|
197
|
+
</svg>
|
198
|
+
</div>
|
199
|
+
<div
|
200
|
+
className="spacer horizontal"
|
201
|
+
style={
|
202
|
+
Object {
|
203
|
+
"height": "100%",
|
204
|
+
"maxHeight": "auto",
|
205
|
+
"width": 15,
|
206
|
+
}
|
207
|
+
}
|
208
|
+
/>
|
209
|
+
<p
|
210
|
+
className="paragraph color-base size-md weight-medium"
|
211
|
+
>
|
212
|
+
Em Sméagol body.
|
213
|
+
</p>
|
214
|
+
</div>
|
215
|
+
<div
|
216
|
+
className="spacer vertical"
|
217
|
+
style={
|
218
|
+
Object {
|
219
|
+
"height": 5,
|
220
|
+
}
|
221
|
+
}
|
222
|
+
/>
|
223
|
+
<div
|
224
|
+
className="divider"
|
225
|
+
/>
|
226
|
+
</div>
|
227
|
+
</div>
|
228
|
+
`;
|