import { useContext, component$, createContextId, type PropsOf, Slot, useContextProvider, type Signal, } from '@builder.io/qwik'; import type { VariantProps } from 'class-variance-authority'; import { LuChevronDown, LuChevronLeft, LuChevronRight, LuChevronUp, } from '@qwikest/icons/lucide'; import { Carousel as HCarousel } from '@qwik-ui/headless'; import { cn } from '@qwik-ui/utils'; import { buttonVariants } from '../button/button'; const styledCarouselContextId = createContextId<{ orientation: 'horizontal' | 'vertical'; progress?: Signal; }>('styled-carousel-context'); const Provider = component$<{ orientation?: 'horizontal' | 'vertical'; }>(({ orientation = 'horizontal' }) => { const context = { orientation, }; useContextProvider(styledCarouselContextId, context); return ; }); const Root = ({ orientation = 'horizontal', ...props }: PropsOf & { orientation?: 'horizontal' | 'vertical'; progress?: Signal; }) => { return ( {props.children} ); }; const Scroller = component$>(({ ...props }) => { const context = useContext(styledCarouselContextId); return ( ); }); const Slide = component$>(({ ...props }) => { const context = useContext(styledCarouselContextId); return ( ); }); const Previous = component$< PropsOf & VariantProps >(({ look = 'ghost', size = 'icon', ...props }) => { const context = useContext(styledCarouselContextId); return (
{context.orientation === 'horizontal' ? ( ) : ( )}
); }); const Next = component$< PropsOf & VariantProps >(({ look = 'ghost', size = 'icon', ...props }) => { const context = useContext(styledCarouselContextId); return (
{/* moves content to the right on hover */}
{context.orientation === 'horizontal' ? ( ) : ( )}
); }); const Pagination = component$>(({ ...props }) => { return ( ); }); const Bullet = component$>((props) => { return ( ); }); const Title = component$>((props) => { return ( ); }); const Stepper = (props: PropsOf) => { return ( {props.children} ); }; const Step = component$>((props) => { return ( ); }); export const Carousel = { Root, Scroller, Slide, Previous, Next, Pagination, Bullet, Title, Stepper, Step, };