daisy-ui-kit 5.0.0-pre.3 → 5.0.0-pre.31
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 +76 -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 +140 -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,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
orientation?: 'vertical' | 'horizontal'
|
|
4
|
+
vertical?: boolean
|
|
5
|
+
horizontal?: boolean
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div
|
|
11
|
+
class="stat"
|
|
12
|
+
:class="{
|
|
13
|
+
'stat-vertical': vertical || orientation === 'vertical',
|
|
14
|
+
'stat-horizontal': horizontal || orientation === 'horizontal',
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'
|
|
4
|
+
neutral?: boolean
|
|
5
|
+
primary?: boolean
|
|
6
|
+
secondary?: boolean
|
|
7
|
+
accent?: boolean
|
|
8
|
+
info?: boolean
|
|
9
|
+
success?: boolean
|
|
10
|
+
warning?: boolean
|
|
11
|
+
error?: boolean
|
|
12
|
+
|
|
13
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
14
|
+
xs?: boolean
|
|
15
|
+
sm?: boolean
|
|
16
|
+
md?: boolean
|
|
17
|
+
lg?: boolean
|
|
18
|
+
xl?: boolean
|
|
19
|
+
}>()
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<span
|
|
24
|
+
class="status"
|
|
25
|
+
:class="[
|
|
26
|
+
neutral || color === 'neutral' ? 'status-neutral' : '',
|
|
27
|
+
primary || color === 'primary' ? 'status-primary' : '',
|
|
28
|
+
secondary || color === 'secondary' ? 'status-secondary' : '',
|
|
29
|
+
accent || color === 'accent' ? 'status-accent' : '',
|
|
30
|
+
info || color === 'info' ? 'status-info' : '',
|
|
31
|
+
success || color === 'success' ? 'status-success' : '',
|
|
32
|
+
warning || color === 'warning' ? 'status-warning' : '',
|
|
33
|
+
error || color === 'error' ? 'status-error' : '',
|
|
34
|
+
xs || size === 'xs' ? 'status-xs' : '',
|
|
35
|
+
sm || size === 'sm' ? 'status-sm' : '',
|
|
36
|
+
md || size === 'md' || (!xs && !sm && !lg && !xl && !size) ? 'status-md' : '',
|
|
37
|
+
lg || size === 'lg' ? 'status-lg' : '',
|
|
38
|
+
xl || size === 'xl' ? 'status-xl' : '',
|
|
39
|
+
]"
|
|
40
|
+
>
|
|
41
|
+
<slot />
|
|
42
|
+
</span>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
glyph?: string
|
|
4
|
+
|
|
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
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<li
|
|
19
|
+
class="step"
|
|
20
|
+
:class="{
|
|
21
|
+
'step-neutral': props.neutral || props.color === 'neutral',
|
|
22
|
+
'step-primary': props.primary || props.color === 'primary',
|
|
23
|
+
'step-secondary': props.secondary || props.color === 'secondary',
|
|
24
|
+
'step-accent': props.accent || props.color === 'accent',
|
|
25
|
+
'step-info': props.info || props.color === 'info',
|
|
26
|
+
'step-success': props.success || props.color === 'success',
|
|
27
|
+
'step-warning': props.warning || props.color === 'warning',
|
|
28
|
+
'step-error': props.error || props.color === 'error',
|
|
29
|
+
}"
|
|
30
|
+
:data-content="glyph"
|
|
31
|
+
>
|
|
32
|
+
<slot />
|
|
33
|
+
</li>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const {
|
|
3
|
+
orientation,
|
|
4
|
+
vertical = false,
|
|
5
|
+
horizontal = false,
|
|
6
|
+
} = defineProps<{
|
|
7
|
+
orientation?: 'vertical' | 'horizontal'
|
|
8
|
+
vertical?: boolean
|
|
9
|
+
horizontal?: boolean
|
|
10
|
+
}>()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<ul
|
|
15
|
+
class="steps"
|
|
16
|
+
:class="{
|
|
17
|
+
'steps-vertical': orientation === 'vertical' || vertical,
|
|
18
|
+
'steps-horizontal': orientation === 'horizontal' || horizontal,
|
|
19
|
+
}"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</ul>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { nextTick, ref, watch } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
modelValue?: boolean | null
|
|
6
|
+
rotate?: boolean
|
|
7
|
+
flip?: boolean
|
|
8
|
+
}>()
|
|
9
|
+
const emit = defineEmits(['update:modelValue'])
|
|
10
|
+
|
|
11
|
+
const checkbox = ref<HTMLInputElement | null>(null)
|
|
12
|
+
|
|
13
|
+
// Keep the checkbox's indeterminate property in sync with modelValue
|
|
14
|
+
watch(
|
|
15
|
+
() => props.modelValue,
|
|
16
|
+
val => {
|
|
17
|
+
nextTick(() => {
|
|
18
|
+
if (checkbox.value) {
|
|
19
|
+
checkbox.value.indeterminate = val === null
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
{ immediate: true },
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
function updateValue(event: Event) {
|
|
27
|
+
const input = event.target as HTMLInputElement
|
|
28
|
+
// If indeterminate, toggle to checked
|
|
29
|
+
if (props.modelValue === null) {
|
|
30
|
+
emit('update:modelValue', true)
|
|
31
|
+
} else {
|
|
32
|
+
emit('update:modelValue', input.checked)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<label
|
|
39
|
+
class="swap"
|
|
40
|
+
:class="{
|
|
41
|
+
'swap-rotate': rotate,
|
|
42
|
+
'swap-flip': flip,
|
|
43
|
+
}"
|
|
44
|
+
>
|
|
45
|
+
<input ref="checkbox" type="checkbox" :checked="modelValue === true" @change="updateValue" />
|
|
46
|
+
<div class="swap-indeterminate">
|
|
47
|
+
<slot name="indeterminate" />
|
|
48
|
+
</div>
|
|
49
|
+
<div class="swap-on">
|
|
50
|
+
<slot name="swap" />
|
|
51
|
+
</div>
|
|
52
|
+
<div class="swap-off">
|
|
53
|
+
<slot />
|
|
54
|
+
</div>
|
|
55
|
+
</label>
|
|
56
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject, resolveComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
is = 'label',
|
|
10
|
+
name,
|
|
11
|
+
...props
|
|
12
|
+
} = defineProps<{
|
|
13
|
+
is?: string
|
|
14
|
+
name?: string
|
|
15
|
+
active?: boolean
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
}>()
|
|
18
|
+
|
|
19
|
+
const NuxtLink = resolveComponent('NuxtLink')
|
|
20
|
+
const RouterLink = resolveComponent('RouterLink')
|
|
21
|
+
|
|
22
|
+
const resolvedComponent = computed(() => {
|
|
23
|
+
if (is === 'NuxtLink') return NuxtLink
|
|
24
|
+
if (is === 'RouterLink') return RouterLink
|
|
25
|
+
return is
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const tabManager: any = inject('tabManager')
|
|
29
|
+
if (!tabManager.currentTab.value) {
|
|
30
|
+
tabManager.currentTab.value = name
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<component
|
|
36
|
+
:is="resolvedComponent"
|
|
37
|
+
v-bind="$attrs"
|
|
38
|
+
class="tab"
|
|
39
|
+
:class="{
|
|
40
|
+
'tab-active': props.active || tabManager.currentTab.value === name,
|
|
41
|
+
'tab-disabled': props.disabled,
|
|
42
|
+
}"
|
|
43
|
+
@keypress.enter="() => (tabManager.currentTab.value = name)"
|
|
44
|
+
>
|
|
45
|
+
<input
|
|
46
|
+
type="radio"
|
|
47
|
+
:name="tabManager.name"
|
|
48
|
+
:value="name"
|
|
49
|
+
:checked="tabManager.currentTab.value === name"
|
|
50
|
+
@change="() => (tabManager.currentTab.value = name)"
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
<slot v-if="$slots.default" />
|
|
54
|
+
<span v-else>{{ name }}</span>
|
|
55
|
+
</component>
|
|
56
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject } from 'vue'
|
|
3
|
+
|
|
4
|
+
const { is = 'div', name } = defineProps<{
|
|
5
|
+
is?: any
|
|
6
|
+
name: string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const tabManager: any = inject('tabManager')
|
|
10
|
+
|
|
11
|
+
const isCurrentTab = computed(() => {
|
|
12
|
+
return tabManager.currentTab.value === name
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
if (!tabManager?.currentTab.value) {
|
|
16
|
+
tabManager.currentTab.value = name
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const existing = tabManager?.tabs?.find((t: string) => t === name)
|
|
20
|
+
if (!existing) {
|
|
21
|
+
tabManager.tabs.push(name)
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<component :is="is" v-show="isCurrentTab" class="tab-content">
|
|
27
|
+
<slot />
|
|
28
|
+
</component>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
zebra?: boolean
|
|
4
|
+
pinRows?: boolean
|
|
5
|
+
pinCols?: boolean
|
|
6
|
+
|
|
7
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
8
|
+
xs?: boolean
|
|
9
|
+
sm?: boolean
|
|
10
|
+
md?: boolean
|
|
11
|
+
lg?: boolean
|
|
12
|
+
xl?: boolean
|
|
13
|
+
}>()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<table
|
|
18
|
+
class="table"
|
|
19
|
+
:class="[
|
|
20
|
+
zebra ? 'table-zebra' : '',
|
|
21
|
+
pinRows ? 'table-pin-rows' : '',
|
|
22
|
+
pinCols ? 'table-pin-cols' : '',
|
|
23
|
+
xs || size === 'xs' ? 'table-xs' : '',
|
|
24
|
+
sm || size === 'sm' ? 'table-sm' : '',
|
|
25
|
+
md || size === 'md' || (!xs && !sm && !lg && !xl && !size) ? 'table-md' : '',
|
|
26
|
+
lg || size === 'lg' ? 'table-lg' : '',
|
|
27
|
+
xl || size === 'xl' ? 'table-xl' : '',
|
|
28
|
+
]"
|
|
29
|
+
>
|
|
30
|
+
<slot />
|
|
31
|
+
</table>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { provide } from 'vue'
|
|
3
|
+
|
|
4
|
+
const { name } = defineProps<{
|
|
5
|
+
is?: any
|
|
6
|
+
name: string
|
|
7
|
+
|
|
8
|
+
variant?: 'box' | 'border' | 'lift'
|
|
9
|
+
box?: boolean
|
|
10
|
+
border?: boolean
|
|
11
|
+
lift?: boolean
|
|
12
|
+
|
|
13
|
+
placement?: 'top' | 'bottom'
|
|
14
|
+
top?: boolean
|
|
15
|
+
bottom?: 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
|
+
|
|
25
|
+
const currentTab = defineModel<string>('currentTab')
|
|
26
|
+
|
|
27
|
+
const tabManager = {
|
|
28
|
+
name,
|
|
29
|
+
currentTab,
|
|
30
|
+
tabs: [],
|
|
31
|
+
}
|
|
32
|
+
provide('tabManager', tabManager)
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<div
|
|
37
|
+
class="tabs"
|
|
38
|
+
:class="{
|
|
39
|
+
'tabs-box': variant === 'box' || box,
|
|
40
|
+
'tabs-border': variant === 'border' || border,
|
|
41
|
+
'tabs-lift': variant === 'lift' || lift,
|
|
42
|
+
'tabs-top': placement === 'top' || top,
|
|
43
|
+
'tabs-bottom': placement === 'bottom' || bottom,
|
|
44
|
+
'tabs-xl': size === 'xl' || xl,
|
|
45
|
+
'tabs-lg': size === 'lg' || lg,
|
|
46
|
+
'tabs-md': size === 'md' || md,
|
|
47
|
+
'tabs-sm': size === 'sm' || sm,
|
|
48
|
+
'tabs-xs': size === 'xs' || xs,
|
|
49
|
+
}"
|
|
50
|
+
>
|
|
51
|
+
<slot />
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, resolveComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
is?: string
|
|
10
|
+
join?: boolean
|
|
11
|
+
|
|
12
|
+
block?: boolean
|
|
13
|
+
inline?: boolean
|
|
14
|
+
inlineBlock?: boolean
|
|
15
|
+
label?: boolean
|
|
16
|
+
|
|
17
|
+
color?:
|
|
18
|
+
| 'neutral'
|
|
19
|
+
| 'primary'
|
|
20
|
+
| 'secondary'
|
|
21
|
+
| 'accent'
|
|
22
|
+
| 'info'
|
|
23
|
+
| 'success'
|
|
24
|
+
| 'warning'
|
|
25
|
+
| 'error'
|
|
26
|
+
| 'primary-content'
|
|
27
|
+
| 'secondary-content'
|
|
28
|
+
| 'neutral-content'
|
|
29
|
+
| 'accent-content'
|
|
30
|
+
| 'info-content'
|
|
31
|
+
| 'success-content'
|
|
32
|
+
| 'warning-content'
|
|
33
|
+
| 'error-content'
|
|
34
|
+
neutral?: boolean
|
|
35
|
+
primary?: boolean
|
|
36
|
+
secondary?: boolean
|
|
37
|
+
accent?: boolean
|
|
38
|
+
info?: boolean
|
|
39
|
+
success?: boolean
|
|
40
|
+
warning?: boolean
|
|
41
|
+
error?: boolean
|
|
42
|
+
neutralContent?: boolean
|
|
43
|
+
primaryContent?: boolean
|
|
44
|
+
secondaryContent?: boolean
|
|
45
|
+
accentContent?: boolean
|
|
46
|
+
infoContent?: boolean
|
|
47
|
+
successContent?: boolean
|
|
48
|
+
warningContent?: boolean
|
|
49
|
+
errorContent?: boolean
|
|
50
|
+
|
|
51
|
+
size?: '9xl' | '8xl' | '7xl' | '6xl' | '5xl' | '4xl' | '3xl' | '2xl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
52
|
+
xl?: boolean
|
|
53
|
+
lg?: boolean
|
|
54
|
+
md?: boolean
|
|
55
|
+
sm?: boolean
|
|
56
|
+
xs?: boolean
|
|
57
|
+
|
|
58
|
+
align?: 'left' | 'center' | 'right' | 'justify'
|
|
59
|
+
left?: boolean
|
|
60
|
+
center?: boolean
|
|
61
|
+
right?: boolean
|
|
62
|
+
justify?: boolean
|
|
63
|
+
|
|
64
|
+
case?: 'upper' | 'lower' | 'capitalize' | 'normal'
|
|
65
|
+
uppercase?: boolean
|
|
66
|
+
lowercase?: boolean
|
|
67
|
+
capitalize?: boolean
|
|
68
|
+
normalCase?: boolean
|
|
69
|
+
|
|
70
|
+
font?: 'sans' | 'serif' | 'mono'
|
|
71
|
+
sans?: boolean
|
|
72
|
+
serif?: boolean
|
|
73
|
+
mono?: boolean
|
|
74
|
+
|
|
75
|
+
weight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black'
|
|
76
|
+
thin?: boolean
|
|
77
|
+
extralight?: boolean
|
|
78
|
+
light?: boolean
|
|
79
|
+
normal?: boolean
|
|
80
|
+
medium?: boolean
|
|
81
|
+
semibold?: boolean
|
|
82
|
+
bold?: boolean
|
|
83
|
+
extrabold?: boolean
|
|
84
|
+
black?: boolean
|
|
85
|
+
}>()
|
|
86
|
+
const NuxtLink = resolveComponent('NuxtLink')
|
|
87
|
+
const RouterLink = resolveComponent('RouterLink')
|
|
88
|
+
|
|
89
|
+
const resolvedComponent = computed(() => {
|
|
90
|
+
if (props.is === 'NuxtLink') return NuxtLink
|
|
91
|
+
if (props.is === 'RouterLink') return RouterLink
|
|
92
|
+
return props.is || 'span'
|
|
93
|
+
})
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<template>
|
|
97
|
+
<component
|
|
98
|
+
:is="resolvedComponent"
|
|
99
|
+
v-bind="{ ...$attrs, ...(label ? { 'data-role': 'label' } : {}) }"
|
|
100
|
+
:class="{
|
|
101
|
+
'join-item': join,
|
|
102
|
+
|
|
103
|
+
block,
|
|
104
|
+
inline,
|
|
105
|
+
'inline-block': inlineBlock,
|
|
106
|
+
label,
|
|
107
|
+
|
|
108
|
+
'text-primary': primary || color === 'primary',
|
|
109
|
+
'text-primary-content': primaryContent || color === 'primary-content',
|
|
110
|
+
'text-secondary': secondary || color === 'secondary',
|
|
111
|
+
'text-secondary-content': secondaryContent || color === 'secondary-content',
|
|
112
|
+
'text-neutral': neutral || color === 'neutral',
|
|
113
|
+
'text-neutral-content': neutralContent || color === 'neutral-content',
|
|
114
|
+
'text-accent': accent || color === 'accent',
|
|
115
|
+
'text-accent-content': accentContent || color === 'accent-content',
|
|
116
|
+
'text-info': info || color === 'info',
|
|
117
|
+
'text-info-content': infoContent || color === 'info-content',
|
|
118
|
+
'text-success': success || color === 'success',
|
|
119
|
+
'text-success-content': successContent || color === 'success-content',
|
|
120
|
+
'text-warning': warning || color === 'warning',
|
|
121
|
+
'text-warning-content': warningContent || color === 'warning-content',
|
|
122
|
+
'text-error': error || color === 'error',
|
|
123
|
+
'text-error-content': errorContent || color === 'error-content',
|
|
124
|
+
|
|
125
|
+
'text-9xl': size === '9xl',
|
|
126
|
+
'text-8xl': size === '8xl',
|
|
127
|
+
'text-7xl': size === '7xl',
|
|
128
|
+
'text-6xl': size === '6xl',
|
|
129
|
+
'text-5xl': size === '5xl',
|
|
130
|
+
'text-4xl': size === '4xl',
|
|
131
|
+
'text-3xl': size === '3xl',
|
|
132
|
+
'text-2xl': size === '2xl',
|
|
133
|
+
'text-xl': xl || size === 'xl',
|
|
134
|
+
'text-lg': lg || size === 'lg',
|
|
135
|
+
'text-md': md || size === 'md',
|
|
136
|
+
'text-sm': sm || size === 'sm',
|
|
137
|
+
'text-xs': xs || size === 'xs',
|
|
138
|
+
|
|
139
|
+
'text-left': left || align === 'left',
|
|
140
|
+
'text-center': center || align === 'center',
|
|
141
|
+
'text-right': right || align === 'right',
|
|
142
|
+
'text-justify': justify || align === 'justify',
|
|
143
|
+
|
|
144
|
+
uppercase: uppercase || props.case === 'upper',
|
|
145
|
+
lowercase: lowercase || props.case === 'lower',
|
|
146
|
+
capitalize: capitalize || props.case === 'capitalize',
|
|
147
|
+
'normal-case': normalCase || props.case === 'normal',
|
|
148
|
+
|
|
149
|
+
'font-sans': sans || font === 'sans',
|
|
150
|
+
'font-serif': serif || font === 'serif',
|
|
151
|
+
'font-mono': mono || font === 'mono',
|
|
152
|
+
|
|
153
|
+
'font-thin': thin || weight === 'thin',
|
|
154
|
+
'font-extralight': extralight || weight === 'extralight',
|
|
155
|
+
'font-light': light || weight === 'light',
|
|
156
|
+
'font-normal': normal || weight === 'normal',
|
|
157
|
+
'font-medium': medium || weight === 'medium',
|
|
158
|
+
'font-semibold': semibold || weight === 'semibold',
|
|
159
|
+
'font-bold': bold || weight === 'bold',
|
|
160
|
+
'font-extrabold': extrabold || weight === 'extrabold',
|
|
161
|
+
'font-black': black || weight === 'black',
|
|
162
|
+
}"
|
|
163
|
+
>
|
|
164
|
+
<slot />
|
|
165
|
+
</component>
|
|
166
|
+
</template>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { nextTick, onMounted, ref, watch } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(
|
|
5
|
+
defineProps<{
|
|
6
|
+
modelValue?: string
|
|
7
|
+
placeholder?: string
|
|
8
|
+
type?: 'text' | 'phone' | 'email' | 'search'
|
|
9
|
+
rows?: number
|
|
10
|
+
autoExpand?: boolean
|
|
11
|
+
|
|
12
|
+
color?: string
|
|
13
|
+
neutral?: boolean
|
|
14
|
+
primary?: boolean
|
|
15
|
+
secondary?: boolean
|
|
16
|
+
accent?: boolean
|
|
17
|
+
info?: boolean
|
|
18
|
+
success?: boolean
|
|
19
|
+
warning?: boolean
|
|
20
|
+
error?: boolean
|
|
21
|
+
|
|
22
|
+
ghost?: boolean
|
|
23
|
+
disabled?: boolean
|
|
24
|
+
validator?: boolean
|
|
25
|
+
|
|
26
|
+
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
27
|
+
xl?: boolean
|
|
28
|
+
lg?: boolean
|
|
29
|
+
md?: boolean
|
|
30
|
+
sm?: boolean
|
|
31
|
+
xs?: boolean
|
|
32
|
+
}>(),
|
|
33
|
+
{
|
|
34
|
+
type: 'text',
|
|
35
|
+
rows: 2,
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
defineEmits(['update:modelValue'])
|
|
39
|
+
|
|
40
|
+
const textareaRef = ref<HTMLTextAreaElement | null>(null)
|
|
41
|
+
|
|
42
|
+
let minHeight = 0
|
|
43
|
+
|
|
44
|
+
function adjustHeight() {
|
|
45
|
+
if (!props.autoExpand || !textareaRef.value) return
|
|
46
|
+
const el = textareaRef.value
|
|
47
|
+
|
|
48
|
+
// Capture the initial rendered height as minimum (respects rows attribute)
|
|
49
|
+
if (minHeight === 0) {
|
|
50
|
+
minHeight = el.offsetHeight
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
el.style.height = 'auto'
|
|
54
|
+
el.style.height = `${Math.max(el.scrollHeight, minHeight)}px`
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
watch(
|
|
58
|
+
() => props.modelValue,
|
|
59
|
+
() => {
|
|
60
|
+
nextTick(adjustHeight)
|
|
61
|
+
},
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
onMounted(() => {
|
|
65
|
+
if (props.autoExpand) {
|
|
66
|
+
nextTick(adjustHeight)
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<textarea
|
|
73
|
+
ref="textareaRef"
|
|
74
|
+
:value="modelValue"
|
|
75
|
+
:type="type"
|
|
76
|
+
:rows="rows"
|
|
77
|
+
:placeholder="placeholder"
|
|
78
|
+
:disabled="disabled"
|
|
79
|
+
class="textarea"
|
|
80
|
+
:class="{
|
|
81
|
+
'textarea-neutral': props.neutral || props.color === 'neutral',
|
|
82
|
+
'textarea-primary': props.primary || props.color === 'primary',
|
|
83
|
+
'textarea-secondary': props.secondary || props.color === 'secondary',
|
|
84
|
+
'textarea-accent': props.accent || props.color === 'accent',
|
|
85
|
+
'textarea-info': props.info || props.color === 'info',
|
|
86
|
+
'textarea-success': props.success || props.color === 'success',
|
|
87
|
+
'textarea-warning': props.warning || props.color === 'warning',
|
|
88
|
+
'textarea-error': props.error || props.color === 'error',
|
|
89
|
+
|
|
90
|
+
'textarea-ghost': props.ghost,
|
|
91
|
+
validator: props.validator,
|
|
92
|
+
|
|
93
|
+
'textarea-xl': props.xl || props.size === 'xl',
|
|
94
|
+
'textarea-lg': props.lg || props.size === 'lg',
|
|
95
|
+
'textarea-md': props.md || props.size === 'md',
|
|
96
|
+
'textarea-sm': props.sm || props.size === 'sm',
|
|
97
|
+
'textarea-xs': props.xs || props.size === 'xs',
|
|
98
|
+
}"
|
|
99
|
+
@input="
|
|
100
|
+
event => {
|
|
101
|
+
$emit('update:modelValue', (event.target as HTMLTextAreaElement).value)
|
|
102
|
+
adjustHeight()
|
|
103
|
+
}
|
|
104
|
+
"
|
|
105
|
+
/>
|
|
106
|
+
</template>
|