-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9041ccf
commit 807339d
Showing
7 changed files
with
46 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,52 @@ | ||
<script setup lang="ts"> | ||
import Slider, { SliderProps } from 'primevue/slider'; | ||
import { type HTMLAttributes, computed } from 'vue'; | ||
type Props = SliderProps; | ||
import { | ||
SliderRange, | ||
SliderRoot, | ||
type SliderRootEmits, | ||
type SliderRootProps, | ||
SliderThumb, | ||
SliderTrack, | ||
useForwardPropsEmits, | ||
} from 'radix-vue'; | ||
const props = defineProps<Props>(); | ||
const model = defineModel<number[]>(); | ||
import { cn } from '@/shared/helpers/tailwind'; | ||
defineExpose(); | ||
const props = defineProps<SliderRootProps & { class?: HTMLAttributes['class'] }>(); | ||
const emits = defineEmits<SliderRootEmits>(); | ||
const delegatedProps = computed(() => { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const { class: _, ...delegated } = props; | ||
return delegated; | ||
}); | ||
const forwarded = useForwardPropsEmits(delegatedProps, emits); | ||
</script> | ||
|
||
<template> | ||
<Slider v-bind="props" v-model="model" /> | ||
<SliderRoot | ||
:class=" | ||
cn( | ||
'relative flex w-full touch-none select-none items-center data-[orientation=vertical]:flex-col data-[orientation=vertical]:w-2 data-[orientation=vertical]:h-full', | ||
props.class | ||
) | ||
" | ||
v-bind="forwarded" | ||
> | ||
<SliderTrack | ||
class="relative h-2 w-full data-[orientation=vertical]:w-2 grow overflow-hidden rounded-full bg-secondary" | ||
> | ||
<SliderRange | ||
class="absolute h-full data-[orientation=vertical]:w-full bg-primary" | ||
/> | ||
</SliderTrack> | ||
<SliderThumb | ||
v-for="(_, key) in modelValue" | ||
:key="key" | ||
class="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" | ||
/> | ||
</SliderRoot> | ||
</template> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters