daisy-ui-kit 5.0.9 → 5.0.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.
@@ -1,68 +1,59 @@
1
- <script setup lang="ts">
2
- import { computed, resolveDynamicComponent } from 'vue'
1
+ <script lang="ts">
2
+ import { computed, defineComponent, h } from 'vue'
3
3
 
4
- defineOptions({
4
+ export default defineComponent({
5
5
  inheritAttrs: false,
6
- })
7
-
8
- const { is = 'div', ...props } = defineProps<{
9
- is?: string
10
- outline?: boolean
11
- soft?: boolean
12
- dash?: boolean
13
- ghost?: boolean
14
-
15
- size?: string
16
- xl?: boolean
17
- lg?: boolean
18
- md?: boolean
19
- sm?: boolean
20
- xs?: boolean
21
-
22
- color?: string
23
- neutral?: boolean
24
- primary?: boolean
25
- secondary?: boolean
26
- accent?: boolean
27
- info?: boolean
28
- success?: boolean
29
- warning?: boolean
30
- error?: boolean
31
- }>()
32
-
33
- const resolvedComponent = computed(() => {
34
- if (is === 'div' || is === 'span') return is
35
- return resolveDynamicComponent(is)
6
+ props: {
7
+ is: { type: [String, Object], default: 'div' },
8
+ outline: Boolean,
9
+ soft: Boolean,
10
+ dash: Boolean,
11
+ ghost: Boolean,
12
+
13
+ size: String as () => string,
14
+ xl: Boolean,
15
+ lg: Boolean,
16
+ md: Boolean,
17
+ sm: Boolean,
18
+ xs: Boolean,
19
+
20
+ color: String as () => string,
21
+ neutral: Boolean,
22
+ primary: Boolean,
23
+ secondary: Boolean,
24
+ accent: Boolean,
25
+ info: Boolean,
26
+ success: Boolean,
27
+ warning: Boolean,
28
+ error: Boolean,
29
+ },
30
+ setup(props, { slots, attrs }) {
31
+ const classes = computed(() => [
32
+ 'badge',
33
+ {
34
+ 'badge-outline': props.outline,
35
+ 'badge-ghost': props.ghost,
36
+ 'badge-soft': props.soft,
37
+ 'badge-dash': props.dash,
38
+
39
+ 'badge-xl': props.xl || props.size === 'xl',
40
+ 'badge-lg': props.lg || props.size === 'lg',
41
+ 'badge-md': props.md || props.size === 'md',
42
+ 'badge-sm': props.sm || props.size === 'sm',
43
+ 'badge-xs': props.xs || props.size === 'xs',
44
+
45
+ 'badge-neutral': props.neutral || props.color === 'neutral',
46
+ 'badge-primary': props.primary || props.color === 'primary',
47
+ 'badge-secondary': props.secondary || props.color === 'secondary',
48
+ 'badge-accent': props.accent || props.color === 'accent',
49
+ 'badge-info': props.info || props.color === 'info',
50
+ 'badge-success': props.success || props.color === 'success',
51
+ 'badge-warning': props.warning || props.color === 'warning',
52
+ 'badge-error': props.error || props.color === 'error',
53
+ },
54
+ ])
55
+
56
+ return () => h(props.is as any, { ...attrs, class: classes.value }, slots.default?.())
57
+ },
36
58
  })
37
59
  </script>
38
-
39
- <template>
40
- <component
41
- :is="resolvedComponent"
42
- v-bind="$attrs"
43
- class="badge"
44
- :class="{
45
- 'badge-outline': props.outline,
46
- 'badge-ghost': props.ghost,
47
- 'badge-soft': props.soft,
48
- 'badge-dash': props.dash,
49
-
50
- 'badge-xl': props.xl || props.size === 'xl',
51
- 'badge-lg': props.lg || props.size === 'lg',
52
- 'badge-md': props.md || props.size === 'md',
53
- 'badge-sm': props.sm || props.size === 'sm',
54
- 'badge-xs': props.xs || props.size === 'xs',
55
-
56
- 'badge-neutral': props.neutral || props.color === 'neutral',
57
- 'badge-primary': props.primary || props.color === 'primary',
58
- 'badge-secondary': props.secondary || props.color === 'secondary',
59
- 'badge-accent': props.accent || props.color === 'accent',
60
- 'badge-info': props.info || props.color === 'info',
61
- 'badge-success': props.success || props.color === 'success',
62
- 'badge-warning': props.warning || props.color === 'warning',
63
- 'badge-error': props.error || props.color === 'error',
64
- }"
65
- >
66
- <slot />
67
- </component>
68
- </template>
@@ -1,138 +1,126 @@
1
- <script setup lang="ts">
2
- import { computed, resolveDynamicComponent } from 'vue'
1
+ <script lang="ts">
2
+ import { computed, defineComponent, h } from 'vue'
3
3
 
4
- defineOptions({
4
+ export default defineComponent({
5
5
  inheritAttrs: false,
6
- })
7
-
8
- const props = withDefaults(
9
- defineProps<{
10
- is?: string
11
- join?: boolean
12
-
13
- color?: string
14
- neutral?: boolean
15
- primary?: boolean
16
- secondary?: boolean
17
- accent?: boolean
18
- info?: boolean
19
- success?: boolean
20
- warning?: boolean
21
- error?: boolean
22
-
23
- ghost?: boolean
24
- link?: boolean
25
- glass?: boolean
26
- outline?: boolean
27
- dash?: boolean
28
- soft?: boolean
29
- disabled?: boolean
30
-
31
- shape?: 'circle' | 'square' | 'wide' | 'block'
32
- circle?: boolean
33
- square?: boolean
34
- wide?: boolean
35
- block?: boolean
36
-
37
- noAnimation?: boolean
38
- active?: boolean
39
-
40
- size?: 'lg' | 'md' | 'sm' | 'xs' | 'xl'
41
- xl?: boolean
42
- lg?: boolean
43
- md?: boolean
44
- sm?: boolean
45
- xs?: boolean
46
-
47
- type?: 'button' | 'submit' | 'reset'
48
- }>(),
49
- {
50
- type: 'button',
6
+ props: {
7
+ is: String,
8
+ join: Boolean,
9
+
10
+ color: String as () => string,
11
+ neutral: Boolean,
12
+ primary: Boolean,
13
+ secondary: Boolean,
14
+ accent: Boolean,
15
+ info: Boolean,
16
+ success: Boolean,
17
+ warning: Boolean,
18
+ error: Boolean,
19
+
20
+ ghost: Boolean,
21
+ link: Boolean,
22
+ glass: Boolean,
23
+ outline: Boolean,
24
+ dash: Boolean,
25
+ soft: Boolean,
26
+ disabled: Boolean,
27
+
28
+ shape: String as () => 'circle' | 'square' | 'wide' | 'block',
29
+ circle: Boolean,
30
+ square: Boolean,
31
+ wide: Boolean,
32
+ block: Boolean,
33
+
34
+ noAnimation: Boolean,
35
+ active: Boolean,
36
+
37
+ size: String as () => 'lg' | 'md' | 'sm' | 'xs' | 'xl',
38
+ xl: Boolean,
39
+ lg: Boolean,
40
+ md: Boolean,
41
+ sm: Boolean,
42
+ xs: Boolean,
43
+
44
+ type: { type: String as () => 'button' | 'submit' | 'reset', default: 'button' },
45
+ },
46
+ setup(props, { slots, attrs }) {
47
+ const isButton = computed(() => (props.is || 'button') === 'button')
48
+
49
+ const classes = computed(() => [
50
+ 'btn',
51
+ {
52
+ 'join-item': props.join,
53
+
54
+ 'btn-neutral': !props.disabled && (props.neutral || props.color === 'neutral'),
55
+ 'btn-primary': !props.disabled && (props.primary || props.color === 'primary'),
56
+ 'btn-secondary': !props.disabled && (props.secondary || props.color === 'secondary'),
57
+ 'btn-accent': !props.disabled && (props.accent || props.color === 'accent'),
58
+ 'btn-info': !props.disabled && (props.info || props.color === 'info'),
59
+ 'btn-success': !props.disabled && (props.success || props.color === 'success'),
60
+ 'btn-warning': !props.disabled && (props.warning || props.color === 'warning'),
61
+ 'btn-error': !props.disabled && (props.error || props.color === 'error'),
62
+
63
+ 'text-primary': !props.disabled && (props.primary || props.color === 'primary') && props.link,
64
+ 'text-secondary': !props.disabled && (props.secondary || props.color === 'secondary') && props.link,
65
+ 'text-neutral': !props.disabled && (props.neutral || props.color === 'neutral') && props.link,
66
+ 'text-accent': !props.disabled && (props.accent || props.color === 'accent') && props.link,
67
+ 'text-info': !props.disabled && (props.info || props.color === 'info') && props.link,
68
+ 'text-success': !props.disabled && (props.success || props.color === 'success') && props.link,
69
+ 'text-warning': !props.disabled && (props.warning || props.color === 'warning') && props.link,
70
+ 'text-error': !props.disabled && (props.error || props.color === 'error') && props.link,
71
+
72
+ glass: !props.disabled && props.glass,
73
+
74
+ 'btn-circle': props.circle || props.shape === 'circle',
75
+ 'btn-square': props.square || props.shape === 'square',
76
+ 'btn-wide': props.wide || props.shape === 'wide',
77
+ 'btn-block': props.block || props.shape === 'block',
78
+
79
+ 'btn-xl': props.xl || props.size === 'xl',
80
+ 'btn-lg': props.lg || props.size === 'lg',
81
+ 'btn-md': props.md || props.size === 'md',
82
+ 'btn-sm': props.sm || props.size === 'sm',
83
+ 'btn-xs': props.xs || props.size === 'xs',
84
+
85
+ 'btn-outline': !props.disabled && props.outline,
86
+ 'btn-dash': !props.disabled && props.dash,
87
+ 'btn-ghost': !props.disabled && props.ghost,
88
+ 'btn-soft': !props.disabled && props.soft,
89
+ 'btn-link': !props.disabled && props.link,
90
+ 'btn-disabled': props.disabled,
91
+
92
+ 'no-animation': props.noAnimation,
93
+ 'btn-active': !props.disabled && props.active,
94
+ },
95
+ ])
96
+
97
+ function onKeydown(e: KeyboardEvent) {
98
+ if (props.disabled) return
99
+ if (e.code === 'Space' || e.code === 'Enter' || e.key === ' ' || e.key === 'Enter') {
100
+ e.preventDefault()
101
+ ;(e.currentTarget as HTMLElement)?.click?.()
102
+ }
103
+ }
104
+
105
+ return () => {
106
+ const tag = props.is || 'button'
107
+ const isBtnEl = isButton.value
108
+
109
+ return h(
110
+ tag as any,
111
+ {
112
+ ...attrs,
113
+ type: isBtnEl ? props.type : undefined,
114
+ disabled: isBtnEl && props.disabled ? true : undefined,
115
+ 'aria-disabled': !isBtnEl && props.disabled ? true : undefined,
116
+ tabindex: !isBtnEl ? (props.disabled ? -1 : 0) : undefined,
117
+ role: !isBtnEl ? 'button' : undefined,
118
+ class: classes.value,
119
+ onKeydown: !isBtnEl ? onKeydown : undefined,
120
+ },
121
+ slots.default?.(),
122
+ )
123
+ }
51
124
  },
52
- )
53
- // Accessibility: Determine if rendering a native button
54
- const isButton = computed(() => (props.is || 'button') === 'button')
55
-
56
- // Resolve the component to render
57
- const resolvedComponent = computed(() => {
58
- const tag = props.is || 'button'
59
- // For HTML elements, return the string directly
60
- if (tag === 'button' || tag === 'a') {
61
- return tag
62
- }
63
- // For component names, resolve from global registry
64
- return resolveDynamicComponent(tag)
65
125
  })
66
-
67
- // Accessibility: Keyboard event handler for custom elements
68
- function onKeydown(e: KeyboardEvent) {
69
- if (props.disabled) {
70
- return
71
- }
72
- if (e.code === 'Space' || e.code === 'Enter' || e.key === ' ' || e.key === 'Enter') {
73
- e.preventDefault()
74
- // @ts-expect-error: $el may not exist yet
75
- e.currentTarget?.click?.()
76
- }
77
- }
78
126
  </script>
79
-
80
- <template>
81
- <component
82
- :is="resolvedComponent"
83
- v-bind="$attrs"
84
- :type="isButton ? type : undefined"
85
- :disabled="isButton && disabled ? true : undefined"
86
- :aria-disabled="!isButton && disabled ? true : undefined"
87
- :tabindex="!isButton ? (disabled ? -1 : 0) : undefined"
88
- :role="!isButton ? 'button' : undefined"
89
- class="btn"
90
- :class="{
91
- 'join-item': join,
92
-
93
- 'btn-neutral': !disabled && (neutral || color === 'neutral'),
94
- 'btn-primary': !disabled && (primary || color === 'primary'),
95
- 'btn-secondary': !disabled && (secondary || color === 'secondary'),
96
- 'btn-accent': !disabled && (accent || color === 'accent'),
97
- 'btn-info': !disabled && (info || color === 'info'),
98
- 'btn-success': !disabled && (success || color === 'success'),
99
- 'btn-warning': !disabled && (warning || color === 'warning'),
100
- 'btn-error': !disabled && (error || color === 'error'),
101
-
102
- 'text-primary': !disabled && (primary || color === 'primary') && link,
103
- 'text-secondary': !disabled && (secondary || color === 'secondary') && link,
104
- 'text-neutral': !disabled && (neutral || color === 'neutral') && link,
105
- 'text-accent': !disabled && (accent || color === 'accent') && link,
106
- 'text-info': !disabled && (info || color === 'info') && link,
107
- 'text-success': !disabled && (success || color === 'success') && link,
108
- 'text-warning': !disabled && (warning || color === 'warning') && link,
109
- 'text-error': !disabled && (error || color === 'error') && link,
110
-
111
- glass: !disabled && glass,
112
-
113
- 'btn-circle': circle || shape === 'circle',
114
- 'btn-square': square || shape === 'square',
115
- 'btn-wide': wide || shape === 'wide',
116
- 'btn-block': block || shape === 'block',
117
-
118
- 'btn-xl': xl || size === 'xl',
119
- 'btn-lg': lg || size === 'lg',
120
- 'btn-md': md || size === 'md',
121
- 'btn-sm': sm || size === 'sm',
122
- 'btn-xs': xs || size === 'xs',
123
-
124
- 'btn-outline': !disabled && outline,
125
- 'btn-dash': !disabled && dash,
126
- 'btn-ghost': !disabled && ghost,
127
- 'btn-soft': !disabled && soft,
128
- 'btn-link': !disabled && link,
129
- 'btn-disabled': disabled,
130
-
131
- 'no-animation': noAnimation,
132
- 'btn-active': !disabled && active,
133
- }"
134
- @keydown="!isButton ? onKeydown : undefined"
135
- >
136
- <slot />
137
- </component>
138
- </template>
@@ -1,47 +1,38 @@
1
- <script setup lang="ts">
2
- import { computed, resolveDynamicComponent } from 'vue'
1
+ <script lang="ts">
2
+ import { computed, defineComponent, h } from 'vue'
3
3
 
4
- defineOptions({
4
+ export default defineComponent({
5
5
  inheritAttrs: false,
6
- })
6
+ props: {
7
+ is: { type: [String, Object], default: 'div' },
8
+ border: Boolean,
9
+ dash: Boolean,
10
+ side: Boolean,
11
+ imageFull: Boolean,
12
+ size: String as () => 'xl' | 'lg' | 'md' | 'sm' | 'xs',
13
+ xl: Boolean,
14
+ lg: Boolean,
15
+ md: Boolean,
16
+ sm: Boolean,
17
+ xs: Boolean,
18
+ },
19
+ setup(props, { slots, attrs }) {
20
+ const classes = computed(() => [
21
+ 'card',
22
+ {
23
+ 'card-border': props.border,
24
+ 'card-side': props.side,
25
+ 'image-full': props.imageFull,
7
26
 
8
- const { is = 'div', ...props } = defineProps<{
9
- is?: string
10
- border?: boolean
11
- dash?: boolean
12
- side?: boolean
13
- imageFull?: boolean
14
- size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
15
- xl?: boolean
16
- lg?: boolean
17
- md?: boolean
18
- sm?: boolean
19
- xs?: boolean
20
- }>()
27
+ 'card-xl': props.xl || props.size === 'xl',
28
+ 'card-lg': props.lg || props.size === 'lg',
29
+ 'card-md': props.md || props.size === 'md',
30
+ 'card-sm': props.sm || props.size === 'sm',
31
+ 'card-xs': props.xs || props.size === 'xs',
32
+ },
33
+ ])
21
34
 
22
- const resolvedComponent = computed(() => {
23
- if (is === 'div') return 'div'
24
- return resolveDynamicComponent(is)
35
+ return () => h(props.is as any, { ...attrs, class: classes.value }, slots.default?.())
36
+ },
25
37
  })
26
38
  </script>
27
-
28
- <template>
29
- <component
30
- :is="resolvedComponent"
31
- v-bind="$attrs"
32
- class="card"
33
- :class="{
34
- 'card-border': props.border,
35
- 'card-side': props.side,
36
- 'image-full': props.imageFull,
37
-
38
- 'card-xl': props.xl || props.size === 'xl',
39
- 'card-lg': props.lg || props.size === 'lg',
40
- 'card-md': props.md || props.size === 'md',
41
- 'card-sm': props.sm || props.size === 'sm',
42
- 'card-xs': props.xs || props.size === 'xs',
43
- }"
44
- >
45
- <slot />
46
- </component>
47
- </template>
@@ -1,15 +1,12 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
1
+ <script lang="ts">
2
+ import { defineComponent, h } from 'vue'
3
3
 
4
- const props = defineProps<{
5
- is?: any
6
- }>()
7
-
8
- const tag = computed(() => props.is || 'span')
4
+ export default defineComponent({
5
+ props: {
6
+ is: { type: [String, Object], default: 'span' },
7
+ },
8
+ setup(props, { slots }) {
9
+ return () => h(props.is as any, { class: 'countdown' }, slots.default?.())
10
+ },
11
+ })
9
12
  </script>
10
-
11
- <template>
12
- <component :is="tag" class="countdown">
13
- <slot />
14
- </component>
15
- </template>
@@ -1,52 +1,39 @@
1
- <script setup lang="ts">
2
- import { computed, resolveDynamicComponent } from 'vue'
1
+ <script lang="ts">
2
+ import { computed, defineComponent, h } from 'vue'
3
3
 
4
- defineOptions({
4
+ export default defineComponent({
5
5
  inheritAttrs: false,
6
- })
6
+ props: {
7
+ is: { type: [String, Object], default: 'a' },
8
+ hover: Boolean,
7
9
 
8
- const props = withDefaults(
9
- defineProps<{
10
- is?: string
11
- hover?: boolean
10
+ color: String as () => 'neutral' | 'primary' | 'secondary' | 'accent' | 'success' | 'info' | 'warning' | 'error',
11
+ neutral: Boolean,
12
+ primary: Boolean,
13
+ secondary: Boolean,
14
+ accent: Boolean,
15
+ success: Boolean,
16
+ info: Boolean,
17
+ warning: Boolean,
18
+ error: Boolean,
19
+ },
20
+ setup(props, { slots, attrs }) {
21
+ const classes = computed(() => [
22
+ 'link',
23
+ {
24
+ 'link-neutral': props.neutral || props.color === 'neutral',
25
+ 'link-primary': props.primary || props.color === 'primary',
26
+ 'link-secondary': props.secondary || props.color === 'secondary',
27
+ 'link-accent': props.accent || props.color === 'accent',
28
+ 'link-success': props.success || props.color === 'success',
29
+ 'link-info': props.info || props.color === 'info',
30
+ 'link-warning': props.warning || props.color === 'warning',
31
+ 'link-error': props.error || props.color === 'error',
32
+ 'link-hover': props.hover,
33
+ },
34
+ ])
12
35
 
13
- color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'success' | 'info' | 'warning' | 'error'
14
- neutral?: boolean
15
- primary?: boolean
16
- secondary?: boolean
17
- accent?: boolean
18
- success?: boolean
19
- info?: boolean
20
- warning?: boolean
21
- error?: boolean
22
- }>(),
23
- {
24
- is: 'a',
36
+ return () => h(props.is as any, { ...attrs, class: classes.value }, slots.default?.())
25
37
  },
26
- )
27
- const resolvedComponent = computed(() => {
28
- if (props.is === 'a') return 'a'
29
- return resolveDynamicComponent(props.is!)
30
38
  })
31
39
  </script>
32
-
33
- <template>
34
- <component
35
- :is="resolvedComponent"
36
- v-bind="$attrs"
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>
@@ -1,20 +1,18 @@
1
- <script setup lang="ts">
2
- defineOptions({
1
+ <script lang="ts">
2
+ import { defineComponent, h } from 'vue'
3
+
4
+ export default defineComponent({
3
5
  inheritAttrs: false,
6
+ props: {
7
+ is: { type: [String, Object], default: 'fieldset' },
8
+ legend: String,
9
+ },
10
+ setup(props, { slots, attrs }) {
11
+ return () =>
12
+ h(props.is as any, { ...attrs, class: 'fieldset bg-base-200 border-base-300 rounded-box border p-4' }, [
13
+ props.legend ? h('legend', { class: 'fieldset-legend' }, props.legend) : slots.legend?.(),
14
+ slots.default?.(),
15
+ ])
16
+ },
4
17
  })
5
-
6
- const { is = 'fieldset', legend } = defineProps<{
7
- is?: string
8
- legend?: string
9
- }>()
10
18
  </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>