daisy-ui-kit 3.0.12 → 5.0.0-pre.4
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/README.md +62 -14
- package/package.json +41 -61
- package/components/Accordion.vue +0 -29
- package/components/Alert.vue +0 -25
- package/components/Artboard.vue +0 -33
- package/components/Avatar.vue +0 -70
- package/components/AvatarGroup.vue +0 -19
- package/components/Badge.vue +0 -50
- package/components/BottomNav.vue +0 -25
- package/components/Breadcrumbs.vue +0 -7
- package/components/Button.vue +0 -111
- package/components/Card.vue +0 -30
- package/components/CardActions.vue +0 -16
- package/components/CardBody.vue +0 -16
- package/components/CardTitle.vue +0 -16
- package/components/Carousel.vue +0 -25
- package/components/CarouselItem.vue +0 -5
- package/components/Chat.vue +0 -27
- package/components/ChatBubble.vue +0 -34
- package/components/ChatFooter.vue +0 -5
- package/components/ChatHeader.vue +0 -5
- package/components/ChatImage.vue +0 -5
- package/components/Checkbox.vue +0 -55
- package/components/Code.vue +0 -92
- package/components/Collapse.vue +0 -54
- package/components/CollapseContent.vue +0 -5
- package/components/CollapseTitle.vue +0 -5
- package/components/Countdown.vue +0 -15
- package/components/CountdownTimers.vue +0 -70
- package/components/Counter.vue +0 -14
- package/components/Crumb.vue +0 -5
- package/components/Divider.vue +0 -24
- package/components/Drawer.vue +0 -45
- package/components/DrawerContent.vue +0 -17
- package/components/DrawerSide.vue +0 -18
- package/components/Dropdown.vue +0 -95
- package/components/DropdownButton.vue +0 -16
- package/components/DropdownContent.vue +0 -56
- package/components/DropdownTarget.vue +0 -14
- package/components/FileInput.vue +0 -59
- package/components/Flex.vue +0 -59
- package/components/FlexItem.vue +0 -59
- package/components/Footer.vue +0 -24
- package/components/FooterTitle.vue +0 -15
- package/components/FormControl.vue +0 -5
- package/components/Hero.vue +0 -15
- package/components/HeroContent.vue +0 -15
- package/components/HeroOverlay.vue +0 -5
- package/components/Indicator.vue +0 -13
- package/components/IndicatorItem.vue +0 -36
- package/components/Join.vue +0 -5
- package/components/Kbd.vue +0 -25
- package/components/Label.vue +0 -15
- package/components/LabelText.vue +0 -15
- package/components/LabelTextAlt.vue +0 -15
- package/components/Link.vue +0 -40
- package/components/LoadingBall.vue +0 -43
- package/components/LoadingBars.vue +0 -43
- package/components/LoadingDots.vue +0 -43
- package/components/LoadingInfinity.vue +0 -43
- package/components/LoadingRing.vue +0 -43
- package/components/LoadingSpinner.vue +0 -43
- package/components/Mask.config.ts +0 -77
- package/components/Mask.vue +0 -14
- package/components/Menu.vue +0 -35
- package/components/MenuExpand.vue +0 -79
- package/components/MenuExpandToggle.vue +0 -13
- package/components/MenuItem.vue +0 -38
- package/components/MenuTitle.vue +0 -5
- package/components/MockupBrowser.vue +0 -5
- package/components/MockupBrowserToolbar.vue +0 -5
- package/components/MockupCode.vue +0 -4
- package/components/MockupPhone.vue +0 -8
- package/components/MockupWindow.vue +0 -5
- package/components/Modal.vue +0 -48
- package/components/ModalAction.vue +0 -5
- package/components/ModalBox.vue +0 -5
- package/components/NavButton.vue +0 -20
- package/components/Navbar.vue +0 -14
- package/components/NavbarCenter.vue +0 -13
- package/components/NavbarEnd.vue +0 -13
- package/components/NavbarStart.vue +0 -13
- package/components/Progress.vue +0 -42
- package/components/Prose.vue +0 -32
- package/components/RadialProgress.vue +0 -41
- package/components/Radio.vue +0 -76
- package/components/RadioGroup.vue +0 -46
- package/components/Range.vue +0 -60
- package/components/RangeMeasure.vue +0 -83
- package/components/RangeMeasureTick.vue +0 -74
- package/components/Rating.vue +0 -167
- package/components/Select.vue +0 -100
- package/components/Stack.vue +0 -13
- package/components/Stat.vue +0 -5
- package/components/StatActions.vue +0 -5
- package/components/StatDesc.vue +0 -5
- package/components/StatFigure.vue +0 -5
- package/components/StatTitle.vue +0 -5
- package/components/StatValue.vue +0 -5
- package/components/Stats.vue +0 -5
- package/components/Step.vue +0 -36
- package/components/Steps.vue +0 -21
- package/components/Swap.vue +0 -58
- package/components/Tab.vue +0 -48
- package/components/TabContent.vue +0 -29
- package/components/Tabs.vue +0 -77
- package/components/TabsManager.vue +0 -38
- package/components/Text.vue +0 -142
- package/components/TextArea.vue +0 -64
- package/components/TextInput.vue +0 -66
- package/components/Toast.vue +0 -31
- package/components/Toggle.vue +0 -59
- package/components/Tooltip.vue +0 -47
- package/index.ts +0 -108
- package/nuxt.js +0 -22
- package/utils/-utils.ts +0 -41
- package/utils/Button.config.ts +0 -26
- package/utils/drawer-utils.ts +0 -32
- package/utils/fixtures.ts +0 -62
- package/utils/random-string.ts +0 -19
- package/utils/types.ts +0 -7
package/components/Carousel.vue
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
|
|
4
|
-
const props = defineProps<{
|
|
5
|
-
snapTo?: 'center' | 'end'
|
|
6
|
-
center?: boolean
|
|
7
|
-
end?: boolean
|
|
8
|
-
vertical?: boolean
|
|
9
|
-
}>()
|
|
10
|
-
|
|
11
|
-
const classes = computed(() => {
|
|
12
|
-
const { snapTo, center, end, vertical } = props
|
|
13
|
-
return {
|
|
14
|
-
'carousel-center': center || snapTo === 'center',
|
|
15
|
-
'carousel-end': end || snapTo === 'end',
|
|
16
|
-
'carousel-vertical': vertical,
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<template>
|
|
22
|
-
<div class="carousel" :class="classes">
|
|
23
|
-
<slot />
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
package/components/Chat.vue
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
|
|
4
|
-
const props = withDefaults(defineProps<{
|
|
5
|
-
pre?: boolean
|
|
6
|
-
align?: string
|
|
7
|
-
start?: boolean
|
|
8
|
-
end?: boolean
|
|
9
|
-
}>(), {
|
|
10
|
-
align: 'start',
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const classes = computed(() => {
|
|
14
|
-
const { align, start, end } = props
|
|
15
|
-
return {
|
|
16
|
-
'chat-start': start || (!end && align === 'start'),
|
|
17
|
-
'chat-end': end || align === 'end',
|
|
18
|
-
'whitespace-pre': props.pre,
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
<div class="chat" :class="classes">
|
|
25
|
-
<slot />
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
|
|
4
|
-
const props = defineProps<{
|
|
5
|
-
color?: string
|
|
6
|
-
neutral?: boolean
|
|
7
|
-
primary?: boolean
|
|
8
|
-
secondary?: boolean
|
|
9
|
-
accent?: boolean
|
|
10
|
-
info?: boolean
|
|
11
|
-
success?: boolean
|
|
12
|
-
warning?: boolean
|
|
13
|
-
error?: boolean
|
|
14
|
-
}>()
|
|
15
|
-
|
|
16
|
-
const classes = computed(() => {
|
|
17
|
-
return {
|
|
18
|
-
'badge-neutral': props.neutral || props.color === 'neutral',
|
|
19
|
-
'badge-primary': props.primary || props.color === 'primary',
|
|
20
|
-
'badge-secondary': props.secondary || props.color === 'secondary',
|
|
21
|
-
'badge-accent': props.accent || props.color === 'accent',
|
|
22
|
-
'badge-info': props.info || props.color === 'info',
|
|
23
|
-
'badge-success': props.success || props.color === 'success',
|
|
24
|
-
'badge-warning': props.warning || props.color === 'warning',
|
|
25
|
-
'badge-error': props.error || props.color === 'error',
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<template>
|
|
31
|
-
<div class="chat-bubble" :class="classes">
|
|
32
|
-
<slot />
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
package/components/ChatImage.vue
DELETED
package/components/Checkbox.vue
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
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 classes = computed(() => {
|
|
25
|
-
const { color, primary, secondary, accent, success, warning, info, error, size, xs, sm, md, lg } = props
|
|
26
|
-
return {
|
|
27
|
-
'checkbox-primary': primary || color === 'primary',
|
|
28
|
-
'checkbox-secondary': secondary || color === 'secondary',
|
|
29
|
-
'checkbox-accent': accent || color === 'accent',
|
|
30
|
-
'checkbox-success': success || color === 'success',
|
|
31
|
-
'checkbox-warning': warning || color === 'warning',
|
|
32
|
-
'checkbox-info': info || color === 'info',
|
|
33
|
-
'checkbox-error': error || color === 'error',
|
|
34
|
-
'checkbox-xs': xs || size === 'xs',
|
|
35
|
-
'checkbox-sm': sm || size === 'sm',
|
|
36
|
-
'checkbox-md': md || size === 'md',
|
|
37
|
-
'checkbox-lg': lg || size === 'lg',
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
const currentValue = computed({
|
|
42
|
-
get: () => props.modelValue,
|
|
43
|
-
set: (val: string) => emit('update:modelValue', val),
|
|
44
|
-
})
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
|
-
<template>
|
|
48
|
-
<input
|
|
49
|
-
v-model="currentValue"
|
|
50
|
-
type="checkbox"
|
|
51
|
-
v-bind="$attrs"
|
|
52
|
-
class="checkbox"
|
|
53
|
-
:class="classes"
|
|
54
|
-
>
|
|
55
|
-
</template>
|
package/components/Code.vue
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { computed, onBeforeUpdate, onMounted, ref } from 'vue'
|
|
3
|
-
import Prism from 'prismjs'
|
|
4
|
-
import 'prismjs/themes/prism-okaidia.css'
|
|
5
|
-
import { useClipboard } from '@vueuse/core'
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
name: 'Code',
|
|
9
|
-
props: {
|
|
10
|
-
language: {
|
|
11
|
-
type: String,
|
|
12
|
-
default: 'javascript',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
setup(props, context) {
|
|
16
|
-
const nuxtApp = useNuxtApp()
|
|
17
|
-
|
|
18
|
-
const source = ref(null)
|
|
19
|
-
const lang = computed(() => {
|
|
20
|
-
if (props.language === 'vue')
|
|
21
|
-
return 'html'
|
|
22
|
-
else return props.language
|
|
23
|
-
})
|
|
24
|
-
const languageClass = computed(() => `language-${lang.value}`)
|
|
25
|
-
const { text, copy, copied, isSupported } = useClipboard({ source })
|
|
26
|
-
|
|
27
|
-
onMounted(() => {
|
|
28
|
-
if (!nuxtApp.ssrContext) {
|
|
29
|
-
setTimeout(() => {
|
|
30
|
-
Prism.highlightAllUnder(source.value)
|
|
31
|
-
}, 0)
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
onBeforeUpdate(() => {
|
|
35
|
-
if (typeof context.slots.default[0] === 'string') {
|
|
36
|
-
const newText = context.slots.default[0].replace(
|
|
37
|
-
/^[\r\n\s]*|[\r\n\s]*$/g,
|
|
38
|
-
'',
|
|
39
|
-
)
|
|
40
|
-
context.el.querySelector('code').textContent = newText
|
|
41
|
-
Prism.highlightAllUnder(source.value)
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
const doCopy = () => {
|
|
46
|
-
copy(source.value.innerText)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return { source, languageClass, text, copy, copied, isSupported, doCopy }
|
|
50
|
-
},
|
|
51
|
-
}
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<template>
|
|
55
|
-
<div class="relative mockup-code">
|
|
56
|
-
<div class="absolute flex flex-row items-center top-1 right-1">
|
|
57
|
-
<div v-if="copied" class="pr-2 text-sm">
|
|
58
|
-
copied
|
|
59
|
-
</div>
|
|
60
|
-
<Button sm @click="doCopy">
|
|
61
|
-
copy
|
|
62
|
-
</Button>
|
|
63
|
-
</div>
|
|
64
|
-
<ClientOnly>
|
|
65
|
-
<pre
|
|
66
|
-
ref="source"
|
|
67
|
-
class="whitespace-pre-wrap daisy-code-highlight"
|
|
68
|
-
:class="languageClass"
|
|
69
|
-
><code><slot /></code></pre>
|
|
70
|
-
|
|
71
|
-
<template #fallback>
|
|
72
|
-
<pre
|
|
73
|
-
class="whitespace-pre-wrap daisy-code-highlight"
|
|
74
|
-
><code><slot /></code></pre>
|
|
75
|
-
</template>
|
|
76
|
-
</ClientOnly>
|
|
77
|
-
</div>
|
|
78
|
-
</template>
|
|
79
|
-
|
|
80
|
-
<style>
|
|
81
|
-
.mockup-code .daisy-code-highlight {
|
|
82
|
-
margin-left: 0 !important;
|
|
83
|
-
background: none;
|
|
84
|
-
border: none;
|
|
85
|
-
box-shadow: none;
|
|
86
|
-
padding-top: 0;
|
|
87
|
-
padding-bottom: 0;
|
|
88
|
-
}
|
|
89
|
-
.mockup-code pre.daisy-code-highlight:before {
|
|
90
|
-
margin: 0 !important;
|
|
91
|
-
}
|
|
92
|
-
</style>
|
package/components/Collapse.vue
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, inject, ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
const props = defineProps<{
|
|
5
|
-
style?: 'arrow' | 'plus'
|
|
6
|
-
arrow?: boolean
|
|
7
|
-
plus?: boolean
|
|
8
|
-
|
|
9
|
-
open?: boolean
|
|
10
|
-
close?: boolean
|
|
11
|
-
|
|
12
|
-
toggle?: boolean
|
|
13
|
-
|
|
14
|
-
// for accordion
|
|
15
|
-
value?: any
|
|
16
|
-
}>()
|
|
17
|
-
|
|
18
|
-
const accordionValue: any = inject('accordion-value', ref('no-accordion-value'))
|
|
19
|
-
const useAccordion = computed(() => {
|
|
20
|
-
return accordionValue.value !== 'no-accordion-value'
|
|
21
|
-
})
|
|
22
|
-
const isAccordionSelected = computed(
|
|
23
|
-
() => {
|
|
24
|
-
if (!useAccordion.value)
|
|
25
|
-
return false
|
|
26
|
-
return accordionValue.value === props.value
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
function handleClick() {
|
|
30
|
-
if (useAccordion.value)
|
|
31
|
-
accordionValue.value = props.value
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const classes = computed(() => {
|
|
35
|
-
const { style, arrow, plus, open, close } = props
|
|
36
|
-
return {
|
|
37
|
-
'collapse-arrow': arrow || style === 'arrow',
|
|
38
|
-
'collapse-plus': plus || style === 'plus',
|
|
39
|
-
'collapse-open': (open && !close) || isAccordionSelected.value,
|
|
40
|
-
'collapse-close': close,
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<template>
|
|
46
|
-
<div tabindex="0" class="collapse" :class="classes" @click="handleClick">
|
|
47
|
-
<input
|
|
48
|
-
v-if="toggle || useAccordion"
|
|
49
|
-
:type="useAccordion ? 'radio' : 'checkbox'"
|
|
50
|
-
:checked="isAccordionSelected"
|
|
51
|
-
>
|
|
52
|
-
<slot />
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
package/components/Countdown.vue
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
|
|
4
|
-
const props = defineProps<{
|
|
5
|
-
is?: string | Function | Object
|
|
6
|
-
}>()
|
|
7
|
-
|
|
8
|
-
const tag = computed(() => props.is || 'span')
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
<component :is="tag" class="countdown">
|
|
13
|
-
<slot />
|
|
14
|
-
</component>
|
|
15
|
-
</template>
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { useIntervalFn } from '@vueuse/core'
|
|
3
|
-
import { computed, watch } from 'vue'
|
|
4
|
-
|
|
5
|
-
const props = withDefaults(defineProps<{
|
|
6
|
-
durationInSeconds?: number
|
|
7
|
-
untilDate?: Date
|
|
8
|
-
}>(), { durationInSeconds: 0 })
|
|
9
|
-
const emit = defineEmits(['done'])
|
|
10
|
-
|
|
11
|
-
const calculateDate = () => props.untilDate || new Date(Date.now() + props.durationInSeconds * 1000)
|
|
12
|
-
const targetDate = ref<Date>(calculateDate())
|
|
13
|
-
watch(
|
|
14
|
-
() => props.durationInSeconds,
|
|
15
|
-
() => {
|
|
16
|
-
targetDate.value = calculateDate()
|
|
17
|
-
},
|
|
18
|
-
{ immediate: true },
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
// The target date
|
|
22
|
-
function calcTimeLeft() {
|
|
23
|
-
const remaining = targetDate.value.getTime() - Date.now()
|
|
24
|
-
return remaining < 0 ? 0 : remaining
|
|
25
|
-
}
|
|
26
|
-
const timeLeft = ref(calcTimeLeft())
|
|
27
|
-
useIntervalFn(() => {
|
|
28
|
-
timeLeft.value = calcTimeLeft()
|
|
29
|
-
}, 1000)
|
|
30
|
-
|
|
31
|
-
watch(timeLeft, () => {
|
|
32
|
-
if (timeLeft.value === 0)
|
|
33
|
-
emit('done')
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
const totalSeconds = computed(() => Math.round(timeLeft.value / 1000))
|
|
37
|
-
const totalMinutes = computed(() => Math.floor(timeLeft.value / 1000 / 60))
|
|
38
|
-
const totalHours = computed(() => Math.floor(timeLeft.value / 1000 / 60 / 60))
|
|
39
|
-
const totalDays = computed(() => Math.floor(timeLeft.value / 1000 / 60 / 60 / 24))
|
|
40
|
-
const totalWeeks = computed(() => Math.floor(timeLeft.value / 1000 / 60 / 60 / 24 / 7))
|
|
41
|
-
const totalMonths = computed(() => {
|
|
42
|
-
const today = new Date()
|
|
43
|
-
let diffMonths = (targetDate.value.getFullYear() - today.getFullYear()) * 12
|
|
44
|
-
diffMonths -= targetDate.value.getMonth()
|
|
45
|
-
diffMonths += today.getMonth()
|
|
46
|
-
return diffMonths
|
|
47
|
-
})
|
|
48
|
-
const split = computed(() => {
|
|
49
|
-
const days = totalDays.value
|
|
50
|
-
const hours = totalHours.value - days * 24
|
|
51
|
-
const minutes = totalMinutes.value - hours * 60
|
|
52
|
-
const seconds = totalSeconds.value - totalMinutes.value * 60
|
|
53
|
-
return { days, hours, minutes, seconds }
|
|
54
|
-
})
|
|
55
|
-
</script>
|
|
56
|
-
|
|
57
|
-
<template>
|
|
58
|
-
<slot
|
|
59
|
-
v-bind="{
|
|
60
|
-
totalSeconds,
|
|
61
|
-
totalMinutes,
|
|
62
|
-
totalHours,
|
|
63
|
-
totalDays,
|
|
64
|
-
totalWeeks,
|
|
65
|
-
totalMonths,
|
|
66
|
-
targetDate,
|
|
67
|
-
split,
|
|
68
|
-
}"
|
|
69
|
-
/>
|
|
70
|
-
</template>
|
package/components/Counter.vue
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
|
|
4
|
-
const props = defineProps<{
|
|
5
|
-
value: number
|
|
6
|
-
is?: string | Function
|
|
7
|
-
}>()
|
|
8
|
-
|
|
9
|
-
const tag = computed(() => props.is || 'span')
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<template>
|
|
13
|
-
<component :is="tag" v-bind="$attrs" :style="`--value:${value};`" />
|
|
14
|
-
</template>
|
package/components/Crumb.vue
DELETED
package/components/Divider.vue
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
|
|
4
|
-
const props = withDefaults(defineProps<{
|
|
5
|
-
horizontal?: boolean
|
|
6
|
-
vertical?: boolean
|
|
7
|
-
}>(), {
|
|
8
|
-
horizontal: false,
|
|
9
|
-
vertical: false,
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
const classes = computed(() => {
|
|
13
|
-
return {
|
|
14
|
-
'divider-horizontal': props.horizontal,
|
|
15
|
-
'divider-vertical': props.vertical,
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<div class="divider" :class="classes">
|
|
22
|
-
<slot />
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
package/components/Drawer.vue
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
{ immediate: true },
|
|
23
|
-
)
|
|
24
|
-
watch(
|
|
25
|
-
() => drawerState.isDrawerOpen,
|
|
26
|
-
(value) => {
|
|
27
|
-
if (props.open !== value)
|
|
28
|
-
emit('update:open', value)
|
|
29
|
-
},
|
|
30
|
-
{ immediate: true },
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
const classes = computed(() => {
|
|
34
|
-
return {
|
|
35
|
-
'drawer-end': props.end,
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<template>
|
|
41
|
-
<div class="drawer" :class="classes">
|
|
42
|
-
<input :id="name" v-model="drawerState.isDrawerOpen" type="checkbox" class="drawer-toggle">
|
|
43
|
-
<slot v-bind="drawerState" />
|
|
44
|
-
</div>
|
|
45
|
-
</template>
|
|
@@ -1,17 +0,0 @@
|
|
|
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>
|
|
@@ -1,18 +0,0 @@
|
|
|
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>
|
package/components/Dropdown.vue
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { onMounted, provide, reactive, ref } from 'vue'
|
|
3
|
-
import { autoUpdate, useFloating } from '@floating-ui/vue'
|
|
4
|
-
import { onClickOutside, syncRefs, useElementHover } from '@vueuse/core'
|
|
5
|
-
import { randomString } from '../utils/random-string'
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(defineProps<{
|
|
8
|
-
// allows passing a custom id to the dropdown. Required for SSR hydration.
|
|
9
|
-
randomId?: string
|
|
10
|
-
autoFocus?: boolean
|
|
11
|
-
|
|
12
|
-
placement?: 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end'
|
|
13
|
-
strategy?: 'fixed' | 'absolute'
|
|
14
|
-
|
|
15
|
-
hover?: boolean
|
|
16
|
-
delayEnter?: number
|
|
17
|
-
delayLeave?: number
|
|
18
|
-
closeOnClickOutside?: boolean
|
|
19
|
-
}>(), {
|
|
20
|
-
autoFocus: false,
|
|
21
|
-
placement: 'bottom-start',
|
|
22
|
-
hover: false,
|
|
23
|
-
delayEnter: 0,
|
|
24
|
-
delayLeave: 300,
|
|
25
|
-
closeOnClickOutside: true,
|
|
26
|
-
})
|
|
27
|
-
// Dropdown Visibility
|
|
28
|
-
const isOpen = defineModel('open', { local: true })
|
|
29
|
-
provide('isDropdownOpen', isOpen)
|
|
30
|
-
|
|
31
|
-
const autoFocus = ref(props.autoFocus)
|
|
32
|
-
provide('dropdownAutoFocus', autoFocus)
|
|
33
|
-
|
|
34
|
-
const randomValue = props.randomId || randomString(12)
|
|
35
|
-
const wrapperId = `dropdown-wrapper-${randomValue}`
|
|
36
|
-
const id = `dropdown-${randomValue}`
|
|
37
|
-
provide('dropdownId', id)
|
|
38
|
-
|
|
39
|
-
// set up the floating ui instance
|
|
40
|
-
const buttonEl = ref(null)
|
|
41
|
-
const contentEl = ref(null)
|
|
42
|
-
const floatingConfig = reactive({
|
|
43
|
-
placement: ref(props.placement),
|
|
44
|
-
strategy: ref(props.strategy),
|
|
45
|
-
whileElementsMounted: autoUpdate,
|
|
46
|
-
})
|
|
47
|
-
const { floatingStyles } = useFloating(buttonEl, contentEl, floatingConfig)
|
|
48
|
-
|
|
49
|
-
provide('buttonEl', buttonEl)
|
|
50
|
-
provide('contentEl', contentEl)
|
|
51
|
-
provide('floatingStyles', floatingStyles)
|
|
52
|
-
|
|
53
|
-
// Visibility Utils
|
|
54
|
-
function toggle() {
|
|
55
|
-
isOpen.value = !isOpen.value
|
|
56
|
-
}
|
|
57
|
-
function open() {
|
|
58
|
-
isOpen.value = true
|
|
59
|
-
}
|
|
60
|
-
function close() {
|
|
61
|
-
isOpen.value = false
|
|
62
|
-
}
|
|
63
|
-
provide('toggleDropdown', toggle)
|
|
64
|
-
provide('openDropdown', open)
|
|
65
|
-
provide('closeDropdown', close)
|
|
66
|
-
|
|
67
|
-
const dropdownWrapper = ref(null)
|
|
68
|
-
|
|
69
|
-
onMounted(() => {
|
|
70
|
-
// Close when clicking outside the element
|
|
71
|
-
// use a slight delay to avoid conflict with the focus trap in the DropdownContent.
|
|
72
|
-
onClickOutside(contentEl, () => {
|
|
73
|
-
if (props.closeOnClickOutside) {
|
|
74
|
-
setTimeout(() => {
|
|
75
|
-
isOpen.value = false
|
|
76
|
-
}, 50)
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
// Sync with top-level isHovered ref. For SSR compatibility.
|
|
81
|
-
if (props.hover) {
|
|
82
|
-
const hover = useElementHover(dropdownWrapper, {
|
|
83
|
-
delayLeave: props.delayLeave,
|
|
84
|
-
delayEnter: props.delayEnter,
|
|
85
|
-
})
|
|
86
|
-
syncRefs(hover, isOpen)
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
</script>
|
|
90
|
-
|
|
91
|
-
<template>
|
|
92
|
-
<div :id="wrapperId" ref="dropdownWrapper" class="relative inline-block floating-dropdown">
|
|
93
|
-
<slot v-bind="{ toggle, open, close }" />
|
|
94
|
-
</div>
|
|
95
|
-
</template>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { inject } from 'vue'
|
|
3
|
-
|
|
4
|
-
const id = inject('dropdownId')
|
|
5
|
-
const isOpen = inject('isDropdownOpen')
|
|
6
|
-
const toggleDropdown = inject('toggleDropdown')
|
|
7
|
-
const buttonEl = inject('buttonEl')
|
|
8
|
-
|
|
9
|
-
const toggle = toggleDropdown
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<template>
|
|
13
|
-
<Button :id="id" ref="buttonEl" :aria-expanded="isOpen" aria-haspopup="menu" class="dropdown-button" @click="toggle">
|
|
14
|
-
<slot />
|
|
15
|
-
</Button>
|
|
16
|
-
</template>
|