daisy-ui-kit 5.0.0-pre.10 → 5.0.0-pre.12
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/Accordion.vue +8 -5
- package/app/components/Alert.vue +2 -1
- package/app/components/Avatar.vue +10 -7
- package/app/components/AvatarGroup.vue +6 -2
- package/app/components/Badge.vue +14 -1
- package/app/components/Button.vue +60 -45
- package/app/components/Calendar.vue +24 -1
- package/app/components/CalendarInput.vue +2 -2
- package/app/components/CalendarSkeleton.vue +51 -10
- package/app/components/Card.vue +15 -2
- package/app/components/CardActions.vue +1 -1
- package/app/components/CardBody.vue +1 -1
- package/app/components/CardTitle.vue +1 -1
- package/app/components/Carousel.vue +2 -1
- package/app/components/Chat.vue +6 -1
- package/app/components/Checkbox.vue +1 -1
- package/app/components/Collapse.vue +37 -5
- package/app/components/CollapseTitle.vue +11 -1
- package/app/components/Countdown.vue +3 -3
- package/app/components/CountdownTimers.vue +4 -7
- package/app/components/Counter.vue +13 -2
- package/app/components/DaisyLink.vue +29 -15
- package/app/components/Dock.vue +1 -1
- package/app/components/DockItem.vue +1 -1
- package/app/components/Drawer.vue +15 -12
- package/app/components/DrawerContent.vue +9 -6
- package/app/components/DrawerSide.vue +9 -6
- package/app/components/Dropdown.vue +61 -50
- package/app/components/DropdownButton.vue +11 -4
- package/app/components/DropdownContent.vue +90 -19
- package/app/components/DropdownTarget.vue +9 -2
- package/app/components/Fab.vue +16 -0
- package/app/components/FabClose.vue +18 -0
- package/app/components/FabMainAction.vue +5 -0
- package/app/components/FabTrigger.vue +117 -0
- package/app/components/Fieldset.vue +1 -4
- package/app/components/FileInput.vue +1 -1
- package/app/components/Filter.vue +35 -32
- package/app/components/Flex.vue +3 -1
- package/app/components/FlexItem.vue +30 -27
- package/app/components/Footer.vue +16 -12
- package/app/components/FooterTitle.vue +8 -5
- package/app/components/Hero.vue +9 -6
- package/app/components/HeroContent.vue +9 -6
- package/app/components/Hover3D.vue +22 -0
- package/app/components/HoverGallery.vue +11 -0
- package/app/components/Indicator.vue +8 -5
- package/app/components/IndicatorItem.vue +16 -13
- package/app/components/Input.vue +47 -40
- package/app/components/Kbd.vue +2 -1
- package/app/components/Label.vue +32 -29
- package/app/components/MenuExpand.vue +1 -7
- package/app/components/MenuExpandToggle.vue +7 -1
- package/app/components/MenuItem.vue +6 -4
- package/app/components/Modal.vue +23 -17
- package/app/components/Progress.vue +13 -1
- package/app/components/Prose.vue +7 -2
- package/app/components/RadialProgress.vue +8 -8
- package/app/components/Radio.vue +1 -1
- package/app/components/RadioGroup.vue +2 -2
- package/app/components/Range.vue +2 -2
- package/app/components/RangeMeasure.vue +33 -30
- package/app/components/Rating.vue +70 -53
- package/app/components/Select.vue +44 -47
- package/app/components/SkeletonText.vue +11 -0
- package/app/components/Steps.vue +7 -2
- package/app/components/Swap.vue +4 -10
- package/app/components/Tab.vue +18 -5
- package/app/components/Text.vue +42 -22
- package/app/components/TextArea.vue +30 -27
- package/app/components/TextRotate.vue +24 -0
- package/app/components/ThemeController.vue +3 -4
- package/app/components/ThemeProvider.vue +47 -32
- package/app/components/TimelineLine.vue +1 -1
- package/app/components/TimelineStart.vue +2 -1
- package/app/components/Toast.vue +1 -6
- package/app/components/Toggle.vue +2 -2
- package/app/components/Tooltip.vue +2 -1
- package/app/utils/drawer-utils.ts +15 -13
- package/app/utils/position-area.ts +41 -0
- package/package.json +9 -7
package/app/components/Text.vue
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
2
4
|
const props = defineProps<{
|
|
3
5
|
is?: string
|
|
4
6
|
join?: boolean
|
|
@@ -8,7 +10,23 @@ const props = defineProps<{
|
|
|
8
10
|
inlineBlock?: boolean
|
|
9
11
|
label?: boolean
|
|
10
12
|
|
|
11
|
-
color?:
|
|
13
|
+
color?:
|
|
14
|
+
| 'neutral'
|
|
15
|
+
| 'primary'
|
|
16
|
+
| 'secondary'
|
|
17
|
+
| 'accent'
|
|
18
|
+
| 'info'
|
|
19
|
+
| 'success'
|
|
20
|
+
| 'warning'
|
|
21
|
+
| 'error'
|
|
22
|
+
| 'primary-content'
|
|
23
|
+
| 'secondary-content'
|
|
24
|
+
| 'neutral-content'
|
|
25
|
+
| 'accent-content'
|
|
26
|
+
| 'info-content'
|
|
27
|
+
| 'success-content'
|
|
28
|
+
| 'warning-content'
|
|
29
|
+
| 'error-content'
|
|
12
30
|
neutral?: boolean
|
|
13
31
|
primary?: boolean
|
|
14
32
|
secondary?: boolean
|
|
@@ -26,7 +44,7 @@ const props = defineProps<{
|
|
|
26
44
|
warningContent?: boolean
|
|
27
45
|
errorContent?: boolean
|
|
28
46
|
|
|
29
|
-
size?:
|
|
47
|
+
size?: '9xl' | '8xl' | '7xl' | '6xl' | '5xl' | '4xl' | '3xl' | '2xl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
30
48
|
xl?: boolean
|
|
31
49
|
lg?: boolean
|
|
32
50
|
md?: boolean
|
|
@@ -50,7 +68,7 @@ const props = defineProps<{
|
|
|
50
68
|
serif?: boolean
|
|
51
69
|
mono?: boolean
|
|
52
70
|
|
|
53
|
-
weight?:
|
|
71
|
+
weight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black'
|
|
54
72
|
thin?: boolean
|
|
55
73
|
extralight?: boolean
|
|
56
74
|
light?: boolean
|
|
@@ -61,40 +79,42 @@ const props = defineProps<{
|
|
|
61
79
|
extrabold?: boolean
|
|
62
80
|
black?: boolean
|
|
63
81
|
}>()
|
|
82
|
+
const NuxtLink = resolveComponent('NuxtLink')
|
|
83
|
+
const RouterLink = resolveComponent('RouterLink')
|
|
84
|
+
|
|
85
|
+
const resolvedComponent = computed(() => {
|
|
86
|
+
if (props.is === 'NuxtLink') return NuxtLink
|
|
87
|
+
if (props.is === 'RouterLink') return RouterLink
|
|
88
|
+
return props.is || 'span'
|
|
89
|
+
})
|
|
64
90
|
</script>
|
|
65
91
|
|
|
66
92
|
<template>
|
|
67
93
|
<component
|
|
68
|
-
:is="
|
|
94
|
+
:is="resolvedComponent"
|
|
69
95
|
v-bind="label ? { 'data-role': 'label' } : {}"
|
|
70
96
|
:class="{
|
|
71
97
|
'join-item': join,
|
|
72
98
|
|
|
73
|
-
|
|
74
|
-
|
|
99
|
+
block,
|
|
100
|
+
inline,
|
|
75
101
|
'inline-block': inlineBlock,
|
|
76
|
-
|
|
102
|
+
label,
|
|
77
103
|
|
|
78
104
|
'text-primary': primary || color === 'primary',
|
|
79
|
-
'text-primary-content':
|
|
80
|
-
primaryContent || color === 'primary-content',
|
|
105
|
+
'text-primary-content': primaryContent || color === 'primary-content',
|
|
81
106
|
'text-secondary': secondary || color === 'secondary',
|
|
82
|
-
'text-secondary-content':
|
|
83
|
-
secondaryContent || color === 'secondary-content',
|
|
107
|
+
'text-secondary-content': secondaryContent || color === 'secondary-content',
|
|
84
108
|
'text-neutral': neutral || color === 'neutral',
|
|
85
|
-
'text-neutral-content':
|
|
86
|
-
neutralContent || color === 'neutral-content',
|
|
109
|
+
'text-neutral-content': neutralContent || color === 'neutral-content',
|
|
87
110
|
'text-accent': accent || color === 'accent',
|
|
88
|
-
'text-accent-content':
|
|
89
|
-
accentContent || color === 'accent-content',
|
|
111
|
+
'text-accent-content': accentContent || color === 'accent-content',
|
|
90
112
|
'text-info': info || color === 'info',
|
|
91
113
|
'text-info-content': infoContent || color === 'info-content',
|
|
92
114
|
'text-success': success || color === 'success',
|
|
93
|
-
'text-success-content':
|
|
94
|
-
successContent || color === 'success-content',
|
|
115
|
+
'text-success-content': successContent || color === 'success-content',
|
|
95
116
|
'text-warning': warning || color === 'warning',
|
|
96
|
-
'text-warning-content':
|
|
97
|
-
warningContent || color === 'warning-content',
|
|
117
|
+
'text-warning-content': warningContent || color === 'warning-content',
|
|
98
118
|
'text-error': error || color === 'error',
|
|
99
119
|
'text-error-content': errorContent || color === 'error-content',
|
|
100
120
|
|
|
@@ -117,9 +137,9 @@ const props = defineProps<{
|
|
|
117
137
|
'text-right': right || align === 'right',
|
|
118
138
|
'text-justify': justify || align === 'justify',
|
|
119
139
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
140
|
+
uppercase: uppercase || props.case === 'upper',
|
|
141
|
+
lowercase: lowercase || props.case === 'lower',
|
|
142
|
+
capitalize: capitalize || props.case === 'capitalize',
|
|
123
143
|
'normal-case': normalCase || props.case === 'normal',
|
|
124
144
|
|
|
125
145
|
'font-sans': sans || font === 'sans',
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
const props = withDefaults(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const props = withDefaults(
|
|
3
|
+
defineProps<{
|
|
4
|
+
modelValue?: string
|
|
5
|
+
placeholder?: string
|
|
6
|
+
type?: 'text' | 'phone' | 'email' | 'search'
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
color?: string
|
|
9
|
+
neutral?: boolean
|
|
10
|
+
primary?: boolean
|
|
11
|
+
secondary?: boolean
|
|
12
|
+
accent?: boolean
|
|
13
|
+
info?: boolean
|
|
14
|
+
success?: boolean
|
|
15
|
+
warning?: boolean
|
|
16
|
+
error?: boolean
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
ghost?: boolean
|
|
19
|
+
disabled?: boolean
|
|
20
|
+
validator?: boolean
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}>(),
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
23
|
+
xl?: boolean
|
|
24
|
+
lg?: boolean
|
|
25
|
+
md?: boolean
|
|
26
|
+
sm?: boolean
|
|
27
|
+
xs?: boolean
|
|
28
|
+
}>(),
|
|
29
|
+
{
|
|
30
|
+
type: 'text',
|
|
31
|
+
},
|
|
32
|
+
)
|
|
30
33
|
defineEmits(['update:modelValue'])
|
|
31
34
|
</script>
|
|
32
35
|
|
|
@@ -48,7 +51,7 @@ defineEmits(['update:modelValue'])
|
|
|
48
51
|
'textarea-error': props.error || props.color === 'error',
|
|
49
52
|
|
|
50
53
|
'textarea-ghost': props.ghost,
|
|
51
|
-
|
|
54
|
+
validator: props.validator,
|
|
52
55
|
|
|
53
56
|
'textarea-xl': props.xl || props.size === 'xl',
|
|
54
57
|
'textarea-lg': props.lg || props.size === 'lg',
|
|
@@ -56,6 +59,6 @@ defineEmits(['update:modelValue'])
|
|
|
56
59
|
'textarea-sm': props.sm || props.size === 'sm',
|
|
57
60
|
'textarea-xs': props.xs || props.size === 'xs',
|
|
58
61
|
}"
|
|
59
|
-
@input="
|
|
62
|
+
@input="event => $emit('update:modelValue', (event.target as HTMLTextAreaElement).value)"
|
|
60
63
|
/>
|
|
61
64
|
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
is?: any
|
|
6
|
+
center?: boolean
|
|
7
|
+
duration?: number
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const style = computed(() => {
|
|
11
|
+
if (props.duration) {
|
|
12
|
+
return { animationDuration: `${props.duration}ms` }
|
|
13
|
+
}
|
|
14
|
+
return undefined
|
|
15
|
+
})
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<component :is="props.is || 'span'" class="text-rotate" :style="style">
|
|
20
|
+
<span :class="{ 'justify-items-center': props.center }">
|
|
21
|
+
<slot />
|
|
22
|
+
</span>
|
|
23
|
+
</component>
|
|
24
|
+
</template>
|
|
@@ -18,16 +18,15 @@ const props = defineProps<{
|
|
|
18
18
|
storage?: <T>(key: string, initial: T) => import('vue').Ref<T>
|
|
19
19
|
}>()
|
|
20
20
|
|
|
21
|
-
const themeOptions =
|
|
22
|
-
? { themes: props.themes || [], defaultTheme: props.defaultTheme }
|
|
23
|
-
: undefined
|
|
21
|
+
const themeOptions =
|
|
22
|
+
props.themes || props.defaultTheme ? { themes: props.themes || [], defaultTheme: props.defaultTheme } : undefined
|
|
24
23
|
|
|
25
24
|
const { theme, effectiveTheme, themes, setTheme, cycleTheme, registerTheme, removeTheme } = useDaisyTheme(
|
|
26
25
|
props.storage,
|
|
27
26
|
themeOptions,
|
|
28
27
|
)
|
|
29
28
|
|
|
30
|
-
const availableThemes = computed(() => themes.value.map(t => typeof t === 'string' ? t : t.theme))
|
|
29
|
+
const availableThemes = computed(() => themes.value.map(t => (typeof t === 'string' ? t : t.theme)))
|
|
31
30
|
</script>
|
|
32
31
|
|
|
33
32
|
<template>
|
|
@@ -19,7 +19,12 @@ function cssVarToCamel(str: string): string {
|
|
|
19
19
|
function dataAttrToCamel(str: string): string {
|
|
20
20
|
return str.replace(/-([a-z0-9])/g, (_, c: string) => c.toUpperCase())
|
|
21
21
|
}
|
|
22
|
-
function parseThemeString(themeString?: string): {
|
|
22
|
+
function parseThemeString(themeString?: string): {
|
|
23
|
+
style: Record<string, string>
|
|
24
|
+
dataAttrs: Record<string, string>
|
|
25
|
+
dataTheme: string | undefined
|
|
26
|
+
allAttrs: Record<string, string>
|
|
27
|
+
} {
|
|
23
28
|
if (!themeString) {
|
|
24
29
|
return { style: {}, dataAttrs: {}, dataTheme: undefined, allAttrs: {} }
|
|
25
30
|
}
|
|
@@ -33,10 +38,14 @@ function parseThemeString(themeString?: string): { style: Record<string, string>
|
|
|
33
38
|
const allAttrs: Record<string, string> = {}
|
|
34
39
|
|
|
35
40
|
// Remove @plugin ... { and closing } if present
|
|
36
|
-
const str = themeString
|
|
41
|
+
const str = themeString
|
|
42
|
+
.trim()
|
|
43
|
+
.replace(/^@plugin[^{}]*\{/, '')
|
|
44
|
+
.replace(/\}$/, '')
|
|
45
|
+
.trim()
|
|
37
46
|
|
|
38
47
|
// works with or without newline characters
|
|
39
|
-
str.split(/[\n;]/).forEach(
|
|
48
|
+
str.split(/[\n;]/).forEach(line => {
|
|
40
49
|
const trimmed = line.trim()
|
|
41
50
|
if (!trimmed || trimmed.startsWith('//')) {
|
|
42
51
|
return
|
|
@@ -57,12 +66,10 @@ function parseThemeString(themeString?: string): { style: Record<string, string>
|
|
|
57
66
|
if (varNamePattern.test(key)) {
|
|
58
67
|
style[key] = value
|
|
59
68
|
allAttrs[cssVarToCamel(key)] = value
|
|
60
|
-
}
|
|
61
|
-
else if (key === 'name') {
|
|
69
|
+
} else if (key === 'name') {
|
|
62
70
|
dataTheme = value.replace(/"/g, '')
|
|
63
71
|
allAttrs.dataTheme = dataTheme
|
|
64
|
-
}
|
|
65
|
-
else if (attrNamePattern.test(key)) {
|
|
72
|
+
} else if (attrNamePattern.test(key)) {
|
|
66
73
|
const attrKey = `data-${key.replace(/[^\w-]/g, '')}`
|
|
67
74
|
const attrVal = value.replace(/"/g, '')
|
|
68
75
|
dataAttrs[attrKey] = attrVal
|
|
@@ -78,7 +85,7 @@ const parsed = computed(() => parseThemeString(props.dataTheme ?? props.cssVars)
|
|
|
78
85
|
|
|
79
86
|
const themeVars = ref<Record<string, string>>({})
|
|
80
87
|
let observers: MutationObserver[] = []
|
|
81
|
-
let themeControllerInputs: Array<{ el: HTMLInputElement
|
|
88
|
+
let themeControllerInputs: Array<{ el: HTMLInputElement; listener: () => void }> = []
|
|
82
89
|
let themeControllerDomObserver: MutationObserver | null = null
|
|
83
90
|
|
|
84
91
|
// Converts a themeAttrs object to a DaisyUI theme string
|
|
@@ -88,15 +95,16 @@ function toThemeString(attrs: Record<string, string>, opts?: { asPlugin?: boolea
|
|
|
88
95
|
for (const [key, value] of Object.entries(attrs)) {
|
|
89
96
|
if (key === 'dataTheme') {
|
|
90
97
|
lines.push(`name: "${value}";`)
|
|
91
|
-
}
|
|
92
|
-
else if (key.startsWith('data')) {
|
|
98
|
+
} else if (key.startsWith('data')) {
|
|
93
99
|
// Convert dataFooBar -> foo-bar
|
|
94
|
-
const attr = key
|
|
100
|
+
const attr = key
|
|
101
|
+
.slice(4)
|
|
102
|
+
.replace(/([A-Z])/g, '-$1')
|
|
103
|
+
.toLowerCase()
|
|
95
104
|
if (attr !== 'theme') {
|
|
96
105
|
lines.push(`${attr}: ${value};`)
|
|
97
106
|
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
107
|
+
} else {
|
|
100
108
|
// Convert camelCase to --kebab-case
|
|
101
109
|
const cssVar = `--${key.replace(/([A-Z])/g, '-$1').toLowerCase()}`
|
|
102
110
|
lines.push(`${cssVar}: ${value};`)
|
|
@@ -207,8 +215,10 @@ function setupSnoop(rootEl: HTMLElement): void {
|
|
|
207
215
|
})
|
|
208
216
|
themeControllerInputs = []
|
|
209
217
|
// Find all matching inputs in the document
|
|
210
|
-
const inputs = Array.from(
|
|
211
|
-
|
|
218
|
+
const inputs = Array.from(
|
|
219
|
+
document.querySelectorAll('input[type="checkbox"].theme-controller, input[type="radio"].theme-controller'),
|
|
220
|
+
) as HTMLInputElement[]
|
|
221
|
+
inputs.forEach(el => {
|
|
212
222
|
const listener = () => updateVars()
|
|
213
223
|
el.addEventListener('change', listener)
|
|
214
224
|
themeControllerInputs.push({ el, listener })
|
|
@@ -226,9 +236,13 @@ function setupSnoop(rootEl: HTMLElement): void {
|
|
|
226
236
|
themeControllerDomObserver.observe(document.body, { childList: true, subtree: true })
|
|
227
237
|
|
|
228
238
|
// Watch for applied style changes (parsed.style)
|
|
229
|
-
watch(
|
|
230
|
-
|
|
231
|
-
|
|
239
|
+
watch(
|
|
240
|
+
() => parsed.value.style,
|
|
241
|
+
() => {
|
|
242
|
+
nextTick(() => updateVars())
|
|
243
|
+
},
|
|
244
|
+
{ immediate: false, deep: true },
|
|
245
|
+
)
|
|
232
246
|
updateVars()
|
|
233
247
|
}
|
|
234
248
|
|
|
@@ -236,21 +250,22 @@ const rootEl = ref<HTMLElement | null>(null)
|
|
|
236
250
|
|
|
237
251
|
const isClient = typeof window !== 'undefined' && typeof document !== 'undefined'
|
|
238
252
|
|
|
239
|
-
watch(
|
|
240
|
-
() => props.snoop,
|
|
241
|
-
() =>
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
253
|
+
watch(
|
|
254
|
+
[() => props.snoop, () => rootEl.value],
|
|
255
|
+
([snoop, el]) => {
|
|
256
|
+
if (isClient) {
|
|
257
|
+
// Clean up previous observers if any
|
|
258
|
+
observers.forEach((o: MutationObserver) => o.disconnect())
|
|
259
|
+
observers = []
|
|
260
|
+
if (snoop && el) {
|
|
261
|
+
nextTick(() => {
|
|
262
|
+
setupSnoop(el)
|
|
263
|
+
})
|
|
264
|
+
}
|
|
251
265
|
}
|
|
252
|
-
}
|
|
253
|
-
|
|
266
|
+
},
|
|
267
|
+
{ immediate: true },
|
|
268
|
+
)
|
|
254
269
|
|
|
255
270
|
onUnmounted(() => {
|
|
256
271
|
observers.forEach((o: MutationObserver) => o.disconnect())
|
package/app/components/Toast.vue
CHANGED
|
@@ -61,12 +61,7 @@ const visibleToasts = computed(() => toasts.value ?? [])
|
|
|
61
61
|
'toast-bottom': props.bottom || props.vAlign === 'bottom',
|
|
62
62
|
}"
|
|
63
63
|
>
|
|
64
|
-
<slot
|
|
65
|
-
v-for="toast in visibleToasts"
|
|
66
|
-
:key="toast.id"
|
|
67
|
-
:toast="toast"
|
|
68
|
-
:remove-toast="removeToast"
|
|
69
|
-
/>
|
|
64
|
+
<slot v-for="toast in visibleToasts" :key="toast.id" :toast="toast" :remove-toast="removeToast" />
|
|
70
65
|
<slot />
|
|
71
66
|
</div>
|
|
72
67
|
</template>
|
|
@@ -40,7 +40,7 @@ const currentValue = computed({
|
|
|
40
40
|
class="toggle"
|
|
41
41
|
:disabled="disabled"
|
|
42
42
|
:class="{
|
|
43
|
-
|
|
43
|
+
validator,
|
|
44
44
|
'toggle-neutral': neutral || color === 'neutral',
|
|
45
45
|
'toggle-primary': primary || color === 'primary',
|
|
46
46
|
'toggle-secondary': secondary || color === 'secondary',
|
|
@@ -56,5 +56,5 @@ const currentValue = computed({
|
|
|
56
56
|
'toggle-xl': xl || size === 'xl',
|
|
57
57
|
'theme-controller': themeController,
|
|
58
58
|
}"
|
|
59
|
-
|
|
59
|
+
/>
|
|
60
60
|
</template>
|
|
@@ -14,19 +14,21 @@ export interface Drawers {
|
|
|
14
14
|
export const drawers = reactive<Drawers>({})
|
|
15
15
|
|
|
16
16
|
export function createDrawerState(name: string) {
|
|
17
|
-
const drawerState =
|
|
18
|
-
name
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
})
|
|
30
32
|
drawers[name] = drawerState
|
|
31
33
|
return drawerState
|
|
32
34
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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: '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
|
+
// Use flip-block and flip-inline to automatically flip positions
|
|
39
|
+
// when there's not enough room in the preferred direction
|
|
40
|
+
return 'flip-block, flip-inline'
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "daisy-ui-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.0-pre.
|
|
4
|
+
"version": "5.0.0-pre.12",
|
|
5
5
|
"packageManager": "pnpm@10.10.0",
|
|
6
|
-
"main": "./nuxt.js",
|
|
7
|
-
"module": "./nuxt.js",
|
|
8
6
|
"exports": {
|
|
9
7
|
".": {
|
|
10
8
|
"import": "./nuxt.js",
|
|
@@ -17,6 +15,8 @@
|
|
|
17
15
|
"./components/*": "./app/components/*",
|
|
18
16
|
"./utils/*": "./app/utils/*"
|
|
19
17
|
},
|
|
18
|
+
"main": "./nuxt.js",
|
|
19
|
+
"module": "./nuxt.js",
|
|
20
20
|
"files": [
|
|
21
21
|
"app/components/*.vue",
|
|
22
22
|
"app/utils/*",
|
|
@@ -43,20 +43,20 @@
|
|
|
43
43
|
"daisyui": "^5"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@floating-ui/vue": "^1.1.6",
|
|
47
46
|
"@nuxt/content": "3.5.1",
|
|
48
47
|
"@nuxt/eslint": "1.3.0",
|
|
49
48
|
"@nuxt/fonts": "0.11.2",
|
|
50
49
|
"@nuxt/icon": "1.12.0",
|
|
51
50
|
"@nuxt/image": "1.10.0",
|
|
52
|
-
"@nuxt/kit": "^
|
|
51
|
+
"@nuxt/kit": "^4.2.1",
|
|
53
52
|
"@nuxt/scripts": "0.11.6",
|
|
54
53
|
"@nuxt/test-utils": "3.18.0",
|
|
54
|
+
"@oddbird/css-anchor-positioning": "^0.7.0",
|
|
55
55
|
"@unhead/vue": "^2.0.8",
|
|
56
56
|
"@vueuse/core": "^13.1.0",
|
|
57
57
|
"@vueuse/integrations": "^13.1.0",
|
|
58
58
|
"focus-trap": "^7.6.4",
|
|
59
|
-
"nuxt": "^
|
|
59
|
+
"nuxt": "^4.2.1",
|
|
60
60
|
"pikaday": "^1.8.2",
|
|
61
61
|
"shiki": "^3.3.0",
|
|
62
62
|
"typescript": "^5.8.3",
|
|
@@ -70,8 +70,10 @@
|
|
|
70
70
|
"@tailwindcss/typography": "^0.5.16",
|
|
71
71
|
"@tailwindcss/vite": "^4.1.5",
|
|
72
72
|
"@types/pikaday": "^1.7.9",
|
|
73
|
-
"daisyui": "^5.
|
|
73
|
+
"daisyui": "^5.5.5",
|
|
74
74
|
"eslint": "^9.26.0",
|
|
75
|
+
"eslint-config-prettier": "^10.1.8",
|
|
76
|
+
"eslint-plugin-vue": "^10.5.1",
|
|
75
77
|
"tailwindcss": "^4.1.5"
|
|
76
78
|
}
|
|
77
79
|
}
|