diff --git a/src/components/copy-connected-icon/CopyConnectedIcon.vue b/src/components/copy-connected-icon/CopyConnectedIcon.vue new file mode 100644 index 0000000..55b2773 --- /dev/null +++ b/src/components/copy-connected-icon/CopyConnectedIcon.vue @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/src/components/copy-connected-icon/index.ts b/src/components/copy-connected-icon/index.ts new file mode 100644 index 0000000..41a7c07 --- /dev/null +++ b/src/components/copy-connected-icon/index.ts @@ -0,0 +1 @@ +export { default as CopyConnectedIcon } from './CopyConnectedIcon.vue' diff --git a/src/components/sonner/Toaster.vue b/src/components/sonner/Toaster.vue index 709a54f..dfbab3d 100644 --- a/src/components/sonner/Toaster.vue +++ b/src/components/sonner/Toaster.vue @@ -1,10 +1,11 @@ @@ -75,14 +113,14 @@ onBeforeUnmount(() => document.removeEventListener('visibilitychange', onVisibil document.removeEventListener('visibilitychange', onVisibil Everything in one flat row, vertically centered. icon · title · (action) · × ──────────────────────────────────────────────────────────────────────── --> - + document.removeEventListener('visibilitychange', onVisibil - @@ -140,9 +178,28 @@ onBeforeUnmount(() => document.removeEventListener('visibilitychange', onVisibil /> {{ headingFor(t) }} - + {{ t.description }} + + {{ t.textAction.label }} + {{ t.textAction.successLabel }} + {{ t.textAction.failureLabel }} + document.removeEventListener('visibilitychange', onVisibil {{ t.action.label }} - - - + + + + + + + + + diff --git a/src/components/sonner/toast.ts b/src/components/sonner/toast.ts index ea4f51e..c5366ee 100644 --- a/src/components/sonner/toast.ts +++ b/src/components/sonner/toast.ts @@ -13,6 +13,15 @@ export interface ToastAction { onClick: () => void } +export interface ToastTextAction { + label: string + ariaLabel?: string + /** A local action leaves the notification open and reports its own result. */ + onClick: () => boolean | Promise + successLabel: string + failureLabel: string +} + export interface ToastOptions { /** Secondary line under the title. */ description?: string @@ -20,6 +29,8 @@ export interface ToastOptions { duration?: number /** Optional trailing action button. */ action?: ToastAction + /** Low-emphasis action under the message, independent of the trailing action. */ + textAction?: ToastTextAction /** Stable id — re-using one updates the existing toast in place. */ id?: string | number } @@ -32,6 +43,7 @@ export interface ToastRecord { title: string description?: string action?: ToastAction + textAction?: ToastTextAction /** True when `title` is a synthesized variant heading (the long-blob auto-shape * below), NOT caller copy. `` swaps it for a localized label when one * is supplied via the `headings` prop; the English `title` here is the fallback. */ @@ -157,6 +169,7 @@ function create(variant: ToastVariant, message: string, options?: ToastOptions): title, description, action: options?.action, + textAction: options?.textAction, autoHeading, } diff --git a/src/index.ts b/src/index.ts index c3266c4..3949377 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,6 +18,7 @@ export { useClipboard } from './lib/clipboard' export * from './components/confirm-delete-dialog/index' export * from './components/confirm-popover/index' export * from './components/context-menu/index' +export * from './components/copy-connected-icon/index' export * from './components/date-range-picker/index' export * from './components/device-code-panel/index' export * from './components/dialog/index'
+
{{ t.description }}