@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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),c=require("../../utils/cn.cjs"),w=require("./CreditInput.const.cjs"),d=require("./CreditInput.utils.cjs"),q={visa:e.jsx("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"currentColor",children:e.jsx("path",{d:"M9.5 8.5l-1.8 7h-1.4l1.8-7h1.4zm6.5 4.5c0-1.1-.9-1.5-1.8-1.9-.6-.2-1-.4-1-.7 0-.2.2-.5.7-.5.5 0 .9.1 1.2.3l.2-1.2c-.3-.1-.9-.3-1.6-.3-1.7 0-2.9.9-2.9 2.2 0 1 .9 1.5 1.5 1.8.7.3 1 .5 1 .8 0 .4-.6.6-1.1.6-.6 0-1.1-.1-1.5-.3l-.2 1.2c.4.2 1 .3 1.7.3 1.8 0 2.9-.9 2.9-2.3h-.1zm2.7-4.5l-1.4 7h-1.3l.1-.5c-.4.4-.9.6-1.5.6-1.3 0-2.2-1.1-2.2-2.5 0-1.7 1.2-3.1 2.9-3.1.5 0 1 .1 1.4.4l.1-.4h1.3l-.4 2.5zm-2.1 2.3c0-.9-.5-1.5-1.2-1.5-.9 0-1.6.9-1.6 1.9 0 .8.5 1.4 1.2 1.4.9 0 1.6-.8 1.6-1.8z"})}),mastercard:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"currentColor",children:[e.jsx("circle",{cx:"9",cy:"12",r:"5",opacity:".8",fill:"#eb001b"}),e.jsx("circle",{cx:"15",cy:"12",r:"5",opacity:".8",fill:"#f79e1b"})]}),amex:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"#2e77bc",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),e.jsx("text",{x:"12",y:"14",textAnchor:"middle",fontSize:"6",fill:"white",fontWeight:"bold",children:"AMEX"})]}),discover:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"#ff6600",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),e.jsx("circle",{cx:"15",cy:"12",r:"3",fill:"white"})]}),diners:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"#0079be",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),e.jsx("circle",{cx:"12",cy:"12",r:"4",fill:"white"})]}),jcb:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",fill:"#0e4c96"}),e.jsx("text",{x:"12",y:"14",textAnchor:"middle",fontSize:"5",fill:"white",fontWeight:"bold",children:"JCB"})]}),unionpay:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",fill:"#d9222a"}),e.jsx("text",{x:"12",y:"14",textAnchor:"middle",fontSize:"4",fill:"white",fontWeight:"bold",children:"UnionPay"})]}),unknown:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),e.jsx("line",{x1:"2",y1:"10",x2:"22",y2:"10"})]})},H=({value:r,onChange:h,mode:U="single",showName:y=!1,size:O="md",variant:V="default",disabled:n=!1,required:W=!1,label:_,helperText:I,error:b,acceptedCards:f,validateOnInput:B=!0,className:Y,testId:$,translations:S,icon:k})=>{const[p,M]=t.useState((r==null?void 0:r.number)||""),[m,T]=t.useState(r!=null&&r.expiryMonth&&(r!=null&&r.expiryYear)?`${r.expiryMonth}/${r.expiryYear}`:""),[C,E]=t.useState((r==null?void 0:r.cvv)||""),[j,z]=t.useState((r==null?void 0:r.name)||""),[u,P]=t.useState("unknown"),[g,A]=t.useState({}),s=t.useMemo(()=>({...w.CREDIT_INPUT_DEFAULT_TRANSLATIONS,...S}),[S]);t.useEffect(()=>{(r==null?void 0:r.number)!==void 0&&M(r.number),r!=null&&r.expiryMonth&&(r!=null&&r.expiryYear)&&T(`${r.expiryMonth}/${r.expiryYear}`),(r==null?void 0:r.cvv)!==void 0&&E(r.cvv),(r==null?void 0:r.name)!==void 0&&z(r.name),(r==null?void 0:r.cardType)!==void 0&&P(r.cardType)},[r]);const L=t.useCallback(()=>{const a=d.createCreditCardValue(p,m,C,y?j:void 0);h==null||h(a)},[p,m,C,j,y,h]);t.useEffect(()=>{L()},[L]);const R=t.useCallback(a=>{const i=a.target.value.replace(/\D/g,""),o=d.detectCardType(i);P(o);const J=d.getMaxCardLength(o),X=i.slice(0,J),Z=d.formatCardNumber(X,o);M(Z),B&&f&&!f.includes(o)&&o!=="unknown"?A(N=>({...N,number:s.invalidCard})):A(N=>{const{number:K,...G}=N;return G})},[f,B,s.invalidCard]),v=t.useCallback(a=>{const i=d.formatExpiry(a.target.value);T(i)},[]),D=t.useCallback(a=>{const i=a.target.value.replace(/\D/g,""),o=d.getMaxCvvLength(u);E(i.slice(0,o))},[u]),F=t.useCallback(a=>{z(a.target.value)},[]),l=c.cn("bear-bg-transparent bear-border-0 bear-outline-none bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-400 dark:placeholder:bear-text-zinc-500",w.CREDIT_INPUT_SIZE_CLASSES[O]),x=c.cn("bear-flex bear-items-center bear-rounded-lg bear-border bear-transition-colors",w.CREDIT_INPUT_VARIANT_CLASSES[V],b||Object.keys(g).length>0?"bear-border-red-500":"focus-within:bear-border-pink-500",n&&"bear-opacity-50 bear-cursor-not-allowed");return e.jsxs("div",{className:c.cn("Bear-CreditInput",Y),"data-testid":$,children:[_&&e.jsxs("label",{className:"Bear-CreditInput__label bear-block bear-text-sm bear-font-medium bear-text-zinc-700 dark:bear-text-zinc-300 bear-mb-1.5",children:[_,W&&e.jsx("span",{className:"bear-text-red-500 bear-ml-0.5",children:"*"})]}),U==="single"?e.jsxs("div",{className:c.cn("Bear-CreditInput__single",x),children:[e.jsx("div",{className:"Bear-CreditInput__icon bear-pl-3 bear-pr-1",children:k??q[u]}),e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-number",value:p,onChange:R,placeholder:s.cardNumberPlaceholder,disabled:n,className:c.cn("Bear-CreditInput__number bear-flex-1",l)}),e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-exp",value:m,onChange:v,placeholder:s.expiryPlaceholder,disabled:n,className:c.cn("Bear-CreditInput__expiry bear-w-16 bear-text-center",l)}),e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-csc",value:C,onChange:D,placeholder:s.cvvPlaceholder,disabled:n,className:c.cn("Bear-CreditInput__cvv bear-w-12 bear-text-center bear-pr-3",l)})]}):e.jsxs("div",{className:"Bear-CreditInput__split bear-space-y-3",children:[e.jsxs("div",{className:x,children:[e.jsx("div",{className:"Bear-CreditInput__icon bear-pl-3 bear-pr-1",children:k??q[u]}),e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-number",value:p,onChange:R,placeholder:s.cardNumberPlaceholder,disabled:n,className:c.cn("Bear-CreditInput__number bear-flex-1",l)})]}),e.jsxs("div",{className:"bear-flex bear-gap-3",children:[e.jsx("div",{className:c.cn(x,"bear-flex-1"),children:e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-exp",value:m,onChange:v,placeholder:s.expiryPlaceholder,disabled:n,className:c.cn("Bear-CreditInput__expiry bear-w-full",l)})}),e.jsx("div",{className:c.cn(x,"bear-w-24"),children:e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-csc",value:C,onChange:D,placeholder:s.cvvPlaceholder,disabled:n,className:c.cn("Bear-CreditInput__cvv bear-w-full bear-text-center",l)})})]}),y&&e.jsx("div",{className:x,children:e.jsx("input",{type:"text",autoComplete:"cc-name",value:j,onChange:F,placeholder:s.namePlaceholder,disabled:n,className:c.cn("Bear-CreditInput__name bear-w-full",l)})})]}),b&&e.jsx("p",{className:"Bear-CreditInput__error bear-mt-1 bear-text-xs bear-text-red-400",children:b}),Object.values(g).map((a,i)=>e.jsx("p",{className:"Bear-CreditInput__error bear-mt-1 bear-text-xs bear-text-red-400",children:a},i)),I&&!b&&Object.keys(g).length===0&&e.jsx("p",{className:"Bear-CreditInput__helper bear-mt-1 bear-text-xs bear-text-zinc-500 dark:bear-text-zinc-400",children:I})]})};exports.CreditInput=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("../../utils/cn.cjs"),N=require("./CreditInput.const.cjs"),x=require("./CreditInput.utils.cjs"),q={visa:e.jsx("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"currentColor",children:e.jsx("path",{d:"M9.5 8.5l-1.8 7h-1.4l1.8-7h1.4zm6.5 4.5c0-1.1-.9-1.5-1.8-1.9-.6-.2-1-.4-1-.7 0-.2.2-.5.7-.5.5 0 .9.1 1.2.3l.2-1.2c-.3-.1-.9-.3-1.6-.3-1.7 0-2.9.9-2.9 2.2 0 1 .9 1.5 1.5 1.8.7.3 1 .5 1 .8 0 .4-.6.6-1.1.6-.6 0-1.1-.1-1.5-.3l-.2 1.2c.4.2 1 .3 1.7.3 1.8 0 2.9-.9 2.9-2.3h-.1zm2.7-4.5l-1.4 7h-1.3l.1-.5c-.4.4-.9.6-1.5.6-1.3 0-2.2-1.1-2.2-2.5 0-1.7 1.2-3.1 2.9-3.1.5 0 1 .1 1.4.4l.1-.4h1.3l-.4 2.5zm-2.1 2.3c0-.9-.5-1.5-1.2-1.5-.9 0-1.6.9-1.6 1.9 0 .8.5 1.4 1.2 1.4.9 0 1.6-.8 1.6-1.8z"})}),mastercard:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"currentColor",children:[e.jsx("circle",{cx:"9",cy:"12",r:"5",opacity:".8",fill:"#eb001b"}),e.jsx("circle",{cx:"15",cy:"12",r:"5",opacity:".8",fill:"#f79e1b"})]}),amex:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"#2e77bc",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),e.jsx("text",{x:"12",y:"14",textAnchor:"middle",fontSize:"6",fill:"white",fontWeight:"bold",children:"AMEX"})]}),discover:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"#ff6600",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),e.jsx("circle",{cx:"15",cy:"12",r:"3",fill:"white"})]}),diners:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"#0079be",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),e.jsx("circle",{cx:"12",cy:"12",r:"4",fill:"white"})]}),jcb:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",fill:"#0e4c96"}),e.jsx("text",{x:"12",y:"14",textAnchor:"middle",fontSize:"5",fill:"white",fontWeight:"bold",children:"JCB"})]}),unionpay:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",fill:"#d9222a"}),e.jsx("text",{x:"12",y:"14",textAnchor:"middle",fontSize:"4",fill:"white",fontWeight:"bold",children:"UnionPay"})]}),unknown:e.jsxs("svg",{viewBox:"0 0 24 24",className:"bear-w-8 bear-h-5",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2"}),e.jsx("line",{x1:"2",y1:"10",x2:"22",y2:"10"})]})},H=({value:r,onChange:b,mode:U="single",showName:f=!1,size:O="md",variant:V="default",disabled:n=!1,required:W=!1,label:_,helperText:I,error:h,acceptedCards:y,validateOnInput:B=!0,className:Y,testId:$,translations:k,icon:S})=>{const[p,M]=t.useState((r==null?void 0:r.number)||""),[m,T]=t.useState(r!=null&&r.expiryMonth&&(r!=null&&r.expiryYear)?`${r.expiryMonth}/${r.expiryYear}`:""),[C,E]=t.useState((r==null?void 0:r.cvv)||""),[j,z]=t.useState((r==null?void 0:r.name)||""),[u,P]=t.useState("unknown"),[g,A]=t.useState({}),s=t.useMemo(()=>({...N.CREDIT_INPUT_DEFAULT_TRANSLATIONS,...k}),[k]);t.useEffect(()=>{(r==null?void 0:r.number)!==void 0&&M(r.number),r!=null&&r.expiryMonth&&(r!=null&&r.expiryYear)&&T(`${r.expiryMonth}/${r.expiryYear}`),(r==null?void 0:r.cvv)!==void 0&&E(r.cvv),(r==null?void 0:r.name)!==void 0&&z(r.name),(r==null?void 0:r.cardType)!==void 0&&P(r.cardType)},[r]);const L=t.useCallback(()=>{const c=x.createCreditCardValue(p,m,C,f?j:void 0);b==null||b(c)},[p,m,C,j,f,b]);t.useEffect(()=>{L()},[L]);const v=t.useCallback(c=>{const i=c.target.value.replace(/\D/g,""),o=x.detectCardType(i);P(o);const J=x.getMaxCardLength(o),X=i.slice(0,J),Z=x.formatCardNumber(X,o);M(Z),B&&y&&!y.includes(o)&&o!=="unknown"?A(w=>({...w,number:s.invalidCard})):A(w=>{const{number:K,...G}=w;return G})},[y,B,s.invalidCard]),R=t.useCallback(c=>{const i=x.formatExpiry(c.target.value);T(i)},[]),D=t.useCallback(c=>{const i=c.target.value.replace(/\D/g,""),o=x.getMaxCvvLength(u);E(i.slice(0,o))},[u]),F=t.useCallback(c=>{z(c.target.value)},[]),l=a.cn("bear-bg-transparent bear-border-0 bear-outline-none bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-400 dark:placeholder:bear-text-zinc-500",N.CREDIT_INPUT_SIZE_CLASSES[O]),d=a.cn("bear-flex bear-items-center bear-rounded-lg bear-border bear-transition-colors",N.CREDIT_INPUT_VARIANT_CLASSES[V],h||Object.keys(g).length>0?"bear-border-red-500":"focus-within:bear-border-pink-500",n&&"bear-opacity-50 bear-cursor-not-allowed");return e.jsxs("div",{className:a.cn("Bear-CreditInput",Y),"data-testid":$,children:[_&&e.jsxs("label",{className:"Bear-CreditInput__label bear-block bear-text-sm bear-font-medium bear-text-zinc-700 dark:bear-text-zinc-300 bear-mb-1.5",children:[_,W&&e.jsx("span",{className:"bear-text-red-500 bear-ml-0.5",children:"*"})]}),U==="single"?e.jsxs("div",{className:a.cn("Bear-CreditInput__single bear-flex bear-flex-wrap bear-items-center bear-gap-2 sm:bear-gap-0",d),children:[e.jsxs("div",{className:"Bear-CreditInput__row-main bear-flex bear-min-w-0 bear-flex-1 bear-basis-full sm:bear-basis-0 sm:bear-flex-1 bear-items-center",children:[e.jsx("div",{className:"Bear-CreditInput__icon bear-pl-3 bear-pr-1 bear-shrink-0",children:S??q[u]}),e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-number",value:p,onChange:v,placeholder:s.cardNumberPlaceholder,disabled:n,className:a.cn("Bear-CreditInput__number bear-min-w-0 bear-flex-1",l)})]}),e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-exp",value:m,onChange:R,placeholder:s.expiryPlaceholder,disabled:n,className:a.cn("Bear-CreditInput__expiry bear-w-20 sm:bear-w-16 bear-text-center bear-shrink-0",l)}),e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-csc",value:C,onChange:D,placeholder:s.cvvPlaceholder,disabled:n,className:a.cn("Bear-CreditInput__cvv bear-w-14 sm:bear-w-12 bear-text-center bear-pr-3 bear-shrink-0",l)})]}):e.jsxs("div",{className:"Bear-CreditInput__split bear-space-y-3",children:[e.jsxs("div",{className:d,children:[e.jsx("div",{className:"Bear-CreditInput__icon bear-pl-3 bear-pr-1",children:S??q[u]}),e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-number",value:p,onChange:v,placeholder:s.cardNumberPlaceholder,disabled:n,className:a.cn("Bear-CreditInput__number bear-flex-1",l)})]}),e.jsxs("div",{className:"bear-flex bear-gap-3",children:[e.jsx("div",{className:a.cn(d,"bear-flex-1"),children:e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-exp",value:m,onChange:R,placeholder:s.expiryPlaceholder,disabled:n,className:a.cn("Bear-CreditInput__expiry bear-w-full",l)})}),e.jsx("div",{className:a.cn(d,"bear-w-24"),children:e.jsx("input",{type:"text",inputMode:"numeric",autoComplete:"cc-csc",value:C,onChange:D,placeholder:s.cvvPlaceholder,disabled:n,className:a.cn("Bear-CreditInput__cvv bear-w-full bear-text-center",l)})})]}),f&&e.jsx("div",{className:d,children:e.jsx("input",{type:"text",autoComplete:"cc-name",value:j,onChange:F,placeholder:s.namePlaceholder,disabled:n,className:a.cn("Bear-CreditInput__name bear-w-full",l)})})]}),h&&e.jsx("p",{className:"Bear-CreditInput__error bear-mt-1 bear-text-xs bear-text-red-400",children:h}),Object.values(g).map((c,i)=>e.jsx("p",{className:"Bear-CreditInput__error bear-mt-1 bear-text-xs bear-text-red-400",children:c},i)),I&&!h&&Object.keys(g).length===0&&e.jsx("p",{className:"Bear-CreditInput__helper bear-mt-1 bear-text-xs bear-text-zinc-500 dark:bear-text-zinc-400",children:I})]})};exports.CreditInput=H;
@@ -1,41 +1,41 @@
1
- import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
- import { useState as d, useMemo as K, useEffect as U, useCallback as p } from "react";
3
- import { cn as t } from "../../utils/cn.js";
1
+ import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
+ import { useState as d, useMemo as K, useEffect as U, useCallback as m } from "react";
3
+ import { cn as a } from "../../utils/cn.js";
4
4
  import { CREDIT_INPUT_DEFAULT_TRANSLATIONS as Q, CREDIT_INPUT_SIZE_CLASSES as ee, CREDIT_INPUT_VARIANT_CLASSES as re } from "./CreditInput.const.js";
5
- import { createCreditCardValue as te, detectCardType as ae, getMaxCardLength as ce, formatCardNumber as ie, formatExpiry as ne, getMaxCvvLength as oe } from "./CreditInput.utils.js";
5
+ import { createCreditCardValue as te, detectCardType as ae, getMaxCardLength as ce, formatCardNumber as ie, formatExpiry as ne, getMaxCvvLength as se } from "./CreditInput.utils.js";
6
6
  const V = {
7
7
  visa: /* @__PURE__ */ r("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "currentColor", children: /* @__PURE__ */ r("path", { d: "M9.5 8.5l-1.8 7h-1.4l1.8-7h1.4zm6.5 4.5c0-1.1-.9-1.5-1.8-1.9-.6-.2-1-.4-1-.7 0-.2.2-.5.7-.5.5 0 .9.1 1.2.3l.2-1.2c-.3-.1-.9-.3-1.6-.3-1.7 0-2.9.9-2.9 2.2 0 1 .9 1.5 1.5 1.8.7.3 1 .5 1 .8 0 .4-.6.6-1.1.6-.6 0-1.1-.1-1.5-.3l-.2 1.2c.4.2 1 .3 1.7.3 1.8 0 2.9-.9 2.9-2.3h-.1zm2.7-4.5l-1.4 7h-1.3l.1-.5c-.4.4-.9.6-1.5.6-1.3 0-2.2-1.1-2.2-2.5 0-1.7 1.2-3.1 2.9-3.1.5 0 1 .1 1.4.4l.1-.4h1.3l-.4 2.5zm-2.1 2.3c0-.9-.5-1.5-1.2-1.5-.9 0-1.6.9-1.6 1.9 0 .8.5 1.4 1.2 1.4.9 0 1.6-.8 1.6-1.8z" }) }),
8
- mastercard: /* @__PURE__ */ a("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "currentColor", children: [
8
+ mastercard: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "currentColor", children: [
9
9
  /* @__PURE__ */ r("circle", { cx: "9", cy: "12", r: "5", opacity: ".8", fill: "#eb001b" }),
10
10
  /* @__PURE__ */ r("circle", { cx: "15", cy: "12", r: "5", opacity: ".8", fill: "#f79e1b" })
11
11
  ] }),
12
- amex: /* @__PURE__ */ a("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "#2e77bc", children: [
12
+ amex: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "#2e77bc", children: [
13
13
  /* @__PURE__ */ r("rect", { x: "2", y: "6", width: "20", height: "12", rx: "2" }),
14
14
  /* @__PURE__ */ r("text", { x: "12", y: "14", textAnchor: "middle", fontSize: "6", fill: "white", fontWeight: "bold", children: "AMEX" })
15
15
  ] }),
16
- discover: /* @__PURE__ */ a("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "#ff6600", children: [
16
+ discover: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "#ff6600", children: [
17
17
  /* @__PURE__ */ r("rect", { x: "2", y: "6", width: "20", height: "12", rx: "2" }),
18
18
  /* @__PURE__ */ r("circle", { cx: "15", cy: "12", r: "3", fill: "white" })
19
19
  ] }),
20
- diners: /* @__PURE__ */ a("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "#0079be", children: [
20
+ diners: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "#0079be", children: [
21
21
  /* @__PURE__ */ r("rect", { x: "2", y: "6", width: "20", height: "12", rx: "2" }),
22
22
  /* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "4", fill: "white" })
23
23
  ] }),
24
- jcb: /* @__PURE__ */ a("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", children: [
24
+ jcb: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", children: [
25
25
  /* @__PURE__ */ r("rect", { x: "2", y: "6", width: "20", height: "12", rx: "2", fill: "#0e4c96" }),
26
26
  /* @__PURE__ */ r("text", { x: "12", y: "14", textAnchor: "middle", fontSize: "5", fill: "white", fontWeight: "bold", children: "JCB" })
27
27
  ] }),
28
- unionpay: /* @__PURE__ */ a("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", children: [
28
+ unionpay: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", children: [
29
29
  /* @__PURE__ */ r("rect", { x: "2", y: "6", width: "20", height: "12", rx: "2", fill: "#d9222a" }),
30
30
  /* @__PURE__ */ r("text", { x: "12", y: "14", textAnchor: "middle", fontSize: "4", fill: "white", fontWeight: "bold", children: "UnionPay" })
31
31
  ] }),
32
- unknown: /* @__PURE__ */ a("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
32
+ unknown: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", className: "bear-w-8 bear-h-5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
33
33
  /* @__PURE__ */ r("rect", { x: "2", y: "6", width: "20", height: "12", rx: "2" }),
34
34
  /* @__PURE__ */ r("line", { x1: "2", y1: "10", x2: "22", y2: "10" })
35
35
  ] })
36
- }, be = ({
36
+ }, pe = ({
37
37
  value: e,
38
- onChange: m,
38
+ onChange: h,
39
39
  mode: W = "single",
40
40
  showName: g = !1,
41
41
  size: Y = "md",
@@ -44,80 +44,82 @@ const V = {
44
44
  required: O = !1,
45
45
  label: B,
46
46
  helperText: I,
47
- error: b,
48
- acceptedCards: N,
49
- validateOnInput: M = !0,
47
+ error: p,
48
+ acceptedCards: w,
49
+ validateOnInput: k = !0,
50
50
  className: F,
51
51
  testId: J,
52
- translations: k,
52
+ translations: M,
53
53
  icon: T
54
54
  }) => {
55
55
  const [x, E] = d((e == null ? void 0 : e.number) || ""), [f, S] = d(
56
56
  e != null && e.expiryMonth && (e != null && e.expiryYear) ? `${e.expiryMonth}/${e.expiryYear}` : ""
57
- ), [C, z] = d((e == null ? void 0 : e.cvv) || ""), [w, A] = d((e == null ? void 0 : e.name) || ""), [y, P] = d("unknown"), [_, L] = d({}), i = K(() => ({
57
+ ), [C, z] = d((e == null ? void 0 : e.cvv) || ""), [N, A] = d((e == null ? void 0 : e.name) || ""), [y, P] = d("unknown"), [_, L] = d({}), i = K(() => ({
58
58
  ...Q,
59
- ...k
60
- }), [k]);
59
+ ...M
60
+ }), [M]);
61
61
  U(() => {
62
62
  (e == null ? void 0 : e.number) !== void 0 && E(e.number), e != null && e.expiryMonth && (e != null && e.expiryYear) && S(`${e.expiryMonth}/${e.expiryYear}`), (e == null ? void 0 : e.cvv) !== void 0 && z(e.cvv), (e == null ? void 0 : e.name) !== void 0 && A(e.name), (e == null ? void 0 : e.cardType) !== void 0 && P(e.cardType);
63
63
  }, [e]);
64
- const j = p(() => {
65
- const c = te(x, f, C, g ? w : void 0);
66
- m == null || m(c);
67
- }, [x, f, C, w, g, m]);
64
+ const j = m(() => {
65
+ const c = te(x, f, C, g ? N : void 0);
66
+ h == null || h(c);
67
+ }, [x, f, C, N, g, h]);
68
68
  U(() => {
69
69
  j();
70
70
  }, [j]);
71
- const D = p((c) => {
72
- const o = c.target.value.replace(/\D/g, ""), l = ae(o);
73
- P(l);
74
- const Z = ce(l), q = o.slice(0, Z), G = ie(q, l);
75
- E(G), M && N && !N.includes(l) && l !== "unknown" ? L((u) => ({ ...u, number: i.invalidCard })) : L((u) => {
76
- const { number: se, ...H } = u;
71
+ const v = m((c) => {
72
+ const s = c.target.value.replace(/\D/g, ""), o = ae(s);
73
+ P(o);
74
+ const Z = ce(o), q = s.slice(0, Z), G = ie(q, o);
75
+ E(G), k && w && !w.includes(o) && o !== "unknown" ? L((u) => ({ ...u, number: i.invalidCard })) : L((u) => {
76
+ const { number: le, ...H } = u;
77
77
  return H;
78
78
  });
79
- }, [N, M, i.invalidCard]), v = p((c) => {
80
- const o = ne(c.target.value);
81
- S(o);
82
- }, []), R = p((c) => {
83
- const o = c.target.value.replace(/\D/g, ""), l = oe(y);
84
- z(o.slice(0, l));
85
- }, [y]), X = p((c) => {
79
+ }, [w, k, i.invalidCard]), D = m((c) => {
80
+ const s = ne(c.target.value);
81
+ S(s);
82
+ }, []), R = m((c) => {
83
+ const s = c.target.value.replace(/\D/g, ""), o = se(y);
84
+ z(s.slice(0, o));
85
+ }, [y]), X = m((c) => {
86
86
  A(c.target.value);
87
- }, []), s = t(
87
+ }, []), l = a(
88
88
  "bear-bg-transparent bear-border-0 bear-outline-none bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-400 dark:placeholder:bear-text-zinc-500",
89
89
  ee[Y]
90
- ), h = t(
90
+ ), b = a(
91
91
  "bear-flex bear-items-center bear-rounded-lg bear-border bear-transition-colors",
92
92
  re[$],
93
- b || Object.keys(_).length > 0 ? "bear-border-red-500" : "focus-within:bear-border-pink-500",
93
+ p || Object.keys(_).length > 0 ? "bear-border-red-500" : "focus-within:bear-border-pink-500",
94
94
  n && "bear-opacity-50 bear-cursor-not-allowed"
95
95
  );
96
- return /* @__PURE__ */ a(
96
+ return /* @__PURE__ */ t(
97
97
  "div",
98
98
  {
99
- className: t("Bear-CreditInput", F),
99
+ className: a("Bear-CreditInput", F),
100
100
  "data-testid": J,
101
101
  children: [
102
- B && /* @__PURE__ */ a("label", { className: "Bear-CreditInput__label bear-block bear-text-sm bear-font-medium bear-text-zinc-700 dark:bear-text-zinc-300 bear-mb-1.5", children: [
102
+ B && /* @__PURE__ */ t("label", { className: "Bear-CreditInput__label bear-block bear-text-sm bear-font-medium bear-text-zinc-700 dark:bear-text-zinc-300 bear-mb-1.5", children: [
103
103
  B,
104
104
  O && /* @__PURE__ */ r("span", { className: "bear-text-red-500 bear-ml-0.5", children: "*" })
105
105
  ] }),
106
- W === "single" ? /* @__PURE__ */ a("div", { className: t("Bear-CreditInput__single", h), children: [
107
- /* @__PURE__ */ r("div", { className: "Bear-CreditInput__icon bear-pl-3 bear-pr-1", children: T ?? V[y] }),
108
- /* @__PURE__ */ r(
109
- "input",
110
- {
111
- type: "text",
112
- inputMode: "numeric",
113
- autoComplete: "cc-number",
114
- value: x,
115
- onChange: D,
116
- placeholder: i.cardNumberPlaceholder,
117
- disabled: n,
118
- className: t("Bear-CreditInput__number bear-flex-1", s)
119
- }
120
- ),
106
+ W === "single" ? /* @__PURE__ */ t("div", { className: a("Bear-CreditInput__single bear-flex bear-flex-wrap bear-items-center bear-gap-2 sm:bear-gap-0", b), children: [
107
+ /* @__PURE__ */ t("div", { className: "Bear-CreditInput__row-main bear-flex bear-min-w-0 bear-flex-1 bear-basis-full sm:bear-basis-0 sm:bear-flex-1 bear-items-center", children: [
108
+ /* @__PURE__ */ r("div", { className: "Bear-CreditInput__icon bear-pl-3 bear-pr-1 bear-shrink-0", children: T ?? V[y] }),
109
+ /* @__PURE__ */ r(
110
+ "input",
111
+ {
112
+ type: "text",
113
+ inputMode: "numeric",
114
+ autoComplete: "cc-number",
115
+ value: x,
116
+ onChange: v,
117
+ placeholder: i.cardNumberPlaceholder,
118
+ disabled: n,
119
+ className: a("Bear-CreditInput__number bear-min-w-0 bear-flex-1", l)
120
+ }
121
+ )
122
+ ] }),
121
123
  /* @__PURE__ */ r(
122
124
  "input",
123
125
  {
@@ -125,10 +127,10 @@ const V = {
125
127
  inputMode: "numeric",
126
128
  autoComplete: "cc-exp",
127
129
  value: f,
128
- onChange: v,
130
+ onChange: D,
129
131
  placeholder: i.expiryPlaceholder,
130
132
  disabled: n,
131
- className: t("Bear-CreditInput__expiry bear-w-16 bear-text-center", s)
133
+ className: a("Bear-CreditInput__expiry bear-w-20 sm:bear-w-16 bear-text-center bear-shrink-0", l)
132
134
  }
133
135
  ),
134
136
  /* @__PURE__ */ r(
@@ -141,11 +143,11 @@ const V = {
141
143
  onChange: R,
142
144
  placeholder: i.cvvPlaceholder,
143
145
  disabled: n,
144
- className: t("Bear-CreditInput__cvv bear-w-12 bear-text-center bear-pr-3", s)
146
+ className: a("Bear-CreditInput__cvv bear-w-14 sm:bear-w-12 bear-text-center bear-pr-3 bear-shrink-0", l)
145
147
  }
146
148
  )
147
- ] }) : /* @__PURE__ */ a("div", { className: "Bear-CreditInput__split bear-space-y-3", children: [
148
- /* @__PURE__ */ a("div", { className: h, children: [
149
+ ] }) : /* @__PURE__ */ t("div", { className: "Bear-CreditInput__split bear-space-y-3", children: [
150
+ /* @__PURE__ */ t("div", { className: b, children: [
149
151
  /* @__PURE__ */ r("div", { className: "Bear-CreditInput__icon bear-pl-3 bear-pr-1", children: T ?? V[y] }),
150
152
  /* @__PURE__ */ r(
151
153
  "input",
@@ -154,28 +156,28 @@ const V = {
154
156
  inputMode: "numeric",
155
157
  autoComplete: "cc-number",
156
158
  value: x,
157
- onChange: D,
159
+ onChange: v,
158
160
  placeholder: i.cardNumberPlaceholder,
159
161
  disabled: n,
160
- className: t("Bear-CreditInput__number bear-flex-1", s)
162
+ className: a("Bear-CreditInput__number bear-flex-1", l)
161
163
  }
162
164
  )
163
165
  ] }),
164
- /* @__PURE__ */ a("div", { className: "bear-flex bear-gap-3", children: [
165
- /* @__PURE__ */ r("div", { className: t(h, "bear-flex-1"), children: /* @__PURE__ */ r(
166
+ /* @__PURE__ */ t("div", { className: "bear-flex bear-gap-3", children: [
167
+ /* @__PURE__ */ r("div", { className: a(b, "bear-flex-1"), children: /* @__PURE__ */ r(
166
168
  "input",
167
169
  {
168
170
  type: "text",
169
171
  inputMode: "numeric",
170
172
  autoComplete: "cc-exp",
171
173
  value: f,
172
- onChange: v,
174
+ onChange: D,
173
175
  placeholder: i.expiryPlaceholder,
174
176
  disabled: n,
175
- className: t("Bear-CreditInput__expiry bear-w-full", s)
177
+ className: a("Bear-CreditInput__expiry bear-w-full", l)
176
178
  }
177
179
  ) }),
178
- /* @__PURE__ */ r("div", { className: t(h, "bear-w-24"), children: /* @__PURE__ */ r(
180
+ /* @__PURE__ */ r("div", { className: a(b, "bear-w-24"), children: /* @__PURE__ */ r(
179
181
  "input",
180
182
  {
181
183
  type: "text",
@@ -185,30 +187,30 @@ const V = {
185
187
  onChange: R,
186
188
  placeholder: i.cvvPlaceholder,
187
189
  disabled: n,
188
- className: t("Bear-CreditInput__cvv bear-w-full bear-text-center", s)
190
+ className: a("Bear-CreditInput__cvv bear-w-full bear-text-center", l)
189
191
  }
190
192
  ) })
191
193
  ] }),
192
- g && /* @__PURE__ */ r("div", { className: h, children: /* @__PURE__ */ r(
194
+ g && /* @__PURE__ */ r("div", { className: b, children: /* @__PURE__ */ r(
193
195
  "input",
194
196
  {
195
197
  type: "text",
196
198
  autoComplete: "cc-name",
197
- value: w,
199
+ value: N,
198
200
  onChange: X,
199
201
  placeholder: i.namePlaceholder,
200
202
  disabled: n,
201
- className: t("Bear-CreditInput__name bear-w-full", s)
203
+ className: a("Bear-CreditInput__name bear-w-full", l)
202
204
  }
203
205
  ) })
204
206
  ] }),
205
- b && /* @__PURE__ */ r("p", { className: "Bear-CreditInput__error bear-mt-1 bear-text-xs bear-text-red-400", children: b }),
206
- Object.values(_).map((c, o) => /* @__PURE__ */ r("p", { className: "Bear-CreditInput__error bear-mt-1 bear-text-xs bear-text-red-400", children: c }, o)),
207
- I && !b && Object.keys(_).length === 0 && /* @__PURE__ */ r("p", { className: "Bear-CreditInput__helper bear-mt-1 bear-text-xs bear-text-zinc-500 dark:bear-text-zinc-400", children: I })
207
+ p && /* @__PURE__ */ r("p", { className: "Bear-CreditInput__error bear-mt-1 bear-text-xs bear-text-red-400", children: p }),
208
+ Object.values(_).map((c, s) => /* @__PURE__ */ r("p", { className: "Bear-CreditInput__error bear-mt-1 bear-text-xs bear-text-red-400", children: c }, s)),
209
+ I && !p && Object.keys(_).length === 0 && /* @__PURE__ */ r("p", { className: "Bear-CreditInput__helper bear-mt-1 bear-text-xs bear-text-zinc-500 dark:bear-text-zinc-400", children: I })
208
210
  ]
209
211
  }
210
212
  );
211
213
  };
212
214
  export {
213
- be as CreditInput
215
+ pe as CreditInput
214
216
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),n=require("react"),U=require("../Input/Input.cjs"),B=require("../Icon/index.cjs"),l=require("./CurrencyInput.const.cjs"),c=require("./CurrencyInput.utils.cjs"),M=({value:p,onChange:u,currency:r=l.DEFAULT_CURRENCY,locale:s=l.DEFAULT_LOCALE,decimals:e=l.DEFAULT_DECIMALS,placeholder:S="0.00",size:f="md",disabled:A=!1,error:F,allowNegative:C=!1,max:o,min:a,testId:L,className:q,...x})=>{const[i,d]=n.useState(()=>c.formatCurrency(p,s,e)),[I,g]=n.useState(!1);n.useEffect(()=>{I||d(c.formatCurrency(p,s,e))},[p,s,e,I]);const D=n.useCallback(t=>{const j=t.target.value,m=C?/[^0-9.,-]/g:/[^0-9.,]/g;d(j.replace(m,""))},[C]),R=n.useCallback(()=>{g(!1);let t=c.parseCurrency(i);t!=null&&(o!=null&&t>o&&(t=o),a!=null&&t<a&&(t=a),t=parseFloat(t.toFixed(e))),u==null||u(t),d(c.formatCurrency(t,s,e))},[i,s,e,o,a,u]),E=typeof r=="string"?l.CURRENCY_SYMBOLS[r]??r:null,_=typeof r!="string"?r:y.jsx(B.BearIcons.DollarSignIcon,{size:f==="sm"?14:f==="lg"?20:16,className:"text-gray-400"}),b=E?y.jsx("span",{className:"text-gray-500 dark:text-gray-400 font-medium select-none",children:E}):_;return y.jsx(U.Input,{...x,size:f,disabled:A,error:F,placeholder:S,value:i,onChange:D,onFocus:()=>g(!0),onBlur:R,inputMode:"decimal",className:q,"data-testid":L,InputProps:{startAdornment:b}})};exports.CurrencyInput=M;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L="USD",C="en-US",E=2,U={USD:"$",EUR:"€",GBP:"£",JPY:"¥",ILS:"₪",INR:"₹",KRW:"₩",CNY:"¥",BRL:"R$",CAD:"CA$",AUD:"A$"};exports.CURRENCY_SYMBOLS=U;exports.DEFAULT_CURRENCY=L;exports.DEFAULT_DECIMALS=E;exports.DEFAULT_LOCALE=C;
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_CURRENCY = "USD";
2
+ export declare const DEFAULT_LOCALE = "en-US";
3
+ export declare const DEFAULT_DECIMALS = 2;
4
+ export declare const CURRENCY_SYMBOLS: Record<string, string>;
@@ -0,0 +1,19 @@
1
+ const U = "USD", A = "en-US", C = 2, L = {
2
+ USD: "$",
3
+ EUR: "€",
4
+ GBP: "£",
5
+ JPY: "¥",
6
+ ILS: "₪",
7
+ INR: "₹",
8
+ KRW: "₩",
9
+ CNY: "¥",
10
+ BRL: "R$",
11
+ CAD: "CA$",
12
+ AUD: "A$"
13
+ };
14
+ export {
15
+ L as CURRENCY_SYMBOLS,
16
+ U as DEFAULT_CURRENCY,
17
+ C as DEFAULT_DECIMALS,
18
+ A as DEFAULT_LOCALE
19
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { CurrencyInputProps } from './CurrencyInput.types';
3
+ export declare const CurrencyInput: FC<CurrencyInputProps>;
@@ -0,0 +1,60 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { useState as E, useEffect as M, useCallback as C } from "react";
3
+ import { Input as N } from "../Input/Input.js";
4
+ import { BearIcons as T } from "../Icon/index.js";
5
+ import { DEFAULT_LOCALE as Y, DEFAULT_DECIMALS as b, DEFAULT_CURRENCY as k, CURRENCY_SYMBOLS as O } from "./CurrencyInput.const.js";
6
+ import { formatCurrency as m, parseCurrency as V } from "./CurrencyInput.utils.js";
7
+ const J = ({
8
+ value: a,
9
+ onChange: e,
10
+ currency: s = k,
11
+ locale: o = Y,
12
+ decimals: r = b,
13
+ placeholder: F = "0.00",
14
+ size: f = "md",
15
+ disabled: L = !1,
16
+ error: g,
17
+ allowNegative: i = !1,
18
+ max: n,
19
+ min: p,
20
+ testId: D,
21
+ className: I,
22
+ ...S
23
+ }) => {
24
+ const [l, u] = E(() => m(a, o, r)), [c, y] = E(!1);
25
+ M(() => {
26
+ c || u(m(a, o, r));
27
+ }, [a, o, r, c]);
28
+ const U = C(
29
+ (t) => {
30
+ const _ = t.target.value, x = i ? /[^0-9.,-]/g : /[^0-9.,]/g;
31
+ u(_.replace(x, ""));
32
+ },
33
+ [i]
34
+ ), B = C(() => {
35
+ y(!1);
36
+ let t = V(l);
37
+ t != null && (n != null && t > n && (t = n), p != null && t < p && (t = p), t = parseFloat(t.toFixed(r))), e == null || e(t), u(m(t, o, r));
38
+ }, [l, o, r, n, p, e]), A = typeof s == "string" ? O[s] ?? s : null, R = typeof s != "string" ? s : /* @__PURE__ */ d(T.DollarSignIcon, { size: f === "sm" ? 14 : f === "lg" ? 20 : 16, className: "text-gray-400" });
39
+ return /* @__PURE__ */ d(
40
+ N,
41
+ {
42
+ ...S,
43
+ size: f,
44
+ disabled: L,
45
+ error: g,
46
+ placeholder: F,
47
+ value: l,
48
+ onChange: U,
49
+ onFocus: () => y(!0),
50
+ onBlur: B,
51
+ inputMode: "decimal",
52
+ className: I,
53
+ "data-testid": D,
54
+ InputProps: { startAdornment: A ? /* @__PURE__ */ d("span", { className: "text-gray-500 dark:text-gray-400 font-medium select-none", children: A }) : R }
55
+ }
56
+ );
57
+ };
58
+ export {
59
+ J as CurrencyInput
60
+ };
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+ import { InputProps } from '../Input/Input.types';
3
+ export interface CurrencyInputProps extends Omit<InputProps, 'onChange' | 'value' | 'type'> {
4
+ /** Current numeric value */
5
+ value?: number;
6
+ /** Change handler receiving the numeric value */
7
+ onChange?: (value: number | undefined) => void;
8
+ /** Currency code (e.g. 'USD', 'EUR', 'GBP') or a custom ReactNode for the symbol */
9
+ currency?: string | ReactNode;
10
+ /** Locale for formatting */
11
+ locale?: string;
12
+ /** Maximum decimals */
13
+ decimals?: number;
14
+ /** Allow negative values */
15
+ allowNegative?: boolean;
16
+ /** Maximum value */
17
+ max?: number;
18
+ /** Minimum value */
19
+ min?: number;
20
+ /** Test ID */
21
+ testId?: string;
22
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(e,n,r){return e==null?"":new Intl.NumberFormat(n,{minimumFractionDigits:r,maximumFractionDigits:r}).format(e)}function i(e){const n=e.replace(/[^\d.,-]/g,"").replace(/,/g,""),r=parseFloat(n);return isNaN(r)?void 0:r}exports.formatCurrency=t;exports.parseCurrency=i;
@@ -0,0 +1,2 @@
1
+ export declare function formatCurrency(value: number | undefined, locale: string, decimals: number): string;
2
+ export declare function parseCurrency(raw: string): number | undefined;
@@ -0,0 +1,14 @@
1
+ function e(n, t, r) {
2
+ return n == null ? "" : new Intl.NumberFormat(t, {
3
+ minimumFractionDigits: r,
4
+ maximumFractionDigits: r
5
+ }).format(n);
6
+ }
7
+ function i(n) {
8
+ const t = n.replace(/[^\d.,-]/g, "").replace(/,/g, ""), r = parseFloat(t);
9
+ return isNaN(r) ? void 0 : r;
10
+ }
11
+ export {
12
+ e as formatCurrency,
13
+ i as parseCurrency
14
+ };
@@ -0,0 +1,2 @@
1
+ export { CurrencyInput } from './CurrencyInput';
2
+ export type { CurrencyInputProps } from './CurrencyInput.types';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),X=require("react-dom"),h=require("../../utils/cn.cjs"),r=require("./DateRangePicker.const.cjs"),b=require("./DateRangePicker.utils.cjs"),O=({year:E,month:d,range:a,onDayClick:k,onNav:L,minDate:u,maxDate:A})=>{const C=b.getCalendarDays(E,d),x=new Date;return x.setHours(0,0,0,0),e.jsxs("div",{className:"bear-w-64",children:[e.jsxs("div",{className:r.CALENDAR_HEADER_CLASSES,children:[e.jsx("button",{type:"button",onClick:()=>L(-1),className:r.NAV_BTN_CLASSES,"aria-label":"Previous month",children:e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),e.jsxs("span",{className:"bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white",children:[r.MONTH_LABELS[d]," ",E]}),e.jsx("button",{type:"button",onClick:()=>L(1),className:r.NAV_BTN_CLASSES,"aria-label":"Next month",children:e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]}),e.jsx("div",{className:"bear-grid bear-grid-cols-7 bear-gap-0.5 bear-mb-1",children:r.DAY_LABELS.map(n=>e.jsx("div",{className:"bear-text-xs bear-text-center bear-font-medium bear-text-gray-400 dark:bear-text-zinc-500 bear-py-1",children:n},n))}),e.jsx("div",{className:"bear-grid bear-grid-cols-7 bear-gap-0.5",children:C.map((n,_)=>{if(!n)return e.jsx("div",{},`e-${_}`);const p=u&&n<u||A&&n>A,i=b.isSameDay(n,a.start)||b.isSameDay(n,a.end),S=b.isInRange(n,a.start,a.end),D=b.isSameDay(n,x);return e.jsx("button",{type:"button",disabled:!!p,onClick:()=>k(n),className:h.cn(r.DAY_BASE_CLASSES,p?r.DAY_DISABLED_CLASSES:r.DAY_HOVER_CLASSES,i&&r.DAY_SELECTED_CLASSES,!i&&S&&r.DAY_IN_RANGE_CLASSES,!i&&!S&&D&&r.DAY_TODAY_CLASSES,!i&&!S&&!p&&"bear-text-gray-700 dark:bear-text-zinc-300"),children:n.getDate()},n.getTime())})})]})},ee=E=>{const{value:d,onChange:a,label:k,placeholder:L="Select date range",disabled:u=!1,clearable:A=!0,minDate:C,maxDate:x,presets:n,showPresets:_=!0,size:p="md",error:i,helperText:S,className:D,testId:I,...q}=E,[N,w]=s.useState(!1),[P,V]=s.useState({top:0,left:0}),[c,f]=s.useState(d??{start:null,end:null}),[T,j]=s.useState("start"),B=s.useRef(null),R=s.useRef(null),Y=s.useRef(null),M=new Date,[m,$]=s.useState(M.getMonth()),[g,G]=s.useState(M.getFullYear()),W=m===11?0:m+1,F=m===11?g+1:g;s.useEffect(()=>{d&&f(d)},[d]),s.useEffect(()=>{if(N&&R.current){const t=R.current.getBoundingClientRect(),o=8,l=400,U=window.innerHeight-t.bottom<l&&t.top>l;V({top:U?t.top-l-o:t.bottom+o,left:t.left})}},[N]),s.useEffect(()=>{const t=o=>{var v,y;const l=o.target;(v=B.current)!=null&&v.contains(l)||(y=Y.current)!=null&&y.contains(l)||w(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]);const H=s.useCallback(t=>{if(T==="start")f({start:t,end:null}),j("end");else{const o=t>=(c.start??t)?{start:c.start,end:t}:{start:t,end:c.start};f(o),j("start"),a==null||a(o)}},[T,c.start,a]),Z=s.useCallback(t=>{f(t),a==null||a(t),w(!1),j("start")},[a]),J=s.useCallback(()=>{const t={start:null,end:null};f(t),a==null||a(t),j("start")},[a]),K=s.useCallback(t=>{let o=m+t,l=g;o<0&&(o=11,l--),o>11&&(o=0,l++),$(o),G(l)},[m,g]),z=n??(_?r.getDefaultPresets():[]),Q=c.start?`${b.formatDate(c.start)}${c.end?` – ${b.formatDate(c.end)}`:""}`:L;return e.jsxs("div",{ref:B,className:h.cn(r.ROOT_CLASSES,D),"data-testid":I,...q,children:[k&&e.jsx("label",{className:r.LABEL_CLASSES,children:k}),e.jsxs("button",{ref:R,type:"button",disabled:u,onClick:()=>!u&&w(!N),className:h.cn(r.TRIGGER_CLASSES,r.SIZE_CLASSES[p],u&&"bear-opacity-50 bear-cursor-not-allowed"),children:[e.jsx("span",{className:h.cn(!c.start&&"bear-text-gray-400 dark:bear-text-zinc-500"),children:Q}),e.jsx("svg",{className:"bear-w-4 bear-h-4 bear-ml-2 bear-text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})]}),N&&typeof document<"u"&&X.createPortal(e.jsx("div",{ref:Y,"data-bear-daterangepicker-dropdown":!0,className:h.cn("bear-fixed bear-z-[9999] bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4"),style:{top:P.top,left:P.left},children:e.jsxs("div",{className:"bear-flex bear-gap-4",children:[z.length>0&&e.jsxs("div",{className:"bear-border-r bear-border-gray-200 dark:bear-border-zinc-700 bear-pr-3 bear-space-y-1 bear-min-w-[120px]",children:[z.map(t=>e.jsx("button",{type:"button",onClick:()=>Z(t.range()),className:r.PRESET_BTN_CLASSES,children:t.label},t.label)),A&&c.start&&e.jsx("button",{type:"button",onClick:J,className:h.cn(r.PRESET_BTN_CLASSES,"bear-text-red-500"),children:"Clear"})]}),e.jsx(O,{year:g,month:m,range:c,onDayClick:H,onNav:K,minDate:C,maxDate:x}),e.jsx(O,{year:F,month:W,range:c,onDayClick:H,onNav:()=>{},minDate:C,maxDate:x})]})}),document.body),i&&e.jsx("p",{className:r.ERROR_CLASSES,children:i}),!i&&S&&e.jsx("p",{className:r.HELPER_CLASSES,children:S})]})};exports.DateRangePicker=ee;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),te=require("react-dom"),x=require("../../utils/cn.cjs"),r=require("./DateRangePicker.const.cjs"),u=require("./DateRangePicker.utils.cjs"),I=({year:L,month:b,range:a,onDayClick:k,onNav:A,minDate:S,maxDate:v})=>{const C=u.getCalendarDays(L,b),p=new Date;return p.setHours(0,0,0,0),e.jsxs("div",{className:"bear-w-64",children:[e.jsxs("div",{className:r.CALENDAR_HEADER_CLASSES,children:[e.jsx("button",{type:"button",onClick:()=>A(-1),className:r.NAV_BTN_CLASSES,"aria-label":"Previous month",children:e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),e.jsxs("span",{className:"bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white",children:[r.MONTH_LABELS[b]," ",L]}),e.jsx("button",{type:"button",onClick:()=>A(1),className:r.NAV_BTN_CLASSES,"aria-label":"Next month",children:e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]}),e.jsx("div",{className:"bear-grid bear-grid-cols-7 bear-gap-0.5 bear-mb-1",children:r.DAY_LABELS.map(n=>e.jsx("div",{className:"bear-text-xs bear-text-center bear-font-medium bear-text-gray-400 dark:bear-text-zinc-500 bear-py-1",children:n},n))}),e.jsx("div",{className:"bear-grid bear-grid-cols-7 bear-gap-0.5",children:C.map((n,_)=>{if(!n)return e.jsx("div",{},`e-${_}`);const f=S&&n<S||v&&n>v,i=u.isSameDay(n,a.start)||u.isSameDay(n,a.end),m=u.isInRange(n,a.start,a.end),D=u.isSameDay(n,p);return e.jsx("button",{type:"button",disabled:!!f,onClick:()=>k(n),className:x.cn(r.DAY_BASE_CLASSES,f?r.DAY_DISABLED_CLASSES:r.DAY_HOVER_CLASSES,i&&r.DAY_SELECTED_CLASSES,!i&&m&&r.DAY_IN_RANGE_CLASSES,!i&&!m&&D&&r.DAY_TODAY_CLASSES,!i&&!m&&!f&&"bear-text-gray-700 dark:bear-text-zinc-300"),children:n.getDate()},n.getTime())})})]})},re=L=>{const{value:b,onChange:a,label:k,placeholder:A="Select date range",disabled:S=!1,clearable:v=!0,minDate:C,maxDate:p,presets:n,showPresets:_=!0,size:f="md",error:i,helperText:m,className:D,testId:q,...V}=L,[N,R]=s.useState(!1),[M,W]=s.useState({top:0,left:0}),[c,E]=s.useState(b??{start:null,end:null}),[T,j]=s.useState("start"),B=s.useRef(null),y=s.useRef(null),Y=s.useRef(null),z=new Date,[h,$]=s.useState(z.getMonth()),[g,G]=s.useState(z.getFullYear()),F=h===11?0:h+1,Z=h===11?g+1:g;s.useEffect(()=>{b&&E(b)},[b]),s.useEffect(()=>{if(!N||!y.current)return;const t=8,o=420,l=()=>{const d=y.current.getBoundingClientRect(),w=window.innerHeight;let P=w-d.bottom<o&&d.top>o?d.top-o-t:d.bottom+t;P=Math.max(8,Math.min(P,w-o-8));const X=Math.min(640,window.innerWidth-16);let ee=Math.max(8,Math.min(d.left,window.innerWidth-X-8));W({top:P,left:ee})};return l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),()=>{window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[N]),s.useEffect(()=>{const t=o=>{var d,w;const l=o.target;(d=B.current)!=null&&d.contains(l)||(w=Y.current)!=null&&w.contains(l)||R(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]);const H=s.useCallback(t=>{if(T==="start")E({start:t,end:null}),j("end");else{const o=t>=(c.start??t)?{start:c.start,end:t}:{start:t,end:c.start};E(o),j("start"),a==null||a(o)}},[T,c.start,a]),J=s.useCallback(t=>{E(t),a==null||a(t),R(!1),j("start")},[a]),K=s.useCallback(()=>{const t={start:null,end:null};E(t),a==null||a(t),j("start")},[a]),Q=s.useCallback(t=>{let o=h+t,l=g;o<0&&(o=11,l--),o>11&&(o=0,l++),$(o),G(l)},[h,g]),O=n??(_?r.getDefaultPresets():[]),U=c.start?`${u.formatDate(c.start)}${c.end?` – ${u.formatDate(c.end)}`:""}`:A;return e.jsxs("div",{ref:B,className:x.cn(r.ROOT_CLASSES,D),"data-testid":q,...V,children:[k&&e.jsx("label",{className:r.LABEL_CLASSES,children:k}),e.jsxs("button",{ref:y,type:"button",disabled:S,onClick:()=>!S&&R(!N),className:x.cn(r.TRIGGER_CLASSES,r.SIZE_CLASSES[f],S&&"bear-opacity-50 bear-cursor-not-allowed"),children:[e.jsx("span",{className:x.cn(!c.start&&"bear-text-gray-400 dark:bear-text-zinc-500"),children:U}),e.jsx("svg",{className:"bear-w-4 bear-h-4 bear-ml-2 bear-text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})]}),N&&typeof document<"u"&&te.createPortal(e.jsx("div",{ref:Y,"data-bear-daterangepicker-dropdown":!0,className:x.cn("bear-fixed bear-z-[10000] bear-max-w-[calc(100vw-16px)] bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4 bear-overflow-x-auto"),style:{top:M.top,left:M.left},children:e.jsxs("div",{className:"bear-flex bear-gap-4",children:[O.length>0&&e.jsxs("div",{className:"bear-border-r bear-border-gray-200 dark:bear-border-zinc-700 bear-pr-3 bear-space-y-1 bear-min-w-[120px]",children:[O.map(t=>e.jsx("button",{type:"button",onClick:()=>J(t.range()),className:r.PRESET_BTN_CLASSES,children:t.label},t.label)),v&&c.start&&e.jsx("button",{type:"button",onClick:K,className:x.cn(r.PRESET_BTN_CLASSES,"bear-text-red-500"),children:"Clear"})]}),e.jsx(I,{year:g,month:h,range:c,onDayClick:H,onNav:Q,minDate:C,maxDate:p}),e.jsx(I,{year:Z,month:F,range:c,onDayClick:H,onNav:()=>{},minDate:C,maxDate:p})]})}),document.body),i&&e.jsx("p",{className:r.ERROR_CLASSES,children:i}),!i&&m&&e.jsx("p",{className:r.HELPER_CLASSES,children:m})]})};exports.DateRangePicker=re;