File tree Expand file tree Collapse file tree 3 files changed +23
-10
lines changed Expand file tree Collapse file tree 3 files changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
17
17
} from 'vue'
18
18
19
19
import { ARIA as ARIAComponent } from '@/components/ARIA'
20
+ import { useDragging , useHover } from '@/composables'
20
21
import {
21
22
CarouselConfig ,
22
23
createSlideRegistry ,
@@ -49,8 +50,6 @@ import {
49
50
} from './Carousel.types'
50
51
import { carouselProps } from './carouselProps'
51
52
52
- import { useDragging } from '@/composables'
53
-
54
53
export const Carousel = defineComponent ( {
55
54
name : 'VueCarousel' ,
56
55
props : carouselProps ,
@@ -333,14 +332,7 @@ export const Carousel = defineComponent({
333
332
/**
334
333
* Carousel Event listeners
335
334
*/
336
- const isHover = ref ( false )
337
-
338
- const handleMouseEnter = ( ) : void => {
339
- isHover . value = true
340
- }
341
- const handleMouseLeave = ( ) : void => {
342
- isHover . value = false
343
- }
335
+ const { isHover, handleMouseEnter, handleMouseLeave } = useHover ( )
344
336
345
337
const handleArrowKeys = throttle ( ( event : KeyboardEvent ) : void => {
346
338
if ( event . ctrlKey ) return
Original file line number Diff line number Diff line change
1
+ export * from './useDragging'
2
+ export * from './useHover'
Original file line number Diff line number Diff line change
1
+ import { ref } from 'vue'
2
+
3
+ export function useHover ( ) {
4
+ const isHover = ref ( false )
5
+
6
+ const handleMouseEnter = ( ) : void => {
7
+ isHover . value = true
8
+ }
9
+
10
+ const handleMouseLeave = ( ) : void => {
11
+ isHover . value = false
12
+ }
13
+
14
+ return {
15
+ isHover,
16
+ handleMouseEnter,
17
+ handleMouseLeave,
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments