@forgedevstack/bear 1.1.4 → 1.1.8
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 +19 -0
- 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/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/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 +59 -60
- 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/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/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 +28 -30
- 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/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.js +39 -38
- package/dist/components/Tabs/Tabs.types.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 +4 -0
- package/dist/components/index.js +66 -62
- 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 +175 -169
- package/dist/styles/_base.css +7 -3
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -1,145 +1,140 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as m, useEffect as _ } from "react";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { SKELETON_BG_CLASSES as v, SKELETON_ANIMATION_CLASSES as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (typeof document < "u" && !document.getElementById(e)) {
|
|
8
|
-
const t = document.createElement("style");
|
|
9
|
-
t.id = e, t.textContent = K, document.head.appendChild(t);
|
|
10
|
-
}
|
|
11
|
-
}, i = m(
|
|
3
|
+
import { cn as k } from "../../utils/cn.js";
|
|
4
|
+
import { SKELETON_BG_CLASSES as v, SKELETON_ANIMATION_CLASSES as b, SKELETON_VARIANT_CLASSES as L, SKELETON_BASE_CLASSES as w, SKELETON_TEXT_HEIGHT as C, SKELETON_AVATAR_SIZES as O } from "./Skeleton.const.js";
|
|
5
|
+
import { injectStyles as x } from "./Skeleton.utils.js";
|
|
6
|
+
const S = m(
|
|
12
7
|
({
|
|
13
8
|
variant: e = "text",
|
|
14
|
-
animation:
|
|
15
|
-
width:
|
|
16
|
-
height:
|
|
17
|
-
borderRadius:
|
|
18
|
-
count:
|
|
19
|
-
gap:
|
|
20
|
-
className:
|
|
21
|
-
style:
|
|
22
|
-
testId:
|
|
23
|
-
...
|
|
24
|
-
},
|
|
9
|
+
animation: r = "pulse",
|
|
10
|
+
width: s,
|
|
11
|
+
height: l,
|
|
12
|
+
borderRadius: o,
|
|
13
|
+
count: a = 1,
|
|
14
|
+
gap: p = 8,
|
|
15
|
+
className: d,
|
|
16
|
+
style: n,
|
|
17
|
+
testId: h,
|
|
18
|
+
...E
|
|
19
|
+
}, N) => {
|
|
25
20
|
_(() => {
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
const c = (
|
|
29
|
-
if (
|
|
30
|
-
return typeof
|
|
31
|
-
},
|
|
32
|
-
width: c(
|
|
33
|
-
height: c(
|
|
34
|
-
borderRadius:
|
|
35
|
-
...
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
r === "wave" && x();
|
|
22
|
+
}, [r]);
|
|
23
|
+
const c = (i) => {
|
|
24
|
+
if (i !== void 0)
|
|
25
|
+
return typeof i == "number" ? `${i}px` : i;
|
|
26
|
+
}, g = {
|
|
27
|
+
width: c(s),
|
|
28
|
+
height: c(l) || (e === "text" ? C : void 0),
|
|
29
|
+
borderRadius: o ? c(o) : void 0,
|
|
30
|
+
...n
|
|
31
|
+
}, y = k(
|
|
32
|
+
w,
|
|
33
|
+
L[e],
|
|
34
|
+
b[r],
|
|
40
35
|
v,
|
|
41
|
-
|
|
36
|
+
d
|
|
42
37
|
);
|
|
43
|
-
return
|
|
38
|
+
return a > 1 ? /* @__PURE__ */ t(
|
|
44
39
|
"div",
|
|
45
40
|
{
|
|
46
41
|
className: "Bear-Skeleton__group flex flex-col",
|
|
47
|
-
style: { gap: c(
|
|
48
|
-
"data-testid":
|
|
49
|
-
children: Array.from({ length:
|
|
42
|
+
style: { gap: c(p) },
|
|
43
|
+
"data-testid": h,
|
|
44
|
+
children: Array.from({ length: a }).map((i, A) => /* @__PURE__ */ t(
|
|
50
45
|
"div",
|
|
51
46
|
{
|
|
52
|
-
ref:
|
|
53
|
-
className:
|
|
54
|
-
style:
|
|
55
|
-
...
|
|
47
|
+
ref: A === 0 ? N : void 0,
|
|
48
|
+
className: y,
|
|
49
|
+
style: g,
|
|
50
|
+
...E
|
|
56
51
|
},
|
|
57
|
-
|
|
52
|
+
A
|
|
58
53
|
))
|
|
59
54
|
}
|
|
60
|
-
) : /* @__PURE__ */
|
|
55
|
+
) : /* @__PURE__ */ t(
|
|
61
56
|
"div",
|
|
62
57
|
{
|
|
63
|
-
ref:
|
|
64
|
-
className:
|
|
65
|
-
style:
|
|
66
|
-
"data-testid":
|
|
67
|
-
...
|
|
58
|
+
ref: N,
|
|
59
|
+
className: y,
|
|
60
|
+
style: g,
|
|
61
|
+
"data-testid": h,
|
|
62
|
+
...E
|
|
68
63
|
}
|
|
69
64
|
);
|
|
70
65
|
}
|
|
71
66
|
);
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
({ lines: e = 3, lastLineWidth:
|
|
75
|
-
|
|
76
|
-
}, [
|
|
67
|
+
S.displayName = "Skeleton";
|
|
68
|
+
const T = m(
|
|
69
|
+
({ lines: e = 3, lastLineWidth: r = "80%", gap: s = 8, animation: l = "pulse", ...o }, a) => (_(() => {
|
|
70
|
+
l === "wave" && x();
|
|
71
|
+
}, [l]), /* @__PURE__ */ t(
|
|
77
72
|
"div",
|
|
78
73
|
{
|
|
79
|
-
ref:
|
|
74
|
+
ref: a,
|
|
80
75
|
className: "Bear-SkeletonText flex flex-col",
|
|
81
|
-
style: { gap: ((
|
|
82
|
-
if (
|
|
83
|
-
return typeof
|
|
84
|
-
})(
|
|
85
|
-
children: Array.from({ length: e }).map((
|
|
86
|
-
|
|
76
|
+
style: { gap: ((d) => {
|
|
77
|
+
if (d !== void 0)
|
|
78
|
+
return typeof d == "number" ? `${d}px` : d;
|
|
79
|
+
})(s) },
|
|
80
|
+
children: Array.from({ length: e }).map((d, n) => /* @__PURE__ */ t(
|
|
81
|
+
S,
|
|
87
82
|
{
|
|
88
83
|
variant: "text",
|
|
89
|
-
animation:
|
|
90
|
-
width:
|
|
91
|
-
...
|
|
84
|
+
animation: l,
|
|
85
|
+
width: n === e - 1 ? r : "100%",
|
|
86
|
+
...o
|
|
92
87
|
},
|
|
93
|
-
|
|
88
|
+
n
|
|
94
89
|
))
|
|
95
90
|
}
|
|
96
91
|
))
|
|
97
92
|
);
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
({ size: e = "md", animation:
|
|
101
|
-
const
|
|
102
|
-
return /* @__PURE__ */
|
|
103
|
-
|
|
93
|
+
T.displayName = "SkeletonText";
|
|
94
|
+
const u = m(
|
|
95
|
+
({ size: e = "md", animation: r = "pulse", ...s }, l) => {
|
|
96
|
+
const o = typeof e == "number" ? e : O[e];
|
|
97
|
+
return /* @__PURE__ */ t(
|
|
98
|
+
S,
|
|
104
99
|
{
|
|
105
|
-
ref:
|
|
100
|
+
ref: l,
|
|
106
101
|
variant: "circular",
|
|
107
|
-
animation:
|
|
108
|
-
width:
|
|
109
|
-
height:
|
|
110
|
-
...
|
|
102
|
+
animation: r,
|
|
103
|
+
width: o,
|
|
104
|
+
height: o,
|
|
105
|
+
...s
|
|
111
106
|
}
|
|
112
107
|
);
|
|
113
108
|
}
|
|
114
109
|
);
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
({ animation: e = "pulse", className:
|
|
110
|
+
u.displayName = "SkeletonAvatar";
|
|
111
|
+
const K = m(
|
|
112
|
+
({ animation: e = "pulse", className: r, ...s }, l) => /* @__PURE__ */ f(
|
|
118
113
|
"div",
|
|
119
114
|
{
|
|
120
|
-
ref:
|
|
121
|
-
className:
|
|
115
|
+
ref: l,
|
|
116
|
+
className: k(
|
|
122
117
|
"Bear-SkeletonCard p-4 rounded-lg border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",
|
|
123
|
-
|
|
118
|
+
r
|
|
124
119
|
),
|
|
125
|
-
...
|
|
120
|
+
...s,
|
|
126
121
|
children: [
|
|
127
122
|
/* @__PURE__ */ f("div", { className: "flex items-center gap-3 mb-4", children: [
|
|
128
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ t(u, { animation: e }),
|
|
129
124
|
/* @__PURE__ */ f("div", { className: "flex-1", children: [
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ t(S, { animation: e, width: "60%", height: 16, className: "mb-2" }),
|
|
126
|
+
/* @__PURE__ */ t(S, { animation: e, width: "40%", height: 12 })
|
|
132
127
|
] })
|
|
133
128
|
] }),
|
|
134
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ t(T, { animation: e, lines: 3 })
|
|
135
130
|
]
|
|
136
131
|
}
|
|
137
132
|
)
|
|
138
133
|
);
|
|
139
|
-
|
|
134
|
+
K.displayName = "SkeletonCard";
|
|
140
135
|
export {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
136
|
+
S as Skeleton,
|
|
137
|
+
u as SkeletonAvatar,
|
|
138
|
+
K as SkeletonCard,
|
|
139
|
+
T as SkeletonText
|
|
145
140
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./Skeleton.const.cjs"),t="bear-skeleton-styles",o=()=>{if(typeof document<"u"&&!document.getElementById(t)){const e=document.createElement("style");e.id=t,e.textContent=n.SKELETON_WAVE_STYLES,document.head.appendChild(e)}};exports.injectStyles=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const injectStyles: () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SKELETON_WAVE_STYLES as n } from "./Skeleton.const.js";
|
|
2
|
+
const t = "bear-skeleton-styles", d = () => {
|
|
3
|
+
if (typeof document < "u" && !document.getElementById(t)) {
|
|
4
|
+
const e = document.createElement("style");
|
|
5
|
+
e.id = t, e.textContent = n, document.head.appendChild(e);
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
d as injectStyles
|
|
10
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),u=require("react"),i=require("../../utils/cn.cjs"),V=require("./SliderRange.utils.cjs"),X={xs:{track:"bear-h-1",thumb:"bear-w-3 bear-h-3",height:"bear-h-6"},sm:{track:"bear-h-1.5",thumb:"bear-w-4 bear-h-4",height:"bear-h-8"},md:{track:"bear-h-2",thumb:"bear-w-5 bear-h-5",height:"bear-h-10"},lg:{track:"bear-h-2.5",thumb:"bear-w-6 bear-h-6",height:"bear-h-12"},xl:{track:"bear-h-3",thumb:"bear-w-7 bear-h-7",height:"bear-h-14"}},Y={primary:{track:"bear-bg-bear-500",thumb:"bear-bg-bear-500 bear-border-bear-600"},secondary:{track:"bear-bg-gray-500",thumb:"bear-bg-gray-500 bear-border-gray-600"},success:{track:"bear-bg-green-500",thumb:"bear-bg-green-500 bear-border-green-600"},warning:{track:"bear-bg-amber-500",thumb:"bear-bg-amber-500 bear-border-amber-600"},error:{track:"bear-bg-red-500",thumb:"bear-bg-red-500 bear-border-red-600"},danger:{track:"bear-bg-red-500",thumb:"bear-bg-red-500 bear-border-red-600"},info:{track:"bear-bg-blue-500",thumb:"bear-bg-blue-500 bear-border-blue-600"},ghost:{track:"bear-bg-gray-400",thumb:"bear-bg-gray-400 bear-border-gray-500"},outline:{track:"bear-bg-gray-600",thumb:"bear-bg-white dark:bear-bg-gray-200 bear-border-gray-600 dark:bear-border-gray-400"}},A=({value:h,defaultValue:D=[20,80],min:e=0,max:t=100,step:d=1,size:I="md",color:$="primary",disabled:a=!1,onChange:s,onChangeCommitted:g,valueFormatter:B=f=>String(f),className:z,...O})=>{const[f,R]=u.useState(D),[b,L]=u.useState(null),w=u.useRef(null),y=h??f,[c,l]=y,k=(c-e)/(t-e)*100,E=(l-e)/(t-e)*100,m=X[I],x=Y[$],S=u.useCallback((r,v)=>{if(!w.current||a)return;const N=w.current.getBoundingClientRect(),P=Math.max(0,Math.min(1,(r-N.left)/N.width)),_=e+P*(t-e),T=V.stepValue(_,e,t,d);if(v==="min"){const n=[Math.min(T,l-d),l];h===void 0&&R(n),s==null||s(n)}else{const q=Math.max(T,c+d),n=[c,q];h===void 0&&R(n),s==null||s(n)}},[e,t,d,c,l,a,h,s]),j=(r,v)=>{a||(r.preventDefault(),L(v),S(r.clientX,v))},p=u.useCallback(r=>{b&&S(r.clientX,b)},[b,S]),M=u.useCallback(()=>{b&&(L(null),g==null||g(y))},[b,y,g]);return u.useEffect(()=>{if(b)return document.addEventListener("mousemove",p),document.addEventListener("mouseup",M),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",M)}},[b,p,M]),o.jsx("div",{className:i.cn("bear-relative bear-w-full bear-flex bear-items-center",m.height,a&&"bear-opacity-50 bear-cursor-not-allowed",z),"data-testid":"slider-range",...O,children:o.jsxs("div",{ref:w,className:i.cn("bear-relative bear-w-full bear-rounded-full bear-bg-gray-200 dark:bear-bg-gray-700",m.track,!a&&"bear-cursor-pointer"),children:[o.jsx("div",{className:i.cn("bear-absolute bear-inset-y-0 bear-left-0 bear-rounded-full",x.track),style:{left:`${k}%`,width:`${E-k}%`}}),o.jsx("div",{role:"slider",tabIndex:a?-1:0,"aria-valuemin":e,"aria-valuemax":t,"aria-valuenow":c,"aria-label":"Range minimum",className:i.cn("bear-absolute bear-top-1/2 bear--translate-y-1/2 bear--translate-x-1/2 bear-rounded-full bear-border-2 bear-shadow-md",m.thumb,x.thumb,!a&&"bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",b==="min"&&"bear-scale-125 bear-z-10"),style:{left:`${k}%`},onMouseDown:r=>j(r,"min")}),o.jsx("div",{role:"slider",tabIndex:a?-1:0,"aria-valuemin":e,"aria-valuemax":t,"aria-valuenow":l,"aria-label":"Range maximum",className:i.cn("bear-absolute bear-top-1/2 bear--translate-y-1/2 bear--translate-x-1/2 bear-rounded-full bear-border-2 bear-shadow-md",m.thumb,x.thumb,!a&&"bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",b==="max"&&"bear-scale-125 bear-z-10"),style:{left:`${E}%`},onMouseDown:r=>j(r,"max")})]})})};exports.SliderRange=A;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
|
|
2
|
+
import { useState as $, useRef as A, useCallback as S, useEffect as B } from "react";
|
|
3
|
+
import { cn as l } from "../../utils/cn.js";
|
|
4
|
+
import { stepValue as F } from "./SliderRange.utils.js";
|
|
5
|
+
const H = {
|
|
5
6
|
xs: { track: "bear-h-1", thumb: "bear-w-3 bear-h-3", height: "bear-h-6" },
|
|
6
7
|
sm: { track: "bear-h-1.5", thumb: "bear-w-4 bear-h-4", height: "bear-h-8" },
|
|
7
8
|
md: { track: "bear-h-2", thumb: "bear-w-5 bear-h-5", height: "bear-h-10" },
|
|
8
9
|
lg: { track: "bear-h-2.5", thumb: "bear-w-6 bear-h-6", height: "bear-h-12" },
|
|
9
10
|
xl: { track: "bear-h-3", thumb: "bear-w-7 bear-h-7", height: "bear-h-14" }
|
|
10
|
-
},
|
|
11
|
+
}, U = {
|
|
11
12
|
primary: { track: "bear-bg-bear-500", thumb: "bear-bg-bear-500 bear-border-bear-600" },
|
|
12
13
|
secondary: { track: "bear-bg-gray-500", thumb: "bear-bg-gray-500 bear-border-gray-600" },
|
|
13
14
|
success: { track: "bear-bg-green-500", thumb: "bear-bg-green-500 bear-border-green-600" },
|
|
@@ -17,59 +18,56 @@ const F = {
|
|
|
17
18
|
info: { track: "bear-bg-blue-500", thumb: "bear-bg-blue-500 bear-border-blue-600" },
|
|
18
19
|
ghost: { track: "bear-bg-gray-400", thumb: "bear-bg-gray-400 bear-border-gray-500" },
|
|
19
20
|
outline: { track: "bear-bg-gray-600", thumb: "bear-bg-white dark:bear-bg-gray-200 bear-border-gray-600 dark:bear-border-gray-400" }
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, K = ({
|
|
24
|
-
value: s,
|
|
25
|
-
defaultValue: v = [20, 80],
|
|
21
|
+
}, Q = ({
|
|
22
|
+
value: n,
|
|
23
|
+
defaultValue: z = [20, 80],
|
|
26
24
|
min: e = 0,
|
|
27
|
-
max:
|
|
28
|
-
step:
|
|
25
|
+
max: t = 100,
|
|
26
|
+
step: i = 1,
|
|
29
27
|
size: j = "md",
|
|
30
28
|
color: O = "primary",
|
|
31
|
-
disabled:
|
|
32
|
-
onChange:
|
|
29
|
+
disabled: a = !1,
|
|
30
|
+
onChange: s,
|
|
33
31
|
onChangeCommitted: h,
|
|
34
|
-
valueFormatter: Z = (
|
|
32
|
+
valueFormatter: Z = (v) => String(v),
|
|
35
33
|
className: P,
|
|
36
34
|
...V
|
|
37
35
|
}) => {
|
|
38
|
-
const [
|
|
39
|
-
(
|
|
40
|
-
if (!
|
|
41
|
-
const
|
|
36
|
+
const [v, L] = $(z), [b, E] = $(null), f = A(null), w = n ?? v, [u, o] = w, y = (u - e) / (t - e) * 100, R = (o - e) / (t - e) * 100, m = H[j], k = U[O], p = S(
|
|
37
|
+
(r, d) => {
|
|
38
|
+
if (!f.current || a) return;
|
|
39
|
+
const D = f.current.getBoundingClientRect(), X = Math.max(0, Math.min(1, (r - D.left) / D.width)), Y = e + X * (t - e), I = F(Y, e, t, i);
|
|
42
40
|
if (d === "min") {
|
|
43
|
-
const
|
|
44
|
-
|
|
41
|
+
const c = [Math.min(I, o - i), o];
|
|
42
|
+
n === void 0 && L(c), s == null || s(c);
|
|
45
43
|
} else {
|
|
46
|
-
const
|
|
47
|
-
|
|
44
|
+
const T = Math.max(I, u + i), c = [u, T];
|
|
45
|
+
n === void 0 && L(c), s == null || s(c);
|
|
48
46
|
}
|
|
49
47
|
},
|
|
50
|
-
[e,
|
|
51
|
-
),
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
(
|
|
55
|
-
|
|
48
|
+
[e, t, i, u, o, a, n, s]
|
|
49
|
+
), N = (r, d) => {
|
|
50
|
+
a || (r.preventDefault(), E(d), p(r.clientX, d));
|
|
51
|
+
}, x = S(
|
|
52
|
+
(r) => {
|
|
53
|
+
b && p(r.clientX, b);
|
|
56
54
|
},
|
|
57
|
-
[
|
|
58
|
-
),
|
|
59
|
-
|
|
60
|
-
}, [
|
|
55
|
+
[b, p]
|
|
56
|
+
), M = S(() => {
|
|
57
|
+
b && (E(null), h == null || h(w));
|
|
58
|
+
}, [b, w, h]);
|
|
61
59
|
return B(() => {
|
|
62
|
-
if (
|
|
63
|
-
return document.addEventListener("mousemove",
|
|
64
|
-
document.removeEventListener("mousemove",
|
|
60
|
+
if (b)
|
|
61
|
+
return document.addEventListener("mousemove", x), document.addEventListener("mouseup", M), () => {
|
|
62
|
+
document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", M);
|
|
65
63
|
};
|
|
66
|
-
}, [
|
|
64
|
+
}, [b, x, M]), /* @__PURE__ */ g(
|
|
67
65
|
"div",
|
|
68
66
|
{
|
|
69
|
-
className:
|
|
67
|
+
className: l(
|
|
70
68
|
"bear-relative bear-w-full bear-flex bear-items-center",
|
|
71
69
|
m.height,
|
|
72
|
-
|
|
70
|
+
a && "bear-opacity-50 bear-cursor-not-allowed",
|
|
73
71
|
P
|
|
74
72
|
),
|
|
75
73
|
"data-testid": "slider-range",
|
|
@@ -77,58 +75,58 @@ const F = {
|
|
|
77
75
|
children: /* @__PURE__ */ _(
|
|
78
76
|
"div",
|
|
79
77
|
{
|
|
80
|
-
ref:
|
|
81
|
-
className:
|
|
78
|
+
ref: f,
|
|
79
|
+
className: l(
|
|
82
80
|
"bear-relative bear-w-full bear-rounded-full bear-bg-gray-200 dark:bear-bg-gray-700",
|
|
83
81
|
m.track,
|
|
84
|
-
!
|
|
82
|
+
!a && "bear-cursor-pointer"
|
|
85
83
|
),
|
|
86
84
|
children: [
|
|
87
85
|
/* @__PURE__ */ g(
|
|
88
86
|
"div",
|
|
89
87
|
{
|
|
90
|
-
className:
|
|
91
|
-
style: { left: `${
|
|
88
|
+
className: l("bear-absolute bear-inset-y-0 bear-left-0 bear-rounded-full", k.track),
|
|
89
|
+
style: { left: `${y}%`, width: `${R - y}%` }
|
|
92
90
|
}
|
|
93
91
|
),
|
|
94
92
|
/* @__PURE__ */ g(
|
|
95
93
|
"div",
|
|
96
94
|
{
|
|
97
95
|
role: "slider",
|
|
98
|
-
tabIndex:
|
|
96
|
+
tabIndex: a ? -1 : 0,
|
|
99
97
|
"aria-valuemin": e,
|
|
100
|
-
"aria-valuemax":
|
|
101
|
-
"aria-valuenow":
|
|
98
|
+
"aria-valuemax": t,
|
|
99
|
+
"aria-valuenow": u,
|
|
102
100
|
"aria-label": "Range minimum",
|
|
103
|
-
className:
|
|
101
|
+
className: l(
|
|
104
102
|
"bear-absolute bear-top-1/2 bear--translate-y-1/2 bear--translate-x-1/2 bear-rounded-full bear-border-2 bear-shadow-md",
|
|
105
103
|
m.thumb,
|
|
106
|
-
|
|
107
|
-
!
|
|
108
|
-
|
|
104
|
+
k.thumb,
|
|
105
|
+
!a && "bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",
|
|
106
|
+
b === "min" && "bear-scale-125 bear-z-10"
|
|
109
107
|
),
|
|
110
|
-
style: { left: `${
|
|
111
|
-
onMouseDown: (
|
|
108
|
+
style: { left: `${y}%` },
|
|
109
|
+
onMouseDown: (r) => N(r, "min")
|
|
112
110
|
}
|
|
113
111
|
),
|
|
114
112
|
/* @__PURE__ */ g(
|
|
115
113
|
"div",
|
|
116
114
|
{
|
|
117
115
|
role: "slider",
|
|
118
|
-
tabIndex:
|
|
116
|
+
tabIndex: a ? -1 : 0,
|
|
119
117
|
"aria-valuemin": e,
|
|
120
|
-
"aria-valuemax":
|
|
121
|
-
"aria-valuenow":
|
|
118
|
+
"aria-valuemax": t,
|
|
119
|
+
"aria-valuenow": o,
|
|
122
120
|
"aria-label": "Range maximum",
|
|
123
|
-
className:
|
|
121
|
+
className: l(
|
|
124
122
|
"bear-absolute bear-top-1/2 bear--translate-y-1/2 bear--translate-x-1/2 bear-rounded-full bear-border-2 bear-shadow-md",
|
|
125
123
|
m.thumb,
|
|
126
|
-
|
|
127
|
-
!
|
|
128
|
-
|
|
124
|
+
k.thumb,
|
|
125
|
+
!a && "bear-cursor-grab active:bear-cursor-grabbing hover:bear-scale-110",
|
|
126
|
+
b === "max" && "bear-scale-125 bear-z-10"
|
|
129
127
|
),
|
|
130
|
-
style: { left: `${
|
|
131
|
-
onMouseDown: (
|
|
128
|
+
style: { left: `${R}%` },
|
|
129
|
+
onMouseDown: (r) => N(r, "max")
|
|
132
130
|
}
|
|
133
131
|
)
|
|
134
132
|
]
|
|
@@ -138,5 +136,5 @@ const F = {
|
|
|
138
136
|
);
|
|
139
137
|
};
|
|
140
138
|
export {
|
|
141
|
-
|
|
139
|
+
Q as SliderRange
|
|
142
140
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=(e,a,n,t)=>{const o=Math.round(e/t)*t;return Math.max(a,Math.min(n,o))};exports.stepValue=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const stepValue: (raw: number, min: number, max: number, step: number) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),h=require("../../utils/cn.cjs"),o=require("./Spotlight.const.cjs"),m=require("./Spotlight.utils.cjs"),U=N=>{const{actions:g,open:E,onOpenChange:x,placeholder:B=o.DEFAULT_PLACEHOLDER,shortcutKey:k=o.DEFAULT_SHORTCUT_KEY,shortcutMod:_=!0,nothingFoundMessage:T=o.DEFAULT_NOTHING_FOUND,highlightMatches:v=!0,limit:p=o.DEFAULT_LIMIT,filter:u,className:D,style:C,testId:I}=N,[L,A]=s.useState(!1),[b,S]=s.useState(""),[d,c]=s.useState(0),j=s.useRef(null),w=s.useRef(null),n=E??L,l=s.useCallback(e=>{A(e),x==null||x(e),e||(S(""),c(0))},[x]);s.useEffect(()=>{const e=a=>{(_?a.metaKey||a.ctrlKey:!0)&&a.key.toLowerCase()===k.toLowerCase()&&(a.preventDefault(),l(!n)),a.key==="Escape"&&n&&l(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[k,_,n,l]),s.useEffect(()=>{n&&setTimeout(()=>{var e;return(e=j.current)==null?void 0:e.focus()},o.FOCUS_DELAY)},[n]);const i=s.useMemo(()=>u?u(b,g).slice(0,p):b?g.filter(e=>m.matchAction(e,b)).slice(0,p):g.slice(0,p),[g,b,u,p]),M=s.useMemo(()=>{const e=new Map;return i.forEach(a=>{const t=a.group||"";e.has(t)||e.set(t,[]),e.get(t).push(a)}),e},[i]),O=s.useCallback(e=>{if(e.key==="ArrowDown")e.preventDefault(),c(a=>Math.min(a+1,i.length-1));else if(e.key==="ArrowUp")e.preventDefault(),c(a=>Math.max(a-1,0));else if(e.key==="Enter"&&i[d]){e.preventDefault();const a=i[d];a.disabled||(a.onTrigger(),l(!1))}},[i,d,l]);if(s.useEffect(()=>{const e=w.current;if(!e)return;const a=e.querySelector('[data-active="true"]');a==null||a.scrollIntoView({block:"nearest"})},[d]),!n)return null;let y=-1;return r.jsxs("div",{className:h.cn("Bear-Spotlight","bear-fixed bear-inset-0 bear-flex bear-items-start bear-justify-center bear-pt-[15vh]"),style:{zIndex:o.SPOTLIGHT_Z_INDEX},"data-testid":I,children:[r.jsx("div",{className:"Bear-Spotlight__backdrop bear-absolute bear-inset-0 bear-bg-black/50 dark:bear-bg-black/70 bear-backdrop-blur-sm",onClick:()=>l(!1),"aria-hidden":"true"}),r.jsxs("div",{className:h.cn("Bear-Spotlight__dialog","bear-relative bear-w-full bear-max-w-[560px] bear-mx-4","bear-bg-white dark:bear-bg-gray-900","bear-rounded-xl bear-shadow-2xl","bear-border bear-border-gray-200 dark:bear-border-gray-700","bear-overflow-hidden",D),style:C,role:"dialog","aria-label":"Search",children:[r.jsxs("div",{className:"Bear-Spotlight__search bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-gray-700",children:[r.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"bear-text-gray-400 dark:bear-text-gray-500 bear-shrink-0",children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),r.jsx("input",{ref:j,type:"text",value:b,onChange:e=>{S(e.target.value),c(0)},onKeyDown:O,placeholder:B,className:h.cn("Bear-Spotlight__input","bear-flex-1 bear-bg-transparent bear-outline-none bear-text-base","bear-text-gray-900 dark:bear-text-white","placeholder:bear-text-gray-400 dark:placeholder:bear-text-gray-500"),autoComplete:"off",spellCheck:!1}),r.jsx("kbd",{className:"bear-hidden sm:bear-inline-flex bear-items-center bear-px-1.5 bear-py-0.5 bear-rounded bear-text-[10px] bear-font-mono bear-text-gray-400 dark:bear-text-gray-500 bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"ESC"})]}),r.jsxs("div",{ref:w,className:"Bear-Spotlight__results bear-max-h-[400px] bear-overflow-y-auto bear-py-2",role:"listbox",children:[i.length===0&&r.jsx("div",{className:"Bear-Spotlight__empty bear-px-4 bear-py-8 bear-text-center bear-text-gray-500 dark:bear-text-gray-400 bear-text-sm",children:T}),Array.from(M.entries()).map(([e,a])=>r.jsxs("div",{className:"Bear-Spotlight__group",children:[e&&r.jsx("div",{className:"Bear-Spotlight__group-title bear-px-4 bear-py-1.5 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-400 dark:bear-text-gray-500",children:e}),a.map(t=>{y++;const f=y===d,R=y;return r.jsxs("button",{className:h.cn("Bear-Spotlight__action","bear-w-full bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2.5 bear-text-left bear-cursor-pointer","bear-transition-colors bear-duration-100",f?"bear-bg-gray-100 dark:bear-bg-gray-800":"hover:bear-bg-gray-50 dark:hover:bear-bg-gray-800/50",t.disabled&&"bear-opacity-50 bear-cursor-not-allowed"),"data-active":f,onMouseEnter:()=>c(R),onClick:()=>{t.disabled||(t.onTrigger(),l(!1))},role:"option","aria-selected":f,"aria-disabled":t.disabled,children:[t.icon&&r.jsx("span",{className:"Bear-Spotlight__action-icon bear-text-gray-500 dark:bear-text-gray-400 bear-shrink-0",children:t.icon}),r.jsxs("div",{className:"Bear-Spotlight__action-body bear-flex-1 bear-min-w-0",children:[r.jsx("div",{className:"Bear-Spotlight__action-label bear-text-sm bear-font-medium bear-text-gray-900 dark:bear-text-white bear-truncate",children:v?m.highlightText(t.label,b):t.label}),t.description&&r.jsx("div",{className:"Bear-Spotlight__action-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate",children:v?m.highlightText(t.description,b):t.description})]}),t.rightSection&&r.jsx("span",{className:"Bear-Spotlight__action-right bear-shrink-0",children:t.rightSection})]},t.id)})]},e))]}),r.jsxs("div",{className:"Bear-Spotlight__footer bear-border-t bear-border-gray-200 dark:bear-border-gray-700 bear-px-4 bear-py-2 bear-flex bear-items-center bear-gap-4 bear-text-[11px] bear-text-gray-400 dark:bear-text-gray-500",children:[r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"↑↓"}),"navigate"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"↵"}),"select"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"esc"}),"close"]})]})]})]})};exports.Spotlight=U;
|