Skip to content

Commit c2f36c3

Browse files
author
Luke Bowerman
authored
Deprecate Drawer, rename Modal* to Dialog* (#1105)
- Deprecate Drawer - Rename Layout/Modal* to Layout/Dialog* (externally visible) - Rename ModalPortal to just Portal - Export getPortalRoot and alias to getModalRoot
1 parent ce22d15 commit c2f36c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+252
-577
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
### Changed
1818

19+
- `ModalPortal` is now `Portal`
20+
- `Modal*` has moved to `Dialog*`
21+
- `ModalContext` is now `DialogContext`
22+
- `ModalContent` is now `DialogContent`
23+
- `ModalFooter` is now `DialogFooter`
24+
- `ModalHeader` is now `DialogHeader`
25+
- Aliases for the old names are in place to ease the upgrade but these aliases will be deprecated shortly
1926
- `Badge` now uses generated colors rather than referencing colors.palette
2027
- `InputText` interface simplified / narrowed
2128
- No longer supports typography or pseudo props
@@ -39,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3946

4047
### Removed
4148

49+
- `Drawer` no longer available
4250
- `ComboboxMultiOption` prop `hideCheckMark` (instead use `indicator={false}`)
4351
- `CustomizableAttributes` are no longer supported
4452
- `MenuList`, `MenuGroup` & `MenuItem` no longer supports `customizationProps`

packages/components/src/Modal/Confirm/Confirm.test.tsx renamed to packages/components/src/Dialog/Confirm/Confirm.test.tsx

File renamed without changes.
File renamed without changes.

packages/components/src/Modal/Confirm/ConfirmLayout.tsx renamed to packages/components/src/Dialog/Confirm/ConfirmLayout.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import React, { FC, ReactElement } from 'react'
2727
import { ButtonProps } from '../../Button'
2828
import { IconProps } from '../../Icon'
2929
import { Paragraph } from '../../Text'
30-
import { ModalContent, ModalFooter, ModalHeader } from '../Layout'
30+
import { DialogContent, DialogFooter, DialogHeader } from '../Layout'
3131

3232
interface ConfirmLayoutProps {
3333
/**
@@ -61,20 +61,20 @@ export const ConfirmLayout: FC<ConfirmLayoutProps> = ({
6161
}) => {
6262
return (
6363
<>
64-
<ModalHeader hideClose headerIcon={titleIcon}>
64+
<DialogHeader hideClose headerIcon={titleIcon}>
6565
{title}
66-
</ModalHeader>
67-
<ModalContent innerProps={{ py: 'none' }}>
66+
</DialogHeader>
67+
<DialogContent innerProps={{ py: 'none' }}>
6868
{typeof message === 'string' ? (
6969
<Paragraph breakword>{message}</Paragraph>
7070
) : (
7171
message
7272
)}
73-
</ModalContent>
74-
<ModalFooter>
73+
</DialogContent>
74+
<DialogFooter>
7575
{primaryButton}
7676
{secondaryButton}
77-
</ModalFooter>
77+
</DialogFooter>
7878
</>
7979
)
8080
}

packages/components/src/Modal/Confirm/ConfirmationDialog.tsx renamed to packages/components/src/Dialog/Confirm/ConfirmationDialog.tsx

File renamed without changes.
File renamed without changes.

packages/components/src/Modal/Dialog/Dialog.test.tsx renamed to packages/components/src/Dialog/Dialog/Dialog.test.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ import {
3030
mountWithTheme,
3131
assertSnapshotShallow,
3232
} from '@looker/components-test-utils'
33-
import { ModalFooter, ModalHeader } from '../Layout'
33+
import { DialogFooter, DialogHeader } from '../Layout'
3434
import { SimpleContent } from '../modal.test.helpers'
3535
import { ModalBackdrop } from '../ModalBackdrop'
36-
import { ModalPortal } from '../../Modal/ModalPortal'
36+
import { Portal } from '../../Portal'
3737
import { ModalSurface } from '../ModalSurface'
3838
import { Dialog } from './Dialog'
3939
import { DialogManager } from './DialogManager'
@@ -72,15 +72,15 @@ describe('Click events', () => {
7272
</DialogManager>
7373
)
7474

75-
// Drawer closed
76-
expect(dialog.find(ModalPortal).exists()).toBeFalsy()
75+
// Dialog closed
76+
expect(dialog.find(Portal).exists()).toBeFalsy()
7777

7878
const button = dialog.find('a')
7979
expect(button.exists()).toBeTruthy()
8080
button.simulate('click') // Click to open
8181

82-
// Drawer open
83-
expect(dialog.find(ModalPortal).exists()).toBeTruthy()
82+
// Dialog open
83+
expect(dialog.find(Portal).exists()).toBeTruthy()
8484

8585
const backdrop = dialog.find(ModalBackdrop)
8686
expect(backdrop.exists()).toBeTruthy()
@@ -95,13 +95,13 @@ test('Dialog opens on click', () => {
9595
</DialogManager>
9696
)
9797

98-
expect(dialog.find(ModalPortal).exists()).toBeFalsy()
98+
expect(dialog.find(Portal).exists()).toBeFalsy()
9999

100100
const button = dialog.find('a')
101101
expect(button.exists()).toBeTruthy()
102102
button.simulate('click')
103103

104-
expect(dialog.find(ModalPortal).exists()).toBeTruthy()
104+
expect(dialog.find(Portal).exists()).toBeTruthy()
105105

106106
const backdrop = dialog.find(ModalBackdrop)
107107
expect(backdrop.exists()).toEqual(true)
@@ -147,11 +147,11 @@ describe('Dialog Styling', () => {
147147
test('Confirmation Dialog, Shown', () => {
148148
assertSnapshotShallow(
149149
<Dialog isOpen>
150-
<ModalHeader>Are you sure you want to delete "Stuff"?</ModalHeader>
151-
<ModalFooter>
150+
<DialogHeader>Are you sure you want to delete "Stuff"?</DialogHeader>
151+
<DialogFooter>
152152
<button>Yes, Delete "Stuff"</button>
153153
<button>Cancel</button>
154-
</ModalFooter>
154+
</DialogFooter>
155155
</Dialog>
156156
)
157157
})
File renamed without changes.

packages/components/src/Modal/Dialog/DialogManager.tsx renamed to packages/components/src/Dialog/Dialog/DialogManager.tsx

File renamed without changes.

packages/components/src/Modal/Dialog/DialogSurface.tsx renamed to packages/components/src/Dialog/Dialog/DialogSurface.tsx

File renamed without changes.

0 commit comments

Comments
 (0)