@forgedevstack/bear 1.2.0 → 1.2.2
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/dist/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
- package/dist/components/AnimatedCounter/index.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
- package/dist/components/Autocomplete/Autocomplete.js +110 -72
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +74 -53
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.d.ts +1 -1
- package/dist/components/Cascader/Cascader.const.js +1 -1
- package/dist/components/Cascader/Cascader.js +109 -146
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
- package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
- package/dist/components/Chart/BarChart.cjs +1 -0
- package/dist/components/Chart/BarChart.d.ts +3 -0
- package/dist/components/Chart/BarChart.js +65 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -1
- package/dist/components/Chart/Chart.const.d.ts +7 -0
- package/dist/components/Chart/Chart.const.js +12 -2
- package/dist/components/Chart/Chart.d.ts +1 -13
- package/dist/components/Chart/Chart.js +18 -204
- package/dist/components/Chart/Chart.types.d.ts +7 -1
- package/dist/components/Chart/LineChart.cjs +1 -0
- package/dist/components/Chart/LineChart.d.ts +3 -0
- package/dist/components/Chart/LineChart.js +73 -0
- package/dist/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.d.ts +3 -0
- package/dist/components/Chart/PieChart.js +110 -0
- package/dist/components/Chart/index.d.ts +4 -1
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
- package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
- package/dist/components/ColorPicker/ColorPicker.js +135 -73
- package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
- package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
- package/dist/components/CreditInput/CreditInput.cjs +1 -1
- package/dist/components/CreditInput/CreditInput.js +80 -78
- package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
- package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
- package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
- package/dist/components/CurrencyInput/index.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
- package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.js +70 -0
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
- package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
- package/dist/components/DiffSquares/index.d.ts +2 -0
- package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
- package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
- package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
- package/dist/components/DiffViewer/DiffViewer.js +97 -105
- package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
- package/dist/components/DiffViewer/index.d.ts +1 -1
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +41 -41
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
- package/dist/components/Dropdown/Dropdown.const.js +10 -0
- package/dist/components/Dropdown/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.js +102 -92
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.js +61 -50
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/GlowCard/GlowCard.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
- package/dist/components/GlowCard/GlowCard.const.js +13 -0
- package/dist/components/GlowCard/GlowCard.d.ts +3 -0
- package/dist/components/GlowCard/GlowCard.js +185 -0
- package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
- package/dist/components/GlowCard/index.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
- package/dist/components/Heatmap/Heatmap.const.js +11 -0
- package/dist/components/Heatmap/Heatmap.d.ts +3 -0
- package/dist/components/Heatmap/Heatmap.js +103 -0
- package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
- package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.utils.js +18 -0
- package/dist/components/Heatmap/index.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -6
- package/dist/components/HoverCard/HoverCard.js +72 -54
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
- package/dist/components/ImageAnnotation/index.d.ts +2 -0
- package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
- package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
- package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
- package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
- package/dist/components/MediaPlayer/index.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +106 -83
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +91 -80
- 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 -1
- package/dist/components/Modal/Modal.const.js +1 -1
- package/dist/components/Modal/Modal.js +50 -44
- package/dist/components/Modal/Modal.types.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +123 -78
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
- package/dist/components/OTPInput/OTPInput.cjs +1 -1
- package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
- package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
- package/dist/components/OTPInput/OTPInput.const.js +14 -0
- package/dist/components/OTPInput/OTPInput.js +99 -65
- package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +88 -83
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
- package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
- package/dist/components/Popconfirm/Popconfirm.js +71 -51
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +36 -31
- package/dist/components/Portal/Portal.cjs +1 -1
- package/dist/components/Portal/Portal.d.ts +0 -3
- package/dist/components/Portal/Portal.js +4 -10
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +71 -51
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +26 -4
- package/dist/components/Stepper/Stepper.const.js +39 -20
- package/dist/components/Stepper/Stepper.d.ts +3 -10
- package/dist/components/Stepper/Stepper.js +189 -130
- package/dist/components/Stepper/Stepper.types.d.ts +14 -0
- package/dist/components/Stepper/Stepper.utils.cjs +1 -0
- package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
- package/dist/components/Stepper/Stepper.utils.js +19 -0
- package/dist/components/Stepper/components/StepperControls.cjs +1 -0
- package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
- package/dist/components/Stepper/components/StepperControls.js +32 -0
- package/dist/components/Stepper/index.d.ts +2 -1
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +72 -57
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/TagCloud/TagCloud.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
- package/dist/components/TagCloud/TagCloud.const.js +8 -0
- package/dist/components/TagCloud/TagCloud.d.ts +3 -0
- package/dist/components/TagCloud/TagCloud.js +76 -0
- package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
- package/dist/components/TagCloud/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
- package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
- package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
- package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
- package/dist/components/TimelineChart/TimelineChart.js +65 -0
- package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
- package/dist/components/TimelineChart/index.d.ts +2 -0
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +86 -82
- package/dist/components/Toast/Toast.types.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +52 -44
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
- package/dist/components/TreeSelect/TreeSelect.js +120 -88
- package/dist/components/Watermark/Watermark.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.d.ts +6 -3
- package/dist/components/Watermark/Watermark.const.js +13 -11
- package/dist/components/Watermark/Watermark.js +87 -61
- package/dist/components/Watermark/Watermark.types.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +22 -4
- package/dist/components/index.js +319 -296
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +55 -54
- package/dist/hooks/useClickOutside.cjs +1 -1
- package/dist/hooks/useClickOutside.d.ts +4 -11
- package/dist/hooks/useClickOutside.js +26 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +412 -388
- package/dist/styles/_effects.css +32 -0
- package/dist/styles.css +1 -1
- package/dist/utils/maxVisible.utils.cjs +1 -0
- package/dist/utils/maxVisible.utils.d.ts +12 -0
- package/dist/utils/maxVisible.utils.js +15 -0
- package/package.json +1 -1
- package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
- package/dist/components/HoverCard/HoverCard.utils.js +0 -23
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as A, useState as m, useCallback as C } from "react";
|
|
3
|
+
import { cn as D } from "../../utils/cn.js";
|
|
4
|
+
import { CENTER_POSITION as h, DEFAULT_BORDER_RADIUS as R, DEFAULT_GLOW_COLOR as S, DEFAULT_GLOW_INTENSITY as L, DEFAULT_EFFECT as F, DEFAULT_BORDER_WIDTH as H, HEX_OPACITY_AMBIENT as c, HEX_OPACITY_BORDER_SHADOW as M, HEX_OPACITY_SHADOW as $, HEX_OPACITY_BORDER as p } from "./GlowCard.const.js";
|
|
5
|
+
const X = ({
|
|
6
|
+
children: x,
|
|
7
|
+
glowColor: n = S,
|
|
8
|
+
glowIntensity: a = L,
|
|
9
|
+
followMouse: v = !0,
|
|
10
|
+
borderRadius: u = R,
|
|
11
|
+
disabled: l = !1,
|
|
12
|
+
effect: f = F,
|
|
13
|
+
borderWidth: s = H,
|
|
14
|
+
testId: w,
|
|
15
|
+
className: E,
|
|
16
|
+
style: B,
|
|
17
|
+
...N
|
|
18
|
+
}) => {
|
|
19
|
+
const _ = A(null), [i, g] = m({ x: h, y: h }), [G, y] = m(!1), O = C(
|
|
20
|
+
(b) => {
|
|
21
|
+
if (!v || l || !_.current) return;
|
|
22
|
+
const o = _.current.getBoundingClientRect();
|
|
23
|
+
g({
|
|
24
|
+
x: (b.clientX - o.left) / o.width * 100,
|
|
25
|
+
y: (b.clientY - o.top) / o.height * 100
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
[v, l]
|
|
29
|
+
), e = G && !l, T = typeof u == "number" ? `${u}px` : u, k = () => {
|
|
30
|
+
switch (f) {
|
|
31
|
+
case "border":
|
|
32
|
+
return /* @__PURE__ */ t(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: "Bear-GlowCard__border absolute inset-0 pointer-events-none rounded-[inherit] transition-opacity duration-300",
|
|
36
|
+
style: {
|
|
37
|
+
opacity: e ? 1 : 0,
|
|
38
|
+
background: `radial-gradient(circle at ${i.x}% ${i.y}%, ${n}${p}, transparent ${a}%)`,
|
|
39
|
+
mask: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
|
|
40
|
+
maskComposite: "exclude",
|
|
41
|
+
WebkitMaskComposite: "xor",
|
|
42
|
+
padding: s
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
case "spotlight":
|
|
47
|
+
return /* @__PURE__ */ r(d, { children: [
|
|
48
|
+
/* @__PURE__ */ t(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: "Bear-GlowCard__spot absolute inset-0 pointer-events-none transition-opacity duration-300",
|
|
52
|
+
style: {
|
|
53
|
+
opacity: e ? 0.8 : 0,
|
|
54
|
+
background: `radial-gradient(300px circle at ${i.x}% ${i.y}%, ${n}${c}, transparent 60%)`
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ t(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: "Bear-GlowCard__spot-border absolute inset-0 pointer-events-none rounded-[inherit] transition-opacity duration-300",
|
|
62
|
+
style: {
|
|
63
|
+
opacity: e ? 1 : 0,
|
|
64
|
+
boxShadow: `inset 0 0 0 ${s}px ${n}${p}`
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] });
|
|
69
|
+
case "pulse":
|
|
70
|
+
return /* @__PURE__ */ r(d, { children: [
|
|
71
|
+
/* @__PURE__ */ t(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
className: "Bear-GlowCard__pulse-inner absolute inset-0 pointer-events-none rounded-[inherit] transition-opacity duration-300",
|
|
75
|
+
style: {
|
|
76
|
+
opacity: e ? 1 : 0,
|
|
77
|
+
background: `radial-gradient(ellipse at 50% 50%, ${n}${c}, transparent 70%)`,
|
|
78
|
+
animation: e ? "bear-glow-pulse 2s ease-in-out infinite" : "none"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ t(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
className: "Bear-GlowCard__pulse-outer absolute -inset-1 pointer-events-none rounded-[inherit]",
|
|
86
|
+
style: {
|
|
87
|
+
boxShadow: `0 0 ${a}px ${a / 2}px ${n}${$}`,
|
|
88
|
+
animation: e ? "bear-glow-pulse 2s ease-in-out infinite" : "none",
|
|
89
|
+
opacity: e ? 1 : 0,
|
|
90
|
+
transition: "opacity 0.3s"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ t(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
className: "Bear-GlowCard__pulse-ring absolute inset-0 pointer-events-none rounded-[inherit]",
|
|
98
|
+
style: {
|
|
99
|
+
boxShadow: `inset 0 0 0 ${s}px ${n}${p}`,
|
|
100
|
+
animation: e ? "bear-glow-pulse 2s ease-in-out infinite 0.5s" : "none",
|
|
101
|
+
opacity: e ? 1 : 0,
|
|
102
|
+
transition: "opacity 0.3s"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] });
|
|
107
|
+
case "wave":
|
|
108
|
+
return /* @__PURE__ */ r(d, { children: [
|
|
109
|
+
/* @__PURE__ */ t(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
className: "Bear-GlowCard__wave absolute inset-0 pointer-events-none rounded-[inherit]",
|
|
113
|
+
style: {
|
|
114
|
+
opacity: e ? 1 : 0,
|
|
115
|
+
transition: "opacity 0.3s",
|
|
116
|
+
background: `linear-gradient(90deg, transparent 0%, ${n}${c} 50%, transparent 100%)`,
|
|
117
|
+
backgroundSize: "200% 100%",
|
|
118
|
+
animation: e ? "bear-glow-wave 2.5s ease-in-out infinite" : "none"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ t(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: "Bear-GlowCard__wave-edge absolute inset-0 pointer-events-none rounded-[inherit]",
|
|
126
|
+
style: {
|
|
127
|
+
opacity: e ? 1 : 0,
|
|
128
|
+
transition: "opacity 0.3s",
|
|
129
|
+
boxShadow: `inset 0 ${s}px 0 ${n}${p}, 0 0 ${a / 2}px ${n}${$}`,
|
|
130
|
+
animation: e ? "bear-glow-wave-shadow 2.5s ease-in-out infinite" : "none"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
] });
|
|
135
|
+
default:
|
|
136
|
+
return /* @__PURE__ */ r(d, { children: [
|
|
137
|
+
/* @__PURE__ */ t(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: "Bear-GlowCard__ambient absolute inset-0 pointer-events-none transition-opacity duration-300",
|
|
141
|
+
style: {
|
|
142
|
+
opacity: e ? 0.6 : 0,
|
|
143
|
+
background: `radial-gradient(circle at ${i.x}% ${i.y}%, ${n}${c}, transparent ${a}%)`
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ t(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
className: "Bear-GlowCard__shadow absolute inset-0 pointer-events-none rounded-[inherit] transition-opacity duration-300",
|
|
151
|
+
style: {
|
|
152
|
+
opacity: e ? 0.6 : 0,
|
|
153
|
+
boxShadow: `inset 0 0 0 1px ${n}${M}, 0 0 ${a}px ${n}${$}`
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
] });
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
return /* @__PURE__ */ r(
|
|
161
|
+
"div",
|
|
162
|
+
{
|
|
163
|
+
ref: _,
|
|
164
|
+
className: D(
|
|
165
|
+
"Bear-GlowCard relative overflow-hidden transition-shadow duration-300",
|
|
166
|
+
"bg-white dark:bg-zinc-900 border border-gray-200 dark:border-zinc-700",
|
|
167
|
+
e && "shadow-xl",
|
|
168
|
+
E
|
|
169
|
+
),
|
|
170
|
+
style: { borderRadius: T, ...B },
|
|
171
|
+
onMouseMove: O,
|
|
172
|
+
onMouseEnter: () => y(!0),
|
|
173
|
+
onMouseLeave: () => y(!1),
|
|
174
|
+
"data-testid": w,
|
|
175
|
+
...N,
|
|
176
|
+
children: [
|
|
177
|
+
k(),
|
|
178
|
+
/* @__PURE__ */ t("div", { className: "Bear-GlowCard__content relative z-10", children: x })
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
export {
|
|
184
|
+
X as GlowCard
|
|
185
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type GlowEffect = 'ambient' | 'border' | 'spotlight' | 'pulse' | 'wave';
|
|
3
|
+
export interface GlowCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** Glow color (CSS color value) */
|
|
6
|
+
glowColor?: string;
|
|
7
|
+
/** Glow intensity (0–100, controls blur/spread) */
|
|
8
|
+
glowIntensity?: number;
|
|
9
|
+
/** Whether glow follows the mouse position */
|
|
10
|
+
followMouse?: boolean;
|
|
11
|
+
/** Border radius */
|
|
12
|
+
borderRadius?: number | string;
|
|
13
|
+
/** Disable glow animation */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Glow effect style */
|
|
16
|
+
effect?: GlowEffect;
|
|
17
|
+
/** Border width for 'border' effect (px) */
|
|
18
|
+
borderWidth?: number;
|
|
19
|
+
/** Test ID */
|
|
20
|
+
testId?: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("react"),S=require("../../utils/cn.cjs"),W=require("../Popover/Popover.cjs"),N=require("../Typography/Typography.cjs"),o=require("./Heatmap.const.cjs"),k=require("./Heatmap.utils.cjs"),I=({data:v,startDate:d,endDate:h,colorScale:u=o.DEFAULT_COLOR_SCALE,cellSize:m=o.DEFAULT_CELL_SIZE,cellGap:p=o.DEFAULT_CELL_GAP,showDayLabels:y=!0,showMonthLabels:b=!0,emptyColor:L,tooltipFormat:E,onCellClick:x,renderTooltip:i,testId:D,className:O,...q})=>{const[g,H]=l.useState(null),[P,_]=l.useState(!1),R=l.useRef(new Map),{weeks:M,dataMap:T,maxValue:f}=l.useMemo(()=>{const e=h?new Date(h):new Date,a=d?new Date(d):new Date(e.getFullYear()-1,e.getMonth(),e.getDate()),c=new Map;let r=0;for(const n of v)c.set(n.date,n),n.value>r&&(r=n.value);return{weeks:k.getWeeks(a,e),dataMap:c,maxValue:r}},[v,d,h]),C=l.useCallback(e=>{if(e===0||f===0)return L??o.DEFAULT_EMPTY_COLOR;const a=Math.min(Math.floor(e/f*(u.length-1)),u.length-1);return u[a]},[f,L,u]),j=y?28:0,F=l.useCallback(e=>{!e||!i||(H(e),_(!0))},[i]),U=l.useCallback(()=>{_(!1),H(null)},[]);return s.jsxs("div",{className:S.cn("Bear-Heatmap relative inline-block",O),"data-testid":D,...q,children:[b&&s.jsx("div",{className:"Bear-Heatmap__months flex mb-1",style:{paddingLeft:j},children:M.map((e,a)=>{const c=e[0],r=a===0||c.getDate()<=o.DAYS_IN_WEEK;return s.jsx(N.Typography,{variant:"caption",className:"Bear-Heatmap__month text-gray-400 dark:text-gray-500 text-[10px]",style:{width:m+p,textAlign:"left"},children:r?o.MONTH_LABELS[c.getMonth()]:""},a)})}),s.jsxs("div",{className:"Bear-Heatmap__grid flex",children:[y&&s.jsx("div",{className:"Bear-Heatmap__days flex flex-col mr-1",style:{gap:p},children:o.DAY_LABELS.map((e,a)=>s.jsx(N.Typography,{variant:"caption",className:"Bear-Heatmap__day text-gray-400 dark:text-gray-500 text-[10px] flex items-center justify-end",style:{height:m,width:j-o.LABEL_PAD},children:e},a))}),s.jsx("div",{className:"Bear-Heatmap__weeks flex",style:{gap:p},children:M.map((e,a)=>s.jsx("div",{className:"Bear-Heatmap__week flex flex-col",style:{gap:p},children:e.map((c,r)=>{const n=k.toKey(c),t=T.get(n),w=(t==null?void 0:t.value)??0,Y=C(w),A=s.jsx("div",{ref:B=>{B&&R.current.set(n,B)},className:"Bear-Heatmap__cell rounded-sm cursor-pointer transition-transform hover:scale-125",style:{width:m,height:m,backgroundColor:Y},title:i?void 0:t?E?E(t):`${n}: ${w}`:n,onClick:()=>t&&(x==null?void 0:x(t)),onMouseEnter:()=>F(t),onMouseLeave:U},r);return i&&t&&(g==null?void 0:g.date)===t.date?s.jsx(W.Popover,{content:i(t),trigger:"hover",placement:"top",open:P,onOpenChange:_,arrow:!1,children:A},r):A})},a))})]})]})};exports.Heatmap=I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=12,E=3,A=["#161b22","#0e4429","#006d32","#26a641","#39d353"],_="#ebedf0",t=["","Mon","","Wed","","Fri",""],D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],e=7,o=4;exports.DAYS_IN_WEEK=e;exports.DAY_LABELS=t;exports.DEFAULT_CELL_GAP=E;exports.DEFAULT_CELL_SIZE=L;exports.DEFAULT_COLOR_SCALE=A;exports.DEFAULT_EMPTY_COLOR=_;exports.LABEL_PAD=o;exports.MONTH_LABELS=D;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DEFAULT_CELL_SIZE = 12;
|
|
2
|
+
export declare const DEFAULT_CELL_GAP = 3;
|
|
3
|
+
export declare const DEFAULT_COLOR_SCALE: string[];
|
|
4
|
+
export declare const DEFAULT_EMPTY_COLOR = "#ebedf0";
|
|
5
|
+
export declare const DAY_LABELS: string[];
|
|
6
|
+
export declare const MONTH_LABELS: string[];
|
|
7
|
+
export declare const DAYS_IN_WEEK = 7;
|
|
8
|
+
export declare const LABEL_PAD = 4;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const L = 12, A = 3, E = ["#161b22", "#0e4429", "#006d32", "#26a641", "#39d353"], _ = "#ebedf0", n = ["", "Mon", "", "Wed", "", "Fri", ""], o = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], c = 7, t = 4;
|
|
2
|
+
export {
|
|
3
|
+
c as DAYS_IN_WEEK,
|
|
4
|
+
n as DAY_LABELS,
|
|
5
|
+
A as DEFAULT_CELL_GAP,
|
|
6
|
+
L as DEFAULT_CELL_SIZE,
|
|
7
|
+
E as DEFAULT_COLOR_SCALE,
|
|
8
|
+
_ as DEFAULT_EMPTY_COLOR,
|
|
9
|
+
t as LABEL_PAD,
|
|
10
|
+
o as MONTH_LABELS
|
|
11
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsxs as N, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as D, useRef as I, useMemo as K, useCallback as g } from "react";
|
|
3
|
+
import { cn as V } from "../../utils/cn.js";
|
|
4
|
+
import { Popover as $ } from "../Popover/Popover.js";
|
|
5
|
+
import { Typography as k } from "../Typography/Typography.js";
|
|
6
|
+
import { DEFAULT_EMPTY_COLOR as Z, DEFAULT_COLOR_SCALE as q, DAYS_IN_WEEK as J, MONTH_LABELS as Q, DEFAULT_CELL_SIZE as S, DEFAULT_CELL_GAP as X, DAY_LABELS as G, LABEL_PAD as z } from "./Heatmap.const.js";
|
|
7
|
+
import { getWeeks as ee, toKey as te } from "./Heatmap.utils.js";
|
|
8
|
+
const le = ({
|
|
9
|
+
data: x,
|
|
10
|
+
startDate: p,
|
|
11
|
+
endDate: d,
|
|
12
|
+
colorScale: i = q,
|
|
13
|
+
cellSize: l = S,
|
|
14
|
+
cellGap: c = X,
|
|
15
|
+
showDayLabels: v = !0,
|
|
16
|
+
showMonthLabels: O = !0,
|
|
17
|
+
emptyColor: L,
|
|
18
|
+
tooltipFormat: y,
|
|
19
|
+
onCellClick: f,
|
|
20
|
+
renderTooltip: m,
|
|
21
|
+
testId: b,
|
|
22
|
+
className: P,
|
|
23
|
+
...F
|
|
24
|
+
}) => {
|
|
25
|
+
const [h, E] = D(null), [R, u] = D(!1), U = I(/* @__PURE__ */ new Map()), { weeks: w, dataMap: Y, maxValue: _ } = K(() => {
|
|
26
|
+
const e = d ? new Date(d) : /* @__PURE__ */ new Date(), a = p ? new Date(p) : new Date(e.getFullYear() - 1, e.getMonth(), e.getDate()), o = /* @__PURE__ */ new Map();
|
|
27
|
+
let n = 0;
|
|
28
|
+
for (const r of x)
|
|
29
|
+
o.set(r.date, r), r.value > n && (n = r.value);
|
|
30
|
+
return { weeks: ee(a, e), dataMap: o, maxValue: n };
|
|
31
|
+
}, [x, p, d]), j = g(
|
|
32
|
+
(e) => {
|
|
33
|
+
if (e === 0 || _ === 0) return L ?? Z;
|
|
34
|
+
const a = Math.min(Math.floor(e / _ * (i.length - 1)), i.length - 1);
|
|
35
|
+
return i[a];
|
|
36
|
+
},
|
|
37
|
+
[_, L, i]
|
|
38
|
+
), A = v ? 28 : 0, C = g((e) => {
|
|
39
|
+
!e || !m || (E(e), u(!0));
|
|
40
|
+
}, [m]), T = g(() => {
|
|
41
|
+
u(!1), E(null);
|
|
42
|
+
}, []);
|
|
43
|
+
return /* @__PURE__ */ N("div", { className: V("Bear-Heatmap relative inline-block", P), "data-testid": b, ...F, children: [
|
|
44
|
+
O && /* @__PURE__ */ s("div", { className: "Bear-Heatmap__months flex mb-1", style: { paddingLeft: A }, children: w.map((e, a) => {
|
|
45
|
+
const o = e[0], n = a === 0 || o.getDate() <= J;
|
|
46
|
+
return /* @__PURE__ */ s(
|
|
47
|
+
k,
|
|
48
|
+
{
|
|
49
|
+
variant: "caption",
|
|
50
|
+
className: "Bear-Heatmap__month text-gray-400 dark:text-gray-500 text-[10px]",
|
|
51
|
+
style: { width: l + c, textAlign: "left" },
|
|
52
|
+
children: n ? Q[o.getMonth()] : ""
|
|
53
|
+
},
|
|
54
|
+
a
|
|
55
|
+
);
|
|
56
|
+
}) }),
|
|
57
|
+
/* @__PURE__ */ N("div", { className: "Bear-Heatmap__grid flex", children: [
|
|
58
|
+
v && /* @__PURE__ */ s("div", { className: "Bear-Heatmap__days flex flex-col mr-1", style: { gap: c }, children: G.map((e, a) => /* @__PURE__ */ s(
|
|
59
|
+
k,
|
|
60
|
+
{
|
|
61
|
+
variant: "caption",
|
|
62
|
+
className: "Bear-Heatmap__day text-gray-400 dark:text-gray-500 text-[10px] flex items-center justify-end",
|
|
63
|
+
style: { height: l, width: A - z },
|
|
64
|
+
children: e
|
|
65
|
+
},
|
|
66
|
+
a
|
|
67
|
+
)) }),
|
|
68
|
+
/* @__PURE__ */ s("div", { className: "Bear-Heatmap__weeks flex", style: { gap: c }, children: w.map((e, a) => /* @__PURE__ */ s("div", { className: "Bear-Heatmap__week flex flex-col", style: { gap: c }, children: e.map((o, n) => {
|
|
69
|
+
const r = te(o), t = Y.get(r), M = (t == null ? void 0 : t.value) ?? 0, W = j(M), B = /* @__PURE__ */ s(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
ref: (H) => {
|
|
73
|
+
H && U.current.set(r, H);
|
|
74
|
+
},
|
|
75
|
+
className: "Bear-Heatmap__cell rounded-sm cursor-pointer transition-transform hover:scale-125",
|
|
76
|
+
style: { width: l, height: l, backgroundColor: W },
|
|
77
|
+
title: m ? void 0 : t ? y ? y(t) : `${r}: ${M}` : r,
|
|
78
|
+
onClick: () => t && (f == null ? void 0 : f(t)),
|
|
79
|
+
onMouseEnter: () => C(t),
|
|
80
|
+
onMouseLeave: T
|
|
81
|
+
},
|
|
82
|
+
n
|
|
83
|
+
);
|
|
84
|
+
return m && t && (h == null ? void 0 : h.date) === t.date ? /* @__PURE__ */ s(
|
|
85
|
+
$,
|
|
86
|
+
{
|
|
87
|
+
content: m(t),
|
|
88
|
+
trigger: "hover",
|
|
89
|
+
placement: "top",
|
|
90
|
+
open: R,
|
|
91
|
+
onOpenChange: u,
|
|
92
|
+
arrow: !1,
|
|
93
|
+
children: B
|
|
94
|
+
},
|
|
95
|
+
n
|
|
96
|
+
) : B;
|
|
97
|
+
}) }, a)) })
|
|
98
|
+
] })
|
|
99
|
+
] });
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
le as Heatmap
|
|
103
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface HeatmapCell {
|
|
3
|
+
date: string;
|
|
4
|
+
value: number;
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface HeatmapProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
8
|
+
/** Data points with date strings (YYYY-MM-DD) and values */
|
|
9
|
+
data: HeatmapCell[];
|
|
10
|
+
/** Start date (defaults to 1 year ago) */
|
|
11
|
+
startDate?: string;
|
|
12
|
+
/** End date (defaults to today) */
|
|
13
|
+
endDate?: string;
|
|
14
|
+
/** Color scale: array of colors from low to high */
|
|
15
|
+
colorScale?: string[];
|
|
16
|
+
/** Cell size in px */
|
|
17
|
+
cellSize?: number;
|
|
18
|
+
/** Gap between cells in px */
|
|
19
|
+
cellGap?: number;
|
|
20
|
+
/** Show day-of-week labels */
|
|
21
|
+
showDayLabels?: boolean;
|
|
22
|
+
/** Show month labels */
|
|
23
|
+
showMonthLabels?: boolean;
|
|
24
|
+
/** Empty cell color */
|
|
25
|
+
emptyColor?: string;
|
|
26
|
+
/** Tooltip formatter */
|
|
27
|
+
tooltipFormat?: (cell: HeatmapCell) => string;
|
|
28
|
+
/** Callback when a cell is clicked */
|
|
29
|
+
onCellClick?: (cell: HeatmapCell) => void;
|
|
30
|
+
/** Render custom hover content per cell */
|
|
31
|
+
renderTooltip?: (cell: HeatmapCell) => ReactNode;
|
|
32
|
+
/** Test ID */
|
|
33
|
+
testId?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./Heatmap.const.cjs");function c(t,r){const n=[],e=new Date(t);for(e.setDate(e.getDate()-e.getDay());e<=r;){const o=[];for(let s=0;s<a.DAYS_IN_WEEK;s++)o.push(new Date(e)),e.setDate(e.getDate()+1);n.push(o)}return n}function u(t){return t.toISOString().slice(0,10)}exports.getWeeks=c;exports.toKey=u;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DAYS_IN_WEEK as D } from "./Heatmap.const.js";
|
|
2
|
+
function c(t, s) {
|
|
3
|
+
const n = [], e = new Date(t);
|
|
4
|
+
for (e.setDate(e.getDate() - e.getDay()); e <= s; ) {
|
|
5
|
+
const o = [];
|
|
6
|
+
for (let r = 0; r < D; r++)
|
|
7
|
+
o.push(new Date(e)), e.setDate(e.getDate() + 1);
|
|
8
|
+
n.push(o);
|
|
9
|
+
}
|
|
10
|
+
return n;
|
|
11
|
+
}
|
|
12
|
+
function u(t) {
|
|
13
|
+
return t.toISOString().slice(0, 10);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
c as getWeeks,
|
|
17
|
+
u as toKey
|
|
18
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),o=require("react"),P=require("../Portal/Portal.cjs"),C=11e3,i=288,u=200;function N(e,l,n){let t=0,r=0;const h=i/2;return l==="bottom"?(t=e.bottom+8,r=e.left+e.width/2-h,n==="start"&&(r=e.left),n==="end"&&(r=e.right-i)):l==="top"?(t=e.top-u-8,r=e.left+e.width/2-h,n==="start"&&(r=e.left),n==="end"&&(r=e.right-i)):l==="right"?(r=e.right+8,t=e.top+e.height/2-u/2,n==="start"&&(t=e.top),n==="end"&&(t=e.bottom-u)):(r=e.left-i-8,t=e.top+e.height/2-u/2,n==="start"&&(t=e.top),n==="end"&&(t=e.bottom-u)),r=Math.max(8,Math.min(r,window.innerWidth-i-8)),t=Math.max(8,Math.min(t,window.innerHeight-u-8)),{position:"fixed",zIndex:C,top:t,left:r,width:i}}const T=o.forwardRef(({children:e,cardContent:l,side:n="bottom",align:m="center",openDelay:t=200,closeDelay:r=300,arrow:h=!0,className:x="",...L},H)=>{const[a,p]=o.useState(!1),[S,j]=o.useState({}),d=o.useRef(),c=o.useRef(),f=o.useRef(null),v=o.useRef(null);o.useEffect(()=>{if(!a||!f.current)return;const s=()=>{const w=f.current.getBoundingClientRect();j(N(w,n,m))};return s(),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[a,n,m]),o.useEffect(()=>{if(!a)return;const s=w=>{var y,M;const R=w.target;(y=f.current)!=null&&y.contains(R)||(M=v.current)!=null&&M.contains(R)||p(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[a]);const g=()=>{c.current&&clearTimeout(c.current),d.current=setTimeout(()=>p(!0),t)},E=()=>{d.current&&clearTimeout(d.current),c.current=setTimeout(()=>p(!1),r)};return o.useEffect(()=>()=>{d.current&&clearTimeout(d.current),c.current&&clearTimeout(c.current)},[]),b.jsxs("div",{ref:H,className:`bear-hover-card bear-relative bear-inline-block ${x}`.trim(),onMouseEnter:g,onMouseLeave:E,...L,children:[b.jsx("div",{ref:f,className:"bear-inline-block",children:e}),a&&b.jsx(P.Portal,{children:b.jsx("div",{ref:v,style:S,className:`
|
|
2
|
+
bear-bg-white dark:bear-bg-gray-800 bear-rounded-lg bear-shadow-xl
|
|
3
|
+
bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-p-4
|
|
4
|
+
bear-transition-all bear-duration-200
|
|
5
|
+
${a?"bear-opacity-100 bear-scale-100":"bear-opacity-0 bear-scale-95"}
|
|
6
|
+
`,onMouseEnter:g,onMouseLeave:E,children:l})})]})});T.displayName="HoverCard";exports.HoverCard=T;
|
|
@@ -1,68 +1,86 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}, g) => {
|
|
15
|
-
const [h, o] = x(!1), e = c(), r = c(), a = () => {
|
|
16
|
-
r.current && clearTimeout(r.current), e.current = setTimeout(() => {
|
|
17
|
-
o(!0);
|
|
18
|
-
}, m);
|
|
19
|
-
}, s = () => {
|
|
20
|
-
e.current && clearTimeout(e.current), r.current = setTimeout(() => {
|
|
21
|
-
o(!1);
|
|
22
|
-
}, b);
|
|
1
|
+
import { jsxs as C, jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as O, useState as R, useRef as c, useEffect as v } from "react";
|
|
3
|
+
import { Portal as P } from "../Portal/Portal.js";
|
|
4
|
+
const S = 11e3, a = 288, s = 200;
|
|
5
|
+
function z(e, u, n) {
|
|
6
|
+
let t = 0, r = 0;
|
|
7
|
+
const b = a / 2;
|
|
8
|
+
return u === "bottom" ? (t = e.bottom + 8, r = e.left + e.width / 2 - b, n === "start" && (r = e.left), n === "end" && (r = e.right - a)) : u === "top" ? (t = e.top - s - 8, r = e.left + e.width / 2 - b, n === "start" && (r = e.left), n === "end" && (r = e.right - a)) : u === "right" ? (r = e.right + 8, t = e.top + e.height / 2 - s / 2, n === "start" && (t = e.top), n === "end" && (t = e.bottom - s)) : (r = e.left - a - 8, t = e.top + e.height / 2 - s / 2, n === "start" && (t = e.top), n === "end" && (t = e.bottom - s)), r = Math.max(8, Math.min(r, window.innerWidth - a - 8)), t = Math.max(8, Math.min(t, window.innerHeight - s - 8)), {
|
|
9
|
+
position: "fixed",
|
|
10
|
+
zIndex: S,
|
|
11
|
+
top: t,
|
|
12
|
+
left: r,
|
|
13
|
+
width: a
|
|
23
14
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
}
|
|
16
|
+
const I = O(({
|
|
17
|
+
children: e,
|
|
18
|
+
cardContent: u,
|
|
19
|
+
side: n = "bottom",
|
|
20
|
+
align: m = "center",
|
|
21
|
+
openDelay: t = 200,
|
|
22
|
+
closeDelay: r = 300,
|
|
23
|
+
arrow: b = !0,
|
|
24
|
+
className: x = "",
|
|
25
|
+
...H
|
|
26
|
+
}, N) => {
|
|
27
|
+
const [i, p] = R(!1), [_, k] = R({}), d = c(), l = c(), f = c(null), g = c(null);
|
|
28
|
+
v(() => {
|
|
29
|
+
if (!i || !f.current) return;
|
|
30
|
+
const o = () => {
|
|
31
|
+
const h = f.current.getBoundingClientRect();
|
|
32
|
+
k(z(h, n, m));
|
|
33
|
+
};
|
|
34
|
+
return o(), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), () => {
|
|
35
|
+
window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0);
|
|
36
|
+
};
|
|
37
|
+
}, [i, n, m]), v(() => {
|
|
38
|
+
if (!i) return;
|
|
39
|
+
const o = (h) => {
|
|
40
|
+
var T, y;
|
|
41
|
+
const M = h.target;
|
|
42
|
+
(T = f.current) != null && T.contains(M) || (y = g.current) != null && y.contains(M) || p(!1);
|
|
43
|
+
};
|
|
44
|
+
return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
|
|
45
|
+
}, [i]);
|
|
46
|
+
const E = () => {
|
|
47
|
+
l.current && clearTimeout(l.current), d.current = setTimeout(() => p(!0), t);
|
|
48
|
+
}, L = () => {
|
|
49
|
+
d.current && clearTimeout(d.current), l.current = setTimeout(() => p(!1), r);
|
|
50
|
+
};
|
|
51
|
+
return v(() => () => {
|
|
52
|
+
d.current && clearTimeout(d.current), l.current && clearTimeout(l.current);
|
|
53
|
+
}, []), /* @__PURE__ */ C(
|
|
27
54
|
"div",
|
|
28
55
|
{
|
|
29
|
-
ref:
|
|
30
|
-
className: `bear-hover-card relative inline-block ${
|
|
31
|
-
onMouseEnter:
|
|
32
|
-
onMouseLeave:
|
|
33
|
-
...
|
|
56
|
+
ref: N,
|
|
57
|
+
className: `bear-hover-card bear-relative bear-inline-block ${x}`.trim(),
|
|
58
|
+
onMouseEnter: E,
|
|
59
|
+
onMouseLeave: L,
|
|
60
|
+
...H,
|
|
34
61
|
children: [
|
|
35
|
-
|
|
36
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ w("div", { ref: f, className: "bear-inline-block", children: e }),
|
|
63
|
+
i && /* @__PURE__ */ w(P, { children: /* @__PURE__ */ w(
|
|
37
64
|
"div",
|
|
38
65
|
{
|
|
66
|
+
ref: g,
|
|
67
|
+
style: _,
|
|
39
68
|
className: `
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
onMouseEnter:
|
|
46
|
-
onMouseLeave:
|
|
47
|
-
children:
|
|
48
|
-
f && /* @__PURE__ */ i(
|
|
49
|
-
"div",
|
|
50
|
-
{
|
|
51
|
-
className: `absolute w-3 h-3 bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 ${w(t)}`,
|
|
52
|
-
style: {
|
|
53
|
-
borderWidth: t === "top" || t === "left" ? "0 1px 1px 0" : "1px 0 0 1px"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
),
|
|
57
|
-
l
|
|
58
|
-
] })
|
|
69
|
+
bear-bg-white dark:bear-bg-gray-800 bear-rounded-lg bear-shadow-xl
|
|
70
|
+
bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-p-4
|
|
71
|
+
bear-transition-all bear-duration-200
|
|
72
|
+
${i ? "bear-opacity-100 bear-scale-100" : "bear-opacity-0 bear-scale-95"}
|
|
73
|
+
`,
|
|
74
|
+
onMouseEnter: E,
|
|
75
|
+
onMouseLeave: L,
|
|
76
|
+
children: u
|
|
59
77
|
}
|
|
60
|
-
)
|
|
78
|
+
) })
|
|
61
79
|
]
|
|
62
80
|
}
|
|
63
81
|
);
|
|
64
82
|
});
|
|
65
|
-
|
|
83
|
+
I.displayName = "HoverCard";
|
|
66
84
|
export {
|
|
67
|
-
|
|
85
|
+
I as HoverCard
|
|
68
86
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as e, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { Icon as l } from "../Icon.js";
|
|
3
3
|
const h = (n) => /* @__PURE__ */ c(l, { ...n, children: /* @__PURE__ */ c("polyline", { points: "20 6 9 17 4 12" }) }), o = (n) => /* @__PURE__ */ e(l, { ...n, children: [
|
|
4
4
|
/* @__PURE__ */ c("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),n=require("react"),q=require("../../utils/cn.cjs"),k=require("../Icon/index.cjs"),P=require("../Popover/Popover.cjs"),R=require("../Input/Input.cjs"),_=require("./ImageAnnotation.const.cjs");let T=1;function L(o,a,r,t){return c.jsx("div",{className:"Bear-ImageAnnotation__edit min-w-[160px]",children:c.jsx(R.Input,{autoFocus:!0,size:"sm",value:o,onChange:s=>a(s.target.value),onKeyDown:s=>{s.key==="Enter"&&r(),s.key==="Escape"&&t()},placeholder:"Add note..."})})}function O(o,a,r,t){return c.jsxs("div",{className:"Bear-ImageAnnotation__label text-xs text-gray-700 dark:text-gray-200 whitespace-nowrap flex items-center gap-1",children:[t??o.text,a&&c.jsx("button",{type:"button",className:"text-red-400 hover:text-red-600 ml-1",onClick:s=>{s.stopPropagation(),r(o.id)},children:c.jsx(k.BearIcons.XIcon,{size:12})})]})}const D=({src:o,alt:a="",annotations:r,onChange:t,editable:s=!0,pinColor:A=_.DEFAULT_PIN_COLOR,pinSize:x=_.DEFAULT_PIN_SIZE,renderPopover:f,testId:j,className:y,...b})=>{const p=n.useRef(null),[i,u]=n.useState(null),[d,v]=n.useState(""),h=n.useCallback(e=>{if(!s||!t||!p.current||e.target.closest(".Bear-ImageAnnotation__pin"))return;const l=p.current.getBoundingClientRect(),I=(e.clientX-l.left)/l.width*100,g=(e.clientY-l.top)/l.height*100,m=`ann-${T++}`,B={id:m,x:I,y:g,text:""};t([...r,B]),u(m),v("")},[s,t,r]),N=n.useCallback(()=>{!i||!t||(d.trim()?t(r.map(e=>e.id===i?{...e,text:d}:e)):t(r.filter(e=>e.id!==i)),u(null))},[i,d,t,r]),w=n.useCallback(()=>u(null),[]),E=n.useCallback(e=>{t==null||t(r.filter(l=>l.id!==e)),i===e&&u(null)},[t,r,i]);return c.jsxs("div",{ref:p,className:q.cn("Bear-ImageAnnotation relative inline-block select-none",s&&"cursor-crosshair",y),onClick:h,"data-testid":j,...b,children:[c.jsx("img",{src:o,alt:a,className:"w-full h-auto block rounded-lg",draggable:!1}),r.map(e=>{const l=i===e.id,I=!!e.text,g=f==null?void 0:f(e),m=l?L(d,v,N,w):I?O(e,s,E,g):null;return c.jsx("div",{className:"Bear-ImageAnnotation__pin absolute transform -translate-x-1/2 -translate-y-full z-10",style:{left:`${e.x}%`,top:`${e.y}%`},children:c.jsx(P.Popover,{content:m,trigger:l?"click":"hover",placement:"top",open:l||void 0,arrow:!1,children:c.jsx("div",{className:"Bear-ImageAnnotation__marker flex items-center justify-center rounded-full shadow-lg cursor-pointer transition-transform hover:scale-110",style:{width:x,height:x,backgroundColor:e.color??A},children:c.jsx(k.BearIcons.MapPinIcon,{size:x*_.PIN_ICON_RATIO,className:"text-white"})})})},e.id)})]})};exports.ImageAnnotation=D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I="#ec4899",_=24,t=.6;exports.DEFAULT_PIN_COLOR=I;exports.DEFAULT_PIN_SIZE=_;exports.PIN_ICON_RATIO=t;
|