reactjs-tiptap-editor-pro 0.2.28 → 0.2.30
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.
- package/package.json +4 -60
- package/src/components/ActionButton.tsx +103 -0
- package/src/components/ActionMenuButton.tsx +76 -0
- package/src/components/BubbleMenu.tsx +93 -0
- package/src/components/CharactorCount.tsx +50 -0
- package/src/components/ColorPicker.tsx +272 -0
- package/src/components/RichTextEditor.tsx +212 -0
- package/src/components/SizeSetter/SizeSetter.tsx +102 -0
- package/src/components/Toolbar.tsx +108 -0
- package/src/components/icons/Activity.tsx +19 -0
- package/src/components/icons/Animas.tsx +24 -0
- package/src/components/icons/AspectRatio.tsx +13 -0
- package/src/components/icons/Blockquote.tsx +17 -0
- package/src/components/icons/ColumnAddLeft.tsx +7 -0
- package/src/components/icons/ColumnAddRight.tsx +7 -0
- package/src/components/icons/DeleteColumn.tsx +26 -0
- package/src/components/icons/DeleteRow.tsx +26 -0
- package/src/components/icons/Direction.tsx +7 -0
- package/src/components/icons/Excalidraw.tsx +7 -0
- package/src/components/icons/ExportPdf.tsx +8 -0
- package/src/components/icons/ExportWord.tsx +24 -0
- package/src/components/icons/FileWordOutline.tsx +13 -0
- package/src/components/icons/Flag.tsx +19 -0
- package/src/components/icons/Food.tsx +20 -0
- package/src/components/icons/GIfIcon.tsx +10 -0
- package/src/components/icons/Icon.tsx +30 -0
- package/src/components/icons/ImportWord.tsx +23 -0
- package/src/components/icons/LeftToRight.tsx +7 -0
- package/src/components/icons/LineHeight.tsx +13 -0
- package/src/components/icons/MenuDown.tsx +24 -0
- package/src/components/icons/Mermaid.tsx +13 -0
- package/src/components/icons/NoFill.tsx +7 -0
- package/src/components/icons/Object.tsx +24 -0
- package/src/components/icons/RightToLeft.tsx +7 -0
- package/src/components/icons/SizeL.tsx +9 -0
- package/src/components/icons/SizeM.tsx +13 -0
- package/src/components/icons/SizeS.tsx +13 -0
- package/src/components/icons/Symbol.tsx +19 -0
- package/src/components/icons/Travel.tsx +24 -0
- package/src/components/icons/Twitter.tsx +7 -0
- package/src/components/icons/icons.ts +212 -0
- package/src/components/icons/index.ts +12 -0
- package/src/components/index.ts +9 -0
- package/src/components/menus/bubble.ts +395 -0
- package/src/components/menus/components/BubbleMenuContent.tsx +15 -0
- package/src/components/menus/components/BubbleMenuDrawer.tsx +128 -0
- package/src/components/menus/components/BubbleMenuExcalidraw.tsx +91 -0
- package/src/components/menus/components/BubbleMenuIframe.tsx +143 -0
- package/src/components/menus/components/BubbleMenuKatex.tsx +136 -0
- package/src/components/menus/components/BubbleMenuLink.tsx +99 -0
- package/src/components/menus/components/BubbleMenuMedia.tsx +235 -0
- package/src/components/menus/components/BubbleMenuMermaid.tsx +128 -0
- package/src/components/menus/components/BubbleMenuText.tsx +102 -0
- package/src/components/menus/components/BubbleMenuTwitter.tsx +91 -0
- package/src/components/menus/components/ColumnsBubbleMenu.tsx +59 -0
- package/src/components/menus/components/ContentMenu.tsx +396 -0
- package/src/components/menus/components/TableBubbleMenu.tsx +362 -0
- package/src/components/menus/index.ts +7 -0
- package/src/components/ui/button.tsx +56 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/dialog.tsx +128 -0
- package/src/components/ui/dropdown-menu.tsx +203 -0
- package/src/components/ui/emoji-picker.tsx +166 -0
- package/src/components/ui/index.ts +14 -0
- package/src/components/ui/input.tsx +25 -0
- package/src/components/ui/label.tsx +26 -0
- package/src/components/ui/popover.tsx +31 -0
- package/src/components/ui/select.tsx +162 -0
- package/src/components/ui/separator.tsx +31 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/tabs.tsx +55 -0
- package/src/components/ui/textarea.tsx +24 -0
- package/src/components/ui/toast.tsx +129 -0
- package/src/components/ui/toaster.tsx +44 -0
- package/src/components/ui/toggle.tsx +45 -0
- package/src/components/ui/tooltip.tsx +30 -0
- package/src/components/ui/use-toast.ts +197 -0
- package/src/constants/index.ts +223 -0
- package/src/constants/resetCSS.ts +139 -0
- package/src/extension-bundle.ts +2 -0
- package/src/extensions/Attachment/Attachment.ts +144 -0
- package/src/extensions/Attachment/components/NodeViewAttachment/FileIcon.tsx +69 -0
- package/src/extensions/Attachment/components/NodeViewAttachment/FileIconString.ts +28 -0
- package/src/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.tsx +155 -0
- package/src/extensions/Attachment/components/NodeViewAttachment/index.module.scss +23 -0
- package/src/extensions/Attachment/index.ts +1 -0
- package/src/extensions/BaseKit.ts +253 -0
- package/src/extensions/Blockquote/Blockquote.ts +31 -0
- package/src/extensions/Blockquote/index.ts +1 -0
- package/src/extensions/Bold/Bold.ts +26 -0
- package/src/extensions/Bold/index.ts +1 -0
- package/src/extensions/BulletList/BulletList.ts +28 -0
- package/src/extensions/BulletList/index.ts +1 -0
- package/src/extensions/Clear/Clear.ts +24 -0
- package/src/extensions/Clear/index.ts +1 -0
- package/src/extensions/Code/Code.ts +26 -0
- package/src/extensions/Code/index.ts +1 -0
- package/src/extensions/CodeBlock/CodeBlock.ts +54 -0
- package/src/extensions/CodeBlock/components/CodeBlockActiveButton.tsx +66 -0
- package/src/extensions/CodeBlock/components/NodeViewCodeBlock/NodeViewCodeBlock.tsx +89 -0
- package/src/extensions/CodeBlock/components/NodeViewCodeBlock/index.module.scss +81 -0
- package/src/extensions/CodeBlock/highlighter.ts +132 -0
- package/src/extensions/CodeBlock/index.ts +1 -0
- package/src/extensions/CodeBlock/shiki-plugin.ts +213 -0
- package/src/extensions/Color/Color.ts +52 -0
- package/src/extensions/Color/components/ColorActionButton.tsx +104 -0
- package/src/extensions/Color/index.ts +1 -0
- package/src/extensions/Document/Document.ts +8 -0
- package/src/extensions/Document/index.ts +1 -0
- package/src/extensions/Drawer/Drawer.ts +177 -0
- package/src/extensions/Drawer/components/ControlDrawer/ControlDrawer.module.scss +85 -0
- package/src/extensions/Drawer/components/ControlDrawer/ControlDrawer.tsx +598 -0
- package/src/extensions/Drawer/components/ControlDrawer/icon.tsx +500 -0
- package/src/extensions/Drawer/components/DrawerActiveButton.tsx +239 -0
- package/src/extensions/Drawer/components/EditDrawerBlock.tsx +238 -0
- package/src/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.tsx +260 -0
- package/src/extensions/Drawer/index.ts +1 -0
- package/src/extensions/Emoji/Emoji.ts +146 -0
- package/src/extensions/Emoji/components/EmojiList/EmojiList.tsx +103 -0
- package/src/extensions/Emoji/components/EmojiList/emojis.ts +1858 -0
- package/src/extensions/Emoji/components/EmojiPicker/EmojiPicker.tsx +61 -0
- package/src/extensions/Emoji/index.ts +1 -0
- package/src/extensions/Excalidraw/Excalidraw.ts +123 -0
- package/src/extensions/Excalidraw/components/ExcalidrawActiveButton.tsx +138 -0
- package/src/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.tsx +178 -0
- package/src/extensions/Excalidraw/components/NodeViewExcalidraw/index.module.scss +43 -0
- package/src/extensions/Excalidraw/index.ts +1 -0
- package/src/extensions/ExportPdf/ExportPdf.ts +25 -0
- package/src/extensions/ExportPdf/index.ts +1 -0
- package/src/extensions/ExportWord/ExportWord.ts +87 -0
- package/src/extensions/ExportWord/index.ts +1 -0
- package/src/extensions/FontFamily/FontFamily.ts +64 -0
- package/src/extensions/FontFamily/components/FontFamilyButton.tsx +97 -0
- package/src/extensions/FontFamily/index.ts +1 -0
- package/src/extensions/FontSize/FontSize.ts +119 -0
- package/src/extensions/FontSize/components/FontSizeMenuButton.tsx +84 -0
- package/src/extensions/FontSize/index.ts +1 -0
- package/src/extensions/FormatPainter/FormatPainter.ts +121 -0
- package/src/extensions/FormatPainter/index.ts +1 -0
- package/src/extensions/Heading/Heading.ts +57 -0
- package/src/extensions/Heading/components/HeadingButton.tsx +96 -0
- package/src/extensions/Heading/index.ts +1 -0
- package/src/extensions/Highlight/Highlight.ts +36 -0
- package/src/extensions/Highlight/components/HighlightActionButton.tsx +108 -0
- package/src/extensions/Highlight/index.ts +1 -0
- package/src/extensions/History/History.ts +39 -0
- package/src/extensions/History/components/HistoryActionButton.tsx +74 -0
- package/src/extensions/History/index.ts +1 -0
- package/src/extensions/HorizontalRule/HorizontalRule.ts +42 -0
- package/src/extensions/HorizontalRule/index.ts +1 -0
- package/src/extensions/Iframe/Iframe.ts +140 -0
- package/src/extensions/Iframe/components/IframeNodeView.tsx +92 -0
- package/src/extensions/Iframe/components/index.module.scss +40 -0
- package/src/extensions/Iframe/embed.ts +487 -0
- package/src/extensions/Iframe/index.ts +1 -0
- package/src/extensions/Image/Image.ts +303 -0
- package/src/extensions/Image/components/ActionImageButton.tsx +186 -0
- package/src/extensions/Image/components/ImageCropper.tsx +198 -0
- package/src/extensions/Image/components/ImageView.tsx +271 -0
- package/src/extensions/Image/index.ts +1 -0
- package/src/extensions/Image/store.ts +15 -0
- package/src/extensions/ImageGif/ImageGif.ts +176 -0
- package/src/extensions/ImageGif/components/ImageGifActionButton.tsx +138 -0
- package/src/extensions/ImageGif/components/ImageGifView.tsx +260 -0
- package/src/extensions/ImageGif/index.ts +1 -0
- package/src/extensions/ImportWord/ImportWord.ts +52 -0
- package/src/extensions/ImportWord/components/ImportWordButton.tsx +151 -0
- package/src/extensions/ImportWord/index.ts +1 -0
- package/src/extensions/Indent/Indent.ts +110 -0
- package/src/extensions/Indent/index.ts +1 -0
- package/src/extensions/Italic/Italic.ts +29 -0
- package/src/extensions/Italic/index.ts +1 -0
- package/src/extensions/Katex/Katex.ts +109 -0
- package/src/extensions/Katex/components/KatexActiveButton.tsx +117 -0
- package/src/extensions/Katex/components/KatexWrapper.tsx +53 -0
- package/src/extensions/Katex/index.ts +1 -0
- package/src/extensions/LineHeight/LineHeight.ts +76 -0
- package/src/extensions/LineHeight/components/LineHeightDropdown.tsx +93 -0
- package/src/extensions/LineHeight/index.ts +1 -0
- package/src/extensions/Link/Link.ts +92 -0
- package/src/extensions/Link/components/LinkEditBlock.tsx +110 -0
- package/src/extensions/Link/components/LinkEditPopover.tsx +46 -0
- package/src/extensions/Link/components/LinkViewBlock.tsx +54 -0
- package/src/extensions/Link/index.ts +1 -0
- package/src/extensions/ListItem/ListItem.ts +1 -0
- package/src/extensions/ListItem/index.ts +1 -0
- package/src/extensions/Mention/Mention.ts +100 -0
- package/src/extensions/Mention/components/NodeViewMentionList/NodeViewMentionList.tsx +94 -0
- package/src/extensions/Mention/components/NodeViewMentionList/index.module.scss +38 -0
- package/src/extensions/Mention/index.ts +1 -0
- package/src/extensions/Mermaid/Mermaid.ts +177 -0
- package/src/extensions/Mermaid/components/EditMermaidBlock.tsx +155 -0
- package/src/extensions/Mermaid/components/MermaidActiveButton.tsx +151 -0
- package/src/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.tsx +260 -0
- package/src/extensions/Mermaid/index.ts +1 -0
- package/src/extensions/MoreMark/MoreMark.ts +102 -0
- package/src/extensions/MoreMark/components/ActionMoreButton.tsx +97 -0
- package/src/extensions/MoreMark/index.ts +1 -0
- package/src/extensions/MultiColumn/Column.ts +36 -0
- package/src/extensions/MultiColumn/MultiColumn.ts +111 -0
- package/src/extensions/MultiColumn/components/ColumnActionButton.ts +22 -0
- package/src/extensions/MultiColumn/index.ts +3 -0
- package/src/extensions/OrderedList/OrderedList.ts +28 -0
- package/src/extensions/OrderedList/index.ts +1 -0
- package/src/extensions/SearchAndReplace/SearchAndReplace.ts +395 -0
- package/src/extensions/SearchAndReplace/components/SearchAndReplaceButton.tsx +190 -0
- package/src/extensions/SearchAndReplace/index.ts +1 -0
- package/src/extensions/Selection/Selection.ts +32 -0
- package/src/extensions/Selection/index.ts +1 -0
- package/src/extensions/SlashCommand/SlashCommand.ts +255 -0
- package/src/extensions/SlashCommand/components/CommandsList.tsx +180 -0
- package/src/extensions/SlashCommand/groups.ts +183 -0
- package/src/extensions/SlashCommand/index.ts +1 -0
- package/src/extensions/SlashCommand/types.ts +24 -0
- package/src/extensions/Strike/Strike.ts +26 -0
- package/src/extensions/Strike/index.ts +1 -0
- package/src/extensions/Subscript/Subscript.ts +88 -0
- package/src/extensions/Subscript/index.ts +1 -0
- package/src/extensions/Table/Cell.ts +131 -0
- package/src/extensions/Table/Header.ts +93 -0
- package/src/extensions/Table/Row.ts +8 -0
- package/src/extensions/Table/Table.ts +60 -0
- package/src/extensions/Table/cell-background.ts +112 -0
- package/src/extensions/Table/components/CreateTablePopover.tsx +132 -0
- package/src/extensions/Table/components/TableActionButton.tsx +42 -0
- package/src/extensions/Table/index.ts +6 -0
- package/src/extensions/Table/utils.ts +352 -0
- package/src/extensions/TableOfContent/TableOfContent.ts +124 -0
- package/src/extensions/TableOfContent/components/NodeViewTableOfContent.tsx +116 -0
- package/src/extensions/TableOfContent/components/TableOfContentActionButton.tsx +27 -0
- package/src/extensions/TableOfContent/components/index.module.scss +40 -0
- package/src/extensions/TableOfContent/index.ts +1 -0
- package/src/extensions/TaskList/TaskList.ts +46 -0
- package/src/extensions/TaskList/index.ts +1 -0
- package/src/extensions/TextAlign/TextAlign.ts +68 -0
- package/src/extensions/TextAlign/components/TextAlignMenuButton.tsx +103 -0
- package/src/extensions/TextAlign/index.ts +1 -0
- package/src/extensions/TextBubble/TextBubble.ts +22 -0
- package/src/extensions/TextBubble/components/TextDropdown.tsx +146 -0
- package/src/extensions/TextBubble/index.ts +1 -0
- package/src/extensions/TextDirection/TextDirection.ts +97 -0
- package/src/extensions/TextDirection/components/TextDirectionButton.tsx +103 -0
- package/src/extensions/TextDirection/index.ts +1 -0
- package/src/extensions/TrailingNode/TrailingNode.ts +71 -0
- package/src/extensions/TrailingNode/index.ts +1 -0
- package/src/extensions/Twitter/Twitter.ts +161 -0
- package/src/extensions/Twitter/components/FormEditLinkTwitter.tsx +68 -0
- package/src/extensions/Twitter/components/NodeViewTweet.tsx +30 -0
- package/src/extensions/Twitter/components/TwitterActiveButton.tsx +41 -0
- package/src/extensions/Twitter/index.ts +1 -0
- package/src/extensions/UnderLine/Underline.ts +30 -0
- package/src/extensions/UnderLine/index.ts +1 -0
- package/src/extensions/Video/Video.ts +204 -0
- package/src/extensions/Video/components/ActiveVideoButton.tsx +191 -0
- package/src/extensions/Video/index.ts +1 -0
- package/src/extensions/Video/store.ts +15 -0
- package/src/extensions/index.ts +122 -0
- package/src/hooks/useActive.tsx +24 -0
- package/src/hooks/useAttributes.tsx +45 -0
- package/src/hooks/useCopy.tsx +20 -0
- package/src/hooks/useEditorState.tsx +23 -0
- package/src/hooks/useExtension.tsx +29 -0
- package/src/index.ts +8 -0
- package/src/lib/utils.ts +7 -0
- package/src/locale-bundle.ts +3 -0
- package/src/locales/en.ts +173 -0
- package/src/locales/hu.ts +173 -0
- package/src/locales/index.tsx +163 -0
- package/src/locales/pt-br.ts +173 -0
- package/src/locales/vi.ts +173 -0
- package/src/locales/zh-cn.ts +173 -0
- package/src/plugins/DragHandle/index.ts +375 -0
- package/src/plugins/DragHandle/range.ts +114 -0
- package/src/plugins/DragHandle/utils.ts +80 -0
- package/src/plugins/image-upload.ts +160 -0
- package/src/store/ProviderRichText.tsx +53 -0
- package/src/store/editableEditor.ts +15 -0
- package/src/store/fast-context.tsx +70 -0
- package/src/store/store.ts +35 -0
- package/src/styles/ProseMirror.scss +176 -0
- package/src/styles/columns.scss +23 -0
- package/src/styles/editor.scss +411 -0
- package/src/styles/global.scss +87 -0
- package/src/styles/index.scss +5 -0
- package/src/styles/mention.scss +6 -0
- package/src/theme/theme.ts +15 -0
- package/src/types.ts +271 -0
- package/src/utils/_event.ts +55 -0
- package/src/utils/color.ts +67 -0
- package/src/utils/columns.ts +142 -0
- package/src/utils/customEvents/customEvents.ts +18 -0
- package/src/utils/customEvents/events.constant.ts +11 -0
- package/src/utils/delete-node.ts +46 -0
- package/src/utils/dom-dataset.ts +121 -0
- package/src/utils/download.ts +17 -0
- package/src/utils/dynamicCSS.ts +192 -0
- package/src/utils/editor-container-size.ts +28 -0
- package/src/utils/file.ts +112 -0
- package/src/utils/getRenderContainer.ts +41 -0
- package/src/utils/indent.ts +99 -0
- package/src/utils/is-mobile.ts +57 -0
- package/src/utils/json.ts +18 -0
- package/src/utils/line-height.ts +109 -0
- package/src/utils/lru-cache.ts +145 -0
- package/src/utils/mitt.ts +114 -0
- package/src/utils/node.ts +92 -0
- package/src/utils/pdf.ts +72 -0
- package/src/utils/plateform.ts +49 -0
- package/src/utils/shortId.ts +5 -0
- package/src/utils/storage.ts +18 -0
- package/src/utils/utils.ts +71 -0
- package/src/vite-env.d.ts +3 -0
- package/lib/RichTextEditor-BC85Dn21.js +0 -8826
- package/lib/RichTextEditor-Cxm0yJdr.cjs +0 -141
- package/lib/extension-bundle.cjs +0 -33
- package/lib/extension-bundle.d.cts +0 -947
- package/lib/extension-bundle.d.ts +0 -947
- package/lib/extension-bundle.js +0 -5755
- package/lib/index-DV-nXpU1.cjs +0 -1
- package/lib/index-M6H3FoBi.js +0 -1147
- package/lib/index.cjs +0 -1
- package/lib/index.d.cts +0 -511
- package/lib/index.d.ts +0 -511
- package/lib/index.js +0 -16
- package/lib/locale-bundle.cjs +0 -1
- package/lib/locale-bundle.d.cts +0 -1140
- package/lib/locale-bundle.d.ts +0 -1140
- package/lib/locale-bundle.js +0 -9
- package/lib/style.css +0 -1
- package/lib/tiptap-DkWHMWDt.js +0 -6061
- package/lib/tiptap-gBG-1T-V.cjs +0 -116
- package/lib/vendor-BJ0Yf78E.cjs +0 -8114
- package/lib/vendor-Cpa6z-M0.js +0 -67575
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Editor } from '@tiptap/core';
|
|
4
|
+
import { isActive } from '@tiptap/core';
|
|
5
|
+
import { TextSelection } from '@tiptap/pm/state';
|
|
6
|
+
import { BubbleMenu } from '@tiptap/react';
|
|
7
|
+
import type { GetReferenceClientRect } from 'tippy.js';
|
|
8
|
+
import { sticky } from 'tippy.js';
|
|
9
|
+
|
|
10
|
+
import { ActionButton, type ActionButtonProps, getBubbleText, ItemA, Separator } from '@/components';
|
|
11
|
+
import HighlightActionButton from '@/extensions/Highlight/components/HighlightActionButton';
|
|
12
|
+
import {
|
|
13
|
+
isColumnGripSelected,
|
|
14
|
+
isRowGripSelected,
|
|
15
|
+
} from '@/extensions/Table/utils';
|
|
16
|
+
import { useLocale } from '@/locales';
|
|
17
|
+
import { type ShouldShowProps } from '@/types';
|
|
18
|
+
|
|
19
|
+
import BubbleMenuContent from './BubbleMenuContent';
|
|
20
|
+
|
|
21
|
+
export interface TableBubbleMenuProps {
|
|
22
|
+
editor: Editor;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
actions?: ActionButtonProps[];
|
|
25
|
+
items?: string[]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function TableRowBubbleMenu ({ editor, disabled }: TableBubbleMenuProps) {
|
|
29
|
+
const { t } = useLocale();
|
|
30
|
+
const shouldShow = useCallback(
|
|
31
|
+
({ view, state, from }: ShouldShowProps) => {
|
|
32
|
+
if (!state || !from) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return isRowGripSelected({ editor, view, state, from });
|
|
37
|
+
},
|
|
38
|
+
[editor]
|
|
39
|
+
);
|
|
40
|
+
function onAddRowAbove() {
|
|
41
|
+
editor.chain().focus().addRowBefore().run();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function onAddRowBelow() {
|
|
45
|
+
editor.chain().focus().addRowAfter().run();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function onDeleteRow() {
|
|
49
|
+
editor.chain().focus().deleteRow().run();
|
|
50
|
+
}
|
|
51
|
+
if(disabled) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return (
|
|
55
|
+
<BubbleMenu
|
|
56
|
+
editor={editor}
|
|
57
|
+
pluginKey="tableRowMenu"
|
|
58
|
+
shouldShow={shouldShow}
|
|
59
|
+
updateDelay={0}
|
|
60
|
+
tippyOptions={{
|
|
61
|
+
placement: 'left',
|
|
62
|
+
offset: [0, 15],
|
|
63
|
+
popperOptions: {
|
|
64
|
+
modifiers: [{ name: 'flip', enabled: false }],
|
|
65
|
+
},
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<BubbleMenuContent vertical>
|
|
69
|
+
<ActionButton
|
|
70
|
+
action={onAddRowAbove}
|
|
71
|
+
disabled={!editor?.can().addRowBefore?.()}
|
|
72
|
+
icon="BetweenVerticalEnd"
|
|
73
|
+
tooltip={t('editor.table.menu.insertRowAbove')}
|
|
74
|
+
tooltip-options={{
|
|
75
|
+
sideOffset: 15,
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<ActionButton
|
|
80
|
+
action={onAddRowBelow}
|
|
81
|
+
disabled={!editor?.can()?.addRowAfter?.()}
|
|
82
|
+
icon="BetweenVerticalStart"
|
|
83
|
+
tooltip={t('editor.table.menu.insertRowBelow')}
|
|
84
|
+
tooltip-options={{
|
|
85
|
+
sideOffset: 15,
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
<ActionButton
|
|
90
|
+
action={onDeleteRow}
|
|
91
|
+
disabled={!editor?.can()?.deleteRow?.()}
|
|
92
|
+
icon="DeleteRow"
|
|
93
|
+
tooltip={t('editor.table.menu.deleteRow')}
|
|
94
|
+
tooltip-options={{
|
|
95
|
+
sideOffset: 15,
|
|
96
|
+
}}
|
|
97
|
+
/>
|
|
98
|
+
</BubbleMenuContent>
|
|
99
|
+
</BubbleMenu>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function TableColBubbleMenu({ editor, disabled }: TableBubbleMenuProps) {
|
|
104
|
+
const { t } = useLocale();
|
|
105
|
+
const shouldShow = useCallback(
|
|
106
|
+
({ view, state, from }: ShouldShowProps) => {
|
|
107
|
+
if (!state) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return isColumnGripSelected({ editor, view, state, from: from || 0 });
|
|
112
|
+
},
|
|
113
|
+
[editor]
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
function onAddColumnBefore() {
|
|
117
|
+
editor.chain().focus().addColumnBefore().run();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function onAddColumnAfter() {
|
|
121
|
+
editor.chain().focus().addColumnAfter().run();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function onDeleteColumn() {
|
|
125
|
+
editor.chain().focus().deleteColumn().run();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if(disabled) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<BubbleMenu
|
|
134
|
+
editor={editor}
|
|
135
|
+
pluginKey="tableColumnMenu"
|
|
136
|
+
shouldShow={shouldShow}
|
|
137
|
+
updateDelay={0}
|
|
138
|
+
tippyOptions={{
|
|
139
|
+
offset: [0, 15],
|
|
140
|
+
popperOptions: {
|
|
141
|
+
modifiers: [{ name: 'flip', enabled: false }],
|
|
142
|
+
},
|
|
143
|
+
}}
|
|
144
|
+
>
|
|
145
|
+
<BubbleMenuContent>
|
|
146
|
+
<ActionButton
|
|
147
|
+
action={onAddColumnBefore}
|
|
148
|
+
disabled={!editor?.can()?.addColumnBefore?.()}
|
|
149
|
+
icon="BetweenHorizonalEnd"
|
|
150
|
+
tooltip={t('editor.table.menu.insertColumnBefore')}
|
|
151
|
+
tooltip-options={{
|
|
152
|
+
sideOffset: 15,
|
|
153
|
+
}}
|
|
154
|
+
/>
|
|
155
|
+
|
|
156
|
+
<ActionButton
|
|
157
|
+
action={onAddColumnAfter}
|
|
158
|
+
disabled={!editor?.can()?.addColumnAfter?.()}
|
|
159
|
+
icon="BetweenHorizonalStart"
|
|
160
|
+
tooltip={t('editor.table.menu.insertColumnAfter')}
|
|
161
|
+
tooltip-options={{
|
|
162
|
+
sideOffset: 15,
|
|
163
|
+
}}
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
<ActionButton
|
|
167
|
+
action={onDeleteColumn}
|
|
168
|
+
disabled={!editor?.can().deleteColumn?.()}
|
|
169
|
+
icon="DeleteColumn"
|
|
170
|
+
tooltip={t('editor.table.menu.deleteColumn')}
|
|
171
|
+
tooltip-options={{
|
|
172
|
+
sideOffset: 15,
|
|
173
|
+
}}
|
|
174
|
+
/>
|
|
175
|
+
</BubbleMenuContent>
|
|
176
|
+
</BubbleMenu>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function TableMainBubbleMenu({ editor, disabled, actions, ...props }: TableBubbleMenuProps) {
|
|
181
|
+
|
|
182
|
+
const shouldSelectionShow = ({ editor, view, state, from }: ShouldShowProps) => {
|
|
183
|
+
const { selection } = editor.view.state;
|
|
184
|
+
const { $from, to } = selection;
|
|
185
|
+
|
|
186
|
+
// check content select length is not empty
|
|
187
|
+
if ($from.pos === to) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!state || !from) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
selection instanceof TextSelection ||
|
|
197
|
+
isRowGripSelected({ editor, view, state, from }) ||
|
|
198
|
+
isColumnGripSelected({ editor, view, state, from })
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const shouldActiveShow = ({ editor }: { editor: Editor }) => {
|
|
203
|
+
return isActive(editor.view.state, 'table');
|
|
204
|
+
};
|
|
205
|
+
const shouldShow = (showProps: ShouldShowProps) => {
|
|
206
|
+
return shouldActiveShow(showProps) && !shouldSelectionShow(showProps);
|
|
207
|
+
};
|
|
208
|
+
const { t, lang } = useLocale();
|
|
209
|
+
|
|
210
|
+
function onMergeCell() {
|
|
211
|
+
editor.chain().focus().mergeCells().run();
|
|
212
|
+
}
|
|
213
|
+
function onSplitCell() {
|
|
214
|
+
editor?.chain().focus().splitCell().run();
|
|
215
|
+
}
|
|
216
|
+
function onDeleteTable() {
|
|
217
|
+
editor.chain().focus().deleteTable().run();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function onSetCellBackground(color: string) {
|
|
221
|
+
editor.chain().focus().setTableCellBackground(color).run();
|
|
222
|
+
}
|
|
223
|
+
const getReferenceClientRect: GetReferenceClientRect = () => {
|
|
224
|
+
const {
|
|
225
|
+
view,
|
|
226
|
+
state: {
|
|
227
|
+
selection: { from },
|
|
228
|
+
},
|
|
229
|
+
} = editor;
|
|
230
|
+
|
|
231
|
+
const node = view.domAtPos(from).node as HTMLElement;
|
|
232
|
+
if (!node) {
|
|
233
|
+
return new DOMRect(-1000, -1000, 0, 0);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const tableWrapper = node?.closest?.('.tableWrapper');
|
|
237
|
+
if (!tableWrapper) {
|
|
238
|
+
return new DOMRect(-1000, -1000, 0, 0);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const rect = tableWrapper.getBoundingClientRect();
|
|
242
|
+
|
|
243
|
+
return rect;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const items = useMemo(() => {
|
|
247
|
+
if (disabled || !editor) {
|
|
248
|
+
return [];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return getBubbleText(editor, t, props.items || []);
|
|
252
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
253
|
+
}, [disabled, editor, props.items, lang, t]);
|
|
254
|
+
|
|
255
|
+
if(disabled) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return (
|
|
260
|
+
<BubbleMenu
|
|
261
|
+
editor={editor}
|
|
262
|
+
pluginKey="table"
|
|
263
|
+
shouldShow={shouldShow}
|
|
264
|
+
updateDelay={0}
|
|
265
|
+
tippyOptions={{
|
|
266
|
+
offset: [0, 15],
|
|
267
|
+
popperOptions: {
|
|
268
|
+
modifiers: [{ name: 'flip', enabled: false }],
|
|
269
|
+
},
|
|
270
|
+
maxWidth: 'auto',
|
|
271
|
+
getReferenceClientRect,
|
|
272
|
+
plugins: [sticky],
|
|
273
|
+
sticky: 'popper',
|
|
274
|
+
}}
|
|
275
|
+
>
|
|
276
|
+
<BubbleMenuContent>
|
|
277
|
+
{actions && (
|
|
278
|
+
<>
|
|
279
|
+
{actions.map((item, i) => (
|
|
280
|
+
<ActionButton key={i} {...item} />
|
|
281
|
+
))}
|
|
282
|
+
|
|
283
|
+
<Separator
|
|
284
|
+
className="!mx-1 !my-2 !h-[16px]"
|
|
285
|
+
orientation="vertical"
|
|
286
|
+
/>
|
|
287
|
+
</>
|
|
288
|
+
)}
|
|
289
|
+
|
|
290
|
+
{props.items && (
|
|
291
|
+
<>
|
|
292
|
+
{items.map((item, i) => (
|
|
293
|
+
<ItemA
|
|
294
|
+
key={i}
|
|
295
|
+
disabled={disabled}
|
|
296
|
+
editor={editor}
|
|
297
|
+
item={item} />
|
|
298
|
+
))}
|
|
299
|
+
|
|
300
|
+
<Separator
|
|
301
|
+
className="!mx-1 !my-2 !h-[16px]"
|
|
302
|
+
orientation="vertical"
|
|
303
|
+
/>
|
|
304
|
+
</>
|
|
305
|
+
)}
|
|
306
|
+
|
|
307
|
+
<ActionButton
|
|
308
|
+
action={onMergeCell}
|
|
309
|
+
disabled={!editor?.can()?.mergeCells?.()}
|
|
310
|
+
icon="TableCellsMerge"
|
|
311
|
+
tooltip={t('editor.table.menu.mergeCells')}
|
|
312
|
+
tooltip-options={{
|
|
313
|
+
sideOffset: 15,
|
|
314
|
+
}}
|
|
315
|
+
/>
|
|
316
|
+
|
|
317
|
+
<ActionButton
|
|
318
|
+
action={onSplitCell}
|
|
319
|
+
disabled={!editor?.can()?.splitCell?.()}
|
|
320
|
+
icon="TableCellsSplit"
|
|
321
|
+
tooltip={t('editor.table.menu.splitCells')}
|
|
322
|
+
tooltip-options={{
|
|
323
|
+
sideOffset: 15,
|
|
324
|
+
}}
|
|
325
|
+
/>
|
|
326
|
+
|
|
327
|
+
<Separator className="!mx-1 !my-2 !h-[16px]" orientation="vertical" />
|
|
328
|
+
|
|
329
|
+
<HighlightActionButton
|
|
330
|
+
action={onSetCellBackground}
|
|
331
|
+
editor={editor}
|
|
332
|
+
tooltip={t('editor.table.menu.setCellsBgColor')}
|
|
333
|
+
tooltipOptions={{
|
|
334
|
+
sideOffset: 15,
|
|
335
|
+
}}
|
|
336
|
+
/>
|
|
337
|
+
|
|
338
|
+
<ActionButton
|
|
339
|
+
action={onDeleteTable}
|
|
340
|
+
disabled={!editor?.can()?.deleteTable?.()}
|
|
341
|
+
icon="Trash2"
|
|
342
|
+
tooltip={t('editor.table.menu.deleteTable')}
|
|
343
|
+
tooltip-options={{
|
|
344
|
+
sideOffset: 15,
|
|
345
|
+
}}
|
|
346
|
+
/>
|
|
347
|
+
</BubbleMenuContent>
|
|
348
|
+
</BubbleMenu>
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function TableBubbleMenu(props: TableBubbleMenuProps) {
|
|
353
|
+
return (
|
|
354
|
+
<>
|
|
355
|
+
<TableMainBubbleMenu {...props} />
|
|
356
|
+
<TableRowBubbleMenu {...props} />
|
|
357
|
+
<TableColBubbleMenu {...props} />
|
|
358
|
+
</>
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export { TableBubbleMenu };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './bubble';
|
|
2
|
+
export * from './components/ContentMenu';
|
|
3
|
+
export * from './components/BubbleMenuText';
|
|
4
|
+
export * from './components/TableBubbleMenu';
|
|
5
|
+
export * from './components/BubbleMenuLink';
|
|
6
|
+
export * from './components/BubbleMenuMedia';
|
|
7
|
+
export * from './components/ColumnsBubbleMenu';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { type VariantProps, cva } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
import { cn } from '@/lib/utils';
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: '!bg-primary !text-primary-foreground hover:!bg-primary/90',
|
|
13
|
+
destructive:
|
|
14
|
+
'bg-destructive text-destructive-foreground hover:bg-destructive/90',
|
|
15
|
+
outline:
|
|
16
|
+
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
|
17
|
+
secondary:
|
|
18
|
+
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
19
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
20
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: 'h-10 px-4 py-2',
|
|
24
|
+
sm: 'h-9 rounded-md px-3',
|
|
25
|
+
lg: 'h-11 rounded-md px-8',
|
|
26
|
+
icon: 'h-10 w-10',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: 'default',
|
|
31
|
+
size: 'default',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export interface ButtonProps
|
|
37
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
38
|
+
VariantProps<typeof buttonVariants> {
|
|
39
|
+
asChild?: boolean
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
43
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
44
|
+
const Comp = asChild ? Slot : 'button';
|
|
45
|
+
return (
|
|
46
|
+
<Comp
|
|
47
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
48
|
+
ref={ref}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
Button.displayName = 'Button';
|
|
55
|
+
|
|
56
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
5
|
+
import { Check } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
8
|
+
|
|
9
|
+
const Checkbox = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
12
|
+
>(({ className, ...props }, ref) => (
|
|
13
|
+
<CheckboxPrimitive.Root
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn(
|
|
16
|
+
'!peer !h-4 !w-4 !p-0 !shrink-0 !rounded-sm !border !border-primary !ring-offset-background focus-visible:!outline-none focus-visible:!ring-2 focus-visible:!ring-ring focus-visible:!ring-offset-2 disabled:!cursor-not-allowed disabled:!opacity-50 data-[state=checked]:!bg-primary data-[state=checked]:!text-primary-foreground',
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
<CheckboxPrimitive.Indicator
|
|
22
|
+
className={cn('!flex !p-0 !items-center !justify-center !text-current')}
|
|
23
|
+
>
|
|
24
|
+
<Check className="!h-4 !w-4" />
|
|
25
|
+
</CheckboxPrimitive.Indicator>
|
|
26
|
+
</CheckboxPrimitive.Root>
|
|
27
|
+
));
|
|
28
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
29
|
+
|
|
30
|
+
export { Checkbox };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
5
|
+
import { X } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
8
|
+
|
|
9
|
+
const Dialog = DialogPrimitive.Root;
|
|
10
|
+
|
|
11
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
12
|
+
|
|
13
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
14
|
+
|
|
15
|
+
const DialogClose = DialogPrimitive.Close;
|
|
16
|
+
|
|
17
|
+
const DialogOverlay = React.forwardRef<
|
|
18
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
19
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
20
|
+
>(({ className, ...props }, ref) => (
|
|
21
|
+
<DialogPrimitive.Overlay
|
|
22
|
+
ref={ref}
|
|
23
|
+
className={cn(
|
|
24
|
+
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
));
|
|
30
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
31
|
+
|
|
32
|
+
const DialogContent = React.forwardRef<
|
|
33
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
34
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
35
|
+
>(({ className, children, ...props }, ref) => (
|
|
36
|
+
<DialogPortal>
|
|
37
|
+
<DialogOverlay />
|
|
38
|
+
<DialogPrimitive.Content
|
|
39
|
+
ref={ref}
|
|
40
|
+
className={cn(
|
|
41
|
+
'dialog-content fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
48
|
+
<X className="h-4 w-4" />
|
|
49
|
+
<span className="sr-only">
|
|
50
|
+
Close
|
|
51
|
+
</span>
|
|
52
|
+
</DialogPrimitive.Close>
|
|
53
|
+
</DialogPrimitive.Content>
|
|
54
|
+
</DialogPortal>
|
|
55
|
+
));
|
|
56
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
57
|
+
|
|
58
|
+
function DialogHeader({
|
|
59
|
+
className,
|
|
60
|
+
...props
|
|
61
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
className={cn(
|
|
65
|
+
'flex flex-col space-y-1.5 text-center sm:text-left',
|
|
66
|
+
className,
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
DialogHeader.displayName = 'DialogHeader';
|
|
73
|
+
|
|
74
|
+
function DialogFooter({
|
|
75
|
+
className,
|
|
76
|
+
...props
|
|
77
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
78
|
+
return (
|
|
79
|
+
<div
|
|
80
|
+
className={cn(
|
|
81
|
+
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
|
|
82
|
+
className,
|
|
83
|
+
)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
DialogFooter.displayName = 'DialogFooter';
|
|
89
|
+
|
|
90
|
+
const DialogTitle = React.forwardRef<
|
|
91
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
92
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
93
|
+
>(({ className, ...props }, ref) => (
|
|
94
|
+
<DialogPrimitive.Title
|
|
95
|
+
ref={ref}
|
|
96
|
+
className={cn(
|
|
97
|
+
'text-lg font-semibold leading-none tracking-tight',
|
|
98
|
+
className,
|
|
99
|
+
)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
));
|
|
103
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
104
|
+
|
|
105
|
+
const DialogDescription = React.forwardRef<
|
|
106
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
107
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
108
|
+
>(({ className, ...props }, ref) => (
|
|
109
|
+
<DialogPrimitive.Description
|
|
110
|
+
ref={ref}
|
|
111
|
+
className={cn('text-sm text-muted-foreground', className)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
));
|
|
115
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
Dialog,
|
|
119
|
+
DialogPortal,
|
|
120
|
+
DialogOverlay,
|
|
121
|
+
DialogClose,
|
|
122
|
+
DialogTrigger,
|
|
123
|
+
DialogContent,
|
|
124
|
+
DialogHeader,
|
|
125
|
+
DialogFooter,
|
|
126
|
+
DialogTitle,
|
|
127
|
+
DialogDescription,
|
|
128
|
+
};
|