@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,38 +1,38 @@
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";
1
+ import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
+ import { useState as h, useRef as P, useEffect as T, useCallback as _ } from "react";
3
+ import { createPortal as le } from "react-dom";
4
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],
5
+ import { getDefaultPresets as ie, LABEL_CLASSES as ce, SIZE_CLASSES as de, TRIGGER_CLASSES as be, PRESET_BTN_CLASSES as $, ERROR_CLASSES as me, HELPER_CLASSES as ue, ROOT_CLASSES as he, CALENDAR_HEADER_CLASSES as pe, NAV_BTN_CLASSES as G, MONTH_LABELS as Se, DAY_LABELS as fe, DAY_TODAY_CLASSES as we, DAY_IN_RANGE_CLASSES as Ee, DAY_SELECTED_CLASSES as ge, DAY_DISABLED_CLASSES as Le, DAY_HOVER_CLASSES as ve, DAY_BASE_CLASSES as Ae } from "./DateRangePicker.const.js";
6
+ import { formatDate as F, getCalendarDays as ke, isSameDay as Y, isInRange as xe } from "./DateRangePicker.utils.js";
7
+ const Z = ({ year: L, month: c, range: r, onDayClick: v, onNav: A, minDate: b, maxDate: k }) => {
8
+ const x = ke(L, c), S = /* @__PURE__ */ new Date();
9
+ return S.setHours(0, 0, 0, 0), /* @__PURE__ */ d("div", { className: "bear-w-64", children: [
10
+ /* @__PURE__ */ d("div", { className: pe, children: [
11
+ /* @__PURE__ */ t("button", { type: "button", onClick: () => A(-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__ */ d("span", { className: "bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white", children: [
13
+ Se[c],
14
14
  " ",
15
- E
15
+ L
16
16
  ] }),
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
+ /* @__PURE__ */ t("button", { type: "button", onClick: () => A(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" }) }) })
18
18
  ] }),
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);
19
+ /* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5 bear-mb-1", children: fe.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: x.map((a, D) => {
21
+ if (!a) return /* @__PURE__ */ t("div", {}, `e-${D}`);
22
+ const f = b && a < b || k && a > k, l = Y(a, r.start) || Y(a, r.end), m = xe(a, r.start, r.end), R = Y(a, S);
23
23
  return /* @__PURE__ */ t(
24
24
  "button",
25
25
  {
26
26
  type: "button",
27
- disabled: !!S,
28
- onClick: () => L(a),
27
+ disabled: !!f,
28
+ onClick: () => v(a),
29
29
  className: p(
30
- ke,
31
- S ? Ee : Le,
30
+ Ae,
31
+ f ? Le : ve,
32
32
  l && ge,
33
- !l && b && fe,
34
- !l && !b && _ && Se,
35
- !l && !b && !S && "bear-text-gray-700 dark:bear-text-zinc-300"
33
+ !l && m && Ee,
34
+ !l && !m && R && we,
35
+ !l && !m && !f && "bear-text-gray-700 dark:bear-text-zinc-300"
36
36
  ),
37
37
  children: a.getDate()
38
38
  },
@@ -40,102 +40,107 @@ const F = ({ year: E, month: c, range: r, onDayClick: L, onNav: k, minDate: d, m
40
40
  );
41
41
  }) })
42
42
  ] });
43
- }, Re = (E) => {
43
+ }, Pe = (L) => {
44
44
  const {
45
45
  value: c,
46
46
  onChange: r,
47
- label: L,
48
- placeholder: k = "Select date range",
49
- disabled: d = !1,
50
- clearable: A = !0,
51
- minDate: N,
52
- maxDate: h,
47
+ label: v,
48
+ placeholder: A = "Select date range",
49
+ disabled: b = !1,
50
+ clearable: k = !0,
51
+ minDate: x,
52
+ maxDate: S,
53
53
  presets: a,
54
- showPresets: x = !0,
55
- size: S = "md",
54
+ showPresets: D = !0,
55
+ size: f = "md",
56
56
  error: l,
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;
57
+ helperText: m,
58
+ className: R,
59
+ testId: q,
60
+ ...J
61
+ } = L, [N, y] = h(!1), [z, K] = h({ top: 0, left: 0 }), [s, w] = h(c ?? { start: null, end: null }), [H, C] = h("start"), O = P(null), M = P(null), I = P(null), W = /* @__PURE__ */ new Date(), [u, Q] = h(W.getMonth()), [E, U] = h(W.getFullYear()), X = u === 11 ? 0 : u + 1, ee = u === 11 ? E + 1 : E;
62
62
  T(() => {
63
- c && f(c);
63
+ c && w(c);
64
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(() => {
65
+ if (!N || !M.current) return;
66
+ const e = 8, n = 420, o = () => {
67
+ const i = M.current.getBoundingClientRect(), g = window.innerHeight;
68
+ let B = g - i.bottom < n && i.top > n ? i.top - n - e : i.bottom + e;
69
+ B = Math.max(8, Math.min(B, g - n - 8));
70
+ const se = Math.min(640, window.innerWidth - 16);
71
+ let oe = Math.max(8, Math.min(i.left, window.innerWidth - se - 8));
72
+ K({ top: B, left: oe });
73
+ };
74
+ return o(), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), () => {
75
+ window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0);
76
+ };
77
+ }, [N]), T(() => {
73
78
  const e = (n) => {
74
- var y, B;
79
+ var i, g;
75
80
  const o = n.target;
76
- (y = z.current) != null && y.contains(o) || (B = O.current) != null && B.contains(o) || D(!1);
81
+ (i = O.current) != null && i.contains(o) || (g = I.current) != null && g.contains(o) || y(!1);
77
82
  };
78
83
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
79
84
  }, []);
80
- const j = v((e) => {
81
- if (M === "start")
82
- f({ start: e, end: null }), C("end");
85
+ const j = _((e) => {
86
+ if (H === "start")
87
+ w({ start: e, end: null }), C("end");
83
88
  else {
84
89
  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);
90
+ w(n), C("start"), r == null || r(n);
86
91
  }
87
- }, [M, s.start, r]), ee = v((e) => {
88
- f(e), r == null || r(e), D(!1), C("start");
89
- }, [r]), te = v(() => {
92
+ }, [H, s.start, r]), te = _((e) => {
93
+ w(e), r == null || r(e), y(!1), C("start");
94
+ }, [r]), re = _(() => {
90
95
  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(
96
+ w(e), r == null || r(e), C("start");
97
+ }, [r]), ae = _((e) => {
98
+ let n = u + e, o = E;
99
+ n < 0 && (n = 11, o--), n > 11 && (n = 0, o++), Q(n), U(o);
100
+ }, [u, E]), V = a ?? (D ? ie() : []), ne = s.start ? `${F(s.start)}${s.end ? ` – ${F(s.end)}` : ""}` : A;
101
+ return /* @__PURE__ */ d("div", { ref: O, className: p(he, R), "data-testid": q, ...J, children: [
102
+ v && /* @__PURE__ */ t("label", { className: ce, children: v }),
103
+ /* @__PURE__ */ d(
99
104
  "button",
100
105
  {
101
- ref: R,
106
+ ref: M,
102
107
  type: "button",
103
- disabled: d,
104
- onClick: () => !d && D(!w),
105
- className: p(ie, ce[S], d && "bear-opacity-50 bear-cursor-not-allowed"),
108
+ disabled: b,
109
+ onClick: () => !b && y(!N),
110
+ className: p(be, de[f], b && "bear-opacity-50 bear-cursor-not-allowed"),
106
111
  children: [
107
- /* @__PURE__ */ t("span", { className: p(!s.start && "bear-text-gray-400 dark:bear-text-zinc-500"), children: ae }),
112
+ /* @__PURE__ */ t("span", { className: p(!s.start && "bear-text-gray-400 dark:bear-text-zinc-500"), children: ne }),
108
113
  /* @__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" }) })
109
114
  ]
110
115
  }
111
116
  ),
112
- w && typeof document < "u" && se(
117
+ N && typeof document < "u" && le(
113
118
  /* @__PURE__ */ t(
114
119
  "div",
115
120
  {
116
- ref: O,
121
+ ref: I,
117
122
  "data-bear-daterangepicker-dropdown": !0,
118
123
  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"
124
+ "bear-fixed bear-z-[10000] bear-max-w-[calc(100vw-16px)] 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 bear-overflow-x-auto"
120
125
  ),
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
+ style: { top: z.top, left: z.left },
127
+ children: /* @__PURE__ */ d("div", { className: "bear-flex bear-gap-4", children: [
128
+ V.length > 0 && /* @__PURE__ */ d("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: [
129
+ V.map((e) => /* @__PURE__ */ t("button", { type: "button", onClick: () => te(e.range()), className: $, children: e.label }, e.label)),
130
+ k && s.start && /* @__PURE__ */ t("button", { type: "button", onClick: re, className: p($, "bear-text-red-500"), children: "Clear" })
126
131
  ] }),
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 })
132
+ /* @__PURE__ */ t(Z, { year: E, month: u, range: s, onDayClick: j, onNav: ae, minDate: x, maxDate: S }),
133
+ /* @__PURE__ */ t(Z, { year: ee, month: X, range: s, onDayClick: j, onNav: () => {
134
+ }, minDate: x, maxDate: S })
130
135
  ] })
131
136
  }
132
137
  ),
133
138
  document.body
134
139
  ),
135
- l && /* @__PURE__ */ t("p", { className: de, children: l }),
136
- !l && b && /* @__PURE__ */ t("p", { className: be, children: b })
140
+ l && /* @__PURE__ */ t("p", { className: me, children: l }),
141
+ !l && m && /* @__PURE__ */ t("p", { className: ue, children: m })
137
142
  ] });
138
143
  };
139
144
  export {
140
- Re as DateRangePicker
145
+ Pe as DateRangePicker
141
146
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),A=require("react"),D=require("../../utils/cn.cjs"),F=require("../Typography/Typography.cjs"),S=require("./DiffSquares.const.cjs"),E=require("./DiffSquares.utils.cjs"),N=({additionsText:n,deletionsText:t,cubeCount:c=S.DIFF_SQUARES_DEFAULT_COUNT,cubes:r,additionColor:m="var(--bear-colors-success-500, #22c55e)",deletionColor:q="var(--bear-colors-danger-500, #ef4444)",gap:_=S.DIFF_SQUARES_GAP,summaryTypographyProps:s,onCubeClick:i,onCubeHover:e,className:h,testId:j,...x})=>{const d=A.useMemo(()=>r!=null&&r.length?r:Array.from({length:c},()=>({fill:"full"})),[r,c]),g={variant:"body2",component:"span",...s,className:D.cn("bear-flex bear-shrink-0 bear-items-baseline bear-gap-1.5 bear-font-mono bear-font-semibold",s==null?void 0:s.className)};return l.jsxs("div",{className:D.cn("Bear-DiffSquares bear-inline-flex bear-min-w-0 bear-max-w-full bear-items-center bear-gap-2",h),"data-testid":j,...x,children:[(n!=null||t!=null)&&l.jsxs(F.Typography,{...g,children:[n!=null&&l.jsx("span",{style:{color:m},children:n}),t!=null&&l.jsx("span",{style:{color:q},children:t})]}),l.jsx("span",{className:"bear-inline-flex bear-items-center bear-flex-shrink-0",style:{gap:_},role:"img","aria-label":"Change density",children:d.map((a,f)=>l.jsx("span",{className:S.DIFF_SQUARES_CUBE_CLASS,style:E.getDiffCubeStyle(a,m,q),"aria-hidden":!(a!=null&&a.ariaLabel),title:a==null?void 0:a.ariaLabel,onMouseEnter:()=>e==null?void 0:e(a,f),onMouseLeave:()=>e==null?void 0:e(null,null),onClick:()=>i==null?void 0:i(a,f)},f))})]})};exports.DiffSquares=N;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=5,r="Bear-DiffSquares__cube bear-inline-block bear-w-2.5 bear-h-2.5 sm:bear-w-3 sm:bear-h-3 bear-rounded bear-shrink-0 bear-ring-1 bear-ring-inset bear-ring-black/18 dark:bear-ring-white/22 motion-reduce:bear-animate-none",a=4;exports.DIFF_SQUARES_CUBE_CLASS=r;exports.DIFF_SQUARES_DEFAULT_COUNT=e;exports.DIFF_SQUARES_GAP=a;
@@ -0,0 +1,3 @@
1
+ export declare const DIFF_SQUARES_DEFAULT_COUNT = 5;
2
+ export declare const DIFF_SQUARES_CUBE_CLASS = "Bear-DiffSquares__cube bear-inline-block bear-w-2.5 bear-h-2.5 sm:bear-w-3 sm:bear-h-3 bear-rounded bear-shrink-0 bear-ring-1 bear-ring-inset bear-ring-black/18 dark:bear-ring-white/22 motion-reduce:bear-animate-none";
3
+ export declare const DIFF_SQUARES_GAP = 4;
@@ -0,0 +1,6 @@
1
+ const e = 5, r = "Bear-DiffSquares__cube bear-inline-block bear-w-2.5 bear-h-2.5 sm:bear-w-3 sm:bear-h-3 bear-rounded bear-shrink-0 bear-ring-1 bear-ring-inset bear-ring-black/18 dark:bear-ring-white/22 motion-reduce:bear-animate-none", a = 4;
2
+ export {
3
+ r as DIFF_SQUARES_CUBE_CLASS,
4
+ e as DIFF_SQUARES_DEFAULT_COUNT,
5
+ a as DIFF_SQUARES_GAP
6
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { DiffSquaresProps } from './DiffSquares.types';
3
+ export declare const DiffSquares: FC<DiffSquaresProps>;
@@ -0,0 +1,70 @@
1
+ import { jsxs as h, jsx as e } from "react/jsx-runtime";
2
+ import { useMemo as L } from "react";
3
+ import { cn as A } from "../../utils/cn.js";
4
+ import { Typography as g } from "../Typography/Typography.js";
5
+ import { DIFF_SQUARES_DEFAULT_COUNT as p, DIFF_SQUARES_GAP as x, DIFF_SQUARES_CUBE_CLASS as I } from "./DiffSquares.const.js";
6
+ import { getDiffCubeStyle as M } from "./DiffSquares.utils.js";
7
+ const B = ({
8
+ additionsText: s,
9
+ deletionsText: t,
10
+ cubeCount: m = p,
11
+ cubes: r,
12
+ additionColor: S = "var(--bear-colors-success-500, #22c55e)",
13
+ deletionColor: _ = "var(--bear-colors-danger-500, #ef4444)",
14
+ gap: D = x,
15
+ summaryTypographyProps: n,
16
+ onCubeClick: i,
17
+ onCubeHover: l,
18
+ className: F,
19
+ testId: E,
20
+ ...N
21
+ }) => {
22
+ const U = L(() => r != null && r.length ? r : Array.from({ length: m }, () => ({ fill: "full" })), [r, m]), d = {
23
+ variant: "body2",
24
+ component: "span",
25
+ ...n,
26
+ className: A(
27
+ "bear-flex bear-shrink-0 bear-items-baseline bear-gap-1.5 bear-font-mono bear-font-semibold",
28
+ n == null ? void 0 : n.className
29
+ )
30
+ };
31
+ return /* @__PURE__ */ h(
32
+ "div",
33
+ {
34
+ className: A("Bear-DiffSquares bear-inline-flex bear-min-w-0 bear-max-w-full bear-items-center bear-gap-2", F),
35
+ "data-testid": E,
36
+ ...N,
37
+ children: [
38
+ (s != null || t != null) && /* @__PURE__ */ h(g, { ...d, children: [
39
+ s != null && /* @__PURE__ */ e("span", { style: { color: S }, children: s }),
40
+ t != null && /* @__PURE__ */ e("span", { style: { color: _ }, children: t })
41
+ ] }),
42
+ /* @__PURE__ */ e(
43
+ "span",
44
+ {
45
+ className: "bear-inline-flex bear-items-center bear-flex-shrink-0",
46
+ style: { gap: D },
47
+ role: "img",
48
+ "aria-label": "Change density",
49
+ children: U.map((a, f) => /* @__PURE__ */ e(
50
+ "span",
51
+ {
52
+ className: I,
53
+ style: M(a, S, _),
54
+ "aria-hidden": !(a != null && a.ariaLabel),
55
+ title: a == null ? void 0 : a.ariaLabel,
56
+ onMouseEnter: () => l == null ? void 0 : l(a, f),
57
+ onMouseLeave: () => l == null ? void 0 : l(null, null),
58
+ onClick: () => i == null ? void 0 : i(a, f)
59
+ },
60
+ f
61
+ ))
62
+ }
63
+ )
64
+ ]
65
+ }
66
+ );
67
+ };
68
+ export {
69
+ B as DiffSquares
70
+ };
@@ -0,0 +1,23 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ import { TypographyProps } from '../Typography/Typography.types';
3
+ export type DiffCubeFill = 'full' | 'empty' | 'half' | 'striped';
4
+ export interface DiffCube {
5
+ fill?: DiffCubeFill;
6
+ color?: string;
7
+ secondaryColor?: string;
8
+ gradient?: string;
9
+ ariaLabel?: string;
10
+ }
11
+ export interface DiffSquaresProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
12
+ additionsText?: ReactNode;
13
+ deletionsText?: ReactNode;
14
+ cubeCount?: number;
15
+ cubes?: DiffCube[];
16
+ additionColor?: string;
17
+ deletionColor?: string;
18
+ gap?: number;
19
+ summaryTypographyProps?: Partial<TypographyProps>;
20
+ onCubeClick?: (cube: DiffCube, index: number) => void;
21
+ onCubeHover?: (cube: DiffCube | null, index: number | null) => void;
22
+ testId?: string;
23
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(r,i,a){const t=(r==null?void 0:r.fill)??"full",n=(r==null?void 0:r.color)??i,o=(r==null?void 0:r.secondaryColor)??a;return r!=null&&r.gradient?{background:r.gradient}:t==="empty"?{backgroundColor:"transparent",boxShadow:`inset 0 0 0 1px ${n}55`}:t==="half"?{background:`linear-gradient(90deg, ${n} 50%, ${o} 50%)`}:t==="striped"?{background:`repeating-linear-gradient(135deg, ${n}, ${n} 2px, ${o} 2px, ${o} 4px)`}:{backgroundColor:n}}exports.getDiffCubeStyle=l;
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'react';
2
+ import { DiffCube } from './DiffSquares.types';
3
+ export declare function getDiffCubeStyle(cube: DiffCube | undefined, additionFallback: string, deletionFallback: string): CSSProperties;
@@ -0,0 +1,12 @@
1
+ function d(r, a, i) {
2
+ const o = (r == null ? void 0 : r.fill) ?? "full", n = (r == null ? void 0 : r.color) ?? a, t = (r == null ? void 0 : r.secondaryColor) ?? i;
3
+ return r != null && r.gradient ? { background: r.gradient } : o === "empty" ? {
4
+ backgroundColor: "transparent",
5
+ boxShadow: `inset 0 0 0 1px ${n}55`
6
+ } : o === "half" ? { background: `linear-gradient(90deg, ${n} 50%, ${t} 50%)` } : o === "striped" ? {
7
+ background: `repeating-linear-gradient(135deg, ${n}, ${n} 2px, ${t} 2px, ${t} 4px)`
8
+ } : { backgroundColor: n };
9
+ }
10
+ export {
11
+ d as getDiffCubeStyle
12
+ };
@@ -0,0 +1,2 @@
1
+ export { DiffSquares } from './DiffSquares';
2
+ export type { DiffSquaresProps, DiffCube, DiffCubeFill } from './DiffSquares.types';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),j=require("react-dom"),x=require("../../utils/cn.cjs"),N=require("../Icon/index.cjs"),d=300,q={left:{sm:"bear-w-64",md:"bear-w-80",lg:"bear-w-96",xl:"bear-w-[32rem]"},right:{sm:"bear-w-64",md:"bear-w-80",lg:"bear-w-96",xl:"bear-w-[32rem]"},top:{sm:"bear-h-32",md:"bear-h-48",lg:"bear-h-64",xl:"bear-h-96"},bottom:{sm:"bear-h-32",md:"bear-h-48",lg:"bear-h-64",xl:"bear-h-96"}},C={left:"bear-left-0 bear-top-0 bear-h-full",right:"bear-right-0 bear-top-0 bear-h-full",top:"bear-top-0 bear-left-0 bear-w-full",bottom:"bear-bottom-0 bear-left-0 bear-w-full"},D={left:"bear-translate-x-0",right:"bear-translate-x-0",top:"bear-translate-y-0",bottom:"bear-translate-y-0"},E={left:"-bear-translate-x-full",right:"bear-translate-x-full",top:"-bear-translate-y-full",bottom:"bear-translate-y-full"},S=({isOpen:s,onClose:l,title:o,children:w,side:e="right",size:g="md",showCloseButton:u=!0,closeOnBackdrop:y=!0,closeOnEscape:c=!0,className:p})=>{const[t,m]=a.useState(s),[f,n]=a.useState(!1),[v,h]=a.useState(!1);a.useEffect(()=>{if(s){m(!0),n(!1);const b=requestAnimationFrame(()=>h(!0));return()=>cancelAnimationFrame(b)}if(t){h(!1),n(!0);const b=setTimeout(()=>{m(!1),n(!1)},d);return()=>clearTimeout(b)}},[s,t]);const i=a.useCallback(b=>{c&&b.key==="Escape"&&l()},[c,l]);if(a.useEffect(()=>(t&&(document.addEventListener("keydown",i),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",i),document.body.style.overflow=""}),[t,i]),!t)return null;const k=r.jsxs("div",{className:"bear-fixed bear-inset-0 bear-z-50",children:[r.jsx("div",{className:x.cn("bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",f?"bear-opacity-0":"bear-opacity-100"),style:{transitionDuration:`${d}ms`},onClick:y?l:void 0,"aria-hidden":"true"}),r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":o?"drawer-title":void 0,className:x.cn("bear-absolute bear-bg-white dark:bear-bg-neutral-900 bear-shadow-2xl","bear-border-neutral-200 dark:bear-border-neutral-700 bear-overflow-hidden","bear-transform bear-transition-transform",e==="left"&&"bear-border-r",e==="right"&&"bear-border-l",e==="top"&&"bear-border-b",e==="bottom"&&"bear-border-t",C[e],q[e][g],v&&!f?D[e]:E[e],p),style:{transitionDuration:`${d}ms`},children:[(o||u)&&r.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700",children:[o&&r.jsx("h2",{id:"drawer-title",className:"bear-text-lg bear-font-semibold bear-text-neutral-900 dark:bear-text-white",children:o}),u&&r.jsx("button",{onClick:l,className:"bear-p-1 bear-rounded-lg bear-text-neutral-500 dark:bear-text-neutral-400 hover:bear-text-neutral-900 dark:hover:bear-text-white hover:bear-bg-neutral-100 dark:hover:bear-bg-neutral-700 bear-transition-colors","aria-label":"Close drawer",children:r.jsx(N.XIcon,{className:"bear-w-5 bear-h-5"})})]}),r.jsx("div",{className:"bear-flex-1 bear-overflow-y-auto bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300",children:w})]})]});return j.createPortal(k,document.body)};exports.Drawer=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),j=require("react-dom"),x=require("../../utils/cn.cjs"),N=require("../Icon/index.cjs"),m=300,q={left:{sm:"bear-w-full sm:bear-w-64 bear-max-w-full sm:bear-max-w-none",md:"bear-w-full sm:bear-w-80 bear-max-w-full sm:bear-max-w-none",lg:"bear-w-full sm:bear-w-96 bear-max-w-full sm:bear-max-w-none",xl:"bear-w-full sm:bear-w-[32rem] bear-max-w-full sm:bear-max-w-none"},right:{sm:"bear-w-full sm:bear-w-64 bear-max-w-full sm:bear-max-w-none",md:"bear-w-full sm:bear-w-80 bear-max-w-full sm:bear-max-w-none",lg:"bear-w-full sm:bear-w-96 bear-max-w-full sm:bear-max-w-none",xl:"bear-w-full sm:bear-w-[32rem] bear-max-w-full sm:bear-max-w-none"},top:{sm:"bear-h-32",md:"bear-h-48",lg:"bear-h-64",xl:"bear-h-96"},bottom:{sm:"bear-h-32",md:"bear-h-48",lg:"bear-h-64",xl:"bear-h-96"}},C={left:"bear-left-0 bear-top-0 bear-h-full",right:"bear-right-0 bear-top-0 bear-h-full",top:"bear-top-0 bear-left-0 bear-w-full",bottom:"bear-bottom-0 bear-left-0 bear-w-full"},D={left:"bear-translate-x-0",right:"bear-translate-x-0",top:"bear-translate-y-0",bottom:"bear-translate-y-0"},E={left:"-bear-translate-x-full",right:"bear-translate-x-full",top:"-bear-translate-y-full",bottom:"bear-translate-y-full"},S=({isOpen:n,onClose:l,title:s,children:h,side:e="right",size:g="md",showCloseButton:i=!0,closeOnBackdrop:y=!0,closeOnEscape:d=!0,className:p})=>{const[t,f]=a.useState(n),[c,o]=a.useState(!1),[v,w]=a.useState(!1);a.useEffect(()=>{if(n){f(!0),o(!1);const b=requestAnimationFrame(()=>w(!0));return()=>cancelAnimationFrame(b)}if(t){w(!1),o(!0);const b=setTimeout(()=>{f(!1),o(!1)},m);return()=>clearTimeout(b)}},[n,t]);const u=a.useCallback(b=>{d&&b.key==="Escape"&&l()},[d,l]);if(a.useEffect(()=>(t&&(document.addEventListener("keydown",u),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",u),document.body.style.overflow=""}),[t,u]),!t)return null;const k=r.jsxs("div",{className:"bear-fixed bear-inset-0 bear-z-[11000]",children:[r.jsx("div",{className:x.cn("bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",c?"bear-opacity-0":"bear-opacity-100"),style:{transitionDuration:`${m}ms`},onClick:y?l:void 0,"aria-hidden":"true"}),r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":s?"drawer-title":void 0,className:x.cn("bear-absolute bear-bg-white dark:bear-bg-neutral-900 bear-shadow-2xl","bear-border-neutral-200 dark:bear-border-neutral-700 bear-overflow-hidden","bear-transform bear-transition-transform",e==="left"&&"bear-border-r",e==="right"&&"bear-border-l",e==="top"&&"bear-border-b",e==="bottom"&&"bear-border-t",C[e],q[e][g],v&&!c?D[e]:E[e],p),style:{transitionDuration:`${m}ms`},children:[(s||i)&&r.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700",children:[s&&r.jsx("h2",{id:"drawer-title",className:"bear-text-lg bear-font-semibold bear-text-neutral-900 dark:bear-text-white",children:s}),i&&r.jsx("button",{onClick:l,className:"bear-p-1 bear-rounded-lg bear-text-neutral-500 dark:bear-text-neutral-400 hover:bear-text-neutral-900 dark:hover:bear-text-white hover:bear-bg-neutral-100 dark:hover:bear-bg-neutral-700 bear-transition-colors","aria-label":"Close drawer",children:r.jsx(N.XIcon,{className:"bear-w-5 bear-h-5"})})]}),r.jsx("div",{className:"bear-flex-1 bear-overflow-y-auto bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300",children:h})]})]});return j.createPortal(k,document.body)};exports.Drawer=S;
@@ -1,20 +1,20 @@
1
- import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import { useState as d, useEffect as p, useCallback as A } from "react";
1
+ import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
+ import { useState as u, useEffect as h, useCallback as A } from "react";
3
3
  import { createPortal as E } from "react-dom";
4
- import { cn as x } from "../../utils/cn.js";
4
+ import { cn as p } from "../../utils/cn.js";
5
5
  import { XIcon as I } from "../Icon/index.js";
6
- const m = 300, D = {
6
+ const i = 300, D = {
7
7
  left: {
8
- sm: "bear-w-64",
9
- md: "bear-w-80",
10
- lg: "bear-w-96",
11
- xl: "bear-w-[32rem]"
8
+ sm: "bear-w-full sm:bear-w-64 bear-max-w-full sm:bear-max-w-none",
9
+ md: "bear-w-full sm:bear-w-80 bear-max-w-full sm:bear-max-w-none",
10
+ lg: "bear-w-full sm:bear-w-96 bear-max-w-full sm:bear-max-w-none",
11
+ xl: "bear-w-full sm:bear-w-[32rem] bear-max-w-full sm:bear-max-w-none"
12
12
  },
13
13
  right: {
14
- sm: "bear-w-64",
15
- md: "bear-w-80",
16
- lg: "bear-w-96",
17
- xl: "bear-w-[32rem]"
14
+ sm: "bear-w-full sm:bear-w-64 bear-max-w-full sm:bear-max-w-none",
15
+ md: "bear-w-full sm:bear-w-80 bear-max-w-full sm:bear-max-w-none",
16
+ lg: "bear-w-full sm:bear-w-96 bear-max-w-full sm:bear-max-w-none",
17
+ xl: "bear-w-full sm:bear-w-[32rem] bear-max-w-full sm:bear-max-w-none"
18
18
  },
19
19
  top: {
20
20
  sm: "bear-h-32",
@@ -44,61 +44,61 @@ const m = 300, D = {
44
44
  top: "-bear-translate-y-full",
45
45
  bottom: "bear-translate-y-full"
46
46
  }, _ = ({
47
- isOpen: l,
47
+ isOpen: o,
48
48
  onClose: b,
49
- title: o,
49
+ title: l,
50
50
  children: g,
51
51
  side: e = "right",
52
52
  size: y = "md",
53
- showCloseButton: u = !0,
53
+ showCloseButton: d = !0,
54
54
  closeOnBackdrop: v = !0,
55
- closeOnEscape: c = !0,
55
+ closeOnEscape: f = !0,
56
56
  className: k
57
57
  }) => {
58
- const [r, f] = d(l), [h, n] = d(!1), [N, w] = d(!1);
59
- p(() => {
60
- if (l) {
61
- f(!0), n(!1);
62
- const a = requestAnimationFrame(() => w(!0));
58
+ const [r, w] = u(o), [c, n] = u(!1), [N, x] = u(!1);
59
+ h(() => {
60
+ if (o) {
61
+ w(!0), n(!1);
62
+ const a = requestAnimationFrame(() => x(!0));
63
63
  return () => cancelAnimationFrame(a);
64
64
  }
65
65
  if (r) {
66
- w(!1), n(!0);
66
+ x(!1), n(!0);
67
67
  const a = setTimeout(() => {
68
- f(!1), n(!1);
69
- }, m);
68
+ w(!1), n(!1);
69
+ }, i);
70
70
  return () => clearTimeout(a);
71
71
  }
72
- }, [l, r]);
72
+ }, [o, r]);
73
73
  const s = A(
74
74
  (a) => {
75
- c && a.key === "Escape" && b();
75
+ f && a.key === "Escape" && b();
76
76
  },
77
- [c, b]
77
+ [f, b]
78
78
  );
79
- if (p(() => (r && (document.addEventListener("keydown", s), document.body.style.overflow = "hidden"), () => {
79
+ if (h(() => (r && (document.addEventListener("keydown", s), document.body.style.overflow = "hidden"), () => {
80
80
  document.removeEventListener("keydown", s), document.body.style.overflow = "";
81
81
  }), [r, s]), !r) return null;
82
- const C = /* @__PURE__ */ i("div", { className: "bear-fixed bear-inset-0 bear-z-50", children: [
82
+ const C = /* @__PURE__ */ m("div", { className: "bear-fixed bear-inset-0 bear-z-[11000]", children: [
83
83
  /* @__PURE__ */ t(
84
84
  "div",
85
85
  {
86
- className: x(
86
+ className: p(
87
87
  "bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",
88
- h ? "bear-opacity-0" : "bear-opacity-100"
88
+ c ? "bear-opacity-0" : "bear-opacity-100"
89
89
  ),
90
- style: { transitionDuration: `${m}ms` },
90
+ style: { transitionDuration: `${i}ms` },
91
91
  onClick: v ? b : void 0,
92
92
  "aria-hidden": "true"
93
93
  }
94
94
  ),
95
- /* @__PURE__ */ i(
95
+ /* @__PURE__ */ m(
96
96
  "div",
97
97
  {
98
98
  role: "dialog",
99
99
  "aria-modal": "true",
100
- "aria-labelledby": o ? "drawer-title" : void 0,
101
- className: x(
100
+ "aria-labelledby": l ? "drawer-title" : void 0,
101
+ className: p(
102
102
  "bear-absolute bear-bg-white dark:bear-bg-neutral-900 bear-shadow-2xl",
103
103
  "bear-border-neutral-200 dark:bear-border-neutral-700 bear-overflow-hidden",
104
104
  "bear-transform bear-transition-transform",
@@ -108,21 +108,21 @@ const m = 300, D = {
108
108
  e === "bottom" && "bear-border-t",
109
109
  M[e],
110
110
  D[e][y],
111
- N && !h ? j[e] : T[e],
111
+ N && !c ? j[e] : T[e],
112
112
  k
113
113
  ),
114
- style: { transitionDuration: `${m}ms` },
114
+ style: { transitionDuration: `${i}ms` },
115
115
  children: [
116
- (o || u) && /* @__PURE__ */ i("div", { className: "bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700", children: [
117
- o && /* @__PURE__ */ t(
116
+ (l || d) && /* @__PURE__ */ m("div", { className: "bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700", children: [
117
+ l && /* @__PURE__ */ t(
118
118
  "h2",
119
119
  {
120
120
  id: "drawer-title",
121
121
  className: "bear-text-lg bear-font-semibold bear-text-neutral-900 dark:bear-text-white",
122
- children: o
122
+ children: l
123
123
  }
124
124
  ),
125
- u && /* @__PURE__ */ t(
125
+ d && /* @__PURE__ */ t(
126
126
  "button",
127
127
  {
128
128
  onClick: b,
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("react"),E=require("../../utils/cn.cjs"),J=require("../../hooks/useClickOutside.cjs");require("../../context/BearProvider.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const Q=require("../Portal/Portal.cjs"),X=require("./Dropdown.const.cjs"),Y=({trigger:x,items:c,open:j,defaultOpen:q=!1,placement:i="bottom-start",offset:v=4,matchWidth:C=!1,minWidth:h=150,maxHeight:M=300,size:S="md",closeOnSelect:I=!0,closeOnClickOutside:g=!0,disabled:R=!1,onOpenChange:f,className:P,testId:W,...z})=>{const[A,U]=t.useState(q),[b,u]=t.useState(-1),[k,B]=t.useState({top:0,left:0,minWidth:h}),D=t.useRef(null),L=t.useRef(null),N=t.useRef(null),w=j!==void 0,n=w?j:A,p=t.useCallback(e=>{w||U(e),f==null||f(e)},[w,f]),F=t.useCallback(()=>{R||p(!n)},[R,n,p]),d=t.useCallback(()=>{p(!1),u(-1)},[p]),y=t.useCallback(e=>{var r;e.disabled||e.divider||e.header||((r=e.onClick)==null||r.call(e),I&&!e.items&&d())},[I,d]),T=t.useCallback(()=>{n&&g&&d()},[n,g,d]);J.useClickOutsideMultiple([D,L],T,{enabled:n&&g}),t.useEffect(()=>{if(!n)return;const e=c.filter(a=>!a.disabled&&!a.divider&&!a.header),r=a=>{switch(a.key){case"Escape":a.preventDefault(),d();break;case"ArrowDown":a.preventDefault(),u(o=>{const l=o+1;return l>=e.length?0:l});break;case"ArrowUp":a.preventDefault(),u(o=>{const l=o-1;return l<0?e.length-1:l});break;case"Enter":case" ":a.preventDefault(),b>=0&&b<e.length&&y(e[b]);break}};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[n,c,b,d,y]),t.useEffect(()=>{if(!n)return;const e=()=>{var m;const r=(m=N.current)==null?void 0:m.getBoundingClientRect();if(!r)return;const a=window.innerWidth,o=C?r.width:h,Z=i.endsWith("end")?r.right-o:i==="top"||i==="bottom"?r.left+r.width/2-o/2:r.left,G=Math.min(Math.max(8,Z),Math.max(8,a-o-8)),H=i.startsWith("top")?r.top-v:r.bottom+v;B({top:H,left:G,minWidth:o})};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[n,C,h,i,v]),t.useEffect(()=>{n||u(-1)},[n]);const _=t.useMemo(()=>c.map((e,r)=>({item:e,index:r})).filter(({item:e})=>!e.disabled&&!e.divider&&!e.header),[c]),K=(e,r)=>{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=_.findIndex(l=>l.index===r),o=b===a;return s.jsxs("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>y(e),onMouseEnter:()=>u(a),className:E.cn("bear-w-full bear-flex bear-items-center bear-gap-2 bear-text-left bear-border-none bear-bg-transparent",X.SIZE_CLASSES[S],"bear-transition-colors bear-cursor-pointer",e.selected&&!e.danger&&"bear-bg-[var(--bear-bg-tertiary)] bear-text-[var(--bear-text-primary)]",o&&!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)},V=t.isValidElement(x)?t.cloneElement(x,{onClick:F,ref:N,"aria-expanded":n,"aria-haspopup":!0}):x;return s.jsxs("div",{ref:D,className:E.cn("bear-relative bear-inline-block",P),"data-testid":W,...z,children:[V,n&&s.jsx(Q.Portal,{children:s.jsx("div",{ref:L,role:"menu",className:E.cn("bear-fixed","bear-border bear-rounded-lg bear-shadow-lg","bear-py-1 bear-overflow-y-auto","bear-duration-100"),style:{backgroundColor:"var(--bear-bg-primary)",borderColor:"var(--bear-border-default)",minWidth:k.minWidth,maxHeight:M,top:k.top,left:k.left,zIndex:11e3},children:c.map((e,r)=>K(e,r))})})]})};exports.Dropdown=Y;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={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"};exports.SIZE_CLASSES=e;
@@ -0,0 +1,7 @@
1
+ export declare const SIZE_CLASSES: {
2
+ readonly xs: "bear-text-xs bear-py-1 bear-px-2";
3
+ readonly sm: "bear-text-sm bear-py-1.5 bear-px-3";
4
+ readonly md: "bear-text-sm bear-py-2 bear-px-3";
5
+ readonly lg: "bear-text-base bear-py-2.5 bear-px-4";
6
+ readonly xl: "bear-text-lg bear-py-3 bear-px-5";
7
+ };
@@ -0,0 +1,10 @@
1
+ const e = {
2
+ xs: "bear-text-xs bear-py-1 bear-px-2",
3
+ sm: "bear-text-sm bear-py-1.5 bear-px-3",
4
+ md: "bear-text-sm bear-py-2 bear-px-3",
5
+ lg: "bear-text-base bear-py-2.5 bear-px-4",
6
+ xl: "bear-text-lg bear-py-3 bear-px-5"
7
+ };
8
+ export {
9
+ e as SIZE_CLASSES
10
+ };