@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,27 +1,28 @@
1
- import { jsxs as S, jsx as r, Fragment as W } from "react/jsx-runtime";
2
- import { useState as v, useRef as V, useMemo as w, useEffect as X, useCallback as y } from "react";
3
- import { cn as p } from "../../utils/cn.js";
4
- import { DEFAULT_MAX_HEIGHT as U, LABEL_CLASSES as Z, SIZE_CLASSES as q, TRIGGER_CLASSES as J, DROPDOWN_CLASSES as K, SEARCH_CLASSES as Q, ERROR_CLASSES as Y, HELPER_CLASSES as $, ROOT_CLASSES as ee, TAG_CLASSES as re, CHEVRON_CLASSES as ae, INDENT_PX as te, NODE_DISABLED_CLASSES as se, NODE_SELECTED_CLASSES as le, NODE_CLASSES as ne } from "./TreeSelect.const.js";
5
- import { collectAllIds as ce, filterNodes as oe, findNodeById as g } from "./TreeSelect.utils.js";
6
- const R = ({ node: a, depth: l, selected: c, expanded: t, multiple: n, onToggleExpand: u, onSelect: h }) => {
7
- const o = a.children && a.children.length > 0, f = t.has(a.id), b = c.has(a.id);
8
- return /* @__PURE__ */ S(W, { children: [
9
- /* @__PURE__ */ S(
1
+ import { jsxs as p, jsx as r, Fragment as Q } from "react/jsx-runtime";
2
+ import { useState as N, useRef as C, useMemo as D, useEffect as P, useCallback as y } from "react";
3
+ import { cn as m } from "../../utils/cn.js";
4
+ import { Portal as Y } from "../Portal/Portal.js";
5
+ import { DEFAULT_MAX_HEIGHT as $, LABEL_CLASSES as ee, SIZE_CLASSES as re, TRIGGER_CLASSES as te, SEARCH_CLASSES as ae, DROPDOWN_CLASSES as se, ERROR_CLASSES as ne, HELPER_CLASSES as le, ROOT_CLASSES as ie, TAG_CLASSES as oe, CHEVRON_CLASSES as ce, INDENT_PX as de, NODE_DISABLED_CLASSES as be, NODE_SELECTED_CLASSES as me, NODE_CLASSES as ue } from "./TreeSelect.const.js";
6
+ import { collectAllIds as he, filterNodes as pe, findNodeById as z } from "./TreeSelect.utils.js";
7
+ const Se = 1e4, M = ({ node: a, depth: l, selected: o, expanded: s, multiple: i, onToggleExpand: S, onSelect: f }) => {
8
+ const c = a.children && a.children.length > 0, E = s.has(a.id), u = o.has(a.id);
9
+ return /* @__PURE__ */ p(Q, { children: [
10
+ /* @__PURE__ */ p(
10
11
  "div",
11
12
  {
12
- className: p(ne, b && le, a.disabled && se),
13
- style: { paddingLeft: l * te + 12 },
14
- onClick: () => !a.disabled && h(a.id),
13
+ className: m(ue, u && me, a.disabled && be),
14
+ style: { paddingLeft: l * de + 12 },
15
+ onClick: () => !a.disabled && f(a.id),
15
16
  role: "treeitem",
16
- "aria-selected": b,
17
- "aria-expanded": o ? f : void 0,
17
+ "aria-selected": u,
18
+ "aria-expanded": c ? E : void 0,
18
19
  children: [
19
- o ? /* @__PURE__ */ r(
20
+ c ? /* @__PURE__ */ r(
20
21
  "svg",
21
22
  {
22
- className: p(ae, f && "bear-rotate-90"),
23
- onClick: (m) => {
24
- m.stopPropagation(), u(a.id);
23
+ className: m(ce, E && "bear-rotate-90"),
24
+ onClick: (h) => {
25
+ h.stopPropagation(), S(a.id);
25
26
  },
26
27
  fill: "none",
27
28
  viewBox: "0 0 24 24",
@@ -29,100 +30,131 @@ const R = ({ node: a, depth: l, selected: c, expanded: t, multiple: n, onToggleE
29
30
  children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
30
31
  }
31
32
  ) : /* @__PURE__ */ r("span", { className: "bear-w-4 bear-mr-1" }),
32
- n && /* @__PURE__ */ r("span", { className: p("bear-w-4 bear-h-4 bear-mr-2 bear-border bear-rounded bear-flex bear-items-center bear-justify-center bear-text-xs", b ? "bear-bg-pink-500 bear-border-pink-500 bear-text-white" : "bear-border-gray-300 dark:bear-border-zinc-600"), children: b && "✓" }),
33
+ i && /* @__PURE__ */ r("span", { className: m("bear-w-4 bear-h-4 bear-mr-2 bear-border bear-rounded bear-flex bear-items-center bear-justify-center bear-text-xs", u ? "bear-bg-pink-500 bear-border-pink-500 bear-text-white" : "bear-border-gray-300 dark:bear-border-zinc-600"), children: u && "✓" }),
33
34
  a.icon && /* @__PURE__ */ r("span", { className: "bear-mr-1.5", children: a.icon }),
34
35
  /* @__PURE__ */ r("span", { className: "bear-truncate", children: a.label })
35
36
  ]
36
37
  }
37
38
  ),
38
- o && f && a.children.map((m) => /* @__PURE__ */ r(R, { node: m, depth: l + 1, selected: c, expanded: t, multiple: n, onToggleExpand: u, onSelect: h }, m.id))
39
+ c && E && a.children.map((h) => /* @__PURE__ */ r(M, { node: h, depth: l + 1, selected: o, expanded: s, multiple: i, onToggleExpand: S, onSelect: f }, h.id))
39
40
  ] });
40
- }, pe = (a) => {
41
+ }, Ae = (a) => {
41
42
  const {
42
43
  nodes: l,
43
- value: c,
44
- onChange: t,
45
- multiple: n = !1,
46
- label: u,
47
- placeholder: h = "Select…",
48
- disabled: o = !1,
49
- clearable: f = !0,
50
- searchable: b = !0,
51
- expandAll: m = !1,
52
- size: O = "md",
53
- error: E,
54
- helperText: k,
55
- maxHeight: D = U,
56
- className: I,
57
- testId: T,
58
- ...H
59
- } = a, [N, x] = v(!1), [A, L] = v(""), C = V(null), j = w(() => ce(l), [l]), [z, B] = v(() => m ? j : /* @__PURE__ */ new Set()), i = w(() => c ? new Set(Array.isArray(c) ? c : [c]) : /* @__PURE__ */ new Set(), [c]);
60
- X(() => {
61
- const e = (s) => {
62
- C.current && !C.current.contains(s.target) && (x(!1), L(""));
44
+ value: o,
45
+ onChange: s,
46
+ multiple: i = !1,
47
+ label: S,
48
+ placeholder: f = "Select…",
49
+ disabled: c = !1,
50
+ clearable: E = !0,
51
+ searchable: u = !0,
52
+ expandAll: h = !1,
53
+ size: B = "md",
54
+ error: w,
55
+ helperText: _,
56
+ maxHeight: H = $,
57
+ className: j,
58
+ testId: G,
59
+ ...W
60
+ } = a, [d, x] = N(!1), [L, A] = N(""), g = C(null), k = C(null), R = C(null), [v, F] = N({ top: 0, left: 0, width: 0 }), V = D(() => he(l), [l]), [X, Z] = N(() => h ? V : /* @__PURE__ */ new Set()), b = D(() => o ? new Set(Array.isArray(o) ? o : [o]) : /* @__PURE__ */ new Set(), [o]);
61
+ P(() => {
62
+ if (!d) return;
63
+ const e = () => {
64
+ var n;
65
+ const t = (n = k.current) == null ? void 0 : n.getBoundingClientRect();
66
+ t && F({
67
+ top: t.bottom + 4,
68
+ left: Math.max(8, Math.min(t.left, window.innerWidth - t.width - 8)),
69
+ width: t.width
70
+ });
71
+ };
72
+ return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
73
+ window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
74
+ };
75
+ }, [d]), P(() => {
76
+ if (!d) return;
77
+ const e = (t) => {
78
+ var I, O;
79
+ const n = t.target;
80
+ (I = g.current) != null && I.contains(n) || (O = R.current) != null && O.contains(n) || (x(!1), A(""));
63
81
  };
64
82
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
65
- }, []);
66
- const P = y((e) => {
67
- B((s) => {
68
- const d = new Set(s);
69
- return d.has(e) ? d.delete(e) : d.add(e), d;
83
+ }, [d]);
84
+ const U = y((e) => {
85
+ Z((t) => {
86
+ const n = new Set(t);
87
+ return n.has(e) ? n.delete(e) : n.add(e), n;
70
88
  });
71
- }, []), G = y((e) => {
72
- if (n) {
73
- const s = new Set(i);
74
- s.has(e) ? s.delete(e) : s.add(e), t == null || t(Array.from(s));
89
+ }, []), q = y((e) => {
90
+ if (i) {
91
+ const t = new Set(b);
92
+ t.has(e) ? t.delete(e) : t.add(e), s == null || s(Array.from(t));
75
93
  } else
76
- t == null || t(e), x(!1), L("");
77
- }, [n, i, t]), M = y(() => {
78
- t == null || t(n ? [] : "");
79
- }, [n, t]), _ = A ? oe(l, A) : l, F = () => {
80
- if (i.size === 0) return /* @__PURE__ */ r("span", { className: "bear-text-gray-400 dark:bear-text-zinc-500", children: h });
81
- if (n)
82
- return /* @__PURE__ */ r("div", { className: "bear-flex bear-flex-wrap bear-gap-1", children: Array.from(i).map((s) => {
83
- const d = g(l, s);
84
- return d ? /* @__PURE__ */ r("span", { className: re, children: d.label }, s) : null;
94
+ s == null || s(e), x(!1), A("");
95
+ }, [i, b, s]), J = y(() => {
96
+ s == null || s(i ? [] : "");
97
+ }, [i, s]), T = L ? pe(l, L) : l, K = () => {
98
+ if (b.size === 0) return /* @__PURE__ */ r("span", { className: "bear-text-gray-400 dark:bear-text-zinc-500", children: f });
99
+ if (i)
100
+ return /* @__PURE__ */ r("div", { className: "bear-flex bear-flex-wrap bear-gap-1", children: Array.from(b).map((t) => {
101
+ const n = z(l, t);
102
+ return n ? /* @__PURE__ */ r("span", { className: oe, children: n.label }, t) : null;
85
103
  }) });
86
- const e = g(l, Array.from(i)[0]);
87
- return (e == null ? void 0 : e.label) ?? h;
104
+ const e = z(l, Array.from(b)[0]);
105
+ return (e == null ? void 0 : e.label) ?? f;
88
106
  };
89
- return /* @__PURE__ */ S("div", { ref: C, className: p(ee, I), "data-testid": T, ...H, children: [
90
- u && /* @__PURE__ */ r("label", { className: Z, children: u }),
91
- /* @__PURE__ */ S(
107
+ return /* @__PURE__ */ p("div", { ref: g, className: m(ie, j), "data-testid": G, ...W, children: [
108
+ S && /* @__PURE__ */ r("label", { className: ee, children: S }),
109
+ /* @__PURE__ */ p(
92
110
  "button",
93
111
  {
112
+ ref: k,
94
113
  type: "button",
95
- disabled: o,
96
- onClick: () => !o && x(!N),
97
- className: p(J, q[O], o && "bear-opacity-50 bear-cursor-not-allowed"),
114
+ disabled: c,
115
+ onClick: () => !c && x(!d),
116
+ className: m(te, re[B], c && "bear-opacity-50 bear-cursor-not-allowed"),
98
117
  children: [
99
- /* @__PURE__ */ r("span", { className: "bear-flex-1 bear-text-left bear-truncate", children: F() }),
100
- /* @__PURE__ */ S("div", { className: "bear-flex bear-items-center bear-gap-1", children: [
101
- f && i.size > 0 && /* @__PURE__ */ r("span", { className: "bear-text-gray-400 hover:bear-text-gray-600 bear-cursor-pointer", onClick: (e) => {
102
- e.stopPropagation(), M();
118
+ /* @__PURE__ */ r("span", { className: "bear-flex-1 bear-text-left bear-truncate", children: K() }),
119
+ /* @__PURE__ */ p("div", { className: "bear-flex bear-items-center bear-gap-1", children: [
120
+ E && b.size > 0 && /* @__PURE__ */ r("span", { className: "bear-text-gray-400 hover:bear-text-gray-600 bear-cursor-pointer", onClick: (e) => {
121
+ e.stopPropagation(), J();
103
122
  }, children: "✕" }),
104
- /* @__PURE__ */ r("svg", { className: p("bear-w-4 bear-h-4 bear-text-gray-400 bear-transition-transform", N && "bear-rotate-180"), fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })
123
+ /* @__PURE__ */ r("svg", { className: m("bear-w-4 bear-h-4 bear-text-gray-400 bear-transition-transform", d && "bear-rotate-180"), fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })
105
124
  ] })
106
125
  ]
107
126
  }
108
127
  ),
109
- N && /* @__PURE__ */ S("div", { className: K, children: [
110
- b && /* @__PURE__ */ r(
111
- "input",
112
- {
113
- className: Q,
114
- placeholder: "Search…",
115
- value: A,
116
- onChange: (e) => L(e.target.value),
117
- autoFocus: !0
118
- }
119
- ),
120
- /* @__PURE__ */ r("div", { style: { maxHeight: D }, className: "bear-overflow-y-auto", role: "tree", children: _.length > 0 ? _.map((e) => /* @__PURE__ */ r(R, { node: e, depth: 0, selected: i, expanded: z, multiple: n, onToggleExpand: P, onSelect: G }, e.id)) : /* @__PURE__ */ r("div", { className: "bear-py-6 bear-text-center bear-text-sm bear-text-gray-400", children: "No results" }) })
121
- ] }),
122
- E && /* @__PURE__ */ r("p", { className: Y, children: E }),
123
- !E && k && /* @__PURE__ */ r("p", { className: $, children: k })
128
+ d && /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ p(
129
+ "div",
130
+ {
131
+ ref: R,
132
+ className: m(se, "bear-fixed"),
133
+ style: {
134
+ top: v.top,
135
+ left: v.left,
136
+ width: v.width,
137
+ zIndex: Se
138
+ },
139
+ children: [
140
+ u && /* @__PURE__ */ r(
141
+ "input",
142
+ {
143
+ className: ae,
144
+ placeholder: "Search…",
145
+ value: L,
146
+ onChange: (e) => A(e.target.value),
147
+ autoFocus: !0
148
+ }
149
+ ),
150
+ /* @__PURE__ */ r("div", { style: { maxHeight: H }, className: "bear-overflow-y-auto", role: "tree", children: T.length > 0 ? T.map((e) => /* @__PURE__ */ r(M, { node: e, depth: 0, selected: b, expanded: X, multiple: i, onToggleExpand: U, onSelect: q }, e.id)) : /* @__PURE__ */ r("div", { className: "bear-py-6 bear-text-center bear-text-sm bear-text-gray-400", children: "No results" }) })
151
+ ]
152
+ }
153
+ ) }),
154
+ w && /* @__PURE__ */ r("p", { className: ne, children: w }),
155
+ !w && _ && /* @__PURE__ */ r("p", { className: le, children: _ })
124
156
  ] });
125
157
  };
126
158
  export {
127
- pe as TreeSelect
159
+ Ae as TreeSelect
128
160
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),a=require("react"),y=require("../../utils/cn.cjs"),t=require("./Watermark.const.cjs"),M=O=>{const{children:x,text:c,image:l,fontSize:u=t.DEFAULT_FONT_SIZE,color:d,rotate:E=t.DEFAULT_ROTATE,opacity:m=t.DEFAULT_OPACITY,gap:f=t.DEFAULT_GAP,offset:h=t.DEFAULT_OFFSET,zIndex:R=t.DEFAULT_Z_INDEX,fontFamily:A,fontWeight:L=t.DEFAULT_FONT_WEIGHT,visible:g=!0,className:H,style:U,testId:w}=O,i=a.useRef(null),T=a.useRef(null),[_,C]=a.useState(!1);a.useEffect(()=>{const r=window.matchMedia("(prefers-color-scheme: dark)"),e=()=>{const s=document.documentElement.classList.contains("dark");C(s||r.matches)};e();const n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),r.addEventListener("change",e),()=>{n.disconnect(),r.removeEventListener("change",e)}},[]);const F=a.useMemo(()=>{if(A)return A;if(typeof window<"u"){const r=getComputedStyle(document.documentElement).getPropertyValue("--bear-font-family");if(r.trim())return r.trim()}return t.DEFAULT_FONT_FAMILY},[A]),b=a.useMemo(()=>d||(_?t.DEFAULT_COLOR_DARK:t.DEFAULT_COLOR_LIGHT),[d,_]),v=a.useCallback(()=>{if(!g||!c&&!l)return"";const r=document.createElement("canvas"),e=r.getContext("2d");if(!e)return"";const n=Array.isArray(c)?c:c?[c]:[],s=u*t.LINE_HEIGHT_MULTIPLIER,N=n.length*s,I=f[0]+t.CANVAS_WIDTH_OFFSET,k=f[1]+N+t.CANVAS_EXTRA_PADDING;if(r.width=I,r.height=k,e.translate(I/t.HALF,k/t.HALF),e.rotate(E*t.DEG_TO_RAD),l){const o=new Image;o.crossOrigin="anonymous",o.src=l,e.globalAlpha=m,e.drawImage(o,-o.width/t.HALF,-o.height/t.HALF)}else e.font=`${L} ${u}px ${F}`,e.fillStyle=b,e.globalAlpha=m,e.textAlign="center",e.textBaseline="middle",n.forEach((o,S)=>{const W=(S-(n.length-1)/t.HALF)*s;e.fillText(o,0,W)});return r.toDataURL()},[c,l,u,b,E,m,f,F,L,g]),D=a.useMemo(()=>v(),[v]);return a.useEffect(()=>{const r=T.current;if(!r)return;const e=new MutationObserver(()=>{var n,s;(n=i.current)!=null&&n.contains(r)||(s=i.current)==null||s.appendChild(r)});return i.current&&e.observe(i.current,{childList:!0}),()=>e.disconnect()},[]),p.jsxs("div",{ref:i,className:y.cn("Bear-Watermark","bear-relative",H),style:U,"data-testid":w,children:[x,g&&D&&p.jsx("div",{ref:T,className:y.cn("Bear-Watermark__overlay","bear-absolute bear-inset-0 bear-pointer-events-none bear-bg-repeat"),style:{backgroundImage:`url(${D})`,backgroundPosition:`${h[0]}px ${h[1]}px`,zIndex:R},"aria-hidden":"true"})]})};exports.Watermark=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),s=require("react"),z=require("../../context/BearProvider.cjs"),C=require("../../utils/cn.cjs"),t=require("./Watermark.const.cjs"),Y=w=>{const{children:S,text:c,image:d,fontSize:E=t.DEFAULT_FONT_SIZE,color:T,rotate:g=t.DEFAULT_ROTATE,opacity:_=t.DEFAULT_OPACITY,patternRepeat:v=t.PATTERN_REPEAT_MIN,gap:F=t.DEFAULT_GAP,offset:D=t.DEFAULT_OFFSET,zIndex:U=t.DEFAULT_Z_INDEX,fontFamily:L,fontWeight:k=t.DEFAULT_FONT_WEIGHT,visible:b=!0,className:W,style:G,testId:q}=w,i=s.useRef(null),R=s.useRef(null),m=s.useContext(z.BearContext),[$,B]=s.useState(!1);s.useEffect(()=>{if(m)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),e=()=>{const o=document.documentElement,h=o.classList.contains("dark")||o.classList.contains("bear-dark")||r.matches;B(h)};e();const n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),r.addEventListener("change",e),()=>{n.disconnect(),r.removeEventListener("change",e)}},[m]);const I=m?m.mode==="dark":$,p=s.useMemo(()=>{if(L)return L;if(typeof window<"u"){const r=document.documentElement,e=getComputedStyle(r).getPropertyValue("--bear-font-sans");if(e.trim())return e.trim();const n=getComputedStyle(r).getPropertyValue("--bear-font-family");if(n.trim())return n.trim()}return t.DEFAULT_FONT_FAMILY},[L]),y=s.useMemo(()=>T||(I?t.DEFAULT_COLOR_DARK:t.DEFAULT_COLOR_LIGHT),[T,I]),x=s.useCallback(()=>{if(!b||!c&&!d)return"";const r=document.createElement("canvas"),e=r.getContext("2d");if(!e)return"";const n=Array.isArray(c)?c:c?[c]:[],o=E*t.LINE_HEIGHT_MULTIPLIER,h=n.length*o,A=F[0]+t.CANVAS_WIDTH_OFFSET,f=F[1]+h+t.CANVAS_EXTRA_PADDING;r.width=A,r.height=f;const l=Math.min(t.PATTERN_REPEAT_MAX,Math.max(t.PATTERN_REPEAT_MIN,Math.floor(v))),O=A/l,N=f/l,M=(a,u)=>{e.save(),e.translate(a,u),e.rotate(g*t.DEG_TO_RAD),e.font=`${k} ${E}px ${p}`,e.fillStyle=y,e.globalAlpha=_,e.textAlign="center",e.textBaseline="middle",n.forEach((j,V)=>{const X=(V-(n.length-1)/t.HALF)*o;e.fillText(j,0,X)}),e.restore()};if(d){e.save(),e.translate(A/t.HALF,f/t.HALF),e.rotate(g*t.DEG_TO_RAD);const a=new Image;a.crossOrigin="anonymous",a.src=d,e.globalAlpha=_,e.drawImage(a,-a.width/t.HALF,-a.height/t.HALF),e.restore()}else if(l<=1)M(A/t.HALF,f/t.HALF);else for(let a=0;a<l;a++)for(let u=0;u<l;u++)M(u*O+O/t.HALF,a*N+N/t.HALF);return r.toDataURL()},[c,d,E,y,g,_,F,p,k,b,v]),H=s.useMemo(()=>x(),[x]);return s.useEffect(()=>{const r=R.current;if(!r)return;const e=new MutationObserver(()=>{var n,o;(n=i.current)!=null&&n.contains(r)||(o=i.current)==null||o.appendChild(r)});return i.current&&e.observe(i.current,{childList:!0}),()=>e.disconnect()},[]),P.jsxs("div",{ref:i,className:C.cn("Bear-Watermark","bear-relative",W),style:G,"data-testid":q,children:[S,b&&H&&P.jsx("div",{ref:R,className:C.cn("Bear-Watermark__overlay","bear-absolute bear-inset-0 bear-pointer-events-none bear-bg-repeat"),style:{backgroundImage:`url(${H})`,backgroundPosition:`${D[0]}px ${D[1]}px`,zIndex:U},"aria-hidden":"true"})]})};exports.Watermark=Y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=16,_=-22,A=.15,E=[100,100],F=[0,0],L=9,D=400,I="rgba(0, 0, 0, 0.15)",O="rgba(255, 255, 255, 0.12)",s="system-ui, -apple-system, sans-serif",t=1.5,U=40,o=200,n=2,c=Math.PI/180;exports.CANVAS_EXTRA_PADDING=U;exports.CANVAS_WIDTH_OFFSET=o;exports.DEFAULT_COLOR_DARK=O;exports.DEFAULT_COLOR_LIGHT=I;exports.DEFAULT_FONT_FAMILY=s;exports.DEFAULT_FONT_SIZE=T;exports.DEFAULT_FONT_WEIGHT=D;exports.DEFAULT_GAP=E;exports.DEFAULT_OFFSET=F;exports.DEFAULT_OPACITY=A;exports.DEFAULT_ROTATE=_;exports.DEFAULT_Z_INDEX=L;exports.DEG_TO_RAD=c;exports.HALF=n;exports.LINE_HEIGHT_MULTIPLIER=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=16,A=-22,_=.22,E=[100,100],F=[0,0],L=9,D=400,I="rgba(0, 0, 0, 0.28)",s="rgba(255, 255, 255, 0.22)",t="system-ui, -apple-system, sans-serif",O=1.5,N=40,R=200,U=2,o=Math.PI/180,n=1,c=4;exports.CANVAS_EXTRA_PADDING=N;exports.CANVAS_WIDTH_OFFSET=R;exports.DEFAULT_COLOR_DARK=s;exports.DEFAULT_COLOR_LIGHT=I;exports.DEFAULT_FONT_FAMILY=t;exports.DEFAULT_FONT_SIZE=T;exports.DEFAULT_FONT_WEIGHT=D;exports.DEFAULT_GAP=E;exports.DEFAULT_OFFSET=F;exports.DEFAULT_OPACITY=_;exports.DEFAULT_ROTATE=A;exports.DEFAULT_Z_INDEX=L;exports.DEG_TO_RAD=o;exports.HALF=U;exports.LINE_HEIGHT_MULTIPLIER=O;exports.PATTERN_REPEAT_MAX=c;exports.PATTERN_REPEAT_MIN=n;
@@ -3,7 +3,7 @@ export declare const DEFAULT_FONT_SIZE = 16;
3
3
  /** Default rotation in degrees */
4
4
  export declare const DEFAULT_ROTATE = -22;
5
5
  /** Default opacity */
6
- export declare const DEFAULT_OPACITY = 0.15;
6
+ export declare const DEFAULT_OPACITY = 0.22;
7
7
  /** Default gap [horizontal, vertical] in pixels */
8
8
  export declare const DEFAULT_GAP: [number, number];
9
9
  /** Default offset [x, y] in pixels */
@@ -13,9 +13,9 @@ export declare const DEFAULT_Z_INDEX = 9;
13
13
  /** Default font weight */
14
14
  export declare const DEFAULT_FONT_WEIGHT = 400;
15
15
  /** Default light mode color */
16
- export declare const DEFAULT_COLOR_LIGHT = "rgba(0, 0, 0, 0.15)";
16
+ export declare const DEFAULT_COLOR_LIGHT = "rgba(0, 0, 0, 0.28)";
17
17
  /** Default dark mode color */
18
- export declare const DEFAULT_COLOR_DARK = "rgba(255, 255, 255, 0.12)";
18
+ export declare const DEFAULT_COLOR_DARK = "rgba(255, 255, 255, 0.22)";
19
19
  /** Default font family */
20
20
  export declare const DEFAULT_FONT_FAMILY = "system-ui, -apple-system, sans-serif";
21
21
  /** Line height multiplier */
@@ -28,3 +28,6 @@ export declare const CANVAS_WIDTH_OFFSET = 200;
28
28
  export declare const HALF = 2;
29
29
  /** Degrees to radians conversion */
30
30
  export declare const DEG_TO_RAD: number;
31
+ /** Min / max pattern repeat per axis */
32
+ export declare const PATTERN_REPEAT_MIN = 1;
33
+ export declare const PATTERN_REPEAT_MAX = 4;
@@ -1,18 +1,20 @@
1
- const T = 16, _ = -22, A = 0.15, s = [100, 100], E = [0, 0], t = 9, F = 400, L = "rgba(0, 0, 0, 0.15)", D = "rgba(255, 255, 255, 0.12)", n = "system-ui, -apple-system, sans-serif", o = 1.5, c = 40, I = 200, O = 2, U = Math.PI / 180;
1
+ const T = 16, A = -22, _ = 0.22, E = [100, 100], s = [0, 0], t = 9, F = 400, n = "rgba(0, 0, 0, 0.28)", o = "rgba(255, 255, 255, 0.22)", L = "system-ui, -apple-system, sans-serif", c = 1.5, D = 40, I = 200, O = 2, N = Math.PI / 180, R = 1, U = 4;
2
2
  export {
3
- c as CANVAS_EXTRA_PADDING,
3
+ D as CANVAS_EXTRA_PADDING,
4
4
  I as CANVAS_WIDTH_OFFSET,
5
- D as DEFAULT_COLOR_DARK,
6
- L as DEFAULT_COLOR_LIGHT,
7
- n as DEFAULT_FONT_FAMILY,
5
+ o as DEFAULT_COLOR_DARK,
6
+ n as DEFAULT_COLOR_LIGHT,
7
+ L as DEFAULT_FONT_FAMILY,
8
8
  T as DEFAULT_FONT_SIZE,
9
9
  F as DEFAULT_FONT_WEIGHT,
10
- s as DEFAULT_GAP,
11
- E as DEFAULT_OFFSET,
12
- A as DEFAULT_OPACITY,
13
- _ as DEFAULT_ROTATE,
10
+ E as DEFAULT_GAP,
11
+ s as DEFAULT_OFFSET,
12
+ _ as DEFAULT_OPACITY,
13
+ A as DEFAULT_ROTATE,
14
14
  t as DEFAULT_Z_INDEX,
15
- U as DEG_TO_RAD,
15
+ N as DEG_TO_RAD,
16
16
  O as HALF,
17
- o as LINE_HEIGHT_MULTIPLIER
17
+ c as LINE_HEIGHT_MULTIPLIER,
18
+ U as PATTERN_REPEAT_MAX,
19
+ R as PATTERN_REPEAT_MIN
18
20
  };
@@ -1,88 +1,114 @@
1
- import { jsxs as M, jsx as P } from "react/jsx-runtime";
2
- import { useRef as k, useState as $, useEffect as O, useMemo as E, useCallback as B } from "react";
3
- import { cn as x } from "../../utils/cn.js";
4
- import { DEFAULT_FONT_SIZE as V, DEFAULT_ROTATE as j, DEFAULT_OPACITY as z, DEFAULT_GAP as X, DEFAULT_OFFSET as Y, DEFAULT_Z_INDEX as Z, DEFAULT_FONT_WEIGHT as q, DEFAULT_FONT_FAMILY as K, DEFAULT_COLOR_DARK as J, DEFAULT_COLOR_LIGHT as Q, CANVAS_WIDTH_OFFSET as ee, CANVAS_EXTRA_PADDING as te, HALF as c, DEG_TO_RAD as re, LINE_HEIGHT_MULTIPLIER as ne } from "./Watermark.const.js";
5
- const ie = (y) => {
1
+ import { jsxs as K, jsx as J } from "react/jsx-runtime";
2
+ import { useRef as U, useContext as Q, useState as ee, useEffect as M, useMemo as F, useCallback as te } from "react";
3
+ import { BearContext as re } from "../../context/BearProvider.js";
4
+ import { cn as P } from "../../utils/cn.js";
5
+ import { DEFAULT_FONT_SIZE as ne, DEFAULT_ROTATE as ae, DEFAULT_OPACITY as oe, PATTERN_REPEAT_MIN as H, DEFAULT_GAP as se, DEFAULT_OFFSET as ce, DEFAULT_Z_INDEX as ie, DEFAULT_FONT_WEIGHT as le, DEFAULT_FONT_FAMILY as me, DEFAULT_COLOR_DARK as ue, DEFAULT_COLOR_LIGHT as de, CANVAS_WIDTH_OFFSET as fe, CANVAS_EXTRA_PADDING as ge, HALF as a, DEG_TO_RAD as S, LINE_HEIGHT_MULTIPLIER as Ee, PATTERN_REPEAT_MAX as Ae } from "./Watermark.const.js";
6
+ const Fe = (W) => {
6
7
  const {
7
- children: U,
8
- text: o,
9
- image: i,
10
- fontSize: l = V,
11
- color: u,
12
- rotate: h = j,
13
- opacity: m = z,
14
- gap: d = X,
15
- offset: A = Y,
16
- zIndex: w = Z,
17
- fontFamily: f,
18
- fontWeight: T = q,
19
- visible: g = !0,
20
- className: C,
21
- style: N,
22
- testId: R
23
- } = y, s = k(null), _ = k(null), [b, H] = $(!1);
24
- O(() => {
8
+ children: G,
9
+ text: s,
10
+ image: m,
11
+ fontSize: g = ne,
12
+ color: E,
13
+ rotate: A = ae,
14
+ opacity: T = oe,
15
+ patternRepeat: L = H,
16
+ gap: h = se,
17
+ offset: v = ce,
18
+ zIndex: $ = ie,
19
+ fontFamily: _,
20
+ fontWeight: D = le,
21
+ visible: b = !0,
22
+ className: B,
23
+ style: V,
24
+ testId: X
25
+ } = W, c = U(null), k = U(null), u = Q(re), [j, z] = ee(!1);
26
+ M(() => {
27
+ if (u) return;
25
28
  const t = window.matchMedia("(prefers-color-scheme: dark)"), e = () => {
26
- const n = document.documentElement.classList.contains("dark");
27
- H(n || t.matches);
29
+ const o = document.documentElement, p = o.classList.contains("dark") || o.classList.contains("bear-dark") || t.matches;
30
+ z(p);
28
31
  };
29
32
  e();
30
33
  const r = new MutationObserver(e);
31
34
  return r.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), t.addEventListener("change", e), () => {
32
35
  r.disconnect(), t.removeEventListener("change", e);
33
36
  };
34
- }, []);
35
- const L = E(() => {
36
- if (f) return f;
37
+ }, [u]);
38
+ const I = u ? u.mode === "dark" : j, x = F(() => {
39
+ if (_) return _;
37
40
  if (typeof window < "u") {
38
- const t = getComputedStyle(document.documentElement).getPropertyValue("--bear-font-family");
39
- if (t.trim()) return t.trim();
41
+ const t = document.documentElement, e = getComputedStyle(t).getPropertyValue("--bear-font-sans");
42
+ if (e.trim()) return e.trim();
43
+ const r = getComputedStyle(t).getPropertyValue("--bear-font-family");
44
+ if (r.trim()) return r.trim();
40
45
  }
41
- return K;
42
- }, [f]), D = E(() => u || (b ? J : Q), [u, b]), F = B(() => {
43
- if (!g || !o && !i) return "";
46
+ return me;
47
+ }, [_]), y = F(() => E || (I ? ue : de), [E, I]), R = te(() => {
48
+ if (!b || !s && !m) return "";
44
49
  const t = document.createElement("canvas"), e = t.getContext("2d");
45
50
  if (!e) return "";
46
- const r = Array.isArray(o) ? o : o ? [o] : [], n = l * ne, S = r.length * n, v = d[0] + ee, I = d[1] + S + te;
47
- if (t.width = v, t.height = I, e.translate(v / c, I / c), e.rotate(h * re), i) {
48
- const a = new Image();
49
- a.crossOrigin = "anonymous", a.src = i, e.globalAlpha = m, e.drawImage(a, -a.width / c, -a.height / c);
50
- } else
51
- e.font = `${T} ${l}px ${L}`, e.fillStyle = D, e.globalAlpha = m, e.textAlign = "center", e.textBaseline = "middle", r.forEach((a, W) => {
52
- const G = (W - (r.length - 1) / c) * n;
53
- e.fillText(a, 0, G);
54
- });
51
+ const r = Array.isArray(s) ? s : s ? [s] : [], o = g * Ee, p = r.length * o, d = h[0] + fe, f = h[1] + p + ge;
52
+ t.width = d, t.height = f;
53
+ const i = Math.min(Ae, Math.max(H, Math.floor(L))), N = d / i, C = f / i, w = (n, l) => {
54
+ e.save(), e.translate(n, l), e.rotate(A * S), e.font = `${D} ${g}px ${x}`, e.fillStyle = y, e.globalAlpha = T, e.textAlign = "center", e.textBaseline = "middle", r.forEach((Y, Z) => {
55
+ const q = (Z - (r.length - 1) / a) * o;
56
+ e.fillText(Y, 0, q);
57
+ }), e.restore();
58
+ };
59
+ if (m) {
60
+ e.save(), e.translate(d / a, f / a), e.rotate(A * S);
61
+ const n = new Image();
62
+ n.crossOrigin = "anonymous", n.src = m, e.globalAlpha = T, e.drawImage(n, -n.width / a, -n.height / a), e.restore();
63
+ } else if (i <= 1)
64
+ w(d / a, f / a);
65
+ else
66
+ for (let n = 0; n < i; n++)
67
+ for (let l = 0; l < i; l++)
68
+ w(l * N + N / a, n * C + C / a);
55
69
  return t.toDataURL();
56
- }, [o, i, l, D, h, m, d, L, T, g]), p = E(() => F(), [F]);
57
- return O(() => {
58
- const t = _.current;
70
+ }, [
71
+ s,
72
+ m,
73
+ g,
74
+ y,
75
+ A,
76
+ T,
77
+ h,
78
+ x,
79
+ D,
80
+ b,
81
+ L
82
+ ]), O = F(() => R(), [R]);
83
+ return M(() => {
84
+ const t = k.current;
59
85
  if (!t) return;
60
86
  const e = new MutationObserver(() => {
61
- var r, n;
62
- (r = s.current) != null && r.contains(t) || (n = s.current) == null || n.appendChild(t);
87
+ var r, o;
88
+ (r = c.current) != null && r.contains(t) || (o = c.current) == null || o.appendChild(t);
63
89
  });
64
- return s.current && e.observe(s.current, { childList: !0 }), () => e.disconnect();
65
- }, []), /* @__PURE__ */ M(
90
+ return c.current && e.observe(c.current, { childList: !0 }), () => e.disconnect();
91
+ }, []), /* @__PURE__ */ K(
66
92
  "div",
67
93
  {
68
- ref: s,
69
- className: x("Bear-Watermark", "bear-relative", C),
70
- style: N,
71
- "data-testid": R,
94
+ ref: c,
95
+ className: P("Bear-Watermark", "bear-relative", B),
96
+ style: V,
97
+ "data-testid": X,
72
98
  children: [
73
- U,
74
- g && p && /* @__PURE__ */ P(
99
+ G,
100
+ b && O && /* @__PURE__ */ J(
75
101
  "div",
76
102
  {
77
- ref: _,
78
- className: x(
103
+ ref: k,
104
+ className: P(
79
105
  "Bear-Watermark__overlay",
80
106
  "bear-absolute bear-inset-0 bear-pointer-events-none bear-bg-repeat"
81
107
  ),
82
108
  style: {
83
- backgroundImage: `url(${p})`,
84
- backgroundPosition: `${A[0]}px ${A[1]}px`,
85
- zIndex: w
109
+ backgroundImage: `url(${O})`,
110
+ backgroundPosition: `${v[0]}px ${v[1]}px`,
111
+ zIndex: $
86
112
  },
87
113
  "aria-hidden": "true"
88
114
  }
@@ -92,5 +118,5 @@ const ie = (y) => {
92
118
  );
93
119
  };
94
120
  export {
95
- ie as Watermark
121
+ Fe as Watermark
96
122
  };
@@ -14,6 +14,8 @@ export interface WatermarkProps {
14
14
  rotate?: number;
15
15
  /** Opacity (0-1) */
16
16
  opacity?: number;
17
+ /** How many staggered copies of the mark to paint inside each pattern tile (1–4 per axis). Higher = denser field. */
18
+ patternRepeat?: number;
17
19
  /** Gap between watermarks [horizontal, vertical] */
18
20
  gap?: [number, number];
19
21
  /** Offset from top-left [x, y] */