@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,465 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
onMounted,
|
|
5
|
+
onUnmounted,
|
|
6
|
+
ref,
|
|
7
|
+
watch,
|
|
8
|
+
Teleport,
|
|
9
|
+
nextTick,
|
|
10
|
+
} from "vue";
|
|
11
|
+
import gsap from "gsap";
|
|
12
|
+
import "./theme.css";
|
|
13
|
+
|
|
14
|
+
export interface SheetProps {
|
|
15
|
+
/**
|
|
16
|
+
* Controls whether the sheet is visible
|
|
17
|
+
*/
|
|
18
|
+
modelValue: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The side from which the sheet slides in
|
|
21
|
+
* @default 'bottom'
|
|
22
|
+
*/
|
|
23
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
24
|
+
/**
|
|
25
|
+
* Whether clicking the backdrop closes the sheet
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
dismissOnBackdrop?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Width of the sheet
|
|
31
|
+
* @default '90vw'
|
|
32
|
+
*/
|
|
33
|
+
width?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Height of the sheet
|
|
36
|
+
* @default 'fit-content'
|
|
37
|
+
*/
|
|
38
|
+
height?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Maximum width of the sheet
|
|
41
|
+
* @default '540px'
|
|
42
|
+
*/
|
|
43
|
+
maxWidth?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Maximum height of the sheet
|
|
46
|
+
* @default 'fit-content'
|
|
47
|
+
*/
|
|
48
|
+
maxHeight?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Animation duration in seconds
|
|
51
|
+
* @default 0.5
|
|
52
|
+
*/
|
|
53
|
+
animationDuration?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Animation type: 'slide' or 'ghost'
|
|
56
|
+
* @default 'slide'
|
|
57
|
+
*/
|
|
58
|
+
animationType?: "slide" | "ghost";
|
|
59
|
+
/**
|
|
60
|
+
* Backdrop style: 'blur' or 'dim'
|
|
61
|
+
* @default 'blur'
|
|
62
|
+
*/
|
|
63
|
+
backdropStyle?: "blur" | "dim";
|
|
64
|
+
/**
|
|
65
|
+
* Z-index for the sheet
|
|
66
|
+
* @default 1000
|
|
67
|
+
*/
|
|
68
|
+
zIndex?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Teleport target
|
|
71
|
+
* @default 'body'
|
|
72
|
+
*/
|
|
73
|
+
teleportTo?: string | HTMLElement;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const props = withDefaults(defineProps<SheetProps>(), {
|
|
77
|
+
side: "bottom",
|
|
78
|
+
dismissOnBackdrop: true,
|
|
79
|
+
width: "90vw",
|
|
80
|
+
height: "50vh",
|
|
81
|
+
maxWidth: "540px",
|
|
82
|
+
maxHeight: "fit-content",
|
|
83
|
+
animationDuration: 0.5,
|
|
84
|
+
animationType: "slide",
|
|
85
|
+
backdropStyle: "blur",
|
|
86
|
+
zIndex: 1000,
|
|
87
|
+
teleportTo: "body",
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const emit = defineEmits<{
|
|
91
|
+
"update:modelValue": [value: boolean];
|
|
92
|
+
"backdrop-click": [];
|
|
93
|
+
open: [];
|
|
94
|
+
close: [];
|
|
95
|
+
"after-enter": [];
|
|
96
|
+
"after-leave": [];
|
|
97
|
+
}>();
|
|
98
|
+
|
|
99
|
+
const isVisible = ref(false);
|
|
100
|
+
const isAnimating = ref(false);
|
|
101
|
+
const sheetRef = ref<HTMLElement>();
|
|
102
|
+
const backdropRef = ref<HTMLElement>();
|
|
103
|
+
const wrapperRef = ref<HTMLElement>();
|
|
104
|
+
|
|
105
|
+
// Store animation timeline
|
|
106
|
+
let timeline: gsap.core.Timeline | null = null;
|
|
107
|
+
|
|
108
|
+
const sheetStyles = computed(() => {
|
|
109
|
+
const styles: Record<string, string> = {
|
|
110
|
+
width: props.width,
|
|
111
|
+
height: props.height,
|
|
112
|
+
maxWidth: props.maxWidth,
|
|
113
|
+
maxHeight: props.maxHeight,
|
|
114
|
+
zIndex: String(props.zIndex + 1),
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return styles;
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const backdropStyles = computed(() => ({
|
|
121
|
+
zIndex: String(props.zIndex),
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
const handleBackdropClick = () => {
|
|
125
|
+
emit("backdrop-click");
|
|
126
|
+
if (props.dismissOnBackdrop && !isAnimating.value) {
|
|
127
|
+
close();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const getInitialPosition = () => {
|
|
132
|
+
switch (props.side) {
|
|
133
|
+
case "top":
|
|
134
|
+
return { y: "-100%", x: 0 };
|
|
135
|
+
case "bottom":
|
|
136
|
+
return { y: "100%", x: 0 };
|
|
137
|
+
case "left":
|
|
138
|
+
return { x: "-100%", y: 0 };
|
|
139
|
+
case "right":
|
|
140
|
+
return { x: "100%", y: 0 };
|
|
141
|
+
default:
|
|
142
|
+
return { y: "100%", x: 0 };
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const open = async () => {
|
|
147
|
+
if (isAnimating.value) return;
|
|
148
|
+
|
|
149
|
+
isAnimating.value = true;
|
|
150
|
+
isVisible.value = true;
|
|
151
|
+
emit("open");
|
|
152
|
+
|
|
153
|
+
await nextTick();
|
|
154
|
+
|
|
155
|
+
if (!sheetRef.value || !backdropRef.value || !wrapperRef.value) return;
|
|
156
|
+
|
|
157
|
+
// Kill any existing timeline
|
|
158
|
+
if (timeline) timeline.kill();
|
|
159
|
+
|
|
160
|
+
// Create new timeline
|
|
161
|
+
timeline = gsap.timeline({
|
|
162
|
+
onComplete: () => {
|
|
163
|
+
isAnimating.value = false;
|
|
164
|
+
emit("after-enter");
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// Set initial states
|
|
169
|
+
gsap.set(wrapperRef.value, { display: "flex" });
|
|
170
|
+
gsap.set(backdropRef.value, { opacity: 0 });
|
|
171
|
+
|
|
172
|
+
if (props.animationType === "ghost") {
|
|
173
|
+
// Ghost animation: scale + opacity
|
|
174
|
+
gsap.set(sheetRef.value, {
|
|
175
|
+
opacity: 0,
|
|
176
|
+
scale: 0.8,
|
|
177
|
+
x: 0,
|
|
178
|
+
y: 0,
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
timeline
|
|
182
|
+
.to(
|
|
183
|
+
backdropRef.value,
|
|
184
|
+
{
|
|
185
|
+
opacity: 1,
|
|
186
|
+
duration: props.animationDuration * 0.8,
|
|
187
|
+
ease: "power2.out",
|
|
188
|
+
},
|
|
189
|
+
0
|
|
190
|
+
)
|
|
191
|
+
.to(
|
|
192
|
+
sheetRef.value,
|
|
193
|
+
{
|
|
194
|
+
opacity: 1,
|
|
195
|
+
scale: 1,
|
|
196
|
+
duration: props.animationDuration,
|
|
197
|
+
ease: "back.out(1.2)",
|
|
198
|
+
},
|
|
199
|
+
0
|
|
200
|
+
);
|
|
201
|
+
} else {
|
|
202
|
+
// Slide animation
|
|
203
|
+
const initialPos = getInitialPosition();
|
|
204
|
+
gsap.set(sheetRef.value, { ...initialPos, opacity: 1 });
|
|
205
|
+
|
|
206
|
+
timeline
|
|
207
|
+
.to(
|
|
208
|
+
backdropRef.value,
|
|
209
|
+
{
|
|
210
|
+
opacity: 1,
|
|
211
|
+
duration: props.animationDuration * 0.8,
|
|
212
|
+
ease: "power2.out",
|
|
213
|
+
},
|
|
214
|
+
0
|
|
215
|
+
)
|
|
216
|
+
.to(
|
|
217
|
+
sheetRef.value,
|
|
218
|
+
{
|
|
219
|
+
x: 0,
|
|
220
|
+
y: 0,
|
|
221
|
+
duration: props.animationDuration,
|
|
222
|
+
ease: "expo.out",
|
|
223
|
+
force3D: true, // Enable GPU acceleration
|
|
224
|
+
},
|
|
225
|
+
0
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const close = async () => {
|
|
231
|
+
if (!isVisible.value || isAnimating.value) return;
|
|
232
|
+
|
|
233
|
+
isAnimating.value = true;
|
|
234
|
+
emit("update:modelValue", false);
|
|
235
|
+
emit("close");
|
|
236
|
+
|
|
237
|
+
if (!sheetRef.value || !backdropRef.value || !wrapperRef.value) return;
|
|
238
|
+
|
|
239
|
+
// Kill any existing timeline
|
|
240
|
+
if (timeline) timeline.kill();
|
|
241
|
+
|
|
242
|
+
// Create new timeline
|
|
243
|
+
timeline = gsap.timeline({
|
|
244
|
+
onComplete: () => {
|
|
245
|
+
isVisible.value = false;
|
|
246
|
+
isAnimating.value = false;
|
|
247
|
+
if (wrapperRef.value) {
|
|
248
|
+
gsap.set(wrapperRef.value, { display: "none" });
|
|
249
|
+
}
|
|
250
|
+
emit("after-leave");
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
if (props.animationType === "ghost") {
|
|
255
|
+
// Ghost animation: scale + opacity
|
|
256
|
+
timeline
|
|
257
|
+
.to(
|
|
258
|
+
backdropRef.value,
|
|
259
|
+
{
|
|
260
|
+
opacity: 0,
|
|
261
|
+
duration: props.animationDuration * 0.8,
|
|
262
|
+
ease: "power2.in",
|
|
263
|
+
},
|
|
264
|
+
0
|
|
265
|
+
)
|
|
266
|
+
.to(
|
|
267
|
+
sheetRef.value,
|
|
268
|
+
{
|
|
269
|
+
opacity: 0,
|
|
270
|
+
scale: 0.9,
|
|
271
|
+
duration: props.animationDuration * 0.8,
|
|
272
|
+
ease: "power2.in",
|
|
273
|
+
},
|
|
274
|
+
0
|
|
275
|
+
);
|
|
276
|
+
} else {
|
|
277
|
+
// Slide animation with faster close
|
|
278
|
+
const exitPos = getInitialPosition();
|
|
279
|
+
|
|
280
|
+
timeline
|
|
281
|
+
.to(
|
|
282
|
+
backdropRef.value,
|
|
283
|
+
{
|
|
284
|
+
opacity: 0,
|
|
285
|
+
duration: props.animationDuration * 0.7,
|
|
286
|
+
ease: "power2.in",
|
|
287
|
+
},
|
|
288
|
+
0
|
|
289
|
+
)
|
|
290
|
+
.to(
|
|
291
|
+
sheetRef.value,
|
|
292
|
+
{
|
|
293
|
+
...exitPos,
|
|
294
|
+
duration: props.animationDuration * 0.8,
|
|
295
|
+
ease: "power3.in", // Faster than expo for dismissal
|
|
296
|
+
force3D: true, // Enable GPU acceleration
|
|
297
|
+
},
|
|
298
|
+
0
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const handleEscape = (event: KeyboardEvent) => {
|
|
304
|
+
if (event.key === "Escape" && props.modelValue && props.dismissOnBackdrop) {
|
|
305
|
+
close();
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
watch(
|
|
310
|
+
() => props.modelValue,
|
|
311
|
+
(newValue) => {
|
|
312
|
+
if (newValue) {
|
|
313
|
+
open();
|
|
314
|
+
} else {
|
|
315
|
+
close();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
onMounted(() => {
|
|
321
|
+
document.addEventListener("keydown", handleEscape);
|
|
322
|
+
// Set initial hidden state
|
|
323
|
+
if (wrapperRef.value) {
|
|
324
|
+
gsap.set(wrapperRef.value, { display: "none" });
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
onUnmounted(() => {
|
|
329
|
+
document.removeEventListener("keydown", handleEscape);
|
|
330
|
+
if (timeline) timeline.kill();
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
defineExpose({
|
|
334
|
+
open,
|
|
335
|
+
close,
|
|
336
|
+
isVisible,
|
|
337
|
+
isAnimating,
|
|
338
|
+
});
|
|
339
|
+
</script>
|
|
340
|
+
|
|
341
|
+
<template>
|
|
342
|
+
<Teleport :to="teleportTo">
|
|
343
|
+
<div ref="wrapperRef" :class="$style.wrapper">
|
|
344
|
+
<!-- Backdrop -->
|
|
345
|
+
<div
|
|
346
|
+
ref="backdropRef"
|
|
347
|
+
:class="[$style.backdrop, $style[`backdrop--${backdropStyle}`]]"
|
|
348
|
+
:style="backdropStyles"
|
|
349
|
+
@click="handleBackdropClick"
|
|
350
|
+
/>
|
|
351
|
+
|
|
352
|
+
<!-- Sheet -->
|
|
353
|
+
<div
|
|
354
|
+
ref="sheetRef"
|
|
355
|
+
:class="[$style.sheet, $style[`sheet--${side}`]]"
|
|
356
|
+
:style="sheetStyles"
|
|
357
|
+
@click.stop
|
|
358
|
+
>
|
|
359
|
+
<slot />
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
</Teleport>
|
|
363
|
+
</template>
|
|
364
|
+
|
|
365
|
+
<style module>
|
|
366
|
+
.wrapper {
|
|
367
|
+
position: fixed;
|
|
368
|
+
inset: 0;
|
|
369
|
+
display: flex;
|
|
370
|
+
align-items: center;
|
|
371
|
+
justify-content: center;
|
|
372
|
+
pointer-events: none;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.backdrop {
|
|
376
|
+
position: absolute;
|
|
377
|
+
inset: 0;
|
|
378
|
+
pointer-events: auto;
|
|
379
|
+
will-change: opacity;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.backdrop--blur {
|
|
383
|
+
background-color: var(--sheet-backdrop-blur-bg);
|
|
384
|
+
backdrop-filter: blur(10px);
|
|
385
|
+
-webkit-backdrop-filter: blur(10px);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.backdrop--dim {
|
|
389
|
+
background-color: var(--sheet-backdrop-dim-bg);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.sheet {
|
|
393
|
+
position: relative;
|
|
394
|
+
background-color: var(--sheet-bg);
|
|
395
|
+
border-radius: 0.5rem;
|
|
396
|
+
overflow-y: auto;
|
|
397
|
+
overflow-x: hidden;
|
|
398
|
+
pointer-events: auto;
|
|
399
|
+
box-shadow: 0px 1px 0px 0px var(--sheet-shadow),
|
|
400
|
+
inset 0px 1px 0px 0px var(--sheet-inset-shadow);
|
|
401
|
+
will-change: transform, opacity;
|
|
402
|
+
transform: translateZ(0); /* Force GPU acceleration */
|
|
403
|
+
|
|
404
|
+
/* Better scrollbar styling */
|
|
405
|
+
scrollbar-width: thin;
|
|
406
|
+
scrollbar-color: var(--sheet-scrollbar-thumb) transparent;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/* Webkit scrollbar styling */
|
|
410
|
+
.sheet::-webkit-scrollbar {
|
|
411
|
+
width: 8px;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.sheet::-webkit-scrollbar-track {
|
|
415
|
+
background: transparent;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.sheet::-webkit-scrollbar-thumb {
|
|
419
|
+
background-color: var(--sheet-scrollbar-thumb);
|
|
420
|
+
border-radius: 4px;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.sheet::-webkit-scrollbar-thumb:hover {
|
|
424
|
+
background-color: var(--sheet-scrollbar-thumb-hover);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/* Handle safe areas for mobile devices */
|
|
428
|
+
@supports (padding: max(0px)) {
|
|
429
|
+
.sheet {
|
|
430
|
+
max-height: calc(
|
|
431
|
+
100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 40px
|
|
432
|
+
);
|
|
433
|
+
max-width: calc(
|
|
434
|
+
100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 40px
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* Ensure sheet doesn't exceed viewport */
|
|
440
|
+
.sheet {
|
|
441
|
+
max-height: calc(100vh - 40px);
|
|
442
|
+
max-width: calc(100vw - 40px);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/* Dark mode support */
|
|
446
|
+
.dark,
|
|
447
|
+
.dark-theme .backdrop--dim {
|
|
448
|
+
background-color: var(--sheet-backdrop-dim-bg);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.dark,
|
|
452
|
+
.dark-theme .sheet::-webkit-scrollbar-thumb {
|
|
453
|
+
background-color: var(--sheet-scrollbar-thumb);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.dark,
|
|
457
|
+
.dark-theme .sheet::-webkit-scrollbar-thumb:hover {
|
|
458
|
+
background-color: var(--sheet-scrollbar-thumb-hover);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/* Prevent body scroll when sheet is open */
|
|
462
|
+
body:has(.wrapper) {
|
|
463
|
+
overflow: hidden;
|
|
464
|
+
}
|
|
465
|
+
</style>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* Light theme using Colors */
|
|
2
|
+
:root {
|
|
3
|
+
/* Sheet colors */
|
|
4
|
+
--sheet-bg: #ffffff; /* white - light background for light mode */
|
|
5
|
+
--sheet-shadow: rgba(
|
|
6
|
+
0,
|
|
7
|
+
0,
|
|
8
|
+
0,
|
|
9
|
+
0.1
|
|
10
|
+
); /* blackA6 - lighter shadow for light mode */
|
|
11
|
+
--sheet-inset-shadow: rgba(
|
|
12
|
+
255,
|
|
13
|
+
255,
|
|
14
|
+
255,
|
|
15
|
+
0.8
|
|
16
|
+
); /* whiteA8 - inset highlight for light mode */
|
|
17
|
+
|
|
18
|
+
/* Sheet backdrop colors */
|
|
19
|
+
--sheet-backdrop-blur-bg: rgba(
|
|
20
|
+
0,
|
|
21
|
+
0,
|
|
22
|
+
0,
|
|
23
|
+
0.3
|
|
24
|
+
); /* blackA8 - blur backdrop for light mode */
|
|
25
|
+
--sheet-backdrop-dim-bg: rgba(
|
|
26
|
+
0,
|
|
27
|
+
0,
|
|
28
|
+
0,
|
|
29
|
+
0.7
|
|
30
|
+
); /* blackA12 - dim backdrop for light mode */
|
|
31
|
+
|
|
32
|
+
/* Sheet scrollbar colors */
|
|
33
|
+
--sheet-scrollbar-thumb: rgba(
|
|
34
|
+
0,
|
|
35
|
+
0,
|
|
36
|
+
0,
|
|
37
|
+
0.2
|
|
38
|
+
); /* blackA6 - scrollbar thumb for light mode */
|
|
39
|
+
--sheet-scrollbar-thumb-hover: rgba(
|
|
40
|
+
0,
|
|
41
|
+
0,
|
|
42
|
+
0,
|
|
43
|
+
0.3
|
|
44
|
+
); /* blackA8 - scrollbar thumb hover for light mode */
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Dark theme */
|
|
48
|
+
.dark,
|
|
49
|
+
.dark-theme {
|
|
50
|
+
/* Sheet colors */
|
|
51
|
+
--sheet-bg: #111111; /* Original dark mode value */
|
|
52
|
+
--sheet-shadow: rgba(0, 0, 0, 0.21); /* Original dark mode value */
|
|
53
|
+
--sheet-inset-shadow: rgba(255, 255, 255, 0.1); /* Original dark mode value */
|
|
54
|
+
|
|
55
|
+
/* Sheet backdrop colors */
|
|
56
|
+
--sheet-backdrop-blur-bg: rgba(0, 0, 0, 0.3); /* Original dark mode value */
|
|
57
|
+
--sheet-backdrop-dim-bg: rgba(0, 0, 0, 0.85); /* Original dark mode value */
|
|
58
|
+
|
|
59
|
+
/* Sheet scrollbar colors */
|
|
60
|
+
--sheet-scrollbar-thumb: rgba(
|
|
61
|
+
255,
|
|
62
|
+
255,
|
|
63
|
+
255,
|
|
64
|
+
0.2
|
|
65
|
+
); /* Original dark mode value */
|
|
66
|
+
--sheet-scrollbar-thumb-hover: rgba(
|
|
67
|
+
255,
|
|
68
|
+
255,
|
|
69
|
+
255,
|
|
70
|
+
0.3
|
|
71
|
+
); /* Original dark mode value */
|
|
72
|
+
}
|