@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.
Files changed (268) hide show
  1. package/dist/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
  2. package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
  3. package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
  4. package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
  5. package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
  6. package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
  7. package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
  8. package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
  9. package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
  10. package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
  11. package/dist/components/AnimatedCounter/index.d.ts +2 -0
  12. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  13. package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
  14. package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
  15. package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
  16. package/dist/components/Autocomplete/Autocomplete.js +110 -72
  17. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  18. package/dist/components/BottomSheet/BottomSheet.js +74 -53
  19. package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
  20. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
  21. package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
  22. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
  23. package/dist/components/Breadcrumbs/index.d.ts +1 -1
  24. package/dist/components/Cascader/Cascader.cjs +1 -1
  25. package/dist/components/Cascader/Cascader.const.cjs +1 -1
  26. package/dist/components/Cascader/Cascader.const.d.ts +1 -1
  27. package/dist/components/Cascader/Cascader.const.js +1 -1
  28. package/dist/components/Cascader/Cascader.js +109 -146
  29. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
  30. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
  31. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
  32. package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
  33. package/dist/components/Chart/BarChart.cjs +1 -0
  34. package/dist/components/Chart/BarChart.d.ts +3 -0
  35. package/dist/components/Chart/BarChart.js +65 -0
  36. package/dist/components/Chart/Chart.cjs +1 -1
  37. package/dist/components/Chart/Chart.const.cjs +1 -1
  38. package/dist/components/Chart/Chart.const.d.ts +7 -0
  39. package/dist/components/Chart/Chart.const.js +12 -2
  40. package/dist/components/Chart/Chart.d.ts +1 -13
  41. package/dist/components/Chart/Chart.js +18 -204
  42. package/dist/components/Chart/Chart.types.d.ts +7 -1
  43. package/dist/components/Chart/LineChart.cjs +1 -0
  44. package/dist/components/Chart/LineChart.d.ts +3 -0
  45. package/dist/components/Chart/LineChart.js +73 -0
  46. package/dist/components/Chart/PieChart.cjs +1 -0
  47. package/dist/components/Chart/PieChart.d.ts +3 -0
  48. package/dist/components/Chart/PieChart.js +110 -0
  49. package/dist/components/Chart/index.d.ts +4 -1
  50. package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
  51. package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
  52. package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
  53. package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
  54. package/dist/components/ColorPicker/ColorPicker.js +135 -73
  55. package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
  56. package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
  57. package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
  58. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  59. package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
  60. package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
  61. package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
  62. package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
  63. package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
  64. package/dist/components/CreditInput/CreditInput.cjs +1 -1
  65. package/dist/components/CreditInput/CreditInput.js +80 -78
  66. package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
  67. package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
  68. package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
  69. package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
  70. package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
  71. package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
  72. package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
  73. package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
  74. package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
  75. package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
  76. package/dist/components/CurrencyInput/index.d.ts +2 -0
  77. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  78. package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
  79. package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
  80. package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
  81. package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
  82. package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
  83. package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
  84. package/dist/components/DiffSquares/DiffSquares.js +70 -0
  85. package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
  86. package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
  87. package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
  88. package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
  89. package/dist/components/DiffSquares/index.d.ts +2 -0
  90. package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
  91. package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
  92. package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
  93. package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
  94. package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
  95. package/dist/components/DiffViewer/DiffViewer.js +97 -105
  96. package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
  97. package/dist/components/DiffViewer/index.d.ts +1 -1
  98. package/dist/components/Drawer/Drawer.cjs +1 -1
  99. package/dist/components/Drawer/Drawer.js +41 -41
  100. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  101. package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
  102. package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
  103. package/dist/components/Dropdown/Dropdown.const.js +10 -0
  104. package/dist/components/Dropdown/Dropdown.d.ts +0 -1
  105. package/dist/components/Dropdown/Dropdown.js +102 -92
  106. package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
  107. package/dist/components/Gauge/Gauge.cjs +1 -1
  108. package/dist/components/Gauge/Gauge.js +61 -50
  109. package/dist/components/Gauge/Gauge.types.d.ts +2 -0
  110. package/dist/components/GlowCard/GlowCard.cjs +1 -0
  111. package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
  112. package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
  113. package/dist/components/GlowCard/GlowCard.const.js +13 -0
  114. package/dist/components/GlowCard/GlowCard.d.ts +3 -0
  115. package/dist/components/GlowCard/GlowCard.js +185 -0
  116. package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
  117. package/dist/components/GlowCard/index.d.ts +2 -0
  118. package/dist/components/Heatmap/Heatmap.cjs +1 -0
  119. package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
  120. package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
  121. package/dist/components/Heatmap/Heatmap.const.js +11 -0
  122. package/dist/components/Heatmap/Heatmap.d.ts +3 -0
  123. package/dist/components/Heatmap/Heatmap.js +103 -0
  124. package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
  125. package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
  126. package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
  127. package/dist/components/Heatmap/Heatmap.utils.js +18 -0
  128. package/dist/components/Heatmap/index.d.ts +2 -0
  129. package/dist/components/HoverCard/HoverCard.cjs +6 -6
  130. package/dist/components/HoverCard/HoverCard.js +72 -54
  131. package/dist/components/Icon/icons/status.js +1 -1
  132. package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
  133. package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
  134. package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
  135. package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
  136. package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
  137. package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
  138. package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
  139. package/dist/components/ImageAnnotation/index.d.ts +2 -0
  140. package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
  141. package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
  142. package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
  143. package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
  144. package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
  145. package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
  146. package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
  147. package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
  148. package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
  149. package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
  150. package/dist/components/MediaPlayer/index.d.ts +2 -0
  151. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  152. package/dist/components/MentionsInput/MentionsInput.js +106 -83
  153. package/dist/components/Menu/Menu.cjs +1 -1
  154. package/dist/components/Menu/Menu.js +91 -80
  155. package/dist/components/Modal/Modal.cjs +1 -1
  156. package/dist/components/Modal/Modal.const.cjs +1 -1
  157. package/dist/components/Modal/Modal.const.d.ts +1 -1
  158. package/dist/components/Modal/Modal.const.js +1 -1
  159. package/dist/components/Modal/Modal.js +50 -44
  160. package/dist/components/Modal/Modal.types.d.ts +6 -0
  161. package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
  162. package/dist/components/MultiSelect/MultiSelect.js +123 -78
  163. package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
  164. package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
  165. package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
  166. package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
  167. package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
  168. package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
  169. package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
  170. package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
  171. package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
  172. package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
  173. package/dist/components/OTPInput/OTPInput.cjs +1 -1
  174. package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
  175. package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
  176. package/dist/components/OTPInput/OTPInput.const.js +14 -0
  177. package/dist/components/OTPInput/OTPInput.js +99 -65
  178. package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
  179. package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
  180. package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
  181. package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
  182. package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
  183. package/dist/components/PhoneInput/PhoneInput.js +88 -83
  184. package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
  185. package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
  186. package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
  187. package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
  188. package/dist/components/Popconfirm/Popconfirm.js +71 -51
  189. package/dist/components/Popover/Popover.cjs +1 -1
  190. package/dist/components/Popover/Popover.js +36 -31
  191. package/dist/components/Portal/Portal.cjs +1 -1
  192. package/dist/components/Portal/Portal.d.ts +0 -3
  193. package/dist/components/Portal/Portal.js +4 -10
  194. package/dist/components/Select/Select.cjs +1 -1
  195. package/dist/components/Select/Select.js +71 -51
  196. package/dist/components/Stepper/Stepper.cjs +1 -1
  197. package/dist/components/Stepper/Stepper.const.cjs +1 -1
  198. package/dist/components/Stepper/Stepper.const.d.ts +26 -4
  199. package/dist/components/Stepper/Stepper.const.js +39 -20
  200. package/dist/components/Stepper/Stepper.d.ts +3 -10
  201. package/dist/components/Stepper/Stepper.js +189 -130
  202. package/dist/components/Stepper/Stepper.types.d.ts +14 -0
  203. package/dist/components/Stepper/Stepper.utils.cjs +1 -0
  204. package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
  205. package/dist/components/Stepper/Stepper.utils.js +19 -0
  206. package/dist/components/Stepper/components/StepperControls.cjs +1 -0
  207. package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
  208. package/dist/components/Stepper/components/StepperControls.js +32 -0
  209. package/dist/components/Stepper/index.d.ts +2 -1
  210. package/dist/components/Tabs/TabList.cjs +1 -1
  211. package/dist/components/Tabs/TabList.js +72 -57
  212. package/dist/components/Tabs/Tabs.types.d.ts +4 -2
  213. package/dist/components/Tabs/index.d.ts +2 -2
  214. package/dist/components/TagCloud/TagCloud.cjs +1 -0
  215. package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
  216. package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
  217. package/dist/components/TagCloud/TagCloud.const.js +8 -0
  218. package/dist/components/TagCloud/TagCloud.d.ts +3 -0
  219. package/dist/components/TagCloud/TagCloud.js +76 -0
  220. package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
  221. package/dist/components/TagCloud/index.d.ts +2 -0
  222. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
  223. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
  224. package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
  225. package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
  226. package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
  227. package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
  228. package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
  229. package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
  230. package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
  231. package/dist/components/TimelineChart/TimelineChart.js +65 -0
  232. package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
  233. package/dist/components/TimelineChart/index.d.ts +2 -0
  234. package/dist/components/Toast/Toast.cjs +1 -1
  235. package/dist/components/Toast/Toast.js +86 -82
  236. package/dist/components/Toast/Toast.types.d.ts +2 -0
  237. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  238. package/dist/components/Tooltip/Tooltip.js +52 -44
  239. package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
  240. package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
  241. package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
  242. package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
  243. package/dist/components/TreeSelect/TreeSelect.js +120 -88
  244. package/dist/components/Watermark/Watermark.cjs +1 -1
  245. package/dist/components/Watermark/Watermark.const.cjs +1 -1
  246. package/dist/components/Watermark/Watermark.const.d.ts +6 -3
  247. package/dist/components/Watermark/Watermark.const.js +13 -11
  248. package/dist/components/Watermark/Watermark.js +87 -61
  249. package/dist/components/Watermark/Watermark.types.d.ts +2 -0
  250. package/dist/components/index.cjs +1 -1
  251. package/dist/components/index.d.ts +22 -4
  252. package/dist/components/index.js +319 -296
  253. package/dist/hooks/index.cjs +1 -1
  254. package/dist/hooks/index.d.ts +1 -1
  255. package/dist/hooks/index.js +55 -54
  256. package/dist/hooks/useClickOutside.cjs +1 -1
  257. package/dist/hooks/useClickOutside.d.ts +4 -11
  258. package/dist/hooks/useClickOutside.js +26 -7
  259. package/dist/index.cjs +1 -1
  260. package/dist/index.js +412 -388
  261. package/dist/styles/_effects.css +32 -0
  262. package/dist/styles.css +1 -1
  263. package/dist/utils/maxVisible.utils.cjs +1 -0
  264. package/dist/utils/maxVisible.utils.d.ts +12 -0
  265. package/dist/utils/maxVisible.utils.js +15 -0
  266. package/package.json +1 -1
  267. package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
  268. 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,2 @@
1
+ export { GlowCard } from './GlowCard';
2
+ export type { GlowCardProps, GlowEffect } from './GlowCard.types';
@@ -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,3 @@
1
+ import { FC } from 'react';
2
+ import { HeatmapProps } from './Heatmap.types';
3
+ export declare const Heatmap: FC<HeatmapProps>;
@@ -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,2 @@
1
+ export declare function getWeeks(start: Date, end: Date): Date[][];
2
+ export declare function toKey(d: Date): string;
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ export { Heatmap } from './Heatmap';
2
+ export type { HeatmapProps, HeatmapCell } from './Heatmap.types';
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("react"),u=require("./HoverCard.utils.cjs"),c=t.forwardRef(({children:l,cardContent:d,side:o="bottom",align:b="center",openDelay:m=200,closeDelay:v=300,arrow:f=!0,className:g="",...p},y)=>{const[h,a]=t.useState(!1),e=t.useRef(),r=t.useRef(),n=()=>{r.current&&clearTimeout(r.current),e.current=setTimeout(()=>{a(!0)},m)},i=()=>{e.current&&clearTimeout(e.current),r.current=setTimeout(()=>{a(!1)},v)};return t.useEffect(()=>()=>{e.current&&clearTimeout(e.current),r.current&&clearTimeout(r.current)},[]),s.jsxs("div",{ref:y,className:`bear-hover-card relative inline-block ${g}`.trim(),onMouseEnter:n,onMouseLeave:i,...p,children:[l,s.jsx("div",{className:`
2
- absolute z-50 w-72
3
- ${u.getSideClasses(o,b)}
4
- transition-all duration-200
5
- ${h?"opacity-100 visible scale-100":"opacity-0 invisible scale-95 pointer-events-none"}
6
- `,onMouseEnter:n,onMouseLeave:i,children:s.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 p-4",children:[f&&s.jsx("div",{className:`absolute w-3 h-3 bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 ${u.getArrowClasses(o)}`,style:{borderWidth:o==="top"||o==="left"?"0 1px 1px 0":"1px 0 0 1px"}}),d]})})]})});c.displayName="HoverCard";exports.HoverCard=c;
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 n, jsx as i } from "react/jsx-runtime";
2
- import { forwardRef as y, useState as x, useRef as c, useEffect as T } from "react";
3
- import { getArrowClasses as w, getSideClasses as M } from "./HoverCard.utils.js";
4
- const k = y(({
5
- children: u,
6
- cardContent: l,
7
- side: t = "bottom",
8
- align: d = "center",
9
- openDelay: m = 200,
10
- closeDelay: b = 300,
11
- arrow: f = !0,
12
- className: p = "",
13
- ...v
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
- return T(() => () => {
25
- e.current && clearTimeout(e.current), r.current && clearTimeout(r.current);
26
- }, []), /* @__PURE__ */ n(
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: g,
30
- className: `bear-hover-card relative inline-block ${p}`.trim(),
31
- onMouseEnter: a,
32
- onMouseLeave: s,
33
- ...v,
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
- u,
36
- /* @__PURE__ */ i(
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
- absolute z-50 w-72
41
- ${M(t, d)}
42
- transition-all duration-200
43
- ${h ? "opacity-100 visible scale-100" : "opacity-0 invisible scale-95 pointer-events-none"}
44
- `,
45
- onMouseEnter: a,
46
- onMouseLeave: s,
47
- children: /* @__PURE__ */ n("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 p-4", 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
- k.displayName = "HoverCard";
83
+ I.displayName = "HoverCard";
66
84
  export {
67
- k as HoverCard
85
+ I as HoverCard
68
86
  };
@@ -1,4 +1,4 @@
1
- import { jsx as c, jsxs as e } from "react/jsx-runtime";
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;
@@ -0,0 +1,3 @@
1
+ export declare const DEFAULT_PIN_COLOR = "#ec4899";
2
+ export declare const DEFAULT_PIN_SIZE = 24;
3
+ export declare const PIN_ICON_RATIO = 0.6;
@@ -0,0 +1,6 @@
1
+ const I = "#ec4899", _ = 24, c = 0.6;
2
+ export {
3
+ I as DEFAULT_PIN_COLOR,
4
+ _ as DEFAULT_PIN_SIZE,
5
+ c as PIN_ICON_RATIO
6
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { ImageAnnotationProps } from './ImageAnnotation.types';
3
+ export declare const ImageAnnotation: FC<ImageAnnotationProps>;