interface.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import React, { ReactNode } from "react";
  2. import { strings } from '@douyinfe/semi-foundation/carousel/constants';
  3. export interface CarouselMethod {
  4. next?: () => void;
  5. prev?: () => void;
  6. goTo?: (tagetIndex: number) => void;
  7. play?: () => void;
  8. stop?: () => void;
  9. }
  10. export interface CarouselProps {
  11. activeIndex?: number;
  12. animation?: typeof strings.ANIMATION_MAP[number];
  13. arrowProps?: ArrowProps;
  14. autoPlay?: boolean | {interval?: number, hoverToPause?: boolean};
  15. arrowType?: typeof strings.ARROW_MAP[number];
  16. children?: ReactNode | Array<ReactNode>;
  17. className?: string;
  18. defaultActiveIndex?: number;
  19. indicatorPosition?: typeof strings.POSITION_MAP[number];
  20. indicatorSize?: typeof strings.SIZE[number];
  21. theme?: typeof strings.THEME_MAP[number];
  22. indicatorType?: typeof strings.TYPE_MAP[number];
  23. onChange?: (index: number, preIndex: number) => void;
  24. showArrow?: boolean;
  25. showIndicator?: boolean;
  26. slideDirection?: typeof strings.DIRECTION[number];
  27. speed?: number;
  28. style?: React.CSSProperties;
  29. trigger?: typeof strings.TRIGGER[number];
  30. }
  31. export interface CarouselIndicatorProps {
  32. activeIndex?: number;
  33. className?: string;
  34. defaultActiveIndex?: number;
  35. position?: typeof strings.POSITION_MAP[number];
  36. size?: typeof strings.SIZE[number];
  37. total?:number;
  38. theme?: typeof strings.THEME_MAP[number];
  39. type?: typeof strings.TYPE_MAP[number];
  40. onIndicatorChange?: (activeIndex: number) => void;
  41. style?: React.CSSProperties;
  42. trigger?: typeof strings.TRIGGER[number];
  43. }
  44. export interface CarouselArrowProps {
  45. type?: typeof strings.ARROW_MAP[number];
  46. theme?: typeof strings.THEME_MAP[number];
  47. prev?: () => void;
  48. next?: () => void;
  49. arrowProps?: ArrowProps;
  50. }
  51. export interface ArrowButton {
  52. props?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
  53. children?: React.ReactNode;
  54. }
  55. export interface ArrowProps {
  56. leftArrow?: ArrowButton;
  57. rightArrow?: ArrowButton;
  58. }