@dooherceg/tiptap-controlled-editor-with-table 0.0.1

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 (287) hide show
  1. package/README.md +63 -0
  2. package/dist/Combination-CO0ZtURs.js +1333 -0
  3. package/dist/assets/badge.css +1 -0
  4. package/dist/assets/button.css +1 -0
  5. package/dist/assets/card.css +1 -0
  6. package/dist/assets/color-highlight-button.css +1 -0
  7. package/dist/assets/dropdown-menu.css +1 -0
  8. package/dist/assets/image-upload-node.css +1 -0
  9. package/dist/assets/input.css +1 -0
  10. package/dist/assets/popover.css +1 -0
  11. package/dist/assets/separator.css +1 -0
  12. package/dist/assets/simple-editor.css +1 -0
  13. package/dist/assets/toolbar.css +1 -0
  14. package/dist/assets/tooltip.css +1 -0
  15. package/dist/components/tiptap-icons/add-table-column-after-icon.d.ts +1 -0
  16. package/dist/components/tiptap-icons/add-table-column-after-icon.js +26 -0
  17. package/dist/components/tiptap-icons/add-table-column-before-icon.d.ts +1 -0
  18. package/dist/components/tiptap-icons/add-table-column-before-icon.js +26 -0
  19. package/dist/components/tiptap-icons/add-table-row-after-icon.d.ts +1 -0
  20. package/dist/components/tiptap-icons/add-table-row-after-icon.js +26 -0
  21. package/dist/components/tiptap-icons/add-table-row-before-icon.d.ts +1 -0
  22. package/dist/components/tiptap-icons/add-table-row-before-icon.js +26 -0
  23. package/dist/components/tiptap-icons/align-center-icon.d.ts +3 -0
  24. package/dist/components/tiptap-icons/align-center-icon.js +47 -0
  25. package/dist/components/tiptap-icons/align-justify-icon.d.ts +3 -0
  26. package/dist/components/tiptap-icons/align-justify-icon.js +47 -0
  27. package/dist/components/tiptap-icons/align-left-icon.d.ts +1 -0
  28. package/dist/components/tiptap-icons/align-left-icon.js +49 -0
  29. package/dist/components/tiptap-icons/align-right-icon.d.ts +1 -0
  30. package/dist/components/tiptap-icons/align-right-icon.js +49 -0
  31. package/dist/components/tiptap-icons/arrow-left-icon.d.ts +1 -0
  32. package/dist/components/tiptap-icons/arrow-left-icon.js +27 -0
  33. package/dist/components/tiptap-icons/ban-icon.d.ts +1 -0
  34. package/dist/components/tiptap-icons/ban-icon.js +29 -0
  35. package/dist/components/tiptap-icons/blockquote-icon.d.ts +1 -0
  36. package/dist/components/tiptap-icons/blockquote-icon.js +58 -0
  37. package/dist/components/tiptap-icons/bold-icon.d.ts +1 -0
  38. package/dist/components/tiptap-icons/bold-icon.js +29 -0
  39. package/dist/components/tiptap-icons/chevron-down-icon.d.ts +3 -0
  40. package/dist/components/tiptap-icons/chevron-down-icon.js +27 -0
  41. package/dist/components/tiptap-icons/close-icon.d.ts +1 -0
  42. package/dist/components/tiptap-icons/close-icon.js +27 -0
  43. package/dist/components/tiptap-icons/code-block-icon.d.ts +1 -0
  44. package/dist/components/tiptap-icons/code-block-icon.js +49 -0
  45. package/dist/components/tiptap-icons/code2-icon.d.ts +1 -0
  46. package/dist/components/tiptap-icons/code2-icon.js +43 -0
  47. package/dist/components/tiptap-icons/corner-down-left-icon.d.ts +1 -0
  48. package/dist/components/tiptap-icons/corner-down-left-icon.js +29 -0
  49. package/dist/components/tiptap-icons/delete-table-column-icon.d.ts +1 -0
  50. package/dist/components/tiptap-icons/delete-table-column-icon.js +26 -0
  51. package/dist/components/tiptap-icons/delete-table-row-icon.d.ts +1 -0
  52. package/dist/components/tiptap-icons/delete-table-row-icon.js +33 -0
  53. package/dist/components/tiptap-icons/external-link-icon.d.ts +1 -0
  54. package/dist/components/tiptap-icons/external-link-icon.js +36 -0
  55. package/dist/components/tiptap-icons/heading-five-icon.d.ts +1 -0
  56. package/dist/components/tiptap-icons/heading-five-icon.js +36 -0
  57. package/dist/components/tiptap-icons/heading-four-icon.d.ts +1 -0
  58. package/dist/components/tiptap-icons/heading-four-icon.js +36 -0
  59. package/dist/components/tiptap-icons/heading-icon.d.ts +1 -0
  60. package/dist/components/tiptap-icons/heading-icon.js +27 -0
  61. package/dist/components/tiptap-icons/heading-one-icon.d.ts +1 -0
  62. package/dist/components/tiptap-icons/heading-one-icon.js +36 -0
  63. package/dist/components/tiptap-icons/heading-six-icon.d.ts +1 -0
  64. package/dist/components/tiptap-icons/heading-six-icon.js +38 -0
  65. package/dist/components/tiptap-icons/heading-three-icon.d.ts +1 -0
  66. package/dist/components/tiptap-icons/heading-three-icon.js +47 -0
  67. package/dist/components/tiptap-icons/heading-two-icon.d.ts +1 -0
  68. package/dist/components/tiptap-icons/heading-two-icon.js +36 -0
  69. package/dist/components/tiptap-icons/highlighter-icon.d.ts +1 -0
  70. package/dist/components/tiptap-icons/highlighter-icon.js +29 -0
  71. package/dist/components/tiptap-icons/image-plus-icon.d.ts +1 -0
  72. package/dist/components/tiptap-icons/image-plus-icon.js +29 -0
  73. package/dist/components/tiptap-icons/italic-icon.d.ts +1 -0
  74. package/dist/components/tiptap-icons/italic-icon.js +27 -0
  75. package/dist/components/tiptap-icons/link-icon.d.ts +1 -0
  76. package/dist/components/tiptap-icons/link-icon.js +36 -0
  77. package/dist/components/tiptap-icons/list-icon.d.ts +1 -0
  78. package/dist/components/tiptap-icons/list-icon.js +76 -0
  79. package/dist/components/tiptap-icons/list-ordered-icon.d.ts +1 -0
  80. package/dist/components/tiptap-icons/list-ordered-icon.js +76 -0
  81. package/dist/components/tiptap-icons/list-todo-icon.d.ts +1 -0
  82. package/dist/components/tiptap-icons/list-todo-icon.js +67 -0
  83. package/dist/components/tiptap-icons/merge-table-cells-icon.d.ts +1 -0
  84. package/dist/components/tiptap-icons/merge-table-cells-icon.js +26 -0
  85. package/dist/components/tiptap-icons/moon-star-icon.d.ts +1 -0
  86. package/dist/components/tiptap-icons/moon-star-icon.js +38 -0
  87. package/dist/components/tiptap-icons/redo2-icon.d.ts +1 -0
  88. package/dist/components/tiptap-icons/redo2-icon.js +29 -0
  89. package/dist/components/tiptap-icons/remove-table-icon.d.ts +1 -0
  90. package/dist/components/tiptap-icons/remove-table-icon.js +26 -0
  91. package/dist/components/tiptap-icons/split-table-cells-icon copy.d.ts +1 -0
  92. package/dist/components/tiptap-icons/split-table-cells-icon copy.js +30 -0
  93. package/dist/components/tiptap-icons/strike-icon.d.ts +1 -0
  94. package/dist/components/tiptap-icons/strike-icon.js +36 -0
  95. package/dist/components/tiptap-icons/subscript-icon.d.ts +1 -0
  96. package/dist/components/tiptap-icons/subscript-icon.js +49 -0
  97. package/dist/components/tiptap-icons/sun-icon.d.ts +1 -0
  98. package/dist/components/tiptap-icons/sun-icon.js +87 -0
  99. package/dist/components/tiptap-icons/superscript-icon.d.ts +1 -0
  100. package/dist/components/tiptap-icons/superscript-icon.js +49 -0
  101. package/dist/components/tiptap-icons/table-icon.d.ts +3 -0
  102. package/dist/components/tiptap-icons/table-icon.js +24 -0
  103. package/dist/components/tiptap-icons/trash-icon.d.ts +1 -0
  104. package/dist/components/tiptap-icons/trash-icon.js +29 -0
  105. package/dist/components/tiptap-icons/underline-icon.d.ts +1 -0
  106. package/dist/components/tiptap-icons/underline-icon.js +29 -0
  107. package/dist/components/tiptap-icons/undo2-icon.d.ts +1 -0
  108. package/dist/components/tiptap-icons/undo2-icon.js +29 -0
  109. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.d.ts +2 -0
  110. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +67 -0
  111. package/dist/components/tiptap-node/image-upload-node/image-upload-node-extension.d.ts +58 -0
  112. package/dist/components/tiptap-node/image-upload-node/image-upload-node-extension.js +77 -0
  113. package/dist/components/tiptap-node/image-upload-node/image-upload-node.d.ts +68 -0
  114. package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +329 -0
  115. package/dist/components/tiptap-node/image-upload-node/index.d.ts +1 -0
  116. package/dist/components/tiptap-node/image-upload-node/index.js +4 -0
  117. package/dist/components/tiptap-templates/simple/simple-editor.d.ts +8 -0
  118. package/dist/components/tiptap-templates/simple/simple-editor.js +1956 -0
  119. package/dist/components/tiptap-templates/simple/theme-toggle.d.ts +1 -0
  120. package/dist/components/tiptap-templates/simple/theme-toggle.js +28 -0
  121. package/dist/components/tiptap-ui/blockquote-button/blockquote-button.d.ts +22 -0
  122. package/dist/components/tiptap-ui/blockquote-button/blockquote-button.js +71 -0
  123. package/dist/components/tiptap-ui/blockquote-button/index.d.ts +2 -0
  124. package/dist/components/tiptap-ui/blockquote-button/index.js +11 -0
  125. package/dist/components/tiptap-ui/blockquote-button/use-blockquote.d.ts +80 -0
  126. package/dist/components/tiptap-ui/blockquote-button/use-blockquote.js +82 -0
  127. package/dist/components/tiptap-ui/code-block-button/code-block-button.d.ts +22 -0
  128. package/dist/components/tiptap-ui/code-block-button/code-block-button.js +71 -0
  129. package/dist/components/tiptap-ui/code-block-button/index.d.ts +2 -0
  130. package/dist/components/tiptap-ui/code-block-button/index.js +11 -0
  131. package/dist/components/tiptap-ui/code-block-button/use-code-block.d.ts +87 -0
  132. package/dist/components/tiptap-ui/code-block-button/use-code-block.js +83 -0
  133. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.d.ts +45 -0
  134. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +89 -0
  135. package/dist/components/tiptap-ui/color-highlight-button/index.d.ts +2 -0
  136. package/dist/components/tiptap-ui/color-highlight-button/index.js +14 -0
  137. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.d.ts +82 -0
  138. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +176 -0
  139. package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.d.ts +25 -0
  140. package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.js +136 -0
  141. package/dist/components/tiptap-ui/color-highlight-popover/index.d.ts +1 -0
  142. package/dist/components/tiptap-ui/color-highlight-popover/index.js +6 -0
  143. package/dist/components/tiptap-ui/heading-button/heading-button.d.ts +23 -0
  144. package/dist/components/tiptap-ui/heading-button/heading-button.js +74 -0
  145. package/dist/components/tiptap-ui/heading-button/index.d.ts +2 -0
  146. package/dist/components/tiptap-ui/heading-button/index.js +13 -0
  147. package/dist/components/tiptap-ui/heading-button/use-heading.d.ts +108 -0
  148. package/dist/components/tiptap-ui/heading-button/use-heading.js +112 -0
  149. package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.d.ts +20 -0
  150. package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.js +67 -0
  151. package/dist/components/tiptap-ui/heading-dropdown-menu/index.d.ts +2 -0
  152. package/dist/components/tiptap-ui/heading-dropdown-menu/index.js +7 -0
  153. package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +73 -0
  154. package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.js +38 -0
  155. package/dist/components/tiptap-ui/image-upload-button/image-upload-button.d.ts +29 -0
  156. package/dist/components/tiptap-ui/image-upload-button/image-upload-button.js +72 -0
  157. package/dist/components/tiptap-ui/image-upload-button/index.d.ts +2 -0
  158. package/dist/components/tiptap-ui/image-upload-button/index.js +12 -0
  159. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.d.ts +84 -0
  160. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +76 -0
  161. package/dist/components/tiptap-ui/insert-table-button/insert-table-button.d.ts +4 -0
  162. package/dist/components/tiptap-ui/insert-table-button/insert-table-button.js +41 -0
  163. package/dist/components/tiptap-ui/link-popover/index.d.ts +2 -0
  164. package/dist/components/tiptap-ui/link-popover/index.js +13 -0
  165. package/dist/components/tiptap-ui/link-popover/link-popover.d.ts +57 -0
  166. package/dist/components/tiptap-ui/link-popover/link-popover.js +193 -0
  167. package/dist/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
  168. package/dist/components/tiptap-ui/link-popover/use-link-popover.js +103 -0
  169. package/dist/components/tiptap-ui/list-button/index.d.ts +2 -0
  170. package/dist/components/tiptap-ui/list-button/index.js +14 -0
  171. package/dist/components/tiptap-ui/list-button/list-button.d.ts +23 -0
  172. package/dist/components/tiptap-ui/list-button/list-button.js +74 -0
  173. package/dist/components/tiptap-ui/list-button/use-list.d.ts +97 -0
  174. package/dist/components/tiptap-ui/list-button/use-list.js +149 -0
  175. package/dist/components/tiptap-ui/list-dropdown-menu/index.d.ts +1 -0
  176. package/dist/components/tiptap-ui/list-dropdown-menu/index.js +4 -0
  177. package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.d.ts +29 -0
  178. package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.js +63 -0
  179. package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.d.ts +90 -0
  180. package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.js +84 -0
  181. package/dist/components/tiptap-ui/mark-button/index.d.ts +2 -0
  182. package/dist/components/tiptap-ui/mark-button/index.js +14 -0
  183. package/dist/components/tiptap-ui/mark-button/mark-button.d.ts +23 -0
  184. package/dist/components/tiptap-ui/mark-button/mark-button.js +74 -0
  185. package/dist/components/tiptap-ui/mark-button/use-mark.d.ts +104 -0
  186. package/dist/components/tiptap-ui/mark-button/use-mark.js +84 -0
  187. package/dist/components/tiptap-ui/table-actions-toolbar/add-column-after-button.d.ts +4 -0
  188. package/dist/components/tiptap-ui/table-actions-toolbar/add-column-after-button.js +7 -0
  189. package/dist/components/tiptap-ui/table-actions-toolbar/add-column-before-button.d.ts +4 -0
  190. package/dist/components/tiptap-ui/table-actions-toolbar/add-column-before-button.js +7 -0
  191. package/dist/components/tiptap-ui/table-actions-toolbar/add-row-after-button.d.ts +4 -0
  192. package/dist/components/tiptap-ui/table-actions-toolbar/add-row-after-button.js +7 -0
  193. package/dist/components/tiptap-ui/table-actions-toolbar/add-row-before-button.d.ts +4 -0
  194. package/dist/components/tiptap-ui/table-actions-toolbar/add-row-before-button.js +7 -0
  195. package/dist/components/tiptap-ui/table-actions-toolbar/delete-column-button.d.ts +4 -0
  196. package/dist/components/tiptap-ui/table-actions-toolbar/delete-column-button.js +7 -0
  197. package/dist/components/tiptap-ui/table-actions-toolbar/delete-row-button.d.ts +4 -0
  198. package/dist/components/tiptap-ui/table-actions-toolbar/delete-row-button.js +7 -0
  199. package/dist/components/tiptap-ui/table-actions-toolbar/get-table-node-and-pos.d.ts +6 -0
  200. package/dist/components/tiptap-ui/table-actions-toolbar/get-table-node-and-pos.js +15 -0
  201. package/dist/components/tiptap-ui/table-actions-toolbar/merge-cells-button.d.ts +4 -0
  202. package/dist/components/tiptap-ui/table-actions-toolbar/merge-cells-button.js +7 -0
  203. package/dist/components/tiptap-ui/table-actions-toolbar/remove-table-button.d.ts +4 -0
  204. package/dist/components/tiptap-ui/table-actions-toolbar/remove-table-button.js +7 -0
  205. package/dist/components/tiptap-ui/table-actions-toolbar/split-table-cells-button.d.ts +4 -0
  206. package/dist/components/tiptap-ui/table-actions-toolbar/split-table-cells-button.js +7 -0
  207. package/dist/components/tiptap-ui/table-actions-toolbar/table-actions-toolbar.d.ts +2 -0
  208. package/dist/components/tiptap-ui/table-actions-toolbar/table-actions-toolbar.js +75 -0
  209. package/dist/components/tiptap-ui/text-align-button/index.d.ts +2 -0
  210. package/dist/components/tiptap-ui/text-align-button/index.js +15 -0
  211. package/dist/components/tiptap-ui/text-align-button/text-align-button.d.ts +30 -0
  212. package/dist/components/tiptap-ui/text-align-button/text-align-button.js +81 -0
  213. package/dist/components/tiptap-ui/text-align-button/use-text-align.d.ts +101 -0
  214. package/dist/components/tiptap-ui/text-align-button/use-text-align.js +84 -0
  215. package/dist/components/tiptap-ui/undo-redo-button/index.d.ts +2 -0
  216. package/dist/components/tiptap-ui/undo-redo-button/index.js +13 -0
  217. package/dist/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +23 -0
  218. package/dist/components/tiptap-ui/undo-redo-button/undo-redo-button.js +70 -0
  219. package/dist/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +90 -0
  220. package/dist/components/tiptap-ui/undo-redo-button/use-undo-redo.js +67 -0
  221. package/dist/components/tiptap-ui-primitive/badge/badge.d.ts +8 -0
  222. package/dist/components/tiptap-ui-primitive/badge/badge.js +30 -0
  223. package/dist/components/tiptap-ui-primitive/badge/index.d.ts +1 -0
  224. package/dist/components/tiptap-ui-primitive/badge/index.js +4 -0
  225. package/dist/components/tiptap-ui-primitive/button/button.d.ts +14 -0
  226. package/dist/components/tiptap-ui-primitive/button/button.js +69 -0
  227. package/dist/components/tiptap-ui-primitive/button/index.d.ts +1 -0
  228. package/dist/components/tiptap-ui-primitive/button/index.js +6 -0
  229. package/dist/components/tiptap-ui-primitive/card/card.d.ts +9 -0
  230. package/dist/components/tiptap-ui-primitive/card/card.js +62 -0
  231. package/dist/components/tiptap-ui-primitive/card/index.d.ts +1 -0
  232. package/dist/components/tiptap-ui-primitive/card/index.js +9 -0
  233. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +16 -0
  234. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +1028 -0
  235. package/dist/components/tiptap-ui-primitive/dropdown-menu/index.d.ts +1 -0
  236. package/dist/components/tiptap-ui-primitive/dropdown-menu/index.js +13 -0
  237. package/dist/components/tiptap-ui-primitive/input/index.d.ts +1 -0
  238. package/dist/components/tiptap-ui-primitive/input/index.js +5 -0
  239. package/dist/components/tiptap-ui-primitive/input/input.d.ts +3 -0
  240. package/dist/components/tiptap-ui-primitive/input/input.js +16 -0
  241. package/dist/components/tiptap-ui-primitive/popover/index.d.ts +1 -0
  242. package/dist/components/tiptap-ui-primitive/popover/index.js +6 -0
  243. package/dist/components/tiptap-ui-primitive/popover/popover.d.ts +5 -0
  244. package/dist/components/tiptap-ui-primitive/popover/popover.js +244 -0
  245. package/dist/components/tiptap-ui-primitive/separator/index.d.ts +1 -0
  246. package/dist/components/tiptap-ui-primitive/separator/index.js +4 -0
  247. package/dist/components/tiptap-ui-primitive/separator/separator.d.ts +6 -0
  248. package/dist/components/tiptap-ui-primitive/separator/separator.js +22 -0
  249. package/dist/components/tiptap-ui-primitive/spacer/index.d.ts +1 -0
  250. package/dist/components/tiptap-ui-primitive/spacer/index.js +4 -0
  251. package/dist/components/tiptap-ui-primitive/spacer/spacer.d.ts +6 -0
  252. package/dist/components/tiptap-ui-primitive/spacer/spacer.js +20 -0
  253. package/dist/components/tiptap-ui-primitive/toolbar/index.d.ts +1 -0
  254. package/dist/components/tiptap-ui-primitive/toolbar/index.js +6 -0
  255. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.d.ts +8 -0
  256. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +83 -0
  257. package/dist/components/tiptap-ui-primitive/tooltip/index.d.ts +1 -0
  258. package/dist/components/tiptap-ui-primitive/tooltip/index.js +6 -0
  259. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +28 -0
  260. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +1374 -0
  261. package/dist/floating-ui.react-dom-DgOuULHo.js +1334 -0
  262. package/dist/hooks/use-composed-ref.d.ts +3 -0
  263. package/dist/hooks/use-composed-ref.js +16 -0
  264. package/dist/hooks/use-cursor-visibility.d.ts +20 -0
  265. package/dist/hooks/use-cursor-visibility.js +31 -0
  266. package/dist/hooks/use-element-rect.d.ts +35 -0
  267. package/dist/hooks/use-element-rect.js +79 -0
  268. package/dist/hooks/use-menu-navigation.d.ts +52 -0
  269. package/dist/hooks/use-menu-navigation.js +68 -0
  270. package/dist/hooks/use-mobile.d.ts +1 -0
  271. package/dist/hooks/use-mobile.js +13 -0
  272. package/dist/hooks/use-scrolling.d.ts +8 -0
  273. package/dist/hooks/use-scrolling.js +17 -0
  274. package/dist/hooks/use-throttled-callback.d.ts +18 -0
  275. package/dist/hooks/use-throttled-callback.js +116 -0
  276. package/dist/hooks/use-tiptap-editor.d.ts +17 -0
  277. package/dist/hooks/use-tiptap-editor.js +25 -0
  278. package/dist/hooks/use-unmount.d.ts +7 -0
  279. package/dist/hooks/use-unmount.js +14 -0
  280. package/dist/hooks/use-window-size.d.ts +35 -0
  281. package/dist/hooks/use-window-size.js +33 -0
  282. package/dist/index-Bqw9S4qP.js +238 -0
  283. package/dist/lib/tiptap-utils.d.ts +160 -0
  284. package/dist/lib/tiptap-utils.js +229 -0
  285. package/dist/main.d.ts +1 -0
  286. package/dist/main.js +4 -0
  287. package/package.json +67 -0
@@ -0,0 +1,74 @@
1
+ import { jsx as t, jsxs as x, Fragment as y } from "react/jsx-runtime";
2
+ import { forwardRef as K, useCallback as S } from "react";
3
+ import { parseShortcutKeys as T } from "../../../lib/tiptap-utils.js";
4
+ import { useTiptapEditor as C } from "../../../hooks/use-tiptap-editor.js";
5
+ import { useMark as N, MARK_SHORTCUT_KEYS as R } from "./use-mark.js";
6
+ import { Button as j } from "../../tiptap-ui-primitive/button/button.js";
7
+ import { Badge as v } from "../../tiptap-ui-primitive/badge/badge.js";
8
+ function A({
9
+ type: a,
10
+ shortcutKeys: r = R[a]
11
+ }) {
12
+ return /* @__PURE__ */ t(v, { children: T({ shortcutKeys: r }) });
13
+ }
14
+ const E = K(
15
+ ({
16
+ editor: a,
17
+ type: r,
18
+ text: e,
19
+ hideWhenUnavailable: c = !1,
20
+ onToggled: u,
21
+ showShortcut: p = !1,
22
+ onClick: o,
23
+ children: m,
24
+ ...f
25
+ }, b) => {
26
+ const { editor: h } = C(a), {
27
+ isVisible: k,
28
+ handleMark: i,
29
+ label: s,
30
+ canToggle: n,
31
+ isActive: l,
32
+ Icon: g,
33
+ shortcutKeys: M
34
+ } = N({
35
+ editor: h,
36
+ type: r,
37
+ hideWhenUnavailable: c,
38
+ onToggled: u
39
+ }), B = S(
40
+ (d) => {
41
+ o?.(d), !d.defaultPrevented && i();
42
+ },
43
+ [i, o]
44
+ );
45
+ return k ? /* @__PURE__ */ t(
46
+ j,
47
+ {
48
+ type: "button",
49
+ disabled: !n,
50
+ "data-style": "ghost",
51
+ "data-active-state": l ? "on" : "off",
52
+ "data-disabled": !n,
53
+ role: "button",
54
+ tabIndex: -1,
55
+ "aria-label": s,
56
+ "aria-pressed": l,
57
+ tooltip: s,
58
+ onClick: B,
59
+ ...f,
60
+ ref: b,
61
+ children: m ?? /* @__PURE__ */ x(y, { children: [
62
+ /* @__PURE__ */ t(g, { className: "tiptap-button-icon" }),
63
+ e && /* @__PURE__ */ t("span", { className: "tiptap-button-text", children: e }),
64
+ p && /* @__PURE__ */ t(A, { type: r, shortcutKeys: M })
65
+ ] })
66
+ }
67
+ ) : null;
68
+ }
69
+ );
70
+ E.displayName = "MarkButton";
71
+ export {
72
+ E as MarkButton,
73
+ A as MarkShortcutBadge
74
+ };
@@ -0,0 +1,104 @@
1
+ import { Editor } from '@tiptap/react';
2
+ export type Mark = "bold" | "italic" | "strike" | "code" | "underline" | "superscript" | "subscript";
3
+ /**
4
+ * Configuration for the mark functionality
5
+ */
6
+ export interface UseMarkConfig {
7
+ /**
8
+ * The Tiptap editor instance.
9
+ */
10
+ editor?: Editor | null;
11
+ /**
12
+ * The type of mark to toggle
13
+ */
14
+ type: Mark;
15
+ /**
16
+ * Whether the button should hide when mark is not available.
17
+ * @default false
18
+ */
19
+ hideWhenUnavailable?: boolean;
20
+ /**
21
+ * Callback function called after a successful mark toggle.
22
+ */
23
+ onToggled?: () => void;
24
+ }
25
+ export declare const markIcons: {
26
+ bold: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
27
+ italic: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
28
+ underline: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
29
+ strike: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
30
+ code: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
31
+ superscript: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
32
+ subscript: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
33
+ };
34
+ export declare const MARK_SHORTCUT_KEYS: Record<Mark, string>;
35
+ /**
36
+ * Checks if a mark can be toggled in the current editor state
37
+ */
38
+ export declare function canToggleMark(editor: Editor | null, type: Mark): boolean;
39
+ /**
40
+ * Checks if a mark is currently active
41
+ */
42
+ export declare function isMarkActive(editor: Editor | null, type: Mark): boolean;
43
+ /**
44
+ * Toggles a mark in the editor
45
+ */
46
+ export declare function toggleMark(editor: Editor | null, type: Mark): boolean;
47
+ /**
48
+ * Determines if the mark button should be shown
49
+ */
50
+ export declare function shouldShowButton(props: {
51
+ editor: Editor | null;
52
+ type: Mark;
53
+ hideWhenUnavailable: boolean;
54
+ }): boolean;
55
+ /**
56
+ * Gets the formatted mark name
57
+ */
58
+ export declare function getFormattedMarkName(type: Mark): string;
59
+ /**
60
+ * Custom hook that provides mark functionality for Tiptap editor
61
+ *
62
+ * @example
63
+ * ```tsx
64
+ * // Simple usage
65
+ * function MySimpleBoldButton() {
66
+ * const { isVisible, handleMark } = useMark({ type: "bold" })
67
+ *
68
+ * if (!isVisible) return null
69
+ *
70
+ * return <button onClick={handleMark}>Bold</button>
71
+ * }
72
+ *
73
+ * // Advanced usage with configuration
74
+ * function MyAdvancedItalicButton() {
75
+ * const { isVisible, handleMark, label, isActive } = useMark({
76
+ * editor: myEditor,
77
+ * type: "italic",
78
+ * hideWhenUnavailable: true,
79
+ * onToggled: () => console.log('Mark toggled!')
80
+ * })
81
+ *
82
+ * if (!isVisible) return null
83
+ *
84
+ * return (
85
+ * <MyButton
86
+ * onClick={handleMark}
87
+ * aria-pressed={isActive}
88
+ * aria-label={label}
89
+ * >
90
+ * Italic
91
+ * </MyButton>
92
+ * )
93
+ * }
94
+ * ```
95
+ */
96
+ export declare function useMark(config: UseMarkConfig): {
97
+ isVisible: boolean;
98
+ isActive: boolean;
99
+ handleMark: () => boolean;
100
+ canToggle: boolean;
101
+ label: string;
102
+ shortcutKeys: string;
103
+ Icon: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element> | import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element> | import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element> | import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element> | import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element> | import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element> | import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
104
+ };
@@ -0,0 +1,84 @@
1
+ import { useState as p, useEffect as b, useCallback as g } from "react";
2
+ import { useTiptapEditor as k } from "../../../hooks/use-tiptap-editor.js";
3
+ import { isMarkInSchema as a, isNodeTypeSelected as h } from "../../../lib/tiptap-utils.js";
4
+ import { BoldIcon as I } from "../../tiptap-icons/bold-icon.js";
5
+ import { Code2Icon as M } from "../../tiptap-icons/code2-icon.js";
6
+ import { ItalicIcon as S } from "../../tiptap-icons/italic-icon.js";
7
+ import { StrikeIcon as E } from "../../tiptap-icons/strike-icon.js";
8
+ import { SubscriptIcon as U } from "../../tiptap-icons/subscript-icon.js";
9
+ import { SuperscriptIcon as v } from "../../tiptap-icons/superscript-icon.js";
10
+ import { UnderlineIcon as T } from "../../tiptap-icons/underline-icon.js";
11
+ const A = {
12
+ bold: I,
13
+ italic: S,
14
+ underline: T,
15
+ strike: E,
16
+ code: M,
17
+ superscript: v,
18
+ subscript: U
19
+ }, C = {
20
+ bold: "mod+b",
21
+ italic: "mod+i",
22
+ underline: "mod+u",
23
+ strike: "mod+shift+s",
24
+ code: "mod+e",
25
+ superscript: "mod+.",
26
+ subscript: "mod+,"
27
+ };
28
+ function s(e, t) {
29
+ return !e || !e.isEditable || !a(t, e) || h(e, ["image"]) ? !1 : e.can().toggleMark(t);
30
+ }
31
+ function K(e, t) {
32
+ return !e || !e.isEditable ? !1 : e.isActive(t);
33
+ }
34
+ function B(e, t) {
35
+ return !e || !e.isEditable || !s(e, t) ? !1 : e.chain().focus().toggleMark(t).run();
36
+ }
37
+ function N(e) {
38
+ const { editor: t, type: r, hideWhenUnavailable: n } = e;
39
+ return !t || !t.isEditable || !a(r, t) ? !1 : n && !t.isActive("code") ? s(t, r) : !0;
40
+ }
41
+ function R(e) {
42
+ return e.charAt(0).toUpperCase() + e.slice(1);
43
+ }
44
+ function j(e) {
45
+ const {
46
+ editor: t,
47
+ type: r,
48
+ hideWhenUnavailable: n = !1,
49
+ onToggled: c
50
+ } = e, { editor: o } = k(t), [l, u] = p(!0), f = s(o, r), m = K(o, r);
51
+ b(() => {
52
+ if (!o) return;
53
+ const i = () => {
54
+ u(N({ editor: o, type: r, hideWhenUnavailable: n }));
55
+ };
56
+ return i(), o.on("selectionUpdate", i), () => {
57
+ o.off("selectionUpdate", i);
58
+ };
59
+ }, [o, r, n]);
60
+ const d = g(() => {
61
+ if (!o) return !1;
62
+ const i = B(o, r);
63
+ return i && c?.(), i;
64
+ }, [o, r, c]);
65
+ return {
66
+ isVisible: l,
67
+ isActive: m,
68
+ handleMark: d,
69
+ canToggle: f,
70
+ label: R(r),
71
+ shortcutKeys: C[r],
72
+ Icon: A[r]
73
+ };
74
+ }
75
+ export {
76
+ C as MARK_SHORTCUT_KEYS,
77
+ s as canToggleMark,
78
+ R as getFormattedMarkName,
79
+ K as isMarkActive,
80
+ A as markIcons,
81
+ N as shouldShowButton,
82
+ B as toggleMark,
83
+ j as useMark
84
+ };
@@ -0,0 +1,4 @@
1
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
2
+ type AddColumnAfterButtonProps = {} & ButtonProps;
3
+ declare const AddColumnAfterButton: ({ onClick }: AddColumnAfterButtonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default AddColumnAfterButton;
@@ -0,0 +1,7 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { AddTableColumnAfterIcon as r } from "../../tiptap-icons/add-table-column-after-icon.js";
3
+ import { Button as n } from "../../tiptap-ui-primitive/button/button.js";
4
+ const u = ({ onClick: o }) => /* @__PURE__ */ t(n, { onClick: o, tooltip: "Add Column After", type: "button", children: /* @__PURE__ */ t(r, {}) });
5
+ export {
6
+ u as default
7
+ };
@@ -0,0 +1,4 @@
1
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
2
+ type AddColumnBeforeButtonProps = {} & ButtonProps;
3
+ declare const AddColumnBeforeButton: ({ onClick }: AddColumnBeforeButtonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default AddColumnBeforeButton;
@@ -0,0 +1,7 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { AddTableColumnBeforeIcon as r } from "../../tiptap-icons/add-table-column-before-icon.js";
3
+ import { Button as e } from "../../tiptap-ui-primitive/button/button.js";
4
+ const u = ({ onClick: t }) => /* @__PURE__ */ o(e, { onClick: t, tooltip: "Add Column Before", type: "button", children: /* @__PURE__ */ o(r, {}) });
5
+ export {
6
+ u as default
7
+ };
@@ -0,0 +1,4 @@
1
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
2
+ type AddRowAfterButtonProps = {} & ButtonProps;
3
+ declare const AddRowAfterButton: ({ onClick }: AddRowAfterButtonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default AddRowAfterButton;
@@ -0,0 +1,7 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { AddTableRowAfterIcon as r } from "../../tiptap-icons/add-table-row-after-icon.js";
3
+ import { Button as e } from "../../tiptap-ui-primitive/button/button.js";
4
+ const m = ({ onClick: o }) => /* @__PURE__ */ t(e, { onClick: o, tooltip: "Add Row After", type: "button", children: /* @__PURE__ */ t(r, {}) });
5
+ export {
6
+ m as default
7
+ };
@@ -0,0 +1,4 @@
1
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
2
+ type AddRowBeforeButtonProps = {} & ButtonProps;
3
+ declare const AddRowBeforeButton: ({ onClick }: AddRowBeforeButtonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default AddRowBeforeButton;
@@ -0,0 +1,7 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { AddTableRowBeforeIcon as r } from "../../tiptap-icons/add-table-row-before-icon.js";
3
+ import { Button as e } from "../../tiptap-ui-primitive/button/button.js";
4
+ const m = ({ onClick: t }) => /* @__PURE__ */ o(e, { onClick: t, tooltip: "Add Row Before", type: "button", children: /* @__PURE__ */ o(r, {}) });
5
+ export {
6
+ m as default
7
+ };
@@ -0,0 +1,4 @@
1
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
2
+ type DeleteColumnButtonProps = {} & ButtonProps;
3
+ declare const DeleteColumnButton: ({ onClick }: DeleteColumnButtonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default DeleteColumnButton;
@@ -0,0 +1,7 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { DeleteTableColumnIcon as e } from "../../tiptap-icons/delete-table-column-icon.js";
3
+ import { Button as l } from "../../tiptap-ui-primitive/button/button.js";
4
+ const u = ({ onClick: o }) => /* @__PURE__ */ t(l, { onClick: o, tooltip: "Delete Column", type: "button", children: /* @__PURE__ */ t(e, {}) });
5
+ export {
6
+ u as default
7
+ };
@@ -0,0 +1,4 @@
1
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
2
+ type DeleteRowButtonProps = {} & ButtonProps;
3
+ declare const DeleteRowButton: ({ onClick }: DeleteRowButtonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default DeleteRowButton;
@@ -0,0 +1,7 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { DeleteTableRowIcon as e } from "../../tiptap-icons/delete-table-row-icon.js";
3
+ import { Button as r } from "../../tiptap-ui-primitive/button/button.js";
4
+ const p = ({ onClick: o }) => /* @__PURE__ */ t(r, { onClick: o, tooltip: "Delete Row", type: "button", children: /* @__PURE__ */ t(e, {}) });
5
+ export {
6
+ p as default
7
+ };
@@ -0,0 +1,6 @@
1
+ import { Editor } from '@tiptap/react';
2
+ export declare function getTableNodeAndPos(editor: Editor): {
3
+ node: import('prosemirror-model').Node;
4
+ pos: number;
5
+ domElement: Node | null;
6
+ } | null;
@@ -0,0 +1,15 @@
1
+ import { findParentNode as t } from "@tiptap/core";
2
+ import "@tiptap/react";
3
+ function l(o) {
4
+ const e = t((n) => n.type.name === "table")(
5
+ o.state.selection
6
+ );
7
+ return e ? {
8
+ node: e.node,
9
+ pos: e.pos,
10
+ domElement: o.view.nodeDOM(e.pos)
11
+ } : null;
12
+ }
13
+ export {
14
+ l as getTableNodeAndPos
15
+ };
@@ -0,0 +1,4 @@
1
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
2
+ type MergeTableCellsButtonProps = {} & ButtonProps;
3
+ declare const MergeTableCellsButton: ({ onClick }: MergeTableCellsButtonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default MergeTableCellsButton;
@@ -0,0 +1,7 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { MergeTableCellsIcon as o } from "../../tiptap-icons/merge-table-cells-icon.js";
3
+ import { Button as r } from "../../tiptap-ui-primitive/button/button.js";
4
+ const p = ({ onClick: t }) => /* @__PURE__ */ e(r, { onClick: t, tooltip: "Merge Cells", type: "button", children: /* @__PURE__ */ e(o, {}) });
5
+ export {
6
+ p as default
7
+ };
@@ -0,0 +1,4 @@
1
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
2
+ type RemoveTableButtonProps = {} & ButtonProps;
3
+ declare const RemoveTableButton: ({ onClick }: RemoveTableButtonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default RemoveTableButton;
@@ -0,0 +1,7 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { RemoveTableIcon as e } from "../../tiptap-icons/remove-table-icon.js";
3
+ import { Button as r } from "../../tiptap-ui-primitive/button/button.js";
4
+ const p = ({ onClick: t }) => /* @__PURE__ */ o(r, { onClick: t, tooltip: "Remove Table", type: "button", children: /* @__PURE__ */ o(e, {}) });
5
+ export {
6
+ p as default
7
+ };
@@ -0,0 +1,4 @@
1
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
2
+ type SplitTableCellsButtonProps = {} & ButtonProps;
3
+ declare const SplitTableCellsButton: ({ onClick }: SplitTableCellsButtonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default SplitTableCellsButton;
@@ -0,0 +1,7 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { SplitTableCellsIcon as o } from "../../tiptap-icons/split-table-cells-icon copy.js";
3
+ import { Button as e } from "../../tiptap-ui-primitive/button/button.js";
4
+ const n = ({ onClick: l }) => /* @__PURE__ */ t(e, { onClick: l, tooltip: "Split Cells", type: "button", children: /* @__PURE__ */ t(o, {}) });
5
+ export {
6
+ n as default
7
+ };
@@ -0,0 +1,2 @@
1
+ declare const TableActions: () => import('react').ReactPortal | null;
2
+ export default TableActions;
@@ -0,0 +1,75 @@
1
+ import { jsx as o, jsxs as a } from "react/jsx-runtime";
2
+ import { useTiptapEditor as i } from "../../../hooks/use-tiptap-editor.js";
3
+ import { useState as m, useEffect as s } from "react";
4
+ import { createPortal as u } from "react-dom";
5
+ import c from "./add-column-after-button.js";
6
+ import f from "./add-column-before-button.js";
7
+ import p from "./add-row-after-button.js";
8
+ import h from "./add-row-before-button.js";
9
+ import C from "./delete-column-button.js";
10
+ import A from "./delete-row-button.js";
11
+ import { getTableNodeAndPos as b } from "./get-table-node-and-pos.js";
12
+ import B from "./merge-cells-button.js";
13
+ import R from "./remove-table-button.js";
14
+ import T from "./split-table-cells-button.js";
15
+ import { ButtonGroup as w } from "../../tiptap-ui-primitive/button/button.js";
16
+ const Q = () => {
17
+ const [l, n] = m(null), { editor: e } = i();
18
+ return s(() => {
19
+ if (!e) return;
20
+ const t = () => {
21
+ const d = e.isActive("table"), r = b(e);
22
+ n(d && r ? r.domElement : null);
23
+ };
24
+ return e.on("selectionUpdate", t), () => {
25
+ e.off("selectionUpdate", t);
26
+ };
27
+ }, [e]), l && u(
28
+ /* @__PURE__ */ o(
29
+ "div",
30
+ {
31
+ onMouseDown: (t) => t.preventDefault(),
32
+ onClick: (t) => t.stopPropagation(),
33
+ style: {
34
+ position: "absolute",
35
+ top: -6,
36
+ left: 0,
37
+ transform: "translateY(-100%)"
38
+ },
39
+ children: /* @__PURE__ */ a(w, { orientation: "horizontal", children: [
40
+ /* @__PURE__ */ o(f, { onClick: () => {
41
+ e?.chain().focus().addColumnBefore().run();
42
+ } }),
43
+ /* @__PURE__ */ o(c, { onClick: () => {
44
+ e?.chain().focus().addColumnAfter().run();
45
+ } }),
46
+ /* @__PURE__ */ o(p, { onClick: () => {
47
+ e?.chain().addRowAfter().run();
48
+ } }),
49
+ /* @__PURE__ */ o(h, { onClick: () => {
50
+ e?.chain().addRowBefore().run();
51
+ } }),
52
+ /* @__PURE__ */ o(A, { onClick: () => {
53
+ e?.chain().deleteRow().run();
54
+ } }),
55
+ /* @__PURE__ */ o(C, { onClick: () => {
56
+ e?.chain().deleteColumn().run();
57
+ } }),
58
+ /* @__PURE__ */ o(B, { onClick: () => {
59
+ e?.chain().mergeCells().run();
60
+ } }),
61
+ /* @__PURE__ */ o(T, { onClick: () => {
62
+ e?.chain().splitCell().run();
63
+ } }),
64
+ /* @__PURE__ */ o(R, { onClick: () => {
65
+ e?.chain().deleteTable().run();
66
+ } })
67
+ ] })
68
+ }
69
+ ),
70
+ l
71
+ );
72
+ };
73
+ export {
74
+ Q as default
75
+ };
@@ -0,0 +1,2 @@
1
+ export * from './text-align-button';
2
+ export * from './use-text-align';
@@ -0,0 +1,15 @@
1
+ import { TextAlignButton as n, TextAlignShortcutBadge as i } from "./text-align-button.js";
2
+ import { TEXT_ALIGN_SHORTCUT_KEYS as x, canSetTextAlign as A, hasSetTextAlign as T, isTextAlignActive as g, setTextAlign as o, shouldShowButton as s, textAlignIcons as S, textAlignLabels as r, useTextAlign as u } from "./use-text-align.js";
3
+ export {
4
+ x as TEXT_ALIGN_SHORTCUT_KEYS,
5
+ n as TextAlignButton,
6
+ i as TextAlignShortcutBadge,
7
+ A as canSetTextAlign,
8
+ T as hasSetTextAlign,
9
+ g as isTextAlignActive,
10
+ o as setTextAlign,
11
+ s as shouldShowButton,
12
+ S as textAlignIcons,
13
+ r as textAlignLabels,
14
+ u as useTextAlign
15
+ };
@@ -0,0 +1,30 @@
1
+ import { TextAlign, UseTextAlignConfig } from '.';
2
+ import { ButtonProps } from '../../tiptap-ui-primitive/button';
3
+ type IconProps = React.SVGProps<SVGSVGElement>;
4
+ type IconComponent = ({ className, ...props }: IconProps) => React.ReactElement;
5
+ export interface TextAlignButtonProps extends Omit<ButtonProps, "type">, UseTextAlignConfig {
6
+ /**
7
+ * Optional text to display alongside the icon.
8
+ */
9
+ text?: string;
10
+ /**
11
+ * Optional show shortcut keys in the button.
12
+ * @default false
13
+ */
14
+ showShortcut?: boolean;
15
+ /**
16
+ * Optional custom icon component to render instead of the default.
17
+ */
18
+ icon?: React.MemoExoticComponent<IconComponent> | React.FC<IconProps>;
19
+ }
20
+ export declare function TextAlignShortcutBadge({ align, shortcutKeys, }: {
21
+ align: TextAlign;
22
+ shortcutKeys?: string;
23
+ }): import("react/jsx-runtime").JSX.Element;
24
+ /**
25
+ * Button component for setting text alignment in a Tiptap editor.
26
+ *
27
+ * For custom button implementations, use the `useTextAlign` hook instead.
28
+ */
29
+ export declare const TextAlignButton: import('react').ForwardRefExoticComponent<TextAlignButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
30
+ export {};
@@ -0,0 +1,81 @@
1
+ import { jsx as t, jsxs as B, Fragment as I } from "react/jsx-runtime";
2
+ import { forwardRef as N, useCallback as R } from "react";
3
+ import { parseShortcutKeys as S } from "../../../lib/tiptap-utils.js";
4
+ import { useTiptapEditor as C } from "../../../hooks/use-tiptap-editor.js";
5
+ import { useTextAlign as E, TEXT_ALIGN_SHORTCUT_KEYS as K } from "./use-text-align.js";
6
+ import { Button as _ } from "../../tiptap-ui-primitive/button/button.js";
7
+ import { Badge as j } from "../../tiptap-ui-primitive/badge/badge.js";
8
+ function k({
9
+ align: o,
10
+ shortcutKeys: e = K[o]
11
+ }) {
12
+ return /* @__PURE__ */ t(j, { children: S({ shortcutKeys: e }) });
13
+ }
14
+ const v = N(
15
+ ({
16
+ editor: o,
17
+ align: e,
18
+ text: r,
19
+ hideWhenUnavailable: c = !1,
20
+ onAligned: p,
21
+ showShortcut: u = !1,
22
+ onClick: n,
23
+ icon: m,
24
+ children: f,
25
+ ...b
26
+ }, h) => {
27
+ const { editor: T } = C(o), {
28
+ isVisible: g,
29
+ handleTextAlign: i,
30
+ label: a,
31
+ canAlign: s,
32
+ isActive: l,
33
+ Icon: x,
34
+ shortcutKeys: A
35
+ } = E({
36
+ editor: T,
37
+ align: e,
38
+ hideWhenUnavailable: c,
39
+ onAligned: p
40
+ }), y = R(
41
+ (d) => {
42
+ n?.(d), !d.defaultPrevented && i();
43
+ },
44
+ [i, n]
45
+ );
46
+ return g ? /* @__PURE__ */ t(
47
+ _,
48
+ {
49
+ type: "button",
50
+ disabled: !s,
51
+ "data-style": "ghost",
52
+ "data-active-state": l ? "on" : "off",
53
+ "data-disabled": !s,
54
+ role: "button",
55
+ tabIndex: -1,
56
+ "aria-label": a,
57
+ "aria-pressed": l,
58
+ tooltip: a,
59
+ onClick: y,
60
+ ...b,
61
+ ref: h,
62
+ children: f ?? /* @__PURE__ */ B(I, { children: [
63
+ /* @__PURE__ */ t(m ?? x, { className: "tiptap-button-icon" }),
64
+ r && /* @__PURE__ */ t("span", { className: "tiptap-button-text", children: r }),
65
+ u && /* @__PURE__ */ t(
66
+ k,
67
+ {
68
+ align: e,
69
+ shortcutKeys: A
70
+ }
71
+ )
72
+ ] })
73
+ }
74
+ ) : null;
75
+ }
76
+ );
77
+ v.displayName = "TextAlignButton";
78
+ export {
79
+ v as TextAlignButton,
80
+ k as TextAlignShortcutBadge
81
+ };