@vritti/quantum-ui 0.3.12 → 0.3.15

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 (508) hide show
  1. package/dist/ActivePoints.js.map +1 -1
  2. package/dist/ActiveShapeUtils.js.map +1 -1
  3. package/dist/Alert.js +1 -1
  4. package/dist/Alert.js.map +1 -1
  5. package/dist/AreaChart.js.map +1 -1
  6. package/dist/Avatar.js +1 -1
  7. package/dist/Avatar.js.map +1 -1
  8. package/dist/Badge2.js +2 -2
  9. package/dist/BarChart.js.map +1 -1
  10. package/dist/BillingCycleSelector.js +37 -0
  11. package/dist/BillingCycleSelector.js.map +1 -0
  12. package/dist/Breadcrumb.js +1 -1
  13. package/dist/Breadcrumb.js.map +1 -1
  14. package/dist/Button.js +1 -1
  15. package/dist/Button.js.map +1 -1
  16. package/dist/Button2.js +2 -2
  17. package/dist/CardSkeleton.js.map +1 -1
  18. package/dist/CartesianChart.js.map +1 -1
  19. package/dist/CategoryFilter.js +6 -4
  20. package/dist/CategoryFilter.js.map +1 -1
  21. package/dist/Chart.js +53 -55
  22. package/dist/Chart.js.map +1 -1
  23. package/dist/Checkbox.js.map +1 -1
  24. package/dist/Checkbox2.js +4 -4
  25. package/dist/CheckboxGroup.js.map +1 -1
  26. package/dist/Collapsible.js.map +1 -1
  27. package/dist/Combination.js +1129 -0
  28. package/dist/Combination.js.map +1 -0
  29. package/dist/CompanySelector.js +20 -0
  30. package/dist/CompanySelector.js.map +1 -0
  31. package/dist/ConfirmHost.js.map +1 -1
  32. package/dist/CopyField.js +71 -0
  33. package/dist/CopyField.js.map +1 -0
  34. package/dist/CountrySelector.js +37 -0
  35. package/dist/CountrySelector.js.map +1 -0
  36. package/dist/CurrencyField.js +1 -0
  37. package/dist/CurrencyField.js.map +1 -1
  38. package/dist/CustomerSelector.js +2 -2
  39. package/dist/CustomerSelector.js.map +1 -1
  40. package/dist/DangerZoneSkeleton.js +21 -3
  41. package/dist/DangerZoneSkeleton.js.map +1 -1
  42. package/dist/DatePicker.js +3 -3
  43. package/dist/DatePicker.js.map +1 -1
  44. package/dist/DateTimePicker.js +2 -2
  45. package/dist/DetailSectionSkeleton.js.map +1 -1
  46. package/dist/Dialog.js.map +1 -1
  47. package/dist/DropdownMenu.js.map +1 -1
  48. package/dist/ErrorBarContext.js.map +1 -1
  49. package/dist/FeaturePermissionSelector.js +37 -0
  50. package/dist/FeaturePermissionSelector.js.map +1 -0
  51. package/dist/Form.js.map +1 -1
  52. package/dist/FormSection.js +4 -4
  53. package/dist/FormSection.js.map +1 -1
  54. package/dist/HierarchyGraph.js +5 -10621
  55. package/dist/HierarchyGraph.js.map +1 -1
  56. package/dist/ISOCountrySelect.js +283 -0
  57. package/dist/ISOCountrySelect.js.map +1 -0
  58. package/dist/IconSelect.js +3 -2
  59. package/dist/IconSelect.js.map +1 -1
  60. package/dist/InventoryItemSelector.js +2 -2
  61. package/dist/InventoryItemSelector.js.map +1 -1
  62. package/dist/Kbd.js +1 -1
  63. package/dist/Kbd.js.map +1 -1
  64. package/dist/Label.js +1 -1
  65. package/dist/LayoutModeContext.js.map +1 -1
  66. package/dist/LegalEntitySelector.js +37 -0
  67. package/dist/LegalEntitySelector.js.map +1 -0
  68. package/dist/LineChart.js.map +1 -1
  69. package/dist/LocationSelector.js +2 -2
  70. package/dist/LocationSelector.js.map +1 -1
  71. package/dist/LotSelector.js +2 -2
  72. package/dist/LotSelector.js.map +1 -1
  73. package/dist/OTPField.js.map +1 -1
  74. package/dist/PageContent.js.map +1 -1
  75. package/dist/PageHeaderSkeleton.js +21 -10
  76. package/dist/PageHeaderSkeleton.js.map +1 -1
  77. package/dist/PasswordField.js.map +1 -1
  78. package/dist/PermissionGate.js +49 -5
  79. package/dist/PermissionGate.js.map +1 -1
  80. package/dist/PersonSelector.js +20 -0
  81. package/dist/PersonSelector.js.map +1 -0
  82. package/dist/PhoneField.js.map +1 -1
  83. package/dist/PieChart.js.map +1 -1
  84. package/dist/PolarChart.js.map +1 -1
  85. package/dist/PurchaseOrderSelector.js +2 -2
  86. package/dist/PurchaseOrderSelector.js.map +1 -1
  87. package/dist/QuantSelector.js +2 -2
  88. package/dist/QuantSelector.js.map +1 -1
  89. package/dist/RadarChart.js.map +1 -1
  90. package/dist/RadialChart.js.map +1 -1
  91. package/dist/RadioGroup.js +6 -6
  92. package/dist/RadioGroup.js.map +1 -1
  93. package/dist/RoleSelector.js +20 -0
  94. package/dist/RoleSelector.js.map +1 -0
  95. package/dist/Select.js +4 -1
  96. package/dist/Select.js.map +1 -1
  97. package/dist/SelectFilter.js.map +1 -1
  98. package/dist/Separator.js.map +1 -1
  99. package/dist/SerialSelector.js +2 -2
  100. package/dist/SerialSelector.js.map +1 -1
  101. package/dist/Sidebar.js +2 -2
  102. package/dist/Sidebar.js.map +1 -1
  103. package/dist/SingleSelect.js +2 -2
  104. package/dist/SingleSelect.js.map +1 -1
  105. package/dist/SiteGroupSelector.js +37 -0
  106. package/dist/SiteGroupSelector.js.map +1 -0
  107. package/dist/SiteSelector.js +37 -0
  108. package/dist/SiteSelector.js.map +1 -0
  109. package/dist/Sonner.js +1 -1
  110. package/dist/Sonner.js.map +1 -1
  111. package/dist/Sortable.js +4 -4417
  112. package/dist/Sortable.js.map +1 -1
  113. package/dist/StepProgressIndicator.js.map +1 -1
  114. package/dist/SupplierItemSelector.js +2 -2
  115. package/dist/SupplierItemSelector.js.map +1 -1
  116. package/dist/SupplierSelector.js +2 -2
  117. package/dist/SupplierSelector.js.map +1 -1
  118. package/dist/Switch.js +3 -3
  119. package/dist/Switch.js.map +1 -1
  120. package/dist/TabsSkeleton.js +101 -49
  121. package/dist/TabsSkeleton.js.map +1 -1
  122. package/dist/TaxClassSelector.js +20 -0
  123. package/dist/TaxClassSelector.js.map +1 -0
  124. package/dist/TextField.js.map +1 -1
  125. package/dist/ThemeContext.js.map +1 -1
  126. package/dist/ThemeToggle.js.map +1 -1
  127. package/dist/Toggle.js +1 -1
  128. package/dist/Toggle.js.map +1 -1
  129. package/dist/Tooltip.js.map +1 -1
  130. package/dist/Typography.js.map +1 -1
  131. package/dist/UomSelector.js +2 -2
  132. package/dist/UomSelector.js.map +1 -1
  133. package/dist/UploadFile.js.map +1 -1
  134. package/dist/assets/quantum-ui.css +44 -13
  135. package/dist/calendar2.js +1 -1
  136. package/dist/collapsible2.js +1 -1
  137. package/dist/components/CompanySelector.js +2 -0
  138. package/dist/components/CompanySelector.js.map +1 -0
  139. package/dist/components/CopyField.js +2 -0
  140. package/dist/components/CopyField.js.map +1 -0
  141. package/dist/components/FormattedDate.js +2 -2
  142. package/dist/components/HierarchyGraph.js +2 -1
  143. package/dist/components/HierarchyGraph.js.map +1 -1
  144. package/dist/components/PermissionGate.js +1 -1
  145. package/dist/components/PersonSelector.js +2 -0
  146. package/dist/components/PersonSelector.js.map +1 -0
  147. package/dist/components/ScanBarcodeButton.js.map +1 -1
  148. package/dist/components/TreeView.js +7 -7
  149. package/dist/components/TreeView.js.map +1 -1
  150. package/dist/copy.js +18 -0
  151. package/dist/copy.js.map +1 -0
  152. package/dist/core.esm.js +4025 -0
  153. package/dist/core.esm.js.map +1 -0
  154. package/dist/dropdown-menu.js +10 -10
  155. package/dist/field.js +1 -1
  156. package/dist/getClassNameFromUnknown.js.map +1 -1
  157. package/dist/getRadiusAndStrokeWidthFromDot.js.map +1 -1
  158. package/dist/getZIndexFromUnknown.js.map +1 -1
  159. package/dist/graphicalItemSelectors.js.map +1 -1
  160. package/dist/image-component.js.map +1 -1
  161. package/dist/index.js +16 -3
  162. package/dist/index.js.map +1 -1
  163. package/dist/index10.js +102 -1499
  164. package/dist/index10.js.map +1 -1
  165. package/dist/index11.js +1499 -37
  166. package/dist/index11.js.map +1 -1
  167. package/dist/index12.js +29 -477
  168. package/dist/index12.js.map +1 -1
  169. package/dist/index13.js +427 -231
  170. package/dist/index13.js.map +1 -1
  171. package/dist/index14.js +215 -1074
  172. package/dist/index14.js.map +1 -1
  173. package/dist/index15.js +1140 -14
  174. package/dist/index15.js.map +1 -1
  175. package/dist/index16.js +13 -19
  176. package/dist/index16.js.map +1 -1
  177. package/dist/index17.js +24 -172
  178. package/dist/index17.js.map +1 -1
  179. package/dist/index18.js +168 -175
  180. package/dist/index18.js.map +1 -1
  181. package/dist/index19.js +173 -201
  182. package/dist/index19.js.map +1 -1
  183. package/dist/index20.js +203 -69
  184. package/dist/index20.js.map +1 -1
  185. package/dist/index21.js +70 -211
  186. package/dist/index21.js.map +1 -1
  187. package/dist/index22.js +207 -117
  188. package/dist/index22.js.map +1 -1
  189. package/dist/index23.js +123 -71
  190. package/dist/index23.js.map +1 -1
  191. package/dist/index24.js +74 -11
  192. package/dist/index24.js.map +1 -1
  193. package/dist/index25.js +13 -1134
  194. package/dist/index25.js.map +1 -1
  195. package/dist/index26.js +1120 -219
  196. package/dist/index26.js.map +1 -1
  197. package/dist/index27.js +202 -2506
  198. package/dist/index27.js.map +1 -1
  199. package/dist/index28.js +2527 -23
  200. package/dist/index28.js.map +1 -1
  201. package/dist/index29.js +32 -4
  202. package/dist/index29.js.map +1 -1
  203. package/dist/index3.js +11543 -267
  204. package/dist/index3.js.map +1 -1
  205. package/dist/index30.js +3 -1124
  206. package/dist/index30.js.map +1 -1
  207. package/dist/index31.js +1 -1
  208. package/dist/index32.js +7 -7
  209. package/dist/index34.js +1 -1
  210. package/dist/index37.js +1 -1
  211. package/dist/index38.js +23 -43
  212. package/dist/index38.js.map +1 -1
  213. package/dist/index4.js +272 -132
  214. package/dist/index4.js.map +1 -1
  215. package/dist/index5.js +138 -388
  216. package/dist/index5.js.map +1 -1
  217. package/dist/index6.js +386 -7
  218. package/dist/index6.js.map +1 -1
  219. package/dist/index7.js +13 -92
  220. package/dist/index7.js.map +1 -1
  221. package/dist/index8.js +92 -43
  222. package/dist/index8.js.map +1 -1
  223. package/dist/index9.js +42 -102
  224. package/dist/index9.js.map +1 -1
  225. package/dist/lib/components/Alert/Alert.d.ts.map +1 -1
  226. package/dist/lib/components/Avatar/Avatar.d.ts.map +1 -1
  227. package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  228. package/dist/lib/components/Button/Button.d.ts.map +1 -1
  229. package/dist/lib/components/Card/CardSkeleton.d.ts.map +1 -1
  230. package/dist/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  231. package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
  232. package/dist/lib/components/Collapsible/Collapsible.d.ts.map +1 -1
  233. package/dist/lib/components/CompanySelector/CompanySelector.d.ts +4 -0
  234. package/dist/lib/components/CompanySelector/CompanySelector.d.ts.map +1 -0
  235. package/dist/lib/components/CompanySelector/index.d.ts +2 -0
  236. package/dist/lib/components/CompanySelector/index.d.ts.map +1 -0
  237. package/dist/lib/components/ConfirmHost/ConfirmHost.d.ts.map +1 -1
  238. package/dist/lib/components/CopyField/CopyField.d.ts +10 -0
  239. package/dist/lib/components/CopyField/CopyField.d.ts.map +1 -0
  240. package/dist/lib/components/CopyField/index.d.ts +2 -0
  241. package/dist/lib/components/CopyField/index.d.ts.map +1 -0
  242. package/dist/lib/components/CurrencyField/CurrencyField.d.ts.map +1 -1
  243. package/dist/lib/components/DangerZone/DangerZone.d.ts +3 -1
  244. package/dist/lib/components/DangerZone/DangerZone.d.ts.map +1 -1
  245. package/dist/lib/components/DataTable/CompactTableSkeleton.d.ts.map +1 -1
  246. package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
  247. package/dist/lib/components/DataTable/cells/cells.d.ts.map +1 -1
  248. package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts.map +1 -1
  249. package/dist/lib/components/DataTable/components/RowActions.d.ts.map +1 -1
  250. package/dist/lib/components/DataTable/hooks/useDataTable.d.ts.map +1 -1
  251. package/dist/lib/components/DataTable/store/store.d.ts.map +1 -1
  252. package/dist/lib/components/DataTable/types.d.ts.map +1 -1
  253. package/dist/lib/components/DatePicker/DatePicker.d.ts +2 -2
  254. package/dist/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
  255. package/dist/lib/components/DetailField/DetailField.d.ts.map +1 -1
  256. package/dist/lib/components/DetailField/DetailHeader.d.ts.map +1 -1
  257. package/dist/lib/components/DetailField/DetailSectionSkeleton.d.ts.map +1 -1
  258. package/dist/lib/components/Dialog/Dialog.d.ts.map +1 -1
  259. package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  260. package/dist/lib/components/DropdownMenu/types.d.ts.map +1 -1
  261. package/dist/lib/components/Editor/editor-ui/color-picker.d.ts.map +1 -1
  262. package/dist/lib/components/Editor/editor-ui/image-component.d.ts.map +1 -1
  263. package/dist/lib/components/Editor/nodes/autocomplete-node.d.ts.map +1 -1
  264. package/dist/lib/components/Editor/plugins/actions/max-length-plugin.d.ts.map +1 -1
  265. package/dist/lib/components/Editor/plugins/embeds/auto-embed-plugin.d.ts.map +1 -1
  266. package/dist/lib/components/Editor/plugins/embeds/youtube-plugin.d.ts.map +1 -1
  267. package/dist/lib/components/Editor/plugins/emojis-plugin.d.ts.map +1 -1
  268. package/dist/lib/components/Editor/plugins/floating-link-editor-plugin.d.ts.map +1 -1
  269. package/dist/lib/components/Editor/plugins/floating-text-format-plugin.d.ts.map +1 -1
  270. package/dist/lib/components/Editor/plugins/images-plugin.d.ts.map +1 -1
  271. package/dist/lib/components/Editor/plugins/keywords-plugin.d.ts.map +1 -1
  272. package/dist/lib/components/Editor/plugins/layout-plugin.d.ts.map +1 -1
  273. package/dist/lib/components/Editor/plugins/list-max-indent-level-plugin.d.ts.map +1 -1
  274. package/dist/lib/components/Editor/plugins/mentions-plugin.d.ts.map +1 -1
  275. package/dist/lib/components/Editor/plugins/picker/component-picker-option.d.ts.map +1 -1
  276. package/dist/lib/components/Editor/plugins/tab-focus-plugin.d.ts.map +1 -1
  277. package/dist/lib/components/Editor/plugins/table-plugin.d.ts.map +1 -1
  278. package/dist/lib/components/Editor/plugins/toolbar/clear-formatting-toolbar-plugin.d.ts.map +1 -1
  279. package/dist/lib/components/Editor/plugins/typing-pref-plugin.d.ts.map +1 -1
  280. package/dist/lib/components/Editor/shared/invariant.d.ts.map +1 -1
  281. package/dist/lib/components/Editor/shared/react-patches.d.ts.map +1 -1
  282. package/dist/lib/components/Editor/shared/react-test-utils.d.ts.map +1 -1
  283. package/dist/lib/components/Editor/shared/simple-diff-with-cursor.d.ts.map +1 -1
  284. package/dist/lib/components/Editor/shared/use-layout-effect.d.ts.map +1 -1
  285. package/dist/lib/components/Editor/transformers/markdown-table-transformer.d.ts.map +1 -1
  286. package/dist/lib/components/Editor/utils/collapsible.d.ts.map +1 -1
  287. package/dist/lib/components/Editor/utils/doc-serialization.d.ts.map +1 -1
  288. package/dist/lib/components/Editor/utils/emoji-list.d.ts.map +1 -1
  289. package/dist/lib/components/Editor/utils/get-dom-range-rect.d.ts.map +1 -1
  290. package/dist/lib/components/Editor/utils/get-selected-node.d.ts.map +1 -1
  291. package/dist/lib/components/Editor/utils/guard.d.ts.map +1 -1
  292. package/dist/lib/components/Editor/utils/set-floating-elem-position-for-link-editor.d.ts.map +1 -1
  293. package/dist/lib/components/Editor/utils/set-floating-elem-position.d.ts.map +1 -1
  294. package/dist/lib/components/Editor/utils/swipe.d.ts.map +1 -1
  295. package/dist/lib/components/Editor/utils/url.d.ts.map +1 -1
  296. package/dist/lib/components/Form/Form.d.ts.map +1 -1
  297. package/dist/lib/components/OTPField/OTPField.d.ts.map +1 -1
  298. package/dist/lib/components/PageContent/PageContent.d.ts.map +1 -1
  299. package/dist/lib/components/PageHeader/PageHeader.d.ts.map +1 -1
  300. package/dist/lib/components/PasswordField/PasswordField.d.ts.map +1 -1
  301. package/dist/lib/components/PermissionGate/PermissionGate.d.ts +15 -4
  302. package/dist/lib/components/PermissionGate/PermissionGate.d.ts.map +1 -1
  303. package/dist/lib/components/PermissionGate/index.d.ts +1 -1
  304. package/dist/lib/components/PermissionGate/index.d.ts.map +1 -1
  305. package/dist/lib/components/PersonSelector/PersonSelector.d.ts +4 -0
  306. package/dist/lib/components/PersonSelector/PersonSelector.d.ts.map +1 -0
  307. package/dist/lib/components/PersonSelector/index.d.ts +2 -0
  308. package/dist/lib/components/PersonSelector/index.d.ts.map +1 -0
  309. package/dist/lib/components/PhoneField/PhoneField.d.ts.map +1 -1
  310. package/dist/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  311. package/dist/lib/components/ScanBarcodeButton/ScanBarcodeButton.d.ts.map +1 -1
  312. package/dist/lib/components/Select/SelectFilter.d.ts.map +1 -1
  313. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  314. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -1
  315. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -1
  316. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
  317. package/dist/lib/components/Select/hooks/useSelect.d.ts.map +1 -1
  318. package/dist/lib/components/Select/hooks/useSingleSelect.d.ts.map +1 -1
  319. package/dist/lib/components/Select/types.d.ts +1 -1
  320. package/dist/lib/components/Select/types.d.ts.map +1 -1
  321. package/dist/lib/components/Separator/Separator.d.ts.map +1 -1
  322. package/dist/lib/components/Sidebar/Sidebar.d.ts.map +1 -1
  323. package/dist/lib/components/Sonner/Sonner.d.ts.map +1 -1
  324. package/dist/lib/components/Sonner/toast.d.ts.map +1 -1
  325. package/dist/lib/components/StepProgressIndicator/StepProgressIndicator.d.ts.map +1 -1
  326. package/dist/lib/components/Switch/Switch.d.ts.map +1 -1
  327. package/dist/lib/components/Tabs/Tabs.d.ts +2 -0
  328. package/dist/lib/components/Tabs/Tabs.d.ts.map +1 -1
  329. package/dist/lib/components/Tabs/TabsSkeleton.d.ts.map +1 -1
  330. package/dist/lib/components/TextField/TextField.d.ts.map +1 -1
  331. package/dist/lib/components/ThemeToggle/ThemeToggle.d.ts.map +1 -1
  332. package/dist/lib/components/Toggle/Toggle.d.ts.map +1 -1
  333. package/dist/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  334. package/dist/lib/components/TreeView/TreeView.d.ts.map +1 -1
  335. package/dist/lib/components/Typography/Typography.d.ts.map +1 -1
  336. package/dist/lib/components/UploadFile/UploadFile.d.ts.map +1 -1
  337. package/dist/lib/components/index.d.ts +3 -0
  338. package/dist/lib/components/index.d.ts.map +1 -1
  339. package/dist/lib/config/index.d.ts.map +1 -1
  340. package/dist/lib/context/LayoutModeContext.d.ts.map +1 -1
  341. package/dist/lib/context/ThemeContext.d.ts.map +1 -1
  342. package/dist/lib/hooks/useBUCurrency.d.ts.map +1 -1
  343. package/dist/lib/hooks/useBUTimezone.d.ts.map +1 -1
  344. package/dist/lib/hooks/useBarcodeScanner.d.ts.map +1 -1
  345. package/dist/lib/hooks/useFormatters.d.ts.map +1 -1
  346. package/dist/lib/hooks/useSSE.d.ts.map +1 -1
  347. package/dist/lib/hooks/useTheme.d.ts.map +1 -1
  348. package/dist/lib/index.d.ts.map +1 -1
  349. package/dist/lib/selects/billing-cycle/BillingCycleFilter.d.ts +12 -0
  350. package/dist/lib/selects/billing-cycle/BillingCycleFilter.d.ts.map +1 -0
  351. package/dist/lib/selects/billing-cycle/BillingCycleSelector.d.ts +4 -0
  352. package/dist/lib/selects/billing-cycle/BillingCycleSelector.d.ts.map +1 -0
  353. package/dist/lib/selects/billing-cycle/index.d.ts +3 -0
  354. package/dist/lib/selects/billing-cycle/index.d.ts.map +1 -0
  355. package/dist/lib/selects/category/CategoryFilter.d.ts.map +1 -1
  356. package/dist/lib/selects/category/CategorySelector.d.ts.map +1 -1
  357. package/dist/lib/selects/cost-category/CostCategorySelector.d.ts.map +1 -1
  358. package/dist/lib/selects/country/CountryFilter.d.ts +12 -0
  359. package/dist/lib/selects/country/CountryFilter.d.ts.map +1 -0
  360. package/dist/lib/selects/country/CountrySelector.d.ts +4 -0
  361. package/dist/lib/selects/country/CountrySelector.d.ts.map +1 -0
  362. package/dist/lib/selects/country/index.d.ts +3 -0
  363. package/dist/lib/selects/country/index.d.ts.map +1 -0
  364. package/dist/lib/selects/feature-permission/FeaturePermissionFilter.d.ts +12 -0
  365. package/dist/lib/selects/feature-permission/FeaturePermissionFilter.d.ts.map +1 -0
  366. package/dist/lib/selects/feature-permission/FeaturePermissionSelector.d.ts +4 -0
  367. package/dist/lib/selects/feature-permission/FeaturePermissionSelector.d.ts.map +1 -0
  368. package/dist/lib/selects/feature-permission/index.d.ts +3 -0
  369. package/dist/lib/selects/feature-permission/index.d.ts.map +1 -0
  370. package/dist/lib/selects/icon/IconSelect.d.ts.map +1 -1
  371. package/dist/lib/selects/index.d.ts +9 -0
  372. package/dist/lib/selects/index.d.ts.map +1 -1
  373. package/dist/lib/selects/inventory-item/InventoryItemSelector.d.ts +2 -2
  374. package/dist/lib/selects/inventory-item/InventoryItemSelector.d.ts.map +1 -1
  375. package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts +15 -0
  376. package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts.map +1 -0
  377. package/dist/lib/selects/iso-country/index.d.ts +3 -0
  378. package/dist/lib/selects/iso-country/index.d.ts.map +1 -0
  379. package/dist/lib/selects/iso-country/iso-countries.d.ts +7 -0
  380. package/dist/lib/selects/iso-country/iso-countries.d.ts.map +1 -0
  381. package/dist/lib/selects/legal-entity/LegalEntityFilter.d.ts +12 -0
  382. package/dist/lib/selects/legal-entity/LegalEntityFilter.d.ts.map +1 -0
  383. package/dist/lib/selects/legal-entity/LegalEntitySelector.d.ts +4 -0
  384. package/dist/lib/selects/legal-entity/LegalEntitySelector.d.ts.map +1 -0
  385. package/dist/lib/selects/legal-entity/index.d.ts +3 -0
  386. package/dist/lib/selects/legal-entity/index.d.ts.map +1 -0
  387. package/dist/lib/selects/location/LocationSelector.d.ts.map +1 -1
  388. package/dist/lib/selects/purchase-order/PurchaseOrderSelector.d.ts.map +1 -1
  389. package/dist/lib/selects/purchase-order-item/PurchaseOrderItemSelector.d.ts.map +1 -1
  390. package/dist/lib/selects/role/RoleSelector.d.ts +4 -0
  391. package/dist/lib/selects/role/RoleSelector.d.ts.map +1 -0
  392. package/dist/lib/selects/role/index.d.ts +2 -0
  393. package/dist/lib/selects/role/index.d.ts.map +1 -0
  394. package/dist/lib/selects/serial/SerialSelector.d.ts.map +1 -1
  395. package/dist/lib/selects/site/SiteFilter.d.ts +12 -0
  396. package/dist/lib/selects/site/SiteFilter.d.ts.map +1 -0
  397. package/dist/lib/selects/site/SiteSelector.d.ts +4 -0
  398. package/dist/lib/selects/site/SiteSelector.d.ts.map +1 -0
  399. package/dist/lib/selects/site/index.d.ts +3 -0
  400. package/dist/lib/selects/site/index.d.ts.map +1 -0
  401. package/dist/lib/selects/site-group/SiteGroupFilter.d.ts +12 -0
  402. package/dist/lib/selects/site-group/SiteGroupFilter.d.ts.map +1 -0
  403. package/dist/lib/selects/site-group/SiteGroupSelector.d.ts +4 -0
  404. package/dist/lib/selects/site-group/SiteGroupSelector.d.ts.map +1 -0
  405. package/dist/lib/selects/site-group/index.d.ts +3 -0
  406. package/dist/lib/selects/site-group/index.d.ts.map +1 -0
  407. package/dist/lib/selects/supplier/SupplierSelector.d.ts.map +1 -1
  408. package/dist/lib/selects/supplier-item/SupplierItemFilter.d.ts.map +1 -1
  409. package/dist/lib/selects/supplier-item/SupplierItemSelector.d.ts.map +1 -1
  410. package/dist/lib/selects/tax-class/TaxClassSelector.d.ts +4 -0
  411. package/dist/lib/selects/tax-class/TaxClassSelector.d.ts.map +1 -0
  412. package/dist/lib/selects/tax-class/index.d.ts +2 -0
  413. package/dist/lib/selects/tax-class/index.d.ts.map +1 -0
  414. package/dist/lib/theme/index.d.ts.map +1 -1
  415. package/dist/lib/types/catalog-resolver.d.ts +50 -17
  416. package/dist/lib/types/catalog-resolver.d.ts.map +1 -1
  417. package/dist/lib/utils/axios.d.ts.map +1 -1
  418. package/dist/lib/utils/cn.d.ts +3 -0
  419. package/dist/lib/utils/cn.d.ts.map +1 -0
  420. package/dist/lib/utils/dagre.d.ts +2 -0
  421. package/dist/lib/utils/dagre.d.ts.map +1 -0
  422. package/dist/lib/utils/dnd-kit/core.d.ts +2 -0
  423. package/dist/lib/utils/dnd-kit/core.d.ts.map +1 -0
  424. package/dist/lib/utils/dnd-kit/sortable.d.ts +2 -0
  425. package/dist/lib/utils/dnd-kit/sortable.d.ts.map +1 -0
  426. package/dist/lib/utils/dnd-kit/utilities.d.ts +2 -0
  427. package/dist/lib/utils/dnd-kit/utilities.d.ts.map +1 -0
  428. package/dist/lib/utils/formHelpers.d.ts.map +1 -1
  429. package/dist/lib/utils/format.d.ts.map +1 -1
  430. package/dist/lib/utils/permission-deps.d.ts +9 -0
  431. package/dist/lib/utils/permission-deps.d.ts.map +1 -0
  432. package/dist/lib/utils/react-flow.d.ts +2 -0
  433. package/dist/lib/utils/react-flow.d.ts.map +1 -0
  434. package/dist/lib/utils/zod.d.ts +9 -0
  435. package/dist/lib/utils/zod.d.ts.map +1 -1
  436. package/dist/polarScaleSelectors.js.map +1 -1
  437. package/dist/popover.js +1 -1
  438. package/dist/select2.js +1 -1
  439. package/dist/selects/billing-cycle.js +2 -0
  440. package/dist/selects/billing-cycle.js.map +1 -0
  441. package/dist/selects/cost-category.js +2 -2
  442. package/dist/selects/cost-category.js.map +1 -1
  443. package/dist/selects/country.js +2 -0
  444. package/dist/selects/country.js.map +1 -0
  445. package/dist/selects/feature-permission.js +2 -0
  446. package/dist/selects/feature-permission.js.map +1 -0
  447. package/dist/selects/iso-country.js +2 -0
  448. package/dist/selects/iso-country.js.map +1 -0
  449. package/dist/selects/legal-entity.js +2 -0
  450. package/dist/selects/legal-entity.js.map +1 -0
  451. package/dist/selects/purchase-order-item.js +1 -1
  452. package/dist/selects/purchase-order-item.js.map +1 -1
  453. package/dist/selects/role.js +2 -0
  454. package/dist/selects/role.js.map +1 -0
  455. package/dist/selects/site-group.js +2 -0
  456. package/dist/selects/site-group.js.map +1 -0
  457. package/dist/selects/site.js +2 -0
  458. package/dist/selects/site.js.map +1 -0
  459. package/dist/selects/tax-class.js +2 -0
  460. package/dist/selects/tax-class.js.map +1 -0
  461. package/dist/selects/tax-group.js +2 -2
  462. package/dist/selects/tax-group.js.map +1 -1
  463. package/dist/separator2.js +1 -1
  464. package/dist/sortable.esm.js +780 -0
  465. package/dist/sortable.esm.js.map +1 -0
  466. package/dist/theme/index.js.map +1 -1
  467. package/dist/toast.js +2 -26
  468. package/dist/toast.js.map +1 -1
  469. package/dist/tooltip2.js +1 -1
  470. package/dist/tooltipContext.js.map +1 -1
  471. package/dist/types/catalog-resolver.js +5 -2
  472. package/dist/types/catalog-resolver.js.map +1 -1
  473. package/dist/useBUTimezone.js.map +1 -1
  474. package/dist/useDataTable.js +58 -60
  475. package/dist/useDataTable.js.map +1 -1
  476. package/dist/useFormatters.js.map +1 -1
  477. package/dist/useTheme.js.map +1 -1
  478. package/dist/useTimer.js +2 -2
  479. package/dist/useTimer.js.map +1 -1
  480. package/dist/utilities.esm.js +333 -0
  481. package/dist/utilities.esm.js.map +1 -0
  482. package/dist/utils/axios.js +1 -1
  483. package/dist/utils/axios.js.map +1 -1
  484. package/dist/utils/cn.js +6 -0
  485. package/dist/utils/cn.js.map +1 -0
  486. package/dist/utils/currency.js +2 -2
  487. package/dist/utils/dagre.js +4 -0
  488. package/dist/utils/dagre.js.map +1 -0
  489. package/dist/utils/dnd-kit/core.js +2 -0
  490. package/dist/utils/dnd-kit/core.js.map +1 -0
  491. package/dist/utils/dnd-kit/sortable.js +2 -0
  492. package/dist/utils/dnd-kit/sortable.js.map +1 -0
  493. package/dist/utils/dnd-kit/utilities.js +2 -0
  494. package/dist/utils/dnd-kit/utilities.js.map +1 -0
  495. package/dist/utils/format.js +2 -2
  496. package/dist/utils/format.js.map +1 -1
  497. package/dist/utils/hotkeys.js +1 -1
  498. package/dist/utils/money.js +1 -1
  499. package/dist/utils/permission-deps.js +64 -0
  500. package/dist/utils/permission-deps.js.map +1 -0
  501. package/dist/utils/react-flow.js +2 -0
  502. package/dist/utils/react-flow.js.map +1 -0
  503. package/dist/utils/timezone.js +1 -1
  504. package/dist/utils/zod.js +11 -1
  505. package/dist/utils/zod.js.map +1 -1
  506. package/dist/youtube.js +15 -29
  507. package/dist/youtube.js.map +1 -1
  508. package/package.json +77 -1
package/dist/index25.js CHANGED
@@ -1,1137 +1,16 @@
1
- import React__default from 'react';
2
- import ReactDOM__default from 'react-dom';
3
-
4
- function __insertCSS(code) {
5
- if (typeof document == 'undefined') return
6
- let head = document.head || document.getElementsByTagName('head')[0];
7
- let style = document.createElement('style');
8
- style.type = 'text/css';
9
- head.appendChild(style)
10
- ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code));
11
- }
12
-
13
- const getAsset = (type)=>{
14
- switch(type){
15
- case 'success':
16
- return SuccessIcon;
17
- case 'info':
18
- return InfoIcon;
19
- case 'warning':
20
- return WarningIcon;
21
- case 'error':
22
- return ErrorIcon;
23
- default:
24
- return null;
25
- }
26
- };
27
- const bars = Array(12).fill(0);
28
- const Loader = ({ visible, className })=>{
29
- return /*#__PURE__*/ React__default.createElement("div", {
30
- className: [
31
- 'sonner-loading-wrapper',
32
- className
33
- ].filter(Boolean).join(' '),
34
- "data-visible": visible
35
- }, /*#__PURE__*/ React__default.createElement("div", {
36
- className: "sonner-spinner"
37
- }, bars.map((_, i)=>/*#__PURE__*/ React__default.createElement("div", {
38
- className: "sonner-loading-bar",
39
- key: `spinner-bar-${i}`
40
- }))));
41
- };
42
- const SuccessIcon = /*#__PURE__*/ React__default.createElement("svg", {
43
- xmlns: "http://www.w3.org/2000/svg",
44
- viewBox: "0 0 20 20",
45
- fill: "currentColor",
46
- height: "20",
47
- width: "20"
48
- }, /*#__PURE__*/ React__default.createElement("path", {
49
- fillRule: "evenodd",
50
- d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
51
- clipRule: "evenodd"
52
- }));
53
- const WarningIcon = /*#__PURE__*/ React__default.createElement("svg", {
54
- xmlns: "http://www.w3.org/2000/svg",
55
- viewBox: "0 0 24 24",
56
- fill: "currentColor",
57
- height: "20",
58
- width: "20"
59
- }, /*#__PURE__*/ React__default.createElement("path", {
60
- fillRule: "evenodd",
61
- d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
62
- clipRule: "evenodd"
63
- }));
64
- const InfoIcon = /*#__PURE__*/ React__default.createElement("svg", {
65
- xmlns: "http://www.w3.org/2000/svg",
66
- viewBox: "0 0 20 20",
67
- fill: "currentColor",
68
- height: "20",
69
- width: "20"
70
- }, /*#__PURE__*/ React__default.createElement("path", {
71
- fillRule: "evenodd",
72
- d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
73
- clipRule: "evenodd"
74
- }));
75
- const ErrorIcon = /*#__PURE__*/ React__default.createElement("svg", {
76
- xmlns: "http://www.w3.org/2000/svg",
77
- viewBox: "0 0 20 20",
78
- fill: "currentColor",
79
- height: "20",
80
- width: "20"
81
- }, /*#__PURE__*/ React__default.createElement("path", {
82
- fillRule: "evenodd",
83
- d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
84
- clipRule: "evenodd"
85
- }));
86
- const CloseIcon = /*#__PURE__*/ React__default.createElement("svg", {
87
- xmlns: "http://www.w3.org/2000/svg",
88
- width: "12",
89
- height: "12",
90
- viewBox: "0 0 24 24",
91
- fill: "none",
92
- stroke: "currentColor",
93
- strokeWidth: "1.5",
94
- strokeLinecap: "round",
95
- strokeLinejoin: "round"
96
- }, /*#__PURE__*/ React__default.createElement("line", {
97
- x1: "18",
98
- y1: "6",
99
- x2: "6",
100
- y2: "18"
101
- }), /*#__PURE__*/ React__default.createElement("line", {
102
- x1: "6",
103
- y1: "6",
104
- x2: "18",
105
- y2: "18"
106
- }));
107
-
108
- const useIsDocumentHidden = ()=>{
109
- const [isDocumentHidden, setIsDocumentHidden] = React__default.useState(document.hidden);
110
- React__default.useEffect(()=>{
111
- const callback = ()=>{
112
- setIsDocumentHidden(document.hidden);
113
- };
114
- document.addEventListener('visibilitychange', callback);
115
- return ()=>window.removeEventListener('visibilitychange', callback);
116
- }, []);
117
- return isDocumentHidden;
118
- };
119
-
120
- let toastsCounter = 1;
121
- class Observer {
122
- constructor(){
123
- // We use arrow functions to maintain the correct `this` reference
124
- this.subscribe = (subscriber)=>{
125
- this.subscribers.push(subscriber);
126
- return ()=>{
127
- const index = this.subscribers.indexOf(subscriber);
128
- this.subscribers.splice(index, 1);
129
- };
130
- };
131
- this.publish = (data)=>{
132
- this.subscribers.forEach((subscriber)=>subscriber(data));
133
- };
134
- this.addToast = (data)=>{
135
- this.publish(data);
136
- this.toasts = [
137
- ...this.toasts,
138
- data
139
- ];
140
- };
141
- this.create = (data)=>{
142
- var _data_id;
143
- const { message, ...rest } = data;
144
- const id = typeof (data == null ? void 0 : data.id) === 'number' || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
145
- const alreadyExists = this.toasts.find((toast)=>{
146
- return toast.id === id;
147
- });
148
- const dismissible = data.dismissible === undefined ? true : data.dismissible;
149
- if (this.dismissedToasts.has(id)) {
150
- this.dismissedToasts.delete(id);
151
- }
152
- if (alreadyExists) {
153
- this.toasts = this.toasts.map((toast)=>{
154
- if (toast.id === id) {
155
- this.publish({
156
- ...toast,
157
- ...data,
158
- id,
159
- title: message
160
- });
161
- return {
162
- ...toast,
163
- ...data,
164
- id,
165
- dismissible,
166
- title: message
167
- };
168
- }
169
- return toast;
170
- });
171
- } else {
172
- this.addToast({
173
- title: message,
174
- ...rest,
175
- dismissible,
176
- id
177
- });
178
- }
179
- return id;
180
- };
181
- this.dismiss = (id)=>{
182
- if (id) {
183
- this.dismissedToasts.add(id);
184
- requestAnimationFrame(()=>this.subscribers.forEach((subscriber)=>subscriber({
185
- id,
186
- dismiss: true
187
- })));
188
- } else {
189
- this.toasts.forEach((toast)=>{
190
- this.subscribers.forEach((subscriber)=>subscriber({
191
- id: toast.id,
192
- dismiss: true
193
- }));
194
- });
195
- }
196
- return id;
197
- };
198
- this.message = (message, data)=>{
199
- return this.create({
200
- ...data,
201
- message
202
- });
203
- };
204
- this.error = (message, data)=>{
205
- return this.create({
206
- ...data,
207
- message,
208
- type: 'error'
209
- });
210
- };
211
- this.success = (message, data)=>{
212
- return this.create({
213
- ...data,
214
- type: 'success',
215
- message
216
- });
217
- };
218
- this.info = (message, data)=>{
219
- return this.create({
220
- ...data,
221
- type: 'info',
222
- message
223
- });
224
- };
225
- this.warning = (message, data)=>{
226
- return this.create({
227
- ...data,
228
- type: 'warning',
229
- message
230
- });
231
- };
232
- this.loading = (message, data)=>{
233
- return this.create({
234
- ...data,
235
- type: 'loading',
236
- message
237
- });
238
- };
239
- this.promise = (promise, data)=>{
240
- if (!data) {
241
- // Nothing to show
242
- return;
243
- }
244
- let id = undefined;
245
- if (data.loading !== undefined) {
246
- id = this.create({
247
- ...data,
248
- promise,
249
- type: 'loading',
250
- message: data.loading,
251
- description: typeof data.description !== 'function' ? data.description : undefined
252
- });
253
- }
254
- const p = Promise.resolve(promise instanceof Function ? promise() : promise);
255
- let shouldDismiss = id !== undefined;
256
- let result;
257
- const originalPromise = p.then(async (response)=>{
258
- result = [
259
- 'resolve',
260
- response
261
- ];
262
- const isReactElementResponse = React__default.isValidElement(response);
263
- if (isReactElementResponse) {
264
- shouldDismiss = false;
265
- this.create({
266
- id,
267
- type: 'default',
268
- message: response
269
- });
270
- } else if (isHttpResponse(response) && !response.ok) {
271
- shouldDismiss = false;
272
- const promiseData = typeof data.error === 'function' ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
273
- const description = typeof data.description === 'function' ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
274
- const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
275
- const toastSettings = isExtendedResult ? promiseData : {
276
- message: promiseData
277
- };
278
- this.create({
279
- id,
280
- type: 'error',
281
- description,
282
- ...toastSettings
283
- });
284
- } else if (response instanceof Error) {
285
- shouldDismiss = false;
286
- const promiseData = typeof data.error === 'function' ? await data.error(response) : data.error;
287
- const description = typeof data.description === 'function' ? await data.description(response) : data.description;
288
- const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
289
- const toastSettings = isExtendedResult ? promiseData : {
290
- message: promiseData
291
- };
292
- this.create({
293
- id,
294
- type: 'error',
295
- description,
296
- ...toastSettings
297
- });
298
- } else if (data.success !== undefined) {
299
- shouldDismiss = false;
300
- const promiseData = typeof data.success === 'function' ? await data.success(response) : data.success;
301
- const description = typeof data.description === 'function' ? await data.description(response) : data.description;
302
- const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
303
- const toastSettings = isExtendedResult ? promiseData : {
304
- message: promiseData
305
- };
306
- this.create({
307
- id,
308
- type: 'success',
309
- description,
310
- ...toastSettings
311
- });
312
- }
313
- }).catch(async (error)=>{
314
- result = [
315
- 'reject',
316
- error
317
- ];
318
- if (data.error !== undefined) {
319
- shouldDismiss = false;
320
- const promiseData = typeof data.error === 'function' ? await data.error(error) : data.error;
321
- const description = typeof data.description === 'function' ? await data.description(error) : data.description;
322
- const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
323
- const toastSettings = isExtendedResult ? promiseData : {
324
- message: promiseData
325
- };
326
- this.create({
327
- id,
328
- type: 'error',
329
- description,
330
- ...toastSettings
331
- });
332
- }
333
- }).finally(()=>{
334
- if (shouldDismiss) {
335
- // Toast is still in load state (and will be indefinitely — dismiss it)
336
- this.dismiss(id);
337
- id = undefined;
338
- }
339
- data.finally == null ? void 0 : data.finally.call(data);
340
- });
341
- const unwrap = ()=>new Promise((resolve, reject)=>originalPromise.then(()=>result[0] === 'reject' ? reject(result[1]) : resolve(result[1])).catch(reject));
342
- if (typeof id !== 'string' && typeof id !== 'number') {
343
- // cannot Object.assign on undefined
344
- return {
345
- unwrap
346
- };
347
- } else {
348
- return Object.assign(id, {
349
- unwrap
350
- });
351
- }
352
- };
353
- this.custom = (jsx, data)=>{
354
- const id = (data == null ? void 0 : data.id) || toastsCounter++;
355
- this.create({
356
- jsx: jsx(id),
357
- id,
358
- ...data
359
- });
360
- return id;
361
- };
362
- this.getActiveToasts = ()=>{
363
- return this.toasts.filter((toast)=>!this.dismissedToasts.has(toast.id));
364
- };
365
- this.subscribers = [];
366
- this.toasts = [];
367
- this.dismissedToasts = new Set();
368
- }
369
- }
370
- const ToastState = new Observer();
371
- // bind this to the toast function
372
- const toastFunction = (message, data)=>{
373
- const id = (data == null ? void 0 : data.id) || toastsCounter++;
374
- ToastState.addToast({
375
- title: message,
376
- ...data,
377
- id
378
- });
379
- return id;
380
- };
381
- const isHttpResponse = (data)=>{
382
- return data && typeof data === 'object' && 'ok' in data && typeof data.ok === 'boolean' && 'status' in data && typeof data.status === 'number';
383
- };
384
- const basicToast = toastFunction;
385
- const getHistory = ()=>ToastState.toasts;
386
- const getToasts = ()=>ToastState.getActiveToasts();
387
- // We use `Object.assign` to maintain the correct types as we would lose them otherwise
388
- const toast = Object.assign(basicToast, {
389
- success: ToastState.success,
390
- info: ToastState.info,
391
- warning: ToastState.warning,
392
- error: ToastState.error,
393
- custom: ToastState.custom,
394
- message: ToastState.message,
395
- promise: ToastState.promise,
396
- dismiss: ToastState.dismiss,
397
- loading: ToastState.loading
398
- }, {
399
- getHistory,
400
- getToasts
401
- });
402
-
403
- __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
404
-
405
- function isAction(action) {
406
- return action.label !== undefined;
407
- }
408
-
409
- // Visible toasts amount
410
- const VISIBLE_TOASTS_AMOUNT = 3;
411
- // Viewport padding
412
- const VIEWPORT_OFFSET = '24px';
413
- // Mobile viewport padding
414
- const MOBILE_VIEWPORT_OFFSET = '16px';
415
- // Default lifetime of a toasts (in ms)
416
- const TOAST_LIFETIME = 4000;
417
- // Default toast width
418
- const TOAST_WIDTH = 356;
419
- // Default gap between toasts
420
- const GAP = 14;
421
- // Threshold to dismiss a toast
422
- const SWIPE_THRESHOLD = 45;
423
- // Equal to exit animation duration
424
- const TIME_BEFORE_UNMOUNT = 200;
425
- function cn(...classes) {
426
- return classes.filter(Boolean).join(' ');
427
- }
428
- function getDefaultSwipeDirections(position) {
429
- const [y, x] = position.split('-');
430
- const directions = [];
431
- if (y) {
432
- directions.push(y);
433
- }
434
- if (x) {
435
- directions.push(x);
436
- }
437
- return directions;
438
- }
439
- const Toast = (props)=>{
440
- var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
441
- const { invert: ToasterInvert, toast, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = '', descriptionClassName = '', duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = 'Close toast' } = props;
442
- const [swipeDirection, setSwipeDirection] = React__default.useState(null);
443
- const [swipeOutDirection, setSwipeOutDirection] = React__default.useState(null);
444
- const [mounted, setMounted] = React__default.useState(false);
445
- const [removed, setRemoved] = React__default.useState(false);
446
- const [swiping, setSwiping] = React__default.useState(false);
447
- const [swipeOut, setSwipeOut] = React__default.useState(false);
448
- const [isSwiped, setIsSwiped] = React__default.useState(false);
449
- const [offsetBeforeRemove, setOffsetBeforeRemove] = React__default.useState(0);
450
- const [initialHeight, setInitialHeight] = React__default.useState(0);
451
- const remainingTime = React__default.useRef(toast.duration || durationFromToaster || TOAST_LIFETIME);
452
- const dragStartTime = React__default.useRef(null);
453
- const toastRef = React__default.useRef(null);
454
- const isFront = index === 0;
455
- const isVisible = index + 1 <= visibleToasts;
456
- const toastType = toast.type;
457
- const dismissible = toast.dismissible !== false;
458
- const toastClassname = toast.className || '';
459
- const toastDescriptionClassname = toast.descriptionClassName || '';
460
- // Height index is used to calculate the offset as it gets updated before the toast array, which means we can calculate the new layout faster.
461
- const heightIndex = React__default.useMemo(()=>heights.findIndex((height)=>height.toastId === toast.id) || 0, [
462
- heights,
463
- toast.id
464
- ]);
465
- const closeButton = React__default.useMemo(()=>{
466
- var _toast_closeButton;
467
- return (_toast_closeButton = toast.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
468
- }, [
469
- toast.closeButton,
470
- closeButtonFromToaster
471
- ]);
472
- const duration = React__default.useMemo(()=>toast.duration || durationFromToaster || TOAST_LIFETIME, [
473
- toast.duration,
474
- durationFromToaster
475
- ]);
476
- const closeTimerStartTimeRef = React__default.useRef(0);
477
- const offset = React__default.useRef(0);
478
- const lastCloseTimerStartTimeRef = React__default.useRef(0);
479
- const pointerStartRef = React__default.useRef(null);
480
- const [y, x] = position.split('-');
481
- const toastsHeightBefore = React__default.useMemo(()=>{
482
- return heights.reduce((prev, curr, reducerIndex)=>{
483
- // Calculate offset up until current toast
484
- if (reducerIndex >= heightIndex) {
485
- return prev;
486
- }
487
- return prev + curr.height;
488
- }, 0);
489
- }, [
490
- heights,
491
- heightIndex
492
- ]);
493
- const isDocumentHidden = useIsDocumentHidden();
494
- const invert = toast.invert || ToasterInvert;
495
- const disabled = toastType === 'loading';
496
- offset.current = React__default.useMemo(()=>heightIndex * gap + toastsHeightBefore, [
497
- heightIndex,
498
- toastsHeightBefore
499
- ]);
500
- React__default.useEffect(()=>{
501
- remainingTime.current = duration;
502
- }, [
503
- duration
504
- ]);
505
- React__default.useEffect(()=>{
506
- // Trigger enter animation without using CSS animation
507
- setMounted(true);
508
- }, []);
509
- React__default.useEffect(()=>{
510
- const toastNode = toastRef.current;
511
- if (toastNode) {
512
- const height = toastNode.getBoundingClientRect().height;
513
- // Add toast height to heights array after the toast is mounted
514
- setInitialHeight(height);
515
- setHeights((h)=>[
516
- {
517
- toastId: toast.id,
518
- height,
519
- position: toast.position
520
- },
521
- ...h
522
- ]);
523
- return ()=>setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));
524
- }
525
- }, [
526
- setHeights,
527
- toast.id
528
- ]);
529
- React__default.useLayoutEffect(()=>{
530
- // Keep height up to date with the content in case it updates
531
- if (!mounted) return;
532
- const toastNode = toastRef.current;
533
- const originalHeight = toastNode.style.height;
534
- toastNode.style.height = 'auto';
535
- const newHeight = toastNode.getBoundingClientRect().height;
536
- toastNode.style.height = originalHeight;
537
- setInitialHeight(newHeight);
538
- setHeights((heights)=>{
539
- const alreadyExists = heights.find((height)=>height.toastId === toast.id);
540
- if (!alreadyExists) {
541
- return [
542
- {
543
- toastId: toast.id,
544
- height: newHeight,
545
- position: toast.position
546
- },
547
- ...heights
548
- ];
549
- } else {
550
- return heights.map((height)=>height.toastId === toast.id ? {
551
- ...height,
552
- height: newHeight
553
- } : height);
554
- }
555
- });
556
- }, [
557
- mounted,
558
- toast.title,
559
- toast.description,
560
- setHeights,
561
- toast.id,
562
- toast.jsx,
563
- toast.action,
564
- toast.cancel
565
- ]);
566
- const deleteToast = React__default.useCallback(()=>{
567
- // Save the offset for the exit swipe animation
568
- setRemoved(true);
569
- setOffsetBeforeRemove(offset.current);
570
- setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));
571
- setTimeout(()=>{
572
- removeToast(toast);
573
- }, TIME_BEFORE_UNMOUNT);
574
- }, [
575
- toast,
576
- removeToast,
577
- setHeights,
578
- offset
579
- ]);
580
- React__default.useEffect(()=>{
581
- if (toast.promise && toastType === 'loading' || toast.duration === Infinity || toast.type === 'loading') return;
582
- let timeoutId;
583
- // Pause the timer on each hover
584
- const pauseTimer = ()=>{
585
- if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
586
- // Get the elapsed time since the timer started
587
- const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;
588
- remainingTime.current = remainingTime.current - elapsedTime;
589
- }
590
- lastCloseTimerStartTimeRef.current = new Date().getTime();
591
- };
592
- const startTimer = ()=>{
593
- // setTimeout(, Infinity) behaves as if the delay is 0.
594
- // As a result, the toast would be closed immediately, giving the appearance that it was never rendered.
595
- // See: https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#an-infinite-timeout
596
- if (remainingTime.current === Infinity) return;
597
- closeTimerStartTimeRef.current = new Date().getTime();
598
- // Let the toast know it has started
599
- timeoutId = setTimeout(()=>{
600
- toast.onAutoClose == null ? void 0 : toast.onAutoClose.call(toast, toast);
601
- deleteToast();
602
- }, remainingTime.current);
603
- };
604
- if (expanded || interacting || isDocumentHidden) {
605
- pauseTimer();
606
- } else {
607
- startTimer();
608
- }
609
- return ()=>clearTimeout(timeoutId);
610
- }, [
611
- expanded,
612
- interacting,
613
- toast,
614
- toastType,
615
- isDocumentHidden,
616
- deleteToast
617
- ]);
618
- React__default.useEffect(()=>{
619
- if (toast.delete) {
620
- deleteToast();
621
- toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
622
- }
623
- }, [
624
- deleteToast,
625
- toast.delete
626
- ]);
627
- function getLoadingIcon() {
628
- var _toast_classNames;
629
- if (icons == null ? void 0 : icons.loading) {
630
- var _toast_classNames1;
631
- return /*#__PURE__*/ React__default.createElement("div", {
632
- className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1.loader, 'sonner-loader'),
633
- "data-visible": toastType === 'loading'
634
- }, icons.loading);
635
- }
636
- return /*#__PURE__*/ React__default.createElement(Loader, {
637
- className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.loader),
638
- visible: toastType === 'loading'
639
- });
640
- }
641
- const icon = toast.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
642
- var _toast_richColors, _icons_close;
643
- return /*#__PURE__*/ React__default.createElement("li", {
644
- tabIndex: 0,
645
- ref: toastRef,
646
- className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1[toastType]),
647
- "data-sonner-toast": "",
648
- "data-rich-colors": (_toast_richColors = toast.richColors) != null ? _toast_richColors : defaultRichColors,
649
- "data-styled": !Boolean(toast.jsx || toast.unstyled || unstyled),
650
- "data-mounted": mounted,
651
- "data-promise": Boolean(toast.promise),
652
- "data-swiped": isSwiped,
653
- "data-removed": removed,
654
- "data-visible": isVisible,
655
- "data-y-position": y,
656
- "data-x-position": x,
657
- "data-index": index,
658
- "data-front": isFront,
659
- "data-swiping": swiping,
660
- "data-dismissible": dismissible,
661
- "data-type": toastType,
662
- "data-invert": invert,
663
- "data-swipe-out": swipeOut,
664
- "data-swipe-direction": swipeOutDirection,
665
- "data-expanded": Boolean(expanded || expandByDefault && mounted),
666
- "data-testid": toast.testId,
667
- style: {
668
- '--index': index,
669
- '--toasts-before': index,
670
- '--z-index': toasts.length - index,
671
- '--offset': `${removed ? offsetBeforeRemove : offset.current}px`,
672
- '--initial-height': expandByDefault ? 'auto' : `${initialHeight}px`,
673
- ...style,
674
- ...toast.style
675
- },
676
- onDragEnd: ()=>{
677
- setSwiping(false);
678
- setSwipeDirection(null);
679
- pointerStartRef.current = null;
680
- },
681
- onPointerDown: (event)=>{
682
- if (event.button === 2) return; // Return early on right click
683
- if (disabled || !dismissible) return;
684
- dragStartTime.current = new Date();
685
- setOffsetBeforeRemove(offset.current);
686
- // Ensure we maintain correct pointer capture even when going outside of the toast (e.g. when swiping)
687
- event.target.setPointerCapture(event.pointerId);
688
- if (event.target.tagName === 'BUTTON') return;
689
- setSwiping(true);
690
- pointerStartRef.current = {
691
- x: event.clientX,
692
- y: event.clientY
693
- };
694
- },
695
- onPointerUp: ()=>{
696
- var _toastRef_current, _toastRef_current1, _dragStartTime_current;
697
- if (swipeOut || !dismissible) return;
698
- pointerStartRef.current = null;
699
- const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue('--swipe-amount-x').replace('px', '')) || 0);
700
- const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue('--swipe-amount-y').replace('px', '')) || 0);
701
- const timeTaken = new Date().getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
702
- const swipeAmount = swipeDirection === 'x' ? swipeAmountX : swipeAmountY;
703
- const velocity = Math.abs(swipeAmount) / timeTaken;
704
- if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
705
- setOffsetBeforeRemove(offset.current);
706
- toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
707
- if (swipeDirection === 'x') {
708
- setSwipeOutDirection(swipeAmountX > 0 ? 'right' : 'left');
709
- } else {
710
- setSwipeOutDirection(swipeAmountY > 0 ? 'down' : 'up');
711
- }
712
- deleteToast();
713
- setSwipeOut(true);
714
- return;
715
- } else {
716
- var _toastRef_current2, _toastRef_current3;
717
- (_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty('--swipe-amount-x', `0px`);
718
- (_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty('--swipe-amount-y', `0px`);
719
- }
720
- setIsSwiped(false);
721
- setSwiping(false);
722
- setSwipeDirection(null);
723
- },
724
- onPointerMove: (event)=>{
725
- var _window_getSelection, // Apply transform using both x and y values
726
- _toastRef_current, _toastRef_current1;
727
- if (!pointerStartRef.current || !dismissible) return;
728
- const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
729
- if (isHighlighted) return;
730
- const yDelta = event.clientY - pointerStartRef.current.y;
731
- const xDelta = event.clientX - pointerStartRef.current.x;
732
- var _props_swipeDirections;
733
- const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
734
- // Determine swipe direction if not already locked
735
- if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
736
- setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? 'x' : 'y');
737
- }
738
- let swipeAmount = {
739
- x: 0,
740
- y: 0
741
- };
742
- const getDampening = (delta)=>{
743
- const factor = Math.abs(delta) / 20;
744
- return 1 / (1.5 + factor);
745
- };
746
- // Only apply swipe in the locked direction
747
- if (swipeDirection === 'y') {
748
- // Handle vertical swipes
749
- if (swipeDirections.includes('top') || swipeDirections.includes('bottom')) {
750
- if (swipeDirections.includes('top') && yDelta < 0 || swipeDirections.includes('bottom') && yDelta > 0) {
751
- swipeAmount.y = yDelta;
752
- } else {
753
- // Smoothly transition to dampened movement
754
- const dampenedDelta = yDelta * getDampening(yDelta);
755
- // Ensure we don't jump when transitioning to dampened movement
756
- swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
757
- }
758
- }
759
- } else if (swipeDirection === 'x') {
760
- // Handle horizontal swipes
761
- if (swipeDirections.includes('left') || swipeDirections.includes('right')) {
762
- if (swipeDirections.includes('left') && xDelta < 0 || swipeDirections.includes('right') && xDelta > 0) {
763
- swipeAmount.x = xDelta;
764
- } else {
765
- // Smoothly transition to dampened movement
766
- const dampenedDelta = xDelta * getDampening(xDelta);
767
- // Ensure we don't jump when transitioning to dampened movement
768
- swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
769
- }
770
- }
771
- }
772
- if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
773
- setIsSwiped(true);
774
- }
775
- (_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty('--swipe-amount-x', `${swipeAmount.x}px`);
776
- (_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty('--swipe-amount-y', `${swipeAmount.y}px`);
777
- }
778
- }, closeButton && !toast.jsx && toastType !== 'loading' ? /*#__PURE__*/ React__default.createElement("button", {
779
- "aria-label": closeButtonAriaLabel,
780
- "data-disabled": disabled,
781
- "data-close-button": true,
782
- onClick: disabled || !dismissible ? ()=>{} : ()=>{
783
- deleteToast();
784
- toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
785
- },
786
- className: cn(classNames == null ? void 0 : classNames.closeButton, toast == null ? void 0 : (_toast_classNames2 = toast.classNames) == null ? void 0 : _toast_classNames2.closeButton)
787
- }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast.icon || toast.promise) && toast.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast.icon) ? /*#__PURE__*/ React__default.createElement("div", {
788
- "data-icon": "",
789
- className: cn(classNames == null ? void 0 : classNames.icon, toast == null ? void 0 : (_toast_classNames3 = toast.classNames) == null ? void 0 : _toast_classNames3.icon)
790
- }, toast.promise || toast.type === 'loading' && !toast.icon ? toast.icon || getLoadingIcon() : null, toast.type !== 'loading' ? icon : null) : null, /*#__PURE__*/ React__default.createElement("div", {
791
- "data-content": "",
792
- className: cn(classNames == null ? void 0 : classNames.content, toast == null ? void 0 : (_toast_classNames4 = toast.classNames) == null ? void 0 : _toast_classNames4.content)
793
- }, /*#__PURE__*/ React__default.createElement("div", {
794
- "data-title": "",
795
- className: cn(classNames == null ? void 0 : classNames.title, toast == null ? void 0 : (_toast_classNames5 = toast.classNames) == null ? void 0 : _toast_classNames5.title)
796
- }, toast.jsx ? toast.jsx : typeof toast.title === 'function' ? toast.title() : toast.title), toast.description ? /*#__PURE__*/ React__default.createElement("div", {
797
- "data-description": "",
798
- className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast == null ? void 0 : (_toast_classNames6 = toast.classNames) == null ? void 0 : _toast_classNames6.description)
799
- }, typeof toast.description === 'function' ? toast.description() : toast.description) : null), /*#__PURE__*/ React__default.isValidElement(toast.cancel) ? toast.cancel : toast.cancel && isAction(toast.cancel) ? /*#__PURE__*/ React__default.createElement("button", {
800
- "data-button": true,
801
- "data-cancel": true,
802
- style: toast.cancelButtonStyle || cancelButtonStyle,
803
- onClick: (event)=>{
804
- // We need to check twice because typescript
805
- if (!isAction(toast.cancel)) return;
806
- if (!dismissible) return;
807
- toast.cancel.onClick == null ? void 0 : toast.cancel.onClick.call(toast.cancel, event);
808
- deleteToast();
809
- },
810
- className: cn(classNames == null ? void 0 : classNames.cancelButton, toast == null ? void 0 : (_toast_classNames7 = toast.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
811
- }, toast.cancel.label) : null, /*#__PURE__*/ React__default.isValidElement(toast.action) ? toast.action : toast.action && isAction(toast.action) ? /*#__PURE__*/ React__default.createElement("button", {
812
- "data-button": true,
813
- "data-action": true,
814
- style: toast.actionButtonStyle || actionButtonStyle,
815
- onClick: (event)=>{
816
- // We need to check twice because typescript
817
- if (!isAction(toast.action)) return;
818
- toast.action.onClick == null ? void 0 : toast.action.onClick.call(toast.action, event);
819
- if (event.defaultPrevented) return;
820
- deleteToast();
821
- },
822
- className: cn(classNames == null ? void 0 : classNames.actionButton, toast == null ? void 0 : (_toast_classNames8 = toast.classNames) == null ? void 0 : _toast_classNames8.actionButton)
823
- }, toast.action.label) : null);
824
- };
825
- function getDocumentDirection() {
826
- if (typeof window === 'undefined') return 'ltr';
827
- if (typeof document === 'undefined') return 'ltr'; // For Fresh purpose
828
- const dirAttribute = document.documentElement.getAttribute('dir');
829
- if (dirAttribute === 'auto' || !dirAttribute) {
830
- return window.getComputedStyle(document.documentElement).direction;
831
- }
832
- return dirAttribute;
833
- }
834
- function assignOffset(defaultOffset, mobileOffset) {
835
- const styles = {};
836
- [
837
- defaultOffset,
838
- mobileOffset
839
- ].forEach((offset, index)=>{
840
- const isMobile = index === 1;
841
- const prefix = isMobile ? '--mobile-offset' : '--offset';
842
- const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
843
- function assignAll(offset) {
844
- [
845
- 'top',
846
- 'right',
847
- 'bottom',
848
- 'left'
849
- ].forEach((key)=>{
850
- styles[`${prefix}-${key}`] = typeof offset === 'number' ? `${offset}px` : offset;
851
- });
852
- }
853
- if (typeof offset === 'number' || typeof offset === 'string') {
854
- assignAll(offset);
855
- } else if (typeof offset === 'object') {
856
- [
857
- 'top',
858
- 'right',
859
- 'bottom',
860
- 'left'
861
- ].forEach((key)=>{
862
- if (offset[key] === undefined) {
863
- styles[`${prefix}-${key}`] = defaultValue;
864
- } else {
865
- styles[`${prefix}-${key}`] = typeof offset[key] === 'number' ? `${offset[key]}px` : offset[key];
866
- }
867
- });
868
- } else {
869
- assignAll(defaultValue);
870
- }
871
- });
872
- return styles;
1
+ import * as React from 'react';
2
+ import { u as useLayoutEffect2 } from './index30.js';
3
+
4
+ // packages/react/id/src/id.tsx
5
+ var useReactId = React[" useId ".trim().toString()] || (() => void 0);
6
+ var count = 0;
7
+ function useId(deterministicId) {
8
+ const [id, setId] = React.useState(useReactId());
9
+ useLayoutEffect2(() => {
10
+ setId((reactId) => reactId ?? String(count++));
11
+ }, [deterministicId]);
12
+ return (id ? `radix-${id}` : "");
873
13
  }
874
- const Toaster = /*#__PURE__*/ React__default.forwardRef(function Toaster(props, ref) {
875
- const { id, invert, position = 'bottom-right', hotkey = [
876
- 'altKey',
877
- 'KeyT'
878
- ], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = 'Notifications' } = props;
879
- const [toasts, setToasts] = React__default.useState([]);
880
- const filteredToasts = React__default.useMemo(()=>{
881
- if (id) {
882
- return toasts.filter((toast)=>toast.toasterId === id);
883
- }
884
- return toasts.filter((toast)=>!toast.toasterId);
885
- }, [
886
- toasts,
887
- id
888
- ]);
889
- const possiblePositions = React__default.useMemo(()=>{
890
- return Array.from(new Set([
891
- position
892
- ].concat(filteredToasts.filter((toast)=>toast.position).map((toast)=>toast.position))));
893
- }, [
894
- filteredToasts,
895
- position
896
- ]);
897
- const [heights, setHeights] = React__default.useState([]);
898
- const [expanded, setExpanded] = React__default.useState(false);
899
- const [interacting, setInteracting] = React__default.useState(false);
900
- const [actualTheme, setActualTheme] = React__default.useState(theme !== 'system' ? theme : typeof window !== 'undefined' ? window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' : 'light');
901
- const listRef = React__default.useRef(null);
902
- const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, '');
903
- const lastFocusedElementRef = React__default.useRef(null);
904
- const isFocusWithinRef = React__default.useRef(false);
905
- const removeToast = React__default.useCallback((toastToRemove)=>{
906
- setToasts((toasts)=>{
907
- var _toasts_find;
908
- if (!((_toasts_find = toasts.find((toast)=>toast.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
909
- ToastState.dismiss(toastToRemove.id);
910
- }
911
- return toasts.filter(({ id })=>id !== toastToRemove.id);
912
- });
913
- }, []);
914
- React__default.useEffect(()=>{
915
- return ToastState.subscribe((toast)=>{
916
- if (toast.dismiss) {
917
- // Prevent batching of other state updates
918
- requestAnimationFrame(()=>{
919
- setToasts((toasts)=>toasts.map((t)=>t.id === toast.id ? {
920
- ...t,
921
- delete: true
922
- } : t));
923
- });
924
- return;
925
- }
926
- // Prevent batching, temp solution.
927
- setTimeout(()=>{
928
- ReactDOM__default.flushSync(()=>{
929
- setToasts((toasts)=>{
930
- const indexOfExistingToast = toasts.findIndex((t)=>t.id === toast.id);
931
- // Update the toast if it already exists
932
- if (indexOfExistingToast !== -1) {
933
- return [
934
- ...toasts.slice(0, indexOfExistingToast),
935
- {
936
- ...toasts[indexOfExistingToast],
937
- ...toast
938
- },
939
- ...toasts.slice(indexOfExistingToast + 1)
940
- ];
941
- }
942
- return [
943
- toast,
944
- ...toasts
945
- ];
946
- });
947
- });
948
- });
949
- });
950
- }, [
951
- toasts
952
- ]);
953
- React__default.useEffect(()=>{
954
- if (theme !== 'system') {
955
- setActualTheme(theme);
956
- return;
957
- }
958
- if (theme === 'system') {
959
- // check if current preference is dark
960
- if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
961
- // it's currently dark
962
- setActualTheme('dark');
963
- } else {
964
- // it's not dark
965
- setActualTheme('light');
966
- }
967
- }
968
- if (typeof window === 'undefined') return;
969
- const darkMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
970
- try {
971
- // Chrome & Firefox
972
- darkMediaQuery.addEventListener('change', ({ matches })=>{
973
- if (matches) {
974
- setActualTheme('dark');
975
- } else {
976
- setActualTheme('light');
977
- }
978
- });
979
- } catch (error) {
980
- // Safari < 14
981
- darkMediaQuery.addListener(({ matches })=>{
982
- try {
983
- if (matches) {
984
- setActualTheme('dark');
985
- } else {
986
- setActualTheme('light');
987
- }
988
- } catch (e) {
989
- console.error(e);
990
- }
991
- });
992
- }
993
- }, [
994
- theme
995
- ]);
996
- React__default.useEffect(()=>{
997
- // Ensure expanded is always false when no toasts are present / only one left
998
- if (toasts.length <= 1) {
999
- setExpanded(false);
1000
- }
1001
- }, [
1002
- toasts
1003
- ]);
1004
- React__default.useEffect(()=>{
1005
- const handleKeyDown = (event)=>{
1006
- var _listRef_current;
1007
- const isHotkeyPressed = hotkey.every((key)=>event[key] || event.code === key);
1008
- if (isHotkeyPressed) {
1009
- var _listRef_current1;
1010
- setExpanded(true);
1011
- (_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
1012
- }
1013
- if (event.code === 'Escape' && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {
1014
- setExpanded(false);
1015
- }
1016
- };
1017
- document.addEventListener('keydown', handleKeyDown);
1018
- return ()=>document.removeEventListener('keydown', handleKeyDown);
1019
- }, [
1020
- hotkey
1021
- ]);
1022
- React__default.useEffect(()=>{
1023
- if (listRef.current) {
1024
- return ()=>{
1025
- if (lastFocusedElementRef.current) {
1026
- lastFocusedElementRef.current.focus({
1027
- preventScroll: true
1028
- });
1029
- lastFocusedElementRef.current = null;
1030
- isFocusWithinRef.current = false;
1031
- }
1032
- };
1033
- }
1034
- }, [
1035
- listRef.current
1036
- ]);
1037
- return(// Remove item from normal navigation flow, only available via hotkey
1038
- /*#__PURE__*/ React__default.createElement("section", {
1039
- ref: ref,
1040
- "aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
1041
- tabIndex: -1,
1042
- "aria-live": "polite",
1043
- "aria-relevant": "additions text",
1044
- "aria-atomic": "false",
1045
- suppressHydrationWarning: true
1046
- }, possiblePositions.map((position, index)=>{
1047
- var _heights_;
1048
- const [y, x] = position.split('-');
1049
- if (!filteredToasts.length) return null;
1050
- return /*#__PURE__*/ React__default.createElement("ol", {
1051
- key: position,
1052
- dir: dir === 'auto' ? getDocumentDirection() : dir,
1053
- tabIndex: -1,
1054
- ref: listRef,
1055
- className: className,
1056
- "data-sonner-toaster": true,
1057
- "data-sonner-theme": actualTheme,
1058
- "data-y-position": y,
1059
- "data-x-position": x,
1060
- style: {
1061
- '--front-toast-height': `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
1062
- '--width': `${TOAST_WIDTH}px`,
1063
- '--gap': `${gap}px`,
1064
- ...style,
1065
- ...assignOffset(offset, mobileOffset)
1066
- },
1067
- onBlur: (event)=>{
1068
- if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
1069
- isFocusWithinRef.current = false;
1070
- if (lastFocusedElementRef.current) {
1071
- lastFocusedElementRef.current.focus({
1072
- preventScroll: true
1073
- });
1074
- lastFocusedElementRef.current = null;
1075
- }
1076
- }
1077
- },
1078
- onFocus: (event)=>{
1079
- const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';
1080
- if (isNotDismissible) return;
1081
- if (!isFocusWithinRef.current) {
1082
- isFocusWithinRef.current = true;
1083
- lastFocusedElementRef.current = event.relatedTarget;
1084
- }
1085
- },
1086
- onMouseEnter: ()=>setExpanded(true),
1087
- onMouseMove: ()=>setExpanded(true),
1088
- onMouseLeave: ()=>{
1089
- // Avoid setting expanded to false when interacting with a toast, e.g. swiping
1090
- if (!interacting) {
1091
- setExpanded(false);
1092
- }
1093
- },
1094
- onDragEnd: ()=>setExpanded(false),
1095
- onPointerDown: (event)=>{
1096
- const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';
1097
- if (isNotDismissible) return;
1098
- setInteracting(true);
1099
- },
1100
- onPointerUp: ()=>setInteracting(false)
1101
- }, filteredToasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{
1102
- var _toastOptions_duration, _toastOptions_closeButton;
1103
- return /*#__PURE__*/ React__default.createElement(Toast, {
1104
- key: toast.id,
1105
- icons: icons,
1106
- index: index,
1107
- toast: toast,
1108
- defaultRichColors: richColors,
1109
- duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration,
1110
- className: toastOptions == null ? void 0 : toastOptions.className,
1111
- descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
1112
- invert: invert,
1113
- visibleToasts: visibleToasts,
1114
- closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
1115
- interacting: interacting,
1116
- position: position,
1117
- style: toastOptions == null ? void 0 : toastOptions.style,
1118
- unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
1119
- classNames: toastOptions == null ? void 0 : toastOptions.classNames,
1120
- cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
1121
- actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
1122
- closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
1123
- removeToast: removeToast,
1124
- toasts: filteredToasts.filter((t)=>t.position == toast.position),
1125
- heights: heights.filter((h)=>h.position == toast.position),
1126
- setHeights: setHeights,
1127
- expandByDefault: expand,
1128
- gap: gap,
1129
- expanded: expanded,
1130
- swipeDirections: props.swipeDirections
1131
- });
1132
- }));
1133
- })));
1134
- });
1135
14
 
1136
- export { Toaster as T, toast as t };
15
+ export { useId as u };
1137
16
  //# sourceMappingURL=index25.js.map