main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
855 bytes
|
Line | |
---|
1 | // @flow
|
---|
2 | import type { ModifierArguments, Modifier } from '../types';
|
---|
3 | import computeOffsets from '../utils/computeOffsets';
|
---|
4 |
|
---|
5 | function popperOffsets({ state, name }: ModifierArguments<{||}>) {
|
---|
6 | // Offsets are the actual position the popper needs to have to be
|
---|
7 | // properly positioned near its reference element
|
---|
8 | // This is the most basic placement, and will be adjusted by
|
---|
9 | // the modifiers in the next step
|
---|
10 | state.modifiersData[name] = computeOffsets({
|
---|
11 | reference: state.rects.reference,
|
---|
12 | element: state.rects.popper,
|
---|
13 | strategy: 'absolute',
|
---|
14 | placement: state.placement,
|
---|
15 | });
|
---|
16 | }
|
---|
17 |
|
---|
18 | // eslint-disable-next-line import/no-unused-modules
|
---|
19 | export type PopperOffsetsModifier = Modifier<'popperOffsets', {||}>;
|
---|
20 | export default ({
|
---|
21 | name: 'popperOffsets',
|
---|
22 | enabled: true,
|
---|
23 | phase: 'read',
|
---|
24 | fn: popperOffsets,
|
---|
25 | data: {},
|
---|
26 | }: PopperOffsetsModifier);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.