@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,450 @@
|
|
|
1
|
+
# Alert
|
|
2
|
+
|
|
3
|
+
A modal alert dialog component built with Vue 3 Composition API and TypeScript. The Alert component provides a flexible interface for displaying important messages, confirmations, and user interactions with customizable actions and smooth animations.
|
|
4
|
+
|
|
5
|
+
## Installation/Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Alert } from "@umbra-ui/core";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Dependencies:**
|
|
12
|
+
|
|
13
|
+
- Vue 3.x
|
|
14
|
+
- @umbra-ui/core (Button component)
|
|
15
|
+
|
|
16
|
+
## Basic Usage
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { ref } from "vue";
|
|
21
|
+
import { Alert, AlertAction } from "@umbra-ui/core";
|
|
22
|
+
|
|
23
|
+
const showAlert = ref(false);
|
|
24
|
+
|
|
25
|
+
const handleShowAlert = () => {
|
|
26
|
+
showAlert.value = true;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const handleCloseAlert = () => {
|
|
30
|
+
showAlert.value = false;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const alertActions: AlertAction[] = [
|
|
34
|
+
{
|
|
35
|
+
title: "Cancel",
|
|
36
|
+
action: handleCloseAlert,
|
|
37
|
+
type: "Cancel",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: "Confirm",
|
|
41
|
+
action: () => {
|
|
42
|
+
console.log("Confirmed!");
|
|
43
|
+
handleCloseAlert();
|
|
44
|
+
},
|
|
45
|
+
type: "Default",
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<div>
|
|
52
|
+
<button @click="handleShowAlert">Show Alert</button>
|
|
53
|
+
|
|
54
|
+
<Alert
|
|
55
|
+
:show="showAlert"
|
|
56
|
+
title="Confirm Action"
|
|
57
|
+
description="Are you sure you want to proceed with this action?"
|
|
58
|
+
:actions="alertActions"
|
|
59
|
+
@update:show="showAlert = $event"
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Props
|
|
66
|
+
|
|
67
|
+
| Prop Name | Type | Required | Default | Description |
|
|
68
|
+
| ------------- | --------------- | -------- | ----------------------------------------------------- | --------------------------------------------- |
|
|
69
|
+
| `show` | `boolean` | Yes | - | Controls the visibility of the alert dialog |
|
|
70
|
+
| `title` | `string` | Yes | - | Main title text displayed in the alert |
|
|
71
|
+
| `description` | `string` | Yes | - | Descriptive text explaining the alert content |
|
|
72
|
+
| `actions` | `AlertAction[]` | No | `[{ title: "Ok", action: () => {}, type: "Cancel" }]` | Array of action buttons for the alert |
|
|
73
|
+
|
|
74
|
+
## Events
|
|
75
|
+
|
|
76
|
+
| Event Name | Payload Type | Description |
|
|
77
|
+
| ------------- | ------------ | ---------------------------------------------------------------- |
|
|
78
|
+
| `update:show` | `boolean` | Emitted when the alert visibility changes, returns the new state |
|
|
79
|
+
|
|
80
|
+
## Slots
|
|
81
|
+
|
|
82
|
+
This component does not use slots.
|
|
83
|
+
|
|
84
|
+
## Exposed Methods/Refs
|
|
85
|
+
|
|
86
|
+
This component does not expose any methods or refs.
|
|
87
|
+
|
|
88
|
+
## Types
|
|
89
|
+
|
|
90
|
+
### AlertAction
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
interface AlertAction {
|
|
94
|
+
title: string;
|
|
95
|
+
action: () => void;
|
|
96
|
+
type: AlertActionType;
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### AlertActionType
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
type AlertActionType = "Default" | "Secondary" | "Destructive" | "Cancel";
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## CSS Customization
|
|
107
|
+
|
|
108
|
+
The Alert component uses CSS custom properties for easy theming and customization:
|
|
109
|
+
|
|
110
|
+
```css
|
|
111
|
+
/* Alert overlay colors */
|
|
112
|
+
--alert-overlay-bg: rgba(0, 0, 0, 0.4);
|
|
113
|
+
|
|
114
|
+
/* Alert content colors */
|
|
115
|
+
--alert-content-bg: #ffffff;
|
|
116
|
+
--alert-content-color: #1a1d23;
|
|
117
|
+
--alert-content-shadow: rgba(0, 0, 0, 0.08);
|
|
118
|
+
|
|
119
|
+
/* Alert description colors */
|
|
120
|
+
--alert-description-opacity: 0.7;
|
|
121
|
+
|
|
122
|
+
/* Alert destructive button color */
|
|
123
|
+
--alert-destructive-color: #e5484d;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Examples
|
|
127
|
+
|
|
128
|
+
### Simple Confirmation Dialog
|
|
129
|
+
|
|
130
|
+
```vue
|
|
131
|
+
<script setup lang="ts">
|
|
132
|
+
import { ref } from "vue";
|
|
133
|
+
import { Alert, AlertAction } from "@umbra-ui/core";
|
|
134
|
+
|
|
135
|
+
const showConfirm = ref(false);
|
|
136
|
+
|
|
137
|
+
const confirmActions: AlertAction[] = [
|
|
138
|
+
{
|
|
139
|
+
title: "Cancel",
|
|
140
|
+
action: () => (showConfirm.value = false),
|
|
141
|
+
type: "Cancel",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
title: "Delete",
|
|
145
|
+
action: () => {
|
|
146
|
+
console.log("Item deleted!");
|
|
147
|
+
showConfirm.value = false;
|
|
148
|
+
},
|
|
149
|
+
type: "Destructive",
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<template>
|
|
155
|
+
<div>
|
|
156
|
+
<button @click="showConfirm = true">Delete Item</button>
|
|
157
|
+
|
|
158
|
+
<Alert
|
|
159
|
+
:show="showConfirm"
|
|
160
|
+
title="Delete Item"
|
|
161
|
+
description="This action cannot be undone. Are you sure you want to delete this item?"
|
|
162
|
+
:actions="confirmActions"
|
|
163
|
+
@update:show="showConfirm = $event"
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
</template>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Information Alert
|
|
170
|
+
|
|
171
|
+
```vue
|
|
172
|
+
<script setup lang="ts">
|
|
173
|
+
import { ref } from "vue";
|
|
174
|
+
import { Alert, AlertAction } from "@umbra-ui/core";
|
|
175
|
+
|
|
176
|
+
const showInfo = ref(false);
|
|
177
|
+
|
|
178
|
+
const infoActions: AlertAction[] = [
|
|
179
|
+
{
|
|
180
|
+
title: "Got it",
|
|
181
|
+
action: () => (showInfo.value = false),
|
|
182
|
+
type: "Default",
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
</script>
|
|
186
|
+
|
|
187
|
+
<template>
|
|
188
|
+
<div>
|
|
189
|
+
<button @click="showInfo = true">Show Information</button>
|
|
190
|
+
|
|
191
|
+
<Alert
|
|
192
|
+
:show="showInfo"
|
|
193
|
+
title="New Feature Available"
|
|
194
|
+
description="We've added a new feature that allows you to export your data in multiple formats. Check it out in the settings menu!"
|
|
195
|
+
:actions="infoActions"
|
|
196
|
+
@update:show="showInfo = $event"
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
</template>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Multiple Choice Alert
|
|
203
|
+
|
|
204
|
+
```vue
|
|
205
|
+
<script setup lang="ts">
|
|
206
|
+
import { ref } from "vue";
|
|
207
|
+
import { Alert, AlertAction } from "@umbra-ui/core";
|
|
208
|
+
|
|
209
|
+
const showMultiple = ref(false);
|
|
210
|
+
|
|
211
|
+
const multipleActions: AlertAction[] = [
|
|
212
|
+
{
|
|
213
|
+
title: "Save Draft",
|
|
214
|
+
action: () => {
|
|
215
|
+
console.log("Saved as draft");
|
|
216
|
+
showMultiple.value = false;
|
|
217
|
+
},
|
|
218
|
+
type: "Secondary",
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
title: "Discard",
|
|
222
|
+
action: () => {
|
|
223
|
+
console.log("Discarded changes");
|
|
224
|
+
showMultiple.value = false;
|
|
225
|
+
},
|
|
226
|
+
type: "Cancel",
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
title: "Publish",
|
|
230
|
+
action: () => {
|
|
231
|
+
console.log("Published!");
|
|
232
|
+
showMultiple.value = false;
|
|
233
|
+
},
|
|
234
|
+
type: "Default",
|
|
235
|
+
},
|
|
236
|
+
];
|
|
237
|
+
</script>
|
|
238
|
+
|
|
239
|
+
<template>
|
|
240
|
+
<div>
|
|
241
|
+
<button @click="showMultiple = true">Close Editor</button>
|
|
242
|
+
|
|
243
|
+
<Alert
|
|
244
|
+
:show="showMultiple"
|
|
245
|
+
title="Unsaved Changes"
|
|
246
|
+
description="You have unsaved changes. What would you like to do?"
|
|
247
|
+
:actions="multipleActions"
|
|
248
|
+
@update:show="showMultiple = $event"
|
|
249
|
+
/>
|
|
250
|
+
</div>
|
|
251
|
+
</template>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Form Validation Alert
|
|
255
|
+
|
|
256
|
+
```vue
|
|
257
|
+
<script setup lang="ts">
|
|
258
|
+
import { ref } from "vue";
|
|
259
|
+
import { Alert, AlertAction } from "@umbra-ui/core";
|
|
260
|
+
|
|
261
|
+
const showValidation = ref(false);
|
|
262
|
+
const validationMessage = ref("");
|
|
263
|
+
|
|
264
|
+
const validateForm = () => {
|
|
265
|
+
// Simulate form validation
|
|
266
|
+
const errors = [
|
|
267
|
+
"Email is required",
|
|
268
|
+
"Password must be at least 8 characters",
|
|
269
|
+
];
|
|
270
|
+
|
|
271
|
+
if (errors.length > 0) {
|
|
272
|
+
validationMessage.value = errors.join(". ");
|
|
273
|
+
showValidation.value = true;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const validationActions: AlertAction[] = [
|
|
278
|
+
{
|
|
279
|
+
title: "OK",
|
|
280
|
+
action: () => (showValidation.value = false),
|
|
281
|
+
type: "Default",
|
|
282
|
+
},
|
|
283
|
+
];
|
|
284
|
+
</script>
|
|
285
|
+
|
|
286
|
+
<template>
|
|
287
|
+
<div>
|
|
288
|
+
<form @submit.prevent="validateForm">
|
|
289
|
+
<input type="email" placeholder="Email" />
|
|
290
|
+
<input type="password" placeholder="Password" />
|
|
291
|
+
<button type="submit">Submit</button>
|
|
292
|
+
</form>
|
|
293
|
+
|
|
294
|
+
<Alert
|
|
295
|
+
:show="showValidation"
|
|
296
|
+
title="Validation Error"
|
|
297
|
+
:description="validationMessage"
|
|
298
|
+
:actions="validationActions"
|
|
299
|
+
@update:show="showValidation = $event"
|
|
300
|
+
/>
|
|
301
|
+
</div>
|
|
302
|
+
</template>
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Network Error Alert
|
|
306
|
+
|
|
307
|
+
```vue
|
|
308
|
+
<script setup lang="ts">
|
|
309
|
+
import { ref } from "vue";
|
|
310
|
+
import { Alert, AlertAction } from "@umbra-ui/core";
|
|
311
|
+
|
|
312
|
+
const showNetworkError = ref(false);
|
|
313
|
+
|
|
314
|
+
const retryConnection = () => {
|
|
315
|
+
console.log("Retrying connection...");
|
|
316
|
+
showNetworkError.value = false;
|
|
317
|
+
// Add retry logic here
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
const networkErrorActions: AlertAction[] = [
|
|
321
|
+
{
|
|
322
|
+
title: "Cancel",
|
|
323
|
+
action: () => (showNetworkError.value = false),
|
|
324
|
+
type: "Cancel",
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
title: "Retry",
|
|
328
|
+
action: retryConnection,
|
|
329
|
+
type: "Default",
|
|
330
|
+
},
|
|
331
|
+
];
|
|
332
|
+
</script>
|
|
333
|
+
|
|
334
|
+
<template>
|
|
335
|
+
<div>
|
|
336
|
+
<button @click="showNetworkError = true">Simulate Network Error</button>
|
|
337
|
+
|
|
338
|
+
<Alert
|
|
339
|
+
:show="showNetworkError"
|
|
340
|
+
title="Connection Error"
|
|
341
|
+
description="Unable to connect to the server. Please check your internet connection and try again."
|
|
342
|
+
:actions="networkErrorActions"
|
|
343
|
+
@update:show="showNetworkError = $event"
|
|
344
|
+
/>
|
|
345
|
+
</div>
|
|
346
|
+
</template>
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Settings Change Alert
|
|
350
|
+
|
|
351
|
+
```vue
|
|
352
|
+
<script setup lang="ts">
|
|
353
|
+
import { ref } from "vue";
|
|
354
|
+
import { Alert, AlertAction } from "@umbra-ui/core";
|
|
355
|
+
|
|
356
|
+
const showSettingsAlert = ref(false);
|
|
357
|
+
const settingName = ref("Dark Mode");
|
|
358
|
+
|
|
359
|
+
const applySetting = () => {
|
|
360
|
+
console.log(`Applied setting: ${settingName.value}`);
|
|
361
|
+
showSettingsAlert.value = false;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
const revertSetting = () => {
|
|
365
|
+
console.log(`Reverted setting: ${settingName.value}`);
|
|
366
|
+
showSettingsAlert.value = false;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
const settingsActions: AlertAction[] = [
|
|
370
|
+
{
|
|
371
|
+
title: "Revert",
|
|
372
|
+
action: revertSetting,
|
|
373
|
+
type: "Cancel",
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
title: "Apply",
|
|
377
|
+
action: applySetting,
|
|
378
|
+
type: "Default",
|
|
379
|
+
},
|
|
380
|
+
];
|
|
381
|
+
</script>
|
|
382
|
+
|
|
383
|
+
<template>
|
|
384
|
+
<div>
|
|
385
|
+
<button @click="showSettingsAlert = true">Change Setting</button>
|
|
386
|
+
|
|
387
|
+
<Alert
|
|
388
|
+
:show="showSettingsAlert"
|
|
389
|
+
title="Setting Changed"
|
|
390
|
+
:description="`You've changed the ${settingName} setting. Would you like to apply this change?`"
|
|
391
|
+
:actions="settingsActions"
|
|
392
|
+
@update:show="showSettingsAlert = $event"
|
|
393
|
+
/>
|
|
394
|
+
</div>
|
|
395
|
+
</template>
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Logout Confirmation
|
|
399
|
+
|
|
400
|
+
```vue
|
|
401
|
+
<script setup lang="ts">
|
|
402
|
+
import { ref } from "vue";
|
|
403
|
+
import { Alert, AlertAction } from "@umbra-ui/core";
|
|
404
|
+
|
|
405
|
+
const showLogout = ref(false);
|
|
406
|
+
|
|
407
|
+
const logout = () => {
|
|
408
|
+
console.log("User logged out");
|
|
409
|
+
showLogout.value = false;
|
|
410
|
+
// Add logout logic here
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
const logoutActions: AlertAction[] = [
|
|
414
|
+
{
|
|
415
|
+
title: "Stay Logged In",
|
|
416
|
+
action: () => (showLogout.value = false),
|
|
417
|
+
type: "Cancel",
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
title: "Logout",
|
|
421
|
+
action: logout,
|
|
422
|
+
type: "Destructive",
|
|
423
|
+
},
|
|
424
|
+
];
|
|
425
|
+
</script>
|
|
426
|
+
|
|
427
|
+
<template>
|
|
428
|
+
<div>
|
|
429
|
+
<button @click="showLogout = true">Logout</button>
|
|
430
|
+
|
|
431
|
+
<Alert
|
|
432
|
+
:show="showLogout"
|
|
433
|
+
title="Logout Confirmation"
|
|
434
|
+
description="Are you sure you want to logout? You will need to sign in again to access your account."
|
|
435
|
+
:actions="logoutActions"
|
|
436
|
+
@update:show="showLogout = $event"
|
|
437
|
+
/>
|
|
438
|
+
</div>
|
|
439
|
+
</template>
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
## Notes
|
|
443
|
+
|
|
444
|
+
- The component uses Vue's `Teleport` to render the alert outside the component tree, ensuring proper z-index layering
|
|
445
|
+
- The alert includes smooth fade and scale animations for a polished user experience
|
|
446
|
+
- Button ordering is automatically handled based on action types (Cancel buttons are positioned appropriately)
|
|
447
|
+
- The component supports both light and dark themes through CSS custom properties
|
|
448
|
+
- The alert is fully accessible and supports keyboard navigation
|
|
449
|
+
- The overlay prevents interaction with the underlying content when the alert is visible
|
|
450
|
+
- Action types automatically map to appropriate button styles (Destructive → danger, Default → primary, etc.)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* Light theme using Colors */
|
|
2
|
+
:root {
|
|
3
|
+
/* Alert overlay colors */
|
|
4
|
+
--alert-overlay-bg: rgba(
|
|
5
|
+
0,
|
|
6
|
+
0,
|
|
7
|
+
0,
|
|
8
|
+
0.4
|
|
9
|
+
); /* blackA8 - lighter overlay for light mode */
|
|
10
|
+
|
|
11
|
+
/* Alert content colors */
|
|
12
|
+
--alert-content-bg: #ffffff; /* white background for light mode */
|
|
13
|
+
--alert-content-color: #1a1d23; /* gray12 - dark text for light mode */
|
|
14
|
+
--alert-content-shadow: rgba(
|
|
15
|
+
0,
|
|
16
|
+
0,
|
|
17
|
+
0,
|
|
18
|
+
0.08
|
|
19
|
+
); /* blackA6 - lighter shadow for light mode */
|
|
20
|
+
|
|
21
|
+
/* Alert description colors */
|
|
22
|
+
--alert-description-opacity: 0.7; /* slightly more visible in light mode */
|
|
23
|
+
|
|
24
|
+
/* Alert destructive button color */
|
|
25
|
+
--alert-destructive-color: #e5484d; /* red9 - destructive action color */
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Dark theme */
|
|
29
|
+
.dark,
|
|
30
|
+
.dark-theme {
|
|
31
|
+
/* Alert overlay colors */
|
|
32
|
+
--alert-overlay-bg: rgba(0, 0, 0, 0.7); /* Original dark mode value */
|
|
33
|
+
|
|
34
|
+
/* Alert content colors */
|
|
35
|
+
--alert-content-bg: #222222; /* Original dark mode value */
|
|
36
|
+
--alert-content-color: #eeeeee; /* Original dark mode value */
|
|
37
|
+
--alert-content-shadow: rgba(0, 0, 0, 0.1); /* Original dark mode value */
|
|
38
|
+
|
|
39
|
+
/* Alert description colors */
|
|
40
|
+
--alert-description-opacity: 0.5; /* Original dark mode value */
|
|
41
|
+
|
|
42
|
+
/* Alert destructive button color */
|
|
43
|
+
--alert-destructive-color: #e5484d; /* red9 - destructive action color */
|
|
44
|
+
}
|