@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.
Files changed (272) hide show
  1. package/dist/components/controls/Dropdown/types.d.ts +5 -0
  2. package/dist/components/controls/Dropdown/types.d.ts.map +1 -0
  3. package/dist/components/controls/Dropdown/types.js +1 -0
  4. package/dist/components/controls/SegmentedControl/types.d.ts +6 -0
  5. package/dist/components/controls/SegmentedControl/types.d.ts.map +1 -0
  6. package/dist/components/controls/SegmentedControl/types.js +1 -0
  7. package/dist/components/dialogs/Alert/types.d.ts +7 -0
  8. package/dist/components/dialogs/Alert/types.d.ts.map +1 -0
  9. package/dist/components/dialogs/Alert/types.js +1 -0
  10. package/dist/components/dialogs/Toast/types.d.ts +34 -0
  11. package/dist/components/dialogs/Toast/types.d.ts.map +1 -0
  12. package/dist/components/dialogs/Toast/types.js +10 -0
  13. package/dist/components/dialogs/Toast/useToast.d.ts +36 -0
  14. package/dist/components/dialogs/Toast/useToast.d.ts.map +1 -0
  15. package/dist/components/dialogs/Toast/useToast.js +90 -0
  16. package/dist/components/indicators/Tooltip/tooltip.d.ts +3 -0
  17. package/dist/components/indicators/Tooltip/tooltip.d.ts.map +1 -0
  18. package/dist/components/indicators/Tooltip/tooltip.js +33 -0
  19. package/dist/components/indicators/Tooltip/types.d.ts +14 -0
  20. package/dist/components/indicators/Tooltip/types.d.ts.map +1 -0
  21. package/dist/components/indicators/Tooltip/types.js +1 -0
  22. package/dist/components/indicators/Tooltip/useTooltip.d.ts +18 -0
  23. package/dist/components/indicators/Tooltip/useTooltip.d.ts.map +1 -0
  24. package/dist/components/indicators/Tooltip/useTooltip.js +57 -0
  25. package/dist/components/inputs/Tags/tag-bar-styles.d.ts +14 -0
  26. package/dist/components/inputs/Tags/tag-bar-styles.d.ts.map +1 -0
  27. package/dist/components/inputs/Tags/tag-bar-styles.js +313 -0
  28. package/dist/components/inputs/Tags/types.d.ts +93 -0
  29. package/dist/components/inputs/Tags/types.d.ts.map +1 -0
  30. package/dist/components/inputs/Tags/types.js +216 -0
  31. package/dist/components/inputs/search/types.d.ts +9 -0
  32. package/dist/components/inputs/search/types.d.ts.map +1 -0
  33. package/dist/components/inputs/search/types.js +1 -0
  34. package/dist/components/navigation/adaptive/types.d.ts +16 -0
  35. package/dist/components/navigation/adaptive/types.d.ts.map +1 -0
  36. package/dist/components/navigation/adaptive/types.js +1 -0
  37. package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts +27 -0
  38. package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts.map +1 -0
  39. package/dist/components/navigation/adaptive/useAdaptiveLayout.js +40 -0
  40. package/dist/components/navigation/adaptive/useBreakpoints.d.ts +6 -0
  41. package/dist/components/navigation/adaptive/useBreakpoints.d.ts.map +1 -0
  42. package/dist/components/navigation/adaptive/useBreakpoints.js +37 -0
  43. package/dist/components/navigation/adaptive/useContainerMonitor.d.ts +93 -0
  44. package/dist/components/navigation/adaptive/useContainerMonitor.d.ts.map +1 -0
  45. package/dist/components/navigation/adaptive/useContainerMonitor.js +145 -0
  46. package/dist/components/navigation/adaptive/useViewAnimation.d.ts +31 -0
  47. package/dist/components/navigation/adaptive/useViewAnimation.d.ts.map +1 -0
  48. package/dist/components/navigation/adaptive/useViewAnimation.js +591 -0
  49. package/dist/components/navigation/adaptive/useViewResize.d.ts +52 -0
  50. package/dist/components/navigation/adaptive/useViewResize.d.ts.map +1 -0
  51. package/dist/components/navigation/adaptive/useViewResize.js +146 -0
  52. package/dist/components/navigation/navstack/useNavigationStack.d.ts +25 -0
  53. package/dist/components/navigation/navstack/useNavigationStack.d.ts.map +1 -0
  54. package/dist/components/navigation/navstack/useNavigationStack.js +133 -0
  55. package/dist/components/navigation/slideover/useSlideoverController.d.ts +20 -0
  56. package/dist/components/navigation/slideover/useSlideoverController.d.ts.map +1 -0
  57. package/dist/components/navigation/slideover/useSlideoverController.js +267 -0
  58. package/dist/components/navigation/splitview/useSplitViewController.d.ts +20 -0
  59. package/dist/components/navigation/splitview/useSplitViewController.d.ts.map +1 -0
  60. package/dist/components/navigation/splitview/useSplitViewController.js +325 -0
  61. package/dist/components/navigation/tabcontroller/types.d.ts +21 -0
  62. package/dist/components/navigation/tabcontroller/types.d.ts.map +1 -0
  63. package/dist/components/navigation/tabcontroller/types.js +1 -0
  64. package/dist/components/navigation/tabcontroller/useTabController.d.ts +5 -0
  65. package/dist/components/navigation/tabcontroller/useTabController.d.ts.map +1 -0
  66. package/dist/components/navigation/tabcontroller/useTabController.js +10 -0
  67. package/dist/components/navigation/types.d.ts +8 -0
  68. package/dist/components/navigation/types.d.ts.map +1 -0
  69. package/dist/components/navigation/types.js +1 -0
  70. package/dist/components/pickers/CollectionPicker/types.d.ts +11 -0
  71. package/dist/components/pickers/CollectionPicker/types.d.ts.map +1 -0
  72. package/dist/components/pickers/CollectionPicker/types.js +1 -0
  73. package/dist/components/pickers/ColorPicker/colors.d.ts +13 -0
  74. package/dist/components/pickers/ColorPicker/colors.d.ts.map +1 -0
  75. package/dist/components/pickers/ColorPicker/colors.js +266 -0
  76. package/dist/components/pickers/FilePicker/types.d.ts +10 -0
  77. package/dist/components/pickers/FilePicker/types.d.ts.map +1 -0
  78. package/dist/components/pickers/FilePicker/types.js +1 -0
  79. package/dist/index.d.ts +91 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +196 -0
  82. package/dist/theme.d.ts +73 -0
  83. package/dist/theme.d.ts.map +1 -0
  84. package/dist/theme.js +279 -0
  85. package/dist/themes/blank.d.ts +7 -0
  86. package/dist/themes/blank.d.ts.map +1 -0
  87. package/dist/themes/blank.js +543 -0
  88. package/dist/themes/crimson-dark.d.ts +4 -0
  89. package/dist/themes/crimson-dark.d.ts.map +1 -0
  90. package/dist/themes/crimson-dark.js +552 -0
  91. package/dist/themes/cyan-light.d.ts +4 -0
  92. package/dist/themes/cyan-light.d.ts.map +1 -0
  93. package/dist/themes/cyan-light.js +552 -0
  94. package/dist/themes/dark.d.ts +4 -0
  95. package/dist/themes/dark.d.ts.map +1 -0
  96. package/dist/themes/dark.js +551 -0
  97. package/dist/themes/gold-dark.d.ts +4 -0
  98. package/dist/themes/gold-dark.d.ts.map +1 -0
  99. package/dist/themes/gold-dark.js +552 -0
  100. package/dist/themes/grass-dark.d.ts +4 -0
  101. package/dist/themes/grass-dark.d.ts.map +1 -0
  102. package/dist/themes/grass-dark.js +552 -0
  103. package/dist/themes/indigo.d.ts +4 -0
  104. package/dist/themes/indigo.d.ts.map +1 -0
  105. package/dist/themes/indigo.js +552 -0
  106. package/dist/themes/light.d.ts +4 -0
  107. package/dist/themes/light.d.ts.map +1 -0
  108. package/dist/themes/light.js +551 -0
  109. package/dist/themes/orange-dark.d.ts +4 -0
  110. package/dist/themes/orange-dark.d.ts.map +1 -0
  111. package/dist/themes/orange-dark.js +551 -0
  112. package/dist/themes/orange-light.d.ts +4 -0
  113. package/dist/themes/orange-light.d.ts.map +1 -0
  114. package/dist/themes/orange-light.js +551 -0
  115. package/package.json +62 -0
  116. package/src/components/controls/Button/Button.vue +417 -0
  117. package/src/components/controls/Button/README.md +348 -0
  118. package/src/components/controls/Button/theme.css +200 -0
  119. package/src/components/controls/Checkbox/Checkbox.vue +164 -0
  120. package/src/components/controls/Checkbox/README.md +441 -0
  121. package/src/components/controls/Checkbox/theme.css +36 -0
  122. package/src/components/controls/Dropdown/Dropdown.vue +476 -0
  123. package/src/components/controls/Dropdown/README.md +370 -0
  124. package/src/components/controls/Dropdown/theme.css +50 -0
  125. package/src/components/controls/Dropdown/types.ts +6 -0
  126. package/src/components/controls/IconButton/IconButton.vue +267 -0
  127. package/src/components/controls/IconButton/README.md +502 -0
  128. package/src/components/controls/IconButton/theme.css +89 -0
  129. package/src/components/controls/Radio/README.md +591 -0
  130. package/src/components/controls/Radio/Radio.vue +89 -0
  131. package/src/components/controls/Radio/theme.css +14 -0
  132. package/src/components/controls/RangeSlider/README.md +608 -0
  133. package/src/components/controls/RangeSlider/RangeSlider.vue +535 -0
  134. package/src/components/controls/RangeSlider/theme.css +80 -0
  135. package/src/components/controls/SegmentedControl/README.md +587 -0
  136. package/src/components/controls/SegmentedControl/SegmentedControl.vue +284 -0
  137. package/src/components/controls/SegmentedControl/theme.css +60 -0
  138. package/src/components/controls/SegmentedControl/types.ts +5 -0
  139. package/src/components/controls/Slider/README.md +627 -0
  140. package/src/components/controls/Slider/Slider.vue +260 -0
  141. package/src/components/controls/Slider/theme.css +74 -0
  142. package/src/components/controls/Stepper/README.md +601 -0
  143. package/src/components/controls/Stepper/Stepper.vue +103 -0
  144. package/src/components/controls/Stepper/theme.css +53 -0
  145. package/src/components/controls/Switch/README.md +667 -0
  146. package/src/components/controls/Switch/Switch.vue +127 -0
  147. package/src/components/controls/Switch/theme.css +42 -0
  148. package/src/components/dialogs/Alert/Alert.vue +218 -0
  149. package/src/components/dialogs/Alert/README.md +450 -0
  150. package/src/components/dialogs/Alert/theme.css +44 -0
  151. package/src/components/dialogs/Alert/types.ts +11 -0
  152. package/src/components/dialogs/Toast/README.md +522 -0
  153. package/src/components/dialogs/Toast/Toast.vue +296 -0
  154. package/src/components/dialogs/Toast/ToastContainer.vue +330 -0
  155. package/src/components/dialogs/Toast/theme.css +44 -0
  156. package/src/components/dialogs/Toast/types.ts +46 -0
  157. package/src/components/dialogs/Toast/useToast.ts +127 -0
  158. package/src/components/indicators/ProgressBar/ProgressBar.vue +98 -0
  159. package/src/components/indicators/ProgressBar/README.md +744 -0
  160. package/src/components/indicators/ProgressBar/theme.css +36 -0
  161. package/src/components/indicators/Tooltip/README.md +723 -0
  162. package/src/components/indicators/Tooltip/TooltipProvider.vue +142 -0
  163. package/src/components/indicators/Tooltip/theme.css +18 -0
  164. package/src/components/indicators/Tooltip/tooltip.ts +48 -0
  165. package/src/components/indicators/Tooltip/types.ts +15 -0
  166. package/src/components/indicators/Tooltip/useTooltip.ts +71 -0
  167. package/src/components/inputs/AutogrowTextView/AutogrowTextView.vue +110 -0
  168. package/src/components/inputs/AutogrowTextView/README.md +643 -0
  169. package/src/components/inputs/AutogrowTextView/theme.css +28 -0
  170. package/src/components/inputs/InputCard/InputCard.vue +600 -0
  171. package/src/components/inputs/InputCard/README.md +636 -0
  172. package/src/components/inputs/InputEmail/InputEmail.vue +698 -0
  173. package/src/components/inputs/InputEmail/README.md +764 -0
  174. package/src/components/inputs/InputNumber/InputNumber.vue +300 -0
  175. package/src/components/inputs/InputNumber/README.md +749 -0
  176. package/src/components/inputs/InputPhone/InputPhone.vue +645 -0
  177. package/src/components/inputs/InputPhone/README.md +636 -0
  178. package/src/components/inputs/InputSecure/InputSecure.vue +646 -0
  179. package/src/components/inputs/InputSecure/README.md +771 -0
  180. package/src/components/inputs/InputText/InputText.vue +225 -0
  181. package/src/components/inputs/InputText/README.md +844 -0
  182. package/src/components/inputs/OTP/OTP.vue +349 -0
  183. package/src/components/inputs/OTP/README.md +736 -0
  184. package/src/components/inputs/OTP/theme.css +50 -0
  185. package/src/components/inputs/StringCapture/README.md +718 -0
  186. package/src/components/inputs/StringCapture/StringCapture.vue +315 -0
  187. package/src/components/inputs/StringCapture/theme.css +86 -0
  188. package/src/components/inputs/Tags/README.md +897 -0
  189. package/src/components/inputs/Tags/TagBar.vue +793 -0
  190. package/src/components/inputs/Tags/TagCreation.vue +219 -0
  191. package/src/components/inputs/Tags/TagPicker.vue +380 -0
  192. package/src/components/inputs/Tags/tag-bar-styles.ts +354 -0
  193. package/src/components/inputs/Tags/theme.css +121 -0
  194. package/src/components/inputs/Tags/types.ts +346 -0
  195. package/src/components/inputs/search/README.md +759 -0
  196. package/src/components/inputs/search/SearchBar.vue +394 -0
  197. package/src/components/inputs/search/SearchResults.vue +310 -0
  198. package/src/components/inputs/search/theme.css +187 -0
  199. package/src/components/inputs/search/types.ts +8 -0
  200. package/src/components/inputs/theme.css +102 -0
  201. package/src/components/menus/ActionMenu/ActionMenu.vue +383 -0
  202. package/src/components/menus/ActionMenu/README.md +825 -0
  203. package/src/components/menus/ActionMenu/theme.css +93 -0
  204. package/src/components/models/Popover/Popover.vue +551 -0
  205. package/src/components/models/Popover/README.md +885 -0
  206. package/src/components/models/Popover/theme.css +52 -0
  207. package/src/components/models/Sheet/README.md +1159 -0
  208. package/src/components/models/Sheet/Sheet.vue +465 -0
  209. package/src/components/models/Sheet/theme.css +72 -0
  210. package/src/components/models/Sidebar/README.md +1228 -0
  211. package/src/components/models/Sidebar/Sidebar.vue +480 -0
  212. package/src/components/models/Sidebar/theme.css +90 -0
  213. package/src/components/navigation/adaptive/AdaptiveLayout.vue +779 -0
  214. package/src/components/navigation/adaptive/AdaptiveLayoutBreadcrumbs.vue +192 -0
  215. package/src/components/navigation/adaptive/AdaptiveLayoutMenuButton.vue +149 -0
  216. package/src/components/navigation/adaptive/README.md +768 -0
  217. package/src/components/navigation/adaptive/types.ts +19 -0
  218. package/src/components/navigation/adaptive/useAdaptiveLayout.ts +89 -0
  219. package/src/components/navigation/adaptive/useBreakpoints.ts +41 -0
  220. package/src/components/navigation/adaptive/useContainerMonitor.ts +214 -0
  221. package/src/components/navigation/adaptive/useViewAnimation.ts +721 -0
  222. package/src/components/navigation/adaptive/useViewResize.ts +211 -0
  223. package/src/components/navigation/navstack/NavigationStack.vue +180 -0
  224. package/src/components/navigation/navstack/README.md +994 -0
  225. package/src/components/navigation/navstack/useNavigationStack.ts +164 -0
  226. package/src/components/navigation/slideover/README.md +1275 -0
  227. package/src/components/navigation/slideover/SlideoverController.vue +287 -0
  228. package/src/components/navigation/slideover/useSlideoverController.ts +320 -0
  229. package/src/components/navigation/splitview/README.md +1115 -0
  230. package/src/components/navigation/splitview/SplitViewController.vue +176 -0
  231. package/src/components/navigation/splitview/useSplitViewController.ts +388 -0
  232. package/src/components/navigation/tabcontroller/README.md +919 -0
  233. package/src/components/navigation/tabcontroller/TabController.vue +307 -0
  234. package/src/components/navigation/tabcontroller/TabItem.vue +57 -0
  235. package/src/components/navigation/tabcontroller/types.ts +24 -0
  236. package/src/components/navigation/tabcontroller/useTabController.ts +18 -0
  237. package/src/components/navigation/theme.css +91 -0
  238. package/src/components/navigation/types.ts +7 -0
  239. package/src/components/pickers/CollectionPicker/CollectionPicker.vue +398 -0
  240. package/src/components/pickers/CollectionPicker/README.md +1115 -0
  241. package/src/components/pickers/CollectionPicker/theme.css +14 -0
  242. package/src/components/pickers/CollectionPicker/types.ts +11 -0
  243. package/src/components/pickers/ColorPicker/ColorPicker.vue +376 -0
  244. package/src/components/pickers/ColorPicker/README.md +1439 -0
  245. package/src/components/pickers/ColorPicker/colors.ts +299 -0
  246. package/src/components/pickers/ColorPicker/theme.css +32 -0
  247. package/src/components/pickers/DatePicker/DatePicker.vue +660 -0
  248. package/src/components/pickers/DatePicker/README.md +1195 -0
  249. package/src/components/pickers/DatePicker/theme.css +22 -0
  250. package/src/components/pickers/FilePicker/FilePicker.vue +534 -0
  251. package/src/components/pickers/FilePicker/README.md +1542 -0
  252. package/src/components/pickers/FilePicker/theme.css +48 -0
  253. package/src/components/pickers/FilePicker/types.ts +10 -0
  254. package/src/components/pickers/IconPicker/IconPicker.vue +327 -0
  255. package/src/components/pickers/IconPicker/README.md +1161 -0
  256. package/src/components/pickers/IconPicker/theme.css +28 -0
  257. package/src/components/pickers/theme.css +82 -0
  258. package/src/components/views/MarkdownViewer/MarkdownViewer.vue +442 -0
  259. package/src/components/views/MarkdownViewer/README.md +833 -0
  260. package/src/components/views/MarkdownViewer/theme.css +130 -0
  261. package/src/index.ts +263 -0
  262. package/src/theme.ts +378 -0
  263. package/src/themes/crimson-dark.ts +556 -0
  264. package/src/themes/cyan-light.ts +556 -0
  265. package/src/themes/dark.ts +557 -0
  266. package/src/themes/gold-dark.ts +556 -0
  267. package/src/themes/grass-dark.ts +556 -0
  268. package/src/themes/indigo.ts +556 -0
  269. package/src/themes/light.ts +557 -0
  270. package/src/themes/orange-dark.ts +557 -0
  271. package/src/themes/orange-light.ts +557 -0
  272. package/src/vue.d.ts +45 -0
@@ -0,0 +1,480 @@
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 SidebarProps {
15
+ /**
16
+ * Controls whether the sidebar is visible
17
+ */
18
+ modelValue: boolean;
19
+ /**
20
+ * The side where the sidebar appears
21
+ * @default 'left'
22
+ */
23
+ side?: "top" | "bottom" | "left" | "right";
24
+ /**
25
+ * Whether clicking the backdrop closes the sidebar
26
+ * @default true
27
+ */
28
+ dismissOnBackdrop?: boolean;
29
+ /**
30
+ * Width of the sidebar (for left/right)
31
+ * @default '280px'
32
+ */
33
+ width?: string;
34
+ /**
35
+ * Height of the sidebar (for top/bottom)
36
+ * @default '280px'
37
+ */
38
+ height?: string;
39
+ /**
40
+ * Minimum width of the sidebar
41
+ * @default '280px'
42
+ */
43
+ minWidth?: string;
44
+ /**
45
+ * Minimum height of the sidebar
46
+ * @default '280px'
47
+ */
48
+ minHeight?: string;
49
+ /**
50
+ * Maximum width of the sidebar
51
+ * @default '90vw'
52
+ */
53
+ maxWidth?: string;
54
+ /**
55
+ * Maximum height of the sidebar
56
+ * @default '90vh'
57
+ */
58
+ maxHeight?: string;
59
+ /**
60
+ * Animation duration in seconds
61
+ * @default 0.4
62
+ */
63
+ animationDuration?: number;
64
+ /**
65
+ * Backdrop style: 'blur' or 'dim'
66
+ * @default 'blur'
67
+ */
68
+ backdropStyle?: "blur" | "dim";
69
+ /**
70
+ * Z-index for the sidebar
71
+ * @default 1000
72
+ */
73
+ zIndex?: number;
74
+ /**
75
+ * Teleport target
76
+ * @default 'body'
77
+ */
78
+ teleportTo?: string | HTMLElement;
79
+ }
80
+
81
+ const props = withDefaults(defineProps<SidebarProps>(), {
82
+ side: "left",
83
+ dismissOnBackdrop: true,
84
+ width: "280px",
85
+ height: "280px",
86
+ minWidth: "280px",
87
+ minHeight: "280px",
88
+ maxWidth: "90vw",
89
+ maxHeight: "90vh",
90
+ animationDuration: 0.4,
91
+ backdropStyle: "blur",
92
+ zIndex: 1000,
93
+ teleportTo: "body",
94
+ });
95
+
96
+ const emit = defineEmits<{
97
+ "update:modelValue": [value: boolean];
98
+ "backdrop-click": [];
99
+ open: [];
100
+ close: [];
101
+ "after-enter": [];
102
+ "after-leave": [];
103
+ }>();
104
+
105
+ const isVisible = ref(false);
106
+ const isAnimating = ref(false);
107
+ const sidebarRef = ref<HTMLElement>();
108
+ const backdropRef = ref<HTMLElement>();
109
+ const wrapperRef = ref<HTMLElement>();
110
+
111
+ // Store animation timeline
112
+ let timeline: gsap.core.Timeline | null = null;
113
+
114
+ const sidebarStyles = computed(() => {
115
+ const styles: Record<string, string> = {
116
+ zIndex: String(props.zIndex + 1),
117
+ };
118
+
119
+ switch (props.side) {
120
+ case "left":
121
+ styles.left = "0";
122
+ styles.top = "0";
123
+ styles.bottom = "0";
124
+ styles.width = props.width;
125
+ styles.minWidth = props.minWidth;
126
+ styles.maxWidth = props.maxWidth;
127
+ break;
128
+ case "right":
129
+ styles.right = "0";
130
+ styles.top = "0";
131
+ styles.bottom = "0";
132
+ styles.width = props.width;
133
+ styles.minWidth = props.minWidth;
134
+ styles.maxWidth = props.maxWidth;
135
+ break;
136
+ case "top":
137
+ styles.top = "0";
138
+ styles.left = "0";
139
+ styles.right = "0";
140
+ styles.height = props.height;
141
+ styles.minHeight = props.minHeight;
142
+ styles.maxHeight = props.maxHeight;
143
+ break;
144
+ case "bottom":
145
+ styles.bottom = "0";
146
+ styles.left = "0";
147
+ styles.right = "0";
148
+ styles.height = props.height;
149
+ styles.minHeight = props.minHeight;
150
+ styles.maxHeight = props.maxHeight;
151
+ break;
152
+ }
153
+
154
+ return styles;
155
+ });
156
+
157
+ const backdropStyles = computed(() => ({
158
+ zIndex: String(props.zIndex),
159
+ }));
160
+
161
+ const handleBackdropClick = () => {
162
+ emit("backdrop-click");
163
+ if (props.dismissOnBackdrop && !isAnimating.value) {
164
+ close();
165
+ }
166
+ };
167
+
168
+ const getInitialPosition = () => {
169
+ switch (props.side) {
170
+ case "top":
171
+ return { y: "-100%", x: 0 };
172
+ case "bottom":
173
+ return { y: "100%", x: 0 };
174
+ case "left":
175
+ return { x: "-100%", y: 0 };
176
+ case "right":
177
+ return { x: "100%", y: 0 };
178
+ default:
179
+ return { x: "-100%", y: 0 };
180
+ }
181
+ };
182
+
183
+ const open = async () => {
184
+ if (isAnimating.value) return;
185
+
186
+ isAnimating.value = true;
187
+ isVisible.value = true;
188
+ emit("open");
189
+
190
+ await nextTick();
191
+
192
+ if (!sidebarRef.value || !backdropRef.value || !wrapperRef.value) return;
193
+
194
+ // Kill any existing timeline
195
+ if (timeline) timeline.kill();
196
+
197
+ // Create new timeline
198
+ timeline = gsap.timeline({
199
+ onComplete: () => {
200
+ isAnimating.value = false;
201
+ emit("after-enter");
202
+ },
203
+ });
204
+
205
+ const initialPos = getInitialPosition();
206
+
207
+ // Set initial states
208
+ gsap.set(wrapperRef.value, { display: "block" });
209
+ gsap.set(sidebarRef.value, { ...initialPos, opacity: 1 });
210
+ gsap.set(backdropRef.value, { opacity: 0 });
211
+
212
+ // Animate in
213
+ timeline
214
+ .to(
215
+ backdropRef.value,
216
+ {
217
+ opacity: 1,
218
+ duration: props.animationDuration * 0.8,
219
+ ease: "power2.out",
220
+ },
221
+ 0
222
+ )
223
+ .to(
224
+ sidebarRef.value,
225
+ {
226
+ x: 0,
227
+ y: 0,
228
+ duration: props.animationDuration,
229
+ ease: "expo.out",
230
+ force3D: true, // Enable GPU acceleration
231
+ },
232
+ 0
233
+ );
234
+ };
235
+
236
+ const close = async () => {
237
+ if (!isVisible.value || isAnimating.value) return;
238
+
239
+ isAnimating.value = true;
240
+ emit("update:modelValue", false);
241
+ emit("close");
242
+
243
+ if (!sidebarRef.value || !backdropRef.value || !wrapperRef.value) return;
244
+
245
+ // Kill any existing timeline
246
+ if (timeline) timeline.kill();
247
+
248
+ const exitPos = getInitialPosition();
249
+
250
+ // Create new timeline
251
+ timeline = gsap.timeline({
252
+ onComplete: () => {
253
+ isVisible.value = false;
254
+ isAnimating.value = false;
255
+ if (wrapperRef.value) {
256
+ gsap.set(wrapperRef.value, { display: "none" });
257
+ }
258
+ emit("after-leave");
259
+ },
260
+ });
261
+
262
+ // Animate out with faster close
263
+ timeline
264
+ .to(
265
+ backdropRef.value,
266
+ {
267
+ opacity: 0,
268
+ duration: props.animationDuration * 0.7,
269
+ ease: "power2.in",
270
+ },
271
+ 0
272
+ )
273
+ .to(
274
+ sidebarRef.value,
275
+ {
276
+ ...exitPos,
277
+ duration: props.animationDuration * 0.8,
278
+ ease: "power3.in", // Faster dismissal
279
+ force3D: true, // Enable GPU acceleration
280
+ },
281
+ 0
282
+ );
283
+ };
284
+
285
+ const handleEscape = (event: KeyboardEvent) => {
286
+ if (event.key === "Escape" && props.modelValue && props.dismissOnBackdrop) {
287
+ close();
288
+ }
289
+ };
290
+
291
+ watch(
292
+ () => props.modelValue,
293
+ (newValue) => {
294
+ if (newValue) {
295
+ open();
296
+ } else {
297
+ close();
298
+ }
299
+ }
300
+ );
301
+
302
+ onMounted(() => {
303
+ document.addEventListener("keydown", handleEscape);
304
+ // Set initial hidden state
305
+ if (wrapperRef.value) {
306
+ gsap.set(wrapperRef.value, { display: "none" });
307
+ }
308
+ });
309
+
310
+ onUnmounted(() => {
311
+ document.removeEventListener("keydown", handleEscape);
312
+ if (timeline) timeline.kill();
313
+ });
314
+
315
+ defineExpose({
316
+ open,
317
+ close,
318
+ isVisible,
319
+ isAnimating,
320
+ });
321
+ </script>
322
+
323
+ <template>
324
+ <Teleport :to="teleportTo">
325
+ <div ref="wrapperRef" :class="$style.wrapper">
326
+ <!-- Backdrop -->
327
+ <div
328
+ ref="backdropRef"
329
+ :class="[$style.backdrop, $style[`backdrop--${backdropStyle}`]]"
330
+ :style="backdropStyles"
331
+ @click="handleBackdropClick"
332
+ />
333
+
334
+ <!-- Sidebar -->
335
+ <div
336
+ ref="sidebarRef"
337
+ :class="[$style.sidebar, $style[`sidebar--${side}`]]"
338
+ :style="sidebarStyles"
339
+ @click.stop
340
+ >
341
+ <slot />
342
+ </div>
343
+ </div>
344
+ </Teleport>
345
+ </template>
346
+
347
+ <style module>
348
+ .wrapper {
349
+ position: fixed;
350
+ inset: 0;
351
+ pointer-events: none;
352
+ }
353
+
354
+ .backdrop {
355
+ position: absolute;
356
+ inset: 0;
357
+ pointer-events: auto;
358
+ will-change: opacity;
359
+ }
360
+
361
+ .backdrop--blur {
362
+ background-color: var(--sidebar-backdrop-blur-bg);
363
+ backdrop-filter: blur(10px);
364
+ -webkit-backdrop-filter: blur(10px);
365
+ }
366
+
367
+ .backdrop--dim {
368
+ background-color: var(--sidebar-backdrop-dim-bg);
369
+ }
370
+
371
+ .sidebar {
372
+ position: absolute;
373
+ background-color: var(--sidebar-bg);
374
+ overflow-y: auto;
375
+ overflow-x: hidden;
376
+ pointer-events: auto;
377
+ will-change: transform;
378
+ transform: translateZ(0); /* Force GPU acceleration */
379
+
380
+ /* Better scrollbar styling */
381
+ scrollbar-width: thin;
382
+ scrollbar-color: var(--sidebar-scrollbar-thumb) transparent;
383
+ }
384
+
385
+ /* Webkit scrollbar styling */
386
+ .sidebar::-webkit-scrollbar {
387
+ width: 8px;
388
+ height: 8px;
389
+ }
390
+
391
+ .sidebar::-webkit-scrollbar-track {
392
+ background: transparent;
393
+ }
394
+
395
+ .sidebar::-webkit-scrollbar-thumb {
396
+ background-color: var(--sidebar-scrollbar-thumb);
397
+ border-radius: 4px;
398
+ }
399
+
400
+ .sidebar::-webkit-scrollbar-thumb:hover {
401
+ background-color: var(--sidebar-scrollbar-thumb-hover);
402
+ }
403
+
404
+ /* Shadow styles for different sides */
405
+ .sidebar--left {
406
+ box-shadow: 4px 0 20px var(--sidebar-shadow-left);
407
+ }
408
+
409
+ .sidebar--right {
410
+ box-shadow: -4px 0 20px var(--sidebar-shadow-right);
411
+ }
412
+
413
+ .sidebar--top {
414
+ box-shadow: 0 4px 20px var(--sidebar-shadow-top);
415
+ }
416
+
417
+ .sidebar--bottom {
418
+ box-shadow: 0 -4px 20px var(--sidebar-shadow-bottom);
419
+ }
420
+
421
+ /* Handle safe areas for mobile devices */
422
+ @supports (padding: max(0px)) {
423
+ .sidebar--left {
424
+ padding-left: env(safe-area-inset-left);
425
+ }
426
+
427
+ .sidebar--right {
428
+ padding-right: env(safe-area-inset-right);
429
+ }
430
+
431
+ .sidebar--top {
432
+ padding-top: env(safe-area-inset-top);
433
+ }
434
+
435
+ .sidebar--bottom {
436
+ padding-bottom: env(safe-area-inset-bottom);
437
+ }
438
+ }
439
+
440
+ /* Dark mode support */
441
+ .dark,
442
+ .dark-theme .sidebar--left {
443
+ box-shadow: 4px 0 20px var(--sidebar-shadow-left);
444
+ }
445
+
446
+ .dark,
447
+ .dark-theme .sidebar--right {
448
+ box-shadow: -4px 0 20px var(--sidebar-shadow-right);
449
+ }
450
+
451
+ .dark,
452
+ .dark-theme .sidebar--top {
453
+ box-shadow: 0 4px 20px var(--sidebar-shadow-top);
454
+ }
455
+
456
+ .dark,
457
+ .dark-theme .sidebar--bottom {
458
+ box-shadow: 0 -4px 20px var(--sidebar-shadow-bottom);
459
+ }
460
+
461
+ .dark,
462
+ .dark-theme .backdrop--dim {
463
+ background-color: var(--sidebar-backdrop-dim-bg);
464
+ }
465
+
466
+ .dark,
467
+ .dark-theme .sidebar::-webkit-scrollbar-thumb {
468
+ background-color: var(--sidebar-scrollbar-thumb);
469
+ }
470
+
471
+ .dark,
472
+ .dark-theme .sidebar::-webkit-scrollbar-thumb:hover {
473
+ background-color: var(--sidebar-scrollbar-thumb-hover);
474
+ }
475
+
476
+ /* Prevent body scroll when sidebar is open */
477
+ body:has(.wrapper) {
478
+ overflow: hidden;
479
+ }
480
+ </style>
@@ -0,0 +1,90 @@
1
+ /* Light theme using Colors */
2
+ :root {
3
+ /* Sidebar colors */
4
+ --sidebar-bg: #ffffff; /* white - light background for light mode */
5
+
6
+ /* Sidebar backdrop colors */
7
+ --sidebar-backdrop-blur-bg: rgba(
8
+ 0,
9
+ 0,
10
+ 0,
11
+ 0.3
12
+ ); /* blackA8 - blur backdrop for light mode */
13
+ --sidebar-backdrop-dim-bg: rgba(
14
+ 0,
15
+ 0,
16
+ 0,
17
+ 0.7
18
+ ); /* blackA12 - dim backdrop for light mode */
19
+
20
+ /* Sidebar shadow colors */
21
+ --sidebar-shadow-left: rgba(
22
+ 0,
23
+ 0,
24
+ 0,
25
+ 0.15
26
+ ); /* blackA6 - left shadow for light mode */
27
+ --sidebar-shadow-right: rgba(
28
+ 0,
29
+ 0,
30
+ 0,
31
+ 0.15
32
+ ); /* blackA6 - right shadow for light mode */
33
+ --sidebar-shadow-top: rgba(
34
+ 0,
35
+ 0,
36
+ 0,
37
+ 0.15
38
+ ); /* blackA6 - top shadow for light mode */
39
+ --sidebar-shadow-bottom: rgba(
40
+ 0,
41
+ 0,
42
+ 0,
43
+ 0.15
44
+ ); /* blackA6 - bottom shadow for light mode */
45
+
46
+ /* Sidebar scrollbar colors */
47
+ --sidebar-scrollbar-thumb: rgba(
48
+ 0,
49
+ 0,
50
+ 0,
51
+ 0.2
52
+ ); /* blackA6 - scrollbar thumb for light mode */
53
+ --sidebar-scrollbar-thumb-hover: rgba(
54
+ 0,
55
+ 0,
56
+ 0,
57
+ 0.3
58
+ ); /* blackA8 - scrollbar thumb hover for light mode */
59
+ }
60
+
61
+ /* Dark theme */
62
+ .dark,
63
+ .dark-theme {
64
+ /* Sidebar colors */
65
+ --sidebar-bg: #111111; /* Original dark mode value */
66
+
67
+ /* Sidebar backdrop colors */
68
+ --sidebar-backdrop-blur-bg: rgba(0, 0, 0, 0.3); /* Original dark mode value */
69
+ --sidebar-backdrop-dim-bg: rgba(0, 0, 0, 0.85); /* Original dark mode value */
70
+
71
+ /* Sidebar shadow colors */
72
+ --sidebar-shadow-left: rgba(0, 0, 0, 0.5); /* Original dark mode value */
73
+ --sidebar-shadow-right: rgba(0, 0, 0, 0.5); /* Original dark mode value */
74
+ --sidebar-shadow-top: rgba(0, 0, 0, 0.5); /* Original dark mode value */
75
+ --sidebar-shadow-bottom: rgba(0, 0, 0, 0.5); /* Original dark mode value */
76
+
77
+ /* Sidebar scrollbar colors */
78
+ --sidebar-scrollbar-thumb: rgba(
79
+ 255,
80
+ 255,
81
+ 255,
82
+ 0.2
83
+ ); /* Original dark mode value */
84
+ --sidebar-scrollbar-thumb-hover: rgba(
85
+ 255,
86
+ 255,
87
+ 255,
88
+ 0.3
89
+ ); /* Original dark mode value */
90
+ }