daisy-ui-kit 5.0.3 → 5.0.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 +1 -1
- package/dist/index.css +1 -0
- package/dist/index.d.ts +4652 -0
- package/dist/index.js +5279 -0
- package/package.json +11 -21
- package/app/components/Accordion.vue +0 -29
- package/app/components/Alert.vue +0 -36
- package/app/components/Avatar.vue +0 -131
- package/app/components/AvatarGroup.vue +0 -22
- package/app/components/Badge.vue +0 -72
- package/app/components/Breadcrumbs.vue +0 -7
- package/app/components/Button.vue +0 -140
- package/app/components/Calendar.vue +0 -175
- package/app/components/CalendarInput.vue +0 -275
- package/app/components/CalendarSkeleton.vue +0 -87
- package/app/components/Card.vue +0 -51
- package/app/components/CardActions.vue +0 -13
- package/app/components/CardBody.vue +0 -13
- package/app/components/CardTitle.vue +0 -11
- package/app/components/Carousel.vue +0 -24
- package/app/components/CarouselItem.vue +0 -5
- package/app/components/Chat.vue +0 -26
- package/app/components/ChatBubble.vue +0 -31
- package/app/components/ChatFooter.vue +0 -5
- package/app/components/ChatHeader.vue +0 -5
- package/app/components/ChatImage.vue +0 -5
- package/app/components/Checkbox.vue +0 -51
- package/app/components/Collapse.vue +0 -76
- package/app/components/CollapseContent.vue +0 -5
- package/app/components/CollapseTitle.vue +0 -15
- package/app/components/Countdown.vue +0 -15
- package/app/components/CountdownTimers.vue +0 -69
- package/app/components/Counter.vue +0 -21
- package/app/components/Crumb.vue +0 -5
- package/app/components/DaisyLink.vue +0 -56
- package/app/components/Diff.vue +0 -11
- package/app/components/Divider.vue +0 -43
- package/app/components/Dock.vue +0 -57
- package/app/components/DockItem.vue +0 -27
- package/app/components/DockLabel.vue +0 -5
- package/app/components/Drawer.vue +0 -50
- package/app/components/DrawerContent.vue +0 -20
- package/app/components/DrawerSide.vue +0 -21
- package/app/components/Dropdown.vue +0 -106
- package/app/components/DropdownButton.vue +0 -23
- package/app/components/DropdownContent.vue +0 -127
- package/app/components/DropdownTarget.vue +0 -21
- package/app/components/Fab.vue +0 -16
- package/app/components/FabClose.vue +0 -18
- package/app/components/FabMainAction.vue +0 -5
- package/app/components/FabTrigger.vue +0 -117
- package/app/components/Fieldset.vue +0 -20
- package/app/components/FileInput.vue +0 -53
- package/app/components/Filter.vue +0 -129
- package/app/components/Flex.vue +0 -89
- package/app/components/FlexItem.vue +0 -62
- package/app/components/Footer.vue +0 -31
- package/app/components/FooterTitle.vue +0 -18
- package/app/components/FormControl.vue +0 -5
- package/app/components/Hero.vue +0 -18
- package/app/components/HeroContent.vue +0 -18
- package/app/components/HeroOverlay.vue +0 -5
- package/app/components/Hover3D.vue +0 -22
- package/app/components/HoverGallery.vue +0 -11
- package/app/components/Indicator.vue +0 -20
- package/app/components/IndicatorItem.vue +0 -43
- package/app/components/Input.vue +0 -116
- package/app/components/Join.vue +0 -5
- package/app/components/Kbd.vue +0 -25
- package/app/components/Label.vue +0 -100
- package/app/components/List.vue +0 -5
- package/app/components/ListColGrow.vue +0 -5
- package/app/components/ListColWrap.vue +0 -5
- package/app/components/ListRow.vue +0 -5
- package/app/components/LoadingBall.vue +0 -42
- package/app/components/LoadingBars.vue +0 -42
- package/app/components/LoadingDots.vue +0 -42
- package/app/components/LoadingInfinity.vue +0 -42
- package/app/components/LoadingRing.vue +0 -42
- package/app/components/LoadingSpinner.vue +0 -42
- package/app/components/Mask.vue +0 -49
- package/app/components/Menu.vue +0 -30
- package/app/components/MenuExpand.vue +0 -92
- package/app/components/MenuExpandToggle.vue +0 -20
- package/app/components/MenuItem.vue +0 -39
- package/app/components/MenuTitle.vue +0 -5
- package/app/components/MockupBrowser.vue +0 -5
- package/app/components/MockupBrowserToolbar.vue +0 -5
- package/app/components/MockupCode.vue +0 -4
- package/app/components/MockupPhone.vue +0 -14
- package/app/components/MockupWindow.vue +0 -5
- package/app/components/Modal.vue +0 -63
- package/app/components/ModalAction.vue +0 -5
- package/app/components/ModalBox.vue +0 -5
- package/app/components/NavButton.vue +0 -12
- package/app/components/Navbar.vue +0 -12
- package/app/components/NavbarCenter.vue +0 -11
- package/app/components/NavbarEnd.vue +0 -11
- package/app/components/NavbarStart.vue +0 -11
- package/app/components/Progress.vue +0 -46
- package/app/components/Prose.vue +0 -37
- package/app/components/RadialProgress.vue +0 -36
- package/app/components/Radio.vue +0 -69
- package/app/components/RadioGroup.vue +0 -47
- package/app/components/Range.vue +0 -201
- package/app/components/RangeMeasure.vue +0 -87
- package/app/components/RangeMeasureTick.vue +0 -69
- package/app/components/Rating.vue +0 -197
- package/app/components/Select.vue +0 -101
- package/app/components/Skeleton.vue +0 -5
- package/app/components/SkeletonText.vue +0 -11
- package/app/components/Stack.vue +0 -30
- package/app/components/Stat.vue +0 -19
- package/app/components/StatActions.vue +0 -5
- package/app/components/StatDesc.vue +0 -5
- package/app/components/StatFigure.vue +0 -5
- package/app/components/StatTitle.vue +0 -5
- package/app/components/StatValue.vue +0 -5
- package/app/components/Stats.vue +0 -5
- package/app/components/Status.vue +0 -43
- package/app/components/Step.vue +0 -34
- package/app/components/StepIcon.vue +0 -5
- package/app/components/Steps.vue +0 -23
- package/app/components/Swap.vue +0 -56
- package/app/components/Tab.vue +0 -56
- package/app/components/TabContent.vue +0 -29
- package/app/components/Table.vue +0 -32
- package/app/components/Tabs.vue +0 -53
- package/app/components/Text.vue +0 -166
- package/app/components/TextArea.vue +0 -106
- package/app/components/TextRotate.vue +0 -24
- package/app/components/ThemeController.vue +0 -45
- package/app/components/ThemeProvider.vue +0 -302
- package/app/components/ThemeTile.vue +0 -50
- package/app/components/Timeline.vue +0 -22
- package/app/components/TimelineEnd.vue +0 -14
- package/app/components/TimelineItem.vue +0 -5
- package/app/components/TimelineLine.vue +0 -29
- package/app/components/TimelineMiddle.vue +0 -5
- package/app/components/TimelineStart.vue +0 -14
- package/app/components/Toast.vue +0 -67
- package/app/components/Toggle.vue +0 -60
- package/app/components/Tooltip.vue +0 -137
- package/app/components/TooltipContent.vue +0 -283
- package/app/components/TooltipTarget.vue +0 -20
- package/app/components/ValidatorHint.vue +0 -5
- package/app/composables/__tests__/use-calendar.test.ts +0 -239
- package/app/composables/use-calendar.ts +0 -288
- package/app/composables/use-daisy-theme.ts +0 -140
- package/app/composables/use-toast.ts +0 -345
- package/app/composables/useSearch.ts +0 -22
- package/app/utils/drawer-utils.ts +0 -34
- package/app/utils/position-area.ts +0 -40
- package/components.d.ts +0 -145
- package/components.js +0 -141
- package/index.d.ts +0 -157
- package/index.js +0 -145
|
@@ -1,92 +0,0 @@
|
|
|
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>
|
|
@@ -1,20 +0,0 @@
|
|
|
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>
|
|
@@ -1,39 +0,0 @@
|
|
|
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>
|
|
@@ -1,14 +0,0 @@
|
|
|
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>
|
package/app/components/Modal.vue
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
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>
|
|
@@ -1,12 +0,0 @@
|
|
|
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>
|
|
@@ -1,46 +0,0 @@
|
|
|
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>
|
package/app/components/Prose.vue
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
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>
|
|
@@ -1,36 +0,0 @@
|
|
|
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>
|
package/app/components/Radio.vue
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
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>
|
|
@@ -1,47 +0,0 @@
|
|
|
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>
|