@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,42 +0,0 @@
1
- import React, { FunctionComponent, ReactNode } from 'react';
2
- import { styled } from '@storybook/theming';
3
-
4
- const Wrapper = styled.label<{}>(({ theme }) => ({
5
- display: 'flex',
6
- borderBottom: `1px solid ${theme.appBorderColor}`,
7
- margin: '0 15px',
8
- padding: '8px 0',
9
-
10
- '&:last-child': {
11
- marginBottom: '3rem',
12
- },
13
- }));
14
-
15
- const Label = styled.span<{}>(({ theme }) => ({
16
- minWidth: 100,
17
- fontWeight: theme.typography.weight.bold,
18
- marginRight: 15,
19
- display: 'flex',
20
- justifyContent: 'flex-start',
21
- alignItems: 'center',
22
- lineHeight: '16px',
23
- }));
24
-
25
- export interface FieldProps {
26
- label?: ReactNode;
27
- }
28
-
29
- export const Field: FunctionComponent<FieldProps> = ({ label, children }) => (
30
- <Wrapper>
31
- {label ? (
32
- <Label>
33
- <span>{label}</span>
34
- </Label>
35
- ) : null}
36
- {children}
37
- </Wrapper>
38
- );
39
-
40
- Field.defaultProps = {
41
- label: undefined,
42
- };
@@ -1,133 +0,0 @@
1
- import React from 'react';
2
- import { styled } from '@storybook/theming';
3
- import { storiesOf } from '@storybook/react';
4
- import { action } from '@storybook/addon-actions';
5
-
6
- import { Input, Button, Select, Textarea } from './input/input';
7
- import { Field } from './field/field';
8
- import { Spaced } from '../spaced/Spaced';
9
-
10
- const Flexed = styled.div({ display: 'flex' });
11
-
12
- storiesOf('Basics|Form/Field', module).add('field', () => (
13
- <Field key="key" label="label">
14
- <Select value="val2" onChange={action('onChange')} size={1}>
15
- <option value="val1">Value 1</option>
16
- <option value="val2">Value 2</option>
17
- <option value="val3">Value 3</option>
18
- </Select>
19
- </Field>
20
- ));
21
-
22
- storiesOf('Basics|Form/Select', module)
23
- .add('sizes', () => (
24
- <Spaced>
25
- {['auto', 'flex', '100%'].map(size => (
26
- <Flexed key={size}>
27
- <Select value="val2" onChange={action('onChange')} size={size}>
28
- <option value="val1">Value 1</option>
29
- <option value="val2">Value 2</option>
30
- <option value="val3">Value 3</option>
31
- </Select>
32
- </Flexed>
33
- ))}
34
- </Spaced>
35
- ))
36
- .add('validations', () => (
37
- <div>
38
- <Spaced>
39
- {['error', 'warn', 'valid', null].map(valid => (
40
- <Select key={valid} value="val2" onChange={action('onChange')} size="100%" valid={valid}>
41
- <option value="val1">Value 1</option>
42
- <option value="val2">Value 2</option>
43
- <option value="val3">Value 3</option>
44
- </Select>
45
- ))}
46
- </Spaced>
47
- <Select value="val2" onChange={action('onChange')} size="100%" disabled>
48
- <option value="val1">Value 1</option>
49
- <option value="val2">Value 2</option>
50
- <option value="val3">Value 3</option>
51
- </Select>
52
- </div>
53
- ));
54
-
55
- storiesOf('Basics|Form/Button', module)
56
- .add('sizes', () => (
57
- <Spaced>
58
- {['auto', 'flex', '100%'].map(size => (
59
- <Flexed key={size}>
60
- <Button size={size}>click this button</Button>
61
- </Flexed>
62
- ))}
63
- </Spaced>
64
- ))
65
- .add('validations', () => (
66
- <Spaced>
67
- {['error', 'warn', 'valid', null].map(valid => (
68
- <Flexed key={valid}>
69
- <Button size="100%" valid={valid}>
70
- click this button
71
- </Button>
72
- </Flexed>
73
- ))}
74
- </Spaced>
75
- ));
76
-
77
- storiesOf('Basics|Form/Textarea', module)
78
- .add('sizes', () => (
79
- <Spaced>
80
- {['auto', 'flex', '100%'].map(size => (
81
- <Flexed key={size}>
82
- <Textarea defaultValue="textarea" size={size} />
83
- </Flexed>
84
- ))}
85
- </Spaced>
86
- ))
87
- .add('validations', () => (
88
- <Spaced>
89
- {['error', 'warn', 'valid', null].map(valid => (
90
- <Flexed key={valid}>
91
- <Textarea defaultValue="textarea" size="100%" valid={valid} />
92
- </Flexed>
93
- ))}
94
- </Spaced>
95
- ))
96
- .add('alignment', () => (
97
- <Spaced>
98
- {['end', 'center', 'start'].map(align => (
99
- <Flexed key={align}>
100
- <Textarea defaultValue="textarea" size="100%" align={align} />
101
- </Flexed>
102
- ))}
103
- </Spaced>
104
- ));
105
-
106
- storiesOf('Basics|Form/Input', module)
107
- .add('sizes', () => (
108
- <Spaced>
109
- {['auto', 'flex', '100%'].map(size => (
110
- <Flexed key={size}>
111
- <Input defaultValue="text" size={size} />
112
- </Flexed>
113
- ))}
114
- </Spaced>
115
- ))
116
- .add('validations', () => (
117
- <Spaced>
118
- {['error', 'warn', 'valid', null].map(valid => (
119
- <Flexed key={valid}>
120
- <Input defaultValue="text" size="100%" valid={valid} />
121
- </Flexed>
122
- ))}
123
- </Spaced>
124
- ))
125
- .add('alignment', () => (
126
- <Spaced>
127
- {['end', 'center', 'start'].map(align => (
128
- <Flexed key={align}>
129
- <Input defaultValue="text" size="100%" align={align} />
130
- </Flexed>
131
- ))}
132
- </Spaced>
133
- ));
@@ -1,18 +0,0 @@
1
- import { styled } from '@storybook/theming';
2
- import { Field } from './field/field';
3
- // InputStyleProps import is for TS
4
- import { InputStyleProps, Input, Select, Textarea, Button } from './input/input';
5
-
6
- export const Form = Object.assign(
7
- styled.form({
8
- boxSizing: 'border-box',
9
- width: '100%',
10
- }),
11
- {
12
- Field,
13
- Input,
14
- Select,
15
- Textarea,
16
- Button,
17
- }
18
- );
@@ -1,178 +0,0 @@
1
- import React, { FunctionComponent, forwardRef, Ref } from 'react';
2
- import { styled, Theme, CSSObject } from '@storybook/theming';
3
-
4
- import TextareaAutoResize, { TextareaAutosizeProps } from 'react-textarea-autosize';
5
-
6
- import { Button as StyledButton } from '../../Button/Button';
7
-
8
- const styleResets: CSSObject = {
9
- // resets
10
- appearance: 'none',
11
- border: '0',
12
- boxSizing: 'inherit',
13
- display: ' block',
14
- margin: ' 0',
15
- background: 'transparent',
16
- padding: 0,
17
- fontSize: 'inherit',
18
- position: 'relative',
19
- };
20
-
21
- const styles = ({ theme }: { theme: Theme }): CSSObject => ({
22
- ...styleResets,
23
-
24
- transition: 'all 200ms ease-out',
25
- color: theme.input.color || 'inherit',
26
- background: theme.input.background,
27
- boxShadow: `${theme.input.border} 0 0 0 1px inset`,
28
- borderRadius: theme.input.borderRadius,
29
- fontSize: theme.typography.size.s2 - 1,
30
- lineHeight: '20px',
31
- padding: '.42em 1em', // 32
32
-
33
- '&:focus': { boxShadow: `${theme.color.secondary} 0 0 0 1px inset` },
34
- '&[disabled]': {
35
- cursor: 'not-allowed',
36
- opacity: 0.5,
37
- },
38
-
39
- '&:-webkit-autofill': { WebkitBoxShadow: `0 0 0 3em ${theme.color.lightest} inset` },
40
-
41
- '::placeholder': {
42
- color: theme.color.mediumdark,
43
- },
44
- });
45
-
46
- type Sizes = '100%' | 'flex' | 'auto';
47
- type Alignments = 'end' | 'center' | 'start';
48
- type ValidationStates = 'valid' | 'error' | 'warn';
49
-
50
- export interface InputStyleProps {
51
- size?: Sizes;
52
- align?: Alignments;
53
- valid?: ValidationStates;
54
- }
55
-
56
- const sizes = ({ size }: { size?: Sizes }): CSSObject => {
57
- switch (size) {
58
- case '100%': {
59
- return { width: '100%' };
60
- }
61
- case 'flex': {
62
- return { flex: 1 };
63
- }
64
- case 'auto':
65
- default: {
66
- return { display: 'inline' };
67
- }
68
- }
69
- };
70
- const alignment = ({ align }: InputStyleProps): CSSObject => {
71
- switch (align) {
72
- case 'end': {
73
- return { textAlign: 'right' };
74
- }
75
- case 'center': {
76
- return { textAlign: 'center' };
77
- }
78
- case 'start':
79
- default: {
80
- return { textAlign: 'left' };
81
- }
82
- }
83
- };
84
- const validation = ({ valid, theme }: { valid: ValidationStates; theme: Theme }): CSSObject => {
85
- switch (valid) {
86
- case 'valid': {
87
- return { boxShadow: `${theme.color.positive} 0 0 0 1px inset !important` };
88
- }
89
- case 'error': {
90
- return { boxShadow: `${theme.color.negative} 0 0 0 1px inset !important` };
91
- }
92
- case 'warn': {
93
- return {
94
- boxShadow: `${theme.color.warning} 0 0 0 1px inset`,
95
- };
96
- }
97
- case undefined:
98
- case null:
99
- default: {
100
- return {};
101
- }
102
- }
103
- };
104
-
105
- type InputProps = Omit<React.HTMLProps<HTMLInputElement>, keyof InputStyleProps> & InputStyleProps;
106
- export const Input = Object.assign(
107
- styled(
108
- forwardRef<any, InputProps>(({ size, valid, align, ...props }, ref) => (
109
- <input {...props} ref={ref} />
110
- ))
111
- )<InputStyleProps>(styles, sizes, alignment, validation, {
112
- minHeight: 32,
113
- }),
114
- {
115
- displayName: 'Input',
116
- }
117
- );
118
-
119
- // (Input).styles = { ...styleResets, ...styles };
120
- // (Input).sizes = sizes;
121
- // (Input).alignment = alignment;
122
-
123
- type SelectProps = Omit<React.SelectHTMLAttributes<HTMLSelectElement>, keyof InputStyleProps> &
124
- InputStyleProps;
125
- export const Select = Object.assign(
126
- styled(
127
- forwardRef<any, SelectProps>(({ size, valid, align, ...props }, ref) => (
128
- <select {...props} ref={ref} />
129
- ))
130
- )<SelectProps>(styles, sizes, validation, {
131
- height: 32,
132
- userSelect: 'none',
133
- paddingRight: 20,
134
- appearance: 'menulist',
135
- }),
136
- {
137
- displayName: 'Select',
138
- }
139
- );
140
-
141
- type TextareaProps = Omit<TextareaAutosizeProps, keyof InputStyleProps> & InputStyleProps;
142
- export const Textarea = Object.assign(
143
- styled(
144
- forwardRef<any, TextareaProps>(({ size, valid, align, ...props }, ref) => (
145
- <TextareaAutoResize {...props} ref={ref} />
146
- ))
147
- )<TextareaProps>(styles, sizes, alignment, validation, {
148
- overflow: 'visible',
149
- }),
150
- {
151
- displayName: 'Textarea',
152
- }
153
- );
154
-
155
- const ButtonStyled = styled(
156
- forwardRef<any, InputStyleProps>(({ size, valid, align, ...props }, ref) => (
157
- <StyledButton {...props} ref={ref} />
158
- ))
159
- )<InputStyleProps>(sizes, validation, {
160
- // Custom styling for color widget nested in buttons
161
- userSelect: 'none',
162
- overflow: 'visible',
163
- zIndex: 2,
164
-
165
- // overrides the default hover from Button
166
- '&:hover': {
167
- transform: 'none',
168
- },
169
- });
170
-
171
- export const Button: FunctionComponent<any> = Object.assign(
172
- forwardRef<{}, {}>((props, ref) => (
173
- <ButtonStyled {...props} {...{ tertiary: true, small: true, inForm: true }} ref={ref} />
174
- )),
175
- {
176
- displayName: 'Button',
177
- }
178
- );
package/src/html.tsx DELETED
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import * as rawComponents from './typography/DocumentFormatting';
3
-
4
- export * from './typography/DocumentFormatting';
5
-
6
- export const components = Object.entries(rawComponents).reduce(
7
- (acc, [k, V]) => ({
8
- ...acc,
9
- [k.toLowerCase()]: (props: object) => <V {...props} className={`sbdocs-${k.toLowerCase()}`} />,
10
- }),
11
- {}
12
- );
@@ -1,77 +0,0 @@
1
- import React from 'react';
2
- import { styled } from '@storybook/theming';
3
- import { storiesOf } from '@storybook/react';
4
-
5
- import { Icons } from './icon';
6
- import { icons, IconKey } from './icons';
7
-
8
- const Meta = styled.div({
9
- color: '#333',
10
- fontSize: 12,
11
- });
12
-
13
- interface ItemProps {
14
- minimal?: boolean;
15
- }
16
-
17
- const Item = styled.div<ItemProps>(
18
- {
19
- display: 'inline-flex',
20
- flexDirection: 'row',
21
- alignItems: 'center',
22
- flex: '0 1 20%',
23
- minWidth: 120,
24
-
25
- padding: '0px 7.5px 20px',
26
-
27
- '& svg': {
28
- marginRight: 10,
29
- width: 24,
30
- height: 24,
31
- },
32
- },
33
- ({ minimal }) =>
34
- minimal
35
- ? {
36
- flex: 'none',
37
- minWidth: 'auto',
38
- padding: 0,
39
- background: '#fff',
40
- border: '1px solid #666',
41
-
42
- '& svg': {
43
- display: 'block',
44
- marginRight: 0,
45
- width: 48,
46
- height: 48,
47
- },
48
- }
49
- : {}
50
- );
51
-
52
- const List = styled.div({
53
- display: 'flex',
54
- flexFlow: 'row wrap',
55
- });
56
-
57
- const list = Object.keys(icons).sort() as IconKey[];
58
-
59
- storiesOf('Basics|Icon', module)
60
- .add('labels', () => (
61
- <List>
62
- {list.map(key => (
63
- <Item key={key}>
64
- <Icons icon={key} /> <Meta>{key}</Meta>
65
- </Item>
66
- ))}
67
- </List>
68
- ))
69
- .add('no labels', () => (
70
- <List>
71
- {list.map(key => (
72
- <Item minimal key={key}>
73
- <Icons icon={key} />
74
- </Item>
75
- ))}
76
- </List>
77
- ));
package/src/icon/icon.tsx DELETED
@@ -1,22 +0,0 @@
1
- import React, { FunctionComponent } from 'react';
2
- import { styled } from '@storybook/theming';
3
- import icons, { IconKey } from './icons';
4
-
5
- import Svg from './svg';
6
-
7
- const Path = styled.path({
8
- fill: 'currentColor',
9
- });
10
-
11
- export interface IconsProps {
12
- icon: IconKey;
13
- }
14
-
15
- // TODO: if we can resize the 1024 to 20, we can remove the size attributes
16
- export const Icons: FunctionComponent<IconsProps> = ({ icon, ...props }) => {
17
- return (
18
- <Svg viewBox="0 0 1024 1024" {...props}>
19
- <Path d={icons[icon]} />
20
- </Svg>
21
- );
22
- };