daisy-ui-kit 5.0.0-pre.5 → 5.0.0-pre.6
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 +26 -0
- package/app/components/Alert.vue +35 -0
- package/app/components/Avatar.vue +128 -0
- package/app/components/AvatarGroup.vue +18 -0
- package/app/components/Badge.vue +54 -0
- package/app/components/Breadcrumbs.vue +7 -0
- package/app/components/Button.vue +113 -0
- package/app/components/Calendar.vue +66 -0
- package/app/components/CalendarInput.vue +176 -0
- package/app/components/CalendarSkeleton.vue +46 -0
- package/app/components/Card.vue +33 -0
- package/app/components/CardActions.vue +13 -0
- package/app/components/CardBody.vue +13 -0
- package/app/components/CardTitle.vue +11 -0
- package/app/components/Carousel.vue +23 -0
- package/app/components/CarouselItem.vue +5 -0
- package/app/components/Chat.vue +21 -0
- package/app/components/ChatBubble.vue +31 -0
- package/app/components/ChatFooter.vue +5 -0
- package/app/components/ChatHeader.vue +5 -0
- package/app/components/ChatImage.vue +5 -0
- package/app/components/Checkbox.vue +49 -0
- package/app/components/Collapse.vue +43 -0
- package/app/components/CollapseContent.vue +5 -0
- package/app/components/CollapseTitle.vue +5 -0
- package/app/components/Countdown.vue +15 -0
- package/app/components/CountdownTimers.vue +72 -0
- package/app/components/Counter.vue +10 -0
- package/app/components/Crumb.vue +5 -0
- package/app/components/DaisyLink.vue +38 -0
- package/app/components/Diff.vue +11 -0
- package/app/components/Divider.vue +43 -0
- package/app/components/Dock.vue +58 -0
- package/app/components/DockItem.vue +25 -0
- package/app/components/DockLabel.vue +5 -0
- package/app/components/Drawer.vue +47 -0
- package/app/components/DrawerContent.vue +17 -0
- package/app/components/DrawerSide.vue +18 -0
- package/app/components/Dropdown.vue +95 -0
- package/app/components/DropdownButton.vue +16 -0
- package/app/components/DropdownContent.vue +57 -0
- package/app/components/DropdownTarget.vue +14 -0
- package/app/components/Fieldset.vue +19 -0
- package/app/components/FileInput.vue +53 -0
- package/app/components/Filter.vue +122 -0
- package/app/components/Flex.vue +82 -0
- package/app/components/FlexItem.vue +59 -0
- package/app/components/Footer.vue +27 -0
- package/app/components/FooterTitle.vue +15 -0
- package/app/components/FormControl.vue +5 -0
- package/app/components/Hero.vue +15 -0
- package/app/components/HeroContent.vue +15 -0
- package/app/components/HeroOverlay.vue +5 -0
- package/app/components/Indicator.vue +13 -0
- package/app/components/IndicatorItem.vue +36 -0
- package/app/components/Input.vue +102 -0
- package/app/components/Join.vue +5 -0
- package/app/components/Kbd.vue +24 -0
- package/app/components/Label.vue +61 -0
- package/app/components/List.vue +5 -0
- package/app/components/ListColGrow.vue +5 -0
- package/app/components/ListColWrap.vue +5 -0
- package/app/components/ListRow.vue +5 -0
- package/app/components/LoadingBall.vue +42 -0
- package/app/components/LoadingBars.vue +42 -0
- package/app/components/LoadingDots.vue +42 -0
- package/app/components/LoadingInfinity.vue +42 -0
- package/app/components/LoadingRing.vue +42 -0
- package/app/components/LoadingSpinner.vue +42 -0
- package/app/components/Mask.vue +49 -0
- package/app/components/Menu.vue +30 -0
- package/app/components/MenuExpand.vue +100 -0
- package/app/components/MenuExpandToggle.vue +14 -0
- package/app/components/MenuItem.vue +37 -0
- package/app/components/MenuTitle.vue +5 -0
- package/app/components/MockupBrowser.vue +5 -0
- package/app/components/MockupBrowserToolbar.vue +5 -0
- package/app/components/MockupCode.vue +4 -0
- package/app/components/MockupPhone.vue +8 -0
- package/app/components/MockupWindow.vue +5 -0
- package/app/components/Modal.vue +57 -0
- package/app/components/ModalAction.vue +5 -0
- package/app/components/ModalBox.vue +5 -0
- package/app/components/NavButton.vue +12 -0
- package/app/components/Navbar.vue +12 -0
- package/app/components/NavbarCenter.vue +11 -0
- package/app/components/NavbarEnd.vue +11 -0
- package/app/components/NavbarStart.vue +11 -0
- package/app/components/Progress.vue +34 -0
- package/app/components/Prose.vue +32 -0
- package/app/components/RadialProgress.vue +36 -0
- package/app/components/Radio.vue +67 -0
- package/app/components/RadioGroup.vue +47 -0
- package/app/components/Range.vue +61 -0
- package/app/components/RangeMeasure.vue +84 -0
- package/app/components/RangeMeasureTick.vue +70 -0
- package/app/components/Rating.vue +180 -0
- package/app/components/Select.vue +104 -0
- package/app/components/Skeleton.vue +5 -0
- package/app/components/Stack.vue +25 -0
- package/app/components/Stat.vue +19 -0
- package/app/components/StatActions.vue +5 -0
- package/app/components/StatDesc.vue +5 -0
- package/app/components/StatFigure.vue +5 -0
- package/app/components/StatTitle.vue +5 -0
- package/app/components/StatValue.vue +5 -0
- package/app/components/Stats.vue +5 -0
- package/app/components/Status.vue +43 -0
- package/app/components/Step.vue +34 -0
- package/app/components/StepIcon.vue +5 -0
- package/app/components/Steps.vue +18 -0
- package/app/components/Swap.vue +62 -0
- package/app/components/Tab.vue +38 -0
- package/app/components/TabContent.vue +29 -0
- package/app/components/Table.vue +32 -0
- package/app/components/Tabs.vue +53 -0
- package/app/components/Text.vue +142 -0
- package/app/components/TextArea.vue +61 -0
- package/app/components/Timeline.vue +22 -0
- package/app/components/TimelineEnd.vue +14 -0
- package/app/components/TimelineItem.vue +5 -0
- package/app/components/TimelineLine.vue +29 -0
- package/app/components/TimelineMiddle.vue +5 -0
- package/app/components/TimelineStart.vue +13 -0
- package/app/components/Toast.vue +29 -0
- package/app/components/Toggle.vue +58 -0
- package/app/components/Tooltip.vue +47 -0
- package/app/components/TooltipContent.vue +5 -0
- package/app/components/ValidatorHint.vue +5 -0
- package/app/utils/drawer-utils.ts +32 -0
- package/app/utils/random-string.ts +19 -0
- package/package.json +4 -4
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { is = 'div', ...props } = defineProps<{
|
|
3
|
+
is?: any
|
|
4
|
+
border?: boolean
|
|
5
|
+
dash?: boolean
|
|
6
|
+
side?: boolean
|
|
7
|
+
imageFull?: boolean
|
|
8
|
+
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
9
|
+
xl?: boolean
|
|
10
|
+
lg?: boolean
|
|
11
|
+
md?: boolean
|
|
12
|
+
sm?: boolean
|
|
13
|
+
xs?: boolean
|
|
14
|
+
}>()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<component
|
|
19
|
+
:is="is" class="card" :class="{
|
|
20
|
+
'card-border': props.border,
|
|
21
|
+
'card-side': props.side,
|
|
22
|
+
'image-full': props.imageFull,
|
|
23
|
+
|
|
24
|
+
'card-xl': props.xl || props.size === 'xl',
|
|
25
|
+
'card-lg': props.lg || props.size === 'lg',
|
|
26
|
+
'card-md': props.md || props.size === 'md',
|
|
27
|
+
'card-sm': props.sm || props.size === 'sm',
|
|
28
|
+
'card-xs': props.xs || props.size === 'xs',
|
|
29
|
+
}"
|
|
30
|
+
>
|
|
31
|
+
<slot />
|
|
32
|
+
</component>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { snapTo, center, end, vertical } = defineProps<{
|
|
3
|
+
snapTo?: 'center' | 'end'
|
|
4
|
+
center?: boolean
|
|
5
|
+
end?: boolean
|
|
6
|
+
orientation?: 'horizontal' | 'vertical'
|
|
7
|
+
horizontal?: boolean
|
|
8
|
+
vertical?: boolean
|
|
9
|
+
}>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div
|
|
14
|
+
class="carousel" :class="{
|
|
15
|
+
'carousel-center': center || snapTo === 'center',
|
|
16
|
+
'carousel-end': end || snapTo === 'end',
|
|
17
|
+
'carousel-horizontal': horizontal || orientation === 'horizontal',
|
|
18
|
+
'carousel-vertical': vertical || orientation === 'vertical',
|
|
19
|
+
}"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { pre, align = 'start', start, end } = defineProps<{
|
|
3
|
+
pre?: boolean
|
|
4
|
+
align?: string
|
|
5
|
+
start?: boolean
|
|
6
|
+
end?: boolean
|
|
7
|
+
}>()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div
|
|
12
|
+
class="chat"
|
|
13
|
+
:class="{
|
|
14
|
+
'chat-start': start || (!end && align === 'start'),
|
|
15
|
+
'chat-end': end || align === 'end',
|
|
16
|
+
'whitespace-pre': pre,
|
|
17
|
+
}"
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { color, neutral, primary, secondary, accent, info, success, warning, error } = defineProps<{
|
|
3
|
+
color?: string
|
|
4
|
+
neutral?: boolean
|
|
5
|
+
primary?: boolean
|
|
6
|
+
secondary?: boolean
|
|
7
|
+
accent?: boolean
|
|
8
|
+
info?: boolean
|
|
9
|
+
success?: boolean
|
|
10
|
+
warning?: boolean
|
|
11
|
+
error?: boolean
|
|
12
|
+
}>()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div
|
|
17
|
+
class="chat-bubble"
|
|
18
|
+
:class="{
|
|
19
|
+
'chat-bubble-neutral': neutral || color === 'neutral',
|
|
20
|
+
'chat-bubble-primary': primary || color === 'primary',
|
|
21
|
+
'chat-bubble-secondary': secondary || color === 'secondary',
|
|
22
|
+
'chat-bubble-accent': accent || color === 'accent',
|
|
23
|
+
'chat-bubble-info': info || color === 'info',
|
|
24
|
+
'chat-bubble-success': success || color === 'success',
|
|
25
|
+
'chat-bubble-warning': warning || color === 'warning',
|
|
26
|
+
'chat-bubble-error': error || color === 'error',
|
|
27
|
+
}"
|
|
28
|
+
>
|
|
29
|
+
<slot />
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
modelValue?: any
|
|
6
|
+
|
|
7
|
+
color?: string
|
|
8
|
+
primary?: boolean
|
|
9
|
+
secondary?: boolean
|
|
10
|
+
accent?: boolean
|
|
11
|
+
success?: boolean
|
|
12
|
+
warning?: boolean
|
|
13
|
+
info?: boolean
|
|
14
|
+
error?: boolean
|
|
15
|
+
|
|
16
|
+
size?: string
|
|
17
|
+
lg?: boolean
|
|
18
|
+
md?: boolean
|
|
19
|
+
sm?: boolean
|
|
20
|
+
xs?: boolean
|
|
21
|
+
}>()
|
|
22
|
+
const emit = defineEmits(['update:modelValue'])
|
|
23
|
+
|
|
24
|
+
const currentValue = computed({
|
|
25
|
+
get: () => props.modelValue,
|
|
26
|
+
set: (val: string) => emit('update:modelValue', val),
|
|
27
|
+
})
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<input
|
|
32
|
+
v-model="currentValue"
|
|
33
|
+
type="checkbox"
|
|
34
|
+
class="checkbox"
|
|
35
|
+
:class="{
|
|
36
|
+
'checkbox-primary': primary || color === 'primary',
|
|
37
|
+
'checkbox-secondary': secondary || color === 'secondary',
|
|
38
|
+
'checkbox-accent': accent || color === 'accent',
|
|
39
|
+
'checkbox-success': success || color === 'success',
|
|
40
|
+
'checkbox-warning': warning || color === 'warning',
|
|
41
|
+
'checkbox-info': info || color === 'info',
|
|
42
|
+
'checkbox-error': error || color === 'error',
|
|
43
|
+
'checkbox-xs': xs || size === 'xs',
|
|
44
|
+
'checkbox-sm': sm || size === 'sm',
|
|
45
|
+
'checkbox-md': md || size === 'md',
|
|
46
|
+
'checkbox-lg': lg || size === 'lg',
|
|
47
|
+
}"
|
|
48
|
+
>
|
|
49
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inject, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
variant?: 'arrow' | 'plus'
|
|
6
|
+
arrow?: boolean
|
|
7
|
+
plus?: boolean
|
|
8
|
+
open?: boolean
|
|
9
|
+
close?: boolean
|
|
10
|
+
toggle?: boolean
|
|
11
|
+
value?: any
|
|
12
|
+
}>()
|
|
13
|
+
|
|
14
|
+
const accordionValue = inject('accordion-value', ref(null))
|
|
15
|
+
const useAccordion = accordionValue.value !== null
|
|
16
|
+
|
|
17
|
+
function handleClick() {
|
|
18
|
+
if (useAccordion) {
|
|
19
|
+
accordionValue.value = props.value
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<div
|
|
26
|
+
tabindex="0"
|
|
27
|
+
class="collapse"
|
|
28
|
+
:class="[
|
|
29
|
+
{ 'collapse-arrow': props.arrow || props.variant === 'arrow' },
|
|
30
|
+
{ 'collapse-plus': props.plus || props.variant === 'plus' },
|
|
31
|
+
{ 'collapse-open': (props.open && !props.close) || (useAccordion && accordionValue === props.value) },
|
|
32
|
+
{ 'collapse-close': props.close },
|
|
33
|
+
]"
|
|
34
|
+
@click="handleClick"
|
|
35
|
+
>
|
|
36
|
+
<input
|
|
37
|
+
v-if="props.toggle || useAccordion"
|
|
38
|
+
:type="useAccordion ? 'radio' : 'checkbox'"
|
|
39
|
+
:checked="useAccordion ? accordionValue === props.value : undefined"
|
|
40
|
+
>
|
|
41
|
+
<slot />
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const { is = 'span' } = defineProps<{
|
|
5
|
+
is?: any
|
|
6
|
+
}>()
|
|
7
|
+
|
|
8
|
+
const tag = computed(() => is)
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<component :is="tag" class="countdown">
|
|
13
|
+
<slot />
|
|
14
|
+
</component>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useIntervalFn } from '@vueuse/core';
|
|
3
|
+
import { computed, ref, watch } from 'vue';
|
|
4
|
+
|
|
5
|
+
const { durationInSeconds = 0, untilDate } = defineProps<{
|
|
6
|
+
durationInSeconds?: number
|
|
7
|
+
untilDate?: Date
|
|
8
|
+
}>()
|
|
9
|
+
const emit = defineEmits(['done'])
|
|
10
|
+
|
|
11
|
+
function getTargetDate() {
|
|
12
|
+
return untilDate || new Date(Date.now() + durationInSeconds * 1000)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const targetDate = ref(getTargetDate())
|
|
16
|
+
|
|
17
|
+
watch(
|
|
18
|
+
() => [durationInSeconds, untilDate],
|
|
19
|
+
() => {
|
|
20
|
+
targetDate.value = getTargetDate()
|
|
21
|
+
},
|
|
22
|
+
{ immediate: true },
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const timeLeft = ref(0)
|
|
26
|
+
const calcTimeLeft = () => Math.max(0, targetDate.value.getTime() - Date.now())
|
|
27
|
+
|
|
28
|
+
useIntervalFn(() => {
|
|
29
|
+
timeLeft.value = calcTimeLeft()
|
|
30
|
+
}, 1000)
|
|
31
|
+
|
|
32
|
+
watch(timeLeft, (val) => {
|
|
33
|
+
if (val === 0) {
|
|
34
|
+
emit('done')
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const totalSeconds = computed(() => Math.round(timeLeft.value / 1000))
|
|
39
|
+
const totalMinutes = computed(() => Math.floor(totalSeconds.value / 60))
|
|
40
|
+
const totalHours = computed(() => Math.floor(totalMinutes.value / 60))
|
|
41
|
+
const totalDays = computed(() => Math.floor(totalHours.value / 24))
|
|
42
|
+
const totalWeeks = computed(() => Math.floor(totalDays.value / 7))
|
|
43
|
+
const totalMonths = computed(() => {
|
|
44
|
+
const now = new Date()
|
|
45
|
+
return (
|
|
46
|
+
(targetDate.value.getFullYear() - now.getFullYear()) * 12
|
|
47
|
+
+ (targetDate.value.getMonth() - now.getMonth())
|
|
48
|
+
)
|
|
49
|
+
})
|
|
50
|
+
const split = computed(() => {
|
|
51
|
+
const days = totalDays.value
|
|
52
|
+
const hours = totalHours.value - days * 24
|
|
53
|
+
const minutes = totalMinutes.value - totalHours.value * 60
|
|
54
|
+
const seconds = totalSeconds.value - totalMinutes.value * 60
|
|
55
|
+
return { days, hours, minutes, seconds }
|
|
56
|
+
})
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<slot
|
|
61
|
+
v-bind="{
|
|
62
|
+
totalSeconds,
|
|
63
|
+
totalMinutes,
|
|
64
|
+
totalHours,
|
|
65
|
+
totalDays,
|
|
66
|
+
totalWeeks,
|
|
67
|
+
totalMonths,
|
|
68
|
+
targetDate,
|
|
69
|
+
split,
|
|
70
|
+
}"
|
|
71
|
+
/>
|
|
72
|
+
</template>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
withDefaults(defineProps<{
|
|
3
|
+
is?: string
|
|
4
|
+
hover?: boolean
|
|
5
|
+
|
|
6
|
+
color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'success' | 'info' | 'warning' | 'error'
|
|
7
|
+
neutral?: boolean
|
|
8
|
+
primary?: boolean
|
|
9
|
+
secondary?: boolean
|
|
10
|
+
accent?: boolean
|
|
11
|
+
success?: boolean
|
|
12
|
+
info?: boolean
|
|
13
|
+
warning?: boolean
|
|
14
|
+
error?: boolean
|
|
15
|
+
}>(), {
|
|
16
|
+
is: 'a',
|
|
17
|
+
})
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<component
|
|
22
|
+
:is="is"
|
|
23
|
+
class="link"
|
|
24
|
+
:class="{
|
|
25
|
+
'link-neutral': neutral || color === 'neutral',
|
|
26
|
+
'link-primary': primary || color === 'primary',
|
|
27
|
+
'link-secondary': secondary || color === 'secondary',
|
|
28
|
+
'link-accent': accent || color === 'accent',
|
|
29
|
+
'link-success': success || color === 'success',
|
|
30
|
+
'link-info': info || color === 'info',
|
|
31
|
+
'link-warning': warning || color === 'warning',
|
|
32
|
+
'link-error': error || color === 'error',
|
|
33
|
+
'link-hover': hover,
|
|
34
|
+
}"
|
|
35
|
+
>
|
|
36
|
+
<slot />
|
|
37
|
+
</component>
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<figure class="diff" tabindex="0">
|
|
3
|
+
<div class="diff-item-1" role="img" tabindex="0">
|
|
4
|
+
<slot name="one" />
|
|
5
|
+
</div>
|
|
6
|
+
<div class="diff-item-2" role="img">
|
|
7
|
+
<slot name="two" />
|
|
8
|
+
</div>
|
|
9
|
+
<div class="diff-resizer" />
|
|
10
|
+
</figure>
|
|
11
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
orientation?: 'horizontal' | 'vertical'
|
|
4
|
+
horizontal?: boolean
|
|
5
|
+
vertical?: boolean
|
|
6
|
+
align?: 'center' | 'start' | 'end'
|
|
7
|
+
center?: boolean
|
|
8
|
+
start?: boolean
|
|
9
|
+
end?: boolean
|
|
10
|
+
color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'info' | 'error'
|
|
11
|
+
neutral?: boolean
|
|
12
|
+
primary?: boolean
|
|
13
|
+
secondary?: boolean
|
|
14
|
+
accent?: boolean
|
|
15
|
+
success?: boolean
|
|
16
|
+
warning?: boolean
|
|
17
|
+
info?: boolean
|
|
18
|
+
error?: boolean
|
|
19
|
+
}>()
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<div
|
|
24
|
+
class="divider"
|
|
25
|
+
:class="{
|
|
26
|
+
'divider-vertical': orientation === 'vertical' || vertical,
|
|
27
|
+
'divider-horizontal': orientation !== 'vertical' || horizontal,
|
|
28
|
+
'divider-neutral': color === 'neutral' || neutral,
|
|
29
|
+
'divider-primary': color === 'primary' || primary,
|
|
30
|
+
'divider-secondary': color === 'secondary' || secondary,
|
|
31
|
+
'divider-accent': color === 'accent' || accent,
|
|
32
|
+
'divider-success': color === 'success' || success,
|
|
33
|
+
'divider-warning': color === 'warning' || warning,
|
|
34
|
+
'divider-info': color === 'info' || info,
|
|
35
|
+
'divider-error': color === 'error' || error,
|
|
36
|
+
'divider-start': align === 'start' || start,
|
|
37
|
+
'divider-center': align === 'center' || center,
|
|
38
|
+
'divider-end': align === 'end' || end,
|
|
39
|
+
}"
|
|
40
|
+
>
|
|
41
|
+
<slot />
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { randomString } from '../utils/random-string';
|
|
3
|
+
|
|
4
|
+
const { size, xl, lg, md, sm, xs } = defineProps<{
|
|
5
|
+
size?: string
|
|
6
|
+
xl?: boolean
|
|
7
|
+
lg?: boolean
|
|
8
|
+
md?: boolean
|
|
9
|
+
sm?: boolean
|
|
10
|
+
xs?: boolean
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const activeItemId = ref<string | null>(null)
|
|
14
|
+
const itemIds = ref<string[]>([])
|
|
15
|
+
|
|
16
|
+
function registerItem() {
|
|
17
|
+
const itemId = randomString()
|
|
18
|
+
itemIds.value.push(itemId)
|
|
19
|
+
function unregister() {
|
|
20
|
+
itemIds.value = itemIds.value.filter(id => id !== itemId)
|
|
21
|
+
if (activeItemId.value === itemId) {
|
|
22
|
+
activeItemId.value = null
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return { id: itemId, unregister }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function setActiveItemId(itemId: string) {
|
|
29
|
+
activeItemId.value = itemId
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface DockState {
|
|
33
|
+
activeItemId: Ref<string | null>
|
|
34
|
+
registerItem: () => { id: string, unregister: () => void }
|
|
35
|
+
setActiveItemId: (itemId: string) => void
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
provide<DockState>('dockState', {
|
|
39
|
+
activeItemId,
|
|
40
|
+
registerItem,
|
|
41
|
+
setActiveItemId,
|
|
42
|
+
})
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<div
|
|
47
|
+
class="dock"
|
|
48
|
+
:class="{
|
|
49
|
+
'dock-xl': xl || size === 'xl',
|
|
50
|
+
'dock-lg': lg || size === 'lg',
|
|
51
|
+
'dock-md': md || size === 'md',
|
|
52
|
+
'dock-sm': sm || size === 'sm',
|
|
53
|
+
'dock-xs': xs || size === 'xs',
|
|
54
|
+
}"
|
|
55
|
+
>
|
|
56
|
+
<slot />
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DockState } from './Dock.vue';
|
|
3
|
+
|
|
4
|
+
const { active } = defineProps<{
|
|
5
|
+
active?: boolean
|
|
6
|
+
}>()
|
|
7
|
+
|
|
8
|
+
const { registerItem, setActiveItemId, activeItemId } = inject<DockState>('dockState')!
|
|
9
|
+
const { id: itemId, unregister } = registerItem()
|
|
10
|
+
|
|
11
|
+
onUnmounted(() => {
|
|
12
|
+
unregister()
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div
|
|
18
|
+
:id="`dock-item-${itemId}`"
|
|
19
|
+
class="dock-item"
|
|
20
|
+
:class="{ 'dock-active': active || (activeItemId === itemId) }"
|
|
21
|
+
@click="setActiveItemId(itemId)"
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, watch } from 'vue';
|
|
3
|
+
import { createDrawerState } from '../utils/drawer-utils';
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
open?: boolean
|
|
7
|
+
name?: string
|
|
8
|
+
end?: boolean
|
|
9
|
+
}>(), {
|
|
10
|
+
name: 'drawer',
|
|
11
|
+
})
|
|
12
|
+
const emit = defineEmits(['update:open'])
|
|
13
|
+
|
|
14
|
+
// sync `open` prop with drawerState.isDrawerOpen
|
|
15
|
+
const drawerState = createDrawerState(props.name)
|
|
16
|
+
watch(
|
|
17
|
+
() => props.open,
|
|
18
|
+
(value) => {
|
|
19
|
+
if (drawerState.isDrawerOpen !== value) {
|
|
20
|
+
drawerState.isDrawerOpen = value
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{ immediate: true },
|
|
24
|
+
)
|
|
25
|
+
watch(
|
|
26
|
+
() => drawerState.isDrawerOpen,
|
|
27
|
+
(value) => {
|
|
28
|
+
if (props.open !== value) {
|
|
29
|
+
emit('update:open', value)
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{ immediate: true },
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
const classes = computed(() => {
|
|
36
|
+
return {
|
|
37
|
+
'drawer-end': props.end,
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<div class="drawer" :class="classes">
|
|
44
|
+
<input :id="name" v-model="drawerState.isDrawerOpen" type="checkbox" class="drawer-toggle">
|
|
45
|
+
<slot v-bind="drawerState" />
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { createDrawerState } from '../utils/drawer-utils';
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
name?: string
|
|
6
|
+
}>(), {
|
|
7
|
+
name: 'drawer',
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const drawerState = createDrawerState(props.name)
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div class="drawer-content">
|
|
15
|
+
<slot v-bind="drawerState" />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { createDrawerState } from '../utils/drawer-utils';
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
name?: string
|
|
6
|
+
}>(), {
|
|
7
|
+
name: 'drawer',
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const drawerState = createDrawerState(props.name)
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div class="drawer-side">
|
|
15
|
+
<div class="drawer-overlay" @click="() => drawerState?.closeDrawer()" />
|
|
16
|
+
<slot v-bind="drawerState" />
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|