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.
- package/app/components/Badge.vue +55 -64
- package/app/components/Button.vue +121 -133
- package/app/components/Card.vue +32 -41
- package/app/components/Countdown.vue +10 -13
- package/app/components/DaisyLink.vue +32 -45
- package/app/components/Fieldset.vue +15 -17
- package/app/components/Flex.vue +73 -75
- package/app/components/FlexItem.vue +45 -51
- package/app/components/Indicator.vue +10 -17
- package/app/components/IndicatorItem.vue +28 -35
- package/app/components/Navbar.vue +12 -11
- package/app/components/NavbarCenter.vue +11 -10
- package/app/components/NavbarEnd.vue +11 -10
- package/app/components/NavbarStart.vue +11 -10
- package/app/components/SkeletonText.vue +11 -10
- package/app/components/Stack.vue +25 -27
- package/app/components/Tab.vue +47 -46
- package/app/components/Text.vue +175 -172
- package/nuxt.js +2 -0
- package/package.json +1 -1
package/app/components/Badge.vue
CHANGED
|
@@ -1,68 +1,59 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import { computed,
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, defineComponent, h } from 'vue'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default defineComponent({
|
|
5
5
|
inheritAttrs: false,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
2
|
-
import { computed,
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, defineComponent, h } from 'vue'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default defineComponent({
|
|
5
5
|
inheritAttrs: false,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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>
|
package/app/components/Card.vue
CHANGED
|
@@ -1,47 +1,38 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import { computed,
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, defineComponent, h } from 'vue'
|
|
3
3
|
|
|
4
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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
|
|
2
|
-
import {
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent, h } from 'vue'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
2
|
-
import { computed,
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, defineComponent, h } from 'vue'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default defineComponent({
|
|
5
5
|
inheritAttrs: false,
|
|
6
|
-
|
|
6
|
+
props: {
|
|
7
|
+
is: { type: [String, Object], default: 'a' },
|
|
8
|
+
hover: Boolean,
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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
|
|
2
|
-
|
|
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>
|