@forgedevstack/bear 1.0.3 → 1.0.4

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 (295) hide show
  1. package/dist/components/Accordion/Accordion.cjs +1 -1
  2. package/dist/components/Accordion/Accordion.const.cjs +1 -0
  3. package/dist/components/Accordion/Accordion.const.d.ts +10 -0
  4. package/dist/components/Accordion/Accordion.const.js +8 -0
  5. package/dist/components/Accordion/Accordion.d.ts +1 -0
  6. package/dist/components/Accordion/Accordion.js +49 -44
  7. package/dist/components/Accordion/Accordion.types.d.ts +2 -0
  8. package/dist/components/Accordion/index.d.ts +3 -2
  9. package/dist/components/ActivityItem/ActivityItem.cjs +1 -0
  10. package/dist/components/ActivityItem/ActivityItem.d.ts +7 -0
  11. package/dist/components/ActivityItem/ActivityItem.js +44 -0
  12. package/dist/components/ActivityItem/ActivityItem.types.d.ts +17 -0
  13. package/dist/components/ActivityItem/index.d.ts +2 -0
  14. package/dist/components/Alert/Alert.cjs +1 -1
  15. package/dist/components/Alert/Alert.const.cjs +1 -0
  16. package/dist/components/Alert/Alert.const.d.ts +14 -0
  17. package/dist/components/Alert/Alert.const.js +27 -0
  18. package/dist/components/Alert/Alert.js +54 -63
  19. package/dist/components/Alert/Alert.types.d.ts +3 -1
  20. package/dist/components/Avatar/Avatar.cjs +1 -1
  21. package/dist/components/Avatar/Avatar.const.cjs +1 -0
  22. package/dist/components/Avatar/Avatar.const.d.ts +28 -0
  23. package/dist/components/Avatar/Avatar.const.js +28 -0
  24. package/dist/components/Avatar/Avatar.js +49 -60
  25. package/dist/components/Avatar/index.d.ts +1 -0
  26. package/dist/components/Badge/Badge.cjs +1 -1
  27. package/dist/components/Badge/Badge.js +24 -22
  28. package/dist/components/BearLogo/EmberLogo.cjs +17 -0
  29. package/dist/components/BearLogo/EmberLogo.js +91 -0
  30. package/dist/components/BearLogo/index.d.ts +2 -0
  31. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
  32. package/dist/components/Breadcrumbs/Breadcrumbs.const.cjs +1 -0
  33. package/dist/components/Breadcrumbs/Breadcrumbs.const.d.ts +16 -0
  34. package/dist/components/Breadcrumbs/Breadcrumbs.const.js +19 -0
  35. package/dist/components/Breadcrumbs/Breadcrumbs.js +49 -34
  36. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +8 -1
  37. package/dist/components/Button/Button.cjs +1 -1
  38. package/dist/components/Button/Button.constants.cjs +1 -1
  39. package/dist/components/Button/Button.constants.d.ts +2 -2
  40. package/dist/components/Button/Button.constants.js +2 -2
  41. package/dist/components/Button/Button.js +41 -46
  42. package/dist/components/Calendar/Calendar.cjs +1 -1
  43. package/dist/components/Calendar/Calendar.helpers.cjs +1 -0
  44. package/dist/components/Calendar/Calendar.helpers.d.ts +10 -0
  45. package/dist/components/Calendar/Calendar.helpers.js +9 -0
  46. package/dist/components/Calendar/Calendar.js +112 -115
  47. package/dist/components/Card/Card.cjs +1 -1
  48. package/dist/components/Card/Card.const.cjs +1 -0
  49. package/dist/components/Card/Card.const.d.ts +13 -0
  50. package/dist/components/Card/Card.const.js +32 -0
  51. package/dist/components/Card/Card.d.ts +1 -0
  52. package/dist/components/Card/Card.js +101 -105
  53. package/dist/components/Card/index.d.ts +3 -2
  54. package/dist/components/Chart/Chart.cjs +1 -0
  55. package/dist/components/Chart/Chart.const.d.ts +15 -0
  56. package/dist/components/Chart/Chart.d.ts +18 -0
  57. package/dist/components/Chart/Chart.js +225 -0
  58. package/dist/components/Chart/Chart.types.d.ts +51 -0
  59. package/dist/components/Chart/Chart.utils.d.ts +31 -0
  60. package/dist/components/Chart/index.d.ts +2 -0
  61. package/dist/components/CodeBlock/CodeBlock.cjs +2 -2
  62. package/dist/components/CodeBlock/CodeBlock.js +65 -52
  63. package/dist/components/CodeBlock/CodeBlock.types.d.ts +12 -1
  64. package/dist/components/Editable/Editable.cjs +1 -1
  65. package/dist/components/Editable/Editable.js +115 -115
  66. package/dist/components/Gauge/Gauge.cjs +1 -0
  67. package/dist/components/Gauge/Gauge.d.ts +3 -0
  68. package/dist/components/Gauge/Gauge.js +92 -0
  69. package/dist/components/Gauge/Gauge.types.d.ts +27 -0
  70. package/dist/components/Gauge/index.d.ts +2 -0
  71. package/dist/components/Icon/icons/editor.cjs +1 -1
  72. package/dist/components/Icon/icons/editor.d.ts +1 -0
  73. package/dist/components/Icon/icons/editor.js +66 -61
  74. package/dist/components/Icon/icons/misc.cjs +1 -1
  75. package/dist/components/Icon/icons/misc.d.ts +13 -0
  76. package/dist/components/Icon/icons/misc.js +157 -88
  77. package/dist/components/Icon/index.d.ts +22 -0
  78. package/dist/components/Input/Input.cjs +1 -1
  79. package/dist/components/Input/Input.js +36 -35
  80. package/dist/components/Modal/Modal.cjs +1 -1
  81. package/dist/components/Modal/Modal.const.cjs +1 -0
  82. package/dist/components/Modal/Modal.const.d.ts +10 -0
  83. package/dist/components/Modal/Modal.const.js +17 -0
  84. package/dist/components/Modal/Modal.d.ts +11 -0
  85. package/dist/components/Modal/Modal.js +80 -77
  86. package/dist/components/Modal/Modal.types.d.ts +6 -1
  87. package/dist/components/Modal/index.d.ts +3 -2
  88. package/dist/components/Rating/Rating.cjs +1 -1
  89. package/dist/components/Rating/Rating.const.cjs +1 -0
  90. package/dist/components/Rating/Rating.const.d.ts +14 -0
  91. package/dist/components/Rating/Rating.const.js +22 -0
  92. package/dist/components/Rating/Rating.d.ts +5 -10
  93. package/dist/components/Rating/Rating.js +135 -93
  94. package/dist/components/Rating/Rating.types.d.ts +27 -25
  95. package/dist/components/Rating/index.d.ts +2 -2
  96. package/dist/components/RichEditor/RichEditor.cjs +1 -10
  97. package/dist/components/RichEditor/RichEditor.const.cjs +141 -0
  98. package/dist/components/RichEditor/RichEditor.const.d.ts +137 -0
  99. package/dist/components/RichEditor/RichEditor.const.js +279 -0
  100. package/dist/components/RichEditor/RichEditor.d.ts +14 -0
  101. package/dist/components/RichEditor/RichEditor.js +341 -129
  102. package/dist/components/RichEditor/RichEditor.types.d.ts +38 -1
  103. package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.cjs +1 -0
  104. package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.d.ts +4 -0
  105. package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.js +25 -0
  106. package/dist/components/RichEditor/components/ToolbarButton/index.d.ts +1 -0
  107. package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -0
  108. package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.d.ts +4 -0
  109. package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +126 -0
  110. package/dist/components/RichEditor/components/ToolbarColorPicker/index.d.ts +1 -0
  111. package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -0
  112. package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.d.ts +4 -0
  113. package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.js +57 -0
  114. package/dist/components/RichEditor/components/ToolbarDropdown/index.d.ts +1 -0
  115. package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.cjs +1 -0
  116. package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.d.ts +7 -0
  117. package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.js +45 -0
  118. package/dist/components/RichEditor/components/ToolbarMore/index.d.ts +2 -0
  119. package/dist/components/RichEditor/components/index.d.ts +4 -0
  120. package/dist/components/RichEditor/helpers/formatHelpers.cjs +1 -0
  121. package/dist/components/RichEditor/helpers/formatHelpers.d.ts +57 -0
  122. package/dist/components/RichEditor/helpers/formatHelpers.js +26 -0
  123. package/dist/components/RichEditor/helpers/index.d.ts +1 -0
  124. package/dist/components/RichEditor/index.d.ts +4 -2
  125. package/dist/components/Sidebar/Sidebar.cjs +1 -1
  126. package/dist/components/Sidebar/Sidebar.const.cjs +1 -0
  127. package/dist/components/Sidebar/Sidebar.const.d.ts +16 -0
  128. package/dist/components/Sidebar/Sidebar.const.js +22 -0
  129. package/dist/components/Sidebar/Sidebar.d.ts +14 -2
  130. package/dist/components/Sidebar/Sidebar.js +50 -138
  131. package/dist/components/Sidebar/Sidebar.types.d.ts +7 -3
  132. package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.cjs +1 -0
  133. package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.d.ts +4 -0
  134. package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.js +45 -0
  135. package/dist/components/Sidebar/components/SidebarGroup/index.d.ts +2 -0
  136. package/dist/components/Sidebar/components/SidebarItem/SidebarItem.cjs +1 -0
  137. package/dist/components/Sidebar/components/SidebarItem/SidebarItem.d.ts +4 -0
  138. package/dist/components/Sidebar/components/SidebarItem/SidebarItem.js +66 -0
  139. package/dist/components/Sidebar/components/SidebarItem/index.d.ts +2 -0
  140. package/dist/components/Sidebar/components/index.d.ts +2 -0
  141. package/dist/components/Sidebar/index.d.ts +5 -2
  142. package/dist/components/SignPad/SignPad.cjs +1 -0
  143. package/dist/components/SignPad/SignPad.const.cjs +1 -0
  144. package/dist/components/SignPad/SignPad.const.d.ts +19 -0
  145. package/dist/components/SignPad/SignPad.const.js +20 -0
  146. package/dist/components/SignPad/SignPad.d.ts +17 -0
  147. package/dist/components/SignPad/SignPad.js +161 -0
  148. package/dist/components/SignPad/SignPad.types.d.ts +37 -0
  149. package/dist/components/SignPad/index.d.ts +3 -0
  150. package/dist/components/Skeleton/Skeleton.cjs +1 -1
  151. package/dist/components/Skeleton/Skeleton.const.cjs +36 -0
  152. package/dist/components/Skeleton/Skeleton.const.d.ts +12 -0
  153. package/dist/components/Skeleton/Skeleton.const.js +58 -0
  154. package/dist/components/Skeleton/Skeleton.d.ts +15 -24
  155. package/dist/components/Skeleton/Skeleton.js +132 -103
  156. package/dist/components/Skeleton/Skeleton.types.d.ts +18 -8
  157. package/dist/components/Skeleton/index.d.ts +2 -2
  158. package/dist/components/Sparkline/Sparkline.cjs +1 -0
  159. package/dist/components/Sparkline/Sparkline.const.cjs +1 -0
  160. package/dist/components/Sparkline/Sparkline.const.d.ts +16 -0
  161. package/dist/components/Sparkline/Sparkline.const.js +16 -0
  162. package/dist/components/Sparkline/Sparkline.d.ts +3 -0
  163. package/dist/components/Sparkline/Sparkline.js +80 -0
  164. package/dist/components/Sparkline/Sparkline.types.d.ts +19 -0
  165. package/dist/components/Sparkline/Sparkline.utils.cjs +1 -0
  166. package/dist/components/Sparkline/Sparkline.utils.d.ts +27 -0
  167. package/dist/components/Sparkline/Sparkline.utils.js +30 -0
  168. package/dist/components/Sparkline/index.d.ts +5 -0
  169. package/dist/components/SpeedDial/SpeedDial.cjs +12 -1
  170. package/dist/components/SpeedDial/SpeedDial.const.cjs +1 -0
  171. package/dist/components/SpeedDial/SpeedDial.const.d.ts +22 -0
  172. package/dist/components/SpeedDial/SpeedDial.const.js +26 -0
  173. package/dist/components/SpeedDial/SpeedDial.d.ts +5 -7
  174. package/dist/components/SpeedDial/SpeedDial.js +154 -144
  175. package/dist/components/SpeedDial/SpeedDial.types.d.ts +26 -29
  176. package/dist/components/SpeedDial/index.d.ts +1 -1
  177. package/dist/components/Spinner/Spinner.cjs +1 -1
  178. package/dist/components/Spinner/Spinner.js +17 -15
  179. package/dist/components/StatCard/StatCard.cjs +1 -0
  180. package/dist/components/StatCard/StatCard.d.ts +7 -0
  181. package/dist/components/StatCard/StatCard.js +36 -0
  182. package/dist/components/StatCard/StatCard.types.d.ts +13 -0
  183. package/dist/components/StatCard/index.d.ts +2 -0
  184. package/dist/components/Stepper/Stepper.cjs +1 -1
  185. package/dist/components/Stepper/Stepper.const.cjs +1 -0
  186. package/dist/components/Stepper/Stepper.const.d.ts +29 -0
  187. package/dist/components/Stepper/Stepper.const.js +46 -0
  188. package/dist/components/Stepper/Stepper.d.ts +10 -3
  189. package/dist/components/Stepper/Stepper.js +143 -92
  190. package/dist/components/Stepper/Stepper.types.d.ts +63 -13
  191. package/dist/components/Stepper/index.d.ts +2 -2
  192. package/dist/components/Switch/Switch.cjs +1 -1
  193. package/dist/components/Switch/Switch.js +74 -47
  194. package/dist/components/Switch/Switch.types.d.ts +11 -1
  195. package/dist/components/Tabs/Tabs.cjs +1 -1
  196. package/dist/components/Tabs/Tabs.js +33 -29
  197. package/dist/components/TimePicker/TimePicker.cjs +1 -1
  198. package/dist/components/TimePicker/TimePicker.constants.cjs +1 -1
  199. package/dist/components/TimePicker/TimePicker.constants.d.ts +14 -0
  200. package/dist/components/TimePicker/TimePicker.constants.js +18 -4
  201. package/dist/components/TimePicker/TimePicker.js +92 -91
  202. package/dist/components/Timeline/Timeline.cjs +1 -1
  203. package/dist/components/Timeline/Timeline.const.cjs +1 -0
  204. package/dist/components/Timeline/Timeline.const.d.ts +40 -0
  205. package/dist/components/Timeline/Timeline.const.js +58 -0
  206. package/dist/components/Timeline/Timeline.d.ts +16 -2
  207. package/dist/components/Timeline/Timeline.js +131 -63
  208. package/dist/components/Timeline/Timeline.types.d.ts +30 -11
  209. package/dist/components/Timeline/index.d.ts +1 -1
  210. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  211. package/dist/components/Tooltip/Tooltip.js +37 -35
  212. package/dist/components/Typography/Typography.cjs +1 -1
  213. package/dist/components/Typography/Typography.js +38 -36
  214. package/dist/components/index.cjs +1 -1
  215. package/dist/components/index.d.ts +17 -5
  216. package/dist/components/index.js +216 -195
  217. package/dist/hooks/index.cjs +1 -1
  218. package/dist/hooks/index.d.ts +24 -0
  219. package/dist/hooks/index.js +42 -14
  220. package/dist/hooks/useBounce/index.d.ts +2 -0
  221. package/dist/hooks/useBounce/useBounce.cjs +1 -0
  222. package/dist/hooks/useBounce/useBounce.d.ts +2 -0
  223. package/dist/hooks/useBounce/useBounce.js +36 -0
  224. package/dist/hooks/useBounce/useBounce.types.d.ts +27 -0
  225. package/dist/hooks/useClickOutside/index.d.ts +2 -0
  226. package/dist/hooks/useClickOutside/useClickOutside.d.ts +22 -0
  227. package/dist/hooks/useClickOutside/useClickOutside.types.d.ts +10 -0
  228. package/dist/hooks/useClipboard/index.d.ts +2 -0
  229. package/dist/hooks/useClipboard/useClipboard.cjs +1 -0
  230. package/dist/hooks/useClipboard/useClipboard.d.ts +15 -0
  231. package/dist/hooks/useClipboard/useClipboard.js +22 -0
  232. package/dist/hooks/useClipboard/useClipboard.types.d.ts +20 -0
  233. package/dist/hooks/useDebounce/index.d.ts +2 -0
  234. package/dist/hooks/useDebounce/useDebounce.cjs +1 -0
  235. package/dist/hooks/useDebounce/useDebounce.d.ts +32 -0
  236. package/dist/hooks/useDebounce/useDebounce.js +39 -0
  237. package/dist/hooks/useDebounce/useDebounce.types.d.ts +20 -0
  238. package/dist/hooks/useFloat/index.d.ts +2 -0
  239. package/dist/hooks/useFloat/useFloat.cjs +1 -0
  240. package/dist/hooks/useFloat/useFloat.d.ts +2 -0
  241. package/dist/hooks/useFloat/useFloat.js +37 -0
  242. package/dist/hooks/useFloat/useFloat.types.d.ts +25 -0
  243. package/dist/hooks/useIntersectionObserver/index.d.ts +2 -0
  244. package/dist/hooks/useIntersectionObserver/useIntersectionObserver.cjs +1 -0
  245. package/dist/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +25 -0
  246. package/dist/hooks/useIntersectionObserver/useIntersectionObserver.js +39 -0
  247. package/dist/hooks/useIntersectionObserver/useIntersectionObserver.types.d.ts +22 -0
  248. package/dist/hooks/useKeyPress/index.d.ts +2 -0
  249. package/dist/hooks/useKeyPress/useKeyPress.cjs +1 -0
  250. package/dist/hooks/useKeyPress/useKeyPress.d.ts +22 -0
  251. package/dist/hooks/useKeyPress/useKeyPress.js +39 -0
  252. package/dist/hooks/useKeyPress/useKeyPress.types.d.ts +19 -0
  253. package/dist/hooks/useLocalStorage/index.d.ts +2 -0
  254. package/dist/hooks/useLocalStorage/useLocalStorage.cjs +1 -0
  255. package/dist/hooks/useLocalStorage/useLocalStorage.d.ts +11 -0
  256. package/dist/hooks/useLocalStorage/useLocalStorage.js +47 -0
  257. package/dist/hooks/useLocalStorage/useLocalStorage.types.d.ts +16 -0
  258. package/dist/hooks/useMediaQuery/index.d.ts +3 -0
  259. package/dist/hooks/useMediaQuery/useMediaQuery.d.ts +12 -0
  260. package/dist/hooks/useMediaQuery/useMediaQuery.types.d.ts +21 -0
  261. package/dist/hooks/useParallax/index.d.ts +2 -0
  262. package/dist/hooks/useParallax/useParallax.cjs +1 -0
  263. package/dist/hooks/useParallax/useParallax.d.ts +2 -0
  264. package/dist/hooks/useParallax/useParallax.js +36 -0
  265. package/dist/hooks/useParallax/useParallax.types.d.ts +19 -0
  266. package/dist/hooks/usePulse/index.d.ts +2 -0
  267. package/dist/hooks/usePulse/usePulse.cjs +1 -0
  268. package/dist/hooks/usePulse/usePulse.d.ts +2 -0
  269. package/dist/hooks/usePulse/usePulse.js +38 -0
  270. package/dist/hooks/usePulse/usePulse.types.d.ts +29 -0
  271. package/dist/hooks/useShake/index.d.ts +2 -0
  272. package/dist/hooks/useShake/useShake.cjs +1 -0
  273. package/dist/hooks/useShake/useShake.d.ts +2 -0
  274. package/dist/hooks/useShake/useShake.js +14 -0
  275. package/dist/hooks/useShake/useShake.types.d.ts +19 -0
  276. package/dist/hooks/useSlide/index.d.ts +2 -0
  277. package/dist/hooks/useSlide/useSlide.cjs +1 -0
  278. package/dist/hooks/useSlide/useSlide.d.ts +2 -0
  279. package/dist/hooks/useSlide/useSlide.js +68 -0
  280. package/dist/hooks/useSlide/useSlide.types.d.ts +36 -0
  281. package/dist/hooks/useThrottle/index.d.ts +2 -0
  282. package/dist/hooks/useThrottle/useThrottle.cjs +1 -0
  283. package/dist/hooks/useThrottle/useThrottle.d.ts +26 -0
  284. package/dist/hooks/useThrottle/useThrottle.js +44 -0
  285. package/dist/hooks/useThrottle/useThrottle.types.d.ts +8 -0
  286. package/dist/index.cjs +1 -1
  287. package/dist/index.js +273 -224
  288. package/dist/styles.css +1 -1
  289. package/package.json +14 -21
  290. package/dist/components/RichEditor/RichEditor.icons.cjs +0 -1
  291. package/dist/components/RichEditor/RichEditor.icons.d.ts +0 -16
  292. package/dist/components/RichEditor/RichEditor.icons.js +0 -62
  293. package/dist/components/RichEditor/RichEditor.utils.cjs +0 -1
  294. package/dist/components/RichEditor/RichEditor.utils.d.ts +0 -3
  295. package/dist/components/RichEditor/RichEditor.utils.js +0 -22
@@ -1,158 +1,70 @@
1
- import { jsxs as s, jsx as r, Fragment as g } from "react/jsx-runtime";
2
- import { useState as z, useCallback as S } from "react";
3
- import { cn as l } from "../../utils/cn.js";
4
- import { ChevronRightIcon as v, ChevronLeftIcon as y, ChevronDownIcon as N } from "../Icon/index.js";
5
- const k = 256, C = 64, w = ({
6
- item: e,
7
- isActive: b,
8
- collapsed: a,
9
- depth: i = 0,
10
- onClick: n
11
- }) => {
12
- const [t, o] = z(!1), d = e.children && e.children.length > 0, u = a ? 16 : 16 + i * 12, f = S(() => {
13
- d && o((c) => !c), e.onClick && e.onClick(), n == null || n(e);
14
- }, [d, e, n]), h = /* @__PURE__ */ s(g, { children: [
15
- e.icon && /* @__PURE__ */ r("span", { className: "bear-shrink-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center", children: e.icon }),
16
- !a && /* @__PURE__ */ s(g, { children: [
17
- /* @__PURE__ */ r("span", { className: "bear-flex-1 bear-truncate", children: e.label }),
18
- e.badge && /* @__PURE__ */ r("span", { className: "bear-ml-auto", children: e.badge }),
19
- d && /* @__PURE__ */ r(
20
- N,
21
- {
22
- size: 14,
23
- className: l(
24
- "bear-ml-1 bear-transition-transform bear-duration-200",
25
- t && "bear-rotate-180"
26
- )
27
- }
28
- )
29
- ] })
30
- ] }), m = l(
31
- "bear-flex bear-items-center bear-gap-3 bear-py-2.5 bear-px-3 bear-rounded-lg bear-text-sm bear-transition-all bear-duration-200 bear-cursor-pointer",
32
- b ? "bear-bg-bear-500 bear-text-white bear-shadow-md" : "bear-text-zinc-600 hover:bear-bg-zinc-100 hover:bear-text-zinc-900",
33
- e.disabled && "bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none",
34
- a && "bear-justify-center"
35
- ), x = e.href ? "a" : "button";
36
- return /* @__PURE__ */ s("div", { children: [
37
- /* @__PURE__ */ r(
38
- x,
39
- {
40
- href: e.href,
41
- onClick: f,
42
- disabled: e.disabled,
43
- className: m,
44
- style: { paddingLeft: u },
45
- title: a ? e.label : void 0,
46
- children: h
47
- }
48
- ),
49
- d && t && !a && /* @__PURE__ */ r("div", { className: "bear-mt-1", children: e.children.map((c) => /* @__PURE__ */ r(
50
- w,
51
- {
52
- item: c,
53
- isActive: !1,
54
- collapsed: a,
55
- depth: i + 1,
56
- onClick: n
57
- },
58
- c.id
59
- )) })
60
- ] });
61
- }, O = ({
62
- title: e,
63
- children: b,
64
- collapsible: a = !1,
65
- defaultCollapsed: i = !1,
66
- className: n
67
- }) => {
68
- const [t, o] = z(i);
69
- return /* @__PURE__ */ s("div", { className: l("bear-mb-4", n), children: [
70
- e && /* @__PURE__ */ s(
71
- "button",
72
- {
73
- type: "button",
74
- onClick: () => a && o(!t),
75
- className: l(
76
- "bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-zinc-400",
77
- a && "bear-cursor-pointer hover:bear-text-zinc-600"
78
- ),
79
- children: [
80
- a && /* @__PURE__ */ r(
81
- N,
82
- {
83
- size: 12,
84
- className: l(
85
- "bear-transition-transform",
86
- t && "-bear-rotate-90"
87
- )
88
- }
89
- ),
90
- e
91
- ]
92
- }
93
- ),
94
- !t && /* @__PURE__ */ r("div", { className: "bear-space-y-1", children: b })
95
- ] });
96
- }, R = ({
97
- items: e,
98
- collapsed: b = !1,
99
- onCollapsedChange: a,
100
- width: i = k,
101
- collapsedWidth: n = C,
102
- header: t,
103
- footer: o,
104
- activeItemId: d,
105
- onItemClick: u,
106
- variant: f = "default",
107
- position: h = "left",
108
- className: m,
109
- style: x
110
- }) => {
111
- const c = b ? n : i;
112
- return /* @__PURE__ */ s(
1
+ import { jsxs as S, jsx as a } from "react/jsx-runtime";
2
+ import { cn as r } from "../../utils/cn.js";
3
+ import { ChevronRightIcon as b, ChevronLeftIcon as c } from "../Icon/index.js";
4
+ import { SidebarItem as u } from "./components/SidebarItem/SidebarItem.js";
5
+ import { SIDEBAR_WIDTH as v, SIDEBAR_COLLAPSED_WIDTH as L, SIDEBAR_TOGGLE_ICON_SIZE as i, SIDEBAR_TOGGLE_CLASSES as x, SIDEBAR_HEADER_CLASSES as N, SIDEBAR_FOOTER_CLASSES as T, SIDEBAR_VARIANT_STYLES as y } from "./Sidebar.const.js";
6
+ const k = (_) => {
7
+ const {
8
+ items: f,
9
+ collapsed: e = !1,
10
+ onCollapsedChange: d,
11
+ width: m = v,
12
+ collapsedWidth: E = L,
13
+ header: s,
14
+ footer: n,
15
+ activeItemId: I,
16
+ onItemClick: p,
17
+ variant: t = "default",
18
+ position: l = "left",
19
+ className: h,
20
+ style: A,
21
+ testId: B,
22
+ id: C
23
+ } = _, D = e ? E : m, R = l === "left" ? "bear-border-r" : "bear-border-l";
24
+ return /* @__PURE__ */ S(
113
25
  "aside",
114
26
  {
115
- className: l(
27
+ id: C,
28
+ "data-testid": B,
29
+ className: r(
30
+ "Bear-Sidebar",
31
+ `Bear-Sidebar--${t}`,
32
+ e && "Bear-Sidebar--collapsed",
116
33
  "bear-flex bear-flex-col bear-h-full bear-transition-all bear-duration-300",
117
- f === "default" && (h === "left" ? "bear-border-r" : "bear-border-l"),
118
- {
119
- default: "bear-bg-white dark:bear-bg-gray-900 bear-border-zinc-200 dark:bear-border-zinc-700",
120
- bordered: "bear-bg-white dark:bear-bg-gray-900 bear-border-2 bear-border-zinc-300 dark:bear-border-zinc-600 bear-rounded-xl bear-m-2",
121
- floating: "bear-bg-white/95 dark:bear-bg-gray-900/95 bear-backdrop-blur-sm bear-shadow-2xl bear-rounded-xl bear-m-3"
122
- }[f],
123
- m
34
+ t === "default" && R,
35
+ y[t],
36
+ h
124
37
  ),
125
- style: { width: c, ...x },
38
+ style: { width: D, ...A },
126
39
  children: [
127
- t && /* @__PURE__ */ s("div", { className: "bear-px-3 bear-py-4 bear-border-b bear-border-zinc-100 bear-flex bear-items-center bear-justify-between", children: [
128
- !b && t,
129
- a && /* @__PURE__ */ r(
40
+ s && /* @__PURE__ */ S("div", { className: r("Bear-Sidebar__header", N), children: [
41
+ !e && s,
42
+ d && /* @__PURE__ */ a(
130
43
  "button",
131
44
  {
132
45
  type: "button",
133
- onClick: () => a(!b),
134
- className: "bear-p-1.5 bear-rounded-lg bear-text-zinc-400 hover:bear-bg-zinc-100 hover:bear-text-zinc-600 bear-transition-colors",
135
- "aria-label": b ? "Expand sidebar" : "Collapse sidebar",
136
- children: b ? h === "left" ? /* @__PURE__ */ r(v, { size: 18 }) : /* @__PURE__ */ r(y, { size: 18 }) : h === "left" ? /* @__PURE__ */ r(y, { size: 18 }) : /* @__PURE__ */ r(v, { size: 18 })
46
+ onClick: () => d(!e),
47
+ className: r("Bear-Sidebar__toggle", x),
48
+ "aria-label": e ? "Expand sidebar" : "Collapse sidebar",
49
+ children: e ? l === "left" ? /* @__PURE__ */ a(b, { size: i }) : /* @__PURE__ */ a(c, { size: i }) : l === "left" ? /* @__PURE__ */ a(c, { size: i }) : /* @__PURE__ */ a(b, { size: i })
137
50
  }
138
51
  )
139
52
  ] }),
140
- /* @__PURE__ */ r("nav", { className: "bear-flex-1 bear-overflow-y-auto bear-px-2 bear-py-3 bear-space-y-1", children: e.map((p) => /* @__PURE__ */ r(
141
- w,
53
+ /* @__PURE__ */ a("nav", { className: "Bear-Sidebar__nav bear-flex-1 bear-overflow-y-auto bear-px-2 bear-py-3 bear-space-y-1", children: f.map((o) => /* @__PURE__ */ a(
54
+ u,
142
55
  {
143
- item: p,
144
- isActive: p.id === d,
145
- collapsed: b,
146
- onClick: u
56
+ item: o,
57
+ isActive: o.id === I,
58
+ collapsed: e,
59
+ onClick: p
147
60
  },
148
- p.id
61
+ o.id
149
62
  )) }),
150
- o && /* @__PURE__ */ r("div", { className: "bear-px-3 bear-py-3 bear-border-t bear-border-zinc-100 bear-mt-auto", children: b ? null : o })
63
+ n && /* @__PURE__ */ a("div", { className: r("Bear-Sidebar__footer", T), children: e ? null : n })
151
64
  ]
152
65
  }
153
66
  );
154
67
  };
155
68
  export {
156
- R as Sidebar,
157
- O as SidebarGroup
69
+ k as Sidebar
158
70
  };
@@ -1,4 +1,6 @@
1
1
  import { ReactNode, CSSProperties } from 'react';
2
+ export type SidebarVariant = 'default' | 'bordered' | 'floating';
3
+ export type SidebarPosition = 'left' | 'right';
2
4
  export interface SidebarItem {
3
5
  id: string;
4
6
  label: string;
@@ -19,10 +21,12 @@ export interface SidebarProps {
19
21
  footer?: ReactNode;
20
22
  activeItemId?: string;
21
23
  onItemClick?: (item: SidebarItem) => void;
22
- variant?: 'default' | 'bordered' | 'floating';
23
- position?: 'left' | 'right';
24
+ variant?: SidebarVariant;
25
+ position?: SidebarPosition;
24
26
  className?: string;
25
27
  style?: CSSProperties;
28
+ testId?: string;
29
+ id?: string;
26
30
  }
27
31
  export interface SidebarGroupProps {
28
32
  title?: string;
@@ -31,7 +35,7 @@ export interface SidebarGroupProps {
31
35
  defaultCollapsed?: boolean;
32
36
  className?: string;
33
37
  }
34
- export interface SidebarItemProps {
38
+ export interface SidebarItemComponentProps {
35
39
  item: SidebarItem;
36
40
  isActive?: boolean;
37
41
  collapsed?: boolean;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),t=require("../../../../utils/cn.cjs"),d=require("../../../Icon/index.cjs"),o=require("../../Sidebar.const.cjs"),S=n=>{const{title:a,children:c,collapsible:r=!1,defaultCollapsed:i=!1,className:l}=n,[s,u]=b.useState(i);return e.jsxs("div",{className:t.cn("Bear-Sidebar__group bear-mb-4",l),children:[a&&e.jsxs("button",{type:"button",onClick:()=>r&&u(!s),className:t.cn("Bear-Sidebar__group-title",o.SIDEBAR_GROUP_TITLE_CLASSES,r&&"bear-cursor-pointer hover:bear-text-zinc-600 dark:hover:bear-text-zinc-300"),children:[r&&e.jsx(d.ChevronDownIcon,{size:o.SIDEBAR_ICON_SIZE-2,className:t.cn("bear-transition-transform",s&&"-bear-rotate-90")}),a]}),!s&&e.jsx("div",{className:"Bear-Sidebar__group-content bear-space-y-1",children:c})]})};exports.SidebarGroup=S;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { SidebarGroupProps } from '../../Sidebar.types';
3
+ export declare const SidebarGroup: FC<SidebarGroupProps>;
4
+ export default SidebarGroup;
@@ -0,0 +1,45 @@
1
+ import { jsxs as t, jsx as s } from "react/jsx-runtime";
2
+ import { useState as p } from "react";
3
+ import { cn as a } from "../../../../utils/cn.js";
4
+ import { ChevronDownIcon as b } from "../../../Icon/index.js";
5
+ import { SIDEBAR_ICON_SIZE as d, SIDEBAR_GROUP_TITLE_CLASSES as S } from "../../Sidebar.const.js";
6
+ const h = (i) => {
7
+ const {
8
+ title: o,
9
+ children: l,
10
+ collapsible: e = !1,
11
+ defaultCollapsed: n = !1,
12
+ className: c
13
+ } = i, [r, m] = p(n);
14
+ return /* @__PURE__ */ t("div", { className: a("Bear-Sidebar__group bear-mb-4", c), children: [
15
+ o && /* @__PURE__ */ t(
16
+ "button",
17
+ {
18
+ type: "button",
19
+ onClick: () => e && m(!r),
20
+ className: a(
21
+ "Bear-Sidebar__group-title",
22
+ S,
23
+ e && "bear-cursor-pointer hover:bear-text-zinc-600 dark:hover:bear-text-zinc-300"
24
+ ),
25
+ children: [
26
+ e && /* @__PURE__ */ s(
27
+ b,
28
+ {
29
+ size: d - 2,
30
+ className: a(
31
+ "bear-transition-transform",
32
+ r && "-bear-rotate-90"
33
+ )
34
+ }
35
+ ),
36
+ o
37
+ ]
38
+ }
39
+ ),
40
+ !r && /* @__PURE__ */ s("div", { className: "Bear-Sidebar__group-content bear-space-y-1", children: l })
41
+ ] });
42
+ };
43
+ export {
44
+ h as SidebarGroup
45
+ };
@@ -0,0 +1,2 @@
1
+ export { SidebarGroup } from './SidebarGroup';
2
+ export { default } from './SidebarGroup';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),d=require("react"),b=require("../../../../utils/cn.cjs"),u=require("../../../Icon/index.cjs"),r=require("../../Sidebar.const.cjs"),S=_=>{const{item:e,isActive:o,collapsed:i,depth:c=0,onClick:s}=_,[l,m]=d.useState(!1),t=e.children&&e.children.length>0,E=i?r.SIDEBAR_PADDING_BASE:r.SIDEBAR_PADDING_BASE+c*r.SIDEBAR_DEPTH_INDENT,I=d.useCallback(()=>{t&&m(n=>!n),e.onClick&&e.onClick(),s==null||s(e)},[t,e,s]),h=a.jsxs(a.Fragment,{children:[e.icon&&a.jsx("span",{className:"Bear-Sidebar__item-icon bear-shrink-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center",children:e.icon}),!i&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"Bear-Sidebar__item-label bear-flex-1 bear-truncate",children:e.label}),e.badge&&a.jsx("span",{className:"Bear-Sidebar__item-badge bear-ml-auto",children:e.badge}),t&&a.jsx(u.ChevronDownIcon,{size:r.SIDEBAR_ICON_SIZE,className:b.cn("Bear-Sidebar__item-chevron bear-ml-1 bear-transition-transform bear-duration-200",l&&"bear-rotate-180")})]})]}),A=b.cn("Bear-Sidebar__item",r.SIDEBAR_ITEM_BASE_CLASSES,o?`Bear-Sidebar__item--active ${r.SIDEBAR_ITEM_ACTIVE_CLASSES}`:r.SIDEBAR_ITEM_INACTIVE_CLASSES,e.disabled&&`Bear-Sidebar__item--disabled ${r.SIDEBAR_ITEM_DISABLED_CLASSES}`,i&&"Bear-Sidebar__item--collapsed bear-justify-center"),B=e.href?"a":"button";return a.jsxs("div",{className:"Bear-Sidebar__item-wrapper",children:[a.jsx(B,{href:e.href,onClick:I,disabled:e.disabled,className:A,style:{paddingLeft:E},title:i?e.label:void 0,children:h}),t&&l&&!i&&a.jsx("div",{className:"Bear-Sidebar__children bear-mt-1",children:e.children.map(n=>a.jsx(S,{item:n,isActive:!1,collapsed:i,depth:c+1,onClick:s},n.id))})]})};exports.SidebarItem=S;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { SidebarItemComponentProps } from '../../Sidebar.types';
3
+ export declare const SidebarItem: FC<SidebarItemComponentProps>;
4
+ export default SidebarItem;
@@ -0,0 +1,66 @@
1
+ import { jsxs as s, Fragment as d, jsx as a } from "react/jsx-runtime";
2
+ import { useState as A, useCallback as f } from "react";
3
+ import { cn as m } from "../../../../utils/cn.js";
4
+ import { ChevronDownIcon as C } from "../../../Icon/index.js";
5
+ import { SIDEBAR_ICON_SIZE as D, SIDEBAR_ITEM_DISABLED_CLASSES as N, SIDEBAR_ITEM_ACTIVE_CLASSES as u, SIDEBAR_ITEM_INACTIVE_CLASSES as v, SIDEBAR_ITEM_BASE_CLASSES as T, SIDEBAR_PADDING_BASE as o, SIDEBAR_DEPTH_INDENT as R } from "../../Sidebar.const.js";
6
+ const g = (b) => {
7
+ const {
8
+ item: e,
9
+ isActive: _,
10
+ collapsed: r,
11
+ depth: l = 0,
12
+ onClick: i
13
+ } = b, [c, S] = A(!1), t = e.children && e.children.length > 0, h = r ? o : o + l * R, E = f(() => {
14
+ t && S((n) => !n), e.onClick && e.onClick(), i == null || i(e);
15
+ }, [t, e, i]), I = /* @__PURE__ */ s(d, { children: [
16
+ e.icon && /* @__PURE__ */ a("span", { className: "Bear-Sidebar__item-icon bear-shrink-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center", children: e.icon }),
17
+ !r && /* @__PURE__ */ s(d, { children: [
18
+ /* @__PURE__ */ a("span", { className: "Bear-Sidebar__item-label bear-flex-1 bear-truncate", children: e.label }),
19
+ e.badge && /* @__PURE__ */ a("span", { className: "Bear-Sidebar__item-badge bear-ml-auto", children: e.badge }),
20
+ t && /* @__PURE__ */ a(
21
+ C,
22
+ {
23
+ size: D,
24
+ className: m(
25
+ "Bear-Sidebar__item-chevron bear-ml-1 bear-transition-transform bear-duration-200",
26
+ c && "bear-rotate-180"
27
+ )
28
+ }
29
+ )
30
+ ] })
31
+ ] }), B = m(
32
+ "Bear-Sidebar__item",
33
+ T,
34
+ _ ? `Bear-Sidebar__item--active ${u}` : v,
35
+ e.disabled && `Bear-Sidebar__item--disabled ${N}`,
36
+ r && "Bear-Sidebar__item--collapsed bear-justify-center"
37
+ ), p = e.href ? "a" : "button";
38
+ return /* @__PURE__ */ s("div", { className: "Bear-Sidebar__item-wrapper", children: [
39
+ /* @__PURE__ */ a(
40
+ p,
41
+ {
42
+ href: e.href,
43
+ onClick: E,
44
+ disabled: e.disabled,
45
+ className: B,
46
+ style: { paddingLeft: h },
47
+ title: r ? e.label : void 0,
48
+ children: I
49
+ }
50
+ ),
51
+ t && c && !r && /* @__PURE__ */ a("div", { className: "Bear-Sidebar__children bear-mt-1", children: e.children.map((n) => /* @__PURE__ */ a(
52
+ g,
53
+ {
54
+ item: n,
55
+ isActive: !1,
56
+ collapsed: r,
57
+ depth: l + 1,
58
+ onClick: i
59
+ },
60
+ n.id
61
+ )) })
62
+ ] });
63
+ };
64
+ export {
65
+ g as SidebarItem
66
+ };
@@ -0,0 +1,2 @@
1
+ export { SidebarItem } from './SidebarItem';
2
+ export { default } from './SidebarItem';
@@ -0,0 +1,2 @@
1
+ export { SidebarItem } from './SidebarItem';
2
+ export { SidebarGroup } from './SidebarGroup';
@@ -1,2 +1,5 @@
1
- export { Sidebar, SidebarGroup } from './Sidebar';
2
- export type { SidebarProps, SidebarItem, SidebarGroupProps, SidebarItemProps } from './Sidebar.types';
1
+ export { Sidebar, default } from './Sidebar';
2
+ export { SidebarGroup } from './components/SidebarGroup';
3
+ export { SidebarItem } from './components/SidebarItem';
4
+ export * from './Sidebar.types';
5
+ export * from './Sidebar.const';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),a=require("react"),_=require("../../utils/cn.cjs"),w=require("../Button/Button.cjs"),s=require("./SignPad.const.cjs"),V=y=>{const{onChange:r,width:P=s.SIGN_PAD_DEFAULT_WIDTH,height:A=s.SIGN_PAD_DEFAULT_HEIGHT,strokeColor:B,strokeWidth:b=s.SIGN_PAD_DEFAULT_STROKE_WIDTH,backgroundColor:O,placeholder:U=s.SIGN_PAD_DEFAULT_PLACEHOLDER,disabled:o=!1,readOnly:i=!1,showClear:I=!0,showSave:v=!1,clearText:M="Clear",saveText:j="Save",outputFormat:h=s.SIGN_PAD_DEFAULT_OUTPUT_FORMAT,outputQuality:D=s.SIGN_PAD_DEFAULT_OUTPUT_QUALITY,className:F,testId:H,id:K,...W}=y,l=a.useRef(null),[g,k]=a.useState(!1),[u,L]=a.useState(!1),[f,E]=a.useState(null),[T,q]=a.useState(!1);a.useEffect(()=>{const e=()=>{const n=document.documentElement.classList.contains("dark");q(n)};e();const t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]);const R=B||(T?s.SIGN_PAD_STROKE_DARK:s.SIGN_PAD_STROKE_LIGHT),S=O||(T?s.SIGN_PAD_BG_DARK:s.SIGN_PAD_BG_LIGHT);a.useEffect(()=>{const e=l.current;if(!e)return;const t=e.getContext("2d");t&&(e.width=P,e.height=A,t.fillStyle=S,t.fillRect(0,0,P,A))},[P,A,S,T]);const C=a.useCallback(e=>{const t=l.current;if(!t)return{x:0,y:0};const n=t.getBoundingClientRect(),d=t.width/n.width,G=t.height/n.height;if("touches"in e){const p=e.touches[0];return{x:(p.clientX-n.left)*d,y:(p.clientY-n.top)*G}}return{x:(e.clientX-n.left)*d,y:(e.clientY-n.top)*G}},[]),x=a.useCallback(e=>{if(o||i)return;const t=C(e);k(!0),E(t)},[o,i,C]),m=a.useCallback(e=>{if(!g||o||i)return;const t=l.current,n=t==null?void 0:t.getContext("2d");if(!t||!n||!f)return;const d=C(e);n.beginPath(),n.moveTo(f.x,f.y),n.lineTo(d.x,d.y),n.strokeStyle=R,n.lineWidth=b,n.lineCap="round",n.lineJoin="round",n.stroke(),E(d),L(!0)},[g,o,i,f,R,b,C]),N=a.useCallback(()=>{if(g&&u){const e=l.current;if(e&&r){const t=e.toDataURL(h,D);r(t)}}k(!1),E(null)},[g,u,r,h,D]),X=a.useCallback(()=>{const e=l.current,t=e==null?void 0:e.getContext("2d");!e||!t||(t.fillStyle=S==="transparent"?"rgba(0,0,0,0)":S,t.clearRect(0,0,e.width,e.height),t.fillRect(0,0,e.width,e.height),L(!1),r==null||r(null))},[S,r]),Y=a.useCallback(()=>{const e=l.current;if(!e||!u)return;const t=e.toDataURL(h,D);r==null||r(t)},[u,r,h,D]);return c.jsxs("div",{id:K,"data-testid":H,className:_.cn("Bear-SignPad",s.SIGN_PAD_ROOT_CLASSES,o&&"Bear-SignPad--disabled bear-opacity-50",i&&"Bear-SignPad--readonly",F),...W,children:[c.jsxs("div",{className:_.cn("Bear-SignPad__canvas-wrapper",s.SIGN_PAD_CANVAS_WRAPPER_CLASSES,!o&&!i&&s.SIGN_PAD_CANVAS_WRAPPER_HOVER,o&&"bear-cursor-not-allowed",!o&&!i&&"bear-cursor-crosshair"),children:[c.jsx("canvas",{ref:l,className:"Bear-SignPad__canvas bear-block bear-rounded-lg",style:{width:P,height:A},onMouseDown:x,onMouseMove:m,onMouseUp:N,onMouseLeave:N,onTouchStart:x,onTouchMove:m,onTouchEnd:N}),!u&&c.jsx("div",{className:_.cn("Bear-SignPad__placeholder",s.SIGN_PAD_PLACEHOLDER_CLASSES),children:U}),c.jsx("div",{className:_.cn("Bear-SignPad__line",s.SIGN_PAD_LINE_CLASSES)}),c.jsx("span",{className:_.cn("Bear-SignPad__x-mark",s.SIGN_PAD_X_MARK_CLASSES),children:"×"})]}),(I||v)&&c.jsxs("div",{className:_.cn("Bear-SignPad__actions",s.SIGN_PAD_ACTIONS_CLASSES),children:[I&&c.jsx(w.Button,{size:"sm",variant:"ghost",onClick:X,disabled:o||!u,children:M}),v&&c.jsx(w.Button,{size:"sm",variant:"primary",onClick:Y,disabled:o||!u,children:j})]})]})};exports.SignPad=V;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=400,e=200,A=2,S="Sign here",r="image/png",D=.92,a="#1f2937",b="#f3f4f6",t="#ffffff",P="#18181b",I="bear-inline-flex bear-flex-col bear-gap-2",E="bear-relative bear-rounded-lg bear-border-2 bear-border-dashed bear-border-gray-300 dark:bear-border-zinc-600",o="hover:bear-border-pink-400 dark:hover:bear-border-pink-500",T="bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center bear-text-gray-400 dark:bear-text-zinc-500 bear-text-sm bear-pointer-events-none",G="bear-absolute bear-bottom-8 bear-left-4 bear-right-4 bear-border-b bear-border-gray-300 dark:bear-border-zinc-600",N="bear-absolute bear-bottom-6 bear-left-4 bear-text-gray-400 dark:bear-text-zinc-500 bear-text-lg bear-font-bold",L="bear-flex bear-gap-2 bear-justify-end";exports.SIGN_PAD_ACTIONS_CLASSES=L;exports.SIGN_PAD_BG_DARK=P;exports.SIGN_PAD_BG_LIGHT=t;exports.SIGN_PAD_CANVAS_WRAPPER_CLASSES=E;exports.SIGN_PAD_CANVAS_WRAPPER_HOVER=o;exports.SIGN_PAD_DEFAULT_HEIGHT=e;exports.SIGN_PAD_DEFAULT_OUTPUT_FORMAT=r;exports.SIGN_PAD_DEFAULT_OUTPUT_QUALITY=D;exports.SIGN_PAD_DEFAULT_PLACEHOLDER=S;exports.SIGN_PAD_DEFAULT_STROKE_WIDTH=A;exports.SIGN_PAD_DEFAULT_WIDTH=_;exports.SIGN_PAD_LINE_CLASSES=G;exports.SIGN_PAD_PLACEHOLDER_CLASSES=T;exports.SIGN_PAD_ROOT_CLASSES=I;exports.SIGN_PAD_STROKE_DARK=b;exports.SIGN_PAD_STROKE_LIGHT=a;exports.SIGN_PAD_X_MARK_CLASSES=N;
@@ -0,0 +1,19 @@
1
+ export declare const SIGN_PAD_DEFAULT_WIDTH = 400;
2
+ export declare const SIGN_PAD_DEFAULT_HEIGHT = 200;
3
+ export declare const SIGN_PAD_DEFAULT_STROKE_COLOR = "currentColor";
4
+ export declare const SIGN_PAD_DEFAULT_STROKE_WIDTH = 2;
5
+ export declare const SIGN_PAD_DEFAULT_BACKGROUND = "transparent";
6
+ export declare const SIGN_PAD_DEFAULT_PLACEHOLDER = "Sign here";
7
+ export declare const SIGN_PAD_DEFAULT_OUTPUT_FORMAT = "image/png";
8
+ export declare const SIGN_PAD_DEFAULT_OUTPUT_QUALITY = 0.92;
9
+ export declare const SIGN_PAD_STROKE_LIGHT = "#1f2937";
10
+ export declare const SIGN_PAD_STROKE_DARK = "#f3f4f6";
11
+ export declare const SIGN_PAD_BG_LIGHT = "#ffffff";
12
+ export declare const SIGN_PAD_BG_DARK = "#18181b";
13
+ export declare const SIGN_PAD_ROOT_CLASSES = "bear-inline-flex bear-flex-col bear-gap-2";
14
+ export declare const SIGN_PAD_CANVAS_WRAPPER_CLASSES = "bear-relative bear-rounded-lg bear-border-2 bear-border-dashed bear-border-gray-300 dark:bear-border-zinc-600";
15
+ export declare const SIGN_PAD_CANVAS_WRAPPER_HOVER = "hover:bear-border-pink-400 dark:hover:bear-border-pink-500";
16
+ export declare const SIGN_PAD_PLACEHOLDER_CLASSES = "bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center bear-text-gray-400 dark:bear-text-zinc-500 bear-text-sm bear-pointer-events-none";
17
+ export declare const SIGN_PAD_LINE_CLASSES = "bear-absolute bear-bottom-8 bear-left-4 bear-right-4 bear-border-b bear-border-gray-300 dark:bear-border-zinc-600";
18
+ export declare const SIGN_PAD_X_MARK_CLASSES = "bear-absolute bear-bottom-6 bear-left-4 bear-text-gray-400 dark:bear-text-zinc-500 bear-text-lg bear-font-bold";
19
+ export declare const SIGN_PAD_ACTIONS_CLASSES = "bear-flex bear-gap-2 bear-justify-end";
@@ -0,0 +1,20 @@
1
+ const e = 400, r = 200, _ = 2, a = "Sign here", b = "image/png", t = 0.92, A = "#1f2937", o = "#f3f4f6", S = "#ffffff", n = "#18181b", D = "bear-inline-flex bear-flex-col bear-gap-2", s = "bear-relative bear-rounded-lg bear-border-2 bear-border-dashed bear-border-gray-300 dark:bear-border-zinc-600", I = "hover:bear-border-pink-400 dark:hover:bear-border-pink-500", P = "bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center bear-text-gray-400 dark:bear-text-zinc-500 bear-text-sm bear-pointer-events-none", c = "bear-absolute bear-bottom-8 bear-left-4 bear-right-4 bear-border-b bear-border-gray-300 dark:bear-border-zinc-600", E = "bear-absolute bear-bottom-6 bear-left-4 bear-text-gray-400 dark:bear-text-zinc-500 bear-text-lg bear-font-bold", G = "bear-flex bear-gap-2 bear-justify-end";
2
+ export {
3
+ G as SIGN_PAD_ACTIONS_CLASSES,
4
+ n as SIGN_PAD_BG_DARK,
5
+ S as SIGN_PAD_BG_LIGHT,
6
+ s as SIGN_PAD_CANVAS_WRAPPER_CLASSES,
7
+ I as SIGN_PAD_CANVAS_WRAPPER_HOVER,
8
+ r as SIGN_PAD_DEFAULT_HEIGHT,
9
+ b as SIGN_PAD_DEFAULT_OUTPUT_FORMAT,
10
+ t as SIGN_PAD_DEFAULT_OUTPUT_QUALITY,
11
+ a as SIGN_PAD_DEFAULT_PLACEHOLDER,
12
+ _ as SIGN_PAD_DEFAULT_STROKE_WIDTH,
13
+ e as SIGN_PAD_DEFAULT_WIDTH,
14
+ c as SIGN_PAD_LINE_CLASSES,
15
+ P as SIGN_PAD_PLACEHOLDER_CLASSES,
16
+ D as SIGN_PAD_ROOT_CLASSES,
17
+ o as SIGN_PAD_STROKE_DARK,
18
+ A as SIGN_PAD_STROKE_LIGHT,
19
+ E as SIGN_PAD_X_MARK_CLASSES
20
+ };
@@ -0,0 +1,17 @@
1
+ import { FC } from 'react';
2
+ import { SignPadProps } from './SignPad.types';
3
+ /**
4
+ * SignPad - Digital signature capture component
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * const [signature, setSignature] = useState<string | null>(null);
9
+ *
10
+ * <SignPad
11
+ * onChange={setSignature}
12
+ * placeholder="Sign here"
13
+ * />
14
+ * ```
15
+ */
16
+ export declare const SignPad: FC<SignPadProps>;
17
+ export default SignPad;
@@ -0,0 +1,161 @@
1
+ import { jsxs as I, jsx as l } from "react/jsx-runtime";
2
+ import { useRef as J, useState as m, useEffect as y, useCallback as d } from "react";
3
+ import { cn as _ } from "../../utils/cn.js";
4
+ import { Button as O } from "../Button/Button.js";
5
+ import { SIGN_PAD_DEFAULT_WIDTH as q, SIGN_PAD_DEFAULT_HEIGHT as Z, SIGN_PAD_DEFAULT_STROKE_WIDTH as $, SIGN_PAD_DEFAULT_PLACEHOLDER as tt, SIGN_PAD_DEFAULT_OUTPUT_FORMAT as et, SIGN_PAD_DEFAULT_OUTPUT_QUALITY as nt, SIGN_PAD_BG_DARK as rt, SIGN_PAD_BG_LIGHT as ot, SIGN_PAD_STROKE_DARK as at, SIGN_PAD_STROKE_LIGHT as st, SIGN_PAD_PLACEHOLDER_CLASSES as ct, SIGN_PAD_LINE_CLASSES as it, SIGN_PAD_X_MARK_CLASSES as lt, SIGN_PAD_CANVAS_WRAPPER_HOVER as dt, SIGN_PAD_CANVAS_WRAPPER_CLASSES as _t, SIGN_PAD_ACTIONS_CLASSES as ut, SIGN_PAD_ROOT_CLASSES as St } from "./SignPad.const.js";
6
+ const gt = (U) => {
7
+ const {
8
+ onChange: r,
9
+ width: S = q,
10
+ height: A = Z,
11
+ strokeColor: B,
12
+ strokeWidth: p = $,
13
+ backgroundColor: M,
14
+ placeholder: F = tt,
15
+ disabled: o = !1,
16
+ readOnly: a = !1,
17
+ showClear: v = !0,
18
+ showSave: C = !1,
19
+ clearText: H = "Clear",
20
+ saveText: K = "Save",
21
+ outputFormat: h = et,
22
+ outputQuality: P = nt,
23
+ className: W,
24
+ testId: X,
25
+ id: Y,
26
+ ...V
27
+ } = U, s = J(null), [D, L] = m(!1), [c, R] = m(!1), [f, E] = m(null), [N, j] = m(!1);
28
+ y(() => {
29
+ const t = () => {
30
+ const n = document.documentElement.classList.contains("dark");
31
+ j(n);
32
+ };
33
+ t();
34
+ const e = new MutationObserver(t);
35
+ return e.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => e.disconnect();
36
+ }, []);
37
+ const G = B || (N ? at : st), u = M || (N ? rt : ot);
38
+ y(() => {
39
+ const t = s.current;
40
+ if (!t) return;
41
+ const e = t.getContext("2d");
42
+ e && (t.width = S, t.height = A, e.fillStyle = u, e.fillRect(0, 0, S, A));
43
+ }, [S, A, u, N]);
44
+ const g = d((t) => {
45
+ const e = s.current;
46
+ if (!e) return { x: 0, y: 0 };
47
+ const n = e.getBoundingClientRect(), i = e.width / n.width, w = e.height / n.height;
48
+ if ("touches" in t) {
49
+ const x = t.touches[0];
50
+ return {
51
+ x: (x.clientX - n.left) * i,
52
+ y: (x.clientY - n.top) * w
53
+ };
54
+ }
55
+ return {
56
+ x: (t.clientX - n.left) * i,
57
+ y: (t.clientY - n.top) * w
58
+ };
59
+ }, []), b = d((t) => {
60
+ if (o || a) return;
61
+ const e = g(t);
62
+ L(!0), E(e);
63
+ }, [o, a, g]), k = d((t) => {
64
+ if (!D || o || a) return;
65
+ const e = s.current, n = e == null ? void 0 : e.getContext("2d");
66
+ if (!e || !n || !f) return;
67
+ const i = g(t);
68
+ n.beginPath(), n.moveTo(f.x, f.y), n.lineTo(i.x, i.y), n.strokeStyle = G, n.lineWidth = p, n.lineCap = "round", n.lineJoin = "round", n.stroke(), E(i), R(!0);
69
+ }, [D, o, a, f, G, p, g]), T = d(() => {
70
+ if (D && c) {
71
+ const t = s.current;
72
+ if (t && r) {
73
+ const e = t.toDataURL(h, P);
74
+ r(e);
75
+ }
76
+ }
77
+ L(!1), E(null);
78
+ }, [D, c, r, h, P]), z = d(() => {
79
+ const t = s.current, e = t == null ? void 0 : t.getContext("2d");
80
+ !t || !e || (e.fillStyle = u === "transparent" ? "rgba(0,0,0,0)" : u, e.clearRect(0, 0, t.width, t.height), e.fillRect(0, 0, t.width, t.height), R(!1), r == null || r(null));
81
+ }, [u, r]), Q = d(() => {
82
+ const t = s.current;
83
+ if (!t || !c) return;
84
+ const e = t.toDataURL(h, P);
85
+ r == null || r(e);
86
+ }, [c, r, h, P]);
87
+ return /* @__PURE__ */ I(
88
+ "div",
89
+ {
90
+ id: Y,
91
+ "data-testid": X,
92
+ className: _(
93
+ "Bear-SignPad",
94
+ St,
95
+ o && "Bear-SignPad--disabled bear-opacity-50",
96
+ a && "Bear-SignPad--readonly",
97
+ W
98
+ ),
99
+ ...V,
100
+ children: [
101
+ /* @__PURE__ */ I(
102
+ "div",
103
+ {
104
+ className: _(
105
+ "Bear-SignPad__canvas-wrapper",
106
+ _t,
107
+ !o && !a && dt,
108
+ o && "bear-cursor-not-allowed",
109
+ !o && !a && "bear-cursor-crosshair"
110
+ ),
111
+ children: [
112
+ /* @__PURE__ */ l(
113
+ "canvas",
114
+ {
115
+ ref: s,
116
+ className: "Bear-SignPad__canvas bear-block bear-rounded-lg",
117
+ style: { width: S, height: A },
118
+ onMouseDown: b,
119
+ onMouseMove: k,
120
+ onMouseUp: T,
121
+ onMouseLeave: T,
122
+ onTouchStart: b,
123
+ onTouchMove: k,
124
+ onTouchEnd: T
125
+ }
126
+ ),
127
+ !c && /* @__PURE__ */ l("div", { className: _("Bear-SignPad__placeholder", ct), children: F }),
128
+ /* @__PURE__ */ l("div", { className: _("Bear-SignPad__line", it) }),
129
+ /* @__PURE__ */ l("span", { className: _("Bear-SignPad__x-mark", lt), children: "×" })
130
+ ]
131
+ }
132
+ ),
133
+ (v || C) && /* @__PURE__ */ I("div", { className: _("Bear-SignPad__actions", ut), children: [
134
+ v && /* @__PURE__ */ l(
135
+ O,
136
+ {
137
+ size: "sm",
138
+ variant: "ghost",
139
+ onClick: z,
140
+ disabled: o || !c,
141
+ children: H
142
+ }
143
+ ),
144
+ C && /* @__PURE__ */ l(
145
+ O,
146
+ {
147
+ size: "sm",
148
+ variant: "primary",
149
+ onClick: Q,
150
+ disabled: o || !c,
151
+ children: K
152
+ }
153
+ )
154
+ ] })
155
+ ]
156
+ }
157
+ );
158
+ };
159
+ export {
160
+ gt as SignPad
161
+ };