Skip to content

Commit 8aee281

Browse files
authored
Merge branch 'main' into hectahertz/selectpanel-aria-multiselectable
2 parents 5891c3d + ea69ccd commit 8aee281

File tree

7 files changed

+730
-278
lines changed

7 files changed

+730
-278
lines changed

.changeset/funny-hats-sing.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Export new Dialog component from the `@primer/react/drafts` bundle:
6+
7+
```diff
8+
- import {Dialog} from '@primer/react/lib-esm/Dialog/Dialog'
9+
+ import {Dialog} from '@primer/react/drafts'
10+
```

docs/content/deprecated/Dialog.md renamed to docs/content/Dialog.md

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,8 @@
11
---
2-
title: Dialog (legacy)
3-
status: Deprecated
2+
title: Dialog
3+
status: Alpha
44
---
55

6-
## Deprecation
7-
8-
Use the [new version of Dialog](/Dialog) instead.
9-
10-
**Before**
11-
12-
```jsx deprecated
13-
<Dialog isOpen={open} onDismiss={() => setOpen(false)} aria-labelledby="header-id">
14-
<Dialog.Header id="header-id">Title</Dialog.Header>
15-
<Box p={3}>
16-
<Text fontFamily="sans-serif">Some content</Text>
17-
</Box>
18-
</Dialog>
19-
```
20-
21-
**After**
22-
23-
```jsx deprecated
24-
{
25-
open && (
26-
<Dialog
27-
title="Dialog example"
28-
subtitle={
29-
<>
30-
This is a <b>description</b> of the dialog.
31-
</>
32-
}
33-
footerButtons={[{content: 'Ok', onClick: () => setOpen(false)}]}
34-
onClose={() => setOpen(false)}
35-
>
36-
<Text fontFamily="sans-serif">Some content</Text>
37-
</Dialog>
38-
)
39-
}
40-
```
41-
426
The dialog component is used for all modals. It renders on top of the rest of the app with an overlay.
437

448
You'll need to manage the `isOpen` state in a wrapper component of your own and pass in a function to be used to close the Dialog. For documentation purposes only we've created a mock `State` to handle this, but you should handle the state in the component you consume `Dialog` in or in a wrapper component.
@@ -57,7 +21,7 @@ If you're running into z-index issues or are rendering the component inside of a
5721

5822
### Examples
5923

60-
```jsx deprecated live
24+
```jsx live
6125
<State default={false}>
6226
{([isOpen, setIsOpen]) => {
6327
const returnFocusRef = React.useRef(null)
@@ -85,7 +49,7 @@ If you're running into z-index issues or are rendering the component inside of a
8549

8650
You can also pass any non-text content into the header:
8751

88-
```jsx deprecated live
52+
```jsx live
8953
<State default={false}>
9054
{([isOpen, setIsOpen]) => {
9155
const returnFocusRef = React.useRef(null)

docs/content/Dialog.mdx renamed to docs/content/drafts/Dialog.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
---
2-
title: Dialog
2+
title: Dialog v2
33
componentId: dialog
4-
status: Alpha
4+
status: Draft
55
---
66

7-
import State from '../components/State'
7+
```js
8+
import {Dialog} from '@primer/react/drafts'
9+
```
10+
11+
import State from '../../components/State'
812

913
The dialog component the Primer implementation of the ARIA design pattern [Dialog](https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_modal). A dialog is a type of overlay that can be used for confirming actions, asking for disambiguation, and presenting small forms. They generally allow the user to focus on a quick task without having to navigate to a different page.
1014

@@ -45,7 +49,7 @@ By default, the Dialog component implements the design and interactions defined
4549

4650
### Example
4751

48-
```jsx live
52+
```jsx live drafts
4953
<State default={false}>
5054
{([isOpen, setIsOpen]) => {
5155
const openDialog = React.useCallback(() => setIsOpen(true), [setIsOpen])

0 commit comments

Comments
 (0)