daisy-ui-kit 5.0.2 → 5.0.4

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 (153) hide show
  1. package/README.md +20 -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/package.json +12 -16
  6. package/app/components/Accordion.vue +0 -29
  7. package/app/components/Alert.vue +0 -36
  8. package/app/components/Avatar.vue +0 -131
  9. package/app/components/AvatarGroup.vue +0 -22
  10. package/app/components/Badge.vue +0 -72
  11. package/app/components/Breadcrumbs.vue +0 -7
  12. package/app/components/Button.vue +0 -140
  13. package/app/components/Calendar.vue +0 -175
  14. package/app/components/CalendarInput.vue +0 -275
  15. package/app/components/CalendarSkeleton.vue +0 -87
  16. package/app/components/Card.vue +0 -51
  17. package/app/components/CardActions.vue +0 -13
  18. package/app/components/CardBody.vue +0 -13
  19. package/app/components/CardTitle.vue +0 -11
  20. package/app/components/Carousel.vue +0 -24
  21. package/app/components/CarouselItem.vue +0 -5
  22. package/app/components/Chat.vue +0 -26
  23. package/app/components/ChatBubble.vue +0 -31
  24. package/app/components/ChatFooter.vue +0 -5
  25. package/app/components/ChatHeader.vue +0 -5
  26. package/app/components/ChatImage.vue +0 -5
  27. package/app/components/Checkbox.vue +0 -51
  28. package/app/components/Collapse.vue +0 -76
  29. package/app/components/CollapseContent.vue +0 -5
  30. package/app/components/CollapseTitle.vue +0 -15
  31. package/app/components/Countdown.vue +0 -15
  32. package/app/components/CountdownTimers.vue +0 -69
  33. package/app/components/Counter.vue +0 -21
  34. package/app/components/Crumb.vue +0 -5
  35. package/app/components/DaisyLink.vue +0 -56
  36. package/app/components/Diff.vue +0 -11
  37. package/app/components/Divider.vue +0 -43
  38. package/app/components/Dock.vue +0 -57
  39. package/app/components/DockItem.vue +0 -27
  40. package/app/components/DockLabel.vue +0 -5
  41. package/app/components/Drawer.vue +0 -50
  42. package/app/components/DrawerContent.vue +0 -20
  43. package/app/components/DrawerSide.vue +0 -21
  44. package/app/components/Dropdown.vue +0 -106
  45. package/app/components/DropdownButton.vue +0 -23
  46. package/app/components/DropdownContent.vue +0 -127
  47. package/app/components/DropdownTarget.vue +0 -21
  48. package/app/components/Fab.vue +0 -16
  49. package/app/components/FabClose.vue +0 -18
  50. package/app/components/FabMainAction.vue +0 -5
  51. package/app/components/FabTrigger.vue +0 -117
  52. package/app/components/Fieldset.vue +0 -20
  53. package/app/components/FileInput.vue +0 -53
  54. package/app/components/Filter.vue +0 -129
  55. package/app/components/Flex.vue +0 -89
  56. package/app/components/FlexItem.vue +0 -62
  57. package/app/components/Footer.vue +0 -31
  58. package/app/components/FooterTitle.vue +0 -18
  59. package/app/components/FormControl.vue +0 -5
  60. package/app/components/Hero.vue +0 -18
  61. package/app/components/HeroContent.vue +0 -18
  62. package/app/components/HeroOverlay.vue +0 -5
  63. package/app/components/Hover3D.vue +0 -22
  64. package/app/components/HoverGallery.vue +0 -11
  65. package/app/components/Indicator.vue +0 -20
  66. package/app/components/IndicatorItem.vue +0 -43
  67. package/app/components/Input.vue +0 -116
  68. package/app/components/Join.vue +0 -5
  69. package/app/components/Kbd.vue +0 -25
  70. package/app/components/Label.vue +0 -100
  71. package/app/components/List.vue +0 -5
  72. package/app/components/ListColGrow.vue +0 -5
  73. package/app/components/ListColWrap.vue +0 -5
  74. package/app/components/ListRow.vue +0 -5
  75. package/app/components/LoadingBall.vue +0 -42
  76. package/app/components/LoadingBars.vue +0 -42
  77. package/app/components/LoadingDots.vue +0 -42
  78. package/app/components/LoadingInfinity.vue +0 -42
  79. package/app/components/LoadingRing.vue +0 -42
  80. package/app/components/LoadingSpinner.vue +0 -42
  81. package/app/components/Mask.vue +0 -49
  82. package/app/components/Menu.vue +0 -30
  83. package/app/components/MenuExpand.vue +0 -92
  84. package/app/components/MenuExpandToggle.vue +0 -20
  85. package/app/components/MenuItem.vue +0 -39
  86. package/app/components/MenuTitle.vue +0 -5
  87. package/app/components/MockupBrowser.vue +0 -5
  88. package/app/components/MockupBrowserToolbar.vue +0 -5
  89. package/app/components/MockupCode.vue +0 -4
  90. package/app/components/MockupPhone.vue +0 -14
  91. package/app/components/MockupWindow.vue +0 -5
  92. package/app/components/Modal.vue +0 -63
  93. package/app/components/ModalAction.vue +0 -5
  94. package/app/components/ModalBox.vue +0 -5
  95. package/app/components/NavButton.vue +0 -12
  96. package/app/components/Navbar.vue +0 -12
  97. package/app/components/NavbarCenter.vue +0 -11
  98. package/app/components/NavbarEnd.vue +0 -11
  99. package/app/components/NavbarStart.vue +0 -11
  100. package/app/components/Progress.vue +0 -46
  101. package/app/components/Prose.vue +0 -37
  102. package/app/components/RadialProgress.vue +0 -36
  103. package/app/components/Radio.vue +0 -69
  104. package/app/components/RadioGroup.vue +0 -47
  105. package/app/components/Range.vue +0 -201
  106. package/app/components/RangeMeasure.vue +0 -87
  107. package/app/components/RangeMeasureTick.vue +0 -69
  108. package/app/components/Rating.vue +0 -197
  109. package/app/components/Select.vue +0 -101
  110. package/app/components/Skeleton.vue +0 -5
  111. package/app/components/SkeletonText.vue +0 -11
  112. package/app/components/Stack.vue +0 -30
  113. package/app/components/Stat.vue +0 -19
  114. package/app/components/StatActions.vue +0 -5
  115. package/app/components/StatDesc.vue +0 -5
  116. package/app/components/StatFigure.vue +0 -5
  117. package/app/components/StatTitle.vue +0 -5
  118. package/app/components/StatValue.vue +0 -5
  119. package/app/components/Stats.vue +0 -5
  120. package/app/components/Status.vue +0 -43
  121. package/app/components/Step.vue +0 -34
  122. package/app/components/StepIcon.vue +0 -5
  123. package/app/components/Steps.vue +0 -23
  124. package/app/components/Swap.vue +0 -56
  125. package/app/components/Tab.vue +0 -56
  126. package/app/components/TabContent.vue +0 -29
  127. package/app/components/Table.vue +0 -32
  128. package/app/components/Tabs.vue +0 -53
  129. package/app/components/Text.vue +0 -166
  130. package/app/components/TextArea.vue +0 -106
  131. package/app/components/TextRotate.vue +0 -24
  132. package/app/components/ThemeController.vue +0 -45
  133. package/app/components/ThemeProvider.vue +0 -302
  134. package/app/components/ThemeTile.vue +0 -50
  135. package/app/components/Timeline.vue +0 -22
  136. package/app/components/TimelineEnd.vue +0 -14
  137. package/app/components/TimelineItem.vue +0 -5
  138. package/app/components/TimelineLine.vue +0 -29
  139. package/app/components/TimelineMiddle.vue +0 -5
  140. package/app/components/TimelineStart.vue +0 -14
  141. package/app/components/Toast.vue +0 -67
  142. package/app/components/Toggle.vue +0 -60
  143. package/app/components/Tooltip.vue +0 -137
  144. package/app/components/TooltipContent.vue +0 -283
  145. package/app/components/TooltipTarget.vue +0 -20
  146. package/app/components/ValidatorHint.vue +0 -5
  147. package/app/composables/__tests__/use-calendar.test.ts +0 -239
  148. package/app/composables/use-calendar.ts +0 -288
  149. package/app/composables/use-daisy-theme.ts +0 -140
  150. package/app/composables/use-toast.ts +0 -345
  151. package/app/composables/useSearch.ts +0 -22
  152. package/app/utils/drawer-utils.ts +0 -34
  153. package/app/utils/position-area.ts +0 -40
@@ -1,345 +0,0 @@
1
- import type { Ref } from 'vue'
2
- import { computed, reactive, ref, toRef } from 'vue'
3
-
4
- export type ToastType = 'success' | 'error' | 'info' | 'warning' | string
5
-
6
- export type ToastPosition =
7
- | 'top-start'
8
- | 'top-center'
9
- | 'top-end'
10
- | 'middle-start'
11
- | 'middle-center'
12
- | 'middle-end'
13
- | 'bottom-start'
14
- | 'bottom-center'
15
- | 'bottom-end'
16
-
17
- export type ToastStatus = 'pending' | 'success' | 'error' | 'info' | 'warning' | 'default'
18
-
19
- export interface Toast {
20
- id: number
21
- message: string
22
- name?: string // toast channel name, optional but always set by logic
23
- type?: ToastType
24
- duration?: number
25
- position: ToastPosition
26
- countdown?: number
27
- status?: ToastStatus
28
- progress?: number // 0-1 for progress bar
29
- promiseId?: string // for async/promise support
30
- ariaLive?: 'polite' | 'assertive' // accessibility
31
- [key: string]: any
32
- }
33
-
34
- /**
35
- * State for a single toast channel (internal use)
36
- */
37
- export interface ToastChannelState {
38
- toasts: Ref<Toast[]>
39
- toastQueue: Toast[]
40
- toastLimit: number | null
41
- }
42
-
43
- let globalToastChannels: Ref<Record<string, ToastChannelState & { defaults?: Partial<Toast> }>> | null = null
44
- let globalNextToastId: Ref<number> | null = null
45
-
46
- function getGlobalToastChannels() {
47
- if (!globalToastChannels) {
48
- globalToastChannels = ref({})
49
- }
50
- return globalToastChannels
51
- }
52
- function getGlobalNextToastId() {
53
- if (!globalNextToastId) {
54
- globalNextToastId = ref(1)
55
- }
56
- return globalNextToastId
57
- }
58
-
59
- function getOrCreateChannel(name: string, defaults?: Partial<Toast>, limit?: number | null) {
60
- const channels = getGlobalToastChannels().value
61
- if (!channels[name]) {
62
- channels[name] = {
63
- toasts: ref<Toast[]>([]),
64
- toastQueue: [],
65
- toastLimit: typeof limit === 'number' ? limit : null,
66
- defaults,
67
- }
68
- }
69
- return toRef(channels[name])
70
- }
71
-
72
- /**
73
- * Clear all toast queues for all channels (useful for logout or channel switch)
74
- */
75
- export function clearAllToastQueues() {
76
- const channels = getGlobalToastChannels().value
77
- Object.values(channels).forEach(channel => {
78
- channel.toastQueue.length = 0
79
- })
80
- }
81
-
82
- /**
83
- * Global toast notification composable supporting named channels.
84
- *
85
- * - Each toast has an optional `name` property (defaults to 'default').
86
- * - All toast state (toasts, queue, limit) is isolated per channel.
87
- * - UI and logic can independently manage/display different channels.
88
- * - Defensive dev warnings if name is missing/invalid.
89
- *
90
- * Example usage:
91
- * const { toasts, addToast } = useToast({ name: 'admin' })
92
- * addToast({ message: 'Hi', name: 'admin' })
93
- * // In UI: <Toast name="admin" />
94
- */
95
- /**
96
- * Options for useToast composable.
97
- * - name: channel name (default: 'default')
98
- * - defaults: default toast settings for this channel (merged into each toast)
99
- */
100
- export interface UseToastOptions {
101
- name?: string
102
- defaults?: Partial<Toast>
103
- limit?: number // per-channel toast limit
104
- }
105
-
106
- /**
107
- * Global toast notification composable supporting named channels and customizable defaults.
108
- *
109
- * - Each toast has an optional `name` property (defaults to 'default').
110
- * - All toast state (toasts, queue, limit) is isolated per channel.
111
- * - UI and logic can independently manage/display different channels.
112
- * - Defensive dev warnings if name is missing/invalid.
113
- * - You can provide `defaults` to set default toast settings for all toasts in this channel.
114
- *
115
- * Example usage:
116
- * const { toasts, addToast } = useToast({ name: 'admin', defaults: { duration: 6000, type: 'info' } })
117
- * addToast({ message: 'Hi' }) // will use defaults
118
- * // In UI: <Toast name="admin" />
119
- */
120
- function normalizeToast(toast: any): Toast & { countdown: number; originalDuration: number; intervalId?: number } {
121
- if (toast.originalDuration == null) {
122
- toast.originalDuration = toast.duration ?? 0
123
- }
124
- if (toast.countdown == null) {
125
- toast.countdown = toast.originalDuration
126
- }
127
- if (typeof toast.intervalId === 'undefined') {
128
- toast.intervalId = undefined
129
- }
130
- return toast as Toast & { countdown: number; originalDuration: number; intervalId?: number }
131
- }
132
-
133
- export function useToast(options?: UseToastOptions) {
134
- const name = options?.name?.trim() || 'default'
135
- const defaults = options?.defaults || {}
136
- const limit = typeof options?.limit === 'number' ? options.limit : null
137
-
138
- // Always get or create the channel (init only once)
139
- const channel = getOrCreateChannel(name, defaults, limit)
140
-
141
- function addToast(
142
- toast: { message: string; position?: ToastPosition; name?: string } & Partial<Omit<Toast, 'id' | 'name'>>,
143
- ) {
144
- const toastName = toast.name?.trim() || name
145
- const nextToastIdRef = getGlobalNextToastId()
146
- // Always get or create the target channel for this toast, using the correct limit if provided
147
- const channelLimit = typeof options?.limit === 'number' ? options.limit : null
148
- const channel = getOrCreateChannel(toastName, defaults, channelLimit)
149
- const merged = { ...channel.value.defaults, ...defaults, ...toast }
150
- const position = merged.position ?? 'bottom-center'
151
- const duration = merged.duration ?? 0
152
- const status = merged.status ?? 'default'
153
- if (import.meta.env.NODE_ENV !== 'production' && !toastName) {
154
- console.warn('[addToast] Toast channel name is empty or invalid. Falling back to "default".')
155
- }
156
- const id = nextToastIdRef.value++
157
- const newToast = normalizeToast(
158
- reactive({
159
- id,
160
- ...merged,
161
- name: toastName,
162
- position,
163
- countdown: duration,
164
- originalDuration: duration,
165
- status,
166
- progress: typeof merged.progress === 'number' ? merged.progress : undefined,
167
- ariaLive: merged.ariaLive ?? 'polite',
168
- intervalId: undefined as number | undefined,
169
- }),
170
- )
171
-
172
- // If limit is set and reached, queue the toast
173
- if (channel.value.toastLimit && channel.value.toasts.length >= channel.value.toastLimit) {
174
- ;(channel.value.toastQueue ??= []).push(newToast)
175
- return id
176
- }
177
- channel.value.toasts.push(newToast)
178
- // Ensure timer always starts for visible toasts
179
- if (channel.value.toasts.includes(newToast)) {
180
- startToastTimer(newToast)
181
- }
182
- return id
183
- }
184
-
185
- function removeToast(id: number) {
186
- const idx = channel.value.toasts.findIndex(t => t.id === id)
187
- if (idx !== -1) {
188
- // Defensive: clear countdown timer if present
189
- const toast = channel.value.toasts[idx] as Toast & { intervalId?: number }
190
- if (toast.intervalId) {
191
- clearInterval(toast.intervalId)
192
- }
193
- channel.value.toasts.splice(idx, 1)
194
- // If queue exists, pop next toast
195
- if (channel.value.toastLimit && (channel.value.toastQueue?.length ?? 0) > 0) {
196
- const next = channel.value.toastQueue!.shift()
197
- if (next) {
198
- const norm = normalizeToast(next)
199
- channel.value.toasts.push(norm)
200
- // Ensure timer always starts for visible toasts
201
- if (channel.value.toasts.includes(norm)) {
202
- startToastTimer(norm)
203
- }
204
- }
205
- }
206
- }
207
- }
208
-
209
- function clearToasts() {
210
- channel.value.toasts = []
211
- if (channel.value.toastQueue) {
212
- channel.value.toastQueue.length = 0
213
- }
214
- }
215
-
216
- /**
217
- * Update or replace a toast by id
218
- */
219
- function updateToast(id: number, updates: Partial<Toast>) {
220
- const toast = channel.value.toasts.find(t => t.id === id)
221
- if (toast) {
222
- Object.assign(toast, updates)
223
- normalizeToast(toast)
224
- // If updating countdown/duration, recalculate progress
225
- if (typeof toast.countdown === 'number' && typeof toast.duration === 'number' && toast.duration > 0) {
226
- toast.progress = Math.max(0, toast.countdown / toast.duration)
227
- }
228
- }
229
- }
230
-
231
- /**
232
- * Show a toast for the duration of a promise
233
- * Sets status to 'pending', then 'success' or 'error' on resolve/reject
234
- */
235
- function toastPromise<T>(
236
- promise: Promise<T>,
237
- options: {
238
- pending: Omit<Toast, 'id'>
239
- success: Omit<Toast, 'id'>
240
- error: Omit<Toast, 'id'>
241
- name?: string
242
- },
243
- ): Promise<T> {
244
- const toastName = options.name?.trim() || name
245
- if (import.meta.env.NODE_ENV !== 'production' && !toastName) {
246
- console.warn('[toastPromise] Toast channel name is empty or invalid. Falling back to "default".')
247
- }
248
- const promiseId = `promise-${Date.now()}-${Math.random()}`
249
- const pendingId = addToast({
250
- ...options.pending,
251
- status: 'pending',
252
- promiseId,
253
- message: options.pending.message,
254
- name: toastName,
255
- })
256
- return promise.then(
257
- result => {
258
- updateToast(pendingId, {
259
- ...options.success,
260
- status: 'success',
261
- promiseId,
262
- message: options.success.message,
263
- name: toastName,
264
- })
265
- return result
266
- },
267
- err => {
268
- updateToast(pendingId, {
269
- ...options.error,
270
- status: 'error',
271
- promiseId,
272
- message: options.error.message,
273
- name: toastName,
274
- })
275
- throw err
276
- },
277
- )
278
- }
279
-
280
- /**
281
- * Set a maximum number of visible toasts (queue extras)
282
- */
283
- function setToastLimit(limit: number) {
284
- channel.value.toastLimit = limit
285
- if (channel.value.toastLimit) {
286
- // If over limit, move extras to queue
287
- while (channel.value.toasts.length > channel.value.toastLimit) {
288
- const removed = channel.value.toasts.pop()
289
- if (removed) {
290
- // Stop timer for toast leaving visible list
291
- if (removed.intervalId) {
292
- clearInterval(removed.intervalId)
293
- removed.intervalId = undefined
294
- }
295
- ;(channel.value.toastQueue ??= []).unshift(removed)
296
- }
297
- }
298
- // If under limit and queue has items, fill up
299
- while (channel.value.toasts.length < channel.value.toastLimit && (channel.value.toastQueue?.length ?? 0) > 0) {
300
- const next = channel.value.toastQueue!.shift()
301
- if (next) {
302
- const norm = normalizeToast(next)
303
- channel.value.toasts.push(norm)
304
- // Ensure timer always starts for visible toasts
305
- if (channel.value.toasts.includes(norm)) {
306
- startToastTimer(norm)
307
- }
308
- }
309
- }
310
- }
311
- }
312
-
313
- function startToastTimer(
314
- toast: Toast & { countdown: number; originalDuration: number; intervalId?: number; startTime?: number },
315
- ) {
316
- if (toast.originalDuration > 0) {
317
- if (toast.intervalId) {
318
- clearInterval(toast.intervalId)
319
- }
320
- const start = Date.now()
321
- toast.startTime = start
322
-
323
- toast.intervalId = setInterval(() => {
324
- const elapsed = Date.now() - (toast.startTime ?? start)
325
- toast.countdown = Math.max(0, toast.originalDuration - elapsed)
326
- toast.progress = Math.max(0, toast.countdown / toast.originalDuration)
327
- if (toast.countdown <= 0) {
328
- clearInterval(toast.intervalId)
329
- removeToast(toast.id)
330
- }
331
- }, 16) as unknown as number // 60fps for smooth animation
332
- }
333
- }
334
-
335
- return {
336
- toasts: computed(() => channel.value.toasts),
337
- addToast,
338
- removeToast,
339
- clearToasts,
340
- updateToast,
341
- toastPromise,
342
- setToastLimit,
343
- name,
344
- }
345
- }
@@ -1,22 +0,0 @@
1
- const isSearchOpen = ref(false)
2
-
3
- export function useSearch() {
4
- function openSearch() {
5
- isSearchOpen.value = true
6
- }
7
-
8
- function closeSearch() {
9
- isSearchOpen.value = false
10
- }
11
-
12
- function toggleSearch() {
13
- isSearchOpen.value = !isSearchOpen.value
14
- }
15
-
16
- return {
17
- isSearchOpen,
18
- openSearch,
19
- closeSearch,
20
- toggleSearch,
21
- }
22
- }
@@ -1,34 +0,0 @@
1
- import { reactive } from 'vue'
2
-
3
- export interface DrawerState {
4
- name: string
5
- isDrawerOpen: boolean
6
- openDrawer: () => void
7
- closeDrawer: () => void
8
- toggleDrawer: () => void
9
- }
10
- export interface Drawers {
11
- [key: string]: DrawerState
12
- }
13
-
14
- export const drawers = reactive<Drawers>({})
15
-
16
- export function createDrawerState(name: string) {
17
- const drawerState =
18
- drawers[name] ||
19
- reactive<DrawerState>({
20
- name,
21
- isDrawerOpen: false,
22
- openDrawer() {
23
- drawerState.isDrawerOpen = true
24
- },
25
- closeDrawer() {
26
- drawerState.isDrawerOpen = false
27
- },
28
- toggleDrawer() {
29
- drawerState.isDrawerOpen = !drawerState.isDrawerOpen
30
- },
31
- })
32
- drawers[name] = drawerState
33
- return drawerState
34
- }
@@ -1,40 +0,0 @@
1
- /**
2
- * Maps placement values to CSS position-area values for anchor positioning
3
- *
4
- * Using span to align edges:
5
- * - "bottom span-right" = below anchor, aligned to left edge (spans from left to center)
6
- * - "bottom span-left" = below anchor, aligned to right edge (spans from center to right)
7
- */
8
- export function getPositionArea(placement: string): string {
9
- const positionMap: Record<string, string> = {
10
- // Top positions
11
- top: 'center top', // centered above
12
- 'top-start': 'top span-right', // above, left edge aligned
13
- 'top-end': 'top span-left', // above, right edge aligned
14
-
15
- // Right positions
16
- right: 'center right', // centered to right
17
- 'right-start': 'right span-bottom', // right, top edge aligned
18
- 'right-end': 'right span-top', // right, bottom edge aligned
19
-
20
- // Bottom positions (most common for dropdowns)
21
- bottom: 'center bottom', // centered below
22
- 'bottom-start': 'bottom span-right', // below, left edge aligned
23
- 'bottom-end': 'bottom span-left', // below, right edge aligned
24
-
25
- // Left positions
26
- left: 'center left', // centered to left
27
- 'left-start': 'left span-bottom', // left, top edge aligned
28
- 'left-end': 'left span-top', // left, bottom edge aligned
29
- }
30
-
31
- return positionMap[placement] || 'bottom span-right'
32
- }
33
-
34
- /**
35
- * Gets position-try-fallbacks for automatic repositioning
36
- */
37
- export function getPositionFallbacks(_placement: string): string {
38
- // Simple flip fallbacks - flip to opposite side on same axis
39
- return 'flip-block, flip-inline'
40
- }