@reportportal/ui-kit 0.0.1-alpha.64 → 0.0.1-alpha.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ interface PopoverProps {
14
14
  dataAutomationId?: string;
15
15
  isOpened?: boolean;
16
16
  setIsOpened?: (isOpened: boolean) => void;
17
+ isCentered?: boolean;
17
18
  }
18
19
  export declare const Popover: FC<PopoverProps>;
19
20
  export {};
package/dist/popover.js CHANGED
@@ -1,19 +1,19 @@
1
- import { jsxs as p, Fragment as G, jsx as o } from "react/jsx-runtime";
2
- import { useRef as H, useState as S } from "react";
3
- import { useFloating as j, offset as C, flip as L, arrow as M, autoUpdate as O, useClick as U, useDismiss as W, useRole as q, useInteractions as z, FloatingFocusManager as B, FloatingArrow as J } from "@floating-ui/react";
4
- import { c as K } from "./bind-06a7ff84.js";
5
- const Q = "_popover_16ogt_1", V = "_title_16ogt_28", X = {
1
+ import { jsxs as f, Fragment as S, jsx as s } from "react/jsx-runtime";
2
+ import { useRef as j, useState as C, useCallback as L } from "react";
3
+ import { useFloating as M, offset as U, flip as W, arrow as q, autoUpdate as z, useClick as B, useDismiss as J, useRole as K, useInteractions as Q, FloatingFocusManager as V, FloatingArrow as X } from "@floating-ui/react";
4
+ import { c as Y } from "./bind-06a7ff84.js";
5
+ const Z = "_popover_16ogt_1", $ = "_title_16ogt_28", O = {
6
6
  "popover-wrapper": "_popover-wrapper_16ogt_1",
7
- popover: Q,
8
- title: V
9
- }, n = K.bind(X), m = 16, f = 8, Y = ["top", "right", "bottom", "left"], Z = [
7
+ popover: Z,
8
+ title: $
9
+ }, r = Y.bind(O), g = 16, d = 8, tt = ["top", "right", "bottom", "left"], et = [
10
10
  "right",
11
11
  "right-start",
12
12
  "right-end",
13
13
  "left",
14
14
  "left-start",
15
15
  "left-end"
16
- ], $ = [
16
+ ], ot = [
17
17
  "top",
18
18
  "top-start",
19
19
  "top-end",
@@ -26,70 +26,74 @@ const Q = "_popover_16ogt_1", V = "_title_16ogt_28", X = {
26
26
  "left",
27
27
  "left-start",
28
28
  "left-end"
29
- ], nt = ({
30
- className: d,
31
- content: g,
32
- children: h,
33
- placement: u = "bottom",
34
- fallbackPlacements: v = $,
35
- title: r,
36
- arrowOffset: l = 16,
37
- safeZone: _ = 4,
38
- arrowColor: w = "white",
39
- dataAutomationId: x,
40
- isOpened: b,
41
- setIsOpened: s
29
+ ], it = ({
30
+ className: h,
31
+ content: u,
32
+ children: v,
33
+ placement: _ = "bottom",
34
+ fallbackPlacements: b = ot,
35
+ title: i,
36
+ arrowOffset: o = 16,
37
+ safeZone: w = 4,
38
+ arrowColor: x = "white",
39
+ dataAutomationId: A,
40
+ isOpened: F,
41
+ setIsOpened: n,
42
+ isCentered: a = !0
42
43
  }) => {
43
- const i = H(null), [F, R] = S(!1), a = s ? b : F, A = (e) => {
44
- s ? s(e) : R(e);
45
- }, { placement: N, refs: c, floatingStyles: P, context: t } = j({
46
- open: a,
47
- onOpenChange: A,
48
- placement: u,
44
+ const c = j(null), [R, N] = C(!1), p = n ? F : R, P = (t) => {
45
+ n ? n(t) : N(t);
46
+ }, k = L(
47
+ (t, l) => a ? ((et.includes(l) ? t.reference.height : t.reference.width) - g) / 2 - o : -o,
48
+ [o, a]
49
+ ), { placement: E, refs: m, floatingStyles: I, context: e } = M({
50
+ open: p,
51
+ onOpenChange: P,
52
+ placement: _,
49
53
  middleware: [
50
- C(({ rects: e, placement: D }) => ({
51
- mainAxis: _ + f,
52
- alignmentAxis: ((Z.includes(D) ? e.reference.height : e.reference.width) - m) / 2 - l
54
+ U(({ rects: t, placement: l }) => ({
55
+ mainAxis: w + d,
56
+ alignmentAxis: k(t, l)
53
57
  })),
54
- L({
58
+ W({
55
59
  fallbackAxisSideDirection: "start",
56
- fallbackPlacements: v
60
+ fallbackPlacements: b
57
61
  }),
58
- M({
59
- element: i
62
+ q({
63
+ element: c
60
64
  })
61
65
  ],
62
- whileElementsMounted: O
63
- }), E = U(t), I = W(t), T = q(t), { getReferenceProps: k, getFloatingProps: y } = z([E, I, T]);
64
- return /* @__PURE__ */ p(G, { children: [
65
- /* @__PURE__ */ o("div", { ref: c.setReference, ...k(), className: n("popover-wrapper"), children: h }),
66
- a && /* @__PURE__ */ o(B, { context: t, modal: !1, children: /* @__PURE__ */ p(
66
+ whileElementsMounted: z
67
+ }), T = B(e), y = J(e), D = K(e), { getReferenceProps: G, getFloatingProps: H } = Q([T, y, D]);
68
+ return /* @__PURE__ */ f(S, { children: [
69
+ /* @__PURE__ */ s("div", { ref: m.setReference, ...G(), className: r("popover-wrapper"), children: v }),
70
+ p && /* @__PURE__ */ s(V, { context: e, modal: !1, children: /* @__PURE__ */ f(
67
71
  "div",
68
72
  {
69
- className: n("popover", d),
70
- "data-automation-id": x,
71
- ref: c.setFloating,
72
- style: P,
73
- ...y,
73
+ className: r("popover", h),
74
+ "data-automation-id": A,
75
+ ref: m.setFloating,
76
+ style: I,
77
+ ...H,
74
78
  children: [
75
- /* @__PURE__ */ o(
76
- J,
79
+ /* @__PURE__ */ s(
80
+ X,
77
81
  {
78
- ref: i,
79
- context: t,
80
- width: m,
81
- height: f,
82
- fill: w,
83
- staticOffset: Y.includes(N) ? null : l
82
+ ref: c,
83
+ context: e,
84
+ width: g,
85
+ height: d,
86
+ fill: x,
87
+ staticOffset: tt.includes(E) ? null : o
84
88
  }
85
89
  ),
86
- r && /* @__PURE__ */ o("div", { className: n("title"), children: r }),
87
- g
90
+ i && /* @__PURE__ */ s("div", { className: r("title"), children: i }),
91
+ u
88
92
  ]
89
93
  }
90
94
  ) })
91
95
  ] });
92
96
  };
93
97
  export {
94
- nt as Popover
98
+ it as Popover
95
99
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reportportal/ui-kit",
3
- "version": "0.0.1-alpha.64",
3
+ "version": "0.0.1-alpha.65",
4
4
  "description": "The UI-kit library for ReportPortal Design System.",
5
5
  "type": "module",
6
6
  "scripts": {