Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbaljet committed Jan 9, 2025
1 parent 1d474ea commit ab812f1
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
35 changes: 35 additions & 0 deletions docs/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,38 @@ export default function UserIndex() {

### Events

The `Modal` component emits several events that you can listen to:

`after-leave`: Triggered after the modal has been removed from the DOM.
`blur:` Triggered when the modal loses focus because another modal is opened on top of it.
`close:` Triggered when the modal is closed.
`focus:` Triggered when the modal gains focus because a modal on top of it has been closed.
`success:` Triggered when the modal has been successfully fetched and opened.

::: code-group

```vue [Vue]
<template>
<Modal @close="doSomething">
<!-- ... -->
</Modal>
</template>
```

```jsx [React]
export default function CreateUserModal() {
return (
<Modal onClose={() => doSomething()}>
{/* ... */}
</Modal>
);
}
```

:::

#### `ModalLink` Events

In addition to the `loading` prop, you can also listen to the events emitted by the `ModalLink` component. You can use the `@start` and `@success` events to show a loading spinner or text.

::: code-group
Expand Down Expand Up @@ -272,6 +304,9 @@ export default function UserIndex() {

Then there are two more events: `@close` and `@after-leave`. The `@close` event is triggered when the modal is closed, and the `@after-leave` event is triggered after the modal has been removed from the DOM.

> [!WARNING] ModalLink Events and Browser Navigation
> The `close` and `after-leave` events are not triggered when the modal is closed after navigating to it using the browser's back or forward buttons. This is because Inertia.js rerenders the page, and therefore, the `ModalLink` components. Closing the modal will not be linked to the original `ModalLink` component.
### Customizing

Just like the `Modal` component, you can pass additional props to the `ModalLink` component to customize its behavior and style. Check out the [Configuration](/configuration.html) section for a list of all available props.
Expand Down
4 changes: 2 additions & 2 deletions react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@inertiaui/modal-react",
"author": "Pascal Baljet <pascal@protone.media>",
"version": "0.17.0",
"version": "0.18.0",
"private": false,
"license": "MIT",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions vue/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inertiaui/modal-vue",
"version": "0.17.0",
"version": "0.18.0",
"author": "Pascal Baljet <pascal@protone.media>",
"private": false,
"license": "MIT",
Expand Down

0 comments on commit ab812f1

Please sign in to comment.