daisy-ui-kit 5.0.0-pre.8 → 5.0.0-pre.9

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.
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
3
 
4
- const props = defineProps<{
4
+ const props = withDefaults(defineProps<{
5
5
  is?: string
6
6
  join?: boolean
7
7
 
@@ -40,7 +40,9 @@ const props = defineProps<{
40
40
  xs?: boolean
41
41
 
42
42
  type?: 'button' | 'submit' | 'reset'
43
- }>()
43
+ }>(), {
44
+ type: 'button',
45
+ })
44
46
 
45
47
  // Accessibility: Determine if rendering a native button
46
48
  const isButton = computed(() => (props.is || 'button') === 'button')
@@ -1,29 +1,72 @@
1
1
  <script setup lang="ts">
2
- defineProps<{
2
+ import type { Toast } from '~/composables/use-toast'
3
+ import { computed } from 'vue'
4
+ import { useToast } from '~/composables/use-toast'
5
+
6
+ // Explicit slot typing (Vue 3.4+ / Volar)
7
+ interface ToastSlotProps {
8
+ toast?: Toast
9
+ removeToast?: (id: number) => void
10
+ [key: string]: unknown
11
+ }
12
+ const props = defineProps<{
13
+ /**
14
+ * Horizontal alignment (start, center, end)
15
+ */
3
16
  hAlign?: 'start' | 'center' | 'end'
4
17
  start?: boolean
5
18
  center?: boolean
6
19
  end?: boolean
7
-
20
+ /**
21
+ * Vertical alignment (top, middle, bottom)
22
+ */
8
23
  vAlign?: 'top' | 'middle' | 'bottom'
9
24
  top?: boolean
10
25
  middle?: boolean
11
26
  bottom?: boolean
27
+ /**
28
+ * Toast channel name (for named channels)
29
+ */
30
+ name?: string
31
+ /**
32
+ * Default toast settings for this channel (merged into every toast)
33
+ * Example: { duration: 6000, type: 'info', position: 'top-center' }
34
+ */
35
+ defaults?: Partial<Toast>
36
+ }>()
37
+
38
+ defineSlots<{
39
+ default: (props: ToastSlotProps) => any
12
40
  }>()
41
+
42
+ // Extract useToast options from props (name, defaults, future-proof)
43
+ const toastOptions = computed(() => {
44
+ const { name, defaults } = props
45
+ return { name, defaults }
46
+ })
47
+
48
+ const { toasts, removeToast } = useToast(toastOptions.value)
49
+ const visibleToasts = computed(() => toasts.value ?? [])
13
50
  </script>
14
51
 
15
52
  <template>
16
53
  <div
17
54
  class="toast"
18
55
  :class="{
19
- 'toast-start': start || hAlign === 'start',
20
- 'toast-center': center || hAlign === 'center',
21
- 'toast-end': end || hAlign === 'end',
22
- 'toast-top': top || vAlign === 'top',
23
- 'toast-middle': middle || vAlign === 'middle',
24
- 'toast-bottom': bottom || vAlign === 'bottom',
56
+ 'toast-start': props.start || props.hAlign === 'start',
57
+ 'toast-center': props.center || props.hAlign === 'center',
58
+ 'toast-end': props.end || props.hAlign === 'end',
59
+ 'toast-top': props.top || props.vAlign === 'top',
60
+ 'toast-middle': props.middle || props.vAlign === 'middle',
61
+ 'toast-bottom': props.bottom || props.vAlign === 'bottom',
25
62
  }"
26
63
  >
64
+ <slot
65
+ v-for="toast in visibleToasts"
66
+ :key="toast.id"
67
+ :toast="toast"
68
+ :remove-toast="removeToast"
69
+ />
27
70
  <slot />
28
71
  </div>
29
72
  </template>
package/package.json CHANGED
@@ -1,8 +1,22 @@
1
1
  {
2
2
  "name": "daisy-ui-kit",
3
3
  "type": "module",
4
- "version": "5.0.0-pre.8",
4
+ "version": "5.0.0-pre.9",
5
5
  "packageManager": "pnpm@10.10.0",
6
+ "main": "./nuxt.js",
7
+ "module": "./nuxt.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./nuxt.js",
11
+ "require": "./nuxt.js"
12
+ },
13
+ "./nuxt": {
14
+ "import": "./nuxt.js",
15
+ "require": "./nuxt.js"
16
+ },
17
+ "./components/*": "./app/components/*",
18
+ "./utils/*": "./app/utils/*"
19
+ },
6
20
  "files": [
7
21
  "app/components/*.vue",
8
22
  "app/utils/*",