index.d.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import * as React from "react";
  2. import * as Radix from "@radix-ui/react-primitive";
  3. import { Primitive } from "@radix-ui/react-primitive";
  4. type Direction = 'ltr' | 'rtl';
  5. export const createSliderScope: import("@radix-ui/react-context").CreateScope;
  6. export interface SliderProps extends Omit<SliderHorizontalProps | SliderVerticalProps, keyof SliderOrientationPrivateProps | 'defaultValue'> {
  7. name?: string;
  8. disabled?: boolean;
  9. orientation?: React.AriaAttributes['aria-orientation'];
  10. dir?: Direction;
  11. min?: number;
  12. max?: number;
  13. step?: number;
  14. minStepsBetweenThumbs?: number;
  15. value?: number[];
  16. defaultValue?: number[];
  17. onValueChange?(value: number[]): void;
  18. onValueCommit?(value: number[]): void;
  19. inverted?: boolean;
  20. }
  21. export const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLSpanElement>>;
  22. type SliderOrientationPrivateProps = {
  23. min: number;
  24. max: number;
  25. inverted: boolean;
  26. onSlideStart?(value: number): void;
  27. onSlideMove?(value: number): void;
  28. onSlideEnd?(): void;
  29. onHomeKeyDown(event: React.KeyboardEvent): void;
  30. onEndKeyDown(event: React.KeyboardEvent): void;
  31. onStepKeyDown(step: {
  32. event: React.KeyboardEvent;
  33. direction: number;
  34. }): void;
  35. };
  36. interface SliderOrientationProps extends Omit<SliderImplProps, keyof SliderImplPrivateProps>, SliderOrientationPrivateProps {
  37. }
  38. interface SliderHorizontalProps extends SliderOrientationProps {
  39. dir?: Direction;
  40. }
  41. interface SliderVerticalProps extends SliderOrientationProps {
  42. }
  43. type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
  44. type SliderImplPrivateProps = {
  45. onSlideStart(event: React.PointerEvent): void;
  46. onSlideMove(event: React.PointerEvent): void;
  47. onSlideEnd(event: React.PointerEvent): void;
  48. onHomeKeyDown(event: React.KeyboardEvent): void;
  49. onEndKeyDown(event: React.KeyboardEvent): void;
  50. onStepKeyDown(event: React.KeyboardEvent): void;
  51. };
  52. interface SliderImplProps extends PrimitiveDivProps, SliderImplPrivateProps {
  53. }
  54. type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
  55. export interface SliderTrackProps extends PrimitiveSpanProps {
  56. }
  57. export const SliderTrack: React.ForwardRefExoticComponent<SliderTrackProps & React.RefAttributes<HTMLSpanElement>>;
  58. export interface SliderRangeProps extends PrimitiveSpanProps {
  59. }
  60. export const SliderRange: React.ForwardRefExoticComponent<SliderRangeProps & React.RefAttributes<HTMLSpanElement>>;
  61. export interface SliderThumbProps extends Omit<SliderThumbImplProps, 'index'> {
  62. }
  63. export const SliderThumb: React.ForwardRefExoticComponent<SliderThumbProps & React.RefAttributes<HTMLSpanElement>>;
  64. interface SliderThumbImplProps extends PrimitiveSpanProps {
  65. index: number;
  66. }
  67. export const Root: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLSpanElement>>;
  68. export const Track: React.ForwardRefExoticComponent<SliderTrackProps & React.RefAttributes<HTMLSpanElement>>;
  69. export const Range: React.ForwardRefExoticComponent<SliderRangeProps & React.RefAttributes<HTMLSpanElement>>;
  70. export const Thumb: React.ForwardRefExoticComponent<SliderThumbProps & React.RefAttributes<HTMLSpanElement>>;
  71. //# sourceMappingURL=index.d.ts.map