@svelte-atoms/core 1.0.0-alpha.27 → 1.0.0-alpha.28
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/README.md +856 -645
- package/dist/components/accordion/accordion-root.svelte +61 -61
- package/dist/components/accordion/item/accordion-item-body.svelte +42 -42
- package/dist/components/accordion/item/accordion-item-header.svelte +50 -50
- package/dist/components/accordion/item/accordion-item-indicator.svelte +50 -50
- package/dist/components/accordion/item/accordion-item-root.svelte +65 -65
- package/dist/components/alert/alert-actions.svelte +2 -1
- package/dist/components/alert/alert-close-button.svelte +18 -20
- package/dist/components/alert/alert-content.svelte +2 -1
- package/dist/components/alert/alert-description.svelte +2 -1
- package/dist/components/alert/alert-icon.svelte +2 -1
- package/dist/components/alert/alert-root.svelte +3 -2
- package/dist/components/alert/alert-title.svelte +2 -1
- package/dist/components/alert/alert.stories.svelte +401 -40
- package/dist/components/alert/alert.stories.svelte.d.ts +2 -5
- package/dist/components/atom/html-atom.svelte +205 -201
- package/dist/components/atom/snippet-renderer.svelte +5 -0
- package/dist/components/atom/snippet-renderer.svelte.d.ts +5 -0
- package/dist/components/avatar/avatar.stories.svelte.d.ts +1 -1
- package/dist/components/badge/badge.stories.svelte.d.ts +1 -1
- package/dist/components/breadcrumb/breadcrumb.stories.svelte.d.ts +1 -1
- package/dist/components/button/button.stories.svelte +60 -57
- package/dist/components/calendar/atoms.d.ts +5 -0
- package/dist/components/calendar/atoms.js +5 -0
- package/dist/components/calendar/bond.svelte.d.ts +72 -0
- package/dist/components/calendar/bond.svelte.js +132 -0
- package/dist/components/calendar/calendar-body.svelte +107 -0
- package/dist/components/calendar/calendar-body.svelte.d.ts +8 -0
- package/dist/components/calendar/calendar-day.svelte +97 -0
- package/dist/components/calendar/calendar-day.svelte.d.ts +4 -0
- package/dist/components/calendar/calendar-header.svelte +33 -0
- package/dist/components/calendar/calendar-header.svelte.d.ts +7 -0
- package/dist/components/calendar/calendar-root.svelte +208 -0
- package/dist/components/calendar/calendar-root.svelte.d.ts +8 -0
- package/dist/components/calendar/calendar-week-day.svelte +34 -0
- package/dist/components/calendar/calendar-week-day.svelte.d.ts +9 -0
- package/dist/components/calendar/calendar.css +26 -0
- package/dist/components/calendar/calendar.stories.svelte +36 -0
- package/dist/components/calendar/calendar.stories.svelte.d.ts +6 -0
- package/dist/components/calendar/index.d.ts +4 -0
- package/dist/components/calendar/index.js +4 -0
- package/dist/components/calendar/runes.svelte.d.ts +3 -0
- package/dist/components/calendar/runes.svelte.js +25 -0
- package/dist/components/calendar/types.d.ts +62 -0
- package/dist/components/calendar/types.js +1 -0
- package/dist/components/card/card-body.svelte +39 -39
- package/dist/components/card/card-description.svelte +41 -41
- package/dist/components/card/card-footer.svelte +41 -41
- package/dist/components/card/card-header.svelte +41 -41
- package/dist/components/card/card-media.svelte +41 -41
- package/dist/components/card/card-root.svelte +91 -91
- package/dist/components/card/card-subtitle.svelte +41 -41
- package/dist/components/card/card-title.svelte +45 -45
- package/dist/components/collapsible/collapsible-body.svelte +39 -39
- package/dist/components/collapsible/collapsible-header.svelte +39 -39
- package/dist/components/collapsible/collapsible-indicator.svelte +50 -50
- package/dist/components/collapsible/collapsible-root.svelte +66 -66
- package/dist/components/combobox/combobox-root.svelte +65 -65
- package/dist/components/container/container.stories.svelte.d.ts +1 -1
- package/dist/components/contextmenu/contextmenu-trigger.svelte.d.ts +1 -1
- package/dist/components/datagrid/bond.svelte.d.ts +2 -2
- package/dist/components/datagrid/datagrid-body.svelte +37 -37
- package/dist/components/datagrid/datagrid-checkbox.svelte +101 -101
- package/dist/components/datagrid/datagrid-footer.svelte +34 -34
- package/dist/components/datagrid/datagrid-header.svelte +49 -49
- package/dist/components/datagrid/datagrid-root.svelte +59 -59
- package/dist/components/datagrid/td/datagrid-td.svelte +66 -66
- package/dist/components/datagrid/th/datagrid-th.svelte +106 -106
- package/dist/components/datagrid/tr/datagrid-tr.svelte +88 -88
- package/dist/components/date-picker/atoms.d.ts +7 -0
- package/dist/components/date-picker/atoms.js +7 -0
- package/dist/components/date-picker/bond.svelte.d.ts +67 -0
- package/dist/components/date-picker/bond.svelte.js +174 -0
- package/dist/components/date-picker/date-picker-calendar.svelte +42 -0
- package/dist/components/date-picker/date-picker-calendar.svelte.d.ts +7 -0
- package/dist/components/date-picker/date-picker-header.svelte +105 -0
- package/dist/components/date-picker/date-picker-header.svelte.d.ts +7 -0
- package/dist/components/date-picker/date-picker-months.svelte +150 -0
- package/dist/components/date-picker/date-picker-months.svelte.d.ts +7 -0
- package/dist/components/date-picker/date-picker-root.svelte +94 -0
- package/dist/components/date-picker/date-picker-root.svelte.d.ts +17 -0
- package/dist/components/date-picker/date-picker-years.svelte +214 -0
- package/dist/components/date-picker/date-picker-years.svelte.d.ts +7 -0
- package/dist/components/date-picker/date-picker.stories.svelte +51 -0
- package/dist/components/date-picker/date-picker.stories.svelte.d.ts +3 -0
- package/dist/components/date-picker/index.d.ts +3 -0
- package/dist/components/date-picker/index.js +3 -0
- package/dist/components/date-picker/types.d.ts +1 -0
- package/dist/components/date-picker/types.js +1 -0
- package/dist/components/dialog/dialog-body.svelte +39 -39
- package/dist/components/dialog/dialog-close-button.svelte +58 -58
- package/dist/components/dialog/dialog-content.svelte +62 -62
- package/dist/components/dialog/dialog-description.svelte +40 -40
- package/dist/components/dialog/dialog-footer.svelte +39 -39
- package/dist/components/dialog/dialog-header.svelte +39 -39
- package/dist/components/dialog/dialog-root.svelte +110 -110
- package/dist/components/dialog/dialog-title.svelte +41 -41
- package/dist/components/drawer/drawer-backdrop.svelte +38 -38
- package/dist/components/drawer/drawer-body.svelte +42 -42
- package/dist/components/drawer/drawer-content.svelte +42 -42
- package/dist/components/drawer/drawer-description.svelte +44 -44
- package/dist/components/drawer/drawer-footer.svelte +41 -41
- package/dist/components/drawer/drawer-header.svelte +43 -43
- package/dist/components/drawer/drawer-root.svelte +93 -93
- package/dist/components/drawer/drawer-title.svelte +44 -44
- package/dist/components/dropdown/dropdown-query.svelte +54 -54
- package/dist/components/dropdown/dropdown-root.svelte +59 -59
- package/dist/components/dropdown/dropdown-trigger.svelte +41 -41
- package/dist/components/dropdown/dropdown-value.svelte +60 -60
- package/dist/components/element/html-element.svelte +85 -85
- package/dist/components/form/bond.svelte.d.ts +1 -1
- package/dist/components/form/field/field-control.svelte +48 -48
- package/dist/components/form/field/field-label.svelte +24 -24
- package/dist/components/form/field/field-root.svelte +59 -59
- package/dist/components/icon/icon.svelte +44 -44
- package/dist/components/image/image.stories.svelte.d.ts +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/input/input-control.svelte +103 -103
- package/dist/components/label/label.svelte +25 -25
- package/dist/components/popover/popover-arrow.svelte +111 -111
- package/dist/components/popover/popover-content.svelte +46 -7
- package/dist/components/popover/popover-root.svelte +48 -49
- package/dist/components/popover/popover.stories.svelte +52 -67
- package/dist/components/portal/portal-root.svelte +83 -83
- package/dist/components/portal/teleport.svelte +50 -50
- package/dist/components/qr-code/index.d.ts +1 -0
- package/dist/components/qr-code/index.js +1 -0
- package/dist/components/qr-code/qr-code.stories.svelte +24 -0
- package/dist/components/qr-code/qr-code.stories.svelte.d.ts +26 -0
- package/dist/components/qr-code/qr-code.svelte +25 -0
- package/dist/components/qr-code/qr-code.svelte.d.ts +6 -0
- package/dist/components/radio/radio.svelte +109 -109
- package/dist/components/radio/types.svelte.d.ts +1 -1
- package/dist/components/scrollable/scrollable-container.svelte +82 -82
- package/dist/components/scrollable/scrollable-content.svelte +41 -41
- package/dist/components/scrollable/scrollable-root.svelte +100 -100
- package/dist/components/scrollable/scrollable-thumb.svelte +75 -75
- package/dist/components/scrollable/scrollable-track.svelte +59 -59
- package/dist/components/scrollable/scrollable.stories.svelte.d.ts +1 -1
- package/dist/components/tabs/tab/tab-body.svelte +52 -52
- package/dist/components/tabs/tab/tab-description.svelte +41 -41
- package/dist/components/tabs/tab/tab-header.svelte +71 -71
- package/dist/components/tabs/tab/tab-root.svelte +86 -86
- package/dist/components/toast/toast-description.svelte +38 -38
- package/dist/components/toast/toast-root.svelte +61 -61
- package/dist/components/toast/toast-title.svelte +35 -35
- package/dist/components/tree/tree-body.svelte +39 -39
- package/dist/components/tree/tree-header.svelte +54 -54
- package/dist/components/tree/tree-indicator.svelte +40 -40
- package/dist/components/tree/tree-root.svelte +65 -65
- package/dist/components/virtual/virtual-root.svelte +239 -239
- package/dist/context/preset.svelte.d.ts +1 -1
- package/dist/icons/icon-arrow-down.svelte.d.ts +1 -1
- package/dist/icons/icon-checkmark.svelte.d.ts +1 -1
- package/dist/icons/icon-close.svelte.d.ts +1 -1
- package/dist/icons/icon-more-vert.svelte.d.ts +1 -1
- package/dist/runes/container.svelte.d.ts +2 -2
- package/dist/shared/bond.svelte.d.ts +1 -1
- package/dist/utils/state.d.ts +1 -1
- package/dist/utils/state.js +2 -1
- package/llm/variants.md +1261 -712
- package/package.json +464 -437
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
let {
|
|
10
10
|
class: klass = '',
|
|
11
11
|
base = Icon,
|
|
12
|
+
preset = 'alert.icon',
|
|
12
13
|
children = undefined,
|
|
13
14
|
onmount = undefined,
|
|
14
15
|
ondestroy = undefined,
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
<HtmlAtom
|
|
29
30
|
{bond}
|
|
30
31
|
{base}
|
|
31
|
-
preset
|
|
32
|
+
{preset}
|
|
32
33
|
class={[
|
|
33
34
|
'alert-icon border-border inline-flex aspect-square h-5 items-center justify-center rounded-full text-sm font-medium',
|
|
34
35
|
'$preset',
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
9
|
class: klass = '',
|
|
10
|
+
preset = 'alert',
|
|
10
11
|
dismissible = false,
|
|
11
12
|
dismissed = $bindable(false),
|
|
12
13
|
disabled = false,
|
|
@@ -76,9 +77,9 @@
|
|
|
76
77
|
</script>
|
|
77
78
|
|
|
78
79
|
<HtmlAtom
|
|
79
|
-
preset
|
|
80
|
+
{preset}
|
|
80
81
|
class={[
|
|
81
|
-
'alert border-border relative flex gap-
|
|
82
|
+
'alert border-border relative flex gap-1 rounded-md border p-4 transition-all duration-200',
|
|
82
83
|
// Base styles
|
|
83
84
|
'bg-background text-foreground',
|
|
84
85
|
// State styles
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
let {
|
|
9
9
|
as = 'h4' as E,
|
|
10
10
|
class: klass = '',
|
|
11
|
+
preset = 'alert.title',
|
|
11
12
|
children = undefined,
|
|
12
13
|
onmount = undefined,
|
|
13
14
|
ondestroy = undefined,
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
<HtmlAtom
|
|
28
29
|
{as}
|
|
29
30
|
{bond}
|
|
30
|
-
preset
|
|
31
|
+
{preset}
|
|
31
32
|
class={['alert-title border-border text-sm leading-tight font-medium', '$preset', klass]}
|
|
32
33
|
onmount={onmount?.bind(bond.state)}
|
|
33
34
|
ondestroy={ondestroy?.bind(bond.state)}
|
|
@@ -1,40 +1,401 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Root from '../root/root.svelte';
|
|
4
|
-
import { Alert as AAlert } from './index';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
parameters: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Root from '../root/root.svelte';
|
|
4
|
+
import { Alert as AAlert } from './index';
|
|
5
|
+
import { Button } from '../button';
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
|
+
import { cn } from '../../utils';
|
|
8
|
+
|
|
9
|
+
const { Story } = defineMeta({
|
|
10
|
+
title: 'Atoms/Alert',
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'fullscreen'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
let dismissedState = $state(false);
|
|
19
|
+
let autoHideState = $state(false);
|
|
20
|
+
|
|
21
|
+
// Auto-hide demo
|
|
22
|
+
$effect(() => {
|
|
23
|
+
if (autoHideState) {
|
|
24
|
+
const timer = setTimeout(() => {
|
|
25
|
+
autoHideState = false;
|
|
26
|
+
}, 5000);
|
|
27
|
+
return () => clearTimeout(timer);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
{#snippet alertLayout({ children, class: klass, ...args })}
|
|
33
|
+
{@const gridTemplateAreas = `"icon title close-button" ". description description" "content content content" "actions actions actions"`}
|
|
34
|
+
{@const gridTemplateColumns = `auto 1fr auto`}
|
|
35
|
+
|
|
36
|
+
<div
|
|
37
|
+
{...args}
|
|
38
|
+
class={cn(klass, 'grid items-center')}
|
|
39
|
+
style:grid-template-areas={gridTemplateAreas}
|
|
40
|
+
style:grid-template-columns={gridTemplateColumns}
|
|
41
|
+
>
|
|
42
|
+
{@render children?.()}
|
|
43
|
+
</div>
|
|
44
|
+
{/snippet}
|
|
45
|
+
|
|
46
|
+
<Story name="All Variants">
|
|
47
|
+
<Root class="space-y-6 p-8">
|
|
48
|
+
<div class="space-y-4">
|
|
49
|
+
<h2 class="text-2xl font-bold">Alert Variants</h2>
|
|
50
|
+
|
|
51
|
+
<!-- Info Alert -->
|
|
52
|
+
<AAlert.Root base={alertLayout} variant="info">
|
|
53
|
+
<AAlert.Icon>
|
|
54
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
55
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
56
|
+
<path d="M12 16v-4M12 8h.01"></path>
|
|
57
|
+
</svg>
|
|
58
|
+
</AAlert.Icon>
|
|
59
|
+
<AAlert.Title>New Feature Available</AAlert.Title>
|
|
60
|
+
<AAlert.Description>
|
|
61
|
+
We've added dark mode support to your dashboard. Try it out in the settings panel.
|
|
62
|
+
</AAlert.Description>
|
|
63
|
+
<AAlert.Content></AAlert.Content>
|
|
64
|
+
</AAlert.Root>
|
|
65
|
+
|
|
66
|
+
<!-- Success Alert -->
|
|
67
|
+
<AAlert.Root base={alertLayout} variant="success">
|
|
68
|
+
<AAlert.Icon>
|
|
69
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
70
|
+
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
|
|
71
|
+
<polyline points="22 4 12 14.01 9 11.01"></polyline>
|
|
72
|
+
</svg>
|
|
73
|
+
</AAlert.Icon>
|
|
74
|
+
<AAlert.Title>Changes Saved Successfully</AAlert.Title>
|
|
75
|
+
<AAlert.Description>
|
|
76
|
+
Your profile settings have been updated and synced across all devices.
|
|
77
|
+
</AAlert.Description>
|
|
78
|
+
<AAlert.Content></AAlert.Content>
|
|
79
|
+
</AAlert.Root>
|
|
80
|
+
|
|
81
|
+
<!-- Warning Alert -->
|
|
82
|
+
<AAlert.Root base={alertLayout} variant="warning">
|
|
83
|
+
<AAlert.Icon>
|
|
84
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
85
|
+
<path
|
|
86
|
+
d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"
|
|
87
|
+
></path>
|
|
88
|
+
<line x1="12" y1="9" x2="12" y2="13"></line>
|
|
89
|
+
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
|
90
|
+
</svg>
|
|
91
|
+
</AAlert.Icon>
|
|
92
|
+
<AAlert.Title>Storage Almost Full</AAlert.Title>
|
|
93
|
+
<AAlert.Description>
|
|
94
|
+
You're using 90% of your storage quota. Consider upgrading your plan or removing unused
|
|
95
|
+
files.
|
|
96
|
+
</AAlert.Description>
|
|
97
|
+
<AAlert.Content></AAlert.Content>
|
|
98
|
+
</AAlert.Root>
|
|
99
|
+
|
|
100
|
+
<!-- Error Alert -->
|
|
101
|
+
<AAlert.Root base={alertLayout} variant="error">
|
|
102
|
+
<AAlert.Icon>
|
|
103
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
104
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
105
|
+
<line x1="15" y1="9" x2="9" y2="15"></line>
|
|
106
|
+
<line x1="9" y1="9" x2="15" y2="15"></line>
|
|
107
|
+
</svg>
|
|
108
|
+
</AAlert.Icon>
|
|
109
|
+
<AAlert.Title>Payment Failed</AAlert.Title>
|
|
110
|
+
<AAlert.Description>
|
|
111
|
+
We couldn't process your payment. Please check your payment method and try again.
|
|
112
|
+
</AAlert.Description>
|
|
113
|
+
<AAlert.Content></AAlert.Content>
|
|
114
|
+
</AAlert.Root>
|
|
115
|
+
</div>
|
|
116
|
+
</Root>
|
|
117
|
+
</Story>
|
|
118
|
+
|
|
119
|
+
<Story name="Dismissible">
|
|
120
|
+
<Root class="space-y-6 p-8">
|
|
121
|
+
<div class="space-y-4">
|
|
122
|
+
<h2 class="text-2xl font-bold">Dismissible Alerts</h2>
|
|
123
|
+
|
|
124
|
+
<AAlert.Root base={alertLayout} variant="info" dismissible bind:dismissed={dismissedState}>
|
|
125
|
+
<AAlert.Icon>
|
|
126
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
127
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
128
|
+
<path d="M12 16v-4M12 8h.01"></path>
|
|
129
|
+
</svg>
|
|
130
|
+
</AAlert.Icon>
|
|
131
|
+
<AAlert.Title>Cookie Preferences</AAlert.Title>
|
|
132
|
+
<AAlert.Description>
|
|
133
|
+
We use cookies to enhance your experience. You can manage your preferences in settings.
|
|
134
|
+
</AAlert.Description>
|
|
135
|
+
<AAlert.Content></AAlert.Content>
|
|
136
|
+
<AAlert.CloseButton>
|
|
137
|
+
<Icon class="h-full">
|
|
138
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
139
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
140
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
141
|
+
</svg>
|
|
142
|
+
</Icon>
|
|
143
|
+
</AAlert.CloseButton>
|
|
144
|
+
</AAlert.Root>
|
|
145
|
+
|
|
146
|
+
{#if dismissedState}
|
|
147
|
+
<Button onclick={() => (dismissedState = false)}>Restore Alert</Button>
|
|
148
|
+
{/if}
|
|
149
|
+
|
|
150
|
+
<AAlert.Root base={alertLayout} variant="warning" dismissible>
|
|
151
|
+
<AAlert.Icon>
|
|
152
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
153
|
+
<path
|
|
154
|
+
d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"
|
|
155
|
+
></path>
|
|
156
|
+
<line x1="12" y1="9" x2="12" y2="13"></line>
|
|
157
|
+
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
|
158
|
+
</svg>
|
|
159
|
+
</AAlert.Icon>
|
|
160
|
+
<AAlert.Title>Beta Feature Warning</AAlert.Title>
|
|
161
|
+
<AAlert.Description>
|
|
162
|
+
You're using a beta feature. Some functionality may be unstable or change without notice.
|
|
163
|
+
</AAlert.Description>
|
|
164
|
+
<AAlert.Content></AAlert.Content>
|
|
165
|
+
<AAlert.CloseButton>
|
|
166
|
+
<Icon class="h-full">
|
|
167
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
168
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
169
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
170
|
+
</svg>
|
|
171
|
+
</Icon>
|
|
172
|
+
</AAlert.CloseButton>
|
|
173
|
+
</AAlert.Root>
|
|
174
|
+
</div>
|
|
175
|
+
</Root>
|
|
176
|
+
</Story>
|
|
177
|
+
|
|
178
|
+
<Story name="With Actions">
|
|
179
|
+
<Root class="space-y-6 p-8">
|
|
180
|
+
<div class="space-y-4">
|
|
181
|
+
<h2 class="text-2xl font-bold">Alerts with Action Buttons</h2>
|
|
182
|
+
|
|
183
|
+
<AAlert.Root base={alertLayout} variant="info">
|
|
184
|
+
<AAlert.Icon>
|
|
185
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
186
|
+
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path>
|
|
187
|
+
<path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
|
|
188
|
+
</svg>
|
|
189
|
+
</AAlert.Icon>
|
|
190
|
+
<AAlert.Title>System Update Available</AAlert.Title>
|
|
191
|
+
<AAlert.Description>
|
|
192
|
+
A new version is ready to install. Update now to get the latest features and security
|
|
193
|
+
improvements.
|
|
194
|
+
</AAlert.Description>
|
|
195
|
+
<AAlert.Actions>
|
|
196
|
+
<Button variant="primary" size="sm">Update Now</Button>
|
|
197
|
+
<Button variant="ghost" size="sm">Remind Me Later</Button>
|
|
198
|
+
</AAlert.Actions>
|
|
199
|
+
<AAlert.Content></AAlert.Content>
|
|
200
|
+
</AAlert.Root>
|
|
201
|
+
|
|
202
|
+
<AAlert.Root base={alertLayout} variant="error" dismissible>
|
|
203
|
+
<AAlert.Icon>
|
|
204
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
205
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
206
|
+
<line x1="15" y1="9" x2="9" y2="15"></line>
|
|
207
|
+
<line x1="9" y1="9" x2="15" y2="15"></line>
|
|
208
|
+
</svg>
|
|
209
|
+
</AAlert.Icon>
|
|
210
|
+
<AAlert.Title>Verification Required</AAlert.Title>
|
|
211
|
+
<AAlert.Description>
|
|
212
|
+
Your account needs verification before you can access premium features.
|
|
213
|
+
</AAlert.Description>
|
|
214
|
+
<AAlert.Actions>
|
|
215
|
+
<Button variant="destructive" size="sm">Verify Account</Button>
|
|
216
|
+
<Button variant="outline" size="sm">Learn More</Button>
|
|
217
|
+
</AAlert.Actions>
|
|
218
|
+
<AAlert.Content></AAlert.Content>
|
|
219
|
+
<AAlert.CloseButton>
|
|
220
|
+
<Icon class="h-full">
|
|
221
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
222
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
223
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
224
|
+
</svg>
|
|
225
|
+
</Icon>
|
|
226
|
+
</AAlert.CloseButton>
|
|
227
|
+
</AAlert.Root>
|
|
228
|
+
|
|
229
|
+
<AAlert.Root base={alertLayout} variant="success">
|
|
230
|
+
<AAlert.Icon>
|
|
231
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
232
|
+
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
|
|
233
|
+
<polyline points="22 4 12 14.01 9 11.01"></polyline>
|
|
234
|
+
</svg>
|
|
235
|
+
</AAlert.Icon>
|
|
236
|
+
<AAlert.Title>Backup Completed</AAlert.Title>
|
|
237
|
+
<AAlert.Description>
|
|
238
|
+
All your data has been backed up successfully. Last backup: just now.
|
|
239
|
+
</AAlert.Description>
|
|
240
|
+
<AAlert.Actions>
|
|
241
|
+
<Button variant="outline" size="sm">View Details</Button>
|
|
242
|
+
</AAlert.Actions>
|
|
243
|
+
<AAlert.Content></AAlert.Content>
|
|
244
|
+
</AAlert.Root>
|
|
245
|
+
</div>
|
|
246
|
+
</Root>
|
|
247
|
+
</Story>
|
|
248
|
+
|
|
249
|
+
<Story name="Minimal">
|
|
250
|
+
<Root class="space-y-6 p-8">
|
|
251
|
+
<div class="space-y-4">
|
|
252
|
+
<h2 class="text-2xl font-bold">Minimal Alerts</h2>
|
|
253
|
+
|
|
254
|
+
<AAlert.Root variant="info">
|
|
255
|
+
<AAlert.Content>Quick tip: Press Ctrl+K to open the command palette.</AAlert.Content>
|
|
256
|
+
</AAlert.Root>
|
|
257
|
+
|
|
258
|
+
<AAlert.Root variant="success">
|
|
259
|
+
<AAlert.Content>Your changes have been saved automatically.</AAlert.Content>
|
|
260
|
+
</AAlert.Root>
|
|
261
|
+
|
|
262
|
+
<AAlert.Root variant="warning">
|
|
263
|
+
<AAlert.Content>Your session will expire in 5 minutes.</AAlert.Content>
|
|
264
|
+
<AAlert.Content></AAlert.Content>
|
|
265
|
+
</AAlert.Root>
|
|
266
|
+
|
|
267
|
+
<AAlert.Root variant="error">
|
|
268
|
+
<AAlert.Content>Connection lost. Attempting to reconnect...</AAlert.Content>
|
|
269
|
+
</AAlert.Root>
|
|
270
|
+
</div>
|
|
271
|
+
</Root>
|
|
272
|
+
</Story>
|
|
273
|
+
|
|
274
|
+
<Story name="Real-World Examples">
|
|
275
|
+
<Root class="space-y-6 p-8">
|
|
276
|
+
<div class="space-y-4">
|
|
277
|
+
<h2 class="text-2xl font-bold">Real-World Use Cases</h2>
|
|
278
|
+
|
|
279
|
+
<!-- Newsletter Subscription -->
|
|
280
|
+
<AAlert.Root base={alertLayout} variant="success" dismissible>
|
|
281
|
+
<AAlert.Icon>
|
|
282
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
283
|
+
<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"
|
|
284
|
+
></path>
|
|
285
|
+
<polyline points="22,6 12,13 2,6"></polyline>
|
|
286
|
+
</svg>
|
|
287
|
+
</AAlert.Icon>
|
|
288
|
+
<AAlert.Title>Successfully Subscribed!</AAlert.Title>
|
|
289
|
+
<AAlert.Description>
|
|
290
|
+
You're now subscribed to our newsletter. Check your inbox for a confirmation email.
|
|
291
|
+
</AAlert.Description>
|
|
292
|
+
<AAlert.Content></AAlert.Content>
|
|
293
|
+
<AAlert.CloseButton>
|
|
294
|
+
<Icon class="h-full">
|
|
295
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
296
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
297
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
298
|
+
</svg>
|
|
299
|
+
</Icon>
|
|
300
|
+
</AAlert.CloseButton>
|
|
301
|
+
</AAlert.Root>
|
|
302
|
+
|
|
303
|
+
<!-- API Rate Limit -->
|
|
304
|
+
<AAlert.Root base={alertLayout} variant="warning">
|
|
305
|
+
<AAlert.Icon>
|
|
306
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
307
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
308
|
+
<polyline points="12 6 12 12 16 14"></polyline>
|
|
309
|
+
</svg>
|
|
310
|
+
</AAlert.Icon>
|
|
311
|
+
<AAlert.Title>API Rate Limit Warning</AAlert.Title>
|
|
312
|
+
<AAlert.Description>
|
|
313
|
+
You've used 450 of 500 API calls this hour. Rate limit resets in 23 minutes.
|
|
314
|
+
</AAlert.Description>
|
|
315
|
+
<AAlert.Content></AAlert.Content>
|
|
316
|
+
<AAlert.Actions>
|
|
317
|
+
<Button variant="primary" size="sm">Upgrade Plan</Button>
|
|
318
|
+
<Button variant="ghost" size="sm">View Usage</Button>
|
|
319
|
+
</AAlert.Actions>
|
|
320
|
+
</AAlert.Root>
|
|
321
|
+
|
|
322
|
+
<!-- Maintenance Notice -->
|
|
323
|
+
<AAlert.Root base={alertLayout} variant="info">
|
|
324
|
+
<AAlert.Icon>
|
|
325
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
326
|
+
<path
|
|
327
|
+
d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"
|
|
328
|
+
></path>
|
|
329
|
+
</svg>
|
|
330
|
+
</AAlert.Icon>
|
|
331
|
+
<AAlert.Title>Scheduled Maintenance</AAlert.Title>
|
|
332
|
+
<AAlert.Description>
|
|
333
|
+
Our services will be undergoing maintenance on Dec 15, 2025 from 2:00 AM to 4:00 AM UTC.
|
|
334
|
+
Some features may be temporarily unavailable.
|
|
335
|
+
</AAlert.Description>
|
|
336
|
+
<AAlert.Content></AAlert.Content>
|
|
337
|
+
<AAlert.Actions>
|
|
338
|
+
<Button variant="primary" size="sm">Add to Calendar</Button>
|
|
339
|
+
</AAlert.Actions>
|
|
340
|
+
</AAlert.Root>
|
|
341
|
+
|
|
342
|
+
<!-- Security Alert -->
|
|
343
|
+
<AAlert.Root base={alertLayout} variant="error" dismissible>
|
|
344
|
+
<AAlert.Icon>
|
|
345
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
346
|
+
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
|
|
347
|
+
<path d="M12 8v4M12 16h.01"></path>
|
|
348
|
+
</svg>
|
|
349
|
+
</AAlert.Icon>
|
|
350
|
+
<AAlert.Title>Unusual Login Detected</AAlert.Title>
|
|
351
|
+
<AAlert.Description>
|
|
352
|
+
We detected a login from a new device in San Francisco, CA. If this wasn't you, secure
|
|
353
|
+
your account immediately.
|
|
354
|
+
</AAlert.Description>
|
|
355
|
+
<AAlert.CloseButton>
|
|
356
|
+
<Icon class="h-full">
|
|
357
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
358
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
359
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
360
|
+
</svg>
|
|
361
|
+
</Icon>
|
|
362
|
+
</AAlert.CloseButton>
|
|
363
|
+
<AAlert.Content></AAlert.Content>
|
|
364
|
+
<AAlert.Actions>
|
|
365
|
+
<Button variant="destructive" size="sm">Secure Account</Button>
|
|
366
|
+
<Button variant="ghost" size="sm">This Was Me</Button>
|
|
367
|
+
</AAlert.Actions>
|
|
368
|
+
</AAlert.Root>
|
|
369
|
+
|
|
370
|
+
<!-- Trial Ending -->
|
|
371
|
+
<AAlert.Root base={alertLayout} variant="warning" dismissible>
|
|
372
|
+
<AAlert.Icon>
|
|
373
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
374
|
+
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
|
|
375
|
+
<line x1="16" y1="2" x2="16" y2="6"></line>
|
|
376
|
+
<line x1="8" y1="2" x2="8" y2="6"></line>
|
|
377
|
+
<line x1="3" y1="10" x2="21" y2="10"></line>
|
|
378
|
+
</svg>
|
|
379
|
+
</AAlert.Icon>
|
|
380
|
+
<AAlert.Title>Trial Ending Soon</AAlert.Title>
|
|
381
|
+
<AAlert.Description>
|
|
382
|
+
Your free trial ends in 3 days. Upgrade now to keep access to premium features and avoid
|
|
383
|
+
any interruption.
|
|
384
|
+
</AAlert.Description>
|
|
385
|
+
<AAlert.Content></AAlert.Content>
|
|
386
|
+
<AAlert.CloseButton>
|
|
387
|
+
<Icon class="h-full">
|
|
388
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
389
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
390
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
391
|
+
</svg>
|
|
392
|
+
</Icon>
|
|
393
|
+
</AAlert.CloseButton>
|
|
394
|
+
<AAlert.Actions>
|
|
395
|
+
<Button variant="primary" size="sm">Upgrade Now</Button>
|
|
396
|
+
<Button variant="ghost" size="sm">Compare Plans</Button>
|
|
397
|
+
</AAlert.Actions>
|
|
398
|
+
</AAlert.Root>
|
|
399
|
+
</div>
|
|
400
|
+
</Root>
|
|
401
|
+
</Story>
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export default Alert;
|
|
2
|
-
type Alert = {
|
|
3
|
-
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<Record<string, never>>): void;
|
|
5
|
-
};
|
|
6
1
|
declare const Alert: import("svelte").Component<Record<string, never>, {}, "">;
|
|
2
|
+
type Alert = ReturnType<typeof Alert>;
|
|
3
|
+
export default Alert;
|