Skip to content

Commit 2c21308

Browse files
committed
📝 Updated documentation and changelog
1 parent a11b72b commit 2c21308

File tree

2 files changed

+79
-1
lines changed

2 files changed

+79
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.5.0] - 2019-04-16
9+
10+
### Changed
11+
- Upgraded to `portal-vue@2.1.0` which required refactoring parts of the implementation.
12+
- Upgraded development dependencies.
13+
814
## [0.4.2] - 2019-02-21
915

1016
### Fixed

README.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Vue A11yDialog
22

3-
This is a Vue.js wrapper component for [`a11y-dialog@5.2.0`](https://github.com/edenspiekermann/a11y-dialog) ([**demo**](https://codesandbox.io/s/rj20wr1kpp)) using [PortalVue](https://github.com/LinusBorg/portal-vue).
3+
This is a Vue.js wrapper component for [`a11y-dialog@5.2.0`](https://github.com/edenspiekermann/a11y-dialog) ([**demo**](https://codesandbox.io/s/rj20wr1kpp)) using [PortalVue@2.1.0](https://github.com/LinusBorg/portal-vue).
44

55
- [Install](#install)
66
- [Usage](#usage)
7+
- [Multiple dialogs](#multiple-dialogs)
78
- [API](#api)
89
- [Events](#events)
910
- [Slots](#slots)
@@ -105,11 +106,72 @@ export default {
105106
}
106107
```
107108

109+
### Multiple dialogs
110+
111+
It's possible to use multiple dialogs in the same component, just make sure to assign the different `dialog` instances separately.
112+
113+
In your `<template>`:
114+
115+
```html
116+
<template>
117+
<div id="app">
118+
<!-- First dialog -->
119+
<a11y-dialog
120+
id="first-dialog"
121+
app-root="#app"
122+
dialog-root="#dialog-root"
123+
@dialog-ref="dialog => assignDialogRef('first', dialog)"
124+
>
125+
<template v-slot:title>
126+
<span>First dialog title</span>
127+
</template>
128+
<div>
129+
<p>Your content</p>
130+
</div>
131+
</a11y-dialog>
132+
133+
<!-- Second dialog -->
134+
<a11y-dialog
135+
id="second-dialog"
136+
app-root="#app"
137+
dialog-root="#dialog-root"
138+
@dialog-ref="dialog => assignDialogRef('second', dialog)"
139+
>
140+
<template v-slot:title>
141+
<span>Second dialog title</span>
142+
</template>
143+
<div>
144+
<p>Your content</p>
145+
</div>
146+
</a11y-dialog>
147+
</div>
148+
</template>
149+
```
150+
151+
In your `<script>`:
152+
```js
153+
import { A11yDialog } from 'vue-a11y-dialog'
154+
export default {
155+
name: 'YourComponent',
156+
157+
data: () => ({
158+
dialogs: {}
159+
}),
160+
161+
methods: {
162+
assignDialogRef (type, dialog) {
163+
this.dialogs[type] = dialog
164+
}
165+
}
166+
}
167+
168+
108169
## API
109170

110171
> All `a11y-dialog` instance methods are available, see their [docs](https://github.com/edenspiekermann/a11y-dialog#js-api) for more.
111172

112173
### `disable-native`
174+
113175
- **Property**: `disable-native`
114176
- **Type**: `Boolean`
115177
- **Default**: `false`
@@ -122,6 +184,7 @@ export default {
122184
```
123185
124186
### `id`
187+
125188
- **Property**: `id`
126189
- **Type**: `String`
127190
- **Required**: `true`
@@ -134,6 +197,7 @@ export default {
134197
```
135198
136199
### `app-root`
200+
137201
- **Property**: `app-root`
138202
- **Type**: `String`, `Array<String>` — CSS Selector string.
139203
- **Required**: `true`
@@ -146,6 +210,7 @@ export default {
146210
```
147211
148212
### `dialog-root`
213+
149214
- **Property**: `dialog-root`
150215
- **Type**: `String` — CSS Selector string.
151216
- **Required**: `true`
@@ -158,6 +223,7 @@ export default {
158223
```
159224
160225
### `class-names`
226+
161227
- **Property**: `class-names`
162228
- **Type**: `Object`
163229
- **Required**: `false`
@@ -171,6 +237,7 @@ export default {
171237
```
172238
173239
### `title-id`
240+
174241
- **Property**: `title-id`
175242
- **Type**: `String`
176243
- **Required**: `false`
@@ -184,6 +251,7 @@ export default {
184251
```
185252
186253
### `close-button-label`
254+
187255
- **Property**: `close-button-label`
188256
- **Type**: `String`
189257
- **Required**: `false`
@@ -197,6 +265,7 @@ export default {
197265
```
198266
199267
### `role`
268+
200269
- **Property**: `role`
201270
- **Type**: `String`
202271
- **Required**: `false`
@@ -212,6 +281,7 @@ export default {
212281
## Events
213282
214283
### `dialog-ref`
284+
215285
- **Returns**: An `a11y-dialog` instance or `undefined`.
216286
- **Description**: This event emits the `a11y-dialog` instance once the component has been initialised. When it gets `destroyed`, the event returns `undefined`. This is needed to call instance methods of the dialog, e.g. `this.dialog.show()`.
217287
- **Usage**:
@@ -234,6 +304,7 @@ export default {
234304
## Slots
235305
236306
### `title`
307+
237308
- **Name**: `title`
238309
- **Description**: The title of the dialog, mandatory in the document to provide context to assistive technology. Could be [hidden with CSS](https://hugogiraudel.com/2016/10/13/css-hide-and-seek/) (while remaining accessible).
239310
- **Usage**:
@@ -247,6 +318,7 @@ export default {
247318
```
248319
249320
### `closeButtonContent`
321+
250322
- **Name**: `closeButtonLabel`
251323
- **Default**: `\u00D7` (×)
252324
- **Description**: The string that is the inner HTML of the close button.

0 commit comments

Comments
 (0)