@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.
@@ -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={ { mr: 2, width: 400 } }>
51
- <Select label="Type" value={ value } isMulti placeholder="Select domains..." options={ options } onChange={ newValue => setValue( newValue ) } />
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={ { mr: 2, width: 200 } }>
61
- <Select label="User" value={ value } placeholder="Select a domain..." options={ options } onChange={ newValue => setValue( newValue ) } />
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={ { mr: 2, width: 200 } }>
71
- <Select label="User" value={ value } isInline isMulti noneLabel="Everyone" placeholder="Filter by user..." options={ options } onChange={ newValue => setValue( newValue ) } />
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={ { mr: 2, width: 200 } }>
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 };
@@ -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,