@intlayer/design-system 6.1.5 → 6.1.6-canary.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 (301) hide show
  1. package/dist/.vite/manifest.json +13 -9
  2. package/dist/Form-CriPBaZk.js.map +1 -1
  3. package/dist/Form-DJrUK3mm.cjs.map +1 -1
  4. package/dist/components/Accordion/Accordion.cjs +51 -15
  5. package/dist/components/Accordion/Accordion.cjs.map +1 -1
  6. package/dist/components/Accordion/Accordion.d.ts +44 -5
  7. package/dist/components/Accordion/Accordion.d.ts.map +1 -1
  8. package/dist/components/Accordion/Accordion.mjs +52 -16
  9. package/dist/components/Accordion/Accordion.mjs.map +1 -1
  10. package/dist/components/Avatar/index.cjs +114 -31
  11. package/dist/components/Avatar/index.cjs.map +1 -1
  12. package/dist/components/Avatar/index.d.ts +46 -2
  13. package/dist/components/Avatar/index.d.ts.map +1 -1
  14. package/dist/components/Avatar/index.mjs +115 -32
  15. package/dist/components/Avatar/index.mjs.map +1 -1
  16. package/dist/components/Badge/index.cjs +88 -9
  17. package/dist/components/Badge/index.cjs.map +1 -1
  18. package/dist/components/Badge/index.d.ts +80 -2
  19. package/dist/components/Badge/index.d.ts.map +1 -1
  20. package/dist/components/Badge/index.mjs +89 -10
  21. package/dist/components/Badge/index.mjs.map +1 -1
  22. package/dist/components/Breadcrumb/index.cjs +124 -59
  23. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  24. package/dist/components/Breadcrumb/index.d.ts +89 -5
  25. package/dist/components/Breadcrumb/index.d.ts.map +1 -1
  26. package/dist/components/Breadcrumb/index.mjs +124 -59
  27. package/dist/components/Breadcrumb/index.mjs.map +1 -1
  28. package/dist/components/Button/Button.cjs +44 -25
  29. package/dist/components/Button/Button.cjs.map +1 -1
  30. package/dist/components/Button/Button.d.ts +95 -1
  31. package/dist/components/Button/Button.d.ts.map +1 -1
  32. package/dist/components/Button/Button.mjs +44 -25
  33. package/dist/components/Button/Button.mjs.map +1 -1
  34. package/dist/components/ClickOutsideDiv/index.cjs +38 -7
  35. package/dist/components/ClickOutsideDiv/index.cjs.map +1 -1
  36. package/dist/components/ClickOutsideDiv/index.d.ts +13 -0
  37. package/dist/components/ClickOutsideDiv/index.d.ts.map +1 -1
  38. package/dist/components/ClickOutsideDiv/index.mjs +39 -8
  39. package/dist/components/ClickOutsideDiv/index.mjs.map +1 -1
  40. package/dist/components/Container/index.cjs +2 -0
  41. package/dist/components/Container/index.cjs.map +1 -1
  42. package/dist/components/Container/index.d.ts +42 -0
  43. package/dist/components/Container/index.d.ts.map +1 -1
  44. package/dist/components/Container/index.mjs +2 -0
  45. package/dist/components/Container/index.mjs.map +1 -1
  46. package/dist/components/ContentEditor/ContentEditor.cjs +80 -33
  47. package/dist/components/ContentEditor/ContentEditor.cjs.map +1 -1
  48. package/dist/components/ContentEditor/ContentEditor.d.ts +29 -0
  49. package/dist/components/ContentEditor/ContentEditor.d.ts.map +1 -1
  50. package/dist/components/ContentEditor/ContentEditor.mjs +80 -33
  51. package/dist/components/ContentEditor/ContentEditor.mjs.map +1 -1
  52. package/dist/components/ContentEditor/ContentEditorInput.cjs +58 -31
  53. package/dist/components/ContentEditor/ContentEditorInput.cjs.map +1 -1
  54. package/dist/components/ContentEditor/ContentEditorInput.d.ts +33 -0
  55. package/dist/components/ContentEditor/ContentEditorInput.d.ts.map +1 -1
  56. package/dist/components/ContentEditor/ContentEditorInput.mjs +58 -31
  57. package/dist/components/ContentEditor/ContentEditorInput.mjs.map +1 -1
  58. package/dist/components/ContentEditor/ContentEditorTextArea.cjs +58 -30
  59. package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
  60. package/dist/components/ContentEditor/ContentEditorTextArea.d.ts +35 -0
  61. package/dist/components/ContentEditor/ContentEditorTextArea.d.ts.map +1 -1
  62. package/dist/components/ContentEditor/ContentEditorTextArea.mjs +59 -31
  63. package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
  64. package/dist/components/ContentEditor/index.cjs +4 -0
  65. package/dist/components/ContentEditor/index.cjs.map +1 -1
  66. package/dist/components/ContentEditor/index.d.ts +2 -0
  67. package/dist/components/ContentEditor/index.d.ts.map +1 -1
  68. package/dist/components/ContentEditor/index.mjs +5 -1
  69. package/dist/components/ContentEditor/index.mjs.map +1 -1
  70. package/dist/components/ContentSelector/ContentSelector.cjs +9 -1
  71. package/dist/components/ContentSelector/ContentSelector.cjs.map +1 -1
  72. package/dist/components/ContentSelector/ContentSelector.d.ts +167 -0
  73. package/dist/components/ContentSelector/ContentSelector.d.ts.map +1 -1
  74. package/dist/components/ContentSelector/ContentSelector.mjs +9 -1
  75. package/dist/components/ContentSelector/ContentSelector.mjs.map +1 -1
  76. package/dist/components/CopyButton/index.cjs +23 -8
  77. package/dist/components/CopyButton/index.cjs.map +1 -1
  78. package/dist/components/CopyButton/index.d.ts +78 -0
  79. package/dist/components/CopyButton/index.d.ts.map +1 -1
  80. package/dist/components/CopyButton/index.mjs +23 -8
  81. package/dist/components/CopyButton/index.mjs.map +1 -1
  82. package/dist/components/CopyToClipboard/index.cjs +58 -22
  83. package/dist/components/CopyToClipboard/index.cjs.map +1 -1
  84. package/dist/components/CopyToClipboard/index.d.ts +68 -2
  85. package/dist/components/CopyToClipboard/index.d.ts.map +1 -1
  86. package/dist/components/CopyToClipboard/index.mjs +59 -23
  87. package/dist/components/CopyToClipboard/index.mjs.map +1 -1
  88. package/dist/components/DropDown/index.cjs +6 -4
  89. package/dist/components/DropDown/index.cjs.map +1 -1
  90. package/dist/components/DropDown/index.d.ts +92 -15
  91. package/dist/components/DropDown/index.d.ts.map +1 -1
  92. package/dist/components/DropDown/index.mjs +6 -4
  93. package/dist/components/DropDown/index.mjs.map +1 -1
  94. package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
  95. package/dist/components/EditableField/EditableFieldInput.d.ts +38 -0
  96. package/dist/components/EditableField/EditableFieldInput.d.ts.map +1 -1
  97. package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
  98. package/dist/components/EditableField/EditableFieldLayout.cjs +10 -2
  99. package/dist/components/EditableField/EditableFieldLayout.cjs.map +1 -1
  100. package/dist/components/EditableField/EditableFieldLayout.d.ts.map +1 -1
  101. package/dist/components/EditableField/EditableFieldLayout.mjs +10 -2
  102. package/dist/components/EditableField/EditableFieldLayout.mjs.map +1 -1
  103. package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
  104. package/dist/components/EditableField/EditableFieldTextArea.d.ts +42 -0
  105. package/dist/components/EditableField/EditableFieldTextArea.d.ts.map +1 -1
  106. package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
  107. package/dist/components/ExpandCollapse/ExpandCollapse.cjs.map +1 -1
  108. package/dist/components/ExpandCollapse/ExpandCollapse.d.ts +58 -0
  109. package/dist/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
  110. package/dist/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
  111. package/dist/components/Footer/index.cjs.map +1 -1
  112. package/dist/components/Footer/index.d.ts +101 -0
  113. package/dist/components/Footer/index.d.ts.map +1 -1
  114. package/dist/components/Footer/index.mjs.map +1 -1
  115. package/dist/components/Form/elements/MultiselectElement.d.ts.map +1 -1
  116. package/dist/components/Form/elements/SelectElement.d.ts.map +1 -1
  117. package/dist/components/Form/elements/SwitchSelectorElement.d.ts.map +1 -1
  118. package/dist/components/Headers/index.cjs.map +1 -1
  119. package/dist/components/Headers/index.d.ts +69 -2
  120. package/dist/components/Headers/index.d.ts.map +1 -1
  121. package/dist/components/Headers/index.mjs.map +1 -1
  122. package/dist/components/HeightResizer/index.cjs +10 -7
  123. package/dist/components/HeightResizer/index.cjs.map +1 -1
  124. package/dist/components/HeightResizer/index.d.ts +89 -0
  125. package/dist/components/HeightResizer/index.d.ts.map +1 -1
  126. package/dist/components/HeightResizer/index.mjs +10 -7
  127. package/dist/components/HeightResizer/index.mjs.map +1 -1
  128. package/dist/components/InformationTag/index.cjs.map +1 -1
  129. package/dist/components/InformationTag/index.d.ts +72 -0
  130. package/dist/components/InformationTag/index.d.ts.map +1 -1
  131. package/dist/components/InformationTag/index.mjs.map +1 -1
  132. package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -1
  133. package/dist/components/KeyboardScreenAdapter/index.d.ts +100 -0
  134. package/dist/components/KeyboardScreenAdapter/index.d.ts.map +1 -1
  135. package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -1
  136. package/dist/components/Label/index.cjs +25 -3
  137. package/dist/components/Label/index.cjs.map +1 -1
  138. package/dist/components/Label/index.d.ts +65 -1
  139. package/dist/components/Label/index.d.ts.map +1 -1
  140. package/dist/components/Label/index.mjs +26 -4
  141. package/dist/components/Label/index.mjs.map +1 -1
  142. package/dist/components/Link/Link.cjs.map +1 -1
  143. package/dist/components/Link/Link.d.ts +169 -0
  144. package/dist/components/Link/Link.d.ts.map +1 -1
  145. package/dist/components/Link/Link.mjs.map +1 -1
  146. package/dist/components/Loader/index.cjs.map +1 -1
  147. package/dist/components/Loader/index.d.ts +82 -11
  148. package/dist/components/Loader/index.d.ts.map +1 -1
  149. package/dist/components/Loader/index.mjs.map +1 -1
  150. package/dist/components/Loader/spinner.cjs.map +1 -1
  151. package/dist/components/Loader/spinner.d.ts +56 -0
  152. package/dist/components/Loader/spinner.d.ts.map +1 -1
  153. package/dist/components/Loader/spinner.mjs.map +1 -1
  154. package/dist/components/MarkDownRender/MarkDownRender.cjs +0 -1
  155. package/dist/components/MarkDownRender/MarkDownRender.cjs.map +1 -1
  156. package/dist/components/MarkDownRender/MarkDownRender.d.ts +147 -0
  157. package/dist/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
  158. package/dist/components/MarkDownRender/MarkDownRender.mjs +0 -1
  159. package/dist/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
  160. package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
  161. package/dist/components/MaxHeightSmoother/index.d.ts +152 -0
  162. package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
  163. package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
  164. package/dist/components/Modal/Modal.cjs +5 -0
  165. package/dist/components/Modal/Modal.cjs.map +1 -1
  166. package/dist/components/Modal/Modal.d.ts +81 -3
  167. package/dist/components/Modal/Modal.d.ts.map +1 -1
  168. package/dist/components/Modal/Modal.mjs +5 -0
  169. package/dist/components/Modal/Modal.mjs.map +1 -1
  170. package/dist/components/Navbar/Burger.cjs.map +1 -1
  171. package/dist/components/Navbar/Burger.d.ts +54 -0
  172. package/dist/components/Navbar/Burger.d.ts.map +1 -1
  173. package/dist/components/Navbar/Burger.mjs.map +1 -1
  174. package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
  175. package/dist/components/Navbar/DesktopNavbar.d.ts +78 -0
  176. package/dist/components/Navbar/DesktopNavbar.d.ts.map +1 -1
  177. package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
  178. package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
  179. package/dist/components/Navbar/MobileNavbar.d.ts +88 -0
  180. package/dist/components/Navbar/MobileNavbar.d.ts.map +1 -1
  181. package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
  182. package/dist/components/Navbar/index.cjs.map +1 -1
  183. package/dist/components/Navbar/index.d.ts +69 -0
  184. package/dist/components/Navbar/index.d.ts.map +1 -1
  185. package/dist/components/Navbar/index.mjs.map +1 -1
  186. package/dist/components/Navbar/useNavigation.cjs +8 -1
  187. package/dist/components/Navbar/useNavigation.cjs.map +1 -1
  188. package/dist/components/Navbar/useNavigation.d.ts +83 -0
  189. package/dist/components/Navbar/useNavigation.d.ts.map +1 -1
  190. package/dist/components/Navbar/useNavigation.mjs +8 -1
  191. package/dist/components/Navbar/useNavigation.mjs.map +1 -1
  192. package/dist/components/Pattern/DotPattern.cjs.map +1 -1
  193. package/dist/components/Pattern/DotPattern.d.ts +101 -0
  194. package/dist/components/Pattern/DotPattern.d.ts.map +1 -1
  195. package/dist/components/Pattern/DotPattern.mjs.map +1 -1
  196. package/dist/components/Pattern/GridPattern.cjs.map +1 -1
  197. package/dist/components/Pattern/GridPattern.d.ts +114 -0
  198. package/dist/components/Pattern/GridPattern.d.ts.map +1 -1
  199. package/dist/components/Pattern/GridPattern.mjs.map +1 -1
  200. package/dist/components/Pattern/SpotLight.cjs.map +1 -1
  201. package/dist/components/Pattern/SpotLight.d.ts +125 -0
  202. package/dist/components/Pattern/SpotLight.d.ts.map +1 -1
  203. package/dist/components/Pattern/SpotLight.mjs.map +1 -1
  204. package/dist/components/Popover/index.cjs +10 -10
  205. package/dist/components/Popover/index.cjs.map +1 -1
  206. package/dist/components/Popover/index.d.ts +110 -15
  207. package/dist/components/Popover/index.d.ts.map +1 -1
  208. package/dist/components/Popover/index.mjs +10 -10
  209. package/dist/components/Popover/index.mjs.map +1 -1
  210. package/dist/components/PressableSpan/PressableSpan.cjs +22 -5
  211. package/dist/components/PressableSpan/PressableSpan.cjs.map +1 -1
  212. package/dist/components/PressableSpan/PressableSpan.d.ts +105 -3
  213. package/dist/components/PressableSpan/PressableSpan.d.ts.map +1 -1
  214. package/dist/components/PressableSpan/PressableSpan.mjs +22 -5
  215. package/dist/components/PressableSpan/PressableSpan.mjs.map +1 -1
  216. package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
  217. package/dist/components/RightDrawer/RightDrawer.d.ts +182 -0
  218. package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
  219. package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
  220. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.cjs.map +1 -1
  221. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts +44 -0
  222. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts.map +1 -1
  223. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.mjs.map +1 -1
  224. package/dist/components/RightDrawer/useRightDrawerStore.cjs.map +1 -1
  225. package/dist/components/RightDrawer/useRightDrawerStore.d.ts +102 -0
  226. package/dist/components/RightDrawer/useRightDrawerStore.d.ts.map +1 -1
  227. package/dist/components/RightDrawer/useRightDrawerStore.mjs.map +1 -1
  228. package/dist/components/Select/Multiselect.cjs.map +1 -1
  229. package/dist/components/Select/Multiselect.d.ts +125 -18
  230. package/dist/components/Select/Multiselect.d.ts.map +1 -1
  231. package/dist/components/Select/Multiselect.mjs.map +1 -1
  232. package/dist/components/Select/Select.cjs.map +1 -1
  233. package/dist/components/Select/Select.d.ts +214 -7
  234. package/dist/components/Select/Select.d.ts.map +1 -1
  235. package/dist/components/Select/Select.mjs.map +1 -1
  236. package/dist/components/SwitchSelector/index.cjs.map +1 -1
  237. package/dist/components/SwitchSelector/index.d.ts +157 -8
  238. package/dist/components/SwitchSelector/index.d.ts.map +1 -1
  239. package/dist/components/SwitchSelector/index.mjs.map +1 -1
  240. package/dist/components/Table/Table.cjs.map +1 -1
  241. package/dist/components/Table/Table.d.ts +184 -0
  242. package/dist/components/Table/Table.d.ts.map +1 -1
  243. package/dist/components/Table/Table.mjs.map +1 -1
  244. package/dist/components/Tag/index.cjs.map +1 -1
  245. package/dist/components/Tag/index.d.ts +223 -0
  246. package/dist/components/Tag/index.d.ts.map +1 -1
  247. package/dist/components/Tag/index.mjs.map +1 -1
  248. package/dist/components/TextArea/AutoSizeTextArea.cjs.map +1 -1
  249. package/dist/components/TextArea/AutoSizeTextArea.d.ts +91 -0
  250. package/dist/components/TextArea/AutoSizeTextArea.d.ts.map +1 -1
  251. package/dist/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
  252. package/dist/components/TextArea/AutocompleteTextArea.cjs.map +1 -1
  253. package/dist/components/TextArea/AutocompleteTextArea.d.ts +145 -0
  254. package/dist/components/TextArea/AutocompleteTextArea.d.ts.map +1 -1
  255. package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
  256. package/dist/components/TextArea/TextArea.cjs.map +1 -1
  257. package/dist/components/TextArea/TextArea.d.ts +74 -0
  258. package/dist/components/TextArea/TextArea.d.ts.map +1 -1
  259. package/dist/components/TextArea/TextArea.mjs.map +1 -1
  260. package/dist/components/Toaster/Toast.cjs +4 -0
  261. package/dist/components/Toaster/Toast.cjs.map +1 -1
  262. package/dist/components/Toaster/Toast.d.ts +148 -2
  263. package/dist/components/Toaster/Toast.d.ts.map +1 -1
  264. package/dist/components/Toaster/Toast.mjs +4 -0
  265. package/dist/components/Toaster/Toast.mjs.map +1 -1
  266. package/dist/components/Toaster/Toaster.cjs.map +1 -1
  267. package/dist/components/Toaster/Toaster.d.ts +42 -0
  268. package/dist/components/Toaster/Toaster.d.ts.map +1 -1
  269. package/dist/components/Toaster/Toaster.mjs.map +1 -1
  270. package/dist/components/Toaster/useToast.cjs.map +1 -1
  271. package/dist/components/Toaster/useToast.d.ts +199 -2
  272. package/dist/components/Toaster/useToast.d.ts.map +1 -1
  273. package/dist/components/Toaster/useToast.mjs.map +1 -1
  274. package/dist/components/WithResizer/index.cjs.map +1 -1
  275. package/dist/components/WithResizer/index.d.ts +143 -0
  276. package/dist/components/WithResizer/index.d.ts.map +1 -1
  277. package/dist/components/WithResizer/index.mjs.map +1 -1
  278. package/dist/components/index.cjs +2 -2
  279. package/dist/components/index.d.ts +0 -1
  280. package/dist/components/index.d.ts.map +1 -1
  281. package/dist/components/index.mjs +4 -4
  282. package/dist/components/index.mjs.map +1 -1
  283. package/dist/hooks/reactQuery.cjs +2 -1
  284. package/dist/hooks/reactQuery.cjs.map +1 -1
  285. package/dist/hooks/reactQuery.d.ts +1 -1
  286. package/dist/hooks/reactQuery.d.ts.map +1 -1
  287. package/dist/hooks/reactQuery.mjs +2 -1
  288. package/dist/hooks/reactQuery.mjs.map +1 -1
  289. package/dist/utils/image.cjs +30 -0
  290. package/dist/utils/image.cjs.map +1 -0
  291. package/dist/utils/image.d.ts +37 -0
  292. package/dist/utils/image.d.ts.map +1 -0
  293. package/dist/utils/image.mjs +30 -0
  294. package/dist/utils/image.mjs.map +1 -0
  295. package/package.json +20 -18
  296. package/dist/utils/capitalize.cjs +0 -10
  297. package/dist/utils/capitalize.cjs.map +0 -1
  298. package/dist/utils/capitalize.d.ts +0 -2
  299. package/dist/utils/capitalize.d.ts.map +0 -1
  300. package/dist/utils/capitalize.mjs +0 -10
  301. package/dist/utils/capitalize.mjs.map +0 -1
@@ -41,9 +41,13 @@ const toastVariants = classVarianceAuthority.cva(
41
41
  "group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md p-4 pr-6 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
42
42
  {
43
43
  variants: {
44
+ /** Toast visual variants for different message types */
44
45
  variant: {
46
+ /** Error state with red styling for failures and warnings */
45
47
  error: "bg-error/40 text-text",
48
+ /** Success state with green styling for confirmations */
46
49
  success: "bg-success/30 text-text",
50
+ /** Default neutral styling for general information */
47
51
  default: "bg-card/80 text-text"
48
52
  }
49
53
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.cjs","sources":["../../../src/components/Toaster/Toast.tsx"],"sourcesContent":["'use client';\n\nimport * as ToastPrimitives from '@radix-ui/react-toast';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { X } from 'lucide-react';\nimport { type FC, type ComponentProps, type ReactElement } from 'react';\nimport { cn } from '../../utils/cn';\n\nconst ToastProvider = ToastPrimitives;\n\nconst ToastViewport: FC<ComponentProps<typeof ToastPrimitives.Viewport>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Viewport\n className={cn(\n 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',\n className\n )}\n {...props}\n />\n);\n\nconst toastVariants = cva(\n 'group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md p-4 pr-6 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',\n {\n variants: {\n variant: {\n error: 'bg-error/40 text-text',\n success: 'bg-success/30 text-text',\n default: 'bg-card/80 text-text',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n\nconst Toast: FC<\n ComponentProps<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n> = ({ className, variant, ...props }) => {\n return (\n <ToastPrimitives.Root\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n};\n\nconst ToastAction: FC<ComponentProps<typeof ToastPrimitives.Action>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Action\n className={cn(\n 'hover:bg-text focus:ring-ring group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive focus:outline-hidden inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-1 disabled:pointer-events-none disabled:opacity-50',\n className\n )}\n {...props}\n />\n);\n\nconst ToastClose: FC<ComponentProps<typeof ToastPrimitives.Close>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Close\n className={cn(\n 'text-text/50 hover:text-text/80 focus:outline-hidden absolute right-1 top-1 rounded-md p-1 opacity-0 transition-opacity focus:opacity-100 focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',\n className\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"size-5\" />\n </ToastPrimitives.Close>\n);\nconst ToastTitle: FC<ComponentProps<typeof ToastPrimitives.Title>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Title\n className={cn('text-sm font-semibold [&+div]:text-xs', className)}\n {...props}\n />\n);\n\nconst ToastDescription: FC<\n ComponentProps<typeof ToastPrimitives.Description>\n> = ({ className, ...props }) => (\n <ToastPrimitives.Description\n className={cn('text-sm opacity-90', className)}\n {...props}\n />\n);\ntype ToastProps = ComponentProps<typeof Toast>;\n\ntype ToastActionElement = ReactElement<typeof ToastAction>;\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n};\n"],"names":["ToastPrimitives","jsx","cn","cva","X"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,gBAAgBA;AAEtB,MAAM,gBAAqE,CAAC;AAAA,EAC1E;AAAA,EACA,GAAG;AACL,MACEC,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,gBAAgBC,uBAAAA;AAAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,OAAO;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;AAEA,MAAM,QAGF,CAAC,EAAE,WAAW,SAAS,GAAG,YAAY;AACxC,SACEF,2BAAAA;AAAAA,IAACD,2BAAgB;AAAA,IAAhB;AAAA,MACC,WAAWE,SAAAA,GAAG,cAAc,EAAE,QAAA,CAAS,GAAG,SAAS;AAAA,MAClD,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,MAAM,cAAiE,CAAC;AAAA,EACtE;AAAA,EACA,GAAG;AACL,MACED,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,aAA+D,CAAC;AAAA,EACpE;AAAA,EACA,GAAG;AACL,MACED,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,eAAY;AAAA,IACX,GAAG;AAAA,IAEJ,UAAAD,2BAAAA,IAACG,YAAAA,GAAA,EAAE,WAAU,SAAA,CAAS;AAAA,EAAA;AACxB;AAEF,MAAM,aAA+D,CAAC;AAAA,EACpE;AAAA,EACA,GAAG;AACL,MACEH,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA,GAAG,yCAAyC,SAAS;AAAA,IAC/D,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,mBAEF,CAAC,EAAE,WAAW,GAAG,YACnBD,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA,GAAG,sBAAsB,SAAS;AAAA,IAC5C,GAAG;AAAA,EAAA;AACN;;;;;;;;"}
1
+ {"version":3,"file":"Toast.cjs","sources":["../../../src/components/Toaster/Toast.tsx"],"sourcesContent":["'use client';\n\nimport * as ToastPrimitives from '@radix-ui/react-toast';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { X } from 'lucide-react';\nimport { type ComponentProps, type FC, type ReactElement } from 'react';\nimport { cn } from '../../utils/cn';\n\nconst ToastProvider = ToastPrimitives;\n\nconst ToastViewport: FC<ComponentProps<typeof ToastPrimitives.Viewport>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Viewport\n className={cn(\n 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',\n className\n )}\n {...props}\n />\n);\n\n/**\n * Toast variant styles using class-variance-authority.\n *\n * Defines visual styles for different toast types with semantic colors,\n * animations, and responsive behavior.\n *\n * @example\n * ```tsx\n * // Error toast with red background\n * <Toast variant=\"error\">Error message</Toast>\n *\n * // Success toast with green background\n * <Toast variant=\"success\">Success message</Toast>\n *\n * // Default toast with neutral styling\n * <Toast variant=\"default\">Info message</Toast>\n * ```\n */\nconst toastVariants = cva(\n 'group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md p-4 pr-6 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',\n {\n variants: {\n /** Toast visual variants for different message types */\n variant: {\n /** Error state with red styling for failures and warnings */\n error: 'bg-error/40 text-text',\n /** Success state with green styling for confirmations */\n success: 'bg-success/30 text-text',\n /** Default neutral styling for general information */\n default: 'bg-card/80 text-text',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n\n/**\n * Toast Component\n *\n * A notification component that displays temporary messages to users using Radix UI primitives.\n * Supports different visual variants, animations, and user interactions including swipe-to-dismiss.\n *\n * ## Features\n * - **Visual Variants**: Error, success, and default styling themes\n * - **Animations**: Smooth slide-in/slide-out transitions with fade effects\n * - **Swipe Gestures**: Touch-friendly swipe-to-dismiss functionality\n * - **Accessibility**: Full screen reader support and keyboard navigation\n * - **Positioning**: Smart positioning with responsive viewport handling\n * - **Auto-dismiss**: Configurable automatic dismissal timing\n *\n * ## Technical Implementation\n * - Built on Radix UI Toast primitives for accessibility compliance\n * - Uses Framer Motion for smooth animations and gestures\n * - CVA (class-variance-authority) for consistent styling variants\n * - Backdrop blur effects for modern visual appeal\n * - CSS transforms for hardware-accelerated animations\n *\n * @example\n * ```tsx\n * // Basic toast with title and description\n * <Toast variant=\"default\">\n * <ToastTitle>Notification</ToastTitle>\n * <ToastDescription>Your action was completed successfully.</ToastDescription>\n * <ToastClose />\n * </Toast>\n *\n * // Error toast with action button\n * <Toast variant=\"error\">\n * <ToastTitle>Upload Failed</ToastTitle>\n * <ToastDescription>Could not upload file. Please try again.</ToastDescription>\n * <ToastAction altText=\"Retry upload\">Retry</ToastAction>\n * <ToastClose />\n * </Toast>\n * ```\n */\nconst Toast: FC<\n ComponentProps<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n> = ({ className, variant, ...props }) => {\n return (\n <ToastPrimitives.Root\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n};\n\n/**\n * ToastAction Component\n *\n * An interactive button component for toast notifications that allows users to take\n * actions related to the notification message.\n *\n * ## Features\n * - **Accessibility**: Requires `altText` prop for screen readers\n * - **Visual States**: Hover, focus, and disabled state styling\n * - **Theme Integration**: Supports destructive and default themes\n * - **Keyboard Navigation**: Full keyboard accessibility support\n *\n * ## Usage Guidelines\n * - Use for actionable notifications (retry, undo, view details)\n * - Keep action text short and descriptive\n * - Provide meaningful `altText` for accessibility\n * - Limit to one primary action per toast\n *\n * @example\n * ```tsx\n * // Retry action for failed operations\n * <ToastAction altText=\"Retry the failed operation\">\n * Retry\n * </ToastAction>\n *\n * // Undo action for reversible operations\n * <ToastAction altText=\"Undo the last action\">\n * Undo\n * </ToastAction>\n *\n * // Navigation action\n * <ToastAction altText=\"View the uploaded file\">\n * View File\n * </ToastAction>\n * ```\n */\nconst ToastAction: FC<ComponentProps<typeof ToastPrimitives.Action>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Action\n className={cn(\n 'hover:bg-text focus:ring-ring group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive focus:outline-hidden inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-1 disabled:pointer-events-none disabled:opacity-50',\n className\n )}\n {...props}\n />\n);\n\nconst ToastClose: FC<ComponentProps<typeof ToastPrimitives.Close>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Close\n className={cn(\n 'text-text/50 hover:text-text/80 focus:outline-hidden absolute right-1 top-1 rounded-md p-1 opacity-0 transition-opacity focus:opacity-100 focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',\n className\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"size-5\" />\n </ToastPrimitives.Close>\n);\n/**\n * ToastTitle Component\n *\n * The primary heading text for toast notifications. Provides semantic structure\n * and proper typography hierarchy within the toast.\n *\n * ## Styling Features\n * - Semi-bold font weight for emphasis\n * - Automatic text sizing adjustments for descriptions\n * - Proper spacing relationships with other toast elements\n *\n * @example\n * ```tsx\n * <ToastTitle>File Upload Complete</ToastTitle>\n * <ToastTitle>Error: Connection Failed</ToastTitle>\n * <ToastTitle>Settings Saved</ToastTitle>\n * ```\n */\nconst ToastTitle: FC<ComponentProps<typeof ToastPrimitives.Title>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Title\n className={cn('text-sm font-semibold [&+div]:text-xs', className)}\n {...props}\n />\n);\n\n/**\n * ToastDescription Component\n *\n * Supporting text that provides additional context or details for the toast notification.\n * Complements the ToastTitle with more detailed information.\n *\n * ## Styling Features\n * - Slightly reduced opacity for visual hierarchy\n * - Smaller text size than title\n * - Optimal line height for readability\n *\n * ## Content Guidelines\n * - Keep descriptions concise but informative\n * - Provide actionable information when possible\n * - Use plain language for better accessibility\n *\n * @example\n * ```tsx\n * <ToastDescription>\n * Your document has been uploaded successfully and is now available for sharing.\n * </ToastDescription>\n *\n * <ToastDescription>\n * Please check your internet connection and try again.\n * </ToastDescription>\n * ```\n */\nconst ToastDescription: FC<\n ComponentProps<typeof ToastPrimitives.Description>\n> = ({ className, ...props }) => (\n <ToastPrimitives.Description\n className={cn('text-sm opacity-90', className)}\n {...props}\n />\n);\n/**\n * Props type for Toast component including all Radix UI Toast.Root props\n * and variant styling options.\n */\ntype ToastProps = ComponentProps<typeof Toast>;\n\n/**\n * Type for ToastAction elements used in toast configurations.\n * Ensures type safety when passing action elements to toast functions.\n */\ntype ToastActionElement = ReactElement<typeof ToastAction>;\n\nexport {\n Toast,\n ToastAction,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n type ToastActionElement,\n type ToastProps,\n};\n"],"names":["ToastPrimitives","jsx","cn","cva","X"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,gBAAgBA;AAEtB,MAAM,gBAAqE,CAAC;AAAA,EAC1E;AAAA,EACA,GAAG;AACL,MACEC,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAqBF,MAAM,gBAAgBC,uBAAAA;AAAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA;AAAA,MAER,SAAS;AAAA;AAAA,QAEP,OAAO;AAAA;AAAA,QAEP,SAAS;AAAA;AAAA,QAET,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;AAyCA,MAAM,QAGF,CAAC,EAAE,WAAW,SAAS,GAAG,YAAY;AACxC,SACEF,2BAAAA;AAAAA,IAACD,2BAAgB;AAAA,IAAhB;AAAA,MACC,WAAWE,SAAAA,GAAG,cAAc,EAAE,QAAA,CAAS,GAAG,SAAS;AAAA,MAClD,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAsCA,MAAM,cAAiE,CAAC;AAAA,EACtE;AAAA,EACA,GAAG;AACL,MACED,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,aAA+D,CAAC;AAAA,EACpE;AAAA,EACA,GAAG;AACL,MACED,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,eAAY;AAAA,IACX,GAAG;AAAA,IAEJ,UAAAD,2BAAAA,IAACG,YAAAA,GAAA,EAAE,WAAU,SAAA,CAAS;AAAA,EAAA;AACxB;AAoBF,MAAM,aAA+D,CAAC;AAAA,EACpE;AAAA,EACA,GAAG;AACL,MACEH,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA,GAAG,yCAAyC,SAAS;AAAA,IAC/D,GAAG;AAAA,EAAA;AACN;AA8BF,MAAM,mBAEF,CAAC,EAAE,WAAW,GAAG,YACnBD,2BAAAA;AAAAA,EAACD,2BAAgB;AAAA,EAAhB;AAAA,IACC,WAAWE,SAAAA,GAAG,sBAAsB,SAAS;AAAA,IAC5C,GAAG;AAAA,EAAA;AACN;;;;;;;;"}
@@ -1,17 +1,163 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
- import { FC, ComponentProps, ReactElement } from 'react';
2
+ import { ComponentProps, FC, ReactElement } from 'react';
3
3
  import * as ToastPrimitives from '@radix-ui/react-toast';
4
4
  declare const ToastProvider: typeof ToastPrimitives;
5
5
  declare const ToastViewport: FC<ComponentProps<typeof ToastPrimitives.Viewport>>;
6
+ /**
7
+ * Toast variant styles using class-variance-authority.
8
+ *
9
+ * Defines visual styles for different toast types with semantic colors,
10
+ * animations, and responsive behavior.
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * // Error toast with red background
15
+ * <Toast variant="error">Error message</Toast>
16
+ *
17
+ * // Success toast with green background
18
+ * <Toast variant="success">Success message</Toast>
19
+ *
20
+ * // Default toast with neutral styling
21
+ * <Toast variant="default">Info message</Toast>
22
+ * ```
23
+ */
6
24
  declare const toastVariants: (props?: ({
7
25
  variant?: "default" | "error" | "success" | null | undefined;
8
26
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
27
+ /**
28
+ * Toast Component
29
+ *
30
+ * A notification component that displays temporary messages to users using Radix UI primitives.
31
+ * Supports different visual variants, animations, and user interactions including swipe-to-dismiss.
32
+ *
33
+ * ## Features
34
+ * - **Visual Variants**: Error, success, and default styling themes
35
+ * - **Animations**: Smooth slide-in/slide-out transitions with fade effects
36
+ * - **Swipe Gestures**: Touch-friendly swipe-to-dismiss functionality
37
+ * - **Accessibility**: Full screen reader support and keyboard navigation
38
+ * - **Positioning**: Smart positioning with responsive viewport handling
39
+ * - **Auto-dismiss**: Configurable automatic dismissal timing
40
+ *
41
+ * ## Technical Implementation
42
+ * - Built on Radix UI Toast primitives for accessibility compliance
43
+ * - Uses Framer Motion for smooth animations and gestures
44
+ * - CVA (class-variance-authority) for consistent styling variants
45
+ * - Backdrop blur effects for modern visual appeal
46
+ * - CSS transforms for hardware-accelerated animations
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * // Basic toast with title and description
51
+ * <Toast variant="default">
52
+ * <ToastTitle>Notification</ToastTitle>
53
+ * <ToastDescription>Your action was completed successfully.</ToastDescription>
54
+ * <ToastClose />
55
+ * </Toast>
56
+ *
57
+ * // Error toast with action button
58
+ * <Toast variant="error">
59
+ * <ToastTitle>Upload Failed</ToastTitle>
60
+ * <ToastDescription>Could not upload file. Please try again.</ToastDescription>
61
+ * <ToastAction altText="Retry upload">Retry</ToastAction>
62
+ * <ToastClose />
63
+ * </Toast>
64
+ * ```
65
+ */
9
66
  declare const Toast: FC<ComponentProps<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>>;
67
+ /**
68
+ * ToastAction Component
69
+ *
70
+ * An interactive button component for toast notifications that allows users to take
71
+ * actions related to the notification message.
72
+ *
73
+ * ## Features
74
+ * - **Accessibility**: Requires `altText` prop for screen readers
75
+ * - **Visual States**: Hover, focus, and disabled state styling
76
+ * - **Theme Integration**: Supports destructive and default themes
77
+ * - **Keyboard Navigation**: Full keyboard accessibility support
78
+ *
79
+ * ## Usage Guidelines
80
+ * - Use for actionable notifications (retry, undo, view details)
81
+ * - Keep action text short and descriptive
82
+ * - Provide meaningful `altText` for accessibility
83
+ * - Limit to one primary action per toast
84
+ *
85
+ * @example
86
+ * ```tsx
87
+ * // Retry action for failed operations
88
+ * <ToastAction altText="Retry the failed operation">
89
+ * Retry
90
+ * </ToastAction>
91
+ *
92
+ * // Undo action for reversible operations
93
+ * <ToastAction altText="Undo the last action">
94
+ * Undo
95
+ * </ToastAction>
96
+ *
97
+ * // Navigation action
98
+ * <ToastAction altText="View the uploaded file">
99
+ * View File
100
+ * </ToastAction>
101
+ * ```
102
+ */
10
103
  declare const ToastAction: FC<ComponentProps<typeof ToastPrimitives.Action>>;
11
104
  declare const ToastClose: FC<ComponentProps<typeof ToastPrimitives.Close>>;
105
+ /**
106
+ * ToastTitle Component
107
+ *
108
+ * The primary heading text for toast notifications. Provides semantic structure
109
+ * and proper typography hierarchy within the toast.
110
+ *
111
+ * ## Styling Features
112
+ * - Semi-bold font weight for emphasis
113
+ * - Automatic text sizing adjustments for descriptions
114
+ * - Proper spacing relationships with other toast elements
115
+ *
116
+ * @example
117
+ * ```tsx
118
+ * <ToastTitle>File Upload Complete</ToastTitle>
119
+ * <ToastTitle>Error: Connection Failed</ToastTitle>
120
+ * <ToastTitle>Settings Saved</ToastTitle>
121
+ * ```
122
+ */
12
123
  declare const ToastTitle: FC<ComponentProps<typeof ToastPrimitives.Title>>;
124
+ /**
125
+ * ToastDescription Component
126
+ *
127
+ * Supporting text that provides additional context or details for the toast notification.
128
+ * Complements the ToastTitle with more detailed information.
129
+ *
130
+ * ## Styling Features
131
+ * - Slightly reduced opacity for visual hierarchy
132
+ * - Smaller text size than title
133
+ * - Optimal line height for readability
134
+ *
135
+ * ## Content Guidelines
136
+ * - Keep descriptions concise but informative
137
+ * - Provide actionable information when possible
138
+ * - Use plain language for better accessibility
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * <ToastDescription>
143
+ * Your document has been uploaded successfully and is now available for sharing.
144
+ * </ToastDescription>
145
+ *
146
+ * <ToastDescription>
147
+ * Please check your internet connection and try again.
148
+ * </ToastDescription>
149
+ * ```
150
+ */
13
151
  declare const ToastDescription: FC<ComponentProps<typeof ToastPrimitives.Description>>;
152
+ /**
153
+ * Props type for Toast component including all Radix UI Toast.Root props
154
+ * and variant styling options.
155
+ */
14
156
  type ToastProps = ComponentProps<typeof Toast>;
157
+ /**
158
+ * Type for ToastAction elements used in toast configurations.
159
+ * Ensures type safety when passing action elements to toast functions.
160
+ */
15
161
  type ToastActionElement = ReactElement<typeof ToastAction>;
16
- export { type ToastProps, type ToastActionElement, ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
162
+ export { Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, type ToastActionElement, type ToastProps, };
17
163
  //# sourceMappingURL=Toast.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Toaster/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC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AO,EACL,KAAK,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,UAAU,GAChB,CAAC"}
@@ -22,9 +22,13 @@ const toastVariants = cva(
22
22
  "group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md p-4 pr-6 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
23
23
  {
24
24
  variants: {
25
+ /** Toast visual variants for different message types */
25
26
  variant: {
27
+ /** Error state with red styling for failures and warnings */
26
28
  error: "bg-error/40 text-text",
29
+ /** Success state with green styling for confirmations */
27
30
  success: "bg-success/30 text-text",
31
+ /** Default neutral styling for general information */
28
32
  default: "bg-card/80 text-text"
29
33
  }
30
34
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.mjs","sources":["../../../src/components/Toaster/Toast.tsx"],"sourcesContent":["'use client';\n\nimport * as ToastPrimitives from '@radix-ui/react-toast';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { X } from 'lucide-react';\nimport { type FC, type ComponentProps, type ReactElement } from 'react';\nimport { cn } from '../../utils/cn';\n\nconst ToastProvider = ToastPrimitives;\n\nconst ToastViewport: FC<ComponentProps<typeof ToastPrimitives.Viewport>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Viewport\n className={cn(\n 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',\n className\n )}\n {...props}\n />\n);\n\nconst toastVariants = cva(\n 'group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md p-4 pr-6 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',\n {\n variants: {\n variant: {\n error: 'bg-error/40 text-text',\n success: 'bg-success/30 text-text',\n default: 'bg-card/80 text-text',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n\nconst Toast: FC<\n ComponentProps<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n> = ({ className, variant, ...props }) => {\n return (\n <ToastPrimitives.Root\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n};\n\nconst ToastAction: FC<ComponentProps<typeof ToastPrimitives.Action>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Action\n className={cn(\n 'hover:bg-text focus:ring-ring group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive focus:outline-hidden inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-1 disabled:pointer-events-none disabled:opacity-50',\n className\n )}\n {...props}\n />\n);\n\nconst ToastClose: FC<ComponentProps<typeof ToastPrimitives.Close>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Close\n className={cn(\n 'text-text/50 hover:text-text/80 focus:outline-hidden absolute right-1 top-1 rounded-md p-1 opacity-0 transition-opacity focus:opacity-100 focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',\n className\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"size-5\" />\n </ToastPrimitives.Close>\n);\nconst ToastTitle: FC<ComponentProps<typeof ToastPrimitives.Title>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Title\n className={cn('text-sm font-semibold [&+div]:text-xs', className)}\n {...props}\n />\n);\n\nconst ToastDescription: FC<\n ComponentProps<typeof ToastPrimitives.Description>\n> = ({ className, ...props }) => (\n <ToastPrimitives.Description\n className={cn('text-sm opacity-90', className)}\n {...props}\n />\n);\ntype ToastProps = ComponentProps<typeof Toast>;\n\ntype ToastActionElement = ReactElement<typeof ToastAction>;\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n};\n"],"names":[],"mappings":";;;;;;AAQA,MAAM,gBAAgB;AAEtB,MAAM,gBAAqE,CAAC;AAAA,EAC1E;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,OAAO;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;AAEA,MAAM,QAGF,CAAC,EAAE,WAAW,SAAS,GAAG,YAAY;AACxC,SACE;AAAA,IAAC,gBAAgB;AAAA,IAAhB;AAAA,MACC,WAAW,GAAG,cAAc,EAAE,QAAA,CAAS,GAAG,SAAS;AAAA,MAClD,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,MAAM,cAAiE,CAAC;AAAA,EACtE;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,aAA+D,CAAC;AAAA,EACpE;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,eAAY;AAAA,IACX,GAAG;AAAA,IAEJ,UAAA,oBAAC,GAAA,EAAE,WAAU,SAAA,CAAS;AAAA,EAAA;AACxB;AAEF,MAAM,aAA+D,CAAC;AAAA,EACpE;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW,GAAG,yCAAyC,SAAS;AAAA,IAC/D,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,mBAEF,CAAC,EAAE,WAAW,GAAG,YACnB;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW,GAAG,sBAAsB,SAAS;AAAA,IAC5C,GAAG;AAAA,EAAA;AACN;"}
1
+ {"version":3,"file":"Toast.mjs","sources":["../../../src/components/Toaster/Toast.tsx"],"sourcesContent":["'use client';\n\nimport * as ToastPrimitives from '@radix-ui/react-toast';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { X } from 'lucide-react';\nimport { type ComponentProps, type FC, type ReactElement } from 'react';\nimport { cn } from '../../utils/cn';\n\nconst ToastProvider = ToastPrimitives;\n\nconst ToastViewport: FC<ComponentProps<typeof ToastPrimitives.Viewport>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Viewport\n className={cn(\n 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',\n className\n )}\n {...props}\n />\n);\n\n/**\n * Toast variant styles using class-variance-authority.\n *\n * Defines visual styles for different toast types with semantic colors,\n * animations, and responsive behavior.\n *\n * @example\n * ```tsx\n * // Error toast with red background\n * <Toast variant=\"error\">Error message</Toast>\n *\n * // Success toast with green background\n * <Toast variant=\"success\">Success message</Toast>\n *\n * // Default toast with neutral styling\n * <Toast variant=\"default\">Info message</Toast>\n * ```\n */\nconst toastVariants = cva(\n 'group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md p-4 pr-6 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',\n {\n variants: {\n /** Toast visual variants for different message types */\n variant: {\n /** Error state with red styling for failures and warnings */\n error: 'bg-error/40 text-text',\n /** Success state with green styling for confirmations */\n success: 'bg-success/30 text-text',\n /** Default neutral styling for general information */\n default: 'bg-card/80 text-text',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n\n/**\n * Toast Component\n *\n * A notification component that displays temporary messages to users using Radix UI primitives.\n * Supports different visual variants, animations, and user interactions including swipe-to-dismiss.\n *\n * ## Features\n * - **Visual Variants**: Error, success, and default styling themes\n * - **Animations**: Smooth slide-in/slide-out transitions with fade effects\n * - **Swipe Gestures**: Touch-friendly swipe-to-dismiss functionality\n * - **Accessibility**: Full screen reader support and keyboard navigation\n * - **Positioning**: Smart positioning with responsive viewport handling\n * - **Auto-dismiss**: Configurable automatic dismissal timing\n *\n * ## Technical Implementation\n * - Built on Radix UI Toast primitives for accessibility compliance\n * - Uses Framer Motion for smooth animations and gestures\n * - CVA (class-variance-authority) for consistent styling variants\n * - Backdrop blur effects for modern visual appeal\n * - CSS transforms for hardware-accelerated animations\n *\n * @example\n * ```tsx\n * // Basic toast with title and description\n * <Toast variant=\"default\">\n * <ToastTitle>Notification</ToastTitle>\n * <ToastDescription>Your action was completed successfully.</ToastDescription>\n * <ToastClose />\n * </Toast>\n *\n * // Error toast with action button\n * <Toast variant=\"error\">\n * <ToastTitle>Upload Failed</ToastTitle>\n * <ToastDescription>Could not upload file. Please try again.</ToastDescription>\n * <ToastAction altText=\"Retry upload\">Retry</ToastAction>\n * <ToastClose />\n * </Toast>\n * ```\n */\nconst Toast: FC<\n ComponentProps<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n> = ({ className, variant, ...props }) => {\n return (\n <ToastPrimitives.Root\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n};\n\n/**\n * ToastAction Component\n *\n * An interactive button component for toast notifications that allows users to take\n * actions related to the notification message.\n *\n * ## Features\n * - **Accessibility**: Requires `altText` prop for screen readers\n * - **Visual States**: Hover, focus, and disabled state styling\n * - **Theme Integration**: Supports destructive and default themes\n * - **Keyboard Navigation**: Full keyboard accessibility support\n *\n * ## Usage Guidelines\n * - Use for actionable notifications (retry, undo, view details)\n * - Keep action text short and descriptive\n * - Provide meaningful `altText` for accessibility\n * - Limit to one primary action per toast\n *\n * @example\n * ```tsx\n * // Retry action for failed operations\n * <ToastAction altText=\"Retry the failed operation\">\n * Retry\n * </ToastAction>\n *\n * // Undo action for reversible operations\n * <ToastAction altText=\"Undo the last action\">\n * Undo\n * </ToastAction>\n *\n * // Navigation action\n * <ToastAction altText=\"View the uploaded file\">\n * View File\n * </ToastAction>\n * ```\n */\nconst ToastAction: FC<ComponentProps<typeof ToastPrimitives.Action>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Action\n className={cn(\n 'hover:bg-text focus:ring-ring group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive focus:outline-hidden inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-1 disabled:pointer-events-none disabled:opacity-50',\n className\n )}\n {...props}\n />\n);\n\nconst ToastClose: FC<ComponentProps<typeof ToastPrimitives.Close>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Close\n className={cn(\n 'text-text/50 hover:text-text/80 focus:outline-hidden absolute right-1 top-1 rounded-md p-1 opacity-0 transition-opacity focus:opacity-100 focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',\n className\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"size-5\" />\n </ToastPrimitives.Close>\n);\n/**\n * ToastTitle Component\n *\n * The primary heading text for toast notifications. Provides semantic structure\n * and proper typography hierarchy within the toast.\n *\n * ## Styling Features\n * - Semi-bold font weight for emphasis\n * - Automatic text sizing adjustments for descriptions\n * - Proper spacing relationships with other toast elements\n *\n * @example\n * ```tsx\n * <ToastTitle>File Upload Complete</ToastTitle>\n * <ToastTitle>Error: Connection Failed</ToastTitle>\n * <ToastTitle>Settings Saved</ToastTitle>\n * ```\n */\nconst ToastTitle: FC<ComponentProps<typeof ToastPrimitives.Title>> = ({\n className,\n ...props\n}) => (\n <ToastPrimitives.Title\n className={cn('text-sm font-semibold [&+div]:text-xs', className)}\n {...props}\n />\n);\n\n/**\n * ToastDescription Component\n *\n * Supporting text that provides additional context or details for the toast notification.\n * Complements the ToastTitle with more detailed information.\n *\n * ## Styling Features\n * - Slightly reduced opacity for visual hierarchy\n * - Smaller text size than title\n * - Optimal line height for readability\n *\n * ## Content Guidelines\n * - Keep descriptions concise but informative\n * - Provide actionable information when possible\n * - Use plain language for better accessibility\n *\n * @example\n * ```tsx\n * <ToastDescription>\n * Your document has been uploaded successfully and is now available for sharing.\n * </ToastDescription>\n *\n * <ToastDescription>\n * Please check your internet connection and try again.\n * </ToastDescription>\n * ```\n */\nconst ToastDescription: FC<\n ComponentProps<typeof ToastPrimitives.Description>\n> = ({ className, ...props }) => (\n <ToastPrimitives.Description\n className={cn('text-sm opacity-90', className)}\n {...props}\n />\n);\n/**\n * Props type for Toast component including all Radix UI Toast.Root props\n * and variant styling options.\n */\ntype ToastProps = ComponentProps<typeof Toast>;\n\n/**\n * Type for ToastAction elements used in toast configurations.\n * Ensures type safety when passing action elements to toast functions.\n */\ntype ToastActionElement = ReactElement<typeof ToastAction>;\n\nexport {\n Toast,\n ToastAction,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n type ToastActionElement,\n type ToastProps,\n};\n"],"names":[],"mappings":";;;;;;AAQA,MAAM,gBAAgB;AAEtB,MAAM,gBAAqE,CAAC;AAAA,EAC1E;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAqBF,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA;AAAA,MAER,SAAS;AAAA;AAAA,QAEP,OAAO;AAAA;AAAA,QAEP,SAAS;AAAA;AAAA,QAET,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;AAyCA,MAAM,QAGF,CAAC,EAAE,WAAW,SAAS,GAAG,YAAY;AACxC,SACE;AAAA,IAAC,gBAAgB;AAAA,IAAhB;AAAA,MACC,WAAW,GAAG,cAAc,EAAE,QAAA,CAAS,GAAG,SAAS;AAAA,MAClD,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAsCA,MAAM,cAAiE,CAAC;AAAA,EACtE;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN;AAGF,MAAM,aAA+D,CAAC;AAAA,EACpE;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,eAAY;AAAA,IACX,GAAG;AAAA,IAEJ,UAAA,oBAAC,GAAA,EAAE,WAAU,SAAA,CAAS;AAAA,EAAA;AACxB;AAoBF,MAAM,aAA+D,CAAC;AAAA,EACpE;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW,GAAG,yCAAyC,SAAS;AAAA,IAC/D,GAAG;AAAA,EAAA;AACN;AA8BF,MAAM,mBAEF,CAAC,EAAE,WAAW,GAAG,YACnB;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC,WAAW,GAAG,sBAAsB,SAAS;AAAA,IAC5C,GAAG;AAAA,EAAA;AACN;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.cjs","sources":["../../../src/components/Toaster/Toaster.tsx"],"sourcesContent":["'use client';\n\nimport {\n ToastProvider,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastViewport,\n} from './Toast';\nimport { useToast } from './useToast';\n\nexport const Toaster = () => {\n const { toasts } = useToast();\n\n return (\n <ToastProvider.Provider>\n {toasts.map(({ id, title, description, action, ...props }) => (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && <ToastDescription>{description}</ToastDescription>}\n </div>\n {action}\n <ToastClose />\n </Toast>\n ))}\n <ToastViewport />\n </ToastProvider.Provider>\n );\n};\n"],"names":["useToast","jsxs","ToastProvider","Toast","jsx","ToastTitle","ToastDescription","ToastClose","ToastViewport"],"mappings":";;;;;;AAYO,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,OAAA,IAAWA,qCAAA;AAEnB,SACEC,gCAACC,yBAAAA,cAAc,UAAd,EACE,UAAA;AAAA,IAAA,OAAO,IAAI,CAAC,EAAE,IAAI,OAAO,aAAa,QAAQ,GAAG,MAAA,MAChDD,2BAAAA,KAACE,yBAAAA,OAAA,EAAgB,GAAG,OAClB,UAAA;AAAA,MAAAF,2BAAAA,KAAC,OAAA,EAAI,WAAU,cACZ,UAAA;AAAA,QAAA,SAASG,2BAAAA,IAACC,yBAAAA,cAAY,UAAA,MAAA,CAAM;AAAA,QAC5B,eAAeD,2BAAAA,IAACE,yBAAAA,kBAAA,EAAkB,UAAA,YAAA,CAAY;AAAA,MAAA,GACjD;AAAA,MACC;AAAA,qCACAC,yBAAAA,YAAA,CAAA,CAAW;AAAA,IAAA,EAAA,GANF,EAOZ,CACD;AAAA,mCACAC,yBAAAA,eAAA,CAAA,CAAc;AAAA,EAAA,GACjB;AAEJ;;"}
1
+ {"version":3,"file":"Toaster.cjs","sources":["../../../src/components/Toaster/Toaster.tsx"],"sourcesContent":["'use client';\n\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from './Toast';\nimport { useToast } from './useToast';\n\n/**\n * Toast notification provider component that renders active toast notifications.\n *\n * This component serves as the visual layer for the toast system, rendering all\n * active toasts and handling their animations and positioning. It should be placed\n * at a high level in your component tree to ensure toasts appear above other content.\n *\n * ## Features\n * - **Global Toast Rendering**: Renders all toasts from the global state\n * - **Automatic Positioning**: Uses Radix UI positioning system\n * - **Animation Integration**: Handles enter/exit animations for toasts\n * - **Accessibility**: Provides proper ARIA landmarks and focus management\n * - **Portal Rendering**: Renders toasts in a portal for z-index safety\n *\n * ## Positioning\n * Toasts are positioned at the bottom-right of the viewport by default.\n * This can be customized through the ToastViewport component styling.\n *\n * ## Integration\n * Place this component near the root of your application, typically:\n * - Next.js: In _app.tsx or layout.tsx\n * - React: In your main App component\n * - Ensure it's outside any containers that might clip overflow\n *\n * ## Usage Example\n * Place Toaster component at the root level of your application to ensure\n * toast notifications appear above all other content. Components throughout\n * your app can then use the useToast hook to display notifications.\n *\n * ## Styling Notes\n * - Toasts use fixed positioning to appear above all other content\n * - The viewport is styled for bottom-right positioning by default\n * - Animations are handled automatically through Radix UI primitives\n * - Custom positioning can be achieved by styling the ToastViewport\n *\n * ## Performance\n * - Only active toasts are rendered (dismissed toasts are cleaned up)\n * - Animations are hardware-accelerated where possible\n * - Memory usage is minimal due to automatic cleanup\n *\n * @returns JSX element rendering the toast viewport and active toasts\n */\nexport const Toaster = () => {\n const { toasts } = useToast();\n\n return (\n <ToastProvider.Provider>\n {toasts.map(({ id, title, description, action, ...props }) => (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && <ToastDescription>{description}</ToastDescription>}\n </div>\n {action}\n <ToastClose />\n </Toast>\n ))}\n <ToastViewport />\n </ToastProvider.Provider>\n );\n};\n"],"names":["useToast","jsxs","ToastProvider","Toast","jsx","ToastTitle","ToastDescription","ToastClose","ToastViewport"],"mappings":";;;;;;AAsDO,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,OAAA,IAAWA,qCAAA;AAEnB,SACEC,gCAACC,yBAAAA,cAAc,UAAd,EACE,UAAA;AAAA,IAAA,OAAO,IAAI,CAAC,EAAE,IAAI,OAAO,aAAa,QAAQ,GAAG,MAAA,MAChDD,2BAAAA,KAACE,yBAAAA,OAAA,EAAgB,GAAG,OAClB,UAAA;AAAA,MAAAF,2BAAAA,KAAC,OAAA,EAAI,WAAU,cACZ,UAAA;AAAA,QAAA,SAASG,2BAAAA,IAACC,yBAAAA,cAAY,UAAA,MAAA,CAAM;AAAA,QAC5B,eAAeD,2BAAAA,IAACE,yBAAAA,kBAAA,EAAkB,UAAA,YAAA,CAAY;AAAA,MAAA,GACjD;AAAA,MACC;AAAA,qCACAC,yBAAAA,YAAA,CAAA,CAAW;AAAA,IAAA,EAAA,GANF,EAOZ,CACD;AAAA,mCACAC,yBAAAA,eAAA,CAAA,CAAc;AAAA,EAAA,GACjB;AAEJ;;"}
@@ -1,2 +1,44 @@
1
+ /**
2
+ * Toast notification provider component that renders active toast notifications.
3
+ *
4
+ * This component serves as the visual layer for the toast system, rendering all
5
+ * active toasts and handling their animations and positioning. It should be placed
6
+ * at a high level in your component tree to ensure toasts appear above other content.
7
+ *
8
+ * ## Features
9
+ * - **Global Toast Rendering**: Renders all toasts from the global state
10
+ * - **Automatic Positioning**: Uses Radix UI positioning system
11
+ * - **Animation Integration**: Handles enter/exit animations for toasts
12
+ * - **Accessibility**: Provides proper ARIA landmarks and focus management
13
+ * - **Portal Rendering**: Renders toasts in a portal for z-index safety
14
+ *
15
+ * ## Positioning
16
+ * Toasts are positioned at the bottom-right of the viewport by default.
17
+ * This can be customized through the ToastViewport component styling.
18
+ *
19
+ * ## Integration
20
+ * Place this component near the root of your application, typically:
21
+ * - Next.js: In _app.tsx or layout.tsx
22
+ * - React: In your main App component
23
+ * - Ensure it's outside any containers that might clip overflow
24
+ *
25
+ * ## Usage Example
26
+ * Place Toaster component at the root level of your application to ensure
27
+ * toast notifications appear above all other content. Components throughout
28
+ * your app can then use the useToast hook to display notifications.
29
+ *
30
+ * ## Styling Notes
31
+ * - Toasts use fixed positioning to appear above all other content
32
+ * - The viewport is styled for bottom-right positioning by default
33
+ * - Animations are handled automatically through Radix UI primitives
34
+ * - Custom positioning can be achieved by styling the ToastViewport
35
+ *
36
+ * ## Performance
37
+ * - Only active toasts are rendered (dismissed toasts are cleaned up)
38
+ * - Animations are hardware-accelerated where possible
39
+ * - Memory usage is minimal due to automatic cleanup
40
+ *
41
+ * @returns JSX element rendering the toast viewport and active toasts
42
+ */
1
43
  export declare const Toaster: () => import("react/jsx-runtime").JSX.Element;
2
44
  //# sourceMappingURL=Toaster.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.d.ts","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,OAAO,+CAkBnB,CAAC"}
1
+ {"version":3,"file":"Toaster.d.ts","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.tsx"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,OAAO,+CAkBnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.mjs","sources":["../../../src/components/Toaster/Toaster.tsx"],"sourcesContent":["'use client';\n\nimport {\n ToastProvider,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastViewport,\n} from './Toast';\nimport { useToast } from './useToast';\n\nexport const Toaster = () => {\n const { toasts } = useToast();\n\n return (\n <ToastProvider.Provider>\n {toasts.map(({ id, title, description, action, ...props }) => (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && <ToastDescription>{description}</ToastDescription>}\n </div>\n {action}\n <ToastClose />\n </Toast>\n ))}\n <ToastViewport />\n </ToastProvider.Provider>\n );\n};\n"],"names":[],"mappings":";;;;AAYO,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,OAAA,IAAW,SAAA;AAEnB,SACE,qBAAC,cAAc,UAAd,EACE,UAAA;AAAA,IAAA,OAAO,IAAI,CAAC,EAAE,IAAI,OAAO,aAAa,QAAQ,GAAG,MAAA,MAChD,qBAAC,OAAA,EAAgB,GAAG,OAClB,UAAA;AAAA,MAAA,qBAAC,OAAA,EAAI,WAAU,cACZ,UAAA;AAAA,QAAA,SAAS,oBAAC,cAAY,UAAA,MAAA,CAAM;AAAA,QAC5B,eAAe,oBAAC,kBAAA,EAAkB,UAAA,YAAA,CAAY;AAAA,MAAA,GACjD;AAAA,MACC;AAAA,0BACA,YAAA,CAAA,CAAW;AAAA,IAAA,EAAA,GANF,EAOZ,CACD;AAAA,wBACA,eAAA,CAAA,CAAc;AAAA,EAAA,GACjB;AAEJ;"}
1
+ {"version":3,"file":"Toaster.mjs","sources":["../../../src/components/Toaster/Toaster.tsx"],"sourcesContent":["'use client';\n\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from './Toast';\nimport { useToast } from './useToast';\n\n/**\n * Toast notification provider component that renders active toast notifications.\n *\n * This component serves as the visual layer for the toast system, rendering all\n * active toasts and handling their animations and positioning. It should be placed\n * at a high level in your component tree to ensure toasts appear above other content.\n *\n * ## Features\n * - **Global Toast Rendering**: Renders all toasts from the global state\n * - **Automatic Positioning**: Uses Radix UI positioning system\n * - **Animation Integration**: Handles enter/exit animations for toasts\n * - **Accessibility**: Provides proper ARIA landmarks and focus management\n * - **Portal Rendering**: Renders toasts in a portal for z-index safety\n *\n * ## Positioning\n * Toasts are positioned at the bottom-right of the viewport by default.\n * This can be customized through the ToastViewport component styling.\n *\n * ## Integration\n * Place this component near the root of your application, typically:\n * - Next.js: In _app.tsx or layout.tsx\n * - React: In your main App component\n * - Ensure it's outside any containers that might clip overflow\n *\n * ## Usage Example\n * Place Toaster component at the root level of your application to ensure\n * toast notifications appear above all other content. Components throughout\n * your app can then use the useToast hook to display notifications.\n *\n * ## Styling Notes\n * - Toasts use fixed positioning to appear above all other content\n * - The viewport is styled for bottom-right positioning by default\n * - Animations are handled automatically through Radix UI primitives\n * - Custom positioning can be achieved by styling the ToastViewport\n *\n * ## Performance\n * - Only active toasts are rendered (dismissed toasts are cleaned up)\n * - Animations are hardware-accelerated where possible\n * - Memory usage is minimal due to automatic cleanup\n *\n * @returns JSX element rendering the toast viewport and active toasts\n */\nexport const Toaster = () => {\n const { toasts } = useToast();\n\n return (\n <ToastProvider.Provider>\n {toasts.map(({ id, title, description, action, ...props }) => (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && <ToastDescription>{description}</ToastDescription>}\n </div>\n {action}\n <ToastClose />\n </Toast>\n ))}\n <ToastViewport />\n </ToastProvider.Provider>\n );\n};\n"],"names":[],"mappings":";;;;AAsDO,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,OAAA,IAAW,SAAA;AAEnB,SACE,qBAAC,cAAc,UAAd,EACE,UAAA;AAAA,IAAA,OAAO,IAAI,CAAC,EAAE,IAAI,OAAO,aAAa,QAAQ,GAAG,MAAA,MAChD,qBAAC,OAAA,EAAgB,GAAG,OAClB,UAAA;AAAA,MAAA,qBAAC,OAAA,EAAI,WAAU,cACZ,UAAA;AAAA,QAAA,SAAS,oBAAC,cAAY,UAAA,MAAA,CAAM;AAAA,QAC5B,eAAe,oBAAC,kBAAA,EAAkB,UAAA,YAAA,CAAY;AAAA,MAAA,GACjD;AAAA,MACC;AAAA,0BACA,YAAA,CAAA,CAAW;AAAA,IAAA,EAAA,GANF,EAOZ,CACD;AAAA,wBACA,eAAA,CAAA,CAAc;AAAA,EAAA,GACjB;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useToast.cjs","sources":["../../../src/components/Toaster/useToast.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode, useState, useEffect } from 'react';\nimport type { ToastProps, ToastActionElement } from './Toast';\n\nconst TOAST_LIMIT = 1;\nconst TOAST_REMOVE_DELAY = 15 * 60 * 1000; // 15 seconds\n\ntype ToasterToast = ToastProps & {\n id: string;\n title?: ReactNode;\n description?: ReactNode;\n action?: ToastActionElement;\n};\n\nenum ActionTypes {\n ADD_TOAST = 'ADD_TOAST',\n UPDATE_TOAST = 'UPDATE_TOAST',\n DISMISS_TOAST = 'DISMISS_TOAST',\n REMOVE_TOAST = 'REMOVE_TOAST',\n}\n\nlet count = 0;\n\nconst genId = () => {\n count = (count + 1) % Number.MAX_SAFE_INTEGER;\n return count.toString();\n};\n\ntype Action =\n | {\n type: ActionTypes.ADD_TOAST;\n toast: ToasterToast;\n }\n | {\n type: ActionTypes.UPDATE_TOAST;\n toast: Partial<ToasterToast>;\n }\n | {\n type: ActionTypes.DISMISS_TOAST;\n toastId?: ToasterToast['id'];\n }\n | {\n type: ActionTypes.REMOVE_TOAST;\n toastId?: ToasterToast['id'];\n };\n\ntype State = {\n toasts: ToasterToast[];\n};\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) {\n return;\n }\n\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId);\n dispatch({\n type: ActionTypes.REMOVE_TOAST,\n toastId: toastId,\n });\n }, TOAST_REMOVE_DELAY);\n\n toastTimeouts.set(toastId, timeout);\n};\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case ActionTypes.ADD_TOAST:\n return {\n ...state,\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n };\n\n case ActionTypes.UPDATE_TOAST:\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === action.toast.id ? { ...t, ...action.toast } : t\n ),\n };\n\n case ActionTypes.DISMISS_TOAST: {\n const { toastId } = action;\n\n // ! Side effects ! - This could be extracted into a dismissToast() action,\n // but I'll keep it here for simplicity\n if (toastId) {\n addToRemoveQueue(toastId);\n } else {\n state.toasts.forEach((toast) => {\n addToRemoveQueue(toast.id);\n });\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === toastId || toastId === undefined\n ? {\n ...t,\n open: false,\n }\n : t\n ),\n };\n }\n case ActionTypes.REMOVE_TOAST:\n if (action.toastId === undefined) {\n return {\n ...state,\n toasts: [],\n };\n }\n return {\n ...state,\n toasts: state.toasts.filter((t) => t.id !== action.toastId),\n };\n }\n};\n\nconst listeners: ((state: State) => void)[] = [];\n\nlet memoryState: State = { toasts: [] };\n\nconst dispatch = (action: Action) => {\n memoryState = reducer(memoryState, action);\n listeners.forEach((listener) => {\n listener(memoryState);\n });\n};\n\ntype Toast = Omit<ToasterToast, 'id'>;\n\nconst toast = ({ ...props }: Toast) => {\n const id = genId();\n\n const update = (props: ToasterToast) =>\n dispatch({\n type: ActionTypes.UPDATE_TOAST,\n toast: { ...props, id },\n });\n const dismiss = () =>\n dispatch({ type: ActionTypes.DISMISS_TOAST, toastId: id });\n\n dispatch({\n type: ActionTypes.ADD_TOAST,\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => {\n if (!open) dismiss();\n },\n },\n });\n\n return {\n id: id,\n dismiss,\n update,\n };\n};\n\nconst useToast = () => {\n const [state, setState] = useState<State>(memoryState);\n\n useEffect(() => {\n listeners.push(setState);\n return () => {\n const index = listeners.indexOf(setState);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n };\n }, [state]);\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) =>\n dispatch({ type: ActionTypes.DISMISS_TOAST, toastId }),\n };\n};\n\nexport { useToast, toast };\n"],"names":["toast","props","useState","useEffect"],"mappings":";;;;AAKA,MAAM,cAAc;AACpB,MAAM,qBAAqB,KAAK,KAAK;AAgBrC,IAAI,QAAQ;AAEZ,MAAM,QAAQ,MAAM;AAClB,WAAS,QAAQ,KAAK,OAAO;AAC7B,SAAO,MAAM,SAAA;AACf;AAwBA,MAAM,oCAAoB,IAAA;AAE1B,MAAM,mBAAmB,CAAC,YAAoB;AAC5C,MAAI,cAAc,IAAI,OAAO,GAAG;AAC9B;AAAA,EACF;AAEA,QAAM,UAAU,WAAW,MAAM;AAC/B,kBAAc,OAAO,OAAO;AAC5B,aAAS;AAAA,MACP,MAAM;AAAA,MACN;AAAA,IAAA,CACD;AAAA,EACH,GAAG,kBAAkB;AAErB,gBAAc,IAAI,SAAS,OAAO;AACpC;AAEO,MAAM,UAAU,CAAC,OAAc,WAA0B;AAC9D,UAAQ,OAAO,MAAA;AAAA,IACb,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,QAAQ,CAAC,OAAO,OAAO,GAAG,MAAM,MAAM,EAAE,MAAM,GAAG,WAAW;AAAA,MAAA;AAAA,IAGhE,K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UAAU,MACd,SAAS,EAAE,MAAM,iBAA2B,SAAS,IAAI;AAE3D,WAAS;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,MACA,MAAM;AAAA,MACN,cAAc,CAAC,SAAS;AACtB,YAAI,CAAC,KAAM,SAAA;AAAA,MACb;AAAA,IAAA;AAAA,EACF,CACD;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAEA,MAAM,WAAW,MAAM;AACrB,QAAM,CAAC,OAAO,QAAQ,IAAIC,aAAAA,SAAgB,WAAW;AAErDC,eAAAA,UAAU,MAAM;AACd,cAAU,KAAK,QAAQ;AACvB,WAAO,MAAM;AACX,YAAM,QAAQ,UAAU,QAAQ,QAAQ;AACxC,UAAI,QAAQ,IAAI;AACd,kBAAU,OAAO,OAAO,CAAC;AAAA,MAC3B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA,SAAS,CAAC,YACR,SAAS,EAAE,MAAM,iBAA2B,SAAS;AAAA,EAAA;AAE3D;;;;"}
1
+ {"version":3,"file":"useToast.cjs","sources":["../../../src/components/Toaster/useToast.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode, useEffect, useState } from 'react';\nimport type { ToastActionElement, ToastProps } from './Toast';\n\n/**\n * Maximum number of toasts that can be displayed simultaneously.\n * Prevents UI overflow and maintains clean notification experience.\n */\nconst TOAST_LIMIT = 1;\n\n/**\n * Delay before automatically removing dismissed toasts from memory.\n * Set to 15 minutes (900,000ms) to allow for potential undo actions.\n */\nconst TOAST_REMOVE_DELAY = 15 * 60 * 1000; // 15 seconds\n\n/**\n * Extended toast configuration with additional properties for the toast system.\n *\n * Combines base ToastProps with specific fields needed for toast management\n * including unique identification and content elements.\n *\n * @example\n * ```tsx\n * const toast: ToasterToast = {\n * id: '1',\n * variant: 'success',\n * title: 'Success!',\n * description: 'Your action completed successfully.',\n * action: <ToastAction altText=\"View details\">View</ToastAction>\n * };\n * ```\n */\ntype ToasterToast = ToastProps & {\n /** Unique identifier for the toast instance */\n id: string;\n /** Optional title text or React element */\n title?: ReactNode;\n /** Optional description text or React element */\n description?: ReactNode;\n /** Optional action button element */\n action?: ToastActionElement;\n};\n\n/**\n * Action types for toast state management using reducer pattern.\n *\n * Defines all possible actions that can be performed on the toast state,\n * enabling predictable state updates and better debugging.\n */\nenum ActionTypes {\n /** Add a new toast to the display queue */\n ADD_TOAST = 'ADD_TOAST',\n /** Update properties of an existing toast */\n UPDATE_TOAST = 'UPDATE_TOAST',\n /** Mark a toast as dismissed (triggers exit animation) */\n DISMISS_TOAST = 'DISMISS_TOAST',\n /** Completely remove a toast from memory */\n REMOVE_TOAST = 'REMOVE_TOAST',\n}\n\nlet count = 0;\n\nconst genId = () => {\n count = (count + 1) % Number.MAX_SAFE_INTEGER;\n return count.toString();\n};\n\ntype Action =\n | {\n type: ActionTypes.ADD_TOAST;\n toast: ToasterToast;\n }\n | {\n type: ActionTypes.UPDATE_TOAST;\n toast: Partial<ToasterToast>;\n }\n | {\n type: ActionTypes.DISMISS_TOAST;\n toastId?: ToasterToast['id'];\n }\n | {\n type: ActionTypes.REMOVE_TOAST;\n toastId?: ToasterToast['id'];\n };\n\ntype State = {\n toasts: ToasterToast[];\n};\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) {\n return;\n }\n\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId);\n dispatch({\n type: ActionTypes.REMOVE_TOAST,\n toastId: toastId,\n });\n }, TOAST_REMOVE_DELAY);\n\n toastTimeouts.set(toastId, timeout);\n};\n\n/**\n * Toast state reducer function that handles all toast state transitions.\n *\n * Implements predictable state updates using the reducer pattern, ensuring\n * consistent behavior across all toast operations.\n *\n * ## State Management\n * - **ADD_TOAST**: Adds new toast and enforces limit by removing excess toasts\n * - **UPDATE_TOAST**: Updates existing toast properties while preserving identity\n * - **DISMISS_TOAST**: Marks toasts as closed and schedules removal\n * - **REMOVE_TOAST**: Permanently removes toasts from state\n *\n * ## Side Effects\n * The DISMISS_TOAST action includes side effects for scheduling toast removal,\n * which could be extracted but is kept here for simplicity.\n *\n * @param state - Current toast state\n * @param action - Action to perform on the state\n * @returns Updated toast state\n *\n * @example\n * ```tsx\n * // Add a new toast\n * const newState = reducer(state, {\n * type: ActionTypes.ADD_TOAST,\n * toast: { id: '1', title: 'Hello', variant: 'default' }\n * });\n *\n * // Dismiss a specific toast\n * const dismissedState = reducer(state, {\n * type: ActionTypes.DISMISS_TOAST,\n * toastId: '1'\n * });\n * ```\n */\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case ActionTypes.ADD_TOAST:\n return {\n ...state,\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n };\n\n case ActionTypes.UPDATE_TOAST:\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === action.toast.id ? { ...t, ...action.toast } : t\n ),\n };\n\n case ActionTypes.DISMISS_TOAST: {\n const { toastId } = action;\n\n // ! Side effects ! - This could be extracted into a dismissToast() action,\n // but I'll keep it here for simplicity\n if (toastId) {\n addToRemoveQueue(toastId);\n } else {\n state.toasts.forEach((toast) => {\n addToRemoveQueue(toast.id);\n });\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === toastId || toastId === undefined\n ? {\n ...t,\n open: false,\n }\n : t\n ),\n };\n }\n case ActionTypes.REMOVE_TOAST:\n if (action.toastId === undefined) {\n return {\n ...state,\n toasts: [],\n };\n }\n return {\n ...state,\n toasts: state.toasts.filter((t) => t.id !== action.toastId),\n };\n }\n};\n\nconst listeners: ((state: State) => void)[] = [];\n\nlet memoryState: State = { toasts: [] };\n\nconst dispatch = (action: Action) => {\n memoryState = reducer(memoryState, action);\n listeners.forEach((listener) => {\n listener(memoryState);\n });\n};\n\n/**\n * Toast configuration type for creating new toasts.\n * Omits the 'id' field as it's automatically generated.\n */\ntype Toast = Omit<ToasterToast, 'id'>;\n\n/**\n * Creates and displays a new toast notification.\n *\n * This is the primary function for showing toast notifications to users.\n * It automatically generates unique IDs, handles state updates, and provides\n * control functions for managing the toast lifecycle.\n *\n * ## Features\n * - **Automatic ID Generation**: Each toast gets a unique identifier\n * - **State Management**: Integrates with global toast state\n * - **Lifecycle Control**: Returns functions to update or dismiss the toast\n * - **Auto-dismiss**: Automatically closes when user dismisses\n *\n * ## Return Value\n * Returns an object with control functions:\n * - `id`: Unique identifier for the toast\n * - `dismiss()`: Function to manually dismiss the toast\n * - `update()`: Function to update toast properties\n *\n * @param props - Toast configuration (title, description, variant, etc.)\n * @returns Object with toast ID and control functions\n *\n * @example\n * ```tsx\n * // Basic success toast\n * const { dismiss } = toast({\n * title: 'Success!',\n * description: 'Your file was uploaded successfully.',\n * variant: 'success'\n * });\n *\n * // Error toast with retry action\n * const errorToast = toast({\n * title: 'Upload Failed',\n * description: 'Could not upload file. Please try again.',\n * variant: 'error',\n * action: <ToastAction altText=\"Retry upload\">Retry</ToastAction>\n * });\n *\n * // Update toast content dynamically\n * errorToast.update({\n * title: 'Retrying...',\n * description: 'Please wait while we retry the upload.',\n * variant: 'default'\n * });\n *\n * // Manually dismiss toast\n * setTimeout(() => errorToast.dismiss(), 5000);\n * ```\n */\nconst toast = ({ ...props }: Toast) => {\n const id = genId();\n\n const update = (props: ToasterToast) =>\n dispatch({\n type: ActionTypes.UPDATE_TOAST,\n toast: { ...props, id },\n });\n const dismiss = () =>\n dispatch({ type: ActionTypes.DISMISS_TOAST, toastId: id });\n\n dispatch({\n type: ActionTypes.ADD_TOAST,\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => {\n if (!open) dismiss();\n },\n },\n });\n\n return {\n id: id,\n dismiss,\n update,\n };\n};\n\n/**\n * React hook for managing toast notifications.\n *\n * Provides access to the global toast state and functions for creating and\n * managing toast notifications. This hook connects components to the toast\n * system and ensures reactive updates when toasts change.\n *\n * ## Features\n * - **State Synchronization**: Automatically updates when toast state changes\n * - **Toast Creation**: Provides the `toast()` function for creating notifications\n * - **Batch Dismissal**: Can dismiss all toasts or specific toasts by ID\n * - **Memory Management**: Handles proper cleanup of listeners\n *\n * ## Return Value\n * - `toasts`: Array of current toast objects\n * - `toast()`: Function to create new toast notifications\n * - `dismiss()`: Function to dismiss toasts (all or by ID)\n *\n * @returns Toast state and control functions\n *\n * @example\n * ```tsx\n * function NotificationButton() {\n * const { toast, toasts, dismiss } = useToast();\n *\n * const showSuccess = () => {\n * toast({\n * title: 'Success!',\n * description: 'Operation completed successfully.',\n * variant: 'success'\n * });\n * };\n *\n * const clearAll = () => {\n * dismiss(); // Dismisses all toasts\n * };\n *\n * return (\n * <div>\n * <button onClick={showSuccess}>Show Success</button>\n * <button onClick={clearAll}>Clear All ({toasts.length})</button>\n * </div>\n * );\n * }\n *\n * // Usage in a form component\n * function ContactForm() {\n * const { toast } = useToast();\n *\n * const handleSubmit = async (data) => {\n * try {\n * await submitForm(data);\n * toast({\n * title: 'Form Submitted',\n * description: 'We\\'ll get back to you soon!',\n * variant: 'success'\n * });\n * } catch (error) {\n * toast({\n * title: 'Submission Failed',\n * description: 'Please check your connection and try again.',\n * variant: 'error',\n * action: <ToastAction altText=\"Retry\">Retry</ToastAction>\n * });\n * }\n * };\n *\n * // ... form JSX\n * }\n * ```\n *\n * ## Usage Notes\n * - Must be used within a component tree that includes `<Toaster />`\n * - Toast state is global - changes affect all components using this hook\n * - Toasts are automatically cleaned up after the configured delay\n * - Consider UX best practices: don't overwhelm users with too many toasts\n */\nconst useToast = () => {\n const [state, setState] = useState<State>(memoryState);\n\n useEffect(() => {\n listeners.push(setState);\n return () => {\n const index = listeners.indexOf(setState);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n };\n }, [state]);\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) =>\n dispatch({ type: ActionTypes.DISMISS_TOAST, toast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