floating-ui.react-dom.d.mts 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. import { AlignedPlacement } from '@floating-ui/dom';
  2. import { Alignment } from '@floating-ui/dom';
  3. import { autoPlacement } from '@floating-ui/dom';
  4. import { AutoPlacementOptions } from '@floating-ui/dom';
  5. import { autoUpdate } from '@floating-ui/dom';
  6. import { AutoUpdateOptions } from '@floating-ui/dom';
  7. import { Axis } from '@floating-ui/dom';
  8. import { Boundary } from '@floating-ui/dom';
  9. import { ClientRectObject } from '@floating-ui/dom';
  10. import { computePosition } from '@floating-ui/dom';
  11. import { ComputePositionConfig } from '@floating-ui/dom';
  12. import { ComputePositionReturn } from '@floating-ui/dom';
  13. import { Coords } from '@floating-ui/dom';
  14. import type { Derivable } from '@floating-ui/dom';
  15. import { detectOverflow } from '@floating-ui/dom';
  16. import { DetectOverflowOptions } from '@floating-ui/dom';
  17. import { Dimensions } from '@floating-ui/dom';
  18. import { ElementContext } from '@floating-ui/dom';
  19. import { ElementRects } from '@floating-ui/dom';
  20. import { Elements } from '@floating-ui/dom';
  21. import { flip } from '@floating-ui/dom';
  22. import { FlipOptions } from '@floating-ui/dom';
  23. import { FloatingElement } from '@floating-ui/dom';
  24. import { getOverflowAncestors } from '@floating-ui/dom';
  25. import { hide } from '@floating-ui/dom';
  26. import { HideOptions } from '@floating-ui/dom';
  27. import { inline } from '@floating-ui/dom';
  28. import { InlineOptions } from '@floating-ui/dom';
  29. import { Length } from '@floating-ui/dom';
  30. import { limitShift } from '@floating-ui/dom';
  31. import { Middleware } from '@floating-ui/dom';
  32. import { MiddlewareArguments } from '@floating-ui/dom';
  33. import { MiddlewareData } from '@floating-ui/dom';
  34. import { MiddlewareReturn } from '@floating-ui/dom';
  35. import { MiddlewareState } from '@floating-ui/dom';
  36. import { NodeScroll } from '@floating-ui/dom';
  37. import { offset } from '@floating-ui/dom';
  38. import { OffsetOptions } from '@floating-ui/dom';
  39. import { Padding } from '@floating-ui/dom';
  40. import { Placement } from '@floating-ui/dom';
  41. import { Platform } from '@floating-ui/dom';
  42. import { platform } from '@floating-ui/dom';
  43. import type * as React_2 from 'react';
  44. import { Rect } from '@floating-ui/dom';
  45. import { ReferenceElement } from '@floating-ui/dom';
  46. import { RootBoundary } from '@floating-ui/dom';
  47. import { shift } from '@floating-ui/dom';
  48. import { ShiftOptions } from '@floating-ui/dom';
  49. import { Side } from '@floating-ui/dom';
  50. import { SideObject } from '@floating-ui/dom';
  51. import { size } from '@floating-ui/dom';
  52. import { SizeOptions } from '@floating-ui/dom';
  53. import { Strategy } from '@floating-ui/dom';
  54. import { VirtualElement } from '@floating-ui/dom';
  55. export { AlignedPlacement }
  56. export { Alignment }
  57. /**
  58. * Provides data to position an inner element of the floating element so that it
  59. * appears centered to the reference element.
  60. * This wraps the core `arrow` middleware to allow React refs as the element.
  61. * @see https://floating-ui.com/docs/arrow
  62. */
  63. export declare const arrow: (options: ArrowOptions | Derivable<ArrowOptions>) => Middleware;
  64. export declare interface ArrowOptions {
  65. /**
  66. * The arrow element to be positioned.
  67. * @default undefined
  68. */
  69. element: React_2.MutableRefObject<Element | null> | Element | null;
  70. /**
  71. * The padding between the arrow element and the floating element edges.
  72. * Useful when the floating element has rounded corners.
  73. * @default 0
  74. */
  75. padding?: Padding;
  76. }
  77. export { autoPlacement }
  78. export { AutoPlacementOptions }
  79. export { autoUpdate }
  80. export { AutoUpdateOptions }
  81. export { Axis }
  82. export { Boundary }
  83. export { ClientRectObject }
  84. export { computePosition }
  85. export { ComputePositionConfig }
  86. export { ComputePositionReturn }
  87. export { Coords }
  88. export { detectOverflow }
  89. export { DetectOverflowOptions }
  90. export { Dimensions }
  91. export { ElementContext }
  92. export { ElementRects }
  93. export { Elements }
  94. export { flip }
  95. export { FlipOptions }
  96. export { FloatingElement }
  97. export { getOverflowAncestors }
  98. export { hide }
  99. export { HideOptions }
  100. export { inline }
  101. export { InlineOptions }
  102. export { Length }
  103. export { limitShift }
  104. export { Middleware }
  105. export { MiddlewareArguments }
  106. export { MiddlewareData }
  107. export { MiddlewareReturn }
  108. export { MiddlewareState }
  109. export { NodeScroll }
  110. export { offset }
  111. export { OffsetOptions }
  112. export { Padding }
  113. export { Placement }
  114. export { Platform }
  115. export { platform }
  116. declare type Prettify<T> = {
  117. [K in keyof T]: T[K];
  118. } & {};
  119. export { Rect }
  120. export { ReferenceElement }
  121. export declare type ReferenceType = Element | VirtualElement;
  122. export { RootBoundary }
  123. export { shift }
  124. export { ShiftOptions }
  125. export { Side }
  126. export { SideObject }
  127. export { size }
  128. export { SizeOptions }
  129. export { Strategy }
  130. /**
  131. * Provides data to position a floating element.
  132. * @see https://floating-ui.com/docs/useFloating
  133. */
  134. export declare function useFloating<RT extends ReferenceType = ReferenceType>(options?: UseFloatingOptions): UseFloatingReturn<RT>;
  135. export declare type UseFloatingData = Prettify<ComputePositionReturn & {
  136. isPositioned: boolean;
  137. }>;
  138. export declare type UseFloatingOptions<RT extends ReferenceType = ReferenceType> = Prettify<Partial<ComputePositionConfig> & {
  139. /**
  140. * A callback invoked when both the reference and floating elements are
  141. * mounted, and cleaned up when either is unmounted. This is useful for
  142. * setting up event listeners (e.g. pass `autoUpdate`).
  143. */
  144. whileElementsMounted?: (reference: RT, floating: HTMLElement, update: () => void) => () => void;
  145. elements?: {
  146. reference?: RT | null;
  147. floating?: HTMLElement | null;
  148. };
  149. /**
  150. * The `open` state of the floating element to synchronize with the
  151. * `isPositioned` value.
  152. */
  153. open?: boolean;
  154. /**
  155. * Whether to use `transform` for positioning instead of `top` and `left`
  156. * (layout) in the `floatingStyles` object.
  157. */
  158. transform?: boolean;
  159. }>;
  160. export declare type UseFloatingReturn<RT extends ReferenceType = ReferenceType> = Prettify<UseFloatingData & {
  161. /**
  162. * Update the position of the floating element, re-rendering the component
  163. * if required.
  164. */
  165. update: () => void;
  166. /**
  167. * Pre-configured positioning styles to apply to the floating element.
  168. */
  169. floatingStyles: React_2.CSSProperties;
  170. /**
  171. * Object containing the reference and floating refs and reactive setters.
  172. */
  173. refs: {
  174. /**
  175. * A React ref to the reference element.
  176. */
  177. reference: React_2.MutableRefObject<RT | null>;
  178. /**
  179. * A React ref to the floating element.
  180. */
  181. floating: React_2.MutableRefObject<HTMLElement | null>;
  182. /**
  183. * A callback to set the reference element (reactive).
  184. */
  185. setReference: (node: RT | null) => void;
  186. /**
  187. * A callback to set the floating element (reactive).
  188. */
  189. setFloating: (node: HTMLElement | null) => void;
  190. };
  191. elements: {
  192. reference: RT | null;
  193. floating: HTMLElement | null;
  194. };
  195. }>;
  196. export { VirtualElement }
  197. export { }