@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.
Files changed (94) hide show
  1. package/dist/html.js +1 -1
  2. package/dist/typography/DocumentFormatting.js +2 -1
  3. package/dist/typography/DocumentWrapper.js +2 -2
  4. package/package.json +11 -5
  5. package/src/ActionBar/ActionBar.stories.tsx +0 -41
  6. package/src/ActionBar/ActionBar.tsx +0 -75
  7. package/src/Badge/Badge.stories.tsx +0 -11
  8. package/src/Badge/Badge.tsx +0 -68
  9. package/src/Button/Button.stories.tsx +0 -53
  10. package/src/Button/Button.tsx +0 -256
  11. package/src/ScrollArea/ScrollArea.stories.tsx +0 -85
  12. package/src/ScrollArea/ScrollArea.tsx +0 -62
  13. package/src/ScrollArea/ScrollAreaStyles.tsx +0 -166
  14. package/src/addon-panel/addon-panel.tsx +0 -33
  15. package/src/bar/bar.tsx +0 -93
  16. package/src/bar/button.ts +0 -89
  17. package/src/bar/separator.tsx +0 -39
  18. package/src/blocks/BlockBackgroundStyles.tsx +0 -9
  19. package/src/blocks/ColorPalette.stories.tsx +0 -29
  20. package/src/blocks/ColorPalette.tsx +0 -168
  21. package/src/blocks/Description.stories.tsx +0 -15
  22. package/src/blocks/Description.tsx +0 -18
  23. package/src/blocks/DocsPage.stories.tsx +0 -67
  24. package/src/blocks/DocsPage.tsx +0 -81
  25. package/src/blocks/DocsPageExampleCaption.md +0 -93
  26. package/src/blocks/DocsPageExampleCaption.mdx +0 -93
  27. package/src/blocks/EmptyBlock.stories.tsx +0 -9
  28. package/src/blocks/EmptyBlock.tsx +0 -23
  29. package/src/blocks/IFrame.tsx +0 -60
  30. package/src/blocks/IconGallery.stories.tsx +0 -32
  31. package/src/blocks/IconGallery.tsx +0 -72
  32. package/src/blocks/Preview.stories.tsx +0 -96
  33. package/src/blocks/Preview.tsx +0 -162
  34. package/src/blocks/PropsTable/PropDef.ts +0 -7
  35. package/src/blocks/PropsTable/PropRow.stories.tsx +0 -113
  36. package/src/blocks/PropsTable/PropRow.tsx +0 -102
  37. package/src/blocks/PropsTable/PropsTable.stories.tsx +0 -14
  38. package/src/blocks/PropsTable/PropsTable.tsx +0 -169
  39. package/src/blocks/Source.stories.tsx +0 -36
  40. package/src/blocks/Source.tsx +0 -72
  41. package/src/blocks/Story.stories.tsx +0 -25
  42. package/src/blocks/Story.tsx +0 -115
  43. package/src/blocks/Toolbar.tsx +0 -85
  44. package/src/blocks/Typeset.stories.tsx +0 -16
  45. package/src/blocks/Typeset.tsx +0 -68
  46. package/src/blocks/ZoomContext.tsx +0 -5
  47. package/src/blocks/index.ts +0 -10
  48. package/src/brand/StorybookIcon.stories.tsx +0 -6
  49. package/src/brand/StorybookIcon.tsx +0 -26
  50. package/src/brand/StorybookLogo.stories.tsx +0 -10
  51. package/src/brand/StorybookLogo.tsx +0 -33
  52. package/src/form/field/field.tsx +0 -42
  53. package/src/form/form.stories.tsx +0 -133
  54. package/src/form/index.tsx +0 -18
  55. package/src/form/input/input.tsx +0 -178
  56. package/src/html.tsx +0 -12
  57. package/src/icon/icon.stories.tsx +0 -77
  58. package/src/icon/icon.tsx +0 -22
  59. package/src/icon/icons.tsx +0 -310
  60. package/src/icon/svg.tsx +0 -24
  61. package/src/index.ts +0 -37
  62. package/src/placeholder/placeholder.stories.tsx +0 -24
  63. package/src/placeholder/placeholder.tsx +0 -25
  64. package/src/spaced/Spaced.stories.tsx +0 -72
  65. package/src/spaced/Spaced.tsx +0 -69
  66. package/src/syntaxhighlighter/formatter.test.js +0 -90
  67. package/src/syntaxhighlighter/formatter.ts +0 -26
  68. package/src/syntaxhighlighter/syntaxhighlighter.stories.tsx +0 -136
  69. package/src/syntaxhighlighter/syntaxhighlighter.tsx +0 -165
  70. package/src/tabs/tabs.stories.tsx +0 -207
  71. package/src/tabs/tabs.tsx +0 -252
  72. package/src/tooltip/ListItem.stories.tsx +0 -35
  73. package/src/tooltip/ListItem.tsx +0 -245
  74. package/src/tooltip/Tooltip.stories.tsx +0 -42
  75. package/src/tooltip/Tooltip.tsx +0 -146
  76. package/src/tooltip/TooltipLinkList.stories.tsx +0 -52
  77. package/src/tooltip/TooltipLinkList.tsx +0 -49
  78. package/src/tooltip/TooltipMessage.stories.tsx +0 -37
  79. package/src/tooltip/TooltipMessage.tsx +0 -67
  80. package/src/tooltip/TooltipNote.stories.tsx +0 -15
  81. package/src/tooltip/TooltipNote.tsx +0 -25
  82. package/src/tooltip/WithTooltip.stories.tsx +0 -85
  83. package/src/tooltip/WithTooltip.tsx +0 -159
  84. package/src/typings.d.ts +0 -4
  85. package/src/typography/DocumentFormatting.tsx +0 -355
  86. package/src/typography/DocumentFormattingSample.md +0 -127
  87. package/src/typography/DocumentWrapper.stories.tsx +0 -190
  88. package/src/typography/DocumentWrapper.tsx +0 -441
  89. package/src/typography/link/link.stories.tsx +0 -67
  90. package/src/typography/link/link.test.tsx +0 -108
  91. package/src/typography/link/link.tsx +0 -223
  92. package/src/typography/typography.stories.tsx +0 -111
  93. package/src/typography/withReset.tsx +0 -12
  94. package/tsconfig.json +0 -18
@@ -1,245 +0,0 @@
1
- import React, { FunctionComponent, ReactNode } from 'react';
2
- import { styled } from '@storybook/theming';
3
- import memoize from 'memoizerific';
4
- import { transparentize } from 'polished';
5
-
6
- export interface TitleProps {
7
- active?: boolean;
8
- loading?: boolean;
9
- disabled?: boolean;
10
- }
11
- const Title = styled(({ active, loading, disabled, ...rest }: TitleProps) => (
12
- <span {...rest}></span>
13
- ))<{ active: boolean; loading: boolean; disabled: boolean }>(
14
- ({ theme }) => ({
15
- color: theme.color.defaultText,
16
- // Previously was theme.typography.weight.normal but this weight does not exists in Theme
17
- fontWeight: theme.typography.weight.regular,
18
- }),
19
- ({ active, theme }) =>
20
- active
21
- ? {
22
- color: theme.color.primary,
23
- fontWeight: theme.typography.weight.bold,
24
- }
25
- : {},
26
- ({ loading, theme }) =>
27
- loading
28
- ? {
29
- display: 'inline-block',
30
- flex: 'none',
31
- ...theme.animation.inlineGlow,
32
- }
33
- : {},
34
- ({ disabled, theme }) =>
35
- disabled
36
- ? {
37
- color: transparentize(0.7, theme.color.defaultText),
38
- }
39
- : {}
40
- );
41
-
42
- export interface RightProps {
43
- active?: boolean;
44
- }
45
-
46
- const Right = styled.span<RightProps>(
47
- {
48
- '& svg': {
49
- transition: 'all 200ms ease-out',
50
- opacity: '0',
51
- height: '12px',
52
- width: '12px',
53
- margin: '3px 0',
54
- verticalAlign: 'top',
55
- } as any,
56
- '& path': {
57
- fill: 'inherit',
58
- },
59
- },
60
- ({ active, theme }) =>
61
- active
62
- ? {
63
- '& svg': {
64
- opacity: 1,
65
- },
66
- '& path': {
67
- fill: theme.color.primary,
68
- },
69
- }
70
- : {}
71
- );
72
-
73
- const Center = styled.span({
74
- flex: 1,
75
- textAlign: 'left',
76
- display: 'inline-flex',
77
-
78
- '& > * + *': {
79
- paddingLeft: 10,
80
- },
81
- });
82
-
83
- export interface CenterTextProps {
84
- active?: boolean;
85
- disabled?: boolean;
86
- }
87
-
88
- const CenterText = styled.span<CenterTextProps>(
89
- {
90
- flex: 1,
91
- textAlign: 'center',
92
- },
93
- ({ active, theme }) =>
94
- active
95
- ? {
96
- color: theme.color.primary,
97
- }
98
- : {},
99
- ({ theme, disabled }) =>
100
- disabled
101
- ? {
102
- color: theme.color.mediumdark,
103
- }
104
- : {}
105
- );
106
-
107
- export interface LeftProps {
108
- active?: boolean;
109
- }
110
-
111
- const Left = styled.span<LeftProps>(({ active, theme }) =>
112
- active
113
- ? {
114
- '& svg': {
115
- opacity: 1,
116
- },
117
- '& path': {
118
- fill: theme.color.primary,
119
- },
120
- }
121
- : {}
122
- );
123
-
124
- export interface ItemProps {
125
- disabled?: boolean;
126
- }
127
-
128
- const Item = styled.a<ItemProps>(
129
- ({ theme }) => ({
130
- fontSize: theme.typography.size.s1,
131
- transition: 'all 150ms ease-out',
132
- color: transparentize(0.5, theme.color.defaultText),
133
- textDecoration: 'none',
134
- cursor: 'pointer',
135
- justifyContent: 'space-between',
136
-
137
- lineHeight: '18px',
138
- padding: '7px 15px',
139
- display: 'flex',
140
- alignItems: 'center',
141
-
142
- '& > * + *': {
143
- paddingLeft: 10,
144
- },
145
-
146
- '&:hover': {
147
- background: theme.background.hoverable,
148
- },
149
- '&:hover svg': {
150
- opacity: 1,
151
- },
152
- }),
153
- ({ disabled }) =>
154
- disabled
155
- ? {
156
- cursor: 'not-allowed',
157
- }
158
- : {}
159
- );
160
-
161
- const getItemProps = memoize(100)((onClick, href, LinkWrapper) => {
162
- const result = {};
163
-
164
- if (onClick) {
165
- Object.assign(result, {
166
- onClick,
167
- });
168
- }
169
- if (href) {
170
- Object.assign(result, {
171
- href,
172
- });
173
- }
174
- if (LinkWrapper && href) {
175
- Object.assign(result, {
176
- to: href,
177
- as: LinkWrapper,
178
- });
179
- }
180
- return result;
181
- });
182
-
183
- export type LinkWrapperType = FunctionComponent;
184
-
185
- export interface ListItemProps {
186
- loading?: boolean;
187
- left?: ReactNode;
188
- title?: ReactNode;
189
- center?: ReactNode;
190
- right?: ReactNode;
191
- active?: boolean;
192
- disabled?: boolean;
193
- href?: string | object;
194
- LinkWrapper?: LinkWrapperType;
195
- onClick?: () => void;
196
- }
197
-
198
- const ListItem: FunctionComponent<ListItemProps> = ({
199
- loading,
200
- left,
201
- title,
202
- center,
203
- right,
204
- active,
205
- disabled,
206
- href,
207
- onClick,
208
- LinkWrapper,
209
- ...rest
210
- }) => {
211
- const itemProps = getItemProps(onClick, href, LinkWrapper);
212
- const commonProps = { active, disabled };
213
-
214
- return (
215
- <Item {...commonProps} {...rest} {...itemProps}>
216
- {left && <Left {...commonProps}>{left}</Left>}
217
- {title || center ? (
218
- <Center>
219
- {title && (
220
- <Title {...commonProps} loading={loading}>
221
- {title}
222
- </Title>
223
- )}
224
- {center && <CenterText {...commonProps}>{center}</CenterText>}
225
- </Center>
226
- ) : null}
227
- {right && <Right {...commonProps}>{right}</Right>}
228
- </Item>
229
- );
230
- };
231
-
232
- ListItem.defaultProps = {
233
- loading: false,
234
- left: null,
235
- title: <span>Loading state</span>,
236
- center: null,
237
- right: null,
238
- active: false,
239
- disabled: false,
240
- href: null,
241
- LinkWrapper: null,
242
- onClick: null,
243
- };
244
-
245
- export default ListItem;
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { styled } from '@storybook/theming';
4
- import { Tooltip } from './Tooltip';
5
-
6
- // Popper would position the tooltip absolutely. We just need to make sure we are pos:rel
7
- const mockPopperProps = { style: { position: 'relative', top: '20px', left: '20px' } };
8
-
9
- const Content = styled.div({
10
- width: '100px',
11
- height: '100px',
12
- fontSize: '16px',
13
- textAlign: 'center',
14
- lineHeight: '100px',
15
- });
16
-
17
- storiesOf('basics/Tooltip/Tooltip', module)
18
- .add('basic, default', () => (
19
- <Tooltip {...mockPopperProps} color="medium">
20
- <Content>Text</Content>
21
- </Tooltip>
22
- ))
23
- .add('basic, default, bottom', () => (
24
- <Tooltip placement="bottom" {...mockPopperProps}>
25
- <Content>Text</Content>
26
- </Tooltip>
27
- ))
28
- .add('basic, default, left', () => (
29
- <Tooltip placement="left" {...mockPopperProps}>
30
- <Content>Text</Content>
31
- </Tooltip>
32
- ))
33
- .add('basic, default, right', () => (
34
- <Tooltip placement="right" {...mockPopperProps}>
35
- <Content>Text</Content>
36
- </Tooltip>
37
- ))
38
- .add('no chrome', () => (
39
- <Tooltip hasChrome={false} {...mockPopperProps}>
40
- <Content>Text</Content>
41
- </Tooltip>
42
- ));
@@ -1,146 +0,0 @@
1
- import React, { FunctionComponent } from 'react';
2
- import memoize from 'memoizerific';
3
-
4
- import { styled, Color, lighten, darken } from '@storybook/theming';
5
-
6
- const match = memoize(1000)((requestes, actual, value, fallback = 0) =>
7
- actual.split('-')[0] === requestes ? value : fallback
8
- );
9
-
10
- const ArrowSpacing = 8;
11
-
12
- export interface ArrowProps {
13
- color: keyof Color;
14
- placement: string;
15
- }
16
-
17
- const Arrow = styled.div<ArrowProps>(
18
- {
19
- position: 'absolute',
20
- borderStyle: 'solid',
21
- },
22
- ({ theme, color, placement }) => ({
23
- marginBottom: `${match('top', placement, '0', ArrowSpacing)}px`,
24
- marginTop: `${match('bottom', placement, '0', ArrowSpacing)}px`,
25
- marginRight: `${match('left', placement, '0', ArrowSpacing)}px`,
26
- marginLeft: `${match('right', placement, '0', ArrowSpacing)}px`,
27
-
28
- bottom: `${match('top', placement, ArrowSpacing * -1, 'auto')}px`,
29
- top: `${match('bottom', placement, ArrowSpacing * -1, 'auto')}px`,
30
- right: `${match('left', placement, ArrowSpacing * -1, 'auto')}px`,
31
- left: `${match('right', placement, ArrowSpacing * -1, 'auto')}px`,
32
-
33
- borderBottomWidth: `${match('top', placement, '0', ArrowSpacing)}px`,
34
- borderTopWidth: `${match('bottom', placement, '0', ArrowSpacing)}px`,
35
- borderRightWidth: `${match('left', placement, '0', ArrowSpacing)}px`,
36
- borderLeftWidth: `${match('right', placement, '0', ArrowSpacing)}px`,
37
-
38
- borderTopColor: match(
39
- 'top',
40
- placement,
41
- theme.color[color] || color || theme.base === 'light'
42
- ? lighten(theme.background.app)
43
- : darken(theme.background.app),
44
- 'transparent'
45
- ),
46
- borderBottomColor: match(
47
- 'bottom',
48
- placement,
49
- theme.color[color] || color || theme.base === 'light'
50
- ? lighten(theme.background.app)
51
- : darken(theme.background.app),
52
- 'transparent'
53
- ),
54
- borderLeftColor: match(
55
- 'left',
56
- placement,
57
- theme.color[color] || color || theme.base === 'light'
58
- ? lighten(theme.background.app)
59
- : darken(theme.background.app),
60
- 'transparent'
61
- ),
62
- borderRightColor: match(
63
- 'right',
64
- placement,
65
- theme.color[color] || color || theme.base === 'light'
66
- ? lighten(theme.background.app)
67
- : darken(theme.background.app),
68
- 'transparent'
69
- ),
70
- })
71
- );
72
-
73
- export interface WrapperProps {
74
- color: keyof Color;
75
- placement: string;
76
- hidden?: boolean;
77
- hasChrome: boolean;
78
- }
79
-
80
- const Wrapper = styled.div<WrapperProps>(
81
- ({ hidden }) => ({
82
- display: hidden ? 'none' : 'inline-block',
83
- zIndex: 2147483647,
84
- }),
85
- ({ theme, color, hasChrome, placement }) =>
86
- hasChrome
87
- ? {
88
- marginBottom: `${match('top', placement, ArrowSpacing + 2, 0)}px`,
89
- marginTop: `${match('bottom', placement, ArrowSpacing + 2, 0)}px`,
90
- marginLeft: `${match('right', placement, ArrowSpacing + 2, 0)}px`,
91
- marginRight: `${match('left', placement, ArrowSpacing + 2, 0)}px`,
92
-
93
- background:
94
- theme.color[color] || color || theme.base === 'light'
95
- ? lighten(theme.background.app)
96
- : darken(theme.background.app),
97
- filter: `
98
- drop-shadow(0px 5px 5px rgba(0,0,0,0.05))
99
- drop-shadow(0 1px 3px rgba(0,0,0,0.1))
100
- `,
101
- borderRadius: theme.appBorderRadius * 2,
102
- fontSize: theme.typography.size.s1,
103
- }
104
- : {
105
- marginBottom: `${match('top', placement, 8, 0)}px`,
106
- marginTop: `${match('bottom', placement, 8, 0)}px`,
107
- marginLeft: `${match('right', placement, 8, 0)}px`,
108
- marginRight: `${match('left', placement, 8, 0)}px`,
109
- }
110
- );
111
-
112
- export interface TooltipProps {
113
- arrowRef?: any;
114
- tooltipRef?: any;
115
- hasChrome?: boolean;
116
- arrowProps?: any;
117
- placement?: string;
118
- color?: keyof Color;
119
- }
120
-
121
- export const Tooltip: FunctionComponent<TooltipProps> = ({
122
- placement,
123
- hasChrome,
124
- children,
125
- arrowProps,
126
- tooltipRef,
127
- arrowRef,
128
- color,
129
- ...props
130
- }) => {
131
- return (
132
- <Wrapper hasChrome={hasChrome} placement={placement} ref={tooltipRef} {...props} color={color}>
133
- {hasChrome && <Arrow placement={placement} ref={arrowRef} {...arrowProps} color={color} />}
134
- {children}
135
- </Wrapper>
136
- );
137
- };
138
-
139
- Tooltip.defaultProps = {
140
- color: undefined,
141
- arrowRef: undefined,
142
- tooltipRef: undefined,
143
- hasChrome: true,
144
- placement: 'top',
145
- arrowProps: {},
146
- };
@@ -1,52 +0,0 @@
1
- import React, { Children, FunctionComponent, ReactElement, ReactNode } from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { action } from '@storybook/addon-actions';
4
- import { WithTooltip } from './WithTooltip';
5
-
6
- import { TooltipLinkList } from './TooltipLinkList';
7
-
8
- const onLinkClick = action('onLinkClick');
9
-
10
- interface StoryLinkWrapperProps {
11
- href: string;
12
- passHref?: boolean;
13
- }
14
-
15
- const StoryLinkWrapper: FunctionComponent<StoryLinkWrapperProps> = ({
16
- href,
17
- passHref,
18
- children,
19
- }) => {
20
- const child = Children.only(children) as ReactElement;
21
-
22
- return React.cloneElement(child, {
23
- href: passHref && href,
24
- onClick: (e: React.MouseEvent) => {
25
- e.preventDefault();
26
- onLinkClick(href);
27
- },
28
- });
29
- };
30
-
31
- StoryLinkWrapper.defaultProps = {
32
- passHref: false,
33
- };
34
-
35
- export const links = [
36
- { id: '1', title: 'Link', href: 'http://google.com' },
37
- { id: '2', title: 'Link', href: 'http://google.com' },
38
- { id: '3', title: 'callback', onClick: action('onClick') },
39
- ];
40
-
41
- storiesOf('basics/Tooltip/TooltipLinkList', module)
42
- .addDecorator(storyFn => (
43
- <div style={{ height: '300px' }}>
44
- <WithTooltip placement="top" trigger="click" startOpen tooltip={storyFn()}>
45
- <div>Tooltip</div>
46
- </WithTooltip>
47
- </div>
48
- ))
49
- .add('links', () => <TooltipLinkList links={links.slice(0, 2)} LinkWrapper={StoryLinkWrapper} />)
50
- .add('links and callback', () => (
51
- <TooltipLinkList links={links} LinkWrapper={StoryLinkWrapper} />
52
- ));
@@ -1,49 +0,0 @@
1
- import React, { FunctionComponent, Key, ReactNode } from 'react';
2
- import { styled } from '@storybook/theming';
3
-
4
- import ListItem, { LinkWrapperType, ListItemProps } from './ListItem';
5
-
6
- const List = styled.div<{}>(
7
- {
8
- minWidth: 180,
9
- overflow: 'hidden',
10
- overflowY: 'auto',
11
- maxHeight: 10.5 * 32, // 10.5 items
12
- },
13
- ({ theme }) => ({
14
- borderRadius: theme.appBorderRadius * 2,
15
- })
16
- );
17
-
18
- export interface Link extends ListItemProps {
19
- id: string;
20
- isGatsby?: boolean;
21
- }
22
-
23
- export interface TooltipLinkListProps {
24
- links: Link[];
25
- LinkWrapper?: LinkWrapperType;
26
- }
27
-
28
- export const TooltipLinkList: FunctionComponent<TooltipLinkListProps> = ({
29
- links,
30
- LinkWrapper,
31
- }) => (
32
- <List>
33
- {links.map(({ id, title, href, onClick, active, isGatsby, ...props }) => (
34
- <ListItem
35
- key={id || (title as string)}
36
- title={title}
37
- onClick={onClick}
38
- active={active}
39
- href={href}
40
- LinkWrapper={isGatsby ? LinkWrapper : null}
41
- {...props}
42
- />
43
- ))}
44
- </List>
45
- );
46
-
47
- TooltipLinkList.defaultProps = {
48
- LinkWrapper: ListItem.defaultProps.LinkWrapper,
49
- };
@@ -1,37 +0,0 @@
1
- import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { WithTooltip } from './WithTooltip';
4
-
5
- import { TooltipMessage } from './TooltipMessage';
6
-
7
- storiesOf('basics/Tooltip/TooltipMessage', module)
8
- .addDecorator(storyFn => (
9
- <div style={{ height: '300px' }}>
10
- <WithTooltip placement="top" trigger="click" startOpen tooltip={storyFn()}>
11
- <div>Tooltip</div>
12
- </WithTooltip>
13
- </div>
14
- ))
15
- .add('default', () => (
16
- <TooltipMessage
17
- title="Lorem ipsum dolor sit"
18
- desc="Amet consectatur vestibulum concet durum politu coret weirom"
19
- />
20
- ))
21
- .add('with link', () => (
22
- <TooltipMessage
23
- title="Lorem ipsum dolor sit"
24
- desc="Amet consectatur vestibulum concet durum politu coret weirom"
25
- links={[{ title: 'Continue', href: 'test' }]}
26
- />
27
- ))
28
- .add('with links', () => (
29
- <TooltipMessage
30
- title="Lorem ipsum dolor sit"
31
- desc="Amet consectatur vestibulum concet durum politu coret weirom"
32
- links={[{ title: 'Get more tips', href: 'test' }, { title: 'Done', href: 'test' }]}
33
- />
34
- ))
35
- .add('minimal message', () => (
36
- <TooltipMessage desc="Amet consectatur vestibulum concet durum politu coret weirom" />
37
- ));
@@ -1,67 +0,0 @@
1
- import React, { FunctionComponent, ReactNode } from 'react';
2
- import { styled } from '@storybook/theming';
3
-
4
- import { Link } from '../typography/link/link';
5
-
6
- const Title = styled.div`
7
- font-weight: ${props => props.theme.typography.weight.black};
8
- `;
9
-
10
- const Desc = styled.span``;
11
-
12
- const Links = styled.div`
13
- margin-top: 8px;
14
- text-align: center;
15
-
16
- > * {
17
- margin: 0 8px;
18
- font-weight: ${props => props.theme.typography.weight.black};
19
- }
20
- `;
21
-
22
- const Message = styled.div`
23
- color: ${props => props.theme.color.darker};
24
- line-height: 18px;
25
- `;
26
-
27
- const MessageWrapper = styled.div`
28
- padding: 15px;
29
- width: 280px;
30
- box-sizing: border-box;
31
- `;
32
-
33
- export interface TooltipMessageProps {
34
- title?: ReactNode;
35
- desc?: ReactNode;
36
- links?: {
37
- title: string;
38
- href?: string;
39
- onClick?: () => void;
40
- }[];
41
- }
42
-
43
- export const TooltipMessage: FunctionComponent<TooltipMessageProps> = ({ title, desc, links }) => {
44
- return (
45
- <MessageWrapper>
46
- <Message>
47
- {title && <Title>{title}</Title>}
48
- {desc && <Desc>{desc}</Desc>}
49
- </Message>
50
- {links && (
51
- <Links>
52
- {links.map(({ title: linkTitle, ...other }) => (
53
- <Link {...other} key={linkTitle}>
54
- {linkTitle}
55
- </Link>
56
- ))}
57
- </Links>
58
- )}
59
- </MessageWrapper>
60
- );
61
- };
62
-
63
- TooltipMessage.defaultProps = {
64
- title: null,
65
- desc: null,
66
- links: null,
67
- };
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { WithTooltip } from './WithTooltip';
4
-
5
- import { TooltipNote } from './TooltipNote';
6
-
7
- storiesOf('basics/Tooltip/TooltipNote', module)
8
- .addDecorator(storyFn => (
9
- <div style={{ height: '300px' }}>
10
- <WithTooltip hasChrome={false} placement="top" trigger="click" startOpen tooltip={storyFn()}>
11
- <div>Tooltip</div>
12
- </WithTooltip>
13
- </div>
14
- ))
15
- .add('default', () => <TooltipNote note="Lorem ipsum dolor" />);
@@ -1,25 +0,0 @@
1
- import React, { FunctionComponent } from 'react';
2
- import { styled } from '@storybook/theming';
3
-
4
- const Note = styled.div`
5
- padding: 2px 6px;
6
- line-height: 16px;
7
- font-size: 10px;
8
- font-weight: ${props => props.theme.typography.weight.bold};
9
- color: ${props => props.theme.color.lightest};
10
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.3);
11
- border-radius: 4px;
12
- white-space: nowrap;
13
- pointer-events: none;
14
- z-index: -1;
15
- background: rgba(0, 0, 0, 0.4);
16
- margin: 6px;
17
- `;
18
-
19
- export interface TooltipNoteProps {
20
- note: string;
21
- }
22
-
23
- export const TooltipNote: FunctionComponent<TooltipNoteProps> = ({ note }) => {
24
- return <Note>{note}</Note>;
25
- };