@automattic/vip-design-system 0.28.0 → 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 (71) 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/Dialog/DialogButton.js +1 -1
  6. package/build/system/Dropdown/Dropdown.stories.js +9 -5
  7. package/build/system/Form/InlineSelect.js +3 -3
  8. package/build/system/Form/Input.js +1 -0
  9. package/build/system/Form/Input.styles.js +2 -2
  10. package/build/system/Form/Label.js +1 -1
  11. package/build/system/Form/Radio.stories.js +1 -1
  12. package/build/system/Form/SearchSelect.js +4 -4
  13. package/build/system/NewForm/FormAutocomplete.js +12 -2
  14. package/build/system/NewForm/FormAutocomplete.stories.js +14 -2
  15. package/build/system/NewForm/FormSelect.stories.js +3 -1
  16. package/build/system/Notice/Notice.js +1 -0
  17. package/build/system/Notice/Notice.stories.js +13 -23
  18. package/build/system/ResourceList/ResourceList.js +35 -26
  19. package/build/system/ResourceList/ResourceList.stories.js +2 -0
  20. package/build/system/Table/Table.stories.js +0 -3
  21. package/build/system/Tabs/Tabs.stories.js +3 -3
  22. package/build/system/Wizard/WizardStep.js +5 -3
  23. package/build/system/theme/colors.js +7 -170
  24. package/build/system/theme/generated/valet-theme-dark.json +2924 -0
  25. package/{src/system/theme/generated/valet-theme.json → build/system/theme/generated/valet-theme-light.json} +73 -16
  26. package/build/system/theme/generated/valet-theme.json +26 -8
  27. package/build/system/theme/getColor.js +53 -50
  28. package/build/system/theme/index.js +114 -150
  29. package/build/system/theme/textStyles.js +51 -0
  30. package/package.json +7 -3
  31. package/src/system/Accordion/Accordion.js +8 -6
  32. package/src/system/Badge/Badge.stories.jsx +2 -2
  33. package/src/system/Dialog/DialogButton.js +1 -1
  34. package/src/system/Dropdown/Dropdown.stories.jsx +12 -10
  35. package/src/system/Form/InlineSelect.js +3 -3
  36. package/src/system/Form/Input.js +1 -0
  37. package/src/system/Form/Input.styles.js +2 -2
  38. package/src/system/Form/Label.js +1 -1
  39. package/src/system/Form/Radio.stories.jsx +3 -3
  40. package/src/system/Form/SearchSelect.js +4 -4
  41. package/src/system/NewForm/FormAutocomplete.js +11 -0
  42. package/src/system/NewForm/FormAutocomplete.stories.jsx +13 -0
  43. package/src/system/NewForm/FormSelect.stories.jsx +3 -2
  44. package/src/system/Notice/Notice.js +3 -1
  45. package/src/system/Notice/Notice.stories.jsx +8 -12
  46. package/src/system/Table/Table.stories.jsx +1 -1
  47. package/src/system/Tabs/Tabs.stories.jsx +3 -3
  48. package/src/system/Wizard/WizardStep.js +9 -3
  49. package/src/system/theme/colors.js +5 -171
  50. package/src/system/theme/generated/valet-theme-dark.json +2924 -0
  51. package/src/system/theme/generated/valet-theme-light.json +2918 -0
  52. package/src/system/theme/getColor.js +46 -40
  53. package/src/system/theme/index.js +150 -172
  54. package/src/system/theme/textStyles.js +46 -0
  55. package/tokens/valet-core/$metadata.json +1 -0
  56. package/tokens/valet-core/$themes.json +15 -91
  57. package/tokens/valet-core/wpvip-expressive-type.json +8 -8
  58. package/tokens/valet-core/wpvip-productive-color-dark.json +946 -0
  59. package/tokens/valet-core/wpvip-productive-color.json +73 -16
  60. package/.idea/GitLink.xml +0 -6
  61. package/.idea/codeStyles/Project.xml +0 -69
  62. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  63. package/.idea/dbnavigator.xml +0 -467
  64. package/.idea/git_toolbox_prj.xml +0 -15
  65. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  66. package/.idea/jsLinters/eslint.xml +0 -6
  67. package/.idea/misc.xml +0 -6
  68. package/.idea/modules.xml +0 -8
  69. package/.idea/php.xml +0 -12
  70. package/.idea/vcs.xml +0 -6
  71. package/.idea/vip-design-system.iml +0 -9
@@ -2,46 +2,52 @@
2
2
  * Internal dependencies
3
3
  */
4
4
 
5
- import Valet from './generated/valet-theme.json';
6
-
7
- export const getColor = ( color, variant = 'default' ) => {
8
- if ( ! Valet[ color ] ) {
9
- return '#000000';
10
- }
11
-
12
- return Valet[ color ][ variant ].value;
13
- };
14
-
15
- const resolvePath = ( object, path, defaultValue ) => {
16
- return path.split( '.' ).reduce( ( acc, property ) => {
17
- return acc ? acc[ property ] : defaultValue;
18
- }, object );
19
- };
20
-
21
- export const getVariants = color => {
22
- const property = resolvePath( Valet, color, {} );
23
-
24
- return Object.keys( property ).reduce(
25
- ( variants, variant ) => ( { ...variants, [ variant ]: property[ variant ].value } ),
26
- {}
27
- );
28
- };
29
-
30
- const traverse = root => {
31
- if ( root.hasOwnProperty( 'value' ) && root.hasOwnProperty( 'type' ) ) {
32
- return root.value;
33
- }
34
-
35
- return Object.entries( root ).reduce(
36
- ( acc, [ key, value ] ) => ( {
37
- ...acc,
38
- [ key ]: traverse( value ),
39
- } ),
40
- {}
41
- );
42
- };
43
-
44
5
  // Valet Theme Productive Theme
45
6
  // https://www.figma.com/file/sILtW5Cs2tAnPWrSOEVyER/Productive-Color?node-id=1%3A17&t=4kHdpoprxntk5Ilw-0
46
7
 
47
- export const ValetTheme = traverse( Valet );
8
+ export default theme => {
9
+ const getColor = ( color, variant = 'default' ) => {
10
+ if ( ! theme[ color ] ) {
11
+ return '#000000';
12
+ }
13
+
14
+ return theme[ color ][ variant ].value;
15
+ };
16
+
17
+ const resolvePath = ( object, path, defaultValue ) => {
18
+ return path.split( '.' ).reduce( ( acc, property ) => {
19
+ return acc ? acc[ property ] : defaultValue;
20
+ }, object );
21
+ };
22
+
23
+ const getVariants = color => {
24
+ const property = resolvePath( theme, color, {} );
25
+
26
+ return Object.keys( property ).reduce(
27
+ ( variants, variant ) => ( { ...variants, [ variant ]: property[ variant ].value } ),
28
+ {}
29
+ );
30
+ };
31
+
32
+ const traverse = root => {
33
+ if ( root.hasOwnProperty( 'value' ) && root.hasOwnProperty( 'type' ) ) {
34
+ return root.value;
35
+ }
36
+
37
+ return Object.entries( root ).reduce(
38
+ ( acc, [ key, value ] ) => ( {
39
+ ...acc,
40
+ [ key ]: traverse( value ),
41
+ } ),
42
+ {}
43
+ );
44
+ };
45
+
46
+ return {
47
+ ValetTheme: traverse( theme ),
48
+ getColor,
49
+ getVariants,
50
+ traverse,
51
+ resolvePath,
52
+ };
53
+ };
@@ -1,55 +1,25 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { getColor, getVariants, ValetTheme } from './getColor';
5
- import { light, dark } from './colors';
6
-
7
- const textStyles = {
8
- h1: {
9
- fontSize: 5,
10
- marginBottom: 3,
11
- letterSpacing: '-.02em',
12
- fontWeight: 'body',
13
- fontFamily: 'serif',
14
- color: 'heading',
15
- },
16
- h2: {
17
- fontSize: 4,
18
- marginBottom: 2,
19
- letterSpacing: '-.005em',
20
- fontWeight: 400,
21
- color: 'heading',
22
- },
23
- h3: {
24
- fontSize: 3,
25
- marginBottom: 3,
26
- letterSpacing: '-.005em',
27
- lineHeight: 1.4,
28
- fontWeight: 'heading',
29
- color: 'heading',
30
- },
31
- h4: {
32
- fontSize: 2,
33
- marginBottom: 1,
34
- lineHeight: 1.5,
35
- fontWeight: 'heading',
36
- color: 'heading',
37
- },
38
- h5: {
39
- fontSize: 1,
40
- marginBottom: 1,
41
- lineHeight: 1.5,
42
- fontWeight: 'heading',
43
- color: 'heading',
44
- },
45
- caps: {
46
- fontSize: 1,
47
- marginBottom: 2,
48
- color: 'muted',
49
- fontWeight: 'bold',
50
- letterSpacing: '.05em',
51
- },
52
- };
4
+ import ThemeBuilder from './getColor';
5
+
6
+ import Valet from './generated/valet-theme-light.json';
7
+ import ValetDark from './generated/valet-theme-dark.json';
8
+ import ColorBuilder from './colors';
9
+ import { textStyles } from './textStyles';
10
+
11
+ // Light
12
+ const { getColor, getVariants, ValetTheme } = ThemeBuilder( Valet );
13
+ const light = ColorBuilder( ValetTheme );
14
+
15
+ // Dark
16
+ const {
17
+ getColor: getColorDark,
18
+ getVariants: getVariantsDark,
19
+ ValetTheme: ValetThemeDark,
20
+ } = ThemeBuilder( ValetDark );
21
+
22
+ const dark = ColorBuilder( ValetThemeDark );
53
23
 
54
24
  const outline = {
55
25
  outlineStyle: 'solid',
@@ -65,6 +35,117 @@ const fonts = {
65
35
  serif: 'recoletaregular, Georgia, serif',
66
36
  };
67
37
 
38
+ const getComponentColors = ( theme, gColor, gVariants ) => ( {
39
+ // Valet Theme Colors
40
+
41
+ // This has to be in the plural because we already have a flag: text
42
+ texts: {
43
+ ...theme.text,
44
+ disabled: '#716e6e',
45
+ },
46
+
47
+ button: {
48
+ ...theme.button,
49
+ },
50
+
51
+ tag: {
52
+ ...theme.tag,
53
+ },
54
+
55
+ // Notice
56
+ notice: {
57
+ ...theme.support,
58
+ },
59
+
60
+ // layer
61
+ layer: {
62
+ ...theme.layer,
63
+ },
64
+
65
+ // icon
66
+ icon: {
67
+ ...theme.icon,
68
+ },
69
+
70
+ // Form Controls
71
+ input: {
72
+ ...theme.input,
73
+ },
74
+
75
+ // Accordion
76
+ accordion: {
77
+ content: {
78
+ background: gColor( 'layer', '2' ),
79
+ text: gColor( 'text', 'secondary' ),
80
+ },
81
+ trigger: {
82
+ text: gColor( 'text', 'primary' ),
83
+ },
84
+ background: {
85
+ open: gColor( 'layer', '3' ),
86
+ closed: 'transparent',
87
+ hover: gColor( 'layer', '3' ),
88
+ },
89
+ },
90
+
91
+ optionRow: {
92
+ hover: 'rgba(0,0,0,.02)',
93
+ border: gColor( 'border', '1' ),
94
+ text: gColor( 'text', 'secondary' ),
95
+ textAccent: gColor( 'link', 'default' ),
96
+ icon: gColor( 'icon', 'primary' ),
97
+ iconBackground: gColor( 'layer', 'accent' ),
98
+ },
99
+
100
+ table: {
101
+ border: gColor( 'border', '2' ),
102
+ heading: gColor( 'text', 'primary' ),
103
+ text: gColor( 'text', 'secondary' ),
104
+ },
105
+
106
+ // Common Tokens
107
+ text: gColor( 'text', 'secondary' ),
108
+ heading: gColor( 'text', 'primary' ),
109
+ background: gColor( 'layer', '2' ),
110
+ backgroundSecondary: gColor( 'layer', '1' ),
111
+ primary: gColor( 'link', 'default' ),
112
+ secondary: light.gray[ '70' ],
113
+ muted: gColor( 'text', 'helper' ),
114
+ border: gColor( 'border', '1' ),
115
+ borders: {
116
+ 1: gColor( 'border', '1' ),
117
+ 2: gColor( 'border', '2' ),
118
+ 3: gColor( 'border', '3' ),
119
+ 4: gColor( 'border', '4' ),
120
+ inverse: gColor( 'border', 'inverse' ),
121
+ accent: gColor( 'border', 'accent' ),
122
+ },
123
+ hover: 'rgba(0,0,0,.02)',
124
+ darken: 'rgba(0,0,0,.05)',
125
+ placeholder: gVariants( 'input.text' ).placeholder,
126
+ midnight: '#13191E',
127
+ dialog: light.gray[ '0' ],
128
+ backgroundMuted: gColor( 'layer', '1' ),
129
+
130
+ // Variant colors
131
+ success: theme.support.link.success.default,
132
+ error: theme.support.link.error.default,
133
+ warning: theme.support.link.warning.default,
134
+ info: theme.support.link.info.default,
135
+
136
+ // Card
137
+ card: '#fff',
138
+
139
+ // Link
140
+ link: gColor( 'link', 'default' ),
141
+ links: {
142
+ default: gColor( 'link', 'default' ),
143
+ hover: gColor( 'link', 'hover' ),
144
+ active: gColor( 'link', 'active' ),
145
+ visited: gColor( 'link', 'visited' ),
146
+ },
147
+ } );
148
+
68
149
  export default {
69
150
  outline,
70
151
  space: [ 0, 4, 8, 16, 32, 64, 128, 256, 512 ],
@@ -88,124 +169,29 @@ export default {
88
169
  },
89
170
  initialColorModeName: 'light',
90
171
  colors: {
91
- // Valet Theme Colors
92
-
93
- // This has to be in the plural because we already have a flag: text
94
- texts: {
95
- ...ValetTheme.text,
96
- disabled: '#716e6e',
97
- },
98
-
99
- button: {
100
- ...ValetTheme.button,
101
- },
102
-
103
- tag: {
104
- ...ValetTheme.tag,
105
- },
106
-
107
- // Notice
108
- notice: {
109
- ...ValetTheme.support,
110
- },
111
-
112
- // layer
113
- layer: {
114
- ...ValetTheme.layer,
115
- },
116
-
117
- // icon
118
- icon: {
119
- ...ValetTheme.icon,
120
- },
121
-
122
- // Form Controls
123
- input: {
124
- ...ValetTheme.input,
125
- text: getColor( 'text', 'secondary' ),
126
- placeholder: getColor( 'text', 'secondary' ),
127
- },
128
-
129
- optionRow: {
130
- hover: 'rgba(0,0,0,.02)',
131
- border: getColor( 'border', '2' ),
132
- text: getColor( 'text', 'secondary' ),
133
- textAccent: getColor( 'link', 'default' ),
134
- icon: getColor( 'icon', 'primary' ),
135
- iconBackground: getColor( 'layer', 'accent' ),
136
- },
137
-
138
- table: {
139
- border: getColor( 'border', '2' ),
140
- heading: getColor( 'text', 'primary' ),
141
- text: getColor( 'text', 'secondary' ),
142
- },
143
-
144
- // Common Tokens
145
- text: getColor( 'text', 'secondary' ),
146
- heading: getColor( 'text', 'primary' ),
147
- background: getColor( 'layer', '2' ),
148
- backgroundSecondary: getColor( 'layer', '1' ),
149
- primary: getColor( 'link', 'default' ),
150
- secondary: light.gray[ '70' ],
151
- muted: getColor( 'text', 'helper' ),
152
- border: getColor( 'border', '1' ),
153
- borders: {
154
- 1: getColor( 'border', '1' ),
155
- 2: getColor( 'border', '2' ),
156
- 3: getColor( 'border', '3' ),
157
- 4: getColor( 'border', '4' ),
158
- inverse: getColor( 'border', 'inverse' ),
159
- accent: getColor( 'border', 'accent' ),
160
- },
161
- hover: 'rgba(0,0,0,.02)',
162
- darken: 'rgba(0,0,0,.05)',
163
- placeholder: getColor( 'text', 'placeholder' ),
164
- midnight: '#13191E',
165
- dialog: light.gray[ '0' ],
166
- backgroundMuted: getColor( 'layer', '1' ),
167
-
168
- // Variant colors
169
- success: ValetTheme.support.link.success.default,
170
- error: ValetTheme.support.link.error.default,
171
- warning: ValetTheme.support.link.warning.default,
172
- info: ValetTheme.support.link.info.default,
173
-
174
- // Card
175
- card: '#fff',
176
-
177
- // Link
178
- link: getColor( 'link', 'default' ),
179
- links: {
180
- default: getColor( 'link', 'default' ),
181
- hover: getColor( 'link', 'hover' ),
182
- active: getColor( 'link', 'active' ),
183
- visited: getColor( 'link', 'visited' ),
184
- },
185
-
172
+ ...getComponentColors( ValetTheme, getColor, getVariants ),
186
173
  ...light,
187
-
188
174
  modes: {
189
- // Dark Mode not fully supported yet
190
175
  dark: {
191
- text: dark.grey[ '90' ],
192
- heading: dark.grey[ '100' ],
193
- background: dark.grey[ '5' ],
194
- backgroundSecondary: dark.grey[ '10' ],
195
- primary: light.brand[ '70' ],
196
- secondary: '#30c',
197
- muted: dark.grey[ '90' ],
198
- link: dark.brand[ '90' ],
199
- card: dark.grey[ '20' ],
200
- placeholder: dark.grey[ '70' ],
201
- border: dark.grey[ '30' ],
202
- hover: 'rgba(255,255,255,.02)',
203
- midnight: dark.grey[ '90' ],
204
- success: dark.green[ '90' ],
205
- error: dark.red[ '90' ],
206
- warning: dark.yellow[ '90' ],
207
- dialog: dark.grey[ '40' ],
208
- backgroundMuted: dark.grey[ '10' ],
176
+ ...getComponentColors( ValetThemeDark, getColorDark, getVariantsDark ),
177
+ // text: dark.grey[ '90' ],
178
+ // heading: dark.grey[ '100' ],
179
+ // background: dark.grey[ '5' ],
180
+ // backgroundSecondary: dark.grey[ '10' ],
181
+ // primary: light.brand[ '70' ],
182
+ // secondary: '#30c',
183
+ // muted: dark.grey[ '90' ],
184
+ // link: dark.brand[ '90' ],
185
+ // card: dark.grey[ '20' ],
186
+ // placeholder: dark.grey[ '70' ],
187
+ // border: dark.grey[ '30' ],
188
+ // hover: 'rgba(255,255,255,.02)',
189
+ // midnight: dark.grey[ '90' ],
190
+ // success: dark.green[ '90' ],
191
+ // error: dark.red[ '90' ],
192
+ // warning: dark.yellow[ '90' ],
193
+ // dialog: dark.grey[ '40' ],
194
+ // backgroundMuted: dark.grey[ '10' ],
209
195
  ...dark,
210
196
  },
211
197
  },
@@ -221,14 +207,6 @@ export default {
221
207
  '0px 2.76726px 2.21381px rgba(0, 0, 0, 0.0196802), 0px 6.6501px 5.32008px rgba(0, 0, 0, 0.0282725), 0px 12.5216px 10.0172px rgba(0, 0, 0, 0.035), 0px 22.3363px 17.869px rgba(0, 0, 0, 0.0417275), 0px 41.7776px 33.4221px rgba(0, 0, 0, 0.0503198), 0px 100px 80px rgba(0, 0, 0, 0.07)',
222
208
  },
223
209
 
224
- accordion: {
225
- background: {
226
- open: getVariants( 'color.gold' )[ '7' ],
227
- closed: 'transparent',
228
- hover: getVariants( 'color.gold' )[ '7' ],
229
- },
230
- },
231
-
232
210
  tag: {
233
211
  gold: getVariants( 'tag.gold' ),
234
212
  },
@@ -0,0 +1,46 @@
1
+ export const textStyles = {
2
+ h1: {
3
+ fontSize: 5,
4
+ marginBottom: 3,
5
+ letterSpacing: '-.02em',
6
+ fontWeight: 'body',
7
+ fontFamily: 'serif',
8
+ color: 'heading',
9
+ },
10
+ h2: {
11
+ fontSize: 4,
12
+ marginBottom: 2,
13
+ letterSpacing: '-.005em',
14
+ fontWeight: 400,
15
+ color: 'heading',
16
+ },
17
+ h3: {
18
+ fontSize: 3,
19
+ marginBottom: 3,
20
+ letterSpacing: '-.005em',
21
+ lineHeight: 1.4,
22
+ fontWeight: 'heading',
23
+ color: 'heading',
24
+ },
25
+ h4: {
26
+ fontSize: 2,
27
+ marginBottom: 1,
28
+ lineHeight: 1.5,
29
+ fontWeight: 'heading',
30
+ color: 'heading',
31
+ },
32
+ h5: {
33
+ fontSize: 1,
34
+ marginBottom: 1,
35
+ lineHeight: 1.5,
36
+ fontWeight: 'heading',
37
+ color: 'heading',
38
+ },
39
+ caps: {
40
+ fontSize: 1,
41
+ marginBottom: 2,
42
+ color: 'muted',
43
+ fontWeight: 'bold',
44
+ letterSpacing: '.05em',
45
+ },
46
+ };
@@ -8,6 +8,7 @@
8
8
  "wpvip-expressive-color",
9
9
  "wpvip-expressive-type",
10
10
  "wpvip-productive-color",
11
+ "wpvip-productive-color-dark",
11
12
  "parsely-expressive-core",
12
13
  "parsely-expressive-color",
13
14
  "parsely-expressive-type",