Welcome to mirror list, hosted at ThFree Co, Russian Federation.

popperOffsets.js.flow « modifiers « lib « package « popperjs - github.com/gohugoio/hugo-mod-jslibs-dist.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 30b5894544c79d0950e31ba28d2cde6f79290796 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// @flow
import type { ModifierArguments, Modifier } from '../types';
import computeOffsets from '../utils/computeOffsets';

function popperOffsets({ state, name }: ModifierArguments<{||}>) {
  // Offsets are the actual position the popper needs to have to be
  // properly positioned near its reference element
  // This is the most basic placement, and will be adjusted by
  // the modifiers in the next step
  state.modifiersData[name] = computeOffsets({
    reference: state.rects.reference,
    element: state.rects.popper,
    strategy: 'absolute',
    placement: state.placement,
  });
}

// eslint-disable-next-line import/no-unused-modules
export type PopperOffsetsModifier = Modifier<'popperOffsets', {||}>;
export default ({
  name: 'popperOffsets',
  enabled: true,
  phase: 'read',
  fn: popperOffsets,
  data: {},
}: PopperOffsetsModifier);