@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
@@ -1 +1 @@
1
- {"version":3,"file":"MarkDownRender.mjs","sources":["../../../src/components/MarkDownRender/MarkDownRender.tsx"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport type { ComponentProps, ComponentPropsWithoutRef, FC } from 'react';\nimport type { BundledLanguage } from 'shiki';\nimport { cn } from '../../utils/cn';\nimport { H1, H2, H3, H4, H5, H6 } from '../Headers';\nimport type { CodeCompAttributes } from '../IDE/Code';\nimport { Code } from '../IDE/Code';\nimport { CodeProvider } from '../IDE/CodeContext';\nimport { Link } from '../Link';\nimport { Tab } from '../Tab';\nimport { TabProvider } from '../Tab/TabContext';\nimport { Table } from '../Table';\nimport { MarkdownProcessor, type MarkdownProcessorOptions } from './processor';\n\ntype MarkdownRendererProps = {\n children: string;\n isDarkMode?: boolean;\n locale?: LocalesValues;\n options?: MarkdownProcessorOptions;\n};\n\n/**\n * Removes frontmatter from markdown content\n * Frontmatter is the YAML metadata block at the beginning of markdown files\n * delimited by --- at the start and end\n */\nconst stripFrontmatter = (markdown: string): string => {\n const lines = markdown.split(/\\r?\\n/);\n\n // Check if the very first non-empty line is the metadata start delimiter\n const firstNonEmptyLine = lines.find((line) => line.trim() !== '');\n\n if (!firstNonEmptyLine || firstNonEmptyLine.trim() !== '---') {\n // No frontmatter, return original content\n return markdown;\n }\n\n let inMetadataBlock = false;\n let endOfMetadataIndex = -1;\n\n for (let i = 0; i < lines.length; i++) {\n const trimmedLine = lines[i].trim();\n\n // Toggle metadata block on encountering the delimiter\n if (trimmedLine === '---') {\n if (!inMetadataBlock) {\n // Begin metadata block\n inMetadataBlock = true;\n continue;\n } else {\n // End of metadata block\n endOfMetadataIndex = i;\n break;\n }\n }\n }\n\n if (endOfMetadataIndex > -1) {\n // Return content after the frontmatter\n return lines.slice(endOfMetadataIndex + 1).join('\\n');\n }\n\n // If we couldn't find the end delimiter, return original content\n return markdown;\n};\n\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n children,\n isDarkMode,\n locale,\n options,\n}) => {\n const { overrides, ...restOptions } = options ?? {};\n\n // Strip frontmatter from the markdown content before rendering\n const cleanMarkdown = stripFrontmatter(children);\n\n return (\n <CodeProvider>\n <TabProvider>\n <MarkdownProcessor\n options={{\n disableParsingRawHTML: true,\n overrides: {\n h1: (props: ComponentProps<typeof H1>) => (\n <H1 isClickable={true} {...props} />\n ),\n h2: (props: ComponentProps<typeof H2>) => (\n <H2 isClickable={true} {...props} />\n ),\n h3: (props: ComponentProps<typeof H3>) => (\n <H3 isClickable={true} {...props} />\n ),\n h4: (props: ComponentProps<typeof H4>) => (\n <H4 isClickable={true} {...props} />\n ),\n h5: (props: ComponentProps<typeof H5>) => (\n <H5 isClickable={true} {...props} />\n ),\n h6: (props: ComponentProps<typeof H6>) => (\n <H6 isClickable={true} {...props} />\n ),\n\n code: (\n props: Omit<ComponentPropsWithoutRef<'code'>, 'children'> &\n Partial<CodeCompAttributes> & { children: string }\n ) =>\n !props.className ? (\n <strong className=\"bg-card/60 rounded p-1 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur\">\n {props.children}\n </strong>\n ) : (\n <Code\n {...props}\n isDarkMode={isDarkMode}\n language={\n (props.className?.replace('lang-', '') ||\n 'plaintext') as BundledLanguage\n }\n fileName={props.fileName}\n showHeader={Boolean(props.fileName)}\n />\n ),\n\n blockquote: ({\n className,\n ...props\n }: ComponentPropsWithoutRef<'blockquote'>) => (\n <blockquote\n className={cn(\n 'border-card text-neutral mt-5 flex flex-col gap-3 border-l-4 pl-5',\n className\n )}\n {...props}\n />\n ),\n ul: ({ className, ...props }: ComponentPropsWithoutRef<'ul'>) => (\n <ul\n className={cn(\n 'mt-5 flex flex-col gap-3 pl-5 list-disc',\n className\n )}\n {...props}\n />\n ),\n ol: ({ className, ...props }: ComponentPropsWithoutRef<'ol'>) => (\n <ol\n className={cn(\n 'mt-5 flex flex-col gap-3 pl-5 list-decimal',\n className\n )}\n {...props}\n />\n ),\n img: ({\n className,\n ...props\n }: ComponentPropsWithoutRef<'img'>) => (\n <img\n {...props}\n loading=\"lazy\"\n className={cn(\n 'max-w-full max-h-[80vh] rounded-md',\n className\n )}\n src={`${props.src}?raw=true`}\n />\n ),\n a: (props: ComponentProps<typeof Link>) => (\n <Link\n color=\"neutral\"\n isExternalLink={props.href?.startsWith('http')}\n underlined={true}\n locale={locale}\n {...props}\n />\n ),\n pre: (props: ComponentPropsWithoutRef<'pre'>) => props.children,\n\n table: (props: ComponentProps<typeof Table>) => (\n <Table {...props} />\n ),\n th: ({ className, ...props }: ComponentPropsWithoutRef<'th'>) => (\n <th\n className={cn(\n 'border-neutral bg-neutral/10 border-b p-4',\n className\n )}\n {...props}\n />\n ),\n tr: ({ className, ...props }: ComponentPropsWithoutRef<'tr'>) => (\n <tr\n className={cn('hover:bg-neutral/10 hover:/10', className)}\n {...props}\n />\n ),\n td: ({ className, ...props }: ComponentPropsWithoutRef<'td'>) => (\n <td\n className={cn(\n 'border-b border-neutral-500/50 p-4',\n className\n )}\n {...props}\n />\n ),\n hr: ({ className, ...props }: ComponentPropsWithoutRef<'hr'>) => (\n <hr\n className={cn('mt-16 mx-6 text-neutral', className)}\n {...props}\n />\n ),\n // Support both <Tab> and <Tabs> in markdown\n Tabs: (props: ComponentProps<typeof Tab>) => <Tab {...props} />,\n Tab: (props: ComponentProps<typeof Tab>) => <Tab {...props} />,\n TabItem: (props: ComponentProps<typeof Tab.Item>) => (\n <Tab.Item {...props} />\n ),\n Columns: ({\n className,\n ...props\n }: ComponentPropsWithoutRef<'div'>) => (\n <div\n className={cn('flex max-md:flex-col gap-4', className)}\n {...props}\n />\n ),\n Column: ({\n className,\n ...props\n }: ComponentPropsWithoutRef<'div'>) => (\n <div className={cn('flex-1', className)} {...props} />\n ),\n ...overrides,\n },\n ...restOptions,\n }}\n >\n {cleanMarkdown ?? ''}\n </MarkdownProcessor>\n </TabProvider>\n </CodeProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA0BA,MAAM,mBAAmB,CAAC,aAA6B;AACrD,QAAM,QAAQ,SAAS,MAAM,OAAO;AAGpC,QAAM,oBAAoB,MAAM,KAAK,CAAC,SAAS,KAAK,KAAA,MAAW,EAAE;AAEjE,MAAI,CAAC,qBAAqB,kBAAkB,KAAA,MAAW,OAAO;AAE5D,WAAO;AAAA,EACT;AAEA,MAAI,kBAAkB;AACtB,MAAI,qBAAqB;AAEzB,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,cAAc,MAAM,CAAC,EAAE,KAAA;AAG7B,QAAI,gBAAgB,OAAO;AACzB,UAAI,CAAC,iBAAiB;AAEpB,0BAAkB;AAClB;AAAA,MACF,OAAO;AAEL,6BAAqB;AACrB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,qBAAqB,IAAI;AAE3B,WAAO,MAAM,MAAM,qBAAqB,CAAC,EAAE,KAAK,IAAI;AAAA,EACtD;AAGA,SAAO;AACT;AAEO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,WAAW,GAAG,YAAA,IAAgB,WAAW,CAAA;AAGjD,QAAM,gBAAgB,iBAAiB,QAAQ;AAE/C,SACE,oBAAC,cAAA,EACC,UAAA,oBAAC,aAAA,EACC,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,QACP,uBAAuB;AAAA,QACvB,WAAW;AAAA,UACT,IAAI,CAAC,UACH,oBAAC,MAAG,aAAa,MAAO,GAAG,OAAO;AAAA,UAEpC,IAAI,CAAC,UACH,oBAAC,MAAG,aAAa,MAAO,GAAG,OAAO;AAAA,UAEpC,IAAI,CA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AAA,YACR;AAAA,YACA,GAAG;AAAA,UAAA,MAEH;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,GAAG,8BAA8B,SAAS;AAAA,cACpD,GAAG;AAAA,YAAA;AAAA,UAAA;AAAA,UAGR,QAAQ,CAAC;AAAA,YACP;AAAA,YACA,GAAG;AAAA,UAAA,0BAEF,OAAA,EAAI,WAAW,GAAG,UAAU,SAAS,GAAI,GAAG,OAAO;AAAA,UAEtD,GAAG;AAAA,QAAA;AAAA,QAEL,GAAG;AAAA,MAAA;AAAA,MAGJ,UAAA,iBAAiB;AAAA,IAAA;AAAA,EAAA,GAEtB,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"MarkDownRender.mjs","sources":["../../../src/components/MarkDownRender/MarkDownRender.tsx"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport type { ComponentProps, ComponentPropsWithoutRef, FC } from 'react';\nimport type { BundledLanguage } from 'shiki';\nimport { cn } from '../../utils/cn';\nimport { H1, H2, H3, H4, H5, H6 } from '../Headers';\nimport type { CodeCompAttributes } from '../IDE/Code';\nimport { Code } from '../IDE/Code';\nimport { CodeProvider } from '../IDE/CodeContext';\nimport { Link } from '../Link';\nimport { Tab } from '../Tab';\nimport { TabProvider } from '../Tab/TabContext';\nimport { Table } from '../Table';\nimport { MarkdownProcessor, type MarkdownProcessorOptions } from './processor';\n\ntype MarkdownRendererProps = {\n children: string;\n isDarkMode?: boolean;\n locale?: LocalesValues;\n options?: MarkdownProcessorOptions;\n};\n\n/**\n * Removes frontmatter from markdown content\n * Frontmatter is the YAML metadata block at the beginning of markdown files\n * delimited by --- at the start and end\n */\nconst stripFrontmatter = (markdown: string): string => {\n const lines = markdown.split(/\\r?\\n/);\n\n // Check if the very first non-empty line is the metadata start delimiter\n const firstNonEmptyLine = lines.find((line) => line.trim() !== '');\n\n if (!firstNonEmptyLine || firstNonEmptyLine.trim() !== '---') {\n // No frontmatter, return original content\n return markdown;\n }\n\n let inMetadataBlock = false;\n let endOfMetadataIndex = -1;\n\n for (let i = 0; i < lines.length; i++) {\n const trimmedLine = lines[i].trim();\n\n // Toggle metadata block on encountering the delimiter\n if (trimmedLine === '---') {\n if (!inMetadataBlock) {\n // Begin metadata block\n inMetadataBlock = true;\n continue;\n } else {\n // End of metadata block\n endOfMetadataIndex = i;\n break;\n }\n }\n }\n\n if (endOfMetadataIndex > -1) {\n // Return content after the frontmatter\n return lines.slice(endOfMetadataIndex + 1).join('\\n');\n }\n\n // If we couldn't find the end delimiter, return original content\n return markdown;\n};\n\n/**\n * MarkdownRenderer Component\n *\n * A comprehensive markdown renderer that transforms markdown text into rich,\n * interactive HTML with custom styling and Intlayer integration. Supports\n * code syntax highlighting, responsive tables, internationalized links,\n * and automatic frontmatter stripping.\n *\n * @component\n * @example\n * Basic usage:\n * ```tsx\n * const markdownContent = `\n * # Hello World\n * This is **bold** and *italic* text.\n * `;\n *\n * <MarkdownRenderer>{markdownContent}</MarkdownRenderer>\n * ```\n *\n * @example\n * With dark mode:\n * ```tsx\n * const codeExample = `\n * # API Documentation\n * \\`\\`\\`javascript\n * const response = await fetch('/api/data');\n * const data = await response.json();\n * \\`\\`\\`\n * `;\n *\n * <MarkdownRenderer isDarkMode={true}>\n * {codeExample}\n * </MarkdownRenderer>\n * ```\n *\n * @example\n * With internationalized links:\n * ```tsx\n * const content = `\n * Visit our [documentation](/docs) for more information.\n * External link: [Google](https://google.com)\n * `;\n *\n * <MarkdownRenderer locale=\"fr\">\n * {content}\n * </MarkdownRenderer>\n * ```\n *\n * @example\n * With custom overrides:\n * ```tsx\n * const customOptions = {\n * overrides: {\n * h1: ({ children }) => (\n * <h1 className=\"custom-title\">{children}</h1>\n * ),\n * },\n * };\n *\n * <MarkdownRenderer options={customOptions}>\n * {markdownContent}\n * </MarkdownRenderer>\n * ```\n *\n * @example\n * With frontmatter (automatically stripped):\n * ```tsx\n * const blogPost = `\n * ---\n * title: \"My Blog Post\"\n * date: \"2023-12-01\"\n * author: \"John Doe\"\n * ---\n * # My Blog Post\n * This content will be rendered without the frontmatter.\n * `;\n *\n * <MarkdownRenderer>{blogPost}</MarkdownRenderer>\n * ```\n *\n * Features:\n * - Automatic frontmatter detection and removal\n * - Syntax-highlighted code blocks with theme support\n * - Clickable headers with anchor links\n * - Internationalized link handling with locale awareness\n * - Responsive tables with hover effects\n * - Custom blockquote, list, and image styling\n * - External link detection and security attributes\n * - Inline code with distinctive styling\n * - Lazy-loaded images with GitHub raw URL support\n * - Horizontal rules with custom styling\n *\n * Supported Markdown Elements:\n * - Headers (h1-h4) with click-to-anchor functionality\n * - Code blocks with language-specific syntax highlighting\n * - Inline code with background styling\n * - Blockquotes with custom border and padding\n * - Ordered and unordered lists with custom spacing\n * - Links (internal and external) with security attributes\n * - Images with lazy loading and responsive sizing\n * - Tables with hover effects and proper styling\n * - Horizontal rules with custom appearance\n * - All standard markdown formatting (bold, italic, etc.)\n *\n * Code Block Support:\n * - Language detection from code fence info\n * - Syntax highlighting through Code component\n * - Dark/light mode theme switching\n * - Line numbers and copy functionality (via Code component)\n * - Support for popular languages (JS, TS, Python, etc.)\n *\n * Link Handling:\n * - Automatic external link detection (starts with 'http')\n * - Security attributes for external links (rel=\"noopener noreferrer\")\n * - Locale-aware internal link routing\n * - Custom Link component integration\n * - Underlined styling for better visibility\n *\n * Image Processing:\n * - Automatic lazy loading for performance\n * - GitHub raw URL transformation for repository images\n * - Responsive sizing with max-width constraints\n * - Rounded corners for visual appeal\n *\n * Accessibility:\n * - Semantic HTML structure with proper heading hierarchy\n * - ARIA attributes through component integration\n * - Screen reader friendly link descriptions\n * - Keyboard navigation support\n * - High contrast styling options\n *\n * Performance:\n * - Lazy loading for images\n * - Efficient re-rendering with React memo patterns\n * - Code syntax highlighting with minimal bundle impact\n * - Optimized markdown parsing with markdown-to-jsx\n *\n * @param props - Component props\n * @param props.children - Raw markdown content to render\n * @param props.isDarkMode - Enable dark mode styling for code blocks\n * @param props.locale - Current locale for link internationalization\n * @param props.options - Additional markdown-to-jsx options\n * @param props.options.overrides - Custom component overrides for markdown elements\n *\n * @returns Rendered markdown content with custom styling and functionality\n */\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n children,\n isDarkMode,\n locale,\n options,\n}) => {\n const { overrides, ...restOptions } = options ?? {};\n\n // Strip frontmatter from the markdown content before rendering\n const cleanMarkdown = stripFrontmatter(children);\n\n return (\n <CodeProvider>\n <TabProvider>\n <MarkdownProcessor\n options={{\n overrides: {\n h1: (props: ComponentProps<typeof H1>) => (\n <H1 isClickable={true} {...props} />\n ),\n h2: (props: ComponentProps<typeof H2>) => (\n <H2 isClickable={true} {...props} />\n ),\n h3: (props: ComponentProps<typeof H3>) => (\n <H3 isClickable={true} {...props} />\n ),\n h4: (props: ComponentProps<typeof H4>) => (\n <H4 isClickable={true} {...props} />\n ),\n h5: (props: ComponentProps<typeof H5>) => (\n <H5 isClickable={true} {...props} />\n ),\n h6: (props: ComponentProps<typeof H6>) => (\n <H6 isClickable={true} {...props} />\n ),\n\n code: (\n props: Omit<ComponentPropsWithoutRef<'code'>, 'children'> &\n Partial<CodeCompAttributes> & { children: string }\n ) =>\n !props.className ? (\n <strong className=\"bg-card/60 rounded p-1 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur\">\n {props.children}\n </strong>\n ) : (\n <Code\n {...props}\n isDarkMode={isDarkMode}\n language={\n (props.className?.replace('lang-', '') ||\n 'plaintext') as BundledLanguage\n }\n fileName={props.fileName}\n showHeader={Boolean(props.fileName)}\n />\n ),\n\n blockquote: ({\n className,\n ...props\n }: ComponentPropsWithoutRef<'blockquote'>) => (\n <blockquote\n className={cn(\n 'border-card text-neutral mt-5 flex flex-col gap-3 border-l-4 pl-5',\n className\n )}\n {...props}\n />\n ),\n ul: ({ className, ...props }: ComponentPropsWithoutRef<'ul'>) => (\n <ul\n className={cn(\n 'mt-5 flex flex-col gap-3 pl-5 list-disc',\n className\n )}\n {...props}\n />\n ),\n ol: ({ className, ...props }: ComponentPropsWithoutRef<'ol'>) => (\n <ol\n className={cn(\n 'mt-5 flex flex-col gap-3 pl-5 list-decimal',\n className\n )}\n {...props}\n />\n ),\n img: ({\n className,\n ...props\n }: ComponentPropsWithoutRef<'img'>) => (\n <img\n {...props}\n loading=\"lazy\"\n className={cn(\n 'max-w-full max-h-[80vh] rounded-md',\n className\n )}\n src={`${props.src}?raw=true`}\n />\n ),\n a: (props: ComponentProps<typeof Link>) => (\n <Link\n color=\"neutral\"\n isExternalLink={props.href?.startsWith('http')}\n underlined={true}\n locale={locale}\n {...props}\n />\n ),\n pre: (props: ComponentPropsWithoutRef<'pre'>) => props.children,\n\n table: (props: ComponentProps<typeof Table>) => (\n <Table {...props} />\n ),\n th: ({ className, ...props }: ComponentPropsWithoutRef<'th'>) => (\n <th\n className={cn(\n 'border-neutral bg-neutral/10 border-b p-4',\n className\n )}\n {...props}\n />\n ),\n tr: ({ className, ...props }: ComponentPropsWithoutRef<'tr'>) => (\n <tr\n className={cn('hover:bg-neutral/10 hover:/10', className)}\n {...props}\n />\n ),\n td: ({ className, ...props }: ComponentPropsWithoutRef<'td'>) => (\n <td\n className={cn(\n 'border-b border-neutral-500/50 p-4',\n className\n )}\n {...props}\n />\n ),\n hr: ({ className, ...props }: ComponentPropsWithoutRef<'hr'>) => (\n <hr\n className={cn('mt-16 mx-6 text-neutral', className)}\n {...props}\n />\n ),\n // Support both <Tab> and <Tabs> in markdown\n Tabs: (props: ComponentProps<typeof Tab>) => <Tab {...props} />,\n Tab: (props: ComponentProps<typeof Tab>) => <Tab {...props} />,\n TabItem: (props: ComponentProps<typeof Tab.Item>) => (\n <Tab.Item {...props} />\n ),\n Columns: ({\n className,\n ...props\n }: ComponentPropsWithoutRef<'div'>) => (\n <div\n className={cn('flex max-md:flex-col gap-4', className)}\n {...props}\n />\n ),\n Column: ({\n className,\n ...props\n }: ComponentPropsWithoutRef<'div'>) => (\n <div className={cn('flex-1', className)} {...props} />\n ),\n ...overrides,\n },\n ...restOptions,\n }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AA,cACC,WAAW,GAAG,8BAA8B,SAAS;AAAA,cACpD,GAAG;AAAA,YAAA;AAAA,UAAA;AAAA,UAGR,QAAQ,CAAC;AAAA,YACP;AAAA,YACA,GAAG;AAAA,UAAA,0BAEF,OAAA,EAAI,WAAW,GAAG,UAAU,SAAS,GAAI,GAAG,OAAO;AAAA,UAEtD,GAAG;AAAA,QAAA;AAAA,QAEL,GAAG;AAAA,MAAA;AAAA,MAGJ,UAAA,iBAAiB;AAAA,IAAA;AAAA,EAAA,GAEtB,EAAA,CACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/MaxHeightSmoother/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\n\ninterface MaxHeightSmootherProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n isHidden?: boolean;\n isOverable?: boolean;\n isFocusable?: boolean;\n minHeight?: number;\n}\n\nexport const MaxHeightSmoother: FC<MaxHeightSmootherProps> = ({\n children,\n isHidden,\n className = '',\n isOverable = false,\n isFocusable = false,\n minHeight = 0,\n ...props\n}) => (\n <div\n aria-hidden={isFocusable ? isHidden : undefined}\n tabIndex={isFocusable ? 0 : undefined}\n role={isFocusable ? 'button' : 'none'}\n className={cn(\n 'group/height-smoother relative grid w-full grid-rows-[0fr] overflow-hidden transition-all duration-700 ease-in-out',\n typeof isHidden !== 'undefined' &&\n !isHidden &&\n 'grid-rows-[1fr] overflow-x-auto',\n isOverable && 'hover:grid-rows-[1fr] hover:overflow-x-auto',\n isFocusable &&\n 'focus-within:grid-rows-[1fr] focus-within:overflow-x-auto focus:grid-rows-[1fr] focus:overflow-x-auto',\n className\n )}\n {...props}\n >\n <div\n style={{\n minHeight: `${minHeight}px`,\n }}\n className={cn(\n isOverable && 'group-hover/height-smoother:visible',\n isFocusable && 'group-focus/height-smoother:visible',\n className\n )}\n >\n {children}\n </div>\n </div>\n);\n"],"names":["jsx","cn"],"mappings":";;;;AAWO,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,GAAG;AACL,MACEA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,eAAa,cAAc,WAAW;AAAA,IACtC,UAAU,cAAc,IAAI;AAAA,IAC5B,MAAM,cAAc,WAAW;AAAA,IAC/B,WAAWC,SAAAA;AAAAA,MACT;AAAA,MACA,OAAO,aAAa,eAClB,CAAC,YACD;AAAA,MACF,cAAc;AAAA,MACd,eACE;AAAA,MACF;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEJ,UAAAD,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL,WAAW,GAAG,SAAS;AAAA,QAAA;AAAA,QAEzB,WAAWC,SAAAA;AAAAA,UACT,cAAc;AAAA,UACd,eAAe;AAAA,UACf;AAAA,QAAA;AAAA,QAGD;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AACF;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/MaxHeightSmoother/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the MaxHeightSmoother component\n */\ninterface MaxHeightSmootherProps extends HTMLAttributes<HTMLDivElement> {\n /** Content to render within the smoother container */\n children: ReactNode;\n /** Controls collapse state. When true, content is collapsed; when false, expanded; when undefined, relies on hover/focus behavior */\n isHidden?: boolean;\n /** Enable expand-on-hover behavior */\n isOverable?: boolean;\n /** Enable expand-on-focus behavior for accessibility and keyboard navigation */\n isFocusable?: boolean;\n /** Minimum height in pixels for the collapsed state */\n minHeight?: number;\n}\n\n/**\n * MaxHeightSmoother Component\n *\n * A sophisticated container component that provides smooth height transitions\n * for collapsible content. Uses CSS Grid's fractional rows to create fluid\n * animations without JavaScript height calculations, making it performant\n * and smooth across all devices and screen sizes.\n *\n * @component\n * @example\n * Basic controlled usage:\n * ```tsx\n * const [isCollapsed, setIsCollapsed] = useState(true);\n *\n * <MaxHeightSmoother isHidden={isCollapsed}>\n * <div>Your collapsible content here</div>\n * </MaxHeightSmoother>\n * ```\n *\n * @example\n * Hover-triggered expansion:\n * ```tsx\n * <MaxHeightSmoother isOverable={true}>\n * <div>\n * <p>This content expands when you hover over the container.</p>\n * <p>Perfect for preview cards or tooltips.</p>\n * </div>\n * </MaxHeightSmoother>\n * ```\n *\n * @example\n * Accessible focus-triggered expansion:\n * ```tsx\n * <MaxHeightSmoother isFocusable={true}>\n * <div>\n * <h3>Expandable Section</h3>\n * <p>Tab to focus this container to expand the content.</p>\n * <p>Great for accessible progressive disclosure.</p>\n * </div>\n * </MaxHeightSmoother>\n * ```\n *\n * @example\n * With minimum height for preview:\n * ```tsx\n * <MaxHeightSmoother\n * isOverable={true}\n * minHeight={100}\n * className=\"border rounded-lg p-4\"\n * >\n * <div>\n * <h3>Article Preview</h3>\n * <p>This article preview shows the first few lines...</p>\n * <p>Hover to see the full content with smooth expansion.</p>\n * <p>The minHeight ensures some content is always visible.</p>\n * </div>\n * </MaxHeightSmoother>\n * ```\n *\n * @example\n * Combined hover and focus behavior:\n * ```tsx\n * <MaxHeightSmoother\n * isOverable={true}\n * isFocusable={true}\n * minHeight={80}\n * >\n * <div>\n * <h4>Interactive Card</h4>\n * <p>Expands on both hover and keyboard focus.</p>\n * <p>Accessible to both mouse and keyboard users.</p>\n * </div>\n * </MaxHeightSmoother>\n * ```\n *\n * Features:\n * - Smooth CSS Grid-based height transitions (700ms duration)\n * - Three interaction modes: controlled, hover, and focus\n * - Configurable minimum height for collapsed state\n * - Accessible keyboard navigation support\n * - Overflow handling with smooth scrolling\n * - ARIA attributes for screen reader compatibility\n * - Performance-optimized with CSS-only animations\n * - Responsive design that works on all screen sizes\n *\n * Animation Technique:\n * Uses CSS Grid `grid-rows-[0fr]` to `grid-rows-[1fr]` transitions\n * instead of height animations, which provides:\n * - Smooth animations without knowing content height\n * - Better performance (no layout recalculations)\n * - More reliable across different content types\n * - Automatic adaptation to dynamic content changes\n *\n * Interaction Modes:\n * 1. **Controlled**: Use `isHidden` prop for external state control\n * 2. **Hover**: Set `isOverable={true}` for mouse hover expansion\n * 3. **Focus**: Set `isFocusable={true}` for keyboard focus expansion\n * 4. **Combined**: Use both `isOverable` and `isFocusable` together\n *\n * Accessibility Features:\n * - `role=\"button\"` when focusable for proper screen reader context\n * - `tabIndex={0}` for keyboard navigation when focusable\n * - `aria-hidden` attribute for screen reader control\n * - Semantic focus management with focus-within pseudo-class\n * - High contrast focus indicators\n * - Respects prefers-reduced-motion settings\n *\n * Use Cases:\n * - FAQ accordions and expandable sections\n * - Article previews and read-more functionality\n * - Card hover effects and content previews\n * - Progressive disclosure for complex forms\n * - Tooltip and popover content containers\n * - Mobile-friendly collapsible navigation\n * - Dashboard widget expansion\n * - Email preview in mail clients\n *\n * Performance Considerations:\n * - Pure CSS animations (no JavaScript timer overhead)\n * - GPU acceleration through transform-based animations\n * - Minimal repaints and layout shifts\n * - Efficient event handling with CSS pseudo-classes\n * - No DOM measurements or calculations required\n *\n * @param props - Component props extending HTML div attributes\n * @param props.children - Content to render within the container\n * @param props.isHidden - Controlled collapse state (true=collapsed, false=expanded)\n * @param props.isOverable - Enable hover-to-expand behavior\n * @param props.isFocusable - Enable focus-to-expand behavior with keyboard navigation\n * @param props.minHeight - Minimum height in pixels for collapsed state (default: 0)\n * @param props.className - Additional CSS classes for styling\n * @param props.style - Inline styles (note: minHeight style will be applied)\n * @param props.role - ARIA role (automatically set to \"button\" when focusable)\n * @param props.tabIndex - Tab index (automatically set to 0 when focusable)\n * @param props.aria-hidden - ARIA hidden state (controlled by isHidden when focusable)\n * @param props.onClick - Click event handler\n * @param props.onMouseEnter - Mouse enter event handler\n * @param props.onMouseLeave - Mouse leave event handler\n * @param props.onFocus - Focus event handler\n * @param props.onBlur - Blur event handler\n * @param props...rest - All other standard HTML div attributes\n *\n * @returns A smooth height-transitioning container with configurable interaction modes\n */\nexport const MaxHeightSmoother: FC<MaxHeightSmootherProps> = ({\n children,\n isHidden,\n className = '',\n isOverable = false,\n isFocusable = false,\n minHeight = 0,\n ...props\n}) => (\n <div\n aria-hidden={isFocusable ? isHidden : undefined}\n tabIndex={isFocusable ? 0 : undefined}\n role={isFocusable ? 'button' : 'none'}\n className={cn(\n 'group/height-smoother relative grid w-full grid-rows-[0fr] overflow-hidden transition-all duration-700 ease-in-out',\n typeof isHidden !== 'undefined' &&\n !isHidden &&\n 'grid-rows-[1fr] overflow-x-auto',\n isOverable && 'hover:grid-rows-[1fr] hover:overflow-x-auto',\n isFocusable &&\n 'focus-within:grid-rows-[1fr] focus-within:overflow-x-auto focus:grid-rows-[1fr] focus:overflow-x-auto',\n className\n )}\n {...props}\n >\n <div\n style={{\n minHeight: `${minHeight}px`,\n }}\n className={cn(\n isOverable && 'group-hover/height-smoother:visible',\n isFocusable && 'group-focus/height-smoother:visible',\n className\n )}\n >\n {children}\n </div>\n </div>\n);\n"],"names":["jsx","cn"],"mappings":";;;;AAmKO,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,GAAG;AACL,MACEA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,eAAa,cAAc,WAAW;AAAA,IACtC,UAAU,cAAc,IAAI;AAAA,IAC5B,MAAM,cAAc,WAAW;AAAA,IAC/B,WAAWC,SAAAA;AAAAA,MACT;AAAA,MACA,OAAO,aAAa,eAClB,CAAC,YACD;AAAA,MACF,cAAc;AAAA,MACd,eACE;AAAA,MACF;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEJ,UAAAD,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL,WAAW,GAAG,SAAS;AAAA,QAAA;AAAA,QAEzB,WAAWC,SAAAA;AAAAA,UACT,cAAc;AAAA,UACd,eAAe;AAAA,UACf;AAAA,QAAA;AAAA,QAGD;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AACF;;"}
@@ -1,11 +1,163 @@
1
1
  import { FC, HTMLAttributes, ReactNode } from 'react';
2
+ /**
3
+ * Props for the MaxHeightSmoother component
4
+ */
2
5
  interface MaxHeightSmootherProps extends HTMLAttributes<HTMLDivElement> {
6
+ /** Content to render within the smoother container */
3
7
  children: ReactNode;
8
+ /** Controls collapse state. When true, content is collapsed; when false, expanded; when undefined, relies on hover/focus behavior */
4
9
  isHidden?: boolean;
10
+ /** Enable expand-on-hover behavior */
5
11
  isOverable?: boolean;
12
+ /** Enable expand-on-focus behavior for accessibility and keyboard navigation */
6
13
  isFocusable?: boolean;
14
+ /** Minimum height in pixels for the collapsed state */
7
15
  minHeight?: number;
8
16
  }
17
+ /**
18
+ * MaxHeightSmoother Component
19
+ *
20
+ * A sophisticated container component that provides smooth height transitions
21
+ * for collapsible content. Uses CSS Grid's fractional rows to create fluid
22
+ * animations without JavaScript height calculations, making it performant
23
+ * and smooth across all devices and screen sizes.
24
+ *
25
+ * @component
26
+ * @example
27
+ * Basic controlled usage:
28
+ * ```tsx
29
+ * const [isCollapsed, setIsCollapsed] = useState(true);
30
+ *
31
+ * <MaxHeightSmoother isHidden={isCollapsed}>
32
+ * <div>Your collapsible content here</div>
33
+ * </MaxHeightSmoother>
34
+ * ```
35
+ *
36
+ * @example
37
+ * Hover-triggered expansion:
38
+ * ```tsx
39
+ * <MaxHeightSmoother isOverable={true}>
40
+ * <div>
41
+ * <p>This content expands when you hover over the container.</p>
42
+ * <p>Perfect for preview cards or tooltips.</p>
43
+ * </div>
44
+ * </MaxHeightSmoother>
45
+ * ```
46
+ *
47
+ * @example
48
+ * Accessible focus-triggered expansion:
49
+ * ```tsx
50
+ * <MaxHeightSmoother isFocusable={true}>
51
+ * <div>
52
+ * <h3>Expandable Section</h3>
53
+ * <p>Tab to focus this container to expand the content.</p>
54
+ * <p>Great for accessible progressive disclosure.</p>
55
+ * </div>
56
+ * </MaxHeightSmoother>
57
+ * ```
58
+ *
59
+ * @example
60
+ * With minimum height for preview:
61
+ * ```tsx
62
+ * <MaxHeightSmoother
63
+ * isOverable={true}
64
+ * minHeight={100}
65
+ * className="border rounded-lg p-4"
66
+ * >
67
+ * <div>
68
+ * <h3>Article Preview</h3>
69
+ * <p>This article preview shows the first few lines...</p>
70
+ * <p>Hover to see the full content with smooth expansion.</p>
71
+ * <p>The minHeight ensures some content is always visible.</p>
72
+ * </div>
73
+ * </MaxHeightSmoother>
74
+ * ```
75
+ *
76
+ * @example
77
+ * Combined hover and focus behavior:
78
+ * ```tsx
79
+ * <MaxHeightSmoother
80
+ * isOverable={true}
81
+ * isFocusable={true}
82
+ * minHeight={80}
83
+ * >
84
+ * <div>
85
+ * <h4>Interactive Card</h4>
86
+ * <p>Expands on both hover and keyboard focus.</p>
87
+ * <p>Accessible to both mouse and keyboard users.</p>
88
+ * </div>
89
+ * </MaxHeightSmoother>
90
+ * ```
91
+ *
92
+ * Features:
93
+ * - Smooth CSS Grid-based height transitions (700ms duration)
94
+ * - Three interaction modes: controlled, hover, and focus
95
+ * - Configurable minimum height for collapsed state
96
+ * - Accessible keyboard navigation support
97
+ * - Overflow handling with smooth scrolling
98
+ * - ARIA attributes for screen reader compatibility
99
+ * - Performance-optimized with CSS-only animations
100
+ * - Responsive design that works on all screen sizes
101
+ *
102
+ * Animation Technique:
103
+ * Uses CSS Grid `grid-rows-[0fr]` to `grid-rows-[1fr]` transitions
104
+ * instead of height animations, which provides:
105
+ * - Smooth animations without knowing content height
106
+ * - Better performance (no layout recalculations)
107
+ * - More reliable across different content types
108
+ * - Automatic adaptation to dynamic content changes
109
+ *
110
+ * Interaction Modes:
111
+ * 1. **Controlled**: Use `isHidden` prop for external state control
112
+ * 2. **Hover**: Set `isOverable={true}` for mouse hover expansion
113
+ * 3. **Focus**: Set `isFocusable={true}` for keyboard focus expansion
114
+ * 4. **Combined**: Use both `isOverable` and `isFocusable` together
115
+ *
116
+ * Accessibility Features:
117
+ * - `role="button"` when focusable for proper screen reader context
118
+ * - `tabIndex={0}` for keyboard navigation when focusable
119
+ * - `aria-hidden` attribute for screen reader control
120
+ * - Semantic focus management with focus-within pseudo-class
121
+ * - High contrast focus indicators
122
+ * - Respects prefers-reduced-motion settings
123
+ *
124
+ * Use Cases:
125
+ * - FAQ accordions and expandable sections
126
+ * - Article previews and read-more functionality
127
+ * - Card hover effects and content previews
128
+ * - Progressive disclosure for complex forms
129
+ * - Tooltip and popover content containers
130
+ * - Mobile-friendly collapsible navigation
131
+ * - Dashboard widget expansion
132
+ * - Email preview in mail clients
133
+ *
134
+ * Performance Considerations:
135
+ * - Pure CSS animations (no JavaScript timer overhead)
136
+ * - GPU acceleration through transform-based animations
137
+ * - Minimal repaints and layout shifts
138
+ * - Efficient event handling with CSS pseudo-classes
139
+ * - No DOM measurements or calculations required
140
+ *
141
+ * @param props - Component props extending HTML div attributes
142
+ * @param props.children - Content to render within the container
143
+ * @param props.isHidden - Controlled collapse state (true=collapsed, false=expanded)
144
+ * @param props.isOverable - Enable hover-to-expand behavior
145
+ * @param props.isFocusable - Enable focus-to-expand behavior with keyboard navigation
146
+ * @param props.minHeight - Minimum height in pixels for collapsed state (default: 0)
147
+ * @param props.className - Additional CSS classes for styling
148
+ * @param props.style - Inline styles (note: minHeight style will be applied)
149
+ * @param props.role - ARIA role (automatically set to "button" when focusable)
150
+ * @param props.tabIndex - Tab index (automatically set to 0 when focusable)
151
+ * @param props.aria-hidden - ARIA hidden state (controlled by isHidden when focusable)
152
+ * @param props.onClick - Click event handler
153
+ * @param props.onMouseEnter - Mouse enter event handler
154
+ * @param props.onMouseLeave - Mouse leave event handler
155
+ * @param props.onFocus - Focus event handler
156
+ * @param props.onBlur - Blur event handler
157
+ * @param props...rest - All other standard HTML div attributes
158
+ *
159
+ * @returns A smooth height-transitioning container with configurable interaction modes
160
+ */
9
161
  export declare const MaxHeightSmoother: FC<MaxHeightSmootherProps>;
10
162
  export {};
11
163
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MaxHeightSmoother/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG3D,UAAU,sBAAuB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACrE,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAsCxD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MaxHeightSmoother/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG3D;;GAEG;AACH,UAAU,sBAAuB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACrE,sDAAsD;IACtD,QAAQ,EAAE,SAAS,CAAC;IACpB,qIAAqI;IACrI,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gFAAgF;IAChF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+IG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAsCxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/components/MaxHeightSmoother/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\n\ninterface MaxHeightSmootherProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n isHidden?: boolean;\n isOverable?: boolean;\n isFocusable?: boolean;\n minHeight?: number;\n}\n\nexport const MaxHeightSmoother: FC<MaxHeightSmootherProps> = ({\n children,\n isHidden,\n className = '',\n isOverable = false,\n isFocusable = false,\n minHeight = 0,\n ...props\n}) => (\n <div\n aria-hidden={isFocusable ? isHidden : undefined}\n tabIndex={isFocusable ? 0 : undefined}\n role={isFocusable ? 'button' : 'none'}\n className={cn(\n 'group/height-smoother relative grid w-full grid-rows-[0fr] overflow-hidden transition-all duration-700 ease-in-out',\n typeof isHidden !== 'undefined' &&\n !isHidden &&\n 'grid-rows-[1fr] overflow-x-auto',\n isOverable && 'hover:grid-rows-[1fr] hover:overflow-x-auto',\n isFocusable &&\n 'focus-within:grid-rows-[1fr] focus-within:overflow-x-auto focus:grid-rows-[1fr] focus:overflow-x-auto',\n className\n )}\n {...props}\n >\n <div\n style={{\n minHeight: `${minHeight}px`,\n }}\n className={cn(\n isOverable && 'group-hover/height-smoother:visible',\n isFocusable && 'group-focus/height-smoother:visible',\n className\n )}\n >\n {children}\n </div>\n </div>\n);\n"],"names":[],"mappings":";;AAWO,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,eAAa,cAAc,WAAW;AAAA,IACtC,UAAU,cAAc,IAAI;AAAA,IAC5B,MAAM,cAAc,WAAW;AAAA,IAC/B,WAAW;AAAA,MACT;AAAA,MACA,OAAO,aAAa,eAClB,CAAC,YACD;AAAA,MACF,cAAc;AAAA,MACd,eACE;AAAA,MACF;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL,WAAW,GAAG,SAAS;AAAA,QAAA;AAAA,QAEzB,WAAW;AAAA,UACT,cAAc;AAAA,UACd,eAAe;AAAA,UACf;AAAA,QAAA;AAAA,QAGD;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AACF;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/components/MaxHeightSmoother/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the MaxHeightSmoother component\n */\ninterface MaxHeightSmootherProps extends HTMLAttributes<HTMLDivElement> {\n /** Content to render within the smoother container */\n children: ReactNode;\n /** Controls collapse state. When true, content is collapsed; when false, expanded; when undefined, relies on hover/focus behavior */\n isHidden?: boolean;\n /** Enable expand-on-hover behavior */\n isOverable?: boolean;\n /** Enable expand-on-focus behavior for accessibility and keyboard navigation */\n isFocusable?: boolean;\n /** Minimum height in pixels for the collapsed state */\n minHeight?: number;\n}\n\n/**\n * MaxHeightSmoother Component\n *\n * A sophisticated container component that provides smooth height transitions\n * for collapsible content. Uses CSS Grid's fractional rows to create fluid\n * animations without JavaScript height calculations, making it performant\n * and smooth across all devices and screen sizes.\n *\n * @component\n * @example\n * Basic controlled usage:\n * ```tsx\n * const [isCollapsed, setIsCollapsed] = useState(true);\n *\n * <MaxHeightSmoother isHidden={isCollapsed}>\n * <div>Your collapsible content here</div>\n * </MaxHeightSmoother>\n * ```\n *\n * @example\n * Hover-triggered expansion:\n * ```tsx\n * <MaxHeightSmoother isOverable={true}>\n * <div>\n * <p>This content expands when you hover over the container.</p>\n * <p>Perfect for preview cards or tooltips.</p>\n * </div>\n * </MaxHeightSmoother>\n * ```\n *\n * @example\n * Accessible focus-triggered expansion:\n * ```tsx\n * <MaxHeightSmoother isFocusable={true}>\n * <div>\n * <h3>Expandable Section</h3>\n * <p>Tab to focus this container to expand the content.</p>\n * <p>Great for accessible progressive disclosure.</p>\n * </div>\n * </MaxHeightSmoother>\n * ```\n *\n * @example\n * With minimum height for preview:\n * ```tsx\n * <MaxHeightSmoother\n * isOverable={true}\n * minHeight={100}\n * className=\"border rounded-lg p-4\"\n * >\n * <div>\n * <h3>Article Preview</h3>\n * <p>This article preview shows the first few lines...</p>\n * <p>Hover to see the full content with smooth expansion.</p>\n * <p>The minHeight ensures some content is always visible.</p>\n * </div>\n * </MaxHeightSmoother>\n * ```\n *\n * @example\n * Combined hover and focus behavior:\n * ```tsx\n * <MaxHeightSmoother\n * isOverable={true}\n * isFocusable={true}\n * minHeight={80}\n * >\n * <div>\n * <h4>Interactive Card</h4>\n * <p>Expands on both hover and keyboard focus.</p>\n * <p>Accessible to both mouse and keyboard users.</p>\n * </div>\n * </MaxHeightSmoother>\n * ```\n *\n * Features:\n * - Smooth CSS Grid-based height transitions (700ms duration)\n * - Three interaction modes: controlled, hover, and focus\n * - Configurable minimum height for collapsed state\n * - Accessible keyboard navigation support\n * - Overflow handling with smooth scrolling\n * - ARIA attributes for screen reader compatibility\n * - Performance-optimized with CSS-only animations\n * - Responsive design that works on all screen sizes\n *\n * Animation Technique:\n * Uses CSS Grid `grid-rows-[0fr]` to `grid-rows-[1fr]` transitions\n * instead of height animations, which provides:\n * - Smooth animations without knowing content height\n * - Better performance (no layout recalculations)\n * - More reliable across different content types\n * - Automatic adaptation to dynamic content changes\n *\n * Interaction Modes:\n * 1. **Controlled**: Use `isHidden` prop for external state control\n * 2. **Hover**: Set `isOverable={true}` for mouse hover expansion\n * 3. **Focus**: Set `isFocusable={true}` for keyboard focus expansion\n * 4. **Combined**: Use both `isOverable` and `isFocusable` together\n *\n * Accessibility Features:\n * - `role=\"button\"` when focusable for proper screen reader context\n * - `tabIndex={0}` for keyboard navigation when focusable\n * - `aria-hidden` attribute for screen reader control\n * - Semantic focus management with focus-within pseudo-class\n * - High contrast focus indicators\n * - Respects prefers-reduced-motion settings\n *\n * Use Cases:\n * - FAQ accordions and expandable sections\n * - Article previews and read-more functionality\n * - Card hover effects and content previews\n * - Progressive disclosure for complex forms\n * - Tooltip and popover content containers\n * - Mobile-friendly collapsible navigation\n * - Dashboard widget expansion\n * - Email preview in mail clients\n *\n * Performance Considerations:\n * - Pure CSS animations (no JavaScript timer overhead)\n * - GPU acceleration through transform-based animations\n * - Minimal repaints and layout shifts\n * - Efficient event handling with CSS pseudo-classes\n * - No DOM measurements or calculations required\n *\n * @param props - Component props extending HTML div attributes\n * @param props.children - Content to render within the container\n * @param props.isHidden - Controlled collapse state (true=collapsed, false=expanded)\n * @param props.isOverable - Enable hover-to-expand behavior\n * @param props.isFocusable - Enable focus-to-expand behavior with keyboard navigation\n * @param props.minHeight - Minimum height in pixels for collapsed state (default: 0)\n * @param props.className - Additional CSS classes for styling\n * @param props.style - Inline styles (note: minHeight style will be applied)\n * @param props.role - ARIA role (automatically set to \"button\" when focusable)\n * @param props.tabIndex - Tab index (automatically set to 0 when focusable)\n * @param props.aria-hidden - ARIA hidden state (controlled by isHidden when focusable)\n * @param props.onClick - Click event handler\n * @param props.onMouseEnter - Mouse enter event handler\n * @param props.onMouseLeave - Mouse leave event handler\n * @param props.onFocus - Focus event handler\n * @param props.onBlur - Blur event handler\n * @param props...rest - All other standard HTML div attributes\n *\n * @returns A smooth height-transitioning container with configurable interaction modes\n */\nexport const MaxHeightSmoother: FC<MaxHeightSmootherProps> = ({\n children,\n isHidden,\n className = '',\n isOverable = false,\n isFocusable = false,\n minHeight = 0,\n ...props\n}) => (\n <div\n aria-hidden={isFocusable ? isHidden : undefined}\n tabIndex={isFocusable ? 0 : undefined}\n role={isFocusable ? 'button' : 'none'}\n className={cn(\n 'group/height-smoother relative grid w-full grid-rows-[0fr] overflow-hidden transition-all duration-700 ease-in-out',\n typeof isHidden !== 'undefined' &&\n !isHidden &&\n 'grid-rows-[1fr] overflow-x-auto',\n isOverable && 'hover:grid-rows-[1fr] hover:overflow-x-auto',\n isFocusable &&\n 'focus-within:grid-rows-[1fr] focus-within:overflow-x-auto focus:grid-rows-[1fr] focus:overflow-x-auto',\n className\n )}\n {...props}\n >\n <div\n style={{\n minHeight: `${minHeight}px`,\n }}\n className={cn(\n isOverable && 'group-hover/height-smoother:visible',\n isFocusable && 'group-focus/height-smoother:visible',\n className\n )}\n >\n {children}\n </div>\n </div>\n);\n"],"names":[],"mappings":";;AAmKO,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,eAAa,cAAc,WAAW;AAAA,IACtC,UAAU,cAAc,IAAI;AAAA,IAC5B,MAAM,cAAc,WAAW;AAAA,IAC/B,WAAW;AAAA,MACT;AAAA,MACA,OAAO,aAAa,eAClB,CAAC,YACD;AAAA,MACF,cAAc;AAAA,MACd,eACE;AAAA,MACF;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL,WAAW,GAAG,SAAS;AAAA,QAAA;AAAA,QAEzB,WAAW;AAAA,UACT,cAAc;AAAA,UACd,eAAe;AAAA,UACf;AAAA,QAAA;AAAA,QAGD;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AACF;"}
@@ -31,10 +31,15 @@ const modalVariants = classVarianceAuthority.cva(
31
31
  {
32
32
  variants: {
33
33
  size: {
34
+ /** Small modal: height auto, max-height 30vh, width 95vw, max-width xl */
34
35
  sm: "h-auto max-h-[30vh] w-[95vw] max-w-xl",
36
+ /** Medium modal: height auto, max-height 50vh, width 95vw, max-width xl */
35
37
  md: "h-auto max-h-[50vh] w-[95vw] max-w-xl",
38
+ /** Large modal: height auto, max-height 70vh, width 95vw, max-width 2xl */
36
39
  lg: "h-auto max-h-[70vh] w-[95vw] max-w-2xl",
40
+ /** Extra large modal: height auto, max-height 95vh, width 95vw, max-width 6xl */
37
41
  xl: "h-auto max-h-[95vh] w-[95vw] max-w-6xl",
42
+ /** Unset modal: height auto, max-height 95vh, width 95vw, no max-width */
38
43
  unset: "h-auto max-h-[95vh] w-[95vw]"
39
44
  }
40
45
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.cjs","sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["'use client';\n\nimport { cva } from 'class-variance-authority';\nimport { motion as m } from 'framer-motion';\nimport { X } from 'lucide-react';\nimport { ReactNode, type FC } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useGetElementOrWindow, useScrollBlockage } from '../../hooks/index';\nimport { cn } from '../../utils/cn';\nimport { Button, ButtonColor, ButtonSize, ButtonVariant } from '../Button';\nimport { Container, type ContainerProps } from '../Container';\nimport { H3 } from '../Headers';\n\nexport enum ModalSize {\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n UNSET = 'unset',\n}\n\ntype ModalProps = {\n children: ReactNode;\n isOpen: boolean;\n onClose?: () => void;\n container?: HTMLElement;\n disableScroll?: boolean;\n hasCloseButton?: boolean;\n title?: string;\n size?: ModalSize | `${ModalSize}`;\n} & Pick<\n ContainerProps,\n | 'className'\n | 'transparency'\n | 'border'\n | 'background'\n | 'roundedSize'\n | 'borderColor'\n | 'padding'\n | 'separator'\n | 'gap'\n>;\n\nconst modalVariants = cva(\n 'cursor-default overflow-auto py-3 shadow-sm justify-center',\n {\n variants: {\n size: {\n sm: 'h-auto max-h-[30vh] w-[95vw] max-w-xl',\n md: 'h-auto max-h-[50vh] w-[95vw] max-w-xl',\n lg: 'h-auto max-h-[70vh] w-[95vw] max-w-2xl',\n xl: 'h-auto max-h-[95vh] w-[95vw] max-w-6xl',\n unset: 'h-auto max-h-[95vh] w-[95vw]',\n },\n },\n defaultVariants: {\n size: 'unset',\n },\n }\n);\n\nconst MotionModal = m.create(Container);\n\n/**\n * Usage example:\n * ```jsx\n * <Modal isOpen={isOpen} onClose={onClose}>\n * Modal content\n * </Modal>\n * ```\n */\nexport const Modal: FC<ModalProps> = ({\n children,\n isOpen,\n container,\n disableScroll = true,\n onClose,\n hasCloseButton = false,\n title,\n size = ModalSize.MD,\n className,\n ...props\n}) => {\n const containerElement = useGetElementOrWindow(container);\n\n useScrollBlockage({ key: 'modal', disableScroll: isOpen && disableScroll });\n\n if (!containerElement) return <></>;\n\n const hasTitle = typeof title === 'string';\n\n return createPortal(\n <m.div\n className=\"bg-background/40 /40 invisible fixed left-0 top-0 z-50 flex size-full cursor-pointer items-center justify-center overflow-auto backdrop-blur\"\n animate={isOpen ? 'visible' : 'invisible'}\n variants={{\n visible: {\n opacity: 1,\n visibility: 'visible',\n transition: { duration: 0.1, when: 'beforeChildren' },\n },\n invisible: {\n opacity: 0,\n visibility: 'hidden',\n transition: { duration: 0.1, when: 'afterChildren' },\n },\n }}\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n aria-hidden={!isOpen}\n >\n <div className=\"flex justify-center p-4\">\n <MotionModal\n onClick={(e) => e.stopPropagation()}\n initial={{ scale: isOpen ? 0.5 : 1 }}\n animate={{ scale: isOpen ? 1 : 0.5 }}\n transition={{ duration: 0.3 }}\n className={modalVariants({\n size,\n className,\n })}\n role=\"dialog\"\n aria-modal\n roundedSize=\"2xl\"\n {...props}\n >\n <div\n className={cn(\n 'cursor-default px-4',\n hasCloseButton && hasTitle\n ? `flex items-center justify-center`\n : hasCloseButton\n ? `flex items-center justify-end`\n : hasTitle\n ? `items-center`\n : `hidden`\n )}\n >\n {hasTitle && (\n <H3 className=\"ml-4 flex items-center justify-center text-lg font-bold\">\n {title}\n </H3>\n )}\n {hasCloseButton && (\n <Button\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n label=\"Close modal\"\n className=\"ml-auto\"\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n Icon={X}\n size={ButtonSize.ICON_MD}\n />\n )}\n </div>\n <div className=\"flex flex-1 flex-col items-center overflow-auto\">\n {children}\n </div>\n </MotionModal>\n </div>\n </m.div>,\n containerElement\n );\n};\n"],"names":["ModalSize","cva","m","Container","useGetElementOrWindow","useScrollBlockage","jsx","Fragment","createPortal","jsxs","cn","H3","Button","ButtonVariant","ButtonColor","X","ButtonSize"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaO,IAAK,8BAAAA,eAAL;AACLA,aAAA,IAAA,IAAK;AACLA,aAAA,IAAA,IAAK;AACLA,aAAA,IAAA,IAAK;AACLA,aAAA,IAAA,IAAK;AACLA,aAAA,OAAA,IAAQ;AALE,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AA8BZ,MAAM,gBAAgBC,uBAAAA;AAAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,iBAAiB;AAAA,MACf,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ;AAEA,MAAM,cAAcC,aAAAA,OAAE,OAAOC,oCAAS;AAU/B,MAAM,QAAwB,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,mBAAmBC,4BAAAA,sBAAsB,SAAS;AAExDC,gCAAAA,kBAAkB,EAAE,KAAK,SAAS,eAAe,UAAU,eAAe;AAE1E,MAAI,CAAC,iBAAkB,QAAOC,+BAAAC,WAAAA,UAAA,CAAA,CAAE;AAEhC,QAAM,WAAW,OA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,wBACC,SAASC,yBAAAA,cAAc;AAAA,wBACvB,OAAOC,yBAAAA,YAAY;AAAA,wBACnB,OAAM;AAAA,wBACN,WAAU;AAAA,wBACV,SAAS,CAAC,MAAM;AACd,4BAAE,gBAAA;AACF,oCAAA;AAAA,wBACF;AAAA,wBACA,MAAMC,YAAAA;AAAAA,wBACN,MAAMC,yBAAAA,WAAW;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACnB;AAAA,gBAAA;AAAA,cAAA;AAAA,cAGJV,2BAAAA,IAAC,OAAA,EAAI,WAAU,mDACZ,SAAA,CACH;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,EACF,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;;;"}
1
+ {"version":3,"file":"Modal.cjs","sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["'use client';\n\nimport { cva } from 'class-variance-authority';\nimport { motion as m } from 'framer-motion';\nimport { X } from 'lucide-react';\nimport { ReactNode, type FC } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useGetElementOrWindow, useScrollBlockage } from '../../hooks/index';\nimport { cn } from '../../utils/cn';\nimport { Button, ButtonColor, ButtonSize, ButtonVariant } from '../Button';\nimport { Container, type ContainerProps } from '../Container';\nimport { H3 } from '../Headers';\n\n/**\n * Enumeration of available modal sizes\n */\nexport enum ModalSize {\n /** Small modal: max height 30vh, max width xl */\n SM = 'sm',\n /** Medium modal: max height 50vh, max width xl */\n MD = 'md',\n /** Large modal: max height 70vh, max width 2xl */\n LG = 'lg',\n /** Extra large modal: max height 95vh, max width 6xl */\n XL = 'xl',\n /** Unset size: max height 95vh, full width responsive */\n UNSET = 'unset',\n}\n\n/**\n * Props for the Modal component\n */\ntype ModalProps = {\n /** Content to be displayed inside the modal */\n children: ReactNode;\n /** Controls whether the modal is visible */\n isOpen: boolean;\n /** Callback function called when the modal should be closed */\n onClose?: () => void;\n /** Container element to render the modal into (defaults to document.body) */\n container?: HTMLElement;\n /** Whether to disable scrolling on the background content */\n disableScroll?: boolean;\n /** Whether to display a close button in the modal header */\n hasCloseButton?: boolean;\n /** Optional title displayed at the top of the modal */\n title?: string;\n /** Size variant for the modal */\n size?: ModalSize | `${ModalSize}`;\n} & Pick<\n ContainerProps,\n | 'className'\n | 'transparency'\n | 'border'\n | 'background'\n | 'roundedSize'\n | 'borderColor'\n | 'padding'\n | 'separator'\n | 'gap'\n>;\n\n/**\n * Class name variants for different modal sizes using class-variance-authority\n * Defines responsive sizing and scrollable content for modal containers\n */\nconst modalVariants = cva(\n 'cursor-default overflow-auto py-3 shadow-sm justify-center',\n {\n variants: {\n size: {\n /** Small modal: height auto, max-height 30vh, width 95vw, max-width xl */\n sm: 'h-auto max-h-[30vh] w-[95vw] max-w-xl',\n /** Medium modal: height auto, max-height 50vh, width 95vw, max-width xl */\n md: 'h-auto max-h-[50vh] w-[95vw] max-w-xl',\n /** Large modal: height auto, max-height 70vh, width 95vw, max-width 2xl */\n lg: 'h-auto max-h-[70vh] w-[95vw] max-w-2xl',\n /** Extra large modal: height auto, max-height 95vh, width 95vw, max-width 6xl */\n xl: 'h-auto max-h-[95vh] w-[95vw] max-w-6xl',\n /** Unset modal: height auto, max-height 95vh, width 95vw, no max-width */\n unset: 'h-auto max-h-[95vh] w-[95vw]',\n },\n },\n defaultVariants: {\n size: 'unset',\n },\n }\n);\n\n/**\n * Motion-enabled modal component with Framer Motion support\n * Extends Container component with motion capabilities for animations\n */\nconst MotionModal = m.create(Container);\n\n/**\n * Modal Component\n *\n * A highly customizable modal dialog component with portal rendering, Framer Motion animations,\n * and comprehensive accessibility features. Supports multiple size variants and scroll management.\n *\n * Features:\n * - Portal rendering to any container element (defaults to document.body)\n * - Smooth animations with Framer Motion\n * - Size variants: SM, MD, LG, XL, UNSET with responsive sizing\n * - Optional title and close button\n * - Background scroll prevention\n * - Click-outside-to-close functionality\n * - Full accessibility support with ARIA attributes\n * - Keyboard navigation support (ESC to close)\n * - Extensible styling with Container props\n *\n * @example\n * Basic usage:\n * ```jsx\n * <Modal isOpen={isModalOpen} onClose={() => setIsModalOpen(false)}>\n * <p>Modal content goes here</p>\n * </Modal>\n * ```\n *\n * @example\n * With title and close button:\n * ```jsx\n * <Modal\n * isOpen={isOpen}\n * onClose={onClose}\n * title=\"Confirm Action\"\n * hasCloseButton\n * size={ModalSize.LG}\n * >\n * <div>\n * <p>Are you sure you want to continue?</p>\n * <Button onClick={onConfirm}>Confirm</Button>\n * </div>\n * </Modal>\n * ```\n *\n * @example\n * Custom container and styling:\n * ```jsx\n * <Modal\n * isOpen={isOpen}\n * onClose={onClose}\n * container={customContainer}\n * background=\"card\"\n * padding=\"lg\"\n * border=\"default\"\n * >\n * Content with custom styling\n * </Modal>\n * ```\n *\n * Accessibility Notes:\n * - Modal receives focus when opened\n * - Background content is hidden from screen readers when modal is open\n * - ESC key closes modal (handled by browser for role=\"dialog\")\n * - Click outside modal closes it\n * - Close button has descriptive label for screen readers\n *\n * @param props - Modal component props\n * @returns JSX element rendered via createPortal\n */\nexport const Modal: FC<ModalProps> = ({\n children,\n isOpen,\n container,\n disableScroll = true,\n onClose,\n hasCloseButton = false,\n title,\n size = ModalSize.MD,\n className,\n ...props\n}) => {\n const containerElement = useGetElementOrWindow(container);\n\n useScrollBlockage({ key: 'modal', disableScroll: isOpen && disableScroll });\n\n if (!containerElement) return <></>;\n\n const hasTitle = typeof title === 'string';\n\n return createPortal(\n <m.div\n className=\"bg-background/40 /40 invisible fixed left-0 top-0 z-50 flex size-full cursor-pointer items-center justify-center overflow-auto backdrop-blur\"\n animate={isOpen ? 'visible' : 'invisible'}\n variants={{\n visible: {\n opacity: 1,\n visibility: 'visible',\n transition: { duration: 0.1, when: 'beforeChildren' },\n },\n invisible: {\n opacity: 0,\n visibility: 'hidden',\n transition: { duration: 0.1, when: 'afterChildren' },\n },\n }}\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n aria-hidden={!isOpen}\n >\n <div className=\"flex justify-center p-4\">\n <MotionModal\n onClick={(e) => e.stopPropagation()}\n initial={{ scale: isOpen ? 0.5 : 1 }}\n animate={{ scale: isOpen ? 1 : 0.5 }}\n transition={{ duration: 0.3 }}\n className={modalVariants({\n size,\n className,\n })}\n role=\"dialog\"\n aria-modal\n roundedSize=\"2xl\"\n {...props}\n >\n <div\n className={cn(\n 'cursor-default px-4',\n hasCloseButton && hasTitle\n ? `flex items-center justify-center`\n : hasCloseButton\n ? `flex items-center justify-end`\n : hasTitle\n ? `items-center`\n : `hidden`\n )}\n >\n {hasTitle && (\n <H3 className=\"ml-4 flex items-center justify-center text-lg font-bold\">\n {title}\n </H3>\n )}\n {hasCloseButton && (\n <Button\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n label=\"Close modal\"\n className=\"ml-auto\"\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n Icon={X}\n size={ButtonSize.ICON_MD}\n />\n )}\n </div>\n <div className=\"flex flex-1 flex-col items-center overflow-auto\">\n {children}\n </div>\n </MotionModal>\n </div>\n </m.div>,\n containerElement\n );\n};\n"],"names":["ModalSize","cva","m","Container","useGetElementOrWindow","useScrollBlockage","jsx","Fragment","createPortal","jsxs","cn","H3","Button","ButtonVariant","ButtonColor","X","ButtonSize"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBO,IAAK,8BAAAA,eAAL;AAELA,aAAA,IAAA,IAAK;AAELA,aAAA,IAAA,IAAK;AAELA,aAAA,IAAA,IAAK;AAELA,aAAA,IAAA,IAAK;AAELA,aAAA,OAAA,IAAQ;AAVE,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAkDZ,MAAM,gBAAgBC,uBAAAA;AAAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA;AAAA,QAEJ,IAAI;AAAA;AAAA,QAEJ,IAAI;AAAA;AAAA,QAEJ,IAAI;AAAA;AAAA,QAEJ,IAAI;AAAA;AAAA,QAEJ,OAAO;AAAA,MAAA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A,YAC/B,YAAY,EAAE,UAAU,IAAA;AAAA,YACxB,WAAW,cAAc;AAAA,cACvB;AAAA,cACA;AAAA,YAAA,CACD;AAAA,YACD,MAAK;AAAA,YACL,cAAU;AAAA,YACV,aAAY;AAAA,YACX,GAAG;AAAA,YAEJ,UAAA;AAAA,cAAAA,2BAAAA;AAAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAWC,SAAAA;AAAAA,oBACT;AAAA,oBACA,kBAAkB,WACd,qCACA,iBACE,kCACA,WACE,iBACA;AAAA,kBAAA;AAAA,kBAGT,UAAA;AAAA,oBAAA,YACCJ,2BAAAA,IAACK,6BAAA,EAAG,WAAU,2DACX,UAAA,OACH;AAAA,oBAED,kBACCL,2BAAAA;AAAAA,sBAACM,yBAAAA;AAAAA,sBAAA;AAAA,wBACC,SAASC,yBAAAA,cAAc;AAAA,wBACvB,OAAOC,yBAAAA,YAAY;AAAA,wBACnB,OAAM;AAAA,wBACN,WAAU;AAAA,wBACV,SAAS,CAAC,MAAM;AACd,4BAAE,gBAAA;AACF,oCAAA;AAAA,wBACF;AAAA,wBACA,MAAMC,YAAAA;AAAAA,wBACN,MAAMC,yBAAAA,WAAW;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACnB;AAAA,gBAAA;AAAA,cAAA;AAAA,cAGJV,2BAAAA,IAAC,OAAA,EAAI,WAAU,mDACZ,SAAA,CACH;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,EACF,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;;;"}
@@ -1,29 +1,107 @@
1
1
  import { ReactNode, FC } from 'react';
2
2
  import { ContainerProps } from '../Container';
3
+ /**
4
+ * Enumeration of available modal sizes
5
+ */
3
6
  export declare enum ModalSize {
7
+ /** Small modal: max height 30vh, max width xl */
4
8
  SM = "sm",
9
+ /** Medium modal: max height 50vh, max width xl */
5
10
  MD = "md",
11
+ /** Large modal: max height 70vh, max width 2xl */
6
12
  LG = "lg",
13
+ /** Extra large modal: max height 95vh, max width 6xl */
7
14
  XL = "xl",
15
+ /** Unset size: max height 95vh, full width responsive */
8
16
  UNSET = "unset"
9
17
  }
18
+ /**
19
+ * Props for the Modal component
20
+ */
10
21
  type ModalProps = {
22
+ /** Content to be displayed inside the modal */
11
23
  children: ReactNode;
24
+ /** Controls whether the modal is visible */
12
25
  isOpen: boolean;
26
+ /** Callback function called when the modal should be closed */
13
27
  onClose?: () => void;
28
+ /** Container element to render the modal into (defaults to document.body) */
14
29
  container?: HTMLElement;
30
+ /** Whether to disable scrolling on the background content */
15
31
  disableScroll?: boolean;
32
+ /** Whether to display a close button in the modal header */
16
33
  hasCloseButton?: boolean;
34
+ /** Optional title displayed at the top of the modal */
17
35
  title?: string;
36
+ /** Size variant for the modal */
18
37
  size?: ModalSize | `${ModalSize}`;
19
38
  } & Pick<ContainerProps, 'className' | 'transparency' | 'border' | 'background' | 'roundedSize' | 'borderColor' | 'padding' | 'separator' | 'gap'>;
20
39
  /**
21
- * Usage example:
40
+ * Modal Component
41
+ *
42
+ * A highly customizable modal dialog component with portal rendering, Framer Motion animations,
43
+ * and comprehensive accessibility features. Supports multiple size variants and scroll management.
44
+ *
45
+ * Features:
46
+ * - Portal rendering to any container element (defaults to document.body)
47
+ * - Smooth animations with Framer Motion
48
+ * - Size variants: SM, MD, LG, XL, UNSET with responsive sizing
49
+ * - Optional title and close button
50
+ * - Background scroll prevention
51
+ * - Click-outside-to-close functionality
52
+ * - Full accessibility support with ARIA attributes
53
+ * - Keyboard navigation support (ESC to close)
54
+ * - Extensible styling with Container props
55
+ *
56
+ * @example
57
+ * Basic usage:
58
+ * ```jsx
59
+ * <Modal isOpen={isModalOpen} onClose={() => setIsModalOpen(false)}>
60
+ * <p>Modal content goes here</p>
61
+ * </Modal>
62
+ * ```
63
+ *
64
+ * @example
65
+ * With title and close button:
66
+ * ```jsx
67
+ * <Modal
68
+ * isOpen={isOpen}
69
+ * onClose={onClose}
70
+ * title="Confirm Action"
71
+ * hasCloseButton
72
+ * size={ModalSize.LG}
73
+ * >
74
+ * <div>
75
+ * <p>Are you sure you want to continue?</p>
76
+ * <Button onClick={onConfirm}>Confirm</Button>
77
+ * </div>
78
+ * </Modal>
79
+ * ```
80
+ *
81
+ * @example
82
+ * Custom container and styling:
22
83
  * ```jsx
23
- * <Modal isOpen={isOpen} onClose={onClose}>
24
- * Modal content
84
+ * <Modal
85
+ * isOpen={isOpen}
86
+ * onClose={onClose}
87
+ * container={customContainer}
88
+ * background="card"
89
+ * padding="lg"
90
+ * border="default"
91
+ * >
92
+ * Content with custom styling
25
93
  * </Modal>
26
94
  * ```
95
+ *
96
+ * Accessibility Notes:
97
+ * - Modal receives focus when opened
98
+ * - Background content is hidden from screen readers when modal is open
99
+ * - ESC key closes modal (handled by browser for role="dialog")
100
+ * - Click outside modal closes it
101
+ * - Close button has descriptive label for screen readers
102
+ *
103
+ * @param props - Modal component props
104
+ * @returns JSX element rendered via createPortal
27
105
  */
28
106
  export declare const Modal: FC<ModalProps>;
29
107
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3C,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9D,oBAAY,SAAS;IACnB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,KAAK,UAAU;CAChB;AAED,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,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,GACZ,aAAa,GACb,aAAa,GACb,SAAS,GACT,WAAW,GACX,KAAK,CACR,CAAC;AAmCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAiGhC,CAAC"}
@@ -29,10 +29,15 @@ const modalVariants = cva(
29
29
  {
30
30
  variants: {
31
31
  size: {
32
+ /** Small modal: height auto, max-height 30vh, width 95vw, max-width xl */
32
33
  sm: "h-auto max-h-[30vh] w-[95vw] max-w-xl",
34
+ /** Medium modal: height auto, max-height 50vh, width 95vw, max-width xl */
33
35
  md: "h-auto max-h-[50vh] w-[95vw] max-w-xl",
36
+ /** Large modal: height auto, max-height 70vh, width 95vw, max-width 2xl */
34
37
  lg: "h-auto max-h-[70vh] w-[95vw] max-w-2xl",
38
+ /** Extra large modal: height auto, max-height 95vh, width 95vw, max-width 6xl */
35
39
  xl: "h-auto max-h-[95vh] w-[95vw] max-w-6xl",
40
+ /** Unset modal: height auto, max-height 95vh, width 95vw, no max-width */
36
41
  unset: "h-auto max-h-[95vh] w-[95vw]"
37
42
  }
38
43
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.mjs","sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["'use client';\n\nimport { cva } from 'class-variance-authority';\nimport { motion as m } from 'framer-motion';\nimport { X } from 'lucide-react';\nimport { ReactNode, type FC } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useGetElementOrWindow, useScrollBlockage } from '../../hooks/index';\nimport { cn } from '../../utils/cn';\nimport { Button, ButtonColor, ButtonSize, ButtonVariant } from '../Button';\nimport { Container, type ContainerProps } from '../Container';\nimport { H3 } from '../Headers';\n\nexport enum ModalSize {\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n UNSET = 'unset',\n}\n\ntype ModalProps = {\n children: ReactNode;\n isOpen: boolean;\n onClose?: () => void;\n container?: HTMLElement;\n disableScroll?: boolean;\n hasCloseButton?: boolean;\n title?: string;\n size?: ModalSize | `${ModalSize}`;\n} & Pick<\n ContainerProps,\n | 'className'\n | 'transparency'\n | 'border'\n | 'background'\n | 'roundedSize'\n | 'borderColor'\n | 'padding'\n | 'separator'\n | 'gap'\n>;\n\nconst modalVariants = cva(\n 'cursor-default overflow-auto py-3 shadow-sm justify-center',\n {\n variants: {\n size: {\n sm: 'h-auto max-h-[30vh] w-[95vw] max-w-xl',\n md: 'h-auto max-h-[50vh] w-[95vw] max-w-xl',\n lg: 'h-auto max-h-[70vh] w-[95vw] max-w-2xl',\n xl: 'h-auto max-h-[95vh] w-[95vw] max-w-6xl',\n unset: 'h-auto max-h-[95vh] w-[95vw]',\n },\n },\n defaultVariants: {\n size: 'unset',\n },\n }\n);\n\nconst MotionModal = m.create(Container);\n\n/**\n * Usage example:\n * ```jsx\n * <Modal isOpen={isOpen} onClose={onClose}>\n * Modal content\n * </Modal>\n * ```\n */\nexport const Modal: FC<ModalProps> = ({\n children,\n isOpen,\n container,\n disableScroll = true,\n onClose,\n hasCloseButton = false,\n title,\n size = ModalSize.MD,\n className,\n ...props\n}) => {\n const containerElement = useGetElementOrWindow(container);\n\n useScrollBlockage({ key: 'modal', disableScroll: isOpen && disableScroll });\n\n if (!containerElement) return <></>;\n\n const hasTitle = typeof title === 'string';\n\n return createPortal(\n <m.div\n className=\"bg-background/40 /40 invisible fixed left-0 top-0 z-50 flex size-full cursor-pointer items-center justify-center overflow-auto backdrop-blur\"\n animate={isOpen ? 'visible' : 'invisible'}\n variants={{\n visible: {\n opacity: 1,\n visibility: 'visible',\n transition: { duration: 0.1, when: 'beforeChildren' },\n },\n invisible: {\n opacity: 0,\n visibility: 'hidden',\n transition: { duration: 0.1, when: 'afterChildren' },\n },\n }}\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n aria-hidden={!isOpen}\n >\n <div className=\"flex justify-center p-4\">\n <MotionModal\n onClick={(e) => e.stopPropagation()}\n initial={{ scale: isOpen ? 0.5 : 1 }}\n animate={{ scale: isOpen ? 1 : 0.5 }}\n transition={{ duration: 0.3 }}\n className={modalVariants({\n size,\n className,\n })}\n role=\"dialog\"\n aria-modal\n roundedSize=\"2xl\"\n {...props}\n >\n <div\n className={cn(\n 'cursor-default px-4',\n hasCloseButton && hasTitle\n ? `flex items-center justify-center`\n : hasCloseButton\n ? `flex items-center justify-end`\n : hasTitle\n ? `items-center`\n : `hidden`\n )}\n >\n {hasTitle && (\n <H3 className=\"ml-4 flex items-center justify-center text-lg font-bold\">\n {title}\n </H3>\n )}\n {hasCloseButton && (\n <Button\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n label=\"Close modal\"\n className=\"ml-auto\"\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n Icon={X}\n size={ButtonSize.ICON_MD}\n />\n )}\n </div>\n <div className=\"flex flex-1 flex-col items-center overflow-auto\">\n {children}\n </div>\n </MotionModal>\n </div>\n </m.div>,\n containerElement\n );\n};\n"],"names":["ModalSize","m"],"mappings":";;;;;;;;;;;;;;;;;;AAaO,IAAK,8BAAAA,eAAL;AACLA,aAAA,IAAA,IAAK;AACLA,aAAA,IAAA,IAAK;AACLA,aAAA,IAAA,IAAK;AACLA,aAAA,IAAA,IAAK;AACLA,aAAA,OAAA,IAAQ;AALE,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AA8BZ,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,iBAAiB;AAAA,MACf,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ;AAEA,MAAM,cAAcC,OAAE,OAAO,SAAS;AAU/B,MAAM,QAAwB,CAAC;AAAA,EACpC;AAAA,EACA;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AAA,oBACA,kBAAkB,WACd,qCACA,iBACE,kCACA,WACE,iBACA;AAAA,kBAAA;AAAA,kBAGT,UAAA;AAAA,oBAAA,YACC,oBAAC,IAAA,EAAG,WAAU,2DACX,UAAA,OACH;AAAA,oBAED,kBACC;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,SAAS,cAAc;AAAA,wBACvB,OAAO,YAAY;AAAA,wBACnB,OAAM;AAAA,wBACN,WAAU;AAAA,wBACV,SAAS,CAAC,MAAM;AACd,4BAAE,gBAAA;AACF,oCAAA;AAAA,wBACF;AAAA,wBACA,MAAM;AAAA,wBACN,MAAM,WAAW;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACnB;AAAA,gBAAA;AAAA,cAAA;AAAA,cAGJ,oBAAC,OAAA,EAAI,WAAU,mDACZ,SAAA,CACH;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,EACF,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"Modal.mjs","sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["'use client';\n\nimport { cva } from 'class-variance-authority';\nimport { motion as m } from 'framer-motion';\nimport { X } from 'lucide-react';\nimport { ReactNode, type FC } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useGetElementOrWindow, useScrollBlockage } from '../../hooks/index';\nimport { cn } from '../../utils/cn';\nimport { Button, ButtonColor, ButtonSize, ButtonVariant } from '../Button';\nimport { Container, type ContainerProps } from '../Container';\nimport { H3 } from '../Headers';\n\n/**\n * Enumeration of available modal sizes\n */\nexport enum ModalSize {\n /** Small modal: max height 30vh, max width xl */\n SM = 'sm',\n /** Medium modal: max height 50vh, max width xl */\n MD = 'md',\n /** Large modal: max height 70vh, max width 2xl */\n LG = 'lg',\n /** Extra large modal: max height 95vh, max width 6xl */\n XL = 'xl',\n /** Unset size: max height 95vh, full width responsive */\n UNSET = 'unset',\n}\n\n/**\n * Props for the Modal component\n */\ntype ModalProps = {\n /** Content to be displayed inside the modal */\n children: ReactNode;\n /** Controls whether the modal is visible */\n isOpen: boolean;\n /** Callback function called when the modal should be closed */\n onClose?: () => void;\n /** Container element to render the modal into (defaults to document.body) */\n container?: HTMLElement;\n /** Whether to disable scrolling on the background content */\n disableScroll?: boolean;\n /** Whether to display a close button in the modal header */\n hasCloseButton?: boolean;\n /** Optional title displayed at the top of the modal */\n title?: string;\n /** Size variant for the modal */\n size?: ModalSize | `${ModalSize}`;\n} & Pick<\n ContainerProps,\n | 'className'\n | 'transparency'\n | 'border'\n | 'background'\n | 'roundedSize'\n | 'borderColor'\n | 'padding'\n | 'separator'\n | 'gap'\n>;\n\n/**\n * Class name variants for different modal sizes using class-variance-authority\n * Defines responsive sizing and scrollable content for modal containers\n */\nconst modalVariants = cva(\n 'cursor-default overflow-auto py-3 shadow-sm justify-center',\n {\n variants: {\n size: {\n /** Small modal: height auto, max-height 30vh, width 95vw, max-width xl */\n sm: 'h-auto max-h-[30vh] w-[95vw] max-w-xl',\n /** Medium modal: height auto, max-height 50vh, width 95vw, max-width xl */\n md: 'h-auto max-h-[50vh] w-[95vw] max-w-xl',\n /** Large modal: height auto, max-height 70vh, width 95vw, max-width 2xl */\n lg: 'h-auto max-h-[70vh] w-[95vw] max-w-2xl',\n /** Extra large modal: height auto, max-height 95vh, width 95vw, max-width 6xl */\n xl: 'h-auto max-h-[95vh] w-[95vw] max-w-6xl',\n /** Unset modal: height auto, max-height 95vh, width 95vw, no max-width */\n unset: 'h-auto max-h-[95vh] w-[95vw]',\n },\n },\n defaultVariants: {\n size: 'unset',\n },\n }\n);\n\n/**\n * Motion-enabled modal component with Framer Motion support\n * Extends Container component with motion capabilities for animations\n */\nconst MotionModal = m.create(Container);\n\n/**\n * Modal Component\n *\n * A highly customizable modal dialog component with portal rendering, Framer Motion animations,\n * and comprehensive accessibility features. Supports multiple size variants and scroll management.\n *\n * Features:\n * - Portal rendering to any container element (defaults to document.body)\n * - Smooth animations with Framer Motion\n * - Size variants: SM, MD, LG, XL, UNSET with responsive sizing\n * - Optional title and close button\n * - Background scroll prevention\n * - Click-outside-to-close functionality\n * - Full accessibility support with ARIA attributes\n * - Keyboard navigation support (ESC to close)\n * - Extensible styling with Container props\n *\n * @example\n * Basic usage:\n * ```jsx\n * <Modal isOpen={isModalOpen} onClose={() => setIsModalOpen(false)}>\n * <p>Modal content goes here</p>\n * </Modal>\n * ```\n *\n * @example\n * With title and close button:\n * ```jsx\n * <Modal\n * isOpen={isOpen}\n * onClose={onClose}\n * title=\"Confirm Action\"\n * hasCloseButton\n * size={ModalSize.LG}\n * >\n * <div>\n * <p>Are you sure you want to continue?</p>\n * <Button onClick={onConfirm}>Confirm</Button>\n * </div>\n * </Modal>\n * ```\n *\n * @example\n * Custom container and styling:\n * ```jsx\n * <Modal\n * isOpen={isOpen}\n * onClose={onClose}\n * container={customContainer}\n * background=\"card\"\n * padding=\"lg\"\n * border=\"default\"\n * >\n * Content with custom styling\n * </Modal>\n * ```\n *\n * Accessibility Notes:\n * - Modal receives focus when opened\n * - Background content is hidden from screen readers when modal is open\n * - ESC key closes modal (handled by browser for role=\"dialog\")\n * - Click outside modal closes it\n * - Close button has descriptive label for screen readers\n *\n * @param props - Modal component props\n * @returns JSX element rendered via createPortal\n */\nexport const Modal: FC<ModalProps> = ({\n children,\n isOpen,\n container,\n disableScroll = true,\n onClose,\n hasCloseButton = false,\n title,\n size = ModalSize.MD,\n className,\n ...props\n}) => {\n const containerElement = useGetElementOrWindow(container);\n\n useScrollBlockage({ key: 'modal', disableScroll: isOpen && disableScroll });\n\n if (!containerElement) return <></>;\n\n const hasTitle = typeof title === 'string';\n\n return createPortal(\n <m.div\n className=\"bg-background/40 /40 invisible fixed left-0 top-0 z-50 flex size-full cursor-pointer items-center justify-center overflow-auto backdrop-blur\"\n animate={isOpen ? 'visible' : 'invisible'}\n variants={{\n visible: {\n opacity: 1,\n visibility: 'visible',\n transition: { duration: 0.1, when: 'beforeChildren' },\n },\n invisible: {\n opacity: 0,\n visibility: 'hidden',\n transition: { duration: 0.1, when: 'afterChildren' },\n },\n }}\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n aria-hidden={!isOpen}\n >\n <div className=\"flex justify-center p-4\">\n <MotionModal\n onClick={(e) => e.stopPropagation()}\n initial={{ scale: isOpen ? 0.5 : 1 }}\n animate={{ scale: isOpen ? 1 : 0.5 }}\n transition={{ duration: 0.3 }}\n className={modalVariants({\n size,\n className,\n })}\n role=\"dialog\"\n aria-modal\n roundedSize=\"2xl\"\n {...props}\n >\n <div\n className={cn(\n 'cursor-default px-4',\n hasCloseButton && hasTitle\n ? `flex items-center justify-center`\n : hasCloseButton\n ? `flex items-center justify-end`\n : hasTitle\n ? `items-center`\n : `hidden`\n )}\n >\n {hasTitle && (\n <H3 className=\"ml-4 flex items-center justify-center text-lg font-bold\">\n {title}\n </H3>\n )}\n {hasCloseButton && (\n <Button\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n label=\"Close modal\"\n className=\"ml-auto\"\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n Icon={X}\n size={ButtonSize.ICON_MD}\n />\n )}\n </div>\n <div className=\"flex flex-1 flex-col items-center overflow-auto\">\n {children}\n </div>\n </MotionModal>\n </div>\n </m.div>,\n containerElement\n );\n};\n"],"names":["ModalSize","m"],"mappings":";;;;;;;;;;;;;;;;;;AAgBO,IAAK,8BAAAA,eAAL;AAELA,aAAA,IAAA,IAAK;AAELA,aAAA,IAAA,IAAK;AAELA,aAAA,IAAA,IAAK;AAELA,aAAA,IAAA,IAAK;AAELA,aAAA,OAAA,IAAQ;AAVE,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAkDZ,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA;AAAA,QAEJ,IAAI;AAAA;AAAA,QAEJ,IAAI;AAAA;AAAA,QAEJ,IAAI;AAAA;AAAA,QAEJ,I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WAAW,cAAc;AAAA,cACvB;AAAA,cACA;AAAA,YAAA,CACD;AAAA,YACD,MAAK;AAAA,YACL,cAAU;AAAA,YACV,aAAY;AAAA,YACX,GAAG;AAAA,YAEJ,UAAA;AAAA,cAAA;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAW;AAAA,oBACT;AAAA,oBACA,kBAAkB,WACd,qCACA,iBACE,kCACA,WACE,iBACA;AAAA,kBAAA;AAAA,kBAGT,UAAA;AAAA,oBAAA,YACC,oBAAC,IAAA,EAAG,WAAU,2DACX,UAAA,OACH;AAAA,oBAED,kBACC;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,SAAS,cAAc;AAAA,wBACvB,OAAO,YAAY;AAAA,wBACnB,OAAM;AAAA,wBACN,WAAU;AAAA,wBACV,SAAS,CAAC,MAAM;AACd,4BAAE,gBAAA;AACF,oCAAA;AAAA,wBACF;AAAA,wBACA,MAAM;AAAA,wBACN,MAAM,WAAW;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACnB;AAAA,gBAAA;AAAA,cAAA;AAAA,cAGJ,oBAAC,OAAA,EAAI,WAAU,mDACZ,SAAA,CACH;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,EACF,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Burger.cjs","sources":["../../../src/components/Navbar/Burger.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\n\ninterface BurgerProps extends HTMLAttributes<HTMLDivElement> {\n isActive?: boolean;\n}\n\nconst lineStyle =\n 'bg-text absolute top-1/2 block h-[2px] w-8 transition duration-300';\n\nexport const Burger = ({\n isActive = false,\n className,\n ...props\n}: BurgerProps) => (\n <div\n className={cn('relative mr-3 size-10 cursor-pointer', className)}\n aria-checked={isActive}\n aria-expanded={isActive}\n aria-controls=\"mobile-menu\"\n role=\"switch\"\n aria-label={isActive ? 'Close menu' : 'Open menu'}\n {...props}\n >\n <div>\n <div\n className={cn(lineStyle, isActive ? 'rotate-[-45deg]' : 'rotate-0')}\n />\n <div\n className={cn(\n lineStyle,\n isActive ? '-translate-y-3 opacity-0' : '-translate-y-2 opacity-100'\n )}\n />\n </div>\n\n <div>\n <div className={cn(lineStyle, isActive ? 'opacity-0' : 'opacity-100')} />\n </div>\n\n <div>\n <div\n className={cn(lineStyle, isActive ? 'rotate-[45deg]' : 'rotate-0')}\n />\n <div\n className={cn(\n lineStyle,\n isActive ? 'translate-y-3 opacity-0' : 'translate-y-2 opacity-100'\n )}\n />\n </div>\n </div>\n);\n"],"names":["jsxs","cn","jsx"],"mappings":";;;;AAOA,MAAM,YACJ;AAEK,MAAM,SAAS,CAAC;AAAA,EACrB,WAAW;AAAA,EACX;AAAA,EACA,GAAG;AACL,MACEA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,SAAAA,GAAG,wCAAwC,SAAS;AAAA,IAC/D,gBAAc;AAAA,IACd,iBAAe;AAAA,IACf,iBAAc;AAAA,IACd,MAAK;AAAA,IACL,cAAY,WAAW,eAAe;AAAA,IACrC,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAD,gCAAC,OAAA,EACC,UAAA;AAAA,QAAAE,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,SAAAA,GAAG,WAAW,WAAW,oBAAoB,UAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAEpEC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,SAAAA;AAAAA,cACT;AAAA,cACA,WAAW,6BAA6B;AAAA,YAAA;AAAA,UAC1C;AAAA,QAAA;AAAA,MACF,GACF;AAAA,MAEAC,2BAAAA,IAAC,OAAA,EACC,UAAAA,2BAAAA,IAAC,OAAA,EAAI,WAAWD,SAAAA,GAAG,WAAW,WAAW,cAAc,aAAa,EAAA,CAAG,EAAA,CACzE;AAAA,sCAEC,OAAA,EACC,UAAA;AAAA,QAAAC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,SAAAA,GAAG,WAAW,WAAW,mBAAmB,UAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAEnEC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,SAAAA;AAAAA,cACT;AAAA,cACA,WAAW,4BAA4B;AAAA,YAAA;AAAA,UACzC;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AACF;;"}
1
+ {"version":3,"file":"Burger.cjs","sources":["../../../src/components/Navbar/Burger.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the Burger menu component\n */\ninterface BurgerProps extends HTMLAttributes<HTMLDivElement> {\n /** Whether the burger menu is in active/open state */\n isActive?: boolean;\n}\n\n/**\n * Shared styles for burger menu lines\n * Creates the classic hamburger menu appearance with smooth transitions\n */\nconst lineStyle =\n 'bg-text absolute top-1/2 block h-[2px] w-8 transition duration-300';\n\n/**\n * Burger Menu Component\n *\n * An animated hamburger menu icon that transforms between closed and open states.\n * Commonly used in mobile navigation to toggle menu visibility.\n *\n * Features:\n * - Smooth CSS transitions between states (300ms duration)\n * - Accessible with proper ARIA attributes\n * - Screen reader support with descriptive labels\n * - Role-based interaction (switch role for toggle behavior)\n * - Responsive sizing (40px × 40px clickable area)\n * - Classic three-line hamburger design\n *\n * Animation States:\n * - Closed: Three horizontal parallel lines\n * - Open: Top and bottom lines rotate to form an X, middle line fades out\n *\n * Accessibility Features:\n * - `role=\"switch\"` indicates toggle behavior\n * - `aria-expanded` reflects current menu state\n * - `aria-checked` provides current selection state\n * - `aria-controls` links to controlled menu element\n * - Dynamic `aria-label` describes current action\n *\n * @example\n * Basic usage:\n * ```tsx\n * const [isMenuOpen, setIsMenuOpen] = useState(false);\n *\n * <Burger\n * isActive={isMenuOpen}\n * onClick={() => setIsMenuOpen(!isMenuOpen)}\n * />\n * ```\n *\n * @example\n * With custom styling:\n * ```tsx\n * <Burger\n * isActive={isMenuOpen}\n * onClick={toggleMenu}\n * className=\"lg:hidden\"\n * style={{ zIndex: 1000 }}\n * />\n * ```\n *\n * @param props - Burger component props\n * @returns Animated burger menu JSX element\n */\nexport const Burger = ({\n isActive = false,\n className,\n ...props\n}: BurgerProps) => (\n <div\n className={cn('relative mr-3 size-10 cursor-pointer', className)}\n aria-checked={isActive}\n aria-expanded={isActive}\n aria-controls=\"mobile-menu\"\n role=\"switch\"\n aria-label={isActive ? 'Close menu' : 'Open menu'}\n {...props}\n >\n <div>\n <div\n className={cn(lineStyle, isActive ? 'rotate-[-45deg]' : 'rotate-0')}\n />\n <div\n className={cn(\n lineStyle,\n isActive ? '-translate-y-3 opacity-0' : '-translate-y-2 opacity-100'\n )}\n />\n </div>\n\n <div>\n <div className={cn(lineStyle, isActive ? 'opacity-0' : 'opacity-100')} />\n </div>\n\n <div>\n <div\n className={cn(lineStyle, isActive ? 'rotate-[45deg]' : 'rotate-0')}\n />\n <div\n className={cn(\n lineStyle,\n isActive ? 'translate-y-3 opacity-0' : 'translate-y-2 opacity-100'\n )}\n />\n </div>\n </div>\n);\n"],"names":["jsxs","cn","jsx"],"mappings":";;;;AAeA,MAAM,YACJ;AAoDK,MAAM,SAAS,CAAC;AAAA,EACrB,WAAW;AAAA,EACX;AAAA,EACA,GAAG;AACL,MACEA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,SAAAA,GAAG,wCAAwC,SAAS;AAAA,IAC/D,gBAAc;AAAA,IACd,iBAAe;AAAA,IACf,iBAAc;AAAA,IACd,MAAK;AAAA,IACL,cAAY,WAAW,eAAe;AAAA,IACrC,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAD,gCAAC,OAAA,EACC,UAAA;AAAA,QAAAE,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,SAAAA,GAAG,WAAW,WAAW,oBAAoB,UAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAEpEC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,SAAAA;AAAAA,cACT;AAAA,cACA,WAAW,6BAA6B;AAAA,YAAA;AAAA,UAC1C;AAAA,QAAA;AAAA,MACF,GACF;AAAA,MAEAC,2BAAAA,IAAC,OAAA,EACC,UAAAA,2BAAAA,IAAC,OAAA,EAAI,WAAWD,SAAAA,GAAG,WAAW,WAAW,cAAc,aAAa,EAAA,CAAG,EAAA,CACzE;AAAA,sCAEC,OAAA,EACC,UAAA;AAAA,QAAAC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,SAAAA,GAAG,WAAW,WAAW,mBAAmB,UAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAEnEC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,SAAAA;AAAAA,cACT;AAAA,cACA,WAAW,4BAA4B;AAAA,YAAA;AAAA,UACzC;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AACF;;"}
@@ -1,7 +1,61 @@
1
1
  import { HTMLAttributes } from 'react';
2
+ /**
3
+ * Props for the Burger menu component
4
+ */
2
5
  interface BurgerProps extends HTMLAttributes<HTMLDivElement> {
6
+ /** Whether the burger menu is in active/open state */
3
7
  isActive?: boolean;
4
8
  }
9
+ /**
10
+ * Burger Menu Component
11
+ *
12
+ * An animated hamburger menu icon that transforms between closed and open states.
13
+ * Commonly used in mobile navigation to toggle menu visibility.
14
+ *
15
+ * Features:
16
+ * - Smooth CSS transitions between states (300ms duration)
17
+ * - Accessible with proper ARIA attributes
18
+ * - Screen reader support with descriptive labels
19
+ * - Role-based interaction (switch role for toggle behavior)
20
+ * - Responsive sizing (40px × 40px clickable area)
21
+ * - Classic three-line hamburger design
22
+ *
23
+ * Animation States:
24
+ * - Closed: Three horizontal parallel lines
25
+ * - Open: Top and bottom lines rotate to form an X, middle line fades out
26
+ *
27
+ * Accessibility Features:
28
+ * - `role="switch"` indicates toggle behavior
29
+ * - `aria-expanded` reflects current menu state
30
+ * - `aria-checked` provides current selection state
31
+ * - `aria-controls` links to controlled menu element
32
+ * - Dynamic `aria-label` describes current action
33
+ *
34
+ * @example
35
+ * Basic usage:
36
+ * ```tsx
37
+ * const [isMenuOpen, setIsMenuOpen] = useState(false);
38
+ *
39
+ * <Burger
40
+ * isActive={isMenuOpen}
41
+ * onClick={() => setIsMenuOpen(!isMenuOpen)}
42
+ * />
43
+ * ```
44
+ *
45
+ * @example
46
+ * With custom styling:
47
+ * ```tsx
48
+ * <Burger
49
+ * isActive={isMenuOpen}
50
+ * onClick={toggleMenu}
51
+ * className="lg:hidden"
52
+ * style={{ zIndex: 1000 }}
53
+ * />
54
+ * ```
55
+ *
56
+ * @param props - Burger component props
57
+ * @returns Animated burger menu JSX element
58
+ */
5
59
  export declare const Burger: ({ isActive, className, ...props }: BurgerProps) => import("react/jsx-runtime").JSX.Element;
6
60
  export {};
7
61
  //# sourceMappingURL=Burger.d.ts.map