@basic-ui/material 0.1.13 → 0.1.14
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/package.json +3 -3
- package/src/Alert/Alert.story.tsx +5 -6
- package/src/AppBar/AppBar.story.tsx +11 -20
- package/src/BottomSheet/BottomSheet.story.tsx +5 -6
- package/src/Button/Button.story.tsx +14 -14
- package/src/Button/SpinnerButton.story.tsx +6 -6
- package/src/CheckBox/CheckBox.story.tsx +7 -6
- package/src/Chip/Chip.story.tsx +5 -7
- package/src/Combobox/Combobox.story.tsx +12 -10
- package/src/Dialog/Dialog.story.tsx +7 -8
- package/src/Divider/Divider.story.tsx +6 -5
- package/src/FloatingLabel/FloatingLabel.story.tsx +10 -9
- package/src/LineRipple/LineRipple.story.tsx +5 -4
- package/src/Link/Link.story.tsx +3 -4
- package/src/ListItem/ListItem.story.tsx +6 -5
- package/src/Menu/Menu.story.tsx +8 -7
- package/src/NotchedOutline/NotchedOutline.story.tsx +5 -4
- package/src/Paper/Paper.story.tsx +5 -4
- package/src/ProgressSpinner/ProgressSpinner.story.tsx +5 -4
- package/src/RadioButton/RadioButton.story.tsx +12 -10
- package/src/Ripple/Ripple.story.tsx +5 -4
- package/src/Select/Select.story.tsx +8 -7
- package/src/Skeleton/Skeleton.story.tsx +7 -6
- package/src/Snackbar/Snackbar.story.tsx +7 -6
- package/src/Switch/Switch.story.tsx +5 -4
- package/src/Tab/Tab.story.tsx +7 -5
- package/src/Table/Table.story.tsx +5 -4
- package/src/Text/Text.story.tsx +5 -4
- package/src/TextField/TextField.story.tsx +7 -6
- package/src/Tooltip/Tooltip.story.tsx +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basic-ui/material",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Accessible React Components used as building blocks for UI patterns",
|
|
5
5
|
"author": "Lucas Terra <lucasterra7@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@basic-ui/core": "^0.0.
|
|
30
|
+
"@basic-ui/core": "^0.0.37",
|
|
31
31
|
"@styled-system/should-forward-prop": "5.1.5",
|
|
32
32
|
"@types/styled-system": "^5.1.10",
|
|
33
33
|
"@types/styled-system__css": "^5.0.14",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0",
|
|
51
51
|
"react-spring": "^9.0.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "78b668ff80ce86a4672b3f34ca2c1aaaf79c56eb"
|
|
54
54
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Alert } from './';
|
|
2
2
|
import { Link } from '../Link';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
// import './styles.css';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Alert',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const Controlled = () => {
|
|
7
10
|
const color = ['primary', 'secondary', 'error'];
|
|
8
11
|
return (
|
|
9
12
|
<>
|
|
@@ -23,7 +26,3 @@ const Example = () => {
|
|
|
23
26
|
</>
|
|
24
27
|
);
|
|
25
28
|
};
|
|
26
|
-
|
|
27
|
-
const stories = storiesOf('Components/Alert', module);
|
|
28
|
-
|
|
29
|
-
stories.add('controlled', () => <Example />);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { AppBar, AppBarButton, AppBarProps } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Box } from '../Box';
|
|
5
4
|
import { LoremIpsum } from '../Text/LoremIpsum';
|
|
6
5
|
import { Button } from '../Button';
|
|
7
6
|
import { BaseLine } from '../BaseLine';
|
|
8
7
|
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/AppBar',
|
|
10
|
+
};
|
|
11
|
+
|
|
9
12
|
const MenuIcon = (props) => (
|
|
10
13
|
<svg width={24} height={24} {...props}>
|
|
11
14
|
<path d="M0 0h24v24H0z" fill="none" />
|
|
@@ -54,24 +57,12 @@ const Example = ({ variant, size }) => {
|
|
|
54
57
|
);
|
|
55
58
|
};
|
|
56
59
|
|
|
57
|
-
const
|
|
60
|
+
export const Default = () => <Example variant="default" size="default" />;
|
|
61
|
+
export const Primary = () => <Example variant="primary" size="default" />;
|
|
62
|
+
export const Secondary = () => <Example variant="secondary" size="default" />;
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
62
|
-
stories.add('primary appbar', () => (
|
|
63
|
-
<Example variant="primary" size="default" />
|
|
64
|
-
));
|
|
65
|
-
stories.add('secondary appbar', () => (
|
|
66
|
-
<Example variant="secondary" size="default" />
|
|
67
|
-
));
|
|
68
|
-
|
|
69
|
-
stories.add('default appbar, dense', () => (
|
|
70
|
-
<Example variant="default" size="dense" />
|
|
71
|
-
));
|
|
72
|
-
stories.add('primary appbar, dense', () => (
|
|
73
|
-
<Example variant="primary" size="dense" />
|
|
74
|
-
));
|
|
75
|
-
stories.add('secondary appbar, dense', () => (
|
|
64
|
+
export const DefaultDense = () => <Example variant="default" size="dense" />;
|
|
65
|
+
export const PrimaryDense = () => <Example variant="primary" size="dense" />;
|
|
66
|
+
export const SecondaryDense = () => (
|
|
76
67
|
<Example variant="secondary" size="dense" />
|
|
77
|
-
)
|
|
68
|
+
);
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { BottomSheet } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Button } from '../Button';
|
|
5
4
|
import { LoremIpsum } from '../Text/LoremIpsum';
|
|
6
5
|
import { Box } from '../Box';
|
|
7
6
|
import { Switch } from '../Switch';
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
export default {
|
|
9
|
+
title: 'components/BottomSheet',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Default = () => {
|
|
10
13
|
const [open, setOpen] = useState(false);
|
|
11
14
|
const [long, setLong] = useState(false);
|
|
12
15
|
|
|
@@ -29,7 +32,3 @@ const Example = () => {
|
|
|
29
32
|
</Box>
|
|
30
33
|
);
|
|
31
34
|
};
|
|
32
|
-
|
|
33
|
-
const stories = storiesOf('Components/BottomSheet', module);
|
|
34
|
-
|
|
35
|
-
stories.add('bottomsheet', () => <Example />);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Button } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Box } from '../Box';
|
|
5
4
|
|
|
5
|
+
export default {
|
|
6
|
+
title: 'components/Button',
|
|
7
|
+
};
|
|
8
|
+
|
|
6
9
|
const AppsIcon = (props) => (
|
|
7
10
|
<svg width={24} height={24} {...props}>
|
|
8
11
|
<path
|
|
@@ -87,12 +90,11 @@ const Example = (props) => {
|
|
|
87
90
|
);
|
|
88
91
|
};
|
|
89
92
|
|
|
90
|
-
const stories = storiesOf('Components/Button', module);
|
|
91
93
|
const onClick = (e) => {
|
|
92
94
|
console.log('I got clicked', e.target.innerText);
|
|
93
95
|
};
|
|
94
96
|
|
|
95
|
-
const
|
|
97
|
+
export const DebugButtonClick = () => {
|
|
96
98
|
const [count, setCount] = useState(0);
|
|
97
99
|
|
|
98
100
|
return (
|
|
@@ -104,22 +106,20 @@ const ButtonDebug = () => {
|
|
|
104
106
|
);
|
|
105
107
|
};
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
stories.add('default', () => (
|
|
109
|
+
export const Default = () => (
|
|
110
110
|
<Example color="surface" colorTransparent="on.surface" onClick={onClick} />
|
|
111
|
-
)
|
|
111
|
+
);
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
export const Primary = () => <Example color="primary" onClick={onClick} />;
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
export const Secondary = () => <Example color="secondary" onClick={onClick} />;
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
export const Error = () => <Example color="error" onClick={onClick} />;
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
export const Disabled = () => (
|
|
120
120
|
<Example color="primary" disabled={true} onClick={onClick} />
|
|
121
|
-
)
|
|
121
|
+
);
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
export const DisabledSecondary = () => (
|
|
124
124
|
<Example color="secondary" disabled={true} onClick={onClick} />
|
|
125
|
-
)
|
|
125
|
+
);
|
|
@@ -5,12 +5,15 @@ import {
|
|
|
5
5
|
SpinnerProps,
|
|
6
6
|
SpinnerButtonProps,
|
|
7
7
|
} from '@basic-ui/core';
|
|
8
|
-
import { storiesOf } from '@storybook/react';
|
|
9
8
|
import { Button, Box, Text } from '../';
|
|
10
9
|
import { alpha } from '../color';
|
|
11
10
|
import { useTheme } from '../theme';
|
|
12
11
|
import { BoxProps } from '../Box';
|
|
13
12
|
|
|
13
|
+
export default {
|
|
14
|
+
title: 'components/SpinnerButton',
|
|
15
|
+
};
|
|
16
|
+
|
|
14
17
|
const Spinner: FC<
|
|
15
18
|
Omit<BoxProps, 'onChange'> & SpinnerProps
|
|
16
19
|
> = SpinnerBase as any;
|
|
@@ -18,8 +21,6 @@ const SpinnerButton: FC<
|
|
|
18
21
|
BoxProps & SpinnerButtonProps
|
|
19
22
|
> = SpinnerButtonBase as any;
|
|
20
23
|
|
|
21
|
-
const stories = storiesOf('OtherComponents/SpinnerButton', module);
|
|
22
|
-
|
|
23
24
|
function AddIcon(props) {
|
|
24
25
|
return (
|
|
25
26
|
<svg viewBox="0 0 24 24" width={24} height={24} {...props}>
|
|
@@ -87,6 +88,5 @@ const Example = ({ vertical = false }) => {
|
|
|
87
88
|
);
|
|
88
89
|
};
|
|
89
90
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
stories.add('vertical', () => <Example vertical={true} />);
|
|
91
|
+
export const Horizontal = () => <Example />;
|
|
92
|
+
export const Vertical = () => <Example vertical={true} />;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { useState, useRef } from 'react';
|
|
2
2
|
import { CheckBox, Box } from '../';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { keyframes } from '@emotion/react';
|
|
5
4
|
import { Keyframes } from '@emotion/serialize';
|
|
6
5
|
|
|
6
|
+
export default {
|
|
7
|
+
title: 'components/CheckBox',
|
|
8
|
+
};
|
|
9
|
+
|
|
7
10
|
const HeartOutline = (props) => {
|
|
8
11
|
return (
|
|
9
12
|
<svg height={24} viewBox="0 0 24 24" width={24} {...props}>
|
|
@@ -28,7 +31,7 @@ const HeartFilled = (props) => {
|
|
|
28
31
|
);
|
|
29
32
|
};
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
const settingIn: Keyframes = keyframes({
|
|
32
35
|
'0%': {
|
|
33
36
|
transform: `scale(1)`,
|
|
34
37
|
},
|
|
@@ -40,7 +43,7 @@ export const settingIn: Keyframes = keyframes({
|
|
|
40
43
|
},
|
|
41
44
|
});
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
const settingOut: Keyframes = keyframes({
|
|
44
47
|
'0%': {
|
|
45
48
|
transform: `scale(1)`,
|
|
46
49
|
},
|
|
@@ -147,6 +150,4 @@ const Example = () => {
|
|
|
147
150
|
);
|
|
148
151
|
};
|
|
149
152
|
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
stories.add('controlled', () => <Example />);
|
|
153
|
+
export const Controlled = () => <Example />;
|
package/src/Chip/Chip.story.tsx
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Chip } from './';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
2
|
import { Box } from '../Box';
|
|
4
3
|
import { Text } from '../Text';
|
|
5
4
|
import { alpha } from '../color';
|
|
6
5
|
import { RadioGroup } from '../RadioButton';
|
|
7
6
|
import { ChoiceChip } from './ChoiceChip';
|
|
8
|
-
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'components/Chip',
|
|
10
|
+
};
|
|
9
11
|
|
|
10
12
|
const CloseIcon = (props) => (
|
|
11
13
|
<Box
|
|
@@ -157,7 +159,7 @@ const AllColors = ({ variant }) => (
|
|
|
157
159
|
</>
|
|
158
160
|
);
|
|
159
161
|
|
|
160
|
-
const AllVariants = () => {
|
|
162
|
+
export const AllVariants = () => {
|
|
161
163
|
return (
|
|
162
164
|
<>
|
|
163
165
|
<AllColors variant="filled" />
|
|
@@ -165,7 +167,3 @@ const AllVariants = () => {
|
|
|
165
167
|
</>
|
|
166
168
|
);
|
|
167
169
|
};
|
|
168
|
-
|
|
169
|
-
const stories = storiesOf('Components/Chip', module);
|
|
170
|
-
|
|
171
|
-
stories.add('choice chip', () => <AllVariants />);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useMemo, useState } from 'react';
|
|
2
2
|
import type * as React from 'react';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import {
|
|
5
4
|
Combobox,
|
|
6
5
|
ComboboxLabel,
|
|
@@ -13,7 +12,9 @@ import {
|
|
|
13
12
|
import { Box } from '../Box';
|
|
14
13
|
import cities from '../../../core/src/ComboBox/cities';
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
export default {
|
|
16
|
+
title: 'components/Combobox',
|
|
17
|
+
};
|
|
17
18
|
|
|
18
19
|
function useCityMatch(searchTerm: string) {
|
|
19
20
|
return useMemo(() => {
|
|
@@ -28,7 +29,7 @@ function useCityMatch(searchTerm: string) {
|
|
|
28
29
|
}, [searchTerm]);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
function UncontrolledClientSideExample({ initialValue = '' }) {
|
|
32
33
|
const [term, setTerm] = useState(initialValue);
|
|
33
34
|
const [selected, setSelected] = useState(initialValue);
|
|
34
35
|
const results = useCityMatch(term);
|
|
@@ -86,7 +87,7 @@ export function UncontrolledClientSideExample({ initialValue = '' }) {
|
|
|
86
87
|
);
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
function ControlledClientSideExample({ initialValue = '' }) {
|
|
90
91
|
const [term, setTerm] = useState(initialValue);
|
|
91
92
|
const [selected, setSelected] = useState(initialValue);
|
|
92
93
|
const results = useCityMatch(term);
|
|
@@ -147,11 +148,12 @@ export function ControlledClientSideExample({ initialValue = '' }) {
|
|
|
147
148
|
);
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
export const UncontrolledClientSide = () => <UncontrolledClientSideExample />;
|
|
152
|
+
export const UncontrolledClientSideInitial = () => (
|
|
152
153
|
<UncontrolledClientSideExample initialValue="Aberdeen" />
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
export const ControlledClientSide = () => <ControlledClientSideExample />;
|
|
157
|
+
export const ControlledClientSideInitial = () => (
|
|
156
158
|
<ControlledClientSideExample initialValue="Aberdeen" />
|
|
157
|
-
)
|
|
159
|
+
);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Dialog, DialogAnimationModes } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Button } from '../Button';
|
|
5
4
|
import { LoremIpsum } from '../Text/LoremIpsum';
|
|
6
5
|
import { Box } from '../Box';
|
|
@@ -8,6 +7,10 @@ import { Switch } from '../Switch';
|
|
|
8
7
|
import { Select } from '../Select';
|
|
9
8
|
import { SelectItem } from '../SelectItem';
|
|
10
9
|
|
|
10
|
+
export default {
|
|
11
|
+
title: 'components/Dialog',
|
|
12
|
+
};
|
|
13
|
+
|
|
11
14
|
const Example = ({ animationMode = 'slide' as DialogAnimationModes }) => {
|
|
12
15
|
const [open, setOpen] = useState(false);
|
|
13
16
|
const [long, setLong] = useState(false);
|
|
@@ -43,10 +46,6 @@ const Example = ({ animationMode = 'slide' as DialogAnimationModes }) => {
|
|
|
43
46
|
);
|
|
44
47
|
};
|
|
45
48
|
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
stories.add('dialog, grow', () => <Example animationMode={'grow'} />);
|
|
50
|
-
stories.add('dialog, slide-grow', () => (
|
|
51
|
-
<Example animationMode={'slide-grow'} />
|
|
52
|
-
));
|
|
49
|
+
export const DialogSlide = () => <Example />;
|
|
50
|
+
export const DialogGrow = () => <Example animationMode={'grow'} />;
|
|
51
|
+
export const DialogSlideGrow = () => <Example animationMode={'slide-grow'} />;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Divider } from './';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
2
|
import { Text } from '../Text';
|
|
4
3
|
import { Box } from '../Box';
|
|
5
4
|
// import './styles.css';
|
|
6
5
|
|
|
6
|
+
export default {
|
|
7
|
+
title: 'components/Divider',
|
|
8
|
+
};
|
|
9
|
+
|
|
7
10
|
const ExampleHorizontal = () => {
|
|
8
11
|
return (
|
|
9
12
|
<Box bg="surface">
|
|
@@ -32,7 +35,5 @@ const ExampleVertical = () => {
|
|
|
32
35
|
);
|
|
33
36
|
};
|
|
34
37
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
stories.add('horizontal', () => <ExampleHorizontal />);
|
|
38
|
-
stories.add('vertical', () => <ExampleVertical />);
|
|
38
|
+
export const Horizontal = () => <ExampleHorizontal />;
|
|
39
|
+
export const Vertical = () => <ExampleVertical />;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { useRef, useState } from 'react';
|
|
2
|
-
import { FloatingLabel } from './FloatingLabel';
|
|
2
|
+
import { FloatingLabel as FloatingLabelComponent } from './FloatingLabel';
|
|
3
3
|
import { Box } from '../Box';
|
|
4
4
|
import { Button } from '../Button';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'helper components/FloatingLabel',
|
|
8
|
+
};
|
|
6
9
|
|
|
7
10
|
const Example = () => {
|
|
8
11
|
const ref = useRef<HTMLDivElement>();
|
|
@@ -22,9 +25,9 @@ const Example = () => {
|
|
|
22
25
|
mb={2}
|
|
23
26
|
bg="#eee"
|
|
24
27
|
>
|
|
25
|
-
<
|
|
28
|
+
<FloatingLabelComponent active={active} height={50}>
|
|
26
29
|
Standard
|
|
27
|
-
</
|
|
30
|
+
</FloatingLabelComponent>
|
|
28
31
|
</Box>
|
|
29
32
|
<Box
|
|
30
33
|
display="flex"
|
|
@@ -38,9 +41,9 @@ const Example = () => {
|
|
|
38
41
|
mb={2}
|
|
39
42
|
bg="#eee"
|
|
40
43
|
>
|
|
41
|
-
<
|
|
44
|
+
<FloatingLabelComponent active={active} height={50} offsetX={16}>
|
|
42
45
|
Standard
|
|
43
|
-
</
|
|
46
|
+
</FloatingLabelComponent>
|
|
44
47
|
</Box>
|
|
45
48
|
<Button onClick={() => setActive(true)}>Activate</Button>
|
|
46
49
|
<Button onClick={() => setActive(false)}>Deactivate</Button>
|
|
@@ -48,6 +51,4 @@ const Example = () => {
|
|
|
48
51
|
);
|
|
49
52
|
};
|
|
50
53
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
stories.add('floating label', () => <Example />);
|
|
54
|
+
export const FloatingLabel = () => <Example />;
|
|
@@ -3,7 +3,10 @@ import { LineRipple } from './';
|
|
|
3
3
|
import { Box } from '../Box';
|
|
4
4
|
import { Text } from '../Text';
|
|
5
5
|
import { Button } from '../Button';
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'helper components/LineRipple',
|
|
9
|
+
};
|
|
7
10
|
|
|
8
11
|
const Example = () => {
|
|
9
12
|
const ref = useRef<HTMLDivElement>();
|
|
@@ -36,6 +39,4 @@ const Example = () => {
|
|
|
36
39
|
);
|
|
37
40
|
};
|
|
38
41
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
stories.add('controlled', () => <Example />);
|
|
42
|
+
export const Controlled = () => <Example />;
|
package/src/Link/Link.story.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Link } from './';
|
|
2
2
|
import { Text } from '../Text';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export default { title: 'components/Link' };
|
|
4
5
|
|
|
5
6
|
const Example = () => {
|
|
6
7
|
return (
|
|
@@ -10,6 +11,4 @@ const Example = () => {
|
|
|
10
11
|
);
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
stories.add('simple', () => <Example />);
|
|
14
|
+
export const Simple = () => <Example />;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { ListItem, ListItemText } from './';
|
|
3
3
|
import { List } from '../List';
|
|
4
|
-
import { storiesOf } from '@storybook/react';
|
|
5
4
|
// import './styles.css';
|
|
6
5
|
|
|
6
|
+
export default {
|
|
7
|
+
title: 'components/ListItem',
|
|
8
|
+
};
|
|
9
|
+
|
|
7
10
|
const Example = ({ selectable = false }) => {
|
|
8
11
|
const [selectedItem, setSelectedItem] = useState(selectable ? '0' : '-1');
|
|
9
12
|
|
|
@@ -35,7 +38,5 @@ const Example = ({ selectable = false }) => {
|
|
|
35
38
|
);
|
|
36
39
|
};
|
|
37
40
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
stories.add('normal', () => <Example />);
|
|
41
|
-
stories.add('selectable', () => <Example selectable={true} />);
|
|
41
|
+
export const Normal = () => <Example />;
|
|
42
|
+
export const Selectable = () => <Example selectable={true} />;
|
package/src/Menu/Menu.story.tsx
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Menu, MenuButton, MenuList, MenuItem, MenuPopover } from '.';
|
|
2
2
|
import { Divider } from '../Divider';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Box } from '../Box';
|
|
5
4
|
// import './styles.css';
|
|
6
5
|
|
|
6
|
+
export default {
|
|
7
|
+
title: 'components/Menu',
|
|
8
|
+
};
|
|
9
|
+
|
|
7
10
|
const MenuUncontrolled = ({ disabled }) => {
|
|
8
11
|
return (
|
|
9
12
|
<Box px={5}>
|
|
@@ -44,10 +47,8 @@ const MenuUncontrolledWithLinks = ({ disabled }) => {
|
|
|
44
47
|
);
|
|
45
48
|
};
|
|
46
49
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
stories.add('uncontrolled', () => <MenuUncontrolled disabled={undefined} />);
|
|
50
|
-
stories.add('uncontrolled, with links', () => (
|
|
50
|
+
export const Uncontrolled = () => <MenuUncontrolled disabled={undefined} />;
|
|
51
|
+
export const UncontrolledWithLinks = () => (
|
|
51
52
|
<MenuUncontrolledWithLinks disabled={undefined} />
|
|
52
|
-
)
|
|
53
|
-
|
|
53
|
+
);
|
|
54
|
+
export const Disabled = () => <MenuUncontrolled disabled={true} />;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {} from './';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
2
|
import { NotchedOutline } from './NotchedOutline';
|
|
4
3
|
import { Box } from '../Box';
|
|
5
4
|
import { FloatingLabel } from '../FloatingLabel';
|
|
6
5
|
import { rem } from 'polished';
|
|
7
6
|
// import './styles.css';
|
|
8
7
|
|
|
8
|
+
export default {
|
|
9
|
+
title: 'helper components/NotchedOutline',
|
|
10
|
+
};
|
|
11
|
+
|
|
9
12
|
const Example = () => {
|
|
10
13
|
const labelWidth = 68.27;
|
|
11
14
|
|
|
@@ -92,6 +95,4 @@ const Example = () => {
|
|
|
92
95
|
);
|
|
93
96
|
};
|
|
94
97
|
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
stories.add('controlled', () => <Example />);
|
|
98
|
+
export const Controlled = () => <Example />;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Paper } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Text } from '../Text';
|
|
5
4
|
import { Box } from '../Box';
|
|
6
5
|
|
|
6
|
+
export default {
|
|
7
|
+
title: 'components/Paper',
|
|
8
|
+
};
|
|
9
|
+
|
|
7
10
|
const Example = ({}) => {
|
|
8
11
|
const [elevation, setElevation] = useState(0);
|
|
9
12
|
|
|
@@ -30,6 +33,4 @@ const Example = ({}) => {
|
|
|
30
33
|
);
|
|
31
34
|
};
|
|
32
35
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
stories.add('paper', () => <Example />);
|
|
36
|
+
export const Default = () => <Example />;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { ProgressSpinner } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Box } from '../Box';
|
|
5
4
|
|
|
5
|
+
export default {
|
|
6
|
+
title: 'components/ProgressSpinner',
|
|
7
|
+
};
|
|
8
|
+
|
|
6
9
|
const Example = () => {
|
|
7
10
|
const steps = [0, 25, 50, 75, 100];
|
|
8
11
|
const [currentProgress, setCurrentProgress] = useState(0);
|
|
@@ -28,6 +31,4 @@ const Example = () => {
|
|
|
28
31
|
);
|
|
29
32
|
};
|
|
30
33
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
stories.add('controlled', () => <Example />);
|
|
34
|
+
export const Default = () => <Example />;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import type * as React from 'react';
|
|
3
3
|
import { RadioButton, RadioGroup, Box } from '../';
|
|
4
|
-
import { storiesOf } from '@storybook/react';
|
|
5
4
|
// import './styles.css';
|
|
6
5
|
|
|
6
|
+
export default {
|
|
7
|
+
title: 'components/RadioButton',
|
|
8
|
+
};
|
|
9
|
+
|
|
7
10
|
const Example = (props) => {
|
|
8
11
|
return (
|
|
9
12
|
<>
|
|
@@ -29,7 +32,7 @@ const Example = (props) => {
|
|
|
29
32
|
);
|
|
30
33
|
};
|
|
31
34
|
|
|
32
|
-
const
|
|
35
|
+
const StandaloneExample = (props) => {
|
|
33
36
|
const [selectedValue, setSelectedValue] = useState('a');
|
|
34
37
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
35
38
|
setSelectedValue(e.target.value);
|
|
@@ -90,17 +93,16 @@ const Standalone = (props) => {
|
|
|
90
93
|
);
|
|
91
94
|
};
|
|
92
95
|
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
stories.add('controlled', () => (
|
|
96
|
+
export const Controlled = () => (
|
|
96
97
|
<>
|
|
97
98
|
<Example name="demo-1" />
|
|
98
99
|
<Example name="demo-2" />
|
|
99
100
|
</>
|
|
100
|
-
)
|
|
101
|
-
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
export const Standalone = () => (
|
|
102
104
|
<>
|
|
103
|
-
<
|
|
104
|
-
<
|
|
105
|
+
<StandaloneExample name="demo-1" />
|
|
106
|
+
<StandaloneExample name="demo-2" />
|
|
105
107
|
</>
|
|
106
|
-
)
|
|
108
|
+
);
|
|
@@ -3,10 +3,13 @@ import { Ripple, useRipple } from './';
|
|
|
3
3
|
import { Box } from '../Box';
|
|
4
4
|
import { Text } from '../Text';
|
|
5
5
|
import { Button } from '../Button';
|
|
6
|
-
import { storiesOf } from '@storybook/react';
|
|
7
6
|
import { useTheme } from '../theme';
|
|
8
7
|
import { get } from '@styled-system/css';
|
|
9
8
|
|
|
9
|
+
export default {
|
|
10
|
+
title: 'helper components/Ripple',
|
|
11
|
+
};
|
|
12
|
+
|
|
10
13
|
const Example = () => {
|
|
11
14
|
const theme = useTheme();
|
|
12
15
|
const ref = useRef<HTMLDivElement>();
|
|
@@ -66,6 +69,4 @@ const Example = () => {
|
|
|
66
69
|
);
|
|
67
70
|
};
|
|
68
71
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
stories.add('controlled', () => <Example />);
|
|
72
|
+
export const Controlled = () => <Example />;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Select } from './';
|
|
3
3
|
import { SelectItem } from '../SelectItem';
|
|
4
|
-
import { storiesOf } from '@storybook/react';
|
|
5
4
|
import { Box } from '../Box';
|
|
6
5
|
import { CheckBox } from '../CheckBox';
|
|
7
6
|
// import './styles.css';
|
|
8
7
|
|
|
8
|
+
export default {
|
|
9
|
+
title: 'components/Select',
|
|
10
|
+
};
|
|
11
|
+
|
|
9
12
|
const Example = ({ variant, native = false }) => {
|
|
10
13
|
const [error, setError] = useState<boolean | string>(false);
|
|
11
14
|
const [color, setColor] = useState<'primary' | 'secondary'>('primary');
|
|
@@ -191,9 +194,7 @@ const Example = ({ variant, native = false }) => {
|
|
|
191
194
|
);
|
|
192
195
|
};
|
|
193
196
|
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
stories.add('filled, native', () => <Example variant="filled" native />);
|
|
199
|
-
stories.add('outlined, native', () => <Example variant="outlined" native />);
|
|
197
|
+
export const Filled = () => <Example variant="filled" />;
|
|
198
|
+
export const Outlined = () => <Example variant="outlined" />;
|
|
199
|
+
export const FilledNative = () => <Example variant="filled" native />;
|
|
200
|
+
export const OutlinedNative = () => <Example variant="outlined" native />;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Skeleton } from './';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
2
|
import { Box } from '../Box';
|
|
4
3
|
import { Text } from '../Text';
|
|
5
4
|
import { DelayAppearance } from './DelayAppearance';
|
|
6
5
|
|
|
6
|
+
export default {
|
|
7
|
+
title: 'components/Skeleton',
|
|
8
|
+
};
|
|
9
|
+
|
|
7
10
|
const Skeletons = ({
|
|
8
11
|
animation = 'pulse',
|
|
9
12
|
}: {
|
|
@@ -46,11 +49,9 @@ const Example = () => {
|
|
|
46
49
|
);
|
|
47
50
|
};
|
|
48
51
|
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
stories.add('controlled', () => <Example />);
|
|
52
|
-
stories.add('controlled, delayed appearance', () => (
|
|
52
|
+
export const Default = () => <Example />;
|
|
53
|
+
export const DelayedAppearance = () => (
|
|
53
54
|
<DelayAppearance>
|
|
54
55
|
<Example />
|
|
55
56
|
</DelayAppearance>
|
|
56
|
-
)
|
|
57
|
+
);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Snackbar } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
3
|
import { Box } from '../Box';
|
|
5
4
|
import { Button } from '../Button';
|
|
6
5
|
import { Select } from '../Select';
|
|
@@ -9,6 +8,10 @@ import { Link } from '../Link';
|
|
|
9
8
|
import { StackProvider, useStack } from './Stack';
|
|
10
9
|
// import './styles.css';
|
|
11
10
|
|
|
11
|
+
export default {
|
|
12
|
+
title: 'components/Snackbar',
|
|
13
|
+
};
|
|
14
|
+
|
|
12
15
|
const Example = () => {
|
|
13
16
|
return (
|
|
14
17
|
<>
|
|
@@ -90,8 +93,6 @@ const SnackbarStackExample = () => {
|
|
|
90
93
|
);
|
|
91
94
|
};
|
|
92
95
|
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
stories.add('controlled', () => <ControlledExample />);
|
|
97
|
-
stories.add('snackbar stack', () => <SnackbarStackExample />);
|
|
96
|
+
export const Default = () => <Example />;
|
|
97
|
+
export const Controlled = () => <ControlledExample />;
|
|
98
|
+
export const SnackbarStack = () => <SnackbarStackExample />;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Switch } from './';
|
|
2
2
|
import { Box } from '../';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'components/Switch',
|
|
6
|
+
};
|
|
4
7
|
|
|
5
8
|
const Example = () => {
|
|
6
9
|
return (
|
|
@@ -21,6 +24,4 @@ const Example = () => {
|
|
|
21
24
|
);
|
|
22
25
|
};
|
|
23
26
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
stories.add('controlled', () => <Example />);
|
|
27
|
+
export const Default = () => <Example />;
|
package/src/Tab/Tab.story.tsx
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Tabs, TabList, Tab, TabPanels, TabPanel } from './';
|
|
2
2
|
import { AppBar } from '../AppBar';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
// import './styles.css';
|
|
5
5
|
|
|
6
|
+
export default {
|
|
7
|
+
title: 'components/Tab',
|
|
8
|
+
};
|
|
9
|
+
|
|
6
10
|
const Example = () => {
|
|
7
11
|
return (
|
|
8
12
|
<Tabs defaultIndex={0}>
|
|
@@ -45,7 +49,5 @@ const ExampleAppBar = () => {
|
|
|
45
49
|
);
|
|
46
50
|
};
|
|
47
51
|
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
stories.add('controlled', () => <Example />);
|
|
51
|
-
stories.add('with app bar', () => <ExampleAppBar />);
|
|
52
|
+
export const Controlled = () => <Example />;
|
|
53
|
+
export const WithAppBar = () => <ExampleAppBar />;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Table, TableRow, TableBody, TableHead, TableCell } from './';
|
|
2
2
|
import { Link } from '../Link';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'components/Table',
|
|
6
|
+
};
|
|
4
7
|
|
|
5
8
|
const data = {
|
|
6
9
|
items: [
|
|
@@ -221,6 +224,4 @@ const GitHubTable = () => {
|
|
|
221
224
|
);
|
|
222
225
|
};
|
|
223
226
|
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
stories.add('github table', () => <GitHubTable />);
|
|
227
|
+
export const Example = () => <GitHubTable />;
|
package/src/Text/Text.story.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Text } from './';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
2
|
import { Box } from '../Box';
|
|
4
3
|
// import './styles.css';
|
|
5
4
|
|
|
5
|
+
export default {
|
|
6
|
+
title: 'components/Text',
|
|
7
|
+
};
|
|
8
|
+
|
|
6
9
|
const Example = () => {
|
|
7
10
|
const variantMapping = {
|
|
8
11
|
h1: 'Heading 1',
|
|
@@ -34,6 +37,4 @@ const Example = () => {
|
|
|
34
37
|
);
|
|
35
38
|
};
|
|
36
39
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
stories.add('all variants', () => <Example />);
|
|
40
|
+
export const AllVariants = () => <Example />;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { TextField } from './';
|
|
3
|
-
import { storiesOf } from '@storybook/react';
|
|
4
2
|
import { Box } from '../Box';
|
|
5
3
|
import { CheckBox } from '../CheckBox';
|
|
6
4
|
import { Select, SelectItem } from '../';
|
|
7
5
|
import { Button } from '../Button';
|
|
8
6
|
import { alpha } from '../color';
|
|
7
|
+
import { TextField } from './';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'components/TextField',
|
|
11
|
+
};
|
|
9
12
|
|
|
10
13
|
const Example = ({ variant }) => {
|
|
11
14
|
const [error, setError] = useState<boolean | string>(false);
|
|
@@ -220,7 +223,5 @@ const Example = ({ variant }) => {
|
|
|
220
223
|
);
|
|
221
224
|
};
|
|
222
225
|
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
stories.add('filled', () => <Example variant="filled" />);
|
|
226
|
-
stories.add('outlined', () => <Example variant="outlined" />);
|
|
226
|
+
export const Filled = () => <Example variant="filled" />;
|
|
227
|
+
export const Outlined = () => <Example variant="outlined" />;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Tooltip } from './';
|
|
3
3
|
import { Button } from '../Button';
|
|
4
|
-
import { storiesOf } from '@storybook/react';
|
|
5
4
|
// import './styles.css';
|
|
6
5
|
|
|
6
|
+
export default {
|
|
7
|
+
title: 'components/Tooltip',
|
|
8
|
+
};
|
|
9
|
+
|
|
7
10
|
const Example = () => {
|
|
8
11
|
const buttonRef = useRef();
|
|
9
12
|
const [counter, setCounter] = useState(0);
|
|
@@ -28,6 +31,4 @@ const Example = () => {
|
|
|
28
31
|
);
|
|
29
32
|
};
|
|
30
33
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
stories.add('controlled', () => <Example />);
|
|
34
|
+
export const Default = () => <Example />;
|