daisy-ui-kit 5.0.3 → 5.0.5

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 (158) hide show
  1. package/README.md +1 -1
  2. package/dist/index.css +1 -0
  3. package/dist/index.d.ts +4652 -0
  4. package/dist/index.js +5279 -0
  5. package/nuxt.js +161 -14
  6. package/package.json +11 -21
  7. package/app/components/Accordion.vue +0 -29
  8. package/app/components/Alert.vue +0 -36
  9. package/app/components/Avatar.vue +0 -131
  10. package/app/components/AvatarGroup.vue +0 -22
  11. package/app/components/Badge.vue +0 -72
  12. package/app/components/Breadcrumbs.vue +0 -7
  13. package/app/components/Button.vue +0 -140
  14. package/app/components/Calendar.vue +0 -175
  15. package/app/components/CalendarInput.vue +0 -275
  16. package/app/components/CalendarSkeleton.vue +0 -87
  17. package/app/components/Card.vue +0 -51
  18. package/app/components/CardActions.vue +0 -13
  19. package/app/components/CardBody.vue +0 -13
  20. package/app/components/CardTitle.vue +0 -11
  21. package/app/components/Carousel.vue +0 -24
  22. package/app/components/CarouselItem.vue +0 -5
  23. package/app/components/Chat.vue +0 -26
  24. package/app/components/ChatBubble.vue +0 -31
  25. package/app/components/ChatFooter.vue +0 -5
  26. package/app/components/ChatHeader.vue +0 -5
  27. package/app/components/ChatImage.vue +0 -5
  28. package/app/components/Checkbox.vue +0 -51
  29. package/app/components/Collapse.vue +0 -76
  30. package/app/components/CollapseContent.vue +0 -5
  31. package/app/components/CollapseTitle.vue +0 -15
  32. package/app/components/Countdown.vue +0 -15
  33. package/app/components/CountdownTimers.vue +0 -69
  34. package/app/components/Counter.vue +0 -21
  35. package/app/components/Crumb.vue +0 -5
  36. package/app/components/DaisyLink.vue +0 -56
  37. package/app/components/Diff.vue +0 -11
  38. package/app/components/Divider.vue +0 -43
  39. package/app/components/Dock.vue +0 -57
  40. package/app/components/DockItem.vue +0 -27
  41. package/app/components/DockLabel.vue +0 -5
  42. package/app/components/Drawer.vue +0 -50
  43. package/app/components/DrawerContent.vue +0 -20
  44. package/app/components/DrawerSide.vue +0 -21
  45. package/app/components/Dropdown.vue +0 -106
  46. package/app/components/DropdownButton.vue +0 -23
  47. package/app/components/DropdownContent.vue +0 -127
  48. package/app/components/DropdownTarget.vue +0 -21
  49. package/app/components/Fab.vue +0 -16
  50. package/app/components/FabClose.vue +0 -18
  51. package/app/components/FabMainAction.vue +0 -5
  52. package/app/components/FabTrigger.vue +0 -117
  53. package/app/components/Fieldset.vue +0 -20
  54. package/app/components/FileInput.vue +0 -53
  55. package/app/components/Filter.vue +0 -129
  56. package/app/components/Flex.vue +0 -89
  57. package/app/components/FlexItem.vue +0 -62
  58. package/app/components/Footer.vue +0 -31
  59. package/app/components/FooterTitle.vue +0 -18
  60. package/app/components/FormControl.vue +0 -5
  61. package/app/components/Hero.vue +0 -18
  62. package/app/components/HeroContent.vue +0 -18
  63. package/app/components/HeroOverlay.vue +0 -5
  64. package/app/components/Hover3D.vue +0 -22
  65. package/app/components/HoverGallery.vue +0 -11
  66. package/app/components/Indicator.vue +0 -20
  67. package/app/components/IndicatorItem.vue +0 -43
  68. package/app/components/Input.vue +0 -116
  69. package/app/components/Join.vue +0 -5
  70. package/app/components/Kbd.vue +0 -25
  71. package/app/components/Label.vue +0 -100
  72. package/app/components/List.vue +0 -5
  73. package/app/components/ListColGrow.vue +0 -5
  74. package/app/components/ListColWrap.vue +0 -5
  75. package/app/components/ListRow.vue +0 -5
  76. package/app/components/LoadingBall.vue +0 -42
  77. package/app/components/LoadingBars.vue +0 -42
  78. package/app/components/LoadingDots.vue +0 -42
  79. package/app/components/LoadingInfinity.vue +0 -42
  80. package/app/components/LoadingRing.vue +0 -42
  81. package/app/components/LoadingSpinner.vue +0 -42
  82. package/app/components/Mask.vue +0 -49
  83. package/app/components/Menu.vue +0 -30
  84. package/app/components/MenuExpand.vue +0 -92
  85. package/app/components/MenuExpandToggle.vue +0 -20
  86. package/app/components/MenuItem.vue +0 -39
  87. package/app/components/MenuTitle.vue +0 -5
  88. package/app/components/MockupBrowser.vue +0 -5
  89. package/app/components/MockupBrowserToolbar.vue +0 -5
  90. package/app/components/MockupCode.vue +0 -4
  91. package/app/components/MockupPhone.vue +0 -14
  92. package/app/components/MockupWindow.vue +0 -5
  93. package/app/components/Modal.vue +0 -63
  94. package/app/components/ModalAction.vue +0 -5
  95. package/app/components/ModalBox.vue +0 -5
  96. package/app/components/NavButton.vue +0 -12
  97. package/app/components/Navbar.vue +0 -12
  98. package/app/components/NavbarCenter.vue +0 -11
  99. package/app/components/NavbarEnd.vue +0 -11
  100. package/app/components/NavbarStart.vue +0 -11
  101. package/app/components/Progress.vue +0 -46
  102. package/app/components/Prose.vue +0 -37
  103. package/app/components/RadialProgress.vue +0 -36
  104. package/app/components/Radio.vue +0 -69
  105. package/app/components/RadioGroup.vue +0 -47
  106. package/app/components/Range.vue +0 -201
  107. package/app/components/RangeMeasure.vue +0 -87
  108. package/app/components/RangeMeasureTick.vue +0 -69
  109. package/app/components/Rating.vue +0 -197
  110. package/app/components/Select.vue +0 -101
  111. package/app/components/Skeleton.vue +0 -5
  112. package/app/components/SkeletonText.vue +0 -11
  113. package/app/components/Stack.vue +0 -30
  114. package/app/components/Stat.vue +0 -19
  115. package/app/components/StatActions.vue +0 -5
  116. package/app/components/StatDesc.vue +0 -5
  117. package/app/components/StatFigure.vue +0 -5
  118. package/app/components/StatTitle.vue +0 -5
  119. package/app/components/StatValue.vue +0 -5
  120. package/app/components/Stats.vue +0 -5
  121. package/app/components/Status.vue +0 -43
  122. package/app/components/Step.vue +0 -34
  123. package/app/components/StepIcon.vue +0 -5
  124. package/app/components/Steps.vue +0 -23
  125. package/app/components/Swap.vue +0 -56
  126. package/app/components/Tab.vue +0 -56
  127. package/app/components/TabContent.vue +0 -29
  128. package/app/components/Table.vue +0 -32
  129. package/app/components/Tabs.vue +0 -53
  130. package/app/components/Text.vue +0 -166
  131. package/app/components/TextArea.vue +0 -106
  132. package/app/components/TextRotate.vue +0 -24
  133. package/app/components/ThemeController.vue +0 -45
  134. package/app/components/ThemeProvider.vue +0 -302
  135. package/app/components/ThemeTile.vue +0 -50
  136. package/app/components/Timeline.vue +0 -22
  137. package/app/components/TimelineEnd.vue +0 -14
  138. package/app/components/TimelineItem.vue +0 -5
  139. package/app/components/TimelineLine.vue +0 -29
  140. package/app/components/TimelineMiddle.vue +0 -5
  141. package/app/components/TimelineStart.vue +0 -14
  142. package/app/components/Toast.vue +0 -67
  143. package/app/components/Toggle.vue +0 -60
  144. package/app/components/Tooltip.vue +0 -137
  145. package/app/components/TooltipContent.vue +0 -283
  146. package/app/components/TooltipTarget.vue +0 -20
  147. package/app/components/ValidatorHint.vue +0 -5
  148. package/app/composables/__tests__/use-calendar.test.ts +0 -239
  149. package/app/composables/use-calendar.ts +0 -288
  150. package/app/composables/use-daisy-theme.ts +0 -140
  151. package/app/composables/use-toast.ts +0 -345
  152. package/app/composables/useSearch.ts +0 -22
  153. package/app/utils/drawer-utils.ts +0 -34
  154. package/app/utils/position-area.ts +0 -40
  155. package/components.d.ts +0 -145
  156. package/components.js +0 -141
  157. package/index.d.ts +0 -157
  158. package/index.js +0 -145
@@ -1,106 +0,0 @@
1
- <script setup lang="ts">
2
- import { useId } from 'vue'
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>
@@ -1,23 +0,0 @@
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>
@@ -1,127 +0,0 @@
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>
@@ -1,21 +0,0 @@
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
- </script>
8
-
9
- <template>
10
- <button
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
- >
19
- <slot />
20
- </button>
21
- </template>
@@ -1,16 +0,0 @@
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>
@@ -1,18 +0,0 @@
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>
@@ -1,5 +0,0 @@
1
- <template>
2
- <div class="fab-main-action">
3
- <slot />
4
- </div>
5
- </template>
@@ -1,117 +0,0 @@
1
- <script setup lang="ts">
2
- defineOptions({
3
- inheritAttrs: false,
4
- })
5
-
6
- const props = withDefaults(
7
- defineProps<{
8
- btn?: boolean
9
- join?: boolean
10
- close?: boolean
11
-
12
- color?: string
13
- neutral?: boolean
14
- primary?: boolean
15
- secondary?: boolean
16
- accent?: boolean
17
- info?: boolean
18
- success?: boolean
19
- warning?: boolean
20
- error?: boolean
21
-
22
- ghost?: boolean
23
- link?: boolean
24
- glass?: boolean
25
- outline?: boolean
26
- dash?: boolean
27
- soft?: boolean
28
-
29
- shape?: 'circle' | 'square' | 'wide' | 'block'
30
- circle?: boolean
31
- square?: boolean
32
- wide?: boolean
33
- block?: boolean
34
-
35
- noAnimation?: boolean
36
- active?: boolean
37
-
38
- size?: 'lg' | 'md' | 'sm' | 'xs' | 'xl'
39
- xl?: boolean
40
- lg?: boolean
41
- md?: boolean
42
- sm?: boolean
43
- xs?: boolean
44
- }>(),
45
- {
46
- btn: true,
47
- },
48
- )
49
-
50
- function handleMouseDown(event: MouseEvent) {
51
- if (!props.close) return
52
- const fab = (event.currentTarget as HTMLElement)?.closest('.fab')
53
- // Only close if FAB is already open (has focus within)
54
- if (fab instanceof HTMLElement && fab.matches(':focus-within')) {
55
- event.preventDefault()
56
- fab.blur()
57
- if (document.activeElement instanceof HTMLElement) {
58
- document.activeElement.blur()
59
- }
60
- }
61
- }
62
- </script>
63
-
64
- <template>
65
- <div
66
- tabindex="0"
67
- role="button"
68
- v-bind="$attrs"
69
- :class="{
70
- btn,
71
- 'join-item': join,
72
-
73
- 'btn-neutral': neutral || color === 'neutral',
74
- 'btn-primary': primary || color === 'primary',
75
- 'btn-secondary': secondary || color === 'secondary',
76
- 'btn-accent': accent || color === 'accent',
77
- 'btn-info': info || color === 'info',
78
- 'btn-success': success || color === 'success',
79
- 'btn-warning': warning || color === 'warning',
80
- 'btn-error': error || color === 'error',
81
-
82
- 'text-primary': (primary || color === 'primary') && link,
83
- 'text-secondary': (secondary || color === 'secondary') && link,
84
- 'text-neutral': (neutral || color === 'neutral') && link,
85
- 'text-accent': (accent || color === 'accent') && link,
86
- 'text-info': (info || color === 'info') && link,
87
- 'text-success': (success || color === 'success') && link,
88
- 'text-warning': (warning || color === 'warning') && link,
89
- 'text-error': (error || color === 'error') && link,
90
-
91
- glass,
92
-
93
- 'btn-circle': circle || shape === 'circle',
94
- 'btn-square': square || shape === 'square',
95
- 'btn-wide': wide || shape === 'wide',
96
- 'btn-block': block || shape === 'block',
97
-
98
- 'btn-xl': xl || size === 'xl',
99
- 'btn-lg': lg || size === 'lg',
100
- 'btn-md': md || size === 'md',
101
- 'btn-sm': sm || size === 'sm',
102
- 'btn-xs': xs || size === 'xs',
103
-
104
- 'btn-outline': outline,
105
- 'btn-dash': dash,
106
- 'btn-ghost': ghost,
107
- 'btn-soft': soft,
108
- 'btn-link': link,
109
-
110
- 'no-animation': noAnimation,
111
- 'btn-active': active,
112
- }"
113
- @mousedown="handleMouseDown"
114
- >
115
- <slot />
116
- </div>
117
- </template>
@@ -1,20 +0,0 @@
1
- <script setup lang="ts">
2
- defineOptions({
3
- inheritAttrs: false,
4
- })
5
-
6
- const { is = 'fieldset', legend } = defineProps<{
7
- is?: string
8
- legend?: string
9
- }>()
10
- </script>
11
-
12
- <template>
13
- <component :is="is" v-bind="$attrs" class="fieldset bg-base-200 border-base-300 rounded-box border p-4">
14
- <legend v-if="legend" class="fieldset-legend">
15
- {{ legend }}
16
- </legend>
17
- <slot v-else name="legend" />
18
- <slot />
19
- </component>
20
- </template>
@@ -1,53 +0,0 @@
1
- <script setup lang="ts">
2
- defineProps<{
3
- join?: boolean
4
-
5
- color?: string
6
- primary?: boolean
7
- secondary?: boolean
8
- accent?: boolean
9
- info?: boolean
10
- success?: boolean
11
- warning?: boolean
12
- error?: boolean
13
-
14
- ghost?: boolean
15
- disabled?: boolean
16
-
17
- size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
18
- xl?: boolean
19
- lg?: boolean
20
- md?: boolean
21
- sm?: boolean
22
- xs?: boolean
23
- }>()
24
- defineEmits(['files'])
25
- </script>
26
-
27
- <template>
28
- <input
29
- type="file"
30
- :disabled="disabled"
31
- class="file-input"
32
- :class="{
33
- 'join-item': join,
34
-
35
- 'file-input-primary': primary || color === 'primary',
36
- 'file-input-secondary': secondary || color === 'secondary',
37
- 'file-input-accent': accent || color === 'accent',
38
- 'file-input-info': info || color === 'info',
39
- 'file-input-success': success || color === 'success',
40
- 'file-input-warning': warning || color === 'warning',
41
- 'file-input-error': error || color === 'error',
42
-
43
- 'file-input-xl': xl || size === 'xl',
44
- 'file-input-lg': lg || size === 'lg',
45
- 'file-input-md': md || size === 'md',
46
- 'file-input-sm': sm || size === 'sm',
47
- 'file-input-xs': xs || size === 'xs',
48
-
49
- 'file-input-ghost': ghost,
50
- }"
51
- @input="$emit('files', ($event.target as any).value)"
52
- />
53
- </template>
@@ -1,129 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
-
4
- defineOptions({
5
- inheritAttrs: false,
6
- })
7
-
8
- const props = withDefaults(
9
- defineProps<{
10
- is?: string
11
- name: string
12
- items: FilterItemInput[]
13
- modelValue?: any
14
- resetLabel?: string
15
- position?: 'start' | 'end'
16
- start?: boolean
17
- end?: boolean
18
-
19
- color?: string
20
- neutral?: boolean
21
- primary?: boolean
22
- secondary?: boolean
23
- accent?: boolean
24
- info?: boolean
25
- success?: boolean
26
- warning?: boolean
27
- error?: boolean
28
-
29
- size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
30
- xl?: boolean
31
- lg?: boolean
32
- md?: boolean
33
- sm?: boolean
34
- xs?: boolean
35
- }>(),
36
- {
37
- resetLabel: 'All',
38
- is: 'div',
39
- },
40
- )
41
-
42
- const emit = defineEmits(['update:modelValue'])
43
-
44
- interface FilterItem {
45
- label: string
46
- value: any
47
- }
48
-
49
- type FilterItemInput = string | FilterItem
50
-
51
- const currentValue = computed({
52
- get: () => props.modelValue,
53
- set(val) {
54
- emit('update:modelValue', val)
55
- },
56
- })
57
-
58
- const normalizedItems = computed(() => {
59
- return props.items.map(item => {
60
- if (typeof item === 'string') {
61
- return { label: item, value: item }
62
- }
63
- return item
64
- })
65
- })
66
- </script>
67
-
68
- <template>
69
- <component :is="props.is" v-bind="$attrs" class="filter">
70
- <!-- Reset button at start -->
71
- <input
72
- v-if="resetLabel && (start || position === 'start')"
73
- v-model="currentValue"
74
- class="btn filter-reset"
75
- type="radio"
76
- :class="{
77
- 'btn-xl': size === 'xl' || xl,
78
- 'btn-lg': size === 'lg' || lg,
79
- 'btn-md': size === 'md' || md,
80
- 'btn-sm': size === 'sm' || sm,
81
- 'btn-xs': size === 'xs' || xs,
82
- }"
83
- :name="name"
84
- :aria-label="resetLabel"
85
- :value="null"
86
- />
87
-
88
- <!-- Filter items -->
89
- <template v-for="(item, index) in normalizedItems" :key="index">
90
- <input
91
- v-model="currentValue"
92
- class="btn"
93
- :class="{
94
- 'btn-neutral': color === 'neutral' || neutral,
95
- 'btn-primary': color === 'primary' || primary,
96
- 'btn-secondary': color === 'secondary' || secondary,
97
- 'btn-accent': color === 'accent' || accent,
98
- 'btn-info': color === 'info' || info,
99
- 'btn-success': color === 'success' || success,
100
- 'btn-warning': color === 'warning' || warning,
101
- 'btn-error': color === 'error' || error,
102
- 'btn-xl': size === 'xl' || xl,
103
- 'btn-lg': size === 'lg' || lg,
104
- 'btn-md': size === 'md' || md,
105
- 'btn-sm': size === 'sm' || sm,
106
- 'btn-xs': size === 'xs' || xs,
107
- }"
108
- type="radio"
109
- :name="name"
110
- :aria-label="item.label"
111
- :value="item.value"
112
- />
113
- </template>
114
-
115
- <!-- Reset button at end -->
116
- <input
117
- v-if="resetLabel && (end || position === 'end')"
118
- v-model="currentValue"
119
- class="btn filter-reset"
120
- type="radio"
121
- :name="name"
122
- :aria-label="resetLabel"
123
- :value="null"
124
- />
125
-
126
- <!-- Optional slot for custom items -->
127
- <slot />
128
- </component>
129
- </template>