Line data Source code
1 : import { computed } from 'vue'
2 : import type { CSSProperties, ComputedRef } from 'vue'
3 :
4 : interface PopoverSizeOptions {
5 : minWidth?: string
6 : maxWidth?: string
7 : }
8 :
9 : /**
10 : * Composable for managing popover sizing styles
11 : * @param options Popover size configuration
12 : * @returns Computed style object for popover sizing
13 : */
14 1170 : export function usePopoverSizing(
15 : options: PopoverSizeOptions
16 : ): ComputedRef<CSSProperties> {
17 1170 : return computed(() => {
18 1147 : const { minWidth, maxWidth } = options
19 1147 : const style: CSSProperties = {}
20 :
21 1147 : if (minWidth) {
22 0 : style.minWidth = minWidth
23 : }
24 :
25 1147 : if (maxWidth) {
26 0 : style.maxWidth = maxWidth
27 : }
28 :
29 1147 : return style
30 : })
31 : }
|