compote-ui 0.57.0 → 0.58.1
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/dist/components/toast/index.d.ts +4 -0
- package/dist/components/toast/index.js +3 -0
- package/dist/components/toast/toast.d.ts +1 -0
- package/dist/components/toast/toast.js +2 -0
- package/dist/components/toast/toaster.svelte +48 -0
- package/dist/components/toast/toaster.svelte.d.ts +8 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toast: import("@zag-js/toast").Store<any>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Toast, Toaster } from '@ark-ui/svelte/toast';
|
|
3
|
+
import { Portal } from '@ark-ui/svelte/portal';
|
|
4
|
+
import { cn } from 'tailwind-variants';
|
|
5
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
6
|
+
import { toast } from './toast.js';
|
|
7
|
+
import PhX from '../../icons/PhX.svelte';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
class?: ClassValue;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { class: className }: Props = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<Portal>
|
|
17
|
+
<Toaster toaster={toast}>
|
|
18
|
+
{#snippet children(toastItem)}
|
|
19
|
+
{@const t = toastItem()}
|
|
20
|
+
<Toast.Root
|
|
21
|
+
class={cn(
|
|
22
|
+
'relative min-w-80 rounded-lg border border-border bg-surface-1 p-4 pr-8 shadow-lg transition-all duration-200',
|
|
23
|
+
'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-top-2',
|
|
24
|
+
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-right-full',
|
|
25
|
+
'data-[type=success]:border-green-500/50 data-[type=success]:bg-green-50 dark:data-[type=success]:bg-green-950/30',
|
|
26
|
+
'data-[type=error]:border-red-500/50 data-[type=error]:bg-red-50 dark:data-[type=error]:bg-red-950/30',
|
|
27
|
+
'data-[type=warning]:border-yellow-500/50 data-[type=warning]:bg-yellow-50 dark:data-[type=warning]:bg-yellow-950/30',
|
|
28
|
+
'data-[type=info]:border-blue-500/50 data-[type=info]:bg-blue-50 dark:data-[type=info]:bg-blue-950/30',
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
style="translate: var(--x) var(--y); scale: var(--scale); z-index: var(--z-index); height: var(--height); opacity: var(--opacity);"
|
|
32
|
+
>
|
|
33
|
+
{#if t.title}
|
|
34
|
+
<Toast.Title class="text-sm font-medium text-ink">{t.title}</Toast.Title>
|
|
35
|
+
{/if}
|
|
36
|
+
{#if t.description}
|
|
37
|
+
<Toast.Description class="mt-1 text-sm text-ink-dim">{t.description}</Toast.Description>
|
|
38
|
+
{/if}
|
|
39
|
+
<Toast.CloseTrigger
|
|
40
|
+
class="absolute right-1.5 top-1.5 rounded p-1 text-ink-dim hover:bg-surface-2 hover:text-ink"
|
|
41
|
+
aria-label="Close notification"
|
|
42
|
+
>
|
|
43
|
+
<PhX class="size-3.5" />
|
|
44
|
+
</Toast.CloseTrigger>
|
|
45
|
+
</Toast.Root>
|
|
46
|
+
{/snippet}
|
|
47
|
+
</Toaster>
|
|
48
|
+
</Portal>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Toaster } from '@ark-ui/svelte/toast';
|
|
2
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
3
|
+
interface Props {
|
|
4
|
+
class?: ClassValue;
|
|
5
|
+
}
|
|
6
|
+
declare const Toaster: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type Toaster = ReturnType<typeof Toaster>;
|
|
8
|
+
export default Toaster;
|
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,10 @@ export { default as Splitter } from './components/splitter/splitter.svelte';
|
|
|
44
44
|
export type { SplitterPanelConfig, SplitterProps } from './components/splitter/types';
|
|
45
45
|
export { default as Switch } from './components/switch/switch.svelte';
|
|
46
46
|
export * as Tabs from './components/tabs';
|
|
47
|
+
export * as Toast from './components/toast';
|
|
48
|
+
export { toast } from './components/toast';
|
|
49
|
+
export { createToaster } from '@ark-ui/svelte/toast';
|
|
50
|
+
export type { CreateToasterReturn } from '@ark-ui/svelte/toast';
|
|
47
51
|
export { default as Toggle } from './components/toggle/toggle.svelte';
|
|
48
52
|
export type { ToggleProps, ToggleSize } from './components/toggle/types';
|
|
49
53
|
export * as ToggleGroup from './components/toggle-group';
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,9 @@ export { default as Select } from './components/select/select.svelte';
|
|
|
33
33
|
export { default as Splitter } from './components/splitter/splitter.svelte';
|
|
34
34
|
export { default as Switch } from './components/switch/switch.svelte';
|
|
35
35
|
export * as Tabs from './components/tabs';
|
|
36
|
+
export * as Toast from './components/toast';
|
|
37
|
+
export { toast } from './components/toast';
|
|
38
|
+
export { createToaster } from '@ark-ui/svelte/toast';
|
|
36
39
|
export { default as Toggle } from './components/toggle/toggle.svelte';
|
|
37
40
|
export * as ToggleGroup from './components/toggle-group';
|
|
38
41
|
export * as Menu from './components/menu';
|