diff --git a/packages/ui-react/lib/Carousel/Carousel.stories.tsx b/packages/ui-react/lib/Carousel/Carousel.stories.tsx index 0ff3edd..0580b55 100644 --- a/packages/ui-react/lib/Carousel/Carousel.stories.tsx +++ b/packages/ui-react/lib/Carousel/Carousel.stories.tsx @@ -47,9 +47,10 @@ export const DefaultCarousel: Story = { { children:
4
}, { children:
5
}, ], - onChange: test, + onchange: test, defaultSelected: 2, selected: 1, + className: 'test', }, }; diff --git a/packages/ui-react/lib/Carousel/Carousel.tsx b/packages/ui-react/lib/Carousel/Carousel.tsx index a1ba5d1..3ff0890 100644 --- a/packages/ui-react/lib/Carousel/Carousel.tsx +++ b/packages/ui-react/lib/Carousel/Carousel.tsx @@ -1,9 +1,9 @@ -import React, { memo, useEffect, useRef, useState } from 'react'; +import React, { memo, useEffect, useRef, useState, type HtmlHTMLAttributes } from 'react'; import { type CarouselItemProps, CarouselItem } from '..'; import classNames from 'classnames'; import styles from './Carousel.module.scss'; -export interface CarouselProps { +export interface CarouselProps extends HtmlHTMLAttributes { /** * width of the carousel */ @@ -19,7 +19,7 @@ export interface CarouselProps { /** * onChange : the onChange of the Carousel */ - onChange?: (value: number) => void; + onchange?: (value: number) => void; /** * defaultselect the defaultselect of the Carousel */ @@ -44,10 +44,11 @@ export const Carousel = React.forwardRef( width = 400, CarouselItems = undefined, height, - onChange, + onchange, defaultSelected, selected, isSliding = true, + ...rest }, ref, ) => { @@ -121,8 +122,8 @@ export const Carousel = React.forwardRef( }; useEffect(() => { - onChange && onChange(select); - }, [select, onChange]); + onchange && onchange(select); + }, [select, onchange]); useEffect(() => { if (difference === 0 && !isChanged) { @@ -167,6 +168,7 @@ export const Carousel = React.forwardRef( className={carouselClass} ref={ref} style={{ width: `${width}px`, height: `${height}px` }} + {...rest} >