@umbra.ui/core 0.1.0
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/controls/Dropdown/types.d.ts +5 -0
- package/dist/components/controls/Dropdown/types.d.ts.map +1 -0
- package/dist/components/controls/Dropdown/types.js +1 -0
- package/dist/components/controls/SegmentedControl/types.d.ts +6 -0
- package/dist/components/controls/SegmentedControl/types.d.ts.map +1 -0
- package/dist/components/controls/SegmentedControl/types.js +1 -0
- package/dist/components/dialogs/Alert/types.d.ts +7 -0
- package/dist/components/dialogs/Alert/types.d.ts.map +1 -0
- package/dist/components/dialogs/Alert/types.js +1 -0
- package/dist/components/dialogs/Toast/types.d.ts +34 -0
- package/dist/components/dialogs/Toast/types.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/types.js +10 -0
- package/dist/components/dialogs/Toast/useToast.d.ts +36 -0
- package/dist/components/dialogs/Toast/useToast.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/useToast.js +90 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts +3 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/tooltip.js +33 -0
- package/dist/components/indicators/Tooltip/types.d.ts +14 -0
- package/dist/components/indicators/Tooltip/types.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/types.js +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts +18 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.js +57 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts +14 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts.map +1 -0
- package/dist/components/inputs/Tags/tag-bar-styles.js +313 -0
- package/dist/components/inputs/Tags/types.d.ts +93 -0
- package/dist/components/inputs/Tags/types.d.ts.map +1 -0
- package/dist/components/inputs/Tags/types.js +216 -0
- package/dist/components/inputs/search/types.d.ts +9 -0
- package/dist/components/inputs/search/types.d.ts.map +1 -0
- package/dist/components/inputs/search/types.js +1 -0
- package/dist/components/navigation/adaptive/types.d.ts +16 -0
- package/dist/components/navigation/adaptive/types.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/types.js +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts +27 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.js +40 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts +6 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useBreakpoints.js +37 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts +93 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.js +145 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts +31 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewAnimation.js +591 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts +52 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewResize.js +146 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts +25 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts.map +1 -0
- package/dist/components/navigation/navstack/useNavigationStack.js +133 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts +20 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts.map +1 -0
- package/dist/components/navigation/slideover/useSlideoverController.js +267 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts +20 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts.map +1 -0
- package/dist/components/navigation/splitview/useSplitViewController.js +325 -0
- package/dist/components/navigation/tabcontroller/types.d.ts +21 -0
- package/dist/components/navigation/tabcontroller/types.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/types.js +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts +5 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.js +10 -0
- package/dist/components/navigation/types.d.ts +8 -0
- package/dist/components/navigation/types.d.ts.map +1 -0
- package/dist/components/navigation/types.js +1 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts +11 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts.map +1 -0
- package/dist/components/pickers/CollectionPicker/types.js +1 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts +13 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts.map +1 -0
- package/dist/components/pickers/ColorPicker/colors.js +266 -0
- package/dist/components/pickers/FilePicker/types.d.ts +10 -0
- package/dist/components/pickers/FilePicker/types.d.ts.map +1 -0
- package/dist/components/pickers/FilePicker/types.js +1 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/theme.d.ts +73 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +279 -0
- package/dist/themes/blank.d.ts +7 -0
- package/dist/themes/blank.d.ts.map +1 -0
- package/dist/themes/blank.js +543 -0
- package/dist/themes/crimson-dark.d.ts +4 -0
- package/dist/themes/crimson-dark.d.ts.map +1 -0
- package/dist/themes/crimson-dark.js +552 -0
- package/dist/themes/cyan-light.d.ts +4 -0
- package/dist/themes/cyan-light.d.ts.map +1 -0
- package/dist/themes/cyan-light.js +552 -0
- package/dist/themes/dark.d.ts +4 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/dark.js +551 -0
- package/dist/themes/gold-dark.d.ts +4 -0
- package/dist/themes/gold-dark.d.ts.map +1 -0
- package/dist/themes/gold-dark.js +552 -0
- package/dist/themes/grass-dark.d.ts +4 -0
- package/dist/themes/grass-dark.d.ts.map +1 -0
- package/dist/themes/grass-dark.js +552 -0
- package/dist/themes/indigo.d.ts +4 -0
- package/dist/themes/indigo.d.ts.map +1 -0
- package/dist/themes/indigo.js +552 -0
- package/dist/themes/light.d.ts +4 -0
- package/dist/themes/light.d.ts.map +1 -0
- package/dist/themes/light.js +551 -0
- package/dist/themes/orange-dark.d.ts +4 -0
- package/dist/themes/orange-dark.d.ts.map +1 -0
- package/dist/themes/orange-dark.js +551 -0
- package/dist/themes/orange-light.d.ts +4 -0
- package/dist/themes/orange-light.d.ts.map +1 -0
- package/dist/themes/orange-light.js +551 -0
- package/package.json +62 -0
- package/src/components/controls/Button/Button.vue +417 -0
- package/src/components/controls/Button/README.md +348 -0
- package/src/components/controls/Button/theme.css +200 -0
- package/src/components/controls/Checkbox/Checkbox.vue +164 -0
- package/src/components/controls/Checkbox/README.md +441 -0
- package/src/components/controls/Checkbox/theme.css +36 -0
- package/src/components/controls/Dropdown/Dropdown.vue +476 -0
- package/src/components/controls/Dropdown/README.md +370 -0
- package/src/components/controls/Dropdown/theme.css +50 -0
- package/src/components/controls/Dropdown/types.ts +6 -0
- package/src/components/controls/IconButton/IconButton.vue +267 -0
- package/src/components/controls/IconButton/README.md +502 -0
- package/src/components/controls/IconButton/theme.css +89 -0
- package/src/components/controls/Radio/README.md +591 -0
- package/src/components/controls/Radio/Radio.vue +89 -0
- package/src/components/controls/Radio/theme.css +14 -0
- package/src/components/controls/RangeSlider/README.md +608 -0
- package/src/components/controls/RangeSlider/RangeSlider.vue +535 -0
- package/src/components/controls/RangeSlider/theme.css +80 -0
- package/src/components/controls/SegmentedControl/README.md +587 -0
- package/src/components/controls/SegmentedControl/SegmentedControl.vue +284 -0
- package/src/components/controls/SegmentedControl/theme.css +60 -0
- package/src/components/controls/SegmentedControl/types.ts +5 -0
- package/src/components/controls/Slider/README.md +627 -0
- package/src/components/controls/Slider/Slider.vue +260 -0
- package/src/components/controls/Slider/theme.css +74 -0
- package/src/components/controls/Stepper/README.md +601 -0
- package/src/components/controls/Stepper/Stepper.vue +103 -0
- package/src/components/controls/Stepper/theme.css +53 -0
- package/src/components/controls/Switch/README.md +667 -0
- package/src/components/controls/Switch/Switch.vue +127 -0
- package/src/components/controls/Switch/theme.css +42 -0
- package/src/components/dialogs/Alert/Alert.vue +218 -0
- package/src/components/dialogs/Alert/README.md +450 -0
- package/src/components/dialogs/Alert/theme.css +44 -0
- package/src/components/dialogs/Alert/types.ts +11 -0
- package/src/components/dialogs/Toast/README.md +522 -0
- package/src/components/dialogs/Toast/Toast.vue +296 -0
- package/src/components/dialogs/Toast/ToastContainer.vue +330 -0
- package/src/components/dialogs/Toast/theme.css +44 -0
- package/src/components/dialogs/Toast/types.ts +46 -0
- package/src/components/dialogs/Toast/useToast.ts +127 -0
- package/src/components/indicators/ProgressBar/ProgressBar.vue +98 -0
- package/src/components/indicators/ProgressBar/README.md +744 -0
- package/src/components/indicators/ProgressBar/theme.css +36 -0
- package/src/components/indicators/Tooltip/README.md +723 -0
- package/src/components/indicators/Tooltip/TooltipProvider.vue +142 -0
- package/src/components/indicators/Tooltip/theme.css +18 -0
- package/src/components/indicators/Tooltip/tooltip.ts +48 -0
- package/src/components/indicators/Tooltip/types.ts +15 -0
- package/src/components/indicators/Tooltip/useTooltip.ts +71 -0
- package/src/components/inputs/AutogrowTextView/AutogrowTextView.vue +110 -0
- package/src/components/inputs/AutogrowTextView/README.md +643 -0
- package/src/components/inputs/AutogrowTextView/theme.css +28 -0
- package/src/components/inputs/InputCard/InputCard.vue +600 -0
- package/src/components/inputs/InputCard/README.md +636 -0
- package/src/components/inputs/InputEmail/InputEmail.vue +698 -0
- package/src/components/inputs/InputEmail/README.md +764 -0
- package/src/components/inputs/InputNumber/InputNumber.vue +300 -0
- package/src/components/inputs/InputNumber/README.md +749 -0
- package/src/components/inputs/InputPhone/InputPhone.vue +645 -0
- package/src/components/inputs/InputPhone/README.md +636 -0
- package/src/components/inputs/InputSecure/InputSecure.vue +646 -0
- package/src/components/inputs/InputSecure/README.md +771 -0
- package/src/components/inputs/InputText/InputText.vue +225 -0
- package/src/components/inputs/InputText/README.md +844 -0
- package/src/components/inputs/OTP/OTP.vue +349 -0
- package/src/components/inputs/OTP/README.md +736 -0
- package/src/components/inputs/OTP/theme.css +50 -0
- package/src/components/inputs/StringCapture/README.md +718 -0
- package/src/components/inputs/StringCapture/StringCapture.vue +315 -0
- package/src/components/inputs/StringCapture/theme.css +86 -0
- package/src/components/inputs/Tags/README.md +897 -0
- package/src/components/inputs/Tags/TagBar.vue +793 -0
- package/src/components/inputs/Tags/TagCreation.vue +219 -0
- package/src/components/inputs/Tags/TagPicker.vue +380 -0
- package/src/components/inputs/Tags/tag-bar-styles.ts +354 -0
- package/src/components/inputs/Tags/theme.css +121 -0
- package/src/components/inputs/Tags/types.ts +346 -0
- package/src/components/inputs/search/README.md +759 -0
- package/src/components/inputs/search/SearchBar.vue +394 -0
- package/src/components/inputs/search/SearchResults.vue +310 -0
- package/src/components/inputs/search/theme.css +187 -0
- package/src/components/inputs/search/types.ts +8 -0
- package/src/components/inputs/theme.css +102 -0
- package/src/components/menus/ActionMenu/ActionMenu.vue +383 -0
- package/src/components/menus/ActionMenu/README.md +825 -0
- package/src/components/menus/ActionMenu/theme.css +93 -0
- package/src/components/models/Popover/Popover.vue +551 -0
- package/src/components/models/Popover/README.md +885 -0
- package/src/components/models/Popover/theme.css +52 -0
- package/src/components/models/Sheet/README.md +1159 -0
- package/src/components/models/Sheet/Sheet.vue +465 -0
- package/src/components/models/Sheet/theme.css +72 -0
- package/src/components/models/Sidebar/README.md +1228 -0
- package/src/components/models/Sidebar/Sidebar.vue +480 -0
- package/src/components/models/Sidebar/theme.css +90 -0
- package/src/components/navigation/adaptive/AdaptiveLayout.vue +779 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutBreadcrumbs.vue +192 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutMenuButton.vue +149 -0
- package/src/components/navigation/adaptive/README.md +768 -0
- package/src/components/navigation/adaptive/types.ts +19 -0
- package/src/components/navigation/adaptive/useAdaptiveLayout.ts +89 -0
- package/src/components/navigation/adaptive/useBreakpoints.ts +41 -0
- package/src/components/navigation/adaptive/useContainerMonitor.ts +214 -0
- package/src/components/navigation/adaptive/useViewAnimation.ts +721 -0
- package/src/components/navigation/adaptive/useViewResize.ts +211 -0
- package/src/components/navigation/navstack/NavigationStack.vue +180 -0
- package/src/components/navigation/navstack/README.md +994 -0
- package/src/components/navigation/navstack/useNavigationStack.ts +164 -0
- package/src/components/navigation/slideover/README.md +1275 -0
- package/src/components/navigation/slideover/SlideoverController.vue +287 -0
- package/src/components/navigation/slideover/useSlideoverController.ts +320 -0
- package/src/components/navigation/splitview/README.md +1115 -0
- package/src/components/navigation/splitview/SplitViewController.vue +176 -0
- package/src/components/navigation/splitview/useSplitViewController.ts +388 -0
- package/src/components/navigation/tabcontroller/README.md +919 -0
- package/src/components/navigation/tabcontroller/TabController.vue +307 -0
- package/src/components/navigation/tabcontroller/TabItem.vue +57 -0
- package/src/components/navigation/tabcontroller/types.ts +24 -0
- package/src/components/navigation/tabcontroller/useTabController.ts +18 -0
- package/src/components/navigation/theme.css +91 -0
- package/src/components/navigation/types.ts +7 -0
- package/src/components/pickers/CollectionPicker/CollectionPicker.vue +398 -0
- package/src/components/pickers/CollectionPicker/README.md +1115 -0
- package/src/components/pickers/CollectionPicker/theme.css +14 -0
- package/src/components/pickers/CollectionPicker/types.ts +11 -0
- package/src/components/pickers/ColorPicker/ColorPicker.vue +376 -0
- package/src/components/pickers/ColorPicker/README.md +1439 -0
- package/src/components/pickers/ColorPicker/colors.ts +299 -0
- package/src/components/pickers/ColorPicker/theme.css +32 -0
- package/src/components/pickers/DatePicker/DatePicker.vue +660 -0
- package/src/components/pickers/DatePicker/README.md +1195 -0
- package/src/components/pickers/DatePicker/theme.css +22 -0
- package/src/components/pickers/FilePicker/FilePicker.vue +534 -0
- package/src/components/pickers/FilePicker/README.md +1542 -0
- package/src/components/pickers/FilePicker/theme.css +48 -0
- package/src/components/pickers/FilePicker/types.ts +10 -0
- package/src/components/pickers/IconPicker/IconPicker.vue +327 -0
- package/src/components/pickers/IconPicker/README.md +1161 -0
- package/src/components/pickers/IconPicker/theme.css +28 -0
- package/src/components/pickers/theme.css +82 -0
- package/src/components/views/MarkdownViewer/MarkdownViewer.vue +442 -0
- package/src/components/views/MarkdownViewer/README.md +833 -0
- package/src/components/views/MarkdownViewer/theme.css +130 -0
- package/src/index.ts +263 -0
- package/src/theme.ts +378 -0
- package/src/themes/crimson-dark.ts +556 -0
- package/src/themes/cyan-light.ts +556 -0
- package/src/themes/dark.ts +557 -0
- package/src/themes/gold-dark.ts +556 -0
- package/src/themes/grass-dark.ts +556 -0
- package/src/themes/indigo.ts +556 -0
- package/src/themes/light.ts +557 -0
- package/src/themes/orange-dark.ts +557 -0
- package/src/themes/orange-light.ts +557 -0
- package/src/vue.d.ts +45 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
# Toast
|
|
2
|
+
|
|
3
|
+
A comprehensive toast notification system built with Vue 3 Composition API and TypeScript. The Toast component provides a flexible interface for displaying temporary messages, notifications, and user feedback with smooth animations, multiple styles, and global state management.
|
|
4
|
+
|
|
5
|
+
## Installation/Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Toast, ToastContainer, useToast, ToastPlugin } from "@umbra-ui/core";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Dependencies:**
|
|
12
|
+
|
|
13
|
+
- Vue 3.x
|
|
14
|
+
- @umbra-ui/core (IconButton component)
|
|
15
|
+
- @umbra-ui/icons (for icons)
|
|
16
|
+
- GSAP (for animations)
|
|
17
|
+
- tinycolor2 (for color calculations)
|
|
18
|
+
|
|
19
|
+
## Basic Usage
|
|
20
|
+
|
|
21
|
+
### Setup (App Level)
|
|
22
|
+
|
|
23
|
+
```vue
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
import { createApp } from "vue";
|
|
26
|
+
import { ToastPlugin } from "@umbra-ui/core";
|
|
27
|
+
import App from "./App.vue";
|
|
28
|
+
|
|
29
|
+
const app = createApp(App);
|
|
30
|
+
app.use(ToastPlugin);
|
|
31
|
+
app.mount("#app");
|
|
32
|
+
</script>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Using the Composable
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import { useToast } from "@umbra-ui/core";
|
|
40
|
+
|
|
41
|
+
const { showSuccess, showError, showWarning, showInfo } = useToast();
|
|
42
|
+
|
|
43
|
+
const handleSuccess = () => {
|
|
44
|
+
showSuccess("Success!", "Your action was completed successfully.");
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const handleError = () => {
|
|
48
|
+
showError("Error", "Something went wrong. Please try again.");
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const handleWarning = () => {
|
|
52
|
+
showWarning("Warning", "Please review your input before proceeding.");
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleInfo = () => {
|
|
56
|
+
showInfo("Information", "Here's some helpful information for you.");
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<div>
|
|
62
|
+
<button @click="handleSuccess">Show Success</button>
|
|
63
|
+
<button @click="handleError">Show Error</button>
|
|
64
|
+
<button @click="handleWarning">Show Warning</button>
|
|
65
|
+
<button @click="handleInfo">Show Info</button>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Include ToastContainer
|
|
71
|
+
|
|
72
|
+
```vue
|
|
73
|
+
<template>
|
|
74
|
+
<div>
|
|
75
|
+
<!-- Your app content -->
|
|
76
|
+
<ToastContainer />
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Props
|
|
82
|
+
|
|
83
|
+
### Toast Component
|
|
84
|
+
|
|
85
|
+
| Prop Name | Type | Required | Default | Description |
|
|
86
|
+
| ------------ | ----------------------------------- | -------- | ------- | --------------------------------------------------- |
|
|
87
|
+
| `toast` | `ToastInstance` | Yes | - | Toast instance data containing all toast properties |
|
|
88
|
+
| `toastStyle` | `"bar" \| "full" \| "notification"` | No | `"bar"` | Visual style variant of the toast |
|
|
89
|
+
|
|
90
|
+
### ToastContainer Component
|
|
91
|
+
|
|
92
|
+
This component does not accept props. It automatically manages all toasts through the global toast manager.
|
|
93
|
+
|
|
94
|
+
## Events
|
|
95
|
+
|
|
96
|
+
### Toast Component
|
|
97
|
+
|
|
98
|
+
| Event Name | Payload Type | Description |
|
|
99
|
+
| ---------- | ------------ | --------------------------------------------------------- |
|
|
100
|
+
| `dismiss` | `string` | Emitted when the toast is dismissed, returns the toast ID |
|
|
101
|
+
|
|
102
|
+
## Slots
|
|
103
|
+
|
|
104
|
+
These components do not use slots.
|
|
105
|
+
|
|
106
|
+
## Exposed Methods/Refs
|
|
107
|
+
|
|
108
|
+
### useToast Composable
|
|
109
|
+
|
|
110
|
+
The `useToast` composable provides the following methods:
|
|
111
|
+
|
|
112
|
+
| Method Name | Parameters | Return Type | Description |
|
|
113
|
+
| ----------------- | ------------------------------------------------------------------------ | ----------------- | ----------------------------------- |
|
|
114
|
+
| `addToast` | `(options: ToastOptions)` | `Promise<string>` | Adds a new toast and returns its ID |
|
|
115
|
+
| `removeToast` | `(id: string)` | `void` | Removes a toast by ID |
|
|
116
|
+
| `removeAllToasts` | `()` | `void` | Removes all active toasts |
|
|
117
|
+
| `setToastStyle` | `(style: "bar" \| "full" \| "notification")` | `void` | Sets the global toast style |
|
|
118
|
+
| `showSuccess` | `(title: string, description?: string, options?: Partial<ToastOptions>)` | `Promise<string>` | Shows a success toast |
|
|
119
|
+
| `showError` | `(title: string, description?: string, options?: Partial<ToastOptions>)` | `Promise<string>` | Shows an error toast |
|
|
120
|
+
| `showWarning` | `(title: string, description?: string, options?: Partial<ToastOptions>)` | `Promise<string>` | Shows a warning toast |
|
|
121
|
+
| `showInfo` | `(title: string, description?: string, options?: Partial<ToastOptions>)` | `Promise<string>` | Shows an info toast |
|
|
122
|
+
|
|
123
|
+
## Types
|
|
124
|
+
|
|
125
|
+
### ToastOptions
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
interface ToastOptions {
|
|
129
|
+
title: string;
|
|
130
|
+
description?: string;
|
|
131
|
+
iconName?: string;
|
|
132
|
+
position?: "Top" | "Bottom";
|
|
133
|
+
toastType?: "success" | "error" | "warning" | "info" | string;
|
|
134
|
+
duration?: number; // Auto dismiss duration in ms (0 = no auto dismiss)
|
|
135
|
+
dismissible?: boolean;
|
|
136
|
+
actions?: ToastAction[];
|
|
137
|
+
onDismiss?: () => void;
|
|
138
|
+
className?: string;
|
|
139
|
+
role?: "alert" | "status";
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### ToastAction
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
interface ToastAction {
|
|
147
|
+
label: string;
|
|
148
|
+
action: () => void;
|
|
149
|
+
style?: "primary" | "secondary";
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### ToastInstance
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
interface ToastInstance
|
|
157
|
+
extends Required<
|
|
158
|
+
Omit<ToastOptions, "actions" | "onDismiss" | "className" | "role">
|
|
159
|
+
> {
|
|
160
|
+
id: string;
|
|
161
|
+
show: boolean;
|
|
162
|
+
actions?: ToastAction[];
|
|
163
|
+
onDismiss?: () => void;
|
|
164
|
+
className?: string;
|
|
165
|
+
role?: "alert" | "status";
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## CSS Customization
|
|
170
|
+
|
|
171
|
+
The Toast component uses CSS custom properties for easy theming and customization:
|
|
172
|
+
|
|
173
|
+
```css
|
|
174
|
+
/* Toast type colors */
|
|
175
|
+
--toast-success-bg: #30a46c;
|
|
176
|
+
--toast-error-bg: #e5484d;
|
|
177
|
+
--toast-warning-bg: #ffe629;
|
|
178
|
+
--toast-info-bg: #5b5bd6;
|
|
179
|
+
--toast-custom-bg: #6b7280;
|
|
180
|
+
|
|
181
|
+
/* Toast shadow colors */
|
|
182
|
+
--toast-shadow: rgba(0, 0, 0, 0.08);
|
|
183
|
+
--toast-border: rgba(0, 0, 0, 0.08);
|
|
184
|
+
|
|
185
|
+
/* Toast description opacity */
|
|
186
|
+
--toast-description-opacity: 0.8;
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Examples
|
|
190
|
+
|
|
191
|
+
### Basic Toast Types
|
|
192
|
+
|
|
193
|
+
```vue
|
|
194
|
+
<script setup lang="ts">
|
|
195
|
+
import { useToast } from "@umbra-ui/core";
|
|
196
|
+
|
|
197
|
+
const { showSuccess, showError, showWarning, showInfo } = useToast();
|
|
198
|
+
|
|
199
|
+
const showToasts = () => {
|
|
200
|
+
showSuccess("Success!", "Operation completed successfully.");
|
|
201
|
+
showError("Error", "Something went wrong.");
|
|
202
|
+
showWarning("Warning", "Please check your input.");
|
|
203
|
+
showInfo("Info", "Here's some information.");
|
|
204
|
+
};
|
|
205
|
+
</script>
|
|
206
|
+
|
|
207
|
+
<template>
|
|
208
|
+
<div>
|
|
209
|
+
<button @click="showToasts">Show All Toast Types</button>
|
|
210
|
+
</div>
|
|
211
|
+
</template>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Custom Toast with Actions
|
|
215
|
+
|
|
216
|
+
```vue
|
|
217
|
+
<script setup lang="ts">
|
|
218
|
+
import { useToast } from "@umbra-ui/core";
|
|
219
|
+
|
|
220
|
+
const { addToast } = useToast();
|
|
221
|
+
|
|
222
|
+
const showCustomToast = () => {
|
|
223
|
+
addToast({
|
|
224
|
+
title: "File Uploaded",
|
|
225
|
+
description: "Your file has been uploaded successfully.",
|
|
226
|
+
toastType: "success",
|
|
227
|
+
duration: 0, // Persistent
|
|
228
|
+
actions: [
|
|
229
|
+
{
|
|
230
|
+
label: "View",
|
|
231
|
+
action: () => console.log("View file"),
|
|
232
|
+
style: "primary",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: "Dismiss",
|
|
236
|
+
action: () => console.log("Dismissed"),
|
|
237
|
+
style: "secondary",
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
</script>
|
|
243
|
+
|
|
244
|
+
<template>
|
|
245
|
+
<div>
|
|
246
|
+
<button @click="showCustomToast">Show Custom Toast</button>
|
|
247
|
+
</div>
|
|
248
|
+
</template>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Different Toast Styles
|
|
252
|
+
|
|
253
|
+
```vue
|
|
254
|
+
<script setup lang="ts">
|
|
255
|
+
import { useToast } from "@umbra-ui/core";
|
|
256
|
+
|
|
257
|
+
const { addToast, setToastStyle } = useToast();
|
|
258
|
+
|
|
259
|
+
const showBarToast = () => {
|
|
260
|
+
setToastStyle("bar");
|
|
261
|
+
addToast({
|
|
262
|
+
title: "Bar Style Toast",
|
|
263
|
+
description: "This is a bar-style toast notification.",
|
|
264
|
+
toastType: "info",
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
const showFullToast = () => {
|
|
269
|
+
setToastStyle("full");
|
|
270
|
+
addToast({
|
|
271
|
+
title: "Full Style Toast",
|
|
272
|
+
description: "This is a full-width toast notification.",
|
|
273
|
+
toastType: "success",
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const showNotificationToast = () => {
|
|
278
|
+
setToastStyle("notification");
|
|
279
|
+
addToast({
|
|
280
|
+
title: "Notification Style Toast",
|
|
281
|
+
description: "This is a notification-style toast.",
|
|
282
|
+
toastType: "warning",
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
</script>
|
|
286
|
+
|
|
287
|
+
<template>
|
|
288
|
+
<div>
|
|
289
|
+
<button @click="showBarToast">Bar Style</button>
|
|
290
|
+
<button @click="showFullToast">Full Style</button>
|
|
291
|
+
<button @click="showNotificationToast">Notification Style</button>
|
|
292
|
+
</div>
|
|
293
|
+
</template>
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Custom Colors and Icons
|
|
297
|
+
|
|
298
|
+
```vue
|
|
299
|
+
<script setup lang="ts">
|
|
300
|
+
import { useToast } from "@umbra-ui/core";
|
|
301
|
+
|
|
302
|
+
const { addToast } = useToast();
|
|
303
|
+
|
|
304
|
+
const showCustomColorToast = () => {
|
|
305
|
+
addToast({
|
|
306
|
+
title: "Custom Color Toast",
|
|
307
|
+
description: "This toast uses a custom color.",
|
|
308
|
+
toastType: "#8b5cf6", // Custom purple color
|
|
309
|
+
iconName: "star",
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
const showCustomIconToast = () => {
|
|
314
|
+
addToast({
|
|
315
|
+
title: "Custom Icon Toast",
|
|
316
|
+
description: "This toast uses a custom icon.",
|
|
317
|
+
toastType: "info",
|
|
318
|
+
iconName: "heart",
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
</script>
|
|
322
|
+
|
|
323
|
+
<template>
|
|
324
|
+
<div>
|
|
325
|
+
<button @click="showCustomColorToast">Custom Color</button>
|
|
326
|
+
<button @click="showCustomIconToast">Custom Icon</button>
|
|
327
|
+
</div>
|
|
328
|
+
</template>
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Form Validation Toasts
|
|
332
|
+
|
|
333
|
+
```vue
|
|
334
|
+
<script setup lang="ts">
|
|
335
|
+
import { ref } from "vue";
|
|
336
|
+
import { useToast } from "@umbra-ui/core";
|
|
337
|
+
|
|
338
|
+
const { showSuccess, showError } = useToast();
|
|
339
|
+
const email = ref("");
|
|
340
|
+
const password = ref("");
|
|
341
|
+
|
|
342
|
+
const validateForm = () => {
|
|
343
|
+
const errors = [];
|
|
344
|
+
|
|
345
|
+
if (!email.value) {
|
|
346
|
+
errors.push("Email is required");
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (!password.value) {
|
|
350
|
+
errors.push("Password is required");
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (password.value.length < 8) {
|
|
354
|
+
errors.push("Password must be at least 8 characters");
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (errors.length > 0) {
|
|
358
|
+
errors.forEach((error) => {
|
|
359
|
+
showError("Validation Error", error);
|
|
360
|
+
});
|
|
361
|
+
} else {
|
|
362
|
+
showSuccess("Success", "Form submitted successfully!");
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
</script>
|
|
366
|
+
|
|
367
|
+
<template>
|
|
368
|
+
<form @submit.prevent="validateForm">
|
|
369
|
+
<input v-model="email" type="email" placeholder="Email" />
|
|
370
|
+
<input v-model="password" type="password" placeholder="Password" />
|
|
371
|
+
<button type="submit">Submit</button>
|
|
372
|
+
</form>
|
|
373
|
+
</template>
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### API Response Toasts
|
|
377
|
+
|
|
378
|
+
```vue
|
|
379
|
+
<script setup lang="ts">
|
|
380
|
+
import { useToast } from "@umbra-ui/core";
|
|
381
|
+
|
|
382
|
+
const { showSuccess, showError, showInfo } = useToast();
|
|
383
|
+
|
|
384
|
+
const simulateApiCall = async () => {
|
|
385
|
+
showInfo("Loading", "Sending request to server...");
|
|
386
|
+
|
|
387
|
+
try {
|
|
388
|
+
// Simulate API call
|
|
389
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
390
|
+
|
|
391
|
+
// Simulate success
|
|
392
|
+
showSuccess("Success", "Data saved successfully!");
|
|
393
|
+
} catch (error) {
|
|
394
|
+
showError("Error", "Failed to save data. Please try again.");
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
</script>
|
|
398
|
+
|
|
399
|
+
<template>
|
|
400
|
+
<div>
|
|
401
|
+
<button @click="simulateApiCall">Save Data</button>
|
|
402
|
+
</div>
|
|
403
|
+
</template>
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Persistent Toasts
|
|
407
|
+
|
|
408
|
+
```vue
|
|
409
|
+
<script setup lang="ts">
|
|
410
|
+
import { useToast } from "@umbra-ui/core";
|
|
411
|
+
|
|
412
|
+
const { addToast } = useToast();
|
|
413
|
+
|
|
414
|
+
const showPersistentToast = () => {
|
|
415
|
+
addToast({
|
|
416
|
+
title: "Important Notice",
|
|
417
|
+
description: "This toast will not auto-dismiss. Click the X to close it.",
|
|
418
|
+
toastType: "warning",
|
|
419
|
+
duration: 0, // No auto-dismiss
|
|
420
|
+
dismissible: true,
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
const showNonDismissibleToast = () => {
|
|
425
|
+
addToast({
|
|
426
|
+
title: "Critical Alert",
|
|
427
|
+
description: "This toast cannot be dismissed manually.",
|
|
428
|
+
toastType: "error",
|
|
429
|
+
duration: 0,
|
|
430
|
+
dismissible: false,
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
</script>
|
|
434
|
+
|
|
435
|
+
<template>
|
|
436
|
+
<div>
|
|
437
|
+
<button @click="showPersistentToast">Persistent Toast</button>
|
|
438
|
+
<button @click="showNonDismissibleToast">Non-Dismissible Toast</button>
|
|
439
|
+
</div>
|
|
440
|
+
</template>
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Toast Management
|
|
444
|
+
|
|
445
|
+
```vue
|
|
446
|
+
<script setup lang="ts">
|
|
447
|
+
import { useToast } from "@umbra-ui/core";
|
|
448
|
+
|
|
449
|
+
const { addToast, removeAllToasts, toasts } = useToast();
|
|
450
|
+
|
|
451
|
+
const addMultipleToasts = () => {
|
|
452
|
+
for (let i = 1; i <= 5; i++) {
|
|
453
|
+
addToast({
|
|
454
|
+
title: `Toast ${i}`,
|
|
455
|
+
description: `This is toast number ${i}`,
|
|
456
|
+
toastType: "info",
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
const clearAllToasts = () => {
|
|
462
|
+
removeAllToasts();
|
|
463
|
+
};
|
|
464
|
+
</script>
|
|
465
|
+
|
|
466
|
+
<template>
|
|
467
|
+
<div>
|
|
468
|
+
<button @click="addMultipleToasts">Add 5 Toasts</button>
|
|
469
|
+
<button @click="clearAllToasts">Clear All Toasts</button>
|
|
470
|
+
<p>Active toasts: {{ toasts.length }}</p>
|
|
471
|
+
</div>
|
|
472
|
+
</template>
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### Different Positions
|
|
476
|
+
|
|
477
|
+
```vue
|
|
478
|
+
<script setup lang="ts">
|
|
479
|
+
import { useToast } from "@umbra-ui/core";
|
|
480
|
+
|
|
481
|
+
const { addToast } = useToast();
|
|
482
|
+
|
|
483
|
+
const showTopToast = () => {
|
|
484
|
+
addToast({
|
|
485
|
+
title: "Top Position",
|
|
486
|
+
description: "This toast appears at the top.",
|
|
487
|
+
toastType: "info",
|
|
488
|
+
position: "Top",
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
const showBottomToast = () => {
|
|
493
|
+
addToast({
|
|
494
|
+
title: "Bottom Position",
|
|
495
|
+
description: "This toast appears at the bottom.",
|
|
496
|
+
toastType: "success",
|
|
497
|
+
position: "Bottom",
|
|
498
|
+
});
|
|
499
|
+
};
|
|
500
|
+
</script>
|
|
501
|
+
|
|
502
|
+
<template>
|
|
503
|
+
<div>
|
|
504
|
+
<button @click="showTopToast">Top Toast</button>
|
|
505
|
+
<button @click="showBottomToast">Bottom Toast</button>
|
|
506
|
+
</div>
|
|
507
|
+
</template>
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
## Notes
|
|
511
|
+
|
|
512
|
+
- The Toast system uses Vue's `Teleport` to render toasts outside the component tree for proper z-index layering
|
|
513
|
+
- Toasts include smooth GSAP animations for enter/exit transitions
|
|
514
|
+
- The system supports multiple toast styles: bar, full, and notification
|
|
515
|
+
- Toasts can be positioned at the top or bottom of the screen
|
|
516
|
+
- The component automatically handles text color contrast based on background color
|
|
517
|
+
- Toasts support custom colors, icons, and actions
|
|
518
|
+
- The system includes accessibility features with proper ARIA labels and roles
|
|
519
|
+
- Auto-dismiss functionality is built-in with configurable duration
|
|
520
|
+
- The toast manager is a singleton that can be used throughout the application
|
|
521
|
+
- Toasts are automatically stacked and animated when multiple are present
|
|
522
|
+
- The system supports both light and dark themes through CSS custom properties
|