@basic-ui/material 0.1.11 → 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/build/cjs/index.js +33 -28
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Alert/Alert.d.ts +1 -1
- package/build/esm/AppBar/AppBar.d.ts +1 -1
- package/build/esm/AppBar/AppBarButton.d.ts +1 -1
- package/build/esm/Badge/Badge.d.ts +1 -1
- package/build/esm/BottomSheet/BottomSheet.d.ts +1 -1
- package/build/esm/BottomSheet/BottomSheetSurface.d.ts +1 -1
- package/build/esm/Button/BaseButton.d.ts +1 -1
- package/build/esm/Button/Button.d.ts +1 -1
- package/build/esm/Button/FilledButton.d.ts +1 -1
- package/build/esm/Button/FloatingActionButton.d.ts +7 -0
- package/build/esm/Button/FloatingActionButton.js +8 -0
- package/build/esm/Button/FloatingActionButton.js.map +1 -0
- package/build/esm/Button/OutlinedButton.d.ts +1 -1
- package/build/esm/Button/TransparentButton.d.ts +1 -1
- package/build/esm/CheckBox/CheckBox.d.ts +1 -1
- package/build/esm/CheckBox/CheckBoxIcon.d.ts +1 -1
- package/build/esm/Chip/ButtonChip.d.ts +1 -1
- package/build/esm/Chip/ChoiceChip.d.ts +1 -1
- package/build/esm/ColorMode/ColorModeProvider.js +10 -3
- package/build/esm/ColorMode/ColorModeProvider.js.map +1 -1
- package/build/esm/Combobox/Combobox.d.ts +7 -7
- package/build/esm/Dialog/Dialog.d.ts +1 -1
- package/build/esm/Dialog/DialogBackdrop.d.ts +1 -1
- package/build/esm/Dialog/DialogSurface.d.ts +1 -1
- package/build/esm/Dialog/useDialogAnimation.js +1 -1
- package/build/esm/Dialog/useDialogAnimation.js.map +1 -1
- package/build/esm/Divider/Divider.d.ts +1 -1
- package/build/esm/LineRipple/LineRipple.d.ts +1 -1
- package/build/esm/Link/Link.d.ts +1 -1
- package/build/esm/List/List.d.ts +1 -1
- package/build/esm/ListItem/ListItem.d.ts +1 -1
- package/build/esm/Menu/Menu.d.ts +4 -4
- package/build/esm/Paper/Paper.d.ts +1 -1
- package/build/esm/RadioButton/RadioGroup.d.ts +1 -1
- package/build/esm/Ripple/keyframes.js +0 -2
- package/build/esm/Ripple/keyframes.js.map +1 -1
- package/build/esm/Ripple/useRipple.js +1 -1
- package/build/esm/Ripple/useRipple.js.map +1 -1
- package/build/esm/Select/SelectIcon.d.ts +1 -1
- package/build/esm/SelectItem/SelectItem.d.ts +1 -1
- package/build/esm/SelectionControl/SelectionControlLabel.d.ts +1 -1
- package/build/esm/SelectionControl/SelectionControlText.d.ts +1 -1
- package/build/esm/Skeleton/DelayAppearance.d.ts +1 -1
- package/build/esm/Skeleton/Skeleton.d.ts +1 -1
- package/build/esm/Snackbar/Snackbar.d.ts +1 -1
- package/build/esm/Switch/Switch.d.ts +1 -1
- package/build/esm/Tab/Tab.d.ts +1 -1
- package/build/esm/Tab/TabList.d.ts +1 -1
- package/build/esm/Tab/TabPanel.d.ts +1 -1
- package/build/esm/TabIndicator/TabIndicator.d.ts +1 -1
- package/build/esm/Table/Table.d.ts +1 -1
- package/build/esm/Table/TableHead.d.ts +1 -1
- package/build/esm/Table/TableRow.d.ts +1 -1
- package/build/esm/Text/Text.d.ts +1 -1
- package/build/esm/TextField/FilledContainer.d.ts +1 -1
- package/build/esm/TextField/HelperText.d.ts +1 -1
- package/build/esm/TextField/Input.d.ts +1 -1
- package/build/esm/TextField/OutlinedContainer.d.ts +1 -1
- package/build/esm/TextField/TextField.d.ts +1 -1
- package/build/esm/ThemeExplorer/ColorPicker.d.ts +8 -0
- package/build/esm/ThemeExplorer/ColorPicker.js +76 -0
- package/build/esm/ThemeExplorer/ColorPicker.js.map +1 -0
- package/build/esm/ThemeExplorer/TextFieldColorPicker.d.ts +9 -0
- package/build/esm/ThemeExplorer/TextFieldColorPicker.js +100 -0
- package/build/esm/ThemeExplorer/TextFieldColorPicker.js.map +1 -0
- package/build/esm/ThemeExplorer/ThemeColors.d.ts +5 -0
- package/build/esm/ThemeExplorer/ThemeColors.js +80 -0
- package/build/esm/ThemeExplorer/ThemeColors.js.map +1 -0
- package/build/esm/ThemeExplorer/components.d.ts +31 -0
- package/build/esm/ThemeExplorer/components.js +184 -0
- package/build/esm/ThemeExplorer/components.js.map +1 -0
- package/build/esm/ThemeExplorer/makeColorScheme.d.ts +66 -0
- package/build/esm/ThemeExplorer/makeColorScheme.js +66 -0
- package/build/esm/ThemeExplorer/makeColorScheme.js.map +1 -0
- package/build/esm/ThemeExplorer/useDeferredColor.d.ts +3 -0
- package/build/esm/ThemeExplorer/useDeferredColor.js +11 -0
- package/build/esm/ThemeExplorer/useDeferredColor.js.map +1 -0
- package/build/esm/ThemeExplorer/useLocalStorageCachedState.d.ts +1 -0
- package/build/esm/ThemeExplorer/useLocalStorageCachedState.js +11 -0
- package/build/esm/ThemeExplorer/useLocalStorageCachedState.js.map +1 -0
- package/build/esm/Tooltip/Tooltip.d.ts +1 -1
- package/build/esm/hooks/useAnimation.js +22 -21
- package/build/esm/hooks/useAnimation.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +54 -54
- 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/ColorMode/ColorModeProvider.tsx +9 -3
- package/src/Combobox/Combobox.story.tsx +12 -10
- package/src/Dialog/Dialog.story.tsx +7 -8
- package/src/Dialog/useDialogAnimation.tsx +1 -1
- 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/Ripple/keyframes.ts +0 -2
- package/src/Ripple/useRipple.ts +3 -1
- 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/src/hooks/useAnimation.ts +42 -32
|
@@ -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 />);
|
|
@@ -65,14 +65,20 @@ export const ColorModeProvider: React.FC<ColorModeProviderProps> = (props) => {
|
|
|
65
65
|
}, [setColorMode]);
|
|
66
66
|
|
|
67
67
|
const globalStyles = useMemo(() => {
|
|
68
|
-
const ret = {
|
|
69
|
-
|
|
68
|
+
const ret = {
|
|
69
|
+
body: { colorScheme: 'light', ...(styles['default'] || {}) },
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
ret[`.${DEFAULT_THEME_CLASS}`] = {
|
|
73
|
+
colorScheme: 'light',
|
|
74
|
+
...(styles['default'] || {}),
|
|
75
|
+
};
|
|
70
76
|
|
|
71
77
|
for (const key in styles) {
|
|
72
78
|
if (key === 'default') {
|
|
73
79
|
continue;
|
|
74
80
|
}
|
|
75
|
-
ret[`.${DARK_THEME_CLASS}`] = styles[key];
|
|
81
|
+
ret[`.${DARK_THEME_CLASS}`] = { colorScheme: 'dark', ...styles[key] };
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
return ret;
|
|
@@ -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'} />;
|
|
@@ -4,7 +4,7 @@ const styles = {
|
|
|
4
4
|
slide: {
|
|
5
5
|
closed: { opacity: 0.6, transform: 'translateY(100%)' },
|
|
6
6
|
open: { opacity: 1, transform: 'translateY(0%)' },
|
|
7
|
-
close: { opacity: 0, transform: 'translateY(
|
|
7
|
+
close: { opacity: 0, transform: 'translateY(10%)' },
|
|
8
8
|
},
|
|
9
9
|
grow: {
|
|
10
10
|
closed: { opacity: 0.8, transform: 'scale(0.8)' },
|
|
@@ -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 />;
|
package/src/Ripple/keyframes.ts
CHANGED
|
@@ -27,11 +27,9 @@ export const opacityIn: Keyframes = keyframes({
|
|
|
27
27
|
|
|
28
28
|
export const opacityOut: Keyframes = keyframes({
|
|
29
29
|
from: {
|
|
30
|
-
transform: `translate(var(${RIPPLE_TRANSLATE_END}, 0)) scale(var(${RIPPLE_SCALE_END}, 1))`,
|
|
31
30
|
opacity: `var(${RIPPLE_OPACITY_END})`,
|
|
32
31
|
},
|
|
33
32
|
to: {
|
|
34
|
-
transform: `translate(var(${RIPPLE_TRANSLATE_END}, 0)) scale(var(${RIPPLE_SCALE_END}, 1))`,
|
|
35
33
|
opacity: '0',
|
|
36
34
|
},
|
|
37
35
|
});
|
package/src/Ripple/useRipple.ts
CHANGED
|
@@ -175,7 +175,9 @@ export const useRipple = (opts: RippleOptions) => {
|
|
|
175
175
|
`${opacityIn} ${enterDuration / 3}ms forwards`;
|
|
176
176
|
break;
|
|
177
177
|
case 'leaving':
|
|
178
|
-
animation =
|
|
178
|
+
animation =
|
|
179
|
+
`${radiusIn} ${enterDuration}ms forwards,` +
|
|
180
|
+
`${opacityOut} ${leaveDuration}ms forwards`;
|
|
179
181
|
break;
|
|
180
182
|
}
|
|
181
183
|
|
|
@@ -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 />;
|