@forgedevstack/bear 1.2.0 → 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 (178) hide show
  1. package/README.md +4 -0
  2. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  3. package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
  4. package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
  5. package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
  6. package/dist/components/Autocomplete/Autocomplete.js +110 -72
  7. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  8. package/dist/components/BottomSheet/BottomSheet.js +74 -53
  9. package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
  10. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
  11. package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
  12. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
  13. package/dist/components/Breadcrumbs/index.d.ts +1 -1
  14. package/dist/components/Cascader/Cascader.cjs +1 -1
  15. package/dist/components/Cascader/Cascader.const.cjs +1 -1
  16. package/dist/components/Cascader/Cascader.const.d.ts +1 -1
  17. package/dist/components/Cascader/Cascader.const.js +1 -1
  18. package/dist/components/Cascader/Cascader.js +109 -146
  19. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
  20. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
  21. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
  22. package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
  23. package/dist/components/Chart/BarChart.cjs +1 -0
  24. package/dist/components/Chart/BarChart.d.ts +3 -0
  25. package/dist/components/Chart/BarChart.js +65 -0
  26. package/dist/components/Chart/Chart.cjs +1 -1
  27. package/dist/components/Chart/Chart.const.cjs +1 -1
  28. package/dist/components/Chart/Chart.const.d.ts +7 -0
  29. package/dist/components/Chart/Chart.const.js +12 -2
  30. package/dist/components/Chart/Chart.d.ts +1 -13
  31. package/dist/components/Chart/Chart.js +18 -204
  32. package/dist/components/Chart/Chart.types.d.ts +7 -1
  33. package/dist/components/Chart/LineChart.cjs +1 -0
  34. package/dist/components/Chart/LineChart.d.ts +3 -0
  35. package/dist/components/Chart/LineChart.js +73 -0
  36. package/dist/components/Chart/PieChart.cjs +1 -0
  37. package/dist/components/Chart/PieChart.d.ts +3 -0
  38. package/dist/components/Chart/PieChart.js +110 -0
  39. package/dist/components/Chart/index.d.ts +4 -1
  40. package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
  41. package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
  42. package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
  43. package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
  44. package/dist/components/ColorPicker/ColorPicker.js +135 -73
  45. package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
  46. package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
  47. package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
  48. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  49. package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
  50. package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
  51. package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
  52. package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
  53. package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
  54. package/dist/components/CreditInput/CreditInput.cjs +1 -1
  55. package/dist/components/CreditInput/CreditInput.js +80 -78
  56. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  57. package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
  58. package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
  59. package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
  60. package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
  61. package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
  62. package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
  63. package/dist/components/DiffSquares/DiffSquares.js +70 -0
  64. package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
  65. package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
  66. package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
  67. package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
  68. package/dist/components/DiffSquares/index.d.ts +2 -0
  69. package/dist/components/Drawer/Drawer.cjs +1 -1
  70. package/dist/components/Drawer/Drawer.js +41 -41
  71. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  72. package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
  73. package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
  74. package/dist/components/Dropdown/Dropdown.const.js +10 -0
  75. package/dist/components/Dropdown/Dropdown.d.ts +0 -1
  76. package/dist/components/Dropdown/Dropdown.js +102 -92
  77. package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
  78. package/dist/components/Gauge/Gauge.cjs +1 -1
  79. package/dist/components/Gauge/Gauge.js +61 -50
  80. package/dist/components/Gauge/Gauge.types.d.ts +2 -0
  81. package/dist/components/HoverCard/HoverCard.cjs +6 -6
  82. package/dist/components/HoverCard/HoverCard.js +72 -54
  83. package/dist/components/Icon/icons/status.js +1 -1
  84. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  85. package/dist/components/MentionsInput/MentionsInput.js +106 -83
  86. package/dist/components/Menu/Menu.cjs +1 -1
  87. package/dist/components/Menu/Menu.js +91 -80
  88. package/dist/components/Modal/Modal.cjs +1 -1
  89. package/dist/components/Modal/Modal.const.cjs +1 -1
  90. package/dist/components/Modal/Modal.const.d.ts +1 -1
  91. package/dist/components/Modal/Modal.const.js +1 -1
  92. package/dist/components/Modal/Modal.js +50 -44
  93. package/dist/components/Modal/Modal.types.d.ts +6 -0
  94. package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
  95. package/dist/components/MultiSelect/MultiSelect.js +123 -78
  96. package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
  97. package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
  98. package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
  99. package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
  100. package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
  101. package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
  102. package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
  103. package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
  104. package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
  105. package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
  106. package/dist/components/OTPInput/OTPInput.cjs +1 -1
  107. package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
  108. package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
  109. package/dist/components/OTPInput/OTPInput.const.js +14 -0
  110. package/dist/components/OTPInput/OTPInput.js +99 -65
  111. package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
  112. package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
  113. package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
  114. package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
  115. package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
  116. package/dist/components/PhoneInput/PhoneInput.js +88 -83
  117. package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
  118. package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
  119. package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
  120. package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
  121. package/dist/components/Popconfirm/Popconfirm.js +71 -51
  122. package/dist/components/Popover/Popover.cjs +1 -1
  123. package/dist/components/Popover/Popover.js +36 -31
  124. package/dist/components/Portal/Portal.cjs +1 -1
  125. package/dist/components/Portal/Portal.d.ts +0 -3
  126. package/dist/components/Portal/Portal.js +4 -10
  127. package/dist/components/Select/Select.cjs +1 -1
  128. package/dist/components/Select/Select.js +71 -51
  129. package/dist/components/Stepper/Stepper.cjs +1 -1
  130. package/dist/components/Stepper/Stepper.const.cjs +1 -1
  131. package/dist/components/Stepper/Stepper.const.d.ts +3 -2
  132. package/dist/components/Stepper/Stepper.const.js +15 -14
  133. package/dist/components/Stepper/Stepper.d.ts +0 -7
  134. package/dist/components/Stepper/Stepper.js +164 -117
  135. package/dist/components/Stepper/Stepper.types.d.ts +3 -0
  136. package/dist/components/Tabs/TabList.cjs +1 -1
  137. package/dist/components/Tabs/TabList.js +72 -57
  138. package/dist/components/Tabs/Tabs.types.d.ts +4 -2
  139. package/dist/components/Tabs/index.d.ts +2 -2
  140. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
  141. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
  142. package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
  143. package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
  144. package/dist/components/Toast/Toast.cjs +1 -1
  145. package/dist/components/Toast/Toast.js +86 -82
  146. package/dist/components/Toast/Toast.types.d.ts +2 -0
  147. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  148. package/dist/components/Tooltip/Tooltip.js +52 -44
  149. package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
  150. package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
  151. package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
  152. package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
  153. package/dist/components/TreeSelect/TreeSelect.js +120 -88
  154. package/dist/components/Watermark/Watermark.cjs +1 -1
  155. package/dist/components/Watermark/Watermark.const.cjs +1 -1
  156. package/dist/components/Watermark/Watermark.const.d.ts +6 -3
  157. package/dist/components/Watermark/Watermark.const.js +13 -11
  158. package/dist/components/Watermark/Watermark.js +87 -61
  159. package/dist/components/Watermark/Watermark.types.d.ts +2 -0
  160. package/dist/components/index.cjs +1 -1
  161. package/dist/components/index.d.ts +5 -3
  162. package/dist/components/index.js +292 -286
  163. package/dist/hooks/index.cjs +1 -1
  164. package/dist/hooks/index.d.ts +1 -1
  165. package/dist/hooks/index.js +55 -54
  166. package/dist/hooks/useClickOutside.cjs +1 -1
  167. package/dist/hooks/useClickOutside.d.ts +4 -11
  168. package/dist/hooks/useClickOutside.js +26 -7
  169. package/dist/index.cjs +1 -1
  170. package/dist/index.js +386 -379
  171. package/dist/styles/_effects.css +17 -0
  172. package/dist/styles.css +1 -1
  173. package/dist/utils/maxVisible.utils.cjs +1 -0
  174. package/dist/utils/maxVisible.utils.d.ts +12 -0
  175. package/dist/utils/maxVisible.utils.js +15 -0
  176. package/package.json +1 -1
  177. package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
  178. package/dist/components/HoverCard/HoverCard.utils.js +0 -23
@@ -1,139 +1,157 @@
1
- import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
- import { useState as S, useRef as B, useMemo as V, useEffect as X, useCallback as f } from "react";
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import { useState as _, useRef as S, useMemo as j, useEffect as W, useCallback as m } from "react";
3
3
  import { cn as s } from "../../utils/cn.js";
4
- import { DEFAULT_PLACEHOLDER as pe, DEFAULT_MAX_VISIBLE as fe, DEFAULT_EMPTY_TEXT as me, SCROLL_BLOCK as xe, TAG_SIZE_CLASSES as ye, ICON_SIZE as he, TRIGGER_SIZE_CLASSES as ve, DROPDOWN_Z_INDEX as ke, OPTION_SIZE_CLASSES as Ne, OPTION_HEIGHT as _e } from "./NavigableSelect.const.js";
5
- const Le = (q) => {
4
+ import { Portal as xe } from "../Portal/Portal.js";
5
+ import { DEFAULT_PLACEHOLDER as ye, DEFAULT_MAX_VISIBLE as he, DEFAULT_EMPTY_TEXT as ve, SCROLL_BLOCK as ke, TAG_SIZE_CLASSES as we, ICON_SIZE as Ne, TRIGGER_SIZE_CLASSES as _e, DROPDOWN_Z_INDEX as Se, OPTION_SIZE_CLASSES as Ee, OPTION_HEIGHT as Be } from "./NavigableSelect.const.js";
6
+ const Te = ($) => {
6
7
  const {
7
- options: _,
8
- value: j,
9
- defaultValue: Y,
8
+ options: E,
9
+ value: H,
10
+ defaultValue: J,
10
11
  onChange: o,
11
- multiple: n = !1,
12
- searchable: $ = !0,
13
- placeholder: J = pe,
14
- label: H,
15
- helperText: P,
16
- error: w,
17
- disabled: m = !1,
18
- size: x = "md",
19
- fullWidth: Q = !1,
20
- maxVisible: ee = fe,
21
- maxSelections: E,
22
- emptyText: re = me,
23
- className: ae,
24
- style: te,
25
- testId: le
26
- } = q, y = j !== void 0, W = (e) => e === void 0 ? [] : Array.isArray(e) ? e : [e], [be, F] = S(W(Y)), [g, L] = S(!1), [c, i] = S(-1), [u, C] = S(""), I = B(null), D = B(null), U = B(null), Z = B(null), b = y ? W(j) : be, h = V(() => {
27
- if (!u) return _;
28
- const e = u.toLowerCase();
29
- return _.filter(
12
+ multiple: b = !1,
13
+ searchable: Q = !0,
14
+ placeholder: ee = ye,
15
+ label: z,
16
+ helperText: F,
17
+ error: B,
18
+ disabled: x = !1,
19
+ size: y = "md",
20
+ fullWidth: re = !1,
21
+ maxVisible: ae = he,
22
+ maxSelections: L,
23
+ emptyText: te = ve,
24
+ className: le,
25
+ style: ne,
26
+ testId: be
27
+ } = $, h = H !== void 0, U = (e) => e === void 0 ? [] : Array.isArray(e) ? e : [e], [se, Z] = _(U(J)), [i, C] = _(!1), [g, c] = _(-1), [f, I] = _(""), G = S(null), K = S(null), D = S(null), X = S(null), A = S(null), [T, ie] = _({ top: 0, left: 0, width: 0 }), n = h ? U(H) : se, v = j(() => {
28
+ if (!f) return E;
29
+ const e = f.toLowerCase();
30
+ return E.filter(
30
31
  (r) => {
31
- var t;
32
- return r.label.toLowerCase().includes(e) || ((t = r.description) == null ? void 0 : t.toLowerCase().includes(e));
32
+ var a;
33
+ return r.label.toLowerCase().includes(e) || ((a = r.description) == null ? void 0 : a.toLowerCase().includes(e));
33
34
  }
34
35
  );
35
- }, [_, u]), ne = V(() => {
36
+ }, [E, f]), oe = j(() => {
36
37
  const e = /* @__PURE__ */ new Map();
37
- return h.forEach((r) => {
38
- const t = r.group || "";
39
- e.has(t) || e.set(t, []), e.get(t).push(r);
38
+ return v.forEach((r) => {
39
+ const a = r.group || "";
40
+ e.has(a) || e.set(a, []), e.get(a).push(r);
40
41
  }), e;
41
- }, [h]), v = V(() => h.filter((e) => !e.disabled), [h]);
42
- X(() => {
42
+ }, [v]), k = j(() => v.filter((e) => !e.disabled), [v]);
43
+ W(() => {
44
+ if (!i) return;
45
+ const e = () => {
46
+ var a;
47
+ const r = (a = A.current) == null ? void 0 : a.getBoundingClientRect();
48
+ r && ie({
49
+ top: r.bottom + 4,
50
+ left: Math.max(8, Math.min(r.left, window.innerWidth - r.width - 8)),
51
+ width: r.width
52
+ });
53
+ };
54
+ return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
55
+ window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
56
+ };
57
+ }, [i]), W(() => {
58
+ if (!i) return;
43
59
  const e = (r) => {
44
- I.current && !I.current.contains(r.target) && (L(!1), C(""));
60
+ var d, N;
61
+ const a = r.target;
62
+ (d = G.current) != null && d.contains(a) || (N = K.current) != null && N.contains(a) || (C(!1), I(""));
45
63
  };
46
64
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
47
- }, []), X(() => {
48
- if (!D.current || c < 0) return;
65
+ }, [i]), W(() => {
66
+ if (!D.current || g < 0) return;
49
67
  const e = D.current.querySelector('[data-active="true"]');
50
- e == null || e.scrollIntoView({ block: xe });
51
- }, [c]);
52
- const A = f(() => {
53
- m || (L(!0), i(0), setTimeout(() => {
68
+ e == null || e.scrollIntoView({ block: ke });
69
+ }, [g]);
70
+ const O = m(() => {
71
+ x || (C(!0), c(0), setTimeout(() => {
54
72
  var e;
55
- return (e = U.current) == null ? void 0 : e.focus();
73
+ return (e = X.current) == null ? void 0 : e.focus();
56
74
  }, 0));
57
- }, [m]), k = f(() => {
75
+ }, [x]), w = m(() => {
58
76
  var e;
59
- L(!1), C(""), i(-1), (e = Z.current) == null || e.focus();
60
- }, []), T = f(
77
+ C(!1), I(""), c(-1), (e = A.current) == null || e.focus();
78
+ }, []), M = m(
61
79
  (e) => {
62
80
  let r;
63
- if (n)
64
- if (b.includes(e))
65
- r = b.filter((t) => t !== e);
81
+ if (b)
82
+ if (n.includes(e))
83
+ r = n.filter((a) => a !== e);
66
84
  else {
67
- if (E && b.length >= E) return;
68
- r = [...b, e];
85
+ if (L && n.length >= L) return;
86
+ r = [...n, e];
69
87
  }
70
88
  else
71
- r = [e], k();
72
- y || F(r), o == null || o(n ? r : r[0] ?? "");
89
+ r = [e], w();
90
+ h || Z(r), o == null || o(b ? r : r[0] ?? "");
73
91
  },
74
- [b, n, y, E, o, k]
75
- ), O = f(
92
+ [n, b, h, L, o, w]
93
+ ), R = m(
76
94
  (e) => {
77
- const r = b.filter((t) => t !== e);
78
- y || F(r), o == null || o(n ? r : r[0] ?? "");
95
+ const r = n.filter((a) => a !== e);
96
+ h || Z(r), o == null || o(b ? r : r[0] ?? "");
79
97
  },
80
- [b, n, y, o]
81
- ), G = f(
98
+ [n, b, h, o]
99
+ ), q = m(
82
100
  (e) => {
83
- if (!g) {
84
- (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), A());
101
+ if (!i) {
102
+ (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), O());
85
103
  return;
86
104
  }
87
105
  switch (e.key) {
88
106
  case "ArrowDown":
89
- e.preventDefault(), i((r) => Math.min(r + 1, v.length - 1));
107
+ e.preventDefault(), c((r) => Math.min(r + 1, k.length - 1));
90
108
  break;
91
109
  case "ArrowUp":
92
- e.preventDefault(), i((r) => Math.max(r - 1, 0));
110
+ e.preventDefault(), c((r) => Math.max(r - 1, 0));
93
111
  break;
94
112
  case "Enter":
95
113
  case " ":
96
- e.preventDefault(), c >= 0 && v[c] && T(v[c].value);
114
+ e.preventDefault(), g >= 0 && k[g] && M(k[g].value);
97
115
  break;
98
116
  case "Escape":
99
- e.preventDefault(), k();
117
+ e.preventDefault(), w();
100
118
  break;
101
119
  case "Backspace":
102
- u === "" && n && b.length > 0 && O(b[b.length - 1]);
120
+ f === "" && b && n.length > 0 && R(n[n.length - 1]);
103
121
  break;
104
122
  case "Home":
105
- e.preventDefault(), i(0);
123
+ e.preventDefault(), c(0);
106
124
  break;
107
125
  case "End":
108
- e.preventDefault(), i(v.length - 1);
126
+ e.preventDefault(), c(k.length - 1);
109
127
  break;
110
128
  }
111
129
  },
112
- [g, c, v, T, k, A, u, n, b, O]
113
- ), se = f((e) => b.includes(e), [b]), d = b.map((e) => _.find((r) => r.value === e)).filter(Boolean), oe = !!w, ie = ve[x], ce = Ne[x], de = ye[x], K = he[x], ge = ee * _e[x];
114
- let R = -1;
130
+ [i, g, k, M, w, O, f, b, n, R]
131
+ ), ce = m((e) => n.includes(e), [n]), u = n.map((e) => E.find((r) => r.value === e)).filter(Boolean), de = !!B, ge = _e[y], ue = Ee[y], fe = we[y], Y = Ne[y], pe = ae * Be[y];
132
+ let P = -1;
115
133
  return /* @__PURE__ */ l(
116
134
  "div",
117
135
  {
118
- ref: I,
136
+ ref: G,
119
137
  className: s(
120
138
  "Bear-NavigableSelect",
121
139
  "bear-relative bear-flex bear-flex-col bear-gap-1.5",
122
- Q && "bear-w-full",
123
- ae
140
+ re && "bear-w-full",
141
+ le
124
142
  ),
125
- style: te,
126
- "data-testid": le,
143
+ style: ne,
144
+ "data-testid": be,
127
145
  children: [
128
- H && /* @__PURE__ */ a("label", { className: "Bear-NavigableSelect__label bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300", children: H }),
146
+ z && /* @__PURE__ */ t("label", { className: "Bear-NavigableSelect__label bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300", children: z }),
129
147
  /* @__PURE__ */ l(
130
148
  "button",
131
149
  {
132
- ref: Z,
150
+ ref: A,
133
151
  type: "button",
134
- disabled: m,
135
- onClick: () => g ? k() : A(),
136
- onKeyDown: G,
152
+ disabled: x,
153
+ onClick: () => i ? w() : O(),
154
+ onKeyDown: q,
137
155
  className: s(
138
156
  "Bear-NavigableSelect__trigger",
139
157
  "bear-flex bear-items-center bear-justify-between bear-w-full",
@@ -141,15 +159,15 @@ const Le = (q) => {
141
159
  "bear-transition-all bear-duration-200",
142
160
  "bear-bg-white dark:bear-bg-gray-900",
143
161
  "bear-text-gray-900 dark:bear-text-white",
144
- oe ? "bear-border-red-500 focus:bear-ring-2 focus:bear-ring-red-500/20" : "bear-border-gray-300 dark:bear-border-gray-600 focus:bear-border-[var(--bear-primary-500)] focus:bear-ring-2 focus:bear-ring-[var(--bear-primary-500)]/20",
145
- m && "bear-opacity-50 bear-cursor-not-allowed",
146
- ie
162
+ de ? "bear-border-red-500 focus:bear-ring-2 focus:bear-ring-red-500/20" : "bear-border-gray-300 dark:bear-border-gray-600 focus:bear-border-[var(--bear-primary-500)] focus:bear-ring-2 focus:bear-ring-[var(--bear-primary-500)]/20",
163
+ x && "bear-opacity-50 bear-cursor-not-allowed",
164
+ ge
147
165
  ),
148
166
  "aria-haspopup": "listbox",
149
- "aria-expanded": g,
167
+ "aria-expanded": i,
150
168
  children: [
151
169
  /* @__PURE__ */ l("span", { className: "Bear-NavigableSelect__value bear-flex bear-items-center bear-gap-1.5 bear-flex-wrap bear-flex-1 bear-min-w-0 bear-overflow-hidden", children: [
152
- n && d.length > 0 && d.map((e) => /* @__PURE__ */ l(
170
+ b && u.length > 0 && u.map((e) => /* @__PURE__ */ l(
153
171
  "span",
154
172
  {
155
173
  className: s(
@@ -157,16 +175,16 @@ const Le = (q) => {
157
175
  "bear-inline-flex bear-items-center bear-gap-1 bear-rounded-md",
158
176
  "bear-bg-[var(--bear-primary-100,#fce7f3)] dark:bear-bg-[var(--bear-primary-900,#831843)]/30",
159
177
  "bear-text-[var(--bear-primary-700,#be185d)] dark:bear-text-[var(--bear-primary-300,#f9a8d4)]",
160
- de
178
+ fe
161
179
  ),
162
180
  children: [
163
181
  e.label,
164
- !m && /* @__PURE__ */ a(
182
+ !x && /* @__PURE__ */ t(
165
183
  "button",
166
184
  {
167
185
  type: "button",
168
186
  onClick: (r) => {
169
- r.stopPropagation(), O(e.value);
187
+ r.stopPropagation(), R(e.value);
170
188
  },
171
189
  className: "bear-ml-0.5 hover:bear-opacity-70",
172
190
  "aria-label": `Remove ${e.label}`,
@@ -177,43 +195,49 @@ const Le = (q) => {
177
195
  },
178
196
  e.value
179
197
  )),
180
- !n && d.length > 0 && /* @__PURE__ */ l("span", { className: "bear-truncate", children: [
181
- d[0].icon && /* @__PURE__ */ a("span", { className: "bear-mr-1.5", children: d[0].icon }),
182
- d[0].label
198
+ !b && u.length > 0 && /* @__PURE__ */ l("span", { className: "bear-truncate", children: [
199
+ u[0].icon && /* @__PURE__ */ t("span", { className: "bear-mr-1.5", children: u[0].icon }),
200
+ u[0].label
183
201
  ] }),
184
- d.length === 0 && /* @__PURE__ */ a("span", { className: "bear-text-gray-400 dark:bear-text-gray-500", children: J })
202
+ u.length === 0 && /* @__PURE__ */ t("span", { className: "bear-text-gray-400 dark:bear-text-gray-500", children: ee })
185
203
  ] }),
186
- /* @__PURE__ */ a(
204
+ /* @__PURE__ */ t(
187
205
  "svg",
188
206
  {
189
207
  className: s(
190
- K,
208
+ Y,
191
209
  "bear-text-gray-400 dark:bear-text-gray-500 bear-transition-transform bear-shrink-0 bear-ml-2",
192
- g && "bear-rotate-180"
210
+ i && "bear-rotate-180"
193
211
  ),
194
212
  fill: "none",
195
213
  viewBox: "0 0 24 24",
196
214
  stroke: "currentColor",
197
215
  strokeWidth: 2,
198
- children: /* @__PURE__ */ a("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
216
+ children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
199
217
  }
200
218
  )
201
219
  ]
202
220
  }
203
221
  ),
204
- g && /* @__PURE__ */ l(
222
+ i && /* @__PURE__ */ t(xe, { children: /* @__PURE__ */ l(
205
223
  "div",
206
224
  {
225
+ ref: K,
207
226
  className: s(
208
227
  "Bear-NavigableSelect__dropdown",
209
- "bear-absolute bear-top-full bear-left-0 bear-w-full bear-mt-1",
228
+ "bear-fixed",
210
229
  "bear-bg-white dark:bear-bg-gray-900",
211
230
  "bear-border bear-border-gray-200 dark:bear-border-gray-700",
212
231
  "bear-rounded-lg bear-shadow-lg bear-overflow-hidden"
213
232
  ),
214
- style: { zIndex: ke },
233
+ style: {
234
+ zIndex: Se,
235
+ top: T.top,
236
+ left: T.left,
237
+ width: T.width
238
+ },
215
239
  children: [
216
- $ && /* @__PURE__ */ l("div", { className: "Bear-NavigableSelect__search bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-border-b bear-border-gray-200 dark:bear-border-gray-700", children: [
240
+ Q && /* @__PURE__ */ l("div", { className: "Bear-NavigableSelect__search bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-border-b bear-border-gray-200 dark:bear-border-gray-700", children: [
217
241
  /* @__PURE__ */ l(
218
242
  "svg",
219
243
  {
@@ -223,21 +247,21 @@ const Le = (q) => {
223
247
  stroke: "currentColor",
224
248
  strokeWidth: 2,
225
249
  children: [
226
- /* @__PURE__ */ a("circle", { cx: "11", cy: "11", r: "8" }),
227
- /* @__PURE__ */ a("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
250
+ /* @__PURE__ */ t("circle", { cx: "11", cy: "11", r: "8" }),
251
+ /* @__PURE__ */ t("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
228
252
  ]
229
253
  }
230
254
  ),
231
- /* @__PURE__ */ a(
255
+ /* @__PURE__ */ t(
232
256
  "input",
233
257
  {
234
- ref: U,
258
+ ref: X,
235
259
  type: "text",
236
- value: u,
260
+ value: f,
237
261
  onChange: (e) => {
238
- C(e.target.value), i(0);
262
+ I(e.target.value), c(0);
239
263
  },
240
- onKeyDown: G,
264
+ onKeyDown: q,
241
265
  placeholder: "Type to search...",
242
266
  className: s(
243
267
  "Bear-NavigableSelect__input",
@@ -255,43 +279,43 @@ const Le = (q) => {
255
279
  {
256
280
  ref: D,
257
281
  className: "Bear-NavigableSelect__list bear-overflow-y-auto bear-py-1",
258
- style: { maxHeight: ge },
282
+ style: { maxHeight: pe },
259
283
  role: "listbox",
260
- "aria-multiselectable": n,
284
+ "aria-multiselectable": b,
261
285
  children: [
262
- h.length === 0 && /* @__PURE__ */ a("div", { className: "Bear-NavigableSelect__empty bear-px-3 bear-py-4 bear-text-center bear-text-sm bear-text-gray-500 dark:bear-text-gray-400", children: re }),
263
- Array.from(ne.entries()).map(([e, r]) => /* @__PURE__ */ l("div", { className: "Bear-NavigableSelect__group", children: [
264
- e && /* @__PURE__ */ a("div", { className: "Bear-NavigableSelect__group-title bear-px-3 bear-py-1 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-400 dark:bear-text-gray-500", children: e }),
265
- r.map((t) => {
266
- const N = t.disabled, z = !N;
267
- z && R++;
268
- const M = R === c, p = se(t.value), ue = R;
286
+ v.length === 0 && /* @__PURE__ */ t("div", { className: "Bear-NavigableSelect__empty bear-px-3 bear-py-4 bear-text-center bear-text-sm bear-text-gray-500 dark:bear-text-gray-400", children: te }),
287
+ Array.from(oe.entries()).map(([e, r]) => /* @__PURE__ */ l("div", { className: "Bear-NavigableSelect__group", children: [
288
+ e && /* @__PURE__ */ t("div", { className: "Bear-NavigableSelect__group-title bear-px-3 bear-py-1 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-400 dark:bear-text-gray-500", children: e }),
289
+ r.map((a) => {
290
+ const d = a.disabled, N = !d;
291
+ N && P++;
292
+ const V = P === g, p = ce(a.value), me = P;
269
293
  return /* @__PURE__ */ l(
270
294
  "button",
271
295
  {
272
296
  type: "button",
273
- disabled: N,
297
+ disabled: d,
274
298
  className: s(
275
299
  "Bear-NavigableSelect__option",
276
300
  "bear-w-full bear-flex bear-items-center bear-gap-2.5 bear-text-left bear-cursor-pointer",
277
301
  "bear-transition-colors bear-duration-100",
278
- ce,
279
- M && "bear-bg-gray-100 dark:bear-bg-gray-800",
280
- p && !M && "bear-bg-[var(--bear-primary-50,#fdf2f8)] dark:bear-bg-[var(--bear-primary-950,#500724)]/20",
281
- N && "bear-opacity-40 bear-cursor-not-allowed"
302
+ ue,
303
+ V && "bear-bg-gray-100 dark:bear-bg-gray-800",
304
+ p && !V && "bear-bg-[var(--bear-primary-50,#fdf2f8)] dark:bear-bg-[var(--bear-primary-950,#500724)]/20",
305
+ d && "bear-opacity-40 bear-cursor-not-allowed"
282
306
  ),
283
- "data-active": M,
307
+ "data-active": V,
284
308
  onMouseEnter: () => {
285
- z && i(ue);
309
+ N && c(me);
286
310
  },
287
311
  onClick: () => {
288
- N || T(t.value);
312
+ d || M(a.value);
289
313
  },
290
314
  role: "option",
291
315
  "aria-selected": p,
292
- "aria-disabled": N,
316
+ "aria-disabled": d,
293
317
  children: [
294
- n && /* @__PURE__ */ a(
318
+ b && /* @__PURE__ */ t(
295
319
  "span",
296
320
  {
297
321
  className: s(
@@ -300,31 +324,31 @@ const Le = (q) => {
300
324
  "bear-transition-colors",
301
325
  p ? "bear-bg-[var(--bear-primary-500)] bear-border-[var(--bear-primary-500)] bear-text-white" : "bear-border-gray-300 dark:bear-border-gray-600"
302
326
  ),
303
- children: p && /* @__PURE__ */ a("svg", { className: "bear-w-3 bear-h-3", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ a("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })
327
+ children: p && /* @__PURE__ */ t("svg", { className: "bear-w-3 bear-h-3", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })
304
328
  }
305
329
  ),
306
- t.icon && /* @__PURE__ */ a("span", { className: "Bear-NavigableSelect__option-icon bear-shrink-0 bear-text-gray-500 dark:bear-text-gray-400", children: t.icon }),
330
+ a.icon && /* @__PURE__ */ t("span", { className: "Bear-NavigableSelect__option-icon bear-shrink-0 bear-text-gray-500 dark:bear-text-gray-400", children: a.icon }),
307
331
  /* @__PURE__ */ l("div", { className: "Bear-NavigableSelect__option-body bear-flex-1 bear-min-w-0", children: [
308
- /* @__PURE__ */ a("div", { className: s(
332
+ /* @__PURE__ */ t("div", { className: s(
309
333
  "Bear-NavigableSelect__option-label bear-truncate",
310
334
  p ? "bear-text-[var(--bear-primary-700,#be185d)] dark:bear-text-[var(--bear-primary-300,#f9a8d4)] bear-font-medium" : "bear-text-gray-900 dark:bear-text-white"
311
- ), children: t.label }),
312
- t.description && /* @__PURE__ */ a("div", { className: "Bear-NavigableSelect__option-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate", children: t.description })
335
+ ), children: a.label }),
336
+ a.description && /* @__PURE__ */ t("div", { className: "Bear-NavigableSelect__option-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate", children: a.description })
313
337
  ] }),
314
- !n && p && /* @__PURE__ */ a(
338
+ !b && p && /* @__PURE__ */ t(
315
339
  "svg",
316
340
  {
317
- className: s(K, "bear-text-[var(--bear-primary-500)] bear-shrink-0"),
341
+ className: s(Y, "bear-text-[var(--bear-primary-500)] bear-shrink-0"),
318
342
  fill: "none",
319
343
  viewBox: "0 0 24 24",
320
344
  stroke: "currentColor",
321
345
  strokeWidth: 2,
322
- children: /* @__PURE__ */ a("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
346
+ children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
323
347
  }
324
348
  )
325
349
  ]
326
350
  },
327
- t.value
351
+ a.value
328
352
  );
329
353
  })
330
354
  ] }, e))
@@ -333,29 +357,29 @@ const Le = (q) => {
333
357
  ),
334
358
  /* @__PURE__ */ l("div", { className: "Bear-NavigableSelect__footer bear-flex bear-items-center bear-gap-3 bear-px-3 bear-py-1.5 bear-border-t bear-border-gray-200 dark:bear-border-gray-700 bear-text-[11px] bear-text-gray-400 dark:bear-text-gray-500", children: [
335
359
  /* @__PURE__ */ l("span", { className: "bear-flex bear-items-center bear-gap-1", children: [
336
- /* @__PURE__ */ a("kbd", { className: "bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700", children: "↑↓" }),
360
+ /* @__PURE__ */ t("kbd", { className: "bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700", children: "↑↓" }),
337
361
  "navigate"
338
362
  ] }),
339
363
  /* @__PURE__ */ l("span", { className: "bear-flex bear-items-center bear-gap-1", children: [
340
- /* @__PURE__ */ a("kbd", { className: "bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700", children: "↵" }),
364
+ /* @__PURE__ */ t("kbd", { className: "bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700", children: "↵" }),
341
365
  "select"
342
366
  ] }),
343
367
  /* @__PURE__ */ l("span", { className: "bear-flex bear-items-center bear-gap-1", children: [
344
- /* @__PURE__ */ a("kbd", { className: "bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700", children: "esc" }),
368
+ /* @__PURE__ */ t("kbd", { className: "bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700", children: "esc" }),
345
369
  "close"
346
370
  ] })
347
371
  ] })
348
372
  ]
349
373
  }
350
- ),
351
- (P || w) && /* @__PURE__ */ a("p", { className: s(
374
+ ) }),
375
+ (F || B) && /* @__PURE__ */ t("p", { className: s(
352
376
  "Bear-NavigableSelect__helper bear-text-xs",
353
- w ? "bear-text-red-500" : "bear-text-gray-500 dark:bear-text-gray-400"
354
- ), children: w || P })
377
+ B ? "bear-text-red-500" : "bear-text-gray-500 dark:bear-text-gray-400"
378
+ ), children: B || F })
355
379
  ]
356
380
  }
357
381
  );
358
382
  };
359
383
  export {
360
- Le as NavigableSelect
384
+ Te as NavigableSelect
361
385
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),q=require("react-dom"),c=require("../../utils/cn.cjs"),m=require("./NotificationCenter.const.cjs"),F=require("./NotificationCenter.utils.cjs"),W=({notification:r,onRead:d,onDismiss:g,onClick:b,translations:v})=>{const p=()=>{r.read||d==null||d(r.id),b==null||b(r)};return e.jsxs("div",{onClick:p,className:c.cn("Bear-NotificationCenter__item bear-flex bear-gap-3 bear-p-3 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700 last:bear-border-b-0 bear-cursor-pointer bear-transition-colors hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700/50",!r.read&&"bear-bg-gray-50 dark:bear-bg-zinc-800/50"),children:[e.jsx("div",{className:"Bear-NotificationCenter__item-icon bear-shrink-0",children:r.avatar?e.jsx("img",{src:r.avatar,alt:"",className:"bear-w-10 bear-h-10 bear-rounded-full bear-object-cover"}):r.icon?e.jsx("div",{className:c.cn("bear-w-10 bear-h-10 bear-rounded-full bear-flex bear-items-center bear-justify-center",m.NOTIFICATION_TYPE_COLORS[r.type]),children:r.icon}):e.jsxs("div",{className:c.cn("bear-w-10 bear-h-10 bear-rounded-full bear-flex bear-items-center bear-justify-center",m.NOTIFICATION_TYPE_COLORS[r.type]),children:[r.type==="success"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),r.type==="error"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),r.type==="warning"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),r.type==="info"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})]})}),e.jsxs("div",{className:"Bear-NotificationCenter__item-content bear-flex-1 bear-min-w-0",children:[e.jsxs("div",{className:"bear-flex bear-items-start bear-justify-between bear-gap-2",children:[e.jsx("p",{className:c.cn("Bear-NotificationCenter__item-title bear-text-sm bear-font-medium bear-truncate",r.read?"bear-text-gray-600 dark:bear-text-zinc-300":"bear-text-gray-900 dark:bear-text-white"),children:r.title}),!r.read&&e.jsx("span",{className:"Bear-NotificationCenter__item-badge bear-w-2 bear-h-2 bear-rounded-full bear-bg-pink-500 bear-shrink-0 bear-mt-1.5"})]}),r.description&&e.jsx("p",{className:"Bear-NotificationCenter__item-description bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mt-0.5 bear-line-clamp-2",children:r.description}),e.jsx("p",{className:"Bear-NotificationCenter__item-time bear-text-xs bear-text-gray-400 dark:bear-text-zinc-500 bear-mt-1",children:F.formatRelativeTime(r.timestamp,v)}),r.actions&&r.actions.length>0&&e.jsx("div",{className:"Bear-NotificationCenter__item-actions bear-flex bear-gap-2 bear-mt-2",children:r.actions.map((a,j)=>e.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),a.onClick()},className:c.cn("bear-px-2 bear-py-1 bear-text-xs bear-rounded bear-transition-colors",a.variant==="primary"&&"bear-bg-pink-500 bear-text-white hover:bear-bg-pink-600",a.variant==="secondary"&&"bear-bg-gray-200 dark:bear-bg-zinc-600 bear-text-gray-900 dark:bear-text-white hover:bear-bg-gray-300 dark:hover:bear-bg-zinc-500",a.variant==="danger"&&"bear-bg-red-500 bear-text-white hover:bear-bg-red-600",!a.variant&&"bear-bg-gray-100 dark:bear-bg-zinc-700 bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-200 dark:hover:bear-bg-zinc-600"),children:a.label},j))})]}),g&&e.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),g(r.id)},className:"Bear-NotificationCenter__item-dismiss bear-p-1 bear-rounded bear-text-gray-500 dark:bear-text-zinc-500 hover:bear-text-gray-700 dark:hover:bear-text-zinc-300 hover:bear-bg-gray-200 dark:hover:bear-bg-zinc-700 bear-transition-colors bear-shrink-0",children:e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})},D=({notifications:r,onNotificationClick:d,onMarkAsRead:g,onMarkAllAsRead:b,onDismiss:v,onClearAll:p,maxVisible:a=m.NOTIFICATION_CENTER_MAX_VISIBLE,groupByCategory:j=!1,position:x="top-right",trigger:C,open:I,onOpenChange:T,className:O,testId:E,translations:_,icon:M})=>{const[A,R]=n.useState(!1),[w,S]=n.useState({top:0,left:0}),[f,P]=n.useState(!1),B=n.useRef(null),y=n.useRef(null),h=I??A,N=T??R,o=n.useMemo(()=>({...m.NOTIFICATION_CENTER_DEFAULT_TRANSLATIONS,..._}),[_]),i=n.useMemo(()=>r.filter(t=>!t.read).length,[r]),z=n.useMemo(()=>f?r:r.slice(0,a),[r,a,f]);n.useEffect(()=>{if(h&&y.current){const t=y.current.getBoundingClientRect(),k=window.scrollY||document.documentElement.scrollTop,s=window.scrollX||document.documentElement.scrollLeft;let u=t.bottom+k+8,l=t.left+s;x.includes("left")?l=t.left+s:l=t.right+s-360,x.includes("bottom")&&(u=t.top+k-8),S({top:u,left:Math.max(8,l)})}},[h,x]),n.useEffect(()=>{const t=k=>{var u,l;const s=k.target;(u=B.current)!=null&&u.contains(s)||(l=s.closest)!=null&&l.call(s,"[data-bear-notification-center]")||N(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[N]);const L=n.useCallback(()=>{N(!h)},[h,N]);return e.jsxs("div",{ref:B,className:c.cn("Bear-NotificationCenter bear-relative bear-inline-block",O),"data-testid":E,children:[C?e.jsx("div",{onClick:L,children:C}):e.jsxs("button",{ref:y,type:"button",onClick:L,className:"Bear-NotificationCenter__trigger bear-relative bear-p-2 bear-rounded-lg bear-text-gray-500 dark:bear-text-zinc-400 hover:bear-text-gray-900 dark:hover:bear-text-white hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-800 bear-transition-colors",children:[M??e.jsx("svg",{className:"bear-w-6 bear-h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})}),i>0&&e.jsx("span",{className:"Bear-NotificationCenter__badge bear-absolute bear-top-0 bear-right-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center bear-text-xs bear-font-medium bear-text-white bear-bg-pink-500 bear-rounded-full",children:i>99?"99+":i})]}),h&&typeof document<"u"&&q.createPortal(e.jsxs("div",{"data-bear-notification-center":!0,className:"Bear-NotificationCenter__dropdown bear-fixed bear-w-[360px] bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-overflow-hidden",style:{top:w.top,left:w.left,zIndex:m.NOTIFICATION_CENTER_Z_INDEX},children:[e.jsxs("div",{className:"Bear-NotificationCenter__header bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700",children:[e.jsxs("h3",{className:"Bear-NotificationCenter__title bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white",children:[o.title,i>0&&e.jsxs("span",{className:"bear-ml-2 bear-text-xs bear-font-normal bear-text-gray-500 dark:bear-text-zinc-400",children:["(",i," ",o.new.toLowerCase(),")"]})]}),e.jsxs("div",{className:"bear-flex bear-gap-2",children:[b&&i>0&&e.jsx("button",{type:"button",onClick:b,className:"Bear-NotificationCenter__mark-all bear-text-xs bear-text-pink-400 hover:bear-text-pink-300 bear-transition-colors",children:o.markAllRead}),p&&r.length>0&&e.jsx("button",{type:"button",onClick:p,className:"Bear-NotificationCenter__clear-all bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 hover:bear-text-gray-700 dark:hover:bear-text-zinc-300 bear-transition-colors",children:o.clearAll})]})]}),e.jsx("div",{className:"Bear-NotificationCenter__list bear-max-h-[400px] bear-overflow-y-auto",children:z.length===0?e.jsx("div",{className:"Bear-NotificationCenter__empty bear-py-8 bear-text-center bear-text-sm bear-text-gray-500 dark:bear-text-zinc-500",children:o.noNotifications}):z.map(t=>e.jsx(W,{notification:t,onRead:g,onDismiss:v,onClick:d,translations:o},t.id))}),!f&&r.length>a&&e.jsx("div",{className:"Bear-NotificationCenter__footer bear-border-t bear-border-gray-200 dark:bear-border-zinc-700",children:e.jsxs("button",{type:"button",onClick:()=>P(!0),className:"bear-w-full bear-py-2 bear-text-sm bear-text-pink-500 dark:bear-text-pink-400 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700/50 bear-transition-colors",children:[o.showMore," (",r.length-a," more)"]})})]}),document.body)]})};exports.NotificationCenter=D;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),F=require("react-dom"),d=require("../../utils/cn.cjs"),u=require("./NotificationCenter.const.cjs"),D=require("./NotificationCenter.utils.cjs"),H=({notification:r,onRead:x,onDismiss:m,onClick:c,translations:k})=>{const g=()=>{r.read||x==null||x(r.id),c==null||c(r)};return e.jsxs("div",{onClick:g,className:d.cn("Bear-NotificationCenter__item bear-flex bear-gap-3 bear-p-3 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700 last:bear-border-b-0 bear-cursor-pointer bear-transition-colors hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700/50",!r.read&&"bear-bg-gray-50 dark:bear-bg-zinc-800/50"),children:[e.jsx("div",{className:"Bear-NotificationCenter__item-icon bear-shrink-0",children:r.avatar?e.jsx("img",{src:r.avatar,alt:"",className:"bear-w-10 bear-h-10 bear-rounded-full bear-object-cover"}):r.icon?e.jsx("div",{className:d.cn("bear-w-10 bear-h-10 bear-rounded-full bear-flex bear-items-center bear-justify-center",u.NOTIFICATION_TYPE_COLORS[r.type]),children:r.icon}):e.jsxs("div",{className:d.cn("bear-w-10 bear-h-10 bear-rounded-full bear-flex bear-items-center bear-justify-center",u.NOTIFICATION_TYPE_COLORS[r.type]),children:[r.type==="success"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),r.type==="error"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),r.type==="warning"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),r.type==="info"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})]})}),e.jsxs("div",{className:"Bear-NotificationCenter__item-content bear-flex-1 bear-min-w-0",children:[e.jsxs("div",{className:"bear-flex bear-items-start bear-justify-between bear-gap-2",children:[e.jsx("p",{className:d.cn("Bear-NotificationCenter__item-title bear-text-sm bear-font-medium bear-truncate",r.read?"bear-text-gray-600 dark:bear-text-zinc-300":"bear-text-gray-900 dark:bear-text-white"),children:r.title}),!r.read&&e.jsx("span",{className:"Bear-NotificationCenter__item-badge bear-w-2 bear-h-2 bear-rounded-full bear-bg-pink-500 bear-shrink-0 bear-mt-1.5"})]}),r.description&&e.jsx("p",{className:"Bear-NotificationCenter__item-description bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mt-0.5 bear-line-clamp-2",children:r.description}),e.jsx("p",{className:"Bear-NotificationCenter__item-time bear-text-xs bear-text-gray-400 dark:bear-text-zinc-500 bear-mt-1",children:D.formatRelativeTime(r.timestamp,k)}),r.actions&&r.actions.length>0&&e.jsx("div",{className:"Bear-NotificationCenter__item-actions bear-flex bear-gap-2 bear-mt-2",children:r.actions.map((a,C)=>e.jsx("button",{type:"button",onClick:p=>{p.stopPropagation(),a.onClick()},className:d.cn("bear-px-2 bear-py-1 bear-text-xs bear-rounded bear-transition-colors",a.variant==="primary"&&"bear-bg-pink-500 bear-text-white hover:bear-bg-pink-600",a.variant==="secondary"&&"bear-bg-gray-200 dark:bear-bg-zinc-600 bear-text-gray-900 dark:bear-text-white hover:bear-bg-gray-300 dark:hover:bear-bg-zinc-500",a.variant==="danger"&&"bear-bg-red-500 bear-text-white hover:bear-bg-red-600",!a.variant&&"bear-bg-gray-100 dark:bear-bg-zinc-700 bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-200 dark:hover:bear-bg-zinc-600"),children:a.label},C))})]}),m&&e.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),m(r.id)},className:"Bear-NotificationCenter__item-dismiss bear-p-1 bear-rounded bear-text-gray-500 dark:bear-text-zinc-500 hover:bear-text-gray-700 dark:hover:bear-text-zinc-300 hover:bear-bg-gray-200 dark:hover:bear-bg-zinc-700 bear-transition-colors bear-shrink-0",children:e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})},X=({notifications:r,onNotificationClick:x,onMarkAsRead:m,onMarkAllAsRead:c,onDismiss:k,onClearAll:g,maxVisible:a=u.NOTIFICATION_CENTER_MAX_VISIBLE,groupByCategory:C=!1,position:p="top-right",trigger:_,open:T,onOpenChange:E,className:M,testId:A,translations:z,icon:R})=>{const[S,P]=t.useState(!1),[B,W]=t.useState({top:0,left:0}),[f,q]=t.useState(!1),L=t.useRef(null),y=t.useRef(null),h=T??S,v=E??P,o=t.useMemo(()=>({...u.NOTIFICATION_CENTER_DEFAULT_TRANSLATIONS,...z}),[z]),l=t.useMemo(()=>r.filter(n=>!n.read).length,[r]),I=t.useMemo(()=>f?r:r.slice(0,a),[r,a,f]);t.useEffect(()=>{if(!h||!y.current)return;const n=360,N=400,b=8,s=()=>{const i=y.current.getBoundingClientRect();let j=p.includes("left")?i.left:i.right-n;j=Math.max(8,Math.min(j,window.innerWidth-n-8));let w=i.bottom+b;w+N>window.innerHeight-8&&(w=Math.max(8,i.top-N-b)),W({top:w,left:j})};return s(),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[h,p]),t.useEffect(()=>{const n=N=>{var s,i;const b=N.target;(s=L.current)!=null&&s.contains(b)||(i=b.closest)!=null&&i.call(b,"[data-bear-notification-center]")||v(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[v]);const O=t.useCallback(()=>{v(!h)},[h,v]);return e.jsxs("div",{ref:L,className:d.cn("Bear-NotificationCenter bear-relative bear-inline-block",M),"data-testid":A,children:[_?e.jsx("div",{onClick:O,children:_}):e.jsxs("button",{ref:y,type:"button",onClick:O,className:"Bear-NotificationCenter__trigger bear-relative bear-p-2 bear-rounded-lg bear-text-gray-500 dark:bear-text-zinc-400 hover:bear-text-gray-900 dark:hover:bear-text-white hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-800 bear-transition-colors",children:[R??e.jsx("svg",{className:"bear-w-6 bear-h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})}),l>0&&e.jsx("span",{className:"Bear-NotificationCenter__badge bear-absolute bear-top-0 bear-right-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center bear-text-xs bear-font-medium bear-text-white bear-bg-pink-500 bear-rounded-full",children:l>99?"99+":l})]}),h&&typeof document<"u"&&F.createPortal(e.jsxs("div",{"data-bear-notification-center":!0,className:"Bear-NotificationCenter__dropdown bear-fixed bear-w-[360px] bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-overflow-hidden",style:{top:B.top,left:B.left,zIndex:u.NOTIFICATION_CENTER_Z_INDEX},children:[e.jsxs("div",{className:"Bear-NotificationCenter__header bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700",children:[e.jsxs("h3",{className:"Bear-NotificationCenter__title bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white",children:[o.title,l>0&&e.jsxs("span",{className:"bear-ml-2 bear-text-xs bear-font-normal bear-text-gray-500 dark:bear-text-zinc-400",children:["(",l," ",o.new.toLowerCase(),")"]})]}),e.jsxs("div",{className:"bear-flex bear-gap-2",children:[c&&l>0&&e.jsx("button",{type:"button",onClick:c,className:"Bear-NotificationCenter__mark-all bear-text-xs bear-text-pink-400 hover:bear-text-pink-300 bear-transition-colors",children:o.markAllRead}),g&&r.length>0&&e.jsx("button",{type:"button",onClick:g,className:"Bear-NotificationCenter__clear-all bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 hover:bear-text-gray-700 dark:hover:bear-text-zinc-300 bear-transition-colors",children:o.clearAll})]})]}),e.jsx("div",{className:"Bear-NotificationCenter__list bear-max-h-[400px] bear-overflow-y-auto",children:I.length===0?e.jsx("div",{className:"Bear-NotificationCenter__empty bear-py-8 bear-text-center bear-text-sm bear-text-gray-500 dark:bear-text-zinc-500",children:o.noNotifications}):I.map(n=>e.jsx(H,{notification:n,onRead:m,onDismiss:k,onClick:x,translations:o},n.id))}),!f&&r.length>a&&e.jsx("div",{className:"Bear-NotificationCenter__footer bear-border-t bear-border-gray-200 dark:bear-border-zinc-700",children:e.jsxs("button",{type:"button",onClick:()=>q(!0),className:"bear-w-full bear-py-2 bear-text-sm bear-text-pink-500 dark:bear-text-pink-400 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700/50 bear-transition-colors",children:[o.showMore," (",r.length-a," more)"]})})]}),document.body)]})};exports.NotificationCenter=X;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={title:"Notifications",noNotifications:"No notifications",markAllRead:"Mark all as read",clearAll:"Clear all",showMore:"Show more",justNow:"Just now",minutesAgo:"{count}m ago",hoursAgo:"{count}h ago",daysAgo:"{count}d ago",new:"New"},T=5,o=9999,I={info:"bear-text-blue-400 bear-bg-blue-500/20",success:"bear-text-green-400 bear-bg-green-500/20",warning:"bear-text-amber-400 bear-bg-amber-500/20",error:"bear-text-red-400 bear-bg-red-500/20"},N={MINUTE:60*1e3,HOUR:3600*1e3,DAY:1440*60*1e3};exports.NOTIFICATION_CENTER_DEFAULT_TRANSLATIONS=e;exports.NOTIFICATION_CENTER_MAX_VISIBLE=T;exports.NOTIFICATION_CENTER_Z_INDEX=o;exports.NOTIFICATION_TYPE_COLORS=I;exports.TIME_THRESHOLDS=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={title:"Notifications",noNotifications:"No notifications",markAllRead:"Mark all as read",clearAll:"Clear all",showMore:"Show more",justNow:"Just now",minutesAgo:"{count}m ago",hoursAgo:"{count}h ago",daysAgo:"{count}d ago",new:"New"},T=5,o=1e4,I={info:"bear-text-blue-400 bear-bg-blue-500/20",success:"bear-text-green-400 bear-bg-green-500/20",warning:"bear-text-amber-400 bear-bg-amber-500/20",error:"bear-text-red-400 bear-bg-red-500/20"},N={MINUTE:60*1e3,HOUR:3600*1e3,DAY:1440*60*1e3};exports.NOTIFICATION_CENTER_DEFAULT_TRANSLATIONS=e;exports.NOTIFICATION_CENTER_MAX_VISIBLE=T;exports.NOTIFICATION_CENTER_Z_INDEX=o;exports.NOTIFICATION_TYPE_COLORS=I;exports.TIME_THRESHOLDS=N;
@@ -10,7 +10,7 @@ export declare const NOTIFICATION_CENTER_MAX_VISIBLE = 5;
10
10
  /**
11
11
  * Dropdown z-index
12
12
  */
13
- export declare const NOTIFICATION_CENTER_Z_INDEX = 9999;
13
+ export declare const NOTIFICATION_CENTER_Z_INDEX = 10000;
14
14
  /**
15
15
  * Type icon colors
16
16
  */
@@ -9,7 +9,7 @@ const e = {
9
9
  hoursAgo: "{count}h ago",
10
10
  daysAgo: "{count}d ago",
11
11
  new: "New"
12
- }, o = 5, t = 9999, a = {
12
+ }, o = 5, t = 1e4, a = {
13
13
  info: "bear-text-blue-400 bear-bg-blue-500/20",
14
14
  success: "bear-text-green-400 bear-bg-green-500/20",
15
15
  warning: "bear-text-amber-400 bear-bg-amber-500/20",