daisy-ui-kit 5.0.0-pre.3 → 5.0.0-pre.30
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 +29 -0
- package/app/components/Alert.vue +36 -0
- package/app/components/Avatar.vue +131 -0
- package/app/components/AvatarGroup.vue +22 -0
- package/app/components/Badge.vue +72 -0
- package/app/components/Breadcrumbs.vue +7 -0
- package/app/components/Button.vue +140 -0
- package/app/components/Calendar.vue +175 -0
- package/app/components/CalendarInput.vue +275 -0
- package/app/components/CalendarSkeleton.vue +87 -0
- package/app/components/Card.vue +51 -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 +24 -0
- package/app/components/CarouselItem.vue +5 -0
- package/app/components/Chat.vue +26 -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 +51 -0
- package/app/components/Collapse.vue +75 -0
- package/app/components/CollapseContent.vue +5 -0
- package/app/components/CollapseTitle.vue +15 -0
- package/app/components/Countdown.vue +15 -0
- package/app/components/CountdownTimers.vue +69 -0
- package/app/components/Counter.vue +21 -0
- package/app/components/Crumb.vue +5 -0
- package/app/components/DaisyLink.vue +56 -0
- package/app/components/Diff.vue +11 -0
- package/app/components/Divider.vue +43 -0
- package/app/components/Dock.vue +57 -0
- package/app/components/DockItem.vue +27 -0
- package/app/components/DockLabel.vue +5 -0
- package/app/components/Drawer.vue +50 -0
- package/app/components/DrawerContent.vue +20 -0
- package/app/components/DrawerSide.vue +21 -0
- package/app/components/Dropdown.vue +106 -0
- package/app/components/DropdownButton.vue +23 -0
- package/app/components/DropdownContent.vue +127 -0
- package/app/components/DropdownTarget.vue +21 -0
- 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 +20 -0
- package/app/components/FileInput.vue +53 -0
- package/app/components/Filter.vue +129 -0
- package/app/components/Flex.vue +89 -0
- package/app/components/FlexItem.vue +62 -0
- package/app/components/Footer.vue +31 -0
- package/app/components/FooterTitle.vue +18 -0
- package/app/components/FormControl.vue +5 -0
- package/app/components/Hero.vue +18 -0
- package/app/components/HeroContent.vue +18 -0
- package/app/components/HeroOverlay.vue +5 -0
- package/app/components/Hover3D.vue +22 -0
- package/app/components/HoverGallery.vue +11 -0
- package/app/components/Indicator.vue +20 -0
- package/app/components/IndicatorItem.vue +43 -0
- package/app/components/Input.vue +116 -0
- package/app/components/Join.vue +5 -0
- package/app/components/Kbd.vue +25 -0
- package/app/components/Label.vue +100 -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 +92 -0
- package/app/components/MenuExpandToggle.vue +20 -0
- package/app/components/MenuItem.vue +39 -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 +14 -0
- package/app/components/MockupWindow.vue +5 -0
- package/app/components/Modal.vue +63 -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 +46 -0
- package/app/components/Prose.vue +37 -0
- package/app/components/RadialProgress.vue +36 -0
- package/app/components/Radio.vue +69 -0
- package/app/components/RadioGroup.vue +47 -0
- package/app/components/Range.vue +201 -0
- package/app/components/RangeMeasure.vue +87 -0
- package/app/components/RangeMeasureTick.vue +69 -0
- package/app/components/Rating.vue +197 -0
- package/app/components/Select.vue +101 -0
- package/app/components/Skeleton.vue +5 -0
- package/app/components/SkeletonText.vue +11 -0
- package/app/components/Stack.vue +30 -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 +23 -0
- package/app/components/Swap.vue +56 -0
- package/app/components/Tab.vue +56 -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 +166 -0
- package/app/components/TextArea.vue +106 -0
- package/app/components/TextRotate.vue +24 -0
- package/app/components/ThemeController.vue +45 -0
- package/app/components/ThemeProvider.vue +302 -0
- package/app/components/ThemeTile.vue +50 -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 +14 -0
- package/app/components/Toast.vue +67 -0
- package/app/components/Toggle.vue +60 -0
- package/app/components/Tooltip.vue +137 -0
- package/app/components/TooltipContent.vue +283 -0
- package/app/components/TooltipTarget.vue +20 -0
- package/app/components/ValidatorHint.vue +5 -0
- package/app/composables/__tests__/use-calendar.test.ts +239 -0
- package/app/composables/use-calendar.ts +288 -0
- package/app/composables/use-daisy-theme.ts +131 -0
- package/app/composables/use-toast.ts +345 -0
- package/app/composables/useSearch.ts +22 -0
- package/app/utils/drawer-utils.ts +34 -0
- package/app/utils/position-area.ts +40 -0
- package/nuxt.d.ts +13 -0
- package/nuxt.js +31 -0
- package/package.json +50 -22
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import { onClickOutside, useElementHover } from '@vueuse/core'
|
|
5
|
+
import { onMounted, provide, ref, useId } from 'vue'
|
|
6
|
+
|
|
7
|
+
// Define the MenuExpandState interface
|
|
8
|
+
export interface MenuExpandState {
|
|
9
|
+
id: string
|
|
10
|
+
isOpen: Ref<boolean>
|
|
11
|
+
toggle: () => void
|
|
12
|
+
open: () => void
|
|
13
|
+
close: () => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Props with defaults
|
|
17
|
+
const {
|
|
18
|
+
hover = false,
|
|
19
|
+
delayLeave = 300,
|
|
20
|
+
closeOnClickOutside = false,
|
|
21
|
+
} = defineProps<{
|
|
22
|
+
hover?: boolean
|
|
23
|
+
delayLeave?: number
|
|
24
|
+
closeOnClickOutside?: boolean
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
// v-model for open state
|
|
28
|
+
const isOpen = defineModel('open', { default: false, type: Boolean })
|
|
29
|
+
|
|
30
|
+
// Generate IDs for accessibility and targeting
|
|
31
|
+
const uniqueId = useId()
|
|
32
|
+
const wrapperId = `expand-wrapper-${uniqueId}`
|
|
33
|
+
const id = `expand-${uniqueId}`
|
|
34
|
+
|
|
35
|
+
// Element reference for click outside detection
|
|
36
|
+
const expandEl = ref()
|
|
37
|
+
|
|
38
|
+
// Control functions
|
|
39
|
+
function toggle() {
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
isOpen.value = !isOpen.value
|
|
42
|
+
}, 50)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function open() {
|
|
46
|
+
isOpen.value = true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function close() {
|
|
50
|
+
isOpen.value = false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Create and provide the menu expand state object
|
|
54
|
+
const menuExpandState: MenuExpandState = {
|
|
55
|
+
id,
|
|
56
|
+
isOpen,
|
|
57
|
+
toggle,
|
|
58
|
+
open,
|
|
59
|
+
close,
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Provide the state to child components
|
|
63
|
+
provide('menuExpandState', menuExpandState)
|
|
64
|
+
|
|
65
|
+
// Setup event handlers
|
|
66
|
+
onMounted(() => {
|
|
67
|
+
// Handle clicks outside the component
|
|
68
|
+
onClickOutside(expandEl, () => {
|
|
69
|
+
if (closeOnClickOutside) {
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
isOpen.value = false
|
|
72
|
+
}, 500)
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
// Setup hover behavior if enabled
|
|
77
|
+
if (hover) {
|
|
78
|
+
useElementHover(expandEl, {
|
|
79
|
+
delayLeave,
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// Empty click handler for internal use
|
|
85
|
+
function handleClick(_ev: MouseEvent) {}
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<template>
|
|
89
|
+
<details :id="wrapperId" ref="expandEl" class="dropdown menu-expand" :open="isOpen" @click="handleClick">
|
|
90
|
+
<slot v-bind="{ toggle, open, close }" />
|
|
91
|
+
</details>
|
|
92
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { MenuExpandState } from './MenuExpand.vue'
|
|
3
|
+
|
|
4
|
+
import { inject } from 'vue'
|
|
5
|
+
|
|
6
|
+
const menuExpandState = inject<MenuExpandState>('menuExpandState')
|
|
7
|
+
const { id, isOpen, toggle } = menuExpandState || {}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<summary
|
|
12
|
+
:id="id"
|
|
13
|
+
:aria-expanded="isOpen"
|
|
14
|
+
aria-haspopup="menu"
|
|
15
|
+
class="menu-expand-toggle"
|
|
16
|
+
@click.prevent.stop="toggle"
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</summary>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
disabled?: boolean
|
|
4
|
+
}>()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<li class="menu-item" :class="{ 'menu-disabled': disabled }">
|
|
9
|
+
<slot />
|
|
10
|
+
</li>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<style lang="postcss">
|
|
14
|
+
/*
|
|
15
|
+
Allow adding .active class to the MenuItem element.
|
|
16
|
+
DaisyUI only supports adding it to the `a` element.
|
|
17
|
+
*/
|
|
18
|
+
.menu-item.menu-active > a,
|
|
19
|
+
.menu-item.menu-active > span {
|
|
20
|
+
background-color: hsl(var(--n) / var(--tw-bg-opacity));
|
|
21
|
+
color: hsl(var(--nc) / var(--tw-text-opacity));
|
|
22
|
+
}
|
|
23
|
+
.menu-item.menu-disabled > a,
|
|
24
|
+
.menu-item.menu-disabled > span {
|
|
25
|
+
background-color: var(--n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Fix padding when putting a Dropdown inside of a menu */
|
|
29
|
+
.menu-item > .floating-dropdown {
|
|
30
|
+
padding: 0;
|
|
31
|
+
}
|
|
32
|
+
.menu-item > .floating-dropdown > .dropdown-button,
|
|
33
|
+
.menu-item > .floating-dropdown > .dropdown-target {
|
|
34
|
+
padding-left: 1rem;
|
|
35
|
+
padding-right: 1rem;
|
|
36
|
+
padding-top: 0.5rem;
|
|
37
|
+
padding-bottom: 0.5rem;
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
defineProps<{
|
|
3
|
+
displayClasses?: string
|
|
4
|
+
}>()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div class="mockup-phone">
|
|
9
|
+
<div class="mockup-phone-camera" />
|
|
10
|
+
<div class="mockup-phone-display" :class="displayClasses">
|
|
11
|
+
<slot />
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, watch } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(
|
|
5
|
+
defineProps<{
|
|
6
|
+
modelValue?: boolean
|
|
7
|
+
closeOnClickOutside?: boolean
|
|
8
|
+
placement?: 'top' | 'bottom' | 'start' | 'end'
|
|
9
|
+
top?: boolean
|
|
10
|
+
bottom?: boolean
|
|
11
|
+
start?: boolean
|
|
12
|
+
end?: boolean
|
|
13
|
+
}>(),
|
|
14
|
+
{
|
|
15
|
+
closeOnClickOutside: true,
|
|
16
|
+
},
|
|
17
|
+
)
|
|
18
|
+
const emit = defineEmits(['update:modelValue'])
|
|
19
|
+
|
|
20
|
+
const is = 'div'
|
|
21
|
+
|
|
22
|
+
// defineModel 'open'
|
|
23
|
+
const _isOpen = ref(props.modelValue)
|
|
24
|
+
watch(
|
|
25
|
+
() => props.modelValue,
|
|
26
|
+
val => {
|
|
27
|
+
_isOpen.value = val
|
|
28
|
+
},
|
|
29
|
+
)
|
|
30
|
+
const isOpen = computed({
|
|
31
|
+
get: () => _isOpen.value,
|
|
32
|
+
set: val => {
|
|
33
|
+
_isOpen.value = val
|
|
34
|
+
if (props.modelValue !== val) {
|
|
35
|
+
emit('update:modelValue', val)
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
function handleClick() {
|
|
41
|
+
if (props.closeOnClickOutside) {
|
|
42
|
+
isOpen.value = false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<input v-model="isOpen" type="checkbox" class="modal-toggle" />
|
|
49
|
+
<Component
|
|
50
|
+
:is="is"
|
|
51
|
+
v-bind="{ ...$attrs, ...$props }"
|
|
52
|
+
class="modal"
|
|
53
|
+
:class="{
|
|
54
|
+
'modal-top': props.top,
|
|
55
|
+
'modal-bottom': props.bottom,
|
|
56
|
+
'modal-start': props.start,
|
|
57
|
+
'modal-end': props.end,
|
|
58
|
+
}"
|
|
59
|
+
@click.self="handleClick"
|
|
60
|
+
>
|
|
61
|
+
<slot />
|
|
62
|
+
</Component>
|
|
63
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { active = false, disabled = false } = defineProps<{
|
|
3
|
+
active?: boolean
|
|
4
|
+
disabled?: boolean
|
|
5
|
+
}>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<button class="nav-button" :class="{ active, disabled }">
|
|
10
|
+
<slot />
|
|
11
|
+
</button>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const {
|
|
3
|
+
value = 0,
|
|
4
|
+
max = 100,
|
|
5
|
+
color,
|
|
6
|
+
neutral,
|
|
7
|
+
primary,
|
|
8
|
+
secondary,
|
|
9
|
+
accent,
|
|
10
|
+
success,
|
|
11
|
+
info,
|
|
12
|
+
warning,
|
|
13
|
+
error,
|
|
14
|
+
} = defineProps<{
|
|
15
|
+
value?: string | number
|
|
16
|
+
max?: string | number
|
|
17
|
+
|
|
18
|
+
color?: string
|
|
19
|
+
neutral?: boolean
|
|
20
|
+
primary?: boolean
|
|
21
|
+
secondary?: boolean
|
|
22
|
+
accent?: boolean
|
|
23
|
+
success?: boolean
|
|
24
|
+
info?: boolean
|
|
25
|
+
warning?: boolean
|
|
26
|
+
error?: boolean
|
|
27
|
+
}>()
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<progress
|
|
32
|
+
:value="value"
|
|
33
|
+
:max="max"
|
|
34
|
+
class="progress"
|
|
35
|
+
:class="{
|
|
36
|
+
'progress-neutral': neutral || color === 'neutral',
|
|
37
|
+
'progress-primary': primary || color === 'primary',
|
|
38
|
+
'progress-secondary': secondary || color === 'secondary',
|
|
39
|
+
'progress-accent': accent || color === 'accent',
|
|
40
|
+
'progress-success': success || color === 'success',
|
|
41
|
+
'progress-info': info || color === 'info',
|
|
42
|
+
'progress-warning': warning || color === 'warning',
|
|
43
|
+
'progress-error': error || color === 'error',
|
|
44
|
+
}"
|
|
45
|
+
/>
|
|
46
|
+
</template>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<article class="prose daisy-prose">
|
|
3
|
+
<slot />
|
|
4
|
+
</article>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style lang="postcss">
|
|
8
|
+
.prose.full-width {
|
|
9
|
+
width: 100%;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
}
|
|
12
|
+
.prose.daisy-prose code:not(pre code) {
|
|
13
|
+
@apply bg-base-300;
|
|
14
|
+
}
|
|
15
|
+
.prose .link-primary {
|
|
16
|
+
@apply text-primary;
|
|
17
|
+
}
|
|
18
|
+
.prose .link-secondary {
|
|
19
|
+
@apply text-secondary;
|
|
20
|
+
}
|
|
21
|
+
.prose .link-neutral {
|
|
22
|
+
@apply text-neutral;
|
|
23
|
+
}
|
|
24
|
+
.prose .link-accent {
|
|
25
|
+
@apply text-accent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.prose h1 a,
|
|
29
|
+
.prose h2 a,
|
|
30
|
+
.prose h3 a,
|
|
31
|
+
.prose h4 a,
|
|
32
|
+
.prose h5 a,
|
|
33
|
+
.prose h6 a {
|
|
34
|
+
text-decoration: none;
|
|
35
|
+
@apply font-bold;
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
value: number | string
|
|
4
|
+
size?: string
|
|
5
|
+
thickness?: string
|
|
6
|
+
|
|
7
|
+
color?: string
|
|
8
|
+
neutral?: boolean
|
|
9
|
+
primary?: boolean
|
|
10
|
+
secondary?: boolean
|
|
11
|
+
accent?: boolean
|
|
12
|
+
info?: boolean
|
|
13
|
+
success?: boolean
|
|
14
|
+
warning?: boolean
|
|
15
|
+
error?: boolean
|
|
16
|
+
}>()
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div
|
|
21
|
+
class="radial-progress"
|
|
22
|
+
:class="{
|
|
23
|
+
'text-neutral': neutral || color === 'neutral',
|
|
24
|
+
'text-primary': primary || color === 'primary',
|
|
25
|
+
'text-secondary': secondary || color === 'secondary',
|
|
26
|
+
'text-accent': accent || color === 'accent',
|
|
27
|
+
'text-info': info || color === 'info',
|
|
28
|
+
'text-success': success || color === 'success',
|
|
29
|
+
'text-warning': warning || color === 'warning',
|
|
30
|
+
'text-error': error || color === 'error',
|
|
31
|
+
}"
|
|
32
|
+
:style="`--value:${value}; --size:${size || '4rem'}; --thickness:${thickness || 'calc(var(--size) / 10)'};`"
|
|
33
|
+
>
|
|
34
|
+
<slot />
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
modelValue?: any
|
|
6
|
+
value: any
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
themeController?: boolean
|
|
9
|
+
|
|
10
|
+
color?: string
|
|
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
|
+
size?: string
|
|
21
|
+
xs?: boolean
|
|
22
|
+
sm?: boolean
|
|
23
|
+
md?: boolean
|
|
24
|
+
lg?: boolean
|
|
25
|
+
xl?: boolean
|
|
26
|
+
}>()
|
|
27
|
+
const emit = defineEmits(['update:modelValue'])
|
|
28
|
+
|
|
29
|
+
const radioGroup: any = inject('radio-group', null)
|
|
30
|
+
|
|
31
|
+
const currentValue = computed({
|
|
32
|
+
get() {
|
|
33
|
+
return radioGroup ? radioGroup.currentValue : props.modelValue
|
|
34
|
+
},
|
|
35
|
+
set(val: any) {
|
|
36
|
+
if (radioGroup) {
|
|
37
|
+
radioGroup.currentValue = val
|
|
38
|
+
}
|
|
39
|
+
emit('update:modelValue', val)
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<input
|
|
46
|
+
v-model="currentValue"
|
|
47
|
+
type="radio"
|
|
48
|
+
v-bind="$attrs"
|
|
49
|
+
class="radio"
|
|
50
|
+
:class="{
|
|
51
|
+
'radio-neutral': props.neutral || props.color === 'neutral',
|
|
52
|
+
'radio-primary': props.primary || props.color === 'primary',
|
|
53
|
+
'radio-secondary': props.secondary || props.color === 'secondary',
|
|
54
|
+
'radio-accent': props.accent || props.color === 'accent',
|
|
55
|
+
'radio-success': props.success || props.color === 'success',
|
|
56
|
+
'radio-warning': props.warning || props.color === 'warning',
|
|
57
|
+
'radio-info': props.info || props.color === 'info',
|
|
58
|
+
'radio-error': props.error || props.color === 'error',
|
|
59
|
+
'radio-xs': props.xs || props.size === 'xs',
|
|
60
|
+
'radio-sm': props.sm || props.size === 'sm',
|
|
61
|
+
'radio-md': props.md || props.size === 'md',
|
|
62
|
+
'radio-lg': props.lg || props.size === 'lg',
|
|
63
|
+
'radio-xl': props.xl || props.size === 'xl',
|
|
64
|
+
'theme-controller': props.themeController,
|
|
65
|
+
}"
|
|
66
|
+
:disabled="props.disabled"
|
|
67
|
+
:value="props.value"
|
|
68
|
+
/>
|
|
69
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, provide, reactive } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
modelValue?: any
|
|
6
|
+
name: string
|
|
7
|
+
|
|
8
|
+
color?: string
|
|
9
|
+
neutral?: boolean
|
|
10
|
+
primary?: boolean
|
|
11
|
+
secondary?: boolean
|
|
12
|
+
accent?: boolean
|
|
13
|
+
success?: boolean
|
|
14
|
+
warning?: boolean
|
|
15
|
+
info?: boolean
|
|
16
|
+
error?: boolean
|
|
17
|
+
|
|
18
|
+
size?: string
|
|
19
|
+
xs?: boolean
|
|
20
|
+
sm?: boolean
|
|
21
|
+
md?: boolean
|
|
22
|
+
lg?: boolean
|
|
23
|
+
xl?: boolean
|
|
24
|
+
}>()
|
|
25
|
+
const emit = defineEmits(['update:modelValue'])
|
|
26
|
+
|
|
27
|
+
const currentValue = computed({
|
|
28
|
+
get: () => {
|
|
29
|
+
return props.modelValue
|
|
30
|
+
},
|
|
31
|
+
set: val => {
|
|
32
|
+
emit('update:modelValue', val)
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const state = reactive({
|
|
37
|
+
currentValue,
|
|
38
|
+
props,
|
|
39
|
+
})
|
|
40
|
+
provide('radio-group', state)
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<div class="radio-group">
|
|
45
|
+
<slot />
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|