@storybook/components 5.2.1 → 5.2.5
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/dist/html.js +1 -1
- package/dist/typography/DocumentFormatting.js +2 -1
- package/dist/typography/DocumentWrapper.js +2 -2
- package/package.json +11 -5
- package/src/ActionBar/ActionBar.stories.tsx +0 -41
- package/src/ActionBar/ActionBar.tsx +0 -75
- package/src/Badge/Badge.stories.tsx +0 -11
- package/src/Badge/Badge.tsx +0 -68
- package/src/Button/Button.stories.tsx +0 -53
- package/src/Button/Button.tsx +0 -256
- package/src/ScrollArea/ScrollArea.stories.tsx +0 -85
- package/src/ScrollArea/ScrollArea.tsx +0 -62
- package/src/ScrollArea/ScrollAreaStyles.tsx +0 -166
- package/src/addon-panel/addon-panel.tsx +0 -33
- package/src/bar/bar.tsx +0 -93
- package/src/bar/button.ts +0 -89
- package/src/bar/separator.tsx +0 -39
- package/src/blocks/BlockBackgroundStyles.tsx +0 -9
- package/src/blocks/ColorPalette.stories.tsx +0 -29
- package/src/blocks/ColorPalette.tsx +0 -168
- package/src/blocks/Description.stories.tsx +0 -15
- package/src/blocks/Description.tsx +0 -18
- package/src/blocks/DocsPage.stories.tsx +0 -67
- package/src/blocks/DocsPage.tsx +0 -81
- package/src/blocks/DocsPageExampleCaption.md +0 -93
- package/src/blocks/DocsPageExampleCaption.mdx +0 -93
- package/src/blocks/EmptyBlock.stories.tsx +0 -9
- package/src/blocks/EmptyBlock.tsx +0 -23
- package/src/blocks/IFrame.tsx +0 -60
- package/src/blocks/IconGallery.stories.tsx +0 -32
- package/src/blocks/IconGallery.tsx +0 -72
- package/src/blocks/Preview.stories.tsx +0 -96
- package/src/blocks/Preview.tsx +0 -162
- package/src/blocks/PropsTable/PropDef.ts +0 -7
- package/src/blocks/PropsTable/PropRow.stories.tsx +0 -113
- package/src/blocks/PropsTable/PropRow.tsx +0 -102
- package/src/blocks/PropsTable/PropsTable.stories.tsx +0 -14
- package/src/blocks/PropsTable/PropsTable.tsx +0 -169
- package/src/blocks/Source.stories.tsx +0 -36
- package/src/blocks/Source.tsx +0 -72
- package/src/blocks/Story.stories.tsx +0 -25
- package/src/blocks/Story.tsx +0 -115
- package/src/blocks/Toolbar.tsx +0 -85
- package/src/blocks/Typeset.stories.tsx +0 -16
- package/src/blocks/Typeset.tsx +0 -68
- package/src/blocks/ZoomContext.tsx +0 -5
- package/src/blocks/index.ts +0 -10
- package/src/brand/StorybookIcon.stories.tsx +0 -6
- package/src/brand/StorybookIcon.tsx +0 -26
- package/src/brand/StorybookLogo.stories.tsx +0 -10
- package/src/brand/StorybookLogo.tsx +0 -33
- package/src/form/field/field.tsx +0 -42
- package/src/form/form.stories.tsx +0 -133
- package/src/form/index.tsx +0 -18
- package/src/form/input/input.tsx +0 -178
- package/src/html.tsx +0 -12
- package/src/icon/icon.stories.tsx +0 -77
- package/src/icon/icon.tsx +0 -22
- package/src/icon/icons.tsx +0 -310
- package/src/icon/svg.tsx +0 -24
- package/src/index.ts +0 -37
- package/src/placeholder/placeholder.stories.tsx +0 -24
- package/src/placeholder/placeholder.tsx +0 -25
- package/src/spaced/Spaced.stories.tsx +0 -72
- package/src/spaced/Spaced.tsx +0 -69
- package/src/syntaxhighlighter/formatter.test.js +0 -90
- package/src/syntaxhighlighter/formatter.ts +0 -26
- package/src/syntaxhighlighter/syntaxhighlighter.stories.tsx +0 -136
- package/src/syntaxhighlighter/syntaxhighlighter.tsx +0 -165
- package/src/tabs/tabs.stories.tsx +0 -207
- package/src/tabs/tabs.tsx +0 -252
- package/src/tooltip/ListItem.stories.tsx +0 -35
- package/src/tooltip/ListItem.tsx +0 -245
- package/src/tooltip/Tooltip.stories.tsx +0 -42
- package/src/tooltip/Tooltip.tsx +0 -146
- package/src/tooltip/TooltipLinkList.stories.tsx +0 -52
- package/src/tooltip/TooltipLinkList.tsx +0 -49
- package/src/tooltip/TooltipMessage.stories.tsx +0 -37
- package/src/tooltip/TooltipMessage.tsx +0 -67
- package/src/tooltip/TooltipNote.stories.tsx +0 -15
- package/src/tooltip/TooltipNote.tsx +0 -25
- package/src/tooltip/WithTooltip.stories.tsx +0 -85
- package/src/tooltip/WithTooltip.tsx +0 -159
- package/src/typings.d.ts +0 -4
- package/src/typography/DocumentFormatting.tsx +0 -355
- package/src/typography/DocumentFormattingSample.md +0 -127
- package/src/typography/DocumentWrapper.stories.tsx +0 -190
- package/src/typography/DocumentWrapper.tsx +0 -441
- package/src/typography/link/link.stories.tsx +0 -67
- package/src/typography/link/link.test.tsx +0 -108
- package/src/typography/link/link.tsx +0 -223
- package/src/typography/typography.stories.tsx +0 -111
- package/src/typography/withReset.tsx +0 -12
- package/tsconfig.json +0 -18
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import React, { AnchorHTMLAttributes, FunctionComponent } from 'react';
|
|
2
|
-
import { styled, css, Theme } from '@storybook/theming';
|
|
3
|
-
import { darken } from 'polished';
|
|
4
|
-
|
|
5
|
-
import { Icons } from '../../icon/icon';
|
|
6
|
-
|
|
7
|
-
// Cmd/Ctrl/Shift/Alt + Click should trigger default browser behaviour. Same applies to non-left clicks
|
|
8
|
-
const LEFT_BUTTON = 0;
|
|
9
|
-
|
|
10
|
-
const isPlainLeftClick = (e: React.MouseEvent) =>
|
|
11
|
-
e.button === LEFT_BUTTON && !e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey;
|
|
12
|
-
|
|
13
|
-
const cancelled = (e: React.MouseEvent, cb: (_e: React.MouseEvent) => void) => {
|
|
14
|
-
if (isPlainLeftClick(e)) {
|
|
15
|
-
e.preventDefault();
|
|
16
|
-
cb(e);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export interface LinkStylesProps {
|
|
21
|
-
secondary?: boolean;
|
|
22
|
-
tertiary?: boolean;
|
|
23
|
-
nochrome?: boolean;
|
|
24
|
-
inverse?: boolean;
|
|
25
|
-
isButton?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const linkStyles = (props: LinkStylesProps & { theme: Theme }) => css`
|
|
29
|
-
display: inline-block;
|
|
30
|
-
transition: all 150ms ease-out;
|
|
31
|
-
text-decoration: none;
|
|
32
|
-
|
|
33
|
-
color: ${props.theme.color.secondary};
|
|
34
|
-
svg path {
|
|
35
|
-
fill: ${props.theme.color.secondary};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&:hover,
|
|
39
|
-
&:focus {
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
color: ${darken(0.07, props.theme.color.secondary)};
|
|
42
|
-
svg path {
|
|
43
|
-
fill: ${darken(0.07, props.theme.color.secondary)};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
&:active {
|
|
47
|
-
color: ${darken(0.1, props.theme.color.secondary)};
|
|
48
|
-
svg path {
|
|
49
|
-
fill: ${darken(0.1, props.theme.color.secondary)};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
svg {
|
|
54
|
-
display: inline-block;
|
|
55
|
-
height: 1em;
|
|
56
|
-
width: 1em;
|
|
57
|
-
vertical-align: text-top;
|
|
58
|
-
position: relative;
|
|
59
|
-
bottom: -0.125em;
|
|
60
|
-
margin-right: 0.4em;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
${props.secondary &&
|
|
64
|
-
css`
|
|
65
|
-
color: ${props.theme.color.mediumdark};
|
|
66
|
-
svg path {
|
|
67
|
-
fill: ${props.theme.color.mediumdark};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&:hover {
|
|
71
|
-
color: ${props.theme.color.dark};
|
|
72
|
-
svg path {
|
|
73
|
-
fill: ${props.theme.color.dark};
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
&:active {
|
|
78
|
-
color: ${props.theme.color.darker};
|
|
79
|
-
svg path {
|
|
80
|
-
fill: ${props.theme.color.darker};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`};
|
|
84
|
-
|
|
85
|
-
${props.tertiary &&
|
|
86
|
-
css`
|
|
87
|
-
color: ${props.theme.color.dark};
|
|
88
|
-
svg path {
|
|
89
|
-
fill: ${props.theme.color.dark};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&:hover {
|
|
93
|
-
color: ${props.theme.color.darkest};
|
|
94
|
-
svg path {
|
|
95
|
-
fill: ${props.theme.color.darkest};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&:active {
|
|
100
|
-
color: ${props.theme.color.mediumdark};
|
|
101
|
-
svg path {
|
|
102
|
-
fill: ${props.theme.color.mediumdark};
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
`};
|
|
106
|
-
|
|
107
|
-
${props.nochrome &&
|
|
108
|
-
css`
|
|
109
|
-
color: inherit;
|
|
110
|
-
|
|
111
|
-
&:hover,
|
|
112
|
-
&:active {
|
|
113
|
-
color: inherit;
|
|
114
|
-
text-decoration: underline;
|
|
115
|
-
}
|
|
116
|
-
`};
|
|
117
|
-
|
|
118
|
-
${props.inverse &&
|
|
119
|
-
css`
|
|
120
|
-
color: ${props.theme.color.lightest};
|
|
121
|
-
svg path {
|
|
122
|
-
fill: ${props.theme.color.lightest};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
&:hover {
|
|
126
|
-
color: ${props.theme.color.lighter};
|
|
127
|
-
svg path {
|
|
128
|
-
fill: ${props.theme.color.lighter};
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
&:active {
|
|
133
|
-
color: ${props.theme.color.light};
|
|
134
|
-
svg path {
|
|
135
|
-
fill: ${props.theme.color.light};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
`};
|
|
139
|
-
|
|
140
|
-
${props.isButton &&
|
|
141
|
-
css`
|
|
142
|
-
border: 0;
|
|
143
|
-
border-radius: 0;
|
|
144
|
-
background: none;
|
|
145
|
-
padding: 0;
|
|
146
|
-
font-size: inherit;
|
|
147
|
-
`};
|
|
148
|
-
`;
|
|
149
|
-
|
|
150
|
-
export interface LinkInnerProps {
|
|
151
|
-
withArrow?: boolean;
|
|
152
|
-
containsIcon?: boolean;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const LinkInner = styled.span`
|
|
156
|
-
${(props: LinkInnerProps) =>
|
|
157
|
-
props.withArrow &&
|
|
158
|
-
css`
|
|
159
|
-
> svg:last-of-type {
|
|
160
|
-
height: 0.7em;
|
|
161
|
-
width: 0.7em;
|
|
162
|
-
margin-right: 0;
|
|
163
|
-
margin-left: 0.25em;
|
|
164
|
-
bottom: auto;
|
|
165
|
-
vertical-align: inherit;
|
|
166
|
-
}
|
|
167
|
-
`};
|
|
168
|
-
|
|
169
|
-
${props =>
|
|
170
|
-
props.containsIcon &&
|
|
171
|
-
css`
|
|
172
|
-
svg {
|
|
173
|
-
height: 1em;
|
|
174
|
-
width: 1em;
|
|
175
|
-
vertical-align: middle;
|
|
176
|
-
position: relative;
|
|
177
|
-
bottom: 0;
|
|
178
|
-
margin-right: 0;
|
|
179
|
-
}
|
|
180
|
-
`};
|
|
181
|
-
`;
|
|
182
|
-
|
|
183
|
-
type AProps = AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
184
|
-
|
|
185
|
-
const A = styled.a<AProps>`
|
|
186
|
-
${linkStyles};
|
|
187
|
-
`;
|
|
188
|
-
|
|
189
|
-
export interface LinkProps extends LinkInnerProps, LinkStylesProps {
|
|
190
|
-
cancel?: boolean;
|
|
191
|
-
className?: string;
|
|
192
|
-
style?: object;
|
|
193
|
-
onClick?: (e: React.MouseEvent) => void;
|
|
194
|
-
href?: string;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export const Link: FunctionComponent<LinkProps & AProps> = ({
|
|
198
|
-
cancel,
|
|
199
|
-
children,
|
|
200
|
-
onClick,
|
|
201
|
-
withArrow,
|
|
202
|
-
containsIcon,
|
|
203
|
-
className,
|
|
204
|
-
...rest
|
|
205
|
-
}) => {
|
|
206
|
-
return (
|
|
207
|
-
<A {...rest} onClick={cancel ? e => cancelled(e, onClick) : onClick} className={className}>
|
|
208
|
-
<LinkInner withArrow={withArrow} containsIcon={containsIcon}>
|
|
209
|
-
{children}
|
|
210
|
-
{withArrow && <Icons icon="arrowright" />}
|
|
211
|
-
</LinkInner>
|
|
212
|
-
</A>
|
|
213
|
-
);
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
Link.defaultProps = {
|
|
217
|
-
cancel: true,
|
|
218
|
-
className: undefined,
|
|
219
|
-
style: undefined,
|
|
220
|
-
onClick: () => {},
|
|
221
|
-
withArrow: false,
|
|
222
|
-
containsIcon: false,
|
|
223
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { styled } from '@storybook/theming';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
|
-
|
|
5
|
-
const Info = styled.div`
|
|
6
|
-
margin-bottom: 3rem;
|
|
7
|
-
`;
|
|
8
|
-
|
|
9
|
-
const Heading1 = styled.div`
|
|
10
|
-
font-size: ${props => props.theme.typography.size.l3}px;
|
|
11
|
-
`;
|
|
12
|
-
const Heading2 = styled.div`
|
|
13
|
-
font-size: ${props => props.theme.typography.size.l2}px;
|
|
14
|
-
`;
|
|
15
|
-
const Heading3 = styled.div`
|
|
16
|
-
font-size: ${props => props.theme.typography.size.l1}px;
|
|
17
|
-
`;
|
|
18
|
-
const Heading4 = styled.div`
|
|
19
|
-
font-size: ${props => props.theme.typography.size.m3}px;
|
|
20
|
-
`;
|
|
21
|
-
const Heading5 = styled.div`
|
|
22
|
-
font-size: ${props => props.theme.typography.size.m3}px;
|
|
23
|
-
`;
|
|
24
|
-
const Heading6 = styled.div`
|
|
25
|
-
font-size: ${props => props.theme.typography.size.m1}px;
|
|
26
|
-
`;
|
|
27
|
-
const Heading7 = styled.div`
|
|
28
|
-
font-size: ${props => props.theme.typography.size.s3}px;
|
|
29
|
-
`;
|
|
30
|
-
const Heading8 = styled.div`
|
|
31
|
-
font-size: ${props => props.theme.typography.size.s2}px;
|
|
32
|
-
`;
|
|
33
|
-
const Heading9 = styled.div`
|
|
34
|
-
font-size: ${props => props.theme.typography.size.s1}px;
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const HeadingWrapper = styled.div`
|
|
38
|
-
font-weight: ${props => props.theme.typography.weight.black};
|
|
39
|
-
> * {
|
|
40
|
-
margin-bottom: 1rem;
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
const Type1 = styled.div`
|
|
45
|
-
font-size: ${props => props.theme.typography.size.s3}px;
|
|
46
|
-
`;
|
|
47
|
-
const Type2 = styled.div`
|
|
48
|
-
font-size: ${props => props.theme.typography.size.s2}px;
|
|
49
|
-
`;
|
|
50
|
-
const Type3 = styled.div`
|
|
51
|
-
font-size: ${props => props.theme.typography.size.s1}px;
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
const TypeWrapper = styled.div`
|
|
55
|
-
> * {
|
|
56
|
-
margin-bottom: 1rem;
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
|
|
60
|
-
const Wrapper = styled.div`
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: row;
|
|
63
|
-
> * {
|
|
64
|
-
flex: 1;
|
|
65
|
-
padding-right: 40px;
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
const Page = styled.div`
|
|
70
|
-
padding: 3rem;
|
|
71
|
-
`;
|
|
72
|
-
|
|
73
|
-
storiesOf('Basics|typography', module).add('all', () => (
|
|
74
|
-
<Page>
|
|
75
|
-
<Info>
|
|
76
|
-
<div>
|
|
77
|
-
<b>Font-family:</b> "Nunito sans", Apple system font ... sans-serif
|
|
78
|
-
</div>
|
|
79
|
-
<div>
|
|
80
|
-
<b>UI text size:</b> 13px
|
|
81
|
-
</div>
|
|
82
|
-
<div>
|
|
83
|
-
<b>Document/Markdown text size:</b> 14px
|
|
84
|
-
</div>
|
|
85
|
-
<div>
|
|
86
|
-
<b>Code font:</b> <code>Operator Mono, Fira Code, Consolas ... monospace</code>
|
|
87
|
-
</div>
|
|
88
|
-
<div>
|
|
89
|
-
<b>Weights:</b> 400(normal), 600(bold), 900(black)
|
|
90
|
-
</div>
|
|
91
|
-
</Info>
|
|
92
|
-
<Wrapper>
|
|
93
|
-
<HeadingWrapper>
|
|
94
|
-
<Heading1>48 heading</Heading1>
|
|
95
|
-
<Heading2>40 heading</Heading2>
|
|
96
|
-
<Heading3>32 heading</Heading3>
|
|
97
|
-
<Heading4>28 heading</Heading4>
|
|
98
|
-
<Heading5>24 heading</Heading5>
|
|
99
|
-
<Heading6>20 heading</Heading6>
|
|
100
|
-
<Heading7>16 heading</Heading7>
|
|
101
|
-
<Heading8>14 heading</Heading8>
|
|
102
|
-
<Heading9>12 heading</Heading9>
|
|
103
|
-
</HeadingWrapper>
|
|
104
|
-
<TypeWrapper>
|
|
105
|
-
<Type1>16 The quick brown fox jumps over the lazy dog</Type1>
|
|
106
|
-
<Type2>14 The quick brown fox jumps over the lazy dog</Type2>
|
|
107
|
-
<Type3>12 The quick brown fox jumps over the lazy dog</Type3>
|
|
108
|
-
</TypeWrapper>
|
|
109
|
-
</Wrapper>
|
|
110
|
-
</Page>
|
|
111
|
-
));
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CSSObject, Theme } from '@storybook/theming';
|
|
2
|
-
|
|
3
|
-
export const withReset = ({ theme }: { theme: Theme }): CSSObject => ({
|
|
4
|
-
fontFamily: theme.typography.fonts.base,
|
|
5
|
-
fontSize: theme.typography.size.s3,
|
|
6
|
-
margin: 0,
|
|
7
|
-
|
|
8
|
-
WebkitFontSmoothing: 'antialiased',
|
|
9
|
-
MozOsxFontSmoothing: 'grayscale',
|
|
10
|
-
WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
|
|
11
|
-
WebkitOverflowScrolling: 'touch',
|
|
12
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": "./src",
|
|
5
|
-
"types": [
|
|
6
|
-
"webpack-env",
|
|
7
|
-
"jest",
|
|
8
|
-
"react-syntax-highlighter"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*"
|
|
13
|
-
],
|
|
14
|
-
"exclude": [
|
|
15
|
-
"src/**/__tests__/**/*",
|
|
16
|
-
"src/**/*.stories.*"
|
|
17
|
-
]
|
|
18
|
-
}
|