@intlayer/design-system 6.1.4 → 6.1.6-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/dist/.vite/manifest.json +19 -14
  2. package/dist/Form-CriPBaZk.js.map +1 -1
  3. package/dist/Form-DJrUK3mm.cjs.map +1 -1
  4. package/dist/components/Accordion/Accordion.cjs +51 -15
  5. package/dist/components/Accordion/Accordion.cjs.map +1 -1
  6. package/dist/components/Accordion/Accordion.d.ts +44 -5
  7. package/dist/components/Accordion/Accordion.d.ts.map +1 -1
  8. package/dist/components/Accordion/Accordion.mjs +52 -16
  9. package/dist/components/Accordion/Accordion.mjs.map +1 -1
  10. package/dist/components/Avatar/index.cjs +114 -31
  11. package/dist/components/Avatar/index.cjs.map +1 -1
  12. package/dist/components/Avatar/index.d.ts +46 -2
  13. package/dist/components/Avatar/index.d.ts.map +1 -1
  14. package/dist/components/Avatar/index.mjs +115 -32
  15. package/dist/components/Avatar/index.mjs.map +1 -1
  16. package/dist/components/Badge/index.cjs +88 -9
  17. package/dist/components/Badge/index.cjs.map +1 -1
  18. package/dist/components/Badge/index.d.ts +80 -2
  19. package/dist/components/Badge/index.d.ts.map +1 -1
  20. package/dist/components/Badge/index.mjs +89 -10
  21. package/dist/components/Badge/index.mjs.map +1 -1
  22. package/dist/components/Breadcrumb/index.cjs +124 -59
  23. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  24. package/dist/components/Breadcrumb/index.d.ts +89 -5
  25. package/dist/components/Breadcrumb/index.d.ts.map +1 -1
  26. package/dist/components/Breadcrumb/index.mjs +124 -59
  27. package/dist/components/Breadcrumb/index.mjs.map +1 -1
  28. package/dist/components/Button/Button.cjs +44 -25
  29. package/dist/components/Button/Button.cjs.map +1 -1
  30. package/dist/components/Button/Button.d.ts +95 -1
  31. package/dist/components/Button/Button.d.ts.map +1 -1
  32. package/dist/components/Button/Button.mjs +44 -25
  33. package/dist/components/Button/Button.mjs.map +1 -1
  34. package/dist/components/ClickOutsideDiv/index.cjs +38 -7
  35. package/dist/components/ClickOutsideDiv/index.cjs.map +1 -1
  36. package/dist/components/ClickOutsideDiv/index.d.ts +13 -0
  37. package/dist/components/ClickOutsideDiv/index.d.ts.map +1 -1
  38. package/dist/components/ClickOutsideDiv/index.mjs +39 -8
  39. package/dist/components/ClickOutsideDiv/index.mjs.map +1 -1
  40. package/dist/components/Container/index.cjs +2 -0
  41. package/dist/components/Container/index.cjs.map +1 -1
  42. package/dist/components/Container/index.d.ts +42 -0
  43. package/dist/components/Container/index.d.ts.map +1 -1
  44. package/dist/components/Container/index.mjs +2 -0
  45. package/dist/components/Container/index.mjs.map +1 -1
  46. package/dist/components/ContentEditor/ContentEditor.cjs +80 -33
  47. package/dist/components/ContentEditor/ContentEditor.cjs.map +1 -1
  48. package/dist/components/ContentEditor/ContentEditor.d.ts +29 -0
  49. package/dist/components/ContentEditor/ContentEditor.d.ts.map +1 -1
  50. package/dist/components/ContentEditor/ContentEditor.mjs +80 -33
  51. package/dist/components/ContentEditor/ContentEditor.mjs.map +1 -1
  52. package/dist/components/ContentEditor/ContentEditorInput.cjs +58 -31
  53. package/dist/components/ContentEditor/ContentEditorInput.cjs.map +1 -1
  54. package/dist/components/ContentEditor/ContentEditorInput.d.ts +33 -0
  55. package/dist/components/ContentEditor/ContentEditorInput.d.ts.map +1 -1
  56. package/dist/components/ContentEditor/ContentEditorInput.mjs +58 -31
  57. package/dist/components/ContentEditor/ContentEditorInput.mjs.map +1 -1
  58. package/dist/components/ContentEditor/ContentEditorTextArea.cjs +58 -30
  59. package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
  60. package/dist/components/ContentEditor/ContentEditorTextArea.d.ts +35 -0
  61. package/dist/components/ContentEditor/ContentEditorTextArea.d.ts.map +1 -1
  62. package/dist/components/ContentEditor/ContentEditorTextArea.mjs +59 -31
  63. package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
  64. package/dist/components/ContentEditor/index.cjs +4 -0
  65. package/dist/components/ContentEditor/index.cjs.map +1 -1
  66. package/dist/components/ContentEditor/index.d.ts +2 -0
  67. package/dist/components/ContentEditor/index.d.ts.map +1 -1
  68. package/dist/components/ContentEditor/index.mjs +5 -1
  69. package/dist/components/ContentEditor/index.mjs.map +1 -1
  70. package/dist/components/ContentSelector/ContentSelector.cjs +9 -1
  71. package/dist/components/ContentSelector/ContentSelector.cjs.map +1 -1
  72. package/dist/components/ContentSelector/ContentSelector.d.ts +167 -0
  73. package/dist/components/ContentSelector/ContentSelector.d.ts.map +1 -1
  74. package/dist/components/ContentSelector/ContentSelector.mjs +9 -1
  75. package/dist/components/ContentSelector/ContentSelector.mjs.map +1 -1
  76. package/dist/components/CopyButton/index.cjs +23 -8
  77. package/dist/components/CopyButton/index.cjs.map +1 -1
  78. package/dist/components/CopyButton/index.d.ts +78 -0
  79. package/dist/components/CopyButton/index.d.ts.map +1 -1
  80. package/dist/components/CopyButton/index.mjs +23 -8
  81. package/dist/components/CopyButton/index.mjs.map +1 -1
  82. package/dist/components/CopyToClipboard/index.cjs +58 -22
  83. package/dist/components/CopyToClipboard/index.cjs.map +1 -1
  84. package/dist/components/CopyToClipboard/index.d.ts +68 -2
  85. package/dist/components/CopyToClipboard/index.d.ts.map +1 -1
  86. package/dist/components/CopyToClipboard/index.mjs +59 -23
  87. package/dist/components/CopyToClipboard/index.mjs.map +1 -1
  88. package/dist/components/DropDown/index.cjs +6 -4
  89. package/dist/components/DropDown/index.cjs.map +1 -1
  90. package/dist/components/DropDown/index.d.ts +92 -15
  91. package/dist/components/DropDown/index.d.ts.map +1 -1
  92. package/dist/components/DropDown/index.mjs +6 -4
  93. package/dist/components/DropDown/index.mjs.map +1 -1
  94. package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
  95. package/dist/components/EditableField/EditableFieldInput.d.ts +38 -0
  96. package/dist/components/EditableField/EditableFieldInput.d.ts.map +1 -1
  97. package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
  98. package/dist/components/EditableField/EditableFieldLayout.cjs +10 -2
  99. package/dist/components/EditableField/EditableFieldLayout.cjs.map +1 -1
  100. package/dist/components/EditableField/EditableFieldLayout.d.ts.map +1 -1
  101. package/dist/components/EditableField/EditableFieldLayout.mjs +10 -2
  102. package/dist/components/EditableField/EditableFieldLayout.mjs.map +1 -1
  103. package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
  104. package/dist/components/EditableField/EditableFieldTextArea.d.ts +42 -0
  105. package/dist/components/EditableField/EditableFieldTextArea.d.ts.map +1 -1
  106. package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
  107. package/dist/components/ExpandCollapse/ExpandCollapse.cjs.map +1 -1
  108. package/dist/components/ExpandCollapse/ExpandCollapse.d.ts +58 -0
  109. package/dist/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
  110. package/dist/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
  111. package/dist/components/Footer/index.cjs.map +1 -1
  112. package/dist/components/Footer/index.d.ts +101 -0
  113. package/dist/components/Footer/index.d.ts.map +1 -1
  114. package/dist/components/Footer/index.mjs.map +1 -1
  115. package/dist/components/Form/elements/MultiselectElement.d.ts.map +1 -1
  116. package/dist/components/Form/elements/SelectElement.d.ts.map +1 -1
  117. package/dist/components/Form/elements/SwitchSelectorElement.d.ts.map +1 -1
  118. package/dist/components/Headers/index.cjs.map +1 -1
  119. package/dist/components/Headers/index.d.ts +69 -2
  120. package/dist/components/Headers/index.d.ts.map +1 -1
  121. package/dist/components/Headers/index.mjs.map +1 -1
  122. package/dist/components/HeightResizer/index.cjs +10 -7
  123. package/dist/components/HeightResizer/index.cjs.map +1 -1
  124. package/dist/components/HeightResizer/index.d.ts +89 -0
  125. package/dist/components/HeightResizer/index.d.ts.map +1 -1
  126. package/dist/components/HeightResizer/index.mjs +10 -7
  127. package/dist/components/HeightResizer/index.mjs.map +1 -1
  128. package/dist/components/IDE/MarkDownRender.cjs +2 -2
  129. package/dist/components/IDE/MarkDownRender.cjs.map +1 -1
  130. package/dist/components/IDE/MarkDownRender.d.ts.map +1 -1
  131. package/dist/components/IDE/MarkDownRender.mjs +2 -2
  132. package/dist/components/IDE/MarkDownRender.mjs.map +1 -1
  133. package/dist/components/InformationTag/index.cjs.map +1 -1
  134. package/dist/components/InformationTag/index.d.ts +72 -0
  135. package/dist/components/InformationTag/index.d.ts.map +1 -1
  136. package/dist/components/InformationTag/index.mjs.map +1 -1
  137. package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -1
  138. package/dist/components/KeyboardScreenAdapter/index.d.ts +100 -0
  139. package/dist/components/KeyboardScreenAdapter/index.d.ts.map +1 -1
  140. package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -1
  141. package/dist/components/Label/index.cjs +25 -3
  142. package/dist/components/Label/index.cjs.map +1 -1
  143. package/dist/components/Label/index.d.ts +65 -1
  144. package/dist/components/Label/index.d.ts.map +1 -1
  145. package/dist/components/Label/index.mjs +26 -4
  146. package/dist/components/Label/index.mjs.map +1 -1
  147. package/dist/components/Link/Link.cjs.map +1 -1
  148. package/dist/components/Link/Link.d.ts +169 -0
  149. package/dist/components/Link/Link.d.ts.map +1 -1
  150. package/dist/components/Link/Link.mjs.map +1 -1
  151. package/dist/components/Loader/index.cjs.map +1 -1
  152. package/dist/components/Loader/index.d.ts +82 -11
  153. package/dist/components/Loader/index.d.ts.map +1 -1
  154. package/dist/components/Loader/index.mjs.map +1 -1
  155. package/dist/components/Loader/spinner.cjs.map +1 -1
  156. package/dist/components/Loader/spinner.d.ts +56 -0
  157. package/dist/components/Loader/spinner.d.ts.map +1 -1
  158. package/dist/components/Loader/spinner.mjs.map +1 -1
  159. package/dist/components/MarkDownRender/MarkDownRender.cjs +3 -3
  160. package/dist/components/MarkDownRender/MarkDownRender.cjs.map +1 -1
  161. package/dist/components/MarkDownRender/MarkDownRender.d.ts +148 -1
  162. package/dist/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
  163. package/dist/components/MarkDownRender/MarkDownRender.mjs +2 -2
  164. package/dist/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
  165. package/dist/components/MarkDownRender/{processer.cjs → processor.cjs} +307 -107
  166. package/dist/components/MarkDownRender/processor.cjs.map +1 -0
  167. package/dist/components/MarkDownRender/{processer.d.ts → processor.d.ts} +1 -1
  168. package/dist/components/MarkDownRender/processor.d.ts.map +1 -0
  169. package/dist/components/MarkDownRender/{processer.mjs → processor.mjs} +307 -107
  170. package/dist/components/MarkDownRender/processor.mjs.map +1 -0
  171. package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
  172. package/dist/components/MaxHeightSmoother/index.d.ts +152 -0
  173. package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
  174. package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
  175. package/dist/components/Modal/Modal.cjs +5 -0
  176. package/dist/components/Modal/Modal.cjs.map +1 -1
  177. package/dist/components/Modal/Modal.d.ts +81 -3
  178. package/dist/components/Modal/Modal.d.ts.map +1 -1
  179. package/dist/components/Modal/Modal.mjs +5 -0
  180. package/dist/components/Modal/Modal.mjs.map +1 -1
  181. package/dist/components/Navbar/Burger.cjs.map +1 -1
  182. package/dist/components/Navbar/Burger.d.ts +54 -0
  183. package/dist/components/Navbar/Burger.d.ts.map +1 -1
  184. package/dist/components/Navbar/Burger.mjs.map +1 -1
  185. package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
  186. package/dist/components/Navbar/DesktopNavbar.d.ts +78 -0
  187. package/dist/components/Navbar/DesktopNavbar.d.ts.map +1 -1
  188. package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
  189. package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
  190. package/dist/components/Navbar/MobileNavbar.d.ts +88 -0
  191. package/dist/components/Navbar/MobileNavbar.d.ts.map +1 -1
  192. package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
  193. package/dist/components/Navbar/index.cjs.map +1 -1
  194. package/dist/components/Navbar/index.d.ts +69 -0
  195. package/dist/components/Navbar/index.d.ts.map +1 -1
  196. package/dist/components/Navbar/index.mjs.map +1 -1
  197. package/dist/components/Navbar/useNavigation.cjs +8 -1
  198. package/dist/components/Navbar/useNavigation.cjs.map +1 -1
  199. package/dist/components/Navbar/useNavigation.d.ts +83 -0
  200. package/dist/components/Navbar/useNavigation.d.ts.map +1 -1
  201. package/dist/components/Navbar/useNavigation.mjs +8 -1
  202. package/dist/components/Navbar/useNavigation.mjs.map +1 -1
  203. package/dist/components/Pattern/DotPattern.cjs.map +1 -1
  204. package/dist/components/Pattern/DotPattern.d.ts +101 -0
  205. package/dist/components/Pattern/DotPattern.d.ts.map +1 -1
  206. package/dist/components/Pattern/DotPattern.mjs.map +1 -1
  207. package/dist/components/Pattern/GridPattern.cjs.map +1 -1
  208. package/dist/components/Pattern/GridPattern.d.ts +114 -0
  209. package/dist/components/Pattern/GridPattern.d.ts.map +1 -1
  210. package/dist/components/Pattern/GridPattern.mjs.map +1 -1
  211. package/dist/components/Pattern/SpotLight.cjs.map +1 -1
  212. package/dist/components/Pattern/SpotLight.d.ts +125 -0
  213. package/dist/components/Pattern/SpotLight.d.ts.map +1 -1
  214. package/dist/components/Pattern/SpotLight.mjs.map +1 -1
  215. package/dist/components/Popover/index.cjs +10 -10
  216. package/dist/components/Popover/index.cjs.map +1 -1
  217. package/dist/components/Popover/index.d.ts +110 -15
  218. package/dist/components/Popover/index.d.ts.map +1 -1
  219. package/dist/components/Popover/index.mjs +10 -10
  220. package/dist/components/Popover/index.mjs.map +1 -1
  221. package/dist/components/PressableSpan/PressableSpan.cjs +22 -5
  222. package/dist/components/PressableSpan/PressableSpan.cjs.map +1 -1
  223. package/dist/components/PressableSpan/PressableSpan.d.ts +105 -3
  224. package/dist/components/PressableSpan/PressableSpan.d.ts.map +1 -1
  225. package/dist/components/PressableSpan/PressableSpan.mjs +22 -5
  226. package/dist/components/PressableSpan/PressableSpan.mjs.map +1 -1
  227. package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
  228. package/dist/components/RightDrawer/RightDrawer.d.ts +182 -0
  229. package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
  230. package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
  231. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.cjs.map +1 -1
  232. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts +44 -0
  233. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts.map +1 -1
  234. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.mjs.map +1 -1
  235. package/dist/components/RightDrawer/useRightDrawerStore.cjs.map +1 -1
  236. package/dist/components/RightDrawer/useRightDrawerStore.d.ts +102 -0
  237. package/dist/components/RightDrawer/useRightDrawerStore.d.ts.map +1 -1
  238. package/dist/components/RightDrawer/useRightDrawerStore.mjs.map +1 -1
  239. package/dist/components/Select/Multiselect.cjs.map +1 -1
  240. package/dist/components/Select/Multiselect.d.ts +125 -18
  241. package/dist/components/Select/Multiselect.d.ts.map +1 -1
  242. package/dist/components/Select/Multiselect.mjs.map +1 -1
  243. package/dist/components/Select/Select.cjs.map +1 -1
  244. package/dist/components/Select/Select.d.ts +214 -7
  245. package/dist/components/Select/Select.d.ts.map +1 -1
  246. package/dist/components/Select/Select.mjs.map +1 -1
  247. package/dist/components/SwitchSelector/index.cjs.map +1 -1
  248. package/dist/components/SwitchSelector/index.d.ts +157 -8
  249. package/dist/components/SwitchSelector/index.d.ts.map +1 -1
  250. package/dist/components/SwitchSelector/index.mjs.map +1 -1
  251. package/dist/components/Table/Table.cjs.map +1 -1
  252. package/dist/components/Table/Table.d.ts +184 -0
  253. package/dist/components/Table/Table.d.ts.map +1 -1
  254. package/dist/components/Table/Table.mjs.map +1 -1
  255. package/dist/components/Tag/index.cjs.map +1 -1
  256. package/dist/components/Tag/index.d.ts +223 -0
  257. package/dist/components/Tag/index.d.ts.map +1 -1
  258. package/dist/components/Tag/index.mjs.map +1 -1
  259. package/dist/components/TextArea/AutoSizeTextArea.cjs.map +1 -1
  260. package/dist/components/TextArea/AutoSizeTextArea.d.ts +91 -0
  261. package/dist/components/TextArea/AutoSizeTextArea.d.ts.map +1 -1
  262. package/dist/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
  263. package/dist/components/TextArea/AutocompleteTextArea.cjs.map +1 -1
  264. package/dist/components/TextArea/AutocompleteTextArea.d.ts +145 -0
  265. package/dist/components/TextArea/AutocompleteTextArea.d.ts.map +1 -1
  266. package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
  267. package/dist/components/TextArea/TextArea.cjs.map +1 -1
  268. package/dist/components/TextArea/TextArea.d.ts +74 -0
  269. package/dist/components/TextArea/TextArea.d.ts.map +1 -1
  270. package/dist/components/TextArea/TextArea.mjs.map +1 -1
  271. package/dist/components/Toaster/Toast.cjs +4 -0
  272. package/dist/components/Toaster/Toast.cjs.map +1 -1
  273. package/dist/components/Toaster/Toast.d.ts +148 -2
  274. package/dist/components/Toaster/Toast.d.ts.map +1 -1
  275. package/dist/components/Toaster/Toast.mjs +4 -0
  276. package/dist/components/Toaster/Toast.mjs.map +1 -1
  277. package/dist/components/Toaster/Toaster.cjs.map +1 -1
  278. package/dist/components/Toaster/Toaster.d.ts +42 -0
  279. package/dist/components/Toaster/Toaster.d.ts.map +1 -1
  280. package/dist/components/Toaster/Toaster.mjs.map +1 -1
  281. package/dist/components/Toaster/useToast.cjs.map +1 -1
  282. package/dist/components/Toaster/useToast.d.ts +199 -2
  283. package/dist/components/Toaster/useToast.d.ts.map +1 -1
  284. package/dist/components/Toaster/useToast.mjs.map +1 -1
  285. package/dist/components/WithResizer/index.cjs.map +1 -1
  286. package/dist/components/WithResizer/index.d.ts +143 -0
  287. package/dist/components/WithResizer/index.d.ts.map +1 -1
  288. package/dist/components/WithResizer/index.mjs.map +1 -1
  289. package/dist/components/index.cjs +2 -2
  290. package/dist/components/index.d.ts +0 -1
  291. package/dist/components/index.d.ts.map +1 -1
  292. package/dist/components/index.mjs +4 -4
  293. package/dist/components/index.mjs.map +1 -1
  294. package/dist/hooks/reactQuery.cjs +2 -1
  295. package/dist/hooks/reactQuery.cjs.map +1 -1
  296. package/dist/hooks/reactQuery.d.ts +1 -1
  297. package/dist/hooks/reactQuery.d.ts.map +1 -1
  298. package/dist/hooks/reactQuery.mjs +2 -1
  299. package/dist/hooks/reactQuery.mjs.map +1 -1
  300. package/dist/hooks/useHorizontalSwipe.cjs +4 -4
  301. package/dist/hooks/useHorizontalSwipe.cjs.map +1 -1
  302. package/dist/hooks/useHorizontalSwipe.d.ts.map +1 -1
  303. package/dist/hooks/useHorizontalSwipe.mjs +4 -4
  304. package/dist/hooks/useHorizontalSwipe.mjs.map +1 -1
  305. package/dist/utils/image.cjs +30 -0
  306. package/dist/utils/image.cjs.map +1 -0
  307. package/dist/utils/image.d.ts +37 -0
  308. package/dist/utils/image.d.ts.map +1 -0
  309. package/dist/utils/image.mjs +30 -0
  310. package/dist/utils/image.mjs.map +1 -0
  311. package/package.json +20 -19
  312. package/dist/components/MarkDownRender/processer.cjs.map +0 -1
  313. package/dist/components/MarkDownRender/processer.d.ts.map +0 -1
  314. package/dist/components/MarkDownRender/processer.mjs.map +0 -1
  315. package/dist/utils/capitalize.cjs +0 -10
  316. package/dist/utils/capitalize.cjs.map +0 -1
  317. package/dist/utils/capitalize.d.ts +0 -2
  318. package/dist/utils/capitalize.d.ts.map +0 -1
  319. package/dist/utils/capitalize.mjs +0 -10
  320. package/dist/utils/capitalize.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["import type { DetailedHTMLProps, FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Container } from '../Container';\n\nexport type PopoverProps = DetailedHTMLProps<\n HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n> & {\n identifier: string;\n};\n\nexport type PopoverType = FC<PopoverProps> & {\n Detail: FC<DetailProps>;\n};\n\n/**\n * Trigger allowing to open a popover menu.\n *\n * Example:\n * ```jsx\n * <Popover identifier=\"popover\">\n * Open popover\n *\n * <Popover.Detail identifier=\"popover\">\n * <div>Content</div>\n * </Popover.Detail>\n * </Popover>\n * ```\n *\n * > Note Popover.Trigger can be replaced by a button. Don't add a button inside the trigger.\n */\nexport const Popover: PopoverType = ({\n children,\n className,\n identifier,\n ...props\n}) => (\n <div\n className={cn('group/popover relative flex cursor-pointer', className)}\n aria-label={`Popover ${identifier}`}\n id={`unrollable-panel-button-${identifier}`}\n aria-haspopup\n {...props}\n >\n {children}\n </div>\n);\n\nexport type DetailProps = HTMLAttributes<HTMLDivElement> & {\n isFocusable?: boolean;\n isHidden?: boolean;\n isOverable?: boolean;\n identifier: string;\n xAlign?: PopoverXAlign | `${PopoverXAlign}`;\n yAlign?: PopoverYAlign | `${PopoverYAlign}`;\n displayArrow?: boolean;\n};\n\nexport enum PopoverXAlign {\n START = 'start',\n END = 'end',\n}\n\nexport enum PopoverYAlign {\n BELOW = 'bellow',\n ABOVE = 'above',\n}\n\n/**\n * Component that opens a popover menu when the trigger is clicked.\n *\n * Example:\n * ```jsx\n * <Popover.Detail identifier=\"popover\">\n * <div>Content</div>\n * </Popover.Detail>\n * ```\n */\nconst Detail: FC<DetailProps> = ({\n children,\n isHidden = undefined,\n isOverable = true,\n isFocusable = false,\n xAlign = PopoverXAlign.START,\n yAlign = PopoverYAlign.BELOW,\n identifier,\n className,\n displayArrow = true,\n ...props\n}) => (\n <Container\n transparency=\"sm\"\n aria-hidden={isHidden}\n aria-labelledby={`unrollable-panel-button-${identifier}`}\n id={`unrollable-panel-${identifier}`}\n className={cn(\n 'absolute z-[1000] min-w-full ring-neutral ring-1 rounded-md',\n\n /* Positioning */\n xAlign === 'start' && 'left-0',\n xAlign === 'end' && 'right-0',\n yAlign === 'bellow' && 'top-[calc(100%+1rem)]',\n yAlign === 'above' && 'bottom-[calc(100%+1rem)]',\n\n /* Arrow indicator */\n displayArrow &&\n 'before:absolute before:z-[999] before:content-[\"\"] before:w-0 before:h-0',\n\n /* Horizontal positioning */\n displayArrow && xAlign === 'start' && 'before:left-2',\n displayArrow && xAlign === 'end' && 'before:right-2',\n\n /* Arrow pointing up (when popover is below trigger) */\n displayArrow &&\n yAlign === 'bellow' &&\n 'before:-top-[10px] before:border-l-[10px] before:border-l-transparent before:border-r-[10px] before:border-r-transparent before:border-b-[10px] before:border-b-neutral',\n\n /* Arrow pointing down (when popover is above trigger) */\n displayArrow &&\n yAlign === 'above' &&\n 'before:-bottom-[10px] before:border-l-[10px] before:border-l-transparent before:border-r-[10px] before:border-r-transparent before:border-t-[10px] before:border-t-neutral',\n\n /* Visibility management */\n 'overflow-x-visible transition-all duration-400 ease-in-out opacity-0',\n isHidden !== false ? 'invisible' : 'delay-800 visible opacity-100',\n isOverable &&\n 'group-hover/popover:visible group-hover/popover:opacity-100 group-hover/popover:delay-800',\n isFocusable &&\n 'group-focus-within/popover:visible group-focus-within/popover:opacity-100 group-focus-within/popover:delay-800',\n className\n )}\n {...props}\n >\n {children}\n </Container>\n);\n\nPopover.Detail = Detail;\n"],"names":["PopoverXAlign","PopoverYAlign"],"mappings":";;;AA+BO,MAAM,UAAuB,CAAC;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW,GAAG,8CAA8C,SAAS;AAAA,IACrE,cAAY,WAAW,UAAU;AAAA,IACjC,IAAI,2BAA2B,UAAU;AAAA,IACzC,iBAAa;AAAA,IACZ,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;AAaK,IAAK,kCAAAA,mBAAL;AACLA,iBAAA,OAAA,IAAQ;AACRA,iBAAA,KAAA,IAAM;AAFI,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAKL,IAAK,kCAAAC,mBAAL;AACLA,iBAAA,OAAA,IAAQ;AACRA,iBAAA,OAAA,IAAQ;AAFE,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAeZ,MAAM,SAA0B,CAAC;AAAA,EAC/B;AAAA,EACA,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,SAAS;AAAA,EACT,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,cAAa;AAAA,IACb,eAAa;AAAA,IACb,mBAAiB,2BAA2B,UAAU;AAAA,IACtD,IAAI,oBAAoB,UAAU;AAAA,IAClC,WAAW;AAAA,MACT;AAAA;AAAA,MAGA,WAAW,WAAW;AAAA,MACtB,WAAW,SAAS;AAAA,MACpB,WAAW,YAAY;AAAA,MACvB,WAAW,WAAW;AAAA;AAAA,MAGtB,gBACE;AAAA;AAAA,MAGF,gBAAgB,WAAW,WAAW;AAAA,MACtC,gBAAgB,WAAW,SAAS;AAAA;AAAA,MAGpC,gBACE,WAAW,YACX;AAAA;AAAA,MAGF,gBACE,WAAW,WACX;AAAA;AAAA,MAGF;AAAA,MACA,aAAa,QAAQ,cAAc;AAAA,MACnC,cACE;AAAA,MACF,eACE;AAAA,MACF;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;AAGF,QAAQ,SAAS;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["import type { DetailedHTMLProps, FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Container } from '../Container';\n\n/**\n * Props for the main Popover component\n * Extends HTMLDivElement attributes for full DOM compatibility\n */\nexport type PopoverProps = DetailedHTMLProps<\n HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n> & {\n /** Unique identifier linking the trigger to its popover content for accessibility */\n identifier: string;\n};\n\n/**\n * Composite type for the Popover component with Detail subcomponent\n * Allows for Popover.Detail usage pattern\n */\nexport type PopoverType = FC<PopoverProps> & {\n Detail: FC<DetailProps>;\n};\n\n/**\n * Horizontal alignment options for popover positioning\n */\nexport enum PopoverXAlign {\n /** Align popover to start (left) of trigger */\n START = 'start',\n /** Align popover to end (right) of trigger */\n END = 'end',\n}\n\n/**\n * Vertical alignment options for popover positioning\n */\nexport enum PopoverYAlign {\n /** Position popover below the trigger */\n BELOW = 'bellow',\n /** Position popover above the trigger */\n ABOVE = 'above',\n}\n\n/**\n * Popover Component\n *\n * A versatile popover container that displays contextual content when triggered by hover\n * or focus interactions. Built with accessibility in mind and supports multiple positioning\n * options with smooth animations.\n *\n * Features:\n * - Hover and focus-based triggering\n * - Multiple positioning options (above/below, start/end)\n * - Accessibility compliant with ARIA attributes\n * - Smooth animations with configurable delays\n * - Optional directional arrows\n * - Automatic z-index management\n * - Responsive design support\n *\n * Architecture:\n * - Main Popover acts as trigger container\n * - Popover.Detail renders the actual popover content\n * - Uses CSS groups for coordinated hover/focus states\n * - Unique identifier system prevents conflicts\n *\n * @example\n * Basic hover popover:\n * ```jsx\n * <Popover identifier=\"help-tooltip\">\n * <button>Need Help?</button>\n *\n * <Popover.Detail identifier=\"help-tooltip\">\n * <div>This is helpful information!</div>\n * </Popover.Detail>\n * </Popover>\n * ```\n *\n * @example\n * Focus-triggered popover:\n * ```jsx\n * <Popover identifier=\"focus-menu\">\n * <input placeholder=\"Focus me\" />\n *\n * <Popover.Detail\n * identifier=\"focus-menu\"\n * isFocusable\n * isOverable={false}\n * >\n * <div>Focus-only menu content</div>\n * </Popover.Detail>\n * </Popover>\n * ```\n *\n * @example\n * Positioned popover with custom alignment:\n * ```jsx\n * <Popover identifier=\"positioned\">\n * <span>Hover me</span>\n *\n * <Popover.Detail\n * identifier=\"positioned\"\n * xAlign={PopoverXAlign.END}\n * yAlign={PopoverYAlign.ABOVE}\n * displayArrow={false}\n * >\n * <div>Above and right-aligned</div>\n * </Popover.Detail>\n * </Popover>\n * ```\n *\n * Accessibility Features:\n * - Proper ARIA labeling and relationships\n * - Keyboard navigation support\n * - Screen reader compatibility\n * - Focus management\n *\n * Performance Considerations:\n * - CSS-only animations for smooth transitions\n * - Efficient group-based state management\n * - Minimal DOM updates during interactions\n *\n * @param props - Popover component props\n * @returns Trigger container with popover functionality\n */\nexport const Popover: PopoverType = ({\n children,\n className,\n identifier,\n ...props\n}) => (\n <div\n className={cn('group/popover relative flex cursor-pointer', className)}\n aria-label={`Popover ${identifier}`}\n id={`unrollable-panel-button-${identifier}`}\n aria-haspopup\n {...props}\n >\n {children}\n </div>\n);\n\n/**\n * Props for the Popover.Detail component\n * Extends HTMLDivElement attributes for styling flexibility\n */\nexport type DetailProps = HTMLAttributes<HTMLDivElement> & {\n /** Whether the popover responds to focus events on the trigger */\n isFocusable?: boolean;\n /** Controls visibility state - undefined allows automatic hover/focus control */\n isHidden?: boolean;\n /** Whether the popover responds to hover events on the trigger */\n isOverable?: boolean;\n /** Unique identifier matching the trigger's identifier for accessibility */\n identifier: string;\n /** Horizontal positioning relative to trigger */\n xAlign?: PopoverXAlign | `${PopoverXAlign}`;\n /** Vertical positioning relative to trigger */\n yAlign?: PopoverYAlign | `${PopoverYAlign}`;\n /** Whether to display the directional arrow indicator */\n displayArrow?: boolean;\n};\n\n/**\n * Popover Detail Component\n *\n * The actual popover content container with advanced positioning, animation, and\n * accessibility features. Automatically manages visibility based on trigger interactions.\n *\n * Features:\n * - Precise positioning with alignment options\n * - Smooth fade and slide animations\n * - Configurable directional arrows\n * - Hover and focus interaction support\n * - Accessibility-compliant ARIA attributes\n * - High z-index for overlay behavior\n * - Automatic visibility management\n *\n * Positioning System:\n * - X-axis: START (left-aligned) or END (right-aligned)\n * - Y-axis: BELOW (underneath) or ABOVE (on top)\n * - Automatic spacing with 1rem gap from trigger\n * - Responsive minimum width matching trigger\n *\n * Arrow Indicators:\n * - CSS-generated triangular arrows\n * - Positioned based on alignment settings\n * - Points toward trigger for visual connection\n * - Can be disabled for clean, minimal appearance\n *\n * Animation Behavior:\n * - Starts invisible with opacity: 0\n * - Smooth 400ms transitions with easing\n * - 800ms delay for hover states (prevents flicker)\n * - Immediate hiding when trigger loses focus/hover\n *\n * @example\n * Rich content popover:\n * ```jsx\n * <Popover.Detail identifier=\"rich-content\">\n * <div className=\"p-4\">\n * <h3>Popover Title</h3>\n * <p>Detailed information with multiple paragraphs.</p>\n * <button>Action Button</button>\n * </div>\n * </Popover.Detail>\n * ```\n *\n * @example\n * Menu-style popover:\n * ```jsx\n * <Popover.Detail\n * identifier=\"context-menu\"\n * displayArrow={false}\n * xAlign={PopoverXAlign.END}\n * >\n * <ul className=\"py-2\">\n * <li><button className=\"w-full px-4 py-2\">Edit</button></li>\n * <li><button className=\"w-full px-4 py-2\">Delete</button></li>\n * </ul>\n * </Popover.Detail>\n * ```\n *\n * @param props - Popover Detail component props\n * @returns Positioned popover content with animations and accessibility\n */\nconst Detail: FC<DetailProps> = ({\n children,\n isHidden = undefined,\n isOverable = true,\n isFocusable = false,\n xAlign = PopoverXAlign.START,\n yAlign = PopoverYAlign.BELOW,\n identifier,\n className,\n displayArrow = true,\n ...props\n}) => (\n <Container\n transparency=\"sm\"\n aria-hidden={isHidden}\n aria-labelledby={`unrollable-panel-button-${identifier}`}\n id={`unrollable-panel-${identifier}`}\n className={cn(\n 'absolute z-[1000] min-w-full ring-neutral ring-1 rounded-md',\n\n /* Positioning */\n xAlign === 'start' && 'left-0',\n xAlign === 'end' && 'right-0',\n yAlign === 'bellow' && 'top-[calc(100%+1rem)]',\n yAlign === 'above' && 'bottom-[calc(100%+1rem)]',\n\n /* Arrow indicator */\n displayArrow &&\n 'before:absolute before:z-[999] before:content-[\"\"] before:w-0 before:h-0',\n\n /* Horizontal positioning */\n displayArrow && xAlign === 'start' && 'before:left-2',\n displayArrow && xAlign === 'end' && 'before:right-2',\n\n /* Arrow pointing up (when popover is below trigger) */\n displayArrow &&\n yAlign === 'bellow' &&\n 'before:-top-[10px] before:border-l-[10px] before:border-l-transparent before:border-r-[10px] before:border-r-transparent before:border-b-[10px] before:border-b-neutral',\n\n /* Arrow pointing down (when popover is above trigger) */\n displayArrow &&\n yAlign === 'above' &&\n 'before:-bottom-[10px] before:border-l-[10px] before:border-l-transparent before:border-r-[10px] before:border-r-transparent before:border-t-[10px] before:border-t-neutral',\n\n /* Visibility management */\n 'overflow-x-visible transition-all duration-400 ease-in-out opacity-0',\n isHidden !== false ? 'invisible' : 'delay-800 visible opacity-100',\n isOverable &&\n 'group-hover/popover:visible group-hover/popover:opacity-100 group-hover/popover:delay-800',\n isFocusable &&\n 'group-focus-within/popover:visible group-focus-within/popover:opacity-100 group-focus-within/popover:delay-800',\n className\n )}\n {...props}\n >\n {children}\n </Container>\n);\n\nPopover.Detail = Detail;\n"],"names":["PopoverXAlign","PopoverYAlign"],"mappings":";;;AA2BO,IAAK,kCAAAA,mBAAL;AAELA,iBAAA,OAAA,IAAQ;AAERA,iBAAA,KAAA,IAAM;AAJI,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAUL,IAAK,kCAAAC,mBAAL;AAELA,iBAAA,OAAA,IAAQ;AAERA,iBAAA,OAAA,IAAQ;AAJE,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAwFL,MAAM,UAAuB,CAAC;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW,GAAG,8CAA8C,SAAS;AAAA,IACrE,cAAY,WAAW,UAAU;AAAA,IACjC,IAAI,2BAA2B,UAAU;AAAA,IACzC,iBAAa;AAAA,IACZ,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;AAuFF,MAAM,SAA0B,CAAC;AAAA,EAC/B;AAAA,EACA,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,SAAS;AAAA,EACT,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,cAAa;AAAA,IACb,eAAa;AAAA,IACb,mBAAiB,2BAA2B,UAAU;AAAA,IACtD,IAAI,oBAAoB,UAAU;AAAA,IAClC,WAAW;AAAA,MACT;AAAA;AAAA,MAGA,WAAW,WAAW;AAAA,MACtB,WAAW,SAAS;AAAA,MACpB,WAAW,YAAY;AAAA,MACvB,WAAW,WAAW;AAAA;AAAA,MAGtB,gBACE;AAAA;AAAA,MAGF,gBAAgB,WAAW,WAAW;AAAA,MACtC,gBAAgB,WAAW,SAAS;AAAA;AAAA,MAGpC,gBACE,WAAW,YACX;AAAA;AAAA,MAGF,gBACE,WAAW,WACX;AAAA;AAAA,MAGF;AAAA,MACA,aAAa,QAAQ,cAAc;AAAA,MACnC,cACE;AAAA,MACF,eACE;AAAA,MACF;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;AAGF,QAAQ,SAAS;"}
@@ -13,7 +13,7 @@ const PressableSpan = ({
13
13
  isSelecting: isSelectingProp,
14
14
  ...props
15
15
  }) => {
16
- const divRef = ReactExports.useRef(null);
16
+ const elementRef = ReactExports.useRef(null);
17
17
  const [isSelectingState, setIsSelectingState] = ReactExports.useState(isSelectingProp);
18
18
  const pressTimerRef = ReactExports.useRef(null);
19
19
  const handleOnLongPress = () => {
@@ -40,7 +40,7 @@ const PressableSpan = ({
40
40
  };
41
41
  const handleClickOutside = ReactExports.useCallback(
42
42
  (event) => {
43
- if (divRef.current && !divRef.current.contains(event.target)) {
43
+ if (elementRef.current && !elementRef.current.contains(event.target)) {
44
44
  setIsSelectingState(false);
45
45
  onUnselect?.();
46
46
  }
@@ -62,16 +62,33 @@ const PressableSpan = ({
62
62
  const handleOnBlur = () => {
63
63
  setIsSelectingState(false);
64
64
  };
65
+ const handleKeyDown = (e) => {
66
+ switch (e.key) {
67
+ case "Enter":
68
+ case " ":
69
+ e.preventDefault();
70
+ handleOnLongPress();
71
+ break;
72
+ case "Escape":
73
+ e.preventDefault();
74
+ setIsSelectingState(false);
75
+ onUnselect?.();
76
+ break;
77
+ }
78
+ };
79
+ const isCurrentlySelecting = isSelectingProp ?? isSelectingState;
65
80
  return /* @__PURE__ */ jsxRuntime.jsx(
66
81
  "span",
67
82
  {
68
83
  className: utils_cn.cn(
69
84
  "inline cursor-pointer select-none rounded-md outline outline-2 outline-offset-4 outline-transparent transition-all delay-100 duration-200",
70
- isSelectingProp ?? isSelectingState ? "outline-inherit" : "hover:outline-inherit"
85
+ isCurrentlySelecting ? "outline-inherit" : "hover:outline-inherit"
71
86
  ),
72
87
  role: "button",
73
88
  tabIndex: 0,
74
- onKeyUp: () => null,
89
+ "aria-pressed": isCurrentlySelecting ? "true" : "false",
90
+ "aria-label": `${isCurrentlySelecting ? "Selected" : "Selectable"} content`,
91
+ onKeyDown: handleKeyDown,
75
92
  onClick: handleOnClick,
76
93
  onMouseDown: handleMouseDown,
77
94
  onMouseUp: handleMouseUp,
@@ -80,7 +97,7 @@ const PressableSpan = ({
80
97
  onTouchEnd: handleMouseUp,
81
98
  onTouchCancel: handleMouseUp,
82
99
  onBlur: handleOnBlur,
83
- ref: divRef,
100
+ ref: elementRef,
84
101
  ...props,
85
102
  children
86
103
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PressableSpan.cjs","sources":["../../../src/components/PressableSpan/PressableSpan.tsx"],"sourcesContent":["'use client';\n\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type FC,\n type HTMLAttributes,\n type MouseEventHandler,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nconst DEFAULT_PRESS_DETECT_DURATION = 400;\n\ntype PressableDivProps = {\n onPress: () => void;\n onClickOutside?: () => void;\n pressDuration?: number;\n isSelecting?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const PressableSpan: FC<PressableDivProps> = ({\n children,\n onPress: onSelect,\n onClickOutside: onUnselect,\n pressDuration = DEFAULT_PRESS_DETECT_DURATION,\n isSelecting: isSelectingProp,\n ...props\n}) => {\n const divRef = useRef<HTMLDivElement>(null);\n const [isSelectingState, setIsSelectingState] = useState(isSelectingProp);\n const pressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const handleOnLongPress = () => {\n setIsSelectingState(true);\n onSelect();\n };\n\n const startPressTimer = () => {\n pressTimerRef.current = setTimeout(() => {\n handleOnLongPress();\n }, pressDuration);\n };\n\n const clearPressTimer = () => {\n if (pressTimerRef.current) {\n clearTimeout(pressTimerRef.current);\n pressTimerRef.current = null;\n }\n };\n\n const handleMouseDown = () => {\n clearPressTimer(); // Ensure any previous timer is cleared\n startPressTimer();\n };\n\n const handleMouseUp = () => {\n clearPressTimer();\n };\n\n // Use useCallback to ensure the function identity remains stable\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (divRef.current && !divRef.current.contains(event.target as Node)) {\n setIsSelectingState(false);\n onUnselect?.();\n }\n },\n [onUnselect]\n );\n\n useEffect(() => {\n // Attach click outside listener\n document.addEventListener('mousedown', handleClickOutside);\n\n return () => {\n // Cleanup\n document.removeEventListener('mousedown', handleClickOutside);\n // clearPressTimer(); // Ensure to clear the timer when component unmounts\n };\n }, [handleClickOutside]);\n\n const handleOnClick: MouseEventHandler<HTMLDivElement> = (e) => {\n if (isSelectingState) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const handleOnBlur = () => {\n // Stop editing when the element loses focus\n setIsSelectingState(false);\n };\n\n return (\n <span\n className={cn(\n 'inline cursor-pointer select-none rounded-md outline outline-2 outline-offset-4 outline-transparent transition-all delay-100 duration-200',\n (isSelectingProp ?? isSelectingState)\n ? 'outline-inherit'\n : 'hover:outline-inherit'\n )}\n role=\"button\"\n tabIndex={0}\n onKeyUp={() => null}\n onClick={handleOnClick}\n onMouseDown={handleMouseDown}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n onTouchStart={handleMouseDown}\n onTouchEnd={handleMouseUp}\n onTouchCancel={handleMouseUp}\n onBlur={handleOnBlur}\n ref={divRef}\n {...props}\n >\n {children}\n </span>\n );\n};\n"],"names":["useRef","useState","useCallback","useEffect","jsx","cn"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A,QAAM,eAAe,MAAM;AAEzB,wBAAoB,KAAK;AAAA,EAC3B;AAEA,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAAA;AAAAA,QACT;AAAA,QACC,mBAAmB,mBAChB,oBACA;AAAA,MAAA;AAAA,MAEN,MAAK;AAAA,MACL,UAAU;AAAA,MACV,SAAS,MAAM;AAAA,MACf,SAAS;AAAA,MACT,aAAa;AAAA,MACb,WAAW;AAAA,MACX,cAAc;AAAA,MACd,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,QAAQ;AAAA,MACR,KAAK;AAAA,MACJ,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;;"}
1
+ {"version":3,"file":"PressableSpan.cjs","sources":["../../../src/components/PressableSpan/PressableSpan.tsx"],"sourcesContent":["'use client';\n\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type FC,\n type HTMLAttributes,\n type MouseEventHandler,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nconst DEFAULT_PRESS_DETECT_DURATION = 400;\n\n/**\n * Props for the PressableSpan component\n */\ntype PressableSpanProps = {\n /**\n * Callback function triggered when a long press is detected\n * @example\n * ```tsx\n * <PressableSpan onPress={() => console.log('Long pressed!')}>\n * Press and hold me\n * </PressableSpan>\n * ```\n */\n onPress: () => void;\n\n /**\n * Optional callback function triggered when clicking outside the component while it's in selecting state\n * @example\n * ```tsx\n * <PressableSpan\n * onPress={() => setIsEditing(true)}\n * onClickOutside={() => setIsEditing(false)}\n * >\n * Click outside to deselect\n * </PressableSpan>\n * ```\n */\n onClickOutside?: () => void;\n\n /**\n * Duration in milliseconds for long press detection\n * @default 400\n * @example\n * ```tsx\n * <PressableSpan pressDuration={800} onPress={() => {}}>\n * Longer press required\n * </PressableSpan>\n * ```\n */\n pressDuration?: number;\n\n /**\n * External control for the selecting state\n * @example\n * ```tsx\n * <PressableSpan isSelecting={isEditing} onPress={() => {}}>\n * Externally controlled\n * </PressableSpan>\n * ```\n */\n isSelecting?: boolean;\n} & HTMLAttributes<HTMLSpanElement>;\n\n/**\n * PressableSpan - An interactive span element that responds to long press gestures\n *\n * A versatile component that detects long press interactions and provides visual feedback.\n * Commonly used for text editing interfaces, selection systems, and interactive content\n * that requires differentiation between quick clicks and intentional long presses.\n *\n * ## Key Features\n * - **Long Press Detection**: Configurable press duration for different interaction patterns\n * - **Visual Feedback**: Smooth outline transitions to indicate interactive and selected states\n * - **Click Outside Detection**: Automatically deselects when clicking outside the component\n * - **Touch Support**: Works seamlessly on both desktop and mobile devices\n * - **Accessible**: Keyboard navigation support and proper ARIA attributes\n *\n * ## Use Cases\n * - Text editing interfaces where long press activates edit mode\n * - Content selection systems with visual feedback\n * - Interactive cards or elements that need press-and-hold activation\n * - Mobile-friendly interfaces requiring long press gestures\n *\n * ## Accessibility\n * - Uses semantic `role=\"button\"` for proper screen reader announcement\n * - Keyboard navigable with `tabIndex={0}`\n * - Focus management with proper blur handling\n * - Visual outline indicators for focus and selection states\n *\n * @example\n * Basic usage with long press detection:\n * ```tsx\n * <PressableSpan onPress={() => setIsEditing(true)}>\n * Press and hold to edit this text\n * </PressableSpan>\n * ```\n *\n * @example\n * With custom press duration and click outside handling:\n * ```tsx\n * <PressableSpan\n * pressDuration={600}\n * onPress={() => setIsEditing(true)}\n * onClickOutside={() => setIsEditing(false)}\n * isSelecting={isEditing}\n * >\n * Custom behavior configuration\n * </PressableSpan>\n * ```\n *\n * @example\n * In a content editing context:\n * ```tsx\n * <PressableSpan\n * onPress={() => startEditingContent(contentId)}\n * onClickOutside={() => saveAndExitEditing()}\n * className=\"prose-text\"\n * >\n * {editableContent}\n * </PressableSpan>\n * ```\n */\n\nexport const PressableSpan: FC<PressableSpanProps> = ({\n children,\n onPress: onSelect,\n onClickOutside: onUnselect,\n pressDuration = DEFAULT_PRESS_DETECT_DURATION,\n isSelecting: isSelectingProp,\n ...props\n}) => {\n const elementRef = useRef<HTMLSpanElement>(null);\n const [isSelectingState, setIsSelectingState] = useState(isSelectingProp);\n const pressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const handleOnLongPress = () => {\n setIsSelectingState(true);\n onSelect();\n };\n\n const startPressTimer = () => {\n pressTimerRef.current = setTimeout(() => {\n handleOnLongPress();\n }, pressDuration);\n };\n\n const clearPressTimer = () => {\n if (pressTimerRef.current) {\n clearTimeout(pressTimerRef.current);\n pressTimerRef.current = null;\n }\n };\n\n const handleMouseDown = () => {\n clearPressTimer(); // Ensure any previous timer is cleared\n startPressTimer();\n };\n\n const handleMouseUp = () => {\n clearPressTimer();\n };\n\n // Use useCallback to ensure the function identity remains stable\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (\n elementRef.current &&\n !elementRef.current.contains(event.target as Node)\n ) {\n setIsSelectingState(false);\n onUnselect?.();\n }\n },\n [onUnselect]\n );\n\n useEffect(() => {\n // Attach click outside listener\n document.addEventListener('mousedown', handleClickOutside);\n\n return () => {\n // Cleanup\n document.removeEventListener('mousedown', handleClickOutside);\n // clearPressTimer(); // Ensure to clear the timer when component unmounts\n };\n }, [handleClickOutside]);\n\n const handleOnClick: MouseEventHandler<HTMLDivElement> = (e) => {\n if (isSelectingState) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const handleOnBlur = () => {\n // Stop editing when the element loses focus\n setIsSelectingState(false);\n };\n\n /**\n * Handle keyboard interactions\n * - Enter/Space: Trigger long press action immediately\n * - Escape: Cancel selection/editing state\n */\n const handleKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>) => {\n switch (e.key) {\n case 'Enter':\n case ' ':\n e.preventDefault();\n handleOnLongPress();\n break;\n case 'Escape':\n e.preventDefault();\n setIsSelectingState(false);\n onUnselect?.();\n break;\n default:\n break;\n }\n };\n\n const isCurrentlySelecting = isSelectingProp ?? isSelectingState;\n\n return (\n <span\n className={cn(\n 'inline cursor-pointer select-none rounded-md outline outline-2 outline-offset-4 outline-transparent transition-all delay-100 duration-200',\n isCurrentlySelecting ? 'outline-inherit' : 'hover:outline-inherit'\n )}\n role=\"button\"\n tabIndex={0}\n aria-pressed={isCurrentlySelecting ? 'true' : 'false'}\n aria-label={`${isCurrentlySelecting ? 'Selected' : 'Selectable'} content`}\n onKeyDown={handleKeyDown}\n onClick={handleOnClick}\n onMouseDown={handleMouseDown}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n onTouchStart={handleMouseDown}\n onTouchEnd={handleMouseUp}\n onTouchCancel={handleMouseUp}\n onBlur={handleOnBlur}\n ref={elementRef}\n {...props}\n >\n {children}\n </span>\n );\n};\n"],"names":["useRef","useState","useCallback","useEffect","jsx","cn"],"mappings":";;;;;;AAaA,MAAM,gCAAgC;AAmH/B,MAAM,gBAAwC,CAAC;AAAA,EACpD;AAAA,EACA,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,GAAG;AACL,MAAM;AACJ,QAAM,aAAaA,aAAAA,OAAwB,IAAI;AAC/C,QAAM,CAAC,kBAAkB,mBAAmB,IAAIC,aAAAA,SAAS,eAAe;AACxE,QAAM,gBAAgBD,aAAAA,OAA6C,IAAI;AAEvE,QAAM,oBAAoB,MAAM;AAC9B,wBAAoB,IAAI;AACxB,aAAA;AAAA,EACF;AAEA,QAAM,kBAAkB,MAAM;AAC5B,kBAAc,UAAU,WAAW,MAAM;AACvC,wBAAA;AAAA,IACF,GAAG,aAAa;AAAA,EAClB;AAEA,QAAM,kBAAkB,MAAM;AAC5B,QAAI,cAAc,SAAS;AACzB,mBAAa,cAAc,OAAO;AAClC,oBAAc,UAAU;AAAA,IAC1B;AAAA,EACF;AAEA,QAAM,kBAAkB,MAAM;AAC5B,oBAAA;AACA,oBAAA;AAAA,EACF;AAEA,QAAM,gBAAgB,MAAM;AAC1B,oBAAA;AAAA,EACF;AAGA,QAAM,qBAAqBE,aAAAA;AAAAA,IACzB,CAAC,UAAsB;AACrB,UACE,WAAW,WACX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TMLAttributes } from 'react';
2
- type PressableDivProps = {
2
+ /**
3
+ * Props for the PressableSpan component
4
+ */
5
+ type PressableSpanProps = {
6
+ /**
7
+ * Callback function triggered when a long press is detected
8
+ * @example
9
+ * ```tsx
10
+ * <PressableSpan onPress={() => console.log('Long pressed!')}>
11
+ * Press and hold me
12
+ * </PressableSpan>
13
+ * ```
14
+ */
3
15
  onPress: () => void;
16
+ /**
17
+ * Optional callback function triggered when clicking outside the component while it's in selecting state
18
+ * @example
19
+ * ```tsx
20
+ * <PressableSpan
21
+ * onPress={() => setIsEditing(true)}
22
+ * onClickOutside={() => setIsEditing(false)}
23
+ * >
24
+ * Click outside to deselect
25
+ * </PressableSpan>
26
+ * ```
27
+ */
4
28
  onClickOutside?: () => void;
29
+ /**
30
+ * Duration in milliseconds for long press detection
31
+ * @default 400
32
+ * @example
33
+ * ```tsx
34
+ * <PressableSpan pressDuration={800} onPress={() => {}}>
35
+ * Longer press required
36
+ * </PressableSpan>
37
+ * ```
38
+ */
5
39
  pressDuration?: number;
40
+ /**
41
+ * External control for the selecting state
42
+ * @example
43
+ * ```tsx
44
+ * <PressableSpan isSelecting={isEditing} onPress={() => {}}>
45
+ * Externally controlled
46
+ * </PressableSpan>
47
+ * ```
48
+ */
6
49
  isSelecting?: boolean;
7
- } & HTMLAttributes<HTMLDivElement>;
8
- export declare const PressableSpan: FC<PressableDivProps>;
50
+ } & HTMLAttributes<HTMLSpanElement>;
51
+ /**
52
+ * PressableSpan - An interactive span element that responds to long press gestures
53
+ *
54
+ * A versatile component that detects long press interactions and provides visual feedback.
55
+ * Commonly used for text editing interfaces, selection systems, and interactive content
56
+ * that requires differentiation between quick clicks and intentional long presses.
57
+ *
58
+ * ## Key Features
59
+ * - **Long Press Detection**: Configurable press duration for different interaction patterns
60
+ * - **Visual Feedback**: Smooth outline transitions to indicate interactive and selected states
61
+ * - **Click Outside Detection**: Automatically deselects when clicking outside the component
62
+ * - **Touch Support**: Works seamlessly on both desktop and mobile devices
63
+ * - **Accessible**: Keyboard navigation support and proper ARIA attributes
64
+ *
65
+ * ## Use Cases
66
+ * - Text editing interfaces where long press activates edit mode
67
+ * - Content selection systems with visual feedback
68
+ * - Interactive cards or elements that need press-and-hold activation
69
+ * - Mobile-friendly interfaces requiring long press gestures
70
+ *
71
+ * ## Accessibility
72
+ * - Uses semantic `role="button"` for proper screen reader announcement
73
+ * - Keyboard navigable with `tabIndex={0}`
74
+ * - Focus management with proper blur handling
75
+ * - Visual outline indicators for focus and selection states
76
+ *
77
+ * @example
78
+ * Basic usage with long press detection:
79
+ * ```tsx
80
+ * <PressableSpan onPress={() => setIsEditing(true)}>
81
+ * Press and hold to edit this text
82
+ * </PressableSpan>
83
+ * ```
84
+ *
85
+ * @example
86
+ * With custom press duration and click outside handling:
87
+ * ```tsx
88
+ * <PressableSpan
89
+ * pressDuration={600}
90
+ * onPress={() => setIsEditing(true)}
91
+ * onClickOutside={() => setIsEditing(false)}
92
+ * isSelecting={isEditing}
93
+ * >
94
+ * Custom behavior configuration
95
+ * </PressableSpan>
96
+ * ```
97
+ *
98
+ * @example
99
+ * In a content editing context:
100
+ * ```tsx
101
+ * <PressableSpan
102
+ * onPress={() => startEditingContent(contentId)}
103
+ * onClickOutside={() => saveAndExitEditing()}
104
+ * className="prose-text"
105
+ * >
106
+ * {editableContent}
107
+ * </PressableSpan>
108
+ * ```
109
+ */
110
+ export declare const PressableSpan: FC<PressableSpanProps>;
9
111
  export {};
10
112
  //# sourceMappingURL=PressableSpan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PressableSpan.d.ts","sourceRoot":"","sources":["../../../src/components/PressableSpan/PressableSpan.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,EAAE,EACP,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAC;AAKf,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnC,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,iBAAiB,CAkG/C,CAAC"}
1
+ {"version":3,"file":"PressableSpan.d.ts","sourceRoot":"","sources":["../../../src/components/PressableSpan/PressableSpan.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,EAAE,EACP,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAC;AAKf;;GAEG;AACH,KAAK,kBAAkB,GAAG;IACxB;;;;;;;;OAQG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA6HhD,CAAC"}
@@ -11,7 +11,7 @@ const PressableSpan = ({
11
11
  isSelecting: isSelectingProp,
12
12
  ...props
13
13
  }) => {
14
- const divRef = useRef(null);
14
+ const elementRef = useRef(null);
15
15
  const [isSelectingState, setIsSelectingState] = useState(isSelectingProp);
16
16
  const pressTimerRef = useRef(null);
17
17
  const handleOnLongPress = () => {
@@ -38,7 +38,7 @@ const PressableSpan = ({
38
38
  };
39
39
  const handleClickOutside = useCallback(
40
40
  (event) => {
41
- if (divRef.current && !divRef.current.contains(event.target)) {
41
+ if (elementRef.current && !elementRef.current.contains(event.target)) {
42
42
  setIsSelectingState(false);
43
43
  onUnselect?.();
44
44
  }
@@ -60,16 +60,33 @@ const PressableSpan = ({
60
60
  const handleOnBlur = () => {
61
61
  setIsSelectingState(false);
62
62
  };
63
+ const handleKeyDown = (e) => {
64
+ switch (e.key) {
65
+ case "Enter":
66
+ case " ":
67
+ e.preventDefault();
68
+ handleOnLongPress();
69
+ break;
70
+ case "Escape":
71
+ e.preventDefault();
72
+ setIsSelectingState(false);
73
+ onUnselect?.();
74
+ break;
75
+ }
76
+ };
77
+ const isCurrentlySelecting = isSelectingProp ?? isSelectingState;
63
78
  return /* @__PURE__ */ jsx(
64
79
  "span",
65
80
  {
66
81
  className: cn(
67
82
  "inline cursor-pointer select-none rounded-md outline outline-2 outline-offset-4 outline-transparent transition-all delay-100 duration-200",
68
- isSelectingProp ?? isSelectingState ? "outline-inherit" : "hover:outline-inherit"
83
+ isCurrentlySelecting ? "outline-inherit" : "hover:outline-inherit"
69
84
  ),
70
85
  role: "button",
71
86
  tabIndex: 0,
72
- onKeyUp: () => null,
87
+ "aria-pressed": isCurrentlySelecting ? "true" : "false",
88
+ "aria-label": `${isCurrentlySelecting ? "Selected" : "Selectable"} content`,
89
+ onKeyDown: handleKeyDown,
73
90
  onClick: handleOnClick,
74
91
  onMouseDown: handleMouseDown,
75
92
  onMouseUp: handleMouseUp,
@@ -78,7 +95,7 @@ const PressableSpan = ({
78
95
  onTouchEnd: handleMouseUp,
79
96
  onTouchCancel: handleMouseUp,
80
97
  onBlur: handleOnBlur,
81
- ref: divRef,
98
+ ref: elementRef,
82
99
  ...props,
83
100
  children
84
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PressableSpan.mjs","sources":["../../../src/components/PressableSpan/PressableSpan.tsx"],"sourcesContent":["'use client';\n\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type FC,\n type HTMLAttributes,\n type MouseEventHandler,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nconst DEFAULT_PRESS_DETECT_DURATION = 400;\n\ntype PressableDivProps = {\n onPress: () => void;\n onClickOutside?: () => void;\n pressDuration?: number;\n isSelecting?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const PressableSpan: FC<PressableDivProps> = ({\n children,\n onPress: onSelect,\n onClickOutside: onUnselect,\n pressDuration = DEFAULT_PRESS_DETECT_DURATION,\n isSelecting: isSelectingProp,\n ...props\n}) => {\n const divRef = useRef<HTMLDivElement>(null);\n const [isSelectingState, setIsSelectingState] = useState(isSelectingProp);\n const pressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const handleOnLongPress = () => {\n setIsSelectingState(true);\n onSelect();\n };\n\n const startPressTimer = () => {\n pressTimerRef.current = setTimeout(() => {\n handleOnLongPress();\n }, pressDuration);\n };\n\n const clearPressTimer = () => {\n if (pressTimerRef.current) {\n clearTimeout(pressTimerRef.current);\n pressTimerRef.current = null;\n }\n };\n\n const handleMouseDown = () => {\n clearPressTimer(); // Ensure any previous timer is cleared\n startPressTimer();\n };\n\n const handleMouseUp = () => {\n clearPressTimer();\n };\n\n // Use useCallback to ensure the function identity remains stable\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (divRef.current && !divRef.current.contains(event.target as Node)) {\n setIsSelectingState(false);\n onUnselect?.();\n }\n },\n [onUnselect]\n );\n\n useEffect(() => {\n // Attach click outside listener\n document.addEventListener('mousedown', handleClickOutside);\n\n return () => {\n // Cleanup\n document.removeEventListener('mousedown', handleClickOutside);\n // clearPressTimer(); // Ensure to clear the timer when component unmounts\n };\n }, [handleClickOutside]);\n\n const handleOnClick: MouseEventHandler<HTMLDivElement> = (e) => {\n if (isSelectingState) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const handleOnBlur = () => {\n // Stop editing when the element loses focus\n setIsSelectingState(false);\n };\n\n return (\n <span\n className={cn(\n 'inline cursor-pointer select-none rounded-md outline outline-2 outline-offset-4 outline-transparent transition-all delay-100 duration-200',\n (isSelectingProp ?? isSelectingState)\n ? 'outline-inherit'\n : 'hover:outline-inherit'\n )}\n role=\"button\"\n tabIndex={0}\n onKeyUp={() => null}\n onClick={handleOnClick}\n onMouseDown={handleMouseDown}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n onTouchStart={handleMouseDown}\n onTouchEnd={handleMouseUp}\n onTouchCancel={handleMouseUp}\n onBlur={handleOnBlur}\n ref={divRef}\n {...props}\n >\n {children}\n </span>\n );\n};\n"],"names":[],"mappings":";;;;AAaA,MAAM,gCAAgC;AAS/B,MAAM,gBAAuC,CAAC;AAAA,EACnD;AAAA,EACA,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,GAAG;AACL,MAAM;AACJ,QAAM,SAAS,OAAuB,IAAI;AAC1C,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,eAAe;AACxE,QAAM,gBAAgB,OAA6C,IAAI;AAEvE,QAAM,oBAAoB,MAAM;AAC9B,wBAAoB,IAAI;AACxB,aAAA;AAAA,EACF;AAEA,QAAM,kBAAkB,MAAM;AAC5B,kBAAc,UAAU,WAAW,MAAM;AACvC,wBAAA;AAAA,IACF,GAAG,aAAa;AAAA,EAClB;AAEA,QAAM,kBAAkB,MAAM;AAC5B,QAAI,cAAc,SAAS;AACzB,mBAAa,cAAc,OAAO;AAClC,oBAAc,UAAU;AAAA,IAC1B;AAAA,EACF;AAEA,QAAM,kBAAkB,MAAM;AAC5B,oBAAA;AACA,oBAAA;AAAA,EACF;AAEA,QAAM,gBAAgB,MAAM;AAC1B,oBAAA;AAAA,EACF;AAGA,QAAM,qBAAqB;AAAA,IACzB,CAAC,UAAsB;AACrB,UAAI,OAAO,WAAW,CAAC,OAAO,QAAQ,SAAS,MAAM,MAAc,GAAG;AACpE,4BAAoB,KAAK;AACzB,qBAAA;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,UAAU;AAAA,EAAA;AAGb,YAAU,MAAM;AAEd,aAAS,iBAAiB,aAAa,kBAAkB;AAEzD,WAAO,MAAM;AAEX,eAAS,oBAAoB,aAAa,kBAAkB;AAAA,IAE9D;AAAA,EACF,GAAG,CAAC,kBAAkB,CAAC;AAEvB,QAAM,gBAAmD,CAAC,MAAM;AAC9D,QAAI,kBAAkB;AACpB,QAAE,eAAA;AACF,QAAE,gBAAA;AAAA,IACJ;AAAA,EACF;AAEA,QAAM,eAAe,MAAM;AAEzB,wBAAoB,KAAK;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACC,mBAAmB,mBAChB,oBACA;AAAA,MAAA;AAAA,MAEN,MAAK;AAAA,MACL,UAAU;AAAA,MACV,SAAS,MAAM;AAAA,MACf,SAAS;AAAA,MACT,aAAa;AAAA,MACb,WAAW;AAAA,MACX,cAAc;AAAA,MACd,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,QAAQ;AAAA,MACR,KAAK;AAAA,MACJ,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"PressableSpan.mjs","sources":["../../../src/components/PressableSpan/PressableSpan.tsx"],"sourcesContent":["'use client';\n\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type FC,\n type HTMLAttributes,\n type MouseEventHandler,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nconst DEFAULT_PRESS_DETECT_DURATION = 400;\n\n/**\n * Props for the PressableSpan component\n */\ntype PressableSpanProps = {\n /**\n * Callback function triggered when a long press is detected\n * @example\n * ```tsx\n * <PressableSpan onPress={() => console.log('Long pressed!')}>\n * Press and hold me\n * </PressableSpan>\n * ```\n */\n onPress: () => void;\n\n /**\n * Optional callback function triggered when clicking outside the component while it's in selecting state\n * @example\n * ```tsx\n * <PressableSpan\n * onPress={() => setIsEditing(true)}\n * onClickOutside={() => setIsEditing(false)}\n * >\n * Click outside to deselect\n * </PressableSpan>\n * ```\n */\n onClickOutside?: () => void;\n\n /**\n * Duration in milliseconds for long press detection\n * @default 400\n * @example\n * ```tsx\n * <PressableSpan pressDuration={800} onPress={() => {}}>\n * Longer press required\n * </PressableSpan>\n * ```\n */\n pressDuration?: number;\n\n /**\n * External control for the selecting state\n * @example\n * ```tsx\n * <PressableSpan isSelecting={isEditing} onPress={() => {}}>\n * Externally controlled\n * </PressableSpan>\n * ```\n */\n isSelecting?: boolean;\n} & HTMLAttributes<HTMLSpanElement>;\n\n/**\n * PressableSpan - An interactive span element that responds to long press gestures\n *\n * A versatile component that detects long press interactions and provides visual feedback.\n * Commonly used for text editing interfaces, selection systems, and interactive content\n * that requires differentiation between quick clicks and intentional long presses.\n *\n * ## Key Features\n * - **Long Press Detection**: Configurable press duration for different interaction patterns\n * - **Visual Feedback**: Smooth outline transitions to indicate interactive and selected states\n * - **Click Outside Detection**: Automatically deselects when clicking outside the component\n * - **Touch Support**: Works seamlessly on both desktop and mobile devices\n * - **Accessible**: Keyboard navigation support and proper ARIA attributes\n *\n * ## Use Cases\n * - Text editing interfaces where long press activates edit mode\n * - Content selection systems with visual feedback\n * - Interactive cards or elements that need press-and-hold activation\n * - Mobile-friendly interfaces requiring long press gestures\n *\n * ## Accessibility\n * - Uses semantic `role=\"button\"` for proper screen reader announcement\n * - Keyboard navigable with `tabIndex={0}`\n * - Focus management with proper blur handling\n * - Visual outline indicators for focus and selection states\n *\n * @example\n * Basic usage with long press detection:\n * ```tsx\n * <PressableSpan onPress={() => setIsEditing(true)}>\n * Press and hold to edit this text\n * </PressableSpan>\n * ```\n *\n * @example\n * With custom press duration and click outside handling:\n * ```tsx\n * <PressableSpan\n * pressDuration={600}\n * onPress={() => setIsEditing(true)}\n * onClickOutside={() => setIsEditing(false)}\n * isSelecting={isEditing}\n * >\n * Custom behavior configuration\n * </PressableSpan>\n * ```\n *\n * @example\n * In a content editing context:\n * ```tsx\n * <PressableSpan\n * onPress={() => startEditingContent(contentId)}\n * onClickOutside={() => saveAndExitEditing()}\n * className=\"prose-text\"\n * >\n * {editableContent}\n * </PressableSpan>\n * ```\n */\n\nexport const PressableSpan: FC<PressableSpanProps> = ({\n children,\n onPress: onSelect,\n onClickOutside: onUnselect,\n pressDuration = DEFAULT_PRESS_DETECT_DURATION,\n isSelecting: isSelectingProp,\n ...props\n}) => {\n const elementRef = useRef<HTMLSpanElement>(null);\n const [isSelectingState, setIsSelectingState] = useState(isSelectingProp);\n const pressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const handleOnLongPress = () => {\n setIsSelectingState(true);\n onSelect();\n };\n\n const startPressTimer = () => {\n pressTimerRef.current = setTimeout(() => {\n handleOnLongPress();\n }, pressDuration);\n };\n\n const clearPressTimer = () => {\n if (pressTimerRef.current) {\n clearTimeout(pressTimerRef.current);\n pressTimerRef.current = null;\n }\n };\n\n const handleMouseDown = () => {\n clearPressTimer(); // Ensure any previous timer is cleared\n startPressTimer();\n };\n\n const handleMouseUp = () => {\n clearPressTimer();\n };\n\n // Use useCallback to ensure the function identity remains stable\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (\n elementRef.current &&\n !elementRef.current.contains(event.target as Node)\n ) {\n setIsSelectingState(false);\n onUnselect?.();\n }\n },\n [onUnselect]\n );\n\n useEffect(() => {\n // Attach click outside listener\n document.addEventListener('mousedown', handleClickOutside);\n\n return () => {\n // Cleanup\n document.removeEventListener('mousedown', handleClickOutside);\n // clearPressTimer(); // Ensure to clear the timer when component unmounts\n };\n }, [handleClickOutside]);\n\n const handleOnClick: MouseEventHandler<HTMLDivElement> = (e) => {\n if (isSelectingState) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const handleOnBlur = () => {\n // Stop editing when the element loses focus\n setIsSelectingState(false);\n };\n\n /**\n * Handle keyboard interactions\n * - Enter/Space: Trigger long press action immediately\n * - Escape: Cancel selection/editing state\n */\n const handleKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>) => {\n switch (e.key) {\n case 'Enter':\n case ' ':\n e.preventDefault();\n handleOnLongPress();\n break;\n case 'Escape':\n e.preventDefault();\n setIsSelectingState(false);\n onUnselect?.();\n break;\n default:\n break;\n }\n };\n\n const isCurrentlySelecting = isSelectingProp ?? isSelectingState;\n\n return (\n <span\n className={cn(\n 'inline cursor-pointer select-none rounded-md outline outline-2 outline-offset-4 outline-transparent transition-all delay-100 duration-200',\n isCurrentlySelecting ? 'outline-inherit' : 'hover:outline-inherit'\n )}\n role=\"button\"\n tabIndex={0}\n aria-pressed={isCurrentlySelecting ? 'true' : 'false'}\n aria-label={`${isCurrentlySelecting ? 'Selected' : 'Selectable'} content`}\n onKeyDown={handleKeyDown}\n onClick={handleOnClick}\n onMouseDown={handleMouseDown}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n onTouchStart={handleMouseDown}\n onTouchEnd={handleMouseUp}\n onTouchCancel={handleMouseUp}\n onBlur={handleOnBlur}\n ref={elementRef}\n {...props}\n >\n {children}\n </span>\n );\n};\n"],"names":[],"mappings":";;;;AAaA,MAAM,gCAAgC;AAmH/B,MAAM,gBAAwC,CAAC;AAAA,EACpD;AAAA,EACA,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,GAAG;AACL,MAAM;AACJ,QAAM,aAAa,OAAwB,IAAI;AAC/C,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,eAAe;AACxE,QAAM,gBAAgB,OAA6C,IAAI;AAEvE,QAAM,oBAAoB,MAAM;AAC9B,wBAAoB,IAAI;AACxB,aAAA;AAAA,EACF;AAEA,QAAM,kBAAkB,MAAM;AAC5B,kBAAc,UAAU,WAAW,MAAM;AACvC,wBAAA;AAAA,IACF,GAAG,aAAa;AAAA,EAClB;AAEA,QAAM,kBAAkB,MAAM;AAC5B,QAAI,cAAc,SAAS;AACzB,mBAAa,cAAc,OAAO;AAClC,oBAAc,UAAU;AAAA,IAC1B;AAAA,EACF;AAEA,QAAM,kBAAkB,MAAM;AAC5B,oBAAA;AACA,oBAAA;AAAA,EACF;AAEA,QAAM,gBAAgB,MAAM;AAC1B,oBAAA;AAAA,EACF;A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}
@@ -1 +1 @@
1
- {"version":3,"file":"RightDrawer.cjs","sources":["../../../src/components/RightDrawer/RightDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronLeft, X } from 'lucide-react';\nimport {\n type FC,\n type MouseEventHandler,\n type ReactNode,\n useEffect,\n useRef,\n} from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useDevice } from '../../hooks/useDevice';\nimport { useScrollBlockage } from '../../hooks/useScrollBlockage';\nimport { Button, ButtonColor, ButtonSize, ButtonVariant } from '../Button';\nimport { Container } from '../Container';\nimport { MaxWidthSmoother } from '../MaxWidthSmoother/index';\nimport { isElementAtTopAndNotCovered } from './isElementAtTopAndNotCovered';\nimport { useRightDrawerStore } from './useRightDrawerStore';\n\ntype BackButtonProps = {\n onBack: () => void;\n text?: string;\n};\n\ntype RightDrawerProps = {\n title?: ReactNode;\n identifier: string;\n children?: ReactNode;\n header?: ReactNode;\n closeOnOutsideClick?: boolean;\n backButton?: BackButtonProps;\n isOpen?: boolean;\n onClose?: () => void;\n};\n\nexport const RightDrawer: FC<RightDrawerProps> = ({\n title,\n identifier,\n children,\n header,\n closeOnOutsideClick = true,\n backButton,\n isOpen: isOpenProp,\n onClose,\n}) => {\n const { isMobile } = useDevice('md');\n const panelRef = useRef<HTMLDivElement>(null);\n const childrenContainerRef = useRef<HTMLDivElement>(null);\n const { close, open, isOpen } = useRightDrawerStore(\n useShallow((s) => ({\n close: () => s.close(identifier),\n open: () => s.open(identifier),\n isOpen: s.isOpen(identifier),\n }))\n );\n\n useScrollBlockage({\n disableScroll: isOpen,\n key: identifier ? `right_drawer_${identifier}` : 'right_drawer',\n });\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n try {\n if (!panelRef.current) return;\n\n // Check if drawer is open and click outside is enabled\n const isClickAble = isOpen && closeOnOutsideClick;\n\n // Check if click is outside the drawer panel\n const isClickOutside =\n event.target && !panelRef.current.contains(event.target as Node);\n\n // Check if event propagation has been stopped\n const isAtTopAndVisible = isElementAtTopAndNotCovered(panelRef.current);\n\n if (\n (isClickAble && isClickOutside && isAtTopAndVisible) ||\n !event.target\n ) {\n close();\n onClose?.();\n }\n } catch (_e) {\n close();\n onClose?.();\n }\n };\n\n window.addEventListener('mousedown', handleClickOutside);\n return () => window.removeEventListener('mousedown', handleClickOutside);\n }, [isOpen, close, onClose, closeOnOutsideClick, identifier]); // Make sure the effect runs only if isOpen or close changes\n\n useEffect(() => {\n if (isOpenProp !== undefined) {\n if (isOpenProp) {\n open();\n } else {\n close();\n onClose?.();\n }\n }\n }, [close, open, onClose, isOpenProp, identifier]);\n\n const handleSpareSpaceClick: MouseEventHandler<HTMLDivElement> = (e) => {\n // Check if the click trigger the background\n if (e.target !== e.currentTarget) {\n return;\n }\n\n if (isMobile) {\n close();\n onClose?.();\n }\n };\n\n return (\n <div className=\"fixed right-0 top-0 z-50 flex h-full justify-end\">\n <MaxWidthSmoother isHidden={!isOpen} align=\"right\">\n <Container\n className=\"text-text relative flex h-screen w-screen flex-col md:w-[400px]\"\n ref={panelRef}\n roundedSize=\"none\"\n >\n <div className=\"flex flex-col gap-3 p-6\">\n <div className=\"flex justify-between gap-3\">\n <div>\n {backButton && (\n <Button\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n label={backButton.text ?? 'Go back'}\n onClick={backButton.onBack}\n Icon={ChevronLeft}\n >\n {backButton?.text}\n </Button>\n )}\n </div>\n <div>\n <Button\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n label=\"Close\"\n className=\"ml-auto\"\n onClick={close}\n Icon={X}\n size={ButtonSize.ICON_MD}\n />\n </div>\n </div>\n {title && (\n <h2 className=\"flex items-center justify-center text-lg font-bold\">\n {title}\n </h2>\n )}\n {header}\n </div>\n\n <div className=\"flex h-full flex-col overflow-y-auto p-2\">\n <div\n className=\"flex flex-1 flex-col\"\n onClick={handleSpareSpaceClick}\n ref={childrenContainerRef}\n >\n {children}\n </div>\n </div>\n </Container>\n </MaxWidthSmoother>\n </div>\n );\n};\n"],"names":["useDevice","useRef","useRightDrawerStore","useShallow","useScrollBlockage","useEffect","isElementAtTopAndNotCovered","jsx","MaxWidthSmoother","jsxs","Container","Button","ButtonVariant","ButtonColor","ChevronLeft","X","ButtonSize"],"mappings":";;;;;;;;;;;;;AAmCO,MAAM,cAAoC,CAAC;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB;AAAA,EACA,QAAQ;AAAA,EACR;AACF,MAAM;AACJ,QAAM,EAAE,SAAA,IAAaA,gBAAAA,UAAU,IAAI;AACnC,QAAM,WAAWC,aAAAA,OAAuB,IAAI;AAC5C,QAAM,uBAAuBA,aAAAA,OAAuB,IAAI;AACxD,QAAM,EAAE,OAAO,MAAM,OAAA,IAAWC,2CAAAA;AAAAA,IAC9BC,8BAAAA,WAAW,CAAC,OAAO;AAAA,MACjB,OAAO,MAAM,EAAE,MAAM,UAAU;AAAA,MAC/B,MAAM,MAAM,EAAE,KAAK,UAAU;AAAA,MAC7B,QAAQ,EAAE,OAAO,UAAU;AAAA,IAAA,EAC3B;AAAA,EAAA;AAGJC,kDAAkB;AAAA,IAChB,eAAe;AAAA,IACf,KAAK,aAAa,gBAAgB,UAAU,KAAK;AAAA,EAAA,CAClD;AAEDC,eAAAA,UAAU,MAAM;AACd,UAAM,qBAAqB,CAAC,UAAsB;AAChD,UAAI;AACF,YAAI,CAAC,SAAS,QAAS;AAGvB,cAAM,cAAc,UAAU;AAG9B,cAAM,iBACJ,MAAM,UAAU,CAAC,SAAS,QAAQ,SAAS,MAAM,MAAc;AAGjE,cAAM,oBAAoBC,mDAAAA,4BAA4B,SAAS,OAAO;AAEtE,YACG,eAAe,kBAAkB,qBAClC,CAAC,MAAM,QACP;AACA,gBAAA;AACA,oBAAA;AAAA,QACF;AAAA,MACF,SAAS,IAAI;AACX,cAAA;AACA,kBAAA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,iBAAiB,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,cAAc;AAAA,gBACvB,OAAOC,yBAAAA,YAAY;AAAA,gBACnB,OAAM;AAAA,gBACN,WAAU;AAAA,gBACV,SAAS;AAAA,gBACT,MAAME,YAAAA;AAAAA,gBACN,MAAMC,yBAAAA,WAAW;AAAA,cAAA;AAAA,YAAA,EACnB,CACF;AAAA,UAAA,GACF;AAAA,UACC,SACCT,2BAAAA,IAAC,MAAA,EAAG,WAAU,sDACX,UAAA,OACH;AAAA,UAED;AAAA,QAAA,GACH;AAAA,QAEAA,2BAAAA,IAAC,OAAA,EAAI,WAAU,4CACb,UAAAA,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,SAAS;AAAA,YACT,KAAK;AAAA,YAEJ;AAAA,UAAA;AAAA,QAAA,EACH,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEJ,EAAA,CACF;AAEJ;;"}
1
+ {"version":3,"file":"RightDrawer.cjs","sources":["../../../src/components/RightDrawer/RightDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronLeft, X } from 'lucide-react';\nimport {\n type FC,\n type MouseEventHandler,\n type ReactNode,\n useEffect,\n useRef,\n} from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useDevice } from '../../hooks/useDevice';\nimport { useScrollBlockage } from '../../hooks/useScrollBlockage';\nimport { Button, ButtonColor, ButtonSize, ButtonVariant } from '../Button';\nimport { Container } from '../Container';\nimport { MaxWidthSmoother } from '../MaxWidthSmoother/index';\nimport { isElementAtTopAndNotCovered } from './isElementAtTopAndNotCovered';\nimport { useRightDrawerStore } from './useRightDrawerStore';\n\n/**\n * Configuration for the back button functionality in the RightDrawer\n *\n * @interface BackButtonProps\n */\ntype BackButtonProps = {\n /** Callback function triggered when the back button is clicked */\n onBack: () => void;\n /** Optional custom text for the back button. Defaults to \"Go back\" if not provided */\n text?: string;\n};\n\n/**\n * Props configuration for the RightDrawer component\n *\n * @interface RightDrawerProps\n */\ntype RightDrawerProps = {\n /**\n * Title displayed in the drawer header\n * @example\n * ```tsx\n * <RightDrawer title=\"User Settings\" identifier=\"settings\">\n * Content here\n * </RightDrawer>\n * ```\n */\n title?: ReactNode;\n\n /**\n * Unique identifier for the drawer instance. Required for store management\n * @example\n * ```tsx\n * <RightDrawer identifier=\"user-profile\" title=\"Profile\">\n * Profile content\n * </RightDrawer>\n * ```\n */\n identifier: string;\n\n /** The content to be displayed inside the drawer */\n children?: ReactNode;\n\n /**\n * Optional header content displayed below the title\n * @example\n * ```tsx\n * <RightDrawer\n * title=\"Settings\"\n * header={<div className=\"text-sm opacity-80\">Configure your preferences</div>}\n * identifier=\"settings\"\n * >\n * Settings content\n * </RightDrawer>\n * ```\n */\n header?: ReactNode;\n\n /**\n * Whether the drawer should close when clicking outside of it\n * @default true\n * @example\n * ```tsx\n * <RightDrawer closeOnOutsideClick={false} identifier=\"persistent\">\n * This drawer requires explicit close action\n * </RightDrawer>\n * ```\n */\n closeOnOutsideClick?: boolean;\n\n /**\n * Configuration for an optional back button in the drawer header\n * @example\n * ```tsx\n * <RightDrawer\n * backButton={{\n * text: \"Back to List\",\n * onBack: () => navigate('/list')\n * }}\n * identifier=\"detail-view\"\n * >\n * Detail content\n * </RightDrawer>\n * ```\n */\n backButton?: BackButtonProps;\n\n /**\n * External control for the open state. When provided, overrides internal store state\n * @example\n * ```tsx\n * const [isOpen, setIsOpen] = useState(false);\n *\n * <RightDrawer\n * isOpen={isOpen}\n * onClose={() => setIsOpen(false)}\n * identifier=\"controlled\"\n * >\n * Controlled drawer content\n * </RightDrawer>\n * ```\n */\n isOpen?: boolean;\n\n /**\n * Callback function triggered when the drawer is closed\n * @example\n * ```tsx\n * <RightDrawer\n * onClose={() => console.log('Drawer closed')}\n * identifier=\"tracked\"\n * >\n * Content with close tracking\n * </RightDrawer>\n * ```\n */\n onClose?: () => void;\n};\n\n/**\n * RightDrawer - A slide-out drawer panel that appears from the right side of the screen\n *\n * A versatile drawer component that provides an overlay panel for displaying secondary content,\n * forms, details, or navigation. Features responsive design that adapts to mobile devices,\n * configurable close behavior, and integrated state management through Zustand store.\n *\n * ## Key Features\n * - **Responsive Design**: Full-width on mobile, fixed 400px width on desktop\n * - **State Management**: Built-in Zustand store for managing multiple drawer instances\n * - **Accessibility**: Proper ARIA attributes, keyboard navigation, and focus management\n * - **Flexible Layout**: Customizable header, title, and content areas\n * - **Click Outside**: Configurable outside click detection for auto-closing\n * - **Scroll Management**: Automatic body scroll blocking when open\n *\n * ## Use Cases\n * - Navigation menus and sidebars\n * - Detail panels and forms\n * - Settings and configuration interfaces\n * - Shopping carts and checkout processes\n * - User profiles and account management\n * - Multi-step workflows and wizards\n *\n * ## Accessibility\n * - **Focus Management**: Traps focus within the drawer when open\n * - **Keyboard Navigation**: Escape key closes the drawer\n * - **Screen Reader Support**: Proper ARIA labels and announcements\n * - **Touch Support**: Mobile-optimized touch interactions\n *\n * ## State Management\n * The component uses a Zustand store (`useRightDrawerStore`) to manage drawer state:\n * - Multiple drawers can be managed simultaneously using unique identifiers\n * - External components can open/close drawers using the store\n * - Supports both controlled (via props) and uncontrolled (via store) patterns\n *\n * @example\n * Basic usage with store management:\n * ```tsx\n * // Opening the drawer from another component\n * const { open } = useRightDrawerStore();\n *\n * <button onClick={() => open('user-menu')}>\n * Open Menu\n * </button>\n *\n * <RightDrawer identifier=\"user-menu\" title=\"User Menu\">\n * <nav>Navigation items here</nav>\n * </RightDrawer>\n * ```\n *\n * @example\n * Controlled drawer with external state:\n * ```tsx\n * const [showDrawer, setShowDrawer] = useState(false);\n *\n * <RightDrawer\n * identifier=\"controlled-drawer\"\n * title=\"Settings\"\n * isOpen={showDrawer}\n * onClose={() => setShowDrawer(false)}\n * closeOnOutsideClick={false}\n * >\n * <SettingsForm onSave={() => setShowDrawer(false)} />\n * </RightDrawer>\n * ```\n *\n * @example\n * Complex drawer with back button and header:\n * ```tsx\n * <RightDrawer\n * identifier=\"product-detail\"\n * title=\"Product Details\"\n * header={\n * <div className=\"text-sm text-gray-600\">\n * SKU: {product.sku} | Stock: {product.stock}\n * </div>\n * }\n * backButton={{\n * text: \"Back to Catalog\",\n * onBack: () => navigate('/catalog')\n * }}\n * >\n * <ProductDetailView product={product} />\n * </RightDrawer>\n * ```\n */\nexport const RightDrawer: FC<RightDrawerProps> = ({\n title,\n identifier,\n children,\n header,\n closeOnOutsideClick = true,\n backButton,\n isOpen: isOpenProp,\n onClose,\n}) => {\n const { isMobile } = useDevice('md');\n const panelRef = useRef<HTMLDivElement>(null);\n const childrenContainerRef = useRef<HTMLDivElement>(null);\n const { close, open, isOpen } = useRightDrawerStore(\n useShallow((s) => ({\n close: () => s.close(identifier),\n open: () => s.open(identifier),\n isOpen: s.isOpen(identifier),\n }))\n );\n\n useScrollBlockage({\n disableScroll: isOpen,\n key: identifier ? `right_drawer_${identifier}` : 'right_drawer',\n });\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n try {\n if (!panelRef.current) return;\n\n // Check if drawer is open and click outside is enabled\n const isClickAble = isOpen && closeOnOutsideClick;\n\n // Check if click is outside the drawer panel\n const isClickOutside =\n event.target && !panelRef.current.contains(event.target as Node);\n\n // Check if event propagation has been stopped\n const isAtTopAndVisible = isElementAtTopAndNotCovered(panelRef.current);\n\n if (\n (isClickAble && isClickOutside && isAtTopAndVisible) ||\n !event.target\n ) {\n close();\n onClose?.();\n }\n } catch (_e) {\n close();\n onClose?.();\n }\n };\n\n window.addEventListener('mousedown', handleClickOutside);\n return () => window.removeEventListener('mousedown', handleClickOutside);\n }, [isOpen, close, onClose, closeOnOutsideClick, identifier]); // Make sure the effect runs only if isOpen or close changes\n\n useEffect(() => {\n if (isOpenProp !== undefined) {\n if (isOpenProp) {\n open();\n } else {\n close();\n onClose?.();\n }\n }\n }, [close, open, onClose, isOpenProp, identifier]);\n\n const handleSpareSpaceClick: MouseEventHandler<HTMLDivElement> = (e) => {\n // Check if the click trigger the background\n if (e.target !== e.currentTarget) {\n return;\n }\n\n if (isMobile) {\n close();\n onClose?.();\n }\n };\n\n return (\n <div className=\"fixed right-0 top-0 z-50 flex h-full justify-end\">\n <MaxWidthSmoother isHidden={!isOpen} align=\"right\">\n <Container\n className=\"text-text relative flex h-screen w-screen flex-col md:w-[400px]\"\n ref={panelRef}\n roundedSize=\"none\"\n >\n <div className=\"flex flex-col gap-3 p-6\">\n <div className=\"flex justify-between gap-3\">\n <div>\n {backButton && (\n <Button\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n label={backButton.text ?? 'Go back'}\n onClick={backButton.onBack}\n Icon={ChevronLeft}\n >\n {backButton?.text}\n </Button>\n )}\n </div>\n <div>\n <Button\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n label=\"Close\"\n className=\"ml-auto\"\n onClick={close}\n Icon={X}\n size={ButtonSize.ICON_MD}\n />\n </div>\n </div>\n {title && (\n <h2 className=\"flex items-center justify-center text-lg font-bold\">\n {title}\n </h2>\n )}\n {header}\n </div>\n\n <div className=\"flex h-full flex-col overflow-y-auto p-2\">\n <div\n className=\"flex flex-1 flex-col\"\n onClick={handleSpareSpaceClick}\n ref={childrenContainerRef}\n >\n {children}\n </div>\n </div>\n </Container>\n </MaxWidthSmoother>\n </div>\n );\n};\n"],"names":["useDevice","useRef","useRightDrawerStore","useShallow","useScrollBlockage","useEffect","isElementAtTopAndNotCovered","jsx","MaxWidthSmoother","jsxs","Container","Button","ButtonVariant","ButtonColor","ChevronLeft","X","ButtonSize"],"mappings":";;;;;;;;;;;;;AAgOO,MAAM,cAAoC,CAAC;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB;AAAA,EACA,QAAQ;AAAA,EACR;AACF,MAAM;AACJ,QAAM,EAAE,SAAA,IAAaA,gBAAAA,UAAU,IAAI;AACnC,QAAM,WAAWC,aAAAA,OAAuB,IAAI;AAC5C,QAAM,uBAAuBA,aAAAA,OAAuB,IAAI;AACxD,QAAM,EAAE,OAAO,MAA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AA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEJ,EAAA,CACF;AAEJ;;"}
@@ -1,18 +1,200 @@
1
1
  import { FC, ReactNode } from 'react';
2
+ /**
3
+ * Configuration for the back button functionality in the RightDrawer
4
+ *
5
+ * @interface BackButtonProps
6
+ */
2
7
  type BackButtonProps = {
8
+ /** Callback function triggered when the back button is clicked */
3
9
  onBack: () => void;
10
+ /** Optional custom text for the back button. Defaults to "Go back" if not provided */
4
11
  text?: string;
5
12
  };
13
+ /**
14
+ * Props configuration for the RightDrawer component
15
+ *
16
+ * @interface RightDrawerProps
17
+ */
6
18
  type RightDrawerProps = {
19
+ /**
20
+ * Title displayed in the drawer header
21
+ * @example
22
+ * ```tsx
23
+ * <RightDrawer title="User Settings" identifier="settings">
24
+ * Content here
25
+ * </RightDrawer>
26
+ * ```
27
+ */
7
28
  title?: ReactNode;
29
+ /**
30
+ * Unique identifier for the drawer instance. Required for store management
31
+ * @example
32
+ * ```tsx
33
+ * <RightDrawer identifier="user-profile" title="Profile">
34
+ * Profile content
35
+ * </RightDrawer>
36
+ * ```
37
+ */
8
38
  identifier: string;
39
+ /** The content to be displayed inside the drawer */
9
40
  children?: ReactNode;
41
+ /**
42
+ * Optional header content displayed below the title
43
+ * @example
44
+ * ```tsx
45
+ * <RightDrawer
46
+ * title="Settings"
47
+ * header={<div className="text-sm opacity-80">Configure your preferences</div>}
48
+ * identifier="settings"
49
+ * >
50
+ * Settings content
51
+ * </RightDrawer>
52
+ * ```
53
+ */
10
54
  header?: ReactNode;
55
+ /**
56
+ * Whether the drawer should close when clicking outside of it
57
+ * @default true
58
+ * @example
59
+ * ```tsx
60
+ * <RightDrawer closeOnOutsideClick={false} identifier="persistent">
61
+ * This drawer requires explicit close action
62
+ * </RightDrawer>
63
+ * ```
64
+ */
11
65
  closeOnOutsideClick?: boolean;
66
+ /**
67
+ * Configuration for an optional back button in the drawer header
68
+ * @example
69
+ * ```tsx
70
+ * <RightDrawer
71
+ * backButton={{
72
+ * text: "Back to List",
73
+ * onBack: () => navigate('/list')
74
+ * }}
75
+ * identifier="detail-view"
76
+ * >
77
+ * Detail content
78
+ * </RightDrawer>
79
+ * ```
80
+ */
12
81
  backButton?: BackButtonProps;
82
+ /**
83
+ * External control for the open state. When provided, overrides internal store state
84
+ * @example
85
+ * ```tsx
86
+ * const [isOpen, setIsOpen] = useState(false);
87
+ *
88
+ * <RightDrawer
89
+ * isOpen={isOpen}
90
+ * onClose={() => setIsOpen(false)}
91
+ * identifier="controlled"
92
+ * >
93
+ * Controlled drawer content
94
+ * </RightDrawer>
95
+ * ```
96
+ */
13
97
  isOpen?: boolean;
98
+ /**
99
+ * Callback function triggered when the drawer is closed
100
+ * @example
101
+ * ```tsx
102
+ * <RightDrawer
103
+ * onClose={() => console.log('Drawer closed')}
104
+ * identifier="tracked"
105
+ * >
106
+ * Content with close tracking
107
+ * </RightDrawer>
108
+ * ```
109
+ */
14
110
  onClose?: () => void;
15
111
  };
112
+ /**
113
+ * RightDrawer - A slide-out drawer panel that appears from the right side of the screen
114
+ *
115
+ * A versatile drawer component that provides an overlay panel for displaying secondary content,
116
+ * forms, details, or navigation. Features responsive design that adapts to mobile devices,
117
+ * configurable close behavior, and integrated state management through Zustand store.
118
+ *
119
+ * ## Key Features
120
+ * - **Responsive Design**: Full-width on mobile, fixed 400px width on desktop
121
+ * - **State Management**: Built-in Zustand store for managing multiple drawer instances
122
+ * - **Accessibility**: Proper ARIA attributes, keyboard navigation, and focus management
123
+ * - **Flexible Layout**: Customizable header, title, and content areas
124
+ * - **Click Outside**: Configurable outside click detection for auto-closing
125
+ * - **Scroll Management**: Automatic body scroll blocking when open
126
+ *
127
+ * ## Use Cases
128
+ * - Navigation menus and sidebars
129
+ * - Detail panels and forms
130
+ * - Settings and configuration interfaces
131
+ * - Shopping carts and checkout processes
132
+ * - User profiles and account management
133
+ * - Multi-step workflows and wizards
134
+ *
135
+ * ## Accessibility
136
+ * - **Focus Management**: Traps focus within the drawer when open
137
+ * - **Keyboard Navigation**: Escape key closes the drawer
138
+ * - **Screen Reader Support**: Proper ARIA labels and announcements
139
+ * - **Touch Support**: Mobile-optimized touch interactions
140
+ *
141
+ * ## State Management
142
+ * The component uses a Zustand store (`useRightDrawerStore`) to manage drawer state:
143
+ * - Multiple drawers can be managed simultaneously using unique identifiers
144
+ * - External components can open/close drawers using the store
145
+ * - Supports both controlled (via props) and uncontrolled (via store) patterns
146
+ *
147
+ * @example
148
+ * Basic usage with store management:
149
+ * ```tsx
150
+ * // Opening the drawer from another component
151
+ * const { open } = useRightDrawerStore();
152
+ *
153
+ * <button onClick={() => open('user-menu')}>
154
+ * Open Menu
155
+ * </button>
156
+ *
157
+ * <RightDrawer identifier="user-menu" title="User Menu">
158
+ * <nav>Navigation items here</nav>
159
+ * </RightDrawer>
160
+ * ```
161
+ *
162
+ * @example
163
+ * Controlled drawer with external state:
164
+ * ```tsx
165
+ * const [showDrawer, setShowDrawer] = useState(false);
166
+ *
167
+ * <RightDrawer
168
+ * identifier="controlled-drawer"
169
+ * title="Settings"
170
+ * isOpen={showDrawer}
171
+ * onClose={() => setShowDrawer(false)}
172
+ * closeOnOutsideClick={false}
173
+ * >
174
+ * <SettingsForm onSave={() => setShowDrawer(false)} />
175
+ * </RightDrawer>
176
+ * ```
177
+ *
178
+ * @example
179
+ * Complex drawer with back button and header:
180
+ * ```tsx
181
+ * <RightDrawer
182
+ * identifier="product-detail"
183
+ * title="Product Details"
184
+ * header={
185
+ * <div className="text-sm text-gray-600">
186
+ * SKU: {product.sku} | Stock: {product.stock}
187
+ * </div>
188
+ * }
189
+ * backButton={{
190
+ * text: "Back to Catalog",
191
+ * onBack: () => navigate('/catalog')
192
+ * }}
193
+ * >
194
+ * <ProductDetailView product={product} />
195
+ * </RightDrawer>
196
+ * ```
197
+ */
16
198
  export declare const RightDrawer: FC<RightDrawerProps>;
17
199
  export {};
18
200
  //# sourceMappingURL=RightDrawer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RightDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/RightDrawer/RightDrawer.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,EAAE,EAEP,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAUf,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAyI5C,CAAC"}
1
+ {"version":3,"file":"RightDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/RightDrawer/RightDrawer.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,EAAE,EAEP,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAUf;;;;GAIG;AACH,KAAK,eAAe,GAAG;IACrB,kEAAkE;IAClE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;GAIG;AACH,KAAK,gBAAgB,GAAG;IACtB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;;;;;;OAQG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;;;;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