index.d.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import type { Ref, ToRefs } from 'vue';
  2. import type { Middleware, Placement, SideObject, Strategy, VirtualElement } from '@floating-ui/dom';
  3. export declare const useFloatingProps: {};
  4. export declare type UseFloatingProps = ToRefs<{
  5. middleware: Array<Middleware>;
  6. placement: Placement;
  7. strategy: Strategy;
  8. }>;
  9. export declare const getPositionDataWithUnit: <T extends Record<string, number>>(record: T | undefined, key: keyof T) => string;
  10. export declare const useFloating: ({ middleware, placement, strategy, }: UseFloatingProps) => {
  11. update: () => Promise<void>;
  12. referenceRef: Ref<HTMLElement | VirtualElement | undefined>;
  13. contentRef: Ref<HTMLElement | undefined>;
  14. x: Ref<number | undefined>;
  15. y: Ref<number | undefined>;
  16. placement: Ref<Placement>;
  17. strategy: Ref<Strategy>;
  18. middlewareData: Ref<{
  19. [x: string]: any;
  20. arrow?: {
  21. x?: number | undefined;
  22. y?: number | undefined;
  23. centerOffset: number;
  24. } | undefined;
  25. autoPlacement?: {
  26. index?: number | undefined;
  27. overflows: {
  28. placement: Placement;
  29. overflows: number[];
  30. }[];
  31. } | undefined;
  32. flip?: {
  33. index?: number | undefined;
  34. overflows: {
  35. placement: Placement;
  36. overflows: number[];
  37. }[];
  38. } | undefined;
  39. hide?: {
  40. referenceHidden?: boolean | undefined;
  41. escaped?: boolean | undefined;
  42. referenceHiddenOffsets?: {
  43. top: number;
  44. bottom: number;
  45. left: number;
  46. right: number;
  47. } | undefined;
  48. escapedOffsets?: {
  49. top: number;
  50. bottom: number;
  51. left: number;
  52. right: number;
  53. } | undefined;
  54. } | undefined;
  55. offset?: {
  56. x: number;
  57. y: number;
  58. } | undefined;
  59. shift?: {
  60. x: number;
  61. y: number;
  62. } | undefined;
  63. }>;
  64. };
  65. export declare type ArrowMiddlewareProps = {
  66. arrowRef: Ref<HTMLElement | null | undefined>;
  67. padding?: number | SideObject;
  68. };
  69. export declare const arrowMiddleware: ({ arrowRef, padding, }: ArrowMiddlewareProps) => Middleware;