@automattic/vip-design-system 0.14.2 → 0.17.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 (44) hide show
  1. package/.prettierignore +1 -0
  2. package/README.md +26 -0
  3. package/build/system/Button/Button.js +9 -4
  4. package/build/system/NewConfirmationDialog/NewConfirmationDialog.js +120 -0
  5. package/build/system/NewConfirmationDialog/NewConfirmationDialog.stories.js +52 -0
  6. package/build/system/NewConfirmationDialog/NewConfirmationDialog.test.js +82 -0
  7. package/build/system/NewConfirmationDialog/index.js +7 -0
  8. package/build/system/NewDialog/DialogClose.js +26 -11
  9. package/build/system/NewDialog/DialogClose.test.js +1 -1
  10. package/build/system/NewDialog/DialogDescription.js +1 -1
  11. package/build/system/NewDialog/DialogTitle.js +1 -1
  12. package/build/system/NewDialog/NewDialog.js +13 -23
  13. package/build/system/NewDialog/NewDialog.stories.js +80 -9
  14. package/build/system/NewDialog/index.js +14 -1
  15. package/build/system/Notification/Notification.js +1 -1
  16. package/build/system/ScreenReaderText/ScreenReader.test.js +2 -2
  17. package/build/system/ScreenReaderText/ScreenReaderText.js +9 -4
  18. package/build/system/ScreenReaderText/index.js +8 -1
  19. package/build/system/index.js +12 -3
  20. package/build/system/theme/generated/valet-theme.json +2429 -0
  21. package/build/system/theme/getColor.js +3 -21
  22. package/build/system/theme/index.js +1 -1
  23. package/package.json +8 -5
  24. package/src/system/Button/Button.js +7 -3
  25. package/src/system/NewConfirmationDialog/NewConfirmationDialog.js +93 -0
  26. package/src/system/NewConfirmationDialog/NewConfirmationDialog.stories.jsx +32 -0
  27. package/src/system/NewConfirmationDialog/NewConfirmationDialog.test.js +39 -0
  28. package/src/system/NewConfirmationDialog/index.js +6 -0
  29. package/src/system/NewDialog/DialogClose.js +18 -4
  30. package/src/system/NewDialog/DialogClose.test.js +1 -1
  31. package/src/system/NewDialog/DialogDescription.js +1 -1
  32. package/src/system/NewDialog/DialogTitle.js +1 -1
  33. package/src/system/NewDialog/NewDialog.js +14 -20
  34. package/src/system/NewDialog/NewDialog.stories.jsx +55 -7
  35. package/src/system/NewDialog/index.js +7 -1
  36. package/src/system/Notification/Notification.js +1 -1
  37. package/src/system/ScreenReaderText/ScreenReader.test.js +1 -1
  38. package/src/system/ScreenReaderText/ScreenReaderText.js +24 -22
  39. package/src/system/ScreenReaderText/index.js +2 -0
  40. package/src/system/index.js +3 -1
  41. package/src/system/theme/generated/valet-theme.json +2429 -0
  42. package/src/system/theme/getColor.js +3 -19
  43. package/src/system/theme/index.js +1 -1
  44. package/tokens/valet-color.json +0 -6164
@@ -5,39 +5,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  exports.__esModule = true;
6
6
  exports.getColor = void 0;
7
7
 
8
- var _valetColor = _interopRequireDefault(require("../../../tokens/valet-color.json"));
8
+ var _valetTheme = _interopRequireDefault(require("./generated/valet-theme.json"));
9
9
 
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
- var ThemeColors = _valetColor["default"]['productive-color-wpvip'];
14
- var CoreColors = _valetColor["default"]['valet-core'];
15
-
16
13
  var getColor = function getColor(color, variant) {
17
14
  if (variant === void 0) {
18
15
  variant = 'default';
19
16
  }
20
17
 
21
- if (!ThemeColors[color]) {
18
+ if (!_valetTheme["default"][color]) {
22
19
  return '#000000';
23
20
  }
24
21
 
25
- var colorValue = ThemeColors[color][variant].value;
26
-
27
- if (colorValue.startsWith('{')) {
28
- var _colorValue$replace$s = colorValue.replace(/[{}]/g, '').split('.'),
29
- name = _colorValue$replace$s[0],
30
- number = _colorValue$replace$s[1]; // Some colors are flat, there is no sub values.
31
-
32
-
33
- if (CoreColors[name][number]) {
34
- return CoreColors[name][number].value;
35
- }
36
-
37
- return CoreColors[name].value;
38
- }
39
-
40
- return colorValue;
22
+ return _valetTheme["default"][color][variant].value;
41
23
  };
42
24
 
43
25
  exports.getColor = getColor;
@@ -65,7 +65,7 @@ var outline = {
65
65
  outlineStyle: 'solid',
66
66
  outlineColor: '#ffffff',
67
67
  outlineWidth: '1px',
68
- boxShadow: "0 0 0 1px #fff, 0 0 0 3px " + (0, _getColor.getColor)('focus')
68
+ boxShadow: "0 0 0 1px " + (0, _getColor.getColor)('focus', 'inset') + ", 0 0 0 3px " + (0, _getColor.getColor)('focus')
69
69
  };
70
70
  var _default = {
71
71
  outline: outline,
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "0.14.2",
3
+ "version": "0.17.0",
4
4
  "main": "build/system/index.js",
5
5
  "scripts": {
6
6
  "build-storybook": "build-storybook",
7
- "build": "cross-env NODE_ENV=production babel src --out-dir build",
7
+ "build": "npm run theme-update && cross-env NODE_ENV=production babel src --out-dir build && npm run theme-builder-copy",
8
8
  "format": "prettier --write \"src/**/*.{js,ts,tsx,md,mdx,json}\"",
9
- "format:check": "prettier --list-different -- \"src/**/*.{js,ts,tsx,md,mdx,json}\"",
9
+ "format:check": "prettier --list-different -- \"src/system/**/*.{js,ts,tsx,md,mdx,json}\"",
10
10
  "jest": "NODE_ENV=test jest --detectOpenHandles --env=jsdom",
11
11
  "jest:coverage": "npm run jest && open-cli ./coverage/index.html",
12
12
  "jest:watch": "npm run jest --watch",
13
+ "theme-builder-copy": "mkdir -p build/system/theme/generated/ && cp src/system/theme/generated/valet-theme.json build/system/theme/generated/valet-theme.json",
14
+ "theme-update": "token-transformer tokens/valet-core.json src/system/theme/generated/valet-theme.json valet-core,productive-color-wpvip",
13
15
  "lint": "eslint . --fix --max-warnings 0",
14
16
  "storybook": "start-storybook -p 6006",
15
17
  "dev": "npm run storybook",
@@ -18,7 +20,7 @@
18
20
  },
19
21
  "dependencies": {
20
22
  "@radix-ui/react-checkbox": "^0.1.5",
21
- "@radix-ui/react-dialog": "^0.1.7",
23
+ "@radix-ui/react-dialog": "^1.0.0",
22
24
  "@radix-ui/react-radio-group": "^0.1.5",
23
25
  "@radix-ui/react-switch": "^0.1.5",
24
26
  "@radix-ui/react-tooltip": "^0.1.7",
@@ -121,6 +123,7 @@
121
123
  "react-dom": "^17.0.2",
122
124
  "react-input-autosize": "^3.0.0",
123
125
  "react-refresh": "^0.9.0",
124
- "theme-ui": "0.10.0"
126
+ "theme-ui": "0.10.0",
127
+ "token-transformer": "^0.0.24"
125
128
  }
126
129
  }
@@ -3,11 +3,12 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { Button as ThemeButton } from 'theme-ui';
6
+ import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import classNames from 'classnames';
9
+ import { Button as ThemeButton } from 'theme-ui';
9
10
 
10
- const Button = ( { sx, ...props } ) => (
11
+ const Button = React.forwardRef( ( { sx, ...props }, forwardRef ) => (
11
12
  <ThemeButton
12
13
  sx={ {
13
14
  verticalAlign: 'middle',
@@ -27,8 +28,11 @@ const Button = ( { sx, ...props } ) => (
27
28
  } }
28
29
  className={ classNames( 'vip-button-component', props.className ) }
29
30
  { ...props }
31
+ ref={ forwardRef }
30
32
  />
31
- );
33
+ ) );
34
+
35
+ Button.displayName = 'Button';
32
36
 
33
37
  Button.propTypes = {
34
38
  sx: PropTypes.object,
@@ -0,0 +1,93 @@
1
+ /** @jsxImportSource theme-ui */
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import classNames from 'classnames';
7
+ import PropTypes from 'prop-types';
8
+ import React from 'react';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { NewDialog, Box, Flex, Button } from '..';
14
+
15
+ const NewConfirmationDialogContent = ( {
16
+ label = 'Confirm',
17
+ onConfirm,
18
+ onClose,
19
+ className = null,
20
+ } ) => (
21
+ <Box className={ classNames( 'vip-confirmation-dialog-component', className ) }>
22
+ <Flex sx={ { justifyContent: 'flex-end', mt: 4 } }>
23
+ <Button variant="secondary" sx={ { mr: 2 } } onClick={ onClose }>
24
+ Cancel
25
+ </Button>
26
+ <NewDialog.Close>
27
+ <Button
28
+ variant="danger"
29
+ onClick={ () => {
30
+ onConfirm();
31
+ onClose();
32
+ } }
33
+ >
34
+ { label }
35
+ </Button>
36
+ </NewDialog.Close>
37
+ </Flex>
38
+ </Box>
39
+ );
40
+
41
+ NewConfirmationDialogContent.propTypes = {
42
+ body: PropTypes.node,
43
+ label: PropTypes.string,
44
+ onClose: PropTypes.func,
45
+ onConfirm: PropTypes.func,
46
+ className: PropTypes.any,
47
+ };
48
+
49
+ const NewConfirmationDialog = ( {
50
+ trigger,
51
+ onConfirm,
52
+ needsConfirm = true,
53
+ label,
54
+ title,
55
+ body = '',
56
+ } ) => {
57
+ const [ open, setOpen ] = React.useState( false );
58
+ const directTrigger = React.cloneElement( trigger, { onClick: onConfirm } );
59
+
60
+ if ( ! needsConfirm ) {
61
+ return directTrigger;
62
+ }
63
+
64
+ return (
65
+ <NewDialog.Root
66
+ open={ open }
67
+ onOpenChange={ setOpen }
68
+ sx={ { maxWidth: 680 } }
69
+ title={ title }
70
+ description={ body }
71
+ content={
72
+ <NewConfirmationDialogContent
73
+ onClose={ () => setOpen( false ) }
74
+ onConfirm={ onConfirm }
75
+ body={ body }
76
+ label={ label }
77
+ />
78
+ }
79
+ trigger={ trigger }
80
+ />
81
+ );
82
+ };
83
+
84
+ NewConfirmationDialog.propTypes = {
85
+ needsConfirm: PropTypes.bool,
86
+ trigger: PropTypes.node,
87
+ onConfirm: PropTypes.func,
88
+ title: PropTypes.node,
89
+ body: PropTypes.node,
90
+ label: PropTypes.node,
91
+ };
92
+
93
+ export { NewConfirmationDialog };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import React from 'react';
5
+ import { Box, NewConfirmationDialog, Button } from '..';
6
+
7
+ export default {
8
+ title: 'NewConfirmationDialog',
9
+ component: NewConfirmationDialog,
10
+ };
11
+
12
+ const ConfirmationTrigger = <Button sx={ { mr: 3 } }>Click to answer</Button>;
13
+
14
+ export const Default = () => {
15
+ const [ answer, setAnswer ] = React.useState( '🤔' );
16
+ return (
17
+ <Box>
18
+ <p>Confirm that your name is John doe?</p>
19
+ <NewConfirmationDialog
20
+ title={ 'Are you John Doe?' }
21
+ description={ 'Please confirm that your name is John Doe.' }
22
+ trigger={ ConfirmationTrigger }
23
+ body="A modal is used to perform more detailed actions that don&lsquo;t necessarily need the context
24
+ behind."
25
+ onConfirm={ () => setAnswer( '👍' ) }
26
+ needsConfirm={ true }
27
+ />
28
+
29
+ <p>Answer: { answer }</p>
30
+ </Box>
31
+ );
32
+ };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { fireEvent, render, screen } from '@testing-library/react';
5
+ import { axe } from 'jest-axe';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { NewConfirmationDialog } from './NewConfirmationDialog';
11
+
12
+ const defaultProps = {
13
+ needsConfirm: true,
14
+ title: 'My Custom Title',
15
+ body: 'My Custom Text',
16
+ label: 'Submit this!',
17
+ trigger: <button>Trigger</button>,
18
+ };
19
+
20
+ const getButton = () => screen.getByText( 'Trigger' );
21
+ const getConfirmButton = () => screen.getByText( defaultProps.label );
22
+ const getTitle = () => screen.getByRole( 'heading', { level: 2 } );
23
+
24
+ describe( '<NewConfirmationDialog />', () => {
25
+ it( 'renders the NewConfirmationDialog component', async () => {
26
+ const { container } = render( <NewConfirmationDialog { ...defaultProps } /> );
27
+
28
+ expect( getButton() ).toBeInTheDocument();
29
+
30
+ fireEvent.click( getButton() );
31
+
32
+ expect( getTitle() ).toHaveTextContent( defaultProps.title );
33
+
34
+ expect( getConfirmButton() ).toBeInTheDocument();
35
+
36
+ // Check for accessibility issues
37
+ await expect( await axe( container ) ).toHaveNoViolations();
38
+ } );
39
+ } );
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { NewConfirmationDialog } from './NewConfirmationDialog';
5
+
6
+ export { NewConfirmationDialog };
@@ -4,14 +4,28 @@
4
4
  * External dependencies
5
5
  */
6
6
  import React from 'react';
7
+ import PropTypes from 'prop-types';
7
8
  import * as DialogPrimitive from '@radix-ui/react-dialog';
8
9
  import { IoClose } from 'react-icons/io5';
9
10
 
10
11
  /**
11
12
  * Internal dependencies
12
13
  */
13
- export const DialogClose = React.forwardRef( ( props, forwardedRef ) => (
14
- <DialogPrimitive.Close asChild { ...props } ref={ forwardedRef }>
14
+
15
+ export const DialogClose = React.forwardRef( ( { children, ...rest }, forwardedRef ) => (
16
+ <DialogPrimitive.Close asChild { ...rest } ref={ forwardedRef }>
17
+ { children }
18
+ </DialogPrimitive.Close>
19
+ ) );
20
+
21
+ DialogClose.propTypes = {
22
+ children: PropTypes.node,
23
+ };
24
+
25
+ DialogClose.displayName = 'DialogClose';
26
+
27
+ export const DialogCloseDefault = React.forwardRef( ( props, forwardedRef ) => (
28
+ <DialogClose { ...props } ref={ forwardedRef }>
15
29
  <button
16
30
  aria-label="Close"
17
31
  sx={ {
@@ -40,7 +54,7 @@ export const DialogClose = React.forwardRef( ( props, forwardedRef ) => (
40
54
  >
41
55
  <IoClose aria-hidden="true" />
42
56
  </button>
43
- </DialogPrimitive.Close>
57
+ </DialogClose>
44
58
  ) );
45
59
 
46
- DialogClose.displayName = 'DialogClose';
60
+ DialogCloseDefault.displayName = 'DialogCloseDefault';
@@ -8,7 +8,7 @@ import { axe } from 'jest-axe';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
- import { DialogClose } from './DialogClose';
11
+ import { DialogCloseDefault as DialogClose } from './DialogClose';
12
12
 
13
13
  // If you render any Dialog child without the `<Dialog />` parent, it will throw an error.
14
14
  const Wrapper = props => <Dialog open={ true } { ...props } />;
@@ -6,7 +6,7 @@
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import * as DialogPrimitive from '@radix-ui/react-dialog';
9
- import ScreenReaderText from '../ScreenReaderText/ScreenReaderText';
9
+ import ScreenReaderText from '../ScreenReaderText';
10
10
 
11
11
  /**
12
12
  * Internal dependencies
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import PropTypes from 'prop-types';
7
7
  import * as DialogPrimitive from '@radix-ui/react-dialog';
8
- import ScreenReaderText from '../ScreenReaderText/ScreenReaderText';
8
+ import ScreenReaderText from '../ScreenReaderText';
9
9
 
10
10
  /**
11
11
  * Internal dependencies
@@ -9,7 +9,7 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
9
9
  * Internal dependencies
10
10
  */
11
11
  import { DialogOverlay } from './DialogOverlay';
12
- import { DialogClose } from './DialogClose';
12
+ import { DialogCloseDefault as DialogClose } from './DialogClose';
13
13
  import { DialogTitle } from './DialogTitle';
14
14
  import { DialogDescription } from './DialogDescription';
15
15
  import { contentStyles } from './DialogContent';
@@ -26,18 +26,22 @@ export const NewDialog = ( {
26
26
  // Radix Specific Properties
27
27
  defaultOpen = false,
28
28
  allowPinchZoom = false,
29
- onOpenAutoFocus = null,
30
- onCloseAutoFocus = null,
31
- onEscapeKeyDown = null,
32
- onPointerDownOutside = null,
33
- onInteractOutside = null,
29
+ onOpenChange = undefined,
30
+ open = undefined,
31
+ id = undefined,
34
32
  } ) => {
35
33
  if ( disabled ) {
36
34
  return;
37
35
  }
38
36
 
39
37
  return (
40
- <DialogPrimitive.Root defaultOpen={ defaultOpen } allowPinchZoom={ allowPinchZoom }>
38
+ <DialogPrimitive.Root
39
+ id={ id }
40
+ open={ open }
41
+ onOpenChange={ onOpenChange }
42
+ defaultOpen={ defaultOpen }
43
+ allowPinchZoom={ allowPinchZoom }
44
+ >
41
45
  { trigger && <DialogPrimitive.Trigger asChild>{ trigger }</DialogPrimitive.Trigger> }
42
46
 
43
47
  <DialogPrimitive.Portal>
@@ -46,11 +50,6 @@ export const NewDialog = ( {
46
50
  <DialogPrimitive.Content
47
51
  className="vip-dialog-component"
48
52
  sx={ { ...contentStyles, ...extraStyles } }
49
- onOpenAutoFocus={ onOpenAutoFocus }
50
- onCloseAutoFocus={ onCloseAutoFocus }
51
- onEscapeKeyDown={ onEscapeKeyDown }
52
- onPointerDownOutside={ onPointerDownOutside }
53
- onInteractOutside={ onInteractOutside }
54
53
  >
55
54
  <DialogClose />
56
55
  <DialogTitle title={ title } hidden={ ! showHeading } />
@@ -74,14 +73,9 @@ NewDialog.propTypes = {
74
73
 
75
74
  // Radix DialogPrimitive.Root properties
76
75
  // https://www.radix-ui.com/docs/primitives/components/dialog#root
76
+ id: PropTypes.string,
77
+ open: PropTypes.bool,
77
78
  defaultOpen: PropTypes.bool,
78
79
  allowPinchZoom: PropTypes.bool,
79
-
80
- // Radix DialogPrimitive.Content properties
81
- // https://www.radix-ui.com/docs/primitives/components/dialog#content
82
- onOpenAutoFocus: PropTypes.func,
83
- onCloseAutoFocus: PropTypes.func,
84
- onEscapeKeyDown: PropTypes.func,
85
- onPointerDownOutside: PropTypes.func,
86
- onInteractOutside: PropTypes.func,
80
+ onOpenChange: PropTypes.func,
87
81
  };
@@ -1,16 +1,21 @@
1
1
  /** @jsxImportSource theme-ui */
2
2
 
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import { useState } from 'react';
7
+
3
8
  /**
4
9
  /**
5
10
  * Internal dependencies
6
11
  */
7
12
  import { Button, Text, Input, Label } from '../../system';
8
- import ScreenReaderText from '../ScreenReaderText/ScreenReaderText';
9
- import { NewDialog } from './NewDialog';
13
+ import ScreenReaderText from '../ScreenReaderText';
14
+ import * as NewDialog from '.';
10
15
 
11
16
  export default {
12
17
  title: 'NewDialog',
13
- component: NewDialog,
18
+ component: NewDialog.Root,
14
19
  };
15
20
 
16
21
  const defaultProps = {
@@ -24,14 +29,14 @@ export const Default = () => (
24
29
  Regular Dialog where the title and description are built-in and the content is provided by the
25
30
  user.
26
31
  </Text>
27
- <NewDialog { ...defaultProps } trigger={ <Button>Trigger Dialog</Button> } />
32
+ <NewDialog.Root { ...defaultProps } trigger={ <Button>Trigger Dialog</Button> } />
28
33
  </>
29
34
  );
30
35
 
31
36
  export const AutoOpen = () => (
32
37
  <>
33
38
  <Text sx={ { fontSize: 3, mb: 3 } }>Auto Opens when rendered. Press escape to close it.</Text>
34
- <NewDialog
39
+ <NewDialog.Root
35
40
  { ...defaultProps }
36
41
  defaultOpen={ true }
37
42
  content={
@@ -61,7 +66,7 @@ export const HiddenHeadings = () => (
61
66
  dialog content.
62
67
  </Text>
63
68
 
64
- <NewDialog
69
+ <NewDialog.Root
65
70
  { ...defaultProps }
66
71
  trigger={ <Button>Trigger Dialog</Button> }
67
72
  title="Custom dialog title"
@@ -88,7 +93,7 @@ export const CustomStyling = () => (
88
93
  <>
89
94
  <Text sx={ { fontSize: 3, mb: 3 } }>Custom Styling on Dialog Content</Text>
90
95
 
91
- <NewDialog
96
+ <NewDialog.Root
92
97
  { ...defaultProps }
93
98
  defaultOpen
94
99
  trigger={ <Button>Trigger Dialog</Button> }
@@ -112,3 +117,46 @@ export const CustomStyling = () => (
112
117
  />
113
118
  </>
114
119
  );
120
+
121
+ export const CustomClose = () => (
122
+ <>
123
+ <Text sx={ { fontSize: 3, mb: 3 } }>
124
+ This example shows how you can create a custom Close trigger to your dialog
125
+ </Text>
126
+ <NewDialog.Root
127
+ { ...defaultProps }
128
+ trigger={ <Button>Trigger Dialog</Button> }
129
+ content={
130
+ <div>
131
+ <NewDialog.Close>
132
+ <Button>Close here instead</Button>
133
+ </NewDialog.Close>
134
+ </div>
135
+ }
136
+ />
137
+ </>
138
+ );
139
+ export const CustomStateManagement = () => {
140
+ const [ open, setOpen ] = useState( false );
141
+ return (
142
+ <>
143
+ <Text sx={ { fontSize: 3, mb: 3 } }>
144
+ This example shows how you can create a custom state management. To achieve accessibility,
145
+ you need to control the <strong>open</strong> state, but also keep consistency using the{ ' ' }
146
+ <strong>onOpenChange</strong> attribute.
147
+ </Text>
148
+
149
+ <NewDialog.Root
150
+ { ...defaultProps }
151
+ open={ open }
152
+ onOpenChange={ setOpen }
153
+ trigger={ <Button>Trigger Dialog</Button> }
154
+ content={
155
+ <div>
156
+ <Button onClick={ () => setOpen( false ) }>Close here instead</Button>
157
+ </div>
158
+ }
159
+ />
160
+ </>
161
+ );
162
+ };
@@ -2,6 +2,12 @@
2
2
  * Internal dependencies
3
3
  */
4
4
 
5
+ import { DialogClose } from './DialogClose';
5
6
  import { NewDialog } from './NewDialog';
6
7
 
7
- export { NewDialog };
8
+ const Root = NewDialog;
9
+ const Close = DialogClose;
10
+
11
+ export { NewDialog, Root, Close };
12
+
13
+ export default NewDialog;
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
10
10
  * Internal dependencies
11
11
  */
12
12
  import { Box, Card, Flex, Text, Button } from '../';
13
- import ScreenReaderText from '../ScreenReaderText/ScreenReaderText';
13
+ import ScreenReaderText from '../ScreenReaderText';
14
14
 
15
15
  const Notification = ( { title, body, status = 'success', onClose } ) => (
16
16
  <Card
@@ -6,7 +6,7 @@ import '@testing-library/jest-dom';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
- import ScreenReaderText from './ScreenReaderText';
9
+ import ScreenReaderText from '.';
10
10
 
11
11
  describe( '<ScreenReaderText />', () => {
12
12
  it( 'should render correctly', () => {
@@ -3,34 +3,36 @@
3
3
  * External dependencies
4
4
  */
5
5
 
6
+ import React from 'react';
6
7
  import PropTypes from 'prop-types';
7
8
 
8
9
  /**
9
10
  * Internal dependencies
10
11
  */
11
12
 
12
- export default function ScreenReaderText( props ) {
13
- return (
14
- <span
15
- className="screen-reader-text"
16
- sx={ {
17
- border: 'none',
18
- clip: 'rect(1px, 1px, 1px, 1px)',
19
- clipPath: 'inset(50%)',
20
- height: '1px',
21
- margin: '-1px',
22
- overflow: 'hidden',
23
- padding: '0',
24
- position: 'absolute',
25
- width: '1px',
26
- wordWrap: 'normal !important',
27
- } }
28
- { ...props }
29
- >
30
- { props.children }
31
- </span>
32
- );
33
- }
13
+ export const ScreenReaderText = React.forwardRef( ( props, forwardRef ) => (
14
+ <span
15
+ className="screen-reader-text"
16
+ sx={ {
17
+ border: 'none',
18
+ clip: 'rect(1px, 1px, 1px, 1px)',
19
+ clipPath: 'inset(50%)',
20
+ height: '1px',
21
+ margin: '-1px',
22
+ overflow: 'hidden',
23
+ padding: '0',
24
+ position: 'absolute',
25
+ width: '1px',
26
+ wordWrap: 'normal !important',
27
+ } }
28
+ { ...props }
29
+ ref={ forwardRef }
30
+ >
31
+ { props.children }
32
+ </span>
33
+ ) );
34
+
35
+ ScreenReaderText.displayName = 'ScreenReaderText';
34
36
 
35
37
  /**
36
38
  * propTypes
@@ -5,3 +5,5 @@
5
5
  import { ScreenReaderText } from './ScreenReaderText';
6
6
 
7
7
  export { ScreenReaderText };
8
+
9
+ export default ScreenReaderText;
@@ -18,8 +18,9 @@ import {
18
18
  DialogContent,
19
19
  } from './Dialog';
20
20
 
21
- import { NewDialog } from './NewDialog';
21
+ import * as NewDialog from './NewDialog';
22
22
  import { ConfirmationDialog } from './ConfirmationDialog';
23
+ import { NewConfirmationDialog } from './NewConfirmationDialog';
23
24
  import { Flex } from './Flex';
24
25
  import {
25
26
  Input,
@@ -70,6 +71,7 @@ export {
70
71
  DialogContent,
71
72
  DialogTrigger,
72
73
  ConfirmationDialog,
74
+ NewConfirmationDialog,
73
75
  Grid,
74
76
  Flex,
75
77
  Notice,