@automattic/vip-design-system 0.28.1 → 0.28.2

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 (41) hide show
  1. package/.storybook/decorators/withColorMode.jsx +15 -2
  2. package/README.md +3 -3
  3. package/build/system/Accordion/Accordion.js +21 -30
  4. package/build/system/Badge/Badge.stories.js +1 -1
  5. package/build/system/Dropdown/Dropdown.stories.js +9 -5
  6. package/build/system/Form/Radio.stories.js +1 -1
  7. package/build/system/NewForm/FormAutocomplete.js +12 -2
  8. package/build/system/NewForm/FormAutocomplete.stories.js +14 -2
  9. package/build/system/NewForm/FormSelect.stories.js +3 -1
  10. package/build/system/Notice/Notice.stories.js +13 -23
  11. package/build/system/Table/Table.stories.js +0 -3
  12. package/build/system/Tabs/Tabs.stories.js +3 -3
  13. package/build/system/Wizard/WizardStep.js +5 -3
  14. package/build/system/theme/colors.js +7 -170
  15. package/build/system/theme/generated/valet-theme-dark.json +2924 -0
  16. package/{src/system/theme/generated/valet-theme.json → build/system/theme/generated/valet-theme-light.json} +47 -8
  17. package/build/system/theme/getColor.js +53 -50
  18. package/build/system/theme/index.js +114 -147
  19. package/build/system/theme/textStyles.js +51 -0
  20. package/package.json +7 -3
  21. package/src/system/Accordion/Accordion.js +8 -6
  22. package/src/system/Badge/Badge.stories.jsx +2 -2
  23. package/src/system/Dropdown/Dropdown.stories.jsx +12 -10
  24. package/src/system/Form/Radio.stories.jsx +3 -3
  25. package/src/system/NewForm/FormAutocomplete.js +11 -0
  26. package/src/system/NewForm/FormAutocomplete.stories.jsx +13 -0
  27. package/src/system/NewForm/FormSelect.stories.jsx +3 -2
  28. package/src/system/Notice/Notice.stories.jsx +8 -12
  29. package/src/system/Table/Table.stories.jsx +1 -1
  30. package/src/system/Tabs/Tabs.stories.jsx +3 -3
  31. package/src/system/Wizard/WizardStep.js +9 -3
  32. package/src/system/theme/colors.js +5 -171
  33. package/src/system/theme/generated/valet-theme-dark.json +2924 -0
  34. package/src/system/theme/generated/valet-theme-light.json +2918 -0
  35. package/src/system/theme/getColor.js +46 -40
  36. package/src/system/theme/index.js +150 -170
  37. package/src/system/theme/textStyles.js +46 -0
  38. package/tokens/valet-core/$metadata.json +1 -0
  39. package/tokens/valet-core/$themes.json +0 -2
  40. package/tokens/valet-core/wpvip-productive-color-dark.json +946 -0
  41. package/tokens/valet-core/wpvip-productive-color.json +47 -8
@@ -12,6 +12,8 @@ import { DotFilledIcon, CheckIcon, ChevronRightIcon } from '@radix-ui/react-icon
12
12
  import * as Dropdown from '.';
13
13
  import { Button } from '../Button';
14
14
  import * as NewDialog from '../NewDialog';
15
+ import { Link } from '../Link';
16
+ import { Text } from '../Text';
15
17
 
16
18
  export default {
17
19
  title: 'Dropdown',
@@ -29,17 +31,17 @@ export const Default = () => (
29
31
  <Dropdown.Item>Errored</Dropdown.Item>
30
32
  </Dropdown.Root>
31
33
 
32
- <p>
34
+ <Text>
33
35
  This component is based on the Radix Dropdown. You can find all available options, props and
34
36
  features in the{ ' ' }
35
- <a
37
+ <Link
36
38
  href="https://www.radix-ui.com/docs/primitives/components/dropdown-menu"
37
39
  target="_blank"
38
40
  rel="noopener noreferrer"
39
41
  >
40
42
  Dropdown Documentation page.
41
- </a>
42
- </p>
43
+ </Link>
44
+ </Text>
43
45
  </>
44
46
  );
45
47
 
@@ -98,17 +100,17 @@ export const ComplexOptions = () => {
98
100
  </Dropdown.RadioGroup>
99
101
  </Dropdown.Root>
100
102
 
101
- <p>
103
+ <Text>
102
104
  This component is based on the Radix Dropdown. You can find all available options, props and
103
105
  features in the{ ' ' }
104
- <a
106
+ <Link
105
107
  href="https://www.radix-ui.com/docs/primitives/components/dropdown-menu"
106
108
  target="_blank"
107
109
  rel="noopener noreferrer"
108
110
  >
109
111
  Dropdown Documentation page.
110
- </a>
111
- </p>
112
+ </Link>
113
+ </Text>
112
114
  </>
113
115
  );
114
116
  };
@@ -134,11 +136,11 @@ export const WithDialog = () => {
134
136
 
135
137
  return (
136
138
  <div>
137
- <p>
139
+ <Text>
138
140
  This is an important example when combining the Dropdown component with the NewDialog
139
141
  component. In order to have the correct accessibility, there are some events you need to
140
142
  use. Use this example if you want to copy and paste the code.
141
- </p>
143
+ </Text>
142
144
 
143
145
  <Dropdown.Root
144
146
  modal={ ! alertOpen }
@@ -8,7 +8,7 @@ import { useState } from 'react';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
- import { Form } from '..';
11
+ import { Form, Link } from '..';
12
12
  import { Radio } from './Radio';
13
13
  import { Flex } from '../Flex';
14
14
  import { Label } from './Label';
@@ -27,9 +27,9 @@ export const Default = () => {
27
27
  <p>
28
28
  Per recommendation, if you have a Radio button, use a Fieldset with a legend as wrapper to
29
29
  your options.{ ' ' }
30
- <a href="https://a11y-collective.github.io/demos/en/accessible-code/form-fieldsets.html">
30
+ <Link href="https://a11y-collective.github.io/demos/en/accessible-code/form-fieldsets.html">
31
31
  Reference to Form fieldsets
32
- </a>
32
+ </Link>
33
33
  </p>
34
34
  <Form.Fieldset>
35
35
  <Form.Legend sx={ { mb: 0, fontSize: 2, fontWeight: 'bold' } }>
@@ -18,6 +18,7 @@ import { Label } from '../Form/Label';
18
18
  import { FormSelectSearch } from './FormSelectSearch';
19
19
  import { FormSelectLoading } from './FormSelectLoading';
20
20
  import { baseControlBorderStyle, inputBaseBackground, inputBaseText } from '../Form/Input.styles';
21
+ import { Validation } from '../Form';
21
22
 
22
23
  const baseBorderTextColors = {
23
24
  ...baseControlBorderStyle,
@@ -115,6 +116,8 @@ const FormAutocomplete = React.forwardRef(
115
116
  showAllValues = true,
116
117
  source,
117
118
  value,
119
+ hasError,
120
+ errorMessage,
118
121
  ...props
119
122
  },
120
123
  forwardRef
@@ -246,6 +249,12 @@ const FormAutocomplete = React.forwardRef(
246
249
  <FormSelectArrow />
247
250
  </FormSelectContent>
248
251
  </div>
252
+
253
+ { hasError && errorMessage && (
254
+ <Validation isValid={ false } describedId={ forLabel }>
255
+ { errorMessage }
256
+ </Validation>
257
+ ) }
249
258
  </div>
250
259
  );
251
260
  }
@@ -273,6 +282,8 @@ FormAutocomplete.propTypes = {
273
282
  showAllValues: PropTypes.bool,
274
283
  source: PropTypes.func,
275
284
  value: PropTypes.string,
285
+ hasError: PropTypes.bool,
286
+ errorMessage: PropTypes.string,
276
287
  };
277
288
 
278
289
  FormAutocomplete.displayName = 'FormAutocomplete';
@@ -134,3 +134,16 @@ export const WithCustomMessages = () => {
134
134
  </>
135
135
  );
136
136
  };
137
+ export const WithErrors = () => {
138
+ const customArgs = {
139
+ ...args,
140
+ hasError: true,
141
+ errorMessage: 'Please select a value',
142
+ };
143
+
144
+ return (
145
+ <>
146
+ <DefaultComponent { ...customArgs } />
147
+ </>
148
+ );
149
+ };
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { useCallback, useState } from 'react';
7
7
  import * as Form from '.';
8
+ import { Link } from '../Link';
8
9
 
9
10
  export default {
10
11
  title: 'Form/Select',
@@ -49,14 +50,14 @@ const DefaultComponent = ( { label = 'Label', width = 250, onChange, ...rest } )
49
50
 
50
51
  <p>
51
52
  This component was heavily inspired by the{ ' ' }
52
- <a
53
+ <Link
53
54
  href="https://designsystem.digital.gov/components/select/"
54
55
  target="_blank"
55
56
  rel="noreferrer"
56
57
  >
57
58
  { ' ' }
58
59
  U.S. Web Design System (USWDS) Select component
59
- </a>
60
+ </Link>
60
61
  .
61
62
  </p>
62
63
  <Form.Root>
@@ -6,7 +6,7 @@
6
6
  * Internal dependencies
7
7
  */
8
8
  import React from 'react';
9
- import { Notice, Text, Link } from '..';
9
+ import { Notice, Link } from '..';
10
10
 
11
11
  export default {
12
12
  title: 'Notice',
@@ -21,10 +21,8 @@ export const Default = () => (
21
21
  sx={ { mb: 4 } }
22
22
  title="Your site is ready to launch!"
23
23
  >
24
- <Text sx={ { mb: 0 } }>
25
- It looks like you&lsquo;re ready to share your{ ' ' }
26
- <Link href="https://google.com/">application with the world.</Link>
27
- </Text>
24
+ It looks like you&lsquo;re ready to share your{ ' ' }
25
+ <Link href="https://google.com/">application with the world.</Link>
28
26
  </Notice>
29
27
 
30
28
  <Notice variant="success" sx={ { mb: 4 } }>
@@ -43,10 +41,8 @@ export const Default = () => (
43
41
  </Notice>
44
42
 
45
43
  <Notice variant="info" sx={ { mb: 4 } } title="Please read this first">
46
- <Text sx={ { mb: 0 } }>
47
- This notice has a title and children and{ ' ' }
48
- <a href="/?path=/story/avatar--default">A link to Avatar</a>
49
- </Text>
44
+ This notice has a title and children and{ ' ' }
45
+ <Link href="/?path=/story/avatar--default">A link to Avatar</Link>
50
46
  </Notice>
51
47
 
52
48
  <Notice
@@ -57,13 +53,13 @@ export const Default = () => (
57
53
  >
58
54
  <ul sx={ { mb: 0 } }>
59
55
  <li>
60
- <a href="#name">Please enter your name.</a>
56
+ <Link href="#name">Please enter your name.</Link>
61
57
  </li>
62
58
  <li>
63
- <a href="#email">Please enter your email address.</a>
59
+ <Link href="#email">Please enter your email address.</Link>
64
60
  </li>
65
61
  <li>
66
- <a href="#terms">Please agree to the terms.</a>
62
+ <Link href="#terms">Please agree to the terms.</Link>
67
63
  </li>
68
64
  </ul>
69
65
  </Notice>
@@ -30,7 +30,7 @@ export const Default = () => (
30
30
  gbc
31
31
  />
32
32
  <TableRow>
33
- <TableCell sx={ { backgroundColor: 'lightgray' } }>
33
+ <TableCell>
34
34
  <Flex sx={ { alignItems: 'center' } } key="user">
35
35
  simon
36
36
  </Flex>
@@ -6,7 +6,7 @@ import React from 'react';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
- import { Tabs, TabsTrigger, TabsList, TabsContent, Text } from '..';
9
+ import { Tabs, TabsTrigger, TabsList, TabsContent, Text, Link, Button } from '..';
10
10
 
11
11
  export default {
12
12
  title: 'Tabs',
@@ -25,13 +25,13 @@ export const Default = () => (
25
25
  </TabsList>
26
26
  <TabsContent value="all">
27
27
  <Text>
28
- All content <a href="https://google.com">https://google.com</a>
28
+ All content <Link href="https://google.com">https://google.com</Link>
29
29
  </Text>
30
30
  </TabsContent>
31
31
  <TabsContent value="live">Live content</TabsContent>
32
32
  <TabsContent value="dev">
33
33
  <Text>
34
- In Development content <button type="button">Hey I am a button</button>{ ' ' }
34
+ In Development content <Button variant="secondary">Hey I am a button</Button>{ ' ' }
35
35
  </Text>
36
36
  </TabsContent>
37
37
  </Tabs>
@@ -25,7 +25,7 @@ const WizardStep = React.forwardRef(
25
25
  borderLeftColor = 'primary';
26
26
  }
27
27
 
28
- let color = 'secondary';
28
+ let color = 'text';
29
29
 
30
30
  if ( complete ) {
31
31
  color = 'success';
@@ -68,12 +68,18 @@ const WizardStep = React.forwardRef(
68
68
  fontWeight: active ? 'bold' : 'normal',
69
69
  } }
70
70
  >
71
- <MdCheckCircle aria-hidden="true" sx={ { mr: 2 } } />
71
+ <MdCheckCircle
72
+ aria-hidden="true"
73
+ sx={ { mr: 2, color: active ? 'icon.primary' : 'icon.disabled' } }
74
+ />
72
75
  { title }
73
76
  </Heading>
74
77
  ) : (
75
78
  <Flex sx={ { alignItems: 'center', color } }>
76
- <MdCheckCircle aria-hidden="true" sx={ { mr: 2 } } />
79
+ <MdCheckCircle
80
+ aria-hidden="true"
81
+ sx={ { mr: 2, color: active ? 'icon.primary' : 'icon.disabled' } }
82
+ />
77
83
  { title }
78
84
  </Flex>
79
85
  ) }
@@ -4,174 +4,8 @@
4
4
  * External dependencies
5
5
  */
6
6
 
7
- /**
8
- * Internal dependencies
9
- */
10
-
11
- import { ValetTheme } from './getColor';
12
-
13
- export const light = {
14
- ...ValetTheme.color,
15
- brand: ValetTheme.color.gold,
16
- grey: ValetTheme.color.gray,
17
- };
18
-
19
- export const dark = {
20
- black: 'rgba(19, 25, 30, 1)',
21
- brand: {
22
- 0: '#1A160F',
23
- 3: '#231809',
24
- 7: '#301F08',
25
- 10: '#301F08',
26
- 20: '#3A2406',
27
- 30: '#432804',
28
- 40: '#502E01',
29
- 50: '#603700',
30
- 60: '#774400',
31
- 70: '#B96B03',
32
- 80: '#C37A19',
33
- 90: '#CA8529',
34
- 100: '#FAF2E7',
35
- },
36
- grey: {
37
- 0: '#161615',
38
- 5: '#1C1C1B',
39
- 10: '#242221',
40
- 20: '#282827',
41
- 30: '#2F2D2C',
42
- 40: '#353431',
43
- 50: '#3F3D3B',
44
- 60: '#524F4C',
45
- 70: '#726F6A',
46
- 80: '#807D78',
47
- 90: '#A29F9B',
48
- 100: '#EDEDEC',
49
- },
50
- blue: {
51
- 0: '#0B1A1C',
52
- 5: '#062124',
53
- 10: '#032D31',
54
- 20: '#00353B',
55
- 30: '#003C42',
56
- 40: '#00444C',
57
- 50: '#005059',
58
- 60: '#00636E',
59
- 70: '#009FB1',
60
- 80: '#09BDD2',
61
- 90: '#2AC5D7',
62
- 100: '#E6F9FB',
63
- },
64
- green: {
65
- 0: '#0D1913',
66
- 5: '#0C1F16',
67
- 10: '#0F291D',
68
- 20: '#113122',
69
- 30: '#133927',
70
- 40: '#16442E',
71
- 50: '#1B5439',
72
- 60: '#236E4A',
73
- 70: '#30A46C',
74
- 80: '#3CB179',
75
- 90: '#4CC389',
76
- 100: '#E4FAF0',
77
- },
78
- pink: {
79
- 0: 'rgba(255, 248, 246, 1)',
80
- 5: 'rgba(255, 232, 230, 1)',
81
- 10: 'rgba(255, 214, 210, 1)',
82
- 15: 'rgba(255, 197, 193, 1)',
83
- 20: 'rgba(251, 183, 180, 1)',
84
- 25: 'rgba(239, 171, 168, 1)',
85
- 30: 'rgba(226, 158, 157, 1)',
86
- 35: 'rgba(212, 146, 148, 1)',
87
- 40: 'rgba(202, 133, 136, 1)',
88
- 45: 'rgba(188, 122, 126, 1)',
89
- 50: 'rgba(176, 109, 116, 1)',
90
- 55: 'rgba(163, 95, 106, 1)',
91
- 60: 'rgba(149, 83, 93, 1)',
92
- 65: 'rgba(137, 71, 85, 1)',
93
- 70: 'rgba(124, 57, 74, 1)',
94
- 75: 'rgba(109, 41, 62, 1)',
95
- 80: 'rgba(95, 30, 52, 1)',
96
- 85: 'rgba(83, 14, 43, 1)',
97
- 90: 'rgba(69, 0, 31, 1)',
98
- 95: 'rgba(53, 0, 18, 1)',
99
- 100: 'rgba(46, 0, 3, 1)',
100
- },
101
- salmon: {
102
- 0: 'rgba(254, 248, 248, 1)',
103
- 5: 'rgba(254, 233, 228, 1)',
104
- 10: 'rgba(254, 214, 206, 1)',
105
- 15: 'rgba(254, 195, 177, 1)',
106
- 20: 'rgba(255, 178, 150, 1)',
107
- 25: 'rgba(255, 163, 120, 1)',
108
- 30: 'rgba(249, 148, 94, 1)',
109
- 35: 'rgba(237, 137, 85, 1)',
110
- 40: 'rgba(224, 123, 77, 1)',
111
- 45: 'rgba(210, 113, 70, 1)',
112
- 50: 'rgba(197, 101, 63, 1)',
113
- 55: 'rgba(181, 86, 56, 1)',
114
- 60: 'rgba(167, 73, 48, 1)',
115
- 65: 'rgba(153, 60, 43, 1)',
116
- 70: 'rgba(137, 47, 38, 1)',
117
- 75: 'rgba(124, 30, 30, 1)',
118
- 80: 'rgba(108, 15, 23, 1)',
119
- 85: 'rgba(94, 0, 16, 1)',
120
- 90: 'rgba(78, 0, 0, 1)',
121
- 95: 'rgba(62, 0, 1, 1)',
122
- 100: 'rgba(52, 0, 2, 1)',
123
- },
124
- orange: {
125
- 0: 'rgba(255, 249, 241, 1)',
126
- 5: 'rgba(255, 233, 219, 1)',
127
- 10: 'rgba(255, 215, 189, 1)',
128
- 15: 'rgba(255, 195, 159, 1)',
129
- 20: 'rgba(255, 178, 126, 1)',
130
- 25: 'rgba(254, 159, 95, 1)',
131
- 30: 'rgba(255, 139, 64, 1)',
132
- 35: 'rgba(255, 123, 40, 1)',
133
- 40: 'rgba(244, 110, 21, 1)',
134
- 45: 'rgba(231, 98, 5, 1)',
135
- 50: 'rgba(215, 80, 1, 1)',
136
- 55: 'rgba(197, 73, 0, 1)',
137
- 60: 'rgba(180, 60, 0, 1)',
138
- 65: 'rgba(165, 49, 0, 1)',
139
- 70: 'rgba(148, 38, 1, 1)',
140
- 75: 'rgba(129, 23, 1, 1)',
141
- 80: 'rgba(111, 8, 1, 1)',
142
- 85: 'rgba(95, 0, 0, 1)',
143
- 90: 'rgba(78, 0, 0, 1)',
144
- 95: 'rgba(60, 0, 0, 1)',
145
- 100: 'rgba(50, 0, 3, 1)',
146
- },
147
- yellow: {
148
- 0: '#1F1300',
149
- 5: '#261700',
150
- 10: '#301E00',
151
- 20: '#3B2400',
152
- 30: '#462B00',
153
- 40: '#553400',
154
- 50: '#674003',
155
- 60: '#804F00',
156
- 70: '#FFB031',
157
- 80: '#FFC568',
158
- 90: '#F69E12',
159
- 100: '#FFF2DE',
160
- },
161
- red: {
162
- 0: '#1E1313',
163
- 5: '#2B1311',
164
- 10: '#3C1714',
165
- 20: '#491915',
166
- 30: '#561B17',
167
- 40: '#681E19',
168
- 50: '#832019',
169
- 60: '#AC241A',
170
- 70: '#F04539',
171
- 80: '#F6574B',
172
- 90: '#FA6459',
173
- 100: '#FFEEED',
174
- },
175
- };
176
-
177
- export default light;
7
+ export default theme => ( {
8
+ ...theme.color,
9
+ brand: theme.color.gold,
10
+ grey: theme.color.gray,
11
+ } );