@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,85 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent } from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { styled } from '@storybook/theming';
|
|
4
|
-
|
|
5
|
-
import { TooltipMessage } from './TooltipMessage';
|
|
6
|
-
import { WithToolTipState as WithTooltip } from './WithTooltip';
|
|
7
|
-
|
|
8
|
-
const ViewPort = styled.div`
|
|
9
|
-
height: 300px;
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
const BackgroundBox = styled.div`
|
|
13
|
-
width: 500px;
|
|
14
|
-
height: 500px;
|
|
15
|
-
overflow-y: scroll;
|
|
16
|
-
background: #eee;
|
|
17
|
-
position: relative;
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
const Spacer = styled.div`
|
|
21
|
-
height: 100px;
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
const Trigger = styled.div`
|
|
25
|
-
width: 200px;
|
|
26
|
-
height: 100px;
|
|
27
|
-
background-color: red;
|
|
28
|
-
color: white;
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
interface TooltipProps {
|
|
32
|
-
onHide?: () => void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const Tooltip: FunctionComponent<TooltipProps> = ({ onHide }) => (
|
|
36
|
-
<TooltipMessage
|
|
37
|
-
title="Lorem ipsum dolor sit"
|
|
38
|
-
desc="Amet consectatur vestibulum concet durum politu coret weirom"
|
|
39
|
-
links={[{ title: 'Continue', onClick: onHide }]}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
Tooltip.defaultProps = {
|
|
44
|
-
onHide: null,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
storiesOf('basics/Tooltip/WithTooltip', module)
|
|
48
|
-
.addDecorator(storyFn => (
|
|
49
|
-
<ViewPort>
|
|
50
|
-
<BackgroundBox>
|
|
51
|
-
<Spacer />
|
|
52
|
-
{storyFn()}
|
|
53
|
-
</BackgroundBox>
|
|
54
|
-
</ViewPort>
|
|
55
|
-
))
|
|
56
|
-
.add('simple hover', () => (
|
|
57
|
-
<WithTooltip placement="top" trigger="hover" tooltip={<Tooltip />}>
|
|
58
|
-
<Trigger>Hover me!</Trigger>
|
|
59
|
-
</WithTooltip>
|
|
60
|
-
))
|
|
61
|
-
.add('simple hover, functional', () => (
|
|
62
|
-
<WithTooltip placement="top" trigger="hover" tooltip={Tooltip}>
|
|
63
|
-
<Trigger>Hover me!</Trigger>
|
|
64
|
-
</WithTooltip>
|
|
65
|
-
))
|
|
66
|
-
.add('simple click', () => (
|
|
67
|
-
<WithTooltip placement="top" trigger="click" tooltip={<Tooltip />}>
|
|
68
|
-
<Trigger>Click me!</Trigger>
|
|
69
|
-
</WithTooltip>
|
|
70
|
-
))
|
|
71
|
-
.add('simple click start open', () => (
|
|
72
|
-
<WithTooltip placement="top" trigger="click" startOpen tooltip={<Tooltip />}>
|
|
73
|
-
<Trigger>Click me!</Trigger>
|
|
74
|
-
</WithTooltip>
|
|
75
|
-
))
|
|
76
|
-
.add('simple click closeOnClick', () => (
|
|
77
|
-
<WithTooltip placement="top" trigger="click" closeOnClick tooltip={<Tooltip />}>
|
|
78
|
-
<Trigger>Click me!</Trigger>
|
|
79
|
-
</WithTooltip>
|
|
80
|
-
))
|
|
81
|
-
.add('no chrome', () => (
|
|
82
|
-
<WithTooltip placement="top" trigger="click" hasChrome={false} tooltip={<Tooltip />}>
|
|
83
|
-
<Trigger>Click me!</Trigger>
|
|
84
|
-
</WithTooltip>
|
|
85
|
-
));
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent, ReactNode, useState, useEffect } from 'react';
|
|
2
|
-
import { styled } from '@storybook/theming';
|
|
3
|
-
import { logger } from '@storybook/client-logger';
|
|
4
|
-
// import { withState, lifecycle } from 'recompose';
|
|
5
|
-
import { document } from 'global';
|
|
6
|
-
|
|
7
|
-
import TooltipTrigger from 'react-popper-tooltip';
|
|
8
|
-
import { Modifiers, Placement } from 'popper.js';
|
|
9
|
-
import { Tooltip } from './Tooltip';
|
|
10
|
-
|
|
11
|
-
// A target that doesn't speak popper
|
|
12
|
-
const TargetContainer = styled.div<{ mode: string }>`
|
|
13
|
-
display: inline-block;
|
|
14
|
-
cursor: ${props => (props.mode === 'hover' ? 'default' : 'pointer')};
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
const TargetSvgContainer = styled.g<{ mode: string }>`
|
|
18
|
-
cursor: ${props => (props.mode === 'hover' ? 'default' : 'pointer')};
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
interface WithHideFn {
|
|
22
|
-
onHide: () => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface WithTooltipPureProps {
|
|
26
|
-
svg?: boolean;
|
|
27
|
-
trigger?: 'none' | 'hover' | 'click' | 'right-click';
|
|
28
|
-
closeOnClick?: boolean;
|
|
29
|
-
placement?: Placement;
|
|
30
|
-
modifiers?: Modifiers;
|
|
31
|
-
hasChrome?: boolean;
|
|
32
|
-
tooltip: ReactNode | ((p: WithHideFn) => ReactNode);
|
|
33
|
-
children: ReactNode;
|
|
34
|
-
tooltipShown?: boolean;
|
|
35
|
-
onVisibilityChange?: (visibility: boolean) => void;
|
|
36
|
-
onDoubleClick?: () => void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Pure, does not bind to the body
|
|
40
|
-
const WithTooltipPure: FunctionComponent<WithTooltipPureProps> = ({
|
|
41
|
-
svg,
|
|
42
|
-
trigger,
|
|
43
|
-
closeOnClick,
|
|
44
|
-
placement,
|
|
45
|
-
modifiers,
|
|
46
|
-
hasChrome,
|
|
47
|
-
tooltip,
|
|
48
|
-
children,
|
|
49
|
-
tooltipShown,
|
|
50
|
-
onVisibilityChange,
|
|
51
|
-
...props
|
|
52
|
-
}) => {
|
|
53
|
-
const Container = svg ? TargetSvgContainer : TargetContainer;
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<TooltipTrigger
|
|
57
|
-
placement={placement}
|
|
58
|
-
trigger={trigger}
|
|
59
|
-
modifiers={modifiers}
|
|
60
|
-
tooltipShown={tooltipShown}
|
|
61
|
-
onVisibilityChange={onVisibilityChange}
|
|
62
|
-
tooltip={({
|
|
63
|
-
getTooltipProps,
|
|
64
|
-
getArrowProps,
|
|
65
|
-
tooltipRef,
|
|
66
|
-
arrowRef,
|
|
67
|
-
placement: tooltipPlacement,
|
|
68
|
-
}) => (
|
|
69
|
-
<Tooltip
|
|
70
|
-
hasChrome={hasChrome}
|
|
71
|
-
placement={tooltipPlacement}
|
|
72
|
-
tooltipRef={tooltipRef}
|
|
73
|
-
arrowRef={arrowRef}
|
|
74
|
-
arrowProps={getArrowProps()}
|
|
75
|
-
{...getTooltipProps()}
|
|
76
|
-
>
|
|
77
|
-
{typeof tooltip === 'function'
|
|
78
|
-
? tooltip({ onHide: () => onVisibilityChange(false) })
|
|
79
|
-
: tooltip}
|
|
80
|
-
</Tooltip>
|
|
81
|
-
)}
|
|
82
|
-
>
|
|
83
|
-
{({ getTriggerProps, triggerRef }) => (
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
<Container ref={triggerRef} {...getTriggerProps()} {...props}>
|
|
86
|
-
{children}
|
|
87
|
-
</Container>
|
|
88
|
-
)}
|
|
89
|
-
</TooltipTrigger>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
WithTooltipPure.defaultProps = {
|
|
94
|
-
svg: false,
|
|
95
|
-
trigger: 'hover',
|
|
96
|
-
closeOnClick: false,
|
|
97
|
-
placement: 'top',
|
|
98
|
-
modifiers: {},
|
|
99
|
-
hasChrome: true,
|
|
100
|
-
tooltipShown: false,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const WithToolTipState: FunctionComponent<
|
|
104
|
-
WithTooltipPureProps & {
|
|
105
|
-
startOpen?: boolean;
|
|
106
|
-
}
|
|
107
|
-
> = ({ startOpen, ...rest }) => {
|
|
108
|
-
const [tooltipShown, onVisibilityChange] = useState(startOpen || false);
|
|
109
|
-
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
const hide = () => onVisibilityChange(false);
|
|
112
|
-
document.addEventListener('keydown', hide, false);
|
|
113
|
-
|
|
114
|
-
// Find all iframes on the screen and bind to clicks inside them (waiting until the iframe is ready)
|
|
115
|
-
const iframes: HTMLIFrameElement[] = Array.from(document.getElementsByTagName('iframe'));
|
|
116
|
-
const unbinders: (() => void)[] = [];
|
|
117
|
-
iframes.forEach(iframe => {
|
|
118
|
-
const bind = () => {
|
|
119
|
-
try {
|
|
120
|
-
if (iframe.contentWindow.document) {
|
|
121
|
-
iframe.contentWindow.document.addEventListener('click', hide);
|
|
122
|
-
unbinders.push(() => {
|
|
123
|
-
try {
|
|
124
|
-
iframe.contentWindow.document.removeEventListener('click', hide);
|
|
125
|
-
} catch (e) {
|
|
126
|
-
logger.warn('Removing a click listener from iframe failed: ', e);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
} catch (e) {
|
|
131
|
-
logger.warn('Adding a click listener to iframe failed: ', e);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
bind(); // I don't know how to find out if it's already loaded so I potentially will bind twice
|
|
136
|
-
iframe.addEventListener('load', bind);
|
|
137
|
-
unbinders.push(() => {
|
|
138
|
-
iframe.removeEventListener('load', bind);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
return () => {
|
|
143
|
-
document.removeEventListener('keydown', hide);
|
|
144
|
-
unbinders.forEach(unbind => {
|
|
145
|
-
unbind();
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<WithTooltipPure
|
|
152
|
-
{...rest}
|
|
153
|
-
tooltipShown={tooltipShown}
|
|
154
|
-
onVisibilityChange={onVisibilityChange}
|
|
155
|
-
/>
|
|
156
|
-
);
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export { WithTooltipPure, WithToolTipState, WithToolTipState as WithTooltip };
|
package/src/typings.d.ts
DELETED
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import { styled, CSSObject, Theme } from '@storybook/theming';
|
|
2
|
-
import { withReset } from './withReset';
|
|
3
|
-
|
|
4
|
-
const headerCommon = ({ theme }: { theme: Theme }): CSSObject => ({
|
|
5
|
-
margin: '20px 0 8px',
|
|
6
|
-
padding: 0,
|
|
7
|
-
cursor: 'text',
|
|
8
|
-
position: 'relative',
|
|
9
|
-
color: theme.color.defaultText,
|
|
10
|
-
'&:first-of-type': {
|
|
11
|
-
marginTop: 0,
|
|
12
|
-
paddingTop: 0,
|
|
13
|
-
},
|
|
14
|
-
'&:hover a.anchor': {
|
|
15
|
-
textDecoration: 'none',
|
|
16
|
-
},
|
|
17
|
-
'& tt, & code': {
|
|
18
|
-
fontSize: 'inherit',
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const withMargin: CSSObject = {
|
|
23
|
-
margin: '16px 0',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const H1 = styled.h1<{}>(withReset, headerCommon, ({ theme }) => ({
|
|
27
|
-
fontSize: `${theme.typography.size.l1}px`,
|
|
28
|
-
fontWeight: theme.typography.weight.black,
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
export const H2 = styled.h2<{}>(withReset, headerCommon, ({ theme }) => ({
|
|
32
|
-
fontSize: `${theme.typography.size.m2}px`,
|
|
33
|
-
paddingBottom: '4px',
|
|
34
|
-
borderBottom: `1px solid ${theme.appBorderColor}`,
|
|
35
|
-
}));
|
|
36
|
-
|
|
37
|
-
export const H3 = styled.h3<{}>(withReset, headerCommon, ({ theme }) => ({
|
|
38
|
-
fontSize: `${theme.typography.size.m1}px`,
|
|
39
|
-
}));
|
|
40
|
-
|
|
41
|
-
export const H4 = styled.h4<{}>(withReset, headerCommon, ({ theme }) => ({
|
|
42
|
-
fontSize: `${theme.typography.size.s3}px`,
|
|
43
|
-
}));
|
|
44
|
-
|
|
45
|
-
export const H5 = styled.h5<{}>(withReset, headerCommon, ({ theme }) => ({
|
|
46
|
-
fontSize: `${theme.typography.size.s2}px`,
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
export const H6 = styled.h6<{}>(withReset, headerCommon, ({ theme }) => ({
|
|
50
|
-
fontSize: `${theme.typography.size.s2}px`,
|
|
51
|
-
color: theme.color.dark,
|
|
52
|
-
}));
|
|
53
|
-
|
|
54
|
-
export const Pre = styled.pre<{}>(withReset, withMargin, ({ theme }) => ({
|
|
55
|
-
// reset
|
|
56
|
-
fontFamily: theme.typography.fonts.mono,
|
|
57
|
-
WebkitFontSmoothing: 'antialiased',
|
|
58
|
-
MozOsxFontSmoothing: 'grayscale',
|
|
59
|
-
lineHeight: '18px',
|
|
60
|
-
padding: '11px 1rem',
|
|
61
|
-
whiteSpace: 'pre-wrap',
|
|
62
|
-
color: 'inherit',
|
|
63
|
-
borderRadius: 3,
|
|
64
|
-
margin: '1rem 0',
|
|
65
|
-
|
|
66
|
-
'&:not(.hljs)': {
|
|
67
|
-
background: 'transparent',
|
|
68
|
-
border: 'none',
|
|
69
|
-
borderRadius: 0,
|
|
70
|
-
padding: 0,
|
|
71
|
-
margin: 0,
|
|
72
|
-
},
|
|
73
|
-
'& pre, &.hljs': {
|
|
74
|
-
padding: 15,
|
|
75
|
-
margin: 0,
|
|
76
|
-
whiteSpace: 'pre-wrap',
|
|
77
|
-
color: 'inherit',
|
|
78
|
-
fontSize: '13px',
|
|
79
|
-
lineHeight: '19px',
|
|
80
|
-
code: {
|
|
81
|
-
color: 'inherit',
|
|
82
|
-
fontSize: 'inherit',
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
'& code': {
|
|
86
|
-
whiteSpace: 'pre',
|
|
87
|
-
},
|
|
88
|
-
'& code, & tt': {
|
|
89
|
-
border: 'none',
|
|
90
|
-
},
|
|
91
|
-
}));
|
|
92
|
-
|
|
93
|
-
export const A = styled.a<{}>(withReset, ({ theme }) => ({
|
|
94
|
-
fontSize: theme.typography.size.s2,
|
|
95
|
-
lineHeight: '24px',
|
|
96
|
-
|
|
97
|
-
color: `${theme.color.secondary}`,
|
|
98
|
-
textDecoration: 'none',
|
|
99
|
-
'&.absent': {
|
|
100
|
-
color: '#cc0000',
|
|
101
|
-
},
|
|
102
|
-
'&.anchor': {
|
|
103
|
-
display: 'block',
|
|
104
|
-
paddingLeft: '30px',
|
|
105
|
-
marginLeft: '-30px',
|
|
106
|
-
cursor: 'pointer',
|
|
107
|
-
position: 'absolute',
|
|
108
|
-
top: '0',
|
|
109
|
-
left: '0',
|
|
110
|
-
bottom: '0',
|
|
111
|
-
},
|
|
112
|
-
}));
|
|
113
|
-
|
|
114
|
-
export const HR = styled.hr<{}>(({ theme }) => ({
|
|
115
|
-
border: '0 none',
|
|
116
|
-
color: theme.appBorderColor,
|
|
117
|
-
height: '4px',
|
|
118
|
-
padding: '0',
|
|
119
|
-
}));
|
|
120
|
-
|
|
121
|
-
export const DL = styled.dl<{}>(withReset, {
|
|
122
|
-
...withMargin,
|
|
123
|
-
padding: 0,
|
|
124
|
-
'& dt': {
|
|
125
|
-
fontSize: '14px',
|
|
126
|
-
fontWeight: 'bold',
|
|
127
|
-
fontStyle: 'italic',
|
|
128
|
-
padding: 0,
|
|
129
|
-
margin: '16px 0 4px',
|
|
130
|
-
},
|
|
131
|
-
'& dt:first-of-type': {
|
|
132
|
-
padding: 0,
|
|
133
|
-
},
|
|
134
|
-
'& dt > :first-of-type': {
|
|
135
|
-
marginTop: 0,
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
'& dt > :last-child': {
|
|
139
|
-
marginBottom: 0,
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
'& dd': {
|
|
143
|
-
margin: '0 0 16px',
|
|
144
|
-
padding: '0 15px',
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
'& dd > :first-of-type': {
|
|
148
|
-
marginTop: 0,
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
'& dd > :last-child': {
|
|
152
|
-
marginBottom: 0,
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
export const Blockquote = styled.blockquote<{}>(withReset, withMargin, ({ theme }) => ({
|
|
157
|
-
borderLeft: `4px solid ${theme.color.medium}`,
|
|
158
|
-
padding: '0 15px',
|
|
159
|
-
color: theme.color.dark,
|
|
160
|
-
'& > :first-of-type': {
|
|
161
|
-
marginTop: '0',
|
|
162
|
-
},
|
|
163
|
-
'& > :last-child': {
|
|
164
|
-
marginBottom: 0,
|
|
165
|
-
},
|
|
166
|
-
}));
|
|
167
|
-
|
|
168
|
-
export const Table = styled.table<{}>(withReset, withMargin, ({ theme }) => ({
|
|
169
|
-
fontSize: theme.typography.size.s2,
|
|
170
|
-
lineHeight: '24px',
|
|
171
|
-
padding: 0,
|
|
172
|
-
borderCollapse: 'collapse',
|
|
173
|
-
'& tr': {
|
|
174
|
-
borderTop: `1px solid ${theme.appBorderColor}`,
|
|
175
|
-
backgroundColor: 'white',
|
|
176
|
-
margin: '0',
|
|
177
|
-
padding: '0',
|
|
178
|
-
},
|
|
179
|
-
'& tr:nth-of-type(2n)': {
|
|
180
|
-
backgroundColor: `${theme.color.lighter}`,
|
|
181
|
-
},
|
|
182
|
-
'& tr th': {
|
|
183
|
-
fontWeight: 'bold',
|
|
184
|
-
border: `1px solid ${theme.appBorderColor}`,
|
|
185
|
-
textAlign: 'left',
|
|
186
|
-
margin: '0',
|
|
187
|
-
padding: '6px 13px',
|
|
188
|
-
},
|
|
189
|
-
'& tr td': {
|
|
190
|
-
border: `1px solid ${theme.appBorderColor}`,
|
|
191
|
-
textAlign: 'left',
|
|
192
|
-
margin: '0',
|
|
193
|
-
padding: '6px 13px',
|
|
194
|
-
},
|
|
195
|
-
'& tr th :first-of-type, & tr td :first-of-type': {
|
|
196
|
-
marginTop: '0',
|
|
197
|
-
},
|
|
198
|
-
'& tr th :last-child, & tr td :last-child': {
|
|
199
|
-
marginBottom: '0',
|
|
200
|
-
},
|
|
201
|
-
}));
|
|
202
|
-
|
|
203
|
-
export const Img = styled.img<{}>({
|
|
204
|
-
maxWidth: '100%',
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
export const Div = styled.div<{}>(withReset);
|
|
208
|
-
|
|
209
|
-
export const Span = styled.span<{}>(withReset, ({ theme }) => ({
|
|
210
|
-
'&.frame': {
|
|
211
|
-
display: 'block',
|
|
212
|
-
overflow: 'hidden',
|
|
213
|
-
},
|
|
214
|
-
'&.frame > span': {
|
|
215
|
-
border: `1px solid ${theme.color.medium}`,
|
|
216
|
-
display: 'block',
|
|
217
|
-
float: 'left',
|
|
218
|
-
overflow: 'hidden',
|
|
219
|
-
margin: '13px 0 0',
|
|
220
|
-
padding: '7px',
|
|
221
|
-
width: 'auto',
|
|
222
|
-
},
|
|
223
|
-
'&.frame span img': {
|
|
224
|
-
display: 'block',
|
|
225
|
-
float: 'left',
|
|
226
|
-
},
|
|
227
|
-
'&.frame span span': {
|
|
228
|
-
clear: 'both',
|
|
229
|
-
color: theme.color.darkest,
|
|
230
|
-
display: 'block',
|
|
231
|
-
padding: '5px 0 0',
|
|
232
|
-
},
|
|
233
|
-
'&.align-center': {
|
|
234
|
-
display: 'block',
|
|
235
|
-
overflow: 'hidden',
|
|
236
|
-
clear: 'both',
|
|
237
|
-
},
|
|
238
|
-
'&.align-center > span': {
|
|
239
|
-
display: 'block',
|
|
240
|
-
overflow: 'hidden',
|
|
241
|
-
margin: '13px auto 0',
|
|
242
|
-
textAlign: 'center',
|
|
243
|
-
},
|
|
244
|
-
'&.align-center span img': {
|
|
245
|
-
margin: '0 auto',
|
|
246
|
-
textAlign: 'center',
|
|
247
|
-
},
|
|
248
|
-
'&.align-right': {
|
|
249
|
-
display: 'block',
|
|
250
|
-
overflow: 'hidden',
|
|
251
|
-
clear: 'both',
|
|
252
|
-
},
|
|
253
|
-
'&.align-right > span': {
|
|
254
|
-
display: 'block',
|
|
255
|
-
overflow: 'hidden',
|
|
256
|
-
margin: '13px 0 0',
|
|
257
|
-
textAlign: 'right',
|
|
258
|
-
},
|
|
259
|
-
'&.align-right span img': {
|
|
260
|
-
margin: '0',
|
|
261
|
-
textAlign: 'right',
|
|
262
|
-
},
|
|
263
|
-
'&.float-left': {
|
|
264
|
-
display: 'block',
|
|
265
|
-
marginRight: '13px',
|
|
266
|
-
overflow: 'hidden',
|
|
267
|
-
float: 'left',
|
|
268
|
-
},
|
|
269
|
-
'&.float-left span': {
|
|
270
|
-
margin: '13px 0 0',
|
|
271
|
-
},
|
|
272
|
-
'&.float-right': {
|
|
273
|
-
display: 'block',
|
|
274
|
-
marginLeft: '13px',
|
|
275
|
-
overflow: 'hidden',
|
|
276
|
-
float: 'right',
|
|
277
|
-
},
|
|
278
|
-
'&.float-right > span': {
|
|
279
|
-
display: 'block',
|
|
280
|
-
overflow: 'hidden',
|
|
281
|
-
margin: '13px auto 0',
|
|
282
|
-
textAlign: 'right',
|
|
283
|
-
},
|
|
284
|
-
}));
|
|
285
|
-
|
|
286
|
-
const listCommon: CSSObject = {
|
|
287
|
-
paddingLeft: '30px',
|
|
288
|
-
'& :first-of-type': {
|
|
289
|
-
marginTop: 0,
|
|
290
|
-
},
|
|
291
|
-
'& :last-child': {
|
|
292
|
-
marginBottom: 0,
|
|
293
|
-
},
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
export const LI = styled.li<{}>(withReset, ({ theme }) => ({
|
|
297
|
-
fontSize: theme.typography.size.s2,
|
|
298
|
-
color: theme.color.defaultText,
|
|
299
|
-
lineHeight: '24px',
|
|
300
|
-
'& + li': {
|
|
301
|
-
marginTop: '.25em',
|
|
302
|
-
},
|
|
303
|
-
'& ul, & ol': {
|
|
304
|
-
marginTop: '.25em',
|
|
305
|
-
marginBottom: 0,
|
|
306
|
-
},
|
|
307
|
-
}));
|
|
308
|
-
|
|
309
|
-
export const UL = styled.ul<{}>(withReset, withMargin, listCommon, {});
|
|
310
|
-
|
|
311
|
-
export const OL = styled.ol<{}>(withReset, withMargin, listCommon);
|
|
312
|
-
|
|
313
|
-
const codeCommon = ({ theme }: { theme: Theme }): CSSObject => ({
|
|
314
|
-
margin: '0 2px',
|
|
315
|
-
padding: '0 5px',
|
|
316
|
-
whiteSpace: 'nowrap',
|
|
317
|
-
border: `1px solid ${theme.color.mediumlight}`,
|
|
318
|
-
backgroundColor: theme.color.lighter,
|
|
319
|
-
borderRadius: '3px',
|
|
320
|
-
fontSize: theme.typography.size.s2 - 1,
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
export const P = styled.p<{}>(withReset, withMargin, ({ theme }) => ({
|
|
324
|
-
fontSize: theme.typography.size.s2,
|
|
325
|
-
lineHeight: '24px',
|
|
326
|
-
color: theme.color.defaultText,
|
|
327
|
-
'& code': codeCommon({ theme }),
|
|
328
|
-
}));
|
|
329
|
-
|
|
330
|
-
export const Code = styled.code<{}>(
|
|
331
|
-
({ theme }) => ({
|
|
332
|
-
// from reset
|
|
333
|
-
fontFamily: theme.typography.fonts.mono,
|
|
334
|
-
WebkitFontSmoothing: 'antialiased',
|
|
335
|
-
MozOsxFontSmoothing: 'grayscale',
|
|
336
|
-
display: 'inline-block',
|
|
337
|
-
paddingLeft: 2,
|
|
338
|
-
paddingRight: 2,
|
|
339
|
-
verticalAlign: 'baseline',
|
|
340
|
-
color: 'inherit',
|
|
341
|
-
}),
|
|
342
|
-
codeCommon
|
|
343
|
-
);
|
|
344
|
-
|
|
345
|
-
export const TT = styled.title<{}>(codeCommon);
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* This is a "local" reset to style subtrees with Storybook styles
|
|
349
|
-
*
|
|
350
|
-
* We can't style individual elements (e.g. h1, h2, etc.) in here
|
|
351
|
-
* because the CSS specificity is too high, so those styles can too
|
|
352
|
-
* easily override child elements that are not expecting it.
|
|
353
|
-
*/
|
|
354
|
-
|
|
355
|
-
export const ResetWrapper = styled.div<{}>(withReset);
|