@automattic/vip-design-system 0.27.12 → 0.28.1

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 (42) hide show
  1. package/build/system/Dialog/DialogButton.js +1 -1
  2. package/build/system/Form/InlineSelect.js +3 -3
  3. package/build/system/Form/Input.js +1 -0
  4. package/build/system/Form/Input.styles.js +2 -2
  5. package/build/system/Form/Label.js +1 -1
  6. package/build/system/Form/SearchSelect.js +4 -4
  7. package/build/system/Notice/Notice.js +1 -0
  8. package/build/system/Notice/Notice.stories.js +16 -11
  9. package/build/system/Tabs/Tabs.js +40 -23
  10. package/build/system/Tabs/Tabs.stories.js +101 -10
  11. package/build/system/Tabs/TabsContent.js +50 -0
  12. package/build/system/Tabs/TabsList.js +49 -0
  13. package/build/system/Tabs/TabsTrigger.js +86 -0
  14. package/build/system/Tabs/index.js +10 -2
  15. package/build/system/index.js +5 -10
  16. package/build/system/theme/generated/valet-theme.json +26 -8
  17. package/build/system/theme/index.js +2 -5
  18. package/package.json +1 -1
  19. package/src/system/Dialog/DialogButton.js +1 -1
  20. package/src/system/Form/InlineSelect.js +3 -3
  21. package/src/system/Form/Input.js +1 -0
  22. package/src/system/Form/Input.styles.js +2 -2
  23. package/src/system/Form/Label.js +1 -1
  24. package/src/system/Form/SearchSelect.js +4 -4
  25. package/src/system/Notice/Notice.js +3 -1
  26. package/src/system/Notice/Notice.stories.jsx +8 -3
  27. package/src/system/Tabs/Tabs.js +34 -20
  28. package/src/system/Tabs/Tabs.stories.jsx +56 -6
  29. package/src/system/{NewTabs → Tabs}/TabsContent.js +0 -0
  30. package/src/system/{NewTabs → Tabs}/TabsList.js +0 -0
  31. package/src/system/{NewTabs → Tabs}/TabsTrigger.js +0 -0
  32. package/src/system/Tabs/index.js +4 -2
  33. package/src/system/index.js +4 -7
  34. package/src/system/theme/generated/valet-theme.json +26 -8
  35. package/src/system/theme/index.js +1 -3
  36. package/tokens/valet-core/$themes.json +15 -89
  37. package/tokens/valet-core/wpvip-expressive-type.json +8 -8
  38. package/tokens/valet-core/wpvip-productive-color.json +26 -8
  39. package/src/system/NewTabs/Tabs.js +0 -53
  40. package/src/system/NewTabs/Tabs.stories.jsx +0 -67
  41. package/src/system/NewTabs/index.js +0 -9
  42. package/src/system/Tabs/TabItem.js +0 -54
@@ -38,6 +38,23 @@
38
38
  "value": "#ffffff",
39
39
  "type": "color"
40
40
  },
41
+ "label": {
42
+ "default": {
43
+ "value": "#13191e",
44
+ "type": "color"
45
+ }
46
+ },
47
+ "text": {
48
+ "default": {
49
+ "value": "#13191e",
50
+ "type": "color"
51
+ },
52
+ "placeholder": {
53
+ "type": "color",
54
+ "value": "#767372",
55
+ "description": "Use for placeholder text in fields"
56
+ }
57
+ },
41
58
  "border": {
42
59
  "default": {
43
60
  "value": "#8f8c8b",
@@ -179,18 +196,19 @@
179
196
  "description": "Use for helper text",
180
197
  "value": "#6a6766"
181
198
  },
182
- "placeholder": {
183
- "type": "color",
184
- "value": "#767372",
185
- "description": "Use for placeholder text in fields"
186
- },
187
199
  "disabled": {
188
200
  "type": "color",
189
201
  "value": "#9b9796"
190
202
  },
191
203
  "inverse": {
192
204
  "type": "color",
193
- "value": "#fbfbfb"
205
+ "value": "#fbfbfb",
206
+ "description": "Use for primary text on an inverse layer"
207
+ },
208
+ "inverse-secondary": {
209
+ "value": "#b3afae",
210
+ "type": "color",
211
+ "description": "Use for secondary text on an inverse layer."
194
212
  },
195
213
  "accent": {
196
214
  "type": "color",
@@ -625,8 +643,8 @@
625
643
  "info": {
626
644
  "default": {
627
645
  "type": "color",
628
- "description": "Use for text links",
629
- "value": "#007586"
646
+ "value": "#006979",
647
+ "description": "Use for text links"
630
648
  },
631
649
  "hover": {
632
650
  "type": "color",
@@ -109,10 +109,7 @@ var _default = {
109
109
  // icon
110
110
  icon: (0, _extends2["default"])({}, _getColor.ValetTheme.icon),
111
111
  // Form Controls
112
- input: (0, _extends2["default"])({}, _getColor.ValetTheme.input, {
113
- text: (0, _getColor.getColor)('text', 'secondary'),
114
- placeholder: (0, _getColor.getColor)('text', 'secondary')
115
- }),
112
+ input: (0, _extends2["default"])({}, _getColor.ValetTheme.input),
116
113
  optionRow: {
117
114
  hover: 'rgba(0,0,0,.02)',
118
115
  border: (0, _getColor.getColor)('border', '2'),
@@ -145,7 +142,7 @@ var _default = {
145
142
  },
146
143
  hover: 'rgba(0,0,0,.02)',
147
144
  darken: 'rgba(0,0,0,.05)',
148
- placeholder: (0, _getColor.getColor)('text', 'placeholder'),
145
+ placeholder: (0, _getColor.getVariants)('input.text').placeholder,
149
146
  midnight: '#13191E',
150
147
  dialog: _colors.light.gray['0'],
151
148
  backgroundMuted: (0, _getColor.getColor)('layer', '1'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "0.27.12",
3
+ "version": "0.28.1",
4
4
  "main": "build/system/index.js",
5
5
  "scripts": {
6
6
  "build-storybook": "build-storybook",
@@ -38,7 +38,7 @@ const DialogButton = ( { label, variant = 'secondary', value, children, ...props
38
38
  flex: '1 1 auto',
39
39
  whiteSpace: 'nowrap',
40
40
  overflow: 'hidden',
41
- color: 'input.text',
41
+ color: 'input.text.default',
42
42
  textOverflow: 'ellipsis',
43
43
  } }
44
44
  >
@@ -71,10 +71,10 @@ const InlineSelect = ( {
71
71
  sx={ {
72
72
  '.select__control': {
73
73
  background: 'none',
74
- color: 'input.text',
74
+ color: 'input.text.default',
75
75
  },
76
76
  '.select__single-value': {
77
- color: 'input.text',
77
+ color: 'input.text.default',
78
78
  px: 1,
79
79
  },
80
80
  '.react-select__option': {
@@ -90,7 +90,7 @@ const InlineSelect = ( {
90
90
  borderColor: 'input.border',
91
91
  },
92
92
  '.select__placeholder': {
93
- color: 'input.placeholder',
93
+ color: 'input.text.placeholder',
94
94
  },
95
95
  } }
96
96
  { ...props }
@@ -17,6 +17,7 @@ const inputStyles = {
17
17
  unset: 'all',
18
18
  ...baseControlStyle,
19
19
  lineHeight: 'inherit',
20
+ height: '36px',
20
21
  px: 3,
21
22
  py: 2,
22
23
  fontSize: 2,
@@ -4,7 +4,7 @@ export const baseControlBorderStyle = {
4
4
  borderColor: 'input.border.default',
5
5
  };
6
6
 
7
- export const inputBaseText = 'input.text';
7
+ export const inputBaseText = 'input.text.default';
8
8
  export const inputBaseBackground = 'input.background';
9
9
  export const baseControlFocusStyle = {
10
10
  '&:focus': theme => theme.outline,
@@ -26,7 +26,7 @@ export const baseControlStyle = {
26
26
  },
27
27
 
28
28
  '&::placeholder': {
29
- color: 'input.placeholder',
29
+ color: 'input.text.placeholder',
30
30
  opacity: 1,
31
31
  },
32
32
  };
@@ -11,7 +11,7 @@ import PropTypes from 'prop-types';
11
11
  */
12
12
  import { RequiredLabel } from './RequiredLabel';
13
13
 
14
- export const baseLabelColor = 'heading';
14
+ export const baseLabelColor = 'input.label.default';
15
15
  export const baseLabelStyle = {
16
16
  fontWeight: 500,
17
17
  fontSize: 2,
@@ -89,7 +89,7 @@ const SearchSelect = props => (
89
89
  sx={ {
90
90
  '.select__control': {
91
91
  background: 'none',
92
- color: 'input.text',
92
+ color: 'input.text.default',
93
93
  border: '1px solid',
94
94
  borderColor: 'input.border',
95
95
  margin: 0,
@@ -98,10 +98,10 @@ const SearchSelect = props => (
98
98
  fontSize: 2,
99
99
  },
100
100
  '.select__placeholder': {
101
- color: 'input.placeholder',
101
+ color: 'input.text.placeholder',
102
102
  },
103
103
  '.select__single-value': {
104
- color: 'input.text',
104
+ color: 'input.text.default',
105
105
  px: 1,
106
106
  },
107
107
  '.select__menu': {
@@ -109,7 +109,7 @@ const SearchSelect = props => (
109
109
  boxShadow: 'medium',
110
110
  },
111
111
  '.react-select__option': {
112
- color: 'input.text',
112
+ color: 'input.text.default',
113
113
  paddingTop: 1,
114
114
  paddingBottom: 1,
115
115
  paddingLeft: 2,
@@ -14,7 +14,9 @@ import { MdError, MdWarning, MdCheckCircle, MdInfo } from 'react-icons/md';
14
14
  import { Box, Flex, Heading, Card } from '../';
15
15
 
16
16
  const colorSystemVariant = color =>
17
- ( { warning: 'warning', alert: 'error', success: 'success', info: 'info' }[ color ] );
17
+ ( { warning: 'warning', error: 'error', alert: 'error', success: 'success', info: 'info' }[
18
+ color
19
+ ] );
18
20
 
19
21
  const NoticeIcon = ( { color, variant } ) => {
20
22
  let Icon = MdWarning;
@@ -22,7 +22,8 @@ export const Default = () => (
22
22
  title="Your site is ready to launch!"
23
23
  >
24
24
  <Text sx={ { mb: 0 } }>
25
- It looks like you&lsquo;re ready to share your application with the world.
25
+ It looks like you&lsquo;re ready to share your{ ' ' }
26
+ <Link href="https://google.com/">application with the world.</Link>
26
27
  </Text>
27
28
  </Notice>
28
29
 
@@ -31,10 +32,14 @@ export const Default = () => (
31
32
  <Link href="https://google.com/">application with the world.</Link>
32
33
  </Notice>
33
34
 
34
- <Notice sx={ { mb: 4 } } title="This notice has only the title prop passed" />
35
+ <Notice sx={ { mb: 4 } } title="This notice has only the title prop passed">
36
+ It looks like you&lsquo;re ready to share your{ ' ' }
37
+ <Link href="https://google.com/">application with the world.</Link>
38
+ </Notice>
35
39
 
36
40
  <Notice variant="success" sx={ { mb: 4 } } title="You made it!">
37
- <Text sx={ { mb: 0 } }>This notice has a title and children.</Text>
41
+ It looks like you&lsquo;re ready to share your{ ' ' }
42
+ <Link href="https://google.com/">application with the world.</Link>
38
43
  </Notice>
39
44
 
40
45
  <Notice variant="info" sx={ { mb: 4 } } title="Please read this first">
@@ -3,37 +3,51 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import React from 'react';
7
6
  import classNames from 'classnames';
8
7
  import PropTypes from 'prop-types';
8
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
9
+ import React from 'react';
9
10
 
10
11
  /**
11
12
  * Internal dependencies
12
13
  */
13
- import { Flex } from '..';
14
-
15
- const Tabs = React.forwardRef( ( { className = null, sx, ...props }, forwardRef ) => (
16
- <Flex
17
- className={ classNames( 'vip-tabs-component', className ) }
18
- sx={ {
19
- borderBottom: '1px solid',
20
- borderColor: 'border',
21
- listStyleType: 'none',
22
- margin: 0,
23
- padding: 0,
24
- ...sx,
25
- } }
26
- ref={ forwardRef }
27
- { ...props }
28
- />
29
- ) );
30
14
 
31
- Tabs.displayName = 'Tabs';
15
+ const Tabs = React.forwardRef(
16
+ (
17
+ {
18
+ children,
19
+ onValueChange = undefined,
20
+ defaultValue = undefined,
21
+ value = undefined,
22
+ className = null,
23
+ sx = {},
24
+ },
25
+ ref
26
+ ) => {
27
+ return (
28
+ <TabsPrimitive.Root
29
+ ref={ ref }
30
+ value={ value }
31
+ defaultValue={ defaultValue }
32
+ onValueChange={ onValueChange }
33
+ className={ classNames( 'vip-tabs-component', className ) }
34
+ sx={ { ...sx } }
35
+ >
36
+ { children }
37
+ </TabsPrimitive.Root>
38
+ );
39
+ }
40
+ );
32
41
 
33
42
  Tabs.propTypes = {
34
43
  className: PropTypes.any,
35
44
  sx: PropTypes.object,
36
- variant: PropTypes.string,
45
+ defaultValue: PropTypes.node,
46
+ value: PropTypes.node,
47
+ onValueChange: PropTypes.func,
48
+ children: PropTypes.node.isRequired,
37
49
  };
38
50
 
51
+ Tabs.displayName = 'Tabs';
52
+
39
53
  export { Tabs };
@@ -1,17 +1,67 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import React from 'react';
5
+
1
6
  /**
2
7
  * Internal dependencies
3
8
  */
4
- import { Tabs, TabItem } from '..';
9
+ import { Tabs, TabsTrigger, TabsList, TabsContent, Text } from '..';
5
10
 
6
11
  export default {
7
- title: 'Deprecated/Tabs',
12
+ title: 'Tabs',
8
13
  component: Tabs,
9
14
  };
10
15
 
11
16
  export const Default = () => (
12
- <Tabs>
13
- <TabItem active>All (5)</TabItem>
14
- <TabItem>Live (2)</TabItem>
15
- <TabItem>In Development (3)</TabItem>
17
+ <Tabs defaultValue="all">
18
+ <TabsList title="See all the content">
19
+ <TabsTrigger value="all">All (5)</TabsTrigger>
20
+ <TabsTrigger value="live">Live (2)</TabsTrigger>
21
+ <TabsTrigger value="dev">In Development (3)</TabsTrigger>
22
+ <TabsTrigger value="protect" disabled>
23
+ Not accessible
24
+ </TabsTrigger>
25
+ </TabsList>
26
+ <TabsContent value="all">
27
+ <Text>
28
+ All content <a href="https://google.com">https://google.com</a>
29
+ </Text>
30
+ </TabsContent>
31
+ <TabsContent value="live">Live content</TabsContent>
32
+ <TabsContent value="dev">
33
+ <Text>
34
+ In Development content <button type="button">Hey I am a button</button>{ ' ' }
35
+ </Text>
36
+ </TabsContent>
16
37
  </Tabs>
17
38
  );
39
+ export const SetActiveTab = () => {
40
+ const [ activeTab, setActiveTab ] = React.useState( 'all' );
41
+
42
+ return (
43
+ <Tabs value={ activeTab } onValueChange={ val => setActiveTab( val ) }>
44
+ <TabsList title="See all the content">
45
+ <TabsTrigger value="all">All (5)</TabsTrigger>
46
+ <TabsTrigger value="live">Live (2)</TabsTrigger>
47
+ <TabsTrigger value="dev">In Development (3)</TabsTrigger>
48
+ <TabsTrigger value="protect" disabled={ true }>
49
+ Not accessible
50
+ </TabsTrigger>
51
+ </TabsList>
52
+ <TabsContent value="all">
53
+ <Text>
54
+ <button type="button" onClick={ () => setActiveTab( 'live' ) }>
55
+ Switch to live tab
56
+ </button>
57
+ </Text>
58
+ </TabsContent>
59
+ <TabsContent value="live">Live content</TabsContent>
60
+ <TabsContent value="dev">
61
+ <Text>
62
+ In Development content <button type="button">Hey I am a button</button>{ ' ' }
63
+ </Text>
64
+ </TabsContent>
65
+ </Tabs>
66
+ );
67
+ };
File without changes
File without changes
File without changes
@@ -2,6 +2,8 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import { Tabs } from './Tabs';
5
- import { TabItem } from './TabItem';
5
+ import { TabsTrigger } from './TabsTrigger';
6
+ import { TabsList } from './TabsList';
7
+ import { TabsContent } from './TabsContent';
6
8
 
7
- export { Tabs, TabItem };
9
+ export { Tabs, TabsList, TabsTrigger, TabsContent };
@@ -51,11 +51,10 @@ import { Timeline } from './Timeline';
51
51
  import { Notification } from './Notification';
52
52
  import { OptionRow } from './OptionRow';
53
53
  import { Table, TableRow, TableCell } from './Table';
54
- import { TabItem, Tabs } from './Tabs';
55
54
  import { Text } from './Text';
56
55
  import theme from './theme';
57
56
  import { Wizard, WizardStep, WizardStepHorizontal } from './Wizard';
58
- import { NewTabs, TabsList, TabsContent, TabsTrigger } from './NewTabs';
57
+ import { Tabs, TabsList, TabsContent, TabsTrigger } from './Tabs';
59
58
 
60
59
  export {
61
60
  Accordion,
@@ -100,14 +99,12 @@ export {
100
99
  Progress,
101
100
  Text,
102
101
  Tabs,
103
- Toggle,
104
- ToggleRow,
105
- ToggleGroup,
106
- TabItem,
107
- NewTabs,
108
102
  TabsTrigger,
109
103
  TabsContent,
110
104
  TabsList,
105
+ Toggle,
106
+ ToggleRow,
107
+ ToggleGroup,
111
108
  Time,
112
109
  Timeline,
113
110
  Validation,
@@ -38,6 +38,23 @@
38
38
  "value": "#ffffff",
39
39
  "type": "color"
40
40
  },
41
+ "label": {
42
+ "default": {
43
+ "value": "#13191e",
44
+ "type": "color"
45
+ }
46
+ },
47
+ "text": {
48
+ "default": {
49
+ "value": "#13191e",
50
+ "type": "color"
51
+ },
52
+ "placeholder": {
53
+ "type": "color",
54
+ "value": "#767372",
55
+ "description": "Use for placeholder text in fields"
56
+ }
57
+ },
41
58
  "border": {
42
59
  "default": {
43
60
  "value": "#8f8c8b",
@@ -179,18 +196,19 @@
179
196
  "description": "Use for helper text",
180
197
  "value": "#6a6766"
181
198
  },
182
- "placeholder": {
183
- "type": "color",
184
- "value": "#767372",
185
- "description": "Use for placeholder text in fields"
186
- },
187
199
  "disabled": {
188
200
  "type": "color",
189
201
  "value": "#9b9796"
190
202
  },
191
203
  "inverse": {
192
204
  "type": "color",
193
- "value": "#fbfbfb"
205
+ "value": "#fbfbfb",
206
+ "description": "Use for primary text on an inverse layer"
207
+ },
208
+ "inverse-secondary": {
209
+ "value": "#b3afae",
210
+ "type": "color",
211
+ "description": "Use for secondary text on an inverse layer."
194
212
  },
195
213
  "accent": {
196
214
  "type": "color",
@@ -625,8 +643,8 @@
625
643
  "info": {
626
644
  "default": {
627
645
  "type": "color",
628
- "description": "Use for text links",
629
- "value": "#007586"
646
+ "value": "#006979",
647
+ "description": "Use for text links"
630
648
  },
631
649
  "hover": {
632
650
  "type": "color",
@@ -122,8 +122,6 @@ export default {
122
122
  // Form Controls
123
123
  input: {
124
124
  ...ValetTheme.input,
125
- text: getColor( 'text', 'secondary' ),
126
- placeholder: getColor( 'text', 'secondary' ),
127
125
  },
128
126
 
129
127
  optionRow: {
@@ -160,7 +158,7 @@ export default {
160
158
  },
161
159
  hover: 'rgba(0,0,0,.02)',
162
160
  darken: 'rgba(0,0,0,.05)',
163
- placeholder: getColor( 'text', 'placeholder' ),
161
+ placeholder: getVariants( 'input.text' ).placeholder,
164
162
  midnight: '#13191E',
165
163
  dialog: light.gray[ '0' ],
166
164
  backgroundMuted: getColor( 'layer', '1' ),