@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,218 +1,181 @@
1
- import { jsxs as h, jsx as c } from "react/jsx-runtime";
2
- import { useState as R, useRef as H, useMemo as O, useEffect as P, useCallback as w } from "react";
1
+ import { jsxs as h, jsx as o } from "react/jsx-runtime";
2
+ import { useState as E, useRef as M, useMemo as A, useEffect as g, useCallback as x } from "react";
3
3
  import { createPortal as $ } from "react-dom";
4
- import { cn as y } from "../../utils/cn.js";
5
- import { CASCADER_DEFAULT_TRANSLATIONS as ee, CASCADER_PATH_SEPARATOR as re, CASCADER_VARIANT_CLASSES as ae, CASCADER_SIZE_CLASSES as te, CASCADER_DROPDOWN_Z_INDEX as ne } from "./Cascader.const.js";
6
- const ce = ({
7
- options: b,
8
- selectedPath: s,
9
- expandedPath: o,
10
- onSelect: B,
11
- onExpand: p,
12
- expandTrigger: k,
13
- level: i
14
- }) => {
15
- const m = (a) => {
16
- var d;
17
- B(a, i), (d = a.children) != null && d.length && p(a, i);
18
- }, v = (a) => {
19
- var d;
20
- k === "hover" && ((d = a.children) != null && d.length) && p(a, i);
21
- };
22
- return /* @__PURE__ */ c("div", { className: "Bear-Cascader__panel bear-min-w-[180px] bear-max-h-[280px] bear-overflow-y-auto bear-border-r bear-border-zinc-200 dark:bear-border-zinc-700 last:bear-border-r-0", children: b.map((a) => {
23
- const d = s[i] === a.value, C = o[i] === a.value, N = a.children && a.children.length > 0;
24
- return /* @__PURE__ */ h(
25
- "button",
26
- {
27
- type: "button",
28
- disabled: a.disabled,
29
- onClick: () => m(a),
30
- onMouseEnter: () => v(a),
31
- className: y(
32
- "Bear-Cascader__option bear-w-full bear-flex bear-items-center bear-justify-between bear-px-3 bear-py-2 bear-text-sm bear-text-left bear-transition-colors",
33
- d && "Bear-Cascader__option--selected bear-bg-pink-500/20 bear-text-pink-600 dark:bear-text-pink-400",
34
- C && !d && "Bear-Cascader__option--expanded bear-bg-gray-100 dark:bear-bg-zinc-700",
35
- !d && !C && "bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700",
36
- a.disabled && "Bear-Cascader__option--disabled bear-opacity-50 bear-cursor-not-allowed"
37
- ),
38
- children: [
39
- /* @__PURE__ */ h("span", { className: "bear-flex bear-items-center bear-gap-2", children: [
40
- a.icon && /* @__PURE__ */ c("span", { className: "Bear-Cascader__option-icon", children: a.icon }),
41
- /* @__PURE__ */ c("span", { className: "Bear-Cascader__option-label", children: a.label })
42
- ] }),
43
- N && /* @__PURE__ */ c("svg", { className: "Bear-Cascader__arrow bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
44
- ]
45
- },
46
- a.value
47
- );
48
- }) });
49
- }, be = ({
50
- options: b,
4
+ import { cn as N } from "../../utils/cn.js";
5
+ import { CASCADER_DEFAULT_TRANSLATIONS as ee, CASCADER_PATH_SEPARATOR as re, CASCADER_VARIANT_CLASSES as te, CASCADER_SIZE_CLASSES as ae, CASCADER_DROPDOWN_Z_INDEX as ne } from "./Cascader.const.js";
6
+ import { CascaderPanel as oe } from "./components/CascaderPanel/CascaderPanel.js";
7
+ const fe = ({
8
+ options: i,
51
9
  value: s = [],
52
- onChange: o,
53
- placeholder: B,
54
- label: p,
55
- helperText: k,
56
- error: i,
10
+ onChange: c,
11
+ placeholder: I,
12
+ label: y,
13
+ helperText: L,
14
+ error: u,
57
15
  disabled: m = !1,
58
- loading: v = !1,
59
- clearable: a = !0,
60
- size: d = "md",
61
- variant: C = "default",
62
- expandTrigger: N = "click",
63
- showFullPath: D = !0,
64
- pathSeparator: j = re,
65
- changeOnSelect: M = !1,
66
- className: U,
67
- testId: V,
68
- translations: T,
69
- icon: Y
16
+ loading: W = !1,
17
+ clearable: T = !0,
18
+ size: Z = "md",
19
+ variant: H = "default",
20
+ expandTrigger: U = "click",
21
+ showFullPath: S = !0,
22
+ pathSeparator: z = re,
23
+ changeOnSelect: B = !1,
24
+ className: V,
25
+ testId: X,
26
+ translations: R,
27
+ icon: q
70
28
  }) => {
71
- const [x, E] = R(!1), [_, A] = R([]), [I, q] = R({ top: 0, left: 0 }), W = H(null), z = H(null), S = O(() => ({
29
+ const [b, w] = E(!1), [f, _] = E([]), [O, F] = E({ top: 0, left: 0 }), P = M(null), k = M(null), v = A(() => ({
72
30
  ...ee,
73
- ...T
74
- }), [T]);
75
- P(() => {
76
- if (x && z.current) {
77
- const e = z.current.getBoundingClientRect(), t = window.scrollY || document.documentElement.scrollTop, r = window.scrollX || document.documentElement.scrollLeft;
78
- q({
79
- top: e.bottom + t + 8,
80
- left: e.left + r
31
+ ...R
32
+ }), [R]);
33
+ g(() => {
34
+ if (!b || !k.current) return;
35
+ const e = () => {
36
+ const t = k.current.getBoundingClientRect(), r = Math.min(560, window.innerWidth - 16);
37
+ let a = Math.max(8, Math.min(t.left, window.innerWidth - r - 8));
38
+ F({
39
+ top: t.bottom + 8,
40
+ left: a
81
41
  });
82
- }
83
- }, [x]), P(() => {
42
+ };
43
+ return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
44
+ window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
45
+ };
46
+ }, [b]), g(() => {
84
47
  const e = (t) => {
85
- var n, l;
48
+ var a, n;
86
49
  const r = t.target;
87
- (n = W.current) != null && n.contains(r) || (l = r.closest) != null && l.call(r, "[data-bear-cascader-dropdown]") || E(!1);
50
+ (a = P.current) != null && a.contains(r) || (n = r.closest) != null && n.call(r, "[data-bear-cascader-dropdown]") || w(!1);
88
51
  };
89
52
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
90
- }, []), P(() => {
91
- s.length > 0 && A(s.slice(0, -1));
53
+ }, []), g(() => {
54
+ s.length > 0 && _(s.slice(0, -1));
92
55
  }, [s]);
93
- const F = w((e, t) => {
56
+ const G = x((e, t) => {
94
57
  for (const r of e) {
95
58
  if (r.value === t) return r;
96
59
  if (r.children) {
97
- const n = F(r.children, t);
98
- if (n) return n;
60
+ const a = G(r.children, t);
61
+ if (a) return a;
99
62
  }
100
63
  }
101
- }, []), X = O(() => {
64
+ }, []), D = A(() => {
102
65
  var t;
103
66
  if (s.length === 0) return "";
104
- const e = s.map((r, n) => {
105
- let l = b;
106
- for (let f = 0; f < n; f++) {
107
- const u = l.find((L) => L.value === s[f]);
108
- u != null && u.children && (l = u.children);
67
+ const e = s.map((r, a) => {
68
+ let n = i;
69
+ for (let d = 0; d < a; d++) {
70
+ const l = n.find((C) => C.value === s[d]);
71
+ l != null && l.children && (n = l.children);
109
72
  }
110
- return l.find((f) => f.value === r);
73
+ return n.find((d) => d.value === r);
111
74
  }).filter(Boolean);
112
- return D ? e.map((r) => r.label).join(j) : ((t = e[e.length - 1]) == null ? void 0 : t.label) || "";
113
- }, [s, b, D, j]), Z = O(() => {
114
- const e = [b];
115
- let t = b;
116
- for (const r of _) {
117
- const n = t.find((l) => l.value === r);
118
- if (n != null && n.children)
119
- e.push(n.children), t = n.children;
75
+ return S ? e.map((r) => r.label).join(z) : ((t = e[e.length - 1]) == null ? void 0 : t.label) || "";
76
+ }, [s, i, S, z]), j = A(() => {
77
+ const e = [i];
78
+ let t = i;
79
+ for (const r of f) {
80
+ const a = t.find((n) => n.value === r);
81
+ if (a != null && a.children)
82
+ e.push(a.children), t = a.children;
120
83
  else
121
84
  break;
122
85
  }
123
86
  return e;
124
- }, [b, _]), G = w((e, t) => {
125
- var n, l;
126
- const r = [..._.slice(0, t), e.value];
127
- if (!((n = e.children) != null && n.length) || M) {
128
- const f = [];
129
- let u = b;
130
- for (const L of r) {
131
- const g = u.find((Q) => Q.value === L);
132
- g && (f.push(g), g.children && (u = g.children));
87
+ }, [i, f]), J = x((e, t) => {
88
+ var a, n;
89
+ const r = [...f.slice(0, t), e.value];
90
+ if (!((a = e.children) != null && a.length) || B) {
91
+ const d = [];
92
+ let l = i;
93
+ for (const C of r) {
94
+ const p = l.find((Y) => Y.value === C);
95
+ p && (d.push(p), p.children && (l = p.children));
133
96
  }
134
- o == null || o(r, f), (l = e.children) != null && l.length || E(!1);
97
+ c == null || c(r, d), (n = e.children) != null && n.length || w(!1);
135
98
  }
136
- }, [_, b, o, M]), J = w((e, t) => {
137
- A((r) => [...r.slice(0, t), e.value]);
138
- }, []), K = w((e) => {
139
- e.stopPropagation(), o == null || o([], []), A([]);
140
- }, [o]);
99
+ }, [f, i, c, B]), K = x((e, t) => {
100
+ _((r) => [...r.slice(0, t), e.value]);
101
+ }, []), Q = x((e) => {
102
+ e.stopPropagation(), c == null || c([], []), _([]);
103
+ }, [c]);
141
104
  return /* @__PURE__ */ h(
142
105
  "div",
143
106
  {
144
- ref: W,
145
- className: y("Bear-Cascader bear-relative", U),
146
- "data-testid": V,
107
+ ref: P,
108
+ className: N("Bear-Cascader bear-relative", V),
109
+ "data-testid": X,
147
110
  children: [
148
- p && /* @__PURE__ */ c("label", { className: "Bear-Cascader__label bear-block bear-text-sm bear-font-medium bear-text-zinc-700 dark:bear-text-zinc-300 bear-mb-1.5", children: p }),
111
+ y && /* @__PURE__ */ o("label", { className: "Bear-Cascader__label bear-block bear-text-sm bear-font-medium bear-text-zinc-700 dark:bear-text-zinc-300 bear-mb-1.5", children: y }),
149
112
  /* @__PURE__ */ h(
150
113
  "button",
151
114
  {
152
- ref: z,
115
+ ref: k,
153
116
  type: "button",
154
- onClick: () => !m && E(!x),
117
+ onClick: () => !m && w(!b),
155
118
  disabled: m,
156
- className: y(
119
+ className: N(
157
120
  "Bear-Cascader__trigger bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-text-left bear-transition-colors",
158
- te[d],
159
- ae[C],
160
- i ? "bear-border-red-500" : "focus:bear-border-pink-500",
121
+ ae[Z],
122
+ te[H],
123
+ u ? "bear-border-red-500" : "focus:bear-border-pink-500",
161
124
  m && "bear-opacity-50 bear-cursor-not-allowed",
162
- X ? "bear-text-gray-900 dark:bear-text-white" : "bear-text-gray-500 dark:bear-text-zinc-500"
125
+ D ? "bear-text-gray-900 dark:bear-text-white" : "bear-text-gray-500 dark:bear-text-zinc-500"
163
126
  ),
164
127
  children: [
165
- /* @__PURE__ */ c("span", { className: "Bear-Cascader__value bear-truncate bear-flex-1", children: v ? S.loading : X || B || S.placeholder }),
128
+ /* @__PURE__ */ o("span", { className: "Bear-Cascader__value bear-truncate bear-flex-1", children: W ? v.loading : D || I || v.placeholder }),
166
129
  /* @__PURE__ */ h("span", { className: "Bear-Cascader__icons bear-flex bear-items-center bear-gap-1", children: [
167
- a && s.length > 0 && !m && /* @__PURE__ */ c(
130
+ T && s.length > 0 && !m && /* @__PURE__ */ o(
168
131
  "span",
169
132
  {
170
- onClick: K,
133
+ onClick: Q,
171
134
  className: "Bear-Cascader__clear bear-p-0.5 bear-rounded hover:bear-bg-gray-200 dark:hover:bear-bg-zinc-700 bear-cursor-pointer",
172
- children: /* @__PURE__ */ c("svg", { className: "bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
135
+ children: /* @__PURE__ */ o("svg", { className: "bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ o("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
173
136
  }
174
137
  ),
175
- Y ?? /* @__PURE__ */ c(
138
+ q ?? /* @__PURE__ */ o(
176
139
  "svg",
177
140
  {
178
- className: y(
141
+ className: N(
179
142
  "Bear-Cascader__chevron bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-400 bear-transition-transform",
180
- x && "bear-rotate-180"
143
+ b && "bear-rotate-180"
181
144
  ),
182
145
  fill: "none",
183
146
  viewBox: "0 0 24 24",
184
147
  stroke: "currentColor",
185
- children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
148
+ children: /* @__PURE__ */ o("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
186
149
  }
187
150
  )
188
151
  ] })
189
152
  ]
190
153
  }
191
154
  ),
192
- i && /* @__PURE__ */ c("p", { className: "Bear-Cascader__error bear-mt-1 bear-text-xs bear-text-red-400", children: i }),
193
- k && !i && /* @__PURE__ */ c("p", { className: "Bear-Cascader__helper bear-mt-1 bear-text-xs bear-text-zinc-500 dark:bear-text-zinc-400", children: k }),
194
- x && typeof document < "u" && $(
155
+ u && /* @__PURE__ */ o("p", { className: "Bear-Cascader__error bear-mt-1 bear-text-xs bear-text-red-400", children: u }),
156
+ L && !u && /* @__PURE__ */ o("p", { className: "Bear-Cascader__helper bear-mt-1 bear-text-xs bear-text-zinc-500 dark:bear-text-zinc-400", children: L }),
157
+ b && typeof document < "u" && $(
195
158
  /* @__PURE__ */ h(
196
159
  "div",
197
160
  {
198
161
  "data-bear-cascader-dropdown": !0,
199
- className: "Bear-Cascader__dropdown bear-fixed bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-flex bear-overflow-hidden",
200
- style: { top: I.top, left: I.left, zIndex: ne },
162
+ className: "Bear-Cascader__dropdown bear-fixed bear-max-w-[calc(100vw-16px)] bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-flex bear-flex-col sm:bear-flex-row bear-overflow-hidden",
163
+ style: { top: O.top, left: O.left, zIndex: ne },
201
164
  children: [
202
- Z.map((e, t) => /* @__PURE__ */ c(
203
- ce,
165
+ j.map((e, t) => /* @__PURE__ */ o(
166
+ oe,
204
167
  {
205
168
  options: e,
206
169
  selectedPath: s,
207
- expandedPath: _,
208
- onSelect: G,
209
- onExpand: J,
210
- expandTrigger: N,
170
+ expandedPath: f,
171
+ onSelect: J,
172
+ onExpand: K,
173
+ expandTrigger: U,
211
174
  level: t
212
175
  },
213
176
  t
214
177
  )),
215
- Z.every((e) => e.length === 0) && /* @__PURE__ */ c("div", { className: "Bear-Cascader__empty bear-px-4 bear-py-3 bear-text-sm bear-text-gray-500 dark:bear-text-zinc-500", children: S.noOptions })
178
+ j.every((e) => e.length === 0) && /* @__PURE__ */ o("div", { className: "Bear-Cascader__empty bear-px-4 bear-py-3 bear-text-sm bear-text-gray-500 dark:bear-text-zinc-500", children: v.noOptions })
216
179
  ]
217
180
  }
218
181
  ),
@@ -223,5 +186,5 @@ const ce = ({
223
186
  );
224
187
  };
225
188
  export {
226
- be as Cascader
189
+ fe as Cascader
227
190
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),u=require("../../../../utils/cn.cjs");require("react");const g=({options:t,selectedPath:b,expandedPath:d,onSelect:l,onExpand:n,expandTrigger:i,level:s})=>{const o=e=>{var r;l(e,s),(r=e.children)!=null&&r.length&&n(e,s)},h=e=>{var r;i==="hover"&&((r=e.children)!=null&&r.length)&&n(e,s)};return a.jsx("div",{className:"Bear-Cascader__panel bear-min-w-[180px] bear-max-h-[280px] bear-overflow-y-auto bear-border-r bear-border-zinc-200 dark:bear-border-zinc-700 last:bear-border-r-0",children:t.map(e=>{const r=b[s]===e.value,c=d[s]===e.value,x=e.children&&e.children.length>0;return a.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>o(e),onMouseEnter:()=>h(e),className:u.cn("Bear-Cascader__option bear-w-full bear-flex bear-items-center bear-justify-between bear-px-3 bear-py-2 bear-text-sm bear-text-left bear-transition-colors",r&&"Bear-Cascader__option--selected bear-bg-pink-500/20 bear-text-pink-600 dark:bear-text-pink-400",c&&!r&&"Bear-Cascader__option--expanded bear-bg-gray-100 dark:bear-bg-zinc-700",!r&&!c&&"bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700",e.disabled&&"Bear-Cascader__option--disabled bear-opacity-50 bear-cursor-not-allowed"),children:[a.jsxs("span",{className:"bear-flex bear-items-center bear-gap-2",children:[e.icon&&a.jsx("span",{className:"Bear-Cascader__option-icon",children:e.icon}),a.jsx("span",{className:"Bear-Cascader__option-label",children:e.label})]}),x&&a.jsx("svg",{className:"Bear-Cascader__arrow bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},e.value)})})};exports.CascaderPanel=g;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { CascaderPanelProps } from '../../Cascader.types';
3
+ export declare const CascaderPanel: FC<CascaderPanelProps>;
@@ -0,0 +1,50 @@
1
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
2
+ import { cn as u } from "../../../../utils/cn.js";
3
+ import "react";
4
+ const p = ({
5
+ options: t,
6
+ selectedPath: d,
7
+ expandedPath: l,
8
+ onSelect: i,
9
+ onExpand: n,
10
+ expandTrigger: o,
11
+ level: a
12
+ }) => {
13
+ const h = (e) => {
14
+ var r;
15
+ i(e, a), (r = e.children) != null && r.length && n(e, a);
16
+ }, x = (e) => {
17
+ var r;
18
+ o === "hover" && ((r = e.children) != null && r.length) && n(e, a);
19
+ };
20
+ return /* @__PURE__ */ s("div", { className: "Bear-Cascader__panel bear-min-w-[180px] bear-max-h-[280px] bear-overflow-y-auto bear-border-r bear-border-zinc-200 dark:bear-border-zinc-700 last:bear-border-r-0", children: t.map((e) => {
21
+ const r = d[a] === e.value, b = l[a] === e.value, m = e.children && e.children.length > 0;
22
+ return /* @__PURE__ */ c(
23
+ "button",
24
+ {
25
+ type: "button",
26
+ disabled: e.disabled,
27
+ onClick: () => h(e),
28
+ onMouseEnter: () => x(e),
29
+ className: u(
30
+ "Bear-Cascader__option bear-w-full bear-flex bear-items-center bear-justify-between bear-px-3 bear-py-2 bear-text-sm bear-text-left bear-transition-colors",
31
+ r && "Bear-Cascader__option--selected bear-bg-pink-500/20 bear-text-pink-600 dark:bear-text-pink-400",
32
+ b && !r && "Bear-Cascader__option--expanded bear-bg-gray-100 dark:bear-bg-zinc-700",
33
+ !r && !b && "bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700",
34
+ e.disabled && "Bear-Cascader__option--disabled bear-opacity-50 bear-cursor-not-allowed"
35
+ ),
36
+ children: [
37
+ /* @__PURE__ */ c("span", { className: "bear-flex bear-items-center bear-gap-2", children: [
38
+ e.icon && /* @__PURE__ */ s("span", { className: "Bear-Cascader__option-icon", children: e.icon }),
39
+ /* @__PURE__ */ s("span", { className: "Bear-Cascader__option-label", children: e.label })
40
+ ] }),
41
+ m && /* @__PURE__ */ s("svg", { className: "Bear-Cascader__arrow bear-w-4 bear-h-4 bear-text-gray-500 dark:bear-text-zinc-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
42
+ ]
43
+ },
44
+ e.value
45
+ );
46
+ }) });
47
+ };
48
+ export {
49
+ p as CascaderPanel
50
+ };
@@ -0,0 +1 @@
1
+ export { CascaderPanel } from './CascaderPanel';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../../utils/cn.cjs");require("react");const f=require("./Chart.utils.cjs"),v=({data:s,height:m=200,showLabels:x=!0,showValues:i=!1,animated:o=!0,color:u,orientation:g="vertical",barRadius:a=4,barGap:d=.2,className:p,...j})=>{const h=Math.max(...s.map(t=>t.value));return e.jsx("div",{className:n.cn("w-full",p),style:{height:m},...j,children:g==="vertical"?e.jsx("div",{className:"flex items-end justify-between h-full",style:{gap:`${d}rem`},children:s.map((t,l)=>{const r=t.value/h*100,c=f.getChartColor(l,t.color||u);return e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-full flex-1 flex items-end",children:e.jsx("div",{className:n.cn("w-full transition-all duration-500 ease-out",o&&"animate-grow-up"),style:{height:`${r}%`,backgroundColor:c,borderRadius:`${a}px ${a}px 0 0`,opacity:.9}})}),i&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:t.value}),x&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 truncate max-w-full",children:t.label})]},l)})}):e.jsx("div",{className:"flex flex-col justify-between h-full",style:{gap:`${d}rem`},children:s.map((t,l)=>{const r=t.value/h*100,c=f.getChartColor(l,t.color||u);return e.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[x&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 w-16 truncate",children:t.label}),e.jsx("div",{className:"flex-1 h-full flex items-center",children:e.jsx("div",{className:n.cn("h-3/4 transition-all duration-500 ease-out",o&&"animate-grow-right"),style:{width:`${r}%`,backgroundColor:c,borderRadius:`0 ${a}px ${a}px 0`,opacity:.9}})}),i&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400 w-10 text-right",children:t.value})]},l)})})})};exports.BarChart=v;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { BarChartProps } from './Chart.types';
3
+ export declare const BarChart: FC<BarChartProps>;
@@ -0,0 +1,65 @@
1
+ import { jsx as l, jsxs as f } from "react/jsx-runtime";
2
+ import { cn as n } from "../../utils/cn.js";
3
+ import "react";
4
+ import { getChartColor as h } from "./Chart.utils.js";
5
+ const C = ({
6
+ data: r,
7
+ height: p = 200,
8
+ showLabels: o = !0,
9
+ showValues: i = !1,
10
+ animated: x = !0,
11
+ color: d,
12
+ orientation: g = "vertical",
13
+ barRadius: a = 4,
14
+ barGap: m = 0.2,
15
+ className: v,
16
+ ...y
17
+ }) => {
18
+ const u = Math.max(...r.map((e) => e.value));
19
+ return /* @__PURE__ */ l("div", { className: n("w-full", v), style: { height: p }, ...y, children: g === "vertical" ? /* @__PURE__ */ l("div", { className: "flex items-end justify-between h-full", style: { gap: `${m}rem` }, children: r.map((e, t) => {
20
+ const s = e.value / u * 100, c = h(t, e.color || d);
21
+ return /* @__PURE__ */ f("div", { className: "flex-1 flex flex-col items-center gap-1", children: [
22
+ /* @__PURE__ */ l("div", { className: "w-full flex-1 flex items-end", children: /* @__PURE__ */ l(
23
+ "div",
24
+ {
25
+ className: n(
26
+ "w-full transition-all duration-500 ease-out",
27
+ x && "animate-grow-up"
28
+ ),
29
+ style: {
30
+ height: `${s}%`,
31
+ backgroundColor: c,
32
+ borderRadius: `${a}px ${a}px 0 0`,
33
+ opacity: 0.9
34
+ }
35
+ }
36
+ ) }),
37
+ i && /* @__PURE__ */ l("span", { className: "text-xs text-gray-500 dark:text-slate-400", children: e.value }),
38
+ o && /* @__PURE__ */ l("span", { className: "text-xs text-gray-600 dark:text-slate-300 truncate max-w-full", children: e.label })
39
+ ] }, t);
40
+ }) }) : /* @__PURE__ */ l("div", { className: "flex flex-col justify-between h-full", style: { gap: `${m}rem` }, children: r.map((e, t) => {
41
+ const s = e.value / u * 100, c = h(t, e.color || d);
42
+ return /* @__PURE__ */ f("div", { className: "flex-1 flex items-center gap-2", children: [
43
+ o && /* @__PURE__ */ l("span", { className: "text-xs text-gray-600 dark:text-slate-300 w-16 truncate", children: e.label }),
44
+ /* @__PURE__ */ l("div", { className: "flex-1 h-full flex items-center", children: /* @__PURE__ */ l(
45
+ "div",
46
+ {
47
+ className: n(
48
+ "h-3/4 transition-all duration-500 ease-out",
49
+ x && "animate-grow-right"
50
+ ),
51
+ style: {
52
+ width: `${s}%`,
53
+ backgroundColor: c,
54
+ borderRadius: `0 ${a}px ${a}px 0`,
55
+ opacity: 0.9
56
+ }
57
+ }
58
+ ) }),
59
+ i && /* @__PURE__ */ l("span", { className: "text-xs text-gray-500 dark:text-slate-400 w-10 text-right", children: e.value })
60
+ ] }, t);
61
+ }) }) });
62
+ };
63
+ export {
64
+ C as BarChart
65
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("react"),d=require("../../utils/cn.cjs"),w=require("./Chart.utils.cjs"),M=({data:r,height:o=200,showLabels:y=!0,showValues:f=!1,animated:h=!0,color:m,orientation:p="vertical",barRadius:i=4,barGap:$=.2,className:j,...v})=>{const n=Math.max(...r.map(l=>l.value));return e.jsx("div",{className:d.cn("w-full",j),style:{height:o},...v,children:p==="vertical"?e.jsx("div",{className:"flex items-end justify-between h-full gap-2",children:r.map((l,a)=>{const t=l.value/n*100,s=w.getChartColor(a,l.color||m);return e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-full flex-1 flex items-end",children:e.jsx("div",{className:d.cn("w-full transition-all duration-500 ease-out",h&&"animate-grow-up"),style:{height:`${t}%`,backgroundColor:s,borderRadius:`${i}px ${i}px 0 0`,opacity:.9}})}),f&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:l.value}),y&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 truncate max-w-full",children:l.label})]},a)})}):e.jsx("div",{className:"flex flex-col justify-between h-full gap-2",children:r.map((l,a)=>{const t=l.value/n*100,s=w.getChartColor(a,l.color||m);return e.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[y&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 w-16 truncate",children:l.label}),e.jsx("div",{className:"flex-1 h-full flex items-center",children:e.jsx("div",{className:d.cn("h-3/4 transition-all duration-500 ease-out",h&&"animate-grow-right"),style:{width:`${t}%`,backgroundColor:s,borderRadius:`0 ${i}px ${i}px 0`,opacity:.9}})}),f&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400 w-10 text-right",children:l.value})]},a)})})})},R=({data:r,height:o=200,showLabels:y=!0,showDots:f=!0,smooth:h=!0,fill:m=!1,strokeWidth:p=2,color:i="#ec4899",animated:$=!0,className:j,...v})=>{const n=C.useMemo(()=>{const t=Math.max(...r.map(c=>c.value)),s=Math.min(...r.map(c=>c.value)),x=t-s||1;return r.map((c,u)=>({x:u/(r.length-1||1)*100,y:100-(c.value-s)/x*80-10,...c}))},[r]),l=C.useMemo(()=>n.length===0?"":h?n.reduce((t,s,x,c)=>{if(x===0)return`M ${s.x},${s.y}`;const u=c[x-1],g=u.x+(s.x-u.x)/3,N=s.x-(s.x-u.x)/3;return`${t} C ${g},${u.y} ${N},${s.y} ${s.x},${s.y}`},""):n.reduce((t,s,x)=>`${t} ${x===0?"M":"L"} ${s.x},${s.y}`,""),[n,h]),a=C.useMemo(()=>n.length===0?"":`${l} L 100,100 L 0,100 Z`,[l,n]);return e.jsxs("div",{className:d.cn("w-full",j),style:{height:o},...v,children:[e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",className:"w-full h-full",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"line-gradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:i,stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:i,stopOpacity:"0"})]})}),m&&e.jsx("path",{d:a,fill:"url(#line-gradient)",className:d.cn($&&"animate-fade-in")}),e.jsx("path",{d:l,fill:"none",stroke:i,strokeWidth:p/10,strokeLinecap:"round",strokeLinejoin:"round",className:d.cn($&&"animate-draw-line")}),f&&n.map((t,s)=>e.jsx("circle",{cx:t.x,cy:t.y,r:1.5,fill:i,className:d.cn($&&"animate-scale-in"),style:{animationDelay:`${s*50}ms`}},s))]}),y&&e.jsx("div",{className:"flex justify-between mt-2",children:r.map((t,s)=>e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300",children:t.label},s))})]})},k=({data:r,height:o=200,showLabels:y=!0,innerRadius:f=0,startAngle:h=-90,padAngle:m=2,animated:p=!0,className:i,...$})=>{const j=r.reduce((a,t)=>a+t.value,0),v=C.useMemo(()=>{let a=h;return r.map((t,s)=>{const x=t.value/j*360-m,c={startAngle:a,endAngle:a+x,color:w.getChartColor(s,t.color),...t};return a+=x+m,c})},[r,j,h,m]),n=(a,t)=>{const s=a*Math.PI/180;return{x:50+t*Math.cos(s),y:50+t*Math.sin(s)}},l=(a,t)=>{const x=f*45,c=n(a,45),u=n(t,45),g=n(a,x),N=n(t,x),b=t-a>180?1:0;return f>0?`M ${c.x},${c.y} A 45,45 0 ${b},1 ${u.x},${u.y} L ${N.x},${N.y} A ${x},${x} 0 ${b},0 ${g.x},${g.y} Z`:`M 50,50 L ${c.x},${c.y} A 45,45 0 ${b},1 ${u.x},${u.y} Z`};return e.jsxs("div",{className:d.cn("flex items-center gap-4",i),...$,children:[e.jsx("div",{style:{width:o,height:o},children:e.jsx("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:v.map((a,t)=>e.jsx("path",{d:l(a.startAngle,a.endAngle),fill:a.color,className:d.cn("transition-opacity hover:opacity-80",p&&"animate-scale-in"),style:{animationDelay:`${t*100}ms`}},t))})}),y&&e.jsx("div",{className:"flex flex-col gap-2",children:r.map((a,t)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.getChartColor(t,a.color)}}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-slate-300",children:a.label}),e.jsxs("span",{className:"text-sm text-gray-400 dark:text-slate-500",children:[Math.round(a.value/j*100),"%"]})]},t))})]})},L=({type:r,...o})=>{switch(r){case"bar":return e.jsx(M,{...o});case"line":case"area":return e.jsx(R,{...o,fill:r==="area"});case"pie":return e.jsx(k,{...o});case"donut":return e.jsx(k,{...o,innerRadius:.6});default:return e.jsx(M,{...o})}};exports.BarChart=M;exports.Chart=L;exports.LineChart=R;exports.PieChart=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),n=require("./BarChart.cjs"),s=require("./LineChart.cjs"),i=require("./PieChart.cjs"),r=require("./Chart.const.cjs"),C=({type:a,...e})=>{switch(a){case r.CHART_TYPES.BAR:return t.jsx(n.BarChart,{...e});case r.CHART_TYPES.LINE:case r.CHART_TYPES.AREA:return t.jsx(s.LineChart,{...e,fill:a===r.CHART_TYPES.AREA});case r.CHART_TYPES.PIE:return t.jsx(i.PieChart,{...e});case r.CHART_TYPES.DONUT:return t.jsx(i.PieChart,{...e,innerRadius:r.CHART.DEFAULT_INNER_RADIUS});default:return t.jsx(n.BarChart,{...e})}};exports.Chart=C;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["#ec4899","#8b5cf6","#3b82f6","#10b981","#f59e0b","#ef4444","#06b6d4","#84cc16"];exports.DEFAULT_COLORS=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={DEFAULT_INNER_RADIUS:.6},A={BAR:"bar",LINE:"line",AREA:"area",PIE:"pie",DONUT:"donut"},T=["#ec4899","#8b5cf6","#3b82f6","#10b981","#f59e0b","#ef4444","#06b6d4","#84cc16"];exports.CHART=e;exports.CHART_TYPES=A;exports.DEFAULT_COLORS=T;
@@ -12,4 +12,11 @@ export declare const CHART: {
12
12
  readonly OUTER_RADIUS: 45;
13
13
  readonly CENTER: 50;
14
14
  };
15
+ export declare const CHART_TYPES: {
16
+ readonly BAR: "bar";
17
+ readonly LINE: "line";
18
+ readonly AREA: "area";
19
+ readonly PIE: "pie";
20
+ readonly DONUT: "donut";
21
+ };
15
22
  export declare const DEFAULT_COLORS: readonly ["#ec4899", "#8b5cf6", "#3b82f6", "#10b981", "#f59e0b", "#ef4444", "#06b6d4", "#84cc16"];
@@ -1,4 +1,12 @@
1
- const b = [
1
+ const A = {
2
+ DEFAULT_INNER_RADIUS: 0.6
3
+ }, c = {
4
+ BAR: "bar",
5
+ LINE: "line",
6
+ AREA: "area",
7
+ PIE: "pie",
8
+ DONUT: "donut"
9
+ }, e = [
2
10
  "#ec4899",
3
11
  // pink
4
12
  "#8b5cf6",
@@ -17,5 +25,7 @@ const b = [
17
25
  // lime
18
26
  ];
19
27
  export {
20
- b as DEFAULT_COLORS
28
+ A as CHART,
29
+ c as CHART_TYPES,
30
+ e as DEFAULT_COLORS
21
31
  };
@@ -1,17 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { ChartProps, BarChartProps, LineChartProps, PieChartProps } from './Chart.types';
3
- /**
4
- * BarChart Component
5
- */
6
- export declare const BarChart: FC<BarChartProps>;
7
- /**
8
- * LineChart Component
9
- */
10
- export declare const LineChart: FC<LineChartProps>;
11
- /**
12
- * PieChart Component
13
- */
14
- export declare const PieChart: FC<PieChartProps>;
2
+ import { ChartProps } from './Chart.types';
15
3
  /**
16
4
  * Main Chart Component
17
5
  */