-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add carousel
component
#227
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
@sadeghbarati Pretty much everything is done. I just have to know how I can generate the Can you explain how can I do that? Also please let me know if I did it all correct. Thank you |
Carousel.-.shadcn_vue.-.Google.Chrome.2023-12-29.20-29-42.mp4 |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Also I'm looking to make the carousel a focusable element for easier keyboard interactions. I've looked in the internet. |
We should change For focusable carousel just add tabindex 0 to |
For building registry you can run |
@sadeghbarati I think I'm pretty much done. Can you please review it once more and let me know when you're free? |
Only one thing which I doubt to include it in defineExpose({
carouselRef: carouselArgs or carouselApi
}) So the user can access the Carousel API in every possible way in Vue
|
It's already accessible through slotProps. I'll check if setting defineExpose is important. I think it's a nice to have. I'll add it |
@sadeghbarati I've made all the changes. You can check it when you're free and let me know |
Sometimes I still have this issue but it will be resolved after embla |
@sadeghbarati do you have the relevant ticket to the issue you mentioned? 😁 |
Hey, Yes here |
Thanks @sadeghbarati .. Something weird in the
|
Sadly Vue doesn't support Complex Types (entire props object) in SFC file, I thought I would solve this issue by defining export interface CarouselProps {
opts?: {
active: CarouselOptions['active']
align: CarouselOptions['align']
axis: CarouselOptions['axis']
breakpoints: CarouselOptions['breakpoints']
container: CarouselOptions['container']
containScroll: CarouselOptions['containScroll']
direction: CarouselOptions['direction']
dragFree: CarouselOptions['dragFree']
dragThreshold: CarouselOptions['dragThreshold']
duration: CarouselOptions['duration']
inViewThreshold: CarouselOptions['inViewThreshold']
loop: CarouselOptions['loop']
skipSnaps: CarouselOptions['skipSnaps']
slides: CarouselOptions['slides']
slidesToScroll: CarouselOptions['slidesToScroll']
startIndex: CarouselOptions['startIndex']
watchDrag: CarouselOptions['watchDrag']
watchResize: CarouselOptions['watchResize']
watchSlides: CarouselOptions['watchSlides']
}
...
} cause
|
Yeah. I wish the type system for Vue would be improved soon! Maybe lets try this? https://github.com/so1ve/vue.ts/tree/main/packages/complex-types |
I tried to exclude carousel files from {
"extends": "@vue/tsconfig/tsconfig.json",
"compilerOptions": {
"moduleResolution": "Node",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"declaration": false
},
"include": ["src/lib/**/*"],
"exclude": ["node_modules", "src/lib/registry/**/example/**/*", "src/lib/registry/default/ui/carousel/*", "src/lib/registry/new-york/ui/carousel/*"]
} in this case we should build registry without vue-tsc typecheck |
@wasimTQ can you update |
@sadeghbarati It's done |
ea2b1c8
to
734079a
Compare
@sadeghbarati I've made the changes. |
so user could change navigation button icons
update tsconfig exclude for the strict registry build
update embla deps
cc6f1b9
to
518189f
Compare
Problem is not complex types in fact if there was complex type error we can't even open carousel.md path in the localhost and should see vite error overlay on screen The problem is ❌ import type { CarouselEmits, CarouselProps, WithClassAsProps } from './interface'
const props = withDefaults(defineProps<CarouselProps & WithClassAsProps>(), {
orientation: 'horizontal',
})
✅ import type { HTMLAttributes, Ref } from 'vue'
import type {
EmblaCarouselType as CarouselApi,
EmblaOptionsType as CarouselOptions,
EmblaPluginType as CarouselPlugin,
} from 'embla-carousel'
const props = withDefaults(defineProps<{
opts?: CarouselOptions | Ref<CarouselOptions>
plugins?: CarouselPlugin[] | Ref<CarouselPlugin[]>
orientation?: 'horizontal' | 'vertical'
class?: HTMLAttributes['class']
}>(), {
orientation: 'horizontal',
}) |
Thanks @sadeghbarati . Found the issue with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job @wasimTQ @sadeghbarati ! You 2 absolutely nailed it!!
Thanks for the care for details, and the thorough implementation! 💚
LGTM and let's get this baby in!
fixes #226
I need help on how to add it to the table of contents
Still there are some examples that needs to be done. And also it has to be copied to new york styling as well