tempest-react-sdk 0.39.0 → 0.40.0

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 (475) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  2. package/dist/access/access-control-context.cjs.map +1 -1
  3. package/dist/access/use-can.cjs.map +1 -1
  4. package/dist/app/AppProviders.cjs.map +1 -1
  5. package/dist/app/AppProviders.js.map +1 -1
  6. package/dist/audio/use-audio-recorder.cjs.map +1 -1
  7. package/dist/audio/use-audio.cjs.map +1 -1
  8. package/dist/audio/use-microphone.cjs.map +1 -1
  9. package/dist/auth/create-auth-store.cjs.map +1 -1
  10. package/dist/auth/lazy-with-retry.cjs.map +1 -1
  11. package/dist/auth/passkey.cjs.map +1 -1
  12. package/dist/auth/passkey.js.map +1 -1
  13. package/dist/auth/use-passkey.cjs.map +1 -1
  14. package/dist/br/BrazilMap.cjs +1 -1
  15. package/dist/br/BrazilMap.cjs.map +1 -1
  16. package/dist/br/BrazilMap.js +2 -2
  17. package/dist/br/BrazilMap.js.map +1 -1
  18. package/dist/br/BrazilStateCitySelect.cjs.map +1 -1
  19. package/dist/br/BrazilStateCitySelect.js.map +1 -1
  20. package/dist/br/BrazilStateMap.cjs +1 -1
  21. package/dist/br/BrazilStateMap.cjs.map +1 -1
  22. package/dist/br/BrazilStateMap.js +2 -2
  23. package/dist/br/BrazilStateMap.js.map +1 -1
  24. package/dist/br/MapLegend.cjs.map +1 -1
  25. package/dist/br/MapLegend.js.map +1 -1
  26. package/dist/br/MapMarkers.cjs.map +1 -1
  27. package/dist/br/MapMarkers.js.map +1 -1
  28. package/dist/br/MunicipalitySearch.cjs.map +1 -1
  29. package/dist/br/MunicipalitySearch.js.map +1 -1
  30. package/dist/br/PixQRCode.cjs.map +1 -1
  31. package/dist/br/PixQRCode.js.map +1 -1
  32. package/dist/br/use-map-hover.cjs.map +1 -1
  33. package/dist/br/use-map-zoom.cjs.map +1 -1
  34. package/dist/capture/media-recorder.cjs +1 -1
  35. package/dist/capture/media-recorder.js +2 -2
  36. package/dist/capture/use-barcode-scanner.cjs +1 -1
  37. package/dist/capture/use-barcode-scanner.cjs.map +1 -1
  38. package/dist/capture/use-barcode-scanner.js +2 -2
  39. package/dist/capture/use-barcode-scanner.js.map +1 -1
  40. package/dist/capture/use-screen-capture.cjs.map +1 -1
  41. package/dist/capture/use-speech-recognition.cjs.map +1 -1
  42. package/dist/capture/use-torch.cjs.map +1 -1
  43. package/dist/capture/use-video-recorder.cjs.map +1 -1
  44. package/dist/charts/AreaChart.cjs.map +1 -1
  45. package/dist/charts/AreaChart.js.map +1 -1
  46. package/dist/charts/BarChart.cjs.map +1 -1
  47. package/dist/charts/BarChart.js.map +1 -1
  48. package/dist/charts/LineChart.cjs.map +1 -1
  49. package/dist/charts/LineChart.js.map +1 -1
  50. package/dist/charts/PieChart.cjs.map +1 -1
  51. package/dist/charts/PieChart.js.map +1 -1
  52. package/dist/charts/RadarChart.cjs.map +1 -1
  53. package/dist/charts/RadarChart.js.map +1 -1
  54. package/dist/charts/use-chart-colors.cjs.map +1 -1
  55. package/dist/components/AIChat/AIChat.cjs.map +1 -1
  56. package/dist/components/AIChat/AIChat.js.map +1 -1
  57. package/dist/components/AIChat/AIChatComposer.cjs.map +1 -1
  58. package/dist/components/AIChat/AIChatComposer.js.map +1 -1
  59. package/dist/components/AIChat/AIChatTurn.cjs.map +1 -1
  60. package/dist/components/AIChat/AIChatTurn.js.map +1 -1
  61. package/dist/components/Accordion/Accordion.cjs.map +1 -1
  62. package/dist/components/Accordion/Accordion.js.map +1 -1
  63. package/dist/components/Alert/Alert.cjs.map +1 -1
  64. package/dist/components/Alert/Alert.js.map +1 -1
  65. package/dist/components/AppBar/AppBar.cjs.map +1 -1
  66. package/dist/components/AppBar/AppBar.js.map +1 -1
  67. package/dist/components/AppShell/AppShell.cjs.map +1 -1
  68. package/dist/components/AppShell/AppShell.js.map +1 -1
  69. package/dist/components/AudioPlayer/AudioPlayer.cjs.map +1 -1
  70. package/dist/components/AudioPlayer/AudioPlayer.js.map +1 -1
  71. package/dist/components/AudioRecorder/AudioRecorder.cjs.map +1 -1
  72. package/dist/components/AudioRecorder/AudioRecorder.js.map +1 -1
  73. package/dist/components/Avatar/Avatar.cjs.map +1 -1
  74. package/dist/components/Avatar/Avatar.js.map +1 -1
  75. package/dist/components/AvatarGroup/AvatarGroup.cjs.map +1 -1
  76. package/dist/components/AvatarGroup/AvatarGroup.js.map +1 -1
  77. package/dist/components/Badge/Badge.cjs.map +1 -1
  78. package/dist/components/Badge/Badge.js.map +1 -1
  79. package/dist/components/Banner/Banner.cjs.map +1 -1
  80. package/dist/components/Banner/Banner.js.map +1 -1
  81. package/dist/components/BarcodeScanner/BarcodeScanner.cjs.map +1 -1
  82. package/dist/components/BarcodeScanner/BarcodeScanner.js.map +1 -1
  83. package/dist/components/BottomNavigation/BottomNavigation.cjs.map +1 -1
  84. package/dist/components/BottomNavigation/BottomNavigation.js.map +1 -1
  85. package/dist/components/BottomSheet/BottomSheet.cjs.map +1 -1
  86. package/dist/components/BottomSheet/BottomSheet.js.map +1 -1
  87. package/dist/components/Breadcrumbs/Breadcrumbs.cjs.map +1 -1
  88. package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  89. package/dist/components/Button/Button.cjs.map +1 -1
  90. package/dist/components/Button/Button.js.map +1 -1
  91. package/dist/components/Calendar/Calendar.cjs +1 -1
  92. package/dist/components/Calendar/Calendar.cjs.map +1 -1
  93. package/dist/components/Calendar/Calendar.js +38 -41
  94. package/dist/components/Calendar/Calendar.js.map +1 -1
  95. package/dist/components/Card/Card.cjs.map +1 -1
  96. package/dist/components/Card/Card.js.map +1 -1
  97. package/dist/components/Carousel/Carousel.cjs.map +1 -1
  98. package/dist/components/Carousel/Carousel.js.map +1 -1
  99. package/dist/components/Chat/Chat.cjs.map +1 -1
  100. package/dist/components/Chat/Chat.js.map +1 -1
  101. package/dist/components/Chat/ChatComposer.cjs.map +1 -1
  102. package/dist/components/Chat/ChatComposer.js.map +1 -1
  103. package/dist/components/Chat/chat-groups.cjs +1 -1
  104. package/dist/components/Chat/chat-groups.cjs.map +1 -1
  105. package/dist/components/Chat/chat-groups.js +2 -2
  106. package/dist/components/Chat/chat-groups.js.map +1 -1
  107. package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
  108. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  109. package/dist/components/ChipInput/ChipInput.cjs.map +1 -1
  110. package/dist/components/ChipInput/ChipInput.js.map +1 -1
  111. package/dist/components/ClickOutside/ClickOutside.cjs.map +1 -1
  112. package/dist/components/CodeBlock/CodeBlock.cjs.map +1 -1
  113. package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
  114. package/dist/components/Collapsible/Collapsible.cjs.map +1 -1
  115. package/dist/components/Collapsible/Collapsible.js.map +1 -1
  116. package/dist/components/Combobox/Combobox.cjs.map +1 -1
  117. package/dist/components/Combobox/Combobox.js.map +1 -1
  118. package/dist/components/Command/Command.cjs.map +1 -1
  119. package/dist/components/Command/Command.js.map +1 -1
  120. package/dist/components/ConfirmDialog/ConfirmDialog.cjs.map +1 -1
  121. package/dist/components/ConfirmDialog/ConfirmDialog.js.map +1 -1
  122. package/dist/components/ContextMenu/ContextMenu.cjs.map +1 -1
  123. package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
  124. package/dist/components/CopyButton/CopyButton.cjs.map +1 -1
  125. package/dist/components/CopyButton/CopyButton.js.map +1 -1
  126. package/dist/components/DataList/DataList.cjs.map +1 -1
  127. package/dist/components/DataList/DataList.js.map +1 -1
  128. package/dist/components/DataTable/DataTable.cjs +1 -1
  129. package/dist/components/DataTable/DataTable.cjs.map +1 -1
  130. package/dist/components/DataTable/DataTable.js +2 -2
  131. package/dist/components/DataTable/DataTable.js.map +1 -1
  132. package/dist/components/DataTable/EditableCell.cjs.map +1 -1
  133. package/dist/components/DataTable/EditableCell.js.map +1 -1
  134. package/dist/components/DatePicker/DatePicker.cjs.map +1 -1
  135. package/dist/components/DateRangePicker/DateRangePicker.cjs.map +1 -1
  136. package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
  137. package/dist/components/DescriptionList/DescriptionList.cjs.map +1 -1
  138. package/dist/components/DescriptionList/DescriptionList.js.map +1 -1
  139. package/dist/components/Divider/Divider.cjs.map +1 -1
  140. package/dist/components/Divider/Divider.js.map +1 -1
  141. package/dist/components/Drawer/Drawer.cjs.map +1 -1
  142. package/dist/components/Drawer/Drawer.js.map +1 -1
  143. package/dist/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
  144. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
  145. package/dist/components/Dropzone/Dropzone.cjs.map +1 -1
  146. package/dist/components/Dropzone/Dropzone.js.map +1 -1
  147. package/dist/components/EmptyState/EmptyState.cjs.map +1 -1
  148. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  149. package/dist/components/ErrorState/ErrorState.cjs.map +1 -1
  150. package/dist/components/ErrorState/ErrorState.js.map +1 -1
  151. package/dist/components/FileUpload/FileUpload.cjs +1 -1
  152. package/dist/components/FileUpload/FileUpload.cjs.map +1 -1
  153. package/dist/components/FileUpload/FileUpload.js +1 -1
  154. package/dist/components/FileUpload/FileUpload.js.map +1 -1
  155. package/dist/components/FilterBar/FilterBar.cjs.map +1 -1
  156. package/dist/components/FilterBar/FilterBar.js.map +1 -1
  157. package/dist/components/FloatingActionButton/FloatingActionButton.cjs.map +1 -1
  158. package/dist/components/FloatingActionButton/FloatingActionButton.js.map +1 -1
  159. package/dist/components/Form/Form.cjs.map +1 -1
  160. package/dist/components/Form/Form.js.map +1 -1
  161. package/dist/components/HoverCard/HoverCard.cjs.map +1 -1
  162. package/dist/components/HoverCard/HoverCard.js.map +1 -1
  163. package/dist/components/Image/Image.cjs.map +1 -1
  164. package/dist/components/ImageCropper/ImageCropper.cjs +1 -1
  165. package/dist/components/ImageCropper/ImageCropper.cjs.map +1 -1
  166. package/dist/components/ImageCropper/ImageCropper.js +1 -1
  167. package/dist/components/ImageCropper/ImageCropper.js.map +1 -1
  168. package/dist/components/Input/Input.cjs.map +1 -1
  169. package/dist/components/Input/Input.js.map +1 -1
  170. package/dist/components/InstallBanner/InstallBanner.cjs.map +1 -1
  171. package/dist/components/InstallBanner/InstallBanner.js.map +1 -1
  172. package/dist/components/InstallButton/InstallButton.cjs.map +1 -1
  173. package/dist/components/InstallButton/InstallButton.js.map +1 -1
  174. package/dist/components/Kanban/Kanban.cjs.map +1 -1
  175. package/dist/components/Kanban/Kanban.js.map +1 -1
  176. package/dist/components/Label/Label.cjs.map +1 -1
  177. package/dist/components/Label/Label.js.map +1 -1
  178. package/dist/components/Lightbox/Lightbox.cjs.map +1 -1
  179. package/dist/components/Lightbox/Lightbox.js.map +1 -1
  180. package/dist/components/ListTile/ListTile.cjs.map +1 -1
  181. package/dist/components/ListTile/ListTile.js.map +1 -1
  182. package/dist/components/Markdown/Markdown.cjs +1 -1
  183. package/dist/components/Markdown/Markdown.cjs.map +1 -1
  184. package/dist/components/Markdown/Markdown.js +2 -2
  185. package/dist/components/Markdown/Markdown.js.map +1 -1
  186. package/dist/components/Masonry/Masonry.cjs.map +1 -1
  187. package/dist/components/Masonry/Masonry.js.map +1 -1
  188. package/dist/components/Menubar/Menubar.cjs.map +1 -1
  189. package/dist/components/Menubar/Menubar.js.map +1 -1
  190. package/dist/components/Modal/Modal.cjs.map +1 -1
  191. package/dist/components/Modal/Modal.js.map +1 -1
  192. package/dist/components/ModalsManager/ModalsManager.cjs.map +1 -1
  193. package/dist/components/ModalsManager/ModalsManager.js.map +1 -1
  194. package/dist/components/Money/Money.cjs.map +1 -1
  195. package/dist/components/Money/Money.js.map +1 -1
  196. package/dist/components/MultiSelect/MultiSelect.cjs.map +1 -1
  197. package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
  198. package/dist/components/NProgress/NProgress.cjs.map +1 -1
  199. package/dist/components/Navbar/Navbar.cjs.map +1 -1
  200. package/dist/components/Navbar/Navbar.js.map +1 -1
  201. package/dist/components/NavigationMenu/NavigationMenu.cjs.map +1 -1
  202. package/dist/components/NavigationMenu/NavigationMenu.js.map +1 -1
  203. package/dist/components/NavigationRail/NavigationRail.cjs.map +1 -1
  204. package/dist/components/NavigationRail/NavigationRail.js.map +1 -1
  205. package/dist/components/NotificationCenter/NotificationCenter.cjs.map +1 -1
  206. package/dist/components/NotificationCenter/NotificationCenter.js.map +1 -1
  207. package/dist/components/NotificationCenter/use-notification-inbox.cjs.map +1 -1
  208. package/dist/components/OfflineIndicator/OfflineIndicator.cjs.map +1 -1
  209. package/dist/components/OfflineIndicator/OfflineIndicator.js.map +1 -1
  210. package/dist/components/Page/Page.cjs.map +1 -1
  211. package/dist/components/Page/Page.js.map +1 -1
  212. package/dist/components/Pagination/Pagination.cjs.map +1 -1
  213. package/dist/components/Pagination/Pagination.js.map +1 -1
  214. package/dist/components/PasswordInput/PasswordInput.cjs.map +1 -1
  215. package/dist/components/PasswordInput/PasswordInput.js.map +1 -1
  216. package/dist/components/PinInput/PinInput.cjs.map +1 -1
  217. package/dist/components/PinInput/PinInput.js.map +1 -1
  218. package/dist/components/Popover/Popover.cjs.map +1 -1
  219. package/dist/components/Popover/Popover.js.map +1 -1
  220. package/dist/components/Portal/Portal.cjs.map +1 -1
  221. package/dist/components/Progress/Progress.cjs.map +1 -1
  222. package/dist/components/Progress/Progress.js.map +1 -1
  223. package/dist/components/QRCode/QRCode.cjs.map +1 -1
  224. package/dist/components/QRCode/QRCode.js.map +1 -1
  225. package/dist/components/Radio/Radio.cjs.map +1 -1
  226. package/dist/components/Radio/Radio.js.map +1 -1
  227. package/dist/components/RangeSlider/RangeSlider.cjs.map +1 -1
  228. package/dist/components/RangeSlider/RangeSlider.js.map +1 -1
  229. package/dist/components/RatingStars/RatingStars.cjs.map +1 -1
  230. package/dist/components/RatingStars/RatingStars.js.map +1 -1
  231. package/dist/components/RefreshIndicator/RefreshIndicator.cjs.map +1 -1
  232. package/dist/components/RefreshIndicator/RefreshIndicator.js.map +1 -1
  233. package/dist/components/RelativeTime/RelativeTime.cjs.map +1 -1
  234. package/dist/components/RelativeTime/RelativeTime.js.map +1 -1
  235. package/dist/components/Resizable/Resizable.cjs.map +1 -1
  236. package/dist/components/Resizable/Resizable.js.map +1 -1
  237. package/dist/components/Scheduler/Scheduler.cjs.map +1 -1
  238. package/dist/components/Scheduler/Scheduler.js.map +1 -1
  239. package/dist/components/ScrollArea/ScrollArea.cjs.map +1 -1
  240. package/dist/components/SearchBar/SearchBar.cjs.map +1 -1
  241. package/dist/components/SearchBar/SearchBar.js.map +1 -1
  242. package/dist/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
  243. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
  244. package/dist/components/Select/Select.cjs.map +1 -1
  245. package/dist/components/Select/Select.js.map +1 -1
  246. package/dist/components/Sidebar/Sidebar.cjs.map +1 -1
  247. package/dist/components/Sidebar/Sidebar.js.map +1 -1
  248. package/dist/components/SignaturePad/SignaturePad.cjs.map +1 -1
  249. package/dist/components/SignaturePad/SignaturePad.js.map +1 -1
  250. package/dist/components/Slider/Slider.cjs.map +1 -1
  251. package/dist/components/Slider/Slider.js.map +1 -1
  252. package/dist/components/Sparkline/Sparkline.cjs.map +1 -1
  253. package/dist/components/Sparkline/Sparkline.js.map +1 -1
  254. package/dist/components/Spinner/Spinner.cjs.map +1 -1
  255. package/dist/components/Spinner/Spinner.js.map +1 -1
  256. package/dist/components/Stat/Stat.cjs.map +1 -1
  257. package/dist/components/Stat/Stat.js.map +1 -1
  258. package/dist/components/Stepper/Stepper.cjs.map +1 -1
  259. package/dist/components/Stepper/Stepper.js.map +1 -1
  260. package/dist/components/StepperInput/StepperInput.cjs.map +1 -1
  261. package/dist/components/StepperInput/StepperInput.js.map +1 -1
  262. package/dist/components/Switch/Switch.cjs.map +1 -1
  263. package/dist/components/Switch/Switch.js.map +1 -1
  264. package/dist/components/SyncStatusBadge/SyncStatusBadge.cjs.map +1 -1
  265. package/dist/components/SyncStatusBadge/SyncStatusBadge.js.map +1 -1
  266. package/dist/components/Table/Table.cjs.map +1 -1
  267. package/dist/components/Table/Table.js.map +1 -1
  268. package/dist/components/Tabs/Tabs.cjs.map +1 -1
  269. package/dist/components/Tabs/Tabs.js.map +1 -1
  270. package/dist/components/Tag/Tag.cjs.map +1 -1
  271. package/dist/components/Tag/Tag.js.map +1 -1
  272. package/dist/components/Textarea/Textarea.cjs.map +1 -1
  273. package/dist/components/Textarea/Textarea.js.map +1 -1
  274. package/dist/components/TimePicker/TimePicker.cjs.map +1 -1
  275. package/dist/components/TimePicker/TimePicker.js.map +1 -1
  276. package/dist/components/Timeline/Timeline.cjs.map +1 -1
  277. package/dist/components/Timeline/Timeline.js.map +1 -1
  278. package/dist/components/Toast/ToastProvider.cjs.map +1 -1
  279. package/dist/components/Toast/ToastProvider.js.map +1 -1
  280. package/dist/components/Toggle/Toggle.cjs.map +1 -1
  281. package/dist/components/ToggleGroup/ToggleGroup.cjs.map +1 -1
  282. package/dist/components/ToggleGroup/ToggleGroup.js.map +1 -1
  283. package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
  284. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  285. package/dist/components/Tour/Tour.cjs.map +1 -1
  286. package/dist/components/Tour/Tour.js.map +1 -1
  287. package/dist/components/Transfer/Transfer.cjs.map +1 -1
  288. package/dist/components/Transfer/Transfer.js.map +1 -1
  289. package/dist/components/TreeView/TreeView.cjs +1 -1
  290. package/dist/components/TreeView/TreeView.cjs.map +1 -1
  291. package/dist/components/TreeView/TreeView.js +1 -4
  292. package/dist/components/TreeView/TreeView.js.map +1 -1
  293. package/dist/components/UpdatePrompt/UpdatePrompt.cjs.map +1 -1
  294. package/dist/components/UpdatePrompt/UpdatePrompt.js.map +1 -1
  295. package/dist/components/VirtualList/VirtualList.cjs.map +1 -1
  296. package/dist/components/VirtualList/VirtualList.js.map +1 -1
  297. package/dist/components/VirtualTable/VirtualTable.cjs.map +1 -1
  298. package/dist/components/VirtualTable/VirtualTable.js.map +1 -1
  299. package/dist/components/VisuallyHidden/VisuallyHidden.cjs.map +1 -1
  300. package/dist/components/Wizard/Wizard.cjs.map +1 -1
  301. package/dist/components/Wizard/Wizard.js.map +1 -1
  302. package/dist/data/data-provider-context.cjs.map +1 -1
  303. package/dist/data/use-resource.cjs.map +1 -1
  304. package/dist/editor/RichTextEditor.cjs.map +1 -1
  305. package/dist/editor/RichTextEditor.js.map +1 -1
  306. package/dist/error-boundary/use-error-handler.cjs.map +1 -1
  307. package/dist/feature-flags/FeatureFlagsProvider.cjs.map +1 -1
  308. package/dist/forms/FormField.cjs.map +1 -1
  309. package/dist/forms/masked-inputs.cjs +1 -1
  310. package/dist/forms/masked-inputs.cjs.map +1 -1
  311. package/dist/forms/masked-inputs.js +1 -1
  312. package/dist/forms/masked-inputs.js.map +1 -1
  313. package/dist/forms/use-viacep.cjs.map +1 -1
  314. package/dist/forms/use-zod-form.cjs.map +1 -1
  315. package/dist/forms/zod-resolver.cjs.map +1 -1
  316. package/dist/forms/zod-resolver.js.map +1 -1
  317. package/dist/geo/TrajectoryMap.cjs.map +1 -1
  318. package/dist/geo/TrajectoryMap.js.map +1 -1
  319. package/dist/geo/leaflet-map.cjs.map +1 -1
  320. package/dist/geo/leaflet-map.js.map +1 -1
  321. package/dist/geo/use-position-tracker.cjs.map +1 -1
  322. package/dist/hooks/use-announce.cjs.map +1 -1
  323. package/dist/hooks/use-async.cjs.map +1 -1
  324. package/dist/hooks/use-before-install-prompt.cjs.map +1 -1
  325. package/dist/hooks/use-breakpoint.cjs.map +1 -1
  326. package/dist/hooks/use-click-outside.cjs.map +1 -1
  327. package/dist/hooks/use-client-filter.cjs.map +1 -1
  328. package/dist/hooks/use-clipboard.cjs.map +1 -1
  329. package/dist/hooks/use-counter.cjs.map +1 -1
  330. package/dist/hooks/use-debounce.cjs.map +1 -1
  331. package/dist/hooks/use-deep-memo.cjs.map +1 -1
  332. package/dist/hooks/use-disclosure.cjs.map +1 -1
  333. package/dist/hooks/use-document-visibility.cjs.map +1 -1
  334. package/dist/hooks/use-event-listener.cjs.map +1 -1
  335. package/dist/hooks/use-geolocation.cjs.map +1 -1
  336. package/dist/hooks/use-hover.cjs.map +1 -1
  337. package/dist/hooks/use-idle.cjs.map +1 -1
  338. package/dist/hooks/use-install-prompt.cjs +1 -1
  339. package/dist/hooks/use-install-prompt.cjs.map +1 -1
  340. package/dist/hooks/use-install-prompt.js +1 -1
  341. package/dist/hooks/use-install-prompt.js.map +1 -1
  342. package/dist/hooks/use-intersection-observer.cjs.map +1 -1
  343. package/dist/hooks/use-interval.cjs.map +1 -1
  344. package/dist/hooks/use-is-first-render.cjs.map +1 -1
  345. package/dist/hooks/use-keyboard-shortcut.cjs +1 -1
  346. package/dist/hooks/use-keyboard-shortcut.cjs.map +1 -1
  347. package/dist/hooks/use-keyboard-shortcut.js +1 -1
  348. package/dist/hooks/use-keyboard-shortcut.js.map +1 -1
  349. package/dist/hooks/use-list-state.cjs.map +1 -1
  350. package/dist/hooks/use-local-storage.cjs.map +1 -1
  351. package/dist/hooks/use-long-press-handlers.cjs.map +1 -1
  352. package/dist/hooks/use-long-press.cjs.map +1 -1
  353. package/dist/hooks/use-map.cjs.map +1 -1
  354. package/dist/hooks/use-media-devices.cjs.map +1 -1
  355. package/dist/hooks/use-media-permission.cjs.map +1 -1
  356. package/dist/hooks/use-media-query.cjs.map +1 -1
  357. package/dist/hooks/use-object-url.cjs.map +1 -1
  358. package/dist/hooks/use-online.cjs.map +1 -1
  359. package/dist/hooks/use-pagination.cjs.map +1 -1
  360. package/dist/hooks/use-previous.cjs.map +1 -1
  361. package/dist/hooks/use-queue.cjs.map +1 -1
  362. package/dist/hooks/use-resize-observer.cjs.map +1 -1
  363. package/dist/hooks/use-scroll-overflow.cjs.map +1 -1
  364. package/dist/hooks/use-service-worker-update.cjs.map +1 -1
  365. package/dist/hooks/use-set.cjs.map +1 -1
  366. package/dist/hooks/use-sortable.cjs +1 -1
  367. package/dist/hooks/use-sortable.cjs.map +1 -1
  368. package/dist/hooks/use-sortable.js +0 -2
  369. package/dist/hooks/use-sortable.js.map +1 -1
  370. package/dist/hooks/use-stable-callback.cjs.map +1 -1
  371. package/dist/hooks/use-storage-estimate.cjs.map +1 -1
  372. package/dist/hooks/use-throttle.cjs.map +1 -1
  373. package/dist/hooks/use-timeout.cjs.map +1 -1
  374. package/dist/hooks/use-toggle.cjs.map +1 -1
  375. package/dist/hooks/use-window-size.cjs.map +1 -1
  376. package/dist/http/api-client.cjs +1 -1
  377. package/dist/http/api-client.cjs.map +1 -1
  378. package/dist/http/api-client.js +7 -5
  379. package/dist/http/api-client.js.map +1 -1
  380. package/dist/http/resumable-upload.cjs +1 -1
  381. package/dist/http/resumable-upload.cjs.map +1 -1
  382. package/dist/http/resumable-upload.js +1 -1
  383. package/dist/http/resumable-upload.js.map +1 -1
  384. package/dist/http/use-poll.cjs.map +1 -1
  385. package/dist/i18n/I18nProvider.cjs.map +1 -1
  386. package/dist/icons/Icon.cjs.map +1 -1
  387. package/dist/icons/IconProvider.cjs.map +1 -1
  388. package/dist/icons/icon-context.cjs.map +1 -1
  389. package/dist/icons/use-icon.cjs.map +1 -1
  390. package/dist/imaging/use-image-processing.cjs.map +1 -1
  391. package/dist/oauth/GoogleSignIn.cjs.map +1 -1
  392. package/dist/oauth/GoogleSignIn.js.map +1 -1
  393. package/dist/oauth/use-oauth-callback.cjs.map +1 -1
  394. package/dist/offline/use-offline-sync.cjs.map +1 -1
  395. package/dist/push/use-push-subscription.cjs.map +1 -1
  396. package/dist/query/QueryProvider.cjs.map +1 -1
  397. package/dist/query/constants.cjs +1 -1
  398. package/dist/query/constants.cjs.map +1 -1
  399. package/dist/query/constants.js +10 -10
  400. package/dist/query/constants.js.map +1 -1
  401. package/dist/query/create-query-keys.cjs +1 -1
  402. package/dist/query/create-query-keys.cjs.map +1 -1
  403. package/dist/query/create-query-keys.js +1 -1
  404. package/dist/query/create-query-keys.js.map +1 -1
  405. package/dist/query/offline-persistence.cjs.map +1 -1
  406. package/dist/query/use-cursor-query.cjs.map +1 -1
  407. package/dist/query/use-offline-mutation.cjs.map +1 -1
  408. package/dist/query/use-paginated-query.cjs.map +1 -1
  409. package/dist/router/AppRouter.cjs +1 -1
  410. package/dist/router/AppRouter.cjs.map +1 -1
  411. package/dist/router/AppRouter.js +7 -2
  412. package/dist/router/AppRouter.js.map +1 -1
  413. package/dist/sse/use-event-stream.cjs.map +1 -1
  414. package/dist/store/create-store.cjs.map +1 -1
  415. package/dist/tabular/use-tabular-predictor.cjs.map +1 -1
  416. package/dist/telemetry/TelemetryProvider.cjs.map +1 -1
  417. package/dist/tempest-react-sdk.d.ts +25 -26
  418. package/dist/theme/ThemeProvider.cjs.map +1 -1
  419. package/dist/theme/color.cjs +1 -1
  420. package/dist/theme/color.cjs.map +1 -1
  421. package/dist/theme/color.js +1 -1
  422. package/dist/theme/color.js.map +1 -1
  423. package/dist/utils/cn.cjs +1 -1
  424. package/dist/utils/cn.cjs.map +1 -1
  425. package/dist/utils/cn.js +1 -1
  426. package/dist/utils/cn.js.map +1 -1
  427. package/dist/utils/objects.cjs +1 -1
  428. package/dist/utils/objects.cjs.map +1 -1
  429. package/dist/utils/objects.js +1 -1
  430. package/dist/utils/objects.js.map +1 -1
  431. package/dist/utils/xlsx.cjs +1 -1
  432. package/dist/utils/xlsx.cjs.map +1 -1
  433. package/dist/utils/xlsx.js +3 -3
  434. package/dist/utils/xlsx.js.map +1 -1
  435. package/dist/vision/core/exceptions.cjs.map +1 -1
  436. package/dist/vision/core/exceptions.js.map +1 -1
  437. package/dist/vision/core/metadata.cjs +1 -1
  438. package/dist/vision/core/metadata.cjs.map +1 -1
  439. package/dist/vision/core/metadata.js +1 -1
  440. package/dist/vision/core/metadata.js.map +1 -1
  441. package/dist/vision/io/image.cjs +1 -1
  442. package/dist/vision/io/image.cjs.map +1 -1
  443. package/dist/vision/io/image.js +4 -2
  444. package/dist/vision/io/image.js.map +1 -1
  445. package/dist/vision/preprocess/image.cjs +1 -1
  446. package/dist/vision/preprocess/image.cjs.map +1 -1
  447. package/dist/vision/preprocess/image.js +4 -2
  448. package/dist/vision/preprocess/image.js.map +1 -1
  449. package/dist/vision/tasks/base.cjs +1 -1
  450. package/dist/vision/tasks/base.cjs.map +1 -1
  451. package/dist/vision/tasks/base.js +3 -1
  452. package/dist/vision/tasks/base.js.map +1 -1
  453. package/dist/vision/tasks/classifier.cjs +1 -1
  454. package/dist/vision/tasks/classifier.cjs.map +1 -1
  455. package/dist/vision/tasks/classifier.js +2 -2
  456. package/dist/vision/tasks/classifier.js.map +1 -1
  457. package/dist/vision/tasks/detectClassify.cjs +1 -1
  458. package/dist/vision/tasks/detectClassify.cjs.map +1 -1
  459. package/dist/vision/tasks/detectClassify.js +16 -15
  460. package/dist/vision/tasks/detectClassify.js.map +1 -1
  461. package/dist/vision/use-camera-stream.cjs.map +1 -1
  462. package/dist/vision/use-live-luminance.cjs.map +1 -1
  463. package/dist/vite/create-vite-config.cjs +1 -1
  464. package/dist/vite/create-vite-config.cjs.map +1 -1
  465. package/dist/vite/create-vite-config.js +3 -3
  466. package/dist/vite/create-vite-config.js.map +1 -1
  467. package/dist/vite/tempest-icons.cjs.map +1 -1
  468. package/dist/vite/tempest-pwa-dev-sw.cjs.map +1 -1
  469. package/dist/vite/tempest-pwa-icons.cjs.map +1 -1
  470. package/dist/ws/use-web-socket.cjs +1 -1
  471. package/dist/ws/use-web-socket.cjs.map +1 -1
  472. package/dist/ws/use-web-socket.js +5 -3
  473. package/dist/ws/use-web-socket.js.map +1 -1
  474. package/package.json +2 -2
  475. package/template/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionList.js","names":[],"sources":["../../../src/components/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { Fragment } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./DescriptionList.module.css\";\n\nexport interface DescriptionListItem {\n /** The key/label rendered inside a `<dt>`. */\n term: ReactNode;\n /** The value rendered inside a `<dd>`. */\n description: ReactNode;\n}\n\nexport interface DescriptionListProps extends HTMLAttributes<HTMLDListElement> {\n /** Term/description pairs rendered as `<dt>`/`<dd>` rows. */\n items: DescriptionListItem[];\n}\n\n/**\n * Renders a semantic `<dl>` of term/description pairs with minimal\n * token-based key/value styling.\n *\n * @param items - The term/description pairs to render.\n * @returns The rendered description list.\n */\nexport function DescriptionList({ items, className, ...props }: DescriptionListProps) {\n return (\n <dl className={cn(styles.list, className)} {...props}>\n {items.map((item, index) => (\n <Fragment key={index}>\n <dt className={styles.term}>{item.term}</dt>\n <dd className={styles.description}>{item.description}</dd>\n </Fragment>\n ))}\n </dl>\n );\n}\n"],"mappings":";;;;;AAwBA,SAAgB,EAAgB,EAAE,UAAO,cAAW,GAAG,KAA+B;CAClF,OACI,kBAAC,MAAD;EAAI,WAAW,EAAG,EAAO,MAAM,CAAS;EAAG,GAAI;YAC1C,EAAM,KAAK,GAAM,MACd,kBAAC,GAAD,EAAA,UAAA,CACI,kBAAC,MAAD;GAAI,WAAW,EAAO;aAAO,EAAK;EAAS,CAAA,GAC3C,kBAAC,MAAD;GAAI,WAAW,EAAO;aAAc,EAAK;EAAgB,CAAA,CACnD,EAAA,GAHK,CAGL,CACb;CACD,CAAA;AAEZ"}
1
+ {"version":3,"file":"DescriptionList.js","names":[],"sources":["../../../src/components/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { Fragment } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./DescriptionList.module.css\";\n\nexport interface DescriptionListItem {\n /** The key/label rendered inside a `<dt>`. */\n term: ReactNode;\n /** The value rendered inside a `<dd>`. */\n description: ReactNode;\n}\n\nexport interface DescriptionListProps extends HTMLAttributes<HTMLDListElement> {\n /** Term/description pairs rendered as `<dt>`/`<dd>` rows. */\n items: DescriptionListItem[];\n}\n\n/**\n * Renders a semantic `<dl>` of term/description pairs with minimal\n * token-based key/value styling.\n *\n * @param items - The term/description pairs to render.\n * @returns The rendered description list.\n */\nexport function DescriptionList({ items, className, ...props }: DescriptionListProps) {\n return (\n <dl className={cn(styles.list, className)} {...props}>\n {items.map((item, index) => (\n <Fragment key={index}>\n <dt className={styles.term}>{item.term}</dt>\n <dd className={styles.description}>{item.description}</dd>\n </Fragment>\n ))}\n </dl>\n );\n}\n"],"mappings":";;;;;AAwBA,SAAgB,EAAgB,EAAE,UAAO,cAAW,GAAG,KAA+B;CAClF,OACI,kBAAC,MAAD;EAAI,WAAW,EAAG,EAAO,MAAM,CAAS;EAAG,GAAI;EAC1C,UAAA,EAAM,KAAK,GAAM,MACd,kBAAC,GAAD,EAAA,UAAA,CACI,kBAAC,MAAD;GAAI,WAAW,EAAO;GAAO,UAAA,EAAK;EAAS,CAAA,GAC3C,kBAAC,MAAD;GAAI,WAAW,EAAO;GAAc,UAAA,EAAK;EAAgB,CAAA,CACnD,EAAA,GAHK,CAGL,CACb;CACD,CAAA;AAEZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"Divider.cjs","names":[],"sources":["../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Divider.module.css\";\n\nexport type DividerOrientation = \"horizontal\" | \"vertical\";\nexport type DividerVariant = \"solid\" | \"dashed\";\nexport type DividerAlign = \"start\" | \"center\" | \"end\";\n\nexport interface DividerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n orientation?: DividerOrientation;\n variant?: DividerVariant;\n /** Optional label rendered inside the divider (horizontal only). */\n label?: ReactNode;\n /** Label horizontal position (only when `label` provided). Defaults to `center`. */\n align?: DividerAlign;\n}\n\n/**\n * Horizontal or vertical visual separator. When `label` is provided in\n * horizontal mode the divider splits and centers the label between two lines.\n */\nexport function Divider({\n orientation = \"horizontal\",\n variant = \"solid\",\n label,\n align = \"center\",\n className,\n ...props\n}: DividerProps) {\n if (orientation === \"vertical\") {\n return (\n <span\n role=\"separator\"\n aria-orientation=\"vertical\"\n className={cn(\n styles.divider,\n styles.vertical,\n variant === \"dashed\" && styles.dashed,\n className,\n )}\n {...props}\n />\n );\n }\n\n if (!label) {\n return (\n <hr\n className={cn(\n styles.divider,\n styles.horizontal,\n styles.bare,\n variant === \"dashed\" && styles.dashed,\n className,\n )}\n />\n );\n }\n\n return (\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n className={cn(\n styles.divider,\n styles.horizontal,\n variant === \"dashed\" && styles.dashed,\n align === \"start\" && styles.alignStart,\n align === \"end\" && styles.alignEnd,\n className,\n )}\n {...props}\n >\n {label}\n </div>\n );\n}\n"],"mappings":"2GAqBA,SAAgB,EAAQ,CACpB,cAAc,aACd,UAAU,QACV,QACA,QAAQ,SACR,YACA,GAAG,GACU,CA+Bb,OA9BI,IAAgB,YAEZ,EAAA,EAAA,IAAA,CAAC,OAAD,CACI,KAAK,YACL,mBAAiB,WACjB,UAAW,EAAA,GACP,EAAA,QAAO,QACP,EAAA,QAAO,SACP,IAAY,UAAY,EAAA,QAAO,OAC/B,CACJ,EACA,GAAI,CACP,CAAA,EAIJ,GAeD,EAAA,EAAA,IAAA,CAAC,MAAD,CACI,KAAK,YACL,mBAAiB,aACjB,UAAW,EAAA,GACP,EAAA,QAAO,QACP,EAAA,QAAO,WACP,IAAY,UAAY,EAAA,QAAO,OAC/B,IAAU,SAAW,EAAA,QAAO,WAC5B,IAAU,OAAS,EAAA,QAAO,SAC1B,CACJ,EACA,GAAI,WAEH,CACA,CAAA,GA3BD,EAAA,EAAA,IAAA,CAAC,KAAD,CACI,UAAW,EAAA,GACP,EAAA,QAAO,QACP,EAAA,QAAO,WACP,EAAA,QAAO,KACP,IAAY,UAAY,EAAA,QAAO,OAC/B,CACJ,CACH,CAAA,CAqBb"}
1
+ {"version":3,"file":"Divider.cjs","names":[],"sources":["../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Divider.module.css\";\n\nexport type DividerOrientation = \"horizontal\" | \"vertical\";\nexport type DividerVariant = \"solid\" | \"dashed\";\nexport type DividerAlign = \"start\" | \"center\" | \"end\";\n\nexport interface DividerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n orientation?: DividerOrientation;\n variant?: DividerVariant;\n /** Optional label rendered inside the divider (horizontal only). */\n label?: ReactNode;\n /** Label horizontal position (only when `label` provided). Defaults to `center`. */\n align?: DividerAlign;\n}\n\n/**\n * Horizontal or vertical visual separator. When `label` is provided in\n * horizontal mode the divider splits and centers the label between two lines.\n */\nexport function Divider({\n orientation = \"horizontal\",\n variant = \"solid\",\n label,\n align = \"center\",\n className,\n ...props\n}: DividerProps) {\n if (orientation === \"vertical\") {\n return (\n <span\n role=\"separator\"\n aria-orientation=\"vertical\"\n className={cn(\n styles.divider,\n styles.vertical,\n variant === \"dashed\" && styles.dashed,\n className,\n )}\n {...props}\n />\n );\n }\n\n if (!label) {\n return (\n <hr\n className={cn(\n styles.divider,\n styles.horizontal,\n styles.bare,\n variant === \"dashed\" && styles.dashed,\n className,\n )}\n />\n );\n }\n\n return (\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n className={cn(\n styles.divider,\n styles.horizontal,\n variant === \"dashed\" && styles.dashed,\n align === \"start\" && styles.alignStart,\n align === \"end\" && styles.alignEnd,\n className,\n )}\n {...props}\n >\n {label}\n </div>\n );\n}\n"],"mappings":"2GAqBA,SAAgB,EAAQ,CACpB,cAAc,aACd,UAAU,QACV,QACA,QAAQ,SACR,YACA,GAAG,GACU,CA+Bb,OA9BI,IAAgB,YAEZ,EAAA,EAAA,IAAA,CAAC,OAAD,CACI,KAAK,YACL,mBAAiB,WACjB,UAAW,EAAA,GACP,EAAA,QAAO,QACP,EAAA,QAAO,SACP,IAAY,UAAY,EAAA,QAAO,OAC/B,CACJ,EACA,GAAI,CACP,CAAA,EAIJ,GAeD,EAAA,EAAA,IAAA,CAAC,MAAD,CACI,KAAK,YACL,mBAAiB,aACjB,UAAW,EAAA,GACP,EAAA,QAAO,QACP,EAAA,QAAO,WACP,IAAY,UAAY,EAAA,QAAO,OAC/B,IAAU,SAAW,EAAA,QAAO,WAC5B,IAAU,OAAS,EAAA,QAAO,SAC1B,CACJ,EACA,GAAI,EAEH,SAAA,CACA,CAAA,GA3BD,EAAA,EAAA,IAAA,CAAC,KAAD,CACI,UAAW,EAAA,GACP,EAAA,QAAO,QACP,EAAA,QAAO,WACP,EAAA,QAAO,KACP,IAAY,UAAY,EAAA,QAAO,OAC/B,CACJ,CACH,CAAA,CAqBb"}
@@ -1 +1 @@
1
- {"version":3,"file":"Divider.js","names":[],"sources":["../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Divider.module.css\";\n\nexport type DividerOrientation = \"horizontal\" | \"vertical\";\nexport type DividerVariant = \"solid\" | \"dashed\";\nexport type DividerAlign = \"start\" | \"center\" | \"end\";\n\nexport interface DividerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n orientation?: DividerOrientation;\n variant?: DividerVariant;\n /** Optional label rendered inside the divider (horizontal only). */\n label?: ReactNode;\n /** Label horizontal position (only when `label` provided). Defaults to `center`. */\n align?: DividerAlign;\n}\n\n/**\n * Horizontal or vertical visual separator. When `label` is provided in\n * horizontal mode the divider splits and centers the label between two lines.\n */\nexport function Divider({\n orientation = \"horizontal\",\n variant = \"solid\",\n label,\n align = \"center\",\n className,\n ...props\n}: DividerProps) {\n if (orientation === \"vertical\") {\n return (\n <span\n role=\"separator\"\n aria-orientation=\"vertical\"\n className={cn(\n styles.divider,\n styles.vertical,\n variant === \"dashed\" && styles.dashed,\n className,\n )}\n {...props}\n />\n );\n }\n\n if (!label) {\n return (\n <hr\n className={cn(\n styles.divider,\n styles.horizontal,\n styles.bare,\n variant === \"dashed\" && styles.dashed,\n className,\n )}\n />\n );\n }\n\n return (\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n className={cn(\n styles.divider,\n styles.horizontal,\n variant === \"dashed\" && styles.dashed,\n align === \"start\" && styles.alignStart,\n align === \"end\" && styles.alignEnd,\n className,\n )}\n {...props}\n >\n {label}\n </div>\n );\n}\n"],"mappings":";;;;AAqBA,SAAgB,EAAQ,EACpB,iBAAc,cACd,aAAU,SACV,UACA,WAAQ,UACR,cACA,GAAG,KACU;CA+Bb,OA9BI,MAAgB,aAEZ,kBAAC,QAAD;EACI,MAAK;EACL,oBAAiB;EACjB,WAAW,EACP,EAAO,SACP,EAAO,UACP,MAAY,YAAY,EAAO,QAC/B,CACJ;EACA,GAAI;CACP,CAAA,IAIJ,IAeD,kBAAC,OAAD;EACI,MAAK;EACL,oBAAiB;EACjB,WAAW,EACP,EAAO,SACP,EAAO,YACP,MAAY,YAAY,EAAO,QAC/B,MAAU,WAAW,EAAO,YAC5B,MAAU,SAAS,EAAO,UAC1B,CACJ;EACA,GAAI;YAEH;CACA,CAAA,IA3BD,kBAAC,MAAD,EACI,WAAW,EACP,EAAO,SACP,EAAO,YACP,EAAO,MACP,MAAY,YAAY,EAAO,QAC/B,CACJ,EACH,CAAA;AAqBb"}
1
+ {"version":3,"file":"Divider.js","names":[],"sources":["../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Divider.module.css\";\n\nexport type DividerOrientation = \"horizontal\" | \"vertical\";\nexport type DividerVariant = \"solid\" | \"dashed\";\nexport type DividerAlign = \"start\" | \"center\" | \"end\";\n\nexport interface DividerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n orientation?: DividerOrientation;\n variant?: DividerVariant;\n /** Optional label rendered inside the divider (horizontal only). */\n label?: ReactNode;\n /** Label horizontal position (only when `label` provided). Defaults to `center`. */\n align?: DividerAlign;\n}\n\n/**\n * Horizontal or vertical visual separator. When `label` is provided in\n * horizontal mode the divider splits and centers the label between two lines.\n */\nexport function Divider({\n orientation = \"horizontal\",\n variant = \"solid\",\n label,\n align = \"center\",\n className,\n ...props\n}: DividerProps) {\n if (orientation === \"vertical\") {\n return (\n <span\n role=\"separator\"\n aria-orientation=\"vertical\"\n className={cn(\n styles.divider,\n styles.vertical,\n variant === \"dashed\" && styles.dashed,\n className,\n )}\n {...props}\n />\n );\n }\n\n if (!label) {\n return (\n <hr\n className={cn(\n styles.divider,\n styles.horizontal,\n styles.bare,\n variant === \"dashed\" && styles.dashed,\n className,\n )}\n />\n );\n }\n\n return (\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n className={cn(\n styles.divider,\n styles.horizontal,\n variant === \"dashed\" && styles.dashed,\n align === \"start\" && styles.alignStart,\n align === \"end\" && styles.alignEnd,\n className,\n )}\n {...props}\n >\n {label}\n </div>\n );\n}\n"],"mappings":";;;;AAqBA,SAAgB,EAAQ,EACpB,iBAAc,cACd,aAAU,SACV,UACA,WAAQ,UACR,cACA,GAAG,KACU;CA+Bb,OA9BI,MAAgB,aAEZ,kBAAC,QAAD;EACI,MAAK;EACL,oBAAiB;EACjB,WAAW,EACP,EAAO,SACP,EAAO,UACP,MAAY,YAAY,EAAO,QAC/B,CACJ;EACA,GAAI;CACP,CAAA,IAIJ,IAeD,kBAAC,OAAD;EACI,MAAK;EACL,oBAAiB;EACjB,WAAW,EACP,EAAO,SACP,EAAO,YACP,MAAY,YAAY,EAAO,QAC/B,MAAU,WAAW,EAAO,YAC5B,MAAU,SAAS,EAAO,UAC1B,CACJ;EACA,GAAI;EAEH,UAAA;CACA,CAAA,IA3BD,kBAAC,MAAD,EACI,WAAW,EACP,EAAO,SACP,EAAO,YACP,EAAO,MACP,MAAY,YAAY,EAAO,QAC/B,CACJ,EACH,CAAA;AAqBb"}
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.cjs","names":[],"sources":["../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["/**\n * @tempest-limits props-count, function-lines — placement plus mobilePlacement is\n * the whole point — a drawer that comes from the side on desktop and from the bottom\n * on a phone — and the rest is the dialog contract the SDK's Modal also has (open,\n * onClose, title, children, footer, closeOnBackdrop, closeOnEsc, hideCloseButton)\n * plus showHandle for the sheet affordance.\n */\nimport { useEffect } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"@/utils/cn\";\nimport { useBreakpoint } from \"@/hooks/use-breakpoint\";\nimport styles from \"./Drawer.module.css\";\n\nexport type DrawerPlacement = \"right\" | \"left\" | \"top\" | \"bottom\";\n\nexport interface DrawerProps {\n open: boolean;\n onClose: () => void;\n placement?: DrawerPlacement;\n title?: ReactNode;\n children?: ReactNode;\n footer?: ReactNode;\n closeOnBackdrop?: boolean;\n closeOnEsc?: boolean;\n hideCloseButton?: boolean;\n className?: string;\n /**\n * Auto-switch to bottom-sheet placement on mobile viewports (< md).\n * Modern mobile apps default to bottom drawers; on desktop the original\n * `placement` is preserved.\n */\n mobilePlacement?: DrawerPlacement;\n /** Render a drag handle indicator at the leading edge (bottom-sheet style). */\n showHandle?: boolean;\n}\n\n/**\n * Sliding side panel. Same building blocks as {@link Modal} but anchored to\n * an edge. Locks body scroll while open.\n */\nexport function Drawer({\n open,\n onClose,\n placement = \"right\",\n title,\n children,\n footer,\n closeOnBackdrop = true,\n closeOnEsc = true,\n hideCloseButton = false,\n className,\n mobilePlacement,\n showHandle = false,\n}: DrawerProps) {\n const { isMobile } = useBreakpoint();\n const effectivePlacement: DrawerPlacement =\n isMobile && mobilePlacement ? mobilePlacement : placement;\n\n useEffect(() => {\n if (!open) return;\n const previousOverflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n const handleKey = (event: KeyboardEvent): void => {\n if (closeOnEsc && event.key === \"Escape\") onClose();\n };\n window.addEventListener(\"keydown\", handleKey);\n return () => {\n document.body.style.overflow = previousOverflow;\n window.removeEventListener(\"keydown\", handleKey);\n };\n }, [open, closeOnEsc, onClose]);\n\n if (!open || typeof document === \"undefined\") return null;\n\n return createPortal(\n <>\n <div\n className={styles.overlay}\n onClick={() => {\n if (closeOnBackdrop) onClose();\n }}\n />\n <aside\n role=\"dialog\"\n aria-modal=\"true\"\n className={cn(styles.panel, styles[effectivePlacement], className)}\n >\n {showHandle &&\n (effectivePlacement === \"bottom\" || effectivePlacement === \"top\") && (\n <div\n className={cn(\n styles.handle,\n effectivePlacement === \"top\" && styles.handleTop,\n )}\n aria-hidden\n />\n )}\n {(title || !hideCloseButton) && (\n <header className={styles.header}>\n <h3 className={styles.title}>{title}</h3>\n {!hideCloseButton && (\n <button\n type=\"button\"\n aria-label=\"Fechar\"\n className={styles.close}\n onClick={onClose}\n >\n <CloseIcon />\n </button>\n )}\n </header>\n )}\n <div className={styles.body}>{children}</div>\n {footer && <footer className={styles.footer}>{footer}</footer>}\n </aside>\n </>,\n document.body,\n );\n}\n\nfunction CloseIcon() {\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M6 6l12 12M6 18L18 6\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n"],"mappings":"gMAyCA,SAAgB,EAAO,CACnB,OACA,UACA,YAAY,QACZ,QACA,WACA,SACA,kBAAkB,GAClB,aAAa,GACb,kBAAkB,GAClB,YACA,kBACA,aAAa,IACD,CACZ,GAAM,CAAE,YAAa,EAAA,cAAc,EAC7B,EACF,GAAY,EAAkB,EAAkB,EAkBpD,OAhBA,EAAA,EAAA,UAAA,KAAgB,CACZ,GAAI,CAAC,EAAM,OACX,IAAM,EAAmB,SAAS,KAAK,MAAM,SAC7C,SAAS,KAAK,MAAM,SAAW,SAC/B,IAAM,EAAa,GAA+B,CAC1C,GAAc,EAAM,MAAQ,UAAU,EAAQ,CACtD,EAEA,OADA,OAAO,iBAAiB,UAAW,CAAS,MAC/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K,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,iBACjD,EAAA,EAAA,IAAA,CAAC,OAAD,CACI,EAAE,uBACF,OAAO,eACP,YAAY,IACZ,cAAc,OACjB,CAAA,CACA,CAAA,CAEb"}
1
+ {"version":3,"file":"Drawer.cjs","names":[],"sources":["../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["/**\n * @tempest-limits props-count, function-lines — placement plus mobilePlacement is\n * the whole point — a drawer that comes from the side on desktop and from the bottom\n * on a phone — and the rest is the dialog contract the SDK's Modal also has (open,\n * onClose, title, children, footer, closeOnBackdrop, closeOnEsc, hideCloseButton)\n * plus showHandle for the sheet affordance.\n */\nimport { useEffect } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"@/utils/cn\";\nimport { useBreakpoint } from \"@/hooks/use-breakpoint\";\nimport styles from \"./Drawer.module.css\";\n\nexport type DrawerPlacement = \"right\" | \"left\" | \"top\" | \"bottom\";\n\nexport interface DrawerProps {\n open: boolean;\n onClose: () => void;\n placement?: DrawerPlacement;\n title?: ReactNode;\n children?: ReactNode;\n footer?: ReactNode;\n closeOnBackdrop?: boolean;\n closeOnEsc?: boolean;\n hideCloseButton?: boolean;\n className?: string;\n /**\n * Auto-switch to bottom-sheet placement on mobile viewports (< md).\n * Modern mobile apps default to bottom drawers; on desktop the original\n * `placement` is preserved.\n */\n mobilePlacement?: DrawerPlacement;\n /** Render a drag handle indicator at the leading edge (bottom-sheet style). */\n showHandle?: boolean;\n}\n\n/**\n * Sliding side panel. Same building blocks as {@link Modal} but anchored to\n * an edge. Locks body scroll while open.\n */\nexport function Drawer({\n open,\n onClose,\n placement = \"right\",\n title,\n children,\n footer,\n closeOnBackdrop = true,\n closeOnEsc = true,\n hideCloseButton = false,\n className,\n mobilePlacement,\n showHandle = false,\n}: DrawerProps) {\n const { isMobile } = useBreakpoint();\n const effectivePlacement: DrawerPlacement =\n isMobile && mobilePlacement ? mobilePlacement : placement;\n\n useEffect(() => {\n if (!open) return;\n const previousOverflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n const handleKey = (event: KeyboardEvent): void => {\n if (closeOnEsc && event.key === \"Escape\") onClose();\n };\n window.addEventListener(\"keydown\", handleKey);\n return () => {\n document.body.style.overflow = previousOverflow;\n window.removeEventListener(\"keydown\", handleKey);\n };\n }, [open, closeOnEsc, onClose]);\n\n if (!open || typeof document === \"undefined\") return null;\n\n return createPortal(\n <>\n <div\n className={styles.overlay}\n onClick={() => {\n if (closeOnBackdrop) onClose();\n }}\n />\n <aside\n role=\"dialog\"\n aria-modal=\"true\"\n className={cn(styles.panel, styles[effectivePlacement], className)}\n >\n {showHandle &&\n (effectivePlacement === \"bottom\" || effectivePlacement === \"top\") && (\n <div\n className={cn(\n styles.handle,\n effectivePlacement === \"top\" && styles.handleTop,\n )}\n aria-hidden\n />\n )}\n {(title || !hideCloseButton) && (\n <header className={styles.header}>\n <h3 className={styles.title}>{title}</h3>\n {!hideCloseButton && (\n <button\n type=\"button\"\n aria-label=\"Fechar\"\n className={styles.close}\n onClick={onClose}\n >\n <CloseIcon />\n </button>\n )}\n </header>\n )}\n <div className={styles.body}>{children}</div>\n {footer && <footer className={styles.footer}>{footer}</footer>}\n </aside>\n </>,\n document.body,\n );\n}\n\nfunction CloseIcon() {\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M6 6l12 12M6 18L18 6\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n"],"mappings":"gMAyCA,SAAgB,EAAO,CACnB,OACA,UACA,YAAY,QACZ,QACA,WACA,SACA,kBAAkB,GAClB,aAAa,GACb,kBAAkB,GAClB,YACA,kBACA,aAAa,IACD,CACZ,GAAM,CAAE,YAAa,EAAA,cAAc,EAC7B,EACF,GAAY,EAAkB,EAAkB,EAkBpD,OAhBA,EAAA,EAAA,UAAA,KAAgB,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W,EAAA,QAAO,KAAO,UAAc,CAAA,EAC3C,IAAU,EAAA,EAAA,IAAA,CAAC,SAAD,CAAQ,UAAW,EAAA,QAAO,OAAS,SAAA,CAAe,CAAA,CAC1D,CACT,CAAA,CAAA,CAAA,CAAA,EACF,SAAS,IACb,CACJ,CAEA,SAAS,GAAY,CACjB,OACI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACjD,UAAA,EAAA,EAAA,IAAA,CAAC,OAAD,CACI,EAAE,uBACF,OAAO,eACP,YAAY,IACZ,cAAc,OACjB,CAAA,CACA,CAAA,CAEb"}
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","names":[],"sources":["../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["/**\n * @tempest-limits props-count, function-lines — placement plus mobilePlacement is\n * the whole point — a drawer that comes from the side on desktop and from the bottom\n * on a phone — and the rest is the dialog contract the SDK's Modal also has (open,\n * onClose, title, children, footer, closeOnBackdrop, closeOnEsc, hideCloseButton)\n * plus showHandle for the sheet affordance.\n */\nimport { useEffect } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"@/utils/cn\";\nimport { useBreakpoint } from \"@/hooks/use-breakpoint\";\nimport styles from \"./Drawer.module.css\";\n\nexport type DrawerPlacement = \"right\" | \"left\" | \"top\" | \"bottom\";\n\nexport interface DrawerProps {\n open: boolean;\n onClose: () => void;\n placement?: DrawerPlacement;\n title?: ReactNode;\n children?: ReactNode;\n footer?: ReactNode;\n closeOnBackdrop?: boolean;\n closeOnEsc?: boolean;\n hideCloseButton?: boolean;\n className?: string;\n /**\n * Auto-switch to bottom-sheet placement on mobile viewports (< md).\n * Modern mobile apps default to bottom drawers; on desktop the original\n * `placement` is preserved.\n */\n mobilePlacement?: DrawerPlacement;\n /** Render a drag handle indicator at the leading edge (bottom-sheet style). */\n showHandle?: boolean;\n}\n\n/**\n * Sliding side panel. Same building blocks as {@link Modal} but anchored to\n * an edge. Locks body scroll while open.\n */\nexport function Drawer({\n open,\n onClose,\n placement = \"right\",\n title,\n children,\n footer,\n closeOnBackdrop = true,\n closeOnEsc = true,\n hideCloseButton = false,\n className,\n mobilePlacement,\n showHandle = false,\n}: DrawerProps) {\n const { isMobile } = useBreakpoint();\n const effectivePlacement: DrawerPlacement =\n isMobile && mobilePlacement ? mobilePlacement : placement;\n\n useEffect(() => {\n if (!open) return;\n const previousOverflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n const handleKey = (event: KeyboardEvent): void => {\n if (closeOnEsc && event.key === \"Escape\") onClose();\n };\n window.addEventListener(\"keydown\", handleKey);\n return () => {\n document.body.style.overflow = previousOverflow;\n window.removeEventListener(\"keydown\", handleKey);\n };\n }, [open, closeOnEsc, onClose]);\n\n if (!open || typeof document === \"undefined\") return null;\n\n return createPortal(\n <>\n <div\n className={styles.overlay}\n onClick={() => {\n if (closeOnBackdrop) onClose();\n }}\n />\n <aside\n role=\"dialog\"\n aria-modal=\"true\"\n className={cn(styles.panel, styles[effectivePlacement], className)}\n >\n {showHandle &&\n (effectivePlacement === \"bottom\" || effectivePlacement === \"top\") && (\n <div\n className={cn(\n styles.handle,\n effectivePlacement === \"top\" && styles.handleTop,\n )}\n aria-hidden\n />\n )}\n {(title || !hideCloseButton) && (\n <header className={styles.header}>\n <h3 className={styles.title}>{title}</h3>\n {!hideCloseButton && (\n <button\n type=\"button\"\n aria-label=\"Fechar\"\n className={styles.close}\n onClick={onClose}\n >\n <CloseIcon />\n </button>\n )}\n </header>\n )}\n <div className={styles.body}>{children}</div>\n {footer && <footer className={styles.footer}>{footer}</footer>}\n </aside>\n </>,\n document.body,\n );\n}\n\nfunction CloseIcon() {\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M6 6l12 12M6 18L18 6\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />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K,WAAW,EAAO;IAAO;GAAc,CAAA;GAC3C,KAAU,kBAAC,UAAD;IAAQ,WAAW,EAAO;cAAS;GAAe,CAAA;EAC1D;GACT,EAAA,CAAA,GACF,SAAS,IACb;AACJ;AAEA,SAAS,IAAY;CACjB,OACI,kBAAC,OAAD;EAAK,OAAM;EAAK,QAAO;EAAK,SAAQ;EAAY,MAAK;YACjD,kBAAC,QAAD;GACI,GAAE;GACF,QAAO;GACP,aAAY;GACZ,eAAc;EACjB,CAAA;CACA,CAAA;AAEb"}
1
+ {"version":3,"file":"Drawer.js","names":[],"sources":["../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["/**\n * @tempest-limits props-count, function-lines — placement plus mobilePlacement is\n * the whole point — a drawer that comes from the side on desktop and from the bottom\n * on a phone — and the rest is the dialog contract the SDK's Modal also has (open,\n * onClose, title, children, footer, closeOnBackdrop, closeOnEsc, hideCloseButton)\n * plus showHandle for the sheet affordance.\n */\nimport { useEffect } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"@/utils/cn\";\nimport { useBreakpoint } from \"@/hooks/use-breakpoint\";\nimport styles from \"./Drawer.module.css\";\n\nexport type DrawerPlacement = \"right\" | \"left\" | \"top\" | \"bottom\";\n\nexport interface DrawerProps {\n open: boolean;\n onClose: () => void;\n placement?: DrawerPlacement;\n title?: ReactNode;\n children?: ReactNode;\n footer?: ReactNode;\n closeOnBackdrop?: boolean;\n closeOnEsc?: boolean;\n hideCloseButton?: boolean;\n className?: string;\n /**\n * Auto-switch to bottom-sheet placement on mobile viewports (< md).\n * Modern mobile apps default to bottom drawers; on desktop the original\n * `placement` is preserved.\n */\n mobilePlacement?: DrawerPlacement;\n /** Render a drag handle indicator at the leading edge (bottom-sheet style). */\n showHandle?: boolean;\n}\n\n/**\n * Sliding side panel. Same building blocks as {@link Modal} but anchored to\n * an edge. Locks body scroll while open.\n */\nexport function Drawer({\n open,\n onClose,\n placement = \"right\",\n title,\n children,\n footer,\n closeOnBackdrop = true,\n closeOnEsc = true,\n hideCloseButton = false,\n className,\n mobilePlacement,\n showHandle = false,\n}: DrawerProps) {\n const { isMobile } = useBreakpoint();\n const effectivePlacement: DrawerPlacement =\n isMobile && mobilePlacement ? mobilePlacement : placement;\n\n useEffect(() => {\n if (!open) return;\n const previousOverflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n const handleKey = (event: KeyboardEvent): void => {\n if (closeOnEsc && event.key === \"Escape\") onClose();\n };\n window.addEventListener(\"keydown\", handleKey);\n return () => {\n document.body.style.overflow = previousOverflow;\n window.removeEventListener(\"keydown\", handleKey);\n };\n }, [open, closeOnEsc, onClose]);\n\n if (!open || typeof document === \"undefined\") return null;\n\n return createPortal(\n <>\n <div\n className={styles.overlay}\n onClick={() => {\n if (closeOnBackdrop) onClose();\n }}\n />\n <aside\n role=\"dialog\"\n aria-modal=\"true\"\n className={cn(styles.panel, styles[effectivePlacement], className)}\n >\n {showHandle &&\n (effectivePlacement === \"bottom\" || effectivePlacement === \"top\") && (\n <div\n className={cn(\n styles.handle,\n effectivePlacement === \"top\" && styles.handleTop,\n )}\n aria-hidden\n />\n )}\n {(title || !hideCloseButton) && (\n <header className={styles.header}>\n <h3 className={styles.title}>{title}</h3>\n {!hideCloseButton && (\n <button\n type=\"button\"\n aria-label=\"Fechar\"\n className={styles.close}\n onClick={onClose}\n >\n <CloseIcon />\n </button>\n )}\n </header>\n )}\n <div className={styles.body}>{children}</div>\n {footer && <footer className={styles.footer}>{footer}</footer>}\n </aside>\n </>,\n document.body,\n );\n}\n\nfunction CloseIcon() {\n return (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M6 6l12 12M6 18L18 6\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n"],"mappings":";;;;;;;AAyCA,SAAgB,EAAO,EACnB,SACA,YACA,eAAY,SACZ,UACA,aACA,WACA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,EAAO;IAAS,UAAA;GAAe,CAAA;EAC1D;CACT,CAAA,CAAA,EAAA,CAAA,GACF,SAAS,IACb;AACJ;AAEA,SAAS,IAAY;CACjB,OACI,kBAAC,OAAD;EAAK,OAAM;EAAK,QAAO;EAAK,SAAQ;EAAY,MAAK;EACjD,UAAA,kBAAC,QAAD;GACI,GAAE;GACF,QAAO;GACP,aAAY;GACZ,eAAc;EACjB,CAAA;CACA,CAAA;AAEb"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenu.cjs","names":[],"sources":["../../../src/components/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["/**\n * @tempest-limits file-lines, function-lines — the body owns placement, outside-\n * click, Escape, and roving focus over items that can be disabled or separators —\n * one keyboard model that has to see the whole item list to know where the next stop\n * is.\n */\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./DropdownMenu.module.css\";\n\nexport type DropdownMenuPlacement = \"bottom-start\" | \"bottom-end\" | \"top-start\" | \"top-end\";\n\nexport type DropdownMenuEntry =\n | {\n type: \"item\";\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n danger?: boolean;\n disabled?: boolean;\n onSelect: () => void;\n }\n | { type: \"separator\"; id: string }\n | { type: \"label\"; id: string; label: ReactNode };\n\nexport interface DropdownMenuProps {\n trigger: ReactElement<{\n onClick?: (e: React.MouseEvent) => void;\n \"aria-expanded\"?: boolean;\n \"aria-controls\"?: string;\n \"aria-haspopup\"?: boolean | \"menu\";\n }>;\n items: DropdownMenuEntry[];\n placement?: DropdownMenuPlacement;\n className?: string;\n}\n\nfunction placementClass(placement: DropdownMenuPlacement): string {\n switch (placement) {\n case \"bottom-end\":\n return styles.bottomEnd;\n case \"top-start\":\n return styles.topStart;\n case \"top-end\":\n return styles.topEnd;\n case \"bottom-start\":\n default:\n return styles.bottomStart;\n }\n}\n\n/**\n * Dropdown menu — list of selectable actions anchored to a trigger.\n *\n * - Toggle on trigger click.\n * - Close on outside click / Escape / item selection.\n * - Arrow keys navigate, Enter activates focused item.\n */\nexport function DropdownMenu({\n trigger,\n items,\n placement = \"bottom-start\",\n className,\n}: DropdownMenuProps) {\n const [open, setOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number>(-1);\n const id = useId();\n const rootRef = useRef<HTMLSpanElement>(null);\n const itemRefs = useRef<Array<HTMLButtonElement | null>>([]);\n\n const selectableIndexes = items\n .map((entry, index) => (entry.type === \"item\" && !entry.disabled ? index : -1))\n .filter((i) => i !== -1);\n\n const close = useCallback((): void => {\n setOpen(false);\n setActiveIndex(-1);\n }, []);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === \"Escape\") {\n close();\n return;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n const current = selectableIndexes.indexOf(activeIndex);\n const next = selectableIndexes[(current + 1) % selectableIndexes.length] ?? -1;\n setActiveIndex(next);\n itemRefs.current[next]?.focus();\n }\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n const current = selectableIndexes.indexOf(activeIndex);\n const prev =\n selectableIndexes[\n (current - 1 + selectableIndexes.length) % selectableIndexes.length\n ] ?? -1;\n setActiveIndex(prev);\n itemRefs.current[prev]?.focus();\n }\n };\n const onDown = (event: MouseEvent): void => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) close();\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"mousedown\", onDown);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"mousedown\", onDown);\n };\n }, [open, activeIndex, selectableIndexes, close]);\n\n const handleTriggerClick = (event: React.MouseEvent): void => {\n trigger.props.onClick?.(event);\n setOpen((prev) => !prev);\n };\n\n const triggerClone = {\n ...trigger,\n props: {\n ...trigger.props,\n onClick: handleTriggerClick,\n \"aria-expanded\": open,\n \"aria-controls\": id,\n \"aria-haspopup\": \"menu\" as const,\n },\n } as ReactElement;\n\n const handleSelect = (entry: Extract<DropdownMenuEntry, { type: \"item\" }>): void => {\n entry.onSelect();\n close();\n };\n\n return (\n <span ref={rootRef} className={styles.root}>\n {triggerClone}\n {open && (\n <ul\n id={id}\n role=\"menu\"\n className={cn(styles.menu, placementClass(placement), className)}\n >\n {items.map((entry, index) => {\n if (entry.type === \"separator\") {\n return (\n <li\n key={entry.id}\n role=\"separator\"\n className={styles.separator}\n aria-hidden\n />\n );\n }\n if (entry.type === \"label\") {\n return (\n <li key={entry.id} role=\"presentation\" className={styles.label}>\n {entry.label}\n </li>\n );\n }\n return (\n <li key={entry.id} role=\"none\">\n <button\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"menuitem\"\n className={cn(\n styles.item,\n entry.danger && styles.danger,\n activeIndex === index && styles.active,\n )}\n disabled={entry.disabled}\n onClick={() => handleSelect(entry)}\n onMouseEnter={() => setActiveIndex(index)}\n >\n {entry.icon && <span aria-hidden>{entry.icon}</span>}\n {entry.label}\n </button>\n </li>\n );\n })}\n </ul>\n )}\n </span>\n );\n}\n"],"mappings":"mIAsCA,SAAS,EAAe,EAA0C,CAC9D,OAAQ,EAAR,CACI,IAAK,aACD,OAAO,EAAA,QAAO,UAClB,IAAK,YACD,OAAO,EAAA,QAAO,SAClB,IAAK,UACD,OAAO,EAAA,QAAO,OAElB,QACI,OAAO,EAAA,QAAO,WACtB,CACJ,CASA,SAAgB,EAAa,CACzB,UACA,QACA,YAAY,eACZ,aACkB,CAClB,GAAM,CAAC,EAAM,IAAA,EAAA,EAAA,SAAA,CAAoB,EAAK,EAChC,CAAC,EAAa,IAAA,EAAA,EAAA,SAAA,CAAmC,EAAE,EACnD,GAAA,EAAA,EAAA,MAAA,CAAW,EACX,GAAA,EAAA,EAAA,OAAA,CAAkC,IAAI,EACtC,GAAA,EAAA,EAAA,OAAA,CAAmD,CAAC,CAAC,EAErD,EAAoB,EACrB,KAAK,EAAO,IAAW,EAAM,OAAS,QAAU,CAAC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CAChF,EAAM,SAAS,EACf,EAAM,CACV,EAEA,OACI,EAAA,EAAA,KAAA,CAAC,OAAD,CAAM,IAAK,EAAS,UAAW,EAAA,QAAO,cAAtC,CACK,EACA,IACG,EAAA,EAAA,IAAA,CAAC,KAAD,CACQ,KACJ,KAAK,OACL,UAAW,EAAA,GAAG,EAAA,QAAO,KAAM,EAAe,CAAS,EAAG,CAAS,WAE9D,EAAM,KAAK,EAAO,IACX,EAAM,OAAS,aAEX,EAAA,EAAA,IAAA,CAAC,KAAD,CAEI,KAAK,YACL,UAAW,EAAA,QAAO,UAClB,cAAA,EACH,EAJQ,EAAM,EAId,EAGL,EAAM,OAAS,SAEX,EAAA,EAAA,IAAA,CAAC,KAAD,CAAmB,KAAK,eAAe,UAAW,EAAA,QAAO,eACpD,EAAM,KACP,EAFK,EAAM,EAEX,GAIR,EAAA,EAAA,IAAA,CAAC,KAAD,CAAmB,KAAK,iBACpB,EAAA,EAAA,KAAA,CAAC,SAAD,CACI,IAAM,GAAO,CACT,EAAS,QAAQ,GAAS,CAC9B,EACA,KAAK,SACL,KAAK,WACL,UAAW,EAAA,GACP,EAAA,QAAO,KACP,EAAM,QAAU,EAAA,QAAO,OACvB,IAAgB,GAAS,EAAA,QAAO,MACpC,EACA,SAAU,EAAM,SAChB,YAAe,EAAa,CAAK,EACjC,iBAAoB,EAAe,CAAK,WAb5C,CAeK,EAAM,OAAQ,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,cAAA,YAAa,EAAM,IAAW,CAAA,EAClD,EAAM,KACH,GACR,EAnBK,EAAM,EAmBX,CAEX,CACD,CAAA,CAEN,GAEd"}
1
+ {"version":3,"file":"DropdownMenu.cjs","names":[],"sources":["../../../src/components/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["/**\n * @tempest-limits file-lines, function-lines — the body owns placement, outside-\n * click, Escape, and roving focus over items that can be disabled or separators —\n * one keyboard model that has to see the whole item list to know where the next stop\n * is.\n */\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./DropdownMenu.module.css\";\n\nexport type DropdownMenuPlacement = \"bottom-start\" | \"bottom-end\" | \"top-start\" | \"top-end\";\n\nexport type DropdownMenuEntry =\n | {\n type: \"item\";\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n danger?: boolean;\n disabled?: boolean;\n onSelect: () => void;\n }\n | { type: \"separator\"; id: string }\n | { type: \"label\"; id: string; label: ReactNode };\n\nexport interface DropdownMenuProps {\n trigger: ReactElement<{\n onClick?: (e: React.MouseEvent) => void;\n \"aria-expanded\"?: boolean;\n \"aria-controls\"?: string;\n \"aria-haspopup\"?: boolean | \"menu\";\n }>;\n items: DropdownMenuEntry[];\n placement?: DropdownMenuPlacement;\n className?: string;\n}\n\nfunction placementClass(placement: DropdownMenuPlacement): string {\n switch (placement) {\n case \"bottom-end\":\n return styles.bottomEnd;\n case \"top-start\":\n return styles.topStart;\n case \"top-end\":\n return styles.topEnd;\n case \"bottom-start\":\n default:\n return styles.bottomStart;\n }\n}\n\n/**\n * Dropdown menu — list of selectable actions anchored to a trigger.\n *\n * - Toggle on trigger click.\n * - Close on outside click / Escape / item selection.\n * - Arrow keys navigate, Enter activates focused item.\n */\nexport function DropdownMenu({\n trigger,\n items,\n placement = \"bottom-start\",\n className,\n}: DropdownMenuProps) {\n const [open, setOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number>(-1);\n const id = useId();\n const rootRef = useRef<HTMLSpanElement>(null);\n const itemRefs = useRef<Array<HTMLButtonElement | null>>([]);\n\n const selectableIndexes = items\n .map((entry, index) => (entry.type === \"item\" && !entry.disabled ? index : -1))\n .filter((i) => i !== -1);\n\n const close = useCallback((): void => {\n setOpen(false);\n setActiveIndex(-1);\n }, []);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === \"Escape\") {\n close();\n return;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n const current = selectableIndexes.indexOf(activeIndex);\n const next = selectableIndexes[(current + 1) % selectableIndexes.length] ?? -1;\n setActiveIndex(next);\n itemRefs.current[next]?.focus();\n }\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n const current = selectableIndexes.indexOf(activeIndex);\n const prev =\n selectableIndexes[\n (current - 1 + selectableIndexes.length) % selectableIndexes.length\n ] ?? -1;\n setActiveIndex(prev);\n itemRefs.current[prev]?.focus();\n }\n };\n const onDown = (event: MouseEvent): void => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) close();\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"mousedown\", onDown);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"mousedown\", onDown);\n };\n }, [open, activeIndex, selectableIndexes, close]);\n\n const handleTriggerClick = (event: React.MouseEvent): void => {\n trigger.props.onClick?.(event);\n setOpen((prev) => !prev);\n };\n\n const triggerClone = {\n ...trigger,\n props: {\n ...trigger.props,\n onClick: handleTriggerClick,\n \"aria-expanded\": open,\n \"aria-controls\": id,\n \"aria-haspopup\": \"menu\" as const,\n },\n } as ReactElement;\n\n const handleSelect = (entry: Extract<DropdownMenuEntry, { type: \"item\" }>): void => {\n entry.onSelect();\n close();\n };\n\n return (\n <span ref={rootRef} className={styles.root}>\n {triggerClone}\n {open && (\n <ul\n id={id}\n role=\"menu\"\n className={cn(styles.menu, placementClass(placement), className)}\n >\n {items.map((entry, index) => {\n if (entry.type === \"separator\") {\n return (\n <li\n key={entry.id}\n role=\"separator\"\n className={styles.separator}\n aria-hidden\n />\n );\n }\n if (entry.type === \"label\") {\n return (\n <li key={entry.id} role=\"presentation\" className={styles.label}>\n {entry.label}\n </li>\n );\n }\n return (\n <li key={entry.id} role=\"none\">\n <button\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"menuitem\"\n className={cn(\n styles.item,\n entry.danger && styles.danger,\n activeIndex === index && styles.active,\n )}\n disabled={entry.disabled}\n onClick={() => handleSelect(entry)}\n onMouseEnter={() => setActiveIndex(index)}\n >\n {entry.icon && <span aria-hidden>{entry.icon}</span>}\n {entry.label}\n </button>\n </li>\n );\n })}\n </ul>\n )}\n </span>\n );\n}\n"],"mappings":"mIAsCA,SAAS,EAAe,EAA0C,CAC9D,OAAQ,EAAR,CACI,IAAK,aACD,OAAO,EAAA,QAAO,UAClB,IAAK,YACD,OAAO,EAAA,QAAO,SAClB,IAAK,UACD,OAAO,EAAA,QAAO,OAElB,QACI,OAAO,EAAA,QAAO,WACtB,CACJ,CASA,SAAgB,EAAa,CACzB,UACA,QACA,YAAY,eACZ,aACkB,CAClB,GAAM,CAAC,EAAM,IAAA,EAAW,EAAA,SAAA,CAAS,EAAK,EAChC,CAAC,EAAa,IAAA,EAAkB,EAAA,SAAA,CAAiB,EAAE,EACnD,GAAA,EAAK,EAAA,MAAA,CAAM,EACX,GAAA,EAAU,EAAA,OAAA,CAAwB,IAAI,EACtC,GAAA,EAAW,EAAA,OAAA,CAAwC,CAAC,CAAC,EAErD,EAAoB,EACrB,KAAK,EAAO,IAAW,EAAM,OAAS,QAAU,CAAC,EAAM,SAAW,EAAQ,EAAG,CAAC,CAC9E,OAAQ,GAAM,IAAM,EAAE,EAErB,GAAA,EAAQ,EAAA,YAAA,KAAwB,CAClC,EAAQ,EAAK,EACb,EAAe,EAAE,CACrB,EAAG,CAAC,CAAC,GAEL,EAAA,EAAA,UAAA,KAAgB,CACZ,GAAI,CAAC,EAAM,OACX,IAAM,EAAS,GAA+B,CAC1C,GAAI,EAAM,MAAQ,SAAU,CACxB,EAAM,EACN,MACJ,CACA,GAAI,EAAM,MAAQ,YAAa,CAC3B,EAAM,eAAe,EACrB,IAAM,EAAU,EAAkB,QAAQ,CAAW,EAC/C,EAAO,GAAmB,EAAU,GAAK,EAAkB,SAAW,GAC5E,EAAe,CAAI,EACnB,EAAS,QAAQ,EAAK,EAAE,MAAM,CAClC,CACA,GAAI,EAAM,MAAQ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ACP,EAFK,EAAM,EAEX,GAIR,EAAA,EAAA,IAAA,CAAC,KAAD,CAAmB,KAAK,OACpB,UAAA,EAAA,EAAA,KAAA,CAAC,SAAD,CACI,IAAM,GAAO,CACT,EAAS,QAAQ,GAAS,CAC9B,EACA,KAAK,SACL,KAAK,WACL,UAAW,EAAA,GACP,EAAA,QAAO,KACP,EAAM,QAAU,EAAA,QAAO,OACvB,IAAgB,GAAS,EAAA,QAAO,MACpC,EACA,SAAU,EAAM,SAChB,YAAe,EAAa,CAAK,EACjC,iBAAoB,EAAe,CAAK,EAb5C,SAAA,CAeK,EAAM,OAAQ,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,cAAA,GAAa,SAAA,EAAM,IAAW,CAAA,EAClD,EAAM,KACH,GACR,EAnBK,EAAM,EAmBX,CAEX,CACD,CAAA,CAEN,GAEd"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenu.js","names":[],"sources":["../../../src/components/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["/**\n * @tempest-limits file-lines, function-lines — the body owns placement, outside-\n * click, Escape, and roving focus over items that can be disabled or separators —\n * one keyboard model that has to see the whole item list to know where the next stop\n * is.\n */\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./DropdownMenu.module.css\";\n\nexport type DropdownMenuPlacement = \"bottom-start\" | \"bottom-end\" | \"top-start\" | \"top-end\";\n\nexport type DropdownMenuEntry =\n | {\n type: \"item\";\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n danger?: boolean;\n disabled?: boolean;\n onSelect: () => void;\n }\n | { type: \"separator\"; id: string }\n | { type: \"label\"; id: string; label: ReactNode };\n\nexport interface DropdownMenuProps {\n trigger: ReactElement<{\n onClick?: (e: React.MouseEvent) => void;\n \"aria-expanded\"?: boolean;\n \"aria-controls\"?: string;\n \"aria-haspopup\"?: boolean | \"menu\";\n }>;\n items: DropdownMenuEntry[];\n placement?: DropdownMenuPlacement;\n className?: string;\n}\n\nfunction placementClass(placement: DropdownMenuPlacement): string {\n switch (placement) {\n case \"bottom-end\":\n return styles.bottomEnd;\n case \"top-start\":\n return styles.topStart;\n case \"top-end\":\n return styles.topEnd;\n case \"bottom-start\":\n default:\n return styles.bottomStart;\n }\n}\n\n/**\n * Dropdown menu — list of selectable actions anchored to a trigger.\n *\n * - Toggle on trigger click.\n * - Close on outside click / Escape / item selection.\n * - Arrow keys navigate, Enter activates focused item.\n */\nexport function DropdownMenu({\n trigger,\n items,\n placement = \"bottom-start\",\n className,\n}: DropdownMenuProps) {\n const [open, setOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number>(-1);\n const id = useId();\n const rootRef = useRef<HTMLSpanElement>(null);\n const itemRefs = useRef<Array<HTMLButtonElement | null>>([]);\n\n const selectableIndexes = items\n .map((entry, index) => (entry.type === \"item\" && !entry.disabled ? index : -1))\n .filter((i) => i !== -1);\n\n const close = useCallback((): void => {\n setOpen(false);\n setActiveIndex(-1);\n }, []);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === \"Escape\") {\n close();\n return;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n const current = selectableIndexes.indexOf(activeIndex);\n const next = selectableIndexes[(current + 1) % selectableIndexes.length] ?? -1;\n setActiveIndex(next);\n itemRefs.current[next]?.focus();\n }\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n const current = selectableIndexes.indexOf(activeIndex);\n const prev =\n selectableIndexes[\n (current - 1 + selectableIndexes.length) % selectableIndexes.length\n ] ?? -1;\n setActiveIndex(prev);\n itemRefs.current[prev]?.focus();\n }\n };\n const onDown = (event: MouseEvent): void => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) close();\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"mousedown\", onDown);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"mousedown\", onDown);\n };\n }, [open, activeIndex, selectableIndexes, close]);\n\n const handleTriggerClick = (event: React.MouseEvent): void => {\n trigger.props.onClick?.(event);\n setOpen((prev) => !prev);\n };\n\n const triggerClone = {\n ...trigger,\n props: {\n ...trigger.props,\n onClick: handleTriggerClick,\n \"aria-expanded\": open,\n \"aria-controls\": id,\n \"aria-haspopup\": \"menu\" as const,\n },\n } as ReactElement;\n\n const handleSelect = (entry: Extract<DropdownMenuEntry, { type: \"item\" }>): void => {\n entry.onSelect();\n close();\n };\n\n return (\n <span ref={rootRef} className={styles.root}>\n {triggerClone}\n {open && (\n <ul\n id={id}\n role=\"menu\"\n className={cn(styles.menu, placementClass(placement), className)}\n >\n {items.map((entry, index) => {\n if (entry.type === \"separator\") {\n return (\n <li\n key={entry.id}\n role=\"separator\"\n className={styles.separator}\n aria-hidden\n />\n );\n }\n if (entry.type === \"label\") {\n return (\n <li key={entry.id} role=\"presentation\" className={styles.label}>\n {entry.label}\n </li>\n );\n }\n return (\n <li key={entry.id} role=\"none\">\n <button\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"menuitem\"\n className={cn(\n styles.item,\n entry.danger && styles.danger,\n activeIndex === index && styles.active,\n )}\n disabled={entry.disabled}\n onClick={() => handleSelect(entry)}\n onMouseEnter={() => setActiveIndex(index)}\n >\n {entry.icon && <span aria-hidden>{entry.icon}</span>}\n {entry.label}\n </button>\n </li>\n );\n })}\n </ul>\n )}\n </span>\n );\n}\n"],"mappings":";;;;;AAsCA,SAAS,EAAe,GAA0C;CAC9D,QAAQ,GAAR;EACI,KAAK,cACD,OAAO,EAAO;EAClB,KAAK,aACD,OAAO,EAAO;EAClB,KAAK,WACD,OAAO,EAAO;EAElB,SACI,OAAO,EAAO;CACtB;AACJ;AASA,SAAgB,EAAa,EACzB,YACA,UACA,eAAY,gBACZ,gBACkB;CAClB,IAAM,CAAC,GAAM,KAAW,EAAS,EAAK,GAChC,CAAC,GAAa,KAAkB,EAAiB,EAA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AAe;EACjB,GAAG;EACH,OAAO;GACH,GAAG,EAAQ;GACX,SAAS;GACT,iBAAiB;GACjB,iBAAiB;GACjB,iBAAiB;EACrB;CACJ,GAEM,KAAgB,MAA8D;EAEhF,AADA,EAAM,SAAS,GACf,EAAM;CACV;CAEA,OACI,kBAAC,QAAD;EAAM,KAAK;EAAS,WAAW,EAAO;YAAtC,CACK,GACA,KACG,kBAAC,MAAD;GACQ;GACJ,MAAK;GACL,WAAW,EAAG,EAAO,MAAM,EAAe,CAAS,GAAG,CAAS;aAE9D,EAAM,KAAK,GAAO,MACX,EAAM,SAAS,cAEX,kBAAC,MAAD;IAEI,MAAK;IACL,WAAW,EAAO;IAClB,eAAA;GACH,GAJQ,EAAM,EAId,IAGL,EAAM,SAAS,UAEX,kBAAC,MAAD;IAAmB,MAAK;IAAe,WAAW,EAAO;cACpD,EAAM;GACP,GAFK,EAAM,EAEX,IAIR,kBAAC,MAAD;IAAmB,MAAK;cACpB,kBAAC,UAAD;KACI,MAAM,MAAO;MACT,EAAS,QAAQ,KAAS;KAC9B;KACA,MAAK;KACL,MAAK;KACL,WAAW,EACP,EAAO,MACP,EAAM,UAAU,EAAO,QACvB,MAAgB,KAAS,EAAO,MACpC;KACA,UAAU,EAAM;KAChB,eAAe,EAAa,CAAK;KACjC,oBAAoB,EAAe,CAAK;eAb5C,CAeK,EAAM,QAAQ,kBAAC,QAAD;MAAM,eAAA;gBAAa,EAAM;KAAW,CAAA,GAClD,EAAM,KACH;;GACR,GAnBK,EAAM,EAmBX,CAEX;EACD,CAAA,CAEN;;AAEd"}
1
+ {"version":3,"file":"DropdownMenu.js","names":[],"sources":["../../../src/components/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["/**\n * @tempest-limits file-lines, function-lines — the body owns placement, outside-\n * click, Escape, and roving focus over items that can be disabled or separators —\n * one keyboard model that has to see the whole item list to know where the next stop\n * is.\n */\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./DropdownMenu.module.css\";\n\nexport type DropdownMenuPlacement = \"bottom-start\" | \"bottom-end\" | \"top-start\" | \"top-end\";\n\nexport type DropdownMenuEntry =\n | {\n type: \"item\";\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n danger?: boolean;\n disabled?: boolean;\n onSelect: () => void;\n }\n | { type: \"separator\"; id: string }\n | { type: \"label\"; id: string; label: ReactNode };\n\nexport interface DropdownMenuProps {\n trigger: ReactElement<{\n onClick?: (e: React.MouseEvent) => void;\n \"aria-expanded\"?: boolean;\n \"aria-controls\"?: string;\n \"aria-haspopup\"?: boolean | \"menu\";\n }>;\n items: DropdownMenuEntry[];\n placement?: DropdownMenuPlacement;\n className?: string;\n}\n\nfunction placementClass(placement: DropdownMenuPlacement): string {\n switch (placement) {\n case \"bottom-end\":\n return styles.bottomEnd;\n case \"top-start\":\n return styles.topStart;\n case \"top-end\":\n return styles.topEnd;\n case \"bottom-start\":\n default:\n return styles.bottomStart;\n }\n}\n\n/**\n * Dropdown menu — list of selectable actions anchored to a trigger.\n *\n * - Toggle on trigger click.\n * - Close on outside click / Escape / item selection.\n * - Arrow keys navigate, Enter activates focused item.\n */\nexport function DropdownMenu({\n trigger,\n items,\n placement = \"bottom-start\",\n className,\n}: DropdownMenuProps) {\n const [open, setOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number>(-1);\n const id = useId();\n const rootRef = useRef<HTMLSpanElement>(null);\n const itemRefs = useRef<Array<HTMLButtonElement | null>>([]);\n\n const selectableIndexes = items\n .map((entry, index) => (entry.type === \"item\" && !entry.disabled ? index : -1))\n .filter((i) => i !== -1);\n\n const close = useCallback((): void => {\n setOpen(false);\n setActiveIndex(-1);\n }, []);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === \"Escape\") {\n close();\n return;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n const current = selectableIndexes.indexOf(activeIndex);\n const next = selectableIndexes[(current + 1) % selectableIndexes.length] ?? -1;\n setActiveIndex(next);\n itemRefs.current[next]?.focus();\n }\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n const current = selectableIndexes.indexOf(activeIndex);\n const prev =\n selectableIndexes[\n (current - 1 + selectableIndexes.length) % selectableIndexes.length\n ] ?? -1;\n setActiveIndex(prev);\n itemRefs.current[prev]?.focus();\n }\n };\n const onDown = (event: MouseEvent): void => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) close();\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"mousedown\", onDown);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"mousedown\", onDown);\n };\n }, [open, activeIndex, selectableIndexes, close]);\n\n const handleTriggerClick = (event: React.MouseEvent): void => {\n trigger.props.onClick?.(event);\n setOpen((prev) => !prev);\n };\n\n const triggerClone = {\n ...trigger,\n props: {\n ...trigger.props,\n onClick: handleTriggerClick,\n \"aria-expanded\": open,\n \"aria-controls\": id,\n \"aria-haspopup\": \"menu\" as const,\n },\n } as ReactElement;\n\n const handleSelect = (entry: Extract<DropdownMenuEntry, { type: \"item\" }>): void => {\n entry.onSelect();\n close();\n };\n\n return (\n <span ref={rootRef} className={styles.root}>\n {triggerClone}\n {open && (\n <ul\n id={id}\n role=\"menu\"\n className={cn(styles.menu, placementClass(placement), className)}\n >\n {items.map((entry, index) => {\n if (entry.type === \"separator\") {\n return (\n <li\n key={entry.id}\n role=\"separator\"\n className={styles.separator}\n aria-hidden\n />\n );\n }\n if (entry.type === \"label\") {\n return (\n <li key={entry.id} role=\"presentation\" className={styles.label}>\n {entry.label}\n </li>\n );\n }\n return (\n <li key={entry.id} role=\"none\">\n <button\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"menuitem\"\n className={cn(\n styles.item,\n entry.danger && styles.danger,\n activeIndex === index && styles.active,\n )}\n disabled={entry.disabled}\n onClick={() => handleSelect(entry)}\n onMouseEnter={() => setActiveIndex(index)}\n >\n {entry.icon && <span aria-hidden>{entry.icon}</span>}\n {entry.label}\n </button>\n </li>\n );\n })}\n </ul>\n )}\n </span>\n );\n}\n"],"mappings":";;;;;AAsCA,SAAS,EAAe,GAA0C;CAC9D,QAAQ,GAAR;EACI,KAAK,cACD,OAAO,EAAO;EAClB,KAAK,aACD,OAAO,EAAO;EAClB,KAAK,WACD,OAAO,EAAO;EAElB,SACI,OAAO,EAAO;CACtB;AACJ;AASA,SAAgB,EAAa,EACzB,YACA,UACA,eAAY,gBACZ,gBACkB;CAClB,IAAM,CAAC,GAAM,KAAW,EAAS,EAAK,GAChC,CAAC,GAAa,KAAkB,EAAiB,EAAE,GACnD,IAAK,EAAM,GACX,IAAU,EAAwB,IAAI,GACtC,IAAW,EAAwC,CAAC,CAAC,GAErD,IAAoB,EACrB,KAAK,GAAO,MAAW,EAAM,SAAS,UAAU,CAAC,EAAM,WAAW,IAAQ,EAAG,CAAC,CAC9E,QAAQ,MAAM,MAAM,EAAE,GAErB,IAAQ,QAAwB;EAElC,AADA,EAAQ,EAAK,GACb,EAAe,EAAE;CACrB,GAAG,CAAC,CAAC;CAEL,QAAgB;EACZ,IAAI,CAAC,GAAM;EACX,IAAM,KAAS,MAA+B;GAC1C,IAAI,EAAM,QAAQ,UAAU;IACxB,EAAM;IACN;GACJ;GACA,IAAI,EAAM,QAAQ,aAAa;IAC3B,EAAM,eAAe;IACrB,IAAM,IAAU,EAAkB,QAAQ,CAAW,GAC/C,IAAO,GAAmB,IAAU,KAAK,EAAkB,WAAW;IAE5E,AADA,EAAe,CAAI,GACnB,EAAS,QAAQ,EAAK,EAAE,MAAM;GAClC;GACA,IAAI,EAAM,QAAQ,WAAW;IACzB,EAAM,eAAe;IACrB,IAAM,IAAU,EAAkB,QAAQ,CAAW,GAC/C,IACF,GACK,IAAU,IAAI,EAAkB,UAAU,EAAkB,WAC5D;IAET,AADA,EAAe,CAAI,GACnB,EAAS,QAAQ,EAAK,EA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;KAChB,eAAe,EAAa,CAAK;KACjC,oBAAoB,EAAe,CAAK;KAb5C,UAAA,CAeK,EAAM,QAAQ,kBAAC,QAAD;MAAM,eAAA;MAAa,UAAA,EAAM;KAAW,CAAA,GAClD,EAAM,KACH;;GACR,GAnBK,EAAM,EAmBX,CAEX;EACD,CAAA,CAEN;;AAEd"}
@@ -1 +1 @@
1
- {"version":3,"file":"Dropzone.cjs","names":[],"sources":["../../../src/components/Dropzone/Dropzone.tsx"],"sourcesContent":["/**\n * @tempest-limits props-count, function-lines — accept, multiple and maxSize are\n * validation the component must apply before it can call onDrop or onReject, and\n * drag state, keyboard activation and the hidden input all live in the body because\n * they resolve to the same file list.\n */\nimport { useRef, useState } from \"react\";\nimport type { DragEvent, KeyboardEvent, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Dropzone.module.css\";\n\n/** Props for {@link Dropzone}. */\nexport interface DropzoneProps {\n /** Called with the accepted files after a drop or file-dialog selection. */\n onDrop: (files: File[]) => void;\n /** `accept` attribute forwarded to the hidden file input. */\n accept?: string;\n /** Allow selecting/dropping multiple files. Default `true`. */\n multiple?: boolean;\n /** Disable interaction. */\n disabled?: boolean;\n /** Maximum file size in bytes; larger files are filtered out. */\n maxSize?: number;\n /** Called with files rejected by `maxSize`. */\n onReject?: (files: File[]) => void;\n /** Custom inner content. Falls back to a default prompt. */\n children?: ReactNode;\n /** Extra class applied to the drop area. */\n className?: string;\n}\n\n/**\n * Drag-and-drop file area with a hidden file input. Clickable and keyboard\n * focusable; filters by `maxSize` before calling `onDrop`.\n *\n * @example\n * <Dropzone accept=\"image/*\" maxSize={5 * 1024 * 1024} onDrop={setFiles}>\n * Solte imagens aqui ou clique para selecionar\n * </Dropzone>\n */\nexport function Dropzone({\n onDrop,\n accept,\n multiple = true,\n disabled = false,\n maxSize,\n onReject,\n children,\n className,\n}: DropzoneProps) {\n const inputRef = useRef<HTMLInputElement>(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const handleFiles = (fileList: FileList | null): void => {\n if (!fileList || fileList.length === 0) return;\n const all = Array.from(fileList);\n const limited = multiple ? all : all.slice(0, 1);\n\n if (maxSize === undefined) {\n onDrop(limited);\n return;\n }\n\n const accepted: File[] = [];\n const rejected: File[] = [];\n for (const file of limited) {\n if (file.size > maxSize) rejected.push(file);\n else accepted.push(file);\n }\n if (rejected.length > 0) onReject?.(rejected);\n if (accepted.length > 0) onDrop(accepted);\n };\n\n const openDialog = (): void => {\n if (disabled) return;\n inputRef.current?.click();\n };\n\n const handleDragEnter = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n if (disabled) return;\n setIsDragging(true);\n };\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n };\n\n const handleDragLeave = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n setIsDragging(false);\n };\n\n const handleDrop = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n setIsDragging(false);\n if (disabled) return;\n handleFiles(event.dataTransfer.files);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n openDialog();\n }\n };\n\n return (\n <div\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n className={cn(\n styles.zone,\n isDragging && styles.dragging,\n disabled && styles.disabled,\n className,\n )}\n onClick={openDialog}\n onKeyDown={handleKeyDown}\n onDragEnter={handleDragEnter}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n >\n <input\n ref={inputRef}\n type=\"file\"\n className={styles.input}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={(event) => {\n handleFiles(event.target.files);\n event.target.value = \"\";\n }}\n />\n {children ?? (\n <span className={styles.prompt}>\n Arraste arquivos aqui ou clique para selecionar\n </span>\n )}\n </div>\n );\n}\n"],"mappings":"+HAwCA,SAAgB,EAAS,CACrB,SACA,SAC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A,EAAA,IAAA,CAAC,QAAD,CACI,IAAK,EACL,KAAK,OACL,UAAW,EAAA,QAAO,MACV,SACE,WACA,WACV,SAAW,GAAU,CACjB,EAAY,EAAM,OAAO,KAAK,EAC9B,EAAM,OAAO,MAAQ,EACzB,CACH,CAAA,EACA,IACG,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAW,EAAA,QAAO,gBAAQ,iDAE1B,CAAA,CAET,GAEb"}
1
+ {"version":3,"file":"Dropzone.cjs","names":[],"sources":["../../../src/components/Dropzone/Dropzone.tsx"],"sourcesContent":["/**\n * @tempest-limits props-count, function-lines — accept, multiple and maxSize are\n * validation the component must apply before it can call onDrop or onReject, and\n * drag state, keyboard activation and the hidden input all live in the body because\n * they resolve to the same file list.\n */\nimport { useRef, useState } from \"react\";\nimport type { DragEvent, KeyboardEvent, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Dropzone.module.css\";\n\n/** Props for {@link Dropzone}. */\nexport interface DropzoneProps {\n /** Called with the accepted files after a drop or file-dialog selection. */\n onDrop: (files: File[]) => void;\n /** `accept` attribute forwarded to the hidden file input. */\n accept?: string;\n /** Allow selecting/dropping multiple files. Default `true`. */\n multiple?: boolean;\n /** Disable interaction. */\n disabled?: boolean;\n /** Maximum file size in bytes; larger files are filtered out. */\n maxSize?: number;\n /** Called with files rejected by `maxSize`. */\n onReject?: (files: File[]) => void;\n /** Custom inner content. Falls back to a default prompt. */\n children?: ReactNode;\n /** Extra class applied to the drop area. */\n className?: string;\n}\n\n/**\n * Drag-and-drop file area with a hidden file input. Clickable and keyboard\n * focusable; filters by `maxSize` before calling `onDrop`.\n *\n * @example\n * <Dropzone accept=\"image/*\" maxSize={5 * 1024 * 1024} onDrop={setFiles}>\n * Solte imagens aqui ou clique para selecionar\n * </Dropzone>\n */\nexport function Dropzone({\n onDrop,\n accept,\n multiple = true,\n disabled = false,\n maxSize,\n onReject,\n children,\n className,\n}: DropzoneProps) {\n const inputRef = useRef<HTMLInputElement>(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const handleFiles = (fileList: FileList | null): void => {\n if (!fileList || fileList.length === 0) return;\n const all = Array.from(fileList);\n const limited = multiple ? all : all.slice(0, 1);\n\n if (maxSize === undefined) {\n onDrop(limited);\n return;\n }\n\n const accepted: File[] = [];\n const rejected: File[] = [];\n for (const file of limited) {\n if (file.size > maxSize) rejected.push(file);\n else accepted.push(file);\n }\n if (rejected.length > 0) onReject?.(rejected);\n if (accepted.length > 0) onDrop(accepted);\n };\n\n const openDialog = (): void => {\n if (disabled) return;\n inputRef.current?.click();\n };\n\n const handleDragEnter = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n if (disabled) return;\n setIsDragging(true);\n };\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n };\n\n const handleDragLeave = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n setIsDragging(false);\n };\n\n const handleDrop = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n setIsDragging(false);\n if (disabled) return;\n handleFiles(event.dataTransfer.files);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n openDialog();\n }\n };\n\n return (\n <div\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n className={cn(\n styles.zone,\n isDragging && styles.dragging,\n disabled && styles.disabled,\n className,\n )}\n onClick={openDialog}\n onKeyDown={handleKeyDown}\n onDragEnter={handleDragEnter}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n >\n <input\n ref={inputRef}\n type=\"file\"\n className={styles.input}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={(event) => {\n handleFiles(event.target.files);\n event.target.value = \"\";\n }}\n />\n {children ?? (\n <span className={styles.prompt}>\n Arraste arquivos aqui ou clique para selecionar\n </span>\n )}\n </div>\n );\n}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EAAY,EAAM,aAAa,KAAK,CACxC,EAUI,SAAA,EAiBI,EAAA,EAAA,IAAA,CAAC,QAAD,CACI,IAAK,EACL,KAAK,OACL,UAAW,EAAA,QAAO,MACV,SACE,WACA,WACV,SAAW,GAAU,CACjB,EAAY,EAAM,OAAO,KAAK,EAC9B,EAAM,OAAO,MAAQ,EACzB,CACH,CAAA,EACA,IACG,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAW,EAAA,QAAO,OAAQ,SAAA,iDAE1B,CAAA,CAET,GAEb"}
@@ -1 +1 @@
1
- {"version":3,"file":"Dropzone.js","names":[],"sources":["../../../src/components/Dropzone/Dropzone.tsx"],"sourcesContent":["/**\n * @tempest-limits props-count, function-lines — accept, multiple and maxSize are\n * validation the component must apply before it can call onDrop or onReject, and\n * drag state, keyboard activation and the hidden input all live in the body because\n * they resolve to the same file list.\n */\nimport { useRef, useState } from \"react\";\nimport type { DragEvent, KeyboardEvent, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Dropzone.module.css\";\n\n/** Props for {@link Dropzone}. */\nexport interface DropzoneProps {\n /** Called with the accepted files after a drop or file-dialog selection. */\n onDrop: (files: File[]) => void;\n /** `accept` attribute forwarded to the hidden file input. */\n accept?: string;\n /** Allow selecting/dropping multiple files. Default `true`. */\n multiple?: boolean;\n /** Disable interaction. */\n disabled?: boolean;\n /** Maximum file size in bytes; larger files are filtered out. */\n maxSize?: number;\n /** Called with files rejected by `maxSize`. */\n onReject?: (files: File[]) => void;\n /** Custom inner content. Falls back to a default prompt. */\n children?: ReactNode;\n /** Extra class applied to the drop area. */\n className?: string;\n}\n\n/**\n * Drag-and-drop file area with a hidden file input. Clickable and keyboard\n * focusable; filters by `maxSize` before calling `onDrop`.\n *\n * @example\n * <Dropzone accept=\"image/*\" maxSize={5 * 1024 * 1024} onDrop={setFiles}>\n * Solte imagens aqui ou clique para selecionar\n * </Dropzone>\n */\nexport function Dropzone({\n onDrop,\n accept,\n multiple = true,\n disabled = false,\n maxSize,\n onReject,\n children,\n className,\n}: DropzoneProps) {\n const inputRef = useRef<HTMLInputElement>(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const handleFiles = (fileList: FileList | null): void => {\n if (!fileList || fileList.length === 0) return;\n const all = Array.from(fileList);\n const limited = multiple ? all : all.slice(0, 1);\n\n if (maxSize === undefined) {\n onDrop(limited);\n return;\n }\n\n const accepted: File[] = [];\n const rejected: File[] = [];\n for (const file of limited) {\n if (file.size > maxSize) rejected.push(file);\n else accepted.push(file);\n }\n if (rejected.length > 0) onReject?.(rejected);\n if (accepted.length > 0) onDrop(accepted);\n };\n\n const openDialog = (): void => {\n if (disabled) return;\n inputRef.current?.click();\n };\n\n const handleDragEnter = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n if (disabled) return;\n setIsDragging(true);\n };\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n };\n\n const handleDragLeave = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n setIsDragging(false);\n };\n\n const handleDrop = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n setIsDragging(false);\n if (disabled) return;\n handleFiles(event.dataTransfer.files);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n openDialog();\n }\n };\n\n return (\n <div\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n className={cn(\n styles.zone,\n isDragging && styles.dragging,\n disabled && styles.disabled,\n className,\n )}\n onClick={openDialog}\n onKeyDown={handleKeyDown}\n onDragEnter={handleDragEnter}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n >\n <input\n ref={inputRef}\n type=\"file\"\n className={styles.input}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={(event) => {\n handleFiles(event.target.files);\n event.target.value = \"\";\n }}\n />\n {children ??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,EAAK,GACf,MACJ,EAAY,EAAM,aAAa,KAAK;EACxC;YAUI,CAiBI,kBAAC,SAAD;GACI,KAAK;GACL,MAAK;GACL,WAAW,EAAO;GACV;GACE;GACA;GACV,WAAW,MAAU;IAEjB,AADA,EAAY,EAAM,OAAO,KAAK,GAC9B,EAAM,OAAO,QAAQ;GACzB;EACH,CAAA,GACA,KACG,kBAAC,QAAD;GAAM,WAAW,EAAO;aAAQ;EAE1B,CAAA,CAET;;AAEb"}
1
+ {"version":3,"file":"Dropzone.js","names":[],"sources":["../../../src/components/Dropzone/Dropzone.tsx"],"sourcesContent":["/**\n * @tempest-limits props-count, function-lines — accept, multiple and maxSize are\n * validation the component must apply before it can call onDrop or onReject, and\n * drag state, keyboard activation and the hidden input all live in the body because\n * they resolve to the same file list.\n */\nimport { useRef, useState } from \"react\";\nimport type { DragEvent, KeyboardEvent, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Dropzone.module.css\";\n\n/** Props for {@link Dropzone}. */\nexport interface DropzoneProps {\n /** Called with the accepted files after a drop or file-dialog selection. */\n onDrop: (files: File[]) => void;\n /** `accept` attribute forwarded to the hidden file input. */\n accept?: string;\n /** Allow selecting/dropping multiple files. Default `true`. */\n multiple?: boolean;\n /** Disable interaction. */\n disabled?: boolean;\n /** Maximum file size in bytes; larger files are filtered out. */\n maxSize?: number;\n /** Called with files rejected by `maxSize`. */\n onReject?: (files: File[]) => void;\n /** Custom inner content. Falls back to a default prompt. */\n children?: ReactNode;\n /** Extra class applied to the drop area. */\n className?: string;\n}\n\n/**\n * Drag-and-drop file area with a hidden file input. Clickable and keyboard\n * focusable; filters by `maxSize` before calling `onDrop`.\n *\n * @example\n * <Dropzone accept=\"image/*\" maxSize={5 * 1024 * 1024} onDrop={setFiles}>\n * Solte imagens aqui ou clique para selecionar\n * </Dropzone>\n */\nexport function Dropzone({\n onDrop,\n accept,\n multiple = true,\n disabled = false,\n maxSize,\n onReject,\n children,\n className,\n}: DropzoneProps) {\n const inputRef = useRef<HTMLInputElement>(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const handleFiles = (fileList: FileList | null): void => {\n if (!fileList || fileList.length === 0) return;\n const all = Array.from(fileList);\n const limited = multiple ? all : all.slice(0, 1);\n\n if (maxSize === undefined) {\n onDrop(limited);\n return;\n }\n\n const accepted: File[] = [];\n const rejected: File[] = [];\n for (const file of limited) {\n if (file.size > maxSize) rejected.push(file);\n else accepted.push(file);\n }\n if (rejected.length > 0) onReject?.(rejected);\n if (accepted.length > 0) onDrop(accepted);\n };\n\n const openDialog = (): void => {\n if (disabled) return;\n inputRef.current?.click();\n };\n\n const handleDragEnter = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n if (disabled) return;\n setIsDragging(true);\n };\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n };\n\n const handleDragLeave = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n setIsDragging(false);\n };\n\n const handleDrop = (event: DragEvent<HTMLDivElement>): void => {\n event.preventDefault();\n setIsDragging(false);\n if (disabled) return;\n handleFiles(event.dataTransfer.files);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n openDialog();\n }\n };\n\n return (\n <div\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n className={cn(\n styles.zone,\n isDragging && styles.dragging,\n disabled && styles.disabled,\n className,\n )}\n onClick={openDialog}\n onKeyDown={handleKeyDown}\n onDragEnter={handleDragEnter}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n >\n <input\n ref={inputRef}\n type=\"file\"\n className={styles.input}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={(event) => {\n handleFiles(event.target.files);\n event.target.value = \"\";\n }}\n />\n {children ?? (\n <span className={styles.prompt}>\n Arraste arquivos aqui ou clique para selecionar\n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;EAUI,UAAA,CAiBI,kBAAC,SAAD;GACI,KAAK;GACL,MAAK;GACL,WAAW,EAAO;GACV;GACE;GACA;GACV,WAAW,MAAU;IAEjB,AADA,EAAY,EAAM,OAAO,KAAK,GAC9B,EAAM,OAAO,QAAQ;GACzB;EACH,CAAA,GACA,KACG,kBAAC,QAAD;GAAM,WAAW,EAAO;GAAQ,UAAA;EAE1B,CAAA,CAET;;AAEb"}
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState.cjs","names":[],"sources":["../../../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./EmptyState.module.css\";\n\nexport interface EmptyStateProps {\n icon?: ReactNode;\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n className?: string;\n}\n\n/** Centered \"nothing here yet\" placeholder with optional icon and CTA. */\nexport function EmptyState({ icon, title, description, action, className }: EmptyStateProps) {\n return (\n <div className={cn(styles.wrapper, className)}>\n {icon && <div className={styles.icon}>{icon}</div>}\n <h4 className={styles.title}>{title}</h4>\n {description && <p className={styles.description}>{description}</p>}\n {action && <div className={styles.action}>{action}</div>}\n </div>\n );\n}\n"],"mappings":"8GAaA,SAAgB,EAAW,CAAE,OAAM,QAAO,cAAa,SAAQ,aAA8B,CACzF,OACI,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAW,EAAA,GAAG,EAAA,QAAO,QAAS,CAAS,WAA5C,CACK,IAAQ,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,QAAO,cAAO,CAAU,CAAA,GACjD,EAAA,EAAA,IAAA,CAAC,KAAD,CAAI,UAAW,EAAA,QAAO,eAAQ,CAAU,CAAA,EACvC,IAAe,EAAA,EAAA,IAAA,CAAC,IAAD,CAAG,UAAW,EAAA,QAAO,qBAAc,CAAe,CAAA,EACjE,IAAU,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,QAAO,gBAAS,CAAY,CAAA,CACtD,GAEb"}
1
+ {"version":3,"file":"EmptyState.cjs","names":[],"sources":["../../../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./EmptyState.module.css\";\n\nexport interface EmptyStateProps {\n icon?: ReactNode;\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n className?: string;\n}\n\n/** Centered \"nothing here yet\" placeholder with optional icon and CTA. */\nexport function EmptyState({ icon, title, description, action, className }: EmptyStateProps) {\n return (\n <div className={cn(styles.wrapper, className)}>\n {icon && <div className={styles.icon}>{icon}</div>}\n <h4 className={styles.title}>{title}</h4>\n {description && <p className={styles.description}>{description}</p>}\n {action && <div className={styles.action}>{action}</div>}\n </div>\n );\n}\n"],"mappings":"8GAaA,SAAgB,EAAW,CAAE,OAAM,QAAO,cAAa,SAAQ,aAA8B,CACzF,OACI,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAW,EAAA,GAAG,EAAA,QAAO,QAAS,CAAS,EAA5C,SAAA,CACK,IAAQ,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,QAAO,KAAO,SAAA,CAAU,CAAA,GACjD,EAAA,EAAA,IAAA,CAAC,KAAD,CAAI,UAAW,EAAA,QAAO,MAAQ,SAAA,CAAU,CAAA,EACvC,IAAe,EAAA,EAAA,IAAA,CAAC,IAAD,CAAG,UAAW,EAAA,QAAO,YAAc,SAAA,CAAe,CAAA,EACjE,IAAU,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,QAAO,OAAS,SAAA,CAAY,CAAA,CACtD,GAEb"}
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState.js","names":[],"sources":["../../../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./EmptyState.module.css\";\n\nexport interface EmptyStateProps {\n icon?: ReactNode;\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n className?: string;\n}\n\n/** Centered \"nothing here yet\" placeholder with optional icon and CTA. */\nexport function EmptyState({ icon, title, description, action, className }: EmptyStateProps) {\n return (\n <div className={cn(styles.wrapper, className)}>\n {icon && <div className={styles.icon}>{icon}</div>}\n <h4 className={styles.title}>{title}</h4>\n {description && <p className={styles.description}>{description}</p>}\n {action && <div className={styles.action}>{action}</div>}\n </div>\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,EAAW,EAAE,SAAM,UAAO,gBAAa,WAAQ,gBAA8B;CACzF,OACI,kBAAC,OAAD;EAAK,WAAW,EAAG,EAAO,SAAS,CAAS;YAA5C;GACK,KAAQ,kBAAC,OAAD;IAAK,WAAW,EAAO;cAAO;GAAU,CAAA;GACjD,kBAAC,MAAD;IAAI,WAAW,EAAO;cAAQ;GAAU,CAAA;GACvC,KAAe,kBAAC,KAAD;IAAG,WAAW,EAAO;cAAc;GAAe,CAAA;GACjE,KAAU,kBAAC,OAAD;IAAK,WAAW,EAAO;cAAS;GAAY,CAAA;EACtD;;AAEb"}
1
+ {"version":3,"file":"EmptyState.js","names":[],"sources":["../../../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./EmptyState.module.css\";\n\nexport interface EmptyStateProps {\n icon?: ReactNode;\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n className?: string;\n}\n\n/** Centered \"nothing here yet\" placeholder with optional icon and CTA. */\nexport function EmptyState({ icon, title, description, action, className }: EmptyStateProps) {\n return (\n <div className={cn(styles.wrapper, className)}>\n {icon && <div className={styles.icon}>{icon}</div>}\n <h4 className={styles.title}>{title}</h4>\n {description && <p className={styles.description}>{description}</p>}\n {action && <div className={styles.action}>{action}</div>}\n </div>\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,EAAW,EAAE,SAAM,UAAO,gBAAa,WAAQ,gBAA8B;CACzF,OACI,kBAAC,OAAD;EAAK,WAAW,EAAG,EAAO,SAAS,CAAS;EAA5C,UAAA;GACK,KAAQ,kBAAC,OAAD;IAAK,WAAW,EAAO;IAAO,UAAA;GAAU,CAAA;GACjD,kBAAC,MAAD;IAAI,WAAW,EAAO;IAAQ,UAAA;GAAU,CAAA;GACvC,KAAe,kBAAC,KAAD;IAAG,WAAW,EAAO;IAAc,UAAA;GAAe,CAAA;GACjE,KAAU,kBAAC,OAAD;IAAK,WAAW,EAAO;IAAS,UAAA;GAAY,CAAA;EACtD;;AAEb"}
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorState.cjs","names":[],"sources":["../../../src/components/ErrorState/ErrorState.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Button } from \"@/components/Button\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./ErrorState.module.css\";\n\nexport interface ErrorStateProps {\n title?: ReactNode;\n description?: ReactNode;\n onRetry?: () => void;\n retryLabel?: string;\n icon?: ReactNode;\n className?: string;\n}\n\n/** Error placeholder with optional retry CTA. Use when a request fails. */\nexport function ErrorState({\n title = \"Algo deu errado\",\n description = \"Não foi possível carregar essas informações.\",\n onRetry,\n retryLabel = \"Tentar novamente\",\n icon,\n className,\n}: ErrorStateProps) {\n return (\n <div className={cn(styles.wrapper, className)}>\n <div className={styles.icon}>{icon ?? <AlertIcon />}</div>\n <h4 className={styles.title}>{title}</h4>\n {description && <p className={styles.description}>{description}</p>}\n {onRetry && (\n <div className={styles.action}>\n <Button variant=\"secondary\" onClick={onRetry}>\n {retryLabel}\n </Button>\n </div>\n )}\n </div>\n );\n}\n\nfunction AlertIcon() {\n return (\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n"],"mappings":"gJAeA,SAAgB,EAAW,CACvB,QAAQ,kBACR,cAAc,+CACd,UACA,aAAa,mBACb,OACA,aACgB,CAChB,OACI,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAW,EAAA,GAAG,EAAA,QAAO,QAAS,CAAS,WAA5C,EACI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,QAAO,cAAO,IAAQ,EAAA,EAAA,IAAA,CAAC,EAAD,CAAY,CAAA,CAAO,CAAA,GACzD,EAAA,EAAA,IAAA,CAAC,KAAD,CAAI,UAAW,EAAA,QAAO,eAAQ,CAAU,CAAA,EACvC,IAAe,EAAA,EAAA,IAAA,CAAC,IAAD,CAAG,UAAW,EAAA,QAAO,qBAAc,CAAe,CAAA,EACjE,IACG,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,QAAO,iBACnB,EAAA,EAAA,IAAA,CAAC,EAAA,OAAD,CAAQ,QAAQ,YAAY,QAAS,WAChC,CACG,CAAA,CACP,CAAA,CAER,GAEb,CAEA,SAAS,GAAY,CACjB,OACI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,iBACjD,EAAA,EAAA,IAAA,CAAC,OAAD,CACI,EAAE,qGACF,OAAO,eACP,YAAY,IACZ,cAAc,QACd,eAAe,OAClB,CAAA,CACA,CAAA,CAEb"}
1
+ {"version":3,"file":"ErrorState.cjs","names":[],"sources":["../../../src/components/ErrorState/ErrorState.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Button } from \"@/components/Button\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./ErrorState.module.css\";\n\nexport interface ErrorStateProps {\n title?: ReactNode;\n description?: ReactNode;\n onRetry?: () => void;\n retryLabel?: string;\n icon?: ReactNode;\n className?: string;\n}\n\n/** Error placeholder with optional retry CTA. Use when a request fails. */\nexport function ErrorState({\n title = \"Algo deu errado\",\n description = \"Não foi possível carregar essas informações.\",\n onRetry,\n retryLabel = \"Tentar novamente\",\n icon,\n className,\n}: ErrorStateProps) {\n return (\n <div className={cn(styles.wrapper, className)}>\n <div className={styles.icon}>{icon ?? <AlertIcon />}</div>\n <h4 className={styles.title}>{title}</h4>\n {description && <p className={styles.description}>{description}</p>}\n {onRetry && (\n <div className={styles.action}>\n <Button variant=\"secondary\" onClick={onRetry}>\n {retryLabel}\n </Button>\n </div>\n )}\n </div>\n );\n}\n\nfunction AlertIcon() {\n return (\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n"],"mappings":"gJAeA,SAAgB,EAAW,CACvB,QAAQ,kBACR,cAAc,+CACd,UACA,aAAa,mBACb,OACA,aACgB,CAChB,OACI,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAW,EAAA,GAAG,EAAA,QAAO,QAAS,CAAS,EAA5C,SAAA,EACI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,QAAO,KAAO,SAAA,IAAQ,EAAA,EAAA,IAAA,CAAC,EAAD,CAAY,CAAA,CAAO,CAAA,GACzD,EAAA,EAAA,IAAA,CAAC,KAAD,CAAI,UAAW,EAAA,QAAO,MAAQ,SAAA,CAAU,CAAA,EACvC,IAAe,EAAA,EAAA,IAAA,CAAC,IAAD,CAAG,UAAW,EAAA,QAAO,YAAc,SAAA,CAAe,CAAA,EACjE,IACG,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,QAAO,OACnB,UAAA,EAAA,EAAA,IAAA,CAAC,EAAA,OAAD,CAAQ,QAAQ,YAAY,QAAS,EAChC,SAAA,CACG,CAAA,CACP,CAAA,CAER,GAEb,CAEA,SAAS,GAAY,CACjB,OACI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACjD,UAAA,EAAA,EAAA,IAAA,CAAC,OAAD,CACI,EAAE,qGACF,OAAO,eACP,YAAY,IACZ,cAAc,QACd,eAAe,OAClB,CAAA,CACA,CAAA,CAEb"}
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorState.js","names":[],"sources":["../../../src/components/ErrorState/ErrorState.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Button } from \"@/components/Button\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./ErrorState.module.css\";\n\nexport interface ErrorStateProps {\n title?: ReactNode;\n description?: ReactNode;\n onRetry?: () => void;\n retryLabel?: string;\n icon?: ReactNode;\n className?: string;\n}\n\n/** Error placeholder with optional retry CTA. Use when a request fails. */\nexport function ErrorState({\n title = \"Algo deu errado\",\n description = \"Não foi possível carregar essas informações.\",\n onRetry,\n retryLabel = \"Tentar novamente\",\n icon,\n className,\n}: ErrorStateProps) {\n return (\n <div className={cn(styles.wrapper, className)}>\n <div className={styles.icon}>{icon ?? <AlertIcon />}</div>\n <h4 className={styles.title}>{title}</h4>\n {description && <p className={styles.description}>{description}</p>}\n {onRetry && (\n <div className={styles.action}>\n <Button variant=\"secondary\" onClick={onRetry}>\n {retryLabel}\n </Button>\n </div>\n )}\n </div>\n );\n}\n\nfunction AlertIcon() {\n return (\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n"],"mappings":";;;;;AAeA,SAAgB,EAAW,EACvB,WAAQ,mBACR,iBAAc,gDACd,YACA,gBAAa,oBACb,SACA,gBACgB;CAChB,OACI,kBAAC,OAAD;EAAK,WAAW,EAAG,EAAO,SAAS,CAAS;YAA5C;GACI,kBAAC,OAAD;IAAK,WAAW,EAAO;cAAO,KAAQ,kBAAC,GAAD,CAAY,CAAA;GAAO,CAAA;GACzD,kBAAC,MAAD;IAAI,WAAW,EAAO;cAAQ;GAAU,CAAA;GACvC,KAAe,kBAAC,KAAD;IAAG,WAAW,EAAO;cAAc;GAAe,CAAA;GACjE,KACG,kBAAC,OAAD;IAAK,WAAW,EAAO;cACnB,kBAAC,GAAD;KAAQ,SAAQ;KAAY,SAAS;eAChC;IACG,CAAA;GACP,CAAA;EAER;;AAEb;AAEA,SAAS,IAAY;CACjB,OACI,kBAAC,OAAD;EAAK,OAAM;EAAK,QAAO;EAAK,SAAQ;EAAY,MAAK;YACjD,kBAAC,QAAD;GACI,GAAE;GACF,QAAO;GACP,aAAY;GACZ,eAAc;GACd,gBAAe;EAClB,CAAA;CACA,CAAA;AAEb"}
1
+ {"version":3,"file":"ErrorState.js","names":[],"sources":["../../../src/components/ErrorState/ErrorState.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Button } from \"@/components/Button\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./ErrorState.module.css\";\n\nexport interface ErrorStateProps {\n title?: ReactNode;\n description?: ReactNode;\n onRetry?: () => void;\n retryLabel?: string;\n icon?: ReactNode;\n className?: string;\n}\n\n/** Error placeholder with optional retry CTA. Use when a request fails. */\nexport function ErrorState({\n title = \"Algo deu errado\",\n description = \"Não foi possível carregar essas informações.\",\n onRetry,\n retryLabel = \"Tentar novamente\",\n icon,\n className,\n}: ErrorStateProps) {\n return (\n <div className={cn(styles.wrapper, className)}>\n <div className={styles.icon}>{icon ?? <AlertIcon />}</div>\n <h4 className={styles.title}>{title}</h4>\n {description && <p className={styles.description}>{description}</p>}\n {onRetry && (\n <div className={styles.action}>\n <Button variant=\"secondary\" onClick={onRetry}>\n {retryLabel}\n </Button>\n </div>\n )}\n </div>\n );\n}\n\nfunction AlertIcon() {\n return (\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n"],"mappings":";;;;;AAeA,SAAgB,EAAW,EACvB,WAAQ,mBACR,iBAAc,gDACd,YACA,gBAAa,oBACb,SACA,gBACgB;CAChB,OACI,kBAAC,OAAD;EAAK,WAAW,EAAG,EAAO,SAAS,CAAS;EAA5C,UAAA;GACI,kBAAC,OAAD;IAAK,WAAW,EAAO;IAAO,UAAA,KAAQ,kBAAC,GAAD,CAAY,CAAA;GAAO,CAAA;GACzD,kBAAC,MAAD;IAAI,WAAW,EAAO;IAAQ,UAAA;GAAU,CAAA;GACvC,KAAe,kBAAC,KAAD;IAAG,WAAW,EAAO;IAAc,UAAA;GAAe,CAAA;GACjE,KACG,kBAAC,OAAD;IAAK,WAAW,EAAO;IACnB,UAAA,kBAAC,GAAD;KAAQ,SAAQ;KAAY,SAAS;KAChC,UAAA;IACG,CAAA;GACP,CAAA;EAER;;AAEb;AAEA,SAAS,IAAY;CACjB,OACI,kBAAC,OAAD;EAAK,OAAM;EAAK,QAAO;EAAK,SAAQ;EAAY,MAAK;EACjD,UAAA,kBAAC,QAAD;GACI,GAAE;GACF,QAAO;GACP,aAAY;GACZ,eAAc;GACd,gBAAe;EAClB,CAAA;CACA,CAAA;AAEb"}
@@ -1,2 +1,2 @@
1
- const e=require("../../utils/cn.cjs"),t=require("./FileUpload.module.cjs");let n=require("react"),r=require("react/jsx-runtime");function i(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function a(e,t){if(!t)return!0;let n=t.split(`,`).map(e=>e.trim().toLowerCase()),r=e.name.toLowerCase(),i=e.type.toLowerCase();return n.some(e=>e.startsWith(`.`)?r.endsWith(e):e.endsWith(`/*`)?i.startsWith(e.replace(`/*`,`/`)):i===e)}function o({value:o,onChange:c,label:l,accept:u,multiple:d=!1,maxSize:f,onReject:p,disabled:m,title:h=`Arraste arquivos aqui ou clique para selecionar`,subtitle:g,className:_}){let[v,y]=(0,n.useState)(!1),b=(0,n.useRef)(null);function x(e){let t=[],n=[];for(let r of Array.from(e)){if(!a(r,u)){n.push({file:r,reason:`type`});continue}if(f&&r.size>f){n.push({file:r,reason:`size`});continue}t.push(r)}n.length>0&&p?.(n),t.length!==0&&c(d?[...o,...t]:t.slice(0,1))}function S(e){e.preventDefault(),y(!1),!m&&e.dataTransfer?.files&&x(e.dataTransfer.files)}function C(e){let t=o.slice();t.splice(e,1),c(t)}return(0,r.jsxs)(`div`,{className:e.cn(t.default.wrapper,_),children:[l&&(0,r.jsx)(`label`,{className:t.default.label,children:l}),(0,r.jsxs)(`div`,{className:e.cn(t.default.dropzone,v&&t.default.active,m&&t.default.disabled),role:`button`,tabIndex:m?-1:0,onClick:()=>!m&&b.current?.click(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b.current?.click())},onDragEnter:e=>{e.preventDefault(),m||y(!0)},onDragOver:e=>e.preventDefault(),onDragLeave:()=>y(!1),onDrop:S,children:[(0,r.jsx)(`div`,{className:t.default.icon,"aria-hidden":!0,children:(0,r.jsx)(s,{})}),(0,r.jsx)(`p`,{className:t.default.title,children:h}),g&&(0,r.jsx)(`p`,{className:t.default.subtitle,children:g}),(0,r.jsx)(`input`,{ref:b,type:`file`,accept:u,multiple:d,disabled:m,className:t.default.hidden,onChange:e=>{e.target.files&&x(e.target.files),e.target.value=``}})]}),o.length>0&&(0,r.jsx)(`ul`,{className:t.default.files,children:o.map((e,n)=>(0,r.jsxs)(`li`,{className:t.default.file,children:[(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`div`,{children:e.name}),(0,r.jsx)(`div`,{className:t.default.fileMeta,children:i(e.size)})]}),(0,r.jsx)(`button`,{type:`button`,"aria-label":`Remover ${e.name}`,className:t.default.remove,onClick:()=>C(n),children:`×`})]},`${e.name}-${n}`))})]})}function s(){return(0,r.jsx)(`svg`,{width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,children:(0,r.jsx)(`path`,{d:`M12 16V4m0 0l-4 4m4-4l4 4M4 20h16`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})}exports.FileUpload=o;
1
+ const e=require("../../utils/cn.cjs"),t=require("./FileUpload.module.cjs");let n=require("react"),r=require("react/jsx-runtime");function i(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function a(e,t){if(!t)return!0;let n=t.split(`,`).map(e=>e.trim().toLowerCase()),r=e.name.toLowerCase(),i=e.type.toLowerCase();return n.some(e=>e.startsWith(`.`)?r.endsWith(e):e.endsWith(`/*`)?i.startsWith(e.replace(`/*`,`/`)):i===e)}function o({value:o,onChange:c,label:l,accept:u,multiple:d=!1,maxSize:f,onReject:p,disabled:m,title:h=`Arraste arquivos aqui ou clique para selecionar`,subtitle:g,className:_}){let[v,y]=(0,n.useState)(!1),b=(0,n.useRef)(null);function x(e){let t=[],n=[];for(let r of Array.from(e)){if(!a(r,u)){n.push({file:r,reason:`type`});continue}if(f&&r.size>f){n.push({file:r,reason:`size`});continue}t.push(r)}n.length>0&&p?.(n),t.length!==0&&c(d?[...o,...t]:t.slice(0,1))}function S(e){e.preventDefault(),y(!1),!m&&e.dataTransfer?.files&&x(e.dataTransfer.files)}function C(e){let t=o.slice();t.splice(e,1),c(t)}return(0,r.jsxs)(`div`,{className:e.cn(t.default.wrapper,_),children:[l&&(0,r.jsx)(`label`,{className:t.default.label,children:l}),(0,r.jsxs)(`div`,{className:e.cn(t.default.dropzone,v&&t.default.active,m&&t.default.disabled),role:`button`,tabIndex:m?-1:0,onClick:()=>!m&&b.current?.click(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b.current?.click())},onDragEnter:e=>{e.preventDefault(),m||y(!0)},onDragOver:e=>e.preventDefault(),onDragLeave:()=>y(!1),onDrop:S,children:[(0,r.jsx)(`div`,{className:t.default.icon,"aria-hidden":!0,children:(0,r.jsx)(s,{})}),(0,r.jsx)(`p`,{className:t.default.title,children:h}),g&&(0,r.jsx)(`p`,{className:t.default.subtitle,children:g}),(0,r.jsx)(`input`,{ref:b,type:`file`,accept:u,multiple:d,disabled:m,className:t.default.hidden,onChange:e=>{e.target.files&&x(e.target.files),e.target.value=``}})]}),o.length>0&&(0,r.jsx)(`ul`,{className:t.default.files,children:o.map((e,n)=>(0,r.jsxs)(`li`,{className:t.default.file,children:[(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`div`,{children:e.name}),(0,r.jsx)(`div`,{className:t.default.fileMeta,children:i(e.size)})]}),(0,r.jsx)(`button`,{type:`button`,"aria-label":`Remover ${e.name}`,className:t.default.remove,onClick:()=>C(n),children:`×`})]},`${e.name}-${n}`))})]})}function s(){return(0,r.jsx)(`svg`,{width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,children:(0,r.jsx)(`path`,{d:`M12 16V4m0 0l-4 4m4-4l4 4M4 20h16`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})}exports.FileUpload=o;
2
2
  //# sourceMappingURL=FileUpload.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileUpload.cjs","names":[],"sources":["../../../src/components/FileUpload/FileUpload.tsx"],"sourcesContent":["/**\n * @tempest-limits file-lines, props-count, function-lines — the picker (accept,\n * multiple, maxSize, onReject) and the list of chosen files (value, onChange,\n * disabled) are one control, and title/subtitle/label exist because the empty state\n * is the biggest part of the surface.\n */\nimport { useRef, useState } from \"react\";\nimport type { DragEvent } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./FileUpload.module.css\";\n\nexport interface FileUploadProps {\n /** Files currently in the dropzone (controlled). */\n value: File[];\n /** Called with the new list when the user adds or removes a file. */\n onChange: (files: File[]) => void;\n label?: string;\n /** Accept attribute forwarded to `<input>`. */\n accept?: string;\n /** Allow multiple files. Default: false. */\n multiple?: boolean;\n /** Max file size in bytes. Files above are rejected via `onReject`. */\n maxSize?: number;\n /** Called with rejected files when they exceed `maxSize` or fail the `accept` filter. */\n onReject?: (rejected: { file: File; reason: \"size\" | \"type\" }[]) => void;\n disabled?: boolean;\n /** Title shown on the empty dropzone. */\n title?: string;\n /** Helper line below the title. */\n subtitle?: string;\n className?: string;\n}\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / 1024 / 1024).toFixed(1)} MB`;\n}\n\nfunction matchesAccept(file: File, accept?: string): boolean {\n if (!accept) return true;\n const tokens = accept.split(\",\").map((t) => t.trim().toLowerCase());\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return tokens.some((token) => {\n if (token.startsWith(\".\")) return name.endsWith(token);\n if (token.endsWith(\"/*\")) return type.startsWith(token.replace(\"/*\", \"/\"));\n return type === token;\n });\n}\n\n/**\n * Drag-and-drop file dropzone. Pair with `uploadWithProgress` from the SDK\n * to wire actual uploads with byte-level progress.\n */\nexport function FileUpload({\n value,\n onChange,\n label,\n accept,\n multiple = false,\n maxSize,\n onReject,\n disabled,\n title = \"Arraste arquivos aqui ou clique para selecionar\",\n subtitle,\n className,\n}: FileUploadProps) {\n const [dragging, setDragging] = useState<boolean>(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n function addFiles(incoming: FileList | File[]): void {\n const accepted: File[] = [];\n const rejected: { file: File; reason: \"size\" | \"type\" }[] = [];\n\n for (const file of Array.from(incoming)) {\n if (!matchesAccept(file, accept)) {\n rejected.push({ file, reason: \"type\" });\n continue;\n }\n if (maxSize && file.size > maxSize) {\n rejected.push({ file, reason: \"size\" });\n continue;\n }\n accepted.push(file);\n }\n\n if (rejected.length > 0) onReject?.(rejected);\n if (accepted.length === 0) return;\n\n const next = multiple ? [...value, ...accepted] : accepted.slice(0, 1);\n onChange(next);\n }\n\n function handleDrop(event: DragEvent<HTMLDivElement>): void {\n event.preventDefault();\n setDragging(false);\n if (disabled) return;\n if (event.dataTransfer?.files) addFiles(event.dataTransfer.files);\n }\n\n function remove(index: number): void {\n const next = value.slice();\n next.splice(index, 1);\n onChange(next);\n }\n\n return (\n <div className={cn(styles.wrapper, className)}>\n {label && <label className={styles.label}>{label}</label>}\n <div\n className={cn(\n styles.dropzone,\n dragging && styles.active,\n disabled && styles.disabled,\n )}\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n onClick={() => !disabled && inputRef.current?.click()}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n inputRef.current?.click();\n }\n }}\n onDragEnter={(event) => {\n event.preventDefault();\n if (!disabled) setDragging(true);\n }}\n onDragOver={(event) => event.preventDefault()}\n onDragLeave={() => setDragging(false)}\n onDrop={handleDrop}\n >\n <div className={styles.icon} aria-hidden>\n <UploadIcon />\n </div>\n <p className={styles.title}>{title}</p>\n {subtitle && <p className={styles.subtitle}>{subtitle}</p>}\n <input\n ref={inputRef}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n className={styles.hidden}\n onChange={(event) => {\n if (event.target.files) addFiles(event.target.files);\n event.target.value = \"\";\n }}\n />\n </div>\n\n {value.length > 0 && (\n <ul className={styles.files}>\n {value.map((file, index) => (\n <li key={`${file.name}-${index}`} className={styles.file}>\n <div>\n <div>{file.name}</div>\n <div className={styles.fileMeta}>{formatSize(file.size)}</div>\n </div>\n <button\n type=\"button\"\n aria-label={`Remover ${file.name}`}\n className={styles.remove}\n onClick={() => remove(index)}\n >\n ×\n </button>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\nfunction UploadIcon() {\n return (\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M12 16V4m0 0l-4 4m4-4l4 4M4 20h16\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n"],"mappings":"iIAiCA,SAAS,EAAW,EAAuB,CAGvC,OAFI,EAAQ,KAAa,GAAG,EAAM,IAC9B,EAAQ,KAAO,KAAa,IAAI,EAAQ,KAAA,CAAM,QAAQ,CAAC,EAAE,KACtD,IAAI,EAAQ,KAAO,KAAA,CAAM,QAAQ,CAAC,EAAE,IAC/C,CAEA,SAAS,EAAc,EAAY,EAA0B,CACzD,GAAI,CAAC,EAAQ,MAAO,GACpB,IAAM,EAAS,EAAO,MAAM,GAAG,CAAC,CAAC,IAAK,GAAM,EAAE,KAAK,CAAC,CAAC,YAAY,CAAC,EAC5D,EAAO,EAAK,KAAK,YAAY,EAC7B,EAAO,EAAK,KAAK,YAAY,EACnC,OAAO,EAAO,KAAM,GACZ,EAAM,WAAW,GAAG,EAAU,EAAK,SAAS,CAAK,EACjD,EAAM,SAAS,IAAI,EAAU,EAAK,WAAW,EAAM,QAAQ,KAAM,GAAG,CAAC,EAClE,IAAS,CACnB,CACL,CAMA,SAAgB,EAAW,CACvB,QACA,WACA,QACA,SACA,WAAW,GACX,UACA,WACA,WACA,QAAQ,kDACR,WACA,aACgB,CAChB,GAAM,CAAC,EAAU,IAAA,EAAA,EAAA,SAAA,CAAiC,EAAK,EACjD,GAAA,EAAA,EAAA,OAAA,CAAoC,IAAI,EAE9C,SAAS,EAAS,EAAmC,CACjD,IAAM,EAAmB,CAAC,EACpB,EAAsD,CAAC,EAE7D,IAAK,IAAM,KAAQ,MAAM,KAAK,CAAQ,EAAG,CACrC,GAAI,CA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,OAAD,CACI,EAAE,oCACF,OAAO,eACP,YAAY,IACZ,cAAc,QACd,eAAe,OAClB,CAAA,CACA,CAAA,CAEb"}
1
+ {"version":3,"file":"FileUpload.cjs","names":[],"sources":["../../../src/components/FileUpload/FileUpload.tsx"],"sourcesContent":["/**\n * @tempest-limits file-lines, props-count, function-lines — the picker (accept,\n * multiple, maxSize, onReject) and the list of chosen files (value, onChange,\n * disabled) are one control, and title/subtitle/label exist because the empty state\n * is the biggest part of the surface.\n */\nimport { useRef, useState } from \"react\";\nimport type { DragEvent } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./FileUpload.module.css\";\n\nexport interface FileUploadProps {\n /** Files currently in the dropzone (controlled). */\n value: File[];\n /** Called with the new list when the user adds or removes a file. */\n onChange: (files: File[]) => void;\n label?: string;\n /** Accept attribute forwarded to `<input>`. */\n accept?: string;\n /** Allow multiple files. Default: false. */\n multiple?: boolean;\n /** Max file size in bytes. Files above are rejected via `onReject`. */\n maxSize?: number;\n /** Called with rejected files when they exceed `maxSize` or fail the `accept` filter. */\n onReject?: (rejected: { file: File; reason: \"size\" | \"type\" }[]) => void;\n disabled?: boolean;\n /** Title shown on the empty dropzone. */\n title?: string;\n /** Helper line below the title. */\n subtitle?: string;\n className?: string;\n}\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / 1024 / 1024).toFixed(1)} MB`;\n}\n\nfunction matchesAccept(file: File, accept?: string): boolean {\n if (!accept) return true;\n const tokens = accept.split(\",\").map((t) => t.trim().toLowerCase());\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return tokens.some((token) => {\n if (token.startsWith(\".\")) return name.endsWith(token);\n if (token.endsWith(\"/*\")) return type.startsWith(token.replace(\"/*\", \"/\"));\n return type === token;\n });\n}\n\n/**\n * Drag-and-drop file dropzone. Pair with `uploadWithProgress` from the SDK\n * to wire actual uploads with byte-level progress.\n */\nexport function FileUpload({\n value,\n onChange,\n label,\n accept,\n multiple = false,\n maxSize,\n onReject,\n disabled,\n title = \"Arraste arquivos aqui ou clique para selecionar\",\n subtitle,\n className,\n}: FileUploadProps) {\n const [dragging, setDragging] = useState<boolean>(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n function addFiles(incoming: FileList | File[]): void {\n const accepted: File[] = [];\n const rejected: { file: File; reason: \"size\" | \"type\" }[] = [];\n\n for (const file of Array.from(incoming)) {\n if (!matchesAccept(file, accept)) {\n rejected.push({ file, reason: \"type\" });\n continue;\n }\n if (maxSize && file.size > maxSize) {\n rejected.push({ file, reason: \"size\" });\n continue;\n }\n accepted.push(file);\n }\n\n if (rejected.length > 0) onReject?.(rejected);\n if (accepted.length === 0) return;\n\n const next = multiple ? [...value, ...accepted] : accepted.slice(0, 1);\n onChange(next);\n }\n\n function handleDrop(event: DragEvent<HTMLDivElement>): void {\n event.preventDefault();\n setDragging(false);\n if (disabled) return;\n if (event.dataTransfer?.files) addFiles(event.dataTransfer.files);\n }\n\n function remove(index: number): void {\n const next = value.slice();\n next.splice(index, 1);\n onChange(next);\n }\n\n return (\n <div className={cn(styles.wrapper, className)}>\n {label && <label className={styles.label}>{label}</label>}\n <div\n className={cn(\n styles.dropzone,\n dragging && styles.active,\n disabled && styles.disabled,\n )}\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n onClick={() => !disabled && inputRef.current?.click()}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n inputRef.current?.click();\n }\n }}\n onDragEnter={(event) => {\n event.preventDefault();\n if (!disabled) setDragging(true);\n }}\n onDragOver={(event) => event.preventDefault()}\n onDragLeave={() => setDragging(false)}\n onDrop={handleDrop}\n >\n <div className={styles.icon} aria-hidden>\n <UploadIcon />\n </div>\n <p className={styles.title}>{title}</p>\n {subtitle && <p className={styles.subtitle}>{subtitle}</p>}\n <input\n ref={inputRef}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n className={styles.hidden}\n onChange={(event) => {\n if (event.target.files) addFiles(event.target.files);\n event.target.value = \"\";\n }}\n />\n </div>\n\n {value.length > 0 && (\n <ul className={styles.files}>\n {value.map((file, index) => (\n <li key={`${file.name}-${index}`} className={styles.file}>\n <div>\n <div>{file.name}</div>\n <div className={styles.fileMeta}>{formatSize(file.size)}</div>\n </div>\n <button\n type=\"button\"\n aria-label={`Remover ${file.name}`}\n className={styles.remove}\n onClick={() => remove(index)}\n >\n ×\n </button>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\nfunction UploadIcon() {\n return (\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M12 16V4m0 0l-4 4m4-4l4 4M4 20h16\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n"],"mappings":"iIAiCA,SAAS,EAAW,EAAuB,CAGvC,OAFI,EAAQ,KAAa,GAAG,EAAM,IAC9B,EAAQ,QAAoB,IAAI,EAAQ,KAAA,CAAM,QAAQ,CAAC,EAAE,KACtD,IAAI,EAAQ,KAAO,KAAA,CAAM,QAAQ,CAAC,EAAE,IAC/C,CAEA,SAAS,EAAc,EAAY,EAA0B,CACzD,GAAI,CAAC,EAAQ,MAAO,GACpB,IAAM,EAAS,EAAO,MAAM,GAAG,CAAC,CAAC,IAAK,GAAM,EAAE,KAAK,CAAC,CAAC,YAAY,CAAC,EAC5D,EAAO,EAAK,KAAK,YAAY,EAC7B,EAAO,EAAK,KAAK,YAAY,EACnC,OAAO,EAAO,KAAM,GACZ,EAAM,WAAW,GAAG,EAAU,EAAK,SAAS,CAAK,EACjD,EAAM,SAAS,IAAI,EAAU,EAAK,WAAW,EAAM,QAAQ,KAAM,GAAG,CAAC,EAClE,IAAS,CACnB,CACL,CAMA,SAAgB,EAAW,CACvB,QACA,WACA,QACA,SACA,WAAW,G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A,EAAA,IAAA,CAAC,SAAD,CACI,KAAK,SACL,aAAY,WAAW,EAAK,OAC5B,UAAW,EAAA,QAAO,OAClB,YAAe,EAAO,CAAK,EAC9B,SAAA,GAEO,CAAA,CACR,CAbK,EAAA,GAAG,EAAK,KAAK,GAAG,GAarB,CACP,CACD,CAAA,CAEP,GAEb,CAEA,SAAS,GAAa,CAClB,OACI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACjD,UAAA,EAAA,EAAA,IAAA,CAAC,OAAD,CACI,EAAE,oCACF,OAAO,eACP,YAAY,IACZ,cAAc,QACd,eAAe,OAClB,CAAA,CACA,CAAA,CAEb"}
@@ -4,7 +4,7 @@ import { useRef as n, useState as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  //#region src/components/FileUpload/FileUpload.tsx
6
6
  function o(e) {
7
- return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
7
+ return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
8
8
  }
9
9
  function s(e, t) {
10
10
  if (!t) return !0;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUpload.js","names":[],"sources":["../../../src/components/FileUpload/FileUpload.tsx"],"sourcesContent":["/**\n * @tempest-limits file-lines, props-count, function-lines — the picker (accept,\n * multiple, maxSize, onReject) and the list of chosen files (value, onChange,\n * disabled) are one control, and title/subtitle/label exist because the empty state\n * is the biggest part of the surface.\n */\nimport { useRef, useState } from \"react\";\nimport type { DragEvent } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./FileUpload.module.css\";\n\nexport interface FileUploadProps {\n /** Files currently in the dropzone (controlled). */\n value: File[];\n /** Called with the new list when the user adds or removes a file. */\n onChange: (files: File[]) => void;\n label?: string;\n /** Accept attribute forwarded to `<input>`. */\n accept?: string;\n /** Allow multiple files. Default: false. */\n multiple?: boolean;\n /** Max file size in bytes. Files above are rejected via `onReject`. */\n maxSize?: number;\n /** Called with rejected files when they exceed `maxSize` or fail the `accept` filter. */\n onReject?: (rejected: { file: File; reason: \"size\" | \"type\" }[]) => void;\n disabled?: boolean;\n /** Title shown on the empty dropzone. */\n title?: string;\n /** Helper line below the title. */\n subtitle?: string;\n className?: string;\n}\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / 1024 / 1024).toFixed(1)} MB`;\n}\n\nfunction matchesAccept(file: File, accept?: string): boolean {\n if (!accept) return true;\n const tokens = accept.split(\",\").map((t) => t.trim().toLowerCase());\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return tokens.some((token) => {\n if (token.startsWith(\".\")) return name.endsWith(token);\n if (token.endsWith(\"/*\")) return type.startsWith(token.replace(\"/*\", \"/\"));\n return type === token;\n });\n}\n\n/**\n * Drag-and-drop file dropzone. Pair with `uploadWithProgress` from the SDK\n * to wire actual uploads with byte-level progress.\n */\nexport function FileUpload({\n value,\n onChange,\n label,\n accept,\n multiple = false,\n maxSize,\n onReject,\n disabled,\n title = \"Arraste arquivos aqui ou clique para selecionar\",\n subtitle,\n className,\n}: FileUploadProps) {\n const [dragging, setDragging] = useState<boolean>(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n function addFiles(incoming: FileList | File[]): void {\n const accepted: File[] = [];\n const rejected: { file: File; reason: \"size\" | \"type\" }[] = [];\n\n for (const file of Array.from(incoming)) {\n if (!matchesAccept(file, accept)) {\n rejected.push({ file, reason: \"type\" });\n continue;\n }\n if (maxSize && file.size > maxSize) {\n rejected.push({ file, reason: \"size\" });\n continue;\n }\n accepted.push(file);\n }\n\n if (rejected.length > 0) onReject?.(rejected);\n if (accepted.length === 0) return;\n\n const next = multiple ? [...value, ...accepted] : accepted.slice(0, 1);\n onChange(next);\n }\n\n function handleDrop(event: DragEvent<HTMLDivElement>): void {\n event.preventDefault();\n setDragging(false);\n if (disabled) return;\n if (event.dataTransfer?.files) addFiles(event.dataTransfer.files);\n }\n\n function remove(index: number): void {\n const next = value.slice();\n next.splice(index, 1);\n onChange(next);\n }\n\n return (\n <div className={cn(styles.wrapper, className)}>\n {label && <label className={styles.label}>{label}</label>}\n <div\n className={cn(\n styles.dropzone,\n dragging && styles.active,\n disabled && styles.disabled,\n )}\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n onClick={() => !disabled && inputRef.current?.click()}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n inputRef.current?.click();\n }\n }}\n onDragEnter={(event) => {\n event.preventDefault();\n if (!disabled) setDragging(true);\n }}\n onDragOver={(event) => event.preventDefault()}\n onDragLeave={() => setDragging(false)}\n onDrop={handleDrop}\n >\n <div className={styles.icon} aria-hidden>\n <UploadIcon />\n </div>\n <p className={styles.title}>{title}</p>\n {subtitle && <p className={styles.subtitle}>{subtitle}</p>}\n <input\n ref={inputRef}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n className={styles.hidden}\n onChange={(event) => {\n if (event.target.files) addFiles(event.target.files);\n event.target.value = \"\";\n }}\n />\n </div>\n\n {value.length > 0 && (\n <ul className={styles.files}>\n {value.map((file, index) => (\n <li key={`${file.name}-${index}`} className={styles.file}>\n <div>\n <div>{file.name}</div>\n <div className={styles.fileMeta}>{formatSize(file.size)}</div>\n </div>\n <button\n type=\"button\"\n aria-label={`Remover ${file.name}`}\n className={styles.remove}\n onClick={() => remove(index)}\n >\n ×\n </button>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\nfunction UploadIcon() {\n return (\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M12 16V4m0 0l-4 4m4-4l4 4M4 20h16\"\n stroke=\"currentColor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O,EAAS,EAAM,OAAO,KAAK,GACnD,EAAM,OAAO,QAAQ;MACzB;KACH,CAAA;IACA;;GAEJ,EAAM,SAAS,KACZ,kBAAC,MAAD;IAAI,WAAW,EAAO;cACjB,EAAM,KAAK,GAAM,MACd,kBAAC,MAAD;KAAkC,WAAW,EAAO;eAApD,CACI,kBAAC,OAAD,EAAA,UAAA,CACI,kBAAC,OAAD,EAAA,UAAM,EAAK,KAAU,CAAA,GACrB,kBAAC,OAAD;MAAK,WAAW,EAAO;gBAAW,EAAW,EAAK,IAAI;KAAO,CAAA,CAC5D,EAAA,CAAA,GACL,kBAAC,UAAD;MACI,MAAK;MACL,cAAY,WAAW,EAAK;MAC5B,WAAW,EAAO;MAClB,eAAe,EAAO,CAAK;gBAC9B;KAEO,CAAA,CACR;OAbK,GAAG,EAAK,KAAK,GAAG,GAarB,CACP;GACD,CAAA;EAEP;;AAEb;AAEA,SAAS,IAAa;CAClB,OACI,kBAAC,OAAD;EAAK,OAAM;EAAK,QAAO;EAAK,SAAQ;EAAY,MAAK;YACjD,kBAAC,QAAD;GACI,GAAE;GACF,QAAO;GACP,aAAY;GACZ,eAAc;GACd,gBAAe;EAClB,CAAA;CACA,CAAA;AAEb"}
1
+ {"version":3,"file":"FileUpload.js","names":[],"sources":["../../../src/components/FileUpload/FileUpload.tsx"],"sourcesContent":["/**\n * @tempest-limits file-lines, props-count, function-lines — the picker (accept,\n * multiple, maxSize, onReject) and the list of chosen files (value, onChange,\n * disabled) are one control, and title/subtitle/label exist because the empty state\n * is the biggest part of the surface.\n */\nimport { useRef, useState } from \"react\";\nimport type { DragEvent } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./FileUpload.module.css\";\n\nexport interface FileUploadProps {\n /** Files currently in the dropzone (controlled). */\n value: File[];\n /** Called with the new list when the user adds or removes a file. */\n onChange: (files: File[]) => void;\n label?: string;\n /** Accept attribute forwarded to `<input>`. */\n accept?: string;\n /** Allow multiple files. Default: false. */\n multiple?: boolean;\n /** Max file size in bytes. Files above are rejected via `onReject`. */\n maxSize?: number;\n /** Called with rejected files when they exceed `maxSize` or fail the `accept` filter. */\n onReject?: (rejected: { file: File; reason: \"size\" | \"type\" }[]) => void;\n disabled?: boolean;\n /** Title shown on the empty dropzone. */\n title?: string;\n /** Helper line below the title. */\n subtitle?: string;\n className?: string;\n}\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / 1024 / 1024).toFixed(1)} MB`;\n}\n\nfunction matchesAccept(file: File, accept?: string): boolean {\n if (!accept) return true;\n const tokens = accept.split(\",\").map((t) => t.trim().toLowerCase());\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return tokens.some((token) => {\n if (token.startsWith(\".\")) return name.endsWith(token);\n if (token.endsWith(\"/*\")) return type.startsWith(token.replace(\"/*\", \"/\"));\n return type === token;\n });\n}\n\n/**\n * Drag-and-drop file dropzone. Pair with `uploadWithProgress` from the SDK\n * to wire actual uploads with byte-level progress.\n */\nexport function FileUpload({\n value,\n onChange,\n label,\n accept,\n multiple = false,\n maxSize,\n onReject,\n disabled,\n title = \"Arraste arquivos aqui ou clique para selecionar\",\n subtitle,\n className,\n}: FileUploadProps) {\n const [dragging, setDragging] = useState<boolean>(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n function addFiles(incoming: FileList | File[]): void {\n const accepted: File[] = [];\n const rejected: { file: File; reason: \"size\" | \"type\" }[] = [];\n\n for (const file of Array.from(incoming)) {\n if (!matchesAccept(file, accept)) {\n rejected.push({ file, reason: \"type\" });\n continue;\n }\n if (maxSize && file.size > maxSize) {\n rejected.push({ file, reason: \"size\" });\n continue;\n }\n accepted.push(file);\n }\n\n if (rejected.length > 0) onReject?.(rejected);\n if (accepted.length === 0) return;\n\n const next = multiple ? [...value, ...accepted] : accepted.slice(0, 1);\n onChange(next);\n }\n\n function handleDrop(event: DragEvent<HTMLDivElement>): void {\n event.preventDefault();\n setDragging(false);\n if (disabled) return;\n if (event.dataTransfer?.files) addFiles(event.dataTransfer.files);\n }\n\n function remove(index: number): void {\n const next = value.slice();\n next.splice(index, 1);\n onChange(next);\n }\n\n return (\n <div className={cn(styles.wrapper, className)}>\n {label && <label className={styles.label}>{label}</label>}\n <div\n className={cn(\n styles.dropzone,\n dragging && styles.active,\n disabled && styles.disabled,\n )}\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n onClick={() => !disabled && inputRef.current?.click()}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n inputRef.current?.click();\n }\n }}\n onDragEnter={(event) => {\n event.preventDefault();\n if (!disabled) setDragging(true);\n }}\n onDragOver={(event) => event.preventDefault()}\n onDragLeave={() => setDragging(false)}\n onDrop={handleDrop}\n >\n <div className={styles.icon} aria-hidden>\n <UploadIcon />\n </div>\n <p className={styles.title}>{title}</p>\n {subtitle && <p className={styles.subtitle}>{subtitle}</p>}\n <input\n ref={inputRef}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n className={styles.hidden}\n onChange={(event) => {\n if (event.target.files) addFiles(event.target.files);\n event.target.value = \"\";\n }}\n />\n </div>\n\n {value.length > 0 && (\n <ul className={styles.files}>\n {value.map((file, index) => (\n <li key={`${file.name}-${index}`} className={styles.file}>\n <div>\n <div>{file.name}</div>\n <div className={styles.fileMeta}>{formatSize(file.size)}</div>\n </div>\n <button\n type=\"button\"\n aria-label={`Remover ${file.name}`}\n className={styles.remove}\n onClick={() => remove(index)}\n >\n ×\n </button>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\nfunction UploadIcon() {\n return (\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M12 16V4m0 0l-4 4m4-4l4 4M4 20h16\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>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