@forgedevstack/bear 1.1.4 → 1.1.9
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 +21 -2
- package/dist/components/Anchor/Anchor.cjs +1 -1
- package/dist/components/Anchor/Anchor.js +37 -45
- package/dist/components/Anchor/Anchor.utils.cjs +1 -0
- package/dist/components/Anchor/Anchor.utils.d.ts +2 -0
- package/dist/components/Anchor/Anchor.utils.js +12 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +60 -67
- package/dist/components/Autocomplete/Autocomplete.utils.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.utils.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.utils.js +12 -0
- package/dist/components/BackTop/BackTop.cjs +1 -1
- package/dist/components/BackTop/BackTop.js +10 -11
- package/dist/components/BearLogo/BearLogo.d.ts +2 -7
- package/dist/components/BearLogo/BearLogo.types.d.ts +15 -0
- package/dist/components/BearLogo/EmberLogo.d.ts +1 -8
- package/dist/components/BearLogo/index.d.ts +1 -2
- package/dist/components/Biometric/Biometric.cjs +1 -0
- package/dist/components/Biometric/Biometric.d.ts +3 -0
- package/dist/components/Biometric/Biometric.js +123 -0
- package/dist/components/Biometric/Biometric.types.d.ts +35 -0
- package/dist/components/Biometric/BiometricIcon.cjs +1 -0
- package/dist/components/Biometric/BiometricIcon.d.ts +3 -0
- package/dist/components/Biometric/BiometricIcon.js +45 -0
- package/dist/components/Biometric/index.d.ts +3 -0
- package/dist/components/Biometric/useBiometric.cjs +1 -0
- package/dist/components/Biometric/useBiometric.d.ts +2 -0
- package/dist/components/Biometric/useBiometric.js +21 -0
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +2 -2
- package/dist/components/Button/Button.constants.d.ts +1 -0
- package/dist/components/Button/Button.constants.js +12 -5
- package/dist/components/Button/Button.d.ts +0 -27
- package/dist/components/Button/Button.js +93 -105
- package/dist/components/Button/Button.types.d.ts +1 -0
- package/dist/components/Button/Button.utils.cjs +1 -0
- package/dist/components/Button/Button.utils.d.ts +2 -0
- package/dist/components/Button/Button.utils.js +5 -0
- package/dist/components/Button/useSpotlight.cjs +1 -0
- package/dist/components/Button/useSpotlight.d.ts +21 -0
- package/dist/components/Button/useSpotlight.js +28 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -0
- package/dist/components/Chart/Chart.const.js +21 -0
- package/dist/components/Chart/Chart.js +55 -71
- package/dist/components/Chart/Chart.utils.cjs +1 -0
- package/dist/components/Chart/Chart.utils.js +5 -0
- package/dist/components/Confetti/Confetti.cjs +1 -1
- package/dist/components/Confetti/Confetti.js +37 -34
- package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +31 -30
- package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
- package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
- package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
- package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.const.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.const.js +12 -13
- package/dist/components/DateRangePicker/DateRangePicker.js +107 -81
- package/dist/components/Dock/Dock.cjs +1 -1
- package/dist/components/Dock/Dock.js +38 -43
- package/dist/components/Dock/Dock.utils.cjs +1 -0
- package/dist/components/Dock/Dock.utils.d.ts +1 -0
- package/dist/components/Dock/Dock.utils.js +10 -0
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +77 -74
- package/dist/components/FileTree/FileTree.cjs +1 -1
- package/dist/components/FileTree/FileTree.js +20 -32
- package/dist/components/FileTree/FileTree.utils.cjs +1 -0
- package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
- package/dist/components/FileTree/FileTree.utils.js +15 -0
- package/dist/components/GradientText/GradientText.cjs +1 -1
- package/dist/components/GradientText/GradientText.js +27 -29
- package/dist/components/Icon/icons/bear.cjs +1 -0
- package/dist/components/Icon/icons/bear.d.ts +12 -0
- package/dist/components/Icon/icons/bear.js +47 -0
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +18 -0
- package/dist/components/Icon/index.js +17 -15
- package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.const.js +6 -7
- package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -41
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +153 -101
- package/dist/components/Input/Input.types.d.ts +8 -2
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +64 -68
- package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
- package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
- package/dist/components/PageNav/PageNav.cjs +1 -0
- package/dist/components/PageNav/PageNav.const.cjs +1 -0
- package/dist/components/PageNav/PageNav.const.d.ts +22 -0
- package/dist/components/PageNav/PageNav.const.js +42 -0
- package/dist/components/PageNav/PageNav.d.ts +3 -0
- package/dist/components/PageNav/PageNav.js +81 -0
- package/dist/components/PageNav/PageNav.types.d.ts +17 -0
- package/dist/components/PageNav/index.d.ts +2 -0
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +76 -76
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.js +6 -6
- package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
- package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
- package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
- package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
- package/dist/components/PropsPlayground/index.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +54 -53
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.js +24 -24
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.js +89 -94
- package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
- package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.utils.js +10 -0
- package/dist/components/SliderRange/SliderRange.cjs +1 -1
- package/dist/components/SliderRange/SliderRange.js +61 -63
- package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
- package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
- package/dist/components/SliderRange/SliderRange.utils.js +7 -0
- package/dist/components/Spotlight/Spotlight.cjs +1 -1
- package/dist/components/Spotlight/Spotlight.js +62 -73
- package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
- package/dist/components/Spotlight/Spotlight.utils.js +18 -0
- package/dist/components/Tabs/TabList.cjs +1 -0
- package/dist/components/Tabs/TabList.d.ts +3 -0
- package/dist/components/Tabs/TabList.js +69 -0
- package/dist/components/Tabs/TabPanel.cjs +1 -0
- package/dist/components/Tabs/TabPanel.d.ts +3 -0
- package/dist/components/Tabs/TabPanel.js +13 -0
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.d.ts +2 -27
- package/dist/components/Tabs/Tabs.js +43 -61
- package/dist/components/Tabs/Tabs.types.d.ts +7 -1
- package/dist/components/Tabs/index.d.ts +3 -1
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +18 -17
- package/dist/components/Toast/Toast.utils.cjs +1 -0
- package/dist/components/Toast/Toast.utils.d.ts +1 -0
- package/dist/components/Toast/Toast.utils.js +4 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +10 -11
- package/dist/components/Tour/Tour.cjs +1 -1
- package/dist/components/Tour/Tour.js +1 -2
- package/dist/components/VirtualList/VirtualList.cjs +1 -1
- package/dist/components/VirtualList/VirtualList.js +38 -43
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +9 -2
- package/dist/components/index.js +311 -300
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +60 -58
- package/dist/hooks/useResizeObserver/index.d.ts +2 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
- package/dist/icons.cjs +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +397 -384
- package/dist/styles/_base.css +7 -3
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -1,130 +1,126 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
|
|
1
|
+
import { jsxs as L, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useRef as v, useCallback as P, useEffect as h } from "react";
|
|
3
|
+
import { cn as k } from "../../utils/cn.js";
|
|
4
|
+
import { defaultFilter as S } from "./MentionsInput.utils.js";
|
|
5
|
+
const W = {
|
|
5
6
|
sm: "bear-h-8 bear-text-sm bear-px-3",
|
|
6
7
|
md: "bear-h-10 bear-text-base bear-px-4",
|
|
7
8
|
lg: "bear-h-12 bear-text-lg bear-px-5"
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, Z = ({
|
|
14
|
-
value: o,
|
|
15
|
-
defaultValue: m = "",
|
|
16
|
-
onChange: t,
|
|
17
|
-
onMentionSelect: s,
|
|
9
|
+
}, C = ({
|
|
10
|
+
value: p,
|
|
11
|
+
defaultValue: M = "",
|
|
12
|
+
onChange: n,
|
|
13
|
+
onMentionSelect: m,
|
|
18
14
|
options: T,
|
|
19
|
-
trigger:
|
|
15
|
+
trigger: s = "@",
|
|
20
16
|
placeholder: $ = "Type @ to mention...",
|
|
21
|
-
disabled:
|
|
17
|
+
disabled: z = !1,
|
|
22
18
|
maxSuggestions: j = 5,
|
|
23
|
-
filterOptions: A =
|
|
19
|
+
filterOptions: A = S,
|
|
24
20
|
size: K = "md",
|
|
25
21
|
fullWidth: Q = !1,
|
|
26
22
|
className: B
|
|
27
23
|
}) => {
|
|
28
|
-
const [F,
|
|
29
|
-
const e =
|
|
24
|
+
const [F, I] = b(M), [i, H] = b(""), [U, u] = b(!1), [l, d] = b(0), [x, V] = b(null), g = v(null), q = v(null), y = v(null), t = p ?? F, o = A(T, i).slice(0, j), E = U && i.length >= 0, D = P(() => {
|
|
25
|
+
const e = t.lastIndexOf(s);
|
|
30
26
|
if (e === -1) return { query: "", start: null };
|
|
31
|
-
const r =
|
|
32
|
-
return { query:
|
|
33
|
-
}, [
|
|
34
|
-
|
|
35
|
-
const { query: e, start: r } =
|
|
36
|
-
H(e),
|
|
37
|
-
}, [
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
if (
|
|
41
|
-
const e = y.current.children[
|
|
27
|
+
const r = t.slice(e + s.length), a = r.indexOf(" ");
|
|
28
|
+
return { query: a === -1 ? r : r.slice(0, a), start: e };
|
|
29
|
+
}, [t, s]);
|
|
30
|
+
h(() => {
|
|
31
|
+
const { query: e, start: r } = D();
|
|
32
|
+
H(e), V(r), u(r !== null && !e.includes(" "));
|
|
33
|
+
}, [t, D]), h(() => {
|
|
34
|
+
d(0);
|
|
35
|
+
}, [i]), h(() => {
|
|
36
|
+
if (l >= 0 && y.current) {
|
|
37
|
+
const e = y.current.children[l];
|
|
42
38
|
e == null || e.scrollIntoView({ block: "nearest" });
|
|
43
39
|
}
|
|
44
|
-
}, [
|
|
40
|
+
}, [l]), h(() => {
|
|
45
41
|
const e = (r) => {
|
|
46
|
-
|
|
42
|
+
g.current && !g.current.contains(r.target) && u(!1);
|
|
47
43
|
};
|
|
48
44
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
49
45
|
}, []);
|
|
50
46
|
const O = (e) => {
|
|
51
|
-
const r = new RegExp(`${
|
|
52
|
-
let
|
|
53
|
-
for (; (
|
|
54
|
-
|
|
55
|
-
return [...new Set(
|
|
56
|
-
},
|
|
47
|
+
const r = new RegExp(`${s}(\\w+)`, "g"), a = [];
|
|
48
|
+
let c;
|
|
49
|
+
for (; (c = r.exec(e)) !== null; )
|
|
50
|
+
a.push(c[1]);
|
|
51
|
+
return [...new Set(a)];
|
|
52
|
+
}, G = (e) => {
|
|
57
53
|
const r = e.target.value;
|
|
58
|
-
|
|
54
|
+
p === void 0 && I(r), n == null || n(r, O(r));
|
|
59
55
|
}, N = (e) => {
|
|
60
56
|
var R;
|
|
61
|
-
if (
|
|
62
|
-
const r =
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
if (!(!
|
|
57
|
+
if (x == null) return;
|
|
58
|
+
const r = t.slice(0, x), a = t.slice(x + s.length + i.length), c = `${s}${e.value}`, w = r + c + " " + a;
|
|
59
|
+
p === void 0 && I(w), n == null || n(w, O(w)), m == null || m(e), u(!1), (R = q.current) == null || R.focus();
|
|
60
|
+
}, J = (e) => {
|
|
61
|
+
if (!(!E || o.length === 0)) {
|
|
66
62
|
if (e.key === "ArrowDown") {
|
|
67
|
-
e.preventDefault(),
|
|
63
|
+
e.preventDefault(), d((r) => Math.min(r + 1, o.length - 1));
|
|
68
64
|
return;
|
|
69
65
|
}
|
|
70
66
|
if (e.key === "ArrowUp") {
|
|
71
|
-
e.preventDefault(),
|
|
67
|
+
e.preventDefault(), d((r) => Math.max(r - 1, 0));
|
|
72
68
|
return;
|
|
73
69
|
}
|
|
74
70
|
if (e.key === "Enter" || e.key === "Tab") {
|
|
75
71
|
e.preventDefault();
|
|
76
|
-
const r =
|
|
72
|
+
const r = o[l];
|
|
77
73
|
r && N(r);
|
|
78
74
|
return;
|
|
79
75
|
}
|
|
80
|
-
e.key === "Escape" &&
|
|
76
|
+
e.key === "Escape" && u(!1);
|
|
81
77
|
}
|
|
82
78
|
};
|
|
83
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ L(
|
|
84
80
|
"div",
|
|
85
81
|
{
|
|
86
|
-
ref:
|
|
87
|
-
className:
|
|
82
|
+
ref: g,
|
|
83
|
+
className: k(
|
|
88
84
|
"Bear-MentionsInput bear-relative",
|
|
89
85
|
Q && "bear-w-full",
|
|
90
86
|
B
|
|
91
87
|
),
|
|
92
88
|
children: [
|
|
93
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ f(
|
|
94
90
|
"input",
|
|
95
91
|
{
|
|
96
|
-
ref:
|
|
92
|
+
ref: q,
|
|
97
93
|
type: "text",
|
|
98
|
-
value:
|
|
99
|
-
onChange:
|
|
100
|
-
onKeyDown:
|
|
94
|
+
value: t,
|
|
95
|
+
onChange: G,
|
|
96
|
+
onKeyDown: J,
|
|
101
97
|
placeholder: $,
|
|
102
|
-
disabled:
|
|
103
|
-
className:
|
|
98
|
+
disabled: z,
|
|
99
|
+
className: k(
|
|
104
100
|
"bear-w-full bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-900 bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-500 dark:placeholder:bear-text-zinc-500 bear-outline-none bear-transition-colors focus:bear-border-bear-500 focus:bear-ring-2 focus:bear-ring-bear-500/20",
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
z && "bear-opacity-50 bear-cursor-not-allowed",
|
|
102
|
+
W[K]
|
|
107
103
|
)
|
|
108
104
|
}
|
|
109
105
|
),
|
|
110
|
-
|
|
106
|
+
E && o.length > 0 && /* @__PURE__ */ f(
|
|
111
107
|
"div",
|
|
112
108
|
{
|
|
113
109
|
ref: y,
|
|
114
110
|
className: "bear-absolute bear-z-50 bear-mt-1 bear-w-full bear-max-h-48 bear-overflow-auto bear-rounded-lg bear-border bear-border-gray-200 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-800 bear-py-1 bear-shadow-lg",
|
|
115
|
-
children:
|
|
111
|
+
children: o.map((e, r) => /* @__PURE__ */ L(
|
|
116
112
|
"button",
|
|
117
113
|
{
|
|
118
114
|
type: "button",
|
|
119
|
-
className:
|
|
115
|
+
className: k(
|
|
120
116
|
"bear-w-full bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-left bear-text-gray-800 dark:bear-text-zinc-200 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700 bear-transition-colors",
|
|
121
|
-
r ===
|
|
117
|
+
r === l && "bear-bg-gray-100 dark:bear-bg-zinc-700"
|
|
122
118
|
),
|
|
123
|
-
onMouseEnter: () =>
|
|
119
|
+
onMouseEnter: () => d(r),
|
|
124
120
|
onClick: () => N(e),
|
|
125
121
|
children: [
|
|
126
|
-
e.avatar && /* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */
|
|
122
|
+
e.avatar && /* @__PURE__ */ f("span", { className: "bear-shrink-0", children: e.avatar }),
|
|
123
|
+
/* @__PURE__ */ f("span", { children: e.label })
|
|
128
124
|
]
|
|
129
125
|
},
|
|
130
126
|
e.value
|
|
@@ -136,5 +132,5 @@ const J = {
|
|
|
136
132
|
);
|
|
137
133
|
};
|
|
138
134
|
export {
|
|
139
|
-
|
|
135
|
+
C as MentionsInput
|
|
140
136
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(l,r)=>{const e=r.toLowerCase();return l.filter(t=>t.value.toLowerCase().includes(e)||String(t.label).toLowerCase().includes(e))};exports.defaultFilter=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../utils/cn.cjs");require("react");const u=require("../Icon/Icon.cjs"),r=require("./PageNav.const.cjs"),p=({size:a})=>e.jsx(u.Icon,{size:a,children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}),h=({size:a})=>e.jsx(u.Icon,{size:a,children:e.jsx("polyline",{points:"9 6 15 12 9 18"})}),d=({item:a,direction:l,linkClass:n,labelClass:b,iconClass:t,sizeClass:x,iconSize:c})=>{const s=l==="prev",o=a.href?"a":"button",j=a.href?{href:a.href}:{type:"button",onClick:a.onClick};return e.jsxs(o,{...j,className:i.cn("bear-flex bear-flex-col bear-gap-1 bear-no-underline bear-min-w-0",s?"bear-items-start":"bear-items-end bear-ml-auto",n,x),children:[e.jsx("span",{className:i.cn("bear-text-[10px] bear-font-semibold bear-uppercase bear-tracking-wider",b),children:s?"Previous":"Next"}),e.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1.5 bear-font-medium",children:[s&&e.jsx("span",{className:i.cn("bear-flex-shrink-0",t),children:a.icon??e.jsx(p,{size:c})}),e.jsx("span",{className:"bear-truncate",children:a.label}),!s&&e.jsx("span",{className:i.cn("bear-flex-shrink-0",t),children:a.icon??e.jsx(h,{size:c})})]})]})},f=({prev:a,next:l,size:n="md",variant:b="default",className:t,testId:x,"aria-label":c="Page navigation"})=>{if(!a&&!l)return null;const s=r.VARIANT_CLASSES[b],o=r.ICON_SIZE[n];return e.jsxs("nav",{"data-testid":x,className:i.cn(r.ROOT_CLASS,"bear-flex bear-items-start bear-justify-between bear-gap-4 bear-border-t bear-border-zinc-700/50",r.SIZE_CLASSES[n],t),"aria-label":c,children:[a?e.jsx(d,{item:a,direction:"prev",linkClass:s.link,labelClass:s.label,iconClass:s.icon,sizeClass:r.LINK_SIZE[n],iconSize:o}):e.jsx("span",{}),l?e.jsx(d,{item:l,direction:"next",linkClass:s.link,labelClass:s.label,iconClass:s.icon,sizeClass:r.LINK_SIZE[n],iconSize:o}):e.jsx("span",{})]})};exports.PageNav=f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-PageNav",r={xs:"bear-text-xs bear-py-3",sm:"bear-text-sm bear-py-4",md:"bear-text-sm bear-py-6",lg:"bear-text-base bear-py-8",xl:"bear-text-lg bear-py-10"},a={xs:"bear-px-2 bear-py-1",sm:"bear-px-3 bear-py-1.5",md:"bear-px-4 bear-py-2",lg:"bear-px-5 bear-py-2.5",xl:"bear-px-6 bear-py-3"},b={default:{link:"bear-text-zinc-400 hover:bear-text-pink-400 bear-transition-colors",label:"bear-text-zinc-500",icon:"bear-text-pink-500"},outlined:{link:"bear-border bear-border-zinc-700 bear-rounded-lg hover:bear-border-pink-500 hover:bear-text-pink-400 bear-transition-all",label:"bear-text-zinc-500",icon:"bear-text-pink-500"},filled:{link:"bear-bg-zinc-800/50 bear-rounded-lg hover:bear-bg-pink-500/10 hover:bear-text-pink-400 bear-transition-all",label:"bear-text-zinc-500",icon:"bear-text-pink-500"}},t={xs:12,sm:14,md:16,lg:18,xl:20};exports.ICON_SIZE=t;exports.LINK_SIZE=a;exports.ROOT_CLASS=e;exports.SIZE_CLASSES=r;exports.VARIANT_CLASSES=b;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BearSize } from '../../types';
|
|
2
|
+
export declare const ROOT_CLASS = "Bear-PageNav";
|
|
3
|
+
export declare const SIZE_CLASSES: Record<BearSize, string>;
|
|
4
|
+
export declare const LINK_SIZE: Record<BearSize, string>;
|
|
5
|
+
export declare const VARIANT_CLASSES: {
|
|
6
|
+
default: {
|
|
7
|
+
link: string;
|
|
8
|
+
label: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
};
|
|
11
|
+
outlined: {
|
|
12
|
+
link: string;
|
|
13
|
+
label: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
};
|
|
16
|
+
filled: {
|
|
17
|
+
link: string;
|
|
18
|
+
label: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const ICON_SIZE: Record<BearSize, number>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const e = "Bear-PageNav", r = {
|
|
2
|
+
xs: "bear-text-xs bear-py-3",
|
|
3
|
+
sm: "bear-text-sm bear-py-4",
|
|
4
|
+
md: "bear-text-sm bear-py-6",
|
|
5
|
+
lg: "bear-text-base bear-py-8",
|
|
6
|
+
xl: "bear-text-lg bear-py-10"
|
|
7
|
+
}, a = {
|
|
8
|
+
xs: "bear-px-2 bear-py-1",
|
|
9
|
+
sm: "bear-px-3 bear-py-1.5",
|
|
10
|
+
md: "bear-px-4 bear-py-2",
|
|
11
|
+
lg: "bear-px-5 bear-py-2.5",
|
|
12
|
+
xl: "bear-px-6 bear-py-3"
|
|
13
|
+
}, b = {
|
|
14
|
+
default: {
|
|
15
|
+
link: "bear-text-zinc-400 hover:bear-text-pink-400 bear-transition-colors",
|
|
16
|
+
label: "bear-text-zinc-500",
|
|
17
|
+
icon: "bear-text-pink-500"
|
|
18
|
+
},
|
|
19
|
+
outlined: {
|
|
20
|
+
link: "bear-border bear-border-zinc-700 bear-rounded-lg hover:bear-border-pink-500 hover:bear-text-pink-400 bear-transition-all",
|
|
21
|
+
label: "bear-text-zinc-500",
|
|
22
|
+
icon: "bear-text-pink-500"
|
|
23
|
+
},
|
|
24
|
+
filled: {
|
|
25
|
+
link: "bear-bg-zinc-800/50 bear-rounded-lg hover:bear-bg-pink-500/10 hover:bear-text-pink-400 bear-transition-all",
|
|
26
|
+
label: "bear-text-zinc-500",
|
|
27
|
+
icon: "bear-text-pink-500"
|
|
28
|
+
}
|
|
29
|
+
}, t = {
|
|
30
|
+
xs: 12,
|
|
31
|
+
sm: 14,
|
|
32
|
+
md: 16,
|
|
33
|
+
lg: 18,
|
|
34
|
+
xl: 20
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
t as ICON_SIZE,
|
|
38
|
+
a as LINK_SIZE,
|
|
39
|
+
e as ROOT_CLASS,
|
|
40
|
+
r as SIZE_CLASSES,
|
|
41
|
+
b as VARIANT_CLASSES
|
|
42
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsxs as p, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cn as l } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Icon as f } from "../Icon/Icon.js";
|
|
5
|
+
import { ICON_SIZE as C, LINK_SIZE as d, VARIANT_CLASSES as u, SIZE_CLASSES as N, ROOT_CLASS as x } from "./PageNav.const.js";
|
|
6
|
+
const S = ({ size: e }) => /* @__PURE__ */ a(f, { size: e, children: /* @__PURE__ */ a("polyline", { points: "15 18 9 12 15 6" }) }), g = ({ size: e }) => /* @__PURE__ */ a(f, { size: e, children: /* @__PURE__ */ a("polyline", { points: "9 6 15 12 9 18" }) }), m = ({ item: e, direction: s, linkClass: n, labelClass: c, iconClass: i, sizeClass: b, iconSize: t }) => {
|
|
7
|
+
const r = s === "prev", o = e.href ? "a" : "button", h = e.href ? { href: e.href } : { type: "button", onClick: e.onClick };
|
|
8
|
+
return /* @__PURE__ */ p(
|
|
9
|
+
o,
|
|
10
|
+
{
|
|
11
|
+
...h,
|
|
12
|
+
className: l(
|
|
13
|
+
"bear-flex bear-flex-col bear-gap-1 bear-no-underline bear-min-w-0",
|
|
14
|
+
r ? "bear-items-start" : "bear-items-end bear-ml-auto",
|
|
15
|
+
n,
|
|
16
|
+
b
|
|
17
|
+
),
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ a("span", { className: l("bear-text-[10px] bear-font-semibold bear-uppercase bear-tracking-wider", c), children: r ? "Previous" : "Next" }),
|
|
20
|
+
/* @__PURE__ */ p("span", { className: "bear-flex bear-items-center bear-gap-1.5 bear-font-medium", children: [
|
|
21
|
+
r && /* @__PURE__ */ a("span", { className: l("bear-flex-shrink-0", i), children: e.icon ?? /* @__PURE__ */ a(S, { size: t }) }),
|
|
22
|
+
/* @__PURE__ */ a("span", { className: "bear-truncate", children: e.label }),
|
|
23
|
+
!r && /* @__PURE__ */ a("span", { className: l("bear-flex-shrink-0", i), children: e.icon ?? /* @__PURE__ */ a(g, { size: t }) })
|
|
24
|
+
] })
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}, E = ({
|
|
29
|
+
prev: e,
|
|
30
|
+
next: s,
|
|
31
|
+
size: n = "md",
|
|
32
|
+
variant: c = "default",
|
|
33
|
+
className: i,
|
|
34
|
+
testId: b,
|
|
35
|
+
"aria-label": t = "Page navigation"
|
|
36
|
+
}) => {
|
|
37
|
+
if (!e && !s) return null;
|
|
38
|
+
const r = u[c], o = C[n];
|
|
39
|
+
return /* @__PURE__ */ p(
|
|
40
|
+
"nav",
|
|
41
|
+
{
|
|
42
|
+
"data-testid": b,
|
|
43
|
+
className: l(
|
|
44
|
+
x,
|
|
45
|
+
"bear-flex bear-items-start bear-justify-between bear-gap-4 bear-border-t bear-border-zinc-700/50",
|
|
46
|
+
N[n],
|
|
47
|
+
i
|
|
48
|
+
),
|
|
49
|
+
"aria-label": t,
|
|
50
|
+
children: [
|
|
51
|
+
e ? /* @__PURE__ */ a(
|
|
52
|
+
m,
|
|
53
|
+
{
|
|
54
|
+
item: e,
|
|
55
|
+
direction: "prev",
|
|
56
|
+
linkClass: r.link,
|
|
57
|
+
labelClass: r.label,
|
|
58
|
+
iconClass: r.icon,
|
|
59
|
+
sizeClass: d[n],
|
|
60
|
+
iconSize: o
|
|
61
|
+
}
|
|
62
|
+
) : /* @__PURE__ */ a("span", {}),
|
|
63
|
+
s ? /* @__PURE__ */ a(
|
|
64
|
+
m,
|
|
65
|
+
{
|
|
66
|
+
item: s,
|
|
67
|
+
direction: "next",
|
|
68
|
+
linkClass: r.link,
|
|
69
|
+
labelClass: r.label,
|
|
70
|
+
iconClass: r.icon,
|
|
71
|
+
sizeClass: d[n],
|
|
72
|
+
iconSize: o
|
|
73
|
+
}
|
|
74
|
+
) : /* @__PURE__ */ a("span", {})
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
E as PageNav
|
|
81
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BearSize } from '../../types';
|
|
3
|
+
export interface PageNavItem {
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface PageNavProps {
|
|
10
|
+
prev?: PageNavItem | null;
|
|
11
|
+
next?: PageNavItem | null;
|
|
12
|
+
size?: BearSize;
|
|
13
|
+
variant?: 'default' | 'outlined' | 'filled';
|
|
14
|
+
className?: string;
|
|
15
|
+
testId?: string;
|
|
16
|
+
'aria-label'?: string;
|
|
17
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),l=require("react"),D=require("react-dom"),p=require("../../utils/cn.cjs"),H=1e4;function X(f,t,a){const e={position:"fixed",zIndex:H},s=f.split("-")[0],r=f.includes("start"),n=f.includes("end");return s==="bottom"?(e.top=t.bottom+a,r?e.left=t.left:n?e.left=t.right:e.left=t.left+t.width/2):s==="top"?(e.bottom=window.innerHeight-t.top+a,r?e.left=t.left:n?e.left=t.right:e.left=t.left+t.width/2):s==="left"?(e.right=window.innerWidth-t.left+a,r?e.top=t.top:n?e.bottom=window.innerHeight-t.bottom:e.top=t.top+t.height/2):(e.left=t.right+a,r?e.top=t.top:n?e.bottom=window.innerHeight-t.bottom:e.top=t.top+t.height/2),s==="bottom"||s==="top"?!r&&!n?e.transform="translateX(-50%)":n&&(e.transform="translateX(-100%)"):!r&&!n?e.transform="translateY(-50%)":n&&(e.transform="translateY(-100%)"),e}const T=({children:f,content:t,placement:a="bottom",trigger:e="click",open:s,onOpenChange:r,className:n,contentClassName:E,arrow:k=!0,closeOnClickOutside:m=!0,closeOnEscape:h=!0,offset:v=8})=>{const[z,R]=l.useState(!1),[S,j]=l.useState({}),d=l.useRef(null),w=l.useRef(null),i=s!==void 0?s:z,b=l.useCallback(o=>{R(o),r==null||r(o)},[r]);l.useEffect(()=>{if(i&&d.current){const o=d.current.getBoundingClientRect();j(X(a,o,v))}},[i,a,v]),l.useEffect(()=>{if(!m)return;const o=c=>{var g,x;const y=c.target;(g=d.current)!=null&&g.contains(y)||(x=w.current)!=null&&x.contains(y)||b(!1)};return i&&document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[i,m,b]),l.useEffect(()=>{if(!h)return;const o=c=>{c.key==="Escape"&&b(!1)};return i&&document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[i,h,b]);const L=()=>{e==="click"&&b(!i)},P=()=>{e==="hover"&&b(!0)},M=()=>{e==="hover"&&b(!1)},N={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"},q=a.split("-")[0],I=i&&typeof document<"u"&&D.createPortal(u.jsxs("div",{ref:w,"data-bear-popover":!0,className:p.cn("bear-bg-zinc-800 bear-border bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-3",E),style:S,children:[t,k&&u.jsx("div",{className:p.cn("bear-absolute bear-w-0 bear-h-0 bear-border-8",N[q])})]}),document.body);return u.jsxs("div",{ref:d,className:p.cn("bear-relative bear-inline-block",n),onMouseEnter:P,onMouseLeave:M,children:[u.jsx("div",{onClick:L,className:"bear-cursor-pointer",children:f}),I]})};exports.Popover=T;
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsxs as x, jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k, useRef as z, useCallback as B, useEffect as u } from "react";
|
|
3
|
+
import { createPortal as T } from "react-dom";
|
|
4
|
+
import { cn as c } from "../../utils/cn.js";
|
|
5
|
+
const W = 1e4;
|
|
6
|
+
function Z(b, t, a) {
|
|
7
|
+
const e = { position: "fixed", zIndex: W }, s = b.split("-")[0], r = b.includes("start"), o = b.includes("end");
|
|
8
|
+
return s === "bottom" ? (e.top = t.bottom + a, r ? e.left = t.left : o ? e.left = t.right : e.left = t.left + t.width / 2) : s === "top" ? (e.bottom = window.innerHeight - t.top + a, r ? e.left = t.left : o ? e.left = t.right : e.left = t.left + t.width / 2) : s === "left" ? (e.right = window.innerWidth - t.left + a, r ? e.top = t.top : o ? e.bottom = window.innerHeight - t.bottom : e.top = t.top + t.height / 2) : (e.left = t.right + a, r ? e.top = t.top : o ? e.bottom = window.innerHeight - t.bottom : e.top = t.top + t.height / 2), s === "bottom" || s === "top" ? !r && !o ? e.transform = "translateX(-50%)" : o && (e.transform = "translateX(-100%)") : !r && !o ? e.transform = "translateY(-50%)" : o && (e.transform = "translateY(-100%)"), e;
|
|
9
|
+
}
|
|
10
|
+
const F = ({
|
|
11
|
+
children: b,
|
|
12
|
+
content: t,
|
|
7
13
|
placement: a = "bottom",
|
|
8
|
-
trigger:
|
|
9
|
-
open:
|
|
10
|
-
onOpenChange:
|
|
11
|
-
className:
|
|
12
|
-
contentClassName:
|
|
13
|
-
arrow:
|
|
14
|
-
closeOnClickOutside:
|
|
15
|
-
closeOnEscape:
|
|
16
|
-
offset:
|
|
14
|
+
trigger: e = "click",
|
|
15
|
+
open: s,
|
|
16
|
+
onOpenChange: r,
|
|
17
|
+
className: o,
|
|
18
|
+
contentClassName: L,
|
|
19
|
+
arrow: N = !0,
|
|
20
|
+
closeOnClickOutside: p = !0,
|
|
21
|
+
closeOnEscape: m = !0,
|
|
22
|
+
offset: h = 8
|
|
17
23
|
}) => {
|
|
18
|
-
const [
|
|
19
|
-
|
|
20
|
-
}, [
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
const [I, M] = k(!1), [P, R] = k({}), f = z(null), v = z(null), i = s !== void 0 ? s : I, l = B((n) => {
|
|
25
|
+
M(n), r == null || r(n);
|
|
26
|
+
}, [r]);
|
|
27
|
+
u(() => {
|
|
28
|
+
if (i && f.current) {
|
|
29
|
+
const n = f.current.getBoundingClientRect();
|
|
30
|
+
R(Z(a, n, h));
|
|
31
|
+
}
|
|
32
|
+
}, [i, a, h]), u(() => {
|
|
33
|
+
if (!p) return;
|
|
34
|
+
const n = (d) => {
|
|
35
|
+
var y, g;
|
|
36
|
+
const w = d.target;
|
|
37
|
+
(y = f.current) != null && y.contains(w) || (g = v.current) != null && g.contains(w) || l(!1);
|
|
25
38
|
};
|
|
26
|
-
return
|
|
27
|
-
}, [
|
|
28
|
-
if (!
|
|
29
|
-
const
|
|
30
|
-
|
|
39
|
+
return i && document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
|
|
40
|
+
}, [i, p, l]), u(() => {
|
|
41
|
+
if (!m) return;
|
|
42
|
+
const n = (d) => {
|
|
43
|
+
d.key === "Escape" && l(!1);
|
|
31
44
|
};
|
|
32
|
-
return
|
|
33
|
-
}, [
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
top: "bear-bottom-full bear-left-1/2 -bear-translate-x-1/2 bear-mb-2",
|
|
42
|
-
"top-start": "bear-bottom-full bear-left-0 bear-mb-2",
|
|
43
|
-
"top-end": "bear-bottom-full bear-right-0 bear-mb-2",
|
|
44
|
-
bottom: "bear-top-full bear-left-1/2 -bear-translate-x-1/2 bear-mt-2",
|
|
45
|
-
"bottom-start": "bear-top-full bear-left-0 bear-mt-2",
|
|
46
|
-
"bottom-end": "bear-top-full bear-right-0 bear-mt-2",
|
|
47
|
-
left: "bear-right-full bear-top-1/2 -bear-translate-y-1/2 bear-mr-2",
|
|
48
|
-
"left-start": "bear-right-full bear-top-0 bear-mr-2",
|
|
49
|
-
"left-end": "bear-right-full bear-bottom-0 bear-mr-2",
|
|
50
|
-
right: "bear-left-full bear-top-1/2 -bear-translate-y-1/2 bear-ml-2",
|
|
51
|
-
"right-start": "bear-left-full bear-top-0 bear-ml-2",
|
|
52
|
-
"right-end": "bear-left-full bear-bottom-0 bear-ml-2"
|
|
53
|
-
}, S = {
|
|
45
|
+
return i && document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
46
|
+
}, [i, m, l]);
|
|
47
|
+
const S = () => {
|
|
48
|
+
e === "click" && l(!i);
|
|
49
|
+
}, H = () => {
|
|
50
|
+
e === "hover" && l(!0);
|
|
51
|
+
}, X = () => {
|
|
52
|
+
e === "hover" && l(!1);
|
|
53
|
+
}, j = {
|
|
54
54
|
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",
|
|
55
55
|
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",
|
|
56
56
|
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",
|
|
57
57
|
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"
|
|
58
|
-
},
|
|
59
|
-
|
|
58
|
+
}, D = a.split("-")[0], Y = i && typeof document < "u" && T(
|
|
59
|
+
/* @__PURE__ */ x(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
ref: v,
|
|
63
|
+
"data-bear-popover": !0,
|
|
64
|
+
className: c(
|
|
65
|
+
"bear-bg-zinc-800 bear-border bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-3",
|
|
66
|
+
L
|
|
67
|
+
),
|
|
68
|
+
style: P,
|
|
69
|
+
children: [
|
|
70
|
+
t,
|
|
71
|
+
N && /* @__PURE__ */ E("div", { className: c("bear-absolute bear-w-0 bear-h-0 bear-border-8", j[D]) })
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
document.body
|
|
76
|
+
);
|
|
77
|
+
return /* @__PURE__ */ x(
|
|
60
78
|
"div",
|
|
61
79
|
{
|
|
62
|
-
ref:
|
|
63
|
-
className:
|
|
64
|
-
onMouseEnter:
|
|
65
|
-
onMouseLeave:
|
|
80
|
+
ref: f,
|
|
81
|
+
className: c("bear-relative bear-inline-block", o),
|
|
82
|
+
onMouseEnter: H,
|
|
83
|
+
onMouseLeave: X,
|
|
66
84
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
69
|
-
"div",
|
|
70
|
-
{
|
|
71
|
-
ref: z,
|
|
72
|
-
className: s(
|
|
73
|
-
"bear-absolute bear-z-50 bear-bg-zinc-800 bear-border bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-3",
|
|
74
|
-
R[a],
|
|
75
|
-
k
|
|
76
|
-
),
|
|
77
|
-
style: { marginTop: a.startsWith("bottom") ? u : void 0, marginBottom: a.startsWith("top") ? u : void 0 },
|
|
78
|
-
children: [
|
|
79
|
-
y,
|
|
80
|
-
g && /* @__PURE__ */ m("div", { className: s(
|
|
81
|
-
"bear-absolute bear-w-0 bear-h-0 bear-border-8",
|
|
82
|
-
S[j]
|
|
83
|
-
) })
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
)
|
|
85
|
+
/* @__PURE__ */ E("div", { onClick: S, className: "bear-cursor-pointer", children: b }),
|
|
86
|
+
Y
|
|
87
87
|
]
|
|
88
88
|
}
|
|
89
89
|
);
|
|
90
90
|
};
|
|
91
91
|
export {
|
|
92
|
-
|
|
92
|
+
F as Popover
|
|
93
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../utils/cn.cjs");require("react");const m={sm:"bear-h-1.5",md:"bear-h-2.5",lg:"bear-h-4"},f={default:"bear-bg-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../utils/cn.cjs");require("react");const m={sm:"bear-h-1.5",md:"bear-h-2.5",lg:"bear-h-4"},f={default:"bear-bg-bear-500",success:"bear-bg-green-500",warning:"bear-bg-amber-500",danger:"bear-bg-red-500",info:"bear-bg-blue-500"},x=({value:b,max:n=100,size:l="md",color:o="default",showLabel:i=!1,labelPosition:d="outside",striped:r=!1,animated:c=!1,indeterminate:a=!1,className:g,testId:u})=>{const s=Math.min(100,Math.max(0,b/n*100));return e.jsxs("div",{className:t.cn("bear-w-full",g),"data-testid":u,children:[i&&d==="outside"&&e.jsxs("div",{className:"bear-flex bear-justify-between bear-mb-1",children:[e.jsx("span",{className:"bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200",children:"Progress"}),e.jsxs("span",{className:"bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200",children:[Math.round(s),"%"]})]}),e.jsx("div",{className:t.cn("bear-w-full bear-bg-gray-200 dark:bear-bg-gray-700 bear-rounded-full bear-overflow-hidden",m[l]),children:e.jsx("div",{className:t.cn("bear-h-full bear-rounded-full bear-transition-all bear-duration-300 bear-ease-out","bear-flex bear-items-center bear-justify-center",f[o],r&&"bear-bg-stripes",c&&"bear-animate-stripes",a&&"bear-animate-indeterminate"),style:{width:a?"50%":`${s}%`,backgroundSize:r?"1rem 1rem":void 0,backgroundImage:r?"linear-gradient(45deg, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent)":void 0},role:"progressbar","aria-valuenow":a?void 0:b,"aria-valuemin":0,"aria-valuemax":n,children:i&&d==="inside"&&l==="lg"&&!a&&e.jsxs("span",{className:"bear-text-xs bear-font-medium bear-text-white",children:[Math.round(s),"%"]})})})]})};exports.Progress=x;
|