daisy-ui-kit 5.0.0-pre.4 → 5.0.0-pre.6
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 +26 -0
- 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/Breadcrumbs.vue +7 -0
- package/app/components/Button.vue +113 -0
- package/app/components/Calendar.vue +66 -0
- package/app/components/CalendarInput.vue +176 -0
- package/app/components/CalendarSkeleton.vue +46 -0
- package/app/components/Card.vue +33 -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 +23 -0
- package/app/components/CarouselItem.vue +5 -0
- package/app/components/Chat.vue +21 -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 +49 -0
- package/app/components/Collapse.vue +43 -0
- package/app/components/CollapseContent.vue +5 -0
- package/app/components/CollapseTitle.vue +5 -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/Crumb.vue +5 -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 +58 -0
- package/app/components/DockItem.vue +25 -0
- package/app/components/DockLabel.vue +5 -0
- package/app/components/Drawer.vue +47 -0
- package/app/components/DrawerContent.vue +17 -0
- package/app/components/DrawerSide.vue +18 -0
- package/app/components/Dropdown.vue +95 -0
- package/app/components/DropdownButton.vue +16 -0
- package/app/components/DropdownContent.vue +57 -0
- package/app/components/DropdownTarget.vue +14 -0
- 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/app/components/FlexItem.vue +59 -0
- package/app/components/Footer.vue +27 -0
- package/app/components/FooterTitle.vue +15 -0
- package/app/components/FormControl.vue +5 -0
- package/app/components/Hero.vue +15 -0
- package/app/components/HeroContent.vue +15 -0
- package/app/components/HeroOverlay.vue +5 -0
- package/app/components/Indicator.vue +13 -0
- package/app/components/IndicatorItem.vue +36 -0
- package/app/components/Input.vue +102 -0
- package/app/components/Join.vue +5 -0
- package/app/components/Kbd.vue +24 -0
- package/app/components/Label.vue +61 -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 +100 -0
- package/app/components/MenuExpandToggle.vue +14 -0
- package/app/components/MenuItem.vue +37 -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 +8 -0
- package/app/components/MockupWindow.vue +5 -0
- package/app/components/Modal.vue +57 -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 +34 -0
- package/app/components/Prose.vue +32 -0
- package/app/components/RadialProgress.vue +36 -0
- package/app/components/Radio.vue +67 -0
- package/app/components/RadioGroup.vue +47 -0
- package/app/components/Range.vue +61 -0
- package/app/components/RangeMeasure.vue +84 -0
- package/app/components/RangeMeasureTick.vue +70 -0
- package/app/components/Rating.vue +180 -0
- package/app/components/Select.vue +104 -0
- package/app/components/Skeleton.vue +5 -0
- package/app/components/Stack.vue +25 -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 +18 -0
- package/app/components/Swap.vue +62 -0
- package/app/components/Tab.vue +38 -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 +142 -0
- package/app/components/TextArea.vue +61 -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 +29 -0
- package/app/components/Toggle.vue +58 -0
- package/app/components/Tooltip.vue +47 -0
- package/app/components/TooltipContent.vue +5 -0
- package/app/components/ValidatorHint.vue +5 -0
- package/app/utils/drawer-utils.ts +32 -0
- package/app/utils/random-string.ts +19 -0
- package/nuxt.js +22 -0
- package/package.json +5 -4
|
@@ -0,0 +1,37 @@
|
|
|
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, .menu-item.menu-active > span {
|
|
19
|
+
background-color: hsl(var(--n) / var(--tw-bg-opacity));
|
|
20
|
+
color: hsl(var(--nc) / var(--tw-text-opacity));
|
|
21
|
+
}
|
|
22
|
+
.menu-item.menu-disabled > a, .menu-item.menu-disabled > span {
|
|
23
|
+
background-color: var(--n)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Fix padding when putting a Dropdown inside of a menu */
|
|
27
|
+
.menu-item > .floating-dropdown {
|
|
28
|
+
padding: 0;
|
|
29
|
+
}
|
|
30
|
+
.menu-item > .floating-dropdown > .dropdown-button,
|
|
31
|
+
.menu-item > .floating-dropdown > .dropdown-target {
|
|
32
|
+
padding-left: 1rem;
|
|
33
|
+
padding-right: 1rem;
|
|
34
|
+
padding-top: 0.5rem;
|
|
35
|
+
padding-bottom: 0.5rem
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, watch } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
modelValue?: boolean
|
|
6
|
+
closeOnClickOutside?: boolean
|
|
7
|
+
placement?: 'top' | 'bottom' | 'start' | 'end'
|
|
8
|
+
top?: boolean
|
|
9
|
+
bottom?: boolean
|
|
10
|
+
start?: boolean
|
|
11
|
+
end?: boolean
|
|
12
|
+
}>(), {
|
|
13
|
+
closeOnClickOutside: true,
|
|
14
|
+
})
|
|
15
|
+
const emit = defineEmits(['update:modelValue'])
|
|
16
|
+
|
|
17
|
+
const is = 'div'
|
|
18
|
+
|
|
19
|
+
// defineModel 'open'
|
|
20
|
+
const _isOpen = ref(props.modelValue)
|
|
21
|
+
watch(() => props.modelValue, (val) => {
|
|
22
|
+
_isOpen.value = val
|
|
23
|
+
})
|
|
24
|
+
const isOpen = computed({
|
|
25
|
+
get: () => _isOpen.value,
|
|
26
|
+
set: (val) => {
|
|
27
|
+
_isOpen.value = val
|
|
28
|
+
if (props.modelValue !== val) {
|
|
29
|
+
emit('update:modelValue', val)
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
function handleClick() {
|
|
35
|
+
if (props.closeOnClickOutside) {
|
|
36
|
+
isOpen.value = false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<input v-model="isOpen" type="checkbox" class="modal-toggle">
|
|
43
|
+
<Component
|
|
44
|
+
:is="is"
|
|
45
|
+
v-bind="{ ...$attrs, ...$props }"
|
|
46
|
+
class="modal"
|
|
47
|
+
:class="{
|
|
48
|
+
'modal-top': props.top,
|
|
49
|
+
'modal-bottom': props.bottom,
|
|
50
|
+
'modal-start': props.start,
|
|
51
|
+
'modal-end': props.end,
|
|
52
|
+
}"
|
|
53
|
+
@click.self="handleClick"
|
|
54
|
+
>
|
|
55
|
+
<slot />
|
|
56
|
+
</Component>
|
|
57
|
+
</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,34 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { value = 0, max = 100, color, neutral, primary, secondary, accent, success, info, warning, error } = defineProps<{
|
|
3
|
+
value?: string | number
|
|
4
|
+
max?: string | number
|
|
5
|
+
|
|
6
|
+
color?: string
|
|
7
|
+
neutral?: boolean
|
|
8
|
+
primary?: boolean
|
|
9
|
+
secondary?: boolean
|
|
10
|
+
accent?: boolean
|
|
11
|
+
success?: boolean
|
|
12
|
+
info?: boolean
|
|
13
|
+
warning?: boolean
|
|
14
|
+
error?: boolean
|
|
15
|
+
}>()
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<progress
|
|
20
|
+
:value="value"
|
|
21
|
+
:max="max"
|
|
22
|
+
class="progress"
|
|
23
|
+
:class="{
|
|
24
|
+
'progress-neutral': neutral || color === 'neutral',
|
|
25
|
+
'progress-primary': primary || color === 'primary',
|
|
26
|
+
'progress-secondary': secondary || color === 'secondary',
|
|
27
|
+
'progress-accent': accent || color === 'accent',
|
|
28
|
+
'progress-success': success || color === 'success',
|
|
29
|
+
'progress-info': info || color === 'info',
|
|
30
|
+
'progress-warning': warning || color === 'warning',
|
|
31
|
+
'progress-error': error || color === 'error',
|
|
32
|
+
}"
|
|
33
|
+
/>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
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, .prose h2 a, .prose h3 a, .prose h4 a, .prose h5 a, .prose h6 a {
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
@apply font-bold
|
|
31
|
+
}
|
|
32
|
+
</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,67 @@
|
|
|
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
|
+
|
|
9
|
+
color?: string
|
|
10
|
+
neutral?: boolean
|
|
11
|
+
primary?: boolean
|
|
12
|
+
secondary?: boolean
|
|
13
|
+
accent?: boolean
|
|
14
|
+
success?: boolean
|
|
15
|
+
warning?: boolean
|
|
16
|
+
info?: boolean
|
|
17
|
+
error?: boolean
|
|
18
|
+
|
|
19
|
+
size?: string
|
|
20
|
+
xs?: boolean
|
|
21
|
+
sm?: boolean
|
|
22
|
+
md?: boolean
|
|
23
|
+
lg?: boolean
|
|
24
|
+
xl?: boolean
|
|
25
|
+
}>()
|
|
26
|
+
const emit = defineEmits(['update:modelValue'])
|
|
27
|
+
|
|
28
|
+
const radioGroup: any = inject('radio-group', null)
|
|
29
|
+
|
|
30
|
+
const currentValue = computed({
|
|
31
|
+
get() {
|
|
32
|
+
return radioGroup ? radioGroup.currentValue : props.modelValue
|
|
33
|
+
},
|
|
34
|
+
set(val: any) {
|
|
35
|
+
if (radioGroup) {
|
|
36
|
+
radioGroup.currentValue = val
|
|
37
|
+
}
|
|
38
|
+
emit('update:modelValue', val)
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<input
|
|
45
|
+
v-model="currentValue"
|
|
46
|
+
type="radio"
|
|
47
|
+
v-bind="$attrs"
|
|
48
|
+
class="radio"
|
|
49
|
+
:class="{
|
|
50
|
+
'radio-neutral': props.neutral || props.color === 'neutral',
|
|
51
|
+
'radio-primary': props.primary || props.color === 'primary',
|
|
52
|
+
'radio-secondary': props.secondary || props.color === 'secondary',
|
|
53
|
+
'radio-accent': props.accent || props.color === 'accent',
|
|
54
|
+
'radio-success': props.success || props.color === 'success',
|
|
55
|
+
'radio-warning': props.warning || props.color === 'warning',
|
|
56
|
+
'radio-info': props.info || props.color === 'info',
|
|
57
|
+
'radio-error': props.error || props.color === 'error',
|
|
58
|
+
'radio-xs': props.xs || props.size === 'xs',
|
|
59
|
+
'radio-sm': props.sm || props.size === 'sm',
|
|
60
|
+
'radio-md': props.md || props.size === 'md',
|
|
61
|
+
'radio-lg': props.lg || props.size === 'lg',
|
|
62
|
+
'radio-xl': props.xl || props.size === 'xl',
|
|
63
|
+
}"
|
|
64
|
+
:disabled="props.disabled"
|
|
65
|
+
:value="props.value"
|
|
66
|
+
>
|
|
67
|
+
</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>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
modelValue?: number | string
|
|
6
|
+
min?: number | string
|
|
7
|
+
max?: number | string
|
|
8
|
+
step?: number | string
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
|
|
11
|
+
color?: string
|
|
12
|
+
neutral?: boolean
|
|
13
|
+
primary?: boolean
|
|
14
|
+
secondary?: boolean
|
|
15
|
+
accent?: boolean
|
|
16
|
+
success?: boolean
|
|
17
|
+
warning?: boolean
|
|
18
|
+
info?: boolean
|
|
19
|
+
error?: boolean
|
|
20
|
+
|
|
21
|
+
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
22
|
+
xl?: boolean
|
|
23
|
+
lg?: boolean
|
|
24
|
+
md?: boolean
|
|
25
|
+
sm?: boolean
|
|
26
|
+
xs?: boolean
|
|
27
|
+
}>()
|
|
28
|
+
const emit = defineEmits(['update:modelValue'])
|
|
29
|
+
|
|
30
|
+
const currentValue = computed({
|
|
31
|
+
get: () => props.modelValue,
|
|
32
|
+
set: val => emit('update:modelValue', val),
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<input
|
|
38
|
+
v-model="currentValue"
|
|
39
|
+
type="range"
|
|
40
|
+
class="range"
|
|
41
|
+
:class="{
|
|
42
|
+
'range-neutral': neutral || color === 'neutral',
|
|
43
|
+
'range-primary': primary || color === 'primary',
|
|
44
|
+
'range-secondary': secondary || color === 'secondary',
|
|
45
|
+
'range-accent': accent || color === 'accent',
|
|
46
|
+
'range-success': success || color === 'success',
|
|
47
|
+
'range-info': info || color === 'info',
|
|
48
|
+
'range-warning': warning || color === 'warning',
|
|
49
|
+
'range-error': error || color === 'error',
|
|
50
|
+
'range-xl': xl || size === 'xl',
|
|
51
|
+
'range-lg': lg || size === 'lg',
|
|
52
|
+
'range-md': md || size === 'md',
|
|
53
|
+
'range-sm': sm || size === 'sm',
|
|
54
|
+
'range-xs': xs || size === 'xs',
|
|
55
|
+
}"
|
|
56
|
+
:min="min"
|
|
57
|
+
:max="max"
|
|
58
|
+
:step="step"
|
|
59
|
+
:disabled="disabled"
|
|
60
|
+
>
|
|
61
|
+
</template>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
modelValue?: number | string
|
|
6
|
+
min?: number | string
|
|
7
|
+
max?: number | string
|
|
8
|
+
step?: number | string
|
|
9
|
+
|
|
10
|
+
numbered?: boolean
|
|
11
|
+
asButtons?: boolean
|
|
12
|
+
disabled?: boolean
|
|
13
|
+
|
|
14
|
+
color?: string
|
|
15
|
+
neutral?: boolean
|
|
16
|
+
primary?: boolean
|
|
17
|
+
secondary?: boolean
|
|
18
|
+
accent?: boolean
|
|
19
|
+
success?: boolean
|
|
20
|
+
warning?: boolean
|
|
21
|
+
info?: boolean
|
|
22
|
+
error?: boolean
|
|
23
|
+
|
|
24
|
+
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
|
|
25
|
+
xl?: boolean
|
|
26
|
+
lg?: boolean
|
|
27
|
+
md?: boolean
|
|
28
|
+
sm?: boolean
|
|
29
|
+
xs?: boolean
|
|
30
|
+
}>(), {
|
|
31
|
+
min: 0,
|
|
32
|
+
max: 100,
|
|
33
|
+
step: 1,
|
|
34
|
+
})
|
|
35
|
+
defineEmits(['update:modelValue'])
|
|
36
|
+
|
|
37
|
+
const values = computed(() => {
|
|
38
|
+
const vals = []
|
|
39
|
+
for (let index = Number.parseInt(props.min as string); index < Number.parseInt(props.max as string) + 1; index++) {
|
|
40
|
+
vals.push({
|
|
41
|
+
value: index,
|
|
42
|
+
isVisible: index % Number.parseInt(props.step as string) === 0,
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
return vals
|
|
46
|
+
})
|
|
47
|
+
// const count = computed(() => Number.parseInt(props.max as string) - Number.parseInt(props.min as string))
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<div
|
|
52
|
+
class="flex justify-between select-none"
|
|
53
|
+
:class="{
|
|
54
|
+
'text-neutral': neutral || color === 'neutral',
|
|
55
|
+
'text-primary': primary || color === 'primary',
|
|
56
|
+
'text-secondary': secondary || color === 'secondary',
|
|
57
|
+
'text-accent': accent || color === 'accent',
|
|
58
|
+
'text-success': success || color === 'success',
|
|
59
|
+
'text-info': info || color === 'info',
|
|
60
|
+
'text-warning': warning || color === 'warning',
|
|
61
|
+
'text-error': error || color === 'error',
|
|
62
|
+
'text-xl': xl || size === 'xl',
|
|
63
|
+
'text-lg': lg || size === 'lg',
|
|
64
|
+
'text-md': md || size === 'md',
|
|
65
|
+
'text-sm': sm || size === 'sm',
|
|
66
|
+
'text-xs': xs || size === 'xs',
|
|
67
|
+
'opacity-50': disabled,
|
|
68
|
+
}"
|
|
69
|
+
>
|
|
70
|
+
<RangeMeasureTick
|
|
71
|
+
v-for="tick in values"
|
|
72
|
+
:key="tick.value"
|
|
73
|
+
:tick="tick.value"
|
|
74
|
+
:model-value="modelValue"
|
|
75
|
+
:numbered="numbered"
|
|
76
|
+
:as-button="asButtons"
|
|
77
|
+
:is-hidden="!tick.isVisible"
|
|
78
|
+
:disabled="disabled"
|
|
79
|
+
@update:model-value="(val) => !disabled && $emit('update:modelValue', val)"
|
|
80
|
+
>
|
|
81
|
+
{{ numbered ? tick : '|' }}
|
|
82
|
+
</RangeMeasureTick>
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useTimeoutFn } from '@vueuse/core';
|
|
3
|
+
import { computed, watch } from 'vue';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
tick: number
|
|
7
|
+
modelValue?: number | string
|
|
8
|
+
numbered?: boolean
|
|
9
|
+
asButton?: boolean
|
|
10
|
+
isHidden?: boolean
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
}>()
|
|
13
|
+
defineEmits(['update:modelValue'])
|
|
14
|
+
|
|
15
|
+
const hasChanged = ref(false)
|
|
16
|
+
const { isPending, start, stop } = useTimeoutFn(() => {
|
|
17
|
+
hasChanged.value = false
|
|
18
|
+
}, 1000)
|
|
19
|
+
watch(
|
|
20
|
+
() => props.modelValue,
|
|
21
|
+
(val) => {
|
|
22
|
+
if (val) {
|
|
23
|
+
start()
|
|
24
|
+
hasChanged.value = true
|
|
25
|
+
}
|
|
26
|
+
else if (!isPending.value) {
|
|
27
|
+
stop()
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line eqeqeq
|
|
33
|
+
const isCurrent = computed(() => props.modelValue == props.tick)
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<Button
|
|
38
|
+
v-if="asButton && !isHidden"
|
|
39
|
+
xs
|
|
40
|
+
:ghost="!isCurrent"
|
|
41
|
+
circle
|
|
42
|
+
:class="{
|
|
43
|
+
'font-bold': isCurrent,
|
|
44
|
+
'opacity-50': props.disabled,
|
|
45
|
+
'cursor-pointer': !props.disabled,
|
|
46
|
+
'cursor-not-allowed': props.disabled,
|
|
47
|
+
}"
|
|
48
|
+
:disabled="disabled"
|
|
49
|
+
@click="$emit('update:modelValue', tick)"
|
|
50
|
+
>
|
|
51
|
+
{{ numbered ? tick : '|' }}
|
|
52
|
+
</Button>
|
|
53
|
+
<Tooltip
|
|
54
|
+
v-else
|
|
55
|
+
:tip="tick"
|
|
56
|
+
:open="hasChanged && isCurrent && !disabled"
|
|
57
|
+
position="bottom"
|
|
58
|
+
:class="{
|
|
59
|
+
'px-[2px]': !asButton,
|
|
60
|
+
'opacity-50': disabled,
|
|
61
|
+
'cursor-pointer': !disabled,
|
|
62
|
+
'cursor-not-allowed': disabled,
|
|
63
|
+
}"
|
|
64
|
+
@click="$emit('update:modelValue', tick)"
|
|
65
|
+
>
|
|
66
|
+
<Text v-if="!isHidden" :black="isCurrent">
|
|
67
|
+
{{ numbered ? tick : '|' }}
|
|
68
|
+
</Text>
|
|
69
|
+
</Tooltip>
|
|
70
|
+
</template>
|