@automattic/vip-design-system 2.1.0 → 2.3.0

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 (101) hide show
  1. package/.eslintrc.js +3 -0
  2. package/build/system/Accordion/Accordion.test.d.ts +0 -1
  3. package/build/system/Accordion/Accordion.test.js +23 -12
  4. package/build/system/Avatar/Avatar.d.ts +0 -1
  5. package/build/system/Avatar/Avatar.js +9 -17
  6. package/build/system/Avatar/Avatar.stories.d.ts +2 -1
  7. package/build/system/Avatar/Avatar.stories.js +19 -2
  8. package/build/system/Button/Button.d.ts +2 -0
  9. package/build/system/Button/Button.js +6 -15
  10. package/build/system/Button/Button.stories.js +86 -67
  11. package/build/system/Card/Card.js +1 -2
  12. package/build/system/Drawer/Drawer.d.ts +12 -3
  13. package/build/system/Drawer/Drawer.js +8 -9
  14. package/build/system/Drawer/Drawer.stories.d.ts +0 -1
  15. package/build/system/Drawer/Drawer.stories.js +19 -225
  16. package/build/system/Drawer/styles.d.ts +2 -2
  17. package/build/system/Drawer/styles.js +13 -9
  18. package/build/system/Form/Checkbox/Checkbox.js +0 -3
  19. package/build/system/Form/Checkbox/Checkbox.stories.js +2 -2
  20. package/build/system/Form/Checkbox/styles.js +16 -11
  21. package/build/system/Form/Radio/Radio.stories.js +1 -1
  22. package/build/system/Form/Toggle.d.ts +14 -2
  23. package/build/system/Form/Toggle.js +68 -69
  24. package/build/system/Form/Toggle.stories.d.ts +29 -18
  25. package/build/system/Form/Toggle.stories.js +99 -0
  26. package/build/system/Form/Toggle.test.js +36 -19
  27. package/build/system/Link/Link.d.ts +1 -1
  28. package/build/system/Link/Link.js +5 -20
  29. package/build/system/Link/Link.stories.d.ts +3 -1
  30. package/build/system/Link/Link.stories.js +18 -1
  31. package/build/system/MobileMenu/MobileMenu.d.ts +16 -0
  32. package/build/system/MobileMenu/MobileMenu.js +112 -0
  33. package/build/system/MobileMenu/MobileMenu.stories.d.ts +19 -0
  34. package/build/system/MobileMenu/MobileMenu.stories.js +173 -0
  35. package/build/system/MobileMenu/MobileMenu.test.d.ts +1 -0
  36. package/build/system/MobileMenu/MobileMenu.test.js +81 -0
  37. package/build/system/Nav/NavItem.js +4 -5
  38. package/build/system/Nav/NavItemGroup.d.ts +3 -0
  39. package/build/system/Nav/NavItemGroup.js +18 -6
  40. package/build/system/Nav/styles/variants/menu.js +15 -9
  41. package/build/system/Nav/styles/variants/menugroup.js +9 -5
  42. package/build/system/Nav/styles/variants/toolbar.js +1 -2
  43. package/build/system/Nav/styles.js +1 -0
  44. package/build/system/NewDialog/DialogClose.d.ts +7 -2
  45. package/build/system/NewDialog/DialogClose.js +25 -15
  46. package/build/system/NewDialog/index.d.ts +2 -1
  47. package/build/system/NewDialog/index.js +2 -1
  48. package/build/system/NewForm/FormAutocomplete.css +1 -3
  49. package/build/system/Table/Table.js +1 -0
  50. package/build/system/Toolbar/Toolbar.js +1 -1
  51. package/build/system/Toolbar/Toolbar.stories.d.ts +3 -0
  52. package/build/system/Toolbar/Toolbar.stories.js +62 -6
  53. package/build/system/Toolbar/ToolbarUtilNav.d.ts +3 -0
  54. package/build/system/Toolbar/ToolbarUtilNav.js +21 -3
  55. package/build/system/Toolbar/index.d.ts +3 -0
  56. package/build/system/Toolbar/index.js +2 -1
  57. package/build/system/index.d.ts +4 -1
  58. package/build/system/index.js +4 -0
  59. package/build/system/theme/index.d.ts +70 -35
  60. package/build/system/theme/index.js +47 -18
  61. package/package.json +2 -1
  62. package/src/system/Accordion/Accordion.test.tsx +15 -8
  63. package/src/system/Avatar/Avatar.stories.tsx +15 -1
  64. package/src/system/Avatar/Avatar.tsx +8 -12
  65. package/src/system/Button/Button.stories.tsx +40 -31
  66. package/src/system/Button/Button.tsx +6 -15
  67. package/src/system/Card/Card.tsx +0 -1
  68. package/src/system/Drawer/Drawer.stories.tsx +28 -197
  69. package/src/system/Drawer/Drawer.tsx +31 -18
  70. package/src/system/Drawer/styles.ts +15 -5
  71. package/src/system/Form/Checkbox/Checkbox.stories.tsx +2 -2
  72. package/src/system/Form/Checkbox/Checkbox.tsx +0 -3
  73. package/src/system/Form/Checkbox/styles.ts +57 -46
  74. package/src/system/Form/Radio/Radio.stories.tsx +1 -1
  75. package/src/system/Form/Toggle.stories.tsx +122 -0
  76. package/src/system/Form/{Toggle.test.js → Toggle.test.tsx} +1 -1
  77. package/src/system/Form/Toggle.tsx +77 -0
  78. package/src/system/Link/Link.stories.tsx +21 -0
  79. package/src/system/Link/Link.tsx +10 -17
  80. package/src/system/MobileMenu/MobileMenu.stories.tsx +171 -0
  81. package/src/system/MobileMenu/MobileMenu.test.tsx +50 -0
  82. package/src/system/MobileMenu/MobileMenu.tsx +116 -0
  83. package/src/system/Nav/NavItem.tsx +3 -3
  84. package/src/system/Nav/NavItemGroup.tsx +18 -2
  85. package/src/system/Nav/styles/variants/menu.ts +15 -9
  86. package/src/system/Nav/styles/variants/menugroup.ts +7 -3
  87. package/src/system/Nav/styles/variants/toolbar.ts +1 -2
  88. package/src/system/Nav/styles.ts +1 -0
  89. package/src/system/NewDialog/DialogClose.tsx +36 -23
  90. package/src/system/NewDialog/index.ts +3 -2
  91. package/src/system/NewForm/FormAutocomplete.css +1 -3
  92. package/src/system/Table/Table.tsx +1 -1
  93. package/src/system/Toolbar/Toolbar.stories.tsx +50 -3
  94. package/src/system/Toolbar/Toolbar.tsx +1 -1
  95. package/src/system/Toolbar/ToolbarUtilNav.tsx +19 -2
  96. package/src/system/Toolbar/index.tsx +6 -1
  97. package/src/system/index.js +4 -0
  98. package/src/system/theme/index.js +47 -18
  99. package/build/system/Form/Toggle.stories.jsx +0 -96
  100. package/src/system/Form/Toggle.js +0 -74
  101. package/src/system/Form/Toggle.stories.jsx +0 -96
@@ -21,6 +21,9 @@ import { DialogDivider } from './Dialog';
21
21
  import { DialogContent } from './Dialog';
22
22
  import { DialogTrigger } from './Dialog';
23
23
  import { ConfirmationDialog } from './ConfirmationDialog';
24
+ import { MobileMenu } from './MobileMenu/MobileMenu';
25
+ import { MobileMenuTrigger } from './MobileMenu/MobileMenu';
26
+ import { MobileMenuWrapper } from './MobileMenu/MobileMenu';
24
27
  import { NewConfirmationDialog } from './NewConfirmationDialog';
25
28
  import { Grid } from './Grid';
26
29
  import { Flex } from './Flex';
@@ -53,4 +56,4 @@ import { Validation } from './Form';
53
56
  import { Wizard } from './Wizard';
54
57
  import { WizardStep } from './Wizard';
55
58
  import theme from './theme';
56
- export { Accordion, Avatar, Badge, Box, Breadcrumbs, Button, ButtonSubmit, ButtonVariant, Card, Checkbox, Code, Dialog, NewDialog, Form, Drawer, Dropdown, DialogButton, DialogMenu, DialogMenuItem, DialogDivider, DialogContent, DialogTrigger, ConfirmationDialog, NewConfirmationDialog, Grid, Flex, Notice, OptionRow, Heading, Input, Label, Spinner, Table, TableRow, TableCell, Tooltip, Link, Radio, RadioBoxGroup, Textarea, Progress, Text, Tabs, Nav, NavItem, TabsTrigger, TabsContent, TabsList, Toggle, ToggleRow, Toolbar, Validation, Wizard, WizardStep, theme };
59
+ export { Accordion, Avatar, Badge, Box, Breadcrumbs, Button, ButtonSubmit, ButtonVariant, Card, Checkbox, Code, Dialog, NewDialog, Form, Drawer, Dropdown, DialogButton, DialogMenu, DialogMenuItem, DialogDivider, DialogContent, DialogTrigger, ConfirmationDialog, MobileMenu, MobileMenuTrigger, MobileMenuWrapper, NewConfirmationDialog, Grid, Flex, Notice, OptionRow, Heading, Input, Label, Spinner, Table, TableRow, TableCell, Tooltip, Link, Radio, RadioBoxGroup, Textarea, Progress, Text, Tabs, Nav, NavItem, TabsTrigger, TabsContent, TabsList, Toggle, ToggleRow, Toolbar, Validation, Wizard, WizardStep, theme };
@@ -36,6 +36,7 @@ import {
36
36
  import { Grid } from './Grid';
37
37
  import { Heading } from './Heading';
38
38
  import { Link } from './Link';
39
+ import { MobileMenuWrapper, MobileMenuTrigger, MobileMenu } from './MobileMenu/MobileMenu';
39
40
  import { Nav } from './Nav/Nav';
40
41
  import { NavItem } from './Nav/NavItem';
41
42
  import { NewConfirmationDialog } from './NewConfirmationDialog';
@@ -77,6 +78,9 @@ export {
77
78
  DialogContent,
78
79
  DialogTrigger,
79
80
  ConfirmationDialog,
81
+ MobileMenu,
82
+ MobileMenuTrigger,
83
+ MobileMenuWrapper,
80
84
  NewConfirmationDialog,
81
85
  Grid,
82
86
  Flex,
@@ -64,6 +64,10 @@ declare namespace _default {
64
64
  color: string;
65
65
  bg: string;
66
66
  border: string;
67
+ py: number;
68
+ px: number;
69
+ minHeight: string;
70
+ height: string;
67
71
  cursor: string;
68
72
  fontWeight: string;
69
73
  boxShadow: string;
@@ -72,6 +76,14 @@ declare namespace _default {
72
76
  backgroundColor: string;
73
77
  color: string;
74
78
  };
79
+ verticalAlign: string;
80
+ display: string;
81
+ alignItems: string;
82
+ justifyContent: string;
83
+ textDecoration: string;
84
+ '&:hover': {
85
+ textDecoration: string;
86
+ };
75
87
  };
76
88
  export { primary_1 as primary };
77
89
  let secondary_1: {
@@ -162,26 +174,45 @@ declare namespace _default {
162
174
  };
163
175
  };
164
176
  }
165
- export namespace links {
166
- let dark: {
177
+ export let links: {
178
+ primary: {
167
179
  color: string;
168
- '&:hover': {
180
+ '&:visited': {
169
181
  color: string;
170
182
  };
171
- };
172
- let hover: {
173
- display: string;
174
- color: string;
175
- py: number;
176
- px: number;
177
- my: number;
178
- mx: number;
179
- borderRadius: number;
180
183
  '&:hover': {
181
- backgroundColor: string;
184
+ color: string;
185
+ };
186
+ '&:active': {
187
+ color: string;
188
+ };
189
+ textDecorationThickness: string;
190
+ textUnderlineOffset: string;
191
+ '&:hover, &:focus': {
192
+ color: string;
193
+ textDecorationLine: string;
194
+ textDecorationThickness: string;
182
195
  };
183
196
  };
184
- }
197
+ 'button-primary': {
198
+ variant: string;
199
+ };
200
+ 'button-danger': {
201
+ variant: string;
202
+ };
203
+ 'button-display': {
204
+ variant: string;
205
+ };
206
+ 'button-ghost': {
207
+ variant: string;
208
+ };
209
+ 'button-secondary': {
210
+ variant: string;
211
+ };
212
+ 'button-tertiary': {
213
+ variant: string;
214
+ };
215
+ };
185
216
  let text_1: {};
186
217
  export { text_1 as text };
187
218
  export namespace dialog {
@@ -277,32 +308,36 @@ declare namespace _default {
277
308
  };
278
309
  };
279
310
  export namespace styles {
280
- let root: {
281
- fontFamily: string;
282
- lineHeight: string;
283
- fontWeight: string;
284
- fontSize: number;
285
- color: string;
286
- backgroundColor: string;
287
- '-webkit-font-smoothing': string;
288
- '-moz-osx-font-smoothing': string;
289
- a: {
311
+ namespace root {
312
+ export let fontFamily: string;
313
+ export let lineHeight: string;
314
+ export let fontWeight: string;
315
+ let color_1: string;
316
+ export { color_1 as color };
317
+ let backgroundColor_5: string;
318
+ export { backgroundColor_5 as backgroundColor };
319
+ export let fontSmoothing: string;
320
+ export let a: {
290
321
  '&:hover': {
291
322
  textDecorationLine: string;
292
323
  textDecorationThickness: string;
293
324
  };
294
325
  };
295
- svg: {
296
- fill: string;
297
- display: string;
298
- };
299
- pre: {
300
- fontFamily: string;
301
- };
302
- p: {
303
- color: string;
304
- };
305
- };
326
+ export namespace svg {
327
+ export let fill: string;
328
+ let display_1: string;
329
+ export { display_1 as display };
330
+ }
331
+ export namespace pre {
332
+ let fontFamily_1: string;
333
+ export { fontFamily_1 as fontFamily };
334
+ }
335
+ export namespace p_2 {
336
+ let color_2: string;
337
+ export { color_2 as color };
338
+ }
339
+ export { p_2 as p };
340
+ }
306
341
  }
307
342
  }
308
343
  export default _default;
@@ -271,11 +271,14 @@ export default {
271
271
 
272
272
  buttons: {
273
273
  primary: {
274
- // you can reference other values defined in the theme
275
274
  fontFamily: 'body',
276
275
  color: 'button.primary.label.default',
277
276
  bg: 'button.primary.background.default',
278
277
  border: '1px solid transparent',
278
+ py: 0,
279
+ px: 5,
280
+ minHeight: '38px',
281
+ height: '100%',
279
282
  cursor: 'pointer',
280
283
  fontWeight: 'medium',
281
284
  boxShadow: 'none',
@@ -284,6 +287,14 @@ export default {
284
287
  backgroundColor: 'button.primary.background.hover',
285
288
  color: 'button.primary.label.hover',
286
289
  },
290
+ verticalAlign: 'middle',
291
+ display: 'inline-flex',
292
+ alignItems: 'center',
293
+ justifyContent: 'center',
294
+ textDecoration: 'none',
295
+ '&:hover': {
296
+ textDecoration: 'none',
297
+ },
287
298
  },
288
299
 
289
300
  secondary: {
@@ -387,23 +398,43 @@ export default {
387
398
  },
388
399
 
389
400
  links: {
390
- dark: {
391
- color: 'modes.dark.muted',
392
- '&:hover': { color: 'modes.dark.heading' },
393
- },
394
-
395
- hover: {
396
- display: 'block',
397
- color: 'inherit',
398
- py: 1,
399
- px: 2,
400
- my: -1,
401
- mx: -2,
402
- borderRadius: 2,
401
+ primary: {
402
+ color: 'link',
403
+ '&:visited': {
404
+ color: 'links.visited',
405
+ },
403
406
  '&:hover': {
404
- backgroundColor: 'hover',
407
+ color: 'hover',
408
+ },
409
+ '&:active': {
410
+ color: 'links.active',
411
+ },
412
+ textDecorationThickness: '0.125rem',
413
+ textUnderlineOffset: '0.125rem',
414
+ '&:hover, &:focus': {
415
+ color: 'links.hover',
416
+ textDecorationLine: 'underline',
417
+ textDecorationThickness: '0.125rem',
405
418
  },
406
419
  },
420
+ 'button-primary': {
421
+ variant: 'buttons.primary',
422
+ },
423
+ 'button-danger': {
424
+ variant: 'buttons.danger',
425
+ },
426
+ 'button-display': {
427
+ variant: 'buttons.display',
428
+ },
429
+ 'button-ghost': {
430
+ variant: 'buttons.ghost',
431
+ },
432
+ 'button-secondary': {
433
+ variant: 'buttons.secondary',
434
+ },
435
+ 'button-tertiary': {
436
+ variant: 'buttons.tertiary',
437
+ },
407
438
  },
408
439
 
409
440
  text: getHeadingStyles(),
@@ -492,11 +523,9 @@ export default {
492
523
  fontFamily: 'body',
493
524
  lineHeight: 'body',
494
525
  fontWeight: 'body',
495
- fontSize: 2,
496
526
  color: 'text',
497
527
  backgroundColor: 'backgrounds.primary',
498
- '-webkit-font-smoothing': 'antialiased',
499
- '-moz-osx-font-smoothing': 'grayscale',
528
+ fontSmoothing: 'antialiased',
500
529
  a: {
501
530
  '&:hover': {
502
531
  textDecorationLine: 'underline',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "main": "build/system/index.js",
5
5
  "scripts": {
6
6
  "build-storybook": "storybook build",
@@ -93,6 +93,7 @@
93
93
  "@testing-library/dom": "9.3.3",
94
94
  "@testing-library/jest-dom": "6.1.3",
95
95
  "@testing-library/react": "14.0.0",
96
+ "@testing-library/user-event": "^14.4.3",
96
97
  "@tsconfig/node18": "18.2.2",
97
98
  "@types/jest": "29.5.5",
98
99
  "@types/jest-axe": "3.5.6",
@@ -1,12 +1,11 @@
1
- // TODO: Fix this
2
1
  /* eslint-disable @typescript-eslint/ban-ts-comment */
3
2
  // @ts-nocheck
4
3
  /** @jsxImportSource theme-ui */
5
-
6
4
  /**
7
5
  * External dependencies
8
6
  */
9
- import { fireEvent, render, screen } from '@testing-library/react';
7
+ import { render, screen } from '@testing-library/react';
8
+ import userEvent from '@testing-library/user-event';
10
9
  import { axe } from 'jest-axe';
11
10
  import { ThemeUIProvider } from 'theme-ui';
12
11
 
@@ -48,15 +47,23 @@ describe( '<Accordion />', () => {
48
47
  } );
49
48
 
50
49
  it( 'should open the content when clicking on its trigger', async () => {
50
+ const user = userEvent.setup();
51
+
51
52
  const { container } = renderComponent();
52
53
 
53
- fireEvent.click( screen.getByRole( 'button', { name: 'trigger two' } ) );
54
+ await user.click( screen.getByRole( 'button', { name: 'trigger two', expanded: false } ) );
54
55
 
55
- // Should find the open content
56
- expect( screen.queryByText( 'content one' ) ).toBeNull();
56
+ expect(
57
+ screen.getByRole( 'button', { name: 'trigger one', expanded: false } )
58
+ ).toHaveAttribute( 'data-state', 'closed' );
59
+ expect( screen.queryByText( 'content one' ) ).not.toBeInTheDocument();
57
60
 
58
- // Should not find the closed content
59
- expect( screen.queryByText( 'content two' ) ).toBeInTheDocument();
61
+ // Should find the open content
62
+ expect( screen.getByRole( 'button', { name: 'trigger two', expanded: true } ) ).toHaveAttribute(
63
+ 'data-state',
64
+ 'open'
65
+ );
66
+ expect( screen.getByText( 'content two' ) ).toBeVisible();
60
67
 
61
68
  // Check for accessibility issues
62
69
  expect( await axe( container ) ).toHaveNoViolations();
@@ -16,4 +16,18 @@ export default {
16
16
 
17
17
  type Story = StoryObj< typeof Avatar >;
18
18
 
19
- export const Default: Story = {};
19
+ const COMMON_SIZES = [ 128, 64, 48, 32, 24, 16 ];
20
+
21
+ export const Default = () => (
22
+ <>
23
+ { COMMON_SIZES.map( size => (
24
+ <Avatar key={ size } size={ size } src="https://i.pravatar.cc/100" />
25
+ ) ) }
26
+ </>
27
+ );
28
+ export const WithName: Story = {
29
+ args: {
30
+ name: 'Kitty',
31
+ size: 30,
32
+ },
33
+ };
@@ -11,7 +11,6 @@ import { Image, ImageProps, ThemeUIStyleObject } from 'theme-ui';
11
11
  import { Box, Text } from '..';
12
12
 
13
13
  export interface AvatarProps {
14
- isVIP?: boolean;
15
14
  size?: number;
16
15
  src?: string;
17
16
  name?: string;
@@ -23,24 +22,21 @@ type AvatarImageProps = AvatarProps & ImageProps;
23
22
 
24
23
  export const Avatar = forwardRef< HTMLElement, AvatarImageProps >(
25
24
  (
26
- { isVIP = false, name, size = 32, src, className, sx = {}, ...props }: AvatarImageProps,
25
+ { name, size = 32, src, className, sx = {}, ...props }: AvatarImageProps,
27
26
  ref: Ref< HTMLElement >
28
27
  ) => (
29
28
  <Box
30
29
  sx={ {
31
30
  borderRadius: '100%',
32
- height: size + 2, // +2 to compensate padding on both sides
33
- width: size + 2, // +2 to compensate padding on both sides
34
- borderWidth: '2px',
35
- borderStyle: 'solid',
36
- borderColor: isVIP || isVIP === undefined ? 'primary' : 'transparent',
31
+ height: size,
32
+ width: size,
37
33
  overflow: 'hidden',
38
- backgroundColor: 'primary',
34
+ border: 'none',
35
+ backgroundColor: 'icon.primary',
39
36
  display: 'inline-flex',
40
37
  alignItems: 'center',
41
38
  justifyContent: 'center',
42
- color: 'white',
43
- padding: '1px', // this should probably be replaced with a token
39
+ color: 'inverse',
44
40
  textAlign: 'center',
45
41
  ...sx,
46
42
  } }
@@ -63,10 +59,10 @@ export const Avatar = forwardRef< HTMLElement, AvatarImageProps >(
63
59
  <Text
64
60
  as="span"
65
61
  sx={ {
66
- color: 'white',
62
+ color: 'icon.inverse',
67
63
  mb: 0,
68
64
  fontWeight: 'bold',
69
- fontSize: 0,
65
+ fontSize: 2,
70
66
  textTransform: 'uppercase',
71
67
  } }
72
68
  >
@@ -10,6 +10,7 @@ import { BiCalendarHeart } from 'react-icons/bi';
10
10
  * Internal dependencies
11
11
  */
12
12
  import { Button, ButtonVariant } from '..';
13
+ import { Flex } from '../Flex/Flex';
13
14
  import ScreenReaderText from '../ScreenReaderText';
14
15
 
15
16
  export default {
@@ -66,48 +67,56 @@ This documentation is heavily inspired by the [U.S Web Design System (USWDS)](ht
66
67
  };
67
68
 
68
69
  const Template = args => (
69
- <React.Fragment>
70
- <Button { ...args }>Primary</Button>
70
+ <div>
71
+ <Flex sx={ { gap: 2, flexDirection: 'row' } }>
72
+ <Button { ...args }>Primary</Button>
71
73
 
72
- <Button variant="secondary" sx={ { ml: 2 } } { ...args }>
73
- Secondary
74
- </Button>
74
+ <Button variant="secondary" sx={ { ml: 2 } } { ...args }>
75
+ Secondary
76
+ </Button>
75
77
 
76
- <Button variant="tertiary" sx={ { ml: 2 } } { ...args }>
77
- Tertiary
78
- </Button>
78
+ <Button variant="tertiary" sx={ { ml: 2 } } { ...args }>
79
+ Tertiary
80
+ </Button>
79
81
 
80
- <Button variant="ghost" sx={ { ml: 2 } } { ...args }>
81
- Ghost
82
- </Button>
82
+ <Button variant="ghost" sx={ { ml: 2 } } { ...args }>
83
+ Ghost
84
+ </Button>
83
85
 
84
- <Button variant="display" sx={ { ml: 2 } } { ...args }>
85
- Display
86
- </Button>
86
+ <Button variant="display" sx={ { ml: 2 } } { ...args }>
87
+ Display
88
+ </Button>
87
89
 
88
- <Button variant="danger" sx={ { ml: 2 } } { ...args }>
89
- Danger
90
- </Button>
90
+ <Button variant="danger" sx={ { ml: 2 } } { ...args }>
91
+ Danger
92
+ </Button>
91
93
 
92
- <Button variant="primary" disabled={ true } sx={ { ml: 2 } } { ...args }>
93
- Disabled
94
- </Button>
94
+ <Button variant="primary" disabled={ true } sx={ { ml: 2 } } { ...args }>
95
+ Disabled
96
+ </Button>
95
97
 
96
- <Button variant="text" sx={ { ml: 2 } } as="a" href="https://google/com" { ...args }>
97
- Button link
98
- </Button>
98
+ <Button variant="text" sx={ { ml: 2 } } as="a" href="https://google/com" { ...args }>
99
+ Button link
100
+ </Button>
101
+
102
+ <Button variant="icon" sx={ { ml: 2 } } type="button" { ...args }>
103
+ <BiCalendarHeart size={ 24 } />
104
+ <ScreenReaderText>domain.com</ScreenReaderText>
105
+ </Button>
106
+ </Flex>
99
107
 
100
- <Button variant="icon" sx={ { ml: 2 } } type="button" { ...args }>
101
- <BiCalendarHeart size={ 24 } />
102
- <ScreenReaderText>domain.com</ScreenReaderText>
103
- </Button>
108
+ <div sx={ { mt: 3 } }>
109
+ <Button variant="secondary" href="https://google/com" { ...args } full>
110
+ Button with full width
111
+ </Button>
112
+ </div>
104
113
 
105
- <div sx={ { maxWidth: '100px', mt: 3 } }>
106
- <Button variant="secondary" href="https://google/com" { ...args }>
107
- Button with constrained width
114
+ <div sx={ { mt: 3, display: 'flex' } }>
115
+ <Button variant="secondary" href="https://google/com" { ...args } grow>
116
+ Button with grow width
108
117
  </Button>
109
118
  </div>
110
- </React.Fragment>
119
+ </div>
111
120
  );
112
121
 
113
122
  export const Default = Template.bind( {} );
@@ -1,8 +1,5 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import classNames from 'classnames';
5
- import React, { useCallback, forwardRef, Ref } from 'react';
2
+ import React, { useCallback, forwardRef } from 'react';
6
3
  import { Theme, Button as ThemeButton, ButtonProps as ThemeButtonProps } from 'theme-ui';
7
4
 
8
5
  type ButtonClickType = React.MouseEvent< HTMLButtonElement, MouseEvent >;
@@ -25,11 +22,13 @@ export enum ButtonVariant {
25
22
  export interface ButtonProps extends ThemeButtonProps {
26
23
  disabled?: boolean;
27
24
  onClick?: ( event: ButtonClickType ) => void;
25
+ full?: boolean;
26
+ grow?: boolean;
28
27
  variant?: keyof typeof ButtonVariant; // converts the enum to a string union type
29
28
  }
30
29
 
31
30
  const Button = forwardRef< HTMLButtonElement, ButtonProps >(
32
- ( { className, disabled, onClick, sx, ...rest }: ButtonProps, ref: Ref< HTMLButtonElement > ) => {
31
+ ( { className, disabled, onClick, sx, full, grow, ...rest }, ref ) => {
33
32
  const handleOnClick = useCallback(
34
33
  ( event: ButtonClickType ) => {
35
34
  if ( disabled ) {
@@ -46,16 +45,6 @@ const Button = forwardRef< HTMLButtonElement, ButtonProps >(
46
45
  return (
47
46
  <ThemeButton
48
47
  sx={ {
49
- verticalAlign: 'middle',
50
- display: 'inline-flex',
51
- alignItems: 'center',
52
- justifyContent: 'center',
53
- minHeight: '36px',
54
- py: 0,
55
- textDecoration: 'none',
56
- '&:hover': {
57
- textDecoration: 'none',
58
- },
59
48
  '&:focus': 'none',
60
49
  '&:focus-visible': ( theme: ButtonTheme ) => theme.outline,
61
50
  '&[aria-disabled="true"]': {
@@ -65,6 +54,8 @@ const Button = forwardRef< HTMLButtonElement, ButtonProps >(
65
54
  cursor: 'not-allowed',
66
55
  pointerEvents: 'none',
67
56
  },
57
+ flexGrow: Boolean( grow ) === true ? '1' : 'initial',
58
+ width: Boolean( full ) === true ? '100%' : 'auto',
68
59
  ...sx,
69
60
  } }
70
61
  { ...rest }
@@ -28,7 +28,6 @@ export const Card = forwardRef< HTMLElement, CardBoxProps >(
28
28
  sx={ {
29
29
  // pass variant prop to sx
30
30
  variant: `cards.${ variant }`,
31
- overflow: 'hidden',
32
31
  ...sx,
33
32
  } }
34
33
  className={ classNames( 'vip-card-component', className ) }