@intlayer/design-system 6.1.4 → 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 (320) hide show
  1. package/dist/.vite/manifest.json +19 -14
  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/IDE/MarkDownRender.cjs +2 -2
  129. package/dist/components/IDE/MarkDownRender.cjs.map +1 -1
  130. package/dist/components/IDE/MarkDownRender.d.ts.map +1 -1
  131. package/dist/components/IDE/MarkDownRender.mjs +2 -2
  132. package/dist/components/IDE/MarkDownRender.mjs.map +1 -1
  133. package/dist/components/InformationTag/index.cjs.map +1 -1
  134. package/dist/components/InformationTag/index.d.ts +72 -0
  135. package/dist/components/InformationTag/index.d.ts.map +1 -1
  136. package/dist/components/InformationTag/index.mjs.map +1 -1
  137. package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -1
  138. package/dist/components/KeyboardScreenAdapter/index.d.ts +100 -0
  139. package/dist/components/KeyboardScreenAdapter/index.d.ts.map +1 -1
  140. package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -1
  141. package/dist/components/Label/index.cjs +25 -3
  142. package/dist/components/Label/index.cjs.map +1 -1
  143. package/dist/components/Label/index.d.ts +65 -1
  144. package/dist/components/Label/index.d.ts.map +1 -1
  145. package/dist/components/Label/index.mjs +26 -4
  146. package/dist/components/Label/index.mjs.map +1 -1
  147. package/dist/components/Link/Link.cjs.map +1 -1
  148. package/dist/components/Link/Link.d.ts +169 -0
  149. package/dist/components/Link/Link.d.ts.map +1 -1
  150. package/dist/components/Link/Link.mjs.map +1 -1
  151. package/dist/components/Loader/index.cjs.map +1 -1
  152. package/dist/components/Loader/index.d.ts +82 -11
  153. package/dist/components/Loader/index.d.ts.map +1 -1
  154. package/dist/components/Loader/index.mjs.map +1 -1
  155. package/dist/components/Loader/spinner.cjs.map +1 -1
  156. package/dist/components/Loader/spinner.d.ts +56 -0
  157. package/dist/components/Loader/spinner.d.ts.map +1 -1
  158. package/dist/components/Loader/spinner.mjs.map +1 -1
  159. package/dist/components/MarkDownRender/MarkDownRender.cjs +3 -3
  160. package/dist/components/MarkDownRender/MarkDownRender.cjs.map +1 -1
  161. package/dist/components/MarkDownRender/MarkDownRender.d.ts +148 -1
  162. package/dist/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
  163. package/dist/components/MarkDownRender/MarkDownRender.mjs +2 -2
  164. package/dist/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
  165. package/dist/components/MarkDownRender/{processer.cjs → processor.cjs} +307 -107
  166. package/dist/components/MarkDownRender/processor.cjs.map +1 -0
  167. package/dist/components/MarkDownRender/{processer.d.ts → processor.d.ts} +1 -1
  168. package/dist/components/MarkDownRender/processor.d.ts.map +1 -0
  169. package/dist/components/MarkDownRender/{processer.mjs → processor.mjs} +307 -107
  170. package/dist/components/MarkDownRender/processor.mjs.map +1 -0
  171. package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
  172. package/dist/components/MaxHeightSmoother/index.d.ts +152 -0
  173. package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
  174. package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
  175. package/dist/components/Modal/Modal.cjs +5 -0
  176. package/dist/components/Modal/Modal.cjs.map +1 -1
  177. package/dist/components/Modal/Modal.d.ts +81 -3
  178. package/dist/components/Modal/Modal.d.ts.map +1 -1
  179. package/dist/components/Modal/Modal.mjs +5 -0
  180. package/dist/components/Modal/Modal.mjs.map +1 -1
  181. package/dist/components/Navbar/Burger.cjs.map +1 -1
  182. package/dist/components/Navbar/Burger.d.ts +54 -0
  183. package/dist/components/Navbar/Burger.d.ts.map +1 -1
  184. package/dist/components/Navbar/Burger.mjs.map +1 -1
  185. package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
  186. package/dist/components/Navbar/DesktopNavbar.d.ts +78 -0
  187. package/dist/components/Navbar/DesktopNavbar.d.ts.map +1 -1
  188. package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
  189. package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
  190. package/dist/components/Navbar/MobileNavbar.d.ts +88 -0
  191. package/dist/components/Navbar/MobileNavbar.d.ts.map +1 -1
  192. package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
  193. package/dist/components/Navbar/index.cjs.map +1 -1
  194. package/dist/components/Navbar/index.d.ts +69 -0
  195. package/dist/components/Navbar/index.d.ts.map +1 -1
  196. package/dist/components/Navbar/index.mjs.map +1 -1
  197. package/dist/components/Navbar/useNavigation.cjs +8 -1
  198. package/dist/components/Navbar/useNavigation.cjs.map +1 -1
  199. package/dist/components/Navbar/useNavigation.d.ts +83 -0
  200. package/dist/components/Navbar/useNavigation.d.ts.map +1 -1
  201. package/dist/components/Navbar/useNavigation.mjs +8 -1
  202. package/dist/components/Navbar/useNavigation.mjs.map +1 -1
  203. package/dist/components/Pattern/DotPattern.cjs.map +1 -1
  204. package/dist/components/Pattern/DotPattern.d.ts +101 -0
  205. package/dist/components/Pattern/DotPattern.d.ts.map +1 -1
  206. package/dist/components/Pattern/DotPattern.mjs.map +1 -1
  207. package/dist/components/Pattern/GridPattern.cjs.map +1 -1
  208. package/dist/components/Pattern/GridPattern.d.ts +114 -0
  209. package/dist/components/Pattern/GridPattern.d.ts.map +1 -1
  210. package/dist/components/Pattern/GridPattern.mjs.map +1 -1
  211. package/dist/components/Pattern/SpotLight.cjs.map +1 -1
  212. package/dist/components/Pattern/SpotLight.d.ts +125 -0
  213. package/dist/components/Pattern/SpotLight.d.ts.map +1 -1
  214. package/dist/components/Pattern/SpotLight.mjs.map +1 -1
  215. package/dist/components/Popover/index.cjs +10 -10
  216. package/dist/components/Popover/index.cjs.map +1 -1
  217. package/dist/components/Popover/index.d.ts +110 -15
  218. package/dist/components/Popover/index.d.ts.map +1 -1
  219. package/dist/components/Popover/index.mjs +10 -10
  220. package/dist/components/Popover/index.mjs.map +1 -1
  221. package/dist/components/PressableSpan/PressableSpan.cjs +22 -5
  222. package/dist/components/PressableSpan/PressableSpan.cjs.map +1 -1
  223. package/dist/components/PressableSpan/PressableSpan.d.ts +105 -3
  224. package/dist/components/PressableSpan/PressableSpan.d.ts.map +1 -1
  225. package/dist/components/PressableSpan/PressableSpan.mjs +22 -5
  226. package/dist/components/PressableSpan/PressableSpan.mjs.map +1 -1
  227. package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
  228. package/dist/components/RightDrawer/RightDrawer.d.ts +182 -0
  229. package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
  230. package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
  231. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.cjs.map +1 -1
  232. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts +44 -0
  233. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts.map +1 -1
  234. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.mjs.map +1 -1
  235. package/dist/components/RightDrawer/useRightDrawerStore.cjs.map +1 -1
  236. package/dist/components/RightDrawer/useRightDrawerStore.d.ts +102 -0
  237. package/dist/components/RightDrawer/useRightDrawerStore.d.ts.map +1 -1
  238. package/dist/components/RightDrawer/useRightDrawerStore.mjs.map +1 -1
  239. package/dist/components/Select/Multiselect.cjs.map +1 -1
  240. package/dist/components/Select/Multiselect.d.ts +125 -18
  241. package/dist/components/Select/Multiselect.d.ts.map +1 -1
  242. package/dist/components/Select/Multiselect.mjs.map +1 -1
  243. package/dist/components/Select/Select.cjs.map +1 -1
  244. package/dist/components/Select/Select.d.ts +214 -7
  245. package/dist/components/Select/Select.d.ts.map +1 -1
  246. package/dist/components/Select/Select.mjs.map +1 -1
  247. package/dist/components/SwitchSelector/index.cjs.map +1 -1
  248. package/dist/components/SwitchSelector/index.d.ts +157 -8
  249. package/dist/components/SwitchSelector/index.d.ts.map +1 -1
  250. package/dist/components/SwitchSelector/index.mjs.map +1 -1
  251. package/dist/components/Table/Table.cjs.map +1 -1
  252. package/dist/components/Table/Table.d.ts +184 -0
  253. package/dist/components/Table/Table.d.ts.map +1 -1
  254. package/dist/components/Table/Table.mjs.map +1 -1
  255. package/dist/components/Tag/index.cjs.map +1 -1
  256. package/dist/components/Tag/index.d.ts +223 -0
  257. package/dist/components/Tag/index.d.ts.map +1 -1
  258. package/dist/components/Tag/index.mjs.map +1 -1
  259. package/dist/components/TextArea/AutoSizeTextArea.cjs.map +1 -1
  260. package/dist/components/TextArea/AutoSizeTextArea.d.ts +91 -0
  261. package/dist/components/TextArea/AutoSizeTextArea.d.ts.map +1 -1
  262. package/dist/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
  263. package/dist/components/TextArea/AutocompleteTextArea.cjs.map +1 -1
  264. package/dist/components/TextArea/AutocompleteTextArea.d.ts +145 -0
  265. package/dist/components/TextArea/AutocompleteTextArea.d.ts.map +1 -1
  266. package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
  267. package/dist/components/TextArea/TextArea.cjs.map +1 -1
  268. package/dist/components/TextArea/TextArea.d.ts +74 -0
  269. package/dist/components/TextArea/TextArea.d.ts.map +1 -1
  270. package/dist/components/TextArea/TextArea.mjs.map +1 -1
  271. package/dist/components/Toaster/Toast.cjs +4 -0
  272. package/dist/components/Toaster/Toast.cjs.map +1 -1
  273. package/dist/components/Toaster/Toast.d.ts +148 -2
  274. package/dist/components/Toaster/Toast.d.ts.map +1 -1
  275. package/dist/components/Toaster/Toast.mjs +4 -0
  276. package/dist/components/Toaster/Toast.mjs.map +1 -1
  277. package/dist/components/Toaster/Toaster.cjs.map +1 -1
  278. package/dist/components/Toaster/Toaster.d.ts +42 -0
  279. package/dist/components/Toaster/Toaster.d.ts.map +1 -1
  280. package/dist/components/Toaster/Toaster.mjs.map +1 -1
  281. package/dist/components/Toaster/useToast.cjs.map +1 -1
  282. package/dist/components/Toaster/useToast.d.ts +199 -2
  283. package/dist/components/Toaster/useToast.d.ts.map +1 -1
  284. package/dist/components/Toaster/useToast.mjs.map +1 -1
  285. package/dist/components/WithResizer/index.cjs.map +1 -1
  286. package/dist/components/WithResizer/index.d.ts +143 -0
  287. package/dist/components/WithResizer/index.d.ts.map +1 -1
  288. package/dist/components/WithResizer/index.mjs.map +1 -1
  289. package/dist/components/index.cjs +2 -2
  290. package/dist/components/index.d.ts +0 -1
  291. package/dist/components/index.d.ts.map +1 -1
  292. package/dist/components/index.mjs +4 -4
  293. package/dist/components/index.mjs.map +1 -1
  294. package/dist/hooks/reactQuery.cjs +2 -1
  295. package/dist/hooks/reactQuery.cjs.map +1 -1
  296. package/dist/hooks/reactQuery.d.ts +1 -1
  297. package/dist/hooks/reactQuery.d.ts.map +1 -1
  298. package/dist/hooks/reactQuery.mjs +2 -1
  299. package/dist/hooks/reactQuery.mjs.map +1 -1
  300. package/dist/hooks/useHorizontalSwipe.cjs +4 -4
  301. package/dist/hooks/useHorizontalSwipe.cjs.map +1 -1
  302. package/dist/hooks/useHorizontalSwipe.d.ts.map +1 -1
  303. package/dist/hooks/useHorizontalSwipe.mjs +4 -4
  304. package/dist/hooks/useHorizontalSwipe.mjs.map +1 -1
  305. package/dist/utils/image.cjs +30 -0
  306. package/dist/utils/image.cjs.map +1 -0
  307. package/dist/utils/image.d.ts +37 -0
  308. package/dist/utils/image.d.ts.map +1 -0
  309. package/dist/utils/image.mjs +30 -0
  310. package/dist/utils/image.mjs.map +1 -0
  311. package/package.json +20 -19
  312. package/dist/components/MarkDownRender/processer.cjs.map +0 -1
  313. package/dist/components/MarkDownRender/processer.d.ts.map +0 -1
  314. package/dist/components/MarkDownRender/processer.mjs.map +0 -1
  315. package/dist/utils/capitalize.cjs +0 -10
  316. package/dist/utils/capitalize.cjs.map +0 -1
  317. package/dist/utils/capitalize.d.ts +0 -2
  318. package/dist/utils/capitalize.d.ts.map +0 -1
  319. package/dist/utils/capitalize.mjs +0 -10
  320. package/dist/utils/capitalize.mjs.map +0 -1
@@ -1,6 +1,64 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
2
  import { FC, HTMLAttributes, PropsWithChildren } from 'react';
3
+ /**
4
+ * Properties for the Tag component extending HTML div attributes and variant options
5
+ *
6
+ * @interface TagProps
7
+ * @extends {PropsWithChildren<VariantProps<typeof containerVariants>>}
8
+ * @extends {HTMLAttributes<HTMLDivElement>}
9
+ *
10
+ * @property {ReactNode} children - The content to display inside the tag
11
+ * @property {TagColor} [color] - Color theme variant of the tag
12
+ * @property {TagRoundedSize} [roundedSize] - Border radius size of the tag
13
+ * @property {TagSize} [size] - Size variant affecting padding and font size
14
+ * @property {TagBorder} [border] - Whether to show a border around the tag
15
+ * @property {TagBackground} [background] - Background visibility option
16
+ * @property {string} [className] - Additional CSS classes for custom styling
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * // Basic tag
21
+ * <Tag>Default Tag</Tag>
22
+ *
23
+ * // Success tag with border
24
+ * <Tag color={TagColor.SUCCESS} border={TagBorder.WITH}>
25
+ * Success Status
26
+ * </Tag>
27
+ *
28
+ * // Large warning tag
29
+ * <Tag color={TagColor.WARNING} size={TagSize.LG}>
30
+ * Important Warning
31
+ * </Tag>
32
+ * ```
33
+ */
3
34
  type TagProps = PropsWithChildren<VariantProps<typeof containerVariants>> & HTMLAttributes<HTMLDivElement>;
35
+ /**
36
+ * Enumeration for tag border radius sizes
37
+ *
38
+ * Controls the roundedness of tag corners, from sharp edges to fully rounded pills.
39
+ *
40
+ * @enum {string} TagRoundedSize
41
+ * @property {string} NONE - 'none' - No border radius (sharp corners)
42
+ * @property {string} SM - 'sm' - Small border radius (2px)
43
+ * @property {string} MD - 'md' - Medium border radius (6px)
44
+ * @property {string} LG - 'lg' - Large border radius (8px)
45
+ * @property {string} XL - 'xl' - Extra large border radius (12px)
46
+ * @property {string} XXL - '2xl' - 2x large border radius (16px)
47
+ * @property {string} XXXL - '3xl' - 3x large border radius (24px)
48
+ * @property {string} FULL - 'full' - Fully rounded (50% border radius, pill shape)
49
+ *
50
+ * @example
51
+ * ```tsx
52
+ * // Sharp corners
53
+ * <Tag roundedSize={TagRoundedSize.NONE}>Sharp Tag</Tag>
54
+ *
55
+ * // Pill-shaped tag
56
+ * <Tag roundedSize={TagRoundedSize.FULL}>Pill Tag</Tag>
57
+ *
58
+ * // Medium rounded corners
59
+ * <Tag roundedSize={TagRoundedSize.MD}>Rounded Tag</Tag>
60
+ * ```
61
+ */
4
62
  export declare enum TagRoundedSize {
5
63
  NONE = "none",
6
64
  SM = "sm",
@@ -11,6 +69,31 @@ export declare enum TagRoundedSize {
11
69
  XXXL = "3xl",
12
70
  FULL = "full"
13
71
  }
72
+ /**
73
+ * Enumeration for tag color themes
74
+ *
75
+ * Provides semantic color options for different tag purposes and meanings.
76
+ * Each color includes background, border, and text color variations.
77
+ *
78
+ * @enum {string} TagColor
79
+ * @property {string} SUCCESS - 'success' - Green theme for positive states, success messages, or completed items
80
+ * @property {string} ERROR - 'error' - Red theme for error states, warnings, or failed operations
81
+ * @property {string} WARNING - 'warning' - Yellow/orange theme for caution, pending states, or important notices
82
+ * @property {string} NEUTRAL - 'neutral' - Gray theme for neutral information or secondary content
83
+ * @property {string} TEXT - 'text' - Default text color theme for general purpose tags
84
+ *
85
+ * @example
86
+ * ```tsx
87
+ * // Status indicators
88
+ * <Tag color={TagColor.SUCCESS}>Completed</Tag>
89
+ * <Tag color={TagColor.ERROR}>Failed</Tag>
90
+ * <Tag color={TagColor.WARNING}>Pending</Tag>
91
+ *
92
+ * // Category tags
93
+ * <Tag color={TagColor.NEUTRAL}>Category</Tag>
94
+ * <Tag color={TagColor.TEXT}>General</Tag>
95
+ * ```
96
+ */
14
97
  export declare enum TagColor {
15
98
  SUCCESS = "success",
16
99
  ERROR = "error",
@@ -18,6 +101,29 @@ export declare enum TagColor {
18
101
  NEUTRAL = "neutral",
19
102
  TEXT = "text"
20
103
  }
104
+ /**
105
+ * Enumeration for tag size variants
106
+ *
107
+ * Controls the overall size of tags including padding, font size, and border thickness.
108
+ * Sizes are designed to maintain visual hierarchy and readability.
109
+ *
110
+ * @enum {string} TagSize
111
+ * @property {string} XS - 'xs' - Extra small (0.5rem padding, text-xs, 1.2px border)
112
+ * @property {string} SM - 'sm' - Small (0.5rem padding, text-sm, 1.5px border)
113
+ * @property {string} MD - 'md' - Medium (1rem padding, text-base, 2px border) - Default size
114
+ * @property {string} LG - 'lg' - Large (2rem padding, text-lg, 2px border)
115
+ * @property {string} XL - 'xl' - Extra large (4rem padding, text-xl, 2px border)
116
+ *
117
+ * @example
118
+ * ```tsx
119
+ * // Different sizes for hierarchy
120
+ * <Tag size={TagSize.XS}>Small detail</Tag>
121
+ * <Tag size={TagSize.SM}>Minor category</Tag>
122
+ * <Tag size={TagSize.MD}>Standard tag</Tag>
123
+ * <Tag size={TagSize.LG}>Important label</Tag>
124
+ * <Tag size={TagSize.XL}>Hero tag</Tag>
125
+ * ```
126
+ */
21
127
  export declare enum TagSize {
22
128
  XS = "xs",
23
129
  SM = "sm",
@@ -25,10 +131,40 @@ export declare enum TagSize {
25
131
  LG = "lg",
26
132
  XL = "xl"
27
133
  }
134
+ /**
135
+ * Enumeration for tag border visibility
136
+ *
137
+ * Controls whether a border is displayed around the tag.
138
+ *
139
+ * @enum {string} TagBorder
140
+ * @property {string} NONE - 'none' - No border (default)
141
+ * @property {string} WITH - 'with' - Show border with 1.5px thickness
142
+ *
143
+ * @example
144
+ * ```tsx
145
+ * <Tag border={TagBorder.NONE}>Borderless</Tag>
146
+ * <Tag border={TagBorder.WITH}>With Border</Tag>
147
+ * ```
148
+ */
28
149
  export declare enum TagBorder {
29
150
  NONE = "none",
30
151
  WITH = "with"
31
152
  }
153
+ /**
154
+ * Enumeration for tag background visibility
155
+ *
156
+ * Controls the background styling of the tag.
157
+ *
158
+ * @enum {string} TagBackground
159
+ * @property {string} NONE - 'none' - No background styling
160
+ * @property {string} WITH - 'with' - Apply background styling
161
+ *
162
+ * @example
163
+ * ```tsx
164
+ * <Tag background={TagBackground.NONE}>No Background</Tag>
165
+ * <Tag background={TagBackground.WITH}>With Background</Tag>
166
+ * ```
167
+ */
32
168
  export declare enum TagBackground {
33
169
  NONE = "none",
34
170
  WITH = "with"
@@ -40,6 +176,93 @@ declare const containerVariants: (props?: ({
40
176
  border?: "none" | "with" | null | undefined;
41
177
  background?: "none" | "with" | null | undefined;
42
178
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
179
+ /**
180
+ * Tag component for displaying labels, categories, status indicators, and badges
181
+ *
182
+ * The Tag component is a versatile labeling element that supports multiple visual variants
183
+ * for different use cases. It provides semantic color options, flexible sizing, and
184
+ * customizable styling options for borders and backgrounds.
185
+ *
186
+ * ## Features
187
+ * - **Semantic Colors**: Success, error, warning, neutral, and text color themes
188
+ * - **Flexible Sizing**: Five size variants from extra small to extra large
189
+ * - **Border Radius Options**: Eight rounding options from none to fully rounded
190
+ * - **Border Control**: Optional borders for enhanced visual separation
191
+ * - **Background Control**: Configurable background styling
192
+ * - **Accessibility**: Proper HTML semantics and keyboard navigation support
193
+ *
194
+ * ## Use Cases
195
+ * - **Status Indicators**: Show completion, error, or pending states
196
+ * - **Category Labels**: Organize and categorize content
197
+ * - **Badges**: Display counts, notifications, or achievements
198
+ * - **Keywords**: Tag content with relevant keywords or topics
199
+ * - **Metadata**: Show additional information like dates, authors, or types
200
+ *
201
+ * ## Design Principles
202
+ * - Maintains readability across all size and color combinations
203
+ * - Uses backdrop blur effect for subtle transparency
204
+ * - Follows consistent spacing and typography scales
205
+ * - Provides sufficient color contrast for accessibility
206
+ *
207
+ * @param {TagProps} props - The properties for the Tag component
208
+ * @returns {JSX.Element} The rendered tag element
209
+ *
210
+ * @example
211
+ * ```tsx
212
+ * // Basic status tags
213
+ * <Tag color={TagColor.SUCCESS}>Completed</Tag>
214
+ * <Tag color={TagColor.ERROR}>Failed</Tag>
215
+ * <Tag color={TagColor.WARNING}>In Progress</Tag>
216
+ *
217
+ * // Category tags with borders
218
+ * <Tag color={TagColor.NEUTRAL} border={TagBorder.WITH}>
219
+ * Technology
220
+ * </Tag>
221
+ * <Tag color={TagColor.TEXT} border={TagBorder.WITH}>
222
+ * Design
223
+ * </Tag>
224
+ *
225
+ * // Size variations for hierarchy
226
+ * <div className="flex items-center gap-2">
227
+ * <Tag size={TagSize.XS} color={TagColor.NEUTRAL}>Minor</Tag>
228
+ * <Tag size={TagSize.SM} color={TagColor.TEXT}>Standard</Tag>
229
+ * <Tag size={TagSize.LG} color={TagColor.SUCCESS}>Important</Tag>
230
+ * </div>
231
+ *
232
+ * // Rounded variations
233
+ * <div className="flex gap-2">
234
+ * <Tag roundedSize={TagRoundedSize.NONE}>Sharp</Tag>
235
+ * <Tag roundedSize={TagRoundedSize.MD}>Rounded</Tag>
236
+ * <Tag roundedSize={TagRoundedSize.FULL}>Pill</Tag>
237
+ * </div>
238
+ *
239
+ * // Custom styled tag
240
+ * <Tag
241
+ * color={TagColor.WARNING}
242
+ * size={TagSize.LG}
243
+ * border={TagBorder.WITH}
244
+ * roundedSize={TagRoundedSize.LG}
245
+ * className="font-bold uppercase tracking-wide"
246
+ * >
247
+ * Custom Style
248
+ * </Tag>
249
+ *
250
+ * // Interactive tags with click handlers
251
+ * <Tag
252
+ * color={TagColor.SUCCESS}
253
+ * onClick={() => console.log('Tag clicked')}
254
+ * className="cursor-pointer hover:opacity-80 transition-opacity"
255
+ * >
256
+ * Clickable Tag
257
+ * </Tag>
258
+ * ```
259
+ *
260
+ * @see {@link TagColor} - Available color theme options
261
+ * @see {@link TagSize} - Available size variants
262
+ * @see {@link TagRoundedSize} - Available border radius options
263
+ * @see {@link TagBorder} - Border visibility options
264
+ * @see {@link TagBackground} - Background styling options
265
+ */
43
266
  export declare const Tag: FC<TagProps>;
44
267
  export {};
45
268
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tag/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEnE,KAAK,QAAQ,GAAG,iBAAiB,CAAC,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC,GACvE,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjC,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,EAAE,OAAO;IACT,EAAE,OAA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,YAAY;IACnB,OAAO,YAAY;IACnB,IAAI,SAAS;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,oBAAY,OAAO;IACjB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;CACV;AAED;;;;;;;;;;;;;;GAcG;AACH,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED;;;;;;;;;;;;;;GAcG;AACH,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,QAAA,MAAM,iBAAiB;;;;;;8EA0CrB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,eAAO,MAAM,GAAG,EAAE,EAAE,CAAC,QAAQ,CAyB5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/components/Tag/index.tsx"],"sourcesContent":["import { type VariantProps, cva } from 'class-variance-authority';\nimport type { FC, HTMLAttributes, PropsWithChildren } from 'react';\n\ntype TagProps = PropsWithChildren<VariantProps<typeof containerVariants>> &\n HTMLAttributes<HTMLDivElement>;\n\nexport enum TagRoundedSize {\n NONE = 'none',\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n XXL = '2xl',\n XXXL = '3xl',\n FULL = 'full',\n}\n\nexport enum TagColor {\n SUCCESS = 'success',\n ERROR = 'error',\n WARNING = 'warning',\n NEUTRAL = 'neutral',\n TEXT = 'text',\n}\n\nexport enum TagSize {\n XS = 'xs',\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n}\n\nexport enum TagBorder {\n NONE = 'none',\n WITH = 'with',\n}\n\nexport enum TagBackground {\n NONE = 'none',\n WITH = 'with',\n}\n\nconst containerVariants = cva('backdrop-blur w-fit', {\n variants: {\n roundedSize: {\n [`${TagRoundedSize.NONE}`]: 'rounded-none',\n [`${TagRoundedSize.SM}`]: 'rounded-sm',\n [`${TagRoundedSize.MD}`]: 'rounded-md',\n [`${TagRoundedSize.LG}`]: 'rounded-lg',\n [`${TagRoundedSize.XL}`]: 'rounded-xl',\n [`${TagRoundedSize.XXL}`]: 'rounded-2xl',\n [`${TagRoundedSize.XXXL}`]: 'rounded-3xl',\n [`${TagRoundedSize.FULL}`]: 'rounded-full',\n },\n color: {\n [`${TagColor.SUCCESS}`]: 'bg-success/10 border-success text-success ',\n [`${TagColor.ERROR}`]: 'bg-error/10 border-error text-error',\n [`${TagColor.WARNING}`]: 'bg-warning/10 border-warning text-warning',\n [`${TagColor.NEUTRAL}`]: 'bg-neutral/10 /10 border-neutral text-neutral ',\n [`${TagColor.TEXT}`]: 'bg-text/10 border-text text-text',\n },\n size: {\n [`${TagSize.XS}`]: 'py-0.5 px-2 text-xs border-[1.2px]',\n [`${TagSize.SM}`]: 'py-0.5 px-2 text-sm border-[1.5px]',\n [`${TagSize.MD}`]: 'py-1 px-2 text-base border-2',\n [`${TagSize.LG}`]: 'py-2 px-3 text-lg border-2',\n [`${TagSize.XL}`]: 'py-4 px-5 text-xl border-2',\n },\n border: {\n [`${TagBorder.NONE}`]: 'border-none',\n [`${TagBorder.WITH}`]: 'border-text border-[1.5px]',\n },\n background: {\n [`${TagBackground.NONE}`]: 'bg-none',\n [`${TagBackground.WITH}`]: '',\n },\n },\n\n defaultVariants: {\n roundedSize: TagRoundedSize.FULL,\n border: TagBorder.NONE,\n color: TagColor.TEXT,\n size: TagSize.MD,\n },\n});\n\nexport const Tag: FC<TagProps> = ({\n children,\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n ...props\n}) => {\n return (\n <div\n className={containerVariants({\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n })}\n {...props}\n >\n {children}\n </div>\n );\n};\n"],"names":["TagRoundedSize","TagColor","TagSize","TagBorder","TagBackground"],"mappings":";;AAMO,IA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;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/components/Tag/index.tsx"],"sourcesContent":["import { type VariantProps, cva } from 'class-variance-authority';\nimport type { FC, HTMLAttributes, PropsWithChildren } from 'react';\n\n/**\n * Properties for the Tag component extending HTML div attributes and variant options\n *\n * @interface TagProps\n * @extends {PropsWithChildren<VariantProps<typeof containerVariants>>}\n * @extends {HTMLAttributes<HTMLDivElement>}\n *\n * @property {ReactNode} children - The content to display inside the tag\n * @property {TagColor} [color] - Color theme variant of the tag\n * @property {TagRoundedSize} [roundedSize] - Border radius size of the tag\n * @property {TagSize} [size] - Size variant affecting padding and font size\n * @property {TagBorder} [border] - Whether to show a border around the tag\n * @property {TagBackground} [background] - Background visibility option\n * @property {string} [className] - Additional CSS classes for custom styling\n *\n * @example\n * ```tsx\n * // Basic tag\n * <Tag>Default Tag</Tag>\n *\n * // Success tag with border\n * <Tag color={TagColor.SUCCESS} border={TagBorder.WITH}>\n * Success Status\n * </Tag>\n *\n * // Large warning tag\n * <Tag color={TagColor.WARNING} size={TagSize.LG}>\n * Important Warning\n * </Tag>\n * ```\n */\ntype TagProps = PropsWithChildren<VariantProps<typeof containerVariants>> &\n HTMLAttributes<HTMLDivElement>;\n\n/**\n * Enumeration for tag border radius sizes\n *\n * Controls the roundedness of tag corners, from sharp edges to fully rounded pills.\n *\n * @enum {string} TagRoundedSize\n * @property {string} NONE - 'none' - No border radius (sharp corners)\n * @property {string} SM - 'sm' - Small border radius (2px)\n * @property {string} MD - 'md' - Medium border radius (6px)\n * @property {string} LG - 'lg' - Large border radius (8px)\n * @property {string} XL - 'xl' - Extra large border radius (12px)\n * @property {string} XXL - '2xl' - 2x large border radius (16px)\n * @property {string} XXXL - '3xl' - 3x large border radius (24px)\n * @property {string} FULL - 'full' - Fully rounded (50% border radius, pill shape)\n *\n * @example\n * ```tsx\n * // Sharp corners\n * <Tag roundedSize={TagRoundedSize.NONE}>Sharp Tag</Tag>\n *\n * // Pill-shaped tag\n * <Tag roundedSize={TagRoundedSize.FULL}>Pill Tag</Tag>\n *\n * // Medium rounded corners\n * <Tag roundedSize={TagRoundedSize.MD}>Rounded Tag</Tag>\n * ```\n */\nexport enum TagRoundedSize {\n NONE = 'none',\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n XXL = '2xl',\n XXXL = '3xl',\n FULL = 'full',\n}\n\n/**\n * Enumeration for tag color themes\n *\n * Provides semantic color options for different tag purposes and meanings.\n * Each color includes background, border, and text color variations.\n *\n * @enum {string} TagColor\n * @property {string} SUCCESS - 'success' - Green theme for positive states, success messages, or completed items\n * @property {string} ERROR - 'error' - Red theme for error states, warnings, or failed operations\n * @property {string} WARNING - 'warning' - Yellow/orange theme for caution, pending states, or important notices\n * @property {string} NEUTRAL - 'neutral' - Gray theme for neutral information or secondary content\n * @property {string} TEXT - 'text' - Default text color theme for general purpose tags\n *\n * @example\n * ```tsx\n * // Status indicators\n * <Tag color={TagColor.SUCCESS}>Completed</Tag>\n * <Tag color={TagColor.ERROR}>Failed</Tag>\n * <Tag color={TagColor.WARNING}>Pending</Tag>\n *\n * // Category tags\n * <Tag color={TagColor.NEUTRAL}>Category</Tag>\n * <Tag color={TagColor.TEXT}>General</Tag>\n * ```\n */\nexport enum TagColor {\n SUCCESS = 'success',\n ERROR = 'error',\n WARNING = 'warning',\n NEUTRAL = 'neutral',\n TEXT = 'text',\n}\n\n/**\n * Enumeration for tag size variants\n *\n * Controls the overall size of tags including padding, font size, and border thickness.\n * Sizes are designed to maintain visual hierarchy and readability.\n *\n * @enum {string} TagSize\n * @property {string} XS - 'xs' - Extra small (0.5rem padding, text-xs, 1.2px border)\n * @property {string} SM - 'sm' - Small (0.5rem padding, text-sm, 1.5px border)\n * @property {string} MD - 'md' - Medium (1rem padding, text-base, 2px border) - Default size\n * @property {string} LG - 'lg' - Large (2rem padding, text-lg, 2px border)\n * @property {string} XL - 'xl' - Extra large (4rem padding, text-xl, 2px border)\n *\n * @example\n * ```tsx\n * // Different sizes for hierarchy\n * <Tag size={TagSize.XS}>Small detail</Tag>\n * <Tag size={TagSize.SM}>Minor category</Tag>\n * <Tag size={TagSize.MD}>Standard tag</Tag>\n * <Tag size={TagSize.LG}>Important label</Tag>\n * <Tag size={TagSize.XL}>Hero tag</Tag>\n * ```\n */\nexport enum TagSize {\n XS = 'xs',\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n}\n\n/**\n * Enumeration for tag border visibility\n *\n * Controls whether a border is displayed around the tag.\n *\n * @enum {string} TagBorder\n * @property {string} NONE - 'none' - No border (default)\n * @property {string} WITH - 'with' - Show border with 1.5px thickness\n *\n * @example\n * ```tsx\n * <Tag border={TagBorder.NONE}>Borderless</Tag>\n * <Tag border={TagBorder.WITH}>With Border</Tag>\n * ```\n */\nexport enum TagBorder {\n NONE = 'none',\n WITH = 'with',\n}\n\n/**\n * Enumeration for tag background visibility\n *\n * Controls the background styling of the tag.\n *\n * @enum {string} TagBackground\n * @property {string} NONE - 'none' - No background styling\n * @property {string} WITH - 'with' - Apply background styling\n *\n * @example\n * ```tsx\n * <Tag background={TagBackground.NONE}>No Background</Tag>\n * <Tag background={TagBackground.WITH}>With Background</Tag>\n * ```\n */\nexport enum TagBackground {\n NONE = 'none',\n WITH = 'with',\n}\n\nconst containerVariants = cva('backdrop-blur w-fit', {\n variants: {\n roundedSize: {\n [`${TagRoundedSize.NONE}`]: 'rounded-none',\n [`${TagRoundedSize.SM}`]: 'rounded-sm',\n [`${TagRoundedSize.MD}`]: 'rounded-md',\n [`${TagRoundedSize.LG}`]: 'rounded-lg',\n [`${TagRoundedSize.XL}`]: 'rounded-xl',\n [`${TagRoundedSize.XXL}`]: 'rounded-2xl',\n [`${TagRoundedSize.XXXL}`]: 'rounded-3xl',\n [`${TagRoundedSize.FULL}`]: 'rounded-full',\n },\n color: {\n [`${TagColor.SUCCESS}`]: 'bg-success/10 border-success text-success ',\n [`${TagColor.ERROR}`]: 'bg-error/10 border-error text-error',\n [`${TagColor.WARNING}`]: 'bg-warning/10 border-warning text-warning',\n [`${TagColor.NEUTRAL}`]: 'bg-neutral/10 /10 border-neutral text-neutral ',\n [`${TagColor.TEXT}`]: 'bg-text/10 border-text text-text',\n },\n size: {\n [`${TagSize.XS}`]: 'py-0.5 px-2 text-xs border-[1.2px]',\n [`${TagSize.SM}`]: 'py-0.5 px-2 text-sm border-[1.5px]',\n [`${TagSize.MD}`]: 'py-1 px-2 text-base border-2',\n [`${TagSize.LG}`]: 'py-2 px-3 text-lg border-2',\n [`${TagSize.XL}`]: 'py-4 px-5 text-xl border-2',\n },\n border: {\n [`${TagBorder.NONE}`]: 'border-none',\n [`${TagBorder.WITH}`]: 'border-text border-[1.5px]',\n },\n background: {\n [`${TagBackground.NONE}`]: 'bg-none',\n [`${TagBackground.WITH}`]: '',\n },\n },\n\n defaultVariants: {\n roundedSize: TagRoundedSize.FULL,\n border: TagBorder.NONE,\n color: TagColor.TEXT,\n size: TagSize.MD,\n },\n});\n\n/**\n * Tag component for displaying labels, categories, status indicators, and badges\n *\n * The Tag component is a versatile labeling element that supports multiple visual variants\n * for different use cases. It provides semantic color options, flexible sizing, and\n * customizable styling options for borders and backgrounds.\n *\n * ## Features\n * - **Semantic Colors**: Success, error, warning, neutral, and text color themes\n * - **Flexible Sizing**: Five size variants from extra small to extra large\n * - **Border Radius Options**: Eight rounding options from none to fully rounded\n * - **Border Control**: Optional borders for enhanced visual separation\n * - **Background Control**: Configurable background styling\n * - **Accessibility**: Proper HTML semantics and keyboard navigation support\n *\n * ## Use Cases\n * - **Status Indicators**: Show completion, error, or pending states\n * - **Category Labels**: Organize and categorize content\n * - **Badges**: Display counts, notifications, or achievements\n * - **Keywords**: Tag content with relevant keywords or topics\n * - **Metadata**: Show additional information like dates, authors, or types\n *\n * ## Design Principles\n * - Maintains readability across all size and color combinations\n * - Uses backdrop blur effect for subtle transparency\n * - Follows consistent spacing and typography scales\n * - Provides sufficient color contrast for accessibility\n *\n * @param {TagProps} props - The properties for the Tag component\n * @returns {JSX.Element} The rendered tag element\n *\n * @example\n * ```tsx\n * // Basic status tags\n * <Tag color={TagColor.SUCCESS}>Completed</Tag>\n * <Tag color={TagColor.ERROR}>Failed</Tag>\n * <Tag color={TagColor.WARNING}>In Progress</Tag>\n *\n * // Category tags with borders\n * <Tag color={TagColor.NEUTRAL} border={TagBorder.WITH}>\n * Technology\n * </Tag>\n * <Tag color={TagColor.TEXT} border={TagBorder.WITH}>\n * Design\n * </Tag>\n *\n * // Size variations for hierarchy\n * <div className=\"flex items-center gap-2\">\n * <Tag size={TagSize.XS} color={TagColor.NEUTRAL}>Minor</Tag>\n * <Tag size={TagSize.SM} color={TagColor.TEXT}>Standard</Tag>\n * <Tag size={TagSize.LG} color={TagColor.SUCCESS}>Important</Tag>\n * </div>\n *\n * // Rounded variations\n * <div className=\"flex gap-2\">\n * <Tag roundedSize={TagRoundedSize.NONE}>Sharp</Tag>\n * <Tag roundedSize={TagRoundedSize.MD}>Rounded</Tag>\n * <Tag roundedSize={TagRoundedSize.FULL}>Pill</Tag>\n * </div>\n *\n * // Custom styled tag\n * <Tag\n * color={TagColor.WARNING}\n * size={TagSize.LG}\n * border={TagBorder.WITH}\n * roundedSize={TagRoundedSize.LG}\n * className=\"font-bold uppercase tracking-wide\"\n * >\n * Custom Style\n * </Tag>\n *\n * // Interactive tags with click handlers\n * <Tag\n * color={TagColor.SUCCESS}\n * onClick={() => console.log('Tag clicked')}\n * className=\"cursor-pointer hover:opacity-80 transition-opacity\"\n * >\n * Clickable Tag\n * </Tag>\n * ```\n *\n * @see {@link TagColor} - Available color theme options\n * @see {@link TagSize} - Available size variants\n * @see {@link TagRoundedSize} - Available border radius options\n * @see {@link TagBorder} - Border visibility options\n * @see {@link TagBackground} - Background styling options\n */\nexport const Tag: FC<TagProps> = ({\n children,\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n ...props\n}) => {\n return (\n <div\n className={containerVariants({\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n })}\n {...props}\n >\n {children}\n </div>\n );\n};\n"],"names":["TagRoundedSize","TagColor","TagSize","TagBorder","TagBackground"],"mappings":";;AAgEO,IAAK,mCAAAA,oBAAL;AACLA,kBAAA,MAAA,IAAO;AACPA,kBAAA,IAAA,IAAK;AACLA,kBAAA,IAAA,IAAK;AACLA,kBAAA,IAAA,IAAK;AACLA,kBAAA,IAAA,IAAK;AACLA,kBAAA,KAAA,IAAM;AACNA,kBAAA,MAAA,IAAO;AACPA,kBAAA,MAAA,IAAO;AARG,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAoCL,IAAK,6BAAAC,cAAL;AACLA,YAAA,SAAA,IAAU;AACVA,YAAA,OAAA,IAAQ;AACRA,YAAA,SAAA,IAAU;AACVA,YAAA,SAAA,IAAU;AACVA,YAAA,MAAA,IAAO;AALG,SAAAA;AAAA,GAAA,YAAA,CAAA,CAAA;AA+BL,IAAK,4BAAAC,aAAL;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AALK,SAAAA;AAAA,GAAA,WAAA,CAAA,CAAA;AAuBL,IAAK,8BAAAC,eAAL;AACLA,aAAA,MAAA,IAAO;AACPA,aAAA,MAAA,IAAO;AAFG,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAoBL,IAAK,kCAAAC,mBAAL;AACLA,iBAAA,MAAA,IAAO;AACPA,iBAAA,MAAA,IAAO;AAFG,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAKZ,MAAM,oBAAoB,IAAI,uBAAuB;AAAA,EACnD,UAAU;AAAA,IACR,aAAa;AAAA,MACX,CAAC,GAAG,MAAA,EAAqB,GAAG;AAAA,MAC5B,CAAC,GAAG,IAAA,EAAmB,GAAG;AAAA,MAC1B,CAAC,GAAG,IAAA,EAAmB,GAAG;AAAA,MAC1B,CA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IAAA;AAAA,MACC,WAAW,kBAAkB;AAAA,QAC3B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA,CACD;AAAA,MACA,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutoSizeTextArea.cjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ChangeEventHandler,\n type FC,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { type TextAreaProps, TextArea } from './TextArea';\n\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n autoSize?: boolean;\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\nexport const AutoSizedTextArea: FC<AutoSizedTextAreaProps> = ({\n className,\n autoSize = true,\n onChange,\n maxRows = 999,\n ref,\n ...props\n}) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = () => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n };\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n };\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-auto',\n autoSize ? 'resize-none' : '',\n className\n )}\n {...props}\n />\n );\n};\n"],"names":["useRef","useImperativeHandle","useEffect","jsx","TextArea","cn"],"mappings":";;;;;;;AAiBA,MAAM,cAAc;AACpB,MAAM,eAAe;AAEd,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,cAAcA,aAAAA,OAAmC,IAAI;AAE3DC,eAAAA,oBAAoB,KAAK,MAAM,YAAY,OAAQ;AAEnD,QAAM,eAAe,MAAM;AACzB,UAAM,aAAa,YAAY;AAE/B,QAAI,CAAC,cAAc,CAAC,SAAU;AAE9B,UAAM,gBAAgB,WAAW;AAGjC,kBAAc,SAAS;AACvB,UAAM,eAAe,WAAW;AAChC,UAAM,YAAY,cAAc,UAAU;AAC1C,UAAM,YAAY,cAAc;AAGhC,kBAAc,SACZ,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,GAAG,SAAS,IAAI;AAAA,EAC7D;AAEAC,eAAAA,UAAU,MAAM;AACd,iBAAA;AAAA,EACF,GAAG,CAAC,MAAM,OAAO,MAAM,cAAc,YAAY,CAAC;AAElD,QAAM,eAAwD,CAAC,MAAM;AACnE,eAAW,CAAC;AACZ,iBAAA;AAAA,EACF;AAEA,QAAM,SAAS,CAAC,OAAmC;AACjD,gBAAY,UAAU;AACtB,QAAI,IAAI;AACN,mBAAA;AAAA,IACF;AAAA,EACF;AAEA,SACEC,2BAAAA;AAAAA,IAACC,6BAAAA;AAAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAWC,SAAAA;AAAAA,QACT;AAAA,QACA,WAAW,gBAAgB;AAAA,QAC3B;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;;"}
1
+ {"version":3,"file":"AutoSizeTextArea.cjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ChangeEventHandler,\n type FC,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { type TextAreaProps, TextArea } from './TextArea';\n\n/**\n * Props for the AutoSizedTextArea component.\n *\n * Extends TextAreaProps with auto-sizing functionality and row limitations.\n *\n * @example\n * ```tsx\n * // Auto-sizing textarea that grows with content\n * <AutoSizedTextArea\n * placeholder=\"Start typing and watch it grow...\"\n * autoSize={true}\n * maxRows={10}\n * />\n *\n * // Limited height with scroll when exceeded\n * <AutoSizedTextArea\n * value={longText}\n * onChange={handleChange}\n * autoSize={true}\n * maxRows={5}\n * className=\"max-h-[120px]\"\n * />\n *\n * // Disable auto-sizing for fixed height\n * <AutoSizedTextArea\n * autoSize={false}\n * rows={3}\n * placeholder=\"Fixed height textarea\"\n * />\n * ```\n */\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n /** Whether to automatically adjust height based on content */\n autoSize?: boolean;\n /** Maximum number of rows before scrolling is enabled */\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\n/**\n * AutoSizedTextArea Component\n *\n * An enhanced textarea that automatically adjusts its height based on content,\n * providing a smooth user experience for variable-length text input.\n *\n * ## Features\n * - **Auto-Sizing**: Dynamically grows and shrinks based on content\n * - **Row Limits**: Configurable maximum rows before scrolling\n * - **Smooth Transitions**: Seamless height adjustments as user types\n * - **Scroll Management**: Automatic overflow handling when max height reached\n * - **Performance Optimized**: Efficient height calculations and updates\n *\n * ## Technical Details\n * - Line height: 24px with 12px padding\n * - Height calculation: `scrollHeight` vs `maxRows * lineHeight + padding`\n * - Resize: Disabled when auto-sizing is active for smooth experience\n * - Ref forwarding: Supports imperative access to textarea element\n *\n * ## Use Cases\n * - Chat message composition with dynamic sizing\n * - Comment forms that expand with content\n * - Note-taking interfaces with variable length\n * - Social media post creation\n * - Code snippet input with growth limits\n *\n * @example\n * ```tsx\n * // Chat-style auto-expanding textarea\n * const [message, setMessage] = useState('');\n *\n * <AutoSizedTextArea\n * value={message}\n * onChange={(e) => setMessage(e.target.value)}\n * placeholder=\"Type your message...\"\n * autoSize={true}\n * maxRows={8}\n * className=\"min-h-[40px]\"\n * onKeyDown={(e) => {\n * if (e.key === 'Enter' && !e.shiftKey) {\n * e.preventDefault();\n * sendMessage(message);\n * setMessage('');\n * }\n * }}\n * />\n *\n * // Note-taking with generous height limits\n * <AutoSizedTextArea\n * defaultValue={note.content}\n * onChange={handleNoteChange}\n * placeholder=\"Write your notes here...\"\n * autoSize={true}\n * maxRows={20}\n * variant={InputVariant.DEFAULT}\n * />\n * ```\n */\nexport const AutoSizedTextArea: FC<AutoSizedTextAreaProps> = ({\n className,\n autoSize = true,\n onChange,\n maxRows = 999,\n ref,\n ...props\n}) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = () => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n };\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n };\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-auto',\n autoSize ? 'resize-none' : '',\n className\n )}\n {...props}\n />\n );\n};\n"],"names":["useRef","useImperativeHandle","useEffect","jsx","TextArea","cn"],"mappings":";;;;;;;AAkDA,MAAM,cAAc;AACpB,MAAM,eAAe;AA4Dd,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,cAAcA,aAAAA,OAAmC,IAAI;AAE3DC,eAAAA,oBAAoB,KAAK,MAAM,YAAY,OAAQ;AAEnD,QAAM,eAAe,MAAM;AACzB,UAAM,aAAa,YAAY;AAE/B,QAAI,CAAC,cAAc,CAAC,SAAU;AAE9B,UAAM,gBAAgB,WAAW;AAGjC,kBAAc,SAAS;AACvB,UAAM,eAAe,WAAW;AAChC,UAAM,YAAY,cAAc,UAAU;AAC1C,UAAM,YAAY,cAAc;AAGhC,kBAAc,SACZ,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,GAAG,SAAS,IAAI;AAAA,EAC7D;AAEAC,eAAAA,UAAU,MAAM;AACd,iBAAA;AAAA,EACF,GAAG,CAAC,MAAM,OAAO,MAAM,cAAc,YAAY,CAAC;AAElD,QAAM,eAAwD,CAAC,MAAM;AACnE,eAAW,CAAC;AACZ,iBAAA;AAAA,EACF;AAEA,QAAM,SAAS,CAAC,OAAmC;AACjD,gBAAY,UAAU;AACtB,QAAI,IAAI;AACN,mBAAA;AAAA,IACF;AAAA,EACF;AAEA,SACEC,2BAAAA;AAAAA,IAACC,6BAAAA;AAAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAWC,SAAAA;AAAAA,QACT;AAAA,QACA,WAAW,gBAAgB;AAAA,QAC3B;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;;"}
@@ -1,8 +1,99 @@
1
1
  import { FC } from 'react';
2
2
  import { TextAreaProps } from './TextArea';
3
+ /**
4
+ * Props for the AutoSizedTextArea component.
5
+ *
6
+ * Extends TextAreaProps with auto-sizing functionality and row limitations.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * // Auto-sizing textarea that grows with content
11
+ * <AutoSizedTextArea
12
+ * placeholder="Start typing and watch it grow..."
13
+ * autoSize={true}
14
+ * maxRows={10}
15
+ * />
16
+ *
17
+ * // Limited height with scroll when exceeded
18
+ * <AutoSizedTextArea
19
+ * value={longText}
20
+ * onChange={handleChange}
21
+ * autoSize={true}
22
+ * maxRows={5}
23
+ * className="max-h-[120px]"
24
+ * />
25
+ *
26
+ * // Disable auto-sizing for fixed height
27
+ * <AutoSizedTextArea
28
+ * autoSize={false}
29
+ * rows={3}
30
+ * placeholder="Fixed height textarea"
31
+ * />
32
+ * ```
33
+ */
3
34
  export type AutoSizedTextAreaProps = TextAreaProps & {
35
+ /** Whether to automatically adjust height based on content */
4
36
  autoSize?: boolean;
37
+ /** Maximum number of rows before scrolling is enabled */
5
38
  maxRows?: number;
6
39
  };
40
+ /**
41
+ * AutoSizedTextArea Component
42
+ *
43
+ * An enhanced textarea that automatically adjusts its height based on content,
44
+ * providing a smooth user experience for variable-length text input.
45
+ *
46
+ * ## Features
47
+ * - **Auto-Sizing**: Dynamically grows and shrinks based on content
48
+ * - **Row Limits**: Configurable maximum rows before scrolling
49
+ * - **Smooth Transitions**: Seamless height adjustments as user types
50
+ * - **Scroll Management**: Automatic overflow handling when max height reached
51
+ * - **Performance Optimized**: Efficient height calculations and updates
52
+ *
53
+ * ## Technical Details
54
+ * - Line height: 24px with 12px padding
55
+ * - Height calculation: `scrollHeight` vs `maxRows * lineHeight + padding`
56
+ * - Resize: Disabled when auto-sizing is active for smooth experience
57
+ * - Ref forwarding: Supports imperative access to textarea element
58
+ *
59
+ * ## Use Cases
60
+ * - Chat message composition with dynamic sizing
61
+ * - Comment forms that expand with content
62
+ * - Note-taking interfaces with variable length
63
+ * - Social media post creation
64
+ * - Code snippet input with growth limits
65
+ *
66
+ * @example
67
+ * ```tsx
68
+ * // Chat-style auto-expanding textarea
69
+ * const [message, setMessage] = useState('');
70
+ *
71
+ * <AutoSizedTextArea
72
+ * value={message}
73
+ * onChange={(e) => setMessage(e.target.value)}
74
+ * placeholder="Type your message..."
75
+ * autoSize={true}
76
+ * maxRows={8}
77
+ * className="min-h-[40px]"
78
+ * onKeyDown={(e) => {
79
+ * if (e.key === 'Enter' && !e.shiftKey) {
80
+ * e.preventDefault();
81
+ * sendMessage(message);
82
+ * setMessage('');
83
+ * }
84
+ * }}
85
+ * />
86
+ *
87
+ * // Note-taking with generous height limits
88
+ * <AutoSizedTextArea
89
+ * defaultValue={note.content}
90
+ * onChange={handleNoteChange}
91
+ * placeholder="Write your notes here..."
92
+ * autoSize={true}
93
+ * maxRows={20}
94
+ * variant={InputVariant.DEFAULT}
95
+ * />
96
+ * ```
97
+ */
7
98
  export declare const AutoSizedTextArea: FC<AutoSizedTextAreaProps>;
8
99
  //# sourceMappingURL=AutoSizeTextArea.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AutoSizeTextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,EAAE,EAIR,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,aAAa,EAAY,MAAM,YAAY,CAAC;AAE1D,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAKF,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA0DxD,CAAC"}
1
+ {"version":3,"file":"AutoSizeTextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,EAAE,EAIR,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,aAAa,EAAY,MAAM,YAAY,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAKF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA0DxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutoSizeTextArea.mjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ChangeEventHandler,\n type FC,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { type TextAreaProps, TextArea } from './TextArea';\n\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n autoSize?: boolean;\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\nexport const AutoSizedTextArea: FC<AutoSizedTextAreaProps> = ({\n className,\n autoSize = true,\n onChange,\n maxRows = 999,\n ref,\n ...props\n}) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = () => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n };\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n };\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-auto',\n autoSize ? 'resize-none' : '',\n className\n )}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;AAiBA,MAAM,cAAc;AACpB,MAAM,eAAe;AAEd,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,cAAc,OAAmC,IAAI;AAE3D,sBAAoB,KAAK,MAAM,YAAY,OAAQ;AAEnD,QAAM,eAAe,MAAM;AACzB,UAAM,aAAa,YAAY;AAE/B,QAAI,CAAC,cAAc,CAAC,SAAU;AAE9B,UAAM,gBAAgB,WAAW;AAGjC,kBAAc,SAAS;AACvB,UAAM,eAAe,WAAW;AAChC,UAAM,YAAY,cAAc,UAAU;AAC1C,UAAM,YAAY,cAAc;AAGhC,kBAAc,SACZ,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,GAAG,SAAS,IAAI;AAAA,EAC7D;AAEA,YAAU,MAAM;AACd,iBAAA;AAAA,EACF,GAAG,CAAC,MAAM,OAAO,MAAM,cAAc,YAAY,CAAC;AAElD,QAAM,eAAwD,CAAC,MAAM;AACnE,eAAW,CAAC;AACZ,iBAAA;AAAA,EACF;AAEA,QAAM,SAAS,CAAC,OAAmC;AACjD,gBAAY,UAAU;AACtB,QAAI,IAAI;AACN,mBAAA;AAAA,IACF;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA,WAAW,gBAAgB;AAAA,QAC3B;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;"}
1
+ {"version":3,"file":"AutoSizeTextArea.mjs","sources":["../../../src/components/TextArea/AutoSizeTextArea.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ChangeEventHandler,\n type FC,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { type TextAreaProps, TextArea } from './TextArea';\n\n/**\n * Props for the AutoSizedTextArea component.\n *\n * Extends TextAreaProps with auto-sizing functionality and row limitations.\n *\n * @example\n * ```tsx\n * // Auto-sizing textarea that grows with content\n * <AutoSizedTextArea\n * placeholder=\"Start typing and watch it grow...\"\n * autoSize={true}\n * maxRows={10}\n * />\n *\n * // Limited height with scroll when exceeded\n * <AutoSizedTextArea\n * value={longText}\n * onChange={handleChange}\n * autoSize={true}\n * maxRows={5}\n * className=\"max-h-[120px]\"\n * />\n *\n * // Disable auto-sizing for fixed height\n * <AutoSizedTextArea\n * autoSize={false}\n * rows={3}\n * placeholder=\"Fixed height textarea\"\n * />\n * ```\n */\nexport type AutoSizedTextAreaProps = TextAreaProps & {\n /** Whether to automatically adjust height based on content */\n autoSize?: boolean;\n /** Maximum number of rows before scrolling is enabled */\n maxRows?: number;\n};\n\nconst LINE_HEIGHT = 24; // px\nconst LINE_PADDING = 12; // px\n\n/**\n * AutoSizedTextArea Component\n *\n * An enhanced textarea that automatically adjusts its height based on content,\n * providing a smooth user experience for variable-length text input.\n *\n * ## Features\n * - **Auto-Sizing**: Dynamically grows and shrinks based on content\n * - **Row Limits**: Configurable maximum rows before scrolling\n * - **Smooth Transitions**: Seamless height adjustments as user types\n * - **Scroll Management**: Automatic overflow handling when max height reached\n * - **Performance Optimized**: Efficient height calculations and updates\n *\n * ## Technical Details\n * - Line height: 24px with 12px padding\n * - Height calculation: `scrollHeight` vs `maxRows * lineHeight + padding`\n * - Resize: Disabled when auto-sizing is active for smooth experience\n * - Ref forwarding: Supports imperative access to textarea element\n *\n * ## Use Cases\n * - Chat message composition with dynamic sizing\n * - Comment forms that expand with content\n * - Note-taking interfaces with variable length\n * - Social media post creation\n * - Code snippet input with growth limits\n *\n * @example\n * ```tsx\n * // Chat-style auto-expanding textarea\n * const [message, setMessage] = useState('');\n *\n * <AutoSizedTextArea\n * value={message}\n * onChange={(e) => setMessage(e.target.value)}\n * placeholder=\"Type your message...\"\n * autoSize={true}\n * maxRows={8}\n * className=\"min-h-[40px]\"\n * onKeyDown={(e) => {\n * if (e.key === 'Enter' && !e.shiftKey) {\n * e.preventDefault();\n * sendMessage(message);\n * setMessage('');\n * }\n * }}\n * />\n *\n * // Note-taking with generous height limits\n * <AutoSizedTextArea\n * defaultValue={note.content}\n * onChange={handleNoteChange}\n * placeholder=\"Write your notes here...\"\n * autoSize={true}\n * maxRows={20}\n * variant={InputVariant.DEFAULT}\n * />\n * ```\n */\nexport const AutoSizedTextArea: FC<AutoSizedTextAreaProps> = ({\n className,\n autoSize = true,\n onChange,\n maxRows = 999,\n ref,\n ...props\n}) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n\n useImperativeHandle(ref, () => textAreaRef.current!);\n\n const adjustHeight = () => {\n const textAreaEl = textAreaRef.current;\n\n if (!textAreaEl || !autoSize) return;\n\n const textAreaStyle = textAreaEl.style;\n\n // Reset height to get accurate scrollHeight\n textAreaStyle.height = 'auto';\n const scrollHeight = textAreaEl.scrollHeight;\n const maxHeight = LINE_HEIGHT * maxRows + LINE_PADDING;\n const minHeight = LINE_HEIGHT + LINE_PADDING;\n\n // Set the new height\n textAreaStyle.height =\n Math.max(Math.min(scrollHeight, maxHeight), minHeight) + 'px';\n };\n\n useEffect(() => {\n adjustHeight();\n }, [props.value, props.defaultValue, adjustHeight]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n onChange?.(e);\n adjustHeight();\n };\n\n const setRef = (el: HTMLTextAreaElement | null) => {\n textAreaRef.current = el;\n if (el) {\n adjustHeight();\n }\n };\n\n return (\n <TextArea\n ref={setRef}\n onChange={handleChange}\n className={cn(\n 'overflow-y-auto',\n autoSize ? 'resize-none' : '',\n className\n )}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;AAkDA,MAAM,cAAc;AACpB,MAAM,eAAe;AA4Dd,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,cAAc,OAAmC,IAAI;AAE3D,sBAAoB,KAAK,MAAM,YAAY,OAAQ;AAEnD,QAAM,eAAe,MAAM;AACzB,UAAM,aAAa,YAAY;AAE/B,QAAI,CAAC,cAAc,CAAC,SAAU;AAE9B,UAAM,gBAAgB,WAAW;AAGjC,kBAAc,SAAS;AACvB,UAAM,eAAe,WAAW;AAChC,UAAM,YAAY,cAAc,UAAU;AAC1C,UAAM,YAAY,cAAc;AAGhC,kBAAc,SACZ,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,GAAG,SAAS,IAAI;AAAA,EAC7D;AAEA,YAAU,MAAM;AACd,iBAAA;AAAA,EACF,GAAG,CAAC,MAAM,OAAO,MAAM,cAAc,YAAY,CAAC;AAElD,QAAM,eAAwD,CAAC,MAAM;AACnE,eAAW,CAAC;AACZ,iBAAA;AAAA,EACF;AAEA,QAAM,SAAS,CAAC,OAAmC;AACjD,gBAAY,UAAU;AACtB,QAAI,IAAI;AACN,mBAAA;AAAA,IACF;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA,WAAW,gBAAgB;AAAA,QAC3B;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutocompleteTextArea.cjs","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"sourcesContent":["'use client';\n\nimport { AutocompleteResponse } from '@intlayer/backend';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { type FC, useEffect, useRef, useState } from 'react';\nimport { useAutocomplete } from '../../hooks/reactQuery';\nimport {\n type AutoSizedTextAreaProps,\n AutoSizedTextArea,\n} from './AutoSizeTextArea';\n\nexport const useDebounce = <T,>(value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n // Cleanup the timer if value changes before 'delay' ms\n return () => clearTimeout(timer);\n }, [value, delay]);\n\n return debouncedValue;\n};\n\nexport type AutocompleteTextAreaProps = AutoSizedTextAreaProps & {\n isActive?: boolean;\n suggestion?: string;\n};\n\nexport const AutoCompleteTextarea: FC<AutocompleteTextAreaProps> = ({\n isActive = true,\n suggestion: suggestionProp,\n ...props\n}) => {\n const defaultValue = String(props.value ?? props.defaultValue ?? '');\n const { mutate: autocomplete } = useAutocomplete();\n const configuration = useConfiguration();\n const [isTyped, setIsTyped] = useState(false);\n const [text, setText] = useState(defaultValue);\n const [suggestion, setSuggestion] = useState('');\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const placeholderRef = useRef<HTMLSpanElement>(null);\n const ghostLayerRef = useRef<HTMLDivElement>(null);\n const [suggestionPosition, setSuggestionPosition] = useState<{\n left: number;\n top: number;\n } | null>(null);\n const [cursorAtFetch, setCursorAtFetch] = useState(-1);\n\n // Only update this “debouncedText” after the user stops typing for 200ms\n const debouncedText = useDebounce(text, 200);\n\n useEffect(() => {\n if (typeof props.value === 'undefined') return;\n setText(defaultValue);\n }, [props.value, props.defaultValue]);\n\n useEffect(() => {\n if (!isActive) return;\n if (!isTyped) return;\n\n const fetchSuggestion = async () => {\n try {\n const cursor =\n textareaRef.current?.selectionStart ?? debouncedText.length;\n const before = debouncedText.slice(0, cursor);\n const after = debouncedText.slice(cursor);\n const numLines = 5;\n const beforeLines = before.split('\\n');\n const contextBeforeLines = beforeLines.slice(\n Math.max(0, beforeLines.length - numLines - 1),\n -1\n );\n const contextBefore = contextBeforeLines.join('\\n');\n const currentLine = beforeLines[beforeLines.length - 1] ?? '';\n const afterLines = after.split('\\n');\n const contextAfter = afterLines.slice(1, numLines + 1).join('\\n');\n\n autocomplete(\n {\n text: before,\n contextBefore,\n currentLine,\n contextAfter,\n aiOptions: {\n apiKey: configuration.ai?.apiKey,\n model: configuration.ai?.model,\n temperature: configuration.ai?.temperature,\n },\n },\n {\n onSuccess: (data: AutocompleteResponse) => {\n setSuggestion(data.data?.autocompletion ?? '');\n setCursorAtFetch(cursor);\n },\n }\n );\n } catch (err) {\n console.error('Autocomplete error:', err);\n }\n };\n\n if (debouncedText.length > 3) {\n // Only fetch if user typed more than 3 chars and has paused\n setSuggestion('');\n fetchSuggestion();\n } else {\n // If typed less than threshold, clear the suggestion\n setSuggestion('');\n }\n }, [debouncedText, isActive, autocomplete, configuration]);\n\n useEffect(() => {\n if (\n !suggestion ||\n cursorAtFetch === -1 ||\n !placeholderRef.current ||\n !ghostLayerRef.current\n ) {\n setSuggestionPosition(null);\n return;\n }\n\n const rect = placeholderRef.current.getBoundingClientRect();\n const parentRect = ghostLayerRef.current.getBoundingClientRect();\n setSuggestionPosition({\n left: rect.left - parentRect.left,\n top: rect.top - parentRect.top,\n });\n }, [suggestion, cursorAtFetch, text]);\n\n const acceptSuggestion = () => {\n const currentCursor = textareaRef.current?.selectionStart ?? cursorAtFetch;\n if (currentCursor !== cursorAtFetch) return;\n const newText =\n text.slice(0, currentCursor) + suggestion + text.slice(currentCursor);\n setText(newText);\n setSuggestion('');\n setCursorAtFetch(-1);\n setTimeout(() => {\n textareaRef.current?.focus();\n const newCursorPos = currentCursor + suggestion.length;\n textareaRef.current?.setSelectionRange(newCursorPos, newCursorPos);\n }, 0);\n };\n\n return (\n <div className=\"relative w-full\">\n <div\n ref={ghostLayerRef}\n className=\"pointer-events-none absolute inset-0 whitespace-pre-wrap break-words px-1 py-3 text-base leading-[1.45rem] md:py-1 md:text-sm md:leading-[1.23rem]\"\n aria-hidden=\"true\"\n >\n {suggestion && cursorAtFetch !== -1 ? (\n <>\n <span className=\"align-text-top text-transparent\">\n {text.slice(0, cursorAtFetch)}\n </span>\n <span\n ref={placeholderRef}\n style={{ visibility: 'hidden' }}\n aria-hidden=\"true\"\n >\n {suggestion}\n </span>\n <span className=\"align-text-top text-transparent\">\n {text.slice(cursorAtFetch)}\n </span>\n </>\n ) : (\n <span className=\"align-text-top text-transparent\">{text}</span>\n )}\n {suggestionProp && (\n <span className=\"text-neutral align-text-top\">{suggestionProp}</span>\n )}\n </div>\n {suggestion && suggestionPosition && (\n <div\n className=\"pointer-events-none text-neutral whitespace-pre-wrap break-words text-base leading-[1.45rem] md:text-sm md:leading-[1.23rem]\"\n style={{\n position: 'absolute',\n left: suggestionPosition.left,\n top: suggestionPosition.top,\n }}\n >\n {suggestion}\n </div>\n )}\n <AutoSizedTextArea\n {...props}\n ref={textareaRef}\n value={text}\n onChange={(e) => {\n setIsTyped(true);\n setText(e.target.value);\n setSuggestion('');\n props.onChange?.(e);\n }}\n onKeyDown={(e) => {\n if (e.key === 'Tab' && suggestion) {\n e.preventDefault();\n acceptSuggestion();\n }\n props.onKeyDown?.(e);\n }}\n onSelect={(e) => {\n if (\n suggestion &&\n (e.target as HTMLTextAreaElement).selectionStart !== cursorAtFetch\n ) {\n setSuggestion('');\n setCursorAtFetch(-1);\n }\n props.onSelect?.(e);\n }}\n />\n </div>\n );\n};\n"],"names":["useState","useEffect","useAutocomplete","useConfiguration","useRef","jsxs","Fragment","jsx","AutoSizedTextArea"],"mappings":";;;;;;;;AAWO,MAAM,cAAc,CAAK,OAAU,UAAqB;AAC7D,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,aAAAA,SAAY,KAAK;AAE7DC,eAAAA,UAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM;AAC7B,wBAAkB,KAAK;AAAA,IACzB,GAAG,KAAK;AAGR,WAAO,MAAM,a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AAmB;AAAA,UACzB,KAAK,mBAAmB;AAAA,QAAA;AAAA,QAGzB,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAGLA,2BAAAA;AAAAA,MAACC,qCAAAA;AAAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,OAAO;AAAA,QACP,UAAU,CAAC,MAAM;AACf,qBAAW,IAAI;AACf,kBAAQ,EAAE,OAAO,KAAK;AACtB,wBAAc,EAAE;AAChB,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,QACA,WAAW,CAAC,MAAM;AAChB,cAAI,EAAE,QAAQ,SAAS,YAAY;AACjC,cAAE,eAAA;AACF,6BAAA;AAAA,UACF;AACA,gBAAM,YAAY,CAAC;AAAA,QACrB;AAAA,QACA,UAAU,CAAC,MAAM;AACf,cACE,cACC,EAAE,OAA+B,mBAAmB,eACrD;AACA,0BAAc,EAAE;AAChB,6BAAiB,EAAE;AAAA,UACrB;AACA,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;;;"}
1
+ {"version":3,"file":"AutocompleteTextArea.cjs","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"sourcesContent":["'use client';\n\nimport { AutocompleteResponse } from '@intlayer/backend';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { type FC, useEffect, useRef, useState } from 'react';\nimport { useAutocomplete } from '../../hooks/reactQuery';\nimport {\n type AutoSizedTextAreaProps,\n AutoSizedTextArea,\n} from './AutoSizeTextArea';\n\n/**\n * Custom hook for debouncing values to prevent excessive API calls.\n *\n * Delays updating the returned value until the input value has stopped changing\n * for the specified delay period.\n *\n * @param value - The value to debounce\n * @param delay - Delay in milliseconds before updating the debounced value\n * @returns The debounced value that only updates after the delay period\n *\n * @example\n * ```tsx\n * const [searchTerm, setSearchTerm] = useState('');\n * const debouncedSearchTerm = useDebounce(searchTerm, 300);\n *\n * useEffect(() => {\n * if (debouncedSearchTerm) {\n * performSearch(debouncedSearchTerm);\n * }\n * }, [debouncedSearchTerm]);\n * ```\n */\nexport const useDebounce = <T,>(value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n // Cleanup the timer if value changes before 'delay' ms\n return () => clearTimeout(timer);\n }, [value, delay]);\n\n return debouncedValue;\n};\n\n/**\n * Props for the AutocompleteTextArea component.\n *\n * Extends AutoSizedTextAreaProps with AI-powered autocomplete functionality.\n *\n * @example\n * ```tsx\n * // AI-powered autocomplete textarea\n * <AutoCompleteTextarea\n * placeholder=\"Start typing for AI suggestions...\"\n * isActive={true}\n * autoSize={true}\n * maxRows={10}\n * />\n *\n * // Manual suggestion mode\n * <AutoCompleteTextarea\n * value={content}\n * onChange={handleChange}\n * suggestion=\"Consider adding more details about...\"\n * isActive={false}\n * />\n *\n * // Disabled autocomplete for sensitive content\n * <AutoCompleteTextarea\n * placeholder=\"Private notes (no AI assistance)\"\n * isActive={false}\n * autoSize={true}\n * />\n * ```\n */\nexport type AutocompleteTextAreaProps = AutoSizedTextAreaProps & {\n /** Whether AI autocomplete is active and should fetch suggestions */\n isActive?: boolean;\n /** Manual suggestion text to display (overrides AI suggestions) */\n suggestion?: string;\n};\n\n/**\n * AutoCompleteTextarea Component\n *\n * An intelligent textarea that provides AI-powered autocomplete suggestions as users type,\n * combining auto-sizing functionality with contextual text completion.\n *\n * ## Features\n * - **AI-Powered Suggestions**: Context-aware autocomplete using configured AI models\n * - **Debounced API Calls**: Efficient suggestion fetching with 200ms debounce\n * - **Visual Suggestions**: Inline preview of suggested completions\n * - **Keyboard Navigation**: Tab key to accept suggestions\n * - **Context Analysis**: Uses surrounding text for better suggestions\n * - **Auto-Sizing**: Inherits all AutoSizedTextArea capabilities\n * - **Performance Optimized**: Smart caching and minimal re-renders\n *\n * ## Technical Implementation\n * - **Debounce Strategy**: 200ms delay before fetching suggestions\n * - **Context Window**: 5 lines before/after cursor for context\n * - **Minimum Trigger**: Requires 3+ characters before suggesting\n * - **Position Tracking**: Ghost layer for accurate suggestion positioning\n * - **Cursor Management**: Tracks cursor position during suggestion fetch\n *\n * ## AI Integration\n * - Uses configured AI model (OpenAI, Anthropic, etc.)\n * - Sends context-aware prompts for relevant suggestions\n * - Respects temperature and model settings from configuration\n * - Handles API errors gracefully without interrupting user flow\n *\n * ## Use Cases\n * - **Content Creation**: Blog posts, articles, documentation\n * - **Code Comments**: Intelligent code documentation assistance\n * - **Email Composition**: Professional email writing assistance\n * - **Creative Writing**: Story and narrative completion\n * - **Technical Documentation**: API docs, README files\n * - **Social Media**: Post creation with engagement optimization\n *\n * @example\n * ```tsx\n * // Blog writing assistant\n * const [blogPost, setBlogPost] = useState('');\n * const [isAiEnabled, setIsAiEnabled] = useState(true);\n *\n * <div className=\"space-y-4\">\n * <div className=\"flex items-center gap-2\">\n * <Switch\n * checked={isAiEnabled}\n * onChange={setIsAiEnabled}\n * />\n * <label>AI Writing Assistant</label>\n * </div>\n *\n * <AutoCompleteTextarea\n * value={blogPost}\n * onChange={(e) => setBlogPost(e.target.value)}\n * placeholder=\"Start writing your blog post...\"\n * isActive={isAiEnabled}\n * autoSize={true}\n * maxRows={15}\n * className=\"min-h-[200px] font-serif text-lg leading-relaxed\"\n * />\n * </div>\n *\n * // Code documentation assistant\n * <AutoCompleteTextarea\n * value={docComment}\n * onChange={handleDocChange}\n * placeholder=\"/** Describe this function... *\\/\"\n * isActive={true}\n * autoSize={true}\n * maxRows={8}\n * className=\"font-mono text-sm\"\n * />\n *\n * // Email composition with templates\n * <AutoCompleteTextarea\n * defaultValue=\"Dear \"\n * placeholder=\"AI will help complete your email...\"\n * isActive={true}\n * autoSize={true}\n * maxRows={12}\n * variant={InputVariant.DEFAULT}\n * />\n * ```\n *\n * ## Accessibility\n * - Ghost layer is properly hidden from screen readers\n * - Maintains focus management during suggestion acceptance\n * - Preserves keyboard navigation patterns\n * - Respects reduced motion preferences\n */\nexport const AutoCompleteTextarea: FC<AutocompleteTextAreaProps> = ({\n isActive = true,\n suggestion: suggestionProp,\n ...props\n}) => {\n const defaultValue = String(props.value ?? props.defaultValue ?? '');\n const { mutate: autocomplete } = useAutocomplete();\n const configuration = useConfiguration();\n const [isTyped, setIsTyped] = useState(false);\n const [text, setText] = useState(defaultValue);\n const [suggestion, setSuggestion] = useState('');\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const placeholderRef = useRef<HTMLSpanElement>(null);\n const ghostLayerRef = useRef<HTMLDivElement>(null);\n const [suggestionPosition, setSuggestionPosition] = useState<{\n left: number;\n top: number;\n } | null>(null);\n const [cursorAtFetch, setCursorAtFetch] = useState(-1);\n\n // Only update this “debouncedText” after the user stops typing for 200ms\n const debouncedText = useDebounce(text, 200);\n\n useEffect(() => {\n if (typeof props.value === 'undefined') return;\n setText(defaultValue);\n }, [props.value, props.defaultValue]);\n\n useEffect(() => {\n if (!isActive) return;\n if (!isTyped) return;\n\n const fetchSuggestion = async () => {\n try {\n const cursor =\n textareaRef.current?.selectionStart ?? debouncedText.length;\n const before = debouncedText.slice(0, cursor);\n const after = debouncedText.slice(cursor);\n const numLines = 5;\n const beforeLines = before.split('\\n');\n const contextBeforeLines = beforeLines.slice(\n Math.max(0, beforeLines.length - numLines - 1),\n -1\n );\n const contextBefore = contextBeforeLines.join('\\n');\n const currentLine = beforeLines[beforeLines.length - 1] ?? '';\n const afterLines = after.split('\\n');\n const contextAfter = afterLines.slice(1, numLines + 1).join('\\n');\n\n autocomplete(\n {\n text: before,\n contextBefore,\n currentLine,\n contextAfter,\n aiOptions: {\n apiKey: configuration.ai?.apiKey,\n model: configuration.ai?.model,\n temperature: configuration.ai?.temperature,\n },\n },\n {\n onSuccess: (data: AutocompleteResponse) => {\n setSuggestion(data.data?.autocompletion ?? '');\n setCursorAtFetch(cursor);\n },\n }\n );\n } catch (err) {\n console.error('Autocomplete error:', err);\n }\n };\n\n if (debouncedText.length > 3) {\n // Only fetch if user typed more than 3 chars and has paused\n setSuggestion('');\n fetchSuggestion();\n } else {\n // If typed less than threshold, clear the suggestion\n setSuggestion('');\n }\n }, [debouncedText, isActive, autocomplete, configuration]);\n\n useEffect(() => {\n if (\n !suggestion ||\n cursorAtFetch === -1 ||\n !placeholderRef.current ||\n !ghostLayerRef.current\n ) {\n setSuggestionPosition(null);\n return;\n }\n\n const rect = placeholderRef.current.getBoundingClientRect();\n const parentRect = ghostLayerRef.current.getBoundingClientRect();\n setSuggestionPosition({\n left: rect.left - parentRect.left,\n top: rect.top - parentRect.top,\n });\n }, [suggestion, cursorAtFetch, text]);\n\n const acceptSuggestion = () => {\n const currentCursor = textareaRef.current?.selectionStart ?? cursorAtFetch;\n if (currentCursor !== cursorAtFetch) return;\n const newText =\n text.slice(0, currentCursor) + suggestion + text.slice(currentCursor);\n setText(newText);\n setSuggestion('');\n setCursorAtFetch(-1);\n setTimeout(() => {\n textareaRef.current?.focus();\n const newCursorPos = currentCursor + suggestion.length;\n textareaRef.current?.setSelectionRange(newCursorPos, newCursorPos);\n }, 0);\n };\n\n return (\n <div className=\"relative w-full\">\n <div\n ref={ghostLayerRef}\n className=\"pointer-events-none absolute inset-0 whitespace-pre-wrap break-words px-1 py-3 text-base leading-[1.45rem] md:py-1 md:text-sm md:leading-[1.23rem]\"\n aria-hidden=\"true\"\n >\n {suggestion && cursorAtFetch !== -1 ? (\n <>\n <span className=\"align-text-top text-transparent\">\n {text.slice(0, cursorAtFetch)}\n </span>\n <span\n ref={placeholderRef}\n style={{ visibility: 'hidden' }}\n aria-hidden=\"true\"\n >\n {suggestion}\n </span>\n <span className=\"align-text-top text-transparent\">\n {text.slice(cursorAtFetch)}\n </span>\n </>\n ) : (\n <span className=\"align-text-top text-transparent\">{text}</span>\n )}\n {suggestionProp && (\n <span className=\"text-neutral align-text-top\">{suggestionProp}</span>\n )}\n </div>\n {suggestion && suggestionPosition && (\n <div\n className=\"pointer-events-none text-neutral whitespace-pre-wrap break-words text-base leading-[1.45rem] md:text-sm md:leading-[1.23rem]\"\n style={{\n position: 'absolute',\n left: suggestionPosition.left,\n top: suggestionPosition.top,\n }}\n >\n {suggestion}\n </div>\n )}\n <AutoSizedTextArea\n {...props}\n ref={textareaRef}\n value={text}\n onChange={(e) => {\n setIsTyped(true);\n setText(e.target.value);\n setSuggestion('');\n props.onChange?.(e);\n }}\n onKeyDown={(e) => {\n if (e.key === 'Tab' && suggestion) {\n e.preventDefault();\n acceptSuggestion();\n }\n props.onKeyDown?.(e);\n }}\n onSelect={(e) => {\n if (\n suggestion &&\n (e.target as HTMLTextAreaElement).selectionStart !== cursorAtFetch\n ) {\n setSuggestion('');\n setCursorAtFetch(-1);\n }\n props.onSelect?.(e);\n }}\n />\n </div>\n );\n};\n"],"names":["useState","useEffect","useAutocomplete","useConfiguration","useRef","jsxs","Fragment","jsx","AutoSizedTextArea"],"mappings":";;;;;;;;AAiCO,MAAM,cAAc,CAAK,OAAU,UAAqB;AAC7D,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,aAAAA,SAAY,KAAK;AAE7DC,eAAAA,UAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM;AAC7B,wBAAkB,KAAK;AAAA,IACzB,GAAG,KAAK;AAGR,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,OAAO,KAAK,CAAC;AAEjB,SAAO;AACT;AAkIO,MAAM,uBAAsD,CAAC;AAAA,EAClE,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,GAAG;AACL,MAAM;AACJ,QAAM,eAAe,OAAO,MAAM,SAAS,MAAM,gBAAgB,EAAE;AACnE,QAAM,EAAE,QAAQ,aAAA,IAAiBC,iCAAA;AACjC,QAAM,gBAAgBC,YAAAA,iBAAA;AACtB,QAAM,CAAC,SAAS,UAAU,IAAIH,aAAAA,SAAS,KAAK;AAC5C,QAAM,CAAC,MAAM,OAAO,IAAIA,aAAAA,SAAS,YAAY;AAC7C,QAAM,CAAC,YAAY,aAAa,IAAI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