@forgedevstack/bear 1.1.4 → 1.1.9

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 (179) hide show
  1. package/README.md +21 -2
  2. package/dist/components/Anchor/Anchor.cjs +1 -1
  3. package/dist/components/Anchor/Anchor.js +37 -45
  4. package/dist/components/Anchor/Anchor.utils.cjs +1 -0
  5. package/dist/components/Anchor/Anchor.utils.d.ts +2 -0
  6. package/dist/components/Anchor/Anchor.utils.js +12 -0
  7. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  8. package/dist/components/Autocomplete/Autocomplete.js +60 -67
  9. package/dist/components/Autocomplete/Autocomplete.utils.cjs +1 -0
  10. package/dist/components/Autocomplete/Autocomplete.utils.d.ts +2 -0
  11. package/dist/components/Autocomplete/Autocomplete.utils.js +12 -0
  12. package/dist/components/BackTop/BackTop.cjs +1 -1
  13. package/dist/components/BackTop/BackTop.js +10 -11
  14. package/dist/components/BearLogo/BearLogo.d.ts +2 -7
  15. package/dist/components/BearLogo/BearLogo.types.d.ts +15 -0
  16. package/dist/components/BearLogo/EmberLogo.d.ts +1 -8
  17. package/dist/components/BearLogo/index.d.ts +1 -2
  18. package/dist/components/Biometric/Biometric.cjs +1 -0
  19. package/dist/components/Biometric/Biometric.d.ts +3 -0
  20. package/dist/components/Biometric/Biometric.js +123 -0
  21. package/dist/components/Biometric/Biometric.types.d.ts +35 -0
  22. package/dist/components/Biometric/BiometricIcon.cjs +1 -0
  23. package/dist/components/Biometric/BiometricIcon.d.ts +3 -0
  24. package/dist/components/Biometric/BiometricIcon.js +45 -0
  25. package/dist/components/Biometric/index.d.ts +3 -0
  26. package/dist/components/Biometric/useBiometric.cjs +1 -0
  27. package/dist/components/Biometric/useBiometric.d.ts +2 -0
  28. package/dist/components/Biometric/useBiometric.js +21 -0
  29. package/dist/components/Button/Button.cjs +1 -1
  30. package/dist/components/Button/Button.constants.cjs +2 -2
  31. package/dist/components/Button/Button.constants.d.ts +1 -0
  32. package/dist/components/Button/Button.constants.js +12 -5
  33. package/dist/components/Button/Button.d.ts +0 -27
  34. package/dist/components/Button/Button.js +93 -105
  35. package/dist/components/Button/Button.types.d.ts +1 -0
  36. package/dist/components/Button/Button.utils.cjs +1 -0
  37. package/dist/components/Button/Button.utils.d.ts +2 -0
  38. package/dist/components/Button/Button.utils.js +5 -0
  39. package/dist/components/Button/useSpotlight.cjs +1 -0
  40. package/dist/components/Button/useSpotlight.d.ts +21 -0
  41. package/dist/components/Button/useSpotlight.js +28 -0
  42. package/dist/components/Chart/Chart.cjs +1 -1
  43. package/dist/components/Chart/Chart.const.cjs +1 -0
  44. package/dist/components/Chart/Chart.const.js +21 -0
  45. package/dist/components/Chart/Chart.js +55 -71
  46. package/dist/components/Chart/Chart.utils.cjs +1 -0
  47. package/dist/components/Chart/Chart.utils.js +5 -0
  48. package/dist/components/Confetti/Confetti.cjs +1 -1
  49. package/dist/components/Confetti/Confetti.js +37 -34
  50. package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
  51. package/dist/components/ContextMenu/ContextMenu.js +31 -30
  52. package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
  53. package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
  54. package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
  55. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  56. package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
  57. package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
  58. package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
  59. package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
  60. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  61. package/dist/components/DateRangePicker/DateRangePicker.const.cjs +1 -1
  62. package/dist/components/DateRangePicker/DateRangePicker.const.js +12 -13
  63. package/dist/components/DateRangePicker/DateRangePicker.js +107 -81
  64. package/dist/components/Dock/Dock.cjs +1 -1
  65. package/dist/components/Dock/Dock.js +38 -43
  66. package/dist/components/Dock/Dock.utils.cjs +1 -0
  67. package/dist/components/Dock/Dock.utils.d.ts +1 -0
  68. package/dist/components/Dock/Dock.utils.js +10 -0
  69. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  70. package/dist/components/Dropdown/Dropdown.js +77 -74
  71. package/dist/components/FileTree/FileTree.cjs +1 -1
  72. package/dist/components/FileTree/FileTree.js +20 -32
  73. package/dist/components/FileTree/FileTree.utils.cjs +1 -0
  74. package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
  75. package/dist/components/FileTree/FileTree.utils.js +15 -0
  76. package/dist/components/GradientText/GradientText.cjs +1 -1
  77. package/dist/components/GradientText/GradientText.js +27 -29
  78. package/dist/components/Icon/icons/bear.cjs +1 -0
  79. package/dist/components/Icon/icons/bear.d.ts +12 -0
  80. package/dist/components/Icon/icons/bear.js +47 -0
  81. package/dist/components/Icon/index.cjs +1 -1
  82. package/dist/components/Icon/index.d.ts +18 -0
  83. package/dist/components/Icon/index.js +17 -15
  84. package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -1
  85. package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -1
  86. package/dist/components/InfiniteScroll/InfiniteScroll.const.js +6 -7
  87. package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -41
  88. package/dist/components/Input/Input.cjs +1 -1
  89. package/dist/components/Input/Input.js +153 -101
  90. package/dist/components/Input/Input.types.d.ts +8 -2
  91. package/dist/components/Input/index.d.ts +1 -1
  92. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  93. package/dist/components/MentionsInput/MentionsInput.js +64 -68
  94. package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
  95. package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
  96. package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
  97. package/dist/components/PageNav/PageNav.cjs +1 -0
  98. package/dist/components/PageNav/PageNav.const.cjs +1 -0
  99. package/dist/components/PageNav/PageNav.const.d.ts +22 -0
  100. package/dist/components/PageNav/PageNav.const.js +42 -0
  101. package/dist/components/PageNav/PageNav.d.ts +3 -0
  102. package/dist/components/PageNav/PageNav.js +81 -0
  103. package/dist/components/PageNav/PageNav.types.d.ts +17 -0
  104. package/dist/components/PageNav/index.d.ts +2 -0
  105. package/dist/components/Popover/Popover.cjs +1 -1
  106. package/dist/components/Popover/Popover.js +76 -76
  107. package/dist/components/Progress/Progress.cjs +1 -1
  108. package/dist/components/Progress/Progress.js +6 -6
  109. package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
  110. package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
  111. package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
  112. package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
  113. package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
  114. package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
  115. package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
  116. package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
  117. package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
  118. package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
  119. package/dist/components/PropsPlayground/index.d.ts +2 -0
  120. package/dist/components/Select/Select.cjs +1 -1
  121. package/dist/components/Select/Select.js +54 -53
  122. package/dist/components/SignPad/SignPad.cjs +1 -1
  123. package/dist/components/SignPad/SignPad.js +24 -24
  124. package/dist/components/Skeleton/Skeleton.cjs +1 -1
  125. package/dist/components/Skeleton/Skeleton.js +89 -94
  126. package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
  127. package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
  128. package/dist/components/Skeleton/Skeleton.utils.js +10 -0
  129. package/dist/components/SliderRange/SliderRange.cjs +1 -1
  130. package/dist/components/SliderRange/SliderRange.js +61 -63
  131. package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
  132. package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
  133. package/dist/components/SliderRange/SliderRange.utils.js +7 -0
  134. package/dist/components/Spotlight/Spotlight.cjs +1 -1
  135. package/dist/components/Spotlight/Spotlight.js +62 -73
  136. package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
  137. package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
  138. package/dist/components/Spotlight/Spotlight.utils.js +18 -0
  139. package/dist/components/Tabs/TabList.cjs +1 -0
  140. package/dist/components/Tabs/TabList.d.ts +3 -0
  141. package/dist/components/Tabs/TabList.js +69 -0
  142. package/dist/components/Tabs/TabPanel.cjs +1 -0
  143. package/dist/components/Tabs/TabPanel.d.ts +3 -0
  144. package/dist/components/Tabs/TabPanel.js +13 -0
  145. package/dist/components/Tabs/Tabs.cjs +1 -1
  146. package/dist/components/Tabs/Tabs.d.ts +2 -27
  147. package/dist/components/Tabs/Tabs.js +43 -61
  148. package/dist/components/Tabs/Tabs.types.d.ts +7 -1
  149. package/dist/components/Tabs/index.d.ts +3 -1
  150. package/dist/components/Toast/Toast.cjs +1 -1
  151. package/dist/components/Toast/Toast.js +18 -17
  152. package/dist/components/Toast/Toast.utils.cjs +1 -0
  153. package/dist/components/Toast/Toast.utils.d.ts +1 -0
  154. package/dist/components/Toast/Toast.utils.js +4 -0
  155. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  156. package/dist/components/Tooltip/Tooltip.js +10 -11
  157. package/dist/components/Tour/Tour.cjs +1 -1
  158. package/dist/components/Tour/Tour.js +1 -2
  159. package/dist/components/VirtualList/VirtualList.cjs +1 -1
  160. package/dist/components/VirtualList/VirtualList.js +38 -43
  161. package/dist/components/index.cjs +1 -1
  162. package/dist/components/index.d.ts +9 -2
  163. package/dist/components/index.js +311 -300
  164. package/dist/hooks/index.cjs +1 -1
  165. package/dist/hooks/index.d.ts +2 -0
  166. package/dist/hooks/index.js +60 -58
  167. package/dist/hooks/useResizeObserver/index.d.ts +2 -0
  168. package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
  169. package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
  170. package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
  171. package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
  172. package/dist/icons.cjs +1 -0
  173. package/dist/icons.d.ts +2 -0
  174. package/dist/icons.js +6 -0
  175. package/dist/index.cjs +1 -1
  176. package/dist/index.js +397 -384
  177. package/dist/styles/_base.css +7 -3
  178. package/dist/styles.css +1 -1
  179. package/package.json +6 -1
@@ -1,37 +1,38 @@
1
- import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import { useState as p, useRef as Q, useEffect as O, useCallback as g } from "react";
3
- import { cn as E } from "../../utils/cn.js";
4
- import { getDefaultPresets as U, LABEL_CLASSES as X, SIZE_CLASSES as ee, TRIGGER_CLASSES as te, DROPDOWN_CLASSES as re, PRESET_BTN_CLASSES as P, ERROR_CLASSES as ae, HELPER_CLASSES as se, ROOT_CLASSES as ne, CALENDAR_HEADER_CLASSES as le, NAV_BTN_CLASSES as I, MONTH_LABELS as oe, DAY_LABELS as ce, DAY_TODAY_CLASSES as ie, DAY_IN_RANGE_CLASSES as de, DAY_SELECTED_CLASSES as be, DAY_DISABLED_CLASSES as me, DAY_HOVER_CLASSES as Se, DAY_BASE_CLASSES as ue } from "./DateRangePicker.const.js";
5
- import { formatDate as z, getCalendarDays as he, isSameDay as w, isInRange as pe } from "./DateRangePicker.utils.js";
6
- const H = ({ year: L, month: o, range: r, onDayClick: A, onNav: N, minDate: i, maxDate: f }) => {
7
- const k = he(L, o), m = /* @__PURE__ */ new Date();
8
- return m.setHours(0, 0, 0, 0), /* @__PURE__ */ c("div", { className: "bear-w-64", children: [
9
- /* @__PURE__ */ c("div", { className: le, children: [
10
- /* @__PURE__ */ e("button", { type: "button", onClick: () => N(-1), className: I, "aria-label": "Previous month", children: /* @__PURE__ */ e("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }),
11
- /* @__PURE__ */ c("span", { className: "bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white", children: [
12
- oe[o],
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
+ import { useState as u, useRef as P, useEffect as T, useCallback as v } from "react";
3
+ import { createPortal as se } from "react-dom";
4
+ import { cn as p } from "../../utils/cn.js";
5
+ import { getDefaultPresets as oe, LABEL_CLASSES as le, SIZE_CLASSES as ce, TRIGGER_CLASSES as ie, PRESET_BTN_CLASSES as $, ERROR_CLASSES as de, HELPER_CLASSES as be, ROOT_CLASSES as me, CALENDAR_HEADER_CLASSES as ue, NAV_BTN_CLASSES as G, MONTH_LABELS as pe, DAY_LABELS as he, DAY_TODAY_CLASSES as Se, DAY_IN_RANGE_CLASSES as fe, DAY_SELECTED_CLASSES as ge, DAY_DISABLED_CLASSES as Ee, DAY_HOVER_CLASSES as Le, DAY_BASE_CLASSES as ke } from "./DateRangePicker.const.js";
6
+ import { formatDate as W, getCalendarDays as Ae, isSameDay as Y, isInRange as Ne } from "./DateRangePicker.utils.js";
7
+ const F = ({ year: E, month: c, range: r, onDayClick: L, onNav: k, minDate: d, maxDate: A }) => {
8
+ const N = Ae(E, c), h = /* @__PURE__ */ new Date();
9
+ return h.setHours(0, 0, 0, 0), /* @__PURE__ */ i("div", { className: "bear-w-64", children: [
10
+ /* @__PURE__ */ i("div", { className: ue, children: [
11
+ /* @__PURE__ */ t("button", { type: "button", onClick: () => k(-1), className: G, "aria-label": "Previous month", children: /* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }),
12
+ /* @__PURE__ */ i("span", { className: "bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white", children: [
13
+ pe[c],
13
14
  " ",
14
- L
15
+ E
15
16
  ] }),
16
- /* @__PURE__ */ e("button", { type: "button", onClick: () => N(1), className: I, "aria-label": "Next month", children: /* @__PURE__ */ e("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }) })
17
+ /* @__PURE__ */ t("button", { type: "button", onClick: () => k(1), className: G, "aria-label": "Next month", children: /* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }) })
17
18
  ] }),
18
- /* @__PURE__ */ e("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5 bear-mb-1", children: ce.map((a) => /* @__PURE__ */ e("div", { className: "bear-text-xs bear-text-center bear-font-medium bear-text-gray-400 dark:bear-text-zinc-500 bear-py-1", children: a }, a)) }),
19
- /* @__PURE__ */ e("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5", children: k.map((a, _) => {
20
- if (!a) return /* @__PURE__ */ e("div", {}, `e-${_}`);
21
- const S = i && a < i || f && a > f, l = w(a, r.start) || w(a, r.end), d = pe(a, r.start, r.end), D = w(a, m);
22
- return /* @__PURE__ */ e(
19
+ /* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5 bear-mb-1", children: he.map((a) => /* @__PURE__ */ t("div", { className: "bear-text-xs bear-text-center bear-font-medium bear-text-gray-400 dark:bear-text-zinc-500 bear-py-1", children: a }, a)) }),
20
+ /* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5", children: N.map((a, x) => {
21
+ if (!a) return /* @__PURE__ */ t("div", {}, `e-${x}`);
22
+ const S = d && a < d || A && a > A, l = Y(a, r.start) || Y(a, r.end), b = Ne(a, r.start, r.end), _ = Y(a, h);
23
+ return /* @__PURE__ */ t(
23
24
  "button",
24
25
  {
25
26
  type: "button",
26
27
  disabled: !!S,
27
- onClick: () => A(a),
28
- className: E(
29
- ue,
30
- S ? me : Se,
31
- l && be,
32
- !l && d && de,
33
- !l && !d && D && ie,
34
- !l && !d && !S && "bear-text-gray-700 dark:bear-text-zinc-300"
28
+ onClick: () => L(a),
29
+ className: p(
30
+ ke,
31
+ S ? Ee : Le,
32
+ l && ge,
33
+ !l && b && fe,
34
+ !l && !b && _ && Se,
35
+ !l && !b && !S && "bear-text-gray-700 dark:bear-text-zinc-300"
35
36
  ),
36
37
  children: a.getDate()
37
38
  },
@@ -39,77 +40,102 @@ const H = ({ year: L, month: o, range: r, onDayClick: A, onNav: N, minDate: i, m
39
40
  );
40
41
  }) })
41
42
  ] });
42
- }, ke = (L) => {
43
+ }, Re = (E) => {
43
44
  const {
44
- value: o,
45
+ value: c,
45
46
  onChange: r,
46
- label: A,
47
- placeholder: N = "Select date range",
48
- disabled: i = !1,
49
- clearable: f = !0,
50
- minDate: k,
51
- maxDate: m,
47
+ label: L,
48
+ placeholder: k = "Select date range",
49
+ disabled: d = !1,
50
+ clearable: A = !0,
51
+ minDate: N,
52
+ maxDate: h,
52
53
  presets: a,
53
- showPresets: _ = !0,
54
+ showPresets: x = !0,
54
55
  size: S = "md",
55
56
  error: l,
56
- helperText: d,
57
- className: D,
58
- testId: j,
59
- ...V
60
- } = L, [y, v] = p(!1), [s, u] = p(o ?? { start: null, end: null }), [T, C] = p("start"), x = Q(null), Y = /* @__PURE__ */ new Date(), [b, W] = p(Y.getMonth()), [h, $] = p(Y.getFullYear()), G = b === 11 ? 0 : b + 1, F = b === 11 ? h + 1 : h;
61
- O(() => {
62
- o && u(o);
63
- }, [o]), O(() => {
64
- const t = (n) => {
65
- x.current && !x.current.contains(n.target) && v(!1);
57
+ helperText: b,
58
+ className: _,
59
+ testId: Z,
60
+ ...q
61
+ } = E, [w, D] = u(!1), [H, J] = u({ top: 0, left: 0 }), [s, f] = u(c ?? { start: null, end: null }), [M, C] = u("start"), z = P(null), R = P(null), O = P(null), I = /* @__PURE__ */ new Date(), [m, K] = u(I.getMonth()), [g, Q] = u(I.getFullYear()), U = m === 11 ? 0 : m + 1, X = m === 11 ? g + 1 : g;
62
+ T(() => {
63
+ c && f(c);
64
+ }, [c]), T(() => {
65
+ if (w && R.current) {
66
+ const e = R.current.getBoundingClientRect(), n = 8, o = 400, ne = window.innerHeight - e.bottom < o && e.top > o;
67
+ J({
68
+ top: ne ? e.top - o - n : e.bottom + n,
69
+ left: e.left
70
+ });
71
+ }
72
+ }, [w]), T(() => {
73
+ const e = (n) => {
74
+ var y, B;
75
+ const o = n.target;
76
+ (y = z.current) != null && y.contains(o) || (B = O.current) != null && B.contains(o) || D(!1);
66
77
  };
67
- return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
78
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
68
79
  }, []);
69
- const B = g((t) => {
70
- if (T === "start")
71
- u({ start: t, end: null }), C("end");
80
+ const j = v((e) => {
81
+ if (M === "start")
82
+ f({ start: e, end: null }), C("end");
72
83
  else {
73
- const n = t >= (s.start ?? t) ? { start: s.start, end: t } : { start: t, end: s.start };
74
- u(n), C("start"), r == null || r(n);
84
+ const n = e >= (s.start ?? e) ? { start: s.start, end: e } : { start: e, end: s.start };
85
+ f(n), C("start"), r == null || r(n);
75
86
  }
76
- }, [T, s.start, r]), Z = g((t) => {
77
- u(t), r == null || r(t), v(!1), C("start");
78
- }, [r]), q = g(() => {
79
- const t = { start: null, end: null };
80
- u(t), r == null || r(t), C("start");
81
- }, [r]), J = g((t) => {
82
- let n = b + t, R = h;
83
- n < 0 && (n = 11, R--), n > 11 && (n = 0, R++), W(n), $(R);
84
- }, [b, h]), M = a ?? (_ ? U() : []), K = s.start ? `${z(s.start)}${s.end ? ` – ${z(s.end)}` : ""}` : N;
85
- return /* @__PURE__ */ c("div", { ref: x, className: E(ne, D), "data-testid": j, ...V, children: [
86
- A && /* @__PURE__ */ e("label", { className: X, children: A }),
87
- /* @__PURE__ */ c(
87
+ }, [M, s.start, r]), ee = v((e) => {
88
+ f(e), r == null || r(e), D(!1), C("start");
89
+ }, [r]), te = v(() => {
90
+ const e = { start: null, end: null };
91
+ f(e), r == null || r(e), C("start");
92
+ }, [r]), re = v((e) => {
93
+ let n = m + e, o = g;
94
+ n < 0 && (n = 11, o--), n > 11 && (n = 0, o++), K(n), Q(o);
95
+ }, [m, g]), V = a ?? (x ? oe() : []), ae = s.start ? `${W(s.start)}${s.end ? ` – ${W(s.end)}` : ""}` : k;
96
+ return /* @__PURE__ */ i("div", { ref: z, className: p(me, _), "data-testid": Z, ...q, children: [
97
+ L && /* @__PURE__ */ t("label", { className: le, children: L }),
98
+ /* @__PURE__ */ i(
88
99
  "button",
89
100
  {
101
+ ref: R,
90
102
  type: "button",
91
- disabled: i,
92
- onClick: () => !i && v(!y),
93
- className: E(te, ee[S], i && "bear-opacity-50 bear-cursor-not-allowed"),
103
+ disabled: d,
104
+ onClick: () => !d && D(!w),
105
+ className: p(ie, ce[S], d && "bear-opacity-50 bear-cursor-not-allowed"),
94
106
  children: [
95
- /* @__PURE__ */ e("span", { className: E(!s.start && "bear-text-gray-400 dark:bear-text-zinc-500"), children: K }),
96
- /* @__PURE__ */ e("svg", { className: "bear-w-4 bear-h-4 bear-ml-2 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) })
107
+ /* @__PURE__ */ t("span", { className: p(!s.start && "bear-text-gray-400 dark:bear-text-zinc-500"), children: ae }),
108
+ /* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4 bear-ml-2 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) })
97
109
  ]
98
110
  }
99
111
  ),
100
- y && /* @__PURE__ */ e("div", { className: re, children: /* @__PURE__ */ c("div", { className: "bear-flex bear-gap-4", children: [
101
- M.length > 0 && /* @__PURE__ */ c("div", { className: "bear-border-r bear-border-gray-200 dark:bear-border-zinc-700 bear-pr-3 bear-space-y-1 bear-min-w-[120px]", children: [
102
- M.map((t) => /* @__PURE__ */ e("button", { type: "button", onClick: () => Z(t.range()), className: P, children: t.label }, t.label)),
103
- f && s.start && /* @__PURE__ */ e("button", { type: "button", onClick: q, className: E(P, "bear-text-red-500"), children: "Clear" })
104
- ] }),
105
- /* @__PURE__ */ e(H, { year: h, month: b, range: s, onDayClick: B, onNav: J, minDate: k, maxDate: m }),
106
- /* @__PURE__ */ e(H, { year: F, month: G, range: s, onDayClick: B, onNav: () => {
107
- }, minDate: k, maxDate: m })
108
- ] }) }),
109
- l && /* @__PURE__ */ e("p", { className: ae, children: l }),
110
- !l && d && /* @__PURE__ */ e("p", { className: se, children: d })
112
+ w && typeof document < "u" && se(
113
+ /* @__PURE__ */ t(
114
+ "div",
115
+ {
116
+ ref: O,
117
+ "data-bear-daterangepicker-dropdown": !0,
118
+ className: p(
119
+ "bear-fixed bear-z-[9999] bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4"
120
+ ),
121
+ style: { top: H.top, left: H.left },
122
+ children: /* @__PURE__ */ i("div", { className: "bear-flex bear-gap-4", children: [
123
+ V.length > 0 && /* @__PURE__ */ i("div", { className: "bear-border-r bear-border-gray-200 dark:bear-border-zinc-700 bear-pr-3 bear-space-y-1 bear-min-w-[120px]", children: [
124
+ V.map((e) => /* @__PURE__ */ t("button", { type: "button", onClick: () => ee(e.range()), className: $, children: e.label }, e.label)),
125
+ A && s.start && /* @__PURE__ */ t("button", { type: "button", onClick: te, className: p($, "bear-text-red-500"), children: "Clear" })
126
+ ] }),
127
+ /* @__PURE__ */ t(F, { year: g, month: m, range: s, onDayClick: j, onNav: re, minDate: N, maxDate: h }),
128
+ /* @__PURE__ */ t(F, { year: X, month: U, range: s, onDayClick: j, onNav: () => {
129
+ }, minDate: N, maxDate: h })
130
+ ] })
131
+ }
132
+ ),
133
+ document.body
134
+ ),
135
+ l && /* @__PURE__ */ t("p", { className: de, children: l }),
136
+ !l && b && /* @__PURE__ */ t("p", { className: be, children: b })
111
137
  ] });
112
138
  };
113
139
  export {
114
- ke as DateRangePicker
140
+ Re as DateRangePicker
115
141
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),s=require("react"),o=require("../../utils/cn.cjs"),r=require("./Dock.const.cjs"),S=(c,i,a,t,d)=>{if(i<0)return t;const l=Math.abs(c-i);if(l>a)return t;const u=1-l/(a+1);return t+(d-t)*u},O=c=>{const{items:i,position:a="bottom",iconSize:t=r.DEFAULT_ICON_SIZE,magnifiedSize:d=r.DEFAULT_MAGNIFIED_SIZE,magnification:l=!0,magnificationDistance:u=r.DEFAULT_MAGNIFICATION_DISTANCE,showLabels:p=!0,className:h,style:D,testId:I}=c,[f,x]=s.useState(-1),[k,_]=s.useState(""),m=s.useRef(null),y=a==="left"||a==="right",N=s.useCallback((e,n)=>{x(e),_(n.label)},[]),v=s.useCallback(()=>{x(-1),_("")},[]);return b.jsx("div",{ref:m,className:o.cn("Bear-Dock","bear-flex bear-items-end bear-gap-1","bear-rounded-2xl bear-px-2 bear-py-1.5","bear-bg-white/80 dark:bear-bg-gray-900/80","bear-backdrop-blur-xl","bear-border bear-border-gray-200/50 dark:bear-border-gray-700/50","bear-shadow-lg",r.DOCK_POSITION_CLASSES[a],y&&"bear-items-center",h),style:{padding:r.DOCK_PADDING,zIndex:r.DOCK_Z_INDEX,...D},"data-testid":I,role:"toolbar","aria-label":"Dock",onMouseLeave:v,children:i.map((e,n)=>{const g=l?S(n,f,u,t,d):t;return b.jsxs("div",{className:"Bear-Dock__item bear-relative bear-flex bear-flex-col bear-items-center",children:[p&&f===n&&k&&b.jsx("div",{className:o.cn("Bear-Dock__tooltip","bear-absolute bear-whitespace-nowrap","bear-px-2 bear-py-1 bear-rounded-lg","bear-bg-gray-900 dark:bear-bg-gray-100","bear-text-white dark:bear-text-gray-900","bear-text-xs bear-font-medium","bear-shadow-md bear-pointer-events-none",r.TOOLTIP_POSITION_CLASSES[a]),role:"tooltip",children:e.label}),b.jsx("button",{className:o.cn("Bear-Dock__button","bear-flex bear-items-center bear-justify-center bear-rounded-xl","bear-transition-all bear-origin-bottom","hover:bear-cursor-pointer",e.active&&"bear-ring-2 bear-ring-offset-1",e.disabled&&"bear-opacity-40 bear-cursor-not-allowed"),style:{width:g,height:g,transitionDuration:`${r.SPRING_DURATION}ms`,transitionTimingFunction:"cubic-bezier(0.25, 0.1, 0.25, 1)"},onClick:e.disabled?void 0:e.onClick,onMouseEnter:()=>N(n,e),disabled:e.disabled,"aria-label":e.label,children:b.jsx("span",{className:o.cn("Bear-Dock__icon","bear-flex bear-items-center bear-justify-center","bear-w-full bear-h-full bear-rounded-xl","bear-transition-transform",e.active?"bear-bg-[var(--bear-primary-500)] bear-text-white":"bear-bg-gray-100 dark:bear-bg-gray-800"),style:{fontSize:g*r.ICON_SCALE_RATIO},children:e.icon})}),e.badge!==void 0&&b.jsx("span",{className:o.cn("Bear-Dock__badge","bear-absolute bear--top-1 bear--right-1","bear-min-w-[18px] bear-h-[18px]","bear-flex bear-items-center bear-justify-center","bear-rounded-full bear-text-[10px] bear-font-bold","bear-text-white bear-leading-none bear-px-1","bear-bg-[var(--bear-danger-500,#ef4444)]"),children:e.badge}),e.active&&a==="bottom"&&b.jsx("div",{className:o.cn("Bear-Dock__dot","bear-w-1 bear-h-1 bear-rounded-full bear-mt-0.5","bear-bg-[var(--bear-primary-500)]"),"aria-hidden":"true"})]},e.id)})})};exports.Dock=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("react"),t=require("../../utils/cn.cjs"),a=require("./Dock.const.cjs"),N=require("./Dock.utils.cjs"),O=u=>{const{items:g,position:b="bottom",iconSize:i=a.DEFAULT_ICON_SIZE,magnifiedSize:x=a.DEFAULT_MAGNIFIED_SIZE,magnification:_=!0,magnificationDistance:f=a.DEFAULT_MAGNIFICATION_DISTANCE,showLabels:p=!0,className:h,style:D,testId:I}=u,[l,c]=n.useState(-1),[k,d]=n.useState(""),m=n.useRef(null),y=b==="left"||b==="right",S=n.useCallback((e,o)=>{c(e),d(o.label)},[]),v=n.useCallback(()=>{c(-1),d("")},[]);return r.jsx("div",{ref:m,className:t.cn("Bear-Dock","bear-flex bear-items-end bear-gap-1","bear-rounded-2xl bear-px-2 bear-py-1.5","bear-bg-white/80 dark:bear-bg-gray-900/80","bear-backdrop-blur-xl","bear-border bear-border-gray-200/50 dark:bear-border-gray-700/50","bear-shadow-lg",a.DOCK_POSITION_CLASSES[b],y&&"bear-items-center",h),style:{padding:a.DOCK_PADDING,zIndex:a.DOCK_Z_INDEX,...D},"data-testid":I,role:"toolbar","aria-label":"Dock",onMouseLeave:v,children:g.map((e,o)=>{const s=_?N.getScale(o,l,f,i,x):i;return r.jsxs("div",{className:"Bear-Dock__item bear-relative bear-flex bear-flex-col bear-items-center",children:[p&&l===o&&k&&r.jsx("div",{className:t.cn("Bear-Dock__tooltip","bear-absolute bear-whitespace-nowrap","bear-px-2 bear-py-1 bear-rounded-lg","bear-bg-gray-900 dark:bear-bg-gray-100","bear-text-white dark:bear-text-gray-900","bear-text-xs bear-font-medium","bear-shadow-md bear-pointer-events-none",a.TOOLTIP_POSITION_CLASSES[b]),role:"tooltip",children:e.label}),r.jsx("button",{className:t.cn("Bear-Dock__button","bear-flex bear-items-center bear-justify-center bear-rounded-xl","bear-transition-all bear-origin-bottom","hover:bear-cursor-pointer",e.active&&"bear-ring-2 bear-ring-offset-1",e.disabled&&"bear-opacity-40 bear-cursor-not-allowed"),style:{width:s,height:s,transitionDuration:`${a.SPRING_DURATION}ms`,transitionTimingFunction:"cubic-bezier(0.25, 0.1, 0.25, 1)"},onClick:e.disabled?void 0:e.onClick,onMouseEnter:()=>S(o,e),disabled:e.disabled,"aria-label":e.label,children:r.jsx("span",{className:t.cn("Bear-Dock__icon","bear-flex bear-items-center bear-justify-center","bear-w-full bear-h-full bear-rounded-xl","bear-transition-transform",e.active?"bear-bg-[var(--bear-primary-500)] bear-text-white":"bear-bg-gray-100 dark:bear-bg-gray-800"),style:{fontSize:s*a.ICON_SCALE_RATIO},children:e.icon})}),e.badge!==void 0&&r.jsx("span",{className:t.cn("Bear-Dock__badge","bear-absolute bear--top-1 bear--right-1","bear-min-w-[18px] bear-h-[18px]","bear-flex bear-items-center bear-justify-center","bear-rounded-full bear-text-[10px] bear-font-bold","bear-text-white bear-leading-none bear-px-1","bear-bg-[var(--bear-danger-500,#ef4444)]"),children:e.badge}),e.active&&b==="bottom"&&r.jsx("div",{className:t.cn("Bear-Dock__dot","bear-w-1 bear-h-1 bear-rounded-full bear-mt-0.5","bear-bg-[var(--bear-primary-500)]"),"aria-hidden":"true"})]},e.id)})})};exports.Dock=O;
@@ -1,35 +1,30 @@
1
- import { jsx as t, jsxs as S } from "react/jsx-runtime";
2
- import { useState as p, useRef as w, useCallback as m } from "react";
3
- import { cn as b } from "../../utils/cn.js";
4
- import { DEFAULT_ICON_SIZE as O, DEFAULT_MAGNIFIED_SIZE as A, DEFAULT_MAGNIFICATION_DISTANCE as C, DOCK_Z_INDEX as E, DOCK_PADDING as T, TOOLTIP_POSITION_CLASSES as L, SPRING_DURATION as B, ICON_SCALE_RATIO as M, DOCK_POSITION_CLASSES as F } from "./Dock.const.js";
5
- const j = (l, n, r, a, s) => {
6
- if (n < 0) return a;
7
- const i = Math.abs(l - n);
8
- if (i > r) return a;
9
- const c = 1 - i / (r + 1);
10
- return a + (s - a) * c;
11
- }, z = (l) => {
1
+ import { jsx as r, jsxs as S } from "react/jsx-runtime";
2
+ import { useState as d, useRef as w, useCallback as c } from "react";
3
+ import { cn as a } from "../../utils/cn.js";
4
+ import { DEFAULT_ICON_SIZE as O, DEFAULT_MAGNIFIED_SIZE as A, DEFAULT_MAGNIFICATION_DISTANCE as C, DOCK_Z_INDEX as E, DOCK_PADDING as T, TOOLTIP_POSITION_CLASSES as L, SPRING_DURATION as B, ICON_SCALE_RATIO as z, DOCK_POSITION_CLASSES as F } from "./Dock.const.js";
5
+ import { getScale as M } from "./Dock.utils.js";
6
+ const K = (g) => {
12
7
  const {
13
- items: n,
14
- position: r = "bottom",
15
- iconSize: a = O,
16
- magnifiedSize: s = A,
17
- magnification: i = !0,
18
- magnificationDistance: c = C,
8
+ items: u,
9
+ position: b = "bottom",
10
+ iconSize: n = O,
11
+ magnifiedSize: p = A,
12
+ magnification: f = !0,
13
+ magnificationDistance: m = C,
19
14
  showLabels: _ = !0,
20
15
  className: h,
21
16
  style: x,
22
- testId: D
23
- } = l, [u, g] = p(-1), [I, f] = p(""), y = w(null), N = r === "left" || r === "right", k = m((e, o) => {
24
- g(e), f(o.label);
25
- }, []), v = m(() => {
26
- g(-1), f("");
17
+ testId: I
18
+ } = g, [i, l] = d(-1), [D, s] = d(""), y = w(null), N = b === "left" || b === "right", k = c((e, t) => {
19
+ l(e), s(t.label);
20
+ }, []), v = c(() => {
21
+ l(-1), s("");
27
22
  }, []);
28
- return /* @__PURE__ */ t(
23
+ return /* @__PURE__ */ r(
29
24
  "div",
30
25
  {
31
26
  ref: y,
32
- className: b(
27
+ className: a(
33
28
  "Bear-Dock",
34
29
  "bear-flex bear-items-end bear-gap-1",
35
30
  "bear-rounded-2xl bear-px-2 bear-py-1.5",
@@ -37,7 +32,7 @@ const j = (l, n, r, a, s) => {
37
32
  "bear-backdrop-blur-xl",
38
33
  "bear-border bear-border-gray-200/50 dark:bear-border-gray-700/50",
39
34
  "bear-shadow-lg",
40
- F[r],
35
+ F[b],
41
36
  N && "bear-items-center",
42
37
  h
43
38
  ),
@@ -46,21 +41,21 @@ const j = (l, n, r, a, s) => {
46
41
  zIndex: E,
47
42
  ...x
48
43
  },
49
- "data-testid": D,
44
+ "data-testid": I,
50
45
  role: "toolbar",
51
46
  "aria-label": "Dock",
52
47
  onMouseLeave: v,
53
- children: n.map((e, o) => {
54
- const d = i ? j(o, u, c, a, s) : a;
48
+ children: u.map((e, t) => {
49
+ const o = f ? M(t, i, m, n, p) : n;
55
50
  return /* @__PURE__ */ S(
56
51
  "div",
57
52
  {
58
53
  className: "Bear-Dock__item bear-relative bear-flex bear-flex-col bear-items-center",
59
54
  children: [
60
- _ && u === o && I && /* @__PURE__ */ t(
55
+ _ && i === t && D && /* @__PURE__ */ r(
61
56
  "div",
62
57
  {
63
- className: b(
58
+ className: a(
64
59
  "Bear-Dock__tooltip",
65
60
  "bear-absolute bear-whitespace-nowrap",
66
61
  "bear-px-2 bear-py-1 bear-rounded-lg",
@@ -68,16 +63,16 @@ const j = (l, n, r, a, s) => {
68
63
  "bear-text-white dark:bear-text-gray-900",
69
64
  "bear-text-xs bear-font-medium",
70
65
  "bear-shadow-md bear-pointer-events-none",
71
- L[r]
66
+ L[b]
72
67
  ),
73
68
  role: "tooltip",
74
69
  children: e.label
75
70
  }
76
71
  ),
77
- /* @__PURE__ */ t(
72
+ /* @__PURE__ */ r(
78
73
  "button",
79
74
  {
80
- className: b(
75
+ className: a(
81
76
  "Bear-Dock__button",
82
77
  "bear-flex bear-items-center bear-justify-center bear-rounded-xl",
83
78
  "bear-transition-all bear-origin-bottom",
@@ -86,32 +81,32 @@ const j = (l, n, r, a, s) => {
86
81
  e.disabled && "bear-opacity-40 bear-cursor-not-allowed"
87
82
  ),
88
83
  style: {
89
- width: d,
90
- height: d,
84
+ width: o,
85
+ height: o,
91
86
  transitionDuration: `${B}ms`,
92
87
  transitionTimingFunction: "cubic-bezier(0.25, 0.1, 0.25, 1)"
93
88
  },
94
89
  onClick: e.disabled ? void 0 : e.onClick,
95
- onMouseEnter: () => k(o, e),
90
+ onMouseEnter: () => k(t, e),
96
91
  disabled: e.disabled,
97
92
  "aria-label": e.label,
98
- children: /* @__PURE__ */ t(
93
+ children: /* @__PURE__ */ r(
99
94
  "span",
100
95
  {
101
- className: b(
96
+ className: a(
102
97
  "Bear-Dock__icon",
103
98
  "bear-flex bear-items-center bear-justify-center",
104
99
  "bear-w-full bear-h-full bear-rounded-xl",
105
100
  "bear-transition-transform",
106
101
  e.active ? "bear-bg-[var(--bear-primary-500)] bear-text-white" : "bear-bg-gray-100 dark:bear-bg-gray-800"
107
102
  ),
108
- style: { fontSize: d * M },
103
+ style: { fontSize: o * z },
109
104
  children: e.icon
110
105
  }
111
106
  )
112
107
  }
113
108
  ),
114
- e.badge !== void 0 && /* @__PURE__ */ t("span", { className: b(
109
+ e.badge !== void 0 && /* @__PURE__ */ r("span", { className: a(
115
110
  "Bear-Dock__badge",
116
111
  "bear-absolute bear--top-1 bear--right-1",
117
112
  "bear-min-w-[18px] bear-h-[18px]",
@@ -120,10 +115,10 @@ const j = (l, n, r, a, s) => {
120
115
  "bear-text-white bear-leading-none bear-px-1",
121
116
  "bear-bg-[var(--bear-danger-500,#ef4444)]"
122
117
  ), children: e.badge }),
123
- e.active && r === "bottom" && /* @__PURE__ */ t(
118
+ e.active && b === "bottom" && /* @__PURE__ */ r(
124
119
  "div",
125
120
  {
126
- className: b(
121
+ className: a(
127
122
  "Bear-Dock__dot",
128
123
  "bear-w-1 bear-h-1 bear-rounded-full bear-mt-0.5",
129
124
  "bear-bg-[var(--bear-primary-500)]"
@@ -140,5 +135,5 @@ const j = (l, n, r, a, s) => {
140
135
  );
141
136
  };
142
137
  export {
143
- z as Dock
138
+ K as Dock
144
139
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=(n,r,o,t,u)=>{if(r<0)return t;const c=Math.abs(n-r);if(c>o)return t;const e=1-c/(o+1);return t+(u-t)*e};exports.getScale=f;
@@ -0,0 +1 @@
1
+ export declare const getScale: (index: number, hoverIndex: number, distance: number, baseSize: number, maxSize: number) => number;
@@ -0,0 +1,10 @@
1
+ const g = (o, r, f, t, c) => {
2
+ if (r < 0) return t;
3
+ const n = Math.abs(o - r);
4
+ if (n > f) return t;
5
+ const u = 1 - n / (f + 1);
6
+ return t + (c - t) * u;
7
+ };
8
+ export {
9
+ g as getScale
10
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),h=require("../../utils/cn.cjs"),_={xs:"bear-text-xs bear-py-1 bear-px-2",sm:"bear-text-sm bear-py-1.5 bear-px-3",md:"bear-text-sm bear-py-2 bear-px-3",lg:"bear-text-base bear-py-2.5 bear-px-4",xl:"bear-text-lg bear-py-3 bear-px-5"},B={"bottom-start":"bear-top-full bear-left-0 bear-mt-1","bottom-end":"bear-top-full bear-right-0 bear-mt-1",bottom:"bear-top-full bear-left-1/2 -bear-translate-x-1/2 bear-mt-1","top-start":"bear-bottom-full bear-left-0 bear-mb-1","top-end":"bear-bottom-full bear-right-0 bear-mb-1",top:"bear-bottom-full bear-left-1/2 -bear-translate-x-1/2 bear-mb-1",left:"bear-right-full bear-top-0 bear-mr-1",right:"bear-left-full bear-top-0 bear-ml-1"},K=({trigger:x,items:i,open:k,defaultOpen:N=!1,placement:S="bottom-start",offset:U=4,matchWidth:C=!1,minWidth:D=150,maxHeight:I=300,size:R="md",closeOnSelect:m=!0,closeOnClickOutside:v=!0,disabled:w=!1,onOpenChange:u,className:L,testId:A,...q})=>{var j;const[M,W]=r.useState(N),[o,d]=r.useState(-1),p=r.useRef(null),z=r.useRef(null),E=r.useRef(null),g=k!==void 0,b=g?k:M,f=r.useCallback(e=>{g||W(e),u==null||u(e)},[g,u]),F=r.useCallback(()=>{w||f(!b)},[w,b,f]),l=r.useCallback(()=>{f(!1),d(-1)},[f]),y=r.useCallback(e=>{var t;e.disabled||e.divider||e.header||((t=e.onClick)==null||t.call(e),m&&!e.items&&l())},[m,l]);r.useEffect(()=>{if(!v||!b)return;const e=t=>{p.current&&!p.current.contains(t.target)&&l()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[b,v,l]),r.useEffect(()=>{if(!b)return;const e=i.filter(a=>!a.disabled&&!a.divider&&!a.header),t=a=>{switch(a.key){case"Escape":a.preventDefault(),l();break;case"ArrowDown":a.preventDefault(),d(c=>{const s=c+1;return s>=e.length?0:s});break;case"ArrowUp":a.preventDefault(),d(c=>{const s=c-1;return s<0?e.length-1:s});break;case"Enter":case" ":a.preventDefault(),o>=0&&o<e.length&&y(e[o]);break}};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[b,i,o,l,y]),r.useEffect(()=>{b||d(-1)},[b]);const P=(e,t)=>{if(e.divider)return n.jsx("div",{className:"bear-my-1 bear-mx-2 bear-h-px bear-bg-gray-200 dark:bear-bg-gray-700",role:"separator"},e.key);if(e.header)return n.jsx("div",{className:"bear-px-3 bear-py-1.5 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-500 dark:bear-text-gray-400",children:e.label},e.key);const a=i.slice(0,t).filter(s=>!s.disabled&&!s.divider&&!s.header).length,c=o===a;return n.jsxs("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>y(e),onMouseEnter:()=>d(a),className:h.cn("bear-w-full bear-flex bear-items-center bear-gap-2 bear-text-left bear-border-none bear-bg-transparent",_[R],"bear-transition-colors bear-cursor-pointer",c&&"bear-bg-gray-100 dark:bear-bg-gray-800",e.danger?"bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-50 dark:hover:bear-bg-red-900/20":"bear-text-gray-700 dark:bear-text-gray-200 hover:bear-bg-gray-100 dark:hover:bear-bg-gray-800",e.disabled&&"bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none"),children:[e.icon&&n.jsx("span",{className:"bear-flex-shrink-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center",children:e.icon}),n.jsx("span",{className:"bear-flex-1",children:e.label}),e.trailing&&n.jsx("span",{className:"bear-flex-shrink-0 bear-text-gray-400",children:e.trailing}),e.items&&n.jsx("svg",{className:"bear-w-4 bear-h-4 bear-text-gray-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})]},e.key)},T=r.isValidElement(x)?r.cloneElement(x,{onClick:F,ref:E,"aria-expanded":b,"aria-haspopup":!0}):x;return n.jsxs("div",{ref:p,className:h.cn("bear-relative bear-inline-block",L),"data-testid":A,...q,children:[T,b&&n.jsx("div",{ref:z,role:"menu",className:h.cn("bear-absolute bear-z-50","bear-bg-white dark:bear-bg-gray-900","bear-border bear-border-gray-200 dark:bear-border-gray-700","bear-rounded-lg bear-shadow-lg","bear-py-1 bear-overflow-y-auto","bear-animate-in bear-fade-in-0 bear-zoom-in-95 bear-duration-100",B[S]),style:{minWidth:C?(j=E.current)==null?void 0:j.offsetWidth:D,maxHeight:I},children:i.map((e,t)=>P(e,t))})]})};exports.Dropdown=K;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("react"),h=require("../../utils/cn.cjs"),B=require("../../hooks/useClickOutside.cjs");require("../../context/BearProvider.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const K={xs:"bear-text-xs bear-py-1 bear-px-2",sm:"bear-text-sm bear-py-1.5 bear-px-3",md:"bear-text-sm bear-py-2 bear-px-3",lg:"bear-text-base bear-py-2.5 bear-px-4",xl:"bear-text-lg bear-py-3 bear-px-5"},U={"bottom-start":"bear-top-full bear-left-0 bear-mt-1","bottom-end":"bear-top-full bear-right-0 bear-mt-1",bottom:"bear-top-full bear-left-1/2 -bear-translate-x-1/2 bear-mt-1","top-start":"bear-bottom-full bear-left-0 bear-mb-1","top-end":"bear-bottom-full bear-right-0 bear-mb-1",top:"bear-bottom-full bear-left-1/2 -bear-translate-x-1/2 bear-mb-1",left:"bear-right-full bear-top-0 bear-mr-1",right:"bear-left-full bear-top-0 bear-ml-1"},V=({trigger:x,items:i,open:k,defaultOpen:j=!1,placement:N="bottom-start",offset:Z=4,matchWidth:S=!1,minWidth:D=150,maxHeight:I=300,size:R="md",closeOnSelect:y=!0,closeOnClickOutside:g=!0,disabled:m=!1,onOpenChange:u,className:q,testId:A,...L})=>{var C;const[M,W]=r.useState(j),[o,d]=r.useState(-1),w=r.useRef(null),z=r.useRef(null),E=r.useRef(null),p=k!==void 0,t=p?k:M,f=r.useCallback(e=>{p||W(e),u==null||u(e)},[p,u]),F=r.useCallback(()=>{m||f(!t)},[m,t,f]),n=r.useCallback(()=>{f(!1),d(-1)},[f]),v=r.useCallback(e=>{var b;e.disabled||e.divider||e.header||((b=e.onClick)==null||b.call(e),y&&!e.items&&n())},[y,n]),P=r.useCallback(()=>{t&&g&&n()},[t,g,n]);B.useClickOutside(w,P),r.useEffect(()=>{if(!t)return;const e=i.filter(a=>!a.disabled&&!a.divider&&!a.header),b=a=>{switch(a.key){case"Escape":a.preventDefault(),n();break;case"ArrowDown":a.preventDefault(),d(c=>{const l=c+1;return l>=e.length?0:l});break;case"ArrowUp":a.preventDefault(),d(c=>{const l=c-1;return l<0?e.length-1:l});break;case"Enter":case" ":a.preventDefault(),o>=0&&o<e.length&&v(e[o]);break}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[t,i,o,n,v]),r.useEffect(()=>{t||d(-1)},[t]);const T=(e,b)=>{if(e.divider)return s.jsx("div",{className:"bear-my-1 bear-mx-2 bear-h-px",style:{backgroundColor:"var(--bear-border-default)"},role:"separator"},e.key);if(e.header)return s.jsx("div",{className:"bear-px-3 bear-py-1.5 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider",style:{color:"var(--bear-text-muted)"},children:e.label},e.key);const a=i.slice(0,b).filter(l=>!l.disabled&&!l.divider&&!l.header).length,c=o===a;return s.jsxs("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>v(e),onMouseEnter:()=>d(a),className:h.cn("bear-w-full bear-flex bear-items-center bear-gap-2 bear-text-left bear-border-none bear-bg-transparent",K[R],"bear-transition-colors bear-cursor-pointer",c&&!e.danger&&"bear-bg-[var(--bear-bg-tertiary)]",e.danger&&"bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-50 dark:hover:bear-bg-red-900/20",!e.danger&&!e.disabled&&"hover:bear-bg-[var(--bear-bg-tertiary)]",e.disabled&&"bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none"),style:e.disabled?{color:"var(--bear-text-muted)"}:e.danger?void 0:{color:"var(--bear-text-secondary)"},children:[e.icon&&s.jsx("span",{className:"bear-flex-shrink-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center",children:e.icon}),s.jsx("span",{className:"bear-flex-1",children:e.label}),e.trailing&&s.jsx("span",{className:"bear-flex-shrink-0",style:{color:"var(--bear-text-muted)"},children:e.trailing}),e.items&&s.jsx("svg",{className:"bear-w-4 bear-h-4 bear-flex-shrink-0",style:{color:"var(--bear-text-muted)"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("polyline",{points:"9 18 15 12 9 6"})})]},e.key)},_=r.isValidElement(x)?r.cloneElement(x,{onClick:F,ref:E,"aria-expanded":t,"aria-haspopup":!0}):x;return s.jsxs("div",{ref:w,className:h.cn("bear-relative bear-inline-block",q),"data-testid":A,...L,children:[_,t&&s.jsx("div",{ref:z,role:"menu",className:h.cn("bear-absolute bear-z-50","bear-border bear-rounded-lg bear-shadow-lg","bear-py-1 bear-overflow-y-auto","bear-animate-in bear-fade-in-0 bear-zoom-in-95 bear-duration-100",U[N]),style:{backgroundColor:"var(--bear-bg-primary)",borderColor:"var(--bear-border-default)",minWidth:S?(C=E.current)==null?void 0:C.offsetWidth:D,maxHeight:I},children:i.map((e,b)=>T(e,b))})]})};exports.Dropdown=V;