@automattic/vip-design-system 0.9.1 → 0.9.4
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/system/Avatar/Avatar.test.js +41 -22
- package/build/system/Badge/Badge.test.js +73 -0
- package/build/system/BlankState/BlankState.js +12 -9
- package/build/system/BlankState/BlankState.test.js +124 -0
- package/build/system/Button/Button.test.js +44 -0
- package/build/system/Card/Card.test.js +78 -0
- package/build/system/Code/Code.js +11 -8
- package/build/system/Code/Code.test.js +167 -0
- package/build/system/Dialog/DialogContent.js +3 -1
- package/build/system/Form/Input.js +2 -2
- package/build/system/Form/Select.js +29 -12
- package/build/system/Timeline/index.js +11 -9
- package/build/system/index.js +4 -0
- package/package.json +15 -4
- package/src/system/Avatar/Avatar.test.js +9 -10
- package/src/system/Badge/Badge.test.js +30 -0
- package/src/system/BlankState/BlankState.js +13 -5
- package/src/system/BlankState/BlankState.test.js +58 -0
- package/src/system/Button/Button.test.js +21 -0
- package/src/system/Card/Card.test.js +33 -0
- package/src/system/Code/Code.js +12 -9
- package/src/system/Code/Code.stories.js +2 -0
- package/src/system/Code/Code.test.js +69 -0
- package/src/system/Dialog/DialogContent.js +2 -0
- package/src/system/Form/Input.js +2 -2
- package/src/system/Form/Select.js +16 -6
- package/src/system/Form/Select.stories.js +52 -24
- package/src/system/Timeline/index.js +46 -0
- package/src/system/index.js +2 -0
|
@@ -6,15 +6,7 @@ import { useState } from 'react';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
Box,
|
|
11
|
-
Dialog,
|
|
12
|
-
DialogMenu,
|
|
13
|
-
DialogMenuItem,
|
|
14
|
-
DialogDivider,
|
|
15
|
-
Select,
|
|
16
|
-
Button,
|
|
17
|
-
} from '..';
|
|
9
|
+
import { Box, Dialog, DialogMenu, DialogMenuItem, DialogDivider, Select, Button } from '..';
|
|
18
10
|
|
|
19
11
|
export default {
|
|
20
12
|
title: 'Select',
|
|
@@ -44,43 +36,79 @@ const DropdownContent = (
|
|
|
44
36
|
const DropdownTrigger = <Button variant="secondary">Trigger Dropdown</Button>;
|
|
45
37
|
|
|
46
38
|
export const Multi = () => {
|
|
47
|
-
const [ value, setValue ] = useState( [
|
|
39
|
+
const [ value, setValue ] = useState( [] );
|
|
48
40
|
|
|
49
41
|
return (
|
|
50
|
-
<Box sx={
|
|
51
|
-
<Select
|
|
42
|
+
<Box sx={{ mr: 2, width: 400 }}>
|
|
43
|
+
<Select
|
|
44
|
+
label="Type"
|
|
45
|
+
value={value}
|
|
46
|
+
isMulti
|
|
47
|
+
placeholder="Select domains..."
|
|
48
|
+
options={options}
|
|
49
|
+
onChange={newValue => setValue( newValue )}
|
|
50
|
+
/>
|
|
51
|
+
</Box>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const usePortal = () => {
|
|
56
|
+
const [ value, setValue ] = useState( [] );
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Box sx={{ mr: 2, width: 400 }}>
|
|
60
|
+
<Select
|
|
61
|
+
label="Type"
|
|
62
|
+
value={value}
|
|
63
|
+
isMulti
|
|
64
|
+
placeholder="Select domains..."
|
|
65
|
+
usePortal
|
|
66
|
+
options={options}
|
|
67
|
+
onChange={newValue => setValue( newValue )}
|
|
68
|
+
/>
|
|
52
69
|
</Box>
|
|
53
70
|
);
|
|
54
71
|
};
|
|
55
72
|
|
|
56
73
|
export const Single = () => {
|
|
57
|
-
const [ value, setValue ] = useState( [
|
|
74
|
+
const [ value, setValue ] = useState( [] );
|
|
58
75
|
|
|
59
76
|
return (
|
|
60
|
-
<Box sx={
|
|
61
|
-
<Select
|
|
77
|
+
<Box sx={{ mr: 2, width: 200 }}>
|
|
78
|
+
<Select
|
|
79
|
+
label="User"
|
|
80
|
+
value={value}
|
|
81
|
+
placeholder="Select a domain..."
|
|
82
|
+
options={options}
|
|
83
|
+
onChange={newValue => setValue( newValue )}
|
|
84
|
+
/>
|
|
62
85
|
</Box>
|
|
63
86
|
);
|
|
64
87
|
};
|
|
65
88
|
|
|
66
89
|
export const Inline = () => {
|
|
67
|
-
const [ value, setValue ] = useState( [
|
|
90
|
+
const [ value, setValue ] = useState( [] );
|
|
68
91
|
|
|
69
92
|
return (
|
|
70
|
-
<Box sx={
|
|
71
|
-
<Select
|
|
93
|
+
<Box sx={{ mr: 2, width: 200 }}>
|
|
94
|
+
<Select
|
|
95
|
+
label="User"
|
|
96
|
+
value={value}
|
|
97
|
+
isInline
|
|
98
|
+
isMulti
|
|
99
|
+
noneLabel="Everyone"
|
|
100
|
+
placeholder="Filter by user..."
|
|
101
|
+
options={options}
|
|
102
|
+
onChange={newValue => setValue( newValue )}
|
|
103
|
+
/>
|
|
72
104
|
</Box>
|
|
73
105
|
);
|
|
74
106
|
};
|
|
75
107
|
|
|
76
108
|
export const DropdownMenu = () => {
|
|
77
109
|
return (
|
|
78
|
-
<Box sx={
|
|
79
|
-
<Dialog
|
|
80
|
-
trigger={DropdownTrigger}
|
|
81
|
-
content={DropdownContent}
|
|
82
|
-
sx={{ width: 200 }}
|
|
83
|
-
/>
|
|
110
|
+
<Box sx={{ mr: 2, width: 200 }}>
|
|
111
|
+
<Dialog trigger={DropdownTrigger} content={DropdownContent} sx={{ width: 200 }} />
|
|
84
112
|
</Box>
|
|
85
113
|
);
|
|
86
114
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { Flex } from 'theme-ui';
|
|
7
|
+
import { MdWatchLater } from 'react-icons/md';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
|
|
10
|
+
const VerticalLine = () => {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
sx={ {
|
|
14
|
+
borderLeft: '2px solid',
|
|
15
|
+
borderColor: 'border',
|
|
16
|
+
height: 'calc( 50% - 16px )',
|
|
17
|
+
borderRadius: '2px',
|
|
18
|
+
} }>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Timeline = ( { time, first = false, last = false, ...props } ) => (
|
|
24
|
+
<Flex { ...props }>
|
|
25
|
+
<Flex sx={ { flexDirection: 'column', justifyContent: 'space-evenly', alignItems: 'center' } }>
|
|
26
|
+
{ ! first && (
|
|
27
|
+
<VerticalLine />
|
|
28
|
+
) }
|
|
29
|
+
<MdWatchLater sx={ { color: 'border' } } size={ 18 }/>
|
|
30
|
+
{ ! last && (
|
|
31
|
+
<VerticalLine />
|
|
32
|
+
) }
|
|
33
|
+
</Flex>
|
|
34
|
+
<Flex sx={ { alignItems: 'center', ml: 2 } }>
|
|
35
|
+
<span>{ time }</span>
|
|
36
|
+
</Flex>
|
|
37
|
+
</Flex>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
Timeline.propTypes = {
|
|
41
|
+
first: PropTypes.bool,
|
|
42
|
+
time: PropTypes.string,
|
|
43
|
+
last: PropTypes.bool,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { Timeline };
|
package/src/system/index.js
CHANGED
|
@@ -41,6 +41,7 @@ import { Spinner } from './Spinner';
|
|
|
41
41
|
import { ResourceList, ResourceItem } from './ResourceList';
|
|
42
42
|
import { Tooltip } from './Tooltip';
|
|
43
43
|
import { Time } from './Time';
|
|
44
|
+
import { Timeline } from './Timeline';
|
|
44
45
|
import { Notification } from './Notification';
|
|
45
46
|
import { OptionRow } from './OptionRow';
|
|
46
47
|
import { Table, TableRow } from './Table';
|
|
@@ -93,6 +94,7 @@ export {
|
|
|
93
94
|
ToggleGroup,
|
|
94
95
|
TabItem,
|
|
95
96
|
Time,
|
|
97
|
+
Timeline,
|
|
96
98
|
Validation,
|
|
97
99
|
Wizard,
|
|
98
100
|
WizardStep,
|