@forgedevstack/bear 1.3.3 → 1.3.4
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.
- package/README.md +145 -292
- package/dist/components/AlertDialog/AlertDialog.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.js +67 -84
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +72 -64
- package/dist/components/ChipGroup/ChipGroup.cjs +1 -1
- package/dist/components/ChipGroup/ChipGroup.const.cjs +1 -1
- package/dist/components/ChipGroup/ChipGroup.const.d.ts +2 -0
- package/dist/components/ChipGroup/ChipGroup.const.js +6 -4
- package/dist/components/ChipGroup/ChipGroup.js +52 -48
- package/dist/components/CommandPalette/CommandItem.cjs +1 -0
- package/dist/components/CommandPalette/CommandItem.d.ts +6 -0
- package/dist/components/CommandPalette/CommandItem.js +39 -0
- package/dist/components/CommandPalette/CommandPalette.cjs +1 -1
- package/dist/components/CommandPalette/CommandPalette.js +129 -144
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +72 -66
- package/dist/components/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.d.ts +5 -0
- package/dist/components/EmptyState/EmptyState.const.js +30 -15
- package/dist/components/EmptyState/EmptyState.js +35 -35
- package/dist/components/EmptyState/EmptyState.types.d.ts +2 -2
- package/dist/components/HoverCard/HoverCard.cjs +4 -3
- package/dist/components/HoverCard/HoverCard.const.cjs +1 -0
- package/dist/components/HoverCard/HoverCard.const.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.const.js +10 -0
- package/dist/components/HoverCard/HoverCard.js +62 -56
- package/dist/components/HoverCard/HoverCard.types.d.ts +7 -0
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.const.cjs +1 -0
- package/dist/components/Menu/Menu.const.d.ts +2 -0
- package/dist/components/Menu/Menu.const.js +12 -0
- package/dist/components/Menu/Menu.d.ts +3 -9
- package/dist/components/Menu/Menu.js +57 -89
- package/dist/components/Menu/Menu.types.d.ts +8 -1
- package/dist/components/Menu/MenuDivider.cjs +1 -0
- package/dist/components/Menu/MenuDivider.d.ts +6 -0
- package/dist/components/Menu/MenuDivider.js +7 -0
- package/dist/components/Menu/MenuItem.cjs +1 -0
- package/dist/components/Menu/MenuItem.d.ts +6 -0
- package/dist/components/Menu/MenuItem.js +46 -0
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +1 -0
- package/dist/components/Modal/Modal.const.js +20 -12
- package/dist/components/Modal/Modal.js +62 -59
- package/dist/components/Modal/Modal.types.d.ts +7 -0
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.const.cjs +1 -0
- package/dist/components/Popover/Popover.const.d.ts +15 -1
- package/dist/components/Popover/Popover.const.js +29 -0
- package/dist/components/Popover/Popover.js +77 -73
- package/dist/components/Popover/Popover.types.d.ts +7 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.const.cjs +1 -1
- package/dist/components/Select/Select.const.d.ts +1 -0
- package/dist/components/Select/Select.const.js +7 -6
- package/dist/components/Select/Select.js +101 -96
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.const.cjs +1 -1
- package/dist/components/Toast/Toast.const.d.ts +2 -0
- package/dist/components/Toast/Toast.const.js +11 -8
- package/dist/components/Toast/Toast.context.cjs +1 -0
- package/dist/components/Toast/Toast.context.d.ts +3 -0
- package/dist/components/Toast/Toast.context.js +11 -0
- package/dist/components/Toast/Toast.d.ts +4 -3
- package/dist/components/Toast/Toast.icons.cjs +1 -0
- package/dist/components/Toast/Toast.icons.d.ts +4 -0
- package/dist/components/Toast/Toast.icons.js +29 -0
- package/dist/components/Toast/Toast.js +32 -160
- package/dist/components/Toast/ToastContainer.cjs +1 -0
- package/dist/components/Toast/ToastContainer.d.ts +3 -0
- package/dist/components/Toast/ToastContainer.js +39 -0
- package/dist/components/Toast/ToastItem.cjs +1 -0
- package/dist/components/Toast/ToastItem.d.ts +5 -0
- package/dist/components/Toast/ToastItem.js +86 -0
- package/dist/components/ToggleGroup/ToggleGroup.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.const.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.const.d.ts +15 -0
- package/dist/components/ToggleGroup/ToggleGroup.const.js +33 -0
- package/dist/components/ToggleGroup/ToggleGroup.context.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.context.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup.context.js +5 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +86 -0
- package/dist/components/ToggleGroup/ToggleGroup.types.d.ts +48 -0
- package/dist/components/ToggleGroup/ToggleGroupItem.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroupItem.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroupItem.js +50 -0
- package/dist/components/ToggleGroup/hooks/useToggleGroupContext.cjs +1 -0
- package/dist/components/ToggleGroup/hooks/useToggleGroupContext.d.ts +1 -0
- package/dist/components/ToggleGroup/hooks/useToggleGroupContext.js +6 -0
- package/dist/components/ToggleGroup/index.d.ts +4 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.const.cjs +1 -0
- package/dist/components/Tooltip/Tooltip.const.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.const.js +18 -0
- package/dist/components/Tooltip/Tooltip.js +59 -61
- package/dist/components/Tooltip/Tooltip.types.d.ts +7 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +428 -418
- package/dist/constants/numbers.const.cjs +1 -1
- package/dist/constants/numbers.const.d.ts +3 -0
- package/dist/constants/numbers.const.js +37 -34
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +6 -4
- package/dist/hooks/useFocusTrap/index.d.ts +2 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.cjs +1 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.d.ts +3 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.js +41 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.types.d.ts +8 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.utils.cjs +1 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.utils.d.ts +1 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.utils.js +23 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +575 -563
- package/dist/styles.css +52 -0
- package/package.json +1 -1
|
@@ -1,122 +1,90 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as M, useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
onClick: a,
|
|
12
|
-
className: u,
|
|
13
|
-
testId: l,
|
|
14
|
-
...y
|
|
15
|
-
}) => /* @__PURE__ */ h(L, { children: [
|
|
16
|
-
/* @__PURE__ */ h(
|
|
17
|
-
"div",
|
|
18
|
-
{
|
|
19
|
-
role: "menuitem",
|
|
20
|
-
tabIndex: r ? -1 : 0,
|
|
21
|
-
className: v(
|
|
22
|
-
"bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2 bear-cursor-pointer bear-transition-colors",
|
|
23
|
-
"hover:bear-bg-gray-100 dark:hover:bear-bg-gray-700",
|
|
24
|
-
"focus:bear-outline-none focus:bear-bg-gray-100 dark:focus:bear-bg-gray-700",
|
|
25
|
-
n && "bear-bg-primary-50 dark:bear-bg-primary-900/20 bear-text-primary-600",
|
|
26
|
-
r && "bear-opacity-50 bear-cursor-not-allowed hover:bear-bg-transparent",
|
|
27
|
-
u
|
|
28
|
-
),
|
|
29
|
-
onClick: r ? void 0 : a,
|
|
30
|
-
onKeyDown: (f) => {
|
|
31
|
-
(f.key === "Enter" || f.key === " ") && !r && (a == null || a());
|
|
32
|
-
},
|
|
33
|
-
"data-testid": l,
|
|
34
|
-
...y,
|
|
35
|
-
children: [
|
|
36
|
-
t && /* @__PURE__ */ c("span", { className: "bear-flex-shrink-0 bear-text-gray-500", children: t }),
|
|
37
|
-
/* @__PURE__ */ c("span", { className: "bear-flex-1 bear-text-sm", children: m })
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
),
|
|
41
|
-
g && /* @__PURE__ */ c(O, {})
|
|
42
|
-
] }), O = ({ className: t }) => /* @__PURE__ */ c("div", { className: v("bear-h-px bear-bg-gray-200 dark:bear-bg-gray-700 bear-my-1", t) }), K = ({
|
|
43
|
-
open: t = !1,
|
|
44
|
-
anchorEl: r,
|
|
45
|
-
onClose: n,
|
|
1
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as M, useState as _, useLayoutEffect as h, useEffect as N } from "react";
|
|
3
|
+
import { cn as z } from "../../utils/cn.js";
|
|
4
|
+
import { resolveOverlayEffects as R } from "../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.js";
|
|
5
|
+
import { Portal as S } from "../Portal/Portal.js";
|
|
6
|
+
import { MENU_Z_INDEX as x, MENU_EFFECT_CLASS_MAP as p } from "./Menu.const.js";
|
|
7
|
+
const j = ({
|
|
8
|
+
open: d = !1,
|
|
9
|
+
anchorEl: f,
|
|
10
|
+
onClose: o,
|
|
46
11
|
children: g,
|
|
47
|
-
position:
|
|
48
|
-
minWidth:
|
|
49
|
-
maxHeight:
|
|
12
|
+
position: u = "bottom-start",
|
|
13
|
+
minWidth: n = 180,
|
|
14
|
+
maxHeight: i = 300,
|
|
50
15
|
className: l,
|
|
51
|
-
testId:
|
|
52
|
-
...
|
|
16
|
+
testId: k,
|
|
17
|
+
...b
|
|
53
18
|
}) => {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
if (!
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
let
|
|
60
|
-
switch (
|
|
19
|
+
const c = M(null), [m, y] = _({ top: 0, left: 0 });
|
|
20
|
+
h(() => {
|
|
21
|
+
if (!d || !f) return;
|
|
22
|
+
const r = () => {
|
|
23
|
+
const t = f.getBoundingClientRect(), e = c.current, v = e ? e.offsetHeight : Math.min(i, 200);
|
|
24
|
+
let a = 0, s = 0;
|
|
25
|
+
switch (u) {
|
|
61
26
|
case "bottom-start":
|
|
62
|
-
|
|
27
|
+
a = t.bottom + 4, s = t.left;
|
|
63
28
|
break;
|
|
64
29
|
case "bottom-end":
|
|
65
|
-
|
|
30
|
+
a = t.bottom + 4, s = t.right - ((e == null ? void 0 : e.offsetWidth) ?? n);
|
|
66
31
|
break;
|
|
67
32
|
case "top-start":
|
|
68
|
-
|
|
33
|
+
a = t.top - v - 4, s = t.left;
|
|
69
34
|
break;
|
|
70
35
|
case "top-end":
|
|
71
|
-
|
|
36
|
+
a = t.top - v - 4, s = t.right - ((e == null ? void 0 : e.offsetWidth) ?? n);
|
|
37
|
+
break;
|
|
38
|
+
case "right-start":
|
|
39
|
+
a = t.top, s = t.right + 4;
|
|
40
|
+
break;
|
|
41
|
+
case "left-start":
|
|
42
|
+
a = t.top, s = t.left - ((e == null ? void 0 : e.offsetWidth) ?? n) - 4;
|
|
72
43
|
break;
|
|
73
44
|
}
|
|
74
|
-
|
|
75
|
-
const E = window.innerHeight - p - 8;
|
|
76
|
-
d = Math.max(8, Math.min(d, E)), k({ top: d, left: i });
|
|
45
|
+
y({ top: a, left: s });
|
|
77
46
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return b.current && o && o.observe(b.current), window.addEventListener("resize", s), window.addEventListener("scroll", s, !0), () => {
|
|
81
|
-
o == null || o.disconnect(), window.removeEventListener("resize", s), window.removeEventListener("scroll", s, !0);
|
|
47
|
+
return r(), window.addEventListener("resize", r), window.addEventListener("scroll", r, !0), () => {
|
|
48
|
+
window.removeEventListener("resize", r), window.removeEventListener("scroll", r, !0);
|
|
82
49
|
};
|
|
83
|
-
}, [
|
|
84
|
-
if (!
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
e.key === "Escape" && (
|
|
50
|
+
}, [d, f, u, n, i]), N(() => {
|
|
51
|
+
if (!d) return;
|
|
52
|
+
const r = (e) => {
|
|
53
|
+
c.current && !c.current.contains(e.target) && f && !f.contains(e.target) && (o == null || o());
|
|
54
|
+
}, t = (e) => {
|
|
55
|
+
e.key === "Escape" && (o == null || o());
|
|
89
56
|
};
|
|
90
|
-
return document.addEventListener("mousedown",
|
|
91
|
-
document.removeEventListener("mousedown",
|
|
57
|
+
return document.addEventListener("mousedown", r), document.addEventListener("keydown", t), () => {
|
|
58
|
+
document.removeEventListener("mousedown", r), document.removeEventListener("keydown", t);
|
|
92
59
|
};
|
|
93
|
-
}, [
|
|
60
|
+
}, [d, f, o]);
|
|
61
|
+
const { openEffect: L } = R(b, "fade"), E = p[L] ?? p.fade;
|
|
62
|
+
return d ? /* @__PURE__ */ w(S, { children: /* @__PURE__ */ w(
|
|
94
63
|
"div",
|
|
95
64
|
{
|
|
96
|
-
ref:
|
|
65
|
+
ref: c,
|
|
97
66
|
role: "menu",
|
|
98
|
-
className:
|
|
67
|
+
className: z(
|
|
99
68
|
"bear-fixed bear-bg-white dark:bear-bg-gray-800",
|
|
100
69
|
"bear-border bear-border-gray-200 dark:bear-border-gray-700",
|
|
101
70
|
"bear-rounded-lg bear-shadow-lg bear-py-1",
|
|
102
71
|
"bear-overflow-y-auto",
|
|
72
|
+
E,
|
|
103
73
|
l
|
|
104
74
|
),
|
|
105
75
|
style: {
|
|
106
|
-
top:
|
|
107
|
-
left:
|
|
108
|
-
minWidth:
|
|
109
|
-
maxHeight:
|
|
110
|
-
zIndex:
|
|
76
|
+
top: m.top,
|
|
77
|
+
left: m.left,
|
|
78
|
+
minWidth: n,
|
|
79
|
+
maxHeight: i,
|
|
80
|
+
zIndex: x
|
|
111
81
|
},
|
|
112
|
-
"data-testid":
|
|
113
|
-
...
|
|
82
|
+
"data-testid": k,
|
|
83
|
+
...b,
|
|
114
84
|
children: g
|
|
115
85
|
}
|
|
116
86
|
) }) : null;
|
|
117
87
|
};
|
|
118
88
|
export {
|
|
119
|
-
|
|
120
|
-
O as MenuDivider,
|
|
121
|
-
H as MenuItem
|
|
89
|
+
j as Menu
|
|
122
90
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { OverlayMotionEffect, OverlayEffectConfig } from '../../hooks/useFixedAnchorPosition';
|
|
2
3
|
export interface MenuItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
4
|
id?: string;
|
|
4
5
|
/** Icon to show before the label */
|
|
@@ -26,11 +27,17 @@ export interface MenuProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
26
27
|
/** Menu items */
|
|
27
28
|
children?: ReactNode;
|
|
28
29
|
/** Position relative to anchor */
|
|
29
|
-
position?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
|
|
30
|
+
position?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'right-start' | 'left-start';
|
|
30
31
|
/** Min width of the menu */
|
|
31
32
|
minWidth?: number;
|
|
32
33
|
/** Max height before scrolling */
|
|
33
34
|
maxHeight?: number;
|
|
35
|
+
/** Transition effect when opening */
|
|
36
|
+
openEffect?: OverlayMotionEffect;
|
|
37
|
+
/** Transition effect when closing */
|
|
38
|
+
closeEffect?: OverlayMotionEffect;
|
|
39
|
+
/** Config for open and close transition effects */
|
|
40
|
+
effect?: OverlayEffectConfig;
|
|
34
41
|
/** Test ID */
|
|
35
42
|
testId?: string;
|
|
36
43
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("../../utils/cn.cjs");require("react");const a=({className:e})=>r.jsx("div",{className:i.cn("bear-h-px bear-bg-gray-200 dark:bear-bg-gray-700 bear-my-1",e)});exports.MenuDivider=a;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cn as e } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
const i = ({ className: r }) => /* @__PURE__ */ a("div", { className: e("bear-h-px bear-bg-gray-200 dark:bear-bg-gray-700 bear-my-1", r) });
|
|
5
|
+
export {
|
|
6
|
+
i as MenuDivider
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("../../utils/cn.cjs");require("react");const n=require("../../constants/numbers.const.cjs"),y=require("./MenuDivider.cjs"),x=({icon:t,disabled:r=!1,selected:b=!1,divider:o=!1,children:i,onClick:a,className:u,testId:c,...g})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{role:"menuitem",tabIndex:r?n.NEGATIVE_ONE:n.ZERO,className:m.cn("bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2 bear-cursor-pointer bear-transition-colors","hover:bear-bg-gray-100 dark:hover:bear-bg-gray-700","focus:bear-outline-none focus:bear-bg-gray-100 dark:focus:bear-bg-gray-700",b&&"bear-bg-primary-50 dark:bear-bg-primary-900/20 bear-text-primary-600",r&&"bear-opacity-50 bear-cursor-not-allowed hover:bear-bg-transparent",u),onClick:r?void 0:a,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&!r&&(a==null||a())},"data-testid":c,...g,children:[t&&e.jsx("span",{className:"bear-flex-shrink-0 bear-text-gray-500",children:t}),e.jsx("span",{className:"bear-flex-1 bear-text-sm",children:i})]}),o&&e.jsx(y.MenuDivider,{})]});exports.MenuItem=x;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs as o, Fragment as g, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cn as y } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { NEGATIVE_ONE as c, ZERO as x } from "../../constants/numbers.const.js";
|
|
5
|
+
import { MenuDivider as l } from "./MenuDivider.js";
|
|
6
|
+
const N = ({
|
|
7
|
+
icon: t,
|
|
8
|
+
disabled: r = !1,
|
|
9
|
+
selected: s = !1,
|
|
10
|
+
divider: n = !1,
|
|
11
|
+
children: m,
|
|
12
|
+
onClick: e,
|
|
13
|
+
className: i,
|
|
14
|
+
testId: p,
|
|
15
|
+
...f
|
|
16
|
+
}) => /* @__PURE__ */ o(g, { children: [
|
|
17
|
+
/* @__PURE__ */ o(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
role: "menuitem",
|
|
21
|
+
tabIndex: r ? c : x,
|
|
22
|
+
className: y(
|
|
23
|
+
"bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2 bear-cursor-pointer bear-transition-colors",
|
|
24
|
+
"hover:bear-bg-gray-100 dark:hover:bear-bg-gray-700",
|
|
25
|
+
"focus:bear-outline-none focus:bear-bg-gray-100 dark:focus:bear-bg-gray-700",
|
|
26
|
+
s && "bear-bg-primary-50 dark:bear-bg-primary-900/20 bear-text-primary-600",
|
|
27
|
+
r && "bear-opacity-50 bear-cursor-not-allowed hover:bear-bg-transparent",
|
|
28
|
+
i
|
|
29
|
+
),
|
|
30
|
+
onClick: r ? void 0 : e,
|
|
31
|
+
onKeyDown: (b) => {
|
|
32
|
+
(b.key === "Enter" || b.key === " ") && !r && (e == null || e());
|
|
33
|
+
},
|
|
34
|
+
"data-testid": p,
|
|
35
|
+
...f,
|
|
36
|
+
children: [
|
|
37
|
+
t && /* @__PURE__ */ a("span", { className: "bear-flex-shrink-0 bear-text-gray-500", children: t }),
|
|
38
|
+
/* @__PURE__ */ a("span", { className: "bear-flex-1 bear-text-sm", children: m })
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
n && /* @__PURE__ */ a(l, {})
|
|
43
|
+
] });
|
|
44
|
+
export {
|
|
45
|
+
N as MenuItem
|
|
46
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),E=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),E=require("react"),j=require("react-dom"),a=require("../../utils/cn.cjs"),q=require("../../utils/generateBearId.utils.cjs"),T=require("../../utils/useBearId.cjs"),g=require("../../hooks/useFocusTrap/useFocusTrap.cjs"),F=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.cjs"),R=require("@forgedevstack/bear-icons/navigation"),P=require("../Backdrop/Backdrop.cjs"),e=require("./Modal.const.cjs"),w=t=>{const{isOpen:s,onClose:r,title:l,children:A,size:M="md",showCloseButton:n=!0,closeOnEscape:L=!0,disableEscapeKeyDown:C=!1,lockBodyScroll:O=!0,cancelPreventScroll:f=!1,closeOnBackdrop:m=!0,hideBackdrop:B=!1,keepMounted:d=!1,isCancelBackgroundClick:i,zIndex:b=e.MODAL_Z_INDEX,className:D,footer:u,testId:v,id:p}=t,y=T.useBearId("Modal"),c=q.resolveBearId(p,y),_=E.useRef(null),S=O&&!f,h=i!==void 0?i:m,I=L&&!C,{openEffect:N}=F.resolveOverlayEffects(t,"scale"),k=e.MODAL_EFFECT_CLASS_MAP[N]??e.MODAL_EFFECT_CLASS_MAP.scale;if(g.useFocusTrap(_,{enabled:s,onEscape:I?r:void 0}),E.useEffect(()=>{if(s)return S&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}},[s,S]),!s&&!d)return null;const x=o.jsxs("div",{className:e.MODAL_ROOT_CLASSES,"data-testid":v,id:c,style:{zIndex:b},children:[!B&&o.jsx(P.Backdrop,{open:s,keepMounted:d,blur:!0,nested:!0,className:"Bear-Modal__backdrop",onClick:h?()=>r():void 0}),o.jsxs("div",{ref:_,role:"dialog","aria-modal":"true","aria-labelledby":l?`${c}-title`:void 0,className:a.cn("Bear-Modal__container",e.MODAL_CONTAINER_CLASSES,e.MODAL_SIZE_CLASSES[M],s&&k,D),style:{zIndex:e.MODAL_PANEL_Z_INDEX},children:[(l||n)&&o.jsxs("div",{className:a.cn("Bear-Modal__header",e.MODAL_HEADER_CLASSES),children:[l&&o.jsx("h2",{id:`${c}-title`,className:a.cn("Bear-Modal__title",e.MODAL_TITLE_CLASSES),children:l}),n&&o.jsx("button",{type:"button",onClick:r,className:a.cn("Bear-Modal__close",e.MODAL_CLOSE_CLASSES),"aria-label":"Close modal",children:o.jsx(R.CloseIcon,{className:"bear-w-5 bear-h-5"})})]}),o.jsx("div",{className:a.cn("Bear-Modal__body",e.MODAL_BODY_CLASSES),children:A}),u&&o.jsx("div",{className:a.cn("Bear-Modal__footer",e.MODAL_FOOTER_CLASSES),children:u})]})]});return j.createPortal(x,document.body)};exports.Modal=w;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/numbers.const.cjs"),r=e.ELEVEN_THOUSAND,a=e.ONE,b="Bear-Modal bear-fixed bear-inset-0 bear-flex bear-items-center bear-justify-center bear-p-4",t={sm:"bear-max-w-sm",md:"bear-max-w-md",lg:"bear-max-w-lg",xl:"bear-max-w-xl",full:"bear-max-w-full bear-mx-4"},S="bear-relative bear-w-full bear-max-h-[calc(100vh-2rem)] bear-overflow-y-auto bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all bear-animate-in bear-fade-in bear-zoom-in-95",n="bear-flex bear-items-center bear-justify-between bear-px-6 bear-py-4 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700",o="bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white",_="bear-p-1 bear-rounded-lg bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-white hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700 bear-transition-colors",A="bear-px-6 bear-py-4 bear-text-gray-600 dark:bear-text-gray-300",L="bear-flex bear-items-center bear-justify-end bear-gap-3 bear-px-6 bear-py-4 bear-border-t bear-border-gray-200 dark:bear-border-zinc-700",E={scale:"animate-scale-in",fade:"animate-fade-in","slide-down":"animate-grow-up",fold:"animate-alert-dialog-in",none:""};exports.MODAL_BODY_CLASSES=A;exports.MODAL_CLOSE_CLASSES=_;exports.MODAL_CONTAINER_CLASSES=S;exports.MODAL_EFFECT_CLASS_MAP=E;exports.MODAL_FOOTER_CLASSES=L;exports.MODAL_HEADER_CLASSES=n;exports.MODAL_PANEL_Z_INDEX=a;exports.MODAL_ROOT_CLASSES=b;exports.MODAL_SIZE_CLASSES=t;exports.MODAL_TITLE_CLASSES=o;exports.MODAL_Z_INDEX=r;
|
|
@@ -10,3 +10,4 @@ export declare const MODAL_TITLE_CLASSES = "bear-text-lg bear-font-semibold bear
|
|
|
10
10
|
export declare const MODAL_CLOSE_CLASSES = "bear-p-1 bear-rounded-lg bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-white hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700 bear-transition-colors";
|
|
11
11
|
export declare const MODAL_BODY_CLASSES = "bear-px-6 bear-py-4 bear-text-gray-600 dark:bear-text-gray-300";
|
|
12
12
|
export declare const MODAL_FOOTER_CLASSES = "bear-flex bear-items-center bear-justify-end bear-gap-3 bear-px-6 bear-py-4 bear-border-t bear-border-gray-200 dark:bear-border-zinc-700";
|
|
13
|
+
export declare const MODAL_EFFECT_CLASS_MAP: Record<string, string>;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import { ELEVEN_THOUSAND as e, ONE as r } from "../../constants/numbers.const.js";
|
|
2
|
+
const b = e, t = r, o = "Bear-Modal bear-fixed bear-inset-0 bear-flex bear-items-center bear-justify-center bear-p-4", n = {
|
|
2
3
|
sm: "bear-max-w-sm",
|
|
3
4
|
md: "bear-max-w-md",
|
|
4
5
|
lg: "bear-max-w-lg",
|
|
5
6
|
xl: "bear-max-w-xl",
|
|
6
7
|
full: "bear-max-w-full bear-mx-4"
|
|
7
|
-
},
|
|
8
|
+
}, i = "bear-relative bear-w-full bear-max-h-[calc(100vh-2rem)] bear-overflow-y-auto bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all bear-animate-in bear-fade-in bear-zoom-in-95", d = "bear-flex bear-items-center bear-justify-between bear-px-6 bear-py-4 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700", l = "bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white", s = "bear-p-1 bear-rounded-lg bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-white hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700 bear-transition-colors", S = "bear-px-6 bear-py-4 bear-text-gray-600 dark:bear-text-gray-300", x = "bear-flex bear-items-center bear-justify-end bear-gap-3 bear-px-6 bear-py-4 bear-border-t bear-border-gray-200 dark:bear-border-zinc-700", c = {
|
|
9
|
+
scale: "animate-scale-in",
|
|
10
|
+
fade: "animate-fade-in",
|
|
11
|
+
"slide-down": "animate-grow-up",
|
|
12
|
+
fold: "animate-alert-dialog-in",
|
|
13
|
+
none: ""
|
|
14
|
+
};
|
|
8
15
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
n as
|
|
18
|
-
|
|
16
|
+
S as MODAL_BODY_CLASSES,
|
|
17
|
+
s as MODAL_CLOSE_CLASSES,
|
|
18
|
+
i as MODAL_CONTAINER_CLASSES,
|
|
19
|
+
c as MODAL_EFFECT_CLASS_MAP,
|
|
20
|
+
x as MODAL_FOOTER_CLASSES,
|
|
21
|
+
d as MODAL_HEADER_CLASSES,
|
|
22
|
+
t as MODAL_PANEL_Z_INDEX,
|
|
23
|
+
o as MODAL_ROOT_CLASSES,
|
|
24
|
+
n as MODAL_SIZE_CLASSES,
|
|
25
|
+
l as MODAL_TITLE_CLASSES,
|
|
26
|
+
b as MODAL_Z_INDEX
|
|
19
27
|
};
|
|
@@ -1,107 +1,110 @@
|
|
|
1
|
-
import { jsxs as s, jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsxs as s, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as R, useEffect as w } from "react";
|
|
3
3
|
import { createPortal as x } from "react-dom";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { resolveBearId as
|
|
6
|
-
import { useBearId as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
4
|
+
import { cn as l } from "../../utils/cn.js";
|
|
5
|
+
import { resolveBearId as g } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as F } from "../../utils/useBearId.js";
|
|
7
|
+
import { useFocusTrap as P } from "../../hooks/useFocusTrap/useFocusTrap.js";
|
|
8
|
+
import { resolveOverlayEffects as z } from "../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.js";
|
|
9
|
+
import { CloseIcon as Z } from "@forgedevstack/bear-icons/navigation";
|
|
10
|
+
import { Backdrop as j } from "../Backdrop/Backdrop.js";
|
|
11
|
+
import { MODAL_Z_INDEX as X, MODAL_ROOT_CLASSES as $, MODAL_PANEL_Z_INDEX as H, MODAL_TITLE_CLASSES as K, MODAL_CLOSE_CLASSES as Y, MODAL_HEADER_CLASSES as q, MODAL_BODY_CLASSES as G, MODAL_FOOTER_CLASSES as J, MODAL_EFFECT_CLASS_MAP as S, MODAL_SIZE_CLASSES as Q, MODAL_CONTAINER_CLASSES as U } from "./Modal.const.js";
|
|
12
|
+
const ne = (d) => {
|
|
11
13
|
const {
|
|
12
|
-
isOpen:
|
|
13
|
-
onClose:
|
|
14
|
-
title:
|
|
15
|
-
children:
|
|
16
|
-
size:
|
|
14
|
+
isOpen: e,
|
|
15
|
+
onClose: r,
|
|
16
|
+
title: a,
|
|
17
|
+
children: u,
|
|
18
|
+
size: E = "md",
|
|
17
19
|
showCloseButton: c = !0,
|
|
18
|
-
closeOnEscape:
|
|
19
|
-
disableEscapeKeyDown:
|
|
20
|
-
lockBodyScroll:
|
|
20
|
+
closeOnEscape: p = !0,
|
|
21
|
+
disableEscapeKeyDown: A = !1,
|
|
22
|
+
lockBodyScroll: L = !0,
|
|
21
23
|
cancelPreventScroll: C = !1,
|
|
22
24
|
closeOnBackdrop: M = !0,
|
|
23
25
|
hideBackdrop: O = !1,
|
|
24
26
|
keepMounted: n = !1,
|
|
25
27
|
isCancelBackgroundClick: i,
|
|
26
|
-
zIndex: B =
|
|
27
|
-
className:
|
|
28
|
+
zIndex: B = X,
|
|
29
|
+
className: b,
|
|
28
30
|
footer: m,
|
|
29
|
-
testId:
|
|
30
|
-
id:
|
|
31
|
-
} =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return document.addEventListener("keydown", t), _ && (document.body.style.overflow = "hidden"), () => {
|
|
40
|
-
document.removeEventListener("keydown", t), document.body.style.overflow = "";
|
|
31
|
+
testId: D,
|
|
32
|
+
id: v
|
|
33
|
+
} = d, N = F("Modal"), t = g(v, N), _ = R(null), f = L && !C, h = i !== void 0 ? i : M, y = p && !A, { openEffect: k } = z(d, "scale"), I = S[k] ?? S.scale;
|
|
34
|
+
if (P(_, {
|
|
35
|
+
enabled: e,
|
|
36
|
+
onEscape: y ? r : void 0
|
|
37
|
+
}), w(() => {
|
|
38
|
+
if (e)
|
|
39
|
+
return f && (document.body.style.overflow = "hidden"), () => {
|
|
40
|
+
document.body.style.overflow = "";
|
|
41
41
|
};
|
|
42
|
-
}, [
|
|
43
|
-
const
|
|
42
|
+
}, [e, f]), !e && !n) return null;
|
|
43
|
+
const T = /* @__PURE__ */ s(
|
|
44
44
|
"div",
|
|
45
45
|
{
|
|
46
|
-
className:
|
|
47
|
-
"data-testid":
|
|
48
|
-
id:
|
|
46
|
+
className: $,
|
|
47
|
+
"data-testid": D,
|
|
48
|
+
id: t,
|
|
49
49
|
style: { zIndex: B },
|
|
50
50
|
children: [
|
|
51
|
-
!O && /* @__PURE__ */
|
|
52
|
-
|
|
51
|
+
!O && /* @__PURE__ */ o(
|
|
52
|
+
j,
|
|
53
53
|
{
|
|
54
|
-
open:
|
|
54
|
+
open: e,
|
|
55
55
|
keepMounted: n,
|
|
56
56
|
blur: !0,
|
|
57
57
|
nested: !0,
|
|
58
58
|
className: "Bear-Modal__backdrop",
|
|
59
|
-
onClick:
|
|
59
|
+
onClick: h ? () => r() : void 0
|
|
60
60
|
}
|
|
61
61
|
),
|
|
62
62
|
/* @__PURE__ */ s(
|
|
63
63
|
"div",
|
|
64
64
|
{
|
|
65
|
+
ref: _,
|
|
65
66
|
role: "dialog",
|
|
66
67
|
"aria-modal": "true",
|
|
67
|
-
"aria-labelledby":
|
|
68
|
-
className:
|
|
68
|
+
"aria-labelledby": a ? `${t}-title` : void 0,
|
|
69
|
+
className: l(
|
|
69
70
|
"Bear-Modal__container",
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
U,
|
|
72
|
+
Q[E],
|
|
73
|
+
e && I,
|
|
74
|
+
b
|
|
73
75
|
),
|
|
74
|
-
style: { zIndex:
|
|
76
|
+
style: { zIndex: H },
|
|
75
77
|
children: [
|
|
76
|
-
(
|
|
77
|
-
|
|
78
|
+
(a || c) && /* @__PURE__ */ s("div", { className: l("Bear-Modal__header", q), children: [
|
|
79
|
+
a && /* @__PURE__ */ o(
|
|
78
80
|
"h2",
|
|
79
81
|
{
|
|
80
|
-
id: `${
|
|
81
|
-
className:
|
|
82
|
-
children:
|
|
82
|
+
id: `${t}-title`,
|
|
83
|
+
className: l("Bear-Modal__title", K),
|
|
84
|
+
children: a
|
|
83
85
|
}
|
|
84
86
|
),
|
|
85
|
-
c && /* @__PURE__ */
|
|
87
|
+
c && /* @__PURE__ */ o(
|
|
86
88
|
"button",
|
|
87
89
|
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
type: "button",
|
|
91
|
+
onClick: r,
|
|
92
|
+
className: l("Bear-Modal__close", Y),
|
|
90
93
|
"aria-label": "Close modal",
|
|
91
|
-
children: /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ o(Z, { className: "bear-w-5 bear-h-5" })
|
|
92
95
|
}
|
|
93
96
|
)
|
|
94
97
|
] }),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
m && /* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ o("div", { className: l("Bear-Modal__body", G), children: u }),
|
|
99
|
+
m && /* @__PURE__ */ o("div", { className: l("Bear-Modal__footer", J), children: m })
|
|
97
100
|
]
|
|
98
101
|
}
|
|
99
102
|
)
|
|
100
103
|
]
|
|
101
104
|
}
|
|
102
105
|
);
|
|
103
|
-
return x(
|
|
106
|
+
return x(T, document.body);
|
|
104
107
|
};
|
|
105
108
|
export {
|
|
106
|
-
|
|
109
|
+
ne as Modal
|
|
107
110
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { OverlayMotionEffect, OverlayEffectConfig } from '../../hooks/useFixedAnchorPosition';
|
|
2
3
|
export type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
3
4
|
export interface ModalProps {
|
|
4
5
|
/** Whether the modal is open */
|
|
@@ -26,6 +27,12 @@ export interface ModalProps {
|
|
|
26
27
|
cancelPreventScroll?: boolean;
|
|
27
28
|
/** When provided, sets whether clicking the backdrop closes the modal (overrides closeOnBackdrop) */
|
|
28
29
|
isCancelBackgroundClick?: boolean;
|
|
30
|
+
/** Transition effect when opening */
|
|
31
|
+
openEffect?: OverlayMotionEffect;
|
|
32
|
+
/** Transition effect when closing */
|
|
33
|
+
closeEffect?: OverlayMotionEffect;
|
|
34
|
+
/** Config for open and close transition effects */
|
|
35
|
+
effect?: OverlayEffectConfig;
|
|
29
36
|
/** Additional class names for content */
|
|
30
37
|
className?: string;
|
|
31
38
|
/** Footer content */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),c=require("react"),V=require("react-dom"),R=require("../../utils/cn.cjs"),m=require("../../constants/numbers.const.cjs"),j=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.cjs"),e=require("./Popover.const.cjs");function z(E,t,d){const n={position:"fixed",zIndex:e.POPOVER_Z_INDEX},[r]=E.split("-"),s=E.includes(e.ALIGN_START),i=E.includes(e.ALIGN_END);return r===e.PLACEMENT_BOTTOM||r===e.PLACEMENT_TOP?(n.top=r===e.PLACEMENT_BOTTOM?t.bottom+d:void 0,n.bottom=r===e.PLACEMENT_TOP?window.innerHeight-t.top+d:void 0,n.left=s?t.left:i?t.right:t.left+t.width/m.TWO,n.transform=!s&&!i?e.TRANSFORM_TRANSLATE_X_CENTER:i?e.TRANSFORM_TRANSLATE_X_END:void 0):(n.left=r===e.PLACEMENT_RIGHT?t.right+d:void 0,n.right=r===e.PLACEMENT_LEFT?window.innerWidth-t.left+d:void 0,n.bottom=i?window.innerHeight-t.bottom:void 0,n.top=i?void 0:s?t.top:t.top+t.height/m.TWO,n.transform=!s&&!i?e.TRANSFORM_TRANSLATE_Y_CENTER:i?e.TRANSFORM_TRANSLATE_Y_END:void 0),n}const B=({children:E,content:t,placement:d=e.PLACEMENT_BOTTOM,trigger:n="click",open:r,onOpenChange:s,className:i,contentClassName:b,arrow:O=!0,closeOnClickOutside:P=!0,closeOnEscape:A=!0,offset:L=e.POPOVER_DEFAULT_OFFSET,openEffect:w,closeEffect:S,effect:h})=>{const[M,p]=c.useState(!1),[C,F]=c.useState({}),f=c.useRef(null),T=c.useRef(null),a=r!==void 0?r:M,l=c.useCallback(o=>{p(o),s==null||s(o)},[s]),v=c.useCallback(()=>{if(!f.current||!T.current)return;const o=f.current.firstElementChild;if(!o)return;const u=o.getBoundingClientRect();F(z(d,u,L))},[d,L]);c.useEffect(()=>{if(a){v();const o=()=>v(),u=()=>v();return window.addEventListener("resize",o),window.addEventListener("scroll",u,!0),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",u,!0)}}},[a,v]),c.useEffect(()=>{if(!a||!P)return;const o=u=>{const N=u.target;f.current&&!f.current.contains(N)&&T.current&&!T.current.contains(N)&&l(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[a,P,l]),c.useEffect(()=>{if(!a||!A)return;const o=u=>{u.key==="Escape"&&l(!1)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a,A,l]);const g=()=>{n==="click"&&l(!a)},y=()=>{n==="hover"&&l(!0)},k=()=>{n==="hover"&&l(!1)},x=d.split("-")[0],{openEffect:D}=j.resolveOverlayEffects({openEffect:w,closeEffect:S,effect:h},"fade"),q=e.POPOVER_EFFECT_CLASS_MAP[D]??e.POPOVER_EFFECT_CLASS_MAP.fade,I=a&&typeof document<"u"&&V.createPortal(_.jsxs("div",{ref:T,"data-bear-popover":!0,className:R.cn("bear-bg-zinc-800 bear-border bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-3",q,b),style:C,children:[t,O&&_.jsx("div",{className:R.cn("bear-absolute bear-w-0 bear-h-0 bear-border-8",e.POPOVER_ARROW_STYLES[x])})]}),document.body);return _.jsxs("div",{ref:f,className:R.cn("bear-relative bear-inline-block",i),onMouseEnter:y,onMouseLeave:k,children:[_.jsx("div",{onClick:g,className:"bear-cursor-pointer",children:E}),I]})};exports.Popover=B;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../constants/numbers.const.cjs"),t=r.ELEVEN_THOUSAND,e=r.EIGHT,a={scale:"animate-scale-in",fade:"animate-fade-in","slide-down":"animate-grow-up",fold:"animate-alert-dialog-in",none:""},E="bottom",T="top",n="left",_="right",o="start",A="end",b="translateX(-50%)",R="translateX(-100%)",N="translateY(-50%)",s="translateY(-100%)",O={top:"bear-top-full bear-left-1/2 -bear-translate-x-1/2 bear-border-t-zinc-700 bear-border-x-transparent bear-border-b-transparent",bottom:"bear-bottom-full bear-left-1/2 -bear-translate-x-1/2 bear-border-b-zinc-700 bear-border-x-transparent bear-border-t-transparent",left:"bear-left-full bear-top-1/2 -bear-translate-y-1/2 bear-border-l-zinc-700 bear-border-y-transparent bear-border-r-transparent",right:"bear-right-full bear-top-1/2 -bear-translate-y-1/2 bear-border-r-zinc-700 bear-border-y-transparent bear-border-l-transparent"};exports.ALIGN_END=A;exports.ALIGN_START=o;exports.PLACEMENT_BOTTOM=E;exports.PLACEMENT_LEFT=n;exports.PLACEMENT_RIGHT=_;exports.PLACEMENT_TOP=T;exports.POPOVER_ARROW_STYLES=O;exports.POPOVER_DEFAULT_OFFSET=e;exports.POPOVER_EFFECT_CLASS_MAP=a;exports.POPOVER_Z_INDEX=t;exports.TRANSFORM_TRANSLATE_X_CENTER=b;exports.TRANSFORM_TRANSLATE_X_END=R;exports.TRANSFORM_TRANSLATE_Y_CENTER=N;exports.TRANSFORM_TRANSLATE_Y_END=s;
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const POPOVER_ROOT_CLASS = "Bear-Popover";
|
|
2
|
+
export declare const POPOVER_Z_INDEX = 11000;
|
|
3
|
+
export declare const POPOVER_DEFAULT_OFFSET = 8;
|
|
4
|
+
export declare const POPOVER_EFFECT_CLASS_MAP: Record<string, string>;
|
|
5
|
+
export declare const PLACEMENT_BOTTOM = "bottom";
|
|
6
|
+
export declare const PLACEMENT_TOP = "top";
|
|
7
|
+
export declare const PLACEMENT_LEFT = "left";
|
|
8
|
+
export declare const PLACEMENT_RIGHT = "right";
|
|
9
|
+
export declare const ALIGN_START = "start";
|
|
10
|
+
export declare const ALIGN_END = "end";
|
|
11
|
+
export declare const TRANSFORM_TRANSLATE_X_CENTER = "translateX(-50%)";
|
|
12
|
+
export declare const TRANSFORM_TRANSLATE_X_END = "translateX(-100%)";
|
|
13
|
+
export declare const TRANSFORM_TRANSLATE_Y_CENTER = "translateY(-50%)";
|
|
14
|
+
export declare const TRANSFORM_TRANSLATE_Y_END = "translateY(-100%)";
|
|
15
|
+
export declare const POPOVER_ARROW_STYLES: Record<string, string>;
|