daisy-ui-kit 3.0.12 → 5.0.0-pre.10
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/{components → app/components}/Accordion.vue +7 -10
- 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/Button.vue +120 -0
- package/app/components/Calendar.vue +66 -0
- package/app/components/CalendarInput.vue +174 -0
- package/app/components/CalendarSkeleton.vue +46 -0
- package/app/components/Card.vue +33 -0
- package/{components → app/components}/CardActions.vue +3 -6
- package/{components → app/components}/CardBody.vue +3 -6
- package/{components → app/components}/CardTitle.vue +2 -7
- package/app/components/Carousel.vue +23 -0
- package/app/components/Chat.vue +21 -0
- package/app/components/ChatBubble.vue +31 -0
- package/app/components/Checkbox.vue +51 -0
- package/app/components/Collapse.vue +43 -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/DaisyLink.vue +38 -0
- package/app/components/Diff.vue +11 -0
- package/app/components/Divider.vue +43 -0
- package/app/components/Dock.vue +60 -0
- package/app/components/DockItem.vue +26 -0
- package/app/components/DockLabel.vue +5 -0
- package/{components → app/components}/Drawer.vue +6 -4
- package/{components → app/components}/DrawerContent.vue +1 -1
- package/{components → app/components}/DrawerSide.vue +1 -1
- package/{components → app/components}/Dropdown.vue +2 -2
- package/{components → app/components}/DropdownContent.vue +3 -3
- 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/{components → app/components}/FlexItem.vue +1 -1
- package/app/components/Footer.vue +27 -0
- package/app/components/FormControl.vue +5 -0
- package/{components → app/components}/Hero.vue +1 -1
- package/{components → app/components}/HeroContent.vue +1 -1
- package/app/components/Input.vue +119 -0
- package/app/components/Kbd.vue +24 -0
- package/app/components/Label.vue +97 -0
- package/app/components/List.vue +5 -0
- package/{components/FormControl.vue → app/components/ListColGrow.vue} +1 -1
- package/app/components/ListColWrap.vue +5 -0
- package/{components/Stat.vue → app/components/ListRow.vue} +1 -1
- 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/{components → app/components}/MenuExpandToggle.vue +5 -4
- package/{components → app/components}/MenuItem.vue +3 -4
- package/app/components/MockupPhone.vue +14 -0
- package/{components → app/components}/Modal.vue +14 -5
- package/app/components/NavButton.vue +12 -0
- package/{components → app/components}/Navbar.vue +3 -5
- package/{components → app/components}/NavbarCenter.vue +3 -5
- package/{components → app/components}/NavbarEnd.vue +3 -5
- package/{components → app/components}/NavbarStart.vue +3 -5
- package/app/components/Progress.vue +34 -0
- package/{components → app/components}/Prose.vue +1 -1
- package/app/components/RadialProgress.vue +36 -0
- package/app/components/Radio.vue +69 -0
- package/{components → app/components}/RadioGroup.vue +2 -1
- package/app/components/Range.vue +61 -0
- package/{components → app/components}/RangeMeasure.vue +22 -21
- package/{components → app/components}/RangeMeasureTick.vue +9 -14
- package/app/components/Rating.vue +180 -0
- package/{components → app/components}/Select.vue +33 -29
- package/app/components/Skeleton.vue +5 -0
- package/app/components/Stack.vue +25 -0
- package/app/components/Stat.vue +19 -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/{components → app/components}/TabContent.vue +10 -10
- 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/ThemeController.vue +46 -0
- package/app/components/ThemeProvider.vue +287 -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 +13 -0
- package/app/components/Toast.vue +72 -0
- package/app/components/Toggle.vue +60 -0
- package/app/components/Tooltip.vue +47 -0
- package/app/components/TooltipContent.vue +5 -0
- package/app/components/ValidatorHint.vue +5 -0
- package/nuxt.js +7 -1
- package/package.json +58 -61
- 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/Button.vue +0 -111
- package/components/Card.vue +0 -30
- package/components/Carousel.vue +0 -25
- package/components/Chat.vue +0 -27
- package/components/ChatBubble.vue +0 -34
- package/components/Checkbox.vue +0 -55
- package/components/Code.vue +0 -92
- package/components/Collapse.vue +0 -54
- package/components/Countdown.vue +0 -15
- package/components/CountdownTimers.vue +0 -70
- package/components/Counter.vue +0 -14
- package/components/Divider.vue +0 -24
- package/components/FileInput.vue +0 -59
- package/components/Flex.vue +0 -59
- package/components/Footer.vue +0 -24
- 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/MockupPhone.vue +0 -8
- package/components/NavButton.vue +0 -20
- package/components/Progress.vue +0 -42
- package/components/RadialProgress.vue +0 -41
- package/components/Radio.vue +0 -76
- package/components/Range.vue +0 -60
- package/components/Rating.vue +0 -167
- package/components/Stack.vue +0 -13
- 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/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/utils/-utils.ts +0 -41
- package/utils/Button.config.ts +0 -26
- package/utils/fixtures.ts +0 -62
- package/utils/types.ts +0 -7
- /package/{components → app/components}/Breadcrumbs.vue +0 -0
- /package/{components → app/components}/CarouselItem.vue +0 -0
- /package/{components → app/components}/ChatFooter.vue +0 -0
- /package/{components → app/components}/ChatHeader.vue +0 -0
- /package/{components → app/components}/ChatImage.vue +0 -0
- /package/{components → app/components}/CollapseContent.vue +0 -0
- /package/{components → app/components}/CollapseTitle.vue +0 -0
- /package/{components → app/components}/Crumb.vue +0 -0
- /package/{components → app/components}/DropdownButton.vue +0 -0
- /package/{components → app/components}/DropdownTarget.vue +0 -0
- /package/{components → app/components}/FooterTitle.vue +0 -0
- /package/{components → app/components}/HeroOverlay.vue +0 -0
- /package/{components → app/components}/Indicator.vue +0 -0
- /package/{components → app/components}/IndicatorItem.vue +0 -0
- /package/{components → app/components}/Join.vue +0 -0
- /package/{components → app/components}/MenuTitle.vue +0 -0
- /package/{components → app/components}/MockupBrowser.vue +0 -0
- /package/{components → app/components}/MockupBrowserToolbar.vue +0 -0
- /package/{components → app/components}/MockupCode.vue +0 -0
- /package/{components → app/components}/MockupWindow.vue +0 -0
- /package/{components → app/components}/ModalAction.vue +0 -0
- /package/{components → app/components}/ModalBox.vue +0 -0
- /package/{components → app/components}/StatActions.vue +0 -0
- /package/{components → app/components}/StatDesc.vue +0 -0
- /package/{components → app/components}/StatFigure.vue +0 -0
- /package/{components → app/components}/StatTitle.vue +0 -0
- /package/{components → app/components}/StatValue.vue +0 -0
- /package/{components → app/components}/Stats.vue +0 -0
- /package/{utils → app/utils}/drawer-utils.ts +0 -0
- /package/{utils → app/utils}/random-string.ts +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, provide } from 'vue'
|
|
3
|
+
import type { Ref } from 'vue'
|
|
4
|
+
import { randomString } from '../utils/random-string'
|
|
5
|
+
|
|
6
|
+
const { size, xl, lg, md, sm, xs } = defineProps<{
|
|
7
|
+
size?: string
|
|
8
|
+
xl?: boolean
|
|
9
|
+
lg?: boolean
|
|
10
|
+
md?: boolean
|
|
11
|
+
sm?: boolean
|
|
12
|
+
xs?: boolean
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const activeItemId = ref<string | null>(null)
|
|
16
|
+
const itemIds = ref<string[]>([])
|
|
17
|
+
|
|
18
|
+
function registerItem() {
|
|
19
|
+
const itemId = randomString()
|
|
20
|
+
itemIds.value.push(itemId)
|
|
21
|
+
function unregister() {
|
|
22
|
+
itemIds.value = itemIds.value.filter(id => id !== itemId)
|
|
23
|
+
if (activeItemId.value === itemId) {
|
|
24
|
+
activeItemId.value = null
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return { id: itemId, unregister }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function setActiveItemId(itemId: string) {
|
|
31
|
+
activeItemId.value = itemId
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface DockState {
|
|
35
|
+
activeItemId: Ref<string | null>
|
|
36
|
+
registerItem: () => { id: string; unregister: () => void }
|
|
37
|
+
setActiveItemId: (itemId: string) => void
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
provide<DockState>('dockState', {
|
|
41
|
+
activeItemId,
|
|
42
|
+
registerItem,
|
|
43
|
+
setActiveItemId,
|
|
44
|
+
})
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<div
|
|
49
|
+
class="dock"
|
|
50
|
+
:class="{
|
|
51
|
+
'dock-xl': xl || size === 'xl',
|
|
52
|
+
'dock-lg': lg || size === 'lg',
|
|
53
|
+
'dock-md': md || size === 'md',
|
|
54
|
+
'dock-sm': sm || size === 'sm',
|
|
55
|
+
'dock-xs': xs || size === 'xs',
|
|
56
|
+
}"
|
|
57
|
+
>
|
|
58
|
+
<slot />
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inject, onUnmounted } from 'vue'
|
|
3
|
+
import type { DockState } from './Dock.vue'
|
|
4
|
+
|
|
5
|
+
const { active } = defineProps<{
|
|
6
|
+
active?: boolean
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const { registerItem, setActiveItemId, activeItemId } = inject<DockState>('dockState')!
|
|
10
|
+
const { id: itemId, unregister } = registerItem()
|
|
11
|
+
|
|
12
|
+
onUnmounted(() => {
|
|
13
|
+
unregister()
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div
|
|
19
|
+
:id="`dock-item-${itemId}`"
|
|
20
|
+
class="dock-item"
|
|
21
|
+
:class="{ 'dock-active': active || activeItemId === itemId }"
|
|
22
|
+
@click="setActiveItemId(itemId)"
|
|
23
|
+
>
|
|
24
|
+
<slot />
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, watch } from 'vue'
|
|
3
|
-
import { createDrawerState } from '../utils/drawer-utils'
|
|
2
|
+
import { computed, watch } from 'vue';
|
|
3
|
+
import { createDrawerState } from '../utils/drawer-utils';
|
|
4
4
|
|
|
5
5
|
const props = withDefaults(defineProps<{
|
|
6
6
|
open?: boolean
|
|
@@ -16,16 +16,18 @@ const drawerState = createDrawerState(props.name)
|
|
|
16
16
|
watch(
|
|
17
17
|
() => props.open,
|
|
18
18
|
(value) => {
|
|
19
|
-
if (drawerState.isDrawerOpen !== value)
|
|
19
|
+
if (drawerState.isDrawerOpen !== value) {
|
|
20
20
|
drawerState.isDrawerOpen = value
|
|
21
|
+
}
|
|
21
22
|
},
|
|
22
23
|
{ immediate: true },
|
|
23
24
|
)
|
|
24
25
|
watch(
|
|
25
26
|
() => drawerState.isDrawerOpen,
|
|
26
27
|
(value) => {
|
|
27
|
-
if (props.open !== value)
|
|
28
|
+
if (props.open !== value) {
|
|
28
29
|
emit('update:open', value)
|
|
30
|
+
}
|
|
29
31
|
},
|
|
30
32
|
{ immediate: true },
|
|
31
33
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { onMounted, provide, reactive, ref } from 'vue'
|
|
3
2
|
import { autoUpdate, useFloating } from '@floating-ui/vue'
|
|
4
3
|
import { onClickOutside, syncRefs, useElementHover } from '@vueuse/core'
|
|
4
|
+
import { onMounted, provide, reactive, ref } from 'vue'
|
|
5
5
|
import { randomString } from '../utils/random-string'
|
|
6
6
|
|
|
7
7
|
const props = withDefaults(defineProps<{
|
|
@@ -25,7 +25,7 @@ const props = withDefaults(defineProps<{
|
|
|
25
25
|
closeOnClickOutside: true,
|
|
26
26
|
})
|
|
27
27
|
// Dropdown Visibility
|
|
28
|
-
const isOpen = defineModel('open'
|
|
28
|
+
const isOpen = defineModel('open')
|
|
29
29
|
provide('isDropdownOpen', isOpen)
|
|
30
30
|
|
|
31
31
|
const autoFocus = ref(props.autoFocus)
|
|
@@ -24,8 +24,9 @@ if (autoFocus.value) {
|
|
|
24
24
|
|
|
25
25
|
// hide the dropdown when the focus-trap drops focus (by pressing escape, for example)
|
|
26
26
|
watchEffect(() => {
|
|
27
|
-
if (!hasFocus.value)
|
|
27
|
+
if (!hasFocus.value) {
|
|
28
28
|
close()
|
|
29
|
+
}
|
|
29
30
|
})
|
|
30
31
|
}
|
|
31
32
|
// const { activate, deactivate, hasFocus } = useFocusTrap(contentEl, { immediate: true })
|
|
@@ -38,8 +39,7 @@ watchEffect(async () => {
|
|
|
38
39
|
await nextTick()
|
|
39
40
|
activate()
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
42
|
+
} else {
|
|
43
43
|
if (autoFocus.value) {
|
|
44
44
|
deactivate()
|
|
45
45
|
await nextTick()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { is = 'fieldset', legend } = defineProps<{
|
|
3
|
+
is?: string
|
|
4
|
+
legend?: string
|
|
5
|
+
}>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<component
|
|
10
|
+
:is="is"
|
|
11
|
+
class="fieldset bg-base-200 border-base-300 rounded-box border p-4"
|
|
12
|
+
>
|
|
13
|
+
<legend v-if="legend" class="fieldset-legend">
|
|
14
|
+
{{ legend }}
|
|
15
|
+
</legend>
|
|
16
|
+
<slot v-else name="legend" />
|
|
17
|
+
<slot />
|
|
18
|
+
</component>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
join?: boolean
|
|
4
|
+
|
|
5
|
+
color?: string
|
|
6
|
+
primary?: boolean
|
|
7
|
+
secondary?: boolean
|
|
8
|
+
accent?: boolean
|
|
9
|
+
info?: boolean
|
|
10
|
+
success?: boolean
|
|
11
|
+
warning?: boolean
|
|
12
|
+
error?: boolean
|
|
13
|
+
|
|
14
|
+
ghost?: boolean
|
|
15
|
+
disabled?: boolean
|
|
16
|
+
|
|
17
|
+
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
18
|
+
xl?: boolean
|
|
19
|
+
lg?: boolean
|
|
20
|
+
md?: boolean
|
|
21
|
+
sm?: boolean
|
|
22
|
+
xs?: boolean
|
|
23
|
+
}>()
|
|
24
|
+
defineEmits(['files'])
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<input
|
|
29
|
+
type="file"
|
|
30
|
+
:disabled="disabled"
|
|
31
|
+
class="file-input"
|
|
32
|
+
:class="{
|
|
33
|
+
'join-item': join,
|
|
34
|
+
|
|
35
|
+
'file-input-primary': primary || color === 'primary',
|
|
36
|
+
'file-input-secondary': secondary || color === 'secondary',
|
|
37
|
+
'file-input-accent': accent || color === 'accent',
|
|
38
|
+
'file-input-info': info || color === 'info',
|
|
39
|
+
'file-input-success': success || color === 'success',
|
|
40
|
+
'file-input-warning': warning || color === 'warning',
|
|
41
|
+
'file-input-error': error || color === 'error',
|
|
42
|
+
|
|
43
|
+
'file-input-xl': xl || size === 'xl',
|
|
44
|
+
'file-input-lg': lg || size === 'lg',
|
|
45
|
+
'file-input-md': md || size === 'md',
|
|
46
|
+
'file-input-sm': sm || size === 'sm',
|
|
47
|
+
'file-input-xs': xs || size === 'xs',
|
|
48
|
+
|
|
49
|
+
'file-input-ghost': ghost,
|
|
50
|
+
}"
|
|
51
|
+
@input="$emit('files', ($event.target as any).value)"
|
|
52
|
+
>
|
|
53
|
+
</template>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
interface FilterItem {
|
|
5
|
+
label: string
|
|
6
|
+
value: any
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type FilterItemInput = string | FilterItem
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(defineProps<{
|
|
12
|
+
is?: string
|
|
13
|
+
name: string
|
|
14
|
+
items: FilterItemInput[]
|
|
15
|
+
modelValue?: any
|
|
16
|
+
resetLabel?: string
|
|
17
|
+
position?: 'start' | 'end'
|
|
18
|
+
start?: boolean
|
|
19
|
+
end?: boolean
|
|
20
|
+
|
|
21
|
+
color?: string
|
|
22
|
+
neutral?: boolean
|
|
23
|
+
primary?: boolean
|
|
24
|
+
secondary?: boolean
|
|
25
|
+
accent?: boolean
|
|
26
|
+
info?: boolean
|
|
27
|
+
success?: boolean
|
|
28
|
+
warning?: boolean
|
|
29
|
+
error?: boolean
|
|
30
|
+
|
|
31
|
+
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
32
|
+
xl?: boolean
|
|
33
|
+
lg?: boolean
|
|
34
|
+
md?: boolean
|
|
35
|
+
sm?: boolean
|
|
36
|
+
xs?: boolean
|
|
37
|
+
}>(), {
|
|
38
|
+
resetLabel: 'All',
|
|
39
|
+
is: 'div',
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const emit = defineEmits(['update:modelValue'])
|
|
43
|
+
|
|
44
|
+
const currentValue = computed({
|
|
45
|
+
get: () => props.modelValue,
|
|
46
|
+
set(val) {
|
|
47
|
+
emit('update:modelValue', val)
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const normalizedItems = computed(() => {
|
|
52
|
+
return props.items.map((item) => {
|
|
53
|
+
if (typeof item === 'string') {
|
|
54
|
+
return { label: item, value: item }
|
|
55
|
+
}
|
|
56
|
+
return item
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<component :is="props.is" class="filter">
|
|
63
|
+
<!-- Reset button at start -->
|
|
64
|
+
<input
|
|
65
|
+
v-if="resetLabel && (start || position === 'start')"
|
|
66
|
+
v-model="currentValue"
|
|
67
|
+
class="btn filter-reset"
|
|
68
|
+
type="radio"
|
|
69
|
+
:class="{
|
|
70
|
+
'btn-xl': size === 'xl' || xl,
|
|
71
|
+
'btn-lg': size === 'lg' || lg,
|
|
72
|
+
'btn-md': size === 'md' || md,
|
|
73
|
+
'btn-sm': size === 'sm' || sm,
|
|
74
|
+
'btn-xs': size === 'xs' || xs,
|
|
75
|
+
}"
|
|
76
|
+
:name="name"
|
|
77
|
+
:aria-label="resetLabel"
|
|
78
|
+
:value="null"
|
|
79
|
+
>
|
|
80
|
+
|
|
81
|
+
<!-- Filter items -->
|
|
82
|
+
<template v-for="(item, index) in normalizedItems" :key="index">
|
|
83
|
+
<input
|
|
84
|
+
v-model="currentValue"
|
|
85
|
+
class="btn"
|
|
86
|
+
:class="{
|
|
87
|
+
'btn-neutral': color === 'neutral' || neutral,
|
|
88
|
+
'btn-primary': color === 'primary' || primary,
|
|
89
|
+
'btn-secondary': color === 'secondary' || secondary,
|
|
90
|
+
'btn-accent': color === 'accent' || accent,
|
|
91
|
+
'btn-info': color === 'info' || info,
|
|
92
|
+
'btn-success': color === 'success' || success,
|
|
93
|
+
'btn-warning': color === 'warning' || warning,
|
|
94
|
+
'btn-error': color === 'error' || error,
|
|
95
|
+
'btn-xl': size === 'xl' || xl,
|
|
96
|
+
'btn-lg': size === 'lg' || lg,
|
|
97
|
+
'btn-md': size === 'md' || md,
|
|
98
|
+
'btn-sm': size === 'sm' || sm,
|
|
99
|
+
'btn-xs': size === 'xs' || xs,
|
|
100
|
+
}"
|
|
101
|
+
type="radio"
|
|
102
|
+
:name="name"
|
|
103
|
+
:aria-label="item.label"
|
|
104
|
+
:value="item.value"
|
|
105
|
+
>
|
|
106
|
+
</template>
|
|
107
|
+
|
|
108
|
+
<!-- Reset button at end -->
|
|
109
|
+
<input
|
|
110
|
+
v-if="resetLabel && (end || position === 'end')"
|
|
111
|
+
v-model="currentValue"
|
|
112
|
+
class="btn filter-reset"
|
|
113
|
+
type="radio"
|
|
114
|
+
:name="name"
|
|
115
|
+
:aria-label="resetLabel"
|
|
116
|
+
:value="null"
|
|
117
|
+
>
|
|
118
|
+
|
|
119
|
+
<!-- Optional slot for custom items -->
|
|
120
|
+
<slot />
|
|
121
|
+
</component>
|
|
122
|
+
</template>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { is = 'div', ...props } = defineProps<{
|
|
3
|
+
is?: string | object
|
|
4
|
+
join?: boolean
|
|
5
|
+
|
|
6
|
+
// https://tailwindcss.com/docs/flex
|
|
7
|
+
flex?: boolean
|
|
8
|
+
flex1?: boolean
|
|
9
|
+
flexAuto?: boolean
|
|
10
|
+
flexInitial?: boolean
|
|
11
|
+
none?: boolean
|
|
12
|
+
|
|
13
|
+
// justify
|
|
14
|
+
justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly'
|
|
15
|
+
justifyStart?: boolean
|
|
16
|
+
justifyEnd?: boolean
|
|
17
|
+
justifyCenter?: boolean
|
|
18
|
+
justifyBetween?: boolean
|
|
19
|
+
justifyAround?: boolean
|
|
20
|
+
justifyEvenly?: boolean
|
|
21
|
+
|
|
22
|
+
// align
|
|
23
|
+
items?: 'start' | 'end' | 'center' | 'baseline' | 'stretch'
|
|
24
|
+
itemsStart?: boolean
|
|
25
|
+
itemsEnd?: boolean
|
|
26
|
+
itemsCenter?: boolean
|
|
27
|
+
itemsBaseline?: boolean
|
|
28
|
+
itemsStretch?: boolean
|
|
29
|
+
|
|
30
|
+
grow?: boolean
|
|
31
|
+
|
|
32
|
+
// https://tailwindcss.com/docs/flex-direction
|
|
33
|
+
direction?: 'row' | 'col' | 'row-reverse' | 'col-reverse'
|
|
34
|
+
row?: boolean
|
|
35
|
+
col?: boolean
|
|
36
|
+
reverse?: boolean
|
|
37
|
+
|
|
38
|
+
// https://tailwindcss.com/docs/flex-wrap
|
|
39
|
+
wrap?: boolean
|
|
40
|
+
nowrap?: boolean
|
|
41
|
+
wrapReverse?: boolean
|
|
42
|
+
}>()
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<component
|
|
47
|
+
:is="is" class="flex" :class="{
|
|
48
|
+
'join-item': props.join,
|
|
49
|
+
|
|
50
|
+
'flex-1': props.flex1,
|
|
51
|
+
'flex-auto': props.flexAuto,
|
|
52
|
+
'flex-initial': props.flexInitial,
|
|
53
|
+
'flex-none': props.none,
|
|
54
|
+
|
|
55
|
+
'justify-start': props.justifyStart,
|
|
56
|
+
'justify-end': props.justifyEnd,
|
|
57
|
+
'justify-center': props.justifyCenter,
|
|
58
|
+
'justify-between': props.justifyBetween,
|
|
59
|
+
'justify-around': props.justifyAround,
|
|
60
|
+
'justify-evenly': props.justifyEvenly,
|
|
61
|
+
|
|
62
|
+
'items-start': props.itemsStart,
|
|
63
|
+
'items-end': props.itemsEnd,
|
|
64
|
+
'items-center': props.itemsCenter,
|
|
65
|
+
'items-baseline': props.itemsBaseline,
|
|
66
|
+
'items-stretch': props.itemsStretch,
|
|
67
|
+
|
|
68
|
+
'flex-grow': props.grow,
|
|
69
|
+
|
|
70
|
+
'flex-row': props.direction === 'row' || props.row,
|
|
71
|
+
'flex-col': props.direction === 'col' || props.col,
|
|
72
|
+
'flex-row-reverse': props.direction === 'row-reverse' || (props.row && props.reverse),
|
|
73
|
+
'flex-col-reverse': props.direction === 'col-reverse' || (props.col && props.reverse),
|
|
74
|
+
|
|
75
|
+
'flex-wrap': props.wrap,
|
|
76
|
+
'flex-wrap-reverse': props.wrapReverse,
|
|
77
|
+
'flex-nowrap': props.nowrap,
|
|
78
|
+
}"
|
|
79
|
+
>
|
|
80
|
+
<slot />
|
|
81
|
+
</component>
|
|
82
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Text from './Text.vue';
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
center?: boolean
|
|
6
|
+
is?: string
|
|
7
|
+
orientation?: 'horizontal' | 'vertical'
|
|
8
|
+
horizontal?: boolean
|
|
9
|
+
vertical?: boolean
|
|
10
|
+
}>(), {
|
|
11
|
+
center: false,
|
|
12
|
+
is: 'footer',
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<Text
|
|
18
|
+
:is="is" class="footer"
|
|
19
|
+
:class="{
|
|
20
|
+
'divider-center': props.center,
|
|
21
|
+
'divider-horizontal': props.horizontal || props.orientation === 'horizontal',
|
|
22
|
+
'divider-vertical': props.vertical || props.orientation === 'vertical',
|
|
23
|
+
}"
|
|
24
|
+
>
|
|
25
|
+
<slot />
|
|
26
|
+
</Text>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { syncRef } from '@vueuse/core'
|
|
3
|
+
import { computed, inject, ref } from 'vue'
|
|
4
|
+
|
|
5
|
+
// Map input type to value type
|
|
6
|
+
type InputType =
|
|
7
|
+
| 'text' | 'password' | 'email' | 'number' | 'date' | 'datetime-local' | 'week' | 'month' | 'tel' | 'url' | 'search' | 'time'
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<{
|
|
10
|
+
modelValue?: string | number | null
|
|
11
|
+
type?: InputType
|
|
12
|
+
placeholder?: string
|
|
13
|
+
disabled?: boolean
|
|
14
|
+
validator?: boolean
|
|
15
|
+
join?: boolean
|
|
16
|
+
color?: string
|
|
17
|
+
primary?: boolean
|
|
18
|
+
secondary?: boolean
|
|
19
|
+
accent?: boolean
|
|
20
|
+
info?: boolean
|
|
21
|
+
success?: boolean
|
|
22
|
+
warning?: boolean
|
|
23
|
+
error?: boolean
|
|
24
|
+
ghost?: boolean
|
|
25
|
+
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
26
|
+
xl?: boolean
|
|
27
|
+
lg?: boolean
|
|
28
|
+
md?: boolean
|
|
29
|
+
sm?: boolean
|
|
30
|
+
xs?: boolean
|
|
31
|
+
}>(), {
|
|
32
|
+
type: 'text',
|
|
33
|
+
})
|
|
34
|
+
const emit = defineEmits(['update:modelValue'])
|
|
35
|
+
|
|
36
|
+
// For slot context
|
|
37
|
+
function setValue(val: string | number | null) {
|
|
38
|
+
emit('update:modelValue', val)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const labelCtx = inject('labelCtx')
|
|
42
|
+
|
|
43
|
+
function handleInput(event: Event) {
|
|
44
|
+
let val: string | number | null
|
|
45
|
+
if (props.type === 'number') {
|
|
46
|
+
const inputVal = (event.target as HTMLInputElement).value
|
|
47
|
+
val = inputVal === '' ? null : Number(inputVal)
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
val = (event.target as HTMLInputElement).value
|
|
51
|
+
}
|
|
52
|
+
emit('update:modelValue', val)
|
|
53
|
+
|
|
54
|
+
// Sync checked only on input if it's a checkbox
|
|
55
|
+
if (
|
|
56
|
+
props.type === 'checkbox'
|
|
57
|
+
&& labelCtx
|
|
58
|
+
&& Object.prototype.hasOwnProperty.call(labelCtx, 'checked')
|
|
59
|
+
&& typeof labelCtx.checked.value === 'boolean'
|
|
60
|
+
) {
|
|
61
|
+
labelCtx.checked.value = Boolean(event.target.checked)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const inputAttrs = computed(() => {
|
|
66
|
+
if (labelCtx) {
|
|
67
|
+
return {
|
|
68
|
+
type: props.type,
|
|
69
|
+
placeholder: props.placeholder,
|
|
70
|
+
disabled: props.disabled,
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
type: props.type,
|
|
75
|
+
placeholder: props.placeholder,
|
|
76
|
+
disabled: props.disabled,
|
|
77
|
+
class: [
|
|
78
|
+
'input',
|
|
79
|
+
{ validator: props.validator },
|
|
80
|
+
{ 'input-primary': props.primary || props.color === 'primary' },
|
|
81
|
+
{ 'input-secondary': props.secondary || props.color === 'secondary' },
|
|
82
|
+
{ 'input-accent': props.accent || props.color === 'accent' },
|
|
83
|
+
{ 'input-info': props.info || props.color === 'info' },
|
|
84
|
+
{ 'input-success': props.success || props.color === 'success' },
|
|
85
|
+
{ 'input-warning': props.warning || props.color === 'warning' },
|
|
86
|
+
{ 'input-error': props.error || props.color === 'error' },
|
|
87
|
+
{ 'input-ghost': props.ghost },
|
|
88
|
+
{ 'input-xl': props.xl || props.size === 'xl' },
|
|
89
|
+
{ 'input-lg': props.lg || props.size === 'lg' },
|
|
90
|
+
{ 'input-md': props.md || props.size === 'md' },
|
|
91
|
+
{ 'input-sm': props.sm || props.size === 'sm' },
|
|
92
|
+
{ 'input-xs': props.xs || props.size === 'xs' },
|
|
93
|
+
{ 'join-item': props.join },
|
|
94
|
+
],
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
const inputModel = computed({
|
|
98
|
+
get: () => props.modelValue,
|
|
99
|
+
set: setValue,
|
|
100
|
+
})
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<div v-if="$slots.default">
|
|
105
|
+
<slot
|
|
106
|
+
:value="inputModel"
|
|
107
|
+
:set-value="setValue"
|
|
108
|
+
:input-attrs="inputAttrs"
|
|
109
|
+
:props="props"
|
|
110
|
+
:input-model="inputModel"
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
<input
|
|
114
|
+
v-else
|
|
115
|
+
v-bind="inputAttrs"
|
|
116
|
+
:value="inputModel"
|
|
117
|
+
@input="handleInput"
|
|
118
|
+
>
|
|
119
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
4
|
+
xl?: boolean
|
|
5
|
+
lg?: boolean
|
|
6
|
+
md?: boolean
|
|
7
|
+
sm?: boolean
|
|
8
|
+
xs?: boolean
|
|
9
|
+
}>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<kbd
|
|
14
|
+
class="kbd" :class="{
|
|
15
|
+
'kbd-xl': xl || size === 'xl',
|
|
16
|
+
'kbd-lg': lg || size === 'lg',
|
|
17
|
+
'kbd-md': md || size === 'md',
|
|
18
|
+
'kbd-sm': sm || size === 'sm',
|
|
19
|
+
'kbd-xs': xs || size === 'xs',
|
|
20
|
+
}"
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</kbd>
|
|
24
|
+
</template>
|