Skip to content

Fix misc issues with Dialog v2 #3444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9d34436
fixes styling issues
mperrotti Jun 22, 2023
96548c3
deprecates old Dialog component
mperrotti Jun 27, 2023
328d3d1
Update generated/components.json
mperrotti Jun 27, 2023
0f81b59
moves Dialog and ConfirmationDialog to drafts directory
mperrotti Jun 27, 2023
ddb1784
adds line breaks in Dialog v2 props table's Type column to preserve t…
mperrotti Jun 27, 2023
e6b38a7
Merge branch 'mp/dialog-v2-doc-and-style-fixes' of github.com:primer/…
mperrotti Jun 27, 2023
c5499f0
adds changeset
mperrotti Jun 27, 2023
0fa32e1
Update generated/components.json
mperrotti Jun 27, 2023
da0c8d5
fixes import path in deprecated Dialog types test
mperrotti Jun 27, 2023
dd73296
Merge branch 'mp/dialog-v2-doc-and-style-fixes' of github.com:primer/…
mperrotti Jun 27, 2023
236d187
Merge branch 'next-major' into mp/dialog-v2-doc-and-style-fixes
mperrotti Jun 30, 2023
2d85959
Merge branch 'next-major' of github.com:primer/react into mp/dialog-v…
mperrotti Jul 5, 2023
475cd12
updates snapshots
mperrotti Jul 7, 2023
8d7035b
Merge branch 'next-major' into mp/dialog-v2-doc-and-style-fixes
mperrotti Jul 7, 2023
ee97546
updates import path for ConfirmationDialog checkExports test
mperrotti Jul 11, 2023
c2fc2e8
updates tests
mperrotti Jul 12, 2023
9c11a78
Merge branch 'next-major' into mp/dialog-v2-doc-and-style-fixes
mperrotti Jul 13, 2023
25c11bd
Merge branch 'next-major' of github.com:primer/react into mp/dialog-v…
mperrotti Jul 13, 2023
802a352
NavList snapshot updates for some reason?
mperrotti Jul 13, 2023
d6c1dff
un-deprecate Dialog
mperrotti Jul 14, 2023
7ce384e
mv draft Dialog types test
mperrotti Jul 14, 2023
2ea97d6
test(vrt): update snapshots
mperrotti Jul 14, 2023
5d5398b
moves test files
mperrotti Jul 19, 2023
1d8b081
Merge branch 'mp/dialog-v2-doc-and-style-fixes' of github.com:primer/…
mperrotti Jul 19, 2023
fd88d02
Merge branch 'next-major' of github.com:primer/react into mp/dialog-v…
mperrotti Jul 20, 2023
8a75245
Merge branch 'next-major' into mp/dialog-v2-doc-and-style-fixes
mperrotti Jul 21, 2023
231548e
Merge branch 'next-major' into mp/dialog-v2-doc-and-style-fixes
mperrotti Jul 21, 2023
3dba21c
Merge branch 'next-major' of github.com:primer/react into mp/dialog-v…
mperrotti Jul 25, 2023
fb1e0b6
use IconButton instead of CloseButton
mperrotti Jul 25, 2023
d64c03b
Merge branch 'next-major' of github.com:primer/react into mp/dialog-v…
mperrotti Jul 28, 2023
099b5e9
correct path to prop data in draft Dialog docs
mperrotti Jul 28, 2023
d35708f
update confirmation button snapshots
broccolinisoup Jul 31, 2023
1c21854
updates ConfirmationDialog tests for the newer Button
mperrotti Aug 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/strange-geese-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/react': major
---

Moves the new Dialog and ConfirmationDialog component to the drafts directory

<!-- Changed components: Dialog -->
2 changes: 1 addition & 1 deletion docs/content/Dialog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ status: Alpha
source: https://github.com/primer/react/blob/main/src/Dialog
---

import data from '../../src/Dialog.docs.json'
import data from '../../src/Dialog/Dialog.docs.json'

The dialog component is used for all modals. It renders on top of the rest of the app with an overlay.

Expand Down
2 changes: 1 addition & 1 deletion docs/content/drafts/Dialog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ componentId: dialog
status: Draft
---

import data from '../../../src/Dialog/Dialog.docs.json'
import data from '../../../src/drafts/Dialog2/Dialog.docs.json'

```js
import {Dialog} from '@primer/react/drafts'
Expand Down
2 changes: 0 additions & 2 deletions docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
url: /CounterLabel
- title: Details
url: /Details
- title: Dialog
url: /Dialog
- title: Flash
url: /Flash
- title: FormControl
Expand Down
2 changes: 1 addition & 1 deletion src/DataTable/ErrorDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import {ConfirmationDialog} from '../Dialog/ConfirmationDialog'
import {ConfirmationDialog} from '../drafts/Dialog2/ConfirmationDialog'

export type TableErrorDialogProps = React.PropsWithChildren<{
/**
Expand Down
54 changes: 0 additions & 54 deletions src/Dialog.docs.json

This file was deleted.

146 changes: 0 additions & 146 deletions src/Dialog.tsx

This file was deleted.

70 changes: 33 additions & 37 deletions src/Dialog/Dialog.docs.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,54 @@
{
"id": "drafts_dialog",
"id": "dialog",
"name": "Dialog",
"status": "draft",
"status": "alpha",
"a11yReviewed": false,
"stories": [],
"props": [
{
"name": "title",
"type": "React.ReactNode",
"description": "Title of the Dialog. Also serves as the aria-label for this Dialog."
"name": "isOpen",
"type": "boolean",
"description": "Whether or not the dialog is open"
},
{
"name": "subtitle",
"type": "React.ReactNode",
"description": "The Dialog's subtitle. Optional. Rendered below the title in smaller type with less contrast. Also serves as the aria-describedby for this Dialog."
"name": "onDismiss",
"type": "() => void",
"description": "Function that will be called when the dialog is closed"
},
{
"name": "renderHeader",
"type": "React.FunctionComponent<React.PropsWithChildren<DialogHeaderProps>>",
"description": "Provide a custom renderer for the dialog header. This content is rendered directly into the dialog body area, full bleed from edge to edge, top to the start of the body element. Warning: using a custom renderer may violate Primer UX principles."
"name": "returnFocusRef",
"type": " React.RefObject<HTMLElement>",
"description": "The element to restore focus back to after the `Dialog` is closed"
},
{
"name": "renderBody",
"type": "React.FunctionComponent<React.PropsWithChildren<DialogProps>>",
"description": "Provide a custom render function for the dialog body. This content is rendered directly into the dialog body area, full bleed from edge to edge, header to footer. Warning: using a custom renderer may violate Primer UX principles."
"name": "initialFocusRef",
"type": " React.RefObject<HTMLElement>",
"description": "Element inside of the `Dialog` you'd like to be focused when the Dialog is opened. If nothing is passed to `initialFocusRef` the close button is focused."
},
{
"name": "renderFooter",
"type": "React.FunctionComponent<React.PropsWithChildren<DialogProps>>",
"description": "Provide a custom render function for the dialog footer. This content is rendered directly into the dialog footer area, full bleed from edge to edge, end of the body element to bottom. Warning: using a custom renderer may violate Primer UX principles."
"name": "aria-labelledby",
"type": "string",
"description": "Pass an id to use for the aria-label. Use either a `aria-label` or an `aria-labelledby` but not both."
},
{
"name": "footerButtons",
"type": "DialogButtonProps[]",
"description": "Specifies the buttons to be rendered in the Dialog footer."
"name": "aria-label",
"type": "string",
"description": "Pass a label to be used to describe the Dialog. Use either a `aria-label` or an `aria-labelledby` but not both."
},
{
"name": "onClose",
"type": "(gesture: 'close-button' | 'escape') => void",
"description": "This method is invoked when a gesture to close the dialog is used (either an Escape key press or clicking the 'X' in the top-right corner). The gesture argument indicates the gesture that was used to close the dialog (either 'close-button' or 'escape')."
},
{
"name": "role",
"type": "'dialog' | 'alertdialog'",
"description": "The ARIA role to assign to this dialog."
},
{
"name": "width",
"type": "'small' | 'medium' | 'large' | 'xlarge'"
},
{
"name": "height",
"type": "'small' | 'large' | 'auto'"
"name": "sx",
"type": "SystemStyleObject"
}
],
"subcomponents": []
"subcomponents": [
{
"name": "Dialog.Header",
"props": [
{
"name": "sx",
"type": "SystemStyleObject"
}
]
}
]
}
4 changes: 2 additions & 2 deletions src/__tests__/Dialog.test.tsx → src/Dialog/Dialog.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useState, useRef} from 'react'
import {Dialog, Box, Text} from '..'
import {Box, Dialog, Text} from '..'
import {Button} from '../deprecated'
import {render as HTMLRender, fireEvent} from '@testing-library/react'
import {axe, toHaveNoViolations} from 'jest-axe'
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('Dialog', () => {
options: {skipAs: true, skipSx: true},
})

checkExports('Dialog', {
checkExports('Dialog/Dialog', {
default: Dialog,
})

Expand Down
Loading