@forgedevstack/bear 1.1.9 → 1.2.1

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 (230) hide show
  1. package/README.md +4 -0
  2. package/dist/components/AlertDialog/AlertDialog.cjs +1 -1
  3. package/dist/components/AlertDialog/AlertDialog.const.cjs +1 -1
  4. package/dist/components/AlertDialog/AlertDialog.const.d.ts +2 -2
  5. package/dist/components/AlertDialog/AlertDialog.const.js +4 -4
  6. package/dist/components/AlertDialog/AlertDialog.js +76 -62
  7. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  8. package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
  9. package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
  10. package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
  11. package/dist/components/Autocomplete/Autocomplete.js +110 -72
  12. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  13. package/dist/components/BottomSheet/BottomSheet.js +74 -53
  14. package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
  15. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
  16. package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
  17. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
  18. package/dist/components/Breadcrumbs/index.d.ts +1 -1
  19. package/dist/components/Calendar/Calendar.cjs +1 -1
  20. package/dist/components/Calendar/Calendar.js +3 -2
  21. package/dist/components/Cascader/Cascader.cjs +1 -1
  22. package/dist/components/Cascader/Cascader.const.cjs +1 -1
  23. package/dist/components/Cascader/Cascader.const.d.ts +1 -1
  24. package/dist/components/Cascader/Cascader.const.js +1 -1
  25. package/dist/components/Cascader/Cascader.js +109 -146
  26. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
  27. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
  28. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
  29. package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
  30. package/dist/components/Chart/BarChart.cjs +1 -0
  31. package/dist/components/Chart/BarChart.d.ts +3 -0
  32. package/dist/components/Chart/BarChart.js +65 -0
  33. package/dist/components/Chart/Chart.cjs +1 -1
  34. package/dist/components/Chart/Chart.const.cjs +1 -1
  35. package/dist/components/Chart/Chart.const.d.ts +7 -0
  36. package/dist/components/Chart/Chart.const.js +12 -2
  37. package/dist/components/Chart/Chart.d.ts +1 -13
  38. package/dist/components/Chart/Chart.js +18 -204
  39. package/dist/components/Chart/Chart.types.d.ts +7 -1
  40. package/dist/components/Chart/LineChart.cjs +1 -0
  41. package/dist/components/Chart/LineChart.d.ts +3 -0
  42. package/dist/components/Chart/LineChart.js +73 -0
  43. package/dist/components/Chart/PieChart.cjs +1 -0
  44. package/dist/components/Chart/PieChart.d.ts +3 -0
  45. package/dist/components/Chart/PieChart.js +110 -0
  46. package/dist/components/Chart/index.d.ts +4 -1
  47. package/dist/components/CloseButton/CloseButton.cjs +1 -0
  48. package/dist/components/CloseButton/CloseButton.d.ts +4 -0
  49. package/dist/components/CloseButton/CloseButton.js +60 -0
  50. package/dist/components/CloseButton/CloseButton.types.d.ts +15 -0
  51. package/dist/components/CloseButton/index.d.ts +2 -0
  52. package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
  53. package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
  54. package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
  55. package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
  56. package/dist/components/ColorPicker/ColorPicker.js +135 -73
  57. package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
  58. package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
  59. package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
  60. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  61. package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
  62. package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
  63. package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
  64. package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
  65. package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
  66. package/dist/components/CreditInput/CreditInput.cjs +1 -1
  67. package/dist/components/CreditInput/CreditInput.js +80 -78
  68. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  69. package/dist/components/DatePicker/DatePicker.js +12 -11
  70. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  71. package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
  72. package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
  73. package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
  74. package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
  75. package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
  76. package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
  77. package/dist/components/DiffSquares/DiffSquares.js +70 -0
  78. package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
  79. package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
  80. package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
  81. package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
  82. package/dist/components/DiffSquares/index.d.ts +2 -0
  83. package/dist/components/Drawer/Drawer.cjs +1 -1
  84. package/dist/components/Drawer/Drawer.js +41 -41
  85. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  86. package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
  87. package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
  88. package/dist/components/Dropdown/Dropdown.const.js +10 -0
  89. package/dist/components/Dropdown/Dropdown.d.ts +0 -1
  90. package/dist/components/Dropdown/Dropdown.js +102 -92
  91. package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
  92. package/dist/components/Gauge/Gauge.cjs +1 -1
  93. package/dist/components/Gauge/Gauge.js +61 -50
  94. package/dist/components/Gauge/Gauge.types.d.ts +2 -0
  95. package/dist/components/HoverCard/HoverCard.cjs +6 -6
  96. package/dist/components/HoverCard/HoverCard.js +72 -54
  97. package/dist/components/Icon/icons/commerce.cjs +1 -0
  98. package/dist/components/Icon/icons/commerce.d.ts +25 -0
  99. package/dist/components/Icon/icons/commerce.js +124 -0
  100. package/dist/components/Icon/icons/device.cjs +1 -0
  101. package/dist/components/Icon/icons/device.d.ts +27 -0
  102. package/dist/components/Icon/icons/device.js +122 -0
  103. package/dist/components/Icon/icons/file.cjs +1 -0
  104. package/dist/components/Icon/icons/file.d.ts +25 -0
  105. package/dist/components/Icon/icons/file.js +120 -0
  106. package/dist/components/Icon/icons/social.cjs +1 -0
  107. package/dist/components/Icon/icons/social.d.ts +24 -0
  108. package/dist/components/Icon/icons/social.js +89 -0
  109. package/dist/components/Icon/icons/status.js +1 -1
  110. package/dist/components/Icon/index.cjs +1 -1
  111. package/dist/components/Icon/index.d.ts +93 -56
  112. package/dist/components/Icon/index.js +38 -26
  113. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  114. package/dist/components/MentionsInput/MentionsInput.js +106 -83
  115. package/dist/components/Menu/Menu.cjs +1 -1
  116. package/dist/components/Menu/Menu.js +91 -80
  117. package/dist/components/Modal/Modal.cjs +1 -1
  118. package/dist/components/Modal/Modal.const.cjs +1 -1
  119. package/dist/components/Modal/Modal.const.d.ts +1 -1
  120. package/dist/components/Modal/Modal.const.js +1 -1
  121. package/dist/components/Modal/Modal.js +50 -44
  122. package/dist/components/Modal/Modal.types.d.ts +6 -0
  123. package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
  124. package/dist/components/MultiSelect/MultiSelect.js +123 -78
  125. package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
  126. package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
  127. package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
  128. package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
  129. package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
  130. package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
  131. package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
  132. package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
  133. package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
  134. package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
  135. package/dist/components/OTPInput/OTPInput.cjs +1 -1
  136. package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
  137. package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
  138. package/dist/components/OTPInput/OTPInput.const.js +14 -0
  139. package/dist/components/OTPInput/OTPInput.js +99 -65
  140. package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
  141. package/dist/components/Overlay/Overlay.cjs +1 -0
  142. package/dist/components/Overlay/Overlay.d.ts +4 -0
  143. package/dist/components/Overlay/Overlay.js +38 -0
  144. package/dist/components/Overlay/Overlay.types.d.ts +23 -0
  145. package/dist/components/Overlay/index.d.ts +2 -0
  146. package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
  147. package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
  148. package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
  149. package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
  150. package/dist/components/PhoneInput/PhoneInput.js +88 -83
  151. package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
  152. package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
  153. package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
  154. package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
  155. package/dist/components/Popconfirm/Popconfirm.js +71 -51
  156. package/dist/components/Popover/Popover.cjs +1 -1
  157. package/dist/components/Popover/Popover.js +36 -31
  158. package/dist/components/Portal/Portal.cjs +1 -0
  159. package/dist/components/Portal/Portal.d.ts +8 -0
  160. package/dist/components/Portal/Portal.js +6 -0
  161. package/dist/components/Portal/index.d.ts +2 -0
  162. package/dist/components/Select/Select.cjs +1 -1
  163. package/dist/components/Select/Select.js +71 -51
  164. package/dist/components/Stepper/Stepper.cjs +1 -1
  165. package/dist/components/Stepper/Stepper.const.cjs +1 -1
  166. package/dist/components/Stepper/Stepper.const.d.ts +3 -2
  167. package/dist/components/Stepper/Stepper.const.js +15 -14
  168. package/dist/components/Stepper/Stepper.d.ts +0 -7
  169. package/dist/components/Stepper/Stepper.js +164 -117
  170. package/dist/components/Stepper/Stepper.types.d.ts +3 -0
  171. package/dist/components/Tabs/TabList.cjs +1 -1
  172. package/dist/components/Tabs/TabList.js +72 -57
  173. package/dist/components/Tabs/Tabs.types.d.ts +4 -2
  174. package/dist/components/Tabs/index.d.ts +2 -2
  175. package/dist/components/ThemeIcon/ThemeIcon.cjs +1 -0
  176. package/dist/components/ThemeIcon/ThemeIcon.d.ts +4 -0
  177. package/dist/components/ThemeIcon/ThemeIcon.js +54 -0
  178. package/dist/components/ThemeIcon/ThemeIcon.types.d.ts +22 -0
  179. package/dist/components/ThemeIcon/index.d.ts +2 -0
  180. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
  181. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
  182. package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
  183. package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
  184. package/dist/components/Toast/Toast.cjs +1 -1
  185. package/dist/components/Toast/Toast.js +86 -82
  186. package/dist/components/Toast/Toast.types.d.ts +2 -0
  187. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  188. package/dist/components/Tooltip/Tooltip.js +52 -44
  189. package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
  190. package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
  191. package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
  192. package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
  193. package/dist/components/TreeSelect/TreeSelect.js +120 -88
  194. package/dist/components/VisuallyHidden/VisuallyHidden.cjs +1 -0
  195. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +6 -0
  196. package/dist/components/VisuallyHidden/VisuallyHidden.js +22 -0
  197. package/dist/components/VisuallyHidden/index.d.ts +2 -0
  198. package/dist/components/Watermark/Watermark.cjs +1 -1
  199. package/dist/components/Watermark/Watermark.const.cjs +1 -1
  200. package/dist/components/Watermark/Watermark.const.d.ts +6 -3
  201. package/dist/components/Watermark/Watermark.const.js +13 -11
  202. package/dist/components/Watermark/Watermark.js +87 -61
  203. package/dist/components/Watermark/Watermark.types.d.ts +2 -0
  204. package/dist/components/index.cjs +1 -1
  205. package/dist/components/index.d.ts +15 -3
  206. package/dist/components/index.js +296 -280
  207. package/dist/hooks/bearStyled.cjs +1 -1
  208. package/dist/hooks/bearStyled.d.ts +31 -9
  209. package/dist/hooks/bearStyled.js +17 -12
  210. package/dist/hooks/index.cjs +1 -1
  211. package/dist/hooks/index.d.ts +1 -1
  212. package/dist/hooks/index.js +55 -54
  213. package/dist/hooks/useClickOutside.cjs +1 -1
  214. package/dist/hooks/useClickOutside.d.ts +4 -11
  215. package/dist/hooks/useClickOutside.js +26 -7
  216. package/dist/hooks/useMediaQuery/useMediaQuery.d.ts +9 -1
  217. package/dist/hooks/useResponsive.cjs +1 -1
  218. package/dist/hooks/useResponsive.d.ts +2 -17
  219. package/dist/hooks/useResponsive.js +47 -41
  220. package/dist/index.cjs +1 -1
  221. package/dist/index.js +383 -366
  222. package/dist/styles/_effects.css +26 -0
  223. package/dist/styles.css +1 -1
  224. package/dist/types/theme.types.d.ts +1 -0
  225. package/dist/utils/maxVisible.utils.cjs +1 -0
  226. package/dist/utils/maxVisible.utils.d.ts +12 -0
  227. package/dist/utils/maxVisible.utils.js +15 -0
  228. package/package.json +1 -1
  229. package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
  230. package/dist/components/HoverCard/HoverCard.utils.js +0 -23
@@ -16,4 +16,3 @@ import { DropdownProps } from './Dropdown.types';
16
16
  * ```
17
17
  */
18
18
  export declare const Dropdown: FC<DropdownProps>;
19
- export default Dropdown;
@@ -1,86 +1,93 @@
1
- import { jsxs as I, jsx as o } from "react/jsx-runtime";
2
- import { useState as D, useRef as v, useCallback as c, useEffect as S, isValidElement as q, cloneElement as G } from "react";
3
- import { cn as h } from "../../utils/cn.js";
4
- import { useClickOutside as H } from "../../hooks/useClickOutside.js";
1
+ import { jsxs as j, jsx as o } from "react/jsx-runtime";
2
+ import { useState as m, useRef as E, useCallback as u, useEffect as I, useMemo as $, isValidElement as O, cloneElement as ee } from "react";
3
+ import { cn as C } from "../../utils/cn.js";
4
+ import { useClickOutsideMultiple as re } from "../../hooks/useClickOutside.js";
5
5
  import "../../context/BearProvider.js";
6
6
  import "../../hooks/useBearComponent/useBearComponent.js";
7
- const J = {
8
- xs: "bear-text-xs bear-py-1 bear-px-2",
9
- sm: "bear-text-sm bear-py-1.5 bear-px-3",
10
- md: "bear-text-sm bear-py-2 bear-px-3",
11
- lg: "bear-text-base bear-py-2.5 bear-px-4",
12
- xl: "bear-text-lg bear-py-3 bear-px-5"
13
- }, Q = {
14
- "bottom-start": "bear-top-full bear-left-0 bear-mt-1",
15
- "bottom-end": "bear-top-full bear-right-0 bear-mt-1",
16
- bottom: "bear-top-full bear-left-1/2 -bear-translate-x-1/2 bear-mt-1",
17
- "top-start": "bear-bottom-full bear-left-0 bear-mb-1",
18
- "top-end": "bear-bottom-full bear-right-0 bear-mb-1",
19
- top: "bear-bottom-full bear-left-1/2 -bear-translate-x-1/2 bear-mb-1",
20
- left: "bear-right-full bear-top-0 bear-mr-1",
21
- right: "bear-left-full bear-top-0 bear-ml-1"
22
- }, te = ({
23
- trigger: p,
24
- items: i,
25
- open: y,
26
- defaultOpen: A = !1,
27
- placement: L = "bottom-start",
28
- offset: X = 4,
29
- matchWidth: R = !1,
30
- minWidth: j = 150,
31
- maxHeight: W = 300,
32
- size: z = "md",
33
- closeOnSelect: g = !0,
34
- closeOnClickOutside: k = !0,
35
- disabled: w = !1,
7
+ import { Portal as te } from "../Portal/Portal.js";
8
+ import { SIZE_CLASSES as ae } from "./Dropdown.const.js";
9
+ const pe = ({
10
+ trigger: v,
11
+ items: d,
12
+ open: L,
13
+ defaultOpen: z = !1,
14
+ placement: i = "bottom-start",
15
+ offset: x = 4,
16
+ matchWidth: N = !1,
17
+ minWidth: h = 150,
18
+ maxHeight: A = 300,
19
+ size: U = "md",
20
+ closeOnSelect: D = !0,
21
+ closeOnClickOutside: g = !0,
22
+ disabled: M = !1,
36
23
  onOpenChange: f,
37
- className: F,
38
- testId: M,
39
- ..._
24
+ className: B,
25
+ testId: F,
26
+ ...K
40
27
  }) => {
41
- var C;
42
- const [B, K] = D(A), [n, s] = D(-1), E = v(null), P = v(null), N = v(null), x = y !== void 0, a = x ? y : B, u = c((e) => {
43
- x || K(e), f == null || f(e);
44
- }, [x, f]), T = c(() => {
45
- w || u(!a);
46
- }, [w, a, u]), l = c(() => {
47
- u(!1), s(-1);
48
- }, [u]), m = c((e) => {
49
- var t;
50
- e.disabled || e.divider || e.header || ((t = e.onClick) == null || t.call(e), g && !e.items && l());
51
- }, [g, l]), U = c(() => {
52
- a && k && l();
53
- }, [a, k, l]);
54
- H(E, U), S(() => {
28
+ const [T, V] = m(z), [b, c] = m(-1), [w, Z] = m({ top: 0, left: 0, minWidth: h }), R = E(null), W = E(null), P = E(null), y = L !== void 0, a = y ? L : T, p = u((e) => {
29
+ y || V(e), f == null || f(e);
30
+ }, [y, f]), _ = u(() => {
31
+ M || p(!a);
32
+ }, [M, a, p]), l = u(() => {
33
+ p(!1), c(-1);
34
+ }, [p]), k = u((e) => {
35
+ var r;
36
+ e.disabled || e.divider || e.header || ((r = e.onClick) == null || r.call(e), D && !e.items && l());
37
+ }, [D, l]), q = u(() => {
38
+ a && g && l();
39
+ }, [a, g, l]);
40
+ re([R, W], q, {
41
+ enabled: a && g
42
+ }), I(() => {
55
43
  if (!a) return;
56
- const e = i.filter((r) => !r.disabled && !r.divider && !r.header), t = (r) => {
57
- switch (r.key) {
44
+ const e = d.filter((t) => !t.disabled && !t.divider && !t.header), r = (t) => {
45
+ switch (t.key) {
58
46
  case "Escape":
59
- r.preventDefault(), l();
47
+ t.preventDefault(), l();
60
48
  break;
61
49
  case "ArrowDown":
62
- r.preventDefault(), s((d) => {
63
- const b = d + 1;
64
- return b >= e.length ? 0 : b;
50
+ t.preventDefault(), c((n) => {
51
+ const s = n + 1;
52
+ return s >= e.length ? 0 : s;
65
53
  });
66
54
  break;
67
55
  case "ArrowUp":
68
- r.preventDefault(), s((d) => {
69
- const b = d - 1;
70
- return b < 0 ? e.length - 1 : b;
56
+ t.preventDefault(), c((n) => {
57
+ const s = n - 1;
58
+ return s < 0 ? e.length - 1 : s;
71
59
  });
72
60
  break;
73
61
  case "Enter":
74
62
  case " ":
75
- r.preventDefault(), n >= 0 && n < e.length && m(e[n]);
63
+ t.preventDefault(), b >= 0 && b < e.length && k(e[b]);
76
64
  break;
77
65
  }
78
66
  };
79
- return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
80
- }, [a, i, n, l, m]), S(() => {
81
- a || s(-1);
67
+ return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
68
+ }, [a, d, b, l, k]), I(() => {
69
+ if (!a) return;
70
+ const e = () => {
71
+ var S;
72
+ const r = (S = P.current) == null ? void 0 : S.getBoundingClientRect();
73
+ if (!r) return;
74
+ const t = window.innerWidth, n = N ? r.width : h, Q = i.endsWith("end") ? r.right - n : i === "top" || i === "bottom" ? r.left + r.width / 2 - n / 2 : r.left, X = Math.min(Math.max(8, Q), Math.max(8, t - n - 8)), Y = i.startsWith("top") ? r.top - x : r.bottom + x;
75
+ Z({
76
+ top: Y,
77
+ left: X,
78
+ minWidth: n
79
+ });
80
+ };
81
+ return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
82
+ window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
83
+ };
84
+ }, [a, N, h, i, x]), I(() => {
85
+ a || c(-1);
82
86
  }, [a]);
83
- const V = (e, t) => {
87
+ const G = $(
88
+ () => d.map((e, r) => ({ item: e, index: r })).filter(({ item: e }) => !e.disabled && !e.divider && !e.header),
89
+ [d]
90
+ ), H = (e, r) => {
84
91
  if (e.divider)
85
92
  return /* @__PURE__ */ o(
86
93
  "div",
@@ -101,20 +108,21 @@ const J = {
101
108
  },
102
109
  e.key
103
110
  );
104
- const r = i.slice(0, t).filter((b) => !b.disabled && !b.divider && !b.header).length, d = n === r;
105
- return /* @__PURE__ */ I(
111
+ const t = G.findIndex((s) => s.index === r), n = b === t;
112
+ return /* @__PURE__ */ j(
106
113
  "button",
107
114
  {
108
115
  type: "button",
109
116
  role: "menuitem",
110
117
  disabled: e.disabled,
111
- onClick: () => m(e),
112
- onMouseEnter: () => s(r),
113
- className: h(
118
+ onClick: () => k(e),
119
+ onMouseEnter: () => c(t),
120
+ className: C(
114
121
  "bear-w-full bear-flex bear-items-center bear-gap-2 bear-text-left bear-border-none bear-bg-transparent",
115
- J[z],
122
+ ae[U],
116
123
  "bear-transition-colors bear-cursor-pointer",
117
- d && !e.danger && "bear-bg-[var(--bear-bg-tertiary)]",
124
+ e.selected && !e.danger && "bear-bg-[var(--bear-bg-tertiary)] bear-text-[var(--bear-text-primary)]",
125
+ n && !e.danger && "bear-bg-[var(--bear-bg-tertiary)]",
118
126
  e.danger && "bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-50 dark:hover:bear-bg-red-900/20",
119
127
  !e.danger && !e.disabled && "hover:bear-bg-[var(--bear-bg-tertiary)]",
120
128
  e.disabled && "bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none"
@@ -129,46 +137,48 @@ const J = {
129
137
  },
130
138
  e.key
131
139
  );
132
- }, Z = q(p) ? G(p, {
133
- onClick: T,
134
- ref: N,
140
+ }, J = O(v) ? ee(v, {
141
+ onClick: _,
142
+ ref: P,
135
143
  "aria-expanded": a,
136
144
  "aria-haspopup": !0
137
- }) : p;
138
- return /* @__PURE__ */ I(
145
+ }) : v;
146
+ return /* @__PURE__ */ j(
139
147
  "div",
140
148
  {
141
- ref: E,
142
- className: h("bear-relative bear-inline-block", F),
143
- "data-testid": M,
144
- ..._,
149
+ ref: R,
150
+ className: C("bear-relative bear-inline-block", B),
151
+ "data-testid": F,
152
+ ...K,
145
153
  children: [
146
- Z,
147
- a && /* @__PURE__ */ o(
154
+ J,
155
+ a && /* @__PURE__ */ o(te, { children: /* @__PURE__ */ o(
148
156
  "div",
149
157
  {
150
- ref: P,
158
+ ref: W,
151
159
  role: "menu",
152
- className: h(
153
- "bear-absolute bear-z-50",
160
+ className: C(
161
+ "bear-fixed",
154
162
  "bear-border bear-rounded-lg bear-shadow-lg",
155
163
  "bear-py-1 bear-overflow-y-auto",
156
- "bear-animate-in bear-fade-in-0 bear-zoom-in-95 bear-duration-100",
157
- Q[L]
164
+ "bear-duration-100"
158
165
  ),
159
166
  style: {
160
167
  backgroundColor: "var(--bear-bg-primary)",
161
168
  borderColor: "var(--bear-border-default)",
162
- minWidth: R ? (C = N.current) == null ? void 0 : C.offsetWidth : j,
163
- maxHeight: W
169
+ minWidth: w.minWidth,
170
+ maxHeight: A,
171
+ top: w.top,
172
+ left: w.left,
173
+ zIndex: 11e3
164
174
  },
165
- children: i.map((e, t) => V(e, t))
175
+ children: d.map((e, r) => H(e, r))
166
176
  }
167
- )
177
+ ) })
168
178
  ]
169
179
  }
170
180
  );
171
181
  };
172
182
  export {
173
- te as Dropdown
183
+ pe as Dropdown
174
184
  };
@@ -17,6 +17,8 @@ export interface DropdownItem {
17
17
  header?: boolean;
18
18
  /** Danger/destructive action */
19
19
  danger?: boolean;
20
+ /** Selected/active visual state */
21
+ selected?: boolean;
20
22
  /** Click handler */
21
23
  onClick?: () => void;
22
24
  /** Nested items for submenu */
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),o=require("../../utils/cn.cjs"),C=({value:a,min:r=0,max:l=100,size:i=120,strokeWidth:t=10,color:y="#ec4899",trackColor:j,showLabel:g=!0,label:p,animated:k=!0,arcAngle:n=270,gradient:s,className:M,...N})=>{const f=h.useId(),{percentage:v,circumference:u,offset:b,startAngle:x}=h.useMemo(()=>{const m=Math.min(Math.max((a-r)/(l-r)*100,0),100),w=50-t/2,c=2*Math.PI*w*(n/360),D=c-m/100*c,q=90+(360-n)/2;return{percentage:m,circumference:c,offset:D,startAngle:q}},[a,r,l,n,t]),d=50-t/2;return e.jsxs("div",{className:o.cn("relative inline-flex items-center justify-center",M),style:{width:i,height:i},...N,children:[e.jsxs("svg",{viewBox:"0 0 100 100",className:"w-full h-full -rotate-90",children:[e.jsx("defs",{children:s&&e.jsxs("linearGradient",{id:f,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[e.jsx("stop",{offset:"0%",stopColor:s[0]}),e.jsx("stop",{offset:"100%",stopColor:s[1]})]})}),e.jsx("circle",{cx:"50",cy:"50",r:d,fill:"none",stroke:j||"currentColor",strokeWidth:t,strokeLinecap:"round",strokeDasharray:u,strokeDashoffset:0,className:o.cn("text-gray-200 dark:text-slate-700"),style:{transformOrigin:"center",transform:`rotate(${x}deg)`}}),e.jsx("circle",{cx:"50",cy:"50",r:d,fill:"none",stroke:s?`url(#${f})`:y,strokeWidth:t,strokeLinecap:"round",strokeDasharray:u,strokeDashoffset:b,className:o.cn(k&&"transition-all duration-1000 ease-out"),style:{transformOrigin:"center",transform:`rotate(${x}deg)`}})]}),g&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:p||e.jsxs("span",{className:"text-2xl font-semibold text-gray-800 dark:text-white",children:[Math.round(v),"%"]})})]})};exports.Gauge=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),g=require("../../utils/cn.cjs"),F=({value:x,min:a=0,max:d=100,size:h=120,strokeWidth:s=10,color:p="#ec4899",trackColor:v,showLabel:k=!0,label:b,animated:t=!0,fillDurationMs:D=900,arcAngle:f=270,gradient:n,className:M,...N})=>{const m=i.useId(),{percentage:O,circumference:r,offset:o,startAngle:y}=i.useMemo(()=>{const c=Math.min(Math.max((x-a)/(d-a)*100,0),100),w=50-s/2,u=2*Math.PI*w*(f/360),$=u-c/100*u,C=90+(360-f)/2;return{percentage:c,circumference:u,offset:$,startAngle:C}},[x,a,d,f,s]),[q,l]=i.useState(()=>t?r:o);i.useLayoutEffect(()=>{if(!t){l(o);return}l(r);const c=requestAnimationFrame(()=>l(o));return()=>cancelAnimationFrame(c)},[t,r,o]);const j=50-s/2;return e.jsxs("div",{className:g.cn("relative inline-flex items-center justify-center",M),style:{width:h,height:h},...N,children:[e.jsxs("svg",{viewBox:"0 0 100 100",className:"h-full w-full -rotate-90",children:[e.jsx("defs",{children:n&&e.jsxs("linearGradient",{id:m,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[e.jsx("stop",{offset:"0%",stopColor:n[0]}),e.jsx("stop",{offset:"100%",stopColor:n[1]})]})}),e.jsx("circle",{cx:"50",cy:"50",r:j,fill:"none",stroke:v||"currentColor",strokeWidth:s,strokeLinecap:"round",strokeDasharray:r,strokeDashoffset:0,className:g.cn("text-gray-200 dark:text-slate-700"),style:{transformOrigin:"center",transform:`rotate(${y}deg)`}}),e.jsx("circle",{cx:"50",cy:"50",r:j,fill:"none",stroke:n?`url(#${m})`:p,strokeWidth:s,strokeLinecap:"round",strokeDasharray:r,strokeDashoffset:q,style:{transformOrigin:"center",transform:`rotate(${y}deg)`,transitionProperty:t?"stroke-dashoffset":void 0,transitionDuration:t?`${D}ms`:void 0,transitionTimingFunction:t?"cubic-bezier(0.4, 0, 0.2, 1)":void 0}})]}),k&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:b||e.jsxs("span",{className:"text-2xl font-semibold text-gray-800 dark:text-white",children:[Math.round(O),"%"]})})]})};exports.Gauge=F;
@@ -1,86 +1,97 @@
1
- import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
- import { useId as $, useMemo as b } from "react";
3
- import { cn as c } from "../../utils/cn.js";
4
- const B = ({
5
- value: l,
6
- min: o = 0,
7
- max: i = 100,
8
- size: f = 120,
9
- strokeWidth: t = 10,
10
- color: p = "#ec4899",
11
- trackColor: y,
12
- showLabel: g = !0,
13
- label: k,
14
- animated: N = !0,
15
- arcAngle: n = 270,
16
- gradient: r,
17
- className: M,
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
+ import { useId as I, useMemo as L, useState as A, useLayoutEffect as G } from "react";
3
+ import { cn as g } from "../../utils/cn.js";
4
+ const E = ({
5
+ value: m,
6
+ min: a = 0,
7
+ max: d = 100,
8
+ size: h = 120,
9
+ strokeWidth: r = 10,
10
+ color: k = "#ec4899",
11
+ trackColor: v,
12
+ showLabel: D = !0,
13
+ label: M,
14
+ animated: e = !0,
15
+ fillDurationMs: N = 900,
16
+ arcAngle: f = 270,
17
+ gradient: o,
18
+ className: b,
18
19
  ...j
19
20
  }) => {
20
- const u = $(), { percentage: v, circumference: m, offset: w, startAngle: d } = b(() => {
21
- const h = Math.min(Math.max((l - o) / (i - o) * 100, 0), 100), D = 50 - t / 2, a = 2 * Math.PI * D * (n / 360), C = a - h / 100 * a, I = 90 + (360 - n) / 2;
21
+ const x = I(), { percentage: w, circumference: s, offset: n, startAngle: p } = L(() => {
22
+ const c = Math.min(Math.max((m - a) / (d - a) * 100, 0), 100), $ = 50 - r / 2, u = 2 * Math.PI * $ * (f / 360), C = u - c / 100 * u, F = 90 + (360 - f) / 2;
22
23
  return {
23
- percentage: h,
24
- circumference: a,
24
+ percentage: c,
25
+ circumference: u,
25
26
  offset: C,
26
- startAngle: I
27
+ startAngle: F
27
28
  };
28
- }, [l, o, i, n, t]), x = 50 - t / 2;
29
- return /* @__PURE__ */ s(
29
+ }, [m, a, d, f, r]), [O, l] = A(() => e ? s : n);
30
+ G(() => {
31
+ if (!e) {
32
+ l(n);
33
+ return;
34
+ }
35
+ l(s);
36
+ const c = requestAnimationFrame(() => l(n));
37
+ return () => cancelAnimationFrame(c);
38
+ }, [e, s, n]);
39
+ const y = 50 - r / 2;
40
+ return /* @__PURE__ */ i(
30
41
  "div",
31
42
  {
32
- className: c("relative inline-flex items-center justify-center", M),
33
- style: { width: f, height: f },
43
+ className: g("relative inline-flex items-center justify-center", b),
44
+ style: { width: h, height: h },
34
45
  ...j,
35
46
  children: [
36
- /* @__PURE__ */ s("svg", { viewBox: "0 0 100 100", className: "w-full h-full -rotate-90", children: [
37
- /* @__PURE__ */ e("defs", { children: r && /* @__PURE__ */ s("linearGradient", { id: u, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
38
- /* @__PURE__ */ e("stop", { offset: "0%", stopColor: r[0] }),
39
- /* @__PURE__ */ e("stop", { offset: "100%", stopColor: r[1] })
47
+ /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "h-full w-full -rotate-90", children: [
48
+ /* @__PURE__ */ t("defs", { children: o && /* @__PURE__ */ i("linearGradient", { id: x, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
49
+ /* @__PURE__ */ t("stop", { offset: "0%", stopColor: o[0] }),
50
+ /* @__PURE__ */ t("stop", { offset: "100%", stopColor: o[1] })
40
51
  ] }) }),
41
- /* @__PURE__ */ e(
52
+ /* @__PURE__ */ t(
42
53
  "circle",
43
54
  {
44
55
  cx: "50",
45
56
  cy: "50",
46
- r: x,
57
+ r: y,
47
58
  fill: "none",
48
- stroke: y || "currentColor",
49
- strokeWidth: t,
59
+ stroke: v || "currentColor",
60
+ strokeWidth: r,
50
61
  strokeLinecap: "round",
51
- strokeDasharray: m,
62
+ strokeDasharray: s,
52
63
  strokeDashoffset: 0,
53
- className: c("text-gray-200 dark:text-slate-700"),
64
+ className: g("text-gray-200 dark:text-slate-700"),
54
65
  style: {
55
66
  transformOrigin: "center",
56
- transform: `rotate(${d}deg)`
67
+ transform: `rotate(${p}deg)`
57
68
  }
58
69
  }
59
70
  ),
60
- /* @__PURE__ */ e(
71
+ /* @__PURE__ */ t(
61
72
  "circle",
62
73
  {
63
74
  cx: "50",
64
75
  cy: "50",
65
- r: x,
76
+ r: y,
66
77
  fill: "none",
67
- stroke: r ? `url(#${u})` : p,
68
- strokeWidth: t,
78
+ stroke: o ? `url(#${x})` : k,
79
+ strokeWidth: r,
69
80
  strokeLinecap: "round",
70
- strokeDasharray: m,
71
- strokeDashoffset: w,
72
- className: c(
73
- N && "transition-all duration-1000 ease-out"
74
- ),
81
+ strokeDasharray: s,
82
+ strokeDashoffset: O,
75
83
  style: {
76
84
  transformOrigin: "center",
77
- transform: `rotate(${d}deg)`
85
+ transform: `rotate(${p}deg)`,
86
+ transitionProperty: e ? "stroke-dashoffset" : void 0,
87
+ transitionDuration: e ? `${N}ms` : void 0,
88
+ transitionTimingFunction: e ? "cubic-bezier(0.4, 0, 0.2, 1)" : void 0
78
89
  }
79
90
  }
80
91
  )
81
92
  ] }),
82
- g && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: k || /* @__PURE__ */ s("span", { className: "text-2xl font-semibold text-gray-800 dark:text-white", children: [
83
- Math.round(v),
93
+ D && /* @__PURE__ */ t("div", { className: "absolute inset-0 flex items-center justify-center", children: M || /* @__PURE__ */ i("span", { className: "text-2xl font-semibold text-gray-800 dark:text-white", children: [
94
+ Math.round(w),
84
95
  "%"
85
96
  ] }) })
86
97
  ]
@@ -88,5 +99,5 @@ const B = ({
88
99
  );
89
100
  };
90
101
  export {
91
- B as Gauge
102
+ E as Gauge
92
103
  };
@@ -20,6 +20,8 @@ export interface GaugeProps extends HTMLAttributes<HTMLDivElement> {
20
20
  label?: ReactNode;
21
21
  /** Animate on render */
22
22
  animated?: boolean;
23
+ /** Fill transition duration in ms when animated */
24
+ fillDurationMs?: number;
23
25
  /** Arc angle (180 for half, 270 for 3/4, 360 for full) */
24
26
  arcAngle?: number;
25
27
  /** Gradient colors [start, end] */
@@ -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
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("../Icon.cjs"),x=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("circle",{cx:"9",cy:"21",r:"1"}),n.jsx("circle",{cx:"20",cy:"21",r:"1"}),n.jsx("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]}),o=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("path",{d:"M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"}),n.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),n.jsx("path",{d:"M16 10a4 4 0 0 1-8 0"})]}),t=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("rect",{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2"}),n.jsx("line",{x1:"1",y1:"10",x2:"23",y2:"10"})]}),h=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),n.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]}),j=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("path",{d:"M4 10h12"}),n.jsx("path",{d:"M4 14h12"}),n.jsx("path",{d:"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12a7.9 7.9 0 0 0 7.8 8 7.7 7.7 0 0 0 5.2-2"})]}),a=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("path",{d:"M4 18h12"}),n.jsx("path",{d:"M4 14h8"}),n.jsx("path",{d:"M17 4a4 4 0 0 0-7.4 2.1L8 18"})]}),e=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("rect",{x:"2",y:"6",width:"20",height:"14",rx:"2"}),n.jsx("path",{d:"M2 10h20"}),n.jsx("path",{d:"M16 14h2"})]}),i=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1-2-1z"}),n.jsx("line",{x1:"8",y1:"8",x2:"16",y2:"8"}),n.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),n.jsx("line",{x1:"8",y1:"16",x2:"12",y2:"16"})]}),l=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),n.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),d=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),n.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"}),n.jsx("path",{d:"M22 7l-8.97 8.97"})]}),r=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("line",{x1:"19",y1:"5",x2:"5",y2:"19"}),n.jsx("circle",{cx:"6.5",cy:"6.5",r:"2.5"}),n.jsx("circle",{cx:"17.5",cy:"17.5",r:"2.5"})]}),p=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),n.jsx("polyline",{points:"17 6 23 6 23 12"})]}),I=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("polyline",{points:"23 18 13.5 8.5 8.5 13.5 1 6"}),n.jsx("polyline",{points:"17 18 23 18 23 12"})]}),y=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("path",{d:"M3 5v14"}),n.jsx("path",{d:"M8 5v14"}),n.jsx("path",{d:"M12 5v14"}),n.jsx("path",{d:"M17 5v14"}),n.jsx("path",{d:"M21 5v14"}),n.jsx("path",{d:"M6 5v14"}),n.jsx("path",{d:"M14 5v14"}),n.jsx("path",{d:"M10 5v14"}),n.jsx("path",{d:"M19 5v14"})]}),M=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("polyline",{points:"20 12 20 22 4 22 4 12"}),n.jsx("rect",{x:"2",y:"7",width:"20",height:"5"}),n.jsx("line",{x1:"12",y1:"22",x2:"12",y2:"7"}),n.jsx("path",{d:"M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z"}),n.jsx("path",{d:"M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z"})]}),v=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("path",{d:"M3 9l1-4h16l1 4"}),n.jsx("path",{d:"M3 9v10a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V9"}),n.jsx("path",{d:"M9 21V12h6v9"}),n.jsx("path",{d:"M3 9a3 3 0 0 0 3 3 3 3 0 0 0 3-3"}),n.jsx("path",{d:"M9 9a3 3 0 0 0 3 3 3 3 0 0 0 3-3"}),n.jsx("path",{d:"M15 9a3 3 0 0 0 3 3 3 3 0 0 0 3-3"})]}),g=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("rect",{x:"1",y:"3",width:"15",height:"13"}),n.jsx("polygon",{points:"16 8 20 8 23 11 23 16 16 16 16 8"}),n.jsx("circle",{cx:"5.5",cy:"18.5",r:"2.5"}),n.jsx("circle",{cx:"18.5",cy:"18.5",r:"2.5"})]}),u=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("line",{x1:"16.5",y1:"9.4",x2:"7.5",y2:"4.21"}),n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),n.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]}),T=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),n.jsx("line",{x1:"8",y1:"17",x2:"12",y2:"17"}),n.jsx("line",{x1:"14",y1:"17",x2:"16",y2:"17"})]}),C=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("rect",{x:"2",y:"7",width:"20",height:"14",rx:"2",ry:"2"}),n.jsx("path",{d:"M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"})]}),S=s=>n.jsxs(c.Icon,{...s,children:[n.jsx("path",{d:"M3 22h18"}),n.jsx("path",{d:"M6 18v-4"}),n.jsx("path",{d:"M10 18v-4"}),n.jsx("path",{d:"M14 18v-4"}),n.jsx("path",{d:"M18 18v-4"}),n.jsx("path",{d:"M3 10l9-7 9 7"}),n.jsx("path",{d:"M3 10h18v4H3z"})]});exports.BankIcon=S;exports.BarCodeIcon=y;exports.BriefcaseIcon=C;exports.CreditCardIcon=t;exports.DollarSignIcon=h;exports.EuroIcon=j;exports.GiftIcon=M;exports.InvoiceIcon=T;exports.PackageIcon=u;exports.PercentIcon=r;exports.PoundIcon=a;exports.ReceiptIcon=i;exports.ShoppingBagIcon=o;exports.ShoppingCartIcon=x;exports.StoreIcon=v;exports.TagIcon=l;exports.TagsIcon=d;exports.TrendDownIcon=I;exports.TrendUpIcon=p;exports.TruckIcon=g;exports.WalletIcon=e;