@forgedevstack/bear 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/dist/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
  2. package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
  3. package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
  4. package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
  5. package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
  6. package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
  7. package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
  8. package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
  9. package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
  10. package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
  11. package/dist/components/AnimatedCounter/index.d.ts +2 -0
  12. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  13. package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
  14. package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
  15. package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
  16. package/dist/components/Autocomplete/Autocomplete.js +110 -72
  17. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  18. package/dist/components/BottomSheet/BottomSheet.js +74 -53
  19. package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
  20. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
  21. package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
  22. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
  23. package/dist/components/Breadcrumbs/index.d.ts +1 -1
  24. package/dist/components/Cascader/Cascader.cjs +1 -1
  25. package/dist/components/Cascader/Cascader.const.cjs +1 -1
  26. package/dist/components/Cascader/Cascader.const.d.ts +1 -1
  27. package/dist/components/Cascader/Cascader.const.js +1 -1
  28. package/dist/components/Cascader/Cascader.js +109 -146
  29. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
  30. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
  31. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
  32. package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
  33. package/dist/components/Chart/BarChart.cjs +1 -0
  34. package/dist/components/Chart/BarChart.d.ts +3 -0
  35. package/dist/components/Chart/BarChart.js +65 -0
  36. package/dist/components/Chart/Chart.cjs +1 -1
  37. package/dist/components/Chart/Chart.const.cjs +1 -1
  38. package/dist/components/Chart/Chart.const.d.ts +7 -0
  39. package/dist/components/Chart/Chart.const.js +12 -2
  40. package/dist/components/Chart/Chart.d.ts +1 -13
  41. package/dist/components/Chart/Chart.js +18 -204
  42. package/dist/components/Chart/Chart.types.d.ts +7 -1
  43. package/dist/components/Chart/LineChart.cjs +1 -0
  44. package/dist/components/Chart/LineChart.d.ts +3 -0
  45. package/dist/components/Chart/LineChart.js +73 -0
  46. package/dist/components/Chart/PieChart.cjs +1 -0
  47. package/dist/components/Chart/PieChart.d.ts +3 -0
  48. package/dist/components/Chart/PieChart.js +110 -0
  49. package/dist/components/Chart/index.d.ts +4 -1
  50. package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
  51. package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
  52. package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
  53. package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
  54. package/dist/components/ColorPicker/ColorPicker.js +135 -73
  55. package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
  56. package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
  57. package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
  58. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  59. package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
  60. package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
  61. package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
  62. package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
  63. package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
  64. package/dist/components/CreditInput/CreditInput.cjs +1 -1
  65. package/dist/components/CreditInput/CreditInput.js +80 -78
  66. package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
  67. package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
  68. package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
  69. package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
  70. package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
  71. package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
  72. package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
  73. package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
  74. package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
  75. package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
  76. package/dist/components/CurrencyInput/index.d.ts +2 -0
  77. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  78. package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
  79. package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
  80. package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
  81. package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
  82. package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
  83. package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
  84. package/dist/components/DiffSquares/DiffSquares.js +70 -0
  85. package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
  86. package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
  87. package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
  88. package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
  89. package/dist/components/DiffSquares/index.d.ts +2 -0
  90. package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
  91. package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
  92. package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
  93. package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
  94. package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
  95. package/dist/components/DiffViewer/DiffViewer.js +97 -105
  96. package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
  97. package/dist/components/DiffViewer/index.d.ts +1 -1
  98. package/dist/components/Drawer/Drawer.cjs +1 -1
  99. package/dist/components/Drawer/Drawer.js +41 -41
  100. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  101. package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
  102. package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
  103. package/dist/components/Dropdown/Dropdown.const.js +10 -0
  104. package/dist/components/Dropdown/Dropdown.d.ts +0 -1
  105. package/dist/components/Dropdown/Dropdown.js +102 -92
  106. package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
  107. package/dist/components/Gauge/Gauge.cjs +1 -1
  108. package/dist/components/Gauge/Gauge.js +61 -50
  109. package/dist/components/Gauge/Gauge.types.d.ts +2 -0
  110. package/dist/components/GlowCard/GlowCard.cjs +1 -0
  111. package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
  112. package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
  113. package/dist/components/GlowCard/GlowCard.const.js +13 -0
  114. package/dist/components/GlowCard/GlowCard.d.ts +3 -0
  115. package/dist/components/GlowCard/GlowCard.js +185 -0
  116. package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
  117. package/dist/components/GlowCard/index.d.ts +2 -0
  118. package/dist/components/Heatmap/Heatmap.cjs +1 -0
  119. package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
  120. package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
  121. package/dist/components/Heatmap/Heatmap.const.js +11 -0
  122. package/dist/components/Heatmap/Heatmap.d.ts +3 -0
  123. package/dist/components/Heatmap/Heatmap.js +103 -0
  124. package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
  125. package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
  126. package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
  127. package/dist/components/Heatmap/Heatmap.utils.js +18 -0
  128. package/dist/components/Heatmap/index.d.ts +2 -0
  129. package/dist/components/HoverCard/HoverCard.cjs +6 -6
  130. package/dist/components/HoverCard/HoverCard.js +72 -54
  131. package/dist/components/Icon/icons/status.js +1 -1
  132. package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
  133. package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
  134. package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
  135. package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
  136. package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
  137. package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
  138. package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
  139. package/dist/components/ImageAnnotation/index.d.ts +2 -0
  140. package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
  141. package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
  142. package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
  143. package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
  144. package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
  145. package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
  146. package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
  147. package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
  148. package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
  149. package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
  150. package/dist/components/MediaPlayer/index.d.ts +2 -0
  151. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  152. package/dist/components/MentionsInput/MentionsInput.js +106 -83
  153. package/dist/components/Menu/Menu.cjs +1 -1
  154. package/dist/components/Menu/Menu.js +91 -80
  155. package/dist/components/Modal/Modal.cjs +1 -1
  156. package/dist/components/Modal/Modal.const.cjs +1 -1
  157. package/dist/components/Modal/Modal.const.d.ts +1 -1
  158. package/dist/components/Modal/Modal.const.js +1 -1
  159. package/dist/components/Modal/Modal.js +50 -44
  160. package/dist/components/Modal/Modal.types.d.ts +6 -0
  161. package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
  162. package/dist/components/MultiSelect/MultiSelect.js +123 -78
  163. package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
  164. package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
  165. package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
  166. package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
  167. package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
  168. package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
  169. package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
  170. package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
  171. package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
  172. package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
  173. package/dist/components/OTPInput/OTPInput.cjs +1 -1
  174. package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
  175. package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
  176. package/dist/components/OTPInput/OTPInput.const.js +14 -0
  177. package/dist/components/OTPInput/OTPInput.js +99 -65
  178. package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
  179. package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
  180. package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
  181. package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
  182. package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
  183. package/dist/components/PhoneInput/PhoneInput.js +88 -83
  184. package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
  185. package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
  186. package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
  187. package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
  188. package/dist/components/Popconfirm/Popconfirm.js +71 -51
  189. package/dist/components/Popover/Popover.cjs +1 -1
  190. package/dist/components/Popover/Popover.js +36 -31
  191. package/dist/components/Portal/Portal.cjs +1 -1
  192. package/dist/components/Portal/Portal.d.ts +0 -3
  193. package/dist/components/Portal/Portal.js +4 -10
  194. package/dist/components/Select/Select.cjs +1 -1
  195. package/dist/components/Select/Select.js +71 -51
  196. package/dist/components/Stepper/Stepper.cjs +1 -1
  197. package/dist/components/Stepper/Stepper.const.cjs +1 -1
  198. package/dist/components/Stepper/Stepper.const.d.ts +26 -4
  199. package/dist/components/Stepper/Stepper.const.js +39 -20
  200. package/dist/components/Stepper/Stepper.d.ts +3 -10
  201. package/dist/components/Stepper/Stepper.js +189 -130
  202. package/dist/components/Stepper/Stepper.types.d.ts +14 -0
  203. package/dist/components/Stepper/Stepper.utils.cjs +1 -0
  204. package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
  205. package/dist/components/Stepper/Stepper.utils.js +19 -0
  206. package/dist/components/Stepper/components/StepperControls.cjs +1 -0
  207. package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
  208. package/dist/components/Stepper/components/StepperControls.js +32 -0
  209. package/dist/components/Stepper/index.d.ts +2 -1
  210. package/dist/components/Tabs/TabList.cjs +1 -1
  211. package/dist/components/Tabs/TabList.js +72 -57
  212. package/dist/components/Tabs/Tabs.types.d.ts +4 -2
  213. package/dist/components/Tabs/index.d.ts +2 -2
  214. package/dist/components/TagCloud/TagCloud.cjs +1 -0
  215. package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
  216. package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
  217. package/dist/components/TagCloud/TagCloud.const.js +8 -0
  218. package/dist/components/TagCloud/TagCloud.d.ts +3 -0
  219. package/dist/components/TagCloud/TagCloud.js +76 -0
  220. package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
  221. package/dist/components/TagCloud/index.d.ts +2 -0
  222. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
  223. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
  224. package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
  225. package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
  226. package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
  227. package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
  228. package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
  229. package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
  230. package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
  231. package/dist/components/TimelineChart/TimelineChart.js +65 -0
  232. package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
  233. package/dist/components/TimelineChart/index.d.ts +2 -0
  234. package/dist/components/Toast/Toast.cjs +1 -1
  235. package/dist/components/Toast/Toast.js +86 -82
  236. package/dist/components/Toast/Toast.types.d.ts +2 -0
  237. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  238. package/dist/components/Tooltip/Tooltip.js +52 -44
  239. package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
  240. package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
  241. package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
  242. package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
  243. package/dist/components/TreeSelect/TreeSelect.js +120 -88
  244. package/dist/components/Watermark/Watermark.cjs +1 -1
  245. package/dist/components/Watermark/Watermark.const.cjs +1 -1
  246. package/dist/components/Watermark/Watermark.const.d.ts +6 -3
  247. package/dist/components/Watermark/Watermark.const.js +13 -11
  248. package/dist/components/Watermark/Watermark.js +87 -61
  249. package/dist/components/Watermark/Watermark.types.d.ts +2 -0
  250. package/dist/components/index.cjs +1 -1
  251. package/dist/components/index.d.ts +22 -4
  252. package/dist/components/index.js +319 -296
  253. package/dist/hooks/index.cjs +1 -1
  254. package/dist/hooks/index.d.ts +1 -1
  255. package/dist/hooks/index.js +55 -54
  256. package/dist/hooks/useClickOutside.cjs +1 -1
  257. package/dist/hooks/useClickOutside.d.ts +4 -11
  258. package/dist/hooks/useClickOutside.js +26 -7
  259. package/dist/index.cjs +1 -1
  260. package/dist/index.js +412 -388
  261. package/dist/styles/_effects.css +32 -0
  262. package/dist/styles.css +1 -1
  263. package/dist/utils/maxVisible.utils.cjs +1 -0
  264. package/dist/utils/maxVisible.utils.d.ts +12 -0
  265. package/dist/utils/maxVisible.utils.js +15 -0
  266. package/package.json +1 -1
  267. package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
  268. package/dist/components/HoverCard/HoverCard.utils.js +0 -23
@@ -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 e=require("react/jsx-runtime"),y=require("react"),b=require("../../utils/cn.cjs"),T=require("../../context/BearProvider.cjs"),a=require("../Typography/Typography.cjs"),f=require("./DiffViewer.const.cjs"),h=require("./DiffViewer.utils.cjs"),q=({oldValue:c,newValue:l,viewMode:v="split",showLineNumbers:u=!0,oldTitle:N="Original",newTitle:j="Modified",showStats:x=!0,className:g,testId:m})=>{const{mode:w}=T.useBear(),p=w==="dark",d=y.useMemo(()=>h.computeDiff(c,l),[c,l]),i=y.useMemo(()=>h.computeStats(d),[d]),t=r=>u?e.jsx("span",{className:"select-none text-gray-400 dark:text-gray-600 text-right pr-3",style:{minWidth:f.LINE_NUMBER_WIDTH},children:r??""}):null,n=(r,s)=>{const o=f.DIFF_COLORS[s],D=s==="add"?"+":s==="remove"?"-":" ";return e.jsxs("div",{className:"flex font-mono text-sm",style:{backgroundColor:o.bg,borderLeft:`3px solid ${o.border}`},children:[e.jsx("span",{className:"px-2 select-none font-bold",style:{color:o.text},children:D}),e.jsx("span",{className:"flex-1 whitespace-pre",children:r})]})};if(v==="unified")return e.jsxs("div",{className:b.cn("Bear-DiffViewer","rounded-lg overflow-hidden border",p?"bg-gray-900 border-gray-700":"bg-white border-gray-200",g),"data-testid":m,children:[x&&e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs(a.Typography,{variant:"caption",className:"text-green-600",children:["+",i.additions," additions"]}),e.jsxs(a.Typography,{variant:"caption",className:"text-red-600",children:["-",i.deletions," deletions"]})]}),e.jsx("div",{className:"overflow-x-auto",children:d.map((r,s)=>e.jsxs("div",{className:"flex",children:[t(r.oldLineNumber||r.newLineNumber),e.jsx("div",{className:"flex-1",children:n(r.content,r.type)})]},s))})]});const k=d.filter(r=>r.type!=="add"),L=d.filter(r=>r.type!=="remove");return e.jsxs("div",{className:b.cn("Bear-DiffViewer","rounded-lg overflow-hidden border",p?"bg-gray-900 border-gray-700":"bg-white border-gray-200",g),"data-testid":m,children:[x&&e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs(a.Typography,{variant:"caption",className:"text-green-600",children:["+",i.additions," additions"]}),e.jsxs(a.Typography,{variant:"caption",className:"text-red-600",children:["-",i.deletions," deletions"]})]}),e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-200 dark:divide-gray-700",children:[e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(a.Typography,{variant:"caption",className:"font-semibold",children:N})}),e.jsx("div",{className:"overflow-x-auto",children:k.map((r,s)=>e.jsxs("div",{className:"flex",children:[t(r.oldLineNumber),e.jsx("div",{className:"flex-1",children:n(r.content,r.type==="remove"?"remove":"context")})]},s))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(a.Typography,{variant:"caption",className:"font-semibold",children:j})}),e.jsx("div",{className:"overflow-x-auto",children:L.map((r,s)=>e.jsxs("div",{className:"flex",children:[t(r.newLineNumber),e.jsx("div",{className:"flex-1",children:n(r.content,r.type==="add"?"add":"context")})]},s))})]})]})]})};exports.DiffViewer=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),o=require("../../utils/cn.cjs"),R=require("../../context/BearProvider.cjs"),d=require("../Typography/Typography.cjs"),a=require("./DiffViewer.const.cjs"),N=require("./DiffViewer.utils.cjs"),P=({oldValue:m,newValue:p,viewMode:j="split",showLineNumbers:L=!0,oldTitle:T=a.DEFAULT_OLD_TITLE,newTitle:k=a.DEFAULT_NEW_TITLE,showStats:E=!0,spacing:D=a.DEFAULT_SPACING,showLineHoverInfo:c=!1,className:_,testId:h})=>{const{mode:w}=R.useBear(),S=w==="dark",[C,b]=n.useState(null),t=n.useMemo(()=>N.computeDiff(m,p),[m,p]),l=n.useMemo(()=>N.computeStats(t),[t]),f=a.LINE_SPACING[D],q=n.useCallback(r=>{c&&b(r)},[c]),A=n.useCallback(()=>{b(null)},[]),x=r=>L?e.jsx("span",{className:o.cn("select-none text-gray-400 dark:text-gray-600 text-right pr-3",f),style:{minWidth:a.LINE_NUMBER_WIDTH},children:r??""}):null,u=(r,s,i)=>{const g=a.DIFF_COLORS[s],F=s==="add"?"+":s==="remove"?"-":" ",O=i!=null&&C===i;return e.jsxs("div",{className:o.cn("flex font-mono text-sm relative group",f),style:{backgroundColor:g.bg,borderLeft:`3px solid ${g.border}`},onMouseEnter:()=>i!=null&&q(i),onMouseLeave:A,children:[e.jsx("span",{className:"px-2 select-none font-bold",style:{color:g.text},children:F}),e.jsx("span",{className:"flex-1 whitespace-pre",children:r}),c&&O&&s!=="context"&&e.jsx("span",{className:o.cn("absolute right-2 top-1/2 -translate-y-1/2 text-xs px-2 py-0.5 rounded",s==="add"?"bg-green-500/20 text-green-600 dark:text-green-400":"bg-red-500/20 text-red-600 dark:text-red-400"),children:a.LINE_HOVER_LABELS[s]})]})},v=()=>E?e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs(d.Typography,{variant:"caption",className:"text-green-600",children:["+",l.additions," additions"]}),e.jsxs(d.Typography,{variant:"caption",className:"text-red-600",children:["-",l.deletions," deletions"]}),e.jsxs(d.Typography,{variant:"caption",className:"text-gray-500",children:[l.unchanged," unchanged"]})]}):null,y=o.cn("Bear-DiffViewer","rounded-lg overflow-hidden border",S?"bg-gray-900 border-gray-700":"bg-white border-gray-200",_);if(j==="unified")return e.jsxs("div",{className:y,"data-testid":h,children:[v(),e.jsx("div",{className:"overflow-x-auto",children:t.map((r,s)=>e.jsxs("div",{className:"flex",children:[x(r.oldLineNumber||r.newLineNumber),e.jsx("div",{className:"flex-1",children:u(r.content,r.type,s)})]},s))})]});const B=t.filter(r=>r.type!=="add"),M=t.filter(r=>r.type!=="remove");return e.jsxs("div",{className:y,"data-testid":h,children:[v(),e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-200 dark:divide-gray-700",children:[e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(d.Typography,{variant:"caption",className:"font-semibold",children:T})}),e.jsx("div",{className:"overflow-x-auto",children:B.map((r,s)=>e.jsxs("div",{className:"flex",children:[x(r.oldLineNumber),e.jsx("div",{className:"flex-1",children:u(r.content,r.type==="remove"?"remove":"context",s)})]},s))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(d.Typography,{variant:"caption",className:"font-semibold",children:k})}),e.jsx("div",{className:"overflow-x-auto",children:M.map((r,s)=>e.jsxs("div",{className:"flex",children:[x(r.newLineNumber),e.jsx("div",{className:"flex-1",children:u(r.content,r.type==="add"?"add":"context",s)})]},s))})]})]})]})};exports.DiffViewer=P;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={add:{bg:"rgba(34, 197, 94, 0.15)",border:"rgba(34, 197, 94, 0.4)",text:"#22c55e"},remove:{bg:"rgba(239, 68, 68, 0.15)",border:"rgba(239, 68, 68, 0.4)",text:"#ef4444"},context:{bg:"transparent",border:"transparent",text:"inherit"}},t=50;exports.DIFF_COLORS=e;exports.LINE_NUMBER_WIDTH=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={add:{bg:"rgba(34, 197, 94, 0.15)",border:"rgba(34, 197, 94, 0.4)",text:"#22c55e"},remove:{bg:"rgba(239, 68, 68, 0.15)",border:"rgba(239, 68, 68, 0.4)",text:"#ef4444"},context:{bg:"transparent",border:"transparent",text:"inherit"}},t=50,o={compact:"py-0",comfortable:"py-1",spacious:"py-2"},r={add:"Added",remove:"Removed",context:"Unchanged"},E="Original",L="Modified",_="comfortable";exports.DEFAULT_NEW_TITLE=L;exports.DEFAULT_OLD_TITLE=E;exports.DEFAULT_SPACING=_;exports.DIFF_COLORS=e;exports.LINE_HOVER_LABELS=r;exports.LINE_NUMBER_WIDTH=t;exports.LINE_SPACING=o;
@@ -1,3 +1,4 @@
1
+ import { DiffSpacing } from './DiffViewer.types';
1
2
  export declare const DIFF_COLORS: {
2
3
  readonly add: {
3
4
  readonly bg: "rgba(34, 197, 94, 0.15)";
@@ -16,3 +17,8 @@ export declare const DIFF_COLORS: {
16
17
  };
17
18
  };
18
19
  export declare const LINE_NUMBER_WIDTH = 50;
20
+ export declare const LINE_SPACING: Record<DiffSpacing, string>;
21
+ export declare const LINE_HOVER_LABELS: Record<string, string>;
22
+ export declare const DEFAULT_OLD_TITLE = "Original";
23
+ export declare const DEFAULT_NEW_TITLE = "Modified";
24
+ export declare const DEFAULT_SPACING: DiffSpacing;
@@ -1,4 +1,4 @@
1
- const r = {
1
+ const t = {
2
2
  add: {
3
3
  bg: "rgba(34, 197, 94, 0.15)",
4
4
  border: "rgba(34, 197, 94, 0.4)",
@@ -14,8 +14,21 @@ const r = {
14
14
  border: "transparent",
15
15
  text: "inherit"
16
16
  }
17
- }, t = 50;
17
+ }, e = 50, o = {
18
+ compact: "py-0",
19
+ comfortable: "py-1",
20
+ spacious: "py-2"
21
+ }, r = {
22
+ add: "Added",
23
+ remove: "Removed",
24
+ context: "Unchanged"
25
+ }, n = "Original", a = "Modified", c = "comfortable";
18
26
  export {
19
- r as DIFF_COLORS,
20
- t as LINE_NUMBER_WIDTH
27
+ a as DEFAULT_NEW_TITLE,
28
+ n as DEFAULT_OLD_TITLE,
29
+ c as DEFAULT_SPACING,
30
+ t as DIFF_COLORS,
31
+ r as LINE_HOVER_LABELS,
32
+ e as LINE_NUMBER_WIDTH,
33
+ o as LINE_SPACING
21
34
  };
@@ -1,18 +1,4 @@
1
1
  import { FC } from 'react';
2
2
  import { DiffViewerProps } from './DiffViewer.types';
3
- /**
4
- * DiffViewer - Compare and visualize text/code differences
5
- *
6
- * @example
7
- * ```tsx
8
- * <DiffViewer
9
- * oldValue="const x = 1;"
10
- * newValue="const x = 2;"
11
- * viewMode="split"
12
- * showLineNumbers
13
- * showStats
14
- * />
15
- * ```
16
- */
17
3
  export declare const DiffViewer: FC<DiffViewerProps>;
18
4
  export default DiffViewer;