daisy-ui-kit 3.0.12 → 5.0.0-pre.11

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 (213) hide show
  1. package/README.md +62 -14
  2. package/app/components/Accordion.vue +29 -0
  3. package/app/components/Alert.vue +36 -0
  4. package/app/components/Avatar.vue +131 -0
  5. package/app/components/AvatarGroup.vue +22 -0
  6. package/app/components/Badge.vue +67 -0
  7. package/app/components/Button.vue +135 -0
  8. package/app/components/Calendar.vue +89 -0
  9. package/app/components/CalendarInput.vue +174 -0
  10. package/app/components/CalendarSkeleton.vue +87 -0
  11. package/app/components/Card.vue +46 -0
  12. package/{components → app/components}/CardActions.vue +2 -5
  13. package/{components → app/components}/CardBody.vue +2 -5
  14. package/{components → app/components}/CardTitle.vue +1 -6
  15. package/app/components/Carousel.vue +24 -0
  16. package/app/components/Chat.vue +26 -0
  17. package/app/components/ChatBubble.vue +31 -0
  18. package/app/components/Checkbox.vue +51 -0
  19. package/app/components/Collapse.vue +75 -0
  20. package/app/components/CollapseTitle.vue +15 -0
  21. package/{components → app/components}/Countdown.vue +1 -1
  22. package/app/components/CountdownTimers.vue +69 -0
  23. package/app/components/Counter.vue +21 -0
  24. package/app/components/DaisyLink.vue +52 -0
  25. package/app/components/Diff.vue +11 -0
  26. package/app/components/Divider.vue +43 -0
  27. package/app/components/Dock.vue +60 -0
  28. package/app/components/DockItem.vue +26 -0
  29. package/app/components/DockLabel.vue +5 -0
  30. package/{components → app/components}/Drawer.vue +17 -12
  31. package/{components → app/components}/DrawerContent.vue +8 -5
  32. package/{components → app/components}/DrawerSide.vue +8 -5
  33. package/app/components/Dropdown.vue +106 -0
  34. package/app/components/DropdownButton.vue +23 -0
  35. package/app/components/DropdownContent.vue +127 -0
  36. package/{components → app/components}/DropdownTarget.vue +9 -2
  37. package/app/components/Fab.vue +16 -0
  38. package/app/components/FabClose.vue +18 -0
  39. package/app/components/FabMainAction.vue +5 -0
  40. package/app/components/FabTrigger.vue +117 -0
  41. package/app/components/Fieldset.vue +16 -0
  42. package/app/components/FileInput.vue +53 -0
  43. package/app/components/Filter.vue +125 -0
  44. package/app/components/Flex.vue +84 -0
  45. package/{components → app/components}/FlexItem.vue +30 -27
  46. package/app/components/Footer.vue +31 -0
  47. package/{components → app/components}/FooterTitle.vue +8 -5
  48. package/app/components/FormControl.vue +5 -0
  49. package/{components → app/components}/Hero.vue +8 -5
  50. package/{components → app/components}/HeroContent.vue +8 -5
  51. package/app/components/Hover3D.vue +22 -0
  52. package/app/components/HoverGallery.vue +11 -0
  53. package/{components → app/components}/Indicator.vue +8 -5
  54. package/{components → app/components}/IndicatorItem.vue +16 -13
  55. package/app/components/Input.vue +126 -0
  56. package/app/components/Kbd.vue +25 -0
  57. package/app/components/Label.vue +100 -0
  58. package/{components/CollapseTitle.vue → app/components/List.vue} +1 -1
  59. package/{components/FormControl.vue → app/components/ListColGrow.vue} +1 -1
  60. package/app/components/ListColWrap.vue +5 -0
  61. package/{components/Stat.vue → app/components/ListRow.vue} +1 -1
  62. package/app/components/LoadingBall.vue +42 -0
  63. package/app/components/LoadingBars.vue +42 -0
  64. package/app/components/LoadingDots.vue +42 -0
  65. package/app/components/LoadingInfinity.vue +42 -0
  66. package/app/components/LoadingRing.vue +42 -0
  67. package/app/components/LoadingSpinner.vue +42 -0
  68. package/app/components/Mask.vue +49 -0
  69. package/app/components/Menu.vue +30 -0
  70. package/app/components/MenuExpand.vue +94 -0
  71. package/app/components/MenuExpandToggle.vue +20 -0
  72. package/{components → app/components}/MenuItem.vue +7 -6
  73. package/app/components/MockupPhone.vue +14 -0
  74. package/{components → app/components}/Modal.vue +28 -13
  75. package/app/components/NavButton.vue +12 -0
  76. package/{components → app/components}/Navbar.vue +3 -5
  77. package/{components → app/components}/NavbarCenter.vue +3 -5
  78. package/{components → app/components}/NavbarEnd.vue +3 -5
  79. package/{components → app/components}/NavbarStart.vue +3 -5
  80. package/app/components/Progress.vue +46 -0
  81. package/{components → app/components}/Prose.vue +8 -3
  82. package/app/components/RadialProgress.vue +36 -0
  83. package/app/components/Radio.vue +69 -0
  84. package/{components → app/components}/RadioGroup.vue +2 -1
  85. package/app/components/Range.vue +61 -0
  86. package/app/components/RangeMeasure.vue +87 -0
  87. package/{components → app/components}/RangeMeasureTick.vue +9 -14
  88. package/app/components/Rating.vue +197 -0
  89. package/app/components/Select.vue +101 -0
  90. package/app/components/Skeleton.vue +5 -0
  91. package/app/components/SkeletonText.vue +11 -0
  92. package/app/components/Stack.vue +25 -0
  93. package/app/components/Stat.vue +19 -0
  94. package/app/components/Status.vue +43 -0
  95. package/app/components/Step.vue +34 -0
  96. package/app/components/StepIcon.vue +5 -0
  97. package/app/components/Steps.vue +23 -0
  98. package/app/components/Swap.vue +56 -0
  99. package/app/components/Tab.vue +51 -0
  100. package/{components → app/components}/TabContent.vue +10 -10
  101. package/app/components/Table.vue +32 -0
  102. package/app/components/Tabs.vue +53 -0
  103. package/app/components/Text.vue +162 -0
  104. package/app/components/TextArea.vue +64 -0
  105. package/app/components/TextRotate.vue +24 -0
  106. package/app/components/ThemeController.vue +45 -0
  107. package/app/components/ThemeProvider.vue +302 -0
  108. package/app/components/ThemeTile.vue +50 -0
  109. package/app/components/Timeline.vue +22 -0
  110. package/app/components/TimelineEnd.vue +14 -0
  111. package/app/components/TimelineItem.vue +5 -0
  112. package/app/components/TimelineLine.vue +29 -0
  113. package/app/components/TimelineMiddle.vue +5 -0
  114. package/app/components/TimelineStart.vue +14 -0
  115. package/app/components/Toast.vue +67 -0
  116. package/app/components/Toggle.vue +60 -0
  117. package/app/components/Tooltip.vue +48 -0
  118. package/app/components/TooltipContent.vue +5 -0
  119. package/app/components/ValidatorHint.vue +5 -0
  120. package/{utils → app/utils}/drawer-utils.ts +15 -13
  121. package/app/utils/position-area.ts +41 -0
  122. package/nuxt.js +7 -1
  123. package/package.json +60 -61
  124. package/components/Accordion.vue +0 -29
  125. package/components/Alert.vue +0 -25
  126. package/components/Artboard.vue +0 -33
  127. package/components/Avatar.vue +0 -70
  128. package/components/AvatarGroup.vue +0 -19
  129. package/components/Badge.vue +0 -50
  130. package/components/BottomNav.vue +0 -25
  131. package/components/Button.vue +0 -111
  132. package/components/Card.vue +0 -30
  133. package/components/Carousel.vue +0 -25
  134. package/components/Chat.vue +0 -27
  135. package/components/ChatBubble.vue +0 -34
  136. package/components/Checkbox.vue +0 -55
  137. package/components/Code.vue +0 -92
  138. package/components/Collapse.vue +0 -54
  139. package/components/CountdownTimers.vue +0 -70
  140. package/components/Counter.vue +0 -14
  141. package/components/Divider.vue +0 -24
  142. package/components/Dropdown.vue +0 -95
  143. package/components/DropdownButton.vue +0 -16
  144. package/components/DropdownContent.vue +0 -56
  145. package/components/FileInput.vue +0 -59
  146. package/components/Flex.vue +0 -59
  147. package/components/Footer.vue +0 -24
  148. package/components/Kbd.vue +0 -25
  149. package/components/Label.vue +0 -15
  150. package/components/LabelText.vue +0 -15
  151. package/components/LabelTextAlt.vue +0 -15
  152. package/components/Link.vue +0 -40
  153. package/components/LoadingBall.vue +0 -43
  154. package/components/LoadingBars.vue +0 -43
  155. package/components/LoadingDots.vue +0 -43
  156. package/components/LoadingInfinity.vue +0 -43
  157. package/components/LoadingRing.vue +0 -43
  158. package/components/LoadingSpinner.vue +0 -43
  159. package/components/Mask.config.ts +0 -77
  160. package/components/Mask.vue +0 -14
  161. package/components/Menu.vue +0 -35
  162. package/components/MenuExpand.vue +0 -79
  163. package/components/MenuExpandToggle.vue +0 -13
  164. package/components/MockupPhone.vue +0 -8
  165. package/components/NavButton.vue +0 -20
  166. package/components/Progress.vue +0 -42
  167. package/components/RadialProgress.vue +0 -41
  168. package/components/Radio.vue +0 -76
  169. package/components/Range.vue +0 -60
  170. package/components/RangeMeasure.vue +0 -83
  171. package/components/Rating.vue +0 -167
  172. package/components/Select.vue +0 -100
  173. package/components/Stack.vue +0 -13
  174. package/components/Step.vue +0 -36
  175. package/components/Steps.vue +0 -21
  176. package/components/Swap.vue +0 -58
  177. package/components/Tab.vue +0 -48
  178. package/components/Tabs.vue +0 -77
  179. package/components/TabsManager.vue +0 -38
  180. package/components/Text.vue +0 -142
  181. package/components/TextArea.vue +0 -64
  182. package/components/TextInput.vue +0 -66
  183. package/components/Toast.vue +0 -31
  184. package/components/Toggle.vue +0 -59
  185. package/components/Tooltip.vue +0 -47
  186. package/index.ts +0 -108
  187. package/utils/-utils.ts +0 -41
  188. package/utils/Button.config.ts +0 -26
  189. package/utils/fixtures.ts +0 -62
  190. package/utils/types.ts +0 -7
  191. /package/{components → app/components}/Breadcrumbs.vue +0 -0
  192. /package/{components → app/components}/CarouselItem.vue +0 -0
  193. /package/{components → app/components}/ChatFooter.vue +0 -0
  194. /package/{components → app/components}/ChatHeader.vue +0 -0
  195. /package/{components → app/components}/ChatImage.vue +0 -0
  196. /package/{components → app/components}/CollapseContent.vue +0 -0
  197. /package/{components → app/components}/Crumb.vue +0 -0
  198. /package/{components → app/components}/HeroOverlay.vue +0 -0
  199. /package/{components → app/components}/Join.vue +0 -0
  200. /package/{components → app/components}/MenuTitle.vue +0 -0
  201. /package/{components → app/components}/MockupBrowser.vue +0 -0
  202. /package/{components → app/components}/MockupBrowserToolbar.vue +0 -0
  203. /package/{components → app/components}/MockupCode.vue +0 -0
  204. /package/{components → app/components}/MockupWindow.vue +0 -0
  205. /package/{components → app/components}/ModalAction.vue +0 -0
  206. /package/{components → app/components}/ModalBox.vue +0 -0
  207. /package/{components → app/components}/StatActions.vue +0 -0
  208. /package/{components → app/components}/StatDesc.vue +0 -0
  209. /package/{components → app/components}/StatFigure.vue +0 -0
  210. /package/{components → app/components}/StatTitle.vue +0 -0
  211. /package/{components → app/components}/StatValue.vue +0 -0
  212. /package/{components → app/components}/Stats.vue +0 -0
  213. /package/{utils → app/utils}/random-string.ts +0 -0
@@ -0,0 +1,52 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
4
+ const NuxtLink = resolveComponent('NuxtLink')
5
+ const RouterLink = resolveComponent('RouterLink')
6
+
7
+ const props = withDefaults(
8
+ defineProps<{
9
+ is?: string
10
+ hover?: boolean
11
+
12
+ color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'success' | 'info' | 'warning' | 'error'
13
+ neutral?: boolean
14
+ primary?: boolean
15
+ secondary?: boolean
16
+ accent?: boolean
17
+ success?: boolean
18
+ info?: boolean
19
+ warning?: boolean
20
+ error?: boolean
21
+ }>(),
22
+ {
23
+ is: 'a',
24
+ },
25
+ )
26
+
27
+ const resolvedComponent = computed(() => {
28
+ if (props.is === 'NuxtLink') return NuxtLink
29
+ if (props.is === 'RouterLink') return RouterLink
30
+ return props.is
31
+ })
32
+ </script>
33
+
34
+ <template>
35
+ <component
36
+ :is="resolvedComponent"
37
+ class="link"
38
+ :class="{
39
+ 'link-neutral': neutral || color === 'neutral',
40
+ 'link-primary': primary || color === 'primary',
41
+ 'link-secondary': secondary || color === 'secondary',
42
+ 'link-accent': accent || color === 'accent',
43
+ 'link-success': success || color === 'success',
44
+ 'link-info': info || color === 'info',
45
+ 'link-warning': warning || color === 'warning',
46
+ 'link-error': error || color === 'error',
47
+ 'link-hover': hover,
48
+ }"
49
+ >
50
+ <slot />
51
+ </component>
52
+ </template>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <figure class="diff" tabindex="0">
3
+ <div class="diff-item-1" role="img" tabindex="0">
4
+ <slot name="one" />
5
+ </div>
6
+ <div class="diff-item-2" role="img">
7
+ <slot name="two" />
8
+ </div>
9
+ <div class="diff-resizer" />
10
+ </figure>
11
+ </template>
@@ -0,0 +1,43 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ orientation?: 'horizontal' | 'vertical'
4
+ horizontal?: boolean
5
+ vertical?: boolean
6
+ align?: 'center' | 'start' | 'end'
7
+ center?: boolean
8
+ start?: boolean
9
+ end?: boolean
10
+ color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'info' | 'error'
11
+ neutral?: boolean
12
+ primary?: boolean
13
+ secondary?: boolean
14
+ accent?: boolean
15
+ success?: boolean
16
+ warning?: boolean
17
+ info?: boolean
18
+ error?: boolean
19
+ }>()
20
+ </script>
21
+
22
+ <template>
23
+ <div
24
+ class="divider"
25
+ :class="{
26
+ 'divider-vertical': orientation === 'vertical' || vertical,
27
+ 'divider-horizontal': orientation !== 'vertical' || horizontal,
28
+ 'divider-neutral': color === 'neutral' || neutral,
29
+ 'divider-primary': color === 'primary' || primary,
30
+ 'divider-secondary': color === 'secondary' || secondary,
31
+ 'divider-accent': color === 'accent' || accent,
32
+ 'divider-success': color === 'success' || success,
33
+ 'divider-warning': color === 'warning' || warning,
34
+ 'divider-info': color === 'info' || info,
35
+ 'divider-error': color === 'error' || error,
36
+ 'divider-start': align === 'start' || start,
37
+ 'divider-center': align === 'center' || center,
38
+ 'divider-end': align === 'end' || end,
39
+ }"
40
+ >
41
+ <slot />
42
+ </div>
43
+ </template>
@@ -0,0 +1,60 @@
1
+ <script setup lang="ts">
2
+ import type { Ref } from 'vue'
3
+ import { provide, ref } from 'vue'
4
+ import { randomString } from '../utils/random-string'
5
+
6
+ const { size, xl, lg, md, sm, xs } = defineProps<{
7
+ size?: string
8
+ xl?: boolean
9
+ lg?: boolean
10
+ md?: boolean
11
+ sm?: boolean
12
+ xs?: boolean
13
+ }>()
14
+
15
+ const activeItemId = ref<string | null>(null)
16
+ const itemIds = ref<string[]>([])
17
+
18
+ function registerItem() {
19
+ const itemId = randomString()
20
+ itemIds.value.push(itemId)
21
+ function unregister() {
22
+ itemIds.value = itemIds.value.filter(id => id !== itemId)
23
+ if (activeItemId.value === itemId) {
24
+ activeItemId.value = null
25
+ }
26
+ }
27
+ return { id: itemId, unregister }
28
+ }
29
+
30
+ function setActiveItemId(itemId: string) {
31
+ activeItemId.value = itemId
32
+ }
33
+
34
+ export interface DockState {
35
+ activeItemId: Ref<string | null>
36
+ registerItem: () => { id: string; unregister: () => void }
37
+ setActiveItemId: (itemId: string) => void
38
+ }
39
+
40
+ provide<DockState>('dockState', {
41
+ activeItemId,
42
+ registerItem,
43
+ setActiveItemId,
44
+ })
45
+ </script>
46
+
47
+ <template>
48
+ <div
49
+ class="dock"
50
+ :class="{
51
+ 'dock-xl': xl || size === 'xl',
52
+ 'dock-lg': lg || size === 'lg',
53
+ 'dock-md': md || size === 'md',
54
+ 'dock-sm': sm || size === 'sm',
55
+ 'dock-xs': xs || size === 'xs',
56
+ }"
57
+ >
58
+ <slot />
59
+ </div>
60
+ </template>
@@ -0,0 +1,26 @@
1
+ <script setup lang="ts">
2
+ import type { DockState } from './Dock.vue'
3
+ import { inject, onUnmounted } from 'vue'
4
+
5
+ const { active } = defineProps<{
6
+ active?: boolean
7
+ }>()
8
+
9
+ const { registerItem, setActiveItemId, activeItemId } = inject<DockState>('dockState')!
10
+ const { id: itemId, unregister } = registerItem()
11
+
12
+ onUnmounted(() => {
13
+ unregister()
14
+ })
15
+ </script>
16
+
17
+ <template>
18
+ <div
19
+ :id="`dock-item-${itemId}`"
20
+ class="dock-item"
21
+ :class="{ 'dock-active': active || activeItemId === itemId }"
22
+ @click="setActiveItemId(itemId)"
23
+ >
24
+ <slot />
25
+ </div>
26
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="dock-label">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -2,30 +2,35 @@
2
2
  import { computed, watch } from 'vue'
3
3
  import { createDrawerState } from '../utils/drawer-utils'
4
4
 
5
- const props = withDefaults(defineProps<{
6
- open?: boolean
7
- name?: string
8
- end?: boolean
9
- }>(), {
10
- name: 'drawer',
11
- })
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ open?: boolean
8
+ name?: string
9
+ end?: boolean
10
+ }>(),
11
+ {
12
+ name: 'drawer',
13
+ },
14
+ )
12
15
  const emit = defineEmits(['update:open'])
13
16
 
14
17
  // sync `open` prop with drawerState.isDrawerOpen
15
18
  const drawerState = createDrawerState(props.name)
16
19
  watch(
17
20
  () => props.open,
18
- (value) => {
19
- if (drawerState.isDrawerOpen !== value)
21
+ value => {
22
+ if (drawerState.isDrawerOpen !== value) {
20
23
  drawerState.isDrawerOpen = value
24
+ }
21
25
  },
22
26
  { immediate: true },
23
27
  )
24
28
  watch(
25
29
  () => drawerState.isDrawerOpen,
26
- (value) => {
27
- if (props.open !== value)
30
+ value => {
31
+ if (props.open !== value) {
28
32
  emit('update:open', value)
33
+ }
29
34
  },
30
35
  { immediate: true },
31
36
  )
@@ -39,7 +44,7 @@ const classes = computed(() => {
39
44
 
40
45
  <template>
41
46
  <div class="drawer" :class="classes">
42
- <input :id="name" v-model="drawerState.isDrawerOpen" type="checkbox" class="drawer-toggle">
47
+ <input :id="name" v-model="drawerState.isDrawerOpen" type="checkbox" class="drawer-toggle" />
43
48
  <slot v-bind="drawerState" />
44
49
  </div>
45
50
  </template>
@@ -1,11 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import { createDrawerState } from '../utils/drawer-utils'
3
3
 
4
- const props = withDefaults(defineProps<{
5
- name?: string
6
- }>(), {
7
- name: 'drawer',
8
- })
4
+ const props = withDefaults(
5
+ defineProps<{
6
+ name?: string
7
+ }>(),
8
+ {
9
+ name: 'drawer',
10
+ },
11
+ )
9
12
 
10
13
  const drawerState = createDrawerState(props.name)
11
14
  </script>
@@ -1,11 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import { createDrawerState } from '../utils/drawer-utils'
3
3
 
4
- const props = withDefaults(defineProps<{
5
- name?: string
6
- }>(), {
7
- name: 'drawer',
8
- })
4
+ const props = withDefaults(
5
+ defineProps<{
6
+ name?: string
7
+ }>(),
8
+ {
9
+ name: 'drawer',
10
+ },
11
+ )
9
12
 
10
13
  const drawerState = createDrawerState(props.name)
11
14
  </script>
@@ -0,0 +1,106 @@
1
+ <script setup lang="ts">
2
+ import { useId } from '#imports'
3
+ import { useElementHover } from '@vueuse/core'
4
+ import { onMounted, provide, ref, watch } from 'vue'
5
+
6
+ const props = withDefaults(
7
+ defineProps<{
8
+ autoFocus?: boolean
9
+
10
+ placement?:
11
+ | 'top'
12
+ | 'top-start'
13
+ | 'top-end'
14
+ | 'right'
15
+ | 'right-start'
16
+ | 'right-end'
17
+ | 'bottom'
18
+ | 'bottom-start'
19
+ | 'bottom-end'
20
+ | 'left'
21
+ | 'left-start'
22
+ | 'left-end'
23
+
24
+ hover?: boolean
25
+ delayEnter?: number
26
+ delayLeave?: number
27
+ closeOnClickOutside?: boolean
28
+ }>(),
29
+ {
30
+ autoFocus: false,
31
+ placement: 'bottom-start',
32
+ hover: false,
33
+ delayEnter: 0,
34
+ delayLeave: 300,
35
+ closeOnClickOutside: true,
36
+ },
37
+ )
38
+
39
+ // Dropdown Visibility
40
+ const isOpen = defineModel('open', { default: false })
41
+ provide('isDropdownOpen', isOpen)
42
+
43
+ const autoFocus = ref(props.autoFocus)
44
+ provide('dropdownAutoFocus', autoFocus)
45
+
46
+ // Use Nuxt's useId() for unique IDs
47
+ const uniqueId = useId()
48
+ const wrapperId = `dropdown-wrapper-${uniqueId}`
49
+ const id = `dropdown-${uniqueId}`
50
+ provide('dropdownId', id)
51
+
52
+ // Provide placement for CSS anchor positioning
53
+ provide('dropdownPlacement', ref(props.placement))
54
+
55
+ // Provide closeOnClickOutside for popover mode selection
56
+ provide('dropdownCloseOnClickOutside', ref(props.closeOnClickOutside))
57
+
58
+ // Provide hover mode for button behavior
59
+ provide('dropdownHover', ref(props.hover))
60
+
61
+ // References
62
+ const buttonEl = ref(null)
63
+ const contentEl = ref(null)
64
+
65
+ provide('buttonEl', buttonEl)
66
+ provide('contentEl', contentEl)
67
+
68
+ // Visibility Utils
69
+ function toggle() {
70
+ isOpen.value = !isOpen.value
71
+ }
72
+ function open() {
73
+ isOpen.value = true
74
+ }
75
+ function close() {
76
+ isOpen.value = false
77
+ }
78
+ provide('toggleDropdown', toggle)
79
+ provide('openDropdown', open)
80
+ provide('closeDropdown', close)
81
+
82
+ const dropdownWrapper = ref(null)
83
+
84
+ onMounted(() => {
85
+ // Note: closeOnClickOutside is handled automatically by popover="auto"
86
+ // The popover API provides "light dismiss" behavior by default
87
+
88
+ // Sync with hover state for SSR compatibility
89
+ if (props.hover) {
90
+ const hover = useElementHover(dropdownWrapper, {
91
+ delayLeave: props.delayLeave,
92
+ delayEnter: props.delayEnter,
93
+ })
94
+
95
+ watch(hover, newValue => {
96
+ isOpen.value = newValue
97
+ })
98
+ }
99
+ })
100
+ </script>
101
+
102
+ <template>
103
+ <div :id="wrapperId" ref="dropdownWrapper" class="relative inline-block">
104
+ <slot v-bind="{ toggle, open, close }" />
105
+ </div>
106
+ </template>
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import { inject } from 'vue'
3
+
4
+ const id = inject('dropdownId')
5
+ const isOpen = inject('isDropdownOpen')
6
+ const buttonEl = inject('buttonEl')
7
+ const isHover = inject('dropdownHover')
8
+ </script>
9
+
10
+ <template>
11
+ <Button
12
+ :id="id"
13
+ ref="buttonEl"
14
+ :aria-expanded="isOpen"
15
+ aria-haspopup="menu"
16
+ :popovertarget="`${id}-content`"
17
+ :popovertargetaction="isHover ? 'show' : undefined"
18
+ :style="{ 'anchor-name': `--${id}` }"
19
+ class="dropdown-button"
20
+ >
21
+ <slot />
22
+ </Button>
23
+ </template>
@@ -0,0 +1,127 @@
1
+ <script setup>
2
+ import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
3
+ import { computed, inject, nextTick, watch, watchEffect } from 'vue'
4
+ import { getPositionArea, getPositionFallbacks } from '../utils/position-area'
5
+
6
+ const autoFocus = inject('dropdownAutoFocus')
7
+ const id = inject('dropdownId')
8
+ const isOpen = inject('isDropdownOpen')
9
+ const contentEl = inject('contentEl')
10
+ const placement = inject('dropdownPlacement')
11
+ const closeOnClickOutside = inject('dropdownCloseOnClickOutside')
12
+
13
+ // Dropdown Utils
14
+ const toggle = inject('toggleDropdown')
15
+ const open = inject('openDropdown')
16
+ const close = inject('closeDropdown')
17
+
18
+ // Compute CSS position-area value based on placement
19
+ const positionArea = computed(() => getPositionArea(placement.value))
20
+ const positionFallbacks = computed(() => getPositionFallbacks(placement.value))
21
+
22
+ // Determine popover mode: "auto" for light dismiss, "manual" to disable it
23
+ const popoverMode = computed(() => (closeOnClickOutside.value ? 'auto' : 'manual'))
24
+
25
+ let activate
26
+ let deactivate
27
+
28
+ if (autoFocus.value) {
29
+ const { activate: _activate, deactivate: _deactivate, hasFocus } = useFocusTrap(contentEl, { immediate: true })
30
+ activate = _activate
31
+ deactivate = _deactivate
32
+
33
+ // hide the dropdown when the focus-trap drops focus (by pressing escape, for example)
34
+ watchEffect(() => {
35
+ if (!hasFocus.value) {
36
+ close()
37
+ }
38
+ })
39
+ }
40
+
41
+ // Sync popover state with isOpen model (for programmatic control)
42
+ watch(
43
+ isOpen,
44
+ async newValue => {
45
+ if (contentEl.value) {
46
+ try {
47
+ // Check current popover state
48
+ const isPopoverOpen = contentEl.value.matches(':popover-open')
49
+
50
+ // Only programmatically control if state differs
51
+ if (newValue && !isPopoverOpen) {
52
+ contentEl.value.showPopover()
53
+ if (autoFocus.value) {
54
+ await nextTick()
55
+ activate?.()
56
+ }
57
+ } else if (!newValue && isPopoverOpen) {
58
+ contentEl.value.hidePopover()
59
+ if (autoFocus.value) {
60
+ deactivate?.()
61
+ await nextTick()
62
+ }
63
+ }
64
+ } catch (e) {
65
+ // Silently handle if popover API is not supported
66
+ console.warn('Popover API not supported:', e)
67
+ }
68
+ }
69
+ },
70
+ { flush: 'post' },
71
+ )
72
+
73
+ // Listen to popover toggle events to sync back to isOpen model
74
+ function handleToggle(event) {
75
+ const newState = event.newState === 'open'
76
+
77
+ if (isOpen.value !== newState) {
78
+ isOpen.value = newState
79
+
80
+ if (newState && autoFocus.value) {
81
+ nextTick().then(() => activate?.())
82
+ } else if (!newState && autoFocus.value) {
83
+ deactivate?.()
84
+ }
85
+ }
86
+ }
87
+ </script>
88
+
89
+ <template>
90
+ <div
91
+ :id="`${id}-content`"
92
+ ref="contentEl"
93
+ :anchor="id"
94
+ :aria-labelledby="id"
95
+ role="menu"
96
+ :popover="popoverMode"
97
+ class="dropdown-content dropdown-popover"
98
+ :style="{
99
+ 'position-anchor': `--${id}`,
100
+ 'position-area': positionArea,
101
+ 'position-try-fallbacks': positionFallbacks,
102
+ }"
103
+ @toggle="handleToggle"
104
+ >
105
+ <slot v-bind="{ toggle, open, close }" />
106
+ </div>
107
+ </template>
108
+
109
+ <style>
110
+ @layer components {
111
+ /* Reset default popover styles - in components layer so utilities can override */
112
+ .dropdown-popover[popover] {
113
+ border: none;
114
+ color: inherit;
115
+ overflow: visible;
116
+ /* Use auto for inset to allow anchor positioning to work */
117
+ inset: auto;
118
+ margin: 0;
119
+ background-color: transparent;
120
+ }
121
+
122
+ /* Position anchoring support */
123
+ .dropdown-popover[popover]:popover-open {
124
+ position: fixed;
125
+ }
126
+ }
127
+ </style>
@@ -3,12 +3,19 @@ import { inject } from 'vue'
3
3
 
4
4
  const id = inject('dropdownId')
5
5
  const isOpen = inject('isDropdownOpen')
6
- const toggle = inject('toggleDropdown')
7
6
  const buttonEl = inject('buttonEl')
8
7
  </script>
9
8
 
10
9
  <template>
11
- <div :id="id" ref="buttonEl" :aria-expanded="isOpen" aria-haspopup="menu" class="dropdown-target" @click="toggle">
10
+ <div
11
+ :id="id"
12
+ ref="buttonEl"
13
+ :aria-expanded="isOpen"
14
+ aria-haspopup="menu"
15
+ :popovertarget="`${id}-content`"
16
+ :style="{ 'anchor-name': `--${id}` }"
17
+ class="dropdown-target"
18
+ >
12
19
  <slot />
13
20
  </div>
14
21
  </template>
@@ -0,0 +1,16 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ flower?: boolean
4
+ }>()
5
+ </script>
6
+
7
+ <template>
8
+ <div
9
+ class="fab"
10
+ :class="{
11
+ 'fab-flower': flower,
12
+ }"
13
+ >
14
+ <slot />
15
+ </div>
16
+ </template>
@@ -0,0 +1,18 @@
1
+ <script setup lang="ts">
2
+ function handleMouseDown(event: MouseEvent) {
3
+ event.preventDefault()
4
+ const fab = (event.currentTarget as HTMLElement)?.closest('.fab')
5
+ if (fab instanceof HTMLElement) {
6
+ fab.blur()
7
+ }
8
+ if (document.activeElement instanceof HTMLElement) {
9
+ document.activeElement.blur()
10
+ }
11
+ }
12
+ </script>
13
+
14
+ <template>
15
+ <div class="fab-close" @mousedown="handleMouseDown">
16
+ <slot />
17
+ </div>
18
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="fab-main-action">
3
+ <slot />
4
+ </div>
5
+ </template>