diff --git a/apps/www/.vitepress/theme/layout/MainLayout.vue b/apps/www/.vitepress/theme/layout/MainLayout.vue index 13ebeaf7..1b67e924 100644 --- a/apps/www/.vitepress/theme/layout/MainLayout.vue +++ b/apps/www/.vitepress/theme/layout/MainLayout.vue @@ -303,7 +303,7 @@ watch(() => $route.path, (n) => { - + diff --git a/apps/www/__registry__/index.ts b/apps/www/__registry__/index.ts index d523c9a4..4a20e476 100644 --- a/apps/www/__registry__/index.ts +++ b/apps/www/__registry__/index.ts @@ -948,6 +948,13 @@ export const Index = { component: () => import("../src/lib/registry/default/example/SonnerDemo.vue").then((m) => m.default), files: ["../src/lib/registry/default/example/SonnerDemo.vue"], }, + "SonnerWithDialog": { + name: "SonnerWithDialog", + type: "components:example", + registryDependencies: ["button","dialog"], + component: () => import("../src/lib/registry/default/example/SonnerWithDialog.vue").then((m) => m.default), + files: ["../src/lib/registry/default/example/SonnerWithDialog.vue"], + }, "SwitchDemo": { name: "SwitchDemo", type: "components:example", @@ -2349,6 +2356,13 @@ export const Index = { component: () => import("../src/lib/registry/new-york/example/SonnerDemo.vue").then((m) => m.default), files: ["../src/lib/registry/new-york/example/SonnerDemo.vue"], }, + "SonnerWithDialog": { + name: "SonnerWithDialog", + type: "components:example", + registryDependencies: ["button","dialog"], + component: () => import("../src/lib/registry/new-york/example/SonnerWithDialog.vue").then((m) => m.default), + files: ["../src/lib/registry/new-york/example/SonnerWithDialog.vue"], + }, "SwitchDemo": { name: "SwitchDemo", type: "components:example", diff --git a/apps/www/src/content/docs/components/sonner.md b/apps/www/src/content/docs/components/sonner.md index 733276b0..c78cf2e8 100644 --- a/apps/www/src/content/docs/components/sonner.md +++ b/apps/www/src/content/docs/components/sonner.md @@ -61,3 +61,23 @@ import { Button } from '@/components/ui/button' ``` + +## Examples + +### Sonner with Dialog + +Related issue https://github.com/radix-vue/shadcn-vue/issues/462 + +Add `pointer-events-auto` class to Toaster component in your `App.vue` file: + +```vue {6} + + + + + +``` + + diff --git a/apps/www/src/lib/registry/default/example/SonnerWithDialog.vue b/apps/www/src/lib/registry/default/example/SonnerWithDialog.vue new file mode 100644 index 00000000..8f836aab --- /dev/null +++ b/apps/www/src/lib/registry/default/example/SonnerWithDialog.vue @@ -0,0 +1,53 @@ + + + + + + + Dialog with toast + + + { + const target = event.target as HTMLElement; + if (target?.closest('[data-sonner-toaster]')) return event.preventDefault() + }" + > + + Vue Sonner Toast + Dialog with toast + + + { + toast('Event has been created', { + description: 'Sunday, December 03, 2023 at 9:00 AM', + action: { + label: 'Undo', + onClick: () => console.log('Undo'), + }, + }); + } + " + > + Toast + + + + + diff --git a/apps/www/src/lib/registry/new-york/example/SonnerWithDialog.vue b/apps/www/src/lib/registry/new-york/example/SonnerWithDialog.vue new file mode 100644 index 00000000..efb1305d --- /dev/null +++ b/apps/www/src/lib/registry/new-york/example/SonnerWithDialog.vue @@ -0,0 +1,53 @@ + + + + + + + Dialog with toast + + + { + const target = event.target as HTMLElement; + if (target?.closest('[data-sonner-toaster]')) return event.preventDefault() + }" + > + + Vue Sonner Toast + Dialog with toast + + + { + toast('Event has been created', { + description: 'Sunday, December 03, 2023 at 9:00 AM', + action: { + label: 'Undo', + onClick: () => console.log('Undo'), + }, + }); + } + " + > + Toast + + + + +