@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":"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,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;AAWL,IAAK,6BAAAC,cAAL;AACLA,YAAA,SAAA,IAAU;AACVA,YAAA,OAAA,IAAQ;AACRA,YAAA,SAAA,IAAU;AACVA,YAAA,SAAA,IAAU;AACVA,YAAA,MAAA,IAAO;AALG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G,IAAA,EAAY,GAAG;AAAA,MACnB,CAAC,GAAG,IAAA,EAAY,GAAG;AAAA,MACnB,CAAC,GAAG,IAAA,EAAY,GAAG;AAAA,MACnB,CAAC,GAAG,IAAA,EAAY,GAAG;AAAA,IAAA;AAAA,IAErB,QAAQ;AAAA,MACN,CAAC,GAAG,MAAA,EAAgB,GAAG;AAAA,MACvB,CAAC,GAAG,MAAA,EAAgB,GAAG;AAAA,IAAA;AAAA,IAEzB,YAAY;AAAA,MACV,CAAC,GAAG,MAAA,EAAoB,GAAG;AAAA,MAC3B,CAAC,GAAG,MAAA,EAAoB,GAAG;AAAA,IAAA;AAAA,EAC7B;AAAA,EAGF,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA;AAAA,EAAA;AAEV,CAAC;AAEM,MAAM,MAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE;AAAA,IAAC;AAAA,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
+ {"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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MACzB,CAAC,GAAG,MAAA,EAAe,GAAG;AAAA,IAAA;AAAA,IAExB,MAAM;AAAA,MACJ,CAAC,GAAG,IAAA,EAAY,GAAG;AAAA,MACnB,CAAC,GAAG,IAAA,EAAY,GAAG;AAAA,MACnB,CAAC,GAAG,IAAA,EAAY,GAAG;AAAA,MACnB,CAAC,GAAG,IAAA,EAAY,GAAG;AAAA,MACnB,CAAC,GAAG,IAAA,EAAY,GAAG;AAAA,IAAA;AAAA,IAErB,QAAQ;AAAA,MACN,CAAC,GAAG,MAAA,EAAgB,GAAG;AAAA,MACvB,CAAC,GAAG,MAAA,EAAgB,GAAG;AAAA,IAAA;AAAA,IAEzB,YAAY;AAAA,MACV,CAAC,GAAG,MAAA,EAAoB,GAAG;AAAA,MAC3B,CAAC,GAAG,MAAA,EAAoB,GAAG;AAAA,IAAA;AAAA,EAC7B;AAAA,EAGF,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA;AAAA,EAAA;AAEV,CAAC;AAyFM,MAAM,MAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE;AAAA,IAAC;AAAA,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,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,OAAO,KAAK,CAAC;AAEjB,SAAO;AACT;AAOO,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;A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ACF,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,IAAIA,aAAAA,SAAS,EAAE;AAC/C,QAAM,cAAcI,aAAAA,OAA4B,IAAI;AACpD,QAAM,iBAAiBA,aAAAA,OAAwB,IAAI;AACnD,QAAM,gBAAgBA,aAAAA,OAAuB,IAAI;AACjD,QAAM,CAAC,oBAAoB,qBAAqB,IAAIJ,aAAAA,SAG1C,IAAI;AACd,QAAM,CAAC,eAAe,gBAAgB,IAAIA,aAAAA,SAAS,EAAE;AAGrD,QAAM,gBAAgB,YAAY,MAAM,GAAG;AAE3CC,eAAAA,UAAU,MAAM;AACd,QAAI,OAAO,MAAM,UAAU,YAAa;AACxC,YAAQ,YAAY;AAAA,EACtB,GAAG,CAAC,MA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CACb,UAAA,KAAK,MAAM,aAAa,EAAA,CAC3B;AAAA,UAAA,GACF,IAEAA,2BAAAA,IAAC,QAAA,EAAK,WAAU,mCAAmC,UAAA,MAAK;AAAA,UAEzD,kBACCA,2BAAAA,IAAC,QAAA,EAAK,WAAU,+BAA+B,UAAA,eAAA,CAAe;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAGjE,cAAc,sBACbA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO;AAAA,UACL,UAAU;AAAA,UACV,MAAM,mBAAmB;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,9 +1,154 @@
1
1
  import { FC } from 'react';
2
2
  import { AutoSizedTextAreaProps } from './AutoSizeTextArea';
3
+ /**
4
+ * Custom hook for debouncing values to prevent excessive API calls.
5
+ *
6
+ * Delays updating the returned value until the input value has stopped changing
7
+ * for the specified delay period.
8
+ *
9
+ * @param value - The value to debounce
10
+ * @param delay - Delay in milliseconds before updating the debounced value
11
+ * @returns The debounced value that only updates after the delay period
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const [searchTerm, setSearchTerm] = useState('');
16
+ * const debouncedSearchTerm = useDebounce(searchTerm, 300);
17
+ *
18
+ * useEffect(() => {
19
+ * if (debouncedSearchTerm) {
20
+ * performSearch(debouncedSearchTerm);
21
+ * }
22
+ * }, [debouncedSearchTerm]);
23
+ * ```
24
+ */
3
25
  export declare const useDebounce: <T>(value: T, delay: number) => T;
26
+ /**
27
+ * Props for the AutocompleteTextArea component.
28
+ *
29
+ * Extends AutoSizedTextAreaProps with AI-powered autocomplete functionality.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * // AI-powered autocomplete textarea
34
+ * <AutoCompleteTextarea
35
+ * placeholder="Start typing for AI suggestions..."
36
+ * isActive={true}
37
+ * autoSize={true}
38
+ * maxRows={10}
39
+ * />
40
+ *
41
+ * // Manual suggestion mode
42
+ * <AutoCompleteTextarea
43
+ * value={content}
44
+ * onChange={handleChange}
45
+ * suggestion="Consider adding more details about..."
46
+ * isActive={false}
47
+ * />
48
+ *
49
+ * // Disabled autocomplete for sensitive content
50
+ * <AutoCompleteTextarea
51
+ * placeholder="Private notes (no AI assistance)"
52
+ * isActive={false}
53
+ * autoSize={true}
54
+ * />
55
+ * ```
56
+ */
4
57
  export type AutocompleteTextAreaProps = AutoSizedTextAreaProps & {
58
+ /** Whether AI autocomplete is active and should fetch suggestions */
5
59
  isActive?: boolean;
60
+ /** Manual suggestion text to display (overrides AI suggestions) */
6
61
  suggestion?: string;
7
62
  };
63
+ /**
64
+ * AutoCompleteTextarea Component
65
+ *
66
+ * An intelligent textarea that provides AI-powered autocomplete suggestions as users type,
67
+ * combining auto-sizing functionality with contextual text completion.
68
+ *
69
+ * ## Features
70
+ * - **AI-Powered Suggestions**: Context-aware autocomplete using configured AI models
71
+ * - **Debounced API Calls**: Efficient suggestion fetching with 200ms debounce
72
+ * - **Visual Suggestions**: Inline preview of suggested completions
73
+ * - **Keyboard Navigation**: Tab key to accept suggestions
74
+ * - **Context Analysis**: Uses surrounding text for better suggestions
75
+ * - **Auto-Sizing**: Inherits all AutoSizedTextArea capabilities
76
+ * - **Performance Optimized**: Smart caching and minimal re-renders
77
+ *
78
+ * ## Technical Implementation
79
+ * - **Debounce Strategy**: 200ms delay before fetching suggestions
80
+ * - **Context Window**: 5 lines before/after cursor for context
81
+ * - **Minimum Trigger**: Requires 3+ characters before suggesting
82
+ * - **Position Tracking**: Ghost layer for accurate suggestion positioning
83
+ * - **Cursor Management**: Tracks cursor position during suggestion fetch
84
+ *
85
+ * ## AI Integration
86
+ * - Uses configured AI model (OpenAI, Anthropic, etc.)
87
+ * - Sends context-aware prompts for relevant suggestions
88
+ * - Respects temperature and model settings from configuration
89
+ * - Handles API errors gracefully without interrupting user flow
90
+ *
91
+ * ## Use Cases
92
+ * - **Content Creation**: Blog posts, articles, documentation
93
+ * - **Code Comments**: Intelligent code documentation assistance
94
+ * - **Email Composition**: Professional email writing assistance
95
+ * - **Creative Writing**: Story and narrative completion
96
+ * - **Technical Documentation**: API docs, README files
97
+ * - **Social Media**: Post creation with engagement optimization
98
+ *
99
+ * @example
100
+ * ```tsx
101
+ * // Blog writing assistant
102
+ * const [blogPost, setBlogPost] = useState('');
103
+ * const [isAiEnabled, setIsAiEnabled] = useState(true);
104
+ *
105
+ * <div className="space-y-4">
106
+ * <div className="flex items-center gap-2">
107
+ * <Switch
108
+ * checked={isAiEnabled}
109
+ * onChange={setIsAiEnabled}
110
+ * />
111
+ * <label>AI Writing Assistant</label>
112
+ * </div>
113
+ *
114
+ * <AutoCompleteTextarea
115
+ * value={blogPost}
116
+ * onChange={(e) => setBlogPost(e.target.value)}
117
+ * placeholder="Start writing your blog post..."
118
+ * isActive={isAiEnabled}
119
+ * autoSize={true}
120
+ * maxRows={15}
121
+ * className="min-h-[200px] font-serif text-lg leading-relaxed"
122
+ * />
123
+ * </div>
124
+ *
125
+ * // Code documentation assistant
126
+ * <AutoCompleteTextarea
127
+ * value={docComment}
128
+ * onChange={handleDocChange}
129
+ * placeholder="/** Describe this function... *\/"
130
+ * isActive={true}
131
+ * autoSize={true}
132
+ * maxRows={8}
133
+ * className="font-mono text-sm"
134
+ * />
135
+ *
136
+ * // Email composition with templates
137
+ * <AutoCompleteTextarea
138
+ * defaultValue="Dear "
139
+ * placeholder="AI will help complete your email..."
140
+ * isActive={true}
141
+ * autoSize={true}
142
+ * maxRows={12}
143
+ * variant={InputVariant.DEFAULT}
144
+ * />
145
+ * ```
146
+ *
147
+ * ## Accessibility
148
+ * - Ghost layer is properly hidden from screen readers
149
+ * - Maintains focus management during suggestion acceptance
150
+ * - Preserves keyboard navigation patterns
151
+ * - Respects reduced motion preferences
152
+ */
8
153
  export declare const AutoCompleteTextarea: FC<AutocompleteTextAreaProps>;
9
154
  //# sourceMappingURL=AutocompleteTextArea.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AutocompleteTextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;AAE7D,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,WAAW,GAAI,CAAC,EAAG,OAAO,CAAC,EAAE,OAAO,MAAM,KAAG,CAazD,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,GAAG;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CA6L9D,CAAC"}
1
+ {"version":3,"file":"AutocompleteTextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;AAE7D,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAAG,OAAO,CAAC,EAAE,OAAO,MAAM,KAAG,CAazD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,GAAG;IAC/D,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CA6L9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutocompleteTextArea.mjs","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":[],"mappings":";;;;;;AAWO,MAAM,cAAc,CAAK,OAAU,UAAqB;AAC7D,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAY,KAAK;AAE7D,YAAU,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;AAOO,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,IAAiB,gBAAA;AACjC,QAAM,gBAAgB,iBAAA;AACtB,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,YAAY;AAC7C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,EAAE;AAC/C,QAAM,cAAc,OAA4B,IAAI;AACpD,QAAM,iBAAiB,OAAwB,IAAI;AACnD,QAAM,gBAAgB,OAAuB,IAAI;AACjD,QAAM,CAAC,oBAAoB,qBAAqB,IAAI,SAG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,gBACL,OAAO,EAAE,YAAY,SAAA;AAAA,gBACrB,eAAY;AAAA,gBAEX,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,gCAEF,QAAA,EAAK,WAAU,mCACb,UAAA,KAAK,MAAM,aAAa,EAAA,CAC3B;AAAA,UAAA,GACF,IAEA,oBAAC,QAAA,EAAK,WAAU,mCAAmC,UAAA,MAAK;AAAA,UAEzD,kBACC,oBAAC,QAAA,EAAK,WAAU,+BAA+B,UAAA,eAAA,CAAe;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAGjE,cAAc,sBACb;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO;AAAA,UACL,UAAU;AAAA,UACV,MAAM,mBAAmB;AAAA,UACzB,KAAK,mBAAmB;AAAA,QAAA;AAAA,QAGzB,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAGL;AAAA,MAAC;AAAA,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.mjs","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":[],"mappings":";;;;;;AAiCO,MAAM,cAAc,CAAK,OAAU,UAAqB;AAC7D,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAY,KAAK;AAE7D,YAAU,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,C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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 +1 @@
1
- {"version":3,"file":"TextArea.cjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n type DetailedHTMLProps,\n type FC,\n type TextareaHTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { InputVariant, inputVariants } from '../Input';\n\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n validationStyleEnabled?: boolean;\n} & Omit<\n VariantProps<typeof inputVariants>,\n 'validationStyleEnabled' | 'variant'\n > & {\n variant?: InputVariant | `${InputVariant}`;\n };\n\nexport const TextArea: FC<TextAreaProps> = ({\n className,\n variant,\n validationStyleEnabled = false,\n ...props\n}) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled ? 'enabled' : 'disabled',\n className,\n })\n )}\n {...props}\n />\n);\n"],"names":["jsx","cn","inputVariants"],"mappings":";;;;;;;;AAwBO,MAAM,WAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,yBAAyB;AAAA,EACzB,GAAG;AACL,MACEA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,SAAAA;AAAAA,MACT;AAAA,MACAC,qCAAc;AAAA,QACZ;AAAA,QACA,wBAAwB,yBAAyB,YAAY;AAAA,QAC7D;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,IAEF,GAAG;AAAA,EAAA;AACN;;"}
1
+ {"version":3,"file":"TextArea.cjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n type DetailedHTMLProps,\n type FC,\n type TextareaHTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { InputVariant, inputVariants } from '../Input';\n\n/**\n * Props for the TextArea component.\n *\n * Extends standard HTML textarea attributes with additional design system variants\n * and validation styling options.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <TextArea placeholder=\"Enter your message...\" />\n *\n * // With error validation styling\n * <TextArea\n * value={message}\n * onChange={handleChange}\n * variant={InputVariant.ERROR}\n * validationStyleEnabled={true}\n * placeholder=\"Message is required\"\n * />\n *\n * // Large multiline input\n * <TextArea\n * rows={6}\n * cols={50}\n * variant={InputVariant.DEFAULT}\n * className=\"min-h-[120px]\"\n * placeholder=\"Write a detailed description...\"\n * />\n * ```\n */\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n /** Enable validation styling based on the variant prop */\n validationStyleEnabled?: boolean;\n} & Omit<\n VariantProps<typeof inputVariants>,\n 'validationStyleEnabled' | 'variant'\n > & {\n /** Visual variant of the textarea (default, success, error, warning, etc.) */\n variant?: InputVariant | `${InputVariant}`;\n };\n\n/**\n * TextArea Component\n *\n * A flexible textarea component that extends the standard HTML textarea with\n * design system styling variants, validation states, and consistent visual appearance.\n *\n * ## Features\n * - **Variant Support**: Multiple visual states (default, error, success, warning)\n * - **Validation Styling**: Optional validation feedback styling\n * - **Resize Control**: Disabled by default for consistent layout\n * - **Design System Integration**: Uses shared input variants for consistency\n * - **Accessibility**: Maintains all standard textarea accessibility features\n *\n * ## Use Cases\n * - Multi-line text input forms\n * - Comment and message composition\n * - Description and content fields\n * - Feedback and review forms\n * - Code snippet input (when combined with monospace styling)\n *\n * @example\n * ```tsx\n * // Basic textarea\n * <TextArea\n * placeholder=\"Enter your thoughts...\"\n * rows={4}\n * />\n *\n * // Controlled with validation\n * const [content, setContent] = useState('');\n * const hasError = content.length < 10;\n *\n * <TextArea\n * value={content}\n * onChange={(e) => setContent(e.target.value)}\n * variant={hasError ? InputVariant.ERROR : InputVariant.SUCCESS}\n * validationStyleEnabled={true}\n * placeholder=\"Minimum 10 characters required\"\n * className=\"min-h-[100px]\"\n * />\n * ```\n */\nexport const TextArea: FC<TextAreaProps> = ({\n className,\n variant,\n validationStyleEnabled = false,\n ...props\n}) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled ? 'enabled' : 'disabled',\n className,\n })\n )}\n {...props}\n />\n);\n"],"names":["jsx","cn","inputVariants"],"mappings":";;;;;;;;AAkGO,MAAM,WAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,yBAAyB;AAAA,EACzB,GAAG;AACL,MACEA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,SAAAA;AAAAA,MACT;AAAA,MACAC,qCAAc;AAAA,QACZ;AAAA,QACA,wBAAwB,yBAAyB,YAAY;AAAA,QAC7D;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,IAEF,GAAG;AAAA,EAAA;AACN;;"}
@@ -1,10 +1,84 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
2
  import { DetailedHTMLProps, FC, TextareaHTMLAttributes } from 'react';
3
3
  import { InputVariant, inputVariants } from '../Input';
4
+ /**
5
+ * Props for the TextArea component.
6
+ *
7
+ * Extends standard HTML textarea attributes with additional design system variants
8
+ * and validation styling options.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * // Basic usage
13
+ * <TextArea placeholder="Enter your message..." />
14
+ *
15
+ * // With error validation styling
16
+ * <TextArea
17
+ * value={message}
18
+ * onChange={handleChange}
19
+ * variant={InputVariant.ERROR}
20
+ * validationStyleEnabled={true}
21
+ * placeholder="Message is required"
22
+ * />
23
+ *
24
+ * // Large multiline input
25
+ * <TextArea
26
+ * rows={6}
27
+ * cols={50}
28
+ * variant={InputVariant.DEFAULT}
29
+ * className="min-h-[120px]"
30
+ * placeholder="Write a detailed description..."
31
+ * />
32
+ * ```
33
+ */
4
34
  export type TextAreaProps = DetailedHTMLProps<DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, HTMLTextAreaElement> & {
35
+ /** Enable validation styling based on the variant prop */
5
36
  validationStyleEnabled?: boolean;
6
37
  } & Omit<VariantProps<typeof inputVariants>, 'validationStyleEnabled' | 'variant'> & {
38
+ /** Visual variant of the textarea (default, success, error, warning, etc.) */
7
39
  variant?: InputVariant | `${InputVariant}`;
8
40
  };
41
+ /**
42
+ * TextArea Component
43
+ *
44
+ * A flexible textarea component that extends the standard HTML textarea with
45
+ * design system styling variants, validation states, and consistent visual appearance.
46
+ *
47
+ * ## Features
48
+ * - **Variant Support**: Multiple visual states (default, error, success, warning)
49
+ * - **Validation Styling**: Optional validation feedback styling
50
+ * - **Resize Control**: Disabled by default for consistent layout
51
+ * - **Design System Integration**: Uses shared input variants for consistency
52
+ * - **Accessibility**: Maintains all standard textarea accessibility features
53
+ *
54
+ * ## Use Cases
55
+ * - Multi-line text input forms
56
+ * - Comment and message composition
57
+ * - Description and content fields
58
+ * - Feedback and review forms
59
+ * - Code snippet input (when combined with monospace styling)
60
+ *
61
+ * @example
62
+ * ```tsx
63
+ * // Basic textarea
64
+ * <TextArea
65
+ * placeholder="Enter your thoughts..."
66
+ * rows={4}
67
+ * />
68
+ *
69
+ * // Controlled with validation
70
+ * const [content, setContent] = useState('');
71
+ * const hasError = content.length < 10;
72
+ *
73
+ * <TextArea
74
+ * value={content}
75
+ * onChange={(e) => setContent(e.target.value)}
76
+ * variant={hasError ? InputVariant.ERROR : InputVariant.SUCCESS}
77
+ * validationStyleEnabled={true}
78
+ * placeholder="Minimum 10 characters required"
79
+ * className="min-h-[100px]"
80
+ * />
81
+ * ```
82
+ */
9
83
  export declare const TextArea: FC<TextAreaProps>;
10
84
  //# sourceMappingURL=TextArea.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACP,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAC3C,iBAAiB,CACf,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,mBAAmB,CACpB,EACD,mBAAmB,CACpB,GAAG;IACF,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,IAAI,CACJ,YAAY,CAAC,OAAO,aAAa,CAAC,EAClC,wBAAwB,GAAG,SAAS,CACrC,GAAG;IACF,OAAO,CAAC,EAAE,YAAY,GAAG,GAAG,YAAY,EAAE,CAAC;CAC5C,CAAC;AAEJ,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAiBtC,CAAC"}
1
+ {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACP,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAC3C,iBAAiB,CACf,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,mBAAmB,CACpB,EACD,mBAAmB,CACpB,GAAG;IACF,0DAA0D;IAC1D,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,IAAI,CACJ,YAAY,CAAC,OAAO,aAAa,CAAC,EAClC,wBAAwB,GAAG,SAAS,CACrC,GAAG;IACF,8EAA8E;IAC9E,OAAO,CAAC,EAAE,YAAY,GAAG,GAAG,YAAY,EAAE,CAAC;CAC5C,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAiBtC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.mjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n type DetailedHTMLProps,\n type FC,\n type TextareaHTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { InputVariant, inputVariants } from '../Input';\n\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n validationStyleEnabled?: boolean;\n} & Omit<\n VariantProps<typeof inputVariants>,\n 'validationStyleEnabled' | 'variant'\n > & {\n variant?: InputVariant | `${InputVariant}`;\n };\n\nexport const TextArea: FC<TextAreaProps> = ({\n className,\n variant,\n validationStyleEnabled = false,\n ...props\n}) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled ? 'enabled' : 'disabled',\n className,\n })\n )}\n {...props}\n />\n);\n"],"names":[],"mappings":";;;;;;AAwBO,MAAM,WAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,yBAAyB;AAAA,EACzB,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA,cAAc;AAAA,QACZ;AAAA,QACA,wBAAwB,yBAAyB,YAAY;AAAA,QAC7D;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,IAEF,GAAG;AAAA,EAAA;AACN;"}
1
+ {"version":3,"file":"TextArea.mjs","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import type { VariantProps } from 'class-variance-authority';\nimport {\n type DetailedHTMLProps,\n type FC,\n type TextareaHTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { InputVariant, inputVariants } from '../Input';\n\n/**\n * Props for the TextArea component.\n *\n * Extends standard HTML textarea attributes with additional design system variants\n * and validation styling options.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <TextArea placeholder=\"Enter your message...\" />\n *\n * // With error validation styling\n * <TextArea\n * value={message}\n * onChange={handleChange}\n * variant={InputVariant.ERROR}\n * validationStyleEnabled={true}\n * placeholder=\"Message is required\"\n * />\n *\n * // Large multiline input\n * <TextArea\n * rows={6}\n * cols={50}\n * variant={InputVariant.DEFAULT}\n * className=\"min-h-[120px]\"\n * placeholder=\"Write a detailed description...\"\n * />\n * ```\n */\nexport type TextAreaProps = DetailedHTMLProps<\n DetailedHTMLProps<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n >,\n HTMLTextAreaElement\n> & {\n /** Enable validation styling based on the variant prop */\n validationStyleEnabled?: boolean;\n} & Omit<\n VariantProps<typeof inputVariants>,\n 'validationStyleEnabled' | 'variant'\n > & {\n /** Visual variant of the textarea (default, success, error, warning, etc.) */\n variant?: InputVariant | `${InputVariant}`;\n };\n\n/**\n * TextArea Component\n *\n * A flexible textarea component that extends the standard HTML textarea with\n * design system styling variants, validation states, and consistent visual appearance.\n *\n * ## Features\n * - **Variant Support**: Multiple visual states (default, error, success, warning)\n * - **Validation Styling**: Optional validation feedback styling\n * - **Resize Control**: Disabled by default for consistent layout\n * - **Design System Integration**: Uses shared input variants for consistency\n * - **Accessibility**: Maintains all standard textarea accessibility features\n *\n * ## Use Cases\n * - Multi-line text input forms\n * - Comment and message composition\n * - Description and content fields\n * - Feedback and review forms\n * - Code snippet input (when combined with monospace styling)\n *\n * @example\n * ```tsx\n * // Basic textarea\n * <TextArea\n * placeholder=\"Enter your thoughts...\"\n * rows={4}\n * />\n *\n * // Controlled with validation\n * const [content, setContent] = useState('');\n * const hasError = content.length < 10;\n *\n * <TextArea\n * value={content}\n * onChange={(e) => setContent(e.target.value)}\n * variant={hasError ? InputVariant.ERROR : InputVariant.SUCCESS}\n * validationStyleEnabled={true}\n * placeholder=\"Minimum 10 characters required\"\n * className=\"min-h-[100px]\"\n * />\n * ```\n */\nexport const TextArea: FC<TextAreaProps> = ({\n className,\n variant,\n validationStyleEnabled = false,\n ...props\n}) => (\n <textarea\n className={cn(\n 'resize-none',\n inputVariants({\n variant,\n validationStyleEnabled: validationStyleEnabled ? 'enabled' : 'disabled',\n className,\n })\n )}\n {...props}\n />\n);\n"],"names":[],"mappings":";;;;;;AAkGO,MAAM,WAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,yBAAyB;AAAA,EACzB,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA,cAAc;AAAA,QACZ;AAAA,QACA,wBAAwB,yBAAyB,YAAY;AAAA,QAC7D;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,IAEF,GAAG;AAAA,EAAA;AACN;"}