@instructure/ui-dialog 8.51.1-snapshot-10 → 8.51.1-snapshot-14
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.
- package/CHANGELOG.md +1 -1
- package/package.json +9 -9
- package/src/Dialog/README.md +85 -30
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [8.51.1-snapshot-
|
|
6
|
+
## [8.51.1-snapshot-14](https://github.com/instructure/instructure-ui/compare/v8.51.0...v8.51.1-snapshot-14) (2024-02-02)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-dialog
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-dialog",
|
|
3
|
-
"version": "8.51.1-snapshot-
|
|
3
|
+
"version": "8.51.1-snapshot-14",
|
|
4
4
|
"description": "A utility component for managing keyboard accessibility and screen reader behavior",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.23.2",
|
|
27
|
-
"@instructure/shared-types": "8.51.1-snapshot-
|
|
28
|
-
"@instructure/ui-a11y-utils": "8.51.1-snapshot-
|
|
29
|
-
"@instructure/ui-dom-utils": "8.51.1-snapshot-
|
|
30
|
-
"@instructure/ui-react-utils": "8.51.1-snapshot-
|
|
31
|
-
"@instructure/ui-testable": "8.51.1-snapshot-
|
|
27
|
+
"@instructure/shared-types": "8.51.1-snapshot-14",
|
|
28
|
+
"@instructure/ui-a11y-utils": "8.51.1-snapshot-14",
|
|
29
|
+
"@instructure/ui-dom-utils": "8.51.1-snapshot-14",
|
|
30
|
+
"@instructure/ui-react-utils": "8.51.1-snapshot-14",
|
|
31
|
+
"@instructure/ui-testable": "8.51.1-snapshot-14",
|
|
32
32
|
"prop-types": "^15.8.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@instructure/console": "8.51.1-snapshot-
|
|
36
|
-
"@instructure/ui-babel-preset": "8.51.1-snapshot-
|
|
37
|
-
"@instructure/ui-prop-types": "8.51.1-snapshot-
|
|
35
|
+
"@instructure/console": "8.51.1-snapshot-14",
|
|
36
|
+
"@instructure/ui-babel-preset": "8.51.1-snapshot-14",
|
|
37
|
+
"@instructure/ui-prop-types": "8.51.1-snapshot-14",
|
|
38
38
|
"@testing-library/jest-dom": "^6.1.4",
|
|
39
39
|
"@testing-library/react": "^14.0.0",
|
|
40
40
|
"@testing-library/user-event": "^14.5.1"
|
package/src/Dialog/README.md
CHANGED
|
@@ -7,36 +7,84 @@ The `Dialog` component is a utility that is used by
|
|
|
7
7
|
|
|
8
8
|
Elements outside of the `Dialog` are hidden from screen readers automatically when `shouldContainFocus` is set to `true` or `screenreader`. The `liveRegion` prop can be used to specify any elements that should not be hidden.
|
|
9
9
|
|
|
10
|
-
```js
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
- ```js
|
|
11
|
+
class Example extends React.Component {
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(props)
|
|
14
|
+
this.state = { open: false }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
render() {
|
|
18
|
+
return (
|
|
19
|
+
<View as="div" padding="large">
|
|
20
|
+
<Button onClick={() => this.setState({ open: true })}>
|
|
21
|
+
Open the Dialog
|
|
22
|
+
</Button>
|
|
23
|
+
<Portal open={this.state.open}>
|
|
24
|
+
<Mask>
|
|
25
|
+
<Dialog
|
|
26
|
+
open={this.state.open}
|
|
27
|
+
shouldContainFocus
|
|
28
|
+
defaultFocusElement={() => this._firstName}
|
|
29
|
+
shouldReturnFocus
|
|
30
|
+
onDismiss={() => this.setState({ open: false })}
|
|
31
|
+
>
|
|
32
|
+
<View
|
|
33
|
+
as="div"
|
|
34
|
+
maxWidth="40rem"
|
|
35
|
+
maxHeight="30rem"
|
|
36
|
+
background="primary"
|
|
37
|
+
shadow="above"
|
|
38
|
+
style={{ position: 'relative' }}
|
|
39
|
+
padding="medium"
|
|
40
|
+
>
|
|
41
|
+
<CloseButton
|
|
42
|
+
placement="end"
|
|
43
|
+
onClick={() => this.setState({ open: false })}
|
|
44
|
+
screenReaderLabel="Close"
|
|
45
|
+
/>
|
|
46
|
+
<FormFieldGroup
|
|
47
|
+
description={
|
|
48
|
+
<Heading level="h4" as="span">
|
|
49
|
+
Full name
|
|
50
|
+
</Heading>
|
|
51
|
+
}
|
|
52
|
+
layout="columns"
|
|
53
|
+
>
|
|
54
|
+
<TextInput
|
|
55
|
+
width="12rem"
|
|
56
|
+
renderLabel="First"
|
|
57
|
+
inputRef={(c) => (this._firstName = c)}
|
|
58
|
+
/>
|
|
59
|
+
<TextInput width="12rem" renderLabel="Last" />
|
|
60
|
+
</FormFieldGroup>
|
|
61
|
+
</View>
|
|
62
|
+
</Dialog>
|
|
63
|
+
</Mask>
|
|
64
|
+
</Portal>
|
|
65
|
+
</View>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
19
68
|
}
|
|
20
69
|
|
|
21
|
-
render
|
|
70
|
+
render(<Example />)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- ```js
|
|
74
|
+
const Example = () => {
|
|
75
|
+
const [open, setOpen] = useState(false)
|
|
76
|
+
|
|
22
77
|
return (
|
|
23
|
-
<View
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
>
|
|
27
|
-
<Button
|
|
28
|
-
onClick={() => this.setState({ open: true })}
|
|
29
|
-
>
|
|
30
|
-
Open the Dialog
|
|
31
|
-
</Button>
|
|
32
|
-
<Portal open={this.state.open}>
|
|
78
|
+
<View as="div" padding="large">
|
|
79
|
+
<Button onClick={() => setOpen(true)}>Open the Dialog</Button>
|
|
80
|
+
<Portal open={open}>
|
|
33
81
|
<Mask>
|
|
34
82
|
<Dialog
|
|
35
|
-
open={
|
|
83
|
+
open={open}
|
|
36
84
|
shouldContainFocus
|
|
37
85
|
defaultFocusElement={() => this._firstName}
|
|
38
86
|
shouldReturnFocus
|
|
39
|
-
onDismiss={() =>
|
|
87
|
+
onDismiss={() => setOpen(false)}
|
|
40
88
|
>
|
|
41
89
|
<View
|
|
42
90
|
as="div"
|
|
@@ -44,19 +92,27 @@ class Example extends React.Component {
|
|
|
44
92
|
maxHeight="30rem"
|
|
45
93
|
background="primary"
|
|
46
94
|
shadow="above"
|
|
47
|
-
style={{position: 'relative'}}
|
|
95
|
+
style={{ position: 'relative' }}
|
|
48
96
|
padding="medium"
|
|
49
97
|
>
|
|
50
98
|
<CloseButton
|
|
51
99
|
placement="end"
|
|
52
|
-
onClick={() =>
|
|
100
|
+
onClick={() => setOpen(false)}
|
|
53
101
|
screenReaderLabel="Close"
|
|
54
102
|
/>
|
|
55
103
|
<FormFieldGroup
|
|
56
|
-
description={
|
|
104
|
+
description={
|
|
105
|
+
<Heading level="h4" as="span">
|
|
106
|
+
Full name
|
|
107
|
+
</Heading>
|
|
108
|
+
}
|
|
57
109
|
layout="columns"
|
|
58
110
|
>
|
|
59
|
-
<TextInput
|
|
111
|
+
<TextInput
|
|
112
|
+
width="12rem"
|
|
113
|
+
renderLabel="First"
|
|
114
|
+
inputRef={(c) => (this._firstName = c)}
|
|
115
|
+
/>
|
|
60
116
|
<TextInput width="12rem" renderLabel="Last" />
|
|
61
117
|
</FormFieldGroup>
|
|
62
118
|
</View>
|
|
@@ -66,16 +122,15 @@ class Example extends React.Component {
|
|
|
66
122
|
</View>
|
|
67
123
|
)
|
|
68
124
|
}
|
|
69
|
-
}
|
|
70
125
|
|
|
71
|
-
render(<Example />)
|
|
72
|
-
```
|
|
126
|
+
render(<Example />)
|
|
127
|
+
```
|
|
73
128
|
|
|
74
129
|
### Guidelines
|
|
75
130
|
|
|
76
131
|
```js
|
|
77
132
|
---
|
|
78
|
-
|
|
133
|
+
type: embed
|
|
79
134
|
---
|
|
80
135
|
<Guidelines>
|
|
81
136
|
<Figure recommendation="a11y" title="Accessibility">
|