1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | import * as React from "react";
|
17 | import * as Classes from "../../common/classes";
|
18 | import { DISPLAYNAME_PREFIX } from "../../common/props";
|
19 | import { getPosition } from "./popperUtils";
|
20 |
|
21 |
|
22 | var SVG_SHADOW_PATH = "M8.11 6.302c1.015-.936 1.887-2.922 1.887-4.297v26c0-1.378" +
|
23 | "-.868-3.357-1.888-4.297L.925 17.09c-1.237-1.14-1.233-3.034 0-4.17L8.11 6.302z";
|
24 | var SVG_ARROW_PATH = "M8.787 7.036c1.22-1.125 2.21-3.376 2.21-5.03V0v30-2.005" +
|
25 | "c0-1.654-.983-3.9-2.21-5.03l-7.183-6.616c-.81-.746-.802-1.96 0-2.7l7.183-6.614z";
|
26 |
|
27 | function getArrowAngle(placement) {
|
28 | if (placement == null) {
|
29 | return 0;
|
30 | }
|
31 |
|
32 | switch (getPosition(placement)) {
|
33 | case "top":
|
34 | return -90;
|
35 | case "left":
|
36 | return 180;
|
37 | case "bottom":
|
38 | return 90;
|
39 | default:
|
40 | return 0;
|
41 | }
|
42 | }
|
43 | export var PopoverArrow = function (_a) {
|
44 | var _b = _a.arrowProps, ref = _b.ref, style = _b.style, placement = _a.placement;
|
45 | return (React.createElement("div", { className: Classes.POPOVER_ARROW, ref: ref, style: style.left == null || isNaN(+style.left) ? {} : style },
|
46 | React.createElement("svg", { viewBox: "0 0 30 30", style: { transform: "rotate(" + getArrowAngle(placement) + "deg)" } },
|
47 | React.createElement("path", { className: Classes.POPOVER_ARROW + "-border", d: SVG_SHADOW_PATH }),
|
48 | React.createElement("path", { className: Classes.POPOVER_ARROW + "-fill", d: SVG_ARROW_PATH }))));
|
49 | };
|
50 | PopoverArrow.displayName = DISPLAYNAME_PREFIX + ".PopoverArrow";
|
51 |
|
\ | No newline at end of file |